Added a bunch of functions to Lua wrapper

This commit is contained in:
MysterD 2022-02-04 19:13:15 -08:00
parent f4279924fb
commit 434176e7d6
4 changed files with 1384 additions and 0 deletions

View file

@ -28,6 +28,11 @@ in_files = [
"src/pc/djui/djui_popup.h",
"src/pc/network/network_utils.h",
"src/pc/djui/djui_chat_message.h",
#"src/game/print.h",
"src/game/interaction.h",
"src/game/level_info.h",
"src/game/save_file.h",
"src/game/sound_init.h",
]
override_allowed_functions = {
@ -35,6 +40,7 @@ override_allowed_functions = {
"src/game/camera.h": [ "set_.*camera_.*shake" ],
"src/game/thread6.c": [ "queue_rumble_"],
"src/pc/djui/djui_popup.h" : [ "create" ],
"src/game/save_file.h": [ "save_file_get_" ],
}
override_disallowed_functions = {
@ -50,6 +56,9 @@ override_disallowed_functions = {
"src/game/mario_step.h": [ " stub_mario_step", "transfer_bully_speed"],
"src/game/mario.h": [ " init_mario" ],
"src/pc/djui/djui_chat_message.h": [ "create_from" ],
#"src/game/print.h": [ "_fmt_", "render_" ],
"src/game/interaction.h": [ "process_interactions", "_handle_" ],
"src/game/sound_init.h": [ "_loop_", "thread4_", "set_sound_mode" ],
}
###########################################################
@ -70,6 +79,11 @@ template = """/* THIS FILE IS AUTOGENERATED */
#include "engine/surface_collision.h"
#include "pc/network/network_utils.h"
#include "src/pc/djui/djui_popup.h"
#include "src/game/print.h"
#include "src/game/interaction.h"
#include "src/game/level_info.h"
#include "src/game/save_file.h"
#include "src/game/sound_init.h"
$[FUNCTIONS]
@ -204,6 +218,8 @@ def build_call(function):
lfunc = 'lua_pushboolean'
elif ftype == 'char*':
lfunc = 'lua_pushstring'
elif ftype == 'const char*':
lfunc = 'lua_pushstring'
elif '???' not in flot and flot != 'LOT_NONE':
return ' smlua_push_object(L, %s, %s);\n' % (flot, ccall)

View file

@ -51,6 +51,28 @@
<br />
- interaction.h
- [does_mario_have_hat](#does_mario_have_hat)
- [get_door_save_file_flag](#get_door_save_file_flag)
- [mario_blow_off_cap](#mario_blow_off_cap)
- [mario_check_object_grab](#mario_check_object_grab)
- [mario_drop_held_object](#mario_drop_held_object)
- [mario_get_collided_object](#mario_get_collided_object)
- [mario_grab_used_object](#mario_grab_used_object)
- [mario_lose_cap_to_enemy](#mario_lose_cap_to_enemy)
- [mario_obj_angle_to_object](#mario_obj_angle_to_object)
- [mario_retrieve_cap](#mario_retrieve_cap)
- [mario_stop_riding_and_holding](#mario_stop_riding_and_holding)
- [mario_stop_riding_object](#mario_stop_riding_object)
- [mario_throw_held_object](#mario_throw_held_object)
<br />
- level_info.h
- [get_level_name](#get_level_name)
<br />
- mario.h
- [adjust_sound_for_speed](#adjust_sound_for_speed)
- [check_common_action_exits](#check_common_action_exits)
@ -248,6 +270,39 @@
<br />
- save_file.h
- [save_file_get_cap_pos](#save_file_get_cap_pos)
- [save_file_get_course_coin_score](#save_file_get_course_coin_score)
- [save_file_get_course_star_count](#save_file_get_course_star_count)
- [save_file_get_flags](#save_file_get_flags)
- [save_file_get_max_coin_score](#save_file_get_max_coin_score)
- [save_file_get_sound_mode](#save_file_get_sound_mode)
- [save_file_get_star_flags](#save_file_get_star_flags)
- [save_file_get_total_star_count](#save_file_get_total_star_count)
<br />
- sound_init.h
- [disable_background_sound](#disable_background_sound)
- [enable_background_sound](#enable_background_sound)
- [fadeout_cap_music](#fadeout_cap_music)
- [fadeout_level_music](#fadeout_level_music)
- [fadeout_music](#fadeout_music)
- [lower_background_noise](#lower_background_noise)
- [play_cap_music](#play_cap_music)
- [play_cutscene_music](#play_cutscene_music)
- [play_infinite_stairs_music](#play_infinite_stairs_music)
- [play_menu_sounds](#play_menu_sounds)
- [play_painting_eject_sound](#play_painting_eject_sound)
- [play_shell_music](#play_shell_music)
- [raise_background_noise](#raise_background_noise)
- [reset_volume](#reset_volume)
- [set_background_music](#set_background_music)
- [stop_cap_music](#stop_cap_music)
- [stop_shell_music](#stop_shell_music)
<br />
- surface_collision.h
- [find_floor_height](#find_floor_height)
- [find_poison_gas_level](#find_poison_gas_level)
@ -910,6 +965,304 @@
<br />
---
# functions from interaction.h
<br />
## [does_mario_have_hat](#does_mario_have_hat)
### Lua Example
`local integerValue = does_mario_have_hat(m)`
### Parameters
| Field | Type |
| ----- | ---- |
| m | [MarioState](structs.md#MarioState) |
### Returns
- integer
### C Prototype
`u32 does_mario_have_hat(struct MarioState *m);`
[:arrow_up_small:](#)
<br />
## [get_door_save_file_flag](#get_door_save_file_flag)
### Lua Example
`local integerValue = get_door_save_file_flag(door)`
### Parameters
| Field | Type |
| ----- | ---- |
| door | [Object](structs.md#Object) |
### Returns
- integer
### C Prototype
`u32 get_door_save_file_flag(struct Object *door);`
[:arrow_up_small:](#)
<br />
## [mario_blow_off_cap](#mario_blow_off_cap)
### Lua Example
`mario_blow_off_cap(m, capSpeed)`
### Parameters
| Field | Type |
| ----- | ---- |
| m | [MarioState](structs.md#MarioState) |
| capSpeed | number |
### Returns
- None
### C Prototype
`void mario_blow_off_cap(struct MarioState *m, f32 capSpeed);`
[:arrow_up_small:](#)
<br />
## [mario_check_object_grab](#mario_check_object_grab)
### Lua Example
`local integerValue = mario_check_object_grab(m)`
### Parameters
| Field | Type |
| ----- | ---- |
| m | [MarioState](structs.md#MarioState) |
### Returns
- integer
### C Prototype
`u32 mario_check_object_grab(struct MarioState *m);`
[:arrow_up_small:](#)
<br />
## [mario_drop_held_object](#mario_drop_held_object)
### Lua Example
`mario_drop_held_object(m)`
### Parameters
| Field | Type |
| ----- | ---- |
| m | [MarioState](structs.md#MarioState) |
### Returns
- None
### C Prototype
`void mario_drop_held_object(struct MarioState *m);`
[:arrow_up_small:](#)
<br />
## [mario_get_collided_object](#mario_get_collided_object)
### Lua Example
`local ObjectValue = mario_get_collided_object(m, interactType)`
### Parameters
| Field | Type |
| ----- | ---- |
| m | [MarioState](structs.md#MarioState) |
| interactType | integer |
### Returns
[Object](structs.md#Object)
### C Prototype
`struct Object *mario_get_collided_object(struct MarioState *m, u32 interactType);`
[:arrow_up_small:](#)
<br />
## [mario_grab_used_object](#mario_grab_used_object)
### Lua Example
`mario_grab_used_object(m)`
### Parameters
| Field | Type |
| ----- | ---- |
| m | [MarioState](structs.md#MarioState) |
### Returns
- None
### C Prototype
`void mario_grab_used_object(struct MarioState *m);`
[:arrow_up_small:](#)
<br />
## [mario_lose_cap_to_enemy](#mario_lose_cap_to_enemy)
### Lua Example
`local integerValue = mario_lose_cap_to_enemy(m, arg)`
### Parameters
| Field | Type |
| ----- | ---- |
| m | [MarioState](structs.md#MarioState) |
| arg | integer |
### Returns
- integer
### C Prototype
`u32 mario_lose_cap_to_enemy(struct MarioState* m, u32 arg);`
[:arrow_up_small:](#)
<br />
## [mario_obj_angle_to_object](#mario_obj_angle_to_object)
### Lua Example
`local integerValue = mario_obj_angle_to_object(m, o)`
### Parameters
| Field | Type |
| ----- | ---- |
| m | [MarioState](structs.md#MarioState) |
| o | [Object](structs.md#Object) |
### Returns
- integer
### C Prototype
`s16 mario_obj_angle_to_object(struct MarioState *m, struct Object *o);`
[:arrow_up_small:](#)
<br />
## [mario_retrieve_cap](#mario_retrieve_cap)
### Lua Example
`mario_retrieve_cap(m)`
### Parameters
| Field | Type |
| ----- | ---- |
| m | [MarioState](structs.md#MarioState) |
### Returns
- None
### C Prototype
`void mario_retrieve_cap(struct MarioState* m);`
[:arrow_up_small:](#)
<br />
## [mario_stop_riding_and_holding](#mario_stop_riding_and_holding)
### Lua Example
`mario_stop_riding_and_holding(m)`
### Parameters
| Field | Type |
| ----- | ---- |
| m | [MarioState](structs.md#MarioState) |
### Returns
- None
### C Prototype
`void mario_stop_riding_and_holding(struct MarioState *m);`
[:arrow_up_small:](#)
<br />
## [mario_stop_riding_object](#mario_stop_riding_object)
### Lua Example
`mario_stop_riding_object(m)`
### Parameters
| Field | Type |
| ----- | ---- |
| m | [MarioState](structs.md#MarioState) |
### Returns
- None
### C Prototype
`void mario_stop_riding_object(struct MarioState *m);`
[:arrow_up_small:](#)
<br />
## [mario_throw_held_object](#mario_throw_held_object)
### Lua Example
`mario_throw_held_object(m)`
### Parameters
| Field | Type |
| ----- | ---- |
| m | [MarioState](structs.md#MarioState) |
### Returns
- None
### C Prototype
`void mario_throw_held_object(struct MarioState *m);`
[:arrow_up_small:](#)
<br />
---
# functions from level_info.h
<br />
## [get_level_name](#get_level_name)
### Lua Example
`local stringValue = get_level_name(courseNum, levelNum, areaIndex)`
### Parameters
| Field | Type |
| ----- | ---- |
| courseNum | integer |
| levelNum | integer |
| areaIndex | integer |
### Returns
- string
### C Prototype
`const char* get_level_name(s16 courseNum, s16 levelNum, s16 areaIndex);`
[:arrow_up_small:](#)
<br />
---
# functions from mario.h
@ -4222,6 +4575,503 @@
<br />
---
# functions from save_file.h
<br />
## [save_file_get_cap_pos](#save_file_get_cap_pos)
### Lua Example
`local integerValue = save_file_get_cap_pos(capPos)`
### Parameters
| Field | Type |
| ----- | ---- |
| capPos | [Vec3s](structs.md#Vec3s) |
### Returns
- integer
### C Prototype
`s32 save_file_get_cap_pos(Vec3s capPos);`
[:arrow_up_small:](#)
<br />
## [save_file_get_course_coin_score](#save_file_get_course_coin_score)
### Lua Example
`local integerValue = save_file_get_course_coin_score(fileIndex, courseIndex)`
### Parameters
| Field | Type |
| ----- | ---- |
| fileIndex | integer |
| courseIndex | integer |
### Returns
- integer
### C Prototype
`s32 save_file_get_course_coin_score(s32 fileIndex, s32 courseIndex);`
[:arrow_up_small:](#)
<br />
## [save_file_get_course_star_count](#save_file_get_course_star_count)
### Lua Example
`local integerValue = save_file_get_course_star_count(fileIndex, courseIndex)`
### Parameters
| Field | Type |
| ----- | ---- |
| fileIndex | integer |
| courseIndex | integer |
### Returns
- integer
### C Prototype
`s32 save_file_get_course_star_count(s32 fileIndex, s32 courseIndex);`
[:arrow_up_small:](#)
<br />
## [save_file_get_flags](#save_file_get_flags)
### Lua Example
`local integerValue = save_file_get_flags()`
### Parameters
- None
### Returns
- integer
### C Prototype
`u32 save_file_get_flags(void);`
[:arrow_up_small:](#)
<br />
## [save_file_get_max_coin_score](#save_file_get_max_coin_score)
### Lua Example
`local integerValue = save_file_get_max_coin_score(courseIndex)`
### Parameters
| Field | Type |
| ----- | ---- |
| courseIndex | integer |
### Returns
- integer
### C Prototype
`u32 save_file_get_max_coin_score(s32 courseIndex);`
[:arrow_up_small:](#)
<br />
## [save_file_get_sound_mode](#save_file_get_sound_mode)
### Lua Example
`local integerValue = save_file_get_sound_mode()`
### Parameters
- None
### Returns
- integer
### C Prototype
`u16 save_file_get_sound_mode(void);`
[:arrow_up_small:](#)
<br />
## [save_file_get_star_flags](#save_file_get_star_flags)
### Lua Example
`local integerValue = save_file_get_star_flags(fileIndex, courseIndex)`
### Parameters
| Field | Type |
| ----- | ---- |
| fileIndex | integer |
| courseIndex | integer |
### Returns
- integer
### C Prototype
`u32 save_file_get_star_flags(s32 fileIndex, s32 courseIndex);`
[:arrow_up_small:](#)
<br />
## [save_file_get_total_star_count](#save_file_get_total_star_count)
### Lua Example
`local integerValue = save_file_get_total_star_count(fileIndex, minCourse, maxCourse)`
### Parameters
| Field | Type |
| ----- | ---- |
| fileIndex | integer |
| minCourse | integer |
| maxCourse | integer |
### Returns
- integer
### C Prototype
`s32 save_file_get_total_star_count(s32 fileIndex, s32 minCourse, s32 maxCourse);`
[:arrow_up_small:](#)
<br />
---
# functions from sound_init.h
<br />
## [disable_background_sound](#disable_background_sound)
### Lua Example
`disable_background_sound()`
### Parameters
- None
### Returns
- None
### C Prototype
`void disable_background_sound(void);`
[:arrow_up_small:](#)
<br />
## [enable_background_sound](#enable_background_sound)
### Lua Example
`enable_background_sound()`
### Parameters
- None
### Returns
- None
### C Prototype
`void enable_background_sound(void);`
[:arrow_up_small:](#)
<br />
## [fadeout_cap_music](#fadeout_cap_music)
### Lua Example
`fadeout_cap_music()`
### Parameters
- None
### Returns
- None
### C Prototype
`void fadeout_cap_music(void);`
[:arrow_up_small:](#)
<br />
## [fadeout_level_music](#fadeout_level_music)
### Lua Example
`fadeout_level_music(fadeTimer)`
### Parameters
| Field | Type |
| ----- | ---- |
| fadeTimer | integer |
### Returns
- None
### C Prototype
`void fadeout_level_music(s16 fadeTimer);`
[:arrow_up_small:](#)
<br />
## [fadeout_music](#fadeout_music)
### Lua Example
`fadeout_music(fadeOutTime)`
### Parameters
| Field | Type |
| ----- | ---- |
| fadeOutTime | integer |
### Returns
- None
### C Prototype
`void fadeout_music(s16 fadeOutTime);`
[:arrow_up_small:](#)
<br />
## [lower_background_noise](#lower_background_noise)
### Lua Example
`lower_background_noise(a)`
### Parameters
| Field | Type |
| ----- | ---- |
| a | integer |
### Returns
- None
### C Prototype
`void lower_background_noise(s32 a);`
[:arrow_up_small:](#)
<br />
## [play_cap_music](#play_cap_music)
### Lua Example
`play_cap_music(seqArgs)`
### Parameters
| Field | Type |
| ----- | ---- |
| seqArgs | integer |
### Returns
- None
### C Prototype
`void play_cap_music(u16 seqArgs);`
[:arrow_up_small:](#)
<br />
## [play_cutscene_music](#play_cutscene_music)
### Lua Example
`play_cutscene_music(seqArgs)`
### Parameters
| Field | Type |
| ----- | ---- |
| seqArgs | integer |
### Returns
- None
### C Prototype
`void play_cutscene_music(u16 seqArgs);`
[:arrow_up_small:](#)
<br />
## [play_infinite_stairs_music](#play_infinite_stairs_music)
### Lua Example
`play_infinite_stairs_music()`
### Parameters
- None
### Returns
- None
### C Prototype
`void play_infinite_stairs_music(void);`
[:arrow_up_small:](#)
<br />
## [play_menu_sounds](#play_menu_sounds)
### Lua Example
`play_menu_sounds(soundMenuFlags)`
### Parameters
| Field | Type |
| ----- | ---- |
| soundMenuFlags | integer |
### Returns
- None
### C Prototype
`void play_menu_sounds(s16 soundMenuFlags);`
[:arrow_up_small:](#)
<br />
## [play_painting_eject_sound](#play_painting_eject_sound)
### Lua Example
`play_painting_eject_sound()`
### Parameters
- None
### Returns
- None
### C Prototype
`void play_painting_eject_sound(void);`
[:arrow_up_small:](#)
<br />
## [play_shell_music](#play_shell_music)
### Lua Example
`play_shell_music()`
### Parameters
- None
### Returns
- None
### C Prototype
`void play_shell_music(void);`
[:arrow_up_small:](#)
<br />
## [raise_background_noise](#raise_background_noise)
### Lua Example
`raise_background_noise(a)`
### Parameters
| Field | Type |
| ----- | ---- |
| a | integer |
### Returns
- None
### C Prototype
`void raise_background_noise(s32 a);`
[:arrow_up_small:](#)
<br />
## [reset_volume](#reset_volume)
### Lua Example
`reset_volume()`
### Parameters
- None
### Returns
- None
### C Prototype
`void reset_volume(void);`
[:arrow_up_small:](#)
<br />
## [set_background_music](#set_background_music)
### Lua Example
`set_background_music(a, seqArgs, fadeTimer)`
### Parameters
| Field | Type |
| ----- | ---- |
| a | integer |
| seqArgs | integer |
| fadeTimer | integer |
### Returns
- None
### C Prototype
`void set_background_music(u16 a, u16 seqArgs, s16 fadeTimer);`
[:arrow_up_small:](#)
<br />
## [stop_cap_music](#stop_cap_music)
### Lua Example
`stop_cap_music()`
### Parameters
- None
### Returns
- None
### C Prototype
`void stop_cap_music(void);`
[:arrow_up_small:](#)
<br />
## [stop_shell_music](#stop_shell_music)
### Lua Example
`stop_shell_music()`
### Parameters
- None
### Returns
- None
### C Prototype
`void stop_shell_music(void);`
[:arrow_up_small:](#)
<br />
---
# functions from surface_collision.h

View file

@ -11,6 +11,12 @@ Lua scripts you make can be placed either the `mods` folder in the base director
<br />
## Tips
- When developing Lua mods, run the game from a console. Lua errors and logs will appear there.
- You can use the `print()` command when debugging. Your logs will show up in the console.
<br />
## Sections
- [Globals](globals.md)
- [Hooks](hooks.md)
@ -25,3 +31,4 @@ Lua scripts you make can be placed either the `mods` folder in the base director
- [Character Movesets](../../mods/character-movesets.lua)
- [Low Gravity](../../mods/low-gravity.lua)
- [Faster Swimming](../../mods/faster-swimming.lua)
- [Hide and Seek](../../mods/hide-and-seek.lua)

View file

@ -14,6 +14,11 @@
#include "engine/surface_collision.h"
#include "pc/network/network_utils.h"
#include "src/pc/djui/djui_popup.h"
#include "src/game/print.h"
#include "src/game/interaction.h"
#include "src/game/level_info.h"
#include "src/game/save_file.h"
#include "src/game/sound_init.h"
//////////////
// camera.h //
@ -429,6 +434,180 @@ int smlua_func_sequence_player_unlower(lua_State* L) {
return 1;
}
///////////////////
// interaction.h //
///////////////////
int smlua_func_does_mario_have_hat(lua_State* L) {
if(!smlua_functions_valid_param_count(L, 1)) { return 0; }
struct MarioState* m = (struct MarioState*)smlua_to_cobject(L, 1, LOT_MARIOSTATE);
if (!gSmLuaConvertSuccess) { return 0; }
lua_pushinteger(L, does_mario_have_hat(m));
return 1;
}
int smlua_func_get_door_save_file_flag(lua_State* L) {
if(!smlua_functions_valid_param_count(L, 1)) { return 0; }
struct Object* door = (struct Object*)smlua_to_cobject(L, 1, LOT_OBJECT);
if (!gSmLuaConvertSuccess) { return 0; }
lua_pushinteger(L, get_door_save_file_flag(door));
return 1;
}
int smlua_func_mario_blow_off_cap(lua_State* L) {
if(!smlua_functions_valid_param_count(L, 2)) { return 0; }
struct MarioState* m = (struct MarioState*)smlua_to_cobject(L, 1, LOT_MARIOSTATE);
if (!gSmLuaConvertSuccess) { return 0; }
f32 capSpeed = smlua_to_number(L, 2);
if (!gSmLuaConvertSuccess) { return 0; }
mario_blow_off_cap(m, capSpeed);
return 1;
}
int smlua_func_mario_check_object_grab(lua_State* L) {
if(!smlua_functions_valid_param_count(L, 1)) { return 0; }
struct MarioState* m = (struct MarioState*)smlua_to_cobject(L, 1, LOT_MARIOSTATE);
if (!gSmLuaConvertSuccess) { return 0; }
lua_pushinteger(L, mario_check_object_grab(m));
return 1;
}
int smlua_func_mario_drop_held_object(lua_State* L) {
if(!smlua_functions_valid_param_count(L, 1)) { return 0; }
struct MarioState* m = (struct MarioState*)smlua_to_cobject(L, 1, LOT_MARIOSTATE);
if (!gSmLuaConvertSuccess) { return 0; }
mario_drop_held_object(m);
return 1;
}
int smlua_func_mario_get_collided_object(lua_State* L) {
if(!smlua_functions_valid_param_count(L, 2)) { return 0; }
struct MarioState* m = (struct MarioState*)smlua_to_cobject(L, 1, LOT_MARIOSTATE);
if (!gSmLuaConvertSuccess) { return 0; }
u32 interactType = smlua_to_integer(L, 2);
if (!gSmLuaConvertSuccess) { return 0; }
smlua_push_object(L, LOT_OBJECT, mario_get_collided_object(m, interactType));
return 1;
}
int smlua_func_mario_grab_used_object(lua_State* L) {
if(!smlua_functions_valid_param_count(L, 1)) { return 0; }
struct MarioState* m = (struct MarioState*)smlua_to_cobject(L, 1, LOT_MARIOSTATE);
if (!gSmLuaConvertSuccess) { return 0; }
mario_grab_used_object(m);
return 1;
}
int smlua_func_mario_lose_cap_to_enemy(lua_State* L) {
if(!smlua_functions_valid_param_count(L, 2)) { return 0; }
struct MarioState* m = (struct MarioState*)smlua_to_cobject(L, 1, LOT_MARIOSTATE);
if (!gSmLuaConvertSuccess) { return 0; }
u32 arg = smlua_to_integer(L, 2);
if (!gSmLuaConvertSuccess) { return 0; }
lua_pushinteger(L, mario_lose_cap_to_enemy(m, arg));
return 1;
}
int smlua_func_mario_obj_angle_to_object(lua_State* L) {
if(!smlua_functions_valid_param_count(L, 2)) { return 0; }
struct MarioState* m = (struct MarioState*)smlua_to_cobject(L, 1, LOT_MARIOSTATE);
if (!gSmLuaConvertSuccess) { return 0; }
struct Object* o = (struct Object*)smlua_to_cobject(L, 2, LOT_OBJECT);
if (!gSmLuaConvertSuccess) { return 0; }
lua_pushinteger(L, mario_obj_angle_to_object(m, o));
return 1;
}
int smlua_func_mario_retrieve_cap(lua_State* L) {
if(!smlua_functions_valid_param_count(L, 1)) { return 0; }
struct MarioState* m = (struct MarioState*)smlua_to_cobject(L, 1, LOT_MARIOSTATE);
if (!gSmLuaConvertSuccess) { return 0; }
mario_retrieve_cap(m);
return 1;
}
int smlua_func_mario_stop_riding_and_holding(lua_State* L) {
if(!smlua_functions_valid_param_count(L, 1)) { return 0; }
struct MarioState* m = (struct MarioState*)smlua_to_cobject(L, 1, LOT_MARIOSTATE);
if (!gSmLuaConvertSuccess) { return 0; }
mario_stop_riding_and_holding(m);
return 1;
}
int smlua_func_mario_stop_riding_object(lua_State* L) {
if(!smlua_functions_valid_param_count(L, 1)) { return 0; }
struct MarioState* m = (struct MarioState*)smlua_to_cobject(L, 1, LOT_MARIOSTATE);
if (!gSmLuaConvertSuccess) { return 0; }
mario_stop_riding_object(m);
return 1;
}
int smlua_func_mario_throw_held_object(lua_State* L) {
if(!smlua_functions_valid_param_count(L, 1)) { return 0; }
struct MarioState* m = (struct MarioState*)smlua_to_cobject(L, 1, LOT_MARIOSTATE);
if (!gSmLuaConvertSuccess) { return 0; }
mario_throw_held_object(m);
return 1;
}
//////////////////
// level_info.h //
//////////////////
int smlua_func_get_level_name(lua_State* L) {
if(!smlua_functions_valid_param_count(L, 3)) { return 0; }
s16 courseNum = smlua_to_integer(L, 1);
if (!gSmLuaConvertSuccess) { return 0; }
s16 levelNum = smlua_to_integer(L, 2);
if (!gSmLuaConvertSuccess) { return 0; }
s16 areaIndex = smlua_to_integer(L, 3);
if (!gSmLuaConvertSuccess) { return 0; }
lua_pushstring(L, get_level_name(courseNum, levelNum, areaIndex));
return 1;
}
/////////////
// mario.h //
/////////////
@ -2685,6 +2864,291 @@ int smlua_func_network_local_index_from_global(lua_State* L) {
return 1;
}
/////////////////
// save_file.h //
/////////////////
int smlua_func_save_file_get_cap_pos(lua_State* L) {
if(!smlua_functions_valid_param_count(L, 1)) { return 0; }
s16* capPos = smlua_get_vec3s_from_buffer();
capPos[0] = smlua_get_integer_field(1, "x");
if (!gSmLuaConvertSuccess) { return 0; }
capPos[1] = smlua_get_integer_field(1, "y");
if (!gSmLuaConvertSuccess) { return 0; }
capPos[2] = smlua_get_integer_field(1, "z");
if (!gSmLuaConvertSuccess) { return 0; }
lua_pushinteger(L, save_file_get_cap_pos(capPos));
smlua_push_integer_field(1, "x", capPos[0]);
smlua_push_integer_field(1, "y", capPos[1]);
smlua_push_integer_field(1, "z", capPos[2]);
return 1;
}
int smlua_func_save_file_get_course_coin_score(lua_State* L) {
if(!smlua_functions_valid_param_count(L, 2)) { return 0; }
s32 fileIndex = smlua_to_integer(L, 1);
if (!gSmLuaConvertSuccess) { return 0; }
s32 courseIndex = smlua_to_integer(L, 2);
if (!gSmLuaConvertSuccess) { return 0; }
lua_pushinteger(L, save_file_get_course_coin_score(fileIndex, courseIndex));
return 1;
}
int smlua_func_save_file_get_course_star_count(lua_State* L) {
if(!smlua_functions_valid_param_count(L, 2)) { return 0; }
s32 fileIndex = smlua_to_integer(L, 1);
if (!gSmLuaConvertSuccess) { return 0; }
s32 courseIndex = smlua_to_integer(L, 2);
if (!gSmLuaConvertSuccess) { return 0; }
lua_pushinteger(L, save_file_get_course_star_count(fileIndex, courseIndex));
return 1;
}
int smlua_func_save_file_get_flags(UNUSED lua_State* L) {
if(!smlua_functions_valid_param_count(L, 0)) { return 0; }
lua_pushinteger(L, save_file_get_flags());
return 1;
}
int smlua_func_save_file_get_max_coin_score(lua_State* L) {
if(!smlua_functions_valid_param_count(L, 1)) { return 0; }
s32 courseIndex = smlua_to_integer(L, 1);
if (!gSmLuaConvertSuccess) { return 0; }
lua_pushinteger(L, save_file_get_max_coin_score(courseIndex));
return 1;
}
int smlua_func_save_file_get_sound_mode(UNUSED lua_State* L) {
if(!smlua_functions_valid_param_count(L, 0)) { return 0; }
lua_pushinteger(L, save_file_get_sound_mode());
return 1;
}
int smlua_func_save_file_get_star_flags(lua_State* L) {
if(!smlua_functions_valid_param_count(L, 2)) { return 0; }
s32 fileIndex = smlua_to_integer(L, 1);
if (!gSmLuaConvertSuccess) { return 0; }
s32 courseIndex = smlua_to_integer(L, 2);
if (!gSmLuaConvertSuccess) { return 0; }
lua_pushinteger(L, save_file_get_star_flags(fileIndex, courseIndex));
return 1;
}
int smlua_func_save_file_get_total_star_count(lua_State* L) {
if(!smlua_functions_valid_param_count(L, 3)) { return 0; }
s32 fileIndex = smlua_to_integer(L, 1);
if (!gSmLuaConvertSuccess) { return 0; }
s32 minCourse = smlua_to_integer(L, 2);
if (!gSmLuaConvertSuccess) { return 0; }
s32 maxCourse = smlua_to_integer(L, 3);
if (!gSmLuaConvertSuccess) { return 0; }
lua_pushinteger(L, save_file_get_total_star_count(fileIndex, minCourse, maxCourse));
return 1;
}
//////////////////
// sound_init.h //
//////////////////
int smlua_func_disable_background_sound(UNUSED lua_State* L) {
if(!smlua_functions_valid_param_count(L, 0)) { return 0; }
disable_background_sound();
return 1;
}
int smlua_func_enable_background_sound(UNUSED lua_State* L) {
if(!smlua_functions_valid_param_count(L, 0)) { return 0; }
enable_background_sound();
return 1;
}
int smlua_func_fadeout_cap_music(UNUSED lua_State* L) {
if(!smlua_functions_valid_param_count(L, 0)) { return 0; }
fadeout_cap_music();
return 1;
}
int smlua_func_fadeout_level_music(lua_State* L) {
if(!smlua_functions_valid_param_count(L, 1)) { return 0; }
s16 fadeTimer = smlua_to_integer(L, 1);
if (!gSmLuaConvertSuccess) { return 0; }
fadeout_level_music(fadeTimer);
return 1;
}
int smlua_func_fadeout_music(lua_State* L) {
if(!smlua_functions_valid_param_count(L, 1)) { return 0; }
s16 fadeOutTime = smlua_to_integer(L, 1);
if (!gSmLuaConvertSuccess) { return 0; }
fadeout_music(fadeOutTime);
return 1;
}
int smlua_func_lower_background_noise(lua_State* L) {
if(!smlua_functions_valid_param_count(L, 1)) { return 0; }
s32 a = smlua_to_integer(L, 1);
if (!gSmLuaConvertSuccess) { return 0; }
lower_background_noise(a);
return 1;
}
int smlua_func_play_cap_music(lua_State* L) {
if(!smlua_functions_valid_param_count(L, 1)) { return 0; }
u16 seqArgs = smlua_to_integer(L, 1);
if (!gSmLuaConvertSuccess) { return 0; }
play_cap_music(seqArgs);
return 1;
}
int smlua_func_play_cutscene_music(lua_State* L) {
if(!smlua_functions_valid_param_count(L, 1)) { return 0; }
u16 seqArgs = smlua_to_integer(L, 1);
if (!gSmLuaConvertSuccess) { return 0; }
play_cutscene_music(seqArgs);
return 1;
}
int smlua_func_play_infinite_stairs_music(UNUSED lua_State* L) {
if(!smlua_functions_valid_param_count(L, 0)) { return 0; }
play_infinite_stairs_music();
return 1;
}
int smlua_func_play_menu_sounds(lua_State* L) {
if(!smlua_functions_valid_param_count(L, 1)) { return 0; }
s16 soundMenuFlags = smlua_to_integer(L, 1);
if (!gSmLuaConvertSuccess) { return 0; }
play_menu_sounds(soundMenuFlags);
return 1;
}
int smlua_func_play_painting_eject_sound(UNUSED lua_State* L) {
if(!smlua_functions_valid_param_count(L, 0)) { return 0; }
play_painting_eject_sound();
return 1;
}
int smlua_func_play_shell_music(UNUSED lua_State* L) {
if(!smlua_functions_valid_param_count(L, 0)) { return 0; }
play_shell_music();
return 1;
}
int smlua_func_raise_background_noise(lua_State* L) {
if(!smlua_functions_valid_param_count(L, 1)) { return 0; }
s32 a = smlua_to_integer(L, 1);
if (!gSmLuaConvertSuccess) { return 0; }
raise_background_noise(a);
return 1;
}
int smlua_func_reset_volume(UNUSED lua_State* L) {
if(!smlua_functions_valid_param_count(L, 0)) { return 0; }
reset_volume();
return 1;
}
int smlua_func_set_background_music(lua_State* L) {
if(!smlua_functions_valid_param_count(L, 3)) { return 0; }
u16 a = smlua_to_integer(L, 1);
if (!gSmLuaConvertSuccess) { return 0; }
u16 seqArgs = smlua_to_integer(L, 2);
if (!gSmLuaConvertSuccess) { return 0; }
s16 fadeTimer = smlua_to_integer(L, 3);
if (!gSmLuaConvertSuccess) { return 0; }
set_background_music(a, seqArgs, fadeTimer);
return 1;
}
int smlua_func_stop_cap_music(UNUSED lua_State* L) {
if(!smlua_functions_valid_param_count(L, 0)) { return 0; }
stop_cap_music();
return 1;
}
int smlua_func_stop_shell_music(UNUSED lua_State* L) {
if(!smlua_functions_valid_param_count(L, 0)) { return 0; }
stop_shell_music();
return 1;
}
/////////////////////////
// surface_collision.h //
/////////////////////////
@ -2963,6 +3427,24 @@ void smlua_bind_functions_autogen(void) {
smlua_bind_function(L, "sequence_player_fade_out", smlua_func_sequence_player_fade_out);
smlua_bind_function(L, "sequence_player_unlower", smlua_func_sequence_player_unlower);
// interaction.h
smlua_bind_function(L, "does_mario_have_hat", smlua_func_does_mario_have_hat);
smlua_bind_function(L, "get_door_save_file_flag", smlua_func_get_door_save_file_flag);
smlua_bind_function(L, "mario_blow_off_cap", smlua_func_mario_blow_off_cap);
smlua_bind_function(L, "mario_check_object_grab", smlua_func_mario_check_object_grab);
smlua_bind_function(L, "mario_drop_held_object", smlua_func_mario_drop_held_object);
smlua_bind_function(L, "mario_get_collided_object", smlua_func_mario_get_collided_object);
smlua_bind_function(L, "mario_grab_used_object", smlua_func_mario_grab_used_object);
smlua_bind_function(L, "mario_lose_cap_to_enemy", smlua_func_mario_lose_cap_to_enemy);
smlua_bind_function(L, "mario_obj_angle_to_object", smlua_func_mario_obj_angle_to_object);
smlua_bind_function(L, "mario_retrieve_cap", smlua_func_mario_retrieve_cap);
smlua_bind_function(L, "mario_stop_riding_and_holding", smlua_func_mario_stop_riding_and_holding);
smlua_bind_function(L, "mario_stop_riding_object", smlua_func_mario_stop_riding_object);
smlua_bind_function(L, "mario_throw_held_object", smlua_func_mario_throw_held_object);
// level_info.h
smlua_bind_function(L, "get_level_name", smlua_func_get_level_name);
// mario.h
smlua_bind_function(L, "adjust_sound_for_speed", smlua_func_adjust_sound_for_speed);
smlua_bind_function(L, "check_common_action_exits", smlua_func_check_common_action_exits);
@ -3145,6 +3627,35 @@ void smlua_bind_functions_autogen(void) {
smlua_bind_function(L, "network_is_server", smlua_func_network_is_server);
smlua_bind_function(L, "network_local_index_from_global", smlua_func_network_local_index_from_global);
// save_file.h
smlua_bind_function(L, "save_file_get_cap_pos", smlua_func_save_file_get_cap_pos);
smlua_bind_function(L, "save_file_get_course_coin_score", smlua_func_save_file_get_course_coin_score);
smlua_bind_function(L, "save_file_get_course_star_count", smlua_func_save_file_get_course_star_count);
smlua_bind_function(L, "save_file_get_flags", smlua_func_save_file_get_flags);
smlua_bind_function(L, "save_file_get_max_coin_score", smlua_func_save_file_get_max_coin_score);
smlua_bind_function(L, "save_file_get_sound_mode", smlua_func_save_file_get_sound_mode);
smlua_bind_function(L, "save_file_get_star_flags", smlua_func_save_file_get_star_flags);
smlua_bind_function(L, "save_file_get_total_star_count", smlua_func_save_file_get_total_star_count);
// sound_init.h
smlua_bind_function(L, "disable_background_sound", smlua_func_disable_background_sound);
smlua_bind_function(L, "enable_background_sound", smlua_func_enable_background_sound);
smlua_bind_function(L, "fadeout_cap_music", smlua_func_fadeout_cap_music);
smlua_bind_function(L, "fadeout_level_music", smlua_func_fadeout_level_music);
smlua_bind_function(L, "fadeout_music", smlua_func_fadeout_music);
smlua_bind_function(L, "lower_background_noise", smlua_func_lower_background_noise);
smlua_bind_function(L, "play_cap_music", smlua_func_play_cap_music);
smlua_bind_function(L, "play_cutscene_music", smlua_func_play_cutscene_music);
smlua_bind_function(L, "play_infinite_stairs_music", smlua_func_play_infinite_stairs_music);
smlua_bind_function(L, "play_menu_sounds", smlua_func_play_menu_sounds);
smlua_bind_function(L, "play_painting_eject_sound", smlua_func_play_painting_eject_sound);
smlua_bind_function(L, "play_shell_music", smlua_func_play_shell_music);
smlua_bind_function(L, "raise_background_noise", smlua_func_raise_background_noise);
smlua_bind_function(L, "reset_volume", smlua_func_reset_volume);
smlua_bind_function(L, "set_background_music", smlua_func_set_background_music);
smlua_bind_function(L, "stop_cap_music", smlua_func_stop_cap_music);
smlua_bind_function(L, "stop_shell_music", smlua_func_stop_shell_music);
// surface_collision.h
//smlua_bind_function(L, "f32_find_wall_collision", smlua_func_f32_find_wall_collision); <--- UNIMPLEMENTED
//smlua_bind_function(L, "find_ceil", smlua_func_find_ceil); <--- UNIMPLEMENTED