Fix IRS related issue.

This commit is contained in:
Randy Thiemann 2023-10-21 19:14:22 +02:00
parent 2ce4934ce7
commit d4b1c6463e
1 changed files with 28 additions and 17 deletions

View File

@ -190,7 +190,7 @@ fetchPieceMode:
; Check if IHS is requested. ; Check if IHS is requested.
; Apply the hold if so. ; Apply the hold if so.
.checkIHS .checkIHS
ld a, [hSelectState] ldh a, [hSelectState]
cp a, 0 cp a, 0
jr z, .checkIRSA jr z, .checkIRSA
call DoHold call DoHold
@ -200,14 +200,18 @@ fetchPieceMode:
; Check if IRS is requested. ; Check if IRS is requested.
; Apply the rotation if so. ; Apply the rotation if so.
.checkIRSA .checkIRSA
ld a, [hSwapAB] ldh a, [hSwapAB]
cp a, 0 cp a, 0
jr z, .lda1 jr z, .lda1
.ldb1 .ldb1
ld a, [hBState] ldh a, [hBState]
ld a, $FF
ldh [hBState], a
jr .cp1 jr .cp1
.lda1 .lda1
ld a, [hAState] ldh a, [hAState]
ld a, $FF
ldh [hAState], a
.cp1 .cp1
cp a, 0 cp a, 0
jr z, .checkIRSB jr z, .checkIRSB
@ -222,9 +226,13 @@ fetchPieceMode:
jr z, .ldb2 jr z, .ldb2
.lda2 .lda2
ld a, [hAState] ld a, [hAState]
ld a, $FF
ldh [hAState], a
jr .cp2 jr .cp2
.ldb2 .ldb2
ld a, [hBState] ldh a, [hBState]
ld a, $FF
ldh [hBState], a
.cp2 .cp2
cp a, 0 cp a, 0
jr z, .checkJingle jr z, .checkJingle
@ -254,12 +262,7 @@ spawnPieceMode:
ld a, MODE_PRE_GAME_OVER ld a, MODE_PRE_GAME_OVER
ld [wMode], a ld [wMode], a
jp drawStaticInfo jp drawStaticInfo
: ld a, MODE_PIECE_IN_MOTION
; If you IRS at the exact time the piece spawns, you can get double IRS, we fix this by always saying A and B were held for a long time.
: ld a, $FF
ldh [hAState], a
ldh [hBState], a
ld a, MODE_PIECE_IN_MOTION
ld [wMode], a ld [wMode], a
@ -468,14 +471,18 @@ DoHold:
; Check if IRS is requested. ; Check if IRS is requested.
; Apply the rotation if so. ; Apply the rotation if so.
.checkIRSHA .checkIRSHA
ld a, [hSwapAB] ldh a, [hSwapAB]
cp a, 0 cp a, 0
jr z, .lda3 jr z, .lda3
.ldb3 .ldb3
ld a, [hBState] ldh a, [hBState]
ld a, $FF
ldh [hBState], a
jr .cp3 jr .cp3
.lda3 .lda3
ld a, [hAState] ldh a, [hAState]
ld a, $FF
ldh [hAState], a
.cp3 .cp3
cp a, 0 cp a, 0
jr z, .checkIRSHB jr z, .checkIRSHB
@ -485,14 +492,18 @@ DoHold:
call SFXEnqueue call SFXEnqueue
.checkIRSHB .checkIRSHB
ld a, [hSwapAB] ldh a, [hSwapAB]
cp a, 0 cp a, 0
jr z, .ldb4 jr z, .ldb4
.lda4 .lda4
ld a, [hAState] ldh a, [hAState]
ld a, $FF
ldh [hAState], a
jr .cp4 jr .cp4
.ldb4 .ldb4
ld a, [hBState] ldh a, [hBState]
ld a, $FF
ldh [hBState], a
.cp4 .cp4
cp a, 0 cp a, 0
jr z, .noRotation jr z, .noRotation