Fix small bug in returning to big mode from final challenge retry and fully implement TGM1 grades.
This commit is contained in:
		
							parent
							
								
									ca822edfc0
								
							
						
					
					
						commit
						6953347770
					
				
							
								
								
									
										
											BIN
										
									
								
								bin/DMGTRIS.GBC
								
								
								
								
							
							
						
						
									
										
											BIN
										
									
								
								bin/DMGTRIS.GBC
								
								
								
								
							
										
											Binary file not shown.
										
									
								
							
							
								
								
									
										4170
									
								
								bin/DMGTRIS.map
								
								
								
								
							
							
						
						
									
										4170
									
								
								bin/DMGTRIS.map
								
								
								
								
							
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							
										
											Binary file not shown.
										
									
								
							
							
								
								
									
										3704
									
								
								bin/DMGTRIS.sym
								
								
								
								
							
							
						
						
									
										3704
									
								
								bin/DMGTRIS.sym
								
								
								
								
							
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							| 
						 | 
					@ -40,6 +40,7 @@ wDelayState: ds 1
 | 
				
			||||||
wLeftSlamTimer: ds 1
 | 
					wLeftSlamTimer: ds 1
 | 
				
			||||||
wRightSlamTimer: ds 1
 | 
					wRightSlamTimer: ds 1
 | 
				
			||||||
wMovementLastFrame: ds 1
 | 
					wMovementLastFrame: ds 1
 | 
				
			||||||
 | 
					wReturnToSmall:: ds 1
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
SECTION "High Field Variables", HRAM
 | 
					SECTION "High Field Variables", HRAM
 | 
				
			||||||
| 
						 | 
					@ -238,6 +239,8 @@ FromBackupField::
 | 
				
			||||||
    jp UnsafeMemCopy
 | 
					    jp UnsafeMemCopy
 | 
				
			||||||
 | 
					
 | 
				
			||||||
GoBig::
 | 
					GoBig::
 | 
				
			||||||
 | 
					    ld a, $FF
 | 
				
			||||||
 | 
					    ld [wReturnToSmall], a
 | 
				
			||||||
    ld hl, wWideBlittedField
 | 
					    ld hl, wWideBlittedField
 | 
				
			||||||
    ld bc, 10*22
 | 
					    ld bc, 10*22
 | 
				
			||||||
    ld d, TILE_BLANK
 | 
					    ld d, TILE_BLANK
 | 
				
			||||||
| 
						 | 
					@ -2514,6 +2517,33 @@ BigFieldClear::
 | 
				
			||||||
    ret
 | 
					    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.
 | 
					    ; Backs up the field.
 | 
				
			||||||
    ; This backup field is used for pausing the game.
 | 
					    ; This backup field is used for pausing the game.
 | 
				
			||||||
BigToBackupField::
 | 
					BigToBackupField::
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
							
								
								
									
										135
									
								
								src/grading.asm
								
								
								
								
							
							
						
						
									
										135
									
								
								src/grading.asm
								
								
								
								
							| 
						 | 
					@ -38,6 +38,9 @@ wSRate:                ds 1
 | 
				
			||||||
wDRate:                         ds 1
 | 
					wDRate:                         ds 1
 | 
				
			||||||
wTRate:                         ds 1
 | 
					wTRate:                         ds 1
 | 
				
			||||||
wQRate:                         ds 1
 | 
					wQRate:                         ds 1
 | 
				
			||||||
 | 
					wTGM1level300RequirementMet:    ds 1
 | 
				
			||||||
 | 
					wTGM1level500RequirementMet:    ds 1
 | 
				
			||||||
 | 
					wTGM1level999RequirementMet:    ds 1
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
SECTION "Grading Data", ROM0
 | 
					SECTION "Grading Data", ROM0
 | 
				
			||||||
| 
						 | 
					@ -238,6 +241,9 @@ GradeInit::
 | 
				
			||||||
    ld [wEffectTimer], a
 | 
					    ld [wEffectTimer], a
 | 
				
			||||||
    ld [wDecayCounter], a
 | 
					    ld [wDecayCounter], a
 | 
				
			||||||
    ld [wGradeGauge], a
 | 
					    ld [wGradeGauge], a
 | 
				
			||||||
 | 
					    ld [wTGM1level300RequirementMet], a
 | 
				
			||||||
 | 
					    ld [wTGM1level500RequirementMet], a
 | 
				
			||||||
 | 
					    ld [wTGM1level999RequirementMet], a
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    ; Most modes begin ungraded.
 | 
					    ; Most modes begin ungraded.
 | 
				
			||||||
    ld a, GRADE_NONE
 | 
					    ld a, GRADE_NONE
 | 
				
			||||||
| 
						 | 
					@ -683,9 +689,14 @@ UpdateGradeTGM1:
 | 
				
			||||||
    cp a, GRADE_GM
 | 
					    cp a, GRADE_GM
 | 
				
			||||||
    ret z
 | 
					    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.
 | 
					    ; Skip to GM check if already S9.
 | 
				
			||||||
    cp a, GRADE_S9
 | 
					    cp a, GRADE_S9
 | 
				
			||||||
    jr nc, .maybegm
 | 
					    jp nc, .check999
 | 
				
			||||||
 | 
					
 | 
				
			||||||
.trygradeup
 | 
					.trygradeup
 | 
				
			||||||
    ; Otherwise, check if we can increase the grade.
 | 
					    ; Otherwise, check if we can increase the grade.
 | 
				
			||||||
| 
						 | 
					@ -724,7 +735,7 @@ UpdateGradeTGM1:
 | 
				
			||||||
    ; Return if C < E. Otherwise increase the grade.
 | 
					    ; Return if C < E. Otherwise increase the grade.
 | 
				
			||||||
    ld a, c
 | 
					    ld a, c
 | 
				
			||||||
    cp a, e
 | 
					    cp a, e
 | 
				
			||||||
    ret c
 | 
					    jr c, .check300
 | 
				
			||||||
 | 
					
 | 
				
			||||||
.increasegrade
 | 
					.increasegrade
 | 
				
			||||||
    ; Add 1 to the grade.
 | 
					    ; Add 1 to the grade.
 | 
				
			||||||
| 
						 | 
					@ -748,15 +759,118 @@ UpdateGradeTGM1:
 | 
				
			||||||
    ; Loop and see if we can increment more grades.
 | 
					    ; Loop and see if we can increment more grades.
 | 
				
			||||||
    ld a, [wDisplayedGrade]
 | 
					    ld a, [wDisplayedGrade]
 | 
				
			||||||
    cp a, GRADE_S9 ; Don't go past S9.
 | 
					    cp a, GRADE_S9 ; Don't go past S9.
 | 
				
			||||||
    ret z
 | 
					    jr nz, .trygradeup
 | 
				
			||||||
    jr .trygradeup
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
.maybegm
 | 
					
 | 
				
			||||||
    ; Level needs to be 1000 or greater.
 | 
					.check300
 | 
				
			||||||
    ld a, [hCLevel+CLEVEL_THOUSANDS] ; Level, thousands digit.
 | 
					    ; Are we at level 300?
 | 
				
			||||||
    cp a, 1
 | 
					    ld a, [hCLevel+CLEVEL_HUNDREDS]
 | 
				
			||||||
 | 
					    cp a, 3
 | 
				
			||||||
    ret c
 | 
					    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
 | 
					    ; Set the grade to GM
 | 
				
			||||||
    ld a, GRADE_GM
 | 
					    ld a, GRADE_GM
 | 
				
			||||||
    ld [wDisplayedGrade], a
 | 
					    ld [wDisplayedGrade], a
 | 
				
			||||||
| 
						 | 
					@ -773,6 +887,11 @@ UpdateGradeTGM1:
 | 
				
			||||||
    ; Return
 | 
					    ; Return
 | 
				
			||||||
    ret
 | 
					    ret
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					.fail999
 | 
				
			||||||
 | 
					    ld a, $01
 | 
				
			||||||
 | 
					    ld [wTGM1level999RequirementMet], a
 | 
				
			||||||
 | 
					    ret
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
UpdateGradeDEAT:
 | 
					UpdateGradeDEAT:
 | 
				
			||||||
    ; If we're disqualified, don't update the grade.
 | 
					    ; If we're disqualified, don't update the grade.
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -223,6 +223,8 @@ GamePlayEventLoopHandlerB::
 | 
				
			||||||
    call SFXKill
 | 
					    call SFXKill
 | 
				
			||||||
    ld a, SFX_READYGO
 | 
					    ld a, SFX_READYGO
 | 
				
			||||||
    call SFXEnqueue
 | 
					    call SFXEnqueue
 | 
				
			||||||
 | 
					    xor a, a
 | 
				
			||||||
 | 
					    ld [wReturnToSmall], a
 | 
				
			||||||
    ldh a, [hModeCounter]
 | 
					    ldh a, [hModeCounter]
 | 
				
			||||||
.firstleadyiterskip
 | 
					.firstleadyiterskip
 | 
				
			||||||
    dec a
 | 
					    dec a
 | 
				
			||||||
| 
						 | 
					@ -1002,6 +1004,8 @@ GamePlayBigEventLoopHandlerB:
 | 
				
			||||||
    call SFXKill
 | 
					    call SFXKill
 | 
				
			||||||
    ld a, SFX_READYGO
 | 
					    ld a, SFX_READYGO
 | 
				
			||||||
    call SFXEnqueue
 | 
					    call SFXEnqueue
 | 
				
			||||||
 | 
					    xor a, a
 | 
				
			||||||
 | 
					    ld [wReturnToSmall], a
 | 
				
			||||||
    ldh a, [hModeCounter]
 | 
					    ldh a, [hModeCounter]
 | 
				
			||||||
.firstleadyiterskip
 | 
					.firstleadyiterskip
 | 
				
			||||||
    dec a
 | 
					    dec a
 | 
				
			||||||
| 
						 | 
					@ -1397,6 +1401,9 @@ GamePlayBigEventLoopHandlerB:
 | 
				
			||||||
    ldh a, [hAState]
 | 
					    ldh a, [hAState]
 | 
				
			||||||
    cp a, 10 ; 10 frame hold
 | 
					    cp a, 10 ; 10 frame hold
 | 
				
			||||||
    jr nz, .noretry
 | 
					    jr nz, .noretry
 | 
				
			||||||
 | 
					    ld a, [wReturnToSmall]
 | 
				
			||||||
 | 
					    cp a, $FF
 | 
				
			||||||
 | 
					    jr z, .gosmall
 | 
				
			||||||
    call CheckAndAddHiscore
 | 
					    call CheckAndAddHiscore
 | 
				
			||||||
    call RNGInit
 | 
					    call RNGInit
 | 
				
			||||||
    call ScoreInit
 | 
					    call ScoreInit
 | 
				
			||||||
| 
						 | 
					@ -1412,6 +1419,23 @@ GamePlayBigEventLoopHandlerB:
 | 
				
			||||||
    ldh [hModeCounter], a
 | 
					    ldh [hModeCounter], a
 | 
				
			||||||
    jp .drawStaticInfo
 | 
					    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
 | 
					    ; Quit
 | 
				
			||||||
.noretry
 | 
					.noretry
 | 
				
			||||||
    ldh a, [hBState]
 | 
					    ldh a, [hBState]
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue