Merge remote-tracking branch 'upstream/master' into takkuri

This commit is contained in:
Tal Hayon
2022-01-11 12:58:21 +02:00
43 changed files with 2513 additions and 5357 deletions
+83
View File
@@ -0,0 +1,83 @@
#define NENT_DEPRECATED
#include "entity.h"
#include "enemy.h"
#include "room.h"
#include "object.h"
#include "functions.h"
typedef struct {
Entity base;
u8 filler[0xe];
u16 unk_0x76;
} BombarossaEntity;
void (*const gUnk_080CEB38[])(Entity*);
const s8 gUnk_080CEB50[];
extern void sub_080A2CC0(Entity*, void*, void*);
void sub_0803350C(BombarossaEntity* this);
void Bombarossa(Entity* this) {
gUnk_080CEB38[GetNextFunction(this)](this);
}
void sub_080333D4(BombarossaEntity* this) {
if (super->action == 0) {
super->action = 1;
super->actionDelay = Random() & 0xf;
InitializeAnimation(super, 0);
if (super->type != 0) {
super->child = GetCurrentRoomProperty(super->type);
sub_080A2CC0(super, &super->child, &this->unk_0x76);
}
}
super->z.HALF.HI = gUnk_080CEB50[(((++super->actionDelay) >> 4) & 0x7) + (super->type2 << 3)];
GetNextFrame(super);
if (super->type != 0) {
sub_0803350C(this);
}
}
void sub_08033448(BombarossaEntity* this) {
Entity* ent;
switch (super->bitfield & 0x7f) {
default:
ent = CreateObject(OBJECT_20, 0, 0);
if (ent) {
CopyPosition(super, ent);
}
DeleteThisEntity();
case 1:
case 15:
case 19:
case 27:
case 29:
case 30:
sub_0804AA30(super, gUnk_080CEB38);
break;
}
}
void nullsub_158() {
}
void sub_0803350C(BombarossaEntity* this) {
if ((super->direction & 0x80) == 0) {
LinearMoveUpdate(super);
}
if (--this->unk_0x76 == 0) {
sub_080A2CC0(super, &super->child, &this->unk_0x76);
}
}
void (*const gUnk_080CEB38[])(Entity*) = {
(EntityActionPtr)sub_080333D4, (EntityActionPtr)sub_08033448, sub_08001324, sub_0804A7D4, sub_08001242, nullsub_158,
};
const s8 gUnk_080CEB50[] = {
0, -1, -2, -3, -4, -3, -2, -1, -18, -19, -20, -21, -22, -21, -20, -19,
};
+35 -7
View File
@@ -37,16 +37,16 @@ extern Entity* sub_08049DF4(u32);
extern u32 sub_0806FC80(Entity*, Entity*, s32);
void sub_0803C664(BowMoblinEntity*);
extern void (*const gUnk_080CFF78[])(BowMoblinEntity*);
extern void (*const gUnk_080CFF90[])(BowMoblinEntity*);
void (*const gUnk_080CFF78[])(Entity*);
void (*const gUnk_080CFF90[])(BowMoblinEntity*);
extern const s8 gUnk_080CFFC4[8];
extern const s8 gUnk_080CFFA4[8];
extern const s8 gUnk_080CFFAC[16];
extern const u16 gUnk_080CFFBC[4];
const s8 gUnk_080CFFA4[8];
const s8 gUnk_080CFFAC[16];
const u16 gUnk_080CFFBC[4];
const s8 gUnk_080CFFC4[8];
void BowMoblin(Entity* this) {
EnemyFunctionHandler(this, (EntityActionArray)gUnk_080CFF78);
EnemyFunctionHandler(this, gUnk_080CFF78);
SetChildOffset(this, 0, 1, -0x18);
}
@@ -389,3 +389,31 @@ void sub_0803C714(BowMoblinEntity* this) {
PositionRelative(super, child, offsetX, offsetY);
}
void (*const gUnk_080CFF78[])(Entity*) = {
(EntityActionPtr)sub_0803C180, (EntityActionPtr)sub_0803C198, sub_08001324, sub_0804A7D4, sub_08001242,
(EntityActionPtr)nullsub_168,
};
void (*const gUnk_080CFF90[])(BowMoblinEntity*) = {
sub_0803C1E0, sub_0803C234, sub_0803C2DC, sub_0803C344, sub_0803C400,
};
const s8 gUnk_080CFFA4[8] = {
0x18, 0x20, 0x30, 0x40, 0x60, 0x6c, 0x78, 0x91,
};
const s8 gUnk_080CFFAC[16] = {
0xf8, 0xc, 0xf4, 0x8, 0x4, 0xfa, 0x6, 0xfc, 0x0, 0xfd, 0x1, 0x3, 0xff, 0x2, 0x0, 0xfe,
};
const u16 gUnk_080CFFBC[4] = {
0xe,
0xe000,
0xe0,
0xe00,
};
const s8 gUnk_080CFFC4[8] = {
-5, -20, 15, -12, 4, -4, -15, -12,
};
+80
View File
@@ -0,0 +1,80 @@
#include "enemy.h"
#include "entity.h"
void (*const gUnk_080D1CC8[])(Entity*);
void (*const gUnk_080D1CE0[])(Entity*);
void Curtain(Entity* this) {
EnemyFunctionHandler(this, gUnk_080D1CC8);
}
void sub_080481D0(Entity* this) {
gUnk_080D1CE0[this->action](this);
}
void sub_080481E8(Entity* this) {
if (this->field_0x46) {
this->action = 2;
this->flags &= 0x7f;
this->spritePriority.b0 = 7;
this->actionDelay = 3;
} else {
this->actionDelay = 2;
}
InitializeAnimation(this, this->actionDelay);
}
void nullsub_26() {
}
void sub_08048224(Entity* this) {
this->spritePriority.b0 = 4;
if (CheckLocalFlag(0x72) == 0) {
this->action = 1;
this->actionDelay = 0;
} else {
this->action = 3;
this->flags &= 0x7f;
this->actionDelay = 1;
}
InitializeAnimation(this, this->actionDelay);
}
void sub_08048268(Entity* this) {
if (this->actionDelay == 0) {
return;
}
GetNextFrame(this);
if (this->frame & 0x80) {
this->actionDelay = 0;
InitializeAnimation(this, 0);
}
}
void sub_08048294(Entity* this) {
GetNextFrame(this);
if (this->frame & 0x80) {
this->action = 3;
SetLocalFlag(0x72);
InitializeAnimation(this, 1);
}
}
void nullsub_27() {
}
void (*const gUnk_080D1CC8[])(Entity*) = {
sub_080481D0, sub_080481E8, sub_08001324, sub_0804A7D4, sub_08001242, nullsub_26,
};
void (*const gUnk_080D1CE0[])(Entity*) = {
sub_08048224,
sub_08048268,
sub_08048294,
nullsub_27,
};
+200
View File
@@ -0,0 +1,200 @@
#define NENT_DEPRECATED
#include "global.h"
#include "room.h"
#include "asm.h"
#include "functions.h"
#include "enemy/gyorg.h"
void sub_08048684(GyorgChildEntity*);
void sub_0804869C(GyorgChildEntity*);
void sub_080486AC(GyorgChildEntity*);
void (*const gUnk_080D1E6C[])(GyorgChildEntity*) = {
sub_08048684,
sub_0804869C,
(void (*)(GyorgChildEntity*))sub_08001324,
(void (*)(GyorgChildEntity*))sub_0804A7D4,
(void (*)(GyorgChildEntity*))sub_08001242,
sub_080486AC,
};
void GyorgChild(Entity* this) {
if (gRoomTransition.field_0x39 == 0) {
this->flags &= ~0x80;
this->health = 0;
this->collisionLayer = 2;
}
gUnk_080D1E6C[GetNextFunction(this)]((GyorgChildEntity*)this);
}
void sub_080486F4(GyorgChildEntity*);
void sub_0804877C(GyorgChildEntity*);
void sub_0804882C(GyorgChildEntity*);
void sub_08048904(GyorgChildEntity*);
void sub_08048684(GyorgChildEntity* this) {
static void (*const gUnk_080D1E84[])(GyorgChildEntity*) = {
sub_080486F4,
sub_0804877C,
sub_0804882C,
sub_08048904,
};
gUnk_080D1E84[super->action](this);
}
void sub_0804869C(GyorgChildEntity* this) {
sub_0804AA30(super, gUnk_080D1E6C);
}
void sub_080486D0(GyorgChildEntity*);
void sub_080486D8(GyorgChildEntity*);
void sub_080486E0(GyorgChildEntity*);
void sub_080486AC(GyorgChildEntity* this) {
static void (*const gUnk_080D1E94[])(GyorgChildEntity*) = {
sub_080486D0,
sub_080486D8,
sub_080486E0,
};
if (sub_0806F520()) {
gUnk_080D1E94[super->subAction](this);
}
}
void sub_080486D0(GyorgChildEntity* this) {
super->subAction = 2;
}
void sub_080486D8(GyorgChildEntity* this) {
sub_0806F4E8(super);
}
void sub_080486E0(GyorgChildEntity* this) {
if (sub_0806F3E4(super)) {
sub_0804A7D4(super);
}
}
void sub_080486F4(GyorgChildEntity* this) {
static const s8 gUnk_080D1EA0[] = {
0x50, 0x1, 0x40, 0x1, 0x30, 0x1, 0x20, 0x1, 0x10, 0x1, 0,
0, 0x10, -0x1, 0x20, -0x1, 0x30, -0x1, 0x40, -0x1, 0x50, -0x1,
};
super->field_0x1c = 1;
super->spriteOrientation.flipY = 3;
super->spriteRendering.b3 = 3;
super->spritePriority.b0 = 7;
super->animationState = super->direction >> 2;
if (super->type == 0) {
s32 r;
InitializeAnimation(super, super->animationState);
super->action = 1;
super->flags |= 0x80;
r = (signed)Random() % 0xB;
super->direction += r;
super->direction -= 5;
super->direction &= 0x1F;
r *= 2;
super->actionDelay = gUnk_080D1EA0[r];
this->unk_7b = gUnk_080D1EA0[r + 1];
super->speed = 0x200;
} else {
super->action = 2;
super->actionDelay = 1;
super->spriteSettings.draw = 0;
}
}
void sub_0804877C(GyorgChildEntity* this) {
LinearMoveUpdate(super);
if (super->actionDelay != 0) {
if ((--super->actionDelay & 0xF) == 0) {
super->direction += this->unk_7b;
super->direction &= 0x1F;
}
}
switch (super->animationState >> 1) {
case 0:
if (super->y.HALF.HI > gRoomControls.scroll_y - 0x18) {
return;
}
break;
case 1:
if (super->x.HALF.HI < gRoomControls.scroll_x + 0x108) {
return;
}
break;
case 2:
if (super->y.HALF.HI < gRoomControls.scroll_y + 0xb8) {
return;
}
break;
default:
if (super->x.HALF.HI > gRoomControls.scroll_x - 0x18) {
return;
}
break;
}
super->action = 2;
super->actionDelay = 90;
super->spriteSettings.draw = 0;
}
void sub_0804882C(GyorgChildEntity* this) {
if (--super->actionDelay == 0) {
super->action = 3;
super->flags |= 0x80;
Random();
super->spriteSettings.draw = 1;
super->spritePriority.b0 = 4;
super->speed = this->unk_78;
super->collisionLayer = 2;
UpdateSpriteForCollisionLayer(super);
super->direction = this->unk_7a;
super->animationState = super->direction >> 2;
InitializeAnimation(super, super->animationState);
switch (super->animationState >> 1) {
case 0:
case 2:
super->x.HALF.HI = gPlayerEntity.x.HALF.HI + this->unk_74;
super->y.HALF.HI = gRoomControls.scroll_y + this->unk_76;
break;
case 1:
default:
super->x.HALF.HI = gRoomControls.scroll_x + this->unk_74;
super->y.HALF.HI = gPlayerEntity.y.HALF.HI + this->unk_76;
break;
}
if (super->type2 == 0) {
SoundReq(SFX_198);
}
}
}
void sub_08048904(GyorgChildEntity* this) {
LinearMoveUpdate(super);
GetNextFrame(super);
switch (super->animationState >> 1) {
case 0:
if (super->y.HALF.HI > gRoomControls.scroll_y - 0x28) {
return;
}
break;
case 1:
if (super->x.HALF.HI < gRoomControls.scroll_x + 0x118) {
return;
}
break;
case 2:
if (super->y.HALF.HI < gRoomControls.scroll_y + 0xc8) {
return;
}
break;
default:
if (super->x.HALF.HI > gRoomControls.scroll_x - 0x28) {
return;
}
break;
}
DeleteThisEntity();
}
+458
View File
@@ -0,0 +1,458 @@
#define NENT_DEPRECATED
#include "global.h"
#include "entity.h"
#include "enemy.h"
#include "sound.h"
#include "asm.h"
#include "functions.h"
#include "enemy/gyorg.h"
extern u8 gEntCount;
extern u8 gMapDataTopSpecial[];
extern u16 gUnk_02019EE0[];
extern void sub_080197D4(const void*);
extern u32 sub_08000E62(u32);
extern void RegisterTransitionManager(void*, void (*)(), void (*)());
void sub_08046498();
void sub_0804660C(GyorgFemaleEntity*, u32);
void sub_080464C0(GyorgFemaleEntity*);
void sub_08046634(GyorgFemaleEntity*, u32);
void sub_080465C8(void);
void sub_080466A8(GyorgFemaleEntity*);
void sub_08046668(GyorgFemaleEntity*);
void sub_08046518(void);
void sub_080467DC(GyorgFemaleEntity*);
extern u8 gUpdateVisibleTiles;
extern u8 gUnk_080B3E80[];
extern u8 gUnk_080B37A0[];
extern u16 gMetatileTypesTop[];
extern const u8 gUnk_080D1A94[];
extern const u8 gUnk_080D1AAC[];
extern const u8 gUnk_080D1AC4[];
extern const u8 gUnk_080D1ADC[];
void sub_0804614C(GyorgFemaleEntity*);
void sub_0804625C(GyorgFemaleEntity*);
void sub_0804632C(GyorgFemaleEntity*);
void sub_080463E4(GyorgFemaleEntity*);
void GyorgFemale(Entity* this) {
static void (*const gUnk_080D1A64[])(GyorgFemaleEntity*) = {
sub_0804614C,
sub_0804625C,
sub_0804632C,
sub_080463E4,
};
gUnk_080D1A64[this->action]((GyorgFemaleEntity*)this);
}
void sub_0804614C(GyorgFemaleEntity* this) {
Entity* tmp;
if (gEntCount > 0x3d)
return;
tmp = CreateProjectile(0x22);
tmp->type = 0;
tmp->parent = super;
((GyorgHeap*)super->myHeap)->unk_14 = (GenericEntity*)tmp;
tmp = CreateEnemy(GYORG_FEMALE_MOUTH, 0);
tmp->parent = super;
((GyorgHeap*)super->myHeap)->unk_10 = (GyorgFemaleMouthEntity*)tmp;
tmp = CreateEnemy(GYORG_FEMALE_EYE, 0);
tmp->parent = super;
tmp = CreateEnemy(GYORG_FEMALE_EYE, 1);
tmp->parent = super;
tmp = CreateEnemy(GYORG_FEMALE_EYE, 2);
tmp->parent = super;
tmp = CreateEnemy(GYORG_FEMALE_EYE, 3);
tmp->parent = super;
tmp = CreateEnemy(GYORG_FEMALE_EYE, 4);
tmp->parent = super;
tmp = CreateEnemy(GYORG_FEMALE_EYE, 5);
tmp->parent = super;
tmp = CreateEnemy(GYORG_FEMALE_EYE, 6);
tmp->parent = super;
tmp = CreateEnemy(GYORG_FEMALE_EYE, 7);
tmp->parent = super;
super->action = 1;
super->spriteOrientation.flipY = 2;
super->spriteRendering.b3 = 2;
super->collisionLayer = 2;
this->unk_78 = 0;
this->unk_79 = 0;
this->unk_70 = 0x3C;
MemClear(&gUnk_02019EE0, 0x8000);
MemClear(&gMapDataTopSpecial, 0x8000);
sub_0804660C(this, 0);
sub_080464C0(this);
gPlayerEntity.collisionLayer = 2;
UpdateSpriteForCollisionLayer(&gPlayerEntity);
#ifndef EU
RegisterTransitionManager(this, sub_08046498, 0);
#else
RegisterTransitionManager(this, sub_080464C0, 0);
#endif
}
void sub_0804625C(GyorgFemaleEntity* this) {
if (this->unk_79 & 0x80) {
this->unk_79 &= ~0x80;
this->unk_79 |= 0x40;
sub_0804660C(this, (this->unk_79 & 3) << 6);
} else {
if (this->unk_79 & 0x40) {
this->unk_79 &= ~0x40;
sub_080464C0(this);
}
}
sub_080465C8();
if (((GyorgHeap*)super->myHeap)->boss->unk_6c & 0x38) {
super->action = 2;
super->actionDelay = 0;
this->unk_7a = 0;
this->unk_7c = 0;
this->unk_7d = 0;
this->unk_70 = 0x3c;
this->unk_80 = 0;
return;
}
if (((GyorgHeap*)super->myHeap)->boss->unk_6c & 0x40) {
super->action = 3;
this->unk_70 = 0x3c;
super->actionDelay = 0;
this->unk_7a = 0;
this->unk_7c = 0;
this->unk_7d = 0;
this->unk_80 = 0;
return;
}
if (((GyorgHeap*)super->myHeap)->boss->unk_6c & 0x100) {
if (--this->unk_70 == 0) {
this->unk_70 = 0x168;
sub_08046634(this, 1);
}
}
}
void sub_0804632C(GyorgFemaleEntity* this) {
sub_080465C8();
sub_080466A8(this);
if (++this->unk_7a > 0x59f) {
this->unk_7a = 0;
this->unk_7c = 0;
this->unk_7d = 0;
this->unk_80 = 0;
} else {
if (this->unk_7a == 0x78) {
sub_08046668(this);
} else {
if (this->unk_7a == 0x528) {
this->unk_78 = 0;
#ifndef EU
this->unk_7d = 0;
this->unk_7f = 0;
#endif
}
}
}
if (((GyorgHeap*)super->myHeap)->boss->unk_6c & 0x80 && --this->unk_70 == 0) {
this->unk_70 = 0x168;
sub_08046634(this, 0);
}
if ((((GyorgHeap*)super->myHeap)->boss->unk_6c & 0x38) == 0) {
super->action = 1;
this->unk_70 = 0x3c;
#ifndef EU
this->unk_78 = 0;
#endif
this->unk_80 = 0;
}
}
void sub_080463E4(GyorgFemaleEntity* this) {
sub_080465C8();
if (--this->unk_70 == 0) {
this->unk_70 = 0x168;
sub_08046634(this, 1);
}
sub_080466A8(this);
if (++this->unk_7a > 0x59f) {
this->unk_7a = 0;
this->unk_7c = 0;
this->unk_7d = 0;
this->unk_80 = 0;
} else {
if (this->unk_7a == 0x78) {
sub_08046668(this);
} else {
if (this->unk_7a == 0x528) {
this->unk_78 = 0;
#ifndef EU
this->unk_7d = 0;
this->unk_7f = 0;
#endif
}
}
}
if (super->health == 0) {
super->action = 1;
#ifdef EU
this->unk_78 = 0;
#endif
this->unk_70 = 0x3c;
#ifndef EU
this->unk_78 = 0;
#endif
this->unk_80 = 0;
SoundReq(SFX_BOSS_DIE);
}
}
#ifndef EU
void sub_08046498(GyorgFemaleEntity* this) {
MemClear(&gUnk_02019EE0, 0x8000);
MemClear(&gMapDataTopSpecial, 0x8000);
sub_080464C0(this);
}
#endif
void sub_080464C0(GyorgFemaleEntity* this) {
static const void* const gUnk_080D1A74[] = {
gUnk_080D1A94,
gUnk_080D1AAC,
gUnk_080D1AC4,
gUnk_080D1ADC,
};
s32 i;
u8* src;
u8* dst;
sub_080197D4(gUnk_080D1A74[super->animationState >> 6]);
sub_08046518();
for (i = 0x20, src = ((u8*)&gUnk_02019EE0), dst = ((u8*)&gUnk_02019EE0) + 0x3260; i != 0; i--) {
MemCopy(src, dst, 0x40);
dst += 0x100;
src += 0x40;
}
MemClear(&gUnk_02019EE0, 0x800);
gUpdateVisibleTiles = 1;
}
NONMATCH("asm/non_matching/gyorg_female/sub_08046518.inc", void sub_08046518(void)) {
u32 r5;
u16* stack1;
u8* stack2;
u8* r6;
u32 i;
u16* sl;
sl = &gMetatileTypesTop[0xFFFFBCB0];
stack1 = &gMetatileTypesTop[0xFFFFECB0];
stack2 = (u8*)&gMetatileTypesTop[0x00006658];
r6 = (u8*)&gMetatileTypesTop[0xFFFFD658];
for (i = 0; i < 0x10; i++) {
sl += 0x40;
stack1 += 0x40;
for (r5 = 0; r5 < 0x10; r5++) {
stack1[r5] = sl[r5];
stack2[r5] = gUnk_080B37A0[gMetatileTypesTop[sl[r5]]];
r6[r5] = gUnk_080B3E80[gMetatileTypesTop[sl[r5]]];
}
stack2 = stack2 + 0x40;
r6 = r6 + 0x40;
}
}
END_NONMATCH
void sub_080465C8(void) {
s32 x, y;
x = (gPlayerEntity.x.HALF.HI - gRoomControls.origin_x) >> 3;
y = (gPlayerEntity.y.HALF.HI - gRoomControls.origin_y) >> 3;
if (gUnk_02019EE0[(y << 7) + x]) {
gPlayerState.field_0x14 = 1;
}
}
void sub_0804660C(GyorgFemaleEntity* this, u32 unk1) {
static const u16 gUnk_080D1A84[] = {
0x200, 0x258, 0x1B8, 0x210, 0x200, 0x1C8, 0x248, 0x210,
};
const u16* p;
super->animationState = unk1;
p = &gUnk_080D1A84[unk1 >> 5];
super->x.HALF.HI = p[0] + gRoomControls.origin_x;
super->y.HALF.HI = p[1] + gRoomControls.origin_y;
}
// todo: correct type
const u8 gUnk_080D1A94[] = {
#if defined(JP) || defined(DEMO_JP)
0x7C,
#elif defined(EU)
0x50,
#else
0x08,
#endif
0x41, 0x22, 0x80, 0xE0, 0x9E, 0x01, 0x02, 0x00, 0x08, 0x00, 0x80,
#if defined(JP) || defined(DEMO_JP)
0x2C, 0xD3,
#elif defined(EU)
0x00, 0xD3,
#else
0xB8, 0xD2,
#endif
0x22, 0x00, 0x54, 0xB6, 0x00, 0x02, 0x80, 0x1F, 0x00, 0x80,
};
const u8 gUnk_080D1AAC[] = {
#if defined(JP) || defined(DEMO_JP)
0xFC,
#elif defined(EU)
0xD0,
#else
0x88,
#endif
0x3D, 0x22, 0x80, 0xE0, 0x9E, 0x01, 0x02, 0x00, 0x08, 0x00, 0x80,
#if defined(JP) || defined(DEMO_JP)
0xF8,
#elif defined(EU)
0xCC,
#else
0x84,
#endif
0xD6, 0x22, 0x00, 0x54, 0xB6, 0x00, 0x02, 0x80, 0x1F, 0x00, 0x80,
};
const u8 gUnk_080D1AC4[] = {
#if defined(JP) || defined(DEMO_JP)
0xE4,
#elif defined(EU)
0xB8,
#else
0x70,
#endif
0x36, 0x22, 0x80, 0xE0, 0x9E, 0x01, 0x02, 0x00, 0x08, 0x00, 0x80,
#if defined(JP) || defined(DEMO_JP)
0xC0,
#elif defined(EU)
0x94,
#else
0x4C,
#endif
0xDA, 0x22, 0x00, 0x54, 0xB6, 0x00, 0x02, 0x80, 0x1F, 0x00, 0x80,
};
const u8 gUnk_080D1ADC[] = {
#if defined(JP) || defined(DEMO_JP)
0x78,
#elif defined(EU)
0x4C,
#else
0x04,
#endif
0x3A, 0x22, 0x80, 0xE0, 0x9E, 0x01, 0x02, 0x00, 0x08, 0x00, 0x80,
#if defined(JP) || defined(DEMO_JP)
0x88,
#elif defined(EU)
0x5C,
#else
0x14,
#endif
0xDE, 0x22, 0x00, 0x54, 0xB6, 0x00, 0x02, 0x80, 0x1F, 0x00, 0x80,
};
void sub_08046634(GyorgFemaleEntity* this, u32 unk1) {
static const u8 gUnk_080D1AF4[] = { 2, 3, 6, 7 };
u32 tmp;
if (unk1 == 0) {
tmp = gUnk_080D1AF4[Random() & 3];
} else {
tmp = Random() & 7;
}
sub_080A1ED0(tmp, 0, super->animationState >> 3);
}
void sub_08046668(GyorgFemaleEntity* this) {
static const u8 gUnk_080D1AF8[] = { 0x16, 0x92, 0x94, 0x86 };
if (super->health == 0) {
return;
}
#ifndef EU
if (this->unk_78 == 0xFF) {
return;
}
#endif
this->unk_78 = gUnk_080D1AF8[Random() & 3];
this->unk_7f = 0;
this->unk_82 = 0;
sub_080467DC(this);
}
void sub_080466A8(GyorgFemaleEntity* this) {
if (this->unk_7c != 0) {
this->unk_7d |= this->unk_7c;
if (super->actionDelay == 0 && this->unk_78 != 0xFF) {
#ifndef EU
super->actionDelay = 4;
#else
super->actionDelay = 3;
#endif
}
if (sub_08000E62(this->unk_7d) > 2) {
super->actionDelay = 0;
this->unk_7d = 0;
this->unk_78 = 0xFF;
SoundReq(SFX_BOSS_HIT);
if (super->health != 0) {
InitScreenShake(8, 0);
if (++this->unk_82 <= 0xC) {
super->health--;
}
if (super->health == 0) {
this->unk_78 = 0;
this->unk_7a = 0x528;
} else {
if (this->unk_7f == 0) {
this->unk_7f = 1;
this->unk_7a = 0x438;
}
}
}
sub_080467DC(this);
}
}
if (super->actionDelay != 0 && this->unk_78 != 0xFF && --super->actionDelay == 0) {
Entity* tmp;
this->unk_80 |= this->unk_7d;
this->unk_7d = 0;
sub_080467DC(this);
#ifndef EU
if (((GyorgHeap*)super->myHeap)->unk_3c != 0xFF) {
#endif
tmp = &gPlayerEntity;
tmp->knockbackDirection = ((GyorgHeap*)super->myHeap)->unk_3c;
tmp->iframes = 0xF4;
tmp->knockbackDuration = 0xA;
tmp = CreateFx(super, 0x2C, 0);
if (tmp) {
tmp->x.HALF.HI = ((GyorgHeap*)super->myHeap)->unk_38;
tmp->y.HALF.HI = ((GyorgHeap*)super->myHeap)->unk_3a;
tmp->collisionLayer = 1;
UpdateSpriteForCollisionLayer(tmp);
}
#ifndef EU
}
#endif
}
this->unk_7c = 0;
}
void sub_080467DC(GyorgFemaleEntity* this) {
u32 i;
for (i = 0; i < 8; i++) {
(*((GyorgHeap**)(&super->myHeap)))->unk_18[i] = 0;
}
}
+208
View File
@@ -0,0 +1,208 @@
#define NENT_DEPRECATED
#include "global.h"
#include "entity.h"
#include "enemy.h"
#include "player.h"
#include "functions.h"
#include "enemy/gyorg.h"
void sub_080489B4(GyorgFemaleEyeEntity*);
void sub_080489CC(GyorgFemaleEyeEntity*);
void sub_08048AF0(GyorgFemaleEyeEntity*);
void sub_08048B2C(GyorgFemaleEyeEntity*);
void sub_08048B84(GyorgFemaleEyeEntity*);
void sub_08048BB0(GyorgFemaleEyeEntity*);
void sub_08048CEC(GyorgFemaleEyeEntity*);
void sub_08048D20(GyorgFemaleEyeEntity*);
u32 sub_08048D70(GyorgFemaleEntity*);
void (*const gUnk_080D1F64[])(GyorgFemaleEyeEntity*) = {
sub_080489B4,
sub_080489CC,
(void (*)(GyorgFemaleEyeEntity*))sub_08001324,
(void (*)(GyorgFemaleEyeEntity*))sub_0804A7D4,
(void (*)(GyorgFemaleEyeEntity*))sub_08001242,
sub_080489B4,
};
void GyorgFemaleEye(Entity* this) {
if (this->parent->next == NULL) {
DeleteThisEntity();
}
gUnk_080D1F64[GetNextFunction(this)]((GyorgFemaleEyeEntity*)this);
}
void sub_080489B4(GyorgFemaleEyeEntity* this) {
static void (*const gUnk_080D1F7C[])(GyorgFemaleEyeEntity*) = {
sub_08048AF0, sub_08048B2C, sub_08048B84, sub_08048BB0, sub_08048CEC,
};
gUnk_080D1F7C[super->action](this);
}
typedef struct {
u16 x, y;
} xy;
const xy gUnk_080D1F90[] = {
{ 0x1e8, 0x1d8 }, { 0x1f8, 0x1d8 }, { 0x208, 0x1d8 }, { 0x218, 0x1d8 }, { 0x1e8, 0x1e8 }, { 0x1f8, 0x1e8 },
{ 0x208, 0x1e8 }, { 0x218, 0x1e8 }, { 0x238, 0x1f8 }, { 0x238, 0x208 }, { 0x238, 0x218 }, { 0x238, 0x228 },
{ 0x228, 0x1f8 }, { 0x228, 0x208 }, { 0x228, 0x218 }, { 0x228, 0x228 }, { 0x218, 0x248 }, { 0x208, 0x248 },
{ 0x1f8, 0x248 }, { 0x1e8, 0x248 }, { 0x218, 0x238 }, { 0x208, 0x238 }, { 0x1f8, 0x238 }, { 0x1e8, 0x238 },
{ 0x1c8, 0x228 }, { 0x1c8, 0x218 }, { 0x1c8, 0x208 }, { 0x1c8, 0x1f8 }, { 0x1d8, 0x228 }, { 0x1d8, 0x218 },
{ 0x1d8, 0x208 }, { 0x1d8, 0x1f8 },
};
const u8 gUnk_080D2010[] = {
0, 0, 1, 1, 0, 0, 1, 1, 4, 4, 5, 5, 4, 4, 5, 5, 9, 9, 8, 8, 9, 9, 8, 8, 13, 13, 12, 12, 13, 13, 12, 12,
};
const u8 gUnk_080D2030[] = {
2, 2, 3, 3, 2, 2, 3, 3, 6, 6, 7, 7, 6, 6, 7, 7, 11, 11, 10, 10, 11, 11, 10, 10, 15, 15, 14, 14, 15, 15, 14, 14,
};
void sub_080489CC(GyorgFemaleEyeEntity* this) {
GyorgFemaleEntity* parent;
if (super->health != 0xFF) {
parent = (GyorgFemaleEntity*)super->parent;
#ifndef EU
if ((parent->unk_78 >> super->type) & 1) {
#endif
parent->unk_7c |= (1 << super->type);
#ifndef EU
switch (super->bitfield & 0x7F) {
case 4 ... 6:
case 8 ... 13:
case 16 ... 18:
case 24 ... 26:
#endif
(*(((GyorgHeap**)&parent->base.myHeap)))->unk_18[super->type] = super->field_0x4c;
(*(((GyorgHeap**)&parent->base.myHeap)))->unk_38 = (gPlayerEntity.x.HALF.HI + super->x.HALF.HI) / 2;
(*(((GyorgHeap**)&parent->base.myHeap)))->unk_3a = (gPlayerEntity.y.HALF.HI + super->y.HALF.HI) / 2;
(*(((GyorgHeap**)&parent->base.myHeap)))->unk_3c = (super->knockbackDirection ^= 0x10);
#ifndef EU
break;
default:
((GyorgHeap*)parent->base.myHeap)->unk_3c = 0xFF;
break;
}
}
#endif
}
super->health = 0xFF;
sub_0804AA30(super, (void (*const*)(Entity*))gUnk_080D1F64);
}
void sub_08048AF0(GyorgFemaleEyeEntity* this) {
super->action = 1;
super->animationState = 0xFF;
super->spriteOrientation.flipY = 2;
super->spriteRendering.b3 = 2;
super->spritePriority.b0 = 7;
super->collisionLayer = 2;
sub_08048D20(this);
}
void sub_08048B2C(GyorgFemaleEyeEntity* this) {
GyorgFemaleEntity* parent;
sub_08048D20(this);
parent = (GyorgFemaleEntity*)super->parent;
if (sub_08048D70(parent)) {
if (!super->spriteSettings.draw) {
CreateFx(super, 2, 0x40);
}
super->spriteSettings.draw = 1;
} else {
super->spriteSettings.draw = 0;
}
if ((parent->unk_78 >> super->type) & 1) {
super->action = 2;
}
}
void sub_08048B84(GyorgFemaleEyeEntity* this) {
GetNextFrame(super);
if (super->frame & 0x80) {
super->action = 3;
super->flags |= 0x80;
super->hitType = 0x1E;
}
}
void sub_08048BB0(GyorgFemaleEyeEntity* this) {
GyorgFemaleEntity* parent = (GyorgFemaleEntity*)super->parent;
if (!((parent->unk_78 >> super->type) & 1)) {
if (parent->base.health != 0) {
super->action = 4;
super->flags &= ~0x80;
InitializeAnimation(super, gUnk_080D2030[(super->animationState << 3) + super->type]);
} else {
super->action = 1;
super->flags &= ~0x80;
super->spriteSettings.draw = 0;
InitializeAnimation(super, gUnk_080D2010[(super->animationState << 3) + super->type]);
CreateFx(super, 2, 0x40);
}
} else {
if ((parent->unk_80 >> super->type) & 1) {
if (super->animIndex <= 0x13) {
super->iframes = 0xF4;
super->hitType = 0x89;
InitializeAnimation(super, (parent->base.animationState >> 6) + 0x14);
SoundReq(0x119);
}
GetNextFrame(super);
if (super->frame & 0x80) {
super->hitType = 0x1E;
InitializeAnimation(super, gUnk_080D2010[(super->animationState << 3) + super->type]);
UpdateAnimationVariableFrames(super, 7);
parent->unk_80 &= ~(1 << super->type);
}
} else {
if (parent->unk_78 == 0xFF) {
u32 tmp = super->animIndex;
if (tmp < 0x10 || tmp > 0x13) {
InitializeAnimation(super, super->animationState + 0x10);
UpdateAnimationVariableFrames(super, Random() & 0x1C);
}
GetNextFrame(super);
}
}
}
}
void sub_08048CEC(GyorgFemaleEyeEntity* this) {
GetNextFrame(super);
if (super->frame & 0x80) {
super->action = 1;
InitializeAnimation(super, gUnk_080D2010[(super->animationState << 3) + super->type]);
}
}
void sub_08048D20(GyorgFemaleEyeEntity* this) {
GyorgFemaleEntity* parent = (GyorgFemaleEntity*)super->parent;
const xy* tmp;
u32 tmp2 = (parent->base.animationState >> 6);
if (tmp2 != super->animationState) {
super->animationState = tmp2;
tmp = &gUnk_080D1F90[super->type + (tmp2 << 3)];
super->x.HALF.HI = tmp->x + gRoomControls.origin_x;
super->y.HALF.HI = tmp->y + gRoomControls.origin_y;
InitializeAnimation(super, gUnk_080D2010[super->type + (tmp2 << 3)]);
}
}
u32 sub_08048D70(GyorgFemaleEntity* parent) {
GyorgMaleEntity* tmp;
if (parent->base.health != 0) {
return 1;
}
tmp = ((GyorgHeap*)parent->base.myHeap)->male1;
if (!tmp) {
tmp = ((GyorgHeap*)parent->base.myHeap)->male2;
}
if (tmp->base.health != 0) {
return 0;
}
return 1;
}
+66
View File
@@ -0,0 +1,66 @@
#define NENT_DEPRECATED
#include "global.h"
#include "player.h"
#include "room.h"
#include "enemy/gyorg.h"
extern const Hitbox gUnk_080D28DC;
extern const Hitbox gUnk_080D28E4;
extern const Hitbox gUnk_080D28EC;
extern const Hitbox gUnk_080D28F4;
extern const Hitbox gUnk_080D28FC;
extern const Hitbox gUnk_080D2904;
extern const Hitbox gUnk_080D290C;
extern const Hitbox gUnk_080D2914;
const Hitbox* const gUnk_080D28AC[] = {
&gUnk_080D28DC, &gUnk_080D28E4, &gUnk_080D28EC, &gUnk_080D28F4,
&gUnk_080D28FC, &gUnk_080D2904, &gUnk_080D290C, &gUnk_080D2914,
};
const u16 gUnk_080D28CC[] = {
0x200, 0x1C8, 0x248, 0x210, 0x200, 0x258, 0x1b8, 0x210,
};
const Hitbox gUnk_080D28DC = { 0xE0, 0xF4, { 0, 0, 0, 0 }, 0x8, 0xA };
const Hitbox gUnk_080D28E4 = { 0x20, 0xF4, { 0, 0, 0, 0 }, 0x8, 0xA };
const Hitbox gUnk_080D28EC = { 0x0C, 0xE0, { 0, 0, 0, 0 }, 0xA, 0x8 };
const Hitbox gUnk_080D28F4 = { 0x0C, 0x20, { 0, 0, 0, 0 }, 0xA, 0x8 };
const Hitbox gUnk_080D28FC = { 0xE0, 0x0C, { 0, 0, 0, 0 }, 0x8, 0xA };
const Hitbox gUnk_080D2904 = { 0x20, 0x0C, { 0, 0, 0, 0 }, 0x8, 0xA };
const Hitbox gUnk_080D290C = { 0xF4, 0xE0, { 0, 0, 0, 0 }, 0xA, 0x8 };
const Hitbox gUnk_080D2914 = { 0xF4, 0x20, { 0, 0, 0, 0 }, 0xA, 0x8 };
void GyorgFemaleMouth(Entity* this) {
u32 tmp;
if (this->parent->next == NULL) {
DeleteThisEntity();
}
if (this->action == 0) {
this->action = 1;
this->spriteOrientation.flipY = 2;
this->spriteRendering.b3 = 2;
this->spritePriority.b0 = 7;
this->collisionLayer = 2;
this->animationState = 0xFF;
}
tmp = this->parent->animationState >> 5;
if (tmp != this->animationState) {
this->animationState = tmp;
this->x.HALF.HI = gUnk_080D28CC[tmp] + gRoomControls.origin_x;
this->y.HALF.HI = gUnk_080D28CC[tmp + 1] + gRoomControls.origin_y;
InitializeAnimation(this, tmp >> 1);
} else {
GetNextFrame(this);
}
if (tmp & 2) {
if (this->y.HALF.HI < gPlayerEntity.y.HALF.HI) {
tmp++;
}
} else {
if (this->x.HALF.HI < gPlayerEntity.x.HALF.HI) {
tmp++;
}
}
this->hitbox = (Hitbox*)gUnk_080D28AC[tmp]; // discarding const qualifier with cast
}
+652 -645
View File
File diff suppressed because it is too large Load Diff
+24 -6
View File
@@ -2,11 +2,11 @@
#include "enemy.h"
#include "functions.h"
void (*const gUnk_080CF46C[])(Entity*);
void (*const gUnk_080CF484[])(Entity*);
extern void (*const gUnk_080012C8[])(Entity*);
extern void (*const gUnk_080CF46C[])(Entity*);
extern void (*const gUnk_080CF484[])(Entity*);
extern s8 gUnk_080CF490[];
extern u8 gUnk_080CF498[];
const s8 gUnk_080CF490[];
const u8 gUnk_080CF498[];
extern u16* GetLayerByIndex(u32);
extern s32 sub_080012DC(Entity*);
@@ -82,7 +82,7 @@ void sub_08037D54(Entity* this) {
if (this->frame & 0x2) {
Entity* proj = CreateProjectileWithParent(this, 1, 0);
if (proj) {
s8* ptr;
const s8* ptr;
s32 dir;
proj->direction = this->direction;
ptr = gUnk_080CF490 + (this->direction >> 2);
@@ -110,7 +110,7 @@ void sub_08037D54(Entity* this) {
void sub_08037E14(Entity* this) {
u32 dir;
u16* pLayer;
s8* ptr;
const s8* ptr;
s32 x, y;
this->actionDelay = 0x8;
dir = (GetFacingDirection(this, &gPlayerEntity) + 4) & 0x18;
@@ -144,3 +144,21 @@ bool32 sub_08037E90(Entity* this) {
return 0;
}
void (*const gUnk_080CF46C[])(Entity*) = {
sub_08037C84, sub_08037C9C, sub_08001324, sub_08037CC0, sub_08001242, sub_08037C84,
};
void (*const gUnk_080CF484[])(Entity*) = {
sub_08037CE4,
sub_08037D0C,
sub_08037D54,
};
const s8 gUnk_080CF490[] = {
0, -3, 4, 0, 0, 2, -4, 0,
};
const u8 gUnk_080CF498[] = {
0, -12, 12, 0, 0, 12, -12, 0,
};
+19
View File
@@ -0,0 +1,19 @@
#include "entity.h"
void sub_080451CC(Entity* this, Entity* other) {
u8* pThis;
u8* pOther;
other->flags = this->flags & 0xfe;
other->x.WORD = this->x.WORD;
other->y.WORD = this->y.WORD;
other->z.WORD = this->z.WORD;
pThis = (u8*)&this->field_0x68;
pOther = (u8*)&other->field_0x68;
pOther[4] = pThis[4];
pOther[5] = pThis[5];
pOther[6] = pThis[6];
pOther[7] = pThis[7];
((u16*)(pOther))[4] = ((u16*)(pThis))[4];
((u16*)(pOther))[5] = ((u16*)(pThis))[5];
}