entity.h fixup

This commit is contained in:
theo3 2020-06-18 03:21:47 -07:00
parent 32ad8dec4d
commit f8ae0eaef7
31 changed files with 140 additions and 140 deletions

View File

@ -183,7 +183,7 @@ typedef struct Entity
EntityType entityType;
u8 action;
u8 previousActionFlag;
u8 parameter3;
u8 actionDelay;
u8 field_0xf;
u8 flags;

View File

@ -12,8 +12,8 @@ typedef struct {
typedef struct {
u8 type;
u8 subtype;
u8 parameter1;
u8 parameter2;
u8 form;
u8 parameter;
} EntityType;
union SplitWord {
@ -36,7 +36,7 @@ typedef struct Entity {
EntityType entityType;
u8 action;
u8 previousActionFlag;
u8 parameter3;
u8 actionDelay;
u8 field_0xf;
u8 flags;
u8 scriptedScene : 4;

View File

@ -51,8 +51,8 @@ typedef struct {
u8 entityType;
u8 field_0x1;
u8 entitySubtype;
u8 entityParameter1;
u32 entityParameter2;
u8 entityform;
u32 entityparameter;
u16 xPos;
u16 yPos;
u32 spritePtr;

View File

@ -17,7 +17,7 @@ extern void sub_0806D02C(Entity*);
extern Entity* sub_0805EB2C(u32, u32, u32, u32, u32);
void BigGoron(Entity* this) {
gUnk_081140D4[this->entityType.parameter1](this);
gUnk_081140D4[this->entityType.form](this);
}
#ifdef NON_MATCHING
@ -55,11 +55,11 @@ void sub_0806CF30(Entity* this) {
}
}
} else {
bVar1 = this->parameter3 -= 1;
bVar1 = this->actionDelay -= 1;
if (bVar1 == 0) {
uVar2 = Random();
PlaySFX(gUnk_081140CC[uVar2 & 3]);
this->parameter3 = ((u8)uVar2 & 7) * 10 + 128;
this->actionDelay = ((u8)uVar2 & 7) * 10 + 128;
}
}
sub_0806D02C(this);

View File

@ -60,7 +60,7 @@ void sub_08068A1C(Entity* this) {
u8 bVar1;
int offset;
(this->entityType).parameter2 = (this->entityType).parameter1;
(this->entityType).parameter = (this->entityType).form;
if (gUnk_030010A0.unk != 0) {
offset = 6;
bVar1 = 3;
@ -104,13 +104,13 @@ void sub_08068AA4(Entity* this) {
u8 bVar1;
this->action = 1;
if (this->entityType.parameter1 != 0) {
this->entityType.parameter2++;
this->entityType.parameter2 &= 7;
if (this->entityType.parameter2 == 0) {
this->entityType.parameter2 += 1;
if (this->entityType.form != 0) {
this->entityType.parameter++;
this->entityType.parameter &= 7;
if (this->entityType.parameter == 0) {
this->entityType.parameter += 1;
}
sub_0801D2B4(this, gUnk_081115DC[this->entityType.parameter2]);
sub_0801D2B4(this, gUnk_081115DC[this->entityType.parameter]);
}
}
@ -153,10 +153,10 @@ void sub_08068B84(Entity* this) {
u8 p;
if (gUnk_08111618) {}
if (p = this->parameter3, gUnk_08111618[p]) {
ForceEquipItem(gUnk_08111618[this->parameter3], 0);
if (p = this->actionDelay, gUnk_08111618[p]) {
ForceEquipItem(gUnk_08111618[this->actionDelay], 0);
}
sub_0805ED14(gUnk_081115EC[this->parameter3]);
sub_0805ED14(gUnk_081115EC[this->actionDelay]);
}
void sub_08068BB4(Entity* this) {
@ -187,16 +187,16 @@ void sub_08068C28(Entity* this) {
u8 bVar1;
u32 uVar2;
this->parameter3 = gUnk_08111623[(this->entityType).parameter1];
if ((this->entityType).parameter1 == 1) {
this->actionDelay = gUnk_08111623[(this->entityType).form];
if ((this->entityType).form == 1) {
if (GetInventoryValue(0x48)) { // spin attack
if (!GetInventoryValue(0x4b)) { // rock breaker
this->parameter3 = 1;
this->actionDelay = 1;
} else {
if (!GetInventoryValue(0x4a)) { // dash attack
this->parameter3 = 2;
this->actionDelay = 2;
} else {
this->parameter3 = 3;
this->actionDelay = 3;
}
}
}
@ -204,20 +204,20 @@ void sub_08068C28(Entity* this) {
}
void sub_08068C6C(Entity* this) {
sub_080A7C18(gUnk_0811162B[this->parameter3] & 0xffffff7f, 0, 0);
sub_080A7C18(gUnk_0811162B[this->actionDelay] & 0xffffff7f, 0, 0);
}
void sub_08068C8C(Entity* param_1, Entity* param_2) {
u8* arr = gUnk_0811162B + 0xd;
*(u32*)&param_2->animationState = *(u32*)(arr + param_1->parameter3 * 4);
*(u32*)&param_2->animationState = *(u32*)(arr + param_1->actionDelay * 4);
}
void sub_08068CA0(Entity* param_1, Entity* param_2) {
u8 bVar1;
u32 uVar2;
bVar1 = (param_1->entityType).parameter1;
bVar1 = (param_1->entityType).form;
if (bVar1 == 1) {
*(u32*)&param_2->animationState = bVar1;
uVar2 = GetInventoryValue(0x48); // spin attack
@ -237,7 +237,7 @@ void sub_08068CA0(Entity* param_1, Entity* param_2) {
return;
}
} else {
uVar2 = GetInventoryValue(gUnk_0811162B[param_1->parameter3] & -0x81);
uVar2 = GetInventoryValue(gUnk_0811162B[param_1->actionDelay] & -0x81);
if (uVar2 != 0) {
uVar2 = 1;
}
@ -253,7 +253,7 @@ void sub_08068CFC(Entity* param_1, Entity* param_2, u32 param_3, u32 param_4)
u32 uVar2;
*(u32*)&param_2->animationState = 0;
bVar1 = param_1->parameter3;
bVar1 = param_1->actionDelay;
if (bVar1 > 10)
return;
@ -319,47 +319,47 @@ switchD_08068d12_caseD_0:
//Introduction dialoague
void sub_08068DB8(Entity* this) {
TextboxNoOverlap(gUnk_08111664[this->parameter3], this);
TextboxNoOverlap(gUnk_08111664[this->actionDelay], this);
}
//Ask to teach dialoague
void sub_08068DD0(Entity* this) {
TextboxNoOverlap(gUnk_0811167A[this->parameter3], this);
TextboxNoOverlap(gUnk_0811167A[this->actionDelay], this);
}
//Technique Dialogue
void sub_08068DE8(Entity* this) {
TextboxNoOverlap(gUnk_08111690[this->parameter3], this);
TextboxNoOverlap(gUnk_08111690[this->actionDelay], this);
}
//Posession dialogue
void sub_08068E00(Entity* this) {
TextboxNoOverlap(gUnk_081116A6[this->parameter3], this);
TextboxNoOverlap(gUnk_081116A6[this->actionDelay], this);
}
void sub_08068E18(Entity* this) {
TextboxNoOverlap(gUnk_081116BC[this->parameter3], this);
TextboxNoOverlap(gUnk_081116BC[this->actionDelay], this);
}
void sub_08068E30(Entity* this) {
TextboxNoOverlap(gUnk_081116D2[this->parameter3], this);
TextboxNoOverlap(gUnk_081116D2[this->actionDelay], this);
}
void sub_08068E48(Entity* this) {
TextboxNoOverlap(gUnk_081116E8[this->parameter3], this);
TextboxNoOverlap(gUnk_081116E8[this->actionDelay], this);
}
void sub_08068E60(Entity* this) {
TextboxNoOverlap(gUnk_081116FE[this->parameter3], this);
TextboxNoOverlap(gUnk_081116FE[this->actionDelay], this);
}
void sub_08068E78(Entity* this) {
TextboxNoOverlap(gUnk_08111714[this->parameter3], this);
TextboxNoOverlap(gUnk_08111714[this->actionDelay], this);
}
void sub_08068E90(Entity* this) {
LinkState* s = &gLinkState;
*(u16*)&s->unk8 = (1 << (gUnk_08111740[this->parameter3] - 1)) | *(u16*)&s->unk8;
*(u16*)&s->unk8 = (1 << (gUnk_08111740[this->actionDelay] - 1)) | *(u16*)&s->unk8;
}
void sub_08068EB4(void) {
@ -367,8 +367,8 @@ void sub_08068EB4(void) {
}
void sub_08068EC4(Entity* param_1, Entity* param_2) {
if (gUnk_08111740[param_1->parameter3] == gLinkState.unk71) {
*(u16*)&param_2->flags = gUnk_0811172A[param_1->parameter3];
if (gUnk_08111740[param_1->actionDelay] == gLinkState.unk71) {
*(u16*)&param_2->flags = gUnk_0811172A[param_1->actionDelay];
*(u32*)&param_2->animationState = 1;
} else {
*(u32*)&param_2->animationState = 0;
@ -376,23 +376,23 @@ void sub_08068EC4(Entity* param_1, Entity* param_2) {
}
void sub_08068F00(Entity* this) {
if (this->parameter3 == 1) {
if (this->actionDelay == 1) {
LoadRoomEntityList(&gUnk_080F3494);
}
}
void sub_08068F14(Entity* this) {
if (this->parameter3 == 5) {
if (this->actionDelay == 5) {
ModHealth(160);
}
if (this->parameter3 == 6) {
if (this->actionDelay == 6) {
ModHealth(-160);
ModHealth(2);
}
}
void sub_08068F3C(Entity* this) {
if (this->parameter3 == 6) {
if (this->actionDelay == 6) {
ModHealth(160);
}
}

View File

@ -12,7 +12,7 @@ void BladeTrap(Entity* ent) {
u16* puVar3;
if (ent->action == 0) {
ent->action = 1;
pEVar2 = sub_0804B128((u8)(ent->entityType).parameter1);
pEVar2 = sub_0804B128((u8)(ent->entityType).form);
ent->attachedEntity = pEVar2;
sub_080A2CC0((EntityData*)ent, &ent->attachedEntity, &ent->heldObjectPtr);
}

View File

@ -13,7 +13,7 @@ void BombPeahat(Entity *this)
s32 iVar1;
u32 uVar2;
if (((this->entityType).parameter1 == 2) && (iVar1 = sub_080012DC(this), iVar1 != 0)) {
if (((this->entityType).form == 2) && (iVar1 = sub_080012DC(this), iVar1 != 0)) {
gUnk_080012C8[iVar1](this);
}
else {

View File

@ -10,7 +10,7 @@ extern void (*gCat[9])(Entity*);
void Cat(Entity* ent) {
gCat[ent->action](ent);
sub_08067C44(ent);
if (((ent->flags & 128) == 0) && ((ent->entityType).parameter1 != 5)) {
if (((ent->flags & 128) == 0) && ((ent->entityType).form != 5)) {
sub_0806ED78(ent);
}
}

View File

@ -33,11 +33,11 @@ extern u16 gUnk_081247C8[];
extern u32 gUnk_081247D0;
void Cloud(Entity* this) {
gUnk_08124798[(this->entityType).parameter1](this);
gUnk_08124798[(this->entityType).form](this);
}
void sub_0809F4DC(Entity* this) {
if ((this->entityType).parameter2 == 0) {
if ((this->entityType).parameter == 0) {
gUnk_081247A0[this->action](this);
} else {
gUnk_081247AC[this->action](this);
@ -46,7 +46,7 @@ void sub_0809F4DC(Entity* this) {
void sub_0809F514(Entity* this) {
this->action = 1;
this->parameter3 = 120;
this->actionDelay = 120;
this->spriteSettings.b.ss0 = 0;
*(u8*)&this->field_0x68 = 12;
gRoomControls.cameraTarget = this;
@ -56,9 +56,9 @@ void sub_0809F514(Entity* this) {
void sub_0809F548(Entity* this) {
if (--this->parameter3 == 0) {
if (--this->actionDelay == 0) {
this->action = 2;
this->parameter3 = 90;
this->actionDelay = 90;
PlaySFX(285);
sub_0809F814((((this->x.HALF.HI - gRoomControls.roomOriginX) >> 4) & 63) |
(((this->y.HALF.HI - gRoomControls.roomOriginY) >> 4) & 63) << 6);
@ -71,7 +71,7 @@ void sub_0809F548(Entity* this) {
}
void sub_0809F5B0(Entity* this) {
if (--this->parameter3 == 0) {
if (--this->actionDelay == 0) {
PlaySFX(115);
SetGlobalFlag(36);
LoadRoomEntityList(&gUnk_080DD750);
@ -88,10 +88,10 @@ void sub_0809F5DC(Entity* this) {
void sub_0809F5F0(Entity* this) {
u32 iVar1;
iVar1 = CheckRoomFlag(this->parameter3);
iVar1 = CheckRoomFlag(this->actionDelay);
if (iVar1 != 0) {
this->action = 2;
this->parameter3 = 120;
this->actionDelay = 120;
sub_08078A90(3);
sub_08078B48();
gRoomControls.cameraTarget = this;
@ -101,12 +101,12 @@ void sub_0809F5F0(Entity* this) {
void sub_0809F61C(Entity* this) {
if ((gRoomControls.unk6 & 4) == 0) {
if (this->parameter3 == 30) {
SetLocalFlag(this->entityType.parameter2);
if (this->actionDelay == 30) {
SetLocalFlag(this->entityType.parameter);
}
if (--this->parameter3 == 0) {
if (--this->actionDelay == 0) {
this->action = 3;
this->parameter3 = 120;
this->actionDelay = 120;
PlaySFX(285);
sub_0809F814((((this->x.HALF.HI - gRoomControls.roomOriginX) >> 4) & 63) |
(((this->y.HALF.HI - gRoomControls.roomOriginY) >> 4) & 63) << 6);
@ -121,8 +121,8 @@ void sub_0809F61C(Entity* this) {
void sub_0809F69C(Entity* this) {
if (--this->parameter3 == 0) {
this->parameter3 = 30;
if (--this->actionDelay == 0) {
this->actionDelay = 30;
this->action = 4;
gRoomControls.cameraTarget = &gLinkEntity;
PlaySFX(115);
@ -131,7 +131,7 @@ void sub_0809F69C(Entity* this) {
void sub_0809F6CC(Entity* this) {
if (((gRoomControls.unk6 & 4) == 0) && (--this->parameter3 == 0)) {
if (((gRoomControls.unk6 & 4) == 0) && (--this->actionDelay == 0)) {
gLinkState.unk7 = 1;
DeleteThisEntity();
}
@ -143,7 +143,7 @@ void sub_0809F700(Entity* this) {
if (this->action == 0) {
this->action = 1;
this->parameter3 = (Random() & 30) + 8;
this->actionDelay = (Random() & 30) + 8;
this->flags = this->flags | 12;
}
if ((gUnk_030010A0 & 3) == 0) {
@ -152,7 +152,7 @@ void sub_0809F700(Entity* this) {
this->spriteOffsetY = gUnk_081247C0[uVar2 >> 4 & 7];
}
sub_0806F69C(this);
if (--this->parameter3 == 0) {
if (--this->actionDelay == 0) {
DeleteThisEntity();
}
}

View File

@ -33,7 +33,7 @@ void sub_08068FC0(Entity* ent) {
u32 r2;
ent->action = 1;
ent->animationState = ent->entityType.parameter2;
ent->animationState = ent->entityType.parameter;
ent->nonPlanarMovement = 0x40;
ent->field_0x6d = 0xFF;
@ -70,7 +70,7 @@ void sub_08069018(Entity* ent) {
UpdateAnimationSingleFrame(ent);
var0 = --ent->field_0xf;
if (var0 == 0) {
if (ent->parameter3 == 0) {
if (ent->actionDelay == 0) {
ent->action = 2;
} else {
ent->action = 3;
@ -186,7 +186,7 @@ void sub_080691E0(Entity* ent) {
// Show dialogue
void sub_080691F8(Entity* ent) {
u32 var0 = ent->entityType.parameter1;
u32 var0 = ent->entityType.form;
u32* var1 = gUnk_08111938 + (var0 * 2);
ShowNPCDialogue(ent, var1);
}

View File

@ -11,7 +11,7 @@ Entity* CreateEnemy(u32 subtype, u32 param1) {
if (enemy != NULL) {
(enemy->entityType).type = 3;
(enemy->entityType).subtype = subtype;
(enemy->entityType).parameter1 = param1;
(enemy->entityType).form = param1;
sub_0805EA2C(enemy, 4);
}
return enemy;

View File

@ -25,12 +25,12 @@
// if (entity != NULL) {
// (entity->entityType).type = type;
// (entity->entityType).subtype = param_1->entitySubtype;
// (entity->entityType).parameter1 = param_1->entityParameter1;
// (entity->entityType).form = param_1->entityform;
// sub_0804AEB0(entity,param_1);
// if ((param_1->field_0x1 & 240) != 16) {
// (entity->entityType).parameter2 = *(u8 *)&param_1->entityParameter2;
// (entity->entityType).parameter = *(u8 *)&param_1->entityparameter;
// /* i suspect this is where the entity's behavior is defined. Not sure. */
// entity->parameter3 = (u8)((u32)param_1->entityParameter2 >> 8);
// entity->actionDelay = (u8)((u32)param_1->entityparameter >> 8);
// if ((type != 9) && (sub_0804AF0C(entity,param_1), entity->field_0x4 != NULL)) {
// if ((param_1->entityType & 16) == 0) {
// if ((param_1->entityType & 32) != 0) {

View File

@ -4,7 +4,7 @@
extern Entity* GetEmptyEntity();
extern void sub_0805EA2C(Entity*, u8);
Entity* CreateNPC(u32 subtype, u32 parameter1, u32 parameter2)
Entity* CreateNPC(u32 subtype, u32 form, u32 parameter)
{
Entity* pEVar1;
@ -13,8 +13,8 @@ Entity* CreateNPC(u32 subtype, u32 parameter1, u32 parameter2)
if (pEVar1 != NULL) {
(pEVar1->entityType).type = 7;
(pEVar1->entityType).subtype = subtype;
(pEVar1->entityType).parameter1 = parameter1;
(pEVar1->entityType).parameter2 = parameter2;
(pEVar1->entityType).form = form;
(pEVar1->entityType).parameter = parameter;
sub_0805EA2C(pEVar1, 7);
}
return pEVar1;

View File

@ -13,8 +13,8 @@ Entity* CreateObject(u32 subtype, u32 param1, u32 param2)
if (newEnt != NULL) {
(newEnt->entityType).type = 6;
(newEnt->entityType).subtype = subtype;
(newEnt->entityType).parameter1 = param1;
(newEnt->entityType).parameter2 = param2;
(newEnt->entityType).form = param1;
(newEnt->entityType).parameter = param2;
sub_0805EA2C(newEnt, 6);
}
return newEnt;

View File

@ -50,7 +50,7 @@ void sub_08065A34(Entity* this) {
}
void sub_08065A50(Entity* this) {
ShowNPCDialogue(this, &gUnk_08110080[this->entityType.parameter1 * 2]);
ShowNPCDialogue(this, &gUnk_08110080[this->entityType.form * 2]);
}
void sub_08065A64(Entity* this) {

View File

@ -15,7 +15,7 @@ void GiantLeaf(Entity* ent) {
ent->spriteSettings.b.ss0 = 1;
ent->spriteOrder.b3 = 3;
ent->ticks.b0 = 7;
ent->animationList = ent->entityType.parameter1;
ent->animationList = ent->entityType.form;
sub_0808D618(ent);
}
}
@ -25,7 +25,7 @@ void sub_0808D618(Entity* ent) {
s16* arr;
u32 i;
arr = (ent->entityType.parameter1 != 0) ? gUnk_0812176A : gUnk_08121750;
arr = (ent->entityType.form != 0) ? gUnk_0812176A : gUnk_08121750;
tilePos = (((ent->x.HALF.HI - gRoomControls.roomOriginX) >> 4) & 0x3F) |
((((ent->y.HALF.HI - gRoomControls.roomOriginY) >> 4) & 0x3F) * 64);

View File

@ -39,7 +39,7 @@ void sub_08069328(Entity* this) {
this->action = 2;
sub_0805E47C(this);
InitAnimationForceUpdate(this, 8);
TextboxNoOverlapFollow(this->parameter3 + (0x90 << 5));
TextboxNoOverlapFollow(this->actionDelay + (0x90 << 5));
}
}
@ -112,7 +112,7 @@ void sub_080694B0(Entity* this) {
extern u64 gUnk_08111A94[]; //array of unknown 64 bit structure type
void sub_080694D8(Entity* this) {
ShowNPCDialogue(this, (u32*)&gUnk_08111A94[this->entityType.parameter1]);
ShowNPCDialogue(this, (u32*)&gUnk_08111A94[this->entityType.form]);
}
void sub_080694EC(Entity* this) {

View File

@ -9,10 +9,10 @@ void GreatFairy(Entity* this) {
u8 bVar1;
if (this->action == 0) {
bVar1 = __modsi3((this->entityType).parameter1, 11);
(this->entityType).parameter2 = bVar1;
bVar1 = __modsi3((this->entityType).form, 11);
(this->entityType).parameter = bVar1;
}
GreatFairy_Main[(this->entityType).parameter2](this);
GreatFairy_Main[(this->entityType).parameter](this);
}
// Behaviors
@ -32,7 +32,7 @@ void GreatFairy_CallBehavior(Entity* this) {
// Init
void GreatFairy_Init(Entity* this) {
GreatFairy_InitializeAnimation(this);
this->parameter3 = 0;
this->actionDelay = 0;
this->cutsceneBeh.HWORD = 290;
}
@ -86,9 +86,9 @@ LABEL_17:
LABEL_16:
ripple = GreatFairy_CreateForm(this, RIPPLE, 0);
if (ripple) {
PositionRelative(this, ripple, (s32)GreatFairy_RippleOffsets[this->parameter3] << 16,
(s32)GreatFairy_RippleOffsets[this->parameter3 + 1] << 16);
this->parameter3 += 2;
PositionRelative(this, ripple, (s32)GreatFairy_RippleOffsets[this->actionDelay] << 16,
(s32)GreatFairy_RippleOffsets[this->actionDelay + 1] << 16);
this->actionDelay += 2;
}
}
@ -114,7 +114,7 @@ void GreatFairy_SpawningUpdate(Entity* this) {
DoFade(6, 4);
PlaySFX(325);
this->action = 4;
this->parameter3 = 0x3c;
this->actionDelay = 0x3c;
var = this->spriteSettings.raw & ~0x3;
this->spriteSettings.raw = (this->spriteSettings.raw & var) | 1;
}
@ -125,14 +125,14 @@ void GreatFairy_MiniUpdate(Entity* this) {
Entity* target;
GetNextFrame(this);
if (this->parameter3 != 0) {
--this->parameter3;
if (this->actionDelay != 0) {
--this->actionDelay;
} else {
target = GreatFairy_CreateForm(this, WINGS, 0);
if (target != NULL) {
PositionRelative(this, target, 0, -0x140000);
this->action = 5;
this->parameter3 = 120;
this->actionDelay = 120;
this->field_0xf = 0;
}
}
@ -142,8 +142,8 @@ void GreatFairy_MiniUpdate(Entity* this) {
void GreatFairy_FinalUpdate(Entity* this) {
Entity* target;
if (this->parameter3 != 0) {
--this->parameter3;
if (this->actionDelay != 0) {
--this->actionDelay;
} else {
if ((this->field_0xf == 0) && (target = GreatFairy_CreateForm(this, FORM9, 0), target != NULL)) {
PositionRelative(this, target, 0, -0x4C0000);
@ -264,7 +264,7 @@ void GreatFairy_MiniAffineInit2(Entity* this) {
if (this->height.HALF.HI == -20) {
this->action = 2;
this->parameter3 = 90;
this->actionDelay = 90;
this->nonPlanarMovement = 4096;
this->spriteOrder.b0 = 3;
sub_0805EC9C(this, 256, 256, 0);
@ -275,7 +275,7 @@ void GreatFairy_MiniAffineInit2(Entity* this) {
void GreatFairy_MiniAffineUpdate(Entity* this) {
s32 iVar2;
if (--this->parameter3 == 0) {
if (--this->actionDelay == 0) {
gRoomVars.greatFairyState |= 1;
this->action = 3;
sub_0805EC60(this);
@ -332,7 +332,7 @@ void GreatFairy_BigRippleCallBehavior(Entity* this) {
void GreatFairy_BigRippleInit(Entity* this) {
GreatFairy_InitializeAnimation(this);
this->parameter3 = 120;
this->actionDelay = 120;
this->spriteSettings.b.ss0 = 1;
this->ticks.b0 = 5;
PlaySFX(249);
@ -342,8 +342,8 @@ void GreatFairy_BigRippleUpdate(Entity* this) {
Entity* target;
GetNextFrame(this);
if (this->parameter3 != 0) {
--this->parameter3;
if (this->actionDelay != 0) {
--this->actionDelay;
} else {
target = GreatFairy_CreateForm(this, MINI, 0);
if (target != NULL) {
@ -373,7 +373,7 @@ void GreatFairy_EnergyUpdate(Entity* this) {
}
void sub_08087114(Entity* this) {
if ((this->entityType).parameter2 == 0) {
if ((this->entityType).parameter == 0) {
GreatFairy_Form1Behaviors[this->action](this);
} else {
GreatFairy_Form2Behaviors[this->action](this);
@ -409,16 +409,16 @@ void nullsub_516() {
void sub_080871A8(Entity* this) {
u32 bVar1;
if (--this->parameter3 == 0) {
if (--this->actionDelay == 0) {
this->action = 3;
this->parameter3 = 60;
this->actionDelay = 60;
gRoomVars.greatFairyState |= 4;
}
}
void sub_080871D0(Entity* this) {
if (--this->parameter3 == 0) {
if (--this->actionDelay == 0) {
gRoomVars.greatFairyState |= 8;
DeleteEntity(this);
}
@ -448,21 +448,21 @@ void sub_080871F8(Entity* this) {
void sub_08087240(Entity* this) {
if ((gRoomVars.greatFairyState & 4) != 0) {
this->action = 3;
this->parameter3 = 20;
this->actionDelay = 20;
this->direction = 16;
}
}
void sub_08087264(Entity* this) {
if (this->parameter3 != 0) {
this->parameter3--;
if (this->actionDelay != 0) {
this->actionDelay--;
sub_0806F69C(this);
}
}
void sub_0808727C(Entity* this) {
if (--this->parameter3 == 0) {
if (--this->actionDelay == 0) {
DeleteEntity(this);
}
}

View File

@ -71,7 +71,7 @@ void sub_08021DF0(Entity *this)
{
sub_0804A720(this);
if ((this->entityType).parameter1 != 0) {
if ((this->entityType).form != 0) {
this->ticks.b1 = 1;
this->height.HALF.HI = -0x10;
}
@ -103,7 +103,7 @@ void sub_08021E4C(Entity *this)
void sub_08021EA4(Entity *this)
{
if (--this->parameter3 == 0) {
if (--this->actionDelay == 0) {
sub_08021EF0(this);
}
}
@ -112,8 +112,8 @@ void sub_08021EBC(Entity *this)
{
s32 iVar1;
if (this->parameter3 != 0) {
this->parameter3--;
if (this->actionDelay != 0) {
this->actionDelay--;
}
else {
iVar1 = sub_0806FCB8(this, gLinkEntity.x.HALF.HI, gLinkEntity.y.HALF.HI, 0x70);

View File

@ -25,9 +25,9 @@ void sub_080869DC(Entity* ent) {
ent->spriteSettings.b.ss0 = 0;
ent->boundingBox = &gUnk_080FD1A8;
ent->field_0x3c = ent->field_0x3c | 16;
itemEntity = CreateObject(0, ent->entityType.parameter1, 0);
itemEntity = CreateObject(0, ent->entityType.form, 0);
if (itemEntity != NULL) {
itemEntity->parameter3 = 10;
itemEntity->actionDelay = 10;
itemEntity->parent = ent;
ent->attachedEntity = itemEntity;
CopyPosition(ent, itemEntity);

View File

@ -13,7 +13,7 @@ void Object1C(Entity *this)
}
iVar1 = CheckRectOnScreen(this->field_0x80, this->field_0x82, 0x10, 0x10);
if (iVar1 == 0) {
this->parent->field_0x20 &= ~(1 << this->entityType.parameter2);
this->parent->field_0x20 &= ~(1 << this->entityType.parameter);
DeleteThisEntity();
}
}

View File

@ -27,7 +27,7 @@ void ObjectA8(Entity *this)
case 0x1f:
this->action = 5;
this->attachedEntity = &gLinkEntity;
CreateItemEntity((this->entityType).parameter1, 0, 0);
CreateItemEntity((this->entityType).form, 0, 0);
DeleteThisEntity();
}
}

View File

@ -44,7 +44,7 @@ void sub_0801EAE8(Entity* ent) {
// Death
void sub_0801EB0C(Entity* ent) {
if ((ent->entityType).parameter1 == 0) {
if ((ent->entityType).form == 0) {
sub_0804A7D4(ent);
} else {
CreateDeathFx(ent, 241, 0);
@ -96,7 +96,7 @@ void sub_0801EB9C(Entity* ent) {
#ifdef NON_MATCHING
void sub_0801EBC8(Entity* ent) {
sub_0804A720();
ent->animationState = (ent->entityType).parameter1 == 2 ? (ent->entityType).parameter1 : Random() & 3;
ent->animationState = (ent->entityType).form == 2 ? (ent->entityType).form : Random() & 3;
ent->filler[0] = 18;
sub_0801ECFC(ent);
InitializeAnimation(ent, ent->animationState);
@ -112,11 +112,11 @@ void sub_0801EBF4(Entity* ent) {
u8 bVar1;
u32 uVar2;
bVar1 = ent->parameter3 -= 1;
bVar1 = ent->actionDelay -= 1;
if (bVar1 == 0) {
ent->action = 2;
uVar2 = Random();
ent->parameter3 = gUnk_080CA170[uVar2 & 3];
ent->actionDelay = gUnk_080CA170[uVar2 & 3];
sub_0801ED14(ent);
}
GetNextFrame(ent);

View File

@ -17,7 +17,7 @@ extern void (*gUnk_08112278[])(Entity*);
extern void gUnk_08012F0C;
void Rem(Entity* this) {
gUnk_08112260[this->entityType.parameter1](this);
gUnk_08112260[this->entityType.form](this);
}
void sub_0806a370(Entity* this) {
@ -46,7 +46,7 @@ void sub_0806A3D8(Entity *this)
u32 *uVar1;
this->action = 1;
this->parameter3 = 0xb4;
this->actionDelay = 0xb4;
sub_0805E3A0(this, 2);
sub_0806A8C8(this);
uVar1 = StartCutscene(this,&gUnk_08012F0C);

View File

@ -68,7 +68,7 @@ void sub_08044FF8(Entity* this) {
this->action = 2;
bVar1 = Random();
this->parameter3 = (bVar1 & 31) + 30;
this->actionDelay = (bVar1 & 31) + 30;
this->cutsceneBeh.HALF.LO = this->currentHealth;
}
@ -79,12 +79,12 @@ void sub_08045018(Entity* this) {
u32 randValue;
GetNextFrame(this);
param3 = this->parameter3 -= 1;
param3 = this->actionDelay -= 1;
if (param3 == 0) {
this->action = 3;
this->parameter3 = 1;
this->actionDelay = 1;
if (0 < this->nonPlanarMovement) {
this->parameter3 = sub_0806FA04(4096, this->nonPlanarMovement) >> 8;
this->actionDelay = sub_0806FA04(4096, this->nonPlanarMovement) >> 8;
}
iVar3 = sub_08049FA0(this);
if ((iVar3 == 0) && (randValue = Random(), (randValue & 3) != 0)) {
@ -101,7 +101,7 @@ void sub_08045088(Entity* this) {
sub_080AEF88();
GetNextFrame(this);
bVar1 = this->parameter3 -= 1;
bVar1 = this->actionDelay -= 1;
if (bVar1 == 0) {
this->action = 1;
}
@ -125,13 +125,13 @@ void sub_080450A8(Entity* this)
Entity* local_2c[4];
ppEVar6 = local_2c;
bVar1 = (&gUnk_080D16D0)[(this->entityType).parameter1];
bVar1 = (&gUnk_080D16D0)[(this->entityType).form];
divisor = (u32)bVar1;
if ((int)gUnk_03003DB8.entityCount < (int)(72 - divisor)) {
uVar7 = divisor;
if (bVar1 != 0) {
do {
uVar2 = CreateEnemy(87, this->entityType.parameter1);
uVar2 = CreateEnemy(87, this->entityType.form);
*ppEVar6 = uVar2;
ppEVar6 = ppEVar6 + 1;
uVar7 = uVar7 - 1;
@ -147,7 +147,7 @@ void sub_080450A8(Entity* this)
local_r6_72->attachedEntity = local_2c[iVar3];
iVar4 = Div(iVar4 + divisor + -1, divisor);
local_r6_72->parent = local_2c[iVar4];
(local_r6_72->entityType).parameter2 = 1;
(local_r6_72->entityType).parameter = 1;
local_r6_72->height.WORD = 0;
local_r6_72->hurtBlinkTime = 240;
sub_08045178(this, local_r6_72, *pcVar8, pcVar8[1]);

View File

@ -29,7 +29,7 @@ void sub_0806A1F8(Entity *this)
Entity *iVar1;
SpriteLoadData *paVar2;
(this->entityType).parameter1 == 0 ? (paVar2 = &gUnk_081121B4) : (paVar2 = &gUnk_081121C4);
(this->entityType).form == 0 ? (paVar2 = &gUnk_081121B4) : (paVar2 = &gUnk_081121C4);
iVar1 = LoadExtraSpriteData(this,paVar2);
if (iVar1) {

View File

@ -36,9 +36,9 @@ void sub_0806559C(Entity* this) {
s32 offset;
s32 result;
this->parameter3++;
if (this->parameter3 >= 9) {
this->parameter3 = 0;
this->actionDelay++;
if (this->actionDelay >= 9) {
this->actionDelay = 0;
result = sub_0806ED9C(this, 0x20, 0x20);
if (result < 0) {
offset = this->animationState + 4;

View File

@ -27,7 +27,7 @@ void sub_0806ABFC(Entity *this)
{
u8 animationState;
SpriteLoadData* SpriteLoadData = &gUnk_08112674[this->entityType.parameter1 << 2];
SpriteLoadData* SpriteLoadData = &gUnk_08112674[this->entityType.form << 2];
if (!LoadExtraSpriteData(this, SpriteLoadData))
{
return;
@ -35,13 +35,13 @@ void sub_0806ABFC(Entity *this)
InitializeAnimation(this, 2);
this->action = 1;
this->field_0x6a.HALF.LO = this->parameter3;
this->field_0x6a.HALF.LO = this->actionDelay;
this->animationState = this->field_0x6a.HALF.LO << 1;
animationState = this->animationState;
this->field_0x69 = animationState << 2;
this->parameter3 = 0;
this->actionDelay = 0;
}
// Not matching yet, not 100% sure it's functionally identical

View File

@ -7,7 +7,7 @@ void WindTribeFlag(Entity *this)
if (this->action == 0) {
this->action++;
this->collisionLayer = 2;
if ((this->entityType).parameter1 == 0) {
if ((this->entityType).form == 0) {
this->spriteSettings.b.ss6 = 0;
}
else {

View File

@ -36,6 +36,6 @@ void sub_080A2124(Entity *this)
void Windcrest_Unlock(Entity *this)
{
PlaySFX(0x72);
gUnk_02002A40.windcrests = gUnk_02002A40.windcrests | 1 << (this->entityType.parameter2 + 0x18);
gUnk_02002A40.windcrests = gUnk_02002A40.windcrests | 1 << (this->entityType.parameter + 0x18);
CreateFx(this, 0x46, 0);
}

View File

@ -11,7 +11,7 @@ void CopyPosition(Entity*, Entity*);
void sub_08068680(Entity*, Entity*);
void sub_08068694(Entity*, Entity*);
extern void SetGlobalFlag(u32);
extern Entity* CreateNPC(u32 subtype, u32 parameter1, u32 parameter2);
extern Entity* CreateNPC(u32 subtype, u32 form, u32 parameter);
u32 sub_0806EDC4(Entity* ent);
void DeleteThisEntity(void);
extern Entity* GetEntityByType(u32, u32);