Merge pull request #575 from BlinkingBerry/main

Documenting some more entities' code
This commit is contained in:
Pierre de La Morinerie 2024-08-06 17:15:25 +02:00 committed by GitHub
commit c25c849600
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
52 changed files with 634 additions and 587 deletions

View File

@ -715,15 +715,15 @@ UpdateLinkWalkingAnimation_trampoline::
call UpdateLinkWalkingAnimation ; $0BF5: $CD $50 $1A
jp ReloadSavedBank ; $0BF8: $C3 $1D $08
; Retrieve the drop timer for the given entity.
; Retrieve the slow transition countdown for the given entity.
; Input:
; bc entity index
; Output:
; hl address of the drop timer for this entity
; a value of the drop timer for this entity
; z whether the drop timer is zero
GetEntityDropTimer::
ld hl, wEntitiesDropTimerTable ; $0BFB: $21 $50 $C4
; hl address of the slow transition countdown for this entity
; a value of the slow transition countdown for this entity
; z whether the slow transition countdown is zero
GetEntitySlowTransitionCountdown::
ld hl, wEntitiesSlowTransitionCountdownTable ; $0BFB: $21 $50 $C4
jr IsZero ; $0BFE: $18 $08
; Retrieve the private counter 1 for the given entity.
@ -2455,7 +2455,7 @@ label_1653::
ldh a, [hIntersectedObjectTop] ; $16A2: $F0 $CD
add a, $10 ; $16A4: $C6 $10
ld [hl], a ; $16A6: $77
ld hl, wEntitiesDropTimerTable ; $16A7: $21 $50 $C4
ld hl, wEntitiesSlowTransitionCountdownTable ; $16A7: $21 $50 $C4
add hl, de ; $16AA: $19
ld [hl], $80 ; $16AB: $36 $80
ld hl, wEntitiesPrivateCountdown1Table ; $16AD: $21 $F0 $C2

View File

@ -749,18 +749,18 @@ UpdateEntityTimers::
dec [hl] ; $4DCB: $35
.unknownCountdownEnd
; Every 4 frames, if entity drop timer > 0, decrement it
; Every 4 frames, if slow transition countdown > 0, decrement it
ldh a, [hFrameCounter] ; $4DCC: $F0 $E7
and $03 ; $4DCE: $E6 $03
jr nz, .dropTimerEnd ; $4DD0: $20 $0
jr nz, .slowTransitionCountdownEnd ; $4DD0: $20 $0
ld hl, wEntitiesDropTimerTable ; $4DD2: $21 $50 $C4
ld hl, wEntitiesSlowTransitionCountdownTable ; $4DD2: $21 $50 $C4
add hl, bc ; $4DD5: $09
ld a, [hl] ; $4DD6: $7E
and a ; $4DD7: $A7
jr z, .dropTimerEnd ; $4DD8: $28 $0
jr z, .slowTransitionCountdownEnd ; $4DD8: $28 $0
dec [hl] ; $4DDA: $35
.dropTimerEnd
.slowTransitionCountdownEnd
; If flash countdown > 0, decrement it
ld hl, wEntitiesFlashCountdownTable ; $4DDB: $21 $20 $C4
@ -1059,7 +1059,7 @@ func_014_50C3::
and ENTITY_PHYSICS_GRABBABLE ; $50D5: $E6 $20
jr z, .continue ; $50D7: $28 $38
; and the wEntitiesPrivateState3Table value != 2…
; and the wEntitiesPrivateState3Table value = 2…
ld hl, wEntitiesPrivateState3Table ; $50D9: $21 $D0 $C2
add hl, de ; $50DC: $19
ld a, [hl] ; $50DD: $7E
@ -1086,8 +1086,8 @@ func_014_50C3::
cp $10 ; $50FC: $FE $10
jr nc, .continue ; $50FE: $30 $11
; Set the drop timer to $80
ld hl, wEntitiesDropTimerTable ; $5100: $21 $50 $C4
; Set the slow transition countdown to $80
ld hl, wEntitiesSlowTransitionCountdownTable ; $5100: $21 $50 $C4
add hl, de ; $5103: $19
ld [hl], $80 ; $5104: $36 $80
; Clear the wEntitiesPrivateState3Table value
@ -1430,12 +1430,12 @@ Data_014_54F0::
db $00, $00, $00, $00, $00, $02, $00, $FE
func_014_54F8::
ld a, [wC178] ; $54F8: $FA $78 $C1
ld a, [wPegasusBootsCollisionCountdown] ; $54F8: $FA $78 $C1
and a ; $54FB: $A7
jr z, .jr_5502 ; $54FC: $28 $04
dec a ; $54FE: $3D
ld [wC178], a ; $54FF: $EA $78 $C1
ld [wPegasusBootsCollisionCountdown], a ; $54FF: $EA $78 $C1
.jr_5502
ld a, [wScreenShakeCountdown] ; $5502: $FA $57 $C1

View File

@ -1810,7 +1810,7 @@ label_002_4C92:
ld d, $00 ; $4C95: $16 $00
ld hl, wRoomObjects ; $4C97: $21 $11 $D7
add hl, de ; $4C9A: $19
ld [hl], $CC ; $4C9B: $36 $CC
ld [hl], OBJECT_SHOVEL_HOLE ; $4C9B: $36 $CC
ld a, $82 ; $4C9D: $3E $82
call BackupObjectInRAM2 ; $4C9F: $CD $2F $0B
call label_2887 ; $4CA2: $CD $87 $28
@ -1865,7 +1865,7 @@ jr_002_4CC1:
ldh a, [hIntersectedObjectTop] ; $4CEF: $F0 $CD
add $10 ; $4CF1: $C6 $10
ld [hl], a ; $4CF3: $77
ld hl, wEntitiesDropTimerTable ; $4CF4: $21 $50 $C4
ld hl, wEntitiesSlowTransitionCountdownTable ; $4CF4: $21 $50 $C4
add hl, de ; $4CF7: $19
ld [hl], $80 ; $4CF8: $36 $80
ld hl, wEntitiesPrivateCountdown1Table ; $4CFA: $21 $F0 $C2

View File

@ -831,37 +831,37 @@ CheckPushedTombStone::
pop bc ; $49B0: $C1
ret ; $49B1: $C9
LinkDirectionTowC179::
PegasusBootsCollisionXOffsets::
.right: db $10
.left: db $F0
.up: db $08
.down: db $08
LinkDirectionTowC17A::
PegasusBootsCollisionYOffsets::
.right: db $0C
.left: db $0C
.up: db $F0
.down: db $10
func_020_49BA::
; wC179 = [LinkDirectionTowC179 + Linkdirection] + hLinkPositionX
; wPegasusBootsCollisionPosX = [PegasusBootsCollisionXOffsets + Linkdirection] + hLinkPositionX
ldh a, [hLinkDirection] ; $49BA: $F0 $9E
ld e, a ; $49BC: $5F
ld d, $00 ; $49BD: $16 $00
ld hl, LinkDirectionTowC179 ; $49BF: $21 $B2 $49
ld hl, PegasusBootsCollisionXOffsets ; $49BF: $21 $B2 $49
add hl, de ; $49C2: $19
ldh a, [hLinkPositionX] ; $49C3: $F0 $98
add [hl] ; $49C5: $86
ld [wC179], a ; $49C6: $EA $79 $C1
; wC17A = [LinkDirectionTowC17A + Linkdirection] + hLinkPositionY
ld hl, LinkDirectionTowC17A ; $49C9: $21 $B6 $49
ld [wPegasusBootsCollisionPosX], a ; $49C6: $EA $79 $C1
; wPegasusBootsCollisionPosY = [PegasusBootsCollisionYOffsets + Linkdirection] + hLinkPositionY
ld hl, PegasusBootsCollisionYOffsets ; $49C9: $21 $B6 $49
add hl, de ; $49CC: $19
ldh a, [hLinkPositionY] ; $49CD: $F0 $99
add [hl] ; $49CF: $86
ld [wC17A], a ; $49D0: $EA $7A $C1
; wC178 = 2
ld [wPegasusBootsCollisionPosY], a ; $49D0: $EA $7A $C1
; wPegasusBootsCollisionCountdown = 2
ld a, $02 ; $49D3: $3E $02
ld [wC178], a ; $49D5: $EA $78 $C1
ld [wPegasusBootsCollisionCountdown], a ; $49D5: $EA $78 $C1
ret ; $49D8: $C9
; Load BG palette data

View File

@ -2147,7 +2147,7 @@ jr_017_557A:
ld hl, wEntitiesPhysicsFlagsTable ; $55C9: $21 $40 $C3
add hl, de ; $55CC: $19
ld [hl], 2 | ENTITY_PHYSICS_HARMLESS | ENTITY_PHYSICS_PROJECTILE_NOCLIP ; $55CD: $36 $C2
ld hl, wEntitiesDropTimerTable ; $55CF: $21 $50 $C4
ld hl, wEntitiesSlowTransitionCountdownTable ; $55CF: $21 $50 $C4
add hl, de ; $55D2: $19
ld [hl], $20 ; $55D3: $36 $20
ld a, c ; $55D5: $79
@ -6118,7 +6118,7 @@ func_017_79A7::
call func_017_7A01 ; $79B0: $CD $01 $7A
ld de, Data_017_7987 ; $79B3: $11 $87 $79
call func_017_7A29 ; $79B6: $CD $29 $7A
call GetEntityDropTimer ; $79B9: $CD $FB $0B
call GetEntitySlowTransitionCountdown ; $79B9: $CD $FB $0B
ret z ; $79BC: $C8
call UpdateEntityPosWithSpeed_17 ; $79BD: $CD $2D $7E

View File

@ -31,7 +31,7 @@ BombEntityHandler::
call func_003_6711 ; $66BF: $CD $11 $67
call CheckForEntityFallingDownQuicksandHole ; $66C2: $CD $EA $5C
call ReturnIfNonInteractive_03 ; $66C5: $CD $78 $7F
call func_003_60B3 ; $66C8: $CD $B3 $60
call BouncingEntityPhysics ; $66C8: $CD $B3 $60
ld hl, wEntitiesPrivateCountdown2Table ; $66CB: $21 $00 $C3
add hl, bc ; $66CE: $09
ld [hl], $FF ; $66CF: $36 $FF

View File

@ -2,13 +2,13 @@ data_003_6157::
db $20, $21, $20, $01
DroppableFairyEntityHandler::
call func_003_61DE ; $615B: $CD $DE $61
call func_003_608C ; $615E: $CD $8C $60
call DroppableRevealOrReturnIfNeeded ; $615B: $CD $DE $61
call DroppableDisappearIfNeeded ; $615E: $CD $8C $60
ld de, data_003_6157 ; $6161: $11 $57 $61
call RenderActiveEntitySprite ; $6164: $CD $77 $3C
call ReturnIfNonInteractive_03 ; $6167: $CD $78 $7F
call func_003_62AF ; $616A: $CD $AF $62
call func_003_62EB ; $616D: $CD $EB $62
call PickableHandleGrabbedByItemIfNeeded ; $616A: $CD $AF $62
call PickableCollectIfNeeded ; $616D: $CD $EB $62
ld hl, wEntitiesSpeedXTable ; $6170: $21 $40 $C2
add hl, bc ; $6173: $09
ld a, [hl] ; $6174: $7E

View File

@ -39,7 +39,7 @@ LiftableRockEntityHandler::
ld hl, wEntitiesPosZTable ; $535E: $21 $10 $C3
add hl, de ; $5361: $19
ld [hl], a ; $5362: $77
ld hl, wEntitiesDropTimerTable ; $5363: $21 $50 $C4
ld hl, wEntitiesSlowTransitionCountdownTable ; $5363: $21 $50 $C4
add hl, de ; $5366: $19
ld [hl], $80 ; $5367: $36 $80
@ -125,7 +125,7 @@ ENDC
ld a, $0B ; $53BC: $3E $0B
ld [wC19E], a ; $53BE: $EA $9E $C1
call func_003_75A2 ; $53C1: $CD $A2 $75
call func_003_60B3 ; $53C4: $CD $B3 $60
call BouncingEntityPhysics ; $53C4: $CD $B3 $60
ld hl, wEntitiesStatusTable ; $53C7: $21 $80 $C2
add hl, bc ; $53CA: $09
ld a, [hl] ; $53CB: $7E

View File

@ -44,11 +44,11 @@ TimerBombiteEntityHandler::
ld de, Bombite1SpriteVariants ; $7D1F: $11 $EF $7C
ldh a, [hMapId] ; $7D22: $F0 $F7
cp MAP_TURTLE_ROCK ; $7D24: $FE $07
jr nz, .jr_7D2B ; $7D26: $20 $03
jr nz, .render ; $7D26: $20 $03
ld de, Bombite2SpriteVariants ; $7D28: $11 $07 $7D
.jr_7D2B
.render
call GetEntityPrivateCountdown1 ; $7D2B: $CD $00 $0C
rla ; $7D2E: $17
rla ; $7D2F: $17
@ -61,35 +61,35 @@ TimerBombiteEntityHandler::
add hl, bc ; $7D3E: $09
ld a, [hl] ; $7D3F: $7E
cp $08 ; $7D40: $FE $08
jr nz, .jr_7D51 ; $7D42: $20 $0D
jr nz, .skipIncrementState ; $7D42: $20 $0D
ldh a, [hActiveEntityState] ; $7D44: $F0 $F0
and a ; $7D46: $A7
jr nz, .jr_7D51 ; $7D47: $20 $08
jr nz, .skipIncrementState ; $7D47: $20 $08
call IncrementEntityState ; $7D49: $CD $12 $3B
call GetEntityDropTimer ; $7D4C: $CD $FB $0B
call GetEntitySlowTransitionCountdown ; $7D4C: $CD $FB $0B
ld [hl], $6F ; $7D4F: $36 $6F
.jr_7D51
.skipIncrementState
call ApplyRecoilIfNeeded_04 ; $7D51: $CD $80 $6D
call UpdateEntityPosWithSpeed_04 ; $7D54: $CD $CA $6D
call DefaultEntityPhysics_trampoline ; $7D57: $CD $23 $3B
ldh a, [hActiveEntityState] ; $7D5A: $F0 $F0
JP_TABLE ; $7D5C
._00 dw func_004_7D69 ; $7D5D
._01 dw func_004_7DA3 ; $7D5F
._00 dw TimerBombiteWalkingHandler ; $7D5D
._01 dw TimerBombiteLitHandler ; $7D5F
Data_004_7D61::
TimerBombiteSpeedXPerDirection::
db $08, $F8, $00, $00
Data_004_7D65::
TimerBombiteSpeedYPerDirection::
db $00, $00, $F8, $00
func_004_7D69::
TimerBombiteWalkingHandler::
call DefaultEnemyDamageCollisionHandler_trampoline ; $7D69: $CD $39 $3B
call GetEntityTransitionCountdown ; $7D6C: $CD $05 $0C
jr nz, .jr_7D91 ; $7D6F: $20 $20
jr nz, .chooseDirectionEnd ; $7D6F: $20 $20
call GetRandomByte ; $7D71: $CD $0D $28
and $1F ; $7D74: $E6 $1F
@ -98,20 +98,20 @@ func_004_7D69::
and $03 ; $7D79: $E6 $03
ld e, a ; $7D7B: $5F
ld d, b ; $7D7C: $50
ld hl, Data_004_7D61 ; $7D7D: $21 $61 $7D
ld hl, TimerBombiteSpeedXPerDirection ; $7D7D: $21 $61 $7D
add hl, de ; $7D80: $19
ld a, [hl] ; $7D81: $7E
ld hl, wEntitiesSpeedXTable ; $7D82: $21 $40 $C2
add hl, bc ; $7D85: $09
ld [hl], a ; $7D86: $77
ld hl, Data_004_7D65 ; $7D87: $21 $65 $7D
ld hl, TimerBombiteSpeedYPerDirection ; $7D87: $21 $65 $7D
add hl, de ; $7D8A: $19
ld a, [hl] ; $7D8B: $7E
ld hl, wEntitiesSpeedYTable ; $7D8C: $21 $50 $C2
add hl, bc ; $7D8F: $09
ld [hl], a ; $7D90: $77
.jr_7D91
.chooseDirectionEnd
ldh a, [hFrameCounter] ; $7D91: $F0 $E7
rra ; $7D93: $1F
rra ; $7D94: $1F
@ -120,57 +120,58 @@ func_004_7D69::
and $01 ; $7D97: $E6 $01
jp SetEntitySpriteVariant ; $7D99: $C3 $0C $3B
Data_004_7D9C::
; Sprite variants for countdown animation
TimerBombiteCountdownAnimation::
db $05, $05, $04, $03, $02, $02, $02
func_004_7DA3::
TimerBombiteLitHandler::
ld a, [wIsRunningWithPegasusBoots] ; $7DA3: $FA $4A $C1
and a ; $7DA6: $A7
jr z, .jr_7DAE ; $7DA7: $28 $05
jr z, .linkNotRunning ; $7DA7: $28 $05
call IncrementEntityState ; $7DA9: $CD $12 $3B
ld [hl], b ; $7DAC: $70
ret ; $7DAD: $C9
.jr_7DAE
.linkNotRunning
call label_3B70 ; $7DAE: $CD $70 $3B
call func_004_6E35 ; $7DB1: $CD $35 $6E
call GetEntityXDistanceToLink_04 ; $7DB1: $CD $35 $6E
add $12 ; $7DB4: $C6 $12
cp $24 ; $7DB6: $FE $24
jr nc, .jr_7DC3 ; $7DB8: $30 $09
jr nc, .chaseLink ; $7DB8: $30 $09
call func_004_6E45 ; $7DBA: $CD $45 $6E
call GetEntityYDistanceToLink_04 ; $7DBA: $CD $45 $6E
add $12 ; $7DBD: $C6 $12
cp $24 ; $7DBF: $FE $24
jr c, jr_004_7DD1 ; $7DC1: $38 $0E
jr c, .chaseLinkEnd ; $7DC1: $38 $0E
.jr_7DC3
.chaseLink
ldh a, [hFrameCounter] ; $7DC3: $F0 $E7
xor c ; $7DC5: $A9
and $03 ; $7DC6: $E6 $03
jr nz, .jr_7DCF ; $7DC8: $20 $05
jr nz, .skipUpdateSpeed ; $7DC8: $20 $05
ld a, $0E ; $7DCA: $3E $0E
call ApplyVectorTowardsLink_trampoline ; $7DCC: $CD $AA $3B
.jr_7DCF
jr jr_004_7DD4 ; $7DCF: $18 $03
.skipUpdateSpeed
jr .skipClearSpeed ; $7DCF: $18 $03
jr_004_7DD1:
.chaseLinkEnd
call ClearEntitySpeed ; $7DD1: $CD $7F $3D
jr_004_7DD4:
call GetEntityDropTimer ; $7DD4: $CD $FB $0B
jp z, jr_004_7EBA ; $7DD7: $CA $BA $7E
.skipClearSpeed
call GetEntitySlowTransitionCountdown ; $7DD4: $CD $FB $0B
jp z, BombiteExplodeAndDisappear ; $7DD7: $CA $BA $7E
cp $18 ; $7DDA: $FE $18
jr nz, .jr_7DE5 ; $7DDC: $20 $07
jr nz, .startFlashingEnd ; $7DDC: $20 $07
ld [hl], $0A ; $7DDE: $36 $0A
call GetEntityPrivateCountdown1 ; $7DE0: $CD $00 $0C
ld [hl], $30 ; $7DE3: $36 $30
.jr_7DE5
.startFlashingEnd
rra ; $7DE5: $1F
rra ; $7DE6: $1F
rra ; $7DE7: $1F
@ -178,7 +179,7 @@ jr_004_7DD4:
and $07 ; $7DE9: $E6 $07
ld e, a ; $7DEB: $5F
ld d, b ; $7DEC: $50
ld hl, Data_004_7D9C ; $7DED: $21 $9C $7D
ld hl, TimerBombiteCountdownAnimation ; $7DED: $21 $9C $7D
add hl, de ; $7DF0: $19
ld a, [hl] ; $7DF1: $7E
jp SetEntitySpriteVariant ; $7DF2: $C3 $0C $3B
@ -201,21 +202,21 @@ BouncingBombite2SpriteVariants::
db $68, OAM_GBC_PAL_2 | OAMF_PAL0
db $6A, OAM_GBC_PAL_2 | OAMF_PAL0
Data_004_7E05::
BouncingBombiteSpeedXPerDirection::
db $08, $F8, $00, $00
Data_004_7E09::
BouncingBombiteSpeedYPerDirection::
db $00, $00, $F8, $08
BouncingBombiteEntityHandler::
ld de, BouncingBombite1SpriteVariants ; $7E0D: $11 $F5 $7D
ldh a, [hMapId] ; $7E10: $F0 $F7
cp MAP_TURTLE_ROCK ; $7E12: $FE $07
jr nz, .jr_7E19 ; $7E14: $20 $03
jr nz, .render ; $7E14: $20 $03
ld de, BouncingBombite2SpriteVariants ; $7E16: $11 $FD $7D
.jr_7E19
.render
call RenderActiveEntitySpritesPair ; $7E19: $CD $C0 $3B
call ReturnIfNonInteractive_04 ; $7E1C: $CD $A3 $7F
call ApplyRecoilIfNeeded_04 ; $7E1F: $CD $80 $6D
@ -229,17 +230,17 @@ BouncingBombiteEntityHandler::
call DefaultEntityPhysics_trampoline ; $7E2D: $CD $23 $3B
ldh a, [hActiveEntityState] ; $7E30: $F0 $F0
JP_TABLE ; $7E32
._00 dw func_004_7E39 ; $7E33
._01 dw func_004_7E4C ; $7E35
._02 dw func_004_7E83 ; $7E37
._00 dw BouncingBombiteWalkingHandler ; $7E33
._01 dw BouncingBombiteTurningHandler ; $7E35
._02 dw BouncingBombiteLitHandler ; $7E37
func_004_7E39::
BouncingBombiteWalkingHandler::
call GetEntityTransitionCountdown ; $7E39: $CD $05 $0C
jr nz, .jr_7E41 ; $7E3C: $20 $03
jr nz, .skipIncrementState ; $7E3C: $20 $03
call IncrementEntityState ; $7E3E: $CD $12 $3B
.jr_7E41
.skipIncrementState
ldh a, [hFrameCounter] ; $7E41: $F0 $E7
rra ; $7E43: $1F
rra ; $7E44: $1F
@ -248,28 +249,28 @@ func_004_7E39::
and $01 ; $7E47: $E6 $01
jp SetEntitySpriteVariant ; $7E49: $C3 $0C $3B
func_004_7E4C::
BouncingBombiteTurningHandler::
call GetRandomByte ; $7E4C: $CD $0D $28
and $03 ; $7E4F: $E6 $03
jr z, .jr_7E5A ; $7E51: $28 $07
jr z, .getDirectionToLink ; $7E51: $28 $07
call GetRandomByte ; $7E53: $CD $0D $28
and $03 ; $7E56: $E6 $03
jr jr_004_7E5D ; $7E58: $18 $03
jr .getDirectionToLinkEnd ; $7E58: $18 $03
.jr_7E5A
call func_004_6E55 ; $7E5A: $CD $55 $6E
.getDirectionToLink
call GetEntityDirectionToLink_04 ; $7E5A: $CD $55 $6E
jr_004_7E5D:
.getDirectionToLinkEnd
ld e, a ; $7E5D: $5F
ld d, b ; $7E5E: $50
ld hl, Data_004_7E05 ; $7E5F: $21 $05 $7E
ld hl, BouncingBombiteSpeedXPerDirection ; $7E5F: $21 $05 $7E
add hl, de ; $7E62: $19
ld a, [hl] ; $7E63: $7E
ld hl, wEntitiesSpeedXTable ; $7E64: $21 $40 $C2
add hl, bc ; $7E67: $09
ld [hl], a ; $7E68: $77
ld hl, Data_004_7E09 ; $7E69: $21 $09 $7E
ld hl, BouncingBombiteSpeedYPerDirection ; $7E69: $21 $09 $7E
add hl, de ; $7E6C: $19
ld a, [hl] ; $7E6D: $7E
ld hl, wEntitiesSpeedYTable ; $7E6E: $21 $50 $C2
@ -284,33 +285,33 @@ jr_004_7E5D:
ld [hl], b ; $7E81: $70
ret ; $7E82: $C9
func_004_7E83::
BouncingBombiteLitHandler::
call label_3B7B ; $7E83: $CD $7B $3B
call GetEntityTransitionCountdown ; $7E86: $CD $05 $0C
jr z, jr_004_7EBA ; $7E89: $28 $2F
jr z, BombiteExplodeAndDisappear ; $7E89: $28 $2F
ld hl, wEntitiesCollisionsTable ; $7E8B: $21 $A0 $C2
add hl, bc ; $7E8E: $09
ld a, [hl] ; $7E8F: $7E
and $03 ; $7E90: $E6 $03
jr nz, .jr_7E9B ; $7E92: $20 $07
jr nz, .horizontalCollision ; $7E92: $20 $07
ld a, [hl] ; $7E94: $7E
and $0C ; $7E95: $E6 $0C
jr nz, jr_004_7EA5 ; $7E97: $20 $0C
jr nz, .verticalCollision ; $7E97: $20 $0C
jr jr_004_7EB1 ; $7E99: $18 $16
jr .collisionEnd ; $7E99: $18 $16
.jr_7E9B
.horizontalCollision
ld hl, wEntitiesSpeedXTable ; $7E9B: $21 $40 $C2
add hl, bc ; $7E9E: $09
ld a, [hl] ; $7E9F: $7E
cpl ; $7EA0: $2F
inc a ; $7EA1: $3C
ld [hl], a ; $7EA2: $77
jr jr_004_7EAD ; $7EA3: $18 $08
jr .playBumpJingle ; $7EA3: $18 $08
jr_004_7EA5:
.verticalCollision
ld hl, wEntitiesSpeedYTable ; $7EA5: $21 $50 $C2
add hl, bc ; $7EA8: $09
ld a, [hl] ; $7EA9: $7E
@ -318,25 +319,25 @@ jr_004_7EA5:
inc a ; $7EAB: $3C
ld [hl], a ; $7EAC: $77
jr_004_7EAD:
.playBumpJingle
ld a, JINGLE_BUMP ; $7EAD: $3E $09
ldh [hJingle], a ; $7EAF: $E0 $F2
jr_004_7EB1:
.collisionEnd
ldh a, [hFrameCounter] ; $7EB1: $F0 $E7
rra ; $7EB3: $1F
rra ; $7EB4: $1F
and $01 ; $7EB5: $E6 $01
jp SetEntitySpriteVariant ; $7EB7: $C3 $0C $3B
jr_004_7EBA:
call func_004_7EC0 ; $7EBA: $CD $C0 $7E
BombiteExplodeAndDisappear:
call BombiteExplode ; $7EBA: $CD $C0 $7E
jp ClearEntityStatusBank04 ; $7EBD: $C3 $7A $6D
func_004_7EC0::
BombiteExplode::
ld a, ENTITY_BOMB ; $7EC0: $3E $02
call SpawnNewEntity_trampoline ; $7EC2: $CD $86 $3B
jr c, .ret_7EE4 ; $7EC5: $38 $1D
jr c, .return ; $7EC5: $38 $1D
call PlayBombExplosionSfx ; $7EC7: $CD $4B $0C
ldh a, [hMultiPurpose0] ; $7ECA: $F0 $D7
@ -354,5 +355,5 @@ func_004_7EC0::
add hl, de ; $7EE1: $19
ld [hl], $01 ; $7EE2: $36 $01
.ret_7EE4
.return
ret ; $7EE4: $C9

View File

@ -185,7 +185,7 @@ func_004_5158::
call IncrementEntityState ; $516C: $CD $12 $3B
call GetEntityPrivateCountdown1 ; $516F: $CD $00 $0C
ld [hl], $A0 ; $5172: $36 $A0
call GetEntityDropTimer ; $5174: $CD $FB $0B
call GetEntitySlowTransitionCountdown ; $5174: $CD $FB $0B
ld [hl], $FF ; $5177: $36 $FF
jp_open_dialog Dialog0B6 ; $5179
@ -249,7 +249,7 @@ jr_004_51FA:
add hl, de ; $5206: $19
ld a, [hl] ; $5207: $7E
ld [wScreenShakeHorizontal], a ; $5208: $EA $55 $C1
call GetEntityDropTimer ; $520B: $CD $FB $0B
call GetEntitySlowTransitionCountdown ; $520B: $CD $FB $0B
jr nz, jr_004_5273 ; $520E: $20 $63
call GetRandomByte ; $5210: $CD $0D $28
@ -573,12 +573,12 @@ FacadeState1Handler:
and a ; $549A: $A7
jr nz, .ret_54F0 ; $549B: $20 $53
call func_004_6E35 ; $549D: $CD $35 $6E
call GetEntityXDistanceToLink_04 ; $549D: $CD $35 $6E
add $08 ; $54A0: $C6 $08
cp $10 ; $54A2: $FE $10
jr nc, .ret_54F0 ; $54A4: $30 $4A
call func_004_6E45 ; $54A6: $CD $45 $6E
call GetEntityYDistanceToLink_04 ; $54A6: $CD $45 $6E
add $08 ; $54A9: $C6 $08
cp $10 ; $54AB: $FE $10
jr nc, .ret_54F0 ; $54AD: $30 $41
@ -596,12 +596,12 @@ FacadeState1Handler:
push bc ; $54C0: $C5
call UpdateFinalLinkPosition ; $54C1: $CD $A8 $21
pop bc ; $54C4: $C1
call func_004_6E35 ; $54C5: $CD $35 $6E
call GetEntityXDistanceToLink_04 ; $54C5: $CD $35 $6E
add $03 ; $54C8: $C6 $03
cp $06 ; $54CA: $FE $06
jr nc, .ret_54F0 ; $54CC: $30 $22
call func_004_6E45 ; $54CE: $CD $45 $6E
call GetEntityYDistanceToLink_04 ; $54CE: $CD $45 $6E
add $03 ; $54D1: $C6 $03
cp $06 ; $54D3: $FE $06
jr nc, .ret_54F0 ; $54D5: $30 $19

View File

@ -30,12 +30,12 @@ jr_004_5C16:
ld a, $FF ; $5C1B: $3E $FF
call SetEntitySpriteVariant ; $5C1D: $CD $0C $3B
call func_004_6E35 ; $5C20: $CD $35 $6E
call GetEntityXDistanceToLink_04 ; $5C20: $CD $35 $6E
add $10 ; $5C23: $C6 $10
cp $20 ; $5C25: $FE $20
jr nc, .ret_5C42 ; $5C27: $30 $19
call func_004_6E45 ; $5C29: $CD $45 $6E
call GetEntityYDistanceToLink_04 ; $5C29: $CD $45 $6E
add $10 ; $5C2C: $C6 $10
cp $20 ; $5C2E: $FE $20
jr nc, .ret_5C42 ; $5C30: $30 $10

View File

@ -54,12 +54,12 @@ func_004_69F3::
.jr_6A04
call UpdateEntityPosWithSpeed_04 ; $6A04: $CD $CA $6D
call DefaultEntityPhysics_trampoline ; $6A07: $CD $23 $3B
call func_004_6E35 ; $6A0A: $CD $35 $6E
call GetEntityXDistanceToLink_04 ; $6A0A: $CD $35 $6E
add $30 ; $6A0D: $C6 $30
cp $60 ; $6A0F: $FE $60
jr nc, jr_004_6A25 ; $6A11: $30 $12
call func_004_6E45 ; $6A13: $CD $45 $6E
call GetEntityYDistanceToLink_04 ; $6A13: $CD $45 $6E
add $30 ; $6A16: $C6 $30
cp $60 ; $6A18: $FE $60
jr nc, jr_004_6A25 ; $6A1A: $30 $09
@ -94,7 +94,7 @@ func_004_6A3D::
call GetEntityTransitionCountdown ; $6A3D: $CD $05 $0C
jr nz, .jr_6A67 ; $6A40: $20 $25
call func_004_6E55 ; $6A42: $CD $55 $6E
call GetEntityDirectionToLink_04 ; $6A42: $CD $55 $6E
ld hl, wEntitiesDirectionTable ; $6A45: $21 $80 $C3
add hl, bc ; $6A48: $09
ld [hl], e ; $6A49: $73

View File

@ -82,12 +82,12 @@ PairoddState0Handler::
.jr_004_5E4A
jr nc, .return ; $5E4A: $30 $26
call func_004_6E35 ; $5E4C: $CD $35 $6E
call GetEntityXDistanceToLink_04 ; $5E4C: $CD $35 $6E
add $20 ; $5E4F: $C6 $20
cp $40 ; $5E51: $FE $40
jr nc, .return ; $5E53: $30 $1D
call func_004_6E45 ; $5E55: $CD $45 $6E
call GetEntityYDistanceToLink_04 ; $5E55: $CD $45 $6E
add $20 ; $5E58: $C6 $20
cp $40 ; $5E5A: $FE $40
jr nc, .return ; $5E5C: $30 $14

View File

@ -44,7 +44,7 @@ ShopOwnerEntityHandler::
jr nz, jr_004_770E ; $7703: $20 $09
.jr_7705
call func_004_6E55 ; $7705: $CD $55 $6E
call GetEntityDirectionToLink_04 ; $7705: $CD $55 $6E
ld a, e ; $7708: $7B
ld hl, wEntitiesDirectionTable ; $7709: $21 $80 $C3
add hl, bc ; $770C: $09
@ -901,7 +901,7 @@ func_004_7C06::
cp $20 ; $7C1A: $FE $20
jr nc, .jr_7C49 ; $7C1C: $30 $2B
call func_004_6E55 ; $7C1E: $CD $55 $6E
call GetEntityDirectionToLink_04 ; $7C1E: $CD $55 $6E
ldh a, [hLinkDirection] ; $7C21: $F0 $9E
xor $01 ; $7C23: $EE $01
cp e ; $7C25: $BB

View File

@ -158,7 +158,7 @@ SlimeEyeState1Handler::
and a ; $4A5F: $A7
jr nz, .jr_4A67 ; $4A60: $20 $05
call GetEntityDropTimer ; $4A62: $CD $FB $0B
call GetEntitySlowTransitionCountdown ; $4A62: $CD $FB $0B
ld [hl], $14 ; $4A65: $36 $14
.jr_4A67
@ -554,7 +554,7 @@ jr_004_4E4F:
jp label_004_50EF ; $4E4F: $C3 $EF $50
func_004_4E52::
call GetEntityDropTimer ; $4E52: $CD $FB $0B
call GetEntitySlowTransitionCountdown ; $4E52: $CD $FB $0B
jr z, .ret_4E5F ; $4E55: $28 $08
ld a, $02 ; $4E57: $3E $02
@ -699,7 +699,7 @@ func_004_4EEB::
and a ; $4F3A: $A7
jr nz, .jr_4F49 ; $4F3B: $20 $0C
call GetEntityDropTimer ; $4F3D: $CD $FB $0B
call GetEntitySlowTransitionCountdown ; $4F3D: $CD $FB $0B
ld [hl], $0E ; $4F40: $36 $0E
ld hl, wEntitiesSpeedZTable ; $4F42: $21 $20 $C3
add hl, bc ; $4F45: $09

View File

@ -42,7 +42,7 @@ Data_004_6844::
db $00, $03, $01, $02
func_004_6848::
call GetEntityDropTimer ; $6848: $CD $FB $0B
call GetEntitySlowTransitionCountdown ; $6848: $CD $FB $0B
jr nz, .jr_6852 ; $684B: $20 $05
ld [hl], $10 ; $684D: $36 $10
@ -106,12 +106,12 @@ func_004_6848::
and a ; $68A2: $A7
jr nz, .jr_68D4 ; $68A3: $20 $2F
call func_004_6E35 ; $68A5: $CD $35 $6E
call GetEntityXDistanceToLink_04 ; $68A5: $CD $35 $6E
add $04 ; $68A8: $C6 $04
cp $08 ; $68AA: $FE $08
jr nc, .jr_68D4 ; $68AC: $30 $26
call func_004_6E45 ; $68AE: $CD $45 $6E
call GetEntityYDistanceToLink_04 ; $68AE: $CD $45 $6E
add $04 ; $68B1: $C6 $04
cp $08 ; $68B3: $FE $08
jr nc, .jr_68D4 ; $68B5: $30 $1D
@ -163,7 +163,7 @@ label_004_68E4:
ret ; $68FC: $C9
func_004_68FD::
call GetEntityDropTimer ; $68FD: $CD $FB $0B
call GetEntitySlowTransitionCountdown ; $68FD: $CD $FB $0B
jr nz, .jr_6908 ; $6900: $20 $06
ld [hl], $40 ; $6902: $36 $40

View File

@ -41,7 +41,7 @@ func_004_6E92::
and $1F ; $6EB5: $E6 $1F
jr nz, .jr_6EC1 ; $6EB7: $20 $08
call func_004_6E55 ; $6EB9: $CD $55 $6E
call GetEntityDirectionToLink_04 ; $6EB9: $CD $55 $6E
ld hl, wEntitiesDirectionTable ; $6EBC: $21 $80 $C3
add hl, bc ; $6EBF: $09
ld [hl], e ; $6EC0: $73
@ -370,7 +370,7 @@ jr_004_70A6:
and a ; $70AC: $A7
jr z, jr_004_70F4 ; $70AD: $28 $45
call GetEntityDropTimer ; $70AF: $CD $FB $0B
call GetEntitySlowTransitionCountdown ; $70AF: $CD $FB $0B
jr z, .jr_70B9 ; $70B2: $28 $05
dec a ; $70B4: $3D
@ -403,7 +403,7 @@ jr_004_70A6:
cp $28 ; $70DC: $FE $28
ret nz ; $70DE: $C0
call GetEntityDropTimer ; $70DF: $CD $FB $0B
call GetEntitySlowTransitionCountdown ; $70DF: $CD $FB $0B
ld [hl], $18 ; $70E2: $36 $18
ld a, [wMarinEntityIndex] ; $70E4: $FA $0F $C5
ld e, a ; $70E7: $5F
@ -488,7 +488,7 @@ jr_004_7152:
and a ; $7158: $A7
jr z, func_004_7160 ; $7159: $28 $05
call GetEntityDropTimer ; $715B: $CD $FB $0B
call GetEntitySlowTransitionCountdown ; $715B: $CD $FB $0B
ld [hl], $10 ; $715E: $36 $10
func_004_7160::
@ -534,7 +534,7 @@ func_004_7179::
jr_004_7198:
ld [wD203], a ; $7198: $EA $03 $D2
call GetEntityDropTimer ; $719B: $CD $FB $0B
call GetEntitySlowTransitionCountdown ; $719B: $CD $FB $0B
ret nz ; $719E: $C0
ld a, [wIsMarinFollowingLink] ; $719F: $FA $73 $DB
@ -1181,7 +1181,7 @@ func_004_7554::
ret ; $755B: $C9
func_004_755C::
call func_004_6E55 ; $755C: $CD $55 $6E
call GetEntityDirectionToLink_04 ; $755C: $CD $55 $6E
ld a, e ; $755F: $7B
xor $01 ; $7560: $EE $01
ld e, a ; $7562: $5F

View File

@ -242,7 +242,7 @@ Data_005_56F7::
db $60, $18
func_005_56F9::
call GetEntityDropTimer
call GetEntitySlowTransitionCountdown
jr nz, .jr_5713 ; $56FC: $20 $15
call GetEntityTransitionCountdown ; $56FE: $CD $05 $0C
@ -335,7 +335,7 @@ func_005_576E::
cp [hl] ; $5789: $BE
jr c, .ret_579B ; $578A: $38 $0F
call GetEntityDropTimer ; $578C: $CD $FB $0B
call GetEntitySlowTransitionCountdown ; $578C: $CD $FB $0B
call GetRandomByte ; $578F: $CD $0D $28
and $1F ; $5792: $E6 $1F
add $40 ; $5794: $C6 $40

View File

@ -1,5 +1,5 @@
Entity67Handler::
call GetEntityDropTimer ; $556B: $CD $FB $0B
call GetEntitySlowTransitionCountdown ; $556B: $CD $FB $0B
ld [hl], $C0 ; $556E: $36 $C0
ld a, $18 ; $5570: $3E $18
ld [wD202], a ; $5572: $EA $02 $D2

View File

@ -179,7 +179,7 @@ func_005_63EB::
ld hl, wEntitiesSpeedZTable ; $6419: $21 $20 $C3
add hl, bc ; $641C: $09
ld [hl], b ; $641D: $70
call GetEntityDropTimer ; $641E: $CD $FB $0B
call GetEntitySlowTransitionCountdown ; $641E: $CD $FB $0B
ld [hl], $40 ; $6421: $36 $40
ldh a, [hActiveEntityPosX] ; $6423: $F0 $EE
add $F8 ; $6425: $C6 $F8
@ -276,7 +276,7 @@ func_005_648E::
jr_005_64AF:
call DefaultEnemyDamageCollisionHandler_trampoline ; $64AF: $CD $39 $3B
call GetEntityDropTimer ; $64B2: $CD $FB $0B
call GetEntitySlowTransitionCountdown ; $64B2: $CD $FB $0B
jr nz, .jr_64CC ; $64B5: $20 $15
ldh a, [hActiveEntityPosX] ; $64B7: $F0 $EE

View File

@ -692,7 +692,7 @@ MarinEntityHandler_Indoor::
and a ; $5213: $A7
jr nz, .jr_5237 ; $5214: $20 $21
call GetEntityDropTimer ; $5216: $CD $FB $0B
call GetEntitySlowTransitionCountdown ; $5216: $CD $FB $0B
ld [hl], $7F ; $5219: $36 $7F
ld hl, wEntitiesDirectionTable ; $521B: $21 $80 $C3
add hl, bc ; $521E: $09
@ -760,7 +760,7 @@ Data_005_5274::
db $00, $00, $01, $01, $00, $00, $01, $01, $00, $00, $01, $01, $00, $00, $01, $01
func_005_5294::
call GetEntityDropTimer ; $5294: $CD $FB $0B
call GetEntitySlowTransitionCountdown ; $5294: $CD $FB $0B
jr nz, .jr_52A4 ; $5297: $20 $0B
call_open_dialog Dialog001 ; $5299: $3E $01

View File

@ -88,7 +88,7 @@ func_005_6D42::
.jr_6D7E
ld [hl], $1F ; $6D7E: $36 $1F
call GetEntityDropTimer ; $6D80: $CD $FB $0B
call GetEntitySlowTransitionCountdown ; $6D80: $CD $FB $0B
ld [hl], $B0 ; $6D83: $36 $B0
call label_3E34 ; $6D85: $CD $34 $3E
ld hl, wEntitiesStatusTable ; $6D88: $21 $80 $C2
@ -480,7 +480,7 @@ Data_005_70E7::
db $00, $00, $01, $01
func_005_70EB::
call GetEntityDropTimer ; $70EB: $CD $FB $0B
call GetEntitySlowTransitionCountdown ; $70EB: $CD $FB $0B
ld a, [wD200] ; $70EE: $FA $00 $D2
and a ; $70F1: $A7
jr z, .jr_70F6 ; $70F2: $28 $02
@ -978,7 +978,7 @@ func_005_7363::
ld hl, wEntitiesPrivateState1Table ; $73E6: $21 $B0 $C2
add hl, bc ; $73E9: $09
ld [hl], $02 ; $73EA: $36 $02
call GetEntityDropTimer ; $73EC: $CD $FB $0B
call GetEntitySlowTransitionCountdown ; $73EC: $CD $FB $0B
ld [hl], $30 ; $73EF: $36 $30
ld hl, wEntitiesPrivateCountdown2Table ; $73F1: $21 $00 $C3
add hl, bc ; $73F4: $09
@ -1283,7 +1283,7 @@ func_005_75D1::
call ReturnIfNonInteractive_05 ; $75D7: $CD $3A $7A
ld a, $01 ; $75DA: $3E $01
ld [wD200], a ; $75DC: $EA $00 $D2
call GetEntityDropTimer ; $75DF: $CD $FB $0B
call GetEntitySlowTransitionCountdown ; $75DF: $CD $FB $0B
cp $10 ; $75E2: $FE $10
jr nc, jr_005_7621 ; $75E4: $30 $3B

View File

@ -231,7 +231,7 @@ jr_005_4A46:
add hl, de ; $4A4F: $19
ld a, [hl] ; $4A50: $7E
call SetEntitySpriteVariant ; $4A51: $CD $0C $3B
call GetEntityDropTimer ; $4A54: $CD $FB $0B
call GetEntitySlowTransitionCountdown ; $4A54: $CD $FB $0B
jr nz, .jr_4A9E ; $4A57: $20 $45
ld a, ENTITY_BOMB ; $4A59: $3E $02
@ -290,7 +290,7 @@ jr_005_4A46:
.jr_4AAE
call UpdateEntityPosWithSpeed_05 ; $4AAE: $CD $B1 $7A
call DefaultEntityPhysics_trampoline ; $4AB1: $CD $23 $3B
call GetEntityDropTimer ; $4AB4: $CD $FB $0B
call GetEntitySlowTransitionCountdown ; $4AB4: $CD $FB $0B
cp $06 ; $4AB7: $FE $06
jr nc, jr_005_4AEC ; $4AB9: $30 $31
@ -373,7 +373,7 @@ jr_005_4AEC:
ldh [hJingle], a ; $4B14: $E0 $F2
.jr_4B16
call GetEntityDropTimer ; $4B16: $CD $FB $0B
call GetEntitySlowTransitionCountdown ; $4B16: $CD $FB $0B
cp $60 ; $4B19: $FE $60
jr nc, ret_005_4B40 ; $4B1B: $30 $23

View File

@ -34,7 +34,7 @@ AntiKirbyState0Handler::
jr nz, label_006_42A2 ; $426E: $20 $32
call ClearEntitySpeed ; $4270: $CD $7F $3D
call GetEntityDropTimer ; $4273: $CD $FB $0B
call GetEntitySlowTransitionCountdown ; $4273: $CD $FB $0B
jr nz, .jr_4294 ; $4276: $20 $1C
call GetEntityXDistanceToLink_06 ; $4278: $CD $94 $65
@ -146,7 +146,7 @@ AntiKirbyState2Handler::
label_006_431B:
call IncrementEntityState ; $431B: $CD $12 $3B
ld [hl], b ; $431E: $70
call GetEntityDropTimer ; $431F: $CD $FB $0B
call GetEntitySlowTransitionCountdown ; $431F: $CD $FB $0B
call GetRandomByte ; $4322: $CD $0D $28
and $1F ; $4325: $E6 $1F
add $08 ; $4327: $C6 $08

View File

@ -153,12 +153,12 @@ BigFairyWaitingHandler::
ret nc ; $7177: $D0
call IncrementEntityState ; $7178: $CD $12 $3B
call GetEntityDropTimer ; $717B: $CD $FB $0B
call GetEntitySlowTransitionCountdown ; $717B: $CD $FB $0B
ld [hl], $48 ; $717E: $36 $48
jp_open_dialog Dialog024 ; $7180
BigFairyHealingHandler::
call GetEntityDropTimer ; $7185: $CD $FB $0B
call GetEntitySlowTransitionCountdown ; $7185: $CD $FB $0B
jr nz, .jr_7197 ; $7188: $20 $0D
call GetEntityTransitionCountdown ; $718A: $CD $05 $0C

View File

@ -42,11 +42,11 @@ LikeLikeGibdoWalk:
ld hl, wEntitiesCollisionsTable ; $7EA3: $21 $A0 $C2
add hl, bc ; $7EA6: $09
ld a, [hl] ; $7EA7: $7E
and COLLISION_TYPE_VERTICAL ; $7EA8: $E6 $03
jr nz, .verticalCollision ; $7EAA: $20 $0F
and $03 ; $7EA8: $E6 $03
jr nz, .horizontalCollision ; $7EAA: $20 $0F
ld a, [hl] ; $7EAC: $7E
and COLLISION_TYPE_HORIZONTAL ; $7EAD: $E6 $0C
and $0C ; $7EAD: $E6 $0C
jr z, .noCollision ; $7EAF: $28 $12
ld hl, wEntitiesSpeedYTable ; $7EB1: $21 $50 $C2
@ -56,7 +56,7 @@ LikeLikeGibdoWalk:
ld [hl], a ; $7EB8: $77
jr .noCollision ; $7EB9: $18 $08
.verticalCollision
.horizontalCollision
ld hl, wEntitiesSpeedXTable ; $7EBB: $21 $40 $C2
add hl, bc ; $7EBE: $09
ld a, [hl] ; $7EBF: $7E

View File

@ -16,11 +16,11 @@ KeeseCaveBSpriteVariants::
db $60, OAM_GBC_PAL_0 | OAMF_PAL0
db $60, OAM_GBC_PAL_0 | OAMF_PAL0 | OAMF_XFLIP
; Approximately 0x0D * sin(pi/8 * index)
; Approximately 0x0E * sin(pi/8 * index)
KeeseYSpeeds::
db $00, $05, $0A, $0D
; Approximately 0x0D * cos(pi/8 * index)
; Approximately 0x0E * cos(pi/8 * index)
KeeseXSpeeds::
db $0E, $0D, $0A, $05, $00, $FB, $F6, $F3, $F2, $F3, $F6, $FB, $00, $05, $0A, $0D

View File

@ -20,7 +20,7 @@ LikeLikeEntityHandler::
._01 dw LikeLikeState1Handler
LikeLikeState0Handler::
call GetEntityDropTimer ; $7DF2: $CD $FB $0B
call GetEntitySlowTransitionCountdown ; $7DF2: $CD $FB $0B
jr nz, .jr_7E06 ; $7DF5: $20 $0F
call label_3B44 ; $7DF7: $CD $44 $3B
@ -49,7 +49,7 @@ LikeLikeState1Handler::
cp $08 ; $7E18: $FE $08
jr c, .jr_7E27 ; $7E1A: $38 $0B
call GetEntityDropTimer ; $7E1C: $CD $FB $0B
call GetEntitySlowTransitionCountdown ; $7E1C: $CD $FB $0B
ld [hl], $15 ; $7E1F: $36 $15
ld hl, wEntitiesPrivateState3Table ; $7E21: $21 $D0 $C2
add hl, bc ; $7E24: $09

View File

@ -227,7 +227,7 @@ func_007_5951::
ld a, MUSIC_MONKEYS_BUILDING_BRIDGE ; $595B: $3E $36
ld [wMusicTrackToPlay], a ; $595D: $EA $68 $D3
ldh [hDefaultMusicTrack], a ; $5960: $E0 $B0
call GetEntityDropTimer ; $5962: $CD $FB $0B
call GetEntitySlowTransitionCountdown ; $5962: $CD $FB $0B
ld [hl], $80 ; $5965: $36 $80
jp IncrementEntityState ; $5967: $C3 $12 $3B
@ -262,7 +262,7 @@ func_007_5997::
ld a, $02 ; $5997: $3E $02
ldh [hLinkInteractiveMotionBlocked], a ; $5999: $E0 $A1
call func_007_58FA ; $599B: $CD $FA $58
call GetEntityDropTimer ; $599E: $CD $FB $0B
call GetEntitySlowTransitionCountdown ; $599E: $CD $FB $0B
.jr_59A1
jr nz, jr_007_59C8 ; $59A1: $20 $25
@ -353,7 +353,7 @@ jr_007_59C8:
pop bc ; $5A29: $C1
jr_007_5A2A:
call GetEntityDropTimer ; $5A2A: $CD $FB $0B
call GetEntitySlowTransitionCountdown ; $5A2A: $CD $FB $0B
cp $40 ; $5A2D: $FE $40
ret nc ; $5A2F: $D0

View File

@ -24,25 +24,25 @@ PeaHatEntityHandler::
set ENTITY_OPT1_B_SWORD_CLINK_OFF, [hl] ; $672B: $CB $F6
ldh a, [hActiveEntityState] ; $672D: $F0 $F0
JP_TABLE ; $672F
._00 dw func_007_6736 ; $6730
._01 dw func_007_6790 ; $6732
._02 dw func_007_67D7 ; $6734
._00 dw PeaHatRestingHandler ; $6730
._01 dw PeaHatTakingOffHandler ; $6732
._02 dw PeaHatFlyingHandler ; $6734
func_007_6736::
PeaHatRestingHandler::
ld hl, wEntitiesPosZTable ; $6736: $21 $10 $C3
add hl, bc ; $6739: $09
ld a, [hl] ; $673A: $7E
and a ; $673B: $A7
jr z, .jr_6747 ; $673C: $28 $09
jr z, .grounded ; $673C: $28 $09
ldh a, [hFrameCounter] ; $673E: $F0 $E7
and $07 ; $6740: $E6 $07
jr nz, jr_007_6753 ; $6742: $20 $0F
jr nz, .groundedEnd ; $6742: $20 $0F
dec [hl] ; $6744: $35
jr jr_007_6753 ; $6745: $18 $0C
jr .groundedEnd ; $6745: $18 $0C
.jr_6747
.grounded
ld hl, wEntitiesHitboxFlagsTable ; $6747: $21 $50 $C3
add hl, bc ; $674A: $09
res 7, [hl] ; $674B: $CB $BE
@ -50,85 +50,85 @@ func_007_6736::
add hl, bc ; $6750: $09
res ENTITY_OPT1_B_SWORD_CLINK_OFF, [hl] ; $6751: $CB $B6
jr_007_6753:
.groundedEnd
ldh a, [hFrameCounter] ; $6753: $F0 $E7
and $07 ; $6755: $E6 $07
jr nz, jr_007_6776 ; $6757: $20 $1D
jr nz, .updateYSpeedEnd ; $6757: $20 $1D
ld hl, wEntitiesSpeedXTable ; $6759: $21 $40 $C2
add hl, bc ; $675C: $09
ld a, [hl] ; $675D: $7E
and a ; $675E: $A7
jr z, jr_007_6768 ; $675F: $28 $07
jr z, .updateXSpeedEnd ; $675F: $28 $07
and $80 ; $6761: $E6 $80
jr z, .jr_6767 ; $6763: $28 $02
jr z, .positiveX ; $6763: $28 $02
inc [hl] ; $6765: $34
inc [hl] ; $6766: $34
.jr_6767
.positiveX
dec [hl] ; $6767: $35
jr_007_6768:
.updateXSpeedEnd
call GetEntitySpeedYAddress ; $6768: $CD $05 $40
ld a, [hl] ; $676B: $7E
and a ; $676C: $A7
jr z, jr_007_6776 ; $676D: $28 $07
jr z, .updateYSpeedEnd ; $676D: $28 $07
and $80 ; $676F: $E6 $80
jr z, .jr_6775 ; $6771: $28 $02
jr z, .positiveY ; $6771: $28 $02
inc [hl] ; $6773: $34
inc [hl] ; $6774: $34
.jr_6775
.positiveY
dec [hl] ; $6775: $35
jr_007_6776:
call GetEntityDropTimer ; $6776: $CD $FB $0B
jr nz, .jr_677E ; $6779: $20 $03
.updateYSpeedEnd
call GetEntitySlowTransitionCountdown ; $6776: $CD $FB $0B
jr nz, .skipIncrementState ; $6779: $20 $03
call IncrementEntityState ; $677B: $CD $12 $3B
.jr_677E
.skipIncrementState
ld hl, wEntitiesPrivateState1Table ; $677E: $21 $B0 $C2
add hl, bc ; $6781: $09
ld a, [hl] ; $6782: $7E
and a ; $6783: $A7
jr z, .jr_678D ; $6784: $28 $07
jr z, .decAnimationSpeedEnd ; $6784: $28 $07
ldh a, [hFrameCounter] ; $6786: $F0 $E7
and $1F ; $6788: $E6 $1F
jr nz, .jr_678D ; $678A: $20 $01
jr nz, .decAnimationSpeedEnd ; $678A: $20 $01
dec [hl] ; $678C: $35
.jr_678D
jp func_007_67AE ; $678D: $C3 $AE $67
.decAnimationSpeedEnd
jp AnimatePeaHat ; $678D: $C3 $AE $67
func_007_6790::
PeaHatTakingOffHandler::
ld hl, wEntitiesPrivateState1Table ; $6790: $21 $B0 $C2
add hl, bc ; $6793: $09
ld a, [hl] ; $6794: $7E
cp $08 ; $6795: $FE $08
jr c, .jr_67A7 ; $6797: $38 $0E
jr c, .skipIncrementState ; $6797: $38 $0E
call GetEntityDropTimer ; $6799: $CD $FB $0B
call GetEntitySlowTransitionCountdown ; $6799: $CD $FB $0B
call GetRandomByte ; $679C: $CD $0D $28
and $1F ; $679F: $E6 $1F
add $80 ; $67A1: $C6 $80
ld [hl], a ; $67A3: $77
jp IncrementEntityState ; $67A4: $C3 $12 $3B
.jr_67A7
.skipIncrementState
ldh a, [hFrameCounter] ; $67A7: $F0 $E7
and $0F ; $67A9: $E6 $0F
jr nz, func_007_67AE ; $67AB: $20 $01
jr nz, AnimatePeaHat ; $67AB: $20 $01
inc [hl] ; $67AD: $34
func_007_67AE::
AnimatePeaHat::
ld hl, wEntitiesPrivateState1Table ; $67AE: $21 $B0 $C2
add hl, bc ; $67B1: $09
ld a, [hl] ; $67B2: $7E
@ -144,44 +144,46 @@ func_007_67AE::
and $01 ; $67BE: $E6 $01
jp SetEntitySpriteVariant ; $67C0: $C3 $0C $3B
Data_007_67C3::
; Approximately 0x0E * sin(pi/8 * index)
PeaHatYSpeeds::
db $00, $05, $0A, $0D
Data_007_67C7::
; Approximately 0x0E * cos(pi/8 * index)
PeaHatXSpeeds::
db $0E, $0D, $0A, $05, $00, $FB, $F6, $F3, $F2, $F3, $F6, $FB, $00, $05, $0A, $0D
func_007_67D7::
call func_007_67AE ; $67D7: $CD $AE $67
PeaHatFlyingHandler::
call AnimatePeaHat ; $67D7: $CD $AE $67
ld hl, wEntitiesPosZTable ; $67DA: $21 $10 $C3
add hl, bc ; $67DD: $09
ld a, [hl] ; $67DE: $7E
cp $10 ; $67DF: $FE $10
jr z, jr_007_67EB ; $67E1: $28 $08
jr z, .reachedMaxHeight ; $67E1: $28 $08
ldh a, [hFrameCounter] ; $67E3: $F0 $E7
and $07 ; $67E5: $E6 $07
jr nz, .ret_67EA ; $67E7: $20 $01
jr nz, .return ; $67E7: $20 $01
inc [hl] ; $67E9: $34
.ret_67EA
.return
ret ; $67EA: $C9
jr_007_67EB:
call GetEntityDropTimer ; $67EB: $CD $FB $0B
jr nz, .jr_67F6 ; $67EE: $20 $06
.reachedMaxHeight
call GetEntitySlowTransitionCountdown ; $67EB: $CD $FB $0B
jr nz, .skipIncrementState ; $67EE: $20 $06
ld [hl], $60 ; $67F0: $36 $60
call IncrementEntityState ; $67F2: $CD $12 $3B
ld [hl], b ; $67F5: $70
.jr_67F6
.skipIncrementState
ld hl, wEntitiesPrivateState3Table ; $67F6: $21 $D0 $C2
add hl, bc ; $67F9: $09
inc [hl] ; $67FA: $34
ld a, [hl] ; $67FB: $7E
cp $18 ; $67FC: $FE $18
jr c, .ret_683D ; $67FE: $38 $3D
jr c, .updateSpeedEnd ; $67FE: $38 $3D
ld [hl], b ; $6800: $70
ld hl, wEntitiesPrivateState2Table ; $6801: $21 $C0 $C2
@ -196,13 +198,13 @@ jr_007_67EB:
add hl, bc ; $6811: $09
ld e, [hl] ; $6812: $5E
ld d, b ; $6813: $50
ld hl, Data_007_67C3 ; $6814: $21 $C3 $67
ld hl, PeaHatYSpeeds ; $6814: $21 $C3 $67
add hl, de ; $6817: $19
ld a, [hl] ; $6818: $7E
sra a ; $6819: $CB $2F
call GetEntitySpeedYAddress ; $681B: $CD $05 $40
ld [hl], a ; $681E: $77
ld hl, Data_007_67C7 ; $681F: $21 $C7 $67
ld hl, PeaHatXSpeeds ; $681F: $21 $C7 $67
add hl, de ; $6822: $19
ld a, [hl] ; $6823: $7E
sra a ; $6824: $CB $2F
@ -211,7 +213,7 @@ jr_007_67EB:
ld [hl], a ; $682A: $77
call GetRandomByte ; $682B: $CD $0D $28
and $07 ; $682E: $E6 $07
jr nz, .ret_683D ; $6830: $20 $0B
jr nz, .updateSpeedEnd ; $6830: $20 $0B
call GetRandomByte ; $6832: $CD $0D $28
and $02 ; $6835: $E6 $02
@ -220,5 +222,5 @@ jr_007_67EB:
add hl, bc ; $683B: $09
ld [hl], a ; $683C: $77
.ret_683D
.updateSpeedEnd
ret ; $683D: $C9

View File

@ -1,32 +1,32 @@
; define sprite variants by selecting tile n° and setting OAM attributes (palette + flags) in a list
SpikedBeetle1SpriteVariants:: ; $7784
.variant0
db $70, $00
db $70, $20
db $70, OAM_GBC_PAL_0 | OAMF_PAL0
db $70, OAM_GBC_PAL_0 | OAMF_PAL0 | OAMF_XFLIP
.variant1
db $72, $00
db $72, $20
db $72, OAM_GBC_PAL_0 | OAMF_PAL0
db $72, OAM_GBC_PAL_0 | OAMF_PAL0 | OAMF_XFLIP
.variant2
db $74, $00
db $74, $20
db $74, OAM_GBC_PAL_0 | OAMF_PAL0
db $74, OAM_GBC_PAL_0 | OAMF_PAL0 | OAMF_XFLIP
.variant3
db $76, $00
db $76, $20
db $76, OAM_GBC_PAL_0 | OAMF_PAL0
db $76, OAM_GBC_PAL_0 | OAMF_PAL0 | OAMF_XFLIP
; define sprite variants by selecting tile n° and setting OAM attributes (palette + flags) in a list
SpikedBeetle2SpriteVariants::
.variant0
db $60, $00
db $60, $20
db $60, OAM_GBC_PAL_0 | OAMF_PAL0
db $60, OAM_GBC_PAL_0 | OAMF_PAL0 | OAMF_XFLIP
.variant1
db $62, $00
db $62, $20
db $62, OAM_GBC_PAL_0 | OAMF_PAL0
db $62, OAM_GBC_PAL_0 | OAMF_PAL0 | OAMF_XFLIP
.variant2
db $64, $00
db $64, $20
db $64, OAM_GBC_PAL_0 | OAMF_PAL0
db $64, OAM_GBC_PAL_0 | OAMF_PAL0 | OAMF_XFLIP
.variant3
db $66, $00
db $66, $20
db $66, OAM_GBC_PAL_0 | OAMF_PAL0
db $66, OAM_GBC_PAL_0 | OAMF_PAL0 | OAMF_XFLIP
SpikedBeetleEntityHandler::
ld de, SpikedBeetle1SpriteVariants ; $77A4: $11 $84 $77
@ -39,8 +39,6 @@ SpikedBeetleEntityHandler::
.render
call RenderActiveEntitySpritesPair ; $77B0: $CD $C0 $3B
call ReturnIfNonInteractive_07 ; $77B3: $CD $96 $7D
.jr_77B6
ld hl, wEntitiesIgnoreHitsCountdownTable ; $77B6: $21 $10 $C4
add hl, bc ; $77B9: $09
ld a, [hl] ; $77BA: $7E
@ -63,16 +61,16 @@ SpikedBeetleEntityHandler::
add hl, bc ; $77D9: $09
ld a, [hl] ; $77DA: $7E
bit 7, a ; $77DB: $CB $7F
jr nz, .jr_77E2 ; $77DD: $20 $03
jr nz, .negativeZ ; $77DD: $20 $03
and a ; $77DF: $A7
jr nz, jr_007_780D ; $77E0: $20 $2B
jr nz, .bounceEnd ; $77E0: $20 $2B
.jr_77E2
.negativeZ
ld [hl], b ; $77E2: $70
ldh a, [hActiveEntityState] ; $77E3: $F0 $F0
cp $03 ; $77E5: $FE $03
jr nz, jr_007_7808 ; $77E7: $20 $1F
jr nz, .notFlipped ; $77E7: $20 $1F
ld hl, wEntitiesSpeedXTable ; $77E9: $21 $40 $C2
add hl, bc ; $77EC: $09
@ -83,46 +81,44 @@ SpikedBeetleEntityHandler::
add hl, bc ; $77F7: $09
ld a, [hl] ; $77F8: $7E
sra a ; $77F9: $CB $2F
.jr_77FB
cpl ; $77FB: $2F
ld [hl], a ; $77FC: $77
cp $07 ; $77FD: $FE $07
jp nc, jr_007_780D ; $77FF: $D2 $0D $78
jp nc, .bounceEnd ; $77FF: $D2 $0D $78
ld [hl], b ; $7802: $70
call ClearEntitySpeed ; $7803: $CD $7F $3D
jr jr_007_780D ; $7806: $18 $05
jr .bounceEnd ; $7806: $18 $05
jr_007_7808:
.notFlipped
ld hl, wEntitiesSpeedZTable ; $7808: $21 $20 $C3
add hl, bc ; $780B: $09
ld [hl], b ; $780C: $70
jr_007_780D:
.bounceEnd
ldh a, [hActiveEntityState] ; $780D: $F0 $F0
cp $04 ; $780F: $FE $04
jr c, .jr_7814 ; $7811: $38 $01
jr c, .state4End ; $7811: $38 $01
ret ; $7813: $C9
.jr_7814
.state4End
JP_TABLE ; $7814
._00 dw func_007_7825 ; $7815
._01 dw func_007_7860 ; $7817
._02 dw func_007_78A5 ; $7819
._03 dw func_007_78EC ; $781B
._00 dw SpikedBeetleRestingHandler ; $7815
._01 dw SpikedBeetleWalkingHandler ; $7817
._02 dw SpikedBeetleDashingHandler ; $7819
._03 dw SpikedBeetleFlippedHandler ; $781B
Data_007_781D::
SpikedBeetleWalkingXSpeeds::
db $06, $FA, $00, $00
Data_007_7821::
SpikedBeetleWalkingYSpeeds::
db $00, $00, $FA, $06
func_007_7825::
SpikedBeetleRestingHandler::
call ClearEntitySpeed ; $7825: $CD $7F $3D
call GetEntityTransitionCountdown ; $7828: $CD $05 $0C
jr nz, jr_007_785E ; $782B: $20 $31
jr nz, .skipIncrementState ; $782B: $20 $31
call GetRandomByte ; $782D: $CD $0D $28
and $1F ; $7830: $E6 $1F
@ -131,45 +127,45 @@ func_007_7825::
call IncrementEntityState ; $7835: $CD $12 $3B
call GetRandomByte ; $7838: $CD $0D $28
and $06 ; $783B: $E6 $06
jr nz, .jr_7844 ; $783D: $20 $05
jr nz, .chooseRandomDirection ; $783D: $20 $05
call GetEntityDirectionToLink_07 ; $783F: $CD $7D $7E
jr jr_007_784A ; $7842: $18 $06
jr .chooseRandomDirectionEnd ; $7842: $18 $06
.jr_7844
.chooseRandomDirection
call GetRandomByte ; $7844: $CD $0D $28
and $03 ; $7847: $E6 $03
ld e, a ; $7849: $5F
jr_007_784A:
.chooseRandomDirectionEnd
ld d, b ; $784A: $50
ld hl, Data_007_781D ; $784B: $21 $1D $78
ld hl, SpikedBeetleWalkingXSpeeds ; $784B: $21 $1D $78
add hl, de ; $784E: $19
ld a, [hl] ; $784F: $7E
ld hl, wEntitiesSpeedXTable ; $7850: $21 $40 $C2
add hl, bc ; $7853: $09
ld [hl], a ; $7854: $77
ld hl, Data_007_7821 ; $7855: $21 $21 $78
ld hl, SpikedBeetleWalkingYSpeeds ; $7855: $21 $21 $78
add hl, de ; $7858: $19
ld a, [hl] ; $7859: $7E
call GetEntitySpeedYAddress ; $785A: $CD $05 $40
ld [hl], a ; $785D: $77
jr_007_785E:
jr jr_007_786E ; $785E: $18 $0E
.skipIncrementState
jr SpikedBeetleNotFlipped ; $785E: $18 $0E
func_007_7860::
SpikedBeetleWalkingHandler::
call GetEntityTransitionCountdown ; $7860: $CD $05 $0C
jr nz, .jr_786B ; $7863: $20 $06
jr nz, .skipSetState0 ; $7863: $20 $06
ld [hl], $18 ; $7865: $36 $18
call IncrementEntityState ; $7867: $CD $12 $3B
ld [hl], b ; $786A: $70
.jr_786B
call func_007_78E1 ; $786B: $CD $E1 $78
.skipSetState0
call SpikedBeetleWalk ; $786B: $CD $E1 $78
jr_007_786E:
SpikedBeetleNotFlipped:
ld hl, wEntitiesHitboxFlagsTable ; $786E: $21 $50 $C3
add hl, bc ; $7871: $09
ld [hl], $80 ; $7872: $36 $80
@ -179,14 +175,14 @@ jr_007_786E:
call GetEntityXDistanceToLink_07 ; $787A: $CD $5D $7E
add $06 ; $787D: $C6 $06
cp $0A ; $787F: $FE $0A
jr c, .jr_788C ; $7881: $38 $09
jr c, .startDash ; $7881: $38 $09
call GetEntityYDistanceToLink_07 ; $7883: $CD $6D $7E
add $06 ; $7886: $C6 $06
cp $0A ; $7888: $FE $0A
jr nc, ret_007_789C ; $788A: $30 $10
jr nc, .return ; $788A: $30 $10
.jr_788C
.startDash
call GetEntityDirectionToLink_07 ; $788C: $CD $7D $7E
ld hl, wEntitiesDirectionTable ; $788F: $21 $80 $C3
add hl, bc ; $7892: $09
@ -195,69 +191,69 @@ jr_007_786E:
call GetEntityTransitionCountdown ; $7897: $CD $05 $0C
ld [hl], $FF ; $789A: $36 $FF
ret_007_789C:
.return
ret ; $789C: $C9
Data_007_789D::
SpikedBeetleDashingXSpeeds::
db $18, $E8, $00, $00
Data_007_78A1::
SpikedBeetleDashingYSpeeds::
db $00, $00, $E8, $18
func_007_78A5::
SpikedBeetleDashingHandler::
call GetEntityTransitionCountdown ; $78A5: $CD $05 $0C
jr z, jr_007_78DD ; $78A8: $28 $33
jr z, .setState0 ; $78A8: $28 $33
ld hl, wEntitiesDirectionTable ; $78AA: $21 $80 $C3
add hl, bc ; $78AD: $09
ld e, [hl] ; $78AE: $5E
ld d, b ; $78AF: $50
ld hl, Data_007_789D ; $78B0: $21 $9D $78
ld hl, SpikedBeetleDashingXSpeeds ; $78B0: $21 $9D $78
add hl, de ; $78B3: $19
ld a, [hl] ; $78B4: $7E
ld hl, wEntitiesSpeedXTable ; $78B5: $21 $40 $C2
add hl, bc ; $78B8: $09
sub [hl] ; $78B9: $96
jr z, jr_007_78C3 ; $78BA: $28 $07
jr z, .updateXSpeedEnd ; $78BA: $28 $07
and $80 ; $78BC: $E6 $80
jr nz, .jr_78C2 ; $78BE: $20 $02
jr nz, .positiveDifferenceX ; $78BE: $20 $02
inc [hl] ; $78C0: $34
inc [hl] ; $78C1: $34
.jr_78C2
.positiveDifferenceX
dec [hl] ; $78C2: $35
jr_007_78C3:
ld hl, Data_007_78A1 ; $78C3: $21 $A1 $78
.updateXSpeedEnd
ld hl, SpikedBeetleDashingYSpeeds ; $78C3: $21 $A1 $78
add hl, de ; $78C6: $19
ld a, [hl] ; $78C7: $7E
call GetEntitySpeedYAddress ; $78C8: $CD $05 $40
sub [hl] ; $78CB: $96
jr z, jr_007_78D5 ; $78CC: $28 $07
jr z, .updateYSpeedEnd ; $78CC: $28 $07
and $80 ; $78CE: $E6 $80
jr nz, .jr_78D4 ; $78D0: $20 $02
jr nz, .positiveDifferenceY ; $78D0: $20 $02
inc [hl] ; $78D2: $34
inc [hl] ; $78D3: $34
.jr_78D4
.positiveDifferenceY
dec [hl] ; $78D4: $35
jr_007_78D5:
.updateYSpeedEnd
ld hl, wEntitiesCollisionsTable ; $78D5: $21 $A0 $C2
add hl, bc ; $78D8: $09
ld a, [hl] ; $78D9: $7E
and a ; $78DA: $A7
jr z, func_007_78E1 ; $78DB: $28 $04
jr z, SpikedBeetleWalk ; $78DB: $28 $04
jr_007_78DD:
.setState0
call IncrementEntityState ; $78DD: $CD $12 $3B
ld [hl], b ; $78E0: $70
func_007_78E1::
SpikedBeetleWalk::
ldh a, [hFrameCounter] ; $78E1: $F0 $E7
rra ; $78E3: $1F
rra ; $78E4: $1F
@ -266,7 +262,7 @@ func_007_78E1::
and $01 ; $78E7: $E6 $01
jp SetEntitySpriteVariant ; $78E9: $C3 $0C $3B
func_007_78EC::
SpikedBeetleFlippedHandler::
ld hl, wEntitiesOptions1Table ; $78EC: $21 $30 $C4
add hl, bc ; $78EF: $09
ld [hl], ENTITY_OPT1_SPLASH_IN_WATER ; $78F0: $36 $08
@ -283,7 +279,7 @@ func_007_78EC::
inc a ; $7901: $3C
call SetEntitySpriteVariant ; $7902: $CD $0C $3B
call GetEntityTransitionCountdown ; $7905: $CD $05 $0C
jr nz, .jr_791A ; $7908: $20 $10
jr nz, .skipSetState0 ; $7908: $20 $10
call IncrementEntityState ; $790A: $CD $12 $3B
ld [hl], b ; $790D: $70
@ -295,22 +291,22 @@ func_007_78EC::
ld [hl], b ; $7918: $70
ret ; $7919: $C9
.jr_791A
.skipSetState0
cp $60 ; $791A: $FE $60
jr nc, jr_007_792B ; $791C: $30 $0D
jr nc, .shakeEnd ; $791C: $30 $0D
and $04 ; $791E: $E6 $04
ld a, $08 ; $7920: $3E $08
jr nz, .jr_7926 ; $7922: $20 $02
jr nz, .shakeRight ; $7922: $20 $02
ld a, $F8 ; $7924: $3E $F8
.jr_7926
.shakeRight
ld hl, wEntitiesSpeedXTable ; $7926: $21 $40 $C2
add hl, bc ; $7929: $09
ld [hl], a ; $792A: $77
jr_007_792B:
.shakeEnd
ld hl, wEntitiesIgnoreHitsCountdownTable ; $792B: $21 $10 $C4
add hl, bc ; $792E: $09
ld a, [hl] ; $792F: $7E

View File

@ -1,20 +1,20 @@
; define sprite variants by selecting tile n° and setting OAM attributes (palette + flags) in a list
StarSpriteVariants::
.variant0
db $74, $01
db $74, $21
db $74, OAM_GBC_PAL_1 | OAMF_PAL0
db $74, OAM_GBC_PAL_1 | OAMF_PAL0 | OAMF_XFLIP
.variant1
db $76, $01
db $78, $01
db $76, OAM_GBC_PAL_1 | OAMF_PAL0
db $78, OAM_GBC_PAL_1 | OAMF_PAL0
.variant2
db $7A, $01
db $7A, $21
db $7A, OAM_GBC_PAL_1 | OAMF_PAL0
db $7A, OAM_GBC_PAL_1 | OAMF_PAL0 | OAMF_XFLIP
.variant3
db $78, $21
db $76, $21
db $78, OAM_GBC_PAL_1 | OAMF_PAL0 | OAMF_XFLIP
db $76, OAM_GBC_PAL_1 | OAMF_PAL0 | OAMF_XFLIP
.variant4
db $7C, $01
db $7C, $01
db $7C, OAM_GBC_PAL_1 | OAMF_PAL0
db $7C, OAM_GBC_PAL_1 | OAMF_PAL0
StarEntityHandler::
ld de, StarSpriteVariants ; $725B: $11 $47 $72
@ -28,31 +28,31 @@ StarEntityHandler::
add hl, bc ; $7273: $09
ld a, [hl] ; $7274: $7E
and $03 ; $7275: $E6 $03
jr nz, .jr_7280 ; $7277: $20 $07
jr nz, .horizontalCollision ; $7277: $20 $07
ld a, [hl] ; $7279: $7E
and $0C ; $727A: $E6 $0C
jr nz, jr_007_728A ; $727C: $20 $0C
jr nz, .verticalCollision ; $727C: $20 $0C
jr jr_007_7291 ; $727E: $18 $11
jr .collisionEnd ; $727E: $18 $11
.jr_7280
.horizontalCollision
ld hl, wEntitiesSpeedXTable ; $7280: $21 $40 $C2
add hl, bc ; $7283: $09
ld a, [hl] ; $7284: $7E
cpl ; $7285: $2F
inc a ; $7286: $3C
ld [hl], a ; $7287: $77
jr jr_007_7291 ; $7288: $18 $07
jr .collisionEnd ; $7288: $18 $07
jr_007_728A:
.verticalCollision
call GetEntitySpeedYAddress ; $728A: $CD $05 $40
ld a, [hl] ; $728D: $7E
cpl ; $728E: $2F
inc a ; $728F: $3C
ld [hl], a ; $7290: $77
jr_007_7291:
.collisionEnd
ldh a, [hFrameCounter] ; $7291: $F0 $E7
rra ; $7293: $1F
rra ; $7294: $1F

View File

@ -2644,7 +2644,7 @@ func_015_65A6::
call GetEntityTransitionCountdown ; $65AB: $CD $05 $0C
jr nz, .jr_65BB ; $65AE: $20 $0B
call GetEntityDropTimer ; $65B0: $CD $FB $0B
call GetEntitySlowTransitionCountdown ; $65B0: $CD $FB $0B
ld [hl], $4C ; $65B3: $36 $4C
call func_015_655D ; $65B5: $CD $5D $65
jp IncrementEntityState ; $65B8: $C3 $12 $3B
@ -2709,7 +2709,7 @@ Data_015_6610::
db $10, $18, $10, $F0, $E8, $F0, $10, $18
func_015_6618::
call GetEntityDropTimer ; $6618: $CD $FB $0B
call GetEntitySlowTransitionCountdown ; $6618: $CD $FB $0B
jr nz, jr_015_6628 ; $661B: $20 $0B
ld [wD221], a ; $661D: $EA $21 $D2
@ -3178,7 +3178,7 @@ func_015_68E7::
ld hl, wEntitiesOptions1Table ; $68FE: $21 $30 $C4
add hl, bc ; $6901: $09
ld [hl], ENTITY_OPT1_IS_BOSS|ENTITY_OPT1_SWORD_CLINK_OFF ; $6902: $36 $C0
call GetEntityDropTimer ; $6904: $CD $FB $0B
call GetEntitySlowTransitionCountdown ; $6904: $CD $FB $0B
ld [hl], $90 ; $6907: $36 $90
xor a ; $6909: $AF
ld [wD223], a ; $690A: $EA $23 $D2
@ -3782,7 +3782,7 @@ func_015_6E66::
ld [wD210], a ; $6EEA: $EA $10 $D2
ld a, $00 ; $6EED: $3E $00
call SetEntitySpriteVariant ; $6EEF: $CD $0C $3B
call GetEntityDropTimer ; $6EF2: $CD $FB $0B
call GetEntitySlowTransitionCountdown ; $6EF2: $CD $FB $0B
jr nz, .jr_6F0B ; $6EF5: $20 $14
call GetRandomByte ; $6EF7: $CD $0D $28

View File

@ -102,7 +102,7 @@ func_015_4750::
.jr_475C
res DIALOG_BOX_BOTTOM_BIT, [hl] ; $475C: $CB $BE
call IncrementEntityState ; $475E: $CD $12 $3B
call GetEntityDropTimer ; $4761: $CD $FB $0B
call GetEntitySlowTransitionCountdown ; $4761: $CD $FB $0B
ld [hl], $30 ; $4764: $36 $30
ld hl, wEntitiesOptions1Table ; $4766: $21 $30 $C4
add hl, bc ; $4769: $09
@ -192,7 +192,7 @@ func_015_4780::
jp ClearEntitySpeed ; $47E0: $C3 $7F $3D
jr_015_47E3:
call GetEntityDropTimer ; $47E3: $CD $FB $0B
call GetEntitySlowTransitionCountdown ; $47E3: $CD $FB $0B
jr nz, .jr_47F3 ; $47E6: $20 $0B
call GetEntityTransitionCountdown ; $47E8: $CD $05 $0C
@ -459,7 +459,7 @@ func_015_4977::
jr nz, jr_015_4990 ; $497D: $20 $11
label_015_497F:
call GetEntityDropTimer ; $497F: $CD $FB $0B
call GetEntitySlowTransitionCountdown ; $497F: $CD $FB $0B
call GetRandomByte ; $4982: $CD $0D $28
and $1F ; $4985: $E6 $1F
add $20 ; $4987: $C6 $20

View File

@ -32,13 +32,13 @@ MonkeyEntityHandler::
and a ; $76A4: $A7
jr z, .jr_76EF ; $76A5: $28 $48
ld a, [wC178] ; $76A7: $FA $78 $C1
ld a, [wPegasusBootsCollisionCountdown] ; $76A7: $FA $78 $C1
and a ; $76AA: $A7
jr z, .jr_76EF ; $76AB: $28 $42
ldh a, [hActiveEntityPosX] ; $76AD: $F0 $EE
add $08 ; $76AF: $C6 $08
ld hl, wC179 ; $76B1: $21 $79 $C1
ld hl, wPegasusBootsCollisionPosX ; $76B1: $21 $79 $C1
sub [hl] ; $76B4: $96
add $10 ; $76B5: $C6 $10
cp $20 ; $76B7: $FE $20
@ -46,7 +46,7 @@ MonkeyEntityHandler::
ldh a, [hActiveEntityPosY] ; $76BB: $F0 $EF
add $08 ; $76BD: $C6 $08
ld hl, wC17A ; $76BF: $21 $7A $C1
ld hl, wPegasusBootsCollisionPosY ; $76BF: $21 $7A $C1
sub [hl] ; $76C2: $96
add $10 ; $76C3: $C6 $10
cp $20 ; $76C5: $FE $20

View File

@ -16,7 +16,7 @@ BlainoEntityHandler::
jr nz, .jr_64EA ; $64E2: $20 $06
inc [hl] ; $64E4: $34
call GetEntityDropTimer ; $64E5: $CD $FB $0B
call GetEntitySlowTransitionCountdown ; $64E5: $CD $FB $0B
ld [hl], $20 ; $64E8: $36 $20
.jr_64EA
@ -136,7 +136,7 @@ func_018_6596::
jr label_018_65B8 ; $659D: $18 $19
.jr_659F
call GetEntityDropTimer ; $659F: $CD $FB $0B
call GetEntitySlowTransitionCountdown ; $659F: $CD $FB $0B
jr nz, ret_018_65CE ; $65A2: $20 $2A
ld hl, wEntitiesPrivateState1Table ; $65A4: $21 $B0 $C2
@ -350,7 +350,7 @@ ret_018_6729:
label_018_672A:
xor a ; $672A: $AF
ld [wD205], a ; $672B: $EA $05 $D2
call GetEntityDropTimer ; $672E: $CD $FB $0B
call GetEntitySlowTransitionCountdown ; $672E: $CD $FB $0B
call GetRandomByte ; $6731: $CD $0D $28
and $0F ; $6734: $E6 $0F
add $0C ; $6736: $C6 $0C

View File

@ -221,13 +221,13 @@ GrimCreeperState5Handler::
ld a, $FF ; $7128: $3E $FF
ld [wD201], a ; $712A: $EA $01 $D2
ld hl, wEntitiesDropTimerTable ; $712D: $21 $50 $C4
ld hl, wEntitiesSlowTransitionCountdownTable ; $712D: $21 $50 $C4
add hl, bc ; $7130: $09
ld [hl], $40 ; $7131: $36 $40
jp IncrementEntityState ; $7133: $C3 $12 $3B
GrimCreeperState6Handler::
ld hl, wEntitiesDropTimerTable ; $7136: $21 $50 $C4
ld hl, wEntitiesSlowTransitionCountdownTable ; $7136: $21 $50 $C4
add hl, bc ; $7139: $09
ld a, [hl] ; $713A: $7E
and a ; $713B: $A7
@ -412,7 +412,7 @@ func_018_7288::
ld hl, Data_018_7280 ; $7295: $21 $80 $72
add hl, de ; $7298: $19
ld a, [hl] ; $7299: $7E
ld hl, wEntitiesDropTimerTable ; $729A: $21 $50 $C4
ld hl, wEntitiesSlowTransitionCountdownTable ; $729A: $21 $50 $C4
add hl, bc ; $729D: $09
ld [hl], a ; $729E: $77
call IncrementEntityState ; $729F: $CD $12 $3B
@ -421,7 +421,7 @@ func_018_7288::
jp label_018_7276 ; $72A2: $C3 $76 $72
func_018_72A5::
ld hl, wEntitiesDropTimerTable ; $72A5: $21 $50 $C4
ld hl, wEntitiesSlowTransitionCountdownTable ; $72A5: $21 $50 $C4
add hl, bc ; $72A8: $09
ld a, [hl] ; $72A9: $7E
and a ; $72AA: $A7

View File

@ -108,7 +108,7 @@ jr_018_79CF:
ld hl, wEntitiesStateTable ; $7A02: $21 $90 $C2
add hl, bc ; $7A05: $09
ld [hl], $01 ; $7A06: $36 $01
call GetEntityDropTimer ; $7A08: $CD $FB $0B
call GetEntitySlowTransitionCountdown ; $7A08: $CD $FB $0B
ld [hl], $80 ; $7A0B: $36 $80
ld hl, wEntitiesPosXTable ; $7A0D: $21 $00 $C2
add hl, bc ; $7A10: $09
@ -162,7 +162,7 @@ label_018_7A4B:
jp label_3B7B ; $7A5A: $C3 $7B $3B
label_018_7A5D:
call GetEntityDropTimer ; $7A5D: $CD $FB $0B
call GetEntitySlowTransitionCountdown ; $7A5D: $CD $FB $0B
jr nz, ret_018_7AB9 ; $7A60: $20 $57
ld hl, wEntitiesPosXTable ; $7A62: $21 $00 $C2

View File

@ -106,7 +106,7 @@ VireState0Handler::
ld [hl], $03 ; $6AAE: $36 $03
call GetEntityTransitionCountdown ; $6AB0: $CD $05 $0C
ld [hl], $C0 ; $6AB3: $36 $C0
ld hl, wEntitiesDropTimerTable ; $6AB5: $21 $50 $C4
ld hl, wEntitiesSlowTransitionCountdownTable ; $6AB5: $21 $50 $C4
add hl, bc ; $6AB8: $09
ld [hl], $80 ; $6AB9: $36 $80
call ClearEntitySpeed ; $6ABB: $CD $7F $3D
@ -154,7 +154,7 @@ VireState1Handler::
ld [hl], $FF ; $6B00: $36 $FF
.jr_6B02
ld hl, wEntitiesDropTimerTable ; $6B02: $21 $50 $C4
ld hl, wEntitiesSlowTransitionCountdownTable ; $6B02: $21 $50 $C4
add hl, bc ; $6B05: $09
ld a, [hl] ; $6B06: $7E
and a ; $6B07: $A7
@ -283,7 +283,7 @@ VireState2Handler::
ld hl, wEntitiesSpeedZTable ; $6BB5: $21 $20 $C3
add hl, bc ; $6BB8: $09
ld [hl], $EC ; $6BB9: $36 $EC
ld hl, wEntitiesDropTimerTable ; $6BBB: $21 $50 $C4
ld hl, wEntitiesSlowTransitionCountdownTable ; $6BBB: $21 $50 $C4
add hl, bc ; $6BBE: $09
ld [hl], $30 ; $6BBF: $36 $30
call GetRandomByte ; $6BC1: $CD $0D $28
@ -434,7 +434,7 @@ jr_018_6C63:
jr nz, func_018_6CB8 ; $6C86: $20 $30
jr_018_6C88:
ld hl, wEntitiesDropTimerTable ; $6C88: $21 $50 $C4
ld hl, wEntitiesSlowTransitionCountdownTable ; $6C88: $21 $50 $C4
add hl, bc ; $6C8B: $09
ld a, [hl] ; $6C8C: $7E
and a ; $6C8D: $A7
@ -542,7 +542,7 @@ VireState5Handler::
call IncrementEntityState ; $6D31: $CD $12 $3B
ld [hl], $01 ; $6D34: $36 $01
ld hl, wEntitiesDropTimerTable ; $6D36: $21 $50 $C4
ld hl, wEntitiesSlowTransitionCountdownTable ; $6D36: $21 $50 $C4
add hl, bc ; $6D39: $09
call GetRandomByte ; $6D3A: $CD $0D $28
and $3F ; $6D3D: $E6 $3F

View File

@ -131,7 +131,7 @@ WalrusWakingUpHandler::
ld a, MUSIC_MARIN_SING ; $55CA: $3E $2F
ld [wMusicTrackToPlay], a ; $55CC: $EA $68 $D3
ld [wIsMarinSinging], a ; $55CF: $EA $C8 $C3
call GetEntityDropTimer ; $55D2: $CD $FB $0B
call GetEntitySlowTransitionCountdown ; $55D2: $CD $FB $0B
ld [hl], $50 ; $55D5: $36 $50
ret ; $55D7: $C9
@ -144,7 +144,7 @@ WalrusState2Handler::
ld [wC167], a ; $55E1: $EA $67 $C1
ld a, $02 ; $55E4: $3E $02
ldh [hLinkInteractiveMotionBlocked], a ; $55E6: $E0 $A1
call GetEntityDropTimer ; $55E8: $CD $FB $0B
call GetEntitySlowTransitionCountdown ; $55E8: $CD $FB $0B
jr nz, .jr_55F2 ; $55EB: $20 $05
ld [hl], $C0 ; $55ED: $36 $C0
@ -192,7 +192,7 @@ WalrusState3Handler::
ld [wC167], a ; $5678: $EA $67 $C1
ld a, $02 ; $567B: $3E $02
ldh [hLinkInteractiveMotionBlocked], a ; $567D: $E0 $A1
call GetEntityDropTimer ; $567F: $CD $FB $0B
call GetEntitySlowTransitionCountdown ; $567F: $CD $FB $0B
jr nz, .jr_5698 ; $5682: $20 $14
ld [wIsMarinSinging], a ; $5684: $EA $C8 $C3

View File

@ -335,7 +335,7 @@ func_019_6F8B::
ret ; $6F8B: $C9
func_019_6F8C::
call GetEntityDropTimer ; $6F8C: $CD $FB $0B
call GetEntitySlowTransitionCountdown ; $6F8C: $CD $FB $0B
ret nz ; $6F8F: $C0
call func_019_7CF0 ; $6F90: $CD $F0 $7C
@ -447,7 +447,7 @@ func_019_7039::
call func_019_7D16 ; $7081: $CD $16 $7D
jr nc, .jr_70A6 ; $7084: $30 $20
call GetEntityDropTimer ; $7086: $CD $FB $0B
call GetEntitySlowTransitionCountdown ; $7086: $CD $FB $0B
jr nz, .jr_70A6 ; $7089: $20 $1B
ld a, [wTransitionSequenceCounter] ; $708B: $FA $6B $C1
@ -460,7 +460,7 @@ func_019_7039::
ld [wTransitionSequenceCounter], a ; $7098: $EA $6B $C1
ld [wC16C], a ; $709B: $EA $6C $C1
ld [wGameplaySubtype], a ; $709E: $EA $96 $DB
call GetEntityDropTimer ; $70A1: $CD $FB $0B
call GetEntitySlowTransitionCountdown ; $70A1: $CD $FB $0B
ld [hl], $08 ; $70A4: $36 $08
.jr_70A6

View File

@ -1,8 +1,14 @@
Data_019_536C::
db $F8, $F8, $60, $00, $F8, $00, $62, $00, $F8, $08, $62, $20, $F8, $10, $60, $20
db $08, $F8, $60, $40, $08, $00, $62, $40, $08, $08, $62, $60, $08, $10, $60, $60
GiantBubbleSpriteRect::
db $F8, $F8, $60, OAM_GBC_PAL_0 | OAMF_PAL0
db $F8, $00, $62, OAM_GBC_PAL_0 | OAMF_PAL0
db $F8, $08, $62, OAM_GBC_PAL_0 | OAMF_PAL0 | OAMF_XFLIP
db $F8, $10, $60, OAM_GBC_PAL_0 | OAMF_PAL0 | OAMF_XFLIP
db $08, $F8, $60, OAM_GBC_PAL_0 | OAMF_PAL0 | OAMF_YFLIP
db $08, $00, $62, OAM_GBC_PAL_0 | OAMF_PAL0 | OAMF_YFLIP
db $08, $08, $62, OAM_GBC_PAL_0 | OAMF_PAL0 | OAMF_YFLIP | OAMF_XFLIP
db $08, $10, $60, OAM_GBC_PAL_0 | OAMF_PAL0 | OAMF_YFLIP | OAMF_XFLIP
Data_019_538C::
GiantBubbleTilesOffsets::
db $00, $04, $08, $04
GiantBubbleEntityHandler::
@ -19,11 +25,11 @@ GiantBubbleEntityHandler::
and $03 ; $539E: $E6 $03
ld e, a ; $53A0: $5F
ld d, b ; $53A1: $50
ld hl, Data_019_538C ; $53A2: $21 $8C $53
ld hl, GiantBubbleTilesOffsets ; $53A2: $21 $8C $53
add hl, de ; $53A5: $19
ld a, [hl] ; $53A6: $7E
ldh [hActiveEntityTilesOffset], a ; $53A7: $E0 $F5
ld hl, Data_019_536C ; $53A9: $21 $6C $53
ld hl, GiantBubbleSpriteRect ; $53A9: $21 $6C $53
ld c, $08 ; $53AC: $0E $08
call RenderActiveEntitySpritesRect ; $53AE: $CD $E6 $3C
call ReturnIfNonInteractive_19 ; $53B1: $CD $3D $7D
@ -34,7 +40,7 @@ GiantBubbleEntityHandler::
add hl, bc ; $53C0: $09
ld a, [hl] ; $53C1: $7E
and $03 ; $53C2: $E6 $03
jr z, .jr_53CE ; $53C4: $28 $08
jr z, .horizontalCollisionEnd ; $53C4: $28 $08
ld hl, wEntitiesSpeedXTable ; $53C6: $21 $40 $C2
add hl, bc ; $53C9: $09
@ -43,12 +49,12 @@ GiantBubbleEntityHandler::
inc a ; $53CC: $3C
ld [hl], a ; $53CD: $77
.jr_53CE
.horizontalCollisionEnd
ld hl, wEntitiesCollisionsTable ; $53CE: $21 $A0 $C2
add hl, bc ; $53D1: $09
ld a, [hl] ; $53D2: $7E
and $0C ; $53D3: $E6 $0C
jr z, .ret_53DF ; $53D5: $28 $08
jr z, .verticalCollisionEnd ; $53D5: $28 $08
ld hl, wEntitiesSpeedYTable ; $53D7: $21 $50 $C2
add hl, bc ; $53DA: $09
@ -57,5 +63,5 @@ GiantBubbleEntityHandler::
inc a ; $53DD: $3C
ld [hl], a ; $53DE: $77
.ret_53DF
.verticalCollisionEnd
ret ; $53DF: $C9

View File

@ -534,7 +534,7 @@ func_019_756F::
call GetEntityTransitionCountdown ; $7579: $CD $05 $0C
jr nz, .jr_7586 ; $757C: $20 $08
call GetEntityDropTimer ; $757E: $CD $FB $0B
call GetEntitySlowTransitionCountdown ; $757E: $CD $FB $0B
ld [hl], $28 ; $7581: $36 $28
jp IncrementEntityState ; $7583: $C3 $12 $3B
@ -578,7 +578,7 @@ func_019_7640::
ld hl, wEntitiesFlashCountdownTable ; $764D: $21 $20 $C4
add hl, bc ; $7650: $09
ld [hl], a ; $7651: $77
call GetEntityDropTimer ; $7652: $CD $FB $0B
call GetEntitySlowTransitionCountdown ; $7652: $CD $FB $0B
jr nz, .jr_765A ; $7655: $20 $03
jp IncrementEntityState ; $7657: $C3 $12 $3B

View File

@ -337,22 +337,22 @@ EntityInitHandlersTable::
._2A dw EntityInitWithRandomDirection
._2B dw EntityInitWithRandomDirection
._2C dw EntityInitWithRandomDirection
._2D dw EntityInitPermanentDroppable
._2E dw EntityInitTemporaryDroppable
._2F dw EntityInitTemporaryDroppable
._2D dw EntityInitDiggableBushOrPotDroppable
._2E dw EntityInitTreeOrPotDroppable
._2F dw EntityInitTreeOrPotDroppable
._30 dw EntityInitKeyDropPoint
._31 dw EntityInitSword
._32 dw EntityInitTemporaryDroppable
._33 dw EntityInitTemporaryDroppable
._34 dw EntityInitTemporaryDroppable
._32 dw EntityInitTreeOrPotDroppable
._33 dw EntityInitTreeOrPotDroppable
._34 dw EntityInitTreeOrPotDroppable
._35 dw EntityInitNoop
._36 dw EntityInitTemporaryDroppable
._37 dw EntityInitTemporaryDroppable
._38 dw EntityInitTemporaryDroppable
._36 dw EntityInitTreeOrPotDroppable
._37 dw EntityInitTreeOrPotDroppable
._38 dw EntityInitTreeOrPotDroppable
._39 dw EntityInitWithShiftedXPosition
._3A dw EntityInitNoop
._3B dw EntityInitPermanentDroppable
._3C dw EntityInitPermanentDroppable
._3B dw EntityInitDiggableBushOrPotDroppable
._3C dw EntityInitDiggableBushOrPotDroppable
._3D dw EntityInitSecretSeashell
._3E dw EntityInitMarin
._3F dw EntityInitTarin

View File

@ -409,7 +409,7 @@ EntityInitFireballShooter::
jp SetEntitySpriteVariant ; $49C5: $C3 $0C $3B
EntityInitAntiKirby::
call GetEntityDropTimer ; $49C8: $CD $FB $0B
call GetEntitySlowTransitionCountdown ; $49C8: $CD $FB $0B
call GetRandomByte ; $49CB: $CD $0D $28
and $3F ; $49CE: $E6 $3F
add $10 ; $49D0: $C6 $10
@ -929,7 +929,7 @@ EntityDestructionHandler::
call ExecuteActiveEntityHandler_trampoline ; $4C67: $CD $81 $3A
call ReturnIfNonInteractive_03.allowInactiveEntity ; $4C6A: $CD $7E $7F
call ApplyRecoilIfNeeded_03 ; $4C6D: $CD $A9 $7F
call func_003_60B3 ; $4C70: $CD $B3 $60
call BouncingEntityPhysics ; $4C70: $CD $B3 $60
IF __OPTIMIZATIONS_1__
jp ClearEntitySpeed
ELSE
@ -1136,7 +1136,7 @@ EntityThrownHandler::
ld hl, wEntitiesIgnoreHitsCountdownTable ; $4D9A: $21 $10 $C4
add hl, bc ; $4D9D: $09
ld [hl], $02 ; $4D9E: $36 $02
call func_003_60B3 ; $4DA0: $CD $B3 $60
call BouncingEntityPhysics ; $4DA0: $CD $B3 $60
ld hl, wEntitiesIgnoreHitsCountdownTable ; $4DA3: $21 $10 $C4
add hl, bc ; $4DA6: $09
ld [hl], b ; $4DA7: $70
@ -1211,7 +1211,7 @@ EntityStunnedHandler::
call ExecuteActiveEntityHandler_trampoline ; $4E07: $CD $81 $3A
call ReturnIfNonInteractive_03.allowInactiveEntity ; $4E0A: $CD $7E $7F
call ApplyRecoilIfNeeded_03 ; $4E0D: $CD $A9 $7F
call func_003_60B3 ; $4E10: $CD $B3 $60
call BouncingEntityPhysics ; $4E10: $CD $B3 $60
call ClearEntitySpeed ; $4E13: $CD $7F $3D
call func_003_6E2B ; $4E16: $CD $2B $6E
ld a, [wInventoryItems.BButtonSlot] ; $4E19: $FA $00 $DB
@ -1380,17 +1380,17 @@ EntityInitSecretSeashell::
ld [hl], $02 ; $4EFF: $36 $02
ldh a, [hMapRoom] ; $4F01: $F0 $F6
cp UNKNOWN_ROOM_A4 ; Overworld room A4 (1 east of Mabe's big bush field)
jr z, .jr_4F0B ; $4F05: $28 $04
jr z, .treeSeashell ; $4F05: $28 $04
cp UNKNOWN_ROOM_D2 ; overworld room D2 (1 west of Tail Cave)
jr nz, jr_003_4F0F ; $4F09: $20 $04
jr nz, .treeSeashellEnd ; $4F09: $20 $04
.jr_4F0B
.treeSeashell
dec [hl] ; $4F0B: $35
call EntityInitWithShiftedPosition ; $4F0C: $CD $83 $4F
jr_003_4F0F:
jp jr_003_4F24 ; $4F0F: $C3 $24 $4F
.treeSeashellEnd
jp SetHiddenDroppableOptions1 ; $4F0F: $C3 $24 $4F
func_003_4F12::
ld hl, wEntitiesPrivateState3Table ; $4F12: $21 $D0 $C2
@ -1398,18 +1398,18 @@ func_003_4F12::
ld [hl], $01 ; $4F16: $36 $01
ld a, [wIsIndoor] ; $4F18: $FA $A5 $DB
and a ; $4F1B: $A7
jr z, jr_003_4F24 ; $4F1C: $28 $06
jr z, SetHiddenDroppableOptions1 ; $4F1C: $28 $06
EntityInitPermanentDroppable::
EntityInitDiggableBushOrPotDroppable::
ld hl, wEntitiesPrivateState3Table ; $4F1E: $21 $D0 $C2
add hl, bc ; $4F21: $09
ld [hl], $02 ; $4F22: $36 $02
jr_003_4F24:
SetHiddenDroppableOptions1::
ld hl, wEntitiesOptions1Table ; $4F24: $21 $30 $C4
add hl, bc ; $4F27: $09
ld a, [hl] ; $4F28: $7E
or %00010001 ; $4F29: $F6 $11
or ENTITY_OPT1_IMMUNE_WATER_PIT|ENTITY_OPT1_MOVE_PIT_WATER ; $4F29: $F6 $11
ld [hl], a ; $4F2B: $77
ret ; $4F2C: $C9
@ -1479,7 +1479,7 @@ EntityInitWarp::
call IncrementEntityState ; $4F75: $CD $12 $3B
jr EntityInitWithShiftedPosition ; $4F78: $18 $09
EntityInitTemporaryDroppable::
EntityInitTreeOrPotDroppable::
call func_003_4F12 ; $4F7A: $CD $12 $4F
ld a, [wIsIndoor] ; $4F7D: $FA $A5 $DB
and a ; $4F80: $A7
@ -1518,7 +1518,7 @@ EntityInitWithShiftedXPosition::
jr EntityShiftPosition.shiftBy8 ; $4FA7: $18 $E9
SetDroppableDefaultTimer::
call GetEntityDropTimer ; $4FA9: $CD $FB $0B
call GetEntitySlowTransitionCountdown ; $4FA9: $CD $FB $0B
ld [hl], $80 ; $4FAC: $36 $80
ret ; $4FAE: $C9
@ -2526,7 +2526,7 @@ SpawnEnemyDrop::
add hl, de ; $568A: $19
ld [hl], a ; $568B: $77
; configure timers
ld hl, wEntitiesDropTimerTable ; $568C: $21 $50 $C4
ld hl, wEntitiesSlowTransitionCountdownTable ; $568C: $21 $50 $C4
add hl, de ; $568F: $19
ld [hl], DROP_DESPAWN_TIME ; $5690: $36 $80
ld hl, wEntitiesPrivateCountdown1Table ; $5692: $21 $F0 $C2
@ -2775,7 +2775,7 @@ HeartContainerEntityHandler::
ld de, HeartContainerSpriteVariants ; $59DC: $11 $D8 $59
call RenderActiveEntitySpritesPair ; $59DF: $CD $C0 $3B
call GetEntityTransitionCountdown ; $59E2: $CD $05 $0C
jp z, label_003_60AA ; $59E5: $CA $AA $60
jp z, PickableHandler ; $59E5: $CA $AA $60
; Start of when item is picked up
dec a ; $59E8: $3D
@ -3027,7 +3027,7 @@ DrawHeartPiecesInDialog::
HeartPieceState0Handler::
ld de, HeartPieceEntitySprite ; $5B52: $11 $4D $5A
call RenderActiveEntitySpritesPair ; $5B55: $CD $C0 $3B
jp label_003_60AA ; $5B58: $C3 $AA $60
jp PickableHandler ; $5B58: $C3 $AA $60
Data_003_5B5B::
db $AE, $14
@ -3040,11 +3040,11 @@ GuardianAcornEntityHandler::
; define sprite variants by selecting tile n° and setting OAM attributes (palette + flags) in a list
PieceOfPowerSpriteVariants::
.variant0
db $14, $02
db $14, $22
db $14, OAM_GBC_PAL_2 | OAMF_PAL0
db $14, OAM_GBC_PAL_2 | OAMF_PAL0 | OAMF_XFLIP
.variant1
db $14, $14
db $14, $34
db $14, OAM_GBC_PAL_4 | OAMF_PAL1
db $14, OAM_GBC_PAL_4 | OAMF_PAL1 | OAMF_XFLIP
PieceOfPowerEntityHandler::
ld de, PieceOfPowerSpriteVariants ; $5B6D: $11 $65 $5B
@ -3057,7 +3057,7 @@ PieceOfPowerEntityHandler::
call SetEntitySpriteVariant ; $5B7A: $CD $0C $3B
jr_003_5B7D:
jp label_003_60AA ; $5B7D: $C3 $AA $60
jp PickableHandler ; $5B7D: $C3 $AA $60
; define sprite variants by selecting tile n° and setting OAM attributes (palette + flags) in a list
IronMasksMaskSpriteVariants::
@ -3072,7 +3072,7 @@ IronMasksMaskEntityHandler::
ld de, IronMasksMaskSpriteVariants ; $5B88: $11 $80 $5B
call RenderActiveEntitySpritesPair ; $5B8B: $CD $C0 $3B
call ReturnIfNonInteractive_03 ; $5B8E: $CD $78 $7F
call func_003_62AF ; $5B91: $CD $AF $62
call PickableHandleGrabbedByItemIfNeeded ; $5B91: $CD $AF $62
ret ; $5B94: $C9
Data_003_5B95::
@ -3105,7 +3105,7 @@ SwordShieldPickableEntityHandler::
SwordShieldPickableState0Handler::
call GetEntityTransitionCountdown ; $5BBA: $CD $05 $0C
jp z, label_003_60AA ; $5BBD: $CA $AA $60
jp z, PickableHandler ; $5BBD: $CA $AA $60
cp $10 ; $5BC0: $FE $10
jr nz, .playSwordFanfare ; $5BC2: $20 $07
@ -3127,7 +3127,7 @@ SwordShieldPickableState0Handler::
ld a, MUSIC_OVERWORLD ; $5BD3: $3E $05
ldh [hDefaultMusicTrack], a ; $5BD5: $E0 $B0
ldh [hNextDefaultMusicTrack], a ; $5BD7: $E0 $BF
call GetEntityDropTimer ; $5BD9: $CD $FB $0B
call GetEntitySlowTransitionCountdown ; $5BD9: $CD $FB $0B
ld [hl], $52 ; $5BDC: $36 $52
call IncrementEntityState ; $5BDE: $CD $12 $3B
@ -3136,7 +3136,7 @@ SwordShieldPickableState0Handler::
SwordShieldPickableState1Handler::
call HoldEntityAboveLink ; $5BE4: $CD $17 $5A
call GetEntityDropTimer ; $5BE7: $CD $FB $0B
call GetEntitySlowTransitionCountdown ; $5BE7: $CD $FB $0B
ret nz ; $5BEA: $C0
; Make Link perform a spin-attack
@ -3206,7 +3206,7 @@ label_003_5C49:
ld de, HookshotSpriteData ; $5C50: $11 $47 $5C
call RenderActiveEntitySprite ; $5C53: $CD $77 $3C
call GetEntityTransitionCountdown ; $5C56: $CD $05 $0C
jp z, label_003_60AA ; $5C59: $CA $AA $60
jp z, PickableHandler ; $5C59: $CA $AA $60
cp $10 ; $5C5C: $FE $10
jr nz, .skipUpdateSpeedY ; $5C5E: $20 $07
@ -3308,17 +3308,17 @@ ENDC
label_003_5CD6:
call ReturnIfNonInteractive_03 ; $5CD6: $CD $78 $7F
call func_003_62AF ; $5CD9: $CD $AF $62
call PickableHandleGrabbedByItemIfNeeded ; $5CD9: $CD $AF $62
ld hl, wEntitiesPosZTable ; $5CDC: $21 $10 $C3
add hl, bc ; $5CDF: $09
ld a, [hl] ; $5CE0: $7E
and a ; $5CE1: $A7
jr nz, .jr_5CE7 ; $5CE2: $20 $03
call func_003_62EB ; $5CE4: $CD $EB $62
call PickableCollectIfNeeded ; $5CE4: $CD $EB $62
.jr_5CE7
jp func_003_60B3 ; $5CE7: $C3 $B3 $60
jp BouncingEntityPhysics ; $5CE7: $C3 $B3 $60
CheckForEntityFallingDownQuicksandHole::
; This is called from the bomb code as well.
@ -3373,21 +3373,20 @@ CheckForEntityFallingDownQuicksandHole::
and a ; $5D34: $A7
ret ; $5D35: $C9
Data_003_5D36::
db $A8, $14
DroppableHeartSprite::
db $A8, OAM_GBC_PAL_4 | OAMF_PAL1
DroppableHeartEntityHandler::
call func_003_61DE ; $5D38: $CD $DE $61
call func_003_608C ; $5D3B: $CD $8C $60
ld de, Data_003_5D36 ; $5D3E: $11 $36 $5D
call DroppableRevealOrReturnIfNeeded ; $5D38: $CD $DE $61
call DroppableDisappearIfNeeded ; $5D3B: $CD $8C $60
ld de, DroppableHeartSprite ; $5D3E: $11 $36 $5D
call RenderActiveEntitySprite ; $5D41: $CD $77 $3C
jp label_003_60AA ; $5D44: $C3 $AA $60
jp PickableHandler ; $5D44: $C3 $AA $60
; define sprite variants by selecting tile n° and setting OAM attributes (palette + flags) in a list
SleepyToadstoolSpriteVariants::
.variant0
db $5E, $02
db $5E, $22
SleepyToadstoolSprite::
db $5E, OAM_GBC_PAL_2 | OAMF_PAL0
db $5E, OAM_GBC_PAL_2 | OAMF_PAL0 | OAMF_XFLIP
SleepyToadstoolEntityHandler::
ld hl, wHasToadstool ; $5D4B: $21 $4B $DB
@ -3395,10 +3394,10 @@ SleepyToadstoolEntityHandler::
or [hl] ; $5D51: $B6
jp nz, UnloadEntityAndReturn ; $5D52: $C2 $8D $3F
ld de, SleepyToadstoolSpriteVariants ; $5D55: $11 $47 $5D
ld de, SleepyToadstoolSprite ; $5D55: $11 $47 $5D
call RenderActiveEntitySpritesPair ; $5D58: $CD $C0 $3B
call GetEntityTransitionCountdown ; $5D5B: $CD $05 $0C
jp z, label_003_60AA ; $5D5E: $CA $AA $60
jp z, PickableHandler ; $5D5E: $CA $AA $60
cp $10 ; $5D61: $FE $10
jr nz, .jr_5D6C ; $5D63: $20 $07
@ -3464,7 +3463,7 @@ SirensInstrumentState2Handler::
call func_006_783C_trampoline ; $5DD9: $CD $76 $3E
ld a, $01 ; $5DDC: $3E $01
ld [wC167], a ; $5DDE: $EA $67 $C1
call GetEntityDropTimer ; $5DE1: $CD $FB $0B
call GetEntitySlowTransitionCountdown ; $5DE1: $CD $FB $0B
jr nz, animateSirensInstrumentPickup ; $5DE4: $20 $43
call UnloadEntity ; $5DE6: $CD $8D $3F
@ -3650,7 +3649,7 @@ ENDC
func_003_5ED5::
call GetEntityTransitionCountdown ; $5ED5: $CD $05 $0C
jp z, label_003_60AA ; $5ED8: $CA $AA $60
jp z, PickableHandler ; $5ED8: $CA $AA $60
cp $10 ; $5EDB: $FE $10
jr nz, .jr_5EFE ; $5EDD: $20 $1F
@ -3764,7 +3763,7 @@ func_003_5F33::
ld hl, wEntitiesPrivateState1Table ; $5F50: $21 $B0 $C2
add hl, de ; $5F53: $19
ld [hl], $02 ; $5F54: $36 $02
ld hl, wEntitiesDropTimerTable ; $5F56: $21 $50 $C4
ld hl, wEntitiesSlowTransitionCountdownTable ; $5F56: $21 $50 $C4
add hl, de ; $5F59: $19
ld [hl], $80 ; $5F5A: $36 $80
jp IncrementEntityState ; $5F5C: $C3 $12 $3B
@ -3844,19 +3843,19 @@ ENDC
func_003_5FBF::
ret ; $5FBF: $C9
Data_003_5FC0::
db $80, $15
DroppableBombsSprite::
db $80, OAM_GBC_PAL_5 | OAMF_PAL1
DroppableBombsEntityHandler::
call func_003_61DE ; $5FC2: $CD $DE $61
call func_003_608C ; $5FC5: $CD $8C $60
ld de, Data_003_5FC0 ; $5FC8: $11 $C0 $5F
call DroppableRevealOrReturnIfNeeded ; $5FC2: $CD $DE $61
call DroppableDisappearIfNeeded ; $5FC5: $CD $8C $60
ld de, DroppableBombsSprite ; $5FC8: $11 $C0 $5F
call RenderActiveEntitySprite ; $5FCB: $CD $77 $3C
jp label_003_60AA ; $5FCE: $C3 $AA $60
jp PickableHandler ; $5FCE: $C3 $AA $60
; Data for loading secret seashell when bush is clipped (and when dug from ground)
data_003_5FD1::
db $9E, $14
DroppableSeashellSprite::
db $9E, OAM_GBC_PAL_4 | OAMF_PAL1
DroppableSeashellEntityHandler::
ld a, [wSwordLevel] ; $5FD3: $FA $4E $DB
@ -3876,24 +3875,24 @@ DroppableSeashellEntityHandler::
jp z, UnloadEntityAndReturn ; $5FEC: $CA $8D $3F
.jr_5FEF
call func_003_61DE ; $5FEF: $CD $DE $61
ld de, data_003_5FD1 ; $5FF2: $11 $D1 $5F
call DroppableRevealOrReturnIfNeeded ; $5FEF: $CD $DE $61
ld de, DroppableSeashellSprite ; $5FF2: $11 $D1 $5F
call RenderActiveEntitySprite ; $5FF5: $CD $77 $3C
jp label_003_60AA ; $5FF8: $C3 $AA $60
jp PickableHandler ; $5FF8: $C3 $AA $60
Data_003_5FFB::
db $CA, $14
HidingSlimeKeySprite::
db $CA, OAM_GBC_PAL_4 | OAMF_PAL1
HidingSlimeKeyEntityHandler::
ldh a, [hRoomStatus] ; $5FFD: $F0 $F8
and ROOM_STATUS_EVENT_1 ; $5FFF: $E6 $10
jp nz, UnloadEntityAndReturn ; $6001: $C2 $8D $3F
call func_003_61DE ; $6004: $CD $DE $61
ld de, Data_003_5FFB ; $6007: $11 $FB $5F
call DroppableRevealOrReturnIfNeeded ; $6004: $CD $DE $61
ld de, HidingSlimeKeySprite ; $6007: $11 $FB $5F
call RenderActiveEntitySprite ; $600A: $CD $77 $3C
call GetEntityTransitionCountdown ; $600D: $CD $05 $0C
jp z, label_003_60AA ; $6010: $CA $AA $60
jp z, PickableHandler ; $6010: $CA $AA $60
cp $10 ; $6013: $FE $10
jr nz, jr_003_604C ; $6015: $20 $35
@ -3945,8 +3944,8 @@ ELSE
jp HoldEntityAboveLink ; $6052: $C3 $17 $5A
ENDC
Data_003_6055::
db $8E, $16
DroppableMagicPowderSprite::
db $8E, OAM_GBC_PAL_6 | OAMF_PAL1
DroppableMagicPowderEntityHandler::
ld a, [wIsIndoor] ; $6057: $FA $A5 $DB
@ -3963,27 +3962,27 @@ DroppableMagicPowderEntityHandler::
jp nz, UnloadEntityAndReturn ; $6067: $C2 $8D $3F
jr_003_606A:
call func_003_61DE ; $606A: $CD $DE $61
call func_003_608C ; $606D: $CD $8C $60
ld de, Data_003_6055 ; $6070: $11 $55 $60
call DroppableRevealOrReturnIfNeeded ; $606A: $CD $DE $61
call DroppableDisappearIfNeeded ; $606D: $CD $8C $60
ld de, DroppableMagicPowderSprite ; $6070: $11 $55 $60
call RenderActiveEntitySprite ; $6073: $CD $77 $3C
jp label_003_60AA ; $6076: $C3 $AA $60
jp PickableHandler ; $6076: $C3 $AA $60
; define sprite variants by selecting tile n° and setting OAM attributes (palette + flags) in a list
DroppableArrowSpriteVariants::
.variant0
db $2A, $41
db $2A, $61
DroppableArrowSprite::
db $2A, OAM_GBC_PAL_1 | OAMF_PAL0 | OAMF_YFLIP
db $2A, OAM_GBC_PAL_1 | OAMF_PAL0 | OAMF_YFLIP | OAMF_XFLIP
DroppableArrowsEntityHandler::
call func_003_61DE ; $607D: $CD $DE $61
call func_003_608C ; $6080: $CD $8C $60
ld de, DroppableArrowSpriteVariants ; $6083: $11 $79 $60
call DroppableRevealOrReturnIfNeeded ; $607D: $CD $DE $61
call DroppableDisappearIfNeeded ; $6080: $CD $8C $60
ld de, DroppableArrowSprite ; $6083: $11 $79 $60
call RenderActiveEntitySpritesPair ; $6086: $CD $C0 $3B
jp label_003_60AA ; $6089: $C3 $AA $60
jp PickableHandler ; $6089: $C3 $AA $60
func_003_608C::
call GetEntityDropTimer ; $608C: $CD $FB $0B
; After enough time, fade away and disappear.
DroppableDisappearIfNeeded::
call GetEntitySlowTransitionCountdown ; $608C: $CD $FB $0B
cp $1C ; $608F: $FE $1C
ret nc ; $6091: $D0
@ -3994,33 +3993,36 @@ func_003_608C::
dec a ; $6098: $3D
jp SetEntitySpriteVariant ; $6099: $C3 $0C $3B
Data_003_609C::
db $A6, $15
DroppableRupeeSprite::
db $A6, OAM_GBC_PAL_5 | OAMF_PAL1
DroppableRupeeEntityHandler::
call func_003_61DE ; $609E: $CD $DE $61
call func_003_608C ; $60A1: $CD $8C $60
ld de, Data_003_609C ; $60A4: $11 $9C $60
call DroppableRevealOrReturnIfNeeded ; $609E: $CD $DE $61
call DroppableDisappearIfNeeded ; $60A1: $CD $8C $60
ld de, DroppableRupeeSprite ; $60A4: $11 $9C $60
call RenderActiveEntitySprite ; $60A7: $CD $77 $3C
; fallthrough
label_003_60AA:
PickableHandler::
call ReturnIfNonInteractive_03 ; $60AA: $CD $78 $7F
call func_003_62AF ; $60AD: $CD $AF $62
call func_003_62EB ; $60B0: $CD $EB $62
call PickableHandleGrabbedByItemIfNeeded ; $60AD: $CD $AF $62
call PickableCollectIfNeeded ; $60B0: $CD $EB $62
; fallthrough
func_003_60B3::
BouncingEntityPhysics::
call UpdateEntityPosWithSpeed_03 ; $60B3: $CD $25 $7F
call func_003_6B7B ; $60B6: $CD $7B $6B
call DefaultEntityPhysics ; $60B9: $CD $93 $78
ldh a, [hIsSideScrolling] ; $60BC: $F0 $F9
and a ; $60BE: $A7
jr z, .jr_60E3 ; $60BF: $28 $22
jr z, .sidescrollingEnd ; $60BF: $28 $22
; If colliding with the ground, bounce. Otherwise, return.
ld hl, wEntitiesCollisionsTable ; $60C1: $21 $A0 $C2
add hl, bc ; $60C4: $09
ld a, [hl] ; $60C5: $7E
and $08 ; $60C6: $E6 $08
jp z, ret_003_6156 ; $60C8: $CA $56 $61
jp z, .return ; $60C8: $CA $56 $61
ld hl, wEntitiesPosYTable ; $60CB: $21 $10 $C2
add hl, bc ; $60CE: $09
@ -4034,16 +4036,17 @@ func_003_60B3::
cpl ; $60DA: $2F
sra a ; $60DB: $CB $2F
cp $F8 ; $60DD: $FE $F8
jr c, jr_003_6112 ; $60DF: $38 $31
jr c, .makeBouncingNoise ; $60DF: $38 $31
jr jr_003_6103 ; $60E1: $18 $20
jr .clearZSpeedEnd ; $60E1: $18 $20
.jr_60E3
.sidescrollingEnd
; If colliding with the ground, bounce. Otherwise, return.
ld hl, wEntitiesPosZTable ; $60E3: $21 $10 $C3
add hl, bc ; $60E6: $09
ld a, [hl] ; $60E7: $7E
and $80 ; $60E8: $E6 $80
jr z, ret_003_6156 ; $60EA: $28 $6A
jr z, .return ; $60EA: $28 $6A
xor a ; $60EC: $AF
ld [hl], a ; $60ED: $77
@ -4053,15 +4056,15 @@ func_003_60B3::
ld hl, wEntitiesSpeedZTable ; $60F3: $21 $20 $C3
add hl, bc ; $60F6: $09
cp $02 ; $60F7: $FE $02
jr z, jr_003_6103 ; $60F9: $28 $08
jr z, .clearZSpeedEnd ; $60F9: $28 $08
ld a, [hl] ; $60FB: $7E
sra a ; $60FC: $CB $2F
cpl ; $60FE: $2F
cp $07 ; $60FF: $FE $07
jr nc, jr_003_6112 ; $6101: $30 $0F
jr nc, .makeBouncingNoise ; $6101: $30 $0F
jr_003_6103:
.clearZSpeedEnd
xor a ; $6103: $AF
push hl ; $6104: $E5
ld hl, wEntitiesSpeedXTable ; $6105: $21 $40 $C2
@ -4071,20 +4074,21 @@ jr_003_6103:
add hl, bc ; $610D: $09
ld [hl], a ; $610E: $77
pop hl ; $610F: $E1
jr jr_003_6136 ; $6110: $18 $24
jr .makeBouncingNoiseEnd ; $6110: $18 $24
jr_003_6112:
.makeBouncingNoise
push af ; $6112: $F5
push hl ; $6113: $E5
; If key or bomb, make appropriate sound
ldh a, [hActiveEntityType] ; $6114: $F0 $EB
cp ENTITY_KEY_DROP_POINT ; $6116: $FE $30
jr nz, .keyDropPointEnd ; $6118: $20 $06
jr nz, .keyEnd ; $6118: $20 $06
ld a, NOISE_SFX_CLINK ; $611A: $3E $17
ldh [hNoiseSfx], a ; $611C: $E0 $F4
jr .bombEnd ; $611E: $18 $14
.keyDropPointEnd
.keyEnd
cp ENTITY_BOMB ; $6120: $FE $02
jr nz, .bombEnd ; $6122: $20 $10
@ -4095,7 +4099,7 @@ jr_003_6112:
and a ; $6129: $A7
jr z, .bombEnd ; $612A: $28 $08
cp $02 ; $612C: $FE $02
cp ENTITY_STATUS_FALLING ; $612C: $FE $02
jr z, .bombEnd ; $612E: $28 $04
ld a, JINGLE_BUMP ; $6130: $3E $09
@ -4105,36 +4109,38 @@ jr_003_6112:
pop hl ; $6134: $E1
pop af ; $6135: $F1
jr_003_6136:
.makeBouncingNoiseEnd
; Halve x speed
ld [hl], a ; $6136: $77
ld hl, wEntitiesSpeedXTable ; $6137: $21 $40 $C2
add hl, bc ; $613A: $09
ld a, [hl] ; $613B: $7E
sra a ; $613C: $CB $2F
cp $FF ; $613E: $FE $FF
jr nz, .jr_6143 ; $6140: $20 $01
jr nz, .clearXSpeedEnd ; $6140: $20 $01
xor a ; $6142: $AF
.jr_6143
.clearXSpeedEnd
; If not side scrolling, also halve y speed
ld [hl], a ; $6143: $77
ldh a, [hIsSideScrolling] ; $6144: $F0 $F9
and a ; $6146: $A7
jr nz, ret_003_6156 ; $6147: $20 $0D
jr nz, .return ; $6147: $20 $0D
ld hl, wEntitiesSpeedYTable ; $6149: $21 $50 $C2
add hl, bc ; $614C: $09
ld a, [hl] ; $614D: $7E
sra a ; $614E: $CB $2F
cp $FF ; $6150: $FE $FF
jr nz, .jr_6155 ; $6152: $20 $01
jr nz, .clearYSpeedEnd ; $6152: $20 $01
xor a ; $6154: $AF
.jr_6155
.clearYSpeedEnd
ld [hl], a ; $6155: $77
ret_003_6156:
.return
ret ; $6156: $C9
include "code/entities/03_droppable_fairy.asm"
@ -4169,101 +4175,107 @@ func_003_61C0::
ret_003_61DD:
ret ; $61DD: $C9
func_003_61DE::
; For hidden items, either stay hidden (by returning early), or be revealed if dug up, etc.
DroppableRevealOrReturnIfNeeded::
ld hl, wEntitiesPrivateState3Table ; $61DE: $21 $D0 $C2
add hl, bc ; $61E1: $09
ld a, [hl] ; $61E2: $7E
and a ; $61E3: $A7
jp z, label_003_629D ; $61E4: $CA $9D $62
jp z, .return ; $61E4: $CA $9D $62
ld a, [wRoomTransitionState] ; $61E7: $FA $24 $C1
and a ; $61EA: $A7
jp nz, jr_003_629C ; $61EB: $C2 $9C $62
jp nz, .remainInvisible ; $61EB: $C2 $9C $62
ld a, [hl] ; $61EE: $7E
cp $02 ; $61EF: $FE $02
jr nz, jr_003_6243 ; $61F1: $20 $50
jr nz, .checkPegasusBootsCollision ; $61F1: $20 $50
; Items buried, hidden in bushes, or indoors:
ldh a, [hActiveEntityType] ; $61F3: $F0 $EB
cp ENTITY_DROPPABLE_SECRET_SEASHELL ; $61F5: $FE $3D
jr z, .jr_6200 ; $61F7: $28 $07 (???: If a seashell, jump?)
jr z, .skipNotActiveIfIndoors ; $61F7: $28 $07 (???: If a seashell, jump?)
; If indoors and not a seashell, the item can't be dug up or dropped by bushes.
ld a, [wIsIndoor] ; $61F9: $FA $A5 $DB
and a ; $61FC: $A7
jp nz, jr_003_629C ; $61FD: $C2 $9C $62
jp nz, .remainInvisible ; $61FD: $C2 $9C $62
.jr_6200
.skipNotActiveIfIndoors
call func_003_7E0E ; $6200: $CD $0E $7E
ldh a, [hActiveEntityType] ; $6203: $F0 $EB
cp ENTITY_DROPPABLE_HEART ; $6205: $FE $2D
jr z, .jr_6227 ; $6207: $28 $1E
jr z, .activeIfOnShortGrass ; $6207: $28 $1E
cp ENTITY_DROPPABLE_SECRET_SEASHELL ; $6209: $FE $3D
jr nz, jr_003_622F ; $620B: $20 $22
jr nz, .activeIfOnShortGrassEnd ; $620B: $20 $22
; Seashells buried under short grass (some of these don't exist)
ldh a, [hMapRoom] ; $620D: $F0 $F6
cp UNKNOWN_ROOM_DA ; Overworld room one north of fisherman under bridge
jr z, jr_003_622F ; $6211: $28 $1C
jr z, .activeIfOnShortGrassEnd ; $6211: $28 $1C
cp UNKNOWN_ROOM_A5 ; Overworld room two east of Mabe bush field
jr z, jr_003_622F ; $6215: $28 $18
jr z, .activeIfOnShortGrassEnd ; $6215: $28 $18
cp UNKNOWN_ROOM_74 ; Overworld room one south of ghost's gravestone (w/zombies)
jr z, jr_003_622F ; $6219: $28 $14
jr z, .activeIfOnShortGrassEnd ; $6219: $28 $14
cp UNKNOWN_ROOM_3A ; Overworld room with... no seashell?
jr z, jr_003_622F ; $621D: $28 $10
jr z, .activeIfOnShortGrassEnd ; $621D: $28 $10
cp UNKNOWN_ROOM_A8 ; Overworld room northeast-ish of Pothole Field
jr z, jr_003_622F ; $6221: $28 $0C
jr z, .activeIfOnShortGrassEnd ; $6221: $28 $0C
cp UNKNOWN_ROOM_B2 ; Overworld room - Mabe village telephone booth (...no seashell???)
jr z, jr_003_622F ; $6225: $28 $08
jr z, .activeIfOnShortGrassEnd ; $6225: $28 $08
.jr_6227
.activeIfOnShortGrass
ldh a, [hObjectUnderEntity] ; $6227: $F0 $AF
cp $04 ; $6229: $FE $04
jr z, jr_003_623B ; $622B: $28 $0E
cp OBJECT_SHORT_GRASS ; $6229: $FE $04
jr z, .setOptionsAndReveal ; $622B: $28 $0E
jr jr_003_6235 ; $622D: $18 $06
jr .activeIfOnShovelHole ; $622D: $18 $06
jr_003_622F:
.activeIfOnShortGrassEnd
ld hl, wEntitiesPrivateState4Table ; $622F: $21 $40 $C4
add hl, bc ; $6232: $09
ld [hl], $01 ; $6233: $36 $01
jr_003_6235:
.activeIfOnShovelHole
ldh a, [hObjectUnderEntity] ; $6235: $F0 $AF
cp $CC ; $6237: $FE $CC
jr nz, jr_003_629C ; $6239: $20 $61
cp OBJECT_SHOVEL_HOLE ; $6237: $FE $CC
jr nz, .remainInvisible ; $6239: $20 $61
jr_003_623B:
.setOptionsAndReveal
ld hl, wEntitiesOptions1Table ; $623B: $21 $30 $C4
add hl, bc ; $623E: $09
ld [hl], ENTITY_OPT1_SPLASH_IN_WATER|ENTITY_OPT1_EXCLUDED_FROM_KILL_ALL ; $623F: $36 $0A
jr jr_003_626B ; $6241: $18 $28
jr .reveal ; $6241: $18 $28
jr_003_6243:
.checkPegasusBootsCollision
; Items knocked down with the Pegasus Boots:
ld a, [wScreenShakeCountdown] ; $6243: $FA $57 $C1
and a ; $6246: $A7
jr z, jr_003_629C ; $6247: $28 $53
jr z, .remainInvisible ; $6247: $28 $53
ld a, [wC178] ; $6249: $FA $78 $C1
ld a, [wPegasusBootsCollisionCountdown] ; $6249: $FA $78 $C1
and a ; $624C: $A7
jr z, jr_003_629C ; $624D: $28 $4D
jr z, .remainInvisible ; $624D: $28 $4D
ldh a, [hActiveEntityPosX] ; $624F: $F0 $EE
add $08 ; $6251: $C6 $08
ld hl, wC179 ; $6253: $21 $79 $C1
ld hl, wPegasusBootsCollisionPosX ; $6253: $21 $79 $C1
sub [hl] ; $6256: $96
add $10 ; $6257: $C6 $10
cp $20 ; $6259: $FE $20
jr nc, jr_003_629C ; $625B: $30 $3F
jr nc, .remainInvisible ; $625B: $30 $3F
ldh a, [hActiveEntityPosY] ; $625D: $F0 $EF
add $08 ; $625F: $C6 $08
ld hl, wC17A ; $6261: $21 $7A $C1
ld hl, wPegasusBootsCollisionPosY ; $6261: $21 $7A $C1
sub [hl] ; $6264: $96
add $10 ; $6265: $C6 $10
cp $20 ; $6267: $FE $20
jr nc, jr_003_629C ; $6269: $30 $31
jr nc, .remainInvisible ; $6269: $30 $31
jr_003_626B:
.reveal
; Items revealed are thrown away from Link
ld hl, wEntitiesPrivateState3Table ; $626B: $21 $D0 $C2
add hl, bc ; $626E: $09
ld [hl], b ; $626F: $70
@ -4289,16 +4301,16 @@ jr_003_626B:
ld hl, wEntitiesSpeedZTable ; $6291: $21 $20 $C3
add hl, bc ; $6294: $09
ld [hl], $20 ; $6295: $36 $20
call GetEntityDropTimer ; $6297: $CD $FB $0B
call GetEntitySlowTransitionCountdown ; $6297: $CD $FB $0B
ld [hl], $80 ; $629A: $36 $80
jr_003_629C:
.remainInvisible
pop af ; $629C: $F1
label_003_629D:
.return
ret ; $629D: $C9
Data_003_629E::
PickableCanBeCollectedBySwordTable::
; Indexed by entity type
db TRUE ; ENTITY_DROPPABLE_HEART
db TRUE ; ENTITY_DROPPABLE_RUPEE
@ -4318,12 +4330,13 @@ Data_003_629E::
db FALSE ; ENTITY_HIDING_SLIME_KEY
db FALSE ; ENTITY_DROPPABLE_SECRET_SEASHELL
func_003_62AF::
; If an item has been grabbed with the Boomerang or Hookshot, this function handles that
PickableHandleGrabbedByItemIfNeeded::
ld hl, wEntitiesPrivateState5Table ; $62AF: $21 $90 $C3
add hl, bc ; $62B2: $09
ld a, [hl] ; $62B3: $7E
and a ; $62B4: $A7
jr z, ret_003_62EA ; $62B5: $28 $33
jr z, .return ; $62B5: $28 $33
pop de ; $62B7: $D1
dec a ; $62B8: $3D
@ -4333,18 +4346,18 @@ func_003_62AF::
add hl, de ; $62BE: $19
ld a, [hl] ; $62BF: $7E
and a ; $62C0: $A7
jr z, collectPickableItem ; $62C1: $28 $4E
jr z, PickableCollectIfNeeded.collect ; $62C1: $28 $4E
ld hl, wEntitiesTypeTable ; $62C3: $21 $A0 $C3
add hl, de ; $62C6: $19
ld a, [hl] ; $62C7: $7E
cp $01 ; $62C8: $FE $01
jr z, .jr_62D0 ; $62CA: $28 $04
cp ENTITY_BOOMERANG ; $62C8: $FE $01
jr z, .snapToBoomerangOrHookshot ; $62CA: $28 $04
cp $03 ; $62CC: $FE $03
jr nz, collectPickableItem ; $62CE: $20 $41
cp ENTITY_HOOKSHOT_CHAIN ; $62CC: $FE $03
jr nz, PickableCollectIfNeeded.collect ; $62CE: $20 $41
.jr_62D0
.snapToBoomerangOrHookshot
ld hl, wEntitiesPosXTable ; $62D0: $21 $00 $C2
add hl, de ; $62D3: $19
ld a, [hl] ; $62D4: $7E
@ -4362,22 +4375,22 @@ func_003_62AF::
add hl, bc ; $62E8: $09
ld [hl], a ; $62E9: $77
ret_003_62EA:
.return
ret ; $62EA: $C9
func_003_62EB::
PickableCollectIfNeeded::
call GetEntityPrivateCountdown1 ; $62EB: $CD $00 $0C
jr nz, ret_003_62EA ; $62EE: $20 $FA
jr nz, PickableHandleGrabbedByItemIfNeeded.return ; $62EE: $20 $FA
ldh a, [hActiveEntityType] ; $62F0: $F0 $EB
sub $2D ; $62F2: $D6 $2D
ld e, a ; $62F4: $5F
ld d, b ; $62F5: $50
ld hl, Data_003_629E ; $62F6: $21 $9E $62
ld hl, PickableCanBeCollectedBySwordTable ; $62F6: $21 $9E $62
add hl, de ; $62F9: $19
ld a, [hl] ; $62FA: $7E
and a ; $62FB: $A7
jr z, .jr_630C ; $62FC: $28 $0E
jr z, .cannotBeCollectedBySword ; $62FC: $28 $0E
ld hl, wEntitiesIgnoreHitsCountdownTable ; $62FE: $21 $10 $C4
add hl, bc ; $6301: $09
@ -4390,11 +4403,11 @@ func_003_62EB::
pop af ; $630A: $F1
ld [hl], a ; $630B: $77
.jr_630C
.cannotBeCollectedBySword
call func_003_6C6B ; $630C: $CD $6B $6C
jr nc, ret_003_62EA ; $630F: $30 $D9
jr nc, PickableHandleGrabbedByItemIfNeeded.return ; $630F: $30 $D9
collectPickableItem:
.collect
ld hl, wEntitiesLoadOrderTable ; $6311: $21 $60 $C4
add hl, bc ; $6314: $09
ld a, [hl] ; $6315: $7E
@ -4405,11 +4418,11 @@ collectPickableItem:
; Play a sound when picking the item
cp ENTITY_DROPPABLE_FAIRY - $2D ; $631D: $FE $02
jr nc, .notFairy ; $631F: $30 $07
jr nc, .heartOrRupeeEnd ; $631F: $30 $07
ld hl, hJingle ; $6321: $21 $F2 $FF
ld [hl], JINGLE_GOT_HEART ; $6324: $36 $14
jr .sfxEnd ; $6326: $18 $05
.notFairy
.heartOrRupeeEnd
ld hl, hWaveSfx ; $6328: $21 $F3 $FF
ld [hl], WAVE_SFX_SEASHELL ; $632B: $36 $01
.sfxEnd
@ -5651,10 +5664,11 @@ Data_003_6B73::
Data_003_6B77::
db $40, $08, $40, $40
; Apply gravity and, if underwater in a sidescrolling section, reduce horizontal speed
func_003_6B7B::
ldh a, [hIsSideScrolling] ; $6B7B: $F0 $F9
and a ; $6B7D: $A7
jr nz, .jr_6B8C ; $6B7E: $20 $0C
jr nz, .sideScrolling ; $6B7E: $20 $0C
call AddEntityZSpeedToPos_03 ; $6B80: $CD $5E $7F
ld hl, wEntitiesSpeedZTable ; $6B83: $21 $20 $C3
@ -5664,35 +5678,36 @@ func_003_6B7B::
ld [hl], a ; $6B8A: $77
ret ; $6B8B: $C9
.jr_6B8C
.sideScrolling
ld hl, wEntitiesGroundStatusTable ; $6B8C: $21 $70 $C4
add hl, bc ; $6B8F: $09
ld a, [hl] ; $6B90: $7E
ld e, a ; $6B91: $5F
ld d, b ; $6B92: $50
and a ; $6B93: $A7
jr z, jr_003_6BAB ; $6B94: $28 $15
jr z, .updateXSpeedEnd ; $6B94: $28 $15
ldh a, [hFrameCounter] ; $6B96: $F0 $E7
and $07 ; $6B98: $E6 $07
jr nz, jr_003_6BAB ; $6B9A: $20 $0F
jr nz, .updateXSpeedEnd ; $6B9A: $20 $0F
ld hl, wEntitiesSpeedXTable ; $6B9C: $21 $40 $C2
add hl, bc ; $6B9F: $09
ld a, [hl] ; $6BA0: $7E
and a ; $6BA1: $A7
jr z, jr_003_6BAB ; $6BA2: $28 $07
jr z, .updateXSpeedEnd ; $6BA2: $28 $07
and $80 ; $6BA4: $E6 $80
jr z, .jr_6BAA ; $6BA6: $28 $02
jr z, .positiveDifferenceX ; $6BA6: $28 $02
; get here every 8 frames, if underwater and X speed is not 0
inc [hl] ; $6BA8: $34
inc [hl] ; $6BA9: $34
.jr_6BAA
.positiveDifferenceX
dec [hl] ; $6BAA: $35
jr_003_6BAB:
.updateXSpeedEnd
ld hl, Data_003_6B73 ; $6BAB: $21 $73 $6B
add hl, de ; $6BAE: $19
ld a, [hl] ; $6BAF: $7E
@ -5704,14 +5719,14 @@ jr_003_6BAB:
add hl, de ; $6BB9: $19
sub [hl] ; $6BBA: $96
and $80 ; $6BBB: $E6 $80
jr nz, .ret_6BC5 ; $6BBD: $20 $06
jr nz, .return ; $6BBD: $20 $06
ld a, [hl] ; $6BBF: $7E
ld hl, wEntitiesSpeedYTable ; $6BC0: $21 $50 $C2
add hl, bc ; $6BC3: $09
ld [hl], a ; $6BC4: $77
.ret_6BC5
.return
ret ; $6BC5: $C9
; define sprite variants by selecting tile n° and setting OAM attributes (palette + flags) in a list
@ -6301,7 +6316,7 @@ func_003_6E2B::
add hl, bc ; $6E9E: $09
ld a, [hl] ; $6E9F: $7E
and ENTITY_PHYSICS_GRABBABLE ; $6EA0: $E6 $20
jp nz, collectPickableItem ; $6EA2: $C2 $11 $63
jp nz, PickableCollectIfNeeded.collect ; $6EA2: $C2 $11 $63
; if sword collision is enabled jump to EnemyCollidedWithSword
ld a, [wSwordCollisionEnabled] ; $6EA5: $FA $B0 $C5
and a ; $6EA8: $A7
@ -7073,7 +7088,7 @@ jr_003_7279:
jr_003_7293:
ld [hl], $2F ; $7293: $36 $2F
call ConfigureNewEntity ; $7295: $CD $5B $48
call GetEntityDropTimer ; $7298: $CD $FB $0B
call GetEntitySlowTransitionCountdown ; $7298: $CD $FB $0B
ld [hl], $80 ; $729B: $36 $80
jr_003_729D:
@ -7809,7 +7824,7 @@ forceCollisionEnd:
jr nz, jr_003_76AC ; $7690: $20 $1A
inc [hl] ; $7692: $34
ld hl, wEntitiesDropTimerTable ; $7693: $21 $50 $C4
ld hl, wEntitiesSlowTransitionCountdownTable ; $7693: $21 $50 $C4
add hl, de ; $7696: $19
ld [hl], $7F ; $7697: $36 $7F
ld hl, wEntitiesFlashCountdownTable ; $7699: $21 $20 $C4
@ -8986,7 +9001,7 @@ ApplySwordIntersectionWithObjects::
ld hl, wEntitiesStateTable ; $7D39: $21 $90 $C2
add hl, bc ; $7D3C: $09
ld [hl], $01 ; $7D3D: $36 $01
call GetEntityDropTimer ; $7D3F: $CD $FB $0B
call GetEntitySlowTransitionCountdown ; $7D3F: $CD $FB $0B
ld [hl], $80 ; $7D42: $36 $80
pop bc ; $7D44: $C1
ld hl, wC1A2 ; $7D45: $21 $A2 $C1
@ -9332,9 +9347,9 @@ ApplyVectorTowardsLinkAndReturn::
;
; Outputs:
; d x distance (Link's position - entity's position)
; e 0x01 if Link is to the left of the entity, 0x00 otherwise
; e DIRECTION_LEFT if Link is to the left of the entity, DIRECTION_RIGHT otherwise
GetEntityXDistanceToLink_03::
ld e, $00 ; $7ED9: $1E $00
ld e, DIRECTION_RIGHT ; $7ED9: $1E $00
ldh a, [hLinkPositionX] ; $7EDB: $F0 $98
ld hl, wEntitiesPosXTable ; $7EDD: $21 $00 $C2
add hl, bc ; $7EE0: $09
@ -9353,9 +9368,9 @@ GetEntityXDistanceToLink_03::
;
; Outputs:
; d y distance (Link's position - entity's position)
; e 0x02 if Link is above the entity, 0x03 otherwise
; e DIRECTION_UP if Link is above the entity, DIRECTION_DOWN otherwise
GetEntityYDistanceToLink_03::
ld e, $02 ; $7EE9: $1E $02
ld e, DIRECTION_UP ; $7EE9: $1E $02
ldh a, [hLinkPositionY] ; $7EEB: $F0 $99
ld hl, wEntitiesPosYTable ; $7EED: $21 $10 $C2
add hl, bc ; $7EF0: $09
@ -9376,7 +9391,7 @@ GetEntityYDistanceToLink_03::
; bc entity index
;
; Outputs:
; e entity's direction to Link (0 = right, 1 = left, 2 = up, 3 = down)
; e entity's direction to Link (see DIRECTION_* constants for possible values)
GetEntityDirectionToLink_03::
call GetEntityXDistanceToLink_03 ; $7EFE: $CD $D9 $7E
ld a, e ; $7F01: $7B

View File

@ -188,71 +188,88 @@ func_004_6E1D::
ld hl, wEntitiesPrivateState3Table ; $6E2F: $21 $D0 $C2
jp AddEntitySpeedToPos_04.updatePosition ; $6E32: $C3 $EF $6D
func_004_6E35::
ld e, $00 ; $6E35: $1E $00
; Inputs:
; bc entity index
;
; Outputs:
; d x distance (Link's position - entity's position)
; e DIRECTION_LEFT if Link is to the left of the entity, DIRECTION_RIGHT otherwise
GetEntityXDistanceToLink_04::
ld e, DIRECTION_RIGHT ; $6E35: $1E $00
ldh a, [hLinkPositionX] ; $6E37: $F0 $98
ld hl, wEntitiesPosXTable ; $6E39: $21 $00 $C2
add hl, bc ; $6E3C: $09
sub [hl] ; $6E3D: $96
bit 7, a ; $6E3E: $CB $7F
jr z, .jr_6E43 ; $6E40: $28 $01
jr z, .positive ; $6E40: $28 $01
inc e ; $6E42: $1C
.jr_6E43
.positive
ld d, a ; $6E43: $57
ret ; $6E44: $C9
func_004_6E45::
ld e, $02 ; $6E45: $1E $02
; Inputs:
; bc entity index
;
; Outputs:
; d y distance (Link's position - entity's position)
; e DIRECTION_UP if Link is above the entity, DIRECTION_DOWN otherwise
GetEntityYDistanceToLink_04::
ld e, DIRECTION_UP ; $6E45: $1E $02
ldh a, [hLinkPositionY] ; $6E47: $F0 $99
ld hl, wEntitiesPosYTable ; $6E49: $21 $10 $C2
add hl, bc ; $6E4C: $09
sub [hl] ; $6E4D: $96
bit 7, a ; $6E4E: $CB $7F
jr nz, .jr_6E53 ; $6E50: $20 $01
jr nz, .negative ; $6E50: $20 $01
inc e ; $6E52: $1C
.jr_6E53
.negative
ld d, a ; $6E53: $57
ret ; $6E54: $C9
func_004_6E55::
call func_004_6E35 ; $6E55: $CD $35 $6E
; Inputs:
; bc entity index
;
; Outputs:
; e entity's direction to Link (see DIRECTION_* constants for possible values)
GetEntityDirectionToLink_04::
call GetEntityXDistanceToLink_04 ; $6E55: $CD $35 $6E
ld a, e ; $6E58: $7B
ldh [hMultiPurpose0], a ; $6E59: $E0 $D7
ld a, d ; $6E5B: $7A
bit 7, a ; $6E5C: $CB $7F
jr z, .jr_6E62 ; $6E5E: $28 $02
jr z, .positiveX ; $6E5E: $28 $02
cpl ; $6E60: $2F
inc a ; $6E61: $3C
.jr_6E62
.positiveX
push af ; $6E62: $F5
call func_004_6E45 ; $6E63: $CD $45 $6E
call GetEntityYDistanceToLink_04 ; $6E63: $CD $45 $6E
ld a, e ; $6E66: $7B
ldh [hMultiPurpose1], a ; $6E67: $E0 $D8
ld a, d ; $6E69: $7A
bit 7, a ; $6E6A: $CB $7F
jr z, .jr_6E70 ; $6E6C: $28 $02
jr z, .positiveY ; $6E6C: $28 $02
cpl ; $6E6E: $2F
inc a ; $6E6F: $3C
.jr_6E70
.positiveY
pop de ; $6E70: $D1
cp d ; $6E71: $BA
jr nc, .jr_6E78 ; $6E72: $30 $04
jr nc, .vertical ; $6E72: $30 $04
ldh a, [hMultiPurpose0] ; $6E74: $F0 $D7
jr jr_004_6E7A ; $6E76: $18 $02
jr .verticalEnd ; $6E76: $18 $02
.jr_6E78
.vertical
ldh a, [hMultiPurpose1] ; $6E78: $F0 $D8
jr_004_6E7A:
.verticalEnd
ld e, a ; $6E7A: $5F
ret ; $6E7B: $C9
@ -291,7 +308,7 @@ func_004_7C4B:: ; called only from fishing minigame
cp $28 ; $7C77: $FE $28
jr nc, .jr_7C92 ; $7C79: $30 $17
call func_004_6E55 ; $7C7B: $CD $55 $6E
call GetEntityDirectionToLink_04 ; $7C7B: $CD $55 $6E
ldh a, [hLinkDirection] ; $7C7E: $F0 $9E
xor $01 ; $7C80: $EE $01
cp e ; $7C82: $BB

View File

@ -352,9 +352,9 @@ AddEntityZSpeedToPos_06::
;
; Outputs:
; d x distance (Link's position - entity's position)
; e 0x01 if Link is to the left of the entity, 0x00 otherwise
; e DIRECTION_LEFT if Link is to the left of the entity, DIRECTION_RIGHT otherwise
GetEntityXDistanceToLink_06::
ld e, $00 ; $6594: $1E $00
ld e, DIRECTION_RIGHT ; $6594: $1E $00
ldh a, [hLinkPositionX] ; $6596: $F0 $98
ld hl, wEntitiesPosXTable ; $6598: $21 $00 $C2
add hl, bc ; $659B: $09
@ -373,9 +373,9 @@ GetEntityXDistanceToLink_06::
;
; Outputs:
; d y distance (Link's position - entity's position)
; e 0x02 if Link is above the entity, 0x03 otherwise
; e DIRECTION_UP if Link is above the entity, DIRECTION_DOWN otherwise
GetEntityYDistanceToLink_06::
ld e, $02 ; $65A4: $1E $02
ld e, DIRECTION_UP ; $65A4: $1E $02
ldh a, [hLinkPositionY] ; $65A6: $F0 $99
ld hl, wEntitiesPosYTable ; $65A8: $21 $10 $C2
add hl, bc ; $65AB: $09
@ -393,7 +393,7 @@ GetEntityYDistanceToLink_06::
; bc entity index
;
; Outputs:
; e entity's direction to Link (0 = right, 1 = left, 2 = up, 3 = down)
; e entity's direction to Link (see DIRECTION_* constants for possible values)
GetEntityDirectionToLink_06::
call GetEntityXDistanceToLink_06 ; $65B4: $CD $94 $65
ld a, e ; $65B7: $7B

View File

@ -347,9 +347,9 @@ AddEntityZSpeedToPos_07::
;
; Outputs:
; d x distance (Link's position - entity's position)
; e 0x01 if Link is to the left of the entity, 0x00 otherwise
; e DIRECTION_LEFT if Link is to the left of the entity, DIRECTION_RIGHT otherwise
GetEntityXDistanceToLink_07::
ld e, $00 ; $7E5D: $1E $00
ld e, DIRECTION_RIGHT ; $7E5D: $1E $00
ldh a, [hLinkPositionX] ; $7E5F: $F0 $98
ld hl, wEntitiesPosXTable ; $7E61: $21 $00 $C2
add hl, bc ; $7E64: $09
@ -368,9 +368,9 @@ GetEntityXDistanceToLink_07::
;
; Outputs:
; d y distance (Link's position - entity's position)
; e 0x02 if Link is above the entity, 0x03 otherwise
; e DIRECTION_UP if Link is above the entity, DIRECTION_DOWN otherwise
GetEntityYDistanceToLink_07::
ld e, $02 ; $7E6D: $1E $02
ld e, DIRECTION_UP ; $7E6D: $1E $02
ldh a, [hLinkPositionY] ; $7E6F: $F0 $99
ld hl, wEntitiesPosYTable ; $7E71: $21 $10 $C2
add hl, bc ; $7E74: $09
@ -388,7 +388,7 @@ GetEntityYDistanceToLink_07::
; bc entity index
;
; Outputs:
; e entity's direction to Link (0 = right, 1 = left, 2 = up, 3 = down)
; e entity's direction to Link (see DIRECTION_* constants for possible values)
GetEntityDirectionToLink_07::
call GetEntityXDistanceToLink_07 ; $7E7D: $CD $5D $7E
ld a, e ; $7E80: $7B

View File

@ -75,7 +75,7 @@ ResetEntity::
ld hl, wEntitiesGroundStatusTable ; $4070: $21 $70 $C4
add hl, bc ; $4073: $09
ld [hl], b ; $4074: $70
ld hl, wEntitiesDropTimerTable ; $4075: $21 $50 $C4
ld hl, wEntitiesSlowTransitionCountdownTable ; $4075: $21 $50 $C4
add hl, bc ; $4078: $09
ld [hl], b ; $4079: $70
ld hl, wEntitiesPrivateCountdown3Table ; $407A: $21 $80 $C4

View File

@ -115,7 +115,7 @@ DropFairyEffectHandler::
add hl, de ; $5DD3: $19
ld [hl], $30 ; $5DD4: $36 $30
ld hl, wEntitiesDropTimerTable ; $5DD6: $21 $50 $C4
ld hl, wEntitiesSlowTransitionCountdownTable ; $5DD6: $21 $50 $C4
add hl, de ; $5DD9: $19
ld [hl], $80 ; $5DDA: $36 $80

View File

@ -182,6 +182,7 @@ DEF OBJECT_BOMBABLE_CAVE_DOOR EQU $BA
DEF OBJECT_TAIL_KEYHOLE EQU $C0
DEF OBJECT_CLOSED_GATE EQU $C2
DEF OBJECT_GROUND_STAIRS EQU $C6
DEF OBJECT_SHOVEL_HOLE EQU $CC
DEF OBJECT_BUSH_GROUND_STAIRS EQU $D3
DEF OBJECT_SIGNPOST EQU $D4
DEF OBJECT_MONKEY_BRIDGE_TOP EQU $D8

View File

@ -603,16 +603,16 @@ wC176:
wDialogAskSelectionIndex:
ds 1 ; C177
; Unlabeled
wC178:
; Set to 2 when Link collides with a wall, tree, etc, while running with the Pegasus Boots
wPegasusBootsCollisionCountdown:
ds 1 ; C178
; Unlabeled
wC179:
; X position of the last Pegasus Boots collision
wPegasusBootsCollisionPosX:
ds 1 ; C179
; Unlabeled
wC17A:
; Y position of the last Pegasus Boots collision
wPegasusBootsCollisionPosY:
ds 1 ; C17A
; See https://tcrf.net/The_Legend_of_Zelda:_Link%27s_Awakening#Mono_Pausing_the_Engine_and_Mono.2FDX_Free-Movement_Mode
@ -1052,8 +1052,8 @@ wEntitiesStateTable::
; 0 = no collisions,
; bit 1 = collision on the right,
; bit 2 = collision on the left,
; bit 3 = collision on the bottom,
; bit 4 = collision on the top
; bit 3 = collision on the top,
; bit 4 = collision on the bottom
wEntitiesCollisionsTable::
ds $10 ; C2A0 - C2AF
@ -1066,9 +1066,10 @@ wEntitiesCollisionsTable::
; - Butterfly: stores a delta X to move closer to Link
; - Genie: store the substate
; - LikeLike: swallowed item
; - Keese: speed table index
; - Keese: movement angle (0x0 = right ... 0x4 = down ... 0x8 = left ... 0xC = up)
; - Smashable pillar: 0 = pillar, 1 = dust, 2 = debris
; - Pincer: hole X position
; - Peahat: animation speed
wEntitiesPrivateState1Table::
ds $10 ; C2B0 - C2BF
@ -1077,6 +1078,7 @@ wEntitiesPrivateState1Table::
; Examples:
; - Butterfly: stores a delta Y to move closer to Link
; - Keese: -1 when flying counter-clockwise, 1 otherwise
; - Peahat: -1 when flying counter-clockwise, 1 otherwise
; - Pincer: hole Y position
wEntitiesPrivateState2Table::
ds $10 ; C2C0 - C2CF
@ -1084,8 +1086,9 @@ wEntitiesPrivateState2Table::
; Entity-specific state.
;
; Examples:
; - Droppable entity: 0 if ??, 1 if ??, 2 if cannot be picked up by sword
; - Droppable entity: 0 if visible; 1 if can be revealed with Pegasus Boots; 2 if buried, in bush, etc
; - Keese: speed update timer
; - Peahat: speed update timer
; - Pincer: head direction
wEntitiesPrivateState3Table::
ds $10 ; C2D0 - C2DF
@ -1095,6 +1098,9 @@ wEntitiesTransitionCountdownTable::
ds $10 ; C2E0 - C2EF
; Entity-specific countdown 1
;
; Examples:
; - Timer Bombite: flashing timer
wEntitiesPrivateCountdown1Table::
ds $10 ; C2F0 - C2FF
@ -1132,7 +1138,7 @@ wEntitiesPhysicsFlagsTable::
; bit 0: TODO ???,
; bit 1: TODO ???,
; bit 2-6: hitbox type (see HitboxPositions),
; bit 7: force collision (for some entities only)
; bit 7: ignore hits (and force collision, for some entities)
wEntitiesHitboxFlagsTable::
ds $10 ; C350 - C35F
@ -1278,11 +1284,14 @@ wEntitiesOptions1Table::
ds $10 ; C430 - C43F
; Entity-specific state.
;
; Examples:
; - Peahat: movement angle (0x0 = right ... 0x4 = down ... 0x8 = left ... 0xC = up)
wEntitiesPrivateState4Table::
ds $10 ; C440 - C44F
; Number of frame before a dropped item disappears
wEntitiesDropTimerTable::
; Frames before the next state transition of the entity (only decremented every four frames)
wEntitiesSlowTransitionCountdownTable::
ds $10 ; C450 - C45F
; TODO comment
@ -1293,7 +1302,7 @@ wEntitiesLoadOrderTable::
;
; Possible values:
; 0: on standard solid ground
; 1: ???
; 1: on deep water/lava
; 2: on shallow water (draws ripples)
; 3: on tall grass (draws pushed-away grasses)
wEntitiesGroundStatusTable::