diff --git a/src/field.asm b/src/field.asm index e1640f8..04cc0d8 100644 --- a/src/field.asm +++ b/src/field.asm @@ -11,7 +11,6 @@ wShadowField:: ds (14*26) SECTION "Field High Variables", HRAM -hToppedOut:: ds 1 hPieceDataBase:: ds 2 hPieceDataOffset:: ds 1 hCurrentLockDelayRemaining:: ds 1 @@ -370,10 +369,6 @@ TrySpawnPiece:: ; Copy the field to the shadow field. call ToShadowField - ; Assume we're not topped out. - xor a, a - ldh [hToppedOut], a - ; Point the piece data to the correct piece. call SetPieceData call SetPieceDataOffset @@ -388,9 +383,31 @@ TrySpawnPiece:: ld d, h ld e, l call GetPieceData - jp CanPieceFit + call CanPieceFit + ; A will be $FF if the piece can fit. - ; We jump instead of return to save a few cycles. + cp a, $FF + ret z + + ; Otherwise check the rotation, and if it's not zero, try to reset it. + ldh a, [hCurrentPieceRotationState] + cp a, 0 + ret nz + + ; Reset the rotation. + xor a, a + ldh [hCurrentPieceRotationState], a + call SetPieceDataOffset + ldh a, [hCurrentPieceY] + ld b, a + ldh a, [hCurrentPieceX] + call XYToSFieldPtr + ld d, h + ld e, l + call GetPieceData + jp CanPieceFit + + ; Draws the piece onto the field. diff --git a/src/state_gameplay.asm b/src/state_gameplay.asm index f2d113d..484c0a3 100644 --- a/src/state_gameplay.asm +++ b/src/state_gameplay.asm @@ -218,7 +218,7 @@ spawnPieceMode: jr z, :+ ld a, MODE_GAME_OVER ld [wMode], a - jr drawStaticInfo + jp drawStaticInfo : ld a, MODE_PIECE_IN_MOTION ld [wMode], a diff --git a/tools/Emulicious.ini b/tools/Emulicious.ini index b5dc806..f8aff36 100644 --- a/tools/Emulicious.ini +++ b/tools/Emulicious.ini @@ -1,5 +1,5 @@ #Emulicious settings file -#Fri Oct 20 08:52:26 CEST 2023 +#Fri Oct 20 11:39:58 CEST 2023 WindowEventViewerWindowHeight=1416 WindowEventViewerWindowDivider=876 WindowMemoryTracerWindowY=631