Add juice on DAS slams.

This commit is contained in:
Randy Thiemann 2023-11-02 08:33:38 +01:00
parent 7bfe31210e
commit 5d82a58b02
9 changed files with 3859 additions and 3613 deletions

Binary file not shown.

File diff suppressed because it is too large Load Diff

Binary file not shown.

File diff suppressed because it is too large Load Diff

View File

@ -37,6 +37,9 @@ wShadowField:: ds (14*26)
wWideField:: ds (5*11) wWideField:: ds (5*11)
wWideBlittedField:: ds (22*10) wWideBlittedField:: ds (22*10)
wDelayState: ds 1 wDelayState: ds 1
wLeftSlamTimer: ds 1
wRightSlamTimer: ds 1
wMovementLastFrame: ds 1
SECTION "High Field Variables", HRAM SECTION "High Field Variables", HRAM
@ -188,6 +191,7 @@ SECTION "Field Function Banked Gameplay", ROMX, BANK[BANK_GAMEPLAY]
FieldInit:: FieldInit::
xor a, a xor a, a
ldh [hBravo], a ldh [hBravo], a
ld [wMovementLastFrame], a
ld a, 1 ld a, 1
ldh [hComboCt], a ldh [hComboCt], a
ld hl, wField ld hl, wField
@ -197,11 +201,15 @@ FieldInit::
ld hl, wShadowField ld hl, wShadowField
ld bc, 14*26 ld bc, 14*26
ld d, $FF ld d, $FF
jp UnsafeMemSet call UnsafeMemSet
ld hl, wPreShadowField ld hl, wPreShadowField
ld bc, 14*2 ld bc, 14*2
ld d, $FF ld d, $FF
jp UnsafeMemSet call UnsafeMemSet
ld a, SLAM_ANIMATION_LEN
ld [wLeftSlamTimer], a
ld [wRightSlamTimer], a
ret
; Fills the field with the empty tile. ; Fills the field with the empty tile.
@ -642,6 +650,12 @@ TrySpawnPiece::
ldh [hShouldLockIfGrounded], a ldh [hShouldLockIfGrounded], a
ldh [hGravityCtr], a ldh [hGravityCtr], a
ldh [hGrounded], a ldh [hGrounded], a
ld [wMovementLastFrame], a
ld a, SLAM_ANIMATION_LEN
ld [wLeftSlamTimer], a
ld [wRightSlamTimer], a
ld a, -2
ldh [rSCX], a
ldh a, [hCurrentLockDelay] ldh a, [hCurrentLockDelay]
ldh [hCurrentLockDelayRemaining], a ldh [hCurrentLockDelayRemaining], a
ld a, $FF ld a, $FF
@ -891,7 +905,36 @@ FindMaxG:
FieldProcess:: FieldProcess::
; ************************************************************** ; **************************************************************
; SETUP ; SETUP
; Apply screen shake if needed.
.leftslam
ld a, [wLeftSlamTimer]
cp a, SLAM_ANIMATION_LEN
jr z, .rightslam
ld b, 0
ld c, a
ld hl, sLeftDasSlam
add hl, bc
inc a
ld [wLeftSlamTimer], a
ld a, [hl]
ldh [rSCX], a
jr .wipe
.rightslam
ld a, [wRightSlamTimer]
cp a, SLAM_ANIMATION_LEN
jr z, .wipe
ld b, 0
ld c, a
ld hl, sRightDasSlam
add hl, bc
inc a
ld [wRightSlamTimer], a
ld a, [hl]
ldh [rSCX], a
; Wipe out the piece. ; Wipe out the piece.
.wipe
ldh a, [hCurrentPieceY] ldh a, [hCurrentPieceY]
ldh [hYPosAtStartOfFrame], a ldh [hYPosAtStartOfFrame], a
call FromShadowField call FromShadowField
@ -1351,14 +1394,14 @@ FieldProcess::
cp a, 1 cp a, 1
jr z, .doright jr z, .doright
cp a, 0 ; We never want to move if the button wasn't held. cp a, 0 ; We never want to move if the button wasn't held.
jr z, .donemanipulating jr z, .noeffect
ld b, a ld b, a
.checkdasright .checkdasright
ldh a, [hCurrentDAS] ldh a, [hCurrentDAS]
ld c, a ld c, a
ld a, b ld a, b
cp a, c cp a, c
jr c, .donemanipulating jr c, .noeffect
.doright .doright
ldh a, [hWantX] ldh a, [hWantX]
inc a inc a
@ -1375,9 +1418,46 @@ FieldProcess::
call GetPieceDataFast call GetPieceDataFast
call CanPieceFitFast call CanPieceFitFast
cp a, $FF cp a, $FF
jr nz, .donemanipulating jr nz, .nomove
ld a, $FF
ld [wMovementLastFrame], a
ldh a, [hWantX] ldh a, [hWantX]
ldh [hCurrentPieceX], a ldh [hCurrentPieceX], a
jr .donemanipulating
.nomove
ld a, [wMovementLastFrame]
cp a, 0
jr z, .noeffect
; We moved last frame but couldn't move this frame. That means we slammed into a wall.
; First check if either effect is playing.
ld a, [wLeftSlamTimer]
cp a, SLAM_ANIMATION_LEN
jr nz, .noeffect
ld a, [wRightSlamTimer]
cp a, SLAM_ANIMATION_LEN
jr nz, .noeffect
; Which wall did we slam into?
ldh a, [hWantX]
ld b, a
ldh a, [hCurrentPieceX]
cp a, b
jr c, .slamright
.slamleft
xor a, a
ld [wLeftSlamTimer], a
jr .noeffect
.slamright
xor a, a
ld [wRightSlamTimer], a
.noeffect
xor a, a
ld [wMovementLastFrame], a
; ************************************************************** ; **************************************************************
@ -2306,6 +2386,7 @@ SECTION "Field Function Banked Gameplay Big", ROMX, BANK[BANK_GAMEPLAY_BIG]
BigFieldInit:: BigFieldInit::
xor a, a xor a, a
ldh [hBravo], a ldh [hBravo], a
ld [wMovementLastFrame], a
ld a, 1 ld a, 1
ldh [hComboCt], a ldh [hComboCt], a
ld hl, wField ld hl, wField
@ -2319,7 +2400,15 @@ BigFieldInit::
ld hl, wShadowField ld hl, wShadowField
ld bc, 14*26 ld bc, 14*26
ld d, $FF ld d, $FF
jp UnsafeMemSet call UnsafeMemSet
ld hl, wPreShadowField
ld bc, 14*2
ld d, $FF
call UnsafeMemSet
ld a, SLAM_ANIMATION_LEN
ld [wLeftSlamTimer], a
ld [wRightSlamTimer], a
ret
; Fills the field with the empty tile. ; Fills the field with the empty tile.
BigFieldClear:: BigFieldClear::
@ -2767,6 +2856,12 @@ BigTrySpawnPiece::
ldh [hShouldLockIfGrounded], a ldh [hShouldLockIfGrounded], a
ldh [hGravityCtr], a ldh [hGravityCtr], a
ldh [hGrounded], a ldh [hGrounded], a
ld [wMovementLastFrame], a
ld a, SLAM_ANIMATION_LEN
ld [wLeftSlamTimer], a
ld [wRightSlamTimer], a
ld a, -2
ldh [rSCX], a
ldh a, [hCurrentLockDelay] ldh a, [hCurrentLockDelay]
ldh [hCurrentLockDelayRemaining], a ldh [hCurrentLockDelayRemaining], a
ld a, $FF ld a, $FF
@ -3016,7 +3111,36 @@ BigFindMaxG:
BigFieldProcess:: BigFieldProcess::
; ************************************************************** ; **************************************************************
; SETUP ; SETUP
; Apply screen shake if needed.
.leftslam
ld a, [wLeftSlamTimer]
cp a, SLAM_ANIMATION_LEN
jr z, .rightslam
ld b, 0
ld c, a
ld hl, sBigLeftDasSlam
add hl, bc
inc a
ld [wLeftSlamTimer], a
ld a, [hl]
ldh [rSCX], a
jr .wipe
.rightslam
ld a, [wRightSlamTimer]
cp a, SLAM_ANIMATION_LEN
jr z, .wipe
ld b, 0
ld c, a
ld hl, sBigRightDasSlam
add hl, bc
inc a
ld [wRightSlamTimer], a
ld a, [hl]
ldh [rSCX], a
; Wipe out the piece. ; Wipe out the piece.
.wipe
ldh a, [hCurrentPieceY] ldh a, [hCurrentPieceY]
ldh [hYPosAtStartOfFrame], a ldh [hYPosAtStartOfFrame], a
call BigFromShadowField call BigFromShadowField
@ -3475,14 +3599,14 @@ BigFieldProcess::
cp a, 1 cp a, 1
jr z, .doright jr z, .doright
cp a, 0 ; We never want to move if the button wasn't held. cp a, 0 ; We never want to move if the button wasn't held.
jr z, .donemanipulating jr z, .noeffect
ld b, a ld b, a
.checkdasright .checkdasright
ldh a, [hCurrentDAS] ldh a, [hCurrentDAS]
ld c, a ld c, a
ld a, b ld a, b
cp a, c cp a, c
jr c, .donemanipulating jr c, .noeffect
.doright .doright
ldh a, [hWantX] ldh a, [hWantX]
inc a inc a
@ -3499,9 +3623,46 @@ BigFieldProcess::
call BigGetPieceDataFast call BigGetPieceDataFast
call BigCanPieceFitFast call BigCanPieceFitFast
cp a, $FF cp a, $FF
jr nz, .donemanipulating jr nz, .nomove
ld a, $FF
ld [wMovementLastFrame], a
ldh a, [hWantX] ldh a, [hWantX]
ldh [hCurrentPieceX], a ldh [hCurrentPieceX], a
jr .donemanipulating
.nomove
ld a, [wMovementLastFrame]
cp a, 0
jr z, .noeffect
; We moved last frame but couldn't move this frame. That means we slammed into a wall.
; First check if either effect is playing.
ld a, [wLeftSlamTimer]
cp a, SLAM_ANIMATION_LEN
jr nz, .noeffect
ld a, [wRightSlamTimer]
cp a, SLAM_ANIMATION_LEN
jr nz, .noeffect
; Which wall did we slam into?
ldh a, [hWantX]
ld b, a
ldh a, [hCurrentPieceX]
cp a, b
jr c, .slamright
.slamleft
xor a, a
ld [wLeftSlamTimer], a
jr .noeffect
.slamright
xor a, a
ld [wRightSlamTimer], a
.noeffect
xor a, a
ld [wMovementLastFrame], a
; ************************************************************** ; **************************************************************

View File

@ -592,6 +592,8 @@ GBCBigGameplayProcess::
ld [hl], a ld [hl], a
ld hl, wShadowTileAttrs+(row*32)+19 ld hl, wShadowTileAttrs+(row*32)+19
ld [hl], a ld [hl], a
ld hl, wShadowTileAttrs+(row*32)+31
ld [hl], a
DEF row += 1 DEF row += 1
ENDR ENDR

View File

@ -303,6 +303,7 @@ DEF STATE_GAMEPLAY_BIG EQU 6
DEF STACK_SIZE EQU 64 DEF STACK_SIZE EQU 64
DEF EASTER_0 EQU $9865 DEF EASTER_0 EQU $9865
DEF EASTER_1 EQU $9885 DEF EASTER_1 EQU $9885
DEF SLAM_ANIMATION_LEN EQU 11
; Magic location for bank id. ; Magic location for bank id.
DEF rBANKID EQU $4007 DEF rBANKID EQU $4007

View File

@ -23,6 +23,26 @@ INCLUDE "globals.asm"
SECTION "Gameplay Big Static Data", ROMX, BANK[BANK_GAMEPLAY_BIG] SECTION "Gameplay Big Static Data", ROMX, BANK[BANK_GAMEPLAY_BIG]
sBigLeftDasSlam::
db -1
db 0
db 1, 1
db 0, 0
db 1, 1
db 0
db -1
db -2
sBigRightDasSlam::
db -3
db -4
db -5, -5
db -4, -4
db -5, -5
db -4
db -3
db -2
sBigLeady:: db " READY? " sBigLeady:: db " READY? "
sBigGo:: db " GO " sBigGo:: db " GO "

View File

@ -23,6 +23,26 @@ INCLUDE "globals.asm"
SECTION "Gameplay Static Data", ROMX, BANK[BANK_GAMEPLAY] SECTION "Gameplay Static Data", ROMX, BANK[BANK_GAMEPLAY]
sLeftDasSlam::
db -1
db 0
db 1, 1
db 0, 0
db 1, 1
db 0
db -1
db -2
sRightDasSlam::
db -3
db -4
db -5, -5
db -4, -4
db -5, -5
db -4
db -3
db -2
sLeady:: db " READY? " sLeady:: db " READY? "
sGo:: db " GO " sGo:: db " GO "