From eee7ba9bd574631c58837a92463e0a4d6a28cae6 Mon Sep 17 00:00:00 2001 From: mzxrules Date: Sat, 12 Oct 2024 22:28:55 -0400 Subject: [PATCH] Rename RoomBehaviorType2 (#2270) * Rename RoomBehavior2 * fig proposal * fig comment --- include/z64scene.h | 20 +++++++++--------- src/code/z_camera.c | 2 +- src/code/z_player_lib.c | 2 +- src/code/z_scene.c | 2 +- .../actors/ovl_player_actor/z_player.c | 21 ++++++++++--------- 5 files changed, 24 insertions(+), 23 deletions(-) diff --git a/include/z64scene.h b/include/z64scene.h index 53c868553d..c88e6b1c6b 100644 --- a/include/z64scene.h +++ b/include/z64scene.h @@ -161,20 +161,20 @@ typedef enum RoomBehaviorType1 { /* 5 */ ROOM_BEHAVIOR_TYPE1_5 } RoomBehaviorType1; -typedef enum RoomBehaviorType2 { - /* 0 */ ROOM_BEHAVIOR_TYPE2_0, - /* 1 */ ROOM_BEHAVIOR_TYPE2_1, - /* 2 */ ROOM_BEHAVIOR_TYPE2_2, - /* 3 */ ROOM_BEHAVIOR_TYPE2_3, - /* 4 */ ROOM_BEHAVIOR_TYPE2_4, - /* 5 */ ROOM_BEHAVIOR_TYPE2_5, - /* 6 */ ROOM_BEHAVIOR_TYPE2_6 -} RoomBehaviorType2; +typedef enum RoomEnvironmentType { + /* 0 */ ROOM_ENV_DEFAULT, + /* 1 */ ROOM_ENV_COLD, + /* 2 */ ROOM_ENV_WARM, + /* 3 */ ROOM_ENV_HOT, // Enables hot room timer for the current room + /* 4 */ ROOM_ENV_UNK_STRETCH_1, + /* 5 */ ROOM_ENV_UNK_STRETCH_2, + /* 6 */ ROOM_ENV_UNK_STRETCH_3 +} RoomEnvironmentType; typedef struct Room { /* 0x00 */ s8 num; // -1 is invalid room /* 0x01 */ u8 unk_01; - /* 0x02 */ u8 behaviorType2; + /* 0x02 */ u8 environmentType; /* 0x03 */ u8 behaviorType1; /* 0x04 */ s8 echo; /* 0x05 */ u8 lensMode; diff --git a/src/code/z_camera.c b/src/code/z_camera.c index 053151a42c..4281b15c0c 100644 --- a/src/code/z_camera.c +++ b/src/code/z_camera.c @@ -7881,7 +7881,7 @@ s32 Camera_UpdateWater(Camera* camera) { s32 Camera_UpdateHotRoom(Camera* camera) { camera->distortionFlags &= ~DISTORTION_HOT_ROOM; - if (camera->play->roomCtx.curRoom.behaviorType2 == ROOM_BEHAVIOR_TYPE2_3) { + if (camera->play->roomCtx.curRoom.environmentType == ROOM_ENV_HOT) { camera->distortionFlags |= DISTORTION_HOT_ROOM; } diff --git a/src/code/z_player_lib.c b/src/code/z_player_lib.c index 1699dd2003..5c03180647 100644 --- a/src/code/z_player_lib.c +++ b/src/code/z_player_lib.c @@ -928,7 +928,7 @@ s32 Player_GetEnvironmentalHazard(PlayState* play) { EnvHazardTextTriggerEntry* triggerEntry; s32 envHazard; - if (play->roomCtx.curRoom.behaviorType2 == ROOM_BEHAVIOR_TYPE2_3) { // Room is hot + if (play->roomCtx.curRoom.environmentType == ROOM_ENV_HOT) { // Room is hot envHazard = PLAYER_ENV_HAZARD_HOTROOM - 1; } else if ((this->underwaterTimer > 80) && ((this->currentBoots == PLAYER_BOOTS_IRON) || (this->underwaterTimer >= 300))) { diff --git a/src/code/z_scene.c b/src/code/z_scene.c index f96005a4a0..13dce2d48e 100644 --- a/src/code/z_scene.c +++ b/src/code/z_scene.c @@ -262,7 +262,7 @@ BAD_RETURN(s32) Scene_CommandSpecialFiles(PlayState* play, SceneCmd* cmd) { BAD_RETURN(s32) Scene_CommandRoomBehavior(PlayState* play, SceneCmd* cmd) { play->roomCtx.curRoom.behaviorType1 = cmd->roomBehavior.gpFlag1; - play->roomCtx.curRoom.behaviorType2 = cmd->roomBehavior.gpFlag2 & 0xFF; + play->roomCtx.curRoom.environmentType = cmd->roomBehavior.gpFlag2 & 0xFF; play->roomCtx.curRoom.lensMode = (cmd->roomBehavior.gpFlag2 >> 8) & 1; play->msgCtx.disableWarpSongs = (cmd->roomBehavior.gpFlag2 >> 0xA) & 1; } diff --git a/src/overlays/actors/ovl_player_actor/z_player.c b/src/overlays/actors/ovl_player_actor/z_player.c index 3e3f35a9bf..32094de138 100644 --- a/src/overlays/actors/ovl_player_actor/z_player.c +++ b/src/overlays/actors/ovl_player_actor/z_player.c @@ -1105,13 +1105,13 @@ static LinkAnimationHeader* D_80853D4C[][3] = { }; typedef enum FidgetType { - /* 0x00 */ FIDGET_LOOK_AROUND, - /* 0x01 */ FIDGET_COLD, - /* 0x02 */ FIDGET_WARM, - /* 0x03 */ FIDGET_HOT, // same animations as FIDGET_WARM - /* 0x04 */ FIDGET_STRETCH_1, - /* 0x05 */ FIDGET_STRETCH_2, // same animations as FIDGET_STRETCH_1 - /* 0x06 */ FIDGET_STRETCH_3, // same animations as FIDGET_STRETCH_1 + /* 0x00 */ FIDGET_LOOK_AROUND, // ROOM_ENV_DEFAULT + /* 0x01 */ FIDGET_COLD, // ROOM_ENV_COLD + /* 0x02 */ FIDGET_WARM, // ROOM_ENV_WARM + /* 0x03 */ FIDGET_HOT, // ROOM_ENV_HOT (same animations as FIDGET_WARM) + /* 0x04 */ FIDGET_STRETCH_1, // ROOM_ENV_UNK_STRETCH_1 + /* 0x05 */ FIDGET_STRETCH_2, // ROOM_ENV_UNK_STRETCH_1 (same animations as FIDGET_STRETCH_1) + /* 0x06 */ FIDGET_STRETCH_3, // ROOM_ENV_UNK_STRETCH_1 (same animations as FIDGET_STRETCH_1) /* 0x07 */ FIDGET_CRIT_HEALTH_START, /* 0x08 */ FIDGET_CRIT_HEALTH_LOOP, /* 0x09 */ FIDGET_SWORD_SWING, @@ -8190,7 +8190,7 @@ void Player_ChooseNextIdleAnim(PlayState* play, Player* this) { } else { // Pick fidget type based on room behavior. // This may be changed below. - fidgetType = play->roomCtx.curRoom.behaviorType2; + fidgetType = play->roomCtx.curRoom.environmentType; if (heathIsCritical) { if (this->idleType >= PLAYER_IDLE_DEFAULT) { @@ -8208,7 +8208,8 @@ void Player_ChooseNextIdleAnim(PlayState* play, Player* this) { // There is a 4/5 chance that a common fidget type will be considered. // However it may get rejected by the conditions below. - // The type determined by `curRoom.behaviorType2` will be used if a common type is rejected. + // The type determined by `curRoom.environmentType` will be used if a common type is + // rejected. if (commonType < 4) { // `FIDGET_ADJUST_TUNIC` and `FIDGET_TAP_FEET` are accepted unconditionally. // The sword and shield related common types have extra restrictions. @@ -9410,7 +9411,7 @@ static AnimSfxEntry D_808545F0[] = { void Player_Action_80843CEC(Player* this, PlayState* play) { if (this->currentTunic != PLAYER_TUNIC_GORON) { - if ((play->roomCtx.curRoom.behaviorType2 == ROOM_BEHAVIOR_TYPE2_3) || (sFloorType == FLOOR_TYPE_9) || + if ((play->roomCtx.curRoom.environmentType == ROOM_ENV_HOT) || (sFloorType == FLOOR_TYPE_9) || ((func_80838144(sFloorType) >= 0) && !func_80042108(&play->colCtx, this->actor.floorPoly, this->actor.floorBgId))) { func_8083821C(this);