summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorEllipticEllipsis <73679967+EllipticEllipsis@users.noreply.github.com>2021-09-29 02:17:39 +0100
committerGitHub <noreply@github.com>2021-09-28 21:17:39 -0400
commitddc643f708543fafc73c55eddddf1f34c401cb02 (patch)
tree445aecfa8046c56b1456a925f875b4918cd2a752 /src
parent1713e8a97d7fa550d0a4be63ee95c1a421816836 (diff)
`ovl_opening` OK (#300)
* ovl_opening OK * un-format z64save.h * Actually change the other uses of nextCutsceneIndex * format * Review * engineer's review * Get it to match again
Diffstat (limited to 'src')
-rw-r--r--src/overlays/gamestates/ovl_opening/z_opening.c60
-rw-r--r--src/overlays/gamestates/ovl_opening/z_opening.h4
2 files changed, 55 insertions, 9 deletions
diff --git a/src/overlays/gamestates/ovl_opening/z_opening.c b/src/overlays/gamestates/ovl_opening/z_opening.c
index e086158fc..b19955071 100644
--- a/src/overlays/gamestates/ovl_opening/z_opening.c
+++ b/src/overlays/gamestates/ovl_opening/z_opening.c
@@ -1,18 +1,64 @@
/*
* File: z_opening.c
* Overlay: ovl_opening
- * Description:
+ * Description: Initializes the game into the title screen
*/
#include "z_opening.h"
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_opening/Opening_SetupForTitleCutscene.s")
+void Opening_SetupForTitleCutscene(OpeningContext* this) {
+ static s32 openingEntrances[] = { 0x1C00, 0x1C10 };
+ static s32 openingCutscenes[] = { 0xFFFA, 0xFFFA };
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_opening/func_80803EA0.s")
+ gSaveContext.eventInf[1] &= (u8)~0x80;
+ gSaveContext.gameMode = 1;
-void Opening_Main(GameState* thisx);
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_opening/Opening_Main.s")
+ func_80144890();
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_opening/Opening_Destroy.s")
+ gSaveContext.entranceIndex = openingEntrances[D_801BB12C];
+ gSaveContext.nextCutsceneIndex = gSaveContext.cutscene = openingCutscenes[D_801BB12C];
+ gSaveContext.sceneSetupIndex = 0;
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_opening/Opening_Init.s")
+ gSaveContext.time = CLOCK_TIME(8, 0);
+ gSaveContext.day = 1;
+
+ {
+ GameState* thisx = &this->gameState;
+ thisx->running = false;
+ }
+ SET_NEXT_GAMESTATE(&this->gameState, Play_Init, GlobalContext);
+ gSaveContext.playerForm = PLAYER_FORM_HUMAN;
+}
+
+void func_80803EA0(OpeningContext* this) {
+ SREG(33) |= 1;
+}
+
+void Opening_Main(GameState* thisx) {
+ OpeningContext* this = (OpeningContext*)thisx;
+
+ func_8012CF0C(this->gameState.gfxCtx, 0, 1, 0, 0, 0);
+ Opening_SetupForTitleCutscene(this);
+ func_80803EA0(this);
+}
+
+void Opening_Destroy(GameState* thisx) {
+ ShrinkWindow_Fini();
+}
+
+void Opening_Init(GameState* thisx) {
+ OpeningContext* this = (OpeningContext*)thisx;
+
+ Game_SetFramerateDivisor(&this->gameState, 1);
+ SysMatrix_StateAlloc(&this->gameState);
+ ShrinkWindow_Init();
+ View_Init(&this->view, this->gameState.gfxCtx);
+ this->gameState.main = Opening_Main;
+ this->gameState.destroy = Opening_Destroy;
+
+ gSaveContext.respawnFlag = 0;
+ gSaveContext.respawn[4].entranceIndex = 0xFF;
+ gSaveContext.respawn[5].entranceIndex = 0xFF;
+ gSaveContext.respawn[6].entranceIndex = 0xFF;
+ gSaveContext.respawn[7].entranceIndex = 0xFF;
+}
diff --git a/src/overlays/gamestates/ovl_opening/z_opening.h b/src/overlays/gamestates/ovl_opening/z_opening.h
index 81a12f630..809767fe4 100644
--- a/src/overlays/gamestates/ovl_opening/z_opening.h
+++ b/src/overlays/gamestates/ovl_opening/z_opening.h
@@ -7,8 +7,8 @@ void Opening_Init(GameState* thisx);
void Opening_Destroy(GameState* thisx);
typedef struct {
- /* 0x000 */ GameState common;
- /* 0x0A4 */ UNK_TYPE1 padA4[0x4];
+ /* 0x000 */ GameState gameState;
+ /* 0x0A4 */ UNK_TYPE1 unk_A4[0x4];
/* 0x0A8 */ View view;
} OpeningContext; // size = 0x210