summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTal Hayon <talhayon1@gmail.com>2022-01-23 17:24:55 +0200
committerTal Hayon <talhayon1@gmail.com>2022-01-23 17:24:55 +0200
commit70e2ef587740bfa159528bc0b160bb89869ad925 (patch)
tree766b21f8ce110a96d673e52e8cd7ac05072e5495
parenta1ae3b229bf3767349849e3da29fe4fd2043eda3 (diff)
parent85aaada18f7eace3284937c4da8db05f047d316b (diff)
Merge remote-tracking branch 'upstream/master' into coord
-rw-r--r--asm/code_08054C04.s2
-rw-r--r--asm/code_08078778.s2
-rwxr-xr-xasm/code_0808091C.s2
-rw-r--r--asm/enemy/chuchuBoss.s10
-rw-r--r--asm/enemy/cloudPiranha.s4
-rw-r--r--asm/enemy/enemy64.s4
-rw-r--r--asm/enemy/enemy66.s30
-rw-r--r--asm/non_matching/castorWildsStatue/sub_080675D4.inc4
-rw-r--r--asm/non_matching/octorokBossObject/OctorokBossObject_Action1.inc8
-rw-r--r--asm/non_matching/pressurePlate/sub_08088938.inc59
-rw-r--r--asm/object/evilSpirit.s4
-rw-r--r--asm/object/fairy.s2
-rw-r--r--asm/object/fourElements.s2
-rw-r--r--asm/object/lilypadLarge.s2
-rw-r--r--asm/object/macroPlayer.s2
-rw-r--r--asm/object/object30.s2
-rw-r--r--asm/object/object91.s6
-rw-r--r--asm/object/object96.s4
-rw-r--r--asm/object/object97.s2
-rw-r--r--asm/object/objectA8.s2
-rw-r--r--asm/object/objectB4.s8
-rw-r--r--asm/object/objectOnSpinyBeetle.s6
-rw-r--r--asm/object/pressurePlate.s308
-rw-r--r--asm/object/specialFx.s2
-rw-r--r--asm/object/windTribeTeleporter.s2
-rw-r--r--asm/objectUtils.s4
-rw-r--r--assets/assets.json10
-rw-r--r--assets/sounds.json4
-rw-r--r--constants/audio_constants.inc2
-rw-r--r--data/animations/object/pressurePlate.s27
-rw-r--r--data/const/enemy/enemy66.s10
-rw-r--r--data/const/object/pressurePlate.s13
-rw-r--r--data/scripts/hyruleTown/script_Carlov.inc2
-rw-r--r--data/sound/sounds.s4
-rw-r--r--include/coord.h4
-rw-r--r--include/entity.h8
-rw-r--r--include/functions.h6
-rw-r--r--include/global.h4
-rw-r--r--include/object.h2
-rw-r--r--include/player.h1
-rw-r--r--include/sound.h4
-rw-r--r--include/sprite.h2
-rw-r--r--linker.ld9
-rw-r--r--src/code_0805436C.c2
-rw-r--r--src/collision.c12
-rw-r--r--src/coord.c40
-rw-r--r--src/enemy/acroBandits.c10
-rw-r--r--src/enemy/beetle.c6
-rw-r--r--src/enemy/bobomb.c6
-rw-r--r--src/enemy/bombPeahat.c2
-rw-r--r--src/enemy/chuchu.c2
-rw-r--r--src/enemy/cuccoChickAggr.c6
-rw-r--r--src/enemy/enemy66.c16
-rw-r--r--src/enemy/fallingBoulder.c4
-rw-r--r--src/enemy/fireballGuy.c2
-rw-r--r--src/enemy/flyingSkull.c2
-rw-r--r--src/enemy/gleerok.c2
-rw-r--r--src/enemy/gyorgMale.c4
-rw-r--r--src/enemy/helmasaur.c12
-rw-r--r--src/enemy/keaton.c2
-rw-r--r--src/enemy/lakitu.c22
-rw-r--r--src/enemy/likeLike.c4
-rw-r--r--src/enemy/mazaalBracelet.c16
-rw-r--r--src/enemy/mazaalHead.c4
-rw-r--r--src/enemy/miniFireballGuy.c2
-rw-r--r--src/enemy/moldworm.c4
-rw-r--r--src/enemy/octorokBoss.c10
-rw-r--r--src/enemy/peahat.c4
-rw-r--r--src/enemy/pesto.c2
-rw-r--r--src/enemy/puffstool.c18
-rw-r--r--src/enemy/rollobite.c6
-rw-r--r--src/enemy/rupeeLike.c4
-rw-r--r--src/enemy/sluggula.c4
-rw-r--r--src/enemy/spikedBeetle.c4
-rw-r--r--src/enemy/spinyChuchu.c10
-rw-r--r--src/enemy/tektiteGolden.c4
-rw-r--r--src/enemy/vaatiArm.c4
-rw-r--r--src/enemy/vaatiBall.c10
-rw-r--r--src/enemy/vaatiProjectile.c4
-rw-r--r--src/enemy/vaatiRebornEnemy.c16
-rw-r--r--src/enemy/vaatiTransfigured.c8
-rw-r--r--src/enemy/vaatiTransfiguredEye.c4
-rw-r--r--src/enemy/vaatiWrath.c2
-rw-r--r--src/enemy/vaatiWrathEye.c2
-rw-r--r--src/enemy/waterDrop.c2
-rw-r--r--src/item/itemRocsCape.c2
-rw-r--r--src/npc/bigGoron.c2
-rw-r--r--src/npc/bladeBrothers.c2
-rw-r--r--src/npc/castorWildsStatue.c4
-rw-r--r--src/npc/cuccoChick.c2
-rw-r--r--src/npc/drLeft.c2
-rw-r--r--src/npc/ezlo.c2
-rw-r--r--src/npc/goron.c12
-rw-r--r--src/npc/gregal.c4
-rw-r--r--src/npc/kid.c2
-rw-r--r--src/npc/malon.c4
-rw-r--r--src/npc/melari.c2
-rw-r--r--src/npc/npc4E.c4
-rw-r--r--src/npc/pita.c2
-rw-r--r--src/npc/postman.c2
-rw-r--r--src/npc/rem.c4
-rw-r--r--src/npc/townMinish.c4
-rw-r--r--src/npc/townsperson.c2
-rw-r--r--src/npc/vaatiReborn.c6
-rw-r--r--src/npc/wheaton.c2
-rw-r--r--src/npc/zelda.c6
-rw-r--r--src/object/bakerOven.c2
-rw-r--r--src/object/bigVortex.c6
-rw-r--r--src/object/bird.c16
-rw-r--r--src/object/book.c4
-rw-r--r--src/object/button.c4
-rw-r--r--src/object/fileScreenObjects.c4
-rw-r--r--src/object/furniture.c4
-rw-r--r--src/object/greatFairy.c14
-rw-r--r--src/object/heartContainer.c2
-rw-r--r--src/object/itemOnGround.c14
-rw-r--r--src/object/jarPortal.c10
-rw-r--r--src/object/lilypadLarge.c2
-rw-r--r--src/object/mask.c2
-rw-r--r--src/object/minecart.c6
-rw-r--r--src/object/object49.c4
-rw-r--r--src/object/object6A.c62
-rw-r--r--src/object/object7E.c2
-rw-r--r--src/object/objectA2.c8
-rw-r--r--src/object/objectAF.c2
-rw-r--r--src/object/objectB5.c2
-rw-r--r--src/object/octorokBossObject.c27
-rw-r--r--src/object/pot.c2
-rw-r--r--src/object/pressurePlate.c185
-rw-r--r--src/object/rupee.c2
-rw-r--r--src/player.c53
-rw-r--r--src/projectile/boneProjectile.c4
-rw-r--r--src/projectile/cannonballProjectile.c4
-rw-r--r--src/projectile/dekuSeedProjectile.c4
-rw-r--r--src/projectile/dirtBallProjectile.c10
-rw-r--r--src/projectile/gleerokProjectile.c4
-rw-r--r--src/projectile/gyorgMaleEnergyProjectile.c4
-rw-r--r--src/projectile/lakituCloudProjectile.c4
-rw-r--r--src/projectile/mandiblesProjectile.c10
-rw-r--r--src/projectile/octorokBossProjectile.c14
-rw-r--r--src/projectile/rockProjectile.c4
-rw-r--r--src/projectile/stalfosProjectile.c4
-rw-r--r--src/projectile/v1DarkMagicProjectile.c8
-rw-r--r--src/projectile/v1EyeLaser.c2
-rw-r--r--src/projectile/v1FireProjectile.c4
-rw-r--r--src/projectile/v2Projectile.c2
-rw-r--r--src/roomInit.c8
-rw-r--r--src/script.c16
-rw-r--r--src/sound.c8
149 files changed, 693 insertions, 827 deletions
diff --git a/asm/code_08054C04.s b/asm/code_08054C04.s
index caacf860..e8a02905 100644
--- a/asm/code_08054C04.s
+++ b/asm/code_08054C04.s
@@ -446,7 +446,7 @@ sub_08054EFC: @ 0x08054EFC
subs r0, #0x10
strh r0, [r1, #0x32]
adds r0, r4, #0
- bl ResolveEntityBelow
+ bl SortEntityBelow
_08054F54:
movs r0, #0xfd
bl SoundReq
diff --git a/asm/code_08078778.s b/asm/code_08078778.s
index 5dd37970..b5c2c7e6 100644
--- a/asm/code_08078778.s
+++ b/asm/code_08078778.s
@@ -724,7 +724,7 @@ _08078DE0:
strh r0, [r4, #0x32]
adds r0, r5, #0
adds r1, r4, #0
- bl ResolveEntityOnTop
+ bl SortEntityAbove
ldr r0, _08078E34 @ =gPlayerState
ldrb r0, [r0, #5]
cmp r0, #4
diff --git a/asm/code_0808091C.s b/asm/code_0808091C.s
index c0d02198..5ab71ebf 100755
--- a/asm/code_0808091C.s
+++ b/asm/code_0808091C.s
@@ -419,7 +419,7 @@ _08080DB4:
adds r2, #1
strb r0, [r2]
adds r0, r4, #0
- bl ResolveEntityOnTop
+ bl SortEntityAbove
b _08080E00
_08080DEE:
ldr r0, _08080E04 @ =gRoomTransition
diff --git a/asm/enemy/chuchuBoss.s b/asm/enemy/chuchuBoss.s
index 12f1451d..3d5bfb57 100644
--- a/asm/enemy/chuchuBoss.s
+++ b/asm/enemy/chuchuBoss.s
@@ -3676,7 +3676,7 @@ _08027676:
mov r0, sl
ldrb r2, [r0]
adds r0, r5, #0
- bl sub_0806F62C
+ bl LinearMoveAngle
ldrb r0, [r5, #0xa]
cmp r0, #1
beq _080276D2
@@ -3692,7 +3692,7 @@ _08027676:
adds r2, r0, #0
adds r2, #0x83
ldrb r2, [r2]
- bl sub_0806F62C
+ bl LinearMoveAngle
ldr r0, [r5, #0x68]
ldr r1, [r5, #0x54]
ldrb r2, [r1, #0xa]
@@ -4033,7 +4033,7 @@ _08027934:
adds r0, #0x83
ldrb r2, [r0]
adds r0, r5, #0
- bl sub_0806F62C
+ bl LinearMoveAngle
ldr r0, [r5, #0x2c]
str r0, [r6, #0x2c]
ldr r0, [r5, #0x30]
@@ -4044,7 +4044,7 @@ _08027934:
adds r0, #0x83
ldrb r2, [r0]
adds r0, r6, #0
- bl sub_0806F62C
+ bl LinearMoveAngle
ldr r0, [r6, #0x2c]
str r0, [r4, #0x2c]
ldr r0, [r6, #0x30]
@@ -4055,7 +4055,7 @@ _08027934:
adds r0, #0x83
ldrb r2, [r0]
adds r0, r4, #0
- bl sub_0806F62C
+ bl LinearMoveAngle
adds r0, r7, #0
bl sub_08027984
pop {r4, r5, r6, r7, pc}
diff --git a/asm/enemy/cloudPiranha.s b/asm/enemy/cloudPiranha.s
index b85843df..a8ea962d 100644
--- a/asm/enemy/cloudPiranha.s
+++ b/asm/enemy/cloudPiranha.s
@@ -396,7 +396,7 @@ sub_080386B8: @ 0x080386B8
cmp r1, #0
beq _08038720
adds r0, r4, #0
- bl ResolveEntityOnTop
+ bl SortEntityAbove
_08038720:
pop {r4, pc}
.align 2, 0
@@ -507,7 +507,7 @@ _080387D8:
cmp r1, #0
beq _080387EE
adds r0, r4, #0
- bl ResolveEntityOnTop
+ bl SortEntityAbove
_080387EE:
pop {r4, pc}
diff --git a/asm/enemy/enemy64.s b/asm/enemy/enemy64.s
index c31e1abb..b14d0243 100644
--- a/asm/enemy/enemy64.s
+++ b/asm/enemy/enemy64.s
@@ -1236,7 +1236,7 @@ sub_08049998: @ 0x08049998
ldrsh r1, [r5, r0]
ldrb r2, [r5, #0x15]
adds r0, r5, #0
- bl sub_0806F62C
+ bl LinearMoveAngle
adds r0, r5, #0
adds r0, #0x7c
ldrb r1, [r0]
@@ -1433,7 +1433,7 @@ sub_08049B20: @ 0x08049B20
ldrsh r1, [r4, r0]
ldrb r2, [r4, #0x15]
adds r0, r4, #0
- bl sub_0806F62C
+ bl LinearMoveAngle
adds r0, r4, #0
adds r0, #0x7c
ldrb r1, [r0]
diff --git a/asm/enemy/enemy66.s b/asm/enemy/enemy66.s
deleted file mode 100644
index 4923766c..00000000
--- a/asm/enemy/enemy66.s
+++ /dev/null
@@ -1,30 +0,0 @@
- .include "asm/macros.inc"
-
- .include "constants/constants.inc"
-
- .syntax unified
-
- .text
-
-
- thumb_func_start Enemy66
-Enemy66: @ 0x08049CAC
- push {lr}
- adds r2, r0, #0
- ldr r1, _08049CC8 @ =gUnk_080D2ABC
- ldrb r0, [r2, #0xf]
- lsls r0, r0, #2
- adds r0, r0, r1
- ldr r1, [r0]
- cmp r1, #0
- beq _08049CCC
- adds r0, r2, #0
- bl _call_via_r1
- b _08049CD0
- .align 2, 0
-_08049CC8: .4byte gUnk_080D2ABC
-_08049CCC:
- bl DeleteThisEntity
-_08049CD0:
- pop {pc}
- .align 2, 0
diff --git a/asm/non_matching/castorWildsStatue/sub_080675D4.inc b/asm/non_matching/castorWildsStatue/sub_080675D4.inc
index f47dc575..48e73e86 100644
--- a/asm/non_matching/castorWildsStatue/sub_080675D4.inc
+++ b/asm/non_matching/castorWildsStatue/sub_080675D4.inc
@@ -54,7 +54,7 @@ _080675EC:
strb r0, [r3, #0x19]
adds r0, r4, #0
adds r1, r3, #0
- bl ResolveEntityOnTop
+ bl SortEntityAbove
_08067646:
subs r6, #1
adds r5, #2
@@ -107,7 +107,7 @@ _08067656:
strb r0, [r3, #0x19]
adds r0, r4, #0
adds r1, r3, #0
- bl ResolveEntityOnTop
+ bl SortEntityAbove
_080676B0:
subs r6, #1
adds r5, #2
diff --git a/asm/non_matching/octorokBossObject/OctorokBossObject_Action1.inc b/asm/non_matching/octorokBossObject/OctorokBossObject_Action1.inc
index 72ca7751..fdcbb90b 100644
--- a/asm/non_matching/octorokBossObject/OctorokBossObject_Action1.inc
+++ b/asm/non_matching/octorokBossObject/OctorokBossObject_Action1.inc
@@ -95,7 +95,7 @@ _0809A25C:
ldrsh r1, [r7, r2]
ldrb r2, [r7, #0x15]
adds r0, r7, #0
- bl sub_0806F62C
+ bl LinearMoveAngle
ldr r1, [r4]
ldrb r0, [r7, #0xe]
lsls r0, r0, #2
@@ -206,7 +206,7 @@ _0809A33E:
lsls r1, r1, #2
ldrb r2, [r7, #0x15]
adds r0, r7, #0
- bl sub_0806F62C
+ bl LinearMoveAngle
ldr r1, [r7, #0x50]
adds r0, r7, #0
movs r2, #0x48
@@ -216,7 +216,7 @@ _0809A378:
ldrb r2, [r7, #0x15]
adds r0, r7, #0
movs r1, #0x80
- bl sub_0806F62C
+ bl LinearMoveAngle
adds r0, r7, #0
adds r0, #0x5a
ldrb r0, [r0]
@@ -335,7 +335,7 @@ _0809A436:
ldrh r3, [r3]
adds r2, r2, r3
adds r0, r7, #0
- bl sub_0806F62C
+ bl LinearMoveAngle
b _0809A632
.align 2, 0
_0809A468: .4byte gUnk_0812388C
diff --git a/asm/non_matching/pressurePlate/sub_08088938.inc b/asm/non_matching/pressurePlate/sub_08088938.inc
new file mode 100644
index 00000000..8a5cb8eb
--- /dev/null
+++ b/asm/non_matching/pressurePlate/sub_08088938.inc
@@ -0,0 +1,59 @@
+ .syntax unified
+ push {r4, r5, r6, r7, lr}
+ mov r7, r8
+ push {r7}
+ movs r5, #0
+ ldrh r1, [r0, #0x2e]
+ subs r1, #8
+ lsls r1, r1, #0x10
+ lsrs r1, r1, #0x10
+ mov ip, r1
+ ldrh r1, [r0, #0x32]
+ subs r1, #8
+ lsls r1, r1, #0x10
+ lsrs r7, r1, #0x10
+ movs r4, #0
+ ldr r1, _080889A0 @ =gRoomVars
+ ldr r2, _080889A4 @ =sSpriteOffsets
+ mov r8, r2
+ adds r3, r1, #0
+ adds r3, #0xac
+ adds r6, r0, #0
+ adds r6, #0x72
+_08088962:
+ ldr r2, [r3]
+ cmp r2, #0
+ beq _08088990
+ ldrh r0, [r2, #0x2e]
+ mov r1, ip
+ subs r0, r0, r1
+ lsls r0, r0, #0x10
+ lsrs r0, r0, #0x10
+ cmp r0, #0x10
+ bhi _08088990
+ ldrh r0, [r2, #0x32]
+ subs r0, r0, r7
+ lsls r0, r0, #0x10
+ lsrs r0, r0, #0x10
+ cmp r0, #0x10
+ bhi _08088990
+ ldrb r0, [r6]
+ add r0, r8
+ ldrb r1, [r0]
+ adds r0, r2, #0
+ adds r0, #0x63
+ strb r1, [r0]
+ adds r5, #1
+_08088990:
+ adds r3, #4
+ adds r4, #1
+ cmp r4, #7
+ bls _08088962
+ adds r0, r5, #0
+ pop {r3}
+ mov r8, r3
+ pop {r4, r5, r6, r7, pc}
+ .align 2, 0
+_080889A0: .4byte gRoomVars
+_080889A4: .4byte sSpriteOffsets
+ .syntax divided
diff --git a/asm/object/evilSpirit.s b/asm/object/evilSpirit.s
index 9b159acd..8aa425f4 100644
--- a/asm/object/evilSpirit.s
+++ b/asm/object/evilSpirit.s
@@ -235,7 +235,7 @@ _08086428:
ldrsh r1, [r6, r0]
ldrb r2, [r6, #0x15]
adds r0, r6, #0
- bl sub_0806F62C
+ bl LinearMoveAngle
b _0808654A
_08086440:
adds r0, r6, #0
@@ -507,7 +507,7 @@ _0808663A:
ldrsh r1, [r7, r0]
ldrb r2, [r7, #0x15]
adds r0, r7, #0
- bl sub_0806F62C
+ bl LinearMoveAngle
ldrb r0, [r7, #0x15]
movs r1, #0x80
eors r0, r1
diff --git a/asm/object/fairy.s b/asm/object/fairy.s
index 9ae61b7f..bde31a70 100644
--- a/asm/object/fairy.s
+++ b/asm/object/fairy.s
@@ -392,7 +392,7 @@ _0808D972:
strh r0, [r4, #0x36]
ldr r1, _0808D994 @ =gPlayerEntity
adds r0, r4, #0
- bl sub_080177A0
+ bl IsColliding
cmp r0, #0
beq _0808D992
adds r0, r4, #0
diff --git a/asm/object/fourElements.s b/asm/object/fourElements.s
index 0e248794..598edaa5 100644
--- a/asm/object/fourElements.s
+++ b/asm/object/fourElements.s
@@ -151,7 +151,7 @@ sub_080A02CC: @ 0x080A02CC
adds r0, r4, #0
bl sub_080A0444
adds r0, r4, #0
- bl sub_08017850
+ bl IsCollidingPlayer
cmp r0, #0
beq _080A0342
ldr r0, [r4, #0x54]
diff --git a/asm/object/lilypadLarge.s b/asm/object/lilypadLarge.s
index c178744a..cdc6ede6 100644
--- a/asm/object/lilypadLarge.s
+++ b/asm/object/lilypadLarge.s
@@ -919,7 +919,7 @@ _08085BB4:
lsls r1, r1, #1
ldrb r2, [r5, #0x15]
adds r0, r4, #0
- bl sub_0806F5BC
+ bl LinearMoveDirection
_08085BE8:
adds r1, r5, #0
adds r1, #0x82
diff --git a/asm/object/macroPlayer.s b/asm/object/macroPlayer.s
index 7c8b3e9d..c741786a 100644
--- a/asm/object/macroPlayer.s
+++ b/asm/object/macroPlayer.s
@@ -90,7 +90,7 @@ _0808CB70:
movs r5, #0
str r5, [r4, #0x34]
adds r1, r4, #0
- bl ResolveEntityBelow
+ bl SortEntityBelow
ldrb r0, [r4, #0xd]
cmp r0, #0
beq _0808CB98
diff --git a/asm/object/object30.s b/asm/object/object30.s
index 8ad2185f..6e3caadb 100644
--- a/asm/object/object30.s
+++ b/asm/object/object30.s
@@ -144,7 +144,7 @@ _0808A930:
asrs r0, r0, #0x18
strh r0, [r4, #0x36]
adds r0, r4, #0
- bl sub_08017850
+ bl IsCollidingPlayer
cmp r0, #0
beq _0808A962
_0808A954:
diff --git a/asm/object/object91.s b/asm/object/object91.s
index 6a8d37f8..f4fed50e 100644
--- a/asm/object/object91.s
+++ b/asm/object/object91.s
@@ -291,7 +291,7 @@ _0809C5E0: @ jump table
_0809C600:
ldr r0, [r5, #0x50]
adds r1, r5, #0
- bl ResolveEntityBelow
+ bl SortEntityBelow
ldr r0, [r5, #0x50]
ldrb r0, [r0, #0xd]
adds r6, r5, #0
@@ -382,7 +382,7 @@ _0809C6B4: .4byte gUnk_08123E1C
_0809C6B8:
ldr r0, [r5, #0x50]
adds r1, r5, #0
- bl ResolveEntityBelow
+ bl SortEntityBelow
ldr r0, [r5, #0x50]
ldrb r0, [r0, #0xd]
adds r6, r5, #0
@@ -864,7 +864,7 @@ _0809CA30:
adds r2, #2
ldrb r2, [r2]
rsbs r2, r2, #0
- bl sub_0806F62C
+ bl LinearMoveAngle
ldr r1, [r4, #0x54]
adds r0, r4, #0
movs r2, #0x48
diff --git a/asm/object/object96.s b/asm/object/object96.s
index 5fb797f2..62c8674d 100644
--- a/asm/object/object96.s
+++ b/asm/object/object96.s
@@ -189,7 +189,7 @@ sub_0809D8C8: @ 0x0809D8C8
_0809D8E4: .4byte gPlayerState
_0809D8E8:
adds r0, r5, #0
- bl sub_08017850
+ bl IsCollidingPlayer
cmp r0, #0
beq _0809D90A
ldrb r0, [r6, #0xd]
@@ -223,7 +223,7 @@ sub_0809D91C: @ 0x0809D91C
cmp r1, #0
beq _0809D934
adds r0, r4, #0
- bl ResolveEntityBelow
+ bl SortEntityBelow
_0809D934:
movs r0, #0x72
bl SoundReq
diff --git a/asm/object/object97.s b/asm/object/object97.s
index 65f2f74a..d49bbd58 100644
--- a/asm/object/object97.s
+++ b/asm/object/object97.s
@@ -1024,7 +1024,7 @@ _0809E170:
ldrsh r1, [r5, r0]
ldrb r2, [r5, #0x15]
adds r0, r5, #0
- bl sub_0806F62C
+ bl LinearMoveAngle
movs r1, #0x2e
ldrsh r0, [r5, r1]
mov r2, r8
diff --git a/asm/object/objectA8.s b/asm/object/objectA8.s
index c7b728bc..d719aaf3 100644
--- a/asm/object/objectA8.s
+++ b/asm/object/objectA8.s
@@ -340,7 +340,7 @@ _0809FD1C:
strh r0, [r4, #0x36]
ldr r1, _0809FD48 @ =gPlayerEntity
adds r0, r4, #0
- bl sub_080177A0
+ bl IsColliding
cmp r0, #0
beq _0809FD44
adds r0, r4, #0
diff --git a/asm/object/objectB4.s b/asm/object/objectB4.s
index eb36b53e..27adbace 100644
--- a/asm/object/objectB4.s
+++ b/asm/object/objectB4.s
@@ -95,7 +95,7 @@ _080A0C08:
strh r0, [r4, #0x32]
adds r0, r5, #0
adds r1, r4, #0
- bl ResolveEntityBelow
+ bl SortEntityBelow
_080A0C40:
ldrb r0, [r5, #0xf]
adds r0, #1
@@ -136,7 +136,7 @@ _080A0C6E:
strh r0, [r4, #0x32]
adds r0, r5, #0
adds r1, r4, #0
- bl ResolveEntityBelow
+ bl SortEntityBelow
_080A0C92:
ldrb r0, [r5, #0xf]
adds r0, #1
@@ -159,7 +159,7 @@ _080A0CA0:
strh r0, [r4, #0x32]
adds r0, r5, #0
adds r1, r4, #0
- bl ResolveEntityOnTop
+ bl SortEntityAbove
_080A0CC0:
movs r0, #0xb4
movs r1, #3
@@ -174,7 +174,7 @@ _080A0CC0:
strh r0, [r4, #0x32]
adds r0, r5, #0
adds r1, r4, #0
- bl ResolveEntityOnTop
+ bl SortEntityAbove
_080A0CE0:
pop {r4, r5, pc}
.align 2, 0
diff --git a/asm/object/objectOnSpinyBeetle.s b/asm/object/objectOnSpinyBeetle.s
index bcf85560..f93fa2a3 100644
--- a/asm/object/objectOnSpinyBeetle.s
+++ b/asm/object/objectOnSpinyBeetle.s
@@ -67,7 +67,7 @@ _080985AC:
_080985AE:
ldr r1, [r4, #0x50]
adds r0, r4, #0
- bl ResolveEntityBelow
+ bl SortEntityBelow
adds r0, r4, #0
bl sub_08098918
pop {r4, r5, pc}
@@ -569,7 +569,7 @@ _0809892E:
strb r0, [r2]
ldr r1, [r4, #0x50]
adds r0, r4, #0
- bl ResolveEntityBelow
+ bl SortEntityBelow
_08098968:
ldr r2, _0809898C @ =gUnk_08123558
adds r0, r6, #0
@@ -606,7 +606,7 @@ _08098990:
strb r0, [r2]
ldr r1, [r4, #0x50]
adds r0, r4, #0
- bl ResolveEntityBelow
+ bl SortEntityBelow
_080989B2:
strh r5, [r4, #0x36]
adds r1, r4, #0
diff --git a/asm/object/pressurePlate.s b/asm/object/pressurePlate.s
deleted file mode 100644
index 37a2339d..00000000
--- a/asm/object/pressurePlate.s
+++ /dev/null
@@ -1,308 +0,0 @@
- .include "asm/macros.inc"
-
- .include "constants/constants.inc"
-
- .syntax unified
-
- .text
-
-
- thumb_func_start PressurePlate
-PressurePlate: @ 0x08088804
- push {r4, lr}
- adds r4, r0, #0
- ldrb r0, [r4, #0xf]
- cmp r0, #0
- beq _08088828
- subs r0, #1
- strb r0, [r4, #0xf]
- lsls r0, r0, #0x18
- cmp r0, #0
- bne _08088828
- ldrb r0, [r4, #0x14]
- adds r1, r4, #0
- adds r1, #0x72
- strb r0, [r1]
- ldrb r1, [r4, #0x14]
- adds r0, r4, #0
- bl InitializeAnimation
-_08088828:
- ldr r0, _0808883C @ =gUnk_08120BE0
- ldrb r1, [r4, #0xc]
- lsls r1, r1, #2
- adds r1, r1, r0
- ldr r1, [r1]
- adds r0, r4, #0
- bl _call_via_r1
- pop {r4, pc}
- .align 2, 0
-_0808883C: .4byte gUnk_08120BE0
-
- thumb_func_start sub_08088840
-sub_08088840: @ 0x08088840
- movs r3, #1
- movs r1, #1
- strb r1, [r0, #0xc]
- ldrb r2, [r0, #0x18]
- subs r1, #5
- ands r1, r2
- orrs r1, r3
- strb r1, [r0, #0x18]
- adds r3, r0, #0
- adds r3, #0x29
- ldrb r1, [r3]
- movs r2, #7
- orrs r1, r2
- strb r1, [r3]
- ldr r1, _08088868 @ =gUnk_080FD1D4
- str r1, [r0, #0x48]
- ldrb r1, [r0, #0x14]
- adds r0, #0x72
- strb r1, [r0]
- bx lr
- .align 2, 0
-_08088868: .4byte gUnk_080FD1D4
-
- thumb_func_start sub_0808886C
-sub_0808886C: @ 0x0808886C
- push {r4, r5, lr}
- adds r5, r0, #0
- bl sub_08088938
- adds r4, r0, #0
- adds r0, r5, #0
- bl sub_080889A8
- adds r4, r4, r0
- lsls r4, r4, #0x18
- lsrs r4, r4, #0x18
- ldrb r1, [r5, #0xa]
- adds r0, r1, #2
- cmp r0, r4
- bgt _080888B8
- movs r1, #0
- movs r0, #2
- strb r0, [r5, #0xc]
- strb r1, [r5, #0xf]
- movs r0, #4
- strb r0, [r5, #0x14]
- strh r1, [r5, #0x36]
- adds r0, r5, #0
- movs r1, #4
- bl InitializeAnimation
- adds r0, r5, #0
- adds r0, #0x86
- ldrh r0, [r0]
- bl SetFlag
- ldr r0, _080888B4 @ =0x0000016B
- bl EnqueueSFX
- b _080888F2
- .align 2, 0
-_080888B4: .4byte 0x0000016B
-_080888B8:
- ldrb r0, [r5, #0x14]
- cmp r4, r0
- bls _080888E4
- adds r0, r1, #1
- cmp r0, r4
- bne _080888D2
- movs r0, #4
- strb r0, [r5, #0xf]
- adds r1, r4, #1
- adds r0, r5, #0
- bl InitializeAnimation
- b _080888DA
-_080888D2:
- adds r0, r5, #0
- adds r1, r4, #0
- bl InitializeAnimation
-_080888DA:
- movs r0, #0x86
- lsls r0, r0, #1
- bl EnqueueSFX
- b _080888F0
-_080888E4:
- cmp r4, r0
- bhs _080888F0
- adds r0, r5, #0
- adds r1, r4, #0
- bl InitializeAnimation
-_080888F0:
- strb r4, [r5, #0x14]
-_080888F2:
- pop {r4, r5, pc}
-
- thumb_func_start sub_080888F4
-sub_080888F4: @ 0x080888F4
- push {r4, r5, lr}
- adds r5, r0, #0
- adds r0, #0x70
- ldrh r0, [r0]
- cmp r0, #0
- beq _08088934
- adds r0, r5, #0
- bl sub_08088938
- adds r4, r0, #0
- adds r0, r5, #0
- bl sub_080889A8
- adds r4, r4, r0
- lsls r4, r4, #0x18
- lsrs r4, r4, #0x18
- ldrb r0, [r5, #0xa]
- adds r0, #2
- cmp r0, r4
- ble _08088934
- movs r0, #1
- strb r0, [r5, #0xc]
- strb r4, [r5, #0x14]
- adds r0, r5, #0
- adds r0, #0x86
- ldrh r0, [r0]
- bl ClearFlag
- adds r0, r5, #0
- adds r1, r4, #0
- bl InitializeAnimation
-_08088934:
- pop {r4, r5, pc}
- .align 2, 0
-
- thumb_func_start sub_08088938
-sub_08088938: @ 0x08088938
- push {r4, r5, r6, r7, lr}
- mov r7, r8
- push {r7}
- movs r5, #0
- ldrh r1, [r0, #0x2e]
- subs r1, #8
- lsls r1, r1, #0x10
- lsrs r1, r1, #0x10
- mov ip, r1
- ldrh r1, [r0, #0x32]
- subs r1, #8
- lsls r1, r1, #0x10
- lsrs r7, r1, #0x10
- movs r4, #0
- ldr r1, _080889A0 @ =gRoomVars
- ldr r2, _080889A4 @ =gUnk_08120BEC
- mov r8, r2
- adds r3, r1, #0
- adds r3, #0xac
- adds r6, r0, #0
- adds r6, #0x72
-_08088962:
- ldr r2, [r3]
- cmp r2, #0
- beq _08088990
- ldrh r0, [r2, #0x2e]
- mov r1, ip
- subs r0, r0, r1
- lsls r0, r0, #0x10
- lsrs r0, r0, #0x10
- cmp r0, #0x10
- bhi _08088990
- ldrh r0, [r2, #0x32]
- subs r0, r0, r7
- lsls r0, r0, #0x10
- lsrs r0, r0, #0x10
- cmp r0, #0x10
- bhi _08088990
- ldrb r0, [r6]
- add r0, r8
- ldrb r1, [r0]
- adds r0, r2, #0
- adds r0, #0x63
- strb r1, [r0]
- adds r5, #1
-_08088990:
- adds r3, #4
- adds r4, #1
- cmp r4, #7
- bls _08088962
- adds r0, r5, #0
- pop {r3}
- mov r8, r3
- pop {r4, r5, r6, r7, pc}
- .align 2, 0
-_080889A0: .4byte gRoomVars
-_080889A4: .4byte gUnk_08120BEC
-
- thumb_func_start sub_080889A8
-sub_080889A8: @ 0x080889A8
- push {r4, r5, r6, lr}
- adds r4, r0, #0
- movs r5, #0
- bl sub_08017850
- cmp r0, #0
- beq _080889CA
- ldr r1, _08088A40 @ =gPlayerEntity
- ldr r2, _08088A44 @ =gUnk_08120BEC
- adds r0, r4, #0
- adds r0, #0x72
- ldrb r0, [r0]
- adds r0, r0, r2
- ldrb r0, [r0]
- adds r1, #0x63
- strb r0, [r1]
- movs r5, #1
-_080889CA:
- ldr r0, _08088A48 @ =gPlayerState
- ldr r0, [r0, #0x30]
- movs r1, #0x80
- lsls r1, r1, #0xf
- ands r0, r1
- cmp r0, #0
- beq _08088A3A
- ldr r6, _08088A4C @ =gPlayerClones
- ldr r1, [r6]
- adds r0, r4, #0
- bl sub_080177A0
- cmp r0, #0
- beq _080889FA
- ldr r1, [r6]
- ldr r2, _08088A44 @ =gUnk_08120BEC
- adds r0, r4, #0
- adds r0, #0x72
- ldrb r0, [r0]
- adds r0, r0, r2
- ldrb r0, [r0]
- adds r1, #0x63
- strb r0, [r1]
- adds r5, #1
-_080889FA:
- ldr r1, [r6, #4]
- adds r0, r4, #0
- bl sub_080177A0
- cmp r0, #0
- beq _08088A1A
- ldr r1, [r6, #4]
- ldr r2, _08088A44 @ =gUnk_08120BEC
- adds r0, r4, #0
- adds r0, #0x72
- ldrb r0, [r0]
- adds r0, r0, r2
- ldrb r0, [r0]
- adds r1, #0x63
- strb r0, [r1]
- adds r5, #1
-_08088A1A:
- ldr r1, [r6, #8]
- adds r0, r4, #0
- bl sub_080177A0
- cmp r0, #0
- beq _08088A3A
- ldr r1, [r6, #8]
- ldr r2, _08088A44 @ =gUnk_08120BEC
- adds r0, r4, #0
- adds r0, #0x72
- ldrb r0, [r0]
- adds r0, r0, r2
- ldrb r0, [r0]
- adds r1, #0x63
- strb r0, [r1]
- adds r5, #1
-_08088A3A:
- adds r0, r5, #0
- pop {r4, r5, r6, pc}
- .align 2, 0
-_08088A40: .4byte gPlayerEntity
-_08088A44: .4byte gUnk_08120BEC
-_08088A48: .4byte gPlayerState
-_08088A4C: .4byte gPlayerClones
diff --git a/asm/object/specialFx.s b/asm/object/specialFx.s
index 5a0f7a1b..286e0046 100644
--- a/asm/object/specialFx.s
+++ b/asm/object/specialFx.s
@@ -459,7 +459,7 @@ _080847F0:
strh r0, [r5, #0x36]
adds r0, r4, #0
adds r1, r5, #0
- bl ResolveEntityOnTop
+ bl SortEntityAbove
adds r0, r5, #0
bl sub_080845DC
pop {r4, r5, pc}
diff --git a/asm/object/windTribeTeleporter.s b/asm/object/windTribeTeleporter.s
index 34541e9e..4fe081a9 100644
--- a/asm/object/windTribeTeleporter.s
+++ b/asm/object/windTribeTeleporter.s
@@ -709,7 +709,7 @@ sub_080A11C0: @ 0x080A11C0
cmp r0, #0
bne _080A11DC
adds r0, r1, #0
- bl sub_08017850
+ bl IsCollidingPlayer
b _080A11DE
.align 2, 0
_080A11D8: .4byte gPlayerEntity
diff --git a/asm/objectUtils.s b/asm/objectUtils.s
index 67edbaa6..f90b70e4 100644
--- a/asm/objectUtils.s
+++ b/asm/objectUtils.s
@@ -167,7 +167,7 @@ _080A2BB4:
bl PositionRelative
adds r0, r5, #0
adds r1, r4, #0
- bl ResolveEntityOnTop
+ bl SortEntityAbove
adds r0, r5, #0
adds r0, #0x62
ldrb r0, [r0]
@@ -380,7 +380,7 @@ CreateSpeechBubble: @ 0x080A2D2C
bl CopyPosition
adds r0, r5, #0
adds r1, r4, #0
- bl ResolveEntityOnTop
+ bl SortEntityAbove
str r5, [r4, #0x50]
adds r0, r4, #0
adds r0, #0x62
diff --git a/assets/assets.json b/assets/assets.json
index 817b639f..a3f59b21 100644
--- a/assets/assets.json
+++ b/assets/assets.json
@@ -29336,16 +29336,6 @@
"size": 8
},
{
- "path": "enemy66/gUnk_080D2ABC.bin",
- "start": 862908,
- "size": 88
- },
- {
- "path": "enemy66/gUnk_080D2ABC_1.bin",
- "start": 863000,
- "size": 320
- },
- {
"path": "data_080D3D94/gUnk_080D3D94.bin",
"start": 867732,
"size": 224
diff --git a/assets/sounds.json b/assets/sounds.json
index e5769e56..af97a90f 100644
--- a/assets/sounds.json
+++ b/assets/sounds.json
@@ -2861,7 +2861,7 @@
"size": 52
},
{
- "path": "sounds/sfx10C.bin",
+ "path": "sounds/sfxButtonPress.bin",
"start": 14557448,
"type": "midi",
"options": {
@@ -3906,7 +3906,7 @@
"size": 60
},
{
- "path": "sounds/sfx16B.bin",
+ "path": "sounds/sfxPressurePlate.bin",
"start": 14565100,
"type": "midi",
"options": {
diff --git a/constants/audio_constants.inc b/constants/audio_constants.inc
index 94589a41..f6319c47 100644
--- a/constants/audio_constants.inc
+++ b/constants/audio_constants.inc
@@ -266,7 +266,7 @@
.equiv SFX_109, 0x109
.equiv SFX_10A, 0x10a
.equiv SFX_10B, 0x10b
- .equiv SFX_10C, 0x10c
+ .equiv SFX_BUTTON_PRESS, 0x10c
.equiv SFX_10D, 0x10d
.equiv SFX_10E, 0x10e
.equiv SFX_10F, 0x10f
diff --git a/data/animations/object/pressurePlate.s b/data/animations/object/pressurePlate.s
deleted file mode 100644
index 75e87fa0..00000000
--- a/data/animations/object/pressurePlate.s
+++ /dev/null
@@ -1,27 +0,0 @@
- .include "asm/macros.inc"
- .include "constants/constants.inc"
-
- .section .rodata
-@ .align 2
-
-gSpriteAnimations_PressurePlate_0:: @ 08120BF1
- .include "animations/gSpriteAnimations_PressurePlate_0.s"
-
-gSpriteAnimations_PressurePlate_1:: @ 08120BF5
- .include "animations/gSpriteAnimations_PressurePlate_1.s"
-
-gSpriteAnimations_PressurePlate_2:: @ 08120BF9
- .include "animations/gSpriteAnimations_PressurePlate_2.s"
-
-gSpriteAnimations_PressurePlate_3:: @ 08120BFD
- .include "animations/gSpriteAnimations_PressurePlate_3.s"
-
-gSpriteAnimations_PressurePlate_4:: @ 08120C01
- .include "animations/gSpriteAnimations_PressurePlate_4.s"
-
-gSpriteAnimations_PressurePlate:: @ 08120C08
- .4byte gSpriteAnimations_PressurePlate_0
- .4byte gSpriteAnimations_PressurePlate_1
- .4byte gSpriteAnimations_PressurePlate_2
- .4byte gSpriteAnimations_PressurePlate_3
- .4byte gSpriteAnimations_PressurePlate_4
diff --git a/data/const/enemy/enemy66.s b/data/const/enemy/enemy66.s
deleted file mode 100644
index 98a7f045..00000000
--- a/data/const/enemy/enemy66.s
+++ /dev/null
@@ -1,10 +0,0 @@
- .include "asm/macros.inc"
- .include "constants/constants.inc"
-
- .section .rodata
- .align 2
-
-gUnk_080D2ABC:: @ 080D2ABC
- .incbin "enemy66/gUnk_080D2ABC.bin"
- .4byte sub_08029270
- .incbin "enemy66/gUnk_080D2ABC_1.bin"
diff --git a/data/const/object/pressurePlate.s b/data/const/object/pressurePlate.s
deleted file mode 100644
index 15f9e807..00000000
--- a/data/const/object/pressurePlate.s
+++ /dev/null
@@ -1,13 +0,0 @@
- .include "asm/macros.inc"
- .include "constants/constants.inc"
-
- .section .rodata
- .align 2
-
-gUnk_08120BE0:: @ 08120BE0
- .4byte sub_08088840
- .4byte sub_0808886C
- .4byte sub_080888F4
-
-gUnk_08120BEC:: @ 08120BEC
- .incbin "PressurePlate/gUnk_08120BEC.bin"
diff --git a/data/scripts/hyruleTown/script_Carlov.inc b/data/scripts/hyruleTown/script_Carlov.inc
index 8a925f4d..3248dd3a 100644
--- a/data/scripts/hyruleTown/script_Carlov.inc
+++ b/data/scripts/hyruleTown/script_Carlov.inc
@@ -46,7 +46,7 @@ script_080144C0:
script_080144C8:
ModRupees 0xfff6
MessageFromTarget 0x420c
- PlaySound SFX_10C
+ PlaySound SFX_BUTTON_PRESS
Wait 0x0018
SetRoomFlag 0x0000
SetLocalFlag 0x0092
diff --git a/data/sound/sounds.s b/data/sound/sounds.s
index fb2a0819..840cb9fe 100644
--- a/data/sound/sounds.s
+++ b/data/sound/sounds.s
@@ -232,7 +232,7 @@
.include "sounds/sfx109.s"
.include "sounds/sfx10A.s"
.include "sounds/sfx10B.s"
- .include "sounds/sfx10C.s"
+ .include "sounds/sfxButtonPress.s"
.include "sounds/sfx10D.s"
.include "sounds/sfx10E.s"
.include "sounds/sfx10F.s"
@@ -327,7 +327,7 @@
.include "sounds/sfx168.s"
.include "sounds/sfx169.s"
.include "sounds/sfx16A.s"
- .include "sounds/sfx16B.s"
+ .include "sounds/sfxPressurePlate.s"
.include "sounds/sfx16C.s"
.include "sounds/sfx16D.s"
.include "sounds/sfx16E.s"
diff --git a/include/coord.h b/include/coord.h
index 85a56ce2..5ead1236 100644
--- a/include/coord.h
+++ b/include/coord.h
@@ -12,8 +12,8 @@ void PositionEntityOnTop(Entity*, Entity*);
void PositionRelative(Entity*, Entity*, s32, s32);
void CopyPositionAndSpriteOffset(Entity* param_1, Entity* param_2);
void sub_0806FA90(Entity*, Entity*, s32, s32);
-void ResolveEntityOnTop(Entity*, Entity*);
-void ResolveEntityBelow(Entity*, Entity*);
+void SortEntityAbove(Entity*, Entity*);
+void SortEntityBelow(Entity*, Entity*);
u32 sub_0806F5A4(u32 idx);
u32 sub_0806F3E4(Entity*);
diff --git a/include/entity.h b/include/entity.h
index c3477e9e..5ff5dcdc 100644
--- a/include/entity.h
+++ b/include/entity.h
@@ -160,14 +160,14 @@ typedef struct Entity_ {
/*0x1d*/ u8 field_0x1d;
/*0x1e*/ u8 frameIndex;
/*0x1f*/ u8 lastFrameIndex;
- /*0x20*/ s32 zVelocity; /**< Z axis speed. */
+ /*0x20*/ s32 zVelocity; /**< Z axis speed, measured in px/frame */
/*0x24*/ s16 speed; /**< Magnitude of speed. */
/*0x26*/ u8 spriteAnimation[3];
/*0x29*/ SpritePriority spritePriority;
/*0x2a*/ u16 collisions;
- /*0x2c*/ union SplitWord x; /**< X position, fixed point. */
- /*0x30*/ union SplitWord y; /**< Y position, fixed point. */
- /*0x34*/ union SplitWord z; /**< Z position, fixed point. */
+ /*0x2c*/ union SplitWord x; /**< X position, fixed point Q16.16. */
+ /*0x30*/ union SplitWord y; /**< Y position, fixed point Q16.16. */
+ /*0x34*/ union SplitWord z; /**< Z position, fixed point Q16.16. */
/*0x38*/ u8 collisionLayer; /**< Collision layer. */
/*0x39*/ s8 interactType;
/*0x3a*/ u8 field_0x3a;
diff --git a/include/functions.h b/include/functions.h
index e6d66558..0fba11a2 100644
--- a/include/functions.h
+++ b/include/functions.h
@@ -86,7 +86,7 @@ extern u32 sub_080002B8(Entity*);
extern u32 sub_08049F84(Entity*, u32);
extern u32 sub_0800419C(Entity*, Entity*, u32, u32);
extern void sub_08004542(Entity*);
-extern u32 sub_08017850(Entity*);
+extern u32 IsCollidingPlayer(Entity*);
extern void sub_080809D4(void);
extern void sub_08080CB4(Entity*);
extern void sub_0807B7D8(u32, u32, u32);
@@ -96,7 +96,7 @@ extern u32 sub_0805F8F8(u32);
extern u32 sub_0805F7A0(u32);
extern u32* sub_0805F25C(u32);
u32 isEntityWithinDistance(Entity*, s32, s32, s32);
-extern void sub_0806F62C(Entity*, u32, u32);
+extern void LinearMoveAngle(Entity*, u32, u32);
extern void sub_080A1ED0(u32, u32, u32);
extern u32 sub_0806F5B0(u32);
extern void sub_08078790(Entity*, u32);
@@ -125,7 +125,7 @@ extern bool32 sub_080806BC(u32, u32, u32, u32);
extern bool32 sub_0806FC80(Entity*, Entity*, s32);
extern u32 sub_080002B4(Entity*, u32, u32);
extern u32 sub_080AF134(Entity*);
-extern void sub_0806F5BC(Entity*, u32, u32);
+extern void LinearMoveDirection(Entity*, u32, u32);
extern void sub_080A2AF4(Entity*, u32, u32);
extern u32 sub_080002CC(Entity*, s32, s32);
extern bool32 sub_0807BD14(Entity*, u32);
diff --git a/include/global.h b/include/global.h
index 0f656445..8521b77c 100644
--- a/include/global.h
+++ b/include/global.h
@@ -59,8 +59,8 @@
// Converts a number to Q8.8 fixed-point format
#define Q_8_8(n) ((s16)((n)*256))
-// Converts a number to Q4.12 fixed-point format
-#define Q_4_12(n) ((s16)((n)*4096))
+// Converts a number to Q16.16 fixed-point format
+#define Q_16_16(n) ((s32)((n) * (1 << 16)))
#define min(a, b) ((a) < (b) ? (a) : (b))
#define max(a, b) ((a) >= (b) ? (a) : (b))
diff --git a/include/object.h b/include/object.h
index fa41a123..53338ef3 100644
--- a/include/object.h
+++ b/include/object.h
@@ -262,7 +262,7 @@ void Object20(Entity*);
void Object21(Entity*);
void FigurineDevice(Entity*);
void EyeSwitch(Entity*);
-void PressurePlate(Entity*);
+void PressurePlate();
void BigBarrel(Entity*);
void BarrelInside(Entity*);
void PushableStatue(Entity*);
diff --git a/include/player.h b/include/player.h
index 09483161..b0658c39 100644
--- a/include/player.h
+++ b/include/player.h
@@ -278,6 +278,7 @@ extern void (*const gPlayerItemFunctions[])(Entity*);
extern u8 gBombBagSizes[];
extern u8 gQuiverSizes[];
extern u16 gWalletSizes[];
+extern Entity* gPlayerClones[];
extern PlayerState gPlayerState;
extern Entity gPlayerEntity;
diff --git a/include/sound.h b/include/sound.h
index 8549510f..58462600 100644
--- a/include/sound.h
+++ b/include/sound.h
@@ -299,7 +299,7 @@ typedef enum {
SFX_109,
SFX_10A,
SFX_10B,
- SFX_10C,
+ SFX_BUTTON_PRESS,
SFX_10D,
SFX_10E,
SFX_10F,
@@ -394,7 +394,7 @@ typedef enum {
SFX_168,
SFX_169,
SFX_16A,
- SFX_16B,
+ SFX_PRESSURE_PLATE,
SFX_16C,
SFX_16D,
SFX_16E,
diff --git a/include/sprite.h b/include/sprite.h
index bb2445b1..7539891f 100644
--- a/include/sprite.h
+++ b/include/sprite.h
@@ -22,7 +22,7 @@ typedef struct {
u8 endOfAnimation : 1;
} PACKED b;
} PACKED frameSettings;
-} Frame;
+} PACKED Frame;
typedef struct {
u8 numGfxTiles;
diff --git a/linker.ld b/linker.ld
index a8d29dad..6f202bbc 100644
--- a/linker.ld
+++ b/linker.ld
@@ -425,7 +425,7 @@ SECTIONS {
src/enemy/gyorgFemaleMouth.o(.text);
asm/enemy/enemy64.o(.text);
src/enemy/treeItem.o(.text);
- asm/enemy/enemy66.o(.text);
+ src/enemy/enemy66.o(.text);
/* END enemies */
src/code_08049CD4.o(.text); /* enemyUtils.c */
asm/code_08049D30.o(.text);
@@ -679,7 +679,7 @@ SECTIONS {
asm/object/object21.o(.text);
asm/object/figurineDevice.o(.text);
asm/object/eyeSwitch.o(.text);
- asm/object/pressurePlate.o(.text);
+ src/object/pressurePlate.o(.text);
asm/object/bigBarrel.o(.text);
src/object/barrelInside.o(.text);
asm/object/pushableStatue.o(.text);
@@ -1116,7 +1116,7 @@ SECTIONS {
data/animations/enemy/gyorgFemaleMouth.o(.rodata);
data/const/enemy/enemy64.o(.rodata);
src/enemy/treeItem.o(.rodata);
- data/const/enemy/enemy66.o(.rodata);
+ src/enemy/enemy66.o(.rodata);
src/enemy.o(.rodata);
data/data_080D3D94.o(.rodata);
data/map/entity_headers.o(.rodata);
@@ -1401,8 +1401,7 @@ SECTIONS {
data/animations/object/figurineDevice.o(.rodata);
data/const/object/eyeSwitch.o(.rodata);
data/animations/object/eyeSwitch.o(.rodata);
- data/const/object/pressurePlate.o(.rodata);
- data/animations/object/pressurePlate.o(.rodata);
+ src/object/pressurePlate.o(.rodata);
data/const/object/bigBarrel.o(.rodata);
data/animations/object/bigBarrel.o(.rodata);
src/object/barrelInside.o(.rodata);
diff --git a/src/code_0805436C.c b/src/code_0805436C.c
index 6d3eb919..2cb38c6e 100644
--- a/src/code_0805436C.c
+++ b/src/code_0805436C.c
@@ -250,7 +250,7 @@ u32 CreateItemDrop(Entity* arg0, u32 itemID, u32 itemParameter) {
} 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);
diff --git a/src/collision.c b/src/collision.c
index f33bcb3f..b312d6ea 100644
--- a/src/collision.c
+++ b/src/collision.c
@@ -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;
}
@@ -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;
@@ -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;
diff --git a/src/coord.c b/src/coord.c
index 55447c9d..f9d02f5a 100644
--- a/src/coord.c
+++ b/src/coord.c
@@ -108,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) {
@@ -179,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;
@@ -188,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;
}
}
@@ -323,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) {
@@ -347,23 +347,23 @@ 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) {
+void SortEntityAbove(Entity* param_1, Entity* param_2) {
param_2->spritePriority.b0 = gEntityOnTopArray[param_1->spritePriority.b0];
}
-void ResolveEntityBelow(Entity* param_1, Entity* param_2) {
+void SortEntityBelow(Entity* param_1, Entity* param_2) {
param_2->spritePriority.b0 = gEntityBelowArray[param_1->spritePriority.b0];
}
diff --git a/src/enemy/acroBandits.c b/src/enemy/acroBandits.c
index 426b3baf..ae071c63 100644
--- a/src/enemy/acroBandits.c
+++ b/src/enemy/acroBandits.c
@@ -104,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);
}
@@ -315,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);
@@ -325,7 +325,7 @@ 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;
@@ -442,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);
}
@@ -477,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--;
diff --git a/src/enemy/beetle.c b/src/enemy/beetle.c
index c03ff919..e01f69d1 100644
--- a/src/enemy/beetle.c
+++ b/src/enemy/beetle.c
@@ -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);
@@ -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;
}
diff --git a/src/enemy/bobomb.c b/src/enemy/bobomb.c
index ebc47375..ef6c9dcf 100644
--- a/src/enemy/bobomb.c
+++ b/src/enemy/bobomb.c
@@ -61,7 +61,7 @@ void sub_0802C688(Entity* this) {
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;
diff --git a/src/enemy/bombPeahat.c b/src/enemy/bombPeahat.c
index 3a7a0064..bc6367ee 100644
--- a/src/enemy/bombPeahat.c
+++ b/src/enemy/bombPeahat.c
@@ -381,7 +381,7 @@ void sub_0802ADDC(Entity* this) {
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;
diff --git a/src/enemy/chuchu.c b/src/enemy/chuchu.c
index 9d8d4ff3..c8e7640e 100644
--- a/src/enemy/chuchu.c
+++ b/src/enemy/chuchu.c
@@ -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);
}
diff --git a/src/enemy/cuccoChickAggr.c b/src/enemy/cuccoChickAggr.c
index 2b6bb47f..94326739 100644
--- a/src/enemy/cuccoChickAggr.c
+++ b/src/enemy/cuccoChickAggr.c
@@ -52,7 +52,7 @@ void sub_08022988(Entity* this) {
return;
this->frameIndex = 1;
- this->zVelocity = 0x10000;
+ this->zVelocity = Q_16_16(1.0);
EnqueueSFX(0xd6);
}
@@ -78,7 +78,7 @@ void sub_080229F8(Entity* this) {
this->speed = 0xc0;
sub_08022B44(this);
} else {
- this->zVelocity = 0x10000;
+ this->zVelocity = Q_16_16(1.0);
EnqueueSFX(0xd6);
}
}
@@ -141,7 +141,7 @@ 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)
diff --git a/src/enemy/enemy66.c b/src/enemy/enemy66.c
new file mode 100644
index 00000000..6975e5e8
--- /dev/null
+++ b/src/enemy/enemy66.c
@@ -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,
+};
diff --git a/src/enemy/fallingBoulder.c b/src/enemy/fallingBoulder.c
index d414ce52..a9dfc7d6 100644
--- a/src/enemy/fallingBoulder.c
+++ b/src/enemy/fallingBoulder.c
@@ -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) {
@@ -195,7 +195,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];
diff --git a/src/enemy/fireballGuy.c b/src/enemy/fireballGuy.c
index 5e81c1d6..a0546fb8 100644
--- a/src/enemy/fireballGuy.c
+++ b/src/enemy/fireballGuy.c
@@ -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;
diff --git a/src/enemy/flyingSkull.c b/src/enemy/flyingSkull.c
index 3bfe18f5..28e2e06e 100644
--- a/src/enemy/flyingSkull.c
+++ b/src/enemy/flyingSkull.c
@@ -46,7 +46,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) {
diff --git a/src/enemy/gleerok.c b/src/enemy/gleerok.c
index 8066e3fc..cfad4857 100644
--- a/src/enemy/gleerok.c
+++ b/src/enemy/gleerok.c
@@ -605,7 +605,7 @@ NONMATCH("asm/non_matching/gleerok/sub_0802D86C.inc", void sub_0802D86C(GleerokE
super->parent->subAction = 4;
super->parent->type2 = 0;
((GleerokEntity*)super->parent)->unk_7b = 0;
- SoundReq(SFX_10C);
+ SoundReq(SFX_BUTTON_PRESS);
}
} else {
if (super->actionDelay != this->unk_84->filler[1]) {
diff --git a/src/enemy/gyorgMale.c b/src/enemy/gyorgMale.c
index d846433b..368d68c6 100644
--- a/src/enemy/gyorgMale.c
+++ b/src/enemy/gyorgMale.c
@@ -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;
diff --git a/src/enemy/helmasaur.c b/src/enemy/helmasaur.c
index 3187c340..be7f9dad 100644
--- a/src/enemy/helmasaur.c
+++ b/src/enemy/helmasaur.c
@@ -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
diff --git a/src/enemy/keaton.c b/src/enemy/keaton.c
index 3e1a0679..78349fbb 100644
--- a/src/enemy/keaton.c
+++ b/src/enemy/keaton.c
@@ -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]));
}
}
diff --git a/src/enemy/lakitu.c b/src/enemy/lakitu.c
index 1c6015c4..be2c827a 100644
--- a/src/enemy/lakitu.c
+++ b/src/enemy/lakitu.c
@@ -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 {
@@ -316,7 +316,7 @@ 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);
}
@@ -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;
@@ -365,26 +367,26 @@ void sub_0803CC08(Entity* this) {
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;
diff --git a/src/enemy/likeLike.c b/src/enemy/likeLike.c
index ca5f59e0..d65a4c8a 100644
--- a/src/enemy/likeLike.c
+++ b/src/enemy/likeLike.c
@@ -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];
@@ -215,7 +215,7 @@ NONMATCH("asm/non_matching/likeLike/sub_0802810C.inc", void sub_0802810C(Entity*
gPlayerState.field_0xa = 0;
gPlayerState.flags &= 0xffffffef;
gPlayerEntity.flags |= 0x80;
- gPlayerEntity.zVelocity = 0x18000;
+ gPlayerEntity.zVelocity = Q_16_16(1.5);
gPlayerEntity.iframes = -60;
gPlayerEntity.direction = gPlayerEntity.animationState << 2;
gPlayerEntity.spritePriority.b1 = this->field_0x82.HALF.HI;
diff --git a/src/enemy/mazaalBracelet.c b/src/enemy/mazaalBracelet.c
index 56ab79b4..763a529e 100644
--- a/src/enemy/mazaalBracelet.c
+++ b/src/enemy/mazaalBracelet.c
@@ -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;
@@ -917,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 {
@@ -974,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;
@@ -1086,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);
@@ -1115,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) {
@@ -1231,7 +1231,7 @@ void sub_0803B798(void) {
gPlayerState.field_0xa = 0;
gPlayerState.flags &= ~(0xffff0000 | PL_CAPTURED);
gPlayerEntity.flags |= 0x80;
- gPlayerEntity.zVelocity = 0x18000;
+ gPlayerEntity.zVelocity = Q_16_16(1.5);
gPlayerEntity.z.HALF.HI = -10;
gPlayerEntity.direction = 0x10;
gPlayerEntity.animationState = 4;
diff --git a/src/enemy/mazaalHead.c b/src/enemy/mazaalHead.c
index af37d745..fa44a8d4 100644
--- a/src/enemy/mazaalHead.c
+++ b/src/enemy/mazaalHead.c
@@ -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));
}
}
}
diff --git a/src/enemy/miniFireballGuy.c b/src/enemy/miniFireballGuy.c
index b9a64caf..fd6f54e2 100644
--- a/src/enemy/miniFireballGuy.c
+++ b/src/enemy/miniFireballGuy.c
@@ -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 {
diff --git a/src/enemy/moldworm.c b/src/enemy/moldworm.c
index cb055f0b..80d1a055 100644
--- a/src/enemy/moldworm.c
+++ b/src/enemy/moldworm.c
@@ -87,7 +87,7 @@ void sub_080230E4(Entity* this) {
CopyPosition(this, &gPlayerEntity);
gPlayerEntity.flags = gPlayerEntity.flags | 0x80;
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 {
diff --git a/src/enemy/octorokBoss.c b/src/enemy/octorokBoss.c
index c0aa2b65..f603afd8 100644
--- a/src/enemy/octorokBoss.c
+++ b/src/enemy/octorokBoss.c
@@ -617,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) {
@@ -649,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;
@@ -693,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)--;
@@ -939,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;
diff --git a/src/enemy/peahat.c b/src/enemy/peahat.c
index 2f08e47a..6389b179 100644
--- a/src/enemy/peahat.c
+++ b/src/enemy/peahat.c
@@ -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 {
diff --git a/src/enemy/pesto.c b/src/enemy/pesto.c
index 34e316cc..b52a69fc 100644
--- a/src/enemy/pesto.c
+++ b/src/enemy/pesto.c
@@ -811,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;
diff --git a/src/enemy/puffstool.c b/src/enemy/puffstool.c
index 6e35dbfc..e4763610 100644
--- a/src/enemy/puffstool.c
+++ b/src/enemy/puffstool.c
@@ -198,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);
}
}
@@ -210,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);
}
@@ -240,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);
}
}
@@ -257,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);
@@ -269,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) {
@@ -553,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;
@@ -567,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;
}
}
diff --git a/src/enemy/rollobite.c b/src/enemy/rollobite.c
index 9a86c115..c80786d3 100644
--- a/src/enemy/rollobite.c
+++ b/src/enemy/rollobite.c
@@ -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);
}
@@ -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;
diff --git a/src/enemy/rupeeLike.c b/src/enemy/rupeeLike.c
index d2393187..bb8e176f 100644
--- a/src/enemy/rupeeLike.c
+++ b/src/enemy/rupeeLike.c
@@ -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;
@@ -240,7 +240,7 @@ void sub_080296D8(Entity* this) {
gPlayerState.jump_status = 0x41;
gPlayerState.flags &= ~PL_CAPTURED;
gPlayerEntity.flags |= 0x80;
- gPlayerEntity.zVelocity = 0x18000;
+ gPlayerEntity.zVelocity = Q_16_16(1.5);
gPlayerEntity.iframes = 0xa6;
gPlayerEntity.z.HALF.HI = -2;
gPlayerEntity.direction = gPlayerEntity.animationState << 2;
diff --git a/src/enemy/sluggula.c b/src/enemy/sluggula.c
index 308d914f..720b3a50 100644
--- a/src/enemy/sluggula.c
+++ b/src/enemy/sluggula.c
@@ -124,7 +124,7 @@ void sub_08023CE0(Entity* this) {
EnqueueSFX(0x12d);
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);
@@ -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]));
}
}
}
diff --git a/src/enemy/spikedBeetle.c b/src/enemy/spikedBeetle.c
index a6fa4ae6..f4f6792e 100644
--- a/src/enemy/spikedBeetle.c
+++ b/src/enemy/spikedBeetle.c
@@ -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;
@@ -171,7 +171,7 @@ 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);
diff --git a/src/enemy/spinyChuchu.c b/src/enemy/spinyChuchu.c
index a51c8ac4..c6db356b 100644
--- a/src/enemy/spinyChuchu.c
+++ b/src/enemy/spinyChuchu.c
@@ -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,7 +132,7 @@ 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;
@@ -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;
@@ -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,7 +225,7 @@ 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);
diff --git a/src/enemy/tektiteGolden.c b/src/enemy/tektiteGolden.c
index 4c63076d..3841377e 100644
--- a/src/enemy/tektiteGolden.c
+++ b/src/enemy/tektiteGolden.c
@@ -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 {
diff --git a/src/enemy/vaatiArm.c b/src/enemy/vaatiArm.c
index fc3e8e21..42b24b13 100644
--- a/src/enemy/vaatiArm.c
+++ b/src/enemy/vaatiArm.c
@@ -951,7 +951,7 @@ 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;
@@ -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;
diff --git a/src/enemy/vaatiBall.c b/src/enemy/vaatiBall.c
index 14970d34..82dd8948 100644
--- a/src/enemy/vaatiBall.c
+++ b/src/enemy/vaatiBall.c
@@ -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;
@@ -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);
}
diff --git a/src/enemy/vaatiProjectile.c b/src/enemy/vaatiProjectile.c
index c9d1fbbf..39e68307 100644
--- a/src/enemy/vaatiProjectile.c
+++ b/src/enemy/vaatiProjectile.c
@@ -121,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);
}
}
@@ -207,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);
}
diff --git a/src/enemy/vaatiRebornEnemy.c b/src/enemy/vaatiRebornEnemy.c
index 612e3af4..99f1777b 100644
--- a/src/enemy/vaatiRebornEnemy.c
+++ b/src/enemy/vaatiRebornEnemy.c
@@ -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);
}
diff --git a/src/enemy/vaatiTransfigured.c b/src/enemy/vaatiTransfigured.c
index 2dd541ac..bf2ef39c 100644
--- a/src/enemy/vaatiTransfigured.c
+++ b/src/enemy/vaatiTransfigured.c
@@ -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) {
@@ -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);
}
}
diff --git a/src/enemy/vaatiTransfiguredEye.c b/src/enemy/vaatiTransfiguredEye.c
index 80fbb07f..e02f2f1b 100644
--- a/src/enemy/vaatiTransfiguredEye.c
+++ b/src/enemy/vaatiTransfiguredEye.c
@@ -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) {
diff --git a/src/enemy/vaatiWrath.c b/src/enemy/vaatiWrath.c
index cb9c9dc9..41df9d76 100644
--- a/src/enemy/vaatiWrath.c
+++ b/src/enemy/vaatiWrath.c
@@ -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;
diff --git a/src/enemy/vaatiWrathEye.c b/src/enemy/vaatiWrathEye.c
index 3a076bb6..360ba2eb 100644
--- a/src/enemy/vaatiWrathEye.c
+++ b/src/enemy/vaatiWrathEye.c
@@ -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));
}
}
}
diff --git a/src/enemy/waterDrop.c b/src/enemy/waterDrop.c
index 3ce0985c..d964ab45 100644
--- a/src/enemy/waterDrop.c
+++ b/src/enemy/waterDrop.c
@@ -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;
diff --git a/src/item/itemRocsCape.c b/src/item/itemRocsCape.c
index ddba77c5..c3af396c 100644
--- a/src/item/itemRocsCape.c
+++ b/src/item/itemRocsCape.c
@@ -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);
diff --git a/src/npc/bigGoron.c b/src/npc/bigGoron.c
index 7bb9f3e3..0245c49c 100644
--- a/src/npc/bigGoron.c
+++ b/src/npc/bigGoron.c
@@ -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);
}
}
diff --git a/src/npc/bladeBrothers.c b/src/npc/bladeBrothers.c
index 0b7de9f5..5d2ddca1 100644
--- a/src/npc/bladeBrothers.c
+++ b/src/npc/bladeBrothers.c
@@ -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);
}
}
diff --git a/src/npc/castorWildsStatue.c b/src/npc/castorWildsStatue.c
index f3614564..2c388a08 100644
--- a/src/npc/castorWildsStatue.c
+++ b/src/npc/castorWildsStatue.c
@@ -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) {
diff --git a/src/npc/cuccoChick.c b/src/npc/cuccoChick.c
index 0ccc0d17..46b564ad 100644
--- a/src/npc/cuccoChick.c
+++ b/src/npc/cuccoChick.c
@@ -75,7 +75,7 @@ void CuccoChick_Fusion(Entity* this) {
this->frameIndex = 1;
} else {
if (GravityUpdate(this, 0x3000) == 0) {
- this->zVelocity = 0x10000;
+ this->zVelocity = Q_16_16(1.0);
}
}
}
diff --git a/src/npc/drLeft.c b/src/npc/drLeft.c
index a4942f0f..65eabde0 100644
--- a/src/npc/drLeft.c
+++ b/src/npc/drLeft.c
@@ -22,7 +22,7 @@ void DrLeft(Entity* this) {
if (this->action == 0) {
this->action += 1;
this->frameIndex = 0;
- ResolveEntityBelow(this, this);
+ SortEntityBelow(this, this);
}
}
}
diff --git a/src/npc/ezlo.c b/src/npc/ezlo.c
index 77a69331..872a99c6 100644
--- a/src/npc/ezlo.c
+++ b/src/npc/ezlo.c
@@ -54,7 +54,7 @@ void sub_0806D96C(Entity* this) {
Entity* fx = CreateFx(this, FX_STEAM_EFC, 0);
if (fx != NULL) {
fx->spritePriority.b0 = 1;
- PositionRelative(this, fx, 0, 0xFFE80000);
+ PositionRelative(this, fx, 0, Q_16_16(-24.0));
}
}
diff --git a/src/npc/goron.c b/src/npc/goron.c
index 22a217ca..baada241 100644
--- a/src/npc/goron.c
+++ b/src/npc/goron.c
@@ -70,11 +70,11 @@ void sub_080693D0(Entity* this) {
if (this->frame == 1) {
this->frame = 0;
- sub_08069428(this, 0xFFF80000, createFx65);
+ sub_08069428(this, Q_16_16(-8.0), createFx65);
}
if (this->frame == 2) {
this->frame = 0;
- sub_08069428(this, 0x80 << 12, createFx65);
+ sub_08069428(this, Q_16_16(8.0), createFx65);
}
}
}
@@ -82,14 +82,14 @@ void sub_080693D0(Entity* this) {
void sub_08069428(Entity* this, s32 offsetX, bool32 createFx65) {
Entity* fx = CreateFx(this, FX_ROCK, 0);
if (fx) {
- PositionRelative(this, fx, offsetX, 0xFFF00000);
- ResolveEntityOnTop(this, fx);
+ PositionRelative(this, fx, offsetX, Q_16_16(-16.0));
+ SortEntityAbove(this, fx);
}
if (createFx65 != 0) {
fx = CreateFx(this, FX_REFLECT4, 0);
if (fx) {
- PositionRelative(this, fx, offsetX, 0xFFF00000);
- ResolveEntityOnTop(this, fx);
+ PositionRelative(this, fx, offsetX, Q_16_16(-16.0));
+ SortEntityAbove(this, fx);
}
}
}
diff --git a/src/npc/gregal.c b/src/npc/gregal.c
index f7038e95..5769c8ac 100644
--- a/src/npc/gregal.c
+++ b/src/npc/gregal.c
@@ -22,13 +22,13 @@ void sub_0806CAF4(Entity* this) {
if (npc != NULL) {
npc->parent = this;
CopyPosition(this, npc);
- ResolveEntityBelow(this, npc);
+ SortEntityBelow(this, npc);
}
npc = CreateNPC(0x4a, 2, 0);
if (npc != NULL) {
npc->parent = this;
CopyPosition(this, npc);
- ResolveEntityOnTop(this, npc);
+ SortEntityAbove(this, npc);
}
sub_0807DD64(this);
sub_08078778(this);
diff --git a/src/npc/kid.c b/src/npc/kid.c
index 7e08592c..02910850 100644
--- a/src/npc/kid.c
+++ b/src/npc/kid.c
@@ -243,7 +243,7 @@ void sub_080626E0(Entity* this, ScriptExecutionContext* context) {
uVar4 = Random();
this->direction = (this->direction + uVar4 % 0xb) - 5;
}
- sub_0806F62C(this, (s32)this->speed, (u32)this->direction);
+ LinearMoveAngle(this, (s32)this->speed, (u32)this->direction);
if ((u32)((this->x.HALF.HI - context->x.HALF.HI) * 0x100 + ((s32)((u32)(u16)this->speed << 0x10) >> 0x11)) <=
(u32)(s32)this->speed) {
this->x.HALF.HI = context->x.HALF.HI;
diff --git a/src/npc/malon.c b/src/npc/malon.c
index deb17fe7..cff3828f 100644
--- a/src/npc/malon.c
+++ b/src/npc/malon.c
@@ -58,12 +58,12 @@ void sub_08065914(Entity* this) {
target = FindEntityByID(7, 0x1F, 7);
if (target != NULL) {
- PositionRelative(this, target, 0x180000, -0x10000);
+ PositionRelative(this, target, Q_16_16(24.0), Q_16_16(-1.0));
target->parent = this;
}
target = FindEntityByID(7, 0x20, 7);
if (target != NULL) {
- PositionRelative(this, target, 0x280000, 0);
+ PositionRelative(this, target, Q_16_16(40.0), 0);
target->parent = this;
}
}
diff --git a/src/npc/melari.c b/src/npc/melari.c
index f2d408b2..7b28d0e2 100644
--- a/src/npc/melari.c
+++ b/src/npc/melari.c
@@ -86,7 +86,7 @@ void sub_08068780(Entity* this) {
}
ent = CreateFx(this, FX_STARS2, 0x20);
if (ent != NULL) {
- PositionRelative(this, ent, 0x180000, -0xa0000);
+ PositionRelative(this, ent, Q_16_16(24.0), Q_16_16(-10.0));
}
}
}
diff --git a/src/npc/npc4E.c b/src/npc/npc4E.c
index 2d59b83e..b842076f 100644
--- a/src/npc/npc4E.c
+++ b/src/npc/npc4E.c
@@ -140,12 +140,12 @@ void sub_0806DB84(Entity* this, ScriptExecutionContext* context) {
this->hitbox = (Hitbox*)&gUnk_08114154;
ent = CreateObject(OBJECT_3E, 4, 0);
if (ent != NULL) {
- PositionRelative(this, ent, -0x80000, 0);
+ PositionRelative(this, ent, Q_16_16(-8.0), 0);
*(ScriptExecutionContext**)&ent->cutsceneBeh = StartCutscene(ent, &script_Object3ELeftStoneOpening);
}
ent = CreateObject(OBJECT_3E, 5, 0);
if (ent != NULL) {
- PositionRelative(this, ent, 0x80000, 0);
+ PositionRelative(this, ent, Q_16_16(8.0), 0);
*(ScriptExecutionContext**)&ent->cutsceneBeh = StartCutscene(ent, &script_Object3ERightStoneOpening);
}
}
diff --git a/src/npc/pita.c b/src/npc/pita.c
index b5a2e065..1f1f2308 100644
--- a/src/npc/pita.c
+++ b/src/npc/pita.c
@@ -12,7 +12,7 @@ void Pita(Entity* this) {
if (this->action == 0) {
this->action += 1;
SetDefaultPriority(this, PRIO_MESSAGE);
- ResolveEntityOnTop(this, this);
+ SortEntityAbove(this, this);
this->hitbox = &gUnk_0810C428;
sub_0807DD64(this);
}
diff --git a/src/npc/postman.c b/src/npc/postman.c
index 48e7aa9e..3629950c 100644
--- a/src/npc/postman.c
+++ b/src/npc/postman.c
@@ -143,7 +143,7 @@ void sub_08060528(Entity* this) {
if (0 < (s16)this->field_0x6a.HWORD) {
if ((s16)this->field_0x6a.HWORD > 0x12b) {
this->field_0x6a.HWORD = 0;
- this->zVelocity = 0x20000;
+ this->zVelocity = Q_16_16(2.0);
this->field_0x6c.HALF.HI = 1;
sub_080788E0(this);
EnqueueSFX(0x7c);
diff --git a/src/npc/rem.c b/src/npc/rem.c
index b846ab31..84fca459 100644
--- a/src/npc/rem.c
+++ b/src/npc/rem.c
@@ -235,7 +235,7 @@ void sub_0806A914(Entity* this) {
Entity* npc = CreateNPC(0x37, 1, 0);
if (npc != NULL) {
CopyPosition(this, npc);
- ResolveEntityOnTop(this, npc);
+ SortEntityAbove(this, npc);
}
}
@@ -279,7 +279,7 @@ void sub_0806A9E8(Entity* this) {
Entity* npc = CreateNPC(0x37, 4, 0);
if (npc != NULL) {
CopyPosition(this, npc);
- ResolveEntityBelow(this, npc);
+ SortEntityBelow(this, npc);
}
}
diff --git a/src/npc/townMinish.c b/src/npc/townMinish.c
index 50045270..04638c22 100644
--- a/src/npc/townMinish.c
+++ b/src/npc/townMinish.c
@@ -216,7 +216,7 @@ void sub_0806AF60(Entity* this, ScriptExecutionContext* context) {
}
void sub_0806AF70(Entity* this, ScriptExecutionContext* context) {
- this->zVelocity = 0x24000;
+ this->zVelocity = Q_16_16(2.25);
}
void sub_0806AF78(Entity* this, ScriptExecutionContext* context) {
@@ -229,7 +229,7 @@ void sub_0806AF78(Entity* this, ScriptExecutionContext* context) {
void sub_0806AFA0(Entity* this) {
if (sub_0806ED78(this)) {
- sub_0806F62C(this, -this->speed, this->direction);
+ LinearMoveAngle(this, -this->speed, this->direction);
}
}
diff --git a/src/npc/townsperson.c b/src/npc/townsperson.c
index 17cd48e5..edb1b694 100644
--- a/src/npc/townsperson.c
+++ b/src/npc/townsperson.c
@@ -220,7 +220,7 @@ void sub_08061F94(Entity* this) {
ent = CreateFx(this, FX_BIG_EXPLOSION, 0);
if (ent != NULL) {
- ResolveEntityOnTop(this, ent);
+ SortEntityAbove(this, ent);
}
}
diff --git a/src/npc/vaatiReborn.c b/src/npc/vaatiReborn.c
index 3ed28ca8..fb59284e 100644
--- a/src/npc/vaatiReborn.c
+++ b/src/npc/vaatiReborn.c
@@ -44,7 +44,7 @@ void VaatiRebornAction0(Entity* this) {
entity = CreateNPC(VAATI_REBORN, 1, 0);
entity->parent = this;
entity->spriteOffsetY = -1;
- PositionRelative(this, entity, 0, 0x10000);
+ PositionRelative(this, entity, 0, Q_16_16(1.0));
InitAnimationForceUpdate(this, 0);
break;
case 1:
@@ -115,7 +115,7 @@ void VaatiRebornAction1(Entity* this) {
if (entity == NULL) {
DeleteThisEntity();
}
- PositionRelative(entity, this, 0, 0x210000);
+ PositionRelative(entity, this, 0, Q_16_16(33.0));
UpdateAnimationSingleFrame(this);
break;
case 2:
@@ -194,7 +194,7 @@ void sub_0806B96C(Entity* this) {
}
ptr = &gUnk_08112F80[this->type2];
this->spriteSettings.draw = entity->spriteSettings.draw;
- PositionRelative(entity, this, ptr->x << 0x10, (ptr->y + 0x21) << 0x10);
+ PositionRelative(entity, this, Q_16_16(ptr->x), Q_16_16(ptr->y + 0x21));
UpdateAnimationSingleFrame(this);
}
diff --git a/src/npc/wheaton.c b/src/npc/wheaton.c
index 3182eda3..e7c5e69b 100644
--- a/src/npc/wheaton.c
+++ b/src/npc/wheaton.c
@@ -7,7 +7,7 @@ void Wheaton(Entity* this) {
this->action++;
SetDefaultPriority(this, PRIO_MESSAGE);
- ResolveEntityOnTop(this, this);
+ SortEntityAbove(this, this);
this->hitbox = &gUnk_0810C3C0;
this->spriteOffsetY = 0xfe;
sub_0807DD64(this);
diff --git a/src/npc/zelda.c b/src/npc/zelda.c
index b0ac945f..f0bc5b77 100644
--- a/src/npc/zelda.c
+++ b/src/npc/zelda.c
@@ -127,13 +127,13 @@ void sub_08066E80(Entity* this, ScriptExecutionContext* context) {
UpdateAnimationSingleFrame(this);
if (this->frame & 1) {
context->unk_18++;
- this->zVelocity = 0x20000;
+ this->zVelocity = Q_16_16(2.0);
this->frame &= 0xFE;
SoundReq(SFX_PLY_JUMP);
}
break;
case 2:
- sub_0806F62C(this, 0x100, 0x80);
+ LinearMoveAngle(this, 0x100, 0x80);
GravityUpdate(this, 0x2000);
if (!(this->frame & 1)) {
UpdateAnimationSingleFrame(this);
@@ -143,7 +143,7 @@ void sub_08066E80(Entity* this, ScriptExecutionContext* context) {
}
break;
case 3:
- sub_0806F62C(this, 0x100, 0x80);
+ LinearMoveAngle(this, 0x100, 0x80);
UpdateAnimationSingleFrame(this);
if (GravityUpdate(this, 0x2000) == 0) {
context->unk_18++;
diff --git a/src/object/bakerOven.c b/src/object/bakerOven.c
index 51c50ca4..be636d81 100644
--- a/src/object/bakerOven.c
+++ b/src/object/bakerOven.c
@@ -24,7 +24,7 @@ void sub_0809CC74(Entity* this) {
ent = CreateObject(BAKER_OVEN, 1, i);
if (ent) {
ent->parent = this;
- PositionRelative(this, ent, (((i + 1) / 2) * 0x100000) - 0x80000, -0xe0000);
+ PositionRelative(this, ent, 16 * Q_16_16((i + 1) / 2) - Q_16_16(8.0), Q_16_16(-14.0));
}
}
sub_0809CDF0(this);
diff --git a/src/object/bigVortex.c b/src/object/bigVortex.c
index a26b7aae..1a3d8229 100644
--- a/src/object/bigVortex.c
+++ b/src/object/bigVortex.c
@@ -65,7 +65,7 @@ void sub_08098DC4(Entity* this) {
sub_08004542(this);
sub_08004542(&gPlayerEntity);
gPlayerEntity.collisionLayer = 1;
- ResolveEntityOnTop(this, &gPlayerEntity);
+ SortEntityAbove(this, &gPlayerEntity);
gPlayerState.queued_action = PLAYER_PARACHUTE;
gPlayerState.field_0x34[4] = 1;
gPlayerState.field_0x34[5] = this->type2;
@@ -101,12 +101,12 @@ void sub_08098E88(Entity* this) {
ent1 = CreateObject(BIG_VORTEX, 1, 0);
if (ent1 != NULL) {
- PositionRelative(this, ent1, 0, -0x10000);
+ PositionRelative(this, ent1, 0, Q_16_16(-1.0));
ent1->spriteOffsetY = 8;
}
ent2 = CreateObject(BIG_VORTEX, 2, 0);
if (ent2 != NULL) {
- PositionRelative(this, ent2, 0, -0x20000);
+ PositionRelative(this, ent2, 0, Q_16_16(-2.0));
ent2->spriteOffsetY = 0x10;
}
}
diff --git a/src/object/bird.c b/src/object/bird.c
index 24e2693b..cafe1262 100644
--- a/src/object/bird.c
+++ b/src/object/bird.c
@@ -24,9 +24,9 @@ void sub_0809CF54(Entity* this) {
this->spriteSettings.draw = TRUE;
this->actionDelay = 0x31;
this->field_0xf = 1;
- this->zVelocity = -0x18000;
- this->z.WORD = -0x38C000;
- this->field_0x68.HWORD = -0x800;
+ this->zVelocity = Q_16_16(-1.5);
+ this->z.WORD = Q_16_16(-56.75);
+ this->field_0x68.HWORD = Q_16_16(-0.03125);
this->speed = 0x280;
this->direction = 8;
this->collisionLayer = 2;
@@ -37,8 +37,8 @@ void sub_0809CF54(Entity* this) {
target = CreateObject(BIRD, 1, 0);
if (target != NULL) {
target->parent = this;
- PositionRelative(this, target, 0, 0x80000);
- ResolveEntityOnTop(this, target);
+ PositionRelative(this, target, 0, Q_16_16(8.0));
+ SortEntityAbove(this, target);
}
}
@@ -77,7 +77,7 @@ void sub_0809D084(Entity* this) {
if (this->parent != NULL) {
temp = this->parent->field_0xf;
if (temp != 0) {
- PositionRelative(this->parent, this, 0, 0x80000);
+ PositionRelative(this->parent, this, 0, Q_16_16(8.0));
} else {
this->subAction++;
this->zVelocity = temp;
@@ -97,7 +97,7 @@ void sub_0809D0AC(Entity* this) {
SoundReq(SFX_SECRET);
fx = CreateFx(this, FX_DASH, 0);
if (fx != NULL) {
- ResolveEntityBelow(this, fx);
+ SortEntityBelow(this, fx);
}
}
}
@@ -116,7 +116,7 @@ void sub_0809D10C(Entity* this) {
void sub_0809D130(Entity* this) {
if ((gPlayerState.flags & PL_MINISH) != 0) {
sub_0800445C(this);
- } else if (sub_08017850(this) != 0) {
+ } else if (IsCollidingPlayer(this) != 0) {
CreateItemEntity(0x17, 0, 0);
gSave.windcrests |= 0x10000000;
DeleteThisEntity();
diff --git a/src/object/book.c b/src/object/book.c
index 7c3bf57e..790c5839 100644
--- a/src/object/book.c
+++ b/src/object/book.c
@@ -134,14 +134,14 @@ void sub_0809B56C(Entity* this) {
fx = CreateFx(this, FX_DEATH, 0);
if (fx) {
- ResolveEntityOnTop(this, fx);
+ SortEntityAbove(this, fx);
}
}
void sub_0809B5B4(Entity* this) {
if (gPlayerState.flags & PL_MINISH) {
sub_0800445C(this);
- } else if (sub_08017850(this)) {
+ } else if (IsCollidingPlayer(this)) {
CreateItemEntity(this->type + 0x39, 0, 0);
DeleteThisEntity();
}
diff --git a/src/object/button.c b/src/object/button.c
index cb7a58c7..316f7608 100644
--- a/src/object/button.c
+++ b/src/object/button.c
@@ -90,7 +90,7 @@ void sub_08081C30(Entity* this) {
this->action = 2;
ClearFlag(this->field_0x86.HWORD);
SetTileType(0x77, this->field_0x74.HWORD, this->collisionLayer);
- SoundReq(SFX_10C);
+ SoundReq(SFX_BUTTON_PRESS);
}
}
@@ -251,7 +251,7 @@ u32 sub_08081F7C(Entity* this, u32 r7) {
SetFlag(this->field_0x86.HWORD);
SetTileType(r7, this->field_0x74.HWORD, this->collisionLayer);
sub_08081F24(this);
- SoundReq(SFX_10C);
+ SoundReq(SFX_BUTTON_PRESS);
if (this->field_0x70.HALF_U.LO != 0xFFFF)
SetTile(this->field_0x70.HALF_U.LO, this->field_0x74.HWORD, this->collisionLayer);
return 0;
diff --git a/src/object/fileScreenObjects.c b/src/object/fileScreenObjects.c
index 004f98d5..c3d217f6 100644
--- a/src/object/fileScreenObjects.c
+++ b/src/object/fileScreenObjects.c
@@ -256,7 +256,7 @@ void sub_0808EB74(Entity* this) {
this->x.WORD = entity->x.WORD;
this->y.WORD = entity->y.WORD;
this->spriteRendering.b3 = entity->spriteRendering.b3;
- ResolveEntityBelow(entity, this);
+ SortEntityBelow(entity, this);
} else {
this->x.HALF.HI = 0xF000;
this->y.HALF.HI = 0xF000;
@@ -306,7 +306,7 @@ void sub_0808EBB8(Entity* this) {
default:
entity = sub_0808EC80(var0);
if (entity) {
- ResolveEntityBelow(entity, this);
+ SortEntityBelow(entity, this);
this->spriteRendering.b3 = entity->spriteRendering.b3;
x = entity->x.HALF.HI;
y = entity->y.HALF.HI;
diff --git a/src/object/furniture.c b/src/object/furniture.c
index c625d1fb..05e7f7ca 100644
--- a/src/object/furniture.c
+++ b/src/object/furniture.c
@@ -220,7 +220,7 @@ static void FurnitureInit(FurnitureEntity* this) {
case SMITH_FORGE:
e = CreateObject(FURNITURE, FORGE_HELPER, 0);
if (e != NULL) {
- PositionRelative(super, e, 0x100000, 0x100000);
+ PositionRelative(super, e, Q_16_16(16.0), Q_16_16(16.0));
e->frameIndex = 1;
e->updatePriority = PRIO_MESSAGE;
}
@@ -451,7 +451,7 @@ static void sub_08090E4C(FurnitureEntity* this) {
void sub_08090E64(FurnitureEntity* this) {
Entity* e = CreateObject(OBJECT_2A, 0, 0);
if (e != NULL) {
- PositionRelative(super, e, (s16)((u16)-2 + super->type2) * 0x10000, 0);
+ PositionRelative(super, e, Q_16_16((s16)((u16)-2 + super->type2)), 0);
e->z.HALF.HI -= 16;
e->collisionLayer = 2;
UpdateSpriteForCollisionLayer(e);
diff --git a/src/object/greatFairy.c b/src/object/greatFairy.c
index 3a1f9a13..70210ffa 100644
--- a/src/object/greatFairy.c
+++ b/src/object/greatFairy.c
@@ -92,8 +92,8 @@ void GreatFairy_DormantUpdate(Entity* this) {
case 289:
ripple = GreatFairy_CreateForm(this, RIPPLE, 0);
if (ripple) {
- PositionRelative(this, ripple, (s32)GreatFairy_RippleOffsets[this->actionDelay] * 65536,
- (s32)GreatFairy_RippleOffsets[this->actionDelay + 1] * 65536);
+ PositionRelative(this, ripple, Q_16_16(GreatFairy_RippleOffsets[this->actionDelay]),
+ Q_16_16(GreatFairy_RippleOffsets[this->actionDelay + 1]));
this->actionDelay += 2;
break;
}
@@ -105,7 +105,7 @@ void GreatFairy_CreateBigRipple(Entity* this) {
ripple = GreatFairy_CreateForm(this, BIGRIPPLE, 0);
if (ripple != NULL) {
- PositionRelative(this, ripple, 0, 0x80000);
+ PositionRelative(this, ripple, 0, Q_16_16(8.0));
this->action = 3;
}
}
@@ -137,7 +137,7 @@ void GreatFairy_MiniUpdate(Entity* this) {
} else {
target = GreatFairy_CreateForm(this, WINGS, 0);
if (target != NULL) {
- PositionRelative(this, target, 0, -0x140000);
+ PositionRelative(this, target, 0, Q_16_16(-20.0));
this->action = 5;
this->actionDelay = 120;
this->field_0xf = 0;
@@ -153,7 +153,7 @@ void GreatFairy_FinalUpdate(Entity* this) {
--this->actionDelay;
} else {
if ((this->field_0xf == 0) && (target = GreatFairy_CreateForm(this, FORM9, 0), target != NULL)) {
- PositionRelative(this, target, 0, -0x4C0000);
+ PositionRelative(this, target, 0, Q_16_16(-76.0));
target->parent = this;
this->field_0xf = 1;
}
@@ -236,7 +236,7 @@ void GreatFairy_MiniRisingUpdate(Entity* this) {
} else {
if (((this->z.HALF.HI == -10) && (this->field_0xf == 0)) &&
(target = GreatFairy_CreateForm(this, DROPLET, 0), target != NULL)) {
- PositionRelative(this, target, 0, 0x40000);
+ PositionRelative(this, target, 0, Q_16_16(4.0));
this->field_0xf = 1;
}
}
@@ -350,7 +350,7 @@ void GreatFairy_BigRippleUpdate(Entity* this) {
} else {
target = GreatFairy_CreateForm(this, MINI, 0);
if (target != NULL) {
- PositionRelative(this, target, 0, -0x80000);
+ PositionRelative(this, target, 0, Q_16_16(-8.0));
gRoomVars.animFlags |= 2;
DeleteEntity(this);
}
diff --git a/src/object/heartContainer.c b/src/object/heartContainer.c
index 9e8346b3..a81709c4 100644
--- a/src/object/heartContainer.c
+++ b/src/object/heartContainer.c
@@ -59,7 +59,7 @@ static void sub_0808E714(Entity* this) {
static void sub_0808E764(Entity* this) {
sub_08080CB4(this);
- if (!(gPlayerState.flags & PL_MINISH) && sub_08017850(this)) {
+ if (!(gPlayerState.flags & PL_MINISH) && IsCollidingPlayer(this)) {
SetFlag(this->cutsceneBeh.HWORD);
CreateItemEntity(0x62, 0, 0);
DeleteThisEntity();
diff --git a/src/object/itemOnGround.c b/src/object/itemOnGround.c
index 35cb741b..ec9b2bef 100644
--- a/src/object/itemOnGround.c
+++ b/src/object/itemOnGround.c
@@ -18,7 +18,7 @@ void sub_080813BC(Entity*);
void sub_080810FC(Entity*);
bool32 CheckShouldPlayItemGetCutscene(Entity*);
-extern u32 sub_080177A0(Entity*, Entity*);
+extern u32 IsColliding(Entity*, Entity*);
extern void GiveItem(u32, u32);
extern void (*const gUnk_0811E7D4[])(Entity*);
@@ -149,7 +149,7 @@ void sub_080810A8(Entity* this) {
}
if (this->zVelocity == 0) {
- this->zVelocity = 0x1E000;
+ this->zVelocity = Q_16_16(1.875);
}
if (this->collisionLayer == 2) {
@@ -269,10 +269,10 @@ void sub_080812A8(Entity* this) {
void sub_080812E8(Entity* this) {
PlayerState* playerState = &gPlayerState;
#ifdef EU
- if ((playerState->swim_state & 0x80) && sub_080177A0(this, &gPlayerEntity)) {
+ if ((playerState->swim_state & 0x80) && IsColliding(this, &gPlayerEntity)) {
#else
if ((playerState->swim_state & 0x80) && (playerState->flags & PL_MINISH) == 0 &&
- sub_080177A0(this, &gPlayerEntity)) {
+ IsColliding(this, &gPlayerEntity)) {
#endif
sub_080810FC(this);
}
@@ -289,7 +289,7 @@ void sub_08081328(Entity* this) {
CopyPosition(other, this);
this->z.HALF.HI--;
other = &gPlayerEntity;
- if (sub_080177A0(this, other)) {
+ if (IsColliding(this, other)) {
sub_080810FC(this);
}
}
@@ -412,7 +412,7 @@ void sub_0808153C(Entity* this) {
if (this->field_0x68.HALF.LO == 0) {
if (!GravityUpdate(this, 0x1000) && !sub_0800442E(this)) {
this->field_0x68.HALF.LO = 1;
- this->zVelocity = 0x1E000;
+ this->zVelocity = Q_16_16(1.875);
sub_0808148C(this->type);
UpdateSpriteForCollisionLayer(this);
}
@@ -432,7 +432,7 @@ void sub_08081598(Entity* this) {
COLLISION_OFF(this);
this->action = 4;
this->actionDelay = 14;
- this->zVelocity = 0x20000;
+ this->zVelocity = Q_16_16(2.0);
this->spriteSettings.draw = 1;
this->spritePriority.b1 = 2;
this->spritePriority.b0 = 3;
diff --git a/src/object/jarPortal.c b/src/object/jarPortal.c
index 61ebb19a..a482621d 100644
--- a/src/object/jarPortal.c
+++ b/src/object/jarPortal.c
@@ -60,7 +60,7 @@ void sub_0808BF58(Entity* this) {
GravityUpdate(this, 0x2000);
switch (this->subAction) {
case 0:
- if (this->zVelocity <= 98303) {
+ if (this->zVelocity < Q_16_16(1.5)) {
++this->subAction;
InitAnimationForceUpdate(this, 2);
}
@@ -69,7 +69,7 @@ void sub_0808BF58(Entity* this) {
UpdateAnimationSingleFrame(this);
if (!this->z.HALF.HI) {
++this->subAction;
- this->zVelocity = 0x8000;
+ this->zVelocity = Q_16_16(0.5);
}
break;
case 2:
@@ -128,7 +128,7 @@ void sub_0808C0AC(Entity* this) {
GravityUpdate(this, 0x2000);
switch (this->subAction) {
case 0:
- if (this->zVelocity <= 98303) {
+ if (this->zVelocity < Q_16_16(1.5)) {
this->subAction = 1;
InitAnimationForceUpdate(this, 3);
}
@@ -137,7 +137,7 @@ void sub_0808C0AC(Entity* this) {
UpdateAnimationSingleFrame(this);
if (!this->z.HALF.HI) {
++this->subAction;
- this->zVelocity = 0x8000;
+ this->zVelocity = Q_16_16(0.5);
}
break;
case 2:
@@ -157,7 +157,7 @@ u32 sub_0808C128(Entity* this) {
void sub_0808C13C(Entity* this) {
this->subAction = 0;
- this->zVelocity = 163840;
+ this->zVelocity = Q_16_16(2.5);
}
void sub_0808C148(Entity* this, u32 a2) {
diff --git a/src/object/lilypadLarge.c b/src/object/lilypadLarge.c
index 91f13635..96b4dff9 100644
--- a/src/object/lilypadLarge.c
+++ b/src/object/lilypadLarge.c
@@ -163,7 +163,7 @@ void sub_08085B40(LilypadLargeEntity* this) {
ResetCollisionLayer(&gPlayerEntity);
sub_08085CDC(this);
super->direction = GetFacingDirection(&gPlayerEntity, super);
- sub_0806F5BC(&gPlayerEntity, 0x100, super->direction);
+ LinearMoveDirection(&gPlayerEntity, 0x100, super->direction);
}
}
diff --git a/src/object/mask.c b/src/object/mask.c
index 73b42095..384c59f4 100644
--- a/src/object/mask.c
+++ b/src/object/mask.c
@@ -39,7 +39,7 @@ void sub_080929A4(Entity* this) {
}
this->action = 1;
- this->zVelocity = 0x18000;
+ this->zVelocity = Q_16_16(1.5);
this->field_0x78.HWORD = ((Random() & 7) << 10) | 0x2000;
diff --git a/src/object/minecart.c b/src/object/minecart.c
index c39a4931..0de7e4c3 100644
--- a/src/object/minecart.c
+++ b/src/object/minecart.c
@@ -45,7 +45,7 @@ void sub_080916EC(Entity* this) {
void sub_080917DC(Entity* this) {
if ((this->bitfield & 0x7f) == 0x1d) {
- this->zVelocity = 0x2a000;
+ this->zVelocity = Q_16_16(2.625);
this->action = 7;
InitAnimationForceUpdate(this, this->type2 + 4 + this->animationState);
SoundReq(SFX_13B);
@@ -65,7 +65,7 @@ void sub_080917DC(Entity* this) {
this->action++;
gPlayerState.jump_status = 0x81;
gPlayerState.flags |= PL_ENTER_MINECART;
- gPlayerEntity.zVelocity = 0x20000;
+ gPlayerEntity.zVelocity = Q_16_16(2.0);
gPlayerEntity.speed = 0x100;
gPlayerEntity.flags &= ~PL_MINISH;
ResetPlayer();
@@ -160,7 +160,7 @@ void sub_080919AC(Entity* this) {
sub_08017744(this);
gPlayerState.jump_status = 0x41;
gPlayerState.flags = (gPlayerState.flags ^ PL_IN_MINECART) | PL_ENTER_MINECART;
- gPlayerEntity.zVelocity = 0x20000;
+ gPlayerEntity.zVelocity = Q_16_16(2.0);
gPlayerEntity.speed = 0x200;
gPlayerEntity.animationState = this->animationState << 1;
gPlayerEntity.direction = this->direction;
diff --git a/src/object/object49.c b/src/object/object49.c
index f1873fc2..c65b41bf 100644
--- a/src/object/object49.c
+++ b/src/object/object49.c
@@ -178,14 +178,14 @@ void sub_0808F3DC(Entity* this) {
// TODO: This block of code might supposed to be a switch statement.
if (this->type != 8) {
if (this->type == 7) {
- ResolveEntityBelow(this->child, this);
+ SortEntityBelow(this->child, this);
return;
}
} else {
this->hitType = this->child->hitType;
this->child->hitType = 0x7E;
}
- ResolveEntityOnTop(this->child, this);
+ SortEntityAbove(this->child, this);
} else {
if (*(u32*)&this->parent->field_0x74 == 0) {
if (this->type == 8) {
diff --git a/src/object/object6A.c b/src/object/object6A.c
index 6813f69c..29dcb2ef 100644
--- a/src/object/object6A.c
+++ b/src/object/object6A.c
@@ -237,7 +237,7 @@ void sub_08094C88(Object6AEntity* this) {
case 0x41:
case 0x42:
case 0x43:
- ResolveEntityBelow(super, super);
+ SortEntityBelow(super, super);
}
}
@@ -250,8 +250,8 @@ void sub_08094C88(Object6AEntity* this) {
void sub_08094CDC(Object6AEntity* this) {
Entity* e = CreateObject(0x6a, 3, 0x62);
if (e != NULL) {
- e->x.HALF.HI = gRoomControls.origin_x + 224;
- e->y.HALF.HI = gRoomControls.origin_y + 600;
+ e->x.HALF.HI = gRoomControls.origin_x + Q_8_8(7.0 / 8.0);
+ e->y.HALF.HI = gRoomControls.origin_y + Q_8_8(2.345);
SoundReq(324);
}
}
@@ -266,8 +266,8 @@ void sub_08094D10(Object6AEntity* this) {
void sub_08094D34(Object6AEntity* this) {
Entity* e = CreateObject(0x6a, 0x15, 0xd);
if (e != NULL) {
- e->x.HALF.HI = gRoomControls.origin_x + 256;
- e->y.HALF.HI = gRoomControls.origin_y + 600;
+ e->x.HALF.HI = gRoomControls.origin_x + Q_8_8(1.0);
+ e->y.HALF.HI = gRoomControls.origin_y + Q_8_8(2.345);
SoundReq(324);
}
}
@@ -299,8 +299,8 @@ void sub_08094D94(Object6AEntity* this) {
void sub_08094DD8(Object6AEntity* this) {
Entity* e = CreateObject(0x6a, 0x4, 0);
if (e != NULL) {
- e->x.HALF.HI = gRoomControls.origin_x + 240;
- e->y.HALF.HI = gRoomControls.origin_y + 600;
+ e->x.HALF.HI = gRoomControls.origin_x + Q_8_8(15.0 / 16.0);
+ e->y.HALF.HI = gRoomControls.origin_y + Q_8_8(2.345);
SoundReq(324);
}
}
@@ -338,7 +338,7 @@ void sub_08094E30(Object6AEntity* this) {
break;
case 1:
super->z.WORD -= super->zVelocity;
- super->zVelocity -= 0x2000;
+ super->zVelocity -= Q_8_8(32.0);
if (super->z.WORD > 0) {
super->action++;
super->z.WORD = 0;
@@ -355,7 +355,7 @@ void sub_08094E30(Object6AEntity* this) {
break;
case 3:
super->z.WORD -= super->zVelocity;
- super->zVelocity -= 0x2000;
+ super->zVelocity -= Q_8_8(32.0);
if (!CheckOnScreen(super)) {
DeleteThisEntity();
}
@@ -473,7 +473,7 @@ void sub_08095120(Object6AEntity* this) {
if (super->action == 0) {
super->action = 1;
SetDefaultPriority(super, 3);
- ResolveEntityBelow(super, super);
+ SortEntityBelow(super, super);
sub_0807DD64(super);
InitAnimationForceUpdate(super, 2);
}
@@ -493,7 +493,7 @@ void sub_08095188(Object6AEntity* this) {
if (super->action == 0) {
super->action = 1;
SetDefaultPriority(super, 3);
- ResolveEntityBelow(super, super);
+ SortEntityBelow(super, super);
sub_0807DD64(super);
InitAnimationForceUpdate(super, 0);
}
@@ -535,7 +535,7 @@ void sub_08095244(Object6AEntity* this) {
Entity* e = CreateObject(OBJECT_6A, 0xA, 0);
if (e != NULL) {
e->parent = super;
- PositionRelative(super, e, 0x100000, -0x100000);
+ PositionRelative(super, e, Q_16_16(16.0), -Q_16_16(16.0));
((Object6AEntity*)e)->ctx = StartCutscene(e, &script_Object6ASwordInChest);
}
}
@@ -583,7 +583,7 @@ void sub_08095330(Object6AEntity* this) {
e->parent = super;
CopyPosition(super, e);
e->z.HALF.HI = -16;
- ResolveEntityOnTop(e, e);
+ SortEntityAbove(e, e);
}
}
@@ -597,7 +597,7 @@ void sub_08095364(Object6AEntity* this) {
e->subAction = 1;
e->z.HALF.HI = -16;
e->direction = 7;
- e->zVelocity = 0x30000;
+ e->zVelocity = Q_16_16(3.0);
e->speed = 128;
InitAnimationForceUpdate(e, 1);
}
@@ -609,7 +609,7 @@ void sub_080953A4(Object6AEntity* this) {
super->z.HALF.HI = -16;
SetDefaultPriority(super, 2);
super->spriteRendering.b3 = gUnk_08114F30[super->spriteRendering.b3];
- ResolveEntityOnTop(super, super);
+ SortEntityAbove(super, super);
sub_0807DD64(super);
}
ExecuteScriptForEntity(super, 0);
@@ -625,7 +625,7 @@ void sub_080953A4(Object6AEntity* this) {
void sub_08095420(Object6AEntity* this, ScriptExecutionContext* ctx) {
Entity* e = CreateObject(OBJECT_6A, 0xC, 0);
if (e != NULL) {
- PositionRelative(super, e, 0, -0x100000);
+ PositionRelative(super, e, 0, Q_16_16(-16));
((Object6AEntity*)e)->ctx = StartCutscene(e, (u16*)ctx->intVariable);
}
}
@@ -637,7 +637,7 @@ void sub_0809545C(Object6AEntity* this, ScriptExecutionContext* ctx) {
Entity* p = CreateObject(OBJECT_6A, 0xD, 0);
Entity* e;
if (p != NULL) {
- PositionRelative(super, p, 0, -0x100000);
+ PositionRelative(super, p, 0, Q_16_16(-16));
((Object6AEntity*)p)->ctx = StartCutscene(p, (u16*)ctx->intVariable);
e = CreateObject(OBJECT_6A, 2, 0);
if (e != NULL) {
@@ -692,7 +692,7 @@ void sub_080954DC(Object6AEntity* this) {
super->y.HALF.HI += this->py;
break;
case 3:
- sub_0806F62C(super, super->speed, super->direction);
+ LinearMoveAngle(super, super->speed, super->direction);
break;
}
this->off += 4;
@@ -764,7 +764,7 @@ void sub_08095754(Object6AEntity* this) {
if (e != NULL) {
e->parent = super;
CopyPosition(super, e);
- ResolveEntityBelow(super, e);
+ SortEntityBelow(super, e);
}
}
@@ -784,7 +784,7 @@ void sub_080957B4(Object6AEntity* this) {
if (e != NULL) {
e->parent = super;
CopyPosition(super, e);
- ResolveEntityBelow(super, e);
+ SortEntityBelow(super, e);
}
}
@@ -804,7 +804,7 @@ void sub_08095810(Object6AEntity* this) {
if (e != NULL) {
e->parent = super;
CopyPosition(super, e);
- ResolveEntityOnTop(super, e);
+ SortEntityAbove(super, e);
((Object6AEntity*)e)->ctx = StartCutscene(e, &script_ZeldaMagic);
}
}
@@ -1084,12 +1084,12 @@ void sub_08095DBC(Object6AEntity* this) {
super->spriteSettings.draw = 1;
InitializeAnimation(super, 75);
super->spriteRendering.b3 = gUnk_08114F30[super->spriteRendering.b3];
- ResolveEntityOnTop(super, super);
+ SortEntityAbove(super, super);
}
if ((super->type2 & 0x80) == 0 && gActiveScriptInfo.syncFlags & 0x20000) {
super->type2 = -1;
- super->zVelocity = 0x40000;
- super->speed = 0xC000;
+ super->zVelocity = Q_16_16(4.0);
+ super->speed = Q_8_8(192);
}
GravityUpdate(super, super->speed);
GetNextFrame(super);
@@ -1128,7 +1128,7 @@ NONMATCH("asm/non_matching/object6A/sub_08095EAC.inc",
x = a - (Random() & b);
y = a - (Random() & b);
- PositionRelative(super, e, x << 16, y << 16);
+ PositionRelative(super, e, Q_16_16(x), Q_16_16(y));
super->zVelocity = vel;
super->speed = speed;
}
@@ -1220,7 +1220,7 @@ void sub_080960C4(Object6AEntity* this, ScriptExecutionContext* ctx) {
e->parent = super;
CopyPosition(super, e);
e->spriteRendering.b3 = gUnk_08114F34[super->spriteRendering.b3];
- ResolveEntityBelow(super, e);
+ SortEntityBelow(super, e);
((Object6AEntity*)e)->ctx = StartCutscene(e, (u16*)ctx->intVariable);
}
e = CreateObject(OBJECT_6A, 0x24, 0x4A);
@@ -1228,7 +1228,7 @@ void sub_080960C4(Object6AEntity* this, ScriptExecutionContext* ctx) {
e->parent = super;
CopyPosition(super, e);
e->spriteRendering.b3 = gUnk_08114F30[super->spriteRendering.b3];
- ResolveEntityOnTop(super, e);
+ SortEntityAbove(super, e);
e->collisionLayer = 2;
((Object6AEntity*)e)->ctx = StartCutscene(e, (u16*)ctx->intVariable);
}
@@ -1241,7 +1241,7 @@ void sub_08096168(Object6AEntity* this) {
InitializeAnimation(super, 75);
}
GetNextFrame(super);
- sub_0806F62C(super, super->speed, super->direction);
+ LinearMoveAngle(super, super->speed, super->direction);
if (!CheckOnScreen(super))
DeleteThisEntity();
}
@@ -1267,21 +1267,21 @@ void sub_08096208(Object6AEntity* this, u32 x) {
s8* p = &gUnk_08122B2E[x * 2];
Entity* e = CreateObject(OBJECT_6A, 0x26, 0);
if (e != NULL) {
- PositionRelative(super, e, p[0] << 16, p[1] << 16);
+ PositionRelative(super, e, Q_16_16(p[0]), Q_16_16(p[1]));
}
}
void sub_0809623C(Object6AEntity* this) {
Entity* e = CreateObject(OBJECT_6A, 0x27, 0);
if (e != NULL) {
- PositionRelative(super, e, 0, -0x100000);
+ PositionRelative(super, e, 0, Q_16_16(-16.0));
}
}
void sub_08096260(Object6AEntity* this) {
Entity* e = CreateObject(OBJECT_6A, 0x28, 0);
if (e != NULL) {
- PositionRelative(super, e, 0, -0x100000);
+ PositionRelative(super, e, 0, Q_16_16(-16.0));
}
}
diff --git a/src/object/object7E.c b/src/object/object7E.c
index 15785d8f..a23b0e5c 100644
--- a/src/object/object7E.c
+++ b/src/object/object7E.c
@@ -17,7 +17,7 @@ void Object7E(Entity* this) {
this->spriteSettings.flipX = TRUE;
}
}
- PositionRelative(this->parent, this, 0, 0x80000);
+ PositionRelative(this->parent, this, 0, Q_16_16(8.0));
this->z.HALF.HI = 0;
if (this->type != 0) {
this->spriteSettings.draw = this->child->spriteSettings.draw;
diff --git a/src/object/objectA2.c b/src/object/objectA2.c
index cc0e350a..e529794c 100644
--- a/src/object/objectA2.c
+++ b/src/object/objectA2.c
@@ -25,14 +25,16 @@ void ObjectA2(Entity* this) {
GetNextFrame(this);
}
+#define fp(n) ((n) << 8)
+
void sub_0809F318(Entity* this) {
InitializeAnimation(this, 0);
if (Random() & 0x10) {
this->spriteSettings.flipX = 1;
}
- this->x.HALF.HI = 0x28;
- this->y.HALF.HI = 0x48;
- this->z.HALF.HI = 0xFFB0;
+ this->x.HALF.HI = Q_8_8(0.16);
+ this->y.HALF.HI = Q_8_8(0.285);
+ this->z.HALF.HI = Q_8_8(-0.315);
this->spriteOrientation.flipY = 2;
this->action = 1;
ChangeObjPalette(this, gUnk_08124704[this->type]);
diff --git a/src/object/objectAF.c b/src/object/objectAF.c
index f34ff4f2..8aa2c9ed 100644
--- a/src/object/objectAF.c
+++ b/src/object/objectAF.c
@@ -47,7 +47,7 @@ void sub_080A0624(Entity* this) {
void sub_080A0640(Entity* this) {
if (this->type == 0) {
- PositionRelative(*(((Entity**)this->parent->myHeap) + 4), this, 0, 0x80000);
+ PositionRelative(*(((Entity**)this->parent->myHeap) + 4), this, 0, Q_16_16(8.0));
} else {
CopyPosition(this->parent, this);
}
diff --git a/src/object/objectB5.c b/src/object/objectB5.c
index a93011ed..e23779b2 100644
--- a/src/object/objectB5.c
+++ b/src/object/objectB5.c
@@ -10,5 +10,5 @@ void ObjectB5(Entity* this) {
#ifndef EU
gRoomControls.camera_target = this;
#endif
- PositionRelative(&gPlayerEntity, this, 0, -0x280000);
+ PositionRelative(&gPlayerEntity, this, 0, Q_16_16(-40.0));
}
diff --git a/src/object/octorokBossObject.c b/src/object/octorokBossObject.c
index 7eac6c78..cd527a72 100644
--- a/src/object/octorokBossObject.c
+++ b/src/object/octorokBossObject.c
@@ -76,14 +76,14 @@ void OctorokBossObject_Init(Entity* this) {
}
this->speed = 0xf0 - (Random() & 0x3f);
- sub_0806F62C(this, ((s16)this->speed >> 1) << 8, (u32)this->direction);
- sub_0806F62C(this, ((s16)this->speed >> 1) << 8, (u32)this->direction);
+ LinearMoveAngle(this, ((s16)this->speed >> 1) << 8, (u32)this->direction);
+ LinearMoveAngle(this, ((s16)this->speed >> 1) << 8, (u32)this->direction);
InitializeAnimation(this, 5);
SoundReq(SFX_14C);
break;
case 3:
this->direction = -(this->parent->field_0x7a.HALF.HI + -0x80);
- sub_0806F62C(this, 0x4800, (u32)this->direction);
+ LinearMoveAngle(this, 0x4800, (u32)this->direction);
if ((Random() & 1) != 0) {
this->direction = (Random() & 0x3f) + this->direction;
} else {
@@ -92,7 +92,7 @@ void OctorokBossObject_Init(Entity* this) {
InitializeAnimation(this, 6);
break;
case 6:
- sub_0806F62C(this, (0x30 - (Random() & 0x2f)) * 0x100, Random() & 0xff);
+ LinearMoveAngle(this, (0x30 - (Random() & 0x2f)) * 0x100, Random() & 0xff);
if ((Random() & 1) != 0) {
this->direction = (Random() & 0x3f) + this->direction;
} else {
@@ -109,10 +109,10 @@ void OctorokBossObject_Init(Entity* this) {
this->field_0x76.HWORD = 0x400;
this->field_0x74.HWORD = 0x400;
this->field_0x7a.HWORD = 0;
- sub_0806F62C(this,
- ((-(u32)this->parent->field_0x7a.HALF.HI << 0x18) >> 0x18) +
- (u32)gUnk_0812388C[(u32)this->type2 * 2 + 1],
- (u32)gUnk_0812388C[(u32)this->type2 * 2]);
+ LinearMoveAngle(this,
+ ((-(u32)this->parent->field_0x7a.HALF.HI << 0x18) >> 0x18) +
+ (u32)gUnk_0812388C[(u32)this->type2 * 2 + 1],
+ (u32)gUnk_0812388C[(u32)this->type2 * 2]);
sub_0805EC9C(this, this->field_0x76.HWORD, this->field_0x74.HWORD, this->field_0x7a.HWORD);
InitializeAnimation(this, 7);
break;
@@ -170,7 +170,7 @@ NONMATCH("asm/non_matching/octorokBossObject/OctorokBossObject_Action1.inc",
case 1:
this->direction = sub_080045DA(GET_HELPER(this)->tailObjects[this->actionDelay]->x.WORD - this->x.WORD,
GET_HELPER(this)->tailObjects[this->actionDelay]->y.WORD - this->y.WORD);
- sub_0806F62C(this, this->speed, this->direction);
+ LinearMoveAngle(this, this->speed, this->direction);
if (EntityInRectRadius(this, GET_HELPER(this)->tailObjects[this->actionDelay], 2, 2) == 0) {
return;
}
@@ -195,7 +195,7 @@ NONMATCH("asm/non_matching/octorokBossObject/OctorokBossObject_Action1.inc",
if (this->parent->type2 == 3) {
Entity* object = GET_HELPER(this->parent)->mouthObject;
this->direction = sub_080045DA(object->x.WORD - this->x.WORD, object->y.WORD - this->y.WORD);
- sub_0806F62C(this, 0x280, this->direction);
+ LinearMoveAngle(this, 0x280, this->direction);
if (sub_0806FC80(this, this->parent, 0x48) == 0) {
return;
}
@@ -204,7 +204,7 @@ NONMATCH("asm/non_matching/octorokBossObject/OctorokBossObject_Action1.inc",
break;
case 3:
case 6:
- sub_0806F62C(this, 0x80, this->direction);
+ LinearMoveAngle(this, 0x80, this->direction);
if (this->frame != 0) {
DeleteThisEntity();
}
@@ -247,8 +247,9 @@ NONMATCH("asm/non_matching/octorokBossObject/OctorokBossObject_Action1.inc",
*(int*)&this->field_0x78 -= 1;
}
CopyPosition(this->parent, this);
- sub_0806F62C(this, (u32)gUnk_0812388C[(u32)this->type2 * 2 + 1],
- ((u8) - this->parent->field_0x7a.HALF.HI & 0xff) + (u32)gUnk_0812388C[(u32)this->type2 * 2]);
+ LinearMoveAngle(this, (u32)gUnk_0812388C[(u32)this->type2 * 2 + 1],
+ ((u8) - this->parent->field_0x7a.HALF.HI & 0xff) +
+ (u32)gUnk_0812388C[(u32)this->type2 * 2]);
return;
case 7:
if (this->actionDelay == 0) {
diff --git a/src/object/pot.c b/src/object/pot.c
index bf94a8be..cde45bc6 100644
--- a/src/object/pot.c
+++ b/src/object/pot.c
@@ -67,7 +67,7 @@ void sub_08082310(Entity* this) {
case 0x1D:
SetTile((u16)this->field_0x70.HALF.LO, COORD_TO_TILE(this), this->collisionLayer);
this->action = 5;
- this->zVelocity = 0x2A000;
+ this->zVelocity = Q_16_16(2.625);
this->spriteOffsetY = 0;
this->spriteSettings.shadow = 1;
this->spritePriority.b1 = 3;
diff --git a/src/object/pressurePlate.c b/src/object/pressurePlate.c
new file mode 100644
index 00000000..891616ca
--- /dev/null
+++ b/src/object/pressurePlate.c
@@ -0,0 +1,185 @@
+#define NENT_DEPRECATED
+#include "object.h"
+#include "functions.h"
+
+u32 IsColliding(Entity*, Entity*);
+
+typedef struct {
+ Entity base;
+ /*0x68*/ union SplitHWord field_0x68;
+ /*0x6a*/ union SplitHWord field_0x6a;
+ /*0x6c*/ union SplitHWord field_0x6c;
+ /*0x6e*/ union SplitHWord field_0x6e;
+ /*0x70*/ u16 canToggle;
+ /*0x72*/ u8 dir;
+ /*0x73*/ u8 filler73[0x86 - 0x73];
+ /*0x86*/ u16 flag;
+} PressurePlateEntity;
+
+typedef void(PressurePlateAction)(PressurePlateEntity*);
+
+PressurePlateAction sub_08088840;
+PressurePlateAction sub_0808886C;
+PressurePlateAction sub_080888F4;
+
+extern Hitbox gUnk_080FD1D4;
+
+static u32 sub_08088938(PressurePlateEntity*);
+static u32 get_standing_count(PressurePlateEntity*);
+
+static const u8 sSpriteOffsets[];
+
+void PressurePlate(PressurePlateEntity* this) {
+ static PressurePlateAction* const sActions[] = {
+ sub_08088840,
+ sub_0808886C,
+ sub_080888F4,
+ };
+
+ if (super->field_0xf) {
+ if (--super->field_0xf == 0) {
+ this->dir = super->animationState;
+ InitializeAnimation(super, super->animationState);
+ }
+ }
+
+ sActions[super->action](this);
+}
+
+void sub_08088840(PressurePlateEntity* this) {
+ super->action = 1;
+ super->spriteSettings.draw = 1;
+ super->spritePriority.b0 = 7;
+ super->hitbox = &gUnk_080FD1D4;
+ this->dir = super->animationState;
+}
+
+void sub_0808886C(PressurePlateEntity* this) {
+ u8 weight;
+
+ weight = sub_08088938(this) + get_standing_count(this);
+ if (super->type + 2 <= weight) {
+ super->action = 2;
+ super->field_0xf = 0;
+ super->animationState = 4;
+ super->z.HALF.HI = 0;
+ InitializeAnimation(super, 4);
+ SetFlag(this->flag);
+ EnqueueSFX(SFX_PRESSURE_PLATE);
+ } else {
+ if (weight > super->animationState) {
+ if (super->type + 1 == weight) {
+ super->field_0xf = 4;
+ InitializeAnimation(super, weight + 1);
+ } else {
+ InitializeAnimation(super, weight);
+ }
+ EnqueueSFX(SFX_BUTTON_PRESS);
+ } else if (weight < super->animationState) {
+ InitializeAnimation(super, weight);
+ }
+ super->animationState = weight;
+ }
+}
+
+void sub_080888F4(PressurePlateEntity* this) {
+ u8 weight;
+
+ if (this->canToggle) {
+ weight = sub_08088938(this) + get_standing_count(this);
+ if (super->type + 2 > weight) {
+ super->action = 1;
+ super->animationState = weight;
+ ClearFlag(this->flag);
+ InitializeAnimation(super, weight);
+ }
+ }
+}
+
+static u32 NONMATCH("asm/non_matching/pressurePlate/sub_08088938.inc", sub_08088938(PressurePlateEntity* this)) {
+ u16 x, y;
+ s32 num;
+ u8* tmp;
+ u32 i;
+
+ num = 0;
+ x = super->x.HALF.HI - 8;
+ y = super->y.HALF.HI - 8;
+
+ tmp = &this->dir;
+ for (i = 0; i < 8; ++i) {
+ Entity* e = gRoomVars.field_0x8c[8 + i];
+ if (e != NULL) {
+ if ((u16)(e->x.HALF.HI - x) < 0x11 && ((u16)(e->y.HALF_U.HI - y) < 0x11)) {
+ e->spriteOffsetY = sSpriteOffsets[*tmp];
+ num++;
+ }
+ }
+ }
+ return num;
+}
+END_NONMATCH
+
+static u32 get_standing_count(PressurePlateEntity* this) {
+ u32 num;
+
+ num = 0;
+ if (IsCollidingPlayer(super) != 0) {
+ gPlayerEntity.spriteOffsetY = sSpriteOffsets[this->dir];
+ num = 1;
+ }
+ if ((gPlayerState.flags & PL_CLONING) != 0) {
+ if (IsColliding(super, gPlayerClones[0]) != 0) {
+ gPlayerClones[0]->spriteOffsetY = sSpriteOffsets[this->dir];
+ num++;
+ }
+ if (IsColliding(super, gPlayerClones[1]) != 0) {
+ gPlayerClones[1]->spriteOffsetY = sSpriteOffsets[this->dir];
+ num++;
+ }
+ if (IsColliding(super, gPlayerClones[2]) != 0) {
+ gPlayerClones[2]->spriteOffsetY = sSpriteOffsets[this->dir];
+ num++;
+ }
+ }
+ return num;
+}
+
+static const u8 sSpriteOffsets[] = {
+ -4, -3, -2, -1, 0,
+};
+
+static const Frame gSpriteAnimations_PressurePlate_0 = {
+ .index = 0,
+ .duration = 0xFF,
+ .frameSettings = { .b = { .endOfAnimation = 1 } },
+};
+
+static const Frame gSpriteAnimations_PressurePlate_1 = {
+ .index = 1,
+ .duration = 0xFF,
+ .frameSettings = { .b = { .endOfAnimation = 1 } },
+};
+
+static const Frame gSpriteAnimations_PressurePlate_2 = {
+ .index = 2,
+ .duration = 0xFF,
+ .frameSettings = { .b = { .endOfAnimation = 1 } },
+};
+
+static const Frame gSpriteAnimations_PressurePlate_3 = {
+ .index = 3,
+ .duration = 0xFF,
+ .frameSettings = { .b = { .endOfAnimation = 1 } },
+};
+
+static const Frame gSpriteAnimations_PressurePlate_4 = {
+ .index = 4,
+ .duration = 0xFF,
+ .frameSettings = { .b = { .endOfAnimation = 1 } },
+};
+
+const Frame* const gSpriteAnimations_PressurePlate[] = {
+ &gSpriteAnimations_PressurePlate_0, &gSpriteAnimations_PressurePlate_1, &gSpriteAnimations_PressurePlate_2,
+ &gSpriteAnimations_PressurePlate_3, &gSpriteAnimations_PressurePlate_4,
+};
diff --git a/src/object/rupee.c b/src/object/rupee.c
index 4c9b8aa0..f4119600 100644
--- a/src/object/rupee.c
+++ b/src/object/rupee.c
@@ -51,7 +51,7 @@ void sub_08086A6C(Entity* ent) {
u32 uVar1;
uVar1 = Random();
- ent->zVelocity = 163840;
+ ent->zVelocity = Q_16_16(2.5);
ent->direction = DirectionNormalize(uVar1 >> 16);
ent->speed = uVar1 & 480;
}
diff --git a/src/player.c b/src/player.c
index 6c2772d6..09e83b77 100644
--- a/src/player.c
+++ b/src/player.c
@@ -22,26 +22,26 @@
#include "screen.h"
#include "main.h"
-#define GRAVITY_RATE 0x2000
+#define GRAVITY_RATE Q_8_8(32)
#define SLOPE_SPEED_MODIFIER 0x50
-#define WALK_SPEED 0x140
-#define ROLL_SPEED 0x200
-#define SHIELDING_SPEED 0xC0
-#define GUST_JAR_SPEED 0x80
-#define SWORD_CHARGE_SPEED 0xE0
-#define BURNING_SPEED 0x300
+#define WALK_SPEED Q_8_8(1.25)
+#define ROLL_SPEED Q_8_8(2.0)
+#define GUST_JAR_SPEED Q_8_8(0.5)
+#define SHIELDING_SPEED Q_8_8(0.75)
+#define SWORD_CHARGE_SPEED Q_8_8(0.875)
+#define BURNING_SPEED Q_8_8(3)
-#define JUMP_SPEED_FWD 0x100
+#define JUMP_SPEED_FWD Q_8_8(1)
/* Jumping out of a hole */
-#define JUMP_SPEED_HOLE_FWD 0x78
-#define JUMP_SPEED_HOLE_Z 0x1a000
+#define JUMP_SPEED_HOLE_FWD Q_8_8(0.46875)
+#define JUMP_SPEED_HOLE_Z Q_16_16(1.625)
/* Bouncing off a wall */
-#define BOUNCE_SPEED_FWD 0x100
-#define BOUNCE_SPEED_Z 0x20000
+#define BOUNCE_SPEED_FWD Q_8_8(1.0)
+#define BOUNCE_SPEED_Z Q_16_16(2.0)
-#define PULL_SPEED 0x80
-#define PUSH_SPEED 0x80
+#define PULL_SPEED Q_8_8(0.5)
+#define PUSH_SPEED Q_8_8(0.5)
#define PIT_DAMAGE 0x2
@@ -321,7 +321,6 @@ extern u8 gUnk_080082DC[];
extern u16 script_BedInLinksRoom;
extern u16 script_BedAtSimons;
-extern Entity* gPlayerClones[];
extern ScriptExecutionContext gPlayerScriptExecutionContext;
NONMATCH("asm/non_matching/playerItemPacciCane/CheckPlayerInactive.inc", u32 CheckPlayerInactive(void)) {
@@ -724,7 +723,7 @@ static NONMATCH("asm/non_matching/player/PlayerBounceUpdate.inc", void PlayerBou
}
if (--this->actionDelay != 0xFF) {
- this->zVelocity = 0x10000;
+ this->zVelocity = Q_16_16(1.0);
return;
}
@@ -1118,7 +1117,7 @@ static void PortalStandUpdate(Entity* this) {
if (--this->actionDelay == 0xff) {
this->direction = gPlayerState.field_0xd;
this->animationState = Direction8ToAnimationState(this->direction);
- this->zVelocity = 0x20000;
+ this->zVelocity = Q_16_16(2.0);
this->speed = JUMP_SPEED_FWD;
this->action = PLAYER_MINISH;
this->subAction = 7;
@@ -1531,7 +1530,7 @@ static void sub_08071D04(Entity* this) {
gPlayerState.field_0x3c[0] = 0;
this->direction = 0xff;
this->speed = 0;
- this->zVelocity = 0x18000;
+ this->zVelocity = Q_16_16(1.5);
gPlayerState.jump_status = 1;
gPlayerState.swim_state = 0;
return;
@@ -1849,7 +1848,7 @@ static void PlayerLavaInit(Entity* this) {
COLLISION_OFF(this);
if ((gPlayerState.flags & PL_MINISH) == 0) {
this->subAction = 1;
- this->zVelocity = 0x28000;
+ this->zVelocity = Q_16_16(2.5);
ent = CreateObject(OBJECT_42, 0x80, 0);
if (ent != NULL) {
ent->child = this;
@@ -2224,7 +2223,7 @@ static void sub_08072B5C(Entity* this) {
COLLISION_ON(this);
this->spritePriority.b0 = 4;
this->speed = 0x40;
- this->zVelocity = 0x39000;
+ this->zVelocity = Q_16_16(3.5625);
this->z.WORD--;
gPlayerState.jump_status = 0x41;
sub_0806F854(this, 0, -12);
@@ -2240,7 +2239,7 @@ static void sub_08072B5C(Entity* this) {
temp -= 4;
temp <<= 12;
this->zVelocity = temp;
- this->speed = 0x100;
+ this->speed = Q_8_8(1.0);
gPlayerState.animation = 0x810;
SoundReq(SFX_PLY_JUMP);
}
@@ -2679,7 +2678,7 @@ static void PlayerParachute(Entity* this) {
static void sub_08073468(Entity* this) {
gPlayerState.animation = 1792;
gPlayerState.jump_status = 0;
- this->zVelocity = -0x10000;
+ this->zVelocity = Q_16_16(-1.0);
this->subAction++;
this->field_0x7c.WORD = 480;
this->direction = Direction8FromAnimationState(this->animationState);
@@ -2695,7 +2694,7 @@ static void sub_08073468(Entity* this) {
static void sub_080734D4(Entity* this) {
GravityUpdate(this, -(GRAVITY_RATE / 2));
if (this->zVelocity > 0 || gPlayerState.field_0x38 == 1) {
- this->zVelocity = 0x49000;
+ this->zVelocity = Q_16_16(4.5625);
this->subAction++;
}
}
@@ -2872,7 +2871,7 @@ static void sub_0807380C(Entity* this) {
if (--this->actionDelay == 0) {
this->subAction = 7;
this->actionDelay = 60;
- this->zVelocity = 0x20000;
+ this->zVelocity = Q_16_16(2.0);
}
}
UpdateAnimationSingleFrame(this);
@@ -2965,7 +2964,7 @@ static void sub_080739EC(Entity* this) {
}
if ((gPlayerState.jump_status & 0xC0) == 0) {
if ((gPlayerState.jump_status & 0x20) && this->zVelocity == 0) {
- this->zVelocity = 0x28000;
+ this->zVelocity = Q_16_16(2.5);
this->actionDelay = 10;
this->direction = 0xff;
gPlayerState.jump_status += 2;
@@ -3176,7 +3175,7 @@ static void sub_08073F04(Entity* this) {
this->spritePriority.b1 = 2;
this->spriteSettings.draw = 0;
this->subAction++;
- this->zVelocity = 0x28000;
+ this->zVelocity = Q_16_16(2.5);
this->speed = 0x100;
gPlayerState.flags &= ~PL_MINISH;
ResetPlayer();
@@ -3240,7 +3239,7 @@ static void sub_08074060(Entity* this) {
this->spriteSettings.shadow = 1;
this->field_0xf = 0;
this->subAction++;
- this->zVelocity = 0x20000;
+ this->zVelocity = Q_16_16(2.0);
gPlayerState.animation = 2060;
sub_0805EC60(this);
} else {
diff --git a/src/projectile/boneProjectile.c b/src/projectile/boneProjectile.c
index 20c6e090..33677de2 100644
--- a/src/projectile/boneProjectile.c
+++ b/src/projectile/boneProjectile.c
@@ -75,7 +75,7 @@ void BoneProjectile_Action3(Entity* this) {
void BoneProjectile_Action4(Entity* this) {
GetNextFrame(this);
LinearMoveUpdate(this);
- if (GravityUpdate(this, 0x1800) == 0) {
+ if (GravityUpdate(this, Q_8_8(24.0)) == 0) {
DeleteEntity(this);
}
}
@@ -83,7 +83,7 @@ void BoneProjectile_Action4(Entity* this) {
void sub_080A82D8(Entity* this) {
this->action = 4;
COLLISION_OFF(this);
- this->zVelocity = 0x10000;
+ this->zVelocity = Q_16_16(1.0);
this->direction ^= 0x10;
this->speed = 0x80;
}
diff --git a/src/projectile/cannonballProjectile.c b/src/projectile/cannonballProjectile.c
index 449240e1..5e07dfc4 100644
--- a/src/projectile/cannonballProjectile.c
+++ b/src/projectile/cannonballProjectile.c
@@ -5,7 +5,7 @@ extern void CreateItemOnGround(Entity*);
extern s32 sub_080AF090(Entity*);
extern void sub_080043A8(Entity*);
extern void CreateChestSpawner(Entity*);
-extern u32 sub_080177A0(Entity*, Entity*);
+extern u32 IsColliding(Entity*, Entity*);
extern void (*const CannonballProjectile_Functions[])(Entity*);
extern void (*const CannonballProjectile_Actions[])(Entity*);
@@ -79,7 +79,7 @@ bool32 sub_080AB634(Entity* this) {
Entity** entities = ((Entity**)&this->parent->zVelocity);
u32 i;
for (i = 0; i <= 3; ++i) {
- if (entities[i] != NULL && (sub_080177A0(this, entities[i]) != 0)) {
+ if (entities[i] != NULL && (IsColliding(this, entities[i]) != 0)) {
if (entities[i]->action < 3) {
entities[i]->action = 3;
entities[i]->actionDelay = 0x1e;
diff --git a/src/projectile/dekuSeedProjectile.c b/src/projectile/dekuSeedProjectile.c
index d84d0409..3afad118 100644
--- a/src/projectile/dekuSeedProjectile.c
+++ b/src/projectile/dekuSeedProjectile.c
@@ -5,7 +5,7 @@
extern s32 sub_080AF090(Entity*);
extern s32 IsProjectileOffScreen(Entity*);
extern void sub_08016AD2(Entity*);
-extern u32 sub_080177A0(Entity*, Entity*);
+extern u32 IsColliding(Entity*, Entity*);
extern void (*const DekuSeedProjectile_Functions[])(Entity*);
extern void (*const DekuSeedProjectile_Actions[])(Entity*);
@@ -70,7 +70,7 @@ void DekuSeedProjectile_Action1(Entity* this) {
}
if (this->field_0xf != 0) {
parent = this->parent;
- if ((parent->next != NULL) && (sub_080177A0(this, parent) != 0)) {
+ if ((parent->next != NULL) && (IsColliding(this, parent) != 0)) {
this->iframes = 0x10;
this->knockbackDirection = -this->direction;
this->bitfield = 0x80;
diff --git a/src/projectile/dirtBallProjectile.c b/src/projectile/dirtBallProjectile.c
index a4a0d8e1..df383b15 100644
--- a/src/projectile/dirtBallProjectile.c
+++ b/src/projectile/dirtBallProjectile.c
@@ -48,7 +48,7 @@ void DirtBallProjectile_Init(Entity* this) {
this->action = 1;
this->subAction = 0;
this->spriteSettings.shadow = 1;
- this->zVelocity = 0x8000;
+ this->zVelocity = Q_16_16(0.5);
this->hitbox = (Hitbox*)&gUnk_08129764;
this->field_0x3c |= 0x10;
switch (this->type) {
@@ -76,13 +76,13 @@ void DirtBallProjectile_Action1(Entity* this) {
if (parent->next == NULL) {
this->action = 2;
}
- PositionRelative(parent, this, 0, -0x10000);
+ PositionRelative(parent, this, 0, Q_16_16(-1.0));
switch (this->type) {
case 0:
- this->z.HALF.HI += 0x10;
+ this->z.HALF.HI += Q_8_8(1.0 / 16.0);
break;
case 1:
- this->z.HALF.HI += 0xe;
+ this->z.HALF.HI += Q_8_8(1.0 / 16.0 - 1.0 / 128.0);
sub_08078954(this->child);
CopyPosition(this, this->child);
if ((0xf < (u8)(this->actionDelay++ + 1)) && (entity = this->child, entity->actionDelay == 0)) {
@@ -96,7 +96,7 @@ void DirtBallProjectile_Action1(Entity* this) {
}
break;
case 2:
- this->z.HALF.HI += 0xe;
+ this->z.HALF.HI += Q_8_8(1.0 / 16.0 - 1.0 / 128.0);
if (EntityInRectRadius(this, &gPlayerEntity, 0xe, 0xe) != 0) {
this->action = 2;
parent->field_0x82.HALF.HI = 0xc0;
diff --git a/src/projectile/gleerokProjectile.c b/src/projectile/gleerokProjectile.c
index 5b63e25f..128e32f7 100644
--- a/src/projectile/gleerokProjectile.c
+++ b/src/projectile/gleerokProjectile.c
@@ -32,10 +32,10 @@ void GleerokProjectile_Init(Entity* this) {
s32 iVar2;
this->action = 1;
- this->zVelocity = -0x10000;
+ this->zVelocity = Q_16_16(-1.0);
if (this->type != 3) {
CopyPosition(this->parent, this);
- sub_0806F5BC(this, 0x1000, this->direction);
+ LinearMoveDirection(this, 0x1000, this->direction);
this->z.WORD = this->parent->y.WORD - this->child->y.WORD;
this->y.WORD -= this->z.WORD;
InitializeAnimation(this, 0x51);
diff --git a/src/projectile/gyorgMaleEnergyProjectile.c b/src/projectile/gyorgMaleEnergyProjectile.c
index 8e9983cc..cfcfed29 100644
--- a/src/projectile/gyorgMaleEnergyProjectile.c
+++ b/src/projectile/gyorgMaleEnergyProjectile.c
@@ -60,8 +60,8 @@ void GyorgMaleEnergyProjectile_Action1(Entity* this) {
DeleteThisEntity();
}
animationState = this->parent->animationState;
- PositionRelative(this->parent, this, gSineTable[animationState] * 0x2800,
- gSineTable[animationState + 0x40] * -0x2800);
+ PositionRelative(this->parent, this, gSineTable[animationState] * Q_16_16(5.0 / 32.0),
+ gSineTable[animationState + 0x40] * Q_16_16(-5.0 / 32.0));
GetNextFrame(this);
if (--this->actionDelay == 0) {
this->action = 2;
diff --git a/src/projectile/lakituCloudProjectile.c b/src/projectile/lakituCloudProjectile.c
index ce7d2d21..0175653f 100644
--- a/src/projectile/lakituCloudProjectile.c
+++ b/src/projectile/lakituCloudProjectile.c
@@ -57,8 +57,8 @@ void LakituCloudProjectile_Init(Entity* this) {
}
void LakituCloudProjectile_Action1(Entity* this) {
- PositionRelative(this->parent, this, 0, -0x10000);
- this->z.HALF.HI = 0xfffe;
+ PositionRelative(this->parent, this, 0, Q_16_16(-1.0));
+ this->z.HALF.HI = -2;
UpdateAnimationSingleFrame(this);
}
diff --git a/src/projectile/mandiblesProjectile.c b/src/projectile/mandiblesProjectile.c
index 5ef24656..4b47889b 100644
--- a/src/projectile/mandiblesProjectile.c
+++ b/src/projectile/mandiblesProjectile.c
@@ -77,7 +77,7 @@ void MandiblesProjectile_Init(Entity* this) {
this->animationState = 0xff;
this->field_0x82.HALF.LO = 0;
this->spritePriority.b0 = 4;
- ResolveEntityBelow(this, this->parent);
+ SortEntityBelow(this, this->parent);
sub_080AA270(this);
}
@@ -125,9 +125,9 @@ void MandiblesProjectile_Action3(Entity* this) {
} else {
tmp = GetSpriteSubEntryOffsetDataPointer((u16)entity->spriteIndex, entity->frameIndex);
if ((entity->animationState & 4) != 0) {
- PositionRelative(entity, this, -tmp[0] * 0x10000, tmp[1] << 0x10);
+ PositionRelative(entity, this, Q_16_16(-tmp[0]), Q_16_16(tmp[1]));
} else {
- PositionRelative(entity, this, tmp[0] << 0x10, tmp[1] << 0x10);
+ PositionRelative(entity, this, Q_16_16(tmp[0]), Q_16_16(tmp[1]));
}
}
if (entity->field_0x43 == 0) {
@@ -212,9 +212,9 @@ void sub_080AA1D8(Entity* this) {
if ((parent->frameIndex & 0x20) == 0) {
tmp = GetSpriteSubEntryOffsetDataPointer((u16)parent->spriteIndex, parent->frameIndex);
if ((parent->animationState & 4) != 0) {
- PositionRelative(parent, this, -tmp[0] * 0x10000, tmp[1] << 0x10);
+ PositionRelative(parent, this, Q_16_16(-tmp[0]), Q_16_16(tmp[1]));
} else {
- PositionRelative(parent, this, tmp[0] << 0x10, tmp[1] << 0x10);
+ PositionRelative(parent, this, Q_16_16(tmp[0]), Q_16_16(tmp[1]));
}
if (parent->field_0x43 != 0) {
if ((this->flags & ENT_COLLIDE) != 0) {
diff --git a/src/projectile/octorokBossProjectile.c b/src/projectile/octorokBossProjectile.c
index 1ca08f9d..1f5c8ddd 100644
--- a/src/projectile/octorokBossProjectile.c
+++ b/src/projectile/octorokBossProjectile.c
@@ -33,7 +33,7 @@ void OctorokBossProjectile_Init(Entity* this) {
switch (this->type) {
case 0:
- sub_0806F62C(this, 0x4800, this->direction);
+ LinearMoveAngle(this, 0x4800, this->direction);
this->speed = 0x200;
this->actionDelay = 0;
this->field_0xf = this->direction;
@@ -44,11 +44,11 @@ void OctorokBossProjectile_Init(Entity* this) {
this->spriteRendering.b3 = 3;
this->spritePriority.b0 = 6;
this->speed = (Random() & 0x1ff) + 0x200;
- this->zVelocity = (Random() & 0x1fff) + 0x18000;
+ this->zVelocity = (Random() & 0x1fff) + Q_16_16(1.5);
uVar1 = (((u8)Random() & 7) - 4);
this->direction -= uVar1;
*(u32*)&this->field_0x78 = 600;
- sub_0806F62C(this, this->speed, this->direction);
+ LinearMoveAngle(this, this->speed, this->direction);
InitializeAnimation(this, 4);
break;
case 2:
@@ -59,7 +59,7 @@ void OctorokBossProjectile_Init(Entity* this) {
}
this->speed = 0x200;
this->actionDelay = 0x30;
- sub_0806F62C(this, 0x5000, this->direction);
+ LinearMoveAngle(this, 0x5000, this->direction);
InitializeAnimation(this, 5);
break;
case 3:
@@ -113,7 +113,7 @@ void OctorokBossProjectile_Action1(Entity* this) {
}
UpdateAnimationSingleFrame(this);
this->field_0x78.HWORD--;
- sub_0806F62C(this, this->speed, this->direction);
+ LinearMoveAngle(this, this->speed, this->direction);
sub_080AE58C(this, this->direction >> 3, 0);
if ((this->collisions & 0xee00) != 0) {
this->direction = -this->direction;
@@ -153,7 +153,7 @@ void OctorokBossProjectile_Action1(Entity* this) {
if (GravityUpdate(this, 0x1800) != 0) {
sub_080AE58C(this, this->direction >> 3, 0);
if (this->collisions == 0) {
- sub_0806F62C(this, (s32)this->speed, (u32)this->direction);
+ LinearMoveAngle(this, (s32)this->speed, (u32)this->direction);
} else {
OctorokBossProjectile_Action2(this);
}
@@ -176,7 +176,7 @@ void OctorokBossProjectile_Action1(Entity* this) {
case 2:
GetNextFrame(this);
if (--this->actionDelay != 0xff) {
- sub_0806F62C(this, this->speed, this->direction);
+ LinearMoveAngle(this, this->speed, this->direction);
return;
}
if (this->child != NULL) {
diff --git a/src/projectile/rockProjectile.c b/src/projectile/rockProjectile.c
index 7254631b..66e8388f 100644
--- a/src/projectile/rockProjectile.c
+++ b/src/projectile/rockProjectile.c
@@ -31,7 +31,7 @@ void sub_080A8064(Entity* this) {
void RockProjectile_Init(Entity* this) {
this->action = 1;
this->actionDelay = 0x30;
- this->zVelocity = 0xa000;
+ this->zVelocity = Q_16_16(0.625);
InitializeAnimation(this, 0);
}
@@ -86,7 +86,7 @@ void sub_080A8178(Entity* this) {
this->action = 2;
COLLISION_OFF(this);
this->speed = 0x40;
- this->zVelocity = 0x14000;
+ this->zVelocity = Q_16_16(1.25);
}
void (*const RockProjectile_Functions[])(Entity*) = {
diff --git a/src/projectile/stalfosProjectile.c b/src/projectile/stalfosProjectile.c
index 709907e0..841a68e3 100644
--- a/src/projectile/stalfosProjectile.c
+++ b/src/projectile/stalfosProjectile.c
@@ -32,7 +32,7 @@ void sub_080A9A34(Entity* this) {
if (this->bitfield == 0x9d) {
this->action = 3;
COLLISION_OFF(this);
- this->zVelocity = 0x2a000;
+ this->zVelocity = Q_16_16(2.625);
this->spritePriority.b1 = 1;
}
}
@@ -76,7 +76,7 @@ void StalfosProjectile_Init(Entity* this) {
break;
case 2:
this->action = 3;
- this->zVelocity = 0x2a000;
+ this->zVelocity = Q_16_16(2.625);
this->spritePriority.b1 = 1;
break;
default:
diff --git a/src/projectile/v1DarkMagicProjectile.c b/src/projectile/v1DarkMagicProjectile.c
index c9a3d281..dbc770a1 100644
--- a/src/projectile/v1DarkMagicProjectile.c
+++ b/src/projectile/v1DarkMagicProjectile.c
@@ -31,9 +31,9 @@ void sub_080AAC44(Entity* this) {
this->action = 2;
COLLISION_OFF(this);
if (this->type == 0) {
- ResolveEntityOnTop(&gPlayerEntity, this);
+ SortEntityAbove(&gPlayerEntity, this);
} else {
- ResolveEntityOnTop(this->parent, this);
+ SortEntityAbove(this->parent, this);
}
ResetPlayer();
gPlayerState.mobility |= 0x80;
@@ -114,7 +114,7 @@ void V1DarkMagicProjectile_Init(Entity* this) {
} else {
this->action = 3;
this->hitType = 0x2c;
- ResolveEntityOnTop(this->parent, this);
+ SortEntityAbove(this->parent, this);
}
if (this->type == 0) {
this->actionDelay = 0;
@@ -136,7 +136,7 @@ void V1DarkMagicProjectile_Init(Entity* this) {
entity->parent = this;
}
} else {
- ResolveEntityOnTop(this->parent, this);
+ SortEntityAbove(this->parent, this);
COLLISION_OFF(this);
CopyPosition(this->parent, this);
}
diff --git a/src/projectile/v1EyeLaser.c b/src/projectile/v1EyeLaser.c
index 8bdb0652..de642d5d 100644
--- a/src/projectile/v1EyeLaser.c
+++ b/src/projectile/v1EyeLaser.c
@@ -99,7 +99,7 @@ void sub_080AB844(Entity* this, s32 param_1, s32 param_2) {
entity->type = 1;
entity->actionDelay = param_1;
entity->parent = this->parent;
- PositionRelative(this, entity, 0, param_2 << 0x10);
+ PositionRelative(this, entity, 0, Q_16_16(param_2));
if (param_1 != 1) {
entity->hitbox = (Hitbox*)&gUnk_0812A61C;
} else {
diff --git a/src/projectile/v1FireProjectile.c b/src/projectile/v1FireProjectile.c
index 90bdc5fd..2823d563 100644
--- a/src/projectile/v1FireProjectile.c
+++ b/src/projectile/v1FireProjectile.c
@@ -39,10 +39,10 @@ void V1FireProjectile_Init(Entity* this) {
s8* data;
this->action = 1;
- this->zVelocity = -0x10000;
+ this->zVelocity = Q_16_16(-1.0);
this->field_0x76.HWORD = TILE(this->x.HALF.HI, this->y.HALF.HI);
CopyPosition(this->parent, this);
- sub_0806F5BC(this, 0x1000, this->direction);
+ LinearMoveDirection(this, 0x1000, this->direction);
this->spritePriority.b0 = 1;
this->z = this->parent->z;
InitializeAnimation(this, 0x51);
diff --git a/src/projectile/v2Projectile.c b/src/projectile/v2Projectile.c
index 5d9f6eb2..fc7f09d2 100644
--- a/src/projectile/v2Projectile.c
+++ b/src/projectile/v2Projectile.c
@@ -138,7 +138,7 @@ void sub_080ABE04(Entity* this) {
u32 rand = Random() & 0xff;
u32 newX;
this->action = 1;
- this->zVelocity = 0xffff0000;
+ this->zVelocity = Q_16_16(-1.0);
this->z.HALF.HI -= 0xa0;
this->x.HALF.HI = (gRoomControls.origin_x & 0x7ff0) | 0x8;
this->y.HALF.HI = (gRoomControls.origin_y & 0x7ff0) | 0x8;
diff --git a/src/roomInit.c b/src/roomInit.c
index e4fd06fa..3cb07870 100644
--- a/src/roomInit.c
+++ b/src/roomInit.c
@@ -5798,14 +5798,14 @@ void sub_0804F79C(Entity* parent) {
fx = CreateFx(parent, FX_BIG_EXPLOSION, 0);
if (fx != NULL) {
fx->spriteRendering.b3 = 0;
- fx->x.HALF.HI = gRoomControls.origin_x + 0x1b8;
- fx->y.HALF.HI = gRoomControls.origin_y + 0x148;
+ fx->x.HALF.HI = gRoomControls.origin_x + Q_8_8(1.72);
+ fx->y.HALF.HI = gRoomControls.origin_y + Q_8_8(1.285);
}
fx = CreateFx(parent, FX_BIG_EXPLOSION, 0);
if (fx != NULL) {
fx->spriteRendering.b3 = 0;
- fx->x.HALF.HI = gRoomControls.origin_x + 0x238;
- fx->y.HALF.HI = gRoomControls.origin_y + 0x148;
+ fx->x.HALF.HI = gRoomControls.origin_x + Q_8_8(2.22);
+ fx->y.HALF.HI = gRoomControls.origin_y + Q_8_8(1.285);
}
}
diff --git a/src/script.c b/src/script.c
index 02cf220a..f6cb795f 100644
--- a/src/script.c
+++ b/src/script.c
@@ -258,7 +258,7 @@ void HandlePostScriptActions(Entity* entity, ScriptExecutionContext* context) {
case 1 << 0x02:
break;
case 1 << 0x03:
- entity->zVelocity = 0x18000;
+ entity->zVelocity = Q_16_16(1.5);
break;
case 1 << 0x04:
CreateSpeechBubbleExclamationMark(entity, 8, -0x18);
@@ -1396,7 +1396,7 @@ void ScriptCommand_0807EE30(Entity* entity, ScriptExecutionContext* context) {
}
tmp = entity->x.HALF.HI - context->x.HALF.HI;
tmp2 = entity->y.HALF.HI - context->y.HALF.HI;
- sub_0806F62C(entity, entity->speed, entity->direction);
+ LinearMoveAngle(entity, entity->speed, entity->direction);
tmp *= entity->x.HALF.HI - context->x.HALF.HI;
tmp2 *= entity->y.HALF.HI - context->y.HALF.HI;
if (tmp <= 0 && tmp2 <= 0) {
@@ -1685,7 +1685,7 @@ void sub_0807F36C(Entity* entity, ScriptExecutionContext* context) {
fx = CreateFx(entity, FX_REFLECT4, 0);
if (fx != NULL) {
fx->spritePriority.b0 = 1;
- PositionRelative(entity, fx, 0, -0x80000);
+ PositionRelative(entity, fx, 0, Q_16_16(-8.0));
if (Random() & 1)
fx->spriteSettings.flipX = 1;
if (Random() & 1)
@@ -1749,7 +1749,7 @@ void sub_0807F464(Entity* entity, ScriptExecutionContext* context) {
entity->animationState = (entity->animationState & 0x80) | 6;
}
}
- sub_0806F62C(entity, entity->speed, entity->direction);
+ LinearMoveAngle(entity, entity->speed, entity->direction);
if (((context->x.HALF.HI - entity->x.HALF.HI) ^ ((entity->direction & 0x80) << 24)) < 0)
entity->x.HALF.HI = context->x.HALF.HI;
else
@@ -1773,7 +1773,7 @@ void sub_0807F4F8(Entity* entity, ScriptExecutionContext* context) {
entity->animationState = (entity->animationState & 0x80);
}
}
- sub_0806F62C(entity, entity->speed, entity->direction);
+ LinearMoveAngle(entity, entity->speed, entity->direction);
if (((context->y.HALF.HI - entity->y.HALF.HI) ^ ((entity->direction & 0x80) << 24)) >= 0)
entity->y.HALF.HI = context->y.HALF.HI;
else
@@ -1853,12 +1853,12 @@ void sub_0807F708(Entity* entity, ScriptExecutionContext* context) {
void sub_0807F714(Entity* entity, ScriptExecutionContext* context) {
entity->spriteRendering.b3 = gUnk_08114F30[entity->spriteRendering.b3];
- ResolveEntityOnTop(entity, entity);
+ SortEntityAbove(entity, entity);
}
void sub_0807F738(Entity* entity, ScriptExecutionContext* context) {
entity->spriteRendering.b3 = gUnk_08114F34[entity->spriteRendering.b3];
- ResolveEntityBelow(entity, entity);
+ SortEntityBelow(entity, entity);
}
void SetPlayerPos(Entity* entity, ScriptExecutionContext* context) {
@@ -2121,7 +2121,7 @@ void sub_0807FBCC(Entity* entity, ScriptExecutionContext* context) {
}
void sub_0807FBD4(Entity* entity, ScriptExecutionContext* context) {
- sub_0806F62C(entity, entity->speed, entity->direction);
+ LinearMoveAngle(entity, entity->speed, entity->direction);
if (CheckOnScreen(entity))
gActiveScriptInfo.commandSize = 0;
}
diff --git a/src/sound.c b/src/sound.c
index 342ae9c6..b0bb5901 100644
--- a/src/sound.c
+++ b/src/sound.c
@@ -462,7 +462,7 @@ extern const SongHeader sfx108;
extern const SongHeader sfx109;
extern const SongHeader sfx10A;
extern const SongHeader sfx10B;
-extern const SongHeader sfx10C;
+extern const SongHeader sfxButtonPress;
extern const SongHeader sfx10D;
extern const SongHeader sfx10E;
extern const SongHeader sfx10F;
@@ -557,7 +557,7 @@ extern const SongHeader sfx167;
extern const SongHeader sfx168;
extern const SongHeader sfx169;
extern const SongHeader sfx16A;
-extern const SongHeader sfx16B;
+extern const SongHeader sfxPressurePlate;
extern const SongHeader sfx16C;
extern const SongHeader sfx16D;
extern const SongHeader sfx16E;
@@ -1094,7 +1094,7 @@ const Song gSongTable[] = {
[SFX_109] = { &sfx109, MUSIC_PLAYER_1E, MUSIC_PLAYER_1E },
[SFX_10A] = { &sfx10A, MUSIC_PLAYER_08, MUSIC_PLAYER_08 },
[SFX_10B] = { &sfx10B, MUSIC_PLAYER_07, MUSIC_PLAYER_07 },
- [SFX_10C] = { &sfx10C, MUSIC_PLAYER_06, MUSIC_PLAYER_06 },
+ [SFX_BUTTON_PRESS] = { &sfxButtonPress, MUSIC_PLAYER_06, MUSIC_PLAYER_06 },
[SFX_10D] = { &sfx10D, MUSIC_PLAYER_05, MUSIC_PLAYER_05 },
[SFX_10E] = { &sfx10E, MUSIC_PLAYER_04, MUSIC_PLAYER_04 },
[SFX_10F] = { &sfx10F, MUSIC_PLAYER_03, MUSIC_PLAYER_03 },
@@ -1189,7 +1189,7 @@ const Song gSongTable[] = {
[SFX_168] = { &sfx168, MUSIC_PLAYER_16, MUSIC_PLAYER_16 },
[SFX_169] = { &sfx169, MUSIC_PLAYER_15, MUSIC_PLAYER_15 },
[SFX_16A] = { &sfx16A, MUSIC_PLAYER_14, MUSIC_PLAYER_14 },
- [SFX_16B] = { &sfx16B, MUSIC_PLAYER_13, MUSIC_PLAYER_13 },
+ [SFX_PRESSURE_PLATE] = { &sfxPressurePlate, MUSIC_PLAYER_13, MUSIC_PLAYER_13 },
[SFX_16C] = { &sfx16C, MUSIC_PLAYER_03, MUSIC_PLAYER_03 },
[SFX_16D] = { &sfx16D, MUSIC_PLAYER_12, MUSIC_PLAYER_12 },
[SFX_16E] = { &sfx16E, MUSIC_PLAYER_11, MUSIC_PLAYER_11 },