From f10955b78583a69efad81a5e67ae389fcb038d2b Mon Sep 17 00:00:00 2001 From: Arceveti <73617174+Arceveti@users.noreply.github.com> Date: Wed, 29 Sep 2021 10:10:14 -0700 Subject: [PATCH] Move some structs/data into proper behavior files --- src/game/behavior_actions.c | 42 ------------------- src/game/behaviors/boo.inc.c | 5 +++ src/game/behaviors/capswitch.inc.c | 8 +++- .../behaviors/checkerboard_platform.inc.c | 6 +++ src/game/behaviors/exclamation_box.inc.c | 8 ++++ src/game/behaviors/grill_door.inc.c | 6 +++ src/game/behaviors/rotating_platform.inc.c | 7 ++++ src/game/behaviors/tumbling_bridge.inc.c | 8 ++++ 8 files changed, 46 insertions(+), 44 deletions(-) diff --git a/src/game/behavior_actions.c b/src/game/behavior_actions.c index 62942ccc..acdc3203 100644 --- a/src/game/behavior_actions.c +++ b/src/game/behavior_actions.c @@ -46,48 +46,6 @@ #include "rumble_init.h" #include "puppylights.h" -struct WFRotatingPlatformData { - s16 pad; - s16 scale; - const Collision *collisionData; - s16 collisionDistance; -}; - -struct TumblingBridgeParams { - s16 numBridgeSections; - s16 bridgeRelativeStartingXorZ; - s16 platformWidth; - ModelID16 model; - const void *segAddr; -}; - -struct ExclamationBoxContents { - u8 id; - u8 unk1; - u8 behParams; - ModelID16 model; - const BehaviorScript *behavior; -}; - -struct CheckerBoardPlatformInitPosition { - s32 relPosZ; - Vec3f scale; - f32 radius; -}; - -struct OpenableGrill { - s16 halfWidth; - ModelID16 modelID; - const Collision *collision; -}; - -static s32 sCapSaveFlags[] = { SAVE_FLAG_HAVE_WING_CAP, SAVE_FLAG_HAVE_METAL_CAP, SAVE_FLAG_HAVE_VANISH_CAP }; - -// Boo Roll -static s16 sBooHitRotations[] = { 6047, 5664, 5292, 4934, 4587, 4254, 3933, 3624, 3329, 3046, 2775, - 2517, 2271, 2039, 1818, 1611, 1416, 1233, 1063, 906, 761, 629, - 509, 402, 308, 226, 157, 100, 56, 25, 4, 0 }; - #include "behaviors/star_door.inc.c" #include "behaviors/mr_i.inc.c" #include "behaviors/pole.inc.c" diff --git a/src/game/behaviors/boo.inc.c b/src/game/behaviors/boo.inc.c index 6509da94..8b00220e 100644 --- a/src/game/behaviors/boo.inc.c +++ b/src/game/behaviors/boo.inc.c @@ -186,6 +186,11 @@ static void boo_set_move_yaw_for_during_hit(s32 hurt) { } } +// Boo Roll +static s16 sBooHitRotations[] = { 6047, 5664, 5292, 4934, 4587, 4254, 3933, 3624, 3329, 3046, 2775, + 2517, 2271, 2039, 1818, 1611, 1416, 1233, 1063, 906, 761, 629, + 509, 402, 308, 226, 157, 100, 56, 25, 4, 0 }; + static void boo_move_during_hit(s32 roll, f32 fVel) { // Boos seem to have been supposed to oscillate up then down then back again // when hit. However it seems the programmers forgot to scale the cosine, diff --git a/src/game/behaviors/capswitch.inc.c b/src/game/behaviors/capswitch.inc.c index f3504522..d79f8970 100644 --- a/src/game/behaviors/capswitch.inc.c +++ b/src/game/behaviors/capswitch.inc.c @@ -1,5 +1,7 @@ // capswitch.c.inc +static s32 sCapSaveFlags[] = { SAVE_FLAG_HAVE_WING_CAP, SAVE_FLAG_HAVE_METAL_CAP, SAVE_FLAG_HAVE_VANISH_CAP }; + void cap_switch_act_0(void) { o->oAnimState = o->oBehParams2ndByte; cur_obj_scale(0.5f); @@ -9,10 +11,12 @@ void cap_switch_act_0(void) { if (save_file_get_flags() & sCapSaveFlags[o->oBehParams2ndByte]) { o->oAction = 3; o->header.gfx.scale[1] = 0.1f; - } else + } else { o->oAction = 1; - } else + } + } else { o->oAction = 1; + } } void cap_switch_act_1(void) { diff --git a/src/game/behaviors/checkerboard_platform.inc.c b/src/game/behaviors/checkerboard_platform.inc.c index c7fd8798..b7c22ae8 100644 --- a/src/game/behaviors/checkerboard_platform.inc.c +++ b/src/game/behaviors/checkerboard_platform.inc.c @@ -1,5 +1,11 @@ // checkerboard_platform.c.inc +struct CheckerBoardPlatformInitPosition { + s32 relPosZ; + Vec3f scale; + f32 radius; +}; + struct CheckerBoardPlatformInitPosition sCheckerBoardPlatformInitPositions[] = { { 145, { 0.7f, 1.5f, 0.7f }, 7.0f }, { 235, { 1.2f, 2.0f, 1.2f }, 11.6f } }; diff --git a/src/game/behaviors/exclamation_box.inc.c b/src/game/behaviors/exclamation_box.inc.c index 547b4fcd..da33945d 100644 --- a/src/game/behaviors/exclamation_box.inc.c +++ b/src/game/behaviors/exclamation_box.inc.c @@ -1,5 +1,13 @@ // exclamation_box.c.inc +struct ExclamationBoxContents { + u8 id; + u8 unk1; + u8 behParams; + ModelID16 model; + const BehaviorScript *behavior; +}; + struct ObjectHitbox sExclamationBoxHitbox = { /* interactType: */ INTERACT_BREAKABLE, /* downOffset: */ 5, diff --git a/src/game/behaviors/grill_door.inc.c b/src/game/behaviors/grill_door.inc.c index 74dd82fa..871f43d5 100644 --- a/src/game/behaviors/grill_door.inc.c +++ b/src/game/behaviors/grill_door.inc.c @@ -1,5 +1,11 @@ // grill_door.c.inc +struct OpenableGrill { + s16 halfWidth; + ModelID16 modelID; + const Collision *collision; +}; + struct OpenableGrill gOpenableGrills[] = { { 320, MODEL_BOB_BARS_GRILLS, bob_seg7_collision_gate }, { 410, MODEL_HMC_RED_GRILLS, hmc_seg7_collision_0702B65C } }; diff --git a/src/game/behaviors/rotating_platform.inc.c b/src/game/behaviors/rotating_platform.inc.c index 2d582daf..d2bb3229 100644 --- a/src/game/behaviors/rotating_platform.inc.c +++ b/src/game/behaviors/rotating_platform.inc.c @@ -3,6 +3,13 @@ #include "levels/wf/header.h" #include "levels/wdw/header.h" +struct WFRotatingPlatformData { + s16 pad; + s16 scale; + const Collision *collisionData; + s16 collisionDistance; +}; + struct WFRotatingPlatformData sWFRotatingPlatformData[] = { { 0, 100, wf_seg7_collision_rotating_platform, 2000 }, { 0, 150, wdw_seg7_collision_070186B4, 1000 } diff --git a/src/game/behaviors/tumbling_bridge.inc.c b/src/game/behaviors/tumbling_bridge.inc.c index 86f3915c..86b7af13 100644 --- a/src/game/behaviors/tumbling_bridge.inc.c +++ b/src/game/behaviors/tumbling_bridge.inc.c @@ -5,6 +5,14 @@ #include "levels/lll/header.h" #include "levels/bitfs/header.h" +struct TumblingBridgeParams { + s16 numBridgeSections; + s16 bridgeRelativeStartingXorZ; + s16 platformWidth; + ModelID16 model; + const void *segAddr; +}; + struct TumblingBridgeParams sTumblingBridgeParams[] = { { 9, -512, 0x80, MODEL_WF_TUMBLING_BRIDGE_PART, wf_seg7_collision_tumbling_bridge }, { 9, -412, 103, MODEL_BBH_TUMBLING_PLATFORM_PART, bbh_seg7_collision_07026B1C },