diff --git a/autogen/lua_definitions/functions.lua b/autogen/lua_definitions/functions.lua index ba8337afd..534575e1d 100644 --- a/autogen/lua_definitions/functions.lua +++ b/autogen/lua_definitions/functions.lua @@ -6332,6 +6332,11 @@ function cur_obj_set_hitbox_radius_and_height(radius, height) -- ... end +--- @return nil +function cur_obj_set_home_once() + -- ... +end + --- @param radius number --- @param height number --- @return nil diff --git a/autogen/lua_definitions/structs.lua b/autogen/lua_definitions/structs.lua index 7371637fe..6994cd386 100644 --- a/autogen/lua_definitions/structs.lua +++ b/autogen/lua_definitions/structs.lua @@ -167,17 +167,25 @@ --- @field public UnagiTrajectory Pointer_Trajectory --- @class BehaviorValues +--- @field public KingBobombFVel number +--- @field public KingBobombHealth integer +--- @field public KingBobombYawVel integer +--- @field public KingWhompHealth integer --- @field public KoopaBobAgility number --- @field public KoopaCatchupAgility number --- @field public KoopaThiAgility number +--- @field public MipsStar1Requirement integer +--- @field public MipsStar2Requirement integer --- @field public RacingPenguinBigHeight number --- @field public RacingPenguinBigRadius number --- @field public RacingPenguinHeight number --- @field public RacingPenguinRadius number +--- @field public ShowStarMilestones integer --- @field public ToadStar1Requirement integer --- @field public ToadStar2Requirement integer --- @field public ToadStar3Requirement integer --- @field public dialogs BehaviorDialogs +--- @field public starsNeededForDialog StarsNeededForDialog --- @field public trajectories BehaviorTrajectories --- @class BullyCollisionData @@ -1509,6 +1517,7 @@ --- @field public platform Object --- @field public prevObj Object --- @field public respawnInfoType integer +--- @field public setHome integer --- @field public unused1 integer --- @field public usingObj Object @@ -1639,6 +1648,14 @@ --- @field public UnagiStarPos Vec3f --- @field public WigglerStarPos Vec3f +--- @class StarsNeededForDialog +--- @field public dialog1 integer +--- @field public dialog2 integer +--- @field public dialog3 integer +--- @field public dialog4 integer +--- @field public dialog5 integer +--- @field public dialog6 integer + --- @class Struct802A272C --- @field public vecF Vec3f --- @field public vecS Vec3s diff --git a/data/dynos_bin_tex.cpp b/data/dynos_bin_tex.cpp index 9fcd09026..6ea57c87d 100644 --- a/data/dynos_bin_tex.cpp +++ b/data/dynos_bin_tex.cpp @@ -344,13 +344,41 @@ DataNode* DynOS_Tex_LoadFromBinary(const SysPath &aPackFolder, const Sy // Generate // ////////////// +static bool is_level_number_png(SysPath& aPath) { + // normalize + String path = aPath.c_str(); + char* p = path.begin(); + while (*p != '\0') { + if (*p == '\\') { + *p = '/'; + } + break; + } + p = path.begin(); + + // compare 'levels/' + s16 levelsLength = strlen("levels/"); + if (strncmp(p, "levels/", levelsLength)) { + return false; + } + + // skip past level name + p += levelsLength; + while (*p != '\0') { + if (*p == '/') { break; } + p++; + } + if (*p != '/') { return false; } + p++; + + return (*p >= '0' && *p <= '9'); +} + static void DynOS_Tex_GeneratePack_Recursive(const SysPath &aPackFolder, SysPath &aOutputFolder, SysPath& aRelativePath, SysPath& aPrefix, GfxData *aGfxData, bool aAllowCustomTextures) { SysPath _DirPath = fstring("%s/%s", aPackFolder.c_str(), aRelativePath.c_str()); - // skip generation if any .c files exist - if (FileTypeExists(_DirPath, ".c")) { - return; - } + // skip generation if any .c files exist, and it isn't levels/xxx/NUMBER + bool containsC = FileTypeExists(_DirPath, ".c"); DIR *_PackDir = opendir(_DirPath.c_str()); if (!_PackDir) { return; } @@ -387,8 +415,12 @@ static void DynOS_Tex_GeneratePack_Recursive(const SysPath &aPackFolder, SysPath continue; } - // write the file SysPath _RelativePath = fstring("%s%s", aRelativePath.c_str(), _PackEnt->d_name); + if (containsC && !is_level_number_png(_RelativePath)) { + continue; + } + + // write the file String _BaseName; const char* _OverrideName = DynOS_Builtin_Tex_GetNameFromFileName(_RelativePath.c_str()); if (_OverrideName) { diff --git a/docs/lua/functions-4.md b/docs/lua/functions-4.md index 78dc61be5..747050c5d 100644 --- a/docs/lua/functions-4.md +++ b/docs/lua/functions-4.md @@ -2973,6 +2973,24 @@
+## [cur_obj_set_home_once](#cur_obj_set_home_once) + +### Lua Example +`cur_obj_set_home_once()` + +### Parameters +- None + +### Returns +- None + +### C Prototype +`void cur_obj_set_home_once(void);` + +[:arrow_up_small:](#) + +
+ ## [cur_obj_set_hurtbox_radius_and_height](#cur_obj_set_hurtbox_radius_and_height) ### Lua Example diff --git a/docs/lua/functions.md b/docs/lua/functions.md index 9fb095fe1..cc8c1b410 100644 --- a/docs/lua/functions.md +++ b/docs/lua/functions.md @@ -1195,6 +1195,7 @@ - [cur_obj_set_face_angle_to_move_angle](functions-4.md#cur_obj_set_face_angle_to_move_angle) - [cur_obj_set_hitbox_and_die_if_attacked](functions-4.md#cur_obj_set_hitbox_and_die_if_attacked) - [cur_obj_set_hitbox_radius_and_height](functions-4.md#cur_obj_set_hitbox_radius_and_height) + - [cur_obj_set_home_once](functions-4.md#cur_obj_set_home_once) - [cur_obj_set_hurtbox_radius_and_height](functions-4.md#cur_obj_set_hurtbox_radius_and_height) - [cur_obj_set_pos_relative](functions-4.md#cur_obj_set_pos_relative) - [cur_obj_set_pos_relative_to_parent](functions-4.md#cur_obj_set_pos_relative_to_parent) diff --git a/docs/lua/structs.md b/docs/lua/structs.md index 2f8d4190d..72010cc3f 100644 --- a/docs/lua/structs.md +++ b/docs/lua/structs.md @@ -54,6 +54,7 @@ - [SpawnInfo](#SpawnInfo) - [SpawnParticlesInfo](#SpawnParticlesInfo) - [StarPositions](#StarPositions) +- [StarsNeededForDialog](#StarsNeededForDialog) - [Struct802A272C](#Struct802A272C) - [Surface](#Surface) - [TextureInfo](#TextureInfo) @@ -285,17 +286,25 @@ | Field | Type | Access | | ----- | ---- | ------ | +| KingBobombFVel | `number` | | +| KingBobombHealth | `integer` | | +| KingBobombYawVel | `integer` | | +| KingWhompHealth | `integer` | | | KoopaBobAgility | `number` | | | KoopaCatchupAgility | `number` | | | KoopaThiAgility | `number` | | +| MipsStar1Requirement | `integer` | | +| MipsStar2Requirement | `integer` | | | RacingPenguinBigHeight | `number` | | | RacingPenguinBigRadius | `number` | | | RacingPenguinHeight | `number` | | | RacingPenguinRadius | `number` | | +| ShowStarMilestones | `integer` | | | ToadStar1Requirement | `integer` | | | ToadStar2Requirement | `integer` | | | ToadStar3Requirement | `integer` | | | dialogs | [BehaviorDialogs](structs.md#BehaviorDialogs) | read-only | +| starsNeededForDialog | [StarsNeededForDialog](structs.md#StarsNeededForDialog) | read-only | | trajectories | [BehaviorTrajectories](structs.md#BehaviorTrajectories) | read-only | [:arrow_up_small:](#) @@ -1117,6 +1126,7 @@ | platform | [Object](structs.md#Object) | | | prevObj | [Object](structs.md#Object) | | | respawnInfoType | `integer` | | +| setHome | `integer` | | | unused1 | `integer` | | | usingObj | [Object](structs.md#Object) | | @@ -2077,6 +2087,21 @@
+## [StarsNeededForDialog](#StarsNeededForDialog) + +| Field | Type | Access | +| ----- | ---- | ------ | +| dialog1 | `integer` | | +| dialog2 | `integer` | | +| dialog3 | `integer` | | +| dialog4 | `integer` | | +| dialog5 | `integer` | | +| dialog6 | `integer` | | + +[:arrow_up_small:](#) + +
+ ## [Struct802A272C](#Struct802A272C) | Field | Type | Access | diff --git a/include/types.h b/include/types.h index c3f672237..932396b0d 100644 --- a/include/types.h +++ b/include/types.h @@ -221,6 +221,7 @@ struct Object /*?????*/ u8 globalPlayerIndex; /*?????*/ struct Object* usingObj; /*?????*/ u8 hookRender; + /*?????*/ u8 setHome; }; struct ObjectHitbox diff --git a/src/engine/behavior_script.c b/src/engine/behavior_script.c index 4426712ea..7e3e55e47 100644 --- a/src/engine/behavior_script.c +++ b/src/engine/behavior_script.c @@ -789,6 +789,7 @@ static s32 bhv_cmd_set_home(void) { gCurrentObject->oHomeX = gCurrentObject->oPosX; gCurrentObject->oHomeY = gCurrentObject->oPosY; gCurrentObject->oHomeZ = gCurrentObject->oPosZ; + gCurrentObject->setHome = TRUE; } gCurBhvCommand++; return BHV_PROC_CONTINUE; diff --git a/src/game/behaviors/king_bobomb.inc.c b/src/game/behaviors/king_bobomb.inc.c index 79fc75d7e..cfa649e37 100644 --- a/src/game/behaviors/king_bobomb.inc.c +++ b/src/game/behaviors/king_bobomb.inc.c @@ -56,7 +56,7 @@ void king_bobomb_act_0(void) { gSecondCameraFocus = o; cur_obj_init_animation_with_sound(5); cur_obj_set_pos_to_home(); - o->oHealth = 3; + o->oHealth = gBehaviorValues.KingBobombHealth; if (should_start_or_continue_dialog(marioState, o) && cur_obj_can_mario_activate_textbox_2(&gMarioStates[0], 500.0f, 100.0f)) { o->oSubAction++; seq_player_lower_volume(SEQ_PLAYER_LEVEL, 60, 40); @@ -93,11 +93,11 @@ void king_bobomb_act_2(void) { } else cur_obj_init_animation_with_sound(11); if (o->oKingBobombUnk108 == 0) { - o->oForwardVel = 3.0f; + o->oForwardVel = gBehaviorValues.KingBobombFVel; struct MarioState* marioState = king_bobomb_nearest_mario_state(); if (marioState != NULL) { s32 angleToPlayer = obj_angle_to_object(o, marioState->marioObj); - cur_obj_rotate_yaw_toward(angleToPlayer, 0x100); + cur_obj_rotate_yaw_toward(angleToPlayer, gBehaviorValues.KingBobombYawVel); } } else { o->oForwardVel = 0.0f; diff --git a/src/game/behaviors/mips.inc.c b/src/game/behaviors/mips.inc.c index 4817e897e..b46a9a62e 100644 --- a/src/game/behaviors/mips.inc.c +++ b/src/game/behaviors/mips.inc.c @@ -36,7 +36,7 @@ void bhv_mips_init(void) { u8 starFlags = save_file_get_star_flags(gCurrSaveFileNum - 1, -1); // If the player has >= 15 stars and hasn't collected first MIPS star... - if (save_file_get_total_star_count(gCurrSaveFileNum - 1, COURSE_MIN - 1, COURSE_MAX - 1) >= 15 + if (save_file_get_total_star_count(gCurrSaveFileNum - 1, COURSE_MIN - 1, COURSE_MAX - 1) >= gBehaviorValues.MipsStar1Requirement && !(starFlags & SAVE_FLAG_TO_STAR_FLAG(SAVE_FLAG_COLLECTED_MIPS_STAR_1))) { o->oBehParams2ndByte = 0; #ifndef VERSION_JP @@ -44,7 +44,7 @@ void bhv_mips_init(void) { #endif } // If the player has >= 50 stars and hasn't collected second MIPS star... - else if (save_file_get_total_star_count(gCurrSaveFileNum - 1, COURSE_MIN - 1, COURSE_MAX - 1) >= 50 + else if (save_file_get_total_star_count(gCurrSaveFileNum - 1, COURSE_MIN - 1, COURSE_MAX - 1) >= gBehaviorValues.MipsStar2Requirement && !(starFlags & SAVE_FLAG_TO_STAR_FLAG(SAVE_FLAG_COLLECTED_MIPS_STAR_2))) { o->oBehParams2ndByte = 1; #ifndef VERSION_JP diff --git a/src/game/behaviors/whomp.inc.c b/src/game/behaviors/whomp.inc.c index 0aee57c94..23544d595 100644 --- a/src/game/behaviors/whomp.inc.c +++ b/src/game/behaviors/whomp.inc.c @@ -32,7 +32,7 @@ void whomp_act_0(void) { seq_player_lower_volume(SEQ_PLAYER_LEVEL, 60, 40); } else { cur_obj_set_pos_to_home(); - o->oHealth = 3; + o->oHealth = gBehaviorValues.KingWhompHealth; } } else if (should_start_or_continue_dialog(marioState, o) && cur_obj_update_dialog_with_cutscene(&gMarioStates[0], 2, 1, CUTSCENE_DIALOG, gBehaviorValues.dialogs.KingWhompDialog, whomp_act_0_continue_dialog)) { o->oAction = 2; diff --git a/src/game/hardcoded.c b/src/game/hardcoded.c index 091a294b1..d7f153288 100644 --- a/src/game/hardcoded.c +++ b/src/game/hardcoded.c @@ -93,16 +93,24 @@ struct LevelValues gLevelValues = { 0 }; /////////////// struct BehaviorValues gDefaultBehaviorValues = { - .KoopaBobAgility = 4.0f, - .KoopaCatchupAgility = 8.0f, - .KoopaThiAgility = 6.0f, + .KoopaBobAgility = 4.0f, + .KoopaCatchupAgility = 8.0f, + .KoopaThiAgility = 6.0f, .RacingPenguinBigHeight = 250.0f, .RacingPenguinBigRadius = 350.0f, - .RacingPenguinHeight = 200.0f, - .RacingPenguinRadius = 200.0f, - .ToadStar1Requirement = 12, - .ToadStar2Requirement = 25, - .ToadStar3Requirement = 35, + .RacingPenguinHeight = 200.0f, + .RacingPenguinRadius = 200.0f, + .ToadStar1Requirement = 12, + .ToadStar2Requirement = 25, + .ToadStar3Requirement = 35, + .KingBobombFVel = 3.0f, + .KingBobombYawVel = 0x100, + .KingBobombHealth = 3, + .KingWhompHealth = 3, + .MipsStar1Requirement = 15, + .MipsStar2Requirement = 50, + .ShowStarMilestones = TRUE, + .starsNeededForDialog = { 1, 3, 8, 30, 50, 70 }, .dialogs = { .BobombBuddyBob1Dialog = DIALOG_004, .BobombBuddyBob2Dialog = DIALOG_105, diff --git a/src/game/hardcoded.h b/src/game/hardcoded.h index 1b8be2d80..c34ef365b 100644 --- a/src/game/hardcoded.h +++ b/src/game/hardcoded.h @@ -178,6 +178,16 @@ struct BehaviorDialogs { enum DialogId YoshiDialog; }; +#define STARS_NEEDED_FOR_DIALOG_COUNT 6 +struct StarsNeededForDialog { + u16 dialog1; + u16 dialog2; + u16 dialog3; + u16 dialog4; + u16 dialog5; + u16 dialog6; +}; + struct BehaviorValues { f32 KoopaBobAgility; f32 KoopaCatchupAgility; @@ -189,6 +199,14 @@ struct BehaviorValues { u16 ToadStar1Requirement; u16 ToadStar2Requirement; u16 ToadStar3Requirement; + f32 KingBobombFVel; + s16 KingBobombYawVel; + s16 KingBobombHealth; + s16 KingWhompHealth; + s16 MipsStar1Requirement; + s16 MipsStar2Requirement; + u8 ShowStarMilestones; + struct StarsNeededForDialog starsNeededForDialog; struct BehaviorDialogs dialogs; struct BehaviorTrajectories trajectories; }; diff --git a/src/game/interaction.c b/src/game/interaction.c index 4ba3e0cbf..e9cd6b3c8 100644 --- a/src/game/interaction.c +++ b/src/game/interaction.c @@ -480,7 +480,7 @@ u32 mario_check_object_grab(struct MarioState *m) { if (m->input & INPUT_INTERACT_OBJ_GRABBABLE) { script = virtual_to_segmented(0x13, m->interactObj->behavior); - if (script == bhvBowser) { + if (script == smlua_override_behavior(bhvBowser)) { s16 facingDYaw = m->faceAngle[1] - m->interactObj->oMoveAngleYaw; if (facingDYaw >= -0x5555 && facingDYaw <= 0x5555) { m->faceAngle[1] = m->interactObj->oMoveAngleYaw; @@ -2042,7 +2042,7 @@ u32 interact_grabbable(struct MarioState *m, u32 interactType, struct Object *o) } } - if (script != bhvBowser) { + if (script != smlua_override_behavior(bhvBowser)) { push_mario_out_of_object(m, o, -5.0f); } diff --git a/src/game/mario_actions_cutscene.c b/src/game/mario_actions_cutscene.c index 207eb3e56..a19aa1d7d 100644 --- a/src/game/mario_actions_cutscene.c +++ b/src/game/mario_actions_cutscene.c @@ -57,8 +57,6 @@ static s8 D_8032CBE4 = 0; static s8 D_8032CBE8 = 0; static s8 D_8032CBEC[7] = { 2, 3, 2, 1, 2, 3, 2 }; -static u8 sStarsNeededForDialog[] = { 1, 3, 8, 30, 50, 70 }; - static BehaviorScript* localDialogNPCBehavior = NULL; /** @@ -247,8 +245,19 @@ s32 get_star_collection_dialog(struct MarioState *m) { return dialogID; } - for (s32 i = 0; i < ARRAY_COUNT(sStarsNeededForDialog); i++) { - s32 numStarsRequired = sStarsNeededForDialog[i]; + if (!gBehaviorValues.ShowStarMilestones) { return 0; } + + for (s32 i = 0; i < STARS_NEEDED_FOR_DIALOG_COUNT; i++) { + s32 numStarsRequired = 999; + switch (i) { + case 0: numStarsRequired = gBehaviorValues.starsNeededForDialog.dialog1; break; + case 1: numStarsRequired = gBehaviorValues.starsNeededForDialog.dialog2; break; + case 2: numStarsRequired = gBehaviorValues.starsNeededForDialog.dialog3; break; + case 3: numStarsRequired = gBehaviorValues.starsNeededForDialog.dialog4; break; + case 4: numStarsRequired = gBehaviorValues.starsNeededForDialog.dialog5; break; + case 5: numStarsRequired = gBehaviorValues.starsNeededForDialog.dialog6; break; + } + if (m->prevNumStarsForDialog < numStarsRequired && m->numStars >= numStarsRequired) { dialogID = i + gBehaviorValues.dialogs.StarCollectionBaseDialog; break; diff --git a/src/game/object_helpers.c b/src/game/object_helpers.c index 49df0b635..93b57439a 100644 --- a/src/game/object_helpers.c +++ b/src/game/object_helpers.c @@ -27,6 +27,7 @@ #include "spawn_object.h" #include "spawn_sound.h" #include "pc/network/network.h" +#include "pc/lua/smlua_hooks.h" u8 (*gContinueDialogFunction)(void) = NULL; struct Object* gContinueDialogFunctionObject = NULL; @@ -117,7 +118,7 @@ Gfx *geo_update_layer_transparency(s32 callContext, struct GraphNode *node, UNUS } } #else // gDebugInfo accesses were removed in all non-JP versions. - if (objectOpacity == 0 && segmented_to_virtual(bhvBowser) == objectGraphNode->behavior) { + if (objectOpacity == 0 && segmented_to_virtual(smlua_override_behavior(bhvBowser)) == objectGraphNode->behavior) { objectGraphNode->oAnimState = 2; } // the debug info check was removed in US. so we need to @@ -982,6 +983,7 @@ struct Object* cur_obj_find_nearest_pole(void) { } struct Object *cur_obj_find_nearest_object_with_behavior(const BehaviorScript *behavior, f32 *dist) { + behavior = smlua_override_behavior(behavior); uintptr_t *behaviorAddr = segmented_to_virtual(behavior); struct Object *closestObj = NULL; struct Object *obj; @@ -1074,6 +1076,7 @@ s32 count_objects_with_behavior(const BehaviorScript *behavior) { } struct Object *find_object_with_behavior(const BehaviorScript *behavior) { + behavior = smlua_override_behavior(behavior); uintptr_t *behaviorAddr = segmented_to_virtual(behavior); struct ObjectNode *listHead = &gObjectLists[get_object_list_from_behavior(behaviorAddr)]; struct ObjectNode *obj = listHead->next; @@ -1269,7 +1272,7 @@ void cur_obj_move_after_thrown_or_dropped(f32 forwardVel, f32 velY) { } void cur_obj_get_thrown_or_placed(f32 forwardVel, f32 velY, s32 thrownAction) { - if (o->behavior == segmented_to_virtual(bhvBowser)) { + if (o->behavior == segmented_to_virtual(smlua_override_behavior(bhvBowser))) { // Interestingly, when bowser is thrown, he is offset slightly to // Mario's right cur_obj_set_pos_relative_to_parent(-41.684f, 85.859f, 321.577f); @@ -3180,3 +3183,11 @@ void cur_obj_spawn_star_at_y_offset(f32 targetX, f32 targetY, f32 targetZ, f32 o o->oPosY = objectPosY; } #endif + +void cur_obj_set_home_once(void) { + if (o->setHome) { return; } + o->setHome = TRUE; + o->oHomeX = o->oPosX; + o->oHomeY = o->oPosY; + o->oHomeZ = o->oPosZ; +} \ No newline at end of file diff --git a/src/game/object_helpers.h b/src/game/object_helpers.h index b6a656a99..1521997a4 100644 --- a/src/game/object_helpers.h +++ b/src/game/object_helpers.h @@ -313,4 +313,6 @@ f32 cur_obj_lateral_dist_from_obj_to_home(struct Object* obj); void cur_obj_spawn_star_at_y_offset(f32 targetX, f32 targetY, f32 targetZ, f32 offsetY); #endif +void cur_obj_set_home_once(void); + #endif // OBJECT_HELPERS_H diff --git a/src/game/object_list_processor.c b/src/game/object_list_processor.c index ca0919e68..95cc2e057 100644 --- a/src/game/object_list_processor.c +++ b/src/game/object_list_processor.c @@ -532,7 +532,7 @@ void spawn_objects_from_info(UNUSED s32 unused, struct SpawnInfo *spawnInfo) { // as it is the most frequently used by objects. object->oBehParams2ndByte = ((spawnInfo->behaviorArg) >> 16) & 0xFF; - object->behavior = script; + object->behavior = smlua_override_behavior(script); object->unused1 = 0; // Record death/collection in the SpawnInfo diff --git a/src/game/spawn_object.c b/src/game/spawn_object.c index fa3e098c4..6d3e2440f 100644 --- a/src/game/spawn_object.c +++ b/src/game/spawn_object.c @@ -326,6 +326,7 @@ struct Object *allocate_object(struct ObjectNode *objList) { obj->areaTimer = 0; obj->areaTimerDuration = 0; obj->areaTimerRunOnceCallback = NULL; + obj->setHome = FALSE; obj->usingObj = NULL; diff --git a/src/pc/lua/smlua_cobject_autogen.c b/src/pc/lua/smlua_cobject_autogen.c index 7025acb93..aac9fda7b 100644 --- a/src/pc/lua/smlua_cobject_autogen.c +++ b/src/pc/lua/smlua_cobject_autogen.c @@ -205,19 +205,27 @@ static struct LuaObjectField sBehaviorTrajectoriesFields[LUA_BEHAVIOR_TRAJECTORI { "UnagiTrajectory", LVT_TRAJECTORY_P, offsetof(struct BehaviorTrajectories, UnagiTrajectory), false, LOT_POINTER }, }; -#define LUA_BEHAVIOR_VALUES_FIELD_COUNT 12 +#define LUA_BEHAVIOR_VALUES_FIELD_COUNT 20 static struct LuaObjectField sBehaviorValuesFields[LUA_BEHAVIOR_VALUES_FIELD_COUNT] = { + { "KingBobombFVel", LVT_F32, offsetof(struct BehaviorValues, KingBobombFVel), false, LOT_NONE }, + { "KingBobombHealth", LVT_S16, offsetof(struct BehaviorValues, KingBobombHealth), false, LOT_NONE }, + { "KingBobombYawVel", LVT_S16, offsetof(struct BehaviorValues, KingBobombYawVel), false, LOT_NONE }, + { "KingWhompHealth", LVT_S16, offsetof(struct BehaviorValues, KingWhompHealth), false, LOT_NONE }, { "KoopaBobAgility", LVT_F32, offsetof(struct BehaviorValues, KoopaBobAgility), false, LOT_NONE }, { "KoopaCatchupAgility", LVT_F32, offsetof(struct BehaviorValues, KoopaCatchupAgility), false, LOT_NONE }, { "KoopaThiAgility", LVT_F32, offsetof(struct BehaviorValues, KoopaThiAgility), false, LOT_NONE }, + { "MipsStar1Requirement", LVT_S16, offsetof(struct BehaviorValues, MipsStar1Requirement), false, LOT_NONE }, + { "MipsStar2Requirement", LVT_S16, offsetof(struct BehaviorValues, MipsStar2Requirement), false, LOT_NONE }, { "RacingPenguinBigHeight", LVT_F32, offsetof(struct BehaviorValues, RacingPenguinBigHeight), false, LOT_NONE }, { "RacingPenguinBigRadius", LVT_F32, offsetof(struct BehaviorValues, RacingPenguinBigRadius), false, LOT_NONE }, { "RacingPenguinHeight", LVT_F32, offsetof(struct BehaviorValues, RacingPenguinHeight), false, LOT_NONE }, { "RacingPenguinRadius", LVT_F32, offsetof(struct BehaviorValues, RacingPenguinRadius), false, LOT_NONE }, + { "ShowStarMilestones", LVT_U8, offsetof(struct BehaviorValues, ShowStarMilestones), false, LOT_NONE }, { "ToadStar1Requirement", LVT_U16, offsetof(struct BehaviorValues, ToadStar1Requirement), false, LOT_NONE }, { "ToadStar2Requirement", LVT_U16, offsetof(struct BehaviorValues, ToadStar2Requirement), false, LOT_NONE }, { "ToadStar3Requirement", LVT_U16, offsetof(struct BehaviorValues, ToadStar3Requirement), false, LOT_NONE }, { "dialogs", LVT_COBJECT, offsetof(struct BehaviorValues, dialogs), true, LOT_BEHAVIORDIALOGS }, + { "starsNeededForDialog", LVT_COBJECT, offsetof(struct BehaviorValues, starsNeededForDialog), true, LOT_STARSNEEDEDFORDIALOG }, { "trajectories", LVT_COBJECT, offsetof(struct BehaviorValues, trajectories), true, LOT_BEHAVIORTRAJECTORIES }, }; @@ -885,7 +893,7 @@ static struct LuaObjectField sNetworkPlayerFields[LUA_NETWORK_PLAYER_FIELD_COUNT { "type", LVT_U8, offsetof(struct NetworkPlayer, type), true, LOT_NONE }, }; -#define LUA_OBJECT_FIELD_COUNT 754 +#define LUA_OBJECT_FIELD_COUNT 755 static struct LuaObjectField sObjectFields[LUA_OBJECT_FIELD_COUNT] = { { "activeFlags", LVT_S16, offsetof(struct Object, activeFlags), false, LOT_NONE }, { "areaTimer", LVT_U32, offsetof(struct Object, areaTimer), false, LOT_NONE }, @@ -1650,6 +1658,7 @@ static struct LuaObjectField sObjectFields[LUA_OBJECT_FIELD_COUNT] = { // { "rawData", LOT_???, offsetof(struct Object, rawData), false, LOT_??? }, <--- UNIMPLEMENTED // { "respawnInfo", LVT_???, offsetof(struct Object, respawnInfo), false, LOT_??? }, <--- UNIMPLEMENTED { "respawnInfoType", LVT_S16, offsetof(struct Object, respawnInfoType), false, LOT_NONE }, + { "setHome", LVT_U8, offsetof(struct Object, setHome), false, LOT_NONE }, // { "transform", LVT_???, offsetof(struct Object, transform), false, LOT_??? }, <--- UNIMPLEMENTED { "unused1", LVT_U32, offsetof(struct Object, unused1), false, LOT_NONE }, { "usingObj", LVT_COBJECT_P, offsetof(struct Object, usingObj), false, LOT_OBJECT }, @@ -1809,6 +1818,16 @@ static struct LuaObjectField sStarPositionsFields[LUA_STAR_POSITIONS_FIELD_COUNT { "WigglerStarPos", LVT_COBJECT, offsetof(struct StarPositions, WigglerStarPos), true, LOT_VEC3F }, }; +#define LUA_STARS_NEEDED_FOR_DIALOG_FIELD_COUNT 6 +static struct LuaObjectField sStarsNeededForDialogFields[LUA_STARS_NEEDED_FOR_DIALOG_FIELD_COUNT] = { + { "dialog1", LVT_U16, offsetof(struct StarsNeededForDialog, dialog1), false, LOT_NONE }, + { "dialog2", LVT_U16, offsetof(struct StarsNeededForDialog, dialog2), false, LOT_NONE }, + { "dialog3", LVT_U16, offsetof(struct StarsNeededForDialog, dialog3), false, LOT_NONE }, + { "dialog4", LVT_U16, offsetof(struct StarsNeededForDialog, dialog4), false, LOT_NONE }, + { "dialog5", LVT_U16, offsetof(struct StarsNeededForDialog, dialog5), false, LOT_NONE }, + { "dialog6", LVT_U16, offsetof(struct StarsNeededForDialog, dialog6), false, LOT_NONE }, +}; + #define LUA_STRUCT802_A272_C_FIELD_COUNT 2 static struct LuaObjectField sStruct802A272CFields[LUA_STRUCT802_A272_C_FIELD_COUNT] = { { "vecF", LVT_COBJECT, offsetof(struct Struct802A272C, vecF), true, LOT_VEC3F }, @@ -1984,6 +2003,7 @@ struct LuaObjectTable sLuaObjectAutogenTable[LOT_AUTOGEN_MAX - LOT_AUTOGEN_MIN] { LOT_SPAWNINFO, sSpawnInfoFields, LUA_SPAWN_INFO_FIELD_COUNT }, { LOT_SPAWNPARTICLESINFO, sSpawnParticlesInfoFields, LUA_SPAWN_PARTICLES_INFO_FIELD_COUNT }, { LOT_STARPOSITIONS, sStarPositionsFields, LUA_STAR_POSITIONS_FIELD_COUNT }, + { LOT_STARSNEEDEDFORDIALOG, sStarsNeededForDialogFields, LUA_STARS_NEEDED_FOR_DIALOG_FIELD_COUNT }, { LOT_STRUCT802A272C, sStruct802A272CFields, LUA_STRUCT802_A272_C_FIELD_COUNT }, { LOT_SURFACE, sSurfaceFields, LUA_SURFACE_FIELD_COUNT }, { LOT_TEXTUREINFO, sTextureInfoFields, LUA_TEXTURE_INFO_FIELD_COUNT }, diff --git a/src/pc/lua/smlua_cobject_autogen.h b/src/pc/lua/smlua_cobject_autogen.h index c027c6eeb..7581587cd 100644 --- a/src/pc/lua/smlua_cobject_autogen.h +++ b/src/pc/lua/smlua_cobject_autogen.h @@ -56,6 +56,7 @@ enum LuaObjectAutogenType { LOT_SPAWNINFO, LOT_SPAWNPARTICLESINFO, LOT_STARPOSITIONS, + LOT_STARSNEEDEDFORDIALOG, LOT_STRUCT802A272C, LOT_SURFACE, LOT_TEXTUREINFO, diff --git a/src/pc/lua/smlua_functions_autogen.c b/src/pc/lua/smlua_functions_autogen.c index 35598f990..a75fffb6d 100644 --- a/src/pc/lua/smlua_functions_autogen.c +++ b/src/pc/lua/smlua_functions_autogen.c @@ -12872,6 +12872,16 @@ int smlua_func_cur_obj_set_hitbox_radius_and_height(lua_State* L) { return 1; } +int smlua_func_cur_obj_set_home_once(UNUSED lua_State* L) { + if(!smlua_functions_valid_param_count(L, 0)) { return 0; } + + + extern void cur_obj_set_home_once(void); + cur_obj_set_home_once(); + + return 1; +} + int smlua_func_cur_obj_set_hurtbox_radius_and_height(lua_State* L) { if(!smlua_functions_valid_param_count(L, 2)) { return 0; } @@ -17664,6 +17674,7 @@ void smlua_bind_functions_autogen(void) { smlua_bind_function(L, "cur_obj_set_face_angle_to_move_angle", smlua_func_cur_obj_set_face_angle_to_move_angle); smlua_bind_function(L, "cur_obj_set_hitbox_and_die_if_attacked", smlua_func_cur_obj_set_hitbox_and_die_if_attacked); smlua_bind_function(L, "cur_obj_set_hitbox_radius_and_height", smlua_func_cur_obj_set_hitbox_radius_and_height); + smlua_bind_function(L, "cur_obj_set_home_once", smlua_func_cur_obj_set_home_once); smlua_bind_function(L, "cur_obj_set_hurtbox_radius_and_height", smlua_func_cur_obj_set_hurtbox_radius_and_height); smlua_bind_function(L, "cur_obj_set_pos_relative", smlua_func_cur_obj_set_pos_relative); smlua_bind_function(L, "cur_obj_set_pos_relative_to_parent", smlua_func_cur_obj_set_pos_relative_to_parent);