Improve pause.

This commit is contained in:
Randy Thiemann 2023-10-23 08:12:16 +02:00
parent c572aabefa
commit ee016a1480
2 changed files with 21 additions and 9 deletions

View File

@ -73,16 +73,28 @@ FieldInit::
ld hl, wShadowField ld hl, wShadowField
ld bc, 14*26 ld bc, 14*26
ld d, $FF ld d, $FF
call UnsafeMemSet jp UnsafeMemSet
ret
FieldClear:: FieldClear::
ld hl, wField ld hl, wField
ld bc, 10*24 ld bc, 10*24
ld d, TILE_FIELD_EMPTY ld d, TILE_FIELD_EMPTY
call UnsafeMemSet jp UnsafeMemSet
ret
ToBackupField::
ld hl, wBackupField
ld de, wField
ld bc, 10*24
jp UnsafeMemCopy
FromBackupField::
ld hl, wField
ld de, wBackupField
ld bc, 10*24
jp UnsafeMemCopy
ToShadowField:: ToShadowField::

View File

@ -293,6 +293,7 @@ pieceInMotionMode:
ldh a, [hStartState] ldh a, [hStartState]
cp a, 1 cp a, 1
jr nz, :+ jr nz, :+
call ToBackupField
ldh a, [hMode] ldh a, [hMode]
ldh [hPrePause], a ldh [hPrePause], a
ld a, MODE_PAUSED ld a, MODE_PAUSED
@ -336,6 +337,7 @@ delayMode:
ldh a, [hStartState] ldh a, [hStartState]
cp a, 1 cp a, 1
jr nz, :+ jr nz, :+
call ToBackupField
ldh a, [hMode] ldh a, [hMode]
ldh [hPrePause], a ldh [hPrePause], a
ld a, MODE_PAUSED ld a, MODE_PAUSED
@ -482,15 +484,13 @@ pauseMode:
ldh a, [hStartState] ldh a, [hStartState]
cp a, 1 cp a, 1
jr nz, :+ jr nz, :+
call FromBackupField
ldh a, [hPrePause] ldh a, [hPrePause]
ldh [hMode], a ldh [hMode], a
jr drawStaticInfo jr drawStaticInfo
; Draw PAUSE all over the field, but not if we came from delay mode. ; Draw PAUSE all over the field.
: ldh a, [hPrePause] : ld de, sPause
cp a, MODE_DELAY
jr z, drawStaticInfo
ld de, sPause
ld hl, wField+(4*10) ld hl, wField+(4*10)
ld bc, 200 ld bc, 200
call UnsafeMemCopy call UnsafeMemCopy