This commit is contained in:
21aslade
2020-11-07 15:22:02 -07:00
432 changed files with 78818 additions and 59951 deletions
+1 -1
View File
@@ -20,7 +20,7 @@ void sub_0808F658(Entity* this) {
this->direction = 8;
this->nonPlanarMovement = gUnk_08121EB0[(this->entityType).form];
this->field_0x78.HWORD = gRoomControls.roomOriginX - 0x60;
this->field_0x7a.HWORD = gRoomControls.roomOriginX + gRoomControls.filler2[3] + 0x60;
this->field_0x7a.HWORD = gRoomControls.roomOriginX + gRoomControls.width + 0x60;
this->animationState = 0;
this->x.HALF.HI += (Random() & 0xf) << 4;
this->actionDelay = 0;
+111
View File
@@ -0,0 +1,111 @@
#include "global.h"
#include "entity.h"
#include "functions.h"
#include "flags.h"
extern void sub_08098E3C(Entity*);
extern void sub_08098E88(Entity*);
extern void (*const gUnk_0812367C[])(Entity*);
extern u16 gUnk_08123690[];
void BigVortex(Entity* this) {
if ((this->entityType).form == 0) {
gUnk_0812367C[this->action](this);
} else {
sub_08098E3C(this);
}
}
void sub_08098D1C(Entity* this) {
u32 temp;
this->action = 1;
this->height.HALF.HI = -0x10;
temp = this->field_0x86.HWORD;
if ((temp != 0) && !CheckFlags(temp)) {
this->action = 1;
} else {
this->action = 3;
this->spriteSettings.b.draw = TRUE;
sub_08098E88(this);
}
sub_0805E3A0(this, 6);
InitAnimationForceUpdate(this, 0);
}
void sub_08098D6C(Entity* this) {
Entity* ent;
if (CheckFlags(this->field_0x86.HWORD)) {
this->action = 2;
this->actionDelay = 0x2d;
ent = CreateFx(this, 0x43, 0);
if (ent != NULL) {
ent->y.HALF.HI += 8;
}
}
}
void sub_08098D9C(Entity* this) {
if (--this->actionDelay == 0) {
this->action = 3;
this->spriteSettings.b.draw = TRUE;
sub_08098E88(this);
}
}
void sub_08098DC4(Entity* this) {
if (sub_0800419C(this, &gPlayerEntity, 8, 8) != 0) {
CopyPosition(this, &gPlayerEntity);
sub_08004542(this);
sub_08004542(&gPlayerEntity);
gPlayerEntity.collisionLayer = 1;
ResolveEntityOnTop(this, &gPlayerEntity);
gPlayerState.playerAction = 0x1f;
gPlayerState.field_0x34[4] = 1;
gPlayerState.field_0x34[5] = this->entityType.parameter;
this->action = 4;
if (this->entityType.parameter == 1) {
SetGlobalFlag(0x23);
}
sub_08077B20();
}
UpdateAnimationSingleFrame(this);
}
void sub_08098E34(Entity* this) {
UpdateAnimationSingleFrame(this);
}
void sub_08098E3C(Entity* this) {
u16* temp;
if (this->action == 0) {
this->action = 1;
this->spriteSettings.b.draw = TRUE;
InitAnimationForceUpdate(this, this->entityType.form);
}
temp = &gUnk_08123690[this->entityType.form & 2];
sub_0805EC9C(this, temp[0], temp[1], 0);
UpdateAnimationSingleFrame(this);
}
void sub_08098E88(Entity* this) {
Entity* ent1;
Entity* ent2;
ent1 = CreateObject(0x82, 1, 0);
if (ent1 != NULL) {
PositionRelative(this, ent1, 0, -0x10000);
ent1->spriteOffsetY = 8;
}
ent2 = CreateObject(0x82, 2, 0);
if (ent2 != NULL) {
PositionRelative(this, ent2, 0, -0x20000);
ent2->spriteOffsetY = 0x10;
}
}
+144
View File
@@ -0,0 +1,144 @@
#include "global.h"
#include "entity.h"
#include "flags.h"
#include "functions.h"
extern void (*const gUnk_08123EC0[])(Entity*);
extern void (*const gUnk_08123EEC[])(Entity*);
extern void (*const gUnk_08123EF4[])(Entity*);
extern void (*const gUnk_08123EFC[])(Entity*);
extern void (*const gUnk_08123F04[])(Entity*);
void Bird(Entity* this) {
gUnk_08123EC0[this->entityType.form](this);
}
void sub_0809CF3C(Entity* this) {
gUnk_08123EEC[this->action](this);
}
void sub_0809CF54(Entity* this) {
Entity* target;
this->action++;
this->spriteSettings.b.draw = TRUE;
this->actionDelay = 0x31;
this->field_0xf = 1;
this->field_0x20 = -0x18000;
this->height.WORD = -0x38C000;
this->field_0x68.HWORD = -0x800;
this->nonPlanarMovement = 0x280;
this->direction = 8;
this->collisionLayer = 2;
this->x.HALF.HI = gRoomControls.roomScrollX;
PlaySFX(0x123);
UpdateSpriteForCollisionLayer(this);
InitAnimationForceUpdate(this, 0);
target = CreateObject(0x95, 1, 0);
if (target != NULL) {
target->parent = this;
PositionRelative(this, target, 0, 0x80000);
ResolveEntityOnTop(this, target);
}
}
void sub_0809CFEC(Entity* this) {
sub_0806F69C(this);
sub_08003FC4(this, *(s16*)&this->field_0x68.HWORD);
if (this->actionDelay != 0) {
if (--this->actionDelay == 0) {
this->field_0xf = 0;
}
} else if (sub_080040A8(this) == 0) {
DeleteThisEntity();
}
UpdateAnimationSingleFrame(this);
}
void sub_0809D030(Entity* this) {
gUnk_08123EF4[this->action](this);
}
void sub_0809D048(Entity* this) {
this->action++;
this->collisionLayer = 1;
UpdateSpriteForCollisionLayer(this);
InitAnimationForceUpdate(this, 0x17);
}
void sub_0809D06C(Entity* this) {
gUnk_08123EFC[this->previousActionFlag](this);
}
void sub_0809D084(Entity* this) {
u32 temp;
if (this->parent != NULL) {
temp = this->parent->field_0xf;
if (temp != 0) {
PositionRelative(this->parent, this, 0, 0x80000);
} else {
this->previousActionFlag++;
this->field_0x20 = temp;
}
}
}
void sub_0809D0AC(Entity* this) {
Entity* fx;
if (sub_080044EC(this, 0x1800) < 2) {
(this->entityType).form = 2;
this->action = 1;
this->height.WORD = 0;
this->collisionLayer = 1;
SetLocalFlag(0x45);
PlaySFX(0x72);
fx = CreateFx(this, 0x11, 0);
if (fx != NULL) {
sub_0806FAD8(this, fx);
}
}
}
void sub_0809D0F4(Entity* this) {
gUnk_08123F04[this->action](this);
}
void sub_0809D10C(Entity* this) {
this->action++;
this->collisionLayer = 1;
UpdateSpriteForCollisionLayer(this);
InitAnimationForceUpdate(this, 0x17);
}
void sub_0809D130(Entity* this) {
if ((gPlayerState.flags.all & 0x80) != 0) {
sub_0800445C(this);
} else if (sub_08017850(this) != 0) {
CreateItemEntity(0x17, 0, 0);
gUnk_02002A40.windcrests |= 0x10000000;
DeleteThisEntity();
}
}
void sub_0809D178(Entity* this) {
if (this->action == 0) {
this->action++;
this->collisionLayer = 2;
UpdateSpriteForCollisionLayer(this);
this->frames.all = 0x80;
}
if ((this->frames.all & 0x80) != 0) {
InitializeAnimation(this, Random() & 3);
this->frameDuration = (Random() & 0xf) + 0x10;
this->spriteSettings.b.flipX = FALSE;
if ((Random() & 1) != 0) {
this->spriteSettings.b.flipX = TRUE;
}
} else {
GetNextFrame(this);
}
}
+286
View File
@@ -0,0 +1,286 @@
#include "global.h"
#include "entity.h"
#include "flags.h"
#include "room.h"
#include "functions.h"
extern void (*const gUnk_0811EE38[])(Entity*);
void Button(Entity* this) {
gUnk_0811EE38[this->action](this);
}
extern u32 sub_08081E3C(Entity*);
void sub_08081AE0(Entity* this) {
this->flags &= 0x7F;
this->scriptedScene = 3;
this->y.HALF.HI++;
if (this->cutsceneBeh.HWORD != 0) {
this->collisionLayer = this->cutsceneBeh.HWORD;
}
this->field_0x74.HWORD = (((this->x.HALF.HI - gRoomControls.roomOriginX)>>4) & 0x3F) |
((((this->y.HALF.HI - gRoomControls.roomOriginY)>>4) & 0x3F) << 6);
this->field_0x70.HALF.HI = GetTileType(this->field_0x74.HWORD, this->collisionLayer);
if (this->entityType.form == 0 && CheckFlags(this->field_0x86.HWORD)) {
this->action = 5;
SetTileType(0x7A, this->field_0x74.HWORD, this->collisionLayer);
} else {
if (sub_08081E3C(this)) {
this->action = 2;
} else {
this->action = 1;
}
}
}
void sub_08081B84(Entity* this) {
if (sub_08081E3C(this)) {
this->action=2;
this->field_0x70.HALF.HI = GetTileType(this->field_0x74.HWORD, this->collisionLayer);
}
}
u32 sub_08081CB0(Entity*);
void sub_0805E4E0(Entity*, u32);
void sub_08081FF8(Entity*);
void sub_08081BAC(Entity* this) {
if (sub_08081CB0(this)) {
this->previousActionFlag = 0;
this->actionDelay = 0xA;
sub_0805E4E0(this, 0xA);
sub_08081FF8(this);
if (this->entityType.form == 1) {
this->action = 3;
} else {
this->action = 5;
}
}
}
u32 sub_08081F7C(Entity*, u32);
u32 sub_08081D28(Entity*);
void sub_08081E6C(Entity*);
void sub_08081BE0(Entity* this) {
if (!sub_08081F7C(this, 0x78))
return;
if (!sub_08081D28(this)) {
this->action = 4;
this->field_0xf = 1;
if ((gPlayerState.heldObject == 2) || (!(gPlayerState.field_0x34[1] & 0x80))) {
this->actionDelay = 0x18;
} else {
this->actionDelay = 0x8;
}
} else {
sub_08081E6C(this);
}
}
void sub_08081C30(Entity* this) {
if (this->actionDelay != 0) {
this->actionDelay--;
if (this->field_0xf != 0) {
this->field_0xf = 0;
SetTile(0x4035, this->field_0x74.HWORD, this->collisionLayer);
}
if (sub_08081CB0(this)) {
this->action = 3;
this->actionDelay = 0;
}
} else {
this->action = 2;
ClearFlag(this->field_0x86.HWORD);
SetTileType(0x77, this->field_0x74.HWORD, this->collisionLayer);
PlaySFX(0x10C);
}
}
void sub_08081C98(Entity* this) {
if (sub_08081F7C(this, 0x7a)) {
sub_08081E6C(this);
}
}
Entity* sub_08081D74(Entity*);
void sub_0807B7D8(u32, u32, u32);
u32 sub_080001DA(u32, u32);
u32 sub_08081CB0(Entity* this) {
u16 tmp;
if (sub_08081D74(this)) {
this->field_0x70.HALF.LO = -1;
if (GetTileType(this->field_0x74.HWORD, this->collisionLayer) == 0x4035) {
sub_0807B7D8(0x78, this->field_0x74.HWORD, this->collisionLayer);
}
return 1;
} else {
tmp = GetTileType(this->field_0x74.HWORD, this->collisionLayer);
if (tmp != 0x77 && tmp != 0x79 && tmp != 0x4035) {
this->field_0x70.HALF.LO = sub_080001DA(this->field_0x74.HWORD, this->collisionLayer);
return 1;
}
}
return 0;
}
u32 sub_08081D28(Entity* this) {
if (sub_08081D74(this)) {
this->field_0x70.HALF_U.LO = 0xFFFF;
return 1;
} else {
if (this->field_0x70.HALF_U.LO == 0xFFFF) {
return 0;
}
if (sub_080001DA(this->field_0x74.HWORD, this->collisionLayer) != this->field_0x70.HALF_U.LO) {
return 0;
}
}
return 1;
}
extern u32 sub_080002E0(u32, u32);
extern Entity* gUnk_03004040[];
extern u32 sub_080041A0(Entity*, Entity*, u32, u32);
u32 sub_08081E0C(Entity*);
Entity* sub_08081D74(Entity* this) {
Entity* ent;
if (sub_080002E0(this->field_0x74.HWORD, this->collisionLayer) == 0xF) {
return 0;
}
ent = 0;
if (sub_08081E0C(this)) {
if (!(gPlayerState.flags.all & 0x10) && !(gPlayerState.flags.all & 0x80)) {
ent = &gPlayerEntity;
}
} else {
if (gPlayerState.flags.all & 0x400000) {
if (sub_080041A0(this, gUnk_03004040[0], 5, 6)) {
ent = gUnk_03004040[0];
} else if (sub_080041A0(this, gUnk_03004040[1], 5, 6)) {
ent = gUnk_03004040[1];
} else if (sub_080041A0(this, gUnk_03004040[2], 5, 6)) {
ent = gUnk_03004040[2];
}
}
}
this->attachedEntity=ent;
return ent;
}
extern u32 sub_08079F8C();
u32 sub_08081E0C(Entity* this) {
Entity* tmp = &gPlayerEntity;
if (tmp->height.HALF.HI != 0 || !sub_08079F8C()) {
return 0;
} else {
return sub_080041A0(this, tmp, 5, 6);
}
}
extern u16 gUnk_0811EE50[];
u32 sub_08081E3C(Entity* this) {
u16* tmp1;
int tmp2;
tmp2 = GetTileType(this->field_0x74.HWORD, this->collisionLayer);
tmp1 = gUnk_0811EE50;
do {
if (*tmp1 == tmp2) return 1;
} while (*++tmp1);
return 0;
}
u32 sub_08081F00(u32*, u32*);
extern u16 gMapDataTopSpecial[0x2000];
#ifdef NON_MATCHING
void sub_08081E6C(Entity* this) {
u32 r4;
u16 *tmp, *r1;
u8 *tmp2;
u32 r6 = this->field_0x74.HWORD;
u32 r5 = this->collisionLayer;
u32 tile = GetTileType(r6,r5);
if (tile < 0x4000)
return;
r1 = GetLayerByIndex(r5);
r4 = (this->entityType.form == 0 ? 0x7a : 0x78);
tmp = r1 + 0x3802;
r1 += 0x3002 + r4;
tmp = tmp + (*r1 << 2);
tmp2 = (r5 == 2 ? gMapDataTopSpecial : (u8*)&gUnk_02019EE0);
tmp2 += (((0x3f & r6)<<1)+((0xfc0 & r6)<<2))<<1;
if (sub_08081F00((u32*)tmp2, (u32*)tmp))
return;
SetTileType(r4, r6, r5);
SetTile(tile,r6,r5);
}
#else
NAKED
void sub_08081E6C(Entity* this) {
asm(".include \"asm/non_matching/button/sub_08081E6C.s\"");
}
#endif
u32 sub_08081F00(u32* unk1, u32* unk2) {
if (*unk1 != *unk2) return 0;
if (unk1[0x40] != unk2[1]) return 0;
return 1;
}
void sub_08081F24(Entity* this) {
Entity* fx = CreateFx(this, 0x11, 0x40);
if (fx) {
fx->scriptedScene = 3;
fx->x.HALF.HI += 7;
fx->y.HALF.HI += 5;
}
fx = CreateFx(this, 0x11, 0x40);
if (fx) {
fx->scriptedScene = 3;
fx->x.HALF.HI -= 7;
fx->y.HALF.HI += 5;
}
}
u32 sub_08081F7C(Entity* this, u32 r7) {
u16 tmp;
if (this->actionDelay == 0) return 1;
if (--this->actionDelay > 6) {
if(this->attachedEntity)
this->attachedEntity->spriteOffsetY = 0xfc;
} else {
if (this->actionDelay == 6) {
SetFlag(this->field_0x86.HWORD);
SetTileType(r7, this->field_0x74.HWORD, this->collisionLayer);
sub_08081F24(this);
PlaySFX(0x10C);
if (this->field_0x70.HALF_U.LO != 0xFFFF)
SetTile(this->field_0x70.HALF_U.LO, this->field_0x74.HWORD, this->collisionLayer);
return 0;
}
}
return 1;
}
extern Entity* gUnk_03004040[3];
extern void sub_080044AE(Entity*, u32, u32);
void sub_08081FF8(Entity* this) {
u32 direction;
u32 i;
if (this->attachedEntity != &gPlayerEntity) return;
direction = GetFacingDirection(this->attachedEntity, this);
sub_080044AE(this->attachedEntity, 0x200, direction);
for (i = 0; i < 3; i++) {
if (gUnk_03004040[i]) {
sub_080044AE(gUnk_03004040[i],0x200, direction);
}
}
}
+4 -5
View File
@@ -3,6 +3,7 @@
#include "room.h"
#include "player.h"
#include "flags.h"
#include "functions.h"
extern void sub_0809F7BC(Entity*);
extern void PlaySFX(u32);
@@ -13,7 +14,6 @@ extern void DeleteThisEntity();
extern u32 CheckRoomFlag(u32);
extern void sub_08078A90(u32);
extern void sub_08078B48(void);
extern u32 Random(void);
extern void sub_0806F69C(Entity*);
extern void (*gUnk_08124798[])(Entity*);
extern void (*gUnk_081247A0[])(Entity*);
@@ -23,7 +23,6 @@ extern void PositionEntityOnTop(Entity*, Entity*);
extern void sub_0807BB68(u32*, u32, u32);
extern u8 gUnk_02034490;
extern u32 gScreenTransition;
extern void* gUnk_080DD750;
extern Entity gPlayerEntity;
extern PlayerState gPlayerState;
@@ -62,7 +61,7 @@ void sub_0809F548(Entity* this) {
sub_0809F814((((this->x.HALF.HI - gRoomControls.roomOriginX) >> 4) & 63) |
(((this->y.HALF.HI - gRoomControls.roomOriginY) >> 4) & 63) << 6);
} else {
if ((gScreenTransition & 7) == 0) {
if ((gScreenTransition.frameCount & 7) == 0) {
sub_0809F7BC(this);
}
sub_0809F7F4(this);
@@ -110,7 +109,7 @@ void sub_0809F61C(Entity* this) {
sub_0809F814((((this->x.HALF.HI - gRoomControls.roomOriginX) >> 4) & 63) |
(((this->y.HALF.HI - gRoomControls.roomOriginY) >> 4) & 63) << 6);
} else {
if ((gScreenTransition & 7) == 0) {
if ((gScreenTransition.frameCount & 7) == 0) {
sub_0809F7BC(this);
}
sub_0809F7F4(this);
@@ -145,7 +144,7 @@ void sub_0809F700(Entity* this) {
this->actionDelay = (Random() & 30) + 8;
this->flags = this->flags | 12;
}
if ((gScreenTransition & 3) == 0) {
if ((gScreenTransition.frameCount & 3) == 0) {
uVar2 = Random();
this->spriteOffsetX = gUnk_081247C0[uVar2 & 7];
this->spriteOffsetY = gUnk_081247C0[uVar2 >> 4 & 7];
+2 -2
View File
@@ -40,8 +40,8 @@ void sub_0809ED88(Entity *this)
{
sub_0809F08C();
sub_0809EE44(this);
if (this->field_0x86 != 0) {
if (this->cutsceneBeh.HWORD == this->field_0x86) {
if (this->field_0x86.HWORD != 0) {
if (this->cutsceneBeh.HWORD == this->field_0x86.HWORD) {
if (CheckFlags(this->cutsceneBeh.HWORD)) {
return;
}
+13
View File
@@ -0,0 +1,13 @@
#include "global.h"
#include "entity.h"
#include "functions.h"
void FloatingBlock(Entity* this) {
if (this->action == 0) {
this->action = 1;
this->frameIndex=this->entityType.form;
this->spritePriority.b0 = 0xe;
this->collisionLayer = 1;
UpdateSpriteForCollisionLayer(this);
}
}
+4 -4
View File
@@ -4,6 +4,7 @@
#include "screen.h"
#include "greatFairy.h"
#include "structures.h"
#include "functions.h"
enum {
BEHAVIORS,
@@ -550,14 +551,14 @@ void sub_08087424(Entity* arg0, struct_08087424* arg1) {
void sub_0808747C(u32 arg0, u32 arg1) {
u32 iVar1;
iVar1 = FindEntityInListByForm(0x6, 0xf, 0x6, 0xb, 0x0);
iVar1 = (u32)FindEntityInListByForm(0x6, 0xf, 0x6, 0xb, 0x0);
if (iVar1 != 0) {
iVar1 = 1;
}
*(u32*)(arg1 + 0x14) = iVar1;
}
//clang-format off
// clang-format off
void (*const GreatFairy_Main[])(Entity*) = {
GreatFairy_CallBehavior,
GreatFairy_WingsCallBehavior,
@@ -647,5 +648,4 @@ void (*const GreatFairy_Form2Behaviors[])(Entity*) = {
sub_08087264,
sub_0808727C
};
//clang-format on
// clang-format on
+2 -4
View File
@@ -5,9 +5,7 @@
extern void DeleteThisEntity();
extern void sub_08080CB4(Entity*);
extern int sub_08017850(Entity*);
extern void CreateItemEntity(u32, u32, u32);
extern u32 sub_08017850(Entity*);
static void sub_0808E6A0(Entity*);
static void sub_0808E6E4(Entity*);
static void sub_0808E714(Entity*);
@@ -39,7 +37,7 @@ static void sub_0808E6A0(Entity* this) {
}
static void sub_0808E6E4(Entity* this) {
if (CheckFlags(this->field_0x86)) {
if (CheckFlags(this->field_0x86.HWORD)) {
this->action = 2;
this->spriteSettings.b.draw = 1;
this->spriteRendering.b0 = 3;
+44
View File
@@ -0,0 +1,44 @@
#include "global.h"
#include "entity.h"
#include "functions.h"
#include "room.h"
#include "flags.h"
extern void (*const gUnk_08122604[])(Entity*);
void HiddenLadderDown(Entity* this) {
if (this->action < 2) {
gUnk_08122604[this->action](this);
}
}
void sub_08091F14(Entity* this) {
u16* puVar3;
this->action = 1;
this->spritePriority.b0 = 7;
this->animIndex = 0;
this->field_0x70.HALF.LO = COORD_TO_TILE(this);
puVar3 = &this->field_0x70.HALF.LO;
if (CheckFlags(this->field_0x86.HWORD) != 0) {
this->action = 2;
this->spriteSettings.b.draw = TRUE;
SetTileType(0x1a2, *puVar3 - 0x41, this->collisionLayer);
SetTileType(0x1a3, *puVar3 - 0x40, this->collisionLayer);
SetTileType(0x1a4, *puVar3 - 0x3f, this->collisionLayer);
SetTileType(0x1a5, *puVar3 - 1, this->collisionLayer);
SetTileType(0x1a6, *puVar3, this->collisionLayer);
SetTileType(0x1a7, *puVar3 + 1, this->collisionLayer);
SetTileType(0x1a8, *puVar3 + 0x3f, this->collisionLayer);
SetTileType(0x1a9, *puVar3 + 0x40, this->collisionLayer);
SetTileType(0x1aa, *puVar3 + 0x41, this->collisionLayer);
}
}
void sub_08092000(Entity* this) {
if (GetTileType(*(u16*)&this->field_0x70.HALF.LO, this->collisionLayer) == 0x1a6) {
this->action = 2;
this->spriteSettings.b.draw = TRUE;
SetFlag(this->field_0x86.HWORD);
}
}
+442
View File
@@ -0,0 +1,442 @@
#include "global.h"
#include "entity.h"
#include "flags.h"
#include "functions.h"
#include "player.h"
static void sub_08081150(Entity*);
static u8 sub_0808147C(u32);
static void sub_080814A4(Entity*);
static u32 sub_080814C0(Entity*);
static void sub_08081500(Entity*);
static void sub_0808153C(Entity*);
static void sub_08081598(Entity*);
static void sub_080813BC(Entity*);
static void sub_080810FC(Entity*);
static bool32 CheckShouldPlayItemGetCutscene(Entity*);
extern u32 sub_080002D0(Entity*);
extern u32 sub_080177A0(Entity*, Entity*);
extern void GiveItem(u32, u32);
extern u32 sub_0805E40C(Entity*);
extern void (*const gUnk_0811E7D4[])(Entity*);
extern void (*const gUnk_0811E7E8[])(Entity*);
extern void (*const gUnk_0811E814[])(Entity*);
extern void (*const gUnk_0811E840[])(Entity*);
extern BoundingBox gUnk_080FD1A8;
typedef struct {
u8 unk0[3];
u8 unk3;
u8 unk4[4];
} Unk_080FD5B4;
extern const Unk_080FD5B4 gUnk_080FD5B4[];
typedef struct {
u8 unk0[2];
u16 sfx;
u8 unk4;
u8 unk5[3];
} Unk_0811E84C;
extern const Unk_0811E84C gUnk_0811E84C[];
void ItemOnGround(Entity* this) {
if (this->bitfield & 0x80) {
switch (this->bitfield & 0x7F) {
case 20:
this->action = 3;
this->flags &= 0x7F;
this->spriteSettings.b.draw = 1;
this->field_0x3c |= 0x10;
this->attachedEntity = this->field_0x4c;
break;
case 0:
case 1:
case 4:
case 5:
case 6:
case 8:
case 9:
case 10:
case 11:
case 12:
case 30:
sub_08081598(this);
break;
}
}
if (sub_0806F520(this)) {
sub_080813BC(this);
} else {
gUnk_0811E7D4[this->action](this);
}
if (this->entityType.form == 0x5C) {
gRoomVars.field_0x4++;
}
sub_08080CB4(this);
}
void sub_08080F20(Entity* this) {
if (this->field_0x86.HWORD && CheckFlags(this->field_0x86.HWORD)) {
DeleteThisEntity();
}
if (this->entityType.form != 0x60) {
this->spriteSettings.b.draw = 1;
this->spritePriority.b1 = 3;
this->spriteSettings.b.shadow = 0;
this->damageType = 7;
this->field_0x3c = 0x47;
this->field_0x40 = 0x44;
this->currentHealth = 0xFF;
this->boundingBox = &gUnk_080FD1A8;
switch (this->entityType.form - 0x3F) {
case 0:
case 21:
case 22:
case 23:
case 24:
case 25:
case 29:
case 30:
case 31:
case 32:
this->flags2 = 0x17;
break;
default:
this->flags2 = 0x11;
break;
}
this->field_0x68.HALF.HI = this->actionDelay;
this->field_0x6a.HALF.LO = 0;
this->field_0x6c.HWORD = 0;
this->field_0x68.HALF.LO = 0;
this->actionDelay = 0;
sub_0805E3A0(this, 3);
this->field_0x1c = sub_0808147C(this->entityType.form);
gUnk_0811E7E8[this->field_0x68.HALF.HI](this);
} else {
Entity* entity = CreateObject(0x40, 0x60, 0);
if (entity) {
entity->actionDelay = 0;
if (this->actionDelay == 1) {
entity->entityType.parameter = 2;
}
CopyPosition(this, entity);
DeleteThisEntity();
}
}
}
static void sub_080810A8(Entity* this) {
this->action = 1;
sub_080814A4(this);
if (this->direction & 0x80) {
this->direction &= 0x1F;
if (this->nonPlanarMovement == 0) {
this->nonPlanarMovement = 0x100;
}
} else {
this->direction |= 0xFF;
}
if (this->field_0x20 == 0) {
this->field_0x20 = 0x1E000;
}
if (this->collisionLayer == 2) {
sub_08016A30(this);
}
}
static void sub_080810FC(Entity* this) {
if (this->entityType.form != 0x5F) {
sub_08081598(this);
} else {
this->action = 2;
this->previousActionFlag = 0;
this->flags |= 0x80;
this->flags2 = 0x11;
CopyPosition(&gPlayerEntity, this);
}
}
void sub_08081134(Entity* this) {
sub_080814A4(this);
this->field_0x6c.HWORD += 80;
sub_08081150(this);
}
static void sub_08081150(Entity* this) {
this->action = 2;
this->flags |= 0x80;
this->height.HALF.HI = -0x80;
this->spriteOrientation.flipY = 1;
this->spriteRendering.b3 = 1;
PlaySFX(0x12D);
}
static void sub_08081188(Entity* this) {
this->action = 2;
this->flags |= 0x80;
if (this->collisionLayer == 2) {
sub_08016A30(this);
}
}
void sub_080811AC(Entity* this) {
this->action = 2;
this->spriteSettings.b.draw = 0;
this->field_0x6e.HWORD = GetTileTypeByEntity(this);
}
void sub_080811C8(Entity* this) {
this->action = 2;
this->spriteSettings.b.draw = 0;
}
void sub_080811D8(Entity* this) {
sub_08081188(this);
PlaySFX(0x215);
}
void sub_080811EC(Entity* this) {
if (this->field_0x68.HALF.HI != 6) {
sub_080AEFE0(this);
} else {
sub_0806F69C(this);
}
sub_08003FC4(this, 0x2800);
if (this->field_0x20 <= 0) {
this->action = 2;
this->flags |= 0x80;
sub_080814A4(this);
}
}
void sub_0808122C(Entity* this) {
gUnk_0811E814[this->field_0x68.HALF.HI](this);
}
void sub_08081248(Entity* this) {
sub_08081500(this);
if (sub_080814C0(this)) {
sub_08081404(this, 0);
} else {
sub_0800442E(this);
}
}
void sub_0808126C(Entity* this) {
UpdateAnimationSingleFrame(this);
sub_0808153C(this);
}
void sub_0808127C(Entity* this) {
if (sub_080814C0(this)) {
sub_08081404(this, 0);
} else {
sub_0808153C(this);
}
}
void nullsub_113(Entity* this) {
}
void sub_080812A0(Entity* this) {
sub_08081500(this);
}
void sub_080812A8(Entity* this) {
if (sub_080002D0(this) != 0xF && this->field_0x6e.HWORD != GetTileTypeByEntity(this)) {
this->direction = 0;
this->nonPlanarMovement = 0;
this->spriteSettings.b.draw = 1;
this->field_0x68.HALF.HI = 0;
sub_080810A8(this);
}
}
void sub_080812E8(Entity* this) {
PlayerState* playerState = &gPlayerState;
if ((playerState->swimState & 0x80) &&
!(playerState->flags.all & 0x80) &&
sub_080177A0(this, &gPlayerEntity)) {
sub_080810FC(this);
}
}
void nullsub_510(Entity* this) {
}
void sub_08081328(Entity* this) {
Entity* other = this->attachedEntity;
if (!(other->entityType.type == 8 && other->entityType.subtype == 3)) {
sub_08081404(this, 0);
} else {
CopyPosition(other, this);
this->height.HALF.HI--;
other = &gPlayerEntity;
if (sub_080177A0(this, other)) {
sub_080810FC(this);
}
}
}
void sub_0808136C(Entity* this) {
if (--this->actionDelay) {
Entity* other = this->attachedEntity;
this->x.WORD = other->x.WORD;
this->y.WORD = other->y.WORD;
this->spriteOrientation.flipY = other->spriteOrientation.flipY;
this->spriteRendering.b3 = other->spriteRendering.b3;
sub_08003FC4(this, 0x2800);
} else {
sub_08081404(this, 1);
}
}
static void sub_080813BC(Entity* this) {
gUnk_0811E840[this->previousActionFlag](this);
}
void sub_080813D4(Entity* this) {
this->previousActionFlag = 1;
this->field_0x1d = 1;
this->spriteSettings.b.draw = 1;
}
void sub_080813E8(Entity* this) {
sub_0806F4E8(this);
}
void sub_080813F0(Entity* this) {
if (sub_0806F3E4(this)) {
sub_080810FC(this);
}
}
void sub_08081404(Entity* this, u32 arg1) {
if (arg1 && this->field_0x86.HWORD) {
SetFlag(this->field_0x86.HWORD);
}
DeleteThisEntity();
}
bool32 sub_08081420(Entity* this) {
if (CheckShouldPlayItemGetCutscene(this)) {
sub_0805E3A0(this, 6);
CreateItemEntity(this->entityType.form, this->entityType.parameter, 0);
return TRUE;
} else {
GiveItem(this->entityType.form, this->entityType.parameter);
return FALSE;
}
}
static bool32 CheckShouldPlayItemGetCutscene(Entity* this) {
bool32 result = FALSE;
if ((gUnk_080FD5B4[this->entityType.form].unk0[3] & 0x2) || !GetInventoryValue(this->entityType.form)) {
result = TRUE;
}
return result;
}
static u8 sub_0808147C(u32 arg0) {
const Unk_0811E84C* var0 = &gUnk_0811E84C[arg0];
return var0->unk4;
}
void sub_0808148C(u32 arg0) {
const Unk_0811E84C* var0 = &gUnk_0811E84C[arg0];
if (var0->sfx) {
PlaySFX(var0->sfx);
}
}
static void sub_080814A4(Entity* this) {
if (this->field_0x68.HALF.HI == 10) {
this->field_0x6c.HWORD = 120;
} else {
this->field_0x6c.HWORD = 600;
}
}
static u32 sub_080814C0(Entity* this) {
if (!sub_0805E40C(this)) {
if (--this->field_0x6c.HWORD == 0) {
return TRUE;
}
if (this->field_0x6c.HWORD < 90) {
this->spriteSettings.b.draw ^= 1;
}
}
return FALSE;
}
static void sub_08081500(Entity* this) {
if (this->field_0x68.HALF.LO == 0) {
u32 var0 = sub_080044EC(this, 0x2800);
if (var0 == 0) {
this->field_0x68.HALF.LO = 1;
} else {
if (var0 == 1) {
sub_0808148C(this->entityType.form);
UpdateSpriteForCollisionLayer(this);
}
sub_080AEFE0(this);
}
}
}
static void sub_0808153C(Entity* this) {
if (this->field_0x68.HALF.LO > 1)
return;
if (this->field_0x68.HALF.LO == 0) {
if (!sub_08003FC4(this, 0x1000) && !sub_0800442E(this)) {
this->field_0x68.HALF.LO = 1;
this->field_0x20 = 0x1E000;
sub_0808148C(this->entityType.form);
UpdateSpriteForCollisionLayer(this);
}
} else {
if (!sub_08003FC4(this, 0x2800)) {
this->field_0x68.HALF.LO = 2;
sub_0808148C(this->entityType.form);
}
}
}
static void sub_08081598(Entity* this) {
if (this->currentHealth == 0) {
sub_08081404(this, 1);
}
this->flags &= 0x7F;
this->action = 4;
this->actionDelay = 14;
this->field_0x20 = 0x20000;
this->spriteSettings.b.draw = 1;
this->spritePriority.b1 = 2;
this->spritePriority.b0 = 3;
this->attachedEntity = &gPlayerEntity;
CopyPosition(this->attachedEntity, this);
this->height.HALF.HI -= 4;
if (this->entityType.form != 0x5F && sub_08081420(this)) {
sub_08081404(this, 1);
}
}
+2 -2
View File
@@ -18,7 +18,7 @@ void JailBars(Entity *this)
void sub_080A08C4(Entity *this)
{
if (CheckFlags(this->field_0x86) == 0) {
if (CheckFlags(this->field_0x86.HWORD) == 0) {
this->action = 1;
sub_080A0960(this, 0);
}
@@ -34,7 +34,7 @@ void sub_080A08C4(Entity *this)
void sub_080A0910(Entity *this)
{
if (CheckFlags(this->field_0x86) != 0) {
if (CheckFlags(this->field_0x86.HWORD) != 0) {
this->action = 2;
sub_080A0960(this, 1);
PlaySFX(0x10b);
+10 -10
View File
@@ -7,7 +7,7 @@
extern void sub_0809EB30(Entity*);
extern void sub_0809EAD8(Entity*);
extern void sub_0809EABC(Entity*);
extern void sub_08004488(u32);
extern void EnqueueSFX(u32);
extern void sub_080A2CC0(Entity*, Entity**, u16*);
extern Entity* GetCurrentRoomProperty(u32);
extern void SetTile(u32, u32, u32);
@@ -45,12 +45,12 @@ void sub_0809EA34(Entity* this) {
void sub_0809EA80(Entity* this) {
if ((this->bitfield & 0x80) != 0) {
if (CheckFlags(this->field_0x86) != 0) {
ClearFlag(this->field_0x86);
if (CheckFlags(this->field_0x86.HWORD) != 0) {
ClearFlag(this->field_0x86.HWORD);
} else {
SetFlag(this->field_0x86);
SetFlag(this->field_0x86.HWORD);
}
sub_08004488(0x110);
EnqueueSFX(0x110);
}
sub_0809EABC(this);
}
@@ -59,7 +59,7 @@ void sub_0809EABC(Entity* this) {
bool32 anySet;
u32 f;
f = CheckFlags(this->field_0x86);
f = CheckFlags(this->field_0x86.HWORD);
anySet = (-f | f) >> 0x1F;
if (this->frameIndex != anySet) {
this->frameIndex = anySet;
@@ -122,8 +122,8 @@ void sub_0809EBD8(Entity* this) {
this->action = 2;
this->actionDelay = 0x10;
this->frameIndex = 2;
SetFlag(this->field_0x86);
sub_08004488(0x110);
SetFlag(this->field_0x86.HWORD);
EnqueueSFX(0x110);
}
}
@@ -136,8 +136,8 @@ void sub_0809EC08(Entity* this) {
if (--this->actionDelay == 0) {
this->action = 1;
this->frameIndex = 3;
ClearFlag(this->field_0x86);
sub_08004488(0x110);
ClearFlag(this->field_0x86.HWORD);
EnqueueSFX(0x110);
}
}
}
+5 -5
View File
@@ -20,7 +20,7 @@ extern void sub_08000148(u16, u16, u32);
extern s16 sub_080001DA(u16, u32);
extern u16 sub_080002E0(u16, u32);
extern void sub_08004488(u32);
extern void EnqueueSFX(u32);
extern void sub_080044EC(Entity *, u16);
extern void sub_0805457C(Entity *, s32);
@@ -31,7 +31,7 @@ void Mask(Entity *this) {
void sub_080929A4(Entity *this) {
if (this->entityType.parameter & 0xC0) {
if (CheckFlags(this->field_0x86)) {
if (CheckFlags(this->field_0x86.HWORD)) {
s32 field_0x0a;
switch (this->entityType.parameter & 0xC0) {
@@ -45,7 +45,7 @@ void sub_080929A4(Entity *this) {
goto switchEnd;
}
ClearFlag(this->field_0x86);
ClearFlag(this->field_0x86.HWORD);
break;
case 0x80:
DeleteThisEntity();
@@ -115,9 +115,9 @@ void sub_08092B0C(Entity *this) {
switch (this->entityType.parameter & 0xC0)
{
case 0x80:
sub_08004488(0x72);
EnqueueSFX(0x72);
case 0x40:
SetFlag(this->field_0x86);
SetFlag(this->field_0x86.HWORD);
break;
}
+3 -3
View File
@@ -6,7 +6,7 @@
extern u32 sub_08083734(Entity*, u32);
extern void sub_080A080C(Entity*);
extern void sub_0806F69C(Entity*);
extern void sub_08004488(u32);
extern void EnqueueSFX(u32);
extern void sub_080A0870(Entity*);
extern void PlaySFX(u32);
extern u32 sub_080001DA(u32, u32);
@@ -71,13 +71,13 @@ void sub_080A074C(Entity *this)
ent->x.HALF.HI -= 0xc;
ent->y.HALF.HI -= 0xc;
}
sub_08004488(0x10b);
EnqueueSFX(0x10b);
}
}
void sub_080A07BC(Entity *this)
{
if (CheckFlags(this->field_0x86)) {
if (CheckFlags(this->field_0x86.HWORD)) {
this->action = 4;
this->actionDelay = 0xc;
this->direction = 0x10;
+1 -1
View File
@@ -50,7 +50,7 @@ void sub_080916EC(Entity* this) {
this->field_0x3c = 0x47;
this->field_0x40 = 0x44;
this->flags2 = 0x80;
this->direction = this->animationState << 3;
this->direction = DirectionFromAnimationState(this->animationState);
this->nonPlanarMovement = 0x700;
this->spritePriority.b1 = 3;
InitAnimationForceUpdate(this, this->entityType.parameter + 4 + this->animationState);
+2 -2
View File
@@ -30,8 +30,8 @@ void MineralWaterSource_Init(Entity *this) {
this->entityType.parameter = unknownParameters->field_0x00;
this->field_0x40 = unknownParameters->field_0x03;
this->boundingBox->field_0x6 = unknownParameters->field_0x01;
this->boundingBox->field_0x7 = unknownParameters->field_0x02;
this->boundingBox->unknown[6] = unknownParameters->field_0x01;
this->boundingBox->unknown[7] = unknownParameters->field_0x02;
this->flags |= 0x80;
-1
View File
@@ -1,7 +1,6 @@
#include "global.h"
#include "entity.h"
extern u32 Random();
extern bool32 CheckIsDungeon();
extern void sub_080AE068(Entity*);
extern void LoadFixedGFX(Entity*, u32);
+3 -9
View File
@@ -1,12 +1,8 @@
#include "global.h"
#include "entity.h"
#include "functions.h"
extern void CopyPosition();
extern void sub_08086A6C();
extern s32 sub_080044EC();
extern void sub_080AEF88();
extern void DeleteThisEntity();
extern u32 Random(void);
extern void (*gUnk_081206C4[99])(Entity*);
@@ -35,16 +31,14 @@ void sub_080869DC(Entity* ent) {
}
void sub_08086A28(Entity* ent) {
s32 iVar1;
if (ent->attachedEntity->next == NULL) {
ent->action = 2;
} else {
iVar1 = sub_080044EC(ent, 10240);
u32 iVar1 = sub_080044EC(ent, 10240);
if (iVar1 == 0) {
ent->action = 2;
}
sub_080AEF88(ent);
ProcessMovement(ent);
CopyPosition(ent, ent->attachedEntity);
}
}
+2 -2
View File
@@ -30,11 +30,11 @@ void sub_08089B18(Entity *this)
CopyPosition(this->parent, this);
break;
case 4:
if (!CheckFlags(this->field_0x86)) {
if (!CheckFlags(this->field_0x86.HWORD)) {
this->spriteSettings.b.draw = FALSE;
this->previousActionFlag = 1;
return;
}
}
sub_08004488(0x124);
EnqueueSFX(0x124);
}
+4 -4
View File
@@ -243,10 +243,10 @@ void sub_0808F498(Entity* this) {
this->action = 1;
this->actionDelay = 64;
var0 = this->entityType.parameter != 0 ? 44 : 43;
this->x.HALF.HI -= this->parent->boundingBox->field_0x6;
this->x.HALF.HI += (s32)Random() % (this->parent->boundingBox->field_0x6 * 2);
this->y.HALF.HI -= this->parent->boundingBox->field_0x7;
this->y.HALF.HI += (s32)Random() % (this->parent->boundingBox->field_0x7 * 2);
this->x.HALF.HI -= this->parent->boundingBox->unknown[6];
this->x.HALF.HI += (s32)Random() % (this->parent->boundingBox->unknown[6] * 2);
this->y.HALF.HI -= this->parent->boundingBox->unknown[7];
this->y.HALF.HI += (s32)Random() % (this->parent->boundingBox->unknown[7] * 2);
sub_0801D2B4(this, var0);
InitializeAnimation(this, 4);
}
-1
View File
@@ -7,7 +7,6 @@ extern u32 sub_080041A0(Entity*, Entity*, u32, u32);
void sub_08099ECC(Entity*);
extern void sub_0805E4E0(Entity*, u32);
extern void sub_0805B390(u32);
extern void CopyPosition(Entity*, Entity*);
extern void (*const gUnk_081237F8[])(Entity*);
-1
View File
@@ -5,7 +5,6 @@
extern BoundingBox gUnk_080FD168;
extern void SetTile(u32, u32, u32);
extern void CopyPosition(Entity*, Entity*);
void Object9E(Entity *this)
{
+3 -3
View File
@@ -20,7 +20,7 @@ void ObjectA(Entity *this) {
uVar2 = 0x34;
}
this->field_0x70.HALF.LO = uVar2;
if (CheckFlags(this->field_0x86) != 0) {
if (CheckFlags(this->field_0x86.HWORD) != 0) {
SetTileType(*(u16*)&this->field_0x70.HALF.LO, COORD_TO_TILE(this), this->collisionLayer);
if ((gRoomControls.unk2 & 1) != 0) {
gUnk_02000070 = 0;
@@ -31,8 +31,8 @@ void ObjectA(Entity *this) {
}
} else if (this->interactType != 0) {
SetTileType(*(u16*)&this->field_0x70.HALF.LO, COORD_TO_TILE(this), this->collisionLayer);
SetFlag(this->field_0x86);
sub_080A29BC(this);
SetFlag(this->field_0x86.HWORD);
CreateDust(this);
sub_080526F8(-1);
DeleteThisEntity();
}
+1 -1
View File
@@ -1,7 +1,7 @@
#include "global.h"
#include "entity.h"
extern void CreateItemEntity(u32, u32, u32);
extern Entity* CreateItemEntity(u32, u32, u32);
extern void DeleteThisEntity();
extern void sub_08080CB4(Entity*);
-2
View File
@@ -2,8 +2,6 @@
#include "entity.h"
extern void sub_080A0640(Entity*);
extern void PositionRelative(Entity*, Entity*, s32, s32);
extern void CopyPosition(Entity*, Entity*);
extern void (*const gUnk_081248C4[])(Entity*);
+23 -29
View File
@@ -7,38 +7,32 @@ extern u32 sub_080AE4CC(Entity*, u32, u32, u32);
extern void* gUnk_02027EB4;
extern void* gUnk_0200D654;
#if 0
void ObjectB2(Entity* this) {
void* pEVar3;
void ObjectB2(Entity *this)
{
void* pEVar3;
if (this->action == 0) {
this->action = 1;
this->actionDelay = 0x10;
this->direction = (this->entityType).form << 3;
if (this->collisionLayer == 2) {
pEVar3 = &gUnk_0200D654;
if (this->action == 0) {
this->action = 1;
this->actionDelay = 0x10;
this->direction = (this->entityType).form << 3;
if (this->collisionLayer == 2) {
pEVar3 = &gUnk_0200D654;
} else {
pEVar3 = &gUnk_02027EB4;
}
this->attachedEntity = pEVar3;
InitializeAnimation(this, this->entityType.form);
}
else {
pEVar3 = &gUnk_02027EB4;
this->nonPlanarMovement = this->parent->nonPlanarMovement;
sub_0806F69C(this);
if (sub_080AE4CC(this->attachedEntity, this->x.HALF.HI, this->y.HALF.HI, 9) != 0) {
DeleteThisEntity();
}
this->attachedEntity = pEVar3;
InitializeAnimation(this, this->entityType.form);
}
this->nonPlanarMovement = this->parent->nonPlanarMovement;
sub_0806F69C(this);
if (sub_080AE4CC(this->attachedEntity, this->x.HALF.HI, this->y.HALF.HI, 9) != 0) {
DeleteThisEntity();
}
if (this->nonPlanarMovement < 0x41) {
this->spriteSettings.b.draw ^= 1;
if (this->nonPlanarMovement < 0x41) {
this->spriteSettings.b.draw ^= 1;
if (--this->actionDelay == 0) {
DeleteThisEntity();
if (--this->actionDelay == 0) {
DeleteThisEntity();
}
}
}
GetNextFrame(this);
GetNextFrame(this);
}
#endif
+43
View File
@@ -0,0 +1,43 @@
#include "global.h"
#include "entity.h"
#include "functions.h"
extern u32 ReadBit(u32*, u32);
extern void DeleteThisEntity();
extern u32 CheckLocalFlag(u32);
extern u32 gUnk_020342F8;
extern u16 gUnk_08125050[];
extern void (*gUnk_0812505C[])(Entity*);
void Pinwheel(Entity* this) {
u16 x = this->currentHealth;
if ((x & 0x7f) != 0) {
if (ReadBit(&gUnk_020342F8,x-1) == 0) {
DeleteThisEntity();
}
}
gUnk_0812505C[this->action](this);
}
void sub_080A23DC(Entity *this) {
this->field_0x68.HWORD = gUnk_08125050[this->entityType.parameter];
this->spritePriority.b0 = 7;
if (CheckLocalFlag(this->field_0x68.HWORD) !=0) {
this->action = 2;
}
else {
this->action = 1;
}
InitializeAnimation(this,0);
}
void sub_080A2420(Entity *this) {
if (CheckLocalFlag(this->field_0x68.HWORD) != 0) {
this->action = 2;
CreateDust(this);
}
}
void sub_080A243C(Entity *this) {
GetNextFrame(this);
}
+4 -6
View File
@@ -18,11 +18,9 @@ extern BoundingBox gUnk_080FD340; // TODO: should be const
extern u32 sub_08016A30(Entity*);
extern u32 sub_080001DA(u32, u32);
extern u32 GetTileTypeByEntity(Entity*);
extern void sub_08078930(Entity*);
extern u32 sub_080002B8(Entity*);
extern void sub_08016A6C(Entity*);
extern u32 sub_0800442E(Entity*);
void Pot(Entity* this) {
gUnk_0811F090[this->action](this);
@@ -30,7 +28,7 @@ void Pot(Entity* this) {
}
void sub_0808222C(Entity* this) {
if (this->entityType.parameter == 1 && CheckFlags(this->field_0x86)) {
if (this->entityType.parameter == 1 && CheckFlags(this->field_0x86.HWORD)) {
DeleteThisEntity();
}
@@ -92,7 +90,7 @@ void sub_08082310(Entity* this) {
this->actionDelay = 64;
}
SetTile((u16)this->field_0x70.HALF.LO, COORD_TO_TILE(this), this->collisionLayer);
sub_08004488(0x10F);
EnqueueSFX(0x10F);
break;
case 0x4067:
SetTile((u16)this->field_0x70.HALF.LO, COORD_TO_TILE(this), this->collisionLayer);
@@ -271,7 +269,7 @@ static void sub_08082850(Entity* this, Entity* parent) {
}
if (this->entityType.parameter == 1) {
SetFlag(this->field_0x86);
SetFlag(this->field_0x86.HWORD);
}
DeleteThisEntity();
@@ -292,7 +290,7 @@ u32 sub_0808288C(Entity* this, u32 form, u32 arg2, u32 arg3) {
if (entity) {
if (arg3 == 2) {
entity->actionDelay = 5;
entity->field_0x86 = this->field_0x86;
entity->field_0x86.HWORD = this->field_0x86.HWORD;
} else {
entity->actionDelay = 0;
}
+36 -44
View File
@@ -6,7 +6,7 @@
extern u32* GetLayerByIndex(u32);
extern void sub_08085394(Entity*);
extern void sub_0808543C(Entity*);
extern void sub_08004488(u32);
extern void EnqueueSFX(u32);
extern u32 sub_080854A8(Entity*);
extern void SetTile(u32, u32, u32);
@@ -32,7 +32,7 @@ void sub_080851AC(Entity* this) {
}
this->animationState = this->entityType.parameter & 2;
if ((this->entityType).form == 3) {
uVar1 = CheckFlags(this->field_0x86);
uVar1 = CheckFlags(this->field_0x86.HWORD);
this->field_0x7a.HWORD = uVar1;
if ((u16)(uVar1 & -1) != 0) {
this->animationState = (this->animationState + 2) & 3;
@@ -45,16 +45,16 @@ void sub_080851AC(Entity* this) {
}
void sub_08085264(Entity* this) {
if (CheckFlags(this->field_0x86)) {
if (CheckFlags(this->field_0x86.HWORD)) {
this->action = 2;
this->field_0xf = 8;
if (this->entityType.form == 1) {
ClearFlag(this->field_0x86);
ClearFlag(this->field_0x86.HWORD);
}
this->animationState = (this->animationState + *(u8*)&this->field_0x7c) & 3;
InitializeAnimation(this, this->animationState);
sub_0808543C(this);
sub_08004488(0x151);
EnqueueSFX(0x151);
}
}
@@ -62,11 +62,11 @@ void sub_080852B4(Entity* this) {
if (--this->field_0xf == 0) {
this->action = 3;
this->field_0xf = this->actionDelay;
this->field_0x7a.HWORD = CheckFlags(this->field_0x86);
this->field_0x7a.HWORD = CheckFlags(this->field_0x86.HWORD);
this->animationState = (this->animationState + *(u8*)&this->field_0x7c) & 3;
InitializeAnimation(this, this->animationState);
sub_08085394(this);
sub_08004488(0x151);
EnqueueSFX(0x151);
}
}
@@ -77,13 +77,13 @@ void sub_08085308(Entity* this) {
case 1:
break;
case 2:
if (CheckFlags(this->field_0x86) == 0) {
if (CheckFlags(this->field_0x86.HWORD) == 0) {
this->action = 1;
return;
}
break;
case 3:
if (CheckFlags(this->field_0x86) == *(u16*)&this->field_0x7a) {
if (CheckFlags(this->field_0x86.HWORD) == *(u16*)&this->field_0x7a) {
this->field_0xf = 0xff;
} else {
this->field_0xf = 1;
@@ -96,60 +96,52 @@ void sub_08085308(Entity* this) {
this->animationState = (this->animationState + *(u8*)&this->field_0x7c) & 3;
InitializeAnimation(this, this->animationState);
sub_0808543C(this);
sub_08004488(0x151);
EnqueueSFX(0x151);
}
}
}
#if 0
void sub_08085394(Entity *this)
{
void sub_08085394(Entity* this) {
u32 uVar1;
u16 *layerData;
u32 iVar3;
u32 uVar4;
u8 *pbVar5;
u16* layerData;
u32 tile;
s8 off;
uVar1 = gUnk_081205E0[this->animationState / 2];
iVar3 = this->animationState / 2;
layerData = *(u16 **)&this->field_0x70;
uVar4 = COORD_TO_TILE(this);
this->field_0x74.HWORD = layerData[gUnk_080B4488[iVar3]];
pbVar5 = &this->collisionLayer;
SetTile(uVar1, uVar4 - iVar3, *pbVar5);
this->field_0x76 = layerData[0];
SetTile(uVar1,uVar4, *pbVar5);
*(u16 *)&this->field_0x78 = layerData[iVar3];
SetTile(uVar1,uVar4 + iVar3, *pbVar5);
}
#endif
off = gUnk_080B4488[this->animationState / 2][0];
layerData = (u16*)this->field_0x70.WORD;
tile = COORD_TO_TILE(this);
NAKED
void sub_08085394(Entity* this) {
asm(".include \"asm/non_matching/railtrack/sub_08085394.inc\"");
this->field_0x74.HWORD = *(layerData - off);
SetTile(uVar1, tile - off, this->collisionLayer);
this->field_0x76.HWORD = layerData[0x0];
SetTile(uVar1, tile - 0x0, this->collisionLayer);
this->field_0x78.HWORD = layerData[off];
SetTile(uVar1, tile + off, this->collisionLayer);
}
void sub_0808543C(Entity *this)
{
s8 *cVar1;
u32 uVar2;
s8 temp;
void sub_0808543C(Entity* this) {
s8* cVar1;
u32 uVar2;
s8 temp;
temp = gUnk_080B4488[this->animationState / 2][0];
uVar2 = COORD_TO_TILE(this);
SetTile(this->field_0x74.HWORD, uVar2 - temp, this->collisionLayer);
SetTile(this->field_0x76.HWORD, uVar2, this->collisionLayer);
SetTile(this->field_0x78.HWORD, uVar2 + temp, this->collisionLayer);
temp = gUnk_080B4488[this->animationState / 2][0];
uVar2 = COORD_TO_TILE(this);
SetTile(this->field_0x74.HWORD, uVar2 - temp, this->collisionLayer);
SetTile(this->field_0x76.HWORD, uVar2, this->collisionLayer);
SetTile(this->field_0x78.HWORD, uVar2 + temp, this->collisionLayer);
}
u32 sub_080854A8(Entity *this) {
u32 sub_080854A8(Entity* this) {
u16 var0;
u16* var1;
s8* var2;
var0 = gUnk_081205E0[this->animationState / 2];
var2 = gUnk_080B4488[this->animationState / 2];
var1 = (u16 *)this->field_0x70.WORD;
var1 = (u16*)this->field_0x70.WORD;
if (var0 != *(var1 - var2[0])) {
return TRUE;
}
+1 -3
View File
@@ -1,10 +1,8 @@
#include "global.h"
#include "entity.h"
#include "functions.h"
extern u32 Random(void);
extern void CopyPosition(Entity*, Entity*);
extern void sub_0806F69C(Entity*);
extern void DeleteEntity(Entity*);
extern void (*const gUnk_08121060[])(Entity*);
extern void (*const gUnk_08121070[])(Entity*);
+4 -4
View File
@@ -6,7 +6,7 @@
extern void sub_0809E96C(Entity*);
extern u32 sub_0800419C(Entity*, Entity*, u32, u32);
extern void sub_080A2B80(Entity*);
extern void CreateSparkle(Entity*);
extern u32 sub_0809E9A0(void);
extern void sub_08078A90(u32);
extern void sub_0809E918(Entity*);
@@ -23,7 +23,7 @@ void TreeHidingPortal(Entity* this) {
}
void sub_0809E83C(Entity* this) {
if (CheckFlags(this->field_0x86)) {
if (CheckFlags(this->field_0x86.HWORD)) {
sub_0809E96C(this);
DeleteThisEntity();
}
@@ -37,7 +37,7 @@ void sub_0809E86C(Entity* this) {
if (sub_0800419C(this, &gPlayerEntity, 0x30, 0x30)) {
if (CheckGlobalFlag(EZERO_1ST)) {
if (((gScreenTransition & 3) == 0)) {
sub_080A2B80(this);
CreateSparkle(this);
}
}
}
@@ -60,7 +60,7 @@ void sub_0809E8BC(Entity* this) {
void sub_0809E8EC(Entity* this) {
if (--this->actionDelay == 0) {
SetFlag(this->field_0x86);
SetFlag(this->field_0x86.HWORD);
sub_08078A90(0);
PlaySFX(0x73);
DeleteThisEntity();