From e40fe57860e2fe74a9e016c248e4a5a0c451e1f4 Mon Sep 17 00:00:00 2001 From: MysterD Date: Thu, 2 Jun 2022 19:45:01 -0700 Subject: [PATCH] Unhardcoded more bowling ball values --- autogen/lua_definitions/structs.lua | 2 + docs/lua/structs.md | 2 + src/game/behaviors/bowling_ball.inc.c | 18 ++++---- src/game/hardcoded.c | 66 +++++++++++++++------------ src/game/hardcoded.h | 2 + src/pc/lua/smlua_cobject_autogen.c | 60 ++++++++++++------------ 6 files changed, 84 insertions(+), 66 deletions(-) diff --git a/autogen/lua_definitions/structs.lua b/autogen/lua_definitions/structs.lua index 8adf88bac..78988ba96 100644 --- a/autogen/lua_definitions/structs.lua +++ b/autogen/lua_definitions/structs.lua @@ -139,6 +139,8 @@ --- @class BehaviorTrajectories --- @field public BowlingBallBob2Trajectory Pointer_Trajectory --- @field public BowlingBallBobTrajectory Pointer_Trajectory +--- @field public BowlingBallThiLargeTrajectory Pointer_Trajectory +--- @field public BowlingBallThiSmallTrajectory Pointer_Trajectory --- @field public BowlingBallTtmTrajectory Pointer_Trajectory --- @field public KoopaBobTrajectory Pointer_Trajectory --- @field public KoopaThiTrajectory Pointer_Trajectory diff --git a/docs/lua/structs.md b/docs/lua/structs.md index 3b30af210..ab67c1f19 100644 --- a/docs/lua/structs.md +++ b/docs/lua/structs.md @@ -251,6 +251,8 @@ | ----- | ---- | ------ | | BowlingBallBob2Trajectory | `Pointer` <`Trajectory`> | | | BowlingBallBobTrajectory | `Pointer` <`Trajectory`> | | +| BowlingBallThiLargeTrajectory | `Pointer` <`Trajectory`> | | +| BowlingBallThiSmallTrajectory | `Pointer` <`Trajectory`> | | | BowlingBallTtmTrajectory | `Pointer` <`Trajectory`> | | | KoopaBobTrajectory | `Pointer` <`Trajectory`> | | | KoopaThiTrajectory | `Pointer` <`Trajectory`> | | diff --git a/src/game/behaviors/bowling_ball.inc.c b/src/game/behaviors/bowling_ball.inc.c index 024a46273..6ec3fc5f5 100644 --- a/src/game/behaviors/bowling_ball.inc.c +++ b/src/game/behaviors/bowling_ball.inc.c @@ -12,7 +12,7 @@ static struct ObjectHitbox sBowlingBallHitbox = { /* hurtboxHeight: */ 0, }; -static Trajectory sThiHugeMetalBallTraj[] = { +Trajectory sThiHugeMetalBallTraj[] = { TRAJECTORY_POS(0, /*pos*/ -4786, 101, -2166), TRAJECTORY_POS(1, /*pos*/ -5000, 81, -2753), TRAJECTORY_POS(2, /*pos*/ -5040, 33, -3846), @@ -26,7 +26,7 @@ static Trajectory sThiHugeMetalBallTraj[] = { TRAJECTORY_END(), }; -static Trajectory sThiTinyMetalBallTraj[] = { +Trajectory sThiTinyMetalBallTraj[] = { TRAJECTORY_POS(0, /*pos*/ -1476, 29, -680), TRAJECTORY_POS(1, /*pos*/ -1492, 14, -1072), TRAJECTORY_POS(2, /*pos*/ -1500, 3, -1331), @@ -67,11 +67,11 @@ void bowling_ball_set_waypoints(void) { break; case BBALL_BP_STYPE_THI_LARGE: - o->oPathedStartWaypoint = (struct Waypoint *) sThiHugeMetalBallTraj; + o->oPathedStartWaypoint = segmented_to_virtual(gBehaviorValues.trajectories.BowlingBallThiLargeTrajectory); break; case BBALL_BP_STYPE_THI_SMALL: - o->oPathedStartWaypoint = (struct Waypoint *) sThiTinyMetalBallTraj; + o->oPathedStartWaypoint = segmented_to_virtual(gBehaviorValues.trajectories.BowlingBallThiSmallTrajectory); break; } } @@ -117,23 +117,23 @@ void bhv_bowling_ball_initializeLoop(void) { switch (o->oBehParams2ndByte) { case BBALL_BP_STYPE_BOB_UPPER: - o->oForwardVel = 20.0f; + o->oForwardVel = gBehaviorValues.BowlingBallBobSpeed; break; case BBALL_BP_STYPE_TTM: - o->oForwardVel = 10.0f; + o->oForwardVel = gBehaviorValues.BowlingBallTtmSpeed; break; case BBALL_BP_STYPE_BOB_LOWER: - o->oForwardVel = 20.0f; + o->oForwardVel = gBehaviorValues.BowlingBallBob2Speed; break; case BBALL_BP_STYPE_THI_LARGE: - o->oForwardVel = 25.0f; + o->oForwardVel = gBehaviorValues.BowlingBallThiLargeSpeed; break; case BBALL_BP_STYPE_THI_SMALL: - o->oForwardVel = 10.0f; + o->oForwardVel = gBehaviorValues.BowlingBallThiSmallSpeed; cur_obj_scale(0.3f); o->oGraphYOffset = 39.0f; break; diff --git a/src/game/hardcoded.c b/src/game/hardcoded.c index d7f153288..d7d50e091 100644 --- a/src/game/hardcoded.c +++ b/src/game/hardcoded.c @@ -33,6 +33,9 @@ #include "levels/wf/header.h" #include "levels/wmotr/header.h" +extern Trajectory sThiHugeMetalBallTraj[]; +extern Trajectory sThiTinyMetalBallTraj[]; + //////////// // Levels // //////////// @@ -109,6 +112,11 @@ struct BehaviorValues gDefaultBehaviorValues = { .KingWhompHealth = 3, .MipsStar1Requirement = 15, .MipsStar2Requirement = 50, + .BowlingBallBobSpeed = 20.0f, + .BowlingBallBob2Speed = 10.0f, + .BowlingBallTtmSpeed = 20.0f, + .BowlingBallThiLargeSpeed = 25.0f, + .BowlingBallThiSmallSpeed = 10.0f, .ShowStarMilestones = TRUE, .starsNeededForDialog = { 1, 3, 8, 30, 50, 70 }, .dialogs = { @@ -198,34 +206,36 @@ struct BehaviorValues gDefaultBehaviorValues = { .YoshiDialog = DIALOG_161, }, .trajectories = { - .KoopaBobTrajectory = (Trajectory*) bob_seg7_trajectory_koopa, - .KoopaThiTrajectory = (Trajectory*) thi_seg7_trajectory_koopa, - .UnagiTrajectory = (Trajectory*) jrb_seg7_trajectory_unagi_1, - .Unagi2Trajectory = (Trajectory*) jrb_seg7_trajectory_unagi_2, - .SnowmanHeadTrajectory = (Trajectory*) ccm_seg7_trajectory_snowman, - .RacingPenguinTrajectory = (Trajectory*) ccm_seg7_trajectory_penguin_race, - .BowlingBallBobTrajectory = (Trajectory*) bob_seg7_metal_ball_path0, - .BowlingBallBob2Trajectory = (Trajectory*) bob_seg7_metal_ball_path1, - .BowlingBallTtmTrajectory = (Trajectory*) ttm_seg7_trajectory_070170A0, - .MipsTrajectory = (Trajectory*) inside_castle_seg7_trajectory_mips_0, - .Mips2Trajectory = (Trajectory*) inside_castle_seg7_trajectory_mips_1, - .Mips3Trajectory = (Trajectory*) inside_castle_seg7_trajectory_mips_2, - .Mips4Trajectory = (Trajectory*) inside_castle_seg7_trajectory_mips_3, - .Mips5Trajectory = (Trajectory*) inside_castle_seg7_trajectory_mips_4, - .Mips6Trajectory = (Trajectory*) inside_castle_seg7_trajectory_mips_5, - .Mips7Trajectory = (Trajectory*) inside_castle_seg7_trajectory_mips_6, - .Mips8Trajectory = (Trajectory*) inside_castle_seg7_trajectory_mips_7, - .Mips9Trajectory = (Trajectory*) inside_castle_seg7_trajectory_mips_8, - .Mips10Trajectory = (Trajectory*) inside_castle_seg7_trajectory_mips_9, - .PlatformRrTrajectory = (Trajectory*) rr_seg7_trajectory_0702EC3C, - .PlatformRr2Trajectory = (Trajectory*) rr_seg7_trajectory_0702ECC0, - .PlatformRr3Trajectory = (Trajectory*) rr_seg7_trajectory_0702ED9C, - .PlatformRr4Trajectory = (Trajectory*) rr_seg7_trajectory_0702EEE0, - .PlatformCcmTrajectory = (Trajectory*) ccm_seg7_trajectory_0701669C, - .PlatformBitfsTrajectory = (Trajectory*) bitfs_seg7_trajectory_070159AC, - .PlatformHmcTrajectory = (Trajectory*) hmc_seg7_trajectory_0702B86C, - .PlatformLllTrajectory = (Trajectory*) lll_seg7_trajectory_0702856C, - .PlatformLll2Trajectory = (Trajectory*) lll_seg7_trajectory_07028660, + .KoopaBobTrajectory = (Trajectory*) bob_seg7_trajectory_koopa, + .KoopaThiTrajectory = (Trajectory*) thi_seg7_trajectory_koopa, + .UnagiTrajectory = (Trajectory*) jrb_seg7_trajectory_unagi_1, + .Unagi2Trajectory = (Trajectory*) jrb_seg7_trajectory_unagi_2, + .SnowmanHeadTrajectory = (Trajectory*) ccm_seg7_trajectory_snowman, + .RacingPenguinTrajectory = (Trajectory*) ccm_seg7_trajectory_penguin_race, + .BowlingBallBobTrajectory = (Trajectory*) bob_seg7_metal_ball_path0, + .BowlingBallBob2Trajectory = (Trajectory*) bob_seg7_metal_ball_path1, + .BowlingBallTtmTrajectory = (Trajectory*) ttm_seg7_trajectory_070170A0, + .BowlingBallThiLargeTrajectory = (Trajectory*) sThiHugeMetalBallTraj, + .BowlingBallThiSmallTrajectory = (Trajectory*) sThiTinyMetalBallTraj, + .MipsTrajectory = (Trajectory*) inside_castle_seg7_trajectory_mips_0, + .Mips2Trajectory = (Trajectory*) inside_castle_seg7_trajectory_mips_1, + .Mips3Trajectory = (Trajectory*) inside_castle_seg7_trajectory_mips_2, + .Mips4Trajectory = (Trajectory*) inside_castle_seg7_trajectory_mips_3, + .Mips5Trajectory = (Trajectory*) inside_castle_seg7_trajectory_mips_4, + .Mips6Trajectory = (Trajectory*) inside_castle_seg7_trajectory_mips_5, + .Mips7Trajectory = (Trajectory*) inside_castle_seg7_trajectory_mips_6, + .Mips8Trajectory = (Trajectory*) inside_castle_seg7_trajectory_mips_7, + .Mips9Trajectory = (Trajectory*) inside_castle_seg7_trajectory_mips_8, + .Mips10Trajectory = (Trajectory*) inside_castle_seg7_trajectory_mips_9, + .PlatformRrTrajectory = (Trajectory*) rr_seg7_trajectory_0702EC3C, + .PlatformRr2Trajectory = (Trajectory*) rr_seg7_trajectory_0702ECC0, + .PlatformRr3Trajectory = (Trajectory*) rr_seg7_trajectory_0702ED9C, + .PlatformRr4Trajectory = (Trajectory*) rr_seg7_trajectory_0702EEE0, + .PlatformCcmTrajectory = (Trajectory*) ccm_seg7_trajectory_0701669C, + .PlatformBitfsTrajectory = (Trajectory*) bitfs_seg7_trajectory_070159AC, + .PlatformHmcTrajectory = (Trajectory*) hmc_seg7_trajectory_0702B86C, + .PlatformLllTrajectory = (Trajectory*) lll_seg7_trajectory_0702856C, + .PlatformLll2Trajectory = (Trajectory*) lll_seg7_trajectory_07028660, }, }; diff --git a/src/game/hardcoded.h b/src/game/hardcoded.h index c34ef365b..8a512b9ab 100644 --- a/src/game/hardcoded.h +++ b/src/game/hardcoded.h @@ -70,6 +70,8 @@ struct BehaviorTrajectories { Trajectory* BowlingBallBobTrajectory; Trajectory* BowlingBallBob2Trajectory; Trajectory* BowlingBallTtmTrajectory; + Trajectory* BowlingBallThiLargeTrajectory; + Trajectory* BowlingBallThiSmallTrajectory; Trajectory* MipsTrajectory; Trajectory* Mips2Trajectory; Trajectory* Mips3Trajectory; diff --git a/src/pc/lua/smlua_cobject_autogen.c b/src/pc/lua/smlua_cobject_autogen.c index d4a4204f3..34874401a 100644 --- a/src/pc/lua/smlua_cobject_autogen.c +++ b/src/pc/lua/smlua_cobject_autogen.c @@ -173,36 +173,38 @@ static struct LuaObjectField sBehaviorDialogsFields[LUA_BEHAVIOR_DIALOGS_FIELD_C { "YoshiDialog", LVT_S32, offsetof(struct BehaviorDialogs, YoshiDialog), false, LOT_NONE }, }; -#define LUA_BEHAVIOR_TRAJECTORIES_FIELD_COUNT 28 +#define LUA_BEHAVIOR_TRAJECTORIES_FIELD_COUNT 30 static struct LuaObjectField sBehaviorTrajectoriesFields[LUA_BEHAVIOR_TRAJECTORIES_FIELD_COUNT] = { - { "BowlingBallBob2Trajectory", LVT_TRAJECTORY_P, offsetof(struct BehaviorTrajectories, BowlingBallBob2Trajectory), false, LOT_POINTER }, - { "BowlingBallBobTrajectory", LVT_TRAJECTORY_P, offsetof(struct BehaviorTrajectories, BowlingBallBobTrajectory), false, LOT_POINTER }, - { "BowlingBallTtmTrajectory", LVT_TRAJECTORY_P, offsetof(struct BehaviorTrajectories, BowlingBallTtmTrajectory), false, LOT_POINTER }, - { "KoopaBobTrajectory", LVT_TRAJECTORY_P, offsetof(struct BehaviorTrajectories, KoopaBobTrajectory), false, LOT_POINTER }, - { "KoopaThiTrajectory", LVT_TRAJECTORY_P, offsetof(struct BehaviorTrajectories, KoopaThiTrajectory), false, LOT_POINTER }, - { "Mips10Trajectory", LVT_TRAJECTORY_P, offsetof(struct BehaviorTrajectories, Mips10Trajectory), false, LOT_POINTER }, - { "Mips2Trajectory", LVT_TRAJECTORY_P, offsetof(struct BehaviorTrajectories, Mips2Trajectory), false, LOT_POINTER }, - { "Mips3Trajectory", LVT_TRAJECTORY_P, offsetof(struct BehaviorTrajectories, Mips3Trajectory), false, LOT_POINTER }, - { "Mips4Trajectory", LVT_TRAJECTORY_P, offsetof(struct BehaviorTrajectories, Mips4Trajectory), false, LOT_POINTER }, - { "Mips5Trajectory", LVT_TRAJECTORY_P, offsetof(struct BehaviorTrajectories, Mips5Trajectory), false, LOT_POINTER }, - { "Mips6Trajectory", LVT_TRAJECTORY_P, offsetof(struct BehaviorTrajectories, Mips6Trajectory), false, LOT_POINTER }, - { "Mips7Trajectory", LVT_TRAJECTORY_P, offsetof(struct BehaviorTrajectories, Mips7Trajectory), false, LOT_POINTER }, - { "Mips8Trajectory", LVT_TRAJECTORY_P, offsetof(struct BehaviorTrajectories, Mips8Trajectory), false, LOT_POINTER }, - { "Mips9Trajectory", LVT_TRAJECTORY_P, offsetof(struct BehaviorTrajectories, Mips9Trajectory), false, LOT_POINTER }, - { "MipsTrajectory", LVT_TRAJECTORY_P, offsetof(struct BehaviorTrajectories, MipsTrajectory), false, LOT_POINTER }, - { "PlatformBitfsTrajectory", LVT_TRAJECTORY_P, offsetof(struct BehaviorTrajectories, PlatformBitfsTrajectory), false, LOT_POINTER }, - { "PlatformCcmTrajectory", LVT_TRAJECTORY_P, offsetof(struct BehaviorTrajectories, PlatformCcmTrajectory), false, LOT_POINTER }, - { "PlatformHmcTrajectory", LVT_TRAJECTORY_P, offsetof(struct BehaviorTrajectories, PlatformHmcTrajectory), false, LOT_POINTER }, - { "PlatformLll2Trajectory", LVT_TRAJECTORY_P, offsetof(struct BehaviorTrajectories, PlatformLll2Trajectory), false, LOT_POINTER }, - { "PlatformLllTrajectory", LVT_TRAJECTORY_P, offsetof(struct BehaviorTrajectories, PlatformLllTrajectory), false, LOT_POINTER }, - { "PlatformRr2Trajectory", LVT_TRAJECTORY_P, offsetof(struct BehaviorTrajectories, PlatformRr2Trajectory), false, LOT_POINTER }, - { "PlatformRr3Trajectory", LVT_TRAJECTORY_P, offsetof(struct BehaviorTrajectories, PlatformRr3Trajectory), false, LOT_POINTER }, - { "PlatformRr4Trajectory", LVT_TRAJECTORY_P, offsetof(struct BehaviorTrajectories, PlatformRr4Trajectory), false, LOT_POINTER }, - { "PlatformRrTrajectory", LVT_TRAJECTORY_P, offsetof(struct BehaviorTrajectories, PlatformRrTrajectory), false, LOT_POINTER }, - { "RacingPenguinTrajectory", LVT_TRAJECTORY_P, offsetof(struct BehaviorTrajectories, RacingPenguinTrajectory), false, LOT_POINTER }, - { "SnowmanHeadTrajectory", LVT_TRAJECTORY_P, offsetof(struct BehaviorTrajectories, SnowmanHeadTrajectory), false, LOT_POINTER }, - { "Unagi2Trajectory", LVT_TRAJECTORY_P, offsetof(struct BehaviorTrajectories, Unagi2Trajectory), false, LOT_POINTER }, - { "UnagiTrajectory", LVT_TRAJECTORY_P, offsetof(struct BehaviorTrajectories, UnagiTrajectory), false, LOT_POINTER }, + { "BowlingBallBob2Trajectory", LVT_TRAJECTORY_P, offsetof(struct BehaviorTrajectories, BowlingBallBob2Trajectory), false, LOT_POINTER }, + { "BowlingBallBobTrajectory", LVT_TRAJECTORY_P, offsetof(struct BehaviorTrajectories, BowlingBallBobTrajectory), false, LOT_POINTER }, + { "BowlingBallThiLargeTrajectory", LVT_TRAJECTORY_P, offsetof(struct BehaviorTrajectories, BowlingBallThiLargeTrajectory), false, LOT_POINTER }, + { "BowlingBallThiSmallTrajectory", LVT_TRAJECTORY_P, offsetof(struct BehaviorTrajectories, BowlingBallThiSmallTrajectory), false, LOT_POINTER }, + { "BowlingBallTtmTrajectory", LVT_TRAJECTORY_P, offsetof(struct BehaviorTrajectories, BowlingBallTtmTrajectory), false, LOT_POINTER }, + { "KoopaBobTrajectory", LVT_TRAJECTORY_P, offsetof(struct BehaviorTrajectories, KoopaBobTrajectory), false, LOT_POINTER }, + { "KoopaThiTrajectory", LVT_TRAJECTORY_P, offsetof(struct BehaviorTrajectories, KoopaThiTrajectory), false, LOT_POINTER }, + { "Mips10Trajectory", LVT_TRAJECTORY_P, offsetof(struct BehaviorTrajectories, Mips10Trajectory), false, LOT_POINTER }, + { "Mips2Trajectory", LVT_TRAJECTORY_P, offsetof(struct BehaviorTrajectories, Mips2Trajectory), false, LOT_POINTER }, + { "Mips3Trajectory", LVT_TRAJECTORY_P, offsetof(struct BehaviorTrajectories, Mips3Trajectory), false, LOT_POINTER }, + { "Mips4Trajectory", LVT_TRAJECTORY_P, offsetof(struct BehaviorTrajectories, Mips4Trajectory), false, LOT_POINTER }, + { "Mips5Trajectory", LVT_TRAJECTORY_P, offsetof(struct BehaviorTrajectories, Mips5Trajectory), false, LOT_POINTER }, + { "Mips6Trajectory", LVT_TRAJECTORY_P, offsetof(struct BehaviorTrajectories, Mips6Trajectory), false, LOT_POINTER }, + { "Mips7Trajectory", LVT_TRAJECTORY_P, offsetof(struct BehaviorTrajectories, Mips7Trajectory), false, LOT_POINTER }, + { "Mips8Trajectory", LVT_TRAJECTORY_P, offsetof(struct BehaviorTrajectories, Mips8Trajectory), false, LOT_POINTER }, + { "Mips9Trajectory", LVT_TRAJECTORY_P, offsetof(struct BehaviorTrajectories, Mips9Trajectory), false, LOT_POINTER }, + { "MipsTrajectory", LVT_TRAJECTORY_P, offsetof(struct BehaviorTrajectories, MipsTrajectory), false, LOT_POINTER }, + { "PlatformBitfsTrajectory", LVT_TRAJECTORY_P, offsetof(struct BehaviorTrajectories, PlatformBitfsTrajectory), false, LOT_POINTER }, + { "PlatformCcmTrajectory", LVT_TRAJECTORY_P, offsetof(struct BehaviorTrajectories, PlatformCcmTrajectory), false, LOT_POINTER }, + { "PlatformHmcTrajectory", LVT_TRAJECTORY_P, offsetof(struct BehaviorTrajectories, PlatformHmcTrajectory), false, LOT_POINTER }, + { "PlatformLll2Trajectory", LVT_TRAJECTORY_P, offsetof(struct BehaviorTrajectories, PlatformLll2Trajectory), false, LOT_POINTER }, + { "PlatformLllTrajectory", LVT_TRAJECTORY_P, offsetof(struct BehaviorTrajectories, PlatformLllTrajectory), false, LOT_POINTER }, + { "PlatformRr2Trajectory", LVT_TRAJECTORY_P, offsetof(struct BehaviorTrajectories, PlatformRr2Trajectory), false, LOT_POINTER }, + { "PlatformRr3Trajectory", LVT_TRAJECTORY_P, offsetof(struct BehaviorTrajectories, PlatformRr3Trajectory), false, LOT_POINTER }, + { "PlatformRr4Trajectory", LVT_TRAJECTORY_P, offsetof(struct BehaviorTrajectories, PlatformRr4Trajectory), false, LOT_POINTER }, + { "PlatformRrTrajectory", LVT_TRAJECTORY_P, offsetof(struct BehaviorTrajectories, PlatformRrTrajectory), false, LOT_POINTER }, + { "RacingPenguinTrajectory", LVT_TRAJECTORY_P, offsetof(struct BehaviorTrajectories, RacingPenguinTrajectory), false, LOT_POINTER }, + { "SnowmanHeadTrajectory", LVT_TRAJECTORY_P, offsetof(struct BehaviorTrajectories, SnowmanHeadTrajectory), false, LOT_POINTER }, + { "Unagi2Trajectory", LVT_TRAJECTORY_P, offsetof(struct BehaviorTrajectories, Unagi2Trajectory), false, LOT_POINTER }, + { "UnagiTrajectory", LVT_TRAJECTORY_P, offsetof(struct BehaviorTrajectories, UnagiTrajectory), false, LOT_POINTER }, }; #define LUA_BEHAVIOR_VALUES_FIELD_COUNT 20