diff --git a/autogen/lua_definitions/functions.lua b/autogen/lua_definitions/functions.lua index c94c2f42e..e8a737f27 100644 --- a/autogen/lua_definitions/functions.lua +++ b/autogen/lua_definitions/functions.lua @@ -7370,6 +7370,11 @@ function set_mario_interact_hoot_if_in_range(sp0, sp4, sp8) -- ... end +--- @param room integer +function set_room_override(room) + -- ... +end + --- @param flags integer function set_time_stop_flags(flags) -- ... diff --git a/docs/lua/functions-4.md b/docs/lua/functions-4.md index ef99f81a1..639e95e22 100644 --- a/docs/lua/functions-4.md +++ b/docs/lua/functions-4.md @@ -7743,6 +7743,26 @@
+## [set_room_override](#set_room_override) + +### Lua Example +`set_room_override(room)` + +### Parameters +| Field | Type | +| ----- | ---- | +| room | `integer` | + +### Returns +- None + +### C Prototype +`void set_room_override(s16 room);` + +[:arrow_up_small:](#) + +
+ ## [set_time_stop_flags](#set_time_stop_flags) ### Lua Example diff --git a/docs/lua/functions-5.md b/docs/lua/functions-5.md index b5c43092c..013dc5bd1 100644 --- a/docs/lua/functions-5.md +++ b/docs/lua/functions-5.md @@ -5310,6 +5310,26 @@
+## [surface_has_force](#surface_has_force) + +### Lua Example +`local booleanValue = surface_has_force(surfaceType)` + +### Parameters +| Field | Type | +| ----- | ---- | +| surfaceType | `integer` | + +### Returns +- `boolean` + +### C Prototype +`bool surface_has_force(s16 surfaceType);` + +[:arrow_up_small:](#) + +
+ --- [< prev](functions-4.md) | [1](functions.md) | [2](functions-2.md) | [3](functions-3.md) | [4](functions-4.md) | 5] diff --git a/docs/lua/functions-6.md b/docs/lua/functions-6.md new file mode 100644 index 000000000..1a2be8898 --- /dev/null +++ b/docs/lua/functions-6.md @@ -0,0 +1,1887 @@ +## [:rewind: Lua Functions](functions.md) + +--- + +[< prev](functions-5.md) | [1](functions.md) | [2](functions-2.md) | [3](functions-3.md) | [4](functions-4.md) | [5](functions-5.md) | 6] + + +--- +# functions from smlua_obj_utils.h + +
+ + +## [get_temp_object_hitbox](#get_temp_object_hitbox) + +### Lua Example +`local ObjectHitboxValue = get_temp_object_hitbox()` + +### Parameters +- None + +### Returns +[ObjectHitbox](structs.md#ObjectHitbox) + +### C Prototype +`struct ObjectHitbox* get_temp_object_hitbox(void);` + +[:arrow_up_small:](#) + +
+ +## [get_trajectory](#get_trajectory) + +### Lua Example +`local PointerValue = get_trajectory(name)` + +### Parameters +| Field | Type | +| ----- | ---- | +| name | `string` | + +### Returns +- `Pointer` <`Trajectory`> + +### C Prototype +`Trajectory* get_trajectory(const char* name);` + +[:arrow_up_small:](#) + +
+ +## [obj_check_hitbox_overlap](#obj_check_hitbox_overlap) + +### Lua Example +`local booleanValue = obj_check_hitbox_overlap(o1, o2)` + +### Parameters +| Field | Type | +| ----- | ---- | +| o1 | [Object](structs.md#Object) | +| o2 | [Object](structs.md#Object) | + +### Returns +- `boolean` + +### C Prototype +`bool obj_check_hitbox_overlap(struct Object *o1, struct Object *o2);` + +[:arrow_up_small:](#) + +
+ +## [obj_check_overlap_with_hitbox_params](#obj_check_overlap_with_hitbox_params) + +### Lua Example +`local booleanValue = obj_check_overlap_with_hitbox_params(o, x, y, z, h, r, d)` + +### Parameters +| Field | Type | +| ----- | ---- | +| o | [Object](structs.md#Object) | +| x | `number` | +| y | `number` | +| z | `number` | +| h | `number` | +| r | `number` | +| d | `number` | + +### Returns +- `boolean` + +### C Prototype +`bool obj_check_overlap_with_hitbox_params(struct Object *o, f32 x, f32 y, f32 z, f32 h, f32 r, f32 d);` + +[:arrow_up_small:](#) + +
+ +## [obj_count_objects_with_behavior_id](#obj_count_objects_with_behavior_id) + +### Lua Example +`local integerValue = obj_count_objects_with_behavior_id(behaviorId)` + +### Parameters +| Field | Type | +| ----- | ---- | +| behaviorId | [enum BehaviorId](constants.md#enum-BehaviorId) | + +### Returns +- `integer` + +### C Prototype +`s32 obj_count_objects_with_behavior_id(enum BehaviorId behaviorId);` + +[:arrow_up_small:](#) + +
+ +## [obj_get_collided_object](#obj_get_collided_object) + +### Lua Example +`local ObjectValue = obj_get_collided_object(o, index)` + +### Parameters +| Field | Type | +| ----- | ---- | +| o | [Object](structs.md#Object) | +| index | `integer` | + +### Returns +[Object](structs.md#Object) + +### C Prototype +`struct Object *obj_get_collided_object(struct Object *o, s16 index);` + +[:arrow_up_small:](#) + +
+ +## [obj_get_field_f32](#obj_get_field_f32) + +### Lua Example +`local numberValue = obj_get_field_f32(o, fieldIndex)` + +### Parameters +| Field | Type | +| ----- | ---- | +| o | [Object](structs.md#Object) | +| fieldIndex | `integer` | + +### Returns +- `number` + +### C Prototype +`f32 obj_get_field_f32(struct Object *o, s32 fieldIndex);` + +[:arrow_up_small:](#) + +
+ +## [obj_get_field_s16](#obj_get_field_s16) + +### Lua Example +`local integerValue = obj_get_field_s16(o, fieldIndex, fieldSubIndex)` + +### Parameters +| Field | Type | +| ----- | ---- | +| o | [Object](structs.md#Object) | +| fieldIndex | `integer` | +| fieldSubIndex | `integer` | + +### Returns +- `integer` + +### C Prototype +`s16 obj_get_field_s16(struct Object *o, s32 fieldIndex, s32 fieldSubIndex);` + +[:arrow_up_small:](#) + +
+ +## [obj_get_field_s32](#obj_get_field_s32) + +### Lua Example +`local integerValue = obj_get_field_s32(o, fieldIndex)` + +### Parameters +| Field | Type | +| ----- | ---- | +| o | [Object](structs.md#Object) | +| fieldIndex | `integer` | + +### Returns +- `integer` + +### C Prototype +`s32 obj_get_field_s32(struct Object *o, s32 fieldIndex);` + +[:arrow_up_small:](#) + +
+ +## [obj_get_field_u32](#obj_get_field_u32) + +### Lua Example +`local integerValue = obj_get_field_u32(o, fieldIndex)` + +### Parameters +| Field | Type | +| ----- | ---- | +| o | [Object](structs.md#Object) | +| fieldIndex | `integer` | + +### Returns +- `integer` + +### C Prototype +`u32 obj_get_field_u32(struct Object *o, s32 fieldIndex);` + +[:arrow_up_small:](#) + +
+ +## [obj_get_first](#obj_get_first) + +### Lua Example +`local ObjectValue = obj_get_first(objList)` + +### Parameters +| Field | Type | +| ----- | ---- | +| objList | [enum ObjectList](constants.md#enum-ObjectList) | + +### Returns +[Object](structs.md#Object) + +### C Prototype +`struct Object *obj_get_first(enum ObjectList objList);` + +[:arrow_up_small:](#) + +
+ +## [obj_get_first_with_behavior_id](#obj_get_first_with_behavior_id) + +### Lua Example +`local ObjectValue = obj_get_first_with_behavior_id(behaviorId)` + +### Parameters +| Field | Type | +| ----- | ---- | +| behaviorId | [enum BehaviorId](constants.md#enum-BehaviorId) | + +### Returns +[Object](structs.md#Object) + +### C Prototype +`struct Object *obj_get_first_with_behavior_id(enum BehaviorId behaviorId);` + +[:arrow_up_small:](#) + +
+ +## [obj_get_first_with_behavior_id_and_field_f32](#obj_get_first_with_behavior_id_and_field_f32) + +### Lua Example +`local ObjectValue = obj_get_first_with_behavior_id_and_field_f32(behaviorId, fieldIndex, value)` + +### Parameters +| Field | Type | +| ----- | ---- | +| behaviorId | [enum BehaviorId](constants.md#enum-BehaviorId) | +| fieldIndex | `integer` | +| value | `number` | + +### Returns +[Object](structs.md#Object) + +### C Prototype +`struct Object *obj_get_first_with_behavior_id_and_field_f32(enum BehaviorId behaviorId, s32 fieldIndex, f32 value);` + +[:arrow_up_small:](#) + +
+ +## [obj_get_first_with_behavior_id_and_field_s32](#obj_get_first_with_behavior_id_and_field_s32) + +### Lua Example +`local ObjectValue = obj_get_first_with_behavior_id_and_field_s32(behaviorId, fieldIndex, value)` + +### Parameters +| Field | Type | +| ----- | ---- | +| behaviorId | [enum BehaviorId](constants.md#enum-BehaviorId) | +| fieldIndex | `integer` | +| value | `integer` | + +### Returns +[Object](structs.md#Object) + +### C Prototype +`struct Object *obj_get_first_with_behavior_id_and_field_s32(enum BehaviorId behaviorId, s32 fieldIndex, s32 value);` + +[:arrow_up_small:](#) + +
+ +## [obj_get_nearest_object_with_behavior_id](#obj_get_nearest_object_with_behavior_id) + +### Lua Example +`local ObjectValue = obj_get_nearest_object_with_behavior_id(o, behaviorId)` + +### Parameters +| Field | Type | +| ----- | ---- | +| o | [Object](structs.md#Object) | +| behaviorId | [enum BehaviorId](constants.md#enum-BehaviorId) | + +### Returns +[Object](structs.md#Object) + +### C Prototype +`struct Object *obj_get_nearest_object_with_behavior_id(struct Object *o, enum BehaviorId behaviorId);` + +[:arrow_up_small:](#) + +
+ +## [obj_get_next](#obj_get_next) + +### Lua Example +`local ObjectValue = obj_get_next(o)` + +### Parameters +| Field | Type | +| ----- | ---- | +| o | [Object](structs.md#Object) | + +### Returns +[Object](structs.md#Object) + +### C Prototype +`struct Object *obj_get_next(struct Object *o);` + +[:arrow_up_small:](#) + +
+ +## [obj_get_next_with_same_behavior_id](#obj_get_next_with_same_behavior_id) + +### Lua Example +`local ObjectValue = obj_get_next_with_same_behavior_id(o)` + +### Parameters +| Field | Type | +| ----- | ---- | +| o | [Object](structs.md#Object) | + +### Returns +[Object](structs.md#Object) + +### C Prototype +`struct Object *obj_get_next_with_same_behavior_id(struct Object *o);` + +[:arrow_up_small:](#) + +
+ +## [obj_get_next_with_same_behavior_id_and_field_f32](#obj_get_next_with_same_behavior_id_and_field_f32) + +### Lua Example +`local ObjectValue = obj_get_next_with_same_behavior_id_and_field_f32(o, fieldIndex, value)` + +### Parameters +| Field | Type | +| ----- | ---- | +| o | [Object](structs.md#Object) | +| fieldIndex | `integer` | +| value | `number` | + +### Returns +[Object](structs.md#Object) + +### C Prototype +`struct Object *obj_get_next_with_same_behavior_id_and_field_f32(struct Object *o, s32 fieldIndex, f32 value);` + +[:arrow_up_small:](#) + +
+ +## [obj_get_next_with_same_behavior_id_and_field_s32](#obj_get_next_with_same_behavior_id_and_field_s32) + +### Lua Example +`local ObjectValue = obj_get_next_with_same_behavior_id_and_field_s32(o, fieldIndex, value)` + +### Parameters +| Field | Type | +| ----- | ---- | +| o | [Object](structs.md#Object) | +| fieldIndex | `integer` | +| value | `integer` | + +### Returns +[Object](structs.md#Object) + +### C Prototype +`struct Object *obj_get_next_with_same_behavior_id_and_field_s32(struct Object *o, s32 fieldIndex, s32 value);` + +[:arrow_up_small:](#) + +
+ +## [obj_get_temp_spawn_particles_info](#obj_get_temp_spawn_particles_info) + +### Lua Example +`local SpawnParticlesInfoValue = obj_get_temp_spawn_particles_info(modelId)` + +### Parameters +| Field | Type | +| ----- | ---- | +| modelId | [enum ModelExtendedId](constants.md#enum-ModelExtendedId) | + +### Returns +[SpawnParticlesInfo](structs.md#SpawnParticlesInfo) + +### C Prototype +`struct SpawnParticlesInfo* obj_get_temp_spawn_particles_info(enum ModelExtendedId modelId);` + +[:arrow_up_small:](#) + +
+ +## [obj_has_behavior_id](#obj_has_behavior_id) + +### Lua Example +`local integerValue = obj_has_behavior_id(o, behaviorId)` + +### Parameters +| Field | Type | +| ----- | ---- | +| o | [Object](structs.md#Object) | +| behaviorId | [enum BehaviorId](constants.md#enum-BehaviorId) | + +### Returns +- `integer` + +### C Prototype +`s32 obj_has_behavior_id(struct Object *o, enum BehaviorId behaviorId);` + +[:arrow_up_small:](#) + +
+ +## [obj_has_model_extended](#obj_has_model_extended) + +### Lua Example +`local integerValue = obj_has_model_extended(o, modelId)` + +### Parameters +| Field | Type | +| ----- | ---- | +| o | [Object](structs.md#Object) | +| modelId | [enum ModelExtendedId](constants.md#enum-ModelExtendedId) | + +### Returns +- `integer` + +### C Prototype +`s32 obj_has_model_extended(struct Object *o, enum ModelExtendedId modelId);` + +[:arrow_up_small:](#) + +
+ +## [obj_is_attackable](#obj_is_attackable) + +### Lua Example +`local booleanValue = obj_is_attackable(o)` + +### Parameters +| Field | Type | +| ----- | ---- | +| o | [Object](structs.md#Object) | + +### Returns +- `boolean` + +### C Prototype +`bool obj_is_attackable(struct Object *o);` + +[:arrow_up_small:](#) + +
+ +## [obj_is_breakable_object](#obj_is_breakable_object) + +### Lua Example +`local booleanValue = obj_is_breakable_object(o)` + +### Parameters +| Field | Type | +| ----- | ---- | +| o | [Object](structs.md#Object) | + +### Returns +- `boolean` + +### C Prototype +`bool obj_is_breakable_object(struct Object *o);` + +[:arrow_up_small:](#) + +
+ +## [obj_is_bully](#obj_is_bully) + +### Lua Example +`local booleanValue = obj_is_bully(o)` + +### Parameters +| Field | Type | +| ----- | ---- | +| o | [Object](structs.md#Object) | + +### Returns +- `boolean` + +### C Prototype +`bool obj_is_bully(struct Object *o);` + +[:arrow_up_small:](#) + +
+ +## [obj_is_coin](#obj_is_coin) + +### Lua Example +`local booleanValue = obj_is_coin(o)` + +### Parameters +| Field | Type | +| ----- | ---- | +| o | [Object](structs.md#Object) | + +### Returns +- `boolean` + +### C Prototype +`bool obj_is_coin(struct Object *o);` + +[:arrow_up_small:](#) + +
+ +## [obj_is_exclamation_box](#obj_is_exclamation_box) + +### Lua Example +`local booleanValue = obj_is_exclamation_box(o)` + +### Parameters +| Field | Type | +| ----- | ---- | +| o | [Object](structs.md#Object) | + +### Returns +- `boolean` + +### C Prototype +`bool obj_is_exclamation_box(struct Object *o);` + +[:arrow_up_small:](#) + +
+ +## [obj_is_grabbable](#obj_is_grabbable) + +### Lua Example +`local booleanValue = obj_is_grabbable(o)` + +### Parameters +| Field | Type | +| ----- | ---- | +| o | [Object](structs.md#Object) | + +### Returns +- `boolean` + +### C Prototype +`bool obj_is_grabbable(struct Object *o) ;` + +[:arrow_up_small:](#) + +
+ +## [obj_is_mushroom_1up](#obj_is_mushroom_1up) + +### Lua Example +`local booleanValue = obj_is_mushroom_1up(o)` + +### Parameters +| Field | Type | +| ----- | ---- | +| o | [Object](structs.md#Object) | + +### Returns +- `boolean` + +### C Prototype +`bool obj_is_mushroom_1up(struct Object *o);` + +[:arrow_up_small:](#) + +
+ +## [obj_is_secret](#obj_is_secret) + +### Lua Example +`local booleanValue = obj_is_secret(o)` + +### Parameters +| Field | Type | +| ----- | ---- | +| o | [Object](structs.md#Object) | + +### Returns +- `boolean` + +### C Prototype +`bool obj_is_secret(struct Object *o);` + +[:arrow_up_small:](#) + +
+ +## [obj_is_valid_for_interaction](#obj_is_valid_for_interaction) + +### Lua Example +`local booleanValue = obj_is_valid_for_interaction(o)` + +### Parameters +| Field | Type | +| ----- | ---- | +| o | [Object](structs.md#Object) | + +### Returns +- `boolean` + +### C Prototype +`bool obj_is_valid_for_interaction(struct Object *o);` + +[:arrow_up_small:](#) + +
+ +## [obj_move_xyz](#obj_move_xyz) + +### Lua Example +`obj_move_xyz(o, dx, dy, dz)` + +### Parameters +| Field | Type | +| ----- | ---- | +| o | [Object](structs.md#Object) | +| dx | `number` | +| dy | `number` | +| dz | `number` | + +### Returns +- None + +### C Prototype +`void obj_move_xyz(struct Object *o, f32 dx, f32 dy, f32 dz);` + +[:arrow_up_small:](#) + +
+ +## [obj_set_field_f32](#obj_set_field_f32) + +### Lua Example +`obj_set_field_f32(o, fieldIndex, value)` + +### Parameters +| Field | Type | +| ----- | ---- | +| o | [Object](structs.md#Object) | +| fieldIndex | `integer` | +| value | `number` | + +### Returns +- None + +### C Prototype +`void obj_set_field_f32(struct Object *o, s32 fieldIndex, f32 value);` + +[:arrow_up_small:](#) + +
+ +## [obj_set_field_s16](#obj_set_field_s16) + +### Lua Example +`obj_set_field_s16(o, fieldIndex, fieldSubIndex, value)` + +### Parameters +| Field | Type | +| ----- | ---- | +| o | [Object](structs.md#Object) | +| fieldIndex | `integer` | +| fieldSubIndex | `integer` | +| value | `integer` | + +### Returns +- None + +### C Prototype +`void obj_set_field_s16(struct Object *o, s32 fieldIndex, s32 fieldSubIndex, s16 value);` + +[:arrow_up_small:](#) + +
+ +## [obj_set_field_s32](#obj_set_field_s32) + +### Lua Example +`obj_set_field_s32(o, fieldIndex, value)` + +### Parameters +| Field | Type | +| ----- | ---- | +| o | [Object](structs.md#Object) | +| fieldIndex | `integer` | +| value | `integer` | + +### Returns +- None + +### C Prototype +`void obj_set_field_s32(struct Object *o, s32 fieldIndex, s32 value);` + +[:arrow_up_small:](#) + +
+ +## [obj_set_field_u32](#obj_set_field_u32) + +### Lua Example +`obj_set_field_u32(o, fieldIndex, value)` + +### Parameters +| Field | Type | +| ----- | ---- | +| o | [Object](structs.md#Object) | +| fieldIndex | `integer` | +| value | `integer` | + +### Returns +- None + +### C Prototype +`void obj_set_field_u32(struct Object *o, s32 fieldIndex, u32 value);` + +[:arrow_up_small:](#) + +
+ +## [obj_set_model_extended](#obj_set_model_extended) + +### Lua Example +`obj_set_model_extended(o, modelId)` + +### Parameters +| Field | Type | +| ----- | ---- | +| o | [Object](structs.md#Object) | +| modelId | [enum ModelExtendedId](constants.md#enum-ModelExtendedId) | + +### Returns +- None + +### C Prototype +`void obj_set_model_extended(struct Object *o, enum ModelExtendedId modelId);` + +[:arrow_up_small:](#) + +
+ +## [obj_set_vel](#obj_set_vel) + +### Lua Example +`obj_set_vel(o, vx, vy, vz)` + +### Parameters +| Field | Type | +| ----- | ---- | +| o | [Object](structs.md#Object) | +| vx | `number` | +| vy | `number` | +| vz | `number` | + +### Returns +- None + +### C Prototype +`void obj_set_vel(struct Object *o, f32 vx, f32 vy, f32 vz);` + +[:arrow_up_small:](#) + +
+ +## [set_whirlpools](#set_whirlpools) + +### Lua Example +`set_whirlpools(x, y, z, strength, area, index)` + +### Parameters +| Field | Type | +| ----- | ---- | +| x | `number` | +| y | `number` | +| z | `number` | +| strength | `integer` | +| area | `integer` | +| index | `integer` | + +### Returns +- None + +### C Prototype +`void set_whirlpools(f32 x, f32 y, f32 z, s16 strength, s16 area, s32 index);` + +[:arrow_up_small:](#) + +
+ +## [spawn_non_sync_object](#spawn_non_sync_object) + +### Lua Example +`local ObjectValue = spawn_non_sync_object(behaviorId, modelId, x, y, z, objSetupFunction)` + +### Parameters +| Field | Type | +| ----- | ---- | +| behaviorId | [enum BehaviorId](constants.md#enum-BehaviorId) | +| modelId | [enum ModelExtendedId](constants.md#enum-ModelExtendedId) | +| x | `number` | +| y | `number` | +| z | `number` | +| objSetupFunction | `Lua Function` () | + +### Returns +[Object](structs.md#Object) + +### C Prototype +`struct Object* spawn_non_sync_object(enum BehaviorId behaviorId, enum ModelExtendedId modelId, f32 x, f32 y, f32 z, LuaFunction objSetupFunction);` + +[:arrow_up_small:](#) + +
+ +## [spawn_sync_object](#spawn_sync_object) + +### Lua Example +`local ObjectValue = spawn_sync_object(behaviorId, modelId, x, y, z, objSetupFunction)` + +### Parameters +| Field | Type | +| ----- | ---- | +| behaviorId | [enum BehaviorId](constants.md#enum-BehaviorId) | +| modelId | [enum ModelExtendedId](constants.md#enum-ModelExtendedId) | +| x | `number` | +| y | `number` | +| z | `number` | +| objSetupFunction | `Lua Function` () | + +### Returns +[Object](structs.md#Object) + +### C Prototype +`struct Object* spawn_sync_object(enum BehaviorId behaviorId, enum ModelExtendedId modelId, f32 x, f32 y, f32 z, LuaFunction objSetupFunction);` + +[:arrow_up_small:](#) + +
+ +--- +# functions from smlua_text_utils.h + +
+ + +## [smlua_text_utils_act_name_get](#smlua_text_utils_act_name_get) + +### Lua Example +`local stringValue = smlua_text_utils_act_name_get(courseNum, actNum)` + +### Parameters +| Field | Type | +| ----- | ---- | +| courseNum | `integer` | +| actNum | `integer` | + +### Returns +- `string` + +### C Prototype +`const char* smlua_text_utils_act_name_get(s16 courseNum, u8 actNum);` + +[:arrow_up_small:](#) + +
+ +## [smlua_text_utils_act_name_mod_index](#smlua_text_utils_act_name_mod_index) + +### Lua Example +`local integerValue = smlua_text_utils_act_name_mod_index(courseNum, actNum)` + +### Parameters +| Field | Type | +| ----- | ---- | +| courseNum | `integer` | +| actNum | `integer` | + +### Returns +- `integer` + +### C Prototype +`s32 smlua_text_utils_act_name_mod_index(s16 courseNum, u8 actNum);` + +[:arrow_up_small:](#) + +
+ +## [smlua_text_utils_act_name_replace](#smlua_text_utils_act_name_replace) + +### Lua Example +`smlua_text_utils_act_name_replace(courseNum, actNum, name)` + +### Parameters +| Field | Type | +| ----- | ---- | +| courseNum | `integer` | +| actNum | `integer` | +| name | `string` | + +### Returns +- None + +### C Prototype +`void smlua_text_utils_act_name_replace(s16 courseNum, u8 actNum, const char* name);` + +[:arrow_up_small:](#) + +
+ +## [smlua_text_utils_act_name_reset](#smlua_text_utils_act_name_reset) + +### Lua Example +`smlua_text_utils_act_name_reset(courseNum, actNum)` + +### Parameters +| Field | Type | +| ----- | ---- | +| courseNum | `integer` | +| actNum | `integer` | + +### Returns +- None + +### C Prototype +`void smlua_text_utils_act_name_reset(s16 courseNum, u8 actNum);` + +[:arrow_up_small:](#) + +
+ +## [smlua_text_utils_castle_secret_stars_replace](#smlua_text_utils_castle_secret_stars_replace) + +### Lua Example +`smlua_text_utils_castle_secret_stars_replace(name)` + +### Parameters +| Field | Type | +| ----- | ---- | +| name | `string` | + +### Returns +- None + +### C Prototype +`void smlua_text_utils_castle_secret_stars_replace(const char* name);` + +[:arrow_up_small:](#) + +
+ +## [smlua_text_utils_course_acts_replace](#smlua_text_utils_course_acts_replace) + +### Lua Example +`smlua_text_utils_course_acts_replace(courseNum, courseName, act1, act2, act3, act4, act5, act6)` + +### Parameters +| Field | Type | +| ----- | ---- | +| courseNum | `integer` | +| courseName | `string` | +| act1 | `string` | +| act2 | `string` | +| act3 | `string` | +| act4 | `string` | +| act5 | `string` | +| act6 | `string` | + +### Returns +- None + +### C Prototype +`void smlua_text_utils_course_acts_replace(s16 courseNum, const char* courseName, const char* act1, const char* act2, const char* act3, const char* act4, const char* act5, const char* act6);` + +[:arrow_up_small:](#) + +
+ +## [smlua_text_utils_course_name_get](#smlua_text_utils_course_name_get) + +### Lua Example +`local stringValue = smlua_text_utils_course_name_get(courseNum)` + +### Parameters +| Field | Type | +| ----- | ---- | +| courseNum | `integer` | + +### Returns +- `string` + +### C Prototype +`const char* smlua_text_utils_course_name_get(s16 courseNum);` + +[:arrow_up_small:](#) + +
+ +## [smlua_text_utils_course_name_mod_index](#smlua_text_utils_course_name_mod_index) + +### Lua Example +`local integerValue = smlua_text_utils_course_name_mod_index(courseNum)` + +### Parameters +| Field | Type | +| ----- | ---- | +| courseNum | `integer` | + +### Returns +- `integer` + +### C Prototype +`s32 smlua_text_utils_course_name_mod_index(s16 courseNum);` + +[:arrow_up_small:](#) + +
+ +## [smlua_text_utils_course_name_replace](#smlua_text_utils_course_name_replace) + +### Lua Example +`smlua_text_utils_course_name_replace(courseNum, name)` + +### Parameters +| Field | Type | +| ----- | ---- | +| courseNum | `integer` | +| name | `string` | + +### Returns +- None + +### C Prototype +`void smlua_text_utils_course_name_replace(s16 courseNum, const char* name);` + +[:arrow_up_small:](#) + +
+ +## [smlua_text_utils_course_name_reset](#smlua_text_utils_course_name_reset) + +### Lua Example +`smlua_text_utils_course_name_reset(courseNum)` + +### Parameters +| Field | Type | +| ----- | ---- | +| courseNum | `integer` | + +### Returns +- None + +### C Prototype +`void smlua_text_utils_course_name_reset(s16 courseNum);` + +[:arrow_up_small:](#) + +
+ +## [smlua_text_utils_dialog_replace](#smlua_text_utils_dialog_replace) + +### Lua Example +`smlua_text_utils_dialog_replace(dialogId, unused, linesPerBox, leftOffset, width, str)` + +### Parameters +| Field | Type | +| ----- | ---- | +| dialogId | [enum DialogId](constants.md#enum-DialogId) | +| unused | `integer` | +| linesPerBox | `integer` | +| leftOffset | `integer` | +| width | `integer` | +| str | `string` | + +### Returns +- None + +### C Prototype +`void smlua_text_utils_dialog_replace(enum DialogId dialogId, u32 unused, s8 linesPerBox, s16 leftOffset, s16 width, const char* str);` + +[:arrow_up_small:](#) + +
+ +## [smlua_text_utils_extra_text_replace](#smlua_text_utils_extra_text_replace) + +### Lua Example +`smlua_text_utils_extra_text_replace(index, text)` + +### Parameters +| Field | Type | +| ----- | ---- | +| index | `integer` | +| text | `string` | + +### Returns +- None + +### C Prototype +`void smlua_text_utils_extra_text_replace(s16 index, const char* text);` + +[:arrow_up_small:](#) + +
+ +## [smlua_text_utils_get_language](#smlua_text_utils_get_language) + +### Lua Example +`local stringValue = smlua_text_utils_get_language()` + +### Parameters +- None + +### Returns +- `string` + +### C Prototype +`const char* smlua_text_utils_get_language(void);` + +[:arrow_up_small:](#) + +
+ +## [smlua_text_utils_secret_star_replace](#smlua_text_utils_secret_star_replace) + +### Lua Example +`smlua_text_utils_secret_star_replace(courseNum, courseName)` + +### Parameters +| Field | Type | +| ----- | ---- | +| courseNum | `integer` | +| courseName | `string` | + +### Returns +- None + +### C Prototype +`void smlua_text_utils_secret_star_replace(s16 courseNum, const char* courseName);` + +[:arrow_up_small:](#) + +
+ +--- +# functions from sound_init.h + +
+ + +## [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:](#) + +
+ +## [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:](#) + +
+ +## [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:](#) + +
+ +## [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:](#) + +
+ +## [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:](#) + +
+ +## [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:](#) + +
+ +## [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:](#) + +
+ +## [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:](#) + +
+ +## [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:](#) + +
+ +## [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:](#) + +
+ +## [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:](#) + +
+ +## [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:](#) + +
+ +## [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:](#) + +
+ +## [reset_volume](#reset_volume) + +### Lua Example +`reset_volume()` + +### Parameters +- None + +### Returns +- None + +### C Prototype +`void reset_volume(void);` + +[:arrow_up_small:](#) + +
+ +## [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:](#) + +
+ +## [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:](#) + +
+ +## [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:](#) + +
+ +--- +# functions from spawn_sound.c + +
+ + +## [calc_dist_to_volume_range_1](#calc_dist_to_volume_range_1) + +### Lua Example +`local integerValue = calc_dist_to_volume_range_1(distance)` + +### Parameters +| Field | Type | +| ----- | ---- | +| distance | `number` | + +### Returns +- `integer` + +### C Prototype +`s32 calc_dist_to_volume_range_1(f32 distance);` + +[:arrow_up_small:](#) + +
+ +## [calc_dist_to_volume_range_2](#calc_dist_to_volume_range_2) + +### Lua Example +`local integerValue = calc_dist_to_volume_range_2(distance)` + +### Parameters +| Field | Type | +| ----- | ---- | +| distance | `number` | + +### Returns +- `integer` + +### C Prototype +`s32 calc_dist_to_volume_range_2(f32 distance);` + +[:arrow_up_small:](#) + +
+ +## [cur_obj_play_sound_1](#cur_obj_play_sound_1) + +### Lua Example +`cur_obj_play_sound_1(soundMagic)` + +### Parameters +| Field | Type | +| ----- | ---- | +| soundMagic | `integer` | + +### Returns +- None + +### C Prototype +`void cur_obj_play_sound_1(s32 soundMagic);` + +[:arrow_up_small:](#) + +
+ +## [cur_obj_play_sound_2](#cur_obj_play_sound_2) + +### Lua Example +`cur_obj_play_sound_2(soundMagic)` + +### Parameters +| Field | Type | +| ----- | ---- | +| soundMagic | `integer` | + +### Returns +- None + +### C Prototype +`void cur_obj_play_sound_2(s32 soundMagic);` + +[:arrow_up_small:](#) + +
+ +## [exec_anim_sound_state](#exec_anim_sound_state) + +### Lua Example +`exec_anim_sound_state(soundStates, maxSoundStates)` + +### Parameters +| Field | Type | +| ----- | ---- | +| soundStates | [SoundState](structs.md#SoundState) | +| maxSoundStates | `integer` | + +### Returns +- None + +### C Prototype +`void exec_anim_sound_state(struct SoundState *soundStates, u16 maxSoundStates);` + +[:arrow_up_small:](#) + +
+ +--- +# functions from surface_collision.h + +
+ + +## [find_ceil_height](#find_ceil_height) + +### Lua Example +`local numberValue = find_ceil_height(x, y, z)` + +### Parameters +| Field | Type | +| ----- | ---- | +| x | `number` | +| y | `number` | +| z | `number` | + +### Returns +- `number` + +### C Prototype +`f32 find_ceil_height(f32 x, f32 y, f32 z);` + +[:arrow_up_small:](#) + +
+ +## [find_floor_height](#find_floor_height) + +### Lua Example +`local numberValue = find_floor_height(x, y, z)` + +### Parameters +| Field | Type | +| ----- | ---- | +| x | `number` | +| y | `number` | +| z | `number` | + +### Returns +- `number` + +### C Prototype +`f32 find_floor_height(f32 x, f32 y, f32 z);` + +[:arrow_up_small:](#) + +
+ +## [find_poison_gas_level](#find_poison_gas_level) + +### Lua Example +`local numberValue = find_poison_gas_level(x, z)` + +### Parameters +| Field | Type | +| ----- | ---- | +| x | `number` | +| z | `number` | + +### Returns +- `number` + +### C Prototype +`f32 find_poison_gas_level(f32 x, f32 z);` + +[:arrow_up_small:](#) + +
+ +## [find_wall_collisions](#find_wall_collisions) + +### Lua Example +`local integerValue = find_wall_collisions(colData)` + +### Parameters +| Field | Type | +| ----- | ---- | +| colData | [WallCollisionData](structs.md#WallCollisionData) | + +### Returns +- `integer` + +### C Prototype +`s32 find_wall_collisions(struct WallCollisionData *colData);` + +[:arrow_up_small:](#) + +
+ +## [find_water_level](#find_water_level) + +### Lua Example +`local numberValue = find_water_level(x, z)` + +### Parameters +| Field | Type | +| ----- | ---- | +| x | `number` | +| z | `number` | + +### Returns +- `number` + +### C Prototype +`f32 find_water_level(f32 x, f32 z);` + +[:arrow_up_small:](#) + +
+ +--- +# functions from surface_load.h + +
+ + +## [alloc_surface_pools](#alloc_surface_pools) + +### Lua Example +`alloc_surface_pools()` + +### Parameters +- None + +### Returns +- None + +### C Prototype +`void alloc_surface_pools(void);` + +[:arrow_up_small:](#) + +
+ +## [clear_dynamic_surfaces](#clear_dynamic_surfaces) + +### Lua Example +`clear_dynamic_surfaces()` + +### Parameters +- None + +### Returns +- None + +### C Prototype +`void clear_dynamic_surfaces(void);` + +[:arrow_up_small:](#) + +
+ +## [get_area_terrain_size](#get_area_terrain_size) + +### Lua Example +`local integerValue = get_area_terrain_size(data)` + +### Parameters +| Field | Type | +| ----- | ---- | +| data | `Pointer` <`integer`> | + +### Returns +- `integer` + +### C Prototype +`u32 get_area_terrain_size(s16 *data);` + +[:arrow_up_small:](#) + +
+ +## [load_area_terrain](#load_area_terrain) + +### Lua Example +`load_area_terrain(index, data, surfaceRooms, macroObjects)` + +### Parameters +| Field | Type | +| ----- | ---- | +| index | `integer` | +| data | `Pointer` <`integer`> | +| surfaceRooms | `Pointer` <`integer`> | +| macroObjects | `Pointer` <`integer`> | + +### Returns +- None + +### C Prototype +`void load_area_terrain(s16 index, s16 *data, s8 *surfaceRooms, s16 *macroObjects);` + +[:arrow_up_small:](#) + +
+ +## [load_object_collision_model](#load_object_collision_model) + +### Lua Example +`load_object_collision_model()` + +### Parameters +- None + +### Returns +- None + +### C Prototype +`void load_object_collision_model(void);` + +[:arrow_up_small:](#) + +
+ +## [obj_get_surface_from_index](#obj_get_surface_from_index) + +### Lua Example +`local SurfaceValue = obj_get_surface_from_index(o, index)` + +### Parameters +| Field | Type | +| ----- | ---- | +| o | [Object](structs.md#Object) | +| index | `integer` | + +### Returns +[Surface](structs.md#Surface) + +### C Prototype +`struct Surface *obj_get_surface_from_index(struct Object *o, u32 index);` + +[:arrow_up_small:](#) + +
+ +## [surface_has_force](#surface_has_force) + +### Lua Example +`local booleanValue = surface_has_force(surfaceType)` + +### Parameters +| Field | Type | +| ----- | ---- | +| surfaceType | `integer` | + +### Returns +- `boolean` + +### C Prototype +`bool surface_has_force(s16 surfaceType);` + +[:arrow_up_small:](#) + +
+ +--- + +[< prev](functions-5.md) | [1](functions.md) | [2](functions-2.md) | [3](functions-3.md) | [4](functions-4.md) | [5](functions-5.md) | 6] + diff --git a/docs/lua/functions.md b/docs/lua/functions.md index 4623a1bad..8e09775fc 100644 --- a/docs/lua/functions.md +++ b/docs/lua/functions.md @@ -1539,6 +1539,7 @@ - [player_performed_grab_escape_action](functions-4.md#player_performed_grab_escape_action) - [random_f32_around_zero](functions-4.md#random_f32_around_zero) - [set_mario_interact_hoot_if_in_range](functions-4.md#set_mario_interact_hoot_if_in_range) + - [set_room_override](functions-4.md#set_room_override) - [set_time_stop_flags](functions-4.md#set_time_stop_flags) - [set_time_stop_flags_if_alone](functions-4.md#set_time_stop_flags_if_alone) - [signum_positive](functions-4.md#signum_positive) @@ -1923,6 +1924,7 @@ - [load_area_terrain](functions-5.md#load_area_terrain) - [load_object_collision_model](functions-5.md#load_object_collision_model) - [obj_get_surface_from_index](functions-5.md#obj_get_surface_from_index) + - [surface_has_force](functions-5.md#surface_has_force)
diff --git a/src/game/object_helpers.c b/src/game/object_helpers.c index 6db7b6046..39c936be0 100644 --- a/src/game/object_helpers.c +++ b/src/game/object_helpers.c @@ -185,6 +185,12 @@ Gfx *geo_switch_anim_state(s32 callContext, struct GraphNode *node) { return NULL; } +s16 gRoomOverride = -1; + +void set_room_override(s16 room) { + gRoomOverride = room; +} + //! @bug Same issue as geo_switch_anim_state. #ifdef AVOID_UB Gfx *geo_switch_area(s32 callContext, struct GraphNode *node, UNUSED void *context) { @@ -198,7 +204,9 @@ Gfx *geo_switch_area(s32 callContext, struct GraphNode *node) { struct GraphNodeSwitchCase *switchCase = (struct GraphNodeSwitchCase *) node; if (callContext == GEO_CONTEXT_RENDER) { - if (gMarioObject == NULL) { + if (gRoomOverride >= 0) { + switchCase->selectedCase = gRoomOverride - 1; + } else if (gMarioObject == NULL) { switchCase->selectedCase = 0; } else { gFindFloorIncludeSurfaceIntangible = TRUE; diff --git a/src/pc/lua/smlua_functions_autogen.c b/src/pc/lua/smlua_functions_autogen.c index a54e9ad3d..49eb8fd67 100644 --- a/src/pc/lua/smlua_functions_autogen.c +++ b/src/pc/lua/smlua_functions_autogen.c @@ -27595,6 +27595,24 @@ int smlua_func_set_mario_interact_hoot_if_in_range(lua_State* L) { return 1; } +int smlua_func_set_room_override(lua_State* L) { + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 1) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "set_room_override", 1, top); + return 0; + } + + s16 room = smlua_to_integer(L, 1); + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "set_room_override"); return 0; } + + extern void set_room_override(s16 room); + set_room_override(room); + + return 1; +} + int smlua_func_set_time_stop_flags(lua_State* L) { if (L == NULL) { return 0; } @@ -34865,6 +34883,7 @@ void smlua_bind_functions_autogen(void) { smlua_bind_function(L, "player_performed_grab_escape_action", smlua_func_player_performed_grab_escape_action); smlua_bind_function(L, "random_f32_around_zero", smlua_func_random_f32_around_zero); smlua_bind_function(L, "set_mario_interact_hoot_if_in_range", smlua_func_set_mario_interact_hoot_if_in_range); + smlua_bind_function(L, "set_room_override", smlua_func_set_room_override); smlua_bind_function(L, "set_time_stop_flags", smlua_func_set_time_stop_flags); smlua_bind_function(L, "set_time_stop_flags_if_alone", smlua_func_set_time_stop_flags_if_alone); smlua_bind_function(L, "signum_positive", smlua_func_signum_positive);