mirror of
https://github.com/zeldaret/tmc
synced 2026-08-19 13:54:04 -04:00
Merge branch 'master' of https://github.com/zeldaret/tmc
This commit is contained in:
@@ -1,5 +0,0 @@
|
||||
#include "global.h"
|
||||
|
||||
void _DmaFill32(u32 a1, u32 a2, u32 a3) {
|
||||
DmaFill32(3, a1, a2, a3);
|
||||
}
|
||||
+11
@@ -1,6 +1,17 @@
|
||||
#include "global.h"
|
||||
#include "entity.h"
|
||||
|
||||
extern u8 gArea;
|
||||
extern u8 gUnk_08127D30[];
|
||||
|
||||
bool32 sub_08052620(u32 r0) {
|
||||
return gArea == 0x81;
|
||||
}
|
||||
|
||||
bool32 sub_08052638(u32 r0) {
|
||||
|
||||
return gUnk_08127D30[r0 * 4] == 0x81;
|
||||
}
|
||||
|
||||
u32 sub_08052654() {
|
||||
return (gArea >> 7) & 1;
|
||||
|
||||
@@ -1,81 +0,0 @@
|
||||
#include "global.h"
|
||||
#include "entity.h"
|
||||
#include "link.h"
|
||||
|
||||
extern void (*gUnk_081140D4[])(Entity*);
|
||||
|
||||
extern u16 gUnk_081140CC[];
|
||||
extern u32 gUnk_030010A0;
|
||||
extern void sub_0805E3A0(Entity*, u32);
|
||||
extern void sub_0806D0B0(Entity*);
|
||||
extern void sub_0807DD64(Entity*);
|
||||
extern void sub_0807DDAC(Entity*, u32);
|
||||
extern void sub_0807DDE4(Entity*);
|
||||
extern u32 Random(void);
|
||||
extern void PlaySFX(u32);
|
||||
extern void sub_0806D02C(Entity*);
|
||||
extern Entity* sub_0805EB2C(u32, u32, u32, u32, u32);
|
||||
|
||||
void BigGoron(Entity* this) {
|
||||
gUnk_081140D4[this->entityType.form](this);
|
||||
}
|
||||
|
||||
#ifdef NON_MATCHING
|
||||
void sub_0806CF30(Entity* this) {
|
||||
u8 bVar1;
|
||||
u32 uVar2;
|
||||
int iVar3;
|
||||
|
||||
if (this->action == 0) {
|
||||
this->action = 1;
|
||||
this->previousActionFlag = 1;
|
||||
this->field_0x68 = (this->x).HALF.HI;
|
||||
sub_0805E3A0(this, 2);
|
||||
sub_0806D0B0(this);
|
||||
sub_0807DD64(this);
|
||||
} else {
|
||||
sub_0807DDAC(this, 0);
|
||||
sub_0807DDE4(this);
|
||||
}
|
||||
if (this->previousActionFlag != 2) {
|
||||
|
||||
if (this->previousActionFlag < 3) {
|
||||
if ((gUnk_030010A0 & 3) == 0) {
|
||||
iVar3 = this->x.HALF.HI;
|
||||
if (gLinkEntity.x.HALF.HI < iVar3) {
|
||||
if ((this->field_0x68 - 32) < iVar3) {
|
||||
this->x.HALF.HI = -1;
|
||||
}
|
||||
}
|
||||
if (this->x.HALF.HI > gLinkEntity.x.HALF.HI) {
|
||||
if (this->x.HALF.HI < (this->field_0x68 + 32)) {
|
||||
this->x.HALF.HI += 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
bVar1 = this->actionDelay -= 1;
|
||||
if (bVar1 == 0) {
|
||||
uVar2 = Random();
|
||||
PlaySFX(gUnk_081140CC[uVar2 & 3]);
|
||||
this->actionDelay = ((u8)uVar2 & 7) * 10 + 128;
|
||||
}
|
||||
}
|
||||
sub_0806D02C(this);
|
||||
}
|
||||
#else
|
||||
NAKED
|
||||
void sub_0806CF30(Entity* this) {
|
||||
asm(".include \"asm/non_matching/bigGoron/sub_0806CF30.inc\"");
|
||||
}
|
||||
#endif
|
||||
|
||||
void sub_0806D00C(Entity* this) {
|
||||
Entity* pEVar1;
|
||||
|
||||
pEVar1 = sub_0805EB2C(7, 76, 7, 0, 0);
|
||||
if (pEVar1 != NULL) {
|
||||
this->parent = pEVar1;
|
||||
}
|
||||
}
|
||||
Executable
+567
@@ -0,0 +1,567 @@
|
||||
#include "global.h"
|
||||
#include "functions.h"
|
||||
#include "main.h"
|
||||
#include "player.h"
|
||||
#include "readKeyInput.h"
|
||||
#include "screen.h"
|
||||
|
||||
typedef struct {
|
||||
u8 filler0[0x5];
|
||||
u8 state;
|
||||
u8 subState;
|
||||
u16 timer;
|
||||
u8 fillerA[0x26];
|
||||
} ChooseFileState;
|
||||
|
||||
// TODO: This occupies the same memory region as gMenu
|
||||
extern ChooseFileState gChooseFileState;
|
||||
|
||||
typedef struct {
|
||||
u8 filler0[0x1];
|
||||
u8 unk1;
|
||||
u8 unk2;
|
||||
u8 unk3;
|
||||
u16 unk4;
|
||||
u16 unk6;
|
||||
u8* unk8;
|
||||
} struct_02036540;
|
||||
|
||||
typedef struct {
|
||||
u8 filler0[0x10];
|
||||
u16 unk10;
|
||||
u8 filler12[0x6];
|
||||
} struct_080FC844;
|
||||
|
||||
typedef struct {
|
||||
u8 filler0[0x4];
|
||||
} struct_020227E8;
|
||||
|
||||
extern struct_020227E8 gUnk_020227E8;
|
||||
|
||||
typedef struct {
|
||||
u8 filler0[0x29C];
|
||||
u16 unk29C;
|
||||
u8 filler29E[0x562];
|
||||
} struct_02034CB0;
|
||||
|
||||
extern struct_02034CB0 gUnk_02034CB0;
|
||||
extern struct_02034CB0 gUnk_02021F30;
|
||||
extern SaveFile gSaveFiles[];
|
||||
extern u32 gUsedPalettes;
|
||||
extern u8 gUnk_02000D00[];
|
||||
extern u16 gUnk_03001010[5];
|
||||
|
||||
static void sub_08050624(u32);
|
||||
static void sub_0805066C(void);
|
||||
static void sub_080507FC(void);
|
||||
|
||||
extern void sub_0801D66C(const void* src, void* dest, u32 size);
|
||||
extern void sub_08056FEC(u32, struct_020227E8*);
|
||||
extern void sub_0805F46C(u32, struct_080FC844*);
|
||||
extern void sub_0801C4A0(u32, u32);
|
||||
extern void sub_08080668(void);
|
||||
extern void sub_0805194C(u32);
|
||||
extern void LoadPalettes(const u8*, int, int);
|
||||
extern struct_02036540* sub_0805F2C8(void);
|
||||
extern void sub_0805F7DC(u32, struct_02036540*);
|
||||
extern void sub_0805F300(struct_02036540*);
|
||||
extern void sub_08050A64(u32);
|
||||
extern void sub_08050AFC(u32);
|
||||
|
||||
extern const struct_080FC844 gUnk_080FC844;
|
||||
extern const u16 gUnk_080FC85C[][3];
|
||||
extern void (*const gUnk_080FC8A4[])(void);
|
||||
extern void (*const gUnk_080FC8B0[])(void);
|
||||
extern void (*const gUnk_080FC8FC[])(void);
|
||||
extern void (*const gUnk_080FC908[])(void);
|
||||
extern const u8 gUnk_080FC8D0[];
|
||||
extern const u16 gUnk_080FC8DE[];
|
||||
extern const u8 gGlobalGfxAndPalettes[];
|
||||
|
||||
void sub_08050318(u32 arg0, u32 arg1) {
|
||||
u32 sfx;
|
||||
struct_080FC844 var0;
|
||||
|
||||
sub_08050384();
|
||||
sub_0801D66C(&gUnk_080FC844, &var0, sizeof(gUnk_080FC844));
|
||||
sub_08056FEC(arg1, &gUnk_020227E8);
|
||||
var0.unk10 |= gUnk_080FC85C[arg0][0] << 0xC;
|
||||
sub_0805F46C(gUnk_080FC85C[arg0][1], &var0);
|
||||
sfx = gUnk_080FC85C[arg0][2];
|
||||
if (sfx) {
|
||||
PlaySFX(sfx);
|
||||
}
|
||||
gScreen.bg.bg3Control = 1;
|
||||
}
|
||||
|
||||
void sub_08050384(void) {
|
||||
sub_0801C4A0(0, 0);
|
||||
_DmaZero(&gUnk_02034CB0, sizeof(gUnk_02034CB0));
|
||||
gScreen.bg.bg3Control = 1;
|
||||
}
|
||||
|
||||
void sub_080503A8(u32 gfxGroup) {
|
||||
LoadGfxGroup(gfxGroup);
|
||||
gScreen.bg.bg2yOffset = 1;
|
||||
gScreen.affine.unk = 1;
|
||||
}
|
||||
|
||||
void sub_080503BC(u8 state) {
|
||||
gUnk_02032EC0.state = state;
|
||||
_DmaZero(&gUnk_02034CB0, sizeof(gUnk_02034CB0));
|
||||
_DmaZero(&gUnk_02021F30, sizeof(gUnk_02021F30));
|
||||
}
|
||||
|
||||
void sub_080503E4(u32 saveFileId) {
|
||||
u8 messageSpeed;
|
||||
u8 brightnessPref;
|
||||
|
||||
if (saveFileId > 2) {
|
||||
messageSpeed = 1;
|
||||
brightnessPref = 1;
|
||||
} else {
|
||||
SaveFile* saveFile = &gSaveFiles[saveFileId];
|
||||
messageSpeed = saveFile->messageSpeed;
|
||||
brightnessPref = saveFile->brightnessPref;
|
||||
}
|
||||
|
||||
((struct_02000000 *)0x2000000)->messageSpeed = messageSpeed;
|
||||
((struct_02000000 *)0x2000000)->brightnessPref = brightnessPref;
|
||||
gUsedPalettes = 0xFFFFFFFF;
|
||||
}
|
||||
|
||||
void sub_0805041C(u32 saveFileId) {
|
||||
SaveFile* saveFile;
|
||||
|
||||
if (saveFileId < 3) {
|
||||
((struct_02000000 *)0x2000000)->saveFileId = saveFileId;
|
||||
saveFile = &gSaveFiles[saveFileId];
|
||||
sub_0801D66C(saveFile, &gUnk_02002A40, sizeof(*saveFile));
|
||||
}
|
||||
sub_080503E4(saveFileId);
|
||||
}
|
||||
|
||||
void HandleChooseFileScreen(void) {
|
||||
sub_080AD90C();
|
||||
gUnk_080FC8A4[gUnk_03001000.funcIndex]();
|
||||
if (gUnk_02032EC0.transitionType != gUnk_02032EC0.state) {
|
||||
gUnk_02032EC0.transitionType = gUnk_02032EC0.state;
|
||||
gScreen.bg.bg1Control = 0;
|
||||
gScreen.bg.bg2Control = 0;
|
||||
gScreen.bg.bg1yOffset = 0;
|
||||
gScreen.bg.bg2xOffset = 0;
|
||||
gScreen.affine.bg2xOffset = 0;
|
||||
gScreen.affine.bg2yOffset = 0;
|
||||
_DmaZero(&gChooseFileState, sizeof(gChooseFileState));
|
||||
}
|
||||
|
||||
sub_080507FC();
|
||||
gUnk_080FC8B0[gUnk_02032EC0.transitionType]();
|
||||
gUnk_02019EE0.unk0 = 0;
|
||||
sub_0805E5C0();
|
||||
sub_0805066C();
|
||||
sub_0801C1D4();
|
||||
sub_0801C208();
|
||||
sub_080AD9B0();
|
||||
sub_080AD918();
|
||||
if (gUnk_02019EE0.unk3 != ((struct_02000000 *)0x2000000)->gameLanguage) {
|
||||
gUnk_02019EE0.unk3 = ((struct_02000000 *)0x2000000)->gameLanguage;
|
||||
sub_080503A8(0x6);
|
||||
sub_080503A8(0xF);
|
||||
}
|
||||
}
|
||||
|
||||
void sub_080504F4(void) {
|
||||
u32 i;
|
||||
|
||||
sub_0801DA90(1);
|
||||
sub_080A3210();
|
||||
_DmaZero((void*)VRAM, 0x80);
|
||||
sub_08056418();
|
||||
EraseAllEntities();
|
||||
sub_08080668();
|
||||
sub_080ADD30();
|
||||
sub_0801CFA8(0);
|
||||
_DmaZero(&gUnk_0200AF00, sizeof(gUnk_0200AF00));
|
||||
_DmaZero(&gUnk_02019EE0, sizeof(gUnk_02019EE0));
|
||||
gUnk_02019EE0.unk3 = 7;
|
||||
gUnk_02019EE0.unk6 = ((struct_02000000 *)0x2000000)->gameLanguage > 1 ? 3 : 0;
|
||||
_DmaZero(&gUnk_02032EC0, sizeof(gUnk_02032EC0));
|
||||
gUnk_02032EC0.transitionType = 8;
|
||||
sub_080503BC(0);
|
||||
sub_0805616C();
|
||||
sub_08050624(0);
|
||||
sub_08050624(1);
|
||||
sub_08050624(2);
|
||||
sub_08056208();
|
||||
sub_080503A8(0x5);
|
||||
LoadPaletteGroup(0x9);
|
||||
for (i = 0; i < 26; i++) {
|
||||
CreateObject(0x48, i, 0);
|
||||
}
|
||||
|
||||
sub_080A70AC(gUnk_080FC8D0);
|
||||
sub_080507FC();
|
||||
gScreen.lcd.displayControl |= 0x1F00;
|
||||
gScreen.affine.bg3Control = 0x1E0B;
|
||||
gScreen.controls.layerFXControl = 0x844;
|
||||
gScreen.controls.alphaBlend = BLDALPHA_BLEND(15, 10);
|
||||
gUnk_02024490.unk0 = 1;
|
||||
gUnk_03001000.funcIndex = 1;
|
||||
PlaySFX(0x7);
|
||||
DoFade(4, 8);
|
||||
}
|
||||
|
||||
void nullsub_479(void) {
|
||||
}
|
||||
|
||||
void sub_0805060C(void) {
|
||||
if (!gFadeControl.active) {
|
||||
InitScreen(SCREEN_GAMEPLAY);
|
||||
}
|
||||
}
|
||||
|
||||
static void sub_08050624(u32 saveFileId) {
|
||||
SaveFile* saveFile = &gSaveFiles[saveFileId];
|
||||
int var0 = sub_0807CF28(saveFileId, saveFile);
|
||||
switch (var0) {
|
||||
case -1:
|
||||
sub_0807CF48(saveFileId);
|
||||
// fallthrough
|
||||
case 0:
|
||||
sub_0805194C(saveFileId);
|
||||
break;
|
||||
}
|
||||
gUnk_02019EE0.unk8[saveFileId] = var0;
|
||||
}
|
||||
|
||||
static void sub_0805066C(void) {
|
||||
u32 loadNewPalette;
|
||||
const u8* paletteOffset;
|
||||
|
||||
loadNewPalette = FALSE;
|
||||
if (--gUnk_02019EE0.unk1 == 0) {
|
||||
gUnk_02019EE0.unk1 = 16;
|
||||
gUnk_02019EE0.unk2 = (gUnk_02019EE0.unk2 + 1) % 15;
|
||||
loadNewPalette = TRUE;
|
||||
}
|
||||
|
||||
if (gUnk_02019EE0.unk2 == 0) {
|
||||
gUnk_02019EE0.unk2 = 1;
|
||||
gUnk_02019EE0.unk1 = (Random() & 0x7) * 16 + 8;
|
||||
loadNewPalette = TRUE;
|
||||
}
|
||||
|
||||
if (loadNewPalette) {
|
||||
paletteOffset = &gGlobalGfxAndPalettes[gUnk_080FC8DE[gUnk_02019EE0.unk2]];
|
||||
LoadPalettes(&paletteOffset[0x11AA0], 11, 1);
|
||||
LoadPalettes(&paletteOffset[0x11BA0], 12, 1);
|
||||
LoadPalettes(&paletteOffset[0x11CA0], 13, 1);
|
||||
LoadPalettes(&paletteOffset[0x11DA0], 14, 1);
|
||||
}
|
||||
}
|
||||
|
||||
void sub_0805070C(void) {
|
||||
u32 i;
|
||||
int j;
|
||||
struct_02036540* var0;
|
||||
u8* playerName;
|
||||
|
||||
var0 = sub_0805F2C8();
|
||||
if (var0) {
|
||||
var0->unk2 = 0;
|
||||
var0->unk3 = 5;
|
||||
var0->unk1 = 1;
|
||||
var0->unk4 = 0x30;
|
||||
var0->unk8 = gUnk_02000D00;
|
||||
for (i = 0; i < 3; i++) {
|
||||
var0->unk6 = 0;
|
||||
_DmaZero(var0->unk8, 0x200);
|
||||
playerName = gSaveFiles[i].playerName;
|
||||
for (j = 0; j < 6; j++) {
|
||||
sub_0805F7DC(playerName[j], var0);
|
||||
}
|
||||
sub_0801D66C(var0->unk8, (void*)(OBJ_VRAM0 + 0x4000 + i * 0x200), 0x200);
|
||||
}
|
||||
sub_0805F300(var0);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void sub_08050790(void) {
|
||||
u32 i, j;
|
||||
struct_02036540* var0;
|
||||
u32 var1;
|
||||
|
||||
var0 = sub_0805F2C8();
|
||||
if (var0) {
|
||||
var0->unk2 = 0;
|
||||
var0->unk3 = 5;
|
||||
var0->unk1 = 1;
|
||||
var0->unk4 = 0x80;
|
||||
var0->unk8 = gUnk_02000D00;
|
||||
for (i = 0; i < 16; i++) {
|
||||
var0->unk6 = 0;
|
||||
var1 = i * 16;
|
||||
for (j = 0; j < 16; j++) {
|
||||
sub_0805F7DC(var1, var0);
|
||||
var1++;
|
||||
}
|
||||
sub_0801D66C(gUnk_02000D00, (void*)(BG_VRAM + i * 0x400), 0x400);
|
||||
}
|
||||
sub_0805F300(var0);
|
||||
}
|
||||
}
|
||||
|
||||
static void sub_080507FC(void) {
|
||||
gUnk_0200AF00.unk1A = 0x140;
|
||||
gUnk_0200AF00.unk20 = 0x24;
|
||||
}
|
||||
|
||||
void sub_08050810(void) {
|
||||
gUnk_0200AF00.unk1A = 0xD0;
|
||||
gUnk_0200AF00.unk20 = 0x24;
|
||||
}
|
||||
|
||||
void sub_08050820(void) {
|
||||
gUnk_080FC8FC[gChooseFileState.state]();
|
||||
sub_08050A64(gUnk_02019EE0.unk6);
|
||||
}
|
||||
|
||||
void sub_08050848(void) {
|
||||
sub_080503A8(0x7);
|
||||
sub_0805070C();
|
||||
gUnk_02019EE0.unk7 = 0;
|
||||
sub_08050AFC(gUnk_02019EE0.unk6);
|
||||
sub_080A7114(1);
|
||||
}
|
||||
|
||||
void sub_0805086C(void) {
|
||||
gUnk_080FC908[gChooseFileState.subState]();
|
||||
}
|
||||
|
||||
void sub_08050888(void) {
|
||||
if (!gFadeControl.active) {
|
||||
switch (gUnk_02019EE0.unk8[gUnk_02019EE0.unk7]) {
|
||||
case 0:
|
||||
sub_0805194C(gUnk_02019EE0.unk7);
|
||||
gChooseFileState.subState = 2;
|
||||
break;
|
||||
case 1:
|
||||
gChooseFileState.subState = 2;
|
||||
break;
|
||||
default:
|
||||
sub_0805194C(gUnk_02019EE0.unk7);
|
||||
sub_08050318(0, gUnk_02019EE0.unk7 + 1);
|
||||
gChooseFileState.timer = 30;
|
||||
gChooseFileState.subState = 1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void sub_080508E4(void) {
|
||||
if (gChooseFileState.timer == 0) {
|
||||
if (gUnk_03000FF0.newKeys & (A_BUTTON | START_BUTTON)) {
|
||||
gChooseFileState.subState = 2;
|
||||
}
|
||||
} else {
|
||||
gChooseFileState.timer--;
|
||||
}
|
||||
}
|
||||
|
||||
void sub_08050910(void) {
|
||||
sub_08050384();
|
||||
if (++gUnk_02019EE0.unk7 > 2) {
|
||||
sub_080A7114(2);
|
||||
} else {
|
||||
gChooseFileState.subState = 0;
|
||||
}
|
||||
}
|
||||
|
||||
void sub_08050940(void) {
|
||||
int saveFileId;
|
||||
u32 newKeys;
|
||||
int var1;
|
||||
u32 var2;
|
||||
|
||||
if (gUnk_02019EE0.unk0) {
|
||||
return;
|
||||
}
|
||||
|
||||
saveFileId = gUnk_02019EE0.unk6;
|
||||
newKeys = gUnk_03000FF0.newKeys;
|
||||
if ((gUnk_03000FF0.heldKeys & L_BUTTON) && gUnk_02019EE0.unk8[saveFileId] == 1) {
|
||||
newKeys &= ~(DPAD_UP | DPAD_DOWN);
|
||||
}
|
||||
|
||||
var1 = ((struct_02000000 *)0x2000000)->gameLanguage > 1 ? 4 : 3;
|
||||
var2 = gUnk_02032EC0.transitionType;
|
||||
switch (newKeys) {
|
||||
case DPAD_UP:
|
||||
if (saveFileId > 0) {
|
||||
saveFileId--;
|
||||
}
|
||||
break;
|
||||
case DPAD_DOWN:
|
||||
if (var1 - 1 > saveFileId) {
|
||||
saveFileId++;
|
||||
}
|
||||
break;
|
||||
case R_BUTTON:
|
||||
if (gUnk_02019EE0.unk8[saveFileId] == 1) {
|
||||
var2 = 3;
|
||||
}
|
||||
break;
|
||||
case A_BUTTON:
|
||||
case START_BUTTON:
|
||||
sub_0805041C(saveFileId);
|
||||
if (saveFileId == 3) {
|
||||
var2 = 2;
|
||||
} else {
|
||||
switch (gUnk_02019EE0.unk8[saveFileId]) {
|
||||
case 0:
|
||||
var2 = 1;
|
||||
break;
|
||||
case 1:
|
||||
var2 = 4;
|
||||
break;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
if (gUnk_02032EC0.transitionType != var2) {
|
||||
sub_080503BC(var2);
|
||||
PlaySFX(0x6A);
|
||||
}
|
||||
|
||||
saveFileId = (saveFileId + var1) % var1;
|
||||
if (gUnk_02019EE0.unk6 != saveFileId) {
|
||||
gUnk_02019EE0.unk6 = saveFileId;
|
||||
sub_08050AFC(saveFileId);
|
||||
PlaySFX(0x69);
|
||||
}
|
||||
|
||||
if (gUnk_02019EE0.unk8[gUnk_02019EE0.unk6] == 1) {
|
||||
sub_08050810();
|
||||
}
|
||||
}
|
||||
|
||||
void sub_08050A64(u32 saveFileId) {
|
||||
if (gUnk_02019EE0.unk8[saveFileId] != 1) {
|
||||
return;
|
||||
}
|
||||
|
||||
gUnk_03001010[2] = 0;
|
||||
gUnk_03001010[3] = 0;
|
||||
gUnk_03001010[4] = 0x400;
|
||||
|
||||
// Draw the save file's obtained elements.
|
||||
if (GetInventoryValue(0x40)) {
|
||||
gUnk_03001010[0] = 0xA2;
|
||||
gUnk_03001010[1] = 0x36;
|
||||
sub_080ADA14(0x145, 0x24);
|
||||
}
|
||||
if (GetInventoryValue(0x41)) {
|
||||
gUnk_03001010[0] = 0x96;
|
||||
gUnk_03001010[1] = 0x3D;
|
||||
sub_080ADA14(0x145, 0x22);
|
||||
}
|
||||
if (GetInventoryValue(0x42)) {
|
||||
gUnk_03001010[0] = 0xAE;
|
||||
gUnk_03001010[1] = 0x3D;
|
||||
sub_080ADA14(0x145, 0x23);
|
||||
}
|
||||
if (GetInventoryValue(0x43)) {
|
||||
gUnk_03001010[0] = 0xA2;
|
||||
gUnk_03001010[1] = 0x44;
|
||||
sub_080ADA14(0x145, 0x21);
|
||||
}
|
||||
}
|
||||
|
||||
void sub_08050B3C(u16*);
|
||||
|
||||
void sub_08050AFC(u32 saveFileId) {
|
||||
sub_0805041C(saveFileId);
|
||||
_DmaZero(&gUnk_02021F30, sizeof(gUnk_02021F30));
|
||||
if (gUnk_02019EE0.unk8[saveFileId] == 1) {
|
||||
sub_08050B3C(&gUnk_02021F30.unk29C);
|
||||
}
|
||||
gScreen.bg.bg2yOffset = 1;
|
||||
}
|
||||
|
||||
// typedef struct {
|
||||
// u16* unk0;
|
||||
// u32 unk4;
|
||||
// } unk_08050B3C;
|
||||
|
||||
// extern const u16 gUnk_080FC914[];
|
||||
|
||||
// void sub_08050B3C(u16* arg0) {
|
||||
// unk_08050B3C sp;
|
||||
// int var0;
|
||||
// int var1;
|
||||
// int var2;
|
||||
// int var3;
|
||||
// int var4;
|
||||
// int var5;
|
||||
// int var6;
|
||||
// int var7;
|
||||
// u16* var8;
|
||||
|
||||
// sp.unk0 = arg0;
|
||||
// var0 = gUnk_02002A40.stats.health * 2;
|
||||
// if (var0 == 0) {
|
||||
// var0 = 1;
|
||||
// }
|
||||
|
||||
// var1 = gUnk_02002A40.stats.maxHealth * 2;
|
||||
// if (var1 == 0) {
|
||||
// return;
|
||||
// }
|
||||
|
||||
// if (var0 > var1) {
|
||||
// var0 = var1;
|
||||
// }
|
||||
|
||||
// sp.unk4 = var0 & 0x3;
|
||||
// var2 = var0 >> 2;
|
||||
// var5 = var2;
|
||||
// if (var2 > 10) {
|
||||
// var5 = 10;
|
||||
// }
|
||||
|
||||
// var6 = var2;
|
||||
// var6 -= 10;
|
||||
// var7 = var6;
|
||||
// if (var6 < 0) {
|
||||
// var7 = 0;
|
||||
// }
|
||||
|
||||
// var1 = var1 >> 2;
|
||||
// var4 = var1;
|
||||
// if (var1 > 10) {
|
||||
// var1 = 10;
|
||||
// }
|
||||
|
||||
// var4 -= 10;
|
||||
// sp.unk0[0] = 0xF24C;
|
||||
// DmaCopy16(3, &gUnk_080FC914[10 - var5], &sp.unk0[1], var1 * 2);
|
||||
// if (var4 > 0) {
|
||||
// sp.unk0[0x20] = 0xF24C;
|
||||
// DmaCopy16(3, &gUnk_080FC914[10 - var7], &sp.unk0[1], var4 * 2);
|
||||
// }
|
||||
|
||||
// if (!sp.unk4) {
|
||||
// return;
|
||||
// }
|
||||
|
||||
// var8 = sp.unk0;
|
||||
// if (var2 >= 10) {
|
||||
// var2 = var6;
|
||||
// var8 += 0x20;
|
||||
// }
|
||||
|
||||
// var8[var2 + 1] = sp.unk4 - 0xDB3;
|
||||
// }
|
||||
@@ -0,0 +1,29 @@
|
||||
#include "global.h"
|
||||
#include "entity.h"
|
||||
|
||||
extern u32 SetTileType(u32 tileID, u32 tilePos, u32 layerID);
|
||||
|
||||
void CreateMinishEntrance(u32 tilePos)
|
||||
{
|
||||
u32 x, y;
|
||||
u32 tileID = 0x185;
|
||||
|
||||
for (y = 0; y <= 3; y++) {
|
||||
for (x = 0; x <= 4; x++) {
|
||||
SetTileType(tileID++, tilePos + x, 1);
|
||||
}
|
||||
tilePos += 0x40;
|
||||
}
|
||||
}
|
||||
|
||||
void sub_08018C58(u32 tilePos)
|
||||
{
|
||||
u32 i = 0;
|
||||
|
||||
for (;i < 6;) {
|
||||
SetTileType(0x260 + i, tilePos, 1);
|
||||
SetTileType(0x261 + i, tilePos + 1, 1);
|
||||
i += 2;
|
||||
tilePos += 0x40;
|
||||
}
|
||||
}
|
||||
Executable
+43
@@ -0,0 +1,43 @@
|
||||
#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);
|
||||
}
|
||||
Executable
+96
@@ -0,0 +1,96 @@
|
||||
#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;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
#include "global.h"
|
||||
#include "entity.h"
|
||||
#include "functions.h"
|
||||
|
||||
//extern void DmaZero(void*, u32);
|
||||
|
||||
typedef struct {
|
||||
u16 unk0;
|
||||
u16 filler2[32];
|
||||
u16 unk66;
|
||||
} struct_0300110C;
|
||||
|
||||
extern struct_0300110C gUnk_0300110C;
|
||||
|
||||
void sub_080300AC(void) {
|
||||
_DmaZero(&gUnk_0300110C.unk0, 0x44);
|
||||
gUnk_0300110C.unk66 = 0xff;
|
||||
}
|
||||
|
||||
void sub_080300C4(void) {
|
||||
if (gScreenTransition.field_0xae == 0xff) {
|
||||
gScreenTransition.field_0xac = 0;
|
||||
_DmaZero(&gScreenTransition.field_0x4c[32], 0x40);
|
||||
}
|
||||
}
|
||||
+1
-1
@@ -22,4 +22,4 @@ u32 sub_08049D1C(u32 arg0) {
|
||||
u32 output = 1;
|
||||
output &= ~bitmask;
|
||||
return output;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,76 @@
|
||||
#include "global.h"
|
||||
#include "entity.h"
|
||||
#include "area.h"
|
||||
#include "main.h"
|
||||
#include "functions.h"
|
||||
#include "screen.h"
|
||||
|
||||
typedef struct {
|
||||
u8 filler [18];
|
||||
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) {
|
||||
gUnk_03001000.transition = 4;
|
||||
gArea.filler[8] = 0;
|
||||
gArea.filler[9] = 0;
|
||||
*(u16*)&gArea.filler[10] = 0;
|
||||
sub_0805E5A8();
|
||||
return 1;
|
||||
}
|
||||
else {
|
||||
gArea.filler[18] = gArea.fadeOut;
|
||||
*(vu8*)&gArea.fadeOut = gArea.fadeOut;
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
void sub_0804AAB8(void)
|
||||
{
|
||||
gUnk_080D4120[gArea.filler[8]]();
|
||||
}
|
||||
|
||||
void sub_0804AAD4(void)
|
||||
{
|
||||
_DmaZero((void *)&gUnk_02018EB0, 0x28);
|
||||
gUnk_02018EB0.unk = 0;
|
||||
EraseAllEntities();
|
||||
CreateObject(0x3d, gArea.field_0x17, 0);
|
||||
gArea.filler[8]++;
|
||||
}
|
||||
|
||||
void sub_0804AB04(void)
|
||||
{
|
||||
sub_0805E5C0();
|
||||
if (gArea.field_0x10 != 0) {
|
||||
sub_080AD90C();
|
||||
sub_080AD9B0();
|
||||
sub_080AD918();
|
||||
}
|
||||
}
|
||||
|
||||
void sub_0804AB24(void)
|
||||
{
|
||||
if (!gFadeControl.active) {
|
||||
gScreen.lcd.displayControl = 0;
|
||||
sub_0801E104();
|
||||
gArea.filler[8] = 0;
|
||||
MenuFadeIn(6, 0);
|
||||
gFadeControl.active = 0;
|
||||
}
|
||||
}
|
||||
|
||||
void sub_0804AB54(void)
|
||||
{
|
||||
gUnk_080D412C[gArea.filler[8]]();
|
||||
}
|
||||
@@ -0,0 +1,274 @@
|
||||
#include "global.h"
|
||||
#include "entity.h"
|
||||
#include "player.h"
|
||||
#include "room.h"
|
||||
#include "menu.h"
|
||||
|
||||
typedef struct {
|
||||
u8 filler[0xa8];
|
||||
Stats stats;
|
||||
} SaveFile;
|
||||
|
||||
typedef struct {
|
||||
u8 unk;
|
||||
u8 filler[7];
|
||||
} struct_080FD5B4;
|
||||
|
||||
typedef struct {
|
||||
u8 filler[0x2e];
|
||||
u8 unk;
|
||||
} ScreenTransition;
|
||||
|
||||
extern SaveFile gUnk_02002A40;
|
||||
extern struct_080FD5B4 gUnk_080FD5B4[];
|
||||
extern ScreenTransition gScreenTransition;
|
||||
|
||||
extern u8 gUnk_0200AF13;
|
||||
extern u8 gUnk_0200AF14;
|
||||
extern u32 gUnk_080015BC;
|
||||
extern u8 gUnk_080FE1C6[];
|
||||
extern u32 gUnk_02034398;
|
||||
extern void (*const gUnk_080FE2A0[])();
|
||||
|
||||
|
||||
u32 IsItemEquipped(u32 itemID) {
|
||||
u32 ret;
|
||||
|
||||
if (itemID == gUnk_02002A40.stats.itemOnA)
|
||||
ret = 0;
|
||||
else if (itemID == gUnk_02002A40.stats.itemOnB)
|
||||
ret = 1;
|
||||
else
|
||||
ret = 2;
|
||||
return ret;
|
||||
}
|
||||
|
||||
#if NON_MATCHING // reg-alloc
|
||||
void PutItemOnSlot(u32 itemID) {
|
||||
u32 itemSlot;
|
||||
if (itemID < 0x47) {
|
||||
ModifyInventory(0, 1);
|
||||
}
|
||||
if (itemID - 1 < 0x1f) {
|
||||
itemSlot = 2;
|
||||
if (gUnk_02002A40.stats.itemOnA == 0) {
|
||||
itemSlot = 0;
|
||||
} else if (gUnk_02002A40.stats.itemOnB == 0) {
|
||||
itemSlot = 1;
|
||||
}
|
||||
if (itemSlot == 2) {
|
||||
u8 temp = gUnk_080FD5B4[itemID].unk;
|
||||
if (temp == gUnk_080FD5B4[gUnk_02002A40.stats.itemOnA].unk) {
|
||||
itemSlot = 0;
|
||||
} else {
|
||||
if (temp == gUnk_080FD5B4[gUnk_02002A40.stats.itemOnB].unk) {
|
||||
itemSlot = 1;
|
||||
}
|
||||
}
|
||||
if (itemSlot == 2) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
ForceEquipItem(itemID, itemSlot);
|
||||
}
|
||||
}
|
||||
#else
|
||||
NAKED
|
||||
void PutItemOnSlot(u32 itemID) {
|
||||
asm(".include \"asm/non_matching/putItemOnSlot.s\"");
|
||||
}
|
||||
#endif
|
||||
|
||||
u32 SetBottleContents(u32 itemID, u32 bottleIndex) {
|
||||
|
||||
if (bottleIndex > 3) {
|
||||
bottleIndex = 0;
|
||||
if (gUnk_02002A40.stats.filler2[0] != 0x20) {
|
||||
do {
|
||||
bottleIndex++;
|
||||
if (bottleIndex > 3) {
|
||||
return bottleIndex;
|
||||
}
|
||||
} while (gUnk_02002A40.stats.filler2[bottleIndex] != 0x20);
|
||||
}
|
||||
if (bottleIndex > 3) {
|
||||
return bottleIndex;
|
||||
}
|
||||
}
|
||||
gUnk_02002A40.stats.filler2[bottleIndex] = itemID;
|
||||
return bottleIndex;
|
||||
}
|
||||
|
||||
u32 sub_0805449C(u32 arg0) {
|
||||
switch (arg0) {
|
||||
case 1:
|
||||
case 2:
|
||||
case 3:
|
||||
case 4:
|
||||
case 6:
|
||||
return 1;
|
||||
default:
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
u32 sub_080544B4(u32 arg0) {
|
||||
switch (arg0) {
|
||||
case 13:
|
||||
case 14:
|
||||
return 1;
|
||||
default:
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
u32 sub_080544C8(u32 arg0) {
|
||||
switch (arg0) {
|
||||
case 28:
|
||||
case 29:
|
||||
case 30:
|
||||
case 31:
|
||||
return 1;
|
||||
default:
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
u32 sub_080544DC(u32 arg0) {
|
||||
if (arg0 == gUnk_02002A40.stats.filler2[0]) {
|
||||
return 1;
|
||||
} else if (arg0 == gUnk_02002A40.stats.filler2[1]) {
|
||||
return 2;
|
||||
} else if (arg0 == gUnk_02002A40.stats.filler2[2]) {
|
||||
return 3;
|
||||
} else if (arg0 == gUnk_02002A40.stats.filler2[3]) {
|
||||
return 4;
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
#if NON_MATCHING // reg-alloc
|
||||
void sub_08054524(void) {
|
||||
u32 bVar1;
|
||||
|
||||
bVar1 = gArea.locationIndex;
|
||||
if (gArea.locationIndex == 0) {
|
||||
bVar1 = gScreenTransition.unk;
|
||||
}
|
||||
if (bVar1 > 0x16) {
|
||||
bVar1 = 0;
|
||||
}
|
||||
|
||||
sub_0801D66C(&gUnk_080015BC + gUnk_080FE1C6[bVar1] * 0x8, &gUnk_02034398, 0x20);
|
||||
}
|
||||
#else
|
||||
NAKED
|
||||
void sub_08054524(void) {
|
||||
asm(".include \"asm/non_matching/sub_08054524.inc\"");
|
||||
}
|
||||
#endif
|
||||
|
||||
void sub_08054564(void) {
|
||||
gRoomVars.filler[2] = 1;
|
||||
}
|
||||
|
||||
void sub_08054570(void) {
|
||||
gRoomVars.filler[2] = 0;
|
||||
}
|
||||
|
||||
NAKED
|
||||
u32 sub_0805457C(u32 arg0, u32 arg1) {
|
||||
asm(".include \"asm/non_matching/code_0805457C.inc\"");
|
||||
}
|
||||
|
||||
/*
|
||||
extern u8 gUnk_080FE1DD[];
|
||||
|
||||
u32 CreateItemDrop(Entity* arg0, u32 itemID, u32 itemParameter) {
|
||||
u32 prereqID;
|
||||
u32 adjustedParam;
|
||||
u32 uVar1;
|
||||
Entity* itemEntity;
|
||||
|
||||
adjustedParam = (u8)itemParameter;
|
||||
switch (adjustedParam) {
|
||||
case 0x3f:
|
||||
if (!GetInventoryValue(0x40)) {
|
||||
return 0;
|
||||
}
|
||||
if (itemParameter == 0) {
|
||||
adjustedParam = 1;
|
||||
}
|
||||
case 0x5d:
|
||||
if (!GetInventoryValue(0x65)) {
|
||||
return 0;
|
||||
}
|
||||
break;
|
||||
case 0x5e:
|
||||
if (!GetInventoryValue(0x9)) {
|
||||
return 0;
|
||||
}
|
||||
break;
|
||||
case 0x5c:
|
||||
case 0xfc ... 0xfe:
|
||||
if (GetInventoryValue(0x67) == 0) {
|
||||
return 0;
|
||||
}
|
||||
if (3 < gRoomVars.filler[5]) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (itemID != 0x5c) {
|
||||
adjustedParam = gUnk_080FE1DD[(Random() & 0x3f) + (itemID - 0xfc) * 0x40];
|
||||
if (adjustedParam == 0) {
|
||||
itemID = 0;
|
||||
}
|
||||
else {
|
||||
itemID = 0x5c;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 0xff:
|
||||
if (!GetInventoryValue(0x1)) {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
if (itemID != 0) {
|
||||
if (itemID == 0xff) {
|
||||
itemEntity = CreateEnemy(7, 0);
|
||||
if (itemEntity != NULL) {
|
||||
itemEntity->x.HALF.HI = arg0->x.HALF.HI;
|
||||
itemEntity->y.HALF.HI = arg0->y.HALF.HI;
|
||||
itemEntity->collisionLayer = arg0->collisionLayer;
|
||||
UpdateSpriteOrderAndFlip(itemEntity);
|
||||
}
|
||||
} else {
|
||||
itemEntity = CreateObject(0, itemID, adjustedParam);
|
||||
if (itemEntity != NULL) {
|
||||
if (arg0 == &gPlayerEntity) {
|
||||
itemEntity->actionDelay = 1;
|
||||
} else {
|
||||
itemEntity->actionDelay = 0;
|
||||
}
|
||||
if ((arg0->entityType).type == 6) {
|
||||
if (arg0->entityType.subtype == 99) {
|
||||
arg0->attachedEntity = itemEntity;
|
||||
} else if (arg0->entityType.subtype == 0x1e) {
|
||||
itemEntity->direction = arg0->animationState << 3 | 0x80;
|
||||
itemEntity->nonPlanarMovement = 0xc0;
|
||||
itemEntity->field_0x20 = 0x18000;
|
||||
}
|
||||
}
|
||||
CopyPosition(arg0, itemEntity);
|
||||
}
|
||||
}
|
||||
}
|
||||
return itemID;
|
||||
}
|
||||
*/
|
||||
|
||||
void sub_08054870(void)
|
||||
{
|
||||
gUnk_080FE2A0[gMenu.menuType]();
|
||||
}
|
||||
@@ -0,0 +1,139 @@
|
||||
#include "global.h"
|
||||
#include "entity.h"
|
||||
#include "player.h"
|
||||
#include "functions.h"
|
||||
|
||||
|
||||
typedef struct {
|
||||
u8 unk[12];
|
||||
} struct_0811BE48;
|
||||
|
||||
typedef struct {
|
||||
u8 field_0x0;
|
||||
u8 field_0x1;
|
||||
} UnkItemStruct;
|
||||
|
||||
Entity* sub_08077C94(ItemBehavior*, u32);
|
||||
void* sub_08077C54(UnkItemStruct* unk);
|
||||
Entity* CreatePlayerBomb(ItemBehavior*, u32);
|
||||
extern Entity* sub_0805E744();
|
||||
|
||||
extern struct_0811BE48 gUnk_0811BE48[];
|
||||
|
||||
void sub_08077B98(UnkItemStruct* unk)
|
||||
{
|
||||
if ((gPlayerState.field_0x2c == NULL) || (gPlayerState.field_0x2c[9] != 1)) {
|
||||
gPlayerState.field_0x2c = sub_08077C54(unk);
|
||||
}
|
||||
}
|
||||
|
||||
void sub_08077BB8(UnkItemStruct* unk)
|
||||
{
|
||||
u8* temp = sub_08077C54(unk);
|
||||
if (temp != NULL) {
|
||||
temp[0x10] = 0x20;
|
||||
}
|
||||
gPlayerState.field_0x2c = temp;
|
||||
}
|
||||
|
||||
Entity* sub_08077BD4(ItemBehavior *beh)
|
||||
{
|
||||
if (sub_08077C94(beh, gUnk_0811BE48[beh->behaviorID].unk[3]) != 0) {
|
||||
return NULL;
|
||||
}
|
||||
else {
|
||||
return CreatePlayerBomb(beh, gUnk_0811BE48[beh->behaviorID].unk[3]);
|
||||
}
|
||||
}
|
||||
|
||||
Entity * sub_08077C0C(ItemBehavior *beh, u32 arg1)
|
||||
{
|
||||
u8 bVar1;
|
||||
Entity *pEVar3;
|
||||
|
||||
bVar1 = gUnk_0811BE48[arg1].unk[3];
|
||||
|
||||
if (sub_08077C94(beh, bVar1) != 0) {
|
||||
return NULL;
|
||||
}
|
||||
else {
|
||||
return CreatePlayerBomb(beh, bVar1);
|
||||
}
|
||||
}
|
||||
|
||||
Entity * CreatePlayerBomb(ItemBehavior *beh, u32 subtype)
|
||||
{
|
||||
Entity *pEVar1;
|
||||
|
||||
pEVar1 = CreatePlayerItem(subtype, 0, 0, beh->behaviorID);
|
||||
if (pEVar1 != NULL) {
|
||||
*(ItemBehavior **)&pEVar1->parent = beh;
|
||||
}
|
||||
return pEVar1;
|
||||
}
|
||||
|
||||
void* sub_08077C54(UnkItemStruct* unk)
|
||||
{
|
||||
Entity *item;
|
||||
|
||||
item = sub_0805E744();
|
||||
if (item != NULL) {
|
||||
item->entityType.subtype = gUnk_0811BE48[unk->field_0x1].unk[3];
|
||||
item->entityType.type = 8;
|
||||
item->flags = 0xa0;
|
||||
item->parent = (Entity*)unk;
|
||||
item->field_0x68.HALF.LO = unk->field_0x1;
|
||||
AppendEntityToList(item, 2);
|
||||
}
|
||||
return item;
|
||||
}
|
||||
|
||||
Entity* sub_08077C94(ItemBehavior* arg0, u32 arg1)
|
||||
{
|
||||
Entity* iVar1;
|
||||
|
||||
iVar1 = FindEntityInListBySubtype(8, gUnk_0811BE48[arg1].unk[3], 2);
|
||||
if (iVar1 == NULL) {
|
||||
return NULL;
|
||||
}
|
||||
return iVar1;
|
||||
}
|
||||
|
||||
Entity * CreatePlayerItem(u32 subtype, u32 form, u32 parameter, u32 unk)
|
||||
{
|
||||
Entity *ent;
|
||||
|
||||
ent = GetEmptyEntity();
|
||||
if (ent != NULL) {
|
||||
ent->flags = 0x80;
|
||||
(ent->entityType).type = 8;
|
||||
(ent->entityType).subtype = subtype;
|
||||
(ent->entityType).form = form;
|
||||
(ent->entityType).parameter = parameter;
|
||||
ent->field_0x68.HALF.LO = unk;
|
||||
AppendEntityToList(ent, 2);
|
||||
}
|
||||
return ent;
|
||||
}
|
||||
|
||||
Entity * sub_08077CF8(u32 subtype, u32 form, u32 parameter, u32 unk)
|
||||
{
|
||||
Entity *ent;
|
||||
|
||||
ent = sub_0805E744();
|
||||
if (ent != NULL) {
|
||||
ent->flags = 0x80;
|
||||
(ent->entityType).type = 8;
|
||||
(ent->entityType).subtype = subtype;
|
||||
(ent->entityType).form = form;
|
||||
(ent->entityType).parameter = parameter;
|
||||
ent->field_0x68.HALF.LO = unk;
|
||||
AppendEntityToList(ent, 2);
|
||||
}
|
||||
return ent;
|
||||
}
|
||||
|
||||
NAKED
|
||||
void sub_08077D38(ItemBehavior *beh, u32 arg1) {
|
||||
asm(".include \"asm/non_matching/sub_08077D38.inc\"");
|
||||
}
|
||||
@@ -0,0 +1,133 @@
|
||||
#include "global.h"
|
||||
#include "entity.h"
|
||||
#include "player.h"
|
||||
#include "functions.h"
|
||||
|
||||
typedef struct {
|
||||
u8 b0: 4;
|
||||
u8 b1: 4;
|
||||
} PACKED Unk_bitfield;
|
||||
|
||||
typedef struct {
|
||||
u8 unk[16];
|
||||
} Unk_struct;
|
||||
|
||||
void sub_08077DF4(Entity *ent, u32 arg1)
|
||||
{
|
||||
*(u16 *)&ent->flags = arg1;
|
||||
if ((arg1 & 0xff) > 0xb8) {
|
||||
arg1 += (ent->entityType).form >> 1;
|
||||
}
|
||||
gPlayerEntity.spriteIndex = (short)(arg1 >> 8);
|
||||
InitAnimationForceUpdate(&gPlayerEntity, (u8)arg1);
|
||||
sub_08077E54(ent);
|
||||
}
|
||||
|
||||
void UpdateItemAnim(Entity *ent)
|
||||
{
|
||||
UpdateAnimationSingleFrame(&gPlayerEntity);
|
||||
sub_08077E54(ent);
|
||||
}
|
||||
|
||||
void sub_08077E3C(Entity *ent)
|
||||
{
|
||||
sub_080042BA(&gPlayerEntity);
|
||||
sub_08077E54(ent);
|
||||
}
|
||||
|
||||
void sub_08077E54(Entity *ent)
|
||||
{
|
||||
ent->action = gPlayerEntity.animIndex;
|
||||
*(u8 *)&ent->spriteIndex = gPlayerEntity.frameIndex;
|
||||
ent->previousActionFlag = gPlayerEntity.frameDuration;
|
||||
ent->actionDelay = gPlayerEntity.frames.all;
|
||||
}
|
||||
|
||||
void sub_08077E78(void* arg0, u32 bits)
|
||||
{
|
||||
u8 *pbVar1;
|
||||
u32 not;
|
||||
|
||||
if (bits == 0) {
|
||||
if (gPlayerState.field_0x2c != NULL) {
|
||||
((Unk_bitfield *)gPlayerState.field_0x2c)[0x11].b0 = 6;
|
||||
gPlayerState.field_0x2c = (u8 *)bits;
|
||||
}
|
||||
else {
|
||||
gPlayerState.field_0x2c = (u8 *)bits;
|
||||
}
|
||||
}
|
||||
|
||||
not = (8 >> bits);
|
||||
gPlayerState.field_0x3[1] &= ~((u8)((8 >> bits) << 4) | not);
|
||||
not = ~not;
|
||||
gPlayerState.field_0xa &= not;
|
||||
gPlayerState.keepFacing &= not;
|
||||
_DmaZero(arg0, 0x1c);
|
||||
}
|
||||
|
||||
u32 sub_08077EC8(Unk_struct* arg0)
|
||||
{
|
||||
|
||||
if ((gPlayerState.field_0x1a[1] & 8) != 0) {
|
||||
sub_08077DF4((Entity *)arg0,0x170);
|
||||
arg0->unk[7] = 0x28;
|
||||
arg0->unk[4] = 7;
|
||||
arg0->unk[15] = 6;
|
||||
return 1;
|
||||
}
|
||||
else {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
void sub_08077EFC(ItemBehavior* arg0)
|
||||
{
|
||||
sub_08077F24(arg0, (u16)gPlayerState.field_0x90.HALF.LO);
|
||||
}
|
||||
|
||||
void sub_08077F10(ItemBehavior* arg0)
|
||||
{
|
||||
sub_08077F24(arg0, (u16)gPlayerState.field_0x90.HALF.HI);
|
||||
}
|
||||
|
||||
NAKED
|
||||
void sub_08077F24(ItemBehavior* beh, u32 arg1) {
|
||||
asm(".include \"asm/non_matching/sub_08077F24.inc\"");
|
||||
}
|
||||
|
||||
void sub_08077F50(ItemBehavior *beh, u32 arg1)
|
||||
{
|
||||
sub_08079184();
|
||||
sub_08077E78(beh, arg1);
|
||||
}
|
||||
|
||||
u32 sub_08077F64(ItemBehavior* arg0, u32 unk)
|
||||
{
|
||||
u32 temp;
|
||||
if (gPlayerState.heldObject == 0) {
|
||||
sub_08077F50(arg0, unk);
|
||||
temp = 0;
|
||||
}
|
||||
else {
|
||||
temp = 1;
|
||||
}
|
||||
return temp;
|
||||
}
|
||||
|
||||
void sub_08077F84(void)
|
||||
{
|
||||
Entity *obj;
|
||||
|
||||
if (((gPlayerEntity.collisionLayer & 2) == 0) &&
|
||||
GetTileTypeByPos(gPlayerEntity.x.HALF.HI, gPlayerEntity.y.HALF.HI - 0xc, 2) - 0x343U < 4) {
|
||||
sub_0807AA80(&gPlayerEntity);
|
||||
gPlayerState.jumpStatus |= 8;
|
||||
obj = CreateObject(0x44, 0, 0);
|
||||
if (obj != NULL) {
|
||||
obj->x = gPlayerEntity.x;
|
||||
obj->y.HALF.HI = gPlayerEntity.y.HALF.HI - 0xc;
|
||||
gPlayerEntity.y.HALF.HI -= 0xc;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,88 @@
|
||||
#include "global.h"
|
||||
#include "entity.h"
|
||||
#include "functions.h"
|
||||
|
||||
typedef struct {
|
||||
u8 unk[4];
|
||||
u32 unk2;
|
||||
u32 unk4;
|
||||
} Unk_struct;
|
||||
|
||||
extern Unk_struct gUnk_03003DF0[];
|
||||
|
||||
void sub_08078778(Entity* ent) {
|
||||
sub_0807887C(ent, 1, 0);
|
||||
}
|
||||
|
||||
void sub_08078784(Entity* ent, u32 arg1) {
|
||||
sub_0807887C(ent, 1, arg1);
|
||||
}
|
||||
|
||||
void sub_08078790(Entity* ent, u32 arg1) {
|
||||
sub_0807887C(ent, 2, arg1);
|
||||
}
|
||||
|
||||
void sub_0807879C(Entity* ent) {
|
||||
sub_0807887C(ent, 7, 0);
|
||||
}
|
||||
|
||||
void sub_080787A8(Entity* ent, u32 arg1) {
|
||||
sub_0807887C(ent, 7, arg1);
|
||||
}
|
||||
|
||||
void sub_080787B4(Entity* ent) {
|
||||
sub_0807887C(ent, 9, 0);
|
||||
}
|
||||
|
||||
void sub_080787C0(Entity* ent) {
|
||||
sub_0807887C(ent, 10, 0);
|
||||
}
|
||||
|
||||
void sub_080787CC(Entity* ent) {
|
||||
sub_0807887C(ent, 5, 0);
|
||||
}
|
||||
|
||||
s32 sub_080787D8(Entity *ent)
|
||||
{
|
||||
s32 iVar1;
|
||||
|
||||
iVar1 = sub_0807887C(ent, 8, 0);
|
||||
if (iVar1 >= 0) {
|
||||
gUnk_03003DF0[iVar1].unk[10] = 0xbe;
|
||||
}
|
||||
return iVar1;
|
||||
}
|
||||
|
||||
s32 sub_08078800(Entity *ent)
|
||||
{
|
||||
s32 iVar1;
|
||||
|
||||
iVar1 = sub_0807887C(ent, 6, 0);
|
||||
if (iVar1 >= 0) {
|
||||
gUnk_03003DF0[iVar1].unk[10] = 0xbe;
|
||||
}
|
||||
return iVar1;
|
||||
}
|
||||
|
||||
s32 sub_08078828(Entity *ent)
|
||||
{
|
||||
s32 iVar1;
|
||||
|
||||
iVar1 = sub_0807887C(ent, 3, 0);
|
||||
if (iVar1 >= 0) {
|
||||
gUnk_03003DF0[iVar1].unk[10] = 0xbe;
|
||||
}
|
||||
return iVar1;
|
||||
}
|
||||
|
||||
void sub_08078850(u32 arg0, u32 arg1, u32 arg2, u32 arg3)
|
||||
{
|
||||
s32 iVar1;
|
||||
|
||||
iVar1 = sub_08078904();
|
||||
if (iVar1 >= 0) {
|
||||
gUnk_03003DF0[iVar1].unk[8] = arg1;
|
||||
gUnk_03003DF0[iVar1].unk[10] = arg2;
|
||||
*(&gUnk_03003DF0[iVar1].unk4 + 1) = arg3;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,146 @@
|
||||
#include "global.h"
|
||||
#include "entity.h"
|
||||
#include "functions.h"
|
||||
#include "menu.h"
|
||||
#include "structures.h"
|
||||
|
||||
extern void (*const gUnk_0811E478[])(u32);
|
||||
|
||||
extern s16 gUnk_02021EE0[6];
|
||||
extern char gUnk_0811E484[];
|
||||
extern char gUnk_0811E4AC[];
|
||||
extern char gUnk_0811E4A4[];
|
||||
|
||||
void sub_0807CD9C() {
|
||||
sub_080530C8();
|
||||
}
|
||||
|
||||
void sub_0807CDA4(u32 arg0) {
|
||||
gUnk_0811E478[gMenu.storyPanelIndex](arg0);
|
||||
}
|
||||
|
||||
u32 sub_0807CDC0(void) {
|
||||
gUnk_02021EE0[5] -= 8;
|
||||
if (gUnk_02021EE0[4] <= 0) {
|
||||
gMenu.field_0xa = 8;
|
||||
gMenu.storyPanelIndex = 1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
u32 sub_0807CDE8(u32 arg0) {
|
||||
u32 temp;
|
||||
|
||||
if (gMenu.field_0xa == 0) {
|
||||
sub_0805616C();
|
||||
switch (arg0) {
|
||||
case 0:
|
||||
temp = sub_0807CF08(gUnk_02000000->saveFileId, gUnk_02002A40.filler0);
|
||||
break;
|
||||
case 1:
|
||||
sub_0807CF48(gUnk_02000000->saveFileId);
|
||||
temp = 1;
|
||||
break;
|
||||
case 2:
|
||||
temp = sub_0807CF10((u8*)gUnk_02000000->header);
|
||||
break;
|
||||
}
|
||||
gMenu.field_0xa = temp;
|
||||
gMenu.storyPanelIndex = 2;
|
||||
sub_08056208();
|
||||
} else {
|
||||
gMenu.field_0xa--;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
s32 sub_0807CE54(void) {
|
||||
u32 uVar1;
|
||||
|
||||
uVar1 = 0;
|
||||
gUnk_02021EE0[5] += 8;
|
||||
if (gUnk_02021EE0[3] <= gUnk_02021EE0[5]) {
|
||||
gUnk_02021EE0[5] = gUnk_02021EE0[3];
|
||||
sub_08050384();
|
||||
gMenu.storyPanelIndex = 0;
|
||||
if (gMenu.field_0xa == 1) {
|
||||
uVar1 = 1;
|
||||
} else {
|
||||
uVar1 = -1;
|
||||
}
|
||||
}
|
||||
return uVar1;
|
||||
}
|
||||
|
||||
u32 sub_0807CE90(void)
|
||||
{
|
||||
struct_0807D1C4 *puVar1;
|
||||
int iVar2;
|
||||
int iVar3;
|
||||
|
||||
sub_080B1520(0x40);
|
||||
puVar1 = sub_0807D1C4(4);
|
||||
iVar3 = 0;
|
||||
if (sub_0807D24C(puVar1->field_0x6, gUnk_0811E484, puVar1->field_0x0) == 0) {
|
||||
iVar3 += 1;
|
||||
}
|
||||
if (sub_0807D24C(puVar1->field_0x8, gUnk_0811E484, puVar1->field_0x0) == 0) {
|
||||
iVar3 += 2;
|
||||
}
|
||||
if (iVar3 != 0) {
|
||||
if (iVar3 == 3) {
|
||||
sub_0807CF68(5);
|
||||
sub_0807CF68(3);
|
||||
sub_0807CF68(2);
|
||||
sub_0807CF68(1);
|
||||
sub_0807CF68(0);
|
||||
}
|
||||
sub_0807D20C(puVar1->field_0x8, gUnk_0811E484, puVar1->field_0x0);
|
||||
sub_0807D20C(puVar1->field_0x6, gUnk_0811E484, puVar1->field_0x0);
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
u32 sub_0807CF08(u32 arg0, u8* arg1) {
|
||||
return sub_0807CF88(arg0, arg1);
|
||||
}
|
||||
|
||||
u32 sub_0807CF10(u8* arg0) {
|
||||
return sub_0807CF88(3, arg0);
|
||||
}
|
||||
|
||||
u32 sub_0807CF1C(u8* arg0) {
|
||||
return sub_0807CF88(5, arg0);
|
||||
}
|
||||
|
||||
int sub_0807CF28(u32 arg0, SaveFile* arg1) {
|
||||
return sub_0807D008(arg0, arg1);
|
||||
}
|
||||
|
||||
u32 sub_0807CF30(void* arg0) {
|
||||
return sub_0807D008(3, arg0);
|
||||
}
|
||||
|
||||
u32 sub_0807CF3C(void* arg0) {
|
||||
return sub_0807D008(5, arg0);
|
||||
}
|
||||
|
||||
void sub_0807CF48(u32 arg0)
|
||||
{
|
||||
struct_0807D1C4 *temp;
|
||||
|
||||
temp = sub_0807D1C4(arg0);
|
||||
sub_0807D184(temp->field_0x4, gUnk_0811E4AC);
|
||||
sub_0807D184(temp->field_0x2, gUnk_0811E4AC);
|
||||
}
|
||||
|
||||
void sub_0807CF68(u32 arg0)
|
||||
{
|
||||
struct_0807D1C4 *temp;
|
||||
char* str;
|
||||
|
||||
temp = sub_0807D1C4(arg0);
|
||||
str = gUnk_0811E4A4;
|
||||
sub_0807D184(temp->field_0x4, str);
|
||||
sub_0807D184(temp->field_0x2, str);
|
||||
}
|
||||
@@ -0,0 +1,72 @@
|
||||
#include "global.h"
|
||||
#include "entity.h"
|
||||
#include "structures.h"
|
||||
#include "functions.h"
|
||||
#include "room.h"
|
||||
|
||||
extern void sub_0805E5A8();
|
||||
|
||||
extern RoomControls gRoomControls;
|
||||
extern u32 gUnk_0200B650;
|
||||
extern u32 gUnk_02025EB0;
|
||||
|
||||
extern void DoExitTransition(ScreenTransitionData*);
|
||||
extern void sub_080809D4();
|
||||
|
||||
void sub_080808D8(void) {
|
||||
gScreenTransition.transitionType = 0;
|
||||
}
|
||||
|
||||
void sub_080808E4(void) {
|
||||
|
||||
if (sub_08052638(gScreenTransition.areaID)) {
|
||||
gScreenTransition.transitionType = 0;
|
||||
} else {
|
||||
gScreenTransition.transitionType = 5;
|
||||
}
|
||||
}
|
||||
|
||||
void sub_08080904(void) {
|
||||
gScreenTransition.transitionType = 1;
|
||||
}
|
||||
|
||||
void sub_08080910(void) {
|
||||
gScreenTransition.transitionType = 1;
|
||||
}
|
||||
|
||||
void sub_0808091C(ScreenTransitionData* param_1, u32 param_2)
|
||||
{
|
||||
DoExitTransition(param_1);
|
||||
gScreenTransition.transitionType = param_2;
|
||||
return;
|
||||
}
|
||||
|
||||
void sub_08080930(void)
|
||||
|
||||
{
|
||||
gRoomControls.unk3 = 5;
|
||||
gRoomControls.unk4 = 0;
|
||||
gRoomControls.unk2 = 2;
|
||||
gRoomControls.filler[0] = 0;
|
||||
sub_0805E5A8();
|
||||
return;
|
||||
}
|
||||
|
||||
u32* GetLayerByIndex(u32 param_1)
|
||||
|
||||
{
|
||||
|
||||
if (param_1 == 2) {
|
||||
return &gUnk_0200B650;
|
||||
} else {
|
||||
return &gUnk_02025EB0;
|
||||
}
|
||||
}
|
||||
|
||||
void sub_08080964(u16 time, u32 magnitude)
|
||||
|
||||
{
|
||||
gRoomControls.screenShakeTime = time;
|
||||
gRoomControls.screenShakeMagnitude = magnitude & 7;
|
||||
return;
|
||||
}
|
||||
@@ -0,0 +1,69 @@
|
||||
#include "global.h"
|
||||
#include "entity.h"
|
||||
#include "room.h"
|
||||
|
||||
void sub_080A29BC(Entity *parent)
|
||||
{
|
||||
CreateFx(parent, 2, 0);
|
||||
}
|
||||
|
||||
void sub_080A29C8(s32 xOff, s32 yOff, u32 layer)
|
||||
{
|
||||
Entity *pEVar1;
|
||||
|
||||
pEVar1 = CreateObject(0xf, 2, 0);
|
||||
if (pEVar1 != NULL) {
|
||||
pEVar1->x.HALF.HI = gRoomControls.roomOriginX + xOff;
|
||||
pEVar1->y.HALF.HI = gRoomControls.roomOriginY + yOff;
|
||||
pEVar1->collisionLayer = layer;
|
||||
}
|
||||
}
|
||||
|
||||
void sub_080A29FC(Entity *parent)
|
||||
{
|
||||
CreateFx(parent, 0x11, 0);
|
||||
}
|
||||
|
||||
void sub_080A2A08(Entity *parent)
|
||||
{
|
||||
CreateFx(parent, 0x6, 0);
|
||||
}
|
||||
|
||||
void sub_080A2A14(Entity *parent)
|
||||
{
|
||||
CreateFx(parent, 0xb, 0);
|
||||
}
|
||||
|
||||
Entity * sub_080A2A20(Entity *parent, u32 form, u32 parameter)
|
||||
{
|
||||
Entity *pEVar1;
|
||||
|
||||
pEVar1 = CreateObjectWithParent(parent, 0, form, parameter);
|
||||
if (pEVar1 != NULL) {
|
||||
pEVar1->actionDelay = 5;
|
||||
}
|
||||
return pEVar1;
|
||||
}
|
||||
|
||||
Entity * sub_080A2A3C(Entity *parent, u32 form, u32 subtype, u32 param_4)
|
||||
{
|
||||
Entity *ent;
|
||||
|
||||
ent = CreateObjectWithParent(parent, 0, form, subtype);
|
||||
if (ent != NULL) {
|
||||
ent->actionDelay = 5;
|
||||
ent->field_0x86 = param_4;
|
||||
}
|
||||
return ent;
|
||||
}
|
||||
|
||||
Entity * sub_080A2A64(Entity *parent)
|
||||
{
|
||||
Entity *pEVar1;
|
||||
|
||||
pEVar1 = CreateFx(parent, 0x20, 0);
|
||||
if (pEVar1 != NULL) {
|
||||
pEVar1->spritePriority.b0 = 7;
|
||||
}
|
||||
return pEVar1;
|
||||
}
|
||||
+2
-2
@@ -2,7 +2,7 @@
|
||||
#include "global.h"
|
||||
|
||||
extern Entity* GetEmptyEntity();
|
||||
extern void sub_0805EA2C(Entity*, u8);
|
||||
extern void AppendEntityToList(Entity*, u8);
|
||||
|
||||
Entity* CreateEnemy(u32 subtype, u32 form) {
|
||||
Entity* enemy;
|
||||
@@ -12,7 +12,7 @@ Entity* CreateEnemy(u32 subtype, u32 form) {
|
||||
(enemy->entityType).type = 3;
|
||||
(enemy->entityType).subtype = subtype;
|
||||
(enemy->entityType).form = form;
|
||||
sub_0805EA2C(enemy, 4);
|
||||
AppendEntityToList(enemy, 4);
|
||||
}
|
||||
return enemy;
|
||||
}
|
||||
|
||||
+7
-7
@@ -2,14 +2,14 @@
|
||||
// #include "entityData.h"
|
||||
// #include "global.h"
|
||||
|
||||
// extern Entity * sub_0805EB9C(u32, u32);
|
||||
// extern Entity * sub_0805E768();
|
||||
// extern void sub_0804AEB0(Entity *, EntityData *);
|
||||
// extern Entity * FindEntityBySubtype(u32, u32);
|
||||
// extern Entity * GetEmptyEntityByType();
|
||||
// extern void RegisterRoomEntity(Entity *, EntityData *);
|
||||
// extern u32 sub_0804AF0C(Entity *, EntityData *);
|
||||
// extern void sub_08016A30(Entity *);
|
||||
// extern u32 gRoomControls;
|
||||
|
||||
// Entity * CreateEntity(EntityData *param_1)
|
||||
// Entity * LoadRoomEntity(EntityData *param_1)
|
||||
// {
|
||||
// Entity *preexisting;
|
||||
// Entity *entity;
|
||||
@@ -17,16 +17,16 @@
|
||||
|
||||
// type = param_1->entityType & 15;
|
||||
// if (((param_1->field_0x1 & 240) == 80) &&
|
||||
// (preexisting = sub_0805EB9C(type,param_1->entitySubtype), preexisting != NULL)) {
|
||||
// (preexisting = FindEntityBySubtype(type,param_1->entitySubtype), preexisting != NULL)) {
|
||||
// entity = NULL;
|
||||
// }
|
||||
// else {
|
||||
// entity = sub_0805E768(); //Get empty entity
|
||||
// entity = GetEmptyEntityByType(); //Get empty entity
|
||||
// if (entity != NULL) {
|
||||
// (entity->entityType).type = type;
|
||||
// (entity->entityType).subtype = param_1->entitySubtype;
|
||||
// (entity->entityType).form = param_1->entityform;
|
||||
// sub_0804AEB0(entity,param_1);
|
||||
// RegisterRoomEntity(entity,param_1);
|
||||
// if ((param_1->field_0x1 & 240) != 16) {
|
||||
// (entity->entityType).parameter = *(u8 *)¶m_1->entityparameter;
|
||||
// entity->actionDelay = (u8)((u32)param_1->entityparameter >> 8);
|
||||
|
||||
+2
-2
@@ -2,7 +2,7 @@
|
||||
#include "entity.h"
|
||||
|
||||
extern Entity* GetEmptyEntity();
|
||||
extern void sub_0805EA2C(Entity*, u8);
|
||||
extern void AppendEntityToList(Entity*, u8);
|
||||
|
||||
Entity* CreateNPC(u32 subtype, u32 form, u32 parameter)
|
||||
|
||||
@@ -15,7 +15,7 @@ Entity* CreateNPC(u32 subtype, u32 form, u32 parameter)
|
||||
(pEVar1->entityType).subtype = subtype;
|
||||
(pEVar1->entityType).form = form;
|
||||
(pEVar1->entityType).parameter = parameter;
|
||||
sub_0805EA2C(pEVar1, 7);
|
||||
AppendEntityToList(pEVar1, 7);
|
||||
}
|
||||
return pEVar1;
|
||||
}
|
||||
|
||||
+2
-2
@@ -2,7 +2,7 @@
|
||||
#include "entity.h"
|
||||
|
||||
extern Entity* GetEmptyEntity();
|
||||
extern void sub_0805EA2C(Entity*, u8);
|
||||
extern void AppendEntityToList(Entity*, u8);
|
||||
|
||||
Entity* CreateObject(u32 subtype, u32 param1, u32 param2)
|
||||
|
||||
@@ -15,7 +15,7 @@ Entity* CreateObject(u32 subtype, u32 param1, u32 param2)
|
||||
(newEnt->entityType).subtype = subtype;
|
||||
(newEnt->entityType).form = param1;
|
||||
(newEnt->entityType).parameter = param2;
|
||||
sub_0805EA2C(newEnt, 6);
|
||||
AppendEntityToList(newEnt, 6);
|
||||
}
|
||||
return newEnt;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,33 @@
|
||||
#include "global.h"
|
||||
#include "entity.h"
|
||||
|
||||
void _DmaFill32(u32, u8*, u32);
|
||||
void _DmaFill16(u32, u8*, u32);
|
||||
|
||||
void _DmaFill16(u32 value, u8* dest, u32 size) {
|
||||
DmaFill16(3, value, dest, size);
|
||||
}
|
||||
|
||||
void _DmaFill32(u32 value, u8* dest, u32 size) {
|
||||
DmaFill32(3, value, dest, size);
|
||||
}
|
||||
|
||||
void _DmaZero(u8 *src, u32 size)
|
||||
{
|
||||
u32 zero = 0;
|
||||
|
||||
switch (((u32)src | size) & 3) {
|
||||
case 0:
|
||||
_DmaFill32(0,src, size);
|
||||
break;
|
||||
case 2:
|
||||
_DmaFill16(0, src, size);
|
||||
break;
|
||||
default:
|
||||
do {
|
||||
*src = zero;
|
||||
src++;
|
||||
size--;
|
||||
} while (size != 0);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,570 @@
|
||||
#include "global.h"
|
||||
#include "entity.h"
|
||||
#include "functions.h"
|
||||
|
||||
extern u32 sub_080002D4(s32, s32, u32);
|
||||
extern s32 sub_080012DC(Entity*);
|
||||
extern void sub_08001324(Entity*);
|
||||
extern u32 sub_080044EC(Entity*, u32);
|
||||
extern u32 sub_08031E04(Entity*);
|
||||
extern void sub_08031E48(Entity*, Entity*);
|
||||
extern void sub_08032290(Entity*);
|
||||
extern u32 sub_080322A4(Entity*);
|
||||
void sub_080322E8(Entity*);
|
||||
extern void sub_08032338(Entity*);
|
||||
extern Entity* sub_08049DF4(u32);
|
||||
extern void sub_0804A9FC(Entity*, 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 u32 Random(void);
|
||||
|
||||
extern Entity* gUnk_020000B0;
|
||||
extern u8 gEntCount;
|
||||
extern void (*const gUnk_080012C8[])(Entity*);
|
||||
extern void (*const gUnk_080CE56C[])(Entity*);
|
||||
extern void (*const gUnk_080CE584[])(Entity*);
|
||||
extern void (*const gUnk_080CE58C[])(Entity*);
|
||||
extern void (*const gUnk_080CE5C8[])(Entity*);
|
||||
extern u8 gUnk_080CE5B0[8];
|
||||
extern u8 gUnk_080CE5B8[8];
|
||||
extern union SplitHWord gUnk_080CE5C0[4];
|
||||
extern u16 gUnk_080CE5F0[5];
|
||||
extern u8 gUnk_080CE5FA[20]; // Directions
|
||||
|
||||
void AcroBandit(Entity* this) {
|
||||
s32 index;
|
||||
|
||||
index = sub_080012DC(this);
|
||||
|
||||
if (index) {
|
||||
if ((this->field_0x3a & 1) == 0)
|
||||
sub_08032338(this);
|
||||
|
||||
gUnk_080012C8[index](this);
|
||||
} else {
|
||||
gUnk_080CE56C[GetNextFunction(this)](this);
|
||||
SetChildOffset(this, 0, 1, -0x10);
|
||||
}
|
||||
}
|
||||
|
||||
void sub_080318C4(Entity* this) {
|
||||
gUnk_080CE584[this->entityType.form](this);
|
||||
}
|
||||
|
||||
void sub_080318DC(Entity* this) {
|
||||
Entity* brother;
|
||||
|
||||
if (this->bitfield != 0x80 && this->bitfield != 0x81) {
|
||||
if (this->entityType.form == 1) {
|
||||
if (this->action < 7 && this->field_0x42) {
|
||||
brother = this->attachedEntity;
|
||||
if (brother) {
|
||||
brother->parent = this->parent;
|
||||
do {
|
||||
brother->action = 5;
|
||||
brother->spritePriority.b1 = 1;
|
||||
if (brother->hurtBlinkTime == 0)
|
||||
brother->hurtBlinkTime = -12;
|
||||
} while (brother = brother->attachedEntity, brother != NULL);
|
||||
}
|
||||
if (this->parent) {
|
||||
this->parent->attachedEntity = this->attachedEntity;
|
||||
} else {
|
||||
if (this->attachedEntity)
|
||||
this->parent = this;
|
||||
}
|
||||
|
||||
this->action = 9;
|
||||
this->spritePriority.b1 = 1;
|
||||
if (this->field_0x3e < 0x10) {
|
||||
this->spriteSettings.b.flipX = 0;
|
||||
} else {
|
||||
this->spriteSettings.b.flipX = 1;
|
||||
}
|
||||
InitializeAnimation(this, 14);
|
||||
}
|
||||
|
||||
if (this->currentHealth == 0) {
|
||||
this->field_0x3e = ((this->field_0x3e + (7 & Random())) - 4) & 0x1f;
|
||||
this->field_0x42 += this->entityType.parameter * 3;
|
||||
sub_08032338(this);
|
||||
}
|
||||
}
|
||||
|
||||
if (this->field_0x42 && this->frames.all & 0x10) {
|
||||
if (this->entityType.form == 0) {
|
||||
this->action = 8;
|
||||
} else {
|
||||
this->action = 9;
|
||||
}
|
||||
if (this->field_0x3e < 0x10) {
|
||||
this->spriteSettings.b.flipX = 0;
|
||||
} else {
|
||||
this->spriteSettings.b.flipX = 1;
|
||||
}
|
||||
this->spritePriority.b1 = 1;
|
||||
InitializeAnimation(this, 14);
|
||||
}
|
||||
}
|
||||
|
||||
if (this->field_0x43)
|
||||
sub_0804A9FC(this, 0x1c);
|
||||
|
||||
sub_0804AA30(this, gUnk_080CE56C);
|
||||
}
|
||||
|
||||
void sub_08031A60(Entity* this) {
|
||||
if (this->hurtBlinkTime > 0)
|
||||
sub_08003FC4(this, 0x1800);
|
||||
|
||||
sub_08001324(this);
|
||||
}
|
||||
|
||||
void nullsub_154(void) {
|
||||
/* ... */
|
||||
}
|
||||
|
||||
void sub_08031A88(Entity* this) {
|
||||
gUnk_080CE58C[this->action](this);
|
||||
}
|
||||
|
||||
void sub_08031AA0(Entity* this) {
|
||||
sub_0804A720(this);
|
||||
this->action = '\x01';
|
||||
this->field_0x74.HWORD = this->x.HALF.HI;
|
||||
this->field_0x76.HWORD = this->y.HALF.HI;
|
||||
this->field_0x78.HALF.HI = Random();
|
||||
}
|
||||
|
||||
void sub_08031AC8(Entity* this)
|
||||
|
||||
{
|
||||
u32 rand;
|
||||
s32 x, y;
|
||||
|
||||
if (this->actionDelay) {
|
||||
this->actionDelay--;
|
||||
} else {
|
||||
if (sub_08049FDC(this, 1)) {
|
||||
rand = Random();
|
||||
x = this->field_0x74.HWORD + ((s32)rand % 5) * 0x10 - 0x20;
|
||||
y = this->field_0x76.HWORD + ((s32)(rand >> 4) % 5) * 0x10 - 0x20;
|
||||
if (sub_080002D4(x, y, this->collisionLayer) == 0) {
|
||||
this->action = 2;
|
||||
this->spriteSettings.b.draw = 1;
|
||||
this->x.HALF.HI = x;
|
||||
this->y.HALF.HI = y;
|
||||
InitializeAnimation(this, 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void sub_08031B48(Entity* this) {
|
||||
GetNextFrame(this);
|
||||
if (this->frames.b.f0) {
|
||||
this->frames.all = 0;
|
||||
this->flags |= 0x80;
|
||||
} else {
|
||||
if (this->frames.b.f3) {
|
||||
this->action = 0x3;
|
||||
this->actionDelay = gUnk_080CE5B0[Random() & 7];
|
||||
InitializeAnimation(this, 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void sub_08031B98(Entity* this) {
|
||||
if (sub_08031E04(this)) {
|
||||
this->action = 5;
|
||||
if (this->x.HALF.HI > gUnk_020000B0->x.HALF.HI) {
|
||||
this->spriteSettings.b.flipX = 0;
|
||||
} else {
|
||||
this->spriteSettings.b.flipX = 1;
|
||||
}
|
||||
InitializeAnimation(this, 3);
|
||||
} else {
|
||||
if (this->frames.b.f0 && this->actionDelay) {
|
||||
// this->frames.b.f0 = 0;
|
||||
this->frames.all &= 0xfe;
|
||||
this->actionDelay--;
|
||||
}
|
||||
GetNextFrame(this);
|
||||
if (this->actionDelay == 0) {
|
||||
this->action = 4;
|
||||
this->flags &= 0x7f;
|
||||
InitializeAnimation(this, 2);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void sub_08031C1C(Entity* this) {
|
||||
GetNextFrame(this);
|
||||
if (this->frames.b.f3) {
|
||||
this->action = '\x01';
|
||||
this->actionDelay = gUnk_080CE5B8[Random() & 7];
|
||||
this->spriteSettings.b.draw = 0;
|
||||
}
|
||||
}
|
||||
|
||||
#if NON_MATCHING
|
||||
void sub_08031C58(Entity* this) {
|
||||
u8 tmp;
|
||||
Entity *a, *b;
|
||||
|
||||
GetNextFrame(this);
|
||||
if (this->frames.b.f3) {
|
||||
if (gEntCount < 0x43) {
|
||||
tmp = Random();
|
||||
tmp &= 3;
|
||||
|
||||
a = CreateEnemy(0x2e, 1);
|
||||
a->entityType.parameter = 0;
|
||||
a->parent = NULL;
|
||||
a->field_0x74.HALF.LO = tmp;
|
||||
sub_08031E48(this, a);
|
||||
|
||||
b = CreateEnemy(0x2e, 1);
|
||||
a->attachedEntity = b;
|
||||
b->entityType.parameter = 1;
|
||||
b->parent = a;
|
||||
b->field_0x74.HALF.LO = tmp;
|
||||
sub_08031E48(this, b);
|
||||
|
||||
a = CreateEnemy(0x2e, 1);
|
||||
b->attachedEntity = a;
|
||||
a->entityType.parameter = 2;
|
||||
a->parent = b;
|
||||
a->field_0x74.HALF.LO = tmp;
|
||||
sub_08031E48(this, a);
|
||||
|
||||
b = CreateEnemy(0x2e, 1);
|
||||
a->attachedEntity = b;
|
||||
b->entityType.parameter = 3;
|
||||
b->parent = a;
|
||||
b->field_0x74.HALF.LO = tmp;
|
||||
sub_08031E48(this, b);
|
||||
|
||||
a = CreateEnemy(0x2e, 1);
|
||||
b->attachedEntity = a;
|
||||
a->entityType.parameter = 4;
|
||||
a->parent = b;
|
||||
a->attachedEntity = NULL;
|
||||
a->field_0x74.HALF.LO = tmp;
|
||||
sub_08031E48(this, a);
|
||||
|
||||
this->action = 6;
|
||||
this->actionDelay = 20;
|
||||
this->spritePriority.b0 = 7;
|
||||
InitializeAnimation(this, 7);
|
||||
}
|
||||
} else {
|
||||
if (this->frames.b.f0) {
|
||||
this->frames.all = 0;
|
||||
this->flags &= 0x7f;
|
||||
}
|
||||
}
|
||||
}
|
||||
#else
|
||||
NAKED
|
||||
void sub_08031C58(Entity* this) {
|
||||
asm(".include \"asm/non_matching/acroBandits/sub_08031C58.inc\"");
|
||||
}
|
||||
#endif
|
||||
|
||||
void sub_08031D70(Entity* this) {
|
||||
GetNextFrame(this);
|
||||
if (--this->actionDelay == '\0') {
|
||||
this->action = 7;
|
||||
this->flags &= 0x7f;
|
||||
this->actionDelay = 5;
|
||||
this->spriteSettings.b.draw = 0;
|
||||
}
|
||||
}
|
||||
|
||||
void sub_08031DA0(Entity* this) {
|
||||
if ((this->actionDelay & 0xf) == 0) {
|
||||
if (this->actionDelay == 0x50) {
|
||||
DeleteEntity(this);
|
||||
} else {
|
||||
this->action = 1;
|
||||
this->actionDelay = 0xb4;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void sub_08031DC4(Entity* this) {
|
||||
if (this->frames.b.f3) {
|
||||
this->action = 1;
|
||||
this->actionDelay = 0xb4;
|
||||
this->spriteSettings.b.draw = 0;
|
||||
} else {
|
||||
GetNextFrame(this);
|
||||
if ((this->frames.all & 0xf) == 2) {
|
||||
this->flags &= 0x7f;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#if NON_MATCHING
|
||||
u32 sub_08031E04(Entity* this) {
|
||||
Entity* ent;
|
||||
union SplitHWord* tmp;
|
||||
int x, y;
|
||||
|
||||
ent = sub_08049DF4(1);
|
||||
if (ent == NULL)
|
||||
return 0;
|
||||
|
||||
tmp = &gUnk_080CE5C0[this->frames.all & 6];
|
||||
x = ent->x.HALF.HI + tmp->HALF.LO;
|
||||
y = ent->y.HALF.HI + tmp->HALF.HI;
|
||||
return sub_0806FCB8(this, x, y, 0x50);
|
||||
}
|
||||
#else
|
||||
NAKED
|
||||
u32 sub_08031E04(Entity* this) {
|
||||
asm(".include \"asm/non_matching/acroBandits/sub_08031E04.inc\"");
|
||||
}
|
||||
#endif
|
||||
|
||||
void sub_08031E48(Entity* this, Entity* child) {
|
||||
CopyPosition(this, child);
|
||||
child->field_0x6c.HALF.LO = this->field_0x6c.HALF.LO;
|
||||
child->field_0x70.HALF.LO = this->field_0x70.HALF.LO;
|
||||
child->field_0x70.HALF.HI = this->field_0x70.HALF.HI;
|
||||
child->filler4[0] = this->filler4[0];
|
||||
child->filler4[1] = this->filler4[1];
|
||||
child->field_0x7c.WORD = (s32)this;
|
||||
}
|
||||
|
||||
void sub_08031E90(Entity* this) {
|
||||
gUnk_080CE5C8[this->action](this);
|
||||
}
|
||||
|
||||
void sub_08031EA8(Entity* this) {
|
||||
this->action = 1;
|
||||
this->spritePriority.b1 = 1;
|
||||
this->field_0x20 = 0x40000;
|
||||
this->height.HALF.HI = (4 - this->entityType.parameter) * 0xe;
|
||||
this->field_0x78.HALF.HI = Random();
|
||||
InitializeAnimation(this, 4);
|
||||
}
|
||||
|
||||
void sub_08031EE8(Entity* this) {
|
||||
int draw;
|
||||
|
||||
this->height.WORD -= this->field_0x20;
|
||||
this->field_0x20 -= 0x1800;
|
||||
|
||||
if (this->height.HALF.HI < 1) {
|
||||
draw = this->spriteSettings.b.draw;
|
||||
if (!draw)
|
||||
sub_08004488(299);
|
||||
|
||||
this->spriteSettings.b.draw = 1;
|
||||
}
|
||||
|
||||
draw = this->spriteSettings.b.draw;
|
||||
if (draw == 1)
|
||||
GetNextFrame(this);
|
||||
|
||||
if (this->field_0x20 < 1) {
|
||||
this->action = 2;
|
||||
this->flags |= 0x80;
|
||||
InitializeAnimation(this, 5);
|
||||
}
|
||||
}
|
||||
|
||||
void sub_08031F54(Entity* this) {
|
||||
sub_08003FC4(this, gUnk_080CE5F0[this->entityType.parameter]);
|
||||
if (this->entityType.parameter * -0xe <= this->height.HALF.HI) {
|
||||
this->action = 3;
|
||||
this->actionDelay = 20;
|
||||
this->height.HALF.HI = this->entityType.parameter * -0xe;
|
||||
if (this->parent != NULL)
|
||||
this->spritePriority.b1 = 0;
|
||||
InitializeAnimation(this, 6);
|
||||
}
|
||||
}
|
||||
|
||||
void sub_08031FB0(Entity* this) {
|
||||
GetNextFrame(this);
|
||||
if (this->frames.b.f3 && (this->parent || --this->actionDelay == 0)) {
|
||||
this->action = 4;
|
||||
this->direction = sub_08049F84(this, 1);
|
||||
*(u8*)&this->field_0x76 = 0;
|
||||
if (this->attachedEntity) {
|
||||
InitializeAnimation(this, 9);
|
||||
} else {
|
||||
InitializeAnimation(this, 8);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void sub_08032008(Entity* this) {
|
||||
Entity* parent;
|
||||
|
||||
if (sub_080322A4(this) == 0) {
|
||||
parent = this->parent;
|
||||
if (parent == 0) {
|
||||
if (sub_08049FDC(this, 1)) {
|
||||
if ((++this->field_0x78.HALF.HI & 7) == 0) {
|
||||
sub_08004596(this, GetFacingDirection(this, gUnk_020000B0));
|
||||
}
|
||||
this->field_0x76.HALF.LO = 0;
|
||||
} else {
|
||||
if (this->field_0x76.HALF.LO) {
|
||||
(this->field_0x76.HALF.LO)--;
|
||||
sub_08004596(this, this->field_0x7a.HALF.LO);
|
||||
} else {
|
||||
this->field_0x76.HALF.LO = 0x10;
|
||||
if (sub_08049FA0(this) == 0 && (Random() & 1)) {
|
||||
this->field_0x7a.HALF.LO = sub_08049EE4(this);
|
||||
} else {
|
||||
this->field_0x7a.HALF.LO = Random() & 30;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (this->direction & 0xf) {
|
||||
this->spriteSettings.b.flipX = !(!(this->direction & 0x10) ^ 1);
|
||||
}
|
||||
|
||||
sub_080AEF88(this);
|
||||
} else {
|
||||
if (this->field_0x76.HALF.HI == 0) {
|
||||
if (sub_0806FCB8(this, parent->x.HALF.HI, parent->y.HALF.HI, 1) == 0) {
|
||||
this->field_0x76.HALF.HI = 1;
|
||||
this->direction = GetFacingDirection(this, parent);
|
||||
sub_080322E8(this);
|
||||
sub_0806F69C(this);
|
||||
}
|
||||
} else {
|
||||
this->direction = GetFacingDirection(this, parent);
|
||||
sub_080322E8(this);
|
||||
sub_0806F69C(this);
|
||||
if (this->x.HALF.HI == parent->x.HALF.HI && this->y.HALF.HI == parent->y.HALF.HI)
|
||||
this->field_0x76.HALF.HI = 0;
|
||||
}
|
||||
}
|
||||
GetNextFrame(this);
|
||||
}
|
||||
}
|
||||
|
||||
void sub_08032148(Entity* this) {
|
||||
if (sub_08003FC4(this, 0x2000))
|
||||
return;
|
||||
|
||||
sub_08032290(this);
|
||||
}
|
||||
|
||||
void sub_08032160(Entity* this) {
|
||||
Entity* tmp;
|
||||
u32 dir;
|
||||
|
||||
if (this->actionDelay == 0) {
|
||||
this->action = 7;
|
||||
dir = gUnk_080CE5FA[this->field_0x74.HALF.LO * 5 + this->entityType.parameter];
|
||||
this->direction = dir;
|
||||
if (dir >= 0x10) {
|
||||
this->spriteSettings.b.flipX = 1;
|
||||
} else {
|
||||
this->spriteSettings.b.flipX = 0;
|
||||
}
|
||||
this->nonPlanarMovement = 0xf0;
|
||||
this->field_0x20 = 0x12000;
|
||||
this->spritePriority.b1 = 1;
|
||||
InitializeAnimation(this, 12);
|
||||
}
|
||||
|
||||
if (this->attachedEntity == NULL) {
|
||||
for (tmp = this->parent; tmp != NULL; tmp = tmp->parent) {
|
||||
if (tmp->currentHealth != 0)
|
||||
tmp->actionDelay = 0;
|
||||
}
|
||||
this->actionDelay = 0;
|
||||
}
|
||||
}
|
||||
|
||||
void sub_080321E8(Entity* this) {
|
||||
sub_080AEFE0(this);
|
||||
|
||||
if (sub_080044EC(this, 0x2000) == 0)
|
||||
this->action = 8;
|
||||
}
|
||||
|
||||
void sub_08032204(Entity* this) {
|
||||
GetNextFrame(this);
|
||||
if (this->frames.all & 1) {
|
||||
this->frames.all = 0;
|
||||
this->frameDuration = (Random() & 0x30) + 30;
|
||||
} else {
|
||||
if (this->frames.all & 0x80) {
|
||||
this->action = 9;
|
||||
InitializeAnimation(this, 13);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void sub_08032248(Entity* this) {
|
||||
if (sub_08003FC4(this, 0x1800) == 0) {
|
||||
if (this->frames.all & 0x80) {
|
||||
((Entity*)this->field_0x7c.WORD)->actionDelay--;
|
||||
|
||||
DeleteEntity(this);
|
||||
} else {
|
||||
GetNextFrame(this);
|
||||
|
||||
if ((this->frames.all & 0xf) == 2)
|
||||
this->flags &= 0x7f;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void sub_08032290(Entity* this) {
|
||||
this->action = 6;
|
||||
this->actionDelay = 12;
|
||||
InitializeAnimation(this, 11);
|
||||
}
|
||||
|
||||
u32 sub_080322A4(Entity* this) {
|
||||
if (this->attachedEntity != NULL && (this->attachedEntity->height.HALF.HI + 8) >= this->height.HALF.HI) {
|
||||
if (this->height.HALF.HI) {
|
||||
this->action = 5;
|
||||
this->height.HALF.HI = this->attachedEntity->height.HALF.HI + 8;
|
||||
InitializeAnimation(this, 11);
|
||||
return 1;
|
||||
} else {
|
||||
sub_08032290(this);
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
void sub_080322E8(Entity* this) {
|
||||
u8 tmp;
|
||||
if (this->field_0x78.HALF.LO) {
|
||||
if (--this->field_0x78.HALF.LO == 0) {
|
||||
u32 flipX = this->spriteSettings.b.flipX;
|
||||
this->spriteSettings.b.flipX = flipX ^ 1;
|
||||
}
|
||||
} else {
|
||||
tmp = this->direction;
|
||||
if (tmp & 0xF) {
|
||||
tmp >>= 4;
|
||||
tmp ^= 1;
|
||||
if (tmp != this->spriteSettings.b.flipX) {
|
||||
this->field_0x78.HALF.LO = 6;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void sub_08032338(Entity *this) {
|
||||
if ((((Entity*)this->field_0x7c.WORD)->actionDelay += 15) != 80)
|
||||
this->field_0x6c.HALF.LO = 0;
|
||||
}
|
||||
@@ -22,7 +22,7 @@ void BladeTrap(Entity* ent) {
|
||||
|
||||
|
||||
|
||||
puVar3 = &(ent->field_0x74);
|
||||
puVar3 = &(ent->field_0x74.HWORD);
|
||||
uVar1 = *puVar3;
|
||||
*puVar3 = uVar1 - 1;
|
||||
if ((*puVar3) == 0) {
|
||||
@@ -1,14 +1,13 @@
|
||||
#include "global.h"
|
||||
#include "entity.h"
|
||||
#include "functions.h"
|
||||
#include "link.h"
|
||||
#include "player.h"
|
||||
|
||||
extern s32 sub_080012DC(Entity*);
|
||||
extern u32 GetNextFunction(Entity*);
|
||||
extern void sub_0802AD54(Entity*);
|
||||
extern void sub_0802B048(Entity*);
|
||||
extern void sub_0806F4E8(Entity*);
|
||||
extern void sub_0806F3E4(Entity*);
|
||||
|
||||
extern void (*const gUnk_080012C8[])(Entity*);
|
||||
extern void (*const gUnk_080CD0F0[])(Entity*);
|
||||
@@ -44,7 +43,7 @@ void sub_0802A84C(Entity* this) {
|
||||
}
|
||||
|
||||
void sub_0802A8AC(Entity *this) {
|
||||
*((u8 *)&this->field_0x80 + 1) = 0;
|
||||
this->field_0x80.HALF.HI = 0;
|
||||
if (this->entityType.form < 2) {
|
||||
InitializeAnimation(this, 0);
|
||||
}
|
||||
@@ -58,7 +57,7 @@ void sub_0802A8C8(Entity* this)
|
||||
void sub_0802A8E0(Entity *this)
|
||||
{
|
||||
this->previousActionFlag = 1;
|
||||
this->filler[1] = 0x3c;
|
||||
this->field_0x1d = 0x3c;
|
||||
}
|
||||
|
||||
void sub_0802A8EC(Entity *this)
|
||||
@@ -73,8 +72,8 @@ void sub_0802A8F4(Entity *this)
|
||||
|
||||
void sub_0802A8FC(Entity *this)
|
||||
{
|
||||
if ((gLinkState.field_0x1c & 0xf) == 0) {
|
||||
this->currentHealth = gLinkState.field_0x1c & 0xf;
|
||||
if ((gPlayerState.field_0x1c & 0xf) == 0) {
|
||||
this->currentHealth = gPlayerState.field_0x1c & 0xf;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -30,10 +30,10 @@ void nullsub_7(Entity* this){}
|
||||
void sub_08021720(Entity *this)
|
||||
{
|
||||
this->action = 1;
|
||||
this->spriteSettings.b.ss0 = 1;
|
||||
this->spriteSettings.b.draw = 1;
|
||||
this->frameIndex = (this->entityType).form;
|
||||
this->spriteOrder.b3 = 1;
|
||||
this->ticks.b0 = 3;
|
||||
this->spriteRendering.b3 = 1;
|
||||
this->spritePriority.b0 = 3;
|
||||
}
|
||||
|
||||
void nullsub_08(Entity* this){}
|
||||
@@ -0,0 +1,246 @@
|
||||
#include "global.h"
|
||||
#include "entity.h"
|
||||
#include "functions.h"
|
||||
|
||||
extern Entity* gUnk_020000B0;
|
||||
|
||||
extern void (*const gUnk_080CE7B0[])(Entity*);
|
||||
extern void (*const gUnk_080CE7C8[])(Entity*);
|
||||
extern u8 gUnk_080CE7E0[];
|
||||
extern u16 gUnk_080CE7F0[];
|
||||
extern s8 gUnk_080CE810[];
|
||||
|
||||
u32 sub_080325E8(Entity* this);
|
||||
void sub_08032650(Entity* this);
|
||||
void sub_0803269C(Entity* this, u32 direction);
|
||||
void sub_080326FC(Entity* this);
|
||||
u32 sub_0803271C(Entity* this);
|
||||
void sub_08032740(Entity* this);
|
||||
void sub_0803275C(Entity* this);
|
||||
void sub_08032784(Entity* this);
|
||||
void sub_08032794(Entity* this);
|
||||
void sub_080327C8(Entity* this);
|
||||
void sub_080327E0(Entity* this);
|
||||
|
||||
void Keaton(Entity* this) {
|
||||
EnemyFunctionHandler(this, gUnk_080CE7B0);
|
||||
SetChildOffset(this, 0, 1, -18);
|
||||
}
|
||||
|
||||
void sub_080323DC(Entity* this) {
|
||||
gUnk_080CE7C8[this->action](this);
|
||||
}
|
||||
|
||||
void sub_080323F4(Entity* this) {
|
||||
u32 var;
|
||||
|
||||
if ((u8)(this->action - 3) >= 2) {
|
||||
this->action = 3;
|
||||
this->actionDelay = 0xC;
|
||||
var = ((this->field_0x3e + 4) & 0x18) ^ 0x10;
|
||||
this->direction = var;
|
||||
InitAnimationForceUpdate(this, var >> 3);
|
||||
} else if (this->bitfield == 0xCC) {
|
||||
if (this->field_0x43 == 0) {
|
||||
sub_0803275C(this);
|
||||
}
|
||||
}
|
||||
if (this->field_0x43 != 0) {
|
||||
sub_0804A9FC(this, 0x1C);
|
||||
}
|
||||
sub_0804AA30(this, gUnk_080CE7B0);
|
||||
}
|
||||
|
||||
void nullsub_155(Entity* this) {
|
||||
}
|
||||
|
||||
void sub_08032468(Entity* this) {
|
||||
sub_0804A720(this);
|
||||
this->animationState = 0;
|
||||
InitAnimationForceUpdate(this, 0);
|
||||
sub_080326FC(this);
|
||||
sub_08032740(this);
|
||||
}
|
||||
|
||||
void sub_0803248C(Entity* this) {
|
||||
if (sub_080325E8(this) == 0) {
|
||||
if (sub_0803271C(this) == 0) {
|
||||
this->actionDelay--;
|
||||
if (this->actionDelay == 0) {
|
||||
sub_08032650(this);
|
||||
}
|
||||
if (sub_080AEF88(this) == 0) {
|
||||
this->actionDelay = 1;
|
||||
}
|
||||
UpdateAnimationSingleFrame(this);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void sub_080324CC(Entity* this) {
|
||||
if (sub_080325E8(this) == 0) {
|
||||
UpdateAnimationSingleFrame(this);
|
||||
if (this->frames.all & 0x80) {
|
||||
sub_080326FC(this);
|
||||
sub_08032740(this);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void sub_080324FC(Entity* this) {
|
||||
if (this->actionDelay != 0) {
|
||||
this->actionDelay--;
|
||||
if (this->actionDelay == 0) {
|
||||
this->field_0xf = 0x1E;
|
||||
this->animationState = this->direction / 8;
|
||||
InitAnimationForceUpdate(this, this->animationState + 4);
|
||||
} else {
|
||||
return;
|
||||
}
|
||||
}
|
||||
UpdateAnimationSingleFrame(this);
|
||||
UpdateAnimationSingleFrame(this);
|
||||
this->field_0xf--;
|
||||
if (this->field_0xf == 0) {
|
||||
this->action = 4;
|
||||
this->nonPlanarMovement = 0x1E0;
|
||||
this->field_0x76.HWORD = 0x46;
|
||||
this->field_0x78.HWORD = 0;
|
||||
*(((u8*)&this->field_0x7a) + 1) = 0;
|
||||
sub_080327C8(this);
|
||||
} else {
|
||||
if ((this->field_0xf & 0x3) == 0) {
|
||||
sub_08032794(this);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void sub_08032574(Entity* this) {
|
||||
if (this->attachedEntity && (this->attachedEntity->bitfield & 0x80)) {
|
||||
sub_0803275C(this);
|
||||
return;
|
||||
}
|
||||
|
||||
if (--this->field_0x76.HWORD == 0 || !sub_080AEFE0(this)) {
|
||||
sub_0803275C(this);
|
||||
return;
|
||||
}
|
||||
|
||||
UpdateAnimationSingleFrame(this);
|
||||
if ((this->field_0x76.HWORD & 0x7) == 0) {
|
||||
sub_08032794(this);
|
||||
}
|
||||
}
|
||||
|
||||
void sub_080325C4(Entity* this) {
|
||||
this->actionDelay--;
|
||||
if ((this->actionDelay == 0) && (sub_080325E8(this) == 0)) {
|
||||
sub_08032784(this);
|
||||
}
|
||||
}
|
||||
|
||||
u32 sub_080325E8(Entity* this) {
|
||||
if (((sub_08049FA0(this) != 0) && (sub_08049FDC(this, 1) != 0)) &&
|
||||
(sub_080041A0(this, gUnk_020000B0, 0x68, 0x40) != 0)) {
|
||||
if (((GetFacingDirection(this, gUnk_020000B0) - ((this->frames.all & 0x18)) + 2) & 0x1F) < 5) {
|
||||
this->action = 3;
|
||||
this->actionDelay = 0xC;
|
||||
this->direction = this->frames.all & 0x18;
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
void sub_08032650(Entity* this) {
|
||||
u32 uVar3;
|
||||
|
||||
uVar3 = Random();
|
||||
this->actionDelay = gUnk_080CE7E0[uVar3 & 0xf];
|
||||
if (!((sub_08049FA0(this) == 0) && ((uVar3 >> 8 & 1) == 0))) {
|
||||
this->direction = (uVar3 >> 0x10) & 0x18;
|
||||
} else {
|
||||
this->direction = (sub_08049EE4(this) + 4) & 0x18;
|
||||
}
|
||||
sub_0803269C(this, this->direction);
|
||||
}
|
||||
|
||||
void sub_0803269C(Entity* this, u32 param_2) {
|
||||
u32 uVar1;
|
||||
|
||||
if (((param_2 - 3) & 7) < 3) {
|
||||
uVar1 = ((param_2 + 4) & 0x18) >> 3;
|
||||
if (((this->animationState - uVar1) & 3) > 1) {
|
||||
this->animationState = uVar1;
|
||||
InitAnimationForceUpdate(this, (this->animIndex & 0xFC) + uVar1);
|
||||
}
|
||||
} else {
|
||||
uVar1 = ((param_2 + 4) & 0x18) >> 3;
|
||||
if (uVar1 != this->animationState) {
|
||||
this->animationState = uVar1;
|
||||
InitAnimationForceUpdate(this, (this->animIndex & 0xFC) + uVar1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void sub_080326FC(Entity* this) {
|
||||
this->field_0x74.HWORD = gUnk_080CE7F0[Random() & 0xF];
|
||||
}
|
||||
|
||||
u32 sub_0803271C(Entity* this) {
|
||||
this->field_0x74.HWORD--;
|
||||
if (this->field_0x74.HWORD == 0) {
|
||||
sub_08032784(this);
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
void sub_08032740(Entity* this) {
|
||||
this->action = 1;
|
||||
this->nonPlanarMovement = 0x80;
|
||||
InitializeAnimation(this, this->animationState);
|
||||
sub_08032650(this);
|
||||
}
|
||||
|
||||
void sub_0803275C(Entity* this) {
|
||||
this->action = 5;
|
||||
this->actionDelay = 0x2D;
|
||||
this->nonPlanarMovement = 0x80;
|
||||
InitAnimationForceUpdate(this, this->animationState);
|
||||
sub_0803269C(this, this->direction);
|
||||
sub_080327E0(this);
|
||||
}
|
||||
|
||||
void sub_08032784(Entity* this) {
|
||||
this->action = 2;
|
||||
InitAnimationForceUpdate(this, this->animationState + 8);
|
||||
}
|
||||
|
||||
void sub_08032794(Entity* this) {
|
||||
Entity* target;
|
||||
s8* temp;
|
||||
|
||||
target = CreateFx(this, 0x11, 0x40);
|
||||
if (target != NULL) {
|
||||
temp = &gUnk_080CE810[this->animationState * 2];
|
||||
PositionRelative(this, target, temp[0] << 0x10, temp[1] << 0x10);
|
||||
}
|
||||
}
|
||||
|
||||
void sub_080327C8(Entity* this) {
|
||||
Entity* child;
|
||||
|
||||
child = sub_0804A98C(this, 11, 0);
|
||||
if (child != NULL) {
|
||||
child->parent = this;
|
||||
this->attachedEntity = child;
|
||||
}
|
||||
}
|
||||
|
||||
void sub_080327E0(Entity* this) {
|
||||
if (this->attachedEntity != NULL) {
|
||||
this->attachedEntity->parent = NULL;
|
||||
this->attachedEntity = NULL;
|
||||
}
|
||||
}
|
||||
@@ -1,7 +1,7 @@
|
||||
#include "global.h"
|
||||
#include "entity.h"
|
||||
#include "enemy.h"
|
||||
#include "link.h"
|
||||
#include "player.h"
|
||||
|
||||
extern void sub_0804AA30(Entity*, void *);
|
||||
extern u32 sub_0806F520(Entity*);
|
||||
@@ -14,6 +14,8 @@ extern void sub_08021EF0(Entity*);
|
||||
extern void sub_080AEFB4(Entity*);
|
||||
extern void sub_08021F24(Entity*);
|
||||
extern u32 sub_0806FCB8(Entity*, s32, s32, u32);
|
||||
extern u32 sub_08049FA0(Entity*);
|
||||
extern u32 sub_08049EE4(Entity*);
|
||||
|
||||
extern void (*gUnk_080CB69C[])(Entity*);
|
||||
extern void (*gUnk_080CB6B4[])(Entity*);
|
||||
@@ -21,9 +23,7 @@ extern void (*gUnk_080CB6C4[])(Entity*);
|
||||
|
||||
extern u8 gUnk_080CB6D0[];
|
||||
extern u16 gUnk_080CB6D6[];
|
||||
|
||||
|
||||
extern u8 gUnk_080CB6D0[];
|
||||
extern u8 gUnk_080CB6F6[];
|
||||
|
||||
void Keese(Entity *this)
|
||||
{
|
||||
@@ -69,14 +69,14 @@ void sub_08021DF0(Entity *this)
|
||||
|
||||
sub_0804A720(this);
|
||||
if ((this->entityType).form != 0) {
|
||||
this->ticks.b1 = 1;
|
||||
this->spritePriority.b1 = 1;
|
||||
this->height.HALF.HI = -0x10;
|
||||
}
|
||||
this->direction = Random() & 0x1f;
|
||||
this->filler[0] = 1;
|
||||
this->ticks.b0 = 3;
|
||||
this->field_0x1c = 1;
|
||||
this->spritePriority.b0 = 3;
|
||||
this->collisionLayer = 3;
|
||||
UpdateSpriteOrderAndFlip(this);
|
||||
UpdateSpriteForCollisionLayer(this);
|
||||
sub_08021EF0(this);
|
||||
}
|
||||
|
||||
@@ -85,8 +85,8 @@ void sub_08021E4C(Entity *this)
|
||||
if (this->field_0x78.HWORD != 0) {
|
||||
this->field_0x78.HWORD--;
|
||||
}
|
||||
if (this->field_0x7a != 0) {
|
||||
(this->field_0x7a)--;
|
||||
if (this->field_0x7a.HWORD != 0) {
|
||||
(this->field_0x7a.HWORD)--;
|
||||
}
|
||||
GetNextFrame(this);
|
||||
if ((this->frames.b.f3) != 0) {
|
||||
@@ -113,7 +113,7 @@ void sub_08021EBC(Entity *this)
|
||||
this->actionDelay--;
|
||||
}
|
||||
else {
|
||||
iVar1 = sub_0806FCB8(this, gLinkEntity.x.HALF.HI, gLinkEntity.y.HALF.HI, 0x70);
|
||||
iVar1 = sub_0806FCB8(this, gPlayerEntity.x.HALF.HI, gPlayerEntity.y.HALF.HI, 0x70);
|
||||
if (iVar1 != 0) {
|
||||
sub_08021EF0(this);
|
||||
}
|
||||
@@ -126,6 +126,31 @@ void sub_08021EF0(Entity *this)
|
||||
|
||||
this->action = 1;
|
||||
this->field_0x78.HWORD = gUnk_080CB6D6[Random() & 0xf];
|
||||
this->field_0x7a = 0x3c;
|
||||
this->field_0x7a.HWORD = 0x3c;
|
||||
InitializeAnimation(this, 0);
|
||||
}
|
||||
|
||||
void sub_08021F24(Entity *this)
|
||||
{
|
||||
u32 bVar1;
|
||||
|
||||
if (this->field_0x78.HWORD == 0) {
|
||||
this->action = 2;
|
||||
this->actionDelay = gUnk_080CB6F6[Random() & 0xf];
|
||||
InitializeAnimation(this, 1);
|
||||
}
|
||||
else if (!this->field_0x7a.HWORD && !(sub_0806FCB8(this, gPlayerEntity.x.HALF.HI, gPlayerEntity.y.HALF.HI, 0x70))) {
|
||||
this->action = 3;
|
||||
this->actionDelay = 0x1e;
|
||||
InitializeAnimation(this, 1);
|
||||
}
|
||||
else {
|
||||
if (sub_08049FA0(this) != 0) {
|
||||
this->direction = Random() & 0x1f;
|
||||
}
|
||||
else {
|
||||
this->direction = sub_08049EE4(this);
|
||||
}
|
||||
InitializeAnimation(this, 0);
|
||||
}
|
||||
}
|
||||
@@ -1,8 +1,9 @@
|
||||
#include "global.h"
|
||||
#include "entity.h"
|
||||
#include "functions.h"
|
||||
#include "trig.h"
|
||||
#include "random.h"
|
||||
#include "link.h"
|
||||
#include "player.h"
|
||||
|
||||
#include "lakitu.h"
|
||||
|
||||
@@ -100,16 +101,16 @@ void Lakitu_Initialize(Entity *this) {
|
||||
|
||||
this->spriteOffsetY = 0xff;
|
||||
|
||||
this->field_0x74 = this->x.HALF.HI;
|
||||
this->field_0x76 = this->y.HALF.HI;
|
||||
this->field_0x74.HWORD = this->x.HALF.HI;
|
||||
this->field_0x76.HWORD = this->y.HALF.HI;
|
||||
}
|
||||
|
||||
void Lakitu_Hide(Entity *this) {
|
||||
sub_0803CA84(this, 0);
|
||||
|
||||
if (sub_0803CA4C(this)) {
|
||||
this->action = END_HIDE;
|
||||
this->spriteSettings.b.ss0 = 1;
|
||||
this->action = 2;
|
||||
this->spriteSettings.b.draw = 1;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -146,8 +147,8 @@ void Lakitu_BeginHide(Entity *this) {
|
||||
UpdateAnimationSingleFrame(this);
|
||||
|
||||
if (this->frames.b.f3 != 0) {
|
||||
this->action = HIDDEN;
|
||||
this->spriteSettings.b.ss0 = 0;
|
||||
this->action = 1;
|
||||
this->spriteSettings.b.draw = 0;
|
||||
|
||||
InitAnimationForceUpdate(this, this->animationState);
|
||||
}
|
||||
@@ -201,7 +202,7 @@ void Lakitu_Cloudless(Entity *this) {
|
||||
if (sub_08003FC4(this, 0x1800) == 0 && this->animIndex <= 19) {
|
||||
InitAnimationForceUpdate(this, this->animationState + 20);
|
||||
|
||||
this->ticks.b1 = 0;
|
||||
this->spritePriority.b1 = 0;
|
||||
}
|
||||
|
||||
UpdateAnimationSingleFrame(this);
|
||||
@@ -209,8 +210,8 @@ void Lakitu_Cloudless(Entity *this) {
|
||||
}
|
||||
|
||||
bool32 sub_0803CA4C(Entity *this) {
|
||||
if (sub_0806FCB8(this, gLinkEntity.x.HALF.HI, gLinkEntity.y.HALF.HI, 0x28) == 0) {
|
||||
if (sub_080041A0(this, &gLinkEntity, 0x70, 0x50)) {
|
||||
if (sub_0806FCB8(this, gPlayerEntity.x.HALF.HI, gPlayerEntity.y.HALF.HI, 0x28) == 0) {
|
||||
if (sub_080041A0(this, &gPlayerEntity, 0x70, 0x50)) {
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
@@ -219,7 +220,7 @@ bool32 sub_0803CA4C(Entity *this) {
|
||||
}
|
||||
|
||||
void sub_0803CA84(Entity *this, u32 unkParameter) {
|
||||
u32 altAnimState = sub_080045C4(this, &gLinkEntity);
|
||||
u32 altAnimState = GetFacingDirection(this, &gPlayerEntity);
|
||||
|
||||
if (((altAnimState - 3) & 7) > 2 || ((this->animationState - (altAnimState >> 3)) & 3) > 1) {
|
||||
u32 intermediate = (altAnimState + 4) & 0x18;
|
||||
@@ -235,8 +236,8 @@ void sub_0803CA84(Entity *this, u32 unkParameter) {
|
||||
}
|
||||
|
||||
void sub_0803CAD0(Entity *this) {
|
||||
if (sub_0806FCB8(this, this->field_0x74, this->field_0x76, 1) == 0) {
|
||||
this->direction = sub_080045D4(this->x.HALF.HI, this->y.HALF.HI, this->field_0x74, this->field_0x76);
|
||||
if (sub_0806FCB8(this, this->field_0x74.HWORD, this->field_0x76.HWORD, 1) == 0) {
|
||||
this->direction = sub_080045D4(this->x.HALF.HI, this->y.HALF.HI, this->field_0x74.HWORD, this->field_0x76.HWORD);
|
||||
|
||||
sub_080AEFE0(this);
|
||||
}
|
||||
@@ -265,7 +266,7 @@ void sub_0803CB34(Entity *this) {
|
||||
this->action = LIGHTNING_THROW;
|
||||
this->damageType = 0xa6;
|
||||
|
||||
this->field_0x78.HALF.LO = sub_080045C4(this, &gLinkEntity);
|
||||
this->field_0x78.HALF.LO = GetFacingDirection(this, &gPlayerEntity);
|
||||
|
||||
InitAnimationForceUpdate(this, this->animationState + 8);
|
||||
}
|
||||
@@ -299,9 +300,9 @@ void sub_0803CBAC(Entity *this) {
|
||||
}
|
||||
|
||||
this->action = CLOUDLESS;
|
||||
this->spriteSettings.b.ss0 = 1;
|
||||
this->spriteSettings.b.draw = 1;
|
||||
|
||||
this->ticks.b1 = 1;
|
||||
this->spritePriority.b1 = 1;
|
||||
|
||||
this->flags2 &= 0x7b;
|
||||
|
||||
@@ -390,4 +391,4 @@ const OffsetCoords gUnk_080D0154[] = {
|
||||
{ 0x12, 0x00 },
|
||||
{ 0x00, 0x08 },
|
||||
{ 0xEE, 0x00 },
|
||||
};
|
||||
};
|
||||
@@ -1,6 +1,6 @@
|
||||
#include "global.h"
|
||||
#include "entity.h"
|
||||
#include "link.h"
|
||||
#include "player.h"
|
||||
|
||||
extern u32 GetNextFunction(Entity *);
|
||||
|
||||
@@ -63,7 +63,7 @@ void sub_0803CD40(Entity *this) {
|
||||
|
||||
ModHealth(-2);
|
||||
|
||||
sub_0800449C(&gLinkEntity, 122);
|
||||
sub_0800449C(&gPlayerEntity, 122);
|
||||
sub_08079D84();
|
||||
|
||||
sub_0803CE3C(this);
|
||||
@@ -81,7 +81,7 @@ void sub_0803CD6C(Entity *this) {
|
||||
this->parent = lakitu;
|
||||
|
||||
this->field_0x78.HWORD = this->x.HALF.HI;
|
||||
this->field_0x7a = this->y.HALF.HI;
|
||||
this->field_0x7a.HWORD = this->y.HALF.HI;
|
||||
|
||||
InitAnimationForceUpdate(this, 4);
|
||||
|
||||
@@ -95,18 +95,18 @@ void sub_0803CDA8(Entity *this) {
|
||||
sub_0806F69C(this);
|
||||
}
|
||||
|
||||
if (--this->field_0x74 << 0x10 == 0) {
|
||||
if (--this->field_0x74.HWORD << 0x10 == 0) {
|
||||
sub_0803CE14(this);
|
||||
}
|
||||
}
|
||||
|
||||
void sub_0803CDD8(Entity *this) {
|
||||
u8 one;
|
||||
u8 ss0;
|
||||
u8 draw;
|
||||
|
||||
ss0 = this->spriteSettings.b.ss0;
|
||||
draw = this->spriteSettings.b.draw;
|
||||
one = 1;
|
||||
this->spriteSettings.b.ss0 = ss0 ^ one;
|
||||
this->spriteSettings.b.draw = draw ^ one;
|
||||
|
||||
this->actionDelay--;
|
||||
|
||||
@@ -115,14 +115,14 @@ void sub_0803CDD8(Entity *this) {
|
||||
|
||||
this->flags |= 0x80;
|
||||
|
||||
this->spriteSettings.b.ss0 = one;
|
||||
this->spriteSettings.b.draw = one;
|
||||
}
|
||||
}
|
||||
|
||||
void sub_0803CE14(Entity *this) {
|
||||
u8 direction;
|
||||
|
||||
sub_080A2CC0(this, &this->attachedEntity, &this->field_0x74);
|
||||
sub_080A2CC0(this, &this->attachedEntity, &this->field_0x74.HWORD);
|
||||
|
||||
direction = this->direction;
|
||||
if (direction & 0x80) {
|
||||
@@ -145,7 +145,7 @@ void sub_0803CE3C(Entity *this) {
|
||||
this->field_0x3a &= 0xfb;
|
||||
|
||||
this->x.HALF.HI = this->field_0x78.HWORD;
|
||||
this->y.HALF.HI = this->field_0x7a;
|
||||
this->y.HALF.HI = this->field_0x7a.HWORD;
|
||||
|
||||
this->attachedEntity = this->parent;
|
||||
|
||||
@@ -0,0 +1,179 @@
|
||||
#include "global.h"
|
||||
#include "entity.h"
|
||||
#include "enemy.h"
|
||||
#include "functions.h"
|
||||
|
||||
extern void SetChildOffset(Entity*, s32, s32, s32);
|
||||
extern void sub_0804A9FC(Entity*, u32);
|
||||
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*);
|
||||
bool32 sub_0801FE68(Entity*, s32);
|
||||
extern void sub_0801FED4(Entity*);
|
||||
extern u32 sub_080002D4(s32, s32, u32);
|
||||
extern u32 sub_080002BC(s32, s32, u32);
|
||||
extern u32 sub_08049FDC(Entity*, u32);
|
||||
bool32 sub_0801FDE4(Entity*, s32, s32);
|
||||
|
||||
extern void (*const gUnk_080CA49C[])(Entity*);
|
||||
extern void (*const gUnk_080CA4B4[])(Entity*);
|
||||
extern Entity* gUnk_020000B0;
|
||||
extern u8 gUnk_080CA4C8[];
|
||||
extern u16 gUnk_080CA4CA[];
|
||||
extern s16 gSineTable[];
|
||||
void Leever(Entity* this) {
|
||||
EnemyFunctionHandler(this, gUnk_080CA49C);
|
||||
SetChildOffset(this, 0, 1, -0x10);
|
||||
}
|
||||
|
||||
void sub_0801FC28(Entity* this) {
|
||||
gUnk_080CA4B4[this->action](this);
|
||||
}
|
||||
|
||||
void sub_0801FC40(Entity* this) {
|
||||
if (this->bitfield == 0x80) {
|
||||
if (this->action == 3) {
|
||||
this->field_0x74.HWORD = 1;
|
||||
}
|
||||
} else {
|
||||
if (this->field_0x43 != 0) {
|
||||
sub_0804A9FC(this, 0x1c);
|
||||
}
|
||||
}
|
||||
sub_0804AA30(this, gUnk_080CA49C);
|
||||
}
|
||||
|
||||
void sub_0801FC7C(Entity* this) {
|
||||
if ((this->entityType).form == 0) {
|
||||
sub_0804A7D4(this);
|
||||
} else {
|
||||
CreateDeathFx(this, 0xf1, 0);
|
||||
}
|
||||
}
|
||||
|
||||
void sub_0801FC9C(Entity* this) {
|
||||
sub_0804A720(this);
|
||||
this->action = 1;
|
||||
this->actionDelay = Random();
|
||||
}
|
||||
|
||||
void sub_0801FCB0(Entity* this) {
|
||||
if (--this->actionDelay == 0) {
|
||||
if (sub_0801FE68(this, Random() & 0x1f) != 0) {
|
||||
this->action = 2;
|
||||
this->spriteSettings.b.draw = TRUE;
|
||||
this->direction = (GetFacingDirection(this, gUnk_020000B0) + gUnk_080CA4C8[Random() & 1]) & 0x1f;
|
||||
InitializeAnimation(this, 0);
|
||||
UpdateSpriteForCollisionLayer(this);
|
||||
} else {
|
||||
this->actionDelay = (Random() & 0x18) + 8;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void sub_0801FD2C(Entity* this) {
|
||||
|
||||
GetNextFrame(this);
|
||||
|
||||
if (this->frames.b.f3 != 0) {
|
||||
this->action = 3;
|
||||
if (this->entityType.form == 0) {
|
||||
this->field_0x74.HWORD = 0xb4;
|
||||
} else {
|
||||
this->field_0x74.HWORD = 0x6e;
|
||||
}
|
||||
InitializeAnimation(this, 2);
|
||||
} else if (this->frames.b.f0 != 0) {
|
||||
this->frames.all &= 0xfe;
|
||||
this->flags |= 0x80;
|
||||
}
|
||||
}
|
||||
|
||||
void sub_0801FD80(Entity* this) {
|
||||
|
||||
sub_0801FED4(this);
|
||||
GetNextFrame(this);
|
||||
|
||||
if (--this->field_0x74.HWORD == 0) {
|
||||
this->action = 4;
|
||||
this->flags &= 0x7f;
|
||||
InitializeAnimation(this, 1);
|
||||
}
|
||||
}
|
||||
|
||||
void sub_0801FDB4(Entity* this) {
|
||||
sub_0801FED4(this);
|
||||
GetNextFrame(this);
|
||||
if ((this->frames.b.f3) != 0) {
|
||||
this->action = 1;
|
||||
this->actionDelay = 0xf0;
|
||||
this->spriteSettings.b.draw = FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
u32 sub_0801FDE4(Entity* ent, s32 x, s32 y) {
|
||||
u32 uVar3;
|
||||
u16* puVar4;
|
||||
|
||||
if (sub_080002D4(x, y, gUnk_020000B0->collisionLayer) != 0) {
|
||||
return 0;
|
||||
} else {
|
||||
uVar3 = sub_080002BC(x, y, gUnk_020000B0->collisionLayer);
|
||||
for (puVar4 = gUnk_080CA4CA; *puVar4 != (u16)-1;) {
|
||||
if (*puVar4++ == uVar3) {
|
||||
ent->x.HALF.HI = (x & 0xfff0) + 8;
|
||||
ent->y.HALF.HI = (y & 0xfff0) + 8;
|
||||
ent->collisionLayer = gUnk_020000B0->collisionLayer;
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
bool32 sub_0801FE68(Entity* ent, s32 arg2) {
|
||||
s32 sin, cos;
|
||||
s32 x, y;
|
||||
u32 i;
|
||||
|
||||
if (sub_08049FDC(ent, 1) == 0) {
|
||||
return 0;
|
||||
} else {
|
||||
x = gUnk_020000B0->x.WORD;
|
||||
y = gUnk_020000B0->y.WORD;
|
||||
sin = gSineTable[arg2 * 8] << 11;
|
||||
cos = gSineTable[arg2 * 8 + 0x40] << 11;
|
||||
for (i = 0; i < 8; i++) {
|
||||
x += sin;
|
||||
y += -cos;
|
||||
if (sub_0801FDE4(ent, x >> 0x10, y >> 0x10) == 0) {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
extern u32 sub_0800132C(Entity*, Entity*);
|
||||
|
||||
void sub_0801FED4(Entity* this) {
|
||||
s16 sVar2;
|
||||
|
||||
if (sub_08049FDC(this, 1) == 0) {
|
||||
this->field_0x74.HWORD = 1;
|
||||
}
|
||||
sVar2 = (this->frames.all & 0xf) * 0x20;
|
||||
this->nonPlanarMovement = sVar2;
|
||||
if (this->entityType.form == 0) {
|
||||
if ((this->field_0xf++ & 0xf) == 0) {
|
||||
sub_08004596(this, sub_0800132C(this, gUnk_020000B0));
|
||||
}
|
||||
} else {
|
||||
this->nonPlanarMovement = sVar2 + 0x40;
|
||||
if ((this->field_0xf++ & 0x7) == 0) {
|
||||
sub_08004596(this, sub_0800132C(this, gUnk_020000B0));
|
||||
}
|
||||
}
|
||||
sub_080AEF88(this);
|
||||
}
|
||||
@@ -1,13 +1,11 @@
|
||||
#include "global.h"
|
||||
#include "entity.h"
|
||||
#include "functions.h"
|
||||
|
||||
extern void EnemyFunctionHandler(Entity*, void (*const func[])(Entity*));
|
||||
extern void sub_0804AA30(Entity*, void (*const func[][])(Entity*));
|
||||
extern void sub_0804A7D4(Entity*);
|
||||
extern void sub_0804A720(Entity*);
|
||||
extern void sub_08045678(Entity*);
|
||||
extern void sub_080AEFE0(void);
|
||||
extern u32 sub_08003FC4(Entity*, u32);
|
||||
extern void sub_08045678(Entity*);
|
||||
|
||||
extern void (*const gUnk_080D1868[])(Entity*);
|
||||
@@ -25,13 +23,13 @@ void sub_080455BC(Entity *this)
|
||||
|
||||
void sub_080455D4(Entity *this)
|
||||
{
|
||||
sub_0804AA30(this, &gUnk_080D1868);
|
||||
sub_0804AA30(this, gUnk_080D1868);
|
||||
}
|
||||
|
||||
void sub_080455E4(Entity *this)
|
||||
{
|
||||
if ((this != this->parent) && (this->parent != NULL)) {
|
||||
this->field_0x6c = this->field_0x6c & 0x7f;
|
||||
this->field_0x6c.HALF.LO &= 0x7f;
|
||||
this->parent->attachedEntity = this->attachedEntity;
|
||||
this->attachedEntity->parent = this->parent;
|
||||
}
|
||||
@@ -43,7 +41,7 @@ void nullsub_23(Entity* this) {}
|
||||
void sub_08045618(Entity *this)
|
||||
{
|
||||
this->action = 1;
|
||||
this->spriteSettings.b.ss0 = 1;
|
||||
this->spriteSettings.b.draw = 1;
|
||||
this->nonPlanarMovement = 0x80;
|
||||
this->field_0x3c = this->field_0x3c | 0x10;
|
||||
sub_0804A720(this);
|
||||
@@ -53,9 +51,26 @@ void sub_08045618(Entity *this)
|
||||
|
||||
void sub_08045654(Entity *this)
|
||||
{
|
||||
sub_080AEFE0();
|
||||
sub_080AEFE0(this);
|
||||
GetNextFrame(this);
|
||||
if (sub_08003FC4(this, 0x1800) == 0) {
|
||||
sub_08045678(this);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void sub_08045678(Entity *this)
|
||||
{
|
||||
|
||||
this->field_0x20 = 0x1c000;
|
||||
if (this->actionDelay != 0) {
|
||||
this->actionDelay--;
|
||||
} else {
|
||||
this->actionDelay = Random() & 3;
|
||||
if ((sub_08049FA0(this) == 0) && (Random() & 3)) {
|
||||
this->direction = (sub_08049EE4(this) - 4 + (Random() & 8)) & 0x18;
|
||||
}
|
||||
else {
|
||||
this->direction = Random() & 0x18;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -11,7 +11,7 @@ extern void sub_0801ECFC();
|
||||
extern u32 sub_0806F520();
|
||||
extern void sub_0806F4E8();
|
||||
extern void sub_0806F3E4();
|
||||
extern void InitializeAnimationAnimation();
|
||||
extern void UpdateAnimationVariableFrames();
|
||||
extern void sub_0804A720();
|
||||
extern u32 Random();
|
||||
extern void sub_0801ED14();
|
||||
@@ -62,7 +62,7 @@ void sub_0801EB2C(Entity* ent) {
|
||||
|
||||
void sub_0801EB68(Entity* ent) {
|
||||
ent->previousActionFlag = 1;
|
||||
ent->filler[1] = 60;
|
||||
ent->field_0x1d = 60;
|
||||
}
|
||||
|
||||
void sub_0801EB74(Entity* ent) {
|
||||
@@ -75,7 +75,7 @@ void sub_0801EB7C(Entity* ent) {
|
||||
|
||||
void sub_0801EB84(Entity* ent) {
|
||||
ent->flags = ent->flags & 127;
|
||||
InitializeAnimationAnimation(ent, 2);
|
||||
UpdateAnimationVariableFrames(ent, 2);
|
||||
}
|
||||
|
||||
void nullsub_3() {
|
||||
@@ -0,0 +1,282 @@
|
||||
#include "global.h"
|
||||
#include "entity.h"
|
||||
#include "enemy.h"
|
||||
#include "functions.h"
|
||||
#include "npc.h"
|
||||
#include "structures.h"
|
||||
#include "player.h"
|
||||
|
||||
extern void sub_080293DC(Entity*);
|
||||
extern void sub_080296D8(Entity*);
|
||||
extern void sub_08029770(Entity*);
|
||||
extern void sub_080297F0(Entity*);
|
||||
extern void sub_080296C8(Entity*);
|
||||
extern void sub_0802969C(Entity*);
|
||||
|
||||
extern void (*const gUnk_080CCC00[])(Entity*);
|
||||
extern void (*const gUnk_080CCC18[])(Entity*);
|
||||
extern void (*const gUnk_080CCC3C[])(Entity*);
|
||||
|
||||
extern u8 gUnk_080CCC34[];
|
||||
extern u8 gUnk_080CCC47[];
|
||||
extern BoundingBox gUnk_080FD260;
|
||||
|
||||
void RupeeLike(Entity* this) {
|
||||
u32 uVar1;
|
||||
|
||||
if (this->entityType.parameter == 0) {
|
||||
uVar1 = (u8)sub_080043E8(this);
|
||||
if (uVar1 != 0) {
|
||||
if (this->action == 4) {
|
||||
sub_080296D8(this);
|
||||
}
|
||||
sub_08001290(this, uVar1);
|
||||
} else {
|
||||
gUnk_080CCC00[GetNextFunction(this)](this);
|
||||
SetChildOffset(this, 0, 1, -0x10);
|
||||
}
|
||||
} else {
|
||||
sub_080293DC(this);
|
||||
}
|
||||
}
|
||||
|
||||
void sub_08029300(Entity* this) {
|
||||
gUnk_080CCC18[this->action](this);
|
||||
}
|
||||
|
||||
void sub_08029318(Entity* this) {
|
||||
if (this->damageType == 0x8e) {
|
||||
sub_08029770(this);
|
||||
} else {
|
||||
if (this->action == 4) {
|
||||
sub_080296D8(this);
|
||||
}
|
||||
if (*(u8*)(*(u32*)&this->field_0x4c + 8) == 1) {
|
||||
if (this->action == 2) {
|
||||
InitializeAnimation(this, 0);
|
||||
InitializeAnimation(this->attachedEntity, 4);
|
||||
}
|
||||
this->action = 4;
|
||||
this->actionDelay = 0x3c;
|
||||
this->field_0xf = 0;
|
||||
this->field_0x82.HALF.HI = 0x41;
|
||||
this->flags2 &= 0xfc;
|
||||
this->field_0x80.HALF.LO = gPlayerEntity.spritePriority.b1;
|
||||
sub_08004488(0x104);
|
||||
} else {
|
||||
if (this->field_0x43 != 0) {
|
||||
sub_0804A9FC(this, 0x1c);
|
||||
}
|
||||
}
|
||||
}
|
||||
sub_0804AA30(this, gUnk_080CCC00);
|
||||
}
|
||||
|
||||
void sub_080293B4(Entity* this) {
|
||||
CreateDeathFx(this, 0xff, gUnk_080CCC34[this->cutsceneBeh.HALF.LO * 3 + this->entityType.form]);
|
||||
}
|
||||
|
||||
void nullsub_141() {
|
||||
}
|
||||
|
||||
void sub_080293DC(Entity* this) {
|
||||
CopyPositionAndSpriteOffset(this->parent, this);
|
||||
this->y.HALF.HI++;
|
||||
this->height.HALF.HI--;
|
||||
gUnk_080CCC3C[this->action](this);
|
||||
}
|
||||
|
||||
void sub_0802940C(Entity* this) {
|
||||
Entity* ent;
|
||||
|
||||
ent = CreateEnemy(0x17, this->entityType.form);
|
||||
if (ent != NULL) {
|
||||
sub_0804A720(this);
|
||||
ent->parent = this;
|
||||
ent->entityType.parameter = 1;
|
||||
this->attachedEntity = ent;
|
||||
this->field_0x80.HALF.HI = 0;
|
||||
this->cutsceneBeh.HALF.LO = 0;
|
||||
this->field_0x82.HALF.LO = this->palette.b.b0;
|
||||
sub_080297F0(this);
|
||||
}
|
||||
}
|
||||
|
||||
void sub_0802944C(Entity* this) {
|
||||
sub_080296C8(this);
|
||||
if ((this->field_0x80.HALF.HI != 0) && sub_08049FDC(this, 1)) {
|
||||
sub_08029770(this);
|
||||
}
|
||||
}
|
||||
|
||||
void sub_08029474(Entity* this) {
|
||||
u32 bVar1;
|
||||
|
||||
sub_080296C8(this);
|
||||
if (this->frames.b.f3) {
|
||||
this->action = 3;
|
||||
this->actionDelay = 8;
|
||||
bVar1 = GetFacingDirection(this, &gPlayerEntity);
|
||||
this->direction = bVar1;
|
||||
this->animationState = (bVar1 << 0x18) >> 0x1c;
|
||||
InitializeAnimation(this, this->animationState);
|
||||
InitializeAnimation(this->attachedEntity, this->animationState + 4);
|
||||
} else {
|
||||
if (this->frames.all == 1) {
|
||||
this->frames.all = 0;
|
||||
this->flags |= 0x80;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void sub_080294D4(Entity* this) {
|
||||
if (sub_08049FDC(this, 1) != 0) {
|
||||
if (--this->actionDelay == 0) {
|
||||
this->actionDelay = 8;
|
||||
sub_08004596(this, GetFacingDirection(this, &gPlayerEntity));
|
||||
sub_0802969C(this);
|
||||
}
|
||||
sub_080AEF88(this);
|
||||
sub_080296C8(this);
|
||||
} else {
|
||||
this->action = 6;
|
||||
this->flags &= 0x7f;
|
||||
InitializeAnimation(this, 3);
|
||||
InitializeAnimation(this->attachedEntity, 7);
|
||||
}
|
||||
}
|
||||
|
||||
extern s8 gUnk_080CCC44[];
|
||||
|
||||
void sub_0802953C(Entity* this) {
|
||||
u8* pbVar3;
|
||||
|
||||
sub_080296C8(this);
|
||||
sub_080296C8(this);
|
||||
if (sub_0807953C() != 0) {
|
||||
this->field_0xf++;
|
||||
}
|
||||
if (this->actionDelay != 0) {
|
||||
this->actionDelay--;
|
||||
}
|
||||
if (((this->field_0xf > 0x2d) || (gUnk_02002A40.stats.rupees == 0)) && (this->actionDelay == 0)) {
|
||||
sub_080296D8(this);
|
||||
} else {
|
||||
ResetPlayer();
|
||||
gPlayerState.field_0x1a[0] |= 0x80;
|
||||
PositionRelative(this, &gPlayerEntity, 0, 0x10000);
|
||||
pbVar3 = GetSpriteSubEntryOffsetDataPointer((u16)this->spriteIndex, this->frameIndex);
|
||||
gPlayerEntity.spriteOffsetX = pbVar3[0];
|
||||
gPlayerEntity.spriteOffsetY = pbVar3[1] - 1;
|
||||
gPlayerEntity.spritePriority.b1 = 0;
|
||||
if (--this->field_0x82.HALF.HI == 0) {
|
||||
this->field_0x82.HALF.HI = 0x41;
|
||||
if (gUnk_02002A40.stats.rupees != 0) {
|
||||
ModRupees(gUnk_080CCC44[this->entityType.form]);
|
||||
this->cutsceneBeh.HALF.LO = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void sub_08029610(Entity* this) {
|
||||
if (--this->field_0xf == 0) {
|
||||
this->action = 3;
|
||||
this->actionDelay = 1;
|
||||
}
|
||||
sub_080296C8(this);
|
||||
}
|
||||
|
||||
void sub_08029630(Entity* this) {
|
||||
sub_080296C8(this);
|
||||
if ((this->frames.b.f3) != 0) {
|
||||
this->field_0x80.HALF.HI = 1;
|
||||
this->attachedEntity->spriteSettings.b.draw = FALSE;
|
||||
sub_080297F0(this);
|
||||
}
|
||||
}
|
||||
|
||||
void sub_08029660(Entity* this) {
|
||||
u32 temp;
|
||||
this->action = 1;
|
||||
this->spriteIndex = 0xd1;
|
||||
temp = gUnk_080CCC47[this->entityType.form];
|
||||
this->palette.b.b0 = temp;
|
||||
}
|
||||
|
||||
void sub_08029688(Entity* this) {
|
||||
if (this->parent->next == NULL) {
|
||||
DeleteEntity(this);
|
||||
}
|
||||
}
|
||||
|
||||
void sub_0802969C(Entity* this) {
|
||||
u32 bVar1;
|
||||
|
||||
if ((this->direction & 0xf) != 0) {
|
||||
|
||||
bVar1 = this->direction >> 4;
|
||||
if (bVar1 != this->animationState) {
|
||||
this->animationState = bVar1;
|
||||
InitializeAnimation(this, bVar1);
|
||||
InitializeAnimation(this->attachedEntity, bVar1 + 4);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void sub_080296C8(Entity* this) {
|
||||
GetNextFrame(this);
|
||||
GetNextFrame(this->attachedEntity);
|
||||
}
|
||||
|
||||
void sub_080296D8(Entity* this) {
|
||||
gPlayerState.jumpStatus = 0x41;
|
||||
gPlayerState.flags.all &= 0xffffffef;
|
||||
gPlayerEntity.flags |= 0x80;
|
||||
gPlayerEntity.field_0x20 = 0x18000;
|
||||
gPlayerEntity.hurtBlinkTime = 0xa6;
|
||||
gPlayerEntity.height.HALF.HI = -2;
|
||||
gPlayerEntity.direction = gPlayerEntity.animationState << 2;
|
||||
gPlayerEntity.spritePriority.b1 = this->field_0x80.HALF.LO;
|
||||
gPlayerEntity.spriteOffsetY = 0;
|
||||
gPlayerEntity.nonPlanarMovement = 0x140;
|
||||
this->action = 5;
|
||||
this->field_0xf = 0x3c;
|
||||
this->flags2 |= 3;
|
||||
if ((s8)this->hurtBlinkTime == 0) {
|
||||
this->hurtBlinkTime = 0xf4;
|
||||
}
|
||||
}
|
||||
|
||||
void sub_08029770(Entity* this) {
|
||||
u32 temp;
|
||||
if (LoadFixedGFX(this, 0x73) != 0) {
|
||||
this->action = 2;
|
||||
this->flags = this->flags & 0x7f;
|
||||
this->spriteIndex = 0xd1;
|
||||
this->spritePriority.b1 = 3;
|
||||
temp = this->field_0x82.HALF.LO;
|
||||
this->palette.b.b0 = temp;
|
||||
this->damageType = 0x8d;
|
||||
this->boundingBox = &gUnk_080FD260;
|
||||
InitializeAnimation(this, 2);
|
||||
this->attachedEntity->spriteSettings.b.draw = TRUE;
|
||||
InitializeAnimation(this->attachedEntity, 6);
|
||||
sub_080A29BC(this);
|
||||
}
|
||||
}
|
||||
|
||||
void sub_080297F0(Entity* this) {
|
||||
u32 temp;
|
||||
this->action = 1;
|
||||
this->actionDelay = 0x78;
|
||||
this->flags = this->flags | 0x80;
|
||||
this->spriteSettings.b.draw = TRUE;
|
||||
this->damageType = 0x8e;
|
||||
sub_080AE068(this);
|
||||
this->spriteIndex = 0x143;
|
||||
temp = gUnk_080CCC47[this->entityType.form];
|
||||
this->palette.b.b0 = temp;
|
||||
this->spriteVramOffset = 9;
|
||||
InitializeAnimation(this, 0x54);
|
||||
}
|
||||
@@ -53,7 +53,7 @@ void nullsub_171() {
|
||||
|
||||
void sub_08044FC8(Entity* this) {
|
||||
this->action = 1;
|
||||
this->spriteSettings.b.ss0 = 1;
|
||||
this->spriteSettings.b.draw = 1;
|
||||
this->nonPlanarMovement = 128;
|
||||
sub_0804A720(this);
|
||||
InitializeAnimation(this, 0);
|
||||
@@ -46,7 +46,7 @@ void sub_0803169C(Entity *this)
|
||||
void sub_080316DC(Entity *this)
|
||||
{
|
||||
this->previousActionFlag = 1;
|
||||
this->filler[1] = 0x3c;
|
||||
this->field_0x1d = 0x3c;
|
||||
}
|
||||
|
||||
void sub_080316E8(Entity *this)
|
||||
@@ -0,0 +1,195 @@
|
||||
#include "global.h"
|
||||
#include "entity.h"
|
||||
#include "enemy.h"
|
||||
#include "functions.h"
|
||||
|
||||
extern void (*const gUnk_080CDED0[])(Entity*);
|
||||
extern void (*const gUnk_080CDEE8[])(Entity*);
|
||||
|
||||
void Tektite(Entity* this) {
|
||||
EnemyFunctionHandler(this, gUnk_080CDED0);
|
||||
SetChildOffset(this, 0, 1, -0x10);
|
||||
}
|
||||
|
||||
void sub_0802F138(Entity* this) {
|
||||
gUnk_080CDEE8[this->action](this);
|
||||
}
|
||||
|
||||
extern u8 gUnk_080CDEF8[];
|
||||
|
||||
void sub_0802F150(Entity* this) {
|
||||
u32 bVar1;
|
||||
u32 uVar2;
|
||||
|
||||
if (this->field_0x43 != 0) {
|
||||
sub_0804A9FC(this, 0x1c);
|
||||
}
|
||||
sub_0804AA30(this, gUnk_080CDED0);
|
||||
if ((this->bitfield & 0x80) != 0) {
|
||||
switch (this->bitfield & 0x3f) {
|
||||
case 0x14:
|
||||
this->action = 1;
|
||||
this->previousActionFlag = 0;
|
||||
if ((this->entityType).form != 0) {
|
||||
this->actionDelay = 0xc0;
|
||||
} else {
|
||||
this->actionDelay = gUnk_080CDEF8[Random() & 3];
|
||||
}
|
||||
this->field_0xf = 0;
|
||||
*(u8*)&this->field_0x7c = 0;
|
||||
if (this->height.HALF.HI != 0) {
|
||||
this->field_0x20 >>= 2;
|
||||
} else {
|
||||
this->field_0x20 = 0;
|
||||
}
|
||||
InitializeAnimation(this, 0);
|
||||
break;
|
||||
case 0xe:
|
||||
case 0x15:
|
||||
this->currentHealth = 0;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void nullsub_16(Entity* this) {
|
||||
}
|
||||
|
||||
void sub_0802F1F0(Entity* this) {
|
||||
sub_08001242(this);
|
||||
if (this->height.HALF.HI != 0) {
|
||||
sub_08003FC4(this, this->field_0x80.HWORD);
|
||||
}
|
||||
}
|
||||
|
||||
extern u8 gUnk_080CDEF8[];
|
||||
|
||||
void sub_0802F210(Entity* this) {
|
||||
u32 temp;
|
||||
u32 temp2;
|
||||
|
||||
sub_0804A720(this);
|
||||
this->action = 1;
|
||||
this->previousActionFlag = 0;
|
||||
this->actionDelay = gUnk_080CDEF8[Random() & 3];
|
||||
this->actionDelay = (Random() & 0x1f) + this->actionDelay;
|
||||
this->field_0xf = 0;
|
||||
*(u8*)&this->field_0x7c = 0;
|
||||
|
||||
this->field_0x80.HWORD = this->entityType.form == 0 ? 0x1800 : 0x2800;
|
||||
|
||||
this->field_0x82.HWORD = this->entityType.form == 0 ? 0x2800 : 0x3000;
|
||||
|
||||
InitializeAnimation(this, 0);
|
||||
}
|
||||
|
||||
void sub_0802F284(Entity* this) {
|
||||
if (this->actionDelay > 0x60) {
|
||||
UpdateAnimationVariableFrames(this, 2);
|
||||
} else {
|
||||
GetNextFrame(this);
|
||||
}
|
||||
if (this->actionDelay != 0) {
|
||||
this->actionDelay--;
|
||||
} else if (this->field_0xf != 0) {
|
||||
if ((this->frames.b.f3) != 0) {
|
||||
this->action = 2;
|
||||
this->actionDelay = 0x10;
|
||||
this->field_0xf = this->entityType.form;
|
||||
this->field_0x20 = this->field_0x82.HWORD << 4;
|
||||
sub_0802F45C(this);
|
||||
InitializeAnimation(this, 2);
|
||||
}
|
||||
} else if ((this->frames.b.f3) != 0) {
|
||||
this->field_0xf = 0x40;
|
||||
InitializeAnimation(this, 1);
|
||||
}
|
||||
}
|
||||
|
||||
extern u8 gUnk_080CDEF8[];
|
||||
|
||||
void sub_0802F300(Entity* this) {
|
||||
s32 temp;
|
||||
u32 rand;
|
||||
|
||||
GetNextFrame(this);
|
||||
sub_080AEF88(this);
|
||||
temp = this->height.HALF.HI;
|
||||
rand = Random() & 0xf;
|
||||
|
||||
if (sub_080044EC(this, this->field_0x80.HWORD) == 1) {
|
||||
this->action = 3;
|
||||
this->previousActionFlag = 0;
|
||||
if (this->entityType.form != 0) {
|
||||
rand = 0;
|
||||
}
|
||||
|
||||
if (rand == 0) {
|
||||
this->actionDelay = 0xc0;
|
||||
} else {
|
||||
this->actionDelay = gUnk_080CDEF8[rand & 3] + rand;
|
||||
}
|
||||
this->field_0xf = 0;
|
||||
InitializeAnimation(this, 3);
|
||||
return;
|
||||
} else if (this->collisions != 0) {
|
||||
sub_0800417E(this, this->collisions);
|
||||
} else if ((sub_080002B8(this) & 0xf0) == 0x50) {
|
||||
this->direction = (this->direction + 0x10) & 0x1f;
|
||||
}
|
||||
|
||||
if (--this->actionDelay == 0) {
|
||||
this->actionDelay = 0x10;
|
||||
if (this->field_0xf != 0) {
|
||||
this->field_0xf--;
|
||||
sub_0802F45C(this);
|
||||
}
|
||||
}
|
||||
|
||||
if ((this->previousActionFlag == 0) && (temp < this->height.HALF.HI)) {
|
||||
InitializeAnimation(this, 4);
|
||||
this->previousActionFlag = 1;
|
||||
}
|
||||
|
||||
if (temp < -0xc) {
|
||||
this->spriteRendering.b3 = 1;
|
||||
this->spriteOrientation.flipY = 1;
|
||||
} else {
|
||||
this->spriteRendering.b3 = 2;
|
||||
this->spriteOrientation.flipY = 2;
|
||||
}
|
||||
}
|
||||
|
||||
void sub_0802F3F4(Entity* this) {
|
||||
|
||||
GetNextFrame(this);
|
||||
|
||||
if ((this->frames.b.f3) != 0) {
|
||||
if ((*(u8*)&this->field_0x7c.HALF.LO < 2) && ((this->entityType.form % 2) != 0)) {
|
||||
this->action = 2;
|
||||
this->actionDelay = 0x10;
|
||||
this->field_0xf = this->entityType.form;
|
||||
this->field_0x20 = this->field_0x82.HWORD << 4;
|
||||
(*(u8*)&this->field_0x7c.HALF.LO)++;
|
||||
sub_0802F45C(this);
|
||||
InitializeAnimation(this, 2);
|
||||
} else {
|
||||
this->action = 1;
|
||||
*(u8*)&this->field_0x7c.HALF.LO = 0;
|
||||
InitializeAnimation(this, 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void sub_0802F45C(Entity* this) {
|
||||
u32 temp;
|
||||
|
||||
if (sub_08049FA0(this) == 0) {
|
||||
this->direction = sub_08049EE4(this);
|
||||
} else if (sub_08049FDC(this, 1) != 0) {
|
||||
this->direction = sub_08049F84(this, 1);
|
||||
} else {
|
||||
temp = (Random() & 0xf) + 0x18;
|
||||
this->direction = (temp + this->direction) & 0x1f;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,167 @@
|
||||
#include "global.h"
|
||||
#include "entity.h"
|
||||
#include "enemy.h"
|
||||
#include "functions.h"
|
||||
#include "flags.h"
|
||||
|
||||
extern void sub_08038168(Entity*);
|
||||
|
||||
extern void (*const gUnk_080CF4A0)(Entity*);
|
||||
extern void (*const gUnk_080CF4B8[])(Entity*);
|
||||
|
||||
void TektiteGolden(Entity* this) {
|
||||
EnemyFunctionHandler(this, &gUnk_080CF4A0);
|
||||
SetChildOffset(this, 0, 1, -0x10);
|
||||
}
|
||||
|
||||
void sub_08037EE8(Entity* this) {
|
||||
gUnk_080CF4B8[this->action](this);
|
||||
}
|
||||
|
||||
void sub_08037F00(Entity* this) {
|
||||
u32 uVar1;
|
||||
|
||||
if (this->field_0x43 != 0) {
|
||||
sub_0804A9FC(this, 0x1c);
|
||||
}
|
||||
sub_0804AA30(this, &gUnk_080CF4A0);
|
||||
if (this->bitfield == 0x94) {
|
||||
this->action = 1;
|
||||
this->previousActionFlag = 0;
|
||||
this->actionDelay = 0x14;
|
||||
this->field_0xf = 0;
|
||||
this->field_0x80.HALF.LO = 0;
|
||||
if (this->height.HALF.HI != 0) {
|
||||
this->field_0x20 >>= 2;
|
||||
} else {
|
||||
this->field_0x20 = 0;
|
||||
}
|
||||
|
||||
InitializeAnimation(this, 0);
|
||||
}
|
||||
}
|
||||
|
||||
void sub_08037F58(Entity* this) {
|
||||
u32 uVar1;
|
||||
|
||||
if ((this->field_0x3a & 2) == 0) {
|
||||
SetGlobalFlag(this->entityType.parameter);
|
||||
}
|
||||
if ((this->entityType).form != 0) {
|
||||
uVar1 = 0x59;
|
||||
} else {
|
||||
uVar1 = 0x58;
|
||||
}
|
||||
CreateDeathFx(this, 0xff, uVar1);
|
||||
}
|
||||
|
||||
void sub_08037F84(Entity* this) {
|
||||
sub_08001242(this);
|
||||
if (this->height.HALF.HI != 0) {
|
||||
sub_08003FC4(this, 0x3000);
|
||||
}
|
||||
}
|
||||
|
||||
void sub_08037FA0(Entity* this) {
|
||||
|
||||
if (CheckGlobalFlag(this->entityType.parameter)) {
|
||||
DeleteThisEntity();
|
||||
}
|
||||
sub_0804A720(this);
|
||||
this->action = 1;
|
||||
this->previousActionFlag = 0;
|
||||
this->actionDelay = (Random() & 0x1f) + 0x20;
|
||||
this->field_0xf = 0;
|
||||
this->field_0x80.HALF.LO = 0;
|
||||
InitializeAnimation(this, 0);
|
||||
}
|
||||
|
||||
void sub_08037Fe0(Entity* this) {
|
||||
UpdateAnimationVariableFrames(this, 2);
|
||||
if (this->actionDelay != 0) {
|
||||
this->actionDelay--;
|
||||
} else if (this->field_0xf != 0) {
|
||||
if ((this->frames.b.f3) != 0) {
|
||||
this->action = 2;
|
||||
this->actionDelay = 6;
|
||||
this->field_0xf = 0;
|
||||
this->field_0x20 = 0x38000;
|
||||
sub_08038168(this);
|
||||
InitializeAnimation(this, 2);
|
||||
}
|
||||
} else if ((this->frames.b.f3) != 0) {
|
||||
this->field_0xf = 0x40;
|
||||
InitializeAnimation(this, 1);
|
||||
}
|
||||
}
|
||||
|
||||
void sub_08038048(Entity* this) {
|
||||
s32 temp;
|
||||
u32 rand;
|
||||
|
||||
UpdateAnimationVariableFrames(this, 2);
|
||||
sub_080AEF88(this);
|
||||
temp = this->height.HALF.HI;
|
||||
rand = Random() & 0xf;
|
||||
|
||||
if (sub_080044EC(this, 0x3000) == 1) {
|
||||
this->action = 3;
|
||||
this->previousActionFlag = 0;
|
||||
this->actionDelay = 0x14;
|
||||
InitializeAnimation(this, 3);
|
||||
return;
|
||||
} else if (this->collisions != 0) {
|
||||
sub_0800417E(this, this->collisions);
|
||||
} else if ((sub_080002B8(this) & 0xf0) == 0x50) {
|
||||
this->direction = (this->direction + 0x10) & 0x1f;
|
||||
}
|
||||
|
||||
if (--this->actionDelay == 0) {
|
||||
this->actionDelay = rand + 0x10;
|
||||
sub_08038168(this);
|
||||
}
|
||||
|
||||
if ((this->previousActionFlag == 0) && (temp < this->height.HALF.HI)) {
|
||||
InitializeAnimation(this, 4);
|
||||
this->previousActionFlag = 1;
|
||||
}
|
||||
|
||||
if (temp < -0xc) {
|
||||
this->spriteRendering.b3 = 1;
|
||||
this->spriteOrientation.flipY = 1;
|
||||
} else {
|
||||
this->spriteRendering.b3 = 2;
|
||||
this->spriteOrientation.flipY = 2;
|
||||
}
|
||||
}
|
||||
|
||||
void sub_08038110(Entity* this) {
|
||||
UpdateAnimationVariableFrames(this, 2);
|
||||
if ((this->frames.b.f3) != 0) {
|
||||
if (this->field_0x80.HALF.LO < 5) {
|
||||
this->action = 2;
|
||||
this->actionDelay = 8;
|
||||
this->field_0x20 = 0x38000;
|
||||
sub_08038168(this);
|
||||
InitializeAnimation(this, 2);
|
||||
} else {
|
||||
this->action = 1;
|
||||
this->field_0x80.HALF.LO = 0;
|
||||
this->actionDelay = 0xc0;
|
||||
InitializeAnimation(this, 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void sub_08038168(Entity* this) {
|
||||
u32 temp;
|
||||
|
||||
if (sub_08049FA0(this) == 0) {
|
||||
this->direction = sub_08049EE4(this);
|
||||
} else if (sub_08049FDC(this, 1) != 0) {
|
||||
this->direction = sub_08049F84(this, 1);
|
||||
} else {
|
||||
temp = (Random() & 0xf) + 0x18;
|
||||
this->direction = (temp + this->direction) & 0x1f;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,149 @@
|
||||
#include "global.h"
|
||||
#include "entity.h"
|
||||
#include "enemy.h"
|
||||
#include "structures.h"
|
||||
#include "player.h"
|
||||
#include "functions.h"
|
||||
|
||||
extern void (*const gUnk_080CEB74[])(Entity*);
|
||||
extern void (*const gUnk_080CEB8C[])(Entity*);
|
||||
extern void (*const gUnk_080CEB98[])(Entity*);
|
||||
|
||||
extern u8 gUnk_080CEBA4[];
|
||||
|
||||
void Wisp(Entity* this) {
|
||||
EnemyFunctionHandler(this, gUnk_080CEB74);
|
||||
}
|
||||
|
||||
void sub_0803354C(Entity* this) {
|
||||
gUnk_080CEB8C[this->action](this);
|
||||
}
|
||||
|
||||
void sub_08033564(Entity* this) {
|
||||
u32 bits;
|
||||
Entity* ent;
|
||||
|
||||
bits = this->bitfield;
|
||||
if ((bits & 0x80) == 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
switch ((s32)bits & 0x3f) {
|
||||
case 0:
|
||||
this->action = 2;
|
||||
this->spriteSettings.b.draw = FALSE;
|
||||
this->flags &= 0x7f;
|
||||
this->field_0x7c.HALF.LO = 0x27c;
|
||||
gPlayerState.flags.all |= 0x4000;
|
||||
gUnk_02002A40.stats.filler2[4] = this->entityType.form + 1;
|
||||
gUnk_02002A40.stats.field_0x20 = 600;
|
||||
if (this->entityType.form == 0) {
|
||||
break;
|
||||
}
|
||||
DeleteThisEntity();
|
||||
break;
|
||||
case 0xe:
|
||||
case 0x15:
|
||||
this->currentHealth = 0;
|
||||
break;
|
||||
case 0x14:
|
||||
this->flags &= 0x7f;
|
||||
this->hurtBlinkTime = 0;
|
||||
this->spriteSettings.b.draw = FALSE;
|
||||
ent = CreateFx(this, 2, 0);
|
||||
if (ent != NULL) {
|
||||
this->attachedEntity = ent;
|
||||
this->actionDelay = 0xe;
|
||||
CopyPosition(this, ent);
|
||||
}
|
||||
DeleteThisEntity();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void sub_0803362C(Entity* this) {
|
||||
if (sub_0806F520() != 0) {
|
||||
gUnk_080CEB98[this->previousActionFlag](this);
|
||||
}
|
||||
}
|
||||
|
||||
void sub_08033650(Entity* this) {
|
||||
this->previousActionFlag = 2;
|
||||
}
|
||||
|
||||
void sub_08033658(Entity* this) {
|
||||
sub_0806F4E8();
|
||||
}
|
||||
|
||||
void sub_08033660(Entity* this) {
|
||||
if (sub_0806F3E4(this)) {
|
||||
sub_0804A7D4(this);
|
||||
}
|
||||
}
|
||||
|
||||
void sub_08033674(Entity* this) {
|
||||
sub_0804A720(this);
|
||||
this->actionDelay = 0;
|
||||
this->action = 1;
|
||||
this->field_0x1c = 1;
|
||||
this->field_0x80.HWORD = this->x.HALF.HI;
|
||||
this->field_0x82.HWORD = this->y.HALF.HI;
|
||||
sub_08033744(this);
|
||||
InitializeAnimation(this, this->entityType.parameter);
|
||||
}
|
||||
|
||||
void sub_080336A8(Entity* this) {
|
||||
if (--this->actionDelay == 0) {
|
||||
sub_08033744(this);
|
||||
} else if (this->collisions != 0) {
|
||||
sub_0800417E(this, this->collisions);
|
||||
}
|
||||
sub_080AEF88(this);
|
||||
GetNextFrame(this);
|
||||
}
|
||||
|
||||
void sub_080336DC(Entity* this) {
|
||||
switch ((u16)-- this->field_0x7c.HALF.LO) {
|
||||
case 0x24:
|
||||
this->x.HALF.HI = this->field_0x80.HWORD;
|
||||
this->y.HALF.HI = this->field_0x82.HWORD;
|
||||
break;
|
||||
case 0x18:
|
||||
sub_080A29BC(this);
|
||||
break;
|
||||
case 0xc:
|
||||
this->spriteSettings.b.draw = TRUE;
|
||||
break;
|
||||
case 0x0:
|
||||
this->action = 1;
|
||||
this->flags |= 0x80;
|
||||
sub_08033744(this);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void sub_08033744(Entity* this) {
|
||||
u32 temp;
|
||||
u32 rand = (u32)Random() % 256;
|
||||
|
||||
// 8 potential options
|
||||
this->actionDelay = gUnk_080CEBA4[(rand & 0x70) >> 4];
|
||||
|
||||
// 4 potential options
|
||||
temp = ((rand & 0xc) * 2);
|
||||
|
||||
// 75% chance to pass
|
||||
if ((sub_08049FA0(this) == 0) && ((rand % 4) != 0)) {
|
||||
temp = sub_08049EE4(this);
|
||||
|
||||
// 50% chance to pass
|
||||
if ((rand & 0x80) != 0) {
|
||||
temp += 0x4;
|
||||
temp &= 0x18;
|
||||
} else {
|
||||
temp += 0x1c;
|
||||
temp &= 0x18;
|
||||
}
|
||||
}
|
||||
this->direction = temp;
|
||||
}
|
||||
+370
@@ -0,0 +1,370 @@
|
||||
#include "global.h"
|
||||
#include "entity.h"
|
||||
|
||||
typedef struct OtherEntity {
|
||||
struct OtherEntity* prev;
|
||||
struct OtherEntity* next;
|
||||
Entity* field_0x8;
|
||||
u8 field_0xC[0x34];
|
||||
} OtherEntity;
|
||||
|
||||
extern Entity gUnk_030011E8[7];
|
||||
|
||||
Entity* sub_0805E744(void) {
|
||||
Entity* ent = gUnk_030011E8;
|
||||
|
||||
do {
|
||||
if (ent->prev == NULL) {
|
||||
return ent;
|
||||
}
|
||||
} while (++ent < &gUnk_030011E8[7]);
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
extern Entity* GetEmptyEntity();
|
||||
OtherEntity* GetEmptyManager();
|
||||
|
||||
typedef void* (*Getter)(void);
|
||||
|
||||
void* GetEmptyEntityByType(int type) {
|
||||
Getter getter = NULL;
|
||||
if (type == 9) {
|
||||
getter = (Getter)GetEmptyManager;
|
||||
} else {
|
||||
getter = (Getter)GetEmptyEntity;
|
||||
}
|
||||
return getter();
|
||||
}
|
||||
|
||||
typedef struct {
|
||||
int field_0x0;
|
||||
int field_0x4;
|
||||
Entity* field_0x8;
|
||||
int field_0xc;
|
||||
} struct_03003DD0;
|
||||
|
||||
extern struct_03003DD0 gUnk_03003DD0;
|
||||
extern u32 _call_via_r0(u32*);
|
||||
extern u32 _EntUpdate;
|
||||
extern 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->entityType.type == 9) {
|
||||
deleter = (Deleter)DeleteManager;
|
||||
} else {
|
||||
deleter = (Deleter)DeleteEntity;
|
||||
}
|
||||
deleter(ent);
|
||||
}
|
||||
|
||||
extern void sub_080AE068();
|
||||
extern void UnloadOBJPalette();
|
||||
extern void sub_0806FE84();
|
||||
extern void sub_080788E0();
|
||||
extern void sub_08078954();
|
||||
extern void sub_0805EC60();
|
||||
extern void sub_08017744();
|
||||
extern void sub_0805E92C();
|
||||
extern void UnloadCutsceneData();
|
||||
extern void UnloadBoundingBox();
|
||||
extern void sub_0801DA0C();
|
||||
extern void sub_0804AA1C();
|
||||
extern void UnlinkEntity(); // Unlink
|
||||
|
||||
void DeleteEntity(Entity* ent) {
|
||||
if (ent->next) {
|
||||
sub_080AE068(ent);
|
||||
UnloadOBJPalette(ent);
|
||||
sub_0806FE84(ent);
|
||||
sub_080788E0(ent);
|
||||
sub_08078954(ent);
|
||||
sub_0805EC60(ent);
|
||||
sub_08017744(ent);
|
||||
sub_0805E92C(ent);
|
||||
UnloadCutsceneData(ent);
|
||||
UnloadBoundingBox(ent);
|
||||
sub_0801DA0C(ent->otherEntity);
|
||||
ent->otherEntity = NULL;
|
||||
if ((ent->entityType).type == 3) {
|
||||
sub_0804AA1C(ent);
|
||||
}
|
||||
ent->flags = ent->flags & 0x7f;
|
||||
ent->spriteSettings.b.draw = 0;
|
||||
ent->field_0x3c = 0;
|
||||
ent->bitfield = 0;
|
||||
ent->field_0x42 = 0;
|
||||
ent->currentHealth = 0;
|
||||
UnlinkEntity(ent);
|
||||
ent->next = NULL;
|
||||
ent->prev = (Entity*)0xffffffff;
|
||||
}
|
||||
}
|
||||
|
||||
extern Entity gPlayerEntity;
|
||||
void ClearDeletedEntity(Entity*);
|
||||
|
||||
void ClearAllDeletedEntities(void) {
|
||||
Entity* ent = &gPlayerEntity;
|
||||
do {
|
||||
if ((int)ent->prev < 0) {
|
||||
ClearDeletedEntity(ent);
|
||||
}
|
||||
} while (ent++, ent < (&gPlayerEntity + 80));
|
||||
return;
|
||||
}
|
||||
|
||||
extern u8 gEntCount;
|
||||
|
||||
void ClearDeletedEntity(Entity* ent) {
|
||||
DmaClear32(3, ent, sizeof(Entity));
|
||||
gEntCount--;
|
||||
}
|
||||
|
||||
typedef struct LinkedList {
|
||||
Entity* last;
|
||||
Entity* first;
|
||||
} LinkedList;
|
||||
|
||||
extern LinkedList gEntityLists[9];
|
||||
extern EntityType gUnk_03003DB8;
|
||||
|
||||
void DeleteAllEntities(void) {
|
||||
Entity* ent;
|
||||
Entity* next;
|
||||
LinkedList* it;
|
||||
|
||||
it = &gEntityLists[0];
|
||||
if (it->first) {
|
||||
do {
|
||||
for (ent = it->first; (u32)ent != (u32)it; ent = next) {
|
||||
next = ent->next;
|
||||
DeleteEntityAny(ent);
|
||||
}
|
||||
} while (++it < &gEntityLists[9]);
|
||||
ClearAllDeletedEntities();
|
||||
}
|
||||
}
|
||||
|
||||
extern OtherEntity gUnk_02033290;
|
||||
|
||||
OtherEntity* GetEmptyManager(void) {
|
||||
OtherEntity* it;
|
||||
for (it = &gUnk_02033290; it < (&gUnk_02033290 + 32); it++) {
|
||||
if (it->prev == 0) {
|
||||
return it;
|
||||
}
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
extern void _DmaZero(void*, u32);
|
||||
extern u8 gManagerCount;
|
||||
|
||||
void DeleteManager(OtherEntity* ent) {
|
||||
if (!ent->next)
|
||||
return;
|
||||
|
||||
sub_0805E92C(ent);
|
||||
UnlinkEntity(ent);
|
||||
_DmaZero(ent, sizeof(OtherEntity));
|
||||
gManagerCount--;
|
||||
}
|
||||
|
||||
#include "area.h"
|
||||
|
||||
void sub_0805E92C(u32 param_1) {
|
||||
if (param_1 == gArea.unk2) {
|
||||
gArea.unk2 = 0;
|
||||
gArea.unk3 = 0;
|
||||
gArea.unk4 = 0;
|
||||
}
|
||||
}
|
||||
|
||||
extern Entity gUnk_020369F0;
|
||||
extern void sub_0801D66C(const void* src, void* dest, size_t size); // dma copy
|
||||
extern void sub_0805E98C(void);
|
||||
|
||||
void sub_0805E958(void) {
|
||||
sub_0801D66C(&gEntityLists, &gUnk_020369F0, 0x48);
|
||||
sub_0805E98C();
|
||||
}
|
||||
|
||||
void sub_0805E974(void) {
|
||||
sub_0801D66C(&gUnk_020369F0, &gEntityLists, 0x48);
|
||||
}
|
||||
|
||||
void sub_0805E98C(void) {
|
||||
LinkedList* list;
|
||||
|
||||
for (list = gEntityLists; list < &gEntityLists[9]; list++) {
|
||||
list->last = (Entity*)list;
|
||||
list->first = (Entity*)list;
|
||||
}
|
||||
}
|
||||
|
||||
void sub_0805E9A8(void) {
|
||||
Entity* i;
|
||||
LinkedList* list;
|
||||
|
||||
list = &gEntityLists[0];
|
||||
do {
|
||||
for (i = list->first; (u32)i != (u32)list; i = i->next) {
|
||||
i->flags &= 0xfd;
|
||||
if ((i->flags & 0x20) == 0) {
|
||||
i->flags |= 0x10;
|
||||
}
|
||||
}
|
||||
} while (++list < &gEntityLists[9]);
|
||||
}
|
||||
|
||||
void sub_0805E9F4(void) {
|
||||
Entity* ent;
|
||||
Entity* next;
|
||||
LinkedList* list;
|
||||
|
||||
list = &gEntityLists[0];
|
||||
do {
|
||||
for (ent = list->first; (u32)ent != (u32)list; ent = next) {
|
||||
next = ent->next;
|
||||
if (ent->flags & 0x10)
|
||||
DeleteEntityAny(ent);
|
||||
}
|
||||
} while (++list < &gEntityLists[9]);
|
||||
}
|
||||
|
||||
extern void sub_0805E374(Entity*);
|
||||
|
||||
void AppendEntityToList(Entity* ent, int listIndex) {
|
||||
LinkedList* list;
|
||||
|
||||
list = &gEntityLists[listIndex];
|
||||
ent->next = (Entity*)list;
|
||||
ent->prev = list->last;
|
||||
list->last->next = ent;
|
||||
list->last = ent;
|
||||
if (ent->entityType.type != 9) {
|
||||
ent->spritePriority.b0 = 4;
|
||||
gEntCount++;
|
||||
} else {
|
||||
gManagerCount++;
|
||||
}
|
||||
sub_0805E374(ent);
|
||||
}
|
||||
|
||||
void PrependEntityToList(Entity* ent, int listIndex) {
|
||||
LinkedList* list;
|
||||
|
||||
UnlinkEntity(ent);
|
||||
list = &gEntityLists[listIndex];
|
||||
ent->prev = (Entity*)list;
|
||||
ent->next = list->first;
|
||||
list->first->prev = ent;
|
||||
list->first = ent;
|
||||
}
|
||||
|
||||
void UnlinkEntity(Entity* ent) {
|
||||
if (ent == gUnk_03003DD0.field_0x8) {
|
||||
gUnk_03003DD0.field_0x8 = ent->prev;
|
||||
}
|
||||
ent->prev->next = ent->next;
|
||||
ent->next->prev = ent->prev;
|
||||
}
|
||||
|
||||
bool32 DoesSimilarEntityExist(Entity* ent) {
|
||||
Entity* i;
|
||||
LinkedList* list;
|
||||
|
||||
list = &gEntityLists[0];
|
||||
do {
|
||||
for (i = list->first; (u32)i != (u32)list; i = i->next) {
|
||||
if ((u32)i != (u32)ent && i->entityType.type == ent->entityType.type &&
|
||||
i->entityType.subtype == ent->entityType.subtype) {
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
} while (++list < &gEntityLists[9]);
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
Entity* FindEntityInListBySubtype(int type, int subtype, int listIndex) {
|
||||
Entity* it;
|
||||
LinkedList* list;
|
||||
|
||||
list = &gEntityLists[listIndex];
|
||||
for (it = list->first; (u32)it != (u32)list; it = it->next) {
|
||||
if (type == it->entityType.type && subtype == it->entityType.subtype)
|
||||
return it;
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
Entity* FindEntityInListByForm(int type, int subtype, int listIndex, int form, int parameter) {
|
||||
Entity* i;
|
||||
LinkedList* list;
|
||||
|
||||
list = &gEntityLists[listIndex];
|
||||
for (i = list->first; (u32)i != (u32)list; i = i->next) {
|
||||
if (type == i->entityType.type
|
||||
&& subtype == i->entityType.subtype
|
||||
&& form == i->entityType.form
|
||||
&& parameter == i->entityType.parameter)
|
||||
return i;
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
Entity* FindNextEntityOfSameSubtype(Entity* ent, int listIndex) {
|
||||
Entity* i;
|
||||
LinkedList* list;
|
||||
|
||||
list = &gEntityLists[listIndex];
|
||||
for (i = ent->next; (u32)i != (u32)list; i = i->next) {
|
||||
if (i->entityType.type == ent->entityType.type && i->entityType.subtype == ent->entityType.subtype)
|
||||
return i;
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
Entity* FindEntityBySubtype(int type, int subtype) {
|
||||
Entity* i;
|
||||
LinkedList* list;
|
||||
|
||||
list = &gEntityLists[0];
|
||||
do {
|
||||
for (i = (Entity*)list->first; (u32)i != (u32)list; i = i->next) {
|
||||
if ((type == (i->entityType).type) && (subtype == (i->entityType).subtype))
|
||||
return i;
|
||||
}
|
||||
} while (++list < &gEntityLists[9]);
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
void DeleteAllEnemies(void) {
|
||||
Entity* ent;
|
||||
Entity* next;
|
||||
LinkedList* list;
|
||||
|
||||
list = &gEntityLists[0];
|
||||
do {
|
||||
for (ent = list->first; (u32)ent != (u32)list; ent = next) {
|
||||
next = ent->next;
|
||||
if (ent->entityType.type == 3)
|
||||
DeleteEntity(ent);
|
||||
}
|
||||
} while (++list < &gEntityLists[9]);
|
||||
ClearAllDeletedEntities();
|
||||
}
|
||||
+117
@@ -0,0 +1,117 @@
|
||||
#include "global.h"
|
||||
#include "entity.h"
|
||||
#include "functions.h"
|
||||
#include "textbox.h"
|
||||
#include "structures.h"
|
||||
|
||||
typedef struct {
|
||||
s8 unk0;
|
||||
u8 unk1;
|
||||
u8 unk2;
|
||||
u8 unk3;
|
||||
u8 unk4;
|
||||
u8 unk5;
|
||||
u8 unk6;
|
||||
u8 unk7;
|
||||
u8 unk8;
|
||||
u8 unk9;
|
||||
u8 unkA;
|
||||
u8 unkB;
|
||||
u16 unkC;
|
||||
u16 unkE;
|
||||
u16 unk10;
|
||||
u8 unk12;
|
||||
u8 unk13;
|
||||
} Element;
|
||||
|
||||
///////////////////////////////////////////////////////////////
|
||||
|
||||
extern void sub_0805ECEC(u32, u32, u32, u32);
|
||||
extern void sub_0801CAD0(Element*);
|
||||
|
||||
extern void (*const gUnk_080C904C[])(Element*);
|
||||
|
||||
extern u16 gUnk_080C9058[];
|
||||
|
||||
void EzloNag(Element* arg0) {
|
||||
gUnk_080C904C[arg0->unk4](arg0);
|
||||
}
|
||||
|
||||
#ifdef NON_MATCHING // REG SWAP
|
||||
extern u32 gUnk_080C9094;
|
||||
|
||||
void sub_0801CED8(Element* arg0) {
|
||||
if (gUnk_0200AF00.ezloNagFuncIndex == 1) {
|
||||
gUnk_0200AF00.ezloNagFuncIndex = 2;
|
||||
arg0->unkC = 0x10;
|
||||
arg0->unkE = 0x90;
|
||||
arg0->unk6 = 0;
|
||||
arg0->unk1 = 7;
|
||||
arg0->unk4 = 1;
|
||||
arg0->unk0 |= 2;
|
||||
sub_0801CAB8(arg0, &gUnk_080C9094);
|
||||
}
|
||||
}
|
||||
#else
|
||||
NAKED
|
||||
void sub_0801CED8(Element* arg0) {
|
||||
asm_unified("\
|
||||
push {r4, lr}\n\
|
||||
adds r3, r0, #0\n\
|
||||
ldr r0, _0801CF10 @ =gUnk_0200AF00\n\
|
||||
adds r1, r0, #0\n\
|
||||
adds r1, #0x24\n\
|
||||
ldrb r4, [r1]\n\
|
||||
cmp r4, #1\n\
|
||||
bne _0801CF0E\n\
|
||||
movs r2, #2\n\
|
||||
movs r0, #2\n\
|
||||
strb r0, [r1]\n\
|
||||
movs r1, #0\n\
|
||||
movs r0, #0x10\n\
|
||||
strh r0, [r3, #0xc]\n\
|
||||
movs r0, #0x90\n\
|
||||
strh r0, [r3, #0xe]\n\
|
||||
strb r1, [r3, #6]\n\
|
||||
movs r0, #7\n\
|
||||
strb r0, [r3, #1]\n\
|
||||
strb r4, [r3, #4]\n\
|
||||
ldrb r0, [r3]\n\
|
||||
orrs r0, r2\n\
|
||||
strb r0, [r3]\n\
|
||||
ldr r1, _0801CF14 @ =gUnk_080C9094\n\
|
||||
adds r0, r3, #0\n\
|
||||
bl sub_0801CAB8\n\
|
||||
_0801CF0E:\n\
|
||||
pop {r4, pc}\n\
|
||||
.align 2, 0\n\
|
||||
_0801CF10: .4byte gUnk_0200AF00\n\
|
||||
_0801CF14: .4byte gUnk_080C9094");
|
||||
}
|
||||
#endif
|
||||
|
||||
void sub_0801CF18(Element* arg0) {
|
||||
u32 temp;
|
||||
|
||||
temp = gUnk_080C9058[arg0->unk6++];
|
||||
sub_0805ECEC(0, temp, temp, 0);
|
||||
if (temp == 0) {
|
||||
arg0->unk4 = 2;
|
||||
arg0->unk1 = 8;
|
||||
gUnk_0200AF00.ezloNagFuncIndex = 3;
|
||||
PlaySFX(0x173);
|
||||
}
|
||||
}
|
||||
|
||||
void sub_0801CF60(Element* arg0) {
|
||||
|
||||
if ((gUnk_0200AF00.ezloNagFuncIndex >= 5) || (gTextBox.doTextBox & 0x7f)) {
|
||||
arg0->unk4 = 0;
|
||||
arg0->unk0 &= -3;
|
||||
return;
|
||||
}
|
||||
sub_0801CAD0(arg0);
|
||||
if (arg0->unk13 == 1) {
|
||||
gUnk_0200AF00.ezloNagFuncIndex = 4;
|
||||
}
|
||||
}
|
||||
@@ -1,36 +0,0 @@
|
||||
#include "global.h"
|
||||
#include "entity.h"
|
||||
#include "flags.h"
|
||||
|
||||
extern void DeleteThisEntity();
|
||||
extern void sub_0808E714(Entity*);
|
||||
|
||||
extern void (*const gUnk_08121C48[])(Entity*);
|
||||
|
||||
extern BoundingBox gUnk_08121C58;
|
||||
|
||||
void HeartContainer(Entity* this) {
|
||||
gUnk_08121C48[this->action](this);
|
||||
}
|
||||
|
||||
void sub_0808E6A0(Entity* this) {
|
||||
|
||||
if (CheckFlags(*(u16*)&this->cutsceneBeh)) {
|
||||
DeleteThisEntity();
|
||||
}
|
||||
this->action = 1;
|
||||
this->entityType.form = 0x62;
|
||||
this->spriteSettings.b.ss0 = 0;
|
||||
this->boundingBox = &gUnk_08121C58;
|
||||
this->collisionLayer = 3;
|
||||
this->scriptedScene = 3;
|
||||
}
|
||||
|
||||
void sub_0808E6E4(Entity* this) {
|
||||
if (CheckFlags(this->field_0x86)) {
|
||||
this->action = 2;
|
||||
this->spriteSettings.b.ss0 = 1;
|
||||
this->spriteOrder.b0 = 3;
|
||||
sub_0808E714(this);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,68 @@
|
||||
#include "global.h"
|
||||
#include "entity.h"
|
||||
#include "player.h"
|
||||
#include "structures.h"
|
||||
#include "functions.h"
|
||||
#include "room.h"
|
||||
#include "flags.h"
|
||||
|
||||
extern u32 gUnk_03000B80;
|
||||
extern u32 gUnk_03003FC0;
|
||||
|
||||
extern Entity gPlayerEntity;
|
||||
|
||||
extern u8 gUnk_080FCAC8[];
|
||||
|
||||
void InitializePlayer(void)
|
||||
{
|
||||
Entity* pl;
|
||||
|
||||
sub_080784C8();
|
||||
_DmaZero((void *)&gUnk_03000B80, 0x70);
|
||||
_DmaZero((void *)&gPlayerState, 0xb0);
|
||||
|
||||
_DmaFill32(0xffffffff, &gPlayerState.field_0x40, 0x40);
|
||||
pl = &gPlayerEntity;
|
||||
_DmaZero((void *)pl, 0x88);
|
||||
gRoomControls.cameraTarget = pl;
|
||||
gPlayerState.playerAction = gUnk_080FCAC8[gScreenTransition.field_0xf];
|
||||
if (!CheckGlobalFlag(0x14)) {
|
||||
gPlayerState.flags.all |= 8;
|
||||
}
|
||||
switch (gScreenTransition.field_0xf) {
|
||||
case 0x2:
|
||||
case 0x6:
|
||||
pl->height.HALF.HI = -0xc0;
|
||||
break;
|
||||
case 0x4:
|
||||
gPlayerState.field_0x34[4] = 0x10;
|
||||
pl->direction = gScreenTransition.playerState << 2;
|
||||
case 0x3:
|
||||
pl->nonPlanarMovement = 0xe0;
|
||||
break;
|
||||
case 0x7:
|
||||
case 0x8:
|
||||
gPlayerState.field_0x34[4] = 1;
|
||||
gPlayerState.field_0x34[5] = gScreenTransition.field_0xf;
|
||||
break;
|
||||
case 0xa:
|
||||
gPlayerState.field_0x34[4] = 1;
|
||||
break;
|
||||
case 0xb:
|
||||
gPlayerState.field_0x34[4] = 3;
|
||||
break;
|
||||
case 0xc:
|
||||
gPlayerState.field_0x34[4] = 4;
|
||||
}
|
||||
pl->entityType.type = 1;
|
||||
pl->flags |= 0xa0;
|
||||
pl->spritePriority.b0 = 4;
|
||||
pl->currentHealth = gUnk_02002A40.stats.health;
|
||||
pl->x.HALF.HI = gScreenTransition.playerStartPos.HALF.x;
|
||||
pl->y.HALF.HI = gScreenTransition.playerStartPos.HALF.y;
|
||||
pl->animationState = gScreenTransition.playerState;
|
||||
pl->collisionLayer = gScreenTransition.playerLayer;
|
||||
UpdateSpriteForCollisionLayer(pl);
|
||||
AppendEntityToList(pl, 1);
|
||||
sub_08017640();
|
||||
}
|
||||
+32
@@ -0,0 +1,32 @@
|
||||
#include "global.h"
|
||||
#include "entity.h"
|
||||
#include "readKeyInput.h"
|
||||
|
||||
static void StoreKeyInput(Input*, u32);
|
||||
|
||||
void ReadKeyInput(void)
|
||||
{
|
||||
u32 keyInput = ~REG_KEYINPUT & KEYS_MASK;
|
||||
StoreKeyInput(&gUnk_03000FF0, 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;
|
||||
}
|
||||
+366
@@ -0,0 +1,366 @@
|
||||
#include "global.h"
|
||||
#include "menu.h"
|
||||
#include "main.h"
|
||||
#include "entity.h"
|
||||
#include "functions.h"
|
||||
#include "readKeyInput.h"
|
||||
#include "screen.h"
|
||||
#include "structures.h"
|
||||
|
||||
typedef struct {
|
||||
u8 filler0[0x4];
|
||||
u8 gameLanguage;
|
||||
u8 state;
|
||||
u8 subState;
|
||||
u8 filler7[0x1];
|
||||
u16 timer;
|
||||
u8 fillerA[0x6];
|
||||
u8 lightRaysPaletteGroup;
|
||||
u8 lightRaysAlphaBlendIndex;
|
||||
u8 counter;
|
||||
u8 filler13[0x19];
|
||||
int swordBgScaleRatio;
|
||||
} IntroState;
|
||||
|
||||
// TODO: This occupies the same memory region as gMenu
|
||||
extern IntroState gIntroState;
|
||||
|
||||
enum {
|
||||
ADVANCE_NONE,
|
||||
ADVANCE_TIMER_EXPIRED,
|
||||
ADVANCE_KEY_PRESSED,
|
||||
};
|
||||
|
||||
static void HandleNintendoCapcomLogos(void);
|
||||
static void HandleTitlescreen(void);
|
||||
static void UpdateSwordBgAffineData(void);
|
||||
static void ExitTitlescreen(void);
|
||||
static void HandleJapaneseTitlescreenAnimationIntro(void);
|
||||
static void HandleTitlescreenAnimationIntro(void);
|
||||
static u32 GetAdvanceState(void);
|
||||
static void UpdateLightRays(void);
|
||||
static void UpdatePressStartIcon(void);
|
||||
|
||||
static void (*const sIntroSequenceHandlers[])(void) = {
|
||||
HandleNintendoCapcomLogos,
|
||||
HandleTitlescreen,
|
||||
ExitTitlescreen,
|
||||
};
|
||||
|
||||
static const u16 sLightRaysAlphaBlends[] = {
|
||||
BLDALPHA_BLEND(9, 9),
|
||||
BLDALPHA_BLEND(8, 10),
|
||||
BLDALPHA_BLEND(7, 11),
|
||||
BLDALPHA_BLEND(6, 12),
|
||||
BLDALPHA_BLEND(5, 13),
|
||||
BLDALPHA_BLEND(6, 12),
|
||||
BLDALPHA_BLEND(7, 11),
|
||||
BLDALPHA_BLEND(8, 10),
|
||||
};
|
||||
|
||||
static u32 AdvanceIntroSequence(u32 transition)
|
||||
{
|
||||
gUnk_02032EC0.transitionType = transition;
|
||||
gUnk_03001000.funcIndex = 2;
|
||||
_DmaZero(&gIntroState, sizeof(gIntroState));
|
||||
DoFade(7, 8);
|
||||
}
|
||||
|
||||
void HandleIntroScreen(void)
|
||||
{
|
||||
sub_080AD90C();
|
||||
switch (gUnk_03001000.funcIndex) {
|
||||
case 0:
|
||||
sub_08056418();
|
||||
_DmaZero(&gUnk_02032EC0, 0x3b4);
|
||||
AdvanceIntroSequence(0);
|
||||
break;
|
||||
case 1:
|
||||
sIntroSequenceHandlers[gUnk_02032EC0.transitionType]();
|
||||
break;
|
||||
case 2:
|
||||
if (gFadeControl.active) {
|
||||
return;
|
||||
}
|
||||
sub_0801DA90(1);
|
||||
gUnk_03001000.funcIndex = 1;
|
||||
break;
|
||||
}
|
||||
sub_080AD918();
|
||||
}
|
||||
|
||||
static void HandleNintendoCapcomLogos(void)
|
||||
{
|
||||
u32 advance;
|
||||
u32 paletteGroup;
|
||||
|
||||
advance = GetAdvanceState();
|
||||
if (gIntroState.state == 0) {
|
||||
sub_0801DA90(1);
|
||||
gIntroState.state = 1;
|
||||
gIntroState.timer = 120;
|
||||
LoadGfxGroup(16);
|
||||
LoadGfxGroup(1);
|
||||
if (((struct_02000000 *)0x2000000)->gameLanguage == 0) {
|
||||
paletteGroup = 1;
|
||||
}
|
||||
else {
|
||||
paletteGroup = 2;
|
||||
}
|
||||
LoadPaletteGroup(paletteGroup);
|
||||
gScreen.lcd.displayControl |= 0x400;
|
||||
gScreen.bg.bg2yOffset = 1;
|
||||
DoFade(6, 8);
|
||||
advance = ADVANCE_NONE;
|
||||
} else {
|
||||
if (advance == ADVANCE_TIMER_EXPIRED) {
|
||||
advance = ADVANCE_KEY_PRESSED;
|
||||
}
|
||||
}
|
||||
|
||||
if (advance == ADVANCE_KEY_PRESSED) {
|
||||
gUnk_02000010.listenForKeyPresses = 1;
|
||||
AdvanceIntroSequence(1);
|
||||
}
|
||||
}
|
||||
|
||||
extern u16 gUnk_03001010[5];
|
||||
|
||||
static void HandleTitlescreen(void)
|
||||
{
|
||||
int advance;
|
||||
u32 paletteGroup;
|
||||
|
||||
gIntroState.counter++;
|
||||
switch (gIntroState.state) {
|
||||
case 0:
|
||||
gIntroState.state = 1;
|
||||
gIntroState.subState = 0;
|
||||
gIntroState.timer = 30;
|
||||
gIntroState.gameLanguage = 7;
|
||||
EraseAllEntities();
|
||||
sub_0801CFA8(0);
|
||||
sub_080ADD30();
|
||||
gUnk_02024490.unk0 = 1;
|
||||
LoadGfxGroup(2);
|
||||
if (((struct_02000000*)0x2000000)->gameLanguage == 0) {
|
||||
paletteGroup = 3;
|
||||
}
|
||||
else {
|
||||
paletteGroup = 4;
|
||||
}
|
||||
LoadPaletteGroup(paletteGroup);
|
||||
if (((struct_02000000*)0x2000000)->gameLanguage == 0) {
|
||||
gScreen.controls.layerFXControl = 0x844;
|
||||
gScreen.controls.alphaBlend = BLDALPHA_BLEND(9, 9);
|
||||
gScreen.bg.bg1xOffset = 0x1c09;
|
||||
gScreen.affine.bg2Control = 0x1d02;
|
||||
gScreen.affine.bg3Control = 0x1e03;
|
||||
gScreen.lcd.displayControl |= 0x1e00;
|
||||
gScreen.bg.bg2xOffset = 0xff60;
|
||||
}
|
||||
else {
|
||||
gScreen.controls.layerFXControl = 0x241;
|
||||
gScreen.controls.alphaBlend = BLDALPHA_BLEND(9, 9);
|
||||
gScreen.bg.bg0Control = 0x1d02;
|
||||
gScreen.bg.bg1xOffset = 0x1E03;
|
||||
gScreen.affine.bg2Control = 0x7C89;
|
||||
gScreen.lcd.displayControl |= 1;
|
||||
gScreen.lcd.displayControl |= 0x1300;
|
||||
gIntroState.swordBgScaleRatio = 0x10;
|
||||
UpdateSwordBgAffineData();
|
||||
}
|
||||
sub_080A3210();
|
||||
PlaySFX(3); //fanfare
|
||||
DoFade(6, 8);
|
||||
break;
|
||||
case 1:
|
||||
if (gFadeControl.active) {
|
||||
return;
|
||||
}
|
||||
if (((struct_02000000*)0x2000000)->gameLanguage == 0) {
|
||||
HandleJapaneseTitlescreenAnimationIntro();
|
||||
}
|
||||
else {
|
||||
HandleTitlescreenAnimationIntro();
|
||||
}
|
||||
break;
|
||||
case 2:
|
||||
if (--gIntroState.timer == 0) {
|
||||
gIntroState.timer = 3600;
|
||||
gIntroState.state++;
|
||||
}
|
||||
UpdatePressStartIcon();
|
||||
break;
|
||||
default:
|
||||
advance = GetAdvanceState();
|
||||
if (advance != ADVANCE_NONE) {
|
||||
if (advance == ADVANCE_KEY_PRESSED) {
|
||||
PlaySFX(0x6a);
|
||||
}
|
||||
else {
|
||||
advance = ADVANCE_NONE;
|
||||
}
|
||||
AdvanceIntroSequence(advance);
|
||||
PlaySFX(0x80080000);
|
||||
}
|
||||
UpdatePressStartIcon();
|
||||
if ((gIntroState.timer & 0x20) == 0) {
|
||||
gUnk_03001010[4] = 0xe000;
|
||||
gUnk_03001010[1] = 0x84;
|
||||
sub_080ADA14(0x1ff,0);
|
||||
}
|
||||
}
|
||||
if (gIntroState.gameLanguage != ((struct_02000000*)0x2000000)->gameLanguage) {
|
||||
gIntroState.gameLanguage = ((struct_02000000*)0x2000000)->gameLanguage;
|
||||
LoadGfxGroup(3);
|
||||
}
|
||||
UpdateLightRays();
|
||||
sub_0805E5C0();
|
||||
sub_080AD9B0();
|
||||
}
|
||||
|
||||
static void UpdatePressStartIcon(void) {
|
||||
gUnk_03001010[2] = 0;
|
||||
gUnk_03001010[3] = 0;
|
||||
gUnk_03001010[4] = 0xE020;
|
||||
gUnk_03001010[0] = 120;
|
||||
gUnk_03001010[1] = 152;
|
||||
sub_080ADA14(511, 1);
|
||||
return;
|
||||
}
|
||||
|
||||
static void UpdateSwordBgAffineData(void)
|
||||
{
|
||||
struct BgAffineSrcData aff;
|
||||
aff.texY = 0x8000;
|
||||
aff.texX = 0x8000;
|
||||
aff.scrX = 0x78;
|
||||
aff.scrY = 0x48;
|
||||
aff.alpha = 0;
|
||||
aff.sy = aff.sx = gIntroState.swordBgScaleRatio;
|
||||
BgAffineSet(&aff, (struct BgAffineDstData*)&gBgControls, 1);
|
||||
}
|
||||
|
||||
static void HandleJapaneseTitlescreenAnimationIntro(void)
|
||||
{
|
||||
Entity *pEVar2;
|
||||
|
||||
switch (gIntroState.subState) {
|
||||
case 0:
|
||||
if (!gFadeControl.active) {
|
||||
if ((gIntroState.counter & 1) == 0) {
|
||||
gScreen.bg.bg2xOffset++;
|
||||
}
|
||||
|
||||
if (GetAdvanceState() == ADVANCE_KEY_PRESSED || gScreen.bg.bg2xOffset == 0) {
|
||||
gIntroState.subState++;
|
||||
gScreen.bg.bg2xOffset = 0;
|
||||
gScreen.bg.bg1xOffset = 0xc09;
|
||||
gFadeControl.field_0x4 = 0x40;
|
||||
DoFade(6, 0x10);
|
||||
PlaySFX(0xf8);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 1:
|
||||
if (!gFadeControl.active) {
|
||||
gFadeControl.field_0x4 = -1;
|
||||
gIntroState.subState++;
|
||||
gIntroState.timer = 90;
|
||||
pEVar2 = CreateObject(0xb4,0,0);
|
||||
if (pEVar2 != NULL) {
|
||||
pEVar2->x.HALF.HI = 0;
|
||||
pEVar2->y.HALF.HI = 0x48;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 2:
|
||||
if (GetAdvanceState() != ADVANCE_NONE) {
|
||||
gIntroState.state++;
|
||||
gIntroState.timer = 60;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void HandleTitlescreenAnimationIntro(void) {
|
||||
switch (gIntroState.subState) {
|
||||
case 0:
|
||||
if (!gFadeControl.active) {
|
||||
gIntroState.subState = 1;
|
||||
gScreen.lcd.displayControl |= 0x400;
|
||||
PlaySFX(0xF6);
|
||||
}
|
||||
break;
|
||||
case 1:
|
||||
gIntroState.swordBgScaleRatio += 0x10;
|
||||
if (gIntroState.swordBgScaleRatio > 0x100) {
|
||||
gIntroState.swordBgScaleRatio = 0x100;
|
||||
gIntroState.timer = 40;
|
||||
gIntroState.subState++;
|
||||
DoFade(6, 16);
|
||||
}
|
||||
UpdateSwordBgAffineData();
|
||||
break;
|
||||
case 2:
|
||||
if (--gIntroState.timer == 0) {
|
||||
gIntroState.timer = 300;
|
||||
gIntroState.subState++;
|
||||
CreateObject(0xBD, 0, 0);
|
||||
DoFade(6, 16);
|
||||
PlaySFX(0xF8);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
if (!gFadeControl.active && GetAdvanceState() != ADVANCE_NONE) {
|
||||
gIntroState.state++;
|
||||
gIntroState.timer = 60;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
static void ExitTitlescreen(void) {
|
||||
if (!gFadeControl.active) {
|
||||
InitScreen(SCREEN_CHOOSE_FILE);
|
||||
}
|
||||
}
|
||||
|
||||
static u32 GetAdvanceState(void) {
|
||||
u32 newKeys;
|
||||
|
||||
if (gFadeControl.active) {
|
||||
return ADVANCE_NONE;
|
||||
}
|
||||
|
||||
if (!gUnk_02000010.listenForKeyPresses) {
|
||||
newKeys = 0;
|
||||
} else {
|
||||
newKeys = gUnk_03000FF0.newKeys & (A_BUTTON | START_BUTTON);
|
||||
}
|
||||
|
||||
if (--gIntroState.timer == 0) {
|
||||
return ADVANCE_TIMER_EXPIRED;
|
||||
}
|
||||
|
||||
if (newKeys) {
|
||||
return ADVANCE_KEY_PRESSED;
|
||||
}
|
||||
|
||||
return ADVANCE_NONE;
|
||||
}
|
||||
|
||||
static void UpdateLightRays(void) {
|
||||
// Periodically rotate the palette to give a shimmeriming effect.
|
||||
if ((gIntroState.counter & 0x7) == 0) {
|
||||
gIntroState.lightRaysPaletteGroup++;
|
||||
gIntroState.lightRaysPaletteGroup &= 0x3;
|
||||
LoadPaletteGroup(5 + gIntroState.lightRaysPaletteGroup);
|
||||
}
|
||||
|
||||
// Periodiccally update the transparency of the light rays.
|
||||
if ((gIntroState.counter & 0x1F) == 0) {
|
||||
gIntroState.lightRaysAlphaBlendIndex = (gIntroState.lightRaysAlphaBlendIndex + 1) & 0x7;
|
||||
gScreen.controls.alphaBlend = sLightRaysAlphaBlends[gIntroState.lightRaysAlphaBlendIndex];
|
||||
}
|
||||
}
|
||||
@@ -1,28 +0,0 @@
|
||||
#include "global.h"
|
||||
#include "menu.h"
|
||||
|
||||
typedef struct {
|
||||
u8 unk;
|
||||
u8 unk2;
|
||||
u8 unk3;
|
||||
u8 functionIndex;
|
||||
u16 unk6;
|
||||
u8 filler[5];
|
||||
u32 ticks;
|
||||
u16 unk7;
|
||||
} TransitionStruct;
|
||||
|
||||
extern u32 DoFade(u32, u32);
|
||||
extern void sub_0801D630(u32*, u32, u32);
|
||||
extern u32 gUnk_02000080;
|
||||
extern TransitionStruct gUnk_03001000;
|
||||
extern Menu gUnk_02032EC0;
|
||||
|
||||
u32 IntroSetTransition(u8 transition, u32 param_2, u32 param_3)
|
||||
|
||||
{
|
||||
gUnk_02032EC0.transitionType = transition;
|
||||
gUnk_03001000.functionIndex = 2;
|
||||
sub_0801D630(&gUnk_02000080, 48, param_3);
|
||||
return DoFade(7, 8);
|
||||
}
|
||||
+120
@@ -38,3 +38,123 @@ void (*const gItemFunctions[])(ItemBehavior*, u32) = {
|
||||
JarEmpty,
|
||||
JarEmpty,
|
||||
};
|
||||
|
||||
extern void sub_08077E78(ItemBehavior*, u32);
|
||||
extern void PlaySFX(u32);
|
||||
extern void sub_08078F60(void);
|
||||
extern void sub_08077D38(ItemBehavior*, u32);
|
||||
extern void sub_0805E544(void);
|
||||
extern void UpdateItemAnim(ItemBehavior*);
|
||||
extern void CreateBird(void);
|
||||
extern void UnfreezeTime(void);
|
||||
extern void sub_0806F948(Entity*);
|
||||
extern void sub_08077BB8(ItemBehavior*);
|
||||
extern void CreatePlayerBomb(ItemBehavior*, u32);
|
||||
extern u32 sub_08077EFC();
|
||||
|
||||
extern void (*const gOcarinaStates[4])(ItemBehavior*, u32);
|
||||
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);
|
||||
gPlayerEntity.field_0x7a++;
|
||||
}
|
||||
|
||||
void OcarinaUse(ItemBehavior *beh, u32 arg1)
|
||||
{
|
||||
u32 bVar1;
|
||||
|
||||
if (gPlayerState.playerAction == 0x18) {
|
||||
PlayerChangeState(beh, arg1);
|
||||
}
|
||||
else {
|
||||
beh->field_0x5[4] = beh->field_0x5[4] | 0xf;
|
||||
gPlayerEntity.animationState = 4;
|
||||
gPlayerEntity.spriteSettings.b.flipX = 0;
|
||||
gPlayerEntity.flags &= 0x7f;
|
||||
gPlayerEntity.field_0x7a = 2;
|
||||
gPlayerState.flags.all |= 0x10000000;
|
||||
gPlayerState.field_0x27[0] = 0xff;
|
||||
gUnk_02034490 = 1;
|
||||
bVar1 = (8 >> arg1);
|
||||
gPlayerState.field_0xa |= bVar1;
|
||||
gPlayerState.keepFacing |= bVar1;
|
||||
sub_08078F60();
|
||||
sub_08077D38(beh, arg1);
|
||||
PlaySFX(0x216);
|
||||
sub_0805E544();
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
void PacciCane(ItemBehavior* beh, u32 arg1) {
|
||||
gUnk_0811BDE0[beh->stateID](beh, arg1);
|
||||
}
|
||||
|
||||
void sub_08076C98(ItemBehavior* beh, u32 arg1) {
|
||||
beh->field_0x5[4] |= 0xf;
|
||||
sub_08077D38(beh, arg1);
|
||||
sub_0806F948(&gPlayerEntity);
|
||||
sub_08077BB8(beh);
|
||||
}
|
||||
|
||||
void sub_08076CBC(ItemBehavior* beh, u32 arg1) {
|
||||
if ((beh->field_0x5[9] & 0x80) != 0) {
|
||||
sub_08077E78(beh, arg1);
|
||||
} else {
|
||||
if ((beh->field_0x5[9] & 0x40) != 0) {
|
||||
CreatePlayerBomb(beh, 0x12);
|
||||
}
|
||||
UpdateItemAnim(beh);
|
||||
}
|
||||
}
|
||||
|
||||
void Shield(ItemBehavior* beh, u32 arg1) {
|
||||
gUnk_0811BDE8[beh->stateID](beh, arg1);
|
||||
}
|
||||
|
||||
void sub_08076D04(ItemBehavior* beh, u32 arg1) {
|
||||
gPlayerState.field_0x3[0] = 0x81;
|
||||
beh->field_0x5[4] = 2;
|
||||
sub_0806F948(&gPlayerEntity);
|
||||
sub_08077D38(beh, arg1);
|
||||
sub_08077BB8(beh);
|
||||
}
|
||||
|
||||
void sub_08076D34(ItemBehavior* beh, u32 arg1) {
|
||||
if (sub_08077EFC() != 0) {
|
||||
gPlayerState.field_0x3[0] |= 1;
|
||||
UpdateItemAnim(beh);
|
||||
if (beh->field_0x5[9] != 0) {
|
||||
beh->stateID++;
|
||||
beh->field_0xf = 0;
|
||||
gPlayerState.field_0xa &= ~(u8)(8 >> arg1);
|
||||
PlaySFX(0x15d);
|
||||
}
|
||||
} else {
|
||||
gPlayerState.field_0x3[0] = 0;
|
||||
sub_08077E78(beh, arg1);
|
||||
}
|
||||
}
|
||||
|
||||
void sub_08076D94(ItemBehavior *beh, u32 arg1)
|
||||
{
|
||||
if (sub_08077EFC(beh)) {
|
||||
gPlayerState.field_0x3[0] |= 1;
|
||||
UpdateItemAnim(beh);
|
||||
}
|
||||
else {
|
||||
gPlayerState.field_0x3[0] = 0;
|
||||
sub_08077E78(beh, arg1);
|
||||
}
|
||||
}
|
||||
|
||||
void GustJar(ItemBehavior *beh, u32 arg1)
|
||||
{
|
||||
gPlayerState.field_0xa8 = 3;
|
||||
gUnk_0811BDF4[beh->stateID](beh, arg1);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,99 @@
|
||||
#include "global.h"
|
||||
#include "entity.h"
|
||||
#include "player.h"
|
||||
|
||||
extern void DeleteThisEntity();
|
||||
extern void sub_08078CD0(Entity*);
|
||||
extern void sub_08018FA0(Entity*);
|
||||
extern void sub_0801766C(Entity*);
|
||||
extern void sub_08018F6C(Entity*);
|
||||
|
||||
extern void (*const gUnk_080B3DD0[])(Entity*);
|
||||
|
||||
extern BoundingBox gUnk_080B3E18;
|
||||
extern u8 gUnk_080B3DE0[];
|
||||
extern BoundingBox* gUnk_080B3DE8[];
|
||||
|
||||
void Item11(Entity *this)
|
||||
{
|
||||
if (this->currentHealth) {
|
||||
this->hurtBlinkTime = 0;
|
||||
gUnk_080B3DD0[this->action](this);
|
||||
}
|
||||
else {
|
||||
DeleteThisEntity();
|
||||
}
|
||||
}
|
||||
|
||||
void sub_08018CBC(Entity *this)
|
||||
{
|
||||
u32 PVar1;
|
||||
u8 uVar2;
|
||||
Entity *pEVar3;
|
||||
|
||||
*(u32 *)&this->cutsceneBeh = this->x.WORD = gPlayerEntity.x.WORD;
|
||||
*(u32 *)&this->field_0x80 = this->y.WORD = gPlayerEntity.y.WORD;
|
||||
uVar2 = this->animationState = gPlayerEntity.animationState & 0xe;
|
||||
this->direction = (u8)(uVar2 << 2);
|
||||
this->nonPlanarMovement = 0x400;
|
||||
this->damageType = 0x96;
|
||||
this->field_0x3c = (gPlayerEntity.field_0x3c + 1) | 0x80;
|
||||
this->flags2 = gPlayerEntity.flags2;
|
||||
pEVar3 = this->attachedEntity;
|
||||
if (pEVar3 != NULL) {
|
||||
this->action = 1;
|
||||
this->flags = this->flags & 0x7f;
|
||||
this->actionDelay = 0x56;
|
||||
this->field_0x40 = 0x1c;
|
||||
this->field_0x44 = 6;
|
||||
this->boundingBox = &gUnk_080B3E18;
|
||||
this->attachedEntity->spriteOffsetX = 0;
|
||||
this->attachedEntity->spriteSettings.b.draw = 0;
|
||||
}
|
||||
else {
|
||||
if (gPlayerState.field_0x1c == 0) {
|
||||
DeleteThisEntity();
|
||||
}
|
||||
this->action = 2;
|
||||
this->spriteSettings.b.draw = 1;
|
||||
this->spriteIndex = 0xa6;
|
||||
this->palette.raw = 0x33;
|
||||
this->spriteVramOffset = 0;
|
||||
(this->entityType).form = gPlayerState.field_0x1d[0] - 1;
|
||||
this->actionDelay = gUnk_080B3DE0[(this->entityType).form * 2];
|
||||
this->field_0x44 = gUnk_080B3DE0[(this->entityType).form * 2 + 1];
|
||||
this->field_0x40 = 0x1b;
|
||||
this->boundingBox = gUnk_080B3DE8[(this->entityType).form];
|
||||
(u32 *)gPlayerEntity.field_0x70.WORD = this;
|
||||
sub_08078CD0(&gPlayerEntity);
|
||||
(u32 *)gPlayerEntity.field_0x70.WORD = pEVar3;
|
||||
InitializeAnimation(this, (this->entityType).form + 10);
|
||||
sub_08018FA0(this);
|
||||
}
|
||||
sub_0801766C(this);
|
||||
}
|
||||
|
||||
void sub_08018DE8(Entity *this)
|
||||
{
|
||||
u8 bVar1;
|
||||
|
||||
bVar1 = this->attachedEntity->field_0x3a & 4;
|
||||
if (bVar1 == 0) {
|
||||
gPlayerState.field_0x1c = bVar1;
|
||||
DeleteThisEntity();
|
||||
}
|
||||
switch (gPlayerState.field_0x1c) {
|
||||
case 0:
|
||||
sub_08018F6C(this);
|
||||
break;
|
||||
case 5:
|
||||
this->attachedEntity->previousActionFlag = 4;
|
||||
this->flags = this->flags | 0x80;
|
||||
this->action = 2;
|
||||
this->spritePriority.b0 = 2;
|
||||
this->attachedEntity->spriteSettings.b.draw = 1;
|
||||
sub_08018FA0(this);
|
||||
break;
|
||||
}
|
||||
sub_08078CD0(&gPlayerEntity);
|
||||
}
|
||||
+78
-16
@@ -1,27 +1,89 @@
|
||||
#include "global.h"
|
||||
/* called when loading any room */
|
||||
#include "room.h"
|
||||
#include "flags.h"
|
||||
|
||||
void LoadRoomEntityList();
|
||||
s32 CheckGlobalFlag(u32 flag);
|
||||
extern s32* GetCurrentRoomProperty(u8 unk);
|
||||
extern void sub_0804B058(s32* unk);
|
||||
extern void sub_0804B1AC();
|
||||
void LoadRoomEntityList(EntityData* dat);
|
||||
extern EntityData* GetCurrentRoomProperty(u32 unk);
|
||||
extern void sub_0804B058(EntityData* dat);
|
||||
extern void LoadRoomTileEntities(EntityData* dat);
|
||||
extern void sub_0801AC98();
|
||||
extern u32 sub_08049D1C(u32);
|
||||
extern Entity* LoadRoomEntity(EntityData*);
|
||||
extern void* GetRoomProperty(u32, u32, u32);
|
||||
|
||||
void LoadRoom(void)
|
||||
|
||||
{
|
||||
extern u32 gUnk_02017654;
|
||||
extern u32* gUnk_080D50FC;
|
||||
|
||||
void LoadRoom(void) {
|
||||
s32 iVar1;
|
||||
s32* dat;
|
||||
|
||||
GetCurrentRoomProperty(1);
|
||||
LoadRoomEntityList();
|
||||
GetCurrentRoomProperty(0);
|
||||
LoadRoomEntityList();
|
||||
LoadRoomEntityList(GetCurrentRoomProperty(1));
|
||||
LoadRoomEntityList(GetCurrentRoomProperty(0));
|
||||
|
||||
if (CheckGlobalFlag(21)) sub_0804B058(GetCurrentRoomProperty(2));
|
||||
GetCurrentRoomProperty(3);
|
||||
sub_0804B1AC();
|
||||
if (CheckGlobalFlag(TABIDACHI))
|
||||
sub_0804B058(GetCurrentRoomProperty(2));
|
||||
|
||||
LoadRoomTileEntities(GetCurrentRoomProperty(3));
|
||||
sub_0801AC98();
|
||||
}
|
||||
|
||||
void sub_0804B058(EntityData* dat) {
|
||||
Entity* ent;
|
||||
u32 uVar2;
|
||||
|
||||
if ((dat != NULL) && *(u8*)dat != 0xff) {
|
||||
uVar2 = 0;
|
||||
do {
|
||||
if ((uVar2 < 0x20) && ((dat->type) == 3)) {
|
||||
if (sub_08049D1C(uVar2) != 0) {
|
||||
ent = LoadRoomEntity(dat);
|
||||
if ((ent != NULL) && ((ent->entityType).type == 3)) {
|
||||
ent->field_0x6c.HALF.LO = uVar2 | 0x80;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
LoadRoomEntity(dat);
|
||||
}
|
||||
uVar2++;
|
||||
dat++;
|
||||
} while (*(u8*)dat!= 0xff);
|
||||
}
|
||||
}
|
||||
|
||||
void sub_0804B0B0(u32 arg0, u32 arg1) {
|
||||
LoadRoomEntityList(GetRoomProperty(arg0, arg1, 1));
|
||||
}
|
||||
|
||||
void SetCurrentRoomPropertyList(u32 arg0, u32 arg1) {
|
||||
u32** arr;
|
||||
gUnk_02017654 = 0;
|
||||
arr = &gUnk_080D50FC;
|
||||
if (arr[arg0] != 0) {
|
||||
gUnk_02017654 = arr[arg0][arg1];
|
||||
}
|
||||
}
|
||||
|
||||
void sub_0804B0E8(u32 arg0, u32 arg1) {
|
||||
void (*func)();
|
||||
|
||||
func = (void (*)())GetRoomProperty(arg0, arg1, 4);
|
||||
if (func != NULL) {
|
||||
func();
|
||||
}
|
||||
}
|
||||
|
||||
// returns multiple types of data?
|
||||
void* GetRoomProperty(u32 arg0, u32 arg1, u32 arg2) {
|
||||
u32 temp;
|
||||
u32** arr;
|
||||
temp = 0;
|
||||
arr = &gUnk_080D50FC;
|
||||
if (arr[arg0] != NULL) {
|
||||
temp = arr[arg0][arg1];
|
||||
if (temp != 0) {
|
||||
temp = *(u32*)(arg2 * 4 + temp);
|
||||
}
|
||||
}
|
||||
return (void*)temp;
|
||||
}
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
#include "global.h"
|
||||
#include "room.h"
|
||||
|
||||
void extern CreateEntity(EntityData*);
|
||||
void extern LoadRoomEntity(EntityData*);
|
||||
|
||||
void LoadRoomEntityList(EntityData* listPtr) {
|
||||
if (listPtr != NULL) {
|
||||
while (listPtr->entityType != 0xFF) {
|
||||
CreateEntity(listPtr++);
|
||||
while (*(u8*)listPtr != 0xFF) {
|
||||
LoadRoomEntity(listPtr++);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+115
-83
@@ -1,57 +1,30 @@
|
||||
#include "global.h"
|
||||
#include "functions.h"
|
||||
#include "main.h"
|
||||
#include "random.h"
|
||||
#include "readKeyInput.h"
|
||||
|
||||
#ifdef NON_MATCHING
|
||||
|
||||
typedef struct {
|
||||
u8 interruptFlag;
|
||||
u8 field_0x1;
|
||||
u8 loadType;
|
||||
u8 funcIndex;
|
||||
u8 transition;
|
||||
u16 field_0x5;
|
||||
u8 muteAudio;
|
||||
u8 field_0x8;
|
||||
u8 countdown;
|
||||
u8 field_0xa;
|
||||
u8 field_0xb;
|
||||
u16 ticks;
|
||||
u8 field_0xe;
|
||||
u8 field_0xf;
|
||||
} MainStruct;
|
||||
|
||||
extern void sub_08055F70(void);
|
||||
extern void sub_080A3204(void);
|
||||
extern void sub_0805616C(void);
|
||||
extern void sub_0807CE90(void);
|
||||
extern void sub_080560B8(void);
|
||||
extern void sub_08056208(void);
|
||||
extern void sub_0804FFE4(void);
|
||||
extern void sub_0804FF84(u32);
|
||||
extern void sub_08056418(void);
|
||||
extern void sub_080ADD30(void);
|
||||
extern void sub_0801D630(void*, u32);
|
||||
extern void sub_08056010(u32);
|
||||
extern void ReadKeyInput();
|
||||
extern u32 sub_08055FF4();
|
||||
extern void sub_080560A8(void);
|
||||
extern void sub_08056458(void);
|
||||
extern void sub_08050154(void);
|
||||
extern void sub_080A3480(void);
|
||||
extern void sub_08016E78(void);
|
||||
extern void sub_08056260(void);
|
||||
|
||||
extern u8 gUnk_02000014;
|
||||
extern u32 gUnk_020176A0;
|
||||
extern u32 gRand;
|
||||
extern MainStruct gUnk_03001000;
|
||||
extern void (*gUnk_08100CBC[])();
|
||||
extern u16 gPaletteBuffer[];
|
||||
extern void VBlankInterruptWait(void);
|
||||
extern void DisableInterruptsAndDMA(void);
|
||||
extern void sub_0801D66C(void*, u8*, int);
|
||||
extern void sub_08016B34(void);
|
||||
|
||||
static void sub_08055F70(void);
|
||||
static bool32 SoftResetKeysPressed(void);
|
||||
|
||||
static void (*const sScreenHandlers[])(void) = {
|
||||
[SCREEN_INTRO] = HandleIntroScreen,
|
||||
[SCREEN_CHOOSE_FILE] = HandleChooseFileScreen,
|
||||
[SCREEN_GAMEPLAY] = HandleGameplayScreen,
|
||||
[SCREEN_GAME_OVER] = HandleGameOverScreen,
|
||||
[SCREEN_CREDITS] = HandleCreditsScreen,
|
||||
[SCREEN_DEBUG_TEXT] = HandleDebugTextScreen,
|
||||
};
|
||||
|
||||
void MainLoop(void) {
|
||||
bool32 codeInputted;
|
||||
u8 cVar1;
|
||||
u32 uVar2;
|
||||
int var0;
|
||||
|
||||
sub_08055F70();
|
||||
sub_080A3204();
|
||||
@@ -59,52 +32,111 @@ void MainLoop(void) {
|
||||
sub_0807CE90();
|
||||
sub_080560B8();
|
||||
sub_08056208();
|
||||
gUnk_02000014 = 193;
|
||||
gUnk_02000010.field_0x4 = 193;
|
||||
sub_0804FFE4();
|
||||
DmaSet(3, 0x5000000U, &gUnk_020176A0, 0x84000080U);
|
||||
DmaCopy32(3, BG_PLTT, gPaletteBuffer, BG_PLTT_SIZE);
|
||||
sub_0804FF84(1);
|
||||
sub_08056418();
|
||||
sub_080ADD30();
|
||||
gRand = 0x1234567;
|
||||
sub_0801D630(&gUnk_03001000, 16);
|
||||
sub_08056010(0);
|
||||
do {
|
||||
_DmaZero(&gUnk_03001000, sizeof(gUnk_03001000));
|
||||
InitScreen(SCREEN_INTRO);
|
||||
while (1) {
|
||||
ReadKeyInput();
|
||||
codeInputted = sub_08055FF4();
|
||||
if (codeInputted) {
|
||||
sub_080560A8();
|
||||
if (SoftResetKeysPressed()) {
|
||||
DoSoftReset();
|
||||
}
|
||||
if ((gUnk_03001000.field_0x1 == 0) || (gUnk_03001000.field_0x1 != 1)) {
|
||||
if (gUnk_03001000.field_0x8 != '\0') {
|
||||
while (codeInputted) {
|
||||
VBlankInterruptWait();
|
||||
cVar1 = gUnk_03001000.field_0x8 + -1;
|
||||
codeInputted = gUnk_03001000.field_0x8 != '\x01';
|
||||
gUnk_03001000.field_0x8 = cVar1;
|
||||
|
||||
switch (gUnk_03001000.field_0x1) {
|
||||
case 1:
|
||||
sub_08056260();
|
||||
break;
|
||||
case 0:
|
||||
default:
|
||||
if (gUnk_03001000.countdown != 0) {
|
||||
do {
|
||||
VBlankIntrWait();
|
||||
} while (--gUnk_03001000.countdown);
|
||||
}
|
||||
}
|
||||
if (gUnk_03001000.countdown != '\0') {
|
||||
gUnk_03001000.countdown = gUnk_03001000.countdown + -1;
|
||||
uVar2 = gUnk_03001000.field_0xa;
|
||||
while (0 < uVar2) {
|
||||
VBlankIntrWait();
|
||||
uVar2 = uVar2 - 1;
|
||||
|
||||
if (gUnk_03001000.field_0x9 != 0) {
|
||||
gUnk_03001000.field_0x9--;
|
||||
var0 = gUnk_03001000.field_0xa;
|
||||
while (var0-- > 0) {
|
||||
VBlankIntrWait();
|
||||
}
|
||||
}
|
||||
}
|
||||
gUnk_03001000.ticks = gUnk_03001000.ticks + 1;
|
||||
gUnk_08100CBC[gUnk_03001000.loadType]();
|
||||
sub_08056458();
|
||||
sub_08050154();
|
||||
sub_080A3480();
|
||||
} else {
|
||||
sub_08056260();
|
||||
|
||||
gUnk_03001000.ticks++;
|
||||
sScreenHandlers[gUnk_03001000.screen]();
|
||||
sub_08056458();
|
||||
sub_08050154();
|
||||
sub_080A3480();
|
||||
break;
|
||||
}
|
||||
|
||||
sub_08016E78();
|
||||
} while (TRUE);
|
||||
}
|
||||
}
|
||||
#else
|
||||
NAKED
|
||||
void MainLoop(void) {
|
||||
asm(".include \"asm/non_matching/mainLoop.inc\"");
|
||||
|
||||
// Interrupt handlers that are loaded into RAM.
|
||||
extern u8 sub_080B197C[];
|
||||
extern u8 gUnk_030056F0[];
|
||||
extern u8 gUnk_02038560[];
|
||||
extern u8 gUnk_080B2CD8[];
|
||||
extern u8 gUnk_080B2CD8_2[];
|
||||
extern u8 gUnk_080B2CD8_3[];
|
||||
extern u8 gUnk_02000030[];
|
||||
|
||||
static void sub_08055F70(void) {
|
||||
u32 size;
|
||||
|
||||
DisableInterruptsAndDMA();
|
||||
RegisterRamReset(RESET_ALL & ~RESET_EWRAM);
|
||||
*(vu16 *)BG_PLTT = 0x7FFF;
|
||||
REG_WAITCNT = WAITCNT_PREFETCH_ENABLE | WAITCNT_WS0_S_1 | WAITCNT_WS0_N_3;
|
||||
size = 0x3FFD0;
|
||||
_DmaZero(gUnk_02000030, size);
|
||||
size = (u32)gUnk_080B2CD8 - (u32)sub_080B197C;
|
||||
if (size != 0) {
|
||||
sub_0801D66C(sub_080B197C, gUnk_030056F0, size);
|
||||
}
|
||||
|
||||
size = (u32)gUnk_080B2CD8_2 - (u32)gUnk_080B2CD8_3;
|
||||
if (size != 0) {
|
||||
sub_0801D66C(gUnk_080B2CD8_3, gUnk_02038560, size);
|
||||
}
|
||||
|
||||
sub_0801DA90(0);
|
||||
sub_08016B34();
|
||||
}
|
||||
|
||||
#define SOFT_RESET_KEYS (A_BUTTON | B_BUTTON | SELECT_BUTTON | START_BUTTON)
|
||||
|
||||
static bool32 SoftResetKeysPressed(void) {
|
||||
return (gUnk_03000FF0.heldKeys & SOFT_RESET_KEYS) == SOFT_RESET_KEYS;
|
||||
}
|
||||
|
||||
void InitScreen(u32 screen) {
|
||||
gUnk_03001000.screen = screen;
|
||||
gUnk_03001000.funcIndex = 0;
|
||||
gUnk_03001000.transition = 0;
|
||||
}
|
||||
|
||||
void DisableInterruptsAndDMA(void) {
|
||||
REG_IME = 0;
|
||||
REG_IE = 0;
|
||||
REG_DISPSTAT = 0;
|
||||
REG_IF = 0;
|
||||
REG_IME = 0;
|
||||
|
||||
DmaStop(0);
|
||||
DmaStop(1);
|
||||
DmaStop(2);
|
||||
DmaStop(3);
|
||||
}
|
||||
|
||||
void DoSoftReset(void) {
|
||||
DisableInterruptsAndDMA();
|
||||
SoftReset(RESET_ALL & ~(RESET_EWRAM | RESET_SIO_REGS));
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -0,0 +1,64 @@
|
||||
#include "global.h"
|
||||
#include "entity.h"
|
||||
#include "screen.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*);
|
||||
|
||||
extern u8 gUnk_08107C40[];
|
||||
|
||||
void Manager1(Entity *this)
|
||||
{
|
||||
u8 bVar1;
|
||||
u8 *pbVar2;
|
||||
|
||||
gUnk_08107C5C[this->action](this);
|
||||
gUnk_08107C48[((u8*)&this->field_0x20)[1]](this);
|
||||
bVar1 = gUnk_08107C40[((u8*)&this->field_0x20)[1]];
|
||||
if ((bVar1 != 0) && (*(u8 *)&this->field_0x20 != bVar1)) {
|
||||
((u8*)&this->field_0x20)[0] = bVar1;
|
||||
LoadGfxGroup(bVar1);
|
||||
}
|
||||
}
|
||||
|
||||
void sub_080570B8(Entity *this)
|
||||
{
|
||||
u8 *pbVar1;
|
||||
|
||||
LoadGfxGroup(((u8 *)&this->field_0x20)[0]);
|
||||
this->height.WORD = 0;
|
||||
pbVar1 = ((u8 *)&this->field_0x20 + 1);
|
||||
if (*pbVar1 == 3) {
|
||||
gScreen.affine.unk4 = 1;
|
||||
}
|
||||
else {
|
||||
gUnk_08107C48[*pbVar1](this);
|
||||
}
|
||||
}
|
||||
|
||||
void sub_080570F8(void)
|
||||
{
|
||||
gScreen.lcd.displayControl &= 0xf7ff;
|
||||
gScreen.controls.layerFXControl = 0;
|
||||
sub_08056250();
|
||||
}
|
||||
|
||||
void sub_08057118(Entity *this)
|
||||
{
|
||||
this->actionDelay = 0;
|
||||
*(u8 *)&this->field_0x20 = 0;
|
||||
((u8 *)&this->field_0x20)[1] = 0;
|
||||
((u8 *)&this->field_0x20)[2] = 0;
|
||||
this->action = 1;
|
||||
gScreen.affine.bg3Control = 0x1e04;
|
||||
gScreen.lcd.displayControl |= 0x800;
|
||||
gScreen.controls.layerFXControl = 0x3648;
|
||||
gScreen.controls.alphaBlend = 0x1000;
|
||||
sub_08052D74(this, sub_080570B8, sub_080570F8);
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
#include "global.h"
|
||||
#include "entity.h"
|
||||
#include "screen.h"
|
||||
|
||||
extern void sub_080576A0();
|
||||
extern void sub_08052D74();
|
||||
extern void sub_0805754C(Entity*);
|
||||
|
||||
void Manager2(Entity *this)
|
||||
{
|
||||
if (this->action == 0) {
|
||||
this->action = 1;
|
||||
gScreen.affine.unk4 = 0;
|
||||
gScreen.bg.bg2yOffset = 0;
|
||||
sub_08052D74(this, sub_080576A0, 0);
|
||||
}
|
||||
sub_0805754C(this);
|
||||
}
|
||||
@@ -3,16 +3,10 @@
|
||||
#include "flags.h"
|
||||
#include "functions.h"
|
||||
|
||||
typedef struct {
|
||||
u8 filler[0xAC];
|
||||
u16 unk;
|
||||
} struct_030010A0;
|
||||
|
||||
extern u32 sub_0805C920(Entity*);
|
||||
extern void LoadPalettesByPaletteGroupIndex(u32);
|
||||
extern void LoadPaletteGroup(u32);
|
||||
extern void (*const gUnk_08108D10[])(Entity*);
|
||||
|
||||
extern struct_030010A0 gUnk_030010A0;
|
||||
extern u8 gUnk_08108D20[];
|
||||
|
||||
void Manager27(Entity *this)
|
||||
@@ -20,10 +14,10 @@ void Manager27(Entity *this)
|
||||
|
||||
gUnk_08108D10[this->action](this);
|
||||
if (CheckLocalFlagByOffset(0x300, this->entityType.form + 0x67)) {
|
||||
gUnk_030010A0.unk |= (1 << (this->entityType).form);
|
||||
gScreenTransition.field_0xac |= (1 << (this->entityType).form);
|
||||
}
|
||||
else {
|
||||
gUnk_030010A0.unk &= ~(1 << (this->entityType).form);
|
||||
gScreenTransition.field_0xac &= ~(1 << (this->entityType).form);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -64,7 +58,7 @@ void sub_0805C8B4(Entity *this)
|
||||
if (5 < ++this->field_0xf) {
|
||||
this->field_0xf = 0;
|
||||
}
|
||||
LoadPalettesByPaletteGroupIndex(gUnk_08108D20[this->field_0xf]);
|
||||
LoadPaletteGroup(gUnk_08108D20[this->field_0xf]);
|
||||
if (this->field_0xf == 0) {
|
||||
PlaySFX(0x11a);
|
||||
}
|
||||
@@ -0,0 +1,102 @@
|
||||
#include "global.h"
|
||||
#include "manager.h"
|
||||
#include "flags.h"
|
||||
#include "area.h"
|
||||
#include "room.h"
|
||||
#include "player.h"
|
||||
#include "functions.h"
|
||||
|
||||
typedef struct {
|
||||
Manager manager;
|
||||
u32 unk_20;
|
||||
u32 unk_24;
|
||||
u8 unk_28[0xC];
|
||||
u8 unk_34;
|
||||
u8 unk_35;
|
||||
u16 unk_36;
|
||||
u16 unk_38;
|
||||
u16 unk_3a;
|
||||
u16 unk_3c;
|
||||
u16 unk_3e;
|
||||
} Manager3;
|
||||
|
||||
extern s8 gUnk_08107C6C[];
|
||||
extern u32 sub_0806FBFC(u32, u32, u32, u32);
|
||||
extern u32 sub_08057810(void);
|
||||
extern u32 sub_080002C0(u16, u16, u8);
|
||||
extern void sub_080577AC(u32, u32, u32);
|
||||
|
||||
void sub_080576C0(Manager3* this) {
|
||||
s8 tmp;
|
||||
if (this->manager.action == 0) {
|
||||
this->manager.action = 1;
|
||||
this->unk_20 = this->unk_38 + gRoomControls.roomOriginX - 0x20;
|
||||
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 (!CheckGlobalFlag(EZERO_1ST)) {
|
||||
gArea.field_0x18 = 1;
|
||||
gArea.field_0x17 = 5;
|
||||
} else {
|
||||
if ((gPlayerState.flags.all & 0x20) && gPlayerState.jumpStatus == 0) {
|
||||
gArea.field_0x18 = 2;
|
||||
} else {
|
||||
if (sub_08057810()) {
|
||||
gArea.field_0x18 = 3;
|
||||
}
|
||||
}
|
||||
if (sub_080002C0(this->unk_38, this->unk_3a, this->manager.unk_0e) == 0x3d) {
|
||||
sub_080577AC(this->unk_38 + gRoomControls.roomOriginX, this->unk_3a + gRoomControls.roomOriginY, this->manager.unk_0e);
|
||||
if (!this->manager.unk_0f) {
|
||||
this->manager.unk_0f = 1;
|
||||
PlaySFX(0x152);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
} else {
|
||||
this->manager.unk_0f = 0;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void sub_080577AC(u32 baseX, u32 baseY, u32 layer) {
|
||||
u32 r;
|
||||
int offsetX, offsetY;
|
||||
Entity* spark;
|
||||
r = Random();
|
||||
if ((r & 0x7) != 0) return;
|
||||
spark = CreateObject(0xF, 0x26, 0);
|
||||
if (!spark) return;
|
||||
offsetX = (r >> 0x8) & 0xF;
|
||||
offsetY = ((r >> 0x10) & 0xF);
|
||||
if (offsetY > 0x4) {
|
||||
offsetY = -offsetY;
|
||||
}
|
||||
if ((r >> 0x18) & 0x1) {
|
||||
offsetX = -offsetX;
|
||||
}
|
||||
spark->x.HALF.HI = baseX + offsetX;
|
||||
spark->y.HALF.HI = baseY + offsetY;
|
||||
spark->collisionLayer = layer;
|
||||
UpdateSpriteForCollisionLayer(spark);
|
||||
}
|
||||
|
||||
u32 sub_08057810(void) {
|
||||
if ((gPlayerState.flags.all & 0x80)
|
||||
&& !gPlayerState.field_0xaa
|
||||
&& (gArea.field_0x17 != 0x6)
|
||||
&& (gPlayerState.heldObject == 0)) {
|
||||
switch (gPlayerState.field_0xa8) {
|
||||
case 0:
|
||||
case 1:
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
@@ -0,0 +1,132 @@
|
||||
#include "global.h"
|
||||
#include "player.h"
|
||||
#include "room.h"
|
||||
#include "manager.h"
|
||||
#include "structures.h"
|
||||
|
||||
extern void (*gUnk_08107C70[])(Manager*);
|
||||
|
||||
void sub_08057854(Manager* this) {
|
||||
gUnk_08107C70[this->action](this);
|
||||
}
|
||||
|
||||
extern void sub_080805F8(void);
|
||||
|
||||
extern void SetTile(u32, u32, u32);
|
||||
|
||||
extern DiggingCaveEntrance* sub_08057AA8(DiggingCaveEntrance*, int);
|
||||
|
||||
void sub_0805786C(Manager* this) {
|
||||
DiggingCaveEntrance* tmp;
|
||||
u8 roomID;
|
||||
u8 areaID;
|
||||
u16 uVar = 0x81<<7;
|
||||
sub_080805F8();
|
||||
if (gUnk_03004030.unk_08 != 0) {
|
||||
if (gUnk_03004030.unk_00 == 0) {
|
||||
gUnk_03004030.unk_0a = 0xFF;
|
||||
roomID = gRoomControls.roomID;
|
||||
tmp = gUnk_08107DC0[gRoomControls.areaID];
|
||||
tmp = sub_08057AA8(tmp, roomID);
|
||||
if (tmp != 0) {
|
||||
roomID = tmp->target_roomID;
|
||||
tmp = gUnk_08107DC0[tmp->target_areaID];
|
||||
tmp = sub_08057AA8(tmp, roomID);
|
||||
if (tmp != 0) {
|
||||
gUnk_03004030.unk_00 = tmp;
|
||||
}
|
||||
}
|
||||
}
|
||||
roomID = gRoomControls.roomID;
|
||||
tmp = gUnk_08107DC0[gRoomControls.areaID];
|
||||
uVar = 0x81<<7;
|
||||
for (tmp = sub_08057AA8(tmp, roomID); tmp != 0; tmp = sub_08057AA8(tmp, roomID)){
|
||||
SetTile(uVar, tmp->unk_00 + 0x3F, 1);
|
||||
SetTile(uVar, tmp->unk_00 + 0x40, 1);
|
||||
SetTile(uVar, tmp->unk_00 + 0x41, 1);
|
||||
tmp++;
|
||||
}
|
||||
}
|
||||
this->action = 1;
|
||||
}
|
||||
|
||||
extern u32 sub_0805795C(Manager*, DiggingCaveEntrance*);
|
||||
|
||||
void sub_08057920(Manager* this) {
|
||||
DiggingCaveEntrance* tmp;
|
||||
u8 roomID;
|
||||
roomID = gRoomControls.roomID;
|
||||
for (tmp = gUnk_08107DC0[gRoomControls.areaID];(tmp = sub_08057AA8(tmp, roomID)) != 0 && !sub_0805795C(this, tmp);tmp++);
|
||||
}
|
||||
|
||||
void sub_08057A18(Manager*, DiggingCaveEntrance*);
|
||||
|
||||
#ifdef NON_MATCHING
|
||||
u32 sub_0805795C(Manager* this, DiggingCaveEntrance* entr) {
|
||||
u16 offsetX, offsetY, offsetX2, offsetY2;
|
||||
u32 tmp;
|
||||
if (gUnk_03004030.unk_08) {
|
||||
offsetX = gPlayerEntity.x.HALF.HI - gRoomControls.roomOriginX;
|
||||
offsetY = gPlayerEntity.y.HALF.HI - gRoomControls.roomOriginY;
|
||||
offsetX2 = (entr->unk_00 & 0x3F) * 16 + 8;
|
||||
offsetY2 = ((entr->unk_00 & 0xFC0)>> 6) * 16 + 0x18;
|
||||
if ((u32)(offsetX - offsetX2) + 0x18 > 0x30) return 0;
|
||||
if (
|
||||
(u32)(offsetY - offsetY2) + 8 > 0x10) return 0;
|
||||
if (
|
||||
((offsetY < offsetY2)))
|
||||
if (
|
||||
(u32)(offsetX - offsetX2) + 0xC <= 0x18) return 0;
|
||||
|
||||
} else {
|
||||
//offsetX = ((gPlayerEntity.x.HALF.HI - gRoomControls.roomOriginX) >> 4) & 0x3F;
|
||||
//offsetY = ((gPlayerEntity.y.HALF.HI - gRoomControls.roomOriginY) >> 4) & 0x3F;
|
||||
//tmp = offsetX | (offsetY << 6);
|
||||
tmp = COORD_TO_TILE((&gPlayerEntity));
|
||||
if (tmp != entr->unk_00) return 0;
|
||||
offsetY = gRoomControls.roomOriginY + ((tmp>>6) * 16) + 6;
|
||||
if (gPlayerEntity.y.HALF.HI >= offsetY) return 0;
|
||||
}
|
||||
sub_08057A18(this, entr);
|
||||
return 1;
|
||||
}
|
||||
#else
|
||||
NAKED
|
||||
u32 sub_0805795C(Manager* this, DiggingCaveEntrance* entr) {
|
||||
asm(".include \"asm/non_matching/manager4/sub_0805795C.inc\"");
|
||||
}
|
||||
#endif
|
||||
|
||||
extern void sub_0805E5A8(void);
|
||||
extern void DeleteManager(Manager*);
|
||||
extern void sub_08080930();
|
||||
|
||||
void sub_08057A18(Manager* this, DiggingCaveEntrance* entr) {
|
||||
u16 tmp;
|
||||
sub_0805E5A8();
|
||||
gUnk_03004030.unk_0a = gUnk_03004030.unk_09;
|
||||
gUnk_03004030.unk_09 = gRoomControls.areaID;
|
||||
gScreenTransition.areaID = entr->target_areaID;
|
||||
gScreenTransition.roomID = entr->target_roomID;
|
||||
gRoomControls.areaID = entr->target_areaID;
|
||||
gRoomControls.roomID = entr->target_roomID;
|
||||
gUnk_03004030.unk_00 = entr;
|
||||
gUnk_03004030.unk_04 = gPlayerEntity.x.HALF.HI - gRoomControls.roomOriginX - ((entr->unk_00 & 0x3F)*16);
|
||||
gUnk_03004030.unk_06 = gPlayerEntity.y.HALF.HI - gRoomControls.roomOriginY - ((entr->unk_00 & 0xFC0) >> 2);
|
||||
tmp = gUnk_03004030.unk_08;
|
||||
if (!tmp) {
|
||||
if ((entr->target_roomID | 0x80) != gUnk_03004030.unk_0b) {
|
||||
gUnk_02034480.unk_00 = gUnk_03004030.unk_08;
|
||||
}
|
||||
gUnk_03004030.unk_0b = entr->target_roomID | 0x80;
|
||||
}
|
||||
sub_08080930(entr->unk_03);
|
||||
DeleteManager(this);
|
||||
}
|
||||
|
||||
DiggingCaveEntrance* sub_08057AA8(DiggingCaveEntrance* entr, int roomID){
|
||||
for (;entr->unk_00 != 0xFFFF;entr++) {
|
||||
if (entr->source_roomID == roomID) return entr;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
#include "global.h"
|
||||
#include "entity.h"
|
||||
#include "player.h"
|
||||
#include "manager.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;
|
||||
Manager6WarpData* i;
|
||||
if (this->manager.action == 0){
|
||||
this->manager.action = 1;
|
||||
this->warpList = GetCurrentRoomProperty(this->manager.unk_0a);
|
||||
if (!this->warpList) {
|
||||
DeleteManager((Entity*) this);
|
||||
return;
|
||||
}
|
||||
}
|
||||
if (this->manager.unk_0e == 0 || gPlayerState.field_0x10[2] == 0x1e) {
|
||||
for (i = this->warpList; i->posX != 0xFFFF; i++) {
|
||||
tmp = (i->unk_07.all & 0x3);
|
||||
if (((tmp & (gPlayerEntity.collisionLayer)) != 0) &&
|
||||
(((gPlayerState.flags.all & 0x80) != 0) || ((i->unk_07.b.unk2) != 0)) &&
|
||||
(CheckPlayerInRegion(i->posX,i->posY,i->width,i->height) != 0) &&
|
||||
(gPlayerEntity.height.HALF.HI == 0)) {
|
||||
DoExitTransition(GetCurrentRoomProperty(i->unk_06));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,168 @@
|
||||
#include "global.h"
|
||||
#include "entity.h"
|
||||
#include "player.h"
|
||||
#include "manager.h"
|
||||
#include "flags.h"
|
||||
#include "area.h"
|
||||
|
||||
|
||||
extern void (*gUnk_081081F4[])(Manager*);
|
||||
|
||||
void sub_08058380(Manager* this) {
|
||||
gUnk_081081F4[this->action](this);
|
||||
}
|
||||
|
||||
|
||||
|
||||
extern void sub_0805E3A0(Manager*, u32);
|
||||
|
||||
void sub_08058398(ManagerA* this) {
|
||||
|
||||
if (CheckFlags(this->unk_3c) != 0) {
|
||||
DeleteThisEntity();
|
||||
}
|
||||
this->unk_24 = this->unk_3a<<3;
|
||||
this->unk_26 = this->unk_3b<<3;
|
||||
this->unk_20 = this->unk_24 + (this->unk_38<<4);
|
||||
this->unk_22 = this->unk_26 + (this->unk_39<<4);
|
||||
sub_0805E3A0(&this->manager, 0x06);
|
||||
if (this->unk_3e == 0) {
|
||||
this->manager.action = 2;
|
||||
} else {
|
||||
this->manager.action = 1;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void sub_08058408(ManagerA*);
|
||||
|
||||
void sub_080583EC(ManagerA* this) {
|
||||
if (CheckFlags(this->unk_3e) != 0) {
|
||||
this->manager.action = 2;
|
||||
sub_08058408(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*);
|
||||
|
||||
void sub_08058408(ManagerA* this){
|
||||
u32 tmp2;
|
||||
tmp2 = (gPlayerState.flags.all & 0x08);
|
||||
if (tmp2 != 0) return;
|
||||
if (!CheckPlayerInRegion(this->unk_20, this->unk_22, this->unk_24, this->unk_26)) return;
|
||||
switch (this->manager.unk_0a) {
|
||||
case 1:
|
||||
return;
|
||||
case 2:
|
||||
sub_080585DC(this);
|
||||
if ((gPlayerState.flags.all & 0x80) == 0) return;
|
||||
case 0:
|
||||
default:
|
||||
sub_080585DC(this);
|
||||
if (sub_0805848C(this) == 0) return;
|
||||
sub_08078A90(3);
|
||||
sub_08078B48();
|
||||
sub_0805E544();
|
||||
this->manager.action = 3;
|
||||
this->manager.unk_0d = 0;
|
||||
this->manager.unk_0e = 0x1e;
|
||||
return;
|
||||
case 3:
|
||||
this->manager.action = 4;
|
||||
this->manager.unk_0d = tmp2;
|
||||
sub_080186C0(this->unk_36);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
u32 sub_0805848C(ManagerA* this) {
|
||||
switch (gPlayerState.field_0xa8-5) {
|
||||
case 0:
|
||||
case 2:
|
||||
case 3:
|
||||
case 5:
|
||||
case 6:
|
||||
case 7:
|
||||
case 8:
|
||||
case 9:
|
||||
case 10:
|
||||
case 11:
|
||||
case 12:
|
||||
case 13:
|
||||
case 14:
|
||||
case 15:
|
||||
case 16:
|
||||
case 17:
|
||||
case 18:
|
||||
case 19:
|
||||
case 22:
|
||||
case 23:
|
||||
return 0;
|
||||
case 1:
|
||||
case 4:
|
||||
case 20:
|
||||
case 21:
|
||||
default:
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
extern void UnfreezeTime(void);
|
||||
|
||||
void sub_08058514(ManagerA* this) {
|
||||
switch (this->manager.unk_0d) {
|
||||
case 1:
|
||||
if ((gPlayerState.flags.all & 0x1235) != 0)
|
||||
return;
|
||||
if (gPlayerEntity.height.HALF.HI != 0)
|
||||
return;
|
||||
gPlayerState.jumpStatus = 0;
|
||||
sub_08078AA8(this->unk_36, this->unk_35);
|
||||
this->manager.unk_0d++;
|
||||
this->manager.unk_0e = 0x1E;
|
||||
return;
|
||||
case 0:
|
||||
case 2:
|
||||
if (((--this->manager.unk_0e)<<0x18) == 0) {
|
||||
this->manager.unk_0d++;
|
||||
}
|
||||
return;
|
||||
case 3:
|
||||
if (gPlayerEntity.action != 1 && gPlayerEntity.action != 9) return;
|
||||
gPlayerState.field_0x8b = 1;
|
||||
UnfreezeTime();
|
||||
SetFlag(this->unk_3c);
|
||||
DeleteThisEntity();
|
||||
return;
|
||||
default:
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
extern void sub_0801855C(void);
|
||||
|
||||
void sub_080585B0(ManagerA* this) {
|
||||
if (gArea.filler4[0] != 0xFF) {
|
||||
DeleteThisEntity();
|
||||
}
|
||||
if (CheckFlags(this->unk_3c)) {
|
||||
sub_0801855C();
|
||||
DeleteThisEntity();
|
||||
}
|
||||
}
|
||||
void sub_080585DC(ManagerA* this) {
|
||||
if (CheckFlags(this->unk_3c)) {
|
||||
DeleteThisEntity();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,160 @@
|
||||
#include "global.h"
|
||||
#include "manager.h"
|
||||
#include "flags.h"
|
||||
#include "entity.h"
|
||||
#include "room.h"
|
||||
#include "area.h"
|
||||
#include "functions.h"
|
||||
|
||||
extern void (*(gUnk_08108208[]))(Manager*);
|
||||
|
||||
void sub_080585F0(Manager* this) {
|
||||
gUnk_08108208[this->unk_0a](this);
|
||||
}
|
||||
|
||||
extern void (*(gUnk_08108210[]))(Manager*);
|
||||
|
||||
void sub_08058608(Manager* this) {
|
||||
gUnk_08108210[this->action](this);
|
||||
}
|
||||
|
||||
void sub_080586EC(Manager*);
|
||||
|
||||
void sub_08058620(ManagerB* this) {
|
||||
if (!CheckFlags(this->unk_3e)) {
|
||||
this->manager.action = 1;
|
||||
if (!this->unk_3c) {
|
||||
sub_080586EC(&this->manager);
|
||||
}
|
||||
sub_0805E3A0(this, 3);
|
||||
} else {
|
||||
DeleteThisEntity();
|
||||
}
|
||||
}
|
||||
extern void sub_080186C0(u32);
|
||||
|
||||
void sub_08058650(ManagerB* this) {
|
||||
int tmp;
|
||||
if (CheckFlags(this->unk_3c)) {
|
||||
sub_080586EC(&this->manager);
|
||||
if (!this->unk_35) {
|
||||
tmp = gRoomVars.field_0x9 ? gRoomVars.field_0x9 : 0x33;
|
||||
this->unk_20 = gArea.musicIndex;
|
||||
gArea.musicIndex = tmp;
|
||||
PlaySFX(tmp);
|
||||
}
|
||||
sub_080186C0(0xB0F);
|
||||
}
|
||||
}
|
||||
|
||||
extern void sub_0801855C(void);
|
||||
|
||||
void sub_080586A8(ManagerB* this) {
|
||||
if (this->manager.unk_0e) return;
|
||||
SetFlag(this->unk_3e);
|
||||
if (this->unk_3c) {
|
||||
if (!this->unk_35) {
|
||||
gArea.musicIndex = this->unk_20;
|
||||
PlaySFX(gArea.musicIndex);
|
||||
sub_0801855C();
|
||||
}
|
||||
}
|
||||
DeleteThisEntity();
|
||||
}
|
||||
|
||||
ManagerBHelper* sub_08058760(Manager*);
|
||||
void sub_08058798(ManagerBHelper*, Entity*, u32);
|
||||
|
||||
extern EntityData* GetCurrentRoomProperty(u8);
|
||||
extern Entity* LoadRoomEntity(EntityData*);
|
||||
|
||||
void sub_080586EC(Manager* this) {
|
||||
ManagerBHelper* tmp;
|
||||
EntityData* prop;
|
||||
Entity* ent;
|
||||
u32 counter;
|
||||
this->action = 2;
|
||||
this->unk_0e = 0;
|
||||
counter = 0;
|
||||
tmp = sub_08058760(this);
|
||||
if (!tmp) DeleteThisEntity();
|
||||
prop = (EntityData*) GetCurrentRoomProperty(this->unk_0b);
|
||||
if (prop) {
|
||||
while (*((u8*)prop) != 0xFF) {
|
||||
ent = LoadRoomEntity(prop++);
|
||||
if (ent && (ent->entityType.type == 3)) {
|
||||
ent->field_0x6c.HALF.HI |= 0x40;
|
||||
sub_08058798(tmp, ent, counter++);
|
||||
}
|
||||
if (counter >= 7) {
|
||||
counter = 0;
|
||||
tmp = sub_08058760(this);
|
||||
if (!tmp) return;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
ManagerBHelper* sub_08058760(Manager* this) {
|
||||
ManagerBHelper* extra;
|
||||
extra = (ManagerBHelper*) GetEmptyManager();
|
||||
if (extra) {
|
||||
extra->manager.type = 9;
|
||||
extra->manager.subtype = 0xB;
|
||||
extra->manager.unk_0a = 1;
|
||||
extra->manager.parent = this;
|
||||
this->unk_0e++;
|
||||
_DmaZero(&extra->enemies, 0x20);
|
||||
AppendEntityToList(extra, 8);
|
||||
}
|
||||
return extra;
|
||||
}
|
||||
|
||||
void sub_08058798(ManagerBHelper* this, Entity* value, u32 index) {
|
||||
this->enemies[index]=value;
|
||||
this->manager.unk_0e++;
|
||||
}
|
||||
|
||||
void sub_080587AC(ManagerBHelper* this) {
|
||||
u8 i, tmp;
|
||||
Entity* current;
|
||||
if (this->manager.action == 0) {
|
||||
this->manager.action = 1;
|
||||
sub_0805E3A0(this,3);
|
||||
}
|
||||
tmp = 0;
|
||||
for (i = 0; i < 8; i++) {
|
||||
if ((current = this->enemies[i])) {
|
||||
if (!current->next) {
|
||||
this->enemies[i] = 0;
|
||||
} else {
|
||||
tmp = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!tmp) {
|
||||
if (((ManagerB*) this->manager.parent)->manager.unk_0e) {
|
||||
((ManagerB*) this->manager.parent)->manager.unk_0e--;
|
||||
}
|
||||
DeleteThisEntity();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
extern Manager gUnk_03003DB0;
|
||||
|
||||
void sub_08058800(Entity* this, Entity* unk1) {
|
||||
ManagerBHelper* current;
|
||||
Manager* end = &gUnk_03003DB0;
|
||||
u32 i;
|
||||
for (current = (ManagerBHelper*) end->next; (Manager*)current != end; current=(ManagerBHelper*)current->manager.next) {
|
||||
if (current->manager.type != 0x9 || current->manager.subtype != 0xB) continue;
|
||||
for (i = 0; i < 8; i++) {
|
||||
if (this == current->enemies[i]) {
|
||||
current->enemies[i] = unk1;
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,39 @@
|
||||
#include "global.h"
|
||||
#include "entity.h"
|
||||
#include "manager.h"
|
||||
#include "flags.h"
|
||||
#include "room.h"
|
||||
|
||||
extern Entity* GetCurrentRoomProperty(u8);
|
||||
extern void LoadRoomEntityList(Entity*);
|
||||
extern void DeleteThisEntity(void);
|
||||
extern void DeleteManager(Manager*);
|
||||
extern void sub_08078A90(u32);
|
||||
extern void sub_08078B48(void);
|
||||
extern void PlaySFX(u32);
|
||||
|
||||
void sub_08058E60(ManagerE* this) {
|
||||
if (!this->manager.action) {
|
||||
this->manager.action = 1;
|
||||
if (CheckFlags(this->unk_3e)) {
|
||||
DeleteManager(&this->manager);
|
||||
return;
|
||||
}
|
||||
}
|
||||
if (!CheckFlags(this->unk_3e))
|
||||
return;
|
||||
if (this->manager.unk_0b != 0) {
|
||||
this->manager.unk_0b = 0;
|
||||
sub_08078A90(0xff);
|
||||
sub_08078B48();
|
||||
}
|
||||
if (this->unk_3a == 0){
|
||||
if (this->unk_38 != 0) {
|
||||
PlaySFX(this->unk_38);
|
||||
}
|
||||
LoadRoomEntityList(GetCurrentRoomProperty(this->manager.unk_0a));
|
||||
DeleteThisEntity();
|
||||
} else {
|
||||
this->unk_3a -= 1;
|
||||
}
|
||||
}
|
||||
+2
-2
@@ -1,6 +1,6 @@
|
||||
#include "global.h"
|
||||
#include "entity.h"
|
||||
#include "link.h"
|
||||
#include "player.h"
|
||||
|
||||
s32 ModHealth(s32 deltaHealth)
|
||||
|
||||
@@ -15,6 +15,6 @@ s32 ModHealth(s32 deltaHealth)
|
||||
newHealth = (u32)gStats.maxHealth;
|
||||
}
|
||||
gStats.health = newHealth;
|
||||
gLinkEntity.currentHealth = newHealth;
|
||||
gPlayerEntity.currentHealth = newHealth;
|
||||
return newHealth;
|
||||
}
|
||||
|
||||
+1
-1
@@ -1,5 +1,5 @@
|
||||
#include "global.h"
|
||||
#include "link.h"
|
||||
#include "player.h"
|
||||
|
||||
extern u16 gWalletSizes[4];
|
||||
|
||||
|
||||
@@ -0,0 +1,61 @@
|
||||
#include "global.h"
|
||||
#include "entity.h"
|
||||
#include "player.h"
|
||||
#include "room.h"
|
||||
#include "flags.h"
|
||||
#include "sprite.h"
|
||||
#include "textbox.h"
|
||||
#include "npc.h"
|
||||
|
||||
extern void sub_0805E3A0(Entity*, u32);
|
||||
extern void sub_0807DD50(Entity*);
|
||||
extern u32 sub_0806F5A4(u32);
|
||||
extern void sub_0806F118(Entity*);
|
||||
extern void sub_0807DD94(Entity*, u32);
|
||||
extern u32 sub_0801E99C(void);
|
||||
extern void sub_08078784(Entity*, u32);
|
||||
|
||||
void Anju(Entity *this)
|
||||
{
|
||||
switch (this->action) {
|
||||
case 0:
|
||||
this->action = 1;
|
||||
this->spriteSettings.b.draw = 1;
|
||||
this->animationState = this->actionDelay;
|
||||
sub_0807DD50(this);
|
||||
return;
|
||||
case 1:
|
||||
if (this->interactType == 2) {
|
||||
this->action = 2;
|
||||
this->interactType = 0;
|
||||
InitializeAnimation(this,(this->animIndex & -4) + sub_0806F5A4(GetFacingDirection(this, &gPlayerEntity)));
|
||||
sub_0806F118(this);
|
||||
} else {
|
||||
sub_0807DD94(this, 0);
|
||||
}
|
||||
return;
|
||||
case 2:
|
||||
if (UpdateFuseInteraction(this)) {
|
||||
this->action = 1;
|
||||
}
|
||||
default:
|
||||
}
|
||||
}
|
||||
|
||||
void sub_0806C354(Entity *this)
|
||||
{
|
||||
this->field_0x68.HALF.LO = sub_0801E99C();
|
||||
sub_08078784(this, this->field_0x68.HALF.LO);
|
||||
}
|
||||
|
||||
void Anju_Fusion(Entity *this)
|
||||
{
|
||||
if (this->action == 0) {
|
||||
this->action++;
|
||||
this->spriteSettings.b.draw = 1;
|
||||
InitAnimationForceUpdate(this,6);
|
||||
}
|
||||
else {
|
||||
UpdateAnimationSingleFrame(this);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,163 @@
|
||||
#include "global.h"
|
||||
#include "entity.h"
|
||||
#include "functions.h"
|
||||
#include "textbox.h"
|
||||
#include "player.h"
|
||||
#include "room.h"
|
||||
|
||||
typedef struct {
|
||||
u32 unk_00;
|
||||
s8 unk_04;
|
||||
} gUnk_0810C89C_struct;
|
||||
|
||||
extern void sub_08078850(Entity*, u32, s8, gUnk_0810C89C_struct*);
|
||||
|
||||
extern u8 gUnk_0810C88C[];
|
||||
extern BoundingBox gUnk_0810C894;
|
||||
extern gUnk_0810C89C_struct gUnk_0810C89C[];
|
||||
extern SpriteLoadData gUnk_0810C8D4;
|
||||
extern void (*gUnk_0810C8E0[])(Entity*);
|
||||
extern u8 gUnk_0810C8F0[];
|
||||
|
||||
void sub_080632C8(Entity* this);
|
||||
void sub_08063410(Entity* this);
|
||||
s32 sub_080633C8(Entity* this);
|
||||
void sub_0806346C(Entity* this);
|
||||
|
||||
void Beedle(Entity* this) {
|
||||
if (this->flags & 0x2) {
|
||||
sub_08063410(this);
|
||||
} else {
|
||||
sub_080632C8(this);
|
||||
}
|
||||
}
|
||||
|
||||
void sub_080632C8(Entity* this) {
|
||||
gUnk_0810C8E0[this->action](this);
|
||||
}
|
||||
|
||||
void sub_080632E0(Entity* this) {
|
||||
if (LoadExtraSpriteData(this, &gUnk_0810C8D4) != 0) {
|
||||
InitializeAnimation(this, 0);
|
||||
sub_08078778(this);
|
||||
this->spriteSettings.b.draw = 1;
|
||||
this->action = 1;
|
||||
}
|
||||
}
|
||||
|
||||
void sub_08063314(Entity* this) {
|
||||
u32 offset;
|
||||
|
||||
if (((++this->field_0xf & 0xF) == 0) && (offset = sub_080633C8(this), this->animIndex != offset)) {
|
||||
InitializeAnimation(this, offset);
|
||||
}
|
||||
if (this->interactType != '\0') {
|
||||
TextboxNoOverlapFollow(this->actionDelay + 0xA01);
|
||||
this->action++;
|
||||
}
|
||||
sub_0806ED78(this);
|
||||
}
|
||||
|
||||
void sub_0806336C(Entity* this) {
|
||||
if ((gTextBox.doTextBox & 0x7F) == 0) {
|
||||
this->action++;
|
||||
InitializeAnimation(this, 8);
|
||||
}
|
||||
}
|
||||
|
||||
void sub_08063390(Entity* this) {
|
||||
GetNextFrame(this);
|
||||
if (this->frames.b.f3 != 0) {
|
||||
this->action = 1;
|
||||
InitializeAnimation(this, GetAnimationState(this));
|
||||
sub_08078778(this);
|
||||
}
|
||||
sub_0806ED78(this);
|
||||
}
|
||||
|
||||
s32 sub_080633C8(Entity* this) {
|
||||
s32 uVar1;
|
||||
|
||||
uVar1 = sub_0806ED9C(this, 0x20, 0x20);
|
||||
if (uVar1 < 0) {
|
||||
uVar1 = this->animIndex;
|
||||
}
|
||||
return uVar1;
|
||||
}
|
||||
|
||||
void Beedle_Head(Entity* this) {
|
||||
SetExtraSpriteFrame(this, 0, this->frames.all & 0x3F);
|
||||
SetExtraSpriteFrame(this, 1, this->frameIndex);
|
||||
SetSpriteSubEntryOffsetData1(this, 1, 0);
|
||||
sub_0807000C(this);
|
||||
}
|
||||
|
||||
void sub_08063410(Entity* this) {
|
||||
if (this->action == 0) {
|
||||
if (LoadExtraSpriteData(this, &gUnk_0810C8D4) == 0) {
|
||||
return;
|
||||
}
|
||||
this->action++;
|
||||
if (this->entityType.form != 0) {
|
||||
this->boundingBox = &gUnk_0810C894;
|
||||
this->entityType.parameter = 0;
|
||||
}
|
||||
sub_0807DD64(this);
|
||||
sub_08078778(this);
|
||||
}
|
||||
if (this->entityType.form != 0) {
|
||||
sub_0806346C(this);
|
||||
}
|
||||
sub_0807DDAC(this, 0);
|
||||
sub_0807DDE4(this);
|
||||
GetNextFrame(this);
|
||||
}
|
||||
|
||||
void sub_0806346C(Entity* this) {
|
||||
u8 bVar1;
|
||||
s32 iVar2;
|
||||
s32 iVar3;
|
||||
|
||||
iVar3 = (gPlayerEntity.x.HALF.HI - this->x.HALF.HI);
|
||||
iVar2 = (gPlayerEntity.y.HALF.HI - this->y.HALF.HI);
|
||||
|
||||
iVar3 += 0x30;
|
||||
iVar2 += 0x18;
|
||||
if (iVar3 < 0) {
|
||||
iVar3 = 0;
|
||||
}
|
||||
if (iVar3 > 0x50) {
|
||||
iVar3 = 0x50;
|
||||
}
|
||||
if (iVar2 < 0) {
|
||||
iVar2 = 0;
|
||||
}
|
||||
if (iVar2 > 0x40) {
|
||||
iVar2 = 0x40;
|
||||
}
|
||||
|
||||
iVar3 >>= 4;
|
||||
iVar2 >>= 4;
|
||||
|
||||
bVar1 = gUnk_0810C8F0[(gPlayerEntity.animationState >> 1) + iVar3 * 4 + iVar2 * 0x18];
|
||||
if (bVar1 != this->entityType.parameter) {
|
||||
gUnk_0810C89C_struct* temp = &gUnk_0810C89C[bVar1];
|
||||
sub_08078850(this, 1, temp->unk_04, temp);
|
||||
this->entityType.parameter = bVar1;
|
||||
}
|
||||
}
|
||||
|
||||
void sub_080634E4(Entity* this, u32* param_1) {
|
||||
param_1[1] = this->entityType.parameter;
|
||||
}
|
||||
|
||||
void sub_080634EC(Entity* this) {
|
||||
gRoomVars.itemForSaleIndex = gUnk_0810C88C[this->entityType.parameter];
|
||||
}
|
||||
|
||||
void sub_08063504(Entity* this, u32* param_2) {
|
||||
u32 uVar1;
|
||||
|
||||
uVar1 = sub_080544DC(gUnk_0810C88C[this->entityType.parameter]);
|
||||
param_2[5] = (-uVar1 | uVar1) >> 0x1F;
|
||||
}
|
||||
@@ -0,0 +1,69 @@
|
||||
#include "global.h"
|
||||
#include "entity.h"
|
||||
#include "player.h"
|
||||
#include "structures.h"
|
||||
|
||||
extern void (*gUnk_081140D4[])(Entity*);
|
||||
|
||||
extern u16 gUnk_081140CC[];
|
||||
extern void sub_0805E3A0(Entity*, u32);
|
||||
extern void sub_0806D0B0(Entity*);
|
||||
extern void sub_0807DD64(Entity*);
|
||||
extern void sub_0807DDAC(Entity*, u32);
|
||||
extern void sub_0807DDE4(Entity*);
|
||||
extern u32 Random(void);
|
||||
extern void PlaySFX(u32);
|
||||
extern void sub_0806D02C(Entity*);
|
||||
extern Entity* FindEntityInListByForm(u32, u32, u32, u32, u32);
|
||||
|
||||
void BigGoron(Entity* this) {
|
||||
gUnk_081140D4[this->entityType.form](this);
|
||||
}
|
||||
|
||||
void sub_0806CF30(Entity* this) {
|
||||
if (this->action == 0) {
|
||||
this->action = 1;
|
||||
this->previousActionFlag = 1;
|
||||
this->field_0x68.HWORD = this->x.HALF.HI;
|
||||
sub_0805E3A0(this, 2);
|
||||
sub_0806D0B0(this);
|
||||
sub_0807DD64(this);
|
||||
} else {
|
||||
sub_0807DDAC(this, 0);
|
||||
sub_0807DDE4(this);
|
||||
}
|
||||
|
||||
switch (this->previousActionFlag) {
|
||||
case 0:
|
||||
case 1:
|
||||
if (gScreenTransition.frameCount % 4 == 0) {
|
||||
if (gPlayerEntity.x.HALF.HI < this->x.HALF.HI && this->field_0x68.HWORD - 32 < this->x.HALF.HI) {
|
||||
this->x.HALF.HI--;
|
||||
}
|
||||
if (gPlayerEntity.x.HALF.HI > this->x.HALF.HI && this->field_0x68.HWORD + 32 > this->x.HALF.HI) {
|
||||
this->x.HALF.HI++;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 2:
|
||||
if (--this->actionDelay == 0) {
|
||||
u32 uVar2 = Random();
|
||||
PlaySFX(gUnk_081140CC[uVar2 % 4]);
|
||||
this->actionDelay = ((u8)uVar2 & 7) * 16;
|
||||
this->actionDelay += 128;
|
||||
}
|
||||
break;
|
||||
case 3:
|
||||
break;
|
||||
}
|
||||
sub_0806D02C(this);
|
||||
}
|
||||
|
||||
void sub_0806D00C(Entity* this) {
|
||||
Entity* pEVar1;
|
||||
|
||||
pEVar1 = FindEntityInListByForm(7, 76, 7, 0, 0);
|
||||
if (pEVar1 != NULL) {
|
||||
this->parent = pEVar1;
|
||||
}
|
||||
}
|
||||
@@ -2,29 +2,17 @@
|
||||
#include "entity.h"
|
||||
#include "functions.h"
|
||||
#include "flags.h"
|
||||
#include "link.h"
|
||||
#include "player.h"
|
||||
#include "room.h"
|
||||
#include "textbox.h"
|
||||
|
||||
typedef struct {
|
||||
/*0x00*/ u8 filler[0x2C];
|
||||
/*0x2C*/ u8 unk;
|
||||
} struct_030010A0;
|
||||
|
||||
typedef struct {
|
||||
u8 filler[0xa8];
|
||||
Stats stats;
|
||||
} struct_02002A40;
|
||||
|
||||
|
||||
extern void (*gUnk_081115C0[])(Entity*);
|
||||
extern void (*gUnk_081115D0[])(Entity*);
|
||||
|
||||
extern struct_030010A0 gUnk_030010A0;
|
||||
extern u16 gUnk_081115DC[];
|
||||
extern u8 gUnk_08111618[];
|
||||
extern u32* gUnk_081115EC[];
|
||||
extern struct_02002A40 gUnk_02002A40;
|
||||
extern u8 gUnk_08111623[];
|
||||
extern u8 gUnk_0811162B[];
|
||||
extern u16 gUnk_08111664[];
|
||||
@@ -60,7 +48,7 @@ void sub_08068A1C(Entity* this) {
|
||||
int offset;
|
||||
|
||||
(this->entityType).parameter = (this->entityType).form;
|
||||
if (gUnk_030010A0.unk != 0) {
|
||||
if (gScreenTransition.field_0x24[8] != 0) {
|
||||
offset = 6;
|
||||
bVar1 = 3;
|
||||
|
||||
@@ -114,7 +102,7 @@ void sub_08068AA4(Entity* this) {
|
||||
}
|
||||
|
||||
void sub_08068ADC(Entity* this) {
|
||||
if (gUnk_030010A0.unk == 2) {
|
||||
if (gScreenTransition.field_0x24[8] == 2) {
|
||||
GetNextFrame(this);
|
||||
}
|
||||
sub_0806FD3C(this);
|
||||
@@ -122,9 +110,9 @@ void sub_08068ADC(Entity* this) {
|
||||
|
||||
void sub_08068AFC(Entity* this) {
|
||||
this->action = 1;
|
||||
this->spriteSettings.b.ss0 = 1;
|
||||
*(u8*)&this->field_0x68 = sub_0801E99C(this);
|
||||
sub_08078784(this, *(u8*)&this->field_0x68);
|
||||
this->spriteSettings.b.draw = 1;
|
||||
this->field_0x68.HALF.LO = sub_0801E99C(this);
|
||||
sub_08078784(this, this->field_0x68.HALF.LO);
|
||||
sub_0807DD50(this);
|
||||
}
|
||||
|
||||
@@ -134,7 +122,7 @@ void FUN_08068b2c(Entity* this) {
|
||||
if (this->interactType == '\x02') {
|
||||
this->action = 2;
|
||||
this->interactType = '\0';
|
||||
uVar1 = sub_0806F5A4(sub_080045C4(this, &gLinkEntity));
|
||||
uVar1 = sub_0806F5A4(GetFacingDirection(this, &gPlayerEntity));
|
||||
InitAnimationForceUpdate(this, uVar1);
|
||||
sub_0806F118(this);
|
||||
} else {
|
||||
@@ -161,14 +149,14 @@ void sub_08068B84(Entity* this) {
|
||||
void sub_08068BB4(Entity* this) {
|
||||
u32 item = gUnk_02002A40.stats.itemOnA;
|
||||
|
||||
this->field_0x69 = item;
|
||||
this->field_0x68.HALF.HI = item;
|
||||
item = gUnk_02002A40.stats.itemOnB;
|
||||
*(&this->field_0x69 + 1) = item;
|
||||
*(&this->field_0x68.HALF.HI + 1) = item;
|
||||
}
|
||||
|
||||
void sub_08068BD0(Entity* this) {
|
||||
ForceEquipItem(this->field_0x69, 0);
|
||||
ForceEquipItem(*(u8*)(&this->field_0x69 + 1), 1);
|
||||
ForceEquipItem(this->field_0x68.HALF.HI, 0);
|
||||
ForceEquipItem(*(u8*)(&this->field_0x68.HALF.HI + 1), 1);
|
||||
}
|
||||
|
||||
void sub_08068BEC(Entity* this, u32 unused) {
|
||||
@@ -176,7 +164,7 @@ void sub_08068BEC(Entity* this, u32 unused) {
|
||||
|
||||
target = CreateFx(this, 0x44, 0);
|
||||
if (target) {
|
||||
target->ticks.b0 = 1;
|
||||
target->spritePriority.b0 = 1;
|
||||
PositionRelative(this, target, 0, -0x100000);
|
||||
PlaySFX(0xfa);
|
||||
}
|
||||
@@ -357,16 +345,16 @@ void sub_08068E78(Entity* this) {
|
||||
}
|
||||
|
||||
void sub_08068E90(Entity* this) {
|
||||
LinkState* s = &gLinkState;
|
||||
*(u16*)&s->unk8 = (1 << (gUnk_08111740[this->actionDelay] - 1)) | *(u16*)&s->unk8;
|
||||
PlayerState* s = &gPlayerState;
|
||||
*(u16*)&s->field_0xac = (1 << (gUnk_08111740[this->actionDelay] - 1)) | *(u16*)&s->field_0xac;
|
||||
}
|
||||
|
||||
void sub_08068EB4(void) {
|
||||
gLinkState.unk71 = 0;
|
||||
gPlayerState.field_0xab = 0;
|
||||
}
|
||||
|
||||
void sub_08068EC4(Entity* param_1, Entity* param_2) {
|
||||
if (gUnk_08111740[param_1->actionDelay] == gLinkState.unk71) {
|
||||
if (gUnk_08111740[param_1->actionDelay] == gPlayerState.field_0xab) {
|
||||
*(u16*)¶m_2->flags = gUnk_0811172A[param_1->actionDelay];
|
||||
*(u32*)¶m_2->animationState = 1;
|
||||
} else {
|
||||
@@ -400,8 +388,8 @@ void BladeBrothers_Fusion(Entity* this) {
|
||||
|
||||
if (this->action == 0) {
|
||||
this->action += 1;
|
||||
this->spriteSettings.b.ss0 = 0;
|
||||
this->spriteSettings.b.ss0 = 1;
|
||||
this->spriteSettings.b.draw = 0;
|
||||
this->spriteSettings.b.draw = 1;
|
||||
InitAnimationForceUpdate(this, 4);
|
||||
} else {
|
||||
UpdateAnimationSingleFrame(this);
|
||||
@@ -0,0 +1,35 @@
|
||||
#include "global.h"
|
||||
#include "entity.h"
|
||||
#include "player.h"
|
||||
#include "room.h"
|
||||
#include "flags.h"
|
||||
#include "sprite.h"
|
||||
#include "textbox.h"
|
||||
#include "npc.h"
|
||||
#include "structures.h"
|
||||
|
||||
extern void sub_0807DD50(Entity *);
|
||||
extern void sub_0807DD94(Entity *,u32);
|
||||
extern void sub_08004488(u32);
|
||||
extern void sub_08080964(u32,u32);
|
||||
|
||||
|
||||
void Carlov(Entity *this)
|
||||
{
|
||||
if (this->action == 0) {
|
||||
this->action++;
|
||||
sub_0807DD50(this);
|
||||
}
|
||||
else {
|
||||
sub_0807DD94(this,0);
|
||||
}
|
||||
if ((this->frames.all & 0x10) != 0) {
|
||||
this->frames.all = this->frames.all & 0xef;
|
||||
sub_08004488(0x104);
|
||||
sub_08080964(0x10,0);
|
||||
}
|
||||
if ((this->frames.all & 0x20) != 0) {
|
||||
this->frames.all = this->frames.all & 0xdf;
|
||||
sub_08004488(0x7c);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,74 @@
|
||||
#include "global.h"
|
||||
#include "entity.h"
|
||||
#include "sprite.h"
|
||||
#include "player.h"
|
||||
|
||||
extern void DeleteThisEntity();
|
||||
extern u32 LoadExtraSpriteData(Entity*, SpriteLoadData*);
|
||||
extern SpriteLoadData gUnk_08110CA8[];
|
||||
extern void sub_0805E3A0(Entity*, u32);
|
||||
extern void sub_0807DD64(Entity*);
|
||||
extern u32 GetFacingDirection(Entity*, Entity*);
|
||||
extern void sub_0806F118(Entity*);
|
||||
extern void sub_0807DDAC(Entity*, u32);
|
||||
extern void sub_0807DDE4(Entity*);
|
||||
extern u32 UpdateFuseInteraction(Entity*);
|
||||
extern void SetSpriteSubEntryOffsetData2(Entity*, u32, u32);
|
||||
extern void sub_0807000C(Entity*);
|
||||
extern u32 sub_0806F5A4();
|
||||
|
||||
void Carpenter(Entity* this) {
|
||||
if (*(u32*)&this->cutsceneBeh == 0) {
|
||||
DeleteThisEntity();
|
||||
}
|
||||
switch (this->action) {
|
||||
case 0:
|
||||
if (!LoadExtraSpriteData(this, gUnk_08110CA8 + this->entityType.form * 4))
|
||||
break;
|
||||
this->action = 1;
|
||||
this->field_0x68.HALF.HI = 0;
|
||||
sub_0805E3A0(this, 2);
|
||||
sub_0807DD64(this);
|
||||
|
||||
case 1:
|
||||
if (this->interactType == 2) {
|
||||
this->action = 2;
|
||||
this->interactType = 0;
|
||||
this->field_0x68.HALF.HI = this->animIndex;
|
||||
InitializeAnimation(this, sub_0806F5A4(GetFacingDirection(this, &gPlayerEntity)) + 4 + (this->entityType.form * 8));
|
||||
sub_0806F118(this);
|
||||
} else {
|
||||
sub_0807DDAC(this, 0);
|
||||
sub_0807DDE4(this);
|
||||
GetNextFrame(this);
|
||||
}
|
||||
break;
|
||||
case 2:
|
||||
if (!UpdateFuseInteraction(this))
|
||||
break;
|
||||
this->action = 1;
|
||||
InitializeAnimation(this, this->field_0x68.HALF.HI);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void Carpenter_Head(Entity* this) {
|
||||
if ((this->entityType).form < 2) {
|
||||
SetExtraSpriteFrame(this, 0, this->frames.all & 0xffffff7f);
|
||||
SetExtraSpriteFrame(this, 1, this->frameIndex);
|
||||
SetExtraSpriteFrame(this, 2, this->frameSpriteSettings & 0x3f);
|
||||
SetSpriteSubEntryOffsetData1(this, 1, 0);
|
||||
SetSpriteSubEntryOffsetData2(this, 1, 2);
|
||||
sub_0807000C(this);
|
||||
} else {
|
||||
SetExtraSpriteFrame(this, 0, this->frames.all & 0xffffff7f);
|
||||
SetExtraSpriteFrame(this, 1, this->frameIndex);
|
||||
SetSpriteSubEntryOffsetData1(this, 1, 0);
|
||||
sub_0807000C(this);
|
||||
}
|
||||
}
|
||||
|
||||
void sub_080672b0(Entity *this, u32 param_2)
|
||||
{
|
||||
InitializeAnimation(this,*(u32 *)(param_2 + 4) + (this->animationState >> 1) + this->entityType.form * 8);
|
||||
}
|
||||
+13
-13
@@ -1,6 +1,6 @@
|
||||
#include "global.h"
|
||||
#include "entity.h"
|
||||
#include "link.h"
|
||||
#include "player.h"
|
||||
|
||||
extern void sub_0806ED78(Entity*);
|
||||
extern void sub_0806920C(Entity*);
|
||||
@@ -19,7 +19,7 @@ extern u32 gUnk_08111938[];
|
||||
extern void PlaySFX(u32);
|
||||
extern u32 Random();
|
||||
extern u32 UpdateFuseInteraction(Entity*);
|
||||
extern LinkState gLinkState;
|
||||
extern PlayerState gPlayerState;
|
||||
|
||||
void Cow(Entity* ent) {
|
||||
gUnk_08111914[ent->action](ent);
|
||||
@@ -34,7 +34,7 @@ void sub_08068FC0(Entity* ent) {
|
||||
ent->animationState = ent->entityType.parameter;
|
||||
ent->nonPlanarMovement = 0x40;
|
||||
|
||||
ent->field_0x6d = 0xFF;
|
||||
ent->field_0x6c.HALF.HI = 0xFF;
|
||||
|
||||
r2 = sub_0805ACC0(ent);
|
||||
if (r2 == 0) {
|
||||
@@ -51,7 +51,7 @@ void sub_08068FC0(Entity* ent) {
|
||||
*(u16*)&ent->field_0x68 = var1;
|
||||
ent->field_0x6a.HWORD = r2;
|
||||
}
|
||||
ent->field_0x6c = sub_0801E99C(ent);
|
||||
ent->field_0x6c.HALF.LO = sub_0801E99C(ent);
|
||||
|
||||
InitAnimationForceUpdate(ent, ent->animationState + 4);
|
||||
}
|
||||
@@ -183,7 +183,7 @@ void sub_080691E0(Entity* ent) {
|
||||
}
|
||||
|
||||
// Show dialogue
|
||||
void sub_080691F8(Entity* ent) {
|
||||
void Cow_ShowDialogue(Entity* ent) {
|
||||
u32 var0 = ent->entityType.form;
|
||||
u32* var1 = gUnk_08111938 + (var0 * 2);
|
||||
ShowNPCDialogue(ent, var1);
|
||||
@@ -191,18 +191,18 @@ void sub_080691F8(Entity* ent) {
|
||||
|
||||
void sub_0806920C(Entity* ent) {
|
||||
// TODO: figure out what bitfield flag this is
|
||||
u32 var0 = gLinkState.flags.all & 0x80;
|
||||
u32 var0 = gPlayerState.flags.all & 0x80;
|
||||
u32 var1 = -var0 >> 0x1F;
|
||||
|
||||
if (var1 != ent->field_0x6d) {
|
||||
if (var1 != ent->field_0x6c.HALF.HI) {
|
||||
if (var1 == 0) {
|
||||
sub_08078778(ent);
|
||||
} else {
|
||||
sub_080787A8(ent, ent->field_0x6c);
|
||||
sub_080787A8(ent, ent->field_0x6c.HALF.LO);
|
||||
}
|
||||
}
|
||||
|
||||
ent->field_0x6d = var1;
|
||||
ent->field_0x6c.HALF.HI = var1;
|
||||
}
|
||||
|
||||
// Check if player interacting
|
||||
@@ -210,15 +210,15 @@ void sub_0806924C(Entity* ent) {
|
||||
s8 itype = ent->interactType;
|
||||
if (itype != 0) {
|
||||
// TODO: figure out what bitfield flag this is
|
||||
if ((gLinkState.flags.all & 0x80) != 0) {
|
||||
if ((gPlayerState.flags.all & 0x80) != 0) {
|
||||
if (itype == 2) {
|
||||
ent->action = 4;
|
||||
sub_0806F118(ent);
|
||||
} else {
|
||||
sub_080691F8(ent);
|
||||
Cow_ShowDialogue(ent);
|
||||
}
|
||||
} else {
|
||||
sub_080691F8(ent);
|
||||
Cow_ShowDialogue(ent);
|
||||
sub_080791D0();
|
||||
}
|
||||
PlaySFX(212);
|
||||
@@ -229,7 +229,7 @@ void sub_0806924C(Entity* ent) {
|
||||
void Cow_Fusion(Entity* ent) {
|
||||
if (ent->action == 0) {
|
||||
ent->action++;
|
||||
ent->spriteSettings.b.ss0 = 1;
|
||||
ent->spriteSettings.b.draw = 1;
|
||||
InitAnimationForceUpdate(ent, 15);
|
||||
} else {
|
||||
UpdateAnimationSingleFrame(ent);
|
||||
@@ -1,6 +1,6 @@
|
||||
#include "global.h"
|
||||
#include "entity.h"
|
||||
#include "link.h"
|
||||
#include "player.h"
|
||||
#include "room.h"
|
||||
#include "flags.h"
|
||||
#include "sprite.h"
|
||||
@@ -9,8 +9,7 @@
|
||||
|
||||
extern void sub_0805E3A0(Entity*, u32);
|
||||
extern void sub_0807DD50(Entity*);
|
||||
extern void sub_080045C4(Entity*, Entity*);
|
||||
extern u32 sub_0806F5A4(void);
|
||||
extern u32 sub_0806F5A4(u32);
|
||||
extern void sub_0806F118(Entity*);
|
||||
extern void sub_0807DD94(Entity*, u32);
|
||||
extern u32 sub_0801E99C(void);
|
||||
@@ -29,7 +28,7 @@ void Dampe(Entity* this) {
|
||||
switch (this->action) {
|
||||
case 0:
|
||||
this->action = 1;
|
||||
this->spriteSettings.b.ss0 = 1;
|
||||
this->spriteSettings.b.draw = 1;
|
||||
sub_0805E3A0(this, 2);
|
||||
sub_0807DD50(this);
|
||||
return;
|
||||
@@ -37,8 +36,7 @@ void Dampe(Entity* this) {
|
||||
if (this->interactType == 2) {
|
||||
this->action = 2;
|
||||
this->interactType = 0;
|
||||
sub_080045C4(this, &gLinkEntity);
|
||||
InitAnimationForceUpdate(this, sub_0806F5A4() + 4);
|
||||
InitAnimationForceUpdate(this, sub_0806F5A4(GetFacingDirection(this, &gPlayerEntity)) + 4);
|
||||
sub_0806F118(this);
|
||||
} else {
|
||||
sub_0807DD94(this, 0);
|
||||
@@ -54,14 +52,14 @@ void Dampe(Entity* this) {
|
||||
}
|
||||
|
||||
void sub_0806BE3C(Entity* this) {
|
||||
this->field_0x68 = sub_0801E99C();
|
||||
sub_08078784(this, this->field_0x68);
|
||||
this->field_0x68.HALF.LO = sub_0801E99C();
|
||||
sub_08078784(this, this->field_0x68.HALF.LO);
|
||||
}
|
||||
|
||||
void Dampe_Fusion(Entity* this) {
|
||||
if (this->action == 0) {
|
||||
this->action++;
|
||||
this->spriteSettings.b.ss0 = 1;
|
||||
this->spriteSettings.b.draw = 1;
|
||||
InitAnimationForceUpdate(this, 2);
|
||||
} else {
|
||||
UpdateAnimationSingleFrame(this);
|
||||
@@ -1,7 +1,7 @@
|
||||
#include "global.h"
|
||||
#include "entity.h"
|
||||
#include "textbox.h"
|
||||
#include "link.h"
|
||||
#include "player.h"
|
||||
#include "functions.h"
|
||||
|
||||
void sub_08065A64(Entity* this);
|
||||
@@ -18,10 +18,10 @@ void Epona(Entity* this) {
|
||||
|
||||
void sub_080659B8(Entity* this) {
|
||||
this->action = 1;
|
||||
this->spriteSettings.b.ss0 = 1;
|
||||
this->spriteSettings.b.draw = 1;
|
||||
this->animationState = 6;
|
||||
this->field_0x69 = -1;
|
||||
this->field_0x68 = sub_0801E99C(this);
|
||||
this->field_0x68.HALF.HI = -1;
|
||||
this->field_0x68.HALF.LO = sub_0801E99C(this);
|
||||
InitAnimationForceUpdate(this, this->animationState / 2);
|
||||
}
|
||||
|
||||
@@ -56,20 +56,20 @@ void sub_08065A50(Entity* this) {
|
||||
void sub_08065A64(Entity* this) {
|
||||
u32 uVar2;
|
||||
|
||||
uVar2 = -(gLinkState.flags.all & 0x80) >> 0x1f;
|
||||
if (uVar2 != this->field_0x69) {
|
||||
uVar2 = -(gPlayerState.flags.all & 0x80) >> 0x1f;
|
||||
if (uVar2 != this->field_0x68.HALF.HI) {
|
||||
if (uVar2 == 0) {
|
||||
sub_08078778(this);
|
||||
} else {
|
||||
sub_080787A8(this, this->field_0x68);
|
||||
sub_080787A8(this, this->field_0x68.HALF.LO);
|
||||
}
|
||||
}
|
||||
this->field_0x69 = uVar2;
|
||||
this->field_0x68.HALF.HI = uVar2;
|
||||
}
|
||||
|
||||
void sub_08065AA4(Entity* this) {
|
||||
if (this->interactType != 0) {
|
||||
if (gLinkState.flags.all & 0x80) {
|
||||
if (gPlayerState.flags.all & 0x80) {
|
||||
if (this->interactType == 2) {
|
||||
this->action = 4;
|
||||
sub_0806F118(this);
|
||||
@@ -78,7 +78,7 @@ void sub_08065AA4(Entity* this) {
|
||||
sub_0805E3A0(this, 2);
|
||||
sub_08065A50(this);
|
||||
}
|
||||
InitAnimationForceUpdate(this, sub_0806F5A4(sub_080045C4(this, &gLinkEntity)));
|
||||
InitAnimationForceUpdate(this, sub_0806F5A4(GetFacingDirection(this, &gPlayerEntity)));
|
||||
} else {
|
||||
sub_08065A50(this);
|
||||
sub_080791D0();
|
||||
@@ -91,7 +91,7 @@ void sub_08065AA4(Entity* this) {
|
||||
void Epona_Fusion(Entity* this) {
|
||||
if (this->action == 0) {
|
||||
this->action += 1;
|
||||
this->spriteSettings.b.ss0 = 1;
|
||||
this->spriteSettings.b.draw = 1;
|
||||
InitAnimationForceUpdate(this, 7);
|
||||
} else {
|
||||
UpdateAnimationSingleFrame(this);
|
||||
@@ -0,0 +1,86 @@
|
||||
#include "global.h"
|
||||
#include "entity.h"
|
||||
#include "functions.h"
|
||||
#include "npc.h"
|
||||
#include "player.h"
|
||||
|
||||
extern u32 sub_0801E99C(Entity*);
|
||||
extern void sub_08078784(Entity*, u32);
|
||||
extern void sub_0807DD50(Entity*);
|
||||
extern void sub_0806F118(Entity*);
|
||||
extern void ExecuteScriptCommandSet(Entity*, void *);
|
||||
extern void sub_0805FF2C(Entity*, void*);
|
||||
extern void sub_0806ED78(Entity*);
|
||||
|
||||
extern void (*const gUnk_08109BBC[])(Entity*);
|
||||
|
||||
|
||||
void Festari(Entity *this)
|
||||
{
|
||||
gUnk_08109BBC[this->action](this);
|
||||
}
|
||||
|
||||
void sub_0805FE10(Entity *this)
|
||||
{
|
||||
this->action = 1;
|
||||
this->spriteSettings.b.draw = TRUE;
|
||||
sub_0805E3A0(this, 2);
|
||||
this->field_0x68.HALF.LO = sub_0801E99C(this);
|
||||
sub_08078784(this, this->field_0x68.HALF.LO);
|
||||
sub_0807DD50(this);
|
||||
}
|
||||
|
||||
void sub_0805FE48(Entity *this)
|
||||
{
|
||||
u8 bVar1;
|
||||
u16 uVar2;
|
||||
u32 uVar3;
|
||||
u32 uVar4;
|
||||
|
||||
if (this->interactType == 2) {
|
||||
this->action = 2;
|
||||
this->interactType = 0;
|
||||
InitAnimationForceUpdate(this, sub_0806F5A4(GetFacingDirection(this, &gPlayerEntity)));
|
||||
sub_0806F118(this);
|
||||
}
|
||||
else {
|
||||
ExecuteScriptCommandSet(this, *(void **)&this->cutsceneBeh);
|
||||
sub_0805FF2C(this, *(void **)&this->cutsceneBeh);
|
||||
uVar4 = this->field_0x80.HWORD;
|
||||
if (uVar4 < 8) {
|
||||
if ((this->field_0x82.HWORD & 1) != 0) {
|
||||
uVar4 = (uVar4 & 0xfc) + (this->field_0xf >> 1);
|
||||
}
|
||||
else {
|
||||
uVar4 = (uVar4 & 0xfc) + (this->animationState >> 1);
|
||||
this->field_0xf = this->animationState;
|
||||
}
|
||||
}
|
||||
if (uVar4 != this->animIndex) {
|
||||
InitAnimationForceUpdate(this, uVar4);
|
||||
}
|
||||
UpdateAnimationSingleFrame(this);
|
||||
|
||||
if (this->frames.b.f3)
|
||||
{
|
||||
switch (this->animIndex) {
|
||||
case 8:
|
||||
case 10:
|
||||
case 11:
|
||||
case 12:
|
||||
this->field_0x80.HWORD = 0;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if ((this->field_0x82.HWORD & (~this->field_0x82.HWORD + 1)) == 2) {
|
||||
sub_0806ED78(this);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void sub_0805FF18(Entity *this)
|
||||
{
|
||||
if (UpdateFuseInteraction(this)) {
|
||||
this->action = 1;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,305 @@
|
||||
#include "global.h"
|
||||
#include "entity.h"
|
||||
#include "npc.h"
|
||||
#include "flags.h"
|
||||
#include "textbox.h"
|
||||
#include "player.h"
|
||||
#include "structures.h"
|
||||
|
||||
extern void sub_0805E3A0(Entity*, u32);
|
||||
extern void StartCutscene(Entity*, void*);
|
||||
extern void sub_0807DD50(Entity*);
|
||||
extern void sub_0806F118(Entity*);
|
||||
extern void sub_0807DDAC(Entity*, u32);
|
||||
extern void sub_0807DDE4(Entity*);
|
||||
extern void sub_080600F0(Entity*);
|
||||
extern u32 sub_0801E99C(Entity*);
|
||||
extern void sub_08078784(Entity*, u32);
|
||||
extern void sub_0807000C(Entity*);
|
||||
extern void sub_080042BA(Entity*, u32);
|
||||
extern void sub_08060158(Entity*);
|
||||
extern u32 CheckKinstoneFused(u32);
|
||||
extern Entity* FindEntityInListBySubtype(u32, u32, u32);
|
||||
extern void sub_080A29BC(Entity* parent);
|
||||
extern void DeleteEntity(Entity*);
|
||||
extern u32 Random(void);
|
||||
extern void ModBombs(s32);
|
||||
|
||||
extern SpriteLoadData gUnk_0810A348;
|
||||
extern void* gUnk_08109D18[];
|
||||
extern u8 gUnk_08109C98[];
|
||||
extern u16 gUnk_0810A354[];
|
||||
extern u32 gUnk_08109DC8[];
|
||||
extern u16 gUnk_0810A35A[];
|
||||
extern u16 gUnk_0810A362[];
|
||||
|
||||
void ForestMinish(Entity* this) {
|
||||
switch (this->action) {
|
||||
case 0:
|
||||
if (LoadExtraSpriteData(this, &gUnk_0810A348)) {
|
||||
this->action = 1;
|
||||
this->spriteSettings.b.draw = TRUE;
|
||||
this->field_0x68.HALF.HI = this->animationState = this->actionDelay << 1;
|
||||
this->actionDelay = 0;
|
||||
sub_0805E3A0(this, 2);
|
||||
StartCutscene(this, gUnk_08109D18[this->entityType.parameter]);
|
||||
sub_0807DD50(this);
|
||||
}
|
||||
break;
|
||||
case 1:
|
||||
if (this->interactType == 2) {
|
||||
this->action = 2;
|
||||
this->interactType = 0;
|
||||
sub_0806F118(this);
|
||||
} else {
|
||||
sub_0807DDAC(this, 0);
|
||||
sub_0807DDE4(this);
|
||||
if (this->frameDuration != 0xf0) {
|
||||
sub_080600F0(this);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 2:
|
||||
if (UpdateFuseInteraction(this)) {
|
||||
this->action = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void sub_08060090(Entity* this) {
|
||||
this->field_0x68.HALF.LO = sub_0801E99C(this);
|
||||
sub_08078784(this, this->field_0x68.HALF.LO);
|
||||
}
|
||||
|
||||
void ForestMinish_Head(Entity* this) {
|
||||
u32 pbVar1;
|
||||
|
||||
pbVar1 = this->frames.all;
|
||||
if (this->frames.all != 0xff) {
|
||||
pbVar1 &= -0x81;
|
||||
}
|
||||
if ((this->frameSpriteSettings & 1) == 0) {
|
||||
pbVar1 = 0xff;
|
||||
}
|
||||
SetExtraSpriteFrame(this, 0, pbVar1);
|
||||
SetExtraSpriteFrame(this, 1, this->frameIndex);
|
||||
SetSpriteSubEntryOffsetData1(this, 1, 0);
|
||||
sub_0807000C(this);
|
||||
}
|
||||
|
||||
void sub_080600F0(Entity* this) {
|
||||
u32 uVar1;
|
||||
u32 uVar2;
|
||||
|
||||
uVar2 = this->field_0x80.HWORD;
|
||||
if (this->field_0x80.HWORD < 8) {
|
||||
if ((this->field_0x82.HWORD & 1) != 0) {
|
||||
uVar2 = (uVar2 & 0xfc) + (this->field_0xf >> 1);
|
||||
} else {
|
||||
uVar2 = (uVar2 & 0xfc) + (this->animationState >> 1);
|
||||
this->field_0xf = this->animationState;
|
||||
}
|
||||
}
|
||||
if (uVar2 != this->animIndex) {
|
||||
InitAnimationForceUpdate(this, uVar2);
|
||||
}
|
||||
if ((this->field_0x82.HWORD & 4) != 0) {
|
||||
uVar1 = 2;
|
||||
} else {
|
||||
uVar1 = 1;
|
||||
}
|
||||
sub_080042BA(this, uVar1);
|
||||
}
|
||||
|
||||
void sub_0806014C(Entity* this) {
|
||||
this->actionDelay = 0;
|
||||
sub_08060158(this);
|
||||
}
|
||||
|
||||
#if 0
|
||||
void sub_08060158(Entity *this)
|
||||
{
|
||||
u8 bVar1;
|
||||
u8 bVar2;
|
||||
s32 iVar4;
|
||||
u32 temp;
|
||||
if (this->actionDelay != 0) {
|
||||
this->actionDelay--;
|
||||
}
|
||||
else {
|
||||
this->actionDelay = 2;
|
||||
iVar4 = sub_0806EDD8(this, 0x20, 0x20);
|
||||
if (iVar4 < 0) {
|
||||
this->animationState = this->field_0x68.HALF.HI;
|
||||
iVar4 = this->field_0x68.HALF.HI << 2;
|
||||
}
|
||||
temp = (this->animationState >> 1) * 0x20 + (iVar4 >> 1) * 2;
|
||||
bVar1 = gUnk_08109C98[temp];
|
||||
bVar2 = gUnk_08109C98[temp + 1];
|
||||
if ((bVar2 & 0x80) != 0) {
|
||||
this->animationState = sub_0806F5B0(iVar4);
|
||||
}
|
||||
this->frames.all = bVar1;
|
||||
this->frameIndex = bVar2 & 0x7f;
|
||||
this->frameSpriteSettings = 1;
|
||||
this->animIndex = 0;
|
||||
this->frameDuration = 0xf0;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
NAKED
|
||||
void sub_08060158(Entity* this) {
|
||||
asm(".include \"asm/non_matching/forestMinish/sub_08060158.inc\"");
|
||||
}
|
||||
|
||||
void sub_080601D4(Entity* this) {
|
||||
u32 temp;
|
||||
u32 uVar2;
|
||||
|
||||
if (CheckGlobalFlag(LV3_CLEAR) == 0) {
|
||||
uVar2 = 2;
|
||||
} else {
|
||||
temp = CheckKinstoneFused(0x17);
|
||||
uVar2 = (-temp | temp) >> 0x1f;
|
||||
}
|
||||
TextboxNoOverlap(gUnk_0810A354[uVar2], this);
|
||||
}
|
||||
|
||||
void sub_08060208(Entity *this)
|
||||
{
|
||||
ShowNPCDialogue(this, &gUnk_08109DC8[this->entityType.parameter * 0x8]);
|
||||
}
|
||||
|
||||
void sub_0806021C(Entity *this)
|
||||
{
|
||||
u32 uVar1;
|
||||
u32 uVar2;
|
||||
|
||||
//jabber nut
|
||||
uVar1 = GetInventoryValue(0x5B);
|
||||
uVar2 = (-uVar1 | uVar1) >> 0x1f;
|
||||
|
||||
//earth element
|
||||
if (GetInventoryValue(0x40)) {
|
||||
uVar2 = 2;
|
||||
}
|
||||
|
||||
//mole mitts
|
||||
if (GetInventoryValue(0x13)) {
|
||||
uVar2 = 3;
|
||||
}
|
||||
ShowNPCDialogue(this, gUnk_08109DC8 + this->entityType.parameter * 0x8 + uVar2 * 2);
|
||||
}
|
||||
|
||||
void sub_0806025C(Entity *this)
|
||||
{
|
||||
ShowNPCDialogue(this, &gUnk_08109DC8[this->entityType.parameter * 0x8]);
|
||||
}
|
||||
|
||||
void sub_08060270(Entity *this)
|
||||
{
|
||||
u32 index;
|
||||
|
||||
//flippers
|
||||
if (GetInventoryValue(0x46) == 0) {
|
||||
index = 1;
|
||||
if (CheckGlobalFlag(MIZUKAKI_START) == 0) {
|
||||
index = 0;
|
||||
SetGlobalFlag(MIZUKAKI_START);
|
||||
}
|
||||
}
|
||||
else {
|
||||
index = 3;
|
||||
if (CheckLocalFlag(0x76) == 0) {
|
||||
index = 2;
|
||||
SetLocalFlag(0x76);
|
||||
}
|
||||
}
|
||||
TextboxNoOverlap(gUnk_0810A35A[index], this);
|
||||
}
|
||||
|
||||
void sub_080602BC(Entity *this)
|
||||
{
|
||||
u32 index;
|
||||
|
||||
//spin attack
|
||||
if (GetInventoryValue(0x48) != 0) {
|
||||
index = (Random() & 1) + 2;
|
||||
}
|
||||
else {
|
||||
if (gUnk_02002A40.stats.bombCount < gBombBagSizes[gUnk_02002A40.stats.bombBagType]) {
|
||||
index = 1;
|
||||
}
|
||||
else {
|
||||
index = 0;
|
||||
}
|
||||
}
|
||||
TextboxNoOverlap(gUnk_0810A362[index], this);
|
||||
}
|
||||
|
||||
void sub_0806030C(Entity* this, u32 *arg1)
|
||||
{
|
||||
ModBombs(*(arg1 + 1));
|
||||
}
|
||||
|
||||
void sub_08060318(void)
|
||||
{
|
||||
Entity *ent;
|
||||
int i;
|
||||
|
||||
for (i = 2; i >= 0; i--) {
|
||||
ent = FindEntityInListBySubtype(8, 2, 2);
|
||||
if (ent != NULL) {
|
||||
sub_080A29BC(ent);
|
||||
DeleteEntity(ent);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void sub_08060340(void)
|
||||
{
|
||||
gUnk_02002A40.unk490 = gUnk_02002A40.unk50;
|
||||
}
|
||||
|
||||
u32 sub_08060354(void)
|
||||
{
|
||||
u32 iVar1;
|
||||
s32 iVar2;
|
||||
|
||||
iVar2 = gUnk_02002A40.unk50 - gUnk_02002A40.unk490;
|
||||
if (CheckGlobalFlag(DRUG_1) == 0) {
|
||||
if (4 < iVar2) {
|
||||
return 0x8444;
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (CheckGlobalFlag(DRUG_2) == 0) {
|
||||
if (iVar2 > 9) {
|
||||
return 0x8444;
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (CheckGlobalFlag(DRUG_3) == 0) {
|
||||
if (iVar2 > 14) {
|
||||
return 0x8444;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
void ForestMinish_Fusion(Entity *this)
|
||||
{
|
||||
if (this->action == 0) {
|
||||
if (LoadExtraSpriteData(this, &gUnk_0810A348)) {
|
||||
this->action++;
|
||||
this->spriteSettings.b.draw = TRUE;
|
||||
sub_0805E3A0(this, 2);
|
||||
InitializeAnimation(this, 6);
|
||||
}
|
||||
}
|
||||
else {
|
||||
GetNextFrame(this);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,53 @@
|
||||
#include "global.h"
|
||||
#include "entity.h"
|
||||
#include "npc.h"
|
||||
#include "player.h"
|
||||
|
||||
extern void sub_0805E3A0(Entity*, u32);
|
||||
extern u32 sub_0801E99C(Entity*);
|
||||
extern void sub_08078784(Entity*, u32);
|
||||
extern void sub_0807DD50(Entity*);
|
||||
extern u32 sub_0806F5A4(u32);
|
||||
extern void sub_0806F118(Entity*);
|
||||
extern void sub_0807DD94(Entity*, u32);
|
||||
|
||||
void Gentari(Entity *this)
|
||||
{
|
||||
switch (this->action) {
|
||||
case 0:
|
||||
this->action = 1;
|
||||
this->spriteSettings.b.draw = TRUE;
|
||||
sub_0805E3A0(this, 2);
|
||||
this->field_0x68.HALF.LO = sub_0801E99C(this);
|
||||
sub_08078784(this, this->field_0x68.HALF.LO);
|
||||
sub_0807DD50(this);
|
||||
break;
|
||||
case 1:
|
||||
if (this->interactType == 2) {
|
||||
this->action = 2;
|
||||
this->interactType = 0;
|
||||
InitAnimationForceUpdate(this, sub_0806F5A4(GetFacingDirection(this, &gPlayerEntity)));
|
||||
sub_0806F118(this);
|
||||
} else {
|
||||
sub_0807DD94(this, 0);
|
||||
}
|
||||
break;
|
||||
case 2:
|
||||
if (UpdateFuseInteraction(this)) {
|
||||
this->action = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void Gentari_Fusion(Entity *this)
|
||||
{
|
||||
if (this->action == 0) {
|
||||
this->action++;
|
||||
this->spriteSettings.b.draw = TRUE;
|
||||
sub_0805E3A0(this, 2);
|
||||
InitAnimationForceUpdate(this, 10);
|
||||
}
|
||||
else {
|
||||
UpdateAnimationSingleFrame(this);
|
||||
}
|
||||
}
|
||||
@@ -63,7 +63,7 @@ void sub_08069428(Entity* this, s32 offsetX, bool32 createFx65);
|
||||
void sub_080693D0(Entity* this) {
|
||||
sub_0807DD94(this, 0);
|
||||
if (this->animIndex == 8) {
|
||||
u32 var0 = this->field_0x82 & 0xF;
|
||||
u32 var0 = this->field_0x82.HWORD & 0xF;
|
||||
bool32 createFx65 = ((-var0) | var0) >> 0x1F; // = !var0
|
||||
|
||||
if (this->frames.all == 1) {
|
||||
@@ -121,13 +121,13 @@ void sub_080694EC(Entity* this) {
|
||||
anim = 2;
|
||||
if (!CheckKinstoneFused(47)) anim = 8;
|
||||
InitAnimationForceUpdate(this, anim);
|
||||
this->field_0x80 = anim;
|
||||
this->field_0x80.HWORD = anim;
|
||||
}
|
||||
|
||||
void Goron_Fusion(Entity* this) {
|
||||
if (this->action == 0) {
|
||||
this->action++;
|
||||
this->spriteSettings.b.ss0 = 1;
|
||||
this->spriteSettings.b.draw = 1;
|
||||
InitAnimationForceUpdate(this, 2);
|
||||
} else {
|
||||
UpdateAnimationSingleFrame(this);
|
||||
@@ -0,0 +1,143 @@
|
||||
#include "global.h"
|
||||
#include "entity.h"
|
||||
#include "functions.h"
|
||||
#include "structures.h"
|
||||
#include "textbox.h"
|
||||
#include "room.h"
|
||||
#include "flags.h"
|
||||
|
||||
extern u32 sub_080696BC(Entity*);
|
||||
|
||||
extern void (*const gUnk_08111B88[])(Entity*);
|
||||
extern void (*const gUnk_08111B98[])(Entity*);
|
||||
|
||||
extern u16 gUnk_08111BA0[];
|
||||
|
||||
|
||||
void GoronMerchant(Entity *this)
|
||||
{
|
||||
if ((this->flags & 2) != 0) {
|
||||
gUnk_08111B98[this->action](this);
|
||||
}
|
||||
else {
|
||||
gUnk_08111B88[this->action](this);
|
||||
sub_0806ED78(this);
|
||||
}
|
||||
}
|
||||
|
||||
void sub_08069584(Entity *this)
|
||||
{
|
||||
if (gScreenTransition.field_0x24[8] != 0) {
|
||||
this->action = 3;
|
||||
}
|
||||
else {
|
||||
this->action = 1;
|
||||
}
|
||||
InitAnimationForceUpdate(this, 2);
|
||||
}
|
||||
|
||||
void sub_080695AC(Entity *this)
|
||||
{
|
||||
s32 iVar2;
|
||||
|
||||
if (++this->field_0xf > 0x10) {
|
||||
this->field_0xf = 0;
|
||||
iVar2 = sub_0806ED9C(this, 0x28, 0x28);
|
||||
if (iVar2 > -1) {
|
||||
this->animationState = iVar2;
|
||||
}
|
||||
}
|
||||
if (this->animIndex != this->animationState) {
|
||||
InitAnimationForceUpdate(this, this->animationState);
|
||||
}
|
||||
}
|
||||
|
||||
void sub_080695E8(Entity *this)
|
||||
{
|
||||
UpdateAnimationSingleFrame(this);
|
||||
if ((gTextBox.doTextBox & 0x7f) == 0) {
|
||||
this->action = 1;
|
||||
this->interactType = gTextBox.doTextBox & 0x7f;
|
||||
sub_0805E584(this);
|
||||
InitAnimationForceUpdate(this, this->animationState);
|
||||
}
|
||||
}
|
||||
|
||||
void sub_0806961C(Entity *this)
|
||||
{
|
||||
if (gScreenTransition.field_0x24[8] == 2) {
|
||||
UpdateAnimationSingleFrame(this);
|
||||
}
|
||||
sub_0806FD3C(this);
|
||||
}
|
||||
|
||||
void sub_0806963C(Entity *this)
|
||||
{
|
||||
this->action = 1;
|
||||
this->spriteSettings.b.draw = TRUE;
|
||||
sub_0807DD50(this);
|
||||
}
|
||||
|
||||
void sub_08069654(Entity* this) {
|
||||
sub_0807DD94(this, 0);
|
||||
}
|
||||
|
||||
void sub_08069660(Entity *this)
|
||||
{
|
||||
u32 uVar1;
|
||||
|
||||
TextboxNoOverlap(0x2c1c, this);
|
||||
gTextBox.field_0x10 = (u16)sub_080696BC(this);
|
||||
}
|
||||
|
||||
void sub_08069684(void)
|
||||
{
|
||||
Manager *mgr;
|
||||
|
||||
if (FindEntityInListBySubtype(9, 0x31, 8) == NULL) {
|
||||
mgr = GetEmptyManager();
|
||||
if (mgr != NULL) {
|
||||
mgr->type = 9;
|
||||
mgr->subtype = 0x31;
|
||||
AppendEntityToList(mgr, 8);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void sub_080696B0(void)
|
||||
{
|
||||
gRoomVars.itemForSaleIndex = 0;
|
||||
}
|
||||
|
||||
u32 sub_080696BC(Entity* this)
|
||||
{
|
||||
u32 uVar1;
|
||||
u32 temp;
|
||||
u32 iVar3;
|
||||
s32 temp2;
|
||||
|
||||
temp2 = gRoomVars.field_0x7;
|
||||
if (temp2 > 0x70) {
|
||||
iVar3 = 1;
|
||||
}
|
||||
else {
|
||||
iVar3 = 0;
|
||||
}
|
||||
if (temp2 > 0x72) {
|
||||
iVar3 = 2;
|
||||
}
|
||||
|
||||
temp = CheckGlobalFlag(0x3e);
|
||||
uVar1 = (-temp | temp) >> 0x1f;
|
||||
|
||||
if (CheckGlobalFlag(0x3f)) {
|
||||
uVar1 = 2;
|
||||
}
|
||||
if (CheckGlobalFlag(0x40)) {
|
||||
uVar1 = 3;
|
||||
}
|
||||
if (CheckGlobalFlag(0x41)) {
|
||||
uVar1 = 4;
|
||||
}
|
||||
return gUnk_08111BA0[uVar1 * 3 + iVar3];
|
||||
}
|
||||
+240
@@ -0,0 +1,240 @@
|
||||
#include "global.h"
|
||||
#include "entity.h"
|
||||
#include "player.h"
|
||||
#include "flags.h"
|
||||
#include "textbox.h"
|
||||
#include "room.h"
|
||||
|
||||
typedef struct {
|
||||
u32 unk;
|
||||
u32 entityCount;
|
||||
} struct_03003DB8;
|
||||
|
||||
typedef struct {
|
||||
u8 filler[8];
|
||||
u8 unk;
|
||||
} ScreenTransition;
|
||||
|
||||
typedef struct {
|
||||
u32 unk;
|
||||
u32 unk2;
|
||||
} struct_08064050;
|
||||
|
||||
extern void sub_08063D24(Entity*);
|
||||
extern void sub_0806ED78(Entity*);
|
||||
extern u32 GetFacingDirection(Entity*, Entity*);
|
||||
extern u32 sub_0806F5A4(u32);
|
||||
extern void sub_0806EE20(Entity*);
|
||||
extern void sub_08064428(Entity*);
|
||||
extern u32 sub_0805ACC0(Entity*);
|
||||
extern void sub_0807DDAC(Entity*, u32);
|
||||
extern void sub_0807DDE4(Entity*);
|
||||
extern void sub_0807000C(Entity*);
|
||||
extern void sub_0806EE04(Entity*, void*, u32);
|
||||
extern Entity* sub_080A7EE0(int);
|
||||
extern void sub_08078778(Entity*);
|
||||
extern void sub_0807DD64(Entity*);
|
||||
void sub_08063DC8(Entity*);
|
||||
void sub_08063F20(Entity*);
|
||||
|
||||
extern void (*const gUnk_0810F544[])(Entity*);
|
||||
extern void (*const gUnk_0810F550[])(Entity*);
|
||||
|
||||
// entity count
|
||||
extern u8 gEntCount;
|
||||
extern SpriteLoadData gUnk_0810F524[];
|
||||
extern void* gUnk_0810F6BC[];
|
||||
extern ScreenTransition gScreenTransition;
|
||||
|
||||
void Guard(Entity* this) {
|
||||
if ((this->flags & 2) != 0) {
|
||||
gUnk_0810F544[this->action](this);
|
||||
} else {
|
||||
sub_08063D24(this);
|
||||
}
|
||||
}
|
||||
|
||||
void sub_08063D24(Entity* this) {
|
||||
gUnk_0810F550[this->action](this);
|
||||
sub_0806ED78(this);
|
||||
}
|
||||
|
||||
void sub_08063D44(Entity* this) {
|
||||
Entity* ent;
|
||||
u32 temp, idx;
|
||||
|
||||
if (gEntCount > 0x46)
|
||||
return;
|
||||
|
||||
temp = this->entityType.subtype;
|
||||
temp ^= 0x15;
|
||||
idx = ((-temp | temp) >> 0x1f) * 4;
|
||||
if (!LoadExtraSpriteData(this, &gUnk_0810F524[idx]))
|
||||
return;
|
||||
|
||||
InitializeAnimation(this, 4);
|
||||
sub_0806EE04(this, gUnk_0810F6BC[this->entityType.form], 0);
|
||||
switch (this->entityType.form) {
|
||||
case 0 ... 3:
|
||||
ent = sub_080A7EE0(0xc);
|
||||
ent->parent = this;
|
||||
ent->field_0xf = 0x3c;
|
||||
break;
|
||||
case 4 ... 5:
|
||||
sub_08078778(this);
|
||||
break;
|
||||
}
|
||||
this->action++;
|
||||
this->entityType.form = 0;
|
||||
sub_08063DC8(this);
|
||||
}
|
||||
|
||||
void sub_08063DC8(Entity* this) {
|
||||
if ((this->entityType).form == 0xff) {
|
||||
this->action = 2;
|
||||
this->actionDelay = 0x1e;
|
||||
this->animationState = sub_0806F5A4(GetFacingDirection(this, &gPlayerEntity));
|
||||
InitAnimationForceUpdate(this, this->animationState + 4);
|
||||
} else {
|
||||
sub_0806EE20(this);
|
||||
if (this->field_0x3e != this->animationState) {
|
||||
this->animationState = this->field_0x3e;
|
||||
InitializeAnimation(this, this->animationState + 4);
|
||||
} else {
|
||||
GetNextFrame(this);
|
||||
}
|
||||
if (this->interactType != 0) {
|
||||
this->action = 3;
|
||||
this->interactType = 0;
|
||||
InitializeAnimation(this, sub_0806F5A4(GetFacingDirection(this, &gPlayerEntity)));
|
||||
sub_08064428(this);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void sub_08063E54(Entity* this) {
|
||||
if (--this->actionDelay == 0) {
|
||||
SetRoomFlag(0xf);
|
||||
}
|
||||
}
|
||||
|
||||
void sub_08063E6C(Entity* this) {
|
||||
if ((gTextBox.doTextBox & 0x7f) == 0) {
|
||||
this->action = 1;
|
||||
InitializeAnimation(this, this->animationState + 4);
|
||||
}
|
||||
}
|
||||
|
||||
void sub_08063E90(Entity* this) {
|
||||
Entity* ent;
|
||||
u32 temp, idx;
|
||||
u32 unk;
|
||||
|
||||
temp = this->entityType.subtype;
|
||||
temp ^= 0x15;
|
||||
idx = ((-temp | temp) >> 0x1f) * 4;
|
||||
if (!LoadExtraSpriteData(this, &gUnk_0810F524[idx]))
|
||||
return;
|
||||
|
||||
this->action++;
|
||||
if (this->actionDelay) {
|
||||
this->field_0x70.BYTES.byte0 = 8;
|
||||
} else {
|
||||
this->field_0x70.BYTES.byte0 = 0;
|
||||
}
|
||||
this->actionDelay = 0;
|
||||
|
||||
unk = sub_0805ACC0(this);
|
||||
if (unk == 0) {
|
||||
this->field_0x68.HWORD = this->x.HALF.HI;
|
||||
this->field_0x6a.HWORD = this->y.HALF.HI;
|
||||
} else {
|
||||
this->field_0x68.HWORD = unk >> 0x10;
|
||||
this->field_0x6a.HWORD = unk;
|
||||
}
|
||||
this->field_0x70.BYTES.byte1 = 0;
|
||||
this->collisionLayer = 1;
|
||||
UpdateSpriteForCollisionLayer(this);
|
||||
sub_0807DD64(this);
|
||||
sub_08063F20(this);
|
||||
}
|
||||
|
||||
void sub_08063F20(Entity* this) {
|
||||
sub_0807DDAC(this, 0);
|
||||
sub_0807DDE4(this);
|
||||
GetNextFrame(this);
|
||||
if (this->interactType != 0) {
|
||||
this->action++;
|
||||
this->interactType = 0;
|
||||
InitializeAnimation(this, sub_0806F5A4(GetFacingDirection(this, &gPlayerEntity)) + *(s8*)&this->field_0x70);
|
||||
sub_08064428(this);
|
||||
}
|
||||
}
|
||||
|
||||
void sub_08063F78(Entity* this) {
|
||||
if ((gTextBox.doTextBox & 0x7f) == 0) {
|
||||
this->action = this->action - 1;
|
||||
InitializeAnimation(this, (this->animationState >> 1) + 4 + *(s8*)&this->field_0x70);
|
||||
}
|
||||
}
|
||||
|
||||
void Guard_Head(Entity* this) {
|
||||
u8 bVar1;
|
||||
u32 uVar2;
|
||||
u32 pbVar3;
|
||||
u32 uVar4;
|
||||
u32 pbVar5;
|
||||
|
||||
uVar2 = this->frames.all & 0x3f;
|
||||
pbVar5 = (this->frameIndex & 0x3f);
|
||||
uVar4 = this->frameSpriteSettings & 0x3f;
|
||||
if ((this->entityType).subtype == 0x15) {
|
||||
if ((this->frameIndex & 0x40) != 0) {
|
||||
pbVar5 = pbVar5 + 0x21;
|
||||
pbVar3 = 0xffffffff;
|
||||
uVar4 = 0;
|
||||
} else {
|
||||
pbVar3 = (uVar2 + 0x19);
|
||||
if ((this->frameSpriteSettings & 0x3f) != 0) {
|
||||
uVar4 += 0x1f;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
pbVar3 = (uVar2 + 0x46);
|
||||
pbVar5 = pbVar5 + 0x2d;
|
||||
if ((this->frameSpriteSettings & 0x3f) != 0) {
|
||||
uVar4 += 0x4c;
|
||||
}
|
||||
}
|
||||
uVar4--;
|
||||
SetExtraSpriteFrame(this, 0, pbVar3);
|
||||
SetExtraSpriteFrame(this, 1, pbVar5);
|
||||
SetExtraSpriteFrame(this, 2, uVar4);
|
||||
SetSpriteSubEntryOffsetData1(this, 1, 0);
|
||||
SetSpriteSubEntryOffsetData2(this, 1, 2);
|
||||
sub_0807000C(this);
|
||||
}
|
||||
|
||||
void sub_08064030(Entity* arg0, Entity* arg1) {
|
||||
*(u32*)&arg1->animationState = (-gRoomVars.greatFairyState | gRoomVars.greatFairyState) >> 0x1f;
|
||||
}
|
||||
|
||||
void sub_08064044(void) {
|
||||
gScreenTransition.unk = 1;
|
||||
}
|
||||
|
||||
void sub_08064050(Entity* arg0, struct_08064050* arg1) {
|
||||
u32 unk;
|
||||
|
||||
arg1->unk2 = 0;
|
||||
switch (arg0->entityType.parameter) {
|
||||
case 0x11:
|
||||
arg1->unk2 = 1;
|
||||
break;
|
||||
case 0x12:
|
||||
arg1->unk2 = 2;
|
||||
break;
|
||||
case 0x13:
|
||||
arg1->unk2 = 3;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,107 @@
|
||||
#include "global.h"
|
||||
#include "entity.h"
|
||||
#include "npc.h"
|
||||
#include "flags.h"
|
||||
#include "textbox.h"
|
||||
#include "functions.h"
|
||||
|
||||
extern u16 gUnk_08112D48[];
|
||||
|
||||
void Librari(Entity* this) {
|
||||
switch (this->action) {
|
||||
case 0:
|
||||
this->action = 1;
|
||||
this->spriteSettings.b.draw = TRUE;
|
||||
this->animationState = this->actionDelay;
|
||||
this->field_0x68.HALF.LO = sub_0801E99C(this);
|
||||
sub_08078784(this, this->field_0x68.HALF.LO);
|
||||
sub_0805E3A0(this, 2);
|
||||
sub_0807DD50(this);
|
||||
break;
|
||||
case 1:
|
||||
if (this->interactType == 2) {
|
||||
this->action = 2;
|
||||
this->interactType = 0;
|
||||
sub_0806F118(this);
|
||||
} else {
|
||||
sub_0807DDAC(this, 0);
|
||||
sub_0807DDE4(this);
|
||||
UpdateAnimationSingleFrame(this);
|
||||
}
|
||||
break;
|
||||
case 2:
|
||||
if (UpdateFuseInteraction(this)) {
|
||||
this->action = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void sub_0806B260(Entity* this, u32 arg1) {
|
||||
u32 index;
|
||||
|
||||
*(u32*)(arg1 + 0x14) = 0;
|
||||
// flippers
|
||||
if (!GetInventoryValue(0x46)) {
|
||||
if (CheckGlobalFlag(0x29)) {
|
||||
index = 2;
|
||||
*(u32*)(arg1 + 0x14) = 1;
|
||||
} else if (!CheckLocalFlag(0x7a)) {
|
||||
index = 0;
|
||||
SetLocalFlag(0x7a);
|
||||
} else {
|
||||
index = 1;
|
||||
}
|
||||
} else {
|
||||
index = 3;
|
||||
}
|
||||
TextboxNoOverlap(gUnk_08112D48[index], this);
|
||||
}
|
||||
|
||||
extern u16 gUnk_08112D50[];
|
||||
|
||||
void sub_0806b2b4(Entity* this) {
|
||||
u32 index;
|
||||
|
||||
if (CheckLocalFlag(0xb3)) {
|
||||
if (!CheckRoomFlag(0)) {
|
||||
index = 1;
|
||||
SetRoomFlag(0);
|
||||
} else if (!CheckRoomFlag(1)) {
|
||||
index = 2;
|
||||
SetRoomFlag(1);
|
||||
} else if (!CheckRoomFlag(2)) {
|
||||
index = 3;
|
||||
SetRoomFlag(2);
|
||||
} else {
|
||||
index = 4;
|
||||
ClearRoomFlag(0);
|
||||
ClearRoomFlag(1);
|
||||
ClearRoomFlag(2);
|
||||
}
|
||||
} else {
|
||||
index = 0;
|
||||
}
|
||||
TextboxNoOverlap(gUnk_08112D50[index], this);
|
||||
}
|
||||
|
||||
void Librari_Fusion(Entity *this)
|
||||
{
|
||||
if (this->action == 0) {
|
||||
this->action++;
|
||||
this->spriteSettings.b.draw = TRUE;
|
||||
InitAnimationForceUpdate(this, 9);
|
||||
}
|
||||
else {
|
||||
UpdateAnimationSingleFrame(this);
|
||||
}
|
||||
}
|
||||
|
||||
void Percy_Head(Entity *this) // ???
|
||||
{
|
||||
SetExtraSpriteFrame(this, 0, (this->frameSpriteSettings & 0x3f) + 0x13);
|
||||
SetExtraSpriteFrame(this, 1, (this->frames.all & 0x7f) + 0xb);
|
||||
SetExtraSpriteFrame(this, 2, this->frameIndex);
|
||||
SetSpriteSubEntryOffsetData1(this, 2, 1);
|
||||
SetSpriteSubEntryOffsetData2(this, 2, 0);
|
||||
sub_0807000C(this);
|
||||
}
|
||||
@@ -2,7 +2,7 @@
|
||||
#include "functions.h"
|
||||
#include "entity.h"
|
||||
|
||||
extern Entity gLinkEntity;
|
||||
extern Entity gPlayerEntity;
|
||||
|
||||
extern void (*gUnk_0810FF5C[])(Entity* this);
|
||||
extern void (*gUnk_0810FF64[])(Entity* this);
|
||||
@@ -20,7 +20,7 @@ void Malon(Entity* this) {
|
||||
|
||||
void sub_08065864(Entity* this) {
|
||||
this->action = 1;
|
||||
this->spriteSettings.b.ss0 = 1;
|
||||
this->spriteSettings.b.draw = 1;
|
||||
InitAnimationForceUpdate(this, 0xC);
|
||||
}
|
||||
|
||||
@@ -30,10 +30,10 @@ void sub_08065880(Entity* this) {
|
||||
|
||||
void sub_08065888(Entity* this) {
|
||||
this->action = 1;
|
||||
this->spriteSettings.b.ss0 = 1;
|
||||
this->spriteSettings.b.draw = 1;
|
||||
this->animationState = 4;
|
||||
this->field_0x68 = sub_0801E99C(this);
|
||||
sub_08078784(this, this->field_0x68);
|
||||
this->field_0x68.HALF.LO = sub_0801E99C(this);
|
||||
sub_08078784(this, this->field_0x68.HALF.LO);
|
||||
sub_0807DD50(this);
|
||||
}
|
||||
|
||||
@@ -41,7 +41,7 @@ void sub_080658BC(Entity* this) {
|
||||
if (this->interactType == 2) {
|
||||
this->action = 2;
|
||||
this->interactType = 0;
|
||||
InitAnimationForceUpdate(this, sub_0806F5A4(sub_080045C4(this, &gLinkEntity)));
|
||||
InitAnimationForceUpdate(this, sub_0806F5A4(GetFacingDirection(this, &gPlayerEntity)));
|
||||
sub_0806F118(this);
|
||||
} else {
|
||||
sub_0807DD94(this, 0);
|
||||
@@ -57,12 +57,12 @@ void sub_08065900(Entity* this) {
|
||||
void sub_08065914(Entity* this) {
|
||||
Entity* target;
|
||||
|
||||
target = sub_0805EB00(7, 0x1F, 7);
|
||||
target = FindEntityInListBySubtype(7, 0x1F, 7);
|
||||
if (target != NULL) {
|
||||
PositionRelative(this, target, 0x180000, -0x10000);
|
||||
target->parent = this;
|
||||
}
|
||||
target = sub_0805EB00(7, 0x20, 7);
|
||||
target = FindEntityInListBySubtype(7, 0x20, 7);
|
||||
if (target != NULL) {
|
||||
PositionRelative(this, target, 0x280000, 0);
|
||||
target->parent = this;
|
||||
@@ -72,7 +72,7 @@ void sub_08065914(Entity* this) {
|
||||
void Malon_Fusion(Entity* this) {
|
||||
if (this->action == 0) {
|
||||
this->action++;
|
||||
this->spriteSettings.b.ss0 = 1;
|
||||
this->spriteSettings.b.draw = 1;
|
||||
InitAnimationForceUpdate(this, 0xC);
|
||||
} else {
|
||||
UpdateAnimationSingleFrame(this);
|
||||
@@ -0,0 +1,110 @@
|
||||
#include "global.h"
|
||||
#include "entity.h"
|
||||
#include "player.h"
|
||||
#include "room.h"
|
||||
#include "flags.h"
|
||||
#include "sprite.h"
|
||||
#include "textbox.h"
|
||||
#include "npc.h"
|
||||
#include "structures.h"
|
||||
|
||||
extern void sub_0807DD50(Entity*);
|
||||
extern u32 sub_0806F5A4(u32);
|
||||
extern void sub_0806F118(Entity*);
|
||||
extern u32 sub_0801E99C();
|
||||
extern void sub_08078784(Entity*,u32);
|
||||
extern void sub_0807DDAC(Entity*,u32);
|
||||
extern void sub_0805E3A0(Entity*,u32);
|
||||
extern void sub_0807DDE4(Entity*);
|
||||
extern void sub_08078850();
|
||||
extern u32 gUnk_08113F44;
|
||||
extern u32 gUnk_08113F48;
|
||||
extern u32 GetInventoryValue(u32);
|
||||
extern u32 CheckLocalFlag(u32);
|
||||
extern void SetLocalFlag();
|
||||
extern void ShowNPCDialogue();
|
||||
|
||||
void MayorHagen(Entity *this)
|
||||
{
|
||||
u32 v;
|
||||
switch (this->action) {
|
||||
case 0:
|
||||
this->action = 1;
|
||||
this->field_0x68.HALF.HI = 0;
|
||||
this->field_0x68.HALF.LO = sub_0801E99C(this);
|
||||
sub_0805E3A0(this, 2);
|
||||
sub_0807DD50(this);
|
||||
break;
|
||||
case 1:
|
||||
v = this->interactType;
|
||||
if (v == 2) {
|
||||
this->action = v;
|
||||
this->interactType = 0;
|
||||
this->field_0x68.HALF.HI = this->animIndex;
|
||||
InitAnimationForceUpdate(this,4 + sub_0806F5A4(GetFacingDirection(this, &gPlayerEntity)));
|
||||
sub_0806F118(this);
|
||||
break;
|
||||
}
|
||||
sub_0807DDAC(this,0);
|
||||
sub_0807DDE4(this);
|
||||
UpdateAnimationSingleFrame(this);
|
||||
break;
|
||||
case 2:
|
||||
if (UpdateFuseInteraction(this)) {
|
||||
this->action = 1;
|
||||
InitAnimationForceUpdate(this, this->field_0x68.HALF.HI);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void sub_0806CE5C(Entity *this)
|
||||
{
|
||||
sub_08078784(this,sub_0801E99C());
|
||||
sub_08078850(this,1,0,&gUnk_08113F44);
|
||||
}
|
||||
|
||||
void sub_0806CE80(Entity *this)
|
||||
{
|
||||
u32 v;
|
||||
u32 v2;
|
||||
v = gUnk_02002A40.unk8;
|
||||
if (v == 5) {
|
||||
//flippers
|
||||
if (GetInventoryValue(0x46) == 0) {
|
||||
if (CheckLocalFlag(0x70) != 0) {
|
||||
v2 = CheckLocalFlag(0x71);
|
||||
if (v2 == 0) {
|
||||
v = 0xb;
|
||||
SetLocalFlag(0x71);
|
||||
}
|
||||
else {
|
||||
v = 0xc;
|
||||
}
|
||||
}
|
||||
else {
|
||||
v = 0xa;
|
||||
}
|
||||
}
|
||||
else {
|
||||
v2 = CheckLocalFlag(0x89);
|
||||
if (v2 == 0) {
|
||||
v = 0xd;
|
||||
SetLocalFlag(0x89);
|
||||
}
|
||||
else {
|
||||
v = 0xe;
|
||||
}
|
||||
}
|
||||
}
|
||||
ShowNPCDialogue(this,&gUnk_08113F48 + 2*v);
|
||||
}
|
||||
|
||||
void MayorHagen_Fusion(Entity *this) {
|
||||
if (this->action == 0) {
|
||||
this->action++;
|
||||
this->spriteSettings.b.draw = 1;
|
||||
InitAnimationForceUpdate(this, 8);
|
||||
} else {
|
||||
UpdateAnimationSingleFrame(this);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,172 @@
|
||||
#include "global.h"
|
||||
#include "entity.h"
|
||||
#include "npc.h"
|
||||
#include "textbox.h"
|
||||
#include "functions.h"
|
||||
|
||||
extern void sub_0806ED78(Entity*);
|
||||
extern void sub_08068780(Entity*);
|
||||
extern void sub_08078778(Entity*);
|
||||
extern u32 Random(void);
|
||||
extern void sub_0807DD50(Entity*);
|
||||
extern void sub_0806F118(Entity*);
|
||||
extern void sub_0807DDAC(Entity*, u32);
|
||||
extern void sub_0807DDE4(Entity*);
|
||||
extern u32 sub_080040A8(Entity*);
|
||||
extern void sub_08004488(u32);
|
||||
extern u32 sub_0801E99C(Entity*);
|
||||
extern void sub_08078784(Entity*, u32);
|
||||
extern void sub_0807000C(Entity*);
|
||||
extern s32 sub_0806EDD8(Entity*, u32, u32);
|
||||
extern void sub_080A7C18(u32, u32, u32);
|
||||
extern void sub_0807CAA0(u32, u32);
|
||||
|
||||
extern void (*const gUnk_08111530[])(Entity*);
|
||||
|
||||
extern SpriteLoadData gUnk_08111520;
|
||||
extern u16 gUnk_0811153E[];
|
||||
extern u16 gUnk_08111538[];
|
||||
|
||||
void Melari(Entity* this) {
|
||||
if ((this->flags & 2) == 0) {
|
||||
gUnk_08111530[this->action](this);
|
||||
sub_0806ED78(this);
|
||||
} else {
|
||||
sub_08068780(this);
|
||||
}
|
||||
}
|
||||
|
||||
void sub_08068708(Entity* this) {
|
||||
if (LoadExtraSpriteData(this, &gUnk_08111520) != 0) {
|
||||
this->action = 1;
|
||||
InitializeAnimation(this, 0);
|
||||
sub_08078778(this);
|
||||
}
|
||||
}
|
||||
|
||||
void sub_08068730(Entity* this) {
|
||||
s32 animIndex;
|
||||
|
||||
animIndex = sub_0806ED9C(this, 0x20, 0x20);
|
||||
if (-1 < animIndex) {
|
||||
if (this->field_0xf == 0) {
|
||||
this->field_0xf = 0x10;
|
||||
if (this->animIndex != animIndex) {
|
||||
InitializeAnimation(this, animIndex);
|
||||
}
|
||||
} else {
|
||||
this->field_0xf--;
|
||||
}
|
||||
}
|
||||
if (this->interactType != 0) {
|
||||
this->interactType = 0;
|
||||
TextboxNoOverlapFollow(this->actionDelay + 0x1200);
|
||||
}
|
||||
}
|
||||
|
||||
void sub_08068780(Entity* this) {
|
||||
Entity* ent;
|
||||
|
||||
switch (this->action) {
|
||||
case 0:
|
||||
if (LoadExtraSpriteData(this, &gUnk_08111520) == 0) {
|
||||
return;
|
||||
}
|
||||
this->action = 1;
|
||||
this->spriteSettings.b.draw = TRUE;
|
||||
this->animationState = this->entityType.form;
|
||||
sub_0805E3A0(this, 2);
|
||||
sub_0807DD50(this);
|
||||
break;
|
||||
case 1:
|
||||
if (this->interactType == 2) {
|
||||
this->action = 2;
|
||||
this->interactType = 0;
|
||||
sub_0806F118(this);
|
||||
} else {
|
||||
sub_0807DDAC(this, 0);
|
||||
sub_0807DDE4(this);
|
||||
GetNextFrame(this);
|
||||
}
|
||||
break;
|
||||
case 2:
|
||||
if (UpdateFuseInteraction(this)) {
|
||||
this->action = 1;
|
||||
}
|
||||
}
|
||||
|
||||
if ((this->frames.b.f2) != 0) {
|
||||
this->frames.all &= 0xbf;
|
||||
if (sub_080040A8(this) == 0) {
|
||||
PlaySFX(gUnk_0811153E[(s32)Random() % 3]);
|
||||
} else {
|
||||
sub_08004488(gUnk_08111538[(s32)Random() % 3]);
|
||||
}
|
||||
ent = CreateFx(this, 0x3d, 0x20);
|
||||
if (ent != NULL) {
|
||||
PositionRelative(this, ent, 0x180000, -0xa0000);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void sub_08068884(Entity* this) {
|
||||
this->field_0x68.HALF.LO = sub_0801E99C(this);
|
||||
sub_08078784(this, this->field_0x68.HALF.LO);
|
||||
}
|
||||
|
||||
void Melari_Head(Entity* this) {
|
||||
u32 bVar1;
|
||||
|
||||
bVar1 = this->frames.all;
|
||||
bVar1 &= -0xc1;
|
||||
SetExtraSpriteFrame(this, 1, this->frameIndex);
|
||||
if ((bVar1 & 0x20) != 0) {
|
||||
SetExtraSpriteFrame(this, 0, bVar1 & -0xe1);
|
||||
SetExtraSpriteFrame(this, 2, 0xff);
|
||||
SetSpriteSubEntryOffsetData1(this, 1, 0);
|
||||
} else {
|
||||
SetExtraSpriteFrame(this, 0, 0xff);
|
||||
SetExtraSpriteFrame(this, 2, bVar1 & -0xe1);
|
||||
SetSpriteSubEntryOffsetData2(this, 1, 2);
|
||||
}
|
||||
sub_0807000C(this);
|
||||
}
|
||||
|
||||
void sub_08068910(Entity* this) {
|
||||
s32 iVar1;
|
||||
|
||||
if (this->actionDelay != 0) {
|
||||
this->actionDelay--;
|
||||
} else {
|
||||
this->actionDelay = 0x10;
|
||||
if ((this->frames.all & 0x20) != 0) {
|
||||
iVar1 = sub_0806EDD8(this, 0x30, 0x30);
|
||||
if (iVar1 < 0) {
|
||||
iVar1 = 0x10;
|
||||
} else {
|
||||
}
|
||||
iVar1 = sub_0806F5A4(iVar1);
|
||||
InitializeAnimation(this, (this->animIndex & -0x4) + iVar1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void sub_08068964(Entity* this) {
|
||||
sub_080A7C18(53, 0, 3);
|
||||
sub_0807CAA0(53, 2);
|
||||
}
|
||||
|
||||
void Melari_Fusion(Entity* this) {
|
||||
if (this->action == 0) {
|
||||
if (LoadExtraSpriteData(this, &gUnk_08111520)) {
|
||||
this->action++;
|
||||
this->spriteSettings.b.draw = TRUE;
|
||||
InitializeAnimation(this, 6);
|
||||
}
|
||||
} else {
|
||||
GetNextFrame(this);
|
||||
}
|
||||
}
|
||||
|
||||
void nullsub_502(Entity* this) {
|
||||
}
|
||||
@@ -12,7 +12,7 @@ void MilkCart(Entity* ent) {
|
||||
|
||||
void sub_08065B6C(Entity* ent) {
|
||||
ent->action++;
|
||||
ent->spriteSettings.b.ss0 = 1;
|
||||
ent->spriteSettings.b.draw = 1;
|
||||
ent->y.HALF.LO += -0x8000;
|
||||
ent->animationState = 6;
|
||||
InitAnimationForceUpdate(ent, 3);
|
||||
@@ -0,0 +1,21 @@
|
||||
#include "global.h"
|
||||
#include "entity.h"
|
||||
#include "player.h"
|
||||
#include "room.h"
|
||||
#include "flags.h"
|
||||
#include "sprite.h"
|
||||
#include "textbox.h"
|
||||
#include "npc.h"
|
||||
extern void sub_0807DD50();
|
||||
extern void sub_0807DD94();
|
||||
|
||||
|
||||
void MoblinLady(Entity* this) {
|
||||
if (this->action == 0) {
|
||||
this->action++;
|
||||
sub_0807DD50(this);
|
||||
}
|
||||
else {
|
||||
sub_0807DD94(this,0);
|
||||
}
|
||||
}
|
||||
+100
@@ -0,0 +1,100 @@
|
||||
#include "global.h"
|
||||
#include "entity.h"
|
||||
#include "player.h"
|
||||
#include "flags.h"
|
||||
#include "textbox.h"
|
||||
#include "npc.h"
|
||||
#include "structures.h"
|
||||
|
||||
extern void sub_0805E3A0(Entity*, u32);
|
||||
extern void sub_0807DD50(Entity*);
|
||||
extern u32 GetFacingDirection(Entity*, Entity*);
|
||||
extern u32 sub_0806F5A4(u32);
|
||||
extern void sub_0806F118(Entity*);
|
||||
extern void sub_0807DD94(Entity*, u32);
|
||||
extern u32 UpdateFuseInteraction(Entity*);
|
||||
extern void sub_0807000C(Entity*);
|
||||
extern u32 sub_0801E99C(Entity*);
|
||||
extern void sub_08078784(Entity*, u32);
|
||||
|
||||
extern SpriteLoadData gUnk_08110C00;
|
||||
extern u16 gUnk_08110C0C[];
|
||||
extern u32 gUnk_08110C10[];
|
||||
|
||||
void Mutoh(Entity* this)
|
||||
{
|
||||
if (*(u32*)&this->cutsceneBeh == 0) {
|
||||
DeleteThisEntity();
|
||||
}
|
||||
|
||||
switch (this->action) {
|
||||
case 0:
|
||||
if (LoadExtraSpriteData(this, &gUnk_08110C00)) {
|
||||
this->action = 1;
|
||||
this->spriteSettings.b.draw = TRUE;
|
||||
sub_0805E3A0(this, 2);
|
||||
sub_0807DD50(this);
|
||||
}
|
||||
break;
|
||||
case 1:
|
||||
if (this->interactType == 2) {
|
||||
this->action = 2;
|
||||
this->interactType = 0;
|
||||
InitAnimationForceUpdate(this, sub_0806F5A4(GetFacingDirection(this, &gPlayerEntity)) + 4);
|
||||
sub_0806F118(this);
|
||||
} else {
|
||||
sub_0807DD94(this, 0);
|
||||
}
|
||||
break;
|
||||
case 2:
|
||||
if (UpdateFuseInteraction(this)) {
|
||||
this->action = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void Mutoh_Head(Entity *this)
|
||||
{
|
||||
SetExtraSpriteFrame(this, 0, (this->frames.all & -0x81));
|
||||
SetExtraSpriteFrame(this, 1, this->frameIndex);
|
||||
SetSpriteSubEntryOffsetData1(this,1,0);
|
||||
sub_0807000C(this);
|
||||
}
|
||||
|
||||
void sub_080670B4(Entity *this)
|
||||
{
|
||||
u32 uVar1;
|
||||
u32 uVar2;
|
||||
|
||||
uVar2 = 0;
|
||||
if (GetInventoryValue(0x11) == 0) {
|
||||
uVar1 = CheckGlobalFlag(TABIDACHI);
|
||||
uVar2 = (-uVar1 | uVar1) >> 0x1f;
|
||||
}
|
||||
TextboxNoOverlap(gUnk_08110C0C[uVar2],this);
|
||||
}
|
||||
|
||||
void sub_080670E4(Entity *this)
|
||||
{
|
||||
ShowNPCDialogue(this, &gUnk_08110C10[gUnk_02002A40.unk8 * 2]);
|
||||
}
|
||||
|
||||
void sub_08067100(Entity *this)
|
||||
{
|
||||
this->field_0x68.HALF.LO = sub_0801E99C(this);
|
||||
sub_08078784(this, this->field_0x68.HALF.LO);
|
||||
}
|
||||
|
||||
void Mutoh_Fusion(Entity *this)
|
||||
{
|
||||
if (this->action == 0) {
|
||||
if (LoadExtraSpriteData(this, &gUnk_08110C00) != 0) {
|
||||
this->action++;
|
||||
this->spriteSettings.b.draw = TRUE;
|
||||
InitializeAnimation(this, 2);
|
||||
}
|
||||
}
|
||||
else {
|
||||
GetNextFrame(this);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,53 @@
|
||||
#include "global.h"
|
||||
#include "entity.h"
|
||||
#include "textbox.h"
|
||||
|
||||
extern void sub_08078778(Entity*);
|
||||
extern void sub_0805E47C(Entity*);
|
||||
extern void sub_0806ED78(Entity*);
|
||||
extern void sub_0805E584(Entity*);
|
||||
|
||||
extern void (*const gUnk_0810C290[])(Entity*);
|
||||
|
||||
void NPC9(Entity *this)
|
||||
{
|
||||
gUnk_0810C290[this->action](this);
|
||||
}
|
||||
|
||||
void sub_08062AF0(Entity *this)
|
||||
{
|
||||
this->action = 1;
|
||||
this->spriteSettings.b.draw = TRUE;
|
||||
InitializeAnimation(this, 0);
|
||||
sub_08078778(this);
|
||||
}
|
||||
|
||||
void sub_08062B14(Entity *this)
|
||||
{
|
||||
GetNextFrame(this);
|
||||
if (this->interactType != 0) {
|
||||
this->interactType = 0;
|
||||
this->action++;
|
||||
InitializeAnimation(this, 1);
|
||||
sub_0805E47C(this);
|
||||
}
|
||||
sub_0806ED78(this);
|
||||
}
|
||||
|
||||
void sub_08062B48(Entity *this)
|
||||
{
|
||||
GetNextFrame(this);
|
||||
if ((this->frames.b.f3) != 0) {
|
||||
TextboxNoOverlapFollow(0xa01);
|
||||
this->action++;
|
||||
}
|
||||
}
|
||||
|
||||
void sub_08062B70(Entity *this)
|
||||
{
|
||||
if ((gTextBox.doTextBox & 0x7f) == 0) {
|
||||
InitializeAnimation(this, 2);
|
||||
this->action = 1;
|
||||
sub_0805E584(this);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
#include "global.h"
|
||||
#include "entity.h"
|
||||
#include "npc.h"
|
||||
#include "textbox.h"
|
||||
#include "functions.h"
|
||||
|
||||
extern void sub_0806B41C(Entity*);
|
||||
void sub_0806B3CC(Entity*);
|
||||
|
||||
extern SpriteLoadData gUnk_08112E1C;
|
||||
|
||||
void Percy(Entity* this) {
|
||||
if ((this->flags & 2) != 0) {
|
||||
sub_0806B41C(this);
|
||||
} else {
|
||||
sub_0806B3CC(this);
|
||||
}
|
||||
}
|
||||
|
||||
void sub_0806B3CC(Entity *this)
|
||||
{
|
||||
if (this->action == 0) {
|
||||
if (!LoadExtraSpriteData(this, &gUnk_08112E1C)) {
|
||||
return;
|
||||
}
|
||||
this->action = 1;
|
||||
InitializeAnimation(this, 0);
|
||||
sub_08078778(this);
|
||||
}
|
||||
GetNextFrame(this);
|
||||
if (this->interactType != 0) {
|
||||
this->interactType = 0;
|
||||
TextboxNoOverlapFollow(0);
|
||||
}
|
||||
sub_0806ED78(this);
|
||||
}
|
||||
@@ -0,0 +1,231 @@
|
||||
#include "global.h"
|
||||
#include "entity.h"
|
||||
#include "functions.h"
|
||||
#include "npc.h"
|
||||
#include "textbox.h"
|
||||
#include "player.h"
|
||||
#include "room.h"
|
||||
#include "structures.h"
|
||||
|
||||
typedef struct {
|
||||
u8 filler[7];
|
||||
u8 unk;
|
||||
} struct_02033280;
|
||||
|
||||
extern void sub_08060528(Entity*);
|
||||
extern void* GetCurrentRoomProperty(u32);
|
||||
extern void sub_0806EE04(Entity*, void*, u32);
|
||||
extern void sub_080604DC(Entity*);
|
||||
extern s32 sub_0806ED9C(Entity*, u32, u32);
|
||||
extern void sub_0806EE20(Entity*);
|
||||
extern void sub_0806ED78(Entity*);
|
||||
extern u32 sub_080040A8(Entity*);
|
||||
extern u32 sub_0801E99C(Entity*);
|
||||
extern void sub_0807DD50(Entity*);
|
||||
extern void sub_0806F118(Entity*);
|
||||
extern u32 sub_0806F5A4(u32);
|
||||
extern u32 GetFacingDirection(Entity*, Entity*);
|
||||
extern void sub_080606D8(Entity*);
|
||||
extern void sub_0807DD94(Entity*, u32);
|
||||
extern void sub_080788E0(Entity*);
|
||||
extern void sub_08004488(u32);
|
||||
extern void sub_080606C0(Entity*);
|
||||
extern void sub_0800451C(Entity*);
|
||||
extern void sub_08078784(Entity*, u32);
|
||||
extern void sub_0807DEDC(Entity*, u32, u32, u32);
|
||||
|
||||
typedef struct {
|
||||
s16 x;
|
||||
s16 y;
|
||||
} Coords16;
|
||||
|
||||
extern Coords16 gUnk_0810A66C[];
|
||||
extern s8* gUnk_0810A918[];
|
||||
|
||||
extern void (*const gUnk_0810AA24[])(Entity*);
|
||||
extern u32 gUnk_0810AA30[];
|
||||
extern struct_02033280 gUnk_02033280;
|
||||
|
||||
void Postman(Entity* this) {
|
||||
if ((this->flags & 2) != 0) {
|
||||
sub_08060528(this);
|
||||
} else {
|
||||
gUnk_0810AA24[this->action](this);
|
||||
}
|
||||
}
|
||||
|
||||
void sub_08060428(Entity* this) {
|
||||
u8 bVar1;
|
||||
void* data;
|
||||
|
||||
this->actionDelay = 0x5a;
|
||||
this->nonPlanarMovement = 0x180;
|
||||
if (this->entityType.parameter != 0) {
|
||||
data = GetCurrentRoomProperty(this->entityType.parameter);
|
||||
} else {
|
||||
data = NULL;
|
||||
}
|
||||
sub_0806EE04(this, data, 0);
|
||||
this->action = 1;
|
||||
InitAnimationForceUpdate(this, 4);
|
||||
}
|
||||
|
||||
void sub_0806045C(Entity* this) {
|
||||
u8 bVar1;
|
||||
u32 uVar2;
|
||||
u32 bVar3;
|
||||
s32 temp;
|
||||
|
||||
UpdateAnimationSingleFrame(this);
|
||||
sub_080604DC(this);
|
||||
switch (this->interactType) {
|
||||
case 1:
|
||||
case 2:
|
||||
this->action = 2;
|
||||
TextboxNoOverlapFollow(0);
|
||||
break;
|
||||
default:
|
||||
bVar1 = this->field_0x3e;
|
||||
if (bVar1 != this->animationState) {
|
||||
this->animationState = bVar1;
|
||||
InitAnimationForceUpdate(this, 4 + bVar1);
|
||||
}
|
||||
temp = sub_0806ED9C(this, 0x18, 0x18);
|
||||
if ((temp > -1) && (temp == this->animationState)) {
|
||||
bVar3 = 1;
|
||||
} else {
|
||||
bVar3 = 0;
|
||||
}
|
||||
if (!bVar3) {
|
||||
sub_0806EE20(this);
|
||||
}
|
||||
}
|
||||
sub_0806ED78(this);
|
||||
}
|
||||
|
||||
void sub_080604C8(Entity* this) {
|
||||
UpdateAnimationSingleFrame(this);
|
||||
sub_080604DC(this);
|
||||
this->action = 1;
|
||||
}
|
||||
|
||||
void sub_080604DC(Entity* this) {
|
||||
u8 bVar1;
|
||||
int iVar2;
|
||||
Entity* ent;
|
||||
|
||||
if (((u32)(this->spriteSettings.raw << 0x1e) >> 0x1e == 1) && sub_080040A8(this)) {
|
||||
if ((this->frames.all & 1) != 0) {
|
||||
this->frames.all &= 0xfe;
|
||||
ent = CreateFx(this, 0x11, 0x40);
|
||||
if (ent != NULL) {
|
||||
ent->y.HALF.HI++;
|
||||
sub_0805E3A0(ent, 3);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void sub_08060528(Entity *this)
|
||||
{
|
||||
switch (this->action) {
|
||||
case 0:
|
||||
this->action = 1;
|
||||
this->spriteSettings.b.draw = TRUE;
|
||||
this->field_0x68.HALF.LO = 0;
|
||||
this->field_0x68.HALF.HI = 0;
|
||||
this->field_0x6a.HWORD = 0;
|
||||
this->field_0x6c.HALF.HI = 0;
|
||||
this->field_0x6c.HALF.LO = sub_0801E99C(this);
|
||||
sub_0807DD50(this);
|
||||
break;
|
||||
case 1:
|
||||
if (this->interactType == 2) {
|
||||
this->action = 3;
|
||||
this->interactType = 0;
|
||||
sub_0806F118(this);
|
||||
InitAnimationForceUpdate(this, sub_0806F5A4(GetFacingDirection(this, &gPlayerEntity)));
|
||||
}
|
||||
else {
|
||||
if (this->interactType != 0) {
|
||||
this->action = 2;
|
||||
this->interactType = 0;
|
||||
sub_080606D8(this);
|
||||
InitAnimationForceUpdate(this, sub_0806F5A4(GetFacingDirection(this, &gPlayerEntity)));
|
||||
}
|
||||
else {
|
||||
sub_0807DD94(this, 0);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 2:
|
||||
UpdateAnimationSingleFrame(this);
|
||||
if ((gTextBox.doTextBox & 0x7f) != 0) {
|
||||
break;
|
||||
}
|
||||
this->action = 1;
|
||||
break;
|
||||
case 3:
|
||||
UpdateAnimationSingleFrame(this);
|
||||
if (!UpdateFuseInteraction(this)) {
|
||||
break;
|
||||
}
|
||||
this->action = 1;
|
||||
}
|
||||
sub_080604DC(this);
|
||||
if (0 < (s16)this->field_0x6a.HWORD) {
|
||||
if ((s16)this->field_0x6a.HWORD > 0x12b) {
|
||||
this->field_0x6a.HWORD = 0;
|
||||
this->field_0x20 = 0x20000;
|
||||
this->field_0x6c.HALF.HI = 1;
|
||||
sub_080788E0(this);
|
||||
sub_08004488(0x7c);
|
||||
}
|
||||
else {
|
||||
this->field_0x6a.HWORD -= 1;
|
||||
}
|
||||
}
|
||||
sub_08003FC4(this, 0x1800);
|
||||
if (((this->field_0x6c.HALF.HI != 0) && (this->field_0x20 == 0)) && this->height.WORD == 0) {
|
||||
this->field_0x6c.HALF.HI = 0;
|
||||
sub_080606C0(this);
|
||||
}
|
||||
if ((-1 < this->height.WORD) &&
|
||||
((gPlayerEntity.collisionLayer == 0 || (this->collisionLayer == gPlayerEntity.collisionLayer)))) {
|
||||
sub_0806ED78(this);
|
||||
}
|
||||
sub_0800451C(this);
|
||||
}
|
||||
|
||||
void sub_080606C0(Entity *this)
|
||||
{
|
||||
this->field_0x6c.HALF.LO = sub_0801E99C(this);
|
||||
sub_08078784(this, this->field_0x6c.HALF.LO);
|
||||
}
|
||||
|
||||
void sub_080606D8(Entity* this)
|
||||
{
|
||||
s32 iVar1;
|
||||
|
||||
iVar1 = gUnk_02002A40.unk8 - 2;
|
||||
if (iVar1 < 0) {
|
||||
iVar1 = 0;
|
||||
}
|
||||
ShowNPCDialogue(this, &gUnk_0810AA30[iVar1 * 2]);
|
||||
}
|
||||
|
||||
void sub_08060700(Entity *entity, u32 arg1)
|
||||
{
|
||||
s8* var0 = gUnk_0810A918[(s8)entity->field_0x68.HALF.LO];
|
||||
Coords16* coords = &gUnk_0810A66C[var0[(s8)entity->field_0x68.HALF.HI]];
|
||||
u32 x = coords->x + gRoomControls.roomOriginX;
|
||||
u32 y = coords->y + gRoomControls.roomOriginY;
|
||||
sub_0807DEDC(entity, arg1, x, y);
|
||||
gUnk_02033280.unk |= 1;
|
||||
}
|
||||
|
||||
void sub_0806075C(Entity *this)
|
||||
{
|
||||
this->field_0x68.HALF.LO = 0xb;
|
||||
this->field_0x68.HALF.HI = 0xff;
|
||||
}
|
||||
@@ -6,7 +6,6 @@ extern void sub_0807DDAC(Entity*, u32);
|
||||
extern void sub_0807DDE4(Entity*);
|
||||
extern void sub_0806ED78(Entity*);
|
||||
extern void PlaySFX(u32);
|
||||
extern void sub_0805E3A0(Entity*, u32);
|
||||
extern void sub_0806A8C8(Entity*);
|
||||
extern void sub_0807DD94(Entity*, u32);
|
||||
|
||||
@@ -4,11 +4,6 @@
|
||||
#include "room.h"
|
||||
#include "flags.h"
|
||||
|
||||
typedef struct {
|
||||
u8 filler[9];
|
||||
u8 unk;
|
||||
} struct_030010A0;
|
||||
|
||||
typedef struct {
|
||||
u8 filler[4];
|
||||
u32 unk;
|
||||
@@ -21,7 +16,6 @@ extern void DoFade(u32, u32);
|
||||
|
||||
extern void gUnk_0813AD60;
|
||||
extern void gUnk_0813AD74;
|
||||
extern struct_030010A0 gUnk_030010A0;
|
||||
|
||||
void Simon(Entity *this)
|
||||
{
|
||||
@@ -37,7 +31,7 @@ void Simon(Entity *this)
|
||||
void sub_0806C224(void)
|
||||
{
|
||||
DoExitTransition(&gUnk_0813AD60);
|
||||
gUnk_030010A0.unk = 6;
|
||||
gScreenTransition.transitionType = 6;
|
||||
}
|
||||
|
||||
void Simon_CreateChest(Entity *this)
|
||||
@@ -49,9 +43,9 @@ void Simon_CreateChest(Entity *this)
|
||||
|
||||
void sub_0806C280(void)
|
||||
{
|
||||
SetGlobalFlag(0x50);
|
||||
SetGlobalFlag(MAROYA_WAKEUP);
|
||||
DoExitTransition(&gUnk_0813AD74);
|
||||
gUnk_030010A0.unk = 6;
|
||||
gScreenTransition.transitionType = 6;
|
||||
}
|
||||
|
||||
void sub_0806C2A0(u32 *param_1,struct_0806C2A0 *param_2)
|
||||
+225
@@ -0,0 +1,225 @@
|
||||
#include "global.h"
|
||||
#include "entity.h"
|
||||
#include "textbox.h"
|
||||
|
||||
typedef struct {
|
||||
u8 filler[8];
|
||||
u8 unk;
|
||||
} SaveFile;
|
||||
|
||||
extern u32 GetFacingDirection(Entity*, Entity*);
|
||||
extern u32 sub_0806F5A4(u32);
|
||||
extern void sub_0806F118(Entity*);
|
||||
extern void sub_0806ED78(Entity*);
|
||||
extern Entity* CreateFx(Entity*, u32, u32);
|
||||
extern void PlaySFX(u32);
|
||||
extern u32 Random(void);
|
||||
extern void sub_0807000C(Entity*);
|
||||
extern u32 sub_0801E99C(Entity*);
|
||||
extern u32 sub_0806ED9C(Entity*, u32, u32);
|
||||
extern u32 sub_0806F078(Entity*, u32);
|
||||
extern void sub_0807DD50(Entity*);
|
||||
extern void sub_0807DD94(Entity*, u32);
|
||||
extern void sub_0807DDAC(Entity*, u32);
|
||||
extern void sub_0807DDE4(Entity*);
|
||||
extern u32 UpdateFuseInteraction(Entity*);
|
||||
extern u32 GetAnimationState(Entity*);
|
||||
extern void ShowNPCDialogue(Entity*, u32*);
|
||||
extern void sub_08078850(u32, u32, u32, u32*);
|
||||
extern void sub_08078784(Entity*, u32);
|
||||
|
||||
extern void (*const gUnk_08110360[])(Entity*);
|
||||
extern void (*const gUnk_0811036C[])(Entity*);
|
||||
|
||||
extern u16 gUnk_08110380[];
|
||||
extern SpriteLoadData gUnk_08110354;
|
||||
extern SaveFile gUnk_02002A40;
|
||||
extern u32 gUnk_08110390[];
|
||||
extern u16 gUnk_081103D0[];
|
||||
extern u32 gUnk_081103E0;
|
||||
|
||||
#if NON_MATCHING //reg-alloc
|
||||
void Smith(Entity *this)
|
||||
{
|
||||
u32 iVar2;
|
||||
u32 iVar4;
|
||||
|
||||
if ((this->flags & 2) != 0) {
|
||||
if (this->interactType == 2) {
|
||||
this->action = 4;
|
||||
this->interactType = 0;
|
||||
iVar4 = (this->animIndex == 0xc) ? 8 : 0;
|
||||
iVar2 = sub_0806F5A4(GetFacingDirection(this, &gPlayerEntity));
|
||||
InitAnimationForceUpdate(this, iVar2 + iVar4);
|
||||
sub_0806F118(this);
|
||||
}
|
||||
gUnk_0811036C[this->action](this);
|
||||
}
|
||||
else {
|
||||
gUnk_08110360[this->action](this);
|
||||
sub_0806ED78(this);
|
||||
}
|
||||
if (this->animIndex == 0xc) {
|
||||
this->spritePriority.b1 = 0;
|
||||
}
|
||||
else {
|
||||
this->spritePriority.b1 = 1;
|
||||
}
|
||||
if ((this->frames.all & 1) != 0) {
|
||||
this->frames.all &= 0xfe;
|
||||
CreateFx(this, 0x3d, 0x20);
|
||||
PlaySFX(gUnk_08110380[(Random() & 7)]);
|
||||
}
|
||||
}
|
||||
#else
|
||||
NAKED
|
||||
void Smith(Entity *this) {
|
||||
asm(".include \"asm/non_matching/smith/smith.inc\"");
|
||||
}
|
||||
#endif
|
||||
|
||||
void Smith_Head(Entity *this)
|
||||
{
|
||||
u8 bVar1;
|
||||
|
||||
bVar1 = this->frames.all;
|
||||
SetExtraSpriteFrame(this, 0, this->frameIndex);
|
||||
if ((bVar1 & 0x40) != 0) {
|
||||
SetExtraSpriteFrame(this, 1, 0x16);
|
||||
}
|
||||
else {
|
||||
SetExtraSpriteFrame(this, 1, 0xff);
|
||||
}
|
||||
SetSpriteSubEntryOffsetData1(this,0,1);
|
||||
sub_0807000C(this);
|
||||
}
|
||||
|
||||
void sub_080660EC(Entity *this)
|
||||
{
|
||||
if (LoadExtraSpriteData(this, &gUnk_08110354) != 0) {
|
||||
this->action = 1;
|
||||
this->field_0x68.HALF.LO = sub_0801E99C(this);
|
||||
InitAnimationForceUpdate(this, 2);
|
||||
}
|
||||
}
|
||||
|
||||
void sub_08066118(Entity *this)
|
||||
{
|
||||
s32 uVar1;
|
||||
u32 iVar2;
|
||||
|
||||
uVar1 = sub_0806ED9C(this, 0x28, 0x28);
|
||||
if (uVar1 < 0) {
|
||||
uVar1 = 2;
|
||||
}
|
||||
else {
|
||||
if (this->field_0xf == 0) {
|
||||
this->field_0xf = 0x10;
|
||||
}
|
||||
else {
|
||||
--this->field_0xf;
|
||||
uVar1 = this->animIndex;
|
||||
}
|
||||
}
|
||||
if (sub_0806F078(this, uVar1) == 0) {
|
||||
UpdateAnimationSingleFrame(this);
|
||||
}
|
||||
if (this->interactType != 0) {
|
||||
this->action = 2;
|
||||
TextboxNoOverlapFollow(0);
|
||||
}
|
||||
}
|
||||
|
||||
void sub_08066170(Entity *this)
|
||||
{
|
||||
this->action = 1;
|
||||
}
|
||||
|
||||
void sub_08066178(Entity *this)
|
||||
{
|
||||
if (LoadExtraSpriteData(this, &gUnk_08110354) != 0) {
|
||||
this->action = 1;
|
||||
this->spriteSettings.b.draw = 1;
|
||||
this->field_0x68.HALF.LO = sub_0801E99C(this);
|
||||
sub_0807DD50(this);
|
||||
}
|
||||
}
|
||||
|
||||
void sub_080661B0(Entity *this)
|
||||
{
|
||||
sub_0807DD94(this, 0);
|
||||
}
|
||||
|
||||
void sub_080661BC(Entity *this)
|
||||
{
|
||||
u32 sVar1;
|
||||
|
||||
if (this->animIndex == 0xc) {
|
||||
UpdateAnimationSingleFrame(this);
|
||||
if ((this->frames.b.f3) != 0) {
|
||||
this->field_0x80.HWORD = GetAnimationState(this) + 8;
|
||||
InitAnimationForceUpdate(this, this->field_0x80.HWORD);
|
||||
}
|
||||
}
|
||||
else {
|
||||
sub_0807DD94(this,0);
|
||||
}
|
||||
}
|
||||
|
||||
void sub_08066200(Entity *this)
|
||||
{
|
||||
sub_0807DDAC(this, 0);
|
||||
sub_0807DDE4(this);
|
||||
UpdateAnimationSingleFrame(this);
|
||||
}
|
||||
|
||||
void sub_08066218(Entity *this)
|
||||
{
|
||||
if (UpdateFuseInteraction(this) != 0) {
|
||||
this->action = 1;
|
||||
}
|
||||
}
|
||||
|
||||
void sub_0806622C(Entity *this)
|
||||
{
|
||||
u32 iVar1;
|
||||
|
||||
if (gUnk_02002A40.unk - 2 < 0) {
|
||||
iVar1 = 0;
|
||||
}
|
||||
else {
|
||||
iVar1 = gUnk_02002A40.unk - 2;
|
||||
}
|
||||
ShowNPCDialogue(this, &gUnk_08110390[iVar1 * 2]);
|
||||
}
|
||||
|
||||
void nullsub_501(Entity* this) {}
|
||||
|
||||
void sub_08066258(void)
|
||||
{
|
||||
PlaySFX(gUnk_081103D0[Random() & 7]);
|
||||
}
|
||||
|
||||
void sub_08066274(u32 arg0)
|
||||
{
|
||||
sub_08078850(arg0, 1, 0, &gUnk_081103E0);
|
||||
}
|
||||
|
||||
void sub_08066288(Entity *arg0)
|
||||
{
|
||||
sub_08078784(arg0, arg0->field_0x68.HALF.LO);
|
||||
}
|
||||
|
||||
void Smith_Fusion(Entity *this)
|
||||
{
|
||||
if (this->action == 0) {
|
||||
if (LoadExtraSpriteData(this, &gUnk_08110354) != 0) {
|
||||
this->action++;
|
||||
this->spriteSettings.b.draw = 1;
|
||||
InitAnimationForceUpdate(this, 6);
|
||||
}
|
||||
}
|
||||
else {
|
||||
UpdateAnimationSingleFrame(this);
|
||||
}
|
||||
}
|
||||
@@ -30,7 +30,7 @@ void Stamp(Entity* ent) {
|
||||
|
||||
void sub_08062BD4(Entity* ent) {
|
||||
ent->action = 1;
|
||||
ent->spriteSettings.b.ss0 = 1;
|
||||
ent->spriteSettings.b.draw = 1;
|
||||
InitializeAnimation(ent, 0);
|
||||
sub_08078778(ent);
|
||||
}
|
||||
@@ -11,7 +11,7 @@ extern void (*gUnk_081121D4[])(Entity*);
|
||||
|
||||
extern SpriteLoadData gUnk_081121C4;
|
||||
extern SpriteLoadData gUnk_081121B4;
|
||||
extern u32 gUnk_030010A0;
|
||||
extern u32 gScreenTransition;
|
||||
extern void sub_0807DD94(Entity*, u32);
|
||||
extern void sub_0806A26C(Entity*);
|
||||
extern void sub_080042BA(Entity*, u32);
|
||||
@@ -41,8 +41,8 @@ void sub_0806A1F8(Entity *this)
|
||||
void sub_0806A234(Entity *this)
|
||||
{
|
||||
sub_0807DD94(this, 0);
|
||||
if ((this->field_0x82 & 4) != 0) {
|
||||
if ((gUnk_030010A0 & 7) == 0) {
|
||||
if ((this->field_0x82.HWORD & 4) != 0) {
|
||||
if ((gScreenTransition & 7) == 0) {
|
||||
sub_0806A26C(this);
|
||||
}
|
||||
sub_080042BA(this, 2);
|
||||
@@ -2,7 +2,7 @@
|
||||
#include "entity.h"
|
||||
#include "textbox.h"
|
||||
#include "functions.h"
|
||||
#include "link.h"
|
||||
#include "player.h"
|
||||
|
||||
extern void (*gUnk_0810FEC4[])(Entity* this);
|
||||
extern void (*gUnk_0810FEBC[])(Entity* this);
|
||||
@@ -63,16 +63,16 @@ void sub_0806559C(Entity* this) {
|
||||
void sub_08065608(Entity* this) {
|
||||
if (LoadExtraSpriteData(this, &gUnk_0810FEB0) != 0) {
|
||||
this->action = 1;
|
||||
this->spriteSettings.b.ss0 = 1;
|
||||
this->field_0x68 = sub_0801E99C(this);
|
||||
sub_08078784(this, this->field_0x68);
|
||||
this->spriteSettings.b.draw = 1;
|
||||
this->field_0x68.HALF.LO = sub_0801E99C(this);
|
||||
sub_08078784(this, this->field_0x68.HALF.LO);
|
||||
sub_0807DD50(this);
|
||||
}
|
||||
}
|
||||
|
||||
void sub_08065648(Entity* this) {
|
||||
if (this->interactType == 2) {
|
||||
this->field_0x69 = this->action;
|
||||
this->field_0x68.HALF.HI = this->action;
|
||||
this->action = 4;
|
||||
this->interactType = 0;
|
||||
sub_0806F118(this);
|
||||
@@ -83,14 +83,14 @@ void sub_08065648(Entity* this) {
|
||||
|
||||
void sub_08065680(Entity* this) {
|
||||
if (UpdateFuseInteraction() != 0) {
|
||||
this->action = this->field_0x69;
|
||||
this->action = this->field_0x68.HALF.HI;
|
||||
InitAnimationForceUpdate(this, this->field_0x6a.HALF.LO);
|
||||
}
|
||||
}
|
||||
|
||||
void sub_080656A4(Entity* this) {
|
||||
if ((gTextBox.doTextBox & 0x7F) == 0) {
|
||||
this->action = this->field_0x69;
|
||||
this->action = this->field_0x68.HALF.HI;
|
||||
InitAnimationForceUpdate(this, this->field_0x6a.HALF.LO);
|
||||
}
|
||||
UpdateAnimationSingleFrame(this);
|
||||
@@ -98,7 +98,7 @@ void sub_080656A4(Entity* this) {
|
||||
|
||||
void sub_080656D4(Entity* this) {
|
||||
if (this->interactType == 2) {
|
||||
this->field_0x69 = this->action;
|
||||
this->field_0x68.HALF.HI = this->action;
|
||||
this->action = 4;
|
||||
this->interactType = 0;
|
||||
sub_0806F118(this);
|
||||
@@ -109,7 +109,7 @@ void sub_080656D4(Entity* this) {
|
||||
StartCutscene(this, &gUnk_0800B41C);
|
||||
goto label2;
|
||||
} else {
|
||||
this->field_0x69 = this->action;
|
||||
this->field_0x68.HALF.HI = this->action;
|
||||
this->action = 3;
|
||||
this->interactType = 0;
|
||||
TextboxNoOverlap(*(u32*)(*(u32*)&this->cutsceneBeh.HWORD + 4), this);
|
||||
@@ -126,7 +126,7 @@ void sub_080656D4(Entity* this) {
|
||||
void sub_0806574C(Entity* this) {
|
||||
u32 j;
|
||||
|
||||
j = (this->animIndex & ~3) + sub_0806F5A4(sub_080045C4(this, &gLinkEntity));
|
||||
j = (this->animIndex & ~3) + sub_0806F5A4(GetFacingDirection(this, &gPlayerEntity));
|
||||
if (this->animIndex != j) {
|
||||
InitAnimationForceUpdate(this, j);
|
||||
}
|
||||
@@ -152,7 +152,7 @@ void Talon_Fusion(Entity* this) {
|
||||
if (this->action == 0) {
|
||||
if (LoadExtraSpriteData(this, &gUnk_0810FEB0) != 0) {
|
||||
this->action++;
|
||||
this->spriteSettings.b.ss0 = 1;
|
||||
this->spriteSettings.b.draw = 1;
|
||||
InitializeAnimation(this, 6);
|
||||
}
|
||||
} else {
|
||||
@@ -0,0 +1,113 @@
|
||||
#include "global.h"
|
||||
#include "entity.h"
|
||||
#include "player.h"
|
||||
|
||||
typedef struct {
|
||||
u8 filler[8];
|
||||
u8 unk;
|
||||
} SaveFile;
|
||||
|
||||
extern SpriteLoadData gUnk_08113910[];
|
||||
extern void sub_0805E3A0(Entity*, u32);
|
||||
extern void sub_0807DD50(Entity*);
|
||||
extern u32 GetFacingDirection(Entity*, Entity*);
|
||||
extern u32 sub_0806F5A4(u32);
|
||||
extern void sub_0806F118(Entity*);
|
||||
extern void sub_0807DD94(Entity*, u32);
|
||||
extern u32 sub_0801E99C();
|
||||
extern void sub_08078784(Entity*, u32);
|
||||
extern u32 UpdateFuseInteraction(Entity*);
|
||||
extern void sub_0807000C(Entity*);
|
||||
extern void ShowNPCDialogue(Entity*, u16*);
|
||||
|
||||
extern SaveFile gUnk_02002A40;
|
||||
extern u16 gUnk_08113930[];
|
||||
|
||||
void Teachers(Entity* this) {
|
||||
switch (this->action) {
|
||||
case 0:
|
||||
if (LoadExtraSpriteData(this, &gUnk_08113910[this->entityType.form * 4])) {
|
||||
this->action = 1;
|
||||
this->spriteSettings.b.draw = TRUE;
|
||||
this->animationState = this->actionDelay;
|
||||
this->field_0x68.HALF.HI = 0;
|
||||
sub_0805E3A0(this, 2);
|
||||
sub_0807DD50(this);
|
||||
}
|
||||
break;
|
||||
case 1:
|
||||
if (this->interactType == 2) {
|
||||
this->action = 2;
|
||||
this->interactType = 0;
|
||||
this->field_0x68.HALF.HI = this->animIndex;
|
||||
InitializeAnimation(this,
|
||||
(this->animIndex & -4) + sub_0806F5A4(GetFacingDirection(this, &gPlayerEntity)));
|
||||
sub_0806F118(this);
|
||||
} else {
|
||||
sub_0807DD94(this, 0);
|
||||
}
|
||||
break;
|
||||
case 2:
|
||||
if (UpdateFuseInteraction(this)) {
|
||||
this->action = 1;
|
||||
InitializeAnimation(this, this->field_0x68.HALF.HI);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void sub_0806C674(Entity *this)
|
||||
{
|
||||
this->field_0x68.HALF.LO = sub_0801E99C();
|
||||
sub_08078784(this, this->field_0x68.HALF.LO);
|
||||
}
|
||||
|
||||
void Teachers_Head(Entity *this)
|
||||
{
|
||||
u8 bVar1;
|
||||
u8 bVar2;
|
||||
u32 uVar3;
|
||||
|
||||
|
||||
uVar3 = this->frames.all & -0x81;
|
||||
bVar1 = this->frameIndex;
|
||||
bVar2 = this->frameSpriteSettings & 0x3f;
|
||||
if ((this->entityType).form == 0) {
|
||||
SetExtraSpriteFrame(this,0, (uVar3 + 3));
|
||||
SetExtraSpriteFrame(this,1, bVar1);
|
||||
SetSpriteSubEntryOffsetData1(this, 1, 0);
|
||||
sub_0807000C(this);
|
||||
}
|
||||
else {
|
||||
SetExtraSpriteFrame(this, 0, (uVar3 + 6));
|
||||
SetExtraSpriteFrame(this, 1, ((bVar2) + 3));
|
||||
SetExtraSpriteFrame(this, 2, bVar1);
|
||||
SetSpriteSubEntryOffsetData1(this, 2, 1);
|
||||
SetSpriteSubEntryOffsetData2(this, 2, 0);
|
||||
sub_0807000C(this);
|
||||
}
|
||||
}
|
||||
|
||||
void sub_0806C70C(Entity *this)
|
||||
{
|
||||
int offset;
|
||||
|
||||
offset = gUnk_02002A40.unk - 2;
|
||||
if (offset < 0) {
|
||||
offset = 0;
|
||||
}
|
||||
ShowNPCDialogue(this, gUnk_08113930 + this->entityType.form * 0x20 + offset * 4);
|
||||
}
|
||||
|
||||
void Teachers_Fusion(Entity *this)
|
||||
{
|
||||
if (this->action == 0) {
|
||||
if (LoadExtraSpriteData(this, &gUnk_08113910[this->entityType.form * 4])) {
|
||||
this->action++;
|
||||
this->spriteSettings.b.draw = TRUE;
|
||||
InitializeAnimation(this, 2);
|
||||
}
|
||||
}
|
||||
else {
|
||||
GetNextFrame(this);
|
||||
}
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user