merge master

This commit is contained in:
Henny022p
2022-01-31 17:30:51 +01:00
545 changed files with 17306 additions and 89017 deletions
+5 -9
View File
@@ -48,7 +48,7 @@ u32 IsItemEquipped(u32 itemID) {
void PutItemOnSlot(u32 itemID) {
u32 itemSlot;
register u32 itemID2 asm("r5") = itemID;
u32 itemID2 = itemID;
if (itemID2 < 0x47) {
sub_0807CAA0(0, 1);
}
@@ -60,7 +60,7 @@ void PutItemOnSlot(u32 itemID) {
itemSlot = 1;
}
if (itemSlot == 2) {
u8 temp = gUnk_080FD5B4[itemID2].unk;
u32 temp = gUnk_080FD5B4[itemID2].unk;
if (temp == gUnk_080FD5B4[gSave.stats.itemButtons[SLOT_A]].unk) {
itemSlot = 0;
} else {
@@ -171,11 +171,7 @@ void sub_08054570(void) {
gRoomVars.field_0x2 = 0;
}
#ifdef EU
ASM_FUNC("asm/non_matching/eu/sub_0805457C.inc", u32 sub_0805457C(u32 arg0, u32 arg1));
#else
ASM_FUNC("asm/non_matching/sub_0805457C.inc", u32 sub_0805457C(u32 arg0, u32 arg1));
#endif
u32 CreateItemDrop(Entity* arg0, u32 itemID, u32 itemParameter) {
u32 prereqID;
@@ -244,13 +240,13 @@ u32 CreateItemDrop(Entity* arg0, u32 itemID, u32 itemParameter) {
} else {
itemEntity->actionDelay = 0;
}
if (arg0->kind == 6) {
if (arg0->kind == OBJECT) {
if (arg0->id == 99) {
arg0->child = itemEntity;
} else if (arg0->id == 0x1e) {
itemEntity->direction = arg0->animationState << 3 | 0x80;
itemEntity->speed = 0xc0;
itemEntity->zVelocity = 0x18000;
itemEntity->zVelocity = Q_16_16(1.5);
}
}
CopyPosition(arg0, itemEntity);
@@ -336,7 +332,7 @@ u32 CreateItemDrop(Entity* arg0, u32 itemID, u32 itemParameter) {
} else {
itemEntity->actionDelay = 0;
}
if (arg0->kind == 6) {
if (arg0->kind == OBJECT) {
if (arg0->id == 99) {
arg0->child = itemEntity;
} else if (arg0->id == 0x1e) {
+6 -6
View File
@@ -26,7 +26,7 @@ void sub_08077BB8(ItemBehavior* beh) {
UnkItemStruct* unk = (UnkItemStruct*)beh; // @nocheckin
Entity* temp = sub_08077C54(unk);
if (temp != NULL) {
temp->flags = 0x20;
temp->flags = ENT_PERSIST;
}
gPlayerState.item = temp;
}
@@ -68,7 +68,7 @@ void* sub_08077C54(UnkItemStruct* unk) {
item = sub_0805E744();
if (item != NULL) {
item->id = gUnk_0811BE48[unk->field_0x1].unk[3];
item->kind = 8;
item->kind = PLAYER_ITEM;
item->flags = 0xa0;
item->parent = (Entity*)unk;
item->field_0x68.HALF.LO = unk->field_0x1;
@@ -92,8 +92,8 @@ Entity* CreatePlayerItem(u32 subtype, u32 form, u32 parameter, u32 unk) {
ent = GetEmptyEntity();
if (ent != NULL) {
ent->flags = 0x80;
ent->kind = 8;
ent->flags = ENT_COLLIDE;
ent->kind = PLAYER_ITEM;
ent->id = subtype;
ent->type = form;
ent->type2 = parameter;
@@ -108,8 +108,8 @@ Entity* sub_08077CF8(u32 subtype, u32 form, u32 parameter, u32 unk) {
ent = sub_0805E744();
if (ent != NULL) {
ent->flags = 0x80;
ent->kind = 8;
ent->flags = ENT_COLLIDE;
ent->kind = PLAYER_ITEM;
ent->id = subtype;
ent->type = form;
ent->type2 = parameter;
+21 -20
View File
@@ -177,7 +177,7 @@ NONMATCH("asm/non_matching/arm_proxy/sub_08017744.inc", void sub_08017744(Entity
}
END_NONMATCH
bool32 sub_080177A0(Entity* this, Entity* that) {
bool32 IsColliding(Entity* this, Entity* that) {
u32 this_d;
u32 depth;
@@ -206,9 +206,9 @@ bool32 sub_080177A0(Entity* this, Entity* that) {
return FALSE;
}
bool32 sub_08017850(Entity* this) {
bool32 IsCollidingPlayer(Entity* this) {
if (sub_08079F8C())
return sub_080177A0(this, &gPlayerEntity);
return IsColliding(this, &gPlayerEntity);
return FALSE;
}
@@ -218,7 +218,7 @@ s32 sub_08017874(Entity* a, Entity* b) {
s32 v6;
asm("" ::: "r1");
if (a->kind == 1) {
if (a->kind == PLAYER) {
newDmg = b->damage;
switch (gSave.stats.charm) {
case 47:
@@ -231,10 +231,10 @@ s32 sub_08017874(Entity* a, Entity* b) {
if (newDmg <= 0)
newDmg = 1;
v5 = ModHealth(-newDmg);
SoundReqClipped(a, 122);
SoundReqClipped(a, SFX_PLY_VO6);
} else {
v6 = b->damage;
if (b->kind == 8) {
if (b->kind == PLAYER_ITEM) {
switch (gSave.stats.charm) {
case 48:
v6 = 3 * v6 / 2;
@@ -245,11 +245,11 @@ s32 sub_08017874(Entity* a, Entity* b) {
}
}
v5 = a->health - v6;
if (a->kind == 3) {
if (a->kind == ENEMY) {
if ((a->field_0x6c.HALF.HI & 1) != 0)
SoundReqClipped(a, 295);
SoundReqClipped(a, SFX_BOSS_HIT);
else
SoundReqClipped(a, 254);
SoundReqClipped(a, SFX_HIT);
}
}
if (v5 <= 0) {
@@ -290,7 +290,7 @@ void sub_080179EC(Entity* a1, Entity* a2) {
u32 rand = Random();
Entity* e = CreateFx(a2, p[rand & 3], 0);
if (e != NULL) {
PositionRelative(a2, e, a2->hitbox->offset_x << 16, a2->hitbox->offset_y << 16);
PositionRelative(a2, e, Q_16_16(a2->hitbox->offset_x), Q_16_16(a2->hitbox->offset_y));
e->spritePriority.b0 = 2;
e->spriteOffsetX = (a1->x.HALF.HI + a1->hitbox->offset_x - (a2->x.HALF.HI + a2->hitbox->offset_x)) >> 1;
e->spriteOffsetY = (a1->y.HALF.HI + a1->hitbox->offset_y - (a2->y.HALF.HI + a2->hitbox->offset_y)) >> 1;
@@ -510,7 +510,7 @@ s32 sub_08017EB0(Entity* org, Entity* tgt, u32 direction, ColSettings* settings)
gPlayerEntity.knockbackDuration = 12;
gPlayerEntity.iframes = 16;
gPlayerEntity.field_0x46 = 384;
} else if (org->kind == 8 && org->id == 5) {
} else if (org->kind == PLAYER_ITEM && org->id == 5) {
org->knockbackDuration = 8;
org->iframes = -6;
org->field_0x46 = 384;
@@ -541,9 +541,9 @@ s32 sub_08017F40(Entity* org, Entity* tgt, u32 direction, ColSettings* settings)
gPlayerState.jump_status = 0;
if (tgt->kind == ENEMY && (tgt->id == GHINI || tgt->id == ENEMY_50)) {
org->z.HALF.HI = 0;
PositionRelative(org, tgt, 0, 0x10000);
PositionRelative(org, tgt, 0, Q_16_16(1.0));
} else {
PositionRelative(tgt, org, 0, 0x10000);
PositionRelative(tgt, org, 0, Q_16_16(1.0));
}
COLLISION_OFF(org);
org->spriteRendering.b3 = tgt->spriteRendering.b3;
@@ -556,7 +556,7 @@ s32 sub_08017F40(Entity* org, Entity* tgt, u32 direction, ColSettings* settings)
} else {
org->health = 0;
}
} else if (tgt->kind == 3 && org == &gPlayerEntity) {
} else if (tgt->kind == ENEMY && org == &gPlayerEntity) {
sub_08004484(tgt, org);
}
return 0;
@@ -644,7 +644,7 @@ s32 sub_08018168(Entity* org, Entity* tgt, u32 direction, ColSettings* settings)
} else {
org->health = 0;
}
} else if ((tgt->kind == 3) && (org == &gPlayerEntity)) {
} else if ((tgt->kind == ENEMY) && (org == &gPlayerEntity)) {
sub_08004484(tgt, &gPlayerEntity);
}
return 0;
@@ -690,11 +690,12 @@ s32 sub_080182A8(Entity* org, Entity* tgt, u32 direction, ColSettings* settings)
s32 sub_08018308(Entity* org, Entity* tgt, u32 direction, ColSettings* settings) {
u32 temp = 0;
if (tgt->field_0x43 && tgt->kind == 3 && org == &gPlayerEntity) {
if (tgt->field_0x43 && tgt->kind == ENEMY && org == &gPlayerEntity) {
sub_08004484(tgt, org);
temp = 1;
}
if ((org->kind == 8 && org->id == 0x5) && gPlayerEntity.animationState == ((((direction + 4) & 0x18) >> 2) ^ 4)) {
if ((org->kind == PLAYER_ITEM && org->id == 0x5) &&
gPlayerEntity.animationState == ((((direction + 4) & 0x18) >> 2) ^ 4)) {
return 0;
}
if (!temp) {
@@ -738,7 +739,7 @@ s32 sub_08018308(Entity* org, Entity* tgt, u32 direction, ColSettings* settings)
parent->field_0x4c = org;
}
}
if (org->kind == 8) {
if (org->kind == PLAYER_ITEM) {
if (org->id == 1) {
if (settings->_8) {
sub_080179EC(org, tgt);
@@ -749,13 +750,13 @@ s32 sub_08018308(Entity* org, Entity* tgt, u32 direction, ColSettings* settings)
}
} else if (org->id == 3) {
if (settings->_9) {
SoundReqClipped(tgt, 254);
SoundReqClipped(tgt, SFX_HIT);
}
} else if (org->id == 5) {
gPlayerEntity.iframes = 0x80;
}
}
if (tgt->kind == 8 && org->id == 5) {
if (tgt->kind == PLAYER_ITEM && org->id == 5) {
gPlayerEntity.iframes = 0x80;
}
return 1;
+15 -2
View File
@@ -27,9 +27,22 @@ void sub_0801CFD0(u32 a1) {
ASM_FUNC("asm/non_matching/color/sub_0801D000.inc", void sub_0801D000(u32 a1));
ASM_FUNC("asm/non_matching/color/LoadObjPalette.inc", void LoadObjPalette(Entity* entity, u32 a2));
ASM_FUNC("asm/non_matching/color/LoadObjPalette.inc", u32 LoadObjPalette(Entity* entity, u32 a2));
ASM_FUNC("asm/non_matching/color/FindPalette.inc", s32 FindPalette(u32 a1));
s32 FindPalette(u32 a1) {
u32 index;
Palette* palette;
if (a1 <= 5)
return a1;
for (index = 6, palette = gPaletteList; index < 0x10; index++) {
if (a1 == palette[index]._2) {
return index;
}
}
return -1;
}
ASM_FUNC("asm/non_matching/color/FindFreeObjPalette.inc", u32 FindFreeObjPalette(u32 a1));
+415 -352
View File
@@ -7,8 +7,33 @@
#include "room.h"
#include "functions.h"
extern u8 gUnk_08114F78[];
extern u8 gUnk_08114F80[];
const u8 gSpriteSortAboveTable[];
const u8 gSpriteSortBelowTable[];
const u8 gUnk_08114F58[];
const u8 gUnk_08114F38[];
typedef struct {
struct {
u8 unk0 : 1;
u8 unk1 : 1;
u8 unk2 : 1;
u8 unk3 : 1;
u8 unk4 : 4;
} PACKED unk_00;
u8 unk_01;
u16 unk_02;
union SplitWord unk_04;
union SplitWord unk_08;
union SplitWord unk_0C;
} struct_gUnk_020000C0_1;
typedef struct {
struct_gUnk_020000C0_1 unk_00[4];
} struct_gUnk_020000C0;
static_assert(sizeof(struct_gUnk_020000C0) == 0x40);
extern struct_gUnk_020000C0 gUnk_020000C0[0x30];
extern u32 gSpritePtrs[];
typedef struct {
u32 _0;
@@ -17,14 +42,21 @@ typedef struct {
} struct_02025EB0;
extern struct_02025EB0 gUnk_02025EB0;
extern u16 gExtraFrameOffsets[];
extern s8 gUnk_08126EE4[];
extern u8 gUnk_08114F38[];
extern u8 gUnk_08114F58[];
extern const u16 gUnk_080046A4[];
extern const u16 gUnk_080047F6[];
void sub_080027EA(Entity*, u32, u32);
void sub_0806F5BC(Entity*, u32, u32);
u32 sub_0806F58C(Entity*, Entity*);
u32 sub_0806FCA0(Entity*, Entity*);
void UnloadHitbox(Entity*);
extern u32 sub_08007DD6(u32, const u16*);
extern u32 sub_080041DC(Entity*, u32, u32);
u32 PointInsideRadius(s32 x, s32 y, s32 radius);
extern void sub_0806FEE8(struct_gUnk_020000C0_1*, u32, u32, u32);
void sub_0806FEFC(struct_gUnk_020000C0_1*, Entity*);
bool32 sub_0807007C(struct_gUnk_020000C0*, u32);
void sub_0806F364(void) {
gArea.filler[2] ^= 0x80;
@@ -76,7 +108,7 @@ u32 sub_0806F3E4(Entity* ent) {
p = &gUnk_08126EE4[gPlayerEntity.animationState & 0xE];
tmp_ent.x.HALF.HI = p[0] + gPlayerEntity.x.HALF.HI;
tmp_ent.y.HALF.HI = p[1] + gPlayerEntity.y.HALF.HI;
sub_0806F5BC(ent, ent->field_0x46, GetFacingDirection(ent, &tmp_ent));
LinearMoveDirection(ent, ent->field_0x46, GetFacingDirection(ent, &tmp_ent));
if (sub_0800419C(&tmp_ent, ent, 4, 4)) {
u32 state = ent->field_0x1c & 0xF;
if (state == 2) {
@@ -147,7 +179,7 @@ u32 sub_0806F5B0(u32 idx) {
return gUnk_08114F58[idx];
}
void sub_0806F5BC(Entity* ent, u32 a, u32 b) {
void LinearMoveDirection(Entity* ent, u32 a, u32 b) {
if ((b & 0x80) == 0) {
u32 m1 = b;
@@ -156,15 +188,15 @@ void sub_0806F5BC(Entity* ent, u32 a, u32 b) {
}
}
void sub_0806F62C(Entity* ent, u32 a, u32 b) {
void LinearMoveAngle(Entity* ent, u32 a, u32 b) {
ent->x.WORD += FixedDiv(FixedMul(gSineTable[(u8)b], a), 256) << 8;
ent->y.WORD -= FixedDiv(FixedMul(gSineTable[(u8)b + 64], a), 256) << 8;
}
void LinearMoveUpdate(Entity* ent) {
if ((ent->direction & 0x80) == 0) {
ent->x.WORD += FixedDiv(FixedMul(gSineTable[ent->direction * 8], ent->speed), 256) << 8;
ent->y.WORD -= FixedDiv(FixedMul(gSineTable[ent->direction * 8 + 64], ent->speed), 256) << 8;
ent->x.WORD += FixedDiv(FixedMul(gSineTable[ent->direction * 8], ent->speed), (1 << 8)) << 8;
ent->y.WORD -= FixedDiv(FixedMul(gSineTable[ent->direction * 8 + 64], ent->speed), (1 << 8)) << 8;
}
}
@@ -214,8 +246,8 @@ u32 sub_0806F804(u32 x, u32 y) {
return gUnk_02025EB0._4[idx];
}
void sub_0806F824(Entity* a, Entity* b, s32 x, s32 y) {
sub_080045D4(a->x.HALF.HI, a->y.HALF.HI, b->x.HALF.HI + x, b->y.HALF.HI + y);
u32 sub_0806F824(Entity* a, Entity* b, s32 x, s32 y) {
return sub_080045D4(a->x.HALF.HI, a->y.HALF.HI, b->x.HALF.HI + x, b->y.HALF.HI + y);
}
u32 sub_0806F854(Entity* ent, s32 x, s32 y) {
@@ -291,13 +323,13 @@ s16 FixedDiv(s16 r0, s16 r1) {
return (r0 * 256) / r1;
}
void CopyPosition(Entity* param_1, Entity* param_2) {
PositionRelative(param_1, param_2, 0, 0);
void CopyPosition(Entity* source, Entity* target) {
PositionRelative(source, target, 0, 0);
}
void PositionEntityOnTop(Entity* ent, Entity* ent2) {
PositionRelative(ent, ent2, 0, 0);
ResolveEntityOnTop(ent, ent2);
void PositionEntityOnTop(Entity* source, Entity* target) {
PositionRelative(source, target, 0, 0);
SortEntityAbove(source, target);
}
void PositionRelative(Entity* source, Entity* target, s32 offsetX, s32 offsetY) {
@@ -315,349 +347,380 @@ void PositionRelative(Entity* source, Entity* target, s32 offsetX, s32 offsetY)
UpdateSpriteForCollisionLayer(target);
}
void CopyPositionAndSpriteOffset(Entity* param_1, Entity* param_2) {
param_2->spriteOffsetX = param_1->spriteOffsetX;
param_2->spriteOffsetY = param_1->spriteOffsetY;
PositionRelative(param_1, param_2, 0, 0);
void CopyPositionAndSpriteOffset(Entity* source, Entity* target) {
target->spriteOffsetX = source->spriteOffsetX;
target->spriteOffsetY = source->spriteOffsetY;
PositionRelative(source, target, 0, 0);
}
void sub_0806FA90(Entity* param_1, Entity* param_2, s32 offsetX, s32 offsetY) {
param_2->spriteOffsetX = param_1->spriteOffsetX;
param_2->spriteOffsetY = param_1->spriteOffsetY;
PositionRelative(param_1, param_2, offsetX * 64 * 32 * 32, offsetY * 64 * 32 * 32);
void sub_0806FA90(Entity* source, Entity* target, s32 offsetX, s32 offsetY) {
target->spriteOffsetX = source->spriteOffsetX;
target->spriteOffsetY = source->spriteOffsetY;
PositionRelative(source, target, Q_16_16(offsetX), Q_16_16(offsetY));
}
void ResolveEntityOnTop(Entity* param_1, Entity* param_2) {
param_2->spritePriority.b0 = gUnk_08114F78[param_1->spritePriority.b0];
void SortEntityAbove(Entity* param_1, Entity* param_2) {
param_2->spritePriority.b0 = gSpriteSortAboveTable[param_1->spritePriority.b0];
}
void ResolveEntityBelow(Entity* param_1, Entity* param_2) {
param_2->spritePriority.b0 = gUnk_08114F80[param_1->spritePriority.b0];
void SortEntityBelow(Entity* param_1, Entity* param_2) {
param_2->spritePriority.b0 = gSpriteSortBelowTable[param_1->spritePriority.b0];
}
// Values of sin(x*(π/128)) as Q8.8 fixed-point numbers from x = 0 to x = 319
const s16 gSineTable[64] = {
Q_8_8(0), // sin(0*(π/128))
Q_8_8(0.0234375), // sin(1*(π/128))
Q_8_8(0.046875), // sin(2*(π/128))
Q_8_8(0.0703125), // sin(3*(π/128))
Q_8_8(0.09765625), // sin(4*(π/128))
Q_8_8(0.12109375), // sin(5*(π/128))
Q_8_8(0.14453125), // sin(6*(π/128))
Q_8_8(0.16796875), // sin(7*(π/128))
Q_8_8(0.19140625), // sin(8*(π/128))
Q_8_8(0.21875), // sin(9*(π/128))
Q_8_8(0.2421875), // sin(10*(π/128))
Q_8_8(0.265625), // sin(11*(π/128))
Q_8_8(0.2890625), // sin(12*(π/128))
Q_8_8(0.3125), // sin(13*(π/128))
Q_8_8(0.3359375), // sin(14*(π/128))
Q_8_8(0.359375), // sin(15*(π/128))
Q_8_8(0.37890625), // sin(16*(π/128))
Q_8_8(0.40234375), // sin(17*(π/128))
Q_8_8(0.42578125), // sin(18*(π/128))
Q_8_8(0.44921875), // sin(19*(π/128))
Q_8_8(0.46875), // sin(20*(π/128))
Q_8_8(0.4921875), // sin(21*(π/128))
Q_8_8(0.51171875), // sin(22*(π/128))
Q_8_8(0.53125), // sin(23*(π/128))
Q_8_8(0.5546875), // sin(24*(π/128))
Q_8_8(0.57421875), // sin(25*(π/128))
Q_8_8(0.59375), // sin(26*(π/128))
Q_8_8(0.61328125), // sin(27*(π/128))
Q_8_8(0.6328125), // sin(28*(π/128))
Q_8_8(0.65234375), // sin(29*(π/128))
Q_8_8(0.66796875), // sin(30*(π/128))
Q_8_8(0.6875), // sin(31*(π/128))
Q_8_8(0.70703125), // sin(32*(π/128))
Q_8_8(0.72265625), // sin(33*(π/128))
Q_8_8(0.73828125), // sin(34*(π/128))
Q_8_8(0.75390625), // sin(35*(π/128))
Q_8_8(0.76953125), // sin(36*(π/128))
Q_8_8(0.78515625), // sin(37*(π/128))
Q_8_8(0.80078125), // sin(38*(π/128))
Q_8_8(0.81640625), // sin(39*(π/128))
Q_8_8(0.828125), // sin(40*(π/128))
Q_8_8(0.84375), // sin(41*(π/128))
Q_8_8(0.85546875), // sin(42*(π/128))
Q_8_8(0.8671875), // sin(43*(π/128))
Q_8_8(0.87890625), // sin(44*(π/128))
Q_8_8(0.890625), // sin(45*(π/128))
Q_8_8(0.90234375), // sin(46*(π/128))
Q_8_8(0.9140625), // sin(47*(π/128))
Q_8_8(0.921875), // sin(48*(π/128))
Q_8_8(0.9296875), // sin(49*(π/128))
Q_8_8(0.94140625), // sin(50*(π/128))
Q_8_8(0.94921875), // sin(51*(π/128))
Q_8_8(0.953125), // sin(52*(π/128))
Q_8_8(0.9609375), // sin(53*(π/128))
Q_8_8(0.96875), // sin(54*(π/128))
Q_8_8(0.97265625), // sin(55*(π/128))
Q_8_8(0.98046875), // sin(56*(π/128))
Q_8_8(0.984375), // sin(57*(π/128))
Q_8_8(0.98828125), // sin(58*(π/128))
Q_8_8(0.9921875), // sin(59*(π/128))
Q_8_8(0.9921875), // sin(60*(π/128))
Q_8_8(0.99609375), // sin(61*(π/128))
Q_8_8(0.99609375), // sin(62*(π/128))
Q_8_8(0.99609375), // sin(63*(π/128))
void sub_0806FB00(Entity* ent, u32 param_1, u32 param_2, u32 param_3) {
if (param_3 == 0) {
param_3 = 1;
}
ent->field_0x7c.BYTES.byte2 = 0;
ent->field_0x7c.BYTES.byte3 = param_3;
ent->field_0x80.HWORD = ent->x.HALF.HI;
ent->field_0x82.HWORD = ent->y.HALF.HI;
ent->cutsceneBeh.HWORD = param_1;
ent->field_0x86.HWORD = param_2;
}
bool32 sub_0806FB38(Entity* ent, u32 param_1, u32 param_2, u32 param_3) {
s32 val;
u32 rv;
if (ent->field_0x7c.BYTES.byte2 < ent->field_0x7c.BYTES.byte3) {
ent->field_0x7c.BYTES.byte2++;
ent->x.HALF.HI =
((((((s16)ent->cutsceneBeh.HWORD - (s16)ent->field_0x80.HWORD) * ent->field_0x7c.BYTES.byte2) << 8) /
ent->field_0x7c.BYTES.byte3) >>
8) +
ent->field_0x80.HWORD;
ent->y.HALF.HI =
(((((((s16)ent->field_0x86.HWORD - (s16)ent->field_0x82.HWORD) * ent->field_0x7c.BYTES.byte2) << 8) /
ent->field_0x7c.BYTES.byte3) >>
8)) +
ent->field_0x82.HWORD;
rv = 0;
} else {
ent->x.HALF.HI = ent->cutsceneBeh.HWORD;
ent->y.HALF.HI = ent->field_0x86.HWORD;
rv = 1;
}
return rv;
}
void sub_0806FBB4(Entity* ent) {
if (gRoomTransition.field_0x4[1] != 0 || gPlayerState.heldObject == 0) {
ent->subAction = 6;
}
}
void AllocMutableHitbox(Entity* ent) {
UnloadHitbox(ent);
ent->hitbox = zMalloc(sizeof(Hitbox3D));
}
void UnloadHitbox(Entity* ent) {
zFree(ent->hitbox);
ent->hitbox = NULL;
}
bool32 CheckPlayerProximity(u32 x, u32 y, u32 distX, u32 DistY) {
s32 diffx = gPlayerEntity.x.HALF.HI - x;
s32 diffy = gPlayerEntity.y.HALF.HI - y;
u32 rv = 0;
if (diffx < distX && diffy < DistY) {
rv = 1;
}
return rv;
}
NONMATCH("asm/non_matching/coord/sub_0806FC24.inc", bool32 sub_0806FC24(u32 param_1, u32 param_2)) {
u32 rv;
u32 val = sub_08007DD6(param_1, gUnk_080046A4);
if (val) {
rv = (*(gUnk_080047F6 + (val << 2)) >> param_2) & 0x1;
} else {
rv = 0;
}
return rv;
}
END_NONMATCH
const u16* sub_0806FC50(u32 param_1, u32 param_2) {
const u16* rv;
u32 val = sub_08007DD6(param_1, gUnk_080046A4);
if (!val || ((gUnk_080047F6[val << 2] >> param_2) & 0x1) == 0) {
rv = 0;
} else {
rv = gUnk_080047F6 + (val << 2);
}
return rv;
}
bool32 sub_0806FC80(Entity* ent, Entity* ent2, s32 param_3) {
u32 rv;
s16 x, y;
param_3 <<= 4;
if (param_3 >= sub_080041DC(ent, ent2->x.HALF.HI, ent2->y.HALF.HI)) {
return 1;
} else {
return 0;
}
}
u32 sub_0806FCA0(Entity* this, Entity* other) {
return sub_0806F5A4(GetFacingDirection(this, other));
}
u32 sub_0806FCAC(Entity* this, Entity* other) {
return sub_0806F5B0(GetFacingDirection(this, other));
}
u32 EntityWithinDistance(Entity* ent, s32 x, s32 y, s32 distance) {
return PointInsideRadius(ent->x.HALF.HI - x, ent->y.HALF.HI - y, distance);
}
bool32 PointInsideRadius(s32 x, s32 y, s32 distance) {
return distance * distance >= (x * x + y * y);
}
void sub_0806FCF4(Entity* ent, s32 param_2, s32 param_3, s32 param_4) {
u32 r2 = 0;
if (param_2 < 0) {
param_2 = -param_2;
}
if (param_3) {
param_2 = (0x10000 / param_2);
param_2 = ((u32)(param_3 * param_2) >> 8);
r2 = param_3 - param_2;
}
if (param_4 == 0 || param_4 == 3) {
r2 = -r2;
}
if (param_4 == 0 || param_4 == 2) {
ent->spriteOffsetY = r2;
} else {
ent->spriteOffsetX = r2;
}
}
void sub_0806FD3C(Entity* this) {
this->spriteSettings.shadow = 0;
this->spritePriority.b1 = 0;
}
bool32 sub_0806FD54(Entity* this) {
u32 rv;
if ((gPlayerState.flags & 0x800000) == 0) {
rv = 0;
} else {
rv = EntityWithinDistance(this, gPlayerEntity.x.HALF.HI, gPlayerEntity.y.HALF.HI - 9, 0x48);
}
return rv;
}
void sub_0806FD8C() {
MemClear(&gUnk_020000C0, sizeof(gUnk_020000C0));
}
bool32 sub_0806FDA0(Entity* this) {
u32 index;
for (index = 1; index < ARRAY_COUNT(gUnk_020000C0); index++) {
if ((gUnk_020000C0[index].unk_00[0].unk_00.unk0) == 0) {
u32 tmp = 0xFF;
this->spriteAnimation[2] = index;
gUnk_020000C0[index].unk_00[0].unk_00.unk0 = 1;
gUnk_020000C0[index].unk_00[0].unk_01 = tmp;
gUnk_020000C0[index].unk_00[1].unk_01 = tmp;
gUnk_020000C0[index].unk_00[2].unk_01 = tmp;
gUnk_020000C0[index].unk_00[3].unk_01 = tmp;
return 1;
}
}
return 0;
}
u32 LoadExtraSpriteData(Entity* ent, SpriteLoadData* data) {
SpriteLoadData* ptr;
u32 index;
struct_gUnk_020000C0_1* ptr2;
if (sub_0806FDA0(ent) == 0)
return 0;
UnloadOBJPalette(ent);
ptr2 = gUnk_020000C0[ent->spriteAnimation[2]].unk_00;
ptr = data;
for (index = 0; index < 4 && (((u16*)ptr)[1] & 0x3ff); index++) {
u32 pal = LoadObjPalette(ent, ((*(u32*)ptr) << 0x16) >> 0x16);
sub_0806FEE8(ptr2, (*(u32*)ptr << 6) >> 0x16, pal, (*(u32*)ptr << 0x10) >> 0x1a);
if (((u8*)ptr)[3] & 4) {
sub_0806FEFC(ptr2, ent);
}
ptr2++;
ptr++;
}
ent->spriteAnimation[1] = 0;
return 1;
}
void sub_0806FE84(Entity* ent) {
u32 index;
u32 spriteAnimation = ent->spriteAnimation[2];
ent->spriteAnimation[2] = 0;
if (spriteAnimation > 0 && spriteAnimation < 0x80) {
struct_gUnk_020000C0_1* startptr = gUnk_020000C0[spriteAnimation].unk_00;
for (index = 0; index <= 3; index++) {
sub_0801D244(startptr[index].unk_04.BYTES.byte1);
}
MemClear(startptr, sizeof(struct_gUnk_020000C0));
}
}
void sub_0806FEBC(Entity* ent, u32 param_2, u32 param_3) {
struct_gUnk_020000C0_1* ptr = &gUnk_020000C0[ent->spriteAnimation[2]].unk_00[param_2];
*((u32*)ptr) = 0;
ptr->unk_04.WORD = 0;
ptr->unk_08.WORD = 0;
ptr->unk_0C.WORD = param_3;
ptr->unk_00.unk0 = 1;
ptr->unk_00.unk1 = 1;
}
void sub_0806FEE8(struct_gUnk_020000C0_1* this, u32 param_2, u32 param_3, u32 param_4) {
this->unk_08.BYTES.byte0 = param_4;
this->unk_02 = param_2;
this->unk_04.BYTES.byte1 = param_3;
this->unk_00.unk3 = 1;
this->unk_00.unk0 = 1;
}
void sub_0806FEFC(struct_gUnk_020000C0_1* this, Entity* ent) {
this->unk_08.HALF.HI = ent->spriteVramOffset + this->unk_08.BYTES.byte0;
this->unk_00.unk2 = 1;
}
void sub_0806FF10(Entity* this, u32 param_2, u32 param_3) {
struct_gUnk_020000C0_1* ptr = &gUnk_020000C0[this->spriteAnimation[2]].unk_00[param_2];
s32 pallete = FindPalette(param_3);
if (ptr->unk_04.BYTES.byte1 != pallete) {
sub_0801D244(ptr->unk_04.BYTES.byte1);
ptr->unk_04.BYTES.byte1 = LoadObjPalette(this, param_3);
}
}
void sub_0806FF48(Entity* this, u32 param_2, u32 param_3) {
struct_gUnk_020000C0_1* ptr = &gUnk_020000C0[this->spriteAnimation[2]].unk_00[param_2];
ptr->unk_04.BYTES.byte0 = param_3;
}
void SetExtraSpriteFrame(Entity* this, u32 param_2, u32 param_3) {
struct_gUnk_020000C0* ptr1 = &gUnk_020000C0[this->spriteAnimation[2]];
struct_gUnk_020000C0_1* ptr2 = &ptr1->unk_00[param_2];
if (ptr2->unk_01 != param_3) {
ptr2->unk_01 = param_3;
ptr2->unk_00.unk3 = 1;
}
}
void SetSpriteSubEntryOffsetData1(Entity* this, u32 param_2, u32 param_3) {
struct_gUnk_020000C0* ptr1 = &gUnk_020000C0[this->spriteAnimation[2]];
struct_gUnk_020000C0_1* ptr2 = &ptr1->unk_00[param_2];
struct_gUnk_020000C0_1* ptr3 = &ptr1->unk_00[param_3];
u8* ptr4 = GetSpriteSubEntryOffsetDataPointer(ptr2->unk_02, ptr2->unk_01);
u8 val1 = ptr2->unk_04.BYTES.byte2;
u8 val2 = ptr4[0];
ptr3->unk_04.BYTES.byte2 = val1 + val2;
val1 = ptr2->unk_04.BYTES.byte3;
val2 = ptr4[1];
ptr3->unk_04.BYTES.byte3 = val1 + val2;
}
void sub_0806FFBC(Entity* this, u32 param_2, u32 param_3, u32 param_4) {
struct_gUnk_020000C0_1* ptr = &gUnk_020000C0[this->spriteAnimation[2]].unk_00[param_2];
ptr->unk_04.BYTES.byte2 = param_3;
ptr->unk_04.BYTES.byte3 = param_4;
}
void SetSpriteSubEntryOffsetData2(Entity* this, u32 param_2, u32 param_3) {
struct_gUnk_020000C0* ptr1 = &gUnk_020000C0[this->spriteAnimation[2]];
struct_gUnk_020000C0_1* ptr2 = &ptr1->unk_00[param_2];
struct_gUnk_020000C0_1* ptr3 = &ptr1->unk_00[param_3];
u8* ptr4 = GetSpriteSubEntryOffsetDataPointer(ptr2->unk_02, ptr2->unk_01);
u8 val1 = ptr2->unk_04.BYTES.byte2;
u8 val2 = ptr4[2];
ptr3->unk_04.BYTES.byte2 = val1 + val2;
val1 = ptr2->unk_04.BYTES.byte3;
val2 = ptr4[3];
ptr3->unk_04.BYTES.byte3 = val1 + val2;
}
void sub_0807000C(Entity* this) {
struct_gUnk_020000C0* ptr = &gUnk_020000C0[this->spriteAnimation[2]];
u32 val = sub_0807007C(ptr, 0);
val |= sub_0807007C(ptr, 1);
val |= sub_0807007C(ptr, 2);
val |= sub_0807007C(ptr, 3);
if (val) {
u8* ptr2 = (u8*)&gGFXSlots;
ptr2[this->spriteAnimation[0] * 12 + 7] = this->spriteAnimation[2];
ptr2[this->spriteAnimation[0] * 12 + 4] = (ptr2[this->spriteAnimation[0] * 12 + 4] & 0xf) | 0x30;
}
}
bool32 sub_0807007C(struct_gUnk_020000C0* this, u32 param_2) {
u8* ptr2;
u8* ptr3;
u32* spritePtr;
struct_gUnk_020000C0_1* ptr1 = &this->unk_00[param_2];
if ((ptr1->unk_00.unk3) == 0)
return 0;
if ((ptr1->unk_00.unk2) == 0)
return 0;
if (ptr1->unk_01 == 0xff)
return 0;
spritePtr = &gSpritePtrs[ptr1->unk_02 * 4];
ptr2 = (u8*)(spritePtr[1]);
if (ptr2 == 0)
return 0;
ptr3 = &ptr2[ptr1->unk_01 * 4];
ptr1->unk_08.BYTES.byte1 = *ptr3;
ptr1->unk_0C.WORD = spritePtr[2] + ((*(u16*)&ptr3[2]) << 5);
return 1;
}
NONMATCH("asm/non_matching/coord/GetSpriteSubEntryOffsetDataPointer.inc",
u8* GetSpriteSubEntryOffsetDataPointer(u32 param_1, u32 param_2)) {
u8* rv;
u32 val;
u32 val2;
val = ((u16*)(((u8*)gExtraFrameOffsets) + 0x10))[param_1];
val2 = ((u8*)gExtraFrameOffsets)[val + param_2] * 4;
rv = val2 + ((u8*)gExtraFrameOffsets);
rv = rv + *((u32*)((u8*)gExtraFrameOffsets));
return rv;
}
END_NONMATCH
const u8 gUnk_08114F38[] = {
0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3, 0, 0, 0, 0,
};
const s16 gCosineTable[256] = {
Q_8_8(1), // sin(64*(π/128))
Q_8_8(0.99609375), // sin(65*(π/128))
Q_8_8(0.99609375), // sin(66*(π/128))
Q_8_8(0.99609375), // sin(67*(π/128))
Q_8_8(0.9921875), // sin(68*(π/128))
Q_8_8(0.9921875), // sin(69*(π/128))
Q_8_8(0.98828125), // sin(70*(π/128))
Q_8_8(0.984375), // sin(71*(π/128))
Q_8_8(0.98046875), // sin(72*(π/128))
Q_8_8(0.97265625), // sin(73*(π/128))
Q_8_8(0.96875), // sin(74*(π/128))
Q_8_8(0.9609375), // sin(75*(π/128))
Q_8_8(0.953125), // sin(76*(π/128))
Q_8_8(0.94921875), // sin(77*(π/128))
Q_8_8(0.94140625), // sin(78*(π/128))
Q_8_8(0.9296875), // sin(79*(π/128))
Q_8_8(0.921875), // sin(80*(π/128))
Q_8_8(0.9140625), // sin(81*(π/128))
Q_8_8(0.90234375), // sin(82*(π/128))
Q_8_8(0.890625), // sin(83*(π/128))
Q_8_8(0.87890625), // sin(84*(π/128))
Q_8_8(0.8671875), // sin(85*(π/128))
Q_8_8(0.85546875), // sin(86*(π/128))
Q_8_8(0.84375), // sin(87*(π/128))
Q_8_8(0.828125), // sin(88*(π/128))
Q_8_8(0.81640625), // sin(89*(π/128))
Q_8_8(0.80078125), // sin(90*(π/128))
Q_8_8(0.78515625), // sin(91*(π/128))
Q_8_8(0.76953125), // sin(92*(π/128))
Q_8_8(0.75390625), // sin(93*(π/128))
Q_8_8(0.73828125), // sin(94*(π/128))
Q_8_8(0.72265625), // sin(95*(π/128))
Q_8_8(0.70703125), // sin(96*(π/128))
Q_8_8(0.6875), // sin(97*(π/128))
Q_8_8(0.66796875), // sin(98*(π/128))
Q_8_8(0.65234375), // sin(99*(π/128))
Q_8_8(0.6328125), // sin(100*(π/128))
Q_8_8(0.61328125), // sin(101*(π/128))
Q_8_8(0.59375), // sin(102*(π/128))
Q_8_8(0.57421875), // sin(103*(π/128))
Q_8_8(0.5546875), // sin(104*(π/128))
Q_8_8(0.53125), // sin(105*(π/128))
Q_8_8(0.51171875), // sin(106*(π/128))
Q_8_8(0.4921875), // sin(107*(π/128))
Q_8_8(0.46875), // sin(108*(π/128))
Q_8_8(0.44921875), // sin(109*(π/128))
Q_8_8(0.42578125), // sin(110*(π/128))
Q_8_8(0.40234375), // sin(111*(π/128))
Q_8_8(0.37890625), // sin(112*(π/128))
Q_8_8(0.359375), // sin(113*(π/128))
Q_8_8(0.3359375), // sin(114*(π/128))
Q_8_8(0.3125), // sin(115*(π/128))
Q_8_8(0.2890625), // sin(116*(π/128))
Q_8_8(0.265625), // sin(117*(π/128))
Q_8_8(0.2421875), // sin(118*(π/128))
Q_8_8(0.21875), // sin(119*(π/128))
Q_8_8(0.19140625), // sin(120*(π/128))
Q_8_8(0.16796875), // sin(121*(π/128))
Q_8_8(0.14453125), // sin(122*(π/128))
Q_8_8(0.12109375), // sin(123*(π/128))
Q_8_8(0.09765625), // sin(124*(π/128))
Q_8_8(0.0703125), // sin(125*(π/128))
Q_8_8(0.046875), // sin(126*(π/128))
Q_8_8(0.0234375), // sin(127*(π/128))
Q_8_8(0), // sin(128*(π/128))
Q_8_8(-0.0234375), // sin(129*(π/128))
Q_8_8(-0.046875), // sin(130*(π/128))
Q_8_8(-0.0703125), // sin(131*(π/128))
Q_8_8(-0.09765625), // sin(132*(π/128))
Q_8_8(-0.12109375), // sin(133*(π/128))
Q_8_8(-0.14453125), // sin(134*(π/128))
Q_8_8(-0.16796875), // sin(135*(π/128))
Q_8_8(-0.19140625), // sin(136*(π/128))
Q_8_8(-0.21875), // sin(137*(π/128))
Q_8_8(-0.2421875), // sin(138*(π/128))
Q_8_8(-0.265625), // sin(139*(π/128))
Q_8_8(-0.2890625), // sin(140*(π/128))
Q_8_8(-0.3125), // sin(141*(π/128))
Q_8_8(-0.3359375), // sin(142*(π/128))
Q_8_8(-0.359375), // sin(143*(π/128))
Q_8_8(-0.37890625), // sin(144*(π/128))
Q_8_8(-0.40234375), // sin(145*(π/128))
Q_8_8(-0.42578125), // sin(146*(π/128))
Q_8_8(-0.44921875), // sin(147*(π/128))
Q_8_8(-0.46875), // sin(148*(π/128))
Q_8_8(-0.4921875), // sin(149*(π/128))
Q_8_8(-0.51171875), // sin(150*(π/128))
Q_8_8(-0.53125), // sin(151*(π/128))
Q_8_8(-0.5546875), // sin(152*(π/128))
Q_8_8(-0.57421875), // sin(153*(π/128))
Q_8_8(-0.59375), // sin(154*(π/128))
Q_8_8(-0.61328125), // sin(155*(π/128))
Q_8_8(-0.6328125), // sin(156*(π/128))
Q_8_8(-0.65234375), // sin(157*(π/128))
Q_8_8(-0.66796875), // sin(158*(π/128))
Q_8_8(-0.6875), // sin(159*(π/128))
Q_8_8(-0.70703125), // sin(160*(π/128))
Q_8_8(-0.72265625), // sin(161*(π/128))
Q_8_8(-0.73828125), // sin(162*(π/128))
Q_8_8(-0.75390625), // sin(163*(π/128))
Q_8_8(-0.76953125), // sin(164*(π/128))
Q_8_8(-0.78515625), // sin(165*(π/128))
Q_8_8(-0.80078125), // sin(166*(π/128))
Q_8_8(-0.81640625), // sin(167*(π/128))
Q_8_8(-0.828125), // sin(168*(π/128))
Q_8_8(-0.84375), // sin(169*(π/128))
Q_8_8(-0.85546875), // sin(170*(π/128))
Q_8_8(-0.8671875), // sin(171*(π/128))
Q_8_8(-0.87890625), // sin(172*(π/128))
Q_8_8(-0.890625), // sin(173*(π/128))
Q_8_8(-0.90234375), // sin(174*(π/128))
Q_8_8(-0.9140625), // sin(175*(π/128))
Q_8_8(-0.921875), // sin(176*(π/128))
Q_8_8(-0.9296875), // sin(177*(π/128))
Q_8_8(-0.94140625), // sin(178*(π/128))
Q_8_8(-0.94921875), // sin(179*(π/128))
Q_8_8(-0.953125), // sin(180*(π/128))
Q_8_8(-0.9609375), // sin(181*(π/128))
Q_8_8(-0.96875), // sin(182*(π/128))
Q_8_8(-0.97265625), // sin(183*(π/128))
Q_8_8(-0.98046875), // sin(184*(π/128))
Q_8_8(-0.984375), // sin(185*(π/128))
Q_8_8(-0.98828125), // sin(186*(π/128))
Q_8_8(-0.9921875), // sin(187*(π/128))
Q_8_8(-0.9921875), // sin(188*(π/128))
Q_8_8(-0.99609375), // sin(189*(π/128))
Q_8_8(-0.99609375), // sin(190*(π/128))
Q_8_8(-0.99609375), // sin(191*(π/128))
Q_8_8(-1), // sin(192*(π/128))
Q_8_8(-0.99609375), // sin(193*(π/128))
Q_8_8(-0.99609375), // sin(194*(π/128))
Q_8_8(-0.99609375), // sin(195*(π/128))
Q_8_8(-0.9921875), // sin(196*(π/128))
Q_8_8(-0.9921875), // sin(197*(π/128))
Q_8_8(-0.98828125), // sin(198*(π/128))
Q_8_8(-0.984375), // sin(199*(π/128))
Q_8_8(-0.98046875), // sin(200*(π/128))
Q_8_8(-0.97265625), // sin(201*(π/128))
Q_8_8(-0.96875), // sin(202*(π/128))
Q_8_8(-0.9609375), // sin(203*(π/128))
Q_8_8(-0.953125), // sin(204*(π/128))
Q_8_8(-0.94921875), // sin(205*(π/128))
Q_8_8(-0.94140625), // sin(206*(π/128))
Q_8_8(-0.9296875), // sin(207*(π/128))
Q_8_8(-0.921875), // sin(208*(π/128))
Q_8_8(-0.9140625), // sin(209*(π/128))
Q_8_8(-0.90234375), // sin(210*(π/128))
Q_8_8(-0.890625), // sin(211*(π/128))
Q_8_8(-0.87890625), // sin(212*(π/128))
Q_8_8(-0.8671875), // sin(213*(π/128))
Q_8_8(-0.85546875), // sin(214*(π/128))
Q_8_8(-0.84375), // sin(215*(π/128))
Q_8_8(-0.828125), // sin(216*(π/128))
Q_8_8(-0.81640625), // sin(217*(π/128))
Q_8_8(-0.80078125), // sin(218*(π/128))
Q_8_8(-0.78515625), // sin(219*(π/128))
Q_8_8(-0.76953125), // sin(220*(π/128))
Q_8_8(-0.75390625), // sin(221*(π/128))
Q_8_8(-0.73828125), // sin(222*(π/128))
Q_8_8(-0.72265625), // sin(223*(π/128))
Q_8_8(-0.70703125), // sin(224*(π/128))
Q_8_8(-0.6875), // sin(225*(π/128))
Q_8_8(-0.66796875), // sin(226*(π/128))
Q_8_8(-0.65234375), // sin(227*(π/128))
Q_8_8(-0.6328125), // sin(228*(π/128))
Q_8_8(-0.61328125), // sin(229*(π/128))
Q_8_8(-0.59375), // sin(230*(π/128))
Q_8_8(-0.57421875), // sin(231*(π/128))
Q_8_8(-0.5546875), // sin(232*(π/128))
Q_8_8(-0.53125), // sin(233*(π/128))
Q_8_8(-0.51171875), // sin(234*(π/128))
Q_8_8(-0.4921875), // sin(235*(π/128))
Q_8_8(-0.46875), // sin(236*(π/128))
Q_8_8(-0.44921875), // sin(237*(π/128))
Q_8_8(-0.42578125), // sin(238*(π/128))
Q_8_8(-0.40234375), // sin(239*(π/128))
Q_8_8(-0.37890625), // sin(240*(π/128))
Q_8_8(-0.359375), // sin(241*(π/128))
Q_8_8(-0.3359375), // sin(242*(π/128))
Q_8_8(-0.3125), // sin(243*(π/128))
Q_8_8(-0.2890625), // sin(244*(π/128))
Q_8_8(-0.265625), // sin(245*(π/128))
Q_8_8(-0.2421875), // sin(246*(π/128))
Q_8_8(-0.21875), // sin(247*(π/128))
Q_8_8(-0.19140625), // sin(248*(π/128))
Q_8_8(-0.16796875), // sin(249*(π/128))
Q_8_8(-0.14453125), // sin(250*(π/128))
Q_8_8(-0.12109375), // sin(251*(π/128))
Q_8_8(-0.09765625), // sin(252*(π/128))
Q_8_8(-0.0703125), // sin(253*(π/128))
Q_8_8(-0.046875), // sin(254*(π/128))
Q_8_8(-0.0234375), // sin(255*(π/128))
Q_8_8(0), // sin(256*(π/128))
Q_8_8(0.0234375), // sin(257*(π/128))
Q_8_8(0.046875), // sin(258*(π/128))
Q_8_8(0.0703125), // sin(259*(π/128))
Q_8_8(0.09765625), // sin(260*(π/128))
Q_8_8(0.12109375), // sin(261*(π/128))
Q_8_8(0.14453125), // sin(262*(π/128))
Q_8_8(0.16796875), // sin(263*(π/128))
Q_8_8(0.19140625), // sin(264*(π/128))
Q_8_8(0.21875), // sin(265*(π/128))
Q_8_8(0.2421875), // sin(266*(π/128))
Q_8_8(0.265625), // sin(267*(π/128))
Q_8_8(0.2890625), // sin(268*(π/128))
Q_8_8(0.3125), // sin(269*(π/128))
Q_8_8(0.3359375), // sin(270*(π/128))
Q_8_8(0.359375), // sin(271*(π/128))
Q_8_8(0.37890625), // sin(272*(π/128))
Q_8_8(0.40234375), // sin(273*(π/128))
Q_8_8(0.42578125), // sin(274*(π/128))
Q_8_8(0.44921875), // sin(275*(π/128))
Q_8_8(0.46875), // sin(276*(π/128))
Q_8_8(0.4921875), // sin(277*(π/128))
Q_8_8(0.51171875), // sin(278*(π/128))
Q_8_8(0.53125), // sin(279*(π/128))
Q_8_8(0.5546875), // sin(280*(π/128))
Q_8_8(0.57421875), // sin(281*(π/128))
Q_8_8(0.59375), // sin(282*(π/128))
Q_8_8(0.61328125), // sin(283*(π/128))
Q_8_8(0.6328125), // sin(284*(π/128))
Q_8_8(0.65234375), // sin(285*(π/128))
Q_8_8(0.66796875), // sin(286*(π/128))
Q_8_8(0.6875), // sin(287*(π/128))
Q_8_8(0.70703125), // sin(288*(π/128))
Q_8_8(0.72265625), // sin(289*(π/128))
Q_8_8(0.73828125), // sin(290*(π/128))
Q_8_8(0.75390625), // sin(291*(π/128))
Q_8_8(0.76953125), // sin(292*(π/128))
Q_8_8(0.78515625), // sin(293*(π/128))
Q_8_8(0.80078125), // sin(294*(π/128))
Q_8_8(0.81640625), // sin(295*(π/128))
Q_8_8(0.828125), // sin(296*(π/128))
Q_8_8(0.84375), // sin(297*(π/128))
Q_8_8(0.85546875), // sin(298*(π/128))
Q_8_8(0.8671875), // sin(299*(π/128))
Q_8_8(0.87890625), // sin(300*(π/128))
Q_8_8(0.890625), // sin(301*(π/128))
Q_8_8(0.90234375), // sin(302*(π/128))
Q_8_8(0.9140625), // sin(303*(π/128))
Q_8_8(0.921875), // sin(304*(π/128))
Q_8_8(0.9296875), // sin(305*(π/128))
Q_8_8(0.94140625), // sin(306*(π/128))
Q_8_8(0.94921875), // sin(307*(π/128))
Q_8_8(0.953125), // sin(308*(π/128))
Q_8_8(0.9609375), // sin(309*(π/128))
Q_8_8(0.96875), // sin(310*(π/128))
Q_8_8(0.97265625), // sin(311*(π/128))
Q_8_8(0.98046875), // sin(312*(π/128))
Q_8_8(0.984375), // sin(313*(π/128))
Q_8_8(0.98828125), // sin(314*(π/128))
Q_8_8(0.9921875), // sin(315*(π/128))
Q_8_8(0.9921875), // sin(316*(π/128))
Q_8_8(0.99609375), // sin(317*(π/128))
Q_8_8(0.99609375), // sin(318*(π/128))
Q_8_8(0.99609375), // sin(319*(π/128))
const u8 gUnk_08114F58[] = {
0, 0, 0, 1, 1, 1, 2, 2, 2, 2, 2, 3, 3, 3, 4, 4, 4, 4, 4, 5, 5, 5, 6, 6, 6, 6, 6, 7, 7, 7, 0, 0,
};
const u8 gSpriteSortAboveTable[] = { 0, 0, 1, 2, 3, 4, 5, 6 };
const u8 gSpriteSortBelowTable[] = { 1, 2, 3, 4, 5, 6, 7, 7 };
+2 -2
View File
@@ -468,7 +468,7 @@ void (*const gEnemyFunctions[])(Entity* ent) = {
[FALLING_BOULDER] = FallingBoulder,
[BOBOMB] = Bobomb,
[WALL_MASTER_2] = WallMaster2,
[GLEEROCK] = Gleerok,
[GLEEROK] = Gleerok,
[VAATI_EYES_MACRO] = VaatiEyesMacro,
[TEKTITE] = Tektite,
[WIZZROBE_WIND] = WizzrobeWind,
@@ -505,7 +505,7 @@ void (*const gEnemyFunctions[])(Entity* ent) = {
[BOW_MOBLIN] = BowMoblin,
[LAKITU] = Lakitu,
[LAKITU_CLOUD] = LakituCloud,
[ENEMY_49] = Enemy49,
[TORCH_TRAP] = TorchTrap,
[VAATI_REBORN_ENEMY] = VaatiRebornEnemy,
[VAATI_PROJECTILE] = VaatiProjectile,
[BALL_CHAIN_SOLIDER] = BallChainSoldier,
+8 -18
View File
@@ -8,16 +8,6 @@
#include "enemy.h"
#include "functions.h"
extern u32 sub_080002D4(s32, s32, u32);
extern s32 sub_080012DC(Entity*);
extern u32 sub_08031E04(Entity*);
extern void sub_08031E48(Entity*, Entity*);
extern void sub_08032290(Entity*);
extern u32 sub_080322A4(Entity*);
void sub_080322E8(Entity*);
extern void sub_08032338(Entity*);
extern Entity* sub_08049DF4(u32);
extern Entity* gUnk_020000B0;
extern void (*const gUnk_080012C8[])(Entity*);
extern void (*const gUnk_080CE56C[])(Entity*);
@@ -114,7 +104,7 @@ void sub_080318DC(Entity* this) {
void sub_08031A60(Entity* this) {
if (this->iframes > 0)
GravityUpdate(this, 0x1800);
GravityUpdate(this, Q_8_8(24.0));
sub_08001324(this);
}
@@ -305,7 +295,7 @@ u32 sub_08031E04(Entity* this) {
return 0;
tmp = &gUnk_080CE5C0[this->frame & 6];
return sub_0806FCB8(this, ent->x.HALF.HI + tmp[0], ent->y.HALF.HI + tmp[1], 0x50);
return EntityWithinDistance(this, ent->x.HALF.HI + tmp[0], ent->y.HALF.HI + tmp[1], 0x50);
}
void sub_08031E48(Entity* this, Entity* child) {
@@ -325,7 +315,7 @@ void sub_08031E90(Entity* this) {
void sub_08031EA8(Entity* this) {
this->action = 1;
this->spritePriority.b1 = 1;
this->zVelocity = 0x40000;
this->zVelocity = Q_16_16(4.0);
this->z.HALF.HI = (4 - this->type2) * 0xe;
this->field_0x78.HALF.HI = Random();
InitializeAnimation(this, 4);
@@ -335,12 +325,12 @@ void sub_08031EE8(Entity* this) {
int draw;
this->z.WORD -= this->zVelocity;
this->zVelocity -= 0x1800;
this->zVelocity -= Q_16_16(3.0 / 32.0);
if (this->z.HALF.HI < 1) {
draw = this->spriteSettings.draw;
if (!draw)
EnqueueSFX(299);
EnqueueSFX(SFX_12B);
this->spriteSettings.draw = 1;
}
@@ -413,7 +403,7 @@ void sub_08032008(Entity* this) {
ProcessMovement(this);
} else {
if (this->field_0x76.HALF.HI == 0) {
if (sub_0806FCB8(this, parent->x.HALF.HI, parent->y.HALF.HI, 1) == 0) {
if (EntityWithinDistance(this, parent->x.HALF.HI, parent->y.HALF.HI, 1) == 0) {
this->field_0x76.HALF.HI = 1;
this->direction = GetFacingDirection(this, parent);
sub_080322E8(this);
@@ -452,7 +442,7 @@ void sub_08032160(Entity* this) {
this->spriteSettings.flipX = 0;
}
this->speed = 0xf0;
this->zVelocity = 0x12000;
this->zVelocity = Q_16_16(1.125);
this->spritePriority.b1 = 1;
InitializeAnimation(this, 12);
}
@@ -487,7 +477,7 @@ void sub_08032204(Entity* this) {
}
void sub_08032248(Entity* this) {
if (GravityUpdate(this, 0x1800) == 0) {
if (GravityUpdate(this, Q_8_8(24.0)) == 0) {
if (this->frame & 0x80) {
((Entity*)this->field_0x7c.WORD)->actionDelay--;
+342
View File
@@ -0,0 +1,342 @@
#define NENT_DEPRECATED
#include "entity.h"
#include "enemy.h"
#include "functions.h"
typedef struct {
Entity base;
u8 filler[0x10];
u16 unk_78;
u8 unk_7a;
u8 unk_7b;
u8 unk_7c;
u8 unk_7d;
u8 unk_7e;
u8 unk_7f;
} BallChainSoldierEntity;
extern Entity* gUnk_020000B0;
void (*const gUnk_080D06E0[])(BallChainSoldierEntity*);
void (*const gUnk_080D06F8[])(BallChainSoldierEntity*);
const u8 gUnk_080D0724[];
const u16 gUnk_080D0728[];
const u16 gUnk_080D0730[];
extern u32 sub_0804A044(Entity*, Entity*, u32);
extern void sub_0803E86C(BallChainSoldierEntity*);
extern void sub_0803E9A4(BallChainSoldierEntity*);
extern bool32 sub_0803E9D4(BallChainSoldierEntity*);
extern void sub_0803E8CC(BallChainSoldierEntity*);
extern void sub_0803E92C(BallChainSoldierEntity*);
extern bool32 sub_0803EA64(BallChainSoldierEntity*);
extern void sub_0803E94C(BallChainSoldierEntity*, u32);
extern bool32 sub_0803EAD0(BallChainSoldierEntity*, u32);
void BallChainSoldier(Entity* this) {
EnemyFunctionHandler(this, (EntityActionArray)gUnk_080D06E0);
}
void sub_0803E538(BallChainSoldierEntity* this) {
gUnk_080D06F8[super->action](this);
}
void sub_0803E550(BallChainSoldierEntity* this) {
sub_0804AA30(super, gUnk_080D06E0);
}
void sub_0803E560(BallChainSoldierEntity* this) {
sub_08001324(super);
sub_0803E538(this);
}
void BallChainSoldier_CreateDeathFx(BallChainSoldierEntity* this) {
CreateDeathFx(super, 0xff, 0x57);
}
void nullsub_20(BallChainSoldierEntity* this) {
}
void BallChainSoldier_Init(BallChainSoldierEntity* this) {
Entity* ent;
sub_0804A720(super);
ent = CreateProjectileWithParent(super, BALL_AND_CHAIN, 0);
if (ent == NULL)
return;
ent->parent = super;
super->child = ent;
COLLISION_ON(super);
super->spriteSettings.draw = 1;
super->animationState = Random() & 3;
this->unk_7b = 0;
this->unk_7c = 0;
this->unk_7e = 0x20;
this->unk_7f = 0xfe;
InitAnimationForceUpdate(super, super->animationState << 2);
sub_0803E86C(this);
}
void sub_0803E5E8(BallChainSoldierEntity* this) {
this->unk_7c -= 0xa;
sub_0803E9A4(this);
if (sub_0803E9D4(this) == 0) {
if (--this->unk_78 == 0) {
sub_0803E8CC(this);
}
}
}
void sub_0803E61C(BallChainSoldierEntity* this) {
this->unk_7c -= 0xa;
sub_0803E9A4(this);
if (sub_0803E9D4(this) == 0) {
if (super->knockbackDuration == 0) {
if (ProcessMovement(super) == 0) {
sub_0803E86C(this);
return;
}
}
if (--this->unk_78 == 0) {
sub_0803E92C(this);
}
}
}
void sub_0803E66C(BallChainSoldierEntity* this) {
this->unk_7c -= 0x10;
sub_0803E9A4(this);
if (this->unk_7e <= 0x21) {
this->unk_7e++;
}
if (!sub_08049FDC(super, 1) || sub_0803EA64(this) == 0) {
super->action = 4;
this->unk_7b = 0;
}
}
void sub_0803E6B4(BallChainSoldierEntity* this) {
this->unk_7c -= 0xa;
sub_0803E9A4(this);
if (this->unk_7e > 0x20) {
this->unk_7e--;
} else {
sub_0803E86C(this);
}
}
void sub_0803E6E0(BallChainSoldierEntity* this) {
this->unk_7c -= 0xc;
sub_0803E9A4(this);
this->unk_7e -= 4;
if ((s8)this->unk_7e <= 0) {
this->unk_7e = 0;
super->action = 6;
super->actionDelay = 0x1e;
InitAnimationForceUpdate(super, super->animationState + 0x20);
}
}
void sub_0803E71C(BallChainSoldierEntity* this) {
if (--super->actionDelay == 0) {
super->action = 7;
super->actionDelay = 1;
this->unk_7c = gUnk_080D0724[super->animationState];
this->unk_7b = 0;
this->unk_7f = 0xf6;
EnqueueSFX(SFX_15B);
}
}
void sub_0803E75C(BallChainSoldierEntity* this) {
if ((super->frame & 0x80) == 0) {
UpdateAnimationSingleFrame(super);
} else {
if (--super->actionDelay == 0) {
super->actionDelay = 2;
this->unk_7f++;
}
if (this->unk_7f) {
this->unk_7e += 5;
} else {
super->action = 8;
super->actionDelay = 0x1e;
InitScreenShake(8, 0);
}
}
}
void sub_0803E7B4(BallChainSoldierEntity* this) {
if (--super->actionDelay == 0) {
super->action = 9;
}
}
void sub_0803E7CC(BallChainSoldierEntity* this) {
this->unk_7e -= 2;
if (this->unk_7e <= 0xa) {
super->action = 0xa;
super->actionDelay = 0x5a;
super->direction = DirectionFromAnimationState(super->animationState);
this->unk_7c = 0;
this->unk_7f = 0xfe;
sub_0803E94C(this, 0x10);
} else if (this->unk_7e <= 0x12) {
COLLISION_OFF(super->child);
}
}
void sub_0803E818(BallChainSoldierEntity* this) {
if (super->actionDelay) {
if (--super->actionDelay == 0) {
COLLISION_ON(super->child);
sub_0803E94C(this, 0);
}
} else {
this->unk_7c -= 0xa;
sub_0803E9A4(this);
if (++this->unk_7e > 0x1f) {
sub_0803E86C(this);
}
}
}
void sub_0803E86C(BallChainSoldierEntity* this) {
if (sub_08049FDC(super, 1) && sub_0803EAD0(this, 0x50)) {
super->direction = DirectionRoundUp(GetFacingDirection(super, gUnk_020000B0));
}
super->action = 1;
this->unk_78 = gUnk_080D0728[Random() & 3];
this->unk_7a = 4;
sub_0803E94C(this, 0);
}
void sub_0803E8CC(BallChainSoldierEntity* this) {
u32 rand = Random();
u32 temp;
u32 dir;
if (sub_08049FA0(super) == 0 && (rand & 3)) {
dir = sub_08049EE4(super) + 4;
temp = 0x18;
} else {
temp = 0x18;
dir = rand;
}
super->direction = dir & temp;
super->action = 2;
this->unk_78 = gUnk_080D0730[(rand >> 0x10) & 3];
this->unk_7a = 4;
sub_0803E94C(this, 0x10);
}
void sub_0803E92C(BallChainSoldierEntity* this) {
if (Random() & 1) {
sub_0803E86C(this);
} else {
sub_0803E8CC(this);
}
}
void sub_0803E94C(BallChainSoldierEntity* this, u32 arg2) {
s32 animationState = DirectionToAnimationState(super->direction);
if ((super->animIndex & 0x10) == arg2) {
u32 dir = super->direction & 7;
s32 currentAnimationState = super->animationState;
if (dir == 4) {
if (((currentAnimationState - (super->direction >> 3)) & 3) <= 1)
return;
}
if (animationState == currentAnimationState)
return;
}
super->animationState = animationState;
animationState = arg2 + (super->animIndex & 3) + animationState * 4;
InitAnimationForceUpdate(super, animationState);
}
void sub_0803E9A4(BallChainSoldierEntity* this) {
s32 val = ((this->unk_7c + 0x20) & 0xff) >> 6;
if ((super->animIndex & 3) == val)
return;
InitAnimationForceUpdate(super, val + (super->animIndex & -4));
}
bool32 sub_0803E9D4(BallChainSoldierEntity* this) {
u32 dir;
if (sub_08049FDC(super, 1)) {
if (sub_0803EAD0(this, 0x38)) {
super->action = 3;
super->direction = DirectionRoundUp(GetFacingDirection(super, gUnk_020000B0));
this->unk_7b = 1;
sub_0803E94C(this, 0);
return 1;
} else if (sub_0803EAD0(this, 0x4e)) {
dir = sub_0804A044(super, gUnk_020000B0, 0x12);
if (dir != 0xff) {
if (--this->unk_7a != 0)
return 0;
super->action = 5;
super->direction = dir;
this->unk_7a = 4;
sub_0803E94C(this, 0);
return 1;
}
}
}
this->unk_7a = 4;
return 0;
}
bool32 sub_0803EA64(BallChainSoldierEntity* this) {
u32 dir;
if (sub_08049FDC(super, 1)) {
if (sub_0803EAD0(this, 0x4e)) {
dir = sub_0804A044(super, gUnk_020000B0, 0x12);
if (dir != 0xff) {
if (--this->unk_7a != 0)
return 1;
super->action = 5;
super->direction = dir;
sub_0803E94C(this, 0);
return 1;
}
}
if (sub_0803EAD0(this, 0x38))
return 1;
}
this->unk_7a = 4;
return 0;
}
bool32 sub_0803EAD0(BallChainSoldierEntity* this, u32 distance) {
return EntityWithinDistance(super, gUnk_020000B0->x.HALF.HI, gUnk_020000B0->y.HALF.HI - 4, distance);
}
void (*const gUnk_080D06E0[])(BallChainSoldierEntity*) = {
sub_0803E538,
sub_0803E550,
sub_0803E560,
BallChainSoldier_CreateDeathFx,
(void (*const)(BallChainSoldierEntity*))sub_08001242,
nullsub_20,
};
void (*const gUnk_080D06F8[])(BallChainSoldierEntity*) = {
BallChainSoldier_Init, sub_0803E5E8, sub_0803E61C, sub_0803E66C, sub_0803E6B4, sub_0803E6E0,
sub_0803E71C, sub_0803E75C, sub_0803E7B4, sub_0803E7CC, sub_0803E818,
};
const u8 gUnk_080D0724[] = { 0, 0x44, 0x80, 0xBC };
const u16 gUnk_080D0728[] = { 0x1E, 0x32, 0x46, 0x5A };
const u16 gUnk_080D0730[] = { 0x3C, 0x5A, 0x78, 0x96 };
+5 -5
View File
@@ -109,7 +109,7 @@ void sub_080218CC(Entity* this) {
this->spriteSettings.draw = 1;
this->direction = ((sub_08049F84(this, 1) ^ 0x10) + gUnk_080CB5DC[Random() & 7]) & 0x1f;
this->speed = 0x100;
this->zVelocity = 0x12000;
this->zVelocity = Q_16_16(1.125);
}
GetNextFrame(this);
@@ -137,7 +137,7 @@ void sub_08021984(Entity* this) {
this->z.HALF.HI = -0x80;
this->spriteRendering.b3 = 1;
this->spriteOrientation.flipY = 1;
EnqueueSFX(0x12d);
EnqueueSFX(SFX_12D);
}
if (GravityUpdate(this, 0x1800) == 0) {
@@ -204,7 +204,7 @@ void sub_08021AD8(Entity* this) {
return;
}
this->direction = (u8)tmp;
EnqueueSFX(0x7c);
EnqueueSFX(SFX_PLY_JUMP);
}
sub_080AEFE0(this);
if (!GravityUpdate(this, 0x1800))
@@ -242,7 +242,7 @@ void sub_08021B64(Entity* this) {
if (iVar4 == 0) {
this->action = 6;
this->zVelocity = 0x10000;
this->zVelocity = Q_16_16(1.0);
((u8*)&this->field_0x86)[1] = 0;
if (gPlayerEntity.direction != 0xff) {
this->direction = 0x10 ^ gPlayerEntity.direction;
@@ -303,7 +303,7 @@ u32 sub_08021D00(Entity* this) {
} else {
this->action = 4;
this->actionDelay = 1;
this->zVelocity = 0x18000;
this->zVelocity = Q_16_16(1.5);
InitializeAnimation(this, 4);
ret = 1;
}
+1 -1
View File
@@ -24,7 +24,7 @@ void BladeTrap(Entity* this) {
if (!(--this->field_0x74.HWORD)) {
if (!(this->direction & 0x80)) {
EnqueueSFX(0x74);
EnqueueSFX(SFX_METAL_CLINK);
}
sub_080A2CC0(this, &this->child, &this->field_0x74.HWORD);
}
+6 -6
View File
@@ -55,13 +55,13 @@ void sub_0802C688(Entity* this) {
switch (this->field_0x82.HALF.LO) {
case 1:
sub_0802CB68(this);
EnqueueSFX(0x14d);
EnqueueSFX(SFX_14D);
break;
case 2:
this->action = 3;
this->hitType = 0x6e;
this->field_0xf = 1;
this->zVelocity = 0x18000;
this->zVelocity = Q_16_16(1.5);
this->speed = 0;
this->field_0x80.HALF.HI = 1;
InitializeAnimation(this, this->direction >> 4 | 6);
@@ -79,7 +79,7 @@ void sub_0802C7AC(Entity* this) {
if (this->field_0x82.HALF.LO != 2) {
this->speed = this->field_0x82.HALF.LO ? 0x200 : 0x80;
}
this->zVelocity = 0x18000;
this->zVelocity = Q_16_16(1.5);
this->field_0x82.HALF.HI = 0;
this->field_0x80.HALF.HI = 0;
} else {
@@ -232,7 +232,7 @@ void sub_0802CA94(Entity* this) {
COLLISION_OFF(this);
this->field_0xf = 1;
this->spritePriority.b1 = 1;
this->zVelocity = 0x18000;
this->zVelocity = Q_16_16(1.5);
this->speed = 0;
this->field_0x82.HALF.HI = 0;
this->field_0x80.HALF.HI = 0;
@@ -245,7 +245,7 @@ void sub_0802CAF8(Entity* this) {
sub_0802CBC4(this);
} else {
if (this->field_0x80.HALF.HI && sub_080044EC(this, 0x2800) == 1) {
EnqueueSFX(0x104);
EnqueueSFX(SFX_104);
}
sub_0802CC18(this);
sub_08078930(this);
@@ -300,7 +300,7 @@ void sub_0802CBC4(Entity* this) {
void sub_0802CC18(Entity* this) {
if (--this->field_0x80.HALF.LO == 0) {
this->field_0x80.HALF.LO = 28;
EnqueueSFX(0x14d);
EnqueueSFX(SFX_14D);
}
}
+92 -26
View File
@@ -12,12 +12,6 @@
#include "object.h"
#include "functions.h"
extern void sub_08078954(Entity*);
extern void sub_08078930(Entity*);
extern s32 sub_080012DC(Entity*);
extern Entity* sub_08049DF4(u32);
extern void sub_08079BD8(Entity*);
void sub_0802AD1C(Entity*, u32);
void sub_0802AD54(Entity*);
void sub_0802B048(Entity*);
@@ -194,9 +188,6 @@ void sub_0802AA40(Entity* this) {
}
}
#ifdef EU
ASM_FUNC("asm/non_matching/eu/sub_0802AAC0.inc", void sub_0802AAC0(Entity* this))
#else
void sub_0802AAC0(Entity* this) {
sub_0802AC40(this);
if (--this->field_0xf == 0) {
@@ -210,24 +201,52 @@ void sub_0802AAC0(Entity* this) {
} else if (ent->next == NULL) {
this->field_0x80.HALF.HI = 0;
this->child = NULL;
#ifdef EU
} else if (ent->actionDelay == 0) {
if (sub_080002E0(COORD_TO_TILE(this), 1) == 0) {
if (EntityInRectRadius(this, &gPlayerEntity, 0x10, 0x10) && ent->field_0xf <= 0x50) {
this->field_0x80.HALF.HI = 0;
}
} else if (ent->field_0xf <= 0x13) {
this->field_0x80.HALF.HI = 0;
}
}
#else
} else if (ent->actionDelay == 0 && ent->field_0xf < 0x51) {
this->field_0x80.HALF.HI = 0;
}
#endif
} else {
this->action = 4;
this->actionDelay = 0xc0;
this->field_0xf = 4;
this->field_0x80.HALF.LO ^= 1;
#ifndef EU
this->field_0x78.HALF.LO = 0;
this->field_0x78.HALF.HI = 4;
this->direction = 0xff;
#endif
InitializeAnimation(this, 0);
}
}
#endif
#ifdef EU
ASM_FUNC("asm/non_matching/eu/sub_0802AB40.inc", void sub_0802AB40(Entity* this));
void sub_0802AB40(Entity* this) {
sub_0802AC40(this);
if (--this->actionDelay == 0) {
if (this->field_0x7a.HALF.LO <= 4) {
this->action = 5;
this->speed = 0;
InitializeAnimation(this, this->type + 1);
} else {
this->actionDelay = 0xc0;
this->field_0xf = 0x4;
this->field_0x80.HALF.LO ^= 1;
}
} else if ((--this->field_0xf & 0xff) == 0) {
sub_0802ACDC(this, 4);
}
}
#else
void sub_0802AB40(Entity* this) {
sub_0802AC40(this);
@@ -281,9 +300,6 @@ void sub_0802AC08(Entity* this) {
GetNextFrame(this);
}
#ifdef EU
ASM_FUNC("asm/non_matching/eu/sub_0802AC40.inc", void sub_0802AC40(Entity* this))
#else
void sub_0802AC40(Entity* this) {
GetNextFrame(this);
LinearMoveUpdate(this);
@@ -291,6 +307,7 @@ void sub_0802AC40(Entity* this) {
if (sub_0802B234(this) == 0) {
this->field_0x7a.HALF.LO = 0;
this->spritePriority.b1 = 0;
#ifndef EU
} else {
if (this->z.HALF.HI == 0) {
if (this->spritePriority.b1 != 1) {
@@ -301,19 +318,23 @@ void sub_0802AC40(Entity* this) {
this->spritePriority.b1 = 3;
}
}
#endif
}
} else {
if (sub_0802B234(this)) {
this->field_0x7a.HALF.LO = 1;
#ifndef EU
if (this->z.HALF.HI == 0) {
this->spritePriority.b1 = 1;
} else {
this->spritePriority.b1 = 3;
}
#else
this->spritePriority.b1 = 3;
#endif
}
}
}
#endif
void sub_0802ACDC(Entity* this, u32 param_2) {
u32 x;
@@ -362,10 +383,6 @@ void sub_0802AD54(Entity* this) {
}
}
#ifdef EU
// TODO regalloc in EU version
ASM_FUNC("asm/non_matching/eu/sub_0802ADDC.inc", void sub_0802ADDC(Entity* this))
#else
void sub_0802ADDC(Entity* this) {
Entity* ent = CreateEnemy(BOMB_PEAHAT, this->type + 2);
if (ent != NULL) {
@@ -373,21 +390,20 @@ void sub_0802ADDC(Entity* this) {
ent->parent = this;
this->child = ent;
CopyPosition(this, ent);
/*#ifdef EU
this->z.HALF.HI += 8;
#endif*/
#ifdef EU
ent->z.HALF.HI += 8;
#endif
this->field_0x80.HALF.HI = 1;
if (this->type == 0) {
this->field_0x7a.HALF.LO++;
}
}
}
#endif
void sub_0802AE24(Entity* this) {
this->action = 1;
this->actionDelay = 0xf0;
this->zVelocity = 0x8000;
this->zVelocity = Q_16_16(0.5);
this->hitbox = (Hitbox*)&gUnk_080CD174;
this->field_0x3c = 3;
this->field_0x16 = 0;
@@ -398,7 +414,30 @@ void sub_0802AE24(Entity* this) {
}
#ifdef EU
ASM_FUNC("asm/non_matching/eu/sub_0802AE68.inc", void sub_0802AE68(Entity* this))
void sub_0802AE68(Entity* this) {
Entity* ent = this->parent;
if (ent == 0) {
this->action = 3;
this->spriteSettings.draw = 1;
this->field_0x80.HALF.LO = 1;
}
if (ent->field_0x80.HALF.HI) {
CopyPosition(ent, this);
this->z.HALF.HI += 8;
this->spriteSettings.draw = 0;
} else {
this->action = 3;
this->field_0x80.HALF.LO = 1;
this->spriteSettings.draw = 1;
if (sub_0802B234(this)) {
this->spritePriority.b1 = 3;
} else {
this->spritePriority.b1 = 0;
}
GetNextFrame(this);
}
}
#else
void sub_0802AE68(Entity* this) {
Entity* ent = sub_0802B250(this);
@@ -575,7 +614,34 @@ void sub_0802B1A0(Entity* this) {
}
#ifdef EU
ASM_FUNC("asm/non_matching/eu/sub_0802B1BC.inc", void sub_0802B1BC(Entity* this))
void sub_0802B1BC(Entity* this) {
Entity* ent;
if (this->actionDelay) {
this->actionDelay--;
}
ent = this->parent;
if (ent == 0) {
this->action = 2;
this->spriteSettings.draw = 1;
}
if (ent->field_0x80.HALF.HI) {
CopyPosition(ent, this);
this->z.HALF.HI += 8;
} else {
this->action = 2;
this->spriteSettings.draw = 1;
if (sub_0802B234(this)) {
this->spritePriority.b1 = 3;
} else {
this->spritePriority.b1 = 0;
}
GetNextFrame(this);
}
}
#else
void sub_0802B1BC(Entity* this) {
Entity* ent;
-2
View File
@@ -33,8 +33,6 @@ void sub_0803C714(BowMoblinEntity*);
void sub_0803C634(BowMoblinEntity*);
u32 sub_0803C6F8(BowMoblinEntity*);
u32 sub_0803C568(BowMoblinEntity*);
extern Entity* sub_08049DF4(u32);
extern u32 sub_0806FC80(Entity*, Entity*, s32);
void sub_0803C664(BowMoblinEntity*);
void (*const gUnk_080CFF78[])(Entity*);
+3 -8
View File
@@ -14,15 +14,10 @@
#include "game.h"
#include "item.h"
extern Entity* sub_08049DF4(u32);
extern bool32 sub_08056338(void);
extern void UnloadOBJPalette(Entity*);
bool32 sub_0802915C(Entity*);
bool32 sub_080291DC(Entity*);
void sub_0802922C(Entity*);
void sub_08028E9C(Entity*);
u32 sub_080001DA(u32, u32);
void sub_08028FFC(Entity*);
void sub_0802925C(Entity*);
void sub_080290E0(Entity*, u32);
@@ -70,7 +65,7 @@ void sub_08028934(Entity* this) {
if (pEVar1 != NULL) {
pEVar1->z.HALF.HI -= 8;
}
EnqueueSFX(0x1bb);
EnqueueSFX(SFX_EM_DEKUSCRUB_HIT);
}
}
@@ -94,7 +89,7 @@ void sub_08028994(Entity* this) {
} else {
this->actionDelay = 0;
this->field_0x76.HWORD = COORD_TO_TILE(this);
this->field_0x74.HWORD = sub_080001DA(this->field_0x76.HWORD, this->collisionLayer);
this->field_0x74.HWORD = GetTileIndex(this->field_0x76.HWORD, this->collisionLayer);
this->hurtType = 0x41;
sub_08028FFC(this);
}
@@ -302,7 +297,7 @@ void sub_08028CE8(Entity* this) {
}
void sub_08028DE8(Entity* this) {
if (gPlayerEntity.action == 8) {
if (gPlayerEntity.action == PLAYER_ITEMGET) {
if (this->field_0x80.HALF.HI == 0) {
SetPlayerControl(1);
this->field_0x80.HALF.HI = 1;
+5 -5
View File
@@ -220,7 +220,7 @@ void sub_0801F1B0(Entity* this) {
if (this->frame & 1) {
this->frame ^= 1;
this->hitType = 90;
EnqueueSFX(299);
EnqueueSFX(SFX_12B);
}
sub_080AEFE0(this);
if (GravityUpdate(this, 0x4000) == 0)
@@ -416,7 +416,7 @@ void sub_0801F584(Entity* this) {
if (this->frame & 0x1) {
this->frame ^= 1;
this->hitType = 91;
EnqueueSFX(299);
EnqueueSFX(SFX_12B);
}
sub_080AEFE0(this);
if (GravityUpdate(this, 0x4000) == 0)
@@ -564,7 +564,7 @@ void sub_0801F884(Entity* this) {
ent->type2 = 64;
this->action = 4;
this->hitType = 165;
EnqueueSFX(0x193);
EnqueueSFX(SFX_193);
}
}
}
@@ -593,7 +593,7 @@ void sub_0801F940(Entity* this) {
if (this->frame & 0x10) {
if (this->frame & 1) {
this->frame ^= 1;
EnqueueSFX(299);
EnqueueSFX(SFX_12B);
}
sub_080AEFE0(this);
if (GravityUpdate(this, 0x4000) == 0)
@@ -722,7 +722,7 @@ u32 sub_0801FBD0(Entity* this) {
void Chuchu_JumpAtPlayer(Entity* this) {
this->speed = 0x180;
this->zVelocity = 0x20000;
this->zVelocity = Q_16_16(2.0);
this->direction = sub_08049F84(this, 1);
InitializeAnimation(this, 3);
}
-2
View File
@@ -20,8 +20,6 @@ void (*const gUnk_080CE990[])(CrowEntity*);
void (*const gUnk_080CE9A4[])(CrowEntity*);
extern Entity* gUnk_020000B0;
extern Entity* sub_08049DF4(u32);
void sub_08032AF4(CrowEntity* this);
void sub_08032AB0(CrowEntity* this);
void sub_08032B38(CrowEntity* this);
+383
View File
@@ -0,0 +1,383 @@
#define NENT_DEPRECATED
#include "entity.h"
#include "enemy.h"
#include "functions.h"
typedef struct {
Entity base;
u8 filler[0x10];
u16 unk_78;
u8 unk_7a;
u8 unk_7b;
} CuccoAggrEntity;
extern void (*const gUnk_080012C8[])(Entity*);
typedef struct {
u16 x;
u16 y;
} PosOffset;
void (*const gUnk_080CF778[])(Entity*);
void (*const gUnk_080CF790[])(CuccoAggrEntity*);
void (*const gUnk_080CF7AC[])(CuccoAggrEntity*);
const u8 gUnk_080CF7BC[];
const u8 gUnk_080CF7BE[];
const u8 gUnk_080CF7C2[];
const PosOffset gCuccoAggrSpawnPoints[];
const u16 gUnk_080CF824[];
const u16 gUnk_080CF828[];
const s8 gCuccoAggrFxHorizontalOffsets[];
const u8 gCuccoAggrFx[];
extern void sub_080391B4(CuccoAggrEntity* this);
extern void sub_08039218(CuccoAggrEntity* this);
extern void CuccoAggr_CreateFx(CuccoAggrEntity* this);
extern void sub_08039120(CuccoAggrEntity* this);
extern void sub_08039140(CuccoAggrEntity* this);
extern void sub_0803901C(CuccoAggrEntity* this);
extern void sub_08039298(CuccoAggrEntity* this);
extern void sub_080390F8(CuccoAggrEntity* this);
extern void sub_080390C0(CuccoAggrEntity* this);
extern bool32 CuccoAggr_IsOutsideScroll(CuccoAggrEntity* this);
void CuccoAggr(Entity* this) {
u32 index = sub_080012DC(this);
if (index) {
gUnk_080012C8[index](this);
} else {
gUnk_080CF778[GetNextFunction(this)](this);
SetChildOffset(this, 0, 1, -0x10);
sub_080391B4((CuccoAggrEntity*)this);
}
}
void sub_08038CF8(CuccoAggrEntity* this) {
gUnk_080CF790[super->action](this);
}
void sub_08038D10(CuccoAggrEntity* this) {
if (super->type != 2) {
if (this->unk_7a == 0 && CheckRoomFlag(1) == 0) {
if (super->health <= 0xbf) {
this->unk_7a = 1;
}
} else {
super->health = 0xff;
}
sub_08039218(this);
CuccoAggr_CreateFx(this);
}
if (super->field_0x43) {
sub_0804A9FC(super, 0x1c);
}
sub_0804AA30(super, gUnk_080CF778);
}
void nullsub_165(CuccoAggrEntity* this) {
}
void sub_08038D78(CuccoAggrEntity* this) {
sub_0804A720(super);
if (super->type != 2) {
super->type2 = 0;
super->field_0x16 = 0x30;
sub_08039120(this);
} else {
sub_08039140(this);
}
}
void sub_08038DA0(CuccoAggrEntity* this) {
if (--super->actionDelay == 0) {
sub_0803901C(this);
}
sub_08039298(this);
}
void sub_08038DC0(CuccoAggrEntity* this) {
gUnk_080CF7AC[super->subAction](this);
}
void sub_08038DD8(CuccoAggrEntity* this) {
super->subAction = 1;
super->actionDelay = 0x10;
super->field_0xf = gUnk_080CF7BC[super->type];
COLLISION_OFF(super);
super->spritePriority.b1 = 0;
InitializeAnimation(super, 4);
EnqueueSFX(SFX_VO_CUCCO4);
}
void sub_08038E18(CuccoAggrEntity* this) {
if (super->field_0xf) {
if (--super->field_0xf == 0) {
sub_08079184();
sub_08039218(this);
COLLISION_ON(super);
super->spritePriority.b1 = 1;
super->spritePriority.b0 = 4;
super->direction = Random() & 0x1f;
ProcessMovement(super);
UpdateSpriteForCollisionLayer(super);
}
}
if (--super->actionDelay == 0) {
super->actionDelay = 0x10;
super->spriteSettings.flipX ^= (Random() & 1);
CuccoAggr_CreateFx(this);
}
GetNextFrame(super);
}
void sub_08038EAC(CuccoAggrEntity* this) {
super->spritePriority.b1 = 1;
sub_080390F8(this);
GetNextFrame(super);
}
void sub_08038ED0(CuccoAggrEntity* this) {
COLLISION_ON(super);
sub_08039218(this);
}
void sub_08038EE0(CuccoAggrEntity* this) {
ProcessMovement(super);
GetNextFrame(super);
sub_08039298(this);
if (GravityUpdate(super, 0x1C00) == 0) {
if (--super->actionDelay == 0) {
sub_0803901C(this);
} else {
super->zVelocity = 0x8000;
}
}
}
void sub_08038F20(CuccoAggrEntity* this) {
sub_08039298(this);
GetNextFrame(super);
if (super->frame & 0x80) {
sub_0803901C(this);
}
}
void sub_08038F44(CuccoAggrEntity* this) {
super->direction = GetFacingDirection(&gPlayerEntity, super);
sub_080390F8(this);
ProcessMovement(super);
sub_080044EC(super, 0x1800);
GetNextFrame(super);
sub_08039298(this);
if (--this->unk_78 == 0) {
sub_08039120(this);
} else if ((this->unk_78 & 0x1f) == 0) {
CuccoAggr_CreateFx(this);
}
}
void sub_08038FA0(CuccoAggrEntity* this) {
if ((super->actionDelay++ & 0x1f) == 0) {
CuccoAggr_CreateFx(this);
}
if (this->unk_78) {
if ((this->unk_78-- & 0x7) == 0) {
sub_08004596(super, GetFacingDirection(super, &gPlayerEntity));
}
sub_080390F8(this);
LinearMoveUpdate(super);
GetNextFrame(super);
} else {
LinearMoveUpdate(super);
GetNextFrame(super);
if (CuccoAggr_IsOutsideScroll(this)) {
DeleteEntity(super);
}
}
}
void sub_0803901C(CuccoAggrEntity* this) {
u32 r3 = Random();
u32 r5 = r3 & 3;
//! @bug This if was meant to check r5 instead of r3.
// The result is that this if practically never happens and
// there's a higher chance of the default branch of the next switch.
if (r3 == 3) {
switch (super->action) {
case 3:
r5 = 1;
break;
case 4:
r5 = 2;
break;
default:
r5 = 0;
}
}
switch (r5) {
default:
super->action = 1;
super->actionDelay = gUnk_080CF7BE[(r3 >> 0x10) & 3];
InitializeAnimation(super, 0);
break;
case 1:
super->action = 3;
super->actionDelay = ((r3 >> 8) & 3) + 2;
super->zVelocity = 0x8000;
sub_080390C0(this);
InitializeAnimation(super, 1);
if (Random() & 1) {
r5 = Random() & 1;
EnqueueSFX(SFX_VO_CUCCO1 + r5);
}
break;
case 2:
super->action = 4;
InitializeAnimation(super, ((r3 >> 0x10) & 1) + 2);
break;
}
}
void sub_080390C0(CuccoAggrEntity* this) {
u32 rand = Random();
if (sub_08049FA0(super) && (rand & 1)) {
super->direction = (rand >> 0x10) & 0x1c;
} else {
super->direction = (sub_08049EE4(super) + 2) & 0x1c;
}
sub_080390F8(this);
}
void sub_080390F8(CuccoAggrEntity* this) {
if (super->direction & 0xf) {
super->spriteSettings.flipX = ((super->direction >> 4) ^ 1);
}
}
void sub_08039120(CuccoAggrEntity* this) {
super->speed = gUnk_080CF7C2[super->type];
this->unk_7a = 0;
sub_0803901C(this);
}
void sub_08039140(CuccoAggrEntity* this) {
super->action = 6;
super->actionDelay = Random();
super->direction = GetFacingDirection(super, &gPlayerEntity);
super->z.HALF.HI = 0xfffc;
this->unk_78 = 0xb4;
sub_080390F8(this);
InitializeAnimation(super, 4);
}
bool32 CuccoAggr_IsOutsideScroll(CuccoAggrEntity* this) {
if ((u32)super->x.HALF.HI - 0xc - gRoomControls.scroll_x > 0x108)
return 1;
if ((u32)super->y.HALF.HI - 0xc - gRoomControls.scroll_y > 0xb8)
return 1;
return 0;
}
void sub_080391B4(CuccoAggrEntity* this) {
if (this->unk_7a) {
if ((this->unk_7b++ & 0x1f) == 0) {
Entity* ent = CreateEnemy(CUCCO_AGGR, 2);
if (ent) {
u32 rand = (Random() & 0x17);
const PosOffset* ptr = &gCuccoAggrSpawnPoints[rand];
ent->x.HALF.HI = gRoomControls.scroll_x + ptr->x;
ent->y.HALF.HI = gRoomControls.scroll_y + ptr->y;
ent->collisionLayer = super->collisionLayer;
}
}
}
}
void sub_08039218(CuccoAggrEntity* this) {
super->action = 5;
super->speed = gUnk_080CF824[super->type];
this->unk_78 = gUnk_080CF828[super->type];
if (super->animIndex != 4) {
InitializeAnimation(super, 4);
}
EnqueueSFX(SFX_VO_CUCCO4);
}
void CuccoAggr_CreateFx(CuccoAggrEntity* this) {
Entity* ent = CreateFx(super, gCuccoAggrFx[super->type], 0);
if (ent) {
ent->x.HALF.HI += gCuccoAggrFxHorizontalOffsets[super->spriteSettings.flipX];
}
}
void sub_08039298(CuccoAggrEntity* this) {
if (super->type2 == 0) {
sub_08078930(super);
}
}
void (*const gUnk_080CF778[])(Entity*) = {
(EntityActionPtr)sub_08038CF8, (EntityActionPtr)sub_08038D10, sub_08001324, sub_0804A7D4, sub_08001242,
(EntityActionPtr)nullsub_165,
};
void (*const gUnk_080CF790[])(CuccoAggrEntity*) = {
sub_08038D78, sub_08038DA0, sub_08038DC0, sub_08038EE0, sub_08038F20, sub_08038F44, sub_08038FA0,
};
void (*const gUnk_080CF7AC[])(CuccoAggrEntity*) = {
sub_08038DD8,
sub_08038E18,
sub_08038EAC,
sub_08038ED0,
};
const u8 gUnk_080CF7BC[] = { 0, 0x78 };
const u8 gUnk_080CF7BE[] = { 0x1e, 0x2d, 0x3c, 0x4b };
const u8 gUnk_080CF7C2[] = { 0x80, 0xc0 };
const PosOffset gCuccoAggrSpawnPoints[] = {
{ 0x18, -0x8 }, { 0x38, -0x8 }, { 0x58, -0x8 }, { 0x78, -0x8 }, { 0x98, -0x8 }, { 0xB8, -0x8 },
{ 0xD8, -0x8 }, { 0x18, 0xA8 }, { 0x38, 0xA8 }, { 0x58, 0xA8 }, { 0x78, 0xA8 }, { 0x98, 0xA8 },
{ 0xB8, 0xA8 }, { 0xD8, 0xA8 }, { -0x8, 0x10 }, { -0x8, 0x30 }, { -0x8, 0x50 }, { -0x8, 0x70 },
{ -0x8, 0x90 }, { 0xF8, 0x10 }, { 0xF8, 0x30 }, { 0xF8, 0x50 }, { 0xF8, 0x70 }, { 0xF8, 0x90 },
};
const u16 gUnk_080CF824[] = {
0x140,
0x200,
};
const u16 gUnk_080CF828[] = {
0x384,
0x3c,
};
const s8 gCuccoAggrFxHorizontalOffsets[] = {
8,
-8,
};
const u8 gCuccoAggrFx[] = {
FX_EGG,
FX_WOOD2,
FX_EGG,
};
+6 -8
View File
@@ -8,8 +8,6 @@
#include "enemy.h"
#include "functions.h"
extern Entity* sub_08049DF4(u32);
void sub_08022A88(Entity*);
void sub_08022AA4(Entity*);
void sub_08022B0C(Entity*);
@@ -54,8 +52,8 @@ void sub_08022988(Entity* this) {
return;
this->frameIndex = 1;
this->zVelocity = 0x10000;
EnqueueSFX(0xd6);
this->zVelocity = Q_16_16(1.0);
EnqueueSFX(SFX_VO_CHEEP);
}
ProcessMovement(this);
@@ -80,8 +78,8 @@ void sub_080229F8(Entity* this) {
this->speed = 0xc0;
sub_08022B44(this);
} else {
this->zVelocity = 0x10000;
EnqueueSFX(0xd6);
this->zVelocity = Q_16_16(1.0);
EnqueueSFX(SFX_VO_CHEEP);
}
}
}
@@ -143,13 +141,13 @@ u32 sub_08022B20(Entity* this) {
}
void sub_08022B44(Entity* this) {
this->zVelocity = 0xc000;
this->zVelocity = Q_16_16(0.75);
this->direction = GetFacingDirection(this, &gPlayerEntity);
if (this->direction & 0xf)
this->spriteSettings.flipX = (this->direction >> 4) ^ 1;
EnqueueSFX(0xd6);
EnqueueSFX(SFX_VO_CHEEP);
}
// clang-format off
+2 -2
View File
@@ -15,7 +15,7 @@ void sub_080481D0(Entity* this) {
void sub_080481E8(Entity* this) {
if (this->field_0x46) {
this->action = 2;
this->flags &= 0x7f;
this->flags &= ~ENT_COLLIDE;
this->spritePriority.b0 = 7;
this->actionDelay = 3;
} else {
@@ -36,7 +36,7 @@ void sub_08048224(Entity* this) {
this->actionDelay = 0;
} else {
this->action = 3;
this->flags &= 0x7f;
this->flags &= ~ENT_COLLIDE;
this->actionDelay = 1;
}
+8 -8
View File
@@ -97,7 +97,7 @@ void sub_08020BB8(Entity* this) {
}
this->action = 10;
sub_08021218(this, 0xb, this->animationState);
EnqueueSFX(0x15d);
EnqueueSFX(SFX_15D);
sub_08021588(this);
break;
case 0x4c:
@@ -280,7 +280,7 @@ void sub_08021038(Entity* this) {
pEVar2->parent = this;
this->child = pEVar2;
}
EnqueueSFX(270);
EnqueueSFX(SFX_10E);
}
if (this->frame & 0x80) {
@@ -302,7 +302,7 @@ void sub_080210A8(Entity* this) {
if (this->frame & 1) {
this->frame = 0;
sub_08021588(this);
EnqueueSFX(349);
EnqueueSFX(SFX_15D);
} else if (this->frame & 0x80) {
sub_08021390(this);
}
@@ -320,7 +320,7 @@ void sub_080210E4(Entity* this) {
this->child = ent;
}
EnqueueSFX(270);
EnqueueSFX(SFX_10E);
}
sub_08021644(this);
@@ -578,13 +578,13 @@ void sub_0802159C(Entity* this) {
ent->parent = this;
this->child = ent;
}
EnqueueSFX(0x116);
EnqueueSFX(SFX_116);
} else if (this->frame == 2) {
this->frame = 0;
sub_08021588(this);
} else if (this->frame & 0x20) {
this->frame &= ~0x20;
EnqueueSFX(0x115);
EnqueueSFX(SFX_115);
}
}
@@ -599,7 +599,7 @@ void sub_08021600(Entity* this) {
ent->parent = this;
this->child = ent;
}
EnqueueSFX(0x10e);
EnqueueSFX(SFX_10E);
} else if (this->frame == 2) {
this->frame = 0;
sub_08021588(this);
@@ -609,7 +609,7 @@ void sub_08021600(Entity* this) {
void sub_08021644(Entity* this) {
if (this->frame & 0x20) {
this->frame &= ~0x20;
EnqueueSFX(0x7d);
EnqueueSFX(SFX_PLY_LAND);
}
}
+2 -3
View File
@@ -9,7 +9,6 @@
#include "enemy.h"
#include "functions.h"
extern s16 sub_080001DA(u32, u32); // ?
extern void sub_08049CF4(Entity*);
void sub_080221C0(Entity*);
@@ -92,7 +91,7 @@ void sub_080220F0(Entity* this) {
fx->y.HALF.HI += off->v;
}
}
EnqueueSFX(260);
EnqueueSFX(SFX_104);
} else if (this->frame & 1) {
this->damage = 4;
}
@@ -118,7 +117,7 @@ void sub_08022198(Entity* this) {
void sub_080221C0(Entity* this) {
u32 tile = COORD_TO_TILE(this) + gUnk_080B4488[this->type2];
this->field_0x7c.HALF.HI = tile;
this->field_0x7c.HALF.LO = sub_080001DA(tile, this->collisionLayer);
this->field_0x7c.HALF.LO = GetTileIndex(tile, this->collisionLayer);
SetTile(gUnk_080CB79C[this->type2], tile, this->collisionLayer);
}
+16
View File
@@ -0,0 +1,16 @@
#include "entity.h"
void (*const gUnk_080D2ABC[])(Entity*);
extern void sub_08029270(Entity* this);
void Enemy66(Entity* this) {
if (gUnk_080D2ABC[this->field_0xf]) {
gUnk_080D2ABC[this->field_0xf](this);
} else {
DeleteThisEntity();
}
}
void (*const gUnk_080D2ABC[103])(Entity*) = {
[22] = sub_08029270,
};
+4 -6
View File
@@ -37,7 +37,7 @@ void sub_0802C254(Entity* this) {
void sub_0802C258(Entity* this) {
sub_0804A720(this);
this->zVelocity = 0x20000;
this->zVelocity = Q_16_16(2.0);
this->actionDelay = 2;
this->field_0x7a.HWORD = Random() & 0x70;
switch (this->type) {
@@ -80,7 +80,7 @@ NONMATCH("asm/non_matching/fallingBoulder/sub_0802C334.inc", void sub_0802C334(E
GetNextFrame(this);
this->field_0x7c.HALF.HI = COORD_TO_TILE(this);
if (sub_080044EC(this, *(u32*)&this->cutsceneBeh) == 1) {
EnqueueSFX(0x14c);
EnqueueSFX(SFX_14C);
COLLISION_ON(this);
this->field_0x7a.HWORD = 0xc;
sub_0802C4B0(this);
@@ -137,14 +137,12 @@ void nullsub_148(Entity* this) {
/* ... */
}
extern u32 sub_080001DA(u32, u32);
void sub_0802C4B0(Entity* this) {
u32 offset;
u32 index;
u32 rand;
switch (sub_080001DA(this->field_0x7c.HALF_U.HI, this->collisionLayer)) {
switch (GetTileIndex(this->field_0x7c.HALF_U.HI, this->collisionLayer)) {
case 0x1ab ... 0x1af:
offset = 8;
break;
@@ -195,7 +193,7 @@ void sub_0802C4B0(Entity* this) {
}
rand = Random() & 7;
this->zVelocity = 0x20000;
this->zVelocity = Q_16_16(2.0);
if (rand & 4) {
if (rand & 3) {
*(u32*)&this->cutsceneBeh = gUnk_080CD58C[offset | 1];
+1 -1
View File
@@ -102,7 +102,7 @@ u32 sub_0804A024(Entity*, u32, u32);
void sub_08045524(Entity* this) {
u32 tmp, tmp1, tmp2;
this->zVelocity = 0x1c000;
this->zVelocity = Q_16_16(1.75);
tmp = sub_0804A024(this, 1, 8);
if (tmp != 0xff && (Random() & 3) == 0) {
this->actionDelay = Random() & 3;
+4 -5
View File
@@ -21,7 +21,6 @@ void (*const gUnk_080CFBD4[])(FlyingSkullEntity*);
const s8 gUnk_080CFBE4[4];
extern s32 sub_080012DC(Entity*);
extern u32 sub_080001DA(u32, u32);
extern void sub_08078930(Entity*);
void sub_0803A100(FlyingSkullEntity* this);
@@ -46,7 +45,7 @@ void sub_08039BF8(FlyingSkullEntity* this) {
if (super->bitfield == 0x9d) {
super->action = 7;
COLLISION_OFF(super);
super->zVelocity = 0x2A000;
super->zVelocity = Q_16_16(2.625);
super->spritePriority.b1 = 1;
SetTile(this->unk_0x74, COORD_TO_TILE(super), super->collisionLayer);
} else if (super->z.HALF.HI) {
@@ -118,7 +117,7 @@ void sub_08039D74(FlyingSkullEntity* this) {
super->y.HALF.HI += 3;
tmp = COORD_TO_TILE(super);
this->unk_0x74 = sub_080001DA(tmp, super->collisionLayer);
this->unk_0x74 = GetTileIndex(tmp, super->collisionLayer);
SetTile(0x4060, tmp, super->collisionLayer);
InitializeAnimation(super, 0);
}
@@ -136,7 +135,7 @@ void sub_08039DD8(FlyingSkullEntity* this) {
} else {
if ((gPlayerState.flags & 0x80) == 0) {
Entity* ent = &gPlayerEntity;
if (sub_0806FCB8(super, ent->x.HALF.HI, ent->y.HALF.HI, 0x30)) {
if (EntityWithinDistance(super, ent->x.HALF.HI, ent->y.HALF.HI, 0x30)) {
if (super->type == 1) {
super->action = 3;
super->actionDelay = 0x1e;
@@ -246,7 +245,7 @@ void sub_0803A0E0(FlyingSkullEntity* this) {
void sub_0803A100(FlyingSkullEntity* this) {
u32 tile = COORD_TO_TILE(super);
if (sub_080001DA(tile, super->collisionLayer) == 0x4067) {
if (GetTileIndex(tile, super->collisionLayer) == 0x4067) {
SetTile(this->unk_0x74, tile, super->collisionLayer);
DeleteThisEntity();
}
+238 -210
View File
@@ -5,34 +5,48 @@
* @brief Gibdo enemy
*/
#define NENT_DEPRECATED
#include "global.h"
#include "enemy.h"
#include "object.h"
#include "functions.h"
typedef struct {
Entity base;
u8 filler[0xc];
u16 field_0x74;
u8 field_0x76;
u8 field_0x77;
u16 field_0x78;
u16 field_0x7a;
u8 field_0x7c;
u8 field_0x7d;
u8 filler2[2];
Entity* field_0x80;
Entity* field_0x84;
} GibdoEntity;
// Gibudo
void sub_08037794(Entity*);
void sub_08037B10(Entity*);
void sub_0803797C(Entity*);
void sub_080379BC(Entity*);
void sub_08037C0C(Entity*, Entity*);
u32 sub_08037810(Entity*);
void sub_080377B0(Entity*);
u32 sub_080378B0(Entity*);
u32 sub_08037914(Entity*);
u32 sub_080379EC(Entity*);
void sub_08037A58(Entity*);
void sub_08037ACC(Entity*);
void sub_08037B48(Entity*);
void sub_08037A14(Entity*);
void sub_08037794(GibdoEntity*);
void sub_08037B10(GibdoEntity*);
void sub_0803797C(GibdoEntity*);
void sub_080379BC(GibdoEntity*);
void Gibdo_MoveObjectsToStalfos(GibdoEntity*, Entity*);
u32 sub_08037810(GibdoEntity*);
void sub_080377B0(GibdoEntity*);
u32 sub_080378B0(GibdoEntity*);
u32 sub_08037914(GibdoEntity*);
u32 sub_080379EC(GibdoEntity*);
void sub_08037A58(GibdoEntity*);
void sub_08037ACC(GibdoEntity*);
void Gibdo_CreateObjects(GibdoEntity*);
void sub_08037A14(GibdoEntity*);
extern void sub_0804A4E4(Entity*, Entity*);
extern Entity* sub_08049DF4(u32);
u32 sub_0804A044(Entity*, Entity*, u32);
extern void SoundReqClipped(Entity*, u32);
extern void (*const gGibdo[6])(Entity*);
extern void (*const gUnk_080CF2AC[9])(Entity*);
void (*const gGibdo[6])(Entity*);
void (*const gUnk_080CF2AC[9])(GibdoEntity*);
extern Entity* gUnk_020000B0;
void Gibdo(Entity* this) {
@@ -40,35 +54,33 @@ void Gibdo(Entity* this) {
SetChildOffset(this, 0, 1, -0x15);
}
void Gibdo_OnTick(Entity* this) {
gUnk_080CF2AC[this->action](this);
void Gibdo_OnTick(GibdoEntity* this) {
gUnk_080CF2AC[super->action](this);
}
// Non-matching
NONMATCH("asm/non_matching/gibdo/sub_080374A4.inc", void sub_080374A4(Entity* this)) {
void sub_080374A4(GibdoEntity* this) {
u8 x;
if (this->bitfield == 0x87) {
if (this->action == 0x6) {
if (super->bitfield == 0x87) {
if (super->action == 0x6) {
sub_08037ACC(this);
}
this->action = 0x8;
this->actionDelay = 0x3c;
COLLISION_OFF(this);
sub_08037B48(this);
super->action = 0x8;
super->actionDelay = 0x3c;
COLLISION_OFF(super);
Gibdo_CreateObjects(this);
} else {
if (this->action != 0x6) {
if (this->hitType == 0x27) {
if (this->bitfield == 0x80) {
sub_08037A14(this);
}
if (super->action != 0x6) {
if (super->hitType == 0x27 && super->bitfield == 0x80) {
sub_08037A14(this);
} else {
if ((u8)(this->action - 1) < 2) {
this->action = 1;
x = DirectionTurnAround(DirectionRoundUp(this->knockbackDirection));
this->direction = x;
this->animationState = x >> 3;
InitAnimationForceUpdate(this, this->animationState);
if ((u8)(super->action - 1) < 2) {
super->action = 1;
x = DirectionRoundUp(DirectionTurnAround(super->knockbackDirection));
super->direction = x;
super->animationState = x >> 3;
InitAnimationForceUpdate(super, super->animationState);
if (sub_08037810(this) != 0) {
this->actionDelay = 4;
super->actionDelay = 4;
}
}
}
@@ -76,41 +88,40 @@ NONMATCH("asm/non_matching/gibdo/sub_080374A4.inc", void sub_080374A4(Entity* th
sub_08037A58(this);
}
}
if (this->field_0x43 != 0) {
sub_0804A9FC(this, 0x1c);
if (super->field_0x43 != 0) {
sub_0804A9FC(super, 0x1c);
}
sub_0804AA30(this, gGibdo);
}
END_NONMATCH
void nullsub_162(Entity* this) {
sub_0804AA30(super, gGibdo);
}
void sub_08037558(Entity* this) {
sub_0804A720(this);
this->animationState = Random() & 0x3;
this->field_0x76.HALF.LO = 0;
this->field_0x76.HALF.HI = 0;
void nullsub_162(GibdoEntity* this) {
}
void sub_08037558(GibdoEntity* this) {
sub_0804A720(super);
super->animationState = Random() & 0x3;
this->field_0x76 = 0;
this->field_0x77 = 0;
sub_08037794(this);
}
void sub_08037580(Entity* this) {
void sub_08037580(GibdoEntity* this) {
if (sub_08037810(this) == 0) {
if (!(--this->field_0x74.HWORD)) {
if (!(--this->field_0x74)) {
sub_080377B0(this);
}
}
}
void sub_080375A4(Entity* this) {
void sub_080375A4(GibdoEntity* this) {
if (sub_080378B0(this) == 0) {
if (sub_08037810(this) == 0) {
if (!(--this->field_0x74.HWORD)) {
if (!(--this->field_0x74)) {
sub_08037794(this);
} else {
UpdateAnimationSingleFrame(this);
if (ProcessMovement(this) == 0) {
if (!(--this->field_0xf)) {
UpdateAnimationSingleFrame(super);
if (ProcessMovement(super) == 0) {
if (!(--super->field_0xf)) {
sub_080379BC(this);
}
}
@@ -119,30 +130,30 @@ void sub_080375A4(Entity* this) {
}
}
void sub_080375F8(Entity* this) {
void sub_080375F8(GibdoEntity* this) {
if (sub_080378B0(this) == 0) {
if (!(--this->actionDelay)) {
this->action = 4;
this->actionDelay = 0x18;
InitAnimationForceUpdate(this, this->animationState + 4);
if (!(--super->actionDelay)) {
super->action = 4;
super->actionDelay = 0x18;
InitAnimationForceUpdate(super, super->animationState + 4);
}
}
}
void sub_08037624(Entity* this) {
void sub_08037624(GibdoEntity* this) {
if (sub_080378B0(this) == 0) {
if (sub_08037914(this) == 0) {
if (!(--this->field_0x74.HWORD)) {
if (!(--this->field_0x74)) {
sub_08037794(this);
} else {
UpdateAnimationSingleFrame(this);
UpdateAnimationSingleFrame(this);
if (ProcessMovement(this) == 0) {
if (!(--this->field_0xf)) {
UpdateAnimationSingleFrame(super);
UpdateAnimationSingleFrame(super);
if (ProcessMovement(super) == 0) {
if (!(--super->field_0xf)) {
sub_080379BC(this);
}
} else {
if (!(--this->actionDelay)) {
if (!(--super->actionDelay)) {
sub_0803797C(this);
}
}
@@ -151,172 +162,172 @@ void sub_08037624(Entity* this) {
}
}
void sub_08037690(Entity* this) {
UpdateAnimationSingleFrame(this);
if ((this->frame & 0x80) != 0) {
this->field_0x76.HALF.HI = 0x14;
void sub_08037690(GibdoEntity* this) {
UpdateAnimationSingleFrame(super);
if ((super->frame & 0x80) != 0) {
this->field_0x77 = 0x14;
sub_08037794(this);
} else {
if ((this->frame & 1) != 0) {
this->hitType = 0x27;
ProcessMovement(this);
if ((super->frame & 1) != 0) {
super->hitType = 0x27;
ProcessMovement(super);
}
}
}
void sub_080376D0(Entity* this) {
void sub_080376D0(GibdoEntity* this) {
u8* x;
if (sub_080379EC(this) == 0) {
ResetPlayer();
gPlayerState.mobility = gPlayerState.mobility | 0x80;
gPlayerState.field_0xa = gPlayerState.field_0xa | 0x80;
CopyPositionAndSpriteOffset(&gPlayerEntity, this);
UpdateAnimationSingleFrame(this);
if ((this->frame & 0x1) != 0) {
if (--this->field_0x7c.BYTES.byte0 == 0) {
CopyPositionAndSpriteOffset(&gPlayerEntity, super);
UpdateAnimationSingleFrame(super);
if ((super->frame & 0x1) != 0) {
if (--this->field_0x7c == 0) {
sub_08037A58(this);
} else {
this->frame ^= 1;
super->frame ^= 1;
sub_08037B10(this);
}
}
}
}
void sub_0803773C(Entity* this) {
UpdateAnimationSingleFrame(this);
if ((this->frame & 0x80) != 0) {
void sub_0803773C(GibdoEntity* this) {
UpdateAnimationSingleFrame(super);
if ((super->frame & 0x80) != 0) {
sub_08037794(this);
}
}
// Turn into Stalfos
void sub_0803775C(Entity* this) {
void sub_0803775C(GibdoEntity* this) {
Entity* x;
if (!(--this->actionDelay)) {
if (!(--super->actionDelay)) {
x = CreateEnemy(STALFOS, 0);
if (x != 0) {
sub_0804A4E4(this, x);
sub_08037C0C(this, x);
sub_0804A4E4(super, x);
Gibdo_MoveObjectsToStalfos(this, x);
}
DeleteEntity(this);
DeleteEntity(super);
}
}
void sub_08037794(Entity* this) {
this->action = 1;
this->field_0x74.HWORD = 0x1e;
this->hitType = 0x26;
InitAnimationForceUpdate(this, this->animationState);
void sub_08037794(GibdoEntity* this) {
super->action = 1;
this->field_0x74 = 0x1e;
super->hitType = 0x26;
InitAnimationForceUpdate(super, super->animationState);
}
void sub_080377B0(Entity* this) {
void sub_080377B0(GibdoEntity* this) {
u32 r1;
u32 r2;
this->action = 2;
this->field_0xf = 8;
super->action = 2;
super->field_0xf = 8;
r1 = Random();
this->field_0x74.HWORD = (r1 & 0x38) + 0x78;
this->speed = 0x40;
this->field_0x74 = (r1 & 0x38) + 0x78;
super->speed = 0x40;
r2 = Random();
if (!sub_08049FA0(this) && (r2 & 3)) {
this->direction = DirectionRoundUp(sub_08049EE4(this));
if (!sub_08049FA0(super) && (r2 & 3)) {
super->direction = DirectionRoundUp(sub_08049EE4(super));
} else {
this->direction = DirectionRound(r2);
super->direction = DirectionRound(r2);
}
this->animationState = this->direction / 8;
InitAnimationForceUpdate(this, this->animationState + 4);
super->animationState = super->direction / 8;
InitAnimationForceUpdate(super, super->animationState + 4);
}
u32 sub_08037810(Entity* this) {
u32 sub_08037810(GibdoEntity* this) {
u32 x;
u32 y;
if (this->field_0x76.HALF.LO == 0) {
if (sub_08049FDC(this, 1) != 0) {
if (sub_0806FCB8(this, gUnk_020000B0->x.HALF.HI, gUnk_020000B0->y.HALF.HI, 0x40) != 0) {
x = GetFacingDirection(this, gUnk_020000B0);
if (((x - this->direction + 6) & 0x1f) <= 0xc) {
this->action = 3;
this->actionDelay = 0x18;
this->field_0xf = 0x8;
this->speed = 0xc0;
this->direction = DirectionRoundUp(GetFacingDirection(this, gUnk_020000B0));
this->animationState = this->direction >> 3;
this->field_0x74.HWORD = 300;
this->field_0x78.HWORD = gUnk_020000B0->x.HALF.HI;
this->field_0x7a.HWORD = gUnk_020000B0->y.HALF.HI;
InitAnimationForceUpdate(this, this->animationState);
if (this->field_0x76 == 0) {
if (sub_08049FDC(super, 1) != 0) {
if (EntityWithinDistance(super, gUnk_020000B0->x.HALF.HI, gUnk_020000B0->y.HALF.HI, 0x40) != 0) {
x = GetFacingDirection(super, gUnk_020000B0);
if (((x - super->direction + 6) & 0x1f) <= 0xc) {
super->action = 3;
super->actionDelay = 0x18;
super->field_0xf = 0x8;
super->speed = 0xc0;
super->direction = DirectionRoundUp(GetFacingDirection(super, gUnk_020000B0));
super->animationState = super->direction >> 3;
this->field_0x74 = 300;
this->field_0x78 = gUnk_020000B0->x.HALF.HI;
this->field_0x7a = gUnk_020000B0->y.HALF.HI;
InitAnimationForceUpdate(super, super->animationState);
return 1;
}
}
}
} else {
this->field_0x76.HALF.LO--;
this->field_0x76--;
}
return 0;
}
u32 sub_080378B0(Entity* this) {
if (this->field_0x76.HALF.HI == 0) {
u32 sub_080378B0(GibdoEntity* this) {
if (this->field_0x77 == 0) {
if (sub_08049DF4(1) != 0) {
if (sub_0804A044(this, gUnk_020000B0, 0xa) == this->direction)
if (sub_0806FCB8(this, gUnk_020000B0->x.HALF.HI, gUnk_020000B0->y.HALF.HI, 0x18) != 0) {
this->action = 5;
this->speed = 0x100;
InitAnimationForceUpdate(this, this->animationState + 8);
if (sub_0804A044(super, gUnk_020000B0, 0xa) == super->direction)
if (EntityWithinDistance(super, gUnk_020000B0->x.HALF.HI, gUnk_020000B0->y.HALF.HI, 0x18) != 0) {
super->action = 5;
super->speed = 0x100;
InitAnimationForceUpdate(super, super->animationState + 8);
return 1;
}
}
} else {
this->field_0x76.HALF.HI--;
this->field_0x77--;
}
return 0;
}
u32 sub_08037914(Entity* this) {
if (sub_08049FDC(this, 1) != 0) {
if (sub_0806FCB8(gUnk_020000B0, this->field_0x78.HWORD, this->field_0x7a.HWORD, 0x28) == 0) {
this->field_0x78.HWORD = gUnk_020000B0->x.HALF_U.HI;
this->field_0x7a.HWORD = gUnk_020000B0->y.HALF_U.HI;
u32 sub_08037914(GibdoEntity* this) {
if (sub_08049FDC(super, 1) != 0) {
if (EntityWithinDistance(gUnk_020000B0, this->field_0x78, this->field_0x7a, 0x28) == 0) {
this->field_0x78 = gUnk_020000B0->x.HALF_U.HI;
this->field_0x7a = gUnk_020000B0->y.HALF_U.HI;
sub_0803797C(this);
return 0;
}
if (sub_0806FCB8(this, this->field_0x78.HWORD, this->field_0x7a.HWORD, 0x8) == 0) {
if (EntityWithinDistance(super, this->field_0x78, this->field_0x7a, 0x8) == 0) {
return 0;
}
this->field_0x76.HALF.LO = 0x3c;
this->field_0x76 = 0x3c;
}
sub_08037794(this);
return 1;
}
NONMATCH("asm/non_matching/gibdo/sub_0803797C.inc", void sub_0803797C(Entity* this)) {
u32 z;
void sub_0803797C(GibdoEntity* this) {
u32 m;
this->actionDelay = 0x18;
this->field_0xf = 0x8;
z = sub_080045D4(this->x.HALF.HI, this->y.HALF.HI, this->field_0x78.HWORD, this->field_0x7a.HWORD);
m = (z + 4) & 0x18;
this->direction = m;
super->actionDelay = 0x18;
super->field_0xf = 8;
m = super->direction =
(sub_080045D4(super->x.HALF.HI, super->y.HALF.HI, this->field_0x78, this->field_0x7a) + 4) & 0x18;
;
m = m / 8;
if (m != this->animationState) {
this->animationState = m;
InitAnimationForceUpdate(this, m + 4);
if (m != super->animationState) {
super->animationState = m;
InitAnimationForceUpdate(super, m + 4);
}
}
END_NONMATCH
void sub_080379BC(Entity* this) {
void sub_080379BC(GibdoEntity* this) {
u32 r;
this->actionDelay = 0x18;
this->field_0xf = 0x8;
super->actionDelay = 0x18;
super->field_0xf = 0x8;
r = Random();
this->animationState = ((this->animationState + (r & 2)) - 1) & 3;
this->direction = DirectionFromAnimationState(this->animationState);
InitAnimationForceUpdate(this, this->animationState + 4);
super->animationState = ((super->animationState + (r & 2)) - 1) & 3;
super->direction = DirectionFromAnimationState(super->animationState);
InitAnimationForceUpdate(super, super->animationState + 4);
}
u32 sub_080379EC(Entity* this) {
u32 sub_080379EC(GibdoEntity* this) {
if (sub_0807953C() != 0) {
if (!(--this->actionDelay)) {
if (!(--super->actionDelay)) {
sub_08037A58(this);
return 1;
}
@@ -324,96 +335,113 @@ u32 sub_080379EC(Entity* this) {
return 0;
}
void sub_08037A14(Entity* this) {
this->action = 6;
this->actionDelay = 0x18;
this->spritePriority.b0 = (this->spritePriority.b0 & (this->actionDelay - 0x20));
this->spritePriority.b0 |= 3;
this->flags2 &= 0xfe;
this->field_0x7c.BYTES.byte0 = 5;
CopyPosition(this, this->field_0x4c);
InitAnimationForceUpdate(this, this->animationState + 0xc);
}
// Take Damage maybe?
void sub_08037A58(Entity* this) {
sub_08037ACC(this);
this->action = 7;
this->spritePriority.b0 = 4;
if (this->iframes == 0) {
this->iframes = 0xec;
}
this->hitType = 0x26;
this->flags2 |= 1;
this->iframes = 0xf4;
this->knockbackDirection = DirectionFromAnimationState(this->animationState) ^ 0x10;
this->knockbackDuration = 8;
this->field_0x46 = 0x180;
this->field_0x76.HALF.LO = 0x3c;
InitAnimationForceUpdate(this, this->animationState + 0x10);
void sub_08037A14(GibdoEntity* this) {
super->action = 6;
super->actionDelay = 0x18;
super->spritePriority.b0 = (super->spritePriority.b0 & (super->actionDelay - 0x20));
super->spritePriority.b0 |= 3;
super->flags2 &= 0xfe;
this->field_0x7c = 5;
CopyPosition(super, super->field_0x4c);
InitAnimationForceUpdate(super, super->animationState + 0xc);
}
void sub_08037ACC(Entity* this) {
// Take Damage maybe?
void sub_08037A58(GibdoEntity* this) {
sub_08037ACC(this);
super->action = 7;
super->spritePriority.b0 = 4;
if (super->iframes == 0) {
super->iframes = 0xec;
}
super->hitType = 0x26;
super->flags2 |= 1;
super->iframes = 0xf4;
super->knockbackDirection = DirectionFromAnimationState(super->animationState) ^ 0x10;
super->knockbackDuration = 8;
super->field_0x46 = 0x180;
this->field_0x76 = 0x3c;
InitAnimationForceUpdate(super, super->animationState + 0x10);
}
void sub_08037ACC(GibdoEntity* this) {
gPlayerState.flags &= ~PL_DISABLE_ITEMS;
COLLISION_ON(&gPlayerEntity);
gPlayerEntity.iframes = 0x1e;
gPlayerEntity.knockbackDirection = DirectionFromAnimationState(this->animationState);
gPlayerEntity.knockbackDirection = DirectionFromAnimationState(super->animationState);
gPlayerEntity.knockbackDuration = 4;
gPlayerEntity.field_0x46 = 0x180;
}
// Damage player maybe?
void sub_08037B10(Entity* this) {
void sub_08037B10(GibdoEntity* this) {
u32 h;
gPlayerEntity.iframes = 0xc;
h = ModHealth(-8);
SoundReqClipped(&gPlayerEntity, 0x7a);
SoundReqClipped(&gPlayerEntity, SFX_PLY_VO6);
if (h == 0) {
sub_08037A58(this);
this->field_0x76.HALF.LO = 0xf0;
this->field_0x76 = 0xf0;
}
}
void sub_08037B48(Entity* this) {
void Gibdo_CreateObjects(GibdoEntity* this) {
Entity* E;
E = CreateObject(OBJECT_2A, 3, 0);
if (E != 0) {
E->type2 = this->actionDelay;
E->type2 = super->actionDelay;
E->spritePriority.b0 = 3;
E->spriteOffsetX = 0;
E->spriteOffsetY = 0xfc;
E->parent = this;
E->parent = super;
}
*(Entity**)&this->field_0x80.HWORD = E;
this->field_0x80 = E;
E = CreateObject(OBJECT_2A, 3, 0);
if (E != 0) {
E->type2 = this->actionDelay;
E->type2 = super->actionDelay;
E->spritePriority.b0 = 3;
E->spriteOffsetX = 0xfd;
E->spriteOffsetY = 0xf8;
E->parent = this;
E->parent = super;
}
*(Entity**)&this->cutsceneBeh.HWORD = E;
this->field_0x84 = E;
E = CreateObject(OBJECT_2A, 3, 0);
if (E != 0) {
E->type2 = this->actionDelay;
E->type2 = super->actionDelay;
E->spritePriority.b0 = 3;
E->spriteOffsetX = 0x5;
E->spriteOffsetY = 0xf5;
E->parent = this;
E->parent = super;
}
this->child = E;
super->child = E;
}
NONMATCH("asm/non_matching/gibdo/sub_08037C0C.inc", void sub_08037C0C(Entity* this, Entity* that)) {
if (this->field_0x80.HWORD != 0) {
this->actionDelay = 0xf;
this->parent = that;
void Gibdo_MoveObjectsToStalfos(GibdoEntity* this, Entity* that) {
Entity* ent = this->field_0x80;
if (ent != NULL) {
ent->actionDelay = 0xf;
ent->parent = that;
}
if (this->cutsceneBeh.HWORD != 0) {
this->actionDelay = 0xf;
this->parent = that;
ent = this->field_0x84;
if (ent != NULL) {
ent->actionDelay = 0xf;
ent->parent = that;
}
if (this->child != 0) {
this->actionDelay = 0xf;
this->parent = that;
ent = super->child;
if (ent != NULL) {
ent->actionDelay = 0xf;
ent->parent = that;
}
}
END_NONMATCH
void (*const gGibdo[6])(Entity*) = {
(EntityActionPtr)Gibdo_OnTick, (EntityActionPtr)sub_080374A4, sub_08001324, sub_0804A7D4, sub_08001242,
(EntityActionPtr)nullsub_162,
};
void (*const gUnk_080CF2AC[9])(GibdoEntity*) = {
sub_08037558, sub_08037580, sub_080375A4, sub_080375F8, sub_08037624,
sub_08037690, sub_080376D0, sub_0803773C, sub_0803775C,
};
+1254
View File
File diff suppressed because it is too large Load Diff
+3 -3
View File
@@ -20,7 +20,7 @@ void (*const gUnk_080D1E6C[])(GyorgChildEntity*) = {
void GyorgChild(Entity* this) {
if (gRoomTransition.field_0x39 == 0) {
this->flags &= ~0x80;
this->flags &= ~ENT_COLLIDE;
this->health = 0;
this->collisionLayer = 2;
}
@@ -89,7 +89,7 @@ void sub_080486F4(GyorgChildEntity* this) {
s32 r;
InitializeAnimation(super, super->animationState);
super->action = 1;
super->flags |= 0x80;
super->flags |= ENT_COLLIDE;
r = (signed)Random() % 0xB;
super->direction += r;
super->direction -= 5;
@@ -143,7 +143,7 @@ void sub_0804877C(GyorgChildEntity* this) {
void sub_0804882C(GyorgChildEntity* this) {
if (--super->actionDelay == 0) {
super->action = 3;
super->flags |= 0x80;
super->flags |= ENT_COLLIDE;
Random();
super->spriteSettings.draw = 1;
super->spritePriority.b0 = 4;
+4 -4
View File
@@ -125,7 +125,7 @@ void sub_08048B84(GyorgFemaleEyeEntity* this) {
GetNextFrame(super);
if (super->frame & 0x80) {
super->action = 3;
super->flags |= 0x80;
super->flags |= ENT_COLLIDE;
super->hitType = 0x1E;
}
}
@@ -135,11 +135,11 @@ void sub_08048BB0(GyorgFemaleEyeEntity* this) {
if (!((parent->unk_78 >> super->type) & 1)) {
if (parent->base.health != 0) {
super->action = 4;
super->flags &= ~0x80;
super->flags &= ~ENT_COLLIDE;
InitializeAnimation(super, gUnk_080D2030[(super->animationState << 3) + super->type]);
} else {
super->action = 1;
super->flags &= ~0x80;
super->flags &= ~ENT_COLLIDE;
super->spriteSettings.draw = 0;
InitializeAnimation(super, gUnk_080D2010[(super->animationState << 3) + super->type]);
CreateFx(super, 2, 0x40);
@@ -150,7 +150,7 @@ void sub_08048BB0(GyorgFemaleEyeEntity* this) {
super->iframes = 0xF4;
super->hitType = 0x89;
InitializeAnimation(super, (parent->base.animationState >> 6) + 0x14);
SoundReq(0x119);
SoundReq(SFX_ITEM_GLOVES_KNOCKBACK);
}
GetNextFrame(super);
if (super->frame & 0x80) {
+17 -17
View File
@@ -106,7 +106,7 @@ void GyorgMale(GyorgMaleEntity* this) {
}
gUnk_080D1AFC[super->action](this);
if (super->action != 7) {
sub_0805EC9C(this, 0xaa, 0xaa, this->unk_78);
sub_0805EC9C(super, 0xaa, 0xaa, this->unk_78);
}
super->animationState = -(this->unk_78 >> 8);
sub_08048004(this);
@@ -279,7 +279,7 @@ void sub_08046B18(GyorgMaleEntity* this) {
}
void sub_08046B8C(GyorgMaleEntity* this) {
if (sub_0806FCB8(super, this->unk_80, this->unk_82, 4)) {
if (EntityWithinDistance(super, this->unk_80, this->unk_82, 4)) {
super->subAction = 3;
this->unk_76 = super->direction << 8;
this->unk_80 = gRoomControls.origin_x + 0x200;
@@ -309,7 +309,7 @@ void sub_08046C04(GyorgMaleEntity* this) {
}
void sub_08046C88(GyorgMaleEntity* this) {
if (sub_0806FCB8(super, this->unk_80, this->unk_82, 4)) {
if (EntityWithinDistance(super, this->unk_80, this->unk_82, 4)) {
super->subAction = 1;
sub_08048178(this, sub_08048158(this->unk_70));
sub_08047D88(this);
@@ -367,7 +367,7 @@ void sub_08046D98(GyorgMaleEntity* this) {
}
void sub_08046E0C(GyorgMaleEntity* this) {
if (sub_0806FCB8(super, this->unk_80, this->unk_82, 4)) {
if (EntityWithinDistance(super, this->unk_80, this->unk_82, 4)) {
super->subAction = 3;
this->unk_76 = super->direction << 8;
sub_08047D88(this);
@@ -468,7 +468,7 @@ void sub_0804702C(GyorgMaleEntity* this) {
}
}
sub_08047DF0(this, ((0x100 - super->direction) & 0xFF) << 8);
if (sub_0806FCB8(super, this->unk_80, this->unk_82, (super->speed >> 0x10) + 0x10)) {
if (EntityWithinDistance(super, this->unk_80, this->unk_82, (super->speed >> 0x10) + 0x10)) {
super->subAction = 2;
this->unk_76 = super->direction << 8;
super->speed = 0x280;
@@ -628,7 +628,7 @@ void sub_080473F0(GyorgMaleEntity* this) {
}
}
sub_08047DF0(this, ((0x100 - super->direction) & 0xFF) << 8);
if (sub_0806FCB8(super, this->unk_80, this->unk_82, 8)) {
if (EntityWithinDistance(super, this->unk_80, this->unk_82, 8)) {
super->subAction = 2;
this->unk_76 = super->direction << 8;
super->speed = 0x180;
@@ -796,7 +796,7 @@ void sub_080477F0(GyorgMaleEntity* this) {
}
super->direction = sub_080045DA(this->unk_80 - super->x.HALF.HI, this->unk_82 - super->y.HALF.HI);
sub_08047E48(this);
if (!sub_0806FCB8(super, gPlayerEntity.x.HALF.HI, gPlayerEntity.y.HALF.HI, 0x80)) {
if (!EntityWithinDistance(super, gPlayerEntity.x.HALF.HI, gPlayerEntity.y.HALF.HI, 0x80)) {
super->action = 2;
super->subAction = 0;
super->spriteOrientation.flipY = 2;
@@ -804,11 +804,11 @@ void sub_080477F0(GyorgMaleEntity* this) {
super->direction = super->animationState;
return;
}
if (!sub_0806FCB8(super, gRoomControls.origin_x + 0x200, gRoomControls.origin_y + 0x210, 0x100)) {
if (!EntityWithinDistance(super, gRoomControls.origin_x + 0x200, gRoomControls.origin_y + 0x210, 0x100)) {
super->spriteOrientation.flipY = 3;
super->spriteRendering.b3 = 3;
}
if (sub_0806FCB8(super, this->unk_80, this->unk_82, 4)) {
if (EntityWithinDistance(super, this->unk_80, this->unk_82, 4)) {
super->subAction = 2;
this->unk_76 = super->animationState << 8;
this->unk_74 = gUnk_080D1BF0[Random() & 1];
@@ -861,7 +861,7 @@ void sub_08047978(GyorgMaleEntity* this) {
tmp->parent = super;
}
}
if (!sub_0806FCB8(super, gPlayerEntity.x.HALF.HI, gPlayerEntity.y.HALF.HI, 0x80)) {
if (!EntityWithinDistance(super, gPlayerEntity.x.HALF.HI, gPlayerEntity.y.HALF.HI, 0x80)) {
super->action = 2;
super->subAction = 0;
super->spriteOrientation.flipY = 2;
@@ -902,7 +902,7 @@ void sub_08047B08(GyorgMaleEntity* this) {
super->direction = sub_080045DA(this->unk_80 - super->x.HALF.HI, this->unk_82 - super->y.HALF.HI);
super->speed = 0x200;
sub_08047E58(this);
if (!sub_0806FCB8(super, this->unk_80, this->unk_82, 4))
if (!EntityWithinDistance(super, this->unk_80, this->unk_82, 4))
return;
if (super->type == 0) {
super->action = 7;
@@ -986,7 +986,7 @@ void sub_08047BF0(GyorgMaleEntity* this) {
}
}
}
sub_0805EC9C(this, 0xAA, 0xAA, this->unk_78);
sub_0805EC9C(super, 0xAA, 0xAA, this->unk_78);
}
void sub_08047D24(GyorgMaleEntity* this) {
@@ -1005,7 +1005,7 @@ void sub_08047D24(GyorgMaleEntity* this) {
} else {
sub_08047E58(this);
}
sub_0805EC9C(this, this->unk_7e, this->unk_7e, this->unk_78);
sub_0805EC9C(super, this->unk_7e, this->unk_7e, this->unk_78);
}
}
@@ -1019,7 +1019,7 @@ void sub_08047D88(GyorgMaleEntity* this) {
return;
if (super->animIndex == 1)
return;
if (!sub_0806FCB8(super, gPlayerEntity.x.HALF.HI, gPlayerEntity.y.HALF.HI, 0x20))
if (!EntityWithinDistance(super, gPlayerEntity.x.HALF.HI, gPlayerEntity.y.HALF.HI, 0x20))
return;
gPlayerState.field_0x14 = 1;
if (gPlayerEntity.z.HALF.HI != 0)
@@ -1033,7 +1033,7 @@ void sub_08047DF0(GyorgMaleEntity* this, u32 unk1) {
sub_08047EA4(this, unk1);
oldX = super->x.HALF.HI;
oldY = super->y.HALF.HI;
sub_0806F62C(super, super->speed, super->direction);
LinearMoveAngle(super, super->speed, super->direction);
if (this->unk_7c & 1) {
if (sub_08079F8C()) {
gPlayerEntity.x.HALF.HI += super->x.HALF.HI - oldX;
@@ -1051,7 +1051,7 @@ void sub_08047E58(GyorgMaleEntity* this) {
u32 oldX, oldY;
oldX = super->x.HALF.HI;
oldY = super->y.HALF.HI;
sub_0806F62C(super, super->speed, super->direction);
LinearMoveAngle(super, super->speed, super->direction);
if (this->unk_7c & 1) {
if (sub_08079F8C()) {
gPlayerEntity.x.HALF.HI += super->x.HALF.HI - oldX;
@@ -1149,7 +1149,7 @@ void sub_08048004(GyorgMaleEntity* this) {
} else {
u32 b = super->spriteRendering.b3;
if (b != 3) {
if (sub_0806FCB8(&gPlayerEntity, super->x.HALF.HI, super->y.HALF.HI, 0x24)) {
if (EntityWithinDistance(&gPlayerEntity, super->x.HALF.HI, super->y.HALF.HI, 0x24)) {
if (!(this->unk_7c & 2)) {
u32 tmp = sub_080045DA(gPlayerEntity.x.HALF.HI - super->x.HALF.HI,
gPlayerEntity.y.HALF.HI - super->y.HALF.HI);
+6 -6
View File
@@ -95,7 +95,7 @@ void sub_0802BCA8(Entity* this) {
this->action = 7;
this->actionDelay = 0x5a;
this->zVelocity = 0x18000;
this->zVelocity = Q_16_16(1.5);
this->hitType = 0x19;
this->field_0x3a = this->field_0x3a & 0xfb;
this->field_0x1c = 0x12;
@@ -222,7 +222,7 @@ void sub_0802BEBC(Entity* this) {
this->direction ^= 0x10;
sub_080AEFE0(this);
this->direction ^= 0x10;
if (!sub_080044EC(this, 0x2000)) {
if (!sub_080044EC(this, Q_16_16(0.125))) {
sub_0802C1C0(this);
}
}
@@ -234,7 +234,7 @@ void sub_0802BEEC(Entity* this) {
this->direction = this->animationState << 3;
InitializeAnimation(this, this->animationState + 4);
}
} else if (!GravityUpdate(this, 0x1c00)) {
} else if (!GravityUpdate(this, Q_16_16(0.109375))) {
this->action = 8;
this->actionDelay = 30;
this->speed = 0x120;
@@ -356,7 +356,7 @@ void sub_0802C18C(Entity* this) {
if ((this->field_0x78.HALF.LO & 7) == 0) {
Entity* ent = CreateObject(SPECIAL_FX, 0x11, 0x40);
if (ent) {
PositionRelative(this, ent, 0, 0x10000);
PositionRelative(this, ent, 0, Q_16_16(1.0));
}
}
}
@@ -374,8 +374,8 @@ void sub_0802C1CC(Entity* this) {
void sub_0802C218(Entity* this) {
this->action = 6;
this->speed = 0xe0;
this->zVelocity = 0x18000;
this->speed = Q_8_8(0.875);
this->zVelocity = Q_16_16(1.5);
}
// clang-format off
+1 -1
View File
@@ -229,7 +229,7 @@ void sub_08032794(Entity* this) {
target = CreateFx(this, FX_DASH, 0x40);
if (target != NULL) {
temp = &gUnk_080CE810[this->animationState * 2];
PositionRelative(this, target, temp[0] << 0x10, temp[1] << 0x10);
PositionRelative(this, target, Q_16_16(temp[0]), Q_16_16(temp[1]));
}
}
+2 -2
View File
@@ -98,7 +98,7 @@ void Keese_Sleep(Entity* this) {
if (this->actionDelay != 0) {
this->actionDelay--;
} else {
if (sub_0806FCB8(this, gPlayerEntity.x.HALF.HI, gPlayerEntity.y.HALF.HI, 0x70))
if (EntityWithinDistance(this, gPlayerEntity.x.HALF.HI, gPlayerEntity.y.HALF.HI, 0x70))
Keese_StartFly(this);
}
}
@@ -116,7 +116,7 @@ void sub_08021F24(Entity* this) {
this->actionDelay = gKeeseRestDurations[Random() & 0xf];
InitializeAnimation(this, KeeseAnimation_Rest);
} else if (!this->field_0x7a.HWORD &&
!(sub_0806FCB8(this, gPlayerEntity.x.HALF.HI, gPlayerEntity.y.HALF.HI, 0x70))) {
!(EntityWithinDistance(this, gPlayerEntity.x.HALF.HI, gPlayerEntity.y.HALF.HI, 0x70))) {
this->action = 3;
this->actionDelay = 30;
InitializeAnimation(this, KeeseAnimation_Rest);
+17 -15
View File
@@ -59,7 +59,7 @@ void Lakitu_DoAction(Entity* this) {
void sub_0803C784(Entity* this) {
if ((this->bitfield & 0x7f) == 0x1d) {
this->zVelocity = 0x20000;
this->zVelocity = Q_16_16(2.0);
sub_0803CBAC(this);
} else {
@@ -242,7 +242,7 @@ void Lakitu_Cloudless(Entity* this) {
}
bool32 sub_0803CA4C(Entity* this) {
if (sub_0806FCB8(this, gPlayerEntity.x.HALF.HI, gPlayerEntity.y.HALF.HI, 0x28) == 0) {
if (EntityWithinDistance(this, gPlayerEntity.x.HALF.HI, gPlayerEntity.y.HALF.HI, 0x28) == 0) {
if (EntityInRectRadius(this, &gPlayerEntity, 0x70, 0x50)) {
return 1;
}
@@ -267,7 +267,7 @@ void sub_0803CA84(Entity* this, u32 unkParameter) {
}
void sub_0803CAD0(Entity* this) {
if (sub_0806FCB8(this, this->field_0x74.HWORD, this->field_0x76.HWORD, 1) == 0) {
if (EntityWithinDistance(this, this->field_0x74.HWORD, this->field_0x76.HWORD, 1) == 0) {
this->direction =
sub_080045D4(this->x.HALF.HI, this->y.HALF.HI, this->field_0x74.HWORD, this->field_0x76.HWORD);
@@ -316,9 +316,9 @@ void Lakitu_SpawnLightning(Entity* this) {
lightning->direction = this->field_0x78.HALF.LO;
PositionRelative(this, lightning, offset->x << 16, offset->y << 16);
PositionRelative(this, lightning, Q_16_16(offset->x), Q_16_16(offset->y));
EnqueueSFX(0x193);
EnqueueSFX(SFX_193);
}
void sub_0803CBAC(Entity* this) {
@@ -326,7 +326,7 @@ void sub_0803CBAC(Entity* this) {
cloud = this->child;
if (cloud != NULL) {
cloud->flags |= 0x80;
cloud->flags |= ENT_COLLIDE;
cloud->hitType = 0x43;
}
@@ -346,6 +346,8 @@ void sub_0803CC08(Entity* this) {
Entity* cloud;
Entity* fx;
const s32 diff = Q_8_8(3.0 / 128.0);
cloud = this->child;
if (cloud == NULL) {
return;
@@ -359,32 +361,32 @@ void sub_0803CC08(Entity* this) {
return;
}
if (!sub_0806FCB8(this, cloud->x.HALF.HI, cloud->y.HALF.HI, 6)) {
if (!EntityWithinDistance(this, cloud->x.HALF.HI, cloud->y.HALF.HI, 6)) {
return;
}
fx = CreateFx(this, FX_DEATH, 0);
if (fx != NULL) {
fx->x.HALF.HI += 6;
fx->y.HALF.HI += 6;
fx->x.HALF.HI += diff;
fx->y.HALF.HI += diff;
}
fx = CreateFx(this, FX_DEATH, 0);
if (fx != NULL) {
fx->x.HALF.HI -= 6;
fx->y.HALF.HI += 6;
fx->x.HALF.HI -= diff;
fx->y.HALF.HI += diff;
}
fx = CreateFx(this, FX_DEATH, 0);
if (fx != NULL) {
fx->x.HALF.HI += 6;
fx->y.HALF.HI -= 6;
fx->x.HALF.HI += diff;
fx->y.HALF.HI -= diff;
}
fx = CreateFx(this, FX_DEATH, 0);
if (fx != NULL) {
fx->x.HALF.HI -= 6;
fx->y.HALF.HI -= 6;
fx->x.HALF.HI -= diff;
fx->y.HALF.HI -= diff;
}
this->child = NULL;
+1 -1
View File
@@ -64,7 +64,7 @@ void sub_0803CD40(Entity* this) {
ModHealth(-2);
SoundReqClipped(&gPlayerEntity, 122);
SoundReqClipped(&gPlayerEntity, SFX_PLY_VO6);
sub_08079D84();
sub_0803CE3C(this);
+4 -4
View File
@@ -193,7 +193,7 @@ void sub_0802805C(Entity* this) {
} else {
ResetPlayer();
gPlayerState.mobility |= 0x80;
PositionRelative(this, &gPlayerEntity, 0, 0x10000);
PositionRelative(this, &gPlayerEntity, 0, Q_16_16(1.0));
tmp = GetSpriteSubEntryOffsetDataPointer((u16)this->spriteIndex, this->frameIndex);
gPlayerEntity.spriteOffsetX = tmp[0];
@@ -205,7 +205,7 @@ void sub_0802805C(Entity* this) {
}
if ((this->actionDelay & 3) == 0) {
EnqueueSFX(0x104);
EnqueueSFX(SFX_104);
}
}
}
@@ -214,8 +214,8 @@ NONMATCH("asm/non_matching/likeLike/sub_0802810C.inc", void sub_0802810C(Entity*
gPlayerState.jump_status = 0x41;
gPlayerState.field_0xa = 0;
gPlayerState.flags &= 0xffffffef;
gPlayerEntity.flags |= 0x80;
gPlayerEntity.zVelocity = 0x18000;
gPlayerEntity.flags |= ENT_COLLIDE;
gPlayerEntity.zVelocity = Q_16_16(1.5);
gPlayerEntity.iframes = -60;
gPlayerEntity.direction = gPlayerEntity.animationState << 2;
gPlayerEntity.spritePriority.b1 = this->field_0x82.HALF.HI;
+9 -9
View File
@@ -61,7 +61,7 @@ void sub_080298A4(Entity* this) {
this->hitType = 0x6b;
this->field_0x76.HALF.HI = 0;
ChangeObjPalette(this, 0x7f);
EnqueueSFX(0xfe);
EnqueueSFX(SFX_HIT);
this->child->action = 2;
break;
}
@@ -145,7 +145,7 @@ void sub_08029AA4(Entity* this) {
this->field_0x7a.HWORD = 0x168;
this->field_0x74.HALF.HI = 4;
sub_08029EEC(this);
EnqueueSFX(0x19d);
EnqueueSFX(SFX_19D);
}
}
@@ -159,7 +159,7 @@ void sub_08029AE0(Entity* this) {
this->field_0x74.HALF.HI = 0;
sub_08029EEC(this);
ChangeObjPalette(this, 0x77);
EnqueueSFX(0x182);
EnqueueSFX(SFX_182);
}
}
@@ -221,7 +221,7 @@ void sub_08029C2C(Entity* this) {
if (--this->actionDelay == 0) {
this->action = 4;
ChangeObjPalette(this, 0x7f);
EnqueueSFX(0x6c);
EnqueueSFX(SFX_MENU_CANCEL);
}
}
@@ -275,7 +275,7 @@ void sub_08029D14(Entity* this) {
if (--this->actionDelay == 0) {
InitializeAnimation(this, this->animationState + 0xc);
ChangeObjPalette(this, 0x7f);
EnqueueSFX(0x6c);
EnqueueSFX(SFX_MENU_CANCEL);
}
} else {
GetNextFrame(this);
@@ -284,7 +284,7 @@ void sub_08029D14(Entity* this) {
this->actionDelay = 0x78;
this->hitType = 0x6c;
this->hitbox = &gUnk_080FD298;
EnqueueSFX(0x6b);
EnqueueSFX(SFX_6B);
}
}
}
@@ -454,7 +454,7 @@ void sub_0802A098(Entity* this) {
if (sub_08029F48(this)) {
sub_08029E0C(this);
sub_08029EEC(this);
EnqueueSFX(0x104);
EnqueueSFX(SFX_104);
}
sub_08029FB4(this, this->x.HALF.HI - uVar1, this->y.HALF.HI - uVar2);
@@ -471,7 +471,7 @@ void sub_0802A0F8(Entity* this) {
}
}
} else {
this->parent->flags &= ~0x80;
this->parent->flags &= ~ENT_COLLIDE;
this->parent->health = 0;
this->parent->field_0xf = 0x69;
}
@@ -505,7 +505,7 @@ void sub_0802A18C(Entity* this) {
case 0x1e:
break;
default:
EnqueueSFX(0x12e);
EnqueueSFX(SFX_12E);
break;
}
}
+18 -18
View File
@@ -189,7 +189,7 @@ void sub_0803A274(Entity* this) {
pEVar1 = CreateObject(OBJECT_7E, 1, 0);
pEVar1->parent = this;
pEVar1->child = this->child;
PositionRelative(this->parent, this, 0x100000, 0x200000);
PositionRelative(this->parent, this, Q_16_16(16.0), Q_16_16(32.0));
} else {
pEVar1 = CreateEnemy(MAZAAL_HAND, 1);
pEVar1->parent = this;
@@ -201,7 +201,7 @@ void sub_0803A274(Entity* this) {
pEVar1->parent = this;
pEVar1->child = this->child;
this->spriteSettings.flipX = 1;
PositionRelative(this->parent, this, -0x100000, 0x200000);
PositionRelative(this->parent, this, Q_16_16(-16.0), Q_16_16(32.0));
}
if (gRoomTransition.field_0x38 != 0) {
this->action = 3;
@@ -590,8 +590,7 @@ void sub_0803AA00(Entity* this) {
}
}
}
NONMATCH("asm/non_matching/mazaal/sub_0803AA98.inc", void sub_0803AA98(Entity* this)) {
void sub_0803AA98(Entity* this) {
Entity* temp;
s8* ptr;
u32 index;
@@ -605,7 +604,8 @@ NONMATCH("asm/non_matching/mazaal/sub_0803AA98.inc", void sub_0803AA98(Entity* t
this->action = 0x14;
this->speed = 0x40;
InitializeAnimation(this, 10);
(*(Entity**)&this->field_0x74)->flags |= 0x80;
temp = (*(Entity**)&this->field_0x74);
temp->flags |= ENT_COLLIDE;
temp = this->child;
temp->hitType = 0x13;
InitAnimationForceUpdate(temp, 5);
@@ -613,7 +613,6 @@ NONMATCH("asm/non_matching/mazaal/sub_0803AA98.inc", void sub_0803AA98(Entity* t
}
}
}
END_NONMATCH
void sub_0803AB10(Entity* this) {
s8* ptr;
@@ -755,7 +754,7 @@ void sub_0803ADAC(Entity* this) {
if (--this->actionDelay == 0) {
this->action = 0x16;
this->spriteSettings.draw = 1;
(*(Entity**)&this->field_0x74)->flags |= 0x80;
(*(Entity**)&this->field_0x74)->flags |= ENT_COLLIDE;
InitializeAnimation(this, 0xb);
InitAnimationForceUpdate(this->child, 6);
sub_0803B798();
@@ -918,7 +917,7 @@ void sub_0803B100(Entity* this) {
Entity* temp;
this->action = 0x29;
this->zVelocity = 0x14000;
this->zVelocity = Q_16_16(1.25);
if (this->type == 0) {
this->hitbox = &gUnk_080FD364;
} else {
@@ -975,7 +974,7 @@ void sub_0803B1B8(Entity* this) {
if (temp != (Entity*)0x0) {
temp->actionDelay = 0;
temp->direction = 0x90;
PositionRelative(this, temp, this->hitbox->offset_x << 0x10, this->hitbox->offset_y << 0x10);
PositionRelative(this, temp, Q_16_16(this->hitbox->offset_x), Q_16_16(this->hitbox->offset_y));
}
temp = *(Entity**)&this->field_0x74;
temp->field_0x74.HALF.LO = 0x40;
@@ -1087,7 +1086,7 @@ void sub_0803B480(Entity* this) {
Entity* target;
if (((this->field_0x7c.HALF.HI & 0x1f) == 0) && (target = CreateObject(SMOKE, 1, 0), target != (Entity*)0x0)) {
PositionRelative(this, target, gUnk_080CFD08[this->type] << 0x10, 0);
PositionRelative(this, target, Q_16_16(gUnk_080CFD08[this->type]), 0);
}
if (--this->field_0x7c.HALF.HI == 0) {
sub_0803B6A4(this);
@@ -1105,7 +1104,7 @@ u32 sub_0803B4E4(Entity* this) {
xoff = this->parent->x.HALF.HI + gUnk_080CFD0A[this->type];
yoff = this->parent->y.HALF.HI + 0x10;
if (sub_0806FCB8(this, xoff, yoff, 2)) {
if (EntityWithinDistance(this, xoff, yoff, 2)) {
this->x.HALF.HI = xoff;
this->y.HALF.HI = yoff;
return 1;
@@ -1116,8 +1115,8 @@ u32 sub_0803B4E4(Entity* this) {
}
void sub_0803B538(Entity* this) {
PositionRelative(this, this->child, 0, -0x10000);
PositionRelative(this, *(Entity**)&this->field_0x74, 0, -0x20000);
PositionRelative(this, this->child, 0, Q_16_16(-1.0));
PositionRelative(this, *(Entity**)&this->field_0x74, 0, Q_16_16(-2.0));
}
void sub_0803B55C(Entity* this) {
@@ -1165,7 +1164,8 @@ void sub_0803B5C0(Entity* this) {
}
u32 sub_0803B610(Entity* this) {
return sub_0806FCB8(this, gPlayerEntity.x.HALF.HI + gUnk_080CFD19[this->type], gPlayerEntity.y.HALF.HI - 0xc, 8);
return EntityWithinDistance(this, gPlayerEntity.x.HALF.HI + gUnk_080CFD19[this->type],
gPlayerEntity.y.HALF.HI - 0xc, 8);
}
// sub_0803B698 was the tail of this function
@@ -1230,8 +1230,8 @@ void sub_0803B798(void) {
gPlayerState.jump_status = 0x41;
gPlayerState.field_0xa = 0;
gPlayerState.flags &= ~(0xffff0000 | PL_CAPTURED);
gPlayerEntity.flags |= 0x80;
gPlayerEntity.zVelocity = 0x18000;
gPlayerEntity.flags |= ENT_COLLIDE;
gPlayerEntity.zVelocity = Q_16_16(1.5);
gPlayerEntity.z.HALF.HI = -10;
gPlayerEntity.direction = 0x10;
gPlayerEntity.animationState = 4;
@@ -1244,7 +1244,7 @@ void sub_0803B798(void) {
void sub_0803B804(Entity* this) {
gPlayerEntity.iframes = 30;
ModHealth(-4);
SoundReqClipped(&gPlayerEntity, 0x7a);
SoundReqClipped(&gPlayerEntity, SFX_PLY_VO6);
}
void sub_0803B824(Entity* this) {
@@ -1263,7 +1263,7 @@ u32 sub_0803B870(Entity* this) {
this->action = 0x18;
this->actionDelay = 0x44;
this->spriteSettings.draw = 0;
gPlayerEntity.flags = gPlayerEntity.flags & 0x7f;
gPlayerEntity.flags &= ~ENT_COLLIDE;
gPlayerEntity.iframes = -0x10;
sub_0803B824(this);
entity->hitType = 0x13;
+4 -4
View File
@@ -221,7 +221,7 @@ void sub_08033FFC(Entity* this) {
}
break;
default:
if (((*(Entity**)&this->field_0x74)->flags & 0x80) != 0) {
if (((*(Entity**)&this->field_0x74)->flags & ENT_COLLIDE) != 0) {
gRoomControls.camera_target = &gPlayerEntity;
sub_08034420(this);
gPlayerState.controlMode = 1;
@@ -659,7 +659,7 @@ u32 sub_080348A4(Entity* this, Entity* hand_, u32 unk) {
break;
case 7:
hand_->action = 0x1b;
hand_->flags = hand_->flags & 0x7f;
hand_->flags = hand_->flags & ~ENT_COLLIDE;
InitializeAnimation(hand_, 5);
break;
case 8:
@@ -741,7 +741,7 @@ void sub_08034A84(Entity* this) {
}
void sub_08034AC4(Entity* this) {
PositionRelative(this->parent, this, 0, 0x10000);
PositionRelative(this->parent, this, 0, Q_16_16(1.0));
gUnk_080CED74[this->action](this);
}
@@ -782,7 +782,7 @@ void sub_08034B38(Entity* this) {
target->direction = this->actionDelay + 0x58;
}
ptr = &gUnk_080CED84[target->type * 2];
PositionRelative(this, target, *(ptr++) << 0x10, *ptr << 0x10);
PositionRelative(this, target, Q_16_16(*(ptr++)), Q_16_16(*ptr));
}
}
}
+1 -1
View File
@@ -57,7 +57,7 @@ void sub_08045654(Entity* this) {
void sub_08045678(Entity* this) {
this->zVelocity = 0x1c000;
this->zVelocity = Q_16_16(1.75);
if (this->actionDelay != 0) {
this->actionDelay--;
} else {
+4 -4
View File
@@ -85,9 +85,9 @@ void sub_080230E4(Entity* this) {
if (this->health == 0 && this->field_0x7c.BYTES.byte3 == 0 && this->action == 7) {
CopyPosition(this, &gPlayerEntity);
gPlayerEntity.flags = gPlayerEntity.flags | 0x80;
gPlayerEntity.flags |= ENT_COLLIDE;
gPlayerEntity.spriteSettings.draw = 1;
gPlayerEntity.zVelocity = 0x18000;
gPlayerEntity.zVelocity = Q_16_16(1.5);
gPlayerEntity.direction = 0xff;
gPlayerEntity.iframes = -0x14;
gPlayerState.jump_status = 0x41;
@@ -270,7 +270,7 @@ void sub_0802351C(Entity* this) {
if (this->type2 == 0) {
gPlayerEntity.animationState = this->animationState & 7;
gPlayerState.flags |= PL_MOLDWORM_CAPTURED;
PositionRelative(this, &gPlayerEntity, 0, gUnk_080CBC90[this->animationState & 7] << 0x10);
PositionRelative(this, &gPlayerEntity, 0, Q_16_16(gUnk_080CBC90[this->animationState & 7]));
gPlayerEntity.spriteOffsetY = -gUnk_080CBC90[this->animationState & 7];
}
} else {
@@ -411,7 +411,7 @@ void sub_08023894(Entity* this) {
gPlayerEntity.animationState = gPlayerEntity.direction >> 2;
gPlayerEntity.iframes = 12;
ModHealth(-0x10);
SoundReqClipped(&gPlayerEntity, 0x7a);
SoundReqClipped(&gPlayerEntity, SFX_PLY_VO6);
}
}
}
+1 -3
View File
@@ -8,8 +8,6 @@
#include "enemy.h"
#include "functions.h"
extern Entity* sub_08049DF4(u32);
void Octorok_Pause(Entity*);
bool32 Octorok_FacesPlayer(Entity*);
void Octorok_Turn(Entity*);
@@ -139,7 +137,7 @@ void Octorok_ShootNut(Entity* this) {
ent->y.HALF.HI += off[1];
ent->z.HALF.HI = -3;
this->frame &= 0xfe;
EnqueueSFX(0x18d);
EnqueueSFX(SFX_18D);
}
}
+8 -9
View File
@@ -13,7 +13,6 @@
extern void sub_08078AC0(u32, u32, u32);
extern u32 GetRandomByWeight(const u8*);
extern u32 sub_0806FC80(Entity*, Entity*, s32);
extern void sub_080792BC(s32, u32, u32);
enum OctorokRotation { ROTATION_CW, ROTATION_CCW, NO_ROTATION = 0xff };
@@ -618,7 +617,7 @@ void OctorokBoss_Action1(Entity* this) {
this->field_0x74.HWORD += 4;
}
}
ResolveEntityBelow(this->parent, this);
SortEntityBelow(this->parent, this);
if (((GET_HELPER(this)->field_0x2 != 0) || (this->parent->action == INTRO)) ||
(1 < (u8)(this->parent->subAction - 3))) {
if ((s8)this->field_0xf < 0) {
@@ -650,9 +649,9 @@ void OctorokBoss_Action1(Entity* this) {
if ((GET_HELPER(this)->tailCount - 2) < this->type2) {
DeleteThisEntity();
}
ResolveEntityOnTop(this->parent, this);
SortEntityAbove(this->parent, this);
if (GET_HELPER(this)->tailCount - 2 == this->type2) {
ResolveEntityOnTop(this->parent, this);
SortEntityAbove(this->parent, this);
radius = 0x10000 / this->parent->field_0x74.HWORD;
radius = radius << 0xd >> 0x8;
angle = -this->parent->field_0x7a.HALF.HI;
@@ -694,7 +693,7 @@ void OctorokBoss_Action1(Entity* this) {
if (this->health == 1) {
this->health = 0;
} else {
ResolveEntityBelow(this->parent, this);
SortEntityBelow(this->parent, this);
if ((this->parent->subAction != 4) && (this->health != 1)) {
if (GET_TIMER(this) > 0x1c) {
GET_TIMER(this)--;
@@ -833,7 +832,7 @@ void OctorokBoss_Action1_Attack(Entity* this) {
if (this->field_0x80.HALF.LO != 0) {
gPlayerEntity.spriteSettings.draw = 0;
gPlayerEntity.flags &= 0x7f;
gPlayerEntity.flags &= ~ENT_COLLIDE;
gPlayerEntity.collisionLayer = 2;
sub_08078B48();
sub_08077B20();
@@ -940,7 +939,7 @@ void OctorokBoss_ExecuteAttackVacuum(Entity* this) {
if (sub_0806FC80(this, &gPlayerEntity, 0xf0) != 0) {
if ((gPlayerState.flags & PL_FROZEN) == 0) {
if ((gPlayerEntity.flags & PL_MINISH) != 0) {
sub_0806F62C(&gPlayerEntity, 0x280, -GET_ANGLE_HI(this));
LinearMoveAngle(&gPlayerEntity, 0x280, -GET_ANGLE_HI(this));
if (sub_0806FC80(this, &gPlayerEntity, 0x48) != 0) {
this->field_0x80.HALF.LO = 1;
GET_TIMER(this) = 2;
@@ -973,7 +972,7 @@ void OctorokBoss_ExecuteAttackVacuum(Entity* this) {
GET_ANGULAR_VEL(this) = 0x100;
GET_HELPER(this)->mouthObject->field_0x78.HALF.HI++;
gPlayerEntity.spriteSettings.draw = 1;
gPlayerEntity.flags &= 0x7f;
gPlayerEntity.flags &= ~ENT_COLLIDE;
gPlayerEntity.collisionLayer = 1;
sub_080792BC(0x400, (u32)(-(GET_ANGLE_HI(this) + 0x80) * 0x1000000) >> 0x1b, 0x30);
OctorokBoss_SetAttackTimer(this);
@@ -1113,7 +1112,7 @@ void OctorokBoss_Burning_SubAction2(Entity* this) {
void sub_080368D8(Entity* this) {
if (this->field_0x80.HALF.LO != 0) {
gPlayerEntity.spriteSettings.draw = 1;
gPlayerEntity.flags |= 0x80;
gPlayerEntity.flags |= ENT_COLLIDE;
gPlayerEntity.collisionLayer = 1;
}
this->field_0x76.HWORD = 0xa0;
+2 -2
View File
@@ -265,7 +265,7 @@ void Peahat_RepairPropeller(Entity* this) {
return;
this->action = 9;
this->zVelocity = 0x18000;
this->zVelocity = Q_16_16(1.5);
this->direction = Random() & 0x1f;
sub_0804AA1C(this);
this->animationState = PeahatAnimation_RepairPropeller;
@@ -291,7 +291,7 @@ void Peahat_Hop(Entity* this) {
if (--this->actionDelay == 0) {
if (this->frame & 0x80) {
this->action = 9;
this->zVelocity = 0x18000;
this->zVelocity = Q_16_16(1.5);
this->animationState = PeahatAnimation_NewPropeller;
InitializeAnimation(this, this->animationState);
} else {
+5 -11
View File
@@ -11,12 +11,6 @@
#include "functions.h"
#include "save.h"
extern u32 sub_080002E0(u16, u32);
extern void SoundReqClipped(Entity*, u32);
extern u32 sub_08049F1C(Entity*, Entity*, u32);
extern u32 PlayerInRange(Entity*, u32, u32);
extern void sub_080AEFB4(Entity*);
void sub_080249F4(Entity*);
void sub_08024940(Entity*);
void sub_080249DC(Entity*);
@@ -188,7 +182,7 @@ void sub_080241C0(Entity* this) {
switch (this->field_0x80.HALF.LO) {
case 0:
if (PlayerInRange(this, 3, (gPlayerState.hurtBlinkSpeed != 0) ? 0xa0 : 0x40) && sub_08049FDC(this, 3) &&
gPlayerEntity.action != 0x1e) {
gPlayerEntity.action != PLAYER_USEENTRANCE) {
this->field_0x80.HALF.LO++;
this->speed = 0;
sub_08024A14(this, 3, 10);
@@ -398,7 +392,7 @@ void sub_080244E8(Entity* this) {
this->flags2 &= 0xfc;
sub_080249DC(this);
this->cutsceneBeh.HALF.HI = gPlayerEntity.spritePriority.b1;
gPlayerEntity.flags &= 0x7f;
gPlayerEntity.flags &= ~ENT_COLLIDE;
gPlayerState.flags |= PL_DISABLE_ITEMS;
gPlayerState.field_0xa |= 0x80;
if (gPlayerState.swim_state != 0) {
@@ -817,7 +811,7 @@ void sub_08024E4C(Entity* this) {
gPlayerState.field_0x38 = 0x14;
gPlayerState.field_0x39 = 1;
*(u8*)&gPlayerState.field_0x3a = 0;
PositionRelative(this, player, 0, 0x10000);
PositionRelative(this, player, 0, Q_16_16(1.0));
player->spriteOffsetY = 0x1a;
player->animationState = 4;
player->spritePriority.b1 = 0;
@@ -825,7 +819,7 @@ void sub_08024E4C(Entity* this) {
this->field_0x86.HALF.HI++;
player->iframes = 8;
ModHealth(-2);
SoundReqClipped(player, 0x7a);
SoundReqClipped(player, SFX_PLY_VO6);
}
}
}
@@ -835,7 +829,7 @@ void sub_08024F50(Entity* this) {
gPlayerState.field_0xa = 0;
gPlayerState.flags &= ~PL_DISABLE_ITEMS;
CopyPosition(this, &gPlayerEntity);
gPlayerEntity.action = 1;
gPlayerEntity.action = PLAYER_NORMAL;
COLLISION_ON(&gPlayerEntity);
gPlayerEntity.iframes = -0x3c;
gPlayerEntity.direction = gPlayerEntity.animationState << 2;
+10 -16
View File
@@ -9,12 +9,6 @@
#include "object.h"
#include "functions.h"
extern u32 sub_080002E0(u32, u32);
extern u32 sub_080002C8(u16, u8);
extern u8 sub_080002D4(u32, u32, u32);
extern void sub_0804AA1C(Entity*);
extern Entity* sub_08049DF4(u32);
extern u8 gUnk_080B37A0[];
extern u8 gUnk_080B3E80[];
@@ -95,7 +89,7 @@ void sub_08025020(Entity* this) {
ent->spritePriority.b0 = 3;
CopyPosition(this, ent);
}
EnqueueSFX(0x186);
EnqueueSFX(SFX_186);
}
break;
}
@@ -204,7 +198,7 @@ void sub_080252E0(Entity* this) {
this->action = 3;
this->actionDelay = 0x1e;
this->field_0xf = 0;
this->zVelocity = 0x18000;
this->zVelocity = Q_16_16(1.5);
InitializeAnimation(this, 1);
}
}
@@ -216,8 +210,8 @@ void sub_0802538C(Entity* this) {
if (this->frame == 0) {
GetNextFrame(this);
} else {
GravityUpdate(this, 0x2000);
if (this->zVelocity < 0x2000) {
GravityUpdate(this, Q_16_16(0.125));
if (this->zVelocity < Q_16_16(0.125)) {
this->action = 4;
InitializeAnimation(this, 2);
}
@@ -246,7 +240,7 @@ void sub_0802541C(Entity* this) {
if (this->frame & 0x80) {
this->action = 3;
this->field_0xf = 1;
this->zVelocity = 0x20000;
this->zVelocity = Q_16_16(2);
InitializeAnimation(this, 1);
}
}
@@ -263,7 +257,7 @@ void sub_0802544C(Entity* this) {
}
void sub_0802547C(Entity* this) {
GravityUpdate(this, 0x2000);
GravityUpdate(this, Q_16_16(0.125));
GetNextFrame(this);
if ((this->actionDelay & 7) == 0) {
sub_08025BD4(this);
@@ -275,7 +269,7 @@ void sub_0802547C(Entity* this) {
}
void sub_080254B4(Entity* this) {
GravityUpdate(this, 0x2000);
GravityUpdate(this, Q_16_16(0.125));
if (this->frame & 0x80) {
if (this->z.HALF.HI == 0) {
if (this->cutsceneBeh.HWORD == 0) {
@@ -559,7 +553,7 @@ void sub_08025B18(Entity* this) {
ent = CreateObject(OBJECT_21, 2, 0);
if (ent) {
PositionRelative(this, ent, offset[0] * 0x10000, offset[1] * 0x10000);
PositionRelative(this, ent, Q_16_16(offset[0]), Q_16_16(offset[1]));
ent->x.HALF.HI &= -0x10;
ent->x.HALF.HI += 8;
ent->y.HALF.HI &= -0x10;
@@ -573,8 +567,8 @@ void sub_08025BD4(Entity* this) {
if (this->field_0x82.HALF.LO && (this->frame & 1) == 0) {
Entity* ent = CreateObject(OBJECT_21, 0, 0);
if (ent) {
PositionRelative(this, ent, gUnk_080CC0BA[this->animationState * 2 + 0] * 0x10000,
gUnk_080CC0BA[this->animationState * 2 + 1] * 0x10000);
PositionRelative(this, ent, Q_16_16(gUnk_080CC0BA[this->animationState * 2 + 0]),
Q_16_16(gUnk_080CC0BA[this->animationState * 2 + 1]));
ent->z.HALF.HI = -10;
}
}
+4 -4
View File
@@ -37,7 +37,7 @@ void Rollobite_OnTick(Entity* this) {
void sub_08020668(Entity* this) {
if (this->hitType == 34 && this->health != 0xff) {
this->action = 4;
this->zVelocity = 0x20000;
this->zVelocity = Q_16_16(2.0);
this->direction = 0xff;
this->health = 0xff;
this->hitType = 35;
@@ -107,7 +107,7 @@ void sub_080207A8(Entity* this) {
this->spritePriority.b0 = 4;
this->field_0x3a &= 0xfb;
this->direction ^= 0x10;
this->zVelocity = 0x18000;
this->zVelocity = Q_16_16(1.5);
this->speed = 0x80;
InitializeAnimation(this, this->animationState + 0x10);
}
@@ -190,7 +190,7 @@ void Rollobite_RolledUp(Entity* this) {
sub_08078930(this);
} else {
if (unk == 1)
EnqueueSFX(260);
EnqueueSFX(SFX_104);
if ((this->direction & 0x80) == 0)
sub_080AEFE0(this);
@@ -267,7 +267,7 @@ bool32 Rollobite_TryToHoleUp(Entity* this) {
this->x.HALF.HI += 8;
this->y.HALF.HI &= 0xfff0;
this->y.HALF.HI += 13;
this->zVelocity = 0x20000;
this->zVelocity = Q_16_16(2.0);
InitializeAnimation(this, this->animationState + 0x14);
SetTile(0x4034, tile, this->collisionLayer);
return TRUE;
+1 -1
View File
@@ -95,7 +95,7 @@ void sub_08031480(Entity* this) {
this->field_0xf = 0xf;
this->spriteSettings.draw = 1;
UpdateSpriteForCollisionLayer(this);
EnqueueSFX(0x84);
EnqueueSFX(SFX_WATER_SPLASH);
}
}
}
+1 -1
View File
@@ -63,7 +63,7 @@ void sub_0803827C(Entity* this) {
this->field_0xf--;
} else {
if ((sub_0804A044(this, &gPlayerEntity, 0x8) != 0xff) ||
(sub_0806FCB8(this, gPlayerEntity.x.HALF.HI, gPlayerEntity.y.HALF.HI, 0x24) != 0)) {
(EntityWithinDistance(this, gPlayerEntity.x.HALF.HI, gPlayerEntity.y.HALF.HI, 0x24) != 0)) {
sub_080383E4(this);
return;
}
+4 -4
View File
@@ -71,7 +71,7 @@ void sub_08029318(Entity* this) {
this->field_0x82.HALF.HI = 0x41;
this->flags2 &= 0xfc;
this->field_0x80.HALF.LO = gPlayerEntity.spritePriority.b1;
EnqueueSFX(0x104);
EnqueueSFX(SFX_104);
} else {
if (this->field_0x43 != 0) {
sub_0804A9FC(this, 0x1c);
@@ -171,7 +171,7 @@ void sub_0802953C(Entity* this) {
} else {
ResetPlayer();
gPlayerState.mobility |= 0x80;
PositionRelative(this, &gPlayerEntity, 0, 0x10000);
PositionRelative(this, &gPlayerEntity, 0, Q_16_16(1.0));
pbVar3 = GetSpriteSubEntryOffsetDataPointer((u16)this->spriteIndex, this->frameIndex);
gPlayerEntity.spriteOffsetX = pbVar3[0];
gPlayerEntity.spriteOffsetY = pbVar3[1] - 1;
@@ -239,8 +239,8 @@ void sub_080296C8(Entity* this) {
void sub_080296D8(Entity* this) {
gPlayerState.jump_status = 0x41;
gPlayerState.flags &= ~PL_CAPTURED;
gPlayerEntity.flags |= 0x80;
gPlayerEntity.zVelocity = 0x18000;
gPlayerEntity.flags |= ENT_COLLIDE;
gPlayerEntity.zVelocity = Q_16_16(1.5);
gPlayerEntity.iframes = 0xa6;
gPlayerEntity.z.HALF.HI = -2;
gPlayerEntity.direction = gPlayerEntity.animationState << 2;
+1 -1
View File
@@ -95,7 +95,7 @@ void sub_0802BB10(Entity* this) {
this->action = 3;
this->speed = 0xc0;
this->direction = this->direction ^ 0x10;
EnqueueSFX(0x74);
EnqueueSFX(SFX_METAL_CLINK);
}
bool32 sub_0802BB2C(Entity* this, u32 param_2) {
-1
View File
@@ -16,7 +16,6 @@ void sub_08044FF8(Entity*);
void sub_08045178(Entity*, Entity*, int, int);
extern void sub_0804A4E4(Entity*, Entity*);
extern u32 sub_080002CC(Entity*, s32, s32);
extern void (*const gUnk_080D16BC[])(Entity*);
extern void (*const gUnk_080D16A4[])(Entity*);
+4 -4
View File
@@ -121,13 +121,13 @@ void sub_08023CE0(Entity* this) {
case 2:
if (this->actionDelay != 0) {
if (--this->actionDelay == 0) {
EnqueueSFX(0x12d);
EnqueueSFX(SFX_12D);
InitializeAnimation(this, 4);
}
} else if (!GravityUpdate(this, 0x1800)) {
} else if (!GravityUpdate(this, Q_8_8(24))) {
this->action = 3;
this->spriteSettings.draw = 1;
EnqueueSFX(0x84);
EnqueueSFX(SFX_WATER_SPLASH);
UpdateSpriteForCollisionLayer(this);
}
break;
@@ -169,7 +169,7 @@ void sub_08023E54(Entity* this) {
ent = CreateEnemy(SLUGGULA, 2);
if (ent) {
const s8* ptr = &gUnk_080CBDF7[this->animationState * 2];
PositionRelative(this, ent, ptr[0] << 0x10, ptr[1] << 0x10);
PositionRelative(this, ent, Q_16_16(ptr[0]), Q_16_16(ptr[1]));
}
}
}
+2 -5
View File
@@ -8,9 +8,6 @@
#include "enemy.h"
#include "functions.h"
extern bool32 sub_0806FC80(Entity*, Entity*, u32);
extern Entity* sub_08049DF4(u32);
void sub_08028604(Entity*);
void sub_08028754(Entity*);
void sub_08028784(Entity*);
@@ -171,7 +168,7 @@ void sub_08028488(Entity* this) {
this->action = 4;
this->speed = 0x180;
this->direction = sub_08049F84(this, 1);
EnqueueSFX(0x11e);
EnqueueSFX(SFX_EM_MOBLIN_SPEAR);
break;
case 2:
this->action = 2;
@@ -228,7 +225,7 @@ void sub_08028528(Entity* this) {
}
if ((this->actionDelay & 7) == 0) {
EnqueueSFX(0xf0);
EnqueueSFX(SFX_F0);
CreateFx(this, FX_DEATH, 0x40);
}
+4 -4
View File
@@ -54,7 +54,7 @@ void sub_0802B628(Entity* this) {
case 0x1d:
if (this->action < 6) {
this->action = 6;
this->zVelocity = 0x18000;
this->zVelocity = Q_16_16(1.5);
this->speed = 0xc0;
this->direction = this->knockbackDirection;
this->knockbackDuration = 0;
@@ -159,7 +159,7 @@ void sub_0802B8B0(Entity* this) {
this->actionDelay = 0x96;
/* fallthrough */
case 1:
EnqueueSFX(299);
EnqueueSFX(SFX_12B);
break;
}
}
@@ -171,11 +171,11 @@ void sub_0802B8E0(Entity* this) {
}
} else {
this->action = 8;
this->zVelocity = 0x10000;
this->zVelocity = Q_16_16(1.0);
this->speed = 0x60;
this->hitType = 99;
InitializeAnimation(this, this->animationState);
EnqueueSFX(299);
EnqueueSFX(SFX_12B);
}
}
+394
View File
@@ -0,0 +1,394 @@
#define NENT_DEPRECATED
#include "entity.h"
#include "enemy.h"
#include "functions.h"
#include "object.h"
typedef struct {
Entity base;
u8 filler[0xc];
u16 tile;
u16 tileIndex;
u8 unk_78;
u8 unk_79;
u8 unk_7a;
u8 unk_7b;
s32 unk_7c;
s32 unk_80;
u16 unk_84;
} SpinyBeetleEntity;
void (*const gUnk_080CEBEC[])(Entity*);
void (*const gUnk_080CEC04[])(SpinyBeetleEntity*);
const s8 gUnk_080CEC1C[];
extern void sub_08033E1C(SpinyBeetleEntity*);
extern void sub_08033D78(SpinyBeetleEntity*);
extern u32 sub_08033DF0(SpinyBeetleEntity*);
extern void SpinyBeetle_SetHitType(SpinyBeetleEntity*);
extern void sub_0804AA30(Entity*, EntityActionArray);
extern void sub_0807B9B8(s32, s32, s32);
extern u32 sub_0804A024(Entity*, u32, u32);
void SpinyBeetle(Entity* this) {
EnemyFunctionHandler(this, gUnk_080CEBEC);
SetChildOffset(this, 0, 1, -0x10);
}
void sub_080337BC(SpinyBeetleEntity* this) {
gUnk_080CEC04[super->action](this);
}
void sub_080337D4(SpinyBeetleEntity* this) {
if (super->field_0x43) {
sub_0804A9FC(super, 0x1c);
}
sub_0804AA30(super, gUnk_080CEBEC);
if (super->bitfield & 0x80) {
if (super->iframes > 0 && super->child) {
sub_08033E1C(this);
}
if ((super->bitfield & 0x3f) == 0x14 && super->action != 5) {
super->action = 3;
super->actionDelay = 0x5a;
super->field_0xf = 0x10;
super->spritePriority.b1 = 1;
super->direction = DirectionRoundUp(sub_08049F84(super, 1));
sub_08033D78(this);
InitializeAnimation(super, 3);
}
}
}
void nullsub_159(SpinyBeetleEntity* this) {
}
void sub_08033870(SpinyBeetleEntity* this) {
sub_08001242(super);
if (super->action != 5) {
if (sub_08033DF0(this)) {
sub_08033E1C(this);
}
}
}
void SpinyBeetle_Init(SpinyBeetleEntity* this) {
Entity* obj;
super->action = 1;
super->actionDelay = 0;
super->field_0xf = 0;
this->unk_7c = (super->x.WORD & 0xfff00000) | 0x80000;
this->unk_80 = (super->y.WORD & 0xfff00000) | 0x80000;
super->x.WORD = this->unk_7c;
super->y.WORD = this->unk_80;
this->unk_79 = 0;
this->unk_7a = 0;
this->unk_78 = 0;
this->unk_7b = 0;
this->tile = COORD_TO_TILE(super);
this->tileIndex = GetTileIndex(this->tile, super->collisionLayer);
SetTile(0x4022, this->tile, super->collisionLayer);
obj = CreateObject(OBJECT_ON_BEETLE, super->type, 0);
if (obj == NULL) {
DeleteThisEntity();
}
CopyPosition(super, obj);
super->child = obj;
obj->parent = super;
if (super->type == 1) {
SpinyBeetle_SetHitType(this);
}
InitializeAnimation(super, 0);
}
void sub_08033958(SpinyBeetleEntity* this) {
u32 direction;
if (sub_08033DF0(this)) {
sub_08033E1C(this);
sub_0807B9B8(this->tileIndex, this->tile, super->collisionLayer);
return;
}
if (this->unk_7b) {
this->unk_7b--;
return;
}
super->x.WORD = this->unk_7c;
super->y.WORD = this->unk_80;
direction = sub_0804A024(super, 1, 0x10);
switch (direction) {
case 0xff:
return;
case 0:
if (this->unk_78 == 0)
return;
if (super->y.HALF.HI - gPlayerEntity.y.HALF.HI > 0x30)
return;
break;
case 0x10:
if (gPlayerEntity.y.HALF.HI - super->y.HALF.HI > 0x30)
return;
break;
case 8:
if (gPlayerEntity.x.HALF.HI - super->x.HALF.HI > 0x30)
return;
break;
case 0x18:
if (super->x.HALF.HI - gPlayerEntity.x.HALF.HI > 0x30)
return;
break;
}
if (super->child && sub_0806F520(super->child)) {
return;
}
if (this->unk_78 == 0) {
this->unk_78 = 1;
}
super->action = 2;
super->direction = direction;
super->spriteSettings.draw = 1;
COLLISION_ON(super);
super->y.WORD = (super->y.WORD & 0xfff00000) | 0xC0000;
sub_0807B9B8(this->tileIndex, this->tile, super->collisionLayer);
InitializeAnimation(super, 2);
}
void sub_08033A7C(SpinyBeetleEntity* this) {
if (sub_08033DF0(this)) {
sub_08033E1C(this);
return;
}
GetNextFrame(super);
if ((super->frame & 0x80) == 0)
return;
super->action = 3;
super->actionDelay = 0x78;
super->field_0xf = 0x20;
super->spritePriority.b1 = 1;
InitializeAnimation(super, 3);
}
void sub_08033ACC(SpinyBeetleEntity* this) {
if (sub_08033DF0(this)) {
sub_08033E1C(this);
return;
}
GetNextFrame(super);
GetNextFrame(super);
if (super->field_0xf) {
super->field_0xf--;
return;
}
if (--super->actionDelay == 0) {
super->action = 4;
super->actionDelay = 0x78;
super->x.WORD = (super->x.WORD & 0xfff00000) | 0x80000;
super->y.WORD = (super->y.WORD & 0xfff00000) | 0xC0000;
this->unk_7c = super->x.WORD;
this->unk_80 = super->y.WORD;
InitializeAnimation(super, 4);
} else {
sub_08033D78(this);
}
}
void sub_08033B44(SpinyBeetleEntity* this) {
u32 stop;
if (sub_08033DF0(this)) {
sub_08033E1C(this);
return;
}
GetNextFrame(super);
if (--super->actionDelay)
return;
super->action = 1;
super->spriteSettings.draw = 0;
COLLISION_OFF(super);
stop = 0;
while (!stop) {
super->x.WORD = (super->x.WORD & 0xfff00000) | 0x80000;
super->y.WORD = (super->y.WORD & 0xfff00000) | 0x80000;
this->unk_7c = super->x.WORD;
this->unk_80 = super->y.WORD;
super->spritePriority.b1 = 0;
this->unk_7b = 0x78;
this->tile = COORD_TO_TILE(super);
this->tileIndex = GetTileIndex(this->tile, super->collisionLayer);
if (this->tileIndex != 0x4022) {
stop += 1;
} else {
switch (DirectionRound(super->direction) >> 2) {
case 0:
super->y.HALF.HI += 0x10;
break;
case 2:
super->x.HALF.HI -= 0x10;
break;
case 4:
super->y.HALF.HI -= 0x10;
break;
case 6:
super->x.HALF.HI += 0x10;
break;
}
}
}
SetTile(0x4022, this->tile, super->collisionLayer);
InitializeAnimation(super, 0);
}
void sub_08033C94(SpinyBeetleEntity* this) {
UpdateAnimationVariableFrames(super, 3);
switch (this->unk_79) {
case 0:
this->unk_79 = 1;
if (super->spriteSettings.draw != 1) {
super->spriteSettings.draw = 1;
}
case 1:
if (--super->actionDelay)
return;
this->unk_79 = 2;
super->actionDelay = 0x78;
super->spriteOffsetY = 0;
super->direction = sub_08049F84(super, 1) + 0x14;
switch (Random() & 3) {
case 0:
super->direction += 8;
break;
case 2:
super->direction += 0x18;
break;
}
super->direction &= 0x18;
break;
case 2:
if (super->field_0xf != 0) {
super->field_0xf--;
} else {
sub_08033D78(this);
}
if (--super->actionDelay)
return;
super->actionDelay = (Random() & 0x1f) + 0x20;
super->direction = sub_08049F84(super, 1) + 0x14;
switch (Random() & 3) {
case 1:
super->direction += 8;
break;
case 3:
super->direction += 0x18;
break;
}
super->direction &= 0x18;
break;
}
}
void sub_08033D78(SpinyBeetleEntity* this) {
u32 dir = DirectionRound(super->direction) >> 2;
const s8* ptr = gUnk_080CEC1C + dir;
s32 tile;
u32 type;
tile = COORD_TO_TILE_OFFSET(super, -ptr[0], -ptr[1]);
type = GetTileType(tile, super->collisionLayer);
switch (type) {
case 0x1c4:
case 0x1c5:
break;
default:
if (sub_080002E0(tile, super->collisionLayer) - 1 > 0x3e)
ProcessMovement(super);
break;
}
}
bool32 sub_08033DF0(SpinyBeetleEntity* this) {
bool32 rv = 0;
if (super->child == NULL) {
rv = 1;
} else {
switch (super->child->action) {
case 4:
rv = 1;
break;
case 3:
if (super->child->subAction > 1) {
rv = 1;
}
break;
case 2:
rv = 1;
break;
}
}
return rv;
}
void sub_08033E1C(SpinyBeetleEntity* this) {
super->action = 5;
this->unk_79 = 0;
super->spriteSettings.draw = 1;
COLLISION_ON(super);
super->spritePriority.b0 = 5;
super->y.WORD = (super->y.WORD & 0xfff00000) | 0xC0000;
super->hitType = 0x19;
super->spritePriority.b1 = 1;
super->actionDelay = 0x30;
super->field_0xf = 0;
super->speed = 0x100;
super->child = NULL;
InitializeAnimation(super, 3);
CreateSpeechBubbleExclamationMark(super, 0xa, -12);
}
void SpinyBeetle_SetHitType(SpinyBeetleEntity* this) {
if ((gPlayerState.field_0xac & 8)) {
super->hitType = 0x95;
} else {
super->hitType = 0x63;
}
}
const u16 unusedLabel_0CEBDC[] = {
0x3F, 0x1C, 0x50, 0x2A, 0x55, 0x1D, 0x5C, 0x2B,
};
void (*const gUnk_080CEBEC[])(Entity*) = {
(EntityActionPtr)sub_080337BC, (EntityActionPtr)sub_080337D4, sub_08001324, sub_0804A7D4,
(EntityActionPtr)sub_08033870, (EntityActionPtr)nullsub_159,
};
void (*const gUnk_080CEC04[])(SpinyBeetleEntity*) = {
SpinyBeetle_Init, sub_08033958, sub_08033A7C, sub_08033ACC, sub_08033B44, sub_08033C94,
};
const s8 gUnk_080CEC1C[] = { 0, -8, 8, 0, 0, 8, -8, 0 };
+9 -9
View File
@@ -75,7 +75,7 @@ void sub_0802244C(Entity* this) {
if (this->action == 3) {
this->action = 4;
InitializeAnimation(this, 3);
EnqueueSFX(0x194);
EnqueueSFX(SFX_194);
}
}
} else {
@@ -93,7 +93,7 @@ void sub_080225A0(Entity* this) {
}
void sub_080225BC(Entity* this) {
GravityUpdate(this, 0x1800);
GravityUpdate(this, Q_8_8(24.0));
if (this->frame & 1) {
sub_0804A7D4(this);
} else {
@@ -132,13 +132,13 @@ void sub_08022654(Entity* this) {
InitializeAnimation(this, 0);
/* fallthrough */
case 1:
if (GravityUpdate(this, 0x1800))
if (GravityUpdate(this, Q_8_8(24.0)))
return;
this->subAction = 2;
this->spriteSettings.draw = 1;
InitializeAnimation(this, 5);
EnqueueSFX(0x7d);
EnqueueSFX(SFX_PLY_LAND);
UpdateSpriteForCollisionLayer(this);
/* fallthrough */
case 2:
@@ -163,7 +163,7 @@ void sub_080226EC(Entity* this) {
if (sub_080228F0(this)) {
this->action = 6;
this->zVelocity = 0x12000;
this->zVelocity = Q_16_16(1.125);
this->speed = 0x140;
this->direction = GetFacingDirection(this, gUnk_020000B0);
this->hitType = 0x5a;
@@ -186,7 +186,7 @@ void sub_08022780(Entity* this) {
if (this->frame & 0x80) {
this->action = 4;
InitializeAnimation(this, 3);
EnqueueSFX(0x194);
EnqueueSFX(SFX_194);
}
}
@@ -211,7 +211,7 @@ void sub_080227AC(Entity* this) {
}
void sub_0802281C(Entity* this) {
GravityUpdate(this, 0x1800);
GravityUpdate(this, Q_8_8(24.0));
GetNextFrame(this);
if (this->frame & 0x80) {
this->action = 2;
@@ -225,11 +225,11 @@ void sub_08022854(Entity* this) {
GetNextFrame(this);
if (this->frame & 1) {
sub_080AEFE0(this);
if (GravityUpdate(this, 0x1800) == 0) {
if (GravityUpdate(this, Q_8_8(24.0)) == 0) {
this->action = 7;
this->hitType = 0x5c;
InitializeAnimation(this, 5);
EnqueueSFX(0x7d);
EnqueueSFX(SFX_PLY_LAND);
}
}
}
+1 -1
View File
@@ -3,7 +3,7 @@
void sub_080451CC(Entity* this, Entity* other) {
u8* pThis;
u8* pOther;
other->flags = this->flags & 0xfe;
other->flags = this->flags & ~ENT_DID_INIT;
other->x.WORD = this->x.WORD;
other->y.WORD = this->y.WORD;
other->z.WORD = this->z.WORD;
+1 -3
View File
@@ -20,8 +20,6 @@ typedef struct {
static_assert(sizeof(TakkuriEntity) == 0x88);
extern void sub_0803C0AC(Entity*);
extern Entity* sub_08049DF4(u32);
extern Entity* gUnk_020000B0;
void (*const gUnk_080CFF3C[])(Entity*);
@@ -341,7 +339,7 @@ void sub_0803C0AC(Entity* this) {
void sub_0803C120(TakkuriEntity* this) {
super->action = 5;
super->spriteSettings.draw = 0;
super->flags &= 0x7f;
super->flags &= ~ENT_COLLIDE;
super->x.HALF.HI = this->x_0x78;
super->y.HALF.HI = this->y_0x7a;
super->z.HALF.HI += 8;
+2 -2
View File
@@ -89,7 +89,7 @@ void sub_08037Fe0(Entity* this) {
this->action = 2;
this->actionDelay = 6;
this->field_0xf = 0;
this->zVelocity = 0x38000;
this->zVelocity = Q_16_16(3.5);
sub_08038168(this);
InitializeAnimation(this, 2);
}
@@ -145,7 +145,7 @@ void sub_08038110(Entity* this) {
if (this->field_0x80.HALF.LO < 5) {
this->action = 2;
this->actionDelay = 8;
this->zVelocity = 0x38000;
this->zVelocity = Q_16_16(3.5);
sub_08038168(this);
InitializeAnimation(this, 2);
} else {
+156
View File
@@ -0,0 +1,156 @@
#define NENT_DEPRECATED
#include "entity.h"
#include "enemy.h"
#include "functions.h"
typedef struct {
Entity base;
u8 filler[0xc];
u16 unk_74;
u16 filler2;
u16 unk_78;
u16 projectileTimer;
u16 unk_7c;
u8 filler3[0x2];
u16 unk_80;
u16 unk_82;
u16 unk_84;
} TorchTrapEntity;
void (*const gTorchTrapActions[])(TorchTrapEntity*);
const u16 gTorchTrapTimerLengths[];
const u16 gTorchTrapProjectileSpeeds[];
extern Entity* gUnk_020000B0;
bool32 sub_0803CFF0(TorchTrapEntity*);
bool32 sub_0803CFD8(TorchTrapEntity*);
void sub_0803D0B0(TorchTrapEntity*);
void TorchTrap_Reset(TorchTrapEntity*);
void TorchTrap_CreateProjectile(TorchTrapEntity*);
void TorchTrap(Entity* this) {
gTorchTrapActions[this->action]((TorchTrapEntity*)this);
}
void TorchTrap_Init(TorchTrapEntity* this) {
super->speed = (this->unk_84 & 0xf000) >> 5;
this->unk_84 &= 0xfff;
sub_0804A720(super);
super->action = 1;
this->unk_74 = this->unk_82 & 0xfff;
super->x.HALF.HI = ((this->unk_82 & 0x3f) << 4) + 8 + gRoomControls.origin_x;
super->y.HALF.HI = ((this->unk_82 & 0xfc0) >> 2) + (gRoomControls.origin_y + 8);
super->direction = ((s16)this->unk_82 & 0xf000) >> 10;
this->unk_78 = super->type << 2;
if (sub_0803CFF0(this)) {
sub_0803D0B0(this);
}
}
void sub_0803CF24(TorchTrapEntity* this) {
if (sub_0803CFD8(this)) {
TorchTrap_Reset(this);
}
}
void sub_0803CF38(TorchTrapEntity* this) {
if (sub_0803CFF0(this)) {
sub_0803D0B0(this);
} else if (sub_08049FDC(super, 0)) {
if (EntityWithinDistance(super, gUnk_020000B0->x.HALF.HI, gUnk_020000B0->y.HALF.HI, 0x20) == 0) {
if (--this->projectileTimer == 0) {
TorchTrap_CreateProjectile(this);
TorchTrap_Reset(this);
}
}
}
}
void sub_0803CF94(TorchTrapEntity* this) {
if (GetTileType(this->unk_74, super->collisionLayer) == 0x76) {
this->unk_80 = 0;
TorchTrap_Reset(this);
} else if (this->unk_7c && sub_0803CFD8(this)) {
TorchTrap_Reset(this);
}
}
bool32 sub_0803CFD8(TorchTrapEntity* this) {
u32 rv;
if (this->unk_7c == 0) {
rv = 1;
} else {
rv = CheckFlags(this->unk_7c);
}
return rv;
}
bool32 sub_0803CFF0(TorchTrapEntity* this) {
u32 rv;
if (this->unk_80 != 0) {
if (this->unk_80 == this->unk_7c) {
u32 val = CheckFlags(this->unk_80);
rv = 0;
if (val == 0) {
rv = 1;
}
return rv;
} else {
return CheckFlags(this->unk_80);
}
}
return 0;
}
void TorchTrap_Reset(TorchTrapEntity* this) {
u32 val;
super->action = 2;
if (this->unk_78) {
this->projectileTimer = this->unk_78;
} else {
this->projectileTimer = gTorchTrapTimerLengths[Random() & 7];
}
}
void TorchTrap_CreateProjectile(TorchTrapEntity* this) {
Entity* proj = CreateProjectileWithParent(super, TORCH_TRAP_PROJECTILE, 0);
if (proj) {
u16 speed = super->speed;
if (super->speed) {
proj->speed = speed;
} else {
proj->speed = gTorchTrapProjectileSpeeds[Random() & 3];
}
if (super->direction & 0x20) {
proj->direction = GetFacingDirection(super, gUnk_020000B0);
} else {
proj->direction = super->direction;
}
}
}
void sub_0803D0B0(TorchTrapEntity* this) {
super->action = 3;
sub_0807B7D8(0x75, this->unk_74, super->collisionLayer);
}
void (*const gTorchTrapActions[])(TorchTrapEntity*) = {
TorchTrap_Init,
sub_0803CF24,
sub_0803CF38,
sub_0803CF94,
};
const u16 gTorchTrapTimerLengths[] = {
0x3c, 0x3c, 0x5a, 0x5a, 0x5a, 0x78, 0x78, 0x96,
};
const u16 gTorchTrapProjectileSpeeds[] = {
0x80,
0x100,
0x180,
0x200,
};
+1 -1
View File
@@ -80,7 +80,7 @@ static bool32 ShouldSpawnTreeItem(Entity* this) {
int expectedStateX, expectedStateY;
int playerState;
if (gPlayerEntity.action != 0x6) {
if (gPlayerEntity.action != PLAYER_BOUNCE) {
return FALSE;
}
+24 -24
View File
@@ -269,15 +269,15 @@ void sub_08042654(Entity* this) {
break;
this->subAction = 5;
this->actionDelay = 0x5a;
((VaatiArm_HeapStruct*)this->myHeap)->entities[0]->flags |= 0x80;
((VaatiArm_HeapStruct*)this->myHeap)->entities[0]->flags |= ENT_COLLIDE;
((VaatiArm_HeapStruct*)this->myHeap)->entities[0]->spritePriority.b0 = 4;
((VaatiArm_HeapStruct*)this->myHeap)->entities[1]->flags |= 0x80;
((VaatiArm_HeapStruct*)this->myHeap)->entities[1]->flags |= ENT_COLLIDE;
((VaatiArm_HeapStruct*)this->myHeap)->entities[1]->spritePriority.b0 = 4;
((VaatiArm_HeapStruct*)this->myHeap)->entities[2]->flags |= 0x80;
((VaatiArm_HeapStruct*)this->myHeap)->entities[2]->flags |= ENT_COLLIDE;
((VaatiArm_HeapStruct*)this->myHeap)->entities[2]->spritePriority.b0 = 4;
((VaatiArm_HeapStruct*)this->myHeap)->entities[3]->flags |= 0x80;
((VaatiArm_HeapStruct*)this->myHeap)->entities[3]->flags |= ENT_COLLIDE;
((VaatiArm_HeapStruct*)this->myHeap)->entities[3]->spritePriority.b0 = 4;
((VaatiArm_HeapStruct*)this->myHeap)->entities[4]->flags |= 0x80;
((VaatiArm_HeapStruct*)this->myHeap)->entities[4]->flags |= ENT_COLLIDE;
((VaatiArm_HeapStruct*)this->myHeap)->entities[4]->spritePriority.b0 = 4;
InitAnimationForceUpdate(this, 7);
SoundReq(SFX_15E);
@@ -495,7 +495,7 @@ void sub_08042B20(Entity* this) {
CopyPosition(((VaatiArm_HeapStruct*)this->myHeap)->entities[4], object);
}
}
entity->flags &= 0x7f;
entity->flags &= ~ENT_COLLIDE;
entity->spriteSettings.draw = 0;
SoundReq(SFX_161);
}
@@ -599,7 +599,7 @@ void sub_08042D6C(Entity* this) {
entity = ((VaatiArm_HeapStruct*)this->myHeap)->entities[i];
if (entity->z.HALF.HI < 4) {
if (i != 2) {
entity->flags = entity->flags | 0x80;
entity->flags = entity->flags | ENT_COLLIDE;
}
if ((entity->spriteSettings.draw == 0u) && (object = CreateObject(OBJECT_AF, 2, 0), object != NULL)) {
CopyPosition(entity, object);
@@ -671,7 +671,7 @@ void sub_08042EF4(Entity* this) {
UpdateAnimationSingleFrame(this);
if (sub_08043C98(this) == 0) {
if (--this->actionDelay == 0) {
if (sub_0806FCB8(this, gPlayerEntity.x.HALF.HI, gPlayerEntity.y.HALF.HI, 0x50)) {
if (EntityWithinDistance(this, gPlayerEntity.x.HALF.HI, gPlayerEntity.y.HALF.HI, 0x50)) {
this->subAction = 6;
this->actionDelay = 0x28;
} else {
@@ -686,7 +686,7 @@ void sub_08042EF4(Entity* this) {
}
x = this->parent->x.HALF.HI;
y = this->parent->y.HALF.HI - 0x10;
if (sub_0806FCB8(this, x, y, 0x30)) {
if (EntityWithinDistance(this, x, y, 0x30)) {
temp = sub_080045D4(this->x.HALF.HI, this->y.HALF.HI, x, y);
if ((this->field_0x78.HALF.HI - temp) + 4 < 9) {
this->field_0x78.HALF.HI = temp ^ 0x10;
@@ -803,7 +803,7 @@ void sub_08043130(Entity* this) {
for (i = 0; i < 4; i++) {
entity = ((VaatiArm_HeapStruct*)this->myHeap)->entities[i];
if (entity->z.HALF.HI > -4) {
entity->flags = entity->flags & 0x7f;
entity->flags = entity->flags & ~ENT_COLLIDE;
if (entity->spriteSettings.draw == 1) {
SoundReq(SFX_161);
}
@@ -872,7 +872,7 @@ NONMATCH("asm/non_matching/vaati/sub_0804334C.inc", void sub_0804334C(Entity* th
}
for (i = 0; i < 5; i++) {
entity = ((VaatiArm_HeapStruct*)this->myHeap)->entities[i];
entity->flags = entity->flags | 0x80;
entity->flags = entity->flags | ENT_COLLIDE;
entity->spriteSettings.draw = 1;
}
}
@@ -951,22 +951,22 @@ void sub_08043490(Entity* this) {
entity = ((VaatiArm_HeapStruct*)this->myHeap)->entities[4];
if (entity->z.HALF.HI < -4) {
entity->zVelocity = 0x18000;
entity->zVelocity = Q_16_16(1.5);
this->subAction = 2;
this->field_0x7c.BYTES.byte2 = 0;
((VaatiArm_HeapStruct*)this->myHeap)->parent->subAction = 2;
} else {
entity->z.HALF.HI -= 2;
if (entity->z.HALF.HI < 0) {
entity->flags = entity->flags | 0x80;
entity->flags = entity->flags | ENT_COLLIDE;
entity->spriteSettings.draw = 1;
entity->field_0x3c = entity->field_0x3c & 0xef;
entity->hitType = 0x3a;
entity->hitbox = (Hitbox*)&gUnk_080FD450;
entity2 = ((VaatiArm_HeapStruct*)this->myHeap)->entities[2];
entity2->flags = entity2->flags | 0x80;
entity2->flags = entity2->flags | ENT_COLLIDE;
entity3 = ((VaatiArm_HeapStruct*)this->myHeap)->entities[3];
entity3->flags = entity3->flags & 0x7f;
entity3->flags = entity3->flags & ~ENT_COLLIDE;
}
}
UpdateAnimationSingleFrame(this);
@@ -976,7 +976,7 @@ void sub_08043520(Entity* this) {
Entity* entity;
entity = ((VaatiArm_HeapStruct*)this->myHeap)->entities[4];
GravityUpdate(entity, 0x1a00);
GravityUpdate(entity, Q_8_8(26.0));
if ((entity->zVelocity < 0) && (-6 < entity->z.HALF.HI)) {
entity->z.HALF.HI = -6;
this->subAction = 3;
@@ -1000,7 +1000,7 @@ void sub_08043580(Entity* this) {
for (i = 0; i < 5; i++) {
entity = ((VaatiArm_HeapStruct*)this->myHeap)->entities[i];
if (-4 < entity->z.HALF.HI) {
entity->flags = entity->flags & 0x7f;
entity->flags = entity->flags & ~ENT_COLLIDE;
entity->spriteSettings.draw = 0;
}
}
@@ -1052,7 +1052,7 @@ void sub_08043698(Entity* this) {
this->actionDelay = 0x3c;
for (i = 0; i < 5; i++) {
entity = ((VaatiArm_HeapStruct*)this->myHeap)->entities[i];
entity->flags = entity->flags & 0x7f;
entity->flags = entity->flags & ~ENT_COLLIDE;
}
}
@@ -1325,7 +1325,7 @@ void sub_08043D08(Entity* this) {
this->subAction = 0;
InitAnimationForceUpdate(this, 0xd);
entity = ((VaatiArm_HeapStruct*)this->myHeap)->entities[4];
entity->flags &= 0x7f;
entity->flags &= ~ENT_COLLIDE;
entity->spriteSettings.draw = 0;
InitializeAnimation(entity, 0x13);
sub_0804AA1C(entity);
@@ -1392,17 +1392,17 @@ void sub_08043EB8(Entity* this) {
this->spritePriority.b0 = 4;
InitAnimationForceUpdate(this, 0xd);
pEVar4 = ((VaatiArm_HeapStruct*)this->myHeap)->entities[1];
pEVar4->flags = pEVar4->flags | 0x80;
pEVar4->flags = pEVar4->flags | ENT_COLLIDE;
pEVar4->spritePriority.b0 = 4;
pEVar4 = ((VaatiArm_HeapStruct*)this->myHeap)->entities[2];
pEVar4->flags = pEVar4->flags | 0x80;
pEVar4->flags = pEVar4->flags | ENT_COLLIDE;
pEVar4->spritePriority.b0 = 4;
pEVar4 = ((VaatiArm_HeapStruct*)this->myHeap)->entities[3];
pEVar4->flags = pEVar4->flags & 0x7f;
pEVar4->flags = pEVar4->flags & ~ENT_COLLIDE;
pEVar4->spriteSettings.draw = 1;
pEVar4->spritePriority.b0 = 4;
pEVar4 = ((VaatiArm_HeapStruct*)this->myHeap)->entities[4];
pEVar4->flags = pEVar4->flags | 0x80;
pEVar4->flags = pEVar4->flags | ENT_COLLIDE;
pEVar4->spriteSettings.draw = 1;
pEVar4->spritePriority.b0 = 4;
pEVar4->x.HALF.HI = (this->type2 == 0) ? gRoomTransition.field_0x44 : gRoomTransition.field_0x48;
@@ -1432,7 +1432,7 @@ NONMATCH("asm/non_matching/vaati/sub_08044000.inc", void sub_08044000(Entity* th
ptr2 = &gUnk_080D1400[this->type2 * 5];
for (i = 0; i < 5; ptr2++, i++) {
entity = ((VaatiArm_HeapStruct*)this->myHeap)->entities[i];
entity->flags = entity->flags | 0x80;
entity->flags = entity->flags | ENT_COLLIDE;
entity->spritePriority.b0 = 4;
ptr = &((VaatiArm_HeapStruct*)this->myHeap)->s1[i];
ptr->unk00.HWORD = *ptr2;
+7 -7
View File
@@ -71,7 +71,7 @@ void sub_0804468C(Entity* this) {
this->field_0x82.HALF.HI = 0;
this->spriteSettings.draw = 0;
off = &gUnk_080D1620[this->field_0x78.HALF.HI & 3];
PositionRelative(this->parent, this, off->h << 0x10, (off->v - 0x10) * 0x10000);
PositionRelative(this->parent, this, Q_16_16(off->h), Q_16_16(off->v - 0x10));
this->z.HALF.HI = this->parent->z.HALF.HI;
InitAnimationForceUpdate(this, 0);
break;
@@ -170,7 +170,7 @@ void sub_08044868(Entity* this) {
break;
case 1:
LinearMoveUpdate(this);
if (sub_0806FCB8(this, vaati->x.HALF.HI, vaati->y.HALF.HI - 0x10, 0xc)) {
if (EntityWithinDistance(this, vaati->x.HALF.HI, vaati->y.HALF.HI - 0x10, 0xc)) {
this->field_0x74.HALF.LO++;
this->x.HALF.HI = vaati->x.HALF.HI;
this->y.HALF.HI = vaati->y.HALF.HI - 0x10;
@@ -383,7 +383,7 @@ void sub_08044B04(Entity* this) {
}
}
if (this->field_0x78.HALF.HI == 3)
if (sub_0806FCB8(this, vaati->x.HALF.HI, vaati->y.HALF.HI - 0x10, 0xc))
if (EntityWithinDistance(this, vaati->x.HALF.HI, vaati->y.HALF.HI - 0x10, 0xc))
vaati->actionDelay++;
this->direction = sub_080045B4(this, vaati->x.HALF.HI, vaati->y.HALF.HI - 0x10);
return;
@@ -397,7 +397,7 @@ void sub_08044B04(Entity* this) {
this->field_0x74.HALF.LO = 1;
this->actionDelay = 80;
COLLISION_OFF(this);
PositionRelative(vaati, this, 0, -0x100000);
PositionRelative(vaati, this, 0, Q_16_16(-16.0));
if (this->field_0xf)
this->spriteSettings.draw = 0;
break;
@@ -463,7 +463,7 @@ void sub_08044DEC(Entity* this) {
this->speed = 0x300;
off = this->parent->field_0x80.HALF.LO - 1;
this->direction = gUnk_080D1628[off][this->field_0x78.HALF.HI];
PositionRelative(this->parent, this, 0, -0x100000);
PositionRelative(this->parent, this, 0, Q_16_16(-16.0));
}
void sub_08044E74(Entity* this, u32 state) {
@@ -475,7 +475,7 @@ void sub_08044E74(Entity* this, u32 state) {
this->action = 2;
this->direction += 0x18;
this->direction &= 0x1f;
PositionRelative(this->parent, this, 0, -0x100000);
PositionRelative(this->parent, this, 0, Q_16_16(-16.0));
this->speed = 12288;
LinearMoveUpdate(this);
this->direction += 0x8;
@@ -509,5 +509,5 @@ void sub_08044E74(Entity* this, u32 state) {
}
this->actionDelay = 1;
this->field_0x78.HALF.LO = 0;
this->speed = 1280;
this->speed = Q_8_8(5);
}
-1
View File
@@ -8,7 +8,6 @@
#include "enemy.h"
#include "functions.h"
extern u32 sub_080002E0(u32, u32);
extern s16 gUnk_080B4488[];
void VaatiEyesMacroFunction0(Entity*);
+5 -7
View File
@@ -8,8 +8,6 @@
#include "enemy.h"
#include "functions.h"
extern bool32 PlayerInRange(Entity*, u32, u32);
extern u32 sub_080002E0(u32, u32);
extern Entity* gUnk_020000B0;
extern const ScreenTransitionData gUnk_0813AB94;
@@ -67,7 +65,7 @@ void VaatiProjectileFunction1(Entity* this) {
this->action = 5;
COLLISION_OFF(this);
this->spritePriority.b1 = 0;
gPlayerEntity.flags &= 0x7f;
gPlayerEntity.flags &= ~ENT_COLLIDE;
gPlayerEntity.spriteOrientation.flipY = this->spriteOrientation.flipY;
gPlayerEntity.spriteRendering.b3 = this->spriteRendering.b3;
sub_0803E444(this);
@@ -75,12 +73,12 @@ void VaatiProjectileFunction1(Entity* this) {
SetPlayerControl(2);
entity = this->parent;
if (entity != NULL) {
entity->flags = entity->flags & 0x7f;
entity->flags = entity->flags & ~ENT_COLLIDE;
}
} else {
gPlayerState.flags &= ~PL_DISABLE_ITEMS;
entity = &gPlayerEntity;
entity->flags = gPlayerEntity.flags | 0x80;
entity->flags = gPlayerEntity.flags | ENT_COLLIDE;
}
#endif
}
@@ -123,7 +121,7 @@ void VaatiProjectileFunction0Action0(Entity* this) {
this->spriteOrientation.flipY = this->parent->spriteOrientation.flipY;
this->spriteRendering.b3 = this->parent->spriteRendering.b3;
this->spritePriority.b1 = 0;
PositionRelative(this->parent, this, 0, -0x10000);
PositionRelative(this->parent, this, 0, Q_16_16(-1.0));
InitializeAnimation(this, 1);
}
}
@@ -209,7 +207,7 @@ void VaatiProjectileFunction0Action8(Entity* this) {
if (this->parent->next == NULL) {
DeleteThisEntity();
}
PositionRelative(this->parent, this, 0, -0x10000);
PositionRelative(this->parent, this, 0, Q_16_16(-1.0));
GetNextFrame(this);
}
+9 -9
View File
@@ -135,7 +135,7 @@ void VaatiRebornEnemyType0Action0(Entity* this) {
entity->parent = this;
entity->spriteSettings.flipX = i;
ptr = &gUnk_080D04A8[i];
PositionRelative(this, entity, ptr->x << 0x10, ptr->y << 0x10);
PositionRelative(this, entity, Q_16_16(ptr->x), Q_16_16(ptr->y));
}
InitAnimationForceUpdate(this, 0);
}
@@ -292,7 +292,7 @@ void VaatiRebornEnemyType0Action3(Entity* this) {
break;
case 0xff:
if (this->z.HALF.HI != -4) {
this->z.WORD -= 0x2000;
this->z.WORD -= Q_16_16(0.125);
}
if (this->actionDelay == 2) {
this->field_0x74.HALF.LO = 0xfe;
@@ -442,7 +442,7 @@ void VaatiRebornEnemyType0Action6(Entity* this) {
SoundReq(SFX_150);
target = CreateProjectileWithParent(this, 0x18, 0);
if (target != NULL) {
PositionRelative(this, target, 0, -0x100000);
PositionRelative(this, target, 0, Q_16_16(-16.0));
target->parent = this;
}
} else if (this->actionDelay == 0x40) {
@@ -500,7 +500,7 @@ void VaatiRebornEnemyType1Action0(Entity* this) {
this->field_0x74.HALF.HI = 1;
this->actionDelay = 0;
this->spriteOffsetY = -1;
PositionRelative(this->parent, this, 0, 0x10000);
PositionRelative(this->parent, this, 0, Q_16_16(1.0));
enemy = CreateEnemy(VAATI_REBORN_ENEMY, 2);
enemy->parent = this;
enemy->child = this->parent;
@@ -546,7 +546,7 @@ void VaatiRebornEnemyType1Action1(Entity* this) {
}
this->spriteSettings.draw = parent->spriteSettings.draw;
this->spriteOffsetX = parent->spriteOffsetX;
PositionRelative(this->parent, this, 0, 0x10000);
PositionRelative(this->parent, this, 0, Q_16_16(1.0));
UpdateAnimationSingleFrame(this);
}
@@ -559,7 +559,7 @@ void VaatiRebornEnemyType2Action0(Entity* this) {
this->field_0x74.HALF.HI = 0;
this->spriteOffsetY = -2;
this->direction = 0xff;
PositionRelative(source, this, 0, 0x20000);
PositionRelative(source, this, 0, Q_16_16(2.0));
InitAnimationForceUpdate(this, 2);
}
@@ -595,7 +595,7 @@ void VaatiRebornEnemyType2Action1(Entity* this) {
}
this->spriteSettings.draw = parent->spriteSettings.draw;
this->spriteOffsetX = parent->spriteOffsetX;
PositionRelative(parent->parent, this, 0, 0x20000);
PositionRelative(parent->parent, this, 0, Q_16_16(2.0));
UpdateAnimationSingleFrame(this);
}
@@ -637,7 +637,7 @@ void sub_0803DC0C(Entity* this) {
tmp = &gUnk_080D04C8[this->actionDelay];
this->spriteSettings.draw = parent->spriteSettings.draw;
this->spriteOffsetX = parent->spriteOffsetX;
PositionRelative(parent, this, tmp->x << 0x10, (tmp->y + 1) * 0x10000);
PositionRelative(parent, this, Q_16_16(tmp->x), Q_16_16(tmp->y + 1));
UpdateAnimationSingleFrame(this);
}
@@ -654,7 +654,7 @@ void VaatiRebornEnemyType1PreAction(Entity* this) {
if (2 < ++parent->field_0x86.HALF.LO) {
COLLISION_OFF(this);
parent->action = 7;
parent->flags &= 0x7f;
parent->flags &= ~ENT_COLLIDE;
parent->actionDelay = 0x80;
parent->spriteOffsetX = 0;
parent->direction = -1;
+6 -6
View File
@@ -314,7 +314,7 @@ void VaatiTransfiguredType0Action3(Entity* this) {
if (this->actionDelay != 0) {
if (--this->actionDelay == 0) {
COLLISION_OFF(this);
this->zVelocity = 0x38000;
this->zVelocity = Q_16_16(3.5);
this->field_0xf = 0x10;
}
break;
@@ -380,12 +380,12 @@ void VaatiTransfiguredType0Action4(Entity* this) {
this->field_0x74.HALF.LO = 0;
this->actionDelay = 0x80;
this->field_0xf = 0;
this->zVelocity = 0x24000;
this->zVelocity = Q_16_16(2.25);
SoundReq(SFX_12B);
}
break;
case 1:
if (GravityUpdate(this, 0x2800) != 0)
if (GravityUpdate(this, Q_8_8(40)) != 0)
break;
this->field_0x80.HALF.LO += 1;
switch (this->cutsceneBeh.HALF.LO) {
@@ -866,7 +866,7 @@ void sub_080406A0(Entity* this) {
uVar6 = gRoomControls.origin_x + gUnk_080D0B58[tmp = uVar5 * 2];
uVar4 = gRoomControls.origin_y + gUnk_080D0B58[tmp + 1];
}
if (sub_0806FCB8(this, uVar6, uVar4, 0x1c)) {
if (EntityWithinDistance(this, uVar6, uVar4, 0x1c)) {
if (uVar5 != 0) {
uVar5 = 0;
} else {
@@ -901,7 +901,7 @@ void sub_08040770(Entity* this) {
tmp5 = gRoomControls.origin_x + gUnk_080D0B64[index = tmp2 * 2];
tmp6 = gRoomControls.origin_y + gUnk_080D0B64[index + 1];
}
if (sub_0806FCB8(this, tmp5, tmp6, 0x1c)) {
if (EntityWithinDistance(this, tmp5, tmp6, 0x1c)) {
if (this->animationState != 2) {
if (tmp & 8) {
tmp2 += 1;
@@ -1062,7 +1062,7 @@ void sub_080409B0(Entity* this) {
this->field_0x80.HALF.HI = 3;
COLLISION_OFF(this);
this->hitType = 0x36;
this->zVelocity = 0x18000;
this->zVelocity = Q_16_16(1.5);
SoundReq(SFX_164);
}
}
+2 -2
View File
@@ -215,7 +215,7 @@ void VaatiTransfiguredEyeFunction0Action4(Entity* this) {
void sub_08045A00(Entity* this) {
const struct xy* t = &gUnk_080D18B4[this->type2];
PositionRelative(this->parent, this, t->x << 0x10, (t->y + 3) * 0x10000);
PositionRelative(this->parent, this, Q_16_16(t->x), Q_16_16(t->y + 3));
}
void sub_08045A28(Entity* this) {
@@ -291,7 +291,7 @@ void sub_08045A28(Entity* this) {
break;
}
} else {
PositionRelative(this->parent, this, 0, -0x10000);
PositionRelative(this->parent, this, 0, Q_16_16(-1.0));
switch (this->field_0x82.HALF.HI) {
case 0:
switch (this->frame & 0x70) {
+3 -3
View File
@@ -453,7 +453,7 @@ void VaatiWrathType0ActionA(Entity* this) {
this->subAction = 0;
this->direction = 0;
this->speed = 0x100;
this->zVelocity = 0x12000;
this->zVelocity = Q_16_16(1.125);
ChangeObjPalette(this, 0x16b);
InitAnimationForceUpdate(this, 5);
type1 = ((VaatiWrathHeapStruct*)this->myHeap)->type1;
@@ -828,11 +828,11 @@ u32 sub_0804207C(Entity* this) {
x = this->x.HALF.HI;
y = this->y.HALF.HI - 0x10;
arm = ((VaatiWrathHeapStruct*)this->myHeap)->arms[0];
if ((arm != NULL) && (arm->action >= 5) && sub_0806FCB8(arm, x, y, 0x30)) {
if ((arm != NULL) && (arm->action >= 5) && EntityWithinDistance(arm, x, y, 0x30)) {
return sub_080045D4(arm->x.HALF.HI, arm->y.HALF.HI, x, y);
} else {
arm = ((VaatiWrathHeapStruct*)this->myHeap)->arms[1];
if (((arm != NULL) && (arm->action >= 5)) && sub_0806FCB8(arm, x, y, 0x30)) {
if (((arm != NULL) && (arm->action >= 5)) && EntityWithinDistance(arm, x, y, 0x30)) {
return sub_080045D4(arm->x.HALF.HI, arm->y.HALF.HI, x, y);
} else {
if (gPlayerEntity.y.HALF.HI < 0x40) {
+1 -1
View File
@@ -148,7 +148,7 @@ void VaatiWrathEyeAction6(Entity* this) {
if (pEVar3 != NULL) {
pEVar3->parent = this;
this->child = pEVar3;
PositionRelative(this, pEVar3, 0, 0xc0000);
PositionRelative(this, pEVar3, 0, Q_16_16(12.0));
}
}
}
+1 -3
View File
@@ -9,8 +9,6 @@
#include "area.h"
#include "functions.h"
extern void sub_08001328(Entity*);
extern Entity* sub_08049DF4(u32);
extern ScreenTransitionData* gUnk_0813AB1C[];
void sub_0802A78C(Entity*);
@@ -94,7 +92,7 @@ void sub_0802A5B8(Entity* this) {
sub_0802A7D0(this);
if (this->actionDelay) {
if (--this->actionDelay == 0) {
EnqueueSFX(0x12d);
EnqueueSFX(SFX_12D);
InitializeAnimation(this, 0);
}
} else {
+2 -2
View File
@@ -41,7 +41,7 @@ void sub_0802CC80(Entity* this) {
this->action = 3;
COLLISION_OFF(this);
InitializeAnimation(this, 1);
gPlayerEntity.flags &= ~0x80;
gPlayerEntity.flags &= ~ENT_COLLIDE;
break;
}
if (this->field_0x43 != 0) {
@@ -125,7 +125,7 @@ void sub_0802CE68(Entity* this) {
gPlayerState.field_0xa |= 0x80;
gPlayerState.mobility |= 0x80;
gPlayerState.flags |= PL_DISABLE_ITEMS;
if (!sub_0806FCB8(this, gPlayerEntity.x.HALF.HI, gPlayerEntity.y.HALF.HI, 4)) {
if (!EntityWithinDistance(this, gPlayerEntity.x.HALF.HI, gPlayerEntity.y.HALF.HI, 4)) {
this->direction = GetFacingDirection(this, &gPlayerEntity);
LinearMoveUpdate(this);
}
+2 -2
View File
@@ -26,7 +26,7 @@ void sub_0802A250(Entity* this) {
this->action = 1;
this->actionDelay = 0;
this->zVelocity = -0x30000;
this->zVelocity = Q_16_16(-3.0);
this->speed = gUnk_080CD03C[Random() & 3];
this->direction = gUnk_080CD040[Random() & 3] + 0x18;
this->collisionLayer = 2;
@@ -43,7 +43,7 @@ void sub_0802A2B4(Entity* this) {
if (!GravityUpdate(this, 0x2800)) {
this->action = 2;
this->spritePriority.b0 = 7;
EnqueueSFX(0x84);
EnqueueSFX(SFX_WATER_SPLASH);
} else {
LinearMoveUpdate(this);
}
+1 -1
View File
@@ -54,7 +54,7 @@ bool32 EnemyInit(Entity* this) {
object->spritePriority.b0 = 3;
object->parent = this;
CopyPosition(this, object);
this->flags &= 0x7f;
this->flags &= ~ENT_COLLIDE;
this->spriteSettings.draw = 0;
this->field_0x6c.HALF.HI |= 0x10;
}
+14 -4
View File
@@ -245,9 +245,6 @@ void PlayerUpdate(Entity* this) {
}
// Responsible for some life things like low health beep and initiating the death sequence
#ifdef EU
ASM_FUNC("asm/non_matching/eu/HandlePlayerLife.inc", void HandlePlayerLife(Entity* this));
#else
void HandlePlayerLife(Entity* this) {
u32 temp;
@@ -280,6 +277,19 @@ void HandlePlayerLife(Entity* this) {
if ((gPlayerState.controlMode != CONTROL_ENABLED) || (gMessage.doTextBox & 0x7f))
return;
#ifdef EU
if ((gUnk_0200AF00.filler0[1] == 0) && gRoomTransition.frameCount % 90 == 0) {
temp = gSave.stats.maxHealth / 4;
if (temp > 24)
temp = 24;
if (temp < 8)
temp = 8;
if (gSave.stats.health <= temp) {
EnqueueSFX(SFX_LOW_HEALTH);
}
}
#else
gRoomVars.unk2 = gMessage.doTextBox & 0x7f;
temp = gSave.stats.maxHealth / 4;
if (temp > 24)
@@ -293,6 +303,7 @@ void HandlePlayerLife(Entity* this) {
EnqueueSFX(SFX_LOW_HEALTH);
}
}
#endif
if (gSave.stats.charm == 0) {
gSave.stats.charmTimer = 0;
@@ -318,7 +329,6 @@ void HandlePlayerLife(Entity* this) {
CreateFx(this, (FX_RED_AURA - 1) + gSave.stats.effect, 0);
}
}
#endif
void sub_080171F0(void) {
if (gPlayerState.mobility != 0)
+3 -3
View File
@@ -46,7 +46,7 @@ void sub_08077534(ItemBehavior* this, u32 arg1) {
sub_08077DF4(this, 0x610);
break;
}
gPlayerEntity.flags &= 0x7f;
gPlayerEntity.flags &= ~ENT_COLLIDE;
}
void sub_08077618(ItemBehavior* this, u32 arg1) {
@@ -61,7 +61,7 @@ void sub_08077618(ItemBehavior* this, u32 arg1) {
void sub_08077640(ItemBehavior* this, u32 arg1) {
UpdateItemAnim(this);
if ((this->field_0x5[9] & 0x80) != 0) {
gPlayerEntity.flags |= 0x80;
gPlayerEntity.flags |= ENT_COLLIDE;
sub_08077E78(this, arg1);
}
}
@@ -69,7 +69,7 @@ void sub_08077640(ItemBehavior* this, u32 arg1) {
void sub_0807766C(ItemBehavior* this, u32 arg1) {
UpdateItemAnim(this);
if ((this->field_0x5[9] & 0x80) != 0) {
gPlayerEntity.flags |= 0x80;
gPlayerEntity.flags |= ENT_COLLIDE;
sub_08077E78(this, arg1);
}
}
+2 -2
View File
@@ -20,7 +20,7 @@ void OcarinaUse(ItemBehavior* this, u32 arg1) {
this->field_0x5[4] |= 0xf;
gPlayerEntity.animationState = 0x04;
gPlayerEntity.spriteSettings.flipX = 0;
gPlayerEntity.flags &= 0x7f;
gPlayerEntity.flags &= ~ENT_COLLIDE;
gPlayerEntity.field_0x7a.HWORD = 2;
gPlayerState.flags |= PL_USE_OCARINA;
gPlayerState.field_0x27[0] = -1;
@@ -38,7 +38,7 @@ NONMATCH("asm/non_matching/ocarina/OcarinaUpdate.inc", void OcarinaUpdate(ItemBe
// TODO regalloc
UpdateItemAnim(this);
if ((this->field_0x5[9] & 0x80) != 0) {
gPlayerEntity.flags |= 0x80;
gPlayerEntity.flags |= ENT_COLLIDE;
gPlayerState.flags &= ~PL_USE_OCARINA;
gPlayerState.field_0x27[0] = 0;
gUnk_02034490.unk0 = 0;
+1 -1
View File
@@ -68,7 +68,7 @@ void sub_08076758(ItemBehavior* this, u32 arg1) {
if ((gPlayerEntity.zVelocity < 1) && ((gPlayerState.jump_status & 0x10) == 0)) {
this->stateID = 2;
gPlayerEntity.field_0x7a.HWORD = 2;
gPlayerEntity.zVelocity = 0x20000;
gPlayerEntity.zVelocity = Q_16_16(2.0);
gPlayerState.jump_status |= 0x10;
gPlayerState.animation = 0x288;
SoundReq(SFX_172);
+75 -4
View File
@@ -4,8 +4,11 @@
#include "object.h"
extern void (*const gUnk_0811BD44[])(ItemBehavior*, u32);
extern void sub_08077B98(ItemBehavior*);
void sub_080759B8(ItemBehavior*, u32);
void sub_080754B8(ItemBehavior*, u32);
void sub_08075898(ItemBehavior*, u32);
extern u32 sub_08077EC8(ItemBehavior*);
@@ -16,11 +19,79 @@ void ItemSword(ItemBehavior* this, u32 arg1) {
gUnk_0811BD44[this->stateID](this, arg1);
}
#ifdef EU
ASM_FUNC("asm/non_matching/eu/sub_08075338.inc", void sub_08075338(ItemBehavior* this, u32 arg1))
#else
ASM_FUNC("asm/non_matching/itemSword/sub_08075338.inc", void sub_08075338(ItemBehavior* this, u32 arg1))
void sub_08075338(ItemBehavior* this, u32 arg1) {
u32 temp, temp2;
if (gPlayerState.flags & 0x80) {
this->field_0x5[4] |= 0x80;
sub_08077D38(this, arg1);
gPlayerState.animation = 0xc00;
SoundReq(SFX_PLY_VO1);
return;
}
if (gPlayerState.jump_status) {
if ((gPlayerState.jump_status & 7) != 3) {
if ((gPlayerState.jump_status & 0x78) == 0 && (u32)gPlayerEntity.zVelocity <= 0x17fff &&
(gPlayerState.field_0xac & 0x40) && gPlayerEntity.z.WORD) {
gPlayerState.jump_status |= 0x20;
gPlayerState.field_0xab = 7;
gPlayerState.field_0x3[1] |= (8 >> arg1) | ((8 >> arg1) << 4);
sub_08077B98(this);
this->stateID = 6;
sub_08075898(this, arg1);
return;
}
}
#ifndef EU
sub_080759B8(this, arg1);
return;
} else if (gPlayerEntity.z.WORD) {
#endif
sub_080759B8(this, arg1);
return;
}
if (gPlayerState.flags & 0x40000) {
if ((gPlayerState.field_0xac & 2) == 0) {
if (gPlayerState.item == NULL)
return;
DeleteEntity(gPlayerState.item);
gPlayerState.item = NULL;
return;
}
sub_08077D38(this, arg1);
sub_08077B98(this);
temp = (8 >> arg1);
gPlayerState.field_0x3[1] |= temp | (temp << 4);
gPlayerState.field_0xa |= temp;
gPlayerState.keepFacing |= temp;
this->stateID = 8;
this->field_0x5[2] = 0x14;
this->field_0xf = 6;
this->field_0x5[4] |= 0x80;
gPlayerState.field_0xab = 2;
gPlayerState.flags |= 0x8000000;
sub_08077DF4(this, 0x130);
SoundReq(SFX_PLY_VO3);
return;
}
if ((gPlayerState.sword_state & 0x80) == 0) {
gPlayerState.sword_state = 0;
sub_0806F948(&gPlayerEntity);
}
if (gPlayerState.item) {
if (gPlayerState.item->id != 1) {
DeleteEntity(gPlayerState.item);
gPlayerState.item = NULL;
}
}
sub_08077D38(this, arg1);
sub_08077B98(this);
}
ASM_FUNC("asm/non_matching/itemSword/sub_080754B8.inc", void sub_080754B8(ItemBehavior* this, u32 arg1))
+1 -1
View File
@@ -30,7 +30,7 @@ void sub_08076488(ItemBehavior* this, u32 arg1) {
}
UpdateItemAnim(this);
if ((this->field_0x5[9] & 0x80) != 0) {
gPlayerEntity.flags |= 0x80;
gPlayerEntity.flags |= ENT_COLLIDE;
gPlayerState.heldObject = 4;
bVar1 = ~(8 >> arg1);
gPlayerState.keepFacing = bVar1 & gPlayerState.keepFacing;
+213 -19
View File
@@ -3,23 +3,39 @@
#include "screen.h"
#include "functions.h"
#include "common.h"
#include "main.h"
extern void sub_08056250(void);
extern void (*const gUnk_08107C5C[])(Entity*);
extern void (*const gUnk_08107C48[])(Entity*);
void (*const gUnk_08107C5C[])(Entity*);
void (*const gUnk_08107C48[])(Entity*);
const u16 gUnk_08107C1C[];
const u16 gUnk_08107C30[];
const u8 gManager1GfxGroups[];
extern u8 gUnk_08107C40[];
extern u16 gUnk_02017AA0[];
extern u16 gUnk_085B4180[];
typedef struct {
u8 unk0;
u8 unk1;
u8 unk2;
u8 unk3;
u8 unk4;
} PACKED Manager1Prop;
#define ZV(this) ((u8*)&this->zVelocity)
#define ZS(this) ((u8*)&this->speed)
void Manager1_Main(Entity* this) {
u8 bVar1;
u8* pbVar2;
gUnk_08107C5C[this->action](this);
gUnk_08107C48[((u8*)&this->zVelocity)[1]](this);
bVar1 = gUnk_08107C40[((u8*)&this->zVelocity)[1]];
if ((bVar1 != 0) && (*(u8*)&this->zVelocity != bVar1)) {
((u8*)&this->zVelocity)[0] = bVar1;
gUnk_08107C48[ZV(this)[1]](this);
bVar1 = gManager1GfxGroups[ZV(this)[1]];
if ((bVar1 != 0) && (ZV(this)[0] != bVar1)) {
ZV(this)[0] = bVar1;
LoadGfxGroup(bVar1);
}
}
@@ -27,9 +43,9 @@ void Manager1_Main(Entity* this) {
static void sub_080570B8(Entity* this) {
u8* pbVar1;
LoadGfxGroup(((u8*)&this->zVelocity)[0]);
LoadGfxGroup(ZV(this)[0]);
this->z.WORD = 0;
pbVar1 = ((u8*)&this->zVelocity + 1);
pbVar1 = &ZV(this)[1];
if (*pbVar1 == 3) {
gScreen.bg3.updated = 1;
} else {
@@ -45,9 +61,9 @@ static void sub_080570F8(void) {
void sub_08057118(Entity* this) {
this->actionDelay = 0;
*(u8*)&this->zVelocity = 0;
((u8*)&this->zVelocity)[1] = 0;
((u8*)&this->zVelocity)[2] = 0;
ZV(this)[0] = 0;
ZV(this)[1] = 0;
ZV(this)[2] = 0;
this->action = 1;
gScreen.bg3.control = 0x1e04;
gScreen.lcd.displayControl |= DISPCNT_BG3_ON;
@@ -56,16 +72,194 @@ void sub_08057118(Entity* this) {
RegisterTransitionManager(this, sub_080570B8, sub_080570F8);
}
ASM_FUNC("asm/non_matching/manager1/sub_08057174.inc", void sub_08057174())
// regalloc
NONMATCH("asm/non_matching/manager1/sub_08057174.inc", void sub_08057174(Entity* this)) {
Manager1Prop* prop = GetCurrentRoomProperty(this->type);
s32 temp;
s32 x;
s32 y;
ASM_FUNC("asm/non_matching/manager1/sub_0805728C.inc", void sub_0805728C())
if (prop->unk0 == 0xff)
return;
temp = gPlayerEntity.x.HALF.HI;
if (temp < 0) {
temp += 0xf;
}
ASM_FUNC("asm/non_matching/manager1/sub_080572D4.inc", void sub_080572D4())
x = temp >> 4;
temp = gPlayerEntity.y.HALF.HI;
if (temp < 0) {
temp += 0xf;
}
ASM_FUNC("asm/non_matching/manager1/sub_0805732C.inc", void sub_0805732C())
y = temp >> 4;
ASM_FUNC("asm/non_matching/manager1/nullsub_494.inc", void nullsub_494())
for (; prop->unk0 != 0xff; prop++) {
if (prop->unk0 != ZV(this)[1]) {
u32 x2 = (gRoomControls.origin_x >> 4) + prop->unk1;
u32 y2 = (gRoomControls.origin_y >> 4) + prop->unk2;
ASM_FUNC("asm/non_matching/manager1/sub_080573AC.inc", void sub_080573AC())
if (y - y2 < prop->unk4 && x - x2 < prop->unk3) {
switch (prop->unk0) {
case 1:
if (ZV(this)[1] == 2) {
this->action = 3;
this->actionDelay = 9;
}
break;
case 5:
if (ZV(this)[1] == 6) {
this->action = 3;
this->actionDelay = 9;
}
break;
case 2:
if (ZV(this)[1] == 0) {
this->action = 2;
this->actionDelay = 0;
ZV(this)[0] = 0;
}
break;
case 6:
if (ZV(this)[1] == 0) {
this->action = 2;
this->actionDelay = 0;
}
break;
case 4:
if (ZV(this)[1] == 0) {
this->action = 2;
this->actionDelay = 0;
this->z.WORD = 0;
}
break;
case 3:
if (ZV(this)[1] == 4) {
this->action = 3;
this->actionDelay = 9;
}
break;
}
ASM_FUNC("asm/non_matching/manager1/sub_08057450.inc", void sub_08057450())
if (this->action != 1) {
this->field_0xf = 8;
ZV(this)[1] = prop->unk0;
ZV(this)[2] = 1;
return;
}
}
}
}
}
END_NONMATCH
void sub_0805728C(Entity* this) {
if (--this->field_0xf == 0) {
this->field_0xf = 8;
gScreen.controls.alphaBlend = gUnk_08107C1C[this->actionDelay++];
if (this->actionDelay == 10) {
this->action = 1;
ZV(this)[2] = 0;
}
}
}
void sub_080572D4(Entity* this) {
if (--this->field_0xf == 0) {
this->field_0xf = 8;
gScreen.controls.alphaBlend = gUnk_08107C1C[this->actionDelay--];
if (this->actionDelay == 0xff) {
this->action = 1;
ZV(this)[2] = 0;
ZV(this)[1] = 0;
gScreen._6c = 0;
}
}
}
void sub_0805732C(u32 param_1, u32 param_2) {
u32 index;
u16* ptr = &gUnk_02017AA0[gUnk_03003DE4 * 0x500];
for (index = 0; index < 0xa0; ptr++, index++) {
*ptr = gSineTable[(param_2 + index) & 0xff] * param_1 / 0x100 + gScreen.bg3.xOffset;
}
sub_0805622C(&gUnk_02017AA0[gUnk_03003DE4 * 0x500], REG_ADDR_BG3HOFS, 0xa2600001UL);
}
void nullsub_494() {
}
void sub_080573AC(Entity* this) {
s32 sin, frameCount;
gRoomControls.bg3OffsetX.WORD -= 0x2000;
gRoomControls.bg3OffsetY.WORD -= 0x1000;
gScreen.bg3.xOffset = ((gRoomControls.scroll_x - gRoomControls.origin_x) >> 1) + gRoomControls.bg3OffsetX.HALF.HI;
gScreen.bg3.yOffset = ((gRoomControls.scroll_y - gRoomControls.origin_y) >> 1) + gRoomControls.bg3OffsetY.HALF.HI;
sin = gSineTable[(gRoomTransition.frameCount & 0xff) + 0x40];
sub_0805732C((sin >> 5) + 0x10, gRoomTransition.frameCount);
if (ZV(this)[2] == 0) {
if ((gRoomTransition.frameCount & 0x1f) == 0) {
ZS(this)[0] = (ZS(this)[0] + 1) & 7;
gScreen.controls.alphaBlend = gUnk_08107C30[ZS(this)[0]];
}
}
}
void sub_08057450(Entity* this) {
s32 y;
gScreen.bg3.xOffset = 0x10;
y = gRoomControls.scroll_y;
y -= gRoomControls.origin_y;
y >>= 2;
gScreen.bg3.yOffset = y & 0x3f;
gScreen.bg3.tilemap = &gBG3Buffer[(y / 0x40) << 8];
if ((void*)this->z.WORD != gScreen.bg3.tilemap) {
this->z.WORD = (u32)gScreen.bg3.tilemap;
gScreen.bg3.updated = 1;
}
if (ZV(this)[2] == 0 && (gRoomTransition.frameCount & 0x1f) == 0) {
ZS(this)[0] = (ZS(this)[0] + 1) & 7;
gScreen.controls.alphaBlend = gUnk_08107C30[ZS(this)[0]];
}
if ((gRoomTransition.frameCount & 0x7) == 0) {
u32 index;
u16* ptr = &gUnk_085B4180[(ZV(this)[3] << 4)];
for (index = 0, ptr = ptr + 7; index <= 3; index++) {
SetColor(index + 0x87, *(ptr + index));
SetColor(index + 0x8c, *(ptr + index + 5));
}
ZV(this)[3] = (ZV(this)[3] + 1) & 3;
}
}
const u16 gUnk_08107C1C[] = {
0x1000, 0xF01, 0xE02, 0xD03, 0xC04, 0xB05, 0xA06, 0x907, 0x908, 0x909,
};
const u16 gUnk_08107C30[] = {
0x909, 0xA08, 0xB07, 0xC06, 0xD05, 0xC06, 0xB07, 0xA08,
};
const u8 gManager1GfxGroups[] = {
0x25, 0x00, 0x24, 0x00, 0x25, 0x00, 0x00, 0x00,
};
void (*const gUnk_08107C48[])(Entity*) = {
nullsub_494, nullsub_494, sub_080573AC, nullsub_494, sub_08057450,
};
void (*const gUnk_08107C5C[])(Entity*) = {
sub_08057118,
sub_08057174,
sub_0805728C,
sub_080572D4,
};
+3 -3
View File
@@ -155,9 +155,9 @@ void sub_0805B210(Manager1A* this) {
gRoomTransition.player_status.room_next = tmp->unk_02;
gRoomTransition.player_status.layer = tmp->unk_03;
if (gPlayerState.flags & PL_MINISH) {
gRoomTransition.player_status.spawn_type = 6;
gRoomTransition.player_status.spawn_type = PL_SPAWN_DROP_MINISH;
} else {
gRoomTransition.player_status.spawn_type = 2;
gRoomTransition.player_status.spawn_type = PL_SPAWN_DROP;
}
switch (tmp->unk_00) {
case 0:
@@ -171,7 +171,7 @@ void sub_0805B210(Manager1A* this) {
case 2:
gRoomTransition.player_status.start_pos_x = tmp->unk_04;
gRoomTransition.player_status.start_pos_y = tmp->unk_06;
gRoomTransition.player_status.spawn_type = 6;
gRoomTransition.player_status.spawn_type = PL_SPAWN_DROP_MINISH;
break;
}
}
+1 -1
View File
@@ -11,7 +11,7 @@ ASM_FUNC("asm/non_matching/manager22/sub_0805BB00.inc", void sub_0805BB00())
ASM_FUNC("asm/non_matching/manager22/sub_0805BB74.inc", void sub_0805BB74())
ASM_FUNC("asm/non_matching/manager22/sub_0805BBBC.inc", void UpdateLightLevel())
ASM_FUNC("asm/non_matching/manager22/UpdateLightLevel.inc", void UpdateLightLevel())
ASM_FUNC("asm/non_matching/manager22/sub_0805BC04.inc", void sub_0805BC04())
+1 -1
View File
@@ -113,7 +113,7 @@ Entity* Manager28_FindMatchingEntity(EntityData* unk1) {
y = unk1->yPos + gRoomControls.origin_y;
tmp = &gEntityLists[4];
for (i = tmp->first; (u32)i != (u32)tmp; i = i->next) {
if (x == i->x.HALF.HI && y == i->y.HALF.HI && unk1->id == i->id && 3 == i->kind && unk1->type == i->type) {
if (x == i->x.HALF.HI && y == i->y.HALF.HI && unk1->id == i->id && ENEMY == i->kind && unk1->type == i->type) {
return i;
}
}
+1 -1
View File
@@ -25,7 +25,7 @@ void Manager2C_Main(Manager2C* manager) {
MemClear(&gRoomTransition.player_status, 0x20);
gRoomTransition.transitioningOut = 1;
gRoomTransition.type = TRANSITION_DEFAULT;
gRoomTransition.player_status.spawn_type = 0xb;
gRoomTransition.player_status.spawn_type = PL_SPAWN_PARACHUTE_UP;
gRoomTransition.player_status.area_next = manager->manager.unk_0b;
gRoomTransition.player_status.room_next = manager->manager.unk_0e;
gRoomTransition.player_status.start_anim = manager->field_0x37;
+4 -4
View File
@@ -91,9 +91,6 @@ u32 sub_0805795C(Manager* this, DiggingCaveEntrance* entr) {
extern void sub_08080930(u32);
#ifdef EU
ASM_FUNC("asm/non_matching/eu/sub_08057A18.inc", void sub_08057A18(Manager* this, DiggingCaveEntrance* entr))
#else
void sub_08057A18(Manager* this, DiggingCaveEntrance* entr) {
u16 tmp;
SetInitializationPriority();
@@ -106,6 +103,8 @@ void sub_08057A18(Manager* this, DiggingCaveEntrance* entr) {
gUnk_03004030.unk_00 = entr;
gUnk_03004030.unk_04 = gPlayerEntity.x.HALF.HI - gRoomControls.origin_x - ((entr->unk_00 & 0x3F) * 16);
gUnk_03004030.unk_06 = gPlayerEntity.y.HALF.HI - gRoomControls.origin_y - ((entr->unk_00 & 0xFC0) >> 2);
#ifndef EU
tmp = gUnk_03004030.unk_08;
if (!tmp) {
if ((entr->target_room | 0x80) != gUnk_03004030.unk_0b) {
@@ -113,10 +112,11 @@ void sub_08057A18(Manager* this, DiggingCaveEntrance* entr) {
}
gUnk_03004030.unk_0b = entr->target_room | 0x80;
}
#endif
sub_08080930(entr->unk_03);
DeleteManager(this);
}
#endif
DiggingCaveEntrance* sub_08057AA8(DiggingCaveEntrance* entr, int room) {
for (; entr->unk_00 != 0xFFFF; entr++) {
+52 -5
View File
@@ -55,7 +55,54 @@ const u32 gUnk_081080A4[0x50] = {
const u8 gUnk_081081E4[] = { 0x16, 0x17, 0x17, 0x18, 0x18 };
#ifdef EU
ASM_FUNC("asm/non_matching/eu/Manager7_Main.inc", void Manager7_Main(Manager7* this))
void Manager7_Main(Manager7* this) {
u32 tmp;
const u32* tmp2;
s32 tmp3;
if (!this->manager.action) {
this->manager.action = 1;
this->manager.unk_0e = 8;
this->unk_20 = 0xFF;
RegisterTransitionManager(this, sub_08057E30, 0);
}
if (gRoomControls.reload_flags)
return;
if (sub_08057E40(this)) {
tmp = (u32)gRoomVars.unk_10[0];
if (this->unk_20 != tmp) {
this->unk_20 = tmp;
this->manager.unk_0e = 0;
}
}
tmp2 = &gUnk_081080A4[tmp << 4];
tmp3 = this->manager.unk_0e;
if (tmp3 == 0) {
gUnk_02034490.unk0 = 1;
LoadResourceAsync(&gGlobalGfxAndPalettes[tmp2[0]], tmp2[1], 0x1000);
LoadPaletteGroup(gUnk_081081E4[tmp]);
this->manager.unk_0e++;
} else {
switch (tmp3) {
case 0:
case 1:
case 2:
case 3:
case 4:
case 5:
case 6:
case 7:
LoadResourceAsync(&gGlobalGfxAndPalettes[tmp2[(this->manager.unk_0e << 1)]],
tmp2[(this->manager.unk_0e << 1) + 1], 0x1000);
this->manager.unk_0e++;
gUnk_02034490.unk0 = 0;
case 8:
break;
}
}
}
#else
void Manager7_Main(Manager7* this) {
u32 tmp;
@@ -129,14 +176,15 @@ void sub_08057E64(void) {
}
}
#ifdef EU
ASM_FUNC("asm/non_matching/eu/sub_08057E7C.inc", void sub_08057E7C(u32 unk1))
#else
void sub_08057E7C(u32 unk1) {
u32 tmp;
const u32* tmp2;
#ifndef EU
if (unk1 > 4)
return;
#endif
LoadPaletteGroup(gUnk_081081E4[unk1]);
tmp2 = &gUnk_081080A4[unk1 << 4];
for (tmp = 0; tmp < 8; tmp++, tmp2 += 2) {
@@ -144,4 +192,3 @@ void sub_08057E7C(u32 unk1) {
}
gRoomVars.unk_10[0] = unk1;
}
#endif
+1 -1
View File
@@ -98,7 +98,7 @@ void ManagerB_LoadFight(Manager* this) {
if (prop) {
while (*((u8*)prop) != 0xFF) {
ent = LoadRoomEntity(prop++);
if (ent && (ent->kind == 3)) {
if (ent && (ent->kind == ENEMY)) {
ent->field_0x6c.HALF.HI |= 0x40;
ManagerBHelper_Monitor(monitor, ent, counter++);
}
+1 -2
View File
@@ -46,7 +46,6 @@ u32 sub_08058B08(ManagerC*, u32, u32, const struct_08108228*);
void sub_08058B5C(ManagerC*, u32);
extern void sub_0805622C(struct BgAffineDstData*, u32, u32);
extern void sub_080044AE(Entity*, u32, u32);
extern u8 gUnk_03003DE4[0xC];
@@ -207,7 +206,7 @@ const u16 gUnk_081082E8[0xC] = { 0xB8, 0x80, 0x0, 0xB8, 0x110, 0x2, 0x118, 0x80,
void sub_08058B5C(ManagerC* this, u32 unk1) {
gRoomTransition.transitioningOut = 1;
gRoomTransition.type = TRANSITION_DEFAULT;
gRoomTransition.player_status.spawn_type = 4;
gRoomTransition.player_status.spawn_type = PL_SPAWN_STEP_IN;
gRoomTransition.player_status.area_next = gRoomControls.area;
gRoomTransition.player_status.room_next = 6;
gRoomTransition.player_status.start_anim = unk1 & 1 ? 4 : 0;
+3 -3
View File
@@ -361,7 +361,7 @@ void sub_0805938C(ManagerF* this) {
u32 sub_080593CC(ManagerF* this) {
if (!(gPlayerState.flags & PL_MINISH) && gPlayerState.swim_state != 0 && gPlayerEntity.animationState == 0 &&
(gPlayerState.field_0x90 & 0xF00) == 0x400) {
return sub_0806FCB8(&gPlayerEntity, this->unk_38, this->unk_3a + 0xC, 6);
return EntityWithinDistance(&gPlayerEntity, this->unk_38, this->unk_3a + 0xC, 6);
}
return 0;
}
@@ -379,7 +379,7 @@ void sub_08059424(ManagerF* this) {
tmp->collisionLayer = 2;
tmp->x.HALF.HI = this->unk_38 + gRoomControls.origin_x;
tmp->y.HALF.HI = this->unk_3a + gRoomControls.origin_y;
EnqueueSFX(0x1B0);
EnqueueSFX(SFX_1B0);
DeleteThisEntity();
}
@@ -427,7 +427,7 @@ void sub_080594DC(ManagerF* this) {
#if defined(USA) || defined(DEMO_USA) || defined(DEMO_JP)
void sub_08059548(ManagerF* this) {
SetDefaultPriority((Entity*)this, PRIO_PLAYER_EVENT);
if (gPlayerEntity.action == 0x16) {
if (gPlayerEntity.action == PLAYER_TALKEZLO) {
DeleteThisEntity();
}
gInput.heldKeys |= 0x4;
+1 -1
View File
@@ -502,7 +502,7 @@ const u8 gUnk_08107C0F[] = { 0x8, 0x1e, 0x4, 0x12, 0x0 };
const u8 gUnk_08107C14[] = { 0x8, 0x1e, 0x8, 0xFE, 0x0 };
#ifdef EU
ASM_FUNC("asm/non_matching/eu/TextBoxHandlerQuestion.inc", static void TextDispEnquiry(TextRender* ctb))
ASM_FUNC("asm/non_matching/eu/TextDispEnquiry.inc", static void TextDispEnquiry(TextRender* ctb))
#else
static void TextDispEnquiry(TextRender* this) {
+1 -1
View File
@@ -26,7 +26,7 @@ s32 sub_080633C8(Entity* this);
void sub_0806346C(Entity* this);
void Beedle(Entity* this) {
if (this->flags & 0x2) {
if (this->flags & ENT_SCRIPTED) {
sub_08063410(this);
} else {
sub_080632C8(this);
+1 -1
View File
@@ -275,7 +275,7 @@ void sub_0806D4C0(Entity* this, u32 param) {
if (npc != NULL) {
npc->parent = this;
CopyPosition(this, npc);
ResolveEntityOnTop(this, npc);
SortEntityAbove(this, npc);
SetDefaultPriority(npc, PRIO_MESSAGE);
}
}
+2 -2
View File
@@ -35,7 +35,7 @@ extern EntityData gUnk_080F3494;
static void sub_08068BEC(Entity* this, u32 unused);
void BladeBrothers(Entity* this) {
if ((this->flags & 2) != 0) {
if ((this->flags & ENT_SCRIPTED) != 0) {
gUnk_081115D0[this->action](this);
} else {
gUnk_081115C0[this->action](this);
@@ -167,7 +167,7 @@ static void sub_08068BEC(Entity* this, u32 unused) {
target = CreateFx(this, FX_WHITE_SPLASH, 0);
if (target) {
target->spritePriority.b0 = 1;
PositionRelative(this, target, 0, -0x100000);
PositionRelative(this, target, 0, Q_16_16(-16.0));
SoundReq(SFX_FA);
}
}
+1 -1
View File
@@ -11,7 +11,7 @@ extern void (*gUnk_0810CAA0[])(Entity*);
extern Dialog gUnk_0810CAAC[];
void Brocco(Entity* this) {
if ((this->flags & 2) != 0) {
if ((this->flags & ENT_SCRIPTED) != 0) {
sub_0806362C(this);
} else {
sub_08063544(this);
+2 -2
View File
@@ -12,11 +12,11 @@ void Carlov(Entity* this) {
}
if ((this->frame & 0x10) != 0) {
this->frame = this->frame & 0xef;
EnqueueSFX(0x104);
EnqueueSFX(SFX_104);
InitScreenShake(0x10, 0);
}
if ((this->frame & 0x20) != 0) {
this->frame = this->frame & 0xdf;
EnqueueSFX(0x7c);
EnqueueSFX(SFX_PLY_JUMP);
}
}
+1 -1
View File
@@ -17,7 +17,7 @@ extern SpriteLoadData gUnk_0810F874[];
extern u32 _call_via_r0(u32*);
void Maid(Entity* this) {
if ((this->flags & 2) != 0) {
if ((this->flags & ENT_SCRIPTED) != 0) {
sub_08064570(this);
} else {
DeleteThisEntity();
+4 -4
View File
@@ -23,7 +23,7 @@ extern PosOffset gUnk_08110E78[];
extern PosOffset gUnk_08110E8A[];
void CastorWildsStatue(Entity* this) {
if ((this->flags & 2) != 0) {
if ((this->flags & ENT_SCRIPTED) != 0) {
gUnk_08110E5C[this->action](this);
} else {
gUnk_08110E4C[this->action](this);
@@ -103,7 +103,7 @@ void sub_08067534(Entity* this) {
entity->y.HALF.HI += 0x1c;
}
}
EnqueueSFX(0x14c);
EnqueueSFX(SFX_14C);
InitScreenShake(0x28, 4);
}
@@ -134,7 +134,7 @@ void sub_080675D4(Entity* this) {
ent->collisionLayer = this->collisionLayer;
ent->spriteOrientation.flipY = this->spriteOrientation.flipY;
ent->spriteRendering.b3 = this->spriteRendering.b3;
ResolveEntityOnTop(this, ent);
SortEntityAbove(this, ent);
}
};
gUnk = gUnk_08110E8A;
@@ -147,7 +147,7 @@ void sub_080675D4(Entity* this) {
ent->collisionLayer = this->collisionLayer;
ent->spriteOrientation.flipY = this->spriteOrientation.flipY;
ent->spriteRendering.b3 = this->spriteRendering.b3;
ResolveEntityOnTop(this, ent);
SortEntityAbove(this, ent);
}
};
if (this->subAction > 2) {
+1 -3
View File
@@ -40,8 +40,6 @@ extern u16 gUnk_08111104[];
extern u32 sub_0806FCA0(Entity*, Entity*);
extern Entity* sub_08049DF4(u32);
void sub_08067790(Entity* this) {
ShowNPCDialogue(this, &gUnk_08110EF8 + this->type * 10 + gSave.global_progress);
}
@@ -50,7 +48,7 @@ void sub_08067790(Entity* this) {
void Cat(Entity* ent) {
gCat[ent->action](ent);
sub_08067C44(ent);
if (((ent->flags & 128) == 0) && (ent->type != 5)) {
if (((ent->flags & ENT_COLLIDE) == 0) && (ent->type != 5)) {
sub_0806ED78(ent);
}
}

Some files were not shown because too many files have changed in this diff Show More