`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>
This commit is contained in:
Anghelo Carvajal 2021-09-22 22:50:35 -03:00 committed by GitHub
parent a59943bc4a
commit 2ff7320409
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
27 changed files with 419 additions and 82 deletions

View File

@ -0,0 +1,19 @@
<Root>
<File Name="daytelop_static" Segment="9">
<Texture Name="gDaytelopFirstDayLeftNESTex" OutName="first_day_left_nes" Format="i4" Width="128" Height="64" Offset="0x0"/>
<Texture Name="gDaytelopFirstDayRightNESTex" OutName="first_day_right_nes" Format="i4" Width="128" Height="64" Offset="0x1000"/>
<Texture Name="gDaytelopSecondDayLeftNESTex" OutName="second_day_left_nes" Format="i4" Width="128" Height="64" Offset="0x2000"/>
<Texture Name="gDaytelopSecondDayRightNESTex" OutName="second_day_right_nes" Format="i4" Width="128" Height="64" Offset="0x3000"/>
<Texture Name="gDaytelopFinalDayLeftNESTex" OutName="final_day_left_nes" Format="i4" Width="128" Height="64" Offset="0x4000"/>
<Texture Name="gDaytelopFinalDayRightNESTex" OutName="final_day_right_nes" Format="i4" Width="128" Height="64" Offset="0x5000"/>
<Texture Name="gDaytelopNewDayLeftNESTex" OutName="new_day_left_nes" Format="i4" Width="128" Height="64" Offset="0x6000"/>
<Texture Name="gDaytelopNewDayRightNESTex" OutName="new_day_right_nes" Format="i4" Width="128" Height="64" Offset="0x7000"/>
<Texture Name="gDaytelop72HoursNESTex" OutName="72_hours_nes" Format="i4" Width="144" Height="32" Offset="0x8000"/>
<Texture Name="gDaytelop48HoursNESTex" OutName="48_hours_nes" Format="i4" Width="144" Height="32" Offset="0x8900"/>
<Texture Name="gDaytelop24HoursNESTex" OutName="24_hours_nes" Format="i4" Width="144" Height="32" Offset="0x9200"/>
</File>
</Root>

View File

@ -0,0 +1,19 @@
<Root>
<File Name="esp_daytelop_static" Segment="9">
<Texture Name="gDaytelopFirstDayLeftESPTex" OutName="first_day_left_esp" Format="i4" Width="128" Height="64" Offset="0x0"/>
<Texture Name="gDaytelopFirstDayRightESPTex" OutName="first_day_right_esp" Format="i4" Width="128" Height="64" Offset="0x1000"/>
<Texture Name="gDaytelopSecondDayLeftESPTex" OutName="second_day_left_esp" Format="i4" Width="128" Height="64" Offset="0x2000"/>
<Texture Name="gDaytelopSecondDayRightESPTex" OutName="second_day_right_esp" Format="i4" Width="128" Height="64" Offset="0x3000"/>
<Texture Name="gDaytelopFinalDayLeftESPTex" OutName="final_day_left_esp" Format="i4" Width="128" Height="64" Offset="0x4000"/>
<Texture Name="gDaytelopFinalDayRightESPTex" OutName="final_day_right_esp" Format="i4" Width="128" Height="64" Offset="0x5000"/>
<Texture Name="gDaytelopNewDayLeftESPTex" OutName="new_day_left_esp" Format="i4" Width="128" Height="64" Offset="0x6000"/>
<Texture Name="gDaytelopNewDayRightESPTex" OutName="new_day_right_esp" Format="i4" Width="128" Height="64" Offset="0x7000"/>
<Texture Name="gDaytelop72HoursESPTex" OutName="72_hours_esp" Format="i4" Width="144" Height="32" Offset="0x8000"/>
<Texture Name="gDaytelop48HoursESPTex" OutName="48_hours_esp" Format="i4" Width="144" Height="32" Offset="0x8900"/>
<Texture Name="gDaytelop24HoursESPTex" OutName="24_hours_esp" Format="i4" Width="144" Height="32" Offset="0x9200"/>
</File>
</Root>

View File

@ -0,0 +1,19 @@
<Root>
<File Name="fra_daytelop_static" Segment="9">
<Texture Name="gDaytelopFirstDayLeftFRATex" OutName="first_day_left_fra" Format="i4" Width="128" Height="64" Offset="0x0"/>
<Texture Name="gDaytelopFirstDayRightFRATex" OutName="first_day_right_fra" Format="i4" Width="128" Height="64" Offset="0x1000"/>
<Texture Name="gDaytelopSecondDayLeftFRATex" OutName="second_day_left_fra" Format="i4" Width="128" Height="64" Offset="0x2000"/>
<Texture Name="gDaytelopSecondDayRightFRATex" OutName="second_day_right_fra" Format="i4" Width="128" Height="64" Offset="0x3000"/>
<Texture Name="gDaytelopFinalDayLeftFRATex" OutName="final_day_left_fra" Format="i4" Width="128" Height="64" Offset="0x4000"/>
<Texture Name="gDaytelopFinalDayRightFRATex" OutName="final_day_right_fra" Format="i4" Width="128" Height="64" Offset="0x5000"/>
<Texture Name="gDaytelopNewDayLeftFRATex" OutName="new_day_left_fra" Format="i4" Width="128" Height="64" Offset="0x6000"/>
<Texture Name="gDaytelopNewDayRightFRATex" OutName="new_day_right_fra" Format="i4" Width="128" Height="64" Offset="0x7000"/>
<Texture Name="gDaytelop72HoursFRATex" OutName="72_hours_fra" Format="i4" Width="144" Height="32" Offset="0x8000"/>
<Texture Name="gDaytelop48HoursFRATex" OutName="48_hours_fra" Format="i4" Width="144" Height="32" Offset="0x8900"/>
<Texture Name="gDaytelop24HoursFRATex" OutName="24_hours_fra" Format="i4" Width="144" Height="32" Offset="0x9200"/>
</File>
</Root>

View File

@ -0,0 +1,19 @@
<Root>
<File Name="ger_daytelop_static" Segment="9">
<Texture Name="gDaytelopFirstDayLeftGERTex" OutName="first_day_left_ger" Format="i4" Width="128" Height="64" Offset="0x0"/>
<Texture Name="gDaytelopFirstDayRightGERTex" OutName="first_day_right_ger" Format="i4" Width="128" Height="64" Offset="0x1000"/>
<Texture Name="gDaytelopSecondDayLeftGERTex" OutName="second_day_left_ger" Format="i4" Width="128" Height="64" Offset="0x2000"/>
<Texture Name="gDaytelopSecondDayRightGERTex" OutName="second_day_right_ger" Format="i4" Width="128" Height="64" Offset="0x3000"/>
<Texture Name="gDaytelopFinalDayLeftGERTex" OutName="final_day_left_ger" Format="i4" Width="128" Height="64" Offset="0x4000"/>
<Texture Name="gDaytelopFinalDayRightGERTex" OutName="final_day_right_ger" Format="i4" Width="128" Height="64" Offset="0x5000"/>
<Texture Name="gDaytelopNewDayLeftGERTex" OutName="new_day_left_ger" Format="i4" Width="128" Height="64" Offset="0x6000"/>
<Texture Name="gDaytelopNewDayRightGERTex" OutName="new_day_right_ger" Format="i4" Width="128" Height="64" Offset="0x7000"/>
<Texture Name="gDaytelop72HoursGERTex" OutName="72_hours_ger" Format="i4" Width="144" Height="32" Offset="0x8000"/>
<Texture Name="gDaytelop48HoursGERTex" OutName="48_hours_ger" Format="i4" Width="144" Height="32" Offset="0x8900"/>
<Texture Name="gDaytelop24HoursGERTex" OutName="24_hours_ger" Format="i4" Width="144" Height="32" Offset="0x9200"/>
</File>
</Root>

View File

@ -0,0 +1,10 @@
<Root>
<File Name="icon_item_gameover_static" Segment="12">
<Texture Name="gGameOverP1Tex" OutName="game_over_p1" Format="ia8" Width="64" Height="32" Offset="0x0"/>
<Texture Name="gGameOverP2Tex" OutName="game_over_p2" Format="ia8" Width="64" Height="32" Offset="0x800"/>
<Texture Name="gGameOverP3Tex" OutName="game_over_p3" Format="ia8" Width="64" Height="32" Offset="0x1000"/>
<Texture Name="gGameOverMaskTex" OutName="game_over_mask" Format="ia8" Width="64" Height="32" Offset="0x1800"/>
<Texture Name="gContinuePlayingJAPTex" OutName="continue_playing_jap" Format="ia8" Width="152" Height="16" Offset="0x2000"/>
<Texture Name="gContinuePlayingNESTex" OutName="continue_playing_nes" Format="ia8" Width="152" Height="16" Offset="0x2980"/>
</File>
</Root>

View File

@ -2814,9 +2814,9 @@ void func_801434E4(GameState* gamestate, SkyboxContext* skyboxCtx, s16 skyType);
// void func_80143A04(void); // void func_80143A04(void);
void func_80143A10(u8 owlId); void func_80143A10(u8 owlId);
// void func_80143A54(void); // void func_80143A54(void);
// void func_80143AC4(void); void func_80143AC4(void);
void func_80143B0C(GlobalContext* globalCtx); void func_80143B0C(GlobalContext* globalCtx);
// void Sram_IncrementDay(void); void Sram_IncrementDay(void);
u32 Sram_CalcChecksum(u8* data, u32 length); u32 Sram_CalcChecksum(u8* data, u32 length);
// void func_80144628(void); // void func_80144628(void);
// void Sram_GenerateRandomSaveFields(void); // void Sram_GenerateRandomSaveFields(void);
@ -2927,7 +2927,7 @@ void ShrinkWindow_SetPillarboxTarget(s8 target);
void ShrinkWindow_SetPillarboxMagnitude(u8 magnitude); void ShrinkWindow_SetPillarboxMagnitude(u8 magnitude);
// s32 ShrinkWindow_GetPillarboxMagnitude(void); // s32 ShrinkWindow_GetPillarboxMagnitude(void);
// void ShrinkWindow_Init(void); // void ShrinkWindow_Init(void);
// void ShrinkWindow_Fini(void); void ShrinkWindow_Fini(void);
void ShrinkWindow_Step(s32 framerateDivisor); void ShrinkWindow_Step(s32 framerateDivisor);
void ShrinkWindow_Draw(GlobalContext* globalCtx); void ShrinkWindow_Draw(GlobalContext* globalCtx);
// void func_80161180(void); // void func_80161180(void);
@ -3061,7 +3061,7 @@ s32 FrameAdvance_IsEnabled(GlobalContext* globalCtx);
// void func_8016A168(void); // void func_8016A168(void);
// void func_8016A178(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 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_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_8016AE1C(void);
// void func_8016B278(void); // void func_8016B278(void);

View File

@ -34,7 +34,7 @@
//#define LINK_IS_CHILD (gSaveContext.linkAge != 0) //#define LINK_IS_CHILD (gSaveContext.linkAge != 0)
#define LINK_IS_ADULT (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))) #define CLOCK_TIME(hr, min) ((s32)(((hr) * 60 + (min)) * 0x10000 / (24 * 60)))

View File

@ -19,6 +19,18 @@
DECLARE_SEGMENT(ovl_##name) \ DECLARE_SEGMENT(ovl_##name) \
DECLARE_ROM_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_SEGMENT(boot)
DECLARE_ROM_SEGMENT(boot) DECLARE_ROM_SEGMENT(boot)
@ -1156,7 +1168,7 @@ DECLARE_ROM_SEGMENT(week_static)
DECLARE_ROM_SEGMENT(daytelop_static) DECLARE_ROM_SEGMENT(daytelop_static)
DECLARE_ROM_SEGMENT(ger_daytelop_static) DECLARE_ROM_SEGMENT(ger_daytelop_static)
DECLARE_ROM_SEGMENT(fra_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_fine_static)
DECLARE_ROM_SEGMENT(d2_cloud_static) DECLARE_ROM_SEGMENT(d2_cloud_static)
DECLARE_ROM_SEGMENT(d2_fine_pal_static) DECLARE_ROM_SEGMENT(d2_fine_pal_static)

View File

@ -983,7 +983,7 @@ extern u8 kanfontOrdering[92];
// extern UNK_TYPE1 D_801BDBBC; // extern UNK_TYPE1 D_801BDBBC;
// extern UNK_TYPE1 D_801BDBC0; // extern UNK_TYPE1 D_801BDBC0;
// extern UNK_TYPE1 D_801BDBC4; // extern UNK_TYPE1 D_801BDBC4;
// extern UNK_TYPE1 D_801BDBC8; extern u8 D_801BDBC8;
// extern UNK_TYPE1 D_801BDBCC; // extern UNK_TYPE1 D_801BDBCC;
// extern UNK_TYPE1 D_801BDCF4; // extern UNK_TYPE1 D_801BDCF4;
// extern UNK_TYPE1 D_801BE38E; // extern UNK_TYPE1 D_801BE38E;

View File

@ -7,7 +7,7 @@
#include "z64math.h" #include "z64math.h"
#define LINK_ANIMETION_OFFSET(addr, offset) \ #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 LIMB_DONE 0xFF
#define ANIMATION_ENTRY_MAX 50 #define ANIMATION_ENTRY_MAX 50

View File

@ -159,7 +159,7 @@ typedef struct {
/* 0x3F45 */ u8 zTargetSetting; // 0: Switch; 1: Hold /* 0x3F45 */ u8 zTargetSetting; // 0: Switch; 1: Hold
/* 0x3F46 */ u16 unk_3F46; // "NottoriBgm" /* 0x3F46 */ u16 unk_3F46; // "NottoriBgm"
/* 0x3F48 */ u8 unk_3F48; // "fade_go" /* 0x3F48 */ u8 unk_3F48; // "fade_go"
/* 0x3F4A */ u16 unk_3F4A; // "next_daytime" /* 0x3F4A */ u16 nextCutsceneIndex; // "next_daytime"
/* 0x3F4C */ u8 cutsceneTrigger; // "doukidemo" /* 0x3F4C */ u8 cutsceneTrigger; // "doukidemo"
/* 0x3F4D */ u8 unk_3F4D; // "Kenjya_no" /* 0x3F4D */ u8 unk_3F4D; // "Kenjya_no"
/* 0x3F4E */ u16 nextDayTime; // "next_zelda_time" /* 0x3F4E */ u16 nextDayTime; // "next_zelda_time"

18
spec
View File

@ -318,7 +318,8 @@ beginseg
name "icon_item_gameover_static" name "icon_item_gameover_static"
compress compress
romalign 0x1000 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 endseg
beginseg beginseg
@ -732,8 +733,7 @@ beginseg
name "ovl_daytelop" name "ovl_daytelop"
compress compress
include "build/src/overlays/gamestates/ovl_daytelop/z_daytelop.o" include "build/src/overlays/gamestates/ovl_daytelop/z_daytelop.o"
include "build/data/ovl_daytelop/ovl_daytelop.data.o" include "build/src/overlays/gamestates/ovl_daytelop/ovl_daytelop_reloc.o"
include "build/data/ovl_daytelop/ovl_daytelop.reloc.o"
endseg endseg
beginseg beginseg
@ -8927,28 +8927,32 @@ beginseg
name "daytelop_static" name "daytelop_static"
compress compress
romalign 0x1000 romalign 0x1000
include "build/baserom/daytelop_static.o" include "build/assets/static/daytelop_static/daytelop_static.o"
number 9
endseg endseg
beginseg beginseg
name "ger_daytelop_static" name "ger_daytelop_static"
compress compress
romalign 0x1000 romalign 0x1000
include "build/baserom/ger_daytelop_static.o" include "build/assets/static/ger_daytelop_static/ger_daytelop_static.o"
number 9
endseg endseg
beginseg beginseg
name "fra_daytelop_static" name "fra_daytelop_static"
compress compress
romalign 0x1000 romalign 0x1000
include "build/baserom/fra_daytelop_static.o" include "build/assets/static/fra_daytelop_static/fra_daytelop_static.o"
number 9
endseg endseg
beginseg beginseg
name "esp_daytelop_static" name "esp_daytelop_static"
compress compress
romalign 0x1000 romalign 0x1000
include "build/baserom/esp_daytelop_static.o" include "build/assets/static/esp_daytelop_static/esp_daytelop_static.o"
number 9
endseg endseg
beginseg beginseg

View File

@ -58,15 +58,15 @@ void Idle_InitCodeAndMemory(void) {
oldSize = sDmaMgrDmaBuffSize; oldSize = sDmaMgrDmaBuffSize;
sDmaMgrDmaBuffSize = 0; sDmaMgrDmaBuffSize = 0;
DmaMgr_SendRequestImpl(&dmaReq, _codeSegmentStart, _codeSegmentRomStart, _codeSegmentRomEnd - _codeSegmentRomStart, DmaMgr_SendRequestImpl(&dmaReq, SEGMENT_START(code), SEGMENT_ROM_START(code),
0, &queue, 0); SEGMENT_ROM_END(code) - SEGMENT_ROM_START(code), 0, &queue, 0);
Idle_InitScreen(); Idle_InitScreen();
Idle_InitMemory(); Idle_InitMemory();
osRecvMesg(&queue, NULL, 1); osRecvMesg(&queue, NULL, 1);
sDmaMgrDmaBuffSize = oldSize; sDmaMgrDmaBuffSize = oldSize;
Idle_ClearMemory(_codeSegmentBssStart, _codeSegmentBssEnd); Idle_ClearMemory(SEGMENT_BSS_START(code), SEGMENT_BSS_END(code));
} }
void Main_ThreadEntry(void* arg) { void Main_ThreadEntry(void* arg) {

View File

@ -213,8 +213,7 @@ void DmaMgr_Start(void) {
DmaEntry* iter; DmaEntry* iter;
u32 idx; u32 idx;
DmaMgr_DMARomToRam((u32)_dmadataSegmentRomStart, (u32)dmadata, DmaMgr_DMARomToRam(SEGMENT_ROM_START(dmadata), dmadata, SEGMENT_ROM_SIZE(dmadata));
(u32)_dmadataSegmentRomEnd - (u32)_dmadataSegmentRomStart);
dummy_label:; dummy_label:;

View File

@ -3,8 +3,8 @@
#define ACTOR_OVERLAY(name, allocType) \ #define ACTOR_OVERLAY(name, allocType) \
{ \ { \
(u32) _ovl_##name##SegmentRomStart, (u32)_ovl_##name##SegmentRomEnd, _ovl_##name##SegmentStart, \ SEGMENT_ROM_START(ovl_##name), SEGMENT_ROM_END(ovl_##name), SEGMENT_START(ovl_##name), \
_ovl_##name##SegmentEnd, NULL, &name##_InitVars, NULL, allocType, 0 \ SEGMENT_END(ovl_##name), NULL, &name##_InitVars, NULL, allocType, 0 \
} }
#define ACTOR_OVERLAY_INTERNAL(name, allocType) \ #define ACTOR_OVERLAY_INTERNAL(name, allocType) \

View File

@ -9,12 +9,13 @@ void Font_LoadCharNES(GlobalContext* globalCtx, u8 codePointIndex, s32 offset) {
Font* font = &msgCtx->font; Font* font = &msgCtx->font;
DmaMgr_SendRequest0(&font->charBuf[font->unk_11D88][offset], 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); FONT_CHAR_TEX_SIZE);
} }
void Font_LoadMessageBoxEndIcon(Font* font, u16 icon) { 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); FONT_CHAR_TEX_SIZE);
} }
@ -36,7 +37,8 @@ void Font_LoadOrderedFont(Font* font) {
loadOffset = 0; loadOffset = 0;
} }
// UB to convert pointer to u32 // 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) { if (sFontOrdering[codePointIndex] == 0x8C) {
break; break;
} }

View File

@ -221,8 +221,8 @@ void Scene_HeaderCmdEntranceList(GlobalContext* globalCtx, SceneCmd* cmd) {
// SceneTableEntry Header Command 0x07: Special Files // SceneTableEntry Header Command 0x07: Special Files
void Scene_HeaderCmdSpecialFiles(GlobalContext* globalCtx, SceneCmd* cmd) { void Scene_HeaderCmdSpecialFiles(GlobalContext* globalCtx, SceneCmd* cmd) {
static RomFile tatlMessageFiles[2] = { static RomFile tatlMessageFiles[2] = {
{ (u32)_elf_message_fieldSegmentRomStart, (u32)_elf_message_fieldSegmentRomEnd }, { SEGMENT_ROM_START(elf_message_field), SEGMENT_ROM_END(elf_message_field) },
{ (u32)_elf_message_ydanSegmentRomStart, (u32)_elf_message_ydanSegmentRomEnd }, { SEGMENT_ROM_START(elf_message_ydan), SEGMENT_ROM_END(elf_message_ydan) },
}; };
if (cmd->specialFiles.subKeepIndex != 0) { if (cmd->specialFiles.subKeepIndex != 0) {
@ -344,14 +344,14 @@ void Scene_HeaderCmdEnvLightSettings(GlobalContext* globalCtx, SceneCmd* cmd) {
s32 Scene_LoadAreaTextures(GlobalContext* globalCtx, s32 fileIndex) { s32 Scene_LoadAreaTextures(GlobalContext* globalCtx, s32 fileIndex) {
static RomFile sceneTextureFiles[9] = { static RomFile sceneTextureFiles[9] = {
{ 0, 0 }, // Default { 0, 0 }, // Default
{ (u32)_scene_texture_01SegmentRomStart, (u32)_scene_texture_01SegmentRomEnd }, { SEGMENT_ROM_START(scene_texture_01), SEGMENT_ROM_END(scene_texture_01) },
{ (u32)_scene_texture_02SegmentRomStart, (u32)_scene_texture_02SegmentRomEnd }, { SEGMENT_ROM_START(scene_texture_02), SEGMENT_ROM_END(scene_texture_02) },
{ (u32)_scene_texture_03SegmentRomStart, (u32)_scene_texture_03SegmentRomEnd }, { SEGMENT_ROM_START(scene_texture_03), SEGMENT_ROM_END(scene_texture_03) },
{ (u32)_scene_texture_04SegmentRomStart, (u32)_scene_texture_04SegmentRomEnd }, { SEGMENT_ROM_START(scene_texture_04), SEGMENT_ROM_END(scene_texture_04) },
{ (u32)_scene_texture_05SegmentRomStart, (u32)_scene_texture_05SegmentRomEnd }, { SEGMENT_ROM_START(scene_texture_05), SEGMENT_ROM_END(scene_texture_05) },
{ (u32)_scene_texture_06SegmentRomStart, (u32)_scene_texture_06SegmentRomEnd }, { SEGMENT_ROM_START(scene_texture_06), SEGMENT_ROM_END(scene_texture_06) },
{ (u32)_scene_texture_07SegmentRomStart, (u32)_scene_texture_07SegmentRomEnd }, { SEGMENT_ROM_START(scene_texture_07), SEGMENT_ROM_END(scene_texture_07) },
{ (u32)_scene_texture_08SegmentRomStart, (u32)_scene_texture_08SegmentRomEnd }, { SEGMENT_ROM_START(scene_texture_08), SEGMENT_ROM_END(scene_texture_08) },
}; };
u32 vromStart = sceneTextureFiles[fileIndex].vromStart; u32 vromStart = sceneTextureFiles[fileIndex].vromStart;
u32 size = sceneTextureFiles[fileIndex].vromEnd - vromStart; u32 size = sceneTextureFiles[fileIndex].vromEnd - vromStart;

View File

@ -1,7 +1,7 @@
#include "global.h" #include "global.h"
#define SCENE_ENTRY(name, textId, config) \ #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() \ #define SCENE_ENTRY_NONE() \
{ { 0, 0 }, 0, 0, 0, 0 } { { 0, 0 }, 0, 0, 0, 0 }

View File

@ -50,21 +50,21 @@ void func_801431E8(GameState* gamestate, SkyboxContext* skyboxCtx, s16 skyType)
} else { } else {
// Send a DMA request for the cloudy sky texture // Send a DMA request for the cloudy sky texture
skyboxCtx->skyboxStaticSegment[0] = &D_80025D00; 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); 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 // Send a DMA request for the clear sky texture
skyboxCtx->skyboxStaticSegment[1] = offset; 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); 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 // Send a DMA request for the skybox palette
skyboxCtx->skyboxPaletteStaticSegment = offset; 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); 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->primR = 145;
skyboxCtx->primG = 120; skyboxCtx->primG = 120;
@ -91,16 +91,16 @@ void func_80143324(GlobalContext* globalCtx, SkyboxContext* skyboxCtx, s16 skyTy
if (globalCtx->envCtx.unk_10 == 0) { if (globalCtx->envCtx.unk_10 == 0) {
// Send a DMA request for the clear sky texture // 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], 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 { } else {
// Send a DMA request for the cloudy sky texture // 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], 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); osRecvMesg(&skyboxCtx->loadQueue, NULL, 1);
@ -108,26 +108,26 @@ void func_80143324(GlobalContext* globalCtx, SkyboxContext* skyboxCtx, s16 skyTy
if (globalCtx->envCtx.unk_11 == 0) { if (globalCtx->envCtx.unk_11 == 0) {
// Send a DMA request for the clear sky texture // 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], 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 { } else {
// Send a DMA request for the cloudy sky texture // 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], 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); osRecvMesg(&skyboxCtx->loadQueue, NULL, 1);
osCreateMesgQueue(&skyboxCtx->loadQueue, &skyboxCtx->loadMsg, 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 // Send a DMA request for the skybox palette
DmaMgr_SendRequestImpl(&skyboxCtx->unk1C8, skyboxCtx->skyboxPaletteStaticSegment, 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); osRecvMesg(&skyboxCtx->loadQueue, NULL, 1);
} }

View File

@ -431,7 +431,7 @@ void func_8092D330(EnDns* this, GlobalContext* globalCtx) {
if ((this->unk_2C6 & 0x100) && (DECR(this->unk_2D0) == 0)) { if ((this->unk_2C6 & 0x100) && (DECR(this->unk_2D0) == 0)) {
this->unk_2C6 &= ~0x100; this->unk_2C6 &= ~0x100;
globalCtx->nextEntranceIndex = 0x5010; globalCtx->nextEntranceIndex = 0x5010;
gSaveContext.unk_3F4A = 0; gSaveContext.nextCutsceneIndex = 0;
globalCtx->sceneLoadFlag = 0x14; globalCtx->sceneLoadFlag = 0x14;
globalCtx->unk_1887F = 3; globalCtx->unk_1887F = 3;
gSaveContext.nextTransition = 3; gSaveContext.nextTransition = 3;

View File

@ -2041,7 +2041,7 @@ void func_80B47108(EnInvadepoh* this, GlobalContext* globalCtx) {
this->actionTimer--; this->actionTimer--;
if (this->actionTimer <= 0) { if (this->actionTimer <= 0) {
globalCtx->nextEntranceIndex = 0x6460; globalCtx->nextEntranceIndex = 0x6460;
gSaveContext.unk_3F4A = 0; gSaveContext.nextCutsceneIndex = 0;
globalCtx->sceneLoadFlag = 0x14; globalCtx->sceneLoadFlag = 0x14;
globalCtx->unk_1887F = 0x49; globalCtx->unk_1887F = 0x49;
gSaveContext.nextTransition = 0x48; gSaveContext.nextTransition = 0x48;
@ -2059,7 +2059,7 @@ void func_80B471C0(EnInvadepoh* this) {
void func_80B471E0(EnInvadepoh* this, GlobalContext* globalCtx) { void func_80B471E0(EnInvadepoh* this, GlobalContext* globalCtx) {
if (D_80B4E998) { if (D_80B4E998) {
globalCtx->nextEntranceIndex = 0x6470; globalCtx->nextEntranceIndex = 0x6470;
gSaveContext.unk_3F4A = 0; gSaveContext.nextCutsceneIndex = 0;
globalCtx->sceneLoadFlag = 0x14; globalCtx->sceneLoadFlag = 0x14;
globalCtx->unk_1887F = 0x48; globalCtx->unk_1887F = 0x48;
gSaveContext.nextTransition = 0x48; gSaveContext.nextTransition = 0x48;
@ -2082,7 +2082,7 @@ void func_80B47278(EnInvadepoh* this) {
void func_80B47298(EnInvadepoh* this, GlobalContext* globalCtx) { void func_80B47298(EnInvadepoh* this, GlobalContext* globalCtx) {
globalCtx->nextEntranceIndex = 0x6400; globalCtx->nextEntranceIndex = 0x6400;
gSaveContext.unk_3F4A = 0xFFF3; gSaveContext.nextCutsceneIndex = 0xFFF3;
globalCtx->sceneLoadFlag = 0x14; globalCtx->sceneLoadFlag = 0x14;
globalCtx->unk_1887F = 0x48; globalCtx->unk_1887F = 0x48;
gSaveContext.nextTransition = 0x48; gSaveContext.nextTransition = 0x48;

View File

@ -685,7 +685,7 @@ void EnMa4_SetupBeginHorsebackGame(EnMa4* this) {
void EnMa4_BeginHorsebackGame(EnMa4* this, GlobalContext* globalCtx) { void EnMa4_BeginHorsebackGame(EnMa4* this, GlobalContext* globalCtx) {
globalCtx->nextEntranceIndex = 0x6400; globalCtx->nextEntranceIndex = 0x6400;
gSaveContext.unk_3F4A = 0xFFF0; gSaveContext.nextCutsceneIndex = 0xFFF0;
globalCtx->sceneLoadFlag = 0x14; globalCtx->sceneLoadFlag = 0x14;
globalCtx->unk_1887F = 0x50; globalCtx->unk_1887F = 0x50;
gSaveContext.nextTransition = 3; gSaveContext.nextTransition = 3;
@ -776,7 +776,7 @@ void EnMa4_HorsebackGameEnd(EnMa4* this, GlobalContext* globalCtx) {
} else if (sFrameCounter == 50) { } else if (sFrameCounter == 50) {
globalCtx->actorCtx.unk268 = 0; globalCtx->actorCtx.unk268 = 0;
globalCtx->nextEntranceIndex = 0x6410; globalCtx->nextEntranceIndex = 0x6410;
gSaveContext.unk_3F4A = 0; gSaveContext.nextCutsceneIndex = 0;
sFrameCounter = 0; sFrameCounter = 0;
globalCtx->sceneLoadFlag = 0x14; globalCtx->sceneLoadFlag = 0x14;
@ -883,7 +883,7 @@ void EnMa4_SetupBeginDescribeThemCs(EnMa4* this) {
void EnMa4_BeginDescribeThemCs(EnMa4* this, GlobalContext* globalCtx) { void EnMa4_BeginDescribeThemCs(EnMa4* this, GlobalContext* globalCtx) {
globalCtx->nextEntranceIndex = 0x6400; globalCtx->nextEntranceIndex = 0x6400;
gSaveContext.unk_3F4A = 0xFFF5; gSaveContext.nextCutsceneIndex = 0xFFF5;
globalCtx->sceneLoadFlag = 0x14; globalCtx->sceneLoadFlag = 0x14;
globalCtx->unk_1887F = 0x40; globalCtx->unk_1887F = 0x40;
gSaveContext.nextTransition = 2; gSaveContext.nextTransition = 2;

View File

@ -1119,7 +1119,7 @@ void EnMaYto_PostMilkRunEnd(EnMaYto* this, GlobalContext* globalCtx) {
// Romani Ranch // Romani Ranch
globalCtx->nextEntranceIndex = 0x6480; globalCtx->nextEntranceIndex = 0x6480;
} }
gSaveContext.unk_3F4A = 0; gSaveContext.nextCutsceneIndex = 0;
globalCtx->sceneLoadFlag = 0x14; globalCtx->sceneLoadFlag = 0x14;
globalCtx->unk_1887F = 0x50; globalCtx->unk_1887F = 0x50;
gSaveContext.nextTransition = 3; gSaveContext.nextTransition = 3;

View File

@ -1,22 +1,247 @@
/* /*
* File: z_daytelop.c * File: z_daytelop.c
* Overlay: ovl_daytelop * Overlay: ovl_daytelop
* Description: * Description: "Dawn of ... day" screen
*/ */
#include "z_daytelop.h" #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); this->transitionCountdown--;
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_daytelop/Daytelop_Main.s") 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);
}

View File

@ -7,14 +7,21 @@ void Daytelop_Init(GameState* thisx);
void Daytelop_Destroy(GameState* thisx); void Daytelop_Destroy(GameState* thisx);
typedef struct { typedef struct {
/* 0x000 */ GameState common; /* 0x000 */ GameState state;
/* 0x0A4 */ UNK_TYPE1 padA4[0xC]; /* 0x0A4 */ void* daytelopStaticFile;
/* 0x0A8 */ void* gameoverStaticFile;
/* 0x0AC */ UNK_TYPE1 unk_AC[0x4];
/* 0x0B0 */ View view; /* 0x0B0 */ View view;
/* 0x218 */ UNK_TYPE1 pad218[0x28]; /* 0x218 */ UNK_TYPE1 unk_218[0x28];
/* 0x240 */ s16 transitionCountdown; /* 0x240 */ s16 transitionCountdown;
/* 0x242 */ s16 unk242; /* 0x242 */ s16 fadeInState;
/* 0x244 */ s16 unk244; /* 0x244 */ s16 alpha;
/* 0x246 */ UNK_TYPE1 pad246[0x2];
} DaytelopContext; // size = 0x248 } DaytelopContext; // size = 0x248
typedef enum {
/* 0 */ DAYTELOP_HOURSTEXT_OFF,
/* 1 */ DAYTELOP_HOURSTEXT_FADEIN,
/* 2 */ DAYTELOP_HOURSTEXT_ON
} Daytelop_FadeState;
#endif #endif

View File

@ -4888,9 +4888,10 @@
0x808147F0:("D_808147F0","f32","",0x4), 0x808147F0:("D_808147F0","f32","",0x4),
0x80814E80:("D_80814E80","UNK_TYPE1","",0x1), 0x80814E80:("D_80814E80","UNK_TYPE1","",0x1),
0x80814E90:("D_80814E90","UNK_TYPE1","",0x1), 0x80814E90:("D_80814E90","UNK_TYPE1","",0x1),
0x80815FF0:("D_80815FF0","u32","[4]",0x10), 0x80815FF0:("D_80815FF0","u8","",0x1),
0x80816000:("D_80816000","u32","[4]",0x10), 0x80815FF4:("sDayLeftTextures","TexturePtr","[4]",0x10),
0x80816010:("D_80816010","u32","[4]",0x10), 0x80816004:("sDayRightTextures","TexturePtr","[4]",0x10),
0x80816014:("sHoursLeftTextures","TexturePtr","[3]",0xC),
0x8082AED0:("D_8082AED0","UNK_TYPE1","",0x1), 0x8082AED0:("D_8082AED0","UNK_TYPE1","",0x1),
0x8082AED8:("D_8082AED8","UNK_TYPE1","",0x1), 0x8082AED8:("D_8082AED8","UNK_TYPE1","",0x1),
0x8082AEE0:("D_8082AEE0","UNK_TYPE2","",0x2), 0x8082AEE0:("D_8082AEE0","UNK_TYPE2","",0x2),

View File

@ -11,6 +11,7 @@ CLOSE_DISPS = "void"
ABS = "int" ABS = "int"
SQ = "int" SQ = "int"
CLAMP = "int" CLAMP = "int"
CLOCK_TIME = "int"
[decompme.compilers] [decompme.compilers]
"tools/ido_recomp/linux/7.1/cc" = "ido7.1" "tools/ido_recomp/linux/7.1/cc" = "ido7.1"