From 13a2f40f2a75ddbe1b5ec8512c88131889aa948a Mon Sep 17 00:00:00 2001 From: HailSanta <53960937+HailSanta@users.noreply.github.com> Date: Mon, 3 Jan 2022 04:56:30 -0500 Subject: [PATCH] Update GameStatus fields (#595) * renamed a few fields in game status * created constant for MAX_GAME_TIME * names for rumble funcs * suggested changes * created sound out enum * function naming test * actorClass consistent name * water block effect field * battle_status fields Co-authored-by: Clover --- include/common_structs.h | 42 +++---- include/enums.h | 5 + src/111f0_len_860.c | 2 +- src/165490.c | 4 +- src/16F740.c | 8 +- src/16c8e0.c | 4 +- src/190B20.c | 4 +- src/1A5830.c | 2 +- src/30450.c | 4 +- src/43F0.c | 8 +- src/77480.c | 26 ++-- src/E225B0.c | 2 +- src/actor_api.c | 64 +++++----- src/ad90_len_2880.c | 6 +- src/audio.h | 4 +- src/battle/partner/sushie.c | 20 +-- src/dc470_len_14c0.c | 22 ++-- src/main_loop.c | 115 +++++++++--------- src/rumble.c | 26 ++-- src/state_demo.c | 10 +- src/state_intro.c | 26 ++-- src/state_logos.c | 56 ++++----- src/state_pause.c | 6 +- src/state_startup.c | 16 +-- src/state_title_screen.c | 2 +- src/world/partner/lakilester.c | 8 +- src/world/partner/sushie.c | 2 +- src/world/partner/watt.c | 4 +- src/world/partners.c | 4 +- .../165490/filemenu_main_handle_input.s | 4 +- ver/us/symbol_addrs.txt | 4 +- 31 files changed, 258 insertions(+), 252 deletions(-) diff --git a/include/common_structs.h b/include/common_structs.h index faa6603c3e..ac265c8883 100644 --- a/include/common_structs.h +++ b/include/common_structs.h @@ -671,7 +671,7 @@ typedef struct BattleStatus { /* 0x062 */ s8 unk_62; /* 0x063 */ s8 unk_63; /* 0x064 */ char unk_64[12]; - /* 0x070 */ s16 unk_70; + /* 0x070 */ s16 menuDisableFlags; /* 1 = jump, 2 = hammer, 4 = items */ /* 0x072 */ char unk_72[2]; /* 0x074 */ s32 unk_74; /* 0x078 */ u8 totalStarPoints; @@ -689,7 +689,7 @@ typedef struct BattleStatus { /* 0x087 */ s8 blockResult; /* 0 = fail, 1 = success, -1 = mashed */ /* 0x088 */ s8 itemUsesLeft; /* set to 2 for double dip, 3 for triple dip */ /* 0x089 */ u8 hpDrainCount; - /* 0x08A */ s8 unk_8A; + /* 0x08A */ s8 nextMerleeSpellType; /* 0x08B */ s8 hustleTurns; /* numTurns from hustle drink, normally 0 */ /* 0x08C */ char unk_8C; /* 0x08D */ s8 unk_8D; @@ -710,32 +710,32 @@ typedef struct BattleStatus { /* 0x09D */ s8 waterBlockTurnsLeft; /* 0x09E */ u8 waterBlockAmount; /* unused? */ /* 0x09F */ char unk_9F; - /* 0x0A0 */ s32* unk_A0; + /* 0x0A0 */ struct EffectInstance* waterBlockEffect; /* 0x0A4 */ s8 cloudNineTurnsLeft; /* 0x0A5 */ s8 cloudNineDodgeChance; /* = 50% */ /* 0x0A6 */ char unk_A6[2]; /* 0x0A8 */ struct EffectInstance* cloudNineEffect; - /* 0x0AC */ char unk_AC; - /* 0x0AD */ s8 unk_AD; + /* 0x0AC */ s8 merleeAttackBoost; + /* 0x0AD */ s8 merleeDefenseBoost; /* 0x0AE */ s8 hammerLossTurns; /* 0x0AF */ s8 jumpLossTurns; /* 0x0B0 */ s8 itemLossTurns; /* 0x0B1 */ char unk_B1[3]; /* 0x0B4 */ UNK_FUN_PTR(preUpdateCallback); - /* 0x0B8 */ UNK_FUN_PTR(unk_B8); + /* 0x0B8 */ UNK_FUN_PTR(initBattleCallback); /* 0x0BC */ struct Evt* controlScript; /* control handed over to this when changing partners */ /* 0x0C0 */ s32 controlScriptID; /* 0x0C4 */ struct Evt* camMovementScript; /* 0x0C8 */ s32 camMovementScriptID; - /* 0x0CC */ Vec3f unk_CC; + /* 0x0CC */ Vec3f camLookatObjPos; /* 0x0D8 */ struct Actor* playerActor; /* 0x0DC */ struct Actor* partnerActor; /* 0x0E0 */ struct Actor* enemyActors[24]; /* 0x140 */ s16 enemyIDs[24]; - /* 0x170 */ s8 unk_170; + /* 0x170 */ s8 nextEnemyIndex; /* (during enemy turn) who should go next */ /* 0x171 */ s8 numEnemyActors; - /* 0x172 */ s16 currentTurnEnemyID; - /* 0x174 */ struct Actor* currentTurnEnemy; + /* 0x172 */ s16 activeEnemyActorID; /* (during enemy turn) enemy currently using their move */ + /* 0x174 */ struct Actor* currentTurnEnemy; /* 0x178 */ s8 moveCategory; ///< 0 = jump, 1 = hammer, 5 = partner, ... /* 0x179 */ char unk_179; /* 0x17A */ s16 selectedItemID; @@ -1177,7 +1177,7 @@ typedef struct GameStatus { /* 0x07A */ s8 musicEnabled; /* 0x07B */ char unk_7B; /* 0x07C */ s8 unk_7C; - /* 0x07D */ s8 unk_7D; + /* 0x07D */ s8 keepUsingPartnerOnMapChange; /* 0x07E */ u8 peachFlags; /* (1 = isPeach, 2 = isTransformed, 4 = hasUmbrella) */ /* 0x07F */ s8 peachDisguise; /* (1 = koopatrol, 2 = hammer bros, 3 = clubba) */ /* 0x080 */ u8 peachAnimIdx; ///< @see world_action_idle_peachAnims @@ -1199,9 +1199,9 @@ typedef struct GameStatus { /* 0x0A8 */ s8 creditsViewportMode; /* 0x0A9 */ s8 unk_A9; /* 0x0AA */ s8 demoFlags; - /* 0x0AB */ u8 unk_AB; - /* 0x0AC */ s8 loadMenuState; - /* 0x0AD */ s8 menuCounter; + /* 0x0AB */ u8 soundOutputMode; + /* 0x0AC */ s8 introState; + /* 0x0AD */ s8 introCounter; /* 0x0AE */ s8 bSkipIntro; /* 0x0AF */ char unk_AF[0x7]; /* 0x0B6 */ s16 bootAlpha; @@ -1209,8 +1209,8 @@ typedef struct GameStatus { /* 0x0BA */ s16 bootGreen; /* 0x0BC */ s16 bootRed; /* 0x0BE */ char unk_BE[94]; - /* 0x11C */ Vec3f unk_11C; - /* 0x128 */ Vec3f playerTraceNormal; + /* 0x11C */ Vec3f playerGroundTraceAngles; + /* 0x128 */ Vec3f playerGroundTraceNormal; /* 0x134 */ u16 frameCounter; /* 0x136 */ char unk_136[2]; /* 0x138 */ s32 nextRNG; @@ -1218,11 +1218,11 @@ typedef struct GameStatus { /* 0x13E */ char unk_13E[2]; /* 0x140 */ ShopItemEntity* shopItemEntities; /* 0x144 */ struct Shop* mapShop; - /* 0x148 */ s16 enableBackground; /* (bit 2 is also used for something) */ - /* 0x14A */ s16 backgroundMinW; - /* 0x14C */ s16 backgroundMinH; - /* 0x14E */ s16 backgroundMaxW; - /* 0x150 */ s16 backgroundMaxH; + /* 0x148 */ s16 backgroundFlags; /* (bit 1 = enable, bit 2 is used for something else) */ + /* 0x14A */ s16 backgroundMinX; + /* 0x14C */ s16 backgroundMinY; + /* 0x14E */ s16 backgroundMaxX; + /* 0x150 */ s16 backgroundMaxY; /* 0x152 */ s16 backgroundXOffset; /* (used for parallax scroll) */ /* 0x154 */ UNK_PTR backgroundRaster; /* 0x158 */ UNK_PTR backgroundPalette; diff --git a/include/enums.h b/include/enums.h index b0ed01369e..78e7b761a9 100644 --- a/include/enums.h +++ b/include/enums.h @@ -241,6 +241,11 @@ enum EncounterTriggers { ENCOUNTER_TRIGGER_PARTNER = 6, }; +enum SoundOutputMode { + SOUND_OUT_MONO = 0, + SOUND_OUT_STEREO = 1, +}; + enum SongIDs { SONG_TOAD_TOWN = 0x00000000, //SONG_GOOMBA_VILLAGE_COPY = 0x00000001, diff --git a/src/111f0_len_860.c b/src/111f0_len_860.c index 7a23eb355e..ad17d844be 100644 --- a/src/111f0_len_860.c +++ b/src/111f0_len_860.c @@ -88,7 +88,7 @@ void state_step_enter_world(void) { } void state_drawUI_enter_world(void) { - if (gGameStatusPtr->loadMenuState == 2) { + if (gGameStatusPtr->introState == 2) { draw_status_ui(); } } diff --git a/src/165490.c b/src/165490.c index 04ecf21959..d3ccfa1878 100644 --- a/src/165490.c +++ b/src/165490.c @@ -56,7 +56,7 @@ void filemenu_draw_contents_stereo( s32 width, s32 height, s32 opacity, s32 darkening ) { - if (gGameStatusPtr->unk_AB == 1) { + if (gGameStatusPtr->soundOutputMode == SOUND_OUT_STEREO) { set_hud_element_render_pos(filemenu_hudElemIDs[18], baseX + 34, baseY + 10); draw_hud_element_3(filemenu_hudElemIDs[18]); } else { @@ -71,7 +71,7 @@ void filemenu_draw_contents_mono( s32 width, s32 height, s32 opacity, s32 darkening ) { - if (gGameStatusPtr->unk_AB == 0) { + if (gGameStatusPtr->soundOutputMode == SOUND_OUT_MONO) { set_hud_element_render_pos(filemenu_hudElemIDs[16], baseX + 34, baseY + 10); draw_hud_element_3(filemenu_hudElemIDs[16]); } else { diff --git a/src/16F740.c b/src/16F740.c index 6e4a2e78d0..02ce6d9309 100644 --- a/src/16F740.c +++ b/src/16F740.c @@ -370,9 +370,9 @@ void btl_state_update_victory(void) { if (gBattleState2 == BATTLE_STATES2_UNK_2) { func_8024E40C(2); - if (battleStatus->unk_8A == 3) { + if (battleStatus->nextMerleeSpellType == 3) { if ((s8) battleStatus->totalStarPoints == 0) { - battleStatus->unk_8A = 0; + battleStatus->nextMerleeSpellType = 0; playerData->merleeTurnCount = 0; playerData->merleeCastsLeft++; } else { @@ -393,11 +393,11 @@ void btl_state_update_victory(void) { D_8029F248--; } else if (player->takeTurnScript == NULL || !does_script_exist(player->takeTurnID)) { player->takeTurnScript = NULL; - if (battleStatus->unk_8A != 3) { + if (battleStatus->nextMerleeSpellType != 3) { gBattleState2 = BATTLE_STATES2_UNK_4; } else { battleStatus->incrementStarPointDelay = 0x14; - battleStatus->unk_8A = 0; + battleStatus->nextMerleeSpellType = 0; gBattleState2 = BATTLE_STATES2_UNK_4; battleStatus->pendingStarPoints = battleStatus->totalStarPoints + battleStatus->pendingStarPoints + battleStatus->pendingStarPoints; diff --git a/src/16c8e0.c b/src/16c8e0.c index 3a6857c402..8538dc3796 100644 --- a/src/16c8e0.c +++ b/src/16c8e0.c @@ -371,8 +371,8 @@ void func_8023ED5C(void) { if (gBattleState != 0) { func_8024EEA8(); - if (battleStatus->unk_B8 != NULL) { - battleStatus->unk_B8(); + if (battleStatus->initBattleCallback != NULL) { + battleStatus->initBattleCallback(); } if (battleStatus->flags1 & 1) { func_80255FD8(); diff --git a/src/190B20.c b/src/190B20.c index 5e5764db8f..0a1cf4a59e 100644 --- a/src/190B20.c +++ b/src/190B20.c @@ -3029,14 +3029,14 @@ void remove_player_buffs(s32 buffs) { if (buffs & 0x200 && (battleStatus->waterBlockTurnsLeft != 0)) { battleStatus->waterBlockTurnsLeft = 0; battleStatus->unk_43C->unk_0C->unk_10 = 0; - battleStatus->unk_A0[0] |= 0x10; + battleStatus->waterBlockEffect->flags |= 0x10; playFX_5A(1, player->currentPos.x, player->currentPos.y + 18.0f, player->currentPos.z + 5.0f, 1.5f, 0xA); playFX_5F(0, player->currentPos.x - 10.0f, player->currentPos.y + 5.0f, player->currentPos.z + 5.0f, 1.0f, 0x18); playFX_5F(0, player->currentPos.x - 15.0f, player->currentPos.y + 32.0f, player->currentPos.z + 5.0f, 1.0f, 0x18); playFX_5F(1, player->currentPos.x + 15.0f, player->currentPos.y + 22.0f, player->currentPos.z + 5.0f, 1.0f, 0x18); - battleStatus->unk_A0 = NULL; + battleStatus->waterBlockEffect = NULL; sfx_play_sound(SOUND_299); } if (buffs & 0x100 && (battleStatus->turboChargeTurnsLeft != 0)) { diff --git a/src/1A5830.c b/src/1A5830.c index bfb35660f5..1def8945b0 100644 --- a/src/1A5830.c +++ b/src/1A5830.c @@ -368,7 +368,7 @@ s32 calc_enemy_damage_target(Actor* attacker) { switch (actorMasked) { case ACTOR_PLAYER: - damage -= battleStatus->unk_AD; + damage -= battleStatus->merleeDefenseBoost; break; case ACTOR_PARTNER: case ACTOR_ENEMY0: diff --git a/src/30450.c b/src/30450.c index 4f14a851f6..e50e59d3a9 100644 --- a/src/30450.c +++ b/src/30450.c @@ -579,12 +579,12 @@ void func_80056144(UnkFuncAl arg0, s32 arg1) { D_8009A5C0->unk_A4[arg1] = arg0; } -void func_8005615C(void) { +void audio_set_stereo(void) { func_80056D5C(1); func_80054DA8(0); } -void func_80056180(void) { +void audio_set_mono(void) { func_80056D5C(0); func_80054DA8(1); } diff --git a/src/43F0.c b/src/43F0.c index 780692f1e9..924c28be3d 100644 --- a/src/43F0.c +++ b/src/43F0.c @@ -652,15 +652,15 @@ f32 atan2(f32 startX, f32 startZ, f32 endX, f32 endZ) { } f32 get_player_normal_yaw(void) { - return atan2(0, 0, gGameStatusPtr->playerTraceNormal.x, gGameStatusPtr->playerTraceNormal.z); + return atan2(0, 0, gGameStatusPtr->playerGroundTraceNormal.x, gGameStatusPtr->playerGroundTraceNormal.z); } f32 get_player_normal_pitch(void) { - f32 traceNormalX = gGameStatusPtr->playerTraceNormal.x; - f32 traceNormalZ = gGameStatusPtr->playerTraceNormal.z; + f32 traceNormalX = gGameStatusPtr->playerGroundTraceNormal.x; + f32 traceNormalZ = gGameStatusPtr->playerGroundTraceNormal.z; f32 sqrt = sqrtf(SQ(traceNormalX) + SQ(traceNormalZ)); - return atan2(0.0f, 0.0f, sqrt, -gGameStatusPtr->playerTraceNormal.y); + return atan2(0.0f, 0.0f, sqrt, -gGameStatusPtr->playerGroundTraceNormal.y); } f32 dist2D(f32 ax, f32 ay, f32 bx, f32 by) { diff --git a/src/77480.c b/src/77480.c index 313c4215dc..fc2d3d9092 100644 --- a/src/77480.c +++ b/src/77480.c @@ -96,8 +96,8 @@ s32 player_raycast_below(f32 yaw, f32 diameter, f32* outX, f32* outY, f32* outZ, hitObjectID = player_raycast_down(&x, &y, &z, &length); ret = -1; if (hitObjectID >= 0 && length <= fabsf(*outLength)) { - *hitRx = -gGameStatusPtr->unk_11C.x; - *hitRz = -gGameStatusPtr->unk_11C.z; + *hitRx = -gGameStatusPtr->playerGroundTraceAngles.x; + *hitRz = -gGameStatusPtr->playerGroundTraceAngles.z; *outX = x; *outY = y; *outZ = z; @@ -113,8 +113,8 @@ s32 player_raycast_below(f32 yaw, f32 diameter, f32* outX, f32* outY, f32* outZ, length = inputLength; hitObjectID = player_raycast_down(&x, &y, &z, &length); if (hitObjectID >= 0 && length <= fabsf(*outLength)) { - *hitRx = -gGameStatusPtr->unk_11C.x; - *hitRz = -gGameStatusPtr->unk_11C.z; + *hitRx = -gGameStatusPtr->playerGroundTraceAngles.x; + *hitRz = -gGameStatusPtr->playerGroundTraceAngles.z; *outX = x; *outY = y; *outZ = z; @@ -130,8 +130,8 @@ s32 player_raycast_below(f32 yaw, f32 diameter, f32* outX, f32* outY, f32* outZ, length = inputLength; hitObjectID = player_raycast_down(&x, &y, &z, &length); if (hitObjectID >= 0 && length <= fabsf(*outLength)) { - *hitRx = -gGameStatusPtr->unk_11C.x; - *hitRz = -gGameStatusPtr->unk_11C.z; + *hitRx = -gGameStatusPtr->playerGroundTraceAngles.x; + *hitRz = -gGameStatusPtr->playerGroundTraceAngles.z; *outX = x; *outY = y; *outZ = z; @@ -147,8 +147,8 @@ s32 player_raycast_below(f32 yaw, f32 diameter, f32* outX, f32* outY, f32* outZ, length = inputLength; hitObjectID = player_raycast_down(&x, &y, &z, &length); if (hitObjectID >= 0 && length <= fabsf(*outLength)) { - *hitRx = -gGameStatusPtr->unk_11C.x; - *hitRz = -gGameStatusPtr->unk_11C.z; + *hitRx = -gGameStatusPtr->playerGroundTraceAngles.x; + *hitRz = -gGameStatusPtr->playerGroundTraceAngles.z; *outX = x; *outY = y; *outZ = z; @@ -164,8 +164,8 @@ s32 player_raycast_below(f32 yaw, f32 diameter, f32* outX, f32* outY, f32* outZ, length = inputLength; hitObjectID = player_raycast_down(&x, &y, &z, &length); if (hitObjectID >= 0 && length <= fabsf(*outLength)) { - *hitRx = -gGameStatusPtr->unk_11C.x; - *hitRz = -gGameStatusPtr->unk_11C.z; + *hitRx = -gGameStatusPtr->playerGroundTraceAngles.x; + *hitRz = -gGameStatusPtr->playerGroundTraceAngles.z; *outX = x; *outY = y; *outZ = z; @@ -1030,9 +1030,9 @@ void update_player_shadow(void) { f32 tan = atan2(playerStatus->position.x, playerStatus->position.z, x, z); s32 angleTemp = clamp_angle((-90.0f - tan) + get_player_normal_yaw()); - if (gGameStatusPtr->playerTraceNormal.y != 0.0f) { - y -= sqrtf(SQ(gGameStatusPtr->playerTraceNormal.x) + SQ(gGameStatusPtr->playerTraceNormal.z)) / - gGameStatusPtr->playerTraceNormal.y * dist * sin_deg(angleTemp); + if (gGameStatusPtr->playerGroundTraceNormal.y != 0.0f) { + y -= sqrtf(SQ(gGameStatusPtr->playerGroundTraceNormal.x) + SQ(gGameStatusPtr->playerGroundTraceNormal.z)) / + gGameStatusPtr->playerGroundTraceNormal.y * dist * sin_deg(angleTemp); } } diff --git a/src/E225B0.c b/src/E225B0.c index 07d910f27a..e0feef4104 100644 --- a/src/E225B0.c +++ b/src/E225B0.c @@ -137,7 +137,7 @@ void func_802B735C_E2290C(void) { switch (temp_v1) { case 0: if (partnerActionStatus->actionState.b[0] && partnerActionStatus->actionState.b[3] == 8) { - phi_v0 = gGameStatusPtr->unk_7D; + phi_v0 = gGameStatusPtr->keepUsingPartnerOnMapChange; } else { phi_v0 = playerStatus->flags & 0x3000; } diff --git a/src/actor_api.c b/src/actor_api.c index d3582a40df..aec1b2a796 100644 --- a/src/actor_api.c +++ b/src/actor_api.c @@ -14,38 +14,38 @@ s32 count_targets(Actor* actor, s32 targetHomeIndex, s32 targetSelectionFlags) { } s32 get_nearest_home_index(f32 x, f32 y, f32 z) { - s32 xVal; - s32 yVal; + s32 row; + s32 col; if (y < 40.0f) { - xVal = 0; + row = 0; } else if (y < 85.0f) { - xVal = 1; + row = 1; } else if (y < 100.0f) { - xVal = 2; + row = 2; } else { - xVal = 3; + row = 3; } if (x < 25.0f) { - yVal = 0; + col = 0; } else if (x < 65.0f) { - yVal = 1; + col = 1; } else if (x < 105.0f) { - yVal = 2; + col = 2; } else { - yVal = 3; + col = 3; } - return yVal | (xVal << 2); + return col | (row << 2); } void set_goal_pos_to_part(ActorState* state, s32 actorID, s32 partIndex) { - s32 temp_s0 = actorID & 0x700; + s32 actorClass = actorID & 0x700; Actor* actor = get_actor(actorID); ActorPart* part; - switch (temp_s0) { + switch (actorClass) { case ACTOR_PLAYER: part = get_actor_part(actor, 0); state->goalPos.x = actor->currentPos.x + part->partOffset.x * actor->scalingFactor; @@ -80,11 +80,11 @@ void set_goal_pos_to_part(ActorState* state, s32 actorID, s32 partIndex) { } void set_part_goal_to_actor_part(ActorPartMovement* movement, s32 actorID, s32 partIndex) { - s32 actorGroup = actorID & 0x700; + s32 actorClass = actorID & 0x700; Actor* actor = get_actor(actorID); ActorPart* part; - switch (actorGroup) { + switch (actorClass) { case ACTOR_PLAYER: part = get_actor_part(actor, 0); part->movement->goalPos.x = actor->currentPos.x + part->partOffset.x * actor->scalingFactor; @@ -154,10 +154,10 @@ void set_actor_home_position(s32 actorID, f32 x, f32 y, f32 z) { Actor* get_actor(s32 actorID) { Actor* ret = NULL; BattleStatus* battleStatus = &gBattleStatus; - s32 idFlag = actorID & 0x700; + s32 actorClass = actorID & 0x700; u32 idIdx = (u8)actorID; - switch (idFlag) { + switch (actorClass) { case ACTOR_PLAYER: ret = battleStatus->playerActor; break; @@ -2039,7 +2039,7 @@ ApiStatus SummonEnemy(Evt* script, s32 isInitialCall) { actor2 = (Actor*) script->functionTemp[1]; if (does_script_exist(actor2->takeTurnID) == FALSE) { enemyIDs = battleStatus->enemyIDs; - if (battleStatus->unk_170 == 0) { + if (battleStatus->nextEnemyIndex == 0) { numEnemies = 0; for (i = 0; i < ARRAY_COUNT(battleStatus->enemyActors); i++) { if (battleStatus->enemyActors[i]) { @@ -2081,12 +2081,12 @@ ApiStatus SummonEnemy(Evt* script, s32 isInitialCall) { } } if (script->functionTemp[2] == 0) { - for (i = numEnemies; i >= battleStatus->unk_170; i--) { + for (i = numEnemies; i >= battleStatus->nextEnemyIndex; i--) { battleStatus->enemyIDs[i] = battleStatus->enemyIDs[i - 1]; } - battleStatus->enemyIDs[battleStatus->unk_170 - 1] = actor2->actorID; + battleStatus->enemyIDs[battleStatus->nextEnemyIndex - 1] = actor2->actorID; battleStatus->numEnemyActors++; - battleStatus->unk_170++; + battleStatus->nextEnemyIndex++; } else { battleStatus->enemyIDs[battleStatus->numEnemyActors] = actor2->actorID; battleStatus->numEnemyActors++; @@ -2160,9 +2160,9 @@ ApiStatus func_8026DF88(Evt* script, s32 isInitialCall) { } ApiStatus func_8026E020(Evt* script, s32 isInitialCall) { - s32 a0 = *script->ptrReadPos; + s32 flagsValue = *script->ptrReadPos; - gBattleStatus.unk_70 = a0; + gBattleStatus.menuDisableFlags = flagsValue; return ApiStatus_DONE2; } @@ -2515,14 +2515,14 @@ ApiStatus GetPlayerActorID(Evt* script, s32 isInitialCall) { ApiStatus func_8026E9A0(Evt* script, s32 isInitialCall) { Bytecode* args = script->ptrReadPos; - s32 temp_s0; - s32 temp_s0_2; + s32 actorID; + s32 partIndex; - temp_s0 = evt_get_variable(script, *args++); - temp_s0_2 = evt_get_variable(script, *args++); + actorID = evt_get_variable(script, *args++); + partIndex = evt_get_variable(script, *args++); - gBattleStatus.currentTargetPart2 = temp_s0_2; - gBattleStatus.currentTargetID2 = temp_s0; + gBattleStatus.currentTargetPart2 = partIndex; + gBattleStatus.currentTargetID2 = actorID; return ApiStatus_DONE2; } @@ -2750,7 +2750,7 @@ ApiStatus GetStatusFlags(Evt* script, s32 isInitialCall) { s32 actorID = evt_get_variable(script, *args++); s32 outVar = *args++; Actor* actor; - s32 actorMasked; + s32 actorClass; s8 debuff; s8 staticStatus; s8 stoneStatus; @@ -2764,7 +2764,7 @@ ApiStatus GetStatusFlags(Evt* script, s32 isInitialCall) { } actor = get_actor(actorID); debuff = actor->debuff; - actorMasked = actor->actorID & 0x700; + actorClass = actor->actorID & 0x700; flags = 0; if (debuff != STATUS_END) { @@ -2835,7 +2835,7 @@ ApiStatus GetStatusFlags(Evt* script, s32 isInitialCall) { } } - switch (actorMasked) { + switch (actorClass) { case ACTOR_PLAYER: case ACTOR_PARTNER: if (battleStatus->outtaSightActive) { diff --git a/src/ad90_len_2880.c b/src/ad90_len_2880.c index 4d13e7b274..73a7e62e07 100644 --- a/src/ad90_len_2880.c +++ b/src/ad90_len_2880.c @@ -68,9 +68,9 @@ void update_camera_mode_6(Camera* camera) { deltaY = camera->lookAt_obj.y - camera->lookAt_eye.y; camera->currentBlendedYawNegated = -atan2(0.0f, 0.0f, deltaX, deltaZ); camera->currentPitch = atan2(0.0f, 0.0f, deltaY, -sqrtf((deltaX * deltaX) + (deltaZ * deltaZ))); - gBattleStatus.unk_CC.x = camera->lookAt_obj.x; - gBattleStatus.unk_CC.y = camera->lookAt_obj.y; - gBattleStatus.unk_CC.z = camera->lookAt_obj.z; + gBattleStatus.camLookatObjPos.x = camera->lookAt_obj.x; + gBattleStatus.camLookatObjPos.y = camera->lookAt_obj.y; + gBattleStatus.camLookatObjPos.z = camera->lookAt_obj.z; } #else INCLUDE_ASM(void, "ad90_len_2880", update_camera_mode_6, Camera* camera); diff --git a/src/audio.h b/src/audio.h index 58a6e26145..e92931b5b6 100644 --- a/src/audio.h +++ b/src/audio.h @@ -664,8 +664,8 @@ s32 func_80056044(s32, u8); void func_8005608C(s32*, s32*); void func_800560A8(void); void func_80056144(UnkFuncAl, s32); -void func_8005615C(void); -void func_80056180(void); +void audio_set_stereo(void); +void audio_set_mono(void); void func_800561A4(s32); void func_800561C4(s32); void func_800561E4(s32); diff --git a/src/battle/partner/sushie.c b/src/battle/partner/sushie.c index 62193e6fff..9d53763679 100644 --- a/src/battle/partner/sushie.c +++ b/src/battle/partner/sushie.c @@ -77,13 +77,13 @@ ApiStatus func_802381EC_707E8C(Evt* script, s32 isInitialCall) { } ApiStatus func_802382A4_707F44(Evt* script, s32 isInitialCall) { - f32 var1 = script->varTable[0]; - f32 var2 = script->varTable[1]; + f32 posX = script->varTable[0]; + f32 posY = script->varTable[1]; - add_vec2D_polar(&var1, &var2, 300, atan2(var1, var2, script->varTable[3], script->varTable[4])); + add_vec2D_polar(&posX, &posY, 300, atan2(posX, posY, script->varTable[3], script->varTable[4])); - script->varTable[3] = var1; - script->varTable[4] = var2; + script->varTable[3] = posX; + script->varTable[4] = posY; return ApiStatus_DONE2; } @@ -122,16 +122,16 @@ ApiStatus func_80238388_708028(Evt* script, s32 isInitialCall) { ApiStatus func_80238480_708120(Evt* script, s32 isInitialCall) { BattleStatus* battleStatus = &gBattleStatus; Bytecode* args = script->ptrReadPos; - f32 var1 = evt_get_float_variable(script, *args++); - f32 var2 = evt_get_float_variable(script, *args++); - f32 var3 = evt_get_float_variable(script, *args++); - s32 effect = battleStatus->unk_A0; + f32 posX = evt_get_float_variable(script, *args++); + f32 posY = evt_get_float_variable(script, *args++); + f32 posZ = evt_get_float_variable(script, *args++); + s32 effect = battleStatus->waterBlockEffect; if (effect != NULL) { remove_effect(effect); } - battleStatus->unk_A0 = playFX_5A(0, var1, var2, var3, 1.5f, 0); + battleStatus->waterBlockEffect = playFX_5A(0, posX, posY, posZ, 1.5f, 0); return ApiStatus_DONE2; } diff --git a/src/dc470_len_14c0.c b/src/dc470_len_14c0.c index 08c18679aa..b1048dca62 100644 --- a/src/dc470_len_14c0.c +++ b/src/dc470_len_14c0.c @@ -29,25 +29,25 @@ void reset_background_settings(void) { D_801595A0 = 0; D_8014F12F = 0; gGameStatusPtr->unk_15C = 180; - gGameStatusPtr->enableBackground &= 0xF0; + gGameStatusPtr->backgroundFlags &= 0xF0; } void read_background_size(BackgroundHeader* bg) { - gGameStatusPtr->backgroundMaxW = bg->width; - gGameStatusPtr->backgroundMaxH = bg->height; - gGameStatusPtr->backgroundMinW = bg->startX; - gGameStatusPtr->backgroundMinH = bg->startY; + gGameStatusPtr->backgroundMaxX = bg->width; + gGameStatusPtr->backgroundMaxY = bg->height; + gGameStatusPtr->backgroundMinX = bg->startX; + gGameStatusPtr->backgroundMinY = bg->startY; gGameStatusPtr->backgroundRaster = bg->raster; gGameStatusPtr->backgroundPalette = bg->palette; - gGameStatusPtr->enableBackground |= 1; + gGameStatusPtr->backgroundFlags |= 1; } void set_background_size(s16 startX, s16 startY, s16 sizeX, s16 sizeY) { - gGameStatusPtr->enableBackground &= ~1; - gGameStatusPtr->backgroundMaxW = startX; - gGameStatusPtr->backgroundMaxH = startY; - gGameStatusPtr->backgroundMinW = sizeX; - gGameStatusPtr->backgroundMinH = sizeY; + gGameStatusPtr->backgroundFlags &= ~1; + gGameStatusPtr->backgroundMaxX = startX; + gGameStatusPtr->backgroundMaxY = startY; + gGameStatusPtr->backgroundMinX = sizeX; + gGameStatusPtr->backgroundMinY = sizeY; } u16 blend_background_channel(s32 arg0, s32 arg1, s32 alpha) { diff --git a/src/main_loop.c b/src/main_loop.c index ca0d32a45e..17a43e65c7 100644 --- a/src/main_loop.c +++ b/src/main_loop.c @@ -5,8 +5,8 @@ #include "sprite.h" #include "overlay.h" -s8 D_80074020 = 1; -s8 D_80074021 = 5; +s8 gGameStepDelayAmount = 1; +s8 gGameStepDelayCount = 5; GameStatus gGameStatus = {0}; GameStatus* gGameStatusPtr = &gGameStatus; @@ -50,22 +50,23 @@ void gfx_draw_background(void); void step_game_loop(void) { PlayerData* playerData = &gPlayerData; + const int MAX_GAME_TIME = 1000*60*60*60 - 1; // 1000 hours minus one frame at 60 fps update_input(); gGameStatusPtr->frameCounter++; playerData->frameCounter += 2; - if (playerData->frameCounter > 215999999) { - playerData->frameCounter = 215999999; + if (playerData->frameCounter > MAX_GAME_TIME) { + playerData->frameCounter = MAX_GAME_TIME; } update_max_rumble_duration(); - if (D_80074021 != 0) { - D_80074021-- ; - if (D_80074021 == 0) { - D_80074021 = D_80074020; + if (gGameStepDelayCount != 0) { + gGameStepDelayCount-- ; + if (gGameStepDelayCount == 0) { + gGameStepDelayCount = gGameStepDelayAmount; } else { return; } @@ -250,7 +251,7 @@ void load_engine_data(void) { gOverrideFlags = 0; gGameStatusPtr->unk_79 = 0; - gGameStatusPtr->enableBackground = 0; + gGameStatusPtr->backgroundFlags = 0; gGameStatusPtr->musicEnabled = 1; gGameStatusPtr->unk_7C = 1; gGameStatusPtr->creditsViewportMode = -1; @@ -260,7 +261,7 @@ void load_engine_data(void) { gGameStatusPtr->unk_83 = 4; timeFreezeMode = 0; gGameStatusPtr->debugQuizmo = gGameStatusPtr->unk_13C = 0; - D_80074021 = 5; + gGameStepDelayCount = 5; gGameStatusPtr->saveCount = 0; fio_init_flash(); func_80028838(); @@ -422,10 +423,10 @@ void func_80027BAC(s32 arg0, s32 arg1) { void gfx_draw_background(void) { Camera* camera; s32 bgFlags; - s32 backgroundMinW; - s32 backgroundSumW; - s32 backgroundMinH; - s32 backgroundSumH; + s32 backgroundMinX; + s32 backgroundMaxX; + s32 backgroundMinY; + s32 backgroundMaxY; s32 viewportStartX; s32 i; s32 a = 0x18; @@ -433,7 +434,7 @@ void gfx_draw_background(void) { gDPSetScissor(gMasterGfxPos++, G_SC_NON_INTERLACE, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT); camera = &gCameras[gCurrentCameraID]; - bgFlags = gGameStatusPtr->enableBackground & 0xF0; + bgFlags = gGameStatusPtr->backgroundFlags & 0xF0; switch (bgFlags) { case 0x10: @@ -447,14 +448,14 @@ void gfx_draw_background(void) { gDPFillRectangle(gMasterGfxPos++, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT); gDPPipeSync(gMasterGfxPos++); gDPSetDepthSource(gMasterGfxPos++, G_ZS_PIXEL); - gGameStatusPtr->enableBackground &= ~0xF0; - gGameStatusPtr->enableBackground |= 0x20; + gGameStatusPtr->backgroundFlags &= ~0xF0; + gGameStatusPtr->backgroundFlags |= 0x20; break; case 0x20: gfx_transfer_frame_to_depth(nuGfxCfb[0], nuGfxCfb[1], nuGfxZBuffer); // applies filters to the framebuffer D_800741F8 = 0; - gGameStatusPtr->enableBackground &= ~0xF0; - gGameStatusPtr->enableBackground |= 0x30; + gGameStatusPtr->backgroundFlags &= ~0xF0; + gGameStatusPtr->backgroundFlags |= 0x30; // fall through case 0x30: D_800741F8 += 0x10; @@ -503,62 +504,62 @@ void gfx_draw_background(void) { gDPSetColorImage(gMasterGfxPos++, G_IM_FMT_RGBA, G_IM_SIZ_16b, SCREEN_WIDTH, osVirtualToPhysical(nuGfxCfb_ptr)); gDPSetFillColor(gMasterGfxPos++, PACK_FILL_COLOR(camera->bgColor[0], camera->bgColor[1], camera->bgColor[2], 1)); - backgroundMinW = gGameStatusPtr->backgroundMinW; - backgroundSumW = backgroundMinW + gGameStatusPtr->backgroundMaxW; - backgroundMinH = gGameStatusPtr->backgroundMinH; - backgroundSumH = backgroundMinH + gGameStatusPtr->backgroundMaxH; + backgroundMinX = gGameStatusPtr->backgroundMinX; + backgroundMaxX = backgroundMinX + gGameStatusPtr->backgroundMaxX; + backgroundMinY = gGameStatusPtr->backgroundMinY; + backgroundMaxY = backgroundMinY + gGameStatusPtr->backgroundMaxY; viewportStartX = camera->viewportStartX; - if (backgroundMinW < viewportStartX) { - backgroundMinW = viewportStartX; + if (backgroundMinX < viewportStartX) { + backgroundMinX = viewportStartX; } - if (backgroundMinH < camera->viewportStartY) { - backgroundMinH = camera->viewportStartY; + if (backgroundMinY < camera->viewportStartY) { + backgroundMinY = camera->viewportStartY; } - if (backgroundSumW > viewportStartX + camera->viewportW) { - backgroundSumW = viewportStartX + camera->viewportW; + if (backgroundMaxX > viewportStartX + camera->viewportW) { + backgroundMaxX = viewportStartX + camera->viewportW; } - if (backgroundSumH > camera->viewportStartY + camera->viewportH) { - backgroundSumH = camera->viewportStartY + camera->viewportH; + if (backgroundMaxY > camera->viewportStartY + camera->viewportH) { + backgroundMaxY = camera->viewportStartY + camera->viewportH; } - if (backgroundMinW < 0) { - backgroundMinW = 0; + if (backgroundMinX < 0) { + backgroundMinX = 0; } - if (backgroundMinH < 0) { - backgroundMinH = 0; + if (backgroundMinY < 0) { + backgroundMinY = 0; } - if (backgroundSumW < 1) { - backgroundSumW = 1; + if (backgroundMaxX < 1) { + backgroundMaxX = 1; } - if (backgroundSumH < 1) { - backgroundSumH = 1; + if (backgroundMaxY < 1) { + backgroundMaxY = 1; } - if (backgroundMinW > SCREEN_WIDTH - 1) { - backgroundMinW = SCREEN_WIDTH - 1; + if (backgroundMinX > SCREEN_WIDTH - 1) { + backgroundMinX = SCREEN_WIDTH - 1; } - if (backgroundMinH > SCREEN_HEIGHT - 1) { - backgroundMinH = SCREEN_HEIGHT - 1; + if (backgroundMinY > SCREEN_HEIGHT - 1) { + backgroundMinY = SCREEN_HEIGHT - 1; } - if (backgroundSumW > SCREEN_WIDTH) { - backgroundSumW = SCREEN_WIDTH; + if (backgroundMaxX > SCREEN_WIDTH) { + backgroundMaxX = SCREEN_WIDTH; } - if (backgroundSumH > SCREEN_HEIGHT) { - backgroundSumH = SCREEN_HEIGHT; + if (backgroundMaxY > SCREEN_HEIGHT) { + backgroundMaxY = SCREEN_HEIGHT; } - if (!(gGameStatusPtr->enableBackground & 1)) { - gDPFillRectangle(gMasterGfxPos++, backgroundMinW, backgroundMinH, backgroundSumW - 1, backgroundSumH - 1); + if (!(gGameStatusPtr->backgroundFlags & 1)) { + gDPFillRectangle(gMasterGfxPos++, backgroundMinX, backgroundMinY, backgroundMaxX - 1, backgroundMaxY - 1); } else { appendGfx_background_texture(); } @@ -569,23 +570,23 @@ void gfx_draw_background(void) { gDPSetFillColor(gMasterGfxPos++, 0x00010001); gDPPipeSync(gMasterGfxPos++); - if (backgroundMinH > 0) { - gDPFillRectangle(gMasterGfxPos++, 0, 0, SCREEN_WIDTH - 1, backgroundMinH - 1); + if (backgroundMinY > 0) { + gDPFillRectangle(gMasterGfxPos++, 0, 0, SCREEN_WIDTH - 1, backgroundMinY - 1); gDPNoOp(gMasterGfxPos++); } - if (backgroundMinW > 0) { - gDPFillRectangle(gMasterGfxPos++, 0, backgroundMinH, backgroundMinW - 1, backgroundSumH - 1); + if (backgroundMinX > 0) { + gDPFillRectangle(gMasterGfxPos++, 0, backgroundMinY, backgroundMinX - 1, backgroundMaxY - 1); gDPNoOp(gMasterGfxPos++); } - if (backgroundSumW < SCREEN_WIDTH) { - gDPFillRectangle(gMasterGfxPos++, backgroundSumW, backgroundMinH, SCREEN_WIDTH - 1, backgroundSumH - 1); + if (backgroundMaxX < SCREEN_WIDTH) { + gDPFillRectangle(gMasterGfxPos++, backgroundMaxX, backgroundMinY, SCREEN_WIDTH - 1, backgroundMaxY - 1); gDPNoOp(gMasterGfxPos++); } - if (backgroundSumH < 0xF0) { - gDPFillRectangle(gMasterGfxPos++, 0, backgroundSumH, SCREEN_WIDTH - 1, SCREEN_HEIGHT - 1); + if (backgroundMaxY < 0xF0) { + gDPFillRectangle(gMasterGfxPos++, 0, backgroundMaxY, SCREEN_WIDTH - 1, SCREEN_HEIGHT - 1); gDPNoOp(gMasterGfxPos++); } break; diff --git a/src/rumble.c b/src/rumble.c index 1a8923a254..ef05b1b8f0 100644 --- a/src/rumble.c +++ b/src/rumble.c @@ -3,8 +3,8 @@ // TODO: replace nustuff with defines -u16 D_80074260 = 0; -s32 D_80074264 = 0; +u16 rumbleMaxDuration = 0; +s32 rumbleButtons = 0; void reset_max_rumble_duration(void); @@ -13,34 +13,34 @@ void poll_rumble(void) { nuContRmbModeSet(0, 2); } -void start_rumble(s32 freq, s32 frame) { +void start_rumble(s32 freq, s32 nframes) { if (gGameStatusPtr->demoState == 0) { - if (D_80074260 != 0) { - s32 symx2 = D_80074260 * 2; + if (rumbleMaxDuration != 0) { + s32 maxFrames = rumbleMaxDuration * 2; - if (frame > symx2) { - frame = symx2; + if (nframes > maxFrames) { + nframes = maxFrames; } if (nuContRmbCheck(0) == 0) { nuContRmbModeSet(0, 2); - nuContRmbStart(0, freq, frame); + nuContRmbStart(0, freq, nframes); } } } } void update_max_rumble_duration(void) { - if (D_80074264 != gGameStatusPtr->currentButtons) { - D_80074264 = gGameStatusPtr->currentButtons; + if (rumbleButtons != gGameStatusPtr->currentButtons) { + rumbleButtons = gGameStatusPtr->currentButtons; reset_max_rumble_duration(); } - if (D_80074260 != 0) { - D_80074260--; + if (rumbleMaxDuration != 0) { + rumbleMaxDuration--; } } void reset_max_rumble_duration(void) { - D_80074260 = 300; + rumbleMaxDuration = 300; } diff --git a/src/state_demo.c b/src/state_demo.c index 46a5ddc419..8824292e05 100644 --- a/src/state_demo.c +++ b/src/state_demo.c @@ -78,17 +78,17 @@ void state_step_demo(void) { case 3: intro_logos_set_fade_alpha(255); intro_logos_set_fade_color(224); - gGameStatusPtr->loadMenuState = 3; + gGameStatusPtr->introState = 3; gOverrideFlags |= 8; intro_logos_update_fade(); gGameStatusPtr->demoState = 5; break; case 4: - if (gGameStatusPtr->loadMenuState != 0) { - gGameStatusPtr->loadMenuState--; + if (gGameStatusPtr->introState != 0) { + gGameStatusPtr->introState--; } - if (gGameStatusPtr->loadMenuState == 0) { + if (gGameStatusPtr->introState == 0) { gGameStatusPtr->nextDemoScene = 0; gGameStatusPtr->demoState = 0; gGameStatusPtr->peachFlags = 0; @@ -96,7 +96,7 @@ void state_step_demo(void) { gGameStatusPtr->isBattle = 0; gGameStatusPtr->unk_76 = 0; gGameStatusPtr->disableScripts = 0; - gGameStatusPtr->unk_7D = 0; + gGameStatusPtr->keepUsingPartnerOnMapChange = 0; gOverrideFlags &= -9; general_heap_create(&gOverrideFlags); clear_render_tasks(); diff --git a/src/state_intro.c b/src/state_intro.c index b68d84abbf..9ac1855a15 100644 --- a/src/state_intro.c +++ b/src/state_intro.c @@ -7,7 +7,7 @@ extern s32 D_800A0950; void state_init_intro(void) { s8 unk_A8; - gGameStatusPtr->loadMenuState = 0; + gGameStatusPtr->introState = 0; set_curtain_scale_goal(1.0f); set_curtain_fade_goal(0.3f); @@ -82,36 +82,36 @@ void state_step_intro(void) { D_800A0964 = 1; } - if (D_800A0964 == 1 && (gGameStatusPtr->loadMenuState == 0 || gGameStatusPtr->loadMenuState == 1 || - gGameStatusPtr->loadMenuState == 4)) { + if (D_800A0964 == 1 && (gGameStatusPtr->introState == 0 || gGameStatusPtr->introState == 1 || + gGameStatusPtr->introState == 4)) { gGameStatusPtr->creditsViewportMode = 100; state_init_intro(); return; } - if (D_800A0964 == 2 && (gGameStatusPtr->loadMenuState == 0 || gGameStatusPtr->loadMenuState == 1 || - gGameStatusPtr->loadMenuState == 4)) { + if (D_800A0964 == 2 && (gGameStatusPtr->introState == 0 || gGameStatusPtr->introState == 1 || + gGameStatusPtr->introState == 4)) { gGameStatusPtr->creditsViewportMode++; state_init_intro(); return; } } - switch (gGameStatusPtr->loadMenuState) { + switch (gGameStatusPtr->introState) { case 0: update_effects(); update_cameras(); if (gGameStatusPtr->creditsViewportMode == -1) { set_curtain_fade_goal(0.0f); if (intro_logos_fade_out(D_800A0956)) { - gGameStatusPtr->loadMenuState = 1; + gGameStatusPtr->introState = 1; set_curtain_draw_callback(NULL); } } else { D_800A0954 += D_800A0956; if (D_800A0954 >= 0xFF) { D_800A0954 = 0xFF; - gGameStatusPtr->loadMenuState = 1; + gGameStatusPtr->introState = 1; set_curtain_draw_callback(NULL); } } @@ -120,14 +120,14 @@ void state_step_intro(void) { D_800A0950 = 4; gOverrideFlags |= 8; if (D_800A0960 != 0xE) { - gGameStatusPtr->loadMenuState = 2; + gGameStatusPtr->introState = 2; } break; case 21: D_800A0950--; if (D_800A0950 <= 0) { gOverrideFlags &= -9; - gGameStatusPtr->loadMenuState = 2; + gGameStatusPtr->introState = 2; } break; case 2: @@ -135,7 +135,7 @@ void state_step_intro(void) { gGameStatusPtr->isBattle = 0; gGameStatusPtr->unk_76 = 0; gGameStatusPtr->disableScripts = 0; - gGameStatusPtr->unk_7D = 0; + gGameStatusPtr->keepUsingPartnerOnMapChange = 0; if (gGameStatusPtr->creditsViewportMode == -1) { general_heap_create(); @@ -185,7 +185,7 @@ void state_step_intro(void) { playerData->currentPartner = 0; load_map_by_IDs(gGameStatusPtr->areaID, gGameStatusPtr->mapID, 0); - gGameStatusPtr->loadMenuState = 3; + gGameStatusPtr->introState = 3; disable_player_input(); break; case 3: @@ -203,7 +203,7 @@ void state_step_intro(void) { update_cameras(); if (!does_script_exist(gGameStatusPtr->mainScriptID)) { gGameStatusPtr->prevArea = gGameStatusPtr->areaID; - gGameStatusPtr->loadMenuState = 4; + gGameStatusPtr->introState = 4; break; } return; diff --git a/src/state_logos.c b/src/state_logos.c index c9b5521a62..9143f4de02 100644 --- a/src/state_logos.c +++ b/src/state_logos.c @@ -16,8 +16,8 @@ void state_init_logos(void) { s32* temp_800A0910; general_heap_create(); - gGameStatusPtr->loadMenuState = 0; - gGameStatusPtr->menuCounter = 0; + gGameStatusPtr->introState = 0; + gGameStatusPtr->introCounter = 0; gGameStatusPtr->bSkipIntro = FALSE; intro_logos_set_fade_alpha(255); intro_logos_set_fade_color(0); @@ -75,7 +75,7 @@ void state_init_logos(void) { clear_effect_data(); gOverrideFlags |= 0x2; intro_logos_update_fade(); - gGameStatusPtr->enableBackground = FALSE; + gGameStatusPtr->backgroundFlags = FALSE; } void state_step_logos(void) { @@ -86,73 +86,73 @@ void state_step_logos(void) { set_game_mode(2); } } else { - switch (gGameStatusPtr->loadMenuState) { + switch (gGameStatusPtr->introState) { case 1: - if (gGameStatusPtr->menuCounter == 0) { + if (gGameStatusPtr->introCounter == 0) { intro_logos_set_fade_color(208); - gGameStatusPtr->loadMenuState++; + gGameStatusPtr->introState++; } - gGameStatusPtr->menuCounter--; + gGameStatusPtr->introCounter--; break; case 2: if (intro_logos_fade_out(0xA) != 0) { - gGameStatusPtr->loadMenuState++; + gGameStatusPtr->introState++; } break; case 3: if (intro_logos_fade_in(0xA) != 0) { - gGameStatusPtr->loadMenuState++; - gGameStatusPtr->menuCounter = 40; + gGameStatusPtr->introState++; + gGameStatusPtr->introCounter = 40; } break; case 4: - if (gGameStatusPtr->menuCounter == 0) { - gGameStatusPtr->loadMenuState++; + if (gGameStatusPtr->introCounter == 0) { + gGameStatusPtr->introState++; intro_logos_set_fade_color(208); } - gGameStatusPtr->menuCounter--; + gGameStatusPtr->introCounter--; break; case 5: if (intro_logos_fade_out(0xA) != 0) { - gGameStatusPtr->loadMenuState++; + gGameStatusPtr->introState++; } break; case 0: case 6: if (intro_logos_fade_in(0xA) != 0) { - gGameStatusPtr->loadMenuState++; - gGameStatusPtr->menuCounter = 30; + gGameStatusPtr->introState++; + gGameStatusPtr->introCounter = 30; } break; case 7: - if (gGameStatusPtr->menuCounter == 0) { - gGameStatusPtr->loadMenuState++; + if (gGameStatusPtr->introCounter == 0) { + gGameStatusPtr->introState++; intro_logos_set_fade_color(208); - gGameStatusPtr->menuCounter = 30; + gGameStatusPtr->introCounter = 30; } - gGameStatusPtr->menuCounter--; + gGameStatusPtr->introCounter--; break; case 8: - if (gGameStatusPtr->menuCounter == 0) { - gGameStatusPtr->loadMenuState++; + if (gGameStatusPtr->introCounter == 0) { + gGameStatusPtr->introState++; set_curtain_scale_goal(1.0f); set_curtain_draw_callback(NULL); set_curtain_fade_goal(0.3f); } else { - gGameStatusPtr->menuCounter--; + gGameStatusPtr->introCounter--; } break; case 9: if (intro_logos_fade_out(0xA) != 0) { - gGameStatusPtr->menuCounter = 15; - gGameStatusPtr->loadMenuState++; + gGameStatusPtr->introCounter = 15; + gGameStatusPtr->introState++; } break; case 10: - if (gGameStatusPtr->menuCounter == 0) { - gGameStatusPtr->loadMenuState++; + if (gGameStatusPtr->introCounter == 0) { + gGameStatusPtr->introState++; } else { - gGameStatusPtr->menuCounter--; + gGameStatusPtr->introCounter--; } break; case 11: diff --git a/src/state_pause.c b/src/state_pause.c index e9c51bd8f3..d0a9dcf58c 100644 --- a/src/state_pause.c +++ b/src/state_pause.c @@ -40,8 +40,8 @@ void state_step_pause(void) { D_800A0920 = 4; D_800A0921 = 2; gOverrideFlags |= 0x8; - gGameStatusPtr->enableBackground &= ~0xF0; - gGameStatusPtr->enableBackground |= 0x10; + gGameStatusPtr->backgroundFlags &= ~0xF0; + gGameStatusPtr->backgroundFlags |= 0x10; } break; @@ -140,7 +140,7 @@ void state_step_unpause(void) { mapConfig = get_current_map_header(); map = &gAreas[gGameStatusPtr->areaID].maps[gGameStatusPtr->mapID]; gGameStatusPtr->isBattle = FALSE; - gGameStatusPtr->enableBackground &= ~0xF0; + gGameStatusPtr->backgroundFlags &= ~0xF0; func_8005AF84(); func_8002ACDC(); nuContRmbForceStopEnd(); diff --git a/src/state_startup.c b/src/state_startup.c index 2efcb612e8..70f60b485b 100644 --- a/src/state_startup.c +++ b/src/state_startup.c @@ -5,15 +5,15 @@ void state_init_startup(void) { gOverrideFlags |= 0x8; - gGameStatusPtr->loadMenuState = 3; + gGameStatusPtr->introState = 3; } void state_step_startup(void) { GameStatus* gameStatus = gGameStatusPtr; s32 i; - if (gameStatus->loadMenuState != 0) { - gameStatus->loadMenuState--; + if (gameStatus->introState != 0) { + gameStatus->introState--; return; } @@ -25,7 +25,7 @@ void state_step_startup(void) { gameStatus->entryID = 0; gGameStatusPtr->unk_76 = 0; gGameStatusPtr->disableScripts = 0; - gGameStatusPtr->unk_7D = 0; + gGameStatusPtr->keepUsingPartnerOnMapChange = 0; gGameStatusPtr->creditsViewportMode = -1; gGameStatusPtr->demoFlags = 0; gGameStatusPtr->unk_A9 = -1; @@ -72,11 +72,11 @@ void state_step_startup(void) { fio_has_valid_backup(); if (D_800D9620 == 0) { - gGameStatusPtr->unk_AB = 1; - func_8005615C(); + gGameStatusPtr->soundOutputMode = SOUND_OUT_STEREO; + audio_set_stereo(); } else { - gGameStatusPtr->unk_AB = 0; - func_80056180(); + gGameStatusPtr->soundOutputMode = SOUND_OUT_MONO; + audio_set_mono(); } gOverrideFlags &= ~0x8; diff --git a/src/state_title_screen.c b/src/state_title_screen.c index e7ce340f30..4bac4886ff 100644 --- a/src/state_title_screen.c +++ b/src/state_title_screen.c @@ -52,7 +52,7 @@ INCLUDE_ASM(void, "state_title_screen", state_init_title_screen, void); INCLUDE_ASM(void, "state_title_screen", state_step_title_screen, void); void state_drawUI_title_screen(void) { - switch (gGameStatusPtr->loadMenuState) { + switch (gGameStatusPtr->introState) { case 0: D_80077A28 = 0; D_80077A2C = 0; diff --git a/src/world/partner/lakilester.c b/src/world/partner/lakilester.c index f38f9468f7..e53029abb7 100644 --- a/src/world/partner/lakilester.c +++ b/src/world/partner/lakilester.c @@ -649,7 +649,7 @@ ApiStatus func_802BF4F0_323040(Evt* script, s32 isInitialCall) { enable_player_input(); } - gGameStatusPtr->unk_7D = 0; + gGameStatusPtr->keepUsingPartnerOnMapChange = 0; D_802BFF0C = 0; partner_clear_player_tracking(lakilester); set_action_state(ACTION_STATE_HIT_FIRE); @@ -674,7 +674,7 @@ ApiStatus func_802BF4F0_323040(Evt* script, s32 isInitialCall) { D_802BFF04 = FALSE; enable_player_input(); } - gGameStatusPtr->unk_7D = 0; + gGameStatusPtr->keepUsingPartnerOnMapChange = 0; D_802BFF0C = 0; partner_clear_player_tracking(lakilester); D_802BFF00++; @@ -716,7 +716,7 @@ void world_lakilester_post_battle(Npc* npc) { if (partnerActionStatus->actionState.b[1] != 0) { if (D_802BFF0C) { *npc = partnerActionStatus->npc; - gGameStatusPtr->unk_7D = 1; + gGameStatusPtr->keepUsingPartnerOnMapChange = 1; set_action_state(ACTION_STATE_RIDE); partnerActionStatus->actionState.b[3] = 0; partnerActionStatus->actionState.b[0] = 0; @@ -786,7 +786,7 @@ s32 func_802BFBA0_3236F0(Evt* script, s32 isInitialCall) { playerStatus->unk_BC = 0; playerStatus->flags |= PLAYER_STATUS_FLAGS_10000000; func_802BFB44_323694(2.0f); - gGameStatusPtr->unk_7D = 1; + gGameStatusPtr->keepUsingPartnerOnMapChange = 1; npc->flags |= NPC_FLAG_100; npc->moveSpeed = *temp_s0_2; npc->jumpScale = 0.0f; diff --git a/src/world/partner/sushie.c b/src/world/partner/sushie.c index 70aa1532d0..70f21058d0 100644 --- a/src/world/partner/sushie.c +++ b/src/world/partner/sushie.c @@ -299,7 +299,7 @@ s32 func_802BFAB8_320828(Evt* script, s32 isInitialCall) { switch (funcTemp0) { case 0: - gGameStatusPtr->unk_7D = 1; + gGameStatusPtr->keepUsingPartnerOnMapChange = 1; disable_player_static_collisions(); disable_player_input(); partnerNPC->pos.x = playerStatus->position.x; diff --git a/src/world/partner/watt.c b/src/world/partner/watt.c index fc1bad380e..1d735db3a1 100644 --- a/src/world/partner/watt.c +++ b/src/world/partner/watt.c @@ -239,7 +239,7 @@ s32 func_802BDD0C_31D87C(Evt* script, s32 isInitialCall) { wattActionStatus->actionState.b[3] = 0; wattActionStatus->actionState.b[0] = 0; playerStatus->animFlags &= ~(PLAYER_STATUS_ANIM_FLAGS_2 | PLAYER_STATUS_ANIM_FLAGS_HOLDING_WATT); - gGameStatusPtr->unk_7D = 0; + gGameStatusPtr->keepUsingPartnerOnMapChange = 0; } if (partner_put_away(watt)) { @@ -304,7 +304,7 @@ ApiStatus func_802BDE88_31D9F8(Evt* script, s32 isInitialCall) { watt->flags &= ~NPC_FLAG_GRAVITY; watt->flags |= NPC_FLAG_100; playerStatus->animFlags |= PLAYER_STATUS_ANIM_FLAGS_2 | PLAYER_STATUS_ANIM_FLAGS_HOLDING_WATT; - gGameStatusPtr->unk_7D = 1; + gGameStatusPtr->keepUsingPartnerOnMapChange = 1; wattActionStatus->actionState.b[0] = 1; wattActionStatus->actionState.b[3] = 6; D_802BE308 = 0; diff --git a/src/world/partners.c b/src/world/partners.c index 11f645d559..5db3141032 100644 --- a/src/world/partners.c +++ b/src/world/partners.c @@ -533,9 +533,9 @@ void partner_reset_data(void) { D_8010CFE8 = 9; D_8010CFD8 = currentPartner; - if (gGameStatusPtr->unk_7D != 0) { + if (gGameStatusPtr->keepUsingPartnerOnMapChange != 0) { gPartnerActionStatus.actionState.b[0] = 1; - gGameStatusPtr->unk_7D = 0; + gGameStatusPtr->keepUsingPartnerOnMapChange = 0; } wPartner = NULL; diff --git a/ver/us/asm/nonmatchings/165490/filemenu_main_handle_input.s b/ver/us/asm/nonmatchings/165490/filemenu_main_handle_input.s index 37d3f47b56..28875b4637 100644 --- a/ver/us/asm/nonmatchings/165490/filemenu_main_handle_input.s +++ b/ver/us/asm/nonmatchings/165490/filemenu_main_handle_input.s @@ -225,12 +225,12 @@ glabel filemenu_main_handle_input /* 166598 80245D38 904200AB */ lbu $v0, 0xab($v0) /* 16659C 80245D3C 10400005 */ beqz $v0, .L80245D54 /* 1665A0 80245D40 00000000 */ nop -/* 1665A4 80245D44 0C015857 */ jal func_8005615C +/* 1665A4 80245D44 0C015857 */ jal audio_set_stereo /* 1665A8 80245D48 00000000 */ nop /* 1665AC 80245D4C 08091757 */ j .L80245D5C /* 1665B0 80245D50 00000000 */ nop .L80245D54: -/* 1665B4 80245D54 0C015860 */ jal func_80056180 +/* 1665B4 80245D54 0C015860 */ jal audio_set_mono /* 1665B8 80245D58 00000000 */ nop .L80245D5C: /* 1665BC 80245D5C 3C038025 */ lui $v1, %hi(filemenu_pressedButtons) diff --git a/ver/us/symbol_addrs.txt b/ver/us/symbol_addrs.txt index 9b7e3151ac..e62c4cd522 100644 --- a/ver/us/symbol_addrs.txt +++ b/ver/us/symbol_addrs.txt @@ -740,8 +740,8 @@ func_800560A8 = 0x800560A8; // type:func rom:0x314A8 func_800560BC = 0x800560BC; // type:func rom:0x314BC func_8005610C = 0x8005610C; // type:func rom:0x3150C func_80056144 = 0x80056144; // type:func rom:0x31544 -func_8005615C = 0x8005615C; // type:func rom:0x3155C -func_80056180 = 0x80056180; // type:func rom:0x31580 +audio_set_stereo = 0x8005615C; // type:func rom:0x3155C +audio_set_mono = 0x80056180; // type:func rom:0x31580 func_800561A4 = 0x800561A4; // type:func rom:0x315A4 func_800561C4 = 0x800561C4; // type:func rom:0x315C4 func_800561E4 = 0x800561E4; // type:func rom:0x315E4