Prevent double lock.

This commit is contained in:
Randy Thiemann 2023-10-24 10:59:02 +02:00
parent f7647fe183
commit 93e6d7946f
5 changed files with 49 additions and 8 deletions

Binary file not shown.

View File

@ -1348,6 +1348,13 @@ FieldProcess::
ldh a, [hDownState]
cp a, 0
jr z, .dontforcelock
ldh a, [hCurrentGravityPerTick]
cp a, 20
jr nz, .forcelock
ldh a, [hDownState]
cp a, 1
jr nz, .dontforcelock
; Set the lock delay to 0 and save it.
.forcelock
@ -1396,16 +1403,20 @@ FieldProcess::
; If the piece is locked, skip the ghost piece.
ldh a, [hCurrentLockDelayRemaining]
cp a, 0
jr z, :+
jr z, .postghost
; If the gravity is <= 1G, draw a ghost piece.
ldh a, [hWantedG]
cp a, 1
jr nz, :+
jr nz, .postghost
ld a, [wInitialA]
cp a, $11
jr z, .ghost
ldh a, [hEvenFrame]
cp a, 1
jr nz, :+
.ghost
ldh a, [hYPosAtStartOfFrame]
ld b, a
ldh a, [hActualG]
@ -1425,7 +1436,8 @@ FieldProcess::
call DrawPiece
; If the lock delay is at the highest value, draw the piece normally.
: ldh a, [hCurrentPiece]
.postghost
ldh a, [hCurrentPiece]
ld b, TILE_PIECE_0
add a, b
ldh [hWantedTile], a

View File

@ -64,7 +64,7 @@ ToATTR::
ldh [rHDMA3], a
ld a, LOW($9800)
ldh [rHDMA4], a
ld a, 39
ld a, 40
ldh [rHDMA5], a
ld a, 0
ldh [rVBK], a
@ -83,7 +83,7 @@ ToVRAM::
ldh [rHDMA3], a
ld a, LOW($9800)
ldh [rHDMA4], a
ld a, 39
ld a, 40
ldh [rHDMA5], a
@ -734,9 +734,38 @@ GBCGameplayProcess::
cp a, $11
ret nz
; 20G?
ldh a, [hCurrentGravityPerTick]
cp a, 20
jr nz, :+
ld a, $00
ld d, a
ld hl, wShadowTileAttrs
ld bc, 32-12
ld a, 21
ld [wOuterReps], a
.outer0
ld a, 12
ld [wInnerReps], a
.inner0
ld [hl], d
inc hl
ld a, [wInnerReps]
dec a
ld [wInnerReps], a
jr nz, .inner0
add hl, bc
ld a, [wOuterReps]
dec a
ld [wOuterReps], a
jr nz, .outer0
; What to copy
ld de, wField + 40
: ld de, wField + 40
; Where to put it
ld hl, wShadowTilemap + 1
; How much to increment hl after each row

Binary file not shown.

View File

@ -530,8 +530,8 @@ Tiles::
DB $4A,$4A,$4A,$4A,$E4,$E4,$00,$00
DB $CA,$CA,$2A,$2A,$2A,$2A,$4E,$4E
DB $82,$82,$82,$82,$E2,$E2,$00,$00
DB $04,$04,$0A,$0A,$0A,$0A,$0E,$0E
DB $0A,$0A,$0A,$0A,$0A,$0A,$00,$00
DB $0C,$0C,$0A,$0A,$0A,$0A,$0C,$0C
DB $0A,$0A,$0A,$0A,$0C,$0C,$00,$00
TilesEnd::