From b671458f8153235d6e6ce468071190eb21078a0f Mon Sep 17 00:00:00 2001 From: PeachyPeachSM64 <72323920+PeachyPeachSM64@users.noreply.github.com> Date: Sun, 17 Aug 2025 19:27:41 +0200 Subject: [PATCH] Enforce function pointers types in dynos geo layouts -> geo_* functions only behaviors -> bhv_* functions only level scripts -> lvl_* functions only other -> no function allowed thanks maniscat for reporting the issue --- data/dynos.cpp.h | 19 +- data/dynos_bin_behavior.cpp | 12 +- data/dynos_bin_geo.cpp | 25 +- data/dynos_bin_gfx.cpp | 4 +- data/dynos_bin_lvl.cpp | 12 +- data/dynos_bin_movtexqc.cpp | 4 +- data/dynos_bin_pointer.cpp | 29 +- data/dynos_bin_texlist.cpp | 4 +- data/dynos_mgr_builtin.cpp | 1325 ++++++++++++++++++----------------- 9 files changed, 765 insertions(+), 669 deletions(-) diff --git a/data/dynos.cpp.h b/data/dynos.cpp.h index 78c5aff09..763cec64b 100644 --- a/data/dynos.cpp.h +++ b/data/dynos.cpp.h @@ -17,6 +17,10 @@ extern "C" { #define LUA_VAR_CODE (u32) 0x5641554C #define TEX_REF_CODE (u32) 0x52584554 +#define FUNCTION_GEO 1 +#define FUNCTION_BHV 2 +#define FUNCTION_LVL 3 + #define MOD_PACK_INDEX 99 // @@ -864,10 +868,13 @@ const char* DynOS_Builtin_Tex_GetFromData(const Texture* aData); const char* DynOS_Builtin_Tex_GetNameFromFileName(const char* aDataName); const struct BuiltinTexInfo* DynOS_Builtin_Tex_GetInfoFromName(const char* aDataName); const struct BuiltinTexInfo* DynOS_Builtin_Tex_GetInfoFromData(const Texture* aData); -const void* DynOS_Builtin_Func_GetFromName(const char* aDataName); -const void* DynOS_Builtin_Func_GetFromIndex(s32 aIndex); -const char * DynOS_Builtin_Func_GetNameFromIndex(s64 aIndex); -s32 DynOS_Builtin_Func_GetIndexFromData(const void* aData); +const void* DynOS_Builtin_Func_GetFromName(const char* aDataName, u8 aFuncType); +const void* DynOS_Builtin_Func_GetFromIndex(s32 aIndex, u8 aFuncType); +const char * DynOS_Builtin_Func_GetNameFromIndex(s32 aIndex, u8 aFuncType); +s32 DynOS_Builtin_Func_GetIndexFromData(const void* aData, u8 aFuncType); +String DynOS_Builtin_Func_CheckMisuse(s32 aIndex, u8 aFuncType); +String DynOS_Builtin_Func_CheckMisuse(const char* aDataName, u8 aFuncType); +String DynOS_Builtin_Func_CheckMisuse(const void* aData, u8 aFuncType); const Gfx * DynOS_Builtin_Gfx_GetFromName(const char *aDataName); const char * DynOS_Builtin_Gfx_GetFromData(const Gfx *aData); @@ -1100,8 +1107,8 @@ void DynOS_Vtx_Write(BinFile* aFile, GfxData* aGfxData, DataNode *aNode); void DynOS_Vtx_Load(BinFile *aFile, GfxData *aGfxData); void DynOS_Pointer_Lua_Write(BinFile* aFile, u32 index, GfxData* aGfxData); -void DynOS_Pointer_Write(BinFile* aFile, const void* aPtr, GfxData* aGfxData); -void *DynOS_Pointer_Load(BinFile *aFile, GfxData *aGfxData, u32 aValue, u8* outFlags); +void DynOS_Pointer_Write(BinFile* aFile, const void* aPtr, GfxData* aGfxData, u8 aFuncType); +void *DynOS_Pointer_Load(BinFile *aFile, GfxData *aGfxData, u32 aValue, u8 aFuncType, u8* outFlags); void DynOS_GfxDynCmd_Load(BinFile *aFile, GfxData *aGfxData); diff --git a/data/dynos_bin_behavior.cpp b/data/dynos_bin_behavior.cpp index 6b7c1c2df..c6150025f 100644 --- a/data/dynos_bin_behavior.cpp +++ b/data/dynos_bin_behavior.cpp @@ -1937,10 +1937,16 @@ static BehaviorScript ParseBehaviorScriptSymbolArgInternal(GfxData *aGfxData, Da } // Built-in functions - const void *_FunctionPtr = DynOS_Builtin_Func_GetFromName(_Arg.begin()); + const void *_FunctionPtr = DynOS_Builtin_Func_GetFromName(_Arg.begin(), FUNCTION_BHV); if (_FunctionPtr != NULL) { return (s64) _FunctionPtr; } + String error = DynOS_Builtin_Func_CheckMisuse(_Arg.begin(), FUNCTION_BHV); + if (!error.Empty()) { + PrintDataError(" ERROR: %s", error.begin()); + *found = false; + return 0; + } // Built-in actors auto builtinActor = DynOS_Builtin_Actor_GetFromName(_Arg.begin()); @@ -2490,7 +2496,7 @@ static void DynOS_Bhv_Write(BinFile* aFile, GfxData* aGfxData, DataNodemSize; ++i) { BehaviorScript *_Head = &aNode->mData[i]; if (aGfxData->mPointerList.Find((void *) _Head) != -1) { - DynOS_Pointer_Write(aFile, (const void *) (*_Head), aGfxData); + DynOS_Pointer_Write(aFile, (const void *) (*_Head), aGfxData, FUNCTION_BHV); } else if (aGfxData->mLuaPointerList.Find((void *) _Head) != -1) { DynOS_Pointer_Lua_Write(aFile, *(u32 *)_Head, aGfxData); } else { @@ -2578,7 +2584,7 @@ static DataNode *DynOS_Bhv_Load(BinFile *aFile, GfxData *aGfxDat break; } u32 _Value = aFile->Read(); - void *_Ptr = DynOS_Pointer_Load(aFile, aGfxData, _Value, &_Node->mFlags); + void *_Ptr = DynOS_Pointer_Load(aFile, aGfxData, _Value, FUNCTION_BHV, &_Node->mFlags); if (_Ptr) { _Node->mData[i] = (uintptr_t) _Ptr; } else { diff --git a/data/dynos_bin_geo.cpp b/data/dynos_bin_geo.cpp index 25a824d4d..972f84b58 100644 --- a/data/dynos_bin_geo.cpp +++ b/data/dynos_bin_geo.cpp @@ -105,10 +105,15 @@ static s64 ParseGeoSymbolArg(GfxData* aGfxData, DataNode* aNode, u64& } // Built-in functions - const void *_FunctionPtr = DynOS_Builtin_Func_GetFromName(_Arg.begin()); + const void *_FunctionPtr = DynOS_Builtin_Func_GetFromName(_Arg.begin(), FUNCTION_GEO); if (_FunctionPtr != NULL) { return (s64) _FunctionPtr; } + String error = DynOS_Builtin_Func_CheckMisuse(_Arg.begin(), FUNCTION_GEO); + if (!error.Empty()) { + PrintDataError(" ERROR: %s", error.begin()); + return 0; + } // Constants bool constantFound = false; @@ -321,13 +326,18 @@ static void ParseGeoSymbol(GfxData* aGfxData, DataNode* aNode, GeoLay s64 _Arg0 = ParseGeoSymbolArg(aGfxData, aNode, aTokenIndex); const String& _Arg1 = aNode->mTokens[aTokenIndex++]; - const void *_FunctionPtr = DynOS_Builtin_Func_GetFromName(_Arg1.begin()); + const void *_FunctionPtr = DynOS_Builtin_Func_GetFromName(_Arg1.begin(), FUNCTION_GEO); if (_FunctionPtr != NULL) { aGfxData->mPointerList.Add(aHead + 1); GeoLayout _Gl[] = { GEO_ASM(_Arg0, _FunctionPtr) }; memcpy(aHead, _Gl, sizeof(_Gl)); aHead += (sizeof(_Gl) / sizeof(_Gl[0])); } else { + String error = DynOS_Builtin_Func_CheckMisuse(_Arg1.begin(), FUNCTION_GEO); + if (!error.Empty()) { + PrintDataError(" ERROR: %s", error.begin()); + return; + } u32 _FuncIndex = DynOS_Lua_RememberVariable(aGfxData, aHead + 1, _Arg1); GeoLayout _Gl[] = { GEO_ASM_EXT(_Arg0, _FuncIndex) }; memcpy(aHead, _Gl, sizeof(_Gl)); @@ -345,13 +355,18 @@ static void ParseGeoSymbol(GfxData* aGfxData, DataNode* aNode, GeoLay s64 _Arg0 = ParseGeoSymbolArg(aGfxData, aNode, aTokenIndex); const String& _Arg1 = aNode->mTokens[aTokenIndex++]; - const void *_FunctionPtr = DynOS_Builtin_Func_GetFromName(_Arg1.begin()); + const void *_FunctionPtr = DynOS_Builtin_Func_GetFromName(_Arg1.begin(), FUNCTION_GEO); if (_FunctionPtr != NULL) { aGfxData->mPointerList.Add(aHead + 1); GeoLayout _Gl[] = { GEO_SWITCH_CASE(_Arg0, _FunctionPtr) }; memcpy(aHead, _Gl, sizeof(_Gl)); aHead += (sizeof(_Gl) / sizeof(_Gl[0])); } else { + String error = DynOS_Builtin_Func_CheckMisuse(_Arg1.begin(), FUNCTION_GEO); + if (!error.Empty()) { + PrintDataError(" ERROR: %s", error.begin()); + return; + } u32 _FuncIndex = DynOS_Lua_RememberVariable(aGfxData, aHead + 1, _Arg1); GeoLayout _Gl[] = { GEO_SWITCH_CASE_EXT(_Arg0, _FuncIndex) }; memcpy(aHead, _Gl, sizeof(_Gl)); @@ -471,7 +486,7 @@ void DynOS_Geo_Write(BinFile *aFile, GfxData *aGfxData, DataNode *aNo for (u32 i = 0; i != aNode->mSize; ++i) { GeoLayout *_Head = &aNode->mData[i]; if (aGfxData->mPointerList.Find((void *) _Head) != -1) { - DynOS_Pointer_Write(aFile, (const void *) (*_Head), aGfxData); + DynOS_Pointer_Write(aFile, (const void *) (*_Head), aGfxData, FUNCTION_GEO); } else if (aGfxData->mLuaPointerList.Find((void *) _Head) != -1) { DynOS_Pointer_Lua_Write(aFile, *(u32 *)_Head, aGfxData); } else { @@ -495,7 +510,7 @@ void DynOS_Geo_Load(BinFile *aFile, GfxData *aGfxData) { _Node->mData = New(_Node->mSize); for (u32 i = 0; i != _Node->mSize; ++i) { u32 _Value = aFile->Read(); - void *_Ptr = DynOS_Pointer_Load(aFile, aGfxData, _Value, &_Node->mFlags); + void *_Ptr = DynOS_Pointer_Load(aFile, aGfxData, _Value, FUNCTION_GEO, &_Node->mFlags); if (_Ptr) { _Node->mData[i] = (uintptr_t) _Ptr; } else { diff --git a/data/dynos_bin_gfx.cpp b/data/dynos_bin_gfx.cpp index 55872a6dd..b6fc5eecb 100644 --- a/data/dynos_bin_gfx.cpp +++ b/data/dynos_bin_gfx.cpp @@ -1104,7 +1104,7 @@ void DynOS_Gfx_Write(BinFile *aFile, GfxData *aGfxData, DataNode *aNode) { Gfx *_Head = &aNode->mData[i]; if (aGfxData->mPointerList.Find((void *) _Head) != -1) { aFile->Write(_Head->words.w0); - DynOS_Pointer_Write(aFile, (const void *) _Head->words.w1, aGfxData); + DynOS_Pointer_Write(aFile, (const void *) _Head->words.w1, aGfxData, 0); } else { aFile->Write(_Head->words.w0); aFile->Write(_Head->words.w1); @@ -1127,7 +1127,7 @@ void DynOS_Gfx_Load(BinFile *aFile, GfxData *aGfxData) { for (u32 i = 0; i != _Node->mSize; ++i) { u32 _WordsW0 = aFile->Read(); u32 _WordsW1 = aFile->Read(); - void *_Ptr = DynOS_Pointer_Load(aFile, aGfxData, _WordsW1, &_Node->mFlags); + void *_Ptr = DynOS_Pointer_Load(aFile, aGfxData, _WordsW1, 0, &_Node->mFlags); if (_Ptr) { _Node->mData[i].words.w0 = (uintptr_t) _WordsW0; _Node->mData[i].words.w1 = (uintptr_t) _Ptr; diff --git a/data/dynos_bin_lvl.cpp b/data/dynos_bin_lvl.cpp index c57102b2f..e3e9a27ed 100644 --- a/data/dynos_bin_lvl.cpp +++ b/data/dynos_bin_lvl.cpp @@ -409,10 +409,16 @@ static LevelScript ParseLevelScriptSymbolArgInternal(GfxData* aGfxData, DataNode } // Built-in functions - const void *_FunctionPtr = DynOS_Builtin_Func_GetFromName(_Arg.begin()); + const void *_FunctionPtr = DynOS_Builtin_Func_GetFromName(_Arg.begin(), FUNCTION_LVL); if (_FunctionPtr != NULL) { return (s64) _FunctionPtr; } + String error = DynOS_Builtin_Func_CheckMisuse(_Arg.begin(), FUNCTION_LVL); + if (!error.Empty()) { + PrintDataError(" ERROR: %s", error.begin()); + *found = false; + return 0; + } bool constantFound = false; s64 constantValue = DynOS_Lvl_ParseLevelScriptConstants(_Arg, &constantFound); @@ -926,7 +932,7 @@ static void DynOS_Lvl_Write(BinFile* aFile, GfxData* aGfxData, DataNodemSize; ++i) { LevelScript *_Head = &aNode->mData[i]; if (aGfxData->mPointerList.Find((void *) _Head) != -1) { - DynOS_Pointer_Write(aFile, (const void *) (*_Head), aGfxData); + DynOS_Pointer_Write(aFile, (const void *) (*_Head), aGfxData, FUNCTION_LVL); } else if (aGfxData->mLuaPointerList.Find((void *) _Head) != -1) { DynOS_Pointer_Lua_Write(aFile, *(u32 *)_Head, aGfxData); } else { @@ -1055,7 +1061,7 @@ static DataNode* DynOS_Lvl_Load(BinFile *aFile, GfxData *aGfxData) bool requirePointer = DynOS_Lvl_Validate_RequirePointer(_Value); - void *_Ptr = DynOS_Pointer_Load(aFile, aGfxData, _Value, &_Node->mFlags); + void *_Ptr = DynOS_Pointer_Load(aFile, aGfxData, _Value, FUNCTION_LVL, &_Node->mFlags); if (_Ptr) { if (!requirePointer) { PrintError("Didn't expect a pointer while reading level script: %s, %u", _Node->mName.begin(), _Value); diff --git a/data/dynos_bin_movtexqc.cpp b/data/dynos_bin_movtexqc.cpp index ab7e36a77..27f99d587 100644 --- a/data/dynos_bin_movtexqc.cpp +++ b/data/dynos_bin_movtexqc.cpp @@ -64,7 +64,7 @@ void DynOS_MovtexQC_Write(BinFile* aFile, GfxData* aGfxData, DataNode aFile->Write(aNode->mSize); for (u32 i = 0; i != aNode->mSize; ++i) { aFile->Write(aNode->mData[i].id); - DynOS_Pointer_Write(aFile, (const void *) (aNode->mData[i].quadArraySegmented), aGfxData); + DynOS_Pointer_Write(aFile, (const void *) (aNode->mData[i].quadArraySegmented), aGfxData, 0); } } @@ -84,7 +84,7 @@ DataNode* DynOS_MovtexQC_Load(BinFile *aFile, GfxData *aGfxData) { for (u32 i = 0; i != _Node->mSize; ++i) { _Node->mData[i].id = aFile->Read(); u32 _Value = aFile->Read(); - void *_Ptr = DynOS_Pointer_Load(aFile, aGfxData, _Value, &_Node->mFlags); + void *_Ptr = DynOS_Pointer_Load(aFile, aGfxData, _Value, 0, &_Node->mFlags); _Node->mData[i].quadArraySegmented = (Movtex*)_Ptr; } diff --git a/data/dynos_bin_pointer.cpp b/data/dynos_bin_pointer.cpp index b23d475e8..f660bbe47 100644 --- a/data/dynos_bin_pointer.cpp +++ b/data/dynos_bin_pointer.cpp @@ -209,7 +209,7 @@ void DynOS_Pointer_Lua_Write(BinFile* aFile, u32 index, GfxData* aGfxData) { token.Write(aFile); } -void DynOS_Pointer_Write(BinFile* aFile, const void* aPtr, GfxData* aGfxData) { +void DynOS_Pointer_Write(BinFile* aFile, const void* aPtr, GfxData* aGfxData, u8 aFuncType) { // NULL if (!aPtr) { @@ -229,10 +229,15 @@ void DynOS_Pointer_Write(BinFile* aFile, const void* aPtr, GfxData* aGfxData) { } // Built-in functions - s32 _GeoFunctionIndex = DynOS_Builtin_Func_GetIndexFromData(aPtr); - if (_GeoFunctionIndex != -1) { + s32 _FunctionIndex = DynOS_Builtin_Func_GetIndexFromData(aPtr, aFuncType); + if (_FunctionIndex != -1) { aFile->Write(FUNCTION_CODE); - aFile->Write(_GeoFunctionIndex); + aFile->Write(_FunctionIndex); + return; + } + String error = DynOS_Builtin_Func_CheckMisuse(aPtr, aFuncType); + if (!error.Empty()) { + PrintDataError(" ERROR: %s", error.begin()); return; } @@ -451,7 +456,7 @@ static void *GetPointerFromData(GfxData *aGfxData, const String &aPtrName, u32 a return NULL; } -void *DynOS_Pointer_Load(BinFile *aFile, GfxData *aGfxData, u32 aValue, u8* outFlags) { +void *DynOS_Pointer_Load(BinFile *aFile, GfxData *aGfxData, u32 aValue, u8 aFuncType, u8* outFlags) { // LUAV if (aValue == LUA_VAR_CODE) { @@ -469,13 +474,23 @@ void *DynOS_Pointer_Load(BinFile *aFile, GfxData *aGfxData, u32 aValue, u8* outF // FUNC if (aValue == FUNCTION_CODE) { s32 _FunctionIndex = aFile->Read(); - return (void*) DynOS_Builtin_Func_GetFromIndex(_FunctionIndex); + void *_FunctionPtr = (void*) DynOS_Builtin_Func_GetFromIndex(_FunctionIndex, aFuncType); + if (_FunctionPtr) { + return _FunctionPtr; + } + String error = DynOS_Builtin_Func_CheckMisuse(_FunctionIndex, aFuncType); + if (!error.Empty()) { + sys_fatal(error.begin()); + return NULL; + } + sys_fatal("Invalid function index: %d", _FunctionIndex); + return NULL; } // PNTR if (aValue == POINTER_CODE) { String _PtrName; _PtrName.Read(aFile); - u32 _PtrData = aFile->Read(); + u32 _PtrData = aFile->Read(); return GetPointerFromData(aGfxData, _PtrName, _PtrData, outFlags); } diff --git a/data/dynos_bin_texlist.cpp b/data/dynos_bin_texlist.cpp index d0e0bac90..58cef9974 100644 --- a/data/dynos_bin_texlist.cpp +++ b/data/dynos_bin_texlist.cpp @@ -50,7 +50,7 @@ void DynOS_TexList_Write(BinFile* aFile, GfxData* aGfxData, DataNode * bool found = false; for (auto& _Node : aGfxData->mTextures) { if (_Node->mData == aNode->mData[i]) { - DynOS_Pointer_Write(aFile, (const void *) (_Node), aGfxData); + DynOS_Pointer_Write(aFile, (const void *) (_Node), aGfxData, 0); found = true; break; } @@ -76,7 +76,7 @@ DataNode* DynOS_TexList_Load(BinFile *aFile, GfxData *aGfxData) { _Node->mData = New(_Node->mSize); for (u32 i = 0; i != _Node->mSize; ++i) { u32 _Value = aFile->Read(); - void *_Ptr = DynOS_Pointer_Load(aFile, aGfxData, _Value, &_Node->mFlags); + void *_Ptr = DynOS_Pointer_Load(aFile, aGfxData, _Value, 0, &_Node->mFlags); if (_Ptr == NULL) { PrintDataError("Could not read texture in texlist"); } else { diff --git a/data/dynos_mgr_builtin.cpp b/data/dynos_mgr_builtin.cpp index c00512a71..b750cd060 100644 --- a/data/dynos_mgr_builtin.cpp +++ b/data/dynos_mgr_builtin.cpp @@ -1397,671 +1397,718 @@ static void *geo_rotate_3d_coin(s32 callContext, void *node, UNUSED void *c) { // // ///////////////////////////////////////////////////////////////////////////////////////////////////////// -static const void* sDynosBuiltinFuncs[] = { - define_builtin(geo_mirror_mario_set_alpha), - define_builtin(geo_switch_mario_stand_run), - define_builtin(geo_switch_mario_eyes), - define_builtin(geo_mario_tilt_torso), - define_builtin(geo_mario_head_rotation), - define_builtin(geo_switch_mario_hand), - define_builtin(geo_mario_hand_foot_scaler), - define_builtin(geo_switch_mario_cap_effect), - define_builtin(geo_switch_mario_cap_on_off), - define_builtin(geo_mario_rotate_wing_cap_wings), - define_builtin(geo_switch_mario_hand_grab_pos), - define_builtin(geo_render_mirror_mario), - define_builtin(geo_mirror_mario_backface_culling), - define_builtin(geo_update_projectile_pos_from_parent), - define_builtin(geo_update_layer_transparency), - define_builtin(geo_switch_anim_state), - define_builtin(geo_switch_area), - define_builtin(geo_camera_main), - define_builtin(geo_camera_fov), - define_builtin(geo_envfx_main), - define_builtin(geo_skybox_main), - define_builtin(geo_wdw_set_initial_water_level), - define_builtin(geo_movtex_pause_control), - define_builtin(geo_movtex_draw_water_regions), - define_builtin(geo_movtex_draw_nocolor), - define_builtin(geo_movtex_draw_colored), - define_builtin(geo_movtex_draw_colored_no_update), - define_builtin(geo_movtex_draw_colored_2_no_update), - define_builtin(geo_movtex_update_horizontal), - define_builtin(geo_movtex_draw_colored_no_update), - define_builtin(geo_painting_draw), - define_builtin(geo_painting_update), - define_builtin(geo_exec_inside_castle_light), - define_builtin(geo_exec_flying_carpet_timer_update), - define_builtin(geo_exec_flying_carpet_create), - define_builtin(geo_exec_cake_end_screen), - define_builtin(geo_cannon_circle_base), - define_builtin(geo_move_mario_part_from_parent), - define_builtin(geo_bits_bowser_coloring), - define_builtin(geo_update_body_rot_from_parent), - define_builtin(geo_switch_bowser_eyes), - define_builtin(geo_switch_tuxie_mother_eyes), - define_builtin(geo_update_held_mario_pos), - define_builtin(geo_snufit_move_mask), - define_builtin(geo_snufit_scale_body), - define_builtin(geo_scale_bowser_key), - (const void *) "geo_rotate_coin", (const void *) geo_rotate_3d_coin, - define_builtin(geo_offset_klepto_held_object), - define_builtin(geo_switch_peach_eyes), +typedef struct { + const char *name; + const void *func; + u8 type; +} DynosBuiltinFunction; + +#define define_builtin_function(_func, _type) { .name = #_func, .func = (const void *) _func, .type = _type } + +static const DynosBuiltinFunction sDynosBuiltinFuncs[] = { + define_builtin_function(geo_mirror_mario_set_alpha, FUNCTION_GEO), + define_builtin_function(geo_switch_mario_stand_run, FUNCTION_GEO), + define_builtin_function(geo_switch_mario_eyes, FUNCTION_GEO), + define_builtin_function(geo_mario_tilt_torso, FUNCTION_GEO), + define_builtin_function(geo_mario_head_rotation, FUNCTION_GEO), + define_builtin_function(geo_switch_mario_hand, FUNCTION_GEO), + define_builtin_function(geo_mario_hand_foot_scaler, FUNCTION_GEO), + define_builtin_function(geo_switch_mario_cap_effect, FUNCTION_GEO), + define_builtin_function(geo_switch_mario_cap_on_off, FUNCTION_GEO), + define_builtin_function(geo_mario_rotate_wing_cap_wings, FUNCTION_GEO), + define_builtin_function(geo_switch_mario_hand_grab_pos, FUNCTION_GEO), + define_builtin_function(geo_render_mirror_mario, FUNCTION_GEO), + define_builtin_function(geo_mirror_mario_backface_culling, FUNCTION_GEO), + define_builtin_function(geo_update_projectile_pos_from_parent, FUNCTION_GEO), + define_builtin_function(geo_update_layer_transparency, FUNCTION_GEO), + define_builtin_function(geo_switch_anim_state, FUNCTION_GEO), + define_builtin_function(geo_switch_area, FUNCTION_GEO), + define_builtin_function(geo_camera_main, FUNCTION_GEO), + define_builtin_function(geo_camera_fov, FUNCTION_GEO), + define_builtin_function(geo_envfx_main, FUNCTION_GEO), + define_builtin_function(geo_skybox_main, FUNCTION_GEO), + define_builtin_function(geo_wdw_set_initial_water_level, FUNCTION_GEO), + define_builtin_function(geo_movtex_pause_control, FUNCTION_GEO), + define_builtin_function(geo_movtex_draw_water_regions, FUNCTION_GEO), + define_builtin_function(geo_movtex_draw_nocolor, FUNCTION_GEO), + define_builtin_function(geo_movtex_draw_colored, FUNCTION_GEO), + define_builtin_function(geo_movtex_draw_colored_no_update, FUNCTION_GEO), + define_builtin_function(geo_movtex_draw_colored_2_no_update, FUNCTION_GEO), + define_builtin_function(geo_movtex_update_horizontal, FUNCTION_GEO), + define_builtin_function(geo_movtex_draw_colored_no_update, FUNCTION_GEO), + define_builtin_function(geo_painting_draw, FUNCTION_GEO), + define_builtin_function(geo_painting_update, FUNCTION_GEO), + define_builtin_function(geo_exec_inside_castle_light, FUNCTION_GEO), + define_builtin_function(geo_exec_flying_carpet_timer_update, FUNCTION_GEO), + define_builtin_function(geo_exec_flying_carpet_create, FUNCTION_GEO), + define_builtin_function(geo_exec_cake_end_screen, FUNCTION_GEO), + define_builtin_function(geo_cannon_circle_base, FUNCTION_GEO), + define_builtin_function(geo_move_mario_part_from_parent, FUNCTION_GEO), + define_builtin_function(geo_bits_bowser_coloring, FUNCTION_GEO), + define_builtin_function(geo_update_body_rot_from_parent, FUNCTION_GEO), + define_builtin_function(geo_switch_bowser_eyes, FUNCTION_GEO), + define_builtin_function(geo_switch_tuxie_mother_eyes, FUNCTION_GEO), + define_builtin_function(geo_update_held_mario_pos, FUNCTION_GEO), + define_builtin_function(geo_snufit_move_mask, FUNCTION_GEO), + define_builtin_function(geo_snufit_scale_body, FUNCTION_GEO), + define_builtin_function(geo_scale_bowser_key, FUNCTION_GEO), + { .name = "geo_rotate_coin", .func = (const void *) geo_rotate_3d_coin, .type = FUNCTION_GEO }, + define_builtin_function(geo_offset_klepto_held_object, FUNCTION_GEO), + define_builtin_function(geo_switch_peach_eyes, FUNCTION_GEO), // Co-op specific - define_builtin(geo_mario_set_player_colors), - define_builtin(geo_movtex_draw_water_regions_ext), - define_builtin(lvl_init_or_update), - define_builtin(geo_choose_area_ext), + define_builtin_function(geo_mario_set_player_colors, FUNCTION_GEO), + define_builtin_function(geo_movtex_draw_water_regions_ext, FUNCTION_GEO), + define_builtin_function(lvl_init_or_update, FUNCTION_LVL), + define_builtin_function(geo_choose_area_ext, FUNCTION_GEO), // Behaviors - define_builtin(bhv_cap_switch_loop), - define_builtin(bhv_tiny_star_particles_init), - define_builtin(bhv_grindel_thwomp_loop), - define_builtin(bhv_koopa_shell_underwater_loop), - define_builtin(bhv_door_init), - define_builtin(bhv_door_loop), - define_builtin(bhv_star_door_loop), - define_builtin(bhv_star_door_loop_2), - define_builtin(bhv_mr_i_loop), - define_builtin(bhv_mr_i_body_loop), - define_builtin(bhv_mr_i_particle_loop), - define_builtin(bhv_piranha_particle_loop), - define_builtin(bhv_giant_pole_loop), - define_builtin(bhv_pole_init), - define_builtin(bhv_pole_base_loop), - define_builtin(bhv_thi_huge_island_top_loop), - define_builtin(bhv_thi_tiny_island_top_loop), - define_builtin(bhv_king_bobomb_loop), - define_builtin(bhv_bobomb_anchor_mario_loop), - define_builtin(bhv_beta_chest_bottom_init), - define_builtin(bhv_beta_chest_bottom_loop), - define_builtin(bhv_beta_chest_lid_loop), - define_builtin(bhv_bubble_wave_init), - define_builtin(bhv_bubble_maybe_loop), - define_builtin(bhv_bubble_player_loop), - define_builtin(bhv_water_air_bubble_init), - define_builtin(bhv_water_air_bubble_loop), - define_builtin(bhv_particle_init), - define_builtin(bhv_particle_loop), - define_builtin(bhv_water_waves_init), - define_builtin(bhv_small_bubbles_loop), - define_builtin(bhv_fish_group_loop), - define_builtin(bhv_cannon_base_loop), - define_builtin(bhv_cannon_barrel_loop), - define_builtin(bhv_cannon_base_unused_loop), - define_builtin(bhv_chuckya_loop), - define_builtin(bhv_chuckya_anchor_mario_loop), - define_builtin(bhv_rotating_platform_loop), - define_builtin(bhv_wf_breakable_wall_loop), - define_builtin(bhv_kickable_board_loop), - define_builtin(bhv_tower_door_loop), - define_builtin(bhv_wf_rotating_wooden_platform_init), - define_builtin(bhv_wf_rotating_wooden_platform_loop), - define_builtin(bhv_fading_warp_loop), - define_builtin(bhv_warp_loop), - define_builtin(bhv_white_puff_exploding_loop), - define_builtin(bhv_spawned_star_init), - define_builtin(bhv_spawned_star_loop), - define_builtin(bhv_coin_init), - define_builtin(bhv_coin_loop), - define_builtin(bhv_coin_inside_boo_loop), - define_builtin(bhv_coin_formation_init), - define_builtin(bhv_coin_formation_spawn_loop), - define_builtin(bhv_coin_formation_loop), - define_builtin(bhv_temp_coin_loop), - define_builtin(bhv_coin_sparkles_loop), - define_builtin(bhv_golden_coin_sparkles_loop), - define_builtin(bhv_wall_tiny_star_particle_loop), - define_builtin(bhv_pound_tiny_star_particle_loop), - define_builtin(bhv_pound_tiny_star_particle_init), - define_builtin(bhv_punch_tiny_triangle_loop), - define_builtin(bhv_punch_tiny_triangle_init), - define_builtin(bhv_tumbling_bridge_platform_loop), - define_builtin(bhv_tumbling_bridge_loop), - define_builtin(bhv_elevator_init), - define_builtin(bhv_elevator_loop), - define_builtin(bhv_water_mist_loop), - define_builtin(bhv_water_mist_spawn_loop), - define_builtin(bhv_water_mist_2_loop), - define_builtin(bhv_pound_white_puffs_init), - define_builtin(bhv_ground_sand_init), - define_builtin(bhv_ground_snow_init), - define_builtin(bhv_wind_loop), - define_builtin(bhv_unused_particle_spawn_loop), - define_builtin(bhv_ukiki_cage_star_loop), - define_builtin(bhv_ukiki_cage_loop), - define_builtin(bhv_bitfs_sinking_platform_loop), - define_builtin(bhv_bitfs_sinking_cage_platform_loop), - define_builtin(bhv_ddd_moving_pole_loop), - define_builtin(bhv_platform_normals_init), - define_builtin(bhv_tilting_inverted_pyramid_loop), - define_builtin(bhv_squishable_platform_loop), - define_builtin(bhv_beta_moving_flames_spawn_loop), - define_builtin(bhv_beta_moving_flames_loop), - define_builtin(bhv_rr_rotating_bridge_platform_loop), - define_builtin(bhv_flamethrower_loop), - define_builtin(bhv_flamethrower_flame_loop), - define_builtin(bhv_bouncing_fireball_loop), - define_builtin(bhv_bouncing_fireball_flame_loop), - define_builtin(bhv_bowser_shock_wave_loop), - define_builtin(bhv_flame_mario_loop), - define_builtin(bhv_black_smoke_mario_loop), - define_builtin(bhv_black_smoke_bowser_loop), - define_builtin(bhv_black_smoke_upward_loop), - define_builtin(bhv_beta_fish_splash_spawner_loop), - define_builtin(bhv_spindrift_loop), - define_builtin(bhv_tower_platform_group_init), - define_builtin(bhv_tower_platform_group_loop), - define_builtin(bhv_wf_sliding_tower_platform_loop), - define_builtin(bhv_wf_elevator_tower_platform_loop), - define_builtin(bhv_wf_solid_tower_platform_loop), - define_builtin(bhv_snow_leaf_particle_spawn_init), - define_builtin(bhv_tree_snow_or_leaf_loop), - define_builtin(bhv_piranha_plant_bubble_loop), - define_builtin(bhv_piranha_plant_waking_bubbles_loop), - define_builtin(bhv_purple_switch_loop), - define_builtin(bhv_hidden_object_loop), - define_builtin(bhv_breakable_box_loop), - define_builtin(bhv_pushable_loop), - define_builtin(bhv_init_room), - define_builtin(bhv_small_water_wave_loop), - define_builtin(bhv_yellow_coin_init), - define_builtin(bhv_yellow_coin_loop), - define_builtin(bhv_squarish_path_moving_loop), - define_builtin(bhv_squarish_path_parent_init), - define_builtin(bhv_squarish_path_parent_loop), - define_builtin(bhv_heave_ho_loop), - define_builtin(bhv_heave_ho_throw_mario_loop), - define_builtin(bhv_ccm_touched_star_spawn_loop), - define_builtin(bhv_unused_poundable_platform), - define_builtin(bhv_beta_trampoline_top_loop), - define_builtin(bhv_beta_trampoline_spring_loop), - define_builtin(bhv_jumping_box_loop), - define_builtin(bhv_boo_cage_init), - define_builtin(bhv_boo_cage_loop), - define_builtin(bhv_bowser_key_init), - define_builtin(bhv_bowser_key_loop), - define_builtin(bhv_grand_star_init), - define_builtin(bhv_grand_star_loop), - define_builtin(bhv_beta_boo_key_loop), - define_builtin(bhv_alpha_boo_key_loop), - define_builtin(bhv_bullet_bill_init), - define_builtin(bhv_bullet_bill_loop), - define_builtin(bhv_white_puff_smoke_init), - define_builtin(bhv_bowser_tail_anchor_init), - define_builtin(bhv_bowser_tail_anchor_loop), - define_builtin(bhv_bowser_init), - define_builtin(bhv_bowser_loop), - define_builtin(bhv_bowser_body_anchor_init), - define_builtin(bhv_bowser_body_anchor_loop), - define_builtin(bhv_bowser_flame_spawn_loop), - define_builtin(bhv_tilting_bowser_lava_platform_init), - define_builtin(bhv_falling_bowser_platform_loop), - define_builtin(bhv_blue_bowser_flame_init), - define_builtin(bhv_blue_bowser_flame_loop), - define_builtin(bhv_flame_floating_landing_init), - define_builtin(bhv_flame_floating_landing_loop), - define_builtin(bhv_blue_flames_group_loop), - define_builtin(bhv_flame_bouncing_init), - define_builtin(bhv_flame_bouncing_loop), - define_builtin(bhv_flame_moving_forward_growing_init), - define_builtin(bhv_flame_moving_forward_growing_loop), - define_builtin(bhv_flame_bowser_init), - define_builtin(bhv_flame_bowser_loop), - define_builtin(bhv_flame_large_burning_out_init), - define_builtin(bhv_blue_fish_movement_loop), - define_builtin(bhv_tank_fish_group_loop), - define_builtin(bhv_checkerboard_elevator_group_init), - define_builtin(bhv_checkerboard_elevator_group_loop), - define_builtin(bhv_checkerboard_platform_init), - define_builtin(bhv_checkerboard_platform_loop), - define_builtin(bhv_bowser_key_unlock_door_loop), - define_builtin(bhv_bowser_key_course_exit_loop), - define_builtin(bhv_invisible_objects_under_bridge_init), - define_builtin(bhv_invisible_objects_under_bridge_loop), - define_builtin(bhv_water_level_pillar_init), - define_builtin(bhv_water_level_pillar_loop), - define_builtin(bhv_ddd_warp_loop), - define_builtin(bhv_moat_grills_loop), - define_builtin(bhv_rotating_clock_arm_loop), - define_builtin(bhv_ukiki_init), - define_builtin(bhv_ukiki_loop), - define_builtin(bhv_lll_sinking_rock_block_loop), - define_builtin(bhv_lll_moving_octagonal_mesh_platform_loop), - define_builtin(bhv_lll_rotating_block_fire_bars_loop), - define_builtin(bhv_lll_rotating_hex_flame_loop), - define_builtin(bhv_lll_wood_piece_loop), - define_builtin(bhv_lll_floating_wood_bridge_loop), - define_builtin(bhv_volcano_flames_loop), - define_builtin(bhv_lll_rotating_hexagonal_ring_loop), - define_builtin(bhv_lll_sinking_rectangular_platform_loop), - define_builtin(bhv_lll_sinking_square_platforms_loop), - define_builtin(bhv_koopa_shell_loop), - define_builtin(bhv_koopa_shell_flame_loop), - define_builtin(bhv_tox_box_loop), - define_builtin(bhv_piranha_plant_loop), - define_builtin(bhv_lll_bowser_puzzle_piece_loop), - define_builtin(bhv_lll_bowser_puzzle_loop), - define_builtin(bhv_tuxies_mother_loop), - define_builtin(bhv_small_penguin_loop), - define_builtin(bhv_fish_spawner_loop), - define_builtin(bhv_fish_loop), - define_builtin(bhv_wdw_express_elevator_loop), - define_builtin(bhv_bub_spawner_loop), - define_builtin(bhv_bub_loop), - define_builtin(bhv_exclamation_box_init), - define_builtin(bhv_exclamation_box_loop), - define_builtin(bhv_rotating_exclamation_box_loop), - define_builtin(bhv_sound_spawner_init), - define_builtin(bhv_bowsers_sub_loop), - define_builtin(bhv_sushi_shark_loop), - define_builtin(bhv_sushi_shark_collision_loop), - define_builtin(bhv_jrb_sliding_box_loop), - define_builtin(bhv_ship_part_3_loop), - define_builtin(bhv_sunken_ship_part_loop), - define_builtin(bhv_white_puff_1_loop), - define_builtin(bhv_white_puff_2_loop), - define_builtin(bhv_blue_coin_switch_loop), - define_builtin(bhv_hidden_blue_coin_loop), - define_builtin(bhv_openable_cage_door_loop), - define_builtin(bhv_openable_grill_loop), - define_builtin(bhv_water_level_diamond_loop), - define_builtin(bhv_init_changing_water_level_loop), - define_builtin(bhv_tweester_sand_particle_loop), - define_builtin(bhv_tweester_loop), - define_builtin(bhv_merry_go_round_boo_manager_loop), - define_builtin(bhv_animated_texture_loop), - define_builtin(bhv_boo_in_castle_loop), - define_builtin(bhv_boo_with_cage_init), - define_builtin(bhv_boo_with_cage_loop), - define_builtin(bhv_boo_init), - define_builtin(bhv_big_boo_loop), - define_builtin(bhv_courtyard_boo_triplet_init), - define_builtin(bhv_boo_loop), - define_builtin(bhv_boo_boss_spawned_bridge_loop), - define_builtin(bhv_bbh_tilting_trap_platform_loop), - define_builtin(bhv_haunted_bookshelf_loop), - define_builtin(bhv_merry_go_round_loop), - // We can't move this without forcing all old mods to possibly need to recompile. How annoying. -#ifndef VERSION_JP - define_builtin(bhv_play_music_track_when_touched_loop), -#else - (const void *) "bhv_play_music_track_when_touched_loop", (const void *) stub_behavior_script_2, -#endif - define_builtin(bhv_beta_bowser_anchor_loop), - define_builtin(bhv_static_checkered_platform_loop), - define_builtin(bhv_castle_floor_trap_init), - define_builtin(bhv_castle_floor_trap_loop), - define_builtin(bhv_floor_trap_in_castle_loop), - define_builtin(bhv_sparkle_spawn_loop), - define_builtin(bhv_scuttlebug_loop), - define_builtin(bhv_scuttlebug_spawn_loop), - define_builtin(bhv_whomp_loop), - define_builtin(bhv_water_splash_spawn_droplets), - define_builtin(bhv_water_droplet_loop), - define_builtin(bhv_water_droplet_splash_init), - define_builtin(bhv_bubble_splash_init), - define_builtin(bhv_idle_water_wave_loop), - define_builtin(bhv_shallow_water_splash_init), - define_builtin(bhv_wave_trail_shrink), - define_builtin(bhv_strong_wind_particle_loop), - define_builtin(bhv_sl_snowman_wind_loop), - define_builtin(bhv_sl_walking_penguin_loop), - define_builtin(bhv_menu_button_init), - define_builtin(bhv_menu_button_loop), - define_builtin(bhv_menu_button_manager_init), - define_builtin(bhv_menu_button_manager_loop), - define_builtin(bhv_act_selector_star_type_loop), - define_builtin(bhv_act_selector_init), - define_builtin(bhv_act_selector_loop), - define_builtin(bhv_moving_yellow_coin_init), - define_builtin(bhv_moving_yellow_coin_loop), - define_builtin(bhv_moving_blue_coin_init), - define_builtin(bhv_moving_blue_coin_loop), - define_builtin(bhv_blue_coin_sliding_jumping_init), - define_builtin(bhv_blue_coin_sliding_loop), - define_builtin(bhv_blue_coin_jumping_loop), - define_builtin(bhv_seaweed_init), - define_builtin(bhv_seaweed_bundle_init), - define_builtin(bhv_bobomb_init), - define_builtin(bhv_bobomb_loop), - define_builtin(bhv_bobomb_fuse_smoke_init), - define_builtin(bhv_bobomb_buddy_init), - define_builtin(bhv_bobomb_buddy_loop), - define_builtin(bhv_cannon_closed_init), - define_builtin(bhv_cannon_closed_loop), - define_builtin(bhv_whirlpool_init), - define_builtin(bhv_whirlpool_loop), - define_builtin(bhv_jet_stream_loop), - define_builtin(bhv_homing_amp_init), - define_builtin(bhv_homing_amp_loop), - define_builtin(bhv_circling_amp_init), - define_builtin(bhv_circling_amp_loop), - define_builtin(bhv_butterfly_init), - define_builtin(bhv_butterfly_loop), - define_builtin(bhv_hoot_init), - define_builtin(bhv_hoot_loop), - define_builtin(bhv_beta_holdable_object_init), - define_builtin(bhv_beta_holdable_object_loop), - define_builtin(bhv_object_bubble_init), - define_builtin(bhv_object_bubble_loop), - define_builtin(bhv_object_water_wave_init), - define_builtin(bhv_object_water_wave_loop), - define_builtin(bhv_explosion_init), - define_builtin(bhv_explosion_loop), - define_builtin(bhv_bobomb_bully_death_smoke_init), - define_builtin(bhv_bobomb_explosion_bubble_init), - define_builtin(bhv_bobomb_explosion_bubble_loop), - define_builtin(bhv_respawner_loop), - define_builtin(bhv_small_bully_init), - define_builtin(bhv_bully_loop), - define_builtin(bhv_big_bully_init), - define_builtin(bhv_big_bully_with_minions_init), - define_builtin(bhv_big_bully_with_minions_loop), - define_builtin(bhv_jet_stream_ring_spawner_loop), - define_builtin(bhv_jet_stream_water_ring_init), - define_builtin(bhv_jet_stream_water_ring_loop), - define_builtin(bhv_manta_ray_water_ring_init), - define_builtin(bhv_manta_ray_water_ring_loop), - define_builtin(bhv_bowser_bomb_loop), - define_builtin(bhv_bowser_bomb_explosion_loop), - define_builtin(bhv_bowser_bomb_smoke_loop), - define_builtin(bhv_celebration_star_init), - define_builtin(bhv_celebration_star_loop), - define_builtin(bhv_celebration_star_sparkle_loop), - define_builtin(bhv_star_key_collection_puff_spawner_loop), - define_builtin(bhv_lll_drawbridge_spawner_init), - define_builtin(bhv_lll_drawbridge_spawner_loop), - define_builtin(bhv_lll_drawbridge_loop), - define_builtin(bhv_small_bomp_init), - define_builtin(bhv_small_bomp_loop), - define_builtin(bhv_large_bomp_init), - define_builtin(bhv_large_bomp_loop), - define_builtin(bhv_wf_sliding_platform_init), - define_builtin(bhv_wf_sliding_platform_loop), - define_builtin(bhv_moneybag_init), - define_builtin(bhv_moneybag_loop), - define_builtin(bhv_moneybag_hidden_loop), - define_builtin(bhv_bob_pit_bowling_ball_init), - define_builtin(bhv_bob_pit_bowling_ball_loop), - define_builtin(bhv_free_bowling_ball_init), - define_builtin(bhv_free_bowling_ball_loop), - define_builtin(bhv_bowling_ball_init), - define_builtin(bhv_bowling_ball_loop), - define_builtin(bhv_generic_bowling_ball_spawner_init), - define_builtin(bhv_generic_bowling_ball_spawner_loop), - define_builtin(bhv_thi_bowling_ball_spawner_loop), - define_builtin(bhv_rr_cruiser_wing_init), - define_builtin(bhv_rr_cruiser_wing_loop), - define_builtin(bhv_spindel_init), - define_builtin(bhv_spindel_loop), - define_builtin(bhv_ssl_moving_pyramid_wall_init), - define_builtin(bhv_ssl_moving_pyramid_wall_loop), - define_builtin(bhv_pyramid_elevator_init), - define_builtin(bhv_pyramid_elevator_loop), - define_builtin(bhv_pyramid_elevator_trajectory_marker_ball_loop), - define_builtin(bhv_pyramid_top_init), - define_builtin(bhv_pyramid_top_loop), - define_builtin(bhv_pyramid_top_fragment_init), - define_builtin(bhv_pyramid_top_fragment_loop), - define_builtin(bhv_pyramid_pillar_touch_detector_loop), - define_builtin(bhv_waterfall_sound_loop), - define_builtin(bhv_volcano_sound_loop), - define_builtin(bhv_castle_flag_init), - define_builtin(bhv_birds_sound_loop), - define_builtin(bhv_ambient_sounds_init), - define_builtin(bhv_sand_sound_loop), - define_builtin(bhv_castle_cannon_grate_init), - define_builtin(bhv_snowmans_bottom_init), - define_builtin(bhv_snowmans_bottom_loop), - define_builtin(bhv_snowmans_head_init), - define_builtin(bhv_snowmans_head_loop), - define_builtin(bhv_snowmans_body_checkpoint_loop), - define_builtin(bhv_big_boulder_init), - define_builtin(bhv_big_boulder_loop), - define_builtin(bhv_big_boulder_generator_loop), - define_builtin(bhv_wing_cap_init), - define_builtin(bhv_wing_vanish_cap_loop), - define_builtin(bhv_metal_cap_init), - define_builtin(bhv_metal_cap_loop), - define_builtin(bhv_normal_cap_init), - define_builtin(bhv_normal_cap_loop), - define_builtin(bhv_vanish_cap_init), - define_builtin(bhv_collect_star_init), - define_builtin(bhv_collect_star_loop), - define_builtin(bhv_star_spawn_init), - define_builtin(bhv_star_spawn_loop), - define_builtin(bhv_hidden_red_coin_star_init), - define_builtin(bhv_hidden_red_coin_star_loop), - define_builtin(bhv_red_coin_init), - define_builtin(bhv_red_coin_loop), - define_builtin(bhv_bowser_course_red_coin_star_loop), - define_builtin(bhv_hidden_star_init), - define_builtin(bhv_hidden_star_loop), - define_builtin(bhv_hidden_star_trigger_loop), - define_builtin(bhv_ttm_rolling_log_init), - define_builtin(bhv_rolling_log_loop), - define_builtin(bhv_lll_rolling_log_init), - define_builtin(bhv_1up_common_init), - define_builtin(bhv_1up_walking_loop), - define_builtin(bhv_1up_running_away_loop), - define_builtin(bhv_1up_sliding_loop), - define_builtin(bhv_1up_init), - define_builtin(bhv_1up_loop), - define_builtin(bhv_1up_jump_on_approach_loop), - define_builtin(bhv_1up_hidden_loop), - define_builtin(bhv_1up_hidden_trigger_loop), - define_builtin(bhv_1up_hidden_in_pole_loop), - define_builtin(bhv_1up_hidden_in_pole_trigger_loop), - define_builtin(bhv_1up_hidden_in_pole_spawner_loop), - define_builtin(bhv_controllable_platform_init), - define_builtin(bhv_controllable_platform_loop), - define_builtin(bhv_controllable_platform_sub_loop), - define_builtin(bhv_breakable_box_small_init), - define_builtin(bhv_breakable_box_small_loop), - define_builtin(bhv_sliding_snow_mound_loop), - define_builtin(bhv_snow_mound_spawn_loop), - define_builtin(bhv_floating_platform_loop), - define_builtin(bhv_arrow_lift_loop), - define_builtin(bhv_orange_number_init), - define_builtin(bhv_orange_number_loop), - define_builtin(bhv_manta_ray_init), - define_builtin(bhv_manta_ray_loop), - define_builtin(bhv_falling_pillar_init), - define_builtin(bhv_falling_pillar_loop), - define_builtin(bhv_falling_pillar_hitbox_loop), - define_builtin(bhv_jrb_floating_box_loop), - define_builtin(bhv_decorative_pendulum_init), - define_builtin(bhv_decorative_pendulum_loop), - define_builtin(bhv_treasure_chest_ship_init), - define_builtin(bhv_treasure_chest_ship_loop), - define_builtin(bhv_treasure_chest_jrb_init), - define_builtin(bhv_treasure_chest_jrb_loop), - define_builtin(bhv_treasure_chest_init), - define_builtin(bhv_treasure_chest_loop), - define_builtin(bhv_treasure_chest_bottom_init), - define_builtin(bhv_treasure_chest_bottom_loop), - define_builtin(bhv_treasure_chest_top_loop), - define_builtin(bhv_mips_init), - define_builtin(bhv_mips_loop), - define_builtin(bhv_yoshi_init), - define_builtin(bhv_koopa_init), - define_builtin(bhv_koopa_update), - define_builtin(bhv_koopa_race_endpoint_update), - define_builtin(bhv_pokey_update), - define_builtin(bhv_pokey_body_part_update), - define_builtin(bhv_swoop_update), - define_builtin(bhv_fly_guy_update), - define_builtin(bhv_goomba_init), - define_builtin(bhv_goomba_update), - define_builtin(bhv_goomba_triplet_spawner_update), - define_builtin(bhv_chain_chomp_update), - define_builtin(bhv_chain_chomp_chain_part_update), - define_builtin(bhv_wooden_post_update), - define_builtin(bhv_chain_chomp_gate_init), - define_builtin(bhv_chain_chomp_gate_update), - define_builtin(bhv_wiggler_update), - define_builtin(bhv_wiggler_body_part_update), - define_builtin(bhv_enemy_lakitu_update), - define_builtin(bhv_camera_lakitu_init), - define_builtin(bhv_camera_lakitu_update), - define_builtin(bhv_cloud_update), - define_builtin(bhv_cloud_part_update), - define_builtin(bhv_spiny_update), - define_builtin(bhv_monty_mole_init), - define_builtin(bhv_monty_mole_update), - define_builtin(bhv_monty_mole_hole_update), - define_builtin(bhv_monty_mole_rock_update), - define_builtin(bhv_platform_on_track_init), - define_builtin(bhv_platform_on_track_update), - define_builtin(bhv_track_ball_update), - define_builtin(bhv_seesaw_platform_init), - define_builtin(bhv_seesaw_platform_update), - define_builtin(bhv_ferris_wheel_axle_init), - define_builtin(bhv_ferris_wheel_platform_update), - define_builtin(bhv_water_bomb_spawner_update), - define_builtin(bhv_water_bomb_update), - define_builtin(bhv_water_bomb_shadow_update), - define_builtin(bhv_ttc_rotating_solid_init), - define_builtin(bhv_ttc_rotating_solid_update), - define_builtin(bhv_ttc_pendulum_init), - define_builtin(bhv_ttc_pendulum_update), - define_builtin(bhv_ttc_treadmill_init), - define_builtin(bhv_ttc_treadmill_update), - define_builtin(bhv_ttc_moving_bar_init), - define_builtin(bhv_ttc_moving_bar_update), - define_builtin(bhv_ttc_cog_init), - define_builtin(bhv_ttc_cog_update), - define_builtin(bhv_ttc_pit_block_init), - define_builtin(bhv_ttc_pit_block_update), - define_builtin(bhv_ttc_elevator_init), - define_builtin(bhv_ttc_elevator_update), - define_builtin(bhv_ttc_2d_rotator_init), - define_builtin(bhv_ttc_2d_rotator_update), - define_builtin(bhv_ttc_spinner_update), - define_builtin(bhv_mr_blizzard_init), - define_builtin(bhv_mr_blizzard_update), - define_builtin(bhv_mr_blizzard_snowball), - define_builtin(bhv_sliding_plat_2_init), - define_builtin(bhv_sliding_plat_2_loop), - define_builtin(bhv_rotating_octagonal_plat_init), - define_builtin(bhv_rotating_octagonal_plat_loop), - define_builtin(bhv_animates_on_floor_switch_press_init), - define_builtin(bhv_animates_on_floor_switch_press_loop), - define_builtin(bhv_activated_back_and_forth_platform_init), - define_builtin(bhv_activated_back_and_forth_platform_update), - define_builtin(bhv_recovery_heart_loop), - define_builtin(bhv_water_bomb_cannon_loop), - define_builtin(bhv_bubble_cannon_barrel_loop), - define_builtin(bhv_unagi_init), - define_builtin(bhv_unagi_loop), - define_builtin(bhv_unagi_subobject_loop), - define_builtin(bhv_dorrie_update), - define_builtin(bhv_haunted_chair_init), - define_builtin(bhv_haunted_chair_loop), - define_builtin(bhv_mad_piano_update), - define_builtin(bhv_flying_bookend_loop), - define_builtin(bhv_bookend_spawn_loop), - define_builtin(bhv_haunted_bookshelf_manager_loop), - define_builtin(bhv_book_switch_loop), - define_builtin(bhv_fire_piranha_plant_init), - define_builtin(bhv_fire_piranha_plant_update), - define_builtin(bhv_small_piranha_flame_loop), - define_builtin(bhv_fire_spitter_update), - define_builtin(bhv_fly_guy_flame_loop), - define_builtin(bhv_snufit_loop), - define_builtin(bhv_snufit_balls_loop), - define_builtin(bhv_horizontal_grindel_init), - define_builtin(bhv_horizontal_grindel_update), - define_builtin(bhv_eyerok_boss_init), - define_builtin(bhv_eyerok_boss_loop), - define_builtin(bhv_eyerok_hand_loop), - define_builtin(bhv_klepto_init), - define_builtin(bhv_klepto_update), - define_builtin(bhv_bird_update), - define_builtin(bhv_racing_penguin_init), - define_builtin(bhv_racing_penguin_update), - define_builtin(bhv_penguin_race_finish_line_update), - define_builtin(bhv_penguin_race_shortcut_check_update), - define_builtin(bhv_coffin_spawner_loop), - define_builtin(bhv_coffin_loop), - define_builtin(bhv_clam_loop), - define_builtin(bhv_skeeter_update), - define_builtin(bhv_skeeter_wave_update), - define_builtin(bhv_swing_platform_init), - define_builtin(bhv_swing_platform_update), - define_builtin(bhv_donut_platform_spawner_update), - define_builtin(bhv_donut_platform_update), - define_builtin(bhv_ddd_pole_init), - define_builtin(bhv_ddd_pole_update), - define_builtin(bhv_red_coin_star_marker_init), - define_builtin(bhv_triplet_butterfly_update), - define_builtin(bhv_bubba_loop), - define_builtin(bhv_intro_lakitu_loop), - define_builtin(bhv_intro_peach_loop), - define_builtin(bhv_end_birds_1_loop), - define_builtin(bhv_end_birds_2_loop), - define_builtin(bhv_intro_scene_loop), - define_builtin(bhv_dust_smoke_loop), - define_builtin(bhv_yoshi_loop), - define_builtin(bhv_volcano_trap_loop), + define_builtin_function(bhv_cap_switch_loop, FUNCTION_BHV), + define_builtin_function(bhv_tiny_star_particles_init, FUNCTION_BHV), + define_builtin_function(bhv_grindel_thwomp_loop, FUNCTION_BHV), + define_builtin_function(bhv_koopa_shell_underwater_loop, FUNCTION_BHV), + define_builtin_function(bhv_door_init, FUNCTION_BHV), + define_builtin_function(bhv_door_loop, FUNCTION_BHV), + define_builtin_function(bhv_star_door_loop, FUNCTION_BHV), + define_builtin_function(bhv_star_door_loop_2, FUNCTION_BHV), + define_builtin_function(bhv_mr_i_loop, FUNCTION_BHV), + define_builtin_function(bhv_mr_i_body_loop, FUNCTION_BHV), + define_builtin_function(bhv_mr_i_particle_loop, FUNCTION_BHV), + define_builtin_function(bhv_piranha_particle_loop, FUNCTION_BHV), + define_builtin_function(bhv_giant_pole_loop, FUNCTION_BHV), + define_builtin_function(bhv_pole_init, FUNCTION_BHV), + define_builtin_function(bhv_pole_base_loop, FUNCTION_BHV), + define_builtin_function(bhv_thi_huge_island_top_loop, FUNCTION_BHV), + define_builtin_function(bhv_thi_tiny_island_top_loop, FUNCTION_BHV), + define_builtin_function(bhv_king_bobomb_loop, FUNCTION_BHV), + define_builtin_function(bhv_bobomb_anchor_mario_loop, FUNCTION_BHV), + define_builtin_function(bhv_beta_chest_bottom_init, FUNCTION_BHV), + define_builtin_function(bhv_beta_chest_bottom_loop, FUNCTION_BHV), + define_builtin_function(bhv_beta_chest_lid_loop, FUNCTION_BHV), + define_builtin_function(bhv_bubble_wave_init, FUNCTION_BHV), + define_builtin_function(bhv_bubble_maybe_loop, FUNCTION_BHV), + define_builtin_function(bhv_bubble_player_loop, FUNCTION_BHV), + define_builtin_function(bhv_water_air_bubble_init, FUNCTION_BHV), + define_builtin_function(bhv_water_air_bubble_loop, FUNCTION_BHV), + define_builtin_function(bhv_particle_init, FUNCTION_BHV), + define_builtin_function(bhv_particle_loop, FUNCTION_BHV), + define_builtin_function(bhv_water_waves_init, FUNCTION_BHV), + define_builtin_function(bhv_small_bubbles_loop, FUNCTION_BHV), + define_builtin_function(bhv_fish_group_loop, FUNCTION_BHV), + define_builtin_function(bhv_cannon_base_loop, FUNCTION_BHV), + define_builtin_function(bhv_cannon_barrel_loop, FUNCTION_BHV), + define_builtin_function(bhv_cannon_base_unused_loop, FUNCTION_BHV), + define_builtin_function(bhv_chuckya_loop, FUNCTION_BHV), + define_builtin_function(bhv_chuckya_anchor_mario_loop, FUNCTION_BHV), + define_builtin_function(bhv_rotating_platform_loop, FUNCTION_BHV), + define_builtin_function(bhv_wf_breakable_wall_loop, FUNCTION_BHV), + define_builtin_function(bhv_kickable_board_loop, FUNCTION_BHV), + define_builtin_function(bhv_tower_door_loop, FUNCTION_BHV), + define_builtin_function(bhv_wf_rotating_wooden_platform_init, FUNCTION_BHV), + define_builtin_function(bhv_wf_rotating_wooden_platform_loop, FUNCTION_BHV), + define_builtin_function(bhv_fading_warp_loop, FUNCTION_BHV), + define_builtin_function(bhv_warp_loop, FUNCTION_BHV), + define_builtin_function(bhv_white_puff_exploding_loop, FUNCTION_BHV), + define_builtin_function(bhv_spawned_star_init, FUNCTION_BHV), + define_builtin_function(bhv_spawned_star_loop, FUNCTION_BHV), + define_builtin_function(bhv_coin_init, FUNCTION_BHV), + define_builtin_function(bhv_coin_loop, FUNCTION_BHV), + define_builtin_function(bhv_coin_inside_boo_loop, FUNCTION_BHV), + define_builtin_function(bhv_coin_formation_init, FUNCTION_BHV), + define_builtin_function(bhv_coin_formation_spawn_loop, FUNCTION_BHV), + define_builtin_function(bhv_coin_formation_loop, FUNCTION_BHV), + define_builtin_function(bhv_temp_coin_loop, FUNCTION_BHV), + define_builtin_function(bhv_coin_sparkles_loop, FUNCTION_BHV), + define_builtin_function(bhv_golden_coin_sparkles_loop, FUNCTION_BHV), + define_builtin_function(bhv_wall_tiny_star_particle_loop, FUNCTION_BHV), + define_builtin_function(bhv_pound_tiny_star_particle_loop, FUNCTION_BHV), + define_builtin_function(bhv_pound_tiny_star_particle_init, FUNCTION_BHV), + define_builtin_function(bhv_punch_tiny_triangle_loop, FUNCTION_BHV), + define_builtin_function(bhv_punch_tiny_triangle_init, FUNCTION_BHV), + define_builtin_function(bhv_tumbling_bridge_platform_loop, FUNCTION_BHV), + define_builtin_function(bhv_tumbling_bridge_loop, FUNCTION_BHV), + define_builtin_function(bhv_elevator_init, FUNCTION_BHV), + define_builtin_function(bhv_elevator_loop, FUNCTION_BHV), + define_builtin_function(bhv_water_mist_loop, FUNCTION_BHV), + define_builtin_function(bhv_water_mist_spawn_loop, FUNCTION_BHV), + define_builtin_function(bhv_water_mist_2_loop, FUNCTION_BHV), + define_builtin_function(bhv_pound_white_puffs_init, FUNCTION_BHV), + define_builtin_function(bhv_ground_sand_init, FUNCTION_BHV), + define_builtin_function(bhv_ground_snow_init, FUNCTION_BHV), + define_builtin_function(bhv_wind_loop, FUNCTION_BHV), + define_builtin_function(bhv_unused_particle_spawn_loop, FUNCTION_BHV), + define_builtin_function(bhv_ukiki_cage_star_loop, FUNCTION_BHV), + define_builtin_function(bhv_ukiki_cage_loop, FUNCTION_BHV), + define_builtin_function(bhv_bitfs_sinking_platform_loop, FUNCTION_BHV), + define_builtin_function(bhv_bitfs_sinking_cage_platform_loop, FUNCTION_BHV), + define_builtin_function(bhv_ddd_moving_pole_loop, FUNCTION_BHV), + define_builtin_function(bhv_platform_normals_init, FUNCTION_BHV), + define_builtin_function(bhv_tilting_inverted_pyramid_loop, FUNCTION_BHV), + define_builtin_function(bhv_squishable_platform_loop, FUNCTION_BHV), + define_builtin_function(bhv_beta_moving_flames_spawn_loop, FUNCTION_BHV), + define_builtin_function(bhv_beta_moving_flames_loop, FUNCTION_BHV), + define_builtin_function(bhv_rr_rotating_bridge_platform_loop, FUNCTION_BHV), + define_builtin_function(bhv_flamethrower_loop, FUNCTION_BHV), + define_builtin_function(bhv_flamethrower_flame_loop, FUNCTION_BHV), + define_builtin_function(bhv_bouncing_fireball_loop, FUNCTION_BHV), + define_builtin_function(bhv_bouncing_fireball_flame_loop, FUNCTION_BHV), + define_builtin_function(bhv_bowser_shock_wave_loop, FUNCTION_BHV), + define_builtin_function(bhv_flame_mario_loop, FUNCTION_BHV), + define_builtin_function(bhv_black_smoke_mario_loop, FUNCTION_BHV), + define_builtin_function(bhv_black_smoke_bowser_loop, FUNCTION_BHV), + define_builtin_function(bhv_black_smoke_upward_loop, FUNCTION_BHV), + define_builtin_function(bhv_beta_fish_splash_spawner_loop, FUNCTION_BHV), + define_builtin_function(bhv_spindrift_loop, FUNCTION_BHV), + define_builtin_function(bhv_tower_platform_group_init, FUNCTION_BHV), + define_builtin_function(bhv_tower_platform_group_loop, FUNCTION_BHV), + define_builtin_function(bhv_wf_sliding_tower_platform_loop, FUNCTION_BHV), + define_builtin_function(bhv_wf_elevator_tower_platform_loop, FUNCTION_BHV), + define_builtin_function(bhv_wf_solid_tower_platform_loop, FUNCTION_BHV), + define_builtin_function(bhv_snow_leaf_particle_spawn_init, FUNCTION_BHV), + define_builtin_function(bhv_tree_snow_or_leaf_loop, FUNCTION_BHV), + define_builtin_function(bhv_piranha_plant_bubble_loop, FUNCTION_BHV), + define_builtin_function(bhv_piranha_plant_waking_bubbles_loop, FUNCTION_BHV), + define_builtin_function(bhv_purple_switch_loop, FUNCTION_BHV), + define_builtin_function(bhv_hidden_object_loop, FUNCTION_BHV), + define_builtin_function(bhv_breakable_box_loop, FUNCTION_BHV), + define_builtin_function(bhv_pushable_loop, FUNCTION_BHV), + define_builtin_function(bhv_init_room, FUNCTION_BHV), + define_builtin_function(bhv_small_water_wave_loop, FUNCTION_BHV), + define_builtin_function(bhv_yellow_coin_init, FUNCTION_BHV), + define_builtin_function(bhv_yellow_coin_loop, FUNCTION_BHV), + define_builtin_function(bhv_squarish_path_moving_loop, FUNCTION_BHV), + define_builtin_function(bhv_squarish_path_parent_init, FUNCTION_BHV), + define_builtin_function(bhv_squarish_path_parent_loop, FUNCTION_BHV), + define_builtin_function(bhv_heave_ho_loop, FUNCTION_BHV), + define_builtin_function(bhv_heave_ho_throw_mario_loop, FUNCTION_BHV), + define_builtin_function(bhv_ccm_touched_star_spawn_loop, FUNCTION_BHV), + define_builtin_function(bhv_unused_poundable_platform, FUNCTION_BHV), + define_builtin_function(bhv_beta_trampoline_top_loop, FUNCTION_BHV), + define_builtin_function(bhv_beta_trampoline_spring_loop, FUNCTION_BHV), + define_builtin_function(bhv_jumping_box_loop, FUNCTION_BHV), + define_builtin_function(bhv_boo_cage_init, FUNCTION_BHV), + define_builtin_function(bhv_boo_cage_loop, FUNCTION_BHV), + define_builtin_function(bhv_bowser_key_init, FUNCTION_BHV), + define_builtin_function(bhv_bowser_key_loop, FUNCTION_BHV), + define_builtin_function(bhv_grand_star_init, FUNCTION_BHV), + define_builtin_function(bhv_grand_star_loop, FUNCTION_BHV), + define_builtin_function(bhv_beta_boo_key_loop, FUNCTION_BHV), + define_builtin_function(bhv_alpha_boo_key_loop, FUNCTION_BHV), + define_builtin_function(bhv_bullet_bill_init, FUNCTION_BHV), + define_builtin_function(bhv_bullet_bill_loop, FUNCTION_BHV), + define_builtin_function(bhv_white_puff_smoke_init, FUNCTION_BHV), + define_builtin_function(bhv_bowser_tail_anchor_init, FUNCTION_BHV), + define_builtin_function(bhv_bowser_tail_anchor_loop, FUNCTION_BHV), + define_builtin_function(bhv_bowser_init, FUNCTION_BHV), + define_builtin_function(bhv_bowser_loop, FUNCTION_BHV), + define_builtin_function(bhv_bowser_body_anchor_init, FUNCTION_BHV), + define_builtin_function(bhv_bowser_body_anchor_loop, FUNCTION_BHV), + define_builtin_function(bhv_bowser_flame_spawn_loop, FUNCTION_BHV), + define_builtin_function(bhv_tilting_bowser_lava_platform_init, FUNCTION_BHV), + define_builtin_function(bhv_falling_bowser_platform_loop, FUNCTION_BHV), + define_builtin_function(bhv_blue_bowser_flame_init, FUNCTION_BHV), + define_builtin_function(bhv_blue_bowser_flame_loop, FUNCTION_BHV), + define_builtin_function(bhv_flame_floating_landing_init, FUNCTION_BHV), + define_builtin_function(bhv_flame_floating_landing_loop, FUNCTION_BHV), + define_builtin_function(bhv_blue_flames_group_loop, FUNCTION_BHV), + define_builtin_function(bhv_flame_bouncing_init, FUNCTION_BHV), + define_builtin_function(bhv_flame_bouncing_loop, FUNCTION_BHV), + define_builtin_function(bhv_flame_moving_forward_growing_init, FUNCTION_BHV), + define_builtin_function(bhv_flame_moving_forward_growing_loop, FUNCTION_BHV), + define_builtin_function(bhv_flame_bowser_init, FUNCTION_BHV), + define_builtin_function(bhv_flame_bowser_loop, FUNCTION_BHV), + define_builtin_function(bhv_flame_large_burning_out_init, FUNCTION_BHV), + define_builtin_function(bhv_blue_fish_movement_loop, FUNCTION_BHV), + define_builtin_function(bhv_tank_fish_group_loop, FUNCTION_BHV), + define_builtin_function(bhv_checkerboard_elevator_group_init, FUNCTION_BHV), + define_builtin_function(bhv_checkerboard_elevator_group_loop, FUNCTION_BHV), + define_builtin_function(bhv_checkerboard_platform_init, FUNCTION_BHV), + define_builtin_function(bhv_checkerboard_platform_loop, FUNCTION_BHV), + define_builtin_function(bhv_bowser_key_unlock_door_loop, FUNCTION_BHV), + define_builtin_function(bhv_bowser_key_course_exit_loop, FUNCTION_BHV), + define_builtin_function(bhv_invisible_objects_under_bridge_init, FUNCTION_BHV), + define_builtin_function(bhv_invisible_objects_under_bridge_loop, FUNCTION_BHV), + define_builtin_function(bhv_water_level_pillar_init, FUNCTION_BHV), + define_builtin_function(bhv_water_level_pillar_loop, FUNCTION_BHV), + define_builtin_function(bhv_ddd_warp_loop, FUNCTION_BHV), + define_builtin_function(bhv_moat_grills_loop, FUNCTION_BHV), + define_builtin_function(bhv_rotating_clock_arm_loop, FUNCTION_BHV), + define_builtin_function(bhv_ukiki_init, FUNCTION_BHV), + define_builtin_function(bhv_ukiki_loop, FUNCTION_BHV), + define_builtin_function(bhv_lll_sinking_rock_block_loop, FUNCTION_BHV), + define_builtin_function(bhv_lll_moving_octagonal_mesh_platform_loop, FUNCTION_BHV), + define_builtin_function(bhv_lll_rotating_block_fire_bars_loop, FUNCTION_BHV), + define_builtin_function(bhv_lll_rotating_hex_flame_loop, FUNCTION_BHV), + define_builtin_function(bhv_lll_wood_piece_loop, FUNCTION_BHV), + define_builtin_function(bhv_lll_floating_wood_bridge_loop, FUNCTION_BHV), + define_builtin_function(bhv_volcano_flames_loop, FUNCTION_BHV), + define_builtin_function(bhv_lll_rotating_hexagonal_ring_loop, FUNCTION_BHV), + define_builtin_function(bhv_lll_sinking_rectangular_platform_loop, FUNCTION_BHV), + define_builtin_function(bhv_lll_sinking_square_platforms_loop, FUNCTION_BHV), + define_builtin_function(bhv_koopa_shell_loop, FUNCTION_BHV), + define_builtin_function(bhv_koopa_shell_flame_loop, FUNCTION_BHV), + define_builtin_function(bhv_tox_box_loop, FUNCTION_BHV), + define_builtin_function(bhv_piranha_plant_loop, FUNCTION_BHV), + define_builtin_function(bhv_lll_bowser_puzzle_piece_loop, FUNCTION_BHV), + define_builtin_function(bhv_lll_bowser_puzzle_loop, FUNCTION_BHV), + define_builtin_function(bhv_tuxies_mother_loop, FUNCTION_BHV), + define_builtin_function(bhv_small_penguin_loop, FUNCTION_BHV), + define_builtin_function(bhv_fish_spawner_loop, FUNCTION_BHV), + define_builtin_function(bhv_fish_loop, FUNCTION_BHV), + define_builtin_function(bhv_wdw_express_elevator_loop, FUNCTION_BHV), + define_builtin_function(bhv_bub_spawner_loop, FUNCTION_BHV), + define_builtin_function(bhv_bub_loop, FUNCTION_BHV), + define_builtin_function(bhv_exclamation_box_init, FUNCTION_BHV), + define_builtin_function(bhv_exclamation_box_loop, FUNCTION_BHV), + define_builtin_function(bhv_rotating_exclamation_box_loop, FUNCTION_BHV), + define_builtin_function(bhv_sound_spawner_init, FUNCTION_BHV), + define_builtin_function(bhv_bowsers_sub_loop, FUNCTION_BHV), + define_builtin_function(bhv_sushi_shark_loop, FUNCTION_BHV), + define_builtin_function(bhv_sushi_shark_collision_loop, FUNCTION_BHV), + define_builtin_function(bhv_jrb_sliding_box_loop, FUNCTION_BHV), + define_builtin_function(bhv_ship_part_3_loop, FUNCTION_BHV), + define_builtin_function(bhv_sunken_ship_part_loop, FUNCTION_BHV), + define_builtin_function(bhv_white_puff_1_loop, FUNCTION_BHV), + define_builtin_function(bhv_white_puff_2_loop, FUNCTION_BHV), + define_builtin_function(bhv_blue_coin_switch_loop, FUNCTION_BHV), + define_builtin_function(bhv_hidden_blue_coin_loop, FUNCTION_BHV), + define_builtin_function(bhv_openable_cage_door_loop, FUNCTION_BHV), + define_builtin_function(bhv_openable_grill_loop, FUNCTION_BHV), + define_builtin_function(bhv_water_level_diamond_loop, FUNCTION_BHV), + define_builtin_function(bhv_init_changing_water_level_loop, FUNCTION_BHV), + define_builtin_function(bhv_tweester_sand_particle_loop, FUNCTION_BHV), + define_builtin_function(bhv_tweester_loop, FUNCTION_BHV), + define_builtin_function(bhv_merry_go_round_boo_manager_loop, FUNCTION_BHV), + define_builtin_function(bhv_animated_texture_loop, FUNCTION_BHV), + define_builtin_function(bhv_boo_in_castle_loop, FUNCTION_BHV), + define_builtin_function(bhv_boo_with_cage_init, FUNCTION_BHV), + define_builtin_function(bhv_boo_with_cage_loop, FUNCTION_BHV), + define_builtin_function(bhv_boo_init, FUNCTION_BHV), + define_builtin_function(bhv_big_boo_loop, FUNCTION_BHV), + define_builtin_function(bhv_courtyard_boo_triplet_init, FUNCTION_BHV), + define_builtin_function(bhv_boo_loop, FUNCTION_BHV), + define_builtin_function(bhv_boo_boss_spawned_bridge_loop, FUNCTION_BHV), + define_builtin_function(bhv_bbh_tilting_trap_platform_loop, FUNCTION_BHV), + define_builtin_function(bhv_haunted_bookshelf_loop, FUNCTION_BHV), + define_builtin_function(bhv_merry_go_round_loop, FUNCTION_BHV), + define_builtin_function(bhv_play_music_track_when_touched_loop, FUNCTION_BHV), + define_builtin_function(bhv_beta_bowser_anchor_loop, FUNCTION_BHV), + define_builtin_function(bhv_static_checkered_platform_loop, FUNCTION_BHV), + define_builtin_function(bhv_castle_floor_trap_init, FUNCTION_BHV), + define_builtin_function(bhv_castle_floor_trap_loop, FUNCTION_BHV), + define_builtin_function(bhv_floor_trap_in_castle_loop, FUNCTION_BHV), + define_builtin_function(bhv_sparkle_spawn_loop, FUNCTION_BHV), + define_builtin_function(bhv_scuttlebug_loop, FUNCTION_BHV), + define_builtin_function(bhv_scuttlebug_spawn_loop, FUNCTION_BHV), + define_builtin_function(bhv_whomp_loop, FUNCTION_BHV), + define_builtin_function(bhv_water_splash_spawn_droplets, FUNCTION_BHV), + define_builtin_function(bhv_water_droplet_loop, FUNCTION_BHV), + define_builtin_function(bhv_water_droplet_splash_init, FUNCTION_BHV), + define_builtin_function(bhv_bubble_splash_init, FUNCTION_BHV), + define_builtin_function(bhv_idle_water_wave_loop, FUNCTION_BHV), + define_builtin_function(bhv_shallow_water_splash_init, FUNCTION_BHV), + define_builtin_function(bhv_wave_trail_shrink, FUNCTION_BHV), + define_builtin_function(bhv_strong_wind_particle_loop, FUNCTION_BHV), + define_builtin_function(bhv_sl_snowman_wind_loop, FUNCTION_BHV), + define_builtin_function(bhv_sl_walking_penguin_loop, FUNCTION_BHV), + define_builtin_function(bhv_menu_button_init, FUNCTION_BHV), + define_builtin_function(bhv_menu_button_loop, FUNCTION_BHV), + define_builtin_function(bhv_menu_button_manager_init, FUNCTION_BHV), + define_builtin_function(bhv_menu_button_manager_loop, FUNCTION_BHV), + define_builtin_function(bhv_act_selector_star_type_loop, FUNCTION_BHV), + define_builtin_function(bhv_act_selector_init, FUNCTION_BHV), + define_builtin_function(bhv_act_selector_loop, FUNCTION_BHV), + define_builtin_function(bhv_moving_yellow_coin_init, FUNCTION_BHV), + define_builtin_function(bhv_moving_yellow_coin_loop, FUNCTION_BHV), + define_builtin_function(bhv_moving_blue_coin_init, FUNCTION_BHV), + define_builtin_function(bhv_moving_blue_coin_loop, FUNCTION_BHV), + define_builtin_function(bhv_blue_coin_sliding_jumping_init, FUNCTION_BHV), + define_builtin_function(bhv_blue_coin_sliding_loop, FUNCTION_BHV), + define_builtin_function(bhv_blue_coin_jumping_loop, FUNCTION_BHV), + define_builtin_function(bhv_seaweed_init, FUNCTION_BHV), + define_builtin_function(bhv_seaweed_bundle_init, FUNCTION_BHV), + define_builtin_function(bhv_bobomb_init, FUNCTION_BHV), + define_builtin_function(bhv_bobomb_loop, FUNCTION_BHV), + define_builtin_function(bhv_bobomb_fuse_smoke_init, FUNCTION_BHV), + define_builtin_function(bhv_bobomb_buddy_init, FUNCTION_BHV), + define_builtin_function(bhv_bobomb_buddy_loop, FUNCTION_BHV), + define_builtin_function(bhv_cannon_closed_init, FUNCTION_BHV), + define_builtin_function(bhv_cannon_closed_loop, FUNCTION_BHV), + define_builtin_function(bhv_whirlpool_init, FUNCTION_BHV), + define_builtin_function(bhv_whirlpool_loop, FUNCTION_BHV), + define_builtin_function(bhv_jet_stream_loop, FUNCTION_BHV), + define_builtin_function(bhv_homing_amp_init, FUNCTION_BHV), + define_builtin_function(bhv_homing_amp_loop, FUNCTION_BHV), + define_builtin_function(bhv_circling_amp_init, FUNCTION_BHV), + define_builtin_function(bhv_circling_amp_loop, FUNCTION_BHV), + define_builtin_function(bhv_butterfly_init, FUNCTION_BHV), + define_builtin_function(bhv_butterfly_loop, FUNCTION_BHV), + define_builtin_function(bhv_hoot_init, FUNCTION_BHV), + define_builtin_function(bhv_hoot_loop, FUNCTION_BHV), + define_builtin_function(bhv_beta_holdable_object_init, FUNCTION_BHV), + define_builtin_function(bhv_beta_holdable_object_loop, FUNCTION_BHV), + define_builtin_function(bhv_object_bubble_init, FUNCTION_BHV), + define_builtin_function(bhv_object_bubble_loop, FUNCTION_BHV), + define_builtin_function(bhv_object_water_wave_init, FUNCTION_BHV), + define_builtin_function(bhv_object_water_wave_loop, FUNCTION_BHV), + define_builtin_function(bhv_explosion_init, FUNCTION_BHV), + define_builtin_function(bhv_explosion_loop, FUNCTION_BHV), + define_builtin_function(bhv_bobomb_bully_death_smoke_init, FUNCTION_BHV), + define_builtin_function(bhv_bobomb_explosion_bubble_init, FUNCTION_BHV), + define_builtin_function(bhv_bobomb_explosion_bubble_loop, FUNCTION_BHV), + define_builtin_function(bhv_respawner_loop, FUNCTION_BHV), + define_builtin_function(bhv_small_bully_init, FUNCTION_BHV), + define_builtin_function(bhv_bully_loop, FUNCTION_BHV), + define_builtin_function(bhv_big_bully_init, FUNCTION_BHV), + define_builtin_function(bhv_big_bully_with_minions_init, FUNCTION_BHV), + define_builtin_function(bhv_big_bully_with_minions_loop, FUNCTION_BHV), + define_builtin_function(bhv_jet_stream_ring_spawner_loop, FUNCTION_BHV), + define_builtin_function(bhv_jet_stream_water_ring_init, FUNCTION_BHV), + define_builtin_function(bhv_jet_stream_water_ring_loop, FUNCTION_BHV), + define_builtin_function(bhv_manta_ray_water_ring_init, FUNCTION_BHV), + define_builtin_function(bhv_manta_ray_water_ring_loop, FUNCTION_BHV), + define_builtin_function(bhv_bowser_bomb_loop, FUNCTION_BHV), + define_builtin_function(bhv_bowser_bomb_explosion_loop, FUNCTION_BHV), + define_builtin_function(bhv_bowser_bomb_smoke_loop, FUNCTION_BHV), + define_builtin_function(bhv_celebration_star_init, FUNCTION_BHV), + define_builtin_function(bhv_celebration_star_loop, FUNCTION_BHV), + define_builtin_function(bhv_celebration_star_sparkle_loop, FUNCTION_BHV), + define_builtin_function(bhv_star_key_collection_puff_spawner_loop, FUNCTION_BHV), + define_builtin_function(bhv_lll_drawbridge_spawner_init, FUNCTION_BHV), + define_builtin_function(bhv_lll_drawbridge_spawner_loop, FUNCTION_BHV), + define_builtin_function(bhv_lll_drawbridge_loop, FUNCTION_BHV), + define_builtin_function(bhv_small_bomp_init, FUNCTION_BHV), + define_builtin_function(bhv_small_bomp_loop, FUNCTION_BHV), + define_builtin_function(bhv_large_bomp_init, FUNCTION_BHV), + define_builtin_function(bhv_large_bomp_loop, FUNCTION_BHV), + define_builtin_function(bhv_wf_sliding_platform_init, FUNCTION_BHV), + define_builtin_function(bhv_wf_sliding_platform_loop, FUNCTION_BHV), + define_builtin_function(bhv_moneybag_init, FUNCTION_BHV), + define_builtin_function(bhv_moneybag_loop, FUNCTION_BHV), + define_builtin_function(bhv_moneybag_hidden_loop, FUNCTION_BHV), + define_builtin_function(bhv_bob_pit_bowling_ball_init, FUNCTION_BHV), + define_builtin_function(bhv_bob_pit_bowling_ball_loop, FUNCTION_BHV), + define_builtin_function(bhv_free_bowling_ball_init, FUNCTION_BHV), + define_builtin_function(bhv_free_bowling_ball_loop, FUNCTION_BHV), + define_builtin_function(bhv_bowling_ball_init, FUNCTION_BHV), + define_builtin_function(bhv_bowling_ball_loop, FUNCTION_BHV), + define_builtin_function(bhv_generic_bowling_ball_spawner_init, FUNCTION_BHV), + define_builtin_function(bhv_generic_bowling_ball_spawner_loop, FUNCTION_BHV), + define_builtin_function(bhv_thi_bowling_ball_spawner_loop, FUNCTION_BHV), + define_builtin_function(bhv_rr_cruiser_wing_init, FUNCTION_BHV), + define_builtin_function(bhv_rr_cruiser_wing_loop, FUNCTION_BHV), + define_builtin_function(bhv_spindel_init, FUNCTION_BHV), + define_builtin_function(bhv_spindel_loop, FUNCTION_BHV), + define_builtin_function(bhv_ssl_moving_pyramid_wall_init, FUNCTION_BHV), + define_builtin_function(bhv_ssl_moving_pyramid_wall_loop, FUNCTION_BHV), + define_builtin_function(bhv_pyramid_elevator_init, FUNCTION_BHV), + define_builtin_function(bhv_pyramid_elevator_loop, FUNCTION_BHV), + define_builtin_function(bhv_pyramid_elevator_trajectory_marker_ball_loop, FUNCTION_BHV), + define_builtin_function(bhv_pyramid_top_init, FUNCTION_BHV), + define_builtin_function(bhv_pyramid_top_loop, FUNCTION_BHV), + define_builtin_function(bhv_pyramid_top_fragment_init, FUNCTION_BHV), + define_builtin_function(bhv_pyramid_top_fragment_loop, FUNCTION_BHV), + define_builtin_function(bhv_pyramid_pillar_touch_detector_loop, FUNCTION_BHV), + define_builtin_function(bhv_waterfall_sound_loop, FUNCTION_BHV), + define_builtin_function(bhv_volcano_sound_loop, FUNCTION_BHV), + define_builtin_function(bhv_castle_flag_init, FUNCTION_BHV), + define_builtin_function(bhv_birds_sound_loop, FUNCTION_BHV), + define_builtin_function(bhv_ambient_sounds_init, FUNCTION_BHV), + define_builtin_function(bhv_sand_sound_loop, FUNCTION_BHV), + define_builtin_function(bhv_castle_cannon_grate_init, FUNCTION_BHV), + define_builtin_function(bhv_snowmans_bottom_init, FUNCTION_BHV), + define_builtin_function(bhv_snowmans_bottom_loop, FUNCTION_BHV), + define_builtin_function(bhv_snowmans_head_init, FUNCTION_BHV), + define_builtin_function(bhv_snowmans_head_loop, FUNCTION_BHV), + define_builtin_function(bhv_snowmans_body_checkpoint_loop, FUNCTION_BHV), + define_builtin_function(bhv_big_boulder_init, FUNCTION_BHV), + define_builtin_function(bhv_big_boulder_loop, FUNCTION_BHV), + define_builtin_function(bhv_big_boulder_generator_loop, FUNCTION_BHV), + define_builtin_function(bhv_wing_cap_init, FUNCTION_BHV), + define_builtin_function(bhv_wing_vanish_cap_loop, FUNCTION_BHV), + define_builtin_function(bhv_metal_cap_init, FUNCTION_BHV), + define_builtin_function(bhv_metal_cap_loop, FUNCTION_BHV), + define_builtin_function(bhv_normal_cap_init, FUNCTION_BHV), + define_builtin_function(bhv_normal_cap_loop, FUNCTION_BHV), + define_builtin_function(bhv_vanish_cap_init, FUNCTION_BHV), + define_builtin_function(bhv_collect_star_init, FUNCTION_BHV), + define_builtin_function(bhv_collect_star_loop, FUNCTION_BHV), + define_builtin_function(bhv_star_spawn_init, FUNCTION_BHV), + define_builtin_function(bhv_star_spawn_loop, FUNCTION_BHV), + define_builtin_function(bhv_hidden_red_coin_star_init, FUNCTION_BHV), + define_builtin_function(bhv_hidden_red_coin_star_loop, FUNCTION_BHV), + define_builtin_function(bhv_red_coin_init, FUNCTION_BHV), + define_builtin_function(bhv_red_coin_loop, FUNCTION_BHV), + define_builtin_function(bhv_bowser_course_red_coin_star_loop, FUNCTION_BHV), + define_builtin_function(bhv_hidden_star_init, FUNCTION_BHV), + define_builtin_function(bhv_hidden_star_loop, FUNCTION_BHV), + define_builtin_function(bhv_hidden_star_trigger_loop, FUNCTION_BHV), + define_builtin_function(bhv_ttm_rolling_log_init, FUNCTION_BHV), + define_builtin_function(bhv_rolling_log_loop, FUNCTION_BHV), + define_builtin_function(bhv_lll_rolling_log_init, FUNCTION_BHV), + define_builtin_function(bhv_1up_common_init, FUNCTION_BHV), + define_builtin_function(bhv_1up_walking_loop, FUNCTION_BHV), + define_builtin_function(bhv_1up_running_away_loop, FUNCTION_BHV), + define_builtin_function(bhv_1up_sliding_loop, FUNCTION_BHV), + define_builtin_function(bhv_1up_init, FUNCTION_BHV), + define_builtin_function(bhv_1up_loop, FUNCTION_BHV), + define_builtin_function(bhv_1up_jump_on_approach_loop, FUNCTION_BHV), + define_builtin_function(bhv_1up_hidden_loop, FUNCTION_BHV), + define_builtin_function(bhv_1up_hidden_trigger_loop, FUNCTION_BHV), + define_builtin_function(bhv_1up_hidden_in_pole_loop, FUNCTION_BHV), + define_builtin_function(bhv_1up_hidden_in_pole_trigger_loop, FUNCTION_BHV), + define_builtin_function(bhv_1up_hidden_in_pole_spawner_loop, FUNCTION_BHV), + define_builtin_function(bhv_controllable_platform_init, FUNCTION_BHV), + define_builtin_function(bhv_controllable_platform_loop, FUNCTION_BHV), + define_builtin_function(bhv_controllable_platform_sub_loop, FUNCTION_BHV), + define_builtin_function(bhv_breakable_box_small_init, FUNCTION_BHV), + define_builtin_function(bhv_breakable_box_small_loop, FUNCTION_BHV), + define_builtin_function(bhv_sliding_snow_mound_loop, FUNCTION_BHV), + define_builtin_function(bhv_snow_mound_spawn_loop, FUNCTION_BHV), + define_builtin_function(bhv_floating_platform_loop, FUNCTION_BHV), + define_builtin_function(bhv_arrow_lift_loop, FUNCTION_BHV), + define_builtin_function(bhv_orange_number_init, FUNCTION_BHV), + define_builtin_function(bhv_orange_number_loop, FUNCTION_BHV), + define_builtin_function(bhv_manta_ray_init, FUNCTION_BHV), + define_builtin_function(bhv_manta_ray_loop, FUNCTION_BHV), + define_builtin_function(bhv_falling_pillar_init, FUNCTION_BHV), + define_builtin_function(bhv_falling_pillar_loop, FUNCTION_BHV), + define_builtin_function(bhv_falling_pillar_hitbox_loop, FUNCTION_BHV), + define_builtin_function(bhv_jrb_floating_box_loop, FUNCTION_BHV), + define_builtin_function(bhv_decorative_pendulum_init, FUNCTION_BHV), + define_builtin_function(bhv_decorative_pendulum_loop, FUNCTION_BHV), + define_builtin_function(bhv_treasure_chest_ship_init, FUNCTION_BHV), + define_builtin_function(bhv_treasure_chest_ship_loop, FUNCTION_BHV), + define_builtin_function(bhv_treasure_chest_jrb_init, FUNCTION_BHV), + define_builtin_function(bhv_treasure_chest_jrb_loop, FUNCTION_BHV), + define_builtin_function(bhv_treasure_chest_init, FUNCTION_BHV), + define_builtin_function(bhv_treasure_chest_loop, FUNCTION_BHV), + define_builtin_function(bhv_treasure_chest_bottom_init, FUNCTION_BHV), + define_builtin_function(bhv_treasure_chest_bottom_loop, FUNCTION_BHV), + define_builtin_function(bhv_treasure_chest_top_loop, FUNCTION_BHV), + define_builtin_function(bhv_mips_init, FUNCTION_BHV), + define_builtin_function(bhv_mips_loop, FUNCTION_BHV), + define_builtin_function(bhv_yoshi_init, FUNCTION_BHV), + define_builtin_function(bhv_koopa_init, FUNCTION_BHV), + define_builtin_function(bhv_koopa_update, FUNCTION_BHV), + define_builtin_function(bhv_koopa_race_endpoint_update, FUNCTION_BHV), + define_builtin_function(bhv_pokey_update, FUNCTION_BHV), + define_builtin_function(bhv_pokey_body_part_update, FUNCTION_BHV), + define_builtin_function(bhv_swoop_update, FUNCTION_BHV), + define_builtin_function(bhv_fly_guy_update, FUNCTION_BHV), + define_builtin_function(bhv_goomba_init, FUNCTION_BHV), + define_builtin_function(bhv_goomba_update, FUNCTION_BHV), + define_builtin_function(bhv_goomba_triplet_spawner_update, FUNCTION_BHV), + define_builtin_function(bhv_chain_chomp_update, FUNCTION_BHV), + define_builtin_function(bhv_chain_chomp_chain_part_update, FUNCTION_BHV), + define_builtin_function(bhv_wooden_post_update, FUNCTION_BHV), + define_builtin_function(bhv_chain_chomp_gate_init, FUNCTION_BHV), + define_builtin_function(bhv_chain_chomp_gate_update, FUNCTION_BHV), + define_builtin_function(bhv_wiggler_update, FUNCTION_BHV), + define_builtin_function(bhv_wiggler_body_part_update, FUNCTION_BHV), + define_builtin_function(bhv_enemy_lakitu_update, FUNCTION_BHV), + define_builtin_function(bhv_camera_lakitu_init, FUNCTION_BHV), + define_builtin_function(bhv_camera_lakitu_update, FUNCTION_BHV), + define_builtin_function(bhv_cloud_update, FUNCTION_BHV), + define_builtin_function(bhv_cloud_part_update, FUNCTION_BHV), + define_builtin_function(bhv_spiny_update, FUNCTION_BHV), + define_builtin_function(bhv_monty_mole_init, FUNCTION_BHV), + define_builtin_function(bhv_monty_mole_update, FUNCTION_BHV), + define_builtin_function(bhv_monty_mole_hole_update, FUNCTION_BHV), + define_builtin_function(bhv_monty_mole_rock_update, FUNCTION_BHV), + define_builtin_function(bhv_platform_on_track_init, FUNCTION_BHV), + define_builtin_function(bhv_platform_on_track_update, FUNCTION_BHV), + define_builtin_function(bhv_track_ball_update, FUNCTION_BHV), + define_builtin_function(bhv_seesaw_platform_init, FUNCTION_BHV), + define_builtin_function(bhv_seesaw_platform_update, FUNCTION_BHV), + define_builtin_function(bhv_ferris_wheel_axle_init, FUNCTION_BHV), + define_builtin_function(bhv_ferris_wheel_platform_update, FUNCTION_BHV), + define_builtin_function(bhv_water_bomb_spawner_update, FUNCTION_BHV), + define_builtin_function(bhv_water_bomb_update, FUNCTION_BHV), + define_builtin_function(bhv_water_bomb_shadow_update, FUNCTION_BHV), + define_builtin_function(bhv_ttc_rotating_solid_init, FUNCTION_BHV), + define_builtin_function(bhv_ttc_rotating_solid_update, FUNCTION_BHV), + define_builtin_function(bhv_ttc_pendulum_init, FUNCTION_BHV), + define_builtin_function(bhv_ttc_pendulum_update, FUNCTION_BHV), + define_builtin_function(bhv_ttc_treadmill_init, FUNCTION_BHV), + define_builtin_function(bhv_ttc_treadmill_update, FUNCTION_BHV), + define_builtin_function(bhv_ttc_moving_bar_init, FUNCTION_BHV), + define_builtin_function(bhv_ttc_moving_bar_update, FUNCTION_BHV), + define_builtin_function(bhv_ttc_cog_init, FUNCTION_BHV), + define_builtin_function(bhv_ttc_cog_update, FUNCTION_BHV), + define_builtin_function(bhv_ttc_pit_block_init, FUNCTION_BHV), + define_builtin_function(bhv_ttc_pit_block_update, FUNCTION_BHV), + define_builtin_function(bhv_ttc_elevator_init, FUNCTION_BHV), + define_builtin_function(bhv_ttc_elevator_update, FUNCTION_BHV), + define_builtin_function(bhv_ttc_2d_rotator_init, FUNCTION_BHV), + define_builtin_function(bhv_ttc_2d_rotator_update, FUNCTION_BHV), + define_builtin_function(bhv_ttc_spinner_update, FUNCTION_BHV), + define_builtin_function(bhv_mr_blizzard_init, FUNCTION_BHV), + define_builtin_function(bhv_mr_blizzard_update, FUNCTION_BHV), + define_builtin_function(bhv_mr_blizzard_snowball, FUNCTION_BHV), + define_builtin_function(bhv_sliding_plat_2_init, FUNCTION_BHV), + define_builtin_function(bhv_sliding_plat_2_loop, FUNCTION_BHV), + define_builtin_function(bhv_rotating_octagonal_plat_init, FUNCTION_BHV), + define_builtin_function(bhv_rotating_octagonal_plat_loop, FUNCTION_BHV), + define_builtin_function(bhv_animates_on_floor_switch_press_init, FUNCTION_BHV), + define_builtin_function(bhv_animates_on_floor_switch_press_loop, FUNCTION_BHV), + define_builtin_function(bhv_activated_back_and_forth_platform_init, FUNCTION_BHV), + define_builtin_function(bhv_activated_back_and_forth_platform_update, FUNCTION_BHV), + define_builtin_function(bhv_recovery_heart_loop, FUNCTION_BHV), + define_builtin_function(bhv_water_bomb_cannon_loop, FUNCTION_BHV), + define_builtin_function(bhv_bubble_cannon_barrel_loop, FUNCTION_BHV), + define_builtin_function(bhv_unagi_init, FUNCTION_BHV), + define_builtin_function(bhv_unagi_loop, FUNCTION_BHV), + define_builtin_function(bhv_unagi_subobject_loop, FUNCTION_BHV), + define_builtin_function(bhv_dorrie_update, FUNCTION_BHV), + define_builtin_function(bhv_haunted_chair_init, FUNCTION_BHV), + define_builtin_function(bhv_haunted_chair_loop, FUNCTION_BHV), + define_builtin_function(bhv_mad_piano_update, FUNCTION_BHV), + define_builtin_function(bhv_flying_bookend_loop, FUNCTION_BHV), + define_builtin_function(bhv_bookend_spawn_loop, FUNCTION_BHV), + define_builtin_function(bhv_haunted_bookshelf_manager_loop, FUNCTION_BHV), + define_builtin_function(bhv_book_switch_loop, FUNCTION_BHV), + define_builtin_function(bhv_fire_piranha_plant_init, FUNCTION_BHV), + define_builtin_function(bhv_fire_piranha_plant_update, FUNCTION_BHV), + define_builtin_function(bhv_small_piranha_flame_loop, FUNCTION_BHV), + define_builtin_function(bhv_fire_spitter_update, FUNCTION_BHV), + define_builtin_function(bhv_fly_guy_flame_loop, FUNCTION_BHV), + define_builtin_function(bhv_snufit_loop, FUNCTION_BHV), + define_builtin_function(bhv_snufit_balls_loop, FUNCTION_BHV), + define_builtin_function(bhv_horizontal_grindel_init, FUNCTION_BHV), + define_builtin_function(bhv_horizontal_grindel_update, FUNCTION_BHV), + define_builtin_function(bhv_eyerok_boss_init, FUNCTION_BHV), + define_builtin_function(bhv_eyerok_boss_loop, FUNCTION_BHV), + define_builtin_function(bhv_eyerok_hand_loop, FUNCTION_BHV), + define_builtin_function(bhv_klepto_init, FUNCTION_BHV), + define_builtin_function(bhv_klepto_update, FUNCTION_BHV), + define_builtin_function(bhv_bird_update, FUNCTION_BHV), + define_builtin_function(bhv_racing_penguin_init, FUNCTION_BHV), + define_builtin_function(bhv_racing_penguin_update, FUNCTION_BHV), + define_builtin_function(bhv_penguin_race_finish_line_update, FUNCTION_BHV), + define_builtin_function(bhv_penguin_race_shortcut_check_update, FUNCTION_BHV), + define_builtin_function(bhv_coffin_spawner_loop, FUNCTION_BHV), + define_builtin_function(bhv_coffin_loop, FUNCTION_BHV), + define_builtin_function(bhv_clam_loop, FUNCTION_BHV), + define_builtin_function(bhv_skeeter_update, FUNCTION_BHV), + define_builtin_function(bhv_skeeter_wave_update, FUNCTION_BHV), + define_builtin_function(bhv_swing_platform_init, FUNCTION_BHV), + define_builtin_function(bhv_swing_platform_update, FUNCTION_BHV), + define_builtin_function(bhv_donut_platform_spawner_update, FUNCTION_BHV), + define_builtin_function(bhv_donut_platform_update, FUNCTION_BHV), + define_builtin_function(bhv_ddd_pole_init, FUNCTION_BHV), + define_builtin_function(bhv_ddd_pole_update, FUNCTION_BHV), + define_builtin_function(bhv_red_coin_star_marker_init, FUNCTION_BHV), + define_builtin_function(bhv_triplet_butterfly_update, FUNCTION_BHV), + define_builtin_function(bhv_bubba_loop, FUNCTION_BHV), + define_builtin_function(bhv_intro_lakitu_loop, FUNCTION_BHV), + define_builtin_function(bhv_intro_peach_loop, FUNCTION_BHV), + define_builtin_function(bhv_end_birds_1_loop, FUNCTION_BHV), + define_builtin_function(bhv_end_birds_2_loop, FUNCTION_BHV), + define_builtin_function(bhv_intro_scene_loop, FUNCTION_BHV), + define_builtin_function(bhv_dust_smoke_loop, FUNCTION_BHV), + define_builtin_function(bhv_yoshi_loop, FUNCTION_BHV), + define_builtin_function(bhv_volcano_trap_loop, FUNCTION_BHV), // mario_misc.h - define_builtin(bhv_toad_message_init), - define_builtin(bhv_toad_message_loop), - define_builtin(bhv_unlock_door_star_init), - define_builtin(bhv_unlock_door_star_loop), + define_builtin_function(bhv_toad_message_init, FUNCTION_BHV), + define_builtin_function(bhv_toad_message_loop, FUNCTION_BHV), + define_builtin_function(bhv_unlock_door_star_init, FUNCTION_BHV), + define_builtin_function(bhv_unlock_door_star_loop, FUNCTION_BHV), // Other - define_builtin(load_object_collision_model), - define_builtin(obj_set_secondary_camera_focus), + define_builtin_function(load_object_collision_model, FUNCTION_BHV), + define_builtin_function(obj_set_secondary_camera_focus, FUNCTION_BHV), // Menu related - define_builtin(lvl_intro_update), - define_builtin(geo_intro_super_mario_64_logo), - define_builtin(geo_intro_tm_copyright), - define_builtin(geo_intro_regular_backdrop), - define_builtin(geo_draw_mario_head_goddard), + define_builtin_function(lvl_intro_update, FUNCTION_LVL), + define_builtin_function(geo_intro_super_mario_64_logo, FUNCTION_GEO), + define_builtin_function(geo_intro_tm_copyright, FUNCTION_GEO), + define_builtin_function(geo_intro_regular_backdrop, FUNCTION_GEO), + define_builtin_function(geo_draw_mario_head_goddard, FUNCTION_GEO), // Custom - define_builtin(bhv_blue_coin_number_loop), - define_builtin(bhv_blue_coin_switch_init), - define_builtin(bhv_star_number_loop), - define_builtin(spawn_star_number), - define_builtin(bhv_ferris_wheel_platform_init), - define_builtin(geo_mario_cap_display_list), - define_builtin(bhv_ambient_light_update), - define_builtin(bhv_point_light_init), - define_builtin(bhv_point_light_loop), + define_builtin_function(bhv_blue_coin_number_loop, FUNCTION_BHV), + define_builtin_function(bhv_blue_coin_switch_init, FUNCTION_BHV), + define_builtin_function(bhv_star_number_loop, FUNCTION_BHV), + define_builtin_function(spawn_star_number, FUNCTION_BHV), + define_builtin_function(bhv_ferris_wheel_platform_init, FUNCTION_BHV), + define_builtin_function(geo_mario_cap_display_list, FUNCTION_GEO), + define_builtin_function(bhv_ambient_light_update, FUNCTION_BHV), + define_builtin_function(bhv_point_light_init, FUNCTION_BHV), + define_builtin_function(bhv_point_light_loop, FUNCTION_BHV), }; -const void* DynOS_Builtin_Func_GetFromName(const char* aDataName) { - MGR_FIND_DATA(sDynosBuiltinFuncs, (const void*)); -} +static const char *sDynosBuiltinFuncTypeNames[] = { + [0] = "other", + [FUNCTION_GEO] = "geo layout", + [FUNCTION_BHV] = "behavior", + [FUNCTION_LVL] = "level script", +}; -const void* DynOS_Builtin_Func_GetFromIndex(s32 aIndex) { - size_t count = sizeof(sDynosBuiltinFuncs) / (2 * sizeof(sDynosBuiltinFuncs[0])); - if (aIndex >= 0 && aIndex < count) { return (const void*)sDynosBuiltinFuncs[aIndex * 2 + 1]; } +const void* DynOS_Builtin_Func_GetFromName(const char* aDataName, u8 aFuncType) { + for (const auto &builtinFunc : sDynosBuiltinFuncs) { + if (builtinFunc.type == aFuncType && strcmp(builtinFunc.name, aDataName) == 0) { + return builtinFunc.func; + } + } return NULL; } -const char *DynOS_Builtin_Func_GetNameFromIndex(s64 aIndex) { - size_t count = sizeof(sDynosBuiltinFuncs) / (2 * sizeof(sDynosBuiltinFuncs[0])); - if (aIndex >= 0 && aIndex < count) { return (const char *)sDynosBuiltinFuncs[aIndex * 2 + 0]; } - return NULL; +const void* DynOS_Builtin_Func_GetFromIndex(s32 aIndex, u8 aFuncType) { + s32 count = (s32) (sizeof(sDynosBuiltinFuncs) / sizeof(sDynosBuiltinFuncs[0])); + if (aIndex < 0 || aIndex >= count) { return NULL; } + if (sDynosBuiltinFuncs[aIndex].type != aFuncType) { return NULL; } + return sDynosBuiltinFuncs[aIndex].func; } -s32 DynOS_Builtin_Func_GetIndexFromData(const void* aData) { - size_t count = sizeof(sDynosBuiltinFuncs) / (2 * sizeof(sDynosBuiltinFuncs[0])); - for (s32 i = 0; i < count; i++) { - if ((const void*)sDynosBuiltinFuncs[i * 2 + 1] == aData) { +const char *DynOS_Builtin_Func_GetNameFromIndex(s32 aIndex, u8 aFuncType) { + s32 count = (s32) (sizeof(sDynosBuiltinFuncs) / sizeof(sDynosBuiltinFuncs[0])); + if (aIndex < 0 || aIndex >= count) { return NULL; } + if (sDynosBuiltinFuncs[aIndex].type != aFuncType) { return NULL; } + return sDynosBuiltinFuncs[aIndex].name; +} + +s32 DynOS_Builtin_Func_GetIndexFromData(const void* aData, u8 aFuncType) { + s32 count = (s32) (sizeof(sDynosBuiltinFuncs) / sizeof(sDynosBuiltinFuncs[0])); + for (s32 i = 0; i < count; ++i) { + const auto &builtinFunc = sDynosBuiltinFuncs[i]; + if (builtinFunc.type == aFuncType && builtinFunc.func == aData) { return i; } } return -1; } +static String DynOS_Builtin_Func_CheckMisuse_Internal(s32 aIndex, const char* aDataName, const void* aData, u8 aFuncType) { + s32 count = (s32) (sizeof(sDynosBuiltinFuncs) / sizeof(sDynosBuiltinFuncs[0])); + for (s32 i = 0; i < count; ++i) { + const auto &builtinFunc = sDynosBuiltinFuncs[i]; + if (aFuncType != builtinFunc.type && ( + aIndex == i || (aDataName && strcmp(aDataName, builtinFunc.name) == 0) || aData == builtinFunc.func)) { + return String( + "Invalid use of function %s: trying to assign %s function to %s", + builtinFunc.name, + sDynosBuiltinFuncTypeNames[builtinFunc.type], + sDynosBuiltinFuncTypeNames[aFuncType] + ); + } + } + return ""; +} + +String DynOS_Builtin_Func_CheckMisuse(s32 aIndex, u8 aFuncType) { + return DynOS_Builtin_Func_CheckMisuse_Internal(aIndex, NULL, NULL, aFuncType); +} + +String DynOS_Builtin_Func_CheckMisuse(const char* aDataName, u8 aFuncType) { + return DynOS_Builtin_Func_CheckMisuse_Internal(-1, aDataName, NULL, aFuncType); +} + +String DynOS_Builtin_Func_CheckMisuse(const void* aData, u8 aFuncType) { + return DynOS_Builtin_Func_CheckMisuse_Internal(-1, NULL, aData, aFuncType); +} + /////////////////// // Display Lists // ///////////////////