Use COL_ enum

This commit is contained in:
Elliptic Ellipsis
2022-03-25 01:25:02 +00:00
parent 1580dd1f2c
commit fa1eb01528
30 changed files with 185 additions and 149 deletions
+3 -2
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);
}
+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);
}
}
+4 -3
View File
@@ -1,4 +1,5 @@
#define NENT_DEPRECATED
#include "collision.h"
#include "entity.h"
#include "enemy.h"
#include "functions.h"
@@ -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);
}
}
+2 -1
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;
+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);
+13 -12
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"
@@ -639,14 +640,14 @@ 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 +912,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 +923,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 +952,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 +1162,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;
+2 -1
View File
@@ -6,6 +6,7 @@
*/
#include "enemy.h"
#include "collision.h"
#include "object.h"
#include "game.h"
#include "functions.h"
@@ -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);
}
+2 -1
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);
}
+2 -1
View File
@@ -1,4 +1,5 @@
#define NENT_DEPRECATED
#include "collision.h"
#include "entity.h"
#include "enemy.h"
#include "functions.h"
@@ -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;
+14 -14
View File
@@ -5,6 +5,7 @@
* @brief Spark enemy
*/
#include "collision.h"
#include "enemy.h"
#include "object.h"
#include "functions.h"
@@ -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;
}
}
+2 -1
View File
@@ -7,6 +7,7 @@
#define NENT_DEPRECATED
#include "global.h"
#include "collision.h"
#include "enemy.h"
#include "functions.h"
@@ -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);
+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;
+2 -1
View File
@@ -5,6 +5,7 @@
* @brief Wisp enemy
*/
#include "collision.h"
#include "enemy.h"
#include "save.h"
#include "object.h"
@@ -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;
}