entities: document GetEntityDirectionToLink_05

This commit is contained in:
Pierre de La Morinerie 2024-10-29 13:20:10 +01:00
parent d785f626c0
commit 021ec5b3e6
6 changed files with 25 additions and 20 deletions

View File

@ -93,7 +93,7 @@ FacadeDeathState0::
dec e ;; 04:50D5 $1D
ld a, e ;; 04:50D6 $7B
cp $FF ;; 04:50D7 $FE $FF
jr nz, .jr_50AD ;; 04:50D9 $20 $D2
jr nz, .jr_50AD ;; 04:50D9 $20 $D2
jr_004_50DB:
ld hl, wEntitiesPrivateState4Table ;; 04:50DB $21 $40 $C4

View File

@ -219,41 +219,46 @@ GetEntityToLinkPositionDeltaY_05::
ld d, a ;; 05:7B22 $57
ret ;; 05:7B23 $C9
func_005_7B24::
; Inputs:
; bc entity index
;
; Outputs:
; e entity's direction to Link (see DIRECTION_* constants for possible values)
GetEntityDirectionToLink_05::
call GetEntityToLinkPositionDeltaX_05 ;; 05:7B24 $CD $04 $7B
ld a, e ;; 05:7B27 $7B
ldh [hMultiPurpose0], a ;; 05:7B28 $E0 $D7
ld a, d ;; 05:7B2A $7A
bit 7, a ;; 05:7B2B $CB $7F
jr z, .jr_7B31 ;; 05:7B2D $28 $02
jr z, .positiveX ;; 05:7B2D $28 $02
cpl ;; 05:7B2F $2F
inc a ;; 05:7B30 $3C
.jr_7B31
.positiveX
push af ;; 05:7B31 $F5
call GetEntityToLinkPositionDeltaY_05 ;; 05:7B32 $CD $14 $7B
ld a, e ;; 05:7B35 $7B
ldh [hMultiPurpose1], a ;; 05:7B36 $E0 $D8
ld a, d ;; 05:7B38 $7A
bit 7, a ;; 05:7B39 $CB $7F
jr z, .jr_7B3F ;; 05:7B3B $28 $02
jr z, .positiveY ;; 05:7B3B $28 $02
cpl ;; 05:7B3D $2F
inc a ;; 05:7B3E $3C
.jr_7B3F
.positiveY
pop de ;; 05:7B3F $D1
cp d ;; 05:7B40 $BA
jr nc, .jr_7B47 ;; 05:7B41 $30 $04
jr nc, .vertical ;; 05:7B41 $30 $04
ldh a, [hMultiPurpose0] ;; 05:7B43 $F0 $D7
jr jr_005_7B49 ;; 05:7B45 $18 $02
jr .verticalEnd ;; 05:7B45 $18 $02
.jr_7B47
.vertical
ldh a, [hMultiPurpose1] ;; 05:7B47 $F0 $D8
jr_005_7B49:
.verticalEnd
ld e, a ;; 05:7B49 $5F
ret ;; 05:7B4A $C9

View File

@ -228,7 +228,7 @@ func_005_6957::
ld [hl], a ;; 05:6970 $77
jr nz, jr_005_6978 ;; 05:6971 $20 $05
call func_005_7B24 ;; 05:6973 $CD $24 $7B
call GetEntityDirectionToLink_05 ;; 05:6973 $CD $24 $7B
jr jr_005_697E ;; 05:6976 $18 $06
jr_005_6978:

View File

@ -134,7 +134,7 @@ MarinEntityHandler::
cp $28 ;; 05:4EC5 $FE $28
jr nc, .jr_4ED1 ;; 05:4EC7 $30 $08
call func_005_7B24 ;; 05:4EC9 $CD $24 $7B
call GetEntityDirectionToLink_05 ;; 05:4EC9 $CD $24 $7B
ld hl, wEntitiesDirectionTable ;; 05:4ECC $21 $80 $C3
add hl, bc ;; 05:4ECF $09
ld [hl], e ;; 05:4ED0 $73
@ -438,7 +438,7 @@ func_005_5059::
jp IncrementEntityState ;; 05:5087 $C3 $12 $3B
.jr_508A
call func_005_7B24 ;; 05:508A $CD $24 $7B
call GetEntityDirectionToLink_05 ;; 05:508A $CD $24 $7B
ld a, e ;; 05:508D $7B
xor $01 ;; 05:508E $EE $01
ldh [hLinkDirection], a ;; 05:5090 $E0 $9E
@ -715,7 +715,7 @@ MarinEntityHandler_Indoor::
and $1F ;; 05:5239 $E6 $1F
jr nz, .jr_5245 ;; 05:523B $20 $08
call func_005_7B24 ;; 05:523D $CD $24 $7B
call GetEntityDirectionToLink_05 ;; 05:523D $CD $24 $7B
ld hl, wEntitiesDirectionTable ;; 05:5240 $21 $80 $C3
add hl, bc ;; 05:5243 $09
ld [hl], e ;; 05:5244 $73

View File

@ -35,7 +35,7 @@ EntityRaftOwnerHandler::
and $1F ;; 05:5366 $E6 $1F
jr nz, .jr_5372 ;; 05:5368 $20 $08
call func_005_7B24 ;; 05:536A $CD $24 $7B
call GetEntityDirectionToLink_05 ;; 05:536A $CD $24 $7B
ld hl, wEntitiesDirectionTable ;; 05:536D $21 $80 $C3
add hl, bc ;; 05:5370 $09
ld [hl], e ;; 05:5371 $73
@ -369,7 +369,7 @@ ShouldLinkTalkToEntity_05::
jr z, .bowWowEnd ;; 05:5536 $28 $0C
push de ;; 05:5538 $D5
call func_005_7B24 ;; 05:5539 $CD $24 $7B
call GetEntityDirectionToLink_05 ;; 05:5539 $CD $24 $7B
ldh a, [hLinkDirection] ;; 05:553C $F0 $9E
xor $01 ;; 05:553E $EE $01
cp e ;; 05:5540 $BB

View File

@ -193,7 +193,7 @@ func_005_4A17::
xor a ;; 05:4A1B $AF
ld [wLinkAttackStepAnimationCountdown], a ;; 05:4A1C $EA $9B $C1
call func_005_7B24 ;; 05:4A1F $CD $24 $7B
call GetEntityDirectionToLink_05 ;; 05:4A1F $CD $24 $7B
ld a, e ;; 05:4A22 $7B
xor $01 ;; 05:4A23 $EE $01
ldh [hLinkDirection], a ;; 05:4A25 $E0 $9E
@ -428,7 +428,7 @@ func_005_4B41::
call label_27DD ;; 05:4B5E $CD $DD $27
call GetEntityTransitionCountdown ;; 05:4B61 $CD $05 $0C
ld [hl], $40 ;; 05:4B64 $36 $40
call func_005_7B24 ;; 05:4B66 $CD $24 $7B
call GetEntityDirectionToLink_05 ;; 05:4B66 $CD $24 $7B
add $08 ;; 05:4B69 $C6 $08
call SetEntitySpriteVariant ;; 05:4B6B $CD $0C $3B
call GetEntityToLinkPositionDeltaX_05 ;; 05:4B6E $CD $04 $7B
@ -468,7 +468,7 @@ func_005_4B89::
and $1F ;; 05:4B9F $E6 $1F
jr nz, .jr_4BAB ;; 05:4BA1 $20 $08
call func_005_7B24 ;; 05:4BA3 $CD $24 $7B
call GetEntityDirectionToLink_05 ;; 05:4BA3 $CD $24 $7B
add $08 ;; 05:4BA6 $C6 $08
call SetEntitySpriteVariant ;; 05:4BA8 $CD $0C $3B
@ -583,7 +583,7 @@ jr_005_4C43:
and $1F ;; 05:4C48 $E6 $1F
jr nz, .jr_4C54 ;; 05:4C4A $20 $08
call func_005_7B24 ;; 05:4C4C $CD $24 $7B
call GetEntityDirectionToLink_05 ;; 05:4C4C $CD $24 $7B
ld hl, wEntitiesSpriteVariantTable ;; 05:4C4F $21 $B0 $C3
add hl, bc ;; 05:4C52 $09
ld [hl], e ;; 05:4C53 $73