summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authornotyourav <65437533+notyourav@users.noreply.github.com>2022-11-21 10:05:33 -0800
committerGitHub <noreply@github.com>2022-11-21 10:05:33 -0800
commit03408debcd86ef85aa02a85680b4ebc26e53efb9 (patch)
treee9f679da3a024029733a6dfd1e5897c930aa4dc3 /src
parent1ceeac3c8498a84db73f9441d8aae4d3f84d4885 (diff)
parent44e4b69cdbf2925ae82fe6e6a7336b8ba90b67f0 (diff)
Merge pull request #584 from hatal175/LatestPrs
Diffstat (limited to 'src')
-rw-r--r--src/enemy/bombPeahat.c10
-rw-r--r--src/enemy/chuchuBoss.c11
-rw-r--r--src/enemy/dust.c69
-rw-r--r--src/enemy/eyegore.c4
-rw-r--r--src/enemy/gleerok.c111
-rw-r--r--src/enemy/helmasaur.c2
-rw-r--r--src/enemy/octorokBoss.c120
-rw-r--r--src/fileselect.c97
-rw-r--r--src/manager/minishPortalManager.c2
-rw-r--r--src/npc/simon.c2
-rw-r--r--src/npc/syrup.c2
-rw-r--r--src/object/bigIceBlock.c2
-rw-r--r--src/object/frozenOctorok.c15
-rw-r--r--src/object/frozenWaterElement.c4
-rw-r--r--src/object/gyorgBossObject.c2
-rw-r--r--src/object/objectOnPillar.c6
-rw-r--r--src/object/pushableStatue.c6
-rw-r--r--src/object/smallIceBlock.c4
-rw-r--r--src/objectDefinitions.c2
-rw-r--r--src/objectUtils.c2
-rw-r--r--src/playerItem/playerItemSword.c45
-rw-r--r--src/room.c2
-rw-r--r--src/roomInit.c4
-rw-r--r--src/scroll.c18
24 files changed, 323 insertions, 219 deletions
diff --git a/src/enemy/bombPeahat.c b/src/enemy/bombPeahat.c
index a3e4ea60..96dbcba4 100644
--- a/src/enemy/bombPeahat.c
+++ b/src/enemy/bombPeahat.c
@@ -515,7 +515,7 @@ void sub_0802AF9C(Entity* this) {
}
}
-NONMATCH("asm/non_matching/bombPeahat/sub_0802AFC8.inc", void sub_0802AFC8(Entity* this)) {
+void sub_0802AFC8(Entity* this) {
u32 subtimer = this->subtimer;
u32 flag = 8;
if (subtimer < 0x29) {
@@ -526,13 +526,12 @@ NONMATCH("asm/non_matching/bombPeahat/sub_0802AFC8.inc", void sub_0802AFC8(Entit
} else {
this->field_0x82.HWORD += 0x10;
}
- tmp2 = this->field_0x82.HWORD;
- tmp = tmp2 & 0xf0;
+ tmp = this->field_0x82.HWORD & 0xf0;
if (tmp == 0 || tmp > 0x80) {
this->field_0x82.HWORD ^= 0x8000;
}
- tmp = 0x130 - (this->field_0x82.HWORD & 0xf0);
- SetAffineInfo(this, tmp, tmp, 0);
+ tmp = this->field_0x82.HWORD & 0xf0;
+ SetAffineInfo(this, 0x130 - tmp, 0x130 - tmp, 0);
}
if (this->subtimer & flag) {
this->palette.b.b0 = this->palette.b.b4;
@@ -540,7 +539,6 @@ NONMATCH("asm/non_matching/bombPeahat/sub_0802AFC8.inc", void sub_0802AFC8(Entit
this->palette.b.b0 = 0;
}
}
-END_NONMATCH
void sub_0802B048(Entity* this) {
Entity* ent;
diff --git a/src/enemy/chuchuBoss.c b/src/enemy/chuchuBoss.c
index af373d39..ab565a0d 100644
--- a/src/enemy/chuchuBoss.c
+++ b/src/enemy/chuchuBoss.c
@@ -327,7 +327,7 @@ void ChuchuBoss_OnTick(ChuchuBossEntity* this) {
gUnk_080CC1B0[super->action](this);
}
-NONMATCH("asm/non_matching/chuchuBoss/sub_08025DD8.inc", void sub_08025DD8(ChuchuBossEntity* this)) {
+void sub_08025DD8(ChuchuBossEntity* this) {
super->action = 1;
if (super->type == 8) {
super->type = 4;
@@ -346,7 +346,7 @@ NONMATCH("asm/non_matching/chuchuBoss/sub_08025DD8.inc", void sub_08025DD8(Chuch
switch (super->type & 3) {
Hitbox* hitbox;
case 0:
- super->type2 = super->type & 3;
+ super->type2 = super->type;
this->unk_84 = zMalloc(sizeof(Helper));
if (!this->unk_84 || !AllocMutableHitbox(super)) {
GenericDeath(super);
@@ -376,6 +376,7 @@ NONMATCH("asm/non_matching/chuchuBoss/sub_08025DD8.inc", void sub_08025DD8(Chuch
this->unk_68->base.y.HALF.HI = super->y.HALF.HI - 0xE;
this->unk_68->base.timer = 0xE;
this->unk_68->base.parent = super;
+ MEMORY_BARRIER;
this->unk_68->unk_68 = this;
}
super->parent = CreateEnemy(CHUCHU_BOSS, super->type | 2);
@@ -385,6 +386,7 @@ NONMATCH("asm/non_matching/chuchuBoss/sub_08025DD8.inc", void sub_08025DD8(Chuch
super->parent->y.HALF.HI = this->unk_68->base.y.HALF.HI - 0x12;
super->parent->timer = 0x12;
super->parent->parent = (Entity*)this->unk_68;
+ MEMORY_BARRIER;
this->unk_68->base.child = super->parent;
((ChuchuBossEntity*)super->parent)->unk_68 = this;
}
@@ -417,7 +419,9 @@ NONMATCH("asm/non_matching/chuchuBoss/sub_08025DD8.inc", void sub_08025DD8(Chuch
}
}
break;
- case 1 ... 3:
+ case 1:
+ case 2:
+ case 3:
hitbox = super->hitbox;
if (!AllocMutableHitbox(super)) {
this->unk_68->base.health = 0;
@@ -437,7 +441,6 @@ NONMATCH("asm/non_matching/chuchuBoss/sub_08025DD8.inc", void sub_08025DD8(Chuch
sub_08026060(this);
}
}
-END_NONMATCH
void sub_08026060(ChuchuBossEntity* this) {
gUnk_080CC1C8[super->type](this);
diff --git a/src/enemy/dust.c b/src/enemy/dust.c
index 9880333a..ead2273a 100644
--- a/src/enemy/dust.c
+++ b/src/enemy/dust.c
@@ -167,69 +167,65 @@ void sub_080442A0(DustEntity* this) {
extern const u8 gUnk_080D15B4[];
-NONMATCH("asm/non_matching/dust/sub_080442BC.inc", void sub_080442BC(DustEntity* this)) {
- u32 bVar1;
+void sub_080442BC(DustEntity* this) {
+ u32 hitboxCount;
u32 i;
- u32 tmp;
const u8* ptr = gUnk_080D15B4;
- u8* ptr2;
-
- bVar1 = HEAP->unk_0;
-
- for (i = 0; i < bVar1; i++) {
- tmp = 0;
- super->hitbox[i + 1].unk2[2] = ptr[0];
- super->hitbox[i + 1].unk2[3] = ptr[1];
- super->hitbox[i + 1].width = ptr[2];
- super->hitbox[i + 1].height = ptr[3];
- // hitbox is probably misused here.
- super->hitbox[i + 1].offset_x = tmp;
- super->hitbox[i + 2].offset_y = (s8)i;
+ hitboxCount = HEAP->unk_0;
+
+ for (i = 0; i < hitboxCount; i++) {
+ ((Hitbox3D*)&super->hitbox[i])[1].offset_x = ptr[0];
+ ((Hitbox3D*)&super->hitbox[i])[1].offset_y = ptr[1];
+ ((Hitbox3D*)&super->hitbox[i])[1].unknown[0] = ptr[2];
+ ((Hitbox3D*)&super->hitbox[i])[1].unknown[1] = ptr[3];
+ ((Hitbox3D*)&super->hitbox[i])[1].unknown[2] = 0;
+ ((Hitbox3D*)&super->hitbox[i])[1].unknown[3] = i;
}
- this->unk_74 = bVar1;
+ this->unk_74 = hitboxCount;
}
-END_NONMATCH
// heap and hitbox struct
-NONMATCH("asm/non_matching/dust/sub_08044310.inc", void sub_08044310(DustEntity* this)) {
+void sub_08044310(DustEntity* this) {
Entity* iVar1;
u32 bVar2;
- Hitbox* pHVar3;
- DustHeap* puVar4;
u32 i;
- u8* puVar6;
u32 uVar7;
- Hitbox* pHVar8;
u8* pbVar9;
u32 tmp;
+ DustHeap* reg7;
uVar7 = 0xff;
tmp = 0xff;
- switch (gPlayerEntity.animationState >> 1 & 3) {
+
+ switch (gPlayerEntity.animationState / 2 & 3) {
case 0:
for (i = 0; i < this->unk_74; i++) {
- if (((u8)super->hitbox[i + 2].offset_x == 0) && (tmp > (u32)super->hitbox[i + 1].unk2[3])) {
+ if ((((Hitbox3D*)&super->hitbox[i])[1].unknown[2] == 0) &&
+ (tmp > (u8)((Hitbox3D*)&super->hitbox[i])[1].offset_y)) {
uVar7 = i;
}
}
break;
case 1:
for (i = 0; i < this->unk_74; i++) {
- if (((u8)super->hitbox[i + 2].offset_x == 0) && (tmp > (u8)super->hitbox[i + 1].width)) {
+ if ((((Hitbox3D*)&super->hitbox[i])[1].unknown[2] == 0) &&
+ (tmp > ((Hitbox3D*)&super->hitbox[i])[1].unknown[0])) {
uVar7 = i;
}
}
break;
case 2:
for (i = 0; i < this->unk_74; i++) {
- if ((u8)super->hitbox[i + 2].offset_x == 0 && (tmp > (u8)super->hitbox[i + 1].unk2[2])) {
+ if ((((Hitbox3D*)&super->hitbox[i])[1].unknown[2] == 0) &&
+ (tmp > (u8)((Hitbox3D*)&super->hitbox[i])[1].offset_x)) {
uVar7 = i;
}
}
break;
case 3:
for (i = 0; i < this->unk_74; i++) {
- if (((u8)super->hitbox[i + 2].offset_x == 0) && (tmp > super->hitbox[i + 1].height)) {
+ if ((((Hitbox3D*)&super->hitbox[i])[1].unknown[2] == 0) &&
+ (tmp > ((Hitbox3D*)&super->hitbox[i])[1].unknown[1])) {
uVar7 = i;
}
}
@@ -239,9 +235,9 @@ NONMATCH("asm/non_matching/dust/sub_08044310.inc", void sub_08044310(DustEntity*
if (uVar7 != 0xff) {
super->hitbox[uVar7 + 2].offset_x = 1;
HEAP->unk_0--;
- puVar4 = HEAP;
- bVar2 = puVar4->unk_0;
- pbVar9 = &puVar4->items[(u32)(u8)super->hitbox[uVar7 + 2].offset_y].unk_1;
+ reg7 = HEAP + 1 + HEAP->unk_0 * 5;
+ bVar2 = HEAP->unk_0;
+ pbVar9 = &HEAP->items[(u32)(u8)super->hitbox[uVar7 + 2].offset_y].unk_0;
iVar1 = CreateEnemy(DUST, 1);
if (iVar1 != 0) {
PositionRelative(super, iVar1, ((s8)*pbVar9 + 8) * 0x10000, ((s8)pbVar9[1] + 8) * 0x10000);
@@ -254,18 +250,17 @@ NONMATCH("asm/non_matching/dust/sub_08044310.inc", void sub_08044310(DustEntity*
}
for (i = 0; i < 5; i++) {
- pbVar9[i] = (&puVar4->unk_0)[i];
+ pbVar9[i] = reg7[i].unk_0;
}
for (i = 0; i < this->unk_74; i++) {
- if ((u8)super->hitbox[i + 2].offset_y == HEAP->unk_0) {
- super->hitbox[i].unk2[3] = super->hitbox[uVar7 + 2].offset_y;
- return;
+ if (((Hitbox3D*)&super->hitbox[i])[1].unknown[3] == HEAP->unk_0) {
+ ((Hitbox3D*)&super->hitbox[i])[1].unknown[3] = super->hitbox[uVar7 + 2].offset_y;
+ break;
}
}
}
}
-END_NONMATCH
void sub_08044498(DustEntity* this) {
Entity* pEVar1;
@@ -288,7 +283,7 @@ void sub_08044498(DustEntity* this) {
for (i = 0; i < uVar4; i++) {
if (xdiff - pbVar2[i].unk_0 < 0x10 && ydiff - pbVar2[i].unk_1 < 0x10) {
- pEVar1 = CreateObject(SPECIAL_FX, 0x11, 0);
+ pEVar1 = CreateObject(SPECIAL_FX, FX_DASH, 0);
if (pEVar1 == NULL) {
return;
}
diff --git a/src/enemy/eyegore.c b/src/enemy/eyegore.c
index 7e308ab8..f0c8efd5 100644
--- a/src/enemy/eyegore.c
+++ b/src/enemy/eyegore.c
@@ -314,13 +314,13 @@ void sub_08030E80(EyegoreEntity* this) {
-11, 9, 11, 9, -9, -2, -8, 10, -11, -1, 11, -1, 9, -2, 8, 10,
};
u32 tmp = super->animationState << 2;
- Entity* effect = CreateObject(SPECIAL_FX, 2, 0);
+ Entity* effect = CreateObject(SPECIAL_FX, FX_DEATH, 0);
if (effect != NULL) {
CopyPosition(super, effect);
effect->x.HALF.HI += gUnk_080CE2F4[tmp + 0];
effect->y.HALF.HI += gUnk_080CE2F4[tmp + 1];
}
- effect = CreateObject(SPECIAL_FX, 2, 0);
+ effect = CreateObject(SPECIAL_FX, FX_DEATH, 0);
if (effect != NULL) {
CopyPosition(super, effect);
effect->x.HALF.HI += gUnk_080CE2F4[tmp + 2];
diff --git a/src/enemy/gleerok.c b/src/enemy/gleerok.c
index 3921b18f..c1a569a3 100644
--- a/src/enemy/gleerok.c
+++ b/src/enemy/gleerok.c
@@ -307,16 +307,12 @@ void Gleerok_OnTick(GleerokEntity* this) {
super->spriteRendering.b3 = 3;
}
-NONMATCH("asm/non_matching/gleerok/sub_0802D3B8.inc", void sub_0802D3B8(GleerokEntity* this)) {
- u32 uvar1;
- Entity* ent;
+void sub_0802D3B8(GleerokEntity* this) {
+ u32 tmp1;
Gleerok_HeapStruct* heap;
- u32 val;
- Gleerok_HeapStruct2* ptr;
- Gleerok_HeapStruct2* ptr2;
if (CheckGlobalFlag(LV2_CLEAR)) {
- gScreen.lcd.displayControl &= 0xFDFF;
+ gScreen.lcd.displayControl &= 0xfdff;
sub_0807AABC(&gPlayerEntity);
DeleteThisEntity();
}
@@ -334,7 +330,7 @@ NONMATCH("asm/non_matching/gleerok/sub_0802D3B8.inc", void sub_0802D3B8(GleerokE
this->unk_7c.WORD = 0x96;
sub_0802EB9C(this);
- this->unk_84 = zMalloc(0x54);
+ this->unk_84 = zMalloc(sizeof(Gleerok_HeapStruct));
heap = this->unk_84;
if (heap == NULL) {
@@ -343,38 +339,36 @@ NONMATCH("asm/non_matching/gleerok/sub_0802D3B8.inc", void sub_0802D3B8(GleerokE
}
super->myHeap = this->unk_84;
- uvar1 = 0;
- do {
+ for (tmp1 = 0; tmp1 < 5; tmp1++) {
super->child = CreateEnemy(GLEEROK, 1);
if (super->child != NULL) {
- super->child->type2 = uvar1 + 1;
+ super->child->type2 = tmp1 + 1;
super->child->collisionLayer = super->collisionLayer;
super->child->x.HALF.HI = super->x.HALF.HI;
- super->child->y.HALF.HI = super->y.HALF.HI + ((uvar1 + 1) * 12);
+ super->child->y.HALF.HI = super->y.HALF.HI + ((tmp1 + 1) * 12);
super->child->parent = super;
((GleerokEntity*)super->child)->unk_84 = this->unk_84;
- this->unk_84->entities[uvar1] = super->child;
- ptr = this->unk_84->filler;
- ptr2 = ptr + uvar1;
- ptr2[0].unk0.HALF.HI = 0x10;
- ptr2[6].unk0.HALF.HI = 0;
- ptr[13].unk0.HALF.HI = 0;
+ MEMORY_BARRIER;
+ heap->entities[tmp1] = super->child;
+ heap->filler[tmp1].unk0.HALF.HI = 0x10;
+ heap->filler2[tmp1].unk0.HALF.HI = 0;
+ heap->unk_30[5] = 0;
}
- } while (++uvar1 < 5);
+ }
- ent = CreateEnemy(GLEEROK, 2);
- super->child = ent;
- if (ent != NULL) {
+ super->child = CreateEnemy(GLEEROK, 2);
+ if (super->child != NULL) {
super->child->collisionLayer = super->collisionLayer;
super->child->x.HALF.HI = super->x.HALF.HI;
- super->child->y.HALF.HI = super->y.HALF.HI + ((uvar1 + 1) * 12);
+ super->child->y.HALF.HI = super->y.HALF.HI + ((tmp1 + 1) * 12);
super->child->parent = super;
((GleerokEntity*)super->child)->unk_84 = this->unk_84;
+ MEMORY_BARRIER;
heap->ent2 = super->child;
heap->filler[5].unk0.HALF.HI = 0x10;
heap->filler2[5].unk0.HALF.HI = 0;
- heap->filler[13].unk0.HALF.HI = 0;
+ heap->unk_30[5] = 0;
}
#ifndef EU
gPlayerState.controlMode = CONTROL_DISABLED;
@@ -386,6 +380,7 @@ NONMATCH("asm/non_matching/gleerok/sub_0802D3B8.inc", void sub_0802D3B8(GleerokE
COLLISION_ON(super);
super->flags2 |= 0x80;
}
+
super->spritePriority.b0 = gUnk_080CD7C4[super->type2].unk0.HALF.HI;
super->subtimer = 0;
InitializeAnimation(super, 0x24);
@@ -422,7 +417,6 @@ NONMATCH("asm/non_matching/gleerok/sub_0802D3B8.inc", void sub_0802D3B8(GleerokE
sub_0802D86C(this);
}
}
-END_NONMATCH
void sub_0802D650(GleerokEntity* this) {
#ifdef EU
@@ -1221,17 +1215,15 @@ void sub_0802E4C0(GleerokEntity* this) {
sub_0802E518(this);
}
-NONMATCH("asm/non_matching/gleerok/sub_0802E518.inc", void sub_0802E518(GleerokEntity* this)) {
- u32 index;
+void sub_0802E518(GleerokEntity* this) {
+ Gleerok_HeapStruct* heap;
+ s32 result;
u32 r6;
- u32 sp4;
- u32 sp8;
- s32 r7;
- Gleerok_HeapStruct* heap = this->unk_84;
- CopyPosition(heap->entities[0]->parent, heap->entities[0]);
- heap->entities[0]->direction = heap->filler->unk0.HALF.HI;
+ u32 r7;
- r6 = heap->filler->unk0.HALF.HI;
+ heap = this->unk_84;
+ CopyPosition(heap->entities[0]->parent, heap->entities[0]);
+ r6 = (heap->entities[0]->direction = heap->filler->unk0.HALF.HI);
if (r6 > 0x10) {
r6 ^= 0xf;
r6 = (r6 + 1) & 0xf;
@@ -1243,21 +1235,16 @@ NONMATCH("asm/non_matching/gleerok/sub_0802E518.inc", void sub_0802E518(GleerokE
heap->entities[0]->speed = ((r6 ^ 0xf) + 0x12) << 8;
LinearMoveUpdate(heap->entities[0]);
- sp4 = *(u32*)&heap->unk_30;
- sp8 = this->unk_80;
- for (index = 0; index <= 4; index++) {
- s32 result;
- CopyPosition(heap->entities[index], heap->entities[index + 1]);
- result = FixedMul(gSineTable[heap->filler2[(index + 1)].unk0.HALF.HI * 8], (heap->unk_30)[r6] << 8);
+ for (r6 = 0; r6 <= 4; r6++) {
+ CopyPosition(heap->entities[r6], heap->entities[r6 + 1]);
+ result = FixedMul(gSineTable[heap->filler2[(r6 + 1)].unk0.HALF.HI * 8], (heap->unk_30)[r6] << 8);
result = FixedDiv(result, 0x100);
- result = FixedMul(gSineTable[heap->filler[(index + 1)].unk0.HALF.HI * 8], result);
- result = FixedDiv(result, 0x100);
- heap->entities[index]->x.WORD += result << 8;
+ result = FixedMul(gSineTable[heap->filler[(r6 + 1)].unk0.HALF.HI * 8], result);
+ heap->entities[r6 + 1]->x.WORD += FixedDiv(result, 0x100) << 8;
- result = FixedMul(gSineTable[heap->filler2[(index + 1)].unk0.HALF.HI * 8 + 0x40], (heap->unk_30)[r6] << 8);
- result = FixedDiv(result, 0x100);
- heap->entities[index]->y.WORD -= result << 8;
+ result = FixedMul(gSineTable[heap->filler2[(r6 + 1)].unk0.HALF.HI * 8 + 0x40], (heap->unk_30)[r6] << 8);
+ heap->entities[r6 + 1]->y.WORD -= FixedDiv(result, 0x100) << 8;
}
if (heap->ent2->timer == 24) {
@@ -1275,17 +1262,16 @@ NONMATCH("asm/non_matching/gleerok/sub_0802E518.inc", void sub_0802E518(GleerokE
if (this->unk_80 == 0) {
sub_0802E7CC(heap, 5, 0, 0);
r7 = (heap->ent2->animationState + (heap->ent2->animationState >> 1));
- r7 = (r7 >> 2) + heap->ent2->timer;
+ r7 >>= 2;
+ r7 += heap->ent2->timer;
} else {
if (super->iframes == 0) {
if ((super->animIndex != (heap->filler[5].unk0.HALF.HI >> 3) + 0x2f)) {
r7 = (heap->filler[5].unk0.HALF.HI >> 3) + 0x28;
+ } else if ((super->frame & ANIM_DONE) != 0) {
+ r7 = (heap->filler[5].unk0.HALF.HI >> 3) + 0x28;
} else {
- if ((super->frame & ANIM_DONE) != 0) {
- r7 = (heap->filler[5].unk0.HALF.HI >> 3) + 0x28;
- } else {
- r7 = super->animIndex;
- }
+ r7 = super->animIndex;
}
} else {
r7 = (heap->filler[5].unk0.HALF.HI >> 3) + 0x2f;
@@ -1299,22 +1285,25 @@ NONMATCH("asm/non_matching/gleerok/sub_0802E518.inc", void sub_0802E518(GleerokE
}
}
- for (index = 0; index <= 4; index++) {
+ for (r6 = 0; r6 <= 4; r6++) {
if (this->unk_80 == 0) {
+ s8 x = 3;
u32 val;
- sub_0802E7CC(heap, (u8)index, 0, 0);
- r7 = heap->entities[index]->animationState * 12;
- r7 += (((s32)heap->filler2[(index + 1)].unk0.HALF.HI) / 3) * 12;
+ sub_0802E7CC(heap, (u8)r6, 0, 0);
+ val = heap->entities[r6]->animationState;
+ r7 = val + (val >> 1);
+ r7 >>= 2;
+ r7 += (u8)(heap->filler2[r6 + 1].unk0.HALF.HI / x) * 12;
} else {
- r7 = heap->filler[index].unk0.HALF.HI >> 3;
- r7 += 0x48;
+ u32 val;
+ val = heap->filler[r6].unk0.HALF.HI >> 3;
+ r7 = val + 0x48;
}
- if (heap->entities[index]->animIndex != r7) {
- InitializeAnimation(heap->entities[index], r7);
+ if (heap->entities[r6]->animIndex != r7) {
+ InitializeAnimation(heap->entities[r6], r7);
}
}
}
-END_NONMATCH
void sub_0802E768(Gleerok_HeapStruct* param_1) {
u32 cVar1;
diff --git a/src/enemy/helmasaur.c b/src/enemy/helmasaur.c
index 0e689c45..18976674 100644
--- a/src/enemy/helmasaur.c
+++ b/src/enemy/helmasaur.c
@@ -353,7 +353,7 @@ bool32 sub_0802C0E8(Entity* this) {
void sub_0802C18C(Entity* this) {
this->field_0x78.HALF.LO--;
if ((this->field_0x78.HALF.LO & 7) == 0) {
- Entity* ent = CreateObject(SPECIAL_FX, 0x11, 0x40);
+ Entity* ent = CreateObject(SPECIAL_FX, FX_DASH, 0x40);
if (ent != NULL) {
PositionRelative(this, ent, 0, Q_16_16(1.0));
}
diff --git a/src/enemy/octorokBoss.c b/src/enemy/octorokBoss.c
index e4a9ca68..d8931e9c 100644
--- a/src/enemy/octorokBoss.c
+++ b/src/enemy/octorokBoss.c
@@ -317,7 +317,125 @@ const u8 gUnk_080CF08C[] = {
0, 4, 0, 0, 1, 5, 0, 0, 1, 4, 0, 0, 1, 3, 0, 0, 1, 2, 0, 0, 2, 1, 0, 0, 1, 1, 0, 0, 3, 6, 0, 0,
};
-ASM_FUNC("asm/non_matching/octorokBoss/OctorokBoss_Init.inc", void OctorokBoss_Init(OctorokBossEntity* this))
+void OctorokBoss_Init(OctorokBossEntity* this) {
+ u32 leg;
+ u32 tail;
+
+ super->action = ACTION1;
+ super->spriteSettings.draw = 3;
+ switch (super->type) {
+ case WHOLE:
+ super->spritePriority.b0 = 4;
+ this->bossPhase = 0;
+ super->timer = 1;
+ this->heap = (OctorokBossHeap*)zMalloc(sizeof(OctorokBossHeap));
+ if (this->heap == NULL) {
+ // Kill this boss
+ GenericDeath(super);
+ return;
+ } else {
+
+ super->myHeap = (u32*)this->heap;
+ }
+ MEMORY_BARRIER;
+ (this->heap)->fallingStonesTimer = 0;
+ (this->heap)->unk_0 = 2;
+ (this->heap)->field_0x2 = 0;
+ (this->heap)->tailCount = 5;
+ super->spriteRendering.b0 = 3;
+ this->field_0x6c.HALF.HI |= 1;
+ this->unk_76 = 0xa0;
+ this->unk_74 = 0xa0;
+ this->angle.HWORD = 0;
+ // Create legs
+ for (leg = 0; leg < 4; leg++) {
+ super->child = CreateEnemy(OCTOROK_BOSS, leg + 1);
+ if (super->child != NULL) {
+ CopyPosition(super, super->child);
+ super->child->parent = super;
+ ((OctorokBossEntity*)super->child)->heap = this->heap;
+ MEMORY_BARRIER;
+ this->heap->legObjects[leg] = ((OctorokBossEntity*)super->child);
+ }
+ }
+ // Create mouth
+ super->child = CreateEnemy(OCTOROK_BOSS, MOUTH);
+ if (super->child != NULL) {
+ CopyPosition(super, super->child);
+ super->child->parent = super;
+ ((OctorokBossEntity*)super->child)->heap = this->heap;
+ }
+ // Create tail end
+ super->child = CreateEnemy(OCTOROK_BOSS, TAIL_END);
+ if (super->child != NULL) {
+ CopyPosition(super, super->child);
+ super->child->parent = super;
+ ((OctorokBossEntity*)super->child)->heap = this->heap;
+ MEMORY_BARRIER;
+ (this->heap)->tailObjects[0] = (OctorokBossEntity*)super->child;
+ }
+ // Create tails
+
+ for (tail = 0; tail < 4; tail++) {
+ super->child = CreateEnemy(OCTOROK_BOSS, TAIL);
+ if (super->child != NULL) {
+ super->child->type2 = tail;
+ CopyPosition(super, super->child);
+ super->child->parent = super;
+ ((OctorokBossEntity*)super->child)->heap = this->heap;
+ MEMORY_BARRIER;
+ this->heap->tailObjects[tail + 1] = (OctorokBossEntity*)super->child;
+ }
+ }
+ super->action = INTRO;
+ super->subAction = 0;
+ this->timer = 0x3c;
+ gPlayerEntity.spriteSettings.draw = 0;
+ gPlayerEntity.x.HALF.HI = super->x.HALF.HI;
+ gPlayerEntity.y.HALF.HI = super->y.HALF.HI - 0xa0;
+ gRoomControls.camera_target = super;
+ break;
+ case LEG_BR:
+ case LEG_FR:
+ case LEG_FL:
+ case LEG_BL:
+ super->timer = 0x10;
+ this->timer = 0;
+ if ((super->type & 2) == 0) {
+ super->subtimer = 2;
+ } else {
+ super->subtimer = 0xfe;
+ }
+ this->unk_74 = 0x100;
+ if ((super->type & 1) == 0) {
+ this->unk_76 = 0xff00;
+ } else {
+ this->unk_76 = 0x100;
+ }
+ break;
+ case MOUTH:
+ this->unk_76 = 0x100;
+ this->unk_74 = 0x100;
+ this->timer = 0x1c;
+ this->heap->mouthObject = this;
+ break;
+ case TAIL_END:
+ this->unk_76 = 0x100;
+ this->unk_74 = 0x100;
+ super->spritePriority.b0 = 0;
+ this->timer = 0;
+ super->timer = 0x10;
+ super->subtimer = 1;
+ GET_TAIL_RADIUS(this) = 0x80;
+ break;
+ }
+ if (super->type != TAIL_END) {
+ InitializeAnimation(super, gUnk_080CF08C[super->type * 4]);
+ } else {
+ InitAnimationForceUpdate(super, gUnk_080CF08C[super->type * 4]);
+ }
+ OctorokBoss_Action1(this);
+}
void OctorokBoss_Intro(OctorokBossEntity* this) {
static void (*const OctorokBoss_Intro_SubActions[])(OctorokBossEntity*) = {
diff --git a/src/fileselect.c b/src/fileselect.c
index 04bbfb89..5324661c 100644
--- a/src/fileselect.c
+++ b/src/fileselect.c
@@ -750,74 +750,71 @@ const u16 gUnk_080FC914[] = { 0xf251, 0xf251, 0xf251, 0xf251, 0xf251, 0xf251, 0x
0xf24d, 0xf24d, 0xf24d, 0xf24d, 0xf24d, 0xf24d, 0xf24d, 0xf24d, 0xf24d, 0xf24d };
// Handles drawing of hearts
-NONMATCH("asm/non_matching/save/sub_08050B3C.inc", void sub_08050B3C(u16* arg0)) {
- unk_08050B3C sp;
- int var0;
- int var1;
- int var2;
- int var3;
- int var4;
- int var5;
- int var6;
- int var7;
- u16* var8;
-
- sp.unk0 = arg0;
- var0 = gSave.stats.health / 2;
- if (var0 == 0) {
- var0 = 1;
- }
-
- var1 = gSave.stats.maxHealth / 2;
- if (var1 == 0) {
+void sub_08050B3C(u16* target) {
+ s32 currentQuarterHearts;
+ s32 maxQuarterHearts;
+ s32 maxHeartsFirstRow;
+ s32 currentFullHearts;
+ s32 maxHeartsSecondRow;
+ u32 currentFullHeartsFirstRow;
+ s32 currentFullHeartsSecondRow;
+ u16* temp_target;
+ u32 currentPartialHeartValue;
+ u32 maxHearts;
+
+ currentQuarterHearts = gSave.stats.health / 2;
+ if (currentQuarterHearts == 0) {
+ currentQuarterHearts = 1;
+ }
+
+ maxQuarterHearts = gSave.stats.maxHealth / 2;
+ if (maxQuarterHearts == 0) {
return;
}
- if (var0 > var1) {
- var0 = var1;
+ if (currentQuarterHearts > maxQuarterHearts) {
+ currentQuarterHearts = maxQuarterHearts;
}
- sp.unk4 = var0 & 0x3;
- var2 = var0 * 2;
- var5 = var2;
- if (var2 > 10) {
- var5 = 10;
+ currentPartialHeartValue = currentQuarterHearts & 3;
+ currentFullHearts = currentQuarterHearts / 4;
+ currentFullHeartsFirstRow = currentFullHearts;
+ if (currentFullHearts > 10) {
+ currentFullHeartsFirstRow = 10;
}
- var6 = var2;
- var6 -= 10;
- var7 = var6;
- if (var6 < 0) {
- var7 = 0;
+ currentFullHeartsSecondRow = currentFullHearts - 10;
+ if (currentFullHeartsSecondRow < 0) {
+ currentFullHeartsSecondRow = 0;
}
- var1 = var1 >> 2;
- var4 = var1;
- if (var1 > 10) {
- var1 = 10;
+ maxHearts = maxQuarterHearts / 4;
+ maxHeartsFirstRow = maxHearts;
+ if (maxHeartsFirstRow > 10) {
+ maxHeartsFirstRow = 10;
}
-
- var4 -= 10;
- sp.unk0[0] = 0xF24C;
- DmaCopy16(3, &gUnk_080FC914[10 - var5], &sp.unk0[1], var1 * 2);
- if (var4 > 0) {
- sp.unk0[0x20] = 0xF24C;
- DmaCopy16(3, &gUnk_080FC914[10 - var7], &sp.unk0[1], var4 * 2);
+ maxHeartsSecondRow = maxHearts - 10;
+ temp_target = target;
+ temp_target[0] = 0xF24C;
+ DmaCopy16(3, &gUnk_080FC914[10 - currentFullHeartsFirstRow], &temp_target[1], maxHeartsFirstRow * 2);
+ if (maxHeartsSecondRow > 0) {
+ temp_target += 0x20;
+ temp_target[0] = 0xF24C;
+ DmaCopy16(3, &gUnk_080FC914[10 - currentFullHeartsSecondRow], &temp_target[1], maxHeartsSecondRow * 2);
}
- if (!sp.unk4) {
+ if (!currentPartialHeartValue) {
return;
}
- var8 = sp.unk0;
- if (var2 >= 10) {
- var2 = var6;
- var8 += 0x20;
+ temp_target = target;
+ if (currentFullHearts >= 10) {
+ currentFullHearts = currentFullHearts - 10;
+ temp_target += 0x20;
}
- var8[var2 + 1] = sp.unk4 - 0xDB3;
+ temp_target[currentFullHearts + 1] = currentPartialHeartValue - 0xDB3;
}
-END_NONMATCH
void sub_08050C54(void);
void sub_08050D68(void);
diff --git a/src/manager/minishPortalManager.c b/src/manager/minishPortalManager.c
index d86549c3..47307dea 100644
--- a/src/manager/minishPortalManager.c
+++ b/src/manager/minishPortalManager.c
@@ -65,7 +65,7 @@ void CreateMagicSparkles(u32 baseX, u32 baseY, u32 layer) {
r = Random();
if (r & 0x7)
return;
- spark = CreateObject(SPECIAL_FX, 0x26, 0);
+ spark = CreateObject(SPECIAL_FX, FX_SPARKLE4, 0);
if (spark == NULL)
return;
offsetX = (r >> 0x8) & 0xF;
diff --git a/src/npc/simon.c b/src/npc/simon.c
index 47a63b6f..647eae41 100644
--- a/src/npc/simon.c
+++ b/src/npc/simon.c
@@ -28,7 +28,7 @@ void sub_0806C224(void) {
}
void Simon_CreateChest(Entity* this) {
- CreateObjectWithParent(this, SPECIAL_FX, 0x43, 0);
+ CreateObjectWithParent(this, SPECIAL_FX, FX_BIG_EXPLOSION2, 0);
SetTileType(0x73, COORD_TO_TILE(this), this->collisionLayer);
SoundReq(SFX_SECRET_BIG);
}
diff --git a/src/npc/syrup.c b/src/npc/syrup.c
index 05e90aee..1668d4f7 100644
--- a/src/npc/syrup.c
+++ b/src/npc/syrup.c
@@ -57,7 +57,7 @@ void sub_0806A26C(Entity* this) {
const s8* ptr;
u32 uVar2, uVar1;
Entity* pEVar1;
- pEVar1 = CreateObject(SPECIAL_FX, 0x2f, 0);
+ pEVar1 = CreateObject(SPECIAL_FX, FX_SLOW_SMOKE_SMALL, 0);
if (pEVar1 != NULL) {
PositionEntityOnTop(this, pEVar1);
uVar2 = uVar1 = Random();
diff --git a/src/object/bigIceBlock.c b/src/object/bigIceBlock.c
index 8814fe63..b52fe780 100644
--- a/src/object/bigIceBlock.c
+++ b/src/object/bigIceBlock.c
@@ -116,7 +116,7 @@ void sub_08099880(BigIceBlockEntity* this) {
uVar4 = (0x3c - super->timer) * 0x20 + 0x100;
SetAffineInfo(super, 0x100, uVar4, 0);
sub_0806FCF4(super, uVar4, 2, 0);
- obj = CreateObject(SPECIAL_FX, 0x11, 0x40);
+ obj = CreateObject(SPECIAL_FX, FX_DASH, 0x40);
if (obj != NULL) {
rand = Random();
x = ((rand >> 0x10) % 0x21) - 0x10;
diff --git a/src/object/frozenOctorok.c b/src/object/frozenOctorok.c
index 7805839c..682e0ae0 100644
--- a/src/object/frozenOctorok.c
+++ b/src/object/frozenOctorok.c
@@ -55,13 +55,11 @@ const u8 gUnk_08123DDC[] = {
9, 4, 0, 0, 1, 5, 0, 0, 1, 4, 0, 0, 1, 3, 0, 0, 1, 2, 0, 0, 2, 1, 0, 0, 10, 4, 0, 0,
};
-NONMATCH("asm/non_matching/frozenOctorok/FrozenOctorok_Init.inc", void FrozenOctorok_Init(FrozenOctorokEntity* this)) {
+void FrozenOctorok_Init(FrozenOctorokEntity* this) {
OctorokBossHeap* heap;
- Entity*** pppEVar2;
- FrozenOctorokEntity* pEVar3;
FrozenOctorokEntity* obj1;
FrozenOctorokEntity* obj2;
- u32 uVar3;
+ u32 i;
u32 type;
super->action = 1;
@@ -89,13 +87,15 @@ NONMATCH("asm/non_matching/frozenOctorok/FrozenOctorok_Init.inc", void FrozenOct
return;
}
super->myHeap = heap;
+ MEMORY_BARRIER;
this->heap->tailCount = 5;
- for (uVar3 = 0; uVar3 < 4; uVar3++) {
- super->child = CreateObjectWithParent(super, FROZEN_OCTOROK, uVar3 + 1, 0);
+ for (i = 0; i < 4; i++) {
+ super->child = CreateObjectWithParent(super, FROZEN_OCTOROK, i + 1, 0);
if (super->child != NULL) {
((FrozenOctorokEntity*)super->child)->heap = this->heap;
- this->heap->legObjects[uVar3] = (OctorokBossEntity*)super->child;
+ MEMORY_BARRIER;
+ this->heap->legObjects[i] = (OctorokBossEntity*)super->child;
}
}
obj1 = (FrozenOctorokEntity*)CreateObjectWithParent(super, FROZEN_OCTOROK, 5, 0);
@@ -143,7 +143,6 @@ NONMATCH("asm/non_matching/frozenOctorok/FrozenOctorok_Init.inc", void FrozenOct
InitializeAnimation(super, gUnk_08123DDC[super->type * 4]);
FrozenOctorok_Action1(this);
}
-END_NONMATCH
void (*const FrozenOctorok_Action1SubActions[])(FrozenOctorokEntity*) = {
FrozenOctorok_Action1SubAction0, FrozenOctorok_Action1SubAction1, FrozenOctorok_Action1SubAction2,
diff --git a/src/object/frozenWaterElement.c b/src/object/frozenWaterElement.c
index f23a76a2..377dd87c 100644
--- a/src/object/frozenWaterElement.c
+++ b/src/object/frozenWaterElement.c
@@ -92,7 +92,7 @@ void FrozenWaterElement_Action2(FrozenWaterElementEntity* this) {
super->spriteOffsetY += 8;
}
value = gUnk_08123DC0[this->unk_74 >> 5];
- effect = CreateObject(SPECIAL_FX, 0x11, 0x40);
+ effect = CreateObject(SPECIAL_FX, FX_DASH, 0x40);
if (effect != NULL) {
rand = Random();
tmp = (((rand >> 0x10) & value) - ((value + 1) >> 1));
@@ -101,7 +101,7 @@ void FrozenWaterElement_Action2(FrozenWaterElementEntity* this) {
effect->x.HALF.HI = this->unk_80 + gRoomControls.origin_x + tmp;
effect->y.HALF.HI = this->unk_82 + gRoomControls.origin_y + tmp2;
}
- effect = CreateObject(SPECIAL_FX, 2, 0x40);
+ effect = CreateObject(SPECIAL_FX, FX_DEATH, 0x40);
if (effect != NULL) {
rand = Random();
tmp = (((rand >> 0x10) & value) - ((value + 1) >> 1));
diff --git a/src/object/gyorgBossObject.c b/src/object/gyorgBossObject.c
index 647f05fe..103352ce 100644
--- a/src/object/gyorgBossObject.c
+++ b/src/object/gyorgBossObject.c
@@ -437,7 +437,7 @@ void GyorgBossObject_SpawnChildren(u32 unk0, bool32 fromBlue, u32 animationState
}
if (fromBlue == FALSE) {
Entity* tmp;
- tmp = CreateObject(SPECIAL_FX, 2, 0);
+ tmp = CreateObject(SPECIAL_FX, FX_DEATH, 0);
if (tmp) {
tmp->x.HALF.HI = x;
tmp->y.HALF.HI = y;
diff --git a/src/object/objectOnPillar.c b/src/object/objectOnPillar.c
index 371d8ec2..5b617169 100644
--- a/src/object/objectOnPillar.c
+++ b/src/object/objectOnPillar.c
@@ -166,7 +166,7 @@ bool32 sub_08097008(ObjectOnPillarEntity* this) {
this->tileIndex = tileType;
break;
default:
- effect = CreateObject(SPECIAL_FX, 4, 0);
+ effect = CreateObject(SPECIAL_FX, FX_ROCK, 0);
if (effect != NULL) {
CopyPosition(super, effect);
}
@@ -244,11 +244,11 @@ void sub_080971E0(ObjectOnPillarEntity* this) {
EntityWithHitFlag* entity;
u32 tilePosition;
- entity = (EntityWithHitFlag*)CreateObject(SPECIAL_FX, 0x11, 0x40);
+ entity = (EntityWithHitFlag*)CreateObject(SPECIAL_FX, FX_DASH, 0x40);
if (entity != NULL) {
PositionRelative(super, &entity->base, -0x80000, 0x20000);
}
- entity = (EntityWithHitFlag*)CreateObject(SPECIAL_FX, 0x11, 0x40);
+ entity = (EntityWithHitFlag*)CreateObject(SPECIAL_FX, FX_DASH, 0x40);
if (entity != NULL) {
PositionRelative(super, &entity->base, 0x80000, 0x20000);
}
diff --git a/src/object/pushableStatue.c b/src/object/pushableStatue.c
index d24e44c7..efca1ea6 100644
--- a/src/object/pushableStatue.c
+++ b/src/object/pushableStatue.c
@@ -71,7 +71,7 @@ void PushableStatue_Action1(PushableStatueEntity* this) {
sub_08089538(this);
break;
case 0:
- obj = CreateObject(SPECIAL_FX, 4, 0);
+ obj = CreateObject(SPECIAL_FX, FX_ROCK, 0);
if (obj != NULL) {
CopyPosition(super, obj);
}
@@ -118,7 +118,7 @@ void PushableStatue_SubAction0(PushableStatueEntity* this) {
sub_08089538(this);
break;
case 0:
- obj = CreateObject(SPECIAL_FX, 4, 0);
+ obj = CreateObject(SPECIAL_FX, FX_ROCK, 0);
if (obj != NULL) {
CopyPosition(super, obj);
}
@@ -216,7 +216,7 @@ bool32 sub_080895C0(PushableStatueEntity* this) {
sub_08089454(this);
return TRUE;
}
- obj = CreateObject(SPECIAL_FX, 4, 0);
+ obj = CreateObject(SPECIAL_FX, FX_ROCK, 0);
if (obj != NULL) {
CopyPosition(super, obj);
}
diff --git a/src/object/smallIceBlock.c b/src/object/smallIceBlock.c
index edd3aac5..1c5e048a 100644
--- a/src/object/smallIceBlock.c
+++ b/src/object/smallIceBlock.c
@@ -98,7 +98,7 @@ void SmallIceBlock_Action1(SmallIceBlockEntity* this) {
sub_080994B8(this);
break;
case 0:
- obj = CreateObject(SPECIAL_FX, 0xd, 0);
+ obj = CreateObject(SPECIAL_FX, FX_ICE, 0);
if (obj != NULL) {
CopyPosition(super, obj);
}
@@ -165,7 +165,7 @@ void SmallIceBlock_Action4(SmallIceBlockEntity* this) {
}
SetAffineInfo(super, 0x100, (0x3c - super->timer) * 0x20 + 0x100, 0);
if ((super->timer & 1) != 0) {
- obj = CreateObject(SPECIAL_FX, 0x11, 0x40);
+ obj = CreateObject(SPECIAL_FX, FX_DASH, 0x40);
if (obj != NULL) {
rand = Random();
x = ((rand >> 0x10) % 9) - 4;
diff --git a/src/objectDefinitions.c b/src/objectDefinitions.c
index 29c5e352..8b9e062a 100644
--- a/src/objectDefinitions.c
+++ b/src/objectDefinitions.c
@@ -44,7 +44,7 @@ const ObjectDefinition gObjectDefinition_F[] = {
{ { 1, 0, 0, 0, 154, 2, 0 }, { 4, 0, 0, 0, SPRITE_SPECIALFX, 0, 0 } }, // FX_BROWN_SMOKE_LARGE
{ { 1, 0, 0, 0, 154, 2, 0 }, { 4, 0, 0, 0, SPRITE_SPECIALFX, 0, 0 } }, // FX_BROWN_SMOKE2
{ { 1, 0, 0, 0, 243, 0, 0 }, { 1, 0, 0, 0, SPRITE_SPECIALFX_1, 0, 0 } }, // FX_SWEAT
- { { 1, 0, 0, 0, 60, 2, 0 }, { 4, 0, 0, 0, SPRITE_SPECIALFX, 0, 0 } }, // FX_26
+ { { 1, 0, 0, 0, 60, 2, 0 }, { 4, 0, 0, 0, SPRITE_SPECIALFX, 0, 0 } }, // FX_SPARKLE4
{ { 1, 0, 0, 0, 96, 2, 0 }, { 0, 0, 0, 0, SPRITE_SPECIALFX_1, 0, 0 } }, // FX_27
{ { 1, 0, 0, 0, 154, 2, 0 }, { 3, 0, 0, 0, SPRITE_SPECIALFX, 0, 0 } }, // FX_SLOW_EXPLOSION
{ { 1, 0, 0, 0, 113, 0, 0 }, { 71, 0, 0, 0, SPRITE_SPECIALFX_1, 0, 0 } }, // FX_CONFETTI
diff --git a/src/objectUtils.c b/src/objectUtils.c
index a97cdbfb..172e2afc 100644
--- a/src/objectUtils.c
+++ b/src/objectUtils.c
@@ -248,7 +248,7 @@ void CreateSparkle(Entity* entity) {
s32 y;
s32 x;
- sparkle = CreateObject(SPECIAL_FX, 0x26, 0);
+ sparkle = CreateObject(SPECIAL_FX, FX_SPARKLE4, 0);
if (sparkle != NULL) {
rand = Random();
x = rand & 0xf;
diff --git a/src/playerItem/playerItemSword.c b/src/playerItem/playerItemSword.c
index 52b9dcbf..e1fbacb9 100644
--- a/src/playerItem/playerItemSword.c
+++ b/src/playerItem/playerItemSword.c
@@ -337,47 +337,54 @@ void sub_080A7A54(PlayerItemSwordEntity* this) {
super->hitbox->height = tmp[3];
}
-NONMATCH("asm/non_matching/playerItemSword/sub_080A7A84.inc", void sub_080A7A84(PlayerItemSwordEntity* this)) {
- s32 iVar1;
+void sub_080A7A84(PlayerItemSwordEntity* this) {
+ u32 one;
Entity* effect;
+ s16 new_var;
s32 uVar3;
- s32 uVar4;
+ Entity* new_var2;
const s8* ptr;
- const s8* ptr2;
u32 tmp;
+ u32 tmp2;
+ u32 r5;
if ((gPlayerEntity.frame & 0xf) != 0) {
uVar3 = gUnk_08129072[((gPlayerEntity.frame & 0xf) - 1)][0];
- uVar4 = gUnk_08129072[((gPlayerEntity.frame & 0xf) - 1)][1];
- if (((gPlayerState.sword_state & 0xc0) == 0) &&
- ((s32)((u32) * (u8*)&gPlayerEntity.spriteSettings * 0x2000000) < 0)) {
+ one = 1;
+ r5 = gUnk_08129072[(gPlayerEntity.frame & 0xf) - 1][one];
+ if (((gPlayerState.sword_state & 0xc0) == 0) && (gPlayerEntity.spriteSettings.flipX == 1)) {
uVar3 = -uVar3;
}
if (super->type != 0) {
- sub_08008796(super, 0, super->x.HALF.HI + uVar3, super->y.HALF.HI + uVar4);
- } else {
- if ((((super->z.WORD == 0) && (sub_08008796(super, (gPlayerState.skills & 8) != 0, super->x.HALF.HI + uVar3,
- super->y.HALF.HI + uVar4) == NULL)) &&
+ sub_08008796(super, 0, super->x.HALF.HI + uVar3, super->y.HALF.HI + r5);
+ } else if (super->z.WORD == 0) {
+ if (gPlayerState.skills & SKILL_ROCK_BREAKER) {
+ tmp2 = 1;
+ } else {
+ tmp2 = 0;
+ }
+ new_var = uVar3;
+ if (((sub_08008796(super, tmp2, super->x.HALF.HI + new_var, super->y.HALF.HI + r5) == NULL) &&
(gPlayerState.sword_state != 0)) &&
((gPlayerState.sword_state & 0xc0) == 0)) {
- if (GetRelativeCollisionTile(super, uVar3, uVar4) == 0x2e) {
+ new_var2 = super;
+ if (GetRelativeCollisionTile(new_var2, new_var, r5) == 0x2e) {
SoundReqClipped(&gPlayerEntity, SFX_ITEM_GLOVES_KNOCKBACK);
} else {
SoundReqClipped(&gPlayerEntity, SFX_METAL_CLINK);
}
- effect = CreateObject(SPECIAL_FX, 0x1a, 0);
+ effect = CreateObject(SPECIAL_FX, FX_LIGHTNING, 0);
if (effect != NULL) {
- ptr2 = gUnk_0812908E;
- effect->x.HALF.HI = super->x.HALF.HI + ptr2[super->animationState];
- tmp = super->animationState + 1;
- effect->y.HALF.HI = super->y.HALF.HI + (ptr2)[tmp];
- effect->z = super->z;
+ ptr = gUnk_0812908E;
+ effect->x.HALF.HI = new_var2->x.HALF.HI + ptr[new_var2->animationState];
+ tmp = new_var2->animationState + 1;
+ effect->y.HALF.HI = new_var2->y.HALF.HI + ptr[tmp];
+ effect->z = new_var2->z;
}
}
}
}
}
-END_NONMATCH
void sub_080A7B98(PlayerItemSwordEntity* this) {
u32 i, j;
diff --git a/src/room.c b/src/room.c
index a8a877e8..12ac101a 100644
--- a/src/room.c
+++ b/src/room.c
@@ -368,7 +368,7 @@ static void LoadDestructibleTile(TileEntity* tile) {
void sub_0804B388(u32 a1, u32 a2) {
Entity* e;
SetTileType(a2 == 1 ? 38 : 52, a1, a2);
- e = CreateObject(SPECIAL_FX, 2, 0);
+ e = CreateObject(SPECIAL_FX, FX_DEATH, 0);
if (e != NULL) {
e->collisionLayer = a2;
sub_0806F704(e, a1);
diff --git a/src/roomInit.c b/src/roomInit.c
index c77091db..fe040744 100644
--- a/src/roomInit.c
+++ b/src/roomInit.c
@@ -998,12 +998,12 @@ void sub_0804BF38(Entity* this, ScriptExecutionContext* context) {
numEnts = ptr->entCnt;
for (entCnt = 0; entCnt < numEnts; entCnt++) {
- fx = CreateObject(SPECIAL_FX, 0xf, 0);
+ fx = CreateObject(SPECIAL_FX, FX_ROCK_SMALL, 0);
if (fx != NULL) {
fx->x.HALF.HI = ptr->x + gRoomControls.origin_x + entCnt * 0x10;
fx->y.HALF.HI = ptr->y + gRoomControls.origin_y + (entCnt & 1) * 8;
}
- fx = CreateObject(SPECIAL_FX, 0x54, 0);
+ fx = CreateObject(SPECIAL_FX, FX_WHITE_PUFF, 0);
if (fx != NULL) {
fx->x.HALF.HI = ptr->x + gRoomControls.origin_x + entCnt * 0x10;
fx->y.HALF.HI = ptr->y + gRoomControls.origin_y + -0xc + (entCnt & 1) * 8;
diff --git a/src/scroll.c b/src/scroll.c
index 2d9c85bd..0ae4b91c 100644
--- a/src/scroll.c
+++ b/src/scroll.c
@@ -718,13 +718,11 @@ void sub_080809D4(void) {
gUpdateVisibleTiles = 1;
}
-NONMATCH("asm/non_matching/scroll/UpdateDoorTransition.inc", void UpdateDoorTransition()) {
+void UpdateDoorTransition() {
u32 uVar1;
- u32 uVar2;
u32 uVar3;
u32 uVar4;
- Entity* target;
-
+ RoomControls* controls = &gRoomControls;
if (gRoomControls.camera_target != &gPlayerEntity) {
return;
}
@@ -740,11 +738,12 @@ NONMATCH("asm/non_matching/scroll/UpdateDoorTransition.inc", void UpdateDoorTran
case 9:
case 0x18:
case 0x1d:
- uVar4 = gRoomControls.camera_target->y.HALF.HI - gRoomControls.origin_y;
- uVar3 = gRoomControls.camera_target->x.HALF.HI - gRoomControls.origin_x;
- uVar1 =
- sub_080B1AE0(COORD_TO_TILE(gRoomControls.camera_target), gRoomControls.camera_target->collisionLayer);
- gRoomTransition.stairs_idx = sub_080B1A48(uVar3, uVar4, gRoomControls.camera_target->collisionLayer);
+ uVar4 = controls->camera_target->y.HALF.HI - controls->origin_y;
+ uVar3 = controls->camera_target->x.HALF.HI - controls->origin_x;
+ uVar1 = sub_080B1AE0((((controls->camera_target->x.HALF.HI - controls->origin_x) >> 4) & 0x3F) |
+ ((((controls->camera_target->y.HALF.HI - controls->origin_y) >> 4) & 0x3F) << 6),
+ controls->camera_target->collisionLayer);
+ gRoomTransition.stairs_idx = sub_080B1A48(uVar3, uVar4, controls->camera_target->collisionLayer);
switch (uVar1) {
case 0x3f:
case 0xf1:
@@ -755,7 +754,6 @@ NONMATCH("asm/non_matching/scroll/UpdateDoorTransition.inc", void UpdateDoorTran
}
}
}
-END_NONMATCH
void sub_08080B60(LayerStruct* layer) {
u32 index;