diff --git a/assets/xml/static/daytelop_static.xml b/assets/xml/static/daytelop_static.xml
new file mode 100644
index 0000000000..2c558404f5
--- /dev/null
+++ b/assets/xml/static/daytelop_static.xml
@@ -0,0 +1,19 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/assets/xml/static/esp_daytelop_static.xml b/assets/xml/static/esp_daytelop_static.xml
new file mode 100644
index 0000000000..2c55295dc4
--- /dev/null
+++ b/assets/xml/static/esp_daytelop_static.xml
@@ -0,0 +1,19 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/assets/xml/static/fra_daytelop_static.xml b/assets/xml/static/fra_daytelop_static.xml
new file mode 100644
index 0000000000..f855ddbe17
--- /dev/null
+++ b/assets/xml/static/fra_daytelop_static.xml
@@ -0,0 +1,19 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/assets/xml/static/ger_daytelop_static.xml b/assets/xml/static/ger_daytelop_static.xml
new file mode 100644
index 0000000000..398683f4bb
--- /dev/null
+++ b/assets/xml/static/ger_daytelop_static.xml
@@ -0,0 +1,19 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/assets/xml/static/icon_item_gameover_static.xml b/assets/xml/static/icon_item_gameover_static.xml
new file mode 100644
index 0000000000..405167b86a
--- /dev/null
+++ b/assets/xml/static/icon_item_gameover_static.xml
@@ -0,0 +1,10 @@
+
+
+
+
+
+
+
+
+
+
diff --git a/include/functions.h b/include/functions.h
index bd61a60c45..98cfefe655 100644
--- a/include/functions.h
+++ b/include/functions.h
@@ -2814,9 +2814,9 @@ void func_801434E4(GameState* gamestate, SkyboxContext* skyboxCtx, s16 skyType);
// void func_80143A04(void);
void func_80143A10(u8 owlId);
// void func_80143A54(void);
-// void func_80143AC4(void);
+void func_80143AC4(void);
void func_80143B0C(GlobalContext* globalCtx);
-// void Sram_IncrementDay(void);
+void Sram_IncrementDay(void);
u32 Sram_CalcChecksum(u8* data, u32 length);
// void func_80144628(void);
// void Sram_GenerateRandomSaveFields(void);
@@ -2927,7 +2927,7 @@ void ShrinkWindow_SetPillarboxTarget(s8 target);
void ShrinkWindow_SetPillarboxMagnitude(u8 magnitude);
// s32 ShrinkWindow_GetPillarboxMagnitude(void);
// void ShrinkWindow_Init(void);
-// void ShrinkWindow_Fini(void);
+void ShrinkWindow_Fini(void);
void ShrinkWindow_Step(s32 framerateDivisor);
void ShrinkWindow_Draw(GlobalContext* globalCtx);
// void func_80161180(void);
@@ -3061,7 +3061,7 @@ s32 FrameAdvance_IsEnabled(GlobalContext* globalCtx);
// void func_8016A168(void);
// void func_8016A178(void);
// void func_8016A268(UNK_TYPE1 param_1, UNK_TYPE1 param_2, UNK_TYPE1 param_3, UNK_TYPE1 param_4, UNK_TYPE1 param_5, UNK_TYPE1 param_6);
-void Play_Init(GlobalContext* globalCtx);
+void Play_Init(GameState* gameState);
// void func_8016AC10(UNK_TYPE1 param_1, UNK_TYPE1 param_2, UNK_TYPE1 param_3, UNK_TYPE1 param_4, UNK_TYPE4 param_5, UNK_TYPE4 param_6, UNK_TYPE4 param_7, UNK_TYPE4 param_8, UNK_TYPE4 param_9, UNK_TYPE4 param_10);
// void func_8016AE1C(void);
// void func_8016B278(void);
diff --git a/include/macros.h b/include/macros.h
index b7a0ff2170..36af1534bc 100644
--- a/include/macros.h
+++ b/include/macros.h
@@ -34,7 +34,7 @@
//#define LINK_IS_CHILD (gSaveContext.linkAge != 0)
#define LINK_IS_ADULT (gSaveContext.linkAge == 0)
-#define CURRENT_DAY (gSaveContext.day % 5)
+#define CURRENT_DAY (((void)0, gSaveContext.day) % 5)
#define CLOCK_TIME(hr, min) ((s32)(((hr) * 60 + (min)) * 0x10000 / (24 * 60)))
diff --git a/include/segment_symbols.h b/include/segment_symbols.h
index 7c8f4895a7..a2dc30ff39 100644
--- a/include/segment_symbols.h
+++ b/include/segment_symbols.h
@@ -19,6 +19,18 @@
DECLARE_SEGMENT(ovl_##name) \
DECLARE_ROM_SEGMENT(ovl_##name)
+#define SEGMENT_START(segment) (_ ## segment ## SegmentStart)
+#define SEGMENT_END(segment) (_ ## segment ## SegmentEnd)
+#define SEGMENT_SIZE(segment) ((uintptr_t)SEGMENT_END(segment) - (uintptr_t)SEGMENT_START(segment))
+
+#define SEGMENT_ROM_START(segment) (_ ## segment ## SegmentRomStart)
+#define SEGMENT_ROM_END(segment) (_ ## segment ## SegmentRomEnd)
+#define SEGMENT_ROM_SIZE(segment) ((uintptr_t)SEGMENT_ROM_END(segment) - (uintptr_t)SEGMENT_ROM_START(segment))
+
+#define SEGMENT_BSS_START(segment) (_ ## segment ## SegmentBssStart)
+#define SEGMENT_BSS_END(segment) (_ ## segment ## SegmentBssEnd)
+#define SEGMENT_BSS_SIZE(segment) ((uintptr_t)SEGMENT_BSS_END(segment) - (uintptr_t)SEGMENT_BSS_START(segment))
+
DECLARE_SEGMENT(boot)
DECLARE_ROM_SEGMENT(boot)
@@ -1156,7 +1168,7 @@ DECLARE_ROM_SEGMENT(week_static)
DECLARE_ROM_SEGMENT(daytelop_static)
DECLARE_ROM_SEGMENT(ger_daytelop_static)
DECLARE_ROM_SEGMENT(fra_daytelop_static)
-DECLARE_ROM_SEGMENT(spa_daytelop_static)
+DECLARE_ROM_SEGMENT(esp_daytelop_static)
DECLARE_ROM_SEGMENT(d2_fine_static)
DECLARE_ROM_SEGMENT(d2_cloud_static)
DECLARE_ROM_SEGMENT(d2_fine_pal_static)
diff --git a/include/variables.h b/include/variables.h
index 0e17c2daa1..258cec4df8 100644
--- a/include/variables.h
+++ b/include/variables.h
@@ -983,7 +983,7 @@ extern u8 kanfontOrdering[92];
// extern UNK_TYPE1 D_801BDBBC;
// extern UNK_TYPE1 D_801BDBC0;
// extern UNK_TYPE1 D_801BDBC4;
-// extern UNK_TYPE1 D_801BDBC8;
+extern u8 D_801BDBC8;
// extern UNK_TYPE1 D_801BDBCC;
// extern UNK_TYPE1 D_801BDCF4;
// extern UNK_TYPE1 D_801BE38E;
diff --git a/include/z64animation.h b/include/z64animation.h
index 1e5b8b0ed4..aa5148e3b2 100644
--- a/include/z64animation.h
+++ b/include/z64animation.h
@@ -7,7 +7,7 @@
#include "z64math.h"
#define LINK_ANIMETION_OFFSET(addr, offset) \
- (((u32)&_link_animetionSegmentRomStart) + ((u32)addr & 0xFFFFFF) + ((u32)offset))
+ (SEGMENT_ROM_START(link_animetion) + ((u32)addr & 0xFFFFFF) + ((u32)offset))
#define LIMB_DONE 0xFF
#define ANIMATION_ENTRY_MAX 50
diff --git a/include/z64save.h b/include/z64save.h
index 20efff7b8f..d701d0a42c 100644
--- a/include/z64save.h
+++ b/include/z64save.h
@@ -159,7 +159,7 @@ typedef struct {
/* 0x3F45 */ u8 zTargetSetting; // 0: Switch; 1: Hold
/* 0x3F46 */ u16 unk_3F46; // "NottoriBgm"
/* 0x3F48 */ u8 unk_3F48; // "fade_go"
- /* 0x3F4A */ u16 unk_3F4A; // "next_daytime"
+ /* 0x3F4A */ u16 nextCutsceneIndex; // "next_daytime"
/* 0x3F4C */ u8 cutsceneTrigger; // "doukidemo"
/* 0x3F4D */ u8 unk_3F4D; // "Kenjya_no"
/* 0x3F4E */ u16 nextDayTime; // "next_zelda_time"
diff --git a/spec b/spec
index b2b784c259..eb6fbaad6d 100644
--- a/spec
+++ b/spec
@@ -318,7 +318,8 @@ beginseg
name "icon_item_gameover_static"
compress
romalign 0x1000
- include "build/baserom/icon_item_gameover_static.o"
+ include "build/assets/static/icon_item_gameover_static/icon_item_gameover_static.o"
+ number 12
endseg
beginseg
@@ -732,8 +733,7 @@ beginseg
name "ovl_daytelop"
compress
include "build/src/overlays/gamestates/ovl_daytelop/z_daytelop.o"
- include "build/data/ovl_daytelop/ovl_daytelop.data.o"
- include "build/data/ovl_daytelop/ovl_daytelop.reloc.o"
+ include "build/src/overlays/gamestates/ovl_daytelop/ovl_daytelop_reloc.o"
endseg
beginseg
@@ -8927,28 +8927,32 @@ beginseg
name "daytelop_static"
compress
romalign 0x1000
- include "build/baserom/daytelop_static.o"
+ include "build/assets/static/daytelop_static/daytelop_static.o"
+ number 9
endseg
beginseg
name "ger_daytelop_static"
compress
romalign 0x1000
- include "build/baserom/ger_daytelop_static.o"
+ include "build/assets/static/ger_daytelop_static/ger_daytelop_static.o"
+ number 9
endseg
beginseg
name "fra_daytelop_static"
compress
romalign 0x1000
- include "build/baserom/fra_daytelop_static.o"
+ include "build/assets/static/fra_daytelop_static/fra_daytelop_static.o"
+ number 9
endseg
beginseg
name "esp_daytelop_static"
compress
romalign 0x1000
- include "build/baserom/esp_daytelop_static.o"
+ include "build/assets/static/esp_daytelop_static/esp_daytelop_static.o"
+ number 9
endseg
beginseg
diff --git a/src/boot_O2_g3/idle.c b/src/boot_O2_g3/idle.c
index 4d01b4c379..4be8a1094f 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 5a29d5d56a..3a447b0e85 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 63dcc9c585..4165e4c9b9 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 f85911fc68..b678642b18 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 efaadf4bf8..e771445282 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 cee8546f05..8372c350a1 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 5c00758d28..1fca4801d1 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 98f8dd5d31..1249e24300 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 1b3cf562f2..613caad0a3 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 4d07c983a1..a0d27353a9 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 04c1e060fc..1c9987a8e3 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 c6b9078a4d..ba34c24482 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 d2788e0e9e..eca743850b 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
diff --git a/tools/disasm/variables.txt b/tools/disasm/variables.txt
index 8a38052aff..a2b28c247c 100644
--- a/tools/disasm/variables.txt
+++ b/tools/disasm/variables.txt
@@ -4888,9 +4888,10 @@
0x808147F0:("D_808147F0","f32","",0x4),
0x80814E80:("D_80814E80","UNK_TYPE1","",0x1),
0x80814E90:("D_80814E90","UNK_TYPE1","",0x1),
- 0x80815FF0:("D_80815FF0","u32","[4]",0x10),
- 0x80816000:("D_80816000","u32","[4]",0x10),
- 0x80816010:("D_80816010","u32","[4]",0x10),
+ 0x80815FF0:("D_80815FF0","u8","",0x1),
+ 0x80815FF4:("sDayLeftTextures","TexturePtr","[4]",0x10),
+ 0x80816004:("sDayRightTextures","TexturePtr","[4]",0x10),
+ 0x80816014:("sHoursLeftTextures","TexturePtr","[3]",0xC),
0x8082AED0:("D_8082AED0","UNK_TYPE1","",0x1),
0x8082AED8:("D_8082AED8","UNK_TYPE1","",0x1),
0x8082AEE0:("D_8082AEE0","UNK_TYPE2","",0x2),
diff --git a/tools/permuter_settings.toml b/tools/permuter_settings.toml
index ac4e1533c5..82ce7cdfed 100644
--- a/tools/permuter_settings.toml
+++ b/tools/permuter_settings.toml
@@ -11,6 +11,7 @@ CLOSE_DISPS = "void"
ABS = "int"
SQ = "int"
CLAMP = "int"
+CLOCK_TIME = "int"
[decompme.compilers]
"tools/ido_recomp/linux/7.1/cc" = "ido7.1"
@@ -18,4 +19,4 @@ CLAMP = "int"
"tools/ido_recomp/windows/7.1/cc" = "ido7.1"
"tools/ido_recomp/linux/5.3/cc" = "ido5.3"
"tools/ido_recomp/macos/5.3/cc" = "ido5.3"
-"tools/ido_recomp/windows/5.3/cc" = "ido5.3"
\ No newline at end of file
+"tools/ido_recomp/windows/5.3/cc" = "ido5.3"