Compare commits

..

No commits in common. "dfa5e5b19b5bca1999a71653c1836b9e1f5366f2" and "228cdfec9ec067ae6c266abdf320371024c775f8" have entirely different histories.

7 changed files with 29 additions and 86 deletions

1
.vscode/launch.json vendored
View File

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

Binary file not shown.

View File

@ -41,9 +41,7 @@ Soft = Amount of frames the down button was held during this piece + 10 if the p
Combo = Old combo + (2 x Lines) - 2 Combo = Old combo + (2 x Lines) - 2
Bravo = 1 if the field isn't empty, 4 if it is. ScoreIncrement = ((Level + Lines) >> 4 + 1 + Soft) x Combo x Lines.
ScoreIncrement = ((Level + Lines) >> 4 + 1 + Soft) x Combo x Lines x Bravo.
ScoreIncrement points are then awarded. ScoreIncrement points are then awarded.

View File

@ -29,9 +29,7 @@ DEF DELAY_STATE_ARE EQU 2
SECTION "Field Variables", WRAM0 SECTION "Field Variables", WRAM0
wField:: ds (10*24) wField:: ds (10*24)
wBackupField:: ds (10*24)
wShadowField:: ds (14*26) wShadowField:: ds (14*26)
wDelayState: ds 1
SECTION "High Field Variables", HRAM SECTION "High Field Variables", HRAM
@ -48,6 +46,7 @@ hWantX: ds 1
hYPosAtStartOfFrame: ds 1 hYPosAtStartOfFrame: ds 1
hWantRotation: ds 1 hWantRotation: ds 1
hRemainingDelay:: ds 1 hRemainingDelay:: ds 1
hDelayState: ds 1
hClearedLines: ds 4 hClearedLines: ds 4
hLineClearCt: ds 1 hLineClearCt: ds 1
hComboCt: ds 1 hComboCt: ds 1
@ -55,13 +54,10 @@ hLockDelayForce: ds 1
hHighestStack: ds 1 hHighestStack: ds 1
hDownFrames: ds 1 hDownFrames: ds 1
hStalePiece: ds 1 hStalePiece: ds 1
hBravo: ds 1
SECTION "Field Functions", ROM0 SECTION "Field Functions", ROM0
FieldInit:: FieldInit::
xor a, a
ldh [hBravo], a
ld a, 23 ld a, 23
ldh [hHighestStack], a ldh [hHighestStack], a
ld a, 1 ld a, 1
@ -517,7 +513,7 @@ TrySpawnPiece::
ld a, $FF ld a, $FF
ldh [hRemainingDelay], a ldh [hRemainingDelay], a
ld a, DELAY_STATE_DETERMINE_DELAY ld a, DELAY_STATE_DETERMINE_DELAY
ld [wDelayState], a ldh [hDelayState], a
; Copy the field to the shadow field. ; Copy the field to the shadow field.
call ToShadowField call ToShadowField
@ -1662,8 +1658,7 @@ GetTileShade:
FieldDelay:: FieldDelay::
; Switch on the delay state. ldh a, [hDelayState]
ld a, [wDelayState]
cp DELAY_STATE_DETERMINE_DELAY cp DELAY_STATE_DETERMINE_DELAY
jr z, .determine jr z, .determine
cp DELAY_STATE_LINE_CLEAR cp DELAY_STATE_LINE_CLEAR
@ -1671,9 +1666,6 @@ FieldDelay::
cp DELAY_STATE_ARE cp DELAY_STATE_ARE
jr z, .are jr z, .are
; Check if there were line clears.
; If so, we need to do a line clear delay.
; Otherwise, we skip to ARE delay.
.determine .determine
call FindClearedLines call FindClearedLines
ldh a, [hClearedLines] ldh a, [hClearedLines]
@ -1687,23 +1679,21 @@ FieldDelay::
and a, c and a, c
and a, d and a, d
cp a, $FF cp a, $FF
jr z, .skip ; If there were no line clears, skip to ARE delay. jr z, .skip
ld a, DELAY_STATE_LINE_CLEAR ; Otherwise, do a line clear delay. ld a, DELAY_STATE_LINE_CLEAR
ld [wDelayState], a ldh [hDelayState], a
ldh a, [hCurrentLineClearDelay] ldh a, [hCurrentLineClearDelay]
ldh [hRemainingDelay], a ldh [hRemainingDelay], a
call MarkClear call MarkClear
jr .lineclear jr .lineclear
.skip .skip
ld a, DELAY_STATE_ARE ; If there were no line clears, do an ARE delay. ld a, DELAY_STATE_ARE
ld [wDelayState], a ldh [hDelayState], a
ldh a, [hCurrentARE] ldh a, [hCurrentARE]
ldh [hRemainingDelay], a ldh [hRemainingDelay], a
jr .are jr .are
; Line clear delay.
; Count doen the delay. If we're out of delay, clear the lines and go to ARE.
.lineclear .lineclear
ldh a, [hRemainingDelay] ldh a, [hRemainingDelay]
dec a dec a
@ -1717,12 +1707,10 @@ FieldDelay::
call SFXEnqueue call SFXEnqueue
ld a, DELAY_STATE_ARE ld a, DELAY_STATE_ARE
ld [wDelayState], a ldh [hDelayState], a
ldh a, [hCurrentARE] ldh a, [hCurrentARE]
ldh [hRemainingDelay], a ldh [hRemainingDelay], a
; ARE delay.
; Count down the delay. If it hits 0, award levels and score if necessary, then end the delay phase.
.are .are
ldh a, [hRemainingDelay] ldh a, [hRemainingDelay]
dec a dec a
@ -1730,17 +1718,12 @@ FieldDelay::
cp a, 0 cp a, 0
ret nz ret nz
; Increment bravo by 4. ; If we're out of delay, spawn a new piece.
ldh a, [hBravo]
add a, 4
ldh [hBravo], a
; Check if there were any line clears.
call SFXKill call SFXKill
ldh a, [hLineClearCt] ldh a, [hLineClearCt]
cp a, 0 cp a, 0
jr nz, :+ ; If there were, award levels and score. jr nz, :+
ld a, 1 ; Otherwise, increment the level counter by one if it's not at a breakpoint, and end the delay phase. ld a, 1
ldh [hComboCt], a ldh [hComboCt], a
ldh a, [hRequiresLineClear] ldh a, [hRequiresLineClear]
cp a, $FF cp a, $FF
@ -1749,22 +1732,8 @@ FieldDelay::
call LevelUp call LevelUp
ret ret
; There were line clears! Clear the level counter breakpoint.
: xor a, a : xor a, a
ldh [hRequiresLineClear], a ldh [hRequiresLineClear], a
; Decrement bravo by 10 for each line clear.
ldh a, [hLineClearCt]
ld b, a
ldh a, [hBravo]
: sub a, 10
dec b
jr nz, :-
ldh [hBravo], a
; Check if we are in a TGM3 mode and thus need to handle line counts of 3 and 4 differently.
ldh a, [hLineClearCt] ldh a, [hLineClearCt]
ld e, a ld e, a
ldh a, [hSimulationMode] ldh a, [hSimulationMode]
@ -1786,71 +1755,47 @@ FieldDelay::
inc a inc a
ld e, a ld e, a
ldh [hLineClearCt], a ldh [hLineClearCt], a
; Increment the level counter by the amount of lines.
.applylines .applylines
call LevelUp call LevelUp
ld c, a
; Update the combo counter.
ld b, a ld b, a
ldh a, [hComboCt] ; Old combo count. ldh a, [hComboCt]
add b ; + lines add b
add b ; + lines add b
sub 2 ; - 2 sub 2
ldh [hComboCt], a ldh [hComboCt], a
; Score the line clears. ; Score the line clears.
; Get the new level. xor a, a
ld b, a
ldh a, [hLevel] ldh a, [hLevel]
ld l, a ld l, a
ldh a, [hLevel+1] ldh a, [hLevel+1]
ld h, a ld h, a
add hl, bc
; Divide by 4.
rrc h rrc h
rr l rr l
rrc h rrc h
rr l rr l
; Add 1.
inc hl inc hl
; Add soft drop points.
ldh a, [hDownFrames] ldh a, [hDownFrames]
ld c, a ld c, a
xor a, a xor a, a
ld b, a ld b, a
add hl, bc add hl, bc
; Copy the running total.
ld b, h ld b, h
ld c, l ld c, l
ldh a, [hComboCt]
; Get a multiplier consisting of... : add hl, bc
xor a, a
ld d, a
ldh a, [hBravo] ; 4 if the field is empty and...
cp a, 0
jr nz, :+
ld a, 4
ld d, a
: ldh a, [hLineClearCt] ; The number of lines cleared and...
add a, d
ld d, a
ldh a, [hComboCt] ; The combo count.
dec a dec a
add a, d cp a, 0
jr nz, :-
; Multiply the running total by the multiplier. ldh a, [hLineClearCt]
: add hl, bc : add hl, bc
dec a dec a
cp a, 0 cp a, 0
jr nz, :- jr nz, :-
; And apply the score.
ld a, l ld a, l
ldh [hScoreIncrement], a ldh [hScoreIncrement], a
ld a, h ld a, h

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 $00,$00,$00,$00,$CC,$CC,$22,$22 DB $00,$00,$00,$00,$CC,$CC,$22,$22
DB $44,$44,$82,$82,$EC,$EC,$00,$00 DB $44,$44,$82,$82,$EC,$EC,$00,$00
DB $00,$00,$00,$00,$0C,$0C,$0A,$0A DB $00,$00,$00,$00,$04,$04,$0A,$0A
DB $0C,$0C,$0A,$0A,$0C,$0C,$00,$00 DB $0E,$0E,$0A,$0A,$0A,$0A,$00,$00
TilesEnd:: TilesEnd::

View File

@ -582,7 +582,6 @@ DoHold:
ldh [hCurrentPieceRotationState], a ldh [hCurrentPieceRotationState], a
.doHoldOperation .doHoldOperation
ldh a, [hHeldPiece]
ld b, a ld b, a
ldh a, [hCurrentPiece] ldh a, [hCurrentPiece]
ldh [hHeldPiece], a ldh [hHeldPiece], a