Merge branch 'master' into m4a

This commit is contained in:
Henny022p
2021-03-22 10:18:20 +01:00
320 changed files with 2898 additions and 3868 deletions
+14 -24
View File
@@ -8,6 +8,7 @@
#include "functions.h"
#include "object.h"
#include "manager.h"
#include "utils.h"
#include "npc.h"
extern u8 gUnk_03003DE0;
@@ -30,7 +31,7 @@ extern void LoadResources();
extern void FadeMain();
extern u32 sub_0805E3B0();
extern void HandlePlayerLife();
extern void sub_08070680();
extern void DoPlayerAction();
extern void sub_080171F0();
extern void sub_08078FB0();
extern void DrawEntity();
@@ -68,17 +69,6 @@ typedef struct {
} NPCStruct;
extern NPCStruct gUnk_02031EC0[100];
typedef struct {
u8 unk0;
u8 unk1;
u8 unk2;
u8 unk3;
u8 freezeTime;
u8 unk9;
} EntityHandler;
extern EntityHandler gUnk_03003DC0;
typedef struct {
void* last;
void* first;
@@ -156,7 +146,7 @@ void PlayerUpdate(Entity* this) {
}
}
HandlePlayerLife(this);
sub_08070680(this);
DoPlayerAction(this);
if ((this->height.WORD == 0) && (this->action == 1 || this->action == 9))
sub_08008790(this, 8);
sub_080171F0();
@@ -174,7 +164,7 @@ void HandlePlayerLife(Entity* this) {
gUnk_0200AF00.filler25[8] = 0;
gUnk_0200AF00.filler25[9] = 0;
if ((gPlayerEntity.bitfield & 0x80) && (gPlayerEntity.hurtBlinkTime > 0))
if ((gPlayerEntity.bitfield & 0x80) && (gPlayerEntity.iframes > 0))
SoundReq(SFX_86);
gPlayerState.flags.all &= ~(0x2000000 | 0x200);
@@ -263,7 +253,7 @@ void sub_080171F0(void) {
gPlayerState.field_0x1a[0] = 0;
gPlayerState.field_0x80 = 0;
gPlayerState.field_0xaa = 0;
MemClear32(&gUnk_03003BE0, 0x8c);
MemClear(&gUnk_03003BE0, 0x8c);
gPlayerEntity.spriteOffsetY = gPlayerState.field_0x3f;
gPlayerState.field_0x3f = 0;
sub_0807B0C8();
@@ -278,7 +268,7 @@ void sub_080171F0(void) {
sub_0807A8D8(&gPlayerEntity);
if (gPlayerState.jumpStatus & 0xc0)
gPlayerEntity.hurtBlinkTime = 0xfe;
gPlayerEntity.iframes = 0xfe;
if (gPlayerEntity.action != 0x17) {
sub_08077FEC(gPlayerEntity.action);
@@ -286,17 +276,17 @@ void sub_080171F0(void) {
}
void ItemUpdate(Entity* this) {
if ((this->flags & 1) == 0 && this->action == 0 && this->previousActionFlag == 0)
if ((this->flags & 1) == 0 && this->action == 0 && this->subAction == 0)
ItemInit(this);
if (!sub_0805E3B0(this)) {
gPlayerItemFunctions[this->id](this);
this->bitfield &= ~0x80;
if (this->hurtBlinkTime != 0) {
if (this->hurtBlinkTime > 0)
this->hurtBlinkTime--;
if (this->iframes != 0) {
if (this->iframes > 0)
this->iframes--;
else
this->hurtBlinkTime++;
this->iframes++;
}
}
DrawEntity(this);
@@ -340,8 +330,8 @@ void ObjectUpdate(Entity* this) {
if (((this->flags & 1) == 0) && (this->action == 0))
sub_080A2838(this);
if (this->hurtBlinkTime != 0)
this->hurtBlinkTime++;
if (this->iframes != 0)
this->iframes++;
if (!sub_0805E3B0(this)) {
gObjectFunctions[this->id](this);
this->bitfield &= ~0x80;
@@ -403,7 +393,7 @@ void CollisionMain(void) {
}
void RegisterPlayerHitbox(void) {
MemClear32(&gUnk_03003C70, sizeof(gUnk_03003C70));
MemClear(&gUnk_03003C70, sizeof(gUnk_03003C70));
gUnk_02018EA0 = (LinkedList2*)&gUnk_03003C70[0].last;
gUnk_03003C70[0].last = &gUnk_03003C70[0].last;
gUnk_03003C70[0].first = &gUnk_03003C70[0].last;
-1
View File
@@ -1,5 +1,4 @@
#include "global.h"
#include "entity.h"
extern u32 SetTileType(u32 tileID, u32 tilePos, u32 layerID);
-43
View File
@@ -1,43 +0,0 @@
#include "global.h"
extern void LoadPalettes(const u8*, int, int);
extern u32 gUsedPalettes;
extern u16 gPaletteBuffer[];
typedef struct {
u16 paletteId;
u8 destPaletteNum;
u8 numPalettes;
} PaletteGroup;
extern const PaletteGroup* gPaletteGroups[];
extern const u8 gGlobalGfxAndPalettes[];
void LoadPaletteGroup(u32 group) {
const PaletteGroup* paletteGroup = gPaletteGroups[group];
while (1) {
u32 destPaletteNum = paletteGroup->destPaletteNum;
u32 numPalettes = paletteGroup->numPalettes & 0xF;
if (numPalettes == 0) {
numPalettes = 16;
}
LoadPalettes(&gGlobalGfxAndPalettes[paletteGroup->paletteId * 32], destPaletteNum, numPalettes);
if ((paletteGroup->numPalettes & 0x80) == 0) {
break;
}
paletteGroup++;
}
}
void LoadPalettes(const u8* src, int destPaletteNum, int numPalettes) {
u16* dest;
u32 size = numPalettes * 32;
u32 usedPalettesMask = 1 << destPaletteNum;
while (--numPalettes > 0) {
usedPalettesMask |= (usedPalettesMask << 1);
}
gUsedPalettes |= usedPalettesMask;
dest = &gPaletteBuffer[destPaletteNum * 16];
DmaCopy32(3, src, dest, size);
}
-96
View File
@@ -1,96 +0,0 @@
#include "global.h"
#include "screen.h"
#include "structures.h"
extern u16 gPaletteBuffer[];
extern u32 gUsedPalettes;
typedef struct {
union {
int raw;
struct {
u8 filler0[0x3];
u8 unk3;
} bytes;
} unk0;
u32 dest;
u32 unk8;
} GfxItem;
extern const GfxItem* gUnk_08100AA8[];
extern const u8 gGlobalGfxAndPalettes[];
void sub_0801D79C(u32 colorIndex, u32 color) {
gPaletteBuffer[colorIndex] = color;
gUsedPalettes |= 1 << (colorIndex / 16);
}
void sub_0801D7BC(u32 color, u32 arg1) {
if (arg1) {
gScreen.lcd.unk6 = 0xE0FF;
} else {
gScreen.lcd.unk6 = 0xFFFF;
}
sub_0801D79C(0, color);
}
void LoadGfxGroup(u32 group) {
u32 terminator;
u32 dmaCtrl;
int gfxOffset;
const u8* src;
u32 dest;
int size;
const GfxItem* gfxItem = gUnk_08100AA8[group];
while (1) {
u32 loadGfx = FALSE;
u32 ctrl = gfxItem->unk0.bytes.unk3;
ctrl &= 0xF;
switch (ctrl) {
case 0x7:
loadGfx = TRUE;
break;
case 0xD:
return;
case 0xE:
if (((struct_02000000*)0x2000000)->gameLanguage > 1) {
loadGfx = TRUE;
}
break;
case 0xF:
if (((struct_02000000*)0x2000000)->gameLanguage != 0) {
loadGfx = TRUE;
}
break;
default:
if (ctrl == ((struct_02000000*)0x2000000)->gameLanguage) {
loadGfx = TRUE;
}
break;
}
if (loadGfx) {
gfxOffset = gfxItem->unk0.raw & 0xFFFFFF;
src = &gGlobalGfxAndPalettes[gfxOffset];
dest = gfxItem->dest;
size = gfxItem->unk8;
dmaCtrl = 0x80000000;
if (size < 0) {
if (dest >= VRAM) {
LZ77UnCompVram(src, (void*)dest);
} else {
LZ77UnCompWram(src, (void*)dest);
}
} else {
DmaSet(3, src, dest, dmaCtrl | ((u32)size >> 1));
}
}
terminator = gfxItem->unk0.bytes.unk3;
terminator &= 0x80;
gfxItem++;
if (!terminator) {
break;
}
}
}
+3 -5
View File
@@ -1,9 +1,7 @@
#include "global.h"
#include "entity.h"
#include "utils.h"
#include "functions.h"
// extern void DmaZero(void*, u32);
typedef struct {
u16 unk0;
u16 filler2[32];
@@ -13,13 +11,13 @@ typedef struct {
extern struct_0300110C gUnk_0300110C;
void sub_080300AC(void) {
MemClear32(&gUnk_0300110C.unk0, 0x44);
MemClear(&gUnk_0300110C.unk0, 0x44);
gUnk_0300110C.unk66 = 0xff;
}
void sub_080300C4(void) {
if (gScreenTransition.field_0xae == 0xff) {
gScreenTransition.field_0xac = 0;
MemClear32(&gScreenTransition.field_0x4c[32], 0x40);
MemClear(&gScreenTransition.field_0x4c[32], 0x40);
}
}
+6 -7
View File
@@ -2,6 +2,7 @@
#include "entity.h"
#include "area.h"
#include "main.h"
#include "utils.h"
#include "functions.h"
#include "screen.h"
@@ -10,15 +11,13 @@ typedef struct {
u32 unk;
} struct_02018EB0;
extern void sub_0805E5A8();
extern void (*const gUnk_080D4120[])();
extern void (*const gUnk_080D412C[])();
extern struct_02018EB0 gUnk_02018EB0;
u32 sub_0804AA84(void) {
if (gArea.fadeOut != 0) {
if (gArea.playShrinkSeq) {
gMain.transition = 4;
gArea.filler[8] = 0;
gArea.filler[9] = 0;
@@ -26,8 +25,8 @@ u32 sub_0804AA84(void) {
sub_0805E5A8();
return 1;
} else {
gArea.filler[18] = gArea.fadeOut;
*(vu8*)&gArea.fadeOut = gArea.fadeOut;
gArea.filler[18] = gArea.playShrinkSeq;
*(vu8*)&gArea.playShrinkSeq = gArea.playShrinkSeq;
return 0;
}
}
@@ -37,10 +36,10 @@ void sub_0804AAB8(void) {
}
void sub_0804AAD4(void) {
MemClear32((void*)&gUnk_02018EB0, 0x28);
MemClear(&gUnk_02018EB0, 0x28);
gUnk_02018EB0.unk = 0;
EraseAllEntities();
CreateObject(0x3d, gArea.field_0x17, 0);
CreateObject(0x3d, gArea.curPortalType, 0);
gArea.filler[8]++;
}
+1 -2
View File
@@ -1,5 +1,4 @@
#include "global.h"
#include "entity.h"
#include "player.h"
#include "room.h"
#include "menu.h"
@@ -133,7 +132,7 @@ u32 sub_080544C8(u32 arg0) {
}
}
u32 sub_080544DC(u32 arg0) {
u32 GetBottleContaining(u32 arg0) {
if (arg0 == gSave.stats.bottles[0]) {
return 1;
} else if (arg0 == gSave.stats.bottles[1]) {
+2 -1
View File
@@ -1,6 +1,7 @@
#include "global.h"
#include "functions.h"
#include "utils.h"
#include "structures.h"
#include "functions.h"
extern u16 gUnk_081092D4;
extern u8 gUnk_02036AD8;
+1 -1
View File
@@ -82,7 +82,7 @@ void* sub_08077C54(UnkItemStruct* unk) {
Entity* sub_08077C94(ItemBehavior* arg0, u32 arg1) {
Entity* iVar1;
iVar1 = FindEntityInListBySubtype(8, gUnk_0811BE48[arg1].unk[3], 2);
iVar1 = FindEntityByID(8, gUnk_0811BE48[arg1].unk[3], 2);
if (iVar1 == NULL) {
return NULL;
}
+3 -2
View File
@@ -1,6 +1,7 @@
#include "global.h"
#include "entity.h"
#include "player.h"
#include "utils.h"
#include "functions.h"
typedef struct {
@@ -35,7 +36,7 @@ void sub_08077E3C(Entity* ent, u32 idx) {
void sub_08077E54(Entity* ent) {
ent->action = gPlayerEntity.animIndex;
*(u8*)&ent->spriteIndex = gPlayerEntity.frameIndex;
ent->previousActionFlag = gPlayerEntity.frameDuration;
ent->subAction = gPlayerEntity.frameDuration;
ent->actionDelay = gPlayerEntity.frames.all;
}
@@ -57,7 +58,7 @@ void sub_08077E78(void* arg0, u32 bits) {
not = ~not ;
gPlayerState.field_0xa &= not ;
gPlayerState.keepFacing &= not ;
MemClear32(arg0, 0x1c);
MemClear(arg0, 0x1c);
}
u32 sub_08077EC8(Unk_struct* arg0) {
-3
View File
@@ -4,16 +4,13 @@
#include "functions.h"
#include "room.h"
extern void sub_0805E5A8();
extern void sub_08080BC4(void);
extern RoomControls gRoomControls;
extern u32 gUnk_0200B650;
extern u32 gUnk_02025EB0;
extern u8 gUnk_02000070;
extern void DoExitTransition(ScreenTransitionData*);
extern void sub_080809D4();
void sub_080808D8(void) {
gScreenTransition.transitionType = 0;
+66 -3
View File
@@ -1,7 +1,71 @@
#include "global.h"
#include "entity.h"
#include "coord.h"
extern u8 gUnk_08114F78[];
extern u8 gUnk_08114F80[];
s16 FixedMul(s16 r0, s16 r1) {
s32 temp = r0 * r1;
if (temp < 0)
return (temp + 255) >> 8;
else
return temp >> 8;
}
s16 FixedDiv(s16 r0, s16 r1) {
if (r1 == 0)
return 0;
else
return (r0 * 256) / r1;
}
void CopyPosition(Entity* param_1, Entity* param_2) {
PositionRelative(param_1, param_2, 0, 0);
}
void PositionEntityOnTop(Entity* ent, Entity* ent2) {
PositionRelative(ent, ent2, 0, 0);
ResolveEntityOnTop(ent, ent2);
}
void PositionRelative(Entity* source, Entity* target, s32 offsetX, s32 offsetY) { // r0, r1, r2, r3
s32 x;
s32 y;
x = source->x.WORD;
target->x.WORD = x + offsetX;
y = source->y.WORD;
target->y.WORD = y + offsetY;
target->height = source->height; // ldr
target->collisionLayer = source->collisionLayer;
UpdateSpriteForCollisionLayer(target);
}
void CopyPositionAndSpriteOffset(Entity* param_1, Entity* param_2) {
param_2->spriteOffsetX = param_1->spriteOffsetX;
param_2->spriteOffsetY = param_1->spriteOffsetY;
PositionRelative(param_1, param_2, 0, 0);
}
void sub_0806FA90(Entity* param_1, Entity* param_2, s32 offsetX, s32 offsetY) {
param_2->spriteOffsetX = param_1->spriteOffsetX;
param_2->spriteOffsetY = param_1->spriteOffsetY;
PositionRelative(param_1, param_2, offsetX * 64 * 32 * 32, offsetY * 64 * 32 * 32);
}
void ResolveEntityOnTop(Entity* param_1, Entity* param_2) {
param_2->spritePriority.b0 = gUnk_08114F78[param_1->spritePriority.b0];
}
void sub_0806FAD8(Entity* param_1, Entity* param_2) {
param_2->spritePriority.b0 = gUnk_08114F80[param_1->spritePriority.b0];
}
// Values of sin(x*(π/128)) as Q8.8 fixed-point numbers from x = 0 to x = 319
const s16 gSineTable[] = {
const s16 gSineTable[64] = {
Q_8_8(0), // sin(0*(π/128))
Q_8_8(0.0234375), // sin(1*(π/128))
Q_8_8(0.046875), // sin(2*(π/128))
@@ -68,8 +132,7 @@ const s16 gSineTable[] = {
Q_8_8(0.99609375), // sin(63*(π/128))
};
const s16 gCosineTable[] = {
const s16 gCosineTable[256] = {
Q_8_8(1), // sin(64*(π/128))
Q_8_8(0.99609375), // sin(65*(π/128))
Q_8_8(0.99609375), // sin(66*(π/128))
+1 -4
View File
@@ -1,8 +1,5 @@
#include "entity.h"
#include "global.h"
extern Entity* GetEmptyEntity();
extern void AppendEntityToList(Entity*, u8);
#include "entity.h"
Entity* CreateEnemy(u32 subtype, u32 form) {
Entity* enemy;
+4 -4
View File
@@ -2,8 +2,8 @@
// #include "entityData.h"
// #include "global.h"
// extern Entity * FindEntityBySubtype(u32, u32);
// extern Entity * GetEmptyEntityByType();
// extern Entity * DeepFindEntityByID(u32, u32);
// extern Entity * GetEmptyEntityByKind();
// extern void RegisterRoomEntity(Entity *, EntityData *);
// extern u32 sub_0804AF0C(Entity *, EntityData *);
// extern void sub_08016A30(Entity *);
@@ -17,11 +17,11 @@
// type = param_1->entityType & 15;
// if (((param_1->field_0x1 & 240) == 80) &&
// (preexisting = FindEntityBySubtype(type,param_1->entitySubtype), preexisting != NULL)) {
// (preexisting = DeepFindEntityByID(type,param_1->entitySubtype), preexisting != NULL)) {
// entity = NULL;
// }
// else {
// entity = GetEmptyEntityByType(); //Get empty entity
// entity = GetEmptyEntityByKind(); //Get empty entity
// if (entity != NULL) {
// (entity->entityType).type = type;
// (entity->entityType).subtype = param_1->entitySubtype;
+9 -12
View File
@@ -1,19 +1,16 @@
#include "global.h"
#include "entity.h"
extern Entity* GetEmptyEntity();
extern void AppendEntityToList(Entity*, u8);
Entity* CreateNPC(u32 subtype, u32 form, u32 parameter) {
Entity* pEVar1;
Entity* entity;
pEVar1 = GetEmptyEntity();
if (pEVar1 != NULL) {
pEVar1->kind = 7;
pEVar1->id = subtype;
pEVar1->type = form;
pEVar1->type2 = parameter;
AppendEntityToList(pEVar1, 7);
entity = GetEmptyEntity();
if (entity != NULL) {
entity->kind = 7;
entity->id = subtype;
entity->type = form;
entity->type2 = parameter;
AppendEntityToList(entity, 7);
}
return pEVar1;
return entity;
}
+11 -12
View File
@@ -1,22 +1,21 @@
#include "global.h"
#include "entity.h"
#include "coord.h"
#include "room.h"
extern Entity* GetEmptyEntity();
extern void AppendEntityToList(Entity*, u8);
#include "createObject.h"
Entity* CreateObject(u32 subtype, u32 form, u32 parameter) {
Entity* ent;
Entity* entity;
ent = GetEmptyEntity();
if (ent != NULL) {
ent->kind = 6;
ent->id = subtype;
ent->type = form;
ent->type2 = parameter;
AppendEntityToList(ent, 6);
entity = GetEmptyEntity();
if (entity != NULL) {
entity->kind = 6;
entity->id = subtype;
entity->type = form;
entity->type2 = parameter;
AppendEntityToList(entity, 6);
}
return ent;
return entity;
}
Entity* CreateObjectWithParent(Entity* parentEnt, u32 subtype, u32 form, u32 parameter) {
+7 -13
View File
@@ -1,4 +1,5 @@
#include "global.h"
#include "utils.h"
#include "functions.h"
#include "main.h"
#include "menu.h"
@@ -6,13 +7,6 @@
#include "structures.h"
#include "textbox.h"
typedef struct {
u16 unk0;
u16 unk2;
u16 unk4;
} VStruct;
extern VStruct gInput;
extern u8 gBG3Buffer[];
extern void (*const gUnk_08109A30[])();
@@ -22,9 +16,9 @@ void HandleDebugTextScreen() {
}
void sub_0805FA04(void) {
sub_0801DA90(1);
MemClear32((void*)&gBG0Buffer, sizeof(BGBuffer));
MemClear32((void*)&gBG3Buffer, 0x1000);
DispReset(1);
MemClear(&gBG0Buffer, sizeof(BGBuffer));
MemClear(&gBG3Buffer, 0x1000);
gScreen.lcd.displayControl = 0x940;
gScreen.bg.bg0xOffset = 0;
gScreen.bg.bg0yOffset = 0;
@@ -33,8 +27,8 @@ void sub_0805FA04(void) {
gScreen.affine.bg3Control = 0x1e0f;
gScreen.affine.bg3Updated = 1;
MessageInitialize();
MemClear32((void*)&gUnk_02032EC0, sizeof(UI));
MemClear32((void*)&gMenu, sizeof(Menu));
MemClear((void*)&gUnk_02032EC0, sizeof(UI));
MemClear((void*)&gMenu, sizeof(Menu));
gMenu.unk16 = gUnk_02000000->gameLanguage;
sub_08053320();
sub_0801D79C(0, 0x1144);
@@ -46,7 +40,7 @@ void sub_0805FA04(void) {
void sub_0805FA98(void) {
int iVar1;
switch (gInput.unk2) {
switch (gInput.newKeys) {
case 0x40:
gMenu.focusCoords[1] -= 1;
break;
-49
View File
@@ -1,49 +0,0 @@
#include "global.h"
#include "entity.h"
void MemFill32(u32, u8*, u32);
void MemFill16(u32, u8*, u32);
void MemFill16(u32 value, u8* dest, u32 size) {
DmaFill16(3, value, dest, size);
}
void MemFill32(u32 value, u8* dest, u32 size) {
DmaFill32(3, value, dest, size);
}
void MemClear32(u8* src, u32 size) {
u32 zero = 0;
switch (((u32)src | size) & 3) {
case 0:
MemFill32(0, src, size);
break;
case 2:
MemFill16(0, src, size);
break;
default:
do {
*src = zero;
src++;
size--;
} while (size != 0);
}
}
void MemCopy(const u8* src, u8* dst, u32 size) {
switch (((u32)src | (u32)dst | size) & 3) {
case 0:
DmaCopy32(3, src, dst, size);
break;
case 2:
DmaCopy16(3, src, dst, size);
break;
default:
do {
*dst = *src;
src++;
dst++;
} while (--size);
}
}
+4 -7
View File
@@ -1,10 +1,10 @@
#include "global.h"
#include "entity.h"
#include "random.h"
#include "functions.h"
extern u32 sub_080002D4(s32, s32, u32);
extern s32 sub_080012DC(Entity*);
extern u32 sub_080044EC(Entity*, u32);
extern u32 sub_08031E04(Entity*);
extern void sub_08031E48(Entity*, Entity*);
extern void sub_08032290(Entity*);
@@ -12,10 +12,7 @@ extern u32 sub_080322A4(Entity*);
void sub_080322E8(Entity*);
extern void sub_08032338(Entity*);
extern Entity* sub_08049DF4(u32);
extern void sub_0804AA30(Entity*, void (*const funcs[])(Entity*));
extern u32 sub_0806FCB8(Entity*, u32, u32, u32);
extern u32 GetNextFunction(Entity*);
extern void SetChildOffset(Entity*, s32, s32, s32);
extern Entity* gUnk_020000B0;
extern u8 gEntCount;
@@ -62,8 +59,8 @@ void sub_080318DC(Entity* this) {
do {
brother->action = 5;
brother->spritePriority.b1 = 1;
if (brother->hurtBlinkTime == 0)
brother->hurtBlinkTime = -12;
if (brother->iframes == 0)
brother->iframes = -12;
} while (brother = brother->attachedEntity, brother != NULL);
}
if (this->parent) {
@@ -113,7 +110,7 @@ void sub_080318DC(Entity* this) {
}
void sub_08031A60(Entity* this) {
if (this->hurtBlinkTime > 0)
if (this->iframes > 0)
sub_08003FC4(this, 0x1800);
sub_08001324(this);
+9 -7
View File
@@ -1,6 +1,8 @@
#include "entity.h"
#include "functions.h"
#include "enemy.h"
#include "player.h"
#include "random.h"
#include "functions.h"
extern u32 PlayerInRange(Entity*, u32, u32);
@@ -66,7 +68,7 @@ void sub_08021818(Entity* this) {
void sub_08021848(Entity* this) {
if (sub_0806F520(this)) {
gUnk_080CB5C8[this->previousActionFlag](this);
gUnk_080CB5C8[this->subAction](this);
} else {
this->action = 3;
this->height.HALF.HI = 0;
@@ -75,7 +77,7 @@ void sub_08021848(Entity* this) {
}
void sub_0802187C(Entity* this) {
this->previousActionFlag = 2;
this->subAction = 2;
}
void nullsub_130(Entity* this) {
@@ -98,8 +100,8 @@ void sub_080218B4(Entity* this) {
}
void sub_080218CC(Entity* this) {
if (this->previousActionFlag == 0) {
this->previousActionFlag = 1;
if (this->subAction == 0) {
this->subAction = 1;
this->spriteSettings.b.draw = 1;
this->direction = ((sub_08049F84(this, 1) ^ 0x10) + gUnk_080CB5DC[Random() & 7]) & 0x1f;
this->speed = 0x100;
@@ -124,8 +126,8 @@ void sub_080218CC(Entity* this) {
}
void sub_08021984(Entity* this) {
if (this->previousActionFlag == 0) {
this->previousActionFlag = 1;
if (this->subAction == 0) {
this->subAction = 1;
this->flags |= 0x80;
this->spriteSettings.b.draw = 3;
this->height.HALF.HI = -0x80;
+1 -2
View File
@@ -1,10 +1,9 @@
#include "global.h"
#include "entity.h"
#include "room.h"
#include "functions.h"
extern void sub_080A2CC0();
extern void sub_0806F69C();
extern void EnqueueSFX();
void BladeTrap(Entity* this) {
if (this->action == 0) {
+9 -8
View File
@@ -1,7 +1,8 @@
#include "enemy.h"
#include "random.h"
#include "createObject.h"
#include "functions.h"
extern void CreateDustSmall(Entity*);
extern void sub_08078930(Entity*);
extern void sub_08078954(Entity*);
@@ -63,8 +64,8 @@ void sub_0802C688(Entity* this) {
}
void sub_0802C7AC(Entity* this) {
if (this->previousActionFlag < 3 && !sub_0806F520(this)) {
this->previousActionFlag = 0;
if (this->subAction < 3 && !sub_0806F520(this)) {
this->subAction = 0;
this->field_0xf = 1;
this->height.HALF.HI = 0;
if (this->field_0x82.HALF.LO != 2) {
@@ -75,7 +76,7 @@ void sub_0802C7AC(Entity* this) {
this->field_0x80.HALF.HI = 0;
} else {
this->height.HALF.HI = -1;
gUnk_080CD600[this->previousActionFlag](this);
gUnk_080CD600[this->subAction](this);
if (this->actionDelay != 0) {
GetNextFrame(this);
}
@@ -83,7 +84,7 @@ void sub_0802C7AC(Entity* this) {
}
void sub_0802C820(Entity* this) {
this->previousActionFlag = 1;
this->subAction = 1;
this->field_0x1d = 60;
}
@@ -180,11 +181,11 @@ void sub_0802C91C(Entity* this) {
}
void sub_0802C9B8(Entity* this) {
gUnk_080CD618[this->previousActionFlag](this);
gUnk_080CD618[this->subAction](this);
}
void sub_0802C9D0(Entity* this) {
this->previousActionFlag = 1;
this->subAction = 1;
this->flags &= ~0x80;
this->spritePriority.b1 = 0;
this->field_0x82.HALF.HI = 1;
@@ -255,7 +256,7 @@ void nullsub_150(Entity* this) {
void sub_0802CB68(Entity* this) {
this->action = 1;
this->previousActionFlag = 0;
this->subAction = 0;
this->direction = Random() & 0x18;
this->direction |= 4;
this->flags |= 0x80;
+11 -13
View File
@@ -1,17 +1,15 @@
#include "global.h"
#include "entity.h"
#include "functions.h"
#include "player.h"
#include "random.h"
#include "functions.h"
extern void sub_08078954(Entity*);
extern u32 sub_0800442E(Entity*);
extern void sub_08078930(Entity*);
extern s32 sub_080012DC(Entity*);
extern u32 GetNextFunction(Entity*);
extern void sub_0806F4E8(Entity*);
extern Entity* sub_08049DF4(u32);
extern void sub_08079BD8(Entity*);
extern u32 GetTileTypeByEntity(Entity*);
void sub_0802AD1C(Entity*, u32);
void sub_0802AD54(Entity*);
@@ -70,11 +68,11 @@ void sub_0802A8AC(Entity* this) {
}
void sub_0802A8C8(Entity* this) {
gUnk_080CD140[this->previousActionFlag](this);
gUnk_080CD140[this->subAction](this);
}
void sub_0802A8E0(Entity* this) {
this->previousActionFlag = 1;
this->subAction = 1;
this->field_0x1d = 60;
}
@@ -102,7 +100,7 @@ void sub_0802A91C(Entity* this) {
void sub_0802A924(Entity* this) {
this->action = 1;
this->previousActionFlag = 0;
this->subAction = 0;
this->actionDelay = 0;
this->field_0xf = 0;
this->hitbox = (Hitbox*)&gUnk_080CD16C;
@@ -128,7 +126,7 @@ void sub_0802A9A8(Entity* this) {
if (this->actionDelay) {
if (--this->actionDelay == 0) {
this->action = 2;
this->previousActionFlag = 0;
this->subAction = 0;
this->actionDelay = 0x40;
sub_0802ACDC(this, 8);
}
@@ -254,7 +252,7 @@ void sub_0802AB40(Entity* this) {
void sub_0802AC08(Entity* this) {
if (this->frames.all & 0x80) {
this->action = 2;
this->previousActionFlag = 0;
this->subAction = 0;
this->actionDelay = 0x40;
this->speed = 0xc0;
sub_0802ACDC(this, 8);
@@ -386,7 +384,7 @@ void sub_0802AE68(Entity* this) {
}
void sub_0802AEBC(Entity* this) {
gUnk_080CD158[this->previousActionFlag](this);
gUnk_080CD158[this->subAction](this);
}
void sub_0802AED4(Entity* this) {
@@ -407,7 +405,7 @@ void sub_0802AED4(Entity* this) {
}
void sub_0802AF28(Entity* this) {
this->previousActionFlag = 1;
this->subAction = 1;
sub_08079BD8(this);
this->spritePriority.b1 = 2;
GetNextFrame(this);
@@ -424,7 +422,7 @@ void sub_0802AF58(Entity* this) {
void sub_0802AF74(Entity* this) {
this->action = 3;
this->previousActionFlag = 0;
this->subAction = 0;
if (this->actionDelay > 60) {
this->actionDelay = 60;
}
@@ -510,7 +508,7 @@ void sub_0802B048(Entity* this) {
} else {
if (this->field_0xf) {
if (--this->field_0xf == 0) {
if (action == 2 && this->previousActionFlag == 1) {
if (action == 2 && this->subAction == 1) {
gPlayerState.heldObject = 0;
}
sub_0805EC60(this);
+3 -5
View File
@@ -1,10 +1,8 @@
#include "global.h"
#include "entity.h"
#include "enemy.h"
#include "functions.h"
extern void EnemyFunctionHandler(Entity*, void (*const funcs[])(Entity*));
extern void SetChildOffset(Entity*, u32, u32, u32);
extern void sub_0804A9FC(Entity*, u32);
extern void sub_0804AA30(Entity*, void (*const funcs[][])(Entity*));
extern void sub_0803C5F0(Entity*);
extern void (*const gUnk_080CFF78[])(Entity*);
@@ -25,7 +23,7 @@ void sub_0803C198(Entity* this) {
if (this->field_0x43 != 0) {
sub_0804A9FC(this, 0x1c);
}
sub_0804AA30(this, &gUnk_080CFF78);
sub_0804AA30(this, gUnk_080CFF78);
if ((this->bitfield & 0x80) != 0) {
sub_0803C5F0(this);
pEVar1 = this->attachedEntity;
+18 -16
View File
@@ -1,9 +1,11 @@
#include "enemy.h"
#include "entity.h"
#include "flags.h"
#include "functions.h"
#include "textbox.h"
#include "save.h"
#include "random.h"
#include "npc.h"
#include "functions.h"
extern void sub_0801D040(Entity*, u32);
extern Entity* sub_08049DF4(u32);
@@ -54,7 +56,7 @@ void sub_08028934(Entity* this) {
if (this->damageType == 1 && (this->bitfield & 0x7f) == 0x42) {
this->action = 3;
this->previousActionFlag = 0;
this->subAction = 0;
this->actionDelay = 0x28;
this->flags &= ~0x80;
sub_080290E0(this, 4);
@@ -97,7 +99,7 @@ void sub_08028A48(Entity* this) {
this->actionDelay--;
} else if (sub_08028F98(this, 0)) {
sub_08029078(this);
this->previousActionFlag = 0;
this->subAction = 0;
this->field_0xf = 1;
}
}
@@ -106,11 +108,11 @@ void sub_08028A74(Entity* this) {
u32 unk;
GetNextFrame(this);
switch (this->previousActionFlag) {
switch (this->subAction) {
case 0:
unk = 1;
if (this->frames.all & 0x80) {
this->previousActionFlag = 1;
this->subAction = 1;
this->actionDelay = 0x3c;
this->field_0xf = 0x10;
sub_08028FDC(this);
@@ -120,7 +122,7 @@ void sub_08028A74(Entity* this) {
case 1:
unk = 1;
if (--this->actionDelay == 0) {
this->previousActionFlag = 2;
this->subAction = 2;
this->actionDelay = 0x20;
this->field_0xf = 0;
sub_08028FDC(this);
@@ -141,14 +143,14 @@ void sub_08028A74(Entity* this) {
ent->parent = this;
ent->direction = this->direction;
this->frames.all &= ~1;
this->previousActionFlag = 3;
this->subAction = 3;
}
}
break;
case 3:
unk = 2;
if (this->frames.all & 0x80) {
this->previousActionFlag = 4;
this->subAction = 4;
this->actionDelay = 0x50;
sub_080290E0(this, 1);
}
@@ -157,13 +159,13 @@ void sub_08028A74(Entity* this) {
unk = 2;
if (--this->actionDelay == 0) {
if (sub_08028F98(this, 0)) {
this->previousActionFlag = 1;
this->subAction = 1;
this->actionDelay = 0x3c;
this->field_0xf = 0x10;
sub_08028FDC(this);
} else {
sub_08028FFC(this);
this->previousActionFlag = 0;
this->subAction = 0;
this->actionDelay = 0x50;
this->field_0xf = 0;
}
@@ -174,7 +176,7 @@ void sub_08028A74(Entity* this) {
if (!sub_08028F98(this, unk)) {
sub_08028FFC(this);
this->previousActionFlag = 0;
this->subAction = 0;
this->actionDelay = 0x50;
this->field_0xf = 0;
}
@@ -183,11 +185,11 @@ void sub_08028A74(Entity* this) {
void sub_08028BC4(Entity* this) {
Entity* iVar1;
switch (this->previousActionFlag) {
switch (this->subAction) {
case 0:
if (this->actionDelay == 0) {
if (this->frames.all & 0x80) {
this->previousActionFlag = 1;
this->subAction = 1;
sub_08028FDC(this);
sub_080290E0(this, 5);
this->spritePriority.b1 = 1;
@@ -199,7 +201,7 @@ void sub_08028BC4(Entity* this) {
case 1:
if (this->frames.all & 0x80) {
this->action = 4;
this->previousActionFlag = 0;
this->subAction = 0;
this->actionDelay = 0x1e;
this->field_0xf = 5;
sub_080290E0(this, 0);
@@ -314,7 +316,7 @@ void sub_08028E40(Entity* this) {
struct SalesOffering* offer = (struct SalesOffering*)this->field_0x7c.WORD;
this->action = 4;
this->previousActionFlag = gTextBox.doTextBox & 0x7f;
this->subAction = gTextBox.doTextBox & 0x7f;
this->actionDelay = 1;
if (CheckLocalFlag(offer->field_0xa) == 0) {
SetLocalFlag(offer->field_0xa);
@@ -326,7 +328,7 @@ void sub_08028E40(Entity* this) {
}
void sub_08028E84(Entity* this) {
if (UpdateFuseInteraction()) {
if (UpdateFuseInteraction(this)) {
this->action = 4;
this->actionDelay = 1;
}
+1
View File
@@ -1,5 +1,6 @@
#include "enemy.h"
#include "entity.h"
#include "random.h"
#include "functions.h"
extern s32 sub_080012DC(Entity*);
-4
View File
@@ -2,8 +2,6 @@
#include "entity.h"
#include "functions.h"
extern void sub_08078B48(void);
void sub_08027870(Entity*);
extern void (*const gUnk_080CC19C[])(Entity*);
@@ -36,13 +34,11 @@ void sub_08025CBC(Entity* this) {
void sub_08025DC0(Entity*);
void sub_08025CD4(Entity*);
void sub_08001242(Entity*);
void sub_08025DD8(Entity*);
void sub_08026060(Entity*);
void sub_08026110(Entity*);
void sub_080272D4(Entity*);
void sub_0802720C(Entity*);
void sub_0802720C(Entity*);
void sub_08026090(Entity*);
void sub_0802626C(Entity*);
void sub_08026580(Entity*);
+1
View File
@@ -1,5 +1,6 @@
#include "enemy.h"
#include "entity.h"
#include "random.h"
#include "functions.h"
extern Entity* sub_08049DF4(u32);
+3 -1
View File
@@ -1,4 +1,6 @@
#include "entity.h"
#include "enemy.h"
#include "random.h"
#include "functions.h"
typedef struct {
@@ -241,7 +243,7 @@ void sub_08020FAC(Entity* this) {
if (this->field_0x7a.HALF.LO) {
this->field_0x7a.HALF.LO--;
} else {
this->hurtBlinkTime = -8;
this->iframes = -8;
sub_08021390(this);
}
} else {
+2 -2
View File
@@ -4,7 +4,7 @@
extern s16 sub_080001DA(u32, u32); // ?
extern void sub_08049CF4();
extern u32 sub_0806FBFC(u32, u32, u32, u32);
extern u32 CheckPlayerProximity(u32, u32, u32, u32);
void sub_080221C0();
typedef struct {
@@ -54,7 +54,7 @@ void sub_08022034(Entity* this) {
void sub_0802209C(Entity* this) {
if (this->actionDelay == 0) {
if (sub_0806FBFC(this->field_0x78.HWORD, this->field_0x7a.HWORD, 0x10, 0x10)) {
if (CheckPlayerProximity(this->field_0x78.HWORD, this->field_0x7a.HWORD, 0x10, 0x10)) {
this->action = 2;
this->actionDelay = 0x12;
InitializeAnimation(this, this->type2 + 4);
+1
View File
@@ -1,4 +1,5 @@
#include "enemy.h"
#include "random.h"
#include "functions.h"
void sub_0802C4B0(Entity*);
+3 -1
View File
@@ -1,5 +1,7 @@
#include "global.h"
#include "entity.h"
#include "enemy.h"
#include "random.h"
#include "functions.h"
typedef struct {
@@ -79,7 +81,7 @@ void sub_08045454(Entity* this) {
tmp = 0;
ent->type2 = 1;
ent->height.HALF.HI = tmp;
ent->hurtBlinkTime = -0x10;
ent->iframes = -0x10;
/* Set MiniFireballGuy offset relative to killed slime. */
sub_08045178(this, ent, off->h, off->v);
+7 -6
View File
@@ -1,8 +1,9 @@
#include "global.h"
#include "entity.h"
#include "sprite.h"
#include "functions.h"
#include "enemy.h"
#include "random.h"
#include "functions.h"
// Gibudo
void sub_08037794();
void sub_08037B10();
@@ -337,12 +338,12 @@ NONMATCH("asm/non_matching/gibdo/sub_08037A58.inc", void sub_08037A58(Entity* th
sub_08037ACC(this);
this->action = 7;
this->spritePriority.b0 = (this->spritePriority.b0 & 0xf8) | 4;
if (this->hurtBlinkTime == 0) {
this->hurtBlinkTime = 0xec;
if (this->iframes == 0) {
this->iframes = 0xec;
}
this->damageType = 0x26;
this->flags2 |= 1;
this->hurtBlinkTime = 0xf4;
this->iframes = 0xf4;
this->field_0x3e = (this->animationState << 3) ^ 0x10;
this->field_0x42 = 8;
this->field_0x46 = 0x180;
@@ -354,7 +355,7 @@ END_NONMATCH
void sub_08037ACC(Entity* this) {
gPlayerState.flags.all &= 0xFFFFFEFF;
gPlayerEntity.flags |= 0x80;
gPlayerEntity.hurtBlinkTime = 0x1e;
gPlayerEntity.iframes = 0x1e;
gPlayerEntity.field_0x3e = DirectionFromAnimationState(this->animationState);
gPlayerEntity.field_0x42 = 4;
gPlayerEntity.field_0x46 = 0x180;
@@ -362,7 +363,7 @@ void sub_08037ACC(Entity* this) {
// Damage player maybe?
void sub_08037B10(Entity* this) {
u32 h;
gPlayerEntity.hurtBlinkTime = 0xc;
gPlayerEntity.iframes = 0xc;
h = ModHealth(-8);
sub_0800449C(&gPlayerEntity, 0x7a);
if (h == 0) {
+105 -106
View File
@@ -2,10 +2,10 @@
#include "enemy.h"
#include "player.h"
#include "room.h"
#include "trig.h"
#include "structures.h"
#include "functions.h"
#include "coord.h"
#include "fileScreen.h"
#include "random.h"
#include "functions.h"
void (*const gUnk_080D1AFC[8])(Entity*);
void (*const gUnk_080D1B1C[7])(Entity*);
@@ -26,57 +26,56 @@ const u8 gUnk_080D1C44[0xC];
const u16 gUnk_080D1C50[8];
const u16 gUnk_080D1C60[8];
void GyorgMale(Entity*);
void sub_08046898(Entity*); // action 0
void sub_08046910(Entity*); // action 1
void sub_08046930(Entity*); // action 1 previousActionFlag 0
void sub_0804696C(Entity*); // action 1 previousActionFlag 1
void sub_080469CC(Entity*); // action 1 previousActionFlag 2
void sub_080469F4(Entity*); // action 1 previousActionFlag 3
void sub_08046A30(Entity*); // action 1 previousActionFlag 4
void sub_08046A54(Entity*); // action 1 previousActionFlag 5
void sub_08046A78(Entity*); // action 1 previousActionFlag 6
void sub_08046930(Entity*); // action 1 subAction 0
void sub_0804696C(Entity*); // action 1 subAction 1
void sub_080469CC(Entity*); // action 1 subAction 2
void sub_080469F4(Entity*); // action 1 subAction 3
void sub_08046A30(Entity*); // action 1 subAction 4
void sub_08046A54(Entity*); // action 1 subAction 5
void sub_08046A78(Entity*); // action 1 subAction 6
void sub_08046A9C(Entity*); // action 2
void sub_08046AE8(Entity*); // action 2 previousActionFlag 0
void sub_08046B18(Entity*); // action 2 previousActionFlag 1
void sub_08046B8C(Entity*); // action 2 previousActionFlag 2
void sub_08046C04(Entity*); // action 2 previousActionFlag 3
void sub_08046C88(Entity*); // action 2 previousActionFlag 4
void sub_08046AE8(Entity*); // action 2 subAction 0
void sub_08046B18(Entity*); // action 2 subAction 1
void sub_08046B8C(Entity*); // action 2 subAction 2
void sub_08046C04(Entity*); // action 2 subAction 3
void sub_08046C88(Entity*); // action 2 subAction 4
void sub_08046CEC(Entity*); // action 3
void sub_08046D44(Entity*); // action 3 previousActionFlag 0
void sub_08046D98(Entity*); // action 3 previousActionFlag 1
void sub_08046E0C(Entity*); // action 3 previousActionFlag 2
void sub_08046E68(Entity*); // action 3 previousActionFlag 3
void sub_08046EF4(Entity*); // action 3 previousActionFlag 4
void sub_08046D44(Entity*); // action 3 subAction 0
void sub_08046D98(Entity*); // action 3 subAction 1
void sub_08046E0C(Entity*); // action 3 subAction 2
void sub_08046E68(Entity*); // action 3 subAction 3
void sub_08046EF4(Entity*); // action 3 subAction 4
void sub_08046F64(Entity*); // action 4
void sub_08046FE8(Entity*); // action 4 previousActionFlag 0
void sub_0804702C(Entity*); // action 4 previousActionFlag 1
void sub_080470B4(Entity*); // action 4 previousActionFlag 2
void sub_08047140(Entity*); // action 4 previousActionFlag 3
void sub_0804717C(Entity*); // action 4 previousActionFlag 4
void sub_080471C8(Entity*); // action 4 previousActionFlag 5
void sub_0804723C(Entity*); // action 4 previousActionFlag 6
void sub_08047284(Entity*); // action 4 previousActionFlag 7
void sub_080472BC(Entity*); // action 4 previousActionFlag 8
void sub_08047310(Entity*); // action 4 previousActionFlag 9
void sub_08046FE8(Entity*); // action 4 subAction 0
void sub_0804702C(Entity*); // action 4 subAction 1
void sub_080470B4(Entity*); // action 4 subAction 2
void sub_08047140(Entity*); // action 4 subAction 3
void sub_0804717C(Entity*); // action 4 subAction 4
void sub_080471C8(Entity*); // action 4 subAction 5
void sub_0804723C(Entity*); // action 4 subAction 6
void sub_08047284(Entity*); // action 4 subAction 7
void sub_080472BC(Entity*); // action 4 subAction 8
void sub_08047310(Entity*); // action 4 subAction 9
void sub_0804736C(Entity*); // action 5
void sub_080473B8(Entity*); // action 5 previousActionFlag 0
void sub_080473F0(Entity*); // action 5 previousActionFlag 1
void sub_08047484(Entity*); // action 5 previousActionFlag 2
void sub_08047508(Entity*); // action 5 previousActionFlag 3
void sub_080475F4(Entity*); // action 5 previousActionFlag 4
void sub_0804763C(Entity*); // action 5 previousActionFlag 5
void sub_0804772C(Entity*); // action 5 previousActionFlag 6
void sub_080473B8(Entity*); // action 5 subAction 0
void sub_080473F0(Entity*); // action 5 subAction 1
void sub_08047484(Entity*); // action 5 subAction 2
void sub_08047508(Entity*); // action 5 subAction 3
void sub_080475F4(Entity*); // action 5 subAction 4
void sub_0804763C(Entity*); // action 5 subAction 5
void sub_0804772C(Entity*); // action 5 subAction 6
void sub_08047778(Entity*); // action 6
void sub_08047798(Entity*); // action 6 previousActionFlag 0
void sub_080477F0(Entity*); // action 6 previousActionFlag 1
void sub_08047914(Entity*); // action 6 previousActionFlag 2
void sub_08047978(Entity*); // action 6 previousActionFlag 3
void sub_08047B08(Entity*); // action 6 previousActionFlag 4
void sub_08047798(Entity*); // action 6 subAction 0
void sub_080477F0(Entity*); // action 6 subAction 1
void sub_08047914(Entity*); // action 6 subAction 2
void sub_08047978(Entity*); // action 6 subAction 3
void sub_08047B08(Entity*); // action 6 subAction 4
void sub_08047B84(Entity*); // action 7
void sub_08047BA4(Entity*); // action 7 previousActionFlag 0
void sub_08047BF0(Entity*); // action 7 previousActionFlag 1, also called elsewhere
void sub_08047D24(Entity*); // action 7 previousActionFlag 2
void sub_08047BA4(Entity*); // action 7 subAction 0
void sub_08047BF0(Entity*); // action 7 subAction 1, also called elsewhere
void sub_08047D24(Entity*); // action 7 subAction 2
void sub_08047D88(Entity*); //
void sub_08047DF0(Entity*, u32);
void sub_08047E48(Entity*); //
@@ -118,7 +117,7 @@ void sub_08046898(Entity* this) {
tmp->parent = this;
this->attachedEntity = tmp;
this->action = 1;
this->previousActionFlag = 0;
this->subAction = 0;
this->spriteRendering.b0 = 3;
this->spriteSettings.b.draw = 1;
this->spriteOrientation.flipY = 2;
@@ -136,20 +135,20 @@ void (*const gUnk_080D1B1C[7])(Entity*) = { sub_08046930, sub_0804696C, sub_0804
sub_08046A30, sub_08046A54, sub_08046A78 };
void sub_08046910(Entity* this) {
gUnk_080D1B1C[this->previousActionFlag](this);
gUnk_080D1B1C[this->subAction](this);
UpdateAnimationSingleFrame(this);
}
void sub_08046930(Entity* this) {
if (this->type) {
this->previousActionFlag = 5;
this->subAction = 5;
this->direction = 0x20;
this->speed = 0x280;
}
sub_08047D88(this);
if (this->field_0x7c.BYTES.byte0 == 0)
return;
this->previousActionFlag = 1;
this->subAction = 1;
this->actionDelay = 1;
this->animationState = 0;
this->direction = 0;
@@ -159,17 +158,17 @@ void sub_08046930(Entity* this) {
void sub_0804696C(Entity* this) {
sub_08047E48(this);
if (gRoomControls.roomOriginY + 0x130 > this->y.HALF.HI) {
this->previousActionFlag = 2;
this->subAction = 2;
this->direction = 0x80;
this->speed = 0x100;
this->spriteOrientation.flipY = 3;
this->spriteRendering.b3 = 3;
SoundReq(0x2e);
SoundReq(BGM_BOSS_THEME);
}
if (this->actionDelay) {
if (gRoomControls.roomOriginY + 0x258 > this->y.HALF.HI) {
this->actionDelay = 0;
SoundReq(0xf7);
SoundReq(SFX_APPARATE);
}
}
}
@@ -177,7 +176,7 @@ void sub_0804696C(Entity* this) {
void sub_080469CC(Entity* this) {
sub_08047E48(this);
if (gRoomControls.roomOriginY + 0x210 < this->y.HALF.HI) {
this->previousActionFlag = 3;
this->subAction = 3;
this->direction = 0x90;
}
}
@@ -185,7 +184,7 @@ void sub_080469CC(Entity* this) {
void sub_080469F4(Entity* this) {
sub_08047E48(this);
if (gRoomControls.roomOriginY + 0x290 < this->y.HALF.HI) {
this->previousActionFlag = 4;
this->subAction = 4;
this->spriteOrientation.flipY = 2;
this->spriteRendering.b3 = 2;
}
@@ -195,14 +194,14 @@ void sub_08046A30(Entity* this) {
sub_08047D88(this);
if (((Entity*)this->myHeap)->prev->field_0x6c.HWORD & 1) {
this->action = 2;
this->previousActionFlag = 0;
this->subAction = 0;
}
}
void sub_08046A54(Entity* this) {
sub_08047E48(this);
if (gRoomControls.roomOriginX + 0x380 < this->x.HALF.HI) {
this->previousActionFlag = 6;
this->subAction = 6;
}
}
@@ -210,7 +209,7 @@ void sub_08046A78(Entity* this) {
sub_08047D88(this);
if (((Entity*)this->myHeap)->prev->field_0x6c.HWORD & 0x10) {
this->action = 3;
this->previousActionFlag = 0;
this->subAction = 0;
}
}
@@ -222,16 +221,16 @@ void sub_08046A9C(Entity* this) {
InitAnimationForceUpdate(this, 0);
}
}
gUnk_080D1B38[this->previousActionFlag](this);
gUnk_080D1B38[this->subAction](this);
UpdateAnimationSingleFrame(this);
if (this->field_0x7c.BYTES.byte0) {
this->action = 6;
this->previousActionFlag = 0;
this->subAction = 0;
}
}
void sub_08046AE8(Entity* this) {
this->previousActionFlag = 1;
this->subAction = 1;
this->speed = 0x180;
sub_08048178(this, ((Entity*)this->myHeap)->next->animationState >> 5);
this->field_0x76.HWORD = this->direction << 8;
@@ -248,7 +247,7 @@ void sub_08046B18(Entity* this) {
}
this->direction = this->field_0x76.HWORD >> 8;
} else {
this->previousActionFlag = 2;
this->subAction = 2;
}
sub_08047D88(this);
sub_08047EA4(this, ((0x100 - this->direction) & 0xFF) << 8);
@@ -256,7 +255,7 @@ void sub_08046B18(Entity* this) {
void sub_08046B8C(Entity* this) {
if (sub_0806FCB8(this, this->field_0x80.HWORD, this->field_0x82.HWORD, 4)) {
this->previousActionFlag = 3;
this->subAction = 3;
this->field_0x76.HWORD = this->direction << 8;
this->field_0x80.HWORD = gRoomControls.roomOriginX + 0x200;
this->field_0x82.HWORD = gRoomControls.roomOriginY + 0x210;
@@ -278,7 +277,7 @@ void sub_08046C04(Entity* this) {
}
this->direction = this->field_0x76.HWORD >> 8;
} else {
this->previousActionFlag = 4;
this->subAction = 4;
this->field_0x70.HALF.LO = ((tmp + 0x20) & 0xC0) >> 6;
}
sub_08047D88(this);
@@ -287,7 +286,7 @@ void sub_08046C04(Entity* this) {
void sub_08046C88(Entity* this) {
if (sub_0806FCB8(this, this->field_0x80.HWORD, this->field_0x82.HWORD, 4)) {
this->previousActionFlag = 1;
this->subAction = 1;
sub_08048178(this, sub_08048158(this->field_0x70.HALF_U.LO));
sub_08047D88(this);
} else {
@@ -305,11 +304,11 @@ void sub_08046CEC(Entity* this) {
InitAnimationForceUpdate(this, 1);
}
}
gUnk_080D1B4C[this->previousActionFlag](this);
gUnk_080D1B4C[this->subAction](this);
UpdateAnimationSingleFrame(this);
if (((Entity*)this->myHeap)->prev->field_0x6c.HWORD & 2) {
this->action = 2;
this->previousActionFlag = 0;
this->subAction = 0;
this->animationState = this->speed;
}
}
@@ -318,7 +317,7 @@ const u16 gUnk_080D1B60[8] = { 0x200, 0x184, 0x28C, 0x210, 0x200, 0x29C, 0x174,
void sub_08046D44(Entity* this) {
const u16* tmp;
this->previousActionFlag = 1;
this->subAction = 1;
this->speed = 0x200;
tmp = gUnk_080D1B60 + (((Entity*)this->myHeap)->next->animationState >> 5);
this->field_0x80.HWORD = tmp[0] + gRoomControls.roomOriginX;
@@ -337,7 +336,7 @@ void sub_08046D98(Entity* this) {
}
this->direction = this->field_0x76.HWORD >> 8;
} else {
this->previousActionFlag = 2;
this->subAction = 2;
}
sub_08047D88(this);
sub_08047EA4(this, ((0x100 - this->direction) & 0xFF) << 8);
@@ -345,7 +344,7 @@ void sub_08046D98(Entity* this) {
void sub_08046E0C(Entity* this) {
if (sub_0806FCB8(this, this->field_0x80.HWORD, this->field_0x82.HWORD, 4)) {
this->previousActionFlag = 3;
this->subAction = 3;
this->field_0x76.HWORD = this->direction << 8;
sub_08047D88(this);
} else {
@@ -369,7 +368,7 @@ void sub_08046E68(Entity* this) {
sub_08047D88(this);
sub_08047EA4(this, ((0x100 - this->direction) & 0xFF) << 8);
} else {
this->previousActionFlag = 4;
this->subAction = 4;
this->actionDelay = 0x3F;
this->field_0xf = 1;
this->direction = (gUnk_080D1B70[Random() & 1] + tmp) & 0xC0;
@@ -408,7 +407,7 @@ void sub_08046F64(Entity* this) {
InitAnimationForceUpdate(this, 1);
}
}
gUnk_080D1B94[this->previousActionFlag](this);
gUnk_080D1B94[this->subAction](this);
UpdateAnimationSingleFrame(this);
if (--this->field_0x7c.HALF.HI == 0) {
Entity* tmp;
@@ -422,12 +421,12 @@ void sub_08046F64(Entity* this) {
}
if (((Entity*)this->myHeap)->prev->field_0x6c.HWORD & 4) {
this->action = 5;
this->previousActionFlag = 0;
this->subAction = 0;
}
}
void sub_08046FE8(Entity* this) {
this->previousActionFlag = 1;
this->subAction = 1;
this->speed = 0x1c0;
this->field_0x7c.HALF.HI = 0x1e;
this->field_0x80.HWORD = gRoomControls.roomOriginX + 0x290;
@@ -446,7 +445,7 @@ void sub_0804702C(Entity* this) {
}
sub_08047DF0(this, ((0x100 - this->direction) & 0xFF) << 8);
if (sub_0806FCB8(this, this->field_0x80.HWORD, this->field_0x82.HWORD, (this->speed >> 0x10) + 0x10)) {
this->previousActionFlag = 2;
this->subAction = 2;
this->field_0x76.HWORD = this->direction << 8;
this->speed = 0x280;
}
@@ -466,7 +465,7 @@ void sub_080470B4(Entity* this) {
sub_08047D88(this);
sub_08047EA4(this, ((0x100 - this->direction) & 0xFF) << 8);
} else {
this->previousActionFlag = 3;
this->subAction = 3;
this->speed = 0x200;
this->field_0x76.HWORD = this->direction << 8;
this->field_0x74.HWORD = gUnk_080D1BBC[Random() & 1];
@@ -479,7 +478,7 @@ void sub_08047140(Entity* this) {
this->direction = this->field_0x76.HWORD >> 8;
if (this->direction > 0xbf) {
this->direction = 0xC0;
this->previousActionFlag = 4;
this->subAction = 4;
}
sub_08047DF0(this, ((0x100 - this->direction) & 0xFF) << 8);
}
@@ -490,7 +489,7 @@ void sub_0804717C(Entity* this) {
}
sub_08047DF0(this, ((0x100 - this->direction) & 0xFF) << 8);
if (gRoomControls.roomOriginX + 0x200 > this->x.HALF.HI) {
this->previousActionFlag = 5;
this->subAction = 5;
}
}
@@ -506,19 +505,19 @@ void sub_080471C8(Entity* this) {
return;
if (this->field_0x74.HWORD > 0x100) {
if (Random() & 1) {
this->previousActionFlag = 6;
this->subAction = 6;
} else {
this->previousActionFlag = 0;
this->subAction = 0;
}
} else {
this->previousActionFlag = 0;
this->subAction = 0;
}
}
void sub_0804723C(Entity* this) {
this->direction -= 2;
if (this->direction < 0xc0) {
this->previousActionFlag = 7;
this->subAction = 7;
this->speed = 0x200;
this->direction = 0xc0;
this->field_0x76.HWORD = 0xc000;
@@ -532,7 +531,7 @@ void sub_08047284(Entity* this) {
this->direction = this->field_0x76.HWORD >> 8;
if (this->direction < 0x40) {
this->direction = 0x40;
this->previousActionFlag = 8;
this->subAction = 8;
}
sub_08047DF0(this, ((0x100 - this->direction) & 0xFF) << 8);
}
@@ -544,7 +543,7 @@ void sub_080472BC(Entity* this) {
sub_08047DF0(this, ((0x100 - this->direction) & 0xFF) << 8);
if (gRoomControls.roomOriginX + 0x2B0 >= this->x.HALF.HI)
return;
this->previousActionFlag = 9;
this->subAction = 9;
this->field_0x76.HWORD = this->direction << 8;
}
@@ -556,7 +555,7 @@ void sub_08047310(Entity* this) {
this->direction = this->field_0x76.HWORD >> 8;
if ((u8)(this->direction + 0x7F) < 0x40) {
this->direction = 0xC0;
this->previousActionFlag = 4;
this->subAction = 4;
}
sub_08047DF0(this, ((0x100 - this->direction) & 0xFF) << 8);
}
@@ -570,16 +569,16 @@ void sub_0804736C(Entity* this) {
InitAnimationForceUpdate(this, 0);
}
}
gUnk_080D1BC0[this->previousActionFlag](this);
gUnk_080D1BC0[this->subAction](this);
UpdateAnimationSingleFrame(this);
if (this->currentHealth == 0) {
this->action = 7;
this->previousActionFlag = 0;
this->subAction = 0;
}
}
void sub_080473B8(Entity* this) {
this->previousActionFlag = 1;
this->subAction = 1;
this->speed = 0x120;
this->field_0x80.HWORD = gRoomControls.roomOriginX + 0x200;
this->field_0x82.HWORD = gRoomControls.roomOriginY + 0x1D0;
@@ -606,7 +605,7 @@ void sub_080473F0(Entity* this) {
}
sub_08047DF0(this, ((0x100 - this->direction) & 0xFF) << 8);
if (sub_0806FCB8(this, this->field_0x80.HWORD, this->field_0x82.HWORD, 8)) {
this->previousActionFlag = 2;
this->subAction = 2;
this->field_0x76.HWORD = this->direction << 8;
this->speed = 0x180;
}
@@ -624,7 +623,7 @@ void sub_08047484(Entity* this) {
sub_08047D88(this);
sub_08047EA4(this, ((0x100 - this->direction) & 0xFF) << 8);
} else {
this->previousActionFlag = 3;
this->subAction = 3;
this->speed = 0x200;
this->direction = 0x40;
this->field_0x76.HWORD = 0x4000;
@@ -664,7 +663,7 @@ void sub_08047508(Entity* this) {
}
sub_08047E48(this);
if (gRoomControls.roomOriginX + 0x280 < this->x.HALF.HI) {
this->previousActionFlag = 4;
this->subAction = 4;
this->speed = 0x200;
this->animationState = this->direction;
this->field_0x76.HWORD = this->direction << 8;
@@ -682,7 +681,7 @@ void sub_080475F4(Entity* this) {
this->direction = this->field_0x76.HWORD >> 8;
if (this->direction >= 0xc0) {
this->direction = 0xc0;
this->previousActionFlag = 5;
this->subAction = 5;
this->speed = 0x200;
this->field_0x7c.HALF.HI = 0x3c;
}
@@ -719,7 +718,7 @@ void sub_0804763C(Entity* this) {
}
sub_08047E48(this);
if (gRoomControls.roomOriginX + 0x180 > this->x.HALF.HI) {
this->previousActionFlag = 6;
this->subAction = 6;
this->speed = 0x200;
this->animationState = this->direction;
this->field_0x76.HWORD = this->direction << 8;
@@ -737,7 +736,7 @@ void sub_0804772C(Entity* this) {
this->direction = this->field_0x76.HWORD >> 8;
if (this->direction <= 0x40) {
this->direction = 0x40;
this->previousActionFlag = 3;
this->subAction = 3;
this->speed = 0x200;
this->field_0x7c.HALF.HI = 0x1e;
}
@@ -747,12 +746,12 @@ void sub_0804772C(Entity* this) {
void (*const gUnk_080D1BDC[5])(Entity*) = { sub_08047798, sub_080477F0, sub_08047914, sub_08047978, sub_08047B08 };
void sub_08047778(Entity* this) {
gUnk_080D1BDC[this->previousActionFlag](this);
gUnk_080D1BDC[this->subAction](this);
UpdateAnimationSingleFrame(this);
}
void sub_08047798(Entity* this) {
this->previousActionFlag = 1;
this->subAction = 1;
this->speed = 0x80;
if (this->x.HALF.HI - gRoomControls.roomOriginX < 0x1F8) {
this->field_0x80.HWORD = 0xa8;
@@ -774,7 +773,7 @@ void sub_080477F0(Entity* this) {
sub_08047E48(this);
if (!sub_0806FCB8(this, gPlayerEntity.x.HALF.HI, gPlayerEntity.y.HALF.HI, 0x80)) {
this->action = 2;
this->previousActionFlag = 0;
this->subAction = 0;
this->spriteOrientation.flipY = 2;
this->spriteRendering.b3 = 2;
this->direction = this->animationState;
@@ -785,7 +784,7 @@ void sub_080477F0(Entity* this) {
this->spriteRendering.b3 = 3;
}
if (sub_0806FCB8(this, this->field_0x80.HWORD, this->field_0x82.HWORD, 4)) {
this->previousActionFlag = 2;
this->subAction = 2;
this->field_0x76.HWORD = this->animationState << 8;
this->field_0x74.HWORD = gUnk_080D1BF0[Random() & 1];
if (((Entity*)this->myHeap)->prev->field_0x6c.HWORD & 1) {
@@ -804,7 +803,7 @@ void sub_08047914(Entity* this) {
this->animationState = this->field_0x76.HWORD >> 8;
sub_08047EA4(this, ((0x100 - this->animationState) & 0xFF) << 8);
} else {
this->previousActionFlag = 3;
this->subAction = 3;
this->field_0x70.HALF.LO = 0x3C;
this->field_0x7c.HALF.HI = ((this->type * 0xF) << 2) + 0x78;
sub_080A1D70(((Entity*)this->myHeap)->prev, this->animationState);
@@ -839,7 +838,7 @@ void sub_08047978(Entity* this) {
}
if (!sub_0806FCB8(this, gPlayerEntity.x.HALF.HI, gPlayerEntity.y.HALF.HI, 0x80)) {
this->action = 2;
this->previousActionFlag = 0;
this->subAction = 0;
this->spriteOrientation.flipY = 2;
this->spriteRendering.b3 = 2;
this->direction = this->animationState;
@@ -848,7 +847,7 @@ void sub_08047978(Entity* this) {
return;
if (this->attachedEntity->action != 1)
return;
this->previousActionFlag = 4;
this->subAction = 4;
if (this->type == 0) {
if ((((Entity*)this->myHeap)->next->animationState >> 6) == 1) {
this->field_0x80.HWORD = gRoomControls.roomOriginX + 0x1C0;
@@ -882,11 +881,11 @@ void sub_08047B08(Entity* this) {
return;
if (this->type == 0) {
this->action = 7;
this->previousActionFlag = 0;
this->subAction = 0;
this->direction ^= 0x80;
} else {
this->action = 4;
this->previousActionFlag = 0;
this->subAction = 0;
this->spriteOrientation.flipY = 2;
this->spriteRendering.b3 = 2;
this->direction = this->animationState;
@@ -896,12 +895,12 @@ void sub_08047B08(Entity* this) {
void (*const gUnk_080D1BF4[3])(Entity*) = { sub_08047BA4, sub_08047BF0, sub_08047D24 };
void sub_08047B84(Entity* this) {
gUnk_080D1BF4[this->previousActionFlag](this);
gUnk_080D1BF4[this->subAction](this);
UpdateAnimationSingleFrame(this);
}
void sub_08047BA4(Entity* this) {
this->previousActionFlag = 1;
this->subAction = 1;
this->actionDelay = 0x78;
this->field_0xf = 0;
if (gRoomControls.roomOriginX + 0x200 < this->x.HALF.HI) {
@@ -937,7 +936,7 @@ void sub_08047BF0(Entity* this) {
this->speed = 0x140;
sub_08047E48(this);
if (this->y.HALF.HI > gRoomControls.roomOriginY + 0x270) {
this->previousActionFlag = 2;
this->subAction = 2;
this->field_0x7c.HALF.HI = 0xAA;
SoundReq(0x12D);
InitAnimationForceUpdate(this, 1);
+1
View File
@@ -1,4 +1,5 @@
#include "entity.h"
#include "enemy.h"
#include "functions.h"
extern void (*const gHangingSeedFunctions[])(Entity*);
+8 -7
View File
@@ -1,4 +1,5 @@
#include "enemy.h"
#include "random.h"
#include "functions.h"
extern void sub_08008796(Entity*, u32, u32, u32);
@@ -62,16 +63,16 @@ void sub_0802BBC4(Entity* this) {
void sub_0802BC20(Entity* this) {
if (this->damageType != 0x19) {
if (sub_0806F520(this)) {
gUnk_080CD42C[this->previousActionFlag](this);
gUnk_080CD42C[this->subAction](this);
}
} else if (2 < this->previousActionFlag || sub_0806F520(this)) {
gUnk_080CD438[this->previousActionFlag](this);
} else if (2 < this->subAction || sub_0806F520(this)) {
gUnk_080CD438[this->subAction](this);
}
}
void sub_0802BC74(Entity* this) {
sub_0802C1C0(this);
this->previousActionFlag = 1;
this->subAction = 1;
this->field_0x1d = 60;
this->animationState = (gPlayerEntity.animationState >> 1) ^ 2;
InitializeAnimation(this, this->animationState);
@@ -101,7 +102,7 @@ void sub_0802BCA8(Entity* this) {
}
void sub_0802BCFC(Entity* this) {
this->previousActionFlag = 1;
this->subAction = 1;
this->field_0x1d = 60;
}
@@ -259,7 +260,7 @@ void sub_0802BF78(Entity* this) {
void sub_0802BF98(Entity* this) {
if (sub_0806F520(this)) {
gUnk_080CD450[this->previousActionFlag](this);
gUnk_080CD450[this->subAction](this);
} else {
this->action = 2;
this->actionDelay = 30;
@@ -268,7 +269,7 @@ void sub_0802BF98(Entity* this) {
}
void sub_0802BFD0(Entity* this) {
this->previousActionFlag = 2;
this->subAction = 2;
}
void sub_0802BFD8(Entity* this) {
+6 -4
View File
@@ -1,5 +1,7 @@
#include "global.h"
#include "entity.h"
#include "enemy.h"
#include "random.h"
#include "functions.h"
extern Entity* gUnk_020000B0;
@@ -164,17 +166,17 @@ void sub_08032650(Entity* this) {
sub_0803269C(this, this->direction);
}
void sub_0803269C(Entity* this, u32 param_2) {
void sub_0803269C(Entity* this, u32 direction) {
u32 uVar1;
if (((param_2 - 3) & 7) < 3) {
uVar1 = DirectionToAnimationState(param_2);
if (((direction - 3) & 7) < 3) {
uVar1 = DirectionToAnimationState(direction);
if (((this->animationState - uVar1) & 3) > 1) {
this->animationState = uVar1;
InitAnimationForceUpdate(this, (this->animIndex & 0xFC) + uVar1);
}
} else {
uVar1 = DirectionToAnimationState(param_2);
uVar1 = DirectionToAnimationState(direction);
if (uVar1 != this->animationState) {
this->animationState = uVar1;
InitAnimationForceUpdate(this, (this->animIndex & 0xFC) + uVar1);
+3 -9
View File
@@ -2,19 +2,13 @@
#include "entity.h"
#include "enemy.h"
#include "player.h"
#include "random.h"
#include "functions.h"
extern void sub_08001328(Entity*);
extern u32 sub_0806F520(Entity*);
extern void sub_0806F4E8(Entity*);
extern u32 sub_0806F3E4(Entity*);
extern void sub_0804A7D4(Entity*);
extern void sub_0804A720(Entity*);
extern void Keese_StartFly(Entity*);
extern void sub_080AEFB4(Entity*);
extern void sub_08021F24(Entity*);
extern u32 sub_08049FA0(Entity*);
extern u32 sub_08049EE4(Entity*);
extern void (*const gKeeseFunctions[])(Entity*);
extern void (*const gKeeseActions[])(Entity*);
@@ -43,12 +37,12 @@ void sub_08021d98(Entity* this) {
void sub_08021DA8(Entity* this) {
if (sub_0806F520(this)) {
gUnk_080CB6C4[this->previousActionFlag](this);
gUnk_080CB6C4[this->subAction](this);
}
}
void sub_08021DCC(Entity* this) {
this->previousActionFlag = 2;
this->subAction = 2;
}
void sub_08021DD4(Entity* this) {
+4 -51
View File
@@ -1,57 +1,13 @@
#include "global.h"
#include "entity.h"
#include "enemy.h"
#include "functions.h"
#include "trig.h"
#include "coord.h"
#include "random.h"
#include "player.h"
extern void (*const LakituActionFuncs[])(Entity*);
// Lakitu
extern void EnemyFunctionHandler(Entity*, void (*const funcs[])(Entity*));
// sub_0803C784
extern void sub_0804AA30(Entity*, void (*const funcs[])(Entity*));
// sub_0803C820
extern u32 sub_0806F520(Entity*);
// sub_0803C850
extern void sub_0806F4E8(Entity*);
// Lakitu_Initialize
extern void sub_0804A720(Entity*);
// Lakitu_Cloudless
extern u32 sub_08003FC4(Entity*, u32);
// sub_0803CA4C
extern u32 sub_080041A0(Entity*, Entity*, u32, u32);
// sub_0803CAD0
extern u32 sub_080AEFE0(Entity*);
// Lakitu_SpawnLightning
void PositionRelative(Entity*, Entity*, s32, s32);
extern void EnqueueSFX(u32);
// sub_0803CC08
extern void DeleteEntity(Entity*);
// Part of function tables
extern void sub_08001324(Entity*);
extern void sub_0804A7D4(Entity*);
extern void sub_08001242(Entity*);
// Used in multiple functions
extern Entity* CreateFx(Entity*, u32, u32);
extern Entity* sub_0804A98C(Entity* positionEntity, u8 subtype,
u8 form); // Creates a projectile positioned at the given entity
extern void UpdateAnimationSingleFrame(Entity*);
extern void InitAnimationForceUpdate(Entity*, u32);
extern u32 sub_0806FCB8(Entity*, u32, u32, u32);
extern u32 GetFacingDirection(Entity*, Entity*);
// Forward references to functions in lakitu.c
extern void sub_0803CAD0(Entity*);
extern void sub_0803CBAC(Entity*);
@@ -78,9 +34,6 @@ typedef struct {
s8 y;
} PACKED OffsetCoords;
// sub_0803CC08
extern void DeleteEntity(Entity*);
// Variables
extern void (*const gUnk_080D0110[])(Entity*);
extern void (*const gUnk_080D0128[])(Entity*);
@@ -140,12 +93,12 @@ void sub_0803C784(Entity* this) {
void sub_0803C820(Entity* this) {
if (sub_0806F520(this)) {
gUnk_080D0148[this->previousActionFlag](this);
gUnk_080D0148[this->subAction](this);
}
}
void sub_0803C844(Entity* this) {
this->previousActionFlag = 1;
this->subAction = 1;
this->field_0x1d = 0x3c;
}
+4 -12
View File
@@ -1,25 +1,17 @@
#include "global.h"
#include "entity.h"
#include "player.h"
#include "functions.h"
extern u32 GetNextFunction(Entity*);
extern void sub_0804A7D4(Entity*);
extern void sub_08001242(Entity*);
extern void (*const gUnk_080D0418[6])(Entity*);
extern void (*const gUnk_080D0430[3])(Entity*);
extern void (*const gUnk_080D043C[3])(Entity*);
extern bool32 sub_0806F3E4(Entity*);
extern bool32 sub_0806F520(Entity*);
extern void sub_0800449C(Entity*, u32);
extern void sub_0803CE14(Entity*);
extern void sub_0803CE3C(Entity*);
extern Entity* GetCurrentRoomProperty(u8);
extern void sub_0806F4E8(Entity*);
extern void sub_0806F69C(Entity*);
extern void sub_08079D84(void);
extern void sub_080A2CC0(Entity*, Entity**, u16*);
@@ -38,16 +30,16 @@ void sub_0803CCEC(Entity* this) {
void sub_0803CCFC(Entity* this) {
if (sub_0806F520(this) == 0) {
if (this->previousActionFlag == 2) {
if (this->subAction == 2) {
sub_0803CE3C(this);
}
} else {
gUnk_080D043C[this->previousActionFlag](this);
gUnk_080D043C[this->subAction](this);
}
}
void sub_0803CD2C(Entity* this) {
this->previousActionFlag = 1;
this->subAction = 1;
this->field_0x1d = 0x3c;
}
+2 -7
View File
@@ -1,19 +1,14 @@
#include "global.h"
#include "entity.h"
#include "enemy.h"
#include "random.h"
#include "functions.h"
#include "coord.h"
extern void SetChildOffset(Entity*, s32, s32, s32);
extern void sub_0804AA30(Entity*, void (*const func[])(Entity*));
extern void sub_0804A7D4(Entity*);
extern Entity* CreateDeathFx(Entity*, u32, u32);
extern void sub_0804A720(Entity*);
extern u32 sub_080002D4(s32, s32, u32);
extern u32 sub_080002BC(s32, s32, u32);
extern u32 sub_08049FDC(Entity*, u32);
extern Entity* gUnk_020000B0;
extern s16 gSineTable[];
bool32 Leever_PlayerInRange(Entity*, s32);
void Leever_Move(Entity*);
+6 -5
View File
@@ -1,11 +1,12 @@
#include "enemy.h"
#include "entity.h"
#include "functions.h"
#include "textbox.h"
#include "save.h"
#include "random.h"
#include "createObject.h"
#include "functions.h"
extern bool32 sub_080544B4(u32);
extern void sub_0807CAA0(u32, u32);
void sub_0802810C(Entity*);
void sub_080281A0(Entity*);
@@ -210,7 +211,7 @@ void sub_0802810C(Entity* this) {
gPlayerState.flags.all &= 0xffffffef;
gPlayerEntity.flags |= 0x80;
gPlayerEntity.field_0x20 = 0x18000;
gPlayerEntity.hurtBlinkTime = -60;
gPlayerEntity.iframes = -60;
gPlayerEntity.direction = gPlayerEntity.animationState << 2;
gPlayerEntity.spritePriority.b1 = this->field_0x82.HALF.HI;
gPlayerEntity.height.HALF.HI = gPlayerEntity.spriteOffsetY;
@@ -219,8 +220,8 @@ void sub_0802810C(Entity* this) {
this->actionDelay = 0x50;
this->field_0xf = 0;
this->flags2 |= 2;
if (this->hurtBlinkTime == 0) {
this->hurtBlinkTime = -18;
if (this->iframes == 0) {
this->iframes = -18;
}
}
#else
+3 -2
View File
@@ -1,5 +1,6 @@
#include "enemy.h"
#include "entity.h"
#include "random.h"
#include "functions.h"
extern u8 gEntCount;
@@ -460,12 +461,12 @@ void sub_0802A098(Entity* this) {
void sub_0802A0F8(Entity* this) {
if (this->currentHealth != 0) {
if ((this->bitfield & 0x80) && this->hurtBlinkTime != 0) {
if ((this->bitfield & 0x80) && this->iframes != 0) {
Entity* ent = this;
u32 i;
for (i = 0; i < 6; i++) {
ent = ent->attachedEntity;
ent->hurtBlinkTime = this->hurtBlinkTime;
ent->iframes = this->iframes;
}
}
} else {
+2 -4
View File
@@ -1,11 +1,9 @@
#include "global.h"
#include "entity.h"
#include "enemy.h"
#include "random.h"
#include "functions.h"
extern void EnemyFunctionHandler(Entity*, void (*const func[])(Entity*));
extern void sub_0804A7D4(Entity*);
extern void sub_0804A720(Entity*);
extern void sub_08045678(Entity*);
extern void sub_08045678(Entity*);
extern void (*const gUnk_080D1868[])(Entity*);
+3 -6
View File
@@ -1,16 +1,13 @@
#include "global.h"
#include "entity.h"
#include "room.h"
#include "enemy.h"
#include "random.h"
#include "functions.h"
void sub_08045374(Entity*);
extern u32 sub_0806FA04(u32, u32);
extern void sub_0804A720();
extern void sub_080452E4();
extern void sub_0804AA30();
extern void ReplaceMonitoredEntity(Entity*, Entity*);
extern void sub_0804A7D4(Entity*);
extern void (*const gUnk_080D17C0[])(Entity*);
extern void (*const gUnk_080D17D8[])(Entity*);
@@ -72,7 +69,7 @@ void sub_080452FC(Entity* this) {
this->action = 3;
this->actionDelay = 1;
if (0 < this->speed)
this->actionDelay = sub_0806FA04(0x1000, this->speed) >> 0x8;
this->actionDelay = FixedDiv(0x1000, this->speed) >> 0x8;
if (sub_08049FA0(this) == 0 && (Random() & 3)) {
cVar2 = sub_08049EE4(this);
+4 -3
View File
@@ -1,5 +1,6 @@
#include "enemy.h"
#include "entity.h"
#include "random.h"
#include "functions.h"
void sub_08022EAC(Entity*);
@@ -40,9 +41,9 @@ void sub_08022BEC(Entity* this) {
this->animationState = ((this->direction + 2) & 0x1c) >> 2;
this->frameIndex = this->animationState;
this->attachedEntity->hurtBlinkTime = this->hurtBlinkTime;
(*(Entity**)&this->field_0x7c)->hurtBlinkTime = this->hurtBlinkTime;
(*(Entity**)&this->field_0x80)->hurtBlinkTime = this->hurtBlinkTime;
this->attachedEntity->iframes = this->iframes;
(*(Entity**)&this->field_0x7c)->iframes = this->iframes;
(*(Entity**)&this->field_0x80)->iframes = this->iframes;
sub_0804AA30(this, gUnk_080CBBA0);
}
+9 -8
View File
@@ -1,5 +1,6 @@
#include "enemy.h"
#include "entity.h"
#include "random.h"
#include "functions.h"
extern void sub_0800449C(Entity*, u32);
@@ -67,12 +68,12 @@ void sub_080230CC(Entity* this) {
}
void sub_080230E4(Entity* this) {
if (this->previousActionFlag == 0xff) {
if (this->subAction == 0xff) {
this->action = 7;
this->actionDelay = 1;
this->previousActionFlag = 0;
this->subAction = 0;
this->damageType = 0x85;
this->hurtBlinkTime = -8;
this->iframes = -8;
this->field_0x7c.BYTES.byte3 = 0;
this->field_0x7a.HALF.HI = 0;
if (this->bitfield == 0x80 || this->bitfield == 0x9e) {
@@ -90,7 +91,7 @@ void sub_080230E4(Entity* this) {
gPlayerEntity.spriteSettings.b.draw = 1;
gPlayerEntity.field_0x20 = 0x18000;
gPlayerEntity.direction = 0xff;
gPlayerEntity.hurtBlinkTime = -0x14;
gPlayerEntity.iframes = -0x14;
gPlayerState.jumpStatus = 0x41;
gPlayerState.flags.all &= 0xfff7ffff;
}
@@ -410,7 +411,7 @@ void sub_08023894(Entity* this) {
gPlayerEntity.y.HALF.HI = this->y.HALF.HI;
gPlayerEntity.direction = DirectionRoundUp(GetFacingDirection(*(Entity**)&this->field_0x74, this));
gPlayerEntity.animationState = gPlayerEntity.direction >> 2;
gPlayerEntity.hurtBlinkTime = 12;
gPlayerEntity.iframes = 12;
ModHealth(-0x10);
sub_0800449C(&gPlayerEntity, 0x7a);
}
@@ -421,7 +422,7 @@ void sub_0802390C(Entity* this) {
if (this->bitfield & 0x80) {
Entity* ent = this->attachedEntity;
do {
ent->hurtBlinkTime = this->hurtBlinkTime;
ent->iframes = this->iframes;
} while (ent = ent->attachedEntity, ent != NULL);
} else {
Entity* ent = this->attachedEntity;
@@ -431,7 +432,7 @@ void sub_0802390C(Entity* this) {
if (bVar2 != 0) {
u32 tmp;
ent->currentHealth = 0xff;
tmp = (u8)ent->hurtBlinkTime;
tmp = (u8)ent->iframes;
if (this->currentHealth >= bVar2) {
this->currentHealth -= bVar2;
} else {
@@ -440,7 +441,7 @@ void sub_0802390C(Entity* this) {
ent = this;
do {
ent->hurtBlinkTime = tmp;
ent->iframes = tmp;
} while (ent = ent->attachedEntity, ent != NULL);
break;
}
+5 -11
View File
@@ -1,15 +1,9 @@
#include "global.h"
#include "entity.h"
#include "enemy.h"
#include "random.h"
#include "functions.h"
extern void EnemyFunctionHandler();
extern void SetChildOffset();
extern void sub_0804AA30();
extern void sub_0804A7D4();
extern u32 sub_0806F520();
extern void sub_0806F4E8();
extern void UpdateAnimationVariableFrames();
extern void sub_0804A720();
extern Entity* sub_08049DF4(u32);
void Octorok_Pause();
@@ -55,16 +49,16 @@ void sub_0801EB0C(Entity* this) {
}
void sub_0801EB2C(Entity* this) {
if (this->previousActionFlag < 3 && !sub_0806F520(this)) {
if (this->subAction < 3 && !sub_0806F520(this)) {
Octorok_Pause(this);
InitializeAnimation(this, this->animationState);
} else {
gUnk_080CA158[this->previousActionFlag](this);
gUnk_080CA158[this->subAction](this);
}
}
void sub_0801EB68(Entity* this) {
this->previousActionFlag = 1;
this->subAction = 1;
this->field_0x1d = 60;
}
+8 -6
View File
@@ -1,4 +1,6 @@
#include "entity.h"
#include "enemy.h"
#include "random.h"
#include "functions.h"
extern void (*const gPeahatFunctions[])(Entity*);
@@ -58,14 +60,14 @@ void sub_0801FFDC(Entity* this) {
this->animationState = PeahatAnimation_SlicedPropeller;
this->action = 5;
this->speed = 0x80;
this->hurtBlinkTime = -30;
this->iframes = -30;
this->field_0x80.HALF.HI = 0;
InitializeAnimation(this, this->animationState);
} else if (this->bitfield == 0x9b) {
this->animationState = PeahatAnimation_BrokenPropeller;
this->action = 5;
this->speed = 0x80;
this->hurtBlinkTime = -30;
this->iframes = -30;
this->field_0x80.HALF.HI = 0;
InitializeAnimation(this, this->animationState);
} else if (this->bitfield == 0x80) {
@@ -87,14 +89,14 @@ void sub_0801FFDC(Entity* this) {
}
void sub_08020088(Entity* this) {
if (2 >= this->previousActionFlag && !sub_0806F520(this))
if (2 >= this->subAction && !sub_0806F520(this))
return;
gUnk_080CA5BC[this->previousActionFlag](this);
gUnk_080CA5BC[this->subAction](this);
}
void sub_080200B4(Entity* this) {
this->previousActionFlag = 1;
this->subAction = 1;
this->field_0x1d = 60;
if (this->animationState == PeahatAnimation_Flying) {
this->animationState = PeahatAnimation_BrokenPropeller;
@@ -150,7 +152,7 @@ void Peahat_Fly(Entity* this) {
if (sub_08049FDC(this, 1)) {
if (this->field_0x82.HALF.HI == 0 && (this->field_0xf & 0xf) == 0 && sub_08049F1C(this, gUnk_020000B0, 0x30)) {
this->action = 2;
this->previousActionFlag = Random() & 3;
this->subAction = Random() & 3;
this->actionDelay = 60;
this->speed = 160;
}
+15 -14
View File
@@ -1,15 +1,16 @@
#include "enemy.h"
#include "entity.h"
#include "random.h"
#include "createObject.h"
#include "game.h"
#include "functions.h"
extern u32 sub_080002E0(u16, u32);
extern u32 CheckIsDungeon(void);
extern void sub_0800449C(Entity*, u32);
extern u32 sub_08049F1C(Entity*, Entity*, u32);
extern void sub_0804AA30(Entity*, void (*const funcs[])(Entity*));
extern u32 PlayerInRange(Entity*, u32, u32);
extern void sub_080AEFB4(Entity*);
extern Entity* FindNextEntityOfSameSubtype(Entity* ent, int listIndex);
extern Entity* FindNextDuplicateID(Entity* ent, int listIndex);
void sub_080249F4(Entity*);
void sub_08024940(Entity*);
@@ -78,20 +79,20 @@ void sub_08023FE0(Entity* this) {
}
void sub_08023FF0(Entity* this) {
if (this->previousActionFlag < 3 && !sub_0806F520(this)) {
if (this->subAction < 3 && !sub_0806F520(this)) {
this->action = 1;
this->previousActionFlag = 0;
this->subAction = 0;
this->flags |= 0x80;
this->damageType = 0x77;
this->actionDelay = 1;
this->speed = 0x40;
} else {
gUnk_080CBEF8[this->previousActionFlag](this);
gUnk_080CBEF8[this->subAction](this);
}
}
void sub_08024038(Entity* this) {
this->previousActionFlag = 1;
this->subAction = 1;
this->field_0x1d = 60;
GetNextFrame(this);
}
@@ -129,7 +130,7 @@ void sub_080240B8(Entity* this) {
u32 direction = (Random() & 0xc0) >> 3;
sub_0804A720(this);
this->action = 1;
this->previousActionFlag = 0;
this->subAction = 0;
this->field_0x80.HALF.LO = 0;
if (direction & 8) {
this->y.HALF.HI += (direction & 0x10) ? -0x20 : 0x20;
@@ -665,7 +666,7 @@ bool32 sub_08024B38(Entity* this) {
}
}
ent = FindEntityInListBySubtype(8, 2, 2);
ent = FindEntityByID(8, 2, 2);
if (ent) {
do {
if (ent->action != 2 && ent->height.HALF.HI == 0 && sub_08049F1C(this, ent, 0xa0)) {
@@ -675,14 +676,14 @@ bool32 sub_08024B38(Entity* this) {
this->field_0x82.HALF.HI &= ~0x40;
break;
}
} while (ent = FindNextEntityOfSameSubtype(ent, 2), ent != NULL);
} while (ent = FindNextDuplicateID(ent, 2), ent != NULL);
}
if (iVar4 != 0) {
return iVar4;
}
ent = FindEntityInListBySubtype(6, 5, 6);
ent = FindEntityByID(6, 5, 6);
if (ent) {
do {
if (ent->action == 1 && sub_08049F1C(this, ent, 0xa0)) {
@@ -692,7 +693,7 @@ bool32 sub_08024B38(Entity* this) {
this->field_0x82.HALF.HI &= ~0x40;
break;
}
} while (ent = FindNextEntityOfSameSubtype(ent, 6), ent != NULL);
} while (ent = FindNextDuplicateID(ent, 6), ent != NULL);
}
if (iVar4 == 0) {
@@ -829,7 +830,7 @@ void sub_08024E4C(Entity* this) {
player->spritePriority.b1 = 0;
if (this->field_0xf == 0) {
(this->field_0x86.HALF.HI++;
player->hurtBlinkTime = 8;
player->iframes = 8;
ModHealth(-2);
sub_0800449C(player, 0x7a);
}
@@ -849,7 +850,7 @@ void sub_08024F50(Entity* this) {
CopyPosition(this, &gPlayerEntity);
gPlayerEntity.action = 1;
gPlayerEntity.flags |= 0x80;
gPlayerEntity.hurtBlinkTime = -0x3c;
gPlayerEntity.iframes = -0x3c;
gPlayerEntity.direction = gPlayerEntity.animationState << 2;
gPlayerEntity.speed = 0;
gPlayerEntity.spritePriority.b1 = this->cutsceneBeh.HALF.HI;
+5 -5
View File
@@ -1,5 +1,6 @@
#include "enemy.h"
#include "entity.h"
#include "random.h"
#include "functions.h"
extern u32 sub_080002E0(u32, u32);
@@ -8,7 +9,6 @@ extern u16 sub_080002A8(u32, u32, u32);
extern u16 sub_080002D4(u32, u32, u32);
extern void sub_0804AA1C(Entity*);
extern Entity* sub_08049DF4(u32);
extern void sub_0807B7D8(u32, u32, u32);
extern u8 gUnk_080B37A0[];
extern u8 gUnk_080B3E80[];
@@ -74,7 +74,7 @@ void sub_08025020(Entity* this) {
if (0 < this->field_0x20) {
this->field_0x20 = 0;
}
this->hurtBlinkTime = -0xc;
this->iframes = -0xc;
this->field_0x42 = 0;
if (this->field_0x80.HALF.LO == 0) {
this->animationState = (*(Entity**)&this->field_0x4c)->direction >> 3;
@@ -84,7 +84,7 @@ void sub_08025020(Entity* this) {
}
break;
default:
if (this->damageType == 0x82 && this->hurtBlinkTime < 0) {
if (this->damageType == 0x82 && this->iframes < 0) {
Entity* ent = CreateObject(0x21, 2, 0);
if (ent != NULL) {
ent->spritePriority.b0 = 3;
@@ -108,14 +108,14 @@ void sub_0802511C(Entity* this) {
void sub_0802514C(Entity* this) {
sub_08003FC4(this, 0x2000);
if (sub_0806F520(this)) {
gUnk_080CBFEC[this->previousActionFlag](this);
gUnk_080CBFEC[this->subAction](this);
} else {
sub_08025C2C(this);
}
}
void sub_08025180(Entity* this) {
this->previousActionFlag = 1;
this->subAction = 1;
this->actionDelay = Random();
this->animationState = (((*(Entity**)&this->field_0x4c)->direction ^ 0x10) >> 3);
InitializeAnimation(this, this->animationState + 4);
+3 -2
View File
@@ -1,5 +1,6 @@
#include "enemy.h"
#include "entity.h"
#include "random.h"
#include "functions.h"
extern void sub_0804A4E4(Entity*, Entity*);
@@ -43,7 +44,7 @@ void sub_08022254(Entity* this) {
ent = CreateEnemy(1, 1);
if (ent) {
ent->type2 = 1;
ent->hurtBlinkTime = -8;
ent->iframes = -8;
sub_0804A4E4(this, ent);
this->action = 2;
this->flags &= ~0x80;
@@ -96,7 +97,7 @@ void sub_080223E4(Entity* this) {
ent = this->attachedEntity;
if (ent) {
ent->bitfield = 0x94;
ent->hurtBlinkTime = 0x10;
ent->iframes = 0x10;
ent->field_0x42 = 0xc;
ent->field_0x3e = this->direction;
}
+7 -5
View File
@@ -1,4 +1,6 @@
#include "entity.h"
#include "enemy.h"
#include "random.h"
#include "functions.h"
extern void (*const gRollobiteFunctions[])(Entity*);
@@ -63,18 +65,18 @@ void sub_080206E0(Entity* this) {
}
void sub_08020734(Entity* this) {
if (this->previousActionFlag < 3 && !sub_0806F520(this)) {
if (this->subAction < 3 && !sub_0806F520(this)) {
this->action = 4;
this->flags |= 0x80;
this->direction = 0xff;
InitializeAnimation(this, this->animationState + 0x10);
} else {
gUnk_080CA6A4[this->previousActionFlag](this);
gUnk_080CA6A4[this->subAction](this);
}
}
void sub_0802077C(Entity* this) {
this->previousActionFlag = 1;
this->subAction = 1;
this->field_0x1d = 60;
}
@@ -132,11 +134,11 @@ void Rollobite_Walk(Entity* this) {
}
void sub_08020874(Entity* this) {
gUnk_080CA6BC[this->previousActionFlag](this);
gUnk_080CA6BC[this->subAction](this);
}
void sub_0802088C(Entity* this) {
this->previousActionFlag = 1;
this->subAction = 1;
this->flags &= ~0x80;
this->cutsceneBeh.HALF.HI = gPlayerEntity.animationState;
this->spritePriority.b1 = 0;
+7 -7
View File
@@ -1,8 +1,8 @@
#include "global.h"
#include "entity.h"
#include "sprite.h"
#include "functions.h"
#include "enemy.h"
#include "random.h"
#include "functions.h"
extern void (*const gRope[6])(Entity*);
extern void (*const gUnk_080CE460[4])(Entity*);
@@ -36,12 +36,12 @@ void sub_080313AC(Entity* this) {
void sub_080313E8(Entity* this) {
if (sub_0806F520()) {
gUnk_080CE470[this->previousActionFlag](this);
gUnk_080CE470[this->subAction](this);
}
}
void sub_0803140C(Entity* this) {
this->previousActionFlag = 1;
this->subAction = 1;
this->field_0x1d = 0x3c;
}
@@ -65,7 +65,7 @@ void sub_08031434(Entity* this) {
sub_08031600(this);
} else {
this->action = 1;
this->previousActionFlag = 0;
this->subAction = 0;
this->spriteSettings.b.draw = (this->spriteSettings.b.draw & 0xfc);
this->height.HALF.HI = -0x80;
this->frameIndex = 0xff;
@@ -73,13 +73,13 @@ void sub_08031434(Entity* this) {
}
void sub_08031480(Entity* this) {
if (this->previousActionFlag == 0) {
if (this->subAction == 0) {
if (this->actionDelay != 0) {
this->actionDelay--;
} else {
sub_08031600(this);
this->action = 1;
this->previousActionFlag = 1;
this->subAction = 1;
this->spriteSettings.b.draw = 3;
this->spriteRendering.b3 = 1;
this->spriteOrientation.flipY = 1;
+5 -5
View File
@@ -1,11 +1,11 @@
#include "global.h"
#include "entity.h"
#include "enemy.h"
#include "functions.h"
#include "npc.h"
#include "structures.h"
#include "player.h"
#include "save.h"
#include "createObject.h"
#include "functions.h"
extern void sub_080293DC(Entity*);
extern void sub_080296D8(Entity*);
@@ -234,7 +234,7 @@ void sub_080296D8(Entity* this) {
gPlayerState.flags.all &= 0xffffffef;
gPlayerEntity.flags |= 0x80;
gPlayerEntity.field_0x20 = 0x18000;
gPlayerEntity.hurtBlinkTime = 0xa6;
gPlayerEntity.iframes = 0xa6;
gPlayerEntity.height.HALF.HI = -2;
gPlayerEntity.direction = gPlayerEntity.animationState << 2;
gPlayerEntity.spritePriority.b1 = this->field_0x80.HALF.LO;
@@ -243,8 +243,8 @@ void sub_080296D8(Entity* this) {
this->action = 5;
this->field_0xf = 0x3c;
this->flags2 |= 3;
if ((s8)this->hurtBlinkTime == 0) {
this->hurtBlinkTime = 0xf4;
if ((s8)this->iframes == 0) {
this->iframes = 0xf4;
}
}
+4 -13
View File
@@ -1,14 +1,10 @@
#include "global.h"
#include "entity.h"
#include "enemy.h"
#include "room.h"
#include "random.h"
#include "functions.h"
typedef struct {
void* field_0x0;
void* entityCount;
u8 freezeTime;
} EntityHandler;
typedef struct {
s8 h, v;
} PACKED PosOffset;
@@ -16,10 +12,6 @@ typedef struct {
void sub_08044FF8(Entity*);
void sub_08045178(Entity*, Entity*, int, int);
extern void sub_0804A720(Entity*);
extern u32 sub_0806FA04(u32, u32);
extern u32 sub_08049FA0(Entity*);
extern u32 sub_08049EE4(Entity*);
extern void sub_0804A4E4(Entity*, Entity*);
extern u32 sub_080002CC(Entity*, s32, s32);
@@ -29,7 +21,6 @@ extern u8 gUnk_080D16D0[4]; // Entity count per form
extern PosOffset gUnk_080D16D4[4];
extern u8 gEntCount;
extern EntityHandler gHitboxCount;
void Slime(Entity* this) {
EnemyFunctionHandler(this, gUnk_080D16A4);
@@ -76,7 +67,7 @@ void sub_08045018(Entity* this) {
this->action = 3;
this->actionDelay = 1;
if (0 < this->speed) {
this->actionDelay = sub_0806FA04(4096, this->speed) >> 8;
this->actionDelay = FixedDiv(4096, this->speed) >> 8;
}
if (sub_08049FA0(this) == 0 && (Random() & 3)) {
this->direction = (sub_08049EE4(this) + 0xfc + (Random() & 8)) & 24;
@@ -117,7 +108,7 @@ void sub_080450A8(Entity* this) {
ent->parent = entities[(i + count - 1) % count];
ent->type2 = 1;
ent->height.HALF.HI = 0;
ent->hurtBlinkTime = -0x10;
ent->iframes = -0x10;
/* Set MiniSlime offset relative to killed slime. */
sub_08045178(this, ent, off->h, off->v);
+1
View File
@@ -1,5 +1,6 @@
#include "enemy.h"
#include "entity.h"
#include "random.h"
#include "functions.h"
extern s32 sub_080012DC(Entity*);
+7 -14
View File
@@ -1,17 +1,11 @@
#include "global.h"
#include "entity.h"
#include "coord.h"
#include "random.h"
#include "functions.h"
extern u32 GetNextFunction(Entity*);
extern u32 sub_0806F520(Entity*);
extern void sub_0806F4E8(Entity*);
extern u32 sub_0806F3E4();
extern void sub_0804A7D4(Entity*);
extern void sub_0804A720(Entity*);
extern void sub_080317F8(Entity*);
extern u32 sub_08049FA0(Entity*);
extern u32 Random();
extern u32 sub_08049EE4(Entity*);
extern void sub_0806F69C(Entity*);
extern void (*gUnk_080CE530[])(Entity*);
extern void (*gUnk_080CE548[])(Entity*);
@@ -19,7 +13,6 @@ extern void (*gUnk_080CE554[])(Entity*);
void sub_080317B4(Entity*);
void sub_080317E0(Entity*);
void sub_080317F8(Entity*);
void sub_08031840(Entity*);
extern Hitbox gUnk_080CE560;
@@ -42,17 +35,17 @@ void sub_0803169C(Entity* this) {
iVar1 = sub_0806F520(this);
if (iVar1 == 0) {
this->action = 1;
this->previousActionFlag = 0;
this->subAction = 0;
this->flags = this->flags | 0x80;
this->speed = 0x40;
this->field_0xf = 1;
} else {
gUnk_080CE554[this->previousActionFlag](this);
gUnk_080CE554[this->subAction](this);
}
}
void sub_080316DC(Entity* this) {
this->previousActionFlag = 1;
this->subAction = 1;
this->field_0x1d = 0x3c;
}
@@ -61,7 +54,7 @@ void sub_080316E8(Entity* this) {
}
void sub_080316F0(Entity* this) {
if (sub_0806F3E4()) {
if (sub_0806F3E4(this)) {
sub_0804A7D4(this);
}
}
+1 -1
View File
@@ -19,7 +19,7 @@ void sub_0802B2E0(Entity* this) {
if (this->bitfield & 0x80) {
if ((this->bitfield & 0x7f) == 0x14) {
this->flags &= ~0x80;
this->hurtBlinkTime = 0;
this->iframes = 0;
this->spriteSettings.b.draw = 0;
this->action = 2;
ent = CreateFx(this, 2, 0);
+3 -3
View File
@@ -1,9 +1,9 @@
#include "enemy.h"
#include "entity.h"
#include "random.h"
#include "functions.h"
extern bool32 sub_0806FC80(Entity*, Entity*, u32);
extern Entity* sub_080A7EE0(u32);
extern Entity* sub_08049DF4(u32);
void sub_08028604(Entity*);
@@ -56,7 +56,7 @@ void sub_08028284(Entity* this) {
}
}
this->attachedEntity->hurtBlinkTime = this->hurtBlinkTime;
this->attachedEntity->iframes = this->iframes;
if (this->currentHealth == 0) {
this->speed = 0;
this->field_0x82.HALF.LO = 0;
@@ -386,7 +386,7 @@ void sub_080288C0(Entity* this) {
Entity* ent = this->attachedEntity;
if (ent && (ent->bitfield & 0x80)) {
this->field_0x3e = ent->field_0x3e;
this->hurtBlinkTime = -ent->hurtBlinkTime;
this->iframes = -ent->iframes;
this->field_0x46 = ent->field_0x46;
this->field_0x42 = ent->field_0x42;
ent->field_0x42 = 0;
+2 -1
View File
@@ -1,5 +1,6 @@
#include "enemy.h"
#include "entity.h"
#include "random.h"
#include "functions.h"
extern u32 sub_0804A024(Entity*, u32, u32);
@@ -52,7 +53,7 @@ void sub_0802B628(Entity* this) {
this->speed = 0xc0;
this->direction = this->field_0x3e;
this->field_0x42 = 0;
this->hurtBlinkTime = -8;
this->iframes = -8;
this->damageType = 100;
InitializeAnimation(this, 9);
}
+4 -3
View File
@@ -1,5 +1,6 @@
#include "enemy.h"
#include "entity.h"
#include "random.h"
#include "functions.h"
extern void sub_08001318(Entity*);
@@ -117,11 +118,11 @@ void sub_080225EC(Entity* this) {
}
void sub_08022654(Entity* this) {
switch (this->previousActionFlag) {
switch (this->subAction) {
case 0:
if (--this->field_0xf)
return;
this->previousActionFlag = 1;
this->subAction = 1;
SoundReq(0x12d);
InitializeAnimation(this, 0);
/* fallthrough */
@@ -129,7 +130,7 @@ void sub_08022654(Entity* this) {
if (sub_08003FC4(this, 0x1800))
return;
this->previousActionFlag = 2;
this->subAction = 2;
this->spriteSettings.b.draw = 1;
InitializeAnimation(this, 5);
EnqueueSFX(0x7d);
+6 -9
View File
@@ -1,6 +1,7 @@
#include "global.h"
#include "entity.h"
#include "enemy.h"
#include "random.h"
#include "functions.h"
extern void (*const gUnk_080CDED0[])(Entity*);
@@ -29,7 +30,7 @@ void sub_0802F150(Entity* this) {
switch (this->bitfield & 0x3f) {
case 0x14:
this->action = 1;
this->previousActionFlag = 0;
this->subAction = 0;
if (this->type != 0) {
this->actionDelay = 0xc0;
} else {
@@ -62,15 +63,13 @@ void sub_0802F1F0(Entity* this) {
}
}
extern u8 gUnk_080CDEF8[];
void sub_0802F210(Entity* this) {
u32 temp;
u32 temp2;
sub_0804A720(this);
this->action = 1;
this->previousActionFlag = 0;
this->subAction = 0;
this->actionDelay = gUnk_080CDEF8[Random() & 3];
this->actionDelay = (Random() & 0x1f) + this->actionDelay;
this->field_0xf = 0;
@@ -106,8 +105,6 @@ void sub_0802F284(Entity* this) {
}
}
extern u8 gUnk_080CDEF8[];
void sub_0802F300(Entity* this) {
s32 temp;
u32 rand;
@@ -119,7 +116,7 @@ void sub_0802F300(Entity* this) {
if (sub_080044EC(this, this->field_0x80.HWORD) == 1) {
this->action = 3;
this->previousActionFlag = 0;
this->subAction = 0;
if (this->type != 0) {
rand = 0;
}
@@ -146,9 +143,9 @@ void sub_0802F300(Entity* this) {
}
}
if ((this->previousActionFlag == 0) && (temp < this->height.HALF.HI)) {
if ((this->subAction == 0) && (temp < this->height.HALF.HI)) {
InitializeAnimation(this, 4);
this->previousActionFlag = 1;
this->subAction = 1;
}
if (temp < -0xc) {
+7 -6
View File
@@ -1,8 +1,9 @@
#include "global.h"
#include "entity.h"
#include "enemy.h"
#include "functions.h"
#include "flags.h"
#include "random.h"
#include "functions.h"
extern void sub_08038168(Entity*);
@@ -27,7 +28,7 @@ void sub_08037F00(Entity* this) {
sub_0804AA30(this, &gUnk_080CF4A0);
if (this->bitfield == 0x94) {
this->action = 1;
this->previousActionFlag = 0;
this->subAction = 0;
this->actionDelay = 0x14;
this->field_0xf = 0;
this->field_0x80.HALF.LO = 0;
@@ -69,7 +70,7 @@ void sub_08037FA0(Entity* this) {
}
sub_0804A720(this);
this->action = 1;
this->previousActionFlag = 0;
this->subAction = 0;
this->actionDelay = (Random() & 0x1f) + 0x20;
this->field_0xf = 0;
this->field_0x80.HALF.LO = 0;
@@ -106,7 +107,7 @@ void sub_08038048(Entity* this) {
if (sub_080044EC(this, 0x3000) == 1) {
this->action = 3;
this->previousActionFlag = 0;
this->subAction = 0;
this->actionDelay = 0x14;
InitializeAnimation(this, 3);
return;
@@ -121,9 +122,9 @@ void sub_08038048(Entity* this) {
sub_08038168(this);
}
if ((this->previousActionFlag == 0) && (temp < this->height.HALF.HI)) {
if ((this->subAction == 0) && (temp < this->height.HALF.HI)) {
InitializeAnimation(this, 4);
this->previousActionFlag = 1;
this->subAction = 1;
}
if (temp < -0xc) {
+2 -3
View File
@@ -1,7 +1,8 @@
#include "entity.h"
#include "player.h"
#include "functions.h"
#include "screen.h"
#include "createObject.h"
#include "functions.h"
typedef struct {
s8 h, v;
@@ -136,8 +137,6 @@ void sub_080447E0(Entity* this) {
}
}
extern u32 sub_080045B4();
extern u32 sub_0806FCB8(Entity*, u32, u32, u32);
extern void sub_08044DEC();
void sub_08044868(Entity* this) {
+2 -1
View File
@@ -1,7 +1,8 @@
#include "enemy.h"
#include "entity.h"
#include "functions.h"
#include "area.h"
#include "random.h"
#include "functions.h"
extern void sub_08001328(Entity*);
extern Entity* sub_08049DF4(u32);
+2 -2
View File
@@ -1,9 +1,9 @@
#include "enemy.h"
#include "functions.h"
#include "area.h"
#include "random.h"
#include "functions.h"
extern void sub_08001328(Entity*);
extern u32 sub_0806FCB8(Entity*, u32, u32, u32);
extern void DoExitTransition(u32*);
extern Entity* gUnk_020000B0;
+2 -1
View File
@@ -1,7 +1,8 @@
#include "enemy.h"
#include "entity.h"
#include "functions.h"
#include "screen.h"
#include "random.h"
#include "functions.h"
void sub_0802A39C(Entity*);
void sub_0802A334(Entity*);
+6 -5
View File
@@ -1,10 +1,11 @@
#include "global.h"
#include "entity.h"
#include "enemy.h"
#include "structures.h"
#include "player.h"
#include "functions.h"
#include "save.h"
#include "random.h"
#include "createObject.h"
#include "functions.h"
extern void (*const gUnk_080CEB74[])(Entity*);
extern void (*const gUnk_080CEB8C[])(Entity*);
@@ -49,7 +50,7 @@ void sub_08033564(Entity* this) {
break;
case 0x14:
this->flags &= 0x7f;
this->hurtBlinkTime = 0;
this->iframes = 0;
this->spriteSettings.b.draw = FALSE;
ent = CreateFx(this, 2, 0);
if (ent != NULL) {
@@ -64,12 +65,12 @@ void sub_08033564(Entity* this) {
void sub_0803362C(Entity* this) {
if (sub_0806F520() != 0) {
gUnk_080CEB98[this->previousActionFlag](this);
gUnk_080CEB98[this->subAction](this);
}
}
void sub_08033650(Entity* this) {
this->previousActionFlag = 2;
this->subAction = 2;
}
void sub_08033658(Entity* this) {
+36 -41
View File
@@ -1,5 +1,7 @@
#include "global.h"
#include "area.h"
#include "entity.h"
#include "utils.h"
#include "script.h"
typedef struct OtherEntity {
@@ -23,14 +25,13 @@ Entity* sub_0805E744(void) {
return NULL;
}
extern Entity* GetEmptyEntity();
OtherEntity* GetEmptyManager();
OtherEntity* GetEmptyManager(void);
typedef void* (*Getter)(void);
void* GetEmptyEntityByType(int type) {
void* GetEmptyEntityByKind(u32 kind) {
Getter getter = NULL;
if (type == 9) {
if (kind == MANAGER) {
getter = (Getter)GetEmptyManager;
} else {
getter = (Getter)GetEmptyEntity;
@@ -48,21 +49,20 @@ typedef struct {
extern struct_03003DD0 gUnk_03003DD0;
extern u32 _call_via_r0(u32*);
extern u32 _EntUpdate;
extern void DeleteEntityAny(Entity*);
void DeleteEntityAny(Entity*);
void DeleteThisEntity(void) {
DeleteEntityAny(gUnk_03003DD0.field_0x8);
_call_via_r0((u32*)&_EntUpdate);
}
void DeleteEntity(Entity*);
void DeleteManager(OtherEntity*);
typedef void (*Deleter)(void*);
void DeleteEntityAny(Entity* ent) {
Deleter deleter = NULL;
if (ent->kind == 9) {
if (ent->kind == MANAGER) {
deleter = (Deleter)DeleteManager;
} else {
deleter = (Deleter)DeleteEntity;
@@ -79,9 +79,8 @@ extern void sub_0805EC60();
extern void sub_08017744();
extern void sub_0805E92C();
extern void UnloadHitbox();
extern void sub_0801DA0C();
extern void sub_0804AA1C();
extern void UnlinkEntity(); // Unlink
void UnlinkEntity();
void DeleteEntity(Entity* ent) {
if (ent->next) {
@@ -95,9 +94,9 @@ void DeleteEntity(Entity* ent) {
sub_0805E92C(ent);
UnloadCutsceneData(ent);
UnloadHitbox(ent);
sub_0801DA0C(ent->myHeap);
zFree(ent->myHeap);
ent->myHeap = NULL;
if (ent->kind == 3) {
if (ent->kind == ENEMY) {
sub_0804AA1C(ent);
}
ent->flags = ent->flags & 0x7f;
@@ -160,7 +159,6 @@ OtherEntity* GetEmptyManager(void) {
return NULL;
}
extern void MemClear32(void*, u32);
extern u8 gManagerCount;
void DeleteManager(OtherEntity* ent) {
@@ -169,12 +167,10 @@ void DeleteManager(OtherEntity* ent) {
sub_0805E92C(ent);
UnlinkEntity(ent);
MemClear32(ent, sizeof(OtherEntity));
MemClear(ent, sizeof(OtherEntity));
gManagerCount--;
}
#include "area.h"
void sub_0805E92C(u32 param_1) {
if (param_1 == gArea.unk2) {
gArea.unk2 = 0;
@@ -184,8 +180,7 @@ void sub_0805E92C(u32 param_1) {
}
extern Entity gUnk_020369F0;
extern void MemCopy(const void* src, void* dest, size_t size); // dma copy
extern void sub_0805E98C(void);
void sub_0805E98C(void);
void sub_0805E958(void) {
MemCopy(&gEntityLists, &gUnk_020369F0, 0x48);
@@ -212,7 +207,7 @@ void sub_0805E9A8(void) {
list = &gEntityLists[0];
do {
for (i = list->first; (u32)i != (u32)list; i = i->next) {
i->flags &= 0xfd;
i->flags &= ~2;
if ((i->flags & 0x20) == 0) {
i->flags |= 0x10;
}
@@ -237,32 +232,32 @@ void sub_0805E9F4(void) {
extern void sub_0805E374(Entity*);
void AppendEntityToList(Entity* ent, int listIndex) {
void AppendEntityToList(Entity* entity, u32 listIndex) {
LinkedList* list;
list = &gEntityLists[listIndex];
ent->next = (Entity*)list;
ent->prev = list->last;
list->last->next = ent;
list->last = ent;
if (ent->kind != 9) {
ent->spritePriority.b0 = 4;
entity->next = (Entity*)list;
entity->prev = list->last;
list->last->next = entity;
list->last = entity;
if (entity->kind != MANAGER) {
entity->spritePriority.b0 = 4;
gEntCount++;
} else {
gManagerCount++;
}
sub_0805E374(ent);
sub_0805E374(entity);
}
void PrependEntityToList(Entity* ent, int listIndex) {
void PrependEntityToList(Entity* entity, u32 listIndex) {
LinkedList* list;
UnlinkEntity(ent);
UnlinkEntity(entity);
list = &gEntityLists[listIndex];
ent->prev = (Entity*)list;
ent->next = list->first;
list->first->prev = ent;
list->first = ent;
entity->prev = (Entity*)list;
entity->next = list->first;
list->first->prev = entity;
list->first = entity;
}
void UnlinkEntity(Entity* ent) {
@@ -273,7 +268,7 @@ void UnlinkEntity(Entity* ent) {
ent->next->prev = ent->prev;
}
bool32 DoesSimilarEntityExist(Entity* ent) {
bool32 EntityHasDuplicateID(Entity* ent) {
Entity* i;
LinkedList* list;
@@ -289,31 +284,31 @@ bool32 DoesSimilarEntityExist(Entity* ent) {
return FALSE;
}
Entity* FindEntityInListBySubtype(int type, int subtype, int listIndex) {
Entity* FindEntityByID(u32 kind, u32 id, u32 listIndex) {
Entity* it;
LinkedList* list;
list = &gEntityLists[listIndex];
for (it = list->first; (u32)it != (u32)list; it = it->next) {
if (type == it->kind && subtype == it->id)
if (kind == it->kind && id == it->id)
return it;
}
return NULL;
}
Entity* FindEntityInListByForm(int type, int subtype, int listIndex, int form, int parameter) {
Entity* FindEntity(u32 kind, u32 id, u32 listIndex, u32 type, u32 type2) {
Entity* i;
LinkedList* list;
list = &gEntityLists[listIndex];
for (i = list->first; (u32)i != (u32)list; i = i->next) {
if (type == i->kind && subtype == i->id && form == i->type && parameter == i->type2)
if (kind == i->kind && id == i->id && type == i->type && type2 == i->type2)
return i;
}
return NULL;
}
Entity* FindNextEntityOfSameSubtype(Entity* ent, int listIndex) {
Entity* FindNextDuplicateID(Entity* ent, int listIndex) {
Entity* i;
LinkedList* list;
@@ -325,14 +320,14 @@ Entity* FindNextEntityOfSameSubtype(Entity* ent, int listIndex) {
return NULL;
}
Entity* FindEntityBySubtype(int type, int subtype) {
Entity* DeepFindEntityByID(u32 kind, u32 id) {
Entity* i;
LinkedList* list;
list = &gEntityLists[0];
do {
for (i = (Entity*)list->first; (u32)i != (u32)list; i = i->next) {
if (type == i->kind && (subtype == i->id))
if (kind == i->kind && (id == i->id))
return i;
}
} while (++list < &gEntityLists[9]);
@@ -349,7 +344,7 @@ void DeleteAllEnemies(void) {
do {
for (ent = list->first; (u32)ent != (u32)list; ent = next) {
next = ent->next;
if (ent->kind == 3)
if (ent->kind == ENEMY)
DeleteEntity(ent);
}
} while (++list < &gEntityLists[9]);
+2 -4
View File
@@ -1,5 +1,5 @@
#include "audio.h"
#include "global.h"
#include "entity.h"
#include "functions.h"
#include "textbox.h"
#include "structures.h"
@@ -24,8 +24,6 @@ typedef struct {
u8 unk13;
} Element;
///////////////////////////////////////////////////////////////
extern void sub_0805ECEC(u32, u32, u32, u32);
extern void sub_0801CAD0(Element*);
@@ -99,7 +97,7 @@ void sub_0801CF18(Element* arg0) {
arg0->unk4 = 2;
arg0->unk1 = 8;
gUnk_0200AF00.ezloNagFuncIndex = 3;
SoundReq(0x173);
SoundReq(SFX_EZLO_UI);
}
}
-3
View File
@@ -12,9 +12,6 @@ extern struct_03000000 gUnk_03000000;
extern u32 gUsedPalettes;
extern void sub_0801E104();
extern void DoFade(u32, u32);
void sub_08050024() {
sub_0801E104();
DoFade(5, 0x80 << 1);
+46 -43
View File
@@ -1,4 +1,11 @@
#include "fileScreen.h"
#include "main.h"
#include "player.h"
#include "utils.h"
#include "screen.h"
#include "menu.h"
#include "random.h"
#include "textbox.h"
// copy, erase, start
#define NUM_FILE_OPERATIONS 3
@@ -105,7 +112,7 @@ void CreateDialogBox(u32 arg0, u32 arg1) {
void sub_08050384(void) {
sub_0801C4A0(0, 0);
MemClear32(&gBG0Buffer, sizeof(gBG0Buffer));
MemClear(&gBG0Buffer, sizeof(gBG0Buffer));
gScreen.bg.bg0Updated = 1;
}
@@ -117,8 +124,8 @@ void sub_080503A8(u32 gfxGroup) {
void SetFileSelectState(FileSelectState mode) {
gUnk_02032EC0.state = mode;
MemClear32(&gBG0Buffer, sizeof(gBG0Buffer));
MemClear32(&gBG1Buffer, sizeof(gBG1Buffer));
MemClear(&gBG0Buffer, sizeof(gBG0Buffer));
MemClear(&gBG1Buffer, sizeof(gBG1Buffer));
}
void LoadOptionsFromSave(u32 idx) {
@@ -159,7 +166,7 @@ void HandleChooseFileScreen(void) {
gScreen.bg.bg1yOffset = 0;
gScreen.affine.bg2xOffset = 0;
gScreen.affine.bg2yOffset = 0;
MemClear32(&gChooseFileState, sizeof(gChooseFileState));
MemClear(&gChooseFileState, sizeof(gChooseFileState));
}
HideButtonR();
@@ -182,19 +189,19 @@ void HandleChooseFileScreen(void) {
static void HandleFileScreenEnter(void) {
u32 i;
sub_0801DA90(1);
DispReset(1);
sub_080A3210();
MemClear32((void*)VRAM, 0x80); // clear palettes
MemClear((void*)VRAM, 0x80); // clear palettes
MessageInitialize();
EraseAllEntities();
sub_08080668();
sub_080ADD30();
sub_0801CFA8(0);
MemClear32(&gUnk_0200AF00, sizeof(gUnk_0200AF00));
MemClear32(&gUnk_02019EE0, sizeof(gUnk_02019EE0));
MemClear(&gUnk_0200AF00, sizeof(gUnk_0200AF00));
MemClear(&gUnk_02019EE0, sizeof(gUnk_02019EE0));
gUnk_02019EE0.unk3 = 7;
gUnk_02019EE0.unk6 = gUnk_02000000->gameLanguage > LANGUAGE_EN ? 3 : 0;
MemClear32(&gUnk_02032EC0, sizeof(gUnk_02032EC0));
MemClear(&gUnk_02032EC0, sizeof(gUnk_02032EC0));
gUnk_02032EC0.lastState = 8;
SetFileSelectState(STATE_NONE);
InitDMA();
@@ -216,7 +223,7 @@ static void HandleFileScreenEnter(void) {
gScreen.controls.alphaBlend = BLDALPHA_BLEND(15, 10);
gUnk_02024490.unk0 = 1;
gMain.funcIndex = 1;
SoundReq(0x7);
SoundReq(BGM_FILE_SELECT);
DoFade(4, 8);
}
@@ -284,7 +291,7 @@ void sub_0805070C(void) {
var0->unk8 = gUnk_02000D00;
for (i = 0; i < NUM_SAVE_SLOTS; i++) {
var0->unk6 = 0;
MemClear32(var0->unk8, 0x200);
MemClear(var0->unk8, 0x200);
playerName = &gUnk_02019EE0.saves[i].playerName[0];
for (j = 0; j < FILENAME_LENGTH; j++) {
sub_0805F7DC(playerName[j], var0);
@@ -438,14 +445,14 @@ void sub_08050940(void) {
if (gUnk_02032EC0.lastState != mode) {
SetFileSelectState(mode);
SoundReq(0x6A);
SoundReq(SFX_TEXTBOX_SELECT);
}
row_idx = (row_idx + num_rows) % num_rows;
if (gUnk_02019EE0.unk6 != row_idx) {
gUnk_02019EE0.unk6 = row_idx;
sub_08050AFC(row_idx);
SoundReq(0x69);
SoundReq(SFX_TEXTBOX_CHOICE);
}
if (gUnk_02019EE0.saveStatus[gUnk_02019EE0.unk6] == SAVE_VALID) {
@@ -489,7 +496,7 @@ void sub_08050B3C(u16*);
void sub_08050AFC(u32 idx) {
SetActiveSave(idx);
MemClear32(&gBG1Buffer, sizeof(gBG1Buffer));
MemClear(&gBG1Buffer, sizeof(gBG1Buffer));
if (gUnk_02019EE0.saveStatus[idx] == SAVE_VALID) {
sub_08050B3C(&gBG1Buffer.unk29C);
}
@@ -589,14 +596,14 @@ void sub_08050C54(void) {
case A_BUTTON:
case START_BUTTON:
if (column_idx == 0) {
SoundReq(0x80080000);
SoundReq(SONG_VOL_FADE_OUT);
}
gMenu.transitionTimer = 0xf;
sub_080A7114(1);
SoundReq(0x6a);
SoundReq(SFX_TEXTBOX_SELECT);
break;
case B_BUTTON:
SoundReq(0x6c);
SoundReq(SFX_MENU_CANCEL);
SetFileSelectState(STATE_NONE);
break;
case DPAD_LEFT:
@@ -614,7 +621,7 @@ void sub_08050C54(void) {
}
if (gMenu.column_idx != column_idx) {
gMenu.column_idx = column_idx;
SoundReq(0x69);
SoundReq(SFX_TEXTBOX_CHOICE);
}
}
@@ -645,7 +652,7 @@ void HandleFileLanguageSelect(void) {
}
void sub_08050DB8(void) {
MemClear32(&gBG2Buffer, sizeof(gBG2Buffer));
MemClear(&gBG2Buffer, sizeof(gBG2Buffer));
sub_080503A8(0xc);
gMenu.field_0x4 = gUnk_02000000->gameLanguage;
sub_080A7114(1);
@@ -667,7 +674,7 @@ void sub_08050DE4(void) {
break;
case A_BUTTON:
case START_BUTTON:
SoundReq(0x6a);
SoundReq(SFX_TEXTBOX_SELECT);
if (gMenu.field_0x4 != row_idx) {
sub_080A7114(2);
CreateDialogBox(8, 0);
@@ -678,7 +685,7 @@ void sub_08050DE4(void) {
case B_BUTTON:
row_idx = gMenu.field_0x4;
gUnk_02000000->gameLanguage = gMenu.field_0x4;
SoundReq(0x6c);
SoundReq(SFX_MENU_CANCEL);
SetFileSelectState(STATE_NONE);
break;
}
@@ -692,7 +699,7 @@ void sub_08050DE4(void) {
}
if (gUnk_02000000->gameLanguage != row_idx) {
gUnk_02000000->gameLanguage = row_idx;
SoundReq(0x69);
SoundReq(SFX_TEXTBOX_CHOICE);
}
}
@@ -765,13 +772,13 @@ NONMATCH("asm/non_matching/fileScreen/sub_08050EF4.inc", void sub_08050EF4(void)
case 3:
gUnk_02019EE0.saves[gUnk_02019EE0.unk6].messageSpeed = gUnk_02019EE0.unk4;
gUnk_02019EE0.saves[gUnk_02019EE0.unk6].brightnessPref = gUnk_02019EE0.unk5;
SoundReq(0x6c);
SoundReq(SFX_MENU_CANCEL);
sub_080A7114(mode);
SetActiveSave(gUnk_02019EE0.unk6);
break;
case 2:
CreateDialogBox(8, 0);
SoundReq(0x6a);
SoundReq(SFX_TEXTBOX_SELECT);
default:
case 1:
sub_080A7114(mode);
@@ -780,11 +787,11 @@ NONMATCH("asm/non_matching/fileScreen/sub_08050EF4.inc", void sub_08050EF4(void)
case 0:
if (gMenu.column_idx != column_idx) {
gMenu.column_idx = column_idx;
SoundReq(0x69);
SoundReq(SFX_TEXTBOX_CHOICE);
} else if (option != *p_option) {
*p_option = option;
LoadOptionsFromSave(gUnk_02019EE0.unk6);
SoundReq(0x69);
SoundReq(SFX_TEXTBOX_CHOICE);
}
break;
}
@@ -842,7 +849,7 @@ void sub_08051358(void) {
if (gMenu.focusCoords[0] != 0x0b || gMenu.focusCoords[1] != 0x5) {
gMenu.focusCoords[1] = 0x5;
gMenu.focusCoords[0] = 0xb;
SoundReq(0x67);
SoundReq(SFX_TEXTBOX_NEXT);
}
}
@@ -919,7 +926,7 @@ void sub_08051480(u32 c) {
gMenu.unk13 = idx + 1;
gSave.playerName[idx] = c;
sub_08051574(0x6b);
sub_08051574(SFX_6B);
}
u32 sub_080514BC(u32 a1) {
@@ -939,9 +946,8 @@ u32 sub_080514BC(u32 a1) {
}
idx = gMenu.unk13;
if (idx == 0) {
if (idx == 0)
return 0;
}
c = gSave.playerName[idx - 1];
if (c - 0xa4 < 0x29) {
@@ -955,11 +961,10 @@ u32 sub_080514BC(u32 a1) {
case 0xE:
return c;
case 0xF:
if (c < 0xc3) {
if (c < 0xc3)
return 0;
} else {
else
return c + 10;
}
default:
return c;
}
@@ -980,13 +985,11 @@ u32 sub_080514BC(u32 a1) {
switch (a1) {
default:
case 0x0:
return c - 0x33;
case 0xe:
return c - 0x33;
case 0xf:
if (c > 0xf5) {
if (c > 0xf5)
return c - 0x29;
}
}
}
@@ -1025,10 +1028,10 @@ void sub_080515D4(void) {
if (column_idx == 1) {
CreateDialogBox(4, 0);
sub_080A7114(2);
SoundReq(0x6a);
SoundReq(SFX_TEXTBOX_SELECT);
} else {
SetFileSelectState(0);
SoundReq(0x6c);
SoundReq(SFX_MENU_CANCEL);
}
break;
case DPAD_LEFT:
@@ -1041,7 +1044,7 @@ void sub_080515D4(void) {
if (gMenu.column_idx != column_idx) {
gMenu.column_idx = column_idx;
SoundReq(0x69);
SoundReq(SFX_TEXTBOX_CHOICE);
}
}
@@ -1122,20 +1125,20 @@ void sub_080517EC(void) {
if (gUnk_02019EE0.unk7 < 3) {
CreateDialogBox(2, 0);
sub_080A7114(2);
SoundReq(0x6a);
SoundReq(SFX_TEXTBOX_SELECT);
break;
}
// fallthrough
case B_BUTTON:
gUnk_02019EE0.unk7 = 4;
SoundReq(0x6c);
SoundReq(SFX_MENU_CANCEL);
SetFileSelectState(0);
break;
}
temp = sub_080517B4(delta);
if (temp != gUnk_02019EE0.unk7) {
gUnk_02019EE0.unk7 = temp;
SoundReq(0x69);
SoundReq(SFX_TEXTBOX_CHOICE);
}
}
@@ -1186,7 +1189,7 @@ void sub_0805194C(u32 save_idx) {
gUnk_02019EE0.saveStatus[save_idx] = 0;
save = &gUnk_02019EE0.saves[save_idx];
MemClear32(save, sizeof(*save));
MemClear(save, sizeof(*save));
save->messageSpeed = 1;
save->brightnessPref = 1;
save->stats.health = 24;
-1
View File
@@ -2,7 +2,6 @@
#include "room.h"
#include "flags.h"
#include "area.h"
#include "room.h"
extern u32 ReadBit(u32*, u32);
extern u32 CheckBits(u32*, u32, u32);
+11 -11
View File
@@ -1,7 +1,6 @@
#include "global.h"
#include "screen.h"
#include "structures.h"
#include "functions.h"
#include "screen.h"
#include "entity.h"
#include "player.h"
@@ -9,11 +8,12 @@
#include "main.h"
#include "flags.h"
#include "save.h"
#include "utils.h"
#include "fileScreen.h"
#include "functions.h"
extern u8 gArea;
extern Entity gPlayerEntity;
extern u32 gUnk_03000B80;
extern u32 gUnk_03003FC0;
extern u16 gWalletSizes[4];
@@ -105,13 +105,13 @@ void sub_080521A0(void) {
}
gMenu.transitionTimer = 0x3c;
sub_080A7114(temp2);
SoundReq(0x6a);
SoundReq(SFX_TEXTBOX_SELECT);
break;
}
if (gMenu.field_0x3 != temp) {
gMenu.field_0x3 = temp;
sub_08052418(0, temp);
SoundReq(0x69);
SoundReq(SFX_TEXTBOX_CHOICE);
}
break;
}
@@ -170,7 +170,7 @@ void sub_080522F4(void) {
break;
case 0x1:
sub_080A7114(2);
SoundReq(0x6a);
SoundReq(SFX_TEXTBOX_SELECT);
if (temp == 0) {
DoFade(5, 8);
} else {
@@ -181,7 +181,7 @@ void sub_080522F4(void) {
if (gMenu.field_0x3 != temp) {
gMenu.field_0x3 = temp;
sub_08052418(1, temp);
SoundReq(0x69);
SoundReq(SFX_TEXTBOX_CHOICE);
}
}
break;
@@ -219,7 +219,7 @@ NONMATCH("asm/non_matching/game/sub_08052418.inc", void sub_08052418(int param_1
int i;
struct_080FCA8C temp;
MemClear32(&gBG1Buffer, 0x800);
MemClear(&gBG1Buffer, 0x800);
gUnk_020227E8._0[0].WORD = 0xf;
gUnk_020227E8._0[2].WORD = 0xf;
gUnk_020227E8._0[4].WORD = 0xf;
@@ -238,12 +238,12 @@ void InitializePlayer(void) {
Entity* pl;
sub_080784C8();
MemClear32((void*)&gUnk_03000B80, 0x70);
MemClear32((void*)&gPlayerState, 0xb0);
MemClear((void*)&gUnk_03000B80, sizeof(gUnk_03000B80));
MemClear((void*)&gPlayerState, 0xb0);
MemFill32(0xffffffff, &gPlayerState.field_0x40, 0x40);
pl = &gPlayerEntity;
MemClear32((void*)pl, 0x88);
MemClear((void*)pl, 0x88);
gRoomControls.cameraTarget = pl;
gPlayerState.playerAction = gUnk_080FCAC8[gScreenTransition.field_0xf];
if (!CheckGlobalFlag(0x14)) {
@@ -299,7 +299,7 @@ u32 sub_08052654() {
return (gArea >> 7) & 1;
}
u32 CheckIsDungeon() {
u32 CheckIsDungeon(void) {
return (gArea >> 2) & 1;
}
-28
View File
@@ -1,28 +0,0 @@
#include "global.h"
#include "entity.h"
#include "readKeyInput.h"
static void StoreKeyInput(Input*, u32);
void ReadKeyInput(void) {
u32 keyInput = ~REG_KEYINPUT & KEYS_MASK;
StoreKeyInput(&gInput, keyInput);
}
static void StoreKeyInput(Input* input, u32 keyInput) {
u32 heldKeys = input->heldKeys;
u32 difference = keyInput & ~heldKeys;
input->newKeys = difference;
if (keyInput == heldKeys) {
if (--input->unk7 == 0) {
input->unk7 = 4;
input->unk4 = keyInput;
} else {
input->unk4 = 0;
}
} else {
input->unk7 = 0x14;
input->unk4 = difference;
}
input->heldKeys = keyInput;
}
+13 -12
View File
@@ -1,11 +1,12 @@
#include "audio.h"
#include "global.h"
#include "menu.h"
#include "main.h"
#include "entity.h"
#include "functions.h"
#include "readKeyInput.h"
#include "utils.h"
#include "screen.h"
#include "structures.h"
#include "textbox.h"
typedef struct {
u8 filler0[0x4];
@@ -55,7 +56,7 @@ static const u16 sLightRaysAlphaBlends[] = {
static u32 AdvanceIntroSequence(u32 transition) {
gUnk_02032EC0.lastState = transition;
gMain.funcIndex = 2;
MemClear32(&gIntroState, sizeof(gIntroState));
MemClear(&gIntroState, sizeof(gIntroState));
DoFade(7, 8);
}
@@ -64,7 +65,7 @@ void HandleIntroScreen(void) {
switch (gMain.funcIndex) {
case 0:
MessageInitialize();
MemClear32(&gUnk_02032EC0, sizeof(gUnk_02032EC0));
MemClear(&gUnk_02032EC0, sizeof(gUnk_02032EC0));
AdvanceIntroSequence(0);
break;
case 1:
@@ -74,7 +75,7 @@ void HandleIntroScreen(void) {
if (gFadeControl.active) {
return;
}
sub_0801DA90(1);
DispReset(1);
gMain.funcIndex = 1;
break;
}
@@ -87,7 +88,7 @@ static void HandleNintendoCapcomLogos(void) {
advance = GetAdvanceState();
if (gIntroState.state == 0) {
sub_0801DA90(1);
DispReset(1);
gIntroState.state = 1;
gIntroState.timer = 120;
LoadGfxGroup(16);
@@ -158,7 +159,7 @@ static void HandleTitlescreen(void) {
UpdateSwordBgAffineData();
}
sub_080A3210();
SoundReq(3); // fanfare
SoundReq(BGM_TITLE_SCREEN);
DoFade(6, 8);
break;
case 1:
@@ -182,12 +183,12 @@ static void HandleTitlescreen(void) {
advance = GetAdvanceState();
if (advance != ADVANCE_NONE) {
if (advance == ADVANCE_KEY_PRESSED) {
SoundReq(0x6a);
SoundReq(SFX_TEXTBOX_SELECT);
} else {
advance = ADVANCE_NONE;
}
AdvanceIntroSequence(advance);
SoundReq(0x80080000);
SoundReq(SONG_VOL_FADE_OUT);
}
UpdatePressStartIcon();
if ((gIntroState.timer & 0x20) == 0) {
@@ -241,7 +242,7 @@ static void HandleJapaneseTitlescreenAnimationIntro(void) {
gScreen.bg.bg1Control = 0xc09;
gFadeControl.field_0x4 = 0x40;
DoFade(6, 0x10);
SoundReq(0xf8);
SoundReq(SFX_F8);
}
}
break;
@@ -271,7 +272,7 @@ static void HandleTitlescreenAnimationIntro(void) {
if (!gFadeControl.active) {
gIntroState.subState = 1;
gScreen.lcd.displayControl |= DISPCNT_BG2_ON;
SoundReq(0xF6);
SoundReq(SFX_EVAPORATE);
}
break;
case 1:
@@ -290,7 +291,7 @@ static void HandleTitlescreenAnimationIntro(void) {
gIntroState.subState++;
CreateObject(0xBD, 0, 0);
DoFade(6, 16);
SoundReq(0xF8);
SoundReq(SFX_F8);
}
break;
default:
+2 -3
View File
@@ -1,6 +1,7 @@
#include "global.h"
#include "entity.h"
#include "item.h"
#include "functions.h"
// TODO - How does this relate to PlayerItemFunctions? Is this just a lookup table?
void (*const gItemFunctions[])(ItemBehavior*, u32) = {
@@ -11,7 +12,6 @@ void (*const gItemFunctions[])(ItemBehavior*, u32) = {
};
extern void sub_08077E78(ItemBehavior*, u32);
extern void SoundReq(u32);
extern void sub_08078F60(void);
extern void sub_08077D38(ItemBehavior*, u32);
extern void sub_0805E544(void);
@@ -28,7 +28,6 @@ extern void (*const gUnk_0811BDE0[])(ItemBehavior* beh, u32);
extern void (*const gUnk_0811BDE8[])(ItemBehavior* beh, u32);
extern void (*const gUnk_0811BDF4[])(ItemBehavior* beh, u32);
extern u8 gUnk_02034490;
#if 0
void Ocarina(ItemBehavior* beh, u32 inputFlags) {
gOcarinaStates[beh->stateID](beh, inputFlags);
@@ -50,7 +49,7 @@ void OcarinaUse(ItemBehavior *beh, u32 arg1)
gPlayerEntity.field_0x7a = 2;
gPlayerState.flags.all |= 0x10000000;
gPlayerState.field_0x27[0] = 0xff;
gUnk_02034490 = 1;
gUnk_02034490[0] = 1;
bVar1 = (8 >> arg1);
gPlayerState.field_0xa |= bVar1;
gPlayerState.keepFacing |= bVar1;
+3 -4
View File
@@ -1,11 +1,10 @@
#include "global.h"
#include "entity.h"
#include "player.h"
#include "functions.h"
extern void DeleteThisEntity();
extern void sub_08078CD0(Entity*);
extern void sub_08018FA0(Entity*);
extern u32 sub_0801766C(Entity*);
extern void sub_08018F6C(Entity*);
extern void (*const gUnk_080B3DD0[])(Entity*);
@@ -16,7 +15,7 @@ extern Hitbox* gUnk_080B3DE8[];
void Item11(Entity* this) {
if (this->currentHealth) {
this->hurtBlinkTime = 0;
this->iframes = 0;
gUnk_080B3DD0[this->action](this);
} else {
DeleteThisEntity();
@@ -82,7 +81,7 @@ void sub_08018DE8(Entity* this) {
sub_08018F6C(this);
break;
case 5:
this->attachedEntity->previousActionFlag = 4;
this->attachedEntity->subAction = 4;
this->flags = this->flags | 0x80;
this->action = 2;
this->spritePriority.b0 = 2;
+3 -2
View File
@@ -1,4 +1,5 @@
#include "entity.h"
#include "audio.h"
#include "functions.h"
#include "player.h"
#include "room.h"
@@ -30,7 +31,7 @@ void sub_0805FBE8(Entity* this) {
sub_0801766C(this);
sub_0806F69C(this);
sub_0805FC74(this);
SoundReq(0x13f);
SoundReq(SFX_ITEM_SWORD_BEAM);
}
void sub_0805FC74(Entity* this) {
@@ -39,7 +40,7 @@ void sub_0805FC74(Entity* this) {
if (--*(int*)&this->field_0x6c != -1) {
GetNextFrame(this);
sub_0806F69C(this);
++this->actionDelay;
this->actionDelay++;
if (this->type2 == 0) {
sub_0800451C(this);
}
+20 -3
View File
@@ -1,10 +1,9 @@
#include "global.h"
#include "room.h"
#include "flags.h"
#include "functions.h"
void LoadRoomEntityList(EntityData* dat);
extern void sub_0804B058(EntityData* dat);
extern void LoadRoomTileEntities(EntityData* dat);
extern void sub_0801AC98();
extern u32 sub_08049D1C(u32);
extern Entity* LoadRoomEntity(EntityData*);
@@ -13,6 +12,24 @@ extern void* GetRoomProperty(u32, u32, u32);
extern u32 gUnk_02017654;
extern u32* gAreaEntities;
extern void sub_080186EC();
extern void sub_0804B16C();
void sub_0804AFF4(void) {
void (*func)();
sub_080186EC();
func = (void (*)())GetCurrentRoomProperty(5);
if (func) {
func();
}
func = (void (*)())GetCurrentRoomProperty(7);
if (func) {
func();
}
sub_0804B16C();
}
void LoadRoom(void) {
s32 iVar1;
s32* dat;
@@ -34,7 +51,7 @@ void sub_0804B058(EntityData* dat) {
if ((dat != NULL) && *(u8*)dat != 0xff) {
uVar2 = 0;
do {
if ((uVar2 < 0x20) && ((dat->type) == 3)) {
if ((uVar2 < 0x20) && ((dat->kind) == 3)) {
if (sub_08049D1C(uVar2) != 0) {
ent = LoadRoomEntity(dat);
if ((ent != NULL) && (ent->kind == 3)) {
+20 -15
View File
@@ -1,11 +1,14 @@
#include "audio.h"
#include "global.h"
#include "functions.h"
#include "structures.h"
#include "main.h"
#include "screen.h"
#include "random.h"
#include "readKeyInput.h"
#include "utils.h"
#include "save.h"
#include "textbox.h"
#include "arm_proxy.h"
extern void HandleIntroScreen(void);
extern void HandleChooseFileScreen(void);
@@ -20,7 +23,9 @@ static void (*const sScreenHandlers[])(void) = {
[SCREEN_CREDITS] = HandleCreditsScreen, [SCREEN_DEBUG_TEXT] = HandleDebugTextScreen,
};
void MainLoop(void) {
static void sub_080560B8(void);
void AgbMain(void) {
int var0;
sub_08055F70();
@@ -36,7 +41,7 @@ void MainLoop(void) {
MessageInitialize();
sub_080ADD30();
gRand = 0x1234567;
MemClear32(&gMain, sizeof(gMain));
MemClear(&gMain, sizeof(gMain));
InitScreen(SCREEN_INTRO);
while (1) {
ReadKeyInput();
@@ -92,7 +97,7 @@ static void sub_08055F70(void) {
*(vu16*)BG_PLTT = 0x7FFF;
REG_WAITCNT = WAITCNT_PREFETCH_ENABLE | WAITCNT_WS0_S_1 | WAITCNT_WS0_N_3;
size = 0x3FFD0;
MemClear32(gUnk_02000030, size);
MemClear(gUnk_02000030, size);
size = (u32)gUnk_080B2CD8 - (u32)sub_080B197C;
if (size != 0) {
MemCopy(sub_080B197C, gUnk_030056F0, size);
@@ -103,7 +108,7 @@ static void sub_08055F70(void) {
MemCopy(gUnk_080B2CD8_3, gUnk_02038560, size);
}
sub_0801DA90(0);
DispReset(0);
sub_08016B34();
}
@@ -146,21 +151,21 @@ typedef struct {
u8 name[6];
u8 _e;
u8 _f;
} test;
} Defaults;
const test sDefaultSettings = {
const Defaults sDefaultSettings = {
.signature = SIGNATURE,
.saveFileId = 0,
.messageSpeed = 1,
.brightnessPref = 1,
.gameLanguage = LANGUAGE_EN,
.gameLanguage = GAME_LANGUAGE,
.name = "LINK",
._e = 0,
._f = 0,
};
// single misplaced ldr
NONMATCH("asm/non_matching/sub_080560B8.inc", void sub_080560B8(void)) {
NONMATCH("asm/non_matching/sub_080560B8.inc", static void sub_080560B8(void)) {
u32 temp;
u32 b;
@@ -182,10 +187,10 @@ NONMATCH("asm/non_matching/sub_080560B8.inc", void sub_080560B8(void)) {
b = BOOLCAST(temp);
if ((gUnk_02000010.field_0x4 != 0) && (gUnk_02000010.field_0x4 != 0xc1)) {
b = 1;
b = TRUE;
}
if (b != 0) {
MemClear32((u8*)&gUnk_02000010.signature, 0x20);
if (b) {
MemClear((u8*)&gUnk_02000010.signature, 0x20);
gUnk_02000010.signature = SIGNATURE;
}
}
@@ -201,7 +206,7 @@ u32 sub_08056134(void) {
}
void InitDMA() {
SoundReq(0x80040000);
SoundReq(SND_VSYNC_OFF);
gScreen._6d = gScreen._6c;
gScreen._6c = 0;
@@ -214,7 +219,7 @@ void InitDMA() {
}
void sub_08056208() {
SoundReq(0x80060000);
SoundReq(SND_VSYNC_ON);
gScreen._6c = gScreen._6d;
gScreen._6d = 0;
}
@@ -250,7 +255,7 @@ void sub_08056260(void) {
temp2->field_0x1 = 0;
}
// Convert in-game AABB to screen coordinates and check if it's within the viewport
// Convert AABB to screen coordinates and check if it's within the viewport
u32 sub_080562CC(u32 x0, u32 y0, u32 x1, u32 y1) {
u32 result;
u32 x = ((gRoomControls.roomScrollX - gRoomControls.roomOriginX) - x0 + DISPLAY_WIDTH);
+1 -2
View File
@@ -1,12 +1,11 @@
#include "global.h"
#include "entity.h"
#include "screen.h"
#include "functions.h"
extern void LoadGfxGroup(u32);
extern void sub_08056250(void);
extern void sub_080570B8(Entity*);
void sub_080570F8(void);
extern void sub_08052D74(void*, void*, void*);
extern void (*const gUnk_08107C5C[])(Entity*);
extern void (*const gUnk_08107C48[])(Entity*);
+7 -8
View File
@@ -1,4 +1,5 @@
#include "global.h"
#include "audio.h"
#include "flags.h"
#include "screen.h"
#include "manager.h"
@@ -78,15 +79,15 @@ extern Entity gUnk_080E4C08;
void sub_0805A370(Manager15* this) {
if (this->manager.unk_0d) {
LoadRoomEntityList(&gUnk_080E4C08);
LoadRoomEntityList((EntityData*)&gUnk_080E4C08);
this->manager.action = 3;
SoundReq(0x80100000);
SoundReq(SONG_RESET_UNK);
}
}
void sub_0805A394(Manager15* this) {
Entity* ent;
if ((ent = FindEntityInListBySubtype(0x3, 0x13, 0x4))) {
if ((ent = FindEntityByID(0x3, 0x13, 0x4))) {
if (ent->type != 4) {
return;
}
@@ -251,10 +252,10 @@ void sub_0805A664(Manager15* this) {
sub_0805A68C(this);
}
extern u32 sub_0806FBFC(u32, u32, u32, u32);
extern u32 CheckPlayerProximity(u32, u32, u32, u32);
void sub_0805A68C(Manager15* this) {
if (sub_0806FBFC(this->unk_38 - 0x18, this->unk_3a - 0x18, 0x30, 0x30)) {
if (CheckPlayerProximity(this->unk_38 - 0x18, this->unk_3a - 0x18, 0x30, 0x30)) {
if (this->unk_2c <= 0x1007) {
gScreen.controls.alphaBlend = ++this->unk_2c;
this->unk_22 = 0;
@@ -285,7 +286,7 @@ void sub_0805A6E8(Manager15* this) {
}
u32 sub_0805A73C(Manager15* this) {
return sub_0806FBFC(this->unk_38 - 0x6, this->unk_3a - 0x6, 0xC, 0xC);
return CheckPlayerProximity(this->unk_38 - 0x6, this->unk_3a - 0x6, 0xC, 0xC);
}
void sub_0805A758(Manager15* this) {
@@ -295,7 +296,6 @@ void sub_0805A758(Manager15* this) {
}
extern void sub_0805E4E0(Manager*, u32);
extern void sub_08077B20(void);
void sub_0805A76C(Manager15* this) {
if ((gPlayerEntity.currentHealth != 0) && (gPlayerEntity.height.HALF.HI == 0) && (!gPlayerState.field_0x2c)) {
@@ -364,7 +364,6 @@ void sub_0805A804(Manager15* this) {
}
void sub_0805AAC8(Manager15*);
extern void sub_08052D74(void*, void*, void*);
void sub_0805A89C(Manager15* this) {
sub_0805E3A0(this, 6);
+5 -5
View File
@@ -4,6 +4,7 @@
#include "entity.h"
#include "room.h"
#include "screen.h"
#include "utils.h"
#include "functions.h"
typedef struct {
@@ -30,7 +31,7 @@ void sub_0805B030(Manager1A* this) {
}
extern void sub_08052D74(void*, void*, void*);
extern u32 sub_0806FBFC(u32, u32, u32, u32);
extern u32 CheckPlayerProximity(u32, u32, u32, u32);
typedef struct struct_08108764 {
u8 unk_00;
@@ -65,13 +66,12 @@ u32 sub_0805B1CC(Manager1A*);
void sub_0805B210(Manager1A*);
void sub_0805B2B0(Manager1A*);
void sub_0805B328(Manager1A*);
void sub_0805BC4C(void);
void sub_0805B048(Manager1A* this) {
struct_08108764* tmp;
Entity* obj;
sub_0805E3A0(&this->manager, 6);
MemClear32(&this->unk_20, 0x20);
MemClear(&this->unk_20, 0x20);
this->manager.action = 1;
this->unk_3f = gRoomControls.roomID;
tmp = &gUnk_08108764[this->manager.unk_0a];
@@ -138,7 +138,7 @@ void sub_0805B168(Manager1A* this) {
u32 sub_0805B1CC(Manager1A* this) {
u32 re = 0;
if (sub_0806FBFC(this->unk_20, this->unk_22, this->unk_24, this->unk_26)) {
if (CheckPlayerProximity(this->unk_20, this->unk_22, this->unk_24, this->unk_26)) {
if ((gPlayerState.flags.all & 0x4) && (gPlayerState.flags.all & 0x1)) {
gPlayerState.flags.all |= 0x8000;
} else if (gPlayerState.flags.all & 0x8000) {
@@ -224,5 +224,5 @@ void sub_0805B390(u32 unk1) {
tmp->type = 0x9;
tmp->subtype = 0x1A;
tmp->unk_0a = unk1;
AppendEntityToList(tmp, 6);
AppendEntityToList((Entity*)tmp, 6);
}
-2
View File
@@ -1,7 +1,6 @@
#include "global.h"
#include "manager.h"
#include "flags.h"
#include "player.h"
#include "functions.h"
typedef struct {
@@ -17,7 +16,6 @@ typedef struct {
enum Manager1E_State { Init, ObserveRegion };
void Manager1E_Handler(Manager1E*);
void Manager1E_Init(Manager1E*);
void Manager1E_ObserveRegion(Manager1E*);
+1 -1
View File
@@ -1,9 +1,9 @@
#include "global.h"
#include "entity.h"
#include "screen.h"
#include "functions.h"
extern void sub_080576A0();
extern void sub_08052D74();
extern void sub_0805754C(Entity*);
void Manager2(Entity* this) {
+2 -3
View File
@@ -3,6 +3,7 @@
#include "flags.h"
#include "entity.h"
#include "room.h"
#include "functions.h"
typedef struct {
Manager manager;
@@ -17,8 +18,6 @@ typedef struct {
u16 unk_3e;
} Manager20;
extern void DeleteManager(Manager20*);
void sub_0805B7A0(Manager20* this) {
Entity* tmp = CreateObject(this->manager.unk_0e, this->manager.unk_0a, this->manager.unk_0b);
if (!tmp)
@@ -35,5 +34,5 @@ void sub_0805B7A0(Manager20* this) {
}
tmp->x.HALF.HI += gRoomControls.roomOriginX;
tmp->y.HALF.HI += gRoomControls.roomOriginY;
DeleteManager(this);
DeleteManager((Manager*)this);
}
+3 -3
View File
@@ -1,10 +1,10 @@
#include "global.h"
#include "audio.h"
#include "entity.h"
#include "flags.h"
#include "functions.h"
extern u32 sub_0805C920(Entity*);
extern void LoadPaletteGroup(u32);
void sub_0805C874(Entity*);
void sub_0805C894(Entity*);
@@ -42,7 +42,7 @@ void sub_0805C894(Entity* this) {
if (sub_0805C920(this)) {
this->action = 2;
this->actionDelay = 1;
SoundReq(0x11a);
SoundReq(SFX_EM_ARMOS_ON);
}
}
@@ -58,7 +58,7 @@ void sub_0805C8B4(Entity* this) {
}
LoadPaletteGroup(gUnk_08108D20[this->field_0xf]);
if (this->field_0xf == 0) {
SoundReq(0x11a);
SoundReq(SFX_EM_ARMOS_ON);
}
}
if (sub_0805C920(this) == 0) {
+4 -5
View File
@@ -11,7 +11,6 @@ typedef struct {
} d;
} Manager28;
void Manager28_Entry(Manager28*);
void Manager28_Init(Manager28*);
void Manager28_Main(Manager28*);
u32 Manager28_FindMatchingEntities(Manager28*);
@@ -47,7 +46,7 @@ void Manager28_Init(Manager28* this) {
/* tmp3->enemies[tmp4] = this->enemies[tmp4]; */
/* } */
tmp3->d = this->d;
AppendEntityToList(tmp3, 6);
AppendEntityToList((Entity*)tmp3, 6);
}
}
DeleteManager(&this->manager);
@@ -86,10 +85,10 @@ u32 Manager28_FindMatchingEntities(Manager28* this) {
EntityData* tmp = GetCurrentRoomProperty(this->manager.unk_0b);
if (!tmp)
return 0;
for (; *((u8*)tmp) != 0xFF && !(tmp->type == 9 && tmp->subtype == 0x28); tmp++) {
for (; *((u8*)tmp) != 0xFF && !(tmp->kind == 9 && tmp->id == 0x28); tmp++) {
Entity* tmp2;
u32 i;
if (tmp->type != 3)
if (tmp->kind != 3)
continue;
tmp2 = Manager28_FindMatchingEntity(tmp);
if (!tmp2)
@@ -115,7 +114,7 @@ Entity* Manager28_FindMatchingEntity(EntityData* unk1) {
y = unk1->yPos + gRoomControls.roomOriginY;
tmp = &gUnk_03003D90;
for (i = tmp->first; (u32)i != (u32)tmp; i = i->next) {
if (x == i->x.HALF.HI && y == i->y.HALF.HI && unk1->subtype == i->id && 3 == i->kind && unk1->form == i->type) {
if (x == i->x.HALF.HI && y == i->y.HALF.HI && unk1->id == i->id && 3 == i->kind && unk1->type == i->type) {
return i;
}
}
+11 -8
View File
@@ -4,8 +4,11 @@
#include "area.h"
#include "room.h"
#include "player.h"
#include "random.h"
#include "functions.h"
// Facilitates the usage of minish portals.
typedef struct {
Manager manager;
u32 unk_20;
@@ -21,7 +24,7 @@ typedef struct {
} Manager3;
extern s8 gUnk_08107C6C[];
extern u32 sub_0806FBFC(u32, u32, u32, u32);
extern u32 CheckPlayerProximity(u32, u32, u32, u32);
extern u32 sub_08057810(void);
extern u32 sub_080002C0(u16, u16, u8);
extern void sub_080577AC(u32, u32, u32);
@@ -34,14 +37,14 @@ void sub_080576C0(Manager3* this) {
this->unk_24 = this->unk_3a + gRoomControls.roomOriginY - 0x20;
return;
}
if (sub_0806FBFC(this->unk_20, this->unk_24, 0x40, 0x40)) {
gArea.field_0x12 = this->unk_20 + 0x20;
gArea.field_0x14 = this->unk_24 + 0x20 + gUnk_08107C6C[this->manager.unk_0a];
gArea.field_0x16 = this->unk_34;
gArea.field_0x17 = this->manager.unk_0a;
if (CheckPlayerProximity(this->unk_20, this->unk_24, 0x40, 0x40)) {
gArea.curPortalX = this->unk_20 + 0x20;
gArea.curPortalY = this->unk_24 + 0x20 + gUnk_08107C6C[this->manager.unk_0a];
gArea.curPortalExitDirection = this->unk_34;
gArea.curPortalType = this->manager.unk_0a;
if (!CheckGlobalFlag(EZERO_1ST)) {
gArea.field_0x18 = 1;
gArea.field_0x17 = 5;
gArea.curPortalType = 5;
} else {
if ((gPlayerState.flags.all & 0x20) && gPlayerState.jumpStatus == 0) {
gArea.field_0x18 = 2;
@@ -90,7 +93,7 @@ void sub_080577AC(u32 baseX, u32 baseY, u32 layer) {
}
u32 sub_08057810(void) {
if ((gPlayerState.flags.all & 0x80) && !gPlayerState.field_0xaa && (gArea.field_0x17 != 0x6) &&
if ((gPlayerState.flags.all & 0x80) && !gPlayerState.field_0xaa && (gArea.curPortalType != 0x6) &&
(gPlayerState.heldObject == 0)) {
switch (gPlayerState.field_0xa8) {
case 0:
+4 -5
View File
@@ -1,4 +1,5 @@
#include "global.h"
#include "audio.h"
#include "manager.h"
#include "flags.h"
#include "functions.h"
@@ -19,8 +20,6 @@ typedef struct Manager30 {
u16 flag_reset;
} Manager30;
extern void sub_0807B7D8(u32, u32, u32);
enum { INIT, IN_PROGRESS, FAILED, SUCCEEDED };
/*
@@ -48,13 +47,13 @@ void Manager30_Main(Manager30* this) {
case 0x317:
// stepped on a red tile again
this->manager.action = FAILED;
SoundReq(0x6d);
SoundReq(SFX_MENU_ERROR);
break;
case 0x318:
// stepped on a blue tile
// turn the tile into a red tile
sub_0807B7D8(0x317, this->player_current_tile, this->manager.unk_0b);
SoundReq(0x6b);
SoundReq(SFX_6B);
// decrease the number of remaining tiles and check if we're done
if (--this->manager.unk_0e == 0) {
this->manager.action = SUCCEEDED;
@@ -89,7 +88,7 @@ void Manager30_Main(Manager30* this) {
SetFlag(this->flag_succeeded);
}
} else {
SoundReq(0x72);
SoundReq(SFX_SECRET);
}
}
}
+4 -4
View File
@@ -3,6 +3,8 @@
#include "screen.h"
#include "area.h"
#include "textbox.h"
#include "utils.h"
#include "game.h"
#include "functions.h"
typedef struct {
@@ -25,9 +27,7 @@ extern const u8 gUnk_08108E30[0x18];
extern const u8 gUnk_08108E48[0x18];
extern const u8 gUnk_08108E60[];
extern void MemCopy(const void* src, void* dest, u32 size);
extern void sub_0805F46C(void*, const void*);
extern u32 CheckIsDungeon(void);
extern void sub_0805E5B4(void);
void sub_0805E140(Manager39*);
@@ -68,7 +68,7 @@ void sub_0805E18C(Manager39* this) {
}
void sub_0805E1D8(Manager39* this) {
MemClear32(&gUnk_02034DF0, 0x80);
MemClear(&gUnk_02034DF0, 0x80);
gScreen.bg.bg0Updated = 1;
DeleteThisEntity();
}
@@ -81,7 +81,7 @@ void sub_0805E1F8(u32 unk0, u32 unk1) {
u8 unk_06[3];
} PACKED tmp;
const u8* tmp2;
MemClear32(&gUnk_02034DF0, 0x80);
MemClear(&gUnk_02034DF0, 0x80);
MemCopy(gUnk_08108E60, &tmp, sizeof(tmp));
tmp.unk_04 = unk0 >> 8;
tmp.unk_05 = unk0;
+1 -4
View File
@@ -3,6 +3,7 @@
#include "room.h"
#include "manager.h"
#include "structures.h"
#include "functions.h"
extern void (*gUnk_08107C70[])(Manager*);
@@ -12,8 +13,6 @@ void sub_08057854(Manager* this) {
extern void sub_080805F8(void);
extern void SetTile(u32, u32, u32);
extern DiggingCaveEntrance* sub_08057AA8(DiggingCaveEntrance*, int);
void sub_0805786C(Manager* this) {
@@ -101,8 +100,6 @@ u32 sub_0805795C(Manager* this, DiggingCaveEntrance* entr) {
}
#endif
extern void sub_0805E5A8(void);
extern void DeleteManager(Manager*);
extern void sub_08080930();
void sub_08057A18(Manager* this, DiggingCaveEntrance* entr) {
+5 -6
View File
@@ -1,4 +1,5 @@
#include "global.h"
#include "audio.h"
#include "manager.h"
#include "flags.h"
#include "functions.h"
@@ -34,8 +35,6 @@ void sub_08057AD0(Manager5* this) {
void sub_08057CA4(Manager5*, u32, u32);
extern void DeleteManager(Manager*);
void sub_08057AE8(Manager5* this) {
u32 tmp;
tmp = (this->manager.unk_0b & 0x3) << 1;
@@ -71,14 +70,14 @@ void sub_08057BA4(Manager5* this) {
sub_08057CA4(this, this->unk_28, this->unk_2a);
sub_0807B7D8(this->unk_30, this->unk_38 | (this->unk_3a << 6), this->unk_3c);
this->manager.unk_0f++;
SoundReq(0x71);
SoundReq(SFX_HEART_GET);
} else {
if (!this->manager.unk_0f)
return;
sub_0807BA8C(this->unk_38 | (this->unk_3a << 6), this->unk_3c);
sub_08057CA4(this, this->unk_2c, this->unk_2e);
this->manager.unk_0f--;
SoundReq(0x71);
SoundReq(SFX_HEART_GET);
}
}
@@ -95,10 +94,10 @@ void sub_08057C28(Manager5* this) {
sub_08057CA4(this, this->unk_28, this->unk_2a);
sub_0807B7D8(this->unk_30, this->unk_38 | (this->unk_3a << 6), this->unk_3c);
this->manager.unk_0f++;
SoundReq(0x71);
SoundReq(SFX_HEART_GET);
} else {
if (this->unk_30 != 0x323) {
SoundReq(0x72);
SoundReq(SFX_SECRET);
}
DeleteManager(&this->manager);
}
+2 -5
View File
@@ -1,12 +1,9 @@
#include "global.h"
#include "entity.h"
#include "player.h"
#include "manager.h"
#include "functions.h"
extern void* GetCurrentRoomProperty(u8);
extern u32 CheckPlayerInRegion(u16, u16, u8, u8);
extern void DoExitTransition(void*);
extern void DeleteManager(Entity*);
void sub_08057CB4(Manager6* this) {
u32 tmp;
@@ -15,7 +12,7 @@ void sub_08057CB4(Manager6* this) {
this->manager.action = 1;
this->warpList = GetCurrentRoomProperty(this->manager.unk_0a);
if (!this->warpList) {
DeleteManager((Entity*)this);
DeleteManager(&this->manager);
return;
}
}
-3
View File
@@ -12,12 +12,9 @@ typedef struct {
void sub_08057E30();
u32 sub_08057E40();
void sub_08057E64();
void sub_08057E7C(u32);
extern void sub_08052D74();
extern u32 sub_08056300(const u16*);
extern void sub_0805E3A0();
extern const u8 gGlobalGfxAndPalettes[];
-2
View File
@@ -17,8 +17,6 @@ void sub_08057EFC();
void sub_08058034(void);
void sub_08058084(u16*, u16*);
extern void sub_08052D74(void*, void*, void*);
extern u16 gMapDataTopSpecial[];
void sub_08057ED0(Manager8* this) {
-1
View File
@@ -15,7 +15,6 @@ void sub_08058210(Manager9*);
u32 sub_08058244(int);
void sub_080582A0(u32, u32*, u8*);
void sub_080582F8(u8*, u8*);
void sub_08058324();
extern u32 gUnk_02006F00[];
extern u8 gBG3Buffer[];
+1 -8
View File
@@ -4,6 +4,7 @@
#include "manager.h"
#include "flags.h"
#include "area.h"
#include "functions.h"
void sub_08058398(ManagerA*);
void sub_080583EC(ManagerA*);
@@ -17,8 +18,6 @@ void sub_08058380(ManagerA* this) {
gUnk_081081F4[this->manager.action](this);
}
extern void sub_0805E3A0(Manager*, u32);
void sub_08058398(ManagerA* this) {
if (CheckFlags(this->unk_3c) != 0) {
@@ -36,8 +35,6 @@ void sub_08058398(ManagerA* this) {
}
}
void sub_08058408(ManagerA*);
void sub_080583EC(ManagerA* this) {
if (CheckFlags(this->unk_3e) != 0) {
this->manager.action = 2;
@@ -45,12 +42,8 @@ void sub_080583EC(ManagerA* this) {
}
}
extern u32 CheckPlayerInRegion(u32, u32, u32, u32);
extern void sub_0805E544(void);
extern void sub_08078A90(u32);
extern void sub_08078AA8(u32, u32);
extern void sub_080186C0(u16);
extern void sub_08078B48(void);
u32 sub_0805848C(ManagerA*);
void sub_080585DC(ManagerA*);

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