header overhaul

This commit is contained in:
theo3 2021-12-20 02:02:33 -08:00
parent 0d5eae8696
commit 6cff332e57
233 changed files with 692 additions and 943 deletions

View File

@ -939,7 +939,7 @@ _08019D76:
_08019D8C: .4byte gPlayerState _08019D8C: .4byte gPlayerState
_08019D90: .4byte gUnk_0200AF00 _08019D90: .4byte gUnk_0200AF00
_08019D94: _08019D94:
bl sub_08052734 bl HasDungeonMap
cmp r0, #0 cmp r0, #0
bne _08019D9E bne _08019D9E
b _0801A2A4 b _0801A2A4

View File

@ -466,7 +466,7 @@ _0801DC04:
adds r0, r6, #0 adds r0, r6, #0
bl sub_0801DF10 bl sub_0801DF10
mov r8, r0 mov r8, r0
bl sub_0805279C bl HasDungeonBigKey
movs r1, #8 movs r1, #8
adds r1, r1, r6 adds r1, r1, r6
mov sb, r1 mov sb, r1
@ -548,7 +548,7 @@ _0801DCA6:
cmp r0, #0 cmp r0, #0
bne _0801DC26 bne _0801DC26
_0801DCAE: _0801DCAE:
bl sub_0805279C bl HasDungeonBigKey
cmp r0, #0 cmp r0, #0
beq _0801DD16 beq _0801DD16
ldrb r1, [r6, #2] ldrb r1, [r6, #2]
@ -731,7 +731,7 @@ _0801DDE4:
_0801DE14: .4byte gUnk_02032EC0 _0801DE14: .4byte gUnk_02032EC0
_0801DE18: .4byte 0x0000FFFF _0801DE18: .4byte 0x0000FFFF
_0801DE1C: _0801DE1C:
bl sub_080527CC bl HasDungeonSmallKey
cmp r0, #0 cmp r0, #0
beq _0801DE28 beq _0801DE28
movs r0, #2 movs r0, #2

View File

@ -741,13 +741,13 @@ _080785B0:
ands r0, r1 ands r0, r1
cmp r0, #0 cmp r0, #0
bne _080785F0 bne _080785F0
bl sub_08052734 bl HasDungeonMap
cmp r0, #0 cmp r0, #0
beq _080785C4 beq _080785C4
movs r0, #1 movs r0, #1
_080785C4: _080785C4:
adds r7, r0, #0 adds r7, r0, #0
bl sub_08052764 bl HasDungeonCompass
cmp r0, #0 cmp r0, #0
beq _080785D2 beq _080785D2
movs r0, #2 movs r0, #2

View File

@ -1344,7 +1344,7 @@ _080A558C:
movs r0, #0x87 movs r0, #0x87
lsls r0, r0, #7 lsls r0, r0, #7
strh r0, [r5, #8] strh r0, [r5, #8]
bl sub_080527CC bl HasDungeonSmallKey
cmp r0, #0 cmp r0, #0
beq _080A55BE beq _080A55BE
movs r0, #0x18 movs r0, #0x18
@ -1359,7 +1359,7 @@ _080A558C:
adds r1, r4, #0 adds r1, r4, #0
bl sub_080ADA14 bl sub_080ADA14
_080A55BE: _080A55BE:
bl sub_08052764 bl HasDungeonCompass
cmp r0, #0 cmp r0, #0
beq _080A55DE beq _080A55DE
movs r0, #0x2e movs r0, #0x2e
@ -1374,7 +1374,7 @@ _080A55BE:
adds r1, r4, #0 adds r1, r4, #0
bl sub_080ADA14 bl sub_080ADA14
_080A55DE: _080A55DE:
bl sub_0805279C bl HasDungeonBigKey
cmp r0, #0 cmp r0, #0
beq _080A563CEU beq _080A563CEU
movs r0, #0x45 movs r0, #0x45
@ -1600,7 +1600,7 @@ _080A5D9A:
movs r0, #0x87 movs r0, #0x87
lsls r0, r0, #7 lsls r0, r0, #7
strh r0, [r5, #8] strh r0, [r5, #8]
bl sub_080527CC bl HasDungeonSmallKey
cmp r0, #0 cmp r0, #0
beq _080A5DCC beq _080A5DCC
movs r0, #0x18 movs r0, #0x18
@ -1616,7 +1616,7 @@ _080A5D9A:
adds r1, r4, #0 adds r1, r4, #0
bl sub_080ADA14 bl sub_080ADA14
_080A5DCC: _080A5DCC:
bl sub_08052764 bl HasDungeonCompass
cmp r0, #0 cmp r0, #0
beq _080A5DEE beq _080A5DEE
movs r0, #0x2e movs r0, #0x2e
@ -1632,7 +1632,7 @@ _080A5DCC:
adds r1, r4, #0 adds r1, r4, #0
bl sub_080ADA14 bl sub_080ADA14
_080A5DEE: _080A5DEE:
bl sub_0805279C bl HasDungeonBigKey
cmp r0, #0 cmp r0, #0
beq _080A5E48 beq _080A5E48
movs r0, #0x45 movs r0, #0x45

View File

@ -974,7 +974,7 @@ HandleGameOverScreen: @ 0x08052094
cmp r0, #0 cmp r0, #0
beq _080520B8 beq _080520B8
bl FlushSprites bl FlushSprites
bl sub_080523D4 bl DrawGameOverText
bl sub_080AD918 bl sub_080AD918
_080520B8: _080520B8:
pop {r4, pc} pop {r4, pc}

View File

@ -1,11 +1,4 @@
.include "asm/macros.inc"
.include "constants/constants.inc"
.syntax unified .syntax unified
.text
push {lr} push {lr}
ldr r2, _08077F34 @ =gStats ldr r2, _08077F34 @ =gStats
ldrb r3, [r0, #1] ldrb r3, [r0, #1]

View File

@ -93,12 +93,3 @@ gUnk_080FCA70:: @ 080FCA70
.4byte sub_080521A0 .4byte sub_080521A0
.4byte sub_080522F4 .4byte sub_080522F4
.4byte nullsub_107 .4byte nullsub_107
gUnk_080FCA84:: @ 080FCA84
.incbin "data_080FC8A4/gUnk_080FCA84.bin"
gUnk_080FCA8C:: @ 080FCA8C
.incbin "data_080FC8A4/gUnk_080FCA8C.bin"
gUnk_080FCAA4:: @ 080FCAA4
.incbin "data_080FC8A4/gUnk_080FCAA4.bin"

View File

@ -1,6 +0,0 @@
#ifndef ARM_PROXY_H
#define ARM_PROXY_H
extern void WaitForNextFrame(void);
#endif

25
include/asm.h Normal file
View File

@ -0,0 +1,25 @@
#ifndef ASM_H
#define ASM_H
#include "global.h"
struct Entity_;
extern u32 Random(void);
extern void sub_08000152(u32);
extern void SetTile(u32 index, u32 position, u32 layer);
extern void sub_08001242(struct Entity_*);
extern void sub_08001290(struct Entity_*, u32);
extern void sub_08001324(struct Entity_*);
extern u32 sub_08002632(struct Entity_*);
extern u32 sub_08003FC4(struct Entity_*, u32);
extern u32 sub_080043E8(struct Entity_*);
extern void sub_08004484(struct Entity_*, struct Entity_*);
extern u32 sub_080045D4(s16, s16, u32, u32);
extern u32 sub_080045DA(s32, s32);
extern void sub_08004596(struct Entity_*, u32);
extern u32 sub_080045B4(struct Entity_*, u32, u32);
extern u32 EntityInRectRadius(struct Entity_*, struct Entity_*, u32, u32);
extern void UpdateAnimationVariableFrames(struct Entity_*, u32);
#endif // ASM_H

View File

@ -5,6 +5,29 @@
#define NUM_BGM 99 #define NUM_BGM 99
void SoundReq(u32 sound);
extern void EnqueueSFX(u32);
void InitSound(void);
void InitSoundPlayingInfo(void);
void AudioMain(void);
typedef struct SoundPlayingInfo {
u16 unk_00;
bool8 stopBgm;
// u8 unk_03;
u16 unk_04;
s16 volumeMasterUnk;
s16 volumeMaster;
s16 volumeMasterTarget;
s16 volumeBgmUnk;
s16 volumeBgm;
s16 volumeBgmTarget;
s16 volumeSfx;
u16 currentBgm;
} SoundPlayingInfo;
extern SoundPlayingInfo gSoundPlayingInfo;
typedef enum { typedef enum {
SFX_NONE, SFX_NONE,
// BGM // BGM
@ -574,25 +597,4 @@ typedef enum {
SONG_BGM_0 = 0x80110000, SONG_BGM_0 = 0x80110000,
} Sound; } Sound;
typedef struct SoundPlayingInfo {
u16 unk_00;
bool8 stopBgm;
// u8 unk_03;
u16 unk_04;
s16 volumeMasterUnk;
s16 volumeMaster;
s16 volumeMasterTarget;
s16 volumeBgmUnk;
s16 volumeBgm;
s16 volumeBgmTarget;
s16 volumeSfx;
u16 currentBgm;
} SoundPlayingInfo;
extern SoundPlayingInfo gSoundPlayingInfo;
void InitSound(void);
void SoundReq(Sound sound);
void AudioMain(void);
#endif // AUDIO_H #endif // AUDIO_H

View File

@ -15,6 +15,10 @@ void sub_0806FA90(Entity*, Entity*, s32, s32);
void ResolveEntityOnTop(Entity*, Entity*); void ResolveEntityOnTop(Entity*, Entity*);
void ResolveEntityBelow(Entity*, Entity*); void ResolveEntityBelow(Entity*, Entity*);
u32 sub_0806F5A4(u32 idx);
u32 sub_0806F3E4(Entity*);
void sub_0806F69C(Entity*);
extern const s16 gSineTable[64]; extern const s16 gSineTable[64];
extern const s16 gCosineTable[256]; extern const s16 gCosineTable[256];

View File

@ -1,16 +0,0 @@
#ifndef CUTSCENE_H
#define CUTSCENE_H
#include "global.h"
typedef struct {
u32* cutsceneData;
u8 textIndex;
u8 filler[11];
u16 pauseTime;
u8 filler2[2];
s32 targetX;
s32 targetY;
} CutsceneBehavior;
#endif

View File

@ -2,8 +2,21 @@
#define ENEMY_H #define ENEMY_H
#include "global.h" #include "global.h"
#include "asm.h"
#include "audio.h"
#include "effects.h"
#include "flags.h"
#include "utils.h"
#include "entity.h" #include "entity.h"
extern u32 GetNextFunction(Entity*);
extern void EnemyFunctionHandler(Entity*, void (*const func[])(Entity*));
extern void sub_08001324(Entity*);
extern Entity* sub_0804A9FC(Entity*, u32);
typedef enum { typedef enum {
/*0x00*/ OCTOROK, /*0x00*/ OCTOROK,
/*0x01*/ CHUCHU, /*0x01*/ CHUCHU,
@ -213,7 +226,4 @@ extern void Enemy64(Entity*);
extern void TreeItem(Entity*); extern void TreeItem(Entity*);
extern void Enemy66(Entity*); extern void Enemy66(Entity*);
extern u32 GetNextFunction(Entity*);
extern void EnemyFunctionHandler(Entity*, void (*const func[])(Entity*));
extern void sub_08001324(Entity*);
#endif #endif

View File

@ -41,9 +41,9 @@ typedef struct {
u8 unknown2[3]; u8 unknown2[3];
} Hitbox3D; } Hitbox3D;
typedef struct Entity { typedef struct Entity_ {
/*0x00*/ struct Entity* prev; /*0x00*/ struct Entity_* prev;
/*0x04*/ struct Entity* next; /*0x04*/ struct Entity_* next;
/*0x08*/ u8 kind; /*0x08*/ u8 kind;
/*0x09*/ u8 id; /*0x09*/ u8 id;
/*0x0a*/ u8 type; /*0x0a*/ u8 type;
@ -118,9 +118,9 @@ typedef struct Entity {
/*0x45*/ u8 health; /*0x45*/ u8 health;
/*0x46*/ u16 field_0x46; /*0x46*/ u16 field_0x46;
/*0x48*/ Hitbox* hitbox; /*0x48*/ Hitbox* hitbox;
/*0x4c*/ struct Entity* field_0x4c; /*0x4c*/ struct Entity_* field_0x4c;
/*0x50*/ struct Entity* parent; /*0x50*/ struct Entity_* parent;
/*0x54*/ struct Entity* child; /*0x54*/ struct Entity_* child;
/*0x58*/ u8 animIndex; /*0x58*/ u8 animIndex;
/*0x59*/ u8 frameDuration; /*0x59*/ u8 frameDuration;
/*0x5a*/ u8 frame; /*0x5a*/ u8 frame;
@ -275,6 +275,7 @@ Entity* FindNextDuplicateID(Entity* ent, int listIndex);
*/ */
Entity* FindEntity(u32 kind, u32 id, u32 listIndex, u32 type, u32 type2); Entity* FindEntity(u32 kind, u32 id, u32 listIndex, u32 type, u32 type2);
void DeleteManager(void*);
void DeleteEntityAny(Entity* ent); void DeleteEntityAny(Entity* ent);
void UpdateEntities(void); void UpdateEntities(void);

18
include/fade.h Normal file
View File

@ -0,0 +1,18 @@
#ifndef FADE_H
#define FADE_H
#include "global.h"
void SetBrightness(u32 arg0);
void DoFade(u32 type, u32 speed);
void sub_08050008(void);
void sub_08050038(u32);
void sub_080500F4(u32 arg0);
void sub_08050110(u32 param_1, u32 param_2, u32 fadeType, u32 fadeSpeed);
void InitFade(void);
void FadeMain(void);
void FadeVBlank(void);
#endif // FADE_H

View File

@ -59,7 +59,6 @@ extern void sub_0805F46C(u32, void*);
extern void RecoverUI(u32 bottomPt, u32 topPt); extern void RecoverUI(u32 bottomPt, u32 topPt);
extern void sub_08080668(void); extern void sub_08080668(void);
extern void sub_0805194C(u32); extern void sub_0805194C(u32);
extern void LoadPalettes(const u8*, int, int);
extern struct_02036540* sub_0805F2C8(void); extern struct_02036540* sub_0805F2C8(void);
extern void sub_0805F7DC(u32, struct_02036540*); extern void sub_0805F7DC(u32, struct_02036540*);
extern void sub_0805F300(struct_02036540*); extern void sub_0805F300(struct_02036540*);

View File

@ -12,21 +12,16 @@
#include "script.h" #include "script.h"
// Identified - to be sorted into header files // Identified - to be sorted into header files
extern void ShowNPCDialogue(Entity*, Dialog*);
extern void DoFade(u32, u32);
extern u32 CheckKinstoneFused(u32); extern u32 CheckKinstoneFused(u32);
extern void ForceEquipItem(u32, u32); extern void ForceEquipItem(u32, u32);
extern void LoadRoomEntityList(EntityData* listPtr); extern void LoadRoomEntityList(EntityData* listPtr);
extern u32 GetAnimationState(Entity*);
extern void SetChildOffset(Entity*, s32, s32, s32); extern void SetChildOffset(Entity*, s32, s32, s32);
extern Entity* CreatePlayerItem(u32, u32, u32, u32); extern Entity* CreatePlayerItem(u32, u32, u32, u32);
extern u32 GetTileTypeByPos(s32 x, s32 y, u32 layer); extern u32 GetTileTypeByPos(s32 x, s32 y, u32 layer);
extern u32 GetTileType(u32 pos, u32 layer); extern u32 GetTileType(u32 pos, u32 layer);
extern void SetTile(u32, u32, u32); extern void SetTile(u32, u32, u32);
extern void SetDirtTile(u32); extern void SetDirtTile(u32);
extern void LoadRoomTileEntities(); // tba
extern Entity* CreateDeathFx(Entity*, u32, u32); extern Entity* CreateDeathFx(Entity*, u32, u32);
extern void UpdateAnimationVariableFrames(Entity*, u32);
extern u8* GetSpriteSubEntryOffsetDataPointer(u32, u32); extern u8* GetSpriteSubEntryOffsetDataPointer(u32, u32);
extern bool32 LoadFixedGFX(Entity*, u32); extern bool32 LoadFixedGFX(Entity*, u32);
extern void CreateItemEntity(u32, u32, u32); extern void CreateItemEntity(u32, u32, u32);
@ -35,20 +30,14 @@ extern void MenuFadeIn(u32, u32);
extern void LoadResourceAsync(const void*, u32, u32); extern void LoadResourceAsync(const void*, u32, u32);
extern void LoadPaletteGroup(u32); extern void LoadPaletteGroup(u32);
extern void TryLoadPrologueHyruleTown(void); extern void TryLoadPrologueHyruleTown(void);
extern Manager* GetEmptyManager(void);
extern void LoadGfxGroup(u32); extern void LoadGfxGroup(u32);
extern void EnqueueSFX(u32);
extern void ResetPlayer(void); extern void ResetPlayer(void);
extern u32 IsItemEquipped(u32); extern u32 IsItemEquipped(u32);
extern void DeleteManager(Manager*);
extern bool32 CheckPlayerInRegion(u32 centerX, u32 centerY, u32 radiusX, u32 radiusY); extern bool32 CheckPlayerInRegion(u32 centerX, u32 centerY, u32 radiusX, u32 radiusY);
extern Entity* CreateProjectileWithParent(Entity*, u8, u8); extern Entity* CreateProjectileWithParent(Entity*, u8, u8);
extern u32 GetBottleContaining(u32);
extern u32 GetTileTypeByEntity(Entity*); extern u32 GetTileTypeByEntity(Entity*);
extern u32 GetSaleItemConfirmMessageID(u32); extern u32 GetSaleItemConfirmMessageID(u32);
extern void FlushSprites(void); extern void FlushSprites(void);
extern void DispReset(u32);
extern void InitSoundPlayingInfo(void);
extern Entity* CreateProjectile(u32); extern Entity* CreateProjectile(u32);
extern void RegisterPlayerHitbox(); extern void RegisterPlayerHitbox();
extern s32 GetItemPrice(); extern s32 GetItemPrice();
@ -58,41 +47,22 @@ extern void PutItemOnSlot(u32 itemID);
extern Entity* CreateSpeechBubbleQuestionMark(Entity*, s32, s32); extern Entity* CreateSpeechBubbleQuestionMark(Entity*, s32, s32);
extern Entity* CreateSpeechBubbleExclamationMark(Entity*, s32, s32); extern Entity* CreateSpeechBubbleExclamationMark(Entity*, s32, s32);
extern Entity* CreateSpeechBubbleSleep(Entity*, s32, s32); extern Entity* CreateSpeechBubbleSleep(Entity*, s32, s32);
extern u32 CheckPlayerProximity(u32, u32, u32, u32);
extern void ChangeLightLevel(s32);
// Unidentified // Unidentified
extern u32 sub_0806ED78(Entity*);
extern u32 sub_0805ACC0(Entity*);
extern u32 sub_0801E99C(Entity*);
extern Entity* sub_080873AC(Entity*, u32, u32);
extern void sub_08078778(Entity*);
extern void sub_080787A8(Entity*, u32);
extern void sub_0806F118(Entity*);
extern void sub_080791D0(); extern void sub_080791D0();
extern void sub_0805EC9C(); extern void sub_0805EC9C();
extern void sub_0805EC60(Entity*); extern void sub_0805EC60(Entity*);
extern u32 sub_080045D4(s16, s16, u32, u32);
extern void sub_0806F69C(Entity*);
extern void sub_0806D0B0(Entity*); extern void sub_0806D0B0(Entity*);
extern void sub_0806D02C(Entity*); extern void sub_0806D02C(Entity*);
extern u32 sub_0806F5A4(u32);
extern void sub_08078784(Entity*, u32);
extern s32 sub_0806ED9C(Entity*, u32, u32);
extern void sub_0807000C(Entity*);
extern void sub_08068BEC(Entity*, u32);
extern s32 sub_0806F078(Entity*, s32);
extern void ChangeObjPalette(Entity*, u32); extern void ChangeObjPalette(Entity*, u32);
extern void sub_0806FD3C(Entity*); extern void sub_0806FD3C(Entity*);
extern void sub_0805ED14(u32*); extern void sub_0805ED14(u32*);
extern void sub_080A7C18(u32, u32, u32); extern void sub_080A7C18(u32, u32, u32);
extern void sub_0804AA30(Entity*, void (*const funcs[])(Entity*)); extern void sub_0804AA30(Entity*, void (*const funcs[])(Entity*));
extern Entity* sub_0804A9FC(Entity*, u32);
extern void sub_0804A720(Entity*); extern void sub_0804A720(Entity*);
extern u32 sub_080AEFE0(Entity*); extern u32 sub_080AEFE0(Entity*);
extern u32 sub_08049FA0(Entity*); extern u32 sub_08049FA0(Entity*);
extern u32 sub_08049FDC(Entity*, u32); extern u32 sub_08049FDC(Entity*, u32);
extern u32 EntityInRectRadius(Entity*, Entity*, u32, u32);
extern u32 sub_08049EE4(Entity*); extern u32 sub_08049EE4(Entity*);
extern void sub_08077E54(ItemBehavior*); extern void sub_08077E54(ItemBehavior*);
extern void sub_080042BA(Entity*, u32); extern void sub_080042BA(Entity*, u32);
@ -111,8 +81,6 @@ extern void sub_080575C8(u32);
extern void sub_08057688(void); extern void sub_08057688(void);
extern void sub_080580B0(u32); extern void sub_080580B0(u32);
extern void sub_080751E8(u32, u32, void*); extern void sub_080751E8(u32, u32, void*);
extern void sub_08052CA4(u32, u32, u32, u32);
extern void sub_08052878(void);
extern void sub_0808091C(ScreenTransitionData*, u32); extern void sub_0808091C(ScreenTransitionData*, u32);
extern void sub_0805BC4C(void); extern void sub_0805BC4C(void);
extern void sub_0807BB68(u32*, u32, u32); extern void sub_0807BB68(u32*, u32, u32);
@ -120,7 +88,6 @@ extern void sub_08054570(void);
extern void sub_08059278(void); extern void sub_08059278(void);
extern void sub_0804C128(u32); extern void sub_0804C128(u32);
extern void sub_08058324(u32); extern void sub_08058324(u32);
extern void sub_0804C2F0(void);
extern void sub_0801AFE4(void); extern void sub_0801AFE4(void);
extern u32 sub_08060354(void); extern u32 sub_08060354(void);
extern void sub_08057E64(void); extern void sub_08057E64(void);
@ -128,7 +95,6 @@ extern void sub_0809F814(u32);
extern void sub_080300E8(void); extern void sub_080300E8(void);
extern void sub_08058D34(void); extern void sub_08058D34(void);
extern void sub_0807AABC(Entity*); extern void sub_0807AABC(Entity*);
extern void UpdateGlobalProgress(void);
extern void sub_0805B4D0(u32); extern void sub_0805B4D0(u32);
extern void sub_0804D0B4(void); extern void sub_0804D0B4(void);
extern void sub_080534AC(); extern void sub_080534AC();
@ -137,7 +103,6 @@ extern void sub_0804D9B0();
extern void sub_0807BB98(u32, u32, u32, u32); extern void sub_0807BB98(u32, u32, u32, u32);
extern void sub_0801D000(u32); extern void sub_0801D000(u32);
extern void sub_08018C58(u32); extern void sub_08018C58(u32);
extern void sub_0804E150(void);
extern void sub_080AF284(void); extern void sub_080AF284(void);
extern void sub_080A71C4(u32, u32, u32, u32); extern void sub_080A71C4(u32, u32, u32, u32);
extern void sub_08054564(); extern void sub_08054564();
@ -150,7 +115,6 @@ extern s32 sub_0801CFA8(u32);
extern void sub_080ADA14(u32, u32); // trampoline to sub_080B27F4 extern void sub_080ADA14(u32, u32); // trampoline to sub_080B27F4
extern void sub_0801E1B8(u32, u32); extern void sub_0801E1B8(u32, u32);
extern void sub_0801E1EC(s32, s32, s32); extern void sub_0801E1EC(s32, s32, s32);
extern void sub_08050008(void);
extern void sub_080A3B74(void); extern void sub_080A3B74(void);
extern void sub_080A4054(void); extern void sub_080A4054(void);
extern void sub_0801C1D4(void); extern void sub_0801C1D4(void);
@ -161,25 +125,16 @@ extern void sub_080A4528(void);
extern void sub_080A4398(void); extern void sub_080A4398(void);
extern void sub_0801E738(u32); extern void sub_0801E738(u32);
extern void sub_080A7114(u32); extern void sub_080A7114(u32);
extern void sub_08001324(Entity*);
extern void sub_08001242(Entity*);
extern u32 sub_08003FC4(Entity*, u32);
extern u32 sub_080043E8(Entity*);
extern void sub_08001290(Entity*, u32);
extern void sub_08004596(Entity*, u32);
extern u32 sub_080045B4(Entity*, u32, u32);
extern u32 sub_0807953C(void); extern u32 sub_0807953C(void);
extern void sub_080AE068(Entity*); extern void sub_080AE068(Entity*);
extern u32 sub_0800445C(Entity*); extern u32 sub_0800445C(Entity*);
extern void sub_0807A108(void); extern void sub_0807A108(void);
extern u32 sub_0801766C(Entity*); extern u32 sub_0801766C(Entity*);
extern void sub_08004168(Entity*); extern void sub_08004168(Entity*);
extern u32 sub_08052638(u32);
extern void sub_08056208(void); extern void sub_08056208(void);
extern void sub_08050384(); extern void sub_08050384();
extern u32 sub_0806F520(); extern u32 sub_0806F520();
extern void sub_0806F4E8(Entity*); extern void sub_0806F4E8(Entity*);
extern u32 sub_0806F3E4(Entity*);
extern void sub_0804A7D4(Entity*); extern void sub_0804A7D4(Entity*);
extern void sub_08033744(Entity*); extern void sub_08033744(Entity*);
extern void sub_0800417E(Entity*, u32); extern void sub_0800417E(Entity*, u32);
@ -197,10 +152,8 @@ extern void sub_08079938();
extern void sub_0807ACCC(Entity*); extern void sub_0807ACCC(Entity*);
extern void sub_080A2BE4(Entity*, u32); extern void sub_080A2BE4(Entity*, u32);
extern u32 sub_08097ADC(Entity*); extern u32 sub_08097ADC(Entity*);
extern void sub_08097B24(Entity*);
extern u32 sub_08079F8C(void); extern u32 sub_08079F8C(void);
extern void sub_080787CC(Entity*); extern void sub_080787CC(Entity*);
extern void sub_080526F8(s32);
extern u32 sub_080044EC(Entity*, u32); extern u32 sub_080044EC(Entity*, u32);
extern u32 sub_080002B8(Entity*); extern u32 sub_080002B8(Entity*);
extern u32 sub_08049F84(Entity*, u32); extern u32 sub_08049F84(Entity*, u32);
@ -215,7 +168,6 @@ extern void sub_08080CB4(Entity*);
extern u32 sub_0800442E(Entity*); extern u32 sub_0800442E(Entity*);
extern void sub_08081404(Entity*, u32); extern void sub_08081404(Entity*, u32);
extern void sub_0807B7D8(u32, u32, u32); extern void sub_0807B7D8(u32, u32, u32);
extern void RegisterTransitionManager(void*, void (*)(), void (*)());
extern void sub_0800451C(Entity*); extern void sub_0800451C(Entity*);
extern u32 sub_080002F0(u32, u32, u32); extern u32 sub_080002F0(u32, u32, u32);
extern u32 sub_080040D8(Entity*, u8*, s32, s32); extern u32 sub_080040D8(Entity*, u8*, s32, s32);
@ -227,7 +179,6 @@ extern void sub_080026C4(u8*, u8*, u8*, u32);
extern void sub_080026F2(u8*, void*, u8*, u32); extern void sub_080026F2(u8*, void*, u8*, u32);
extern u32 sub_0805F7A0(u32); extern u32 sub_0805F7A0(u32);
extern u32* sub_0805F25C(u32); extern u32* sub_0805F25C(u32);
extern u32 sub_080045DA(s32, s32);
u32 sub_0806FCB8(Entity*, u32, u32, u32); u32 sub_0806FCB8(Entity*, u32, u32, u32);
extern void sub_080A1D70(Entity*, u32); extern void sub_080A1D70(Entity*, u32);
extern void sub_0806F62C(Entity*, u32, u32); extern void sub_0806F62C(Entity*, u32, u32);
@ -235,13 +186,6 @@ extern void sub_080A1ED0(u32, u32, u32);
extern u32 sub_0806F5B0(u32); extern u32 sub_0806F5B0(u32);
extern void sub_0801DFB4(Entity*, u32, u32, u32); extern void sub_0801DFB4(Entity*, u32, u32, u32);
extern void sub_0801E00C(); extern void sub_0801E00C();
extern void sub_08050038(u32);
extern void sub_080500F4(u32);
extern void sub_08050110(u32, u32, u32, u32);
extern u32 sub_08052734(); // has Dungeon Map?
extern u32 sub_08052764(); // has Dungeon Compass?
extern u32 sub_0805279C(); // has Dungeon Big Key?
extern u32 sub_080527CC(); // num Dungeon small keys?
extern void sub_08078790(Entity*, u32); extern void sub_08078790(Entity*, u32);
extern void sub_080788E0(Entity*); extern void sub_080788E0(Entity*);
extern void sub_08078AA8(u32, u32); extern void sub_08078AA8(u32, u32);
@ -259,17 +203,7 @@ extern u32 sub_08079FC4(u32);
extern void sub_0800455E(Entity*); extern void sub_0800455E(Entity*);
extern u32* sub_08008790(Entity*, u32); extern u32* sub_08008790(Entity*, u32);
extern void sub_0804ACF8(); extern void sub_0804ACF8();
extern void sub_08073904(Entity*);
extern u32 CheckHeaderValid(void);
extern void sub_08004484(Entity*, Entity*);
extern void sub_0805F8E4(u32 r0, WStruct* r1); extern void sub_0805F8E4(u32 r0, WStruct* r1);
extern u32 sub_08002632(Entity*);
extern void sub_0807879C(Entity*);
extern void sub_080787C0(Entity*);
extern void sub_080787B4(Entity*);
extern void sub_0808C650(Entity*, u32);
extern u32 sub_0808C67C(void);
extern void sub_0808C688(void);
extern Entity* sub_08077C94(ItemBehavior*, u32); extern Entity* sub_08077C94(ItemBehavior*, u32);
extern Entity* sub_08077C0C(ItemBehavior*, u32); extern Entity* sub_08077C0C(ItemBehavior*, u32);
@ -287,12 +221,6 @@ extern void sub_080042D0(Entity*, u32, u16);
extern u32 sub_080002A8(u32, u32, u32); extern u32 sub_080002A8(u32, u32, u32);
extern void sub_080806BC(u32, u32, u32, u32); extern void sub_080806BC(u32, u32, u32, u32);
extern void sub_080186C0(u32);
extern void sub_0801855C(void);
extern u32 sub_0807CAEC(u32);
extern void sub_0807CAC8(u32);
extern void LoadObjPalette(Entity*, u32); extern void LoadObjPalette(Entity*, u32);
void sub_0804B3C4(void*);
#endif #endif

View File

@ -1,8 +0,0 @@
#ifndef GAME_H
#define GAME_H
#include "gba/types.h"
u32 CheckIsDungeon(void);
#endif // GAME_H

View File

@ -1,29 +0,0 @@
#ifndef GREATFAIRY_H
#define GREATFAIRY_H
#include "entity.h"
#include "screen.h"
void GreatFairy_InitializeAnimation(Entity*);
Entity* GreatFairy_CreateForm(Entity*, u32, u32);
void sub_080873D0();
extern void (*const GreatFairy_Main[])(Entity*);
extern void (*const GreatFairy_Behaviors[])(Entity*);
extern void (*const GreatFairy_WingsBehaviors[])(Entity*);
extern void (*const GreatFairy_WakeBehaviors[])(Entity*);
extern void (*const GreatFairy_MiniBehaviors[])(Entity*);
extern void (*const GreatFairy_MiniAffineBehaviors[])(Entity*);
extern void (*const GreatFairy_DropletBehaviors[])(Entity*);
extern void (*const GreatFairy_RippleBehaviors[])(Entity*);
extern void (*const GreatFairy_BigRippleBehaviors[])(Entity*);
extern void (*const GreatFairy_EnergyBehaviors[])(Entity*);
extern void (*const GreatFairy_Form1Behaviors[])(Entity*);
extern void (*const GreatFairy_Form2Behaviors[])(Entity*);
extern void (*const gUnk_081207A4[])(Entity*);
extern u32 gUnk_0810C2E4;
extern const s16 GreatFairy_RippleOffsets[10];
extern u8 gUnk_0812079C[8];
extern s8 gUnk_081207AC[];
#endif

6
include/interrupts.h Normal file
View File

@ -0,0 +1,6 @@
#ifndef INTERRUPTS_H
#define INTERRUPTS_H
extern void WaitForNextFrame(void);
#endif // INTERRUPTS_H

View File

@ -92,7 +92,6 @@ void InitScreen(u32 screen);
void InitDMA(void); void InitDMA(void);
extern void sub_08056208(void); extern void sub_08056208(void);
extern void InitFade(void);
extern void ResetPalettes(void); extern void ResetPalettes(void);
extern void DoSoftReset(void); extern void DoSoftReset(void);

View File

@ -230,4 +230,15 @@ extern void Manager39_Main();
extern void (*const gManagerFunctions[58])(); extern void (*const gManagerFunctions[58])();
Manager* GetEmptyManager(void);
/**
* @brief Set manager responsible for handling room changes
*/
extern void RegisterTransitionManager(void* mgr, void (*onEnter)(), void (*onExit)());
extern u32 sub_0805ACC0(Entity*);
extern void sub_0801855C(void);
extern void sub_080186C0(u32);
#endif #endif

View File

@ -1,9 +1,50 @@
#ifndef NPC_H
#define NPC_H
#include "global.h" #include "global.h"
#include "asm.h"
#include "utils.h"
#include "audio.h"
#include "effects.h"
#include "room.h"
#include "flags.h"
#include "coord.h"
#include "textbox.h"
#include "script.h"
#include "save.h"
#include "entity.h" #include "entity.h"
#include "player.h" #include "player.h"
#ifndef NPC_H #include "structures.h"
#define NPC_H
void sub_0806EC20(Entity* ent);
void sub_0806EC38(void);
u32 sub_0806ED78(Entity* ent);
s32 sub_0806ED9C(Entity*, u32, u32);
u32 GetAnimationState(Entity* ent);
s32 sub_0806EDD8(Entity* ent, u32 x, u32 y);
void sub_0806EE04(Entity* ent, void* a2, u32 a3);
u32 sub_0806EE20(Entity* ent);
s32 sub_0806F078(Entity* ent, s32 a2);
void sub_0806F118(Entity* ent);
void sub_0806F188(Entity* ent);
void ShowNPCDialogue(Entity* ent, Dialog* dia);
Entity* CreateNPC(u32 subtype, u32 form, u32 parameter);
u32 UpdateFuseInteraction(Entity*);
void NPCInit(Entity* ent);
void sub_0806F0A4(void);
// TODO move?
void sub_08078784(Entity* ent, u32 arg1);
u32 sub_0806F5A4(u32);
u32 sub_0801E99C(Entity*);
void sub_08078778(Entity*);
void sub_0807000C(Entity*);
void sub_080787A8(Entity*, u32);
enum NPC { enum NPC {
/*0x00*/ NPC_NONE_0, /*0x00*/ NPC_NONE_0,
@ -297,8 +338,6 @@ extern void Phonograph(Entity*);
extern void NPC58(Entity*); extern void NPC58(Entity*);
extern void NPC58_Head(Entity*); extern void NPC58_Head(Entity*);
extern u32 UpdateFuseInteraction(Entity*);
extern void (*const gNPCFunctions[128][3])(Entity*); extern void (*const gNPCFunctions[128][3])(Entity*);
#endif #endif

View File

@ -2,7 +2,24 @@
#define OBJECT_H #define OBJECT_H
#include "global.h" #include "global.h"
#include "asm.h"
#include "utils.h"
#include "audio.h"
#include "flags.h"
#include "effects.h"
#include "room.h"
#include "coord.h"
#include "entity.h" #include "entity.h"
#include "player.h"
extern void sub_0807879C(Entity*);
extern void sub_080787C0(Entity*);
extern void sub_080787B4(Entity*);
extern void sub_0808C650(Entity*, u32);
extern u32 sub_0808C67C(void);
extern void sub_0808C688(void);
typedef enum { typedef enum {
GROUND_ITEM, GROUND_ITEM,

63
include/overworld.h Normal file
View File

@ -0,0 +1,63 @@
#ifndef OVERWORLD_H
#define OVERWORLD_H
#include "global.h"
#include "area.h"
void ChangeLightLevel(s32);
void SetPopupState(u32 type, u32 choice_idx);
bool32 CheckIsOverworld(void);
bool32 sub_08052638(u32 r0);
#ifndef EU
u32 sub_08052654(void);
#endif
u32 CheckIsDungeon(void);
u32 CheckIsInteriorWithEnemies(void);
u32 CheckIsInteriorNoEnemies(void);
u32 CheckHasMap(void);
s32 ModHealth(s32 deltaHealth);
void ModRupees(s32 rupeeDelta);
void sub_080526F8(s32 a1);
u32 sub_08052724(void);
u32 HasDungeonMap(void);
u32 HasDungeonCompass(void);
u32 HasDungeonBigKey(void);
u32 HasDungeonSmallKey(void);
void sub_080527FC(u32 a1, u32 a2);
#ifndef EU
void sub_08052878(void);
#endif
void RoomExitCallback(void);
void InitParachuteRoom(void);
u32 sub_08052B24(void);
void DisplayEzloMessage(void);
void sub_08052CA4(u32 area, u32 room, u32 x, u32 y);
void sub_08052CD0(u32 area, u32 room, u32 x, u32 y);
void sub_08052CFC(void);
/**
* @brief Get bank offset for area
*/
u32 GetFlagBankOffset(u32 idx);
RoomResInfo* GetCurrentRoomInfo(void);
void sub_08052EA0(void);
void sub_08052FD8(u32 room, u32 area);
void UpdateGlobalProgress(void);
void sub_08053250(void);
void sub_08053320(void);
void sub_080533CC(void);
void sub_08053494(void);
void sub_080534AC(void);
void sub_08053500(void);
u32 GetBottleContaining(u32);
#endif // OVERWORLD_H

View File

@ -1,10 +0,0 @@
#ifndef RANDOM_H
#define RANDOM_H
#include "gba/types.h"
extern u32 Random(void);
extern u32 gRand;
#endif

View File

@ -175,5 +175,8 @@ extern void SetTileType(u32, u32, u32);
extern void sub_08080964(u32 time, u32 magnitude); // shake screen extern void sub_08080964(u32 time, u32 magnitude); // shake screen
extern void* GetCurrentRoomProperty(u32); extern void* GetCurrentRoomProperty(u32);
extern void LoadRoomTileEntities();
void sub_0804B3C4(void*);
#endif #endif

View File

@ -2,6 +2,7 @@
#define BG_H #define BG_H
#include "global.h" #include "global.h"
#include "fade.h"
typedef struct { typedef struct {
u16 displayControl; u16 displayControl;

View File

@ -38,7 +38,7 @@ void MemCopy(const void* src, void* dest, u32 size);
*/ */
void ReadKeyInput(void); void ReadKeyInput(void);
void LoadPalettes(const u8*, int, int); void LoadPalettes(const u8*, s32, s32);
void LoadPaletteGroup(u32 group); void LoadPaletteGroup(u32 group);
void SetColor(u32 colorIndex, u32 color); void SetColor(u32 colorIndex, u32 color);
void SetFillColor(u32 color, u32 arg1); void SetFillColor(u32 color, u32 arg1);
@ -70,4 +70,6 @@ void zFree(void* ptr);
*/ */
void DispReset(bool32 updateHUD); void DispReset(bool32 updateHUD);
#endif u32 CheckPlayerProximity(u32, u32, u32, u32);
#endif

View File

@ -677,13 +677,11 @@ SECTIONS {
asm/code_08077698.o(.text); asm/code_08077698.o(.text);
asm/respawnPlayer.o(.text); asm/respawnPlayer.o(.text);
src/code_08077B98.o(.text); src/code_08077B98.o(.text);
src/code_08077DF4.o(.text);
asm/code_08077B98.o(.text); asm/code_08077B98.o(.text);
src/code_08078778.o(.text); src/code_08078778.o(.text);
asm/code_08078778.o(.text); asm/code_08078778.o(.text);
src/sub_0807B820.o(.text); src/sub_0807B820.o(.text);
asm/code_0807B9B8.o(.text); asm/code_0807B9B8.o(.text);
src/sub_0807C998.o(.text);
src/sub_0807CA18.o(.text); src/sub_0807CA18.o(.text);
asm/getInventoryValue.o(.text); asm/getInventoryValue.o(.text);
asm/code_0807CAA0.o(.text); asm/code_0807CAA0.o(.text);

View File

@ -7,12 +7,11 @@
#define IS_BGM(song) (song) - 1 <= NUM_BGM - 1 #define IS_BGM(song) (song) - 1 <= NUM_BGM - 1
#define IS_SFX(song) (song) - 1 > NUM_BGM - 1 #define IS_SFX(song) (song) - 1 > NUM_BGM - 1
void InitSoundPlayingInfo(void); static s32 fade(s32 target, s32 current);
s32 fade(s32 target, s32 current); static void doPlaySound(u32 sound);
void doPlaySound(u32 sound); static void PlayFadeIn(u32 sound);
void PlayFadeIn(u32 sound); static void PlayFadeOut(u32 sound);
void PlayFadeOut(u32 sound); static void InitVolume(void);
void InitVolume(void);
void InitSound(void) { void InitSound(void) {
InitSoundPlayingInfo(); InitSoundPlayingInfo();
@ -182,7 +181,7 @@ void AudioMain(void) {
} }
} }
s32 fade(s32 target, s32 current) { static s32 fade(s32 target, s32 current) {
if (target - current >= 1) { if (target - current >= 1) {
current += 4; current += 4;
if (target > current) if (target > current)
@ -196,7 +195,7 @@ s32 fade(s32 target, s32 current) {
} }
} }
void doPlaySound(u32 sound) { static void doPlaySound(u32 sound) {
u32 volume; u32 volume;
MusicPlayerInfo* musicPlayerInfo; MusicPlayerInfo* musicPlayerInfo;
@ -214,17 +213,17 @@ void doPlaySound(u32 sound) {
m4aMPlayVolumeControl(musicPlayerInfo, 0xffff, volume); m4aMPlayVolumeControl(musicPlayerInfo, 0xffff, volume);
} }
void PlayFadeIn(u32 sound) { static void PlayFadeIn(u32 sound) {
gSoundPlayingInfo.volumeMasterTarget = 0x100; gSoundPlayingInfo.volumeMasterTarget = 0x100;
doPlaySound(sound); doPlaySound(sound);
} }
void PlayFadeOut(u32 sound) { static void PlayFadeOut(u32 sound) {
gSoundPlayingInfo.volumeMasterTarget = 0; gSoundPlayingInfo.volumeMasterTarget = 0;
doPlaySound(sound); doPlaySound(sound);
} }
void InitVolume() { static void InitVolume() {
gSoundPlayingInfo.volumeMasterUnk = 0x100; gSoundPlayingInfo.volumeMasterUnk = 0x100;
gSoundPlayingInfo.volumeMaster = 0x100; gSoundPlayingInfo.volumeMaster = 0x100;
gSoundPlayingInfo.volumeMasterTarget = 0x100; gSoundPlayingInfo.volumeMasterTarget = 0x100;

View File

@ -1,7 +1,5 @@
#include "global.h"
#include "entity.h"
#include "player.h"
#include "functions.h" #include "functions.h"
#include "object.h"
typedef struct { typedef struct {
u8 unk[12]; u8 unk[12];
@ -122,4 +120,118 @@ Entity* sub_08077CF8(u32 subtype, u32 form, u32 parameter, u32 unk) {
return ent; return ent;
} }
ASM_FUNC("asm/non_matching/sub_08077D38.inc", void sub_08077D38(ItemBehavior* beh, u32 arg1)) ASM_FUNC("asm/non_matching/sub_08077D38.inc", void sub_08077D38(ItemBehavior* beh, u32 arg1));
typedef struct {
u8 b0 : 4;
u8 b1 : 4;
} PACKED Unk_bitfield;
typedef struct {
u8 unk[16];
} Unk_struct;
void sub_08077DF4(ItemBehavior* beh, u32 arg1) {
Entity* ent = (Entity*)beh; // @nocheckin
*(u16*)&ent->flags = arg1;
if ((arg1 & 0xff) > 0xb8) {
arg1 += ent->type >> 1;
}
gPlayerEntity.spriteIndex = (short)(arg1 >> 8);
InitAnimationForceUpdate(&gPlayerEntity, (u8)arg1);
sub_08077E54(beh);
}
void UpdateItemAnim(ItemBehavior* beh) {
UpdateAnimationSingleFrame(&gPlayerEntity);
sub_08077E54(beh);
}
void sub_08077E3C(ItemBehavior* ent, u32 idx) {
sub_080042BA(&gPlayerEntity, idx);
sub_08077E54(ent);
}
void sub_08077E54(ItemBehavior* beh) {
Entity* ent = (Entity*)beh; // @nocheckin
ent->action = gPlayerEntity.animIndex;
*(u8*)&ent->spriteIndex = gPlayerEntity.frameIndex;
ent->subAction = gPlayerEntity.frameDuration;
ent->actionDelay = gPlayerEntity.frame;
}
void sub_08077E78(ItemBehavior* arg0, u32 bits) {
u32 not ;
if (bits == 0) {
if (gPlayerState.field_0x2c != NULL) {
((Unk_bitfield*)gPlayerState.field_0x2c)[0x11].b0 = 6;
gPlayerState.field_0x2c = (u8*)bits;
} else {
gPlayerState.field_0x2c = (u8*)bits;
}
}
not = (8 >> bits);
gPlayerState.field_0x3[1] &= ~((u8)((8 >> bits) << 4) | not );
not = ~not ;
gPlayerState.field_0xa &= not ;
gPlayerState.keepFacing &= not ;
MemClear(arg0, 0x1c);
}
u32 sub_08077EC8(ItemBehavior* beh) {
Unk_struct* arg0 = (Unk_struct*)beh; // @nocheckin
if ((gPlayerState.field_0x1a[1] & 8) != 0) {
sub_08077DF4(beh, 0x170);
arg0->unk[7] = 0x28;
arg0->unk[4] = 7;
arg0->unk[15] = 6;
return 1;
} else {
return 0;
}
}
bool32 sub_08077EFC(ItemBehavior* arg0) {
return sub_08077F24(arg0, (u16)gPlayerState.field_0x90.HALF.LO);
}
bool32 sub_08077F10(ItemBehavior* arg0) {
return sub_08077F24(arg0, (u16)gPlayerState.field_0x90.HALF.HI);
}
ASM_FUNC("asm/non_matching/sub_08077F24.inc", bool32 sub_08077F24(ItemBehavior* beh, u32 arg1))
void sub_08077F50(ItemBehavior* beh, u32 arg1) {
sub_08079184();
sub_08077E78(beh, arg1);
}
u32 sub_08077F64(ItemBehavior* arg0, u32 unk) {
u32 temp;
if (gPlayerState.heldObject == 0) {
sub_08077F50(arg0, unk);
temp = 0;
} else {
temp = 1;
}
return temp;
}
void sub_08077F84(void) {
Entity* obj;
if (((gPlayerEntity.collisionLayer & 2) == 0) &&
GetTileTypeByPos(gPlayerEntity.x.HALF.HI, gPlayerEntity.y.HALF.HI - 0xc, 2) - 0x343U < 4) {
sub_0807AA80(&gPlayerEntity);
gPlayerState.jumpStatus |= 8;
obj = CreateObject(OBJECT_44, 0, 0);
if (obj != NULL) {
obj->x = gPlayerEntity.x;
obj->y.HALF.HI = gPlayerEntity.y.HALF.HI - 0xc;
gPlayerEntity.y.HALF.HI -= 0xc;
}
}
}

View File

@ -1,120 +0,0 @@
#include "global.h"
#include "entity.h"
#include "player.h"
#include "utils.h"
#include "object.h"
#include "functions.h"
typedef struct {
u8 b0 : 4;
u8 b1 : 4;
} PACKED Unk_bitfield;
typedef struct {
u8 unk[16];
} Unk_struct;
void sub_08077DF4(ItemBehavior* beh, u32 arg1) {
Entity* ent = (Entity*)beh; // @nocheckin
*(u16*)&ent->flags = arg1;
if ((arg1 & 0xff) > 0xb8) {
arg1 += ent->type >> 1;
}
gPlayerEntity.spriteIndex = (short)(arg1 >> 8);
InitAnimationForceUpdate(&gPlayerEntity, (u8)arg1);
sub_08077E54(beh);
}
void UpdateItemAnim(ItemBehavior* beh) {
UpdateAnimationSingleFrame(&gPlayerEntity);
sub_08077E54(beh);
}
void sub_08077E3C(ItemBehavior* ent, u32 idx) {
sub_080042BA(&gPlayerEntity, idx);
sub_08077E54(ent);
}
void sub_08077E54(ItemBehavior* beh) {
Entity* ent = (Entity*)beh; // @nocheckin
ent->action = gPlayerEntity.animIndex;
*(u8*)&ent->spriteIndex = gPlayerEntity.frameIndex;
ent->subAction = gPlayerEntity.frameDuration;
ent->actionDelay = gPlayerEntity.frame;
}
void sub_08077E78(ItemBehavior* arg0, u32 bits) {
u32 not ;
if (bits == 0) {
if (gPlayerState.field_0x2c != NULL) {
((Unk_bitfield*)gPlayerState.field_0x2c)[0x11].b0 = 6;
gPlayerState.field_0x2c = (u8*)bits;
} else {
gPlayerState.field_0x2c = (u8*)bits;
}
}
not = (8 >> bits);
gPlayerState.field_0x3[1] &= ~((u8)((8 >> bits) << 4) | not );
not = ~not ;
gPlayerState.field_0xa &= not ;
gPlayerState.keepFacing &= not ;
MemClear(arg0, 0x1c);
}
u32 sub_08077EC8(ItemBehavior* beh) {
Unk_struct* arg0 = (Unk_struct*)beh; // @nocheckin
if ((gPlayerState.field_0x1a[1] & 8) != 0) {
sub_08077DF4(beh, 0x170);
arg0->unk[7] = 0x28;
arg0->unk[4] = 7;
arg0->unk[15] = 6;
return 1;
} else {
return 0;
}
}
bool32 sub_08077EFC(ItemBehavior* arg0) {
return sub_08077F24(arg0, (u16)gPlayerState.field_0x90.HALF.LO);
}
bool32 sub_08077F10(ItemBehavior* arg0) {
return sub_08077F24(arg0, (u16)gPlayerState.field_0x90.HALF.HI);
}
ASM_FUNC("asm/non_matching/sub_08077F24.inc", bool32 sub_08077F24(ItemBehavior* beh, u32 arg1))
void sub_08077F50(ItemBehavior* beh, u32 arg1) {
sub_08079184();
sub_08077E78(beh, arg1);
}
u32 sub_08077F64(ItemBehavior* arg0, u32 unk) {
u32 temp;
if (gPlayerState.heldObject == 0) {
sub_08077F50(arg0, unk);
temp = 0;
} else {
temp = 1;
}
return temp;
}
void sub_08077F84(void) {
Entity* obj;
if (((gPlayerEntity.collisionLayer & 2) == 0) &&
GetTileTypeByPos(gPlayerEntity.x.HALF.HI, gPlayerEntity.y.HALF.HI - 0xc, 2) - 0x343U < 4) {
sub_0807AA80(&gPlayerEntity);
gPlayerState.jumpStatus |= 8;
obj = CreateObject(OBJECT_44, 0, 0);
if (obj != NULL) {
obj->x = gPlayerEntity.x;
obj->y.HALF.HI = gPlayerEntity.y.HALF.HI - 0xc;
gPlayerEntity.y.HALF.HI -= 0xc;
}
}
}

View File

@ -2,6 +2,7 @@
#include "entity.h" #include "entity.h"
#include "structures.h" #include "structures.h"
#include "functions.h" #include "functions.h"
#include "overworld.h"
#include "room.h" #include "room.h"
extern void sub_08080BC4(void); extern void sub_08080BC4(void);

View File

@ -1,8 +1,8 @@
#include "global.h" #include "global.h"
#include "asm.h"
#include "entity.h" #include "entity.h"
#include "player.h" #include "player.h"
#include "save.h" #include "save.h"
#include "random.h"
#include "utils.h" #include "utils.h"
#include "functions.h" #include "functions.h"
#include "enemy.h" #include "enemy.h"

View File

@ -1,3 +1,4 @@
#include "asm.h"
#include "area.h" #include "area.h"
#include "player.h" #include "player.h"
#include "global.h" #include "global.h"

View File

@ -1,4 +1,5 @@
#include "global.h" #include "global.h"
#include "audio.h"
#include "utils.h" #include "utils.h"
#include "functions.h" #include "functions.h"
#include "main.h" #include "main.h"

View File

@ -1,7 +1,4 @@
#include "global.h"
#include "entity.h"
#include "enemy.h" #include "enemy.h"
#include "random.h"
#include "functions.h" #include "functions.h"
extern u32 sub_080002D4(s32, s32, u32); extern u32 sub_080002D4(s32, s32, u32);

View File

@ -1,7 +1,4 @@
#include "entity.h"
#include "enemy.h" #include "enemy.h"
#include "player.h"
#include "random.h"
#include "functions.h" #include "functions.h"
extern u32 PlayerInRange(Entity*, u32, u32); extern u32 PlayerInRange(Entity*, u32, u32);

View File

@ -1,4 +1,5 @@
#include "global.h" #include "global.h"
#include "audio.h"
#include "entity.h" #include "entity.h"
#include "room.h" #include "room.h"
#include "functions.h" #include "functions.h"

View File

@ -1,5 +1,6 @@
#include "asm.h"
#include "audio.h"
#include "enemy.h" #include "enemy.h"
#include "random.h"
#include "createObject.h" #include "createObject.h"
#include "object.h" #include "object.h"
#include "functions.h" #include "functions.h"

View File

@ -1,8 +1,8 @@
#include "asm.h"
#include "global.h" #include "global.h"
#include "entity.h" #include "entity.h"
#include "enemy.h" #include "enemy.h"
#include "player.h" #include "player.h"
#include "random.h"
#include "object.h" #include "object.h"
#include "functions.h" #include "functions.h"

View File

@ -1,9 +1,10 @@
#include "asm.h"
#include "enemy.h" #include "enemy.h"
#include "audio.h"
#include "entity.h" #include "entity.h"
#include "flags.h" #include "flags.h"
#include "textbox.h" #include "textbox.h"
#include "save.h" #include "save.h"
#include "random.h"
#include "npc.h" #include "npc.h"
#include "functions.h" #include "functions.h"
#include "effects.h" #include "effects.h"

View File

@ -1,7 +1,8 @@
#include "asm.h"
#include "enemy.h" #include "enemy.h"
#include "entity.h" #include "entity.h"
#include "random.h"
#include "functions.h" #include "functions.h"
#include "audio.h"
extern s32 sub_080012DC(Entity*); extern s32 sub_080012DC(Entity*);
extern void sub_08001318(Entity*); extern void sub_08001318(Entity*);

View File

@ -1,6 +1,4 @@
#include "enemy.h" #include "enemy.h"
#include "entity.h"
#include "random.h"
#include "functions.h" #include "functions.h"
extern Entity* sub_08049DF4(u32); extern Entity* sub_08049DF4(u32);

View File

@ -1,6 +1,4 @@
#include "entity.h"
#include "enemy.h" #include "enemy.h"
#include "random.h"
#include "functions.h" #include "functions.h"
typedef struct { typedef struct {

View File

@ -1,3 +1,4 @@
#include "audio.h"
#include "enemy.h" #include "enemy.h"
#include "entity.h" #include "entity.h"
#include "functions.h" #include "functions.h"

View File

@ -1,7 +1,5 @@
#include "enemy.h" #include "enemy.h"
#include "random.h"
#include "functions.h" #include "functions.h"
#include "effects.h"
void sub_0802C4B0(Entity*); void sub_0802C4B0(Entity*);
void sub_0802C62C(Entity*); void sub_0802C62C(Entity*);

View File

@ -1,9 +1,5 @@
#include "global.h"
#include "entity.h"
#include "enemy.h" #include "enemy.h"
#include "random.h"
#include "functions.h" #include "functions.h"
#include "effects.h"
typedef struct { typedef struct {
s8 h, v; s8 h, v;

View File

@ -1,8 +1,5 @@
#include "global.h" #include "global.h"
#include "entity.h"
#include "sprite.h"
#include "enemy.h" #include "enemy.h"
#include "random.h"
#include "object.h" #include "object.h"
#include "functions.h" #include "functions.h"
// Gibudo // Gibudo

View File

@ -1,10 +1,7 @@
#include "global.h" #include "global.h"
#include "enemy.h" #include "enemy.h"
#include "player.h" #include "player.h"
#include "room.h"
#include "coord.h"
#include "fileScreen.h" #include "fileScreen.h"
#include "random.h"
#include "functions.h" #include "functions.h"
#include "effects.h" #include "effects.h"

View File

@ -1,5 +1,4 @@
#include "enemy.h" #include "enemy.h"
#include "random.h"
#include "object.h" #include "object.h"
#include "functions.h" #include "functions.h"

View File

@ -1,9 +1,5 @@
#include "global.h"
#include "entity.h"
#include "enemy.h" #include "enemy.h"
#include "random.h"
#include "functions.h" #include "functions.h"
#include "effects.h"
extern Entity* gUnk_020000B0; extern Entity* gUnk_020000B0;

View File

@ -1,8 +1,4 @@
#include "global.h"
#include "entity.h"
#include "enemy.h" #include "enemy.h"
#include "player.h"
#include "random.h"
#include "functions.h" #include "functions.h"
extern void sub_08001328(Entity*); extern void sub_08001328(Entity*);

View File

@ -1,11 +1,6 @@
#include "global.h" #include "global.h"
#include "entity.h"
#include "enemy.h" #include "enemy.h"
#include "functions.h" #include "functions.h"
#include "coord.h"
#include "random.h"
#include "player.h"
#include "effects.h"
extern void (*const LakituActionFuncs[])(Entity*); extern void (*const LakituActionFuncs[])(Entity*);

View File

@ -1,4 +1,5 @@
#include "global.h" #include "global.h"
#include "asm.h"
#include "entity.h" #include "entity.h"
#include "player.h" #include "player.h"
#include "functions.h" #include "functions.h"

View File

@ -1,9 +1,5 @@
#include "global.h"
#include "entity.h"
#include "enemy.h" #include "enemy.h"
#include "random.h"
#include "functions.h" #include "functions.h"
#include "coord.h"
extern u32 sub_080002D4(s32, s32, u32); extern u32 sub_080002D4(s32, s32, u32);
extern u32 sub_080002BC(s32, s32, u32); extern u32 sub_080002BC(s32, s32, u32);

View File

@ -1,8 +1,6 @@
#include "enemy.h" #include "enemy.h"
#include "entity.h"
#include "textbox.h" #include "textbox.h"
#include "save.h" #include "save.h"
#include "random.h"
#include "createObject.h" #include "createObject.h"
#include "functions.h" #include "functions.h"

View File

@ -1,8 +1,5 @@
#include "enemy.h" #include "enemy.h"
#include "entity.h"
#include "random.h"
#include "functions.h" #include "functions.h"
#include "effects.h"
extern u8 gEntCount; extern u8 gEntCount;
extern Hitbox gUnk_080FD298; extern Hitbox gUnk_080FD298;

View File

@ -1,10 +1,6 @@
#include "global.h"
#include "enemy.h" #include "enemy.h"
#include "audio.h"
#include "random.h"
#include "object.h" #include "object.h"
#include "functions.h" #include "functions.h"
#include "effects.h"
void sub_0803B538(Entity*); void sub_0803B538(Entity*);
u32 sub_0803B4E4(Entity*); u32 sub_0803B4E4(Entity*);

View File

@ -1,12 +1,7 @@
#include "global.h"
#include "entity.h"
#include "enemy.h" #include "enemy.h"
#include "screen.h"
#include "audio.h"
#include "random.h"
#include "object.h" #include "object.h"
#include "functions.h" #include "functions.h"
#include "effects.h" #include "screen.h"
extern void UnloadOBJPalette(Entity*); extern void UnloadOBJPalette(Entity*);

View File

@ -1,11 +1,7 @@
#include "global.h"
#include "entity.h"
#include "enemy.h" #include "enemy.h"
#include "random.h"
#include "script.h" #include "script.h"
#include "structures.h" #include "structures.h"
#include "functions.h" #include "functions.h"
#include "effects.h"
extern void sub_0807B600(u32); extern void sub_0807B600(u32);

View File

@ -1,7 +1,4 @@
#include "global.h"
#include "entity.h"
#include "enemy.h" #include "enemy.h"
#include "random.h"
#include "functions.h" #include "functions.h"
extern void sub_08045678(Entity*); extern void sub_08045678(Entity*);

View File

@ -1,7 +1,4 @@
#include "global.h"
#include "entity.h"
#include "enemy.h" #include "enemy.h"
#include "random.h"
#include "functions.h" #include "functions.h"
void sub_08045374(Entity*); void sub_08045374(Entity*);

View File

@ -1,6 +1,4 @@
#include "enemy.h" #include "enemy.h"
#include "entity.h"
#include "random.h"
#include "functions.h" #include "functions.h"
void sub_08022EAC(Entity*); void sub_08022EAC(Entity*);

View File

@ -1,8 +1,5 @@
#include "enemy.h" #include "enemy.h"
#include "entity.h"
#include "random.h"
#include "functions.h" #include "functions.h"
#include "effects.h"
extern void sub_0800449C(Entity*, u32); extern void sub_0800449C(Entity*, u32);
extern bool32 sub_08023A38(u32); extern bool32 sub_08023A38(u32);

View File

@ -1,7 +1,4 @@
#include "global.h"
#include "entity.h"
#include "enemy.h" #include "enemy.h"
#include "random.h"
#include "functions.h" #include "functions.h"
extern Entity* sub_08049DF4(u32); extern Entity* sub_08049DF4(u32);

View File

@ -1,14 +1,9 @@
#include "global.h"
#include "audio.h"
#include "enemy.h" #include "enemy.h"
#include "functions.h" #include "functions.h"
#include "object.h" #include "object.h"
#include "projectile.h" #include "projectile.h"
#include "random.h"
#include "room.h"
#include "structures.h" #include "structures.h"
#include "structures.h" #include "overworld.h"
#include "utils.h"
extern void sub_08078AC0(u32, u32, u32); extern void sub_08078AC0(u32, u32, u32);
extern u32 GetRandomByWeight(const u8*); extern u32 GetRandomByWeight(const u8*);

View File

@ -1,6 +1,4 @@
#include "entity.h"
#include "enemy.h" #include "enemy.h"
#include "random.h"
#include "functions.h" #include "functions.h"
extern void (*const gPeahatFunctions[])(Entity*); extern void (*const gPeahatFunctions[])(Entity*);

View File

@ -1,8 +1,6 @@
#include "enemy.h" #include "enemy.h"
#include "entity.h"
#include "random.h"
#include "createObject.h" #include "createObject.h"
#include "game.h" #include "overworld.h"
#include "functions.h" #include "functions.h"
#include "save.h" #include "save.h"

View File

@ -1,9 +1,6 @@
#include "enemy.h" #include "enemy.h"
#include "entity.h"
#include "random.h"
#include "object.h" #include "object.h"
#include "functions.h" #include "functions.h"
#include "effects.h"
extern u32 sub_080002E0(u32, u32); extern u32 sub_080002E0(u32, u32);
extern u32 sub_080002C8(u16, u8); extern u32 sub_080002C8(u16, u8);

View File

@ -1,8 +1,5 @@
#include "enemy.h" #include "enemy.h"
#include "entity.h"
#include "random.h"
#include "functions.h" #include "functions.h"
#include "effects.h"
extern void sub_0804A4E4(Entity*, Entity*); extern void sub_0804A4E4(Entity*, Entity*);

View File

@ -1,6 +1,4 @@
#include "entity.h"
#include "enemy.h" #include "enemy.h"
#include "random.h"
#include "functions.h" #include "functions.h"
extern void (*const gRollobiteFunctions[])(Entity*); extern void (*const gRollobiteFunctions[])(Entity*);

View File

@ -1,8 +1,4 @@
#include "global.h"
#include "entity.h"
#include "enemy.h" #include "enemy.h"
#include "random.h"
#include "audio.h"
#include "functions.h" #include "functions.h"
extern void (*const gRope[6])(Entity*); extern void (*const gRope[6])(Entity*);

View File

@ -1,4 +1,6 @@
#include "global.h" #include "global.h"
#include "asm.h"
#include "audio.h"
#include "entity.h" #include "entity.h"
#include "enemy.h" #include "enemy.h"
#include "npc.h" #include "npc.h"

View File

@ -1,4 +1,5 @@
#include "enemy.h" #include "enemy.h"
#include "audio.h"
#include "functions.h" #include "functions.h"
extern u32 sub_0804A024(Entity*, u32, u32); extern u32 sub_0804A024(Entity*, u32, u32);

View File

@ -1,10 +1,5 @@
#include "global.h"
#include "entity.h"
#include "enemy.h" #include "enemy.h"
#include "room.h"
#include "random.h"
#include "functions.h" #include "functions.h"
#include "effects.h"
typedef struct { typedef struct {
s8 h, v; s8 h, v;

View File

@ -1,6 +1,4 @@
#include "enemy.h" #include "enemy.h"
#include "entity.h"
#include "random.h"
#include "functions.h" #include "functions.h"
extern s32 sub_080012DC(Entity*); extern s32 sub_080012DC(Entity*);

View File

@ -1,8 +1,4 @@
#include "global.h"
#include "entity.h"
#include "enemy.h" #include "enemy.h"
#include "coord.h"
#include "random.h"
#include "functions.h" #include "functions.h"
extern void sub_080317F8(Entity*); extern void sub_080317F8(Entity*);

View File

@ -1,8 +1,5 @@
#include "enemy.h" #include "enemy.h"
#include "entity.h"
#include "random.h"
#include "functions.h" #include "functions.h"
#include "effects.h"
extern bool32 sub_0806FC80(Entity*, Entity*, u32); extern bool32 sub_0806FC80(Entity*, Entity*, u32);
extern Entity* sub_08049DF4(u32); extern Entity* sub_08049DF4(u32);

View File

@ -1,6 +1,4 @@
#include "enemy.h" #include "enemy.h"
#include "entity.h"
#include "random.h"
#include "functions.h" #include "functions.h"
extern u32 sub_0804A024(Entity*, u32, u32); extern u32 sub_0804A024(Entity*, u32, u32);

View File

@ -1,7 +1,4 @@
#include "enemy.h" #include "enemy.h"
#include "entity.h"
#include "random.h"
#include "audio.h"
#include "functions.h" #include "functions.h"
extern void sub_08001318(Entity*); extern void sub_08001318(Entity*);

View File

@ -1,7 +1,4 @@
#include "global.h"
#include "entity.h"
#include "enemy.h" #include "enemy.h"
#include "random.h"
#include "functions.h" #include "functions.h"
extern void (*const gUnk_080CDED0[])(Entity*); extern void (*const gUnk_080CDED0[])(Entity*);

View File

@ -1,8 +1,4 @@
#include "global.h"
#include "entity.h"
#include "enemy.h" #include "enemy.h"
#include "flags.h"
#include "random.h"
#include "functions.h" #include "functions.h"
extern void sub_08038168(Entity*); extern void sub_08038168(Entity*);

View File

@ -1,12 +1,6 @@
#include "global.h"
#include "enemy.h" #include "enemy.h"
#include "entity.h"
#include "audio.h"
#include "object.h" #include "object.h"
#include "random.h"
#include "utils.h"
#include "functions.h" #include "functions.h"
#include "effects.h"
extern void DoExitTransition(ScreenTransitionData*); extern void DoExitTransition(ScreenTransitionData*);

View File

@ -1,4 +1,5 @@
#include "entity.h" #include "entity.h"
#include "enemy.h"
#include "player.h" #include "player.h"
#include "screen.h" #include "screen.h"
#include "createObject.h" #include "createObject.h"

View File

@ -1,7 +1,4 @@
#include "global.h"
#include "enemy.h" #include "enemy.h"
#include "audio.h"
#include "random.h"
#include "functions.h" #include "functions.h"
extern u32 sub_080002E0(u32, u32); extern u32 sub_080002E0(u32, u32);

View File

@ -1,6 +1,4 @@
#include "global.h"
#include "enemy.h" #include "enemy.h"
#include "random.h"
#include "functions.h" #include "functions.h"
extern bool32 PlayerInRange(Entity*, u32, u32); extern bool32 PlayerInRange(Entity*, u32, u32);

View File

@ -1,12 +1,6 @@
#include "global.h"
#include "enemy.h" #include "enemy.h"
#include "coord.h"
#include "flags.h"
#include "random.h"
#include "audio.h"
#include "area.h" #include "area.h"
#include "functions.h" #include "functions.h"
#include "effects.h"
extern void sub_080AEFB4(Entity*); extern void sub_080AEFB4(Entity*);
extern u8 gEntCount; extern u8 gEntCount;

View File

@ -1,11 +1,6 @@
#include "entity.h"
#include "enemy.h" #include "enemy.h"
#include "object.h" #include "object.h"
#include "random.h"
#include "flags.h"
#include "audio.h"
#include "functions.h" #include "functions.h"
#include "effects.h"
void sub_080409B0(Entity*); void sub_080409B0(Entity*);
void sub_080408EC(Entity*); void sub_080408EC(Entity*);

View File

@ -1,16 +1,10 @@
#include "entity.h"
#include "enemy.h" #include "enemy.h"
#include "audio.h"
#include "room.h"
#include "random.h"
#include "object.h" #include "object.h"
#include "textbox.h" #include "textbox.h"
#include "flags.h"
#include "utils.h"
#include "structures.h" #include "structures.h"
#include "functions.h" #include "functions.h"
#include "save.h" #include "save.h"
#include "effects.h" #include "screen.h"
extern u8 gEntCount; extern u8 gEntCount;

View File

@ -1,8 +1,6 @@
#include "entity.h" #include "enemy.h"
#include "audio.h"
#include "structures.h" #include "structures.h"
#include "functions.h" #include "functions.h"
#include "effects.h"
void sub_080485D8(Entity*); void sub_080485D8(Entity*);
void sub_080485FC(Entity*); void sub_080485FC(Entity*);

View File

@ -1,7 +1,5 @@
#include "enemy.h" #include "enemy.h"
#include "entity.h"
#include "area.h" #include "area.h"
#include "random.h"
#include "functions.h" #include "functions.h"
extern void sub_08001328(Entity*); extern void sub_08001328(Entity*);

View File

@ -1,6 +1,5 @@
#include "enemy.h" #include "enemy.h"
#include "area.h" #include "area.h"
#include "random.h"
#include "functions.h" #include "functions.h"
extern void sub_08001328(Entity*); extern void sub_08001328(Entity*);

View File

@ -1,7 +1,5 @@
#include "enemy.h" #include "enemy.h"
#include "entity.h"
#include "screen.h" #include "screen.h"
#include "random.h"
#include "object.h" #include "object.h"
#include "structures.h" #include "structures.h"
#include "functions.h" #include "functions.h"

View File

@ -1,12 +1,7 @@
#include "global.h"
#include "entity.h"
#include "enemy.h" #include "enemy.h"
#include "player.h"
#include "save.h" #include "save.h"
#include "random.h"
#include "createObject.h" #include "createObject.h"
#include "functions.h" #include "functions.h"
#include "effects.h"
extern void (*const gUnk_080CEB74[])(Entity*); extern void (*const gUnk_080CEB74[])(Entity*);
extern void (*const gUnk_080CEB8C[])(Entity*); extern void (*const gUnk_080CEB8C[])(Entity*);

View File

@ -17,7 +17,7 @@ const EnemyDefinition* GetEnemyDefinition(Entity* entity) {
} }
bool32 EnemyInit(Entity* this) { bool32 EnemyInit(Entity* this) {
if ((this->flags & 1) == 0) { if ((this->flags & ENT_DID_INIT) == 0) {
const EnemyDefinition* definition = GetEnemyDefinition(this); const EnemyDefinition* definition = GetEnemyDefinition(this);
if (LoadEnemySprite(this, definition) == FALSE) { if (LoadEnemySprite(this, definition) == FALSE) {
return FALSE; return FALSE;

View File

@ -6,6 +6,7 @@
#include "room.h" #include "room.h"
#include "script.h" #include "script.h"
#include "textbox.h" #include "textbox.h"
#include "npc.h"
extern u8 gUnk_081091F8[]; extern u8 gUnk_081091F8[];
extern u8 gUnk_081091EE[]; extern u8 gUnk_081091EE[];
@ -13,7 +14,6 @@ extern u8 gUpdateVisibleTiles;
extern Manager gUnk_02033290; extern Manager gUnk_02033290;
void sub_0805ED30(void); void sub_0805ED30(void);
void ClearHitboxList(void); void ClearHitboxList(void);
void sub_0806F0A4(void);
void sub_0805EE88(void); void sub_0805EE88(void);
void ClearAllDeletedEntities(void); void ClearAllDeletedEntities(void);
void DeleteAllEntities(void); void DeleteAllEntities(void);
@ -277,7 +277,7 @@ void DeleteThisEntity(void) {
f(); f();
} }
void DeleteManager(Manager*); void DeleteManager(void*);
typedef void (*Deleter)(void*); typedef void (*Deleter)(void*);
@ -378,13 +378,14 @@ Manager* GetEmptyManager(void) {
extern u8 gManagerCount; extern u8 gManagerCount;
void DeleteManager(Manager* ent) { void DeleteManager(void* ent) {
if (!ent->next) Manager* manager = (Manager*)ent;
if (!manager->next)
return; return;
ReleaseTransitionManager(ent); ReleaseTransitionManager(manager);
UnlinkEntity(ent); UnlinkEntity(manager);
MemClear(ent, sizeof(Temp)); MemClear(manager, sizeof(Temp));
gManagerCount--; gManagerCount--;
} }

View File

@ -2,6 +2,7 @@
#include "functions.h" #include "functions.h"
#include "screen.h" #include "screen.h"
#include "utils.h" #include "utils.h"
#include "fade.h"
typedef struct { typedef struct {
u8 field_0x0; u8 field_0x0;
@ -48,18 +49,18 @@ void FadeVBlank(void) {
} }
} }
void InitFade() { void InitFade(void) {
MemClear(&gFadeControl, sizeof(gFadeControl)); MemClear(&gFadeControl, sizeof(gFadeControl));
MemClear(&gUnk_020354C0, sizeof(gUnk_020354C0)); MemClear(&gUnk_020354C0, sizeof(gUnk_020354C0));
gFadeControl.mask = 0xffffffff; gFadeControl.mask = 0xffffffff;
} }
void sub_08050008() { void sub_08050008(void) {
MemClear(&gUnk_020354C0, sizeof(gUnk_020354C0)); MemClear(&gUnk_020354C0, sizeof(gUnk_020354C0));
gFadeControl.mask = 0xFFFFFFFF; gFadeControl.mask = 0xFFFFFFFF;
} }
void sub_08050024() { static void sub_08050024(void) {
sub_0801E104(); sub_0801E104();
DoFade(5, 256); DoFade(5, 256);
} }
@ -72,9 +73,9 @@ void sub_08050038(u32 arg0) {
} }
} }
void DoFade(u32 fadeType, u32 fadeSpeed) { void DoFade(u32 type, u32 speed) {
gFadeControl.fadeSpeed = fadeSpeed; gFadeControl.fadeSpeed = speed;
gFadeControl.fadeType = fadeType; gFadeControl.fadeType = type;
gFadeControl.active = 1; gFadeControl.active = 1;
gFadeControl.fadeDuration = 0x100; gFadeControl.fadeDuration = 0x100;
gFadeControl.field_0xe = 0; gFadeControl.field_0xe = 0;
@ -83,16 +84,16 @@ void DoFade(u32 fadeType, u32 fadeSpeed) {
} else { } else {
gFadeControl.field_0x2 = 0; gFadeControl.field_0x2 = 0;
} }
if (fadeType & 8) { if (type & 8) {
gUnk_03000000.spritesOffset = 1; gUnk_03000000.spritesOffset = 1;
gScreen.bg1.control |= BGCNT_MOSAIC; gScreen.bg1.control |= BGCNT_MOSAIC;
gScreen.bg2.control |= BGCNT_MOSAIC; gScreen.bg2.control |= BGCNT_MOSAIC;
gScreen.bg3.control |= BGCNT_MOSAIC; gScreen.bg3.control |= BGCNT_MOSAIC;
} }
if (fadeType & 0x10) { if (type & 0x10) {
sub_0801E1B8(gFadeControl.field_0x16, gFadeControl.field_0x18); sub_0801E1B8(gFadeControl.field_0x16, gFadeControl.field_0x18);
sub_0801E1EC(gFadeControl.field_0x12, gFadeControl.field_0x14, gFadeControl.field_0x10); sub_0801E1EC(gFadeControl.field_0x12, gFadeControl.field_0x14, gFadeControl.field_0x10);
if ((fadeType & 1) == 0) { if ((type & 1) == 0) {
gFadeControl.fadeType &= ~4; gFadeControl.fadeType &= ~4;
sub_08050008(); sub_08050008();
gUsedPalettes = 0xffffffff; gUsedPalettes = 0xffffffff;

View File

@ -4,7 +4,6 @@
#include "utils.h" #include "utils.h"
#include "screen.h" #include "screen.h"
#include "menu.h" #include "menu.h"
#include "random.h"
#include "textbox.h" #include "textbox.h"
#include "object.h" #include "object.h"
#include "functions.h" #include "functions.h"

Some files were not shown because too many files have changed in this diff Show More