documenting code relating to blooper, zol, gel, tektite, pillar and wrecking ball

This commit is contained in:
BlinkingBerry 2024-07-13 14:20:11 +01:00
parent 842e41ec00
commit 9ff8f09e83
45 changed files with 593 additions and 547 deletions

View File

@ -2732,7 +2732,7 @@ LinkMotionMapFadeOutHandler::
.label_1847
call func_1A22 ; $1847: $CD $22 $1A
xor a ; $184A: $AF
ld [wC157], a ; $184B: $EA $57 $C1
ld [wScreenShakeCountdown], a ; $184B: $EA $57 $C1
inc a ; $184E: $3C
ld [wC1A8], a ; $184F: $EA $A8 $C1
ld a, [wTransitionSequenceCounter] ; $1852: $FA $6B $C1

View File

@ -1438,12 +1438,12 @@ func_014_54F8::
ld [wC178], a ; $54FF: $EA $78 $C1
.jr_5502
ld a, [wC157] ; $5502: $FA $57 $C1
ld a, [wScreenShakeCountdown] ; $5502: $FA $57 $C1
and a ; $5505: $A7
jr z, .ret_5525 ; $5506: $28 $1D
dec a ; $5508: $3D
ld [wC157], a ; $5509: $EA $57 $C1
ld [wScreenShakeCountdown], a ; $5509: $EA $57 $C1
and $03 ; $550C: $E6 $03
ld hl, wC158 ; $550E: $21 $58 $C1
add [hl] ; $5511: $86

View File

@ -518,7 +518,7 @@ jr_002_4459:
label_002_4464:
ld e, $03 ; $4464: $1E $03
ld a, [wC117] ; $4466: $FA $17 $C1
ld a, [wIsGelClingingToLink] ; $4466: $FA $17 $C1
and a ; $4469: $A7
jr nz, jr_002_44A2 ; $446A: $20 $36
@ -5906,7 +5906,7 @@ jr_002_6BEB:
call UpdateFinalLinkPosition ; $6C16: $CD $A8 $21
call CheckPositionForMapTransition ; $6C19: $CD $75 $6C
ld a, $20 ; $6C1C: $3E $20
ld [wC157], a ; $6C1E: $EA $57 $C1
ld [wScreenShakeCountdown], a ; $6C1E: $EA $57 $C1
ldh a, [hLinkDirection] ; $6C21: $F0 $9E
and DIRECTION_VERTICAL_MASK ; $6C23: $E6 $02
sla a ; $6C25: $CB $27
@ -6192,7 +6192,7 @@ CheckPositionForMapTransition::
.jr_002_6D94
ld a, [wIgnoreLinkCollisionsCountdown] ; $6D94: $FA $3E $C1
ld hl, wC157 ; $6D97: $21 $57 $C1
ld hl, wScreenShakeCountdown ; $6D97: $21 $57 $C1
or [hl] ; $6D9A: $B6
jr nz, clearIncrementAndReturn ; $6D9B: $20 $6F
@ -7574,7 +7574,7 @@ label_002_74AD:
ld a, $02 ; $74E4: $3E $02
ld [wIsLinkInTheAir], a ; $74E6: $EA $46 $C1
ld a, $20 ; $74E9: $3E $20
ld [wC157], a ; $74EB: $EA $57 $C1
ld [wScreenShakeCountdown], a ; $74EB: $EA $57 $C1
ldh a, [hLinkDirection] ; $74EE: $F0 $9E
and $02 ; $74F0: $E6 $02
sla a ; $74F2: $CB $27

View File

@ -1078,7 +1078,7 @@ func_20_4B1F::
ld [wActiveProjectileCount], a ; $4B23: $EA $4D $C1
ld [wC1A4], a ; $4B26: $EA $A4 $C1
ld [wIsCarryingLiftedObject], a ; $4B29: $EA $5C $C1
ld [wC1AE], a ; $4B2C: $EA $AE $C1
ld [wZolCount], a ; $4B2C: $EA $AE $C1
ld a, [wIsLinkPushing] ; $4B2F: $FA $44 $C1
and a ; $4B32: $A7
jr z, .ret_4B39 ; $4B33: $28 $04

View File

@ -88,7 +88,7 @@ func_004_49DC::
._03 dw SlimeEyeState3Handler ; $49EB
SlimeEyeState0Handler::
ld a, [wC157] ; $49ED: $FA $57 $C1
ld a, [wScreenShakeCountdown] ; $49ED: $FA $57 $C1
cp $05 ; $49F0: $FE $05
jr nz, .jr_49FB ; $49F2: $20 $07
@ -101,7 +101,7 @@ SlimeEyeState0Handler::
jr nz, .ret_4A2C ; $49FE: $20 $2C
ld [hl], $50 ; $4A00: $36 $50
ld a, [wC1AE] ; $4A02: $FA $AE $C1
ld a, [wZolCount] ; $4A02: $FA $AE $C1
cp $02 ; $4A05: $FE $02
jr nc, .ret_4A2C ; $4A07: $30 $23
@ -148,7 +148,7 @@ SlimeEyeState1Handler::
ld [hl], b ; $4A49: $70
ld a, $50 ; $4A4A: $3E $50
ld [wC157], a ; $4A4C: $EA $57 $C1
ld [wScreenShakeCountdown], a ; $4A4C: $EA $57 $C1
ld a, $04 ; $4A4F: $3E $04
ld [wC158], a ; $4A51: $EA $58 $C1
call GetEntityTransitionCountdown ; $4A54: $CD $05 $0C
@ -692,7 +692,7 @@ func_004_4EEB::
jr z, .jr_4F49 ; $4F2C: $28 $1B
ld a, $18 ; $4F2E: $3E $18
ld [wC157], a ; $4F30: $EA $57 $C1
ld [wScreenShakeCountdown], a ; $4F30: $EA $57 $C1
ld a, JINGLE_STRONG_BUMP ; $4F33: $3E $0B
ldh [hJingle], a ; $4F35: $E0 $F2
ld a, [wIsLinkInTheAir] ; $4F37: $FA $46 $C1

View File

@ -307,7 +307,7 @@ func_005_5737::
ret nc ; $5758: $D0
ld a, $30 ; $5759: $3E $30
ld [wC157], a ; $575B: $EA $57 $C1
ld [wScreenShakeCountdown], a ; $575B: $EA $57 $C1
xor a ; $575E: $AF
ld [wC158], a ; $575F: $EA $58 $C1
call PlayBombExplosionSfx ; $5762: $CD $4B $0C
@ -321,7 +321,7 @@ func_005_576E::
add hl, bc ; $5771: $09
ld a, [hl] ; $5772: $7E
inc [hl] ; $5773: $34
ld a, [wC157] ; $5774: $FA $57 $C1
ld a, [wScreenShakeCountdown] ; $5774: $FA $57 $C1
and a ; $5777: $A7
jr nz, .ret_579B ; $5778: $20 $21

View File

@ -776,7 +776,7 @@ jr_005_5E56:
.jr_5E65
jr z, jr_005_5E8A ; $5E65: $28 $23
.jr_5E67
.spawnDebrisEnd
ld hl, wEntitiesDirectionTable ; $5E67: $21 $80 $C3
add hl, bc ; $5E6A: $09
ld a, [hl] ; $5E6B: $7E

View File

@ -38,7 +38,7 @@ func_005_6D00::
ld [hl], $80 ; $6D04: $36 $80
ld a, $FF ; $6D06: $3E $FF
ld [wC157], a ; $6D08: $EA $57 $C1
ld [wScreenShakeCountdown], a ; $6D08: $EA $57 $C1
ld a, NOISE_SFX_SLIME_EEL_FLOOR_BREAK ; $6D0B: $3E $3E
ldh [hNoiseSfx], a ; $6D0D: $E0 $F4
ld [wD3E8], a ; $6D0F: $EA $E8 $D3

View File

@ -353,7 +353,7 @@ ArmosKnightState6Handler::
ret z ; $54F3: $C8
ld a, $30 ; $54F4: $3E $30
ld [wC157], a ; $54F6: $EA $57 $C1
ld [wScreenShakeCountdown], a ; $54F6: $EA $57 $C1
ld a, $04 ; $54F9: $3E $04
ld [wC158], a ; $54FB: $EA $58 $C1
ld a, JINGLE_STRONG_BUMP ; $54FE: $3E $0B

View File

@ -173,24 +173,3 @@ jr_006_7BD6:
.jr_7BE0
ld [de], a ; $7BE0: $12
ret ; $7BE1: $C9
func_006_7BE2::
ldh a, [hMapId] ; $7BE2: $F0 $F7
cp MAP_CAVE_B ; $7BE4: $FE $0A
ret nz ; $7BE6: $C0
.jr_7BE7
ldh a, [hMapRoom] ; $7BE7: $F0 $F6
cp ROOM_INDOOR_B_97 ; $7BE9: $FE $97
jr z, .jr_7BF0 ; $7BEB: $28 $03
cp ROOM_INDOOR_B_98 ; $7BED: $FE $98
ret nz ; $7BEF: $C0
.jr_7BF0
ld a, [wExchangingTradeSequenceItem] ; $7BF0: $FA $7F $DB
and a ; $7BF3: $A7
ret z ; $7BF4: $C8
ld a, $FF ; $7BF5: $3E $FF
ldh [hActiveEntitySpriteVariant], a ; $7BF7: $E0 $F1
ret ; $7BF9: $C9

View File

@ -161,7 +161,7 @@ RollingBonesBarRollingHandler::
inc a ; $6FA1: $3C
ld [hl], a ; $6FA2: $77
ld a, $20 ; $6FA3: $3E $20
ld [wC157], a ; $6FA5: $EA $57 $C1
ld [wScreenShakeCountdown], a ; $6FA5: $EA $57 $C1
xor a ; $6FA8: $AF
ld [wC158], a ; $6FA9: $EA $58 $C1
ld a, JINGLE_STRONG_BUMP ; $6FAC: $3E $0B

View File

@ -7,17 +7,15 @@ TektiteSpriteVariants::
db $5A, OAM_GBC_PAL_2 | OAMF_PAL0
db $5A, OAM_GBC_PAL_2 | OAMF_PAL0 | OAMF_XFLIP
Data_006_78BF::
TektiteXSpeeds::
db $10, $F0, $10, $F0
Data_006_78C3::
TektiteYSpeeds::
db $10, $10, $F0, $F0
TektiteEntityHandler::
ld de, TektiteSpriteVariants ; $78C7: $11 $B7 $78
call RenderActiveEntitySpritesPair ; $78CA: $CD $C0 $3B
.jr_78CD
call ReturnIfNonInteractive_06 ; $78CD: $CD $C6 $64
call ApplyRecoilIfNeeded_06 ; $78D0: $CD $F7 $64
call DefaultEnemyDamageCollisionHandler_trampoline ; $78D3: $CD $39 $3B
@ -27,27 +25,27 @@ TektiteEntityHandler::
add hl, bc ; $78DF: $09
ld a, [hl] ; $78E0: $7E
and $03 ; $78E1: $E6 $03
jr z, .jr_78E8 ; $78E3: $28 $03
jr z, .noCollisionX ; $78E3: $28 $03
call func_006_7979 ; $78E5: $CD $79 $79
call TektiteHorizontalCollision ; $78E5: $CD $79 $79
.jr_78E8
.noCollisionX
ld a, [hl] ; $78E8: $7E
and $0C ; $78E9: $E6 $0C
jr z, .jr_78F0 ; $78EB: $28 $03
jr z, .noCollisionY ; $78EB: $28 $03
call func_006_797E ; $78ED: $CD $7E $79
call TektiteVerticalCollision ; $78ED: $CD $7E $79
.jr_78F0
.noCollisionY
ldh a, [hActiveEntityState] ; $78F0: $F0 $F0
and a ; $78F2: $A7
jr nz, jr_006_7921 ; $78F3: $20 $2C
jr nz, TektiteState1Handler ; $78F3: $20 $2C
ld hl, wEntitiesPosZTable ; $78F5: $21 $10 $C3
add hl, bc ; $78F8: $09
ld a, [hl] ; $78F9: $7E
and $80 ; $78FA: $E6 $80
jr z, .jr_7918 ; $78FC: $28 $1A
jr z, .hitGroundEnd ; $78FC: $28 $1A
xor a ; $78FE: $AF
ld [hl], a ; $78FF: $77
@ -63,14 +61,14 @@ TektiteEntityHandler::
ld a, $01 ; $7913: $3E $01
jp SetEntitySpriteVariant ; $7915: $C3 $0C $3B
.jr_7918
.hitGroundEnd
call AddEntityZSpeedToPos_06 ; $7918: $CD $7A $65
ld hl, wEntitiesSpeedZTable ; $791B: $21 $20 $C3
add hl, bc ; $791E: $09
dec [hl] ; $791F: $35
ret ; $7920: $C9
jr_006_7921:
TektiteState1Handler::
ld hl, wEntitiesInertiaTable ; $7921: $21 $D0 $C3
add hl, bc ; $7924: $09
inc [hl] ; $7925: $34
@ -98,13 +96,13 @@ jr_006_7921:
and $03 ; $794C: $E6 $03
ld e, a ; $794E: $5F
ld d, b ; $794F: $50
ld hl, Data_006_78BF ; $7950: $21 $BF $78
ld hl, TektiteXSpeeds ; $7950: $21 $BF $78
add hl, de ; $7953: $19
ld a, [hl] ; $7954: $7E
ld hl, wEntitiesSpeedXTable ; $7955: $21 $40 $C2
add hl, bc ; $7958: $09
ld [hl], a ; $7959: $77
ld hl, Data_006_78C3 ; $795A: $21 $C3 $78
ld hl, TektiteYSpeeds ; $795A: $21 $C3 $78
add hl, de ; $795D: $19
ld a, [hl] ; $795E: $7E
ld hl, wEntitiesSpeedYTable ; $795F: $21 $50 $C2
@ -112,23 +110,23 @@ jr_006_7921:
ld [hl], a ; $7963: $77
call GetRandomByte ; $7964: $CD $0D $28
and $01 ; $7967: $E6 $01
jr z, .jr_7970 ; $7969: $28 $05
jr z, .skipMoveTowardsLink ; $7969: $28 $05
ld a, $14 ; $796B: $3E $14
call ApplyVectorTowardsLink_trampoline ; $796D: $CD $AA $3B
.jr_7970
.skipMoveTowardsLink
ld hl, wEntitiesStateTable ; $7970: $21 $90 $C2
add hl, bc ; $7973: $09
xor a ; $7974: $AF
ld [hl], a ; $7975: $77
jp SetEntitySpriteVariant ; $7976: $C3 $0C $3B
func_006_7979::
TektiteHorizontalCollision::
ld hl, wEntitiesSpeedXTable ; $7979: $21 $40 $C2
jr jr_006_7982 ; $797C: $18 $04
func_006_797E::
TektiteVerticalCollision::
ld hl, wEntitiesSpeedXTable ; $797E: $21 $40 $C2
add hl, bc ; $7981: $09

View File

@ -1,14 +1,38 @@
Data_006_7BFA::
db $56, $02, $56, $22
; If in magnifying lens cave, and Link has no trade sequence item, make invisible
ZolGelMakeInvisibleBeforeMagnifyingLens::
ldh a, [hMapId] ; $7BE2: $F0 $F7
cp MAP_CAVE_B ; $7BE4: $FE $0A
ret nz ; $7BE6: $C0
ldh a, [hMapRoom] ; $7BE7: $F0 $F6
cp ROOM_INDOOR_B_97 ; $7BE9: $FE $97
jr z, .invisible ; $7BEB: $28 $03
cp ROOM_INDOOR_B_98 ; $7BED: $FE $98
ret nz ; $7BEF: $C0
.invisible
ld a, [wExchangingTradeSequenceItem] ; $7BF0: $FA $7F $DB
and a ; $7BF3: $A7
ret z ; $7BF4: $C8
ld a, $FF ; $7BF5: $3E $FF
ldh [hActiveEntitySpriteVariant], a ; $7BF7: $E0 $F1
ret ; $7BF9: $C9
GelSpriteVariants::
.variant0
db $56, OAM_GBC_PAL_2 | OAMF_PAL0
.variant1
db $56, OAM_GBC_PAL_2 | OAMF_PAL0 | OAMF_XFLIP
GelEntityHandler::
call func_006_7BE2 ; $7BFE: $CD $E2 $7B
ld de, Data_006_7BFA ; $7C01: $11 $FA $7B
call ZolGelMakeInvisibleBeforeMagnifyingLens ; $7BFE: $CD $E2 $7B
ld de, GelSpriteVariants ; $7C01: $11 $FA $7B
call RenderActiveEntitySprite ; $7C04: $CD $77 $3C
jr jr_006_7C2E ; $7C07: $18 $25
jr AnimateZolGel ; $7C07: $18 $25
; define sprite variants by selecting tile n° and setting OAM attributes (palette + flags) in a list
ZolLowHealthSpriteVariants::
; Zols spawned by Slime Eye are green instead of red
ZolSlimeEyeSpriteVariants::
.variant0
db $52, OAM_GBC_PAL_2 | OAMF_PAL0
db $52, OAM_GBC_PAL_2 | OAMF_PAL0 | OAMF_XFLIP
@ -16,7 +40,6 @@ ZolLowHealthSpriteVariants::
db $54, OAM_GBC_PAL_2 | OAMF_PAL0
db $54, OAM_GBC_PAL_2 | OAMF_PAL0 | OAMF_XFLIP
; define sprite variants by selecting tile n° and setting OAM attributes (palette + flags) in a list
ZolSpriteVariants::
.variant0
db $52, OAM_GBC_PAL_0 | OAMF_PAL0
@ -26,8 +49,8 @@ ZolSpriteVariants::
db $54, OAM_GBC_PAL_0 | OAMF_PAL0 | OAMF_XFLIP
ZolEntityHandler::
call func_006_7BE2 ; $7C19: $CD $E2 $7B
ld de, ZolLowHealthSpriteVariants ; $7C1C: $11 $09 $7C
call ZolGelMakeInvisibleBeforeMagnifyingLens ; $7C19: $CD $E2 $7B
ld de, ZolSlimeEyeSpriteVariants ; $7C1C: $11 $09 $7C
ld hl, wEntitiesHealthTable ; $7C1F: $21 $60 $C3
add hl, bc ; $7C22: $09
ld a, [hl] ; $7C23: $7E
@ -40,8 +63,8 @@ ZolEntityHandler::
.render:
call RenderActiveEntitySpritesPair ; $7C2B: $CD $C0 $3B
jr_006_7C2E:
ld hl, wC1AE ; $7C2E: $21 $AE $C1
AnimateZolGel:
ld hl, wZolCount ; $7C2E: $21 $AE $C1
inc [hl] ; $7C31: $34
call ReturnIfNonInteractive_06 ; $7C32: $CD $C6 $64
call AddEntityZSpeedToPos_06 ; $7C35: $CD $7A $65
@ -55,23 +78,23 @@ jr_006_7C2E:
ld a, [hl] ; $7C43: $7E
and $80 ; $7C44: $E6 $80
ldh [hMultiPurposeG], a ; $7C46: $E0 $E8
jr z, .jr_7C50 ; $7C48: $28 $06
jr z, .hitGroundEnd ; $7C48: $28 $06
ld [hl], b ; $7C4A: $70
ld hl, wEntitiesSpeedZTable ; $7C4B: $21 $20 $C3
add hl, bc ; $7C4E: $09
ld [hl], b ; $7C4F: $70
.jr_7C50
.hitGroundEnd
ldh a, [hActiveEntityType] ; $7C50: $F0 $EB
cp ENTITY_ZOL ; $7C52: $FE $1B
jr nz, jr_006_7CB7 ; $7C54: $20 $61
jr nz, .splitEnd ; $7C54: $20 $61
ld hl, wEntitiesFlashCountdownTable ; $7C56: $21 $20 $C4
add hl, bc ; $7C59: $09
ld a, [hl] ; $7C5A: $7E
cp $08 ; $7C5B: $FE $08
jr nz, jr_006_7CB7 ; $7C5D: $20 $58
jr nz, .splitEnd ; $7C5D: $20 $58
ld [hl], b ; $7C5F: $70
ld hl, wEntitiesLoadOrderTable ; $7C60: $21 $60 $C4
@ -80,11 +103,9 @@ jr_006_7C2E:
push hl ; $7C65: $E5
push af ; $7C66: $F5
ld hl, wEntitiesTypeTable ; $7C67: $21 $A0 $C3
.jr_7C6A
add hl, bc ; $7C6A: $09
ld [hl], $1C ; $7C6B: $36 $1C
call label_3965 ; $7C6D: $CD $65 $39
ld [hl], ENTITY_GEL ; $7C6B: $36 $1C
call ConfigureNewEntity_trampoline ; $7C6D: $CD $65 $39
pop af ; $7C70: $F1
pop hl ; $7C71: $E1
ld [hl], a ; $7C72: $77
@ -102,7 +123,7 @@ jr_006_7C2E:
ld [hl], $20 ; $7C87: $36 $20
ld a, ENTITY_GEL ; $7C89: $3E $1C
call SpawnNewEntity_trampoline ; $7C8B: $CD $86 $3B
jr c, jr_006_7CB7 ; $7C8E: $38 $27
jr c, .splitEnd ; $7C8E: $38 $27
ld hl, wEntitiesLoadOrderTable ; $7C90: $21 $60 $C4
add hl, bc ; $7C93: $09
@ -127,7 +148,7 @@ jr_006_7C2E:
add hl, de ; $7CB4: $19
ld [hl], $20 ; $7CB5: $36 $20
jr_006_7CB7:
.splitEnd
call ApplyRecoilIfNeeded_06 ; $7CB7: $CD $F7 $64
ld hl, wEntitiesPrivateCountdown2Table ; $7CBA: $21 $00 $C3
add hl, bc ; $7CBD: $09
@ -150,44 +171,45 @@ jr_006_7CB7:
.jr_7CD4
ldh a, [hActiveEntityState] ; $7CD4: $F0 $F0
cp $04 ; $7CD6: $FE $04
jr z, .jr_7CE5 ; $7CD8: $28 $0B
jr z, .skipCollision ; $7CD8: $28 $0B
ld hl, wEntitiesPrivateCountdown3Table ; $7CDA: $21 $80 $C4
add hl, bc ; $7CDD: $09
ld a, [hl] ; $7CDE: $7E
and a ; $7CDF: $A7
jr nz, .jr_7CE5 ; $7CE0: $20 $03
jr nz, .skipCollision ; $7CE0: $20 $03
call DefaultEnemyDamageCollisionHandler_trampoline ; $7CE2: $CD $39 $3B
.jr_7CE5
.skipCollision
ldh a, [hActiveEntityState] ; $7CE5: $F0 $F0
JP_TABLE ; $7CE7
._00 dw ZolState0Handler
._01 dw ZolState1Handler
._02 dw ZolState2Handler
._03 dw ZolState3Handler
._04 dw ZolState4Handler
._00 dw ZolGelState0Handler
._01 dw ZolGelState1Handler
._02 dw ZolGelState2Handler
._03 dw ZolGelState3Handler
._04 dw GelState4Handler
ZolState1Handler::
; Inching (up)
ZolGelState1Handler::
call GetEntityTransitionCountdown ; $7CF2: $CD $05 $0C
jr nz, func_006_7D0F ; $7CF5: $20 $18
jr nz, ZolGelPhysics ; $7CF5: $20 $18
ld [hl], $10 ; $7CF7: $36 $10
call ClearEntitySpeed ; $7CF9: $CD $7F $3D
call GetRandomByte ; $7CFC: $CD $0D $28
and $0F ; $7CFF: $E6 $0F
jr nz, .jr_7D0B ; $7D01: $20 $08
jr nz, .skipLeap ; $7D01: $20 $08
call GetEntityTransitionCountdown ; $7D03: $CD $05 $0C
ld [hl], $50 ; $7D06: $36 $50
jp IncrementEntityState ; $7D08: $C3 $12 $3B
.jr_7D0B
.skipLeap
call IncrementEntityState ; $7D0B: $CD $12 $3B
ld [hl], b ; $7D0E: $70
func_006_7D0F::
ZolGelPhysics::
call UpdateEntityPosWithSpeed_06 ; $7D0F: $CD $41 $65
call GetEntityPrivateCountdown1 ; $7D12: $CD $00 $0C
ret nz ; $7D15: $C0
@ -201,8 +223,9 @@ func_006_7D0F::
ld [hl], b ; $7D23: $70
ret ; $7D24: $C9
ZolState0Handler::
call func_006_7D0F ; $7D25: $CD $0F $7D
; Inching (down)
ZolGelState0Handler::
call ZolGelPhysics ; $7D25: $CD $0F $7D
call GetEntityTransitionCountdown ; $7D28: $CD $05 $0C
ret nz ; $7D2B: $C0
@ -211,9 +234,10 @@ ZolState0Handler::
ld a, $04 ; $7D31: $3E $04
jp ApplyVectorTowardsLink_trampoline ; $7D33: $C3 $AA $3B
ZolState2Handler::
; Preparing to leap
ZolGelState2Handler::
call GetEntityTransitionCountdown ; $7D36: $CD $05 $0C
jr nz, .jr_7D4A ; $7D39: $20 $0F
jr nz, .leapEnd ; $7D39: $20 $0F
call IncrementEntityState ; $7D3B: $CD $12 $3B
ld a, $10 ; $7D3E: $3E $10
@ -223,40 +247,42 @@ ZolState2Handler::
ld [hl], $20 ; $7D47: $36 $20
ret ; $7D49: $C9
.jr_7D4A
.leapEnd
call GetEntityTransitionCountdown ; $7D4A: $CD $05 $0C
ld hl, wEntitiesSpeedXTable ; $7D4D: $21 $40 $C2
add hl, bc ; $7D50: $09
and $04 ; $7D51: $E6 $04
jr nz, .jr_7D59 ; $7D53: $20 $04
jr nz, .negative ; $7D53: $20 $04
ld [hl], $08 ; $7D55: $36 $08
jr jr_006_7D5B ; $7D57: $18 $02
jr .setSpeed ; $7D57: $18 $02
.jr_7D59
.negative
ld [hl], $F8 ; $7D59: $36 $F8
jr_006_7D5B:
.setSpeed:
ld hl, wEntitiesSpeedYTable ; $7D5B: $21 $50 $C2
add hl, bc ; $7D5E: $09
ld [hl], b ; $7D5F: $70
jp func_006_7D0F ; $7D60: $C3 $0F $7D
jp ZolGelPhysics ; $7D60: $C3 $0F $7D
ZolState3Handler::
call func_006_7D0F ; $7D63: $CD $0F $7D
; Leaping
ZolGelState3Handler::
call ZolGelPhysics ; $7D63: $CD $0F $7D
ldh a, [hMultiPurposeG] ; $7D66: $F0 $E8
and a ; $7D68: $A7
jr z, .ret_7D6F ; $7D69: $28 $04
jr z, .hitGroundEnd ; $7D69: $28 $04
call IncrementEntityState ; $7D6B: $CD $12 $3B
ld [hl], b ; $7D6E: $70
.ret_7D6F
.hitGroundEnd
ret ; $7D6F: $C9
ZolState4Handler::
; Clinging
GelState4Handler::
call GetEntityTransitionCountdown ; $7D70: $CD $05 $0C
jr nz, .jr_7D91 ; $7D73: $20 $1C
jr nz, .skipIncrementState ; $7D73: $20 $1C
ld hl, wEntitiesPrivateCountdown3Table ; $7D75: $21 $80 $C4
add hl, bc ; $7D78: $09
@ -273,7 +299,7 @@ ZolState4Handler::
ld [hl], $03 ; $7D8E: $36 $03
ret ; $7D90: $C9
.jr_7D91
.skipIncrementState
push af ; $7D91: $F5
rra ; $7D92: $1F
and $07 ; $7D93: $E6 $07
@ -300,21 +326,21 @@ ZolState4Handler::
add hl, bc ; $7DB5: $09
ld [hl], a ; $7DB6: $77
ld a, $01 ; $7DB7: $3E $01
ld [wC117], a ; $7DB9: $EA $17 $C1
ld [wIsGelClingingToLink], a ; $7DB9: $EA $17 $C1
call DefaultEntityPhysics_trampoline ; $7DBC: $CD $23 $3B
ldh a, [hJoypadState] ; $7DBF: $F0 $CC
and a ; $7DC1: $A7
jr z, ret_006_7DD3 ; $7DC2: $28 $0F
jr z, DecreaseEntityTransitionCountdown.skipUpdateSpeedX ; $7DC2: $28 $0F
call func_006_7DCD ; $7DC4: $CD $CD $7D
call func_006_7DCD ; $7DC7: $CD $CD $7D
call func_006_7DCD ; $7DCA: $CD $CD $7D
call DecreaseEntityTransitionCountdown ; $7DC4: $CD $CD $7D
call DecreaseEntityTransitionCountdown ; $7DC7: $CD $CD $7D
call DecreaseEntityTransitionCountdown ; $7DCA: $CD $CD $7D
func_006_7DCD::
DecreaseEntityTransitionCountdown::
call GetEntityTransitionCountdown ; $7DCD: $CD $05 $0C
jr z, ret_006_7DD3 ; $7DD0: $28 $01
jr z, .skipUpdateSpeedX ; $7DD0: $28 $01
dec [hl] ; $7DD2: $35
ret_006_7DD3:
.skipUpdateSpeedX
ret ; $7DD3: $C9

View File

@ -14,8 +14,6 @@ BlooperEntityHandler::
call ApplyRecoilIfNeeded_07 ; $5C02: $CD $C3 $7D
call DefaultEnemyDamageCollisionHandler_trampoline ; $5C05: $CD $39 $3B
call UpdateEntityPosWithSpeed_07 ; $5C08: $CD $0A $7E
.jr_5C0B
call DefaultEntityPhysics_trampoline ; $5C0B: $CD $23 $3B
ld hl, wEntitiesGroundStatusTable ; $5C0E: $21 $70 $C4
add hl, bc ; $5C11: $09
@ -40,22 +38,22 @@ BlooperEntityHandler::
call SetEntitySpriteVariant ; $5C2B: $CD $0C $3B
ldh a, [hActiveEntityState] ; $5C2E: $F0 $F0
JP_TABLE ; $5C30
._00 dw func_007_5C35 ; $5C31
._01 dw func_007_5C79 ; $5C33
._00 dw BlooperState0Handler ; $5C31
._01 dw BlooperState1Handler ; $5C33
func_007_5C35::
BlooperState0Handler::
call GetEntityTransitionCountdown ; $5C35: $CD $05 $0C
jr nz, .jr_5C58 ; $5C38: $20 $1E
jr nz, .skipSwimUp ; $5C38: $20 $1E
call EntityLinkPositionYDifference_07 ; $5C3A: $CD $6D $7E
call GetEntityYDistanceToLink_07 ; $5C3A: $CD $6D $7E
ld a, e ; $5C3D: $7B
cp $03 ; $5C3E: $FE $03
jr z, .jr_5C58 ; $5C40: $28 $16
jr z, .skipSwimUp ; $5C40: $28 $16
call ClearEntitySpeed ; $5C42: $CD $7F $3D
call GetEntityTransitionCountdown ; $5C45: $CD $05 $0C
ld [hl], $25 ; $5C48: $36 $25
call EntityLinkPositionXDifference_07 ; $5C4A: $CD $5D $7E
call GetEntityXDistanceToLink_07 ; $5C4A: $CD $5D $7E
ld hl, wEntitiesDirectionTable ; $5C4D: $21 $80 $C3
add hl, bc ; $5C50: $09
ld [hl], e ; $5C51: $73
@ -63,58 +61,58 @@ func_007_5C35::
ld [hl], $01 ; $5C55: $36 $01
ret ; $5C57: $C9
.jr_5C58
.skipSwimUp
; If y speed < 4, increase, if > 4, decrease, else, do nothing
call GetEntitySpeedYAddress ; $5C58: $CD $05 $40
ld a, [hl] ; $5C5B: $7E
sub $04 ; $5C5C: $D6 $04
.jr_5C5E
jr z, jr_007_5C67 ; $5C5E: $28 $07
jr z, .skipUpdateSpeedY ; $5C5E: $28 $07
and $80 ; $5C60: $E6 $80
jr z, .jr_5C66 ; $5C62: $28 $02
jr z, .decSpeedY ; $5C62: $28 $02
inc [hl] ; $5C64: $34
inc [hl] ; $5C65: $34
.jr_5C66
.decSpeedY
dec [hl] ; $5C66: $35
jr_007_5C67:
.skipUpdateSpeedY
; If x speed < 0, increase, if > 0, decrease, else, do nothing
ld hl, wEntitiesSpeedXTable ; $5C67: $21 $40 $C2
add hl, bc ; $5C6A: $09
ld a, [hl] ; $5C6B: $7E
and a ; $5C6C: $A7
jr z, ret_007_5C76 ; $5C6D: $28 $07
jr z, .skipUpdateSpeedX ; $5C6D: $28 $07
and $80 ; $5C6F: $E6 $80
jr z, .jr_5C75 ; $5C71: $28 $02
jr z, .decSpeedX ; $5C71: $28 $02
inc [hl] ; $5C73: $34
inc [hl] ; $5C74: $34
.jr_5C75
.decSpeedX
dec [hl] ; $5C75: $35
ret_007_5C76:
.skipUpdateSpeedX
ret ; $5C76: $C9
Data_007_5C77::
BlooperSpeedXPerDirection::
db $01, $FF
func_007_5C79::
BlooperState1Handler::
call GetEntityTransitionCountdown ; $5C79: $CD $05 $0C
jr nz, .jr_5C85 ; $5C7C: $20 $07
jr nz, .skipIncrementState ; $5C7C: $20 $07
ld [hl], $40 ; $5C7E: $36 $40
call IncrementEntityState ; $5C80: $CD $12 $3B
ld [hl], b ; $5C83: $70
ret ; $5C84: $C9
.jr_5C85
.skipIncrementState
ldh a, [hFrameCounter] ; $5C85: $F0 $E7
and $01 ; $5C87: $E6 $01
jr nz, .jr_5CA0 ; $5C89: $20 $15
jr nz, .oddFrame ; $5C89: $20 $15
call GetEntitySpeedYAddress ; $5C8B: $CD $05 $40
dec [hl] ; $5C8E: $35
@ -122,7 +120,7 @@ func_007_5C79::
add hl, bc ; $5C92: $09
ld e, [hl] ; $5C93: $5E
ld d, b ; $5C94: $50
ld hl, Data_007_5C77 ; $5C95: $21 $77 $5C
ld hl, BlooperSpeedXPerDirection ; $5C95: $21 $77 $5C
add hl, de ; $5C98: $19
ld a, [hl] ; $5C99: $7E
ld hl, wEntitiesSpeedXTable ; $5C9A: $21 $40 $C2
@ -130,78 +128,6 @@ func_007_5C79::
add [hl] ; $5C9E: $86
ld [hl], a ; $5C9F: $77
.jr_5CA0
.oddFrame
ld a, $01 ; $5CA0: $3E $01
jp SetEntitySpriteVariant ; $5CA2: $C3 $0C $3B
func_007_5CA5::
ldh a, [hActiveEntitySpriteVariant] ; $5CA5: $F0 $F1
inc a ; $5CA7: $3C
jr z, jr_007_5CF3 ; $5CA8: $28 $49
push hl ; $5CAA: $E5
ld a, [wOAMNextAvailableSlot] ; $5CAB: $FA $C0 $C3
ld e, a ; $5CAE: $5F
ld d, $00 ; $5CAF: $16 $00
ld hl, wDynamicOAMBuffer ; $5CB1: $21 $30 $C0
add hl, de ; $5CB4: $19
ld e, l ; $5CB5: $5D
ld d, h ; $5CB6: $54
pop hl ; $5CB7: $E1
jr_007_5CB8:
ldh a, [hActiveEntityVisualPosY] ; $5CB8: $F0 $EC
add [hl] ; $5CBA: $86
cp $7E ; $5CBB: $FE $7E
jr c, .jr_5CC0 ; $5CBD: $38 $01
xor a ; $5CBF: $AF
.jr_5CC0
ld [de], a ; $5CC0: $12
inc hl ; $5CC1: $23
inc de ; $5CC2: $13
push bc ; $5CC3: $C5
ld a, [wScreenShakeHorizontal] ; $5CC4: $FA $55 $C1
ld c, a ; $5CC7: $4F
ldh a, [hActiveEntityPosX] ; $5CC8: $F0 $EE
add [hl] ; $5CCA: $86
sub c ; $5CCB: $91
ld [de], a ; $5CCC: $12
inc hl ; $5CCD: $23
inc de ; $5CCE: $13
ldh a, [hActiveEntityTilesOffset] ; $5CCF: $F0 $F5
ld c, a ; $5CD1: $4F
ld a, [hl+] ; $5CD2: $2A
push af ; $5CD3: $F5
add c ; $5CD4: $81
ld [de], a ; $5CD5: $12
pop af ; $5CD6: $F1
cp $FF ; $5CD7: $FE $FF
jr nz, .jr_5CDF ; $5CD9: $20 $04
dec de ; $5CDB: $1B
xor a ; $5CDC: $AF
ld [de], a ; $5CDD: $12
inc de ; $5CDE: $13
.jr_5CDF
pop bc ; $5CDF: $C1
inc de ; $5CE0: $13
ldh a, [hActiveEntityFlipAttribute] ; $5CE1: $F0 $ED
xor [hl] ; $5CE3: $AE
inc hl ; $5CE4: $23
ld [de], a ; $5CE5: $12
inc de ; $5CE6: $13
dec c ; $5CE7: $0D
jr nz, jr_007_5CB8 ; $5CE8: $20 $CE
ld a, [wActiveEntityIndex] ; $5CEA: $FA $23 $C1
ld c, a ; $5CED: $4F
ld a, $0A ; $5CEE: $3E $0A
jp func_015_7964_trampoline ; $5CF0: $C3 $A0 $3D
jr_007_5CF3:
ld a, [wActiveEntityIndex] ; $5CF3: $FA $23 $C1
ld c, a ; $5CF6: $4F
ret ; $5CF7: $C9

View File

@ -146,13 +146,13 @@ BushCrawlerState0Handler::
call GetEntityTransitionCountdown ; $40DB: $CD $05 $0C
jr nz, jr_007_4128 ; $40DE: $20 $48
call EntityLinkPositionYDifference_07 ; $40E0: $CD $6D $7E
call GetEntityYDistanceToLink_07 ; $40E0: $CD $6D $7E
add $08 ; $40E3: $C6 $08
cp $10 ; $40E5: $FE $10
jr c, .jr_40F9 ; $40E7: $38 $10
push de ; $40E9: $D5
call EntityLinkPositionXDifference_07 ; $40EA: $CD $5D $7E
call GetEntityXDistanceToLink_07 ; $40EA: $CD $5D $7E
add $08 ; $40ED: $C6 $08
pop de ; $40EF: $D1
cp $10 ; $40F0: $FE $10
@ -164,7 +164,7 @@ BushCrawlerState0Handler::
.jr_40F9
call IncrementEntityState ; $40F9: $CD $12 $3B
call func_007_7E7D ; $40FC: $CD $7D $7E
call GetEntityDirectionToLink_07 ; $40FC: $CD $7D $7E
ld d, b ; $40FF: $50
ld hl, Data_007_40CE ; $4100: $21 $CE $40
add hl, de ; $4103: $19

View File

@ -3,12 +3,12 @@ Data_007_7112::
FireballShooterEntityHandler::
call ReturnIfNonInteractive_07 ; $711C: $CD $96 $7D
call EntityLinkPositionXDifference_07 ; $711F: $CD $5D $7E
call GetEntityXDistanceToLink_07 ; $711F: $CD $5D $7E
add $20 ; $7122: $C6 $20
cp $40 ; $7124: $FE $40
jr nc, .jr_7131 ; $7126: $30 $09
call EntityLinkPositionYDifference_07 ; $7128: $CD $6D $7E
call GetEntityYDistanceToLink_07 ; $7128: $CD $6D $7E
add $20 ; $712B: $C6 $20
cp $40 ; $712D: $FE $40
jr c, ret_007_7197 ; $712F: $38 $66

View File

@ -564,7 +564,7 @@ label_007_45F7:
and $80 ; $4624: $E6 $80
jr nz, .jr_4640 ; $4626: $20 $18
call EntityLinkPositionYDifference_07 ; $4628: $CD $6D $7E
call GetEntityYDistanceToLink_07 ; $4628: $CD $6D $7E
add $08 ; $462B: $C6 $08
bit 7, a ; $462D: $CB $7F
jr z, .jr_4640 ; $462F: $28 $0F

View File

@ -266,7 +266,7 @@ func_007_6606::
jr nz, .jr_662A ; $6622: $20 $06
ld [hl], b ; $6624: $70
call func_007_7E7D ; $6625: $CD $7D $7E
call GetEntityDirectionToLink_07 ; $6625: $CD $7D $7E
jr jr_007_6630 ; $6628: $18 $06
.jr_662A
@ -352,7 +352,7 @@ label_007_6693:
._01 dw func_007_66B8 ; $66A4
func_007_66A6::
call EntityLinkPositionXDifference_07 ; $66A6: $CD $5D $7E
call GetEntityXDistanceToLink_07 ; $66A6: $CD $5D $7E
ld a, $08 ; $66A9: $3E $08
dec e ; $66AB: $1D
jr nz, .jr_66B0 ; $66AC: $20 $02

View File

@ -68,13 +68,13 @@ func_007_72F4::
call GetEntityTransitionCountdown ; $72F4: $CD $05 $0C
jr nz, ret_007_731F ; $72F7: $20 $26
call EntityLinkPositionXDifference_07 ; $72F9: $CD $5D $7E
call GetEntityXDistanceToLink_07 ; $72F9: $CD $5D $7E
add $20 ; $72FC: $C6 $20
cp $40 ; $72FE: $FE $40
jr nc, ret_007_731F ; $7300: $30 $1D
.jr_7302
call EntityLinkPositionYDifference_07 ; $7302: $CD $6D $7E
call GetEntityYDistanceToLink_07 ; $7302: $CD $6D $7E
add $20 ; $7305: $C6 $20
cp $40 ; $7307: $FE $40
jr nc, ret_007_731F ; $7309: $30 $14

View File

@ -48,7 +48,7 @@ func_007_512F::
jr nz, ret_007_5173 ; $5148: $20 $29
call IncrementEntityState ; $514A: $CD $12 $3B
call func_007_7E7D ; $514D: $CD $7D $7E
call GetEntityDirectionToLink_07 ; $514D: $CD $7D $7E
ld hl, wEntitiesDirectionTable ; $5150: $21 $80 $C3
add hl, bc ; $5153: $09
ld a, e ; $5154: $7B

View File

@ -109,12 +109,12 @@ func_007_58A8::
and a ; $58B4: $A7
jr nz, .jr_58C9 ; $58B5: $20 $12
call EntityLinkPositionXDifference_07 ; $58B7: $CD $5D $7E
call GetEntityXDistanceToLink_07 ; $58B7: $CD $5D $7E
add $18 ; $58BA: $C6 $18
cp $30 ; $58BC: $FE $30
jr nc, KikiOpenDialog.return ; $58BE: $30 $1D
call EntityLinkPositionYDifference_07 ; $58C0: $CD $6D $7E
call GetEntityYDistanceToLink_07 ; $58C0: $CD $6D $7E
add $18 ; $58C3: $C6 $18
cp $30 ; $58C5: $FE $30
jr nc, KikiOpenDialog.return ; $58C7: $30 $14

View File

@ -424,7 +424,7 @@ func_007_6BC8::
call IncrementEntityState ; $6BDC: $CD $12 $3B
label_007_6BDF:
call EntityLinkPositionXDifference_07 ; $6BDF: $CD $5D $7E
call GetEntityXDistanceToLink_07 ; $6BDF: $CD $5D $7E
ld hl, wEntitiesDirectionTable ; $6BE2: $21 $80 $C3
add hl, bc ; $6BE5: $09
ld [hl], e ; $6BE6: $73
@ -441,12 +441,12 @@ func_007_6BE7::
func_007_6BF4::
call func_007_6EA2 ; $6BF4: $CD $A2 $6E
call EntityLinkPositionXDifference_07 ; $6BF7: $CD $5D $7E
call GetEntityXDistanceToLink_07 ; $6BF7: $CD $5D $7E
add $20 ; $6BFA: $C6 $20
cp $40 ; $6BFC: $FE $40
jr nc, .jr_6C14 ; $6BFE: $30 $14
call EntityLinkPositionYDifference_07 ; $6C00: $CD $6D $7E
call GetEntityYDistanceToLink_07 ; $6C00: $CD $6D $7E
add $1C ; $6C03: $C6 $1C
cp $38 ; $6C05: $FE $38
jr nc, .jr_6C14 ; $6C07: $30 $0B
@ -905,12 +905,12 @@ func_007_6EA2::
ld hl, wEntitiesPrivateState1Table ; $6EA2: $21 $B0 $C2
add hl, bc ; $6EA5: $09
ld [hl], b ; $6EA6: $70
call EntityLinkPositionXDifference_07 ; $6EA7: $CD $5D $7E
call GetEntityXDistanceToLink_07 ; $6EA7: $CD $5D $7E
add $30 ; $6EAA: $C6 $30
cp $60 ; $6EAC: $FE $60
jr nc, .jr_6EC3 ; $6EAE: $30 $13
call EntityLinkPositionYDifference_07 ; $6EB0: $CD $6D $7E
call GetEntityYDistanceToLink_07 ; $6EB0: $CD $6D $7E
add $30 ; $6EB3: $C6 $30
cp $60 ; $6EB5: $FE $60
jr nc, .jr_6EC3 ; $6EB7: $30 $0A

View File

@ -147,16 +147,16 @@ func_007_4759::
cp $04 ; $4762: $FE $04
ret nz ; $4764: $C0
call EntityLinkPositionXDifference_07 ; $4765: $CD $5D $7E
call GetEntityXDistanceToLink_07 ; $4765: $CD $5D $7E
ld a, e ; $4768: $7B
call SetEntitySpriteVariant ; $4769: $CD $0C $3B
call PushLinkOutOfEntity_07 ; $476C: $CD $F0 $7C
call EntityLinkPositionXDifference_07 ; $476F: $CD $5D $7E
call GetEntityXDistanceToLink_07 ; $476F: $CD $5D $7E
add $12 ; $4772: $C6 $12
cp $24 ; $4774: $FE $24
jr nc, .jr_4793 ; $4776: $30 $1B
call EntityLinkPositionYDifference_07 ; $4778: $CD $6D $7E
call GetEntityYDistanceToLink_07 ; $4778: $CD $6D $7E
add $12 ; $477B: $C6 $12
cp $24 ; $477D: $FE $24
jr nc, .jr_4793 ; $477F: $30 $12
@ -497,7 +497,7 @@ func_007_4959::
func_007_4982::
call PushLinkOutOfEntity_07 ; $4982: $CD $F0 $7C
call EntityLinkPositionXDifference_07 ; $4985: $CD $5D $7E
call GetEntityXDistanceToLink_07 ; $4985: $CD $5D $7E
ld a, e ; $4988: $7B
add $02 ; $4989: $C6 $02
ldh [hActiveEntitySpriteVariant], a ; $498B: $E0 $F1

View File

@ -150,7 +150,7 @@ func_007_79D7::
call ApplyVectorTowardsLink_trampoline ; $7A1B: $CD $AA $3B
jr_007_7A1E:
call func_007_7E7D ; $7A1E: $CD $7D $7E
call GetEntityDirectionToLink_07 ; $7A1E: $CD $7D $7E
ld hl, wEntitiesDirectionTable ; $7A21: $21 $80 $C3
add hl, bc ; $7A24: $09
ld [hl], a ; $7A25: $77
@ -164,17 +164,17 @@ func_007_7A2D::
and a ; $7A30: $A7
jr nz, func_007_7A55 ; $7A31: $20 $22
call EntityLinkPositionXDifference_07 ; $7A33: $CD $5D $7E
call GetEntityXDistanceToLink_07 ; $7A33: $CD $5D $7E
add $30 ; $7A36: $C6 $30
cp $60 ; $7A38: $FE $60
jr nc, ret_007_7A6C ; $7A3A: $30 $30
call EntityLinkPositionYDifference_07 ; $7A3C: $CD $6D $7E
call GetEntityYDistanceToLink_07 ; $7A3C: $CD $6D $7E
add $30 ; $7A3F: $C6 $30
cp $60 ; $7A41: $FE $60
jr nc, ret_007_7A6C ; $7A43: $30 $27
call func_007_7E7D ; $7A45: $CD $7D $7E
call GetEntityDirectionToLink_07 ; $7A45: $CD $7D $7E
ld d, b ; $7A48: $50
ld hl, Data_007_7A29 ; $7A49: $21 $29 $7A
add hl, de ; $7A4C: $19

View File

@ -61,7 +61,7 @@ PapahlEntityHandler::
cp $08 ; $4A36: $FE $08
jr nc, .render ; $4A38: $30 $09
call EntityLinkPositionXDifference_07 ; $4A3A: $CD $5D $7E
call GetEntityXDistanceToLink_07 ; $4A3A: $CD $5D $7E
ld a, e ; $4A3D: $7B
ldh [hActiveEntitySpriteVariant], a ; $4A3E: $E0 $F1
ld de, Papahl1SpriteVariants ; $4A40: $11 $EF $49
@ -132,7 +132,7 @@ jr_007_4A69:
._04 dw func_007_4B5B ; $4AB1
func_007_4AB3::
call EntityLinkPositionXDifference_07 ; $4AB3: $CD $5D $7E
call GetEntityXDistanceToLink_07 ; $4AB3: $CD $5D $7E
ld hl, wEntitiesDirectionTable ; $4AB6: $21 $80 $C3
add hl, bc ; $4AB9: $09
ld [hl], e ; $4ABA: $73
@ -140,7 +140,7 @@ func_007_4AB3::
cp $48 ; $4ABD: $FE $48
jr nc, jr_007_4AE9 ; $4ABF: $30 $28
call EntityLinkPositionYDifference_07 ; $4AC1: $CD $6D $7E
call GetEntityYDistanceToLink_07 ; $4AC1: $CD $6D $7E
add $24 ; $4AC4: $C6 $24
cp $48 ; $4AC6: $FE $48
jr nc, jr_007_4AE9 ; $4AC8: $30 $1F

View File

@ -103,12 +103,12 @@ func_007_535A::
ld hl, wEntitiesPhysicsFlagsTable ; $535F: $21 $40 $C3
add hl, bc ; $5362: $09
set 6, [hl] ; $5363: $CB $F6
call EntityLinkPositionXDifference_07 ; $5365: $CD $5D $7E
call GetEntityXDistanceToLink_07 ; $5365: $CD $5D $7E
add $20 ; $5368: $C6 $20
cp $40 ; $536A: $FE $40
jr nc, .jr_537F ; $536C: $30 $11
call EntityLinkPositionYDifference_07 ; $536E: $CD $6D $7E
call GetEntityYDistanceToLink_07 ; $536E: $CD $6D $7E
add $20 ; $5371: $C6 $20
cp $40 ; $5373: $FE $40
jr nc, .jr_537F ; $5375: $30 $08
@ -190,12 +190,12 @@ func_007_53D8::
ldh [hLinkPositionY], a ; $53EA: $E0 $99
ld a, $10 ; $53EC: $3E $10
call ApplyVectorTowardsLink_trampoline ; $53EE: $CD $AA $3B
call EntityLinkPositionXDifference_07 ; $53F1: $CD $5D $7E
call GetEntityXDistanceToLink_07 ; $53F1: $CD $5D $7E
add $02 ; $53F4: $C6 $02
cp $04 ; $53F6: $FE $04
jr nc, .jr_541F ; $53F8: $30 $25
call EntityLinkPositionYDifference_07 ; $53FA: $CD $6D $7E
call GetEntityYDistanceToLink_07 ; $53FA: $CD $6D $7E
add $02 ; $53FD: $C6 $02
cp $04 ; $53FF: $FE $04
jr nc, .jr_541F ; $5401: $30 $1C

View File

@ -67,7 +67,7 @@ func_007_639E::
and $80 ; $63BD: $E6 $80
jr nz, .ret_63F6 ; $63BF: $20 $35
call EntityLinkPositionYDifference_07 ; $63C1: $CD $6D $7E
call GetEntityYDistanceToLink_07 ; $63C1: $CD $6D $7E
add $08 ; $63C4: $C6 $08
bit 7, a ; $63C6: $CB $7F
jr z, .ret_63F6 ; $63C8: $28 $2C

View File

@ -1,17 +1,107 @@
Data_007_5CF8::
db $00, $00, $4C, $07, $00, $08, $4C, $27, $F0, $00, $4A, $07, $F0, $08, $4A, $27
db $E0, $00, $4A, $07, $E0, $08, $4A, $27, $D0, $00, $4A, $07, $D0, $08, $4A, $27
db $C0, $00, $48, $07, $C0, $08, $48, $27, $00, $00, $4A, $07, $00, $08, $4A, $27
db $F0, $00, $4A, $07, $F0, $08, $4A, $27, $E0, $00, $4A, $07, $E0, $08, $4A, $27
db $D0, $00, $48, $07, $D0, $08, $48, $27, $C0, $00, $FF, $07, $C0, $08, $FF, $27
db $00, $00, $4A, $07, $00, $08, $4A, $27, $F0, $00, $4A, $07, $F0, $08, $4A, $27
db $E0, $00, $48, $07, $E0, $08, $48, $27, $D0, $00, $FF, $07, $D0, $08, $FF, $27
db $C0, $00, $FF, $07, $C0, $08, $FF, $27, $00, $00, $4A, $07, $00, $08, $4A, $27
db $F0, $00, $48, $07, $F0, $08, $48, $27, $E0, $00, $FF, $07, $E0, $08, $FF, $27
db $D0, $00, $FF, $07, $D0, $08, $FF, $27, $C0, $00, $FF, $07, $C0, $08, $FF, $27
db $00, $00, $48, $07, $00, $08, $48, $27, $F0, $00, $FF, $07, $F0, $08, $FF, $27
db $E0, $00, $FF, $07, $E0, $08, $FF, $27, $D0, $00, $FF, $07, $D0, $08, $FF, $27
db $C0, $00, $FF, $07, $C0, $08, $FF, $27
RenderSmashablePillar::
ldh a, [hActiveEntitySpriteVariant] ; $5CA5: $F0 $F1
inc a ; $5CA7: $3C
jr z, .invisible ; $5CA8: $28 $49
push hl ; $5CAA: $E5
ld a, [wOAMNextAvailableSlot] ; $5CAB: $FA $C0 $C3
ld e, a ; $5CAE: $5F
ld d, $00 ; $5CAF: $16 $00
ld hl, wDynamicOAMBuffer ; $5CB1: $21 $30 $C0
add hl, de ; $5CB4: $19
ld e, l ; $5CB5: $5D
ld d, h ; $5CB6: $54
pop hl ; $5CB7: $E1
.loop:
ldh a, [hActiveEntityVisualPosY] ; $5CB8: $F0 $EC
add [hl] ; $5CBA: $86
cp $7E ; $5CBB: $FE $7E
jr c, .positiveY ; $5CBD: $38 $01
xor a ; $5CBF: $AF
.positiveY
ld [de], a ; $5CC0: $12
inc hl ; $5CC1: $23
inc de ; $5CC2: $13
push bc ; $5CC3: $C5
ld a, [wScreenShakeHorizontal] ; $5CC4: $FA $55 $C1
ld c, a ; $5CC7: $4F
ldh a, [hActiveEntityPosX] ; $5CC8: $F0 $EE
add [hl] ; $5CCA: $86
sub c ; $5CCB: $91
ld [de], a ; $5CCC: $12
inc hl ; $5CCD: $23
inc de ; $5CCE: $13
ldh a, [hActiveEntityTilesOffset] ; $5CCF: $F0 $F5
ld c, a ; $5CD1: $4F
ld a, [hl+] ; $5CD2: $2A
push af ; $5CD3: $F5
add c ; $5CD4: $81
ld [de], a ; $5CD5: $12
pop af ; $5CD6: $F1
cp $FF ; $5CD7: $FE $FF
jr nz, .visibleSprite ; $5CD9: $20 $04
dec de ; $5CDB: $1B
xor a ; $5CDC: $AF
ld [de], a ; $5CDD: $12
inc de ; $5CDE: $13
.visibleSprite
pop bc ; $5CDF: $C1
inc de ; $5CE0: $13
ldh a, [hActiveEntityFlipAttribute] ; $5CE1: $F0 $ED
xor [hl] ; $5CE3: $AE
inc hl ; $5CE4: $23
ld [de], a ; $5CE5: $12
inc de ; $5CE6: $13
dec c ; $5CE7: $0D
jr nz, .loop ; $5CE8: $20 $CE
ld a, [wActiveEntityIndex] ; $5CEA: $FA $23 $C1
ld c, a ; $5CED: $4F
ld a, $0A ; $5CEE: $3E $0A
jp func_015_7964_trampoline ; $5CF0: $C3 $A0 $3D
.invisible
ld a, [wActiveEntityIndex] ; $5CF3: $FA $23 $C1
ld c, a ; $5CF6: $4F
ret ; $5CF7: $C9
; Y position, X position, tile n°, attribute
SmashablePillarSpriteVariants::
.variant0
db $00, $00, $4C, OAM_GBC_PAL_7 | OAMF_PAL0, $00, $08, $4C, OAM_GBC_PAL_7 | OAMF_PAL0 | OAMF_XFLIP
db $F0, $00, $4A, OAM_GBC_PAL_7 | OAMF_PAL0, $F0, $08, $4A, OAM_GBC_PAL_7 | OAMF_PAL0 | OAMF_XFLIP
db $E0, $00, $4A, OAM_GBC_PAL_7 | OAMF_PAL0, $E0, $08, $4A, OAM_GBC_PAL_7 | OAMF_PAL0 | OAMF_XFLIP
db $D0, $00, $4A, OAM_GBC_PAL_7 | OAMF_PAL0, $D0, $08, $4A, OAM_GBC_PAL_7 | OAMF_PAL0 | OAMF_XFLIP
db $C0, $00, $48, OAM_GBC_PAL_7 | OAMF_PAL0, $C0, $08, $48, OAM_GBC_PAL_7 | OAMF_PAL0 | OAMF_XFLIP
.variant1
db $00, $00, $4A, OAM_GBC_PAL_7 | OAMF_PAL0, $00, $08, $4A, OAM_GBC_PAL_7 | OAMF_PAL0 | OAMF_XFLIP
db $F0, $00, $4A, OAM_GBC_PAL_7 | OAMF_PAL0, $F0, $08, $4A, OAM_GBC_PAL_7 | OAMF_PAL0 | OAMF_XFLIP
db $E0, $00, $4A, OAM_GBC_PAL_7 | OAMF_PAL0, $E0, $08, $4A, OAM_GBC_PAL_7 | OAMF_PAL0 | OAMF_XFLIP
db $D0, $00, $48, OAM_GBC_PAL_7 | OAMF_PAL0, $D0, $08, $48, OAM_GBC_PAL_7 | OAMF_PAL0 | OAMF_XFLIP
db $C0, $00, $FF, OAM_GBC_PAL_7 | OAMF_PAL0, $C0, $08, $FF, OAM_GBC_PAL_7 | OAMF_PAL0 | OAMF_XFLIP
.variant2
db $00, $00, $4A, OAM_GBC_PAL_7 | OAMF_PAL0, $00, $08, $4A, OAM_GBC_PAL_7 | OAMF_PAL0 | OAMF_XFLIP
db $F0, $00, $4A, OAM_GBC_PAL_7 | OAMF_PAL0, $F0, $08, $4A, OAM_GBC_PAL_7 | OAMF_PAL0 | OAMF_XFLIP
db $E0, $00, $48, OAM_GBC_PAL_7 | OAMF_PAL0, $E0, $08, $48, OAM_GBC_PAL_7 | OAMF_PAL0 | OAMF_XFLIP
db $D0, $00, $FF, OAM_GBC_PAL_7 | OAMF_PAL0, $D0, $08, $FF, OAM_GBC_PAL_7 | OAMF_PAL0 | OAMF_XFLIP
db $C0, $00, $FF, OAM_GBC_PAL_7 | OAMF_PAL0, $C0, $08, $FF, OAM_GBC_PAL_7 | OAMF_PAL0 | OAMF_XFLIP
.variant3
db $00, $00, $4A, OAM_GBC_PAL_7 | OAMF_PAL0, $00, $08, $4A, OAM_GBC_PAL_7 | OAMF_PAL0 | OAMF_XFLIP
db $F0, $00, $48, OAM_GBC_PAL_7 | OAMF_PAL0, $F0, $08, $48, OAM_GBC_PAL_7 | OAMF_PAL0 | OAMF_XFLIP
db $E0, $00, $FF, OAM_GBC_PAL_7 | OAMF_PAL0, $E0, $08, $FF, OAM_GBC_PAL_7 | OAMF_PAL0 | OAMF_XFLIP
db $D0, $00, $FF, OAM_GBC_PAL_7 | OAMF_PAL0, $D0, $08, $FF, OAM_GBC_PAL_7 | OAMF_PAL0 | OAMF_XFLIP
db $C0, $00, $FF, OAM_GBC_PAL_7 | OAMF_PAL0, $C0, $08, $FF, OAM_GBC_PAL_7 | OAMF_PAL0 | OAMF_XFLIP
.variant4
db $00, $00, $48, OAM_GBC_PAL_7 | OAMF_PAL0, $00, $08, $48, OAM_GBC_PAL_7 | OAMF_PAL0 | OAMF_XFLIP
db $F0, $00, $FF, OAM_GBC_PAL_7 | OAMF_PAL0, $F0, $08, $FF, OAM_GBC_PAL_7 | OAMF_PAL0 | OAMF_XFLIP
db $E0, $00, $FF, OAM_GBC_PAL_7 | OAMF_PAL0, $E0, $08, $FF, OAM_GBC_PAL_7 | OAMF_PAL0 | OAMF_XFLIP
db $D0, $00, $FF, OAM_GBC_PAL_7 | OAMF_PAL0, $D0, $08, $FF, OAM_GBC_PAL_7 | OAMF_PAL0 | OAMF_XFLIP
db $C0, $00, $FF, OAM_GBC_PAL_7 | OAMF_PAL0, $C0, $08, $FF, OAM_GBC_PAL_7 | OAMF_PAL0 | OAMF_XFLIP
SmashablePillarEntityHandler::
ldh a, [hLinkPositionY] ; $5DC0: $F0 $99
@ -20,20 +110,20 @@ SmashablePillarEntityHandler::
add hl, bc ; $5DC6: $09
ld a, [hl] ; $5DC7: $7E
sub e ; $5DC8: $93
jr c, .jr_5DD0 ; $5DC9: $38 $05
jr c, .aboveLink ; $5DC9: $38 $05
ld a, $01 ; $5DCB: $3E $01
ld [wDE00], a ; $5DCD: $EA $00 $DE
.jr_5DD0
.aboveLink
ld hl, wEntitiesPrivateState1Table ; $5DD0: $21 $B0 $C2
add hl, bc ; $5DD3: $09
ld a, [hl] ; $5DD4: $7E
cp $02 ; $5DD5: $FE $02
jp z, label_007_5FAB ; $5DD7: $CA $AB $5F
jp z, SmashablePillarDebrisHandler ; $5DD7: $CA $AB $5F
and a ; $5DDA: $A7
jp nz, label_007_5F4D ; $5DDB: $C2 $4D $5F
jp nz, SmashablePillarDustHandler ; $5DDB: $C2 $4D $5F
ldh a, [hRoomStatus] ; $5DDE: $F0 $F8
and ROOM_STATUS_EVENT_2 ; $5DE0: $E6 $20
@ -41,7 +131,7 @@ SmashablePillarEntityHandler::
ld a, [wRoomTransitionState] ; $5DE5: $FA $24 $C1
and a ; $5DE8: $A7
jr nz, .jr_5DF5 ; $5DE9: $20 $0A
jr nz, .roomTransition ; $5DE9: $20 $0A
ld hl, wEntitiesRoomTable ; $5DEB: $21 $E0 $C3
add hl, bc ; $5DEE: $09
@ -49,10 +139,10 @@ SmashablePillarEntityHandler::
cp [hl] ; $5DF1: $BE
jp nz, ClearEntityStatus_07 ; $5DF2: $C2 $A4 $7E
.jr_5DF5
.roomTransition
ldh a, [hActiveEntitySpriteVariant] ; $5DF5: $F0 $F1
cp $05 ; $5DF7: $FE $05
jr nc, jr_007_5E12 ; $5DF9: $30 $17
jr nc, .variant5End ; $5DF9: $30 $17
rla ; $5DFB: $17
rla ; $5DFC: $17
@ -64,55 +154,53 @@ SmashablePillarEntityHandler::
add e ; $5E06: $83
ld e, a ; $5E07: $5F
ld d, b ; $5E08: $50
label_007_5E09:
ld hl, Data_007_5CF8 ; $5E09: $21 $F8 $5C
ld hl, SmashablePillarSpriteVariants ; $5E09: $21 $F8 $5C
add hl, de ; $5E0C: $19
ld c, $0A ; $5E0D: $0E $0A
call func_007_5CA5 ; $5E0F: $CD $A5 $5C
call RenderSmashablePillar ; $5E0F: $CD $A5 $5C
jr_007_5E12:
.variant5End
call DecrementEntityIgnoreHitsCountdown ; $5E12: $CD $56 $0C
call label_3B70 ; $5E15: $CD $70 $3B
call PushLinkOutOfEntity_07 ; $5E18: $CD $F0 $7C
ldh a, [hActiveEntityState] ; $5E1B: $F0 $F0
JP_TABLE ; $5E1D
._00 dw func_007_5E2A ; $5E1E
._01 dw func_007_5E2B ; $5E20
._02 dw func_007_5E43 ; $5E22
._03 dw func_007_5EC5 ; $5E24
._04 dw func_007_5EF2 ; $5E26
._05 dw func_007_5F11 ; $5E28
._00 dw SmashablePillarState0Handler ; $5E1E
._01 dw SmashablePillarState1Handler ; $5E20
._02 dw SmashablePillarState2Handler ; $5E22
._03 dw SmashablePillarState3Handler ; $5E24
._04 dw SmashablePillarState4Handler ; $5E26
._05 dw SmashablePillarState5Handler ; $5E28
func_007_5E2A::
SmashablePillarState0Handler::
ret
func_007_5E2B::
SmashablePillarState1Handler::
call func_007_5EEA ; $5E2B: $CD $EA $5E
call GetEntityTransitionCountdown ; $5E2E: $CD $05 $0C
jr nz, func_007_5E36 ; $5E31: $20 $03
jr nz, SmashablePillarShakeScreen ; $5E31: $20 $03
jp IncrementEntityState ; $5E33: $C3 $12 $3B
func_007_5E36::
SmashablePillarShakeScreen::
ld e, $00 ; $5E36: $1E $00
and $04 ; $5E38: $E6 $04
jr z, .jr_5E3E ; $5E3A: $28 $02
jr z, .shakeRight ; $5E3A: $28 $02
ld e, $02 ; $5E3C: $1E $02
.jr_5E3E
.shakeRight
ld a, e ; $5E3E: $7B
ld [wScreenShakeHorizontal], a ; $5E3F: $EA $55 $C1
ret ; $5E42: $C9
func_007_5E43::
SmashablePillarState2Handler::
call func_007_5EEA ; $5E43: $CD $EA $5E
ldh a, [hFrameCounter] ; $5E46: $F0 $E7
call func_007_5E36 ; $5E48: $CD $36 $5E
call SmashablePillarShakeScreen ; $5E48: $CD $36 $5E
ldh a, [hFrameCounter] ; $5E4B: $F0 $E7
and $1F ; $5E4D: $E6 $1F
jr nz, .jr_5E67 ; $5E4F: $20 $16
jr nz, .spawnDebrisEnd ; $5E4F: $20 $16
ld hl, wEntitiesSpriteVariantTable ; $5E51: $21 $B0 $C3
add hl, bc ; $5E54: $09
@ -120,22 +208,22 @@ func_007_5E43::
inc a ; $5E56: $3C
ld [hl], a ; $5E57: $77
cp $05 ; $5E58: $FE $05
jp z, label_007_5EA7 ; $5E5A: $CA $A7 $5E
jp z, SmashablePillarDestroyed ; $5E5A: $CA $A7 $5E
call GetRandomByte ; $5E5D: $CD $0D $28
and $03 ; $5E60: $E6 $03
jr z, .jr_5E67 ; $5E62: $28 $03
jr z, .spawnDebrisEnd ; $5E62: $28 $03
call func_007_5F61 ; $5E64: $CD $61 $5F
call SmashablePillarSpawnDebris ; $5E64: $CD $61 $5F
.jr_5E67
.spawnDebrisEnd
ldh a, [hFrameCounter] ; $5E67: $F0 $E7
and $03 ; $5E69: $E6 $03
jr nz, .ret_5EA6 ; $5E6B: $20 $39
jr nz, .return ; $5E6B: $20 $39
ld a, ENTITY_SMASHABLE_PILLAR ; $5E6D: $3E $A7
call SpawnNewEntity_trampoline ; $5E6F: $CD $86 $3B
jr c, .ret_5EA6 ; $5E72: $38 $32
jr c, .return ; $5E72: $38 $32
call GetRandomByte ; $5E74: $CD $0D $28
and $07 ; $5E77: $E6 $07
@ -163,29 +251,29 @@ func_007_5E43::
add hl, de ; $5EA3: $19
ld [hl], $01 ; $5EA4: $36 $01
.ret_5EA6
.return
ret ; $5EA6: $C9
label_007_5EA7:
SmashablePillarDestroyed:
ld a, $00 ; $5EA7: $3E $00
ld [wScreenShakeHorizontal], a ; $5EA9: $EA $55 $C1
ld a, [wNumberOfDungeon7PillarsDestroyed] ; $5EAC: $FA $72 $DB
inc a ; $5EAF: $3C
ld [wNumberOfDungeon7PillarsDestroyed], a ; $5EB0: $EA $72 $DB
cp $04 ; $5EB3: $FE $04
jr c, .jr_5EBF ; $5EB5: $38 $08
jr c, .lastPillar ; $5EB5: $38 $08
call GetEntityTransitionCountdown ; $5EB7: $CD $05 $0C
ld [hl], $20 ; $5EBA: $36 $20
jp IncrementEntityState ; $5EBC: $C3 $12 $3B
.jr_5EBF
.lastPillar
call func_007_6E7F ; $5EBF: $CD $7F $6E
jp ClearEntityStatus_07 ; $5EC2: $C3 $A4 $7E
func_007_5EC5::
SmashablePillarState3Handler::
call GetEntityTransitionCountdown ; $5EC5: $CD $05 $0C
jr nz, .jr_5EDE ; $5EC8: $20 $14
jr nz, .skipIncrementState ; $5EC8: $20 $14
ld [hl], $20 ; $5ECA: $36 $20
ld a, GAMEPLAY_CUTSCENE ; $5ECC: $3E $08
@ -196,14 +284,14 @@ func_007_5EC5::
ld [wGameplaySubtype], a ; $5ED8: $EA $96 $DB
jp IncrementEntityState ; $5EDB: $C3 $12 $3B
.jr_5EDE
.skipIncrementState
ld e, $00 ; $5EDE: $1E $00
and $04 ; $5EE0: $E6 $04
jr z, .jr_5EE6 ; $5EE2: $28 $02
jr z, .shakeRight ; $5EE2: $28 $02
ld e, $02 ; $5EE4: $1E $02
.jr_5EE6
.shakeRight
ld a, e ; $5EE6: $7B
ld [wScreenShakeHorizontal], a ; $5EE7: $EA $55 $C1
@ -213,32 +301,32 @@ func_007_5EEA::
ld [wC111], a ; $5EEE: $EA $11 $C1
ret ; $5EF1: $C9
func_007_5EF2::
SmashablePillarState4Handler::
xor a ; $5EF2: $AF
ld [wScreenShakeHorizontal], a ; $5EF3: $EA $55 $C1
call GetEntityTransitionCountdown ; $5EF6: $CD $05 $0C
jr nz, .jr_5F06 ; $5EF9: $20 $0B
jr nz, .skipCollapseTower ; $5EF9: $20 $0B
call func_007_6E7F ; $5EFB: $CD $7F $6E
ld hl, wHasInstrument7 ; $5EFE: $21 $6B $DB
set 2, [hl] ; $5F01: $CB $D6
jp ClearEntityStatus_07 ; $5F03: $C3 $A4 $7E
.jr_5F06
.skipCollapseTower
jp func_007_5EEA ; $5F06: $C3 $EA $5E
Data_007_5F09::
db $00, $02, $04, $06, $06, $04, $02, $00
func_007_5F11::
SmashablePillarState5Handler::
xor a ; $5F11: $AF
ld [wScreenShakeVertical], a ; $5F12: $EA $56 $C1
call GetEntityTransitionCountdown ; $5F15: $CD $05 $0C
jr nz, .jr_5F1D ; $5F18: $20 $03
jr nz, .skipClearStatus ; $5F18: $20 $03
jp ClearEntityStatus_07 ; $5F1A: $C3 $A4 $7E
.jr_5F1D
.skipClearStatus
push af ; $5F1D: $F5
and $07 ; $5F1E: $E6 $07
ld e, a ; $5F20: $5F
@ -249,29 +337,28 @@ func_007_5F11::
ld [wScreenShakeVertical], a ; $5F27: $EA $56 $C1
pop af ; $5F2A: $F1
cp $20 ; $5F2B: $FE $20
jr nc, .jr_5F37 ; $5F2D: $30 $08
jr nc, .skipSpawnDebris ; $5F2D: $30 $08
and $03 ; $5F2F: $E6 $03
jr nz, .jr_5F37 ; $5F31: $20 $04
jr nz, .skipSpawnDebris ; $5F31: $20 $04
call func_007_5F61 ; $5F33: $CD $61 $5F
call SmashablePillarSpawnDebris ; $5F33: $CD $61 $5F
xor a ; $5F36: $AF
.jr_5F37
.skipSpawnDebris
cp $40 ; $5F37: $FE $40
jr c, .ret_5F44 ; $5F39: $38 $09
jr c, .return ; $5F39: $38 $09
and $07 ; $5F3B: $E6 $07
jr nz, .ret_5F44 ; $5F3D: $20 $05
jr nz, .return ; $5F3D: $20 $05
ld hl, hNoiseSfx ; $5F3F: $21 $F4 $FF
ld [hl], NOISE_SFX_EXPLOSION ; $5F42: $36 $0C
.ret_5F44
.return
ret ; $5F44: $C9
; define sprite variants by selecting tile n° and setting OAM attributes (palette + flags) in a list
Unknown101SpriteVariants::
SmashablePillarDustSpriteVariants::
.variant0
db $30, OAM_GBC_PAL_1 | OAMF_PAL0
db $30, OAM_GBC_PAL_1 | OAMF_PAL0 | OAMF_XFLIP
@ -279,8 +366,8 @@ Unknown101SpriteVariants::
db $32, OAM_GBC_PAL_1 | OAMF_PAL0
db $32, OAM_GBC_PAL_1 | OAMF_PAL0 | OAMF_XFLIP
label_007_5F4D:
ld de, Unknown101SpriteVariants ; $5F4D: $11 $45 $5F
SmashablePillarDustHandler::
ld de, SmashablePillarDustSpriteVariants ; $5F4D: $11 $45 $5F
call RenderActiveEntitySpritesPair ; $5F50: $CD $C0 $3B
call GetEntityTransitionCountdown ; $5F53: $CD $05 $0C
jp z, ClearEntityStatus_07 ; $5F56: $CA $A4 $7E
@ -291,10 +378,10 @@ label_007_5F4D:
ld a, $01 ; $5F5C: $3E $01
jp SetEntitySpriteVariant ; $5F5E: $C3 $0C $3B
func_007_5F61::
SmashablePillarSpawnDebris::
ld a, ENTITY_SMASHABLE_PILLAR ; $5F61: $3E $A7
call SpawnNewEntity_trampoline ; $5F63: $CD $86 $3B
jr c, .ret_5F9A ; $5F66: $38 $32
jr c, .return ; $5F66: $38 $32
ld hl, wEntitiesPrivateState1Table ; $5F68: $21 $B0 $C2
add hl, de ; $5F6B: $19
@ -322,28 +409,30 @@ func_007_5F61::
add hl, de ; $5F98: $19
ld [hl], a ; $5F99: $77
.ret_5F9A
.return
ret ; $5F9A: $C9
Data_007_5F9B::
db $16, $03, $16, $23
SmashablePillarDebrisSpriteVariants::
.variant0
db $16, OAM_GBC_PAL_3 | OAMF_PAL0
.variant1
db $16, OAM_GBC_PAL_3 | OAMF_PAL0 | OAMF_XFLIP
Data_007_5F9F::
; Initial z speed is lower for each consecutive bounce
SmashablePillarDebrisZSpeeds::
db $18, $10, $0C, $08
Data_007_5FA3::
SmashablePillarDebrisXSpeeds::
db $0C, $F4, $0C, $F4
Data_007_5FA7::
SmashablePillarDebrisYSpeeds::
db $F4, $F4, $0C, $0C
label_007_5FAB:
SmashablePillarDebrisHandler::
ldh a, [hActiveEntityVisualPosY] ; $5FAB: $F0 $EC
add $08 ; $5FAD: $C6 $08
ldh [hActiveEntityVisualPosY], a ; $5FAF: $E0 $EC
.jr_5FB1
ld de, Data_007_5F9B ; $5FB1: $11 $9B $5F
ld de, SmashablePillarDebrisSpriteVariants ; $5FB1: $11 $9B $5F
call RenderActiveEntitySprite ; $5FB4: $CD $77 $3C
call UpdateEntityPosWithSpeed_07 ; $5FB7: $CD $0A $7E
call AddEntityZSpeedToPos_07 ; $5FBA: $CD $43 $7E
@ -367,7 +456,7 @@ label_007_5FAB:
ld e, a ; $5FD7: $5F
ld d, b ; $5FD8: $50
ld hl, Data_007_5F9F ; $5FD9: $21 $9F $5F
ld hl, SmashablePillarDebrisZSpeeds ; $5FD9: $21 $9F $5F
add hl, de ; $5FDC: $19
ld a, [hl] ; $5FDD: $7E
ld hl, wEntitiesSpeedZTable ; $5FDE: $21 $20 $C3
@ -377,16 +466,14 @@ label_007_5FAB:
and $03 ; $5FE6: $E6 $03
ld e, a ; $5FE8: $5F
ld d, b ; $5FE9: $50
ld hl, Data_007_5FA3 ; $5FEA: $21 $A3 $5F
ld hl, SmashablePillarDebrisXSpeeds ; $5FEA: $21 $A3 $5F
add hl, de ; $5FED: $19
ld a, [hl] ; $5FEE: $7E
ld hl, wEntitiesSpeedXTable ; $5FEF: $21 $40 $C2
add hl, bc ; $5FF2: $09
ld [hl], a ; $5FF3: $77
ld hl, Data_007_5FA7 ; $5FF4: $21 $A7 $5F
ld hl, SmashablePillarDebrisYSpeeds ; $5FF4: $21 $A7 $5F
add hl, de ; $5FF7: $19
.jr_5FF8
ld a, [hl] ; $5FF8: $7E
call GetEntitySpeedYAddress ; $5FF9: $CD $05 $40
ld [hl], a ; $5FFC: $77

View File

@ -1,17 +1,17 @@
; define sprite variants by selecting tile n° and setting OAM attributes (palette + flags) in a list
SnakeSpriteVariants::
.variant0
db $44, $03
db $46, $03
db $44, OAM_GBC_PAL_3 | OAMF_PAL0
db $46, OAM_GBC_PAL_3 | OAMF_PAL0
.variant1
db $44, $03
db $48, $03
db $44, OAM_GBC_PAL_3 | OAMF_PAL0
db $48, OAM_GBC_PAL_3 | OAMF_PAL0
.variant2
db $46, $23
db $44, $23
db $46, OAM_GBC_PAL_3 | OAMF_PAL0 | OAMF_XFLIP
db $44, OAM_GBC_PAL_3 | OAMF_PAL0 | OAMF_XFLIP
.variant3
db $48, $23
db $44, $23
db $48, OAM_GBC_PAL_3 | OAMF_PAL0 | OAMF_XFLIP
db $44, OAM_GBC_PAL_3 | OAMF_PAL0 | OAMF_XFLIP
SnakeEntityHandler::
ld hl, wEntitiesDirectionTable ; $684E: $21 $80 $C3
@ -42,9 +42,9 @@ SnakeEntityHandler::
.jr_6882
ldh a, [hActiveEntityState] ; $6882: $F0 $F0
JP_TABLE ; $6884
._00 dw func_007_6897 ; $6885
._01 dw func_007_68D8 ; $6887
._02 dw func_007_6929 ; $6889
._00 dw SnakeState0Handler ; $6885
._01 dw SnakeState1Handler ; $6887
._02 dw SnakeState2Handler ; $6889
Data_007_688B::
db $08, $F8, $00, $00
@ -55,7 +55,7 @@ Data_007_688F::
Data_007_6893::
db $02, $00, $FF, $FF
func_007_6897::
SnakeState0Handler::
call GetEntityTransitionCountdown ; $6897: $CD $05 $0C
jr nz, jr_007_68D0 ; $689A: $20 $34
@ -99,7 +99,7 @@ jr_007_68D0:
call func_007_68F0 ; $68D3: $CD $F0 $68
jr jr_007_68E6 ; $68D6: $18 $0E
func_007_68D8::
SnakeState1Handler::
call GetEntityTransitionCountdown ; $68D8: $CD $05 $0C
jr nz, .jr_68E3 ; $68DB: $20 $06
@ -122,12 +122,12 @@ func_007_68F0::
call GetEntityPrivateCountdown1 ; $68F0: $CD $00 $0C
jr nz, ret_007_6919 ; $68F3: $20 $24
call EntityLinkPositionXDifference_07 ; $68F5: $CD $5D $7E
call GetEntityXDistanceToLink_07 ; $68F5: $CD $5D $7E
add $08 ; $68F8: $C6 $08
cp $10 ; $68FA: $FE $10
jr nc, jr_007_691A ; $68FC: $30 $1C
call EntityLinkPositionYDifference_07 ; $68FE: $CD $6D $7E
call GetEntityYDistanceToLink_07 ; $68FE: $CD $6D $7E
jr_007_6901:
call func_007_68AD ; $6901: $CD $AD $68
@ -145,18 +145,18 @@ ret_007_6919:
ret ; $6919: $C9
jr_007_691A:
call EntityLinkPositionYDifference_07 ; $691A: $CD $6D $7E
call GetEntityYDistanceToLink_07 ; $691A: $CD $6D $7E
add $08 ; $691D: $C6 $08
cp $10 ; $691F: $FE $10
jr nc, .ret_6928 ; $6921: $30 $05
call EntityLinkPositionXDifference_07 ; $6923: $CD $5D $7E
call GetEntityXDistanceToLink_07 ; $6923: $CD $5D $7E
jr jr_007_6901 ; $6926: $18 $D9
.ret_6928
ret ; $6928: $C9
func_007_6929::
SnakeState2Handler::
call GetEntityTransitionCountdown ; $6929: $CD $05 $0C
jr nz, .jr_6939 ; $692C: $20 $0B

View File

@ -133,7 +133,7 @@ func_007_7825::
and $06 ; $783B: $E6 $06
jr nz, .jr_7844 ; $783D: $20 $05
call func_007_7E7D ; $783F: $CD $7D $7E
call GetEntityDirectionToLink_07 ; $783F: $CD $7D $7E
jr jr_007_784A ; $7842: $18 $06
.jr_7844
@ -176,18 +176,18 @@ jr_007_786E:
ld hl, wEntitiesOptions1Table ; $7874: $21 $30 $C4
add hl, bc ; $7877: $09
ld [hl], ENTITY_OPT1_SWORD_CLINK_OFF|ENTITY_OPT1_SPLASH_IN_WATER ; $7878: $36 $48
call EntityLinkPositionXDifference_07 ; $787A: $CD $5D $7E
call GetEntityXDistanceToLink_07 ; $787A: $CD $5D $7E
add $06 ; $787D: $C6 $06
cp $0A ; $787F: $FE $0A
jr c, .jr_788C ; $7881: $38 $09
call EntityLinkPositionYDifference_07 ; $7883: $CD $6D $7E
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_788C
call func_007_7E7D ; $788C: $CD $7D $7E
call GetEntityDirectionToLink_07 ; $788C: $CD $7D $7E
ld hl, wEntitiesDirectionTable ; $788F: $21 $80 $C3
add hl, bc ; $7892: $09
ld [hl], e ; $7893: $73

View File

@ -332,7 +332,7 @@ jr_007_506E:
ld hl, wEntitiesDirectionTable ; $508F: $21 $80 $C3
add hl, bc ; $5092: $09
ld [hl], a ; $5093: $77
call func_007_7E7D ; $5094: $CD $7D $7E
call GetEntityDirectionToLink_07 ; $5094: $CD $7D $7E
ld a, e ; $5097: $7B
xor $01 ; $5098: $EE $01

View File

@ -87,7 +87,7 @@ WingedOctorokEntityHandler::
cp $0A ; $56A5: $FE $0A
jr nz, .jr_56B7 ; $56A7: $20 $0E
call func_007_7E7D ; $56A9: $CD $7D $7E
call GetEntityDirectionToLink_07 ; $56A9: $CD $7D $7E
ld hl, wEntitiesDirectionTable ; $56AC: $21 $80 $C3
add hl, bc ; $56AF: $09
ld a, e ; $56B0: $7B
@ -117,7 +117,7 @@ jr_007_56BD:
cp $00 ; $56D4: $FE $00
jr nz, .jr_56DD ; $56D6: $20 $05
call func_007_7E7D ; $56D8: $CD $7D $7E
call GetEntityDirectionToLink_07 ; $56D8: $CD $7D $7E
jr jr_007_56E0 ; $56DB: $18 $03
.jr_56DD
@ -173,12 +173,12 @@ label_007_5721:
and a ; $5726: $A7
jr nz, jr_007_5777 ; $5727: $20 $4E
call EntityLinkPositionXDifference_07 ; $5729: $CD $5D $7E
call GetEntityXDistanceToLink_07 ; $5729: $CD $5D $7E
add $20 ; $572C: $C6 $20
cp $40 ; $572E: $FE $40
jr nc, jr_007_5777 ; $5730: $30 $45
call EntityLinkPositionYDifference_07 ; $5732: $CD $6D $7E
call GetEntityYDistanceToLink_07 ; $5732: $CD $6D $7E
add $20 ; $5735: $C6 $20
cp $40 ; $5737: $FE $40
jr nc, jr_007_5777 ; $5739: $30 $3C
@ -203,7 +203,7 @@ label_007_5721:
jr z, jr_007_5777 ; $5755: $28 $20
jr_007_5757:
call func_007_7E7D ; $5757: $CD $7D $7E
call GetEntityDirectionToLink_07 ; $5757: $CD $7D $7E
ld hl, wEntitiesDirectionTable ; $575A: $21 $80 $C3
add hl, bc ; $575D: $09
ld a, [hl] ; $575E: $7E
@ -231,7 +231,7 @@ label_007_577A:
ld hl, wEntitiesPrivateState2Table ; $5780: $21 $C0 $C2
add hl, bc ; $5783: $09
ld [hl], a ; $5784: $77
call func_007_7E7D ; $5785: $CD $7D $7E
call GetEntityDirectionToLink_07 ; $5785: $CD $7D $7E
ld hl, wEntitiesDirectionTable ; $5788: $21 $80 $C3
add hl, bc ; $578B: $09
ld [hl], e ; $578C: $73

View File

@ -1,5 +1,6 @@
Data_007_6003::
db $4E, $00, $4E, $20
WreckingBallSprite::
db $4E, OAM_GBC_PAL_0 | OAMF_PAL0
db $4E, OAM_GBC_PAL_0 | OAMF_PAL0 | OAMF_XFLIP
WreckingBallEntityHandler::
IF __PATCH_0__
@ -22,8 +23,8 @@ ENDC
.default
ldh a, [hActiveEntityStatus] ; $6007: $F0 $EA
cp $07 ; $6009: $FE $07
jr nz, jr_007_602A ; $600B: $20 $1D
cp ENTITY_STATUS_LIFTED ; $6009: $FE $07
jr nz, notLifted ; $600B: $20 $1D
ld a, [wLinkMotionState] ; $600D: $FA $1C $C1
cp LINK_MOTION_REVOLVING_DOOR ; $6010: $FE $05
@ -44,8 +45,8 @@ ENDC
add hl, bc ; $6028: $09
ld [hl], b ; $6029: $70
jr_007_602A:
ld de, Data_007_6003 ; $602A: $11 $03 $60
notLifted:
ld de, WreckingBallSprite ; $602A: $11 $03 $60
call RenderActiveEntitySpritesPair ; $602D: $CD $C0 $3B
ld a, [wRoomTransitionState] ; $6030: $FA $24 $C1
and a ; $6033: $A7
@ -62,7 +63,7 @@ jr_007_602A:
ret nz ; $6048: $C0
ldh a, [hActiveEntityStatus] ; $6049: $F0 $EA
cp $02 ; $604B: $FE $02
cp ENTITY_STATUS_FALLING ; $604B: $FE $02
ret z ; $604D: $C8
call DecrementEntityIgnoreHitsCountdown ; $604E: $CD $56 $0C
@ -79,7 +80,7 @@ jr_007_602A:
ldh [hDungeonFloorTile], a ; $6065: $E0 $E9
and $80 ; $6067: $E6 $80
ldh [hMultiPurposeG], a ; $6069: $E0 $E8
jr z, jr_007_608F ; $606B: $28 $22
jr z, .hitGroundEnd ; $606B: $28 $22
ld [hl], b ; $606D: $70
ld hl, wEntitiesSpeedZTable ; $606E: $21 $20 $C3
@ -88,18 +89,18 @@ jr_007_602A:
sra a ; $6073: $CB $2F
cpl ; $6075: $2F
cp $07 ; $6076: $FE $07
jr c, .jr_6082 ; $6078: $38 $08
jr c, .stopBouncing ; $6078: $38 $08
push af ; $607A: $F5
ld a, NOISE_SFX_CLINK ; $607B: $3E $17
ldh [hNoiseSfx], a ; $607D: $E0 $F4
pop af ; $607F: $F1
jr jr_007_6083 ; $6080: $18 $01
jr .stopBouncingEnd ; $6080: $18 $01
.jr_6082
.stopBouncing
xor a ; $6082: $AF
jr_007_6083:
.stopBouncingEnd
ld [hl], a ; $6083: $77
ld hl, wEntitiesSpeedXTable ; $6084: $21 $40 $C2
add hl, bc ; $6087: $09
@ -107,7 +108,7 @@ jr_007_6083:
call GetEntitySpeedYAddress ; $608A: $CD $05 $40
sra [hl] ; $608D: $CB $2E
jr_007_608F:
.hitGroundEnd
ld hl, wEntitiesIgnoreHitsCountdownTable ; $608F: $21 $10 $C4
add hl, bc ; $6092: $09
ld [hl], $03 ; $6093: $36 $03
@ -135,84 +136,85 @@ jr_007_608F:
ldh [hActiveEntityPosY], a ; $60B6: $E0 $EF
ldh a, [hActiveEntityState] ; $60B8: $F0 $F0
JP_TABLE ; $60BA
._00 dw func_007_60C1 ; $60BB
._01 dw func_007_6134 ; $60BD
._02 dw func_007_6135 ; $60BF
._00 dw WreckingBallState0Handler ; $60BB
._01 dw WreckingBallState1Handler ; $60BD
._02 dw WreckingBallState2Handler ; $60BF
func_007_60C1::
; Idle
WreckingBallState0Handler::
ldh a, [hDungeonFloorTile] ; $60C1: $F0 $E9
dec a ; $60C3: $3D
and $80 ; $60C4: $E6 $80
jr z, jr_007_60DD ; $60C6: $28 $15
jr z, .notTouchingGround ; $60C6: $28 $15
ld hl, wEntitiesSpeedYTable ; $60C8: $21 $50 $C2
call func_007_60D1 ; $60CB: $CD $D1 $60
call .updateSpeed ; $60CB: $CD $D1 $60
ld hl, wEntitiesSpeedXTable ; $60CE: $21 $40 $C2
func_007_60D1::
.updateSpeed
add hl, bc ; $60D1: $09
ld a, [hl] ; $60D2: $7E
and a ; $60D3: $A7
jr z, jr_007_60DD ; $60D4: $28 $07
jr z, .notTouchingGround ; $60D4: $28 $07
and $80 ; $60D6: $E6 $80
jr z, .jr_60DC ; $60D8: $28 $02
jr z, .positiveSpeed ; $60D8: $28 $02
inc [hl] ; $60DA: $34
inc [hl] ; $60DB: $34
.jr_60DC
.positiveSpeed
dec [hl] ; $60DC: $35
jr_007_60DD:
.notTouchingGround
call CheckLinkCollisionWithEnemy_trampoline ; $60DD: $CD $5A $3B
jr nc, ret_007_6133 ; $60E0: $30 $51
jr nc, .return ; $60E0: $30 $51
ld a, [wLinkAttackStepAnimationCountdown] ; $60E2: $FA $9B $C1
and a ; $60E5: $A7
jr nz, ret_007_6133 ; $60E6: $20 $4B
jr nz, .return ; $60E6: $20 $4B
ld a, [wInventoryItems.BButtonSlot] ; $60E8: $FA $00 $DB
cp INVENTORY_POWER_BRACELET ; $60EB: $FE $03
jr nz, .jr_60F7 ; $60ED: $20 $08
jr nz, .braceletNotOnBSlot ; $60ED: $20 $08
ldh a, [hJoypadState] ; $60EF: $F0 $CC
and J_B ; $60F1: $E6 $20
jr nz, jr_007_6104 ; $60F3: $20 $0F
jr nz, .notGrabbing ; $60F3: $20 $0F
jr ret_007_6133 ; $60F5: $18 $3C
jr .return ; $60F5: $18 $3C
.jr_60F7
.braceletNotOnBSlot
ld a, [wInventoryItems.AButtonSlot] ; $60F7: $FA $01 $DB
cp INVENTORY_POWER_BRACELET ; $60FA: $FE $03
jr nz, ret_007_6133 ; $60FC: $20 $35
jr nz, .return ; $60FC: $20 $35
ldh a, [hJoypadState] ; $60FE: $F0 $CC
and J_A ; $6100: $E6 $10
jr z, ret_007_6133 ; $6102: $28 $2F
jr z, .return ; $6102: $28 $2F
jr_007_6104:
.notGrabbing
ld a, [wC3CF] ; $6104: $FA $CF $C3
and a ; $6107: $A7
jr nz, ret_007_6133 ; $6108: $20 $29
jr nz, .return ; $6108: $20 $29
IF __PATCH_0__
ldh a, [hMovingBlockMoverState]
and a
jr nz, ret_007_6133
jr nz, .return
ENDC
inc a ; $610A: $3C
ld [wC3CF], a ; $610B: $EA $CF $C3
ldh a, [hActiveEntityStatus] ; $610E: $F0 $EA
cp $07 ; $6110: $FE $07
jr z, ret_007_6133 ; $6112: $28 $1F
cp ENTITY_STATUS_LIFTED ; $6110: $FE $07
jr z, .return ; $6112: $28 $1F
call IncrementEntityState ; $6114: $CD $12 $3B
ld [hl], $02 ; $6117: $36 $02
ld hl, wEntitiesStatusTable ; $6119: $21 $80 $C2
add hl, bc ; $611C: $09
ld [hl], $07 ; $611D: $36 $07
ld [hl], ENTITY_STATUS_LIFTED ; $611D: $36 $07
ld hl, wEntitiesLiftedTable ; $611F: $21 $90 $C4
add hl, bc ; $6122: $09
ld [hl], b ; $6123: $70
@ -223,24 +225,26 @@ ENDC
ld hl, hWaveSfx ; $612E: $21 $F3 $FF
ld [hl], WAVE_SFX_LIFT_UP ; $6131: $36 $02
ret_007_6133:
.return
ret ; $6133: $C9
func_007_6134::
; Lifted
WreckingBallState1Handler::
ret ; $6134: $C9
func_007_6135::
; Thrown
WreckingBallState2Handler::
ldh a, [hMultiPurposeG] ; $6135: $F0 $E8
and a ; $6137: $A7
jr nz, jr_007_6159 ; $6138: $20 $1F
jr nz, .touchingGround ; $6138: $20 $1F
ld hl, wEntitiesCollisionsTable ; $613A: $21 $A0 $C2
add hl, bc ; $613D: $09
ld a, [hl] ; $613E: $7E
and a ; $613F: $A7
jr z, jr_007_6164 ; $6140: $28 $22
jr z, .noCollision ; $6140: $28 $22
func_007_6142::
.collided
ld a, JINGLE_SWORD_POKING ; $6142: $3E $07
ldh [hJingle], a ; $6144: $E0 $F2
ld hl, wEntitiesSpeedXTable ; $6146: $21 $40 $C2
@ -257,7 +261,8 @@ func_007_6142::
sra a ; $6156: $CB $2F
ld [hl], a ; $6158: $77
jr_007_6159:
; negative z position
.touchingGround
ld hl, wC5D0 ; $6159: $21 $D0 $C5
add hl, bc ; $615C: $09
ld [hl], $FF ; $615D: $36 $FF
@ -265,7 +270,8 @@ jr_007_6159:
ld [hl], b ; $6162: $70
ret ; $6163: $C9
jr_007_6164:
; no collision
.noCollision
call ReturnIfNonInteractive_07 ; $6164: $CD $96 $7D
ld a, $0B ; $6167: $3E $0B
ld [wC19E], a ; $6169: $EA $9E $C1
@ -273,34 +279,34 @@ jr_007_6164:
ld e, $0F ; $616F: $1E $0F
ld d, b ; $6171: $50
jr_007_6172:
.loop
ld hl, wEntitiesStatusTable ; $6172: $21 $80 $C2
add hl, de ; $6175: $19
ld a, [hl] ; $6176: $7E
and a ; $6177: $A7
jr z, .jr_6188 ; $6178: $28 $0E
jr z, .hitPillarEnd ; $6178: $28 $0E
ld hl, wEntitiesTypeTable ; $617A: $21 $A0 $C3
add hl, de ; $617D: $19
ld a, [hl] ; $617E: $7E
cp $A7 ; $617F: $FE $A7
jr nz, .jr_6188 ; $6181: $20 $05
cp ENTITY_SMASHABLE_PILLAR ; $617F: $FE $A7
jr nz, .hitPillarEnd ; $6181: $20 $05
push de ; $6183: $D5
call func_007_618F ; $6184: $CD $8F $61
call WreckingBallHandlePillarCollision ; $6184: $CD $8F $61
pop de ; $6187: $D1
.jr_6188
.hitPillarEnd
dec e ; $6188: $1D
ld a, e ; $6189: $7B
cp $FF ; $618A: $FE $FF
jr nz, jr_007_6172 ; $618C: $20 $E4
jr nz, .loop ; $618C: $20 $E4
ret ; $618E: $C9
func_007_618F::
WreckingBallHandlePillarCollision::
call GetEntityTransitionCountdown ; $618F: $CD $05 $0C
jr nz, .ret_61CD ; $6192: $20 $39
jr nz, .return ; $6192: $20 $39
ld hl, wEntitiesPosXTable ; $6194: $21 $00 $C2
add hl, de ; $6197: $19
@ -308,7 +314,7 @@ func_007_618F::
sub [hl] ; $619A: $96
add $10 ; $619B: $C6 $10
cp $20 ; $619D: $FE $20
jr nc, .ret_61CD ; $619F: $30 $2C
jr nc, .return ; $619F: $30 $2C
ld hl, wEntitiesPosYTable ; $61A1: $21 $10 $C2
add hl, de ; $61A4: $19
@ -316,9 +322,9 @@ func_007_618F::
sub [hl] ; $61A7: $96
add $18 ; $61A8: $C6 $18
cp $28 ; $61AA: $FE $28
jr nc, .ret_61CD ; $61AC: $30 $1F
jr nc, .return ; $61AC: $30 $1F
call func_007_6142 ; $61AE: $CD $42 $61
call WreckingBallState2Handler.collided ; $61AE: $CD $42 $61
ld a, NOISE_SFX_D7_PILLAR_COLLAPSE ; $61B1: $3E $25
ldh [hNoiseSfx], a ; $61B3: $E0 $F4
ld a, JINGLE_STRONG_BUMP ; $61B5: $3E $0B
@ -329,12 +335,12 @@ func_007_618F::
add hl, de ; $61C1: $19
ld a, [hl] ; $61C2: $7E
and a ; $61C3: $A7
jr nz, .ret_61CD ; $61C4: $20 $07
jr nz, .return ; $61C4: $20 $07
inc [hl] ; $61C6: $34
ld hl, wEntitiesTransitionCountdownTable ; $61C7: $21 $E0 $C2
add hl, de ; $61CA: $19
ld [hl], $50 ; $61CB: $36 $50
.ret_61CD
.return
ret ; $61CD: $C9

View File

@ -303,7 +303,7 @@ func_015_4873::
xor a ; $4887: $AF
ld [wC158], a ; $4888: $EA $58 $C1
ld a, $20 ; $488B: $3E $20
ld [wC157], a ; $488D: $EA $57 $C1
ld [wScreenShakeCountdown], a ; $488D: $EA $57 $C1
ld a, JINGLE_STRONG_BUMP ; $4890: $3E $0B
ldh [hJingle], a ; $4892: $E0 $F2
ld hl, wEntitiesSpeedXTable ; $4894: $21 $40 $C2

View File

@ -28,7 +28,7 @@ MonkeyEntityHandler::
cp $02 ; $769D: $FE $02
jr nc, .jr_76EF ; $769F: $30 $4E
ld a, [wC157] ; $76A1: $FA $57 $C1
ld a, [wScreenShakeCountdown] ; $76A1: $FA $57 $C1
and a ; $76A4: $A7
jr z, .jr_76EF ; $76A5: $28 $48

View File

@ -275,7 +275,7 @@ jr_018_5B3B:
ld [hl], JINGLE_STRONG_BUMP ; $5B3E: $36 $0B
ld hl, hWaveSfx ; $5B40: $21 $F3 $FF
ld [hl], WAVE_SFX_LINK_HURT ; $5B43: $36 $03
ld hl, wC157 ; $5B45: $21 $57 $C1
ld hl, wScreenShakeCountdown ; $5B45: $21 $57 $C1
ld [hl], $18 ; $5B48: $36 $18
ld hl, wC158 ; $5B4A: $21 $58 $C1
ld [hl], $04 ; $5B4D: $36 $04

View File

@ -116,7 +116,7 @@ ThwompRammableState1Handler::
call GetEntityTransitionCountdown ; $5626: $CD $05 $0C
ld [hl], $30 ; $5629: $36 $30
ld a, $30 ; $562B: $3E $30
ld [wC157], a ; $562D: $EA $57 $C1
ld [wScreenShakeCountdown], a ; $562D: $EA $57 $C1
ld a, $04 ; $5630: $3E $04
ld [wC158], a ; $5632: $EA $58 $C1
jp IncrementEntityState ; $5635: $C3 $12 $3B
@ -452,7 +452,7 @@ ThwompState2Handler::
call GetEntityTransitionCountdown ; $586F: $CD $05 $0C
ld [hl], $30 ; $5872: $36 $30
ld a, $30 ; $5874: $3E $30
ld [wC157], a ; $5876: $EA $57 $C1
ld [wScreenShakeCountdown], a ; $5876: $EA $57 $C1
ld a, $04 ; $5879: $3E $04
ld [wC158], a ; $587B: $EA $58 $C1
jp IncrementEntityState ; $587E: $C3 $12 $3B

View File

@ -278,7 +278,7 @@ func_020_4303::
ld [wC5A0], a ; $430A: $EA $A0 $C5
ld [wShouldGetLostInMysteriousWoods], a ; $430D: $EA $0C $C1
ldh [hLinkSlowWalkingSpeed], a ; $4310: $E0 $B2
ld [wC117], a ; $4312: $EA $17 $C1
ld [wIsGelClingingToLink], a ; $4312: $EA $17 $C1
ld [wC19D], a ; $4315: $EA $9D $C1
ld [wC147], a ; $4318: $EA $47 $C1
ld [wLiftedEntityType], a ; $431B: $EA $A8 $C5

View File

@ -522,7 +522,7 @@ EntityInitBowWow::
ld a, [wIsBowWowFollowingLink] ; $4A61: $FA $56 $DB
cp BOW_WOW_KIDNAPPED ; $4A64: $FE $80
jr z, .return ; $4A66: $28 $0A
jr z, .skipUpdateSpeedX ; $4A66: $28 $0A
jp UnloadEntityAndReturn ; $4A68: $C3 $8D $3F
@ -531,7 +531,7 @@ EntityInitBowWow::
and a ; $4A6E: $A7
jp nz, UnloadEntityAndReturn ; $4A6F: $C2 $8D $3F
.return
.skipUpdateSpeedX
ret ; $4A72: $C9
EntityInitOwlEvent::
@ -662,12 +662,12 @@ EntityInitTarin::
EntityInitMadamMeowMeow::
ld a, [wIsBowWowFollowingLink] ; $4B0E: $FA $56 $DB
cp BOW_WOW_KIDNAPPED ; $4B11: $FE $80
jr nz, .return ; $4B13: $20 $05
jr nz, .skipUpdateSpeedX ; $4B13: $20 $05
ld a, MUSIC_BOWWOW_KIDNAPPED ; $4B15: $3E $0E
ld [wMusicTrackToPlay], a ; $4B17: $EA $68 $D3
.return
.skipUpdateSpeedX
ret ; $4B1A: $C9
EntityInitRaftRaftOwner::
@ -1181,13 +1181,13 @@ ENDC
ld hl, wEntitiesSpeedYTable ; $4DDF: $21 $50 $C2
add hl, bc ; $4DE2: $09
or [hl] ; $4DE3: $B6
jr nz, .return ; $4DE4: $20 $1E
jr nz, .skipUpdateSpeedX ; $4DE4: $20 $1E
call func_003_7267 ; $4DE6: $CD $67 $72
ldh a, [hActiveEntityType] ; $4DE9: $F0 $EB
cp ENTITY_GENIE ; $4DEB: $FE $5C
jr nz, .return ; $4DED: $20 $15
jr nz, .skipUpdateSpeedX ; $4DED: $20 $15
.genie2
ld hl, wEntitiesStatusTable ; $4DEF: $21 $80 $C2
@ -1201,7 +1201,7 @@ ENDC
add hl, bc ; $4E02: $09
ld [hl], b ; $4E03: $70
.return
.skipUpdateSpeedX
ret ; $4E04: $C9
Data_003_4E05::
@ -2779,7 +2779,7 @@ HeartContainerEntityHandler::
; Start of when item is picked up
dec a ; $59E8: $3D
jr nz, HoldEntityAboveLink ; $59E9: $20 $2C
jr nz, HoldEntityskipSwimUp ; $59E9: $20 $2C
ld a, MUSIC_AFTER_BOSS ; $59EB: $3E $18
ld [wMusicTrackToPlay], a ; $59ED: $EA $68 $D3
@ -2823,7 +2823,7 @@ HeartContainerEntityHandler::
; Finished setting status bits for rooms, delete this
jp UnloadEntityAndReturn
HoldEntityAboveLink::
HoldEntityskipSwimUp::
ldh a, [hLinkPositionX] ; $5A17: $F0 $98
ld hl, wEntitiesPosXTable ; $5A19: $21 $00 $C2
add hl, bc ; $5A1C: $09
@ -2879,7 +2879,7 @@ HeartPieceEntityHandler::
._08 dw HeartPieceState8Handler ; $5A6B
HeartPieceState1Handler::
call HoldEntityAboveLink ; $5A6D: $CD $17 $5A
call HoldEntityskipSwimUp ; $5A6D: $CD $17 $5A
call GetEntityTransitionCountdown ; $5A70: $CD $05 $0C
ret nz ; $5A73: $C0
@ -2905,7 +2905,7 @@ HeartPieceState4Handler::
ret ; $5A97: $C9
HeartPieceState5Handler::
call HoldEntityAboveLink ; $5A98: $CD $17 $5A
call HoldEntityskipSwimUp ; $5A98: $CD $17 $5A
ld de, HeartPieceEntitySprite ; $5A9B: $11 $4D $5A
call RenderActiveEntitySpritesPair ; $5A9E: $CD $C0 $3B
call DrawHeartPiecesInDialog ; $5AA1: $CD $2B $5B
@ -2927,7 +2927,7 @@ HeartPieceState5Handler::
ret ; $5ABA: $C9
HeartPieceState6Handler::
call HoldEntityAboveLink ; $5ABB: $CD $17 $5A
call HoldEntityskipSwimUp ; $5ABB: $CD $17 $5A
ld de, HeartPieceEntitySprite ; $5ABE: $11 $4D $5A
call RenderActiveEntitySpritesPair ; $5AC1: $CD $C0 $3B
xor a ; $5AC4: $AF
@ -2960,7 +2960,7 @@ HeartPieceState6Handler::
jp IncrementEntityState ; $5AED: $C3 $12 $3B
HeartPieceState7Handler::
call HoldEntityAboveLink ; $5AF0: $CD $17 $5A
call HoldEntityskipSwimUp ; $5AF0: $CD $17 $5A
ld de, HeartPieceEntitySprite ; $5AF3: $11 $4D $5A
call RenderActiveEntitySpritesPair ; $5AF6: $CD $C0 $3B
ld a, [wDialogState] ; $5AF9: $FA $9F $C1
@ -3120,7 +3120,7 @@ SwordShieldPickableState0Handler::
.playSwordFanfare
; Plays a heroic fanfare, when you first retrieve your sword from the beach
dec a ; $5BCB: $3D
jr nz, .holdItemAboveLink ; $5BCC: $20 $13
jr nz, .holdItemskipSwimUp ; $5BCC: $20 $13
ld a, MUSIC_OVERWORLD_INTRO ; $5BCE: $3E $31
ld [wMusicTrackToPlay], a ; $5BD0: $EA $68 $D3
@ -3131,11 +3131,11 @@ SwordShieldPickableState0Handler::
ld [hl], $52 ; $5BDC: $36 $52
call IncrementEntityState ; $5BDE: $CD $12 $3B
.holdItemAboveLink
jp HoldEntityAboveLink ; $5BE1: $C3 $17 $5A
.holdItemskipSwimUp
jp HoldEntityskipSwimUp ; $5BE1: $C3 $17 $5A
SwordShieldPickableState1Handler::
call HoldEntityAboveLink ; $5BE4: $CD $17 $5A
call HoldEntityskipSwimUp ; $5BE4: $CD $17 $5A
call GetEntityDropTimer ; $5BE7: $CD $FB $0B
ret nz ; $5BEA: $C0
@ -3161,7 +3161,7 @@ SwordShieldPickableState2Handler::
jp IncrementEntityState ; $5C0C: $C3 $12 $3B
SwordShieldPickableState3Handler::
call HoldEntityAboveLink ; $5C0F: $CD $17 $5A
call HoldEntityskipSwimUp ; $5C0F: $CD $17 $5A
ld a, LINK_ANIMATION_STATE_UNKNOWN_6B ; $5C12: $3E $6B
ldh [hLinkAnimationState], a ; $5C14: $E0 $9D
ld hl, wEntitiesPosXTable ; $5C16: $21 $00 $C2
@ -3184,7 +3184,7 @@ SwordShieldPickableState3Handler::
.continueToRaiseSword
; When the countdown reaches 26…
cp 26 ; $5C37: $FE $1A
jr nz, .return ; $5C39: $20 $0B
jr nz, .skipUpdateSpeedX ; $5C39: $20 $0B
; …activate the sword poke VFX and SFX
ldh a, [hActiveEntityPosY] ; $5C3B: $F0 $EF
sub $0C ; $5C3D: $D6 $0C
@ -3192,7 +3192,7 @@ SwordShieldPickableState3Handler::
ld a, JINGLE_SWORD_POKING ; $5C42: $3E $07
ldh [hJingle], a ; $5C44: $E0 $F2
.return
.skipUpdateSpeedX
ret ; $5C46: $C9
HookshotSpriteData::
@ -3209,18 +3209,18 @@ label_003_5C49:
jp z, label_003_60AA ; $5C59: $CA $AA $60
cp $10 ; $5C5C: $FE $10
jr nz, .jr_5C67 ; $5C5E: $20 $07
jr nz, .skipUpdateSpeedY ; $5C5E: $20 $07
dec [hl] ; $5C60: $35
call_open_dialog Dialog093 ; $5C61
xor a ; $5C66: $AF
.jr_5C67
.skipUpdateSpeedY
dec a ; $5C67: $3D
IF __OPTIMIZATIONS_3__
jp nz, HoldEntityAboveLink
jp nz, HoldEntityskipSwimUp
ELSE
jr nz, .jr_5C75 ; $5C68: $20 $0B
jr nz, .decSpeedX ; $5C68: $20 $0B
ENDC
ld d, INVENTORY_HOOKSHOT ; $5C6A: $16 $06
@ -3229,8 +3229,8 @@ ENDC
jp UnloadEntityAndReturn ; $5C72: $C3 $8D $3F
IF !__OPTIMIZATIONS_3__
.jr_5C75
jp HoldEntityAboveLink ; $5C75: $C3 $17 $5A
.decSpeedX
jp HoldEntityskipSwimUp ; $5C75: $C3 $17 $5A
ENDC
KeyDropSpriteTable:
@ -3295,7 +3295,7 @@ KeyDropPointEntityHandler::
.jr_5CCD
dec a ; $5CCD: $3D
IF __OPTIMIZATIONS_3__
jp nz, HoldEntityAboveLink
jp nz, HoldEntityskipSwimUp
jp UnloadEntityAndReturn
ELSE
jr nz, .jr_5CD3 ; $5CCE: $20 $03
@ -3303,7 +3303,7 @@ ELSE
jp UnloadEntityAndReturn ; $5CD0: $C3 $8D $3F
.jr_5CD3
jp HoldEntityAboveLink ; $5CD3: $C3 $17 $5A
jp HoldEntityskipSwimUp ; $5CD3: $C3 $17 $5A
ENDC
label_003_5CD6:
@ -3410,7 +3410,7 @@ SleepyToadstoolEntityHandler::
.jr_5D6C
dec a ; $5D6C: $3D
IF __OPTIMIZATIONS_3__
jp nz, HoldEntityAboveLink
jp nz, HoldEntityskipSwimUp
ELSE
jr nz, .jr_5D80 ; $5D6D: $20 $11
ENDC
@ -3425,7 +3425,7 @@ ENDC
IF !__OPTIMIZATIONS_3__
.jr_5D80
jp HoldEntityAboveLink ; $5D80: $C3 $17 $5A
jp HoldEntityskipSwimUp ; $5D80: $C3 $17 $5A
ENDC
; define sprite variants by selecting tile n° and setting OAM attributes (palette + flags) in a list
@ -3696,12 +3696,12 @@ ENDC
.jr_5EFE
dec a ; $5EFE: $3D
IF __OPTIMIZATIONS_1__
jp HoldEntityAboveLink
jp HoldEntityskipSwimUp
ELSE
jr nz, jr_003_5F01 ; $5EFF: $20 $00
jr_003_5F01:
jp HoldEntityAboveLink ; $5F01: $C3 $17 $5A
jp HoldEntityskipSwimUp ; $5F01: $C3 $17 $5A
ENDC
InstrumentMusicTable::
@ -3735,7 +3735,7 @@ func_003_5F0C::
ld [hl], $FF ; $5F2A: $36 $FF
.jr_5F2C
jp HoldEntityAboveLink ; $5F2C: $C3 $17 $5A
jp HoldEntityskipSwimUp ; $5F2C: $C3 $17 $5A
Data_003_5F2F::
db $0A, $FA
@ -3825,20 +3825,20 @@ func_003_5F33::
.jr_5FB9
IF !__PATCH_0__
jp HoldEntityAboveLink ; $5FB9: $C3 $17 $5A
jp HoldEntityskipSwimUp ; $5FB9: $C3 $17 $5A
ENDC
func_003_5FBC::
IF __PATCH_0__
ld a, [wObjPal1 + 1*2]
inc a
jp nz, HoldEntityAboveLink
jp nz, HoldEntityskipSwimUp
ld a, $80
ldh [hLinkPositionZ], a
ld a, $02
ldh [hLinkInteractiveMotionBlocked], a
ELSE
jp HoldEntityAboveLink ; $5FBC: $C3 $17 $5A
jp HoldEntityskipSwimUp ; $5FBC: $C3 $17 $5A
ENDC
func_003_5FBF::
@ -3935,14 +3935,14 @@ HidingSlimeKeyEntityHandler::
jr_003_604C:
dec a ; $604C: $3D
IF __OPTIMIZATIONS_3__
jp nz, HoldEntityAboveLink
jp nz, HoldEntityskipSwimUp
jp UnloadEntityAndReturn
ELSE
jr nz, .jr_6052 ; $604D: $20 $03
jp UnloadEntityAndReturn ; $604F: $C3 $8D $3F
.jr_6052
jp HoldEntityAboveLink ; $6052: $C3 $17 $5A
jp HoldEntityskipSwimUp ; $6052: $C3 $17 $5A
ENDC
Data_003_6055::
@ -4239,7 +4239,7 @@ jr_003_623B:
jr jr_003_626B ; $6241: $18 $28
jr_003_6243:
ld a, [wC157] ; $6243: $FA $57 $C1
ld a, [wScreenShakeCountdown] ; $6243: $FA $57 $C1
and a ; $6246: $A7
jr z, jr_003_629C ; $6247: $28 $53
@ -4421,7 +4421,7 @@ collectPickableItem:
._2F dw PickDroppableFairy
._30 dw PickDroppableKey
._31 dw PickSword
._32 dw MovePickupInTheAir.return
._32 dw MovePickupInTheAir.skipUpdateSpeedX
._33 dw PickPieceOfPower
._34 dw PickGuardianAcorn
._35 dw PickHeartPiece
@ -4447,13 +4447,13 @@ PickDroppableMagicPowder::
jr_003_635F:
ld a, [de] ; $635F: $1A
cp [hl] ; $6360: $BE
jr nc, .return ; $6361: $30 $04
jr nc, .skipUpdateSpeedX ; $6361: $30 $04
add $01 ; $6363: $C6 $01
daa ; $6365: $27
ld [de], a ; $6366: $12
.return
.skipUpdateSpeedX
ret ; $6367: $C9
PickSecretSeashell::
@ -4614,7 +4614,7 @@ MovePickupInTheAir::
cp $FF ; $6448: $FE $FF
jr nz, .movePickupHigher ; $644A: $20 $D6
.return::
.skipUpdateSpeedX::
ret ; $644C: $C9
PickSword::
@ -4647,7 +4647,7 @@ GiveInventoryItem:: ; @TODO GivePlayerItem or w/e - inserts item in [d] into
.checkInventorySlot: ; Check if we already have this item:
ld a, [hl+] ; Check what item is in this slot
cp d ; Is it the item we're trying to add?
jr z, .return ; If yes, return
jr z, .skipUpdateSpeedX ; If yes, return
dec e ; Otherwise, have we checked all slots?
jr nz, .checkInventorySlot ; If no, continue
@ -4669,7 +4669,7 @@ GiveInventoryItem:: ; @TODO GivePlayerItem or w/e - inserts item in [d] into
cp $0C ; If we've checked enough to get back to 0C, we're out
jr nz, .checkInventorySlotEmpty ; Otherwise, go back to check next slot
.return:
.skipUpdateSpeedX:
ret ; $648E: $C9
PickDroppableKey::
@ -5334,7 +5334,7 @@ func_003_68F8::
add hl, de ; $691B: $19
ld a, h ; $691C: $7C
cp $D7 ; $691D: $FE $D7
jp nz, .return ; $691F: $C2 $A0 $69
jp nz, .skipUpdateSpeedX ; $691F: $C2 $A0 $69
ld a, [wIsIndoor] ; $6922: $FA $A5 $DB
and a ; $6925: $A7
@ -5352,11 +5352,11 @@ func_003_68F8::
cp $5C ; $6935: $FE $5C
jr z, .jr_003_6964 ; $6937: $28 $2B
jp .return ; $6939: $C3 $A0 $69
jp .skipUpdateSpeedX ; $6939: $C3 $A0 $69
.jr_003_693C
cp $A9 ; $693C: $FE $A9
jp nz, .return ; $693E: $C2 $A0 $69
jp nz, .skipUpdateSpeedX ; $693E: $C2 $A0 $69
ld hl, wIndoorARoomStatus ; $6941: $21 $00 $D9
ldh a, [hMapRoom] ; $6944: $F0 $F6
@ -5390,7 +5390,7 @@ func_003_68F8::
ld a, ENTITY_LIFTABLE_ROCK ; $6967: $3E $05
call SpawnNewEntity ; $6969: $CD $CA $64
jr c, .return ; $696C: $38 $32
jr c, .skipUpdateSpeedX ; $696C: $38 $32
xor a ; $696E: $AF
ld [wLinkAttackStepAnimationCountdown], a ; $696F: $EA $9B $C1
@ -5424,7 +5424,7 @@ func_003_68F8::
ld b, d ; $699C: $42
call func_003_53E4 ; $699D: $CD $E4 $53
.return
.skipUpdateSpeedX
pop bc ; $69A0: $C1
ret ; $69A1: $C9
@ -5749,12 +5749,12 @@ CheckLinkCollisionWithProjectile::
; If Link is not interactive, return.
ld a, [wLinkMotionState] ; $6BDE: $FA $1C $C1
cp LINK_MOTION_TYPE_NON_INTERACTIVE ; $6BE1: $FE $02
jr nc, .return ; $6BE3: $30 $75
jr nc, .skipUpdateSpeedX ; $6BE3: $30 $75
; If Link is in the air, return.
ldh a, [hLinkPositionZ] ; $6BE5: $F0 $A2
and a ; $6BE7: $A7
jr nz, .return ; $6BE8: $20 $70
jr nz, .skipUpdateSpeedX ; $6BE8: $20 $70
; If Link is not touching the entity, return.
ld hl, hActiveEntityPosX ; $6BEA: $21 $EE $FF
@ -5762,14 +5762,14 @@ CheckLinkCollisionWithProjectile::
sub [hl] ; $6BEF: $96
add $06 ; $6BF0: $C6 $06
cp $0C ; $6BF2: $FE $0C
jr nc, .return ; $6BF4: $30 $64
jr nc, .skipUpdateSpeedX ; $6BF4: $30 $64
ld hl, hActiveEntityVisualPosY ; $6BF6: $21 $EC $FF
ldh a, [hLinkPositionY] ; $6BF9: $F0 $99
sub [hl] ; $6BFB: $96
add $06 ; $6BFC: $C6 $06
cp $0C ; $6BFE: $FE $0C
jr nc, .return ; $6C00: $30 $58
jr nc, .skipUpdateSpeedX ; $6C00: $30 $58
;
; Check shield usage
@ -5840,7 +5840,7 @@ CheckLinkCollisionWithProjectile::
add hl, bc ; $6C57: $09
ld [hl], $FF ; $6C58: $36 $FF
.return
.skipUpdateSpeedX
ret ; $6C5A: $C9
.shieldEnd
@ -5872,13 +5872,13 @@ CheckLinkCollisionWithEnemy::
; If Link is in the air, skip the collision check
ldh a, [hLinkPositionZ] ; $6C72: $F0 $A2
and a ; $6C74: $A7
jr nz, CheckLinkCollisionWithProjectile.return ; $6C75: $20 $E3
jr nz, CheckLinkCollisionWithProjectile.skipUpdateSpeedX ; $6C75: $20 $E3
.collisionEvenInTheAir
; If Link is not interactive, return.
ld a, [wLinkMotionState] ; $6C77: $FA $1C $C1
cp LINK_MOTION_TYPE_NON_INTERACTIVE ; $6C7A: $FE $02
jr nc, CheckLinkCollisionWithProjectile.return ; $6C7C: $30 $DC
jr nc, CheckLinkCollisionWithProjectile.skipUpdateSpeedX ; $6C7C: $30 $DC
push bc ; $6C7E: $C5
; c = (entity index * 4)
@ -9406,12 +9406,12 @@ GetEntityDirectionToLink_03::
jr nc, .vertical ; $7F1B: $30 $04
ldh a, [hMultiPurpose0] ; $7F1D: $F0 $D7
jr jr_003_7F23 ; $7F1F: $18 $02
jr .verticalEnd ; $7F1F: $18 $02
.vertical
ldh a, [hMultiPurpose1] ; $7F21: $F0 $D8
jr_003_7F23:
.verticalEnd
ld e, a ; $7F23: $5F
ret ; $7F24: $C9
@ -9440,7 +9440,7 @@ AddEntitySpeedToPos_03::
ld a, [hl] ; $7F36: $7E
and a ; $7F37: $A7
; No need to update the position if it's not moving
jr z, .return ; $7F38: $28 $23
jr z, .skipUpdateSpeedX ; $7F38: $28 $23
push af ; $7F3A: $F5
; Multiply speed by 16 so the carry is set if greater than $0F
@ -9473,7 +9473,7 @@ AddEntitySpeedToPos_03::
adc [hl] ; $7F5B: $8E
ld [hl], a ; $7F5C: $77
.return
.skipUpdateSpeedX
ret ; $7F5D: $C9
AddEntityZSpeedToPos_03::
@ -9481,7 +9481,7 @@ AddEntityZSpeedToPos_03::
add hl, bc ; $7F61: $09
ld a, [hl] ; $7F62: $7E
and a ; $7F63: $A7
jr z, AddEntitySpeedToPos_03.return ; $7F64: $28 $F7
jr z, AddEntitySpeedToPos_03.skipUpdateSpeedX ; $7F64: $28 $F7
push af ; $7F66: $F5
swap a ; $7F67: $CB $37
@ -9526,13 +9526,13 @@ ReturnIfNonInteractive_03::
ld a, [wRoomTransitionState] ; $7FA1: $FA $24 $C1
and a ; $7FA4: $A7
jr z, .return ; $7FA5: $28 $01
jr z, .skipUpdateSpeedX ; $7FA5: $28 $01
.skip
; pop the return address to return to caller
pop af ; $7FA7: $F1
.return
.skipUpdateSpeedX
ret ; $7FA8: $C9
; If the entity is ignoring hits, apply its recoil velocity.

View File

@ -386,7 +386,7 @@ func_036_4221::
ld a, $02 ; $423B: $3E $02
ld [wC167], a ; $423D: $EA $67 $C1
ld a, [wC157] ; $4240: $FA $57 $C1
ld a, [wScreenShakeCountdown] ; $4240: $FA $57 $C1
and a ; $4243: $A7
ret nz ; $4244: $C0
@ -4067,7 +4067,7 @@ ColorDungeonBookEntityHandler::
._05 dw func_036_5930 ; $589F
func_036_58A1::
ld a, [wC157] ; $58A1: $FA $57 $C1
ld a, [wScreenShakeCountdown] ; $58A1: $FA $57 $C1
and a ; $58A4: $A7
jr z, .ret_58B8 ; $58A5: $28 $11
@ -5079,7 +5079,7 @@ jr_036_5E81:
add hl, bc ; $5E92: $09
ld [hl], a ; $5E93: $77
ld a, $30 ; $5E94: $3E $30
ld [wC157], a ; $5E96: $EA $57 $C1
ld [wScreenShakeCountdown], a ; $5E96: $EA $57 $C1
ld a, $04 ; $5E99: $3E $04
ld [wC158], a ; $5E9B: $EA $58 $C1
call func_036_5EC2 ; $5E9E: $CD $C2 $5E

View File

@ -114,14 +114,14 @@ CheckLinkInteractionWithEntity_06::
cp $28 ; $647C: $FE $28
.label_006_647E
jr nc, .return ; $647E: $30 $44
jr nc, .skipUpdateSpeedX ; $647E: $30 $44
ldh a, [hLinkPositionX] ; $6480: $F0 $98
ld hl, hActiveEntityPosX ; $6482: $21 $EE $FF
sub [hl] ; $6485: $96
add $10 ; $6486: $C6 $10
cp $20 ; $6488: $FE $20
jr nc, .return ; $648A: $30 $38
jr nc, .skipUpdateSpeedX ; $648A: $30 $38
inc e ; $648C: $1C
ldh a, [hActiveEntityType] ; $648D: $F0 $EB
@ -134,7 +134,7 @@ CheckLinkInteractionWithEntity_06::
xor $01 ; $6499: $EE $01
cp e ; $649B: $BB
pop de ; $649C: $D1
jr nz, .return ; $649D: $20 $25
jr nz, .skipUpdateSpeedX ; $649D: $20 $25
.jr_006_649F
ld hl, wItemUsageContext ; $649F: $21 $AD $C1
@ -146,20 +146,20 @@ CheckLinkInteractionWithEntity_06::
or [hl] ; $64AE: $B6
ld hl, wDialogCooldown ; $64AF: $21 $34 $C1
or [hl] ; $64B2: $B6
jr nz, .return ; $64B3: $20 $0F
jr nz, .skipUpdateSpeedX ; $64B3: $20 $0F
ld a, [wWindowY] ; $64B5: $FA $9A $DB
cp $80 ; $64B8: $FE $80
jr nz, .return ; $64BA: $20 $08
jr nz, .skipUpdateSpeedX ; $64BA: $20 $08
ldh a, [hJoypadState] ; $64BC: $F0 $CC
and J_A ; $64BE: $E6 $10
jr z, .return ; $64C0: $28 $02
jr z, .skipUpdateSpeedX ; $64C0: $28 $02
scf ; $64C2: $37
ret ; $64C3: $C9
.return
.skipUpdateSpeedX
and a ; $64C4: $A7
ret ; $64C5: $C9
@ -195,13 +195,13 @@ ReturnIfNonInteractive_06::
ld a, [wRoomTransitionState] ; $64EF: $FA $24 $C1
and a ; $64F2: $A7
jr z, .return ; $64F3: $28 $01
jr z, .skipUpdateSpeedX ; $64F3: $28 $01
.skip
; pop the return address to return to caller
pop af ; $64F5: $F1
.return
.skipUpdateSpeedX
ret ; $64F6: $C9
; If the entity is ignoring hits, apply its recoil velocity.
@ -210,7 +210,7 @@ ApplyRecoilIfNeeded_06::
add hl, bc ; $64FA: $09
ld a, [hl] ; $64FB: $7E
and a ; $64FC: $A7
jr z, .return ; $64FD: $28 $41
jr z, .skipUpdateSpeedX ; $64FD: $28 $41
dec a ; $64FF: $3D
ld [hl], a ; $6500: $77
@ -266,7 +266,7 @@ ApplyRecoilIfNeeded_06::
ld [hl], a ; $653E: $77
pop af ; $653F: $F1
.return
.skipUpdateSpeedX
ret ; $6540: $C9
UpdateEntityPosWithSpeed_06::
@ -294,7 +294,7 @@ AddEntitySpeedToPos_06::
ld a, [hl] ; $6552: $7E
and a ; $6553: $A7
; No need to update the position if it's not moving
jr z, .return ; $6554: $28 $23
jr z, .skipUpdateSpeedX ; $6554: $28 $23
push af ; $6556: $F5
swap a ; $6557: $CB $37
@ -326,7 +326,7 @@ AddEntitySpeedToPos_06::
adc [hl] ; $6577: $8E
ld [hl], a ; $6578: $77
.return
.skipUpdateSpeedX
ret ; $6579: $C9
AddEntityZSpeedToPos_06::
@ -334,7 +334,7 @@ AddEntityZSpeedToPos_06::
add hl, bc ; $657D: $09
ld a, [hl] ; $657E: $7E
and a ; $657F: $A7
jr z, AddEntitySpeedToPos_06.return ; $6580: $28 $F7
jr z, AddEntitySpeedToPos_06.skipUpdateSpeedX ; $6580: $28 $F7
push af ; $6582: $F5
swap a ; $6583: $CB $37
@ -423,12 +423,12 @@ GetEntityDirectionToLink_06::
jr nc, .vertical ; $65D1: $30 $04
ldh a, [hMultiPurpose0] ; $65D3: $F0 $D7
jr jr_006_65D9 ; $65D5: $18 $02
jr .verticalEnd ; $65D5: $18 $02
.vertical
ldh a, [hMultiPurpose1] ; $65D7: $F0 $D8
jr_006_65D9:
.verticalEnd
ld e, a ; $65D9: $5F
ret ; $65DA: $C9

View File

@ -131,7 +131,7 @@ jr_007_7D4E:
jr z, .jr_7D6F ; $7D61: $28 $0C
push de ; $7D63: $D5
call func_007_7E7D ; $7D64: $CD $7D $7E
call GetEntityDirectionToLink_07 ; $7D64: $CD $7D $7E
ldh a, [hLinkDirection] ; $7D67: $F0 $9E
xor $01 ; $7D69: $EE $01
cp e ; $7D6B: $BB
@ -341,72 +341,89 @@ AddEntityZSpeedToPos_07::
rl d ; $7E56: $CB $12
ld hl, wEntitiesPosZTable ; $7E58: $21 $10 $C3
jr AddEntitySpeedToPos_07.updatePosition ; $7E5B: $18 $D2
EntityLinkPositionXDifference_07::
; Inputs:
; bc entity index
;
; Outputs:
; d x distance (Link's position - entity's position)
; e 0x01 if Link is to the left of the entity, 0x00 otherwise
GetEntityXDistanceToLink_07::
ld e, $00 ; $7E5D: $1E $00
ldh a, [hLinkPositionX] ; $7E5F: $F0 $98
ld hl, wEntitiesPosXTable ; $7E61: $21 $00 $C2
add hl, bc ; $7E64: $09
sub [hl] ; $7E65: $96
bit 7, a ; $7E66: $CB $7F
jr z, .jr_7E6B ; $7E68: $28 $01
jr z, .positive ; $7E68: $28 $01
inc e ; $7E6A: $1C
.jr_7E6B
.positive
ld d, a ; $7E6B: $57
ret ; $7E6C: $C9
EntityLinkPositionYDifference_07::
; Inputs:
; bc entity index
;
; Outputs:
; d y distance (Link's position - entity's position)
; e 0x02 if Link is above the entity, 0x03 otherwise
GetEntityYDistanceToLink_07::
ld e, $02 ; $7E6D: $1E $02
ldh a, [hLinkPositionY] ; $7E6F: $F0 $99
ld hl, wEntitiesPosYTable ; $7E71: $21 $10 $C2
add hl, bc ; $7E74: $09
sub [hl] ; $7E75: $96
bit 7, a ; $7E76: $CB $7F
jr nz, .jr_7E7B ; $7E78: $20 $01
jr nz, .negative ; $7E78: $20 $01
inc e ; $7E7A: $1C
.jr_7E7B
.negative
ld d, a ; $7E7B: $57
ret ; $7E7C: $C9
func_007_7E7D::
call EntityLinkPositionXDifference_07 ; $7E7D: $CD $5D $7E
; Inputs:
; bc entity index
;
; Outputs:
; e entity's direction to Link (0 = right, 1 = left, 2 = up, 3 = down)
GetEntityDirectionToLink_07::
call GetEntityXDistanceToLink_07 ; $7E7D: $CD $5D $7E
ld a, e ; $7E80: $7B
ldh [hMultiPurpose0], a ; $7E81: $E0 $D7
ld a, d ; $7E83: $7A
bit 7, a ; $7E84: $CB $7F
jr z, .jr_7E8A ; $7E86: $28 $02
jr z, .positiveX ; $7E86: $28 $02
cpl ; $7E88: $2F
inc a ; $7E89: $3C
.jr_7E8A
.positiveX
push af ; $7E8A: $F5
call EntityLinkPositionYDifference_07 ; $7E8B: $CD $6D $7E
call GetEntityYDistanceToLink_07 ; $7E8B: $CD $6D $7E
ld a, e ; $7E8E: $7B
ldh [hMultiPurpose1], a ; $7E8F: $E0 $D8
ld a, d ; $7E91: $7A
bit 7, a ; $7E92: $CB $7F
jr z, .jr_7E98 ; $7E94: $28 $02
jr z, .positiveY ; $7E94: $28 $02
cpl ; $7E96: $2F
inc a ; $7E97: $3C
.jr_7E98
.positiveY
pop de ; $7E98: $D1
cp d ; $7E99: $BA
jr nc, .jr_7EA0 ; $7E9A: $30 $04
jr nc, .vertical ; $7E9A: $30 $04
ldh a, [hMultiPurpose0] ; $7E9C: $F0 $D7
jr jr_007_7EA2 ; $7E9E: $18 $02
jr .verticalEnd ; $7E9E: $18 $02
.jr_7EA0
.vertical
ldh a, [hMultiPurpose1] ; $7EA0: $F0 $D8
jr_007_7EA2:
.verticalEnd
ld e, a ; $7EA2: $5F
ret ; $7EA3: $C9

View File

@ -51,7 +51,7 @@ CheckItemsToUse::
.swordShieldEnd
ld a, [wC117] ; $11C3: $FA $17 $C1
ld a, [wIsGelClingingToLink] ; $11C3: $FA $17 $C1
and a ; $11C6: $A7
jp nz, UseItem.return ; $11C7: $C2 $ED $12
; if Link does carry something, exit

View File

@ -35,7 +35,7 @@ CreateFollowingNpcEntity_trampoline::
ld a, $02 ; $3960: $3E $02
jp SwitchBank ; $3962: $C3 $0C $08
label_3965::
ConfigureNewEntity_trampoline::
callsb ConfigureNewEntity ; $3965: $3E $03 $EA $00 $21 $CD $5B $48
jp ReloadSavedBank ; $396D: $C3 $1D $08
@ -342,6 +342,8 @@ SetEntitySpriteVariant::
; Increment the state attribute of the given entity
; Input:
; bc entity index
; Output:
; hl address of the state for this entity
IncrementEntityState::
ld hl, wEntitiesStateTable ; $3B12: $21 $90 $C2
add hl, bc ; $3B15: $09

View File

@ -149,8 +149,11 @@ wC115:
wC116:
ds 1 ; C116
; Unlabeled
wC117:
; Whether there are Gels clinging to Link
; Possible values:
; 0 = false
; 1 = true
wIsGelClingingToLink:
ds 1 ; C117
; Unlabeled
@ -457,8 +460,8 @@ wScreenShakeHorizontal::
wScreenShakeVertical::
ds 1 ; C156
; Unlabeled
wC157::
; While not zero, the screen shakes
wScreenShakeCountdown::
ds 1 ; C157
; Unlabeled
@ -810,8 +813,9 @@ wC1AC::
wItemUsageContext::
ds 1 ; C1AD
; Unlabeled
wC1AE::
; Number of regular Zols animated so far on this frame.
; Used by Slime Eye to know the number of Zols on screen.
wZolCount::
ds 2 ; C1AE - C1AF
; Unlabeled
@ -1063,6 +1067,7 @@ wEntitiesCollisionsTable::
; - Genie: store the substate
; - LikeLike: swallowed item
; - Keese: speed table index
; - Smashable pillar: 0 = pillar, 1 = dust, 2 = debris
wEntitiesPrivateState1Table::
ds $10 ; C2B0 - C2BF