Merge branch 'master' into gyorg

This commit is contained in:
Ibot02
2022-01-09 20:46:03 +01:00
1301 changed files with 26072 additions and 28415 deletions
+13 -7
View File
@@ -1,3 +1,10 @@
/**
* @file acroBandits.c
* @ingroup Enemies
*
* @brief Acro Bandits enemy
*/
#include "enemy.h"
#include "functions.h"
@@ -12,7 +19,6 @@ extern void sub_08032338(Entity*);
extern Entity* sub_08049DF4(u32);
extern Entity* gUnk_020000B0;
extern u8 gEntCount;
extern void (*const gUnk_080012C8[])(Entity*);
extern void (*const gUnk_080CE56C[])(Entity*);
extern void (*const gUnk_080CE584[])(Entity*);
@@ -108,7 +114,7 @@ void sub_080318DC(Entity* this) {
void sub_08031A60(Entity* this) {
if (this->iframes > 0)
sub_08003FC4(this, 0x1800);
GravityUpdate(this, 0x1800);
sub_08001324(this);
}
@@ -351,7 +357,7 @@ void sub_08031EE8(Entity* this) {
}
void sub_08031F54(Entity* this) {
sub_08003FC4(this, gUnk_080CE5F0[this->type2]);
GravityUpdate(this, gUnk_080CE5F0[this->type2]);
if (this->type2 * -0xe <= this->z.HALF.HI) {
this->action = 3;
this->actionDelay = 20;
@@ -411,12 +417,12 @@ void sub_08032008(Entity* this) {
this->field_0x76.HALF.HI = 1;
this->direction = GetFacingDirection(this, parent);
sub_080322E8(this);
sub_0806F69C(this);
LinearMoveUpdate(this);
}
} else {
this->direction = GetFacingDirection(this, parent);
sub_080322E8(this);
sub_0806F69C(this);
LinearMoveUpdate(this);
if (this->x.HALF.HI == parent->x.HALF.HI && this->y.HALF.HI == parent->y.HALF.HI)
this->field_0x76.HALF.HI = 0;
}
@@ -426,7 +432,7 @@ void sub_08032008(Entity* this) {
}
void sub_08032148(Entity* this) {
if (sub_08003FC4(this, 0x2000))
if (GravityUpdate(this, 0x2000))
return;
sub_08032290(this);
@@ -481,7 +487,7 @@ void sub_08032204(Entity* this) {
}
void sub_08032248(Entity* this) {
if (sub_08003FC4(this, 0x1800) == 0) {
if (GravityUpdate(this, 0x1800) == 0) {
if (this->frame & 0x80) {
((Entity*)this->field_0x7c.WORD)->actionDelay--;
+15 -8
View File
@@ -1,9 +1,16 @@
/**
* @file beetle.c
* @ingroup Enemies
*
* @brief Beetle enemy
*/
#include "enemy.h"
#include "functions.h"
extern u32 PlayerInRange(Entity*, u32, u32);
u32 sub_08021D00();
u32 sub_08021D00(Entity*);
void sub_08021D44(Entity* this, u32 direction);
extern void (*const gUnk_080CB590[])(Entity*);
@@ -133,7 +140,7 @@ void sub_08021984(Entity* this) {
EnqueueSFX(0x12d);
}
if (sub_08003FC4(this, 0x1800) == 0) {
if (GravityUpdate(this, 0x1800) == 0) {
this->action = 2;
this->actionDelay = 16;
this->field_0xf = 1;
@@ -200,7 +207,7 @@ void sub_08021AD8(Entity* this) {
EnqueueSFX(0x7c);
}
sub_080AEFE0(this);
if (!sub_08003FC4(this, 0x1800))
if (!GravityUpdate(this, 0x1800))
this->frameDuration = 1;
}
@@ -213,7 +220,7 @@ void sub_08021AD8(Entity* this) {
}
void sub_08021B64(Entity* this) {
if (gPlayerState.flags & 4) {
if (gPlayerState.flags & PL_DROWNING) {
this->action = 3;
this->z.WORD = 0;
InitializeAnimation(this, 2);
@@ -230,7 +237,7 @@ void sub_08021B64(Entity* this) {
this->actionDelay = (u8)iVar4;
}
if (gPlayerState.flags & 0x110)
if (gPlayerState.flags & (PL_DISABLE_ITEMS | PL_CAPTURED))
iVar4 = 0;
if (iVar4 == 0) {
@@ -244,8 +251,8 @@ void sub_08021B64(Entity* this) {
}
InitializeAnimation(this, 5);
} else {
gPlayerState.field_0x1a[0] |= 0x80;
gPlayerState.field_0x80 -= 0x50;
gPlayerState.mobility |= 0x80;
gPlayerState.speed_modifier -= 0x50;
gPlayerState.field_0xaa++;
CopyPositionAndSpriteOffset(&gPlayerEntity, this);
this->x.HALF.HI += gUnk_080CB5E4[(this->field_0xf++ & 0xe) >> 1];
@@ -259,7 +266,7 @@ void sub_08021C58(Entity* this) {
GetNextFrame(this);
if (this->frame & 1) {
sub_080AEFE0(this);
if (sub_08003FC4(this, 0x1800) == 0)
if (GravityUpdate(this, 0x1800) == 0)
this->frameDuration = 1;
}
+10 -4
View File
@@ -1,10 +1,16 @@
#include "global.h"
#include "audio.h"
/**
* @file bladeTrap.c
* @ingroup Enemies
*
* @brief Blade Trap enemy
*/
#include "sound.h"
#include "entity.h"
#include "room.h"
#include "functions.h"
extern void sub_080A2CC0();
extern void sub_080A2CC0(Entity*, void*, void*);
void BladeTrap(Entity* this) {
if (this->action == 0) {
@@ -13,7 +19,7 @@ void BladeTrap(Entity* this) {
sub_080A2CC0(this, &this->child, &this->field_0x74);
}
if (!(this->direction & 0x80)) {
sub_0806F69C(this);
LinearMoveUpdate(this);
}
if (!(--this->field_0x74.HWORD)) {
+8 -1
View File
@@ -1,5 +1,12 @@
/**
* @file bobomb.c
* @ingroup Enemies
*
* @brief Bobomb enemy
*/
#include "asm.h"
#include "audio.h"
#include "sound.h"
#include "enemy.h"
#include "object.h"
#include "functions.h"
+27 -21
View File
@@ -1,5 +1,11 @@
/**
* @file bombPeahat.c
* @ingroup Enemies
*
* @brief Bomb Peahat enemy
*/
#include "asm.h"
#include "global.h"
#include "entity.h"
#include "enemy.h"
#include "player.h"
@@ -137,19 +143,19 @@ void sub_0802A9A8(Entity* this) {
sub_0802ACDC(this, 8);
}
} else {
if (gRoomControls.unk2 != 0) {
if (gRoomControls.reload_flags != 0) {
return;
}
this->spriteSettings.draw = 1;
this->field_0x82.HWORD = 1;
if (this->field_0x80.HALF.LO) {
this->x.HALF.HI = gRoomControls.roomScrollX - 0x10;
this->x.HALF.HI = gRoomControls.scroll_x - 0x10;
this->direction = 8;
} else {
this->x.HALF.HI = gRoomControls.roomScrollX + 0x100;
this->x.HALF.HI = gRoomControls.scroll_x + 0x100;
this->direction = 0x18;
}
this->y.HALF.HI = gRoomControls.roomScrollY + 0x40;
this->y.HALF.HI = gRoomControls.scroll_y + 0x40;
this->actionDelay = 0x80;
sub_0802ADDC(this);
}
@@ -280,7 +286,7 @@ ASM_FUNC("asm/non_matching/eu/sub_0802AC40.inc", void sub_0802AC40(Entity* this)
#else
void sub_0802AC40(Entity* this) {
GetNextFrame(this);
sub_0806F69C(this);
LinearMoveUpdate(this);
if (this->field_0x7a.HALF.LO) {
if (sub_0802B234(this) == 0) {
this->field_0x7a.HALF.LO = 0;
@@ -312,9 +318,9 @@ void sub_0802AC40(Entity* this) {
void sub_0802ACDC(Entity* this, u32 param_2) {
u32 x;
if (this->field_0x80.HALF.LO) {
x = sub_080045B4(this, gRoomControls.roomScrollX + 0x20, gRoomControls.roomScrollY + 0x60);
x = sub_080045B4(this, gRoomControls.scroll_x + 0x20, gRoomControls.scroll_y + 0x60);
} else {
x = sub_080045B4(this, gRoomControls.roomScrollX + 0xd0, gRoomControls.roomScrollY + 0x60);
x = sub_080045B4(this, gRoomControls.scroll_x + 0xd0, gRoomControls.scroll_y + 0x60);
}
sub_08004596(this, x);
this->field_0xf = param_2;
@@ -334,13 +340,13 @@ void sub_0802AD1C(Entity* this, u32 param_2) {
void sub_0802AD54(Entity* this) {
if (this->field_0x82.HWORD != 0) {
if (gRoomControls.unk2 != 0) {
if (gRoomControls.reload_flags != 0) {
this->spriteSettings.draw = 0;
DeleteEntity(this);
return;
}
if (gRoomControls.roomOriginY > this->y.HALF.HI ||
(gRoomControls.roomOriginY + gRoomControls.height + 0x20) < this->y.HALF.HI) {
if (gRoomControls.origin_y > this->y.HALF.HI ||
(gRoomControls.origin_y + gRoomControls.height + 0x20) < this->y.HALF.HI) {
this->spriteSettings.draw = 0;
} else {
this->spriteSettings.draw = 1;
@@ -474,28 +480,28 @@ void sub_0802AF9C(Entity* this) {
}
NONMATCH("asm/non_matching/bombPeahat/sub_0802AFC8.inc", void sub_0802AFC8(Entity* this)) {
u32 field_0xf = this->field_0xf;
u32 flag = 8;
if (this->field_0xf < 0x29) {
u32 tmp;
if (field_0xf < 0x29) {
u32 tmp, tmp2;
flag = 4;
if (this->field_0x82.HWORD & 0x8000) {
this->field_0x82.HWORD -= 0x10;
} else {
this->field_0x82.HWORD += 0x10;
}
if (0x7f < (this->field_0x82.HWORD & 0xf0) - 1) {
tmp2 = this->field_0x82.HWORD;
tmp = tmp2 & 0xf0;
if (tmp == 0 || tmp > 0x80) {
this->field_0x82.HWORD ^= 0x8000;
}
tmp = 0x130 - (this->field_0x82.HWORD & 0xf0);
sub_0805EC9C(this, tmp, tmp, 0);
}
if (this->field_0xf & flag) {
this->palette.b.b0 = 0;
} else {
this->palette.b.b0 = this->palette.b.b4;
} else {
this->palette.b.b0 = 0;
}
}
END_NONMATCH
@@ -505,8 +511,8 @@ void sub_0802B048(Entity* this) {
u32 action;
if (this->field_0x7a.HALF.HI) {
if (gRoomControls.roomOriginY > this->y.HALF.HI ||
(gRoomControls.roomOriginY + gRoomControls.height + 0x20) < this->y.HALF.HI) {
if (gRoomControls.origin_y > this->y.HALF.HI ||
(gRoomControls.origin_y + gRoomControls.height + 0x20) < this->y.HALF.HI) {
COLLISION_OFF(this);
} else {
COLLISION_ON(this);
+367 -13
View File
@@ -1,37 +1,391 @@
/**
* @file bowMoblin.c
* @ingroup Enemies
*
* @brief Bow Moblin enemy
*/
#define NENT_DEPRECATED
#include "global.h"
#include "entity.h"
#include "enemy.h"
#include "functions.h"
extern void sub_0803C5F0(Entity*);
typedef struct {
Entity base;
u8 filler[0x12];
u8 unk_0x7a;
u8 unk_0x7b;
u8 filter[0x4];
u8 unk_0x80;
u8 unk_0x81;
u8 unk_0x82;
u8 unk_0x83;
} BowMoblinEntity;
extern void (*const gUnk_080CFF78[])(Entity*);
extern void (*const gUnk_080CFF90[])(Entity*);
void sub_0803C5F0(BowMoblinEntity*);
void sub_0803C690(BowMoblinEntity*);
void sub_0803C4B0(BowMoblinEntity*);
void sub_0803C5C4(BowMoblinEntity*);
void sub_0803C624(BowMoblinEntity*);
void sub_0803C6DC(BowMoblinEntity*);
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*);
extern void (*const gUnk_080CFF78[])(BowMoblinEntity*);
extern void (*const gUnk_080CFF90[])(BowMoblinEntity*);
extern const s8 gUnk_080CFFC4[8];
extern const s8 gUnk_080CFFA4[8];
extern const s8 gUnk_080CFFAC[16];
extern const u16 gUnk_080CFFBC[4];
void BowMoblin(Entity* this) {
EnemyFunctionHandler(this, gUnk_080CFF78);
EnemyFunctionHandler(this, (EntityActionArray)gUnk_080CFF78);
SetChildOffset(this, 0, 1, -0x18);
}
void sub_0803C180(Entity* this) {
gUnk_080CFF90[this->action](this);
void sub_0803C180(BowMoblinEntity* this) {
gUnk_080CFF90[super->action](this);
}
void sub_0803C198(Entity* this) {
void sub_0803C198(BowMoblinEntity* this) {
Entity* pEVar1;
if (this->field_0x43 != 0) {
sub_0804A9FC(this, 0x1c);
if (super->field_0x43 != 0) {
sub_0804A9FC(super, 0x1c);
}
sub_0804AA30(this, gUnk_080CFF78);
if ((this->bitfield & 0x80) != 0) {
sub_0804AA30(super, (EntityActionArray)gUnk_080CFF78);
if ((super->bitfield & 0x80) != 0) {
sub_0803C5F0(this);
pEVar1 = this->child;
pEVar1 = super->child;
if (pEVar1 != NULL) {
pEVar1->field_0xf++;
}
}
}
void nullsub_168(Entity* this) {
void nullsub_168(BowMoblinEntity* this) {
}
void sub_0803C1E0(BowMoblinEntity* this) {
sub_0804A720(super);
super->action = 1;
this->unk_0x7b = 0;
this->unk_0x80 = 0;
this->unk_0x83 = 0;
this->unk_0x81 = 0;
this->unk_0x7a = 0;
this->unk_0x82 = 1;
if (super->actionDelay) {
super->animationState = super->type2 << 1;
super->actionDelay = 0x1e;
super->speed = 0x80;
super->direction = super->type2 << 3;
sub_0803C690(this);
} else {
super->animationState = 0x10;
sub_0803C4B0(this);
}
}
void sub_0803C234(BowMoblinEntity* this) {
u8 mask;
if (this->unk_0x81) {
this->unk_0x81--;
}
mask = 0xff;
if (((--super->actionDelay) & mask) == 0) {
u8 tmp = ++this->unk_0x80;
if ((tmp) > 0xf) {
sub_0803C5C4(this);
} else if (((this->unk_0x80 & 0x3) == 0) && (Random() & 0x10)) {
sub_0803C624(this);
} else {
sub_0803C4B0(this);
}
} else if (sub_0803C6F8(this)) {
sub_0800417E(super, super->collisions);
super->animationState = ((super->direction + 4) & 0x18) >> 2;
this->unk_0x83++;
sub_0803C690(this);
} else if (sub_0803C568(this)) {
sub_0803C5F0(this);
}
sub_0803C6DC(this);
}
void sub_0803C2DC(BowMoblinEntity* this) {
u32 res;
u32 actionDelay = --super->actionDelay;
if (actionDelay == 0) {
super->action = 3;
this->unk_0x82 = actionDelay;
this->unk_0x80 = actionDelay;
super->animationState = 0x10;
sub_0803C4B0(this);
} else if (res = sub_0803C568(this), res) {
this->unk_0x7b |= 0x1;
}
if (super->field_0xf > 0xb) {
if (this->unk_0x7b != 0) {
sub_0803C5F0(this);
}
} else {
super->field_0xf++;
}
sub_0803C6DC(this);
}
void sub_0803C344(BowMoblinEntity* this) {
if (--super->actionDelay == 0) {
switch (this->unk_0x82) {
case 3: {
super->action = 4;
super->speed = 0x80;
super->direction = sub_08049F84(super, 1);
break;
}
case 5: {
super->action = 4;
super->speed = 0x80;
break;
}
case 2: {
u32 tmp;
super->action = 2;
super->speed = 0;
tmp = Random() & 0x7;
super->actionDelay = (tmp << 1) + tmp + 0x40;
break;
}
case 4: {
super->direction = (super->direction + 0x10) & 0x18;
}
case 0:
case 1:
default: {
u32 tmp;
super->action = 1;
this->unk_0x82 = 1;
super->speed = 0x80;
tmp = (Random() & 0x7);
super->actionDelay = (tmp << 1) + tmp + 0x22;
break;
}
}
super->field_0xf = 0;
super->animationState = ((super->direction + 4) & 0x18) >> 2;
sub_0803C690(this);
}
sub_0803C6DC(this);
}
void sub_0803C400(BowMoblinEntity* this) {
if (super->field_0xf) {
u8 mask;
super->field_0xf--;
mask = 0xff;
if ((super->field_0xf & mask) == 0) {
if (this->unk_0x82 == 3) {
this->unk_0x7a++;
if ((this->unk_0x7a & mask) <= 2) {
if (Random() & 0xc0) {
super->actionDelay = 0;
sub_0803C690(this);
sub_0803C6DC(this);
return;
}
}
}
sub_0803C634(this);
}
} else {
Entity* projectile;
switch (++super->actionDelay) {
case 1:
super->direction = super->animationState << 2;
projectile = CreateProjectileWithParent(super, 0xd, super->animationState >> 1);
if (projectile) {
super->child = projectile;
projectile->direction = (super->direction + 4) & 0x18;
projectile->parent = super;
}
break;
case 24:
super->actionDelay = 0;
super->field_0xf = 0x20;
break;
}
sub_0803C6DC(this);
if (super->child) {
sub_0803C714(this);
}
}
}
void sub_0803C4B0(BowMoblinEntity* this) {
u32 dir;
super->field_0xf = 0;
if (this->unk_0x82 == 1) {
super->actionDelay = gUnk_080CFFA4[Random() & 7];
super->speed = 0x80;
if (sub_08049FA0(super)) {
dir = Random();
dir &= 6;
super->direction = dir << 2;
} else {
dir = sub_08049EE4(super);
if (this->unk_0x83 == 0) {
dir += gUnk_080CFFAC[Random() & 0xf];
} else {
dir += gUnk_080CFFAC[Random() & 0x7];
super->actionDelay += 0x10;
this->unk_0x83--;
}
dir = (super->direction = (dir + 4) & 0x18) >> 2;
}
} else {
super->actionDelay = 0xc;
super->speed = super->field_0xf;
dir = super->direction >> 2;
}
if (dir != super->animationState) {
super->animationState = dir;
sub_0803C690(this);
}
}
u32 sub_0803C568(BowMoblinEntity* this) {
if (this->unk_0x81 == 0) {
Entity* ent = sub_08049DF4(1);
if (ent) {
if (this->unk_0x82 == 2) {
if (sub_0806FC80(super, ent, 0x30)) {
return 1;
}
}
if (sub_0806FC80(super, ent, 0x40)) {
u32 direction = (GetFacingDirection(super, ent) + 4) & 0x18;
direction = direction >> 2;
if (direction == super->animationState) {
return 1;
}
}
}
}
return 0;
}
void sub_0803C5C4(BowMoblinEntity* this) {
u32 state = ((super->direction + 4) & 0x18) >> 2;
super->animationState = state;
super->direction = state << 2;
this->unk_0x83 >>= 1;
sub_0803C664(this);
this->unk_0x82 = 2;
}
void sub_0803C5F0(BowMoblinEntity* this) {
super->direction = sub_08049F84(super, 1);
super->animationState = ((super->direction + 4) & 0x18) >> 2;
this->unk_0x83 = 0;
this->unk_0x7a = 0;
sub_0803C664(this);
this->unk_0x82 = 3;
}
void sub_0803C624(BowMoblinEntity* this) {
sub_0803C664(this);
this->unk_0x82 = 5;
}
void sub_0803C634(BowMoblinEntity* this) {
super->animationState = ((super->direction + 4) & 0x18) >> 2;
super->direction = super->animationState << 2;
this->unk_0x83 = 0;
sub_0803C664(this);
super->actionDelay <<= 1;
this->unk_0x82 = 4;
}
void sub_0803C664(BowMoblinEntity* this) {
super->action = 3;
super->actionDelay = 0x20;
super->field_0xf = 0;
this->unk_0x80 = 0;
this->unk_0x7b = 0;
super->speed = 0;
this->unk_0x82 = 0;
sub_0803C690(this);
}
void sub_0803C690(BowMoblinEntity* this) {
u32 tmp = super->animationState >> 1;
switch (this->unk_0x82) {
case 1:
case 4: {
tmp += 0x4;
break;
}
case 3:
case 5: {
tmp += 0x8;
break;
}
case 2: {
tmp += 0xc;
break;
}
case 0: {
break;
}
}
InitializeAnimation(super, tmp);
}
void sub_0803C6DC(BowMoblinEntity* this) {
u8 tmp = this->unk_0x82;
if (tmp == 0) {
super->speed = tmp;
}
ProcessMovement(super);
GetNextFrame(super);
}
u32 sub_0803C6F8(BowMoblinEntity* this) {
u32 tmp = (super->collisions & gUnk_080CFFBC[(super->animationState ^ 1) / 2]);
u32 tmp2 = -tmp;
return (tmp2 | tmp) >> 0x1f;
}
void sub_0803C714(BowMoblinEntity* this) {
Entity* child = super->child;
const s8* tmp;
u32 offsetX;
u32 offsetY;
tmp = &gUnk_080CFFC4[super->animationState];
// TODO fix array access
offsetX = tmp[0] << 0x10;
offsetY = tmp[1] << 0x10;
PositionRelative(super, child, offsetX, offsetY);
}
+10 -6
View File
@@ -1,15 +1,19 @@
/**
* @file businessScrub.c
* @ingroup Enemies
*
* @brief Business Scrub enemy
*/
#include "asm.h"
#include "enemy.h"
#include "audio.h"
#include "entity.h"
#include "flags.h"
#include "textbox.h"
#include "message.h"
#include "save.h"
#include "npc.h"
#include "functions.h"
#include "effects.h"
#include "game.h"
#include "item.h"
extern void LoadObjPalette(Entity*, u32);
extern Entity* sub_08049DF4(u32);
extern bool32 sub_08056338(void);
extern void UnloadOBJPalette(Entity*);
+7 -1
View File
@@ -1,5 +1,11 @@
/**
* @file chaser.c
* @ingroup Enemies
*
* @brief Chaser enemy
*/
#include "enemy.h"
#include "entity.h"
#include "functions.h"
extern s32 sub_080012DC(Entity*);
+24 -14
View File
@@ -1,8 +1,13 @@
/**
* @file chuchu.c
* @ingroup Enemies
*
* @brief Chuchu enemy
*/
#include "asm.h"
#include "enemy.h"
#include "entity.h"
#include "functions.h"
#include "audio.h"
extern s32 sub_080012DC(Entity*);
extern void sub_08001318(Entity*);
@@ -134,7 +139,7 @@ void sub_0801EFD8(Entity* this) {
sub_0801FB68(this);
InitializeAnimation(this, 8);
}
sub_08003FC4(this, 0x1800);
GravityUpdate(this, 0x1800);
GetNextFrame(this);
}
}
@@ -146,7 +151,7 @@ void sub_0801F02C(Entity* this) {
}
void sub_0801F048(Entity* this) {
sub_08003FC4(this, 0x1800);
GravityUpdate(this, 0x1800);
GetNextFrame(this);
if (this->type == 0) {
sub_0804A7D4(this);
@@ -218,7 +223,7 @@ void sub_0801F1B0(Entity* this) {
EnqueueSFX(299);
}
sub_080AEFE0(this);
if (sub_08003FC4(this, 0x4000) == 0)
if (GravityUpdate(this, 0x4000) == 0)
GetNextFrame(this);
} else {
GetNextFrame(this);
@@ -278,7 +283,7 @@ void sub_0801F2CC(Entity* this) {
}
void sub_0801F2F8(Entity* this) {
sub_08003FC4(this, 0x1800);
GravityUpdate(this, 0x1800);
GetNextFrame(this);
if (this->frame & 0x80) {
sub_0801F340(this);
@@ -333,9 +338,6 @@ void sub_0801F3AC(Entity* this) {
}
}
#ifdef EU
ASM_FUNC("asm/non_matching/eu/sub_0801F428.inc", void sub_0801F428(Entity* this))
#else
void sub_0801F428(Entity* this) {
sub_0804A720(this);
this->action = 1;
@@ -347,12 +349,20 @@ void sub_0801F428(Entity* this) {
this->action = 3;
this->field_0xf = 30;
#ifdef EU
this->direction = sub_08049F84(this, 1);
#endif
COLLISION_ON(this);
this->spritePriority.b1 = 3;
#ifndef EU
this->spriteSettings.draw = 1;
#endif
InitializeAnimation(this, 2);
}
#endif
void sub_0801F48C(Entity* this) {
GetNextFrame(this);
@@ -409,7 +419,7 @@ void sub_0801F584(Entity* this) {
EnqueueSFX(299);
}
sub_080AEFE0(this);
if (sub_08003FC4(this, 0x4000) == 0)
if (GravityUpdate(this, 0x4000) == 0)
GetNextFrame(this);
} else {
@@ -471,7 +481,7 @@ void sub_0801F6CC(Entity* this) {
}
void sub_0801F6F8(Entity* this) {
sub_08003FC4(this, 0x1800);
GravityUpdate(this, 0x1800);
GetNextFrame(this);
if (this->frame & 0x80) {
this->action = 4;
@@ -586,7 +596,7 @@ void sub_0801F940(Entity* this) {
EnqueueSFX(299);
}
sub_080AEFE0(this);
if (sub_08003FC4(this, 0x4000) == 0)
if (GravityUpdate(this, 0x4000) == 0)
GetNextFrame(this);
} else {
GetNextFrame(this);
@@ -646,7 +656,7 @@ void sub_0801FA78(Entity* this) {
}
void sub_0801FAAC(Entity* this) {
sub_08003FC4(this, 0x1800);
GravityUpdate(this, 0x1800);
GetNextFrame(this);
if (this->frame & 0x80) {
sub_0801FB14(this);
+7 -2
View File
@@ -1,6 +1,11 @@
/**
* @file chuchuBoss.c
* @ingroup Enemies
*
* @brief Chuchu Boss enemy
*/
#include "enemy.h"
#include "entity.h"
#include "functions.h"
void sub_08027870(Entity*);
+15
View File
@@ -0,0 +1,15 @@
#include "global.h"
#include "common.h"
#include "functions.h"
void ClearArmosData(void) {
MemClear(&gRoomTransition.armos_data, sizeof(gRoomTransition.armos_data));
gRoomTransition.armos_data.field_0xae = 0xff;
}
void sub_080300C4(void) {
if (gRoomTransition.armos_data.field_0xae == 0xff) {
gRoomTransition.armos_data.field_0xac = 0;
MemClear(&gRoomTransition.armos_data.data, sizeof(gRoomTransition.armos_data.data));
}
}
+10 -3
View File
@@ -1,3 +1,10 @@
/**
* @file cuccoChickAggr.c
* @ingroup Enemies
*
* @brief Cucco Chick Aggr enemy
*/
#include "enemy.h"
#include "functions.h"
@@ -52,7 +59,7 @@ void sub_08022988(Entity* this) {
}
ProcessMovement(this);
if (sub_08003FC4(this, 0x2000) == 0) {
if (GravityUpdate(this, 0x2000) == 0) {
if (--this->actionDelay == 0) {
sub_08022A88(this);
} else {
@@ -64,7 +71,7 @@ void sub_08022988(Entity* this) {
}
void sub_080229F8(Entity* this) {
if (sub_08003FC4(this, 0x2800) == 0) {
if (GravityUpdate(this, 0x2800) == 0) {
if (--this->actionDelay == 0) {
this->action = 4;
this->actionDelay = 6;
@@ -88,7 +95,7 @@ void sub_08022A40(Entity* this) {
}
ProcessMovement(this);
if (sub_08003FC4(this, 0x2000) == 0) {
if (GravityUpdate(this, 0x2000) == 0) {
if (--this->actionDelay == 0) {
sub_08022A88(this);
} else {
+24 -17
View File
@@ -1,3 +1,10 @@
/**
* @file darkNut.c
* @ingroup Enemies
*
* @brief Dark Nut enemy
*/
#include "enemy.h"
#include "functions.h"
@@ -6,23 +13,23 @@ typedef struct {
u8 field_0x1;
} PACKED stuct_080CAB14;
void sub_08021218();
void sub_08021588();
void sub_080213D0();
void sub_08021390();
void sub_0802159C();
void sub_0804AA1C();
void sub_080213F0();
u32 sub_080214FC();
void sub_08021540();
void sub_08021600();
void sub_080213B0();
u32 PlayerInRange();
u32 sub_0802169C();
void sub_0802124C();
void sub_08021644();
void sub_08021414();
void sub_08021400();
void sub_08021218(Entity*, u32, u32);
void sub_08021588(Entity*);
void sub_080213D0(Entity*, u32);
void sub_08021390(Entity*);
void sub_0802159C(Entity*);
void sub_0804AA1C(Entity*);
void sub_080213F0(Entity*);
u32 sub_080214FC(Entity*);
void sub_08021540(Entity*);
void sub_08021600(Entity*);
void sub_080213B0(Entity*);
u32 PlayerInRange(Entity*, u32, u32);
u32 sub_0802169C(Entity*, Entity*);
void sub_0802124C(Entity*);
void sub_08021644(Entity*);
void sub_08021414(Entity*);
void sub_08021400(Entity*);
u32 sub_08021274(u32, u32);
u32 sub_08021664(Entity*, Entity*);
u32 sub_0804A044(Entity*, Entity*, u32);
+10 -5
View File
@@ -1,12 +1,17 @@
#include "audio.h"
/**
* @file doorMimic.c
* @ingroup Enemies
*
* @brief Door Mimic enemy
*/
#include "sound.h"
#include "enemy.h"
#include "entity.h"
#include "functions.h"
#include "effects.h"
extern s16 sub_080001DA(u32, u32); // ?
extern void sub_08049CF4();
void sub_080221C0();
extern void sub_08049CF4(Entity*);
void sub_080221C0(Entity*);
typedef struct {
s8 h;
+8 -1
View File
@@ -1,3 +1,10 @@
/**
* @file enemy4D.c
* @ingroup Enemies
*
* @brief enemy 4D
*/
#include "global.h"
#include "entity.h"
#include "enemy.h"
@@ -29,7 +36,7 @@ void sub_0803EB34(Entity* this) {
CreateDeathFx(this, 0xff, 0x57);
}
void nullsub_21() {
void nullsub_21(Entity* this) {
}
void sub_0803EB44(Entity* this) {
+7 -1
View File
@@ -1,5 +1,11 @@
/**
* @file enemyE.c
* @ingroup Enemies
*
* @brief enemy E
*/
#include "enemy.h"
#include "entity.h"
#include "functions.h"
void sub_08023000(Entity*, int);
+10 -3
View File
@@ -1,3 +1,10 @@
/**
* @file fallingBoulder.c
* @ingroup Enemies
*
* @brief Falling Boulder enemy
*/
#include "enemy.h"
#include "functions.h"
@@ -61,7 +68,7 @@ void sub_0802C318(Entity* this) {
NONMATCH("asm/non_matching/fallingBoulder/sub_0802C334.inc", void sub_0802C334(Entity* this)) {
if ((u16)this->field_0x7c.HALF.LO == 0) {
u32 tmp = gRoomControls.roomOriginY;
u32 tmp = gRoomControls.origin_y;
if (&gPlayerEntity == NULL)
return;
if (tmp - gPlayerEntity.y.HALF.HI <= 0x38) {
@@ -106,11 +113,11 @@ NONMATCH("asm/non_matching/fallingBoulder/sub_0802C334.inc", void sub_0802C334(E
}
}
y = gRoomControls.roomOriginY + gRoomControls.height - this->y.HALF.HI;
y = gRoomControls.origin_y + gRoomControls.height - this->y.HALF.HI;
if (y >= 5) {
sub_080AEFB4(this);
} else {
sub_0806F69C(this);
LinearMoveUpdate(this);
if (this->z.HALF.HI - y > 0x38) {
sub_0802C62C(this);
this->field_0x7a.HWORD = (Random() & 0x7f) | 0x80;
+8 -3
View File
@@ -1,3 +1,10 @@
/**
* @file fireballGuy.c
* @ingroup Enemies
*
* @brief Fireball Guy enemy
*/
#include "enemy.h"
#include "functions.h"
@@ -13,8 +20,6 @@ extern void (*const gUnk_080D1800[])(Entity*);
extern u8 gUnk_080D180C[4]; // Entity count per form
extern PosOffset gUnk_080D1810[4];
extern u8 gEntCount;
void FireballGuy(Entity* this) {
EnemyFunctionHandler(this, gUnk_080D17E8);
}
@@ -49,7 +54,7 @@ void sub_080453E8(Entity* this) {
void sub_08045430(Entity* this) {
sub_080AEFE0(this);
GetNextFrame(this);
if (sub_08003FC4(this, 0x1800) == 0)
if (GravityUpdate(this, 0x1800) == 0)
sub_08045524(this);
}
+39 -34
View File
@@ -1,27 +1,35 @@
/**
* @file gibdo.c
* @ingroup Enemies
*
* @brief Gibdo enemy
*/
#include "global.h"
#include "enemy.h"
#include "object.h"
#include "functions.h"
// Gibudo
void sub_08037794();
void sub_08037B10();
void sub_0803797C();
void sub_080379BC();
void sub_08037C0C();
u32 sub_08037810();
void sub_080377B0();
u32 sub_080378B0();
u32 sub_08037914();
u32 sub_080379EC();
void sub_08037A58();
void sub_08037ACC();
void sub_08037B48();
void sub_08037A14();
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*);
extern void sub_0804A4E4(Entity*, Entity*);
extern Entity* sub_08049DF4(u32);
u32 sub_0804A044(Entity*, Entity*, u32);
extern void sub_0800449C(Entity*, u32);
extern void SoundReqClipped(Entity*, u32);
extern void (*const gGibdo[6])(Entity*);
extern void (*const gUnk_080CF2AC[9])(Entity*);
@@ -75,7 +83,7 @@ NONMATCH("asm/non_matching/gibdo/sub_080374A4.inc", void sub_080374A4(Entity* th
}
END_NONMATCH
void nullsub_162() {
void nullsub_162(Entity* this) {
}
void sub_08037558(Entity* this) {
@@ -155,27 +163,25 @@ void sub_08037690(Entity* this) {
}
}
}
// Non-matching
NONMATCH("asm/non_matching/gibdo/sub_080376D0.inc", void sub_080376D0(Entity* this)) {
void sub_080376D0(Entity* this) {
u8* x;
if (sub_080379EC(this) == 0) {
ResetPlayer();
gPlayerState.field_0x1a[0] = gPlayerState.field_0x1a[0] | 0x80;
gPlayerState.mobility = gPlayerState.mobility | 0x80;
gPlayerState.field_0xa = gPlayerState.field_0xa | 0x80;
CopyPositionAndSpriteOffset(&gPlayerEntity, this);
UpdateAnimationSingleFrame(this);
x = &this->frame;
if ((*x & 0x1) != 0) {
if (!(--this->field_0x7c.BYTES.byte0)) {
if ((this->frame & 0x1) != 0) {
if (--this->field_0x7c.BYTES.byte0 == 0) {
sub_08037A58(this);
} else {
this->frame ^= 1;
sub_08037B10(this);
}
} else {
*x = *x ^ 1;
sub_08037B10(this);
}
}
}
END_NONMATCH
void sub_0803773C(Entity* this) {
UpdateAnimationSingleFrame(this);
@@ -347,8 +353,8 @@ void sub_08037A58(Entity* this) {
}
void sub_08037ACC(Entity* this) {
gPlayerState.flags &= 0xFFFFFEFF;
gPlayerEntity.flags |= 0x80;
gPlayerState.flags &= ~PL_DISABLE_ITEMS;
COLLISION_ON(&gPlayerEntity);
gPlayerEntity.iframes = 0x1e;
gPlayerEntity.knockbackDirection = DirectionFromAnimationState(this->animationState);
gPlayerEntity.knockbackDuration = 4;
@@ -359,18 +365,18 @@ void sub_08037B10(Entity* this) {
u32 h;
gPlayerEntity.iframes = 0xc;
h = ModHealth(-8);
sub_0800449C(&gPlayerEntity, 0x7a);
SoundReqClipped(&gPlayerEntity, 0x7a);
if (h == 0) {
sub_08037A58(this);
this->field_0x76.HALF.LO = 0xf0;
}
}
NONMATCH("asm/non_matching/gibdo/sub_08037B48.inc", void sub_08037B48(Entity* this)) {
void sub_08037B48(Entity* this) {
Entity* E;
E = CreateObject(OBJECT_2A, 3, 0);
if (E != 0) {
E->type2 = this->actionDelay;
E->spritePriority.b0 = (E->spritePriority.b0 & 0xf8) | 3;
E->spritePriority.b0 = 3;
E->spriteOffsetX = 0;
E->spriteOffsetY = 0xfc;
E->parent = this;
@@ -379,7 +385,7 @@ NONMATCH("asm/non_matching/gibdo/sub_08037B48.inc", void sub_08037B48(Entity* th
E = CreateObject(OBJECT_2A, 3, 0);
if (E != 0) {
E->type2 = this->actionDelay;
E->spritePriority.b0 = (E->spritePriority.b0 & 0xf8) | 3;
E->spritePriority.b0 = 3;
E->spriteOffsetX = 0xfd;
E->spriteOffsetY = 0xf8;
E->parent = this;
@@ -388,14 +394,13 @@ NONMATCH("asm/non_matching/gibdo/sub_08037B48.inc", void sub_08037B48(Entity* th
E = CreateObject(OBJECT_2A, 3, 0);
if (E != 0) {
E->type2 = this->actionDelay;
E->spritePriority.b0 = (E->spritePriority.b0 & 0xf8) | 3;
E->spritePriority.b0 = 3;
E->spriteOffsetX = 0x5;
E->spriteOffsetY = 0xf5;
E->parent = this;
}
this->child = E;
}
END_NONMATCH
NONMATCH("asm/non_matching/gibdo/sub_08037C0C.inc", void sub_08037C0C(Entity* this, Entity* that)) {
if (this->field_0x80.HWORD != 0) {
+13 -13
View File
@@ -19,7 +19,7 @@ void (*const gUnk_080D1E6C[])(GyorgChildEntity*) = {
};
void GyorgChild(Entity* this) {
if (gScreenTransition.field_0x39 == 0) {
if (gRoomTransition.field_0x39 == 0) {
this->flags &= ~0x80;
this->health = 0;
this->collisionLayer = 2;
@@ -106,7 +106,7 @@ void sub_080486F4(GyorgChildEntity* this) {
}
void sub_0804877C(GyorgChildEntity* this) {
sub_0806F69C(super);
LinearMoveUpdate(super);
if (super->actionDelay != 0) {
if ((--super->actionDelay & 0xF) == 0) {
super->direction += this->unk_7b;
@@ -115,22 +115,22 @@ void sub_0804877C(GyorgChildEntity* this) {
}
switch (super->animationState >> 1) {
case 0:
if (super->y.HALF.HI > gRoomControls.roomScrollY - 0x18) {
if (super->y.HALF.HI > gRoomControls.scroll_y - 0x18) {
return;
}
break;
case 1:
if (super->x.HALF.HI < gRoomControls.roomScrollX + 0x108) {
if (super->x.HALF.HI < gRoomControls.scroll_x + 0x108) {
return;
}
break;
case 2:
if (super->y.HALF.HI < gRoomControls.roomScrollY + 0xb8) {
if (super->y.HALF.HI < gRoomControls.scroll_y + 0xb8) {
return;
}
break;
default:
if (super->x.HALF.HI > gRoomControls.roomScrollX - 0x18) {
if (super->x.HALF.HI > gRoomControls.scroll_x - 0x18) {
return;
}
break;
@@ -157,11 +157,11 @@ void sub_0804882C(GyorgChildEntity* this) {
case 0:
case 2:
super->x.HALF.HI = gPlayerEntity.x.HALF.HI + this->unk_74;
super->y.HALF.HI = gRoomControls.roomScrollY + this->unk_76;
super->y.HALF.HI = gRoomControls.scroll_y + this->unk_76;
break;
case 1:
default:
super->x.HALF.HI = gRoomControls.roomScrollX + this->unk_74;
super->x.HALF.HI = gRoomControls.scroll_x + this->unk_74;
super->y.HALF.HI = gPlayerEntity.y.HALF.HI + this->unk_76;
break;
}
@@ -172,26 +172,26 @@ void sub_0804882C(GyorgChildEntity* this) {
}
void sub_08048904(GyorgChildEntity* this) {
sub_0806F69C(super);
LinearMoveUpdate(super);
GetNextFrame(super);
switch (super->animationState >> 1) {
case 0:
if (super->y.HALF.HI > gRoomControls.roomScrollY - 0x28) {
if (super->y.HALF.HI > gRoomControls.scroll_y - 0x28) {
return;
}
break;
case 1:
if (super->x.HALF.HI < gRoomControls.roomScrollX + 0x118) {
if (super->x.HALF.HI < gRoomControls.scroll_x + 0x118) {
return;
}
break;
case 2:
if (super->y.HALF.HI < gRoomControls.roomScrollY + 0xc8) {
if (super->y.HALF.HI < gRoomControls.scroll_y + 0xc8) {
return;
}
break;
default:
if (super->x.HALF.HI > gRoomControls.roomScrollX - 0x28) {
if (super->x.HALF.HI > gRoomControls.scroll_x - 0x28) {
return;
}
break;
+6 -7
View File
@@ -2,8 +2,7 @@
#include "global.h"
#include "entity.h"
#include "enemy.h"
#include "utils.h"
#include "audio.h"
#include "sound.h"
#include "asm.h"
#include "functions.h"
#include "enemy/gyorg.h"
@@ -270,8 +269,8 @@ END_NONMATCH
void sub_080465C8(void) {
s32 x, y;
x = (gPlayerEntity.x.HALF.HI - gRoomControls.roomOriginX) >> 3;
y = (gPlayerEntity.y.HALF.HI - gRoomControls.roomOriginY) >> 3;
x = (gPlayerEntity.x.HALF.HI - gRoomControls.origin_x) >> 3;
y = (gPlayerEntity.y.HALF.HI - gRoomControls.origin_y) >> 3;
if (gUnk_02019EE0[(y << 7) + x]) {
gPlayerState.field_0x14 = 1;
}
@@ -284,8 +283,8 @@ void sub_0804660C(GyorgFemaleEntity* this, u32 unk1) {
const u16* p;
super->animationState = unk1;
p = &gUnk_080D1A84[unk1 >> 5];
super->x.HALF.HI = p[0] + gRoomControls.roomOriginX;
super->y.HALF.HI = p[1] + gRoomControls.roomOriginY;
super->x.HALF.HI = p[0] + gRoomControls.origin_x;
super->y.HALF.HI = p[1] + gRoomControls.origin_y;
}
// todo: correct type
@@ -408,7 +407,7 @@ void sub_080466A8(GyorgFemaleEntity* this) {
this->unk_78 = 0xFF;
SoundReq(SFX_BOSS_HIT);
if (super->health != 0) {
sub_08080964(8, 0);
InitScreenShake(8, 0);
if (++this->unk_82 <= 0xC) {
super->health--;
}
+2 -2
View File
@@ -186,8 +186,8 @@ void sub_08048D20(GyorgFemaleEyeEntity* this) {
if (tmp2 != super->animationState) {
super->animationState = tmp2;
tmp = &gUnk_080D1F90[super->type + (tmp2 << 3)];
super->x.HALF.HI = tmp->x + gRoomControls.roomOriginX;
super->y.HALF.HI = tmp->y + gRoomControls.roomOriginY;
super->x.HALF.HI = tmp->x + gRoomControls.origin_x;
super->y.HALF.HI = tmp->y + gRoomControls.origin_y;
InitializeAnimation(super, gUnk_080D2010[super->type + (tmp2 << 3)]);
}
}
+2 -2
View File
@@ -47,8 +47,8 @@ void GyorgFemaleMouth(Entity* this) {
tmp = this->parent->animationState >> 5;
if (tmp != this->animationState) {
this->animationState = tmp;
this->x.HALF.HI = gUnk_080D28CC[tmp] + gRoomControls.roomOriginX;
this->y.HALF.HI = gUnk_080D28CC[tmp + 1] + gRoomControls.roomOriginY;
this->x.HALF.HI = gUnk_080D28CC[tmp] + gRoomControls.origin_x;
this->y.HALF.HI = gUnk_080D28CC[tmp + 1] + gRoomControls.origin_y;
InitializeAnimation(this, tmp >> 1);
} else {
GetNextFrame(this);
+51 -44
View File
@@ -1,8 +1,15 @@
/**
* @file gyorgMale.c
* @ingroup Enemies
*
* @brief Gyorg Male enemy
*/
#define NENT_DEPRECATED
#include "global.h"
#include "enemy.h"
#include "player.h"
#include "fileScreen.h"
#include "fileselect.h"
#include "functions.h"
#include "effects.h"
#include "enemy/gyorg.h"
@@ -104,7 +111,7 @@ void GyorgMale(GyorgMaleEntity* this) {
super->animationState = -(this->unk_78 >> 8);
sub_08048004(this);
this->unk_7d = super->spriteSettings.draw;
if (super->spriteSettings.draw == 1 && (super->y.HALF.HI - gRoomControls.roomScrollY + 0x30) > 0x100u) {
if (super->spriteSettings.draw == 1 && (super->y.HALF.HI - gRoomControls.scroll_y + 0x30) > 0x100u) {
super->spriteSettings.draw = 0;
}
this->unk_84 = gPlayerEntity.x.HALF.HI;
@@ -168,7 +175,7 @@ void sub_08046930(GyorgMaleEntity* this) {
void sub_0804696C(GyorgMaleEntity* this) {
sub_08047E48(this);
if (gRoomControls.roomOriginY + 0x130 > super->y.HALF.HI) {
if (gRoomControls.origin_y + 0x130 > super->y.HALF.HI) {
super->subAction = 2;
super->direction = 0x80;
super->speed = 0x100;
@@ -180,9 +187,9 @@ void sub_0804696C(GyorgMaleEntity* this) {
}
if (super->actionDelay) {
#ifdef EU
if (gRoomControls.roomOriginY + 0x210 > super->y.HALF.HI) {
if (gRoomControls.origin_y + 0x210 > super->y.HALF.HI) {
#else
if (gRoomControls.roomOriginY + 0x258 > super->y.HALF.HI) {
if (gRoomControls.origin_y + 0x258 > super->y.HALF.HI) {
#endif
super->actionDelay = 0;
SoundReq(SFX_APPARATE);
@@ -192,7 +199,7 @@ void sub_0804696C(GyorgMaleEntity* this) {
void sub_080469CC(GyorgMaleEntity* this) {
sub_08047E48(this);
if (gRoomControls.roomOriginY + 0x210 < super->y.HALF.HI) {
if (gRoomControls.origin_y + 0x210 < super->y.HALF.HI) {
super->subAction = 3;
super->direction = 0x90;
}
@@ -200,7 +207,7 @@ void sub_080469CC(GyorgMaleEntity* this) {
void sub_080469F4(GyorgMaleEntity* this) {
sub_08047E48(this);
if (gRoomControls.roomOriginY + 0x290 < super->y.HALF.HI) {
if (gRoomControls.origin_y + 0x290 < super->y.HALF.HI) {
super->subAction = 4;
super->spriteOrientation.flipY = 2;
super->spriteRendering.b3 = 2;
@@ -217,7 +224,7 @@ void sub_08046A30(GyorgMaleEntity* this) {
void sub_08046A54(GyorgMaleEntity* this) {
sub_08047E48(this);
if (gRoomControls.roomOriginX + 0x380 < super->x.HALF.HI) {
if (gRoomControls.origin_x + 0x380 < super->x.HALF.HI) {
super->subAction = 6;
}
}
@@ -275,8 +282,8 @@ void sub_08046B8C(GyorgMaleEntity* this) {
if (sub_0806FCB8(super, this->unk_80, this->unk_82, 4)) {
super->subAction = 3;
this->unk_76 = super->direction << 8;
this->unk_80 = gRoomControls.roomOriginX + 0x200;
this->unk_82 = gRoomControls.roomOriginY + 0x210;
this->unk_80 = gRoomControls.origin_x + 0x200;
this->unk_82 = gRoomControls.origin_y + 0x210;
sub_08047D88(this);
} else {
super->direction = sub_080045DA(this->unk_80 - super->x.HALF.HI, this->unk_82 - super->y.HALF.HI);
@@ -337,8 +344,8 @@ void sub_08046D44(GyorgMaleEntity* this) {
super->subAction = 1;
super->speed = 0x200;
tmp = gUnk_080D1B60 + (((Entity*)super->myHeap)->next->animationState >> 5);
this->unk_80 = tmp[0] + gRoomControls.roomOriginX;
this->unk_82 = tmp[1] + gRoomControls.roomOriginY;
this->unk_80 = tmp[0] + gRoomControls.origin_x;
this->unk_82 = tmp[1] + gRoomControls.origin_y;
this->unk_76 = super->direction << 8;
sub_08047D88(this);
}
@@ -446,8 +453,8 @@ void sub_08046FE8(GyorgMaleEntity* this) {
super->subAction = 1;
super->speed = 0x1c0;
this->unk_7e = 0x1e;
this->unk_80 = gRoomControls.roomOriginX + 0x290;
this->unk_82 = gRoomControls.roomOriginY + 0x190;
this->unk_80 = gRoomControls.origin_x + 0x290;
this->unk_82 = gRoomControls.origin_y + 0x190;
sub_08047D88(this);
}
@@ -505,7 +512,7 @@ void sub_0804717C(GyorgMaleEntity* this) {
super->speed += 8;
}
sub_08047DF0(this, ((0x100 - super->direction) & 0xFF) << 8);
if (gRoomControls.roomOriginX + 0x200 > super->x.HALF.HI) {
if (gRoomControls.origin_x + 0x200 > super->x.HALF.HI) {
super->subAction = 5;
}
}
@@ -518,7 +525,7 @@ void sub_080471C8(GyorgMaleEntity* this) {
super->direction++;
}
sub_08047DF0(this, ((0x100 - super->direction) & 0xFF) << 8);
if (gRoomControls.roomOriginY + 0x190 <= super->y.HALF.HI)
if (gRoomControls.origin_y + 0x190 <= super->y.HALF.HI)
return;
if (this->unk_74 > 0x100) {
if (Random() & 1) {
@@ -558,7 +565,7 @@ void sub_080472BC(GyorgMaleEntity* this) {
super->speed += 8;
}
sub_08047DF0(this, ((0x100 - super->direction) & 0xFF) << 8);
if (gRoomControls.roomOriginX + 0x2B0 >= super->x.HALF.HI)
if (gRoomControls.origin_x + 0x2B0 >= super->x.HALF.HI)
return;
super->subAction = 9;
this->unk_76 = super->direction << 8;
@@ -597,8 +604,8 @@ void sub_0804736C(GyorgMaleEntity* this) {
void sub_080473B8(GyorgMaleEntity* this) {
super->subAction = 1;
super->speed = 0x120;
this->unk_80 = gRoomControls.roomOriginX + 0x200;
this->unk_82 = gRoomControls.roomOriginY + 0x1D0;
this->unk_80 = gRoomControls.origin_x + 0x200;
this->unk_82 = gRoomControls.origin_y + 0x1D0;
sub_08047D88(this);
}
@@ -651,9 +658,9 @@ void sub_08047484(GyorgMaleEntity* this) {
}
void sub_08047508(GyorgMaleEntity* this) {
if (gRoomControls.roomOriginX + 0x1A0 < super->x.HALF.HI) {
if (gRoomControls.origin_x + 0x1A0 < super->x.HALF.HI) {
if (super->direction == 0) {
if (gRoomControls.roomOriginY + 0x208 >= super->y.HALF.HI) {
if (gRoomControls.origin_y + 0x208 >= super->y.HALF.HI) {
this->unk_74 = -this->unk_74;
this->unk_76 += this->unk_74;
super->direction = this->unk_76 >> 8;
@@ -679,7 +686,7 @@ void sub_08047508(GyorgMaleEntity* this) {
}
}
sub_08047E48(this);
if (gRoomControls.roomOriginX + 0x280 < super->x.HALF.HI) {
if (gRoomControls.origin_x + 0x280 < super->x.HALF.HI) {
super->subAction = 4;
super->speed = 0x200;
super->animationState = super->direction;
@@ -706,9 +713,9 @@ void sub_080475F4(GyorgMaleEntity* this) {
}
void sub_0804763C(GyorgMaleEntity* this) {
if (gRoomControls.roomOriginX + 0x1F0 > super->x.HALF.HI) {
if (gRoomControls.origin_x + 0x1F0 > super->x.HALF.HI) {
if (super->direction == 0) {
if (gRoomControls.roomOriginY + 0x208 >= super->y.HALF.HI) {
if (gRoomControls.origin_y + 0x208 >= super->y.HALF.HI) {
this->unk_74 = -this->unk_74;
this->unk_76 += this->unk_74;
super->direction = this->unk_76 >> 8;
@@ -734,7 +741,7 @@ void sub_0804763C(GyorgMaleEntity* this) {
}
}
sub_08047E48(this);
if (gRoomControls.roomOriginX + 0x180 > super->x.HALF.HI) {
if (gRoomControls.origin_x + 0x180 > super->x.HALF.HI) {
super->subAction = 6;
super->speed = 0x200;
super->animationState = super->direction;
@@ -771,13 +778,13 @@ void sub_08047778(GyorgMaleEntity* this) {
void sub_08047798(GyorgMaleEntity* this) {
super->subAction = 1;
super->speed = 0x80;
if (super->x.HALF.HI - gRoomControls.roomOriginX < 0x1F8) {
if (super->x.HALF.HI - gRoomControls.origin_x < 0x1F8) {
this->unk_80 = 0xa8;
} else {
this->unk_80 = 0x348;
}
this->unk_80 += gRoomControls.roomOriginX;
this->unk_82 = gRoomControls.roomOriginY + 0x348;
this->unk_80 += gRoomControls.origin_x;
this->unk_82 = gRoomControls.origin_y + 0x348;
sub_08047D88(this);
}
@@ -797,7 +804,7 @@ void sub_080477F0(GyorgMaleEntity* this) {
super->direction = super->animationState;
return;
}
if (!sub_0806FCB8(super, gRoomControls.roomOriginX + 0x200, gRoomControls.roomOriginY + 0x210, 0x100)) {
if (!sub_0806FCB8(super, gRoomControls.origin_x + 0x200, gRoomControls.origin_y + 0x210, 0x100)) {
super->spriteOrientation.flipY = 3;
super->spriteRendering.b3 = 3;
}
@@ -807,7 +814,7 @@ void sub_080477F0(GyorgMaleEntity* this) {
this->unk_74 = gUnk_080D1BF0[Random() & 1];
if (((GyorgHeap*)super->myHeap)->boss->unk_6c & 1) {
((GyorgHeap*)super->myHeap)->female->unk_79 =
gRoomControls.roomOriginX + 0x200 > super->x.HALF.HI ? 0x81 : 0x83;
gRoomControls.origin_x + 0x200 > super->x.HALF.HI ? 0x81 : 0x83;
} else {
((GyorgHeap*)super->myHeap)->female->unk_79 = 0x80;
}
@@ -868,25 +875,25 @@ void sub_08047978(GyorgMaleEntity* this) {
super->subAction = 4;
if (super->type == 0) {
if ((((GyorgHeap*)super->myHeap)->female->base.animationState >> 6) == 1) {
this->unk_80 = gRoomControls.roomOriginX + 0x1C0;
this->unk_82 = gRoomControls.roomOriginY + 0x250;
this->unk_80 = gRoomControls.origin_x + 0x1C0;
this->unk_82 = gRoomControls.origin_y + 0x250;
} else {
this->unk_80 = gRoomControls.roomOriginX + 0x240;
this->unk_82 = gRoomControls.roomOriginY + 0x250;
this->unk_80 = gRoomControls.origin_x + 0x240;
this->unk_82 = gRoomControls.origin_y + 0x250;
}
} else {
if (gRoomControls.roomOriginX + 0x200 < super->x.HALF.HI) {
if (gRoomControls.origin_x + 0x200 < super->x.HALF.HI) {
this->unk_80 = 0x190;
} else {
this->unk_80 = 0x270;
}
this->unk_80 += gRoomControls.roomOriginX;
if (gRoomControls.roomOriginY + 0x210 < super->y.HALF.HI) {
this->unk_80 += gRoomControls.origin_x;
if (gRoomControls.origin_y + 0x210 < super->y.HALF.HI) {
this->unk_82 = 0x1A0;
} else {
this->unk_82 = 0x280;
}
this->unk_82 += gRoomControls.roomOriginY;
this->unk_82 += gRoomControls.origin_y;
}
}
@@ -921,7 +928,7 @@ void sub_08047BA4(GyorgMaleEntity* this) {
super->subAction = 1;
super->actionDelay = 0x78;
super->field_0xf = 0;
if (gRoomControls.roomOriginX + 0x200 < super->x.HALF.HI) {
if (gRoomControls.origin_x + 0x200 < super->x.HALF.HI) {
this->unk_76 = 0x78;
} else {
this->unk_76 = 0x88;
@@ -953,7 +960,7 @@ void sub_08047BF0(GyorgMaleEntity* this) {
super->direction = this->unk_76;
super->speed = 0x140;
sub_08047E48(this);
if (super->y.HALF.HI > gRoomControls.roomOriginY + 0x270) {
if (super->y.HALF.HI > gRoomControls.origin_y + 0x270) {
super->subAction = 2;
this->unk_7e = 0xAA;
SoundReq(SFX_12D);
@@ -1124,8 +1131,8 @@ void sub_08048004(GyorgMaleEntity* this) {
if (this->unk_7c & 1) {
u32 b = super->spriteRendering.b3;
if (b == 3) {
s32 posX = ((gPlayerEntity.x.HALF.HI - gRoomControls.roomOriginX) >> 3);
s32 posY = ((gPlayerEntity.y.HALF.HI - gRoomControls.roomOriginY) >> 3);
s32 posX = ((gPlayerEntity.x.HALF.HI - gRoomControls.origin_x) >> 3);
s32 posY = ((gPlayerEntity.y.HALF.HI - gRoomControls.origin_y) >> 3);
u16* tmp = (u16*)&gUnk_02019EE0;
if (tmp[(posY << 7) + posX]) {
if (!(this->unk_7c & 2)) {
@@ -1176,6 +1183,6 @@ const u16 gUnk_080D1C60[8] = { 0x200, 0x150, 0x290, 0x210, 0x200, 0x2D0, 0x170,
void sub_08048178(GyorgMaleEntity* this, u32 unk1) {
const u16* tmp = ((((GyorgHeap*)super->myHeap)->female->base.animationState >> 6 & 1) ? gUnk_080D1C60 + unk1
: gUnk_080D1C50 + unk1);
this->unk_80 = *tmp + gRoomControls.roomOriginX;
this->unk_82 = *(tmp + 1) + gRoomControls.roomOriginY;
this->unk_80 = *tmp + gRoomControls.origin_x;
this->unk_82 = *(tmp + 1) + gRoomControls.origin_y;
}
+7 -1
View File
@@ -1,7 +1,13 @@
/**
* @file hangingSeed.c
* @ingroup Enemies
*
* @brief Hanging Seed enemy
*/
#include "entity.h"
#include "enemy.h"
#include "functions.h"
#include "effects.h"
extern void (*const gHangingSeedFunctions[])(Entity*);
extern void (*const gUnk_080CB588[])(Entity*);
+9 -2
View File
@@ -1,3 +1,10 @@
/**
* @file helmasaur.c
* @ingroup Enemies
*
* @brief Helmasaur enemy
*/
#include "enemy.h"
#include "object.h"
#include "functions.h"
@@ -186,7 +193,7 @@ void sub_0802BE18(Entity* this) {
void sub_0802BE48(Entity* this) {
if (!sub_080AEFE0(this)) {
sub_0802C218(this);
sub_08080964(8, 0);
InitScreenShake(8, 0);
} else {
GetNextFrame(this);
sub_0802C1CC(this);
@@ -227,7 +234,7 @@ void sub_0802BEEC(Entity* this) {
this->direction = this->animationState << 3;
InitializeAnimation(this, this->animationState + 4);
}
} else if (!sub_08003FC4(this, 0x1c00)) {
} else if (!GravityUpdate(this, 0x1c00)) {
this->action = 8;
this->actionDelay = 30;
this->speed = 0x120;
+7
View File
@@ -1,3 +1,10 @@
/**
* @file keaton.c
* @ingroup Enemies
*
* @brief keaton enemy
*/
#include "enemy.h"
#include "functions.h"
+7
View File
@@ -1,3 +1,10 @@
/**
* @file keese.c
* @ingroup Enemies
*
* @brief Keese enemy
*/
#include "enemy.h"
#include "functions.h"
+8 -1
View File
@@ -1,3 +1,10 @@
/**
* @file lakitu.c
* @ingroup Enemies
*
* @brief Lakitu enemy
*/
#include "global.h"
#include "enemy.h"
#include "functions.h"
@@ -224,7 +231,7 @@ void Lakitu_LightningDelay(Entity* this) {
}
void Lakitu_Cloudless(Entity* this) {
if (sub_08003FC4(this, 0x1800) == 0 && this->animIndex <= 19) {
if (GravityUpdate(this, 0x1800) == 0 && this->animIndex <= 19) {
InitAnimationForceUpdate(this, this->animationState + 20);
this->spritePriority.b1 = 0;
+11 -3
View File
@@ -1,9 +1,17 @@
/**
* @file lakituCloud.c
* @ingroup Enemies
*
* @brief Lakitu Cloud enemy
*/
#include "global.h"
#include "asm.h"
#include "entity.h"
#include "player.h"
#include "functions.h"
#include "effects.h"
#include "enemy.h"
extern u32 GetNextFunction(Entity*);
@@ -11,7 +19,7 @@ extern void (*const gUnk_080D0418[6])(Entity*);
extern void (*const gUnk_080D0430[3])(Entity*);
extern void (*const gUnk_080D043C[3])(Entity*);
extern void sub_0800449C(Entity*, u32);
extern void SoundReqClipped(Entity*, u32);
extern void sub_0803CE14(Entity*);
extern void sub_0803CE3C(Entity*);
extern void sub_08079D84(void);
@@ -56,7 +64,7 @@ void sub_0803CD40(Entity* this) {
ModHealth(-2);
sub_0800449C(&gPlayerEntity, 122);
SoundReqClipped(&gPlayerEntity, 122);
sub_08079D84();
sub_0803CE3C(this);
@@ -85,7 +93,7 @@ void sub_0803CDA8(Entity* this) {
UpdateAnimationSingleFrame(this);
if ((this->direction & 0x80) == 0) {
sub_0806F69C(this);
LinearMoveUpdate(this);
}
if (--this->field_0x74.HWORD << 0x10 == 0) {
+7
View File
@@ -1,3 +1,10 @@
/**
* @file leever.c
* @ingroup Enemies
*
* @brief Leever enemy
*/
#include "enemy.h"
#include "functions.h"
+11 -3
View File
@@ -1,8 +1,16 @@
/**
* @file likeLike.c
* @ingroup Enemies
*
* @brief Like Like enemy
*/
#include "enemy.h"
#include "textbox.h"
#include "message.h"
#include "save.h"
#include "object.h"
#include "functions.h"
#include "item.h"
extern bool32 ItemIsShield(u32);
@@ -184,7 +192,7 @@ void sub_0802805C(Entity* this) {
sub_0802810C(this);
} else {
ResetPlayer();
gPlayerState.field_0x1a[0] |= 0x80;
gPlayerState.mobility |= 0x80;
PositionRelative(this, &gPlayerEntity, 0, 0x10000);
tmp = GetSpriteSubEntryOffsetDataPointer((u16)this->spriteIndex, this->frameIndex);
@@ -203,7 +211,7 @@ void sub_0802805C(Entity* this) {
}
NONMATCH("asm/non_matching/likeLike/sub_0802810C.inc", void sub_0802810C(Entity* this)) {
gPlayerState.jumpStatus = 0x41;
gPlayerState.jump_status = 0x41;
gPlayerState.field_0xa = 0;
gPlayerState.flags &= 0xffffffef;
gPlayerEntity.flags |= 0x80;
+7 -1
View File
@@ -1,7 +1,13 @@
/**
* @file madderpillar.c
* @ingroup Enemies
*
* @brief Madderpillar enemy
*/
#include "enemy.h"
#include "functions.h"
extern u8 gEntCount;
extern Hitbox gUnk_080FD298;
extern Hitbox gUnk_080FD2A0;
+38 -32
View File
@@ -1,3 +1,10 @@
/**
* @file mazaalBracelet.c
* @ingroup Enemies
*
* @brief Mazaal Bracelet enemy
*/
#include "enemy.h"
#include "object.h"
#include "functions.h"
@@ -20,7 +27,7 @@ void sub_0803B798(void);
void sub_0803BA8C(Entity*, u32);
void sub_0803B724(Entity*);
extern void sub_0800449C(Entity*, u32);
extern void SoundReqClipped(Entity*, u32);
void sub_0803A170(Entity*);
void sub_0803A188(Entity*);
@@ -85,7 +92,6 @@ void sub_0803B978(Entity*);
void sub_0803BA6C(Entity*);
void sub_0803BA80(Entity*);
extern u8 gEntCount;
// these are not with the rest of this files constant data
extern Hitbox gUnk_080FD35C;
extern Hitbox gUnk_080FD364;
@@ -197,7 +203,7 @@ void sub_0803A274(Entity* this) {
this->spriteSettings.flipX = 1;
PositionRelative(this->parent, this, -0x100000, 0x200000);
}
if (gScreenTransition.field_0x38 != 0) {
if (gRoomTransition.field_0x38 != 0) {
this->action = 3;
COLLISION_ON(this);
this->spriteSettings.draw = 1;
@@ -242,7 +248,7 @@ void sub_0803A364(Entity* this) {
break;
case 5:
if (sub_0803B4E4(this) == 0) {
sub_0806F69C(this);
LinearMoveUpdate(this);
return;
}
this->type2 = 0;
@@ -325,7 +331,7 @@ void sub_0803A548(Entity* this) {
index = ((this->parent->field_0xf >> 4) + 3);
this->z.HALF.HI = ptr[(index + (u32)this->type * 2) & 7] + 4;
if (sub_0803B4E4(this) == 0) {
sub_0806F69C(this);
LinearMoveUpdate(this);
}
}
@@ -339,7 +345,7 @@ void sub_0803A58C(Entity* this) {
if (sub_0803B4E4(this) != 0) {
sub_0803B59C(this);
} else {
sub_0806F69C(this);
LinearMoveUpdate(this);
}
}
@@ -408,7 +414,7 @@ void sub_0803A6E8(Entity* this) {
this->actionDelay = 10;
} else {
sub_0803B63C(this);
sub_0806F69C(this);
LinearMoveUpdate(this);
y = this->parent->y.HALF.HI + 8;
if (y > this->y.HALF.HI) {
this->y.HALF.HI = y;
@@ -434,7 +440,7 @@ void sub_0803A740(Entity* this) {
this->actionDelay = 10;
this->parent->field_0x7c.BYTES.byte1 |= 0x40;
sub_0803B8E8(this, 0x13);
sub_08080964(10, 0);
InitScreenShake(10, 0);
SoundReq(SFX_158);
}
}
@@ -468,7 +474,7 @@ void sub_0803A7CC(Entity* this) {
this->action = 0xd;
InitAnimationForceUpdate(this->child, 6);
} else {
sub_0806F69C(this);
LinearMoveUpdate(this);
}
}
@@ -527,7 +533,7 @@ void sub_0803A90C(Entity* this) {
this->z.HALF.HI = ptr[(index + (u32)this->type * 2) & 7] + 4;
GetNextFrame(this);
sub_0803B55C(this);
sub_0806F69C(this);
LinearMoveUpdate(this);
this->actionDelay--;
if (this->actionDelay == 0) {
this->action = 0x11;
@@ -550,7 +556,7 @@ void sub_0803A978(Entity* this) {
if ((++this->actionDelay & 3) == 0) {
sub_08004596(this, 0x10);
}
sub_0806F69C(this);
LinearMoveUpdate(this);
if (this->direction == 0x10) {
this->action = 0x12;
this->actionDelay = 3;
@@ -574,7 +580,7 @@ void sub_0803AA00(Entity* this) {
if ((++this->actionDelay & 3) == 0) {
sub_08004596(this, direction);
}
sub_0806F69C(this);
LinearMoveUpdate(this);
if ((this->direction == direction) || (this->y.HALF.HI >= gPlayerEntity.y.HALF.HI)) {
this->action = 0x13;
this->spriteSettings.draw = 0;
@@ -594,7 +600,7 @@ NONMATCH("asm/non_matching/mazaal/sub_0803AA98.inc", void sub_0803AA98(Entity* t
index = ((this->parent->field_0xf >> 4) + 3);
this->z.HALF.HI = ptr[(index + (u32)this->type * 2) & 7] + 4;
if (sub_0803B870(this) == 0) {
sub_0806F69C(this);
LinearMoveUpdate(this);
if (sub_0803B6F4(this) != 0) {
this->action = 0x14;
this->speed = 0x40;
@@ -616,7 +622,7 @@ void sub_0803AB10(Entity* this) {
ptr = gUnk_080CED6C;
index = ((this->parent->field_0xf >> 4) + 3);
this->z.HALF.HI = ptr[(index + (u32)this->type * 2) & 7] + 4;
sub_0806F69C(this);
LinearMoveUpdate(this);
sub_0803B55C(this);
if ((this->child->frame & 0x80) != 0) {
this->action = 0x15;
@@ -667,7 +673,7 @@ void sub_0803AC1C(Entity* this) {
if (sub_0803B4E4(this)) {
sub_0803B59C(this);
} else {
sub_0806F69C(this);
LinearMoveUpdate(this);
}
}
@@ -685,7 +691,7 @@ void sub_0803AC60(Entity* this) {
this->subAction = 0;
this->actionDelay = 0x1e;
} else {
sub_0806F69C(this);
LinearMoveUpdate(this);
}
} else {
this->actionDelay = this->actionDelay - 1;
@@ -713,7 +719,7 @@ void sub_0803ACC0(Entity* this) {
this->z.HALF.HI = 0;
this->actionDelay = 0xc;
this->subAction = 3;
sub_08080964(8, 0);
InitScreenShake(8, 0);
SoundReq(SFX_158);
sub_0803B804(this);
}
@@ -735,7 +741,7 @@ void sub_0803ACC0(Entity* this) {
this->z.HALF.HI = 0;
this->action = 0x1a;
this->actionDelay = 0x3c;
sub_08080964(0x1e, 0);
InitScreenShake(0x1e, 0);
SoundReq(SFX_158);
sub_0803B804(this);
return;
@@ -788,7 +794,7 @@ void sub_0803AE48(Entity* this) {
InitializeAnimation(this, 4);
} else {
if (sub_0803B4E4(this) == 0) {
sub_0806F69C(this);
LinearMoveUpdate(this);
}
}
}
@@ -859,7 +865,7 @@ void sub_0803AFE0(Entity* this) {
this->actionDelay = 0xf0;
*(u8*)&this->cutsceneBeh = 3;
this->z.HALF.HI = 0;
sub_08080964(0xa0, 0);
InitScreenShake(0xa0, 0);
SoundReq(SFX_158);
}
}
@@ -927,11 +933,11 @@ void sub_0803B100(Entity* this) {
void sub_0803B144(Entity* this) {
UpdateAnimationSingleFrame(this->child);
if (sub_08003FC4(this, 0x2000) == 0) {
if (GravityUpdate(this, 0x2000) == 0) {
this->action = 0x2a;
InitializeAnimation(this, 0x16);
sub_0803B8E8(this, 0x14);
sub_08080964(8, 0);
InitScreenShake(8, 0);
}
}
@@ -1049,7 +1055,7 @@ void sub_0803B398(Entity* this) {
InitializeAnimation(this, 4);
InitAnimationForceUpdate(this->child, 0);
} else {
sub_0806F69C(this);
LinearMoveUpdate(this);
}
}
@@ -1211,19 +1217,19 @@ void sub_0803B724(Entity* param_1) {
pEVar1->type2 = 1;
random_value = Random();
temp = gUnk_080CFD1B[param_1->type];
pEVar1->x.HALF.HI = (random_value & 0x70) + temp + gRoomControls.roomOriginX;
pEVar1->y.HALF.HI = ((random_value >> 0x10) & 7) * 10 + 0x5c + gRoomControls.roomOriginY;
pEVar1->x.HALF.HI = (random_value & 0x70) + temp + gRoomControls.origin_x;
pEVar1->y.HALF.HI = ((random_value >> 0x10) & 7) * 10 + 0x5c + gRoomControls.origin_y;
pEVar1->parent = param_1;
sub_08016A30(pEVar1);
ResolveCollisionLayer(pEVar1);
param_1->field_0xf++;
param_1->cutsceneBeh.HALF.LO--;
}
}
void sub_0803B798(void) {
gPlayerState.jumpStatus = 0x41;
gPlayerState.jump_status = 0x41;
gPlayerState.field_0xa = 0;
gPlayerState.flags &= 0xffef;
gPlayerState.flags &= ~(0xffff0000 | PL_CAPTURED);
gPlayerEntity.flags |= 0x80;
gPlayerEntity.zVelocity = 0x18000;
gPlayerEntity.z.HALF.HI = -10;
@@ -1238,12 +1244,12 @@ void sub_0803B798(void) {
void sub_0803B804(Entity* this) {
gPlayerEntity.iframes = 30;
ModHealth(-4);
sub_0800449C(&gPlayerEntity, 0x7a);
SoundReqClipped(&gPlayerEntity, 0x7a);
}
void sub_0803B824(Entity* this) {
ResetPlayer();
gPlayerState.field_0x1a[0] = gPlayerState.field_0x1a[0] | 0x80;
gPlayerState.mobility = gPlayerState.mobility | 0x80;
sub_0806FA90(this, &gPlayerEntity, gUnk_080CFD1D[this->type], 1);
gPlayerEntity.spriteOffsetY = -6;
gPlayerEntity.spritePriority.b1 = 0;
@@ -1253,7 +1259,7 @@ u32 sub_0803B870(Entity* this) {
Entity* entity;
entity = this->child;
if ((entity->bitfield & 0x80) != 0 && (gPlayerState.flags & 0x10) != 0) {
if ((entity->bitfield & 0x80) != 0 && (gPlayerState.flags & PL_CAPTURED)) {
this->action = 0x18;
this->actionDelay = 0x44;
this->spriteSettings.draw = 0;
@@ -1283,7 +1289,7 @@ void sub_0803B8F8(Entity* this) {
}
void sub_0803B910(Entity* this) {
if (gScreenTransition.field_0x38 != 0) {
if (gRoomTransition.field_0x38 != 0) {
this->action = 2;
this->spriteSettings.draw = 1;
*(u8*)&this->field_0x74 = 0;
+7 -1
View File
@@ -1,4 +1,10 @@
#include "global.h"
/**
* @file mazaalHand.c
* @ingroup Enemies
*
* @brief Mazaal Hand enemy
*/
#include "entity.h"
void sub_08035194(Entity*);
+25 -20
View File
@@ -1,3 +1,10 @@
/**
* @file mazaalHead.c
* @ingroup Enemies
*
* @brief Mazaal Head enemy
*/
#include "enemy.h"
#include "object.h"
#include "functions.h"
@@ -5,8 +12,6 @@
extern void UnloadOBJPalette(Entity*);
extern u8 gEntCount;
void sub_0803499C(Entity*);
void sub_08034420(Entity*);
void sub_08034830(Entity*);
@@ -121,7 +126,7 @@ void sub_08033F3C(Entity* this) {
Entity* pEVar2;
if (gEntCount < 0x43) {
if (gScreenTransition.field_0x38 != 0) {
if (gRoomTransition.field_0x38 != 0) {
sub_08034420(this);
this->field_0x80.HALF.HI = 1;
} else {
@@ -135,7 +140,7 @@ void sub_08033F3C(Entity* this) {
pEVar1->parent = this;
pEVar2 = CreateObject(OBJECT_7E, 0, 0);
pEVar2->parent = this;
if (gScreenTransition.field_0x39 == 0) {
if (gRoomTransition.field_0x39 == 0) {
this->action = 0xd;
this->subAction = 0;
this->actionDelay = 0xfc;
@@ -217,10 +222,10 @@ void sub_08033FFC(Entity* this) {
break;
default:
if (((*(Entity**)&this->field_0x74)->flags & 0x80) != 0) {
gRoomControls.cameraTarget = &gPlayerEntity;
gRoomControls.camera_target = &gPlayerEntity;
sub_08034420(this);
gPlayerState.controlMode = 1;
sub_080791D0();
ResetPlayerAnimationAndAction();
SoundReq(BGM_BOSS_THEME);
}
}
@@ -229,8 +234,8 @@ void sub_08033FFC(Entity* this) {
void sub_0803414C(Entity* this) {
u32 x, y;
x = gRoomControls.roomOriginX + 0xb8;
y = gRoomControls.roomOriginY + 0x48;
x = gRoomControls.origin_x + 0xb8;
y = gRoomControls.origin_y + 0x48;
if (this->x.HALF.HI - x + 1 < 3 && this->y.HALF.HI - y + 1 < 3) {
if (sub_080349D8(this)) {
@@ -243,7 +248,7 @@ void sub_0803414C(Entity* this) {
}
} else {
this->direction = sub_080045D4(this->x.HALF.HI, this->y.HALF.HI, x, y);
sub_0806F69C(this);
LinearMoveUpdate(this);
}
}
@@ -315,12 +320,12 @@ void sub_080342C8(Entity* this) {
this->spriteOffsetX = gUnk_080CECEC[this->actionDelay >> 1 & 7];
} else {
this->spriteOffsetX = 0;
if (sub_08003FC4(this, 0x2000) == 0) {
if (GravityUpdate(this, 0x2000) == 0) {
this->action = 0xc;
this->field_0x7c.HALF.HI = 0x708;
this->field_0x7c.BYTES.byte1 = 0;
this->field_0x80.HALF.HI = 0;
sub_08080964(0x1e, 0);
InitScreenShake(0x1e, 0);
SoundReq(SFX_1A1);
}
}
@@ -379,10 +384,10 @@ void sub_0803442C(Entity* this, u32 unk) {
void sub_0803443C(Entity* this) {
this->field_0x7c.BYTES.byte1 = 0;
if (gScreenTransition.field_0x39 < 0x1f) {
if (gRoomTransition.field_0x39 < 0x1f) {
sub_080344BC(this);
} else {
if (gScreenTransition.field_0x39 < 0x3d) {
if (gRoomTransition.field_0x39 < 0x3d) {
sub_08034498(this);
} else {
sub_08034474(this);
@@ -546,7 +551,7 @@ NONMATCH("asm/non_matching/mazaal/sub_0803473C.inc", void sub_0803473C(Entity* t
}
playerX = gPlayerEntity.x.HALF.HI + 0x60;
}
roomX = gRoomControls.roomOriginX;
roomX = gRoomControls.origin_x;
if (playerX - 4 > this->x.HALF.HI) {
if (roomX + 0xe0 < this->x.HALF.HI) {
return;
@@ -562,14 +567,14 @@ NONMATCH("asm/non_matching/mazaal/sub_0803473C.inc", void sub_0803473C(Entity* t
direction = 0x18;
}
this->direction = direction;
sub_0806F69C(this);
LinearMoveUpdate(this);
}
END_NONMATCH
NONMATCH("asm/non_matching/mazaal/sub_080347B4.inc", void sub_080347B4(Entity* this)) {
u32 direction;
u32 playerX = gPlayerEntity.x.HALF.HI;
u32 roomX = gRoomControls.roomOriginX;
u32 roomX = gRoomControls.origin_x;
if (playerX - 4 > this->x.HALF.HI) {
if (roomX + 0xe0 < this->x.HALF.HI) {
return;
@@ -585,7 +590,7 @@ NONMATCH("asm/non_matching/mazaal/sub_080347B4.inc", void sub_080347B4(Entity* t
direction = 0x18;
}
this->direction = direction;
sub_0806F69C(this);
LinearMoveUpdate(this);
}
END_NONMATCH
@@ -812,9 +817,9 @@ void sub_08034BC8(Entity* this) {
void sub_08034C00(Entity* this) {
if (((gPlayerState.flags & PL_MINISH) != 0) &&
CheckPlayerInRegion(this->x.HALF.HI - gRoomControls.roomOriginX,
this->y.HALF.HI - gRoomControls.roomOriginY + 0xd, 3, 3) != 0) {
if (gScreenTransition.field_0x39 >= 0x3d) {
CheckPlayerInRegion(this->x.HALF.HI - gRoomControls.origin_x, this->y.HALF.HI - gRoomControls.origin_y + 0xd, 3,
3) != 0) {
if (gRoomTransition.field_0x39 >= 0x3d) {
DoExitTransition((ScreenTransitionData*)&gUnk_080CED88);
} else {
DoExitTransition((ScreenTransitionData*)&gUnk_080CED9C);
+24 -17
View File
@@ -1,3 +1,10 @@
/**
* @file mazaalMacro.c
* @ingroup Enemies
*
* @brief Mazaal Macro enemy
*/
#include "enemy.h"
#include "script.h"
#include "structures.h"
@@ -94,8 +101,8 @@ void sub_08034D4C(Entity* this) {
if (--this->field_0x78.HWORD == 0) {
if ((this->field_0xf < 8) && (entity = CreateEnemy(VAATI_PROJECTILE, 0), entity != (Entity*)0x0)) {
entity->direction = (s32)Random() % 5 + 0xc;
entity->x.HALF.HI = (gRoomControls.width / 2) + gRoomControls.roomOriginX;
entity->y.HALF.HI = gRoomControls.roomOriginY + 8;
entity->x.HALF.HI = (gRoomControls.width / 2) + gRoomControls.origin_x;
entity->y.HALF.HI = gRoomControls.origin_y + 8;
entity->collisionLayer = 3;
entity->parent = this;
UpdateSpriteForCollisionLayer(entity);
@@ -108,7 +115,7 @@ void sub_08034D4C(Entity* this) {
}
void sub_08034DC8(Entity* this) {
if (gScreenTransition.field_0x39 == 0) {
if (gRoomTransition.field_0x39 == 0) {
CreateFx(this, FX_GIANT_EXPLOSION4, 0);
sub_0807BA8C(COORD_TO_TILE(this), this->collisionLayer);
DeleteThisEntity();
@@ -136,7 +143,7 @@ void sub_08034E68(Entity* this) {
this->spriteSettings.draw = 0;
sub_08035120(this);
}
if (gScreenTransition.field_0x39 == 0) {
if (gRoomTransition.field_0x39 == 0) {
if (sub_08079F8C() != 0) {
this->action = 3;
scriptExecutionContext = StartCutscene(this, (u16*)script_MazaalMacroDefeated);
@@ -167,8 +174,8 @@ void sub_08034EE4(Entity* this) {
randomValue = Random();
entity = CreateFx(this, gUnk_080CEEC8[randomValue & 3], 0);
if (entity != NULL) {
entity->x.HALF.HI = (((randomValue >> 2) & 0x77) << 1) + 1 + gRoomControls.roomScrollX;
entity->y.HALF.HI = ((randomValue >> 9) & 0x7e) + 1 + gRoomControls.roomScrollY;
entity->x.HALF.HI = (((randomValue >> 2) & 0x77) << 1) + 1 + gRoomControls.scroll_x;
entity->y.HALF.HI = ((randomValue >> 9) & 0x7e) + 1 + gRoomControls.scroll_y;
entity->collisionLayer = 2;
UpdateSpriteForCollisionLayer(entity);
}
@@ -182,10 +189,10 @@ void sub_08034F58(Entity* this) {
}
void sub_08034F70(Entity* this) {
this->health = gScreenTransition.field_0x39;
if (gScreenTransition.field_0x39 >= 0x3d) {
this->health = gRoomTransition.field_0x39;
if (gRoomTransition.field_0x39 >= 0x3d) {
this->type2 = 0;
} else if (gScreenTransition.field_0x39 >= 0x1f) {
} else if (gRoomTransition.field_0x39 >= 0x1f) {
this->type2 = 1;
} else {
this->type2 = 2;
@@ -195,19 +202,19 @@ void sub_08034F70(Entity* this) {
void sub_08034FA0(Entity* this) {
if (0 < this->iframes) {
this->child->iframes = this->iframes;
sub_08080964(0xc, 1);
InitScreenShake(0xc, 1);
}
switch (this->type2) {
case 0:
if (this->health < 0x3c) {
gScreenTransition.field_0x39 = 0x3c;
gRoomTransition.field_0x39 = 0x3c;
sub_08035050(this);
return;
}
break;
case 1:
if (this->health < 0x1e) {
gScreenTransition.field_0x39 = 0x1e;
gRoomTransition.field_0x39 = 0x1e;
sub_08035050(this);
return;
}
@@ -218,7 +225,7 @@ void sub_08034FA0(Entity* this) {
}
break;
}
gScreenTransition.field_0x39 = this->health;
gRoomTransition.field_0x39 = this->health;
}
void sub_08035050(Entity* this) {
@@ -247,16 +254,16 @@ u32 sub_08035084(Entity* this) {
}
do {
vulnPillar = (s32)Random() % 6;
} while (vulnPillar == gScreenTransition.field_0x38 >> 4);
gScreenTransition.field_0x38 = (gScreenTransition.field_0x38 & 0xf) | (vulnPillar << 4);
} while (vulnPillar == gRoomTransition.field_0x38 >> 4);
gRoomTransition.field_0x38 = (gRoomTransition.field_0x38 & 0xf) | (vulnPillar << 4);
for (i = 0, coords = gUnk_080CEECC; i < 6; i++, coords += 2) {
if (i == vulnPillar) {
entity = this;
} else {
entity = CreateEnemy(MAZAAL_MACRO, 1);
}
entity->x.HALF.HI = gRoomControls.roomOriginX + *coords;
entity->y.HALF.HI = gRoomControls.roomOriginY + *(coords + 1);
entity->x.HALF.HI = gRoomControls.origin_x + *coords;
entity->y.HALF.HI = gRoomControls.origin_y + *(coords + 1);
entity->collisionLayer = 1;
UpdateSpriteForCollisionLayer(entity);
}
+8 -1
View File
@@ -1,3 +1,10 @@
/**
* @file miniFireballGuy.c
* @ingroup Enemies
*
* @brief Mini Fireball Guy enemy
*/
#include "enemy.h"
#include "functions.h"
@@ -43,7 +50,7 @@ void sub_08045618(Entity* this) {
void sub_08045654(Entity* this) {
sub_080AEFE0(this);
GetNextFrame(this);
if (sub_08003FC4(this, 0x1800) == 0) {
if (GravityUpdate(this, 0x1800) == 0) {
sub_08045678(this);
}
}
+8 -1
View File
@@ -1,9 +1,16 @@
/**
* @file miniSlime.c
* @ingroup Enemies
*
* @brief Mini Slime enemy
*/
#include "enemy.h"
#include "functions.h"
void sub_08045374(Entity*);
extern void sub_080452E4();
extern void sub_080452E4(Entity*);
extern void ReplaceMonitoredEntity(Entity*, Entity*);
extern void (*const gUnk_080D17C0[])(Entity*);
+7 -1
View File
@@ -1,3 +1,10 @@
/**
* @file moldorm.c
* @ingroup Enemies
*
* @brief Moldorm enemy
*/
#include "enemy.h"
#include "functions.h"
@@ -9,7 +16,6 @@ extern void (*const gUnk_080CBBA0[])(Entity*);
extern void (*const gUnk_080CBBB4[])(Entity*);
extern void (*const gUnk_080CBBBC[])(Entity*);
extern u8 gEntCount;
extern const s8 gUnk_080CBBC4[];
void Moldorm(Entity* this) {
+13 -7
View File
@@ -1,7 +1,14 @@
/**
* @file moldworm.c
* @ingroup Enemies
*
* @brief Moldworm enemy
*/
#include "enemy.h"
#include "functions.h"
extern void sub_0800449C(Entity*, u32);
extern void SoundReqClipped(Entity*, u32);
extern bool32 sub_08023A38(u32);
extern void sub_08023990(Entity*, u32, u32);
extern void sub_08023A88(Entity*, u32);
@@ -14,7 +21,6 @@ void sub_0802390C(Entity*);
void sub_080239F0(Entity*);
bool32 sub_08023B38(Entity*);
extern u8 gEntCount;
extern const u8 gUnk_080B37A0[];
extern void (*const gUnk_080CBC38[])(Entity*);
@@ -84,7 +90,7 @@ void sub_080230E4(Entity* this) {
gPlayerEntity.zVelocity = 0x18000;
gPlayerEntity.direction = 0xff;
gPlayerEntity.iframes = -0x14;
gPlayerState.jumpStatus = 0x41;
gPlayerState.jump_status = 0x41;
gPlayerState.flags &= 0xfff7ffff;
}
@@ -218,7 +224,7 @@ void sub_08023398(Entity* this) {
this->field_0x7c.BYTES.byte0--;
}
if ((gScreenTransition.frameCount & 7) == 0) {
if ((gRoomTransition.frameCount & 7) == 0) {
u32 uVar4;
sub_08004596(this, sub_08049F84(this, 1));
@@ -263,7 +269,7 @@ void sub_0802351C(Entity* this) {
if (this->field_0x7c.BYTES.byte3 == 0) {
if (this->type2 == 0) {
gPlayerEntity.animationState = this->animationState & 7;
gPlayerState.flags |= 0x80000;
gPlayerState.flags |= PL_MOLDWORM_CAPTURED;
PositionRelative(this, &gPlayerEntity, 0, gUnk_080CBC90[this->animationState & 7] << 0x10);
gPlayerEntity.spriteOffsetY = -gUnk_080CBC90[this->animationState & 7];
}
@@ -398,14 +404,14 @@ void sub_08023894(Entity* this) {
this->parent->field_0x7c.BYTES.byte3 = 1;
InitializeAnimation(this, this->animationState);
if (this->parent->type2 == 0) {
gPlayerState.flags |= 0x200000;
gPlayerState.flags |= PL_MOLDWORM_RELEASED;
gPlayerEntity.x.HALF.HI = this->x.HALF.HI;
gPlayerEntity.y.HALF.HI = this->y.HALF.HI;
gPlayerEntity.direction = DirectionRoundUp(GetFacingDirection(*(Entity**)&this->field_0x74, this));
gPlayerEntity.animationState = gPlayerEntity.direction >> 2;
gPlayerEntity.iframes = 12;
ModHealth(-0x10);
sub_0800449C(&gPlayerEntity, 0x7a);
SoundReqClipped(&gPlayerEntity, 0x7a);
}
}
}
+10 -3
View File
@@ -1,11 +1,18 @@
/**
* @file octorok.c
* @ingroup Enemies
*
* @brief Octorok enemy
*/
#include "enemy.h"
#include "functions.h"
extern Entity* sub_08049DF4(u32);
void Octorok_Pause();
bool32 Octorok_FacesPlayer();
void Octorok_Turn();
void Octorok_Pause(Entity*);
bool32 Octorok_FacesPlayer(Entity*);
void Octorok_Turn(Entity*);
extern void (*const gOctorok[6])(Entity*);
extern void (*const gOctorokActions[4])(Entity*);
+47 -41
View File
@@ -1,9 +1,15 @@
/**
* @file octorokBoss.c
* @ingroup Enemies
*
* @brief Octorok boss enemy
*/
#include "enemy.h"
#include "functions.h"
#include "object.h"
#include "projectile.h"
#include "structures.h"
#include "overworld.h"
#include "game.h"
extern void sub_08078AC0(u32, u32, u32);
extern u32 GetRandomByWeight(const u8*);
@@ -36,25 +42,25 @@ this->field_0x7c.BYTES.byte0 Boss Phase
3: frozen 2
4: unfrozen -> death
*/
#define IS_FROZEN(this) (this->field_0x7c.BYTES.byte0 & 1)
#define GET_BOSS_PHASE(this) (this->field_0x7c.BYTES.byte0)
#define IS_FROZEN(this) ((this)->field_0x7c.BYTES.byte0 & 1)
#define GET_BOSS_PHASE(this) ((this)->field_0x7c.BYTES.byte0)
/*
this->field_0x78.HALF.HI reused timer
*/
#define GET_TIMER(this) this->field_0x78.HALF.HI
#define GET_TIMER(this) ((this)->field_0x78.HALF.HI)
/*
this->field_0x78.HALF.LO turns until the next attack
*/
#define GET_ATTACK_WAIT_TURNS(this) this->field_0x78.HALF.LO
#define GET_ATTACK_WAIT_TURNS(this) ((this)->field_0x78.HALF.LO)
/*
this->field_0x7a.HALF.HI angle of legs
*/
#define GET_ANGLE(this) this->field_0x7a.HWORD
#define GET_ANGLE_HI(this) this->field_0x7a.HALF.HI
#define GET_ANGLE(this) ((this)->field_0x7a.HWORD)
#define GET_ANGLE_HI(this) ((this)->field_0x7a.HALF.HI)
/*
this->field_0x82.HWORD angular speed
*/
#define GET_ANGULAR_VEL(this) this->field_0x82.HWORD
#define GET_ANGULAR_VEL(this) ((this)->field_0x82.HWORD)
enum OctorokBossPart { WHOLE, LEG_BR, LEG_FR, LEG_FL, LEG_BL, MOUTH, TAIL_END, TAIL };
enum OctorokBossAction {
@@ -168,7 +174,7 @@ Hit SubActions
void OctorokBoss_Hit(Entity* this) {
if (GET_BOSS_PHASE(this) == 0) {
if (this->subAction != 3) {
gRoomControls.cameraTarget = GET_HELPER(this)->tailObjects[0];
gRoomControls.camera_target = GET_HELPER(this)->tailObjects[0];
GET_HELPER(this)->field_0x7 = 0x5a;
sub_08078B48();
}
@@ -220,17 +226,17 @@ void OctorokBoss_Hit_SubAction1(Entity* this) {
GET_HELPER(this)->tailObjects[0]->field_0x7c.BYTES.byte1--;
}
// Move to the center of the screen before freezing
diffX = 0x108 + gRoomControls.roomOriginX - this->x.HALF.HI + 0x4;
diffY = gRoomControls.roomOriginY - this->y.HALF.HI + 0x8c;
diffX = 0x108 + gRoomControls.origin_x - this->x.HALF.HI + 0x4;
diffY = gRoomControls.origin_y - this->y.HALF.HI + 0x8c;
if (diffX > 8 || diffY > 8) {
GET_HELPER(this)->field_0x2 = 1;
#if defined(JP) || defined(DEMO_JP) || defined(EU)
this->direction = ((s32)sub_080045DA((((gRoomControls.roomOriginX + 0x108) << 0x10) - this->x.WORD),
(((gRoomControls.roomOriginY + 0x88) << 0x10) - this->y.WORD))) >>
this->direction = ((s32)sub_080045DA((((gRoomControls.origin_x + 0x108) << 0x10) - this->x.WORD),
(((gRoomControls.origin_y + 0x88) << 0x10) - this->y.WORD))) >>
3;
#else
this->direction = ((s32)sub_080045DA(gRoomControls.roomOriginX + 0x108 - this->x.HALF.HI,
gRoomControls.roomOriginY + 0x88 - this->y.HALF.HI)) >>
this->direction = ((s32)sub_080045DA(gRoomControls.origin_x + 0x108 - this->x.HALF.HI,
gRoomControls.origin_y + 0x88 - this->y.HALF.HI)) >>
3;
#endif
this->speed = 0x100;
@@ -254,7 +260,7 @@ void OctorokBoss_Hit_SubAction1(Entity* this) {
Entity* tail = GET_HELPER(this)->tailObjects[i - 1];
tail->spriteSettings.draw |= 1;
}
if ((gScreenTransition.frameCount & 2) != 0) {
if ((gRoomTransition.frameCount & 2) != 0) {
CreateObjectWithParent(this, OCTOROK_BOSS_OBJECT, 6, 0);
}
GET_TIMER(this)--;
@@ -286,7 +292,7 @@ void OctorokBoss_Hit_SubAction2(Entity* this) {
} else {
this->subAction = 3;
GET_TIMER(this) = 0x96;
gRoomControls.cameraTarget = &gPlayerEntity;
gRoomControls.camera_target = &gPlayerEntity;
}
}
@@ -306,7 +312,7 @@ void OctorokBoss_Hit_SubAction4(Entity* this) {
this->subAction = 5;
object = CreateObjectWithParent(this, OCTOROK_BOSS_OBJECT, 9, 0);
if (object != NULL) {
gRoomControls.cameraTarget = object;
gRoomControls.camera_target = object;
}
}
@@ -341,11 +347,11 @@ void OctorokBoss_Hit_SubAction6(Entity* this) {
tmp = FixedDiv(tmp, 0x100);
this->spriteOffsetY = -((tmp << 0x10) >> 8) >> 0x10;
if (GET_TIMER(this) == 0) {
if ((gScreenTransition.frameCount & 0xfU) == 0) {
if ((gRoomTransition.frameCount & 0xfU) == 0) {
// Explosion in the center
CreateFx(this, 0x48, 0);
CreateFx(this, FX_GIANT_EXPLOSION3, 0);
// Explosion at the front right leg
CreateFx(GET_HELPER(this)->legObjects[0], 0x48, 0);
CreateFx(GET_HELPER(this)->legObjects[0], FX_GIANT_EXPLOSION3, 0);
}
if (++this->field_0x82.HALF.LO == 0x79) {
GET_HELPER(this)->mouthObject->health = 1;
@@ -449,7 +455,7 @@ ASM_FUNC("asm/non_matching/octorokBoss/OctorokBoss_Init.inc", void OctorokBoss_I
gPlayerEntity.spriteSettings.draw = 0;
gPlayerEntity.x.HALF.HI = this->x.HALF.HI;
gPlayerEntity.y.HALF.HI = this->y.HALF.HI - 0xa0;
gRoomControls.cameraTarget = this;
gRoomControls.camera_target = this;
break;
case LEG_BR:
@@ -534,7 +540,7 @@ void OctorokBoss_Intro_SubAction2(Entity* this) {
this->subAction = 3;
GET_TIMER(this) = 0x3c;
gPlayerEntity.spriteSettings.draw |= 1;
gRoomControls.cameraTarget = &gPlayerEntity;
gRoomControls.camera_target = &gPlayerEntity;
gRoomControls.unk5 = 1;
}
}
@@ -715,7 +721,7 @@ void OctorokBoss_Action1(Entity* this) {
sub_08036F60(this);
if (GET_HELPER(this)->fallingStonesTimer != 0) {
GET_HELPER(this)->fallingStonesTimer--;
if ((gScreenTransition.frameCount & 3) == 0) {
if ((gRoomTransition.frameCount & 3) == 0) {
// Falling stones
CreateProjectileWithParent(this, OCTOROK_BOSS_PROJECTILE, 3);
}
@@ -811,7 +817,7 @@ void OctorokBoss_Action1_ChargeAttack(Entity* this) {
this->knockbackDirection = this->direction ^ 0x10;
GET_HELPER(this)->fallingStonesTimer += 0x3c;
OctorokBoss_SetAttackTimer(this);
sub_08080964(0x3c, 0);
InitScreenShake(0x3c, 0);
SoundReq(SFX_158);
SoundReq(SFX_14C);
}
@@ -893,7 +899,7 @@ void OctorokBoss_Action1_Attack_Type2_2(Entity* this) {
}
void OctorokBoss_Action1_Attack_Type2_3(Entity* this) {
if ((gScreenTransition.frameCount & 2) != 0) {
if ((gRoomTransition.frameCount & 2) != 0) {
GET_HELPER(this)->mouthObject->field_0x76.HWORD -= 8;
} else {
GET_HELPER(this)->mouthObject->field_0x76.HWORD += 8;
@@ -932,25 +938,25 @@ void OctorokBoss_ExecuteAttackVacuum(Entity* this) {
}
if (tmp < 0x10) {
if (sub_0806FC80(this, &gPlayerEntity, 0xf0) != 0) {
if ((gPlayerState.flags & 0x800) == 0) {
if ((gPlayerEntity.flags & 0x80) != 0) {
if ((gPlayerState.flags & PL_FROZEN) == 0) {
if ((gPlayerEntity.flags & PL_MINISH) != 0) {
sub_0806F62C(&gPlayerEntity, 0x280, -GET_ANGLE_HI(this));
if (sub_0806FC80(this, &gPlayerEntity, 0x48) != 0) {
this->field_0x80.HALF.LO = 1;
GET_TIMER(this) = 2;
GET_HELPER(this)->targetAngle =
sub_080045DA((gRoomControls.roomOriginX + 0x108) * 0x10000 - this->x.WORD,
(gRoomControls.roomOriginY + 0x88) * 0x10000 - this->y.WORD);
sub_080045DA((gRoomControls.origin_x + 0x108) * 0x10000 - this->x.WORD,
(gRoomControls.origin_y + 0x88) * 0x10000 - this->y.WORD);
GET_HELPER(this)->targetAngle = (u8) - (GET_HELPER(this)->targetAngle + 0x80);
SoundReq(SFX_ED);
}
}
} else {
gPlayerState.flags &= 0xfffff7ff;
gPlayerState.flags &= ~PL_FROZEN;
}
}
}
if ((gScreenTransition.frameCount & 3) == 0) {
if ((gRoomTransition.frameCount & 3) == 0) {
CreateObjectWithParent(this, OCTOROK_BOSS_OBJECT, 2, 0);
}
} else {
@@ -982,7 +988,7 @@ void OctorokBoss_ExecuteAttackVacuum(Entity* this) {
OctorokBoss_SetAttackTimer(this);
} else {
GET_TIMER(this)--;
if ((gPlayerState.flags == 0x800) && (GET_TIMER(this) == 0x3c)) {
if ((gPlayerState.flags == PL_FROZEN) && (GET_TIMER(this) == 0x3c)) {
tmp = sub_080045DA(gPlayerEntity.x.WORD - this->x.WORD, gPlayerEntity.y.WORD - this->y.WORD);
if ((u8)((tmp - ((u8)-GET_ANGLE_HI(this) ^ 0x80))) > 0x80) {
GET_HELPER(this)->targetAngle = GET_ANGLE_HI(this) + 0x30;
@@ -1013,8 +1019,8 @@ void OctorokBoss_ExecuteAttackSmoke(Entity* this) {
} else {
GET_TIMER(this)++;
ChangeLightLevel(-1);
if ((gScreenTransition.frameCount & 3) == 0) {
if ((gScreenTransition.frameCount & 7) == 0) {
if ((gRoomTransition.frameCount & 3) == 0) {
if ((gRoomTransition.frameCount & 7) == 0) {
SoundReq(SFX_124);
}
CreateObjectWithParent(this, OCTOROK_BOSS_OBJECT, 3, 0);
@@ -1028,7 +1034,7 @@ void OctorokBoss_ExecuteAttackFreeze(Entity* this) {
OctorokBoss_SetAttackTimer(this);
} else {
GET_TIMER(this)--;
if ((gScreenTransition.frameCount & 3) == 0) {
if ((gRoomTransition.frameCount & 3) == 0) {
this->child = CreateProjectileWithParent(this, OCTOROK_BOSS_PROJECTILE, 2);
if (this->child != NULL) {
this->child->parent = this;
@@ -1042,7 +1048,7 @@ void OctorokBoss_Burning(Entity* this) {
OctorokBoss_Burning_SubActions[this->subAction](this);
if (GET_HELPER(this)->fallingStonesTimer != 0) {
GET_HELPER(this)->fallingStonesTimer--;
if ((gScreenTransition.frameCount & 7) == 0) {
if ((gRoomTransition.frameCount & 7) == 0) {
// Falling stones
CreateProjectileWithParent(this, OCTOROK_BOSS_PROJECTILE, 3);
}
@@ -1077,14 +1083,14 @@ void OctorokBoss_Burning_SubAction1(Entity* this) {
this->field_0x46 = 0x200;
this->knockbackDirection = this->direction ^ 0x10;
GET_HELPER(this)->fallingStonesTimer += 0x1e;
sub_08080964(0x1e, 0);
InitScreenShake(0x1e, 0);
SoundReq(SFX_158);
SoundReq(SFX_14C);
}
if (GET_TIMER(this)-- == 0) {
this->health = 0;
}
if ((gScreenTransition.frameCount & 0x1f) == 0) {
if ((gRoomTransition.frameCount & 0x1f) == 0) {
SoundReq(SFX_159);
}
}
@@ -1411,7 +1417,7 @@ void sub_08036F60(Entity* this) {
}
void OctorokBoss_StepSound(Entity* this, u32 frameMask) {
if ((gScreenTransition.frameCount & frameMask) == 0) {
if ((gRoomTransition.frameCount & frameMask) == 0) {
if (IS_FROZEN(this) == FALSE) {
SoundReq(SFX_163);
} else {
+146
View File
@@ -0,0 +1,146 @@
#include "entity.h"
#include "enemy.h"
#include "functions.h"
extern void (*const gUnk_080012C8[])(Entity*);
extern void (*const gUnk_080CF46C[])(Entity*);
extern void (*const gUnk_080CF484[])(Entity*);
extern s8 gUnk_080CF490[];
extern u8 gUnk_080CF498[];
extern u16* GetLayerByIndex(u32);
extern s32 sub_080012DC(Entity*);
extern bool32 sub_080AE4CC(Entity*, u32, u32, u32);
extern u32 sub_0804A044(Entity*, Entity*, u32);
void sub_08037E14(Entity* this);
bool32 sub_08037E90(Entity* this);
void OctorokGolden(Entity* this) {
u32 index;
if (sub_080012DC(this)) {
//! @bug index (r4) is uninitialized
gUnk_080012C8[index](this);
} else {
gUnk_080CF46C[GetNextFunction(this)](this);
SetChildOffset(this, 0, 1, -0x10);
}
}
void sub_08037C84(Entity* this) {
gUnk_080CF484[this->action](this);
}
void sub_08037C9C(Entity* this) {
if (this->field_0x43 != 0) {
sub_0804A9FC(this, 0x1c);
}
sub_0804AA30(this, gUnk_080CF46C);
}
void sub_08037CC0(Entity* this) {
if ((this->field_0x3a & 0x2) == 0) {
SetGlobalFlag(this->type2);
}
CreateDeathFx(this, 0xff, 0x58);
}
void sub_08037CE4(Entity* this) {
if (CheckGlobalFlag(this->type2)) {
DeleteThisEntity();
}
sub_0804A720(this);
this->action = 1;
this->animationState = 0xff;
sub_08037E14(this);
}
void sub_08037D0C(Entity* this) {
if (this->field_0xf) {
this->field_0xf--;
} else if (sub_08037E90(this)) {
return;
}
UpdateAnimationVariableFrames(this, 2);
if (ProcessMovement(this) == 0) {
sub_08037E14(this);
} else if (--this->actionDelay == 0) {
sub_08037E14(this);
}
}
void sub_08037D54(Entity* this) {
UpdateAnimationVariableFrames(this, 2);
if (this->frame & 0x1) {
this->frame ^= 2;
if (this->frame & 0x2) {
Entity* proj = CreateProjectileWithParent(this, 1, 0);
if (proj) {
s8* ptr;
s32 dir;
proj->direction = this->direction;
ptr = gUnk_080CF490 + (this->direction >> 2);
proj->x.HALF.HI += *ptr;
proj->y.HALF.HI += *(ptr + 1);
proj->z.HALF.HI = 0xfffd;
EnqueueSFX(SFX_124);
}
}
} else if (this->frame & 0x80) {
if (--this->actionDelay == 0) {
this->action = 1;
this->field_0xf = 0x3c;
this->animationState |= 0xff;
sub_08037E14(this);
} else {
u32 dir = GetFacingDirection(this, &gPlayerEntity);
this->direction = (dir + 4) & 0x18;
this->animationState = this->direction >> 3;
InitializeAnimation(this, this->animationState + 4);
}
}
}
void sub_08037E14(Entity* this) {
u32 dir;
u16* pLayer;
s8* ptr;
s32 x, y;
this->actionDelay = 0x8;
dir = (GetFacingDirection(this, &gPlayerEntity) + 4) & 0x18;
pLayer = GetLayerByIndex(this->collisionLayer) + 0x1002;
ptr = gUnk_080CF498 + (dir >> 2);
x = this->x.HALF.HI + *ptr;
y = this->y.HALF.HI + *(ptr + 1);
if (sub_080AE4CC((Entity*)pLayer, x, y, 0)) {
this->direction = Random() & 0x18;
} else {
this->direction = dir;
}
dir = this->direction >> 3;
if ((dir) != this->animationState) {
this->animationState = dir;
InitializeAnimation(this, dir);
}
}
bool32 sub_08037E90(Entity* this) {
u32 dir = sub_0804A044(this, &gPlayerEntity, 8);
if (dir != 0xff) {
this->action = 2;
this->actionDelay = 3;
this->direction = dir;
this->animationState = dir >> 3;
InitializeAnimation(this, this->animationState + 4);
return 1;
}
return 0;
}
+11 -4
View File
@@ -1,3 +1,10 @@
/**
* @file peahat.c
* @ingroup Enemies
*
* @brief Peahat enemy
*/
#include "enemy.h"
#include "functions.h"
@@ -195,7 +202,7 @@ void Peahat_ChargeTarget(Entity* this) {
if (this->actionDelay & 1)
this->speed += 4;
if ((gScreenTransition.frameCount & 3) == 0)
if ((gRoomTransition.frameCount & 3) == 0)
sub_08004596(this, GetFacingDirection(this, gUnk_020000B0));
}
sub_080AEFE0(this);
@@ -238,7 +245,7 @@ void Peahat_Stunned(Entity* this) {
GetNextFrame(this);
break;
case PeahatAnimation_SlicedPropeller:
sub_08003FC4(this, 0x1c00);
GravityUpdate(this, 0x1c00);
if (this->z.HALF.HI == 0) {
this->action = 7;
this->actionDelay = 150;
@@ -316,7 +323,7 @@ void Peahat_Takeoff(Entity* this) {
} else if (this->frame & 1) {
sub_0800442E(this);
} else {
sub_08003FC4(this, 0x1c00);
GravityUpdate(this, 0x1c00);
ProcessMovement(this);
}
}
@@ -343,7 +350,7 @@ void PeahatPropeller_Fly(Entity* this) {
this->spriteSettings.draw ^= 1;
this->z.WORD -= 0xc000;
sub_0806F69C(this);
LinearMoveUpdate(this);
if (--this->field_0xf == 0) {
this->field_0xf = 40;
this->direction = (Random() & 0x10) + 8;
+29 -26
View File
@@ -1,15 +1,21 @@
/**
* @file pesto.c
* @ingroup Enemies
*
* @brief Pesto enemy
*/
#include "enemy.h"
#include "object.h"
#include "overworld.h"
#include "game.h"
#include "functions.h"
#include "save.h"
extern u32 sub_080002E0(u16, u32);
extern void sub_0800449C(Entity*, u32);
extern void SoundReqClipped(Entity*, u32);
extern u32 sub_08049F1C(Entity*, Entity*, u32);
extern u32 PlayerInRange(Entity*, u32, u32);
extern void sub_080AEFB4(Entity*);
extern Entity* FindNextDuplicateID(Entity* ent, int listIndex);
void sub_080249F4(Entity*);
void sub_08024940(Entity*);
@@ -149,7 +155,7 @@ void sub_080240B8(Entity* this) {
}
UpdateSpriteForCollisionLayer(this);
if (CheckIsDungeon())
if (AreaIsDungeon())
this->spriteOrientation.flipY = 1;
this->field_0x80.HALF.HI = Random() & 0x40;
@@ -393,10 +399,10 @@ void sub_080244E8(Entity* this) {
sub_080249DC(this);
this->cutsceneBeh.HALF.HI = gPlayerEntity.spritePriority.b1;
gPlayerEntity.flags &= 0x7f;
gPlayerState.flags |= 0x100;
gPlayerState.flags |= PL_DISABLE_ITEMS;
gPlayerState.field_0xa |= 0x80;
if (gPlayerState.swimState != 0) {
gPlayerState.swimState = 0;
if (gPlayerState.swim_state != 0) {
gPlayerState.swim_state = 0;
}
}
break;
@@ -535,7 +541,7 @@ void sub_08024940(Entity* this) {
this->z.HALF.HI += 2;
}
if (this->type2 != 0 || CheckIsDungeon()) {
if (this->type2 != 0 || AreaIsDungeon()) {
if (!sub_08049FA0(this)) {
this->direction = sub_08049EE4(this);
sub_080249F4(this);
@@ -558,14 +564,14 @@ void sub_080249DC(Entity* this) {
InitializeAnimation(this, this->animationState);
}
NONMATCH("asm/non_matching/pesto/sub_080249F4.inc", void sub_080249F4(Entity* this)) {
u8 direction = ((this->direction + 2) & 0x1c) >> 2;
void sub_080249F4(Entity* this) {
u32 direction = ((this->direction + 2) & 0x1f);
direction >>= 2;
if (direction != this->animationState) {
this->animationState = direction;
InitializeAnimation(this, this->animationState);
}
}
END_NONMATCH
void sub_08024A14(Entity* this, u32 param_2, u32 param_3) {
u8 unk = FALSE;
@@ -637,7 +643,7 @@ bool32 sub_08024B38(Entity* this) {
Entity* ent;
if (gPlayerState.hurtBlinkSpeed != 0) {
if (gPlayerState.swimState == 1) {
if (gPlayerState.swim_state == 1) {
if (gPlayerState.hurtBlinkSpeed > 3) {
gPlayerState.hurtBlinkSpeed -= 3;
} else {
@@ -784,16 +790,15 @@ u32 sub_08024E34(void) {
return gUnk_080CBF20[idx];
}
NONMATCH("asm/non_matching/pesto/sub_08024E4C.inc", void sub_08024E4C(Entity* this)) {
void sub_08024E4C(Entity* this) {
if (this->field_0x82.HALF.HI == 3) {
this->field_0xf++;
this->field_0xf &= 0xff;
this->field_0xf &= 0x1f;
this->field_0xf = ++this->field_0xf & 0x1f;
if (sub_0807953C()) {
this->cutsceneBeh.HALF.LO += 1 + (Random() & 1);
u32 r = Random();
this->cutsceneBeh.HALF.LO++;
r &= 1;
this->cutsceneBeh.HALF.LO += r;
}
if (gSave.stats.health == 0 || this->field_0x86.HALF.HI == 4) {
this->cutsceneBeh.HALF.LO = 0x30;
this->field_0x86.HALF.HI = 0;
@@ -805,11 +810,10 @@ NONMATCH("asm/non_matching/pesto/sub_08024E4C.inc", void sub_08024E4C(Entity* th
sub_08024A14(this, 0, 8);
} else {
Entity* player = &gPlayerEntity;
ResetPlayer();
gPlayerState.flags |= 0x100;
gPlayerState.flags |= PL_DISABLE_ITEMS;
gPlayerState.field_0xa |= 0x80;
gPlayerState.playerAction = 0xe;
gPlayerState.queued_action = PLAYER_0807204C;
gPlayerState.field_0x38 = 0x14;
gPlayerState.field_0x39 = 1;
*(u8*)&gPlayerState.field_0x3a = 0;
@@ -821,19 +825,18 @@ NONMATCH("asm/non_matching/pesto/sub_08024E4C.inc", void sub_08024E4C(Entity* th
this->field_0x86.HALF.HI++;
player->iframes = 8;
ModHealth(-2);
sub_0800449C(player, 0x7a);
SoundReqClipped(player, 0x7a);
}
}
}
}
END_NONMATCH
void sub_08024F50(Entity* this) {
gPlayerState.field_0xa = 0;
gPlayerState.flags &= 0xfffffeff;
gPlayerState.flags &= ~PL_DISABLE_ITEMS;
CopyPosition(this, &gPlayerEntity);
gPlayerEntity.action = 1;
gPlayerEntity.flags |= 0x80;
COLLISION_ON(&gPlayerEntity);
gPlayerEntity.iframes = -0x3c;
gPlayerEntity.direction = gPlayerEntity.animationState << 2;
gPlayerEntity.speed = 0;
+34 -24
View File
@@ -1,10 +1,17 @@
/**
* @file puffstool.c
* @ingroup Enemies
*
* @brief Puffstool enemy
*/
#include "enemy.h"
#include "object.h"
#include "functions.h"
extern u32 sub_080002E0(u32, u32);
extern u32 sub_080002C8(u16, u8);
extern u16 sub_080002D4(u32, u32, u32);
extern u8 sub_080002D4(u32, u32, u32);
extern void sub_0804AA1C(Entity*);
extern Entity* sub_08049DF4(u32);
@@ -104,7 +111,7 @@ void sub_0802511C(Entity* this) {
}
void sub_0802514C(Entity* this) {
sub_08003FC4(this, 0x2000);
GravityUpdate(this, 0x2000);
if (sub_0806F520(this)) {
gUnk_080CBFEC[this->subAction](this);
} else {
@@ -209,7 +216,7 @@ void sub_0802538C(Entity* this) {
if (this->frame == 0) {
GetNextFrame(this);
} else {
sub_08003FC4(this, 0x2000);
GravityUpdate(this, 0x2000);
if (this->zVelocity < 0x2000) {
this->action = 4;
InitializeAnimation(this, 2);
@@ -220,7 +227,7 @@ void sub_0802538C(Entity* this) {
void sub_080253D4(Entity* this) {
GetNextFrame(this);
if (!sub_08003FC4(this, 0x2000)) {
if (!GravityUpdate(this, 0x2000)) {
if (this->field_0xf == 0) {
this->action = 5;
InitializeAnimation(this, 3);
@@ -256,7 +263,7 @@ void sub_0802544C(Entity* this) {
}
void sub_0802547C(Entity* this) {
sub_08003FC4(this, 0x2000);
GravityUpdate(this, 0x2000);
GetNextFrame(this);
if ((this->actionDelay & 7) == 0) {
sub_08025BD4(this);
@@ -268,7 +275,7 @@ void sub_0802547C(Entity* this) {
}
void sub_080254B4(Entity* this) {
sub_08003FC4(this, 0x2000);
GravityUpdate(this, 0x2000);
if (this->frame & 0x80) {
if (this->z.HALF.HI == 0) {
if (this->cutsceneBeh.HWORD == 0) {
@@ -386,8 +393,8 @@ void sub_080256B4(Entity* this) {
bool32 sub_0802571C(Entity* this) {
RoomControls* ctrl = &gRoomControls;
u16 xDiff = (this->x.HALF.HI - ctrl->roomOriginX + 8) & -0x10;
u16 yDiff = (this->y.HALF.HI - ctrl->roomOriginY + 8) & -0x10;
u16 xDiff = (this->x.HALF.HI - ctrl->origin_x + 8) & -0x10;
u16 yDiff = (this->y.HALF.HI - ctrl->origin_y + 8) & -0x10;
u16 unk = this->field_0x7a.HALF.LO;
u16 i;
@@ -396,8 +403,8 @@ bool32 sub_0802571C(Entity* this) {
u16 sVar4 = yDiff + gUnk_080CC020[unk + 1];
if (sub_080257EC(this, sVar3, sVar4)) {
this->field_0x7c.HALF.LO = sVar3 + ctrl->roomOriginX;
this->field_0x7c.HALF.HI = sVar4 + ctrl->roomOriginY;
this->field_0x7c.HALF.LO = sVar3 + ctrl->origin_x;
this->field_0x7c.HALF.HI = sVar4 + ctrl->origin_y;
return TRUE;
}
@@ -465,22 +472,25 @@ bool32 sub_080258C4(Entity* this) {
}
}
// regalloc
NONMATCH("asm/non_matching/puffstool/sub_0802594C.inc", bool32 sub_0802594C(Entity* this, u32 param_2)) {
s16 xDiff;
s16 yDiff;
const s8* unk = gUnk_080CC090[param_2];
u32 uVar1 = this->collisionLayer;
RoomControls* ctrl = &gRoomControls;
u16 xDiff = (this->x.HALF.HI - ctrl->roomOriginX + 8) & -0x10;
u16 yDiff = (this->y.HALF.HI - ctrl->roomOriginY + 8) & -0x10;
xDiff = (this->x.HALF.HI - ctrl->origin_x + 8) & -0x10;
yDiff = (this->y.HALF.HI - ctrl->origin_y + 8) & -0x10;
do {
u16 iVar9 = xDiff + unk[0];
u16 iVar11 = yDiff + unk[1];
u32 bVar4 = sub_080002D4(iVar9 - 0x00, iVar11 - 0x00, uVar1);
u32 bVar5 = sub_080002D4(iVar9 - 0x10, iVar11 - 0x00, uVar1);
u32 bVar6 = sub_080002D4(iVar9 - 0x00, iVar11 - 0x10, uVar1);
u32 bVar7 = sub_080002D4(iVar9 - 0x10, iVar11 - 0x10, uVar1);
s16 iVar9 = xDiff + unk[0];
s16 iVar11 = yDiff + unk[1];
u8 bVar4 = sub_080002D4(iVar9 - 0x00, iVar11 - 0x00, uVar1);
u8 bVar5 = sub_080002D4(iVar9 - 0x10, iVar11 - 0x00, uVar1);
u8 bVar6 = sub_080002D4(iVar9 - 0x00, iVar11 - 0x10, uVar1);
u8 bVar7 = sub_080002D4(iVar9 - 0x10, iVar11 - 0x10, uVar1);
if ((bVar6 | bVar4 | bVar5 | bVar7) == 0) {
this->field_0x7c.HALF.LO = ctrl->roomOriginX + iVar9;
this->field_0x7c.HALF.HI = ctrl->roomOriginY + iVar11;
this->field_0x7c.HALF.LO = ctrl->origin_x + iVar9;
this->field_0x7c.HALF.HI = ctrl->origin_y + iVar11;
return TRUE;
}
unk += 2;
@@ -492,8 +502,8 @@ END_NONMATCH
void sub_08025A54(Entity* this) {
u32 layer = this->collisionLayer;
s16 x = this->x.HALF.HI - gRoomControls.roomOriginX;
s16 y = this->y.HALF.HI - gRoomControls.roomOriginY;
s16 x = this->x.HALF.HI - gRoomControls.origin_x;
s16 y = this->y.HALF.HI - gRoomControls.origin_y;
const s8* offset = gUnk_080CC0A0;
u32 i = 0;
@@ -532,8 +542,8 @@ void sub_08025AE8(Entity* this) {
void sub_08025B18(Entity* this) {
Entity* ent;
s32 x = this->x.HALF.HI - gRoomControls.roomOriginX;
s32 y = this->y.HALF.HI - gRoomControls.roomOriginY;
s32 x = this->x.HALF.HI - gRoomControls.origin_x;
s32 y = this->y.HALF.HI - gRoomControls.origin_y;
u32 layer = this->collisionLayer;
const s8* offset = gUnk_080CC0A8;
+7
View File
@@ -1,3 +1,10 @@
/**
* @file rockChuchu.c
* @ingroup Enemies
*
* @brief Rock Chuchu enemy
*/
#include "enemy.h"
#include "functions.h"
+11 -4
View File
@@ -1,3 +1,10 @@
/**
* @file rollobite.c
* @ingroup Enemies
*
* @brief Rollobite enemy
*/
#include "enemy.h"
#include "functions.h"
@@ -14,9 +21,9 @@ void sub_08020A7C(Entity*);
bool32 Rollobite_TryToHoleUp(Entity*);
bool32 Rollobite_IsRolledUp(Entity*);
extern void sub_080AE58C();
extern void sub_080AE7E8();
extern void sub_08078930();
extern void sub_080AE58C(Entity*, u32, u32);
extern void sub_080AE7E8(Entity*, u32, u32, u32);
extern void sub_08078930(Entity*);
void Rollobite(Entity* this) {
EnemyFunctionHandler(this, gRollobiteFunctions);
@@ -206,7 +213,7 @@ void Rollobite_Unroll(Entity* this) {
}
void Rollobite_LinedUp(Entity* this) {
if (sub_08003FC4(this, 0x1c00) == 0) {
if (GravityUpdate(this, 0x1c00) == 0) {
this->action = 7;
this->spritePriority.b0 = 7;
}
+11 -4
View File
@@ -1,3 +1,10 @@
/**
* @file rope.c
* @ingroup Enemies
*
* @brief Rope enemy
*/
#include "enemy.h"
#include "functions.h"
@@ -5,10 +12,10 @@ extern void (*const gRope[6])(Entity*);
extern void (*const gUnk_080CE460[4])(Entity*);
extern void (*const gUnk_080CE470[3])(Entity*);
extern Entity* gUnk_020000B0;
extern u32 sub_0804A044();
extern u32 sub_0804A044(Entity*, Entity*, u32);
void sub_08031600();
u32 sub_0803163C();
void sub_08031600(Entity*);
u32 sub_0803163C(Entity*);
void Rope(Entity* this) {
EnemyFunctionHandler(this, gRope);
@@ -83,7 +90,7 @@ void sub_08031480(Entity* this) {
SoundReq(SFX_12D);
}
} else {
if (sub_08003FC4(this, 0x1800) == 0) {
if (GravityUpdate(this, 0x1800) == 0) {
this->action = 2;
this->field_0xf = 0xf;
this->spriteSettings.draw = 1;
+7 -3
View File
@@ -1,6 +1,12 @@
/**
* @file ropeGolden.c
* @ingroup Enemies
*
* @brief Golden Rope enemy
*/
#include "global.h"
#include "entity.h"
#include "sprite.h"
#include "functions.h"
#include "enemy.h"
@@ -9,8 +15,6 @@ extern void (*const gUnk_080CF4C8[6])(Entity*);
extern void (*const gUnk_080CF4E0[4])(Entity*);
extern s32 sub_080012DC(Entity*);
extern void SetGlobalFlag(u32);
extern u32 CheckGlobalFlag(u32);
extern u32 sub_0804A044(Entity*, Entity*, u32);
void sub_080383AC(Entity*);
+13 -8
View File
@@ -1,13 +1,18 @@
/**
* @file rupeeLike.c
* @ingroup Enemies
*
* @brief Rupee Like enemy
*/
#include "global.h"
#include "asm.h"
#include "audio.h"
#include "sound.h"
#include "entity.h"
#include "enemy.h"
#include "npc.h"
#include "player.h"
#include "save.h"
#include "object.h"
#include "functions.h"
#include "save.h"
extern void sub_080293DC(Entity*);
extern void sub_080296D8(Entity*);
@@ -80,7 +85,7 @@ void sub_080293B4(Entity* this) {
CreateDeathFx(this, 0xff, gUnk_080CCC34[this->cutsceneBeh.HALF.LO * 3 + this->type]);
}
void nullsub_141() {
void nullsub_141(Entity* this) {
}
void sub_080293DC(Entity* this) {
@@ -165,7 +170,7 @@ void sub_0802953C(Entity* this) {
sub_080296D8(this);
} else {
ResetPlayer();
gPlayerState.field_0x1a[0] |= 0x80;
gPlayerState.mobility |= 0x80;
PositionRelative(this, &gPlayerEntity, 0, 0x10000);
pbVar3 = GetSpriteSubEntryOffsetDataPointer((u16)this->spriteIndex, this->frameIndex);
gPlayerEntity.spriteOffsetX = pbVar3[0];
@@ -232,8 +237,8 @@ void sub_080296C8(Entity* this) {
}
void sub_080296D8(Entity* this) {
gPlayerState.jumpStatus = 0x41;
gPlayerState.flags &= 0xffffffef;
gPlayerState.jump_status = 0x41;
gPlayerState.flags &= ~PL_CAPTURED;
gPlayerEntity.flags |= 0x80;
gPlayerEntity.zVelocity = 0x18000;
gPlayerEntity.iframes = 0xa6;
+7 -2
View File
@@ -1,6 +1,11 @@
/**
* @file sensorBladeTrap.c
* @ingroup Enemies
*
* @brief Sensor Blade Trap enemy
*/
#include "enemy.h"
#include "audio.h"
#include "functions.h"
extern u32 sub_0804A024(Entity*, u32, u32);
extern bool32 sub_080AE4CC(Entity*, u32, u32, u32);
+10 -5
View File
@@ -1,3 +1,10 @@
/**
* @file slime.c
* @ingroup Enemies
*
* @brief Slime enemy
*/
#include "enemy.h"
#include "functions.h"
@@ -16,8 +23,6 @@ extern void (*const gUnk_080D16A4[])(Entity*);
extern u8 gUnk_080D16D0[4]; // Entity count per form
extern PosOffset gUnk_080D16D4[4];
extern u8 gEntCount;
void Slime(Entity* this) {
EnemyFunctionHandler(this, gUnk_080D16A4);
SetChildOffset(this, 0, 1, -12);
@@ -39,7 +44,7 @@ void sub_08044F88(Entity* this) {
}
}
void nullsub_171() {
void nullsub_171(Entity* this) {
}
void sub_08044FC8(Entity* this) {
@@ -129,10 +134,10 @@ void sub_08045178(Entity* this, Entity* child, int h, int v) {
return;
x = child->x.HALF.HI + h;
if (0 <= x && x < (gRoomControls.roomOriginX + gRoomControls.width))
if (0 <= x && x < (gRoomControls.origin_x + gRoomControls.width))
child->x.HALF.HI = x;
y = child->y.HALF.HI + v;
if (0 <= y && y < (gRoomControls.roomOriginY + gRoomControls.height))
if (0 <= y && y < (gRoomControls.origin_y + gRoomControls.height))
child->y.HALF.HI = y;
}
+8 -1
View File
@@ -1,3 +1,10 @@
/**
* @file sluggula.c
* @ingroup Enemies
*
* @brief Sluggula enemy
*/
#include "enemy.h"
#include "functions.h"
@@ -117,7 +124,7 @@ void sub_08023CE0(Entity* this) {
EnqueueSFX(0x12d);
InitializeAnimation(this, 4);
}
} else if (!sub_08003FC4(this, 0x1800)) {
} else if (!GravityUpdate(this, 0x1800)) {
this->action = 3;
this->spriteSettings.draw = 1;
EnqueueSFX(0x84);
+9 -2
View File
@@ -1,3 +1,10 @@
/**
* @file smallPesto.c
* @ingroup Enemies
*
* @brief Small Pesto enemy
*/
#include "enemy.h"
#include "functions.h"
@@ -21,7 +28,7 @@ void sub_08031680(Entity* this) {
gUnk_080CE548[this->action](this);
}
void nullsub_152() {
void nullsub_152(Entity* this) {
}
void sub_0803169C(Entity* this) {
@@ -94,7 +101,7 @@ void sub_08031770(Entity* this) {
void sub_080317B4(Entity* this) {
this->z.HALF.HI = ((Random() & 0x30) != 0) ? -0xc : -0xd;
sub_0806F69C(this);
LinearMoveUpdate(this);
GetNextFrame(this);
}
+7 -2
View File
@@ -1,8 +1,13 @@
/**
* @file spark.c
* @ingroup Enemies
*
* @brief Spark enemy
*/
#include "enemy.h"
#include "entity.h"
#include "object.h"
#include "functions.h"
#include "effects.h"
extern void (*const gUnk_080CD234[])(Entity*);
extern void (*const gUnk_080CD24C[])(Entity*);
+7
View File
@@ -1,3 +1,10 @@
/**
* @file spearMoblin.c
* @ingroup Enemies
*
* @brief Spear Moblin enemy
*/
#include "enemy.h"
#include "functions.h"
+8 -1
View File
@@ -1,3 +1,10 @@
/**
* @file spikedBeetle.c
* @ingroup Enemies
*
* @brief Spiked Beetle enemy
*/
#include "enemy.h"
#include "functions.h"
@@ -173,7 +180,7 @@ void sub_0802B8E0(Entity* this) {
}
void sub_0802B948(Entity* this) {
if (!sub_08003FC4(this, 0x1800)) {
if (!GravityUpdate(this, 0x1800)) {
this->action = 1;
this->actionDelay = 1;
}
+11 -4
View File
@@ -1,3 +1,10 @@
/**
* @file spinyChuchu.c
* @ingroup Enemies
*
* @brief Spiny Chuchu enemy
*/
#include "enemy.h"
#include "functions.h"
@@ -86,7 +93,7 @@ void sub_080225A0(Entity* this) {
}
void sub_080225BC(Entity* this) {
sub_08003FC4(this, 0x1800);
GravityUpdate(this, 0x1800);
if (this->frame & 1) {
sub_0804A7D4(this);
} else {
@@ -125,7 +132,7 @@ void sub_08022654(Entity* this) {
InitializeAnimation(this, 0);
/* fallthrough */
case 1:
if (sub_08003FC4(this, 0x1800))
if (GravityUpdate(this, 0x1800))
return;
this->subAction = 2;
@@ -204,7 +211,7 @@ void sub_080227AC(Entity* this) {
}
void sub_0802281C(Entity* this) {
sub_08003FC4(this, 0x1800);
GravityUpdate(this, 0x1800);
GetNextFrame(this);
if (this->frame & 0x80) {
this->action = 2;
@@ -218,7 +225,7 @@ void sub_08022854(Entity* this) {
GetNextFrame(this);
if (this->frame & 1) {
sub_080AEFE0(this);
if (sub_08003FC4(this, 0x1800) == 0) {
if (GravityUpdate(this, 0x1800) == 0) {
this->action = 7;
this->hitType = 0x5c;
InitializeAnimation(this, 5);
+11 -2
View File
@@ -1,6 +1,15 @@
/**
* @file tektite.c
* @ingroup Enemies
*
* @brief Tektite enemy
*/
#include "enemy.h"
#include "functions.h"
static void sub_0802F45C(Entity* this);
extern void (*const gUnk_080CDED0[])(Entity*);
extern void (*const gUnk_080CDEE8[])(Entity*);
@@ -56,7 +65,7 @@ void nullsub_16(Entity* this) {
void sub_0802F1F0(Entity* this) {
sub_08001242(this);
if (this->z.HALF.HI != 0) {
sub_08003FC4(this, this->field_0x80.HWORD);
GravityUpdate(this, this->field_0x80.HWORD);
}
}
@@ -175,7 +184,7 @@ void sub_0802F3F4(Entity* this) {
}
}
void sub_0802F45C(Entity* this) {
static void sub_0802F45C(Entity* this) {
u32 temp;
if (sub_08049FA0(this) == 0) {
+8 -1
View File
@@ -1,3 +1,10 @@
/**
* @file tektiteGolden.c
* @ingroup Enemies
*
* @brief Golden Tektite enemy
*/
#include "enemy.h"
#include "functions.h"
@@ -55,7 +62,7 @@ void sub_08037F58(Entity* this) {
void sub_08037F84(Entity* this) {
sub_08001242(this);
if (this->z.HALF.HI != 0) {
sub_08003FC4(this, 0x3000);
GravityUpdate(this, 0x3000);
}
}
+7 -2
View File
@@ -1,8 +1,13 @@
/**
* @file treeItem.c
* @ingroup Enemies
*
* @brief Tree Item enemy
*/
#include "global.h"
#include "enemy.h"
#include "entity.h"
#include "object.h"
#include "functions.h"
static bool32 ShouldSpawnTreeItem(Entity*);
+60 -54
View File
@@ -1,3 +1,10 @@
/**
* @file vaatiArm.c
* @ingroup Enemies
*
* @brief Vaati Arm enemy
*/
#include "enemy.h"
#include "object.h"
#include "functions.h"
@@ -163,7 +170,6 @@ const u16 gUnk_080D140E[] = { -0x6000, -0x5000, -0x4000 };
const u8 gUnk_080D1414[] = { 0, 0xc, 0xe, 0x10, 0x1c };
const u8 gUnk_080D1419[] = { 0, 0xa, 0xa, 0xa, 0x1c };
extern u8 gEntCount;
extern const Hitbox gUnk_080FD450;
extern const Hitbox gUnk_080FD538;
@@ -190,11 +196,11 @@ void sub_080425B4(Entity* this) {
if (sub_080437DC(this)) {
this->field_0x7c.BYTES.byte0 = 0;
this->field_0x7c.BYTES.byte1 = 0;
if ((gScreenTransition.field_0x38 & 1) != 0) {
if (gScreenTransition.field_0x3c == this->type2) {
if ((gRoomTransition.field_0x38 & 1) != 0) {
if (gRoomTransition.field_0x3c == this->type2) {
sub_08043EB8(this);
sub_08043ABC(this);
if ((gScreenTransition.field_0x39 >> (this->type2 + 2) & 1U) != 0) {
if ((gRoomTransition.field_0x39 >> (this->type2 + 2) & 1U) != 0) {
this->action = 7;
this->subAction = 4;
} else {
@@ -208,7 +214,7 @@ void sub_080425B4(Entity* this) {
}
} else {
this->action = 1;
this->subAction = gScreenTransition.field_0x38 & 1;
this->subAction = gRoomTransition.field_0x38 & 1;
((VaatiArm_HeapStruct*)this->myHeap)->s1[0].unk08 = gUnk_080D1280[this->type2];
sub_08042654(this);
}
@@ -529,28 +535,27 @@ void sub_08042C34(Entity* this) {
temp = &gUnk_080D12F8[random];
x = gPlayerEntity.x.HALF.HI + *temp;
y = gPlayerEntity.y.HALF.HI + *(temp + 1);
if ((gRoomControls.roomOriginX + 0x20) > x) {
x = gRoomControls.roomOriginX + 0x20;
if ((gRoomControls.origin_x + 0x20) > x) {
x = gRoomControls.origin_x + 0x20;
}
if (gRoomControls.roomOriginX + gRoomControls.width + -0x20 < x) {
x = gRoomControls.roomOriginX + gRoomControls.width + -0x20;
if (gRoomControls.origin_x + gRoomControls.width + -0x20 < x) {
x = gRoomControls.origin_x + gRoomControls.width + -0x20;
}
if ((gRoomControls.roomOriginY + 0x20) > y) {
y = gRoomControls.roomOriginY + 0x20;
if ((gRoomControls.origin_y + 0x20) > y) {
y = gRoomControls.origin_y + 0x20;
}
#if defined EU || defined JP || defined DEMO_JP
if (gRoomControls.roomOriginY + gRoomControls.height + -0x20 < y) {
y = gRoomControls.roomOriginY + gRoomControls.height + -0x20;
if (gRoomControls.origin_y + gRoomControls.height + -0x20 < y) {
y = gRoomControls.origin_y + gRoomControls.height + -0x20;
}
#else
if (gRoomControls.roomOriginY + gRoomControls.height + -0x40 < y) {
y = gRoomControls.roomOriginY + gRoomControls.height + -0x40;
if (gRoomControls.origin_y + gRoomControls.height + -0x40 < y) {
y = gRoomControls.origin_y + gRoomControls.height + -0x40;
}
#endif
if (((u32)((x - gRoomControls.roomOriginX) - 0x90) < 0x41) &&
((u32)((y - gRoomControls.roomOriginY) - 8) < 0x41)) {
x = gRoomControls.roomOriginX + 0xb0;
y = gRoomControls.roomOriginY + 0x40;
if (((u32)((x - gRoomControls.origin_x) - 0x90) < 0x41) && ((u32)((y - gRoomControls.origin_y) - 8) < 0x41)) {
x = gRoomControls.origin_x + 0xb0;
y = gRoomControls.origin_y + 0x40;
}
for (i = 0; i < 4; i++) {
entity = ((VaatiArm_HeapStruct*)this->myHeap)->entities[i];
@@ -637,8 +642,8 @@ void sub_08042E30(Entity* this) {
this->actionDelay = (Random() & 0x38) + 0x28;
this->speed = 0x200;
this->direction = pVVar9->unk00.HALF.HI >> 3;
uVar6 = sub_080045D4(this->x.HALF.HI, this->y.HALF.HI, gRoomControls.roomOriginX + 0x110,
gRoomControls.roomOriginY + 0x60);
uVar6 = sub_080045D4(this->x.HALF.HI, this->y.HALF.HI, gRoomControls.origin_x + 0x110,
gRoomControls.origin_y + 0x60);
this->field_0x78.HALF.HI = (gUnk_080D1304[Random() & 7] + uVar6) & 0x1f;
}
pVVar9->unk00.HWORD += pVVar9->unk08;
@@ -939,8 +944,10 @@ void sub_08043440(Entity* this) {
}
}
NONMATCH("asm/non_matching/vaati/sub_08043490.inc", void sub_08043490(Entity* this)) {
void sub_08043490(Entity* this) {
Entity* entity;
Entity* entity2;
Entity* entity3;
entity = ((VaatiArm_HeapStruct*)this->myHeap)->entities[4];
if (entity->z.HALF.HI < -4) {
@@ -956,21 +963,20 @@ NONMATCH("asm/non_matching/vaati/sub_08043490.inc", void sub_08043490(Entity* th
entity->field_0x3c = entity->field_0x3c & 0xef;
entity->hitType = 0x3a;
entity->hitbox = (Hitbox*)&gUnk_080FD450;
entity = ((VaatiArm_HeapStruct*)this->myHeap)->entities[2];
entity->flags = entity->flags | 0x80;
entity = ((VaatiArm_HeapStruct*)this->myHeap)->entities[3];
entity->flags = entity->flags & 0x7f;
entity2 = ((VaatiArm_HeapStruct*)this->myHeap)->entities[2];
entity2->flags = entity2->flags | 0x80;
entity3 = ((VaatiArm_HeapStruct*)this->myHeap)->entities[3];
entity3->flags = entity3->flags & 0x7f;
}
}
UpdateAnimationSingleFrame(this);
}
END_NONMATCH
void sub_08043520(Entity* this) {
Entity* entity;
entity = ((VaatiArm_HeapStruct*)this->myHeap)->entities[4];
sub_08003FC4(entity, 0x1a00);
GravityUpdate(entity, 0x1a00);
if ((entity->zVelocity < 0) && (-6 < entity->z.HALF.HI)) {
entity->z.HALF.HI = -6;
this->subAction = 3;
@@ -1080,15 +1086,15 @@ NONMATCH("asm/non_matching/vaati/sub_08043770.inc", void sub_08043770(Entity* th
if (--this->actionDelay == 0) {
entity = ((VaatiArm_HeapStruct*)this->myHeap)->parent;
if ((gScreenTransition.field_0x39 & 0xc) == 0) {
if ((gRoomTransition.field_0x39 & 0xc) == 0) {
entity->subAction = 2;
}
if (this->type2 == 0) {
((VaatiArm_HeapStruct*)this->myHeap)->parent = NULL;
gScreenTransition.field_0x39 &= 0xfe;
gRoomTransition.field_0x39 &= 0xfe;
} else {
*(u32*)((VaatiArm_HeapStruct*)this->myHeap)->s1 = 0;
gScreenTransition.field_0x39 &= 0xfd;
gRoomTransition.field_0x39 &= 0xfd;
}
((VaatiArm_HeapStruct*)this->myHeap)->entities[4]->myHeap = NULL;
((VaatiArm_HeapStruct*)this->myHeap)->entities[4]->health = 0;
@@ -1292,7 +1298,7 @@ u32 sub_08043C98(Entity* this) {
Entity* e2 = ((VaatiArm_HeapStruct*)this->myHeap)->entities[3];
if ((e1->bitfield == 0x9d) || (e2->bitfield == 0x9d)) {
sub_08043D08(this);
gScreenTransition.field_0x38 |= 2;
gRoomTransition.field_0x38 |= 2;
return 1;
} else {
return 0;
@@ -1346,33 +1352,33 @@ void sub_08043DB0(Entity* this) {
if (((gPlayerState.flags & PL_MINISH) != 0)) {
pEVar3 = ((VaatiArm_HeapStruct*)this->myHeap)->entities[3];
if (CheckPlayerInRegion(pEVar3->x.HALF.HI - gRoomControls.roomOriginX,
pEVar3->y.HALF.HI - gRoomControls.roomOriginY + 2, 3, 3)) {
if (CheckPlayerInRegion(pEVar3->x.HALF.HI - gRoomControls.origin_x,
pEVar3->y.HALF.HI - gRoomControls.origin_y + 2, 3, 3)) {
DoExitTransition((ScreenTransitionData*)&gUnk_080D13EC);
if ((gScreenTransition.field_0x39 & 3) != 3) {
gScreenTransition.player_status.room_next = 1;
if ((gRoomTransition.field_0x39 & 3) != 3) {
gRoomTransition.player_status.room_next = 1;
}
cVar1 = this->field_0x7a.HWORD;
gScreenTransition.field_0x3d = 0x1e - (cVar1 / 0x3c);
gScreenTransition.field_0x3c = this->type2;
gRoomTransition.field_0x3d = 0x1e - (cVar1 / 0x3c);
gRoomTransition.field_0x3c = this->type2;
pEVar2 = ((VaatiArm_HeapStruct*)this->myHeap)->parent;
gScreenTransition.hurtType = pEVar2->x.HALF.HI;
gScreenTransition.field_0x42 = pEVar2->y.HALF.HI;
gRoomTransition.hurtType = pEVar2->x.HALF.HI;
gRoomTransition.field_0x42 = pEVar2->y.HALF.HI;
pEVar4 = ((VaatiArm_HeapStruct*)pEVar2->myHeap)->parent;
if (pEVar4 != NULL) {
gScreenTransition.field_0x44 = pEVar4->x.HALF.HI;
gScreenTransition.field_0x46 = pEVar4->y.HALF.HI;
gRoomTransition.field_0x44 = pEVar4->x.HALF.HI;
gRoomTransition.field_0x46 = pEVar4->y.HALF.HI;
} else {
gScreenTransition.field_0x44 = gRoomControls.roomOriginX + 0x110;
gScreenTransition.field_0x46 = gRoomControls.roomOriginY + 0x60;
gRoomTransition.field_0x44 = gRoomControls.origin_x + 0x110;
gRoomTransition.field_0x46 = gRoomControls.origin_y + 0x60;
}
pEVar4 = (Entity*)(*(int*)((VaatiArm_HeapStruct*)pEVar2->myHeap)->s1);
if (pEVar4 != NULL) {
gScreenTransition.field_0x48 = pEVar4->x.HALF.HI;
gScreenTransition.field_0x4a = pEVar4->y.HALF.HI;
gRoomTransition.field_0x48 = pEVar4->x.HALF.HI;
gRoomTransition.field_0x4a = pEVar4->y.HALF.HI;
} else {
gScreenTransition.field_0x48 = gRoomControls.roomOriginX + 0x110;
gScreenTransition.field_0x4a = gRoomControls.roomOriginY + 0x60;
gRoomTransition.field_0x48 = gRoomControls.origin_x + 0x110;
gRoomTransition.field_0x4a = gRoomControls.origin_y + 0x60;
}
}
}
@@ -1400,8 +1406,8 @@ void sub_08043EB8(Entity* this) {
pEVar4->flags = pEVar4->flags | 0x80;
pEVar4->spriteSettings.draw = 1;
pEVar4->spritePriority.b0 = 4;
pEVar4->x.HALF.HI = (this->type2 == 0) ? gScreenTransition.field_0x44 : gScreenTransition.field_0x48;
pEVar4->y.HALF.HI = (this->type2 == 0) ? gScreenTransition.field_0x46 : gScreenTransition.field_0x4a;
pEVar4->x.HALF.HI = (this->type2 == 0) ? gRoomTransition.field_0x44 : gRoomTransition.field_0x48;
pEVar4->y.HALF.HI = (this->type2 == 0) ? gRoomTransition.field_0x46 : gRoomTransition.field_0x4a;
pEVar4->z.HALF.HI = 0;
pEVar4->field_0x3c = pEVar4->field_0x3c & 0xef;
pEVar4->hitType = 0x3a;
@@ -1443,8 +1449,8 @@ void sub_08044078(Entity* this) {
if (this->action == 0) {
this->action = 1;
if (this->type != 3 ||
!(((gScreenTransition.field_0x38 & 1) == 0 ||
(((VaatiArm_HeapStruct*)this->myHeap)->entities[0]->type2 != gScreenTransition.field_0x3c)))) {
!(((gRoomTransition.field_0x38 & 1) == 0 ||
(((VaatiArm_HeapStruct*)this->myHeap)->entities[0]->type2 != gRoomTransition.field_0x3c)))) {
InitializeAnimation(this, 0x12);
} else {
InitializeAnimation(this, 0x11);
@@ -1456,8 +1462,8 @@ void sub_08044078(Entity* this) {
void sub_080440CC(Entity* this) {
if (this->action == 0) {
this->action = 1;
if ((gScreenTransition.field_0x38 & 1) != 0 &&
((VaatiArm_HeapStruct*)this->myHeap)->entities[0]->type2 == gScreenTransition.field_0x3c) {
if ((gRoomTransition.field_0x38 & 1) != 0 &&
((VaatiArm_HeapStruct*)this->myHeap)->entities[0]->type2 == gRoomTransition.field_0x3c) {
InitializeAnimation(this, 0x13);
} else {
InitializeAnimation(this, 0x11);
+23 -18
View File
@@ -1,9 +1,14 @@
/**
* @file vaatiBall.c
* @ingroup Enemies
*
* @brief Vaati Ball enemy
*/
#include "entity.h"
#include "enemy.h"
#include "player.h"
#include "screen.h"
#include "object.h"
#include "audio.h"
#include "functions.h"
typedef struct {
@@ -112,7 +117,7 @@ void sub_0804474C(Entity* this) {
this->direction++;
this->direction &= 0x1f;
}
sub_0806F69C(this);
LinearMoveUpdate(this);
UpdateAnimationSingleFrame(this);
}
}
@@ -143,7 +148,7 @@ void sub_080447E0(Entity* this) {
}
}
extern void sub_08044DEC();
extern void sub_08044DEC(Entity*);
void sub_08044868(Entity* this) {
Entity* vaati = this->parent;
@@ -164,7 +169,7 @@ void sub_08044868(Entity* this) {
}
break;
case 1:
sub_0806F69C(this);
LinearMoveUpdate(this);
if (sub_0806FCB8(this, vaati->x.HALF.HI, vaati->y.HALF.HI - 0x10, 0xc)) {
this->field_0x74.HALF.LO++;
this->x.HALF.HI = vaati->x.HALF.HI;
@@ -200,7 +205,7 @@ void sub_08044868(Entity* this) {
case 2:
if (this->actionDelay)
if (--this->actionDelay < 0x11)
sub_0806F69C(this);
LinearMoveUpdate(this);
break;
case 3: {
u8 draw;
@@ -229,7 +234,7 @@ void sub_080449F8(Entity* this) {
switch (vaati->field_0x74.HALF.LO) {
case 0:
sub_0806F69C(this);
LinearMoveUpdate(this);
if (--this->actionDelay)
break;
@@ -254,17 +259,17 @@ void sub_080449F8(Entity* this) {
break;
case 1:
this->direction = (this->direction + 0x10) & 0x1f;
sub_0806F69C(this);
LinearMoveUpdate(this);
this->direction = (this->direction + 0x10) & 0x1f;
this->actionDelay = 2;
break;
case 3:
sub_0806F69C(this);
LinearMoveUpdate(this);
this->actionDelay = 2;
break;
case 4:
sub_0806F69C(this);
sub_0806F69C(this);
LinearMoveUpdate(this);
LinearMoveUpdate(this);
this->actionDelay = 2;
break;
}
@@ -305,7 +310,7 @@ void sub_08044B04(Entity* this) {
switch (vaati->field_0x74.HALF.LO) {
case 0:
sub_0806F69C(this);
LinearMoveUpdate(this);
switch (this->field_0x74.HALF.LO) {
case 0:
if (--this->actionDelay == 0) {
@@ -420,7 +425,7 @@ void sub_08044B04(Entity* this) {
}
break;
case 1:
sub_0806F69C(this);
LinearMoveUpdate(this);
if (--this->actionDelay == 0)
this->field_0x74.HALF.LO++;
break;
@@ -472,11 +477,11 @@ void sub_08044E74(Entity* this, u32 state) {
this->direction &= 0x1f;
PositionRelative(this->parent, this, 0, -0x100000);
this->speed = 12288;
sub_0806F69C(this);
LinearMoveUpdate(this);
this->direction += 0x8;
this->direction &= 0x1f;
this->speed = 1280;
sub_0806F69C(this);
LinearMoveUpdate(this);
break;
case 1:
this->direction = (this->direction + 8) & 0x1f;
@@ -486,18 +491,18 @@ void sub_08044E74(Entity* this, u32 state) {
switch (this->actionDelay) {
case 3 ... 4:
do {
sub_0806F69C(this);
LinearMoveUpdate(this);
} while (this->actionDelay-- != 3);
break;
case 1:
this->direction = (this->direction + 0x10) & 0x1f;
sub_0806F69C(this);
LinearMoveUpdate(this);
this->direction = (this->direction + 0x10) & 0x1f;
break;
}
} else {
if (this->actionDelay == 2) {
sub_0806F69C(this);
LinearMoveUpdate(this);
}
}
break;
+14 -9
View File
@@ -1,3 +1,10 @@
/**
* @file vaatiEyesMacro.c
* @ingroup Enemies
*
* @brief Vaati Eyes Macro enemy
*/
#include "enemy.h"
#include "functions.h"
@@ -43,8 +50,6 @@ const u8 gUnk_080CDE70[] = {
const s8 gUnk_080CDE90[] = { -2, -3, -4, -5, -6, -5, -4, -3 };
const u16 gUnk_080CDE98[] = { 0xc0, 0x100, 0x140, 0x180 };
extern u8 gEntCount;
void VaatiEyesMacro(Entity* this) {
vaatiEyesMacroFunctions[GetNextFunction(this)](this);
SetChildOffset(this, 0, 1, -0x10);
@@ -60,12 +65,12 @@ void VaatiEyesMacroFunction0(Entity* this) {
void VaatiEyesMacroFunction1(Entity* this) {
if (this->type == 0) {
if (this->health == 0) {
gScreenTransition.field_0x39 &= ~(1 << (gScreenTransition.field_0x3c + 2));
gRoomTransition.field_0x39 &= ~(1 << (gRoomTransition.field_0x3c + 2));
}
if (gRoomControls.roomID == 0) {
gScreenTransition.field_0x3a = this->health;
if (gRoomControls.room == 0) {
gRoomTransition.field_0x3a = this->health;
} else {
gScreenTransition.field_0x3b = this->health;
gRoomTransition.field_0x3b = this->health;
}
if (this->field_0x78.HALF.HI != this->health) {
EnqueueSFX(SFX_17A);
@@ -104,10 +109,10 @@ void VaatiEyesMacroFunction0Type0Action0(Entity* this) {
enemy = CreateEnemy(VAATI_EYES_MACRO, 2);
enemy->parent = this;
this->action = 1;
if (gRoomControls.roomID == 0) {
this->field_0x78.HALF.HI = this->health = gScreenTransition.field_0x3a;
if (gRoomControls.room == 0) {
this->field_0x78.HALF.HI = this->health = gRoomTransition.field_0x3a;
} else {
this->field_0x78.HALF.HI = this->health = gScreenTransition.field_0x3b;
this->field_0x78.HALF.HI = this->health = gRoomTransition.field_0x3b;
}
this->field_0x78.HALF.LO = Random();
sub_0802EFB8(this);
+14 -7
View File
@@ -1,3 +1,10 @@
/**
* @file vaatiProjectile.c
* @ingroup Enemies
*
* @brief Vaati Projectile enemy
*/
#include "enemy.h"
#include "functions.h"
@@ -71,7 +78,7 @@ void VaatiProjectileFunction1(Entity* this) {
entity->flags = entity->flags & 0x7f;
}
} else {
gPlayerState.flags &= 0xfffffeff; // using b.unk8 does not match
gPlayerState.flags &= ~PL_DISABLE_ITEMS;
entity = &gPlayerEntity;
entity->flags = gPlayerEntity.flags | 0x80;
}
@@ -130,7 +137,7 @@ void VaatiProjectileFunction0Action1(Entity* this) {
} else {
if (gUnk_020000B0 != NULL) {
sub_08004596(this, GetFacingDirection(this, gUnk_020000B0));
sub_0806F69C(this);
LinearMoveUpdate(this);
}
}
GetNextFrame(this);
@@ -190,9 +197,9 @@ void VaatiProjectileFunction0Action6(Entity* this) {
void VaatiProjectileFunction0Action7(Entity* this) {
sub_0803E444(this);
sub_0806F69C(this);
LinearMoveUpdate(this);
sub_0803E4D8(this);
if ((gRoomControls.roomOriginY + gRoomControls.height + -0x10) <= this->y.HALF.HI) {
if ((gRoomControls.origin_y + gRoomControls.height + -0x10) <= this->y.HALF.HI) {
SetInitializationPriority();
DoExitTransition((ScreenTransitionData*)&gUnk_0813AB94);
}
@@ -222,7 +229,7 @@ void VaatiProjectileFunction0Action9(Entity* this) {
void sub_0803E444(Entity* this) {
ResetPlayer();
gPlayerState.field_0x1a[0] = gPlayerState.field_0x1a[0] | 0x80;
gPlayerState.mobility = gPlayerState.mobility | 0x80;
gPlayerState.field_0xa = gPlayerState.field_0xa | 0x80;
sub_0806FA90(this, this->field_0x4c, 0, -2);
gPlayerEntity.spriteOffsetY += 0xe;
@@ -239,7 +246,7 @@ void sub_0803E480(Entity* this) {
bool32 sub_0803E4A0(Entity* this) {
#ifdef EU
bool32 ret;
if (gScreenTransition.field_0x39 == 0) {
if (gRoomTransition.field_0x39 == 0) {
return TRUE;
} else {
if (this->parent == NULL) {
@@ -250,7 +257,7 @@ bool32 sub_0803E4A0(Entity* this) {
return ret;
#else
bool32 ret;
if (gScreenTransition.field_0x39 != 0) {
if (gRoomTransition.field_0x39 != 0) {
if (this->parent == NULL) {
return FALSE;
}
+14 -8
View File
@@ -1,9 +1,15 @@
/**
* @file vaatiRebornEnemy.c
* @ingroup Enemies
*
* @brief Vaati Reborn enemy
*/
#include "enemy.h"
#include "area.h"
#include "functions.h"
extern void sub_080AEFB4(Entity*);
extern u8 gEntCount;
void VaatiRebornEnemyType0PreAction(Entity*);
void VaatiRebornEnemyType1PreAction(Entity*);
@@ -246,8 +252,8 @@ void VaatiRebornEnemyType0Action2(Entity* this) {
tmp = this->field_0x80.HALF.HI;
this->field_0x80.HALF.HI = tmp % 5;
ptr = &gUnk_080D04AC[this->field_0x80.HALF.HI];
this->x.HALF.HI = gRoomControls.roomOriginX + ptr->HALF.x + 0x10;
this->y.HALF.HI = gRoomControls.roomOriginY + ptr->HALF.y + 0x10;
this->x.HALF.HI = gRoomControls.origin_x + ptr->HALF.x + 0x10;
this->y.HALF.HI = gRoomControls.origin_y + ptr->HALF.y + 0x10;
}
this->spriteSettings.draw = 1;
this->actionDelay = 0x20;
@@ -654,7 +660,7 @@ void VaatiRebornEnemyType1PreAction(Entity* this) {
parent->direction = -1;
this->actionDelay = 0;
SoundReq(SONG_STOP_BGM);
gArea.musicIndex = gArea.pMusicIndex;
gArea.bgm = gArea.queued_bgm;
return;
}
this->actionDelay = 1;
@@ -662,7 +668,7 @@ void VaatiRebornEnemyType1PreAction(Entity* this) {
}
if (0 < this->iframes) {
SoundReq(0x127);
sub_08080964(0xc, 1);
InitScreenShake(0xc, 1);
if (this->actionDelay == 0)
this->actionDelay = 0x48;
}
@@ -880,15 +886,15 @@ u32 sub_0803E028(Entity* this) {
if (this->field_0x76.HALF.HI != 1) {
return ret;
}
tmp = gRoomControls.roomOriginX + 0x58;
tmp = gRoomControls.origin_x + 0x58;
if (tmp > gPlayerEntity.x.HALF.HI) {
return ret;
}
tmp = gRoomControls.roomOriginY + 0x58;
tmp = gRoomControls.origin_y + 0x58;
if (tmp > gPlayerEntity.x.HALF.HI) {
return ret;
}
tmp = gRoomControls.roomOriginY + 0xf8;
tmp = gRoomControls.origin_y + 0xf8;
if (tmp >= gPlayerEntity.x.HALF.HI) {
this->field_0x80.HALF.HI += 5;
ret = 1;
+23 -17
View File
@@ -1,3 +1,10 @@
/**
* @file vaatiTransfigured.c
* @ingroup Enemies
*
* @brief Vaati Transfigured enemy
*/
#include "enemy.h"
#include "object.h"
#include "functions.h"
@@ -37,7 +44,6 @@ typedef struct {
s8 x;
s8 y;
} PACKED xy;
extern u8 gEntCount;
#ifdef EU
const u8 gUnk_080D0ABC[] = { 0xf0, 0xd0, 0xb0 };
@@ -266,7 +272,7 @@ void VaatiTransfiguredType0Action3(Entity* this) {
this->actionDelay = 0xc0;
COLLISION_ON(this);
SoundReq(SFX_14C);
sub_08080964(0x14, 4);
InitScreenShake(0x14, 4);
break;
case 1:
if (--this->actionDelay == 0) {
@@ -288,7 +294,7 @@ void VaatiTransfiguredType0Action3(Entity* this) {
if (this->animationState > 2) {
this->action = 7;
this->actionDelay = 0xe0;
sub_0807A108();
DeleteClones();
SoundReq(SFX_BOSS_HIT);
return;
}
@@ -313,7 +319,7 @@ void VaatiTransfiguredType0Action3(Entity* this) {
}
break;
}
if (sub_08003FC4(this, 0x2800) == 0) {
if (GravityUpdate(this, 0x2800) == 0) {
this->field_0x80.HALF.LO = 5;
this->actionDelay = 0x10;
COLLISION_ON(this);
@@ -321,7 +327,7 @@ void VaatiTransfiguredType0Action3(Entity* this) {
this->field_0x86.HALF.LO = 0;
sub_080408EC(this);
SoundReq(SFX_14C);
sub_08080964(0x1e, 4);
InitScreenShake(0x1e, 4);
} else {
if (this->field_0xf != 0) {
if (--this->field_0xf == 0) {
@@ -341,7 +347,7 @@ void VaatiTransfiguredType0Action3(Entity* this) {
this->field_0x86.HALF.LO = 0;
sub_080408EC(this);
} else {
if (((this->actionDelay & 1) != 0) && (pEVar3 = CreateObject(0x9b, 1, 0xff), pEVar3 != NULL)) {
if (((this->actionDelay & 1) != 0) && (pEVar3 = CreateObject(OBJECT_9B, 1, 0xff), pEVar3 != NULL)) {
pEVar3->parent = this;
CopyPosition(this, pEVar3);
pEVar3->x.HALF.HI += (Random() & 0xf) - 7;
@@ -379,7 +385,7 @@ void VaatiTransfiguredType0Action4(Entity* this) {
}
break;
case 1:
if (sub_08003FC4(this, 0x2800) != 0)
if (GravityUpdate(this, 0x2800) != 0)
break;
this->field_0x80.HALF.LO += 1;
switch (this->cutsceneBeh.HALF.LO) {
@@ -399,7 +405,7 @@ void VaatiTransfiguredType0Action4(Entity* this) {
this->field_0xf = 1;
}
SoundReq(SFX_14C);
sub_08080964(0x1e, 4);
InitScreenShake(0x1e, 4);
break;
case 2:
if (--this->actionDelay == 0) {
@@ -857,8 +863,8 @@ void sub_080406A0(Entity* this) {
uVar5 = this->field_0x86.HALF.LO;
{
u32 tmp;
uVar6 = gRoomControls.roomOriginX + gUnk_080D0B58[tmp = uVar5 * 2];
uVar4 = gRoomControls.roomOriginY + gUnk_080D0B58[tmp + 1];
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 (uVar5 != 0) {
@@ -868,8 +874,8 @@ void sub_080406A0(Entity* this) {
}
{
u32 tmp;
uVar6 = gRoomControls.roomOriginX + gUnk_080D0B58[tmp = uVar5 * 2];
uVar4 = gRoomControls.roomOriginY + gUnk_080D0B58[tmp + 1];
uVar6 = gRoomControls.origin_x + gUnk_080D0B58[tmp = uVar5 * 2];
uVar4 = gRoomControls.origin_y + gUnk_080D0B58[tmp + 1];
}
}
uVar3 = sub_080045D4(this->x.HALF.HI, this->y.HALF.HI, uVar6, uVar4);
@@ -892,8 +898,8 @@ void sub_08040770(Entity* this) {
u32 tmp5, tmp6;
{
u32 index;
tmp5 = gRoomControls.roomOriginX + gUnk_080D0B64[index = tmp2 * 2];
tmp6 = gRoomControls.roomOriginY + gUnk_080D0B64[index + 1];
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 (this->animationState != 2) {
@@ -955,8 +961,8 @@ void sub_08040770(Entity* this) {
}
{
u32 tmp3;
tmp5 = gRoomControls.roomOriginX + gUnk_080D0B64[tmp3 = tmp2 * 2],
tmp6 = gRoomControls.roomOriginY + gUnk_080D0B64[tmp3 + 1];
tmp5 = gRoomControls.origin_x + gUnk_080D0B64[tmp3 = tmp2 * 2],
tmp6 = gRoomControls.origin_y + gUnk_080D0B64[tmp3 + 1];
}
}
this->direction = sub_080045D4(this->x.HALF.HI, this->y.HALF.HI, tmp5, tmp6);
@@ -1069,7 +1075,7 @@ void sub_080409B0(Entity* this) {
}
} else {
if (((this->bitfield & 0x80) != 0) && (0 < this->iframes)) {
sub_08080964(0xc, 1);
InitScreenShake(0xc, 1);
SoundReq(SFX_BOSS_HIT);
}
if ((this->bitfield == 0x8a) && (gPlayerState.field_0xa0[0] == 5)) {
+8 -2
View File
@@ -1,7 +1,13 @@
/**
* @file vaatiTransfiguredEye.c
* @ingroup Enemies
*
* @brief Vaati Transfigured Eye enemy
*/
#include "entity.h"
#include "enemy.h"
#include "audio.h"
#include "textbox.h"
#include "message.h"
#include "coord.h"
#include "functions.h"
+38 -35
View File
@@ -1,13 +1,17 @@
/**
* @file vaatiWrath.c
* @ingroup Enemies
*
* @brief Vaati Wrath enemy
*/
#include "enemy.h"
#include "object.h"
#include "textbox.h"
#include "structures.h"
#include "message.h"
#include "functions.h"
#include "save.h"
#include "screen.h"
extern u8 gEntCount;
void VaatiWrathType0PreAction(Entity*);
u32 sub_08041FCC(Entity*);
void sub_08042004(Entity*);
@@ -120,20 +124,20 @@ void VaatiWrathType0(Entity* this) {
void VaatiWrathType0Action0(Entity* this) {
u32 bVar1;
bVar1 = gScreenTransition.field_0x38 & 1;
bVar1 = gRoomTransition.field_0x38 & 1;
if (bVar1 != 0) {
if (sub_08041FCC(this) == 0) {
return;
}
if ((gScreenTransition.field_0x39 & 0xc) == 0) {
if ((gRoomTransition.field_0x39 & 0xc) == 0) {
this->action = 5;
this->subAction = 1;
} else {
this->action = 2;
this->actionDelay = 0x3c;
}
this->x.HALF.HI = gScreenTransition.hurtType;
this->y.HALF.HI = gScreenTransition.field_0x42;
this->x.HALF.HI = gRoomTransition.hurtType;
this->y.HALF.HI = gRoomTransition.field_0x42;
sub_08042004(this);
} else {
if (sub_08041ED4(this) == 0) {
@@ -144,7 +148,7 @@ void VaatiWrathType0Action0(Entity* this) {
this->actionDelay = 120;
this->spritePriority.b1 = 0;
this->z.HALF.HI = 0xffb0;
gRoomControls.cameraTarget = this;
gRoomControls.camera_target = this;
sub_080809D4();
}
this->spriteSettings.draw = 1;
@@ -212,8 +216,8 @@ void VaatiWrathType0Action1(Entity* this) {
sub_08042004(this);
this->subAction = 6;
this->actionDelay = 0x1e;
gScreenTransition.field_0x38 |= 1;
gRoomControls.cameraTarget = &gPlayerEntity;
gRoomTransition.field_0x38 |= 1;
gRoomControls.camera_target = &gPlayerEntity;
gPlayerState.controlMode = 1;
break;
default:
@@ -246,7 +250,7 @@ void VaatiWrathType0Action3(Entity* this) {
UpdateAnimationSingleFrame(this);
ProcessMovement(this);
roomY = gRoomControls.roomOriginY;
roomY = gRoomControls.origin_y;
bound = roomY + 0x90;
thisY = this->y.HALF.HI;
if ((bound < thisY)) {
@@ -322,12 +326,12 @@ void VaatiWrathType0Action5(Entity* this) {
} else {
if (this->field_0x78.HALF.HI == 0) {
if (this->subAction == 2) {
if ((gScreenTransition.field_0x39 & 3) == 0) {
if ((gRoomTransition.field_0x39 & 3) == 0) {
object = CreateObject(OBJECT_B5, 0, 0);
if (object != NULL) {
object->parent = this;
((VaatiWrathHeapStruct*)this->myHeap)->object5b = object;
gRoomControls.cameraTarget = object;
gRoomControls.camera_target = object;
this->action = 6;
this->actionDelay = 0x1e;
((VaatiWrathHeapStruct*)this->myHeap)->type1->subAction = 1;
@@ -377,10 +381,10 @@ void VaatiWrathType0Action7(Entity* this) {
sub_08042214(this);
sub_08042004(this);
UpdateAnimationSingleFrame(this);
if (gRoomControls.roomOriginY + 0x48 != this->y.HALF.HI) {
if (gRoomControls.origin_y + 0x48 != this->y.HALF.HI) {
this->speed = 0x100;
this->direction = ((gRoomControls.roomOriginY + 0x48) >= this->y.HALF.HI) ? 0x10 : 0;
sub_0806F69C(this);
this->direction = ((gRoomControls.origin_y + 0x48) >= this->y.HALF.HI) ? 0x10 : 0;
LinearMoveUpdate(this);
} else {
if (--this->actionDelay == 0) {
sub_08042050(this);
@@ -391,9 +395,8 @@ void VaatiWrathType0Action7(Entity* this) {
void VaatiWrathType0Action8(Entity* this) {
sub_08042004(this);
UpdateAnimationSingleFrame(this);
sub_0806F69C(this);
if (((gRoomControls.roomOriginX + 0x20) > this->x.HALF.HI) ||
((gRoomControls.roomOriginX + 0x140) < this->x.HALF.HI)) {
LinearMoveUpdate(this);
if (((gRoomControls.origin_x + 0x20) > this->x.HALF.HI) || ((gRoomControls.origin_x + 0x140) < this->x.HALF.HI)) {
if (0x3f < this->speed) {
this->direction ^= 0x10;
}
@@ -466,16 +469,16 @@ void VaatiWrathType0ActionA(Entity* this) {
void VaatiWrathType0ActionB(Entity* this) {
switch (this->subAction) {
case 0:
sub_0806F69C(this);
LinearMoveUpdate(this);
UpdateAnimationSingleFrame(this);
GetNextFrame(((VaatiWrathHeapStruct*)this->myHeap)->type1);
GetNextFrame(((VaatiWrathHeapStruct*)this->myHeap)->type2);
if (sub_08003FC4(this, 0x2000) == 0) {
if (GravityUpdate(this, 0x2000) == 0) {
this->subAction = 1;
this->actionDelay = 0xf0;
this->health = 8;
this->hitType = 0x38;
sub_08080964(0x14, 0);
InitScreenShake(0x14, 0);
InitAnimationForceUpdate(this, 6);
InitializeAnimation(((VaatiWrathHeapStruct*)this->myHeap)->type2, 0x16);
}
@@ -527,8 +530,8 @@ void VaatiWrathType0ActionC(Entity* this) {
if (this->actionDelay) {
this->actionDelay--;
} else {
sub_0806F69C(this);
if (gRoomControls.roomOriginY + 0x48 == this->y.HALF.HI) {
LinearMoveUpdate(this);
if (gRoomControls.origin_y + 0x48 == this->y.HALF.HI) {
this->subAction = 2;
InitializeAnimation(((VaatiWrathHeapStruct*)this->myHeap)->type1, 0x11);
InitializeAnimation(((VaatiWrathHeapStruct*)this->myHeap)->type2, 0x19);
@@ -586,7 +589,7 @@ void sub_08041BE8(Entity* this) {
DeleteEntity(entity);
((VaatiWrathHeapStruct*)this->myHeap)->object5b = NULL;
gRoomControls.cameraTarget = &gPlayerEntity;
gRoomControls.camera_target = &gPlayerEntity;
#endif
entity = ((VaatiWrathHeapStruct*)this->myHeap)->eyes[0];
entity->myHeap = NULL;
@@ -663,7 +666,7 @@ void sub_08041D84(Entity* this) {
ChangeObjPalette(this->child, gUnk_080D0E80[(this->field_0xf - 0xb8) >> 3]);
}
if (this->field_0xf == 0xe6) {
DoFade(7, 4);
SetFade(7, 4);
}
} else {
this->subAction = 4;
@@ -709,7 +712,7 @@ void sub_08041E78(Entity* this) {
fx->x.HALF.HI += *temp++;
fx->y.HALF.HI += *temp;
fx->spritePriority.b0 = 3;
sub_08080964(4, 0);
InitScreenShake(4, 0);
}
}
}
@@ -769,7 +772,7 @@ u32 sub_08041F74(Entity* this, u32 unk1) {
}
heap = ((VaatiWrathHeapStruct*)this->myHeap);
arm = NULL;
if ((gScreenTransition.field_0x39 >> unk1 & 1U) != 0) {
if ((gRoomTransition.field_0x39 >> unk1 & 1U) != 0) {
arm = CreateEnemy(VAATI_ARM, 0);
arm->type2 = unk1;
arm->parent = this;
@@ -833,7 +836,7 @@ u32 sub_0804207C(Entity* this) {
return sub_080045D4(arm->x.HALF.HI, arm->y.HALF.HI, x, y);
} else {
if (gPlayerEntity.y.HALF.HI < 0x40) {
tmp = gRoomControls.roomOriginY + 0x18;
tmp = gRoomControls.origin_y + 0x18;
} else {
tmp = gPlayerEntity.y.HALF.HI - 0x28;
@@ -888,7 +891,7 @@ void sub_080421AC(Entity* this) {
this->field_0x7c.HALF_U.HI--;
} else {
if (this->field_0x78.HALF.HI == 0) {
if (((Random() & 1) != 0) && ((gScreenTransition.field_0x39 & 0xc) != 0)) {
if (((Random() & 1) != 0) && ((gRoomTransition.field_0x39 & 0xc) != 0)) {
sub_08042264(this);
this->field_0x78.HALF.HI = 1;
return;
@@ -994,9 +997,9 @@ void sub_0804235C(Entity* this) {
#if defined USA || defined DEMO_USA || defined DEMO_JP
void VaatiWrathType0PreAction(Entity* this) {
int temp;
if ((gScreenTransition.field_0x38 & 2) == 0) {
if (gSave.unk48C[3] != 0) {
gSave.unk48C[3]--;
if ((gRoomTransition.field_0x38 & 2) == 0) {
if (gSave.timers[3] != 0) {
gSave.timers[3]--;
} else {
temp = gPlayerState.framestate_last;
if (temp < 2) {
@@ -1005,7 +1008,7 @@ void VaatiWrathType0PreAction(Entity* this) {
if (gPlayerEntity.field_0x7a.HWORD == 0) {
if ((gPlayerEntity.z.HALF.HI & 0x8000U) == 0 || (gPlayerState.field_0xa != 0)) {
CreateEzloHint(0xb70, 0);
gScreenTransition.field_0x38 |= 2;
gRoomTransition.field_0x38 |= 2;
}
}
}
+10 -4
View File
@@ -1,5 +1,11 @@
/**
* @file vaatiWrathEye.c
* @ingroup Enemies
*
* @brief Vaati Wrath Eye enemy
*/
#include "enemy.h"
#include "structures.h"
#include "functions.h"
void sub_080485D8(Entity*);
@@ -36,7 +42,7 @@ void VaatiWrathEye(Entity* this) {
}
void VaatiWrathEyeAction0(Entity* this) {
if ((gScreenTransition.field_0x38 & 1) != 0) {
if ((gRoomTransition.field_0x38 & 1) != 0) {
this->action = 2;
InitializeAnimation(this, 1);
} else {
@@ -58,7 +64,7 @@ void VaatiWrathEyeAction1(Entity* this) {
void VaatiWrathEyeAction2(Entity* this) {
sub_080485D8(this);
if ((gScreenTransition.field_0x39 & 3) == 0) {
if ((gRoomTransition.field_0x39 & 3) == 0) {
this->action = 3;
COLLISION_ON(this);
this->speed = 0x80;
@@ -82,7 +88,7 @@ void VaatiWrathEyeAction3(Entity* this) {
y = parent->y.HALF.HI + ptr[1];
direction = sub_080045D4(this->x.HALF.HI, this->y.HALF.HI, x, y);
this->direction = direction;
sub_0806F69C(this);
LinearMoveUpdate(this);
this->z.HALF.HI = this->parent->z.HALF.HI;
if ((this->x.HALF.HI == x) && (this->y.HALF.HI == y)) {
this->action = 4;
+9 -2
View File
@@ -1,3 +1,10 @@
/**
* @file wallMaster.c
* @ingroup Enemies
*
* @brief Wall Master enemy
*/
#include "enemy.h"
#include "area.h"
#include "functions.h"
@@ -134,7 +141,7 @@ void sub_0802A69C(Entity* this) {
sub_0802A7D0(this);
gPlayerState.field_0xa |= 0x80;
gPlayerState.field_0x1a[0] |= 0x80;
gPlayerState.mobility |= 0x80;
gPlayerEntity.x.HALF.HI = this->field_0x7c.HALF.HI;
gPlayerEntity.y.HALF.HI = this->field_0x80.HWORD;
gPlayerEntity.z.HALF.HI = this->field_0x82.HWORD;
@@ -168,7 +175,7 @@ void sub_0802A734(Entity* this) {
} else {
this->z.WORD -= 0x20000;
gPlayerState.field_0xa |= 0x80;
gPlayerState.field_0x1a[0] |= 0x80;
gPlayerState.mobility |= 0x80;
}
}
+13 -6
View File
@@ -1,3 +1,10 @@
/**
* @file wallMaster2.c
* @ingroup Enemies
*
* @brief Wall Master 2 enemy
*/
#include "enemy.h"
#include "area.h"
#include "functions.h"
@@ -92,7 +99,7 @@ void sub_0802CD54(Entity* this) {
this->actionDelay = 60;
sub_0802CF64(this);
}
sub_0806F69C(this);
LinearMoveUpdate(this);
}
void sub_0802CDE8(Entity* this) {
@@ -101,7 +108,7 @@ void sub_0802CDE8(Entity* this) {
sub_08004596(this, GetFacingDirection(this, gUnk_020000B0));
sub_0802CF8C(this);
}
sub_0806F69C(this);
LinearMoveUpdate(this);
} else {
this->action = 1;
this->actionDelay = 60;
@@ -116,11 +123,11 @@ void sub_0802CE68(Entity* this) {
u8 frames;
gPlayerState.field_0xa |= 0x80;
gPlayerState.field_0x1a[0] |= 0x80;
gPlayerState.flags |= 0x100;
gPlayerState.mobility |= 0x80;
gPlayerState.flags |= PL_DISABLE_ITEMS;
if (!sub_0806FCB8(this, gPlayerEntity.x.HALF.HI, gPlayerEntity.y.HALF.HI, 4)) {
this->direction = GetFacingDirection(this, &gPlayerEntity);
sub_0806F69C(this);
LinearMoveUpdate(this);
}
sub_0802CFD8(this);
GetNextFrame(this);
@@ -145,7 +152,7 @@ void sub_0802CEF4(Entity* this) {
this->spriteSettings.shadow = 1;
}
gPlayerState.field_0xa |= 0x80;
gPlayerState.field_0x1a[0] |= 0x80;
gPlayerState.mobility |= 0x80;
}
}
+13 -7
View File
@@ -1,8 +1,14 @@
/**
* @file waterDrop.c
* @ingroup Enemies
*
* @brief Water Drop enemy
*/
#include "enemy.h"
#include "screen.h"
#include "object.h"
#include "structures.h"
#include "functions.h"
void sub_0802A39C(Entity*);
void sub_0802A334(Entity*);
@@ -34,12 +40,12 @@ void sub_0802A250(Entity* this) {
}
void sub_0802A2B4(Entity* this) {
if (!sub_08003FC4(this, 0x2800)) {
if (!GravityUpdate(this, 0x2800)) {
this->action = 2;
this->spritePriority.b0 = 7;
EnqueueSFX(0x84);
} else {
sub_0806F69C(this);
LinearMoveUpdate(this);
}
sub_0802A39C(this);
@@ -60,8 +66,8 @@ void sub_0802A2FC(Entity* this) {
}
void sub_0802A334(Entity* this) {
u32 x = (this->x.HALF.HI - gRoomControls.roomScrollX + gScreen.bg1.xOffset) >> 3;
u32 y = (this->y.HALF.HI - gRoomControls.roomScrollY + gScreen.bg1.yOffset) >> 3;
u32 x = (this->x.HALF.HI - gRoomControls.scroll_x + gScreen.bg1.xOffset) >> 3;
u32 y = (this->y.HALF.HI - gRoomControls.scroll_y + gScreen.bg1.yOffset) >> 3;
if (gBG3Buffer[(x & 0x1fU) + (y & 0x1fU) * 0x20 + 0x400]) {
this->collisionLayer = 2;
} else {
@@ -71,8 +77,8 @@ void sub_0802A334(Entity* this) {
}
void sub_0802A39C(Entity* this) {
u32 x = (gPlayerEntity.x.HALF.HI - gRoomControls.roomScrollX + gScreen.bg1.xOffset) >> 3;
u32 y = (gPlayerEntity.y.HALF.HI - gRoomControls.roomScrollY + gScreen.bg1.yOffset - 10) >> 3;
u32 x = (gPlayerEntity.x.HALF.HI - gRoomControls.scroll_x + gScreen.bg1.xOffset) >> 3;
u32 y = (gPlayerEntity.y.HALF.HI - gRoomControls.scroll_y + gScreen.bg1.yOffset - 10) >> 3;
if (gBG3Buffer[(x & 0x1fU) + (y & 0x1fU) * 0x20 + 0x400]) {
COLLISION_OFF(this);
} else {
+11 -2
View File
@@ -1,8 +1,17 @@
/**
* @file wisp.c
* @ingroup Enemies
*
* @brief Wisp enemy
*/
#include "enemy.h"
#include "save.h"
#include "object.h"
#include "functions.h"
static void sub_08033744(Entity* this);
extern void (*const gUnk_080CEB74[])(Entity*);
extern void (*const gUnk_080CEB8C[])(Entity*);
extern void (*const gUnk_080CEB98[])(Entity*);
@@ -32,7 +41,7 @@ void sub_08033564(Entity* this) {
this->spriteSettings.draw = FALSE;
COLLISION_OFF(this);
this->field_0x7c.HALF.LO = 0x27c;
gPlayerState.flags |= 0x4000;
gPlayerState.flags |= PL_DRUGGED;
gSave.stats.effect = this->type + 1;
gSave.stats.effectTimer = 600;
if (this->type == 0) {
@@ -120,7 +129,7 @@ void sub_080336DC(Entity* this) {
}
}
void sub_08033744(Entity* this) {
static void sub_08033744(Entity* this) {
u32 temp;
u32 rand = (u32)Random() % 256;