summaryrefslogtreecommitdiff
path: root/src/object
diff options
context:
space:
mode:
authornotyourav <65437533+notyourav@users.noreply.github.com>2022-07-23 11:16:08 -0700
committerGitHub <noreply@github.com>2022-07-23 11:16:08 -0700
commitccba86d292a0e4c8a0e07325ac4fb25e5a58dc89 (patch)
treefbe0b96a06f46a457e7c4ed54fa889d82746879b /src/object
parentaabd340b51c818bc5c46017298b59747be2e4bf6 (diff)
parent461841290a4f8f85bae303e0d2f4315830b34c6e (diff)
Merge pull request #536 from hatal175/various
Diffstat (limited to 'src/object')
-rw-r--r--src/object/chestSpawner.c9
-rw-r--r--src/object/object64.c10
-rw-r--r--src/object/specialFx.c184
3 files changed, 105 insertions, 98 deletions
diff --git a/src/object/chestSpawner.c b/src/object/chestSpawner.c
index 1c8527e1..04ca7420 100644
--- a/src/object/chestSpawner.c
+++ b/src/object/chestSpawner.c
@@ -307,7 +307,14 @@ void sub_080842D8(ChestSpawnerEntity* this) {
gUnk_0811F880,
gUnk_0811F88A,
};
- s32 index = -(-(super->x.HALF.HI & 8) >> 0x1f);
+ s32 index;
+
+ if ((super->x.HALF.HI & 8) != 0) {
+ index = 1;
+ } else {
+ index = 0;
+ }
+
if ((super->y.HALF.HI & 8) != 0) {
index += 2;
}
diff --git a/src/object/object64.c b/src/object/object64.c
index d1d6f62e..e0f20c1e 100644
--- a/src/object/object64.c
+++ b/src/object/object64.c
@@ -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;
diff --git a/src/object/specialFx.c b/src/object/specialFx.c
index a278428e..f0ec7d46 100644
--- a/src/object/specialFx.c
+++ b/src/object/specialFx.c
@@ -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);