summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAnghelo Carvajal <angheloalf95@gmail.com>2021-09-22 22:50:35 -0300
committerGitHub <noreply@github.com>2021-09-22 21:50:35 -0400
commit2ff7320409d1f6340bed2ea37b7ceb3a49a57525 (patch)
tree8cb503aa65a39dfc9b3318d07bd1e49b31da2ea7 /src
parenta59943bc4aee376eca48cbee429af75153b28570 (diff)
`ovl_daytelop` OK (#277)
* eeeee * nonequivalents * draw * Import data * Match Daytelop_LoadGraphics * draw kinda better * extract daytelops and gameover * SEGMENT_ROM macros * Use extracted symbols for daytelop * match Daytelop_Draw * Fix bss * draw cleanup * Daytelop_Update from non equivalent to non matching * Some renames and spec * Run formatter * enum * sfx * Use SEGMENT_ROM_START macros everywhere * more macros * run formatter * Add description * update variables.txt * Remove extra stuff in gbi.h * Would this fix it? * and again * whoops * Apply suggestions from code review Co-authored-by: Tharo <17233964+Thar0@users.noreply.github.com> * Tharo's suggestions * match Daytelop_Update * run formatter * fix merge issues Co-authored-by: Tharo <17233964+Thar0@users.noreply.github.com>
Diffstat (limited to 'src')
-rw-r--r--src/boot_O2_g3/idle.c6
-rw-r--r--src/boot_O2_g3/z_std_dma.c3
-rw-r--r--src/code/z_actor_dlftbls.c8
-rw-r--r--src/code/z_kanfont.c8
-rw-r--r--src/code/z_scene.c20
-rw-r--r--src/code/z_scene_table.c2
-rw-r--r--src/code/z_vr_box.c32
-rw-r--r--src/overlays/actors/ovl_En_Dns/z_en_dns.c2
-rw-r--r--src/overlays/actors/ovl_En_Invadepoh/z_en_invadepoh.c6
-rw-r--r--src/overlays/actors/ovl_En_Ma4/z_en_ma4.c6
-rw-r--r--src/overlays/actors/ovl_En_Ma_Yto/z_en_ma_yto.c2
-rw-r--r--src/overlays/gamestates/ovl_daytelop/z_daytelop.c243
-rw-r--r--src/overlays/gamestates/ovl_daytelop/z_daytelop.h19
13 files changed, 295 insertions, 62 deletions
diff --git a/src/boot_O2_g3/idle.c b/src/boot_O2_g3/idle.c
index 4d01b4c37..4be8a1094 100644
--- a/src/boot_O2_g3/idle.c
+++ b/src/boot_O2_g3/idle.c
@@ -58,15 +58,15 @@ void Idle_InitCodeAndMemory(void) {
oldSize = sDmaMgrDmaBuffSize;
sDmaMgrDmaBuffSize = 0;
- DmaMgr_SendRequestImpl(&dmaReq, _codeSegmentStart, _codeSegmentRomStart, _codeSegmentRomEnd - _codeSegmentRomStart,
- 0, &queue, 0);
+ DmaMgr_SendRequestImpl(&dmaReq, SEGMENT_START(code), SEGMENT_ROM_START(code),
+ SEGMENT_ROM_END(code) - SEGMENT_ROM_START(code), 0, &queue, 0);
Idle_InitScreen();
Idle_InitMemory();
osRecvMesg(&queue, NULL, 1);
sDmaMgrDmaBuffSize = oldSize;
- Idle_ClearMemory(_codeSegmentBssStart, _codeSegmentBssEnd);
+ Idle_ClearMemory(SEGMENT_BSS_START(code), SEGMENT_BSS_END(code));
}
void Main_ThreadEntry(void* arg) {
diff --git a/src/boot_O2_g3/z_std_dma.c b/src/boot_O2_g3/z_std_dma.c
index 5a29d5d56..3a447b0e8 100644
--- a/src/boot_O2_g3/z_std_dma.c
+++ b/src/boot_O2_g3/z_std_dma.c
@@ -213,8 +213,7 @@ void DmaMgr_Start(void) {
DmaEntry* iter;
u32 idx;
- DmaMgr_DMARomToRam((u32)_dmadataSegmentRomStart, (u32)dmadata,
- (u32)_dmadataSegmentRomEnd - (u32)_dmadataSegmentRomStart);
+ DmaMgr_DMARomToRam(SEGMENT_ROM_START(dmadata), dmadata, SEGMENT_ROM_SIZE(dmadata));
dummy_label:;
diff --git a/src/code/z_actor_dlftbls.c b/src/code/z_actor_dlftbls.c
index 63dcc9c58..4165e4c9b 100644
--- a/src/code/z_actor_dlftbls.c
+++ b/src/code/z_actor_dlftbls.c
@@ -1,10 +1,10 @@
#include "global.h"
#include "initvars.h"
-#define ACTOR_OVERLAY(name, allocType) \
- { \
- (u32) _ovl_##name##SegmentRomStart, (u32)_ovl_##name##SegmentRomEnd, _ovl_##name##SegmentStart, \
- _ovl_##name##SegmentEnd, NULL, &name##_InitVars, NULL, allocType, 0 \
+#define ACTOR_OVERLAY(name, allocType) \
+ { \
+ SEGMENT_ROM_START(ovl_##name), SEGMENT_ROM_END(ovl_##name), SEGMENT_START(ovl_##name), \
+ SEGMENT_END(ovl_##name), NULL, &name##_InitVars, NULL, allocType, 0 \
}
#define ACTOR_OVERLAY_INTERNAL(name, allocType) \
diff --git a/src/code/z_kanfont.c b/src/code/z_kanfont.c
index f85911fc6..b678642b1 100644
--- a/src/code/z_kanfont.c
+++ b/src/code/z_kanfont.c
@@ -9,12 +9,13 @@ void Font_LoadCharNES(GlobalContext* globalCtx, u8 codePointIndex, s32 offset) {
Font* font = &msgCtx->font;
DmaMgr_SendRequest0(&font->charBuf[font->unk_11D88][offset],
- &_nes_font_staticSegmentRomStart[(codePointIndex - ' ') * FONT_CHAR_TEX_SIZE],
+ &((u8*)SEGMENT_ROM_START(nes_font_static))[(codePointIndex - ' ') * FONT_CHAR_TEX_SIZE],
FONT_CHAR_TEX_SIZE);
}
void Font_LoadMessageBoxEndIcon(Font* font, u16 icon) {
- DmaMgr_SendRequest0(&font->iconBuf, &_message_staticSegmentRomStart[5 * 0x1000 + icon * FONT_CHAR_TEX_SIZE],
+ DmaMgr_SendRequest0(&font->iconBuf,
+ &((u8*)SEGMENT_ROM_START(message_static))[5 * 0x1000 + icon * FONT_CHAR_TEX_SIZE],
FONT_CHAR_TEX_SIZE);
}
@@ -36,7 +37,8 @@ void Font_LoadOrderedFont(Font* font) {
loadOffset = 0;
}
// UB to convert pointer to u32
- DmaMgr_SendRequest0(writeLocation, (u32)_nes_font_staticSegmentRomStart + loadOffset, FONT_CHAR_TEX_SIZE);
+ DmaMgr_SendRequest0(writeLocation, (uintptr_t)SEGMENT_ROM_START(nes_font_static) + loadOffset,
+ FONT_CHAR_TEX_SIZE);
if (sFontOrdering[codePointIndex] == 0x8C) {
break;
}
diff --git a/src/code/z_scene.c b/src/code/z_scene.c
index efaadf4bf..e77144528 100644
--- a/src/code/z_scene.c
+++ b/src/code/z_scene.c
@@ -221,8 +221,8 @@ void Scene_HeaderCmdEntranceList(GlobalContext* globalCtx, SceneCmd* cmd) {
// SceneTableEntry Header Command 0x07: Special Files
void Scene_HeaderCmdSpecialFiles(GlobalContext* globalCtx, SceneCmd* cmd) {
static RomFile tatlMessageFiles[2] = {
- { (u32)_elf_message_fieldSegmentRomStart, (u32)_elf_message_fieldSegmentRomEnd },
- { (u32)_elf_message_ydanSegmentRomStart, (u32)_elf_message_ydanSegmentRomEnd },
+ { SEGMENT_ROM_START(elf_message_field), SEGMENT_ROM_END(elf_message_field) },
+ { SEGMENT_ROM_START(elf_message_ydan), SEGMENT_ROM_END(elf_message_ydan) },
};
if (cmd->specialFiles.subKeepIndex != 0) {
@@ -344,14 +344,14 @@ void Scene_HeaderCmdEnvLightSettings(GlobalContext* globalCtx, SceneCmd* cmd) {
s32 Scene_LoadAreaTextures(GlobalContext* globalCtx, s32 fileIndex) {
static RomFile sceneTextureFiles[9] = {
{ 0, 0 }, // Default
- { (u32)_scene_texture_01SegmentRomStart, (u32)_scene_texture_01SegmentRomEnd },
- { (u32)_scene_texture_02SegmentRomStart, (u32)_scene_texture_02SegmentRomEnd },
- { (u32)_scene_texture_03SegmentRomStart, (u32)_scene_texture_03SegmentRomEnd },
- { (u32)_scene_texture_04SegmentRomStart, (u32)_scene_texture_04SegmentRomEnd },
- { (u32)_scene_texture_05SegmentRomStart, (u32)_scene_texture_05SegmentRomEnd },
- { (u32)_scene_texture_06SegmentRomStart, (u32)_scene_texture_06SegmentRomEnd },
- { (u32)_scene_texture_07SegmentRomStart, (u32)_scene_texture_07SegmentRomEnd },
- { (u32)_scene_texture_08SegmentRomStart, (u32)_scene_texture_08SegmentRomEnd },
+ { SEGMENT_ROM_START(scene_texture_01), SEGMENT_ROM_END(scene_texture_01) },
+ { SEGMENT_ROM_START(scene_texture_02), SEGMENT_ROM_END(scene_texture_02) },
+ { SEGMENT_ROM_START(scene_texture_03), SEGMENT_ROM_END(scene_texture_03) },
+ { SEGMENT_ROM_START(scene_texture_04), SEGMENT_ROM_END(scene_texture_04) },
+ { SEGMENT_ROM_START(scene_texture_05), SEGMENT_ROM_END(scene_texture_05) },
+ { SEGMENT_ROM_START(scene_texture_06), SEGMENT_ROM_END(scene_texture_06) },
+ { SEGMENT_ROM_START(scene_texture_07), SEGMENT_ROM_END(scene_texture_07) },
+ { SEGMENT_ROM_START(scene_texture_08), SEGMENT_ROM_END(scene_texture_08) },
};
u32 vromStart = sceneTextureFiles[fileIndex].vromStart;
u32 size = sceneTextureFiles[fileIndex].vromEnd - vromStart;
diff --git a/src/code/z_scene_table.c b/src/code/z_scene_table.c
index cee8546f0..8372c350a 100644
--- a/src/code/z_scene_table.c
+++ b/src/code/z_scene_table.c
@@ -1,7 +1,7 @@
#include "global.h"
#define SCENE_ENTRY(name, textId, config) \
- { { (u32)_##name##SegmentRomStart, (u32)_##name##SegmentRomEnd }, textId, 0, config, 0 }
+ { { SEGMENT_ROM_START(name), SEGMENT_ROM_END(name) }, textId, 0, config, 0 }
#define SCENE_ENTRY_NONE() \
{ { 0, 0 }, 0, 0, 0, 0 }
diff --git a/src/code/z_vr_box.c b/src/code/z_vr_box.c
index 5c00758d2..1fca4801d 100644
--- a/src/code/z_vr_box.c
+++ b/src/code/z_vr_box.c
@@ -50,21 +50,21 @@ void func_801431E8(GameState* gamestate, SkyboxContext* skyboxCtx, s16 skyType)
} else {
// Send a DMA request for the cloudy sky texture
skyboxCtx->skyboxStaticSegment[0] = &D_80025D00;
- size = (u32)_d2_cloud_staticSegmentRomEnd - (u32)_d2_cloud_staticSegmentRomStart;
+ size = SEGMENT_ROM_SIZE(d2_cloud_static);
offset = (void*)ALIGN8((u32)skyboxCtx->skyboxStaticSegment[0] + size);
- DmaMgr_SendRequest0(skyboxCtx->skyboxStaticSegment[0], (u32)_d2_cloud_staticSegmentRomStart, size);
+ DmaMgr_SendRequest0(skyboxCtx->skyboxStaticSegment[0], SEGMENT_ROM_START(d2_cloud_static), size);
// Send a DMA request for the clear sky texture
skyboxCtx->skyboxStaticSegment[1] = offset;
- size = (u32)_d2_fine_staticSegmentRomEnd - (u32)_d2_fine_staticSegmentRomStart;
+ size = SEGMENT_ROM_SIZE(d2_fine_static);
offset = (void*)ALIGN8((u32)offset + size);
- DmaMgr_SendRequest0(skyboxCtx->skyboxStaticSegment[1], (u32)_d2_fine_staticSegmentRomStart, size);
+ DmaMgr_SendRequest0(skyboxCtx->skyboxStaticSegment[1], SEGMENT_ROM_START(d2_fine_static), size);
// Send a DMA request for the skybox palette
skyboxCtx->skyboxPaletteStaticSegment = offset;
- size = (u32)_d2_fine_pal_staticSegmentRomEnd - (u32)_d2_fine_pal_staticSegmentRomStart;
+ size = SEGMENT_ROM_SIZE(d2_fine_pal_static);
offset = (void*)ALIGN8((u32)offset + size);
- DmaMgr_SendRequest0(skyboxCtx->skyboxPaletteStaticSegment, (u32)_d2_fine_pal_staticSegmentRomStart, size);
+ DmaMgr_SendRequest0(skyboxCtx->skyboxPaletteStaticSegment, SEGMENT_ROM_START(d2_fine_pal_static), size);
skyboxCtx->primR = 145;
skyboxCtx->primG = 120;
@@ -91,16 +91,16 @@ void func_80143324(GlobalContext* globalCtx, SkyboxContext* skyboxCtx, s16 skyTy
if (globalCtx->envCtx.unk_10 == 0) {
// Send a DMA request for the clear sky texture
- size = (u32)_d2_fine_staticSegmentRomEnd - (u32)_d2_fine_staticSegmentRomStart;
+ size = SEGMENT_ROM_SIZE(d2_fine_static);
DmaMgr_SendRequestImpl(&skyboxCtx->unk188, skyboxCtx->skyboxStaticSegment[0],
- (u32)_d2_fine_staticSegmentRomStart, size, 0, &skyboxCtx->loadQueue, NULL);
+ SEGMENT_ROM_START(d2_fine_static), size, 0, &skyboxCtx->loadQueue, NULL);
} else {
// Send a DMA request for the cloudy sky texture
- size = (u32)_d2_cloud_staticSegmentRomEnd - (u32)_d2_cloud_staticSegmentRomStart;
+ size = SEGMENT_ROM_SIZE(d2_cloud_static);
DmaMgr_SendRequestImpl(&skyboxCtx->unk188, skyboxCtx->skyboxStaticSegment[0],
- (u32)_d2_cloud_staticSegmentRomStart, size, 0, &skyboxCtx->loadQueue, NULL);
+ SEGMENT_ROM_START(d2_cloud_static), size, 0, &skyboxCtx->loadQueue, NULL);
}
osRecvMesg(&skyboxCtx->loadQueue, NULL, 1);
@@ -108,26 +108,26 @@ void func_80143324(GlobalContext* globalCtx, SkyboxContext* skyboxCtx, s16 skyTy
if (globalCtx->envCtx.unk_11 == 0) {
// Send a DMA request for the clear sky texture
- size = (u32)_d2_fine_staticSegmentRomEnd - (u32)_d2_fine_staticSegmentRomStart;
+ size = SEGMENT_ROM_SIZE(d2_fine_static);
DmaMgr_SendRequestImpl(&skyboxCtx->unk1A8, skyboxCtx->skyboxStaticSegment[1],
- (u32)_d2_fine_staticSegmentRomStart, size, 0, &skyboxCtx->loadQueue, NULL);
+ SEGMENT_ROM_START(d2_fine_static), size, 0, &skyboxCtx->loadQueue, NULL);
} else {
// Send a DMA request for the cloudy sky texture
- size = (u32)_d2_cloud_staticSegmentRomEnd - (u32)_d2_cloud_staticSegmentRomStart;
+ size = SEGMENT_ROM_SIZE(d2_cloud_static);
DmaMgr_SendRequestImpl(&skyboxCtx->unk1A8, skyboxCtx->skyboxStaticSegment[1],
- (u32)_d2_cloud_staticSegmentRomStart, size, 0, &skyboxCtx->loadQueue, NULL);
+ SEGMENT_ROM_START(d2_cloud_static), size, 0, &skyboxCtx->loadQueue, NULL);
}
osRecvMesg(&skyboxCtx->loadQueue, NULL, 1);
osCreateMesgQueue(&skyboxCtx->loadQueue, &skyboxCtx->loadMsg, 1);
- size = (u32)_d2_fine_pal_staticSegmentRomEnd - (u32)_d2_fine_pal_staticSegmentRomStart;
+ size = SEGMENT_ROM_SIZE(d2_fine_pal_static);
// Send a DMA request for the skybox palette
DmaMgr_SendRequestImpl(&skyboxCtx->unk1C8, skyboxCtx->skyboxPaletteStaticSegment,
- (u32)_d2_fine_pal_staticSegmentRomStart, size, 0, &skyboxCtx->loadQueue, NULL);
+ SEGMENT_ROM_START(d2_fine_pal_static), size, 0, &skyboxCtx->loadQueue, NULL);
osRecvMesg(&skyboxCtx->loadQueue, NULL, 1);
}
diff --git a/src/overlays/actors/ovl_En_Dns/z_en_dns.c b/src/overlays/actors/ovl_En_Dns/z_en_dns.c
index 98f8dd5d3..1249e2430 100644
--- a/src/overlays/actors/ovl_En_Dns/z_en_dns.c
+++ b/src/overlays/actors/ovl_En_Dns/z_en_dns.c
@@ -431,7 +431,7 @@ void func_8092D330(EnDns* this, GlobalContext* globalCtx) {
if ((this->unk_2C6 & 0x100) && (DECR(this->unk_2D0) == 0)) {
this->unk_2C6 &= ~0x100;
globalCtx->nextEntranceIndex = 0x5010;
- gSaveContext.unk_3F4A = 0;
+ gSaveContext.nextCutsceneIndex = 0;
globalCtx->sceneLoadFlag = 0x14;
globalCtx->unk_1887F = 3;
gSaveContext.nextTransition = 3;
diff --git a/src/overlays/actors/ovl_En_Invadepoh/z_en_invadepoh.c b/src/overlays/actors/ovl_En_Invadepoh/z_en_invadepoh.c
index 1b3cf562f..613caad0a 100644
--- a/src/overlays/actors/ovl_En_Invadepoh/z_en_invadepoh.c
+++ b/src/overlays/actors/ovl_En_Invadepoh/z_en_invadepoh.c
@@ -2041,7 +2041,7 @@ void func_80B47108(EnInvadepoh* this, GlobalContext* globalCtx) {
this->actionTimer--;
if (this->actionTimer <= 0) {
globalCtx->nextEntranceIndex = 0x6460;
- gSaveContext.unk_3F4A = 0;
+ gSaveContext.nextCutsceneIndex = 0;
globalCtx->sceneLoadFlag = 0x14;
globalCtx->unk_1887F = 0x49;
gSaveContext.nextTransition = 0x48;
@@ -2059,7 +2059,7 @@ void func_80B471C0(EnInvadepoh* this) {
void func_80B471E0(EnInvadepoh* this, GlobalContext* globalCtx) {
if (D_80B4E998) {
globalCtx->nextEntranceIndex = 0x6470;
- gSaveContext.unk_3F4A = 0;
+ gSaveContext.nextCutsceneIndex = 0;
globalCtx->sceneLoadFlag = 0x14;
globalCtx->unk_1887F = 0x48;
gSaveContext.nextTransition = 0x48;
@@ -2082,7 +2082,7 @@ void func_80B47278(EnInvadepoh* this) {
void func_80B47298(EnInvadepoh* this, GlobalContext* globalCtx) {
globalCtx->nextEntranceIndex = 0x6400;
- gSaveContext.unk_3F4A = 0xFFF3;
+ gSaveContext.nextCutsceneIndex = 0xFFF3;
globalCtx->sceneLoadFlag = 0x14;
globalCtx->unk_1887F = 0x48;
gSaveContext.nextTransition = 0x48;
diff --git a/src/overlays/actors/ovl_En_Ma4/z_en_ma4.c b/src/overlays/actors/ovl_En_Ma4/z_en_ma4.c
index 4d07c983a..a0d27353a 100644
--- a/src/overlays/actors/ovl_En_Ma4/z_en_ma4.c
+++ b/src/overlays/actors/ovl_En_Ma4/z_en_ma4.c
@@ -685,7 +685,7 @@ void EnMa4_SetupBeginHorsebackGame(EnMa4* this) {
void EnMa4_BeginHorsebackGame(EnMa4* this, GlobalContext* globalCtx) {
globalCtx->nextEntranceIndex = 0x6400;
- gSaveContext.unk_3F4A = 0xFFF0;
+ gSaveContext.nextCutsceneIndex = 0xFFF0;
globalCtx->sceneLoadFlag = 0x14;
globalCtx->unk_1887F = 0x50;
gSaveContext.nextTransition = 3;
@@ -776,7 +776,7 @@ void EnMa4_HorsebackGameEnd(EnMa4* this, GlobalContext* globalCtx) {
} else if (sFrameCounter == 50) {
globalCtx->actorCtx.unk268 = 0;
globalCtx->nextEntranceIndex = 0x6410;
- gSaveContext.unk_3F4A = 0;
+ gSaveContext.nextCutsceneIndex = 0;
sFrameCounter = 0;
globalCtx->sceneLoadFlag = 0x14;
@@ -883,7 +883,7 @@ void EnMa4_SetupBeginDescribeThemCs(EnMa4* this) {
void EnMa4_BeginDescribeThemCs(EnMa4* this, GlobalContext* globalCtx) {
globalCtx->nextEntranceIndex = 0x6400;
- gSaveContext.unk_3F4A = 0xFFF5;
+ gSaveContext.nextCutsceneIndex = 0xFFF5;
globalCtx->sceneLoadFlag = 0x14;
globalCtx->unk_1887F = 0x40;
gSaveContext.nextTransition = 2;
diff --git a/src/overlays/actors/ovl_En_Ma_Yto/z_en_ma_yto.c b/src/overlays/actors/ovl_En_Ma_Yto/z_en_ma_yto.c
index 04c1e060f..1c9987a8e 100644
--- a/src/overlays/actors/ovl_En_Ma_Yto/z_en_ma_yto.c
+++ b/src/overlays/actors/ovl_En_Ma_Yto/z_en_ma_yto.c
@@ -1119,7 +1119,7 @@ void EnMaYto_PostMilkRunEnd(EnMaYto* this, GlobalContext* globalCtx) {
// Romani Ranch
globalCtx->nextEntranceIndex = 0x6480;
}
- gSaveContext.unk_3F4A = 0;
+ gSaveContext.nextCutsceneIndex = 0;
globalCtx->sceneLoadFlag = 0x14;
globalCtx->unk_1887F = 0x50;
gSaveContext.nextTransition = 3;
diff --git a/src/overlays/gamestates/ovl_daytelop/z_daytelop.c b/src/overlays/gamestates/ovl_daytelop/z_daytelop.c
index c6b9078a4..ba34c2448 100644
--- a/src/overlays/gamestates/ovl_daytelop/z_daytelop.c
+++ b/src/overlays/gamestates/ovl_daytelop/z_daytelop.c
@@ -1,22 +1,247 @@
/*
* File: z_daytelop.c
* Overlay: ovl_daytelop
- * Description:
+ * Description: "Dawn of ... day" screen
*/
#include "z_daytelop.h"
+#include "static/daytelop_static/daytelop_static.h"
+#include "static/icon_item_gameover_static/icon_item_gameover_static.h"
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_daytelop/Daytelop_Update.s")
+// unused
+UNK_TYPE D_808158E0[] = {
+ 0x00000C00, 0x00000000, 0x00000000, 0x40000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000C04, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x80000000, 0x00000000, 0x00000000, 0x00000000, 0x80000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00100000, 0x00000000, 0x00000000, 0x40000002, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x04000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000002, 0x00000000, 0x00000000, 0x00000000, 0x04000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x0000000F, 0x00000000, 0x00000000, 0x00000000,
+ 0x0070B000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x80000000, 0x00000000, 0x00000400, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x80000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x01A00020, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000400, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00001000,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0x00000400,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x80000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000002, 0x00000000, 0x00000000, 0x00000000, 0x40000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000010, 0x00000000, 0x00000000, 0x00000000, 0x00000003, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x80000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000, 0x80000000, 0x00100400, 0x00000000, 0x00000000, 0x00000022, 0x00000400,
+ 0x00000000, 0x00000000, 0x00000080, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000400, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0x00000000, 0x00000000, 0x00000000, 0x80000002, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x80000000, 0x00000C00, 0x00000000, 0x00000000,
+ 0x40000000, 0x00000102, 0x00000000, 0x00000000, 0x00000400, 0x00000000, 0x00000000, 0x00000000, 0x00000002,
+ 0x00000000, 0x00000000, 0x00000000, 0x40000000, 0x00000070, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x40000000, 0x00000000, 0x00000000, 0x00000000, 0x40000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00100000, 0x00000000, 0x00000000, 0x80000000,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000400, 0x00000000, 0x00000000, 0x00000000, 0x00000400, 0x00000000, 0x00000000, 0x00000000,
+ 0x00100000, 0x00000000, 0x00000000, 0x80000000, 0x00000000, 0x00000000, 0x00000000, 0x00000100, 0x00000400,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000080, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000080, 0x00000000, 0x00000000, 0x00000000, 0x80000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000400, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000001, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000001, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000400, 0x00100000, 0x00000000, 0x00000000, 0x00000400, 0x00000000, 0x00000000,
+ 0x00000001, 0x00000000,
+};
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_daytelop/Daytelop_Draw.s")
+void Daytelop_Update(DaytelopContext* this, GameState* gameState) {
+ static u8 D_80815FF0 = 0;
+ s16 new_var;
+ u8 temp_v0_2;
-void Daytelop_Main(GameState* thisx);
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_daytelop/Daytelop_Main.s")
+ this->transitionCountdown--;
+ if (this->transitionCountdown == 0) {
+ if (gSaveContext.day < 9) {
+ gSaveContext.gameMode = 0;
+ } else {
+ gSaveContext.nextCutsceneIndex = 0xFFF6;
+ gSaveContext.day = 1;
+ }
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_daytelop/Daytelop_Destroy.s")
+ {
+ GameState* state = &this->state;
+ state->running = 0;
+ }
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_daytelop/Daytelop_nop80815770.s")
+ SET_NEXT_GAMESTATE(&this->state, Play_Init, GlobalContext);
+ gSaveContext.time = CLOCK_TIME(6, 0);
+ D_801BDBC8 = 0xFE;
+ } else if (this->transitionCountdown == 90) {
+ this->fadeInState = DAYTELOP_HOURSTEXT_FADEIN;
+ this->alpha = 0;
+ D_80815FF0 = 30;
+ }
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_daytelop/Daytelop_LoadGraphics.s")
+ if (this->fadeInState == DAYTELOP_HOURSTEXT_FADEIN) {
+ this->alpha += (s16)(ABS_ALT(this->alpha - 0xFF) / D_80815FF0);
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_daytelop/Daytelop_Init.s")
+ D_80815FF0--;
+ if (D_80815FF0 == 0) {
+ this->fadeInState = DAYTELOP_HOURSTEXT_ON;
+ this->alpha = 255;
+ }
+ }
+}
+
+TexturePtr sDayLeftTextures[] = {
+ gDaytelopFirstDayLeftNESTex,
+ gDaytelopSecondDayLeftNESTex,
+ gDaytelopFinalDayLeftNESTex,
+
+ // Last element is the new day
+ gDaytelopNewDayLeftNESTex,
+};
+
+TexturePtr sDayRightTextures[] = {
+ gDaytelopFirstDayRightNESTex,
+ gDaytelopSecondDayRightNESTex,
+ gDaytelopFinalDayRightNESTex,
+
+ // Last element is the new day
+ gDaytelopNewDayRightNESTex,
+};
+
+TexturePtr sHoursLeftTextures[] = {
+ gDaytelop72HoursNESTex,
+ gDaytelop48HoursNESTex,
+ gDaytelop24HoursNESTex,
+};
+
+void Daytelop_Draw(DaytelopContext* this) {
+ GraphicsContext* gfxCtx = this->state.gfxCtx;
+
+ OPEN_DISPS(gfxCtx);
+ func_8012C628(this->state.gfxCtx);
+
+ if (gSaveContext.day >= 9) {
+ // Draw a white screen
+ gDPSetRenderMode(POLY_OPA_DISP++, G_RM_XLU_SURF, G_RM_XLU_SURF2);
+ gDPSetCombineMode(POLY_OPA_DISP++, G_CC_PRIMITIVE, G_CC_PRIMITIVE);
+ gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, 255, 255, 255, 255);
+ gDPFillRectangle(POLY_OPA_DISP++, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT);
+ }
+
+ func_8012C628(this->state.gfxCtx);
+
+ gDPSetRenderMode(POLY_OPA_DISP++, G_RM_OPA_SURF, G_RM_OPA_SURF2);
+ gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, 255, 255, 255, 255);
+
+ if (gSaveContext.day >= 9) {
+ gDPSetAlphaCompare(POLY_OPA_DISP++, G_AC_NONE);
+ }
+
+ // Draw the left side of the "Dawn of" texture
+ if (gSaveContext.day < 9) {
+ gDPLoadTextureBlock_4b(POLY_OPA_DISP++, sDayLeftTextures[CURRENT_DAY - 1], G_IM_FMT_I, 128, 64, 0,
+ G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMASK, G_TX_NOMASK,
+ G_TX_NOLOD, G_TX_NOLOD);
+ } else {
+ gDPLoadTextureBlock_4b(POLY_OPA_DISP++, sDayLeftTextures[ARRAY_COUNT(sDayLeftTextures) - 1], G_IM_FMT_I, 128,
+ 64, 0, G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMASK, G_TX_NOMASK,
+ G_TX_NOLOD, G_TX_NOLOD);
+ }
+ gSPTextureRectangle(POLY_OPA_DISP++, 32 << 2, 77 << 2, (32 + 128) << 2, (77 + 64) << 2, G_TX_RENDERTILE, 0, 0,
+ 0x0400, 0x0400);
+
+ // Draw the right side of the "Dawn of" texture
+ if (gSaveContext.day < 9) {
+ gDPLoadTextureBlock_4b(POLY_OPA_DISP++, sDayRightTextures[CURRENT_DAY - 1], G_IM_FMT_I, 128, 64, 0,
+ G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMASK, G_TX_NOMASK,
+ G_TX_NOLOD, G_TX_NOLOD);
+ } else {
+ gDPLoadTextureBlock_4b(POLY_OPA_DISP++, sDayRightTextures[ARRAY_COUNT(sDayRightTextures) - 1], G_IM_FMT_I, 128,
+ 64, 0, G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMASK, G_TX_NOMASK,
+ G_TX_NOLOD, G_TX_NOLOD);
+ }
+ gSPTextureRectangle(POLY_OPA_DISP++, 160 << 2, 77 << 2, (160 + 128) << 2, (77 + 64) << 2, G_TX_RENDERTILE, 0, 0,
+ 0x0400, 0x0400);
+
+ // Draw the "Hours left" texture
+ if (gSaveContext.day < 9) {
+ gDPPipeSync(POLY_OPA_DISP++);
+ gDPSetRenderMode(POLY_OPA_DISP++, G_RM_XLU_SURF, G_RM_XLU_SURF2);
+ gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, 255, 255, 255, this->alpha);
+ gDPLoadTextureBlock_4b(POLY_OPA_DISP++, sHoursLeftTextures[CURRENT_DAY - 1], G_IM_FMT_I, 144, 32, 0,
+ G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMASK, G_TX_NOMASK,
+ G_TX_NOLOD, G_TX_NOLOD);
+ gSPTextureRectangle(POLY_OPA_DISP++, 88 << 2, 144 << 2, (88 + 144) << 2, (144 + 32) << 2, G_TX_RENDERTILE, 0, 0,
+ 0x0400, 0x0400);
+ }
+
+ CLOSE_DISPS(this->state.gfxCtx);
+}
+
+void Daytelop_Main(GameState* thisx) {
+ DaytelopContext* this = (DaytelopContext*)thisx;
+
+ func_8012CF0C(this->state.gfxCtx, 1, 1, 0, 0, 0);
+
+ OPEN_DISPS(this->state.gfxCtx);
+ gSPSegment(POLY_OPA_DISP++, 0x09, this->daytelopStaticFile);
+ gSPSegment(POLY_OPA_DISP++, 0x0C, this->gameoverStaticFile);
+ CLOSE_DISPS(this->state.gfxCtx);
+
+ Daytelop_Draw(this);
+ Daytelop_Update(this, &this->state);
+}
+
+void Daytelop_Destroy(GameState* thisx) {
+ ShrinkWindow_Fini();
+}
+
+void Daytelop_nop80815770(DaytelopContext* this) {
+}
+
+void Daytelop_LoadGraphics(DaytelopContext* this) {
+ size_t segmentSize = SEGMENT_ROM_SIZE(daytelop_static);
+
+ this->daytelopStaticFile = THA_AllocEndAlign16(&this->state.heap, segmentSize);
+ DmaMgr_SendRequest0(this->daytelopStaticFile, SEGMENT_ROM_START(daytelop_static), segmentSize);
+
+ segmentSize = SEGMENT_ROM_SIZE(icon_item_gameover_static);
+ this->gameoverStaticFile = THA_AllocEndAlign16(&this->state.heap, segmentSize);
+ DmaMgr_SendRequest0(this->gameoverStaticFile, SEGMENT_ROM_START(icon_item_gameover_static), segmentSize);
+}
+
+void Daytelop_Init(GameState* thisx) {
+ DaytelopContext* this = (DaytelopContext*)thisx;
+
+ Game_SetFramerateDivisor(thisx, 1);
+ SysMatrix_StateAlloc(thisx);
+ ShrinkWindow_Fini();
+ View_Init(&this->view, thisx->gfxCtx);
+ thisx->main = Daytelop_Main;
+ thisx->destroy = Daytelop_Destroy;
+ this->transitionCountdown = 140;
+ this->fadeInState = DAYTELOP_HOURSTEXT_OFF;
+
+ if (gSaveContext.day < 9) {
+ if (gSaveContext.day == 0) {
+ func_80143AC4();
+ }
+ Sram_IncrementDay();
+ }
+
+ Daytelop_nop80815770(this);
+ Daytelop_LoadGraphics(this);
+ play_sound(NA_SE_OC_TELOP_IMPACT);
+}
diff --git a/src/overlays/gamestates/ovl_daytelop/z_daytelop.h b/src/overlays/gamestates/ovl_daytelop/z_daytelop.h
index d2788e0e9..eca743850 100644
--- a/src/overlays/gamestates/ovl_daytelop/z_daytelop.h
+++ b/src/overlays/gamestates/ovl_daytelop/z_daytelop.h
@@ -7,14 +7,21 @@ void Daytelop_Init(GameState* thisx);
void Daytelop_Destroy(GameState* thisx);
typedef struct {
- /* 0x000 */ GameState common;
- /* 0x0A4 */ UNK_TYPE1 padA4[0xC];
+ /* 0x000 */ GameState state;
+ /* 0x0A4 */ void* daytelopStaticFile;
+ /* 0x0A8 */ void* gameoverStaticFile;
+ /* 0x0AC */ UNK_TYPE1 unk_AC[0x4];
/* 0x0B0 */ View view;
- /* 0x218 */ UNK_TYPE1 pad218[0x28];
+ /* 0x218 */ UNK_TYPE1 unk_218[0x28];
/* 0x240 */ s16 transitionCountdown;
- /* 0x242 */ s16 unk242;
- /* 0x244 */ s16 unk244;
- /* 0x246 */ UNK_TYPE1 pad246[0x2];
+ /* 0x242 */ s16 fadeInState;
+ /* 0x244 */ s16 alpha;
} DaytelopContext; // size = 0x248
+typedef enum {
+ /* 0 */ DAYTELOP_HOURSTEXT_OFF,
+ /* 1 */ DAYTELOP_HOURSTEXT_FADEIN,
+ /* 2 */ DAYTELOP_HOURSTEXT_ON
+} Daytelop_FadeState;
+
#endif