Remove RTC (#1) and remove time of day dependence on RTC (#7) [Commit 1]

This commit is contained in:
xCrystal
2023-07-27 20:32:15 +02:00
parent 59bda0b36b
commit 0571144a7b
32 changed files with 40 additions and 2276 deletions

View File

@@ -75,12 +75,6 @@ AreYouABoyOrAreYouAGirl:
farcall InitGender
ret
if DEF(_DEBUG)
DebugRoom: ; unreferenced
farcall _DebugRoom
ret
endc
ResetWRAM:
xor a
ldh [hBGMapMode], a
@@ -322,17 +316,11 @@ Continue:
ld c, 20
call DelayFrames
call ConfirmContinue
jr nc, .Check1Pass
jr nc, .CheckPass
call CloseWindow
jr .FailToLoad
.Check1Pass:
call Continue_CheckRTC_RestartClock
jr nc, .Check2Pass
call CloseWindow
jr .FailToLoad
.Check2Pass:
.CheckPass:
ld a, $8
ld [wMusicFade], a
ld a, LOW(MUSIC_NONE)
@@ -345,7 +333,6 @@ Continue:
ld c, 20
call DelayFrames
farcall JumpRoamMons
farcall ClockContinue
ld a, [wSpawnAfterChampion]
cp SPAWN_LEVEL_1
jr z, .SpawnAfterE4
@@ -388,21 +375,6 @@ ConfirmContinue:
.PressA:
ret
Continue_CheckRTC_RestartClock:
call CheckRTCStatus
and %10000000 ; Day count exceeded 16383
jr z, .pass
farcall RestartClock
ld a, c
and a
jr z, .pass
scf
ret
.pass
xor a
ret
FinishContinueFunction:
.loop
xor a
@@ -424,14 +396,6 @@ FinishContinueFunction:
jr .loop
DisplaySaveInfoOnContinue:
call CheckRTCStatus
and %10000000
jr z, .clock_ok
lb de, 4, 8
call DisplayContinueDataWithRTCError
ret
.clock_ok
lb de, 4, 8
call DisplayNormalContinueData
ret
@@ -448,14 +412,6 @@ DisplayNormalContinueData:
call UpdateSprites
ret
DisplayContinueDataWithRTCError:
call Continue_LoadMenuHeader
call Continue_DisplayBadgesDexPlayerName
call Continue_UnknownGameTime
call LoadFontsExtra
call UpdateSprites
ret
Continue_LoadMenuHeader:
xor a
ldh [hBGMapMode], a
@@ -528,16 +484,6 @@ Continue_PrintGameTime:
call Continue_DisplayGameTime
ret
Continue_UnknownGameTime:
decoord 9, 8, 0
add hl, de
ld de, .three_question_marks
call PlaceString
ret
.three_question_marks
db " ???@"
Continue_DisplayBadgeCount:
push hl
ld hl, wJohtoBadges
@@ -576,7 +522,6 @@ Continue_DisplayGameTime:
jp PrintNum
OakSpeech:
farcall InitClock
call RotateFourPalettesLeft
call ClearTilemap
@@ -909,7 +854,6 @@ Intro_PlacePlayerSprite:
const TITLESCREENOPTION_DELETE_SAVE_DATA
const TITLESCREENOPTION_RESTART
const TITLESCREENOPTION_UNUSED
const TITLESCREENOPTION_RESET_CLOCK
DEF NUM_TITLESCREENOPTIONS EQU const_value
IntroSequence:
@@ -972,7 +916,6 @@ StartTitleScreen:
dw DeleteSaveData
dw IntroSequence
dw IntroSequence
dw ResetClock
.TitleScreen:
farcall _TitleScreen
@@ -1109,38 +1052,7 @@ TitleScreenMain:
cp D_UP + B_BUTTON + SELECT
jr z, .delete_save_data
; To bring up the clock reset dialog:
; Hold Down + B + Select to initiate the sequence.
ldh a, [hClockResetTrigger]
cp $34
jr z, .check_clock_reset
ld a, [hl]
and D_DOWN + B_BUTTON + SELECT
cp D_DOWN + B_BUTTON + SELECT
jr nz, .check_start
ld a, $34
ldh [hClockResetTrigger], a
jr .check_start
; Keep Select pressed, and hold Left + Up.
; Then let go of Select.
.check_clock_reset
bit SELECT_F, [hl]
jr nz, .check_start
xor a
ldh [hClockResetTrigger], a
ld a, [hl]
and D_LEFT + D_UP
cp D_LEFT + D_UP
jr z, .reset_clock
; Press Start or A to start the game.
.check_start
ld a, [hl]
and START | A_BUTTON
jr nz, .incave
@@ -1177,15 +1089,6 @@ TitleScreenMain:
inc [hl]
ret
.reset_clock
ld a, TITLESCREENOPTION_RESET_CLOCK
ld [wTitleScreenSelectedOption], a
; Return to the intro sequence.
ld hl, wJumptableIndex
set 7, [hl]
ret
TitleScreenEnd:
; Wait until the music is done fading.
@@ -1208,61 +1111,6 @@ DeleteSaveData:
farcall _DeleteSaveData
jp Init
ResetClock:
farcall _ResetClock
jp Init
UpdateTitleTrailSprite: ; unreferenced
; If bit 0 or 1 of [wTitleScreenTimer] is set, we don't need to be here.
ld a, [wTitleScreenTimer]
and %00000011
ret nz
ld bc, wSpriteAnim10
ld hl, SPRITEANIMSTRUCT_FRAME
add hl, bc
ld l, [hl]
ld h, 0
add hl, hl
add hl, hl
ld de, .TitleTrailCoords
add hl, de
; If bit 2 of [wTitleScreenTimer] is set, get the second coords; else, get the first coords
ld a, [wTitleScreenTimer]
and %00000100
srl a
srl a
ld e, a
ld d, 0
add hl, de
add hl, de
ld a, [hli]
and a
ret z
ld e, a
ld d, [hl]
ld a, SPRITE_ANIM_INDEX_GS_TITLE_TRAIL
call InitSpriteAnimStruct
ret
.TitleTrailCoords:
MACRO trail_coords
rept _NARG / 2
DEF _dx = 4
if \1 == 0 && \2 == 0
DEF _dx = 0
endc
dbpixel \1, \2, _dx, 0
shift 2
endr
ENDM
; frame 0 y, x; frame 1 y, x
trail_coords 11, 10, 0, 0
trail_coords 11, 13, 11, 11
trail_coords 11, 13, 11, 15
trail_coords 11, 17, 11, 15
trail_coords 0, 0, 11, 15
trail_coords 0, 0, 11, 11
Copyright:
call ClearTilemap
call LoadFontsExtra

View File

@@ -55,9 +55,6 @@ MainMenu:
db "CONTINUE@"
db "NEW GAME@"
db "OPTION@"
db "MYSTERY GIFT@"
db "MOBILE@"
db "MOBILE STUDIUM@"
if DEF(_DEBUG)
db "DEBUG ROOM@"
endc
@@ -147,58 +144,26 @@ MainMenu_PrintCurrentTimeAndDay:
ret
.PlaceBox:
call CheckRTCStatus
and %10000000 ; Day count exceeded 16383
jr nz, .TimeFail
hlcoord 0, 14
ld b, 2
ld c, 18
call Textbox
ret
.TimeFail:
call SpeechTextbox
ret
.PlaceTime:
ld a, [wSaveFileExists]
and a
ret z
call CheckRTCStatus
and $80
jp nz, .PrintTimeNotSet
call UpdateTime
call GetWeekday
ld b, a
decoord 1, 15
call .PrintDayOfWeek
ld a, [wTimeOfDay]
maskbits NUM_DAYTIMES
decoord 4, 16
ldh a, [hHours]
ld c, a
farcall PrintHour
ld [hl], ":"
inc hl
ld de, hMinutes
lb bc, PRINTNUM_LEADINGZEROS | 1, 2
call PrintNum
call .PrintTimeOfDay
ret
.minString: ; unreferenced
db "min.@"
.PrintTimeNotSet:
hlcoord 1, 14
ld de, .TimeNotSetString
call PlaceString
ret
.TimeNotSetString:
db "TIME NOT SET@"
.MainMenuTimeUnknownText: ; unreferenced
text_far _MainMenuTimeUnknownText
text_end
.PrintDayOfWeek:
push de
ld hl, .Days
@@ -225,6 +190,22 @@ MainMenu_PrintCurrentTimeAndDay:
.Day:
db "DAY@"
.PrintTimeOfDay:
push de
ld hl, .TimesOfDay
call GetNthString
ld d, h
ld e, l
pop hl
call PlaceString
ret
.TimesOfDay:
db "MORN@"
db "DAY@"
db "NITE@"
db "NITE@"
ClearTilemapEtc:
xor a
ldh [hMapAnims], a
@@ -245,3 +226,9 @@ MainMenu_Option:
MainMenu_Continue:
farcall Continue
ret
if DEF(_DEBUG)
MainMenu_DebugRoom:
farcall _DebugRoom
ret
endc

View File

@@ -263,7 +263,7 @@ MenuJoypadLoop:
Do2DMenuRTCJoypad:
.loopRTC
call UpdateTimeAndPals
call UpdateTimeSensitivePals
call Menu_WasButtonPressed
ret c
ld a, [w2DMenuFlags1]

View File

@@ -25,13 +25,11 @@ SaveMenu:
SaveAfterLinkTrade:
call PauseGameLogic
farcall StageRTCTimeForSave
call SavePokemonData
call SaveChecksum
call SaveBackupPokemonData
call SaveBackupChecksum
farcall BackupPartyMonMail
farcall SaveRTC
call ResumeGameLogic
ret
@@ -90,7 +88,6 @@ MoveMonWOMail_InsertMon_SaveGame:
ld [wCurBox], a
ld a, TRUE
ld [wSaveFileExists], a
farcall StageRTCTimeForSave
call ValidateSave
call SaveOptions
call SavePlayerData
@@ -102,7 +99,6 @@ MoveMonWOMail_InsertMon_SaveGame:
call SaveBackupPokemonData
call SaveBackupChecksum
farcall BackupPartyMonMail
farcall SaveRTC
call LoadBox
call ResumeGameLogic
ld de, SFX_SAVE
@@ -263,7 +259,6 @@ SavedTheGame:
_SaveGameData:
ld a, TRUE
ld [wSaveFileExists], a
farcall StageRTCTimeForSave
call ValidateSave
call SaveOptions
call SavePlayerData
@@ -277,7 +272,6 @@ _SaveGameData:
call SaveBackupChecksum
call UpdateStackTop
farcall BackupPartyMonMail
farcall SaveRTC
ret
UpdateStackTop:
@@ -593,7 +587,6 @@ TryLoadSaveData:
ld de, wOptions
ld bc, wOptionsEnd - wOptions
call CopyBytes
call ClearClock
ret
INCLUDE "data/default_options.asm"

View File

@@ -19,7 +19,6 @@ TrainerCard:
set NO_TEXT_SCROLL, [hl]
call .InitRAM
.loop
call UpdateTime
call JoyTextDelay
ld a, [wJumptableIndex]
bit 7, a