Compare commits
3 Commits
228cdfec9e
...
dfa5e5b19b
Author | SHA1 | Date |
---|---|---|
Randy Thiemann | dfa5e5b19b | |
Randy Thiemann | 75f450f62b | |
Randy Thiemann | 1ca7ecb16d |
|
@ -8,7 +8,6 @@
|
||||||
"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,
|
||||||
|
|
BIN
DMGTRIS.GB
BIN
DMGTRIS.GB
Binary file not shown.
|
@ -41,7 +41,9 @@ 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
|
||||||
|
|
||||||
ScoreIncrement = ((Level + Lines) >> 4 + 1 + Soft) x Combo x Lines.
|
Bravo = 1 if the field isn't empty, 4 if it is.
|
||||||
|
|
||||||
|
ScoreIncrement = ((Level + Lines) >> 4 + 1 + Soft) x Combo x Lines x Bravo.
|
||||||
|
|
||||||
ScoreIncrement points are then awarded.
|
ScoreIncrement points are then awarded.
|
||||||
|
|
||||||
|
|
105
src/field.asm
105
src/field.asm
|
@ -29,7 +29,9 @@ 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
|
||||||
|
@ -46,7 +48,6 @@ 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
|
||||||
|
@ -54,10 +55,13 @@ 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
|
||||||
|
@ -513,7 +517,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
|
||||||
ldh [hDelayState], a
|
ld [wDelayState], a
|
||||||
|
|
||||||
; Copy the field to the shadow field.
|
; Copy the field to the shadow field.
|
||||||
call ToShadowField
|
call ToShadowField
|
||||||
|
@ -1658,7 +1662,8 @@ GetTileShade:
|
||||||
|
|
||||||
|
|
||||||
FieldDelay::
|
FieldDelay::
|
||||||
ldh a, [hDelayState]
|
; Switch on the delay state.
|
||||||
|
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
|
||||||
|
@ -1666,6 +1671,9 @@ 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]
|
||||||
|
@ -1679,21 +1687,23 @@ FieldDelay::
|
||||||
and a, c
|
and a, c
|
||||||
and a, d
|
and a, d
|
||||||
cp a, $FF
|
cp a, $FF
|
||||||
jr z, .skip
|
jr z, .skip ; If there were no line clears, skip to ARE delay.
|
||||||
ld a, DELAY_STATE_LINE_CLEAR
|
ld a, DELAY_STATE_LINE_CLEAR ; Otherwise, do a line clear delay.
|
||||||
ldh [hDelayState], a
|
ld [wDelayState], 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
|
ld a, DELAY_STATE_ARE ; If there were no line clears, do an ARE delay.
|
||||||
ldh [hDelayState], a
|
ld [wDelayState], 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
|
||||||
|
@ -1707,10 +1717,12 @@ FieldDelay::
|
||||||
call SFXEnqueue
|
call SFXEnqueue
|
||||||
|
|
||||||
ld a, DELAY_STATE_ARE
|
ld a, DELAY_STATE_ARE
|
||||||
ldh [hDelayState], a
|
ld [wDelayState], 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
|
||||||
|
@ -1718,12 +1730,17 @@ FieldDelay::
|
||||||
cp a, 0
|
cp a, 0
|
||||||
ret nz
|
ret nz
|
||||||
|
|
||||||
; If we're out of delay, spawn a new piece.
|
; Increment bravo by 4.
|
||||||
|
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, :+
|
jr nz, :+ ; If there were, award levels and score.
|
||||||
ld a, 1
|
ld a, 1 ; Otherwise, increment the level counter by one if it's not at a breakpoint, and end the delay phase.
|
||||||
ldh [hComboCt], a
|
ldh [hComboCt], a
|
||||||
ldh a, [hRequiresLineClear]
|
ldh a, [hRequiresLineClear]
|
||||||
cp a, $FF
|
cp a, $FF
|
||||||
|
@ -1732,8 +1749,22 @@ 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]
|
||||||
|
@ -1755,47 +1786,71 @@ 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]
|
ldh a, [hComboCt] ; Old combo count.
|
||||||
add b
|
add b ; + lines
|
||||||
add b
|
add b ; + lines
|
||||||
sub 2
|
sub 2 ; - 2
|
||||||
ldh [hComboCt], a
|
ldh [hComboCt], a
|
||||||
|
|
||||||
; Score the line clears.
|
; Score the line clears.
|
||||||
xor a, a
|
; Get the new level.
|
||||||
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]
|
|
||||||
: add hl, bc
|
; Get a multiplier consisting of...
|
||||||
dec a
|
xor a, a
|
||||||
|
ld d, a
|
||||||
|
|
||||||
|
ldh a, [hBravo] ; 4 if the field is empty and...
|
||||||
cp a, 0
|
cp a, 0
|
||||||
jr nz, :-
|
jr nz, :+
|
||||||
ldh a, [hLineClearCt]
|
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
|
||||||
|
add a, d
|
||||||
|
|
||||||
|
; Multiply the running total by the multiplier.
|
||||||
: 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.
|
@ -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,$04,$04,$0A,$0A
|
DB $00,$00,$00,$00,$0C,$0C,$0A,$0A
|
||||||
DB $0E,$0E,$0A,$0A,$0A,$0A,$00,$00
|
DB $0C,$0C,$0A,$0A,$0C,$0C,$00,$00
|
||||||
TilesEnd::
|
TilesEnd::
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -582,6 +582,7 @@ 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
|
||||||
|
|
Loading…
Reference in New Issue