Merge pull request #680 from notyourav/f

BounceUpdate and other asm functions labeled
This commit is contained in:
Theo 2023-12-30 17:29:51 -08:00 committed by GitHub
commit 3771464496
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
62 changed files with 229 additions and 197 deletions

View File

@ -1,6 +1,21 @@
.ifndef GUARD_ASM_MACROS_MAP_INC .ifndef GUARD_ASM_MACROS_MAP_INC
.set GUARD_ASM_MACROS_MAP_INC, 1 .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 .macro room_header map_x, map_y, pixel_width, pixel_height, tileset_id
.2byte (\map_x) << 4 .2byte (\map_x) << 4
.2byte (\map_y) << 4 .2byte (\map_y) << 4

View File

@ -67,7 +67,7 @@ sub_0800445C: @ 0x0800445C
ldr r5, _080044D8 @ =gPlayerEntity ldr r5, _080044D8 @ =gPlayerEntity
adds r0, r4, #0 adds r0, r4, #0
adds r1, r5, #0 adds r1, r5, #0
bl sub_08004484 bl CalcCollisionStaticEntity
cmp r0, #0 cmp r0, #0
beq _08004482 beq _08004482
ldrb r0, [r5, #0xc] ldrb r0, [r5, #0xc]
@ -80,8 +80,8 @@ _08004480:
_08004482: _08004482:
pop {r4, r5, pc} pop {r4, r5, pc}
thumb_func_start sub_08004484 thumb_func_start CalcCollisionStaticEntity
sub_08004484: @ 0x08004484 CalcCollisionStaticEntity: @ 0x08004484
ldr r2, _080044DC @ =ram_sub_080B227C ldr r2, _080044DC @ =ram_sub_080B227C
bx r2 bx r2
@ -138,30 +138,34 @@ _080044E0: .4byte gUnk_02024048
_080044E4: .4byte gUnk_02021F20 _080044E4: .4byte gUnk_02021F20
_080044E8: .4byte gPlayerEntity _080044E8: .4byte gPlayerEntity
thumb_func_start sub_080044EC // BounceUpdate
sub_080044EC: @ 0x080044EC // assumes initial velocity is set
// r0: entity*
// r1: acceleration
thumb_func_start BounceUpdate
BounceUpdate: @ 0x080044EC
ldr r2, [r0, #0x34] ldr r2, [r0, #0x34]
ldr r3, [r0, #0x20] ldr r3, [r0, #0x20]
subs r2, r2, r3 subs r2, r3
bpl _080044FE bpl grounded // if z is positive, entity is grounded
str r2, [r0, #0x34] str r2, [r0, #0x34] // entity.z = entity.z - entity.zVelocity
subs r3, r3, r1 subs r3, r1
str r3, [r0, #0x20] str r3, [r0, #0x20] // entity.zVelocity = entity.zVelocity - acceleration
movs r0, #2 movs r0, #2 // return 2
bx lr bx lr
_080044FE: grounded:
movs r2, #1 movs r2, #1
str r2, [r0, #0x34] str r2, [r0, #0x34] // entity.z = 1 (note: player cant do certain actions at z!=0)
subs r3, r3, r1 subs r3, r1
rsbs r3, r3, #0 negs r3, r3
lsrs r3, r3, #1 lsrs r3, #1
lsrs r1, r3, #2 lsrs r1, r3, #2
adds r3, r3, r1 adds r3, r1 // calc next bounce velocity
lsrs r1, r3, #0xc lsrs r1, r3, #0xc
cmp r1, #0xc cmp r1, #0xc
bhs _08004516 bhs _08004516 // return 1 if bouncing
movs r2, #0 movs r2, #0 // return 0 if not bouncing
movs r3, #0 movs r3, #0 // set velocity to 0
_08004516: _08004516:
str r3, [r0, #0x20] str r3, [r0, #0x20]
adds r0, r2, #0 adds r0, r2, #0
@ -170,7 +174,7 @@ _08004516:
thumb_func_start sub_0800451C thumb_func_start sub_0800451C
sub_0800451C: @ 0x0800451C sub_0800451C: @ 0x0800451C
push {r0, lr} push {r0, lr}
bl GetTileUnderEntity bl GetActTile
adds r1, r0, #0 adds r1, r0, #0
pop {r0, r3} pop {r0, r3}
mov lr, r3 mov lr, r3

View File

@ -86,7 +86,7 @@ arm_sub_080B1A0C: @ 0x080B1A0C
ldrb r2, [r0, #0x38] ldrb r2, [r0, #0x38]
mov r0, r3 mov r0, r3
b arm_GetTileTypeByPos b arm_GetTileTypeByPos
arm_GetTileTypeByEntity: arm_GetTileTypeByEntity: // GetCell
ldrb r2, [r0, #0x38] ldrb r2, [r0, #0x38]
ldrh r1, [r0, #0x32] ldrh r1, [r0, #0x32]
ldrh r0, [r0, #0x2e] ldrh r0, [r0, #0x2e]
@ -129,7 +129,7 @@ arm_GetRelativeCollisionTile: @ 0x080B1A8C
ldrb r2, [r0, #0x38] ldrb r2, [r0, #0x38]
mov r0, r3 mov r0, r3
b arm_sub_080B1AB4 b arm_sub_080B1AB4
arm_GetTileUnderEntity: arm_GetActTile: // GetCellAct
ldrb r2, [r0, #0x38] ldrb r2, [r0, #0x38]
ldrh r1, [r0, #0x32] ldrh r1, [r0, #0x32]
ldrh r0, [r0, #0x2e] ldrh r0, [r0, #0x2e]
@ -148,42 +148,46 @@ arm_sub_080B1AD8:
add r0, r0, r1, lsl #6 add r0, r0, r1, lsl #6
mov r1, r2 mov r1, r2
arm_sub_080B1AE0: arm_sub_080B1AE0:
ldr r2, _080B1C24 @ =gUnk_08000278 ldr r2, _080B1C24 @ =gUnkDataPtrs
ldr r2, [r2, r1, lsl #2] ldr r2, [r2, r1, lsl #2]
ldrb r0, [r2, r0] ldrb r0, [r2, r0]
bx lr bx lr
arm_func_start arm_sub_080B1AF0 arm_func_start arm_sub_080B1AF0
arm_sub_080B1AF0: @ 0x080B1AF0 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 add r3, r3, r1
ldrh r1, [r0, #0x32] ldrh r1, [r0, #0x32] @ ent.y + y
add r1, r1, r2 add r1, r1, r2
ldrb r2, [r0, #0x38] ldrb r2, [r0, #0x38] @ ent.layer
mov r0, r3 mov r0, r3
b arm_sub_080B1B18 b arm_sub_080B1B18
arm_sub_080B1B0C: arm_sub_080B1B0C: // GetCellAtt
ldrb r2, [r0, #0x38] ldrb r2, [r0, #0x38] @ ent.layer
ldrh r1, [r0, #0x32] ldrh r1, [r0, #0x32] @ ent.y
ldrh r0, [r0, #0x2e] ldrh r0, [r0, #0x2e] @ ent.x
arm_sub_080B1B18: arm_sub_080B1B18:
ldr ip, _080B1C28 @ =gRoomControls ldr ip, _080B1C28 @ =gRoomControls
ldrh r3, [ip, #6] ldrh r3, [ip, #6]
sub r0, r0, r3 sub r0, r0, r3 @ ent.x - gRoomControls.origin_x
ldrh r3, [ip, #8] ldrh r3, [ip, #8]
sub r1, r1, r3 sub r1, r1, r3 @ ent.y - gRoomControls.origin_y
arm_sub_080B1B2C: arm_sub_080B1B2C:
lsl r0, r0, #0x16 lsl r0, r0, #0x16
lsr r0, r0, #0x1a lsr r0, r0, #0x1a @ /= 16
lsl r1, r1, #0x16 lsl r1, r1, #0x16
lsr r1, r1, #0x1a lsr r1, r1, #0x1a @ /= 16
arm_sub_080B1B3C: arm_sub_080B1B3C:
add r0, r0, r1, lsl #6 add r0, r0, r1, lsl #6 @ convert coords to tile index
mov r1, r2 mov r1, r2
arm_sub_080B1B44: arm_sub_080B1B44:
ldr r2, _080B1C2C @ =gUnk_08000248 ldr r2, _080B1C2C @ =gUnk_08000248
ldr r1, [r2, r1, lsl #2] ldr r1, [r2, r1, lsl #2]
ldrb r0, [r1, r0] ldrb r0, [r1, r0] @ load collision tile at my location
bx lr bx lr
arm_func_start arm_sub_080B1B54 arm_func_start arm_sub_080B1B54
@ -242,7 +246,7 @@ sub_080B1BCC: @ 0x080B1BCC
and r1, r1, #0x3f0 and r1, r1, #0x3f0
and r2, r2, #0x3f0 and r2, r2, #0x3f0
add r1, r1, r2, lsl #6 add r1, r1, r2, lsl #6
ldr r2, _080B1C50 @ =gUnk_08000278 ldr r2, _080B1C50 @ =gUnkDataPtrs
ldrb r3, [r0, #0x38] ldrb r3, [r0, #0x38]
ldr r2, [r2, r3, lsl #2] ldr r2, [r2, r3, lsl #2]
ldrb r0, [r2, r1, lsr #4] ldrb r0, [r2, r1, lsr #4]
@ -253,7 +257,7 @@ _080B1C14: .4byte gUnk_08000258
_080B1C18: .4byte gRoomControls _080B1C18: .4byte gRoomControls
_080B1C1C: .4byte gUnk_08000228 _080B1C1C: .4byte gUnk_08000228
_080B1C20: .4byte gRoomControls _080B1C20: .4byte gRoomControls
_080B1C24: .4byte gUnk_08000278 _080B1C24: .4byte gUnkDataPtrs
_080B1C28: .4byte gRoomControls _080B1C28: .4byte gRoomControls
_080B1C2C: .4byte gUnk_08000248 _080B1C2C: .4byte gUnk_08000248
_080B1C30: .4byte gUnk_080B37A0 _080B1C30: .4byte gUnk_080B37A0
@ -264,7 +268,7 @@ _080B1C40: .4byte gUnk_080B7A3E
_080B1C44: .4byte gUnk_08000360 _080B1C44: .4byte gUnk_08000360
_080B1C48: .4byte gUnk_080B7A3E _080B1C48: .4byte gUnk_080B7A3E
_080B1C4C: .4byte gRoomControls _080B1C4C: .4byte gRoomControls
_080B1C50: .4byte gUnk_08000278 _080B1C50: .4byte gUnkDataPtrs
arm_func_start UpdateCollision arm_func_start UpdateCollision
UpdateCollision: @ 0x080B1C54 UpdateCollision: @ 0x080B1C54
@ -424,15 +428,15 @@ _080B1E74:
mov ip, #0 mov ip, #0
bl arm_CalcCollisionDirection bl arm_CalcCollisionDirection
mov r6, r0 mov r6, r0
ldrb r1, [r5, #0x3f] ldrb r1, [r5, #0x3f] // hitType
mov r0, #0x22 mov r0, #0x22
mul r1, r0, r1 mul r1, r0, r1
ldrb r0, [r4, #0x40] ldrb r0, [r4, #0x40] // hurtType
add r0, r0, r1 add r0, r0, r1
mov r1, #0xc mov r1, #0xc
mul r2, r0, r1 mul r2, r0, r1
ldr r1, _080B2014 @ =gCollisionMtx ldr r1, _080B2014 @ =gCollisionMtx
add r3, r2, r1 add r3, r2, r1 // gCollisionMtx + 12 * (34 * hurtType + hurtType)
mov r1, #0 mov r1, #0
ldrb r0, [r3] ldrb r0, [r3]
cmp r0, #0xff cmp r0, #0xff
@ -742,29 +746,30 @@ _080B2270: .4byte gUpdateContext
_080B2274: .4byte gUnk_080026A4 _080B2274: .4byte gUnk_080026A4
_080B2278: .4byte gUpdateContext _080B2278: .4byte gUpdateContext
// calculating knockback?
arm_func_start arm_sub_080B227C arm_func_start arm_sub_080B227C
arm_sub_080B227C: @ 0x080B227C arm_sub_080B227C: @ 0x080B227C
push {r4, r5, r6, r7, r8, lr} push {r4-r8, lr}
ldr r2, [r0, #0x48] ldr r2, [r0, #0x48] // tgt.hitbox
cmp r2, #0 cmp r2, #0
beq _080B236C beq ret_false
ldr r3, [r1, #0x48] ldr r3, [r1, #0x48] // org.hitbox
cmp r3, #0 cmp r3, #0
beq _080B236C beq ret_false
ldrh r4, [r1, #0x2e] ldrh r4, [r1, #0x2e]
ldrsb r5, [r3] ldrsb r5, [r3]
add r4, r4, r5 add r4, r4, r5
ldrh r5, [r0, #0x2e] ldrh r5, [r0, #0x2e]
sub r4, r4, r5 sub r4, r4, r5
ldrsb r5, [r2] 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 r5, [r2, #6]
ldrb r6, [r3, #6] ldrb r6, [r3, #6]
add r5, r5, r6 add r5, r5, r6
add r6, r4, r5 add r6, r4, r5 // temp = temp + (tgt.hitbox.width + org.hitbox.width)
lsl r7, r5, #1 lsl r7, r5, #1
cmp r7, r6 cmp r7, r6
blo _080B236C blo ret_false // not colliding
cmp r4, #0 cmp r4, #0
movpl ip, #8 movpl ip, #8
movmi ip, #0x18 movmi ip, #0x18
@ -783,7 +788,7 @@ arm_sub_080B227C: @ 0x080B227C
add r5, r4, r3 add r5, r4, r3
lsl r6, r3, #1 lsl r6, r3, #1
cmp r6, r5 cmp r6, r5
blo _080B236C blo ret_false
cmp r4, #0 cmp r4, #0
movpl r2, #0x10 movpl r2, #0x10
movmi r2, #0 movmi r2, #0
@ -793,7 +798,7 @@ arm_sub_080B227C: @ 0x080B227C
movhs r7, r8 movhs r7, r8
movhs r2, ip movhs r2, ip
cmp r7, #0 cmp r7, #0
beq _080B236C beq ret_false
cmp r7, #5 cmp r7, #5
movhs r7, #4 movhs r7, #4
mov r0, r1 mov r0, r1
@ -802,11 +807,11 @@ arm_sub_080B227C: @ 0x080B227C
mov lr, pc mov lr, pc
bx r3 bx r3
_080B2360: _080B2360:
pop {r4, r5, r6, r7, r8, lr} pop {r4-r8, lr}
mov r0, #1 mov r0, #1
bx lr bx lr
_080B236C: ret_false:
pop {r4, r5, r6, r7, r8, lr} pop {r4-r8, lr}
mov r0, #0 mov r0, #0
bx lr bx lr
.align 2, 0 .align 2, 0

View File

@ -106,7 +106,7 @@ _08016A64:
sub_08016A6C: @ 0x08016A6C sub_08016A6C: @ 0x08016A6C
push {r4, r5, lr} push {r4, r5, lr}
adds r4, r0, #0 adds r4, r0, #0
bl GetTileUnderEntity bl GetActTile
add r1, pc, #0x38 add r1, pc, #0x38
_08016A76: _08016A76:
adds r1, #4 adds r1, #4

View File

@ -107,7 +107,7 @@ _080001CC: .4byte gMapBottom+0x6004
thumb_func_start sub_080001D0 thumb_func_start sub_080001D0
sub_080001D0: @ 0x080001D0 sub_080001D0: @ 0x080001D0
lsls r2, r2, #2 lsls r2, r2, #2
ldr r3, _08000220 @ =gUnk_08000278 ldr r3, _08000220 @ =gUnkDataPtrs
ldr r3, [r3, r2] ldr r3, [r3, r2]
strb r0, [r3, r1] strb r0, [r3, r1]
bx lr bx lr
@ -135,37 +135,37 @@ _08000210: .4byte gUnk_080B7910
_08000214: .4byte gUnk_080B79A7 _08000214: .4byte gUnk_080B79A7
_08000218: .4byte gUnk_080B37A0 _08000218: .4byte gUnk_080B37A0
_0800021C: .4byte gUnk_080B3E80 _0800021C: .4byte gUnk_080B3E80
_08000220: .4byte gUnk_08000278 _08000220: .4byte gUnkDataPtrs
_08000224: .4byte gUnk_08000228 _08000224: .4byte gUnk_08000228
gUnk_08000228:: gUnk_08000228::
.4byte gMapBottom+0x0004 .4byte BOTTOM_TILEDATA
gUnk_0800022C:: gUnk_0800022C::
.4byte gMapBottom+0x5004 .4byte BOTTOM_METATILETYPES
.4byte gMapBottom+0x0004 .4byte BOTTOM_TILEDATA
.4byte gMapBottom+0x5004 .4byte BOTTOM_METATILETYPES
.4byte gMapTop+0x0004 .4byte TOP_TILEDATA
.4byte gMapTop+0x5004 .4byte TOP_METATILETYPES
.4byte gMapBottom+0x0004 .4byte BOTTOM_TILEDATA
.4byte gMapBottom+0x5004 .4byte BOTTOM_METATILETYPES
gUnk_08000248:: gUnk_08000248::
.4byte gMapBottom+0x2004 .4byte BOTTOM_COLLISIONDATA
.4byte gMapBottom+0x2004 .4byte BOTTOM_COLLISIONDATA
.4byte gMapTop+0x2004 .4byte TOP_COLLISIONDATA
.4byte gMapBottom+0x2004 .4byte BOTTOM_COLLISIONDATA
gUnk_08000258:: gUnk_08000258::
.4byte gMapBottom+0x3004 .4byte BOTTOM_TILEDATACLONE
.4byte gMapBottom+0x5004 .4byte BOTTOM_METATILETYPES
.4byte gMapBottom+0x3004 .4byte BOTTOM_TILEDATACLONE
.4byte gMapBottom+0x5004 .4byte BOTTOM_METATILETYPES
.4byte gMapTop+0x3004 .4byte TOP_TILEDATACLONE
.4byte gMapTop+0x5004 .4byte TOP_METATILETYPES
.4byte gMapBottom+0x3004 .4byte BOTTOM_TILEDATACLONE
.4byte gMapBottom+0x5004 .4byte BOTTOM_METATILETYPES
gUnk_08000278:: gUnkDataPtrs::
.4byte gMapBottom+0xb004 .4byte BOTTOM_UNKDATA3
.4byte gMapBottom+0xb004 .4byte BOTTOM_UNKDATA3
.4byte gMapTop+0xb004 .4byte TOP_UNKDATA3
.4byte gMapBottom+0xb004 .4byte BOTTOM_UNKDATA3
@ call 0x80B19CC @ call 0x80B19CC
@ ======== @ ========
@ -277,9 +277,9 @@ GetRelativeCollisionTile: @ 0x080002B4
@ return: @ return:
@ ======== @ ========
@ Called every frame a pot is thrown, every frame the screen is sliding in a transition, and once when entering stairs. @ 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 thumb_func_start GetActTile
GetTileUnderEntity: @ 0x080002B8 GetActTile: @ 0x080002B8
ldr r3, _08000324 @ =ram_GetTileUnderEntity ldr r3, _08000324 @ =ram_GetActTile
bx r3 bx r3
@ call 0x080B1AB4 @ call 0x080B1AB4
@ -362,8 +362,6 @@ sub_080B1B3C: @ 0x080002DC
bx r3 bx r3
@ call 0x080B1B44 @ call 0x080B1B44
@ ========
@ Unused? Doesn't seem to be called by anything in Ghidra.
thumb_func_start sub_080B1B44 thumb_func_start sub_080B1B44
sub_080B1B44: @ 0x080002E0 sub_080B1B44: @ 0x080002E0
ldr r3, _0800034C @ =ram_sub_080B1B44 ldr r3, _0800034C @ =ram_sub_080B1B44
@ -413,7 +411,7 @@ _08000314: .4byte ram_sub_080B1A48
_08000318: .4byte ram_sub_080B1A58 _08000318: .4byte ram_sub_080B1A58
_0800031C: .4byte ram_GetTileType _0800031C: .4byte ram_GetTileType
_08000320: .4byte ram_GetRelativeCollisionTile _08000320: .4byte ram_GetRelativeCollisionTile
_08000324: .4byte ram_GetTileUnderEntity _08000324: .4byte ram_GetActTile
_08000328: .4byte ram_sub_080B1AB4 _08000328: .4byte ram_sub_080B1AB4
_0800032C: .4byte ram_sub_080B1AC8 _0800032C: .4byte ram_sub_080B1AC8
_08000330: .4byte ram_sub_080B1AD8 _08000330: .4byte ram_sub_080B1AD8

View File

@ -20,11 +20,21 @@ extern void GenericKnockback(struct Entity_*);
extern u32 GetFuserId(struct Entity_*); extern u32 GetFuserId(struct Entity_*);
extern u32 CheckPlayerInRegion(u32 centerX, u32 centerY, u32 radiusX, u32 radiusY); extern u32 CheckPlayerInRegion(u32 centerX, u32 centerY, u32 radiusX, u32 radiusY);
extern u32 GravityUpdate(struct Entity_* entity, u32 gravity); 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 u32 CheckOnScreen(struct Entity_*);
extern bool32 EntityInRectRadius(struct Entity_*, struct Entity_*, u32, u32); extern bool32 EntityInRectRadius(struct Entity_*, struct Entity_*, u32, u32);
extern void UpdateAnimationVariableFrames(struct Entity_*, u32); extern void UpdateAnimationVariableFrames(struct Entity_*, u32);
extern u32 sub_080043E8(struct Entity_*); 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 ResetCollisionLayer(struct Entity_*);
extern void sub_08004596(struct Entity_*, u32); extern void sub_08004596(struct Entity_*, u32);
extern u32 sub_080045B4(struct Entity_*, u32, 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_080B1A48(u32, u32, u32);
extern u32 sub_080B1B18(s32, s32, u32); extern u32 sub_080B1B18(s32, s32, u32);
extern u32 sub_080B1AE0(u16, u8); 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_0800445C(struct Entity_*);
extern u32 sub_080B1AF0(struct Entity_*, s32, s32); extern u32 sub_080B1AF0(struct Entity_*, s32, s32);
extern u32 GetRelativeCollisionTile(struct Entity_*, u32, u32); extern u32 GetRelativeCollisionTile(struct Entity_*, u32, u32);

View File

@ -11,9 +11,9 @@ struct Entity_;
typedef struct { typedef struct {
u16 heldKeys; /**< Keys held since last frame. */ u16 heldKeys; /**< Keys held since last frame. */
u16 newKeys; /** Keys newly pressed this frame. */ u16 newKeys; /** Keys newly pressed this frame. */
u16 unk4; u16 menuScrollKeys;
u8 unk6; u8 unk6;
u8 unk7; u8 menuScrollTimer;
} Input; } Input;
extern Input gInput; /**< Input instance. */ extern Input gInput; /**< Input instance. */

View File

@ -43,7 +43,7 @@ bool32 sub_08049F84(Entity*, s32);
Entity* sub_08049DF4(u32); Entity* sub_08049DF4(u32);
u32 sub_0804A044(Entity*, Entity*, u32); u32 sub_0804A044(Entity*, Entity*, u32);
s32 sub_080012DC(Entity*); s32 sub_080012DC(Entity*);
u32 sub_080044EC(Entity*, u32);
void sub_0804AA1C(Entity*); void sub_0804AA1C(Entity*);
bool32 sub_08049F1C(Entity*, Entity*, s32); bool32 sub_08049F1C(Entity*, Entity*, s32);
bool32 PlayerInRange(Entity*, u32, s32); bool32 PlayerInRange(Entity*, u32, s32);

View File

@ -69,7 +69,7 @@ extern void sub_080042D0(Entity*, u32, u16);
extern void sub_080043A8(Entity*); extern void sub_080043A8(Entity*);
extern u32 sub_0800445C(Entity*); extern u32 sub_0800445C(Entity*);
extern void sub_080044AE(Entity*, u32, u32); 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_0800451C(Entity*);
extern void sub_08004542(Entity*); extern void sub_08004542(Entity*);
extern void sub_080085B0(Entity*); extern void sub_080085B0(Entity*);

View File

@ -18,11 +18,11 @@ typedef struct {
u8 textWindowPosY; u8 textWindowPosY;
u16 textIndex; u16 textIndex;
u16 unk2; // HI? u16 unk2; // HI?
u32 field_0xc; u32 flags;
u32 rupees; u32 rupees; // item price, shells, minigame timer
u32 field_0x14; u32 field_0x14; // number of cuccos
u32 field_0x18; u32 field_0x18; // unused
u32 field_0x1c; u32 field_0x1c; // unused
} Message; } Message;
extern Message gMessage; extern Message gMessage;

View File

@ -170,7 +170,7 @@ SECTIONS {
. = 0x000057CC; ram_sub_080B1A58 = .; . = 0x000057CC; ram_sub_080B1A58 = .;
. = 0x000057D4; ram_GetTileType = .; . = 0x000057D4; ram_GetTileType = .;
. = 0x00005800; ram_GetRelativeCollisionTile = .; . = 0x00005800; ram_GetRelativeCollisionTile = .;
. = 0x0000581C; ram_GetTileUnderEntity = .; . = 0x0000581C; ram_GetActTile = .;
. = 0x00005828; ram_sub_080B1AB4 = .; . = 0x00005828; ram_sub_080B1AB4 = .;
. = 0x0000583C; ram_sub_080B1AC8 = .; . = 0x0000583C; ram_sub_080B1AC8 = .;
. = 0x0000584C; ram_sub_080B1AD8 = .; . = 0x0000584C; ram_sub_080B1AD8 = .;

View File

@ -580,7 +580,7 @@ CollisionResult sub_08017F40(Entity* org, Entity* tgt, u32 direction, ColSetting
org->health = 0; org->health = 0;
} }
} else if (tgt->kind == ENEMY && org == &gPlayerEntity.base) { } else if (tgt->kind == ENEMY && org == &gPlayerEntity.base) {
sub_08004484(tgt, org); CalcCollisionStaticEntity(tgt, org);
} }
return RESULT_NO_COLLISION; return RESULT_NO_COLLISION;
} }
@ -670,14 +670,14 @@ CollisionResult sub_08018168(Entity* org, Entity* tgt, u32 direction, ColSetting
org->health = 0; org->health = 0;
} }
} else if ((tgt->kind == ENEMY) && (org == &gPlayerEntity.base)) { } else if ((tgt->kind == ENEMY) && (org == &gPlayerEntity.base)) {
sub_08004484(tgt, &gPlayerEntity.base); CalcCollisionStaticEntity(tgt, &gPlayerEntity.base);
} }
return RESULT_NO_COLLISION; return RESULT_NO_COLLISION;
} }
CollisionResult sub_08018228(Entity* org, Entity* tgt, u32 direction, ColSettings* settings) { CollisionResult sub_08018228(Entity* org, Entity* tgt, u32 direction, ColSettings* settings) {
if (org == &gPlayerEntity.base && PlayerCanBeMoved()) if (org == &gPlayerEntity.base && PlayerCanBeMoved())
sub_08004484(tgt, org); CalcCollisionStaticEntity(tgt, org);
return RESULT_NO_COLLISION; 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) { CollisionResult CollisionDefault(Entity* org, Entity* tgt, u32 direction, ColSettings* settings) {
u32 confused = 0; u32 confused = 0;
if (tgt->confusedTime && tgt->kind == ENEMY && org == &gPlayerEntity.base) { if (tgt->confusedTime && tgt->kind == ENEMY && org == &gPlayerEntity.base) {
sub_08004484(tgt, org); CalcCollisionStaticEntity(tgt, org);
confused = 1; confused = 1;
} }
if ((org->kind == PLAYER_ITEM && org->id == PL_ITEM_SHIELD) && if ((org->kind == PLAYER_ITEM && org->id == PL_ITEM_SHIELD) &&

View File

@ -216,15 +216,15 @@ static void StoreKeyInput(Input* input, u32 keyInput) {
u32 difference = keyInput & ~heldKeys; u32 difference = keyInput & ~heldKeys;
input->newKeys = difference; input->newKeys = difference;
if (keyInput == heldKeys) { if (keyInput == heldKeys) {
if (--input->unk7 == 0) { if (--input->menuScrollTimer == 0) {
input->unk7 = 4; input->menuScrollTimer = 4;
input->unk4 = keyInput; input->menuScrollKeys = keyInput;
} else { } else {
input->unk4 = 0; input->menuScrollKeys = 0;
} }
} else { } else {
input->unk7 = 20; input->menuScrollTimer = 20;
input->unk4 = difference; input->menuScrollKeys = difference;
} }
input->heldKeys = keyInput; input->heldKeys = keyInput;
} }

View File

@ -73,7 +73,7 @@ void sub_0805FA98(void) {
MessageInitialize(); MessageInitialize();
break; break;
default: default:
switch (gInput.unk4) { switch (gInput.menuScrollKeys) {
case DPAD_LEFT: case DPAD_LEFT:
iVar1 = -1; iVar1 = -1;
break; break;

View File

@ -528,7 +528,7 @@ void AcroBandit_Type1Action6(AcroBanditEntity* this) {
void AcroBandit_Type1Action7(AcroBanditEntity* this) { void AcroBandit_Type1Action7(AcroBanditEntity* this) {
ProcessMovement2(super); ProcessMovement2(super);
if (sub_080044EC(super, 0x2000) == 0) if (BounceUpdate(super, Q_8_8(32.0)) == BOUNCE_DONE_ALL)
super->action = 8; super->action = 8;
} }

View File

@ -120,7 +120,7 @@ void sub_080218CC(BeetleEntity* this) {
GetNextFrame(super); GetNextFrame(super);
if (super->frame & 1) { if (super->frame & 1) {
ProcessMovement2(super); ProcessMovement2(super);
if (sub_080044EC(super, 0x1c00) == 0) if (BounceUpdate(super, Q_8_8(28.0)) == BOUNCE_DONE_ALL)
super->frameDuration = 1; super->frameDuration = 1;
} }

View File

@ -250,7 +250,7 @@ void sub_0802CAF8(BobombEntity* this) {
if (--super->timer == 0) { if (--super->timer == 0) {
sub_0802CBC4(this); sub_0802CBC4(this);
} else { } 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); EnqueueSFX(SFX_PLACE_OBJ);
} }
sub_0802CC18(this); sub_0802CC18(this);

View File

@ -474,7 +474,7 @@ void sub_0802AEBC(BombPeahatEntity* this) {
void sub_0802AED4(BombPeahatEntity* this) { void sub_0802AED4(BombPeahatEntity* this) {
GetNextFrame(super); GetNextFrame(super);
if (this->unk_81 < 2) { 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++; this->unk_81++;
} }
} else { } else {
@ -673,7 +673,7 @@ void sub_0802B1BC(BombPeahatEntity* this) {
#endif #endif
void sub_0802B204(BombPeahatEntity* this) { 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); Entity* entity = CreateEnemy(BOBOMB, 1);
if (entity != NULL) { if (entity != NULL) {
CopyPosition(super, entity); CopyPosition(super, entity);

View File

@ -715,7 +715,7 @@ void sub_0801FB68(ChuchuEntity* this) {
} }
u32 sub_0801FBD0(ChuchuEntity* this) { u32 sub_0801FBD0(ChuchuEntity* this) {
if (GetTileUnderEntity(super) == 0x10) { if (GetActTile(super) == 0x10) {
return 1; return 1;
} else { } else {
return 0; return 0;

View File

@ -175,7 +175,7 @@ void CloudPiranha_Action3(CloudPiranhaEntity* this) {
void CloudPiranha_Action4(CloudPiranhaEntity* this) { void CloudPiranha_Action4(CloudPiranhaEntity* this) {
Entity* effect; Entity* effect;
sub_080387F0(this); sub_080387F0(this);
if (sub_080044EC(super, 0x1800) == 1) { if (BounceUpdate(super, Q_8_8(24.0)) == BOUNCE_INIT_NEXT) {
super->action = 1; super->action = 1;
super->hitType = 0x72; super->hitType = 0x72;
super->timer = 1; super->timer = 1;

View File

@ -176,7 +176,7 @@ void sub_08038F44(CuccoAggrEntity* this) {
super->direction = GetFacingDirection(&gPlayerEntity.base, super); super->direction = GetFacingDirection(&gPlayerEntity.base, super);
sub_080390F8(this); sub_080390F8(this);
ProcessMovement0(super); ProcessMovement0(super);
sub_080044EC(super, 0x1800); BounceUpdate(super, Q_8_8(24.0));
GetNextFrame(super); GetNextFrame(super);
sub_08039298(this); sub_08039298(this);
if (--this->unk_78 == 0) { if (--this->unk_78 == 0) {

View File

@ -93,7 +93,7 @@ void sub_0802C334(FallingBoulderEntity* this) {
GetNextFrame(super); GetNextFrame(super);
this->unk_7e = COORD_TO_TILE(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); EnqueueSFX(0x14c);
COLLISION_ON(super); COLLISION_ON(super);
this->unk_7a = 12; this->unk_7a = 12;

View File

@ -224,7 +224,7 @@ void sub_0802BEBC(HelmasaurEntity* this) {
super->direction ^= DirectionSouth; super->direction ^= DirectionSouth;
ProcessMovement2(super); ProcessMovement2(super);
super->direction ^= DirectionSouth; 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); sub_0802C1C0(this);
} }
} }

View File

@ -240,7 +240,7 @@ void Peahat_ChargeEnd(PeahatEntity* this) {
void Peahat_Stunned(PeahatEntity* this) { void Peahat_Stunned(PeahatEntity* this) {
switch (super->animationState) { switch (super->animationState) {
default: default:
if (sub_080044EC(super, 0x1800) == 0) { if (BounceUpdate(super, Q_8_8(24.0)) == BOUNCE_DONE_ALL) {
super->action = 6; super->action = 6;
super->timer = 240; super->timer = 240;
super->subtimer = 10; super->subtimer = 10;

View File

@ -187,16 +187,16 @@ void Rollobite_RolledUp(RollobiteEntity* this) {
if ((super->frame & ANIM_DONE) == 0) if ((super->frame & ANIM_DONE) == 0)
GetNextFrame(super); 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) { if (--super->timer == 0) {
super->action = 5; super->action = 5;
InitializeAnimation(super, super->animationState + 12); InitializeAnimation(super, super->animationState + 12);
} }
RegisterCarryEntity(super); RegisterCarryEntity(super);
} else { } else {
if (unk == 1) if (unk == BOUNCE_INIT_NEXT)
EnqueueSFX(SFX_PLACE_OBJ); EnqueueSFX(SFX_PLACE_OBJ);
if (!(super->direction & DIR_NOT_MOVING_CHECK)) if (!(super->direction & DIR_NOT_MOVING_CHECK))

View File

@ -208,7 +208,7 @@ void sub_08031600(RopeEntity* this) {
u32 sub_0803163C(RopeEntity* this) { u32 sub_0803163C(RopeEntity* this) {
u32 h; u32 h;
if (GetTileUnderEntity(super) == 0x13) { if (GetActTile(super) == 0x13) {
h = this->unk_7a / 2; h = this->unk_7a / 2;
} else { } else {
h = this->unk_7a; h = this->unk_7a;

View File

@ -152,12 +152,12 @@ void sub_0802B880(Entity* this) {
void sub_0802B8B0(Entity* this) { void sub_0802B8B0(Entity* this) {
ProcessMovement2(this); ProcessMovement2(this);
switch (sub_080044EC(this, 0x1800)) { switch (BounceUpdate(this, Q_8_8(24.0))) {
case 0: case BOUNCE_DONE_ALL:
this->action = 7; this->action = 7;
this->timer = 150; this->timer = 150;
/* fallthrough */ /* fallthrough */
case 1: case BOUNCE_INIT_NEXT:
EnqueueSFX(SFX_12B); EnqueueSFX(SFX_12B);
break; break;
} }

View File

@ -147,7 +147,7 @@ void sub_0802F300(TektiteEntity* this) {
temp = super->z.HALF.HI; temp = super->z.HALF.HI;
rand = Random() & 0xf; rand = Random() & 0xf;
if (sub_080044EC(super, this->unk_80) == 1) { if (BounceUpdate(super, this->unk_80) == BOUNCE_INIT_NEXT) {
super->action = 3; super->action = 3;
super->subAction = 0; super->subAction = 0;
if (super->type != 0) { if (super->type != 0) {
@ -164,7 +164,7 @@ void sub_0802F300(TektiteEntity* this) {
return; return;
} else if (super->collisions != COL_NONE) { } else if (super->collisions != COL_NONE) {
sub_0800417E(super, super->collisions); sub_0800417E(super, super->collisions);
} else if ((GetTileUnderEntity(super) & 0xf0) == 0x50) { } else if ((GetActTile(super) & 0xf0) == 0x50) {
super->direction = (super->direction + 0x10) & (0x3 | DirectionNorthWest); super->direction = (super->direction + 0x10) & (0x3 | DirectionNorthWest);
} }

View File

@ -129,7 +129,7 @@ void sub_08038048(TektiteGoldenEntity* this) {
temp = super->z.HALF.HI; temp = super->z.HALF.HI;
rand = Random() & 0xf; rand = Random() & 0xf;
if (sub_080044EC(super, 0x3000) == 1) { if (BounceUpdate(super, Q_8_8(48.0)) == BOUNCE_INIT_NEXT) {
super->action = 3; super->action = 3;
super->subAction = 0; super->subAction = 0;
super->timer = 20; super->timer = 20;
@ -137,7 +137,7 @@ void sub_08038048(TektiteGoldenEntity* this) {
return; return;
} else if (super->collisions != COL_NONE) { } else if (super->collisions != COL_NONE) {
sub_0800417E(super, super->collisions); sub_0800417E(super, super->collisions);
} else if ((GetTileUnderEntity(super) & 0xf0) == 0x50) { } else if ((GetActTile(super) & 0xf0) == 0x50) {
super->direction = (super->direction + 0x10) & (0x3 | DirectionNorthWest); super->direction = (super->direction + 0x10) & (0x3 | DirectionNorthWest);
} }

View File

@ -288,7 +288,7 @@ void VaatiTransfiguredType0Action3(VaatiTransfiguredEntity* this) {
switch (this->unk_80) { switch (this->unk_80) {
case 0: case 0:
uVar4 = sub_080044EC(super, 0x2800); uVar4 = BounceUpdate(super, Q_8_8(40.0));
if (uVar4 != 1) if (uVar4 != 1)
break; break;
this->unk_80 = 1; this->unk_80 = 1;

View File

@ -1145,7 +1145,7 @@ void sub_080610B8(void) {
default: default:
uVar6 = 0; uVar6 = 0;
tmp4 = 0; tmp4 = 0;
switch (gInput.unk4) { switch (gInput.menuScrollKeys) {
case DPAD_UP: case DPAD_UP:
tmp4 = -1; tmp4 = -1;
break; break;

View File

@ -66,14 +66,14 @@ void EnemyInteractionManager_Action1(EnemyInteractionManager* this) {
for (i = 0; i < n; i++) { for (i = 0; i < n; i++) {
tmp = this->d.enemies[i]; tmp = this->d.enemies[i];
for (j = i + 1; j < super->timer; j++) { for (j = i + 1; j < super->timer; j++) {
sub_08004484(tmp, this->d.enemies[j]); CalcCollisionStaticEntity(tmp, this->d.enemies[j]);
} }
} }
} else { } else {
for (i = 0; i < n; i++) { for (i = 0; i < n; i++) {
tmp = this->d.enemies[i]; tmp = this->d.enemies[i];
for (j = i + 1; j < super->timer; j++) { for (j = i + 1; j < super->timer; j++) {
sub_08004484(this->d.enemies[j], tmp); CalcCollisionStaticEntity(this->d.enemies[j], tmp);
} }
} }
} }

View File

@ -180,7 +180,7 @@ void FigurineMenu0_ViewFigurineAfterDrawing(void) {
s32 t; s32 t;
infoY = gFigurineMenu.unk1f; infoY = gFigurineMenu.unk1f;
switch (gInput.unk4) { switch (gInput.menuScrollKeys) {
case B_BUTTON: case B_BUTTON:
case START_BUTTON: case START_BUTTON:
FigurineMenu_ExitMenu(); FigurineMenu_ExitMenu();
@ -219,7 +219,7 @@ void FigurineMenu1_ViewAllFigurines(void) {
infoY = gFigurineMenu.unk1f; infoY = gFigurineMenu.unk1f;
figurineIndex = gFigurineMenu.figure_idx; figurineIndex = gFigurineMenu.figure_idx;
switch (gInput.unk4) { switch (gInput.menuScrollKeys) {
case B_BUTTON: case B_BUTTON:
case START_BUTTON: case START_BUTTON:
SetMenuType(3); SetMenuType(3);

View File

@ -194,7 +194,7 @@ void KinstoneMenu_Type1(void) {
return; return;
} }
tmp3 = menu->unk28; tmp3 = menu->unk28;
switch (gInput.unk4) { switch (gInput.menuScrollKeys) {
case DPAD_LEFT: case DPAD_LEFT:
case DPAD_UP: case DPAD_UP:
tmp3--; tmp3--;

View File

@ -404,7 +404,7 @@ void PauseMenu_ItemMenu_Update(void) {
} }
break; break;
default: default:
switch (gInput.unk4) { switch (gInput.menuScrollKeys) {
case DPAD_UP: case DPAD_UP:
menuSlot = entry->up; menuSlot = entry->up;
break; break;
@ -710,7 +710,7 @@ void sub_080A56A0(void) {
gMenu.field_0xc = gUnk_08128C00; gMenu.field_0xc = gUnk_08128C00;
ptr = &gUnk_08128C14[gMenu.field_0x3]; ptr = &gUnk_08128C14[gMenu.field_0x3];
uVar2 = 0xff; uVar2 = 0xff;
switch (gInput.unk4) { switch (gInput.menuScrollKeys) {
case DPAD_UP: case DPAD_UP:
uVar2 = ptr->unk0; uVar2 = ptr->unk0;
break; break;

View File

@ -408,7 +408,7 @@ u16 RunTextCommand(TextRender* this) {
gMessage.unk = this->curToken.param; gMessage.unk = this->curToken.param;
break; break;
case 6: case 6:
ptr = &gMessage.field_0xc; ptr = &gMessage.flags;
tmp3 = this->curToken.param; tmp3 = this->curToken.param;
tmp3 &= 0x1f; tmp3 &= 0x1f;
WriteBit(ptr, tmp3); WriteBit(ptr, tmp3);

View File

@ -61,10 +61,10 @@ void sub_0806E964(PhonographEntity* this, ScriptExecutionContext* context) {
sub_0806EABC(this); sub_0806EABC(this);
} }
if (gInput.unk4 & (DPAD_UP | DPAD_DOWN)) { if (gInput.menuScrollKeys & (DPAD_UP | DPAD_DOWN)) {
s32 val2, val3; s32 val2, val3;
s32 val = this->unk_68; s32 val = this->unk_68;
if (gInput.unk4 & DPAD_UP) { if (gInput.menuScrollKeys & DPAD_UP) {
val++; val++;
} else { } else {
val--; val--;
@ -147,8 +147,8 @@ void sub_0806E964(PhonographEntity* this, ScriptExecutionContext* context) {
if (val > val2) { if (val > val2) {
val = 1; val = 1;
} }
} else if (gInput.unk4 & (DPAD_UP | DPAD_DOWN)) { } else if (gInput.menuScrollKeys & (DPAD_UP | DPAD_DOWN)) {
if (gInput.unk4 & DPAD_UP) { if (gInput.menuScrollKeys & DPAD_UP) {
val++; val++;
} else { } else {
val--; val--;

View File

@ -321,7 +321,7 @@ void CollideFollowers(void) {
continue; continue;
if ((nextEnt->followerFlag & 1) == 0) if ((nextEnt->followerFlag & 1) == 0)
continue; continue;
sub_08004484(currentEntity, nextEnt); CalcCollisionStaticEntity(currentEntity, nextEnt);
} }
} }
} }

View File

@ -131,7 +131,7 @@ void Bird_Type1_Action1_Subaction0(BirdEntity* this) {
void Bird_Type1_Action1_Subaction1(BirdEntity* this) { void Bird_Type1_Action1_Subaction1(BirdEntity* this) {
Entity* fx; Entity* fx;
if (sub_080044EC(super, 0x1800) < 2) { if (BounceUpdate(super, Q_8_8(24.0)) < BOUNCE_AIRBORNE) {
super->type = 2; super->type = 2;
super->action = 1; super->action = 1;
super->z.WORD = 0; super->z.WORD = 0;

View File

@ -138,7 +138,7 @@ void Book_Action2(BookEntity* this) {
void Book_Action3(BookEntity* this) { void Book_Action3(BookEntity* this) {
Entity* fx; Entity* fx;
if (sub_080044EC(super, 0x2800) != 1) { if (BounceUpdate(super, Q_8_8(40.0)) != BOUNCE_INIT_NEXT) {
return; return;
} }

View File

@ -174,7 +174,7 @@ void CrenelBeanSprout_Action1(CrenelBeanSproutEntity* this) {
gUnk_0200AF00.rActionPlayerState = R_ACTION_NONE; gUnk_0200AF00.rActionPlayerState = R_ACTION_NONE;
} }
PositionRelative(&gPlayerEntity.base, super, 0, 0x10000); PositionRelative(&gPlayerEntity.base, super, 0, 0x10000);
if (GetTileUnderEntity(super) == 0x19) { if (GetActTile(super) == 0x19) {
RestorePrevTileEntity(0xdc, super->collisionLayer); RestorePrevTileEntity(0xdc, super->collisionLayer);
sub_08096A78(this); sub_08096A78(this);
} }

View File

@ -331,7 +331,7 @@ void CutsceneMiscObject_Type5(CutsceneMiscObjectEntity* this) {
super->zVelocity = 0; super->zVelocity = 0;
SetEntityPriority(super, PRIO_PLAYER_EVENT); SetEntityPriority(super, PRIO_PLAYER_EVENT);
InitializeAnimation(super, 0); InitializeAnimation(super, 0);
if (GetTileUnderEntity(super) == 13) { if (GetActTile(super) == 13) {
super->action = 3; super->action = 3;
} }
break; break;
@ -550,7 +550,7 @@ void CutsceneMiscObject_Type11(CutsceneMiscObjectEntity* this) {
InitAnimationForceUpdate(super, 0); InitAnimationForceUpdate(super, 0);
} }
if (super->subAction != 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; super->subAction = 0;
SetAffineInfo(super, 0x100, 0x100, 0xC000); SetAffineInfo(super, 0x100, 0x100, 0xC000);
} else { } else {

View File

@ -259,9 +259,9 @@ void FigurineDevice_Action4(FigurineDeviceEntity* this) {
tmp = 1; tmp = 1;
} }
#ifdef JP #ifdef JP
switch (gInput.unk4) { switch (gInput.menuScrollKeys) {
#else #else
switch (gInput.unk4 & 0xfffffeff) { switch (gInput.menuScrollKeys & ~R_BUTTON) {
#endif #endif
case DPAD_UP: case DPAD_UP:
FigurineDevice_ChangeShellAmount(this, tmp); FigurineDevice_ChangeShellAmount(this, tmp);
@ -274,7 +274,7 @@ void FigurineDevice_Action4(FigurineDeviceEntity* this) {
sub_080882A8(this); sub_080882A8(this);
} }
#else #else
switch (gInput.unk4) { switch (gInput.menuScrollKeys) {
case DPAD_UP: case DPAD_UP:
FigurineDevice_ChangeShellAmount(this, 1); FigurineDevice_ChangeShellAmount(this, 1);
break; break;

View File

@ -124,7 +124,7 @@ void GraveyardKey_Action2(Entity* this, const struct_gUnk_08123FB0* param_2) {
u8 type; u8 type;
LinearMoveUpdate(this); LinearMoveUpdate(this);
if (sub_080044EC(this, param_2->unk14) < 2) { if (BounceUpdate(this, param_2->unk14) < BOUNCE_AIRBORNE) {
if (this->timer) { if (this->timer) {
this->timer--; this->timer--;
this->zVelocity = param_2->unk14 << 3; this->zVelocity = param_2->unk14 << 3;

View File

@ -436,7 +436,7 @@ u32 sub_080814C0(ItemOnGroundEntity* this) {
void sub_08081500(ItemOnGroundEntity* this) { void sub_08081500(ItemOnGroundEntity* this) {
if (this->unk_68 == 0) { if (this->unk_68 == 0) {
u32 var0 = sub_080044EC(super, 0x2800); u32 var0 = BounceUpdate(super, Q_8_8(40.0));
if (var0 == 0) { if (var0 == 0) {
this->unk_68 = 1; this->unk_68 = 1;
} else { } else {

View File

@ -163,7 +163,7 @@ void KeyStealingTakkuri_Type5_Init(KeyStealingTakkuriEntity* this) {
void KeyStealingTakkuri_Type5_Action1(KeyStealingTakkuriEntity* this) { void KeyStealingTakkuri_Type5_Action1(KeyStealingTakkuriEntity* this) {
LinearMoveUpdate(super); LinearMoveUpdate(super);
if (sub_080044EC(super, 0x2000) < 2) { if (BounceUpdate(super, Q_8_8(32.0)) < BOUNCE_AIRBORNE) {
if (super->timer != 0) { if (super->timer != 0) {
super->timer--; super->timer--;
super->zVelocity = Q_16_16(1.0); super->zVelocity = Q_16_16(1.0);

View File

@ -386,7 +386,7 @@ void sub_08085B40(LilypadLargeEntity* this) {
} }
} else { } else {
ResetCollisionLayer(super); ResetCollisionLayer(super);
if (GetTileUnderEntity(super) == 0xd) { if (GetActTile(super) == 0xd) {
ResetCollisionLayer(&gPlayerEntity.base); ResetCollisionLayer(&gPlayerEntity.base);
LilypadLarge_Action4(this); LilypadLarge_Action4(this);
super->direction = GetFacingDirection(&gPlayerEntity.base, super); super->direction = GetFacingDirection(&gPlayerEntity.base, super);
@ -408,7 +408,7 @@ void sub_08085B40(LilypadLargeEntity* this) {
super->timer |= 0x80; super->timer |= 0x80;
this->unk_70 = 0; this->unk_70 = 0;
this->unk_6c = 0; this->unk_6c = 0;
if (GetTileUnderEntity(super) == 0xd) { if (GetActTile(super) == 0xd) {
super->action = 4; super->action = 4;
} }
} }

View File

@ -129,7 +129,7 @@ void Mask_Action2(MaskEntity* this) {
CreateRandomItemDrop(super, 3); CreateRandomItemDrop(super, 3);
} else { } else {
sub_080044EC(super, this->unk_78); BounceUpdate(super, this->unk_78);
if (super->z.HALF.HI == 0) { if (super->z.HALF.HI == 0) {
super->timer++; super->timer++;

View File

@ -199,7 +199,7 @@ void Minecart_Action3(MinecartEntity* this) {
case 0x6d: case 0x6d:
case 0x6e: case 0x6e:
case 0x6f: case 0x6f:
if (uVar3 == GetTileUnderEntity(super)) { if (uVar3 == GetActTile(super)) {
Minecart_Action4(this); Minecart_Action4(this);
gPlayerEntity.base.animationState = super->animationState << 1; gPlayerEntity.base.animationState = super->animationState << 1;
return; return;
@ -221,7 +221,7 @@ void Minecart_Action3(MinecartEntity* this) {
void Minecart_Action4(MinecartEntity* this) { void Minecart_Action4(MinecartEntity* this) {
sub_08004168(super); sub_08004168(super);
CopyPosition(super, &gPlayerEntity.base); CopyPosition(super, &gPlayerEntity.base);
switch (GetTileUnderEntity(super)) { switch (GetActTile(super)) {
case 0x67: case 0x67:
if (super->direction == DirectionWest) { if (super->direction == DirectionWest) {
super->direction = DirectionNorth; super->direction = DirectionNorth;

View File

@ -51,7 +51,7 @@ void ObjectA2_Action1(Entity* this) {
LinearMoveUpdate(this); LinearMoveUpdate(this);
#ifndef EU #ifndef EU
if (gSaveHeader->language < 2) { 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->z.WORD = 0;
this->action = 2; this->action = 2;
InitializeAnimation(this, 1); InitializeAnimation(this, 1);
@ -61,15 +61,15 @@ void ObjectA2_Action1(Entity* this) {
} }
} else { } else {
#endif #endif
switch (sub_080044EC(this, 0x2000)) { switch (BounceUpdate(this, Q_8_8(32.0))) {
default: default:
this->timer++; this->timer++;
break; break;
case 0: case BOUNCE_DONE_ALL:
this->action = 2; this->action = 2;
InitializeAnimation(this, 1); InitializeAnimation(this, 1);
// fall through // fall through
case 1: case BOUNCE_INIT_NEXT:
this->timer = 0; this->timer = 0;
sub_0809F448(this); sub_0809F448(this);
SoundReq(SFX_186); SoundReq(SFX_186);

View File

@ -208,7 +208,7 @@ void sub_080970F4(ObjectOnPillarEntity* this) {
bool32 sub_08097144(ObjectOnPillarEntity* this) { bool32 sub_08097144(ObjectOnPillarEntity* this) {
LinearMoveUpdate(super); LinearMoveUpdate(super);
sub_0800445C(super); sub_0800445C(super);
if (GetTileUnderEntity(super) == 0x19) { if (GetActTile(super) == 0x19) {
super->spriteOffsetY = 2; super->spriteOffsetY = 2;
} }
if ((--this->unk_76 == 0) && sub_08097194(this) == FALSE) { if ((--this->unk_76 == 0) && sub_08097194(this) == FALSE) {

View File

@ -109,7 +109,7 @@ void PlayerClone_Action2(PlayerCloneEntity* this) {
if (gPlayerEntity.base.iframes >= 1) { if (gPlayerEntity.base.iframes >= 1) {
gPlayerState.chargeState.action = 1; gPlayerState.chargeState.action = 1;
} else { } else {
GetTileUnderEntity(super); GetActTile(super);
sub_08084B1C(this); sub_08084B1C(this);
super->x.HALF.HI = gPlayerEntity.base.x.HALF.HI + this->unk78; super->x.HALF.HI = gPlayerEntity.base.x.HALF.HI + this->unk78;
super->y.HALF.HI = gPlayerEntity.base.y.HALF.HI + this->unk7a; super->y.HALF.HI = gPlayerEntity.base.y.HALF.HI + this->unk7a;

View File

@ -25,7 +25,7 @@ typedef struct {
} PotEntity; } PotEntity;
void Pot_Action5(PotEntity*); void Pot_Action5(PotEntity*);
static void sub_08082850(PotEntity*, Entity*); static void BreakPot(PotEntity*, Entity*);
void sub_08082608(PotEntity* this); void sub_08082608(PotEntity* this);
void Pot_Init(PotEntity* this); void Pot_Init(PotEntity* this);
void Pot_Action1(PotEntity* this); void Pot_Action1(PotEntity* this);
@ -128,13 +128,13 @@ void Pot_Action1(PotEntity* this) {
DeleteThisEntity(); DeleteThisEntity();
break; break;
default: default:
if (GetTileUnderEntity(super) == 13) { if (GetActTile(super) == 13) {
CreateFx(super, FX_FALL_DOWN, 0); CreateFx(super, FX_FALL_DOWN, 0);
} else if (tileType == 0x4005) { } else if (tileType == 0x4005) {
gPlayerState.lastSwordMove = SWORD_MOVE_BREAK_POT; gPlayerState.lastSwordMove = SWORD_MOVE_BREAK_POT;
SetTile((u16)this->unk_70, COORD_TO_TILE(super), super->collisionLayer); SetTile((u16)this->unk_70, COORD_TO_TILE(super), super->collisionLayer);
} }
sub_08082850(this, NULL); BreakPot(this, NULL);
break; break;
} }
} else { } else {
@ -181,7 +181,7 @@ void sub_0808259C(PotEntity* this) {
CreateFx(super, FX_LAVA_SPLASH, 0); CreateFx(super, FX_LAVA_SPLASH, 0);
break; break;
default: default:
sub_08082850(this, &gPlayerEntity.base); BreakPot(this, &gPlayerEntity.base);
return; return;
} }
@ -227,7 +227,7 @@ void Pot_Action4(PotEntity* this) {
switch (tileType) { switch (tileType) {
case 0x71: case 0x71:
case 0x72: case 0x72:
sub_08082850(this, NULL); BreakPot(this, NULL);
break; break;
default: default:
SetTile(0x4000, COORD_TO_TILE(super), super->collisionLayer); 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) { if ((gPlayerState.field_0x1c & 0xF) != 0x1 || (super->contactFlags & 0x7F) != 0x13) {
sub_08082850(this, NULL); BreakPot(this, NULL);
} else { } else {
sub_0806F3E4(super); sub_0806F3E4(super);
} }
@ -276,7 +276,7 @@ void sub_08082778(PotEntity* this) {
void sub_080827F8(PotEntity* this) { void sub_080827F8(PotEntity* this) {
if (gPlayerState.field_0x1c == 0) { 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) { void sub_08082818(PotEntity* this) {
sub_08082850(this, NULL); BreakPot(this, NULL);
} }
void Pot_Action5(PotEntity* this) { void Pot_Action5(PotEntity* this) {
@ -293,11 +293,11 @@ void Pot_Action5(PotEntity* this) {
} }
if (GravityUpdate(super, Q_8_8(32.0)) == 0) { 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); u32 parameter = sub_0808288C(super, super->type, this->unk_7d, super->type2);
Entity* fxEntity = CreateFx(super, FX_POT_SHATTER, parameter); Entity* fxEntity = CreateFx(super, FX_POT_SHATTER, parameter);
if (fxEntity) { if (fxEntity) {

View File

@ -45,7 +45,7 @@ void Rupee_Action_1(Entity* this) {
if (this->child->next == NULL) { if (this->child->next == NULL) {
this->action = 2; this->action = 2;
} else { } else {
if (sub_080044EC(this, 10240) == 0) { if (BounceUpdate(this, Q_8_8(40.0)) == BOUNCE_DONE_ALL) {
this->action = 2; this->action = 2;
} }
ProcessMovement0(this); ProcessMovement0(this);

View File

@ -1976,7 +1976,7 @@ static void PlayerRoomTransition(PlayerEntity* this) {
static void sub_080724DC(PlayerEntity* this) { static void sub_080724DC(PlayerEntity* this) {
super->knockbackDuration = 0; super->knockbackDuration = 0;
DeleteClones(); DeleteClones();
if (GetTileUnderEntity(super) != 0x29) { if (GetActTile(super) != 0x29) {
if ((gPlayerState.remainingDiveTime == 0) && (gPlayerState.swim_state != 0)) { if ((gPlayerState.remainingDiveTime == 0) && (gPlayerState.swim_state != 0)) {
PlayerUpdateSwimming(super); PlayerUpdateSwimming(super);
} }
@ -2620,7 +2620,7 @@ static void PlayerUseStairs(PlayerEntity* this) {
static void sub_080732D0(PlayerEntity* this) { static void sub_080732D0(PlayerEntity* this) {
UpdateAnimationSingleFrame(super); UpdateAnimationSingleFrame(super);
if (GetTileUnderEntity(super) != 40) { if (GetActTile(super) != 40) {
super->direction = DirectionNorth; super->direction = DirectionNorth;
LinearMoveUpdate(super); LinearMoveUpdate(super);
} else { } else {
@ -4107,7 +4107,7 @@ void sub_0807529C(PlayerEntity* this) {
void sub_080752AC(PlayerEntity* this, ScriptExecutionContext* ctx) { void sub_080752AC(PlayerEntity* this, ScriptExecutionContext* ctx) {
LinearMoveUpdate(super); LinearMoveUpdate(super);
if (!ctx->unk_18) { if (!ctx->unk_18) {
if (GetTileUnderEntity(super) != 41) { if (GetActTile(super) != 41) {
ctx->unk_18 = 1; ctx->unk_18 = 1;
ctx->unk_19 = 6; ctx->unk_19 = 6;
} }

View File

@ -135,7 +135,7 @@ void PlayerItemHeldObject_SubAction2(PlayerItemHeldObjectEntity* this) {
(child->base).x = super->x; (child->base).x = super->x;
(child->base).y = super->y; (child->base).y = super->y;
(child->base).z = super->z; (child->base).z = super->z;
tile = GetTileUnderEntity(super); tile = GetActTile(super);
switch (tile) { switch (tile) {
case 0xd: case 0xd:
case 0x10: case 0x10:

View File

@ -127,7 +127,7 @@ void PlayerItemPacciCaneProjectile_Action1(PlayerItemPacciCaneProjectileEntity*
} }
if (sub_080B1BA4(COORD_TO_TILE(super), gPlayerEntity.base.collisionLayer, 0x80) == 0) { 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 (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; super->action = 4;
COLLISION_OFF(super); COLLISION_OFF(super);
super->x.HALF.HI = (super->x.HALF.HI & 0xfff0) | 8; super->x.HALF.HI = (super->x.HALF.HI & 0xfff0) | 8;

View File

@ -2350,7 +2350,7 @@ bool32 sub_08079D48(void) {
return TRUE; return TRUE;
} else { } else {
if (!PlayerCheckNEastTile()) { if (!PlayerCheckNEastTile()) {
if (!sub_08007DD6((u16)GetTileUnderEntity(&gPlayerEntity.base), gUnk_0811C268)) { if (!sub_08007DD6((u16)GetActTile(&gPlayerEntity.base), gUnk_0811C268)) {
return TRUE; return TRUE;
} }
} }

View File

@ -70,7 +70,7 @@ void BoneProjectile_Action3(Entity* this) {
this->spriteSettings.draw ^= 1; this->spriteSettings.draw ^= 1;
LinearMoveUpdate(this); LinearMoveUpdate(this);
GetNextFrame(this); GetNextFrame(this);
if (sub_080044EC(this, 0x1800) == 0) { if (BounceUpdate(this, Q_8_8(24.0)) == BOUNCE_DONE_ALL) {
DeleteEntity(this); DeleteEntity(this);
} }
} }

View File

@ -115,11 +115,11 @@ void DekuSeedProjectile_Action3(Entity* this) {
void DekuSeedProjectile_Action4(Entity* this) { void DekuSeedProjectile_Action4(Entity* this) {
GetNextFrame(this); GetNextFrame(this);
ProcessMovement3(this); ProcessMovement3(this);
switch (sub_080044EC(this, 0x2800)) { switch (BounceUpdate(this, Q_8_8(40.0))) {
case 0: case BOUNCE_DONE_ALL:
DeleteThisEntity(); DeleteThisEntity();
return; return;
case 1: case BOUNCE_INIT_NEXT:
COLLISION_OFF(this); COLLISION_OFF(this);
this->speed = 0x120; this->speed = 0x120;

View File

@ -132,7 +132,7 @@ void DirtBallProjectile_Action2(Entity* this) {
FreeCarryEntity(entity); FreeCarryEntity(entity);
CopyPosition(this, entity); CopyPosition(this, entity);
} }
if (sub_080044EC(this, 0x2800) != 1) { if (BounceUpdate(this, Q_8_8(40.0)) != BOUNCE_INIT_NEXT) {
return; return;
} }

View File

@ -66,11 +66,11 @@ void RockProjectile_Action2(Entity* this) {
void RockProjectile_Action3(Entity* this) { void RockProjectile_Action3(Entity* this) {
GetNextFrame(this); GetNextFrame(this);
ProcessMovement3(this); ProcessMovement3(this);
switch (sub_080044EC(this, 0x2800)) { switch (BounceUpdate(this, Q_8_8(40.0))) {
case 0: case BOUNCE_DONE_ALL:
DeleteEntity(this); DeleteEntity(this);
return; return;
case 1: case BOUNCE_INIT_NEXT:
COLLISION_OFF(this); COLLISION_OFF(this);
this->speed = 0x120; this->speed = 0x120;
if (sub_0800442E(this) != 0) { if (sub_0800442E(this) != 0) {