merge master

This commit is contained in:
Henny022p
2022-01-31 17:30:51 +01:00
545 changed files with 17306 additions and 89017 deletions
+8 -18
View File
@@ -8,16 +8,6 @@
#include "enemy.h"
#include "functions.h"
extern u32 sub_080002D4(s32, s32, u32);
extern s32 sub_080012DC(Entity*);
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 Entity* gUnk_020000B0;
extern void (*const gUnk_080012C8[])(Entity*);
extern void (*const gUnk_080CE56C[])(Entity*);
@@ -114,7 +104,7 @@ void sub_080318DC(Entity* this) {
void sub_08031A60(Entity* this) {
if (this->iframes > 0)
GravityUpdate(this, 0x1800);
GravityUpdate(this, Q_8_8(24.0));
sub_08001324(this);
}
@@ -305,7 +295,7 @@ u32 sub_08031E04(Entity* this) {
return 0;
tmp = &gUnk_080CE5C0[this->frame & 6];
return sub_0806FCB8(this, ent->x.HALF.HI + tmp[0], ent->y.HALF.HI + tmp[1], 0x50);
return EntityWithinDistance(this, ent->x.HALF.HI + tmp[0], ent->y.HALF.HI + tmp[1], 0x50);
}
void sub_08031E48(Entity* this, Entity* child) {
@@ -325,7 +315,7 @@ void sub_08031E90(Entity* this) {
void sub_08031EA8(Entity* this) {
this->action = 1;
this->spritePriority.b1 = 1;
this->zVelocity = 0x40000;
this->zVelocity = Q_16_16(4.0);
this->z.HALF.HI = (4 - this->type2) * 0xe;
this->field_0x78.HALF.HI = Random();
InitializeAnimation(this, 4);
@@ -335,12 +325,12 @@ void sub_08031EE8(Entity* this) {
int draw;
this->z.WORD -= this->zVelocity;
this->zVelocity -= 0x1800;
this->zVelocity -= Q_16_16(3.0 / 32.0);
if (this->z.HALF.HI < 1) {
draw = this->spriteSettings.draw;
if (!draw)
EnqueueSFX(299);
EnqueueSFX(SFX_12B);
this->spriteSettings.draw = 1;
}
@@ -413,7 +403,7 @@ void sub_08032008(Entity* this) {
ProcessMovement(this);
} else {
if (this->field_0x76.HALF.HI == 0) {
if (sub_0806FCB8(this, parent->x.HALF.HI, parent->y.HALF.HI, 1) == 0) {
if (EntityWithinDistance(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);
@@ -452,7 +442,7 @@ void sub_08032160(Entity* this) {
this->spriteSettings.flipX = 0;
}
this->speed = 0xf0;
this->zVelocity = 0x12000;
this->zVelocity = Q_16_16(1.125);
this->spritePriority.b1 = 1;
InitializeAnimation(this, 12);
}
@@ -487,7 +477,7 @@ void sub_08032204(Entity* this) {
}
void sub_08032248(Entity* this) {
if (GravityUpdate(this, 0x1800) == 0) {
if (GravityUpdate(this, Q_8_8(24.0)) == 0) {
if (this->frame & 0x80) {
((Entity*)this->field_0x7c.WORD)->actionDelay--;
+342
View File
@@ -0,0 +1,342 @@
#define NENT_DEPRECATED
#include "entity.h"
#include "enemy.h"
#include "functions.h"
typedef struct {
Entity base;
u8 filler[0x10];
u16 unk_78;
u8 unk_7a;
u8 unk_7b;
u8 unk_7c;
u8 unk_7d;
u8 unk_7e;
u8 unk_7f;
} BallChainSoldierEntity;
extern Entity* gUnk_020000B0;
void (*const gUnk_080D06E0[])(BallChainSoldierEntity*);
void (*const gUnk_080D06F8[])(BallChainSoldierEntity*);
const u8 gUnk_080D0724[];
const u16 gUnk_080D0728[];
const u16 gUnk_080D0730[];
extern u32 sub_0804A044(Entity*, Entity*, u32);
extern void sub_0803E86C(BallChainSoldierEntity*);
extern void sub_0803E9A4(BallChainSoldierEntity*);
extern bool32 sub_0803E9D4(BallChainSoldierEntity*);
extern void sub_0803E8CC(BallChainSoldierEntity*);
extern void sub_0803E92C(BallChainSoldierEntity*);
extern bool32 sub_0803EA64(BallChainSoldierEntity*);
extern void sub_0803E94C(BallChainSoldierEntity*, u32);
extern bool32 sub_0803EAD0(BallChainSoldierEntity*, u32);
void BallChainSoldier(Entity* this) {
EnemyFunctionHandler(this, (EntityActionArray)gUnk_080D06E0);
}
void sub_0803E538(BallChainSoldierEntity* this) {
gUnk_080D06F8[super->action](this);
}
void sub_0803E550(BallChainSoldierEntity* this) {
sub_0804AA30(super, gUnk_080D06E0);
}
void sub_0803E560(BallChainSoldierEntity* this) {
sub_08001324(super);
sub_0803E538(this);
}
void BallChainSoldier_CreateDeathFx(BallChainSoldierEntity* this) {
CreateDeathFx(super, 0xff, 0x57);
}
void nullsub_20(BallChainSoldierEntity* this) {
}
void BallChainSoldier_Init(BallChainSoldierEntity* this) {
Entity* ent;
sub_0804A720(super);
ent = CreateProjectileWithParent(super, BALL_AND_CHAIN, 0);
if (ent == NULL)
return;
ent->parent = super;
super->child = ent;
COLLISION_ON(super);
super->spriteSettings.draw = 1;
super->animationState = Random() & 3;
this->unk_7b = 0;
this->unk_7c = 0;
this->unk_7e = 0x20;
this->unk_7f = 0xfe;
InitAnimationForceUpdate(super, super->animationState << 2);
sub_0803E86C(this);
}
void sub_0803E5E8(BallChainSoldierEntity* this) {
this->unk_7c -= 0xa;
sub_0803E9A4(this);
if (sub_0803E9D4(this) == 0) {
if (--this->unk_78 == 0) {
sub_0803E8CC(this);
}
}
}
void sub_0803E61C(BallChainSoldierEntity* this) {
this->unk_7c -= 0xa;
sub_0803E9A4(this);
if (sub_0803E9D4(this) == 0) {
if (super->knockbackDuration == 0) {
if (ProcessMovement(super) == 0) {
sub_0803E86C(this);
return;
}
}
if (--this->unk_78 == 0) {
sub_0803E92C(this);
}
}
}
void sub_0803E66C(BallChainSoldierEntity* this) {
this->unk_7c -= 0x10;
sub_0803E9A4(this);
if (this->unk_7e <= 0x21) {
this->unk_7e++;
}
if (!sub_08049FDC(super, 1) || sub_0803EA64(this) == 0) {
super->action = 4;
this->unk_7b = 0;
}
}
void sub_0803E6B4(BallChainSoldierEntity* this) {
this->unk_7c -= 0xa;
sub_0803E9A4(this);
if (this->unk_7e > 0x20) {
this->unk_7e--;
} else {
sub_0803E86C(this);
}
}
void sub_0803E6E0(BallChainSoldierEntity* this) {
this->unk_7c -= 0xc;
sub_0803E9A4(this);
this->unk_7e -= 4;
if ((s8)this->unk_7e <= 0) {
this->unk_7e = 0;
super->action = 6;
super->actionDelay = 0x1e;
InitAnimationForceUpdate(super, super->animationState + 0x20);
}
}
void sub_0803E71C(BallChainSoldierEntity* this) {
if (--super->actionDelay == 0) {
super->action = 7;
super->actionDelay = 1;
this->unk_7c = gUnk_080D0724[super->animationState];
this->unk_7b = 0;
this->unk_7f = 0xf6;
EnqueueSFX(SFX_15B);
}
}
void sub_0803E75C(BallChainSoldierEntity* this) {
if ((super->frame & 0x80) == 0) {
UpdateAnimationSingleFrame(super);
} else {
if (--super->actionDelay == 0) {
super->actionDelay = 2;
this->unk_7f++;
}
if (this->unk_7f) {
this->unk_7e += 5;
} else {
super->action = 8;
super->actionDelay = 0x1e;
InitScreenShake(8, 0);
}
}
}
void sub_0803E7B4(BallChainSoldierEntity* this) {
if (--super->actionDelay == 0) {
super->action = 9;
}
}
void sub_0803E7CC(BallChainSoldierEntity* this) {
this->unk_7e -= 2;
if (this->unk_7e <= 0xa) {
super->action = 0xa;
super->actionDelay = 0x5a;
super->direction = DirectionFromAnimationState(super->animationState);
this->unk_7c = 0;
this->unk_7f = 0xfe;
sub_0803E94C(this, 0x10);
} else if (this->unk_7e <= 0x12) {
COLLISION_OFF(super->child);
}
}
void sub_0803E818(BallChainSoldierEntity* this) {
if (super->actionDelay) {
if (--super->actionDelay == 0) {
COLLISION_ON(super->child);
sub_0803E94C(this, 0);
}
} else {
this->unk_7c -= 0xa;
sub_0803E9A4(this);
if (++this->unk_7e > 0x1f) {
sub_0803E86C(this);
}
}
}
void sub_0803E86C(BallChainSoldierEntity* this) {
if (sub_08049FDC(super, 1) && sub_0803EAD0(this, 0x50)) {
super->direction = DirectionRoundUp(GetFacingDirection(super, gUnk_020000B0));
}
super->action = 1;
this->unk_78 = gUnk_080D0728[Random() & 3];
this->unk_7a = 4;
sub_0803E94C(this, 0);
}
void sub_0803E8CC(BallChainSoldierEntity* this) {
u32 rand = Random();
u32 temp;
u32 dir;
if (sub_08049FA0(super) == 0 && (rand & 3)) {
dir = sub_08049EE4(super) + 4;
temp = 0x18;
} else {
temp = 0x18;
dir = rand;
}
super->direction = dir & temp;
super->action = 2;
this->unk_78 = gUnk_080D0730[(rand >> 0x10) & 3];
this->unk_7a = 4;
sub_0803E94C(this, 0x10);
}
void sub_0803E92C(BallChainSoldierEntity* this) {
if (Random() & 1) {
sub_0803E86C(this);
} else {
sub_0803E8CC(this);
}
}
void sub_0803E94C(BallChainSoldierEntity* this, u32 arg2) {
s32 animationState = DirectionToAnimationState(super->direction);
if ((super->animIndex & 0x10) == arg2) {
u32 dir = super->direction & 7;
s32 currentAnimationState = super->animationState;
if (dir == 4) {
if (((currentAnimationState - (super->direction >> 3)) & 3) <= 1)
return;
}
if (animationState == currentAnimationState)
return;
}
super->animationState = animationState;
animationState = arg2 + (super->animIndex & 3) + animationState * 4;
InitAnimationForceUpdate(super, animationState);
}
void sub_0803E9A4(BallChainSoldierEntity* this) {
s32 val = ((this->unk_7c + 0x20) & 0xff) >> 6;
if ((super->animIndex & 3) == val)
return;
InitAnimationForceUpdate(super, val + (super->animIndex & -4));
}
bool32 sub_0803E9D4(BallChainSoldierEntity* this) {
u32 dir;
if (sub_08049FDC(super, 1)) {
if (sub_0803EAD0(this, 0x38)) {
super->action = 3;
super->direction = DirectionRoundUp(GetFacingDirection(super, gUnk_020000B0));
this->unk_7b = 1;
sub_0803E94C(this, 0);
return 1;
} else if (sub_0803EAD0(this, 0x4e)) {
dir = sub_0804A044(super, gUnk_020000B0, 0x12);
if (dir != 0xff) {
if (--this->unk_7a != 0)
return 0;
super->action = 5;
super->direction = dir;
this->unk_7a = 4;
sub_0803E94C(this, 0);
return 1;
}
}
}
this->unk_7a = 4;
return 0;
}
bool32 sub_0803EA64(BallChainSoldierEntity* this) {
u32 dir;
if (sub_08049FDC(super, 1)) {
if (sub_0803EAD0(this, 0x4e)) {
dir = sub_0804A044(super, gUnk_020000B0, 0x12);
if (dir != 0xff) {
if (--this->unk_7a != 0)
return 1;
super->action = 5;
super->direction = dir;
sub_0803E94C(this, 0);
return 1;
}
}
if (sub_0803EAD0(this, 0x38))
return 1;
}
this->unk_7a = 4;
return 0;
}
bool32 sub_0803EAD0(BallChainSoldierEntity* this, u32 distance) {
return EntityWithinDistance(super, gUnk_020000B0->x.HALF.HI, gUnk_020000B0->y.HALF.HI - 4, distance);
}
void (*const gUnk_080D06E0[])(BallChainSoldierEntity*) = {
sub_0803E538,
sub_0803E550,
sub_0803E560,
BallChainSoldier_CreateDeathFx,
(void (*const)(BallChainSoldierEntity*))sub_08001242,
nullsub_20,
};
void (*const gUnk_080D06F8[])(BallChainSoldierEntity*) = {
BallChainSoldier_Init, sub_0803E5E8, sub_0803E61C, sub_0803E66C, sub_0803E6B4, sub_0803E6E0,
sub_0803E71C, sub_0803E75C, sub_0803E7B4, sub_0803E7CC, sub_0803E818,
};
const u8 gUnk_080D0724[] = { 0, 0x44, 0x80, 0xBC };
const u16 gUnk_080D0728[] = { 0x1E, 0x32, 0x46, 0x5A };
const u16 gUnk_080D0730[] = { 0x3C, 0x5A, 0x78, 0x96 };
+5 -5
View File
@@ -109,7 +109,7 @@ void sub_080218CC(Entity* this) {
this->spriteSettings.draw = 1;
this->direction = ((sub_08049F84(this, 1) ^ 0x10) + gUnk_080CB5DC[Random() & 7]) & 0x1f;
this->speed = 0x100;
this->zVelocity = 0x12000;
this->zVelocity = Q_16_16(1.125);
}
GetNextFrame(this);
@@ -137,7 +137,7 @@ void sub_08021984(Entity* this) {
this->z.HALF.HI = -0x80;
this->spriteRendering.b3 = 1;
this->spriteOrientation.flipY = 1;
EnqueueSFX(0x12d);
EnqueueSFX(SFX_12D);
}
if (GravityUpdate(this, 0x1800) == 0) {
@@ -204,7 +204,7 @@ void sub_08021AD8(Entity* this) {
return;
}
this->direction = (u8)tmp;
EnqueueSFX(0x7c);
EnqueueSFX(SFX_PLY_JUMP);
}
sub_080AEFE0(this);
if (!GravityUpdate(this, 0x1800))
@@ -242,7 +242,7 @@ void sub_08021B64(Entity* this) {
if (iVar4 == 0) {
this->action = 6;
this->zVelocity = 0x10000;
this->zVelocity = Q_16_16(1.0);
((u8*)&this->field_0x86)[1] = 0;
if (gPlayerEntity.direction != 0xff) {
this->direction = 0x10 ^ gPlayerEntity.direction;
@@ -303,7 +303,7 @@ u32 sub_08021D00(Entity* this) {
} else {
this->action = 4;
this->actionDelay = 1;
this->zVelocity = 0x18000;
this->zVelocity = Q_16_16(1.5);
InitializeAnimation(this, 4);
ret = 1;
}
+1 -1
View File
@@ -24,7 +24,7 @@ void BladeTrap(Entity* this) {
if (!(--this->field_0x74.HWORD)) {
if (!(this->direction & 0x80)) {
EnqueueSFX(0x74);
EnqueueSFX(SFX_METAL_CLINK);
}
sub_080A2CC0(this, &this->child, &this->field_0x74.HWORD);
}
+6 -6
View File
@@ -55,13 +55,13 @@ void sub_0802C688(Entity* this) {
switch (this->field_0x82.HALF.LO) {
case 1:
sub_0802CB68(this);
EnqueueSFX(0x14d);
EnqueueSFX(SFX_14D);
break;
case 2:
this->action = 3;
this->hitType = 0x6e;
this->field_0xf = 1;
this->zVelocity = 0x18000;
this->zVelocity = Q_16_16(1.5);
this->speed = 0;
this->field_0x80.HALF.HI = 1;
InitializeAnimation(this, this->direction >> 4 | 6);
@@ -79,7 +79,7 @@ void sub_0802C7AC(Entity* this) {
if (this->field_0x82.HALF.LO != 2) {
this->speed = this->field_0x82.HALF.LO ? 0x200 : 0x80;
}
this->zVelocity = 0x18000;
this->zVelocity = Q_16_16(1.5);
this->field_0x82.HALF.HI = 0;
this->field_0x80.HALF.HI = 0;
} else {
@@ -232,7 +232,7 @@ void sub_0802CA94(Entity* this) {
COLLISION_OFF(this);
this->field_0xf = 1;
this->spritePriority.b1 = 1;
this->zVelocity = 0x18000;
this->zVelocity = Q_16_16(1.5);
this->speed = 0;
this->field_0x82.HALF.HI = 0;
this->field_0x80.HALF.HI = 0;
@@ -245,7 +245,7 @@ void sub_0802CAF8(Entity* this) {
sub_0802CBC4(this);
} else {
if (this->field_0x80.HALF.HI && sub_080044EC(this, 0x2800) == 1) {
EnqueueSFX(0x104);
EnqueueSFX(SFX_104);
}
sub_0802CC18(this);
sub_08078930(this);
@@ -300,7 +300,7 @@ void sub_0802CBC4(Entity* this) {
void sub_0802CC18(Entity* this) {
if (--this->field_0x80.HALF.LO == 0) {
this->field_0x80.HALF.LO = 28;
EnqueueSFX(0x14d);
EnqueueSFX(SFX_14D);
}
}
+92 -26
View File
@@ -12,12 +12,6 @@
#include "object.h"
#include "functions.h"
extern void sub_08078954(Entity*);
extern void sub_08078930(Entity*);
extern s32 sub_080012DC(Entity*);
extern Entity* sub_08049DF4(u32);
extern void sub_08079BD8(Entity*);
void sub_0802AD1C(Entity*, u32);
void sub_0802AD54(Entity*);
void sub_0802B048(Entity*);
@@ -194,9 +188,6 @@ void sub_0802AA40(Entity* this) {
}
}
#ifdef EU
ASM_FUNC("asm/non_matching/eu/sub_0802AAC0.inc", void sub_0802AAC0(Entity* this))
#else
void sub_0802AAC0(Entity* this) {
sub_0802AC40(this);
if (--this->field_0xf == 0) {
@@ -210,24 +201,52 @@ void sub_0802AAC0(Entity* this) {
} else if (ent->next == NULL) {
this->field_0x80.HALF.HI = 0;
this->child = NULL;
#ifdef EU
} else if (ent->actionDelay == 0) {
if (sub_080002E0(COORD_TO_TILE(this), 1) == 0) {
if (EntityInRectRadius(this, &gPlayerEntity, 0x10, 0x10) && ent->field_0xf <= 0x50) {
this->field_0x80.HALF.HI = 0;
}
} else if (ent->field_0xf <= 0x13) {
this->field_0x80.HALF.HI = 0;
}
}
#else
} else if (ent->actionDelay == 0 && ent->field_0xf < 0x51) {
this->field_0x80.HALF.HI = 0;
}
#endif
} else {
this->action = 4;
this->actionDelay = 0xc0;
this->field_0xf = 4;
this->field_0x80.HALF.LO ^= 1;
#ifndef EU
this->field_0x78.HALF.LO = 0;
this->field_0x78.HALF.HI = 4;
this->direction = 0xff;
#endif
InitializeAnimation(this, 0);
}
}
#endif
#ifdef EU
ASM_FUNC("asm/non_matching/eu/sub_0802AB40.inc", void sub_0802AB40(Entity* this));
void sub_0802AB40(Entity* this) {
sub_0802AC40(this);
if (--this->actionDelay == 0) {
if (this->field_0x7a.HALF.LO <= 4) {
this->action = 5;
this->speed = 0;
InitializeAnimation(this, this->type + 1);
} else {
this->actionDelay = 0xc0;
this->field_0xf = 0x4;
this->field_0x80.HALF.LO ^= 1;
}
} else if ((--this->field_0xf & 0xff) == 0) {
sub_0802ACDC(this, 4);
}
}
#else
void sub_0802AB40(Entity* this) {
sub_0802AC40(this);
@@ -281,9 +300,6 @@ void sub_0802AC08(Entity* this) {
GetNextFrame(this);
}
#ifdef EU
ASM_FUNC("asm/non_matching/eu/sub_0802AC40.inc", void sub_0802AC40(Entity* this))
#else
void sub_0802AC40(Entity* this) {
GetNextFrame(this);
LinearMoveUpdate(this);
@@ -291,6 +307,7 @@ void sub_0802AC40(Entity* this) {
if (sub_0802B234(this) == 0) {
this->field_0x7a.HALF.LO = 0;
this->spritePriority.b1 = 0;
#ifndef EU
} else {
if (this->z.HALF.HI == 0) {
if (this->spritePriority.b1 != 1) {
@@ -301,19 +318,23 @@ void sub_0802AC40(Entity* this) {
this->spritePriority.b1 = 3;
}
}
#endif
}
} else {
if (sub_0802B234(this)) {
this->field_0x7a.HALF.LO = 1;
#ifndef EU
if (this->z.HALF.HI == 0) {
this->spritePriority.b1 = 1;
} else {
this->spritePriority.b1 = 3;
}
#else
this->spritePriority.b1 = 3;
#endif
}
}
}
#endif
void sub_0802ACDC(Entity* this, u32 param_2) {
u32 x;
@@ -362,10 +383,6 @@ void sub_0802AD54(Entity* this) {
}
}
#ifdef EU
// TODO regalloc in EU version
ASM_FUNC("asm/non_matching/eu/sub_0802ADDC.inc", void sub_0802ADDC(Entity* this))
#else
void sub_0802ADDC(Entity* this) {
Entity* ent = CreateEnemy(BOMB_PEAHAT, this->type + 2);
if (ent != NULL) {
@@ -373,21 +390,20 @@ void sub_0802ADDC(Entity* this) {
ent->parent = this;
this->child = ent;
CopyPosition(this, ent);
/*#ifdef EU
this->z.HALF.HI += 8;
#endif*/
#ifdef EU
ent->z.HALF.HI += 8;
#endif
this->field_0x80.HALF.HI = 1;
if (this->type == 0) {
this->field_0x7a.HALF.LO++;
}
}
}
#endif
void sub_0802AE24(Entity* this) {
this->action = 1;
this->actionDelay = 0xf0;
this->zVelocity = 0x8000;
this->zVelocity = Q_16_16(0.5);
this->hitbox = (Hitbox*)&gUnk_080CD174;
this->field_0x3c = 3;
this->field_0x16 = 0;
@@ -398,7 +414,30 @@ void sub_0802AE24(Entity* this) {
}
#ifdef EU
ASM_FUNC("asm/non_matching/eu/sub_0802AE68.inc", void sub_0802AE68(Entity* this))
void sub_0802AE68(Entity* this) {
Entity* ent = this->parent;
if (ent == 0) {
this->action = 3;
this->spriteSettings.draw = 1;
this->field_0x80.HALF.LO = 1;
}
if (ent->field_0x80.HALF.HI) {
CopyPosition(ent, this);
this->z.HALF.HI += 8;
this->spriteSettings.draw = 0;
} else {
this->action = 3;
this->field_0x80.HALF.LO = 1;
this->spriteSettings.draw = 1;
if (sub_0802B234(this)) {
this->spritePriority.b1 = 3;
} else {
this->spritePriority.b1 = 0;
}
GetNextFrame(this);
}
}
#else
void sub_0802AE68(Entity* this) {
Entity* ent = sub_0802B250(this);
@@ -575,7 +614,34 @@ void sub_0802B1A0(Entity* this) {
}
#ifdef EU
ASM_FUNC("asm/non_matching/eu/sub_0802B1BC.inc", void sub_0802B1BC(Entity* this))
void sub_0802B1BC(Entity* this) {
Entity* ent;
if (this->actionDelay) {
this->actionDelay--;
}
ent = this->parent;
if (ent == 0) {
this->action = 2;
this->spriteSettings.draw = 1;
}
if (ent->field_0x80.HALF.HI) {
CopyPosition(ent, this);
this->z.HALF.HI += 8;
} else {
this->action = 2;
this->spriteSettings.draw = 1;
if (sub_0802B234(this)) {
this->spritePriority.b1 = 3;
} else {
this->spritePriority.b1 = 0;
}
GetNextFrame(this);
}
}
#else
void sub_0802B1BC(Entity* this) {
Entity* ent;
-2
View File
@@ -33,8 +33,6 @@ void sub_0803C714(BowMoblinEntity*);
void sub_0803C634(BowMoblinEntity*);
u32 sub_0803C6F8(BowMoblinEntity*);
u32 sub_0803C568(BowMoblinEntity*);
extern Entity* sub_08049DF4(u32);
extern u32 sub_0806FC80(Entity*, Entity*, s32);
void sub_0803C664(BowMoblinEntity*);
void (*const gUnk_080CFF78[])(Entity*);
+3 -8
View File
@@ -14,15 +14,10 @@
#include "game.h"
#include "item.h"
extern Entity* sub_08049DF4(u32);
extern bool32 sub_08056338(void);
extern void UnloadOBJPalette(Entity*);
bool32 sub_0802915C(Entity*);
bool32 sub_080291DC(Entity*);
void sub_0802922C(Entity*);
void sub_08028E9C(Entity*);
u32 sub_080001DA(u32, u32);
void sub_08028FFC(Entity*);
void sub_0802925C(Entity*);
void sub_080290E0(Entity*, u32);
@@ -70,7 +65,7 @@ void sub_08028934(Entity* this) {
if (pEVar1 != NULL) {
pEVar1->z.HALF.HI -= 8;
}
EnqueueSFX(0x1bb);
EnqueueSFX(SFX_EM_DEKUSCRUB_HIT);
}
}
@@ -94,7 +89,7 @@ void sub_08028994(Entity* this) {
} else {
this->actionDelay = 0;
this->field_0x76.HWORD = COORD_TO_TILE(this);
this->field_0x74.HWORD = sub_080001DA(this->field_0x76.HWORD, this->collisionLayer);
this->field_0x74.HWORD = GetTileIndex(this->field_0x76.HWORD, this->collisionLayer);
this->hurtType = 0x41;
sub_08028FFC(this);
}
@@ -302,7 +297,7 @@ void sub_08028CE8(Entity* this) {
}
void sub_08028DE8(Entity* this) {
if (gPlayerEntity.action == 8) {
if (gPlayerEntity.action == PLAYER_ITEMGET) {
if (this->field_0x80.HALF.HI == 0) {
SetPlayerControl(1);
this->field_0x80.HALF.HI = 1;
+5 -5
View File
@@ -220,7 +220,7 @@ void sub_0801F1B0(Entity* this) {
if (this->frame & 1) {
this->frame ^= 1;
this->hitType = 90;
EnqueueSFX(299);
EnqueueSFX(SFX_12B);
}
sub_080AEFE0(this);
if (GravityUpdate(this, 0x4000) == 0)
@@ -416,7 +416,7 @@ void sub_0801F584(Entity* this) {
if (this->frame & 0x1) {
this->frame ^= 1;
this->hitType = 91;
EnqueueSFX(299);
EnqueueSFX(SFX_12B);
}
sub_080AEFE0(this);
if (GravityUpdate(this, 0x4000) == 0)
@@ -564,7 +564,7 @@ void sub_0801F884(Entity* this) {
ent->type2 = 64;
this->action = 4;
this->hitType = 165;
EnqueueSFX(0x193);
EnqueueSFX(SFX_193);
}
}
}
@@ -593,7 +593,7 @@ void sub_0801F940(Entity* this) {
if (this->frame & 0x10) {
if (this->frame & 1) {
this->frame ^= 1;
EnqueueSFX(299);
EnqueueSFX(SFX_12B);
}
sub_080AEFE0(this);
if (GravityUpdate(this, 0x4000) == 0)
@@ -722,7 +722,7 @@ u32 sub_0801FBD0(Entity* this) {
void Chuchu_JumpAtPlayer(Entity* this) {
this->speed = 0x180;
this->zVelocity = 0x20000;
this->zVelocity = Q_16_16(2.0);
this->direction = sub_08049F84(this, 1);
InitializeAnimation(this, 3);
}
-2
View File
@@ -20,8 +20,6 @@ void (*const gUnk_080CE990[])(CrowEntity*);
void (*const gUnk_080CE9A4[])(CrowEntity*);
extern Entity* gUnk_020000B0;
extern Entity* sub_08049DF4(u32);
void sub_08032AF4(CrowEntity* this);
void sub_08032AB0(CrowEntity* this);
void sub_08032B38(CrowEntity* this);
+383
View File
@@ -0,0 +1,383 @@
#define NENT_DEPRECATED
#include "entity.h"
#include "enemy.h"
#include "functions.h"
typedef struct {
Entity base;
u8 filler[0x10];
u16 unk_78;
u8 unk_7a;
u8 unk_7b;
} CuccoAggrEntity;
extern void (*const gUnk_080012C8[])(Entity*);
typedef struct {
u16 x;
u16 y;
} PosOffset;
void (*const gUnk_080CF778[])(Entity*);
void (*const gUnk_080CF790[])(CuccoAggrEntity*);
void (*const gUnk_080CF7AC[])(CuccoAggrEntity*);
const u8 gUnk_080CF7BC[];
const u8 gUnk_080CF7BE[];
const u8 gUnk_080CF7C2[];
const PosOffset gCuccoAggrSpawnPoints[];
const u16 gUnk_080CF824[];
const u16 gUnk_080CF828[];
const s8 gCuccoAggrFxHorizontalOffsets[];
const u8 gCuccoAggrFx[];
extern void sub_080391B4(CuccoAggrEntity* this);
extern void sub_08039218(CuccoAggrEntity* this);
extern void CuccoAggr_CreateFx(CuccoAggrEntity* this);
extern void sub_08039120(CuccoAggrEntity* this);
extern void sub_08039140(CuccoAggrEntity* this);
extern void sub_0803901C(CuccoAggrEntity* this);
extern void sub_08039298(CuccoAggrEntity* this);
extern void sub_080390F8(CuccoAggrEntity* this);
extern void sub_080390C0(CuccoAggrEntity* this);
extern bool32 CuccoAggr_IsOutsideScroll(CuccoAggrEntity* this);
void CuccoAggr(Entity* this) {
u32 index = sub_080012DC(this);
if (index) {
gUnk_080012C8[index](this);
} else {
gUnk_080CF778[GetNextFunction(this)](this);
SetChildOffset(this, 0, 1, -0x10);
sub_080391B4((CuccoAggrEntity*)this);
}
}
void sub_08038CF8(CuccoAggrEntity* this) {
gUnk_080CF790[super->action](this);
}
void sub_08038D10(CuccoAggrEntity* this) {
if (super->type != 2) {
if (this->unk_7a == 0 && CheckRoomFlag(1) == 0) {
if (super->health <= 0xbf) {
this->unk_7a = 1;
}
} else {
super->health = 0xff;
}
sub_08039218(this);
CuccoAggr_CreateFx(this);
}
if (super->field_0x43) {
sub_0804A9FC(super, 0x1c);
}
sub_0804AA30(super, gUnk_080CF778);
}
void nullsub_165(CuccoAggrEntity* this) {
}
void sub_08038D78(CuccoAggrEntity* this) {
sub_0804A720(super);
if (super->type != 2) {
super->type2 = 0;
super->field_0x16 = 0x30;
sub_08039120(this);
} else {
sub_08039140(this);
}
}
void sub_08038DA0(CuccoAggrEntity* this) {
if (--super->actionDelay == 0) {
sub_0803901C(this);
}
sub_08039298(this);
}
void sub_08038DC0(CuccoAggrEntity* this) {
gUnk_080CF7AC[super->subAction](this);
}
void sub_08038DD8(CuccoAggrEntity* this) {
super->subAction = 1;
super->actionDelay = 0x10;
super->field_0xf = gUnk_080CF7BC[super->type];
COLLISION_OFF(super);
super->spritePriority.b1 = 0;
InitializeAnimation(super, 4);
EnqueueSFX(SFX_VO_CUCCO4);
}
void sub_08038E18(CuccoAggrEntity* this) {
if (super->field_0xf) {
if (--super->field_0xf == 0) {
sub_08079184();
sub_08039218(this);
COLLISION_ON(super);
super->spritePriority.b1 = 1;
super->spritePriority.b0 = 4;
super->direction = Random() & 0x1f;
ProcessMovement(super);
UpdateSpriteForCollisionLayer(super);
}
}
if (--super->actionDelay == 0) {
super->actionDelay = 0x10;
super->spriteSettings.flipX ^= (Random() & 1);
CuccoAggr_CreateFx(this);
}
GetNextFrame(super);
}
void sub_08038EAC(CuccoAggrEntity* this) {
super->spritePriority.b1 = 1;
sub_080390F8(this);
GetNextFrame(super);
}
void sub_08038ED0(CuccoAggrEntity* this) {
COLLISION_ON(super);
sub_08039218(this);
}
void sub_08038EE0(CuccoAggrEntity* this) {
ProcessMovement(super);
GetNextFrame(super);
sub_08039298(this);
if (GravityUpdate(super, 0x1C00) == 0) {
if (--super->actionDelay == 0) {
sub_0803901C(this);
} else {
super->zVelocity = 0x8000;
}
}
}
void sub_08038F20(CuccoAggrEntity* this) {
sub_08039298(this);
GetNextFrame(super);
if (super->frame & 0x80) {
sub_0803901C(this);
}
}
void sub_08038F44(CuccoAggrEntity* this) {
super->direction = GetFacingDirection(&gPlayerEntity, super);
sub_080390F8(this);
ProcessMovement(super);
sub_080044EC(super, 0x1800);
GetNextFrame(super);
sub_08039298(this);
if (--this->unk_78 == 0) {
sub_08039120(this);
} else if ((this->unk_78 & 0x1f) == 0) {
CuccoAggr_CreateFx(this);
}
}
void sub_08038FA0(CuccoAggrEntity* this) {
if ((super->actionDelay++ & 0x1f) == 0) {
CuccoAggr_CreateFx(this);
}
if (this->unk_78) {
if ((this->unk_78-- & 0x7) == 0) {
sub_08004596(super, GetFacingDirection(super, &gPlayerEntity));
}
sub_080390F8(this);
LinearMoveUpdate(super);
GetNextFrame(super);
} else {
LinearMoveUpdate(super);
GetNextFrame(super);
if (CuccoAggr_IsOutsideScroll(this)) {
DeleteEntity(super);
}
}
}
void sub_0803901C(CuccoAggrEntity* this) {
u32 r3 = Random();
u32 r5 = r3 & 3;
//! @bug This if was meant to check r5 instead of r3.
// The result is that this if practically never happens and
// there's a higher chance of the default branch of the next switch.
if (r3 == 3) {
switch (super->action) {
case 3:
r5 = 1;
break;
case 4:
r5 = 2;
break;
default:
r5 = 0;
}
}
switch (r5) {
default:
super->action = 1;
super->actionDelay = gUnk_080CF7BE[(r3 >> 0x10) & 3];
InitializeAnimation(super, 0);
break;
case 1:
super->action = 3;
super->actionDelay = ((r3 >> 8) & 3) + 2;
super->zVelocity = 0x8000;
sub_080390C0(this);
InitializeAnimation(super, 1);
if (Random() & 1) {
r5 = Random() & 1;
EnqueueSFX(SFX_VO_CUCCO1 + r5);
}
break;
case 2:
super->action = 4;
InitializeAnimation(super, ((r3 >> 0x10) & 1) + 2);
break;
}
}
void sub_080390C0(CuccoAggrEntity* this) {
u32 rand = Random();
if (sub_08049FA0(super) && (rand & 1)) {
super->direction = (rand >> 0x10) & 0x1c;
} else {
super->direction = (sub_08049EE4(super) + 2) & 0x1c;
}
sub_080390F8(this);
}
void sub_080390F8(CuccoAggrEntity* this) {
if (super->direction & 0xf) {
super->spriteSettings.flipX = ((super->direction >> 4) ^ 1);
}
}
void sub_08039120(CuccoAggrEntity* this) {
super->speed = gUnk_080CF7C2[super->type];
this->unk_7a = 0;
sub_0803901C(this);
}
void sub_08039140(CuccoAggrEntity* this) {
super->action = 6;
super->actionDelay = Random();
super->direction = GetFacingDirection(super, &gPlayerEntity);
super->z.HALF.HI = 0xfffc;
this->unk_78 = 0xb4;
sub_080390F8(this);
InitializeAnimation(super, 4);
}
bool32 CuccoAggr_IsOutsideScroll(CuccoAggrEntity* this) {
if ((u32)super->x.HALF.HI - 0xc - gRoomControls.scroll_x > 0x108)
return 1;
if ((u32)super->y.HALF.HI - 0xc - gRoomControls.scroll_y > 0xb8)
return 1;
return 0;
}
void sub_080391B4(CuccoAggrEntity* this) {
if (this->unk_7a) {
if ((this->unk_7b++ & 0x1f) == 0) {
Entity* ent = CreateEnemy(CUCCO_AGGR, 2);
if (ent) {
u32 rand = (Random() & 0x17);
const PosOffset* ptr = &gCuccoAggrSpawnPoints[rand];
ent->x.HALF.HI = gRoomControls.scroll_x + ptr->x;
ent->y.HALF.HI = gRoomControls.scroll_y + ptr->y;
ent->collisionLayer = super->collisionLayer;
}
}
}
}
void sub_08039218(CuccoAggrEntity* this) {
super->action = 5;
super->speed = gUnk_080CF824[super->type];
this->unk_78 = gUnk_080CF828[super->type];
if (super->animIndex != 4) {
InitializeAnimation(super, 4);
}
EnqueueSFX(SFX_VO_CUCCO4);
}
void CuccoAggr_CreateFx(CuccoAggrEntity* this) {
Entity* ent = CreateFx(super, gCuccoAggrFx[super->type], 0);
if (ent) {
ent->x.HALF.HI += gCuccoAggrFxHorizontalOffsets[super->spriteSettings.flipX];
}
}
void sub_08039298(CuccoAggrEntity* this) {
if (super->type2 == 0) {
sub_08078930(super);
}
}
void (*const gUnk_080CF778[])(Entity*) = {
(EntityActionPtr)sub_08038CF8, (EntityActionPtr)sub_08038D10, sub_08001324, sub_0804A7D4, sub_08001242,
(EntityActionPtr)nullsub_165,
};
void (*const gUnk_080CF790[])(CuccoAggrEntity*) = {
sub_08038D78, sub_08038DA0, sub_08038DC0, sub_08038EE0, sub_08038F20, sub_08038F44, sub_08038FA0,
};
void (*const gUnk_080CF7AC[])(CuccoAggrEntity*) = {
sub_08038DD8,
sub_08038E18,
sub_08038EAC,
sub_08038ED0,
};
const u8 gUnk_080CF7BC[] = { 0, 0x78 };
const u8 gUnk_080CF7BE[] = { 0x1e, 0x2d, 0x3c, 0x4b };
const u8 gUnk_080CF7C2[] = { 0x80, 0xc0 };
const PosOffset gCuccoAggrSpawnPoints[] = {
{ 0x18, -0x8 }, { 0x38, -0x8 }, { 0x58, -0x8 }, { 0x78, -0x8 }, { 0x98, -0x8 }, { 0xB8, -0x8 },
{ 0xD8, -0x8 }, { 0x18, 0xA8 }, { 0x38, 0xA8 }, { 0x58, 0xA8 }, { 0x78, 0xA8 }, { 0x98, 0xA8 },
{ 0xB8, 0xA8 }, { 0xD8, 0xA8 }, { -0x8, 0x10 }, { -0x8, 0x30 }, { -0x8, 0x50 }, { -0x8, 0x70 },
{ -0x8, 0x90 }, { 0xF8, 0x10 }, { 0xF8, 0x30 }, { 0xF8, 0x50 }, { 0xF8, 0x70 }, { 0xF8, 0x90 },
};
const u16 gUnk_080CF824[] = {
0x140,
0x200,
};
const u16 gUnk_080CF828[] = {
0x384,
0x3c,
};
const s8 gCuccoAggrFxHorizontalOffsets[] = {
8,
-8,
};
const u8 gCuccoAggrFx[] = {
FX_EGG,
FX_WOOD2,
FX_EGG,
};
+6 -8
View File
@@ -8,8 +8,6 @@
#include "enemy.h"
#include "functions.h"
extern Entity* sub_08049DF4(u32);
void sub_08022A88(Entity*);
void sub_08022AA4(Entity*);
void sub_08022B0C(Entity*);
@@ -54,8 +52,8 @@ void sub_08022988(Entity* this) {
return;
this->frameIndex = 1;
this->zVelocity = 0x10000;
EnqueueSFX(0xd6);
this->zVelocity = Q_16_16(1.0);
EnqueueSFX(SFX_VO_CHEEP);
}
ProcessMovement(this);
@@ -80,8 +78,8 @@ void sub_080229F8(Entity* this) {
this->speed = 0xc0;
sub_08022B44(this);
} else {
this->zVelocity = 0x10000;
EnqueueSFX(0xd6);
this->zVelocity = Q_16_16(1.0);
EnqueueSFX(SFX_VO_CHEEP);
}
}
}
@@ -143,13 +141,13 @@ u32 sub_08022B20(Entity* this) {
}
void sub_08022B44(Entity* this) {
this->zVelocity = 0xc000;
this->zVelocity = Q_16_16(0.75);
this->direction = GetFacingDirection(this, &gPlayerEntity);
if (this->direction & 0xf)
this->spriteSettings.flipX = (this->direction >> 4) ^ 1;
EnqueueSFX(0xd6);
EnqueueSFX(SFX_VO_CHEEP);
}
// clang-format off
+2 -2
View File
@@ -15,7 +15,7 @@ void sub_080481D0(Entity* this) {
void sub_080481E8(Entity* this) {
if (this->field_0x46) {
this->action = 2;
this->flags &= 0x7f;
this->flags &= ~ENT_COLLIDE;
this->spritePriority.b0 = 7;
this->actionDelay = 3;
} else {
@@ -36,7 +36,7 @@ void sub_08048224(Entity* this) {
this->actionDelay = 0;
} else {
this->action = 3;
this->flags &= 0x7f;
this->flags &= ~ENT_COLLIDE;
this->actionDelay = 1;
}
+8 -8
View File
@@ -97,7 +97,7 @@ void sub_08020BB8(Entity* this) {
}
this->action = 10;
sub_08021218(this, 0xb, this->animationState);
EnqueueSFX(0x15d);
EnqueueSFX(SFX_15D);
sub_08021588(this);
break;
case 0x4c:
@@ -280,7 +280,7 @@ void sub_08021038(Entity* this) {
pEVar2->parent = this;
this->child = pEVar2;
}
EnqueueSFX(270);
EnqueueSFX(SFX_10E);
}
if (this->frame & 0x80) {
@@ -302,7 +302,7 @@ void sub_080210A8(Entity* this) {
if (this->frame & 1) {
this->frame = 0;
sub_08021588(this);
EnqueueSFX(349);
EnqueueSFX(SFX_15D);
} else if (this->frame & 0x80) {
sub_08021390(this);
}
@@ -320,7 +320,7 @@ void sub_080210E4(Entity* this) {
this->child = ent;
}
EnqueueSFX(270);
EnqueueSFX(SFX_10E);
}
sub_08021644(this);
@@ -578,13 +578,13 @@ void sub_0802159C(Entity* this) {
ent->parent = this;
this->child = ent;
}
EnqueueSFX(0x116);
EnqueueSFX(SFX_116);
} else if (this->frame == 2) {
this->frame = 0;
sub_08021588(this);
} else if (this->frame & 0x20) {
this->frame &= ~0x20;
EnqueueSFX(0x115);
EnqueueSFX(SFX_115);
}
}
@@ -599,7 +599,7 @@ void sub_08021600(Entity* this) {
ent->parent = this;
this->child = ent;
}
EnqueueSFX(0x10e);
EnqueueSFX(SFX_10E);
} else if (this->frame == 2) {
this->frame = 0;
sub_08021588(this);
@@ -609,7 +609,7 @@ void sub_08021600(Entity* this) {
void sub_08021644(Entity* this) {
if (this->frame & 0x20) {
this->frame &= ~0x20;
EnqueueSFX(0x7d);
EnqueueSFX(SFX_PLY_LAND);
}
}
+2 -3
View File
@@ -9,7 +9,6 @@
#include "enemy.h"
#include "functions.h"
extern s16 sub_080001DA(u32, u32); // ?
extern void sub_08049CF4(Entity*);
void sub_080221C0(Entity*);
@@ -92,7 +91,7 @@ void sub_080220F0(Entity* this) {
fx->y.HALF.HI += off->v;
}
}
EnqueueSFX(260);
EnqueueSFX(SFX_104);
} else if (this->frame & 1) {
this->damage = 4;
}
@@ -118,7 +117,7 @@ void sub_08022198(Entity* this) {
void sub_080221C0(Entity* this) {
u32 tile = COORD_TO_TILE(this) + gUnk_080B4488[this->type2];
this->field_0x7c.HALF.HI = tile;
this->field_0x7c.HALF.LO = sub_080001DA(tile, this->collisionLayer);
this->field_0x7c.HALF.LO = GetTileIndex(tile, this->collisionLayer);
SetTile(gUnk_080CB79C[this->type2], tile, this->collisionLayer);
}
+16
View File
@@ -0,0 +1,16 @@
#include "entity.h"
void (*const gUnk_080D2ABC[])(Entity*);
extern void sub_08029270(Entity* this);
void Enemy66(Entity* this) {
if (gUnk_080D2ABC[this->field_0xf]) {
gUnk_080D2ABC[this->field_0xf](this);
} else {
DeleteThisEntity();
}
}
void (*const gUnk_080D2ABC[103])(Entity*) = {
[22] = sub_08029270,
};
+4 -6
View File
@@ -37,7 +37,7 @@ void sub_0802C254(Entity* this) {
void sub_0802C258(Entity* this) {
sub_0804A720(this);
this->zVelocity = 0x20000;
this->zVelocity = Q_16_16(2.0);
this->actionDelay = 2;
this->field_0x7a.HWORD = Random() & 0x70;
switch (this->type) {
@@ -80,7 +80,7 @@ NONMATCH("asm/non_matching/fallingBoulder/sub_0802C334.inc", void sub_0802C334(E
GetNextFrame(this);
this->field_0x7c.HALF.HI = COORD_TO_TILE(this);
if (sub_080044EC(this, *(u32*)&this->cutsceneBeh) == 1) {
EnqueueSFX(0x14c);
EnqueueSFX(SFX_14C);
COLLISION_ON(this);
this->field_0x7a.HWORD = 0xc;
sub_0802C4B0(this);
@@ -137,14 +137,12 @@ void nullsub_148(Entity* this) {
/* ... */
}
extern u32 sub_080001DA(u32, u32);
void sub_0802C4B0(Entity* this) {
u32 offset;
u32 index;
u32 rand;
switch (sub_080001DA(this->field_0x7c.HALF_U.HI, this->collisionLayer)) {
switch (GetTileIndex(this->field_0x7c.HALF_U.HI, this->collisionLayer)) {
case 0x1ab ... 0x1af:
offset = 8;
break;
@@ -195,7 +193,7 @@ void sub_0802C4B0(Entity* this) {
}
rand = Random() & 7;
this->zVelocity = 0x20000;
this->zVelocity = Q_16_16(2.0);
if (rand & 4) {
if (rand & 3) {
*(u32*)&this->cutsceneBeh = gUnk_080CD58C[offset | 1];
+1 -1
View File
@@ -102,7 +102,7 @@ u32 sub_0804A024(Entity*, u32, u32);
void sub_08045524(Entity* this) {
u32 tmp, tmp1, tmp2;
this->zVelocity = 0x1c000;
this->zVelocity = Q_16_16(1.75);
tmp = sub_0804A024(this, 1, 8);
if (tmp != 0xff && (Random() & 3) == 0) {
this->actionDelay = Random() & 3;
+4 -5
View File
@@ -21,7 +21,6 @@ void (*const gUnk_080CFBD4[])(FlyingSkullEntity*);
const s8 gUnk_080CFBE4[4];
extern s32 sub_080012DC(Entity*);
extern u32 sub_080001DA(u32, u32);
extern void sub_08078930(Entity*);
void sub_0803A100(FlyingSkullEntity* this);
@@ -46,7 +45,7 @@ void sub_08039BF8(FlyingSkullEntity* this) {
if (super->bitfield == 0x9d) {
super->action = 7;
COLLISION_OFF(super);
super->zVelocity = 0x2A000;
super->zVelocity = Q_16_16(2.625);
super->spritePriority.b1 = 1;
SetTile(this->unk_0x74, COORD_TO_TILE(super), super->collisionLayer);
} else if (super->z.HALF.HI) {
@@ -118,7 +117,7 @@ void sub_08039D74(FlyingSkullEntity* this) {
super->y.HALF.HI += 3;
tmp = COORD_TO_TILE(super);
this->unk_0x74 = sub_080001DA(tmp, super->collisionLayer);
this->unk_0x74 = GetTileIndex(tmp, super->collisionLayer);
SetTile(0x4060, tmp, super->collisionLayer);
InitializeAnimation(super, 0);
}
@@ -136,7 +135,7 @@ void sub_08039DD8(FlyingSkullEntity* this) {
} else {
if ((gPlayerState.flags & 0x80) == 0) {
Entity* ent = &gPlayerEntity;
if (sub_0806FCB8(super, ent->x.HALF.HI, ent->y.HALF.HI, 0x30)) {
if (EntityWithinDistance(super, ent->x.HALF.HI, ent->y.HALF.HI, 0x30)) {
if (super->type == 1) {
super->action = 3;
super->actionDelay = 0x1e;
@@ -246,7 +245,7 @@ void sub_0803A0E0(FlyingSkullEntity* this) {
void sub_0803A100(FlyingSkullEntity* this) {
u32 tile = COORD_TO_TILE(super);
if (sub_080001DA(tile, super->collisionLayer) == 0x4067) {
if (GetTileIndex(tile, super->collisionLayer) == 0x4067) {
SetTile(this->unk_0x74, tile, super->collisionLayer);
DeleteThisEntity();
}
+238 -210
View File
@@ -5,34 +5,48 @@
* @brief Gibdo enemy
*/
#define NENT_DEPRECATED
#include "global.h"
#include "enemy.h"
#include "object.h"
#include "functions.h"
typedef struct {
Entity base;
u8 filler[0xc];
u16 field_0x74;
u8 field_0x76;
u8 field_0x77;
u16 field_0x78;
u16 field_0x7a;
u8 field_0x7c;
u8 field_0x7d;
u8 filler2[2];
Entity* field_0x80;
Entity* field_0x84;
} GibdoEntity;
// Gibudo
void sub_08037794(Entity*);
void sub_08037B10(Entity*);
void sub_0803797C(Entity*);
void sub_080379BC(Entity*);
void sub_08037C0C(Entity*, Entity*);
u32 sub_08037810(Entity*);
void sub_080377B0(Entity*);
u32 sub_080378B0(Entity*);
u32 sub_08037914(Entity*);
u32 sub_080379EC(Entity*);
void sub_08037A58(Entity*);
void sub_08037ACC(Entity*);
void sub_08037B48(Entity*);
void sub_08037A14(Entity*);
void sub_08037794(GibdoEntity*);
void sub_08037B10(GibdoEntity*);
void sub_0803797C(GibdoEntity*);
void sub_080379BC(GibdoEntity*);
void Gibdo_MoveObjectsToStalfos(GibdoEntity*, Entity*);
u32 sub_08037810(GibdoEntity*);
void sub_080377B0(GibdoEntity*);
u32 sub_080378B0(GibdoEntity*);
u32 sub_08037914(GibdoEntity*);
u32 sub_080379EC(GibdoEntity*);
void sub_08037A58(GibdoEntity*);
void sub_08037ACC(GibdoEntity*);
void Gibdo_CreateObjects(GibdoEntity*);
void sub_08037A14(GibdoEntity*);
extern void sub_0804A4E4(Entity*, Entity*);
extern Entity* sub_08049DF4(u32);
u32 sub_0804A044(Entity*, Entity*, u32);
extern void SoundReqClipped(Entity*, u32);
extern void (*const gGibdo[6])(Entity*);
extern void (*const gUnk_080CF2AC[9])(Entity*);
void (*const gGibdo[6])(Entity*);
void (*const gUnk_080CF2AC[9])(GibdoEntity*);
extern Entity* gUnk_020000B0;
void Gibdo(Entity* this) {
@@ -40,35 +54,33 @@ void Gibdo(Entity* this) {
SetChildOffset(this, 0, 1, -0x15);
}
void Gibdo_OnTick(Entity* this) {
gUnk_080CF2AC[this->action](this);
void Gibdo_OnTick(GibdoEntity* this) {
gUnk_080CF2AC[super->action](this);
}
// Non-matching
NONMATCH("asm/non_matching/gibdo/sub_080374A4.inc", void sub_080374A4(Entity* this)) {
void sub_080374A4(GibdoEntity* this) {
u8 x;
if (this->bitfield == 0x87) {
if (this->action == 0x6) {
if (super->bitfield == 0x87) {
if (super->action == 0x6) {
sub_08037ACC(this);
}
this->action = 0x8;
this->actionDelay = 0x3c;
COLLISION_OFF(this);
sub_08037B48(this);
super->action = 0x8;
super->actionDelay = 0x3c;
COLLISION_OFF(super);
Gibdo_CreateObjects(this);
} else {
if (this->action != 0x6) {
if (this->hitType == 0x27) {
if (this->bitfield == 0x80) {
sub_08037A14(this);
}
if (super->action != 0x6) {
if (super->hitType == 0x27 && super->bitfield == 0x80) {
sub_08037A14(this);
} else {
if ((u8)(this->action - 1) < 2) {
this->action = 1;
x = DirectionTurnAround(DirectionRoundUp(this->knockbackDirection));
this->direction = x;
this->animationState = x >> 3;
InitAnimationForceUpdate(this, this->animationState);
if ((u8)(super->action - 1) < 2) {
super->action = 1;
x = DirectionRoundUp(DirectionTurnAround(super->knockbackDirection));
super->direction = x;
super->animationState = x >> 3;
InitAnimationForceUpdate(super, super->animationState);
if (sub_08037810(this) != 0) {
this->actionDelay = 4;
super->actionDelay = 4;
}
}
}
@@ -76,41 +88,40 @@ NONMATCH("asm/non_matching/gibdo/sub_080374A4.inc", void sub_080374A4(Entity* th
sub_08037A58(this);
}
}
if (this->field_0x43 != 0) {
sub_0804A9FC(this, 0x1c);
if (super->field_0x43 != 0) {
sub_0804A9FC(super, 0x1c);
}
sub_0804AA30(this, gGibdo);
}
END_NONMATCH
void nullsub_162(Entity* this) {
sub_0804AA30(super, gGibdo);
}
void sub_08037558(Entity* this) {
sub_0804A720(this);
this->animationState = Random() & 0x3;
this->field_0x76.HALF.LO = 0;
this->field_0x76.HALF.HI = 0;
void nullsub_162(GibdoEntity* this) {
}
void sub_08037558(GibdoEntity* this) {
sub_0804A720(super);
super->animationState = Random() & 0x3;
this->field_0x76 = 0;
this->field_0x77 = 0;
sub_08037794(this);
}
void sub_08037580(Entity* this) {
void sub_08037580(GibdoEntity* this) {
if (sub_08037810(this) == 0) {
if (!(--this->field_0x74.HWORD)) {
if (!(--this->field_0x74)) {
sub_080377B0(this);
}
}
}
void sub_080375A4(Entity* this) {
void sub_080375A4(GibdoEntity* this) {
if (sub_080378B0(this) == 0) {
if (sub_08037810(this) == 0) {
if (!(--this->field_0x74.HWORD)) {
if (!(--this->field_0x74)) {
sub_08037794(this);
} else {
UpdateAnimationSingleFrame(this);
if (ProcessMovement(this) == 0) {
if (!(--this->field_0xf)) {
UpdateAnimationSingleFrame(super);
if (ProcessMovement(super) == 0) {
if (!(--super->field_0xf)) {
sub_080379BC(this);
}
}
@@ -119,30 +130,30 @@ void sub_080375A4(Entity* this) {
}
}
void sub_080375F8(Entity* this) {
void sub_080375F8(GibdoEntity* this) {
if (sub_080378B0(this) == 0) {
if (!(--this->actionDelay)) {
this->action = 4;
this->actionDelay = 0x18;
InitAnimationForceUpdate(this, this->animationState + 4);
if (!(--super->actionDelay)) {
super->action = 4;
super->actionDelay = 0x18;
InitAnimationForceUpdate(super, super->animationState + 4);
}
}
}
void sub_08037624(Entity* this) {
void sub_08037624(GibdoEntity* this) {
if (sub_080378B0(this) == 0) {
if (sub_08037914(this) == 0) {
if (!(--this->field_0x74.HWORD)) {
if (!(--this->field_0x74)) {
sub_08037794(this);
} else {
UpdateAnimationSingleFrame(this);
UpdateAnimationSingleFrame(this);
if (ProcessMovement(this) == 0) {
if (!(--this->field_0xf)) {
UpdateAnimationSingleFrame(super);
UpdateAnimationSingleFrame(super);
if (ProcessMovement(super) == 0) {
if (!(--super->field_0xf)) {
sub_080379BC(this);
}
} else {
if (!(--this->actionDelay)) {
if (!(--super->actionDelay)) {
sub_0803797C(this);
}
}
@@ -151,172 +162,172 @@ void sub_08037624(Entity* this) {
}
}
void sub_08037690(Entity* this) {
UpdateAnimationSingleFrame(this);
if ((this->frame & 0x80) != 0) {
this->field_0x76.HALF.HI = 0x14;
void sub_08037690(GibdoEntity* this) {
UpdateAnimationSingleFrame(super);
if ((super->frame & 0x80) != 0) {
this->field_0x77 = 0x14;
sub_08037794(this);
} else {
if ((this->frame & 1) != 0) {
this->hitType = 0x27;
ProcessMovement(this);
if ((super->frame & 1) != 0) {
super->hitType = 0x27;
ProcessMovement(super);
}
}
}
void sub_080376D0(Entity* this) {
void sub_080376D0(GibdoEntity* this) {
u8* x;
if (sub_080379EC(this) == 0) {
ResetPlayer();
gPlayerState.mobility = gPlayerState.mobility | 0x80;
gPlayerState.field_0xa = gPlayerState.field_0xa | 0x80;
CopyPositionAndSpriteOffset(&gPlayerEntity, this);
UpdateAnimationSingleFrame(this);
if ((this->frame & 0x1) != 0) {
if (--this->field_0x7c.BYTES.byte0 == 0) {
CopyPositionAndSpriteOffset(&gPlayerEntity, super);
UpdateAnimationSingleFrame(super);
if ((super->frame & 0x1) != 0) {
if (--this->field_0x7c == 0) {
sub_08037A58(this);
} else {
this->frame ^= 1;
super->frame ^= 1;
sub_08037B10(this);
}
}
}
}
void sub_0803773C(Entity* this) {
UpdateAnimationSingleFrame(this);
if ((this->frame & 0x80) != 0) {
void sub_0803773C(GibdoEntity* this) {
UpdateAnimationSingleFrame(super);
if ((super->frame & 0x80) != 0) {
sub_08037794(this);
}
}
// Turn into Stalfos
void sub_0803775C(Entity* this) {
void sub_0803775C(GibdoEntity* this) {
Entity* x;
if (!(--this->actionDelay)) {
if (!(--super->actionDelay)) {
x = CreateEnemy(STALFOS, 0);
if (x != 0) {
sub_0804A4E4(this, x);
sub_08037C0C(this, x);
sub_0804A4E4(super, x);
Gibdo_MoveObjectsToStalfos(this, x);
}
DeleteEntity(this);
DeleteEntity(super);
}
}
void sub_08037794(Entity* this) {
this->action = 1;
this->field_0x74.HWORD = 0x1e;
this->hitType = 0x26;
InitAnimationForceUpdate(this, this->animationState);
void sub_08037794(GibdoEntity* this) {
super->action = 1;
this->field_0x74 = 0x1e;
super->hitType = 0x26;
InitAnimationForceUpdate(super, super->animationState);
}
void sub_080377B0(Entity* this) {
void sub_080377B0(GibdoEntity* this) {
u32 r1;
u32 r2;
this->action = 2;
this->field_0xf = 8;
super->action = 2;
super->field_0xf = 8;
r1 = Random();
this->field_0x74.HWORD = (r1 & 0x38) + 0x78;
this->speed = 0x40;
this->field_0x74 = (r1 & 0x38) + 0x78;
super->speed = 0x40;
r2 = Random();
if (!sub_08049FA0(this) && (r2 & 3)) {
this->direction = DirectionRoundUp(sub_08049EE4(this));
if (!sub_08049FA0(super) && (r2 & 3)) {
super->direction = DirectionRoundUp(sub_08049EE4(super));
} else {
this->direction = DirectionRound(r2);
super->direction = DirectionRound(r2);
}
this->animationState = this->direction / 8;
InitAnimationForceUpdate(this, this->animationState + 4);
super->animationState = super->direction / 8;
InitAnimationForceUpdate(super, super->animationState + 4);
}
u32 sub_08037810(Entity* this) {
u32 sub_08037810(GibdoEntity* this) {
u32 x;
u32 y;
if (this->field_0x76.HALF.LO == 0) {
if (sub_08049FDC(this, 1) != 0) {
if (sub_0806FCB8(this, gUnk_020000B0->x.HALF.HI, gUnk_020000B0->y.HALF.HI, 0x40) != 0) {
x = GetFacingDirection(this, gUnk_020000B0);
if (((x - this->direction + 6) & 0x1f) <= 0xc) {
this->action = 3;
this->actionDelay = 0x18;
this->field_0xf = 0x8;
this->speed = 0xc0;
this->direction = DirectionRoundUp(GetFacingDirection(this, gUnk_020000B0));
this->animationState = this->direction >> 3;
this->field_0x74.HWORD = 300;
this->field_0x78.HWORD = gUnk_020000B0->x.HALF.HI;
this->field_0x7a.HWORD = gUnk_020000B0->y.HALF.HI;
InitAnimationForceUpdate(this, this->animationState);
if (this->field_0x76 == 0) {
if (sub_08049FDC(super, 1) != 0) {
if (EntityWithinDistance(super, gUnk_020000B0->x.HALF.HI, gUnk_020000B0->y.HALF.HI, 0x40) != 0) {
x = GetFacingDirection(super, gUnk_020000B0);
if (((x - super->direction + 6) & 0x1f) <= 0xc) {
super->action = 3;
super->actionDelay = 0x18;
super->field_0xf = 0x8;
super->speed = 0xc0;
super->direction = DirectionRoundUp(GetFacingDirection(super, gUnk_020000B0));
super->animationState = super->direction >> 3;
this->field_0x74 = 300;
this->field_0x78 = gUnk_020000B0->x.HALF.HI;
this->field_0x7a = gUnk_020000B0->y.HALF.HI;
InitAnimationForceUpdate(super, super->animationState);
return 1;
}
}
}
} else {
this->field_0x76.HALF.LO--;
this->field_0x76--;
}
return 0;
}
u32 sub_080378B0(Entity* this) {
if (this->field_0x76.HALF.HI == 0) {
u32 sub_080378B0(GibdoEntity* this) {
if (this->field_0x77 == 0) {
if (sub_08049DF4(1) != 0) {
if (sub_0804A044(this, gUnk_020000B0, 0xa) == this->direction)
if (sub_0806FCB8(this, gUnk_020000B0->x.HALF.HI, gUnk_020000B0->y.HALF.HI, 0x18) != 0) {
this->action = 5;
this->speed = 0x100;
InitAnimationForceUpdate(this, this->animationState + 8);
if (sub_0804A044(super, gUnk_020000B0, 0xa) == super->direction)
if (EntityWithinDistance(super, gUnk_020000B0->x.HALF.HI, gUnk_020000B0->y.HALF.HI, 0x18) != 0) {
super->action = 5;
super->speed = 0x100;
InitAnimationForceUpdate(super, super->animationState + 8);
return 1;
}
}
} else {
this->field_0x76.HALF.HI--;
this->field_0x77--;
}
return 0;
}
u32 sub_08037914(Entity* this) {
if (sub_08049FDC(this, 1) != 0) {
if (sub_0806FCB8(gUnk_020000B0, this->field_0x78.HWORD, this->field_0x7a.HWORD, 0x28) == 0) {
this->field_0x78.HWORD = gUnk_020000B0->x.HALF_U.HI;
this->field_0x7a.HWORD = gUnk_020000B0->y.HALF_U.HI;
u32 sub_08037914(GibdoEntity* this) {
if (sub_08049FDC(super, 1) != 0) {
if (EntityWithinDistance(gUnk_020000B0, this->field_0x78, this->field_0x7a, 0x28) == 0) {
this->field_0x78 = gUnk_020000B0->x.HALF_U.HI;
this->field_0x7a = gUnk_020000B0->y.HALF_U.HI;
sub_0803797C(this);
return 0;
}
if (sub_0806FCB8(this, this->field_0x78.HWORD, this->field_0x7a.HWORD, 0x8) == 0) {
if (EntityWithinDistance(super, this->field_0x78, this->field_0x7a, 0x8) == 0) {
return 0;
}
this->field_0x76.HALF.LO = 0x3c;
this->field_0x76 = 0x3c;
}
sub_08037794(this);
return 1;
}
NONMATCH("asm/non_matching/gibdo/sub_0803797C.inc", void sub_0803797C(Entity* this)) {
u32 z;
void sub_0803797C(GibdoEntity* this) {
u32 m;
this->actionDelay = 0x18;
this->field_0xf = 0x8;
z = sub_080045D4(this->x.HALF.HI, this->y.HALF.HI, this->field_0x78.HWORD, this->field_0x7a.HWORD);
m = (z + 4) & 0x18;
this->direction = m;
super->actionDelay = 0x18;
super->field_0xf = 8;
m = super->direction =
(sub_080045D4(super->x.HALF.HI, super->y.HALF.HI, this->field_0x78, this->field_0x7a) + 4) & 0x18;
;
m = m / 8;
if (m != this->animationState) {
this->animationState = m;
InitAnimationForceUpdate(this, m + 4);
if (m != super->animationState) {
super->animationState = m;
InitAnimationForceUpdate(super, m + 4);
}
}
END_NONMATCH
void sub_080379BC(Entity* this) {
void sub_080379BC(GibdoEntity* this) {
u32 r;
this->actionDelay = 0x18;
this->field_0xf = 0x8;
super->actionDelay = 0x18;
super->field_0xf = 0x8;
r = Random();
this->animationState = ((this->animationState + (r & 2)) - 1) & 3;
this->direction = DirectionFromAnimationState(this->animationState);
InitAnimationForceUpdate(this, this->animationState + 4);
super->animationState = ((super->animationState + (r & 2)) - 1) & 3;
super->direction = DirectionFromAnimationState(super->animationState);
InitAnimationForceUpdate(super, super->animationState + 4);
}
u32 sub_080379EC(Entity* this) {
u32 sub_080379EC(GibdoEntity* this) {
if (sub_0807953C() != 0) {
if (!(--this->actionDelay)) {
if (!(--super->actionDelay)) {
sub_08037A58(this);
return 1;
}
@@ -324,96 +335,113 @@ u32 sub_080379EC(Entity* this) {
return 0;
}
void sub_08037A14(Entity* this) {
this->action = 6;
this->actionDelay = 0x18;
this->spritePriority.b0 = (this->spritePriority.b0 & (this->actionDelay - 0x20));
this->spritePriority.b0 |= 3;
this->flags2 &= 0xfe;
this->field_0x7c.BYTES.byte0 = 5;
CopyPosition(this, this->field_0x4c);
InitAnimationForceUpdate(this, this->animationState + 0xc);
}
// Take Damage maybe?
void sub_08037A58(Entity* this) {
sub_08037ACC(this);
this->action = 7;
this->spritePriority.b0 = 4;
if (this->iframes == 0) {
this->iframes = 0xec;
}
this->hitType = 0x26;
this->flags2 |= 1;
this->iframes = 0xf4;
this->knockbackDirection = DirectionFromAnimationState(this->animationState) ^ 0x10;
this->knockbackDuration = 8;
this->field_0x46 = 0x180;
this->field_0x76.HALF.LO = 0x3c;
InitAnimationForceUpdate(this, this->animationState + 0x10);
void sub_08037A14(GibdoEntity* this) {
super->action = 6;
super->actionDelay = 0x18;
super->spritePriority.b0 = (super->spritePriority.b0 & (super->actionDelay - 0x20));
super->spritePriority.b0 |= 3;
super->flags2 &= 0xfe;
this->field_0x7c = 5;
CopyPosition(super, super->field_0x4c);
InitAnimationForceUpdate(super, super->animationState + 0xc);
}
void sub_08037ACC(Entity* this) {
// Take Damage maybe?
void sub_08037A58(GibdoEntity* this) {
sub_08037ACC(this);
super->action = 7;
super->spritePriority.b0 = 4;
if (super->iframes == 0) {
super->iframes = 0xec;
}
super->hitType = 0x26;
super->flags2 |= 1;
super->iframes = 0xf4;
super->knockbackDirection = DirectionFromAnimationState(super->animationState) ^ 0x10;
super->knockbackDuration = 8;
super->field_0x46 = 0x180;
this->field_0x76 = 0x3c;
InitAnimationForceUpdate(super, super->animationState + 0x10);
}
void sub_08037ACC(GibdoEntity* this) {
gPlayerState.flags &= ~PL_DISABLE_ITEMS;
COLLISION_ON(&gPlayerEntity);
gPlayerEntity.iframes = 0x1e;
gPlayerEntity.knockbackDirection = DirectionFromAnimationState(this->animationState);
gPlayerEntity.knockbackDirection = DirectionFromAnimationState(super->animationState);
gPlayerEntity.knockbackDuration = 4;
gPlayerEntity.field_0x46 = 0x180;
}
// Damage player maybe?
void sub_08037B10(Entity* this) {
void sub_08037B10(GibdoEntity* this) {
u32 h;
gPlayerEntity.iframes = 0xc;
h = ModHealth(-8);
SoundReqClipped(&gPlayerEntity, 0x7a);
SoundReqClipped(&gPlayerEntity, SFX_PLY_VO6);
if (h == 0) {
sub_08037A58(this);
this->field_0x76.HALF.LO = 0xf0;
this->field_0x76 = 0xf0;
}
}
void sub_08037B48(Entity* this) {
void Gibdo_CreateObjects(GibdoEntity* this) {
Entity* E;
E = CreateObject(OBJECT_2A, 3, 0);
if (E != 0) {
E->type2 = this->actionDelay;
E->type2 = super->actionDelay;
E->spritePriority.b0 = 3;
E->spriteOffsetX = 0;
E->spriteOffsetY = 0xfc;
E->parent = this;
E->parent = super;
}
*(Entity**)&this->field_0x80.HWORD = E;
this->field_0x80 = E;
E = CreateObject(OBJECT_2A, 3, 0);
if (E != 0) {
E->type2 = this->actionDelay;
E->type2 = super->actionDelay;
E->spritePriority.b0 = 3;
E->spriteOffsetX = 0xfd;
E->spriteOffsetY = 0xf8;
E->parent = this;
E->parent = super;
}
*(Entity**)&this->cutsceneBeh.HWORD = E;
this->field_0x84 = E;
E = CreateObject(OBJECT_2A, 3, 0);
if (E != 0) {
E->type2 = this->actionDelay;
E->type2 = super->actionDelay;
E->spritePriority.b0 = 3;
E->spriteOffsetX = 0x5;
E->spriteOffsetY = 0xf5;
E->parent = this;
E->parent = super;
}
this->child = E;
super->child = E;
}
NONMATCH("asm/non_matching/gibdo/sub_08037C0C.inc", void sub_08037C0C(Entity* this, Entity* that)) {
if (this->field_0x80.HWORD != 0) {
this->actionDelay = 0xf;
this->parent = that;
void Gibdo_MoveObjectsToStalfos(GibdoEntity* this, Entity* that) {
Entity* ent = this->field_0x80;
if (ent != NULL) {
ent->actionDelay = 0xf;
ent->parent = that;
}
if (this->cutsceneBeh.HWORD != 0) {
this->actionDelay = 0xf;
this->parent = that;
ent = this->field_0x84;
if (ent != NULL) {
ent->actionDelay = 0xf;
ent->parent = that;
}
if (this->child != 0) {
this->actionDelay = 0xf;
this->parent = that;
ent = super->child;
if (ent != NULL) {
ent->actionDelay = 0xf;
ent->parent = that;
}
}
END_NONMATCH
void (*const gGibdo[6])(Entity*) = {
(EntityActionPtr)Gibdo_OnTick, (EntityActionPtr)sub_080374A4, sub_08001324, sub_0804A7D4, sub_08001242,
(EntityActionPtr)nullsub_162,
};
void (*const gUnk_080CF2AC[9])(GibdoEntity*) = {
sub_08037558, sub_08037580, sub_080375A4, sub_080375F8, sub_08037624,
sub_08037690, sub_080376D0, sub_0803773C, sub_0803775C,
};
+1254
View File
File diff suppressed because it is too large Load Diff
+3 -3
View File
@@ -20,7 +20,7 @@ void (*const gUnk_080D1E6C[])(GyorgChildEntity*) = {
void GyorgChild(Entity* this) {
if (gRoomTransition.field_0x39 == 0) {
this->flags &= ~0x80;
this->flags &= ~ENT_COLLIDE;
this->health = 0;
this->collisionLayer = 2;
}
@@ -89,7 +89,7 @@ void sub_080486F4(GyorgChildEntity* this) {
s32 r;
InitializeAnimation(super, super->animationState);
super->action = 1;
super->flags |= 0x80;
super->flags |= ENT_COLLIDE;
r = (signed)Random() % 0xB;
super->direction += r;
super->direction -= 5;
@@ -143,7 +143,7 @@ void sub_0804877C(GyorgChildEntity* this) {
void sub_0804882C(GyorgChildEntity* this) {
if (--super->actionDelay == 0) {
super->action = 3;
super->flags |= 0x80;
super->flags |= ENT_COLLIDE;
Random();
super->spriteSettings.draw = 1;
super->spritePriority.b0 = 4;
+4 -4
View File
@@ -125,7 +125,7 @@ void sub_08048B84(GyorgFemaleEyeEntity* this) {
GetNextFrame(super);
if (super->frame & 0x80) {
super->action = 3;
super->flags |= 0x80;
super->flags |= ENT_COLLIDE;
super->hitType = 0x1E;
}
}
@@ -135,11 +135,11 @@ void sub_08048BB0(GyorgFemaleEyeEntity* this) {
if (!((parent->unk_78 >> super->type) & 1)) {
if (parent->base.health != 0) {
super->action = 4;
super->flags &= ~0x80;
super->flags &= ~ENT_COLLIDE;
InitializeAnimation(super, gUnk_080D2030[(super->animationState << 3) + super->type]);
} else {
super->action = 1;
super->flags &= ~0x80;
super->flags &= ~ENT_COLLIDE;
super->spriteSettings.draw = 0;
InitializeAnimation(super, gUnk_080D2010[(super->animationState << 3) + super->type]);
CreateFx(super, 2, 0x40);
@@ -150,7 +150,7 @@ void sub_08048BB0(GyorgFemaleEyeEntity* this) {
super->iframes = 0xF4;
super->hitType = 0x89;
InitializeAnimation(super, (parent->base.animationState >> 6) + 0x14);
SoundReq(0x119);
SoundReq(SFX_ITEM_GLOVES_KNOCKBACK);
}
GetNextFrame(super);
if (super->frame & 0x80) {
+17 -17
View File
@@ -106,7 +106,7 @@ void GyorgMale(GyorgMaleEntity* this) {
}
gUnk_080D1AFC[super->action](this);
if (super->action != 7) {
sub_0805EC9C(this, 0xaa, 0xaa, this->unk_78);
sub_0805EC9C(super, 0xaa, 0xaa, this->unk_78);
}
super->animationState = -(this->unk_78 >> 8);
sub_08048004(this);
@@ -279,7 +279,7 @@ void sub_08046B18(GyorgMaleEntity* this) {
}
void sub_08046B8C(GyorgMaleEntity* this) {
if (sub_0806FCB8(super, this->unk_80, this->unk_82, 4)) {
if (EntityWithinDistance(super, this->unk_80, this->unk_82, 4)) {
super->subAction = 3;
this->unk_76 = super->direction << 8;
this->unk_80 = gRoomControls.origin_x + 0x200;
@@ -309,7 +309,7 @@ void sub_08046C04(GyorgMaleEntity* this) {
}
void sub_08046C88(GyorgMaleEntity* this) {
if (sub_0806FCB8(super, this->unk_80, this->unk_82, 4)) {
if (EntityWithinDistance(super, this->unk_80, this->unk_82, 4)) {
super->subAction = 1;
sub_08048178(this, sub_08048158(this->unk_70));
sub_08047D88(this);
@@ -367,7 +367,7 @@ void sub_08046D98(GyorgMaleEntity* this) {
}
void sub_08046E0C(GyorgMaleEntity* this) {
if (sub_0806FCB8(super, this->unk_80, this->unk_82, 4)) {
if (EntityWithinDistance(super, this->unk_80, this->unk_82, 4)) {
super->subAction = 3;
this->unk_76 = super->direction << 8;
sub_08047D88(this);
@@ -468,7 +468,7 @@ void sub_0804702C(GyorgMaleEntity* this) {
}
}
sub_08047DF0(this, ((0x100 - super->direction) & 0xFF) << 8);
if (sub_0806FCB8(super, this->unk_80, this->unk_82, (super->speed >> 0x10) + 0x10)) {
if (EntityWithinDistance(super, this->unk_80, this->unk_82, (super->speed >> 0x10) + 0x10)) {
super->subAction = 2;
this->unk_76 = super->direction << 8;
super->speed = 0x280;
@@ -628,7 +628,7 @@ void sub_080473F0(GyorgMaleEntity* this) {
}
}
sub_08047DF0(this, ((0x100 - super->direction) & 0xFF) << 8);
if (sub_0806FCB8(super, this->unk_80, this->unk_82, 8)) {
if (EntityWithinDistance(super, this->unk_80, this->unk_82, 8)) {
super->subAction = 2;
this->unk_76 = super->direction << 8;
super->speed = 0x180;
@@ -796,7 +796,7 @@ void sub_080477F0(GyorgMaleEntity* this) {
}
super->direction = sub_080045DA(this->unk_80 - super->x.HALF.HI, this->unk_82 - super->y.HALF.HI);
sub_08047E48(this);
if (!sub_0806FCB8(super, gPlayerEntity.x.HALF.HI, gPlayerEntity.y.HALF.HI, 0x80)) {
if (!EntityWithinDistance(super, gPlayerEntity.x.HALF.HI, gPlayerEntity.y.HALF.HI, 0x80)) {
super->action = 2;
super->subAction = 0;
super->spriteOrientation.flipY = 2;
@@ -804,11 +804,11 @@ void sub_080477F0(GyorgMaleEntity* this) {
super->direction = super->animationState;
return;
}
if (!sub_0806FCB8(super, gRoomControls.origin_x + 0x200, gRoomControls.origin_y + 0x210, 0x100)) {
if (!EntityWithinDistance(super, gRoomControls.origin_x + 0x200, gRoomControls.origin_y + 0x210, 0x100)) {
super->spriteOrientation.flipY = 3;
super->spriteRendering.b3 = 3;
}
if (sub_0806FCB8(super, this->unk_80, this->unk_82, 4)) {
if (EntityWithinDistance(super, this->unk_80, this->unk_82, 4)) {
super->subAction = 2;
this->unk_76 = super->animationState << 8;
this->unk_74 = gUnk_080D1BF0[Random() & 1];
@@ -861,7 +861,7 @@ void sub_08047978(GyorgMaleEntity* this) {
tmp->parent = super;
}
}
if (!sub_0806FCB8(super, gPlayerEntity.x.HALF.HI, gPlayerEntity.y.HALF.HI, 0x80)) {
if (!EntityWithinDistance(super, gPlayerEntity.x.HALF.HI, gPlayerEntity.y.HALF.HI, 0x80)) {
super->action = 2;
super->subAction = 0;
super->spriteOrientation.flipY = 2;
@@ -902,7 +902,7 @@ void sub_08047B08(GyorgMaleEntity* this) {
super->direction = sub_080045DA(this->unk_80 - super->x.HALF.HI, this->unk_82 - super->y.HALF.HI);
super->speed = 0x200;
sub_08047E58(this);
if (!sub_0806FCB8(super, this->unk_80, this->unk_82, 4))
if (!EntityWithinDistance(super, this->unk_80, this->unk_82, 4))
return;
if (super->type == 0) {
super->action = 7;
@@ -986,7 +986,7 @@ void sub_08047BF0(GyorgMaleEntity* this) {
}
}
}
sub_0805EC9C(this, 0xAA, 0xAA, this->unk_78);
sub_0805EC9C(super, 0xAA, 0xAA, this->unk_78);
}
void sub_08047D24(GyorgMaleEntity* this) {
@@ -1005,7 +1005,7 @@ void sub_08047D24(GyorgMaleEntity* this) {
} else {
sub_08047E58(this);
}
sub_0805EC9C(this, this->unk_7e, this->unk_7e, this->unk_78);
sub_0805EC9C(super, this->unk_7e, this->unk_7e, this->unk_78);
}
}
@@ -1019,7 +1019,7 @@ void sub_08047D88(GyorgMaleEntity* this) {
return;
if (super->animIndex == 1)
return;
if (!sub_0806FCB8(super, gPlayerEntity.x.HALF.HI, gPlayerEntity.y.HALF.HI, 0x20))
if (!EntityWithinDistance(super, gPlayerEntity.x.HALF.HI, gPlayerEntity.y.HALF.HI, 0x20))
return;
gPlayerState.field_0x14 = 1;
if (gPlayerEntity.z.HALF.HI != 0)
@@ -1033,7 +1033,7 @@ void sub_08047DF0(GyorgMaleEntity* this, u32 unk1) {
sub_08047EA4(this, unk1);
oldX = super->x.HALF.HI;
oldY = super->y.HALF.HI;
sub_0806F62C(super, super->speed, super->direction);
LinearMoveAngle(super, super->speed, super->direction);
if (this->unk_7c & 1) {
if (sub_08079F8C()) {
gPlayerEntity.x.HALF.HI += super->x.HALF.HI - oldX;
@@ -1051,7 +1051,7 @@ void sub_08047E58(GyorgMaleEntity* this) {
u32 oldX, oldY;
oldX = super->x.HALF.HI;
oldY = super->y.HALF.HI;
sub_0806F62C(super, super->speed, super->direction);
LinearMoveAngle(super, super->speed, super->direction);
if (this->unk_7c & 1) {
if (sub_08079F8C()) {
gPlayerEntity.x.HALF.HI += super->x.HALF.HI - oldX;
@@ -1149,7 +1149,7 @@ void sub_08048004(GyorgMaleEntity* this) {
} else {
u32 b = super->spriteRendering.b3;
if (b != 3) {
if (sub_0806FCB8(&gPlayerEntity, super->x.HALF.HI, super->y.HALF.HI, 0x24)) {
if (EntityWithinDistance(&gPlayerEntity, super->x.HALF.HI, super->y.HALF.HI, 0x24)) {
if (!(this->unk_7c & 2)) {
u32 tmp = sub_080045DA(gPlayerEntity.x.HALF.HI - super->x.HALF.HI,
gPlayerEntity.y.HALF.HI - super->y.HALF.HI);
+6 -6
View File
@@ -95,7 +95,7 @@ void sub_0802BCA8(Entity* this) {
this->action = 7;
this->actionDelay = 0x5a;
this->zVelocity = 0x18000;
this->zVelocity = Q_16_16(1.5);
this->hitType = 0x19;
this->field_0x3a = this->field_0x3a & 0xfb;
this->field_0x1c = 0x12;
@@ -222,7 +222,7 @@ void sub_0802BEBC(Entity* this) {
this->direction ^= 0x10;
sub_080AEFE0(this);
this->direction ^= 0x10;
if (!sub_080044EC(this, 0x2000)) {
if (!sub_080044EC(this, Q_16_16(0.125))) {
sub_0802C1C0(this);
}
}
@@ -234,7 +234,7 @@ void sub_0802BEEC(Entity* this) {
this->direction = this->animationState << 3;
InitializeAnimation(this, this->animationState + 4);
}
} else if (!GravityUpdate(this, 0x1c00)) {
} else if (!GravityUpdate(this, Q_16_16(0.109375))) {
this->action = 8;
this->actionDelay = 30;
this->speed = 0x120;
@@ -356,7 +356,7 @@ void sub_0802C18C(Entity* this) {
if ((this->field_0x78.HALF.LO & 7) == 0) {
Entity* ent = CreateObject(SPECIAL_FX, 0x11, 0x40);
if (ent) {
PositionRelative(this, ent, 0, 0x10000);
PositionRelative(this, ent, 0, Q_16_16(1.0));
}
}
}
@@ -374,8 +374,8 @@ void sub_0802C1CC(Entity* this) {
void sub_0802C218(Entity* this) {
this->action = 6;
this->speed = 0xe0;
this->zVelocity = 0x18000;
this->speed = Q_8_8(0.875);
this->zVelocity = Q_16_16(1.5);
}
// clang-format off
+1 -1
View File
@@ -229,7 +229,7 @@ void sub_08032794(Entity* this) {
target = CreateFx(this, FX_DASH, 0x40);
if (target != NULL) {
temp = &gUnk_080CE810[this->animationState * 2];
PositionRelative(this, target, temp[0] << 0x10, temp[1] << 0x10);
PositionRelative(this, target, Q_16_16(temp[0]), Q_16_16(temp[1]));
}
}
+2 -2
View File
@@ -98,7 +98,7 @@ void Keese_Sleep(Entity* this) {
if (this->actionDelay != 0) {
this->actionDelay--;
} else {
if (sub_0806FCB8(this, gPlayerEntity.x.HALF.HI, gPlayerEntity.y.HALF.HI, 0x70))
if (EntityWithinDistance(this, gPlayerEntity.x.HALF.HI, gPlayerEntity.y.HALF.HI, 0x70))
Keese_StartFly(this);
}
}
@@ -116,7 +116,7 @@ void sub_08021F24(Entity* this) {
this->actionDelay = gKeeseRestDurations[Random() & 0xf];
InitializeAnimation(this, KeeseAnimation_Rest);
} else if (!this->field_0x7a.HWORD &&
!(sub_0806FCB8(this, gPlayerEntity.x.HALF.HI, gPlayerEntity.y.HALF.HI, 0x70))) {
!(EntityWithinDistance(this, gPlayerEntity.x.HALF.HI, gPlayerEntity.y.HALF.HI, 0x70))) {
this->action = 3;
this->actionDelay = 30;
InitializeAnimation(this, KeeseAnimation_Rest);
+17 -15
View File
@@ -59,7 +59,7 @@ void Lakitu_DoAction(Entity* this) {
void sub_0803C784(Entity* this) {
if ((this->bitfield & 0x7f) == 0x1d) {
this->zVelocity = 0x20000;
this->zVelocity = Q_16_16(2.0);
sub_0803CBAC(this);
} else {
@@ -242,7 +242,7 @@ void Lakitu_Cloudless(Entity* this) {
}
bool32 sub_0803CA4C(Entity* this) {
if (sub_0806FCB8(this, gPlayerEntity.x.HALF.HI, gPlayerEntity.y.HALF.HI, 0x28) == 0) {
if (EntityWithinDistance(this, gPlayerEntity.x.HALF.HI, gPlayerEntity.y.HALF.HI, 0x28) == 0) {
if (EntityInRectRadius(this, &gPlayerEntity, 0x70, 0x50)) {
return 1;
}
@@ -267,7 +267,7 @@ void sub_0803CA84(Entity* this, u32 unkParameter) {
}
void sub_0803CAD0(Entity* this) {
if (sub_0806FCB8(this, this->field_0x74.HWORD, this->field_0x76.HWORD, 1) == 0) {
if (EntityWithinDistance(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);
@@ -316,9 +316,9 @@ void Lakitu_SpawnLightning(Entity* this) {
lightning->direction = this->field_0x78.HALF.LO;
PositionRelative(this, lightning, offset->x << 16, offset->y << 16);
PositionRelative(this, lightning, Q_16_16(offset->x), Q_16_16(offset->y));
EnqueueSFX(0x193);
EnqueueSFX(SFX_193);
}
void sub_0803CBAC(Entity* this) {
@@ -326,7 +326,7 @@ void sub_0803CBAC(Entity* this) {
cloud = this->child;
if (cloud != NULL) {
cloud->flags |= 0x80;
cloud->flags |= ENT_COLLIDE;
cloud->hitType = 0x43;
}
@@ -346,6 +346,8 @@ void sub_0803CC08(Entity* this) {
Entity* cloud;
Entity* fx;
const s32 diff = Q_8_8(3.0 / 128.0);
cloud = this->child;
if (cloud == NULL) {
return;
@@ -359,32 +361,32 @@ void sub_0803CC08(Entity* this) {
return;
}
if (!sub_0806FCB8(this, cloud->x.HALF.HI, cloud->y.HALF.HI, 6)) {
if (!EntityWithinDistance(this, cloud->x.HALF.HI, cloud->y.HALF.HI, 6)) {
return;
}
fx = CreateFx(this, FX_DEATH, 0);
if (fx != NULL) {
fx->x.HALF.HI += 6;
fx->y.HALF.HI += 6;
fx->x.HALF.HI += diff;
fx->y.HALF.HI += diff;
}
fx = CreateFx(this, FX_DEATH, 0);
if (fx != NULL) {
fx->x.HALF.HI -= 6;
fx->y.HALF.HI += 6;
fx->x.HALF.HI -= diff;
fx->y.HALF.HI += diff;
}
fx = CreateFx(this, FX_DEATH, 0);
if (fx != NULL) {
fx->x.HALF.HI += 6;
fx->y.HALF.HI -= 6;
fx->x.HALF.HI += diff;
fx->y.HALF.HI -= diff;
}
fx = CreateFx(this, FX_DEATH, 0);
if (fx != NULL) {
fx->x.HALF.HI -= 6;
fx->y.HALF.HI -= 6;
fx->x.HALF.HI -= diff;
fx->y.HALF.HI -= diff;
}
this->child = NULL;
+1 -1
View File
@@ -64,7 +64,7 @@ void sub_0803CD40(Entity* this) {
ModHealth(-2);
SoundReqClipped(&gPlayerEntity, 122);
SoundReqClipped(&gPlayerEntity, SFX_PLY_VO6);
sub_08079D84();
sub_0803CE3C(this);
+4 -4
View File
@@ -193,7 +193,7 @@ void sub_0802805C(Entity* this) {
} else {
ResetPlayer();
gPlayerState.mobility |= 0x80;
PositionRelative(this, &gPlayerEntity, 0, 0x10000);
PositionRelative(this, &gPlayerEntity, 0, Q_16_16(1.0));
tmp = GetSpriteSubEntryOffsetDataPointer((u16)this->spriteIndex, this->frameIndex);
gPlayerEntity.spriteOffsetX = tmp[0];
@@ -205,7 +205,7 @@ void sub_0802805C(Entity* this) {
}
if ((this->actionDelay & 3) == 0) {
EnqueueSFX(0x104);
EnqueueSFX(SFX_104);
}
}
}
@@ -214,8 +214,8 @@ NONMATCH("asm/non_matching/likeLike/sub_0802810C.inc", void sub_0802810C(Entity*
gPlayerState.jump_status = 0x41;
gPlayerState.field_0xa = 0;
gPlayerState.flags &= 0xffffffef;
gPlayerEntity.flags |= 0x80;
gPlayerEntity.zVelocity = 0x18000;
gPlayerEntity.flags |= ENT_COLLIDE;
gPlayerEntity.zVelocity = Q_16_16(1.5);
gPlayerEntity.iframes = -60;
gPlayerEntity.direction = gPlayerEntity.animationState << 2;
gPlayerEntity.spritePriority.b1 = this->field_0x82.HALF.HI;
+9 -9
View File
@@ -61,7 +61,7 @@ void sub_080298A4(Entity* this) {
this->hitType = 0x6b;
this->field_0x76.HALF.HI = 0;
ChangeObjPalette(this, 0x7f);
EnqueueSFX(0xfe);
EnqueueSFX(SFX_HIT);
this->child->action = 2;
break;
}
@@ -145,7 +145,7 @@ void sub_08029AA4(Entity* this) {
this->field_0x7a.HWORD = 0x168;
this->field_0x74.HALF.HI = 4;
sub_08029EEC(this);
EnqueueSFX(0x19d);
EnqueueSFX(SFX_19D);
}
}
@@ -159,7 +159,7 @@ void sub_08029AE0(Entity* this) {
this->field_0x74.HALF.HI = 0;
sub_08029EEC(this);
ChangeObjPalette(this, 0x77);
EnqueueSFX(0x182);
EnqueueSFX(SFX_182);
}
}
@@ -221,7 +221,7 @@ void sub_08029C2C(Entity* this) {
if (--this->actionDelay == 0) {
this->action = 4;
ChangeObjPalette(this, 0x7f);
EnqueueSFX(0x6c);
EnqueueSFX(SFX_MENU_CANCEL);
}
}
@@ -275,7 +275,7 @@ void sub_08029D14(Entity* this) {
if (--this->actionDelay == 0) {
InitializeAnimation(this, this->animationState + 0xc);
ChangeObjPalette(this, 0x7f);
EnqueueSFX(0x6c);
EnqueueSFX(SFX_MENU_CANCEL);
}
} else {
GetNextFrame(this);
@@ -284,7 +284,7 @@ void sub_08029D14(Entity* this) {
this->actionDelay = 0x78;
this->hitType = 0x6c;
this->hitbox = &gUnk_080FD298;
EnqueueSFX(0x6b);
EnqueueSFX(SFX_6B);
}
}
}
@@ -454,7 +454,7 @@ void sub_0802A098(Entity* this) {
if (sub_08029F48(this)) {
sub_08029E0C(this);
sub_08029EEC(this);
EnqueueSFX(0x104);
EnqueueSFX(SFX_104);
}
sub_08029FB4(this, this->x.HALF.HI - uVar1, this->y.HALF.HI - uVar2);
@@ -471,7 +471,7 @@ void sub_0802A0F8(Entity* this) {
}
}
} else {
this->parent->flags &= ~0x80;
this->parent->flags &= ~ENT_COLLIDE;
this->parent->health = 0;
this->parent->field_0xf = 0x69;
}
@@ -505,7 +505,7 @@ void sub_0802A18C(Entity* this) {
case 0x1e:
break;
default:
EnqueueSFX(0x12e);
EnqueueSFX(SFX_12E);
break;
}
}
+18 -18
View File
@@ -189,7 +189,7 @@ void sub_0803A274(Entity* this) {
pEVar1 = CreateObject(OBJECT_7E, 1, 0);
pEVar1->parent = this;
pEVar1->child = this->child;
PositionRelative(this->parent, this, 0x100000, 0x200000);
PositionRelative(this->parent, this, Q_16_16(16.0), Q_16_16(32.0));
} else {
pEVar1 = CreateEnemy(MAZAAL_HAND, 1);
pEVar1->parent = this;
@@ -201,7 +201,7 @@ void sub_0803A274(Entity* this) {
pEVar1->parent = this;
pEVar1->child = this->child;
this->spriteSettings.flipX = 1;
PositionRelative(this->parent, this, -0x100000, 0x200000);
PositionRelative(this->parent, this, Q_16_16(-16.0), Q_16_16(32.0));
}
if (gRoomTransition.field_0x38 != 0) {
this->action = 3;
@@ -590,8 +590,7 @@ void sub_0803AA00(Entity* this) {
}
}
}
NONMATCH("asm/non_matching/mazaal/sub_0803AA98.inc", void sub_0803AA98(Entity* this)) {
void sub_0803AA98(Entity* this) {
Entity* temp;
s8* ptr;
u32 index;
@@ -605,7 +604,8 @@ NONMATCH("asm/non_matching/mazaal/sub_0803AA98.inc", void sub_0803AA98(Entity* t
this->action = 0x14;
this->speed = 0x40;
InitializeAnimation(this, 10);
(*(Entity**)&this->field_0x74)->flags |= 0x80;
temp = (*(Entity**)&this->field_0x74);
temp->flags |= ENT_COLLIDE;
temp = this->child;
temp->hitType = 0x13;
InitAnimationForceUpdate(temp, 5);
@@ -613,7 +613,6 @@ NONMATCH("asm/non_matching/mazaal/sub_0803AA98.inc", void sub_0803AA98(Entity* t
}
}
}
END_NONMATCH
void sub_0803AB10(Entity* this) {
s8* ptr;
@@ -755,7 +754,7 @@ void sub_0803ADAC(Entity* this) {
if (--this->actionDelay == 0) {
this->action = 0x16;
this->spriteSettings.draw = 1;
(*(Entity**)&this->field_0x74)->flags |= 0x80;
(*(Entity**)&this->field_0x74)->flags |= ENT_COLLIDE;
InitializeAnimation(this, 0xb);
InitAnimationForceUpdate(this->child, 6);
sub_0803B798();
@@ -918,7 +917,7 @@ void sub_0803B100(Entity* this) {
Entity* temp;
this->action = 0x29;
this->zVelocity = 0x14000;
this->zVelocity = Q_16_16(1.25);
if (this->type == 0) {
this->hitbox = &gUnk_080FD364;
} else {
@@ -975,7 +974,7 @@ void sub_0803B1B8(Entity* this) {
if (temp != (Entity*)0x0) {
temp->actionDelay = 0;
temp->direction = 0x90;
PositionRelative(this, temp, this->hitbox->offset_x << 0x10, this->hitbox->offset_y << 0x10);
PositionRelative(this, temp, Q_16_16(this->hitbox->offset_x), Q_16_16(this->hitbox->offset_y));
}
temp = *(Entity**)&this->field_0x74;
temp->field_0x74.HALF.LO = 0x40;
@@ -1087,7 +1086,7 @@ void sub_0803B480(Entity* this) {
Entity* target;
if (((this->field_0x7c.HALF.HI & 0x1f) == 0) && (target = CreateObject(SMOKE, 1, 0), target != (Entity*)0x0)) {
PositionRelative(this, target, gUnk_080CFD08[this->type] << 0x10, 0);
PositionRelative(this, target, Q_16_16(gUnk_080CFD08[this->type]), 0);
}
if (--this->field_0x7c.HALF.HI == 0) {
sub_0803B6A4(this);
@@ -1105,7 +1104,7 @@ u32 sub_0803B4E4(Entity* this) {
xoff = this->parent->x.HALF.HI + gUnk_080CFD0A[this->type];
yoff = this->parent->y.HALF.HI + 0x10;
if (sub_0806FCB8(this, xoff, yoff, 2)) {
if (EntityWithinDistance(this, xoff, yoff, 2)) {
this->x.HALF.HI = xoff;
this->y.HALF.HI = yoff;
return 1;
@@ -1116,8 +1115,8 @@ u32 sub_0803B4E4(Entity* this) {
}
void sub_0803B538(Entity* this) {
PositionRelative(this, this->child, 0, -0x10000);
PositionRelative(this, *(Entity**)&this->field_0x74, 0, -0x20000);
PositionRelative(this, this->child, 0, Q_16_16(-1.0));
PositionRelative(this, *(Entity**)&this->field_0x74, 0, Q_16_16(-2.0));
}
void sub_0803B55C(Entity* this) {
@@ -1165,7 +1164,8 @@ void sub_0803B5C0(Entity* this) {
}
u32 sub_0803B610(Entity* this) {
return sub_0806FCB8(this, gPlayerEntity.x.HALF.HI + gUnk_080CFD19[this->type], gPlayerEntity.y.HALF.HI - 0xc, 8);
return EntityWithinDistance(this, gPlayerEntity.x.HALF.HI + gUnk_080CFD19[this->type],
gPlayerEntity.y.HALF.HI - 0xc, 8);
}
// sub_0803B698 was the tail of this function
@@ -1230,8 +1230,8 @@ void sub_0803B798(void) {
gPlayerState.jump_status = 0x41;
gPlayerState.field_0xa = 0;
gPlayerState.flags &= ~(0xffff0000 | PL_CAPTURED);
gPlayerEntity.flags |= 0x80;
gPlayerEntity.zVelocity = 0x18000;
gPlayerEntity.flags |= ENT_COLLIDE;
gPlayerEntity.zVelocity = Q_16_16(1.5);
gPlayerEntity.z.HALF.HI = -10;
gPlayerEntity.direction = 0x10;
gPlayerEntity.animationState = 4;
@@ -1244,7 +1244,7 @@ void sub_0803B798(void) {
void sub_0803B804(Entity* this) {
gPlayerEntity.iframes = 30;
ModHealth(-4);
SoundReqClipped(&gPlayerEntity, 0x7a);
SoundReqClipped(&gPlayerEntity, SFX_PLY_VO6);
}
void sub_0803B824(Entity* this) {
@@ -1263,7 +1263,7 @@ u32 sub_0803B870(Entity* this) {
this->action = 0x18;
this->actionDelay = 0x44;
this->spriteSettings.draw = 0;
gPlayerEntity.flags = gPlayerEntity.flags & 0x7f;
gPlayerEntity.flags &= ~ENT_COLLIDE;
gPlayerEntity.iframes = -0x10;
sub_0803B824(this);
entity->hitType = 0x13;
+4 -4
View File
@@ -221,7 +221,7 @@ void sub_08033FFC(Entity* this) {
}
break;
default:
if (((*(Entity**)&this->field_0x74)->flags & 0x80) != 0) {
if (((*(Entity**)&this->field_0x74)->flags & ENT_COLLIDE) != 0) {
gRoomControls.camera_target = &gPlayerEntity;
sub_08034420(this);
gPlayerState.controlMode = 1;
@@ -659,7 +659,7 @@ u32 sub_080348A4(Entity* this, Entity* hand_, u32 unk) {
break;
case 7:
hand_->action = 0x1b;
hand_->flags = hand_->flags & 0x7f;
hand_->flags = hand_->flags & ~ENT_COLLIDE;
InitializeAnimation(hand_, 5);
break;
case 8:
@@ -741,7 +741,7 @@ void sub_08034A84(Entity* this) {
}
void sub_08034AC4(Entity* this) {
PositionRelative(this->parent, this, 0, 0x10000);
PositionRelative(this->parent, this, 0, Q_16_16(1.0));
gUnk_080CED74[this->action](this);
}
@@ -782,7 +782,7 @@ void sub_08034B38(Entity* this) {
target->direction = this->actionDelay + 0x58;
}
ptr = &gUnk_080CED84[target->type * 2];
PositionRelative(this, target, *(ptr++) << 0x10, *ptr << 0x10);
PositionRelative(this, target, Q_16_16(*(ptr++)), Q_16_16(*ptr));
}
}
}
+1 -1
View File
@@ -57,7 +57,7 @@ void sub_08045654(Entity* this) {
void sub_08045678(Entity* this) {
this->zVelocity = 0x1c000;
this->zVelocity = Q_16_16(1.75);
if (this->actionDelay != 0) {
this->actionDelay--;
} else {
+4 -4
View File
@@ -85,9 +85,9 @@ void sub_080230E4(Entity* this) {
if (this->health == 0 && this->field_0x7c.BYTES.byte3 == 0 && this->action == 7) {
CopyPosition(this, &gPlayerEntity);
gPlayerEntity.flags = gPlayerEntity.flags | 0x80;
gPlayerEntity.flags |= ENT_COLLIDE;
gPlayerEntity.spriteSettings.draw = 1;
gPlayerEntity.zVelocity = 0x18000;
gPlayerEntity.zVelocity = Q_16_16(1.5);
gPlayerEntity.direction = 0xff;
gPlayerEntity.iframes = -0x14;
gPlayerState.jump_status = 0x41;
@@ -270,7 +270,7 @@ void sub_0802351C(Entity* this) {
if (this->type2 == 0) {
gPlayerEntity.animationState = this->animationState & 7;
gPlayerState.flags |= PL_MOLDWORM_CAPTURED;
PositionRelative(this, &gPlayerEntity, 0, gUnk_080CBC90[this->animationState & 7] << 0x10);
PositionRelative(this, &gPlayerEntity, 0, Q_16_16(gUnk_080CBC90[this->animationState & 7]));
gPlayerEntity.spriteOffsetY = -gUnk_080CBC90[this->animationState & 7];
}
} else {
@@ -411,7 +411,7 @@ void sub_08023894(Entity* this) {
gPlayerEntity.animationState = gPlayerEntity.direction >> 2;
gPlayerEntity.iframes = 12;
ModHealth(-0x10);
SoundReqClipped(&gPlayerEntity, 0x7a);
SoundReqClipped(&gPlayerEntity, SFX_PLY_VO6);
}
}
}
+1 -3
View File
@@ -8,8 +8,6 @@
#include "enemy.h"
#include "functions.h"
extern Entity* sub_08049DF4(u32);
void Octorok_Pause(Entity*);
bool32 Octorok_FacesPlayer(Entity*);
void Octorok_Turn(Entity*);
@@ -139,7 +137,7 @@ void Octorok_ShootNut(Entity* this) {
ent->y.HALF.HI += off[1];
ent->z.HALF.HI = -3;
this->frame &= 0xfe;
EnqueueSFX(0x18d);
EnqueueSFX(SFX_18D);
}
}
+8 -9
View File
@@ -13,7 +13,6 @@
extern void sub_08078AC0(u32, u32, u32);
extern u32 GetRandomByWeight(const u8*);
extern u32 sub_0806FC80(Entity*, Entity*, s32);
extern void sub_080792BC(s32, u32, u32);
enum OctorokRotation { ROTATION_CW, ROTATION_CCW, NO_ROTATION = 0xff };
@@ -618,7 +617,7 @@ void OctorokBoss_Action1(Entity* this) {
this->field_0x74.HWORD += 4;
}
}
ResolveEntityBelow(this->parent, this);
SortEntityBelow(this->parent, this);
if (((GET_HELPER(this)->field_0x2 != 0) || (this->parent->action == INTRO)) ||
(1 < (u8)(this->parent->subAction - 3))) {
if ((s8)this->field_0xf < 0) {
@@ -650,9 +649,9 @@ void OctorokBoss_Action1(Entity* this) {
if ((GET_HELPER(this)->tailCount - 2) < this->type2) {
DeleteThisEntity();
}
ResolveEntityOnTop(this->parent, this);
SortEntityAbove(this->parent, this);
if (GET_HELPER(this)->tailCount - 2 == this->type2) {
ResolveEntityOnTop(this->parent, this);
SortEntityAbove(this->parent, this);
radius = 0x10000 / this->parent->field_0x74.HWORD;
radius = radius << 0xd >> 0x8;
angle = -this->parent->field_0x7a.HALF.HI;
@@ -694,7 +693,7 @@ void OctorokBoss_Action1(Entity* this) {
if (this->health == 1) {
this->health = 0;
} else {
ResolveEntityBelow(this->parent, this);
SortEntityBelow(this->parent, this);
if ((this->parent->subAction != 4) && (this->health != 1)) {
if (GET_TIMER(this) > 0x1c) {
GET_TIMER(this)--;
@@ -833,7 +832,7 @@ void OctorokBoss_Action1_Attack(Entity* this) {
if (this->field_0x80.HALF.LO != 0) {
gPlayerEntity.spriteSettings.draw = 0;
gPlayerEntity.flags &= 0x7f;
gPlayerEntity.flags &= ~ENT_COLLIDE;
gPlayerEntity.collisionLayer = 2;
sub_08078B48();
sub_08077B20();
@@ -940,7 +939,7 @@ void OctorokBoss_ExecuteAttackVacuum(Entity* this) {
if (sub_0806FC80(this, &gPlayerEntity, 0xf0) != 0) {
if ((gPlayerState.flags & PL_FROZEN) == 0) {
if ((gPlayerEntity.flags & PL_MINISH) != 0) {
sub_0806F62C(&gPlayerEntity, 0x280, -GET_ANGLE_HI(this));
LinearMoveAngle(&gPlayerEntity, 0x280, -GET_ANGLE_HI(this));
if (sub_0806FC80(this, &gPlayerEntity, 0x48) != 0) {
this->field_0x80.HALF.LO = 1;
GET_TIMER(this) = 2;
@@ -973,7 +972,7 @@ void OctorokBoss_ExecuteAttackVacuum(Entity* this) {
GET_ANGULAR_VEL(this) = 0x100;
GET_HELPER(this)->mouthObject->field_0x78.HALF.HI++;
gPlayerEntity.spriteSettings.draw = 1;
gPlayerEntity.flags &= 0x7f;
gPlayerEntity.flags &= ~ENT_COLLIDE;
gPlayerEntity.collisionLayer = 1;
sub_080792BC(0x400, (u32)(-(GET_ANGLE_HI(this) + 0x80) * 0x1000000) >> 0x1b, 0x30);
OctorokBoss_SetAttackTimer(this);
@@ -1113,7 +1112,7 @@ void OctorokBoss_Burning_SubAction2(Entity* this) {
void sub_080368D8(Entity* this) {
if (this->field_0x80.HALF.LO != 0) {
gPlayerEntity.spriteSettings.draw = 1;
gPlayerEntity.flags |= 0x80;
gPlayerEntity.flags |= ENT_COLLIDE;
gPlayerEntity.collisionLayer = 1;
}
this->field_0x76.HWORD = 0xa0;
+2 -2
View File
@@ -265,7 +265,7 @@ void Peahat_RepairPropeller(Entity* this) {
return;
this->action = 9;
this->zVelocity = 0x18000;
this->zVelocity = Q_16_16(1.5);
this->direction = Random() & 0x1f;
sub_0804AA1C(this);
this->animationState = PeahatAnimation_RepairPropeller;
@@ -291,7 +291,7 @@ void Peahat_Hop(Entity* this) {
if (--this->actionDelay == 0) {
if (this->frame & 0x80) {
this->action = 9;
this->zVelocity = 0x18000;
this->zVelocity = Q_16_16(1.5);
this->animationState = PeahatAnimation_NewPropeller;
InitializeAnimation(this, this->animationState);
} else {
+5 -11
View File
@@ -11,12 +11,6 @@
#include "functions.h"
#include "save.h"
extern u32 sub_080002E0(u16, u32);
extern void SoundReqClipped(Entity*, u32);
extern u32 sub_08049F1C(Entity*, Entity*, u32);
extern u32 PlayerInRange(Entity*, u32, u32);
extern void sub_080AEFB4(Entity*);
void sub_080249F4(Entity*);
void sub_08024940(Entity*);
void sub_080249DC(Entity*);
@@ -188,7 +182,7 @@ void sub_080241C0(Entity* this) {
switch (this->field_0x80.HALF.LO) {
case 0:
if (PlayerInRange(this, 3, (gPlayerState.hurtBlinkSpeed != 0) ? 0xa0 : 0x40) && sub_08049FDC(this, 3) &&
gPlayerEntity.action != 0x1e) {
gPlayerEntity.action != PLAYER_USEENTRANCE) {
this->field_0x80.HALF.LO++;
this->speed = 0;
sub_08024A14(this, 3, 10);
@@ -398,7 +392,7 @@ void sub_080244E8(Entity* this) {
this->flags2 &= 0xfc;
sub_080249DC(this);
this->cutsceneBeh.HALF.HI = gPlayerEntity.spritePriority.b1;
gPlayerEntity.flags &= 0x7f;
gPlayerEntity.flags &= ~ENT_COLLIDE;
gPlayerState.flags |= PL_DISABLE_ITEMS;
gPlayerState.field_0xa |= 0x80;
if (gPlayerState.swim_state != 0) {
@@ -817,7 +811,7 @@ void sub_08024E4C(Entity* this) {
gPlayerState.field_0x38 = 0x14;
gPlayerState.field_0x39 = 1;
*(u8*)&gPlayerState.field_0x3a = 0;
PositionRelative(this, player, 0, 0x10000);
PositionRelative(this, player, 0, Q_16_16(1.0));
player->spriteOffsetY = 0x1a;
player->animationState = 4;
player->spritePriority.b1 = 0;
@@ -825,7 +819,7 @@ void sub_08024E4C(Entity* this) {
this->field_0x86.HALF.HI++;
player->iframes = 8;
ModHealth(-2);
SoundReqClipped(player, 0x7a);
SoundReqClipped(player, SFX_PLY_VO6);
}
}
}
@@ -835,7 +829,7 @@ void sub_08024F50(Entity* this) {
gPlayerState.field_0xa = 0;
gPlayerState.flags &= ~PL_DISABLE_ITEMS;
CopyPosition(this, &gPlayerEntity);
gPlayerEntity.action = 1;
gPlayerEntity.action = PLAYER_NORMAL;
COLLISION_ON(&gPlayerEntity);
gPlayerEntity.iframes = -0x3c;
gPlayerEntity.direction = gPlayerEntity.animationState << 2;
+10 -16
View File
@@ -9,12 +9,6 @@
#include "object.h"
#include "functions.h"
extern u32 sub_080002E0(u32, u32);
extern u32 sub_080002C8(u16, u8);
extern u8 sub_080002D4(u32, u32, u32);
extern void sub_0804AA1C(Entity*);
extern Entity* sub_08049DF4(u32);
extern u8 gUnk_080B37A0[];
extern u8 gUnk_080B3E80[];
@@ -95,7 +89,7 @@ void sub_08025020(Entity* this) {
ent->spritePriority.b0 = 3;
CopyPosition(this, ent);
}
EnqueueSFX(0x186);
EnqueueSFX(SFX_186);
}
break;
}
@@ -204,7 +198,7 @@ void sub_080252E0(Entity* this) {
this->action = 3;
this->actionDelay = 0x1e;
this->field_0xf = 0;
this->zVelocity = 0x18000;
this->zVelocity = Q_16_16(1.5);
InitializeAnimation(this, 1);
}
}
@@ -216,8 +210,8 @@ void sub_0802538C(Entity* this) {
if (this->frame == 0) {
GetNextFrame(this);
} else {
GravityUpdate(this, 0x2000);
if (this->zVelocity < 0x2000) {
GravityUpdate(this, Q_16_16(0.125));
if (this->zVelocity < Q_16_16(0.125)) {
this->action = 4;
InitializeAnimation(this, 2);
}
@@ -246,7 +240,7 @@ void sub_0802541C(Entity* this) {
if (this->frame & 0x80) {
this->action = 3;
this->field_0xf = 1;
this->zVelocity = 0x20000;
this->zVelocity = Q_16_16(2);
InitializeAnimation(this, 1);
}
}
@@ -263,7 +257,7 @@ void sub_0802544C(Entity* this) {
}
void sub_0802547C(Entity* this) {
GravityUpdate(this, 0x2000);
GravityUpdate(this, Q_16_16(0.125));
GetNextFrame(this);
if ((this->actionDelay & 7) == 0) {
sub_08025BD4(this);
@@ -275,7 +269,7 @@ void sub_0802547C(Entity* this) {
}
void sub_080254B4(Entity* this) {
GravityUpdate(this, 0x2000);
GravityUpdate(this, Q_16_16(0.125));
if (this->frame & 0x80) {
if (this->z.HALF.HI == 0) {
if (this->cutsceneBeh.HWORD == 0) {
@@ -559,7 +553,7 @@ void sub_08025B18(Entity* this) {
ent = CreateObject(OBJECT_21, 2, 0);
if (ent) {
PositionRelative(this, ent, offset[0] * 0x10000, offset[1] * 0x10000);
PositionRelative(this, ent, Q_16_16(offset[0]), Q_16_16(offset[1]));
ent->x.HALF.HI &= -0x10;
ent->x.HALF.HI += 8;
ent->y.HALF.HI &= -0x10;
@@ -573,8 +567,8 @@ void sub_08025BD4(Entity* this) {
if (this->field_0x82.HALF.LO && (this->frame & 1) == 0) {
Entity* ent = CreateObject(OBJECT_21, 0, 0);
if (ent) {
PositionRelative(this, ent, gUnk_080CC0BA[this->animationState * 2 + 0] * 0x10000,
gUnk_080CC0BA[this->animationState * 2 + 1] * 0x10000);
PositionRelative(this, ent, Q_16_16(gUnk_080CC0BA[this->animationState * 2 + 0]),
Q_16_16(gUnk_080CC0BA[this->animationState * 2 + 1]));
ent->z.HALF.HI = -10;
}
}
+4 -4
View File
@@ -37,7 +37,7 @@ void Rollobite_OnTick(Entity* this) {
void sub_08020668(Entity* this) {
if (this->hitType == 34 && this->health != 0xff) {
this->action = 4;
this->zVelocity = 0x20000;
this->zVelocity = Q_16_16(2.0);
this->direction = 0xff;
this->health = 0xff;
this->hitType = 35;
@@ -107,7 +107,7 @@ void sub_080207A8(Entity* this) {
this->spritePriority.b0 = 4;
this->field_0x3a &= 0xfb;
this->direction ^= 0x10;
this->zVelocity = 0x18000;
this->zVelocity = Q_16_16(1.5);
this->speed = 0x80;
InitializeAnimation(this, this->animationState + 0x10);
}
@@ -190,7 +190,7 @@ void Rollobite_RolledUp(Entity* this) {
sub_08078930(this);
} else {
if (unk == 1)
EnqueueSFX(260);
EnqueueSFX(SFX_104);
if ((this->direction & 0x80) == 0)
sub_080AEFE0(this);
@@ -267,7 +267,7 @@ bool32 Rollobite_TryToHoleUp(Entity* this) {
this->x.HALF.HI += 8;
this->y.HALF.HI &= 0xfff0;
this->y.HALF.HI += 13;
this->zVelocity = 0x20000;
this->zVelocity = Q_16_16(2.0);
InitializeAnimation(this, this->animationState + 0x14);
SetTile(0x4034, tile, this->collisionLayer);
return TRUE;
+1 -1
View File
@@ -95,7 +95,7 @@ void sub_08031480(Entity* this) {
this->field_0xf = 0xf;
this->spriteSettings.draw = 1;
UpdateSpriteForCollisionLayer(this);
EnqueueSFX(0x84);
EnqueueSFX(SFX_WATER_SPLASH);
}
}
}
+1 -1
View File
@@ -63,7 +63,7 @@ void sub_0803827C(Entity* this) {
this->field_0xf--;
} else {
if ((sub_0804A044(this, &gPlayerEntity, 0x8) != 0xff) ||
(sub_0806FCB8(this, gPlayerEntity.x.HALF.HI, gPlayerEntity.y.HALF.HI, 0x24) != 0)) {
(EntityWithinDistance(this, gPlayerEntity.x.HALF.HI, gPlayerEntity.y.HALF.HI, 0x24) != 0)) {
sub_080383E4(this);
return;
}
+4 -4
View File
@@ -71,7 +71,7 @@ void sub_08029318(Entity* this) {
this->field_0x82.HALF.HI = 0x41;
this->flags2 &= 0xfc;
this->field_0x80.HALF.LO = gPlayerEntity.spritePriority.b1;
EnqueueSFX(0x104);
EnqueueSFX(SFX_104);
} else {
if (this->field_0x43 != 0) {
sub_0804A9FC(this, 0x1c);
@@ -171,7 +171,7 @@ void sub_0802953C(Entity* this) {
} else {
ResetPlayer();
gPlayerState.mobility |= 0x80;
PositionRelative(this, &gPlayerEntity, 0, 0x10000);
PositionRelative(this, &gPlayerEntity, 0, Q_16_16(1.0));
pbVar3 = GetSpriteSubEntryOffsetDataPointer((u16)this->spriteIndex, this->frameIndex);
gPlayerEntity.spriteOffsetX = pbVar3[0];
gPlayerEntity.spriteOffsetY = pbVar3[1] - 1;
@@ -239,8 +239,8 @@ void sub_080296C8(Entity* this) {
void sub_080296D8(Entity* this) {
gPlayerState.jump_status = 0x41;
gPlayerState.flags &= ~PL_CAPTURED;
gPlayerEntity.flags |= 0x80;
gPlayerEntity.zVelocity = 0x18000;
gPlayerEntity.flags |= ENT_COLLIDE;
gPlayerEntity.zVelocity = Q_16_16(1.5);
gPlayerEntity.iframes = 0xa6;
gPlayerEntity.z.HALF.HI = -2;
gPlayerEntity.direction = gPlayerEntity.animationState << 2;
+1 -1
View File
@@ -95,7 +95,7 @@ void sub_0802BB10(Entity* this) {
this->action = 3;
this->speed = 0xc0;
this->direction = this->direction ^ 0x10;
EnqueueSFX(0x74);
EnqueueSFX(SFX_METAL_CLINK);
}
bool32 sub_0802BB2C(Entity* this, u32 param_2) {
-1
View File
@@ -16,7 +16,6 @@ void sub_08044FF8(Entity*);
void sub_08045178(Entity*, Entity*, int, int);
extern void sub_0804A4E4(Entity*, Entity*);
extern u32 sub_080002CC(Entity*, s32, s32);
extern void (*const gUnk_080D16BC[])(Entity*);
extern void (*const gUnk_080D16A4[])(Entity*);
+4 -4
View File
@@ -121,13 +121,13 @@ void sub_08023CE0(Entity* this) {
case 2:
if (this->actionDelay != 0) {
if (--this->actionDelay == 0) {
EnqueueSFX(0x12d);
EnqueueSFX(SFX_12D);
InitializeAnimation(this, 4);
}
} else if (!GravityUpdate(this, 0x1800)) {
} else if (!GravityUpdate(this, Q_8_8(24))) {
this->action = 3;
this->spriteSettings.draw = 1;
EnqueueSFX(0x84);
EnqueueSFX(SFX_WATER_SPLASH);
UpdateSpriteForCollisionLayer(this);
}
break;
@@ -169,7 +169,7 @@ void sub_08023E54(Entity* this) {
ent = CreateEnemy(SLUGGULA, 2);
if (ent) {
const s8* ptr = &gUnk_080CBDF7[this->animationState * 2];
PositionRelative(this, ent, ptr[0] << 0x10, ptr[1] << 0x10);
PositionRelative(this, ent, Q_16_16(ptr[0]), Q_16_16(ptr[1]));
}
}
}
+2 -5
View File
@@ -8,9 +8,6 @@
#include "enemy.h"
#include "functions.h"
extern bool32 sub_0806FC80(Entity*, Entity*, u32);
extern Entity* sub_08049DF4(u32);
void sub_08028604(Entity*);
void sub_08028754(Entity*);
void sub_08028784(Entity*);
@@ -171,7 +168,7 @@ void sub_08028488(Entity* this) {
this->action = 4;
this->speed = 0x180;
this->direction = sub_08049F84(this, 1);
EnqueueSFX(0x11e);
EnqueueSFX(SFX_EM_MOBLIN_SPEAR);
break;
case 2:
this->action = 2;
@@ -228,7 +225,7 @@ void sub_08028528(Entity* this) {
}
if ((this->actionDelay & 7) == 0) {
EnqueueSFX(0xf0);
EnqueueSFX(SFX_F0);
CreateFx(this, FX_DEATH, 0x40);
}
+4 -4
View File
@@ -54,7 +54,7 @@ void sub_0802B628(Entity* this) {
case 0x1d:
if (this->action < 6) {
this->action = 6;
this->zVelocity = 0x18000;
this->zVelocity = Q_16_16(1.5);
this->speed = 0xc0;
this->direction = this->knockbackDirection;
this->knockbackDuration = 0;
@@ -159,7 +159,7 @@ void sub_0802B8B0(Entity* this) {
this->actionDelay = 0x96;
/* fallthrough */
case 1:
EnqueueSFX(299);
EnqueueSFX(SFX_12B);
break;
}
}
@@ -171,11 +171,11 @@ void sub_0802B8E0(Entity* this) {
}
} else {
this->action = 8;
this->zVelocity = 0x10000;
this->zVelocity = Q_16_16(1.0);
this->speed = 0x60;
this->hitType = 99;
InitializeAnimation(this, this->animationState);
EnqueueSFX(299);
EnqueueSFX(SFX_12B);
}
}
+394
View File
@@ -0,0 +1,394 @@
#define NENT_DEPRECATED
#include "entity.h"
#include "enemy.h"
#include "functions.h"
#include "object.h"
typedef struct {
Entity base;
u8 filler[0xc];
u16 tile;
u16 tileIndex;
u8 unk_78;
u8 unk_79;
u8 unk_7a;
u8 unk_7b;
s32 unk_7c;
s32 unk_80;
u16 unk_84;
} SpinyBeetleEntity;
void (*const gUnk_080CEBEC[])(Entity*);
void (*const gUnk_080CEC04[])(SpinyBeetleEntity*);
const s8 gUnk_080CEC1C[];
extern void sub_08033E1C(SpinyBeetleEntity*);
extern void sub_08033D78(SpinyBeetleEntity*);
extern u32 sub_08033DF0(SpinyBeetleEntity*);
extern void SpinyBeetle_SetHitType(SpinyBeetleEntity*);
extern void sub_0804AA30(Entity*, EntityActionArray);
extern void sub_0807B9B8(s32, s32, s32);
extern u32 sub_0804A024(Entity*, u32, u32);
void SpinyBeetle(Entity* this) {
EnemyFunctionHandler(this, gUnk_080CEBEC);
SetChildOffset(this, 0, 1, -0x10);
}
void sub_080337BC(SpinyBeetleEntity* this) {
gUnk_080CEC04[super->action](this);
}
void sub_080337D4(SpinyBeetleEntity* this) {
if (super->field_0x43) {
sub_0804A9FC(super, 0x1c);
}
sub_0804AA30(super, gUnk_080CEBEC);
if (super->bitfield & 0x80) {
if (super->iframes > 0 && super->child) {
sub_08033E1C(this);
}
if ((super->bitfield & 0x3f) == 0x14 && super->action != 5) {
super->action = 3;
super->actionDelay = 0x5a;
super->field_0xf = 0x10;
super->spritePriority.b1 = 1;
super->direction = DirectionRoundUp(sub_08049F84(super, 1));
sub_08033D78(this);
InitializeAnimation(super, 3);
}
}
}
void nullsub_159(SpinyBeetleEntity* this) {
}
void sub_08033870(SpinyBeetleEntity* this) {
sub_08001242(super);
if (super->action != 5) {
if (sub_08033DF0(this)) {
sub_08033E1C(this);
}
}
}
void SpinyBeetle_Init(SpinyBeetleEntity* this) {
Entity* obj;
super->action = 1;
super->actionDelay = 0;
super->field_0xf = 0;
this->unk_7c = (super->x.WORD & 0xfff00000) | 0x80000;
this->unk_80 = (super->y.WORD & 0xfff00000) | 0x80000;
super->x.WORD = this->unk_7c;
super->y.WORD = this->unk_80;
this->unk_79 = 0;
this->unk_7a = 0;
this->unk_78 = 0;
this->unk_7b = 0;
this->tile = COORD_TO_TILE(super);
this->tileIndex = GetTileIndex(this->tile, super->collisionLayer);
SetTile(0x4022, this->tile, super->collisionLayer);
obj = CreateObject(OBJECT_ON_BEETLE, super->type, 0);
if (obj == NULL) {
DeleteThisEntity();
}
CopyPosition(super, obj);
super->child = obj;
obj->parent = super;
if (super->type == 1) {
SpinyBeetle_SetHitType(this);
}
InitializeAnimation(super, 0);
}
void sub_08033958(SpinyBeetleEntity* this) {
u32 direction;
if (sub_08033DF0(this)) {
sub_08033E1C(this);
sub_0807B9B8(this->tileIndex, this->tile, super->collisionLayer);
return;
}
if (this->unk_7b) {
this->unk_7b--;
return;
}
super->x.WORD = this->unk_7c;
super->y.WORD = this->unk_80;
direction = sub_0804A024(super, 1, 0x10);
switch (direction) {
case 0xff:
return;
case 0:
if (this->unk_78 == 0)
return;
if (super->y.HALF.HI - gPlayerEntity.y.HALF.HI > 0x30)
return;
break;
case 0x10:
if (gPlayerEntity.y.HALF.HI - super->y.HALF.HI > 0x30)
return;
break;
case 8:
if (gPlayerEntity.x.HALF.HI - super->x.HALF.HI > 0x30)
return;
break;
case 0x18:
if (super->x.HALF.HI - gPlayerEntity.x.HALF.HI > 0x30)
return;
break;
}
if (super->child && sub_0806F520(super->child)) {
return;
}
if (this->unk_78 == 0) {
this->unk_78 = 1;
}
super->action = 2;
super->direction = direction;
super->spriteSettings.draw = 1;
COLLISION_ON(super);
super->y.WORD = (super->y.WORD & 0xfff00000) | 0xC0000;
sub_0807B9B8(this->tileIndex, this->tile, super->collisionLayer);
InitializeAnimation(super, 2);
}
void sub_08033A7C(SpinyBeetleEntity* this) {
if (sub_08033DF0(this)) {
sub_08033E1C(this);
return;
}
GetNextFrame(super);
if ((super->frame & 0x80) == 0)
return;
super->action = 3;
super->actionDelay = 0x78;
super->field_0xf = 0x20;
super->spritePriority.b1 = 1;
InitializeAnimation(super, 3);
}
void sub_08033ACC(SpinyBeetleEntity* this) {
if (sub_08033DF0(this)) {
sub_08033E1C(this);
return;
}
GetNextFrame(super);
GetNextFrame(super);
if (super->field_0xf) {
super->field_0xf--;
return;
}
if (--super->actionDelay == 0) {
super->action = 4;
super->actionDelay = 0x78;
super->x.WORD = (super->x.WORD & 0xfff00000) | 0x80000;
super->y.WORD = (super->y.WORD & 0xfff00000) | 0xC0000;
this->unk_7c = super->x.WORD;
this->unk_80 = super->y.WORD;
InitializeAnimation(super, 4);
} else {
sub_08033D78(this);
}
}
void sub_08033B44(SpinyBeetleEntity* this) {
u32 stop;
if (sub_08033DF0(this)) {
sub_08033E1C(this);
return;
}
GetNextFrame(super);
if (--super->actionDelay)
return;
super->action = 1;
super->spriteSettings.draw = 0;
COLLISION_OFF(super);
stop = 0;
while (!stop) {
super->x.WORD = (super->x.WORD & 0xfff00000) | 0x80000;
super->y.WORD = (super->y.WORD & 0xfff00000) | 0x80000;
this->unk_7c = super->x.WORD;
this->unk_80 = super->y.WORD;
super->spritePriority.b1 = 0;
this->unk_7b = 0x78;
this->tile = COORD_TO_TILE(super);
this->tileIndex = GetTileIndex(this->tile, super->collisionLayer);
if (this->tileIndex != 0x4022) {
stop += 1;
} else {
switch (DirectionRound(super->direction) >> 2) {
case 0:
super->y.HALF.HI += 0x10;
break;
case 2:
super->x.HALF.HI -= 0x10;
break;
case 4:
super->y.HALF.HI -= 0x10;
break;
case 6:
super->x.HALF.HI += 0x10;
break;
}
}
}
SetTile(0x4022, this->tile, super->collisionLayer);
InitializeAnimation(super, 0);
}
void sub_08033C94(SpinyBeetleEntity* this) {
UpdateAnimationVariableFrames(super, 3);
switch (this->unk_79) {
case 0:
this->unk_79 = 1;
if (super->spriteSettings.draw != 1) {
super->spriteSettings.draw = 1;
}
case 1:
if (--super->actionDelay)
return;
this->unk_79 = 2;
super->actionDelay = 0x78;
super->spriteOffsetY = 0;
super->direction = sub_08049F84(super, 1) + 0x14;
switch (Random() & 3) {
case 0:
super->direction += 8;
break;
case 2:
super->direction += 0x18;
break;
}
super->direction &= 0x18;
break;
case 2:
if (super->field_0xf != 0) {
super->field_0xf--;
} else {
sub_08033D78(this);
}
if (--super->actionDelay)
return;
super->actionDelay = (Random() & 0x1f) + 0x20;
super->direction = sub_08049F84(super, 1) + 0x14;
switch (Random() & 3) {
case 1:
super->direction += 8;
break;
case 3:
super->direction += 0x18;
break;
}
super->direction &= 0x18;
break;
}
}
void sub_08033D78(SpinyBeetleEntity* this) {
u32 dir = DirectionRound(super->direction) >> 2;
const s8* ptr = gUnk_080CEC1C + dir;
s32 tile;
u32 type;
tile = COORD_TO_TILE_OFFSET(super, -ptr[0], -ptr[1]);
type = GetTileType(tile, super->collisionLayer);
switch (type) {
case 0x1c4:
case 0x1c5:
break;
default:
if (sub_080002E0(tile, super->collisionLayer) - 1 > 0x3e)
ProcessMovement(super);
break;
}
}
bool32 sub_08033DF0(SpinyBeetleEntity* this) {
bool32 rv = 0;
if (super->child == NULL) {
rv = 1;
} else {
switch (super->child->action) {
case 4:
rv = 1;
break;
case 3:
if (super->child->subAction > 1) {
rv = 1;
}
break;
case 2:
rv = 1;
break;
}
}
return rv;
}
void sub_08033E1C(SpinyBeetleEntity* this) {
super->action = 5;
this->unk_79 = 0;
super->spriteSettings.draw = 1;
COLLISION_ON(super);
super->spritePriority.b0 = 5;
super->y.WORD = (super->y.WORD & 0xfff00000) | 0xC0000;
super->hitType = 0x19;
super->spritePriority.b1 = 1;
super->actionDelay = 0x30;
super->field_0xf = 0;
super->speed = 0x100;
super->child = NULL;
InitializeAnimation(super, 3);
CreateSpeechBubbleExclamationMark(super, 0xa, -12);
}
void SpinyBeetle_SetHitType(SpinyBeetleEntity* this) {
if ((gPlayerState.field_0xac & 8)) {
super->hitType = 0x95;
} else {
super->hitType = 0x63;
}
}
const u16 unusedLabel_0CEBDC[] = {
0x3F, 0x1C, 0x50, 0x2A, 0x55, 0x1D, 0x5C, 0x2B,
};
void (*const gUnk_080CEBEC[])(Entity*) = {
(EntityActionPtr)sub_080337BC, (EntityActionPtr)sub_080337D4, sub_08001324, sub_0804A7D4,
(EntityActionPtr)sub_08033870, (EntityActionPtr)nullsub_159,
};
void (*const gUnk_080CEC04[])(SpinyBeetleEntity*) = {
SpinyBeetle_Init, sub_08033958, sub_08033A7C, sub_08033ACC, sub_08033B44, sub_08033C94,
};
const s8 gUnk_080CEC1C[] = { 0, -8, 8, 0, 0, 8, -8, 0 };
+9 -9
View File
@@ -75,7 +75,7 @@ void sub_0802244C(Entity* this) {
if (this->action == 3) {
this->action = 4;
InitializeAnimation(this, 3);
EnqueueSFX(0x194);
EnqueueSFX(SFX_194);
}
}
} else {
@@ -93,7 +93,7 @@ void sub_080225A0(Entity* this) {
}
void sub_080225BC(Entity* this) {
GravityUpdate(this, 0x1800);
GravityUpdate(this, Q_8_8(24.0));
if (this->frame & 1) {
sub_0804A7D4(this);
} else {
@@ -132,13 +132,13 @@ void sub_08022654(Entity* this) {
InitializeAnimation(this, 0);
/* fallthrough */
case 1:
if (GravityUpdate(this, 0x1800))
if (GravityUpdate(this, Q_8_8(24.0)))
return;
this->subAction = 2;
this->spriteSettings.draw = 1;
InitializeAnimation(this, 5);
EnqueueSFX(0x7d);
EnqueueSFX(SFX_PLY_LAND);
UpdateSpriteForCollisionLayer(this);
/* fallthrough */
case 2:
@@ -163,7 +163,7 @@ void sub_080226EC(Entity* this) {
if (sub_080228F0(this)) {
this->action = 6;
this->zVelocity = 0x12000;
this->zVelocity = Q_16_16(1.125);
this->speed = 0x140;
this->direction = GetFacingDirection(this, gUnk_020000B0);
this->hitType = 0x5a;
@@ -186,7 +186,7 @@ void sub_08022780(Entity* this) {
if (this->frame & 0x80) {
this->action = 4;
InitializeAnimation(this, 3);
EnqueueSFX(0x194);
EnqueueSFX(SFX_194);
}
}
@@ -211,7 +211,7 @@ void sub_080227AC(Entity* this) {
}
void sub_0802281C(Entity* this) {
GravityUpdate(this, 0x1800);
GravityUpdate(this, Q_8_8(24.0));
GetNextFrame(this);
if (this->frame & 0x80) {
this->action = 2;
@@ -225,11 +225,11 @@ void sub_08022854(Entity* this) {
GetNextFrame(this);
if (this->frame & 1) {
sub_080AEFE0(this);
if (GravityUpdate(this, 0x1800) == 0) {
if (GravityUpdate(this, Q_8_8(24.0)) == 0) {
this->action = 7;
this->hitType = 0x5c;
InitializeAnimation(this, 5);
EnqueueSFX(0x7d);
EnqueueSFX(SFX_PLY_LAND);
}
}
}
+1 -1
View File
@@ -3,7 +3,7 @@
void sub_080451CC(Entity* this, Entity* other) {
u8* pThis;
u8* pOther;
other->flags = this->flags & 0xfe;
other->flags = this->flags & ~ENT_DID_INIT;
other->x.WORD = this->x.WORD;
other->y.WORD = this->y.WORD;
other->z.WORD = this->z.WORD;
+1 -3
View File
@@ -20,8 +20,6 @@ typedef struct {
static_assert(sizeof(TakkuriEntity) == 0x88);
extern void sub_0803C0AC(Entity*);
extern Entity* sub_08049DF4(u32);
extern Entity* gUnk_020000B0;
void (*const gUnk_080CFF3C[])(Entity*);
@@ -341,7 +339,7 @@ void sub_0803C0AC(Entity* this) {
void sub_0803C120(TakkuriEntity* this) {
super->action = 5;
super->spriteSettings.draw = 0;
super->flags &= 0x7f;
super->flags &= ~ENT_COLLIDE;
super->x.HALF.HI = this->x_0x78;
super->y.HALF.HI = this->y_0x7a;
super->z.HALF.HI += 8;
+2 -2
View File
@@ -89,7 +89,7 @@ void sub_08037Fe0(Entity* this) {
this->action = 2;
this->actionDelay = 6;
this->field_0xf = 0;
this->zVelocity = 0x38000;
this->zVelocity = Q_16_16(3.5);
sub_08038168(this);
InitializeAnimation(this, 2);
}
@@ -145,7 +145,7 @@ void sub_08038110(Entity* this) {
if (this->field_0x80.HALF.LO < 5) {
this->action = 2;
this->actionDelay = 8;
this->zVelocity = 0x38000;
this->zVelocity = Q_16_16(3.5);
sub_08038168(this);
InitializeAnimation(this, 2);
} else {
+156
View File
@@ -0,0 +1,156 @@
#define NENT_DEPRECATED
#include "entity.h"
#include "enemy.h"
#include "functions.h"
typedef struct {
Entity base;
u8 filler[0xc];
u16 unk_74;
u16 filler2;
u16 unk_78;
u16 projectileTimer;
u16 unk_7c;
u8 filler3[0x2];
u16 unk_80;
u16 unk_82;
u16 unk_84;
} TorchTrapEntity;
void (*const gTorchTrapActions[])(TorchTrapEntity*);
const u16 gTorchTrapTimerLengths[];
const u16 gTorchTrapProjectileSpeeds[];
extern Entity* gUnk_020000B0;
bool32 sub_0803CFF0(TorchTrapEntity*);
bool32 sub_0803CFD8(TorchTrapEntity*);
void sub_0803D0B0(TorchTrapEntity*);
void TorchTrap_Reset(TorchTrapEntity*);
void TorchTrap_CreateProjectile(TorchTrapEntity*);
void TorchTrap(Entity* this) {
gTorchTrapActions[this->action]((TorchTrapEntity*)this);
}
void TorchTrap_Init(TorchTrapEntity* this) {
super->speed = (this->unk_84 & 0xf000) >> 5;
this->unk_84 &= 0xfff;
sub_0804A720(super);
super->action = 1;
this->unk_74 = this->unk_82 & 0xfff;
super->x.HALF.HI = ((this->unk_82 & 0x3f) << 4) + 8 + gRoomControls.origin_x;
super->y.HALF.HI = ((this->unk_82 & 0xfc0) >> 2) + (gRoomControls.origin_y + 8);
super->direction = ((s16)this->unk_82 & 0xf000) >> 10;
this->unk_78 = super->type << 2;
if (sub_0803CFF0(this)) {
sub_0803D0B0(this);
}
}
void sub_0803CF24(TorchTrapEntity* this) {
if (sub_0803CFD8(this)) {
TorchTrap_Reset(this);
}
}
void sub_0803CF38(TorchTrapEntity* this) {
if (sub_0803CFF0(this)) {
sub_0803D0B0(this);
} else if (sub_08049FDC(super, 0)) {
if (EntityWithinDistance(super, gUnk_020000B0->x.HALF.HI, gUnk_020000B0->y.HALF.HI, 0x20) == 0) {
if (--this->projectileTimer == 0) {
TorchTrap_CreateProjectile(this);
TorchTrap_Reset(this);
}
}
}
}
void sub_0803CF94(TorchTrapEntity* this) {
if (GetTileType(this->unk_74, super->collisionLayer) == 0x76) {
this->unk_80 = 0;
TorchTrap_Reset(this);
} else if (this->unk_7c && sub_0803CFD8(this)) {
TorchTrap_Reset(this);
}
}
bool32 sub_0803CFD8(TorchTrapEntity* this) {
u32 rv;
if (this->unk_7c == 0) {
rv = 1;
} else {
rv = CheckFlags(this->unk_7c);
}
return rv;
}
bool32 sub_0803CFF0(TorchTrapEntity* this) {
u32 rv;
if (this->unk_80 != 0) {
if (this->unk_80 == this->unk_7c) {
u32 val = CheckFlags(this->unk_80);
rv = 0;
if (val == 0) {
rv = 1;
}
return rv;
} else {
return CheckFlags(this->unk_80);
}
}
return 0;
}
void TorchTrap_Reset(TorchTrapEntity* this) {
u32 val;
super->action = 2;
if (this->unk_78) {
this->projectileTimer = this->unk_78;
} else {
this->projectileTimer = gTorchTrapTimerLengths[Random() & 7];
}
}
void TorchTrap_CreateProjectile(TorchTrapEntity* this) {
Entity* proj = CreateProjectileWithParent(super, TORCH_TRAP_PROJECTILE, 0);
if (proj) {
u16 speed = super->speed;
if (super->speed) {
proj->speed = speed;
} else {
proj->speed = gTorchTrapProjectileSpeeds[Random() & 3];
}
if (super->direction & 0x20) {
proj->direction = GetFacingDirection(super, gUnk_020000B0);
} else {
proj->direction = super->direction;
}
}
}
void sub_0803D0B0(TorchTrapEntity* this) {
super->action = 3;
sub_0807B7D8(0x75, this->unk_74, super->collisionLayer);
}
void (*const gTorchTrapActions[])(TorchTrapEntity*) = {
TorchTrap_Init,
sub_0803CF24,
sub_0803CF38,
sub_0803CF94,
};
const u16 gTorchTrapTimerLengths[] = {
0x3c, 0x3c, 0x5a, 0x5a, 0x5a, 0x78, 0x78, 0x96,
};
const u16 gTorchTrapProjectileSpeeds[] = {
0x80,
0x100,
0x180,
0x200,
};
+1 -1
View File
@@ -80,7 +80,7 @@ static bool32 ShouldSpawnTreeItem(Entity* this) {
int expectedStateX, expectedStateY;
int playerState;
if (gPlayerEntity.action != 0x6) {
if (gPlayerEntity.action != PLAYER_BOUNCE) {
return FALSE;
}
+24 -24
View File
@@ -269,15 +269,15 @@ void sub_08042654(Entity* this) {
break;
this->subAction = 5;
this->actionDelay = 0x5a;
((VaatiArm_HeapStruct*)this->myHeap)->entities[0]->flags |= 0x80;
((VaatiArm_HeapStruct*)this->myHeap)->entities[0]->flags |= ENT_COLLIDE;
((VaatiArm_HeapStruct*)this->myHeap)->entities[0]->spritePriority.b0 = 4;
((VaatiArm_HeapStruct*)this->myHeap)->entities[1]->flags |= 0x80;
((VaatiArm_HeapStruct*)this->myHeap)->entities[1]->flags |= ENT_COLLIDE;
((VaatiArm_HeapStruct*)this->myHeap)->entities[1]->spritePriority.b0 = 4;
((VaatiArm_HeapStruct*)this->myHeap)->entities[2]->flags |= 0x80;
((VaatiArm_HeapStruct*)this->myHeap)->entities[2]->flags |= ENT_COLLIDE;
((VaatiArm_HeapStruct*)this->myHeap)->entities[2]->spritePriority.b0 = 4;
((VaatiArm_HeapStruct*)this->myHeap)->entities[3]->flags |= 0x80;
((VaatiArm_HeapStruct*)this->myHeap)->entities[3]->flags |= ENT_COLLIDE;
((VaatiArm_HeapStruct*)this->myHeap)->entities[3]->spritePriority.b0 = 4;
((VaatiArm_HeapStruct*)this->myHeap)->entities[4]->flags |= 0x80;
((VaatiArm_HeapStruct*)this->myHeap)->entities[4]->flags |= ENT_COLLIDE;
((VaatiArm_HeapStruct*)this->myHeap)->entities[4]->spritePriority.b0 = 4;
InitAnimationForceUpdate(this, 7);
SoundReq(SFX_15E);
@@ -495,7 +495,7 @@ void sub_08042B20(Entity* this) {
CopyPosition(((VaatiArm_HeapStruct*)this->myHeap)->entities[4], object);
}
}
entity->flags &= 0x7f;
entity->flags &= ~ENT_COLLIDE;
entity->spriteSettings.draw = 0;
SoundReq(SFX_161);
}
@@ -599,7 +599,7 @@ void sub_08042D6C(Entity* this) {
entity = ((VaatiArm_HeapStruct*)this->myHeap)->entities[i];
if (entity->z.HALF.HI < 4) {
if (i != 2) {
entity->flags = entity->flags | 0x80;
entity->flags = entity->flags | ENT_COLLIDE;
}
if ((entity->spriteSettings.draw == 0u) && (object = CreateObject(OBJECT_AF, 2, 0), object != NULL)) {
CopyPosition(entity, object);
@@ -671,7 +671,7 @@ void sub_08042EF4(Entity* this) {
UpdateAnimationSingleFrame(this);
if (sub_08043C98(this) == 0) {
if (--this->actionDelay == 0) {
if (sub_0806FCB8(this, gPlayerEntity.x.HALF.HI, gPlayerEntity.y.HALF.HI, 0x50)) {
if (EntityWithinDistance(this, gPlayerEntity.x.HALF.HI, gPlayerEntity.y.HALF.HI, 0x50)) {
this->subAction = 6;
this->actionDelay = 0x28;
} else {
@@ -686,7 +686,7 @@ void sub_08042EF4(Entity* this) {
}
x = this->parent->x.HALF.HI;
y = this->parent->y.HALF.HI - 0x10;
if (sub_0806FCB8(this, x, y, 0x30)) {
if (EntityWithinDistance(this, x, y, 0x30)) {
temp = sub_080045D4(this->x.HALF.HI, this->y.HALF.HI, x, y);
if ((this->field_0x78.HALF.HI - temp) + 4 < 9) {
this->field_0x78.HALF.HI = temp ^ 0x10;
@@ -803,7 +803,7 @@ void sub_08043130(Entity* this) {
for (i = 0; i < 4; i++) {
entity = ((VaatiArm_HeapStruct*)this->myHeap)->entities[i];
if (entity->z.HALF.HI > -4) {
entity->flags = entity->flags & 0x7f;
entity->flags = entity->flags & ~ENT_COLLIDE;
if (entity->spriteSettings.draw == 1) {
SoundReq(SFX_161);
}
@@ -872,7 +872,7 @@ NONMATCH("asm/non_matching/vaati/sub_0804334C.inc", void sub_0804334C(Entity* th
}
for (i = 0; i < 5; i++) {
entity = ((VaatiArm_HeapStruct*)this->myHeap)->entities[i];
entity->flags = entity->flags | 0x80;
entity->flags = entity->flags | ENT_COLLIDE;
entity->spriteSettings.draw = 1;
}
}
@@ -951,22 +951,22 @@ void sub_08043490(Entity* this) {
entity = ((VaatiArm_HeapStruct*)this->myHeap)->entities[4];
if (entity->z.HALF.HI < -4) {
entity->zVelocity = 0x18000;
entity->zVelocity = Q_16_16(1.5);
this->subAction = 2;
this->field_0x7c.BYTES.byte2 = 0;
((VaatiArm_HeapStruct*)this->myHeap)->parent->subAction = 2;
} else {
entity->z.HALF.HI -= 2;
if (entity->z.HALF.HI < 0) {
entity->flags = entity->flags | 0x80;
entity->flags = entity->flags | ENT_COLLIDE;
entity->spriteSettings.draw = 1;
entity->field_0x3c = entity->field_0x3c & 0xef;
entity->hitType = 0x3a;
entity->hitbox = (Hitbox*)&gUnk_080FD450;
entity2 = ((VaatiArm_HeapStruct*)this->myHeap)->entities[2];
entity2->flags = entity2->flags | 0x80;
entity2->flags = entity2->flags | ENT_COLLIDE;
entity3 = ((VaatiArm_HeapStruct*)this->myHeap)->entities[3];
entity3->flags = entity3->flags & 0x7f;
entity3->flags = entity3->flags & ~ENT_COLLIDE;
}
}
UpdateAnimationSingleFrame(this);
@@ -976,7 +976,7 @@ void sub_08043520(Entity* this) {
Entity* entity;
entity = ((VaatiArm_HeapStruct*)this->myHeap)->entities[4];
GravityUpdate(entity, 0x1a00);
GravityUpdate(entity, Q_8_8(26.0));
if ((entity->zVelocity < 0) && (-6 < entity->z.HALF.HI)) {
entity->z.HALF.HI = -6;
this->subAction = 3;
@@ -1000,7 +1000,7 @@ void sub_08043580(Entity* this) {
for (i = 0; i < 5; i++) {
entity = ((VaatiArm_HeapStruct*)this->myHeap)->entities[i];
if (-4 < entity->z.HALF.HI) {
entity->flags = entity->flags & 0x7f;
entity->flags = entity->flags & ~ENT_COLLIDE;
entity->spriteSettings.draw = 0;
}
}
@@ -1052,7 +1052,7 @@ void sub_08043698(Entity* this) {
this->actionDelay = 0x3c;
for (i = 0; i < 5; i++) {
entity = ((VaatiArm_HeapStruct*)this->myHeap)->entities[i];
entity->flags = entity->flags & 0x7f;
entity->flags = entity->flags & ~ENT_COLLIDE;
}
}
@@ -1325,7 +1325,7 @@ void sub_08043D08(Entity* this) {
this->subAction = 0;
InitAnimationForceUpdate(this, 0xd);
entity = ((VaatiArm_HeapStruct*)this->myHeap)->entities[4];
entity->flags &= 0x7f;
entity->flags &= ~ENT_COLLIDE;
entity->spriteSettings.draw = 0;
InitializeAnimation(entity, 0x13);
sub_0804AA1C(entity);
@@ -1392,17 +1392,17 @@ void sub_08043EB8(Entity* this) {
this->spritePriority.b0 = 4;
InitAnimationForceUpdate(this, 0xd);
pEVar4 = ((VaatiArm_HeapStruct*)this->myHeap)->entities[1];
pEVar4->flags = pEVar4->flags | 0x80;
pEVar4->flags = pEVar4->flags | ENT_COLLIDE;
pEVar4->spritePriority.b0 = 4;
pEVar4 = ((VaatiArm_HeapStruct*)this->myHeap)->entities[2];
pEVar4->flags = pEVar4->flags | 0x80;
pEVar4->flags = pEVar4->flags | ENT_COLLIDE;
pEVar4->spritePriority.b0 = 4;
pEVar4 = ((VaatiArm_HeapStruct*)this->myHeap)->entities[3];
pEVar4->flags = pEVar4->flags & 0x7f;
pEVar4->flags = pEVar4->flags & ~ENT_COLLIDE;
pEVar4->spriteSettings.draw = 1;
pEVar4->spritePriority.b0 = 4;
pEVar4 = ((VaatiArm_HeapStruct*)this->myHeap)->entities[4];
pEVar4->flags = pEVar4->flags | 0x80;
pEVar4->flags = pEVar4->flags | ENT_COLLIDE;
pEVar4->spriteSettings.draw = 1;
pEVar4->spritePriority.b0 = 4;
pEVar4->x.HALF.HI = (this->type2 == 0) ? gRoomTransition.field_0x44 : gRoomTransition.field_0x48;
@@ -1432,7 +1432,7 @@ NONMATCH("asm/non_matching/vaati/sub_08044000.inc", void sub_08044000(Entity* th
ptr2 = &gUnk_080D1400[this->type2 * 5];
for (i = 0; i < 5; ptr2++, i++) {
entity = ((VaatiArm_HeapStruct*)this->myHeap)->entities[i];
entity->flags = entity->flags | 0x80;
entity->flags = entity->flags | ENT_COLLIDE;
entity->spritePriority.b0 = 4;
ptr = &((VaatiArm_HeapStruct*)this->myHeap)->s1[i];
ptr->unk00.HWORD = *ptr2;
+7 -7
View File
@@ -71,7 +71,7 @@ void sub_0804468C(Entity* this) {
this->field_0x82.HALF.HI = 0;
this->spriteSettings.draw = 0;
off = &gUnk_080D1620[this->field_0x78.HALF.HI & 3];
PositionRelative(this->parent, this, off->h << 0x10, (off->v - 0x10) * 0x10000);
PositionRelative(this->parent, this, Q_16_16(off->h), Q_16_16(off->v - 0x10));
this->z.HALF.HI = this->parent->z.HALF.HI;
InitAnimationForceUpdate(this, 0);
break;
@@ -170,7 +170,7 @@ void sub_08044868(Entity* this) {
break;
case 1:
LinearMoveUpdate(this);
if (sub_0806FCB8(this, vaati->x.HALF.HI, vaati->y.HALF.HI - 0x10, 0xc)) {
if (EntityWithinDistance(this, vaati->x.HALF.HI, vaati->y.HALF.HI - 0x10, 0xc)) {
this->field_0x74.HALF.LO++;
this->x.HALF.HI = vaati->x.HALF.HI;
this->y.HALF.HI = vaati->y.HALF.HI - 0x10;
@@ -383,7 +383,7 @@ void sub_08044B04(Entity* this) {
}
}
if (this->field_0x78.HALF.HI == 3)
if (sub_0806FCB8(this, vaati->x.HALF.HI, vaati->y.HALF.HI - 0x10, 0xc))
if (EntityWithinDistance(this, vaati->x.HALF.HI, vaati->y.HALF.HI - 0x10, 0xc))
vaati->actionDelay++;
this->direction = sub_080045B4(this, vaati->x.HALF.HI, vaati->y.HALF.HI - 0x10);
return;
@@ -397,7 +397,7 @@ void sub_08044B04(Entity* this) {
this->field_0x74.HALF.LO = 1;
this->actionDelay = 80;
COLLISION_OFF(this);
PositionRelative(vaati, this, 0, -0x100000);
PositionRelative(vaati, this, 0, Q_16_16(-16.0));
if (this->field_0xf)
this->spriteSettings.draw = 0;
break;
@@ -463,7 +463,7 @@ void sub_08044DEC(Entity* this) {
this->speed = 0x300;
off = this->parent->field_0x80.HALF.LO - 1;
this->direction = gUnk_080D1628[off][this->field_0x78.HALF.HI];
PositionRelative(this->parent, this, 0, -0x100000);
PositionRelative(this->parent, this, 0, Q_16_16(-16.0));
}
void sub_08044E74(Entity* this, u32 state) {
@@ -475,7 +475,7 @@ void sub_08044E74(Entity* this, u32 state) {
this->action = 2;
this->direction += 0x18;
this->direction &= 0x1f;
PositionRelative(this->parent, this, 0, -0x100000);
PositionRelative(this->parent, this, 0, Q_16_16(-16.0));
this->speed = 12288;
LinearMoveUpdate(this);
this->direction += 0x8;
@@ -509,5 +509,5 @@ void sub_08044E74(Entity* this, u32 state) {
}
this->actionDelay = 1;
this->field_0x78.HALF.LO = 0;
this->speed = 1280;
this->speed = Q_8_8(5);
}
-1
View File
@@ -8,7 +8,6 @@
#include "enemy.h"
#include "functions.h"
extern u32 sub_080002E0(u32, u32);
extern s16 gUnk_080B4488[];
void VaatiEyesMacroFunction0(Entity*);
+5 -7
View File
@@ -8,8 +8,6 @@
#include "enemy.h"
#include "functions.h"
extern bool32 PlayerInRange(Entity*, u32, u32);
extern u32 sub_080002E0(u32, u32);
extern Entity* gUnk_020000B0;
extern const ScreenTransitionData gUnk_0813AB94;
@@ -67,7 +65,7 @@ void VaatiProjectileFunction1(Entity* this) {
this->action = 5;
COLLISION_OFF(this);
this->spritePriority.b1 = 0;
gPlayerEntity.flags &= 0x7f;
gPlayerEntity.flags &= ~ENT_COLLIDE;
gPlayerEntity.spriteOrientation.flipY = this->spriteOrientation.flipY;
gPlayerEntity.spriteRendering.b3 = this->spriteRendering.b3;
sub_0803E444(this);
@@ -75,12 +73,12 @@ void VaatiProjectileFunction1(Entity* this) {
SetPlayerControl(2);
entity = this->parent;
if (entity != NULL) {
entity->flags = entity->flags & 0x7f;
entity->flags = entity->flags & ~ENT_COLLIDE;
}
} else {
gPlayerState.flags &= ~PL_DISABLE_ITEMS;
entity = &gPlayerEntity;
entity->flags = gPlayerEntity.flags | 0x80;
entity->flags = gPlayerEntity.flags | ENT_COLLIDE;
}
#endif
}
@@ -123,7 +121,7 @@ void VaatiProjectileFunction0Action0(Entity* this) {
this->spriteOrientation.flipY = this->parent->spriteOrientation.flipY;
this->spriteRendering.b3 = this->parent->spriteRendering.b3;
this->spritePriority.b1 = 0;
PositionRelative(this->parent, this, 0, -0x10000);
PositionRelative(this->parent, this, 0, Q_16_16(-1.0));
InitializeAnimation(this, 1);
}
}
@@ -209,7 +207,7 @@ void VaatiProjectileFunction0Action8(Entity* this) {
if (this->parent->next == NULL) {
DeleteThisEntity();
}
PositionRelative(this->parent, this, 0, -0x10000);
PositionRelative(this->parent, this, 0, Q_16_16(-1.0));
GetNextFrame(this);
}
+9 -9
View File
@@ -135,7 +135,7 @@ void VaatiRebornEnemyType0Action0(Entity* this) {
entity->parent = this;
entity->spriteSettings.flipX = i;
ptr = &gUnk_080D04A8[i];
PositionRelative(this, entity, ptr->x << 0x10, ptr->y << 0x10);
PositionRelative(this, entity, Q_16_16(ptr->x), Q_16_16(ptr->y));
}
InitAnimationForceUpdate(this, 0);
}
@@ -292,7 +292,7 @@ void VaatiRebornEnemyType0Action3(Entity* this) {
break;
case 0xff:
if (this->z.HALF.HI != -4) {
this->z.WORD -= 0x2000;
this->z.WORD -= Q_16_16(0.125);
}
if (this->actionDelay == 2) {
this->field_0x74.HALF.LO = 0xfe;
@@ -442,7 +442,7 @@ void VaatiRebornEnemyType0Action6(Entity* this) {
SoundReq(SFX_150);
target = CreateProjectileWithParent(this, 0x18, 0);
if (target != NULL) {
PositionRelative(this, target, 0, -0x100000);
PositionRelative(this, target, 0, Q_16_16(-16.0));
target->parent = this;
}
} else if (this->actionDelay == 0x40) {
@@ -500,7 +500,7 @@ void VaatiRebornEnemyType1Action0(Entity* this) {
this->field_0x74.HALF.HI = 1;
this->actionDelay = 0;
this->spriteOffsetY = -1;
PositionRelative(this->parent, this, 0, 0x10000);
PositionRelative(this->parent, this, 0, Q_16_16(1.0));
enemy = CreateEnemy(VAATI_REBORN_ENEMY, 2);
enemy->parent = this;
enemy->child = this->parent;
@@ -546,7 +546,7 @@ void VaatiRebornEnemyType1Action1(Entity* this) {
}
this->spriteSettings.draw = parent->spriteSettings.draw;
this->spriteOffsetX = parent->spriteOffsetX;
PositionRelative(this->parent, this, 0, 0x10000);
PositionRelative(this->parent, this, 0, Q_16_16(1.0));
UpdateAnimationSingleFrame(this);
}
@@ -559,7 +559,7 @@ void VaatiRebornEnemyType2Action0(Entity* this) {
this->field_0x74.HALF.HI = 0;
this->spriteOffsetY = -2;
this->direction = 0xff;
PositionRelative(source, this, 0, 0x20000);
PositionRelative(source, this, 0, Q_16_16(2.0));
InitAnimationForceUpdate(this, 2);
}
@@ -595,7 +595,7 @@ void VaatiRebornEnemyType2Action1(Entity* this) {
}
this->spriteSettings.draw = parent->spriteSettings.draw;
this->spriteOffsetX = parent->spriteOffsetX;
PositionRelative(parent->parent, this, 0, 0x20000);
PositionRelative(parent->parent, this, 0, Q_16_16(2.0));
UpdateAnimationSingleFrame(this);
}
@@ -637,7 +637,7 @@ void sub_0803DC0C(Entity* this) {
tmp = &gUnk_080D04C8[this->actionDelay];
this->spriteSettings.draw = parent->spriteSettings.draw;
this->spriteOffsetX = parent->spriteOffsetX;
PositionRelative(parent, this, tmp->x << 0x10, (tmp->y + 1) * 0x10000);
PositionRelative(parent, this, Q_16_16(tmp->x), Q_16_16(tmp->y + 1));
UpdateAnimationSingleFrame(this);
}
@@ -654,7 +654,7 @@ void VaatiRebornEnemyType1PreAction(Entity* this) {
if (2 < ++parent->field_0x86.HALF.LO) {
COLLISION_OFF(this);
parent->action = 7;
parent->flags &= 0x7f;
parent->flags &= ~ENT_COLLIDE;
parent->actionDelay = 0x80;
parent->spriteOffsetX = 0;
parent->direction = -1;
+6 -6
View File
@@ -314,7 +314,7 @@ void VaatiTransfiguredType0Action3(Entity* this) {
if (this->actionDelay != 0) {
if (--this->actionDelay == 0) {
COLLISION_OFF(this);
this->zVelocity = 0x38000;
this->zVelocity = Q_16_16(3.5);
this->field_0xf = 0x10;
}
break;
@@ -380,12 +380,12 @@ void VaatiTransfiguredType0Action4(Entity* this) {
this->field_0x74.HALF.LO = 0;
this->actionDelay = 0x80;
this->field_0xf = 0;
this->zVelocity = 0x24000;
this->zVelocity = Q_16_16(2.25);
SoundReq(SFX_12B);
}
break;
case 1:
if (GravityUpdate(this, 0x2800) != 0)
if (GravityUpdate(this, Q_8_8(40)) != 0)
break;
this->field_0x80.HALF.LO += 1;
switch (this->cutsceneBeh.HALF.LO) {
@@ -866,7 +866,7 @@ void sub_080406A0(Entity* this) {
uVar6 = gRoomControls.origin_x + gUnk_080D0B58[tmp = uVar5 * 2];
uVar4 = gRoomControls.origin_y + gUnk_080D0B58[tmp + 1];
}
if (sub_0806FCB8(this, uVar6, uVar4, 0x1c)) {
if (EntityWithinDistance(this, uVar6, uVar4, 0x1c)) {
if (uVar5 != 0) {
uVar5 = 0;
} else {
@@ -901,7 +901,7 @@ void sub_08040770(Entity* this) {
tmp5 = gRoomControls.origin_x + gUnk_080D0B64[index = tmp2 * 2];
tmp6 = gRoomControls.origin_y + gUnk_080D0B64[index + 1];
}
if (sub_0806FCB8(this, tmp5, tmp6, 0x1c)) {
if (EntityWithinDistance(this, tmp5, tmp6, 0x1c)) {
if (this->animationState != 2) {
if (tmp & 8) {
tmp2 += 1;
@@ -1062,7 +1062,7 @@ void sub_080409B0(Entity* this) {
this->field_0x80.HALF.HI = 3;
COLLISION_OFF(this);
this->hitType = 0x36;
this->zVelocity = 0x18000;
this->zVelocity = Q_16_16(1.5);
SoundReq(SFX_164);
}
}
+2 -2
View File
@@ -215,7 +215,7 @@ void VaatiTransfiguredEyeFunction0Action4(Entity* this) {
void sub_08045A00(Entity* this) {
const struct xy* t = &gUnk_080D18B4[this->type2];
PositionRelative(this->parent, this, t->x << 0x10, (t->y + 3) * 0x10000);
PositionRelative(this->parent, this, Q_16_16(t->x), Q_16_16(t->y + 3));
}
void sub_08045A28(Entity* this) {
@@ -291,7 +291,7 @@ void sub_08045A28(Entity* this) {
break;
}
} else {
PositionRelative(this->parent, this, 0, -0x10000);
PositionRelative(this->parent, this, 0, Q_16_16(-1.0));
switch (this->field_0x82.HALF.HI) {
case 0:
switch (this->frame & 0x70) {
+3 -3
View File
@@ -453,7 +453,7 @@ void VaatiWrathType0ActionA(Entity* this) {
this->subAction = 0;
this->direction = 0;
this->speed = 0x100;
this->zVelocity = 0x12000;
this->zVelocity = Q_16_16(1.125);
ChangeObjPalette(this, 0x16b);
InitAnimationForceUpdate(this, 5);
type1 = ((VaatiWrathHeapStruct*)this->myHeap)->type1;
@@ -828,11 +828,11 @@ u32 sub_0804207C(Entity* this) {
x = this->x.HALF.HI;
y = this->y.HALF.HI - 0x10;
arm = ((VaatiWrathHeapStruct*)this->myHeap)->arms[0];
if ((arm != NULL) && (arm->action >= 5) && sub_0806FCB8(arm, x, y, 0x30)) {
if ((arm != NULL) && (arm->action >= 5) && EntityWithinDistance(arm, x, y, 0x30)) {
return sub_080045D4(arm->x.HALF.HI, arm->y.HALF.HI, x, y);
} else {
arm = ((VaatiWrathHeapStruct*)this->myHeap)->arms[1];
if (((arm != NULL) && (arm->action >= 5)) && sub_0806FCB8(arm, x, y, 0x30)) {
if (((arm != NULL) && (arm->action >= 5)) && EntityWithinDistance(arm, x, y, 0x30)) {
return sub_080045D4(arm->x.HALF.HI, arm->y.HALF.HI, x, y);
} else {
if (gPlayerEntity.y.HALF.HI < 0x40) {
+1 -1
View File
@@ -148,7 +148,7 @@ void VaatiWrathEyeAction6(Entity* this) {
if (pEVar3 != NULL) {
pEVar3->parent = this;
this->child = pEVar3;
PositionRelative(this, pEVar3, 0, 0xc0000);
PositionRelative(this, pEVar3, 0, Q_16_16(12.0));
}
}
}
+1 -3
View File
@@ -9,8 +9,6 @@
#include "area.h"
#include "functions.h"
extern void sub_08001328(Entity*);
extern Entity* sub_08049DF4(u32);
extern ScreenTransitionData* gUnk_0813AB1C[];
void sub_0802A78C(Entity*);
@@ -94,7 +92,7 @@ void sub_0802A5B8(Entity* this) {
sub_0802A7D0(this);
if (this->actionDelay) {
if (--this->actionDelay == 0) {
EnqueueSFX(0x12d);
EnqueueSFX(SFX_12D);
InitializeAnimation(this, 0);
}
} else {
+2 -2
View File
@@ -41,7 +41,7 @@ void sub_0802CC80(Entity* this) {
this->action = 3;
COLLISION_OFF(this);
InitializeAnimation(this, 1);
gPlayerEntity.flags &= ~0x80;
gPlayerEntity.flags &= ~ENT_COLLIDE;
break;
}
if (this->field_0x43 != 0) {
@@ -125,7 +125,7 @@ void sub_0802CE68(Entity* this) {
gPlayerState.field_0xa |= 0x80;
gPlayerState.mobility |= 0x80;
gPlayerState.flags |= PL_DISABLE_ITEMS;
if (!sub_0806FCB8(this, gPlayerEntity.x.HALF.HI, gPlayerEntity.y.HALF.HI, 4)) {
if (!EntityWithinDistance(this, gPlayerEntity.x.HALF.HI, gPlayerEntity.y.HALF.HI, 4)) {
this->direction = GetFacingDirection(this, &gPlayerEntity);
LinearMoveUpdate(this);
}
+2 -2
View File
@@ -26,7 +26,7 @@ void sub_0802A250(Entity* this) {
this->action = 1;
this->actionDelay = 0;
this->zVelocity = -0x30000;
this->zVelocity = Q_16_16(-3.0);
this->speed = gUnk_080CD03C[Random() & 3];
this->direction = gUnk_080CD040[Random() & 3] + 0x18;
this->collisionLayer = 2;
@@ -43,7 +43,7 @@ void sub_0802A2B4(Entity* this) {
if (!GravityUpdate(this, 0x2800)) {
this->action = 2;
this->spritePriority.b0 = 7;
EnqueueSFX(0x84);
EnqueueSFX(SFX_WATER_SPLASH);
} else {
LinearMoveUpdate(this);
}