Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Documenting moving blocks, including the two unused ones #583

Merged
merged 3 commits into from
Aug 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions src/code/bank0.asm
Original file line number Diff line number Diff line change
Expand Up @@ -3434,10 +3434,10 @@ SwordAreaYForDirection::

; Array of constants for Link animation state
LinkDirectionToLinkAnimationState_2::
.right: db LINK_ANIMATION_STATE_UNKNOWN_36
.left: db LINK_ANIMATION_STATE_UNKNOWN_38
.up: db LINK_ANIMATION_STATE_UNKNOWN_3A
.down: db LINK_ANIMATION_STATE_UNKNOWN_3C ;; 00:1F51
.right: db LINK_ANIMATION_STATE_GRABBING_RIGHT
.left: db LINK_ANIMATION_STATE_GRABBING_LEFT
.up: db LINK_ANIMATION_STATE_GRABBING_UP
.down: db LINK_ANIMATION_STATE_GRABBING_DOWN ;; 00:1F51

LinkDirectionToLiftDirectionButton::
db 2, 1, 8, 4 ;; 00:1F55
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
; define sprite variants by selecting tile n° and setting OAM attributes (palette + flags) in a list
Entity8CSpriteVariants::
RaisableBlockSpriteVariants::
db $F8, OAM_GBC_PAL_0 | OAMF_PAL1
db $FA, OAM_GBC_PAL_0 | OAMF_PAL1

Entity8CHandler::
RaisableBlockShiftedRightEntityHandler::
ldh a, [hActiveEntityState] ;; 06:4EA1 $F0 $F0
and a ;; 06:4EA3 $A7
jr nz, .update ;; 06:4EA4 $20 $11
Expand All @@ -21,28 +21,28 @@ Entity8CHandler::
ld hl, wEntitiesPosZTable ;; 06:4EAE $21 $10 $C3
add hl, bc ;; 06:4EB1 $09
ld [hl], $10 ;; 06:4EB2 $36 $10
; Done
jp IncrementEntityState ;; 06:4EB4 $C3 $12 $3B

.update
ld de, Entity8CSpriteVariants ;; 06:4EB7 $11 $9D $4E
ld de, RaisableBlockSpriteVariants ;; 06:4EB7 $11 $9D $4E
call RenderActiveEntitySpritesPair ;; 06:4EBA $CD $C0 $3B

call ReturnIfNonInteractive_06 ;; 06:4EBD $CD $C6 $64

ldh a, [hMovingBlockMoverState] ;; 06:4EC0 $F0 $BA
cp $02 ;; 06:4EC2 $FE $02
jr z, .movingBlockMoverRetracting ;; 06:4EC4 $28 $2C
jr z, .shoveLink ;; 06:4EC4 $28 $2C

and a ;; 06:4EC6 $A7
jr z, .jr_006_4EE3 ;; 06:4EC7 $28 $1A
jr z, .moverNotGrabbed ;; 06:4EC7 $28 $1A

; If the moving block mover is being pulled, raise the block into the air
ld hl, wEntitiesInertiaTable ;; 06:4EC9 $21 $D0 $C3
add hl, bc ;; 06:4ECC $09
inc [hl] ;; 06:4ECD $34
ld a, [hl] ;; 06:4ECE $7E
cp $0A ;; 06:4ECF $FE $0A
jr nz, .ret_4EE2 ;; 06:4ED1 $20 $0F
jr nz, .return ;; 06:4ED1 $20 $0F

ld [hl], b ;; 06:4ED3 $70

Expand All @@ -53,34 +53,33 @@ Entity8CHandler::
add hl, bc ;; 06:4EDB $09
ld a, [hl] ;; 06:4EDC $7E
cp $20 ;; 06:4EDD $FE $20
jr nc, .ret_4EE2 ;; 06:4EDF $30 $01
jr nc, .return ;; 06:4EDF $30 $01

inc [hl] ;; 06:4EE1 $34

.ret_4EE2
.return
ret ;; 06:4EE2 $C9

.jr_006_4EE3
.moverNotGrabbed
ld hl, wEntitiesPosZTable ;; 06:4EE3 $21 $10 $C3
add hl, bc ;; 06:4EE6 $09
ld a, [hl] ;; 06:4EE7 $7E
and a ;; 06:4EE8 $A7
jr z, jr_006_4F0E ;; 06:4EE9 $28 $23

.jr_4EEB
jr z, .onGround ;; 06:4EE9 $28 $23
; If the moving block mover isn't grabbed, and the block is in the air, fall slowly
ldh a, [hFrameCounter] ;; 06:4EEB $F0 $E7

.jr_4EED
and $0F ;; 06:4EED $E6 $0F
jr nz, .movingBlockMoverRetracting ;; 06:4EEF $20 $01
jr nz, .shoveLink ;; 06:4EEF $20 $01

dec [hl] ;; 06:4EF1 $35

.movingBlockMoverRetracting
.shoveLink
ld a, [hl] ;; 06:4EF2 $7E
cp $04 ;; 06:4EF3 $FE $04
jr nc, .ret_4F0D ;; 06:4EF5 $30 $16
jr nc, .shoveLinkEnd ;; 06:4EF5 $30 $16

; If the block hits Link while falling, shove him away
call CheckLinkCollisionWithEnemy_trampoline ;; 06:4EF7 $CD $5A $3B
ret nc ;; 06:4EFA $D0

Expand All @@ -93,25 +92,30 @@ Entity8CHandler::
ldh a, [hMultiPurpose1] ;; 06:4F09 $F0 $D8
ldh [hLinkSpeedX], a ;; 06:4F0B $E0 $9A

.ret_4F0D
.shoveLinkEnd
ret ;; 06:4F0D $C9

jr_006_4F0E:
.onGround
call CheckLinkCollisionWithEnemy_trampoline ;; 06:4F0E $CD $5A $3B
ret nc ;; 06:4F11 $D0

jp label_006_641F ;; 06:4F12 $C3 $1F $64
jp PushLinkOutOfEntity_06.forcePush ;; 06:4F12 $C3 $1F $64

Entity8DHandler::
RaisableBlockShiftedDownEntityHandler::
ldh a, [hActiveEntityState] ;; 06:4F15 $F0 $F0
and a ;; 06:4F17 $A7
jp nz, Entity8CHandler.update ;; 06:4F18 $C2 $B7 $4E
jp nz, RaisableBlockShiftedRightEntityHandler.update ; 06:4F18 $C2 $B7 $4E

; Init
; (hActiveEntityState == 0)

; wEntitiesPosYTable += 8
ld hl, wEntitiesPosYTable ;; 06:4F1B $21 $10 $C2
add hl, bc ;; 06:4F1E $09
ld a, [hl] ;; 06:4F1F $7E
add $08 ;; 06:4F20 $C6 $08
ld [hl], a ;; 06:4F22 $77
; wEntitiesPosZTable += 10
ld hl, wEntitiesPosZTable ;; 06:4F23 $21 $10 $C3
add hl, bc ;; 06:4F26 $09
ld [hl], $10 ;; 06:4F27 $36 $10
Expand Down
12 changes: 6 additions & 6 deletions src/code/entities/06_zol.asm
Original file line number Diff line number Diff line change
Expand Up @@ -31,16 +31,16 @@ GelEntityHandler::
call RenderActiveEntitySprite ;; 06:7C04 $CD $77 $3C
jr AnimateZolGel ;; 06:7C07 $18 $25

; Zols spawned by Slime Eye are green instead of red
ZolSlimeEyeSpriteVariants::
ZolSpriteVariants::
.variant0
db $52, OAM_GBC_PAL_2 | OAMF_PAL0
db $52, OAM_GBC_PAL_2 | OAMF_PAL0 | OAMF_XFLIP
.variant1
db $54, OAM_GBC_PAL_2 | OAMF_PAL0
db $54, OAM_GBC_PAL_2 | OAMF_PAL0 | OAMF_XFLIP

ZolSpriteVariants::
; Zols spawned by Slime Eye are green instead of red
ZolSlimeEyeSpriteVariants::
.variant0
db $52, OAM_GBC_PAL_0 | OAMF_PAL0
db $52, OAM_GBC_PAL_0 | OAMF_PAL0 | OAMF_XFLIP
Expand All @@ -50,15 +50,15 @@ ZolSpriteVariants::

ZolEntityHandler::
call ZolGelMakeInvisibleBeforeMagnifyingLens ;; 06:7C19 $CD $E2 $7B
ld de, ZolSlimeEyeSpriteVariants ;; 06:7C1C $11 $09 $7C
ld de, ZolSpriteVariants ;; 06:7C1C $11 $09 $7C
ld hl, wEntitiesHealthTable ;; 06:7C1F $21 $60 $C3
add hl, bc ;; 06:7C22 $09
ld a, [hl] ;; 06:7C23 $7E
and $02 ;; 06:7C24 $E6 $02
jr nz, .render ;; 06:7C26 $20 $03

; load different sprite variants, when health bit 2 is set
ld de, ZolSpriteVariants ;; 06:7C28 $11 $11 $7C
; load different sprite variants, when health bit 2 is not set
ld de, ZolSlimeEyeSpriteVariants ;; 06:7C28 $11 $11 $7C

.render:
call RenderActiveEntitySpritesPair ;; 06:7C2B $CD $C0 $3B
Expand Down
7 changes: 4 additions & 3 deletions src/code/entities/07_blooper.asm
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,9 @@ BlooperEntityHandler::
add hl, bc ;; 07:5C11 $09
ld a, [hl] ;; 07:5C12 $7E
and a ;; 07:5C13 $A7
jr nz, .jr_5C2A ;; 07:5C14 $20 $14

jr nz, .underwater ;; 07:5C14 $20 $14

; If moving would put the Blooper out of the water, undo the movement
ld hl, wEntitiesPrivateCountdown3Table ;; 07:5C16 $21 $80 $C4
add hl, bc ;; 07:5C19 $09
ld [hl], $10 ;; 07:5C1A $36 $10
Expand All @@ -33,7 +34,7 @@ BlooperEntityHandler::
add hl, bc ;; 07:5C28 $09
ld [hl], a ;; 07:5C29 $77

.jr_5C2A
.underwater
xor a ;; 07:5C2A $AF
call SetEntitySpriteVariant ;; 07:5C2B $CD $0C $3B
ldh a, [hActiveEntityState] ;; 07:5C2E $F0 $F0
Expand Down
4 changes: 2 additions & 2 deletions src/code/entities/15_beetle_spawner.asm
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@ BeetleSpawnerEntityHandler::
jp nz, BeetleSpawnerBeetleHandler ;; 15:7513 $C2 $7F $75

call ReturnIfNonInteractive_15 ;; 15:7516 $CD $0D $7B
call GetEntityToLinkPositionDeltaX_15 ;; 15:7519 $CD $DB $7B
call GetEntityXDistanceToLink_15 ;; 15:7519 $CD $DB $7B
add $20 ;; 15:751C $C6 $20
cp $40 ;; 15:751E $FE $40
jr nc, .ret_756E ;; 15:7520 $30 $4C

call GetEntityToLinkPositionDeltaY_15 ;; 15:7522 $CD $EB $7B
call GetEntityRealYDistanceToLink_15 ;; 15:7522 $CD $EB $7B
add $20 ;; 15:7525 $C6 $20
cp $40 ;; 15:7527 $FE $40
jr nc, .ret_756E ;; 15:7529 $30 $43
Expand Down
4 changes: 2 additions & 2 deletions src/code/entities/15_dream_shrine_bed.asm
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@ DreamShrineBedEntityHandler::

; Dream Shrine transition sequence?
func_015_7D01::
call GetEntityToLinkPositionDeltaX_15 ;; 15:7D02 $DB
call GetEntityXDistanceToLink_15 ;; 15:7D02 $DB
add $0E ;; 15:7D04 $C6 $0E
cp $1C ;; 15:7D06 $FE $1C
jr nc, .ret_7D4F ;; 15:7D08 $30 $45

call GetEntityToLinkPositionDeltaY_15 ;; 15:7D0A $CD $EB $7B
call GetEntityRealYDistanceToLink_15 ;; 15:7D0A $CD $EB $7B
add $0C ;; 15:7D0D $C6 $0C
cp $18 ;; 15:7D0F $FE $18
jr nc, .ret_7D4F ;; 15:7D11 $30 $3C
Expand Down
4 changes: 2 additions & 2 deletions src/code/entities/15_final_nightmare.asm
Original file line number Diff line number Diff line change
Expand Up @@ -1061,7 +1061,7 @@ func_015_580B::
jp IncrementEntityState ;; 15:5816 $C3 $12 $3B

func_015_5819::
call func_015_7C0A ;; 15:5819 $CD $0A $7C
call GetEntityDirectionToLink_15 ;; 15:5819 $CD $0A $7C
ld a, e ;; 15:581C $7B
ld [wD21E], a ;; 15:581D $EA $1E $D2
ld d, b ;; 15:5820 $50
Expand Down Expand Up @@ -2622,7 +2622,7 @@ func_015_6553::
jp IncrementEntityState ;; 15:655A $C3 $12 $3B

func_015_655D::
call GetEntityToLinkPositionDeltaX_15 ;; 15:655D $CD $DB $7B
call GetEntityXDistanceToLink_15 ;; 15:655D $CD $DB $7B
ld a, e ;; 15:6560 $7B
ld [wD21E], a ;; 15:6561 $EA $1E $D2
ret ;; 15:6564 $C9
Expand Down
4 changes: 2 additions & 2 deletions src/code/entities/15_moblin_king.asm
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ func_015_4734::
call IncrementEntityState ;; 15:4740 $CD $12 $3B

func_015_4743::
call GetEntityToLinkPositionDeltaX_15 ;; 15:4743 $CD $DB $7B
call GetEntityXDistanceToLink_15 ;; 15:4743 $CD $DB $7B
ld a, e ;; 15:4746 $7B
ld [wD227], a ;; 15:4747 $EA $27 $D2
ld hl, wEntitiesDirectionTable ;; 15:474A $21 $80 $C3
Expand Down Expand Up @@ -207,7 +207,7 @@ jr_015_47E3:

ldh a, [hLinkPositionX] ;; 15:47F8 $F0 $98
push af ;; 15:47FA $F5
call GetEntityToLinkPositionDeltaX_15 ;; 15:47FB $CD $DB $7B
call GetEntityXDistanceToLink_15 ;; 15:47FB $CD $DB $7B
ld d, b ;; 15:47FE $50
ld hl, Data_015_477E ;; 15:47FF $21 $7E $47
add hl, de ;; 15:4802 $19
Expand Down
Loading