Compare commits

..

2 Commits

Author SHA1 Message Date
Randy Thiemann 93e6d7946f Prevent double lock. 2023-10-24 10:59:02 +02:00
Randy Thiemann f7647fe183 Prevent 20G double locks. 2023-10-24 10:45:06 +02:00
6 changed files with 50 additions and 10 deletions

3
.vscode/launch.json vendored
View File

@ -8,8 +8,7 @@
"type": "emulicious-debugger", "type": "emulicious-debugger",
"request": "launch", "request": "launch",
"name": "Launch in Emulicious", "name": "Launch in Emulicious",
"emuliciousPath": "${workspaceFolder}\\tools", "program": "${workspaceFolder}\\bin\\DMGTRIS.gbc",
"program": "${workspaceFolder}\\bin\\out.gb",
"port": 58870, "port": 58870,
"stopOnEntry": false, "stopOnEntry": false,
"preLaunchTask": "buildrom" "preLaunchTask": "buildrom"

Binary file not shown.

View File

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

View File

@ -64,7 +64,7 @@ ToATTR::
ldh [rHDMA3], a ldh [rHDMA3], a
ld a, LOW($9800) ld a, LOW($9800)
ldh [rHDMA4], a ldh [rHDMA4], a
ld a, 39 ld a, 40
ldh [rHDMA5], a ldh [rHDMA5], a
ld a, 0 ld a, 0
ldh [rVBK], a ldh [rVBK], a
@ -83,7 +83,7 @@ ToVRAM::
ldh [rHDMA3], a ldh [rHDMA3], a
ld a, LOW($9800) ld a, LOW($9800)
ldh [rHDMA4], a ldh [rHDMA4], a
ld a, 39 ld a, 40
ldh [rHDMA5], a ldh [rHDMA5], a
@ -734,9 +734,38 @@ GBCGameplayProcess::
cp a, $11 cp a, $11
ret nz 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 ; What to copy
ld de, wField + 40 : ld de, wField + 40
; Where to put it ; Where to put it
ld hl, wShadowTilemap + 1 ld hl, wShadowTilemap + 1
; How much to increment hl after each row ; 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 $4A,$4A,$4A,$4A,$E4,$E4,$00,$00
DB $CA,$CA,$2A,$2A,$2A,$2A,$4E,$4E DB $CA,$CA,$2A,$2A,$2A,$2A,$4E,$4E
DB $82,$82,$82,$82,$E2,$E2,$00,$00 DB $82,$82,$82,$82,$E2,$E2,$00,$00
DB $04,$04,$0A,$0A,$0A,$0A,$0E,$0E DB $0C,$0C,$0A,$0A,$0A,$0A,$0C,$0C
DB $0A,$0A,$0A,$0A,$0A,$0A,$00,$00 DB $0A,$0A,$0A,$0A,$0C,$0C,$00,$00
TilesEnd:: TilesEnd::