Fix small bug in returning to big mode from final challenge retry and fully implement TGM1 grades.

This commit is contained in:
Randy Thiemann 2023-11-10 22:43:02 +01:00
parent ca822edfc0
commit 6953347770
7 changed files with 4147 additions and 3946 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

@ -40,6 +40,7 @@ wDelayState: ds 1
wLeftSlamTimer: ds 1
wRightSlamTimer: ds 1
wMovementLastFrame: ds 1
wReturnToSmall:: ds 1
SECTION "High Field Variables", HRAM
@ -238,6 +239,8 @@ FromBackupField::
jp UnsafeMemCopy
GoBig::
ld a, $FF
ld [wReturnToSmall], a
ld hl, wWideBlittedField
ld bc, 10*22
ld d, TILE_BLANK
@ -2514,6 +2517,33 @@ BigFieldClear::
ret
GoSmall::
xor a, a
ldh [hBravo], a
ldh [hLineClearCt], a
ld [wMovementLastFrame], a
ld a, 1
ldh [hComboCt], a
ld hl, wField
ld bc, 10*24
ld d, TILE_BLANK
call UnsafeMemSet
ld hl, wShadowField
ld bc, 14*26
ld d, $FF
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
ld a, STATE_GAMEPLAY
ldh [hGameState], a
ret
; Backs up the field.
; This backup field is used for pausing the game.
BigToBackupField::

View File

@ -23,21 +23,24 @@ INCLUDE "globals.asm"
SECTION "Grade Variables", WRAM0
wDecayRate: ds 1
wGradePoints: ds 1
wInternalGrade: ds 1
wDisplayedGrade:: ds 1
wEffectTimer:: ds 1
wRankingDisqualified:: ds 1
wDecayCounter: ds 1
wGradeGauge: ds 1
wSMult: ds 1
wDMult: ds 1
wTMult: ds 1
wSRate: ds 1
wDRate: ds 1
wTRate: ds 1
wQRate: ds 1
wDecayRate: ds 1
wGradePoints: ds 1
wInternalGrade: ds 1
wDisplayedGrade:: ds 1
wEffectTimer:: ds 1
wRankingDisqualified:: ds 1
wDecayCounter: ds 1
wGradeGauge: ds 1
wSMult: ds 1
wDMult: ds 1
wTMult: ds 1
wSRate: ds 1
wDRate: ds 1
wTRate: ds 1
wQRate: ds 1
wTGM1level300RequirementMet: ds 1
wTGM1level500RequirementMet: ds 1
wTGM1level999RequirementMet: ds 1
SECTION "Grading Data", ROM0
@ -238,6 +241,9 @@ GradeInit::
ld [wEffectTimer], a
ld [wDecayCounter], a
ld [wGradeGauge], a
ld [wTGM1level300RequirementMet], a
ld [wTGM1level500RequirementMet], a
ld [wTGM1level999RequirementMet], a
; Most modes begin ungraded.
ld a, GRADE_NONE
@ -683,9 +689,14 @@ UpdateGradeTGM1:
cp a, GRADE_GM
ret z
; Bail if we didn't make the 999 check.
ld a, [wTGM1level999RequirementMet]
cp a, 0
ret nz
; Skip to GM check if already S9.
cp a, GRADE_S9
jr nc, .maybegm
jp nc, .check999
.trygradeup
; Otherwise, check if we can increase the grade.
@ -724,7 +735,7 @@ UpdateGradeTGM1:
; Return if C < E. Otherwise increase the grade.
ld a, c
cp a, e
ret c
jr c, .check300
.increasegrade
; Add 1 to the grade.
@ -748,15 +759,118 @@ UpdateGradeTGM1:
; Loop and see if we can increment more grades.
ld a, [wDisplayedGrade]
cp a, GRADE_S9 ; Don't go past S9.
ret z
jr .trygradeup
jr nz, .trygradeup
.maybegm
; Level needs to be 1000 or greater.
ld a, [hCLevel+CLEVEL_THOUSANDS] ; Level, thousands digit.
cp a, 1
.check300
; Are we at level 300?
ld a, [hCLevel+CLEVEL_HUNDREDS]
cp a, 3
ret c
; Have we judged the requirement before?
ld a, [wTGM1level300RequirementMet]
cp a, 0
jr nz, .check500
; Rank?
ld a, [wDisplayedGrade]
cp a, GRADE_1
jr c, .fail300
; Time?
ld b, 4
ld c, 15
call CheckTorikan
cp a, $FF
jr nz, .fail300
.success300
ld a, $FF
ld [wTGM1level300RequirementMet], a
jr .check500
.fail300
ld a, $01
ld [wTGM1level300RequirementMet], a
jr .check500
.check500
; Are we at level 500?
ld a, [hCLevel+CLEVEL_HUNDREDS]
cp a, 5
ret c
; Have we judged the requirement before?
ld a, [wTGM1level500RequirementMet]
cp a, 0
jr nz, .check999
; Rank?
ld a, [wDisplayedGrade]
cp a, GRADE_S4
jr c, .fail500
; Time?
ld b, 7
ld c, 30
call CheckTorikan
cp a, $FF
jr nz, .fail500
.success500
ld a, $FF
ld [wTGM1level500RequirementMet], a
jr .check999
.fail500
ld a, $01
ld [wTGM1level500RequirementMet], a
jr .check999
.check999
; Level needs to be 999.
ld a, [hCLevel+CLEVEL_HUNDREDS]
cp a, 9
ret nz
ld a, [hCLevel+CLEVEL_TENS]
cp a, 9
ret nz
ld a, [hCLevel+CLEVEL_ONES]
cp a, 9
ret nz
; Have we judged the requirement before?
ld a, [wTGM1level999RequirementMet]
cp a, 0
ret nz
; Did both other checks succeed?
ld a, [wTGM1level300RequirementMet]
cp a, $FF
jr nz, .fail999
ld a, [wTGM1level500RequirementMet]
cp a, $FF
jr nz, .fail999
; Rank? (This is technically slightly wrong but it's nearly impossible to miss the real requirement but make this one, 6000 points.)
ld a, [wDisplayedGrade]
cp a, GRADE_S9
jr c, .fail999
; Time?
ld b, 13
ld c, 30
call CheckTorikan
cp a, $FF
jr nz, .fail999
.success999
ld a, $FF
ld [wTGM1level999RequirementMet], a
; Set the grade to GM
ld a, GRADE_GM
ld [wDisplayedGrade], a
@ -773,6 +887,11 @@ UpdateGradeTGM1:
; Return
ret
.fail999
ld a, $01
ld [wTGM1level999RequirementMet], a
ret
UpdateGradeDEAT:
; If we're disqualified, don't update the grade.

View File

@ -223,6 +223,8 @@ GamePlayEventLoopHandlerB::
call SFXKill
ld a, SFX_READYGO
call SFXEnqueue
xor a, a
ld [wReturnToSmall], a
ldh a, [hModeCounter]
.firstleadyiterskip
dec a
@ -1002,6 +1004,8 @@ GamePlayBigEventLoopHandlerB:
call SFXKill
ld a, SFX_READYGO
call SFXEnqueue
xor a, a
ld [wReturnToSmall], a
ldh a, [hModeCounter]
.firstleadyiterskip
dec a
@ -1397,6 +1401,9 @@ GamePlayBigEventLoopHandlerB:
ldh a, [hAState]
cp a, 10 ; 10 frame hold
jr nz, .noretry
ld a, [wReturnToSmall]
cp a, $FF
jr z, .gosmall
call CheckAndAddHiscore
call RNGInit
call ScoreInit
@ -1412,6 +1419,23 @@ GamePlayBigEventLoopHandlerB:
ldh [hModeCounter], a
jp .drawStaticInfo
.gosmall
call CheckAndAddHiscore
call RNGInit
call ScoreInit
call LevelInit
call GoSmall
call GradeInit
xor a, a
ldh [hHoldSpent], a
ld [wInStaffRoll], a
ld a, MODE_LEADY
ldh [hMode], a
ld a, LEADY_TIME
ldh [hModeCounter], a
jp .drawStaticInfo
; Quit
.noretry
ldh a, [hBState]