game.c doc

This commit is contained in:
theo3
2022-01-04 18:39:32 -08:00
parent 52db70bb9d
commit 7036ec73af
49 changed files with 563 additions and 488 deletions
+1 -1
View File
@@ -66,7 +66,7 @@ void sub_080ADA04(OAMCommand* cmd, void* dst) {
fn(cmd, dst);
}
void sub_080ADA14(u32 a1, u32 a2) {
void DrawDirect(u32 a1, u32 a2) {
void (*fn)(OAMCommand*, u32, u32) = gUnk_03006580;
fn(&gOamCmd, a1, a2);
}
+3 -3
View File
@@ -94,7 +94,7 @@ u32 SetBottleContents(u32 itemID, u32 bottleIndex) {
return bottleIndex;
}
u32 ItemIsSword(u32 item) {
bool32 ItemIsSword(u32 item) {
switch (item) {
case ITEM_SMITH_SWORD:
case ITEM_GREEN_SWORD:
@@ -107,7 +107,7 @@ u32 ItemIsSword(u32 item) {
}
}
u32 ItemIsShield(u32 id) {
bool32 ItemIsShield(u32 id) {
switch (id) {
case 13:
case 14:
@@ -117,7 +117,7 @@ u32 ItemIsShield(u32 id) {
}
}
u32 ItemIsBottle(u32 id) {
bool32 ItemIsBottle(u32 id) {
switch (id) {
case 28:
case 29:
+2 -2
View File
@@ -148,7 +148,7 @@ void sub_080240B8(Entity* this) {
}
UpdateSpriteForCollisionLayer(this);
if (CheckIsDungeon())
if (AreaIsDungeon())
this->spriteOrientation.flipY = 1;
this->field_0x80.HALF.HI = Random() & 0x40;
@@ -534,7 +534,7 @@ void sub_08024940(Entity* this) {
this->z.HALF.HI += 2;
}
if (this->type2 != 0 || CheckIsDungeon()) {
if (this->type2 != 0 || AreaIsDungeon()) {
if (!sub_08049FA0(this)) {
this->direction = sub_08049EE4(this);
sub_080249F4(this);
+1 -1
View File
@@ -653,7 +653,7 @@ void VaatiRebornEnemyType1PreAction(Entity* this) {
parent->direction = -1;
this->actionDelay = 0;
SoundReq(SONG_STOP_BGM);
gArea.musicIndex = gArea.pMusicIndex;
gArea.bgm = gArea.queued_bgm;
return;
}
this->actionDelay = 1;
+2 -2
View File
@@ -992,8 +992,8 @@ void sub_0804235C(Entity* this) {
void VaatiWrathType0PreAction(Entity* this) {
int temp;
if ((gRoomTransition.field_0x38 & 2) == 0) {
if (gSave.unk48C[3] != 0) {
gSave.unk48C[3]--;
if (gSave.timers[3] != 0) {
gSave.timers[3]--;
} else {
temp = gPlayerState.framestate_last;
if (temp < 2) {
+1 -1
View File
@@ -458,7 +458,7 @@ void sub_0805E98C(void) {
}
}
void QueueEntityDeletion(void) {
void RecycleEntities(void) {
Entity* i;
LinkedList* list;
+8 -8
View File
@@ -481,36 +481,36 @@ void sub_08050A64(u32 idx) {
gOamCmd.x = 0xA2;
gOamCmd.y = 0x36;
#ifdef EU
sub_080ADA14(0x144, 0x24);
DrawDirect(0x144, 0x24);
#else
sub_080ADA14(0x145, 0x24);
DrawDirect(0x145, 0x24);
#endif
}
if (GetInventoryValue(0x41)) {
gOamCmd.x = 0x96;
gOamCmd.y = 0x3D;
#ifdef EU
sub_080ADA14(0x144, 0x22);
DrawDirect(0x144, 0x22);
#else
sub_080ADA14(0x145, 0x22);
DrawDirect(0x145, 0x22);
#endif
}
if (GetInventoryValue(0x42)) {
gOamCmd.x = 0xAE;
gOamCmd.y = 0x3D;
#ifdef EU
sub_080ADA14(0x144, 0x23);
DrawDirect(0x144, 0x23);
#else
sub_080ADA14(0x145, 0x23);
DrawDirect(0x145, 0x23);
#endif
}
if (GetInventoryValue(0x43)) {
gOamCmd.x = 0xA2;
gOamCmd.y = 0x44;
#ifdef EU
sub_080ADA14(0x144, 0x21);
DrawDirect(0x144, 0x21);
#else
sub_080ADA14(0x145, 0x21);
DrawDirect(0x145, 0x21);
#endif
}
}
+224 -148
View File
@@ -17,12 +17,52 @@
#include "game.h"
#include "item.h"
// Game task
typedef void(GameState)(void);
typedef void(GameMainState)(void);
static GameState GameTask_Transition;
static GameState GameTask_Init;
static GameState GameTask_Exit;
static GameState GameTask_Main;
static GameMainState GameMain_InitRoom;
static GameMainState GameMain_ChangeRoom;
static GameMainState GameMain_Update;
static GameMainState GameMain_ChangeArea;
GameMainState GameMain_MinishPortal;
static GameMainState GameMain_BarrelUpdate;
/*static GameMainState 00000000;*/
GameMainState GameMain_Subtask;
// Cutscene subtask
typedef void(AuxCutsceneState)(void);
typedef void(CutsceneMainState)(void);
static AuxCutsceneState AuxCutscene_Init;
static AuxCutsceneState AuxCutscene_Main;
static AuxCutsceneState AuxCutscene_Exit;
CutsceneMainState CutsceneMain_Init;
CutsceneMainState CutsceneMain_Update;
CutsceneMainState CutsceneMain_Exit;
// Game Over task
typedef void(GameOverState)(void);
static GameOverState GameOver_Init;
static GameOverState GameOver_FadeIn;
static GameOverState GameOver_TextMove;
static GameOverState GameOver_Update;
static GameOverState GameOver_Exit;
extern u8 gUpdateVisibleTiles;
extern u8 gUnk_080FCA84[];
extern u8 gUnk_080FCAC8[];
extern u16 gUnk_020178E0[];
extern u8 gUnk_02024090[];
extern u16 gUnk_080FCAD6[];
extern void** gAreaTilesets[];
extern void** gAreaRoomMaps[];
@@ -31,15 +71,6 @@ extern void* gUnk_080B755C[];
extern void** gExitLists[];
extern void** gAreaTable[];
extern u8 gUnk_080FCAF8[];
extern u16 gUnk_020178E0[];
extern void (*gUnk_080FC9D8[])();
extern void (*gUnk_080FC9E8[])();
extern void (*gUnk_080FCA08[])();
extern void (*gUnk_080FCA14[])();
extern void (*gUnk_080FCA70[])(void);
void FinalizeSave(void);
void ClearArmosData(void);
void ClearRoomMemory(void);
@@ -55,19 +86,16 @@ void UpdateDoorTransition(void);
u32 IsEnterPortal(void);
void UpdateCarriedObject(void);
void DrawUI();
u32 CheckPlayerActivity();
u32 CheckPlayerInactive();
void CollisionMain();
void sub_0805BB74();
void CreateZeldaFollower(void);
void LoadRoomGfx();
void QueueEntityDeletion();
void RecycleEntities();
void sub_0804AF90();
void CallRoomProp6();
void LoadRoomBgm();
void UpdateScroll();
void UpdateBgAnim();
void sub_08052010();
void sub_080520C4();
void CleanUpGFXSlots();
void sub_080ADE24();
void InitUI(u32);
@@ -85,6 +113,8 @@ void sub_0807C740(void);
void SetBGDefaults(void);
void LoadItemGfx(void);
static void LoadRoomBgm();
static void sub_08052010(void);
static void ResetTmpFlags(void);
static void InitializeEntities(void);
static void CheckAreaDiscovery(void);
@@ -97,11 +127,10 @@ static void sub_0805340C(void);
static void sub_08051D98(void);
static void sub_08051DCC(void);
static u32 CheckGameOver(void);
static u32 HandleRoomExit(void);
static void sub_080531F8(void);
static u32 CheckRoomExit(void);
static void UpdatePlayerRoomStatus(void);
static void sub_0805329C(void);
static void InitializePlayer(void);
/* static */ void sub_08051F04(void);
/* static */ void sub_08051F9C(u32 a1, u32 a2, u32 a3, u32 a4);
static void DrawGameOverText(void);
static u32 StairsAreValid();
@@ -124,16 +153,6 @@ typedef struct {
} struct_08127F94;
extern struct_08127F94 gUnk_08127F94[];
typedef struct {
u8 _0;
u8 _1;
u8 _2;
u8 _3;
u16 _4;
u16 _6;
} struct_080FCA20;
extern struct_080FCA20 gUnk_080FCA20[];
typedef struct {
u16* dest;
void* gfx_dest;
@@ -161,9 +180,26 @@ typedef struct {
extern void CreateDialogBox();
typedef struct {
u8 area;
u8 room;
u8 _2;
u8 _3;
u16 x;
u16 y;
} CutsceneData;
static const CutsceneData sCutsceneData[];
void GameTask(void) {
static GameState* const sStates[] = {
GameTask_Transition,
GameTask_Init,
GameTask_Main,
GameTask_Exit,
};
gRoomTransition.frameCount++;
gUnk_080FC9D8[gMain.state]();
sStates[gMain.state]();
#ifdef DEMO_USA
if (gSave.demo_timer != 0) {
if (--gSave.demo_timer == 0) {
@@ -174,7 +210,7 @@ void GameTask(void) {
#endif
}
void GameTask_Transition(void) {
static void GameTask_Transition(void) {
// wait for file select to fade out
if (gFadeControl.active)
return;
@@ -190,7 +226,7 @@ void GameTask_Transition(void) {
FinalizeSave();
// spawn in with saved status
MemCopy(&gSave.saved_status, &gRoomTransition.player_status, sizeof (gRoomTransition.player_status));
MemCopy(&gSave.saved_status, &gRoomTransition.player_status, sizeof(gRoomTransition.player_status));
gRoomTransition.type = TRANSITION_FADE_BLACK_SLOW;
ResetTmpFlags();
@@ -198,7 +234,7 @@ void GameTask_Transition(void) {
gMain.substate = 0;
}
void GameTask_Init(void) {
static void GameTask_Init(void) {
DispReset(1);
gFadeControl.mask = 0xffffffff;
MemClear(&gOAMControls, 0xB74);
@@ -216,13 +252,23 @@ void GameTask_Init(void) {
gMain.state = GAMETASK_MAIN;
}
void GameTask_Main(void) {
gUnk_080FC9E8[gMain.substate]();
static void GameTask_Main(void) {
static GameMainState* const sStates[] = {
GameMain_InitRoom,
GameMain_ChangeRoom,
GameMain_Update,
GameMain_ChangeArea,
GameMain_MinishPortal,
GameMain_BarrelUpdate,
0,
GameMain_Subtask,
};
sStates[gMain.substate]();
}
void GameMain_InitRoom(void) {
static void GameMain_InitRoom(void) {
SetInitializationPriority();
gScreen.lcd.displayControl = 0x1740;
gScreen.lcd.displayControl = DISPCNT_BG0_ON | DISPCNT_BG1_ON | DISPCNT_BG2_ON | DISPCNT_OBJ_ON | DISPCNT_OBJ_1D_MAP;
gMain.substate = GAMEMAIN_CHANGEROOM;
gRoomTransition.transitioningOut = 0;
gRoomTransition.field_0x4[0] = 0;
@@ -236,7 +282,7 @@ void GameMain_InitRoom(void) {
#endif
}
void GameMain_ChangeRoom(void) {
static void GameMain_ChangeRoom(void) {
UpdateEntities();
if (!UpdateLightLevel())
UpdateScroll();
@@ -254,9 +300,9 @@ void GameMain_ChangeRoom(void) {
return;
UpdateFakeScroll();
if (gArea.musicIndex != gArea.pMusicIndex) {
gArea.musicIndex = gArea.pMusicIndex;
SoundReq(gArea.pMusicIndex | SONG_PLAY_VOL_RESET);
if (gArea.bgm != gArea.queued_bgm) {
gArea.bgm = gArea.queued_bgm;
SoundReq(gArea.queued_bgm | SONG_PLAY_VOL_RESET);
}
DeleteSleepingEntities();
@@ -298,13 +344,13 @@ void GameMain_ChangeRoom(void) {
}
}
void GameMain_Update(void) {
if (CheckPlayerActivity() || IsEnterPortal()) {
static void GameMain_Update(void) {
if (CheckPlayerInactive() || IsEnterPortal()) {
return;
}
sub_0805340C();
// leave early if player is entering a portal
// leave early if player is now entering a portal
if (gMain.substate != GAMEMAIN_UPDATE) {
return;
}
@@ -325,7 +371,7 @@ void GameMain_Update(void) {
DrawOAMCmd();
UpdateCarriedObject();
DrawEntities();
HandleRoomExit();
CheckRoomExit();
UpdatePlayerMapCoords();
CheckGameOver();
sub_080185F8();
@@ -346,8 +392,8 @@ void GameMain_Update(void) {
}
}
void GameMain_BarrelUpdate(void) {
if (CheckPlayerActivity())
static void GameMain_BarrelUpdate(void) {
if (CheckPlayerInactive())
return;
UpdateEntities();
@@ -358,14 +404,14 @@ void GameMain_BarrelUpdate(void) {
DrawOAMCmd();
UpdateCarriedObject();
DrawEntities();
HandleRoomExit();
CheckRoomExit();
CheckGameOver();
CopyOAM();
if (!gFadeControl.active)
ResetSystemPriority();
}
void GameMain_ChangeArea(void) {
static void GameMain_ChangeArea(void) {
FlushSprites();
DrawOAMCmd();
DrawEntities();
@@ -379,7 +425,7 @@ void GameMain_ChangeArea(void) {
}
}
void sub_08051D2C(void) {
static void GameTask_Exit(void) {
#ifdef DEMO_USA
if (!gFadeControl.active)
DoSoftReset();
@@ -405,15 +451,15 @@ static void InitializeEntities(void) {
sub_0805329C();
UpdateScrollVram();
sub_0805BB74(0xffffffff);
sub_080531F8();
UpdatePlayerRoomStatus();
}
void sub_08051D98(void) {
static void sub_08051D98(void) {
sub_08052EA0();
gRoomVars.field_0x0 = 1;
// remove old entities, unless persistent
QueueEntityDeletion();
RecycleEntities();
sub_0804AF90();
CallRoomProp6();
@@ -424,21 +470,21 @@ void sub_08051D98(void) {
SetPlayerControl(1);
}
void sub_08051DCC(void) {
static void sub_08051DCC(void) {
gRoomControls.area = gRoomTransition.player_status.area_next;
gRoomControls.room = gRoomTransition.player_status.room_next;
RoomExitCallback();
gRoomTransition.type = TRANSITION_3;
InitRoom();
sub_08052EA0();
QueueEntityDeletion();
RecycleEntities();
sub_0804AF90();
CallRoomProp6();
LoadRoomBgm();
}
void UpdateWindcrests() {
if (CheckIsOverworld()) {
static void UpdateWindcrests(void) {
if (AreaIsOverworld()) {
struct_08127F94* i;
u32 hi_x, hi_y;
s32 x, y;
@@ -462,31 +508,43 @@ void UpdateWindcrests() {
}
}
void Subtask_ChuchuCutscene() {
gUnk_080FCA08[gMenu.menuType]();
void Subtask_AuxCutscene(void) {
static AuxCutsceneState* const sStates[] = {
AuxCutscene_Init,
AuxCutscene_Main,
AuxCutscene_Exit,
};
sStates[gMenu.menuType]();
}
void sub_08051E84() {
struct_080FCA20* p = &gUnk_080FCA20[gUnk_02032EC0.field_0x3];
gRoomControls.area = p->_0;
gRoomControls.room = p->_1;
static void AuxCutscene_Init(void) {
const CutsceneData* p = &sCutsceneData[gUnk_02032EC0.field_0x3];
gRoomControls.area = p->area;
gRoomControls.room = p->room;
LoadGfxGroups();
gArea.localFlagOffset = GetFlagBankOffset(gRoomControls.area);
SetCurrentRoomPropertyList(p->_0, p->_1);
sub_08052FD8(p->_0, p->_1);
gRoomControls.scroll_x = gRoomControls.origin_x + p->_4;
gRoomControls.scroll_y = gRoomControls.origin_y + p->_6;
SetCurrentRoomPropertyList(p->area, p->room);
LoadCutsceneRoom(p->area, p->room);
gRoomControls.scroll_x = gRoomControls.origin_x + p->x;
gRoomControls.scroll_y = gRoomControls.origin_y + p->y;
gMenu.field_0x0 = p->_2;
gMenu.field_0x3 = p->_3 & 0xf;
gMenu.field_0xc = (void*)p;
gMenu.menuType++;
gMenu.overlayType = 0;
gMenu.transitionTimer = 300;
sub_08051F04();
AuxCutscene_Main(); // init
}
void sub_08051F04(void) {
gUnk_080FCA14[gMenu.field_0x0]();
static void AuxCutscene_Main(void) {
static CutsceneMainState* const sStates[] = {
CutsceneMain_Init,
CutsceneMain_Update,
CutsceneMain_Exit,
};
sStates[gMenu.field_0x0]();
FlushSprites();
UpdateEntities();
DrawEntities();
@@ -497,8 +555,21 @@ void sub_08051F04(void) {
UpdateScrollVram();
}
void sub_08051F40(u32 a1, u32 a2, u32 a3, u32 a4) {
u32 flag = gUnk_080FCA20[gUnk_02032EC0.field_0x3]._3;
static const CutsceneData sCutsceneData[] = {
{ AREA_MINISH_WOODS, 0, 0, 0, 336, 528 },
{ AREA_HYRULE_FIELD, 1, 1, 0, 472, 312 },
{ AREA_HYRULE_CASTLE, 2, 1, 1, 16, 16 },
{ AREA_SANCTUARY, 2, 1, 2, 0, 0 },
{ AREA_EZLO_CUTSCENE, 0, 1, 3, 0, 0 },
{ AREA_HOUSE_INTERIORS_2, 16, 1, 4, 0, 0 },
{ AREA_DARK_HYRULE_CASTLE_OUTSIDE, 0, 1, 5, 0, 40 },
{ AREA_FORTRESS_OF_WINDS, 28, 2, 0, 0, 0 },
{ AREA_FORTRESS_OF_WINDS, 29, 2, 1, 0, 0 },
{ AREA_DARK_HYRULE_CASTLE, 14, 2, 2, 16, 16 },
};
static void AuxCutscene_Exit(void) {
u32 flag = sCutsceneData[gUnk_02032EC0.field_0x3]._3;
if (flag & 0xF0) {
MenuFadeIn(2, flag >> 4);
} else {
@@ -510,12 +581,12 @@ void sub_08051F40(u32 a1, u32 a2, u32 a3, u32 a4) {
void sub_08051F78(u32 a1, u32 a2, u32 a3, u32 a4) {
u32 idx = gUnk_02032EC0.field_0x3;
struct_080FCA20* p = &gUnk_080FCA20[idx];
sub_08051F9C(p->_0, p->_1, p->_4, p->_6);
const CutsceneData* p = &sCutsceneData[idx];
sub_08051F9C(p->area, p->room, p->x, p->y);
}
void sub_08051F9C(u32 a1, u32 a2, u32 a3, u32 a4) {
u32 tmp = gScreen.lcd.displayControl & 0x6000;
u32 tmp = gScreen.lcd.displayControl & (DISPCNT_WIN0_ON | DISPCNT_WIN1_ON);
sub_08052FF4(a1, a2);
gRoomControls.scroll_x = gRoomControls.origin_x + a3;
gRoomControls.scroll_y = gRoomControls.origin_y + a4;
@@ -525,15 +596,15 @@ void sub_08051F9C(u32 a1, u32 a2, u32 a3, u32 a4) {
gScreen.lcd.displayControl |= tmp;
}
void sub_08051FF0() {
void sub_08051FF0(void) {
sub_0804B0B0(gMenu.field_0xc[0], gMenu.field_0xc[1]);
}
void sub_08052004() {
void sub_08052004(void) {
gMenu.menuType = 2;
}
void sub_08052010() {
static void sub_08052010(void) {
InitSoundPlayingInfo();
MessageInitialize();
DispReset(1);
@@ -545,15 +616,19 @@ void sub_08052010() {
LoadGfxGroup(4);
MemClear((void*)0x06000000, 0x20);
MemClear(&gMenu, 0x30);
gScreen.lcd.displayControl |= 0x1000;
gScreen.bg1.control = 0x1C01;
gScreen.bg2.control = 0x1D05;
gScreen.lcd.displayControl |= DISPCNT_OBJ_ON;
gScreen.bg1.control = BGCNT_PRIORITY(1) | BGCNT_SCREENBASE(28) | BGCNT_CHARBASE(0);
gScreen.bg2.control = BGCNT_PRIORITY(1) | BGCNT_SCREENBASE(29) | BGCNT_CHARBASE(1);
gScreen.bg1.updated = 1;
gScreen.bg2.updated = 1;
}
void GameOverTask() {
gUnk_080FCA70[gMain.state]();
void GameOverTask(void) {
static GameOverState* const sStates[] = {
GameOver_Init, GameOver_FadeIn, GameOver_TextMove, GameOver_Update, GameOver_Exit,
};
sStates[gMain.state]();
if (gMain.state != 0) {
FlushSprites();
DrawGameOverText();
@@ -561,12 +636,12 @@ void GameOverTask() {
}
}
void sub_080520C4(u32 idx) {
static void switch_state(u32 idx) {
gMain.state = idx;
sub_080A7114(0);
}
void sub_080520D8(void) {
static void GameOver_Init(void) {
if (gFadeControl.active)
return;
sub_08052010();
@@ -577,10 +652,10 @@ void sub_080520D8(void) {
SoundReq(BGM_GAMEOVER);
sub_080500F4(4);
gFadeControl.mask = 0xFFFF0001;
sub_080520C4(1);
switch_state(1);
}
void sub_0805212C(void) {
static void GameOver_FadeIn(void) {
if (gFadeControl.active)
return;
@@ -590,7 +665,7 @@ void sub_0805212C(void) {
} else {
gMenu.transitionTimer--;
if (gMenu.transitionTimer == 0) {
sub_080520C4(2);
switch_state(2);
#if defined(DEMO_USA) || defined(DEMO_JP)
SoundReq(SONG_VOL_FADE_OUT);
DoFade(7, 4);
@@ -607,14 +682,13 @@ void sub_0805212C(void) {
}
}
static void GameOver_TextMove(void) {
#if defined(DEMO_USA) || defined(DEMO_JP)
void sub_080521A0(void) {
if (gFadeControl.active == 0) {
DoSoftReset();
}
}
#else
void sub_080521A0(void) {
s32 temp3;
u32 temp2;
@@ -685,13 +759,13 @@ void sub_080521A0(void) {
default:
gScreen.lcd.displayControl &= ~DISPCNT_BG1_ON;
sub_08050384();
sub_080520C4(3);
switch_state(3);
return;
}
}
#endif
void sub_080522F4(void) {
static void GameOver_Update(void) {
switch (gMenu.menuType) {
case 0x0:
gMenu.transitionTimer = 0x1e;
@@ -743,7 +817,9 @@ void sub_080522F4(void) {
}
}
void nullsub_107(void) {
// Unused, since task is set above
// if we got here, it would be a softlock
static void GameOver_Exit(void) {
}
static void DrawGameOverText(void) {
@@ -760,9 +836,9 @@ static void DrawGameOverText(void) {
for (i = 0; i < 8; ++i) {
gOamCmd.x = sOffsets[i];
#ifdef EU
sub_080ADA14(0x1fc, i);
DrawDirect(0x1fc, i);
#else
sub_080ADA14(0x1fd, i);
DrawDirect(0x1fd, i);
#endif
}
}
@@ -810,7 +886,7 @@ void SetPopupState(u32 type, u32 choice_idx) {
gScreen.bg1.updated = fakematch;
}
void InitializePlayer(void) {
static void InitializePlayer(void) {
static const u8 sPlayerSpawnStates[] = {
[PL_SPAWN_DEFAULT] = PLAYER_INIT,
[PL_SPAWN_MINISH] = PLAYER_MINISH,
@@ -881,7 +957,7 @@ void InitializePlayer(void) {
RegisterPlayerHitbox();
}
bool32 CheckIsOverworld(void) {
bool32 AreaIsOverworld(void) {
#ifdef EU
return gArea.areaMetadata == 0x01;
#else
@@ -889,33 +965,33 @@ bool32 CheckIsOverworld(void) {
#endif
}
bool32 sub_08052638(u32 r0) {
bool32 CheckAreaOverworld(u32 area) {
#if EU
return gAreaMetadata[r0].flags == 0x01;
return gAreaMetadata[area].flags == 0x01;
#else
return gAreaMetadata[r0].flags == 0x81;
return gAreaMetadata[area].flags == 0x81;
#endif
}
#ifndef EU
u32 sub_08052654(void) {
bool32 AreaAllowsWarp(void) {
return (gArea.areaMetadata >> 7) & 1;
}
#endif
u32 CheckIsDungeon(void) {
bool32 AreaIsDungeon(void) {
return (gArea.areaMetadata >> 2) & 1;
}
u32 CheckIsInteriorWithEnemies(void) {
bool32 AreaHasEnemies(void) {
return (gArea.areaMetadata >> 4) & 1;
}
u32 CheckIsInteriorNoEnemies(void) {
bool32 AreaHasNoEnemies(void) {
return (gArea.areaMetadata >> 6) & 1;
}
u32 CheckHasMap(void) {
bool32 AreaHasMap(void) {
return (gArea.areaMetadata >> 3) & 1;
}
@@ -951,7 +1027,7 @@ void ModRupees(s32 delta) {
}
void sub_080526F8(s32 a1) {
if (sub_08052724()) {
if (AreaHasKeys()) {
u8* p = &gSave.unk45C[gArea.dungeon_idx];
if (*p + a1 < 0)
*p = 0;
@@ -960,41 +1036,41 @@ void sub_080526F8(s32 a1) {
}
}
u32 sub_08052724(void) {
bool32 AreaHasKeys(void) {
return (gArea.areaMetadata >> 1) & 1;
}
u32 HasDungeonMap(void) {
bool32 HasDungeonMap(void) {
u32 tmp;
if (sub_08052724())
if (AreaHasKeys())
tmp = gSave.unk45C[gArea.dungeon_idx];
return tmp ? 1 : 0;
}
u32 HasDungeonCompass(void) {
bool32 HasDungeonCompass(void) {
u32 tmp;
if (sub_08052724())
if (AreaHasKeys())
tmp = gSave.unk46C[gArea.dungeon_idx] & 4;
return tmp ? 1 : 0;
}
u32 HasDungeonBigKey(void) {
if (!sub_08052724())
bool32 HasDungeonBigKey(void) {
if (!AreaHasKeys())
return 0;
return (gSave.unk46C[gArea.dungeon_idx] >> 1) & 1;
}
u32 HasDungeonSmallKey(void) {
bool32 HasDungeonSmallKey(void) {
u32 tmp;
if (!sub_08052724())
if (!AreaHasKeys())
return 0;
return gSave.unk46C[gArea.dungeon_idx] & 1;
}
void sub_080527FC(u32 a1, u32 a2) {
void RestoreGameTask(u32 a1) {
LoadGfxGroups();
#ifndef EU
CleanUpGFXSlots();
@@ -1003,28 +1079,28 @@ void sub_080527FC(u32 a1, u32 a2) {
InitUI(1);
sub_0801AE44(a1);
MemCopy(gUnk_02024090, gPaletteBuffer, 1024);
gUsedPalettes = -1;
gUsedPalettes = 0xffffffff;
}
void LoadRoomBgm(void) {
gArea.pMusicIndex = gAreaMetadata[gRoomControls.area]._3;
static void LoadRoomBgm(void) {
gArea.queued_bgm = gAreaMetadata[gRoomControls.area]._3;
if (CheckLocalFlagByBank(FLAG_BANK_10, LV6_KANE_START)) {
gArea.pMusicIndex = BGM_FIGHT_THEME2;
gArea.queued_bgm = BGM_FIGHT_THEME2;
}
}
#ifndef EU
void sub_08052878(void) {
gArea.musicIndex = gArea.pMusicIndex;
gArea.bgm = gArea.queued_bgm;
SoundReq(SONG_STOP_ALL);
}
static void sub_0805289C(void) {
gArea.pMusicIndex = gArea.musicIndex;
gArea.queued_bgm = gArea.bgm;
}
#endif
u32 CheckGameOver(void) {
static u32 CheckGameOver(void) {
if (gRoomTransition.field_0x4[1]) {
InitFade();
gMain.state = 3;
@@ -1041,7 +1117,7 @@ void RoomExitCallback(void) {
gArea.onExit(gArea.transitionManager);
}
u32 HandleRoomExit(void) {
static u32 CheckRoomExit(void) {
if (gRoomTransition.transitioningOut && gSave.stats.health != 0 && gPlayerState.framestate != PL_STATE_DIE) {
if (StairsAreValid()) {
gRoomTransition.transitioningOut = 0;
@@ -1147,7 +1223,7 @@ static void InitRoomTransition(void) {
}
}
u32 sub_08052B24(void) {
bool32 CanDispEzloMessage(void) {
s32 tmp = PL_STATE_WALK;
if (!(gInput.heldKeys & SELECT_BUTTON) || gPlayerState.controlMode != CONTROL_ENABLED || gUnk_02034490[0] ||
@@ -1185,7 +1261,7 @@ void DisplayEzloMessage(void) {
}
#if defined(USA) || defined(DEMO_USA) || defined(DEMO_JP)
void CreateManagerF(void) {
static void CreateManagerF(void) {
Entity* e = NULL;
if (gRoomTransition.player_status.field_0x24[13])
@@ -1204,7 +1280,7 @@ void CreateManagerF(void) {
}
#endif
void sub_08052C3C(void) {
static void sub_08052C3C(void) {
if (gArea.field_0x18 == 0)
gArea.unk1A = gArea.field_0x18;
if (gArea.unk1A) {
@@ -1213,25 +1289,25 @@ void sub_08052C3C(void) {
}
}
void UpdatePlayerMapCoords(void) {
if (!CheckIsInteriorNoEnemies()) {
if (CheckIsOverworld()) {
static void UpdatePlayerMapCoords(void) {
if (!AreaHasNoEnemies()) {
if (AreaIsOverworld()) {
gRoomTransition.player_status.overworld_map_x = gPlayerEntity.x.HALF_U.HI;
gRoomTransition.player_status.overworld_map_y = gPlayerEntity.y.HALF_U.HI;
} else if (CheckIsDungeon()) {
} else if (AreaIsDungeon()) {
gRoomTransition.player_status.dungeon_map_x = gPlayerEntity.x.HALF.HI;
gRoomTransition.player_status.dungeon_map_y = gPlayerEntity.y.HALF.HI;
}
}
}
void sub_08052CA4(u32 area, u32 room, u32 x, u32 y) {
void SetWorldMapPos(u32 area, u32 room, u32 x, u32 y) {
RoomHeader* hdr = gAreaRoomHeaders[area] + room;
gRoomTransition.player_status.overworld_map_x = hdr->map_x + x;
gRoomTransition.player_status.overworld_map_y = hdr->map_y + y;
}
void sub_08052CD0(u32 area, u32 room, u32 x, u32 y) {
void SetDungeonMapPos(u32 area, u32 room, u32 x, u32 y) {
RoomHeader* hdr = gAreaRoomHeaders[area] + room;
gRoomTransition.player_status.dungeon_map_x = hdr->map_x + x;
gRoomTransition.player_status.dungeon_map_y = hdr->map_y + y;
@@ -1324,7 +1400,7 @@ static u32 sub_08052EF4(s32 idx) {
* @brief If enabled, this type of transition does not change the room
* and keeps all entities.
*/
void UpdateFakeScroll(void) {
static void UpdateFakeScroll(void) {
u32 x, y;
LinkedList* ll;
Entity* e;
@@ -1365,7 +1441,7 @@ void UpdateFakeScroll(void) {
} while (++ll < gEntityLists + 9);
}
void sub_08052FD8(u32 area, u32 room) {
void LoadCutsceneRoom(u32 area, u32 room) {
sub_08052FF4(area, room);
gRoomControls.camera_target = NULL;
sub_0807C860();
@@ -1440,7 +1516,7 @@ static u32 sub_08053144(void) {
return ret;
}
void CheckAreaDiscovery(void) {
static void CheckAreaDiscovery(void) {
if (!sub_08053144())
return;
@@ -1465,12 +1541,12 @@ void CheckAreaDiscovery(void) {
WriteBit(gSave.areaVisitFlags, gArea.locationIndex);
}
void sub_080531F8(void) {
static void UpdatePlayerRoomStatus(void) {
gPlayerState.startPosX = gPlayerEntity.x.HALF.HI;
gPlayerState.startPosY = gPlayerEntity.y.HALF.HI;
if (sub_08053144()) {
MemCopy(&gRoomTransition.player_status, &gSave.saved_status, sizeof gRoomTransition.player_status);
if (CheckIsDungeon()) {
if (AreaIsDungeon()) {
gRoomTransition.player_status.dungeon_area = gRoomControls.area;
gRoomTransition.player_status.dungeon_room = gRoomControls.room;
gRoomTransition.player_status.dungeon_x = gPlayerEntity.x.HALF.HI;
@@ -1490,7 +1566,7 @@ void sub_08053250(void) {
MemCopy(&gRoomTransition.player_status, &gSave.saved_status, sizeof gRoomTransition.player_status);
}
void sub_0805329C(void) {
static void sub_0805329C(void) {
if (sub_08053144()) {
switch (gRoomControls.area) {
case AREA_DEEPWOOD_SHRINE:
@@ -1556,7 +1632,7 @@ void sub_080533CC(void) {
gUsedPalettes |= 8;
}
void sub_0805340C(void) {
static void sub_0805340C(void) {
static void (*const sHandlers[])(u32*) = {
sub_08053434, DummyHandler, sub_080534E4, DummyHandler, DummyHandler, DummyHandler, DummyHandler, DummyHandler,
};
@@ -1564,7 +1640,7 @@ void sub_0805340C(void) {
u32* p;
u32 i;
p = gSave.unk48C;
p = gSave.timers;
for (i = 0; i < 8; i++, p++) {
(sHandlers[i])(p);
}
@@ -1590,20 +1666,20 @@ static void sub_08053460(void) {
FLAG_BANK_10, LV6_KANE_2ND, FLAG_BANK_10, LV6_SOTO_ENDING,
0xFFFF };
gSave.unk48C[0] = 0;
gSave.timers[0] = 0;
if (CheckLocalFlagByBank(FLAG_BANK_10, LV6_ZELDA_DISCURSE))
ClearGlobalFlag(ZELDA_CHASE);
ClearFlagArray(sClearFlags);
}
void sub_08053494(void) {
gSave.unk48C[0] = 10800;
gSave.timers[0] = 10800;
}
void sub_080534AC(void) {
if (CheckLocalFlagByBank(FLAG_BANK_10, LV6_KANE_START)) {
ClearLocalFlagByBank(FLAG_BANK_10, LV6_KANE_START);
gSave.unk48C[0] = 0;
gSave.timers[0] = 0;
SoundReq(SONG_STOP_BGM);
}
}
@@ -1615,11 +1691,11 @@ static void sub_080534E4(u32* a1) {
}
}
void sub_08053500(void) {
gSave.unk48C[2] = 36000;
void InitBiggoronTimer(void) {
gSave.timers[2] = 36000;
}
void ResetTmpFlags(void) {
static void ResetTmpFlags(void) {
static const u16 sClearFlags[] = { FLAG_BANK_2, BILL00_SHICHOU_00, FLAG_BANK_2, BILL0A_YADO_TAKARA_00,
FLAG_BANK_2, BILL0C_SCHOOLR_00, FLAG_BANK_1, MACHI00_00,
FLAG_BANK_1, MACHI00_02, FLAG_BANK_2, MHOUSE06_00,
+7 -7
View File
@@ -60,21 +60,21 @@ void sub_080595E4(Manager10* this) {
void sub_08059608(Manager10* this) {
if (this->unk_23) {
if (!--this->unk_23) {
gArea.musicIndex = gArea.pMusicIndex;
SoundReq(gArea.musicIndex);
gArea.bgm = gArea.queued_bgm;
SoundReq(gArea.bgm);
}
return;
}
if (sub_0805986C()) {
if (gArea.pMusicIndex != 0x1E) {
gArea.pMusicIndex = 0x1E;
if (gArea.queued_bgm != 0x1E) {
gArea.queued_bgm = 0x1E;
this->unk_23 = 0x78;
SoundReq(0x800d0000);
}
return;
}
if (gArea.pMusicIndex != 0x37) {
gArea.pMusicIndex = 0x37;
if (gArea.queued_bgm != 0x37) {
gArea.queued_bgm = 0x37;
this->unk_23 = 0x78;
SoundReq(0x800d0000);
}
@@ -210,6 +210,6 @@ void sub_08059960(const u16* unk1, const u16* unk2, u16* unk3, u8 unk4) {
void sub_08059994() {
if (sub_0805986C()) {
LoadPaletteGroup(0x5B);
gArea.pMusicIndex = 0x1E;
gArea.queued_bgm = 0x1E;
}
}
+15 -15
View File
@@ -89,7 +89,7 @@ void sub_0805C050(u32 pos, u32 layer) {
SetTileType(0xb4, pos - 1, layer);
SetTileType(0xb7, pos + 1, layer);
if (layer == 1) {
if (CheckIsInteriorWithEnemies() != 0) {
if (AreaHasEnemies() != 0) {
Entity* object = CreateObject(ARCHWAY, 0xe, 0);
if (object != NULL) {
object->x.HALF.HI = ((pos & 0x3f) << 4) + 8 + gRoomControls.origin_x;
@@ -97,7 +97,7 @@ void sub_0805C050(u32 pos, u32 layer) {
}
SetTileType(0xb5, pos, 1);
} else {
if (CheckIsDungeon() != 0) {
if (AreaIsDungeon() != 0) {
SetTileType(0xb5, pos, 1);
} else {
SetTileType(0xb6, pos, 1);
@@ -110,7 +110,7 @@ void sub_0805C050(u32 pos, u32 layer) {
} else {
Entity* object;
SetTileType(0xb5, pos, 2);
if (CheckIsDungeon() == 0) {
if (AreaIsDungeon() == 0) {
return;
}
object = CreateObject(ARCHWAY, sub_0805C608(), 6);
@@ -133,7 +133,7 @@ void sub_0805C178(u32 pos, u32 layer) {
SetTileType(0xf7, pos + 0x41, layer);
if (layer == 1) {
if (CheckIsInteriorWithEnemies() != 0) {
if (AreaHasEnemies() != 0) {
object = CreateObject(ARCHWAY, 0xe, 1);
if (object != NULL) {
@@ -142,7 +142,7 @@ void sub_0805C178(u32 pos, u32 layer) {
}
SetTileType(0xf2, pos, 1);
} else {
if (CheckIsDungeon() != 0) {
if (AreaIsDungeon() != 0) {
SetTileType(0xf2, pos, 1);
} else {
SetTileType(0xf3, pos, 1);
@@ -153,7 +153,7 @@ void sub_0805C178(u32 pos, u32 layer) {
SetTileType(0xfa, pos + 0x41, 2);
} else {
SetTileType(0xf2, pos, 2);
if (CheckIsDungeon() == 0) {
if (AreaIsDungeon() == 0) {
return;
}
object = CreateObject(ARCHWAY, sub_0805C608(), 7);
@@ -175,7 +175,7 @@ void sub_0805C294(u32 pos, u32 layer) {
SetTileType(0xd6, pos + 0x40, layer);
SetTileType(0xd7, pos + 0x41, layer);
if (layer == 1) {
if (CheckIsInteriorWithEnemies() != 0) {
if (AreaHasEnemies() != 0) {
object = CreateObject(ARCHWAY, 0xe, 2);
if (object != NULL) {
object->x.HALF.HI = ((pos & 0x3f) << 4) + 8 + gRoomControls.origin_x;
@@ -183,7 +183,7 @@ void sub_0805C294(u32 pos, u32 layer) {
}
SetTileType(0xd2, pos, 1);
} else {
if (CheckIsDungeon() != 0) {
if (AreaIsDungeon() != 0) {
SetTileType(0xd2, pos, 1);
} else {
SetTileType(0xd3, pos, 1);
@@ -194,7 +194,7 @@ void sub_0805C294(u32 pos, u32 layer) {
SetTileType(0xda, pos + 0x41, 2);
} else {
SetTileType(0xd2, pos, 2);
if (CheckIsDungeon() == 0) {
if (AreaIsDungeon() == 0) {
return;
}
object = CreateObject(ARCHWAY, sub_0805C608(), 8);
@@ -216,7 +216,7 @@ void sub_0805C3B4(u32 pos, u32 layer) {
SetTileType(0xe3, pos + 0x3f, layer);
SetTileType(0xe7, pos + 0x40, layer);
if (layer == 1) {
if (CheckIsInteriorWithEnemies() != 0) {
if (AreaHasEnemies() != 0) {
object = CreateObject(ARCHWAY, 0xe, 3);
if (object != NULL) {
object->x.HALF.HI = ((pos & 0x3f) << 4) + -0x10 + gRoomControls.origin_x;
@@ -224,7 +224,7 @@ void sub_0805C3B4(u32 pos, u32 layer) {
}
SetTileType(0xe5, pos, 1);
} else {
if (CheckIsDungeon() != 0) {
if (AreaIsDungeon() != 0) {
SetTileType(0xe5, pos, 1);
} else {
SetTileType(0xe6, pos, 1);
@@ -235,7 +235,7 @@ void sub_0805C3B4(u32 pos, u32 layer) {
SetTileType(0xea, pos + 0x3f, 2);
} else {
SetTileType(0xe5, pos, 2);
if (CheckIsDungeon() == 0) {
if (AreaIsDungeon() == 0) {
return;
}
@@ -258,7 +258,7 @@ void sub_0805C4E0(u32 pos, u32 layer) {
SetTileType(0xc4, pos - 1, layer);
SetTileType(0xc7, pos + 1, layer);
if (layer == 1) {
if (CheckIsInteriorWithEnemies() != 0) {
if (AreaHasEnemies() != 0) {
object = CreateObject(ARCHWAY, 0xe, 0);
if (object != NULL) {
object->x.HALF.HI = ((pos & 0x3f) << 4) + 8 + gRoomControls.origin_x;
@@ -266,7 +266,7 @@ void sub_0805C4E0(u32 pos, u32 layer) {
}
SetTileType(0xc5, pos, 1);
} else {
if (CheckIsDungeon() != 0) {
if (AreaIsDungeon() != 0) {
SetTileType(0xc5, pos, 1);
} else {
SetTileType(0xc6, pos, 1);
@@ -277,7 +277,7 @@ void sub_0805C4E0(u32 pos, u32 layer) {
SetTileType(0xca, pos - 0x3f, 2);
} else {
SetTileType(0xc5, pos, 2);
if (CheckIsDungeon() == 0) {
if (AreaIsDungeon() == 0) {
return;
}
+2 -2
View File
@@ -38,7 +38,7 @@ void sub_0805DE68(Manager* this) {
*(u8*)&gRoomTransition.field_0x3a = 0x20;
*((u8*)&gRoomTransition.field_0x3a + 1) = 0x20;
#if !defined(EU) && !defined(JP)
gSave.unk48C[3] = 0x1194;
gSave.timers[3] = 0x1194;
#endif
}
@@ -119,7 +119,7 @@ void sub_0805E000(Manager* this) {
*(Entity**)this->unk_18 = enemy;
this->action = 1;
SetPlayerControl(3);
gArea.pMusicIndex = 0x80010000;
gArea.queued_bgm = 0x80010000;
DoFade(6, 4);
SoundReq(SFX_APPARATE);
}
+1 -1
View File
@@ -48,7 +48,7 @@ void sub_0805E140(Manager39* this) {
this->manager.unk_0e = 0x78;
this->manager.unk_0f = 0x3c;
SetDefaultPriority((Entity*)this, PRIO_HIGHEST);
sub_0805E1F8(gUnk_08108DE8[gArea.locationIndex], CheckIsDungeon());
sub_0805E1F8(gUnk_08108DE8[gArea.locationIndex], AreaIsDungeon());
}
void sub_0805E18C(Manager39* this) {
+4 -4
View File
@@ -52,8 +52,8 @@ void ManagerB_WaitForFlag(ManagerB* this) {
ManagerB_LoadFight(&this->manager);
if (!this->unk_35) {
tmp = gRoomVars.field_0x9 ? gRoomVars.field_0x9 : 0x33;
this->unk_20 = gArea.musicIndex;
gArea.musicIndex = tmp;
this->unk_20 = gArea.bgm;
gArea.bgm = tmp;
SoundReq(tmp);
}
sub_080186C0(0xB0F);
@@ -69,8 +69,8 @@ void ManagerB_WaitForDone(ManagerB* this) {
// restore music (if it was set, which apparently is only possible if there's a flag the fight waited for)
if (this->unk_3c) {
if (!this->unk_35) {
gArea.musicIndex = this->unk_20;
SoundReq(gArea.musicIndex);
gArea.bgm = this->unk_20;
SoundReq(gArea.bgm);
sub_0801855C();
}
}
+1 -1
View File
@@ -293,7 +293,7 @@ void sub_08058D34() {
gScreen.bg1.yOffset = tmp2;
gScreen.controls.layerFXControl = 0x3456;
gScreen.controls.alphaBlend = 0x909;
gArea.musicIndex = gArea.pMusicIndex;
gArea.bgm = gArea.queued_bgm;
gUpdateVisibleTiles = 0;
if (CheckGlobalFlag(LV1TARU_OPEN)) {
LoadGfxGroup(0x4A);
+3 -3
View File
@@ -14,7 +14,7 @@ extern u8 gMapDataTopSpecial[];
void sub_0806D138(u8* param_1, u8* param_2);
extern void sub_08053500(void);
extern void InitBiggoronTimer(void);
extern u32 gUnk_0200B650;
void sub_0806D110(void);
@@ -302,7 +302,7 @@ ASM_FUNC("asm/non_matching/bigGoron/sub_0806D520.inc", void sub_0806D520(Entity*
NONMATCH("asm/non_matching/bigGoron/sub_0806D5D4.inc", void sub_0806D5D4(void)) {
u32 itemSlot;
sub_08053500();
InitBiggoronTimer();
itemSlot = IsItemEquipped(0xd);
if (itemSlot != 2) {
((u8*)&gSave.stats.itemOnA)[itemSlot] = 0;
@@ -312,7 +312,7 @@ NONMATCH("asm/non_matching/bigGoron/sub_0806D5D4.inc", void sub_0806D5D4(void))
END_NONMATCH
void sub_0806D600(Entity* this, ScriptExecutionContext* context) {
context->condition = gSave.unk48C[2] == 0;
context->condition = gSave.timers[2] == 0;
}
void sub_0806D620(void) {
+2 -2
View File
@@ -224,13 +224,13 @@ void sub_08060318(void) {
}
void sub_08060340(void) {
gSave.unk48C[1] = gSave.unk50;
gSave.timers[1] = gSave.unk50;
}
u32 sub_08060354(void) {
s32 iVar2;
iVar2 = gSave.unk50 - gSave.unk48C[1];
iVar2 = gSave.unk50 - gSave.timers[1];
if (CheckGlobalFlag(DRUG_1) == 0) {
if (4 < iVar2) {
return 0x8444;
+1 -1
View File
@@ -8,7 +8,7 @@ void Archway(Entity* this) {
this->frameIndex = this->type2;
this->collisionLayer = 2;
UpdateSpriteForCollisionLayer(this);
if (CheckIsDungeon()) {
if (AreaIsDungeon()) {
this->spritePriority.b0 = 1;
}
}
+1 -1
View File
@@ -127,7 +127,7 @@ void sub_08083338(Entity* this) {
if (!CheckFlags(this->field_0x86.HWORD)) {
this->frameIndex |= 4;
sub_080836DC(this, this->field_0x7c.BYTES.byte2, this->field_0x76.HWORD);
if (!CheckIsDungeon()) {
if (!AreaIsDungeon()) {
this->action = 5;
} else {
this->action = 8;
+1 -1
View File
@@ -7,7 +7,7 @@ void MinishSizedArchway(Entity* this) {
this->frameIndex = this->type;
this->collisionLayer = 2;
UpdateSpriteForCollisionLayer(this);
if (CheckIsDungeon()) {
if (AreaIsDungeon()) {
this->spritePriority.b0 = 1;
}
}
+1 -1
View File
@@ -14,7 +14,7 @@ void sub_08090EC0(Entity* this) {
this->spriteRendering.b3 = 3;
this->spritePriority.b0 = 7;
this->frameIndex = this->type2;
if (CheckIsDungeon()) {
if (AreaIsDungeon()) {
this->frameIndex += 4;
sub_080AE068(this);
LoadFixedGFX(this, 0x184);
+2 -2
View File
@@ -45,7 +45,7 @@ void sub_0808B474(Entity* this) {
if (CheckFlags(this->field_0x86.HWORD)) {
sub_0808B830(this);
} else {
if (CheckIsDungeon() && sub_0807CAEC(this->type)) {
if (AreaIsDungeon() && sub_0807CAEC(this->type)) {
sub_0808B830(this);
}
}
@@ -63,7 +63,7 @@ void sub_0808B474(Entity* this) {
void sub_0808B530(Entity* this) {
if (CheckFlags(this->field_0x86.HWORD)) {
sub_0808B830(this);
if (CheckIsDungeon()) {
if (AreaIsDungeon()) {
sub_0807CAC8(this->type);
}
this->action = 2;
+3 -3
View File
@@ -320,7 +320,7 @@ extern u16 script_BedAtSimons;
extern Entity* gPlayerClones[];
extern ScriptExecutionContext gPlayerScriptExecutionContext;
NONMATCH("asm/non_matching/playerItemPacciCane/sub_080705AC.inc", u32 CheckPlayerActivity(void)) {
NONMATCH("asm/non_matching/playerItemPacciCane/sub_080705AC.inc", u32 CheckPlayerInactive(void)) {
if (!((gInput.newKeys & START_BUTTON) == 0 || gFadeControl.active || gUnk_02034490[0] ||
(gMessage.doTextBox & 0x7F) || gSave.stats.health == 0 || !gSave.fillerD0[34] ||
gPlayerState.controlMode != 0 || gPriorityHandler.priority_timer != 0)) {
@@ -1053,7 +1053,7 @@ static void PlayerUsePortal(Entity* this) {
if ((gInput.newKeys & (B_BUTTON | R_BUTTON)) == 0)
return;
if (CheckIsDungeon() || gArea.curPortalType == 3) {
if (AreaIsDungeon() || gArea.curPortalType == 3) {
this->subAction = 7;
this->actionDelay = 30;
DoFade(7, 16);
@@ -2228,7 +2228,7 @@ static void sub_08072B5C(Entity* this) {
return;
}
if (!CheckIsOverworld()) {
if (!AreaIsOverworld()) {
sub_08004542(this);
}
this->subAction++;
+1 -1
View File
@@ -147,7 +147,7 @@ void MandiblesProjectile_Action3(Entity* this) {
this->direction = uVar1 << 2;
this->animationState = uVar1 << 0x1a >> 0x1a;
this->hitbox = &gHitbox_0;
if (CheckIsDungeon() != 0) {
if (AreaIsDungeon() != 0) {
this->spriteOrientation.flipY = 1;
}
sub_080AA3E0(this, 0);
+1 -1
View File
@@ -280,7 +280,7 @@ void LoadRoomTileEntities(TileEntity* list) {
LoadBombableWallTile(t);
break;
case MUSIC_SETTER:
gArea.pMusicIndex = t->_3;
gArea.queued_bgm = t->_3;
break;
case DARKNESS:
LoadDarknessTile(t);
+50 -50
View File
@@ -517,7 +517,7 @@ void sub_StateChange_HouseInteriors1_SchoolWest(void) {
LoadRoomEntityList(&gUnk_080D7038);
}
if (gRoomVars.field_0x0 == 0) {
sub_08052CA4(2, 0, 0x2c8, 0xa8);
SetWorldMapPos(2, 0, 0x2c8, 0xa8);
}
}
@@ -564,17 +564,17 @@ void sub_StateChange_HyruleCastle_0(void) {
#if defined(JP) || defined(DEMO_JP)
if (CheckGlobalFlag(CASTLE_BGM) || CheckGlobalFlag(ENDING)) {
gArea.pMusicIndex = gArea.musicIndex;
gArea.queued_bgm = gArea.bgm;
}
#elif defined(EU)
if (CheckGlobalFlag(ENDING)) {
gArea.pMusicIndex = gArea.musicIndex;
gArea.queued_bgm = gArea.bgm;
}
#else
if (CheckGlobalFlag(CASTLE_BGM)) {
gArea.pMusicIndex = BGM_HYRULE_CASTLE_NOINTRO;
gArea.queued_bgm = BGM_HYRULE_CASTLE_NOINTRO;
} else if (CheckGlobalFlag(ENDING)) {
gArea.pMusicIndex = gArea.musicIndex;
gArea.queued_bgm = gArea.bgm;
}
#endif
}
@@ -594,7 +594,7 @@ extern EntityData gUnk_080D73E0;
void sub_StateChange_HyruleCastle_1(void) {
if (CheckGlobalFlag(ENDING)) {
gArea.pMusicIndex = gArea.musicIndex;
gArea.queued_bgm = gArea.bgm;
} else {
if (!CheckGlobalFlag(LV2_CLEAR)) {
LoadRoomEntityList(&gUnk_080D73B0);
@@ -604,7 +604,7 @@ void sub_StateChange_HyruleCastle_1(void) {
}
#ifndef EU
if (CheckGlobalFlag(CASTLE_BGM)) {
gArea.pMusicIndex = gArea.musicIndex;
gArea.queued_bgm = gArea.bgm;
}
#endif
}
@@ -622,16 +622,16 @@ extern EntityData gUnk_080D7618;
void sub_StateChange_HyruleCastle_2(void) {
#ifndef EU
if (CheckGlobalFlag(CASTLE_BGM)) {
gArea.pMusicIndex = gArea.musicIndex;
gArea.queued_bgm = gArea.bgm;
}
#endif
if (CheckGlobalFlag(ENDING)) {
LoadRoomEntityList(&gUnk_080D7618);
gArea.pMusicIndex = gArea.musicIndex;
gArea.queued_bgm = gArea.bgm;
} else if (CheckGlobalFlag(TABIDACHI) == 0) {
LoadRoomEntityList(&gUnk_080D74C8);
gArea.pMusicIndex = BGM_HYRULE_CASTLE_NOINTRO;
gArea.queued_bgm = BGM_HYRULE_CASTLE_NOINTRO;
} else if (CheckGlobalFlag(LV1_CLEAR) == 0) {
LoadRoomEntityList(&gUnk_080D7588);
} else {
@@ -669,7 +669,7 @@ void sub_StateChange_HyruleCastle_4(void) {
sub_080751E8(0, 6, &script_PlayerWakingUpInHyruleCastle);
#ifdef EU
SoundReq(0x80010000);
gArea.musicIndex = gArea.pMusicIndex;
gArea.bgm = gArea.queued_bgm;
}
#else
}
@@ -683,9 +683,9 @@ void sub_StateChange_HyruleCastle_4(void) {
#endif
if (CheckGlobalFlag(CASTLE_BGM)) {
#if defined(JP) || defined(DEMO_JP)
gArea.pMusicIndex = gArea.musicIndex;
gArea.queued_bgm = gArea.bgm;
#else
gArea.pMusicIndex = BGM_HYRULE_CASTLE_NOINTRO;
gArea.queued_bgm = BGM_HYRULE_CASTLE_NOINTRO;
#endif
}
#if !(defined(JP) || defined(DEMO_JP))
@@ -1011,11 +1011,11 @@ void sub_0804BF38(u32 arg0, struct_0804BF38* arg1)
ASM_FUNC("asm/non_matching/sub_0804BF38.inc", void sub_0804BF38(Entity* this, ScriptExecutionContext* context))
#endif
u32 sub_unk3_EzloCutscene_Main() {
u32 sub_unk3_EzloAuxCutscene_Main() {
return 1;
}
void sub_StateChange_EzloCutscene_Main() {
void sub_StateChange_EzloAuxCutscene_Main() {
}
u32 sub_unk3_RoyalValley_Main() {
@@ -2264,7 +2264,7 @@ void sub_StateChange_DeepwoodShrineBoss_Main(void) {
LoadRoomEntityList(&gUnk_additional_a_DeepwoodShrineBoss_Main);
} else {
SoundReq(SONG_STOP_BGM);
gArea.musicIndex = gArea.pMusicIndex;
gArea.bgm = gArea.queued_bgm;
}
}
@@ -2462,7 +2462,7 @@ void sub_StateChange_CaveOfFlamesBoss_Main(void) {
LoadRoomEntityList(&gUnk_additional_a_CaveOfFlamesBoss_Main);
} else {
SoundReq(SONG_STOP_BGM);
gArea.musicIndex = gArea.pMusicIndex;
gArea.bgm = gArea.queued_bgm;
}
}
@@ -2562,7 +2562,7 @@ void sub_StateChange_FortressOfWinds_Mazaal(void) {
SetPlayerControl(3);
}
}
gArea.musicIndex = gArea.pMusicIndex;
gArea.bgm = gArea.queued_bgm;
}
}
@@ -2791,7 +2791,7 @@ void sub_StateChange_TempleOfDroplets_BigOcto(void) {
LoadRoomEntityList(&gUnk_additional_a_TempleOfDroplets_BigOcto);
} else {
SoundReq(SONG_STOP_BGM);
gArea.musicIndex = gArea.pMusicIndex;
gArea.bgm = gArea.queued_bgm;
}
}
@@ -3112,7 +3112,7 @@ void sub_StateChange_PalaceOfWinds_0(void) {
if (!GetInventoryValue(ITEM_WIND_ELEMENT)) {
SetPlayerControl(3);
LoadRoomEntityList(&gUnk_additional_8_PalaceOfWinds_0);
gArea.musicIndex = gArea.pMusicIndex;
gArea.bgm = gArea.queued_bgm;
SoundReq(SONG_STOP_BGM);
}
}
@@ -3522,7 +3522,7 @@ u32 sub_unk3_Vaati2_Main() {
void sub_StateChange_Vaati2_Main(void) {
SoundReq(SONG_STOP_BGM);
gArea.musicIndex = gArea.pMusicIndex;
gArea.bgm = gArea.queued_bgm;
}
u32 sub_unk3_Vaati3_Main() {
@@ -3584,7 +3584,7 @@ void sub_StateChange_DarkHyruleCastleOutside_ZeldaStatuePlatform(void) {
LoadRoomEntityList(&gUnk_080EADB8);
SetTileType(0x4072, 0x145, 1);
SetTileType(0x4072, 0x149, 1);
gArea.pMusicIndex = 0;
gArea.queued_bgm = 0;
}
}
@@ -3629,14 +3629,14 @@ void sub_StateChange_DarkHyruleCastleOutside_Garden(void) {
if (!CheckLocalFlag(0x7f)) {
LoadRoomEntityList(&gUnk_080EAEC0);
SetLocalFlag(0x7f);
gArea.pMusicIndex = 0x11;
gArea.queued_bgm = 0x11;
} else {
LoadRoomEntityList(&gUnk_080EAF20);
gArea.pMusicIndex = gArea.musicIndex;
gArea.queued_bgm = gArea.bgm;
}
} else {
if (CheckLocalFlag(0x79)) {
gArea.pMusicIndex = gArea.musicIndex;
gArea.queued_bgm = gArea.bgm;
}
if (!CheckLocalFlag(1)) {
LoadRoomEntityList(&gUnk_080EAE60);
@@ -3701,7 +3701,7 @@ u32 sub_unk3_DarkHyruleCastle_0(void) {
if (CheckGlobalFlag(ENDING)) {
gRoomVars.field_0x6c[0] = &gUnk_080EB604;
gRoomVars.field_0x6c[2] = 0;
gArea.musicIndex = gArea.pMusicIndex = BGM_BEAT_VAATI;
gArea.bgm = gArea.queued_bgm = BGM_BEAT_VAATI;
} else if (CheckLocalFlag(0x79)) {
gRoomVars.field_0x6c[0] = NULL;
if (!CheckLocalFlag(0x7a)) {
@@ -3716,7 +3716,7 @@ u32 sub_unk3_DarkHyruleCastle_0(void) {
void sub_StateChange_DarkHyruleCastle_0(void) {
if (CheckGlobalFlag(ENDING)) {
gArea.pMusicIndex = gArea.musicIndex;
gArea.queued_bgm = gArea.bgm;
}
if (CheckLocalFlag(0x79)) {
@@ -3731,7 +3731,7 @@ void sub_0804D9B0(void) {
sub_0807BB98(0x357, 1, 5, 1);
sub_0807BB98(0x55f, 1, 2, 1);
LoadRoomEntityList(&gUnk_080EB684);
gArea.pMusicIndex = gArea.musicIndex;
gArea.queued_bgm = gArea.bgm;
}
u32 sub_unk3_DarkHyruleCastle_1() {
@@ -3975,7 +3975,7 @@ void sub_StateChange_DarkHyruleCastle_28(void) {
if (CheckLocalFlag(0x79)) {
sub_0807BB98(0x90, 1, 1, 5);
LoadRoomEntityList(&gUnk_080ECFCC);
gArea.pMusicIndex = gArea.musicIndex;
gArea.queued_bgm = gArea.bgm;
}
}
@@ -4005,7 +4005,7 @@ u32 sub_unk3_DarkHyruleCastle_31(void) {
void sub_StateChange_DarkHyruleCastle_31(void) {
if (CheckGlobalFlag(ENDING)) {
gArea.pMusicIndex = gArea.musicIndex;
gArea.queued_bgm = gArea.bgm;
}
}
@@ -4170,7 +4170,7 @@ void sub_StateChange_DarkHyruleCastle_53(void) {
if (CheckLocalFlag(0x79)) {
sub_0807BB98(3, 2, 5, 1);
LoadRoomEntityList(&gUnk_080EE314);
gArea.pMusicIndex = gArea.musicIndex;
gArea.queued_bgm = gArea.bgm;
}
}
@@ -4194,7 +4194,7 @@ void sub_StateChange_DarkHyruleCastle_55(void) {
if (CheckLocalFlag(0x79)) {
sub_0807BB98(0x392, 2, 2, 5);
LoadRoomEntityList(&gUnk_080EE5DC);
gArea.pMusicIndex = gArea.musicIndex;
gArea.queued_bgm = gArea.bgm;
}
}
@@ -4450,16 +4450,16 @@ void sub_StateChange_CastleGarden_Main(void) {
if (!CheckGlobalFlag(TABIDACHI)) {
LoadRoomEntityList(&gUnk_080F0650);
#ifdef EU
gArea.pMusicIndex = BGM_FESTIVAL_APPROACH;
gArea.queued_bgm = BGM_FESTIVAL_APPROACH;
#else
gArea.pMusicIndex = BGM_BEANSTALK;
gArea.queued_bgm = BGM_BEANSTALK;
SetGlobalFlag(CASTLE_BGM);
} else {
if (CheckGlobalFlag(CASTLE_BGM)) {
#if defined(JP) || defined(DEMO_JP)
gArea.pMusicIndex = gArea.musicIndex;
gArea.queued_bgm = gArea.bgm;
#else
gArea.pMusicIndex = BGM_HYRULE_CASTLE_NOINTRO;
gArea.queued_bgm = BGM_HYRULE_CASTLE_NOINTRO;
#endif
}
#endif
@@ -4743,7 +4743,7 @@ extern EntityData gUnk_080F2E2C;
void sub_StateChange_HouseInteriors2_LinksHouseEntrance(void) {
if (!CheckGlobalFlag(OUTDOOR)) {
gArea.musicIndex = gArea.pMusicIndex;
gArea.bgm = gArea.queued_bgm;
SoundReq(SONG_PLAY_VOL_RESET | BGM_MINISH_CAP);
}
if (!CheckGlobalFlag(START)) {
@@ -4760,7 +4760,7 @@ extern EntityData gUnk_080F2EC4;
void sub_StateChange_HouseInteriors2_LinksHouseSmith(void) {
if (!CheckGlobalFlag(OUTDOOR)) {
gArea.musicIndex = gArea.pMusicIndex;
gArea.bgm = gArea.queued_bgm;
SoundReq(SONG_PLAY_VOL_RESET | BGM_MINISH_CAP);
}
if (!CheckGlobalFlag(START)) {
@@ -4810,7 +4810,7 @@ void sub_StateChange_HouseInteriors2_LinksHouseBedroom(void) {
sub_080751E8(0, 6, &script_PlayerIntro);
}
if (!CheckGlobalFlag(OUTDOOR)) {
gArea.musicIndex = gArea.pMusicIndex;
gArea.bgm = gArea.queued_bgm;
SoundReq(SONG_PLAY_VOL_RESET | BGM_MINISH_CAP);
}
if ((gPlayerState.flags & PL_NO_CAP) == 0) {
@@ -5074,7 +5074,7 @@ extern EntityData gUnk_080F4E10;
void sub_StateChange_MinishWoods_Main(void) {
if (CheckGlobalFlag(ENDING)) {
gArea.pMusicIndex = gArea.musicIndex;
gArea.queued_bgm = gArea.bgm;
}
if (!CheckGlobalFlag(EZERO_1ST)) {
LoadRoomEntityList(&gUnk_080F4D50);
@@ -5145,7 +5145,7 @@ void sub_StateChange_SanctuaryEntrance_Main(void) {
}
void sub_0804ED18(void) {
gArea.pMusicIndex = gArea.musicIndex;
gArea.queued_bgm = gArea.bgm;
}
u32 sub_unk3_Sanctuary_Hall() {
@@ -5155,7 +5155,7 @@ u32 sub_unk3_Sanctuary_Hall() {
void sub_StateChange_Sanctuary_Hall(void) {
sub_080AF2E4();
if (CheckGlobalFlag(SEIIKI_BGM)) {
gArea.pMusicIndex = BGM_CASTLE_COLLAPSE;
gArea.queued_bgm = BGM_CASTLE_COLLAPSE;
}
}
@@ -5207,7 +5207,7 @@ void sub_StateChange_Sanctuary_Main(void) {
LoadRoomEntityList(&gUnk_080F55B8);
}
if (CheckGlobalFlag(SEIIKI_BGM)) {
gArea.pMusicIndex = BGM_CASTLE_COLLAPSE;
gArea.queued_bgm = BGM_CASTLE_COLLAPSE;
}
}
@@ -5222,7 +5222,7 @@ void sub_StateChange_Sanctuary_StainedGlass(void) {
LoadRoomEntityList(&gUnk_080F5660);
}
if (CheckGlobalFlag(SEIIKI_BGM)) {
gArea.pMusicIndex = BGM_CASTLE_COLLAPSE;
gArea.queued_bgm = BGM_CASTLE_COLLAPSE;
}
}
@@ -5398,7 +5398,7 @@ void sub_StateChange_WindTribeTower_Entrance(void) {
SetTileType(0x4072, 0x4c7, 1);
SetTileType(0x4072, 0x507, 1);
}
sub_08052CA4(8, 0, 0x1e8, 0x158);
SetWorldMapPos(8, 0, 0x1e8, 0x158);
}
u32 sub_unk3_WindTribeTower_Floor2() {
@@ -5451,7 +5451,7 @@ void sub_StateChange_WindTribeTowerRoof_Main(void) {
if (CheckGlobalFlag(LV5_CLEAR) && !CheckLocalFlagByBank(0x100, 5)) {
LoadRoomEntityList(&gUnk_080F66AC);
}
sub_08052CA4(8, 0, 0x1e8, 0x158);
SetWorldMapPos(8, 0, 0x1e8, 0x158);
#ifndef EU
gArea.areaMetadata |= 0x80;
#endif
@@ -5562,7 +5562,7 @@ void sub_StateChange_HyruleField_LinksHouseExterior(void) {
ClearGlobalFlag(ZELDA_CHASE);
}
if (!CheckGlobalFlag(TABIDACHI)) {
gArea.pMusicIndex = BGM_FESTIVAL_APPROACH;
gArea.queued_bgm = BGM_FESTIVAL_APPROACH;
}
if ((gSave.windcrests & 0x40000000) == 0) {
LoadRoomEntityList(&gUnk_080F70D8);
@@ -5703,9 +5703,9 @@ void sub_StateChange_HyruleField_OutsideCastle(void) {
}
if (!CheckGlobalFlag(TABIDACHI)) {
#ifdef EU
gArea.pMusicIndex = 0x10;
gArea.queued_bgm = 0x10;
#else
gArea.pMusicIndex = 0x13;
gArea.queued_bgm = 0x13;
#endif
}
}
@@ -6479,7 +6479,7 @@ extern EntityData gUnk_080FACB8;
void sub_StateChange_MtCrenel_MountainTop(void) {
if (CheckGlobalFlag(ENDING)) {
gArea.pMusicIndex = gArea.musicIndex;
gArea.queued_bgm = gArea.bgm;
} else {
LoadRoomEntityList(&gUnk_080FACB8);
}
+1 -1
View File
@@ -1458,7 +1458,7 @@ void ScriptCommand_PlaySound(Entity* entity, ScriptExecutionContext* context) {
void ScriptCommand_PlayBgm(Entity* entity, ScriptExecutionContext* context) {
if (context->scriptInstructionPointer[1] >= 100) {
SoundReq(gArea.musicIndex);
SoundReq(gArea.bgm);
} else {
SoundReq(context->scriptInstructionPointer[1]);
}
+1 -1
View File
@@ -15,7 +15,7 @@ void sub_080808D8(void) {
}
void sub_080808E4(void) {
if (sub_08052638(gRoomTransition.player_status.area_next)) {
if (CheckAreaOverworld(gRoomTransition.player_status.area_next)) {
gRoomTransition.type = TRANSITION_DEFAULT;
} else {
gRoomTransition.type = TRANSITION_FADE_BLACK;
+5 -5
View File
@@ -281,14 +281,14 @@ static void HandleTitlescreen(void) {
gOamCmd._8 = 0xE020;
gOamCmd.x = 120;
gOamCmd.y = 152;
sub_080ADA14(511, 1);
DrawDirect(511, 1);
#elif defined(EU)
gOamCmd._4 = 0;
gOamCmd._6 = 0;
gOamCmd._8 = 0xE020;
gOamCmd.x = 120;
gOamCmd.y = 152;
sub_080ADA14(510, 1);
DrawDirect(510, 1);
#else
UpdatePressStartIcon();
#endif
@@ -296,9 +296,9 @@ static void HandleTitlescreen(void) {
gOamCmd._8 = 0xe000;
gOamCmd.y = 0x84;
#ifdef EU
sub_080ADA14(0x1fe, 0);
DrawDirect(0x1fe, 0);
#else
sub_080ADA14(0x1ff, 0);
DrawDirect(0x1ff, 0);
#endif
}
}
@@ -318,7 +318,7 @@ static void UpdatePressStartIcon(void) {
gOamCmd._8 = 0xE020;
gOamCmd.x = 120;
gOamCmd.y = 152;
sub_080ADA14(511, 1);
DrawDirect(511, 1);
}
#endif