Using sfx enum and some minor type changes

This commit is contained in:
Tal Hayon 2022-07-22 10:53:34 +03:00
parent dbe2cd55b2
commit fa1d806944
5 changed files with 115 additions and 119 deletions

View File

@ -21,7 +21,7 @@ extern u32 sub_08002632(struct Entity_*);
extern u32 CheckPlayerInRegion(u32 centerX, u32 centerY, u32 radiusX, u32 radiusY);
extern u32 GravityUpdate(struct Entity_*, u32);
extern u32 CheckOnScreen(struct Entity_*);
extern u32 EntityInRectRadius(struct Entity_*, struct Entity_*, u32, u32);
extern bool32 EntityInRectRadius(struct Entity_*, struct Entity_*, u32, u32);
extern void UpdateAnimationVariableFrames(struct Entity_*, u32);
extern u32 sub_080043E8(struct Entity_*);
extern void sub_08004484(struct Entity_*, struct Entity_*);

View File

@ -9,7 +9,7 @@ void sub_08069FE8(Entity*);
u32 sub_08069EF0(Entity*);
extern u8 gUnk_08111DA8[];
u32 sub_08069F90(Entity*);
bool32 sub_08069F90(Entity*);
void sub_08069F6C(Entity*);
void sub_08069D00(Entity*);
void sub_08069CB8(Entity*);
@ -24,9 +24,9 @@ extern u8 gUnk_08111E30[];
void sub_0806A080(Entity*);
extern Dialog gUnk_08111E34[];
extern Dialog gUnk_08111E34[][10];
extern u16 gUnk_08111F74[];
extern u16 gUnk_08111F74[][5];
extern u16 gUnk_08111FD8[];
@ -71,11 +71,7 @@ void sub_08069B44(Entity* this) {
(GetInventoryValue(ITEM_QST_DOGFOOD) != 2)) {
this->action = 4;
}
#if defined(JP) || defined(EU) || defined(DEMO_JP)
if ((this->type == 2) && (CheckLocalFlag(0xcc) == 0)) {
#else
if ((this->type == 2) && (CheckLocalFlag(0xcf) == 0)) {
#endif
if ((this->type == 2) && (CheckLocalFlag(MACHI_02_DOG) == 0)) {
SetTile(0x4072, TILE(this->x.HALF.HI, this->y.HALF.HI - 8), this->collisionLayer);
}
}
@ -83,7 +79,7 @@ void sub_08069B44(Entity* this) {
void sub_08069C40(Entity* this) {
UpdateAnimationSingleFrame(this);
if (sub_08069F90(this) != 0) {
if (sub_08069F90(this)) {
if ((gPlayerState.flags & PL_MINISH) != 0) {
sub_08069CB8(this);
} else {
@ -135,7 +131,7 @@ void sub_08069D00(Entity* this) {
void sub_08069D54(Entity* this) {
u16 collisions;
if (sub_08069F90(this) == 0) {
if (!sub_08069F90(this)) {
this->timer -= 1;
if (this->timer != 0) {
UpdateAnimationSingleFrame(this);
@ -161,7 +157,7 @@ void sub_08069D54(Entity* this) {
return;
}
}
if (sub_08069F90(this) != 0) {
if (sub_08069F90(this)) {
this->action = 1;
} else {
this->action = 3;
@ -171,7 +167,7 @@ void sub_08069D54(Entity* this) {
void sub_08069DF8(Entity* this) {
UpdateAnimationSingleFrame(this);
if (sub_08069F90(this) != 0) {
if (sub_08069F90(this)) {
this->action = 1;
} else {
this->timer -= 1;
@ -211,8 +207,8 @@ void sub_08069E50(Entity* this) {
this->action = 7;
InitAnimationForceUpdate(this, 0x29);
sub_080788E0(this);
EnqueueSFX(0xd1);
EnqueueSFX(0xcd);
EnqueueSFX(SFX_VO_DOG);
EnqueueSFX(SFX_TASK_COMPLETE);
}
}
@ -249,9 +245,9 @@ u32 sub_08069EF0(Entity* this) {
void Dog_Head(Entity* this) {
u32 frame;
frame = this->frame & 0xffffff7f;
frame = this->frame & ~ANIM_DONE;
if (frame != 0) {
frame = frame + this->field_0x68.HWORD;
frame += this->field_0x68.HWORD;
}
SetExtraSpriteFrame(this, 0, frame - 1);
SetExtraSpriteFrame(this, 1, this->frameIndex);
@ -266,9 +262,9 @@ void sub_08069F6C(Entity* this) {
}
}
u32 sub_08069F90(Entity* this) {
bool32 sub_08069F90(Entity* this) {
if ((this->type == 2) && (CheckLocalFlag(MACHI_02_DOG) == 0)) {
return 1;
return TRUE;
} else {
return EntityInRectRadius(this, &gPlayerEntity, 0x14, 0x14);
}
@ -313,7 +309,7 @@ void sub_0806A028(Entity* this) {
}
void sub_0806A080(Entity* this) {
ShowNPCDialogue(this, (Dialog*)&gUnk_08111E34 + this->type2 * 10 + gSave.global_progress);
ShowNPCDialogue(this, &(gUnk_08111E34[this->type2][gSave.global_progress]));
}
void sub_0806A0A4(Entity* this) {
@ -336,7 +332,7 @@ void sub_0806A0A4(Entity* this) {
}
}
}
MessageNoOverlap(gUnk_08111F74[(u32)gSave.global_progress * 5 + dialog], this);
MessageNoOverlap(gUnk_08111F74[gSave.global_progress][dialog], this);
}
void sub_0806A144(Entity* this) {

View File

@ -148,7 +148,7 @@ void sub_08060528(Entity* this) {
this->zVelocity = Q_16_16(2.0);
this->field_0x6c.HALF.HI = 1;
sub_080788E0(this);
EnqueueSFX(0x7c);
EnqueueSFX(SFX_PLY_JUMP);
} else {
this->field_0x6a.HWORD -= 1;
}

View File

@ -20,7 +20,7 @@ void sub_08093ED0(Object64Entity*);
void sub_08093EF0(Object64Entity*);
typedef struct {
u16 unk_0;
u16 sfx;
u8 unk_2;
u8 unk_3;
} struct_08122950;
@ -40,7 +40,7 @@ void Object64(Object64Entity* this) {
}
void sub_08093E3C(Object64Entity* this) {
const u16* ptr;
const struct_08122950* ptr;
super->action = 1;
super->flags &= 0x7f;
super->spriteSettings.draw = 1;
@ -48,9 +48,9 @@ void sub_08093E3C(Object64Entity* this) {
ResolveCollisionLayer(super);
}
InitializeAnimation(super, super->type);
ptr = &gUnk_08122950[super->type].unk_0;
if ((ptr[0] != 0) && ((super->type2 & 0x40) == 0)) {
EnqueueSFX(ptr[0]);
ptr = &gUnk_08122950[super->type];
if ((ptr->sfx != SFX_NONE) && ((super->type2 & 0x40) == 0)) {
EnqueueSFX(ptr->sfx);
}
if ((super->type2 & 0x20) != 0) {
super->spriteRendering.b3 = 1;

View File

@ -14,104 +14,104 @@ typedef struct {
u8 unk_00 : 4;
u8 unk_00_4 : 4;
u8 unk_01;
u16 unk_02;
u16 sfx;
} struct_0811F960;
// way more legible like this than if clang-format were to put multiple elements on each line
// clang-format off
const struct_0811F960 gUnk_0811F960[] = {
{0x1, 0x0, 0x00, 0x12D},
{0x0, 0x0, 0x00, 0x0FD},
{0x0, 0x0, 0x00, 0x124},
{0x0, 0x1, 0x11, 0x123},
{0x0, 0x1, 0x12, 0x164},
{0x0, 0x1, 0x13, 0x10D},
{0x0, 0x0, 0x00, 0x0FF},
{0x5, 0x1, 0x00, 0x000},
{0x0, 0x0, 0x00, 0x000},
{0x0, 0x0, 0x00, 0x000},
{0x0, 0x0, 0x00, 0x000},
{0x2, 0x1, 0x00, 0x084},
{0x2, 0x1, 0x00, 0x084},
{0x0, 0x0, 0x00, 0x195},
{0x0, 0x0, 0x00, 0x164},
{0x0, 0x0, 0x00, 0x10D},
{0x0, 0x1, 0x00, 0x074},
{0x0, 0x0, 0x00, 0x10C},
{0x5, 0x0, 0x00, 0x000},
{0x0, 0x0, 0x10, 0x123},
{0x5, 0x1, 0x00, 0x000},
{0x0, 0x0, 0x00, 0x164},
{0x0, 0x1, 0x14, 0x1A8},
{0x0, 0x1, 0x10, 0x088},
{0x0, 0x0, 0x00, 0x000},
{0x0, 0x0, 0x00, 0x000},
{0x0, 0x0, 0x00, 0x000},
{0x3, 0x0, 0x00, 0x197},
{0x3, 0x0, 0x00, 0x000},
{0x6, 0x1, 0x00, 0x074},
{0x3, 0x0, 0x00, 0x074},
{0x0, 0x0, 0x00, 0x074},
{0x0, 0x1, 0x00, 0x000},
{0x0, 0x1, 0x00, 0x000},
{0x0, 0x0, 0x00, 0x000},
{0x7, 0x0, 0x00, 0x000},
{0x0, 0x0, 0x00, 0x000},
{0x3, 0x1, 0x00, 0x000},
{0x8, 0x1, 0x00, 0x000},
{0x9, 0x1, 0x00, 0x15F},
{0x0, 0x0, 0x00, 0x000},
{0x0, 0x1, 0x00, 0x000},
{0x0, 0x1, 0x00, 0x000},
{0x2, 0x1, 0x00, 0x084},
{0x0, 0x0, 0x00, 0x074},
{0x0, 0x0, 0x00, 0x164},
{0xA, 0x1, 0x00, 0x000},
{0xA, 0x1, 0x00, 0x000},
{0x0, 0x0, 0x00, 0x000},
{0x0, 0x1, 0x00, 0x000},
{0x9, 0x1, 0x00, 0x15F},
{0x9, 0x1, 0x00, 0x15F},
{0x9, 0x1, 0x00, 0x15F},
{0x0, 0x0, 0x00, 0x000},
{0x2, 0x0, 0x00, 0x17F},
{0x0, 0x1, 0x11, 0x123},
{0x0, 0x1, 0x11, 0x123},
{0x0, 0x1, 0x11, 0x123},
{0x0, 0x1, 0x00, 0x000},
{0x0, 0x1, 0x00, 0x1B4},
{0x0, 0x1, 0x13, 0x164},
{0x0, 0x1, 0x00, 0x000},
{0x0, 0x1, 0x10, 0x088},
{0x0, 0x1, 0x10, 0x088},
{0x0, 0x1, 0x10, 0x088},
{0x0, 0x1, 0x00, 0x000},
{0x0, 0x1, 0x00, 0x000},
{0x0, 0x0, 0x00, 0x11D},
{0x0, 0x1, 0x00, 0x000},
{0x0, 0x0, 0x00, 0x164},
{0x0, 0x0, 0x00, 0x0FD},
{0x0, 0x0, 0x00, 0x0FD},
{0x0, 0x0, 0x00, 0x0FD},
{0x0, 0x1, 0x00, 0x000},
{0x0, 0x1, 0x00, 0x000},
{0x0, 0x1, 0x00, 0x000},
{0x0, 0x1, 0x00, 0x000},
{0xB, 0x1, 0x00, 0x000},
{0x0, 0x1, 0x00, 0x000},
{0x0, 0x1, 0x00, 0x000},
{0x0, 0x1, 0x00, 0x000},
{0x0, 0x1, 0x00, 0x0FD},
{0x2, 0x1, 0x00, 0x084},
{0x1, 0x0, 0x00, SFX_12D},
{0x0, 0x0, 0x00, SFX_ITEM_BOMB_EXPLODE},
{0x0, 0x0, 0x00, SFX_124},
{0x0, 0x1, 0x11, SFX_123},
{0x0, 0x1, 0x12, SFX_164},
{0x0, 0x1, 0x13, SFX_10D},
{0x0, 0x0, 0x00, SFX_FF},
{0x5, 0x1, 0x00, SFX_NONE},
{0x0, 0x0, 0x00, SFX_NONE},
{0x0, 0x0, 0x00, SFX_NONE},
{0x0, 0x0, 0x00, SFX_NONE},
{0x2, 0x1, 0x00, SFX_WATER_SPLASH},
{0x2, 0x1, 0x00, SFX_WATER_SPLASH},
{0x0, 0x0, 0x00, SFX_195},
{0x0, 0x0, 0x00, SFX_164},
{0x0, 0x0, 0x00, SFX_10D},
{0x0, 0x1, 0x00, SFX_METAL_CLINK},
{0x0, 0x0, 0x00, SFX_BUTTON_PRESS},
{0x5, 0x0, 0x00, SFX_NONE},
{0x0, 0x0, 0x10, SFX_123},
{0x5, 0x1, 0x00, SFX_NONE},
{0x0, 0x0, 0x00, SFX_164},
{0x0, 0x1, 0x14, SFX_1A8},
{0x0, 0x1, 0x10, SFX_88},
{0x0, 0x0, 0x00, SFX_NONE},
{0x0, 0x0, 0x00, SFX_NONE},
{0x0, 0x0, 0x00, SFX_NONE},
{0x3, 0x0, 0x00, SFX_197},
{0x3, 0x0, 0x00, SFX_NONE},
{0x6, 0x1, 0x00, SFX_METAL_CLINK},
{0x3, 0x0, 0x00, SFX_METAL_CLINK},
{0x0, 0x0, 0x00, SFX_METAL_CLINK},
{0x0, 0x1, 0x00, SFX_NONE},
{0x0, 0x1, 0x00, SFX_NONE},
{0x0, 0x0, 0x00, SFX_NONE},
{0x7, 0x0, 0x00, SFX_NONE},
{0x0, 0x0, 0x00, SFX_NONE},
{0x3, 0x1, 0x00, SFX_NONE},
{0x8, 0x1, 0x00, SFX_NONE},
{0x9, 0x1, 0x00, SFX_15F},
{0x0, 0x0, 0x00, SFX_NONE},
{0x0, 0x1, 0x00, SFX_NONE},
{0x0, 0x1, 0x00, SFX_NONE},
{0x2, 0x1, 0x00, SFX_WATER_SPLASH},
{0x0, 0x0, 0x00, SFX_METAL_CLINK},
{0x0, 0x0, 0x00, SFX_164},
{0xA, 0x1, 0x00, SFX_NONE},
{0xA, 0x1, 0x00, SFX_NONE},
{0x0, 0x0, 0x00, SFX_NONE},
{0x0, 0x1, 0x00, SFX_NONE},
{0x9, 0x1, 0x00, SFX_15F},
{0x9, 0x1, 0x00, SFX_15F},
{0x9, 0x1, 0x00, SFX_15F},
{0x0, 0x0, 0x00, SFX_NONE},
{0x2, 0x0, 0x00, SFX_LAVA_TILE_LAND},
{0x0, 0x1, 0x11, SFX_123},
{0x0, 0x1, 0x11, SFX_123},
{0x0, 0x1, 0x11, SFX_123},
{0x0, 0x1, 0x00, SFX_NONE},
{0x0, 0x1, 0x00, SFX_1B4},
{0x0, 0x1, 0x13, SFX_164},
{0x0, 0x1, 0x00, SFX_NONE},
{0x0, 0x1, 0x10, SFX_88},
{0x0, 0x1, 0x10, SFX_88},
{0x0, 0x1, 0x10, SFX_88},
{0x0, 0x1, 0x00, SFX_NONE},
{0x0, 0x1, 0x00, SFX_NONE},
{0x0, 0x0, 0x00, SFX_11D},
{0x0, 0x1, 0x00, SFX_NONE},
{0x0, 0x0, 0x00, SFX_164},
{0x0, 0x0, 0x00, SFX_ITEM_BOMB_EXPLODE},
{0x0, 0x0, 0x00, SFX_ITEM_BOMB_EXPLODE},
{0x0, 0x0, 0x00, SFX_ITEM_BOMB_EXPLODE},
{0x0, 0x1, 0x00, SFX_NONE},
{0x0, 0x1, 0x00, SFX_NONE},
{0x0, 0x1, 0x00, SFX_NONE},
{0x0, 0x1, 0x00, SFX_NONE},
{0xB, 0x1, 0x00, SFX_NONE},
{0x0, 0x1, 0x00, SFX_NONE},
{0x0, 0x1, 0x00, SFX_NONE},
{0x0, 0x1, 0x00, SFX_NONE},
{0x0, 0x1, 0x00, SFX_ITEM_BOMB_EXPLODE},
{0x2, 0x1, 0x00, SFX_WATER_SPLASH},
#ifndef EU
{0x0, 0x0, 0x18, 0x124},
{0x0, 0x0, 0x18, SFX_124},
#else
{0x0, 0x0, 0x16, 0x124},
{0x0, 0x0, 0x16, SFX_124},
#endif
{0xC, 0x0, 0x00, 0x124},
{0x0, 0x0, 0x00, 0x0FD},
{0xD, 0x1, 0x00, 0x000},
{0xD, 0x1, 0x00, 0x000},
{0xC, 0x0, 0x00, SFX_124},
{0x0, 0x0, 0x00, SFX_ITEM_BOMB_EXPLODE},
{0xD, 0x1, 0x00, SFX_NONE},
{0xD, 0x1, 0x00, SFX_NONE},
};
// clang-format on
@ -166,8 +166,8 @@ void sub_080844E0(SpecialFxObject* this) {
if (ptr->unk_00 == 6) {
super->speed = 0x40;
}
if (ptr->unk_02 && !(super->type2 & 0x40)) {
EnqueueSFX(ptr->unk_02);
if (ptr->sfx != SFX_NONE && !(super->type2 & 0x40)) {
EnqueueSFX(ptr->sfx);
}
if (super->type2 & 0x80) {
CreateRandomItemDrop(super, ptr->unk_01);