From 2209585b2fe567248c9539cb24c9ee0f60423baf Mon Sep 17 00:00:00 2001 From: HailSanta Date: Mon, 9 Oct 2023 02:11:31 -0400 Subject: [PATCH] mostly startup stuff --- include/common_structs.h | 28 +- include/effects.h | 2 +- include/enums.h | 53 ++-- include/functions.h | 12 +- include/variables.h | 2 +- src/111f0_len_860.c | 113 +++++--- src/16F740.c | 120 ++++---- src/16c8e0.c | 66 ++--- src/415D90.c | 12 +- src/80850_len_3060.c | 2 +- src/8800.c | 8 +- src/actor_api.c | 26 +- src/background_gfx.c | 2 +- src/battle/actor_rendering.c | 21 +- src/battle/area/hos/actor/goombario_tutor.c | 8 +- src/battle/area/trd_part_3/actor/eldstar.c | 4 +- src/battle/battle.c | 4 +- src/battle/level_up.c | 2 +- src/battle/move/jump/attack.c | 8 +- src/battle/partner/bow.c | 2 +- src/battle/partner/watt.c | 6 +- src/cd180_len_38f0.c | 4 +- src/effects/partner_buff.c | 6 +- src/entity.c | 2 +- src/game_modes.c | 38 +-- src/imgfx.c | 4 +- src/intro_logos.c | 40 --- src/main_loop.c | 30 +- src/sprite.c | 4 +- src/startup_screen_fading.c | 45 +++ src/state_battle.c | 10 +- src/state_demo.c | 24 +- src/state_file_select.c | 18 +- src/state_intro.c | 197 +++++++------ src/state_logos.c | 204 ++++++------- src/state_pause.c | 10 +- src/state_startup.c | 16 +- src/state_title_screen.c | 304 +++++++++++--------- src/world/area_gv/gv_01/gv_01_1_main.c | 8 +- src/world/area_hos/common/Narrator.inc.c | 2 +- src/world/area_hos/hos_04/hos_04_6_intro.c | 10 +- src/world/area_hos/hos_05/hos_05_5_intro.c | 4 +- src/world/area_hos/hos_10/hos_10_5_intro.c | 10 +- src/world/world.c | 10 +- ver/ique/asm/bss.s | 20 +- ver/ique/splat.yaml | 2 +- ver/ique/symbol_addrs.txt | 2 +- ver/jp/asm/main.bss.s | 20 +- ver/jp/splat.yaml | 2 +- ver/pal/undefined_syms.txt | 6 +- ver/us/asm/bss.s | 20 +- ver/us/splat.yaml | 2 +- ver/us/symbol_addrs.txt | 52 ++-- 53 files changed, 839 insertions(+), 788 deletions(-) delete mode 100644 src/intro_logos.c create mode 100644 src/startup_screen_fading.c diff --git a/include/common_structs.h b/include/common_structs.h index 5c7cfde6741..f4a2fb8f0bb 100644 --- a/include/common_structs.h +++ b/include/common_structs.h @@ -898,7 +898,7 @@ typedef struct BattleStatus { /* 0x092 */ s8 reflectFlags; /* 0x093 */ s8 unk_93; /* 0x094 */ s8 unk_94; - /* 0x095 */ s8 unk_95; + /* 0x095 */ s8 waitForState; /* 0x096 */ s8 hammerCharge; /* 0x097 */ s8 jumpCharge; /* 0x098 */ char unk_98; @@ -1412,17 +1412,17 @@ typedef struct GameStatus { /* 0x07A */ b8 musicEnabled; /* 0x07B */ char unk_7B; /* 0x07C */ b8 healthBarsEnabled; - /* 0x07D */ s8 keepUsingPartnerOnMapChange; + /* 0x07D */ b8 keepUsingPartnerOnMapChange; /* 0x07E */ u8 peachFlags; /* (1 = isPeach, 2 = isTransformed, 4 = hasUmbrella) */ /* 0x07F */ s8 peachDisguise; /* (1 = koopatrol, 2 = hammer bros, 3 = clubba) */ /* 0x080 */ u8 peachBakingIngredient; ///< @see enum PeachBakingItems /* 0x081 */ b8 multiplayerEnabled; - /* 0x082 */ Vec2b unk_82; + /* 0x082 */ Vec2b altViewportOffset; /* 0x084 */ s8 playerSpriteSet; /* 0x085 */ char unk_85; /* 0x086 */ s16 areaID; /* 0x088 */ s16 prevArea; - /* 0x08A */ s16 didAreaChange; + /* 0x08A */ b16 didAreaChange; /* 0x08C */ s16 mapID; /* 0x08E */ s16 entryID; /* 0x090 */ u16 unk_90; @@ -1430,20 +1430,20 @@ typedef struct GameStatus { /* 0x094 */ f32 exitTangent; /* 0x098 */ Vec3f playerPos; /* 0x0A4 */ f32 playerYaw; - /* 0x0A8 */ s8 creditsViewportMode; + /* 0x0A8 */ s8 introPart; /* 0x0A9 */ s8 unk_A9; // selected language? /* 0x0AA */ s8 demoBattleFlags; /* 0x0AB */ u8 soundOutputMode; - /* 0x0AC */ s8 introState; - /* 0x0AD */ s8 introCounter; - /* 0x0AE */ s8 bSkipIntro; - /* 0x0AF */ s8 unk_AF; - /* 0x0B0 */ s8 unk_B0; + /* 0x0AC */ s8 startupState; // used for various startup states like logos, title screen, intro, and demo + /* 0x0AD */ s8 logoTime; + /* 0x0AE */ b8 skipLogos; + /* 0x0AF */ s8 titleScreenTimer; + /* 0x0B0 */ s8 titleScreenDismissTime; /* 0x0B1 */ char unk_B1[0x5]; - /* 0x0B6 */ s16 bootAlpha; - /* 0x0B8 */ s16 bootBlue; - /* 0x0BA */ s16 bootGreen; - /* 0x0BC */ s16 bootRed; + /* 0x0B6 */ s16 screenColorA; + /* 0x0B8 */ s16 screenColorR; + /* 0x0BA */ s16 screenColorG; + /* 0x0BC */ s16 screenColorB; /* 0x0BE */ char unk_BE[94]; /* 0x11C */ Vec3f playerGroundTraceAngles; /* 0x128 */ Vec3f playerGroundTraceNormal; diff --git a/include/effects.h b/include/effects.h index bae47798c0d..d2e71d6bb62 100644 --- a/include/effects.h +++ b/include/effects.h @@ -2319,7 +2319,7 @@ typedef struct BuffData { typedef struct PartnerBuffFXData { /* 0x00 */ s16 useRandomValues; - /* 0x02 */ s16 unk_02; + /* 0x02 */ s16 visible; /* 0x04 */ s32 timeLeft; /* 0x08 */ s32 lifeTime; /* 0x0C */ BuffData unk_0C[3]; diff --git a/include/enums.h b/include/enums.h index c599fb64fbc..6dc0acfc456 100644 --- a/include/enums.h +++ b/include/enums.h @@ -2365,8 +2365,8 @@ typedef enum ScreenOverlayType { OVERLAY_WORLD_DARKNESS = 11, OVERLAY_BLUR = 12, OVERLAY_BATTLE_DARKNESS = 13, - OVERLAY_UNUSED_1 = 14, - OVERLAY_UNUSED_2 = 15, + OVERLAY_INTRO_1 = 14, + OVERLAY_INTRO_2 = 15, } ScreenOverlayType; enum DoorSounds { @@ -3487,36 +3487,19 @@ enum DemoFlags { DEMO_BTL_FLAG_40 = 0x40, }; +enum IntroParts { + INTRO_PART_0 = 0, + INTRO_PART_1 = 1, + INTRO_PART_5 = 5, + INTRO_PART_100 = 100, + INTRO_PART_NONE = -1, +}; + enum MapLoadType { LOAD_FROM_MAP = 0, LOAD_FROM_FILE_SELECT = 1, }; -enum IntroStates { - INTRO_STATE_0 = 0x00000000, - INTRO_STATE_1 = 0x00000001, - INTRO_STATE_2 = 0x00000002, - INTRO_STATE_3 = 0x00000003, - INTRO_STATE_4 = 0x00000004, - INTRO_STATE_5 = 0x00000005, - INTRO_STATE_6 = 0x00000006, - INTRO_STATE_7 = 0x00000007, - INTRO_STATE_8 = 0x00000008, - INTRO_STATE_9 = 0x00000009, - INTRO_STATE_A = 0x0000000A, - INTRO_STATE_B = 0x0000000B, - INTRO_STATE_C = 0x0000000C, - INTRO_STATE_D = 0x0000000D, - INTRO_STATE_E = 0x0000000E, - INTRO_STATE_F = 0x0000000F, - INTRO_STATE_10 = 0x00000010, - INTRO_STATE_11 = 0x00000011, - INTRO_STATE_12 = 0x00000012, - INTRO_STATE_13 = 0x00000013, - INTRO_STATE_14 = 0x00000014, - INTRO_STATE_15 = 0x00000015, -}; - enum BattleStatusFlags1 { BS_FLAGS1_ACTORS_VISIBLE = 0x00000001, BS_FLAGS1_MENU_OPEN = 0x00000002, @@ -3553,22 +3536,20 @@ enum BattleStatusFlags1 { }; enum BattleStatusFlags2 { - BS_FLAGS2_1 = 0x00000001, - BS_FLAGS2_2 = 0x00000002, - BS_FLAGS2_4 = 0x00000004, + BS_FLAGS2_AWARDING_STAR_POINTS = 0x00000001, // star points move to the center of the screen + BS_FLAGS2_PLAYER_TURN_USED = 0x00000002, // set after player has used their action for this turn + BS_FLAGS2_PARTNER_TURN_USED = 0x00000004, // set after partner has used their action for this turn BS_FLAGS2_8 = 0x00000008, BS_FLAGS2_10 = 0x00000010, BS_FLAGS2_CANT_FLEE = 0x00000020, BS_FLAGS2_PEACH_BATTLE = 0x00000040, - BS_FLAGS2_80 = 0x00000080, - BS_FLAGS2_100 = 0x00000100, // dont decrement turbo charge on begin player turn - BS_FLAGS2_200 = 0x00000200, + BS_FLAGS2_STORED_TURBO_CHARGE_TURN = 0x00000100, // prevents turbo charge turns from decrementing on begin player turn + BS_FLAGS2_DOING_JUMP_TUTORIAL = 0x00000200, BS_FLAGS2_400 = 0x00000400, - BS_FLAGS2_800 = 0x00000800, BS_FLAGS2_NO_TARGET_AVAILABLE = 0x00001000, BS_FLAGS2_IGNORE_DARKNESS = 0x00004000, BS_FLAGS2_10000 = 0x00010000, - BS_FLAGS2_100000 = 0x00100000, + BS_FLAGS2_NO_PLAYER_PAL_ADJUST = 0x00100000, BS_FLAGS2_IS_FIRST_STRIKE = 0x01000000, BS_FLAGS2_DONT_STOP_MUSIC = 0x02000000, // don't stop playing the current song when the battle ends BS_FLAGS2_HAS_DRAINED_HP = 0x04000000, @@ -4218,7 +4199,7 @@ enum DebuffTypes { enum GlobalOverrides { GLOBAL_OVERRIDES_DISABLE_RENDER_WORLD = 0x00000002, - GLOBAL_OVERRIDES_8 = 0x00000008, + GLOBAL_OVERRIDES_DISABLE_DRAW_FRAME = 0x00000008, GLOBAL_OVERRIDES_10 = 0x00000010, GLOBAL_OVERRIDES_ENABLE_TRANSITION_STENCIL = 0x00000020, GLOBAL_OVERRIDES_40 = 0x00000040, diff --git a/include/functions.h b/include/functions.h index ae647796657..9d102a29fc8 100644 --- a/include/functions.h +++ b/include/functions.h @@ -54,9 +54,9 @@ s32 is_picking_up_item(void); f32 integrate_gravity(void); void gravity_use_fall_parms(void); f32 get_clamped_angle_diff(f32, f32); -s32 intro_logos_fade_in(s16 subtractAlpha); -s32 intro_logos_fade_out(s16 addAlpha); -void intro_logos_update_fade(void); +b32 startup_fade_screen_in(s16 subtractAlpha); +b32 startup_fade_screen_out(s16 addAlpha); +void startup_fade_screen_update(void); u32 get_entity_type(s32 arg0); Entity* get_entity_by_index(s32 index); @@ -279,8 +279,8 @@ s32 test_ray_entities(f32 startX, f32 startY, f32 startZ, f32 dirX, f32 dirY, f3 void mem_clear(void* data, s32 numBytes); -void intro_logos_set_fade_color(s16 color); -void intro_logos_set_fade_alpha(s16 alpha); +void startup_set_fade_screen_color(s16 color); +void startup_set_fade_screen_alpha(s16 alpha); f32 get_xz_dist_to_player(f32, f32); void func_800E06C0(s32); @@ -1068,7 +1068,7 @@ void clear_sprite_shading_data(void); void clear_character_set(void); void clear_trigger_data(void); void clear_script_list(void); -void clear_entity_data(s32); +void clear_entity_data(b32); void clear_effect_data(void); void clear_saved_variables(void); diff --git a/include/variables.h b/include/variables.h index 7d2feff7538..c80a20801f1 100644 --- a/include/variables.h +++ b/include/variables.h @@ -98,7 +98,7 @@ extern s32 gEncounterSubState; extern s32 timeFreezeMode; extern s32 D_8009A678; -extern u8 D_800779B0; +extern u8 IntroMessageIdx; extern s32 PartnerIDFromMenuIndex[12]; // partner IDs // Scripts diff --git a/src/111f0_len_860.c b/src/111f0_len_860.c index e94988920a1..51951472f24 100644 --- a/src/111f0_len_860.c +++ b/src/111f0_len_860.c @@ -12,6 +12,12 @@ void set_map_change_fade_rate(s16 fadeRate) { gMapTransitionFadeRate = fadeRate; } +enum EnterWorldStates { + ENTER_WORLD_LOAD_MAP = 0, + ENTER_WORLD_AWAIT_MAIN = 1, + ENTER_WORLD_FADE_IN = 2, +}; + void state_init_enter_demo(void) { gLoadedFromFileSelect = FALSE; init_enter_world_shared(); @@ -24,14 +30,14 @@ void state_init_enter_world(void) { } void init_enter_world_shared(void) { - gMapTransitionState = 0; + gMapTransitionState = ENTER_WORLD_LOAD_MAP; gMapTransitionStateTime = 4; gGameStatusPtr->exitTangent = 0.0f; gMapTransitionAlpha = 255; nuContRmbForceStopEnd(); update_exit_map_screen_overlay(&gMapTransitionAlpha); - gOverrideFlags |= GLOBAL_OVERRIDES_8; + gOverrideFlags |= GLOBAL_OVERRIDES_DISABLE_DRAW_FRAME; evt_set_variable(NULL, GB_Unused_EVT_01, gGameStatusPtr->unk_A9); timeFreezeMode = 0; @@ -39,30 +45,31 @@ void init_enter_world_shared(void) { void state_step_enter_world(void) { switch (gMapTransitionState) { - case 0: - if (gMapTransitionStateTime == 0) { - gGameStatusPtr->isBattle = FALSE; - gGameStatusPtr->disableScripts = FALSE; + case ENTER_WORLD_LOAD_MAP: + if (gMapTransitionStateTime != 0) { + gMapTransitionStateTime--; + break; + } - if (!gLoadedFromFileSelect) { - load_map_by_IDs(gGameStatusPtr->areaID, gGameStatusPtr->mapID, LOAD_FROM_MAP); - } else { - load_map_by_IDs(gGameStatusPtr->areaID, gGameStatusPtr->mapID, LOAD_FROM_FILE_SELECT); - } + gGameStatusPtr->isBattle = FALSE; + gGameStatusPtr->disableScripts = FALSE; - gGameStatusPtr->prevArea = gGameStatusPtr->areaID; - set_time_freeze_mode(TIME_FREEZE_NORMAL); - if (gGameStatusPtr->demoState == DEMO_STATE_NONE) { - disable_player_input(); - } - update_cameras(); - gMapTransitionStateTime = 2; - gMapTransitionState++; + if (!gLoadedFromFileSelect) { + load_map_by_IDs(gGameStatusPtr->areaID, gGameStatusPtr->mapID, LOAD_FROM_MAP); } else { - gMapTransitionStateTime--; + load_map_by_IDs(gGameStatusPtr->areaID, gGameStatusPtr->mapID, LOAD_FROM_FILE_SELECT); } + + gGameStatusPtr->prevArea = gGameStatusPtr->areaID; + set_time_freeze_mode(TIME_FREEZE_NORMAL); + if (gGameStatusPtr->demoState == DEMO_STATE_NONE) { + disable_player_input(); + } + update_cameras(); + gMapTransitionStateTime = 2; + gMapTransitionState++; break; - case 1: + case ENTER_WORLD_AWAIT_MAIN: update_encounters(); update_npcs(); update_player(); @@ -70,12 +77,14 @@ void state_step_enter_world(void) { if (gMapTransitionStateTime != 0) { gMapTransitionStateTime--; - } else if (!does_script_exist(gGameStatusPtr->mainScriptID)) { - gOverrideFlags &= ~GLOBAL_OVERRIDES_8; + break; + } + if (!does_script_exist(gGameStatusPtr->mainScriptID)) { + gOverrideFlags &= ~GLOBAL_OVERRIDES_DISABLE_DRAW_FRAME; gMapTransitionState++; } break; - case 2: + case ENTER_WORLD_FADE_IN: update_npcs(); update_player(); update_effects(); @@ -93,15 +102,24 @@ void state_step_enter_world(void) { } void state_drawUI_enter_world(void) { - if (gGameStatusPtr->introState == INTRO_STATE_2) { + // startupState is being used as a timer here + if (gGameStatusPtr->startupState == 2) { draw_status_ui(); } } +enum ChangeMapStates { + CHANGE_MAP_INIT = 0, + CHANGE_MAP_DELAY = 1, + CHANGE_MAP_LOAD_MAP = 2, + CHANGE_MAP_AWAIT_MAIN = 3, + CHANGE_MAP_FADE_IN = 4, +}; + void state_init_change_map(void) { - gMapTransitionAlpha = 0x00; + gMapTransitionAlpha = 0; gMapTransitionFadeRate = 20; - gMapTransitionState = 0; + gMapTransitionState = CHANGE_MAP_INIT; if (gGameStatusPtr->prevArea != gGameStatusPtr->areaID) { gGameStatusPtr->didAreaChange = TRUE; @@ -113,7 +131,7 @@ void state_init_change_map(void) { void state_step_change_map(void) { switch (gMapTransitionState) { - case 0: + case CHANGE_MAP_INIT: update_npcs(); update_player(); update_effects(); @@ -123,13 +141,13 @@ void state_step_change_map(void) { gMapTransitionState++; } break; - case 1: - gOverrideFlags |= GLOBAL_OVERRIDES_8; + case CHANGE_MAP_DELAY: + gOverrideFlags |= GLOBAL_OVERRIDES_DISABLE_DRAW_FRAME; nuContRmbForceStop(); gMapTransitionStateTime = 4; gMapTransitionState++; break; - case 2: + case CHANGE_MAP_LOAD_MAP: if (gGameStatusPtr->demoState != DEMO_STATE_NONE) { set_game_mode(GAME_MODE_DEMO); } @@ -139,7 +157,7 @@ void state_step_change_map(void) { } else { gGameStatusPtr->isBattle = FALSE; gGameStatusPtr->disableScripts = FALSE; - load_map_by_IDs(gGameStatusPtr->areaID, gGameStatusPtr->mapID, 0); + load_map_by_IDs(gGameStatusPtr->areaID, gGameStatusPtr->mapID, LOAD_FROM_MAP); set_time_freeze_mode(TIME_FREEZE_NORMAL); nuContRmbForceStopEnd(); if (gGameStatusPtr->demoState == DEMO_STATE_NONE) { @@ -150,7 +168,7 @@ void state_step_change_map(void) { gMapTransitionState++; } break; - case 3: + case CHANGE_MAP_AWAIT_MAIN: update_encounters(); update_npcs(); update_player(); @@ -159,11 +177,11 @@ void state_step_change_map(void) { if (gMapTransitionStateTime != 0) { gMapTransitionStateTime--; } else if (!does_script_exist(gGameStatusPtr->mainScriptID)) { - gOverrideFlags &= ~GLOBAL_OVERRIDES_8; + gOverrideFlags &= ~GLOBAL_OVERRIDES_DISABLE_DRAW_FRAME; gMapTransitionState++; } break; - case 4: + case CHANGE_MAP_FADE_IN: update_npcs(); update_player(); update_effects(); @@ -181,47 +199,54 @@ void state_step_change_map(void) { } void state_drawUI_change_map(void) { - if (gMapTransitionState == 4 || gMapTransitionState == 0) { + if (gMapTransitionState == CHANGE_MAP_FADE_IN || gMapTransitionState == CHANGE_MAP_INIT) { draw_status_ui(); } } +enum GameOverStates { + GAME_OVER_INIT = 1, + GAME_OVER_LOAD_MAP = 2, + GAME_OVER_AWAIT_MAIN = 3, + GAME_OVER_FADE_IN = 4, +}; + void state_init_game_over(void) { gMapTransitionAlpha = 255; gMapTransitionFadeRate = 20; - gMapTransitionState = 0x01; + gMapTransitionState = GAME_OVER_INIT; gPlayerStatus.flags |= PS_FLAG_NO_STATIC_COLLISION; } void state_step_game_over(void) { switch (gMapTransitionState) { - case 1: - gOverrideFlags |= GLOBAL_OVERRIDES_8; + case GAME_OVER_INIT: + gOverrideFlags |= GLOBAL_OVERRIDES_DISABLE_DRAW_FRAME; nuContRmbForceStop(); gMapTransitionStateTime = 4; gMapTransitionState++; break; - case 2: + case GAME_OVER_LOAD_MAP: if (gMapTransitionStateTime != 0) { gMapTransitionStateTime--; } else { gGameStatusPtr->isBattle = FALSE; gGameStatusPtr->disableScripts = FALSE; - load_map_by_IDs(gGameStatusPtr->areaID, gGameStatusPtr->mapID, 0); + load_map_by_IDs(gGameStatusPtr->areaID, gGameStatusPtr->mapID, LOAD_FROM_MAP); nuContRmbForceStopEnd(); gMapTransitionState++; } break; - case 3: + case GAME_OVER_AWAIT_MAIN: update_encounters(); update_npcs(); if (!does_script_exist(gGameStatusPtr->mainScriptID)) { - gOverrideFlags &= ~GLOBAL_OVERRIDES_8; + gOverrideFlags &= ~GLOBAL_OVERRIDES_DISABLE_DRAW_FRAME; gMapTransitionState++; break; } return; - case 4: + case GAME_OVER_FADE_IN: gMapTransitionAlpha -= gMapTransitionFadeRate; if (gMapTransitionAlpha < 0) { gMapTransitionAlpha = 0; diff --git a/src/16F740.c b/src/16F740.c index acadb066437..854e6c6eba0 100644 --- a/src/16F740.c +++ b/src/16F740.c @@ -278,7 +278,7 @@ void btl_state_update_normal_start(void) { gBattleStatus.flags2 &= ~BS_FLAGS2_CANT_FLEE; } battleStatus->endBattleFadeOutRate = 10; - battleStatus->unk_95 = 0; + battleStatus->waitForState = BATTLE_STATE_0; battleStatus->hammerLossTurns = -1; battleStatus->jumpLossTurns = -1; battleStatus->itemLossTurns = -1; @@ -300,12 +300,12 @@ void btl_state_update_normal_start(void) { battleStatus->hustleTurns = 0; battleStatus->unk_93 = 0; battleStatus->unk_94 = 0; - gBattleStatus.flags2 &= ~BS_FLAGS2_2; - gBattleStatus.flags2 &= ~BS_FLAGS2_4; + gBattleStatus.flags2 &= ~BS_FLAGS2_PLAYER_TURN_USED; + gBattleStatus.flags2 &= ~BS_FLAGS2_PARTNER_TURN_USED; gBattleStatus.flags2 &= ~BS_FLAGS2_8; gBattleStatus.flags2 &= ~BS_FLAGS2_10; - gBattleStatus.flags2 &= ~BS_FLAGS2_100; - gBattleStatus.flags2 &= ~BS_FLAGS2_200; + gBattleStatus.flags2 &= ~BS_FLAGS2_STORED_TURBO_CHARGE_TURN; + gBattleStatus.flags2 &= ~BS_FLAGS2_DOING_JUMP_TUTORIAL; for (i = 0; i < ARRAY_COUNT(battleStatus->varTable); i++) { battleStatus->varTable[i] = 0; @@ -535,8 +535,8 @@ void btl_state_update_begin_turn(void) { s16* enemyIDs; if (gBattleSubState == BTL_SUBSTATE_BEGIN_TURN_INIT) { - battleStatus->flags2 &= ~BS_FLAGS2_2; - battleStatus->flags2 &= ~BS_FLAGS2_4; + battleStatus->flags2 &= ~BS_FLAGS2_PLAYER_TURN_USED; + battleStatus->flags2 &= ~BS_FLAGS2_PARTNER_TURN_USED; battleStatus->flags2 &= ~BS_FLAGS2_8; battleStatus->flags2 &= ~BS_FLAGS2_10; battleStatus->merleeAttackBoost = 0; @@ -754,7 +754,7 @@ void btl_state_update_begin_player_turn(void) { if (!does_script_exist(partner->handleBatttlePhaseScriptID)) { battleStatus->outtaSightActive = 0; gBattleSubState = BTL_SUBSTATE_BEGIN_PLAYER_TURN_CHECK_WATER_BLOCK; - gBattleStatus.flags2 |= BS_FLAGS2_4; + gBattleStatus.flags2 |= BS_FLAGS2_PARTNER_TURN_USED; } break; } @@ -818,8 +818,8 @@ void btl_state_update_begin_player_turn(void) { switch (gBattleSubState) { case BTL_SUBSTATE_BEGIN_PLAYER_TURN_CHECK_TURBO_CHARGE: if (battleStatus->turboChargeTurnsLeft != 0) { - if (gBattleStatus.flags2 & BS_FLAGS2_100) { - gBattleStatus.flags2 &= ~BS_FLAGS2_100; + if (gBattleStatus.flags2 & BS_FLAGS2_STORED_TURBO_CHARGE_TURN) { + gBattleStatus.flags2 &= ~BS_FLAGS2_STORED_TURBO_CHARGE_TURN; gBattleSubState = BTL_SUBSTATE_BEGIN_PLAYER_TURN_TRY_STATUS_DAMAGE; } else { battleStatus->turboChargeTurnsLeft--; @@ -1049,7 +1049,7 @@ void btl_state_update_begin_player_turn(void) { btl_set_state(BATTLE_STATE_SWITCH_TO_PLAYER); } else{ btl_set_state(BATTLE_STATE_BEGIN_PARTNER_TURN); - gBattleStatus.flags2 |= BS_FLAGS2_2; + gBattleStatus.flags2 |= BS_FLAGS2_PLAYER_TURN_USED; } } } @@ -1102,7 +1102,7 @@ void btl_state_update_begin_partner_turn(void) { if (partner == NULL) { D_8029F254 = TRUE; gBattleSubState = BTL_SUBSTATE_BEGIN_PARTNER_TURN_END_DELAY; - } else if ((battleStatus->flags2 & (BS_FLAGS2_4 | BS_FLAGS2_2)) != (BS_FLAGS2_4 | BS_FLAGS2_2)) { + } else if ((battleStatus->flags2 & (BS_FLAGS2_PARTNER_TURN_USED | BS_FLAGS2_PLAYER_TURN_USED)) != (BS_FLAGS2_PARTNER_TURN_USED | BS_FLAGS2_PLAYER_TURN_USED)) { if (!(partner->flags & ACTOR_FLAG_NO_ATTACK)) { btl_cam_use_preset(BTL_CAM_DEFAULT); btl_cam_move(5); @@ -1191,11 +1191,11 @@ void btl_state_update_begin_partner_turn(void) { D_8029F258--; return; } - gBattleStatus.flags2 &= ~BS_FLAGS2_100000; + gBattleStatus.flags2 &= ~BS_FLAGS2_NO_PLAYER_PAL_ADJUST; if (!D_8029F254) { btl_set_state(BATTLE_STATE_SWITCH_TO_PARTNER); } else { - gBattleStatus.flags2 |= BS_FLAGS2_4; + gBattleStatus.flags2 |= BS_FLAGS2_PARTNER_TURN_USED; btl_set_state(BATTLE_STATE_9); } } @@ -1247,31 +1247,31 @@ void btl_state_update_9(void) { s32 oldKoDuration; if (gBattleSubState == BTL_SUBSTATE_9_INIT) { - if (gBattleStatus.flags2 & BS_FLAGS2_2) { - if (partner != NULL) { - if (!(gBattleStatus.flags2 & BS_FLAGS2_4) && !(partner->flags & ACTOR_FLAG_NO_ATTACK)) { - btl_set_state(BATTLE_STATE_SWITCH_TO_PARTNER); - return; - } - } + if (!(gBattleStatus.flags2 & BS_FLAGS2_PLAYER_TURN_USED)) { + btl_set_state(BATTLE_STATE_SWITCH_TO_PLAYER); + return; + } - player->flags &= ~ACTOR_FLAG_SHOW_STATUS_ICONS; - player->flags |= ACTOR_FLAG_USING_IDLE_ANIM; - if (partner != NULL) { - partner->flags &= ~ACTOR_FLAG_SHOW_STATUS_ICONS; - partner->flags |= ACTOR_FLAG_USING_IDLE_ANIM; + if (partner != NULL) { + if (!(gBattleStatus.flags2 & BS_FLAGS2_PARTNER_TURN_USED) && !(partner->flags & ACTOR_FLAG_NO_ATTACK)) { + btl_set_state(BATTLE_STATE_SWITCH_TO_PARTNER); + return; } + } - gBattleSubState = BTL_SUBSTATE_9_1; - D_8029F258 = 0; - gBattleStatus.flags2 &= ~BS_FLAGS2_2; - gBattleStatus.flags2 &= ~BS_FLAGS2_4; - gBattleStatus.flags2 &= ~BS_FLAGS2_8; - gBattleStatus.flags2 &= ~BS_FLAGS2_10; - } else { - btl_set_state(BATTLE_STATE_SWITCH_TO_PLAYER); - return; + player->flags &= ~ACTOR_FLAG_SHOW_STATUS_ICONS; + player->flags |= ACTOR_FLAG_USING_IDLE_ANIM; + if (partner != NULL) { + partner->flags &= ~ACTOR_FLAG_SHOW_STATUS_ICONS; + partner->flags |= ACTOR_FLAG_USING_IDLE_ANIM; } + + gBattleSubState = BTL_SUBSTATE_9_1; + D_8029F258 = 0; + gBattleStatus.flags2 &= ~BS_FLAGS2_PLAYER_TURN_USED; + gBattleStatus.flags2 &= ~BS_FLAGS2_PARTNER_TURN_USED; + gBattleStatus.flags2 &= ~BS_FLAGS2_8; + gBattleStatus.flags2 &= ~BS_FLAGS2_10; } if (gBattleSubState == BTL_SUBSTATE_9_1) { @@ -1297,13 +1297,13 @@ void btl_state_update_9(void) { actor->flags &= ~ACTOR_FLAG_SKIP_TURN; if (actor->debuff != 0) { - if (actor->debuff == STATUS_KEY_FEAR || - actor->debuff == STATUS_KEY_DIZZY || - actor->debuff == STATUS_KEY_PARALYZE || - actor->debuff == STATUS_KEY_SLEEP || - actor->debuff == STATUS_KEY_FROZEN || - actor->debuff == STATUS_KEY_STOP) - { + if (actor->debuff == STATUS_KEY_FEAR + || actor->debuff == STATUS_KEY_DIZZY + || actor->debuff == STATUS_KEY_PARALYZE + || actor->debuff == STATUS_KEY_SLEEP + || actor->debuff == STATUS_KEY_FROZEN + || actor->debuff == STATUS_KEY_STOP + ) { actor->flags |= ACTOR_FLAG_SKIP_TURN; } actor->debuffDuration--; @@ -1484,8 +1484,8 @@ void btl_state_update_9(void) { partner->flags |= ACTOR_FLAG_USING_IDLE_ANIM; } gBattleSubState = BTL_SUBSTATE_9_5; - gBattleStatus.flags2 &= ~BS_FLAGS2_2; - gBattleStatus.flags2 &= ~BS_FLAGS2_4; + gBattleStatus.flags2 &= ~BS_FLAGS2_PLAYER_TURN_USED; + gBattleStatus.flags2 &= ~BS_FLAGS2_PARTNER_TURN_USED; gBattleStatus.flags2 &= ~BS_FLAGS2_8; gBattleStatus.flags2 &= ~BS_FLAGS2_10; } @@ -1781,8 +1781,8 @@ void btl_state_update_victory(void) { partner->flags &= ~(ACTOR_FLAG_SHOW_STATUS_ICONS | ACTOR_FLAG_USING_IDLE_ANIM); } gBattleSubState = BTL_SUBSTATE_VICTORY_CHECK_SWAP; - gBattleStatus.flags2 &= ~BS_FLAGS2_2; - gBattleStatus.flags2 &= ~BS_FLAGS2_4; + gBattleStatus.flags2 &= ~BS_FLAGS2_PLAYER_TURN_USED; + gBattleStatus.flags2 &= ~BS_FLAGS2_PARTNER_TURN_USED; gBattleStatus.flags2 &= ~BS_FLAGS2_8; gBattleStatus.flags2 &= ~BS_FLAGS2_10; @@ -1954,8 +1954,8 @@ void btl_state_update_end_training_battle(void) { partner->flags &= ~(ACTOR_FLAG_SHOW_STATUS_ICONS | ACTOR_FLAG_USING_IDLE_ANIM); } gBattleSubState = BTL_SUBSTATE_END_TRAINING_CHECK_OUTTA_SIGHT; - gBattleStatus.flags2 &= ~BS_FLAGS2_2; - gBattleStatus.flags2 &= ~BS_FLAGS2_4; + gBattleStatus.flags2 &= ~BS_FLAGS2_PLAYER_TURN_USED; + gBattleStatus.flags2 &= ~BS_FLAGS2_PARTNER_TURN_USED; gBattleStatus.flags2 &= ~BS_FLAGS2_8; gBattleStatus.flags2 &= ~BS_FLAGS2_10; @@ -2004,8 +2004,8 @@ void btl_state_update_end_training_battle(void) { switch (gBattleSubState) { case BTL_SUBSTATE_END_TRAINING_CHECK_OUTTA_SIGHT: battleStatus->stateFreezeCount = 0; - gBattleStatus.flags2 &= ~BS_FLAGS2_2; - gBattleStatus.flags2 &= ~BS_FLAGS2_4; + gBattleStatus.flags2 &= ~BS_FLAGS2_PLAYER_TURN_USED; + gBattleStatus.flags2 &= ~BS_FLAGS2_PARTNER_TURN_USED; gBattleStatus.flags2 &= ~BS_FLAGS2_8; gBattleStatus.flags2 &= ~BS_FLAGS2_10; @@ -2214,7 +2214,7 @@ void btl_state_update_run_away(void) { case BTL_SUBSTATE_RUN_AWAY_EXEC_SCRIPT: battleStatus->stateFreezeCount = 0; gBattleStatus.flags1 &= ~BS_FLAGS1_BATTLE_FLED; - gBattleStatus.flags2 |= BS_FLAGS2_10 | BS_FLAGS2_8 | BS_FLAGS2_4 | BS_FLAGS2_2; + gBattleStatus.flags2 |= BS_FLAGS2_10 | BS_FLAGS2_8 | BS_FLAGS2_PARTNER_TURN_USED | BS_FLAGS2_PLAYER_TURN_USED; playerData->unk_2A6++; btl_cam_use_preset(BTL_CAM_PRESET_25); btl_cam_target_actor(ACTOR_PLAYER); @@ -2375,8 +2375,8 @@ void btl_state_update_defeat(void) { switch (gBattleSubState) { case BTL_SUBSTATE_DEFEAT_INIT: battleStatus->flags1 &= ~BS_FLAGS1_SHOW_PLAYER_DECORATIONS; - gBattleStatus.flags2 &= ~BS_FLAGS2_2; - gBattleStatus.flags2 &= ~BS_FLAGS2_4; + gBattleStatus.flags2 &= ~BS_FLAGS2_PLAYER_TURN_USED; + gBattleStatus.flags2 &= ~BS_FLAGS2_PARTNER_TURN_USED; gBattleStatus.flags2 &= ~BS_FLAGS2_8; gBattleStatus.flags2 &= ~BS_FLAGS2_10; battleStatus->stateFreezeCount = 0; @@ -3082,9 +3082,9 @@ void btl_state_update_end_player_turn(void) { if (battleStatus->moveCategory == BTL_MENU_TYPE_ITEMS && battleStatus->itemUsesLeft >= 2) { btl_cam_use_preset(BTL_CAM_DEFAULT); btl_cam_move(10); - gBattleStatus.flags2 &= ~BS_FLAGS2_2; + gBattleStatus.flags2 &= ~BS_FLAGS2_PLAYER_TURN_USED; } else { - gBattleStatus.flags2 |= BS_FLAGS2_2; + gBattleStatus.flags2 |= BS_FLAGS2_PLAYER_TURN_USED; } if (battleStatus->unk_94 < 0) { @@ -3110,7 +3110,7 @@ void btl_state_update_end_player_turn(void) { } if (battleStatus->hustleTurns != 0 && (gBattleStatus.flags1 & BS_FLAGS1_HUSTLED)) { - gBattleStatus.flags2 &= ~BS_FLAGS2_2; + gBattleStatus.flags2 &= ~BS_FLAGS2_PLAYER_TURN_USED; btl_set_state(BATTLE_STATE_PREPARE_MENU); return; } else { @@ -3127,7 +3127,7 @@ void btl_state_update_end_player_turn(void) { } if (battleStatus->hustleTurns != 0 && (gBattleStatus.flags1 & BS_FLAGS1_HUSTLED)) { - gBattleStatus.flags2 &= ~BS_FLAGS2_2; + gBattleStatus.flags2 &= ~BS_FLAGS2_PLAYER_TURN_USED; btl_set_state(BATTLE_STATE_PREPARE_MENU); } else { gBattleStatus.flags1 &= ~BS_FLAGS2_HAS_DRAINED_HP; @@ -3415,7 +3415,7 @@ void btl_state_update_end_partner_turn(void) { BattleStatus* battleStatus = &gBattleStatus; if (gBattleSubState == BTL_SUBSTATE_INIT) { - battleStatus->flags2 |= BS_FLAGS2_4; + battleStatus->flags2 |= BS_FLAGS2_PARTNER_TURN_USED; if (btl_check_enemies_defeated()) { return; } @@ -3527,8 +3527,8 @@ void btl_state_update_next_enemy(void) { partner->flags |= ACTOR_FLAG_USING_IDLE_ANIM; } - gBattleStatus.flags2 &= ~BS_FLAGS2_2; - gBattleStatus.flags2 &= ~BS_FLAGS2_4; + gBattleStatus.flags2 &= ~BS_FLAGS2_PLAYER_TURN_USED; + gBattleStatus.flags2 &= ~BS_FLAGS2_PARTNER_TURN_USED; gBattleStatus.flags2 |= BS_FLAGS2_10000; D_8029F244 = enemy->unk_134; diff --git a/src/16c8e0.c b/src/16c8e0.c index 4581ddbbeb5..3501911028f 100644 --- a/src/16c8e0.c +++ b/src/16c8e0.c @@ -17,14 +17,14 @@ BSS s32 bSavedPartner; BSS s32 bSavedOverrideFlags; BSS s32 D_8029DA38; // unused? BSS s32 D_8029DA3C; // unused? -BSS s32 D_8029DA40; -BSS s32 D_8029DA44; -BSS s32 D_8029DA48; +BSS s32 StarPointsBasePosX; +BSS s32 StarPointsBasePosY; +BSS s32 StarPointsMoveInterpAmt; BSS s32 D_8029DA4C; -BSS Camera D_8029DA50[ARRAY_COUNT(gCameras)]; -BSS f32 D_8029EFB0; -BSS f32 D_8029EFB4; -BSS f32 D_8029EFB8; +BSS Camera SavedWorldCameras[ARRAY_COUNT(gCameras)]; +BSS f32 SavedWorldPlayerPosX; +BSS f32 SavedWorldPlayerPosY; +BSS f32 SavedWorldPlayerPosZ; BSS s32 D_8029EFBC; BSS s32 BtlStarPointTensHIDs[10]; BSS s32 BtlStarPointShinesHIDs[10]; @@ -172,7 +172,7 @@ void initialize_battle(void) { battleStatus->inputBufferPos = 0; battleStatus->holdInputBufferPos = 0; - battleStatus->unk_95 = 0; + battleStatus->waitForState = BATTLE_STATE_0; for (i = 0; i < ARRAY_COUNT(battleStatus->enemyActors); i++) { battleStatus->enemyActors[i] = NULL; @@ -289,7 +289,7 @@ void btl_update(void) { } cond = TRUE; - if (battleStatus->unk_95 == 0 || battleStatus->unk_95 != gBattleState) { + if (battleStatus->waitForState == BATTLE_STATE_0 || battleStatus->waitForState != gBattleState) { switch (gBattleState) { case BATTLE_STATE_NEGATIVE_1: case BATTLE_STATE_0: @@ -470,8 +470,8 @@ void btl_update(void) { set_screen_overlay_params_front(OVERLAY_SCREEN_COLOR, D_802809F6); set_screen_overlay_color(SCREEN_LAYER_FRONT, 208, 208, 208); - intro_logos_set_fade_alpha(255); - intro_logos_set_fade_color(224); + startup_set_fade_screen_alpha(255); + startup_set_fade_screen_color(224); } } } @@ -948,17 +948,17 @@ void btl_update_starpoints_display(void) { s32 i; if (gBattleStatus.flags1 & BS_FLAGS1_ACTORS_VISIBLE) { - if (!(gBattleStatus.flags2 & BS_FLAGS2_1)) { - D_8029DA40 = 292; - D_8029DA44 = 196; - D_8029DA48 = 6; + if (!(gBattleStatus.flags2 & BS_FLAGS2_AWARDING_STAR_POINTS)) { + StarPointsBasePosX = 292; + StarPointsBasePosY = 196; + StarPointsMoveInterpAmt = 6; D_8029DA4C = battleStatus->totalStarPoints % 10; } else { - D_8029DA40 += (202 - D_8029DA40) / D_8029DA48; - D_8029DA44 += (120 - D_8029DA44) / D_8029DA48; - D_8029DA48--; - if (D_8029DA48 < 1) { - D_8029DA48 = 1; + StarPointsBasePosX += (202 - StarPointsBasePosX) / StarPointsMoveInterpAmt; + StarPointsBasePosY += (120 - StarPointsBasePosY) / StarPointsMoveInterpAmt; + StarPointsMoveInterpAmt--; + if (StarPointsMoveInterpAmt < 1) { + StarPointsMoveInterpAmt = 1; } } @@ -1008,8 +1008,8 @@ void btl_update_starpoints_display(void) { } } - posX = D_8029DA40; - posY = D_8029DA44; + posX = StarPointsBasePosX; + posY = StarPointsBasePosY; tens = battleStatus->totalStarPoints / 10; ones = battleStatus->totalStarPoints % 10; @@ -1037,9 +1037,9 @@ void btl_update_starpoints_display(void) { hud_element_set_flags(BtlStarPointShinesHIDs[i], HUD_ELEMENT_FLAG_DISABLED); } - posX = D_8029DA40; - posY = D_8029DA44 + (one * 14.0f); - if (gBattleStatus.flags2 & BS_FLAGS2_1) { + posX = StarPointsBasePosX; + posY = StarPointsBasePosY + (one * 14.0f); + if (gBattleStatus.flags2 & BS_FLAGS2_AWARDING_STAR_POINTS) { if (ones != 0) { draw_box(0, WINDOW_STYLE_4, posX - 100, posY - 5, 0, 110, 12, 120, 0, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, NULL, NULL, NULL, SCREEN_WIDTH, SCREEN_HEIGHT, NULL); @@ -1069,12 +1069,12 @@ void btl_save_world_cameras(void) { s32 i; for (i = 0; i < ARRAY_COUNT(gCameras); i++) { - D_8029DA50[i] = gCameras[i]; + SavedWorldCameras[i] = gCameras[i]; } - D_8029EFB0 = playerStatus->pos.x; - D_8029EFB4 = playerStatus->pos.y; - D_8029EFB8 = playerStatus->pos.z; + SavedWorldPlayerPosX = playerStatus->pos.x; + SavedWorldPlayerPosY = playerStatus->pos.y; + SavedWorldPlayerPosZ = playerStatus->pos.z; playerStatus->pos.x = NPC_DISPOSE_POS_X; playerStatus->pos.y = NPC_DISPOSE_POS_Y; playerStatus->pos.z = NPC_DISPOSE_POS_Z; @@ -1086,13 +1086,13 @@ void btl_restore_world_cameras(void) { s32 i; for (i = 0; i < ARRAY_COUNT(gCameras); i++) { - gCameras[i] = D_8029DA50[i]; + gCameras[i] = SavedWorldCameras[i]; } gCurrentCameraID = CAM_DEFAULT; - playerStatus->pos.x = D_8029EFB0; - playerStatus->pos.y = D_8029EFB4; - playerStatus->pos.z = D_8029EFB8; + playerStatus->pos.x = SavedWorldPlayerPosX; + playerStatus->pos.y = SavedWorldPlayerPosY; + playerStatus->pos.z = SavedWorldPlayerPosZ; if (bSavedOverrideFlags & GLOBAL_OVERRIDES_ENABLE_FLOOR_REFLECTION) { gOverrideFlags |= GLOBAL_OVERRIDES_ENABLE_FLOOR_REFLECTION; diff --git a/src/415D90.c b/src/415D90.c index af0c95ee9fc..ac419bcc49b 100644 --- a/src/415D90.c +++ b/src/415D90.c @@ -2119,7 +2119,7 @@ s32 can_switch_to_player(void) { BattleStatus* battleStatus = &gBattleStatus; Actor* player = battleStatus->playerActor; - if (battleStatus->flags2 & BS_FLAGS2_2) { + if (battleStatus->flags2 & BS_FLAGS2_PLAYER_TURN_USED) { return FALSE; } else { s8 debuff = player->debuff; @@ -2170,7 +2170,7 @@ s32 can_switch_to_partner(void) { s8 partnerDebuff; s32 partnerCantMove; - if (battleStatus->flags2 & BS_FLAGS2_4 || partner == PARTNER_NONE || partner->flags & ACTOR_FLAG_NO_ATTACK) { + if (battleStatus->flags2 & BS_FLAGS2_PARTNER_TURN_USED || partner == PARTNER_NONE || partner->flags & ACTOR_FLAG_NO_ATTACK) { return FALSE; } @@ -2806,7 +2806,7 @@ void btl_state_update_player_menu(void) { } break; case BTL_SUBSTATE_PLAYER_MENU_MAIN_SHOW_CANT_SWAP: - if (gBattleStatus.flags2 & BS_FLAGS2_4) { + if (gBattleStatus.flags2 & BS_FLAGS2_PARTNER_TURN_USED) { btl_show_variable_battle_message(BTL_MSG_CANT_SWITCH, 60, 0); } else { btl_show_variable_battle_message(BTL_MSG_CANT_MOVE, 60, playerData->curPartner); @@ -3295,7 +3295,7 @@ void btl_state_update_player_menu(void) { if (jumpTargetCount <= 0 && hammerTargetCount <= 0) { battleStatus->moveCategory = BTL_MENU_TYPE_DO_NOTHING; - battleStatus->unk_95 = 0; + battleStatus->waitForState = BATTLE_STATE_0; btl_set_state(BATTLE_STATE_END_PLAYER_TURN); } else { jumpChance = 50; @@ -4482,7 +4482,7 @@ void btl_state_draw_partner_menu(void) { } s32 btl_menu_show_switch_to_twink(void) { - if (gBattleStatus.flags2 & BS_FLAGS2_4) { + if (gBattleStatus.flags2 & BS_FLAGS2_PARTNER_TURN_USED) { return FALSE; } return TRUE; @@ -4657,7 +4657,7 @@ void btl_state_draw_peach_menu(void) { } s32 btl_menu_show_switch_to_peach(void) { - if (gBattleStatus.flags2 & BS_FLAGS2_2) { + if (gBattleStatus.flags2 & BS_FLAGS2_PLAYER_TURN_USED) { return FALSE; } return TRUE; diff --git a/src/80850_len_3060.c b/src/80850_len_3060.c index d92730a484e..7f35d2c63fa 100644 --- a/src/80850_len_3060.c +++ b/src/80850_len_3060.c @@ -560,7 +560,7 @@ void update_status_bar(void) { s32 spBars; s32 maxStarPower; - if (gGameStatusPtr->creditsViewportMode >= 0 + if (gGameStatusPtr->introPart >= INTRO_PART_0 || gGameStatusPtr->demoState != DEMO_STATE_NONE || (gGameStatusPtr->peachFlags & PEACH_STATUS_FLAG_IS_PEACH) || evt_get_variable(NULL, GB_StoryProgress) >= STORY_EPILOGUE diff --git a/src/8800.c b/src/8800.c index a665fb14516..24c8383dbd8 100644 --- a/src/8800.c +++ b/src/8800.c @@ -192,8 +192,8 @@ void render_frame(s32 isSecondPass) { camera->unkMatrix = &gDisplayContext->matrixStack[gMatrixListPos]; matrixListPos = gMatrixListPos++; guRotate(&gDisplayContext->matrixStack[matrixListPos], -camera->trueRot.x, 0.0f, 1.0f, 0.0f); - camera->vpAlt.vp.vtrans[0] = camera->vp.vp.vtrans[0] + gGameStatusPtr->unk_82.x; - camera->vpAlt.vp.vtrans[1] = camera->vp.vp.vtrans[1] + gGameStatusPtr->unk_82.y; + camera->vpAlt.vp.vtrans[0] = camera->vp.vp.vtrans[0] + gGameStatusPtr->altViewportOffset.x; + camera->vpAlt.vp.vtrans[1] = camera->vp.vp.vtrans[1] + gGameStatusPtr->altViewportOffset.y; if (!(camera->flags & CAMERA_FLAG_ORTHO)) { if (gCurrentCamID != CAM_3) { @@ -436,8 +436,8 @@ void set_cam_viewport(s16 id, s16 x, s16 y, s16 width, s16 height) { camera->vpAlt.vp.vscale[2] = 0x1FF; camera->vpAlt.vp.vscale[3] = 0; - camera->vpAlt.vp.vtrans[0] = gGameStatusPtr->unk_82.x + 4 * (s16) ((u16) camera->viewportStartX + (camera->viewportW / 2)); - camera->vpAlt.vp.vtrans[1] = gGameStatusPtr->unk_82.y + 4 * (s16) ((u16) camera->viewportStartY + (camera->viewportH / 2)); + camera->vpAlt.vp.vtrans[0] = gGameStatusPtr->altViewportOffset.x + 4 * (s16) ((u16) camera->viewportStartX + (camera->viewportW / 2)); + camera->vpAlt.vp.vtrans[1] = gGameStatusPtr->altViewportOffset.y + 4 * (s16) ((u16) camera->viewportStartY + (camera->viewportH / 2)); camera->vpAlt.vp.vtrans[2] = 0x200; camera->vpAlt.vp.vtrans[3] = 0; } diff --git a/src/actor_api.c b/src/actor_api.c index 18f81153395..1947f01cb9e 100644 --- a/src/actor_api.c +++ b/src/actor_api.c @@ -2286,31 +2286,35 @@ ApiStatus SetBattleState(Evt* script, s32 isInitialCall) { ApiStatus WaitForState(Evt* script, s32 isInitialCall) { Bytecode* args = script->ptrReadPos; BattleStatus* battleStatus = &gBattleStatus; - s32 temp_v0; + s32 waitForState; if (isInitialCall) { - temp_v0 = evt_get_variable(script, *args++); - if (temp_v0 == 0) { - battleStatus->unk_95 = 0; + waitForState = evt_get_variable(script, *args++); + if (waitForState == BATTLE_STATE_0) { + battleStatus->waitForState = BATTLE_STATE_0; return ApiStatus_DONE2; } - battleStatus->unk_95 = temp_v0; + battleStatus->waitForState = waitForState; } - temp_v0 = battleStatus->unk_95; - if (temp_v0) { - return (gBattleState == temp_v0) * ApiStatus_DONE2; + waitForState = battleStatus->waitForState; + if (waitForState == BATTLE_STATE_0) { + return ApiStatus_DONE2; } - return ApiStatus_DONE2; + if (gBattleState == waitForState) { + return ApiStatus_DONE2; + } else { + return ApiStatus_BLOCK; + } } ApiStatus CancelEnemyTurn(Evt* script, s32 isInitialCall) { Bytecode* args = script->ptrReadPos; BattleStatus* battleStatus = &gBattleStatus; - s32 temp_v0 = evt_get_variable(script, *args++); + s32 cancelMode = evt_get_variable(script, *args++); - switch (temp_v0) { + switch (cancelMode) { case 0: battleStatus->unk_94 = 1; break; diff --git a/src/background_gfx.c b/src/background_gfx.c index 71c178a1576..b9ab1d61d52 100644 --- a/src/background_gfx.c +++ b/src/background_gfx.c @@ -385,7 +385,7 @@ void gfx_draw_background(void) { break; default: // Draw the scene's background as normal - if (gOverrideFlags & GLOBAL_OVERRIDES_8) { + if (gOverrideFlags & GLOBAL_OVERRIDES_DISABLE_DRAW_FRAME) { gDPSetColorImage(gMainGfxPos++, G_IM_FMT_RGBA, G_IM_SIZ_16b, SCREEN_WIDTH, osVirtualToPhysical(nuGfxCfb_ptr)); return; } diff --git a/src/battle/actor_rendering.c b/src/battle/actor_rendering.c index 9fb84d82682..ed60dbe81fe 100644 --- a/src/battle/actor_rendering.c +++ b/src/battle/actor_rendering.c @@ -1007,7 +1007,7 @@ void appendGfx_npc_actor(b32 isPartner, s32 actorIndex) { } while (0); // required to match if (isPartner) { - if ((gBattleStatus.flags2 & (BS_FLAGS2_10 | BS_FLAGS2_4)) == BS_FLAGS2_4) { + if ((gBattleStatus.flags2 & (BS_FLAGS2_10 | BS_FLAGS2_PARTNER_TURN_USED)) == BS_FLAGS2_PARTNER_TURN_USED) { do { if (actor->koStatus == 0) { part->curAnimation = get_npc_anim_for_status(part->idleAnimations, STATUS_KEY_INACTIVE); @@ -1552,10 +1552,13 @@ void appendGfx_player_actor(void* arg0) { } } - if (!(gBattleStatus.flags2 & BS_FLAGS2_10000) && !(gBattleStatus.flags1 & BS_FLAGS1_TATTLE_OPEN) && (player->flags & ACTOR_FLAG_SHOW_STATUS_ICONS)) { - battleStatus->buffEffect->data.partnerBuff->unk_02 = 1; + if (!(gBattleStatus.flags2 & BS_FLAGS2_10000) + && !(gBattleStatus.flags1 & BS_FLAGS1_TATTLE_OPEN) + && (player->flags & ACTOR_FLAG_SHOW_STATUS_ICONS) + ) { + battleStatus->buffEffect->data.partnerBuff->visible = TRUE; } else { - battleStatus->buffEffect->data.partnerBuff->unk_02 = 0; + battleStatus->buffEffect->data.partnerBuff->visible = FALSE; } do { @@ -1625,11 +1628,13 @@ void appendGfx_player_actor(void* arg0) { lastAnim = playerParts->curAnimation; } while (0); // required to match - if (((((gBattleStatus.flags2 & (BS_FLAGS2_8 | BS_FLAGS2_2)) == BS_FLAGS2_2) && (partner != NULL)) || (battleStatus->outtaSightActive > 0)) + if (((((gBattleStatus.flags2 & (BS_FLAGS2_8 | BS_FLAGS2_PLAYER_TURN_USED)) == BS_FLAGS2_PLAYER_TURN_USED) + && (partner != NULL)) + || (battleStatus->outtaSightActive > 0)) && !(player->flags & ACTOR_FLAG_NO_INACTIVE_ANIM) - && ((partner == NULL) || !(partner->flags & ACTOR_FLAG_NO_ATTACK))) + && !((partner != NULL) && (partner->flags & ACTOR_FLAG_NO_ATTACK))) { - if (!(gBattleStatus.flags2 & BS_FLAGS2_100000)) { + if (!(gBattleStatus.flags2 & BS_FLAGS2_NO_PLAYER_PAL_ADJUST)) { if ((player->debuff != STATUS_KEY_FEAR) && (player->debuff != STATUS_KEY_PARALYZE) && (player->debuff != STATUS_KEY_FROZEN) @@ -1637,7 +1642,7 @@ void appendGfx_player_actor(void* arg0) { ) { if ((player->transparentStatus != STATUS_KEY_TRANSPARENT) && (player->stoneStatus != STATUS_KEY_STONE) && - ((battleStatus->outtaSightActive > 0) || (gBattleStatus.flags2 & BS_FLAGS2_2))) + ((battleStatus->outtaSightActive > 0) || (gBattleStatus.flags2 & BS_FLAGS2_PLAYER_TURN_USED))) { if (is_ability_active(ABILITY_BERSERKER)) { playerParts->curAnimation = get_player_anim_for_status(STATUS_KEY_INACTIVE_BERSERK); diff --git a/src/battle/area/hos/actor/goombario_tutor.c b/src/battle/area/hos/actor/goombario_tutor.c index 656c4c24fa9..c02c1504e1a 100644 --- a/src/battle/area/hos/actor/goombario_tutor.c +++ b/src/battle/area/hos/actor/goombario_tutor.c @@ -191,7 +191,7 @@ EvtScript N(EVS_TakeTurn) = { EVT_CALL(SetGoalToTarget, ACTOR_SELF) EVT_CALL(AddGoalPos, ACTOR_SELF, -10, 0, 0) EVT_CALL(GetBattleFlags2, LVar0) - EVT_IF_FLAG(LVar0, BS_FLAGS2_200) + EVT_IF_FLAG(LVar0, BS_FLAGS2_DOING_JUMP_TUTORIAL) EVT_CALL(AddGoalPos, ACTOR_SELF, 5, 10, 0) EVT_END_IF EVT_CALL(SetActorJumpGravity, ACTOR_SELF, EVT_FLOAT(1.1)) @@ -326,7 +326,7 @@ EvtScript N(EVS_ManageTutorial) = { EVT_CALL(FlyToGoal, ACTOR_PARTNER, 20, 20, EASING_COS_IN_OUT) EVT_CALL(SetActionCommandMode, ACTION_COMMAND_MODE_TUTORIAL) EVT_CALL(WaitForState, BATTLE_STATE_0) - EVT_CALL(SetBattleFlagBits2, BS_FLAGS2_200, TRUE) + EVT_CALL(SetBattleFlagBits2, BS_FLAGS2_DOING_JUMP_TUTORIAL, TRUE) EVT_LOOP(0) EVT_CALL(GetActionCommandMode, LVar0) EVT_IF_NE(LVar0, ACTION_COMMAND_MODE_TUTORIAL) @@ -366,7 +366,7 @@ EvtScript N(EVS_ManageTutorial) = { EVT_CALL(UseBattleCamPreset, BTL_CAM_DEFAULT) EVT_WAIT(15) EVT_CALL(UseIdleAnimation, ACTOR_PARTNER, FALSE) - EVT_CALL(ActorSpeak, MSG_HOS_001E, BS_FLAGS2_200, 1, ANIM_BattleGoombario_Talk, ANIM_BattleGoombario_Idle) + EVT_CALL(ActorSpeak, MSG_HOS_001E, ACTOR_ENEMY0, 1, ANIM_BattleGoombario_Talk, ANIM_BattleGoombario_Idle) EVT_CALL(UseIdleAnimation, ACTOR_PARTNER, TRUE) EVT_CALL(SetActionCommandMode, ACTION_COMMAND_MODE_TUTORIAL) EVT_CALL(WaitForState, BATTLE_STATE_0) @@ -494,7 +494,7 @@ EvtScript N(EVS_ManageTutorial) = { EVT_CALL(ActorSpeak, MSG_HOS_0028, ACTOR_PARTNER, 1, ANIM_Twink_Talk, ANIM_Twink_Fly) EVT_CALL(UseIdleAnimation, ACTOR_PARTNER, TRUE) EVT_CALL(SetActorVar, ACTOR_SELF, AVAR_FirstTurn, FALSE) - EVT_CALL(SetBattleFlagBits2, BS_FLAGS2_200, FALSE) + EVT_CALL(SetBattleFlagBits2, BS_FLAGS2_DOING_JUMP_TUTORIAL, FALSE) EVT_LABEL(10) EVT_CALL(SetBattleMenuEnabledFlags, BTL_MENU_ENABLED_JUMP | BTL_MENU_ENABLED_SMASH | BTL_MENU_ENABLED_STRATEGIES) EVT_CALL(SetActionCommandMode, ACTION_COMMAND_MODE_TUTORIAL) diff --git a/src/battle/area/trd_part_3/actor/eldstar.c b/src/battle/area/trd_part_3/actor/eldstar.c index 0afc2c8e9a8..1b60a04ce22 100644 --- a/src/battle/area/trd_part_3/actor/eldstar.c +++ b/src/battle/area/trd_part_3/actor/eldstar.c @@ -149,7 +149,7 @@ API_CALLABLE(N(func_80218170_4CF320)) { script->functionTemp[0] = 10; } - battleStatus->flags2 &= ~BS_FLAGS2_2; + battleStatus->flags2 &= ~BS_FLAGS2_PLAYER_TURN_USED; if (script->functionTemp[0] != 0) { script->functionTemp[0]--; @@ -166,7 +166,7 @@ API_CALLABLE(N(func_802181B4_4CF364)) { script->functionTemp[0] = 10; } - battleStatus->flags2 &= ~BS_FLAGS2_4; + battleStatus->flags2 &= ~BS_FLAGS2_PARTNER_TURN_USED; if (script->functionTemp[0] != 0) { script->functionTemp[0]--; diff --git a/src/battle/battle.c b/src/battle/battle.c index 367f7a201f5..31efa16b0c4 100644 --- a/src/battle/battle.c +++ b/src/battle/battle.c @@ -238,7 +238,7 @@ void load_demo_battle(u32 index) { func_80138188(); reset_battle_status(); clear_encounter_status(); - clear_entity_data(1); + clear_entity_data(TRUE); clear_effect_data(); clear_player_status(); clear_printers(); @@ -329,6 +329,6 @@ void load_demo_battle(u32 index) { gCurrentEncounter.instigatorValue = 0; set_battle_stage(BTL_STAGE_DEFAULT); gGameStatusPtr->demoBattleFlags |= DEMO_BTL_FLAG_ENABLED; - gOverrideFlags &= ~GLOBAL_OVERRIDES_8; + gOverrideFlags &= ~GLOBAL_OVERRIDES_DISABLE_DRAW_FRAME; load_battle(battleID); } diff --git a/src/battle/level_up.c b/src/battle/level_up.c index 09fbad205d9..d81230837fb 100644 --- a/src/battle/level_up.c +++ b/src/battle/level_up.c @@ -522,7 +522,7 @@ void btl_state_update_celebration(void) { EndBattleRewardStep = 0; CelebrateSubstateTime = 1; gBattleSubState = BTL_SUBSTATE_CELEBRATE_LOAD_STAR_POINTS; - gBattleStatus.flags2 |= BS_FLAGS2_1; + gBattleStatus.flags2 |= BS_FLAGS2_AWARDING_STAR_POINTS; } break; case BTL_SUBSTATE_CELEBRATE_LOAD_STAR_POINTS: diff --git a/src/battle/move/jump/attack.c b/src/battle/move/jump/attack.c index 9b1394dfa24..1ca4417e250 100644 --- a/src/battle/move/jump/attack.c +++ b/src/battle/move/jump/attack.c @@ -28,13 +28,13 @@ API_CALLABLE(N(GetJumpDamage)) { extern EvtScript N(EVS_UseMove0_ImplA); extern EvtScript N(EVS_UseMove0_ImplB); extern EvtScript N(EVS_UseMove0_ImplC); -extern EvtScript N(EVS_802A4018); +extern EvtScript N(EVS_UseMove_Tutorial); EvtScript N(EVS_UseMove0) = { EVT_CALL(ShowActionHud, TRUE) EVT_CALL(GetBattleFlags2, LVar0) - EVT_IF_FLAG(LVar0, BS_FLAGS2_200) - EVT_EXEC_WAIT(N(EVS_802A4018)) + EVT_IF_FLAG(LVar0, BS_FLAGS2_DOING_JUMP_TUTORIAL) + EVT_EXEC_WAIT(N(EVS_UseMove_Tutorial)) EVT_RETURN EVT_END_IF EVT_CALL(GetMenuSelection, LVar0, LVar1, LVar2) @@ -495,7 +495,7 @@ EvtScript N(EVS_UseMove2_ImplC) = { EVT_END }; -EvtScript N(EVS_802A4018) = { +EvtScript N(EVS_UseMove_Tutorial) = { EVT_CALL(LoadActionCommand, ACTION_COMMAND_JUMP) EVT_CALL(action_command_jump_init) EVT_EXEC_WAIT(N(EVS_JumpSupport_A)) diff --git a/src/battle/partner/bow.c b/src/battle/partner/bow.c index d847682523e..dac697c9f00 100644 --- a/src/battle/partner/bow.c +++ b/src/battle/partner/bow.c @@ -53,7 +53,7 @@ API_CALLABLE(N(ApplyOuttaSight)) { ActorPart* playerActorPartTable = gBattleStatus.playerActor->partsTable; gBattleStatus.outtaSightActive = 1; - if (!(gBattleStatus.flags2 & BS_FLAGS2_2)) { + if (!(gBattleStatus.flags2 & BS_FLAGS2_PLAYER_TURN_USED)) { gBattleStatus.outtaSightActive = -1; } diff --git a/src/battle/partner/watt.c b/src/battle/partner/watt.c index ed3898988ea..5c7ebc5d809 100644 --- a/src/battle/partner/watt.c +++ b/src/battle/partner/watt.c @@ -72,7 +72,7 @@ API_CALLABLE(N(WattFXUpdate)) { x = partner->curPos.x + partner->headOffset.x; y = partner->curPos.y + partner->headOffset.y + partner->verticalRenderOffset + 12.0f; z = partner->curPos.z + partner->headOffset.z; - if ((gBattleStatus.flags2 & (BS_FLAGS2_10 | BS_FLAGS2_4)) == BS_FLAGS2_4) { + if ((gBattleStatus.flags2 & (BS_FLAGS2_10 | BS_FLAGS2_PARTNER_TURN_USED)) == BS_FLAGS2_PARTNER_TURN_USED) { y = NPC_DISPOSE_POS_Y; } @@ -361,8 +361,8 @@ API_CALLABLE(N(ApplyTurboCharge)) { battleStatus->buffEffect->data.partnerBuff->unk_0C[FX_BUFF_DATA_TURBO_CHARGE].turnsLeft = battleStatus->turboChargeTurnsLeft; } - if (gBattleStatus.flags2 & BS_FLAGS2_2) { - gBattleStatus.flags2 |= BS_FLAGS2_100; + if (gBattleStatus.flags2 & BS_FLAGS2_PLAYER_TURN_USED) { + gBattleStatus.flags2 |= BS_FLAGS2_STORED_TURBO_CHARGE_TURN; } return ApiStatus_DONE2; diff --git a/src/cd180_len_38f0.c b/src/cd180_len_38f0.c index 0896b40ea2a..45cf5a123f4 100644 --- a/src/cd180_len_38f0.c +++ b/src/cd180_len_38f0.c @@ -349,8 +349,8 @@ void _render_transition_stencil(u8 stencilType, f32 progress, ScreenOverlay* ove gSPDisplayList(gMainGfxPos++, Gfx_LoadStencilTex_BlurryCircle); appendGfx_darkness_stencil(FALSE, x1, y1, alpha, progress); break; - case OVERLAY_UNUSED_1: - case OVERLAY_UNUSED_2: + case OVERLAY_INTRO_1: + case OVERLAY_INTRO_2: break; } diff --git a/src/effects/partner_buff.c b/src/effects/partner_buff.c index 6caadfcc418..d21f00f10fa 100644 --- a/src/effects/partner_buff.c +++ b/src/effects/partner_buff.c @@ -70,9 +70,9 @@ EffectInstance* partner_buff_main(s32 useRandomValues, f32 arg1, f32 arg2, f32 a part->unk_0C[i].stateTimer = 0; } - part->unk_02 = 0; + part->visible = FALSE; if (useRandomValues == 1) { - part->unk_02 = 1; + part->visible = TRUE; } return effect; @@ -220,7 +220,7 @@ void func_E011A700(EffectInstance* effect) { f32 x, y; s32 i; - if (data->unk_02 != 0) { + if (data->visible) { gDPPipeSync(gMainGfxPos++); gSPSegment(gMainGfxPos++, 0x09, VIRTUAL_TO_PHYSICAL(((EffectInstance*)effect)->graphics->data)); diff --git a/src/entity.c b/src/entity.c index 0f0ce4a60f5..7a2a0a4deef 100644 --- a/src/entity.c +++ b/src/entity.c @@ -784,7 +784,7 @@ void load_area_specific_entity_data(void) { } } -void clear_entity_data(s32 arg0) { +void clear_entity_data(b32 arg0) { s32 i; D_801516FC = 1; diff --git a/src/game_modes.c b/src/game_modes.c index 7b844a2cd30..db9fa8e8ad4 100644 --- a/src/game_modes.c +++ b/src/game_modes.c @@ -203,7 +203,7 @@ GameModeIncomplete GameModeFileSelect = { }; GameModeIncomplete GameModeEndFileSelect = { - 0, + MODE_FLAG_NONE, state_init_exit_file_select, state_step_exit_file_select, NULL, @@ -236,24 +236,24 @@ GameModeIncomplete GameModeDemo = { }; GameMode* gameModeMap[] = { - (GameMode*) &GameModeStartup, - (GameMode*) &GameModeLogos, - (GameMode*) &GameModeTitleScreen, - (GameMode*) &GameModeEnterDemoWorld, - (GameMode*) &GameModeWorld, - (GameMode*) &GameModeChangeMap, - (GameMode*) &GameModeGameOver, - (GameMode*) &GameModeEnterWorld, - (GameMode*) &GameModeBattle, - (GameMode*) &GameModeEndBattle, - (GameMode*) &GameModePause, - (GameMode*) &GameModeUnpause, - (GameMode*) &GameModeLanguageSelect, - (GameMode*) &GameModeEndLanguageSelect, - (GameMode*) &GameModeFileSelect, - (GameMode*) &GameModeEndFileSelect, - (GameMode*) &GameModeIntro, - (GameMode*) &GameModeDemo, + [GAME_MODE_STARTUP] (GameMode*) &GameModeStartup, + [GAME_MODE_LOGOS] (GameMode*) &GameModeLogos, + [GAME_MODE_TITLE_SCREEN] (GameMode*) &GameModeTitleScreen, + [GAME_MODE_ENTER_DEMO_WORLD] (GameMode*) &GameModeEnterDemoWorld, + [GAME_MODE_WORLD] (GameMode*) &GameModeWorld, + [GAME_MODE_CHANGE_MAP] (GameMode*) &GameModeChangeMap, + [GAME_MODE_GAME_OVER] (GameMode*) &GameModeGameOver, + [GAME_MODE_ENTER_WORLD] (GameMode*) &GameModeEnterWorld, + [GAME_MODE_BATTLE] (GameMode*) &GameModeBattle, + [GAME_MODE_END_BATTLE] (GameMode*) &GameModeEndBattle, + [GAME_MODE_PAUSE] (GameMode*) &GameModePause, + [GAME_MODE_UNPAUSE] (GameMode*) &GameModeUnpause, + [GAME_MODE_LANGUAGE_SELECT] (GameMode*) &GameModeLanguageSelect, + [GAME_MODE_END_LANGUAGE_SELECT] (GameMode*) &GameModeEndLanguageSelect, + [GAME_MODE_FILE_SELECT] (GameMode*) &GameModeFileSelect, + [GAME_MODE_END_FILE_SELECT] (GameMode*) &GameModeEndFileSelect, + [GAME_MODE_INTRO] (GameMode*) &GameModeIntro, + [GAME_MODE_DEMO] (GameMode*) &GameModeDemo, }; SHIFT_BSS s16 CurGameMode; diff --git a/src/imgfx.c b/src/imgfx.c index ffe1f9a80d3..8a5b91f608e 100644 --- a/src/imgfx.c +++ b/src/imgfx.c @@ -1619,8 +1619,8 @@ void imgfx_appendGfx_mesh_basic(ImgFXState* state, Matrix4f mtx) { cam = &gCameras[gCurrentCamID]; if (gGameStatusPtr->isBattle == 2) { gSPViewport(gMainGfxPos++, &D_8014EE40); - D_8014EE50.vp.vtrans[0] = D_8014EE40.vp.vtrans[0] + gGameStatusPtr->unk_82.x; - D_8014EE50.vp.vtrans[1] = D_8014EE40.vp.vtrans[1] + gGameStatusPtr->unk_82.y; + D_8014EE50.vp.vtrans[0] = D_8014EE40.vp.vtrans[0] + gGameStatusPtr->altViewportOffset.x; + D_8014EE50.vp.vtrans[1] = D_8014EE40.vp.vtrans[1] + gGameStatusPtr->altViewportOffset.y; } else { gSPViewport(gMainGfxPos++, &cam->vp); } diff --git a/src/intro_logos.c b/src/intro_logos.c deleted file mode 100644 index 3053d8f55cf..00000000000 --- a/src/intro_logos.c +++ /dev/null @@ -1,40 +0,0 @@ -#include "common.h" - -void intro_logos_set_fade_alpha(s16 alpha) { - gGameStatusPtr->bootAlpha = alpha; -} - -void intro_logos_set_fade_color(s16 color) { - gGameStatusPtr->bootRed = color; - gGameStatusPtr->bootGreen = color; - gGameStatusPtr->bootBlue = color; -} - -s32 intro_logos_fade_in(s16 subtractAlpha) { - if (gGameStatusPtr->bootAlpha != 0) { - gGameStatusPtr->bootAlpha -= subtractAlpha; - if (gGameStatusPtr->bootAlpha < 0) { - gGameStatusPtr->bootAlpha = 0; - } - } else { - return TRUE; - } - return FALSE; -} - -s32 intro_logos_fade_out(s16 addAlpha) { - if (gGameStatusPtr->bootAlpha != 255) { - gGameStatusPtr->bootAlpha += addAlpha; - if (gGameStatusPtr->bootAlpha > 255) { - gGameStatusPtr->bootAlpha = 255; - } - } else { - return TRUE; - } - return FALSE; -} - -void intro_logos_update_fade(void) { - set_screen_overlay_params_front(OVERLAY_SCREEN_COLOR, gGameStatusPtr->bootAlpha); - set_screen_overlay_color(SCREEN_LAYER_FRONT, gGameStatusPtr->bootBlue, gGameStatusPtr->bootGreen, gGameStatusPtr->bootRed); -} diff --git a/src/main_loop.c b/src/main_loop.c index 91421325ed2..74d871fc0c1 100644 --- a/src/main_loop.c +++ b/src/main_loop.c @@ -16,14 +16,14 @@ s8 gGameStepDelayAmount = 1; s8 gGameStepDelayCount = 5; GameStatus gGameStatus = { - .curButtons = {0}, - .pressedButtons = {0}, - .heldButtons = {0}, - .prevButtons = {0}, - .stickX = {0}, - .stickY = {0}, - .unk_48 = {0}, - .unk_50 = {0}, + .curButtons = { 0 }, + .pressedButtons = { 0 }, + .heldButtons = { 0 }, + .prevButtons = { 0 }, + .stickX = { 0 }, + .stickY = { 0 }, + .unk_48 = { 0 }, + .unk_50 = { 0 }, }; GameStatus* gGameStatusPtr = &gGameStatus; @@ -111,7 +111,7 @@ void step_game_loop(void) { } break; case 1: - gOverrideFlags |= GLOBAL_OVERRIDES_8; + gOverrideFlags |= GLOBAL_OVERRIDES_DISABLE_DRAW_FRAME; D_8009A690--; if (D_8009A690 == 0) { sfx_stop_env_sounds(); @@ -175,7 +175,7 @@ void gfx_draw_frame(void) { gMatrixListPos = 0; gMainGfxPos = &gDisplayContext->mainGfx[0]; - if (gOverrideFlags & GLOBAL_OVERRIDES_8) { + if (gOverrideFlags & GLOBAL_OVERRIDES_DISABLE_DRAW_FRAME) { gCurrentDisplayContextIndex = gCurrentDisplayContextIndex ^ 1; return; } @@ -262,11 +262,11 @@ void load_engine_data(void) { gGameStatusPtr->backgroundFlags = 0; gGameStatusPtr->musicEnabled = TRUE; gGameStatusPtr->healthBarsEnabled = TRUE; - gGameStatusPtr->creditsViewportMode = -1; + gGameStatusPtr->introPart = INTRO_PART_NONE; gGameStatusPtr->demoBattleFlags = 0; gGameStatusPtr->multiplayerEnabled = FALSE; - gGameStatusPtr->unk_82.x = -8; - gGameStatusPtr->unk_82.y = 4; + gGameStatusPtr->altViewportOffset.x = -8; + gGameStatusPtr->altViewportOffset.y = 4; timeFreezeMode = 0; gGameStatusPtr->debugQuizmo = gGameStatusPtr->unk_13C = 0; gGameStepDelayCount = 5; @@ -291,7 +291,7 @@ void load_engine_data(void) { clear_npcs(); hud_element_clear_cache(); clear_trigger_data(); - clear_entity_data(0); + clear_entity_data(FALSE); clear_player_data(); init_encounter_status(); clear_screen_overlays(); @@ -310,7 +310,7 @@ void load_engine_data(void) { gGameStatusPtr->unk_48[i] = 12; } - gOverrideFlags |= GLOBAL_OVERRIDES_8; + gOverrideFlags |= GLOBAL_OVERRIDES_DISABLE_DRAW_FRAME; set_game_mode(GAME_MODE_STARTUP); } diff --git a/src/sprite.c b/src/sprite.c index 0169887156f..afabc171234 100644 --- a/src/sprite.c +++ b/src/sprite.c @@ -304,8 +304,8 @@ void spr_appendGfx_component_flat( if (gGameStatusPtr->isBattle == 2) { gSPViewport(gMainGfxPos++, &SprPauseVp); - SprPauseVpAlt.vp.vtrans[0] = SprPauseVp.vp.vtrans[0] + gGameStatusPtr->unk_82.x; - SprPauseVpAlt.vp.vtrans[1] = SprPauseVp.vp.vtrans[1] + gGameStatusPtr->unk_82.y; + SprPauseVpAlt.vp.vtrans[0] = SprPauseVp.vp.vtrans[0] + gGameStatusPtr->altViewportOffset.x; + SprPauseVpAlt.vp.vtrans[1] = SprPauseVp.vp.vtrans[1] + gGameStatusPtr->altViewportOffset.y; } else { gSPViewport(gMainGfxPos++, &camera->vp); } diff --git a/src/startup_screen_fading.c b/src/startup_screen_fading.c new file mode 100644 index 00000000000..aee0b8f1b64 --- /dev/null +++ b/src/startup_screen_fading.c @@ -0,0 +1,45 @@ +#include "common.h" + +void startup_set_fade_screen_alpha(s16 alpha) { + gGameStatusPtr->screenColorA = alpha; +} + +void startup_set_fade_screen_color(s16 color) { + gGameStatusPtr->screenColorB = color; + gGameStatusPtr->screenColorG = color; + gGameStatusPtr->screenColorR = color; +} + +b32 startup_fade_screen_in(s16 subtractAlpha) { + if (gGameStatusPtr->screenColorA == 0) { + return TRUE; + } + + gGameStatusPtr->screenColorA -= subtractAlpha; + if (gGameStatusPtr->screenColorA < 0) { + gGameStatusPtr->screenColorA = 0; + } + + return FALSE; +} + +b32 startup_fade_screen_out(s16 addAlpha) { + if (gGameStatusPtr->screenColorA == 255) { + return TRUE; + } + + gGameStatusPtr->screenColorA += addAlpha; + if (gGameStatusPtr->screenColorA > 255) { + gGameStatusPtr->screenColorA = 255; + } + + return FALSE; +} + +void startup_fade_screen_update(void) { + set_screen_overlay_params_front(OVERLAY_SCREEN_COLOR, gGameStatusPtr->screenColorA); + set_screen_overlay_color(SCREEN_LAYER_FRONT, + gGameStatusPtr->screenColorR, + gGameStatusPtr->screenColorG, + gGameStatusPtr->screenColorB); +} diff --git a/src/state_battle.c b/src/state_battle.c index abfba2dd6ed..a48ad5d095f 100644 --- a/src/state_battle.c +++ b/src/state_battle.c @@ -42,7 +42,7 @@ void state_step_battle(void) { return; } D_800A0900--; - gOverrideFlags |= GLOBAL_OVERRIDES_8; + gOverrideFlags |= GLOBAL_OVERRIDES_DISABLE_DRAW_FRAME; nuContRmbForceStop(); } @@ -91,7 +91,7 @@ void state_step_battle(void) { clear_item_entity_data(); clear_script_list(); clear_npcs(); - clear_entity_data(1); + clear_entity_data(TRUE); clear_trigger_data(); DMA_COPY_SEGMENT(battle_code); initialize_battle(); @@ -101,7 +101,7 @@ void state_step_battle(void) { gPlayerStatusPtr->animFlags &= ~PA_FLAG_PULSE_STONE_VISIBLE; D_800A0908 = get_time_freeze_mode(); set_time_freeze_mode(TIME_FREEZE_NORMAL); - gOverrideFlags &= ~GLOBAL_OVERRIDES_8; + gOverrideFlags &= ~GLOBAL_OVERRIDES_DISABLE_DRAW_FRAME; if (D_800A0900 >= 0) { return; @@ -126,7 +126,7 @@ void state_drawUI_battle(void) { } void state_init_end_battle(void) { - gOverrideFlags |= GLOBAL_OVERRIDES_8; + gOverrideFlags |= GLOBAL_OVERRIDES_DISABLE_DRAW_FRAME; nuContRmbForceStop(); D_800A0900 = 5; } @@ -143,7 +143,7 @@ void state_step_end_battle(void) { D_800A0900 = -1; nuGfxSetCfb(bFrameBuffers, 3); - gOverrideFlags &= ~GLOBAL_OVERRIDES_8; + gOverrideFlags &= ~GLOBAL_OVERRIDES_DISABLE_DRAW_FRAME; nuContRmbForceStopEnd(); sfx_stop_env_sounds(); mapSettings = get_current_map_settings(); diff --git a/src/state_demo.c b/src/state_demo.c index 83765ace3a4..59b9fa8757d 100644 --- a/src/state_demo.c +++ b/src/state_demo.c @@ -174,19 +174,19 @@ void state_step_demo(void) { switch (mode) { case DEMO_SCENE_DONE: - intro_logos_set_fade_alpha(255); - intro_logos_set_fade_color(224); - gGameStatusPtr->introState = INTRO_STATE_3; - gOverrideFlags |= GLOBAL_OVERRIDES_8; - intro_logos_update_fade(); + startup_set_fade_screen_alpha(255); + startup_set_fade_screen_color(224); + gGameStatusPtr->startupState = 3; + gOverrideFlags |= GLOBAL_OVERRIDES_DISABLE_DRAW_FRAME; + startup_fade_screen_update(); gGameStatusPtr->demoState = DEMO_STATE_DONE; break; case DEMO_SCENE_EXIT: - if (gGameStatusPtr->introState != INTRO_STATE_0) { - gGameStatusPtr->introState--; + if (gGameStatusPtr->startupState != 0) { + gGameStatusPtr->startupState--; } - if (gGameStatusPtr->introState == INTRO_STATE_0) { + if (gGameStatusPtr->startupState == 0) { gGameStatusPtr->nextDemoScene = 0; gGameStatusPtr->demoState = DEMO_STATE_NONE; gGameStatusPtr->peachFlags = 0; @@ -195,7 +195,7 @@ void state_step_demo(void) { gGameStatusPtr->unk_76 = FALSE; gGameStatusPtr->disableScripts = FALSE; gGameStatusPtr->keepUsingPartnerOnMapChange = FALSE; - gOverrideFlags &= ~GLOBAL_OVERRIDES_8; + gOverrideFlags &= ~GLOBAL_OVERRIDES_DISABLE_DRAW_FRAME; general_heap_create(); clear_render_tasks(); clear_worker_list(); @@ -210,7 +210,7 @@ void state_step_demo(void) { hud_element_clear_cache(); clear_trigger_data(); clear_printers(); - clear_entity_data(0); + clear_entity_data(FALSE); clear_screen_overlays(); clear_player_status(); clear_npcs(); @@ -231,7 +231,7 @@ void state_step_demo(void) { gGameStatusPtr->entryID = demoSceneData->index; gGameStatusPtr->peachFlags = 0; playerData->curPartner = demoSceneData->partnerID; - set_cam_viewport(0, 29, 20, -262, 177); + set_cam_viewport(CAM_DEFAULT, 29, 20, -262, 177); evt_set_variable(NULL, GB_StoryProgress, demoSceneData->storyProgress); if (gGameStatusPtr->nextDemoScene == 0) { @@ -249,7 +249,7 @@ void state_step_demo(void) { gGameStatusPtr->entryID = demoSceneData->index; gGameStatusPtr->peachFlags = PEACH_STATUS_FLAG_IS_PEACH; playerData->curPartner = demoSceneData->partnerID; - set_cam_viewport(0, 29, 20, -262, 177); + set_cam_viewport(CAM_DEFAULT, 29, 20, -262, 177); evt_set_variable(NULL, GB_StoryProgress, demoSceneData->storyProgress); if (gGameStatusPtr->nextDemoScene == 0) { diff --git a/src/state_file_select.c b/src/state_file_select.c index df0ec224c74..b327be2f5bf 100644 --- a/src/state_file_select.c +++ b/src/state_file_select.c @@ -37,7 +37,7 @@ NUPiOverlaySegment D_8007798C = { .bssEnd = filemenu_BSS_END, }; -u8 D_800779B0 = 0; +u8 IntroMessageIdx = 0; extern s32 D_80200000; extern ShapeFile gMapShapeData; @@ -73,7 +73,7 @@ void state_init_file_select(void) { gCameras[CAM_TATTLE].flags |= CAMERA_FLAG_DISABLED; gCameras[CAM_3].flags |= CAMERA_FLAG_DISABLED; gCameras[CAM_DEFAULT].vfov = 25.0f; - set_cam_viewport(0, 12, 28, 296, 184); + set_cam_viewport(CAM_DEFAULT, 12, 28, 296, 184); gCameras[CAM_DEFAULT].auxBoomLength = 40; gCameras[CAM_DEFAULT].lookAt_eye.x = 500.0f; gCameras[CAM_DEFAULT].lookAt_eye.y = 1000.0f; @@ -116,16 +116,16 @@ void state_step_language_select(void) { case 1: D_800A0930 = 5; D_800A0931 = 2; - gOverrideFlags |= GLOBAL_OVERRIDES_8; + gOverrideFlags |= GLOBAL_OVERRIDES_DISABLE_DRAW_FRAME; break; case 2: D_800A0930--; if (D_800A0930 == 0) { nuGfxSetCfb(fsFrameBuffers, 2); if (nuGfxCfb[2] == nuGfxCfb_ptr) { - gOverrideFlags &= ~GLOBAL_OVERRIDES_8; + gOverrideFlags &= ~GLOBAL_OVERRIDES_DISABLE_DRAW_FRAME; } else { - gOverrideFlags |= GLOBAL_OVERRIDES_8; + gOverrideFlags |= GLOBAL_OVERRIDES_DISABLE_DRAW_FRAME; set_windows_visible(WINDOW_GROUP_FILE_MENU); D_800A0930 = 1; D_800A0931 = 3; @@ -156,11 +156,11 @@ void state_step_language_select(void) { clear_item_entity_data(); clear_script_list(); clear_npcs(); - clear_entity_data(0); + clear_entity_data(FALSE); clear_trigger_data(); nuPiReadRomOverlay(&D_8007798C); filemenu_init(1); - gOverrideFlags &= ~GLOBAL_OVERRIDES_8; + gOverrideFlags &= ~GLOBAL_OVERRIDES_DISABLE_DRAW_FRAME; set_screen_overlay_params_front(OVERLAY_NONE, 255.0f); } if (D_800A0930 >= 0) { @@ -274,7 +274,7 @@ void state_step_exit_language_select(void) { break; case 2: if (D_800A0930 == 3) { - gOverrideFlags |= GLOBAL_OVERRIDES_8; + gOverrideFlags |= GLOBAL_OVERRIDES_DISABLE_DRAW_FRAME; } if (D_800A0930 >= 0) { @@ -289,7 +289,7 @@ void state_step_exit_language_select(void) { D_800A0930 = -1; nuGfxSetCfb(fsFrameBuffers, ARRAY_COUNT(fsFrameBuffers)); filemenu_cleanup(); - gOverrideFlags &= ~GLOBAL_OVERRIDES_8; + gOverrideFlags &= ~GLOBAL_OVERRIDES_DISABLE_DRAW_FRAME; mapSettings = get_current_map_settings(); mapConfig = &gAreas[gGameStatusPtr->areaID].maps[gGameStatusPtr->mapID]; gGameStatusPtr->isBattle = FALSE; diff --git a/src/state_intro.c b/src/state_intro.c index 23c19ea3ef3..45c0fba280b 100644 --- a/src/state_intro.c +++ b/src/state_intro.c @@ -3,82 +3,92 @@ #include "sprite.h" #include "game_modes.h" -SHIFT_BSS s32 D_800A0950; -SHIFT_BSS s16 D_800A0954; -SHIFT_BSS s16 D_800A0956; -SHIFT_BSS s16 D_800A0958; -SHIFT_BSS s16 D_800A095A; -SHIFT_BSS s16 D_800A095C; -SHIFT_BSS s16 D_800A095E; -SHIFT_BSS s32 D_800A0960; -SHIFT_BSS s32 D_800A0964; +enum IntroStates { + INTRO_INIT = 0x00000000, + INTRO_DISABLE_DRAW_FRAME = 0x00000001, + INTRO_LOAD_MAP = 0x00000002, + INTRO_AWAIT_MAIN = 0x00000003, + INTRO_FADE_IN = 0x00000004, + INTRO_ENABLE_DRAW_FRAME = 0x00000015, // unused +}; + +SHIFT_BSS s32 IntroEnableDrawFrameDelay; +SHIFT_BSS s16 IntroOverlayAlpha; +SHIFT_BSS s16 IntroFrontFadeAlpha; +SHIFT_BSS s16 IntroOverlayDelta; +SHIFT_BSS s16 IntroFadeColorR; +SHIFT_BSS s16 IntroFadeColorG; +SHIFT_BSS s16 IntroFadeColorB; +SHIFT_BSS s32 IntroOverlayType; +SHIFT_BSS s32 D_800A0964; // related to skipping the intro void state_init_intro(void) { - s8 unk_A8; + s8 viewportMode; - gGameStatusPtr->introState = INTRO_STATE_0; + gGameStatusPtr->startupState = INTRO_INIT; set_curtain_scale_goal(1.0f); set_curtain_fade_goal(0.3f); - unk_A8 = gGameStatusPtr->creditsViewportMode; - switch (unk_A8) { + viewportMode = gGameStatusPtr->introPart; + switch (viewportMode) { case 0: - intro_logos_set_fade_alpha(0); - - D_800A0954 = 0xFF; - D_800A0956 = 0x10; - D_800A0958 = 4; - D_800A0960 = 0; - D_800A095A = 208; - D_800A095C = 208; - D_800A095E = 208; + startup_set_fade_screen_alpha(0); + + IntroOverlayAlpha = 255; + IntroFrontFadeAlpha = 16; + IntroOverlayDelta = 4; + IntroOverlayType = OVERLAY_SCREEN_COLOR; + IntroFadeColorR = 208; + IntroFadeColorG = 208; + IntroFadeColorB = 208; D_800A0964 = 0; // hos_05 (Star Sanctuary) gGameStatusPtr->areaID = AREA_HOS; - gGameStatusPtr->mapID = 5; + gGameStatusPtr->mapID = 5; //TODO hard-coded map ID gGameStatusPtr->entryID = 3; break; case 1: - intro_logos_set_fade_alpha(0); - - D_800A0954 = 0; - D_800A0956 = 0xC; - D_800A0958 = 4; - D_800A0960 = unk_A8; - D_800A095A = 0; - D_800A095C = 0; - D_800A095E = 0; + startup_set_fade_screen_alpha(0); + + IntroOverlayAlpha = 0; + IntroFrontFadeAlpha = 12; + IntroOverlayDelta = 4; + IntroOverlayType = OVERLAY_VIEWPORT_COLOR; + IntroFadeColorR = 0; + IntroFadeColorG = 0; + IntroFadeColorB = 0; D_800A0964 = 0; // hos_04 (Outside the Sanctuary) gGameStatusPtr->areaID = AREA_HOS; - gGameStatusPtr->mapID = 4; + gGameStatusPtr->mapID = 4; //TODO hard-coded map ID gGameStatusPtr->entryID = 4; break; default: - intro_logos_set_fade_alpha(0); - intro_logos_set_fade_color(208); + startup_set_fade_screen_alpha(0); + startup_set_fade_screen_color(208); - gGameStatusPtr->creditsViewportMode = -1; + gGameStatusPtr->introPart = INTRO_PART_NONE; - D_800A0956 = 6; - D_800A0958 = 6; + IntroFrontFadeAlpha = 6; + IntroOverlayDelta = 6; - D_800779B0++; - if (D_800779B0 >= 4) { - D_800779B0 = 0; + IntroMessageIdx++; + if (IntroMessageIdx >= 4) { + // both hos_04 and hos_05 have an IntroMessage array of length 4 + IntroMessageIdx = 0; } D_800A0964 = 3; break; } - set_screen_overlay_params_back(D_800A0960, D_800A0954); - set_screen_overlay_color(SCREEN_LAYER_BACK, D_800A095A, D_800A095C, D_800A095E); + set_screen_overlay_params_back(IntroOverlayType, IntroOverlayAlpha); + set_screen_overlay_color(SCREEN_LAYER_BACK, IntroFadeColorR, IntroFadeColorG, IntroFadeColorB); - intro_logos_update_fade(); + startup_fade_screen_update(); } void state_step_intro(void) { @@ -86,71 +96,72 @@ void state_step_intro(void) { u32 pressedButtons = gGameStatusPtr->pressedButtons[0]; s32 i; - if (gGameStatusPtr->creditsViewportMode != -1) { + if (gGameStatusPtr->introPart != INTRO_PART_NONE) { if (D_800A0964 == 0 && pressedButtons & (BUTTON_A | BUTTON_B | BUTTON_START | BUTTON_Z)) { D_800A0964 = 1; } - if (D_800A0964 == 1 && (gGameStatusPtr->introState == INTRO_STATE_0 || - gGameStatusPtr->introState == INTRO_STATE_1 || - gGameStatusPtr->introState == INTRO_STATE_4)) + if (D_800A0964 == 1 && (gGameStatusPtr->startupState == INTRO_INIT || + gGameStatusPtr->startupState == INTRO_DISABLE_DRAW_FRAME || + gGameStatusPtr->startupState == INTRO_FADE_IN)) { - gGameStatusPtr->creditsViewportMode = 100; + gGameStatusPtr->introPart = INTRO_PART_100; state_init_intro(); return; } - if (D_800A0964 == 2 && (gGameStatusPtr->introState == INTRO_STATE_0 || - gGameStatusPtr->introState == INTRO_STATE_1 || - gGameStatusPtr->introState == INTRO_STATE_4)) + if (D_800A0964 == 2 && (gGameStatusPtr->startupState == INTRO_INIT || + gGameStatusPtr->startupState == INTRO_DISABLE_DRAW_FRAME || + gGameStatusPtr->startupState == INTRO_FADE_IN)) { - gGameStatusPtr->creditsViewportMode++; + gGameStatusPtr->introPart++; state_init_intro(); return; } } - switch (gGameStatusPtr->introState) { - case INTRO_STATE_0: + switch (gGameStatusPtr->startupState) { + case INTRO_INIT: update_effects(); update_cameras(); - if (gGameStatusPtr->creditsViewportMode == -1) { + if (gGameStatusPtr->introPart == INTRO_PART_NONE) { set_curtain_fade_goal(0.0f); - if (intro_logos_fade_out(D_800A0956)) { - gGameStatusPtr->introState = INTRO_STATE_1; + if (startup_fade_screen_out(IntroFrontFadeAlpha)) { + gGameStatusPtr->startupState = INTRO_DISABLE_DRAW_FRAME; set_curtain_draw_callback(NULL); } } else { - D_800A0954 += D_800A0956; - if (D_800A0954 >= 0xFF) { - D_800A0954 = 0xFF; - gGameStatusPtr->introState = INTRO_STATE_1; + IntroOverlayAlpha += IntroFrontFadeAlpha; + if (IntroOverlayAlpha >= 255) { + IntroOverlayAlpha = 255; + gGameStatusPtr->startupState = INTRO_DISABLE_DRAW_FRAME; set_curtain_draw_callback(NULL); } } break; - case INTRO_STATE_1: - D_800A0950 = 4; - gOverrideFlags |= GLOBAL_OVERRIDES_8; - if (D_800A0960 != 0xE) { - gGameStatusPtr->introState = INTRO_STATE_2; + case INTRO_DISABLE_DRAW_FRAME: + IntroEnableDrawFrameDelay = 4; + gOverrideFlags |= GLOBAL_OVERRIDES_DISABLE_DRAW_FRAME; + // this condition is always true, likely leftover from an earlier version + if (IntroOverlayType != OVERLAY_INTRO_1) { + gGameStatusPtr->startupState = INTRO_LOAD_MAP; } break; - case INTRO_STATE_15: - D_800A0950--; - if (D_800A0950 <= 0) { - gOverrideFlags &= ~GLOBAL_OVERRIDES_8; - gGameStatusPtr->introState = INTRO_STATE_2; + case INTRO_ENABLE_DRAW_FRAME: // unused + IntroEnableDrawFrameDelay--; + if (IntroEnableDrawFrameDelay <= 0) { + gOverrideFlags &= ~GLOBAL_OVERRIDES_DISABLE_DRAW_FRAME; + gGameStatusPtr->startupState = INTRO_LOAD_MAP; } break; - case INTRO_STATE_2: + case INTRO_LOAD_MAP: set_curtain_draw_callback(NULL); gGameStatusPtr->isBattle = FALSE; gGameStatusPtr->unk_76 = FALSE; gGameStatusPtr->disableScripts = FALSE; gGameStatusPtr->keepUsingPartnerOnMapChange = FALSE; - if (gGameStatusPtr->creditsViewportMode == -1) { + if (gGameStatusPtr->introPart == INTRO_PART_NONE) { general_heap_create(); clear_render_tasks(); clear_worker_list(); @@ -165,7 +176,7 @@ void state_step_intro(void) { hud_element_clear_cache(); clear_trigger_data(); clear_printers(); - clear_entity_data(0); + clear_entity_data(FALSE); clear_screen_overlays(); clear_player_status(); clear_npcs(); @@ -193,21 +204,21 @@ void state_step_intro(void) { playerData->level = 0; for (i = 0; i < ARRAY_COUNT(playerData->partners); i++) { - playerData->partners[i].enabled = 0; + playerData->partners[i].enabled = FALSE; } playerData->curPartner = PARTNER_NONE; - load_map_by_IDs(gGameStatusPtr->areaID, gGameStatusPtr->mapID, 0); - gGameStatusPtr->introState = INTRO_STATE_3; + load_map_by_IDs(gGameStatusPtr->areaID, gGameStatusPtr->mapID, LOAD_FROM_MAP); + gGameStatusPtr->startupState = INTRO_AWAIT_MAIN; disable_player_input(); break; - case INTRO_STATE_3: - if (D_800A0960 == 0xE) { - D_800A0960 = 0xF; + case INTRO_AWAIT_MAIN: + if (IntroOverlayType == OVERLAY_INTRO_1) { + IntroOverlayType = OVERLAY_INTRO_2; } - D_800A0954 = 255 - D_800A0958; - gOverrideFlags &= ~GLOBAL_OVERRIDES_8; - gCameras[CAM_DEFAULT].flags &= ~0x2; + IntroOverlayAlpha = 255 - IntroOverlayDelta; + gOverrideFlags &= ~GLOBAL_OVERRIDES_DISABLE_DRAW_FRAME; + gCameras[CAM_DEFAULT].flags &= ~CAMERA_FLAG_DISABLED; gOverrideFlags &= ~GLOBAL_OVERRIDES_DISABLE_RENDER_WORLD; update_player(); update_encounters(); @@ -216,29 +227,29 @@ void state_step_intro(void) { update_cameras(); if (!does_script_exist(gGameStatusPtr->mainScriptID)) { gGameStatusPtr->prevArea = gGameStatusPtr->areaID; - gGameStatusPtr->introState = INTRO_STATE_4; + gGameStatusPtr->startupState = INTRO_FADE_IN; break; } return; - case INTRO_STATE_4: + case INTRO_FADE_IN: update_effects(); update_cameras(); update_npcs(); - if (D_800A0954 == 0) { + if (IntroOverlayAlpha == 0) { set_screen_overlay_params_front(OVERLAY_NONE, -1.0f); set_screen_overlay_params_back(OVERLAY_NONE, -1.0f); } else { - D_800A0954 -= D_800A0958; - if (D_800A0954 < 0) { - D_800A0954 = 0; + IntroOverlayAlpha -= IntroOverlayDelta; + if (IntroOverlayAlpha < 0) { + IntroOverlayAlpha = 0; } } break; } - set_screen_overlay_params_back(D_800A0960, D_800A0954); - set_screen_overlay_color(SCREEN_LAYER_BACK, D_800A095A, D_800A095C, D_800A095E); - intro_logos_update_fade(); + set_screen_overlay_params_back(IntroOverlayType, IntroOverlayAlpha); + set_screen_overlay_color(SCREEN_LAYER_BACK, IntroFadeColorR, IntroFadeColorG, IntroFadeColorB); + startup_fade_screen_update(); } void state_drawUI_intro(void) { diff --git a/src/state_logos.c b/src/state_logos.c index 9a95b0e0d52..6198540b54e 100644 --- a/src/state_logos.c +++ b/src/state_logos.c @@ -11,11 +11,27 @@ void appendGfx_intro_logos(void); #if VERSION_JP #define LOGO_1_Y 54 #define LOGO_2_Y 104 +#define N64_FADE_IN_TIME 30 #else #define LOGO_1_Y 89 #define LOGO_2_Y 59 +#define N64_FADE_IN_TIME 40 #endif +enum LogoStates { + LOGOS_STATE_N64_FADE_IN = 0x00000000, + LOGOS_STATE_N64_HOLD = 0x00000001, + LOGOS_STATE_N64_FADE_OUT = 0x00000002, + LOGOS_STATE_NINTENDO_FADE_IN = 0x00000003, + LOGOS_STATE_NINTENDO_HOLD = 0x00000004, + LOGOS_STATE_NINTENDO_FADE_OUT = 0x00000005, + LOGOS_STATE_IS_FADE_IN = 0x00000006, + LOGOS_STATE_IS_HOLD_1 = 0x00000007, + LOGOS_STATE_IS_HOLD_2 = 0x00000008, + LOGOS_STATE_IS_FADE_OUT = 0x00000009, + LOGOS_STATE_CURTAINS_APPEAR = 0x0000000A, + LOGOS_STATE_CLEANUP = 0x0000000B, +}; s32 D_800778C0[] = { 0, 0 }; @@ -51,11 +67,11 @@ void state_init_logos(void) { s8* romEnd; general_heap_create(); - gGameStatusPtr->introState = INTRO_STATE_0; - gGameStatusPtr->introCounter = 0; - gGameStatusPtr->bSkipIntro = FALSE; - intro_logos_set_fade_alpha(255); - intro_logos_set_fade_color(0); + gGameStatusPtr->startupState = LOGOS_STATE_N64_FADE_IN; + gGameStatusPtr->logoTime = 0; + gGameStatusPtr->skipLogos = FALSE; + startup_set_fade_screen_alpha(255); + startup_set_fade_screen_color(0); romEnd = logos_ROM_END; romStart = logos_ROM_START; @@ -78,7 +94,7 @@ void state_init_logos(void) { gCameras[CAM_BATTLE].flags |= CAMERA_FLAG_DISABLED; gCameras[CAM_TATTLE].flags |= CAMERA_FLAG_DISABLED; gCameras[CAM_3].flags |= CAMERA_FLAG_DISABLED; - set_cam_viewport(0, 12, 28, 296, 184); + set_cam_viewport(CAM_DEFAULT, 12, 28, 296, 184); gCameras[CAM_DEFAULT].auxBoomLength = 40; gCameras[CAM_DEFAULT].bgColor[0] = 0; gCameras[CAM_DEFAULT].bgColor[1] = 0; @@ -101,10 +117,10 @@ void state_init_logos(void) { clear_npcs(); hud_element_clear_cache(); reset_background_settings(); - clear_entity_data(1); + clear_entity_data(TRUE); clear_effect_data(); gOverrideFlags |= GLOBAL_OVERRIDES_DISABLE_RENDER_WORLD; - intro_logos_update_fade(); + startup_fade_screen_update(); gGameStatusPtr->backgroundFlags = 0; } @@ -113,128 +129,124 @@ void state_step_logos(void) { int pressedButtons = gGameStatusPtr->pressedButtons[0]; #endif - if (gGameStatusPtr->bSkipIntro) { - if (intro_logos_fade_out(10)) { + if (gGameStatusPtr->skipLogos) { + if (startup_fade_screen_out(10)) { set_curtain_scale(1.0f); set_curtain_fade(0.0f); set_game_mode(GAME_MODE_TITLE_SCREEN); } } else { #if VERSION_JP - if ((gGameStatusPtr->introState == INTRO_STATE_1 || - gGameStatusPtr->introState == INTRO_STATE_2 || - gGameStatusPtr->introState == INTRO_STATE_3 || - gGameStatusPtr->introState == INTRO_STATE_4 || - gGameStatusPtr->introState == INTRO_STATE_5 || - gGameStatusPtr->introState == INTRO_STATE_6 || - gGameStatusPtr->introState == INTRO_STATE_7 || - gGameStatusPtr->introState == INTRO_STATE_8 || - gGameStatusPtr->introState == INTRO_STATE_9 || - gGameStatusPtr->introState == INTRO_STATE_A) && - (pressedButtons & (BUTTON_START | BUTTON_Z | BUTTON_A))) - { - intro_logos_set_fade_color(208); - gGameStatusPtr->bSkipIntro = 1; + if ((gGameStatusPtr->startupState == LOGOS_STATE_N64_HOLD + || gGameStatusPtr->startupState == LOGOS_STATE_N64_FADE_OUT + || gGameStatusPtr->startupState == LOGOS_STATE_NINTENDO_FADE_IN + || gGameStatusPtr->startupState == LOGOS_STATE_NINTENDO_HOLD + || gGameStatusPtr->startupState == LOGOS_STATE_NINTENDO_FADE_OUT + || gGameStatusPtr->startupState == LOGOS_STATE_IS_FADE_IN + || gGameStatusPtr->startupState == LOGOS_STATE_IS_HOLD_1 + || gGameStatusPtr->startupState == LOGOS_STATE_IS_HOLD_2 + || gGameStatusPtr->startupState == LOGOS_STATE_IS_FADE_OUT + || gGameStatusPtr->startupState == LOGOS_STATE_CURTAINS_APPEAR) + && (pressedButtons & (BUTTON_START | BUTTON_Z | BUTTON_A)) + ) { + startup_set_fade_screen_color(208); + gGameStatusPtr->skipLogos = TRUE; } #endif - switch (gGameStatusPtr->introState) { - case INTRO_STATE_0: - if (intro_logos_fade_in(10)) { - gGameStatusPtr->introState++; - gGameStatusPtr->introCounter = 30; + switch (gGameStatusPtr->startupState) { + case LOGOS_STATE_N64_FADE_IN: + if (startup_fade_screen_in(10)) { + gGameStatusPtr->startupState++; + gGameStatusPtr->logoTime = 30; } break; - case INTRO_STATE_1: - if (gGameStatusPtr->introCounter == 0) { - intro_logos_set_fade_color(208); - gGameStatusPtr->introState++; + case LOGOS_STATE_N64_HOLD: + if (gGameStatusPtr->logoTime == 0) { + startup_set_fade_screen_color(208); + gGameStatusPtr->startupState++; } - gGameStatusPtr->introCounter--; + gGameStatusPtr->logoTime--; break; - case INTRO_STATE_2: - if (intro_logos_fade_out(10)) { - gGameStatusPtr->introState++; + case LOGOS_STATE_N64_FADE_OUT: + if (startup_fade_screen_out(10)) { + gGameStatusPtr->startupState++; #if VERSION_JP - gGameStatusPtr->introState += 2; + gGameStatusPtr->startupState += 2; #endif } break; - case INTRO_STATE_3: - if (intro_logos_fade_in(10)) { - gGameStatusPtr->introState++; -#if VERSION_JP - gGameStatusPtr->introCounter = 30; -#else - gGameStatusPtr->introCounter = 40; -#endif + case LOGOS_STATE_NINTENDO_FADE_IN: + if (startup_fade_screen_in(10)) { + gGameStatusPtr->startupState++; + gGameStatusPtr->logoTime = N64_FADE_IN_TIME; } break; - case INTRO_STATE_4: - if (gGameStatusPtr->introCounter == 0) { - gGameStatusPtr->introState++; + case LOGOS_STATE_NINTENDO_HOLD: + if (gGameStatusPtr->logoTime == 0) { + gGameStatusPtr->startupState++; #if VERSION_JP - intro_logos_set_fade_color(0); + startup_set_fade_screen_color(0); #else - intro_logos_set_fade_color(208); + startup_set_fade_screen_color(208); #endif } - gGameStatusPtr->introCounter--; + gGameStatusPtr->logoTime--; break; - case INTRO_STATE_5: - if (intro_logos_fade_out(10)) { - gGameStatusPtr->introState++; + case LOGOS_STATE_NINTENDO_FADE_OUT: + if (startup_fade_screen_out(10)) { + gGameStatusPtr->startupState++; } break; - case INTRO_STATE_6: - if (intro_logos_fade_in(10)) { - gGameStatusPtr->introState++; - gGameStatusPtr->introCounter = 30; + case LOGOS_STATE_IS_FADE_IN: + if (startup_fade_screen_in(10)) { + gGameStatusPtr->startupState++; + gGameStatusPtr->logoTime = 30; } break; - case INTRO_STATE_7: - if (gGameStatusPtr->introCounter == 0) { - gGameStatusPtr->introState++; - intro_logos_set_fade_color(208); - gGameStatusPtr->introCounter = 30; + case LOGOS_STATE_IS_HOLD_1: + if (gGameStatusPtr->logoTime == 0) { + gGameStatusPtr->startupState++; + startup_set_fade_screen_color(208); + gGameStatusPtr->logoTime = 30; } - gGameStatusPtr->introCounter--; + gGameStatusPtr->logoTime--; break; - case INTRO_STATE_8: - if (gGameStatusPtr->introCounter == 0) { - gGameStatusPtr->introState++; + case LOGOS_STATE_IS_HOLD_2: + if (gGameStatusPtr->logoTime == 0) { + gGameStatusPtr->startupState++; set_curtain_scale_goal(1.0f); set_curtain_draw_callback(NULL); set_curtain_fade_goal(0.3f); } else { - gGameStatusPtr->introCounter--; + gGameStatusPtr->logoTime--; } break; - case INTRO_STATE_9: - if (intro_logos_fade_out(10)) { - gGameStatusPtr->introCounter = 15; - gGameStatusPtr->introState++; + case LOGOS_STATE_IS_FADE_OUT: + if (startup_fade_screen_out(10)) { + gGameStatusPtr->logoTime = 15; + gGameStatusPtr->startupState++; } break; - case INTRO_STATE_A: - if (gGameStatusPtr->introCounter == 0) { - gGameStatusPtr->introState++; + case LOGOS_STATE_CURTAINS_APPEAR: + if (gGameStatusPtr->logoTime == 0) { + gGameStatusPtr->startupState++; } else { - gGameStatusPtr->introCounter--; + gGameStatusPtr->logoTime--; } break; - case INTRO_STATE_B: + case LOGOS_STATE_CLEANUP: heap_free(gLogosImages); gLogosImages = NULL; - intro_logos_set_fade_alpha(255); - gGameStatusPtr->creditsViewportMode = 0; + startup_set_fade_screen_alpha(255); + gGameStatusPtr->introPart = INTRO_PART_0; set_game_mode(GAME_MODE_INTRO); break; } } update_npcs(); update_cameras(); - intro_logos_update_fade(); + startup_fade_screen_update(); } void state_drawUI_logos(void) { @@ -252,10 +264,10 @@ void appendGfx_intro_logos(void) { gDPFillRectangle(gMainGfxPos++, 0, 0, SCREEN_WIDTH - 1, SCREEN_HEIGHT - 1); gDPPipeSync(gMainGfxPos++); - switch (gGameStatusPtr->introState) { - case INTRO_STATE_0: - case INTRO_STATE_1: - case INTRO_STATE_2: + switch (gGameStatusPtr->startupState) { + case LOGOS_STATE_N64_FADE_IN: + case LOGOS_STATE_N64_HOLD: + case LOGOS_STATE_N64_FADE_OUT: gSPDisplayList(gMainGfxPos++, D_80077908); for (i = 0; i < 7; i++) { gDPLoadTextureTile(gMainGfxPos++, gLogosImage1 + i * 0x1000, G_IM_FMT_RGBA, G_IM_SIZ_16b, 128, 112, @@ -265,15 +277,15 @@ void appendGfx_intro_logos(void) { gDPPipeSync(gMainGfxPos++); } break; - case INTRO_STATE_3: - case INTRO_STATE_4: - case INTRO_STATE_5: + case LOGOS_STATE_NINTENDO_FADE_IN: + case LOGOS_STATE_NINTENDO_HOLD: + case LOGOS_STATE_NINTENDO_FADE_OUT: #if VERSION_JP break; - case INTRO_STATE_6: - case INTRO_STATE_7: - case INTRO_STATE_8: - case INTRO_STATE_9: + case LOGOS_STATE_IS_FADE_IN: + case LOGOS_STATE_IS_HOLD_1: + case LOGOS_STATE_IS_HOLD_2: + case LOGOS_STATE_IS_FADE_OUT: #endif gSPDisplayList(gMainGfxPos++, D_80077908); for (i = 0; i < 6; i++) { @@ -289,10 +301,10 @@ void appendGfx_intro_logos(void) { } #if !VERSION_JP break; - case INTRO_STATE_6: - case INTRO_STATE_7: - case INTRO_STATE_8: - case INTRO_STATE_9: + case LOGOS_STATE_IS_FADE_IN: + case LOGOS_STATE_IS_HOLD_1: + case LOGOS_STATE_IS_HOLD_2: + case LOGOS_STATE_IS_FADE_OUT: gSPDisplayList(gMainGfxPos++, D_80077908); #endif for (i = 0; i < 14; i++) { diff --git a/src/state_pause.c b/src/state_pause.c index 4c7833c3c0b..f5ab86e3e4a 100644 --- a/src/state_pause.c +++ b/src/state_pause.c @@ -66,7 +66,7 @@ void state_step_pause(void) { if (nuGfxCfb[1] == nuGfxCfb_ptr) { D_800A0920 = 4; D_800A0921 = 2; - gOverrideFlags |= GLOBAL_OVERRIDES_8; + gOverrideFlags |= GLOBAL_OVERRIDES_DISABLE_DRAW_FRAME; gGameStatusPtr->backgroundFlags &= ~BACKGROUND_RENDER_STATE_MASK; gGameStatusPtr->backgroundFlags |= BACKGROUND_RENDER_STATE_1; @@ -102,14 +102,14 @@ void state_step_pause(void) { clear_item_entity_data(); clear_script_list(); clear_npcs(); - clear_entity_data(0); + clear_entity_data(FALSE); clear_trigger_data(); SavedReverbMode = sfx_get_reverb_mode(); sfx_set_reverb_mode(0); bgm_quiet_max_volume(); nuPiReadRomOverlay(&D_8007795C); pause_init(); - gOverrideFlags &= ~GLOBAL_OVERRIDES_8; + gOverrideFlags &= ~GLOBAL_OVERRIDES_DISABLE_DRAW_FRAME; } if (D_800A0920 >= 0) { @@ -145,7 +145,7 @@ void state_step_unpause(void) { case 0: case 1: if (D_800A0920 == 4) { - gOverrideFlags |= GLOBAL_OVERRIDES_8; + gOverrideFlags |= GLOBAL_OVERRIDES_DISABLE_DRAW_FRAME; } if (D_800A0920 >= 0) { @@ -163,7 +163,7 @@ void state_step_unpause(void) { D_800A0920 = -1; nuGfxSetCfb(pause_frameBuffers, ARRAY_COUNT(pause_frameBuffers)); pause_cleanup(); - gOverrideFlags &= ~GLOBAL_OVERRIDES_8; + gOverrideFlags &= ~GLOBAL_OVERRIDES_DISABLE_DRAW_FRAME; mapSettings = get_current_map_settings(); mapConfig = &gAreas[gGameStatusPtr->areaID].maps[gGameStatusPtr->mapID]; gGameStatusPtr->isBattle = FALSE; diff --git a/src/state_startup.c b/src/state_startup.c index 5ca4dff473b..b1e113d06fb 100644 --- a/src/state_startup.c +++ b/src/state_startup.c @@ -5,16 +5,16 @@ #include "game_modes.h" void state_init_startup(void) { - gOverrideFlags |= GLOBAL_OVERRIDES_8; - gGameStatusPtr->introState = INTRO_STATE_3; + gOverrideFlags |= GLOBAL_OVERRIDES_DISABLE_DRAW_FRAME; + gGameStatusPtr->startupState = 3; } void state_step_startup(void) { GameStatus* gameStatus = gGameStatusPtr; s32 i; - if (gameStatus->introState != INTRO_STATE_0) { - gameStatus->introState--; + if (gameStatus->startupState != 0) { + gameStatus->startupState--; return; } @@ -27,7 +27,7 @@ void state_step_startup(void) { gGameStatusPtr->unk_76 = FALSE; gGameStatusPtr->disableScripts = FALSE; gGameStatusPtr->keepUsingPartnerOnMapChange = FALSE; - gGameStatusPtr->creditsViewportMode = -1; + gGameStatusPtr->introPart = INTRO_PART_NONE; gGameStatusPtr->demoBattleFlags = 0; gGameStatusPtr->unk_A9 = -1; gGameStatusPtr->demoState = DEMO_STATE_NONE; @@ -47,7 +47,7 @@ void state_step_startup(void) { hud_element_clear_cache(); clear_trigger_data(); clear_printers(); - clear_entity_data(0); + clear_entity_data(FALSE); clear_screen_overlays(); clear_player_status(); clear_npcs(); @@ -67,7 +67,7 @@ void state_step_startup(void) { for (i = 0; i < 4; i++) { gGameStatusPtr->unk_50[i] = 4; - gGameStatusPtr->unk_48[i] = 0xF; + gGameStatusPtr->unk_48[i] = 15; } fio_has_valid_backup(); @@ -80,7 +80,7 @@ void state_step_startup(void) { audio_set_mono(); } - gOverrideFlags &= ~GLOBAL_OVERRIDES_8; + gOverrideFlags &= ~GLOBAL_OVERRIDES_DISABLE_DRAW_FRAME; set_game_mode(GAME_MODE_LOGOS); } diff --git a/src/state_title_screen.c b/src/state_title_screen.c index fda6b8b55f9..cc2f0a56c8b 100644 --- a/src/state_title_screen.c +++ b/src/state_title_screen.c @@ -24,26 +24,47 @@ #define TITLE_NUM_TILES (TITLE_HEIGHT / TITLE_TILE_HEIGHT) // Number of tiles in the texture #define TITLE_TILE_PIXELS (TITLE_WIDTH * TITLE_TILE_HEIGHT) // Number of pixels in a single tile of the texture -s16 D_800779C0[2] = {0, 0}; + +enum TitleScreenStates { + TITLE_STATE_INIT = 0x00000000, + TITLE_STATE_APPEAR = 0x00000001, + TITLE_STATE_HOLD = 0x00000002, // show the title screen with PRESS START blinking + TITLE_STATE_UNUSED = 0x00000003, + TITLE_STATE_BEGIN_DISMISS = 0x00000004, + TITLE_STATE_DISMISS = 0x00000005, + TITLE_STATE_EXIT = 0x00000006, +}; + +enum { + NEXT_STATE_DEMO = 10, + NEXT_STATE_INTRO = 9, + NEXT_STATE_FILE_SELECT = 5, + NEXT_STATE_NONE = 0, // used only for the initial value +}; + +s16 TitleScreenNextState = NEXT_STATE_NONE; SaveMetadata gSaveSlotMetadata[4] = { - { .filename = {FILENAME_ERROR} }, - { .filename = {FILENAME_ERROR} }, - { .filename = {FILENAME_ERROR} }, - { .filename = {FILENAME_ERROR} }, + { .filename = { FILENAME_ERROR } }, + { .filename = { FILENAME_ERROR } }, + { .filename = { FILENAME_ERROR } }, + { .filename = { FILENAME_ERROR } }, }; -u8 gSaveSlotHasData[4] = {TRUE, TRUE, TRUE, TRUE}; +u8 gSaveSlotHasData[4] = { TRUE, TRUE, TRUE, TRUE }; -s32 TitleScreen_PressStart_Alpha = 0; // the opacity of "PRESS START" text -b32 TitleScreen_PressStart_IsVisible = FALSE; // toggles the visibility of "PRESS START" -s32 TitleScreen_PressStart_BlinkCounter = 0; // counts to 16, then toggles TitleScreen_PressStart_IsVisible +s32 PressStart_Alpha = 0; // the opacity of "PRESS START" text +b32 PressStart_IsVisible = FALSE; // toggles the visibility of "PRESS START" +s32 PressStart_BlinkCounter = 0; // counts to 16, then toggles PressStart_IsVisible -s32 D_80077A34[1] = {0}; +// controls whether the intro story or the demo will player after TITLE_STATE_HOLD is done +// since this state is reached for the first time after the intro has already played once or was skipped, +// this is initially false and the demo is will play first. +s32 PlayIntroNext = FALSE; Lights1 D_80077A38 = gdSPDefLights1(255, 255, 255, 0, 0, 0, 0, 0, 0); -Gfx D_80077A50[] = { +Gfx TitleSetupGfx[] = { gsDPPipeSync(), gsDPSetCycleType(G_CYC_1CYCLE), gsDPSetRenderMode(G_RM_CLD_SURF, G_RM_CLD_SURF2), @@ -77,7 +98,7 @@ typedef struct TitleDataStruct { #define COPYRIGHT_WIDTH 144 #endif -SHIFT_BSS s16 D_800A0970; +SHIFT_BSS s16 TitleScreen_AppearDelay; SHIFT_BSS TitleDataStruct* TitleScreen_ImgList; SHIFT_BSS s32* TitleScreen_ImgList_Logo; SHIFT_BSS u8 (*TitleScreen_ImgList_Copyright)[COPYRIGHT_WIDTH]; @@ -85,7 +106,7 @@ SHIFT_BSS s32* TitleScreen_ImgList_PressStart; #if VERSION_JP SHIFT_BSS s32* TitleScreen_ImgList_CopyrightPalette; #endif -SHIFT_BSS s16 D_800A0988; +SHIFT_BSS s16 TitleScreen_TimeLeft; void appendGfx_title_screen(void); void draw_title_screen_NOP(void); @@ -105,11 +126,11 @@ void state_init_title_screen(void) { general_heap_create(); clear_printers(); sfx_set_reverb_mode(0); - gGameStatusPtr->introState = INTRO_STATE_0; - gGameStatusPtr->introCounter = 0; + gGameStatusPtr->startupState = TITLE_STATE_INIT; + gGameStatusPtr->logoTime = 0; gGameStatusPtr->isBattle = FALSE; - gGameStatusPtr->creditsViewportMode = -1; - intro_logos_update_fade(); + gGameStatusPtr->introPart = INTRO_PART_NONE; + startup_fade_screen_update(); titleData = load_asset_by_name("title_data", &titleDataSize); titleDataDst = TitleScreen_ImgList = heap_malloc(titleDataSize); decode_yay0(titleData, titleDataDst); @@ -133,7 +154,7 @@ void state_init_title_screen(void) { gCameras[CAM_BATTLE].flags |= CAMERA_FLAG_DISABLED; gCameras[CAM_TATTLE].flags |= CAMERA_FLAG_DISABLED; gCameras[CAM_3].flags |= CAMERA_FLAG_DISABLED; - set_cam_viewport(0, 12, 28, 296, 184); + set_cam_viewport(CAM_DEFAULT, 12, 28, 296, 184); gCameras[CAM_DEFAULT].auxBoomLength = 40; gCameras[CAM_DEFAULT].bgColor[0] = 0; gCameras[CAM_DEFAULT].bgColor[1] = 0; @@ -156,115 +177,115 @@ void state_init_title_screen(void) { clear_npcs(); hud_element_clear_cache(); reset_background_settings(); - clear_entity_data(1); + clear_entity_data(TRUE); clear_effect_data(); gOverrideFlags |= GLOBAL_OVERRIDES_DISABLE_RENDER_WORLD; clear_player_data(); - gOverrideFlags &= ~GLOBAL_OVERRIDES_8; + gOverrideFlags &= ~GLOBAL_OVERRIDES_DISABLE_DRAW_FRAME; game_mode_set_fpDrawAuxUI(0, appendGfx_title_screen); load_map_bg("title_bg"); read_background_size(&gBackgroundImage); bgm_set_song(0, SONG_MAIN_THEME, 0, 500, 8); - D_800A0988 = 480; + TitleScreen_TimeLeft = 480; } void state_step_title_screen(void) { - s16* temp; + s32 temp; u32 pressedButtons = gGameStatusPtr->pressedButtons[0]; set_curtain_scale(1.0f); set_curtain_fade(0.0f); - if (D_800A0988 > 0) { - D_800A0988--; + if (TitleScreen_TimeLeft > 0) { + TitleScreen_TimeLeft--; } - switch (gGameStatusPtr->introState) { - case INTRO_STATE_0: - D_800A0970 = 3; - gOverrideFlags |= GLOBAL_OVERRIDES_8; - gGameStatusPtr->unk_B0 = 20; - gGameStatusPtr->unk_AF = gGameStatusPtr->unk_B0; - gGameStatusPtr->introState++; + switch (gGameStatusPtr->startupState) { + case TITLE_STATE_INIT: + TitleScreen_AppearDelay = 3; + gOverrideFlags |= GLOBAL_OVERRIDES_DISABLE_DRAW_FRAME; + gGameStatusPtr->titleScreenDismissTime = 20; + gGameStatusPtr->titleScreenTimer = gGameStatusPtr->titleScreenDismissTime; + gGameStatusPtr->startupState++; break; - case INTRO_STATE_1: - if (D_800A0970 != 0) { - D_800A0970--; - } else { - if (gGameStatusPtr->unk_AF != 0) { - gGameStatusPtr->unk_AF--; - } - gOverrideFlags &= ~GLOBAL_OVERRIDES_8; - if (intro_logos_fade_in(6) != 0) { - if (gGameStatusPtr->unk_AF == 0) { - gGameStatusPtr->introState = INTRO_STATE_2; - } + case TITLE_STATE_APPEAR: + if (TitleScreen_AppearDelay != 0) { + TitleScreen_AppearDelay--; + break; + } + if (gGameStatusPtr->titleScreenTimer != 0) { + gGameStatusPtr->titleScreenTimer--; + } + gOverrideFlags &= ~GLOBAL_OVERRIDES_DISABLE_DRAW_FRAME; + if (startup_fade_screen_in(6) != 0) { + if (gGameStatusPtr->titleScreenTimer == 0) { + gGameStatusPtr->startupState = TITLE_STATE_HOLD; } - intro_logos_update_fade(); } + startup_fade_screen_update(); break; - case INTRO_STATE_2: - if (D_80077A34[0] != NULL && D_800A0988 == 120) { + case TITLE_STATE_HOLD: + if (PlayIntroNext && TitleScreen_TimeLeft == 120) { bgm_set_song(0, -1, 0, 3900, 8); } - if (D_800A0988 == 0) { - gGameStatusPtr->introState = INTRO_STATE_4; - if (D_80077A34[0] == NULL) { - *D_800779C0 = 10; + if (TitleScreen_TimeLeft == 0) { + gGameStatusPtr->startupState = TITLE_STATE_BEGIN_DISMISS; + if (!PlayIntroNext) { + TitleScreenNextState = NEXT_STATE_DEMO; } else { - *D_800779C0 = 9; + TitleScreenNextState = NEXT_STATE_INTRO; } - D_80077A34[0] ^= 1; + PlayIntroNext ^= 1; return; } if (pressedButtons & (BUTTON_A | BUTTON_START)) { - gGameStatusPtr->introState = INTRO_STATE_4; - *D_800779C0 = 5; + gGameStatusPtr->startupState = TITLE_STATE_BEGIN_DISMISS; + TitleScreenNextState = NEXT_STATE_FILE_SELECT; sfx_play_sound(SOUND_FILE_MENU_IN); bgm_set_song(0, SONG_FILE_SELECT, 0, 500, 8); return; } break; - case INTRO_STATE_4: - gGameStatusPtr->introState = INTRO_STATE_5; - intro_logos_set_fade_color(0xD0); - if (*D_800779C0 == 9 || *D_800779C0 == 10) { - gGameStatusPtr->unk_B0 = 20; + case TITLE_STATE_BEGIN_DISMISS: + gGameStatusPtr->startupState = TITLE_STATE_DISMISS; + startup_set_fade_screen_color(208); + if (TitleScreenNextState == NEXT_STATE_INTRO || TitleScreenNextState == NEXT_STATE_DEMO) { + gGameStatusPtr->titleScreenDismissTime = 20; } else { - gGameStatusPtr->unk_B0 = 10; + gGameStatusPtr->titleScreenDismissTime = 10; } - gGameStatusPtr->unk_AF = gGameStatusPtr->unk_B0; + gGameStatusPtr->titleScreenTimer = gGameStatusPtr->titleScreenDismissTime; break; - case INTRO_STATE_5: - if (*D_800779C0 == 9 || *D_800779C0 == 10) { - if (gGameStatusPtr->unk_AF != 0) { - gGameStatusPtr->unk_AF--; + case TITLE_STATE_DISMISS: + if (TitleScreenNextState == NEXT_STATE_INTRO || TitleScreenNextState == NEXT_STATE_DEMO) { + if (gGameStatusPtr->titleScreenTimer != 0) { + gGameStatusPtr->titleScreenTimer--; } - if (intro_logos_fade_out(0xA) != 0) { - if (gGameStatusPtr->unk_AF == 0) { - gGameStatusPtr->unk_AF = 3; - gOverrideFlags |= GLOBAL_OVERRIDES_8; - gGameStatusPtr->introState = INTRO_STATE_6; + if (startup_fade_screen_out(10) != 0) { + if (gGameStatusPtr->titleScreenTimer == 0) { + gGameStatusPtr->titleScreenTimer = 3; + gOverrideFlags |= GLOBAL_OVERRIDES_DISABLE_DRAW_FRAME; + gGameStatusPtr->startupState = TITLE_STATE_EXIT; } } - intro_logos_update_fade(); - } else if (*D_800779C0 == 5) { - if (gGameStatusPtr->unk_AF == 0) { - gGameStatusPtr->unk_AF = 3; - gOverrideFlags |= GLOBAL_OVERRIDES_8; - gGameStatusPtr->introState = INTRO_STATE_6; + startup_fade_screen_update(); + } else if (TitleScreenNextState == NEXT_STATE_FILE_SELECT) { + if (gGameStatusPtr->titleScreenTimer == 0) { + gGameStatusPtr->titleScreenTimer = 3; + gOverrideFlags |= GLOBAL_OVERRIDES_DISABLE_DRAW_FRAME; + gGameStatusPtr->startupState = TITLE_STATE_EXIT; } else { - gGameStatusPtr->unk_AF--; + gGameStatusPtr->titleScreenTimer--; } } else { - gGameStatusPtr->unk_AF = 3; - gOverrideFlags |= GLOBAL_OVERRIDES_8; - gGameStatusPtr->introState = INTRO_STATE_6; + gGameStatusPtr->titleScreenTimer = 3; + gOverrideFlags |= GLOBAL_OVERRIDES_DISABLE_DRAW_FRAME; + gGameStatusPtr->startupState = TITLE_STATE_EXIT; } break; - case INTRO_STATE_6: - if (gGameStatusPtr->unk_AF != 0) { - gGameStatusPtr->unk_AF--; + case TITLE_STATE_EXIT: + if (gGameStatusPtr->titleScreenTimer != 0) { + gGameStatusPtr->titleScreenTimer--; break; } general_heap_create(); @@ -275,24 +296,23 @@ void state_step_title_screen(void) { clear_npcs(); hud_element_clear_cache(); spr_init_sprites(PLAYER_SPRITES_MARIO_WORLD); - clear_entity_data(1); + clear_entity_data(TRUE); clear_windows(); - gOverrideFlags &= ~GLOBAL_OVERRIDES_8; + gOverrideFlags &= ~GLOBAL_OVERRIDES_DISABLE_DRAW_FRAME; gOverrideFlags &= ~GLOBAL_OVERRIDES_DISABLE_RENDER_WORLD; - temp = D_800779C0; gGameStatusPtr->entryID = 0; - switch (temp[0]) { - case 9: - gGameStatusPtr->creditsViewportMode = 0; + switch (TitleScreenNextState) { + case NEXT_STATE_INTRO: + gGameStatusPtr->introPart = INTRO_PART_0; set_game_mode(GAME_MODE_INTRO); break; - case 10: + case NEXT_STATE_DEMO: set_game_mode(GAME_MODE_DEMO); break; - case 5: - gGameStatusPtr->areaID = 0; - gGameStatusPtr->mapID = 0xB; + case NEXT_STATE_FILE_SELECT: + gGameStatusPtr->areaID = AREA_KMR; + gGameStatusPtr->mapID = 0xB; //TODO hardcoded map IDs gGameStatusPtr->entryID = 0; set_game_mode(GAME_MODE_FILE_SELECT); break; @@ -300,30 +320,30 @@ void state_step_title_screen(void) { return; } - if (!(gOverrideFlags & GLOBAL_OVERRIDES_8)) { + if (!(gOverrideFlags & GLOBAL_OVERRIDES_DISABLE_DRAW_FRAME)) { update_npcs(); update_cameras(); } } void state_drawUI_title_screen(void) { - switch (gGameStatusPtr->introState) { - case INTRO_STATE_0: - TitleScreen_PressStart_Alpha = 0; - TitleScreen_PressStart_IsVisible = FALSE; - TitleScreen_PressStart_BlinkCounter = 0; + switch (gGameStatusPtr->startupState) { + case TITLE_STATE_INIT: + PressStart_Alpha = 0; + PressStart_IsVisible = FALSE; + PressStart_BlinkCounter = 0; draw_title_screen_NOP(); break; - case INTRO_STATE_2: + case TITLE_STATE_HOLD: draw_title_screen_NOP(); if (gGameStatusPtr->contBitPattern & 1) { title_screen_draw_press_start(); } - case INTRO_STATE_3: + case TITLE_STATE_UNUSED: break; - case INTRO_STATE_1: - case INTRO_STATE_4: - case INTRO_STATE_5: + case TITLE_STATE_APPEAR: + case TITLE_STATE_BEGIN_DISMISS: + case TITLE_STATE_DISMISS: draw_title_screen_NOP(); break; } @@ -333,26 +353,26 @@ void appendGfx_title_screen(void) { f32 phi_f12; s32 temp; - switch (gGameStatusPtr->introState) { - case INTRO_STATE_0: - case INTRO_STATE_3: + switch (gGameStatusPtr->startupState) { + case TITLE_STATE_INIT: + case TITLE_STATE_UNUSED: break; - case INTRO_STATE_1: - phi_f12 = gGameStatusPtr->unk_AF; - phi_f12 /= gGameStatusPtr->unk_B0; + case TITLE_STATE_APPEAR: + phi_f12 = gGameStatusPtr->titleScreenTimer; + phi_f12 /= gGameStatusPtr->titleScreenDismissTime; phi_f12 = SQ(phi_f12); title_screen_draw_images(phi_f12, phi_f12); break; - case INTRO_STATE_2: + case TITLE_STATE_HOLD: title_screen_draw_images(0.0f, 0.0f); break; - case INTRO_STATE_4: + case TITLE_STATE_BEGIN_DISMISS: title_screen_draw_images(0.0f, 0.0f); break; - case INTRO_STATE_5: - temp = gGameStatusPtr->unk_AF - 1; - phi_f12 = gGameStatusPtr->unk_B0 - temp; - phi_f12 /= gGameStatusPtr->unk_B0; + case TITLE_STATE_DISMISS: + temp = gGameStatusPtr->titleScreenTimer - 1; + phi_f12 = gGameStatusPtr->titleScreenDismissTime - temp; + phi_f12 /= gGameStatusPtr->titleScreenDismissTime; phi_f12 = SQ(phi_f12); title_screen_draw_images(phi_f12, phi_f12); break; @@ -384,18 +404,18 @@ void appendGfx_title_screen(void) { void draw_title_screen_NOP(void) { } -void title_screen_draw_images(f32 arg0, f32 arg1) { - title_screen_draw_logo(arg0); - title_screen_draw_copyright(arg1); +void title_screen_draw_images(f32 logoMoveAlpha, f32 copyrightMoveAlpha) { + title_screen_draw_logo(logoMoveAlpha); + title_screen_draw_copyright(copyrightMoveAlpha); } -void title_screen_draw_logo(f32 arg0) { +void title_screen_draw_logo(f32 moveAlpha) { s32 yOffset; s32 i; - gSPDisplayList(gMainGfxPos++, D_80077A50); + gSPDisplayList(gMainGfxPos++, TitleSetupGfx); gDPPipeSync(gMainGfxPos++); - yOffset = -100 * arg0; + yOffset = -100 * moveAlpha; for (i = 0; i < TITLE_NUM_TILES; i++) { // Load a tile from the logo texture @@ -427,35 +447,35 @@ void title_screen_draw_logo(f32 arg0) { #endif void title_screen_draw_press_start(void) { - switch (TitleScreen_PressStart_IsVisible) { + switch (PressStart_IsVisible) { case FALSE: - TitleScreen_PressStart_Alpha -= 128; - if (TitleScreen_PressStart_Alpha < 0) { - TitleScreen_PressStart_Alpha = 0; + PressStart_Alpha -= 128; + if (PressStart_Alpha < 0) { + PressStart_Alpha = 0; } - TitleScreen_PressStart_BlinkCounter++; - if (TitleScreen_PressStart_BlinkCounter >= 16) { - TitleScreen_PressStart_BlinkCounter = 0; - TitleScreen_PressStart_IsVisible = TRUE; + PressStart_BlinkCounter++; + if (PressStart_BlinkCounter >= 16) { + PressStart_BlinkCounter = 0; + PressStart_IsVisible = TRUE; } break; case TRUE: - TitleScreen_PressStart_Alpha += 128; - if (TitleScreen_PressStart_Alpha > 255) { - TitleScreen_PressStart_Alpha = 255; + PressStart_Alpha += 128; + if (PressStart_Alpha > 255) { + PressStart_Alpha = 255; } - TitleScreen_PressStart_BlinkCounter++; - if (TitleScreen_PressStart_BlinkCounter >= 16) { - TitleScreen_PressStart_BlinkCounter = 0; - TitleScreen_PressStart_IsVisible = FALSE; + PressStart_BlinkCounter++; + if (PressStart_BlinkCounter >= 16) { + PressStart_BlinkCounter = 0; + PressStart_IsVisible = FALSE; } } - gSPDisplayList(gMainGfxPos++, D_80077A50); + gSPDisplayList(gMainGfxPos++, TitleSetupGfx); gDPSetCombineMode(gMainGfxPos++, G_CC_MODULATEIA_PRIM, G_CC_MODULATEIA_PRIM); - gDPSetPrimColor(gMainGfxPos++, 0, 0, 248, 240, 152, TitleScreen_PressStart_Alpha); + gDPSetPrimColor(gMainGfxPos++, 0, 0, 248, 240, 152, PressStart_Alpha); gDPPipeSync(gMainGfxPos++); gDPLoadTextureBlock(gMainGfxPos++, TitleScreen_ImgList_PressStart, G_IM_FMT_IA, G_IM_SIZ_8b, 128, VAR_1, 0, G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMASK, G_TX_NOMASK, G_TX_NOLOD, @@ -480,17 +500,17 @@ void title_screen_draw_press_start(void) { #define LTT_LRT 15 #endif -void title_screen_draw_copyright(f32 arg0) { +void title_screen_draw_copyright(f32 moveAlpha) { s32 alpha; s32 i; - gSPDisplayList(gMainGfxPos++, &D_80077A50); + gSPDisplayList(gMainGfxPos++, &TitleSetupGfx); #if VERSION_JP gDPSetTextureLUT(gMainGfxPos++, G_TT_RGBA16); #endif gDPPipeSync(gMainGfxPos++); - alpha = 255.0f - (arg0 * 255.0f); + alpha = 255.0f - (moveAlpha * 255.0f); if (alpha < 255) { if (alpha < 0) { alpha = 0; diff --git a/src/world/area_gv/gv_01/gv_01_1_main.c b/src/world/area_gv/gv_01/gv_01_1_main.c index 9553008862c..1c540d1bc60 100644 --- a/src/world/area_gv/gv_01/gv_01_1_main.c +++ b/src/world/area_gv/gv_01/gv_01_1_main.c @@ -286,7 +286,7 @@ API_CALLABLE(N(ChangeStateToTitleScreen)) { gGameStatusPtr->unk_76 = FALSE; gGameStatusPtr->disableScripts = FALSE; gGameStatusPtr->keepUsingPartnerOnMapChange = FALSE; - gOverrideFlags &= ~GLOBAL_OVERRIDES_8; + gOverrideFlags &= ~GLOBAL_OVERRIDES_DISABLE_DRAW_FRAME; general_heap_create(); clear_render_tasks(); clear_worker_list(); @@ -301,7 +301,7 @@ API_CALLABLE(N(ChangeStateToTitleScreen)) { hud_element_clear_cache(); clear_trigger_data(); clear_printers(); - clear_entity_data(0); + clear_entity_data(FALSE); clear_screen_overlays(); clear_player_status(); clear_npcs(); @@ -312,8 +312,8 @@ API_CALLABLE(N(ChangeStateToTitleScreen)) { clear_item_entity_data(); clear_saved_variables(); initialize_collision(); - intro_logos_set_fade_alpha(255); - intro_logos_set_fade_color(208); + startup_set_fade_screen_alpha(255); + startup_set_fade_screen_color(208); set_game_mode(GAME_MODE_TITLE_SCREEN); return ApiStatus_FINISH; } diff --git a/src/world/area_hos/common/Narrator.inc.c b/src/world/area_hos/common/Narrator.inc.c index 669e2e7c54d..5e05d674028 100644 --- a/src/world/area_hos/common/Narrator.inc.c +++ b/src/world/area_hos/common/Narrator.inc.c @@ -29,7 +29,7 @@ void N(UpdateIntroMessages)(IntroMessage** introMessageLists) { static s32 N(IntroMessageDelay); if (N(CurMessageList) == NULL) { - N(CurMessageList) = introMessageLists[D_800779B0]; + N(CurMessageList) = introMessageLists[IntroMessageIdx]; } switch (N(IntroMessageState)) { diff --git a/src/world/area_hos/hos_04/hos_04_6_intro.c b/src/world/area_hos/hos_04/hos_04_6_intro.c index 1f0c1cd4985..78a4e552a67 100644 --- a/src/world/area_hos/hos_04/hos_04_6_intro.c +++ b/src/world/area_hos/hos_04/hos_04_6_intro.c @@ -41,14 +41,8 @@ API_CALLABLE(N(SetCamVfov)) { } API_CALLABLE(N(ResumeIntroState)) { - if ( - gGameStatusPtr->creditsViewportMode == 0 || - gGameStatusPtr->creditsViewportMode == 1 || - gGameStatusPtr->creditsViewportMode == 2 || - gGameStatusPtr->creditsViewportMode == 3 || - gGameStatusPtr->creditsViewportMode == 4) - { - gGameStatusPtr->creditsViewportMode++; + if (gGameStatusPtr->introPart > INTRO_PART_NONE && gGameStatusPtr->introPart < INTRO_PART_5) { + gGameStatusPtr->introPart++; state_init_intro(); } return ApiStatus_DONE1; diff --git a/src/world/area_hos/hos_05/hos_05_5_intro.c b/src/world/area_hos/hos_05/hos_05_5_intro.c index 24acf8be1d3..fc1e994b3cb 100644 --- a/src/world/area_hos/hos_05/hos_05_5_intro.c +++ b/src/world/area_hos/hos_05/hos_05_5_intro.c @@ -280,8 +280,8 @@ API_CALLABLE(N(AdjustCamVfov)) { API_CALLABLE(N(ResumeIntro)) { GameStatus* gameStatus = gGameStatusPtr; - if (gameStatus->creditsViewportMode < 5U) { - gameStatus->creditsViewportMode++; + if (gameStatus->introPart > INTRO_PART_NONE && gameStatus->introPart < INTRO_PART_5) { + gameStatus->introPart++; state_init_intro(); } return ApiStatus_DONE1; diff --git a/src/world/area_hos/hos_10/hos_10_5_intro.c b/src/world/area_hos/hos_10/hos_10_5_intro.c index a5154b49fff..36d18293ba2 100644 --- a/src/world/area_hos/hos_10/hos_10_5_intro.c +++ b/src/world/area_hos/hos_10/hos_10_5_intro.c @@ -4,14 +4,8 @@ #include "world/common/atomic/TexturePan.inc.c" API_CALLABLE(N(ResumeIntroState)) { - if ( - gGameStatusPtr->creditsViewportMode == 0 || - gGameStatusPtr->creditsViewportMode == 1 || - gGameStatusPtr->creditsViewportMode == 2 || - gGameStatusPtr->creditsViewportMode == 3 || - gGameStatusPtr->creditsViewportMode == 4) - { - gGameStatusPtr->creditsViewportMode++; + if (gGameStatusPtr->introPart > INTRO_PART_NONE && gGameStatusPtr->introPart < INTRO_PART_5) { + gGameStatusPtr->introPart++; state_init_intro(); } return ApiStatus_DONE1; diff --git a/src/world/world.c b/src/world/world.c index b82575a8064..8d22298b657 100644 --- a/src/world/world.c +++ b/src/world/world.c @@ -177,7 +177,7 @@ void load_map_by_IDs(s16 areaID, s16 mapID, s16 loadType) { clear_sprite_shading_data(); reset_background_settings(); - if (gGameStatusPtr->creditsViewportMode == -1) { + if (gGameStatusPtr->introPart == INTRO_PART_NONE) { func_80138188(); } @@ -188,7 +188,7 @@ void load_map_by_IDs(s16 areaID, s16 mapID, s16 loadType) { reset_battle_status(); clear_encounter_status(); - clear_entity_data(1); + clear_entity_data(TRUE); clear_effect_data(); clear_player_status(); player_reset_data(); @@ -221,10 +221,10 @@ void load_map_by_IDs(s16 areaID, s16 mapID, s16 loadType) { gCameras[CAM_TATTLE].flags |= CAMERA_FLAG_DISABLED; gCameras[CAM_3].flags |= CAMERA_FLAG_DISABLED; - if (gGameStatusPtr->creditsViewportMode == -1) { - set_cam_viewport(0, 12, 20, 296, 200); + if (gGameStatusPtr->introPart == INTRO_PART_NONE) { + set_cam_viewport(CAM_DEFAULT, 12, 20, 296, 200); } else { - set_cam_viewport(0, 29, 28, 262, 162); + set_cam_viewport(CAM_DEFAULT, 29, 28, 262, 162); } initialize_status_bar(); diff --git a/ver/ique/asm/bss.s b/ver/ique/asm/bss.s index 0feef0f4d77..13c53964313 100644 --- a/ver/ique/asm/bss.s +++ b/ver/ique/asm/bss.s @@ -361,28 +361,28 @@ dlabel gLoadedFromFileSelect dlabel D_800A094C .space 4 -dlabel D_800A0950 +dlabel IntroEnableDrawFrameDelay .space 4 -dlabel D_800A0954 +dlabel IntroOverlayAlpha .space 2 -dlabel D_800A0956 +dlabel IntroFrontFadeAlpha .space 2 -dlabel D_800A0958 +dlabel IntroOverlayDelta .space 2 -dlabel D_800A095A +dlabel IntroFadeColorR .space 2 -dlabel D_800A095C +dlabel IntroFadeColorG .space 2 -dlabel D_800A095E +dlabel IntroFadeColorB .space 2 -dlabel D_800A0960 +dlabel IntroOverlayType .space 0x00000004 dlabel D_800A0964 @@ -391,7 +391,7 @@ dlabel D_800A0964 dlabel D_800A0968 .space 8 -dlabel D_800A0970 +dlabel TitleScreen_AppearDelay .space 4 dlabel TitleScreen_ImgList @@ -409,7 +409,7 @@ dlabel TitleScreen_ImgList_PressStart dlabel D_800A0984 .space 4 -dlabel D_800A0988 +dlabel TitleScreen_TimeLeft .space 4 dlabel D_800A098C diff --git a/ver/ique/splat.yaml b/ver/ique/splat.yaml index bb822d734c4..80a7c717716 100644 --- a/ver/ique/splat.yaml +++ b/ver/ique/splat.yaml @@ -58,7 +58,7 @@ segments: - [0xCCC0, c, camera] - [0xDFA0, c, game_modes] - [0xDFF0, c, state_startup] - - [0xE280, c, intro_logos] + - [0xE280, c, startup_screen_fading] - [0xE380, c, state_battle] - [0xE920, c, state_logos] - [0xF3F0, c, state_pause] diff --git a/ver/ique/symbol_addrs.txt b/ver/ique/symbol_addrs.txt index 975616fd645..e79d2df6d3d 100644 --- a/ver/ique/symbol_addrs.txt +++ b/ver/ique/symbol_addrs.txt @@ -132,7 +132,7 @@ au_driver_init = 0x80055910; au_engine_init = 0x8005251c; nuAuDmaNew = 0x8004a8dc; nuAuPreNMI = 0x80076dd0; -D_80077A50 = 0x800766b0; +TitleSetupGfx = 0x800766b0; osAiGetLength = 0x80060310; osAiGetStatus = 0x80060320; osAiSetFrequency = 0x80060330; diff --git a/ver/jp/asm/main.bss.s b/ver/jp/asm/main.bss.s index 2b021c6ae13..a198942dc3c 100644 --- a/ver/jp/asm/main.bss.s +++ b/ver/jp/asm/main.bss.s @@ -283,34 +283,34 @@ dlabel gMapTransitionStateTime dlabel gLoadedFromFileSelect .space 8 -dlabel D_800A0950 +dlabel IntroEnableDrawFrameDelay .space 4 -dlabel D_800A0954 +dlabel IntroOverlayAlpha .space 2 -dlabel D_800A0956 +dlabel IntroFrontFadeAlpha .space 2 -dlabel D_800A0958 +dlabel IntroOverlayDelta .space 2 -dlabel D_800A095A +dlabel IntroFadeColorR .space 2 -dlabel D_800A095C +dlabel IntroFadeColorG .space 2 -dlabel D_800A095E +dlabel IntroFadeColorB .space 2 -dlabel D_800A0960 +dlabel IntroOverlayType .space 4 dlabel D_800A0964 .space 12 -dlabel D_800A0970 +dlabel TitleScreen_AppearDelay .space 4 dlabel TitleScreen_ImgList @@ -328,7 +328,7 @@ dlabel TitleScreen_ImgList_PressStart dlabel TitleScreen_ImgList_CopyrightPalette .space 4 -dlabel D_800A0988 +dlabel TitleScreen_TimeLeft .space 8 dlabel gWorldNpcList diff --git a/ver/jp/splat.yaml b/ver/jp/splat.yaml index 668093dbc9a..96caae6b93f 100644 --- a/ver/jp/splat.yaml +++ b/ver/jp/splat.yaml @@ -59,7 +59,7 @@ segments: - [0xD2A0, c, camera] - [0xE580, c, game_modes] - [0xE580, c, state_startup] - - [0xE860, c, intro_logos] + - [0xE860, c, startup_screen_fading] - [0xE960, c, state_battle] - [0xEF00, c, state_logos] - [0xF9C0, c, state_pause] diff --git a/ver/pal/undefined_syms.txt b/ver/pal/undefined_syms.txt index c549cf0a672..2c9693cdbfd 100644 --- a/ver/pal/undefined_syms.txt +++ b/ver/pal/undefined_syms.txt @@ -57,8 +57,8 @@ set_cam_viewport = 0x8002E634; get_screen_coords = 0x8002E858; set_game_mode = 0x80033810; get_game_mode = 0x80033848; -intro_logos_set_fade_alpha = 0x80033B10; -intro_logos_set_fade_color = 0x80033B20; +startup_set_fade_screen_alpha = 0x80033B10; +startup_set_fade_screen_color = 0x80033B20; set_map_change_fade_rate = 0x80035CF0; state_init_intro = 0x80036550; clear_npcs = 0x800389AC; @@ -249,7 +249,7 @@ gMatrixListPos = 0x80071500; gCurrentDisplayContextIndex = 0x80071504; nuGfxCfbNum = 0x80073710; gCurrentCameraID = 0x80073730; -D_800779B0 = 0x80073D00; +IntroMessageIdx = 0x80073D00; gSaveSlotMetadata = 0x80073D14; gSaveSlotHasData = 0x80073D74; EnemyNpcHit = 0x80074310; diff --git a/ver/us/asm/bss.s b/ver/us/asm/bss.s index 096cf8b64f2..df8dc295613 100644 --- a/ver/us/asm/bss.s +++ b/ver/us/asm/bss.s @@ -355,28 +355,28 @@ dlabel gLoadedFromFileSelect dlabel D_800A094C .space 4 -dlabel D_800A0950 +dlabel IntroEnableDrawFrameDelay .space 4 -dlabel D_800A0954 +dlabel IntroOverlayAlpha .space 2 -dlabel D_800A0956 +dlabel IntroFrontFadeAlpha .space 2 -dlabel D_800A0958 +dlabel IntroOverlayDelta .space 2 -dlabel D_800A095A +dlabel IntroFadeColorR .space 2 -dlabel D_800A095C +dlabel IntroFadeColorG .space 2 -dlabel D_800A095E +dlabel IntroFadeColorB .space 2 -dlabel D_800A0960 +dlabel IntroOverlayType .space 0x00000004 dlabel D_800A0964 @@ -385,7 +385,7 @@ dlabel D_800A0964 dlabel D_800A0968 .space 8 -dlabel D_800A0970 +dlabel TitleScreen_AppearDelay .space 4 dlabel TitleScreen_ImgList @@ -403,7 +403,7 @@ dlabel TitleScreen_ImgList_PressStart dlabel D_800A0984 .space 4 -dlabel D_800A0988 +dlabel TitleScreen_TimeLeft .space 4 dlabel D_800A098C diff --git a/ver/us/splat.yaml b/ver/us/splat.yaml index a45c3148ff7..29f957b7a09 100644 --- a/ver/us/splat.yaml +++ b/ver/us/splat.yaml @@ -68,7 +68,7 @@ segments: - [auto, c, camera] - [auto, c, game_modes] - [auto, c, state_startup] - - [auto, c, intro_logos] + - [auto, c, startup_screen_fading] - [auto, c, state_battle] - [auto, c, state_logos] - [auto, c, state_pause] diff --git a/ver/us/symbol_addrs.txt b/ver/us/symbol_addrs.txt index f4f4042c538..ba9dc44153c 100644 --- a/ver/us/symbol_addrs.txt +++ b/ver/us/symbol_addrs.txt @@ -174,11 +174,11 @@ get_game_mode = 0x80033528; // type:func rom:0xE928 state_init_startup = 0x80033540; // type:func rom:0xE940 state_step_startup = 0x80033568; // type:func rom:0xE968 state_drawUI_startup = 0x80033788; // type:func rom:0xEB88 -intro_logos_set_fade_alpha = 0x800337D0; // type:func rom:0xEBD0 -intro_logos_set_fade_color = 0x800337E0; // type:func rom:0xEBE0 -intro_logos_fade_in = 0x800337F8; // type:func rom:0xEBF8 -intro_logos_fade_out = 0x80033830; // type:func rom:0xEC30 -intro_logos_update_fade = 0x80033874; // type:func rom:0xEC74 +startup_set_fade_screen_alpha = 0x800337D0; // type:func rom:0xEBD0 +startup_set_fade_screen_color = 0x800337E0; // type:func rom:0xEBE0 +startup_fade_screen_in = 0x800337F8; // type:func rom:0xEBF8 +startup_fade_screen_out = 0x80033830; // type:func rom:0xEC30 +startup_fade_screen_update = 0x80033874; // type:func rom:0xEC74 state_init_battle = 0x800338D0; // type:func rom:0xECD0 state_step_battle = 0x800338E4; // type:func rom:0xECE4 state_drawUI_battle = 0x80033B54; // type:func rom:0xEF54 @@ -1390,17 +1390,17 @@ pause_frameBuffers = 0x80077950; // rom:0x52D50 D_8007795C = 0x8007795C; // rom:0x52D5C fsFrameBuffers = 0x80077980; // rom:0x52D80 D_8007798C = 0x8007798C; // rom:0x52D8C -D_800779B0 = 0x800779B0; // rom:0x52DB0 -D_800779C0 = 0x800779C0; // rom:0x52DC0 +IntroMessageIdx = 0x800779B0; // rom:0x52DB0 +TitleScreenNextState = 0x800779C0; // rom:0x52DC0 gSaveSlotMetadata = 0x800779C4; // rom:0x52DC4 gSaveSlotHasData = 0x80077A24; // rom:0x52E24 TitleScreen_PressStart_Alpha = 0x80077A28; // rom:0x52E28 TitleScreen_PressStart_isVisibile = 0x80077A2C; // rom:0x52E2C TitleScreen_PressStart_BlinkCounter = 0x80077A30; // rom:0x52E30 -D_80077A34 = 0x80077A34; // rom:0x52E34 +PlayIntroNext = 0x80077A34; // rom:0x52E34 D_80077A38 = 0x80077A38; // rom:0x52E38 D_80077A40 = 0x80077A40; // rom:0x52E40 -D_80077A50 = 0x80077A50; // rom:0x52E50 +TitleSetupGfx = 0x80077A50; // rom:0x52E50 DemoScenes = 0x80077AE0; // rom:0x52EE0 versionString = 0x80077BD0; // rom:0x52FD0 EVS_NpcDefeat = 0x80077E38; // rom:0x53238 @@ -2737,23 +2737,23 @@ gMapTransitionState = 0x800A0944; // rom:0x7BD44 gMapTransitionStateTime = 0x800A0946; // rom:0x7BD46 gLoadedFromFileSelect = 0x800A0948; // rom:0x7BD48 D_800A094C = 0x800A094C; // rom:0x7BD4C -D_800A0950 = 0x800A0950; // rom:0x7BD50 -D_800A0954 = 0x800A0954; // rom:0x7BD54 -D_800A0956 = 0x800A0956; // rom:0x7BD56 -D_800A0958 = 0x800A0958; // rom:0x7BD58 -D_800A095A = 0x800A095A; // rom:0x7BD5A -D_800A095C = 0x800A095C; // rom:0x7BD5C -D_800A095E = 0x800A095E; // rom:0x7BD5E -D_800A0960 = 0x800A0960; // rom:0x7BD60 +IntroEnableDrawFrameDelay = 0x800A0950; // rom:0x7BD50 +IntroOverlayAlpha = 0x800A0954; // rom:0x7BD54 +IntroFrontFadeAlpha = 0x800A0956; // rom:0x7BD56 +IntroOverlayDelta = 0x800A0958; // rom:0x7BD58 +IntroFadeColorR = 0x800A095A; // rom:0x7BD5A +IntroFadeColorG = 0x800A095C; // rom:0x7BD5C +IntroFadeColorB = 0x800A095E; // rom:0x7BD5E +IntroOverlayType = 0x800A0960; // rom:0x7BD60 D_800A0964 = 0x800A0964; // rom:0x7BD64 D_800A0968 = 0x800A0968; // rom:0x7BD68 -D_800A0970 = 0x800A0970; // rom:0x7BD70 +TitleScreen_AppearDelay = 0x800A0970; // rom:0x7BD70 TitleScreen_ImgList = 0x800A0974; // rom:0x7BD74 TitleScreen_ImgList_Logo = 0x800A0978; // rom:0x7BD78 TitleScreen_ImgList_Copyright = 0x800A097C; // rom:0x7BD7C TitleScreen_ImgList_PressStart = 0x800A0980; // rom:0x7BD80 D_800A0984 = 0x800A0984; // rom:0x7BD84 -D_800A0988 = 0x800A0988; // rom:0x7BD88 +TitleScreen_TimeLeft = 0x800A0988; // rom:0x7BD88 D_800A098C = 0x800A098C; // rom:0x7BD8C gWorldNpcList = 0x800A0990; // rom:0x7BD90 func_800E29C8 = 0x800E29C8; // type:func rom:0x7BE78 @@ -26759,14 +26759,14 @@ actionCmdTableWaterBlock = 0x80294460; // actionCmdTableTidalWave = 0x802944A0; // bSavedPartner = 0x8029DA30; // bSavedOverrideFlags = 0x8029DA34; // -D_8029DA40 = 0x8029DA40; // -D_8029DA44 = 0x8029DA44; // -D_8029DA48 = 0x8029DA48; // +StarPointsBasePosX = 0x8029DA40; // +StarPointsBasePosY = 0x8029DA44; // +StarPointsMoveInterpAmt = 0x8029DA48; // D_8029DA4C = 0x8029DA4C; // -D_8029DA50 = 0x8029DA50; // -D_8029EFB0 = 0x8029EFB0; // -D_8029EFB4 = 0x8029EFB4; // -D_8029EFB8 = 0x8029EFB8; // +SavedWorldCameras = 0x8029DA50; // +SavedWorldPlayerPosX = 0x8029EFB0; // +SavedWorldPlayerPosY = 0x8029EFB4; // +SavedWorldPlayerPosZ = 0x8029EFB8; // D_8029EFBC = 0x8029EFBC; // BtlStarPointTensHIDs = 0x8029EFC0; // BtlStarPointShinesHIDs = 0x8029EFE8; //