This commit is contained in:
theo3
2022-03-27 00:19:10 -07:00
212 changed files with 13172 additions and 18396 deletions
+102 -60
View File
@@ -10,15 +10,39 @@
extern Entity* gUnk_020000B0;
extern void (*const gUnk_080012C8[])(Entity*);
extern void (*const AcroBandit_Functions[])(Entity*);
extern void (*const gUnk_080CE584[])(Entity*);
extern void (*const gUnk_080CE58C[])(Entity*);
extern void (*const gUnk_080CE5C8[])(Entity*);
extern u8 gUnk_080CE5B0[8];
extern u8 gUnk_080CE5B8[8];
extern s8 gUnk_080CE5C0[8];
extern u16 gUnk_080CE5F0[5];
extern u8 gUnk_080CE5FA[20]; // Directions
void AcroBandit_OnTick(Entity* this);
void AcroBandit_OnCollision(Entity* this);
void AcroBandit_OnKnockback(Entity* this);
void GenericDeath(Entity* this);
void GenericConfused(Entity* this);
void AcroBandit_OnGrabbed(Entity* this);
void AcroBandit_Type0(Entity* this);
void AcroBandit_Type1(Entity* this);
void AcroBandit_Type0Action0(Entity* this);
void AcroBandit_Type0Action1(Entity* this);
void AcroBandit_Type0Action2(Entity* this);
void AcroBandit_Type0Action3(Entity* this);
void AcroBandit_Type0Action4(Entity* this);
void AcroBandit_Type0Action5(Entity* this);
void AcroBandit_Type0Action6(Entity* this);
void AcroBandit_Type0Action7(Entity* this);
void AcroBandit_Type0Action8(Entity* this);
void AcroBandit_Type1Init(Entity* this);
void AcroBandit_Type1Action1(Entity* this);
void AcroBandit_Type1Action2(Entity* this);
void AcroBandit_Type1Action3(Entity* this);
void AcroBandit_Type1Action4(Entity* this);
void AcroBandit_Type1Action5(Entity* this);
void AcroBandit_Type1Action6(Entity* this);
void AcroBandit_Type1Action7(Entity* this);
void AcroBandit_Type1Action8(Entity* this);
void AcroBandit_Type1Action9(Entity* this);
static void (*const AcroBandit_Functions[])(Entity*) = {
AcroBandit_OnTick, AcroBandit_OnCollision, AcroBandit_OnKnockback,
GenericDeath, GenericConfused, AcroBandit_OnGrabbed,
};
void AcroBandit(Entity* this) {
s32 index;
@@ -37,7 +61,11 @@ void AcroBandit(Entity* this) {
}
void AcroBandit_OnTick(Entity* this) {
gUnk_080CE584[this->type](this);
static void (*const typeFuncs[])(Entity*) = {
AcroBandit_Type0,
AcroBandit_Type1,
};
typeFuncs[this->type](this);
}
void AcroBandit_OnCollision(Entity* this) {
@@ -47,7 +75,7 @@ void AcroBandit_OnCollision(Entity* this) {
if (this->type == 1) {
if (this->action < 7 && this->knockbackDuration != 0) {
brother = this->child;
if (brother) {
if (brother != NULL) {
brother->parent = this->parent;
do {
brother->action = 5;
@@ -56,10 +84,10 @@ void AcroBandit_OnCollision(Entity* this) {
brother->iframes = -12;
} while (brother = brother->child, brother != NULL);
}
if (this->parent) {
if (this->parent != NULL) {
this->parent->child = this->child;
} else {
if (this->child)
if (this->child != NULL)
this->parent = this;
}
@@ -109,25 +137,27 @@ void AcroBandit_OnKnockback(Entity* this) {
GenericKnockback(this);
}
void AcroBandit_OnGrabbed(void) {
/* ... */
void AcroBandit_OnGrabbed(Entity* this) {
}
void sub_08031A88(Entity* this) {
gUnk_080CE58C[this->action](this);
void AcroBandit_Type0(Entity* this) {
static void (*const actionFuncs[])(Entity*) = {
AcroBandit_Type0Action0, AcroBandit_Type0Action1, AcroBandit_Type0Action2,
AcroBandit_Type0Action3, AcroBandit_Type0Action4, AcroBandit_Type0Action5,
AcroBandit_Type0Action6, AcroBandit_Type0Action7, AcroBandit_Type0Action8,
};
actionFuncs[this->action](this);
}
void sub_08031AA0(Entity* this) {
void AcroBandit_Type0Action0(Entity* this) {
sub_0804A720(this);
this->action = '\x01';
this->action = 1;
this->field_0x74.HWORD = this->x.HALF.HI;
this->field_0x76.HWORD = this->y.HALF.HI;
this->field_0x78.HALF.HI = Random();
}
void sub_08031AC8(Entity* this)
{
void AcroBandit_Type0Action1(Entity* this) {
u32 rand;
s32 x, y;
@@ -149,7 +179,9 @@ void sub_08031AC8(Entity* this)
}
}
void sub_08031B48(Entity* this) {
void AcroBandit_Type0Action2(Entity* this) {
static const u8 actionDelays[] = { 2, 2, 2, 3, 3, 3, 3, 4 };
GetNextFrame(this);
if (this->frame & 1) {
this->frame = 0;
@@ -157,13 +189,13 @@ void sub_08031B48(Entity* this) {
} else {
if (this->frame & ANIM_DONE) {
this->action = 0x3;
this->actionDelay = gUnk_080CE5B0[Random() & 7];
this->actionDelay = actionDelays[Random() & 7];
InitializeAnimation(this, 1);
}
}
}
void sub_08031B98(Entity* this) {
void AcroBandit_Type0Action3(Entity* this) {
if (sub_08031E04(this)) {
this->action = 5;
if (this->x.HALF.HI > gUnk_020000B0->x.HALF.HI) {
@@ -186,21 +218,22 @@ void sub_08031B98(Entity* this) {
}
}
void sub_08031C1C(Entity* this) {
void AcroBandit_Type0Action4(Entity* this) {
static const u8 actionDelays[] = { 60, 60, 90, 120, 120, 120, 120, 150 };
GetNextFrame(this);
if (this->frame & ANIM_DONE) {
this->action = '\x01';
this->actionDelay = gUnk_080CE5B8[Random() & 7];
this->action = 1;
this->actionDelay = actionDelays[Random() & 7];
this->spriteSettings.draw = 0;
}
}
void sub_08031C58(Entity* this) {
void AcroBandit_Type0Action5(Entity* this) {
Entity *a, *b;
GetNextFrame(this);
if (this->frame & ANIM_DONE) {
if (gEntCount < 0x43) {
if (gEntCount < MAX_ENTITIES - 4) {
u32 tmp = Random();
tmp &= 3;
@@ -252,7 +285,7 @@ void sub_08031C58(Entity* this) {
}
}
void sub_08031D70(Entity* this) {
void AcroBandit_Type0Action6(Entity* this) {
GetNextFrame(this);
if (--this->actionDelay == 0) {
this->action = 7;
@@ -262,7 +295,7 @@ void sub_08031D70(Entity* this) {
}
}
void sub_08031DA0(Entity* this) {
void AcroBandit_Type0Action7(Entity* this) {
if ((this->actionDelay & 0xf) == 0) {
if (this->actionDelay == 0x50) {
DeleteEntity(this);
@@ -273,7 +306,7 @@ void sub_08031DA0(Entity* this) {
}
}
void sub_08031DC4(Entity* this) {
void AcroBandit_Type0Action8(Entity* this) {
if (this->frame & ANIM_DONE) {
this->action = 1;
this->actionDelay = 0xb4;
@@ -286,13 +319,14 @@ void sub_08031DC4(Entity* this) {
}
}
u32 sub_08031E04(Entity* this) {
bool32 sub_08031E04(Entity* this) {
static const s8 gUnk_080CE5C0[] = { -32, 0, 0, 32, 32, 0, 0, 0 };
Entity* ent;
s8* tmp;
const s8* tmp;
ent = sub_08049DF4(1);
if (ent == NULL)
return 0;
return FALSE;
tmp = &gUnk_080CE5C0[this->frame & 6];
return EntityWithinDistance(this, ent->x.HALF.HI + tmp[0], ent->y.HALF.HI + tmp[1], 0x50);
@@ -308,11 +342,16 @@ void sub_08031E48(Entity* this, Entity* child) {
child->field_0x7c.WORD = (s32)this;
}
void sub_08031E90(Entity* this) {
gUnk_080CE5C8[this->action](this);
void AcroBandit_Type1(Entity* this) {
static void (*const actionFuncs[])(Entity*) = {
AcroBandit_Type1Init, AcroBandit_Type1Action1, AcroBandit_Type1Action2, AcroBandit_Type1Action3,
AcroBandit_Type1Action4, AcroBandit_Type1Action5, AcroBandit_Type1Action6, AcroBandit_Type1Action7,
AcroBandit_Type1Action8, AcroBandit_Type1Action9,
};
actionFuncs[this->action](this);
}
void sub_08031EA8(Entity* this) {
void AcroBandit_Type1Init(Entity* this) {
this->action = 1;
this->spritePriority.b1 = 1;
this->zVelocity = Q_16_16(4.0);
@@ -321,7 +360,7 @@ void sub_08031EA8(Entity* this) {
InitializeAnimation(this, 4);
}
void sub_08031EE8(Entity* this) {
void AcroBandit_Type1Action1(Entity* this) {
int draw;
this->z.WORD -= this->zVelocity;
@@ -346,8 +385,10 @@ void sub_08031EE8(Entity* this) {
}
}
void sub_08031F54(Entity* this) {
GravityUpdate(this, gUnk_080CE5F0[this->type2]);
void AcroBandit_Type1Action2(Entity* this) {
static const u16 banditGravity[] = { 0x1600, 0x1300, 0x1000, 0xD00, 0xB00 };
GravityUpdate(this, banditGravity[this->type2]);
if (this->type2 * -0xe <= this->z.HALF.HI) {
this->action = 3;
this->actionDelay = 20;
@@ -358,13 +399,13 @@ void sub_08031F54(Entity* this) {
}
}
void sub_08031FB0(Entity* this) {
void AcroBandit_Type1Action3(Entity* this) {
GetNextFrame(this);
if ((this->frame & ANIM_DONE) && (this->parent || --this->actionDelay == 0)) {
if ((this->frame & ANIM_DONE) && ((this->parent != NULL) || (--this->actionDelay == 0))) {
this->action = 4;
this->direction = sub_08049F84(this, 1);
*(u8*)&this->field_0x76 = 0;
if (this->child) {
if (this->child != NULL) {
InitializeAnimation(this, 9);
} else {
InitializeAnimation(this, 8);
@@ -372,12 +413,12 @@ void sub_08031FB0(Entity* this) {
}
}
void sub_08032008(Entity* this) {
void AcroBandit_Type1Action4(Entity* this) {
Entity* parent;
if (sub_080322A4(this) == 0) {
if (!sub_080322A4(this)) {
parent = this->parent;
if (parent == 0) {
if (parent == NULL) {
if (sub_08049FDC(this, 1)) {
if ((++this->field_0x78.HALF.HI & 7) == 0) {
sub_08004596(this, GetFacingDirection(this, gUnk_020000B0));
@@ -421,20 +462,22 @@ void sub_08032008(Entity* this) {
}
}
void sub_08032148(Entity* this) {
void AcroBandit_Type1Action5(Entity* this) {
if (GravityUpdate(this, 0x2000))
return;
sub_08032290(this);
}
void sub_08032160(Entity* this) {
void AcroBandit_Type1Action6(Entity* this) {
static const u8 fallDirections[] = { 0x8, 0x1c, 0x11, 0x2, 0x15, 0xc, 0x0, 0x15, 0x6, 0x19,
0x10, 0x4, 0x19, 0xa, 0x1d, 0x14, 0x8, 0x1d, 0xe, 0x1 };
Entity* tmp;
u32 dir;
if (this->actionDelay == 0) {
this->action = 7;
dir = gUnk_080CE5FA[this->field_0x74.HALF.LO * 5 + this->type2];
dir = fallDirections[this->field_0x74.HALF.LO * 5 + this->type2];
this->direction = dir;
if (dir >= 0x10) {
this->spriteSettings.flipX = 1;
@@ -456,14 +499,14 @@ void sub_08032160(Entity* this) {
}
}
void sub_080321E8(Entity* this) {
void AcroBandit_Type1Action7(Entity* this) {
ProcessMovement2(this);
if (sub_080044EC(this, 0x2000) == 0)
this->action = 8;
}
void sub_08032204(Entity* this) {
void AcroBandit_Type1Action8(Entity* this) {
GetNextFrame(this);
if (this->frame & 1) {
this->frame = 0;
@@ -476,7 +519,7 @@ void sub_08032204(Entity* this) {
}
}
void sub_08032248(Entity* this) {
void AcroBandit_Type1Action9(Entity* this) {
if (GravityUpdate(this, Q_8_8(24.0)) == 0) {
if (this->frame & ANIM_DONE) {
((Entity*)this->field_0x7c.WORD)->actionDelay--;
@@ -497,30 +540,29 @@ void sub_08032290(Entity* this) {
InitializeAnimation(this, 11);
}
u32 sub_080322A4(Entity* this) {
bool32 sub_080322A4(Entity* this) {
if (this->child != NULL && (this->child->z.HALF.HI + 8) >= this->z.HALF.HI) {
if (this->z.HALF.HI) {
this->action = 5;
this->z.HALF.HI = this->child->z.HALF.HI + 8;
InitializeAnimation(this, 11);
return 1;
return TRUE;
} else {
sub_08032290(this);
return 1;
return TRUE;
}
}
return 0;
return FALSE;
}
void sub_080322E8(Entity* this) {
u8 tmp;
if (this->field_0x78.HALF.LO) {
if (--this->field_0x78.HALF.LO == 0) {
u32 flipX = this->spriteSettings.flipX;
this->spriteSettings.flipX = flipX ^ 1;
}
} else {
tmp = this->direction;
u8 tmp = this->direction;
if (tmp & 0xF) {
tmp >>= 4;
tmp ^= 1;
+2 -2
View File
@@ -306,12 +306,12 @@ bool32 sub_08030650(ArmosEntity* this) {
return 1;
}
} else if (this->unk_80 != 2) {
if ((sub_08049FDC(super, 1) == 0) || (0x20 < (gUnk_020000B0->x.HALF.HI - super->x.HALF.HI) + 0x10U)) {
if (!sub_08049FDC(super, 1) || (0x20 < (gUnk_020000B0->x.HALF.HI - super->x.HALF.HI) + 0x10U)) {
return FALSE;
}
return TRUE;
} else {
if (sub_08049FDC(super, 1) == 0) {
if (!sub_08049FDC(super, 1)) {
return FALSE;
}
if (gUnk_020000B0->x.HALF.HI >= (s32)(gRoomControls.origin_x + 0xa8)) {
+1 -1
View File
@@ -60,7 +60,7 @@ void Beetle_OnDeath(Entity* this) {
GenericDeath(this);
} else {
Entity* ent = this->parent;
if (ent) {
if (ent != NULL) {
ent->field_0xf--;
this->parent = NULL;
}
+4 -3
View File
@@ -6,6 +6,7 @@
*/
#include "asm.h"
#include "collision.h"
#include "sound.h"
#include "enemy.h"
#include "object.h"
@@ -160,7 +161,7 @@ void sub_0802C91C(Entity* this) {
GetNextFrame(this);
ProcessMovement0(this);
if (this->field_0x82.HALF.LO) {
if (this->collisions) {
if (this->collisions != COL_NONE) {
sub_0800417E(this, this->collisions);
InitializeAnimation(this, (this->direction >> 4) | 2);
}
@@ -173,7 +174,7 @@ void sub_0802C91C(Entity* this) {
sub_0802CC18(this);
}
} else {
if (this->collisions) {
if (this->collisions != COL_NONE) {
sub_0800417E(this, this->collisions);
InitializeAnimation(this, this->direction >> 4);
}
@@ -289,7 +290,7 @@ void sub_0802CBC4(Entity* this) {
FreeCarryEntity(this);
ent = CreateObjectWithParent(this, OBJECT_20, 0, 0);
if (ent) {
if (ent != NULL) {
ent->collisionLayer = this->collisionLayer;
}
}
+12 -13
View File
@@ -92,7 +92,6 @@ void sub_0802A8FC(Entity* this) {
}
void nullsub_143(Entity* this) {
/* ... */
}
void sub_0802A91C(Entity* this) {
@@ -167,7 +166,7 @@ void sub_0802AA40(Entity* this) {
this->actionDelay--;
} else {
Entity* ent = this->child;
if (ent) {
if (ent != NULL) {
if (ent->next == NULL) {
this->child = NULL;
} else {
@@ -212,7 +211,7 @@ void sub_0802AAC0(Entity* this) {
}
}
#else
} else if (ent->actionDelay == 0 && ent->field_0xf < 0x51) {
} else if ((ent->actionDelay == 0) && (ent->field_0xf <= 0x50)) {
this->field_0x80.HALF.HI = 0;
}
#endif
@@ -304,7 +303,7 @@ void sub_0802AC40(Entity* this) {
GetNextFrame(this);
LinearMoveUpdate(this);
if (this->field_0x7a.HALF.LO) {
if (sub_0802B234(this) == 0) {
if (!sub_0802B234(this)) {
this->field_0x7a.HALF.LO = 0;
this->spritePriority.b1 = 0;
#ifndef EU
@@ -349,7 +348,7 @@ void sub_0802ACDC(Entity* this, u32 param_2) {
void sub_0802AD1C(Entity* this, u32 param_2) {
Entity* ent = sub_08049DF4(1);
if (ent) {
if (ent != NULL) {
u32 y = ent->y.HALF.HI - 0x18;
u32 x = ent->x.HALF.HI;
sub_08004596(this, sub_080045B4(this, x, y));
@@ -416,7 +415,7 @@ void sub_0802AE24(Entity* this) {
#ifdef EU
void sub_0802AE68(Entity* this) {
Entity* ent = this->parent;
if (ent == 0) {
if (ent == NULL) {
this->action = 3;
this->spriteSettings.draw = 1;
this->field_0x80.HALF.LO = 1;
@@ -441,7 +440,7 @@ void sub_0802AE68(Entity* this) {
#else
void sub_0802AE68(Entity* this) {
Entity* ent = sub_0802B250(this);
if (ent == 0) {
if (ent == NULL) {
this->action = 3;
this->field_0x80.HALF.LO = 1;
sub_0802B264(this);
@@ -559,7 +558,7 @@ void sub_0802B048(Entity* this) {
}
ent = this->parent;
if (ent && this->action == 1) {
if ((ent != NULL) && this->action == 1) {
this->spriteRendering.b3 = ent->spriteRendering.b3;
this->spritePriority.b0 = ent->spritePriority.b0;
this->spriteOrientation.flipY = ent->spriteOrientation.flipY;
@@ -588,7 +587,7 @@ void sub_0802B048(Entity* this) {
COLLISION_ON(this);
this->field_0x7a.HALF.HI = 0;
FreeCarryEntity(this);
if (this->parent->next) {
if (this->parent->next != NULL) {
this->parent->field_0x80.HALF.HI = 0;
}
ent = CreateObjectWithParent(this, OBJECT_20, 0, 0);
@@ -622,7 +621,7 @@ void sub_0802B1BC(Entity* this) {
}
ent = this->parent;
if (ent == 0) {
if (ent == NULL) {
this->action = 2;
this->spriteSettings.draw = 1;
}
@@ -651,7 +650,7 @@ void sub_0802B1BC(Entity* this) {
}
ent = sub_0802B250(this);
if (ent == 0) {
if (ent == NULL) {
this->action = 2;
sub_0802B264(this);
} else {
@@ -668,7 +667,7 @@ void sub_0802B1BC(Entity* this) {
void sub_0802B204(Entity* this) {
if (sub_080044EC(this, 0x2800) == 1) {
Entity* ent = CreateEnemy(BOBOMB, 1);
if (ent) {
if (ent != NULL) {
CopyPosition(this, ent);
ent->parent = this->parent;
}
@@ -686,7 +685,7 @@ bool32 sub_0802B234(Entity* this) {
#ifndef EU
Entity* sub_0802B250(Entity* this) {
Entity* parent = this->parent;
if (parent && parent->next == NULL) {
if ((parent != NULL) && (parent->next == NULL)) {
parent = NULL;
}
return parent;
+1 -1
View File
@@ -44,7 +44,7 @@ void Bombarossa_OnCollision(BombarossaEntity* this) {
switch (super->bitfield & 0x7f) {
default:
ent = CreateObject(OBJECT_20, 0, 0);
if (ent) {
if (ent != NULL) {
CopyPosition(super, ent);
}
DeleteThisEntity();
+2 -2
View File
@@ -230,7 +230,7 @@ void sub_0803C400(BowMoblinEntity* this) {
}
sub_0803C6DC(this);
if (super->child) {
if (super->child != NULL) {
sub_0803C714(this);
}
}
@@ -271,7 +271,7 @@ void sub_0803C4B0(BowMoblinEntity* this) {
u32 sub_0803C568(BowMoblinEntity* this) {
if (this->unk_0x81 == 0) {
Entity* ent = sub_08049DF4(1);
if (ent) {
if (ent != NULL) {
if (this->unk_0x82 == 2) {
if (sub_0806FC80(super, ent, 0x30)) {
return 1;
+1 -1
View File
@@ -384,7 +384,7 @@ void sub_08028F0C(Entity* this) {
SetPlayerControl(1);
}
MessageFromTarget(dialog);
gMessage.field_0x10 = offer->price;
gMessage.rupees = offer->price;
}
}
+6 -6
View File
@@ -48,7 +48,7 @@ void BusinessScrubPrologue_OnCollision(BusinessScrubPrologueEntity* this) {
super->flags &= ~ENT_COLLIDE;
sub_08046030(this, 4);
ent = CreateFx(super, FX_BUSH, 0);
if (ent) {
if (ent != NULL) {
ent->z.HALF.HI -= 8;
}
@@ -123,7 +123,7 @@ void sub_08045CE0(BusinessScrubPrologueEntity* this) {
sub_0804604C(this);
if (super->frame & 1) {
ent = CreateProjectileWithParent(super, DEKU_SEED_PROJECTILE, 0);
if (ent) {
if (ent != NULL) {
ent->parent = super;
ent->direction = super->direction;
super->frame &= 0xfe;
@@ -186,7 +186,7 @@ void sub_08045E14(BusinessScrubPrologueEntity* this) {
super->subAction = 0;
sub_08046030(this, 0);
ent = Create0x68FX(super, FX_STARS);
if (ent) {
if (ent != NULL) {
ent->spritePriority.b0 = 3;
ent->z.HALF.HI -= 0xc;
SetDefaultPriority(ent, PRIO_MESSAGE);
@@ -299,7 +299,7 @@ void sub_08046078(BusinessScrubPrologueEntity* this) {
for (index = 0; index <= 4; index++) {
ent = CreateFx(super, FX_DEATH, 0x40);
if (ent) {
if (ent != NULL) {
ent->x.HALF.HI = gRoomControls.origin_x + *ptr;
ptr++;
ent->y.HALF.HI = gRoomControls.origin_y + *ptr;
@@ -315,12 +315,12 @@ void sub_08046078(BusinessScrubPrologueEntity* this) {
RestorePrevTileEntity(0x7a7, 1);
ent = CreateFx(super, FX_BIG_EXPLOSION2, 0x40);
if (ent) {
if (ent != NULL) {
CopyPosition(super, ent);
EnqueueSFX(SFX_184);
}
if (super->child) {
if (super->child != NULL) {
super->child->action = 0xff;
}
+2 -2
View File
@@ -123,7 +123,7 @@ void Chuchu_OnCollision(Entity* this) {
}
void Chuchu_OnGrabbed(Entity* this) {
if (sub_0806F520(this) == 0 && this->confusedTime) {
if (!sub_0806F520(this) && this->confusedTime) {
Create0x68FX(this, FX_STARS);
InitializeAnimation(this, 6);
} else {
@@ -552,7 +552,7 @@ void sub_0801F884(Entity* this) {
this->field_0xf--;
} else {
Entity* ent = Create0x68FX(this, FX_LIGHTNING_STRIKE);
if (ent) {
if (ent != NULL) {
ent->type2 = 64;
this->action = 4;
this->hitType = 165;
+2 -1
View File
@@ -7,6 +7,7 @@
#define NENT_DEPRECATED
#include "global.h"
#include "collision.h"
#include "enemy.h"
#include "functions.h"
#include "coord.h"
@@ -259,7 +260,7 @@ void sub_080387F0(CloudPiranhaEntity* this) {
if ((iVar4 == 0xf) || (iVar4 == 0x2a)) {
super->direction = (super->direction + 0x10) & 0x1f;
} else {
if (super->collisions != 0) {
if (super->collisions != COL_NONE) {
sub_0800417E(super, super->collisions);
}
}
+2 -2
View File
@@ -295,7 +295,7 @@ void sub_080391B4(CuccoAggrEntity* this) {
if (this->unk_7a) {
if ((this->unk_7b++ & 0x1f) == 0) {
Entity* ent = CreateEnemy(CUCCO_AGGR, 2);
if (ent) {
if (ent != NULL) {
u32 rand = (Random() & 0x17);
const PosOffset* ptr = &gCuccoAggrSpawnPoints[rand];
ent->x.HALF.HI = gRoomControls.scroll_x + ptr->x;
@@ -321,7 +321,7 @@ void sub_08039218(CuccoAggrEntity* this) {
void CuccoAggr_CreateFx(CuccoAggrEntity* this) {
Entity* ent = CreateFx(super, gCuccoAggrFx[super->type], 0);
if (ent) {
if (ent != NULL) {
ent->x.HALF.HI += gCuccoAggrFxHorizontalOffsets[super->spriteSettings.flipX];
}
}
+4 -6
View File
@@ -312,7 +312,7 @@ void sub_080210E4(Entity* this) {
this->frame &= ~1;
ent = CreateProjectileWithParent(this, DARK_NUT_SWORD_SLASH, 2);
if (ent) {
if (ent != NULL) {
ent->parent = this;
this->child = ent;
}
@@ -558,7 +558,7 @@ void sub_08021540(Entity* this) {
}
void sub_08021588(Entity* this) {
if (this->child) {
if (this->child != NULL) {
this->child->parent = NULL;
this->child = NULL;
}
@@ -571,7 +571,7 @@ void sub_0802159C(Entity* this) {
this->frame = 0;
this->hitType = 0x51;
ent = CreateProjectileWithParent(this, DARK_NUT_SWORD_SLASH, 3);
if (ent) {
if (ent != NULL) {
ent->parent = this;
this->child = ent;
}
@@ -592,7 +592,7 @@ void sub_08021600(Entity* this) {
this->frame = 0;
this->hitType = 0x51;
ent = CreateProjectileWithParent(this, DARK_NUT_SWORD_SLASH, 4);
if (ent) {
if (ent != NULL) {
ent->parent = this;
this->child = ent;
}
@@ -610,8 +610,6 @@ void sub_08021644(Entity* this) {
}
}
extern u32 sub_08049F1C(Entity*, Entity*, u32);
u32 sub_08021664(Entity* this, Entity* ent) {
switch (this->animationState) {
case 0:
+1 -1
View File
@@ -154,7 +154,7 @@ void sub_08040D30(Enemy50Entity* this) {
}
void sub_08040D90(Enemy50Entity* this) {
if (sub_0806F520()) {
if (sub_0806F520(super)) {
Enemy50_SubActions[super->subAction](this);
} else {
sub_08041128(this);
+1 -1
View File
@@ -97,7 +97,7 @@ NONMATCH("asm/non_matching/fallingBoulder/sub_0802C334.inc", void sub_0802C334(E
s32 i;
for (i = 1; i > -1; i--) {
Entity* ent = CreateFx(this, FX_ROCK2, 0);
if (ent) {
if (ent != NULL) {
ent->x.HALF.HI += 12;
ent->x.HALF.HI -= diff;
}
+1 -1
View File
@@ -91,7 +91,7 @@ void sub_08045454(Entity* this) {
}
ent = CreateFx(this, FX_DEATH, 0);
if (ent)
if (ent != NULL)
CopyPosition(this, ent);
DeleteEntity(this);
+265
View File
@@ -0,0 +1,265 @@
/**
* @file flyingPot.c
* @ingroup Enemies
*
* @brief Flying pot enemy
*/
#define NENT_DEPRECATED
#include "collision.h"
#include "functions.h"
#include "enemy.h"
#include "player.h"
#include "room.h"
extern void (*const gUnk_080012C8[])(Entity*);
extern Hitbox gUnk_080FD34C;
typedef struct {
/* 0x00 */ Entity base;
/* 0x68 */ u8 filler[0xC];
/* 0x74 */ u16 tileIndex;
} FlyingPotEntity;
enum FlyingPotActions {
/* 0 */ FLYING_POT_ACTION_0,
/* 1 */ FLYING_POT_ACTION_1,
/* 2 */ FLYING_POT_ACTION_2,
/* 3 */ FLYING_POT_ACTION_3,
/* 4 */ FLYING_POT_ACTION_4,
/* 5 */ FLYING_POT_ACTION_5,
/* 6 */ FLYING_POT_ACTION_6,
};
enum FlyingPotSubActions {
/* 0 */ FLYING_POT_SUBACTION_0,
/* 1 */ FLYING_POT_SUBACTION_1,
/* 2 */ FLYING_POT_SUBACTION_2,
/* 3 */ FLYING_POT_SUBACTION_3,
/* 4 */ FLYING_POT_SUBACTION_DO_NOTHING,
/* 5 */ FLYING_POT_SUBACTION_5,
};
// Functions
void FlyingPot_OnTick(FlyingPotEntity*); // 0803708C
void FlyingPot_OnCollision(FlyingPotEntity*); // 080370A4
void FlyingPot_OnGrabbed(FlyingPotEntity*); // 0803712C
// Subactions
void FlyingPot_SubAction0(FlyingPotEntity*); // 08037144
void FlyingPot_SubAction1(FlyingPotEntity*); // 0803715C
void FlyingPot_SubAction2(FlyingPotEntity*); // 0803718C
void FlyingPot_SubAction3(FlyingPotEntity*); // 080371F8
void FlyingPot_SubActionDoNothing(FlyingPotEntity*);
void FlyingPot_SubAction5(FlyingPotEntity*); // 08037218
// Actions
void FlyingPot_Init(FlyingPotEntity*); // ? // 08037220
void FlyingPot_Action1(FlyingPotEntity*); // 08037280
void FlyingPot_Action2(FlyingPotEntity*); // 080372E8
void FlyingPot_Action3(FlyingPotEntity*); // 0803737C
void FlyingPot_Action4(FlyingPotEntity*); // 080373B0
void FlyingPot_Action5(FlyingPotEntity*); // 080373C8
void FlyingPot_Action6(FlyingPotEntity*); // 080373E0
void sub_08037408(FlyingPotEntity*);
void sub_08037418(FlyingPotEntity*);
void (*const FlyingPot_Functions[])(Entity*) = {
(EntityActionPtr)FlyingPot_OnTick,
(EntityActionPtr)FlyingPot_OnCollision,
GenericKnockback,
GenericDeath,
GenericConfused,
(EntityActionPtr)FlyingPot_OnGrabbed,
};
void FlyingPot(Entity* thisx) {
s32 index = sub_080012DC(thisx);
if (index != 0) {
gUnk_080012C8[index](thisx);
} else {
FlyingPot_Functions[GetNextFunction(thisx)](thisx);
}
}
void FlyingPot_OnTick(FlyingPotEntity* this) {
static void (*const FlyingPot_Actions[])(FlyingPotEntity*) = {
FlyingPot_Init, FlyingPot_Action1, FlyingPot_Action2, FlyingPot_Action3,
FlyingPot_Action4, FlyingPot_Action5, FlyingPot_Action6,
};
FlyingPot_Actions[super->action](this);
}
void FlyingPot_OnCollision(FlyingPotEntity* this) {
sub_08037418(this);
if (super->bitfield == 0x9D) {
super->action = FLYING_POT_ACTION_6;
COLLISION_OFF(super);
super->zVelocity = 0x2A000;
super->spritePriority.b1 = 1;
SetTile(this->tileIndex, TILE(super->x.HALF.HI, super->y.HALF.HI), super->collisionLayer);
} else if (super->z.HALF.HI != 0) {
sub_08037408(this);
}
EnemyFunctionHandlerAfterCollision(super, FlyingPot_Functions);
}
void FlyingPot_OnGrabbed(FlyingPotEntity* this) {
static void (*const FlyingPot_SubActions[])(FlyingPotEntity*) = {
FlyingPot_SubAction0, FlyingPot_SubAction1, FlyingPot_SubAction2,
FlyingPot_SubAction3, FlyingPot_SubActionDoNothing, FlyingPot_SubAction5,
};
FlyingPot_SubActions[super->subAction](this);
}
void FlyingPot_SubAction0(FlyingPotEntity* this) {
sub_08037418(this);
super->subAction = FLYING_POT_SUBACTION_1;
super->actionDelay = 0;
super->field_0x1d = 0x30;
}
void FlyingPot_SubAction1(FlyingPotEntity* this) {
sub_08037418(this);
if (sub_0806F520(super)) {
sub_0806F4E8(super);
} else {
super->spriteOffsetX = 0;
if (super->z.HALF.HI != 0) {
sub_08037408(this);
}
}
}
void FlyingPot_SubAction2(FlyingPotEntity* this) {
if (super->actionDelay == 0) {
sub_08037418(this);
super->actionDelay = 1;
COLLISION_OFF(super);
super->spriteOffsetX = 0;
SetTile(this->tileIndex, TILE(super->x.HALF.HI, super->y.HALF.HI), super->collisionLayer);
}
if (sub_0806F520(super)) {
sub_0806F3E4(super);
} else {
sub_08037408(this);
}
}
void FlyingPot_SubAction3(FlyingPotEntity* this) {
if (!(gPlayerState.field_0x1c & 0xF)) {
sub_08037408(this);
}
}
void FlyingPot_SubActionDoNothing(FlyingPotEntity* this) {
}
void FlyingPot_SubAction5(FlyingPotEntity* this) {
sub_08037408(this);
}
void FlyingPot_Init(FlyingPotEntity* this) {
u32 tile;
super->action = FLYING_POT_ACTION_1;
super->field_0x1c = 2;
super->y.HALF.HI += 3;
tile = TILE(super->x.HALF.HI, super->y.HALF.HI);
this->tileIndex = GetTileIndex(tile, super->collisionLayer);
SetTile(0x4000, tile, super->collisionLayer);
InitializeAnimation(super, 5);
}
void FlyingPot_Action1(FlyingPotEntity* this) {
sub_08037418(this);
if (GetTileTypeByEntity(super) != 0x4000) {
SetTile(this->tileIndex, TILE(super->x.HALF.HI, super->y.HALF.HI), super->collisionLayer);
sub_08037408(this);
}
if (PlayerInRange(super, 1, 0x40)) {
super->action = FLYING_POT_ACTION_2;
super->actionDelay = 30;
}
}
void FlyingPot_Action2(FlyingPotEntity* this) {
static const u8 offsets[] = { -1, 1, 1, -1 };
sub_08037418(this);
super->spriteOffsetX += offsets[super->actionDelay & 3];
if (--super->actionDelay == 0) {
super->action = FLYING_POT_ACTION_3;
super->spritePriority.b1 = 1;
super->spriteOffsetX = 0;
super->hitType = 0xA0;
super->flags2 = 0xF;
super->hitbox = &gUnk_080FD34C;
SetTile(this->tileIndex, TILE(super->x.HALF.HI, super->y.HALF.HI), super->collisionLayer);
}
}
void FlyingPot_Action3(FlyingPotEntity* this) {
super->z.WORD -= 0x10000;
if (super->z.HALF.HI <= -6) {
super->action = FLYING_POT_ACTION_4;
super->actionDelay = 10;
super->direction = GetFacingDirection(super, &gPlayerEntity);
}
}
void FlyingPot_Action4(FlyingPotEntity* this) {
if (--super->actionDelay == 0) {
super->action = FLYING_POT_ACTION_5;
}
}
void FlyingPot_Action5(FlyingPotEntity* this) {
ProcessMovement2(super);
if (super->collisions != COL_NONE) {
sub_08037408(this);
}
}
void FlyingPot_Action6(FlyingPotEntity* this) {
if (super->zVelocity < 0) {
super->spriteSettings.flipY = 1;
}
if (!GravityUpdate(super, 0x2000)) {
sub_08037408(this);
}
}
void sub_08037408(FlyingPotEntity* this) {
CreateFx(super, FX_POT_SHATTER, 0);
DeleteThisEntity();
}
void sub_08037418(FlyingPotEntity* this) {
u32 tile = COORD_TO_TILE(super);
if (GetTileIndex(tile, super->collisionLayer) == 0x4067) {
SetTile(this->tileIndex, tile, super->collisionLayer);
DeleteThisEntity();
}
}
+5 -4
View File
@@ -1,4 +1,5 @@
#define NENT_DEPRECATED
#include "collision.h"
#include "entity.h"
#include "enemy.h"
#include "functions.h"
@@ -140,7 +141,7 @@ void sub_08039DD8(FlyingSkullEntity* this) {
super->actionDelay = 0x1e;
} else {
ent = CreateEnemy(STALFOS, super->type - 2);
if (ent) {
if (ent != NULL) {
ent->type2 = 1;
CopyPosition(super, ent);
SetTile(this->unk_0x74, COORD_TO_TILE(super), super->collisionLayer);
@@ -159,7 +160,7 @@ void sub_08039ECC(FlyingSkullEntity* this) {
void sub_08039EE4(FlyingSkullEntity* this) {
super->subAction = 1;
COLLISION_OFF(super);
super->collisions = 0;
super->collisions = COL_NONE;
super->hitbox = (Hitbox*)&gUnk_080FD340;
gPlayerEntity.animationState;
this->unk_0x76 = gPlayerEntity.animationState;
@@ -175,7 +176,7 @@ void sub_08039F4C(FlyingSkullEntity* this) {
void sub_08039F78(FlyingSkullEntity* this) {
super->spritePriority.b1 = 1;
if (super->z.HALF.HI == 0 || super->collisions) {
if (super->z.HALF.HI == 0 || (super->collisions != COL_NONE)) {
sub_0803A0E0(this);
}
}
@@ -222,7 +223,7 @@ void sub_0803A09C(FlyingSkullEntity* this) {
GetNextFrame(super);
ProcessMovement2(super);
if (super->collisions) {
if (super->collisions != COL_NONE) {
sub_0803A0E0(this);
}
}
+1 -1
View File
@@ -113,7 +113,7 @@ void Ghini_OnConfused(GhiniEntity* this) {
}
void Ghini_OnGrabbed(GhiniEntity* this) {
if (sub_0806F520()) {
if (sub_0806F520(super)) {
Ghini_SubActions[super->subAction](this);
} else {
sub_0803F51C(this);
-3
View File
@@ -42,9 +42,6 @@ void sub_08037ACC(GibdoEntity*);
void Gibdo_CreateObjects(GibdoEntity*);
void sub_08037A14(GibdoEntity*);
extern void sub_0804A4E4(Entity*, Entity*);
u32 sub_0804A044(Entity*, Entity*, u32);
void (*const Gibdo_Functions[6])(Entity*);
void (*const gUnk_080CF2AC[9])(GibdoEntity*);
extern Entity* gUnk_020000B0;
+5 -5
View File
@@ -283,7 +283,7 @@ NONMATCH("asm/non_matching/gleerok/sub_0802D3B8.inc", void sub_0802D3B8(GleerokE
do {
ent = CreateEnemy(GLEEROK, 1);
super->child = ent;
if (ent) {
if (ent != NULL) {
ent->type2 = uvar1 + 1;
super->child->collisionLayer = super->collisionLayer;
super->child->x.HALF.HI = super->x.HALF.HI;
@@ -301,7 +301,7 @@ NONMATCH("asm/non_matching/gleerok/sub_0802D3B8.inc", void sub_0802D3B8(GleerokE
ent = CreateEnemy(GLEEROK, 2);
super->child = ent;
if (ent) {
if (ent != NULL) {
super->child->collisionLayer = super->collisionLayer;
super->child->x.HALF.HI = super->x.HALF.HI;
super->child->y.HALF.HI = super->y.HALF.HI + ((uvar1 + 1) * 12);
@@ -760,7 +760,7 @@ void sub_0802DCE0(GleerokEntity* this) {
if (this->unk_84->ent2->field_0xf == 0) {
super->child = CreateProjectileWithParent(super, GLEEROK_PROJECTILE, 0);
if (super->child) {
if (super->child != NULL) {
super->child->direction = this->unk_84->filler[0x15];
super->child->type2 = this->unk_84->ent2->frame & 0xf;
super->child->parent = this->unk_84->ent2;
@@ -827,7 +827,7 @@ void sub_0802DDD8(GleerokEntity* this) {
if (this->unk_84->ent2->field_0xf == 1) {
super->child = CreateProjectileWithParent(super, GLEEROK_PROJECTILE, r2);
if (super->child) {
if (super->child != NULL) {
super->child->direction = this->unk_84->filler[0x15];
super->child->type2 = this->unk_84->ent2->frame & 0xf;
super->child->parent = this->unk_84->ent2;
@@ -1094,7 +1094,7 @@ void sub_0802E300(GleerokEntity* this) {
InitializeAnimation(super, 0x4d);
ent = CreateEnemy(GLEEROK, 5);
super->child = ent;
if (super->child) {
if (super->child != NULL) {
super->child->parent = super;
heap->ent = super->child;
((GleerokEntity*)super->child)->unk_84 = heap;
+1 -1
View File
@@ -56,7 +56,7 @@ void GyorgChild_OnGrabbed(GyorgChildEntity* this) {
GyorgChild_OnGrabbed_Action1,
GyorgChild_OnGrabbed_Action3,
};
if (sub_0806F520()) {
if (sub_0806F520(super)) {
GyorgChild_OnGrabbed_Actions[super->subAction](this);
}
}
+2 -2
View File
@@ -98,7 +98,7 @@ void sub_0802BCA8(Entity* this) {
this->field_0x3a = this->field_0x3a & 0xfb;
this->field_0x1c = 0x12;
ent = CreateEnemy(HELMASAUR, 1);
if (ent) {
if (ent != NULL) {
ent->animationState = this->animationState;
CopyPosition(this, ent);
}
@@ -356,7 +356,7 @@ void sub_0802C18C(Entity* this) {
this->field_0x78.HALF.LO--;
if ((this->field_0x78.HALF.LO & 7) == 0) {
Entity* ent = CreateObject(SPECIAL_FX, 0x11, 0x40);
if (ent) {
if (ent != NULL) {
PositionRelative(this, ent, 0, Q_16_16(1.0));
}
}
+1 -1
View File
@@ -34,7 +34,7 @@ void LakituCloud_OnKnockback(Entity* this) {
}
void LakituCloud_OnGrabbed(Entity* this) {
if (sub_0806F520(this) == 0) {
if (!sub_0806F520(this)) {
if (this->subAction == 2) {
sub_0803CE3C(this);
}
+1 -1
View File
@@ -144,7 +144,7 @@ void sub_08034E68(Entity* this) {
sub_08035120(this);
}
if (gRoomTransition.field_0x39 == 0) {
if (sub_08079F8C() != 0) {
if (sub_08079F8C()) {
this->action = 3;
scriptExecutionContext = StartCutscene(this, (u16*)script_MazaalMacroDefeated);
*(ScriptExecutionContext**)&this->cutsceneBeh = scriptExecutionContext;
+1 -1
View File
@@ -34,7 +34,7 @@ void MiniSlime_OnCollision(Entity* this) {
void MiniSlime_OnDeath(Entity* this) {
Entity* parent = this->parent;
if (this != parent && parent) {
if ((this != parent) && (parent != NULL)) {
this->field_0x6c.HALF.LO &= 0x7f;
this->parent->child = this->child;
this->child->parent = this->parent;
+3 -2
View File
@@ -6,6 +6,7 @@
*/
#include "enemy.h"
#include "collision.h"
#include "functions.h"
void sub_08022EAC(Entity*);
@@ -103,7 +104,7 @@ void sub_08022D40(Entity* this) {
sub_08022F14(this);
ProcessMovement0(this);
if (this->collisions) {
if (this->collisions != COL_NONE) {
sub_0800417E(this, this->collisions);
this->animationState = ((this->direction + 2) & 0x1c) >> 2;
this->frameIndex = this->animationState;
@@ -112,7 +113,7 @@ void sub_08022D40(Entity* this) {
}
void sub_08022D90(Entity* this) {
if (this->parent->next) {
if (this->parent->next != NULL) {
Entity* parent;
gUnk_080CBBBC[this->action](this);
+6 -6
View File
@@ -42,7 +42,7 @@ NONMATCH("asm/non_matching/moldworm/Moldworm.inc", void Moldworm(Entity* this))
this->field_0x7c.BYTES.byte1 = this->field_0x7c.BYTES.byte0;
EnemyFunctionHandler(this, Moldworm_Functions);
} else {
if (this->parent->next) {
if (this->parent->next != NULL) {
if (this->type != 8) {
sub_080235BC(this);
} else {
@@ -191,7 +191,7 @@ void sub_08023AB0(Entity*);
void sub_08023398(Entity* this) {
this->field_0x7c.BYTES.byte0++;
if (this->field_0x7c.BYTES.byte3 && sub_08049FDC(this, 1) == 0) {
if (this->field_0x7c.BYTES.byte3 && !sub_08049FDC(this, 1)) {
this->field_0x78.HWORD = 1;
}
@@ -258,7 +258,7 @@ void sub_080234D8(Entity* this) {
}
void sub_0802351C(Entity* this) {
if (this->actionDelay != 0 && (this->type2 == 1 || gPlayerEntity.frameIndex == 0xff)) {
if ((this->actionDelay != 0) && ((this->type2 == 1) || (gPlayerEntity.frameIndex == 0xff))) {
this->actionDelay = 0;
this->child->action = 3;
this->child->field_0xf = this->field_0x80.HALF.LO;
@@ -377,8 +377,8 @@ void sub_0802376C(Entity* this) {
void sub_080237D8(Entity* this) {
Entity* parent = this->parent;
if (parent->animIndex == 0x17 && this->actionDelay != 0 && this->x.HALF.HI == parent->x.HALF.HI &&
this->y.HALF.HI == parent->y.HALF.HI) {
if ((parent->animIndex == 0x17) && (this->actionDelay != 0) && (this->x.HALF.HI == parent->x.HALF.HI) &&
(this->y.HALF.HI == parent->y.HALF.HI)) {
this->action = 1;
COLLISION_OFF(this);
this->spriteSettings.draw = 0;
@@ -501,7 +501,7 @@ void sub_08023AB0(Entity* this) {
if (this->field_0x7a.HALF.HI == 8) {
if (this->field_0x7c.BYTES.byte2) {
this->field_0x7c.BYTES.byte2--;
} else if (!sub_08023B38(this) || 0x1d >= this->field_0x78.HWORD) {
} else if (!sub_08023B38(this) || (this->field_0x78.HWORD <= 0x1D)) {
this->hitType = 0x85;
this->field_0x7a.HALF.HI = 0;
this->field_0x7c.BYTES.byte2 = 30;
+5 -4
View File
@@ -7,6 +7,7 @@
#define NENT_DEPRECATED
#include "global.h"
#include "collision.h"
#include "enemy.h"
#include "functions.h"
@@ -63,11 +64,11 @@ void sub_08032CAC(MulldozerEntity* this) {
case 2:
case 3:
super->action = 6;
super->actionDelay = super->type != 0 ? 0x5a : 200;
super->actionDelay = (super->type != 0) ? 0x5a : 200;
super->field_0xf = 2;
this->unk_80 = 3;
super->direction = super->knockbackDirection;
super->direction = (super->direction + ((Random() & 0x40) != 0 ? 4 : 0x1c));
super->direction += ((Random() & 0x40) != 0) ? 4 : 0x1c;
super->direction &= 0x1f;
super->speed = 0;
break;
@@ -102,7 +103,7 @@ void Mulldozer_Action1(MulldozerEntity* this) {
if (--super->actionDelay == 0) {
sub_080330C0(this);
} else {
if (sub_08033364(this) != 0) {
if (sub_08033364(this)) {
sub_08033100(this);
}
}
@@ -200,7 +201,7 @@ void sub_08032F48(MulldozerEntity* this) {
}
void sub_08032F64(MulldozerEntity* this) {
if (super->collisions != 0) {
if (super->collisions != COL_NONE) {
sub_0800417E(super, super->collisions);
super->animationState = super->direction >> 2;
sub_08032F24(this);
+1 -1
View File
@@ -129,7 +129,7 @@ void Octorok_ShootNut(Entity* this) {
GetNextFrame(this);
if (this->frame & 1) {
Entity* ent = CreateProjectileWithParent(this, ROCK_PROJECTILE, 0);
if (ent) {
if (ent != NULL) {
const s8* off;
ent->direction = this->direction;
off = &gOctorokNutOffset[this->direction / 4];
+15 -13
View File
@@ -6,6 +6,7 @@
*/
#define NENT_DEPRECATED
#include "enemy/octorokBoss.h"
#include "collision.h"
#include "functions.h"
#include "game.h"
#include "object.h"
@@ -494,7 +495,7 @@ void OctorokBoss_Action1(OctorokBossEntity* this) {
sub_08036914(super, angle, radius);
this->angle.HALF.HI = -((OctorokBossEntity*)super->parent)->angle.HALF.HI;
}
if (IS_FROZEN((OctorokBossEntity*)super->parent) == 0) {
if (!IS_FROZEN((OctorokBossEntity*)super->parent)) {
super->spriteSettings.draw |= 1;
}
break;
@@ -639,14 +640,15 @@ void OctorokBoss_Action1_ChargeAttack(OctorokBossEntity* this) {
if (this->timer == 0) {
ProcessMovement0(super);
knockbackCondition = 0;
knockbackCondition = FALSE;
if ((super->direction != 0) && (super->direction != 0x10)) {
knockbackCondition = ((u32)super->collisions & 0xee00) != 0;
knockbackCondition = ((super->collisions & (COL_EAST_ANY | COL_WEST_ANY)) != COL_NONE);
}
if (((super->direction != 0x18) && (super->direction != 8)) && ((super->collisions & 0xee) != 0)) {
knockbackCondition = 1;
if (((super->direction != 0x18) && (super->direction != 8)) &&
(super->collisions & (COL_NORTH_ANY | COL_SOUTH_ANY))) {
knockbackCondition = TRUE;
}
if (knockbackCondition != 0) {
if (knockbackCondition) {
super->knockbackDuration = 0x20;
super->knockbackSpeed = 0x200;
super->knockbackDirection = super->direction ^ 0x10;
@@ -911,7 +913,7 @@ void OctorokBoss_Burning(OctorokBossEntity* this) {
void OctorokBoss_Burning_SubAction0(OctorokBossEntity* this) {
super->subAction = 1;
super->speed = 0x200;
super->collisions = 0;
super->collisions = COL_NONE;
super->direction = (u8)(-this->angle.HALF.HI ^ 0x80U) >> 3;
this->timer = 0x78;
this->angularSpeed.HWORD = 0x180;
@@ -922,13 +924,13 @@ void OctorokBoss_Burning_SubAction0(OctorokBossEntity* this) {
void OctorokBoss_Burning_SubAction1(OctorokBossEntity* this) {
ProcessMovement0(super);
if (super->collisions != 0) {
if (super->collisions != COL_NONE) {
super->subAction = 2;
this->heap->targetAngle = this->angle.HALF.HI;
if ((super->collisions & 0xee00) != 0) {
if ((super->collisions & (COL_EAST_ANY | COL_WEST_ANY)) != COL_NONE) {
this->heap->targetAngle = -this->heap->targetAngle;
}
if ((super->collisions & 0xee) != 0) {
if ((super->collisions & (COL_NORTH_ANY | COL_SOUTH_ANY)) != COL_NONE) {
this->heap->targetAngle = -this->heap->targetAngle ^ 0x80;
}
super->knockbackDuration = 0x18;
@@ -951,10 +953,10 @@ void OctorokBoss_Burning_SubAction2(OctorokBossEntity* this) {
if ((u32)(this->heap->targetAngle - this->angle.HALF.HI + 7) < 0xf) {
super->subAction = 1;
super->direction = ((u8) - this->angle.HALF.HI ^ 0x80) >> 3;
super->collisions = 0;
super->collisions = COL_NONE;
ProcessMovement0(super);
} else {
if ((u8)(this->heap->targetAngle - this->angle.HALF.HI) >= 0x81) {
if ((u8)(this->heap->targetAngle - this->angle.HALF.HI) > 0x80) {
this->angle.HWORD -= this->angularSpeed.HWORD;
} else {
this->angle.HWORD += this->angularSpeed.HWORD;
@@ -1161,7 +1163,7 @@ void OctorokBoss_StartRegularAttack(OctorokBossEntity* this) {
super->subAction = ACTION1_SUBACTION2;
super->speed = 0x200;
this->timer = 0x3c;
super->collisions = 0;
super->collisions = COL_NONE;
this->heap->unk_0 = 4;
SoundReq(SFX_159);
return;
-3
View File
@@ -8,9 +8,6 @@ extern void (*const gUnk_080012C8[])(Entity*);
const s8 gUnk_080CF490[];
const u8 gUnk_080CF498[];
extern s32 sub_080012DC(Entity*);
extern u32 sub_0804A044(Entity*, Entity*, u32);
void sub_08037E14(Entity* this);
bool32 sub_08037E90(Entity* this);
+1 -4
View File
@@ -19,9 +19,6 @@ extern const s8 gUnk_080CA5D4[];
void sub_080205F8(Entity*);
void sub_08020604(Entity*);
extern u32 sub_08049F1C(Entity*, Entity*, u32);
extern void sub_0804AA1C(Entity*);
extern Entity* gUnk_020000B0;
enum {
@@ -57,7 +54,7 @@ void Peahat_OnCollision(Entity* this) {
if (this->field_0x82.HALF.LO) {
if (this->bitfield == 0x94) {
Entity* ent = CreateEnemy(PEAHAT, PeahatForm_Propeller);
if (ent) {
if (ent != NULL) {
CopyPosition(this, ent);
ent->z.HALF.HI -= 8;
}
+7 -6
View File
@@ -6,6 +6,7 @@
*/
#include "enemy.h"
#include "collision.h"
#include "object.h"
#include "game.h"
#include "functions.h"
@@ -170,7 +171,7 @@ void sub_080240B8(Entity* this) {
this->field_0x82.HALF.HI = 0;
ent = CreateProjectileWithParent(this, DIRT_BALL_PROJECTILE, this->field_0x82.HALF.HI);
if (ent) {
if (ent != NULL) {
this->child = ent;
ent->parent = this;
ent->y.HALF.HI += 0x10;
@@ -413,7 +414,7 @@ void sub_080244E8(Entity* this) {
this->field_0x78.HWORD -= 0xe;
ent = CreateProjectileWithParent(this, DIRT_BALL_PROJECTILE, this->field_0x82.HALF.HI);
if (ent) {
if (ent != NULL) {
ent->parent = this;
ent->z.HALF.HI += 0xe;
ent->child = this->child;
@@ -436,7 +437,7 @@ void sub_080244E8(Entity* this) {
this->field_0x78.HWORD -= 0xe;
ent = CreateProjectileWithParent(this, DIRT_BALL_PROJECTILE, this->field_0x82.HALF.HI);
if (ent) {
if (ent != NULL) {
ent->parent = this;
ent->z.HALF.HI += 0xe;
this->child = ent;
@@ -525,7 +526,7 @@ void sub_080244E8(Entity* this) {
void sub_08024940(Entity* this) {
u32 random = Random() & 0x70;
if (this->collisions != 0) {
if (this->collisions != COL_NONE) {
sub_0800417E(this, this->collisions);
sub_080249F4(this);
}
@@ -661,7 +662,7 @@ bool32 sub_08024B38(Entity* this) {
}
ent = FindEntityByID(PLAYER_ITEM, PLAYER_ITEM_BOMB, 2);
if (ent) {
if (ent != NULL) {
do {
if (ent->action != 2 && ent->z.HALF.HI == 0 && sub_08049F1C(this, ent, 0xa0)) {
iVar4 = 1;
@@ -678,7 +679,7 @@ bool32 sub_08024B38(Entity* this) {
}
ent = FindEntityByID(OBJECT, POT, 6);
if (ent) {
if (ent != NULL) {
do {
if (ent->action == 1 && sub_08049F1C(this, ent, 0xa0)) {
iVar4 = 1;
+6 -5
View File
@@ -6,6 +6,7 @@
*/
#include "enemy.h"
#include "collision.h"
#include "object.h"
#include "functions.h"
@@ -156,7 +157,7 @@ void sub_08025230(Entity* this) {
this->direction = sub_08025C60(this);
}
if (this->collisions != 0) {
if (this->collisions != COL_NONE) {
if (--this->field_0xf == 0) {
sub_0800417E(this, this->collisions);
}
@@ -528,12 +529,12 @@ void sub_08025AE8(Entity* this) {
Entity* ent;
ent = CreateFx(this, FX_BROWN_SMOKE, 0);
if (ent) {
if (ent != NULL) {
ent->y.WORD--;
}
ent = CreateFx(this, FX_BROWN_SMOKE_LARGE, 0);
if (ent) {
if (ent != NULL) {
ent->y.WORD++;
}
}
@@ -552,7 +553,7 @@ void sub_08025B18(Entity* this) {
sub_08025AB8((((x + offset[0]) >> 4) & 0x3fU) | ((((y + offset[1]) >> 4) & 0x3fU) << 6), layer);
ent = CreateObject(OBJECT_21, 2, 0);
if (ent) {
if (ent != NULL) {
PositionRelative(this, ent, Q_16_16(offset[0]), Q_16_16(offset[1]));
ent->x.HALF.HI &= -0x10;
ent->x.HALF.HI += 8;
@@ -566,7 +567,7 @@ void sub_08025B18(Entity* this) {
void sub_08025BD4(Entity* this) {
if (this->field_0x82.HALF.LO && (this->frame & 1) == 0) {
Entity* ent = CreateObject(OBJECT_21, 0, 0);
if (ent) {
if (ent != NULL) {
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;
+2 -4
View File
@@ -8,8 +8,6 @@
#include "enemy.h"
#include "functions.h"
extern void sub_0804A4E4(Entity*, Entity*);
extern void (*const RockChuchu_Functions[])(Entity*);
extern void (*const gUnk_080CB960[])(Entity*);
@@ -47,7 +45,7 @@ void RockChuchu_OnCollision(Entity* this) {
case 0x1c:
CreateFx(this, FX_ROCK, 0);
ent = CreateEnemy(CHUCHU, 1);
if (ent) {
if (ent != NULL) {
ent->type2 = 1;
#ifndef EU
ent->iframes = -8;
@@ -102,7 +100,7 @@ void sub_080223E4(Entity* this) {
Entity* ent;
ent = this->child;
if (ent) {
if (ent != NULL) {
ent->bitfield = 0x94;
ent->iframes = 0x10;
#ifndef EU
+1 -2
View File
@@ -12,7 +12,6 @@ extern void (*const Rope_Functions[6])(Entity*);
extern void (*const gUnk_080CE460[4])(Entity*);
extern void (*const gUnk_080CE470[3])(Entity*);
extern Entity* gUnk_020000B0;
extern u32 sub_0804A044(Entity*, Entity*, u32);
void sub_08031600(Entity*);
u32 sub_0803163C(Entity*);
@@ -39,7 +38,7 @@ void Rope_OnCollision(Entity* this) {
}
void Rope_OnGrabbed(Entity* this) {
if (sub_0806F520()) {
if (sub_0806F520(this)) {
gUnk_080CE470[this->subAction](this);
}
}
-3
View File
@@ -14,9 +14,6 @@ extern void (*const gUnk_080012C8[])(Entity*);
extern void (*const RopeGolden_Functions[6])(Entity*);
extern void (*const gUnk_080CF4E0[4])(Entity*);
extern s32 sub_080012DC(Entity*);
extern u32 sub_0804A044(Entity*, Entity*, u32);
void sub_080383AC(Entity*);
void sub_080383E4(Entity*);
+3 -2
View File
@@ -1,4 +1,5 @@
#define NENT_DEPRECATED
#include "collision.h"
#include "entity.h"
#include "enemy.h"
#include "functions.h"
@@ -63,7 +64,7 @@ void ScissorsBeetle_OnGrabbed(ScissorsBeetleEntity* this) {
void ScissorsBeetle_Init(ScissorsBeetleEntity* this) {
Entity* ent = CreateProjectile(MANDIBLES_PROJECTILE);
if (!ent)
if (ent == NULL)
return;
sub_0804A720(super);
@@ -92,7 +93,7 @@ void sub_080389E8(ScissorsBeetleEntity* this) {
sub_08038C2C((ScissorsBeetleEntity*)child);
} else if (super->actionDelay) {
super->actionDelay--;
} else if (super->collisions) {
} else if (super->collisions != COL_NONE) {
super->actionDelay = 0xc;
if ((child->animationState & 1) == 0) {
child->animationState += Random() & 0x20 ? 1 : 7;
+1 -3
View File
@@ -15,8 +15,6 @@ typedef struct {
void sub_08044FF8(Entity*);
void sub_08045178(Entity*, Entity*, int, int);
extern void sub_0804A4E4(Entity*, Entity*);
extern void (*const gUnk_080D16BC[])(Entity*);
extern void (*const Slime_Functions[])(Entity*);
extern u8 gUnk_080D16D0[4]; // Entity count per form
@@ -116,7 +114,7 @@ void sub_080450A8(Entity* this) {
}
ent = CreateFx(this, FX_DEATH, 0);
if (ent)
if (ent != NULL)
CopyPosition(this, ent);
DeleteEntity(this);
+3 -7
View File
@@ -8,13 +8,9 @@
#include "enemy.h"
#include "functions.h"
extern s32 sub_080012DC(Entity*);
bool32 PlayerInRange(Entity*, u32, u32);
void sub_08023E10(Entity*);
void sub_08023E54(Entity*);
void sub_08023E9C(Entity*);
void sub_0804A4E4(Entity*, Entity*);
extern void (*const gUnk_080012C8[])(Entity*);
@@ -136,7 +132,7 @@ void sub_08023CE0(Entity* this) {
if (this->frame) {
if (this->frame & ANIM_DONE) {
Entity* ent = CreateEnemy(SLUGGULA, 1);
if (ent) {
if (ent != NULL) {
sub_0804A4E4(this, ent);
DeleteThisEntity();
}
@@ -167,7 +163,7 @@ void sub_08023E54(Entity* this) {
if (this->field_0xf++ > 27) {
this->field_0xf = 0;
ent = CreateEnemy(SLUGGULA, 2);
if (ent) {
if (ent != NULL) {
const s8* ptr = &gUnk_080CBDF7[this->animationState * 2];
PositionRelative(this, ent, Q_16_16(ptr[0]), Q_16_16(ptr[1]));
}
@@ -178,7 +174,7 @@ extern Entity* gUnk_020000B0;
void sub_08023E9C(Entity* this) {
u32 uVar3 = Random();
if (sub_08049FA0(this) == 0 && (uVar3 & 1)) {
if (!sub_08049FA0(this) && (uVar3 & 1)) {
this->direction = DirectionRoundUp(sub_08049EE4(this));
} else if (sub_08049FDC(this, 1) && (uVar3 & 6)) {
u32 uVar3 = GetFacingDirection(this, gUnk_020000B0) - this->direction;
+16 -16
View File
@@ -5,6 +5,7 @@
* @brief Spark enemy
*/
#include "collision.h"
#include "enemy.h"
#include "object.h"
#include "functions.h"
@@ -30,7 +31,7 @@ void Spark_OnCollision(Entity* this) {
this->spriteSettings.draw = 0;
this->action = 2;
ent = CreateFx(this, FX_DEATH, 0);
if (ent) {
if (ent != NULL) {
this->child = ent;
this->actionDelay = 14;
CopyPosition(this, ent);
@@ -40,7 +41,6 @@ void Spark_OnCollision(Entity* this) {
}
void Spark_OnGrabbed(Entity* this) {
/* ... */
}
void sub_0802B33C(Entity* this) {
@@ -57,7 +57,7 @@ void sub_0802B35C(Entity* this) {
GetNextFrame(this);
ProcessMovement0(this);
is_head = this->type == 0;
if (this->collisions == 0) {
if (this->collisions == COL_NONE) {
if (--this->field_0xf == 0) {
this->field_0xf = 0x78;
@@ -68,49 +68,49 @@ void sub_0802B35C(Entity* this) {
this->field_0xf = 0x78;
switch (DirectionRound(this->direction)) {
case DirectionNorth:
if (this->collisions & 0xe) {
if ((this->collisions & COL_NORTH_ANY) != COL_NONE) {
this->direction = is_head ? DirectionWest : DirectionEast;
} else {
if ((this->collisions & 0xe000) == 0x4000 && is_head) {
if (((this->collisions & COL_EAST_ANY) == COL_EAST_NORTH) && is_head) {
this->direction = DirectionEast;
}
if ((this->collisions & 0xe00) == 0x400 && !is_head) {
if (((this->collisions & COL_WEST_ANY) == COL_WEST_NORTH) && !is_head) {
this->direction = DirectionWest;
}
}
break;
case DirectionSouth:
if (this->collisions & 0xe0) {
if ((this->collisions & COL_SOUTH_ANY) != COL_NONE) {
this->direction = is_head ? DirectionEast : DirectionWest;
} else {
if ((this->collisions & 0xe000) == 0x2000 && !is_head) {
if (((this->collisions & COL_EAST_ANY) == COL_EAST_SOUTH) && !is_head) {
this->direction = DirectionEast;
}
if ((this->collisions & 0xe00) == 0x200 && is_head) {
if (((this->collisions & COL_WEST_ANY) == COL_WEST_SOUTH) && is_head) {
this->direction = DirectionWest;
}
}
break;
case DirectionWest:
if (this->collisions & 0xe00) {
if ((this->collisions & COL_WEST_ANY) != COL_NONE) {
this->direction = is_head ? DirectionSouth : DirectionNorth;
} else {
if ((this->collisions & 0xe) == 4 && is_head) {
if (((this->collisions & COL_NORTH_ANY) == COL_NORTH_EAST) && is_head) {
this->direction = DirectionNorth;
}
if ((this->collisions & 0xe0) == 0x40 && !is_head) {
if (((this->collisions & COL_SOUTH_ANY) == COL_SOUTH_EAST) && !is_head) {
this->direction = DirectionSouth;
}
}
break;
case DirectionEast:
if (this->collisions & 0xe000) {
if ((this->collisions & COL_EAST_ANY) != COL_NONE) {
this->direction = is_head ? DirectionNorth : DirectionSouth;
} else {
if ((this->collisions & 0xe) == 2 && !is_head) {
if (((this->collisions & COL_NORTH_ANY) == COL_NORTH_WEST) && !is_head) {
this->direction = DirectionNorth;
}
if ((this->collisions & 0xe0) == 0x20 && is_head) {
if (((this->collisions & COL_SOUTH_ANY) == COL_SOUTH_WEST) && is_head) {
this->direction = DirectionSouth;
}
}
@@ -122,7 +122,7 @@ void sub_0802B35C(Entity* this) {
void sub_0802B4A8(Entity* this) {
if (--this->actionDelay == 0) {
Entity* ent = CreateObjectWithParent(this, GROUND_ITEM, 0x60, 0);
if (ent) {
if (ent != NULL) {
ent->y.HALF.HI -= 4;
}
DeleteEntity(this);
+1 -1
View File
@@ -380,7 +380,7 @@ bool32 sub_080288A4(Entity* this) {
void sub_080288C0(Entity* this) {
Entity* ent = this->child;
if (ent && (ent->bitfield & 0x80)) {
if ((ent != NULL) && (ent->bitfield & 0x80)) {
this->knockbackDirection = ent->knockbackDirection;
this->iframes = -ent->iframes;
this->knockbackSpeed = ent->knockbackSpeed;
-5
View File
@@ -9,11 +9,6 @@
#include "functions.h"
#include "hitbox.h"
extern void sub_08001318(Entity*);
extern u32 PlayerInRange(Entity*, u32, u32);
extern void sub_0804A4E4(Entity*, Entity*);
extern void sub_0804AA1C(Entity*);
u32 sub_080228CC(Entity*);
u32 sub_080228F0(Entity*);
+3 -2
View File
@@ -7,6 +7,7 @@
#define NENT_DEPRECATED
#include "global.h"
#include "collision.h"
#include "enemy.h"
#include "functions.h"
@@ -123,7 +124,7 @@ void sub_08039418(StalfosEntity* this) {
}
void sub_08039438(StalfosEntity* this) {
if (sub_0806F520()) {
if (sub_0806F520(super)) {
Stalfos_SubActions[super->subAction](this);
}
}
@@ -366,7 +367,7 @@ void sub_0803992C(StalfosEntity* this) {
super->direction = super->animationState << 3;
this->unk_78 = (u16)gUnk_080CF900[Random() & 0xf];
CalculateEntityTileCollisions(super, super->direction, 0);
if ((gUnk_080CF910[super->animationState] & super->collisions) != 0) {
if ((gUnk_080CF910[super->animationState] & super->collisions) != COL_NONE) {
InitAnimationForceUpdate(super, super->animationState);
} else {
InitAnimationForceUpdate(super, super->animationState + 4);
+3 -3
View File
@@ -74,7 +74,7 @@ void Takkuri_OnCollision(TakkuriEntity* this) {
void Takkuri_OnGrabbed(TakkuriEntity* this) {
gUnk_080CFF6C[super->subAction](this);
GetNextFrame(super);
if (sub_0806F520(super) == 0) {
if (!sub_0806F520(super)) {
super->action = 2;
super->subAction = 0;
this->unk_0x84 = 2;
@@ -132,7 +132,7 @@ void sub_0803BD08(TakkuriEntity* this) {
sub_0803BEE8(this);
GetNextFrame(super);
ent = sub_08049DF4(1);
if (ent) {
if (ent != NULL) {
if (EntityInRectRadius(super, gUnk_020000B0, 0x88, 0x50)) {
if (gUnk_020000B0->y.HALF.HI > super->y.HALF.HI + 8) {
super->action = 2;
@@ -306,7 +306,7 @@ void sub_0803C0AC(Entity* this) {
u32 index, rupeeType, rupees;
Entity* ent;
ent = sub_08049DF4(1);
if (!ent)
if (ent == NULL)
return;
rupees = gSave.stats.rupees;
+2 -1
View File
@@ -5,6 +5,7 @@
* @brief Tektite enemy
*/
#include "collision.h"
#include "enemy.h"
#include "functions.h"
@@ -135,7 +136,7 @@ void sub_0802F300(Entity* this) {
this->field_0xf = 0;
InitializeAnimation(this, 3);
return;
} else if (this->collisions != 0) {
} else if (this->collisions != COL_NONE) {
sub_0800417E(this, this->collisions);
} else if ((GetTileUnderEntity(this) & 0xf0) == 0x50) {
this->direction = (this->direction + 0x10) & 0x1f;
+2 -1
View File
@@ -5,6 +5,7 @@
* @brief Golden Tektite enemy
*/
#include "collision.h"
#include "enemy.h"
#include "functions.h"
@@ -114,7 +115,7 @@ void sub_08038048(Entity* this) {
this->actionDelay = 0x14;
InitializeAnimation(this, 3);
return;
} else if (this->collisions != 0) {
} else if (this->collisions != COL_NONE) {
sub_0800417E(this, this->collisions);
} else if ((GetTileUnderEntity(this) & 0xf0) == 0x50) {
this->direction = (this->direction + 0x10) & 0x1f;
+1 -1
View File
@@ -561,7 +561,7 @@ void VaatiWrathType0ActionD(Entity* this) {
void sub_08041BE8(Entity* this) {
Entity* entity;
if (sub_08079F8C() != 0) {
if (sub_08079F8C()) {
this->subAction = 1;
this->actionDelay = 120;
this->updatePriority = PRIO_NO_BLOCK;
+1 -1
View File
@@ -34,7 +34,7 @@ void sub_0802A250(Entity* this) {
UpdateSpriteForCollisionLayer(this);
ent = CreateObject(OBJECT_66, 0, 0);
if (ent) {
if (ent != NULL) {
ent->parent = this;
}
}
+3 -2
View File
@@ -5,6 +5,7 @@
* @brief Wisp enemy
*/
#include "collision.h"
#include "enemy.h"
#include "save.h"
#include "object.h"
@@ -69,7 +70,7 @@ void Wisp_OnCollision(Entity* this) {
}
void Wisp_OnGrabbed(Entity* this) {
if (sub_0806F520() != 0) {
if (sub_0806F520(this)) {
gUnk_080CEB98[this->subAction](this);
}
}
@@ -102,7 +103,7 @@ void sub_08033674(Entity* this) {
void sub_080336A8(Entity* this) {
if (--this->actionDelay == 0) {
sub_08033744(this);
} else if (this->collisions != 0) {
} else if (this->collisions != COL_NONE) {
sub_0800417E(this, this->collisions);
}
ProcessMovement0(this);
+2 -1
View File
@@ -7,6 +7,7 @@
#define NENT_DEPRECATED
#include "global.h"
#include "collision.h"
#include "enemy.h"
#include "enemy/wizzrobe.h"
#include "functions.h"
@@ -262,7 +263,7 @@ void sub_0802F9C8(WizzrobeEntity* this) {
} else {
if (super->type2 != 0) {
ProcessMovement0(super);
if (super->collisions != 0) {
if (super->collisions != COL_NONE) {
super->flags &= 0x7f;
this->timer1 = 0x28;
}