diff --git a/autogen/lua_definitions/constants.lua b/autogen/lua_definitions/constants.lua index e5019fb4d..3fbca7d65 100644 --- a/autogen/lua_definitions/constants.lua +++ b/autogen/lua_definitions/constants.lua @@ -1983,7 +1983,13 @@ id_bhvYellowCoin = 533 id_bhvYoshi = 534 --- @type BehaviorId -id_bhv_max_count = 535 +id_RM_Scroll_Texture = 535 + +--- @type BehaviorId +id_editor_Scroll_Texture = 536 + +--- @type BehaviorId +id_bhv_max_count = 537 --- @type integer CAMERA_MODE_8_DIRECTIONS = 0x0E diff --git a/autogen/lua_definitions/functions.lua b/autogen/lua_definitions/functions.lua index 16b5f34b9..4d01779f5 100644 --- a/autogen/lua_definitions/functions.lua +++ b/autogen/lua_definitions/functions.lua @@ -2852,6 +2852,11 @@ function update_angle_from_move_flags(angle) -- ... end +--- @return nil +function uv_update_scroll() + -- ... +end + --- @param dest Vec3f --- @param src Vec3f --- @return nil @@ -7527,6 +7532,13 @@ function warp_to_level(aLevel, aArea, aAct) -- ... end +--- @param index integer +--- @param name string +--- @param offset integer +--- @param size integer +--- @return nil +function add_scroll_target(index, name, offset, size) + --- @return boolean function warp_to_start_level() -- ... @@ -7745,6 +7757,11 @@ function hud_show() -- ... end +--- @return nil +function init_scroll_targets() + -- ... +end + --- @return boolean function is_game_paused() -- ... diff --git a/data/behavior_data.c b/data/behavior_data.c index 6b899cb4a..9cea0cab3 100644 --- a/data/behavior_data.c +++ b/data/behavior_data.c @@ -6379,3 +6379,19 @@ const BehaviorScript bhvIntroScene[] = { CALL_NATIVE(bhv_intro_scene_loop), END_LOOP(), }; + +const BehaviorScript RM_Scroll_Texture[] = { + BEGIN(OBJ_LIST_GENACTOR), + ID(id_RM_Scroll_Texture), + BEGIN_LOOP(), + CALL_NATIVE(uv_update_scroll), + END_LOOP(), +}; + +const BehaviorScript editor_Scroll_Texture[] = { + BEGIN(OBJ_LIST_GENACTOR), + ID(id_editor_Scroll_Texture), + BEGIN_LOOP(), + CALL_NATIVE(uv_update_scroll), + END_LOOP(), +}; diff --git a/data/behavior_table.c b/data/behavior_table.c index 7b4d0c627..f325f581d 100644 --- a/data/behavior_table.c +++ b/data/behavior_table.c @@ -546,6 +546,8 @@ const struct BehaviorTableEntry gBehaviorTable[id_bhv_max_count] = { BHV_ENTRY(bhvYellowBall), BHV_ENTRY(bhvYellowCoin), BHV_ENTRY(bhvYoshi), + BHV_ENTRY(RM_Scroll_Texture), + BHV_ENTRY(editor_Scroll_Texture) }; enum BehaviorId get_id_from_behavior(const BehaviorScript* behavior) { diff --git a/data/dynos.c.h b/data/dynos.c.h index 4c0d5782e..d3fa1225b 100644 --- a/data/dynos.c.h +++ b/data/dynos.c.h @@ -65,6 +65,8 @@ void dynos_behavior_hook_all_custom_behaviors(void); // -- other -- // void dynos_mod_shutdown(void); +void dynos_add_scroll_target(u32 index, const char *name, u32 offset, u32 size); +void dynos_init_scroll_targets(void); #endif #endif diff --git a/data/dynos.cpp.h b/data/dynos.cpp.h index e21353334..7b5d0bc22 100644 --- a/data/dynos.cpp.h +++ b/data/dynos.cpp.h @@ -1064,5 +1064,8 @@ bool DynOS_Bin_IsCompressed(const SysPath &aFilename); bool DynOS_Bin_Compress(const SysPath &aFilename); BinFile *DynOS_Bin_Decompress(const SysPath &aFilename); +void DynOS_Add_Scroll_Target(u32 index, const char *name, u32 offset, u32 size); +void DynOS_Init_Scroll_Targets(void); + #endif #endif diff --git a/data/dynos_bin_behavior.cpp b/data/dynos_bin_behavior.cpp index d141e2fdf..0d8b84544 100644 --- a/data/dynos_bin_behavior.cpp +++ b/data/dynos_bin_behavior.cpp @@ -771,6 +771,8 @@ s64 DynOS_Bhv_ParseBehaviorScriptConstants(const String &_Arg, bool *found) { bhv_constant(id_bhvYellowBall); bhv_constant(id_bhvYellowCoin); bhv_constant(id_bhvYoshi); + bhv_constant(id_RM_Scroll_Texture); + bhv_constant(id_editor_Scroll_Texture); // Define a special type for new ids that don't override. if (_Arg == "id_bhvNewId") { return (BehaviorScript) (0xFFFF); } @@ -2673,4 +2675,4 @@ void DynOS_Bhv_GeneratePack(const SysPath &aPackFolder) { DynOS_Bhv_Generate(aPackFolder, _BehaviorsFolders, _GfxData); DynOS_Gfx_Free(_GfxData); -} \ No newline at end of file +} diff --git a/data/dynos_bin_common.cpp b/data/dynos_bin_common.cpp index 8de35f713..abdf94641 100644 --- a/data/dynos_bin_common.cpp +++ b/data/dynos_bin_common.cpp @@ -547,6 +547,8 @@ s64 DynOS_Common_ParseBhvConstants(const String &_Arg, bool *found) { common_constant(bhvEndBirds2); common_constant(bhvIntroScene); common_constant(bhvUnusedFakeStar); + common_constant(RM_Scroll_Texture); + common_constant(editor_Scroll_Texture); // Legacy behavior names common_legacy_constant(bhvFish2, bhvManyBlueFishSpawner); diff --git a/data/dynos_c.cpp b/data/dynos_c.cpp index f5f79578a..3adc2df6b 100644 --- a/data/dynos_c.cpp +++ b/data/dynos_c.cpp @@ -198,4 +198,12 @@ void dynos_mod_shutdown(void) { DynOS_Mod_Shutdown(); } +void dynos_add_scroll_target(u32 index, const char *name, u32 offset, u32 size) { + DynOS_Add_Scroll_Target(index, name, offset, size); +} + +void dynos_init_scroll_targets(void) { + DynOS_Init_Scroll_Targets(); +} + } diff --git a/data/dynos_misc.cpp b/data/dynos_misc.cpp index c34fa0a9e..3c99d6a42 100644 --- a/data/dynos_misc.cpp +++ b/data/dynos_misc.cpp @@ -16,6 +16,7 @@ extern "C" { #include "game/behavior_actions.h" #include "game/rendering_graph_node.h" #include "game/skybox.h" +#include "game/scroll_targets.h" } // @@ -174,3 +175,21 @@ void *DynOS_Geo_GetGraphNode(const void *aGeoLayout, bool aKeepInMemory) { free(_Pool); return NULL; } + +// +// Scroll Targets +// + +void DynOS_Add_Scroll_Target(u32 index, const char* name, u32 offset, u32 size) { + for (auto& lvlPair : DynOS_Lvl_GetArray()) { + for (auto& node : lvlPair.second->mVertices) { + if (node->mName.Find(name) >= 0) { + add_vtx_scroll_target(index, &node->mData[offset], size); + } + } + } +} + +void DynOS_Init_Scroll_Targets(void) { + init_vtx_scroll_targets(); +} diff --git a/docs/lua/constants.md b/docs/lua/constants.md index 760541f8c..7ac323fa4 100644 --- a/docs/lua/constants.md +++ b/docs/lua/constants.md @@ -619,7 +619,9 @@ | id_bhvYellowBall | 532 | | id_bhvYellowCoin | 533 | | id_bhvYoshi | 534 | -| id_bhv_max_count | 535 | +| id_RM_Scroll_Texture | 535 | +| id_editor_Scroll_Texture | 536 | +| id_bhv_max_count | 537 | [:arrow_up_small:](#) diff --git a/docs/lua/functions-2.md b/docs/lua/functions-2.md index cd17218c3..ea85d7882 100644 --- a/docs/lua/functions-2.md +++ b/docs/lua/functions-2.md @@ -10184,6 +10184,24 @@
+## [uv_update_scroll](#uv_update_scroll) + +### Lua Example +`uv_update_scroll()` + +### Parameters +- None + +### Returns +- None + +### C Prototype +`void uv_update_scroll(void);` + +[:arrow_up_small:](#) + +
+ ## [vec3f_copy_2](#vec3f_copy_2) ### Lua Example diff --git a/docs/lua/functions-4.md b/docs/lua/functions-4.md index 43069451b..61d8eb8a1 100644 --- a/docs/lua/functions-4.md +++ b/docs/lua/functions-4.md @@ -6310,6 +6310,29 @@
+## [add_scroll_target](#add_scroll_target) + +### Lua Example +`add_scroll_target(index, name, offset, size)` + +### Parameters +| Field | Type | +| ----- | ---- | +| index | `integer` | +| name | `string` | +| offset | `integer` | +| size | `integer` | + +### Returns +- None + +### C Prototype +`void add_scroll_target(u32 index, const char* name, u32 offset, u32 size);` + +[:arrow_up_small:](#) + +
+ ## [allocate_mario_action](#allocate_mario_action) ### Lua Example @@ -7024,6 +7047,24 @@
+## [init_scroll_targets](#init_scroll_targets) + +### Lua Example +`init_scroll_targets()` + +### Parameters +- None + +### Returns +- None + +### C Prototype +`void init_scroll_targets(void);` + +[:arrow_up_small:](#) + +
+ ## [is_game_paused](#is_game_paused) ### Lua Example diff --git a/docs/lua/functions.md b/docs/lua/functions.md index 93ca199b7..d8d9cb142 100644 --- a/docs/lua/functions.md +++ b/docs/lua/functions.md @@ -583,6 +583,7 @@ - [spawn_wind_particles](functions-2.md#spawn_wind_particles) - [tox_box_move](functions-2.md#tox_box_move) - [update_angle_from_move_flags](functions-2.md#update_angle_from_move_flags) + - [uv_update_scroll](functions-2.md#uv_update_scroll) - [vec3f_copy_2](functions-2.md#vec3f_copy_2)
@@ -1405,6 +1406,7 @@
- smlua_misc_utils.h + - [add_scroll_target](functions-4.md#add_scroll_target) - [allocate_mario_action](functions-4.md#allocate_mario_action) - [camera_config_enable_analog_cam](functions-4.md#camera_config_enable_analog_cam) - [camera_config_enable_free_cam](functions-4.md#camera_config_enable_free_cam) @@ -1442,6 +1444,7 @@ - [hud_render_power_meter](functions-4.md#hud_render_power_meter) - [hud_set_value](functions-4.md#hud_set_value) - [hud_show](functions-4.md#hud_show) + - [init_scroll_targets](functions-4.md#init_scroll_targets) - [is_game_paused](functions-4.md#is_game_paused) - [is_transition_playing](functions-4.md#is_transition_playing) - [movtexqc_register](functions-4.md#movtexqc_register) diff --git a/include/behavior_data.h b/include/behavior_data.h index 4eb2c0d0e..58cb9ffc8 100644 --- a/include/behavior_data.h +++ b/include/behavior_data.h @@ -539,5 +539,7 @@ extern const BehaviorScript bhvEndBirds1[]; extern const BehaviorScript bhvEndBirds2[]; extern const BehaviorScript bhvIntroScene[]; extern const BehaviorScript bhvUnusedFakeStar[]; +extern const BehaviorScript RM_Scroll_Texture[]; +extern const BehaviorScript editor_Scroll_Texture[]; #endif // BEHAVIOR_DATA_H diff --git a/include/behavior_table.h b/include/behavior_table.h index c595b282d..a18b67105 100644 --- a/include/behavior_table.h +++ b/include/behavior_table.h @@ -539,6 +539,8 @@ enum BehaviorId { id_bhvYellowBall, id_bhvYellowCoin, id_bhvYoshi, + id_RM_Scroll_Texture, + id_editor_Scroll_Texture, id_bhv_max_count // must be the last in the list }; diff --git a/src/game/behavior_actions.c b/src/game/behavior_actions.c index 4e3596cdf..4aac79222 100644 --- a/src/game/behavior_actions.c +++ b/src/game/behavior_actions.c @@ -284,3 +284,4 @@ s32 set_obj_anim_with_accel_and_sound(s16 a0, s16 a1, s32 a2) { #include "behaviors/strong_wind_particle.inc.c" #include "behaviors/sl_snowman_wind.inc.c" #include "behaviors/sl_walking_penguin.inc.c" +#include "behaviors/texscroll.inc.c" diff --git a/src/game/behavior_actions.h b/src/game/behavior_actions.h index 95f1899e9..506bece52 100644 --- a/src/game/behavior_actions.h +++ b/src/game/behavior_actions.h @@ -565,6 +565,7 @@ void bhv_intro_scene_loop(void); void bhv_dust_smoke_loop(void); void bhv_yoshi_loop(void); void bhv_volcano_trap_loop(void); +void uv_update_scroll(void); Gfx *geo_move_mario_part_from_parent(s32 run, UNUSED struct GraphNode *node, Mat4 mtx); diff --git a/src/game/behaviors/texscroll.inc.c b/src/game/behaviors/texscroll.inc.c new file mode 100644 index 000000000..b135469c0 --- /dev/null +++ b/src/game/behaviors/texscroll.inc.c @@ -0,0 +1,138 @@ +/* + * All credit goes to https://github.com/jesusyoshi54 + * also known as scuttlebugraiser, the creator of RM2C + * Created for the project https://github.com/jesusyoshi54/sm64ex-alo for RM2C support + * https://github.com/jesusyoshi54/sm64ex-alo/blob/master/src/game/behaviors/texscroll.inc.c + */ + +#include +#include "engine/math_util.h" +#include "src/game/scroll_targets.h" +#include "pc/pc_main.h" +#include "pc/utils/misc.h" + +/* SCROLLING BHVS */ +#define SCROLL_X 0 +#define SCROLL_Y 1 +#define SCROLL_Z 2 +#define SCROLL_UV_X 4 +#define SCROLL_UV_Y 5 + +/* SCROLLING TYPES */ +#define MODE_SCROLL_UV 0 +#define MODE_SCROLL_SINE 182 // 1 +#define MODE_SCROLL_JUMP 108 // 2 + +// typedef struct { + // float ob[3]; /* x, y, z */ + // unsigned short flag; + // short tc[2]; /* texture coord */ + // signed char n[3]; /* normal */ + // unsigned char a; /* alpha */ +// } Vtx_tn; + +// typedef union { + // Vtx_t v; /* Use this one for colors */ + // Vtx_tn n; /* Use this one for normals */ + // long long int force_structure_alignment; +// } Vtx; +extern Vtx *gScrollTargets[]; +extern f32 gRenderingDelta; + +static void shift_UV_JUMP(s32 vtxIndex, u16 vertcount, s16 speed, u16 bhv, u16 cycle) { + Vtx* *verts = get_scroll_targets(vtxIndex); + u16 i; + + if (verts[0]->n.flag++ <= cycle) { + return; + } + + verts[0]->n.flag = 0; + + if (bhv < SCROLL_UV_X) { + for (i = 0; i < vertcount; i++) { + verts[i]->n.ob[bhv] += speed; + } + } else { + for (i = 0; i < vertcount; i++) { + verts[i]->n.tc[bhv-SCROLL_UV_X] += speed; + } + } +} + +static void shift_UV_NORMAL(u32 vtxIndex, u16 vertcount, s16 speed, u16 bhv, u16 cycle) { + u16 overflownum = 0x1000; + Vtx* *verts = get_scroll_targets(vtxIndex); + u16 correction = 0; + u16 i; + + if (bhv < SCROLL_UV_X) { + if (verts[0]->n.flag >= cycle) { + correction = verts[0]->n.flag * speed; + verts[0]->n.flag = 0; + } + + for (i = 0; i < vertcount; i++) { + if (correction == 0) { + verts[i]->n.ob[bhv] += speed; + } else { + verts[i]->n.ob[bhv] -= correction; + } + } + } else { + if (verts[0]->n.flag * absi(speed) > overflownum) { + correction = overflownum * signum_positive(speed); + verts[0]->n.flag = 0; + } + + for (i = 0; i < vertcount; i++) { + if (correction == 0) { + verts[i]->n.tc[bhv-SCROLL_UV_X] += speed; + } else { + verts[i]->n.tc[bhv-SCROLL_UV_X] -= correction; + } + } + } + + if (correction == 0) { + verts[0]->n.flag++; + } +} + +static void shift_UV_SINE(u32 vtxIndex, u16 vertcount, s16 speed, u16 bhv, u16 cycle) { + Vtx* *verts = get_scroll_targets(vtxIndex); + u32 i; + + if (bhv < SCROLL_UV_X) { + for (i = 0; i < vertcount; i++) { + verts[i]->n.ob[bhv] += sins(verts[0]->n.flag) * speed; + } + } else { + for (i = 0; i < vertcount; i++) { + verts[i]->n.tc[bhv-SCROLL_UV_X] += (u16) (sins(verts[0]->n.flag) * speed); + } + } + verts[0]->n.flag += cycle * 0x23; +} + +// format I will use is x=spd, y=bhv, z=vert amount, rx=offset, ry=scrollType, rz=cycle, bparam=addr +void uv_update_scroll(void) { + s16 speed = (s16) o->oPosX; + u16 bhv = (u16) o->oPosY; + u16 vertCount = (u16) o->oPosZ; + u8 scrollType = (u8) o->oFaceAngleYaw; + u16 cycle = (u16) o->oFaceAngleRoll * 180 / 0x8000; + u32 vtxIndex = (u32) o->oBehParams; + + switch (scrollType) { + case MODE_SCROLL_UV: + shift_UV_NORMAL(vtxIndex, vertCount, speed, bhv, cycle); + break; + case MODE_SCROLL_SINE: + shift_UV_SINE(vtxIndex, vertCount, speed, bhv, cycle); + break; + case MODE_SCROLL_JUMP: + shift_UV_JUMP(vtxIndex, vertCount, speed, bhv, cycle); + break; + } +} diff --git a/src/game/scroll_targets.c b/src/game/scroll_targets.c new file mode 100644 index 000000000..1e1c023a1 --- /dev/null +++ b/src/game/scroll_targets.c @@ -0,0 +1,27 @@ +#include "scroll_targets.h" + +Vtx *gScrollTargets[1024]; + +static int startIndex[128]; +static int lastIndex = 0; + +Vtx* *get_scroll_targets(u32 id) { + return &gScrollTargets[startIndex[id]]; +} + +void add_vtx_scroll_target(u32 id, Vtx *vtx, u32 size) { + if (startIndex[id] == -1) { + startIndex[id] = lastIndex; + } + + for (u32 i = 0; i < size; ++i) { + gScrollTargets[lastIndex++] = &vtx[i]; + } +} + +void init_vtx_scroll_targets(void) { + for (int i = 0; i < 128; ++i) { + startIndex[i] = -1; + } + lastIndex = 0; +} diff --git a/src/game/scroll_targets.h b/src/game/scroll_targets.h new file mode 100644 index 000000000..ede2b4e70 --- /dev/null +++ b/src/game/scroll_targets.h @@ -0,0 +1,19 @@ +/* + * All credit goes to https://github.com/jesusyoshi54 + * also known as scuttlebugraiser, the creator of RM2C + * Created for the project https://github.com/jesusyoshi54/sm64ex-alo for RM2C support + * https://github.com/jesusyoshi54/sm64ex-alo/blob/master/src/game/ScrollTargets.inc.c + */ + +#include +#include "sm64.h" +#include "types.h" + +//Q. Why does this exist instead of just directly referencing VBs? +//A. Because gcc is dumb and will seg fault if you reference a VB by abstracting it through a bparam +//instead of directly refencing it, causing this horrible shit. +extern Vtx *gScrollTargets[]; + +Vtx* *get_scroll_targets(u32 id); +void add_vtx_scroll_target(u32 id, Vtx *vtx, u32 size); +void init_vtx_scroll_targets(void); diff --git a/src/pc/lua/smlua_cobject.c b/src/pc/lua/smlua_cobject.c index 973985fc2..52db23458 100644 --- a/src/pc/lua/smlua_cobject.c +++ b/src/pc/lua/smlua_cobject.c @@ -4,6 +4,7 @@ #include "game/area.h" #include "game/mario.h" #include "game/hardcoded.h" +#include "game/scroll_targets.h" #include "audio/external.h" #include "object_fields.h" #include "pc/djui/djui_hud_utils.h" @@ -590,7 +591,6 @@ void smlua_cobject_init_globals(void) { smlua_push_object(L, LOT_BEHAVIORVALUES, &gBehaviorValues); lua_setglobal(L, "gBehaviorValues"); } - } void smlua_cobject_init_per_file_globals(char* path) { diff --git a/src/pc/lua/smlua_constants_autogen.c b/src/pc/lua/smlua_constants_autogen.c index b69f843e0..edc3c4fd4 100644 --- a/src/pc/lua/smlua_constants_autogen.c +++ b/src/pc/lua/smlua_constants_autogen.c @@ -855,7 +855,9 @@ char gSmluaConstants[] = "" "id_bhvYellowBall = 532\n" "id_bhvYellowCoin = 533\n" "id_bhvYoshi = 534\n" -"id_bhv_max_count = 535\n" +"id_RM_Scroll_Texture = 535\n" +"id_editor_Scroll_Texture = 536\n" +"id_bhv_max_count = 537\n" "CAM_MODE_MARIO_ACTIVE = 0x01\n" "CAM_MODE_LAKITU_WAS_ZOOMED_OUT = 0x02\n" "CAM_MODE_MARIO_SELECTED = 0x04\n" diff --git a/src/pc/lua/smlua_functions_autogen.c b/src/pc/lua/smlua_functions_autogen.c index c3c2810f1..7c4071fa8 100644 --- a/src/pc/lua/smlua_functions_autogen.c +++ b/src/pc/lua/smlua_functions_autogen.c @@ -5348,6 +5348,15 @@ int smlua_func_update_angle_from_move_flags(lua_State* L) { return 1; } +int smlua_func_uv_update_scroll(UNUSED lua_State* L) { + if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + + + uv_update_scroll(); + + return 1; +} + int smlua_func_vec3f_copy_2(lua_State* L) { if(!smlua_functions_valid_param_count(L, 2)) { return 0; } @@ -16648,6 +16657,23 @@ int smlua_func_warp_to_start_level(UNUSED lua_State* L) { // smlua_misc_utils.h // //////////////////////// +int smlua_func_add_scroll_target(lua_State* L) { + if(!smlua_functions_valid_param_count(L, 4)) { return 0; } + + u32 index = smlua_to_integer(L, 1); + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 1 for function 'add_scroll_target'"); return 0; } + const char* name = smlua_to_string(L, 2); + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 2 for function 'add_scroll_target'"); return 0; } + u32 offset = smlua_to_integer(L, 3); + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 3 for function 'add_scroll_target'"); return 0; } + u32 size = smlua_to_integer(L, 4); + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter 4 for function 'add_scroll_target'"); return 0; } + + add_scroll_target(index, name, offset, size); + + return 1; +} + int smlua_func_allocate_mario_action(lua_State* L) { if(!smlua_functions_valid_param_count(L, 1)) { return 0; } @@ -17037,6 +17063,15 @@ int smlua_func_hud_show(UNUSED lua_State* L) { return 1; } +int smlua_func_init_scroll_targets(UNUSED lua_State* L) { + if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + + + init_scroll_targets(); + + return 1; +} + int smlua_func_is_game_paused(UNUSED lua_State* L) { if(!smlua_functions_valid_param_count(L, 0)) { return 0; } @@ -18632,6 +18667,7 @@ void smlua_bind_functions_autogen(void) { smlua_bind_function(L, "spawn_wind_particles", smlua_func_spawn_wind_particles); smlua_bind_function(L, "tox_box_move", smlua_func_tox_box_move); smlua_bind_function(L, "update_angle_from_move_flags", smlua_func_update_angle_from_move_flags); + smlua_bind_function(L, "uv_update_scroll", smlua_func_uv_update_scroll); smlua_bind_function(L, "vec3f_copy_2", smlua_func_vec3f_copy_2); // behavior_table.h @@ -19447,6 +19483,7 @@ void smlua_bind_functions_autogen(void) { smlua_bind_function(L, "warp_to_start_level", smlua_func_warp_to_start_level); // smlua_misc_utils.h + smlua_bind_function(L, "add_scroll_target", smlua_func_add_scroll_target); smlua_bind_function(L, "allocate_mario_action", smlua_func_allocate_mario_action); smlua_bind_function(L, "camera_config_enable_analog_cam", smlua_func_camera_config_enable_analog_cam); smlua_bind_function(L, "camera_config_enable_free_cam", smlua_func_camera_config_enable_free_cam); @@ -19484,6 +19521,7 @@ void smlua_bind_functions_autogen(void) { smlua_bind_function(L, "hud_render_power_meter", smlua_func_hud_render_power_meter); smlua_bind_function(L, "hud_set_value", smlua_func_hud_set_value); smlua_bind_function(L, "hud_show", smlua_func_hud_show); + smlua_bind_function(L, "init_scroll_targets", smlua_func_init_scroll_targets); smlua_bind_function(L, "is_game_paused", smlua_func_is_game_paused); smlua_bind_function(L, "is_transition_playing", smlua_func_is_transition_playing); smlua_bind_function(L, "movtexqc_register", smlua_func_movtexqc_register); diff --git a/src/pc/lua/utils/smlua_misc_utils.c b/src/pc/lua/utils/smlua_misc_utils.c index f28191562..5097140c0 100644 --- a/src/pc/lua/utils/smlua_misc_utils.c +++ b/src/pc/lua/utils/smlua_misc_utils.c @@ -353,3 +353,13 @@ void set_override_near(f32 near) { void set_override_far(f32 far) { gOverrideFar = far; } + +/// + +void add_scroll_target(u32 index, const char* name, u32 offset, u32 size) { + dynos_add_scroll_target(index, name, offset, size); +} + +void init_scroll_targets(void) { + dynos_init_scroll_targets(); +} diff --git a/src/pc/lua/utils/smlua_misc_utils.h b/src/pc/lua/utils/smlua_misc_utils.h index d4c4c6284..e29929bd1 100644 --- a/src/pc/lua/utils/smlua_misc_utils.h +++ b/src/pc/lua/utils/smlua_misc_utils.h @@ -83,6 +83,9 @@ void set_override_fov(f32 fov); void set_override_near(f32 near); void set_override_far(f32 far); +void add_scroll_target(u32 index, const char* name, u32 offset, u32 size); +void init_scroll_targets(void); + void play_transition(s16 transType, s16 time, u8 red, u8 green, u8 blue); #endif