summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTheo <65437533+notyourav@users.noreply.github.com>2023-12-30 17:29:51 -0800
committerGitHub <noreply@github.com>2023-12-30 17:29:51 -0800
commit37714644960c56650dd1067b86aafa685eaf01f4 (patch)
tree40f875091f258e234ff5b0c8f56e08faa55e90d1
parent9c87bcca8ea4b52199ed908c0ea28ab08b1d0747 (diff)
parent2c7c9ae509d3a9909623c917c082a1ed45b76f46 (diff)
Merge pull request #680 from notyourav/f
BounceUpdate and other asm functions labeled
-rwxr-xr-xasm/macros/map.inc15
-rw-r--r--asm/src/code_080043E8.s46
-rw-r--r--asm/src/intr.s75
-rw-r--r--asm/src/script.s2
-rw-r--r--asm/src/veneer.s64
-rw-r--r--include/asm.h14
-rw-r--r--include/common.h4
-rw-r--r--include/enemy.h2
-rw-r--r--include/functions.h2
-rw-r--r--include/message.h10
-rw-r--r--linker.ld2
-rw-r--r--src/collision.c8
-rw-r--r--src/common.c12
-rw-r--r--src/debug.c2
-rw-r--r--src/enemy/acroBandits.c2
-rw-r--r--src/enemy/beetle.c2
-rw-r--r--src/enemy/bobomb.c2
-rw-r--r--src/enemy/bombPeahat.c4
-rw-r--r--src/enemy/chuchu.c2
-rw-r--r--src/enemy/cloudPiranha.c2
-rw-r--r--src/enemy/cuccoAggr.c2
-rw-r--r--src/enemy/fallingBoulder.c2
-rw-r--r--src/enemy/helmasaur.c2
-rw-r--r--src/enemy/peahat.c2
-rw-r--r--src/enemy/rollobite.c6
-rw-r--r--src/enemy/rope.c2
-rw-r--r--src/enemy/spikedBeetle.c6
-rw-r--r--src/enemy/tektite.c4
-rw-r--r--src/enemy/tektiteGolden.c4
-rw-r--r--src/enemy/vaatiTransfigured.c2
-rw-r--r--src/fileselect.c2
-rw-r--r--src/manager/enemyInteractionManager.c4
-rw-r--r--src/menu/figurineMenu.c4
-rw-r--r--src/menu/kinstoneMenu.c2
-rw-r--r--src/menu/pauseMenu.c4
-rw-r--r--src/message.c2
-rw-r--r--src/npc/phonograph.c8
-rw-r--r--src/npcUtils.c2
-rw-r--r--src/object/bird.c2
-rw-r--r--src/object/book.c2
-rw-r--r--src/object/crenelBeanSprout.c2
-rw-r--r--src/object/cutsceneMiscObject.c4
-rw-r--r--src/object/figurineDevice.c6
-rw-r--r--src/object/graveyardKey.c2
-rw-r--r--src/object/itemOnGround.c2
-rw-r--r--src/object/keyStealingTakkuri.c2
-rw-r--r--src/object/lilypadLarge.c4
-rw-r--r--src/object/mask.c2
-rw-r--r--src/object/minecart.c4
-rw-r--r--src/object/objectA2.c8
-rw-r--r--src/object/objectOnPillar.c2
-rw-r--r--src/object/playerClone.c2
-rw-r--r--src/object/pot.c20
-rw-r--r--src/object/rupee.c2
-rw-r--r--src/player.c6
-rw-r--r--src/playerItem/playerItemHeldObject.c2
-rw-r--r--src/playerItem/playerItemPacciCaneProjectile.c2
-rw-r--r--src/playerUtils.c2
-rw-r--r--src/projectile/boneProjectile.c2
-rw-r--r--src/projectile/dekuSeedProjectile.c6
-rw-r--r--src/projectile/dirtBallProjectile.c2
-rw-r--r--src/projectile/rockProjectile.c6
62 files changed, 229 insertions, 197 deletions
diff --git a/asm/macros/map.inc b/asm/macros/map.inc
index c731112d..0a2ac5c5 100755
--- a/asm/macros/map.inc
+++ b/asm/macros/map.inc
@@ -1,6 +1,21 @@
.ifndef GUARD_ASM_MACROS_MAP_INC
.set GUARD_ASM_MACROS_MAP_INC, 1
+ .set TOP_TILEDATA, gMapTop+0x4
+ .set TOP_COLLISIONDATA, gMapTop+0x2004
+ .set TOP_TILEDATACLONE, gMapTop+0x3004
+ .set TOP_METATILETYPES, gMapTop+0x5004
+ .set TOP_UNKDATA2, gMapTop+0x6004
+ .set TOP_METATILES, gMapTop+0x7004
+ .set TOP_UNKDATA3, gMapTop+0xb004
+ .set BOTTOM_TILEDATA, gMapBottom+0x4
+ .set BOTTOM_COLLISIONDATA, gMapBottom+0x2004
+ .set BOTTOM_TILEDATACLONE, gMapBottom+0x3004
+ .set BOTTOM_METATILETYPES, gMapBottom+0x5004
+ .set BOTTOM_UNKDATA2, gMapBottom+0x6004
+ .set BOTTOM_METATILES, gMapBottom+0x7004
+ .set BOTTOM_UNKDATA3, gMapBottom+0xb004
+
.macro room_header map_x, map_y, pixel_width, pixel_height, tileset_id
.2byte (\map_x) << 4
.2byte (\map_y) << 4
diff --git a/asm/src/code_080043E8.s b/asm/src/code_080043E8.s
index 0216f977..98048228 100644
--- a/asm/src/code_080043E8.s
+++ b/asm/src/code_080043E8.s
@@ -67,7 +67,7 @@ sub_0800445C: @ 0x0800445C
ldr r5, _080044D8 @ =gPlayerEntity
adds r0, r4, #0
adds r1, r5, #0
- bl sub_08004484
+ bl CalcCollisionStaticEntity
cmp r0, #0
beq _08004482
ldrb r0, [r5, #0xc]
@@ -80,8 +80,8 @@ _08004480:
_08004482:
pop {r4, r5, pc}
- thumb_func_start sub_08004484
-sub_08004484: @ 0x08004484
+ thumb_func_start CalcCollisionStaticEntity
+CalcCollisionStaticEntity: @ 0x08004484
ldr r2, _080044DC @ =ram_sub_080B227C
bx r2
@@ -138,30 +138,34 @@ _080044E0: .4byte gUnk_02024048
_080044E4: .4byte gUnk_02021F20
_080044E8: .4byte gPlayerEntity
- thumb_func_start sub_080044EC
-sub_080044EC: @ 0x080044EC
+ // BounceUpdate
+ // assumes initial velocity is set
+ // r0: entity*
+ // r1: acceleration
+ thumb_func_start BounceUpdate
+BounceUpdate: @ 0x080044EC
ldr r2, [r0, #0x34]
ldr r3, [r0, #0x20]
- subs r2, r2, r3
- bpl _080044FE
- str r2, [r0, #0x34]
- subs r3, r3, r1
- str r3, [r0, #0x20]
- movs r0, #2
+ subs r2, r3
+ bpl grounded // if z is positive, entity is grounded
+ str r2, [r0, #0x34] // entity.z = entity.z - entity.zVelocity
+ subs r3, r1
+ str r3, [r0, #0x20] // entity.zVelocity = entity.zVelocity - acceleration
+ movs r0, #2 // return 2
bx lr
-_080044FE:
+grounded:
movs r2, #1
- str r2, [r0, #0x34]
- subs r3, r3, r1
- rsbs r3, r3, #0
- lsrs r3, r3, #1
+ str r2, [r0, #0x34] // entity.z = 1 (note: player cant do certain actions at z!=0)
+ subs r3, r1
+ negs r3, r3
+ lsrs r3, #1
lsrs r1, r3, #2
- adds r3, r3, r1
+ adds r3, r1 // calc next bounce velocity
lsrs r1, r3, #0xc
cmp r1, #0xc
- bhs _08004516
- movs r2, #0
- movs r3, #0
+ bhs _08004516 // return 1 if bouncing
+ movs r2, #0 // return 0 if not bouncing
+ movs r3, #0 // set velocity to 0
_08004516:
str r3, [r0, #0x20]
adds r0, r2, #0
@@ -170,7 +174,7 @@ _08004516:
thumb_func_start sub_0800451C
sub_0800451C: @ 0x0800451C
push {r0, lr}
- bl GetTileUnderEntity
+ bl GetActTile
adds r1, r0, #0
pop {r0, r3}
mov lr, r3
diff --git a/asm/src/intr.s b/asm/src/intr.s
index 4d59c9d7..4f65fa09 100644
--- a/asm/src/intr.s
+++ b/asm/src/intr.s
@@ -86,7 +86,7 @@ arm_sub_080B1A0C: @ 0x080B1A0C
ldrb r2, [r0, #0x38]
mov r0, r3
b arm_GetTileTypeByPos
-arm_GetTileTypeByEntity:
+arm_GetTileTypeByEntity: // GetCell
ldrb r2, [r0, #0x38]
ldrh r1, [r0, #0x32]
ldrh r0, [r0, #0x2e]
@@ -129,7 +129,7 @@ arm_GetRelativeCollisionTile: @ 0x080B1A8C
ldrb r2, [r0, #0x38]
mov r0, r3
b arm_sub_080B1AB4
-arm_GetTileUnderEntity:
+arm_GetActTile: // GetCellAct
ldrb r2, [r0, #0x38]
ldrh r1, [r0, #0x32]
ldrh r0, [r0, #0x2e]
@@ -148,42 +148,46 @@ arm_sub_080B1AD8:
add r0, r0, r1, lsl #6
mov r1, r2
arm_sub_080B1AE0:
- ldr r2, _080B1C24 @ =gUnk_08000278
+ ldr r2, _080B1C24 @ =gUnkDataPtrs
ldr r2, [r2, r1, lsl #2]
ldrb r0, [r2, r0]
bx lr
arm_func_start arm_sub_080B1AF0
arm_sub_080B1AF0: @ 0x080B1AF0
- ldrh r3, [r0, #0x2e]
+ @ r0 = entity*
+ @ r1 = x
+ @ r2 = y
+
+ ldrh r3, [r0, #0x2e] @ ent.x + x
add r3, r3, r1
- ldrh r1, [r0, #0x32]
+ ldrh r1, [r0, #0x32] @ ent.y + y
add r1, r1, r2
- ldrb r2, [r0, #0x38]
+ ldrb r2, [r0, #0x38] @ ent.layer
mov r0, r3
b arm_sub_080B1B18
-arm_sub_080B1B0C:
- ldrb r2, [r0, #0x38]
- ldrh r1, [r0, #0x32]
- ldrh r0, [r0, #0x2e]
+arm_sub_080B1B0C: // GetCellAtt
+ ldrb r2, [r0, #0x38] @ ent.layer
+ ldrh r1, [r0, #0x32] @ ent.y
+ ldrh r0, [r0, #0x2e] @ ent.x
arm_sub_080B1B18:
ldr ip, _080B1C28 @ =gRoomControls
ldrh r3, [ip, #6]
- sub r0, r0, r3
+ sub r0, r0, r3 @ ent.x - gRoomControls.origin_x
ldrh r3, [ip, #8]
- sub r1, r1, r3
+ sub r1, r1, r3 @ ent.y - gRoomControls.origin_y
arm_sub_080B1B2C:
lsl r0, r0, #0x16
- lsr r0, r0, #0x1a
+ lsr r0, r0, #0x1a @ /= 16
lsl r1, r1, #0x16
- lsr r1, r1, #0x1a
+ lsr r1, r1, #0x1a @ /= 16
arm_sub_080B1B3C:
- add r0, r0, r1, lsl #6
+ add r0, r0, r1, lsl #6 @ convert coords to tile index
mov r1, r2
arm_sub_080B1B44:
ldr r2, _080B1C2C @ =gUnk_08000248
ldr r1, [r2, r1, lsl #2]
- ldrb r0, [r1, r0]
+ ldrb r0, [r1, r0] @ load collision tile at my location
bx lr
arm_func_start arm_sub_080B1B54
@@ -242,7 +246,7 @@ sub_080B1BCC: @ 0x080B1BCC
and r1, r1, #0x3f0
and r2, r2, #0x3f0
add r1, r1, r2, lsl #6
- ldr r2, _080B1C50 @ =gUnk_08000278
+ ldr r2, _080B1C50 @ =gUnkDataPtrs
ldrb r3, [r0, #0x38]
ldr r2, [r2, r3, lsl #2]
ldrb r0, [r2, r1, lsr #4]
@@ -253,7 +257,7 @@ _080B1C14: .4byte gUnk_08000258
_080B1C18: .4byte gRoomControls
_080B1C1C: .4byte gUnk_08000228
_080B1C20: .4byte gRoomControls
-_080B1C24: .4byte gUnk_08000278
+_080B1C24: .4byte gUnkDataPtrs
_080B1C28: .4byte gRoomControls
_080B1C2C: .4byte gUnk_08000248
_080B1C30: .4byte gUnk_080B37A0
@@ -264,7 +268,7 @@ _080B1C40: .4byte gUnk_080B7A3E
_080B1C44: .4byte gUnk_08000360
_080B1C48: .4byte gUnk_080B7A3E
_080B1C4C: .4byte gRoomControls
-_080B1C50: .4byte gUnk_08000278
+_080B1C50: .4byte gUnkDataPtrs
arm_func_start UpdateCollision
UpdateCollision: @ 0x080B1C54
@@ -424,15 +428,15 @@ _080B1E74:
mov ip, #0
bl arm_CalcCollisionDirection
mov r6, r0
- ldrb r1, [r5, #0x3f]
+ ldrb r1, [r5, #0x3f] // hitType
mov r0, #0x22
mul r1, r0, r1
- ldrb r0, [r4, #0x40]
+ ldrb r0, [r4, #0x40] // hurtType
add r0, r0, r1
mov r1, #0xc
mul r2, r0, r1
ldr r1, _080B2014 @ =gCollisionMtx
- add r3, r2, r1
+ add r3, r2, r1 // gCollisionMtx + 12 * (34 * hurtType + hurtType)
mov r1, #0
ldrb r0, [r3]
cmp r0, #0xff
@@ -742,29 +746,30 @@ _080B2270: .4byte gUpdateContext
_080B2274: .4byte gUnk_080026A4
_080B2278: .4byte gUpdateContext
+ // calculating knockback?
arm_func_start arm_sub_080B227C
arm_sub_080B227C: @ 0x080B227C
- push {r4, r5, r6, r7, r8, lr}
- ldr r2, [r0, #0x48]
+ push {r4-r8, lr}
+ ldr r2, [r0, #0x48] // tgt.hitbox
cmp r2, #0
- beq _080B236C
- ldr r3, [r1, #0x48]
+ beq ret_false
+ ldr r3, [r1, #0x48] // org.hitbox
cmp r3, #0
- beq _080B236C
+ beq ret_false
ldrh r4, [r1, #0x2e]
ldrsb r5, [r3]
add r4, r4, r5
ldrh r5, [r0, #0x2e]
sub r4, r4, r5
ldrsb r5, [r2]
- sub r4, r4, r5
+ sub r4, r4, r5 // temp = (tgt.x + tgt.hitbox.x) - (org.x + org.hitbox.x)
ldrb r5, [r2, #6]
ldrb r6, [r3, #6]
add r5, r5, r6
- add r6, r4, r5
+ add r6, r4, r5 // temp = temp + (tgt.hitbox.width + org.hitbox.width)
lsl r7, r5, #1
cmp r7, r6
- blo _080B236C
+ blo ret_false // not colliding
cmp r4, #0
movpl ip, #8
movmi ip, #0x18
@@ -783,7 +788,7 @@ arm_sub_080B227C: @ 0x080B227C
add r5, r4, r3
lsl r6, r3, #1
cmp r6, r5
- blo _080B236C
+ blo ret_false
cmp r4, #0
movpl r2, #0x10
movmi r2, #0
@@ -793,7 +798,7 @@ arm_sub_080B227C: @ 0x080B227C
movhs r7, r8
movhs r2, ip
cmp r7, #0
- beq _080B236C
+ beq ret_false
cmp r7, #5
movhs r7, #4
mov r0, r1
@@ -802,11 +807,11 @@ arm_sub_080B227C: @ 0x080B227C
mov lr, pc
bx r3
_080B2360:
- pop {r4, r5, r6, r7, r8, lr}
+ pop {r4-r8, lr}
mov r0, #1
bx lr
-_080B236C:
- pop {r4, r5, r6, r7, r8, lr}
+ret_false:
+ pop {r4-r8, lr}
mov r0, #0
bx lr
.align 2, 0
diff --git a/asm/src/script.s b/asm/src/script.s
index 4a607068..f1fc3cfd 100644
--- a/asm/src/script.s
+++ b/asm/src/script.s
@@ -106,7 +106,7 @@ _08016A64:
sub_08016A6C: @ 0x08016A6C
push {r4, r5, lr}
adds r4, r0, #0
- bl GetTileUnderEntity
+ bl GetActTile
add r1, pc, #0x38
_08016A76:
adds r1, #4
diff --git a/asm/src/veneer.s b/asm/src/veneer.s
index c3fc5da8..2d484627 100644
--- a/asm/src/veneer.s
+++ b/asm/src/veneer.s
@@ -107,7 +107,7 @@ _080001CC: .4byte gMapBottom+0x6004
thumb_func_start sub_080001D0
sub_080001D0: @ 0x080001D0
lsls r2, r2, #2
- ldr r3, _08000220 @ =gUnk_08000278
+ ldr r3, _08000220 @ =gUnkDataPtrs
ldr r3, [r3, r2]
strb r0, [r3, r1]
bx lr
@@ -135,37 +135,37 @@ _08000210: .4byte gUnk_080B7910
_08000214: .4byte gUnk_080B79A7
_08000218: .4byte gUnk_080B37A0
_0800021C: .4byte gUnk_080B3E80
-_08000220: .4byte gUnk_08000278
+_08000220: .4byte gUnkDataPtrs
_08000224: .4byte gUnk_08000228
gUnk_08000228::
- .4byte gMapBottom+0x0004
+ .4byte BOTTOM_TILEDATA
gUnk_0800022C::
- .4byte gMapBottom+0x5004
- .4byte gMapBottom+0x0004
- .4byte gMapBottom+0x5004
- .4byte gMapTop+0x0004
- .4byte gMapTop+0x5004
- .4byte gMapBottom+0x0004
- .4byte gMapBottom+0x5004
+ .4byte BOTTOM_METATILETYPES
+ .4byte BOTTOM_TILEDATA
+ .4byte BOTTOM_METATILETYPES
+ .4byte TOP_TILEDATA
+ .4byte TOP_METATILETYPES
+ .4byte BOTTOM_TILEDATA
+ .4byte BOTTOM_METATILETYPES
gUnk_08000248::
- .4byte gMapBottom+0x2004
- .4byte gMapBottom+0x2004
- .4byte gMapTop+0x2004
- .4byte gMapBottom+0x2004
+ .4byte BOTTOM_COLLISIONDATA
+ .4byte BOTTOM_COLLISIONDATA
+ .4byte TOP_COLLISIONDATA
+ .4byte BOTTOM_COLLISIONDATA
gUnk_08000258::
- .4byte gMapBottom+0x3004
- .4byte gMapBottom+0x5004
- .4byte gMapBottom+0x3004
- .4byte gMapBottom+0x5004
- .4byte gMapTop+0x3004
- .4byte gMapTop+0x5004
- .4byte gMapBottom+0x3004
- .4byte gMapBottom+0x5004
-gUnk_08000278::
- .4byte gMapBottom+0xb004
- .4byte gMapBottom+0xb004
- .4byte gMapTop+0xb004
- .4byte gMapBottom+0xb004
+ .4byte BOTTOM_TILEDATACLONE
+ .4byte BOTTOM_METATILETYPES
+ .4byte BOTTOM_TILEDATACLONE
+ .4byte BOTTOM_METATILETYPES
+ .4byte TOP_TILEDATACLONE
+ .4byte TOP_METATILETYPES
+ .4byte BOTTOM_TILEDATACLONE
+ .4byte BOTTOM_METATILETYPES
+gUnkDataPtrs::
+ .4byte BOTTOM_UNKDATA3
+ .4byte BOTTOM_UNKDATA3
+ .4byte TOP_UNKDATA3
+ .4byte BOTTOM_UNKDATA3
@ call 0x80B19CC
@ ========
@@ -277,9 +277,9 @@ GetRelativeCollisionTile: @ 0x080002B4
@ return:
@ ========
@ Called every frame a pot is thrown, every frame the screen is sliding in a transition, and once when entering stairs.
- thumb_func_start GetTileUnderEntity
-GetTileUnderEntity: @ 0x080002B8
- ldr r3, _08000324 @ =ram_GetTileUnderEntity
+ thumb_func_start GetActTile
+GetActTile: @ 0x080002B8
+ ldr r3, _08000324 @ =ram_GetActTile
bx r3
@ call 0x080B1AB4
@@ -362,8 +362,6 @@ sub_080B1B3C: @ 0x080002DC
bx r3
@ call 0x080B1B44
-@ ========
-@ Unused? Doesn't seem to be called by anything in Ghidra.
thumb_func_start sub_080B1B44
sub_080B1B44: @ 0x080002E0
ldr r3, _0800034C @ =ram_sub_080B1B44
@@ -413,7 +411,7 @@ _08000314: .4byte ram_sub_080B1A48
_08000318: .4byte ram_sub_080B1A58
_0800031C: .4byte ram_GetTileType
_08000320: .4byte ram_GetRelativeCollisionTile
-_08000324: .4byte ram_GetTileUnderEntity
+_08000324: .4byte ram_GetActTile
_08000328: .4byte ram_sub_080B1AB4
_0800032C: .4byte ram_sub_080B1AC8
_08000330: .4byte ram_sub_080B1AD8
diff --git a/include/asm.h b/include/asm.h
index 391ba768..bb768be3 100644
--- a/include/asm.h
+++ b/include/asm.h
@@ -20,11 +20,21 @@ extern void GenericKnockback(struct Entity_*);
extern u32 GetFuserId(struct Entity_*);
extern u32 CheckPlayerInRegion(u32 centerX, u32 centerY, u32 radiusX, u32 radiusY);
extern u32 GravityUpdate(struct Entity_* entity, u32 gravity);
+enum {
+ BOUNCE_DONE_ALL,
+ BOUNCE_INIT_NEXT,
+ BOUNCE_AIRBORNE,
+};
+u32 BounceUpdate(struct Entity_*, u32 acceleration);
extern u32 CheckOnScreen(struct Entity_*);
extern bool32 EntityInRectRadius(struct Entity_*, struct Entity_*, u32, u32);
extern void UpdateAnimationVariableFrames(struct Entity_*, u32);
extern u32 sub_080043E8(struct Entity_*);
-extern void sub_08004484(struct Entity_*, struct Entity_*);
+/**
+ * Basic collision, only used between player and dazed enemies.
+ * (Probablity leftover from Four Swords)
+ */
+extern void CalcCollisionStaticEntity(struct Entity_*, struct Entity_*);
extern void ResetCollisionLayer(struct Entity_*);
extern void sub_08004596(struct Entity_*, u32);
extern u32 sub_080045B4(struct Entity_*, u32, u32);
@@ -41,7 +51,7 @@ extern u32 sub_080B1B44(u32, u32);
extern u32 sub_080B1A48(u32, u32, u32);
extern u32 sub_080B1B18(s32, s32, u32);
extern u32 sub_080B1AE0(u16, u8);
-extern u32 GetTileUnderEntity(struct Entity_*);
+extern u32 GetActTile(struct Entity_*);
extern u32 sub_0800445C(struct Entity_*);
extern u32 sub_080B1AF0(struct Entity_*, s32, s32);
extern u32 GetRelativeCollisionTile(struct Entity_*, u32, u32);
diff --git a/include/common.h b/include/common.h
index 871e5f05..c9200c98 100644
--- a/include/common.h
+++ b/include/common.h
@@ -11,9 +11,9 @@ struct Entity_;
typedef struct {
u16 heldKeys; /**< Keys held since last frame. */
u16 newKeys; /** Keys newly pressed this frame. */
- u16 unk4;
+ u16 menuScrollKeys;
u8 unk6;
- u8 unk7;
+ u8 menuScrollTimer;
} Input;
extern Input gInput; /**< Input instance. */
diff --git a/include/enemy.h b/include/enemy.h
index bc9f842b..d9bc0a76 100644
--- a/include/enemy.h
+++ b/include/enemy.h
@@ -43,7 +43,7 @@ bool32 sub_08049F84(Entity*, s32);
Entity* sub_08049DF4(u32);
u32 sub_0804A044(Entity*, Entity*, u32);
s32 sub_080012DC(Entity*);
-u32 sub_080044EC(Entity*, u32);
+
void sub_0804AA1C(Entity*);
bool32 sub_08049F1C(Entity*, Entity*, s32);
bool32 PlayerInRange(Entity*, u32, s32);
diff --git a/include/functions.h b/include/functions.h
index 49fb3f31..1caeb76d 100644
--- a/include/functions.h
+++ b/include/functions.h
@@ -69,7 +69,7 @@ extern void sub_080042D0(Entity*, u32, u16);
extern void sub_080043A8(Entity*);
extern u32 sub_0800445C(Entity*);
extern void sub_080044AE(Entity*, u32, u32);
-extern u32 sub_080044EC(Entity*, u32);
+extern u32 BounceUpdate(Entity*, u32);
extern void sub_0800451C(Entity*);
extern void sub_08004542(Entity*);
extern void sub_080085B0(Entity*);
diff --git a/include/message.h b/include/message.h
index 32f9f582..b25e9df5 100644
--- a/include/message.h
+++ b/include/message.h
@@ -18,11 +18,11 @@ typedef struct {
u8 textWindowPosY;
u16 textIndex;
u16 unk2; // HI?
- u32 field_0xc;
- u32 rupees;
- u32 field_0x14;
- u32 field_0x18;
- u32 field_0x1c;
+ u32 flags;
+ u32 rupees; // item price, shells, minigame timer
+ u32 field_0x14; // number of cuccos
+ u32 field_0x18; // unused
+ u32 field_0x1c; // unused
} Message;
extern Message gMessage;
diff --git a/linker.ld b/linker.ld
index 18f9d27d..1774c36d 100644
--- a/linker.ld
+++ b/linker.ld
@@ -170,7 +170,7 @@ SECTIONS {
. = 0x000057CC; ram_sub_080B1A58 = .;
. = 0x000057D4; ram_GetTileType = .;
. = 0x00005800; ram_GetRelativeCollisionTile = .;
- . = 0x0000581C; ram_GetTileUnderEntity = .;
+ . = 0x0000581C; ram_GetActTile = .;
. = 0x00005828; ram_sub_080B1AB4 = .;
. = 0x0000583C; ram_sub_080B1AC8 = .;
. = 0x0000584C; ram_sub_080B1AD8 = .;
diff --git a/src/collision.c b/src/collision.c
index ea0d5db9..6ec7f5f3 100644
--- a/src/collision.c
+++ b/src/collision.c
@@ -580,7 +580,7 @@ CollisionResult sub_08017F40(Entity* org, Entity* tgt, u32 direction, ColSetting
org->health = 0;
}
} else if (tgt->kind == ENEMY && org == &gPlayerEntity.base) {
- sub_08004484(tgt, org);
+ CalcCollisionStaticEntity(tgt, org);
}
return RESULT_NO_COLLISION;
}
@@ -670,14 +670,14 @@ CollisionResult sub_08018168(Entity* org, Entity* tgt, u32 direction, ColSetting
org->health = 0;
}
} else if ((tgt->kind == ENEMY) && (org == &gPlayerEntity.base)) {
- sub_08004484(tgt, &gPlayerEntity.base);
+ CalcCollisionStaticEntity(tgt, &gPlayerEntity.base);
}
return RESULT_NO_COLLISION;
}
CollisionResult sub_08018228(Entity* org, Entity* tgt, u32 direction, ColSettings* settings) {
if (org == &gPlayerEntity.base && PlayerCanBeMoved())
- sub_08004484(tgt, org);
+ CalcCollisionStaticEntity(tgt, org);
return RESULT_NO_COLLISION;
}
@@ -716,7 +716,7 @@ CollisionResult sub_080182A8(Entity* org, Entity* tgt, u32 direction, ColSetting
CollisionResult CollisionDefault(Entity* org, Entity* tgt, u32 direction, ColSettings* settings) {
u32 confused = 0;
if (tgt->confusedTime && tgt->kind == ENEMY && org == &gPlayerEntity.base) {
- sub_08004484(tgt, org);
+ CalcCollisionStaticEntity(tgt, org);
confused = 1;
}
if ((org->kind == PLAYER_ITEM && org->id == PL_ITEM_SHIELD) &&
diff --git a/src/common.c b/src/common.c
index 10e200c0..83d194ca 100644
--- a/src/common.c
+++ b/src/common.c
@@ -216,15 +216,15 @@ static void StoreKeyInput(Input* input, u32 keyInput) {
u32 difference = keyInput & ~heldKeys;
input->newKeys = difference;
if (keyInput == heldKeys) {
- if (--input->unk7 == 0) {
- input->unk7 = 4;
- input->unk4 = keyInput;
+ if (--input->menuScrollTimer == 0) {
+ input->menuScrollTimer = 4;
+ input->menuScrollKeys = keyInput;
} else {
- input->unk4 = 0;
+ input->menuScrollKeys = 0;
}
} else {
- input->unk7 = 20;
- input->unk4 = difference;
+ input->menuScrollTimer = 20;
+ input->menuScrollKeys = difference;
}
input->heldKeys = keyInput;
}
diff --git a/src/debug.c b/src/debug.c
index 399dcf71..6edbf3ee 100644
--- a/src/debug.c
+++ b/src/debug.c
@@ -73,7 +73,7 @@ void sub_0805FA98(void) {
MessageInitialize();
break;
default:
- switch (gInput.unk4) {
+ switch (gInput.menuScrollKeys) {
case DPAD_LEFT:
iVar1 = -1;
break;
diff --git a/src/enemy/acroBandits.c b/src/enemy/acroBandits.c
index 1e5d3057..84963d1f 100644
--- a/src/enemy/acroBandits.c
+++ b/src/enemy/acroBandits.c
@@ -528,7 +528,7 @@ void AcroBandit_Type1Action6(AcroBanditEntity* this) {
void AcroBandit_Type1Action7(AcroBanditEntity* this) {
ProcessMovement2(super);
- if (sub_080044EC(super, 0x2000) == 0)
+ if (BounceUpdate(super, Q_8_8(32.0)) == BOUNCE_DONE_ALL)
super->action = 8;
}
diff --git a/src/enemy/beetle.c b/src/enemy/beetle.c
index 6b83d6dc..d6b4d9f8 100644
--- a/src/enemy/beetle.c
+++ b/src/enemy/beetle.c
@@ -120,7 +120,7 @@ void sub_080218CC(BeetleEntity* this) {
GetNextFrame(super);
if (super->frame & 1) {
ProcessMovement2(super);
- if (sub_080044EC(super, 0x1c00) == 0)
+ if (BounceUpdate(super, Q_8_8(28.0)) == BOUNCE_DONE_ALL)
super->frameDuration = 1;
}
diff --git a/src/enemy/bobomb.c b/src/enemy/bobomb.c
index 5c15c015..f007f779 100644
--- a/src/enemy/bobomb.c
+++ b/src/enemy/bobomb.c
@@ -250,7 +250,7 @@ void sub_0802CAF8(BobombEntity* this) {
if (--super->timer == 0) {
sub_0802CBC4(this);
} else {
- if (this->unk_81 && sub_080044EC(super, 0x2800) == 1) {
+ if (this->unk_81 && BounceUpdate(super, Q_8_8(40.0)) == BOUNCE_INIT_NEXT) {
EnqueueSFX(SFX_PLACE_OBJ);
}
sub_0802CC18(this);
diff --git a/src/enemy/bombPeahat.c b/src/enemy/bombPeahat.c
index d0fd3a22..44ea5007 100644
--- a/src/enemy/bombPeahat.c
+++ b/src/enemy/bombPeahat.c
@@ -474,7 +474,7 @@ void sub_0802AEBC(BombPeahatEntity* this) {
void sub_0802AED4(BombPeahatEntity* this) {
GetNextFrame(super);
if (this->unk_81 < 2) {
- if (sub_080044EC(super, 0x2800) == 1) {
+ if (BounceUpdate(super, Q_8_8(40.0)) == BOUNCE_INIT_NEXT) {
this->unk_81++;
}
} else {
@@ -673,7 +673,7 @@ void sub_0802B1BC(BombPeahatEntity* this) {
#endif
void sub_0802B204(BombPeahatEntity* this) {
- if (sub_080044EC(super, 0x2800) == 1) {
+ if (BounceUpdate(super, Q_8_8(40.0)) == BOUNCE_INIT_NEXT) {
Entity* entity = CreateEnemy(BOBOMB, 1);
if (entity != NULL) {
CopyPosition(super, entity);
diff --git a/src/enemy/chuchu.c b/src/enemy/chuchu.c
index c7ca7b94..8e72398d 100644
--- a/src/enemy/chuchu.c
+++ b/src/enemy/chuchu.c
@@ -715,7 +715,7 @@ void sub_0801FB68(ChuchuEntity* this) {
}
u32 sub_0801FBD0(ChuchuEntity* this) {
- if (GetTileUnderEntity(super) == 0x10) {
+ if (GetActTile(super) == 0x10) {
return 1;
} else {
return 0;
diff --git a/src/enemy/cloudPiranha.c b/src/enemy/cloudPiranha.c
index 7f8f85c4..dbe78f28 100644
--- a/src/enemy/cloudPiranha.c
+++ b/src/enemy/cloudPiranha.c
@@ -175,7 +175,7 @@ void CloudPiranha_Action3(CloudPiranhaEntity* this) {
void CloudPiranha_Action4(CloudPiranhaEntity* this) {
Entity* effect;
sub_080387F0(this);
- if (sub_080044EC(super, 0x1800) == 1) {
+ if (BounceUpdate(super, Q_8_8(24.0)) == BOUNCE_INIT_NEXT) {
super->action = 1;
super->hitType = 0x72;
super->timer = 1;
diff --git a/src/enemy/cuccoAggr.c b/src/enemy/cuccoAggr.c
index 03a158ea..45c7f863 100644
--- a/src/enemy/cuccoAggr.c
+++ b/src/enemy/cuccoAggr.c
@@ -176,7 +176,7 @@ void sub_08038F44(CuccoAggrEntity* this) {
super->direction = GetFacingDirection(&gPlayerEntity.base, super);
sub_080390F8(this);
ProcessMovement0(super);
- sub_080044EC(super, 0x1800);
+ BounceUpdate(super, Q_8_8(24.0));
GetNextFrame(super);
sub_08039298(this);
if (--this->unk_78 == 0) {
diff --git a/src/enemy/fallingBoulder.c b/src/enemy/fallingBoulder.c
index e898c1b7..13421100 100644
--- a/src/enemy/fallingBoulder.c
+++ b/src/enemy/fallingBoulder.c
@@ -93,7 +93,7 @@ void sub_0802C334(FallingBoulderEntity* this) {
GetNextFrame(super);
this->unk_7e = COORD_TO_TILE(super);
- if (sub_080044EC(super, this->unk_84) == 1) {
+ if (BounceUpdate(super, this->unk_84) == BOUNCE_INIT_NEXT) {
EnqueueSFX(0x14c);
COLLISION_ON(super);
this->unk_7a = 12;
diff --git a/src/enemy/helmasaur.c b/src/enemy/helmasaur.c
index 9f970a08..e1cb2a51 100644
--- a/src/enemy/helmasaur.c
+++ b/src/enemy/helmasaur.c
@@ -224,7 +224,7 @@ void sub_0802BEBC(HelmasaurEntity* this) {
super->direction ^= DirectionSouth;
ProcessMovement2(super);
super->direction ^= DirectionSouth;
- if (!sub_080044EC(super, Q_16_16(0.125))) {
+ if (BounceUpdate(super, Q_16_16(0.125)) == BOUNCE_DONE_ALL) {
sub_0802C1C0(this);
}
}
diff --git a/src/enemy/peahat.c b/src/enemy/peahat.c
index fee43028..eeae83f8 100644
--- a/src/enemy/peahat.c
+++ b/src/enemy/peahat.c
@@ -240,7 +240,7 @@ void Peahat_ChargeEnd(PeahatEntity* this) {
void Peahat_Stunned(PeahatEntity* this) {
switch (super->animationState) {
default:
- if (sub_080044EC(super, 0x1800) == 0) {
+ if (BounceUpdate(super, Q_8_8(24.0)) == BOUNCE_DONE_ALL) {
super->action = 6;
super->timer = 240;
super->subtimer = 10;
diff --git a/src/enemy/rollobite.c b/src/enemy/rollobite.c
index 62f6e2d6..7d297f8d 100644
--- a/src/enemy/rollobite.c
+++ b/src/enemy/rollobite.c
@@ -187,16 +187,16 @@ void Rollobite_RolledUp(RollobiteEntity* this) {
if ((super->frame & ANIM_DONE) == 0)
GetNextFrame(super);
- unk = sub_080044EC(super, 0x2800);
+ unk = BounceUpdate(super, Q_8_8(40.0));
- if (unk == 0) {
+ if (unk == BOUNCE_DONE_ALL) {
if (--super->timer == 0) {
super->action = 5;
InitializeAnimation(super, super->animationState + 12);
}
RegisterCarryEntity(super);
} else {
- if (unk == 1)
+ if (unk == BOUNCE_INIT_NEXT)
EnqueueSFX(SFX_PLACE_OBJ);
if (!(super->direction & DIR_NOT_MOVING_CHECK))
diff --git a/src/enemy/rope.c b/src/enemy/rope.c
index e8bcbc41..79fa291b 100644
--- a/src/enemy/rope.c
+++ b/src/enemy/rope.c
@@ -208,7 +208,7 @@ void sub_08031600(RopeEntity* this) {
u32 sub_0803163C(RopeEntity* this) {
u32 h;
- if (GetTileUnderEntity(super) == 0x13) {
+ if (GetActTile(super) == 0x13) {
h = this->unk_7a / 2;
} else {
h = this->unk_7a;
diff --git a/src/enemy/spikedBeetle.c b/src/enemy/spikedBeetle.c
index 92406dda..3a282359 100644
--- a/src/enemy/spikedBeetle.c
+++ b/src/enemy/spikedBeetle.c
@@ -152,12 +152,12 @@ void sub_0802B880(Entity* this) {
void sub_0802B8B0(Entity* this) {
ProcessMovement2(this);
- switch (sub_080044EC(this, 0x1800)) {
- case 0:
+ switch (BounceUpdate(this, Q_8_8(24.0))) {
+ case BOUNCE_DONE_ALL:
this->action = 7;
this->timer = 150;
/* fallthrough */
- case 1:
+ case BOUNCE_INIT_NEXT:
EnqueueSFX(SFX_12B);
break;
}
diff --git a/src/enemy/tektite.c b/src/enemy/tektite.c
index 81573437..7423bc40 100644
--- a/src/enemy/tektite.c
+++ b/src/enemy/tektite.c
@@ -147,7 +147,7 @@ void sub_0802F300(TektiteEntity* this) {
temp = super->z.HALF.HI;
rand = Random() & 0xf;
- if (sub_080044EC(super, this->unk_80) == 1) {
+ if (BounceUpdate(super, this->unk_80) == BOUNCE_INIT_NEXT) {
super->action = 3;
super->subAction = 0;
if (super->type != 0) {
@@ -164,7 +164,7 @@ void sub_0802F300(TektiteEntity* this) {
return;
} else if (super->collisions != COL_NONE) {
sub_0800417E(super, super->collisions);
- } else if ((GetTileUnderEntity(super) & 0xf0) == 0x50) {
+ } else if ((GetActTile(super) & 0xf0) == 0x50) {
super->direction = (super->direction + 0x10) & (0x3 | DirectionNorthWest);
}
diff --git a/src/enemy/tektiteGolden.c b/src/enemy/tektiteGolden.c
index d92dfdee..140658b7 100644
--- a/src/enemy/tektiteGolden.c
+++ b/src/enemy/tektiteGolden.c
@@ -129,7 +129,7 @@ void sub_08038048(TektiteGoldenEntity* this) {
temp = super->z.HALF.HI;
rand = Random() & 0xf;
- if (sub_080044EC(super, 0x3000) == 1) {
+ if (BounceUpdate(super, Q_8_8(48.0)) == BOUNCE_INIT_NEXT) {
super->action = 3;
super->subAction = 0;
super->timer = 20;
@@ -137,7 +137,7 @@ void sub_08038048(TektiteGoldenEntity* this) {
return;
} else if (super->collisions != COL_NONE) {
sub_0800417E(super, super->collisions);
- } else if ((GetTileUnderEntity(super) & 0xf0) == 0x50) {
+ } else if ((GetActTile(super) & 0xf0) == 0x50) {
super->direction = (super->direction + 0x10) & (0x3 | DirectionNorthWest);
}
diff --git a/src/enemy/vaatiTransfigured.c b/src/enemy/vaatiTransfigured.c
index 265b5a98..56ca8a39 100644
--- a/src/enemy/vaatiTransfigured.c
+++ b/src/enemy/vaatiTransfigured.c
@@ -288,7 +288,7 @@ void VaatiTransfiguredType0Action3(VaatiTransfiguredEntity* this) {
switch (this->unk_80) {
case 0:
- uVar4 = sub_080044EC(super, 0x2800);
+ uVar4 = BounceUpdate(super, Q_8_8(40.0));
if (uVar4 != 1)
break;
this->unk_80 = 1;
diff --git a/src/fileselect.c b/src/fileselect.c
index 7e4d9108..cf275fe1 100644
--- a/src/fileselect.c
+++ b/src/fileselect.c
@@ -1145,7 +1145,7 @@ void sub_080610B8(void) {
default:
uVar6 = 0;
tmp4 = 0;
- switch (gInput.unk4) {
+ switch (gInput.menuScrollKeys) {
case DPAD_UP:
tmp4 = -1;
break;
diff --git a/src/manager/enemyInteractionManager.c b/src/manager/enemyInteractionManager.c
index 0c8428d7..cd393b31 100644
--- a/src/manager/enemyInteractionManager.c
+++ b/src/manager/enemyInteractionManager.c
@@ -66,14 +66,14 @@ void EnemyInteractionManager_Action1(EnemyInteractionManager* this) {
for (i = 0; i < n; i++) {
tmp = this->d.enemies[i];
for (j = i + 1; j < super->timer; j++) {
- sub_08004484(tmp, this->d.enemies[j]);
+ CalcCollisionStaticEntity(tmp, this->d.enemies[j]);
}
}
} else {
for (i = 0; i < n; i++) {
tmp = this->d.enemies[i];
for (j = i + 1; j < super->timer; j++) {
- sub_08004484(this->d.enemies[j], tmp);
+ CalcCollisionStaticEntity(this->d.enemies[j], tmp);
}
}
}
diff --git a/src/menu/figurineMenu.c b/src/menu/figurineMenu.c
index f8732c15..f76389fd 100644
--- a/src/menu/figurineMenu.c
+++ b/src/menu/figurineMenu.c
@@ -180,7 +180,7 @@ void FigurineMenu0_ViewFigurineAfterDrawing(void) {
s32 t;
infoY = gFigurineMenu.unk1f;
- switch (gInput.unk4) {
+ switch (gInput.menuScrollKeys) {
case B_BUTTON:
case START_BUTTON:
FigurineMenu_ExitMenu();
@@ -219,7 +219,7 @@ void FigurineMenu1_ViewAllFigurines(void) {
infoY = gFigurineMenu.unk1f;
figurineIndex = gFigurineMenu.figure_idx;
- switch (gInput.unk4) {
+ switch (gInput.menuScrollKeys) {
case B_BUTTON:
case START_BUTTON:
SetMenuType(3);
diff --git a/src/menu/kinstoneMenu.c b/src/menu/kinstoneMenu.c
index cfc0473a..446cd71c 100644
--- a/src/menu/kinstoneMenu.c
+++ b/src/menu/kinstoneMenu.c
@@ -194,7 +194,7 @@ void KinstoneMenu_Type1(void) {
return;
}
tmp3 = menu->unk28;
- switch (gInput.unk4) {
+ switch (gInput.menuScrollKeys) {
case DPAD_LEFT:
case DPAD_UP:
tmp3--;
diff --git a/src/menu/pauseMenu.c b/src/menu/pauseMenu.c
index 6b1d0cef..ab90f23b 100644
--- a/src/menu/pauseMenu.c
+++ b/src/menu/pauseMenu.c
@@ -404,7 +404,7 @@ void PauseMenu_ItemMenu_Update(void) {
}
break;
default:
- switch (gInput.unk4) {
+ switch (gInput.menuScrollKeys) {
case DPAD_UP:
menuSlot = entry->up;
break;
@@ -710,7 +710,7 @@ void sub_080A56A0(void) {
gMenu.field_0xc = gUnk_08128C00;
ptr = &gUnk_08128C14[gMenu.field_0x3];
uVar2 = 0xff;
- switch (gInput.unk4) {
+ switch (gInput.menuScrollKeys) {
case DPAD_UP:
uVar2 = ptr->unk0;
break;
diff --git a/src/message.c b/src/message.c
index 87d6e461..08bad90c 100644
--- a/src/message.c
+++ b/src/message.c
@@ -408,7 +408,7 @@ u16 RunTextCommand(TextRender* this) {
gMessage.unk = this->curToken.param;
break;
case 6:
- ptr = &gMessage.field_0xc;
+ ptr = &gMessage.flags;
tmp3 = this->curToken.param;
tmp3 &= 0x1f;
WriteBit(ptr, tmp3);
diff --git a/src/npc/phonograph.c b/src/npc/phonograph.c
index ca74c820..f10677d2 100644
--- a/src/npc/phonograph.c
+++ b/src/npc/phonograph.c
@@ -61,10 +61,10 @@ void sub_0806E964(PhonographEntity* this, ScriptExecutionContext* context) {
sub_0806EABC(this);
}
- if (gInput.unk4 & (DPAD_UP | DPAD_DOWN)) {
+ if (gInput.menuScrollKeys & (DPAD_UP | DPAD_DOWN)) {
s32 val2, val3;
s32 val = this->unk_68;
- if (gInput.unk4 & DPAD_UP) {
+ if (gInput.menuScrollKeys & DPAD_UP) {
val++;
} else {
val--;
@@ -147,8 +147,8 @@ void sub_0806E964(PhonographEntity* this, ScriptExecutionContext* context) {
if (val > val2) {
val = 1;
}
- } else if (gInput.unk4 & (DPAD_UP | DPAD_DOWN)) {
- if (gInput.unk4 & DPAD_UP) {
+ } else if (gInput.menuScrollKeys & (DPAD_UP | DPAD_DOWN)) {
+ if (gInput.menuScrollKeys & DPAD_UP) {
val++;
} else {
val--;
diff --git a/src/npcUtils.c b/src/npcUtils.c
index 3d0323c3..6866991c 100644
--- a/src/npcUtils.c
+++ b/src/npcUtils.c
@@ -321,7 +321,7 @@ void CollideFollowers(void) {
continue;
if ((nextEnt->followerFlag & 1) == 0)
continue;
- sub_08004484(currentEntity, nextEnt);
+ CalcCollisionStaticEntity(currentEntity, nextEnt);
}
}
}
diff --git a/src/object/bird.c b/src/object/bird.c
index bbd382ff..3f1bca18 100644
--- a/src/object/bird.c
+++ b/src/object/bird.c
@@ -131,7 +131,7 @@ void Bird_Type1_Action1_Subaction0(BirdEntity* this) {
void Bird_Type1_Action1_Subaction1(BirdEntity* this) {
Entity* fx;
- if (sub_080044EC(super, 0x1800) < 2) {
+ if (BounceUpdate(super, Q_8_8(24.0)) < BOUNCE_AIRBORNE) {
super->type = 2;
super->action = 1;
super->z.WORD = 0;
diff --git a/src/object/book.c b/src/object/book.c
index 6a516500..a031da2d 100644
--- a/src/object/book.c
+++ b/src/object/book.c
@@ -138,7 +138,7 @@ void Book_Action2(BookEntity* this) {
void Book_Action3(BookEntity* this) {
Entity* fx;
- if (sub_080044EC(super, 0x2800) != 1) {
+ if (BounceUpdate(super, Q_8_8(40.0)) != BOUNCE_INIT_NEXT) {
return;
}
diff --git a/src/object/crenelBeanSprout.c b/src/object/crenelBeanSprout.c
index 384722b2..3621f300 100644
--- a/src/object/crenelBeanSprout.c
+++ b/src/object/crenelBeanSprout.c
@@ -174,7 +174,7 @@ void CrenelBeanSprout_Action1(CrenelBeanSproutEntity* this) {
gUnk_0200AF00.rActionPlayerState = R_ACTION_NONE;
}
PositionRelative(&gPlayerEntity.base, super, 0, 0x10000);
- if (GetTileUnderEntity(super) == 0x19) {
+ if (GetActTile(super) == 0x19) {
RestorePrevTileEntity(0xdc, super->collisionLayer);
sub_08096A78(this);
}
diff --git a/src/object/cutsceneMiscObject.c b/src/object/cutsceneMiscObject.c
index 68f86a77..c2320d91 100644
--- a/src/object/cutsceneMiscObject.c
+++ b/src/object/cutsceneMiscObject.c
@@ -331,7 +331,7 @@ void CutsceneMiscObject_Type5(CutsceneMiscObjectEntity* this) {
super->zVelocity = 0;
SetEntityPriority(super, PRIO_PLAYER_EVENT);
InitializeAnimation(super, 0);
- if (GetTileUnderEntity(super) == 13) {
+ if (GetActTile(super) == 13) {
super->action = 3;
}
break;
@@ -550,7 +550,7 @@ void CutsceneMiscObject_Type11(CutsceneMiscObjectEntity* this) {
InitAnimationForceUpdate(super, 0);
}
if (super->subAction != 0) {
- if ((u32)sub_080044EC(super, 0x1800) <= 1) {
+ if ((u32)BounceUpdate(super, Q_8_8(24.0)) <= BOUNCE_INIT_NEXT) {
super->subAction = 0;
SetAffineInfo(super, 0x100, 0x100, 0xC000);
} else {
diff --git a/src/object/figurineDevice.c b/src/object/figurineDevice.c
index 8572dc38..d975556a 100644
--- a/src/object/figurineDevice.c
+++ b/src/object/figurineDevice.c
@@ -259,9 +259,9 @@ void FigurineDevice_Action4(FigurineDeviceEntity* this) {
tmp = 1;
}
#ifdef JP
- switch (gInput.unk4) {
+ switch (gInput.menuScrollKeys) {
#else
- switch (gInput.unk4 & 0xfffffeff) {
+ switch (gInput.menuScrollKeys & ~R_BUTTON) {
#endif
case DPAD_UP:
FigurineDevice_ChangeShellAmount(this, tmp);
@@ -274,7 +274,7 @@ void FigurineDevice_Action4(FigurineDeviceEntity* this) {
sub_080882A8(this);
}
#else
- switch (gInput.unk4) {
+ switch (gInput.menuScrollKeys) {
case DPAD_UP:
FigurineDevice_ChangeShellAmount(this, 1);
break;
diff --git a/src/object/graveyardKey.c b/src/object/graveyardKey.c
index 699bb95a..577d4b09 100644
--- a/src/object/graveyardKey.c
+++ b/src/object/graveyardKey.c
@@ -124,7 +124,7 @@ void GraveyardKey_Action2(Entity* this, const struct_gUnk_08123FB0* param_2) {
u8 type;
LinearMoveUpdate(this);
- if (sub_080044EC(this, param_2->unk14) < 2) {
+ if (BounceUpdate(this, param_2->unk14) < BOUNCE_AIRBORNE) {
if (this->timer) {
this->timer--;
this->zVelocity = param_2->unk14 << 3;
diff --git a/src/object/itemOnGround.c b/src/object/itemOnGround.c
index 3a755c87..dc9d0975 100644
--- a/src/object/itemOnGround.c
+++ b/src/object/itemOnGround.c
@@ -436,7 +436,7 @@ u32 sub_080814C0(ItemOnGroundEntity* this) {
void sub_08081500(ItemOnGroundEntity* this) {
if (this->unk_68 == 0) {
- u32 var0 = sub_080044EC(super, 0x2800);
+ u32 var0 = BounceUpdate(super, Q_8_8(40.0));
if (var0 == 0) {
this->unk_68 = 1;
} else {
diff --git a/src/object/keyStealingTakkuri.c b/src/object/keyStealingTakkuri.c
index c5a8bdf3..2f67e69f 100644
--- a/src/object/keyStealingTakkuri.c
+++ b/src/object/keyStealingTakkuri.c
@@ -163,7 +163,7 @@ void KeyStealingTakkuri_Type5_Init(KeyStealingTakkuriEntity* this) {
void KeyStealingTakkuri_Type5_Action1(KeyStealingTakkuriEntity* this) {
LinearMoveUpdate(super);
- if (sub_080044EC(super, 0x2000) < 2) {
+ if (BounceUpdate(super, Q_8_8(32.0)) < BOUNCE_AIRBORNE) {
if (super->timer != 0) {
super->timer--;
super->zVelocity = Q_16_16(1.0);
diff --git a/src/object/lilypadLarge.c b/src/object/lilypadLarge.c
index 7a09ee3a..9bc15399 100644
--- a/src/object/lilypadLarge.c
+++ b/src/object/lilypadLarge.c
@@ -386,7 +386,7 @@ void sub_08085B40(LilypadLargeEntity* this) {
}
} else {
ResetCollisionLayer(super);
- if (GetTileUnderEntity(super) == 0xd) {
+ if (GetActTile(super) == 0xd) {
ResetCollisionLayer(&gPlayerEntity.base);
LilypadLarge_Action4(this);
super->direction = GetFacingDirection(&gPlayerEntity.base, super);
@@ -408,7 +408,7 @@ void sub_08085B40(LilypadLargeEntity* this) {
super->timer |= 0x80;
this->unk_70 = 0;
this->unk_6c = 0;
- if (GetTileUnderEntity(super) == 0xd) {
+ if (GetActTile(super) == 0xd) {
super->action = 4;
}
}
diff --git a/src/object/mask.c b/src/object/mask.c
index 5fd949ef..46cfdb9e 100644
--- a/src/object/mask.c
+++ b/src/object/mask.c
@@ -129,7 +129,7 @@ void Mask_Action2(MaskEntity* this) {
CreateRandomItemDrop(super, 3);
} else {
- sub_080044EC(super, this->unk_78);
+ BounceUpdate(super, this->unk_78);
if (super->z.HALF.HI == 0) {
super->timer++;
diff --git a/src/object/minecart.c b/src/object/minecart.c
index 67d52465..ee523716 100644
--- a/src/object/minecart.c
+++ b/src/object/minecart.c
@@ -199,7 +199,7 @@ void Minecart_Action3(MinecartEntity* this) {
case 0x6d:
case 0x6e:
case 0x6f:
- if (uVar3 == GetTileUnderEntity(super)) {
+ if (uVar3 == GetActTile(super)) {
Minecart_Action4(this);
gPlayerEntity.base.animationState = super->animationState << 1;
return;
@@ -221,7 +221,7 @@ void Minecart_Action3(MinecartEntity* this) {
void Minecart_Action4(MinecartEntity* this) {
sub_08004168(super);
CopyPosition(super, &gPlayerEntity.base);
- switch (GetTileUnderEntity(super)) {
+ switch (GetActTile(super)) {
case 0x67:
if (super->direction == DirectionWest) {
super->direction = DirectionNorth;
diff --git a/src/object/objectA2.c b/src/object/objectA2.c
index 5aca031b..0617ce3e 100644
--- a/src/object/objectA2.c
+++ b/src/object/objectA2.c
@@ -51,7 +51,7 @@ void ObjectA2_Action1(Entity* this) {
LinearMoveUpdate(this);
#ifndef EU
if (gSaveHeader->language < 2) {
- if (sub_080044EC(this, 0x2000) < 2) {
+ if (BounceUpdate(this, Q_8_8(32.0)) < BOUNCE_AIRBORNE) {
this->z.WORD = 0;
this->action = 2;
InitializeAnimation(this, 1);
@@ -61,15 +61,15 @@ void ObjectA2_Action1(Entity* this) {
}
} else {
#endif
- switch (sub_080044EC(this, 0x2000)) {
+ switch (BounceUpdate(this, Q_8_8(32.0))) {
default:
this->timer++;
break;
- case 0:
+ case BOUNCE_DONE_ALL:
this->action = 2;
InitializeAnimation(this, 1);
// fall through
- case 1:
+ case BOUNCE_INIT_NEXT:
this->timer = 0;
sub_0809F448(this);
SoundReq(SFX_186);
diff --git a/src/object/objectOnPillar.c b/src/object/objectOnPillar.c
index 7815dd74..98501c8e 100644
--- a/src/object/objectOnPillar.c
+++ b/src/object/objectOnPillar.c
@@ -208,7 +208,7 @@ void sub_080970F4(ObjectOnPillarEntity* this) {
bool32 sub_08097144(ObjectOnPillarEntity* this) {
LinearMoveUpdate(super);
sub_0800445C(super);
- if (GetTileUnderEntity(super) == 0x19) {
+ if (GetActTile(super) == 0x19) {
super->spriteOffsetY = 2;
}
if ((--this->unk_76 == 0) && sub_08097194(this) == FALSE) {
diff --git a/src/object/playerClone.c b/src/object/playerClone.c
index 36c4dd8b..a5e8bed4 100644
--- a/src/object/playerClone.c
+++ b/src/object/playerClone.c
@@ -109,7 +109,7 @@ void PlayerClone_Action2(PlayerCloneEntity* this) {
if (gPlayerEntity.base.iframes >= 1) {
gPlayerState.chargeState.action = 1;
} else {
- GetTileUnderEntity(super);
+ GetActTile(super);
sub_08084B1C(this);
super->x.HALF.HI = gPlayerEntity.base.x.HALF.HI + this->unk78;
super->y.HALF.HI = gPlayerEntity.base.y.HALF.HI + this->unk7a;
diff --git a/src/object/pot.c b/src/object/pot.c
index 388b35cc..0575dc87 100644
--- a/src/object/pot.c
+++ b/src/object/pot.c
@@ -25,7 +25,7 @@ typedef struct {
} PotEntity;
void Pot_Action5(PotEntity*);
-static void sub_08082850(PotEntity*, Entity*);
+static void BreakPot(PotEntity*, Entity*);
void sub_08082608(PotEntity* this);
void Pot_Init(PotEntity* this);
void Pot_Action1(PotEntity* this);
@@ -128,13 +128,13 @@ void Pot_Action1(PotEntity* this) {
DeleteThisEntity();
break;
default:
- if (GetTileUnderEntity(super) == 13) {
+ if (GetActTile(super) == 13) {
CreateFx(super, FX_FALL_DOWN, 0);
} else if (tileType == 0x4005) {
gPlayerState.lastSwordMove = SWORD_MOVE_BREAK_POT;
SetTile((u16)this->unk_70, COORD_TO_TILE(super), super->collisionLayer);
}
- sub_08082850(this, NULL);
+ BreakPot(this, NULL);
break;
}
} else {
@@ -181,7 +181,7 @@ void sub_0808259C(PotEntity* this) {
CreateFx(super, FX_LAVA_SPLASH, 0);
break;
default:
- sub_08082850(this, &gPlayerEntity.base);
+ BreakPot(this, &gPlayerEntity.base);
return;
}
@@ -227,7 +227,7 @@ void Pot_Action4(PotEntity* this) {
switch (tileType) {
case 0x71:
case 0x72:
- sub_08082850(this, NULL);
+ BreakPot(this, NULL);
break;
default:
SetTile(0x4000, COORD_TO_TILE(super), super->collisionLayer);
@@ -268,7 +268,7 @@ void sub_08082778(PotEntity* this) {
}
if ((gPlayerState.field_0x1c & 0xF) != 0x1 || (super->contactFlags & 0x7F) != 0x13) {
- sub_08082850(this, NULL);
+ BreakPot(this, NULL);
} else {
sub_0806F3E4(super);
}
@@ -276,7 +276,7 @@ void sub_08082778(PotEntity* this) {
void sub_080827F8(PotEntity* this) {
if (gPlayerState.field_0x1c == 0) {
- sub_08082850(this, NULL);
+ BreakPot(this, NULL);
}
}
@@ -284,7 +284,7 @@ void nullsub_512(PotEntity* this) {
}
void sub_08082818(PotEntity* this) {
- sub_08082850(this, NULL);
+ BreakPot(this, NULL);
}
void Pot_Action5(PotEntity* this) {
@@ -293,11 +293,11 @@ void Pot_Action5(PotEntity* this) {
}
if (GravityUpdate(super, Q_8_8(32.0)) == 0) {
- sub_08082850(this, NULL);
+ BreakPot(this, NULL);
}
}
-static void sub_08082850(PotEntity* this, Entity* parent) {
+static void BreakPot(PotEntity* this, Entity* parent) {
u32 parameter = sub_0808288C(super, super->type, this->unk_7d, super->type2);
Entity* fxEntity = CreateFx(super, FX_POT_SHATTER, parameter);
if (fxEntity) {
diff --git a/src/object/rupee.c b/src/object/rupee.c
index b729c071..49ff7835 100644
--- a/src/object/rupee.c
+++ b/src/object/rupee.c
@@ -45,7 +45,7 @@ void Rupee_Action_1(Entity* this) {
if (this->child->next == NULL) {
this->action = 2;
} else {
- if (sub_080044EC(this, 10240) == 0) {
+ if (BounceUpdate(this, Q_8_8(40.0)) == BOUNCE_DONE_ALL) {
this->action = 2;
}
ProcessMovement0(this);
diff --git a/src/player.c b/src/player.c
index e9e84ce5..1c41684c 100644
--- a/src/player.c
+++ b/src/player.c
@@ -1976,7 +1976,7 @@ static void PlayerRoomTransition(PlayerEntity* this) {
static void sub_080724DC(PlayerEntity* this) {
super->knockbackDuration = 0;
DeleteClones();
- if (GetTileUnderEntity(super) != 0x29) {
+ if (GetActTile(super) != 0x29) {
if ((gPlayerState.remainingDiveTime == 0) && (gPlayerState.swim_state != 0)) {
PlayerUpdateSwimming(super);
}
@@ -2620,7 +2620,7 @@ static void PlayerUseStairs(PlayerEntity* this) {
static void sub_080732D0(PlayerEntity* this) {
UpdateAnimationSingleFrame(super);
- if (GetTileUnderEntity(super) != 40) {
+ if (GetActTile(super) != 40) {
super->direction = DirectionNorth;
LinearMoveUpdate(super);
} else {
@@ -4107,7 +4107,7 @@ void sub_0807529C(PlayerEntity* this) {
void sub_080752AC(PlayerEntity* this, ScriptExecutionContext* ctx) {
LinearMoveUpdate(super);
if (!ctx->unk_18) {
- if (GetTileUnderEntity(super) != 41) {
+ if (GetActTile(super) != 41) {
ctx->unk_18 = 1;
ctx->unk_19 = 6;
}
diff --git a/src/playerItem/playerItemHeldObject.c b/src/playerItem/playerItemHeldObject.c
index e7fb4643..7d1eebd6 100644
--- a/src/playerItem/playerItemHeldObject.c
+++ b/src/playerItem/playerItemHeldObject.c
@@ -135,7 +135,7 @@ void PlayerItemHeldObject_SubAction2(PlayerItemHeldObjectEntity* this) {
(child->base).x = super->x;
(child->base).y = super->y;
(child->base).z = super->z;
- tile = GetTileUnderEntity(super);
+ tile = GetActTile(super);
switch (tile) {
case 0xd:
case 0x10:
diff --git a/src/playerItem/playerItemPacciCaneProjectile.c b/src/playerItem/playerItemPacciCaneProjectile.c
index ef2bee36..a5725d17 100644
--- a/src/playerItem/playerItemPacciCaneProjectile.c
+++ b/src/playerItem/playerItemPacciCaneProjectile.c
@@ -127,7 +127,7 @@ void PlayerItemPacciCaneProjectile_Action1(PlayerItemPacciCaneProjectileEntity*
}
if (sub_080B1BA4(COORD_TO_TILE(super), gPlayerEntity.base.collisionLayer, 0x80) == 0) {
if (sub_080040D8(super, &gUnk_08003E44, super->x.HALF.HI, super->y.HALF.HI) == 0) {
- if (GetTileUnderEntity(super) == 0x19) {
+ if (GetActTile(super) == 0x19) {
super->action = 4;
COLLISION_OFF(super);
super->x.HALF.HI = (super->x.HALF.HI & 0xfff0) | 8;
diff --git a/src/playerUtils.c b/src/playerUtils.c
index c64835df..833d8acf 100644
--- a/src/playerUtils.c
+++ b/src/playerUtils.c
@@ -2350,7 +2350,7 @@ bool32 sub_08079D48(void) {
return TRUE;
} else {
if (!PlayerCheckNEastTile()) {
- if (!sub_08007DD6((u16)GetTileUnderEntity(&gPlayerEntity.base), gUnk_0811C268)) {
+ if (!sub_08007DD6((u16)GetActTile(&gPlayerEntity.base), gUnk_0811C268)) {
return TRUE;
}
}
diff --git a/src/projectile/boneProjectile.c b/src/projectile/boneProjectile.c
index 711070a7..164ec13b 100644
--- a/src/projectile/boneProjectile.c
+++ b/src/projectile/boneProjectile.c
@@ -70,7 +70,7 @@ void BoneProjectile_Action3(Entity* this) {
this->spriteSettings.draw ^= 1;
LinearMoveUpdate(this);
GetNextFrame(this);
- if (sub_080044EC(this, 0x1800) == 0) {
+ if (BounceUpdate(this, Q_8_8(24.0)) == BOUNCE_DONE_ALL) {
DeleteEntity(this);
}
}
diff --git a/src/projectile/dekuSeedProjectile.c b/src/projectile/dekuSeedProjectile.c
index bc76acc4..132bf708 100644
--- a/src/projectile/dekuSeedProjectile.c
+++ b/src/projectile/dekuSeedProjectile.c
@@ -115,11 +115,11 @@ void DekuSeedProjectile_Action3(Entity* this) {
void DekuSeedProjectile_Action4(Entity* this) {
GetNextFrame(this);
ProcessMovement3(this);
- switch (sub_080044EC(this, 0x2800)) {
- case 0:
+ switch (BounceUpdate(this, Q_8_8(40.0))) {
+ case BOUNCE_DONE_ALL:
DeleteThisEntity();
return;
- case 1:
+ case BOUNCE_INIT_NEXT:
COLLISION_OFF(this);
this->speed = 0x120;
diff --git a/src/projectile/dirtBallProjectile.c b/src/projectile/dirtBallProjectile.c
index 5a56b0d3..12f9beae 100644
--- a/src/projectile/dirtBallProjectile.c
+++ b/src/projectile/dirtBallProjectile.c
@@ -132,7 +132,7 @@ void DirtBallProjectile_Action2(Entity* this) {
FreeCarryEntity(entity);
CopyPosition(this, entity);
}
- if (sub_080044EC(this, 0x2800) != 1) {
+ if (BounceUpdate(this, Q_8_8(40.0)) != BOUNCE_INIT_NEXT) {
return;
}
diff --git a/src/projectile/rockProjectile.c b/src/projectile/rockProjectile.c
index d5d4578e..70957e97 100644
--- a/src/projectile/rockProjectile.c
+++ b/src/projectile/rockProjectile.c
@@ -66,11 +66,11 @@ void RockProjectile_Action2(Entity* this) {
void RockProjectile_Action3(Entity* this) {
GetNextFrame(this);
ProcessMovement3(this);
- switch (sub_080044EC(this, 0x2800)) {
- case 0:
+ switch (BounceUpdate(this, Q_8_8(40.0))) {
+ case BOUNCE_DONE_ALL:
DeleteEntity(this);
return;
- case 1:
+ case BOUNCE_INIT_NEXT:
COLLISION_OFF(this);
this->speed = 0x120;
if (sub_0800442E(this) != 0) {