mirror of
https://github.com/zeldaret/tmc
synced 2026-08-21 06:29:00 -04:00
Merge branch 'master' into demo-jp
This commit is contained in:
@@ -138,7 +138,7 @@ void sub_08028A74(Entity* this) {
|
||||
unk = 1;
|
||||
sub_080290FC(this);
|
||||
if (this->frames.all & 1) {
|
||||
Entity* ent = sub_0804A98C(this, 4, 0);
|
||||
Entity* ent = CreateProjectileWithParent(this, 4, 0);
|
||||
if (ent != NULL) {
|
||||
ent->parent = this;
|
||||
ent->direction = this->direction;
|
||||
|
||||
+5
-5
@@ -224,7 +224,7 @@ void sub_08020F48(Entity* this) {
|
||||
|
||||
this->action = 14;
|
||||
sub_08021218(this, 13, uVar2 >> 3);
|
||||
pEVar3 = sub_0804A98C(this, 0, 1);
|
||||
pEVar3 = CreateProjectileWithParent(this, 0, 1);
|
||||
if (pEVar3) {
|
||||
pEVar3->parent = this;
|
||||
this->attachedEntity = pEVar3;
|
||||
@@ -270,7 +270,7 @@ void sub_08021010(Entity* this) {
|
||||
|
||||
void sub_08021038(Entity* this) {
|
||||
if (this->attachedEntity == NULL && this->frames.all) {
|
||||
Entity* pEVar2 = (Entity*)sub_0804A98C(this, 0, 0);
|
||||
Entity* pEVar2 = (Entity*)CreateProjectileWithParent(this, 0, 0);
|
||||
if (pEVar2) {
|
||||
pEVar2->parent = this;
|
||||
this->attachedEntity = pEVar2;
|
||||
@@ -309,7 +309,7 @@ void sub_080210E4(Entity* this) {
|
||||
Entity* ent;
|
||||
|
||||
this->frames.all &= ~1;
|
||||
ent = sub_0804A98C(this, 0, 2);
|
||||
ent = CreateProjectileWithParent(this, 0, 2);
|
||||
if (ent) {
|
||||
ent->parent = this;
|
||||
this->attachedEntity = ent;
|
||||
@@ -569,7 +569,7 @@ void sub_0802159C(Entity* this) {
|
||||
|
||||
this->frames.all = 0;
|
||||
this->damageType = 0x51;
|
||||
ent = sub_0804A98C(this, 0, 3);
|
||||
ent = CreateProjectileWithParent(this, 0, 3);
|
||||
if (ent) {
|
||||
ent->parent = this;
|
||||
this->attachedEntity = ent;
|
||||
@@ -590,7 +590,7 @@ void sub_08021600(Entity* this) {
|
||||
|
||||
this->frames.all = 0;
|
||||
this->damageType = 0x51;
|
||||
ent = sub_0804A98C(this, 0, 4);
|
||||
ent = CreateProjectileWithParent(this, 0, 4);
|
||||
if (ent) {
|
||||
ent->parent = this;
|
||||
this->attachedEntity = ent;
|
||||
|
||||
+1
-1
@@ -36,7 +36,7 @@ void sub_0803EB44(Entity* this) {
|
||||
Entity* pEVar1;
|
||||
|
||||
sub_0804A720(this);
|
||||
pEVar1 = sub_0804A98C(this, 0x19, 0);
|
||||
pEVar1 = CreateProjectileWithParent(this, 0x19, 0);
|
||||
if (pEVar1 != NULL) {
|
||||
pEVar1->parent = this;
|
||||
this->attachedEntity = pEVar1;
|
||||
|
||||
@@ -109,7 +109,7 @@ void GyorgMale(Entity* this) {
|
||||
}
|
||||
|
||||
void sub_08046898(Entity* this) {
|
||||
Entity* tmp = sub_080A7EE0(0x22);
|
||||
Entity* tmp = CreateProjectile(0x22);
|
||||
u32 tmp2;
|
||||
if (!tmp)
|
||||
return;
|
||||
@@ -402,7 +402,7 @@ void sub_08046EF4(Entity* this) {
|
||||
if ((--this->field_0xf & 0xFF) == 0) {
|
||||
Entity* tmp;
|
||||
this->field_0xf = (Random() & 0x38) + 0x78;
|
||||
tmp = sub_080A7EE0(0x23);
|
||||
tmp = CreateProjectile(0x23);
|
||||
if (tmp) {
|
||||
tmp->collisionLayer = 2;
|
||||
tmp->parent = this;
|
||||
@@ -426,7 +426,7 @@ void sub_08046F64(Entity* this) {
|
||||
if (--this->field_0x7c.HALF.HI == 0) {
|
||||
Entity* tmp;
|
||||
this->field_0x7c.HALF.HI = 0x78;
|
||||
tmp = sub_080A7EE0(0x23);
|
||||
tmp = CreateProjectile(0x23);
|
||||
if (tmp) {
|
||||
tmp->collisionLayer = 2;
|
||||
tmp->parent = this;
|
||||
|
||||
+1
-1
@@ -232,7 +232,7 @@ void sub_08032794(Entity* this) {
|
||||
void sub_080327C8(Entity* this) {
|
||||
Entity* child;
|
||||
|
||||
child = sub_0804A98C(this, 11, 0);
|
||||
child = CreateProjectileWithParent(this, 11, 0);
|
||||
if (child != NULL) {
|
||||
child->parent = this;
|
||||
this->attachedEntity = child;
|
||||
|
||||
+2
-2
@@ -117,7 +117,7 @@ void sub_0803C86C(Entity* this) {
|
||||
}
|
||||
|
||||
void Lakitu_Initialize(Entity* this) {
|
||||
Entity* cloud = sub_0804A98C(this, 17, 0);
|
||||
Entity* cloud = CreateProjectileWithParent(this, 17, 0);
|
||||
if (cloud == NULL) {
|
||||
return;
|
||||
}
|
||||
@@ -303,7 +303,7 @@ void Lakitu_SpawnLightning(Entity* this) {
|
||||
Entity* lightning;
|
||||
const OffsetCoords* offset;
|
||||
|
||||
lightning = sub_0804A98C(this, 18, 0);
|
||||
lightning = CreateProjectileWithParent(this, 18, 0);
|
||||
|
||||
if (lightning == NULL) {
|
||||
return;
|
||||
|
||||
@@ -779,7 +779,7 @@ NONMATCH("asm/non_matching/mazaal/sub_08034B38.inc", void sub_08034B38(Entity* t
|
||||
this->action = 3;
|
||||
InitializeAnimation(this, this->type + 3);
|
||||
} else {
|
||||
target = sub_080A7EE0(0xe);
|
||||
target = CreateProjectile(0xe);
|
||||
if (target != NULL) {
|
||||
target->type -= 2;
|
||||
if (target->type == 0) {
|
||||
|
||||
+1
-1
@@ -126,7 +126,7 @@ void Octorok_Move(Entity* this) {
|
||||
void Octorok_ShootNut(Entity* this) {
|
||||
GetNextFrame(this);
|
||||
if (this->frames.all & 1) {
|
||||
Entity* ent = sub_0804A98C(this, 1, 0);
|
||||
Entity* ent = CreateProjectileWithParent(this, 1, 0);
|
||||
if (ent) {
|
||||
const s8* off;
|
||||
ent->direction = this->direction;
|
||||
|
||||
+3
-3
@@ -170,7 +170,7 @@ void sub_080240B8(Entity* this) {
|
||||
Entity* ent;
|
||||
|
||||
this->field_0x82.HALF.HI = 0;
|
||||
ent = sub_0804A98C(this, 6, this->field_0x82.HALF.HI);
|
||||
ent = CreateProjectileWithParent(this, 6, this->field_0x82.HALF.HI);
|
||||
if (ent) {
|
||||
this->attachedEntity = ent;
|
||||
ent->parent = this;
|
||||
@@ -413,7 +413,7 @@ void sub_080244E8(Entity* this) {
|
||||
this->height.HALF.HI -= 0xe;
|
||||
this->field_0x78.HWORD -= 0xe;
|
||||
|
||||
ent = sub_0804A98C(this, 6, this->field_0x82.HALF.HI);
|
||||
ent = CreateProjectileWithParent(this, 6, this->field_0x82.HALF.HI);
|
||||
if (ent) {
|
||||
ent->parent = this;
|
||||
ent->height.HALF.HI += 0xe;
|
||||
@@ -436,7 +436,7 @@ void sub_080244E8(Entity* this) {
|
||||
this->height.HALF.HI -= 0xe;
|
||||
this->field_0x78.HWORD -= 0xe;
|
||||
|
||||
ent = sub_0804A98C(this, 6, this->field_0x82.HALF.HI);
|
||||
ent = CreateProjectileWithParent(this, 6, this->field_0x82.HALF.HI);
|
||||
if (ent) {
|
||||
ent->parent = this;
|
||||
ent->height.HALF.HI += 0xe;
|
||||
|
||||
@@ -94,7 +94,7 @@ void sub_08028314(Entity* this) {
|
||||
sub_08028604(this);
|
||||
}
|
||||
|
||||
pEVar2 = sub_080A7EE0(3);
|
||||
pEVar2 = CreateProjectile(3);
|
||||
if (pEVar2 != NULL) {
|
||||
pEVar2->parent = this;
|
||||
this->attachedEntity = pEVar2;
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -185,7 +185,7 @@ void sub_08044868(Entity* this) {
|
||||
if (*(u8*)&vaati->field_0x86 > 1) {
|
||||
u8 draw = this->spriteSettings.b.draw;
|
||||
if (draw == 1 && this->cutsceneBeh.HALF.LO == 0) {
|
||||
vaati = sub_0804A98C(this, 0x18, 0);
|
||||
vaati = CreateProjectileWithParent(this, 0x18, 0);
|
||||
if (vaati) {
|
||||
vaati->type2 = 1;
|
||||
vaati->parent = this;
|
||||
@@ -275,7 +275,7 @@ void sub_080449F8(Entity* this) {
|
||||
this->field_0x74.HALF.LO++;
|
||||
draw = this->spriteSettings.b.draw;
|
||||
if (draw) {
|
||||
vaati = sub_0804A98C(this, 0x1c, 0);
|
||||
vaati = CreateProjectileWithParent(this, 0x1c, 0);
|
||||
if (vaati) {
|
||||
vaati->y.HALF.HI += 4;
|
||||
vaati->parent = this;
|
||||
|
||||
@@ -0,0 +1,302 @@
|
||||
#include "global.h"
|
||||
#include "enemy.h"
|
||||
#include "audio.h"
|
||||
#include "random.h"
|
||||
#include "functions.h"
|
||||
|
||||
extern u32 sub_080002E0(u32, u32);
|
||||
extern s16 gUnk_080B4488[];
|
||||
|
||||
void VaatiEyesMacroFunction0(Entity*);
|
||||
void VaatiEyesMacroFunction1(Entity*);
|
||||
void VaatiEyesMacroFunction0Type0(Entity*);
|
||||
void VaatiEyesMacroFunction0Type1(Entity*);
|
||||
void VaatiEyesMacroFunction0Type2(Entity*);
|
||||
void VaatiEyesMacroFunction0Type3(Entity*);
|
||||
void VaatiEyesMacroFunction0Type0Action0(Entity*);
|
||||
void VaatiEyesMacroFunction0Type0Action1(Entity*);
|
||||
void VaatiEyesMacroFunction0Type1Action0(Entity*);
|
||||
void VaatiEyesMacroFunction0Type1Action1(Entity*);
|
||||
void sub_0802EF90(Entity*);
|
||||
void sub_0802EFB8(Entity*);
|
||||
void sub_0802EF58(Entity*);
|
||||
void sub_0802F04C(Entity*);
|
||||
|
||||
void (*const vaatiEyesMacroFunctions[])(Entity*) = {
|
||||
VaatiEyesMacroFunction0, VaatiEyesMacroFunction1, sub_08001324, sub_0804A7D4, sub_08001242, VaatiEyesMacroFunction0,
|
||||
};
|
||||
void (*const vaatiEyesMacroFunction0Types[])(Entity*) = {
|
||||
VaatiEyesMacroFunction0Type0,
|
||||
VaatiEyesMacroFunction0Type1,
|
||||
VaatiEyesMacroFunction0Type2,
|
||||
VaatiEyesMacroFunction0Type3,
|
||||
};
|
||||
void (*const vaatiEyesMacroFunction0Type0Actions[])(Entity*) = {
|
||||
VaatiEyesMacroFunction0Type0Action0,
|
||||
VaatiEyesMacroFunction0Type0Action1,
|
||||
};
|
||||
void (*const vaatiEyesMacroFunction0Type1Actions[])(Entity*) = {
|
||||
VaatiEyesMacroFunction0Type1Action0,
|
||||
VaatiEyesMacroFunction0Type1Action1,
|
||||
};
|
||||
const u8 gUnk_080CDE6C[] = { 0, 8, 0x18, 0 };
|
||||
const u8 gUnk_080CDE70[] = {
|
||||
9, 9, 8, 9, 8, 8, 8, 7, 7, 7, 6, 7, 6, 6, 6, 5, 5, 5, 12, 5, 12, 12, 12, 11, 11, 11, 10, 11, 10, 10, 10, 9,
|
||||
};
|
||||
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);
|
||||
}
|
||||
|
||||
void VaatiEyesMacroFunction0(Entity* this) {
|
||||
vaatiEyesMacroFunction0Types[this->type](this);
|
||||
if (this->type < 2) {
|
||||
sub_0802EF90(this);
|
||||
}
|
||||
}
|
||||
|
||||
void VaatiEyesMacroFunction1(Entity* this) {
|
||||
if (this->type == 0) {
|
||||
if (this->currentHealth == 0) {
|
||||
gScreenTransition.field_0x39 &= ~(1 << (gScreenTransition.field_0x3c + 2));
|
||||
}
|
||||
if (gRoomControls.roomID == 0) {
|
||||
gScreenTransition.field_0x3a = this->currentHealth;
|
||||
} else {
|
||||
gScreenTransition.field_0x3b = this->currentHealth;
|
||||
}
|
||||
if (this->field_0x78.HALF.HI != this->currentHealth) {
|
||||
EnqueueSFX(SFX_17A);
|
||||
}
|
||||
this->field_0x78.HALF.HI = this->currentHealth;
|
||||
} else {
|
||||
if (this->type == 1) {
|
||||
if (0 < this->iframes) {
|
||||
this->iframes *= -1;
|
||||
}
|
||||
if (this->currentHealth != 0xff) {
|
||||
EnqueueSFX(SFX_BUTTON_DEPRESS);
|
||||
}
|
||||
this->currentHealth = 0xff;
|
||||
}
|
||||
}
|
||||
if (this->field_0x43 != 0) {
|
||||
sub_0804A9FC(this, 0x1c);
|
||||
}
|
||||
sub_0804AA30(this, vaatiEyesMacroFunctions);
|
||||
}
|
||||
|
||||
void VaatiEyesMacroFunction0Type0(Entity* this) {
|
||||
vaatiEyesMacroFunction0Type0Actions[this->action](this);
|
||||
}
|
||||
|
||||
void VaatiEyesMacroFunction0Type0Action0(Entity* this) {
|
||||
Manager* manager;
|
||||
Entity* enemy;
|
||||
|
||||
if ((gEntCount < 0x47) && (manager = GetEmptyManager(), manager != NULL)) {
|
||||
manager->type = 9;
|
||||
manager->subtype = 0x34;
|
||||
manager->parent = (Manager*)this;
|
||||
AppendEntityToList((Entity*)manager, 8);
|
||||
enemy = CreateEnemy(VAATI_EYES_MACRO, 2);
|
||||
enemy->parent = this;
|
||||
this->action = 1;
|
||||
if (gRoomControls.roomID == 0) {
|
||||
this->field_0x78.HALF.HI = this->currentHealth = gScreenTransition.field_0x3a;
|
||||
} else {
|
||||
this->field_0x78.HALF.HI = this->currentHealth = gScreenTransition.field_0x3b;
|
||||
}
|
||||
this->field_0x78.HALF.LO = Random();
|
||||
sub_0802EFB8(this);
|
||||
InitializeAnimation(this, 0);
|
||||
sub_0802EF58(this);
|
||||
}
|
||||
}
|
||||
|
||||
void VaatiEyesMacroFunction0Type0Action1(Entity* this) {
|
||||
sub_0802F04C(this);
|
||||
GetNextFrame(this);
|
||||
}
|
||||
|
||||
void VaatiEyesMacroFunction0Type1(Entity* this) {
|
||||
vaatiEyesMacroFunction0Type1Actions[this->action](this);
|
||||
}
|
||||
|
||||
void VaatiEyesMacroFunction0Type1Action0(Entity* this) {
|
||||
Entity* entity;
|
||||
u32 rand;
|
||||
|
||||
if (gEntCount < 0x47) {
|
||||
entity = CreateEnemy(VAATI_EYES_MACRO, 3);
|
||||
entity->parent = this;
|
||||
this->action = 1;
|
||||
rand = Random();
|
||||
this->actionDelay = (rand & 3) + 1;
|
||||
this->field_0x78.HALF.LO = Random() >> 8;
|
||||
this->direction = gUnk_080CDE6C[rand >> 0x10 & 3];
|
||||
InitializeAnimation(this, 1);
|
||||
}
|
||||
}
|
||||
|
||||
void VaatiEyesMacroFunction0Type1Action1(Entity* this) {
|
||||
if (this->parent->next == NULL) {
|
||||
this->flags &= 0x7f;
|
||||
this->currentHealth = 0;
|
||||
} else {
|
||||
sub_0802F04C(this);
|
||||
GetNextFrame(this);
|
||||
}
|
||||
}
|
||||
|
||||
typedef struct xy {
|
||||
u8 x;
|
||||
u8 y;
|
||||
} xy;
|
||||
|
||||
void VaatiEyesMacroFunction0Type2(Entity* this) {
|
||||
u32 uVar2;
|
||||
xy* temp;
|
||||
|
||||
if (this->parent->next == NULL) {
|
||||
DeleteThisEntity();
|
||||
}
|
||||
if (this->action == 0) {
|
||||
this->action = 1;
|
||||
this->animationState = 0xff;
|
||||
}
|
||||
CopyPositionAndSpriteOffset(this->parent, this);
|
||||
uVar2 = (GetFacingDirection(this, &gPlayerEntity) + 1) & 0x1e;
|
||||
temp = (xy*)&gUnk_080CDE70[uVar2];
|
||||
if (temp->x != this->frameIndex) {
|
||||
if (temp->y != this->frameIndex) {
|
||||
this->frameIndex = temp->x;
|
||||
}
|
||||
}
|
||||
this->y.HALF.HI++;
|
||||
this->spriteOffsetY -= 1;
|
||||
}
|
||||
|
||||
void VaatiEyesMacroFunction0Type3(Entity* this) {
|
||||
if (this->parent->next == NULL) {
|
||||
DeleteThisEntity();
|
||||
}
|
||||
if (this->action == 0) {
|
||||
this->action = 1;
|
||||
this->frameIndex = 0x11;
|
||||
this->spritePriority.b0 = 6;
|
||||
}
|
||||
CopyPositionAndSpriteOffset(this->parent, this);
|
||||
this->height.HALF.HI = 0;
|
||||
}
|
||||
|
||||
void sub_0802EF58(Entity* this) {
|
||||
Entity* entity;
|
||||
u32 i;
|
||||
|
||||
for (i = 0; i < 7; i++) {
|
||||
entity = CreateEnemy(VAATI_EYES_MACRO, 1);
|
||||
if (entity != NULL) {
|
||||
entity->type2 = i;
|
||||
entity->collisionLayer = 1;
|
||||
entity->parent = this;
|
||||
UpdateSpriteForCollisionLayer(entity);
|
||||
CopyPosition(this, entity);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void sub_0802EF90(Entity* this) {
|
||||
this->height.HALF.HI = gUnk_080CDE90[this->field_0x78.HALF.LO++ >> 3 & 7];
|
||||
}
|
||||
|
||||
void sub_0802EFB8(Entity* this) {
|
||||
u32 uVar1;
|
||||
u32 rand;
|
||||
u32 uVar3;
|
||||
int iVar4;
|
||||
|
||||
rand = Random();
|
||||
if ((rand >> 0x10 & 3) != 0) {
|
||||
uVar1 = rand & 0x18;
|
||||
} else {
|
||||
uVar3 = GetFacingDirection(&gPlayerEntity, this);
|
||||
uVar1 = (uVar3 + 4) & 0x18;
|
||||
}
|
||||
iVar4 = sub_080002E0(TILE(this->x.HALF.HI, this->y.HALF.HI) + gUnk_080B4488[((uVar1) >> 3)], 1);
|
||||
if (iVar4 != 0) {
|
||||
this->direction = 0xff;
|
||||
} else {
|
||||
this->actionDelay = (rand & 3) + 1;
|
||||
this->direction = (uVar1 & 0x18);
|
||||
this->speed = gUnk_080CDE98[rand >> 0x18 & 3];
|
||||
}
|
||||
}
|
||||
|
||||
void sub_0802F04C(Entity* this) {
|
||||
s32 oldX;
|
||||
s32 oldY;
|
||||
|
||||
oldX = this->x.HALF.HI;
|
||||
oldY = this->y.HALF.HI;
|
||||
if (ProcessMovement(this) == 0) {
|
||||
sub_0802EFB8(this);
|
||||
return;
|
||||
}
|
||||
switch (this->direction >> 3) {
|
||||
case 0:
|
||||
if (((oldY & 0xf) > 8) && ((this->y.HALF.HI & 0xf) < 9)) {
|
||||
this->actionDelay--;
|
||||
oldY = (this->y.HALF.HI & 0xfff0) + 8;
|
||||
}
|
||||
if (this->actionDelay == 0) {
|
||||
this->x.HALF.HI = oldX;
|
||||
this->y.HALF.HI = oldY;
|
||||
} else {
|
||||
return;
|
||||
}
|
||||
break;
|
||||
case 1:
|
||||
if (((oldX & 0xf) < 8) && ((this->x.HALF.HI & 0xf) >= 8)) {
|
||||
this->actionDelay--;
|
||||
oldX = (this->x.HALF.HI & 0xfff0) + 8;
|
||||
}
|
||||
if (this->actionDelay == 0) {
|
||||
this->x.HALF.HI = oldX;
|
||||
this->y.HALF.HI = oldY;
|
||||
} else {
|
||||
return;
|
||||
}
|
||||
break;
|
||||
case 2:
|
||||
if (((oldY & 0xf) < 8) && ((this->y.HALF.HI & 0xf) >= 8)) {
|
||||
this->actionDelay--;
|
||||
oldY = (this->y.HALF.HI & 0xfff0) + 8;
|
||||
}
|
||||
if (this->actionDelay == 0) {
|
||||
this->x.HALF.HI = oldX;
|
||||
this->y.HALF.HI = oldY;
|
||||
} else {
|
||||
return;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
if (((oldX & 0xf) >= 9) && ((this->x.HALF.HI & 0xf) < 9)) {
|
||||
this->actionDelay--;
|
||||
oldX = (this->x.HALF.HI & 0xfff0) + 8;
|
||||
}
|
||||
if (this->actionDelay == 0) {
|
||||
this->x.HALF.HI = oldX;
|
||||
this->y.HALF.HI = oldY;
|
||||
} else {
|
||||
return;
|
||||
}
|
||||
break;
|
||||
}
|
||||
sub_0802EFB8(this);
|
||||
}
|
||||
@@ -0,0 +1,279 @@
|
||||
#include "global.h"
|
||||
#include "enemy.h"
|
||||
#include "random.h"
|
||||
#include "functions.h"
|
||||
|
||||
extern bool32 PlayerInRange(Entity*, u32, u32);
|
||||
extern void DoExitTransition(ScreenTransitionData*);
|
||||
extern u32 sub_080002E0(u32, u32);
|
||||
extern Entity* gUnk_020000B0;
|
||||
extern const ScreenTransitionData gUnk_0813AB94;
|
||||
|
||||
bool32 sub_0803E4A0(Entity*);
|
||||
void VaatiProjectileFunction0(Entity*);
|
||||
void VaatiProjectileFunction1(Entity*);
|
||||
void sub_08001328(Entity*);
|
||||
void VaatiProjectileFunction3(Entity*);
|
||||
void VaatiProjectileNoop(Entity*);
|
||||
void VaatiProjectileFunction0Action0(Entity*);
|
||||
void VaatiProjectileFunction0Action1(Entity*);
|
||||
void VaatiProjectileFunction0Action2(Entity*);
|
||||
void VaatiProjectileFunction0Action3(Entity*);
|
||||
void VaatiProjectileFunction0Action4(Entity*);
|
||||
void VaatiProjectileFunction0Action5(Entity*);
|
||||
void VaatiProjectileFunction0Action6(Entity*);
|
||||
void VaatiProjectileFunction0Action7(Entity*);
|
||||
void VaatiProjectileFunction0Action8(Entity*);
|
||||
void VaatiProjectileFunction0Action9(Entity*);
|
||||
void sub_0803E444(Entity*);
|
||||
void sub_0803E480(Entity*);
|
||||
void sub_0803E4D8(Entity*);
|
||||
|
||||
void (*const vaatiProjectileFunctions[])(Entity*) = {
|
||||
VaatiProjectileFunction0, VaatiProjectileFunction1, sub_08001328, VaatiProjectileFunction3, sub_08001242,
|
||||
VaatiProjectileNoop,
|
||||
};
|
||||
void (*const vaatiProjectileFunction0Actions[])(Entity*) = {
|
||||
VaatiProjectileFunction0Action0, VaatiProjectileFunction0Action1, VaatiProjectileFunction0Action2,
|
||||
VaatiProjectileFunction0Action3, VaatiProjectileFunction0Action4, VaatiProjectileFunction0Action5,
|
||||
VaatiProjectileFunction0Action6, VaatiProjectileFunction0Action7, VaatiProjectileFunction0Action8,
|
||||
VaatiProjectileFunction0Action9,
|
||||
};
|
||||
|
||||
void VaatiProjectile(Entity* this) {
|
||||
if (sub_0803E4A0(this)) {
|
||||
this->flags &= 0x7f;
|
||||
this->currentHealth = 0;
|
||||
this->parent = NULL;
|
||||
}
|
||||
vaatiProjectileFunctions[GetNextFunction(this)](this);
|
||||
}
|
||||
|
||||
void VaatiProjectileFunction0(Entity* this) {
|
||||
vaatiProjectileFunction0Actions[this->action](this);
|
||||
}
|
||||
|
||||
void VaatiProjectileFunction1(Entity* this) {
|
||||
Entity* entity;
|
||||
|
||||
if (this->bitfield == 0x80) {
|
||||
#ifndef EU
|
||||
if (this->currentHealth != 0) {
|
||||
#endif
|
||||
this->action = 5;
|
||||
this->flags = this->flags & 0x7f;
|
||||
this->spritePriority.b1 = 0;
|
||||
gPlayerEntity.flags &= 0x7f;
|
||||
gPlayerEntity.spriteOrientation.flipY = this->spriteOrientation.flipY;
|
||||
gPlayerEntity.spriteRendering.b3 = this->spriteRendering.b3;
|
||||
sub_0803E444(this);
|
||||
#ifndef EU
|
||||
sub_08078A90(2);
|
||||
entity = this->parent;
|
||||
if (entity != NULL) {
|
||||
entity->flags = entity->flags & 0x7f;
|
||||
}
|
||||
} else {
|
||||
gPlayerState.flags.all &= 0xfffffeff; // using b.unk8 does not match
|
||||
entity = &gPlayerEntity;
|
||||
entity->flags = gPlayerEntity.flags | 0x80;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
sub_0804AA30(this, vaatiProjectileFunctions);
|
||||
}
|
||||
|
||||
void VaatiProjectileFunction3(Entity* this) {
|
||||
if (this->parent != NULL) {
|
||||
this->parent->field_0xf--;
|
||||
this->parent = NULL;
|
||||
}
|
||||
sub_0804A7D4(this);
|
||||
}
|
||||
|
||||
void VaatiProjectileNoop(Entity* this) {
|
||||
}
|
||||
|
||||
void VaatiProjectileFunction0Action0(Entity* this) {
|
||||
Entity* entity;
|
||||
|
||||
if (this->type == 0) {
|
||||
entity = CreateEnemy(VAATI_PROJECTILE, 1);
|
||||
if (entity != NULL) {
|
||||
entity->parent = this;
|
||||
this->attachedEntity = entity;
|
||||
if (this->type2 == 0) {
|
||||
this->action = 1;
|
||||
this->height.HALF.HI = -0x18;
|
||||
} else {
|
||||
this->action = 9;
|
||||
this->height.HALF.HI = -0x80;
|
||||
this->flags2 = 1;
|
||||
}
|
||||
InitializeAnimation(this, 0);
|
||||
}
|
||||
} else {
|
||||
this->action = 8;
|
||||
this->flags = this->flags & 0x7f;
|
||||
this->spriteOffsetY = 1;
|
||||
this->spriteOrientation.flipY = this->parent->spriteOrientation.flipY;
|
||||
this->spriteRendering.b3 = this->parent->spriteRendering.b3;
|
||||
this->spritePriority.b1 = 0;
|
||||
PositionRelative(this->parent, this, 0, -0x10000);
|
||||
InitializeAnimation(this, 1);
|
||||
}
|
||||
}
|
||||
|
||||
void VaatiProjectileFunction0Action1(Entity* this) {
|
||||
sub_0803E480(this);
|
||||
if (PlayerInRange(this, 0, 8) != 0) {
|
||||
this->action = 2;
|
||||
this->actionDelay = 10;
|
||||
InitializeAnimation(this->attachedEntity, 2);
|
||||
} else {
|
||||
if (gUnk_020000B0 != NULL) {
|
||||
sub_08004596(this, GetFacingDirection(this, gUnk_020000B0));
|
||||
sub_0806F69C(this);
|
||||
}
|
||||
}
|
||||
GetNextFrame(this);
|
||||
}
|
||||
|
||||
void VaatiProjectileFunction0Action2(Entity* this) {
|
||||
if (this->actionDelay != 0) {
|
||||
this->actionDelay--;
|
||||
} else {
|
||||
if (++this->height.HALF.HI == 0) {
|
||||
this->action = 3;
|
||||
}
|
||||
}
|
||||
GetNextFrame(this);
|
||||
}
|
||||
|
||||
void VaatiProjectileFunction0Action3(Entity* this) {
|
||||
if ((this->attachedEntity->frames.b.f3) != 0) {
|
||||
if (--this->height.HALF.HI <= -0x18) {
|
||||
this->action = 4;
|
||||
this->actionDelay = (Random() & 0xf) + 0xf;
|
||||
InitializeAnimation(this->attachedEntity, 1);
|
||||
}
|
||||
GetNextFrame(this);
|
||||
}
|
||||
}
|
||||
|
||||
void VaatiProjectileFunction0Action4(Entity* this) {
|
||||
if (--this->actionDelay == 0) {
|
||||
this->action = 1;
|
||||
this->direction = GetFacingDirection(this, &gPlayerEntity);
|
||||
}
|
||||
GetNextFrame(this);
|
||||
}
|
||||
|
||||
void VaatiProjectileFunction0Action5(Entity* this) {
|
||||
sub_0803E444(this);
|
||||
if (this->actionDelay != 0) {
|
||||
this->actionDelay--;
|
||||
} else {
|
||||
if (-0x18 < --this->height.HALF.HI) {
|
||||
return;
|
||||
}
|
||||
this->action = 6;
|
||||
this->actionDelay = 0x14;
|
||||
}
|
||||
}
|
||||
|
||||
void VaatiProjectileFunction0Action6(Entity* this) {
|
||||
if (--this->actionDelay == 0) {
|
||||
this->action = 7;
|
||||
this->direction = 0x10;
|
||||
this->speed = 0x300;
|
||||
}
|
||||
sub_0803E444(this);
|
||||
}
|
||||
|
||||
void VaatiProjectileFunction0Action7(Entity* this) {
|
||||
sub_0803E444(this);
|
||||
sub_0806F69C(this);
|
||||
sub_0803E4D8(this);
|
||||
if ((gRoomControls.roomOriginY + gRoomControls.height + -0x10) <= this->y.HALF.HI) {
|
||||
sub_0805E5A8();
|
||||
DoExitTransition((ScreenTransitionData*)&gUnk_0813AB94);
|
||||
}
|
||||
}
|
||||
|
||||
void VaatiProjectileFunction0Action8(Entity* this) {
|
||||
if (this->parent->next == NULL) {
|
||||
DeleteThisEntity();
|
||||
}
|
||||
PositionRelative(this->parent, this, 0, -0x10000);
|
||||
GetNextFrame(this);
|
||||
}
|
||||
|
||||
void VaatiProjectileFunction0Action9(Entity* this) {
|
||||
this->x.HALF.HI = gPlayerEntity.x.HALF.HI;
|
||||
this->y.HALF.HI = gPlayerEntity.y.HALF.HI;
|
||||
if (this->height.HALF.HI < -8) {
|
||||
if (this->animIndex != 2) {
|
||||
this->actionDelay = 0;
|
||||
InitializeAnimation(this->attachedEntity, 2);
|
||||
}
|
||||
VaatiProjectileFunction0Action2(this);
|
||||
} else {
|
||||
this->height.HALF.HI += 8;
|
||||
}
|
||||
}
|
||||
|
||||
void sub_0803E444(Entity* this) {
|
||||
ResetPlayer();
|
||||
gPlayerState.field_0x1a[0] = gPlayerState.field_0x1a[0] | 0x80;
|
||||
gPlayerState.field_0xa = gPlayerState.field_0xa | 0x80;
|
||||
sub_0806FA90(this, this->field_0x4c, 0, -2);
|
||||
gPlayerEntity.spriteOffsetY += 0xe;
|
||||
}
|
||||
|
||||
void sub_0803E480(Entity* this) {
|
||||
if (this->field_0x78.HWORD >= 0x4b1) {
|
||||
this->speed = 0x180;
|
||||
} else {
|
||||
this->field_0x78.HWORD++;
|
||||
}
|
||||
}
|
||||
|
||||
bool32 sub_0803E4A0(Entity* this) {
|
||||
#ifdef EU
|
||||
bool32 ret;
|
||||
if (gScreenTransition.field_0x39 == 0) {
|
||||
return TRUE;
|
||||
} else {
|
||||
if (this->parent == NULL) {
|
||||
return FALSE;
|
||||
}
|
||||
ret = this->parent->next == NULL;
|
||||
}
|
||||
return ret;
|
||||
#else
|
||||
bool32 ret;
|
||||
if (gScreenTransition.field_0x39 != 0) {
|
||||
if (this->parent == NULL) {
|
||||
return FALSE;
|
||||
}
|
||||
if (this->parent->currentHealth == 0) {
|
||||
return TRUE;
|
||||
} else {
|
||||
ret = this->parent->next == NULL;
|
||||
}
|
||||
} else {
|
||||
return TRUE;
|
||||
}
|
||||
return ret;
|
||||
#endif
|
||||
}
|
||||
|
||||
void sub_0803E4D8(Entity* this) {
|
||||
u32 tile;
|
||||
|
||||
tile = TILE(this->x.HALF.HI, this->y.HALF.HI + 8);
|
||||
if (sub_080002E0(tile, gPlayerEntity.collisionLayer) != 0xff) {
|
||||
SetTile(0x4074, tile, gPlayerEntity.collisionLayer);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,902 @@
|
||||
#include "global.h"
|
||||
#include "enemy.h"
|
||||
#include "coord.h"
|
||||
#include "flags.h"
|
||||
#include "random.h"
|
||||
#include "audio.h"
|
||||
#include "area.h"
|
||||
#include "functions.h"
|
||||
|
||||
extern void sub_080AEFB4(Entity*);
|
||||
extern u8 gEntCount;
|
||||
|
||||
void VaatiRebornEnemyType0PreAction(Entity*);
|
||||
void VaatiRebornEnemyType1PreAction(Entity*);
|
||||
void VaatiRebornEnemyType0Action0(Entity*);
|
||||
void VaatiRebornEnemyType0Action1(Entity*);
|
||||
void VaatiRebornEnemyType0Action2(Entity*);
|
||||
void VaatiRebornEnemyType0Action3(Entity*);
|
||||
void VaatiRebornEnemyType0Action4(Entity*);
|
||||
void VaatiRebornEnemyType0Action5(Entity*);
|
||||
void VaatiRebornEnemyType0Action6(Entity*);
|
||||
void VaatiRebornEnemyType0Action7(Entity*);
|
||||
void VaatiRebornEnemyType1Action0(Entity*);
|
||||
void VaatiRebornEnemyType1Action1(Entity*);
|
||||
void VaatiRebornEnemyType2Action0(Entity*);
|
||||
void VaatiRebornEnemyType2Action1(Entity*);
|
||||
void VaatiRebornEnemyType3Action0(Entity*);
|
||||
void VaatiRebornEnemyType3Action1(Entity*);
|
||||
void sub_0803DD78(Entity*);
|
||||
u32 sub_0803DEE0(Entity*);
|
||||
u32 sub_0803E028(Entity*);
|
||||
void sub_0803DC0C(Entity*);
|
||||
|
||||
typedef struct xy {
|
||||
s8 x;
|
||||
s8 y;
|
||||
} PACKED xy;
|
||||
|
||||
void (*const vaatiRebornEnemyType0Actions[])(Entity*) = {
|
||||
VaatiRebornEnemyType0Action0, VaatiRebornEnemyType0Action1, VaatiRebornEnemyType0Action2,
|
||||
VaatiRebornEnemyType0Action3, VaatiRebornEnemyType0Action4, VaatiRebornEnemyType0Action5,
|
||||
VaatiRebornEnemyType0Action6, VaatiRebornEnemyType0Action7,
|
||||
};
|
||||
void (*const vaatiRebornEnemyType1Actions[])(Entity*) = {
|
||||
VaatiRebornEnemyType1Action0,
|
||||
VaatiRebornEnemyType1Action1,
|
||||
};
|
||||
void (*const vaatiRebornEnemyType2Actions[])(Entity*) = {
|
||||
VaatiRebornEnemyType2Action0,
|
||||
VaatiRebornEnemyType2Action1,
|
||||
};
|
||||
void (*const vaatiRebornEnemyType3Actions[])(Entity*) = {
|
||||
VaatiRebornEnemyType3Action0,
|
||||
VaatiRebornEnemyType3Action1,
|
||||
};
|
||||
|
||||
const xy gUnk_080D04A8[] = { { 16, -43 }, { -16, -43 } };
|
||||
const Coords gUnk_080D04AC[] = { { .HALF = { 0x58, 0x60 } },
|
||||
{ .HALF = { 0x58, 0x90 } },
|
||||
{ .HALF = { 0x98, 0x78 } },
|
||||
{ .HALF = { 0xd8, 0x60 } },
|
||||
{ .HALF = { 0xd8, 0x90 } } };
|
||||
const u8 gUnk_080D04C0[] = { 2, 0, 0, 2, 2, 2, 4, 4 };
|
||||
const xy gUnk_080D04C8[] = { { 10, -29 }, { -10, -29 }, { 15, -21 }, { -15, -21 } };
|
||||
#ifdef EU
|
||||
const u8 gUnk_080D04D0[] = { -12, -20, -32 };
|
||||
#else
|
||||
const u8 gUnk_080D04D0[] = { -24, -40, -48 };
|
||||
#endif
|
||||
const u8 gUnk_080D04D3[] = { 0, 1, 0, -1 };
|
||||
|
||||
void VaatiRebornEnemy(Entity* this) {
|
||||
switch (this->type) {
|
||||
case 0:
|
||||
VaatiRebornEnemyType0PreAction(this);
|
||||
vaatiRebornEnemyType0Actions[this->action](this);
|
||||
break;
|
||||
case 1:
|
||||
VaatiRebornEnemyType1PreAction(this);
|
||||
vaatiRebornEnemyType1Actions[this->action](this);
|
||||
break;
|
||||
case 2:
|
||||
vaatiRebornEnemyType2Actions[this->action](this);
|
||||
break;
|
||||
case 3:
|
||||
vaatiRebornEnemyType3Actions[this->action](this);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void VaatiRebornEnemyType0Action0(Entity* this) {
|
||||
s32 i;
|
||||
Entity* entity;
|
||||
const xy* ptr;
|
||||
|
||||
if (CheckLocalFlag(0x7b) != 0) {
|
||||
DeleteThisEntity();
|
||||
}
|
||||
sub_0804A720(this);
|
||||
if (CheckRoomFlag(0) && (gEntCount < 0x42)) {
|
||||
ClearRoomFlag(0);
|
||||
this->action = 3;
|
||||
this->field_0x74.HALF.LO = -1;
|
||||
this->actionDelay = 0;
|
||||
this->field_0x76.HALF.LO = 0;
|
||||
this->spriteSettings.b.draw = 1;
|
||||
this->direction = 0xff;
|
||||
this->spritePriority.b0 = 4;
|
||||
this->height.WORD = 0;
|
||||
this->field_0x80.HALF.LO = 2;
|
||||
this->field_0x86.HALF.LO = 0;
|
||||
this->cutsceneBeh.HALF.HI = 0x30;
|
||||
this->cutsceneBeh.HALF.LO = -1;
|
||||
this->field_0x86.HALF.HI = 0;
|
||||
this->field_0x82.HALF.LO = 0;
|
||||
this->field_0x82.HALF.HI = 0;
|
||||
*(u32*)(&this->field_0x78) = this->x.WORD;
|
||||
this->field_0x7c = this->y;
|
||||
entity = CreateEnemy(VAATI_REBORN_ENEMY, 1);
|
||||
entity->parent = this;
|
||||
this->attachedEntity = entity;
|
||||
for (i = 0; i < 6; i++) {
|
||||
entity = CreateEnemy(VAATI_BALL, 0);
|
||||
entity->parent = this;
|
||||
entity->field_0x78.HALF.HI = i;
|
||||
}
|
||||
for (i = 0; i < 4; i++) {
|
||||
entity = CreateEnemy(VAATI_REBORN_ENEMY, 3);
|
||||
entity->parent = this;
|
||||
entity->actionDelay = i;
|
||||
}
|
||||
for (i = 0; i < 2; i++) {
|
||||
entity = CreateEnemy(VAATI_BALL, 1);
|
||||
entity->parent = this;
|
||||
entity->spriteSettings.b.flipX = i;
|
||||
ptr = &gUnk_080D04A8[i];
|
||||
PositionRelative(this, entity, ptr->x << 0x10, ptr->y << 0x10);
|
||||
}
|
||||
InitAnimationForceUpdate(this, 0);
|
||||
}
|
||||
}
|
||||
|
||||
void VaatiRebornEnemyType0Action1(Entity* this) {
|
||||
if (this->actionDelay != 0) {
|
||||
if (--this->actionDelay == 0) {
|
||||
if ((this->field_0x74.HALF.LO & 0x70) == 0) {
|
||||
if (this->attachedEntity->actionDelay == 0) {
|
||||
sub_0803DD78(this);
|
||||
if (this->field_0x74.HALF.HI != 0) {
|
||||
this->action = 2;
|
||||
this->field_0x74.HALF.LO = 0;
|
||||
this->actionDelay = 0x10;
|
||||
this->direction = 0xff;
|
||||
} else {
|
||||
if ((this->field_0x86.HALF.LO != 0) || (this->field_0x80.HALF.LO != 0)) {
|
||||
this->direction = ((Random() & 0x80) >> 3) | 8;
|
||||
} else {
|
||||
this->direction = 0xff;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
this->actionDelay = 2;
|
||||
}
|
||||
} else {
|
||||
this->action = 3;
|
||||
this->field_0x74.HALF.HI = this->field_0x74.HALF.LO & 0x80;
|
||||
this->field_0x74.HALF.LO = 0;
|
||||
this->actionDelay = 0xc0;
|
||||
this->direction = 0xff;
|
||||
this->spriteSettings.b.draw = 1;
|
||||
InitAnimationForceUpdate(this, 0);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (--this->field_0x76.HALF.HI == 0) {
|
||||
switch (sub_0803DEE0(this)) {
|
||||
case 0:
|
||||
this->action = 4;
|
||||
this->actionDelay = 0xa0;
|
||||
this->direction = 0xff;
|
||||
this->cutsceneBeh.HALF.LO = 0xff;
|
||||
InitAnimationForceUpdate(this, 1);
|
||||
break;
|
||||
case 1:
|
||||
this->action = 6;
|
||||
this->field_0x74.HALF.LO = 0;
|
||||
this->actionDelay = 0;
|
||||
this->direction = 0xff;
|
||||
break;
|
||||
case 3:
|
||||
this->action = 5;
|
||||
this->field_0x74.HALF.LO = 0;
|
||||
this->field_0xf = 0x20;
|
||||
this->direction = 0xff;
|
||||
break;
|
||||
case 2:
|
||||
this->field_0x74.HALF.LO = 0;
|
||||
this->actionDelay = 0x20;
|
||||
if ((this->field_0x86.HALF.LO != 0) || (this->field_0x80.HALF.LO != 0)) {
|
||||
this->direction = ((Random() & 0x80) >> 3) | 8;
|
||||
} else {
|
||||
this->direction = 0xff;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (this->attachedEntity->actionDelay == 0) {
|
||||
this->cutsceneBeh.HALF.HI++;
|
||||
if ((this->cutsceneBeh.HALF.HI & 3) == 0) {
|
||||
switch (this->cutsceneBeh.HALF.HI & 0x30) {
|
||||
case 0:
|
||||
case 0x30:
|
||||
this->y.HALF.HI++;
|
||||
break;
|
||||
case 0x10:
|
||||
case 0x20:
|
||||
this->y.HALF.HI--;
|
||||
}
|
||||
}
|
||||
sub_080AEFB4(this);
|
||||
}
|
||||
}
|
||||
UpdateAnimationSingleFrame(this);
|
||||
}
|
||||
|
||||
void VaatiRebornEnemyType0Action2(Entity* this) {
|
||||
const Coords* ptr;
|
||||
|
||||
switch (this->field_0x74.HALF.LO) {
|
||||
case 0:
|
||||
if (--this->actionDelay == 0) {
|
||||
this->field_0x74.HALF.LO++;
|
||||
this->actionDelay = 0x20;
|
||||
InitAnimationForceUpdate(this, 3);
|
||||
SoundReq(SFX_19B);
|
||||
}
|
||||
break;
|
||||
case 1:
|
||||
if ((this->frames.all & 0x80) != 0) {
|
||||
this->field_0x74.HALF.LO = 2;
|
||||
this->spriteSettings.b.draw = 0;
|
||||
this->actionDelay = 0x10;
|
||||
}
|
||||
break;
|
||||
case 2:
|
||||
if (--this->actionDelay == 0) {
|
||||
this->field_0x74.HALF.LO++;
|
||||
if (sub_0803E028(this) == 0) {
|
||||
s32 tmp;
|
||||
this->field_0x80.HALF.HI += 1 + (Random() & 3);
|
||||
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->spriteSettings.b.draw = 1;
|
||||
this->actionDelay = 0x20;
|
||||
InitAnimationForceUpdate(this, 4);
|
||||
SoundReq(SFX_F5);
|
||||
}
|
||||
break;
|
||||
case 3:
|
||||
if ((this->frames.all & 0x80) != 0) {
|
||||
this->spriteSettings.b.draw = 1;
|
||||
if (4 < this->field_0x80.HALF.HI) {
|
||||
this->x.HALF.HI = gPlayerEntity.x.HALF.HI;
|
||||
this->y.HALF.HI = gPlayerEntity.y.HALF.HI - 0x18;
|
||||
}
|
||||
if (--this->field_0x76.HALF.HI == 0) {
|
||||
this->action = 1;
|
||||
this->actionDelay = 1;
|
||||
} else {
|
||||
this->field_0x74.HALF.LO = 0;
|
||||
this->actionDelay = 0x10;
|
||||
}
|
||||
InitAnimationForceUpdate(this, 0);
|
||||
}
|
||||
break;
|
||||
}
|
||||
UpdateAnimationSingleFrame(this);
|
||||
}
|
||||
|
||||
void VaatiRebornEnemyType0Action3(Entity* this) {
|
||||
u8 temp;
|
||||
|
||||
switch (this->field_0x74.HALF.LO) {
|
||||
case 0xfe:
|
||||
this->field_0x74.HALF.LO = 0;
|
||||
this->actionDelay = 1;
|
||||
break;
|
||||
case 0xff:
|
||||
if (this->height.HALF.HI != -4) {
|
||||
this->height.WORD -= 0x2000;
|
||||
}
|
||||
if (this->actionDelay == 2) {
|
||||
this->field_0x74.HALF.LO = 0xfe;
|
||||
}
|
||||
break;
|
||||
case 0:
|
||||
if (--this->actionDelay == 0) {
|
||||
this->field_0x74.HALF.LO++;
|
||||
if ((this->field_0x74.HALF.HI & 0x80) != 0) {
|
||||
temp = 0x14;
|
||||
} else {
|
||||
temp = 0x20;
|
||||
}
|
||||
this->actionDelay = temp;
|
||||
this->field_0x80.HALF.LO = ((this->field_0x86.HALF.LO + 1) >> 1) * 2 + 2;
|
||||
}
|
||||
break;
|
||||
case 1:
|
||||
if (--this->actionDelay == 0) {
|
||||
this->field_0x74.HALF.LO++;
|
||||
if ((this->field_0x74.HALF.HI & 0x80) == 0) {
|
||||
SoundReq(SFX_1B0);
|
||||
}
|
||||
InitAnimationForceUpdate(this, 1);
|
||||
}
|
||||
break;
|
||||
case 2:
|
||||
if ((this->frames.all & 0x80) != 0) {
|
||||
this->field_0x74.HALF.LO = 3;
|
||||
InitAnimationForceUpdate(this, 0);
|
||||
}
|
||||
break;
|
||||
case 3:
|
||||
this->action = 1;
|
||||
this->field_0x74.HALF.LO = 0;
|
||||
this->actionDelay = 1;
|
||||
break;
|
||||
}
|
||||
UpdateAnimationSingleFrame(this);
|
||||
}
|
||||
|
||||
void VaatiRebornEnemyType0Action4(Entity* this) {
|
||||
u32 index;
|
||||
Entity* entity;
|
||||
|
||||
if (--this->actionDelay == 0) {
|
||||
this->action = 1;
|
||||
this->cutsceneBeh.HALF.LO = 0xff;
|
||||
this->actionDelay = 1;
|
||||
this->direction = (this->direction + 0x10) & 0x1f;
|
||||
InitAnimationForceUpdate(this, 0);
|
||||
} else {
|
||||
if ((this->frames.all & 0x10) != 0) {
|
||||
this->frames.all &= 0xef;
|
||||
if (this->cutsceneBeh.HALF.LO == 0xff) {
|
||||
index = Direction8RoundUp(GetFacingDirection(this, &gPlayerEntity));
|
||||
this->cutsceneBeh.HALF.LO = gUnk_080D04C0[index >> 2];
|
||||
this->field_0xf = 0;
|
||||
}
|
||||
if ((this->field_0xf < 0x10) &&
|
||||
(entity = CreateProjectileWithParent(this, 0x1a, this->cutsceneBeh.HALF.LO), entity != NULL)) {
|
||||
entity->field_0xf = this->field_0xf;
|
||||
entity->parent = this;
|
||||
entity->height.HALF.HI = this->height.HALF.HI;
|
||||
this->field_0xf = this->field_0xf + 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
UpdateAnimationSingleFrame(this);
|
||||
}
|
||||
|
||||
void VaatiRebornEnemyType0Action5(Entity* this) {
|
||||
u32 uVar3;
|
||||
|
||||
if (this->field_0x80.HALF.LO == 0) {
|
||||
this->action = 1;
|
||||
this->actionDelay = 1;
|
||||
this->direction = 0xff;
|
||||
InitAnimationForceUpdate(this, 0);
|
||||
return;
|
||||
}
|
||||
|
||||
switch (this->field_0x74.HALF.LO) {
|
||||
case 0:
|
||||
if (--this->field_0xf == 0) {
|
||||
this->field_0x74.HALF.LO++;
|
||||
InitAnimationForceUpdate(this, 1);
|
||||
}
|
||||
break;
|
||||
case 1:
|
||||
if ((this->frames.all & 0x10) != 0) {
|
||||
this->field_0x74.HALF.LO = 2;
|
||||
this->field_0xf = (Random() & 0x3f) + 0x40;
|
||||
SoundReq(SFX_SUMMON);
|
||||
}
|
||||
break;
|
||||
case 2:
|
||||
if (--this->field_0xf == 0) {
|
||||
if (!((this->field_0x86.HALF.LO < 2) || (3 < this->field_0x86.HALF.HI)) && (Random() & 0x10) != 0) {
|
||||
this->field_0x86.HALF.HI++;
|
||||
this->field_0xf = (Random() & 0x3f) + 0x40;
|
||||
uVar3 = GetFacingDirection(this, &gPlayerEntity);
|
||||
this->direction = (uVar3 & 0x10) | 8;
|
||||
} else {
|
||||
this->field_0x74.HALF.LO++;
|
||||
this->field_0x86.HALF.HI = 0;
|
||||
this->field_0xf = 0x30;
|
||||
InitAnimationForceUpdate(this, 0);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 3:
|
||||
if (--this->field_0xf == 0) {
|
||||
this->action = 1;
|
||||
this->field_0x74.HALF.LO = 0;
|
||||
this->actionDelay = 1;
|
||||
this->direction = 0xff;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
if (this->field_0x86.HALF.HI != 0) {
|
||||
sub_080AEFB4(this);
|
||||
}
|
||||
UpdateAnimationSingleFrame(this);
|
||||
}
|
||||
|
||||
void VaatiRebornEnemyType0Action6(Entity* this) {
|
||||
Entity* target;
|
||||
|
||||
if (this->field_0x80.HALF.LO == 0) {
|
||||
this->action = 1;
|
||||
this->actionDelay = 1;
|
||||
return;
|
||||
}
|
||||
|
||||
switch (this->field_0x74.HALF.LO) {
|
||||
case 0:
|
||||
if (this->actionDelay != 0) {
|
||||
this->field_0x74.HALF.LO = 1;
|
||||
this->actionDelay = 0x70;
|
||||
}
|
||||
break;
|
||||
case 1:
|
||||
if (--this->actionDelay == 0) {
|
||||
this->field_0x74.HALF.LO++;
|
||||
SoundReq(SFX_150);
|
||||
target = CreateProjectileWithParent(this, 0x18, 0);
|
||||
if (target != NULL) {
|
||||
PositionRelative(this, target, 0, -0x100000);
|
||||
target->parent = this;
|
||||
}
|
||||
} else if (this->actionDelay == 0x40) {
|
||||
SoundReq(SFX_196);
|
||||
}
|
||||
break;
|
||||
case 2:
|
||||
if (this->field_0xf != 0) {
|
||||
this->field_0xf = 0;
|
||||
}
|
||||
break;
|
||||
case 3:
|
||||
if (this->field_0xf == 0) {
|
||||
this->field_0xf = 1;
|
||||
SoundReq(SFX_14F);
|
||||
}
|
||||
if (this->actionDelay) {
|
||||
this->action = 1;
|
||||
this->field_0x74.HALF.LO = 0;
|
||||
this->actionDelay = 1;
|
||||
}
|
||||
break;
|
||||
}
|
||||
UpdateAnimationSingleFrame(this);
|
||||
}
|
||||
|
||||
void VaatiRebornEnemyType0Action7(Entity* this) {
|
||||
Entity* fx;
|
||||
u32 tmp;
|
||||
|
||||
if (this->actionDelay != 0) {
|
||||
if (--this->actionDelay == 0) {
|
||||
SetRoomFlag(1);
|
||||
} else {
|
||||
if ((this->actionDelay & 7) == 0) {
|
||||
fx = CreateFx(this, 2, 0);
|
||||
if (fx != NULL) {
|
||||
tmp = Random() & 0x3f3f;
|
||||
fx->x.HALF.HI = ((tmp & 0xff) - 0x20) + fx->x.HALF.HI;
|
||||
fx->y.HALF.HI = ((tmp >> 8) & 0xff) - 0x20 + fx->y.HALF.HI;
|
||||
#ifndef EU
|
||||
fx->spritePriority.b0 = 2;
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void VaatiRebornEnemyType1Action0(Entity* this) {
|
||||
Entity* enemy;
|
||||
|
||||
this->action = 1;
|
||||
this->field_0x74.HALF.LO = 0;
|
||||
this->field_0x74.HALF.HI = 1;
|
||||
this->actionDelay = 0;
|
||||
this->spriteOffsetY = -1;
|
||||
PositionRelative(this->parent, this, 0, 0x10000);
|
||||
enemy = CreateEnemy(VAATI_REBORN_ENEMY, 2);
|
||||
enemy->parent = this;
|
||||
enemy->attachedEntity = this->parent;
|
||||
InitAnimationForceUpdate(this, this->field_0x74.HALF.LO);
|
||||
}
|
||||
|
||||
void VaatiRebornEnemyType1Action1(Entity* this) {
|
||||
Entity* parent;
|
||||
|
||||
parent = this->parent;
|
||||
if (this->field_0x74.HALF.LO == 0) {
|
||||
if (parent->field_0x80.HALF.LO == 0) {
|
||||
this->field_0x74.HALF.LO = 1;
|
||||
this->damageType = 0x30;
|
||||
InitAnimationForceUpdate(this, this->field_0x74.HALF.LO);
|
||||
}
|
||||
} else {
|
||||
if (parent->field_0x80.HALF.LO != 0) {
|
||||
this->field_0x74.HALF.LO = 0;
|
||||
this->damageType = 0x2f;
|
||||
InitAnimationForceUpdate(this, this->field_0x74.HALF.LO);
|
||||
} else {
|
||||
if (((this->bitfield & 0x80) != 0) && (0 < this->iframes)) {
|
||||
parent->iframes = this->iframes;
|
||||
parent->bitfield = this->bitfield;
|
||||
}
|
||||
if ((this->frames.all & 0x40) != 0) {
|
||||
InitAnimationForceUpdate(this, 2);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (this->field_0x74.HALF.HI == 0) {
|
||||
if (parent->action != 2) {
|
||||
this->field_0x74.HALF.HI = 1;
|
||||
this->flags |= 0x80;
|
||||
}
|
||||
} else {
|
||||
if (parent->action == 2) {
|
||||
this->field_0x74.HALF.HI = 0;
|
||||
this->flags &= 0x7f;
|
||||
}
|
||||
}
|
||||
this->spriteSettings.b.draw = parent->spriteSettings.b.draw;
|
||||
this->spriteOffsetX = parent->spriteOffsetX;
|
||||
PositionRelative(this->parent, this, 0, 0x10000);
|
||||
UpdateAnimationSingleFrame(this);
|
||||
}
|
||||
|
||||
void VaatiRebornEnemyType2Action0(Entity* this) {
|
||||
Entity* source;
|
||||
|
||||
source = this->parent->parent;
|
||||
this->action = 1;
|
||||
this->field_0x74.HALF.LO = 1;
|
||||
this->field_0x74.HALF.HI = 0;
|
||||
this->spriteOffsetY = -2;
|
||||
this->direction = 0xff;
|
||||
PositionRelative(source, this, 0, 0x20000);
|
||||
InitAnimationForceUpdate(this, 2);
|
||||
}
|
||||
|
||||
void VaatiRebornEnemyType2Action1(Entity* this) {
|
||||
u8 parentDirection;
|
||||
Entity* parent;
|
||||
|
||||
parent = this->parent;
|
||||
if (parent->field_0x74.HALF.LO == 0) {
|
||||
if (this->field_0x74.HALF.LO != 0) {
|
||||
this->field_0x74.HALF.LO = 0;
|
||||
}
|
||||
parentDirection = parent->parent->direction;
|
||||
if (parentDirection != 0xff) {
|
||||
if (this->field_0x74.HALF.HI == 0) {
|
||||
this->field_0x74.HALF.HI = 1;
|
||||
}
|
||||
if (parentDirection != this->direction) {
|
||||
this->direction = parentDirection;
|
||||
InitAnimationForceUpdate(this, parentDirection >> 3);
|
||||
}
|
||||
} else {
|
||||
if (this->field_0x74.HALF.HI != 0) {
|
||||
this->field_0x74.HALF.HI = 0;
|
||||
InitAnimationForceUpdate(this, 0);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (this->field_0x74.HALF.LO == 0) {
|
||||
this->field_0x74.HALF.LO = 1;
|
||||
InitAnimationForceUpdate(this, 2);
|
||||
}
|
||||
}
|
||||
this->spriteSettings.b.draw = parent->spriteSettings.b.draw;
|
||||
this->spriteOffsetX = parent->spriteOffsetX;
|
||||
PositionRelative(parent->parent, this, 0, 0x20000);
|
||||
UpdateAnimationSingleFrame(this);
|
||||
}
|
||||
|
||||
void VaatiRebornEnemyType3Action0(Entity* this) {
|
||||
this->action = 1;
|
||||
this->field_0x74.HALF.LO = 0;
|
||||
this->direction = 0xff;
|
||||
this->spriteOffsetY = -1;
|
||||
InitAnimationForceUpdate(this, this->field_0x74.HALF.LO);
|
||||
sub_0803DC0C(this);
|
||||
}
|
||||
|
||||
void VaatiRebornEnemyType3Action1(Entity* this) {
|
||||
Entity* parent = this->parent;
|
||||
|
||||
if (this->parent->direction != 0xff) {
|
||||
if (this->field_0x74.HALF.LO == 0) {
|
||||
this->field_0x74.HALF.LO = 1;
|
||||
}
|
||||
if (parent->direction != this->direction) {
|
||||
this->direction = parent->direction;
|
||||
InitAnimationForceUpdate(this, this->direction >> 3);
|
||||
}
|
||||
} else {
|
||||
if (this->field_0x74.HALF.LO != 0) {
|
||||
this->field_0x74.HALF.LO = 0;
|
||||
this->direction = 0xff;
|
||||
InitAnimationForceUpdate(this, 2);
|
||||
}
|
||||
}
|
||||
sub_0803DC0C(this);
|
||||
}
|
||||
|
||||
void sub_0803DC0C(Entity* this) {
|
||||
Entity* parent;
|
||||
const xy* tmp;
|
||||
|
||||
parent = this->parent;
|
||||
tmp = &gUnk_080D04C8[this->actionDelay];
|
||||
this->spriteSettings.b.draw = parent->spriteSettings.b.draw;
|
||||
this->spriteOffsetX = parent->spriteOffsetX;
|
||||
PositionRelative(parent, this, tmp->x << 0x10, (tmp->y + 1) * 0x10000);
|
||||
UpdateAnimationSingleFrame(this);
|
||||
}
|
||||
|
||||
void VaatiRebornEnemyType1PreAction(Entity* this) {
|
||||
Entity* parent;
|
||||
|
||||
if (this->damageType != 0x30) {
|
||||
return;
|
||||
}
|
||||
parent = this->parent;
|
||||
this->field_0x76.HALF.HI = 0;
|
||||
if ((this->bitfield & 0x80) != 0) {
|
||||
if (gUnk_080D04D0[parent->field_0x86.HALF.LO] > this->currentHealth) {
|
||||
if (2 < ++parent->field_0x86.HALF.LO) {
|
||||
this->flags &= 0x7f;
|
||||
parent->action = 7;
|
||||
parent->flags &= 0x7f;
|
||||
parent->actionDelay = 0x80;
|
||||
parent->spriteOffsetX = 0;
|
||||
parent->direction = -1;
|
||||
this->actionDelay = 0;
|
||||
SoundReq(SONG_STOP_BGM);
|
||||
gArea.musicIndex = gArea.pMusicIndex;
|
||||
return;
|
||||
}
|
||||
this->actionDelay = 1;
|
||||
this->field_0x76.HALF.HI = 0xff;
|
||||
}
|
||||
if (0 < this->iframes) {
|
||||
SoundReq(0x127);
|
||||
sub_08080964(0xc, 1);
|
||||
if (this->actionDelay == 0)
|
||||
this->actionDelay = 0x48;
|
||||
}
|
||||
}
|
||||
if (this->actionDelay != 0) {
|
||||
if (--this->actionDelay == 0) {
|
||||
this->damageType = 0x2f;
|
||||
this->field_0x74.HALF.LO = 1;
|
||||
if (this->field_0x76.HALF.HI == 0) {
|
||||
parent->field_0x74.HALF.LO = 0xf0;
|
||||
} else {
|
||||
parent->field_0x74.HALF.LO = 0x70;
|
||||
this->currentHealth = 0xff;
|
||||
}
|
||||
parent->action = 1;
|
||||
parent->actionDelay = 1;
|
||||
InitAnimationForceUpdate(this, 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void sub_0803DD78(Entity* this) {
|
||||
u32 random_number;
|
||||
|
||||
random_number = ((u32)Random() & 0x7c) >> 2;
|
||||
|
||||
switch (this->field_0x86.HALF.LO) {
|
||||
case 0:
|
||||
if (this->field_0x80.HALF.LO == 0) {
|
||||
this->field_0x74.HALF.HI = 0;
|
||||
this->field_0x76.HALF.HI = 0x50;
|
||||
break;
|
||||
}
|
||||
switch (this->field_0x82.HALF.HI) {
|
||||
case 0:
|
||||
case 2:
|
||||
case 4:
|
||||
this->field_0x74.HALF.HI = 0;
|
||||
this->field_0x76.HALF.HI = 0x50;
|
||||
break;
|
||||
case 1:
|
||||
case 3:
|
||||
case 5:
|
||||
this->field_0x74.HALF.HI = 0;
|
||||
this->field_0x76.HALF.HI = 1;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case 1:
|
||||
switch (this->field_0x82.HALF.HI) {
|
||||
case 1:
|
||||
case 3:
|
||||
case 5:
|
||||
this->field_0x74.HALF.HI = 0;
|
||||
this->field_0x76.HALF.HI = 1;
|
||||
break;
|
||||
case 2:
|
||||
if ((random_number & 8) != 0) {
|
||||
this->field_0x74.HALF.HI = 0;
|
||||
this->field_0x76.HALF.HI = 1;
|
||||
} else {
|
||||
this->field_0x74.HALF.HI = 0;
|
||||
this->field_0x76.HALF.HI = 0x50;
|
||||
}
|
||||
break;
|
||||
case 4:
|
||||
if ((random_number & 8) != 0) {
|
||||
this->field_0x74.HALF.HI = 0;
|
||||
this->field_0x76.HALF.HI = 0x50;
|
||||
break;
|
||||
}
|
||||
case 0:
|
||||
this->field_0x74.HALF.HI = 1;
|
||||
this->field_0x76.HALF.HI = 1;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case 2:
|
||||
switch (this->field_0x82.HALF.HI) {
|
||||
case 2:
|
||||
if ((random_number & 0xf) < 3) {
|
||||
this->field_0x74.HALF.HI = 0;
|
||||
this->field_0x76.HALF.HI = 1;
|
||||
} else {
|
||||
this->field_0x74.HALF.HI = 1;
|
||||
this->field_0x76.HALF.HI = 1;
|
||||
}
|
||||
break;
|
||||
case 0:
|
||||
this->field_0x74.HALF.HI = 1;
|
||||
this->field_0x76.HALF.HI = 1;
|
||||
break;
|
||||
case 4:
|
||||
if (9 < random_number) {
|
||||
this->field_0x74.HALF.HI = 2;
|
||||
this->field_0x76.HALF.HI = (Random() & 1) + 2;
|
||||
break;
|
||||
}
|
||||
case 1:
|
||||
case 3:
|
||||
case 5:
|
||||
this->field_0x74.HALF.HI = 0;
|
||||
this->field_0x76.HALF.HI = 1;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
this->field_0x82.HALF.HI = (this->field_0x82.HALF.HI + 1) % 6;
|
||||
}
|
||||
|
||||
u32 sub_0803DEE0(Entity* this) {
|
||||
u32 randomValue;
|
||||
u32 ret;
|
||||
|
||||
ret = 2;
|
||||
randomValue = (Random() & 0xf8) >> 3;
|
||||
if (this->field_0x80.HALF.LO) {
|
||||
switch (this->field_0x86.HALF.LO) {
|
||||
case 0:
|
||||
ret = this->field_0x82.HALF.LO & 1;
|
||||
this->field_0x82.HALF.LO = (this->field_0x82.HALF.LO + 1) & 3;
|
||||
break;
|
||||
case 1:
|
||||
switch (this->field_0x82.HALF.LO) {
|
||||
case 0:
|
||||
case 2:
|
||||
ret = 3;
|
||||
break;
|
||||
case 1:
|
||||
case 3:
|
||||
ret = 1;
|
||||
break;
|
||||
case 4:
|
||||
if (randomValue & 8) {
|
||||
ret = 3;
|
||||
} else {
|
||||
ret = 0;
|
||||
}
|
||||
break;
|
||||
}
|
||||
this->field_0x82.HALF.LO = (this->field_0x82.HALF.LO + 1) % 5;
|
||||
break;
|
||||
case 2:
|
||||
switch (this->field_0x82.HALF.LO) {
|
||||
case 0:
|
||||
case 3:
|
||||
ret = 3;
|
||||
break;
|
||||
case 1:
|
||||
ret = 0;
|
||||
if (randomValue > 5) {
|
||||
ret = 3;
|
||||
}
|
||||
break;
|
||||
case 2:
|
||||
ret = 0;
|
||||
if (randomValue < 10) {
|
||||
ret = 3;
|
||||
}
|
||||
break;
|
||||
case 4:
|
||||
ret = 0;
|
||||
break;
|
||||
default:
|
||||
ret = 2;
|
||||
}
|
||||
this->field_0x82.HALF.LO = (this->field_0x82.HALF.LO + 1) % 5;
|
||||
break;
|
||||
}
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
void VaatiRebornEnemyType0PreAction(Entity* this) {
|
||||
u32 bVar1;
|
||||
|
||||
if (this->action != 0) {
|
||||
*(u32*)&this->field_0x78 = this->x.WORD;
|
||||
this->field_0x7c = this->y;
|
||||
}
|
||||
if (this->field_0x76.HALF.LO == 0) {
|
||||
if ((this->direction == 0xff) || sub_08049FA0(this)) {
|
||||
if (this->field_0x80.HALF.LO == 0) {
|
||||
this->animationState = (this->animationState + 1) & 3;
|
||||
this->spriteOffsetX = gUnk_080D04D3[this->animationState];
|
||||
}
|
||||
return;
|
||||
}
|
||||
bVar1 = sub_08049EE4(this);
|
||||
this->direction = (bVar1 & 0x10) | 8;
|
||||
this->field_0x76.HALF.LO = 0x10;
|
||||
} else {
|
||||
this->field_0x76.HALF.LO--;
|
||||
}
|
||||
if (this->field_0x80.HALF.LO == 0) {
|
||||
this->animationState = (this->animationState + 1) & 3;
|
||||
this->spriteOffsetX = gUnk_080D04D3[this->animationState];
|
||||
}
|
||||
}
|
||||
|
||||
u32 sub_0803E028(Entity* this) {
|
||||
u32 ret;
|
||||
s32 tmp;
|
||||
|
||||
ret = 0;
|
||||
if ((this->field_0x74.HALF.HI != 2) && ((Random() & 1) != 0)) {
|
||||
return 0;
|
||||
}
|
||||
if (this->field_0x76.HALF.HI != 1) {
|
||||
return ret;
|
||||
}
|
||||
tmp = gRoomControls.roomOriginX + 0x58;
|
||||
if (tmp > gPlayerEntity.x.HALF.HI) {
|
||||
return ret;
|
||||
}
|
||||
tmp = gRoomControls.roomOriginY + 0x58;
|
||||
if (tmp > gPlayerEntity.x.HALF.HI) {
|
||||
return ret;
|
||||
}
|
||||
tmp = gRoomControls.roomOriginY + 0xf8;
|
||||
if (tmp >= gPlayerEntity.x.HALF.HI) {
|
||||
this->field_0x80.HALF.HI += 5;
|
||||
ret = 1;
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,333 @@
|
||||
#include "entity.h"
|
||||
#include "enemy.h"
|
||||
#include "audio.h"
|
||||
#include "textbox.h"
|
||||
#include "coord.h"
|
||||
#include "functions.h"
|
||||
|
||||
void sub_08045A00(Entity*);
|
||||
void sub_08045A28(Entity*);
|
||||
|
||||
void VaatiTransfiguredEyeFunction0(Entity*);
|
||||
void VaatiTransfiguredEyeFunction1(Entity*);
|
||||
void VaatiTransfiguredEyeNoop(Entity*);
|
||||
void VaatiTransfiguredEyeFunction0Action0(Entity*);
|
||||
void VaatiTransfiguredEyeFunction0Action1(Entity*);
|
||||
void VaatiTransfiguredEyeFunction0Action2(Entity*);
|
||||
void VaatiTransfiguredEyeFunction0Action3(Entity*);
|
||||
void VaatiTransfiguredEyeFunction0Action4(Entity*);
|
||||
|
||||
void (*const vaatiTransfiguredEyeFunctions[])(Entity*) = {
|
||||
VaatiTransfiguredEyeFunction0,
|
||||
VaatiTransfiguredEyeFunction1,
|
||||
VaatiTransfiguredEyeFunction0,
|
||||
sub_0804A7D4,
|
||||
sub_08001242,
|
||||
VaatiTransfiguredEyeNoop,
|
||||
};
|
||||
|
||||
void (*const vaatiTransfiguredEyeFunction0Actions[])(Entity*) = {
|
||||
VaatiTransfiguredEyeFunction0Action0, VaatiTransfiguredEyeFunction0Action1, VaatiTransfiguredEyeFunction0Action2,
|
||||
VaatiTransfiguredEyeFunction0Action3, VaatiTransfiguredEyeFunction0Action4,
|
||||
};
|
||||
|
||||
struct xy {
|
||||
s8 x;
|
||||
s8 y;
|
||||
} PACKED;
|
||||
|
||||
const struct xy gUnk_080D18B4[] = { { 0xe8, 0xf6 }, { 0xf6, 0xe8 }, { 0x0a, 0xe8 }, { 0x18, 0xf6 },
|
||||
{ 0x18, 0x0a }, { 0x0a, 0x18 }, { 0xf6, 0x18 }, { 0xe8, 0x0a } };
|
||||
|
||||
void VaatiTransfiguredEye(Entity* this) {
|
||||
EnemyFunctionHandler(this, vaatiTransfiguredEyeFunctions);
|
||||
}
|
||||
|
||||
void VaatiTransfiguredEyeFunction0(Entity* this) {
|
||||
vaatiTransfiguredEyeFunction0Actions[this->action](this);
|
||||
}
|
||||
|
||||
void VaatiTransfiguredEyeFunction1(Entity* this) {
|
||||
u8 bVar1;
|
||||
Entity* pEVar4;
|
||||
|
||||
if (this->type != 0) {
|
||||
pEVar4 = this->parent->parent;
|
||||
if ((this->bitfield & 0x80) != 0) {
|
||||
bVar1 = this->bitfield & 0x3f;
|
||||
if ((bVar1 == 0xe) || (bVar1 == 0x15)) {
|
||||
|
||||
if (this->field_0x80.HALF.HI == 0) {
|
||||
this->action = 3;
|
||||
this->field_0x80.HALF.HI += 1;
|
||||
InitializeAnimation(this, (this->type << 3) | (this->actionDelay + 2));
|
||||
InitializeAnimation(this->parent, (this->parent->type << 3) | (this->actionDelay + 2));
|
||||
}
|
||||
if (this->actionDelay != 0) {
|
||||
SoundReq(SFX_17A);
|
||||
} else {
|
||||
SoundReq(SFX_ITEM_GLOVES_KNOCKBACK);
|
||||
}
|
||||
} else {
|
||||
if (this->currentHealth != 0xff) {
|
||||
this->currentHealth = 0xff;
|
||||
if (this->actionDelay != 0 && (pEVar4->field_0x80.HALF.HI != 0)) {
|
||||
pEVar4->field_0x76.HALF.LO |= (1 << this->type2);
|
||||
if (this->cutsceneBeh.HALF.HI == 0) {
|
||||
this->cutsceneBeh.HALF.HI += 1;
|
||||
InitializeAnimation(this, this->type << 3 | 6);
|
||||
InitializeAnimation(this->parent, this->parent->type << 3 | 6);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
sub_0804AA30(this, vaatiTransfiguredEyeFunctions);
|
||||
}
|
||||
|
||||
void VaatiTransfiguredEyeNoop(Entity* this) {
|
||||
}
|
||||
|
||||
void VaatiTransfiguredEyeFunction0Action0(Entity* this) {
|
||||
Entity* child;
|
||||
u8 bVar2;
|
||||
|
||||
bVar2 = gTextBox.doTextBox & 0x7f;
|
||||
if ((gTextBox.doTextBox & 0x7f) == 0) {
|
||||
this->action = 1;
|
||||
this->spriteSettings.b.draw = 0;
|
||||
this->field_0x80.HALF.LO = bVar2;
|
||||
this->field_0x80.HALF.HI = bVar2;
|
||||
this->cutsceneBeh.HALF.HI = bVar2;
|
||||
this->field_0xf = bVar2;
|
||||
this->field_0x82.HALF.LO = 0x30;
|
||||
this->field_0x82.HALF.HI = bVar2;
|
||||
if (this->type == 0) {
|
||||
sub_08045A00(this);
|
||||
child = CreateEnemy(VAATI_TRANSFIGURED_EYE, 1);
|
||||
if (child != NULL) {
|
||||
child->parent = this;
|
||||
this->attachedEntity = child;
|
||||
child->actionDelay = this->actionDelay;
|
||||
child->type2 = this->type2;
|
||||
CopyPosition(this, child);
|
||||
}
|
||||
} else {
|
||||
this->spriteOffsetY = 1;
|
||||
}
|
||||
InitializeAnimation(this, (u32)this->type << 3 | 1);
|
||||
}
|
||||
}
|
||||
|
||||
void VaatiTransfiguredEyeFunction0Action1(Entity* this) {
|
||||
sub_08045A28(this);
|
||||
if (this->field_0x82.HALF.LO == 0) {
|
||||
if ((this->frames.all & 0x80) != 0) {
|
||||
if (this->type != 0) {
|
||||
this->flags |= 0x80;
|
||||
}
|
||||
this->action = 2;
|
||||
InitializeAnimation(this, this->type << 3);
|
||||
}
|
||||
} else {
|
||||
if (--this->field_0x82.HALF.LO == 0) {
|
||||
this->spriteSettings.b.draw = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void VaatiTransfiguredEyeFunction0Action2(Entity* this) {
|
||||
Entity* parent;
|
||||
|
||||
sub_08045A28(this);
|
||||
parent = this->parent;
|
||||
if (this->type != 0) {
|
||||
parent = parent->parent;
|
||||
}
|
||||
if ((parent->action == 3) && (parent->field_0x80.HALF.LO == 1)) {
|
||||
this->action = 4;
|
||||
this->field_0xf = 0;
|
||||
if (this->type != 0) {
|
||||
this->flags &= 0x7f;
|
||||
if (this->actionDelay != 0) {
|
||||
InitializeAnimation(this, this->type << 3 | 5);
|
||||
InitializeAnimation(this->parent, this->parent->type << 3 | 5);
|
||||
} else {
|
||||
InitializeAnimation(this, this->type << 3 | 4);
|
||||
InitializeAnimation(this->parent, this->parent->type << 3 | 4);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void VaatiTransfiguredEyeFunction0Action3(Entity* this) {
|
||||
sub_08045A28(this);
|
||||
if ((this->frames.all & 0x80) != 0) {
|
||||
this->action = 2;
|
||||
if (this->type != 0) {
|
||||
if (this->actionDelay == 0) {
|
||||
this->damageType = 0x32;
|
||||
} else {
|
||||
this->parent->parent->field_0x76.HALF.LO |= (1 << this->type2);
|
||||
this->damageType = 0x31;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void VaatiTransfiguredEyeFunction0Action4(Entity* this) {
|
||||
Entity* parent;
|
||||
|
||||
sub_08045A28(this);
|
||||
if (this->field_0xf == 0) {
|
||||
if ((this->frames.all & 0x80) != 0) {
|
||||
this->field_0xf = 0x20;
|
||||
}
|
||||
} else {
|
||||
parent = this->parent;
|
||||
if (this->type != 0) {
|
||||
parent = parent->parent;
|
||||
}
|
||||
if ((parent->animationState < 3) && (parent->action != 3)) {
|
||||
this->action = 1;
|
||||
this->field_0xf = 0;
|
||||
this->field_0x80.HALF.HI = 0;
|
||||
this->cutsceneBeh.HALF.HI = 0;
|
||||
if (this->type != 0) {
|
||||
this->damageType = 0x33;
|
||||
}
|
||||
if ((parent->field_0x74.HALF.HI >> this->type2 & 1U) != 0) {
|
||||
this->actionDelay = 1;
|
||||
} else {
|
||||
this->actionDelay = 0;
|
||||
}
|
||||
InitializeAnimation(this, this->type << 3 | 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void sub_08045A00(Entity* this) {
|
||||
const struct xy* t = &gUnk_080D18B4[this->type2];
|
||||
PositionRelative(this->parent, this, t->x << 0x10, (t->y + 3) * 0x10000);
|
||||
}
|
||||
|
||||
void sub_08045A28(Entity* this) {
|
||||
u32 frames;
|
||||
u32 type;
|
||||
|
||||
if (this->field_0x82.HALF.LO == 0) {
|
||||
GetNextFrame(this);
|
||||
}
|
||||
frames = this->frames.all & 0x70;
|
||||
type = this->type;
|
||||
if (type == 0) {
|
||||
sub_08045A00(this);
|
||||
switch (this->field_0x82.HALF.HI) {
|
||||
case 0:
|
||||
switch (frames) {
|
||||
case 0x20:
|
||||
this->field_0x82.HALF.HI = 1;
|
||||
sub_0801D2B4(this, 0x13e);
|
||||
break;
|
||||
case 0x00:
|
||||
case 0x40:
|
||||
this->field_0x82.HALF.HI = 2;
|
||||
sub_0801D2B4(this, 0x13f);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case 1:
|
||||
switch (frames) {
|
||||
case 0x10:
|
||||
this->field_0x82.HALF.HI = type;
|
||||
sub_0801D2B4(this, 0x13b);
|
||||
break;
|
||||
case 0:
|
||||
this->field_0x82.HALF.HI = 2;
|
||||
sub_0801D2B4(this, 0x13f);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case 2:
|
||||
switch (frames) {
|
||||
case 0x20:
|
||||
this->field_0x82.HALF.HI = 1;
|
||||
sub_0801D2B4(this, 0x13e);
|
||||
break;
|
||||
case 0x10:
|
||||
this->field_0x82.HALF.HI = 0;
|
||||
sub_0801D2B4(this, 0x13b);
|
||||
break;
|
||||
case 0x40:
|
||||
this->field_0x82.HALF.HI = 2;
|
||||
sub_0801D2B4(this, 0x13f);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case 3:
|
||||
switch (frames) {
|
||||
case 0:
|
||||
this->field_0x82.HALF.HI = 2;
|
||||
sub_0801D2B4(this, 0x13f);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
PositionRelative(this->parent, this, 0, -0x10000);
|
||||
switch (this->field_0x82.HALF.HI) {
|
||||
case 0:
|
||||
switch (this->frames.all & 0x70) {
|
||||
case 0x10:
|
||||
this->field_0x82.HALF.HI = 2;
|
||||
sub_0801D2B4(this, 0x13b);
|
||||
break;
|
||||
case 0x20:
|
||||
this->field_0x82.HALF.HI = 1;
|
||||
sub_0801D2B4(this, 0x13e);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case 1: {
|
||||
u32 temp = this->frames.all & 0x70;
|
||||
switch (temp) {
|
||||
case 0:
|
||||
this->field_0x82.HALF.HI = temp;
|
||||
sub_0801D2B4(this, 0x13f);
|
||||
break;
|
||||
case 0x10:
|
||||
this->field_0x82.HALF.HI = 2;
|
||||
sub_0801D2B4(this, 0x13b);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
} break;
|
||||
case 2:
|
||||
switch (this->frames.all & 0x70) {
|
||||
case 0:
|
||||
this->field_0x82.HALF.HI = this->frames.all & 0x70;
|
||||
sub_0801D2B4(this, 0x13f);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,211 @@
|
||||
#include "entity.h"
|
||||
#include "audio.h"
|
||||
#include "structures.h"
|
||||
#include "functions.h"
|
||||
|
||||
void sub_080485D8(Entity*);
|
||||
void sub_080485FC(Entity*);
|
||||
void VaatiWrathEyeAction0(Entity*);
|
||||
void VaatiWrathEyeAction1(Entity*);
|
||||
void VaatiWrathEyeAction2(Entity*);
|
||||
void VaatiWrathEyeAction3(Entity*);
|
||||
void VaatiWrathEyeAction4(Entity*);
|
||||
void VaatiWrathEyeAction5(Entity*);
|
||||
void VaatiWrathEyeAction6(Entity*);
|
||||
void VaatiWrathEyeAction7(Entity*);
|
||||
void VaatiWrathEyeAction8(Entity*);
|
||||
void VaatiWrathEyeAction9(Entity*);
|
||||
|
||||
void (*const vaatiWrathEyeActions[])(Entity*) = {
|
||||
VaatiWrathEyeAction0, VaatiWrathEyeAction1, VaatiWrathEyeAction2, VaatiWrathEyeAction3, VaatiWrathEyeAction4,
|
||||
VaatiWrathEyeAction5, VaatiWrathEyeAction6, VaatiWrathEyeAction7, VaatiWrathEyeAction8, VaatiWrathEyeAction9,
|
||||
};
|
||||
|
||||
const s8 gUnk_080D1D70[] = { 0xee, 0x01, 0xfa, 0x04, 0x06, 0x04, 0x13, 0x01 };
|
||||
|
||||
const s8 gUnk_080D1D78[] = { 0xfd, 0xfc, 0xfb, 0xfa, 0xf9, 0xfa, 0xfb, 0xfc, 0xfc, 0xfd, 0xfc,
|
||||
0xfb, 0xfa, 0xf9, 0xfa, 0xfb, 0xfb, 0xfc, 0xfd, 0xfc, 0xfb, 0xfa,
|
||||
0xf9, 0xfa, 0xfa, 0xfb, 0xfc, 0xfd, 0xfc, 0xfb, 0xfa, 0xf9 };
|
||||
|
||||
const s8 gUnk_080D1D98[] = { 0xe8, 0x04, 0xf8, 0x08, 0x08, 0x08, 0x18, 0x04 };
|
||||
|
||||
void VaatiWrathEye(Entity* this) {
|
||||
if (this->parent->next == NULL) {
|
||||
DeleteThisEntity();
|
||||
}
|
||||
vaatiWrathEyeActions[this->action](this);
|
||||
}
|
||||
|
||||
void VaatiWrathEyeAction0(Entity* this) {
|
||||
if ((gScreenTransition.field_0x38 & 1) != 0) {
|
||||
this->action = 2;
|
||||
InitializeAnimation(this, 1);
|
||||
} else {
|
||||
this->action = 1;
|
||||
InitializeAnimation(this, 0);
|
||||
SoundReq(SFX_166);
|
||||
}
|
||||
sub_080485D8(this);
|
||||
}
|
||||
|
||||
void VaatiWrathEyeAction1(Entity* this) {
|
||||
sub_080485D8(this);
|
||||
GetNextFrame(this);
|
||||
if ((this->frames.all & 0x80) != 0) {
|
||||
this->action = 2;
|
||||
InitializeAnimation(this, 1);
|
||||
}
|
||||
}
|
||||
|
||||
void VaatiWrathEyeAction2(Entity* this) {
|
||||
sub_080485D8(this);
|
||||
if ((gScreenTransition.field_0x39 & 3) == 0) {
|
||||
this->action = 3;
|
||||
this->flags |= 0x80;
|
||||
this->speed = 0x80;
|
||||
}
|
||||
}
|
||||
|
||||
void VaatiWrathEyeAction3(Entity* this) {
|
||||
u32 direction;
|
||||
Entity* parent;
|
||||
u32 x;
|
||||
u32 y;
|
||||
|
||||
const s8* ptr;
|
||||
|
||||
parent = this->parent;
|
||||
if (parent->field_0x78.HALF.HI != 0) {
|
||||
sub_080485D8(this);
|
||||
} else {
|
||||
ptr = &gUnk_080D1D98[this->type * 2];
|
||||
x = parent->x.HALF.HI + ptr[0];
|
||||
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);
|
||||
this->height.HALF.HI = this->parent->height.HALF.HI;
|
||||
if ((this->x.HALF.HI == x) && (this->y.HALF.HI == y)) {
|
||||
this->action = 4;
|
||||
this->actionDelay = 0x3c;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void VaatiWrathEyeAction4(Entity* this) {
|
||||
sub_080485FC(this);
|
||||
if (this->actionDelay != 0) {
|
||||
if (--this->actionDelay == 0) {
|
||||
InitializeAnimation(this, 3);
|
||||
}
|
||||
} else {
|
||||
GetNextFrame(this);
|
||||
if ((this->frames.all & 0x80) != 0) {
|
||||
this->action = 5;
|
||||
this->actionDelay = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void VaatiWrathEyeAction5(Entity* this) {
|
||||
if (this->actionDelay != 0) {
|
||||
this->action = 6;
|
||||
if (this->parent->currentHealth >= 0x15) {
|
||||
this->actionDelay = 120;
|
||||
} else {
|
||||
this->actionDelay = 0x3c;
|
||||
}
|
||||
this->attachedEntity = NULL;
|
||||
InitializeAnimation(this, 5);
|
||||
SoundReq(SFX_19B);
|
||||
}
|
||||
sub_080485FC(this);
|
||||
}
|
||||
|
||||
void VaatiWrathEyeAction6(Entity* this) {
|
||||
Entity* pEVar3;
|
||||
|
||||
sub_080485FC(this);
|
||||
GetNextFrame(this);
|
||||
if (this->actionDelay != 0) {
|
||||
if (--this->actionDelay == 0) {
|
||||
InitializeAnimation(this, 6);
|
||||
}
|
||||
} else {
|
||||
if (this->frames.b.f3) {
|
||||
this->action = 7;
|
||||
this->actionDelay = 120;
|
||||
this->field_0xf = 0;
|
||||
} else {
|
||||
if (this->frames.b.f0 != 0) {
|
||||
this->frames.all &= 0xfe;
|
||||
pEVar3 = CreateProjectile(0x24);
|
||||
if (pEVar3 != NULL) {
|
||||
pEVar3->parent = this;
|
||||
this->attachedEntity = pEVar3;
|
||||
PositionRelative(this, pEVar3, 0, 0xc0000);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void VaatiWrathEyeAction7(Entity* this) {
|
||||
sub_080485FC(this);
|
||||
GetNextFrame(this);
|
||||
if (this->field_0xf != 0) {
|
||||
this->action = 8;
|
||||
this->actionDelay = 0x3c;
|
||||
this->flags &= 0x7f;
|
||||
this->spriteSettings.b.draw = 0;
|
||||
CreateFx(this, 0x1f, 0x40);
|
||||
this->parent->field_0x7a.HALF.HI |= 0x10 << this->type;
|
||||
} else {
|
||||
if (--this->actionDelay != 0) {
|
||||
return;
|
||||
}
|
||||
this->action = 5;
|
||||
this->actionDelay = 0;
|
||||
this->parent->field_0x7a.HALF.HI |= 1 << this->type;
|
||||
}
|
||||
}
|
||||
|
||||
void VaatiWrathEyeAction8(Entity* this) {
|
||||
if (this->parent->action == 0xb) {
|
||||
this->actionDelay = 0x3c;
|
||||
} else {
|
||||
if (--this->actionDelay == 0) {
|
||||
this->action = 9;
|
||||
this->flags |= 0x80;
|
||||
this->spriteSettings.b.draw = 1;
|
||||
InitializeAnimation(this, 0);
|
||||
sub_080485FC(this);
|
||||
SoundReq(SFX_166);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void VaatiWrathEyeAction9(Entity* this) {
|
||||
sub_080485FC(this);
|
||||
GetNextFrame(this);
|
||||
if ((this->frames.all & 0x80) != 0) {
|
||||
this->action = 4;
|
||||
this->actionDelay = 1;
|
||||
this->parent->field_0x7a.HALF.HI = (this->parent->field_0x7a.HALF.HI & 0xf) | (1 << this->type);
|
||||
}
|
||||
}
|
||||
|
||||
void sub_080485D8(Entity* this) {
|
||||
const s8* ptr;
|
||||
|
||||
ptr = &gUnk_080D1D70[this->type * 2];
|
||||
sub_0806FA90(this->parent, this, ptr[0], ptr[1]);
|
||||
}
|
||||
|
||||
void sub_080485FC(Entity* this) {
|
||||
const s8* ptr;
|
||||
|
||||
ptr = &gUnk_080D1D98[this->type * 2];
|
||||
sub_0806FA90(this->parent, this, ptr[0], ptr[1]);
|
||||
this->height.HALF.HI = gUnk_080D1D78[this->type * 8 + (this->parent->field_0x78.HALF.LO >> 4 & 7)];
|
||||
}
|
||||
Reference in New Issue
Block a user