lakituCloud.s OK

Also edited a few names in the entity struct to match usage more.
This commit is contained in:
21aslade
2020-06-28 22:05:36 -06:00
parent 8f0c917ab5
commit 6304bbc3f2
10 changed files with 178 additions and 272 deletions
+7 -4
View File
@@ -14,16 +14,19 @@ void BladeTrap(Entity* ent) {
ent->action = 1;
pEVar2 = sub_0804B128((u8)(ent->entityType).form);
ent->attachedEntity = pEVar2;
sub_080A2CC0((EntityData*)ent, &ent->attachedEntity, &ent->heldObjectPtr);
sub_080A2CC0((EntityData*)ent, &ent->attachedEntity, &ent->field_0x74);
}
if ((ent->direction & 0x80) == 0) {
sub_0806F69C(ent);
}
puVar3 = (u16*)&(ent->heldObjectPtr);
puVar3 = &(ent->field_0x74);
uVar1 = *puVar3;
*puVar3 = uVar1 - 1;
if ((u16)(*puVar3) == 0) {
if ((ent->direction & 0x80) == 0) {
if ((*puVar3) == 0) {
if ((u16)(ent->direction & 0x80) == 0) {
sub_08004488(0x74);
}
sub_080A2CC0((EntityData*)ent, &ent->attachedEntity, puVar3);
+3 -3
View File
@@ -88,8 +88,8 @@ void sub_08021E4C(Entity *this)
if (this->field_0x78 != 0) {
this->field_0x78--;
}
if (this->itemCooldown != 0) {
(this->itemCooldown)--;
if (this->field_0x7a != 0) {
(this->field_0x7a)--;
}
GetNextFrame(this);
if ((this->frames.b.f3) != 0) {
@@ -129,6 +129,6 @@ void sub_08021EF0(Entity *this)
this->action = 1;
this->field_0x78 = gUnk_080CB6D6[Random() & 0xf];
this->itemCooldown = 0x3c;
this->field_0x7a = 0x3c;
InitializeAnimation(this, 0);
}
+155
View File
@@ -0,0 +1,155 @@
#include "global.h"
#include "entity.h"
extern Entity gLinkEntity;
extern void UpdateAnimationSingleFrame(Entity *);
extern void InitAnimationForceUpdate(Entity *, s32);
extern u32 GetNextFunction(Entity *);
extern void ModHealth(s32);
extern void CreateFx(Entity *, u16, u16);
extern void (* const gUnk_080D0418[])(Entity *);
extern void (* const gUnk_080D0430[])(Entity *);
extern void (* const gUnk_080D043C[])(Entity *);
extern bool32 sub_0806F3E4(Entity *);
extern bool32 sub_0806F520(Entity *);
extern void sub_0800449C(Entity *, u32);
extern void sub_0803CE14(Entity *);
extern void sub_0803CE3C(Entity *);
extern Entity *sub_0804B128(u8);
extern void sub_0806F4E8(Entity *);
extern void sub_0806F69C(Entity *);
extern void sub_08079D84(void);
extern void sub_080A2CC0(Entity *, Entity **, u16 *);
void LakituCloud(Entity *this) {
gUnk_080D0418[GetNextFunction(this)](this);
}
void sub_0803CCD4(Entity *this) {
gUnk_080D0430[this->action](this);
}
void sub_0803CCEC(Entity *this) {
this->field_0x42 = 0;
sub_0803CCD4(this);
}
void sub_0803CCFC(Entity *this) {
if (sub_0806F520(this) == 0) {
if (this->previousActionFlag == 2) {
sub_0803CE3C(this);
}
}
else {
gUnk_080D043C[this->previousActionFlag](this);
}
}
void sub_0803CD2C(Entity *this) {
this->previousActionFlag = 1;
this->field_0x1d = 0x3c;
}
void sub_0803CD38(Entity *this) {
sub_0806F4E8(this);
}
void sub_0803CD40(Entity *this) {
if (!sub_0806F3E4(this)) {
return;
}
ModHealth(-2);
sub_0800449C(&gLinkEntity, 122);
sub_08079D84();
sub_0803CE3C(this);
}
void sub_0803CD6C(Entity *this) {
Entity *lakitu;
this->action = 1;
this->height.HALF.HI = -2;
// Set parent to lakitu
lakitu = sub_0804B128(this->entityType.form);
this->attachedEntity = lakitu;
this->parent = lakitu;
this->field_0x78 = this->x.HALF.HI;
this->field_0x7a = this->y.HALF.HI;
InitAnimationForceUpdate(this, 4);
sub_0803CE14(this);
}
void sub_0803CDA8(Entity *this) {
UpdateAnimationSingleFrame(this);
if ((this->direction & 0x80) == 0) {
sub_0806F69C(this);
}
if (--this->field_0x74 << 0x10 == 0) {
sub_0803CE14(this);
}
}
void sub_0803CDD8(Entity *this) {
u8 one;
u8 ss0;
ss0 = this->spriteSettings.b.ss0;
one = 1;
this->spriteSettings.b.ss0 = ss0 ^ one;
this->actionDelay--;
if (this->actionDelay == 0) {
this->action = 1;
this->flags |= 0x80;
this->spriteSettings.b.ss0 = one;
}
}
void sub_0803CE14(Entity *this) {
u8 direction;
sub_080A2CC0(this, &this->attachedEntity, &this->field_0x74);
direction = this->direction;
if (direction & 0x80) {
return;
}
direction = direction / 8 + 4;
InitAnimationForceUpdate(this, direction);
}
void sub_0803CE3C(Entity *this) {
CreateFx(this, 2, 0);
this->action = 2;
this->actionDelay = 60;
this->flags &= 0x7f;
this->field_0x3a &= 0xfb;
this->x.HALF.HI = this->field_0x78;
this->y.HALF.HI = this->field_0x7a;
this->attachedEntity = this->parent;
sub_0803CE14(this);
}
+2 -2
View File
@@ -70,7 +70,7 @@ void sub_080929A4(Entity *this) {
this->field_0x7c.HALF.HI = COORD_TO_TILE(this);
this->field_0x7c.HALF.LO = sub_080001DA(this->field_0x7c.HALF.HI, 1);
this->itemCooldown = sub_080002E0(this->field_0x7c.HALF.HI, 1);
this->field_0x7a = sub_080002E0(this->field_0x7c.HALF.HI, 1);
SetTile(0x4022, this->field_0x7c.HALF.HI, 1);
}
@@ -98,7 +98,7 @@ void sub_08092A94(Entity *this) {
// Presumably, make the mask fall
SetTile((u16)this->field_0x7c.HALF.LO, this->field_0x7c.HALF.HI, 1);
sub_08000148(this->itemCooldown, this->field_0x7c.HALF.HI, 1);
sub_08000148(this->field_0x7a, this->field_0x7c.HALF.HI, 1);
this->action = 2;
+2 -2
View File
@@ -24,7 +24,7 @@ void Ocarina(ItemBehavior* pItemBeh, u32 inputFlags)
// u32 *ocarinaStates = &gOcarinaStates;
//_call_via_r2(pItemBeh, inputFlags,(ocarinaStates)[pItemBeh->stateID]);
gOcarinaStates[pItemBeh->stateID](pItemBeh, inputFlags);
gLinkEntity.itemCooldown = gLinkEntity.itemCooldown + 1;
gLinkEntity.field_0x7a = gLinkEntity.field_0x7a + 1;
}
void OcarinaUse(ItemBehavior* itemBeh, s32 inputFlags) {
@@ -40,7 +40,7 @@ void OcarinaUse(ItemBehavior* itemBeh, s32 inputFlags) {
gLinkEntity.spriteSettings.raw &= var;
gLinkEntity.flags &= 127;
gLinkEntity.itemCooldown = 2;
gLinkEntity.field_0x7a = 2;
gLinkState.flags.all |= 0x10000000;
gLinkState.filler8[0] = 255;
gUnk_02034490 = 1;
+1 -1
View File
@@ -94,7 +94,7 @@ void sub_08066D94(Entity* ent) {
npc->flags |= 0x20;
npc->animationState = sub_0806EDC4(ent);
roomID = gRoomControls.roomID;
*(u16*)&npc->heldObjectPtr = roomID;
npc->field_0x74 = roomID;
CopyPosition(ent, npc);
}
DeleteThisEntity();