mirror of
https://gitlab.com/xCrystal/pokecrystal-board.git
synced 2024-11-16 11:27:33 -08:00
Save functions; feeble attempt at serial and link functions
This commit is contained in:
parent
af0119ca7e
commit
6a3b3e3773
@ -2020,7 +2020,7 @@ MovePKMNWitoutMail_InsertMon: ; e31e7
|
||||
.dw_return ; e322a
|
||||
pop af
|
||||
ld e, a
|
||||
callba Function14ad5
|
||||
callba MovePkmnWOMail_InsertMon_SaveGame
|
||||
ret
|
||||
; e3233
|
||||
|
||||
|
@ -1942,20 +1942,20 @@ LinkTrade: ; 28b87
|
||||
pop af
|
||||
ld c, a
|
||||
cp MEW
|
||||
jr z, .asm_28e49
|
||||
jr z, .loop
|
||||
ld a, [CurPartySpecies]
|
||||
cp MEW
|
||||
jr z, .asm_28e49
|
||||
jr z, .loop
|
||||
ld b, $2
|
||||
ld a, c
|
||||
cp CELEBI
|
||||
jr z, .asm_28e49
|
||||
jr z, .loop
|
||||
ld a, [CurPartySpecies]
|
||||
cp CELEBI
|
||||
jr z, .asm_28e49
|
||||
jr z, .loop
|
||||
ld b, $0
|
||||
|
||||
.asm_28e49
|
||||
.loop
|
||||
ld a, b
|
||||
ld [wPlayerLinkAction], a
|
||||
push bc
|
||||
@ -1963,16 +1963,16 @@ LinkTrade: ; 28b87
|
||||
pop bc
|
||||
ld a, [wLinkMode]
|
||||
cp LINK_TIMECAPSULE
|
||||
jr z, .asm_28e63
|
||||
jr z, .save
|
||||
ld a, b
|
||||
and a
|
||||
jr z, .asm_28e63
|
||||
jr z, .save
|
||||
ld a, [wOtherPlayerLinkAction]
|
||||
cp b
|
||||
jr nz, .asm_28e49
|
||||
jr nz, .loop
|
||||
|
||||
.asm_28e63
|
||||
callba Function14a58
|
||||
.save
|
||||
callba SaveAfterLinkTrade
|
||||
callba MobileFn_1060af
|
||||
callba BackupMobileEventIndex
|
||||
ld c, 40
|
||||
@ -2255,7 +2255,7 @@ Special_WaitForLinkedFriend: ; 29d11
|
||||
|
||||
.asm_29d2f
|
||||
ld a, $2
|
||||
ld [wcf5c], a
|
||||
ld [wcf5b + 1], a
|
||||
ld a, $ff
|
||||
ld [wcf5b], a
|
||||
.asm_29d39
|
||||
@ -2278,9 +2278,9 @@ Special_WaitForLinkedFriend: ; 29d11
|
||||
dec a
|
||||
ld [wcf5b], a
|
||||
jr nz, .asm_29d68
|
||||
ld a, [wcf5c]
|
||||
ld a, [wcf5b + 1]
|
||||
dec a
|
||||
ld [wcf5c], a
|
||||
ld [wcf5b + 1], a
|
||||
jr z, .asm_29d8d
|
||||
|
||||
.asm_29d68
|
||||
@ -2384,24 +2384,24 @@ Function29e0c: ; 29e0c
|
||||
ld [hFFCA], a
|
||||
ld a, [wcf5b]
|
||||
ld h, a
|
||||
ld a, [wcf5c]
|
||||
ld a, [wcf5b + 1]
|
||||
ld l, a
|
||||
push hl
|
||||
call Function29e3b
|
||||
call .CheckConnected
|
||||
pop hl
|
||||
jr nz, .asm_29e2f
|
||||
call Function29e47
|
||||
call Function29e53
|
||||
call Function29e3b
|
||||
jr nz, .asm_29e2f
|
||||
call Function29e47
|
||||
jr nz, .load_true
|
||||
call .AcknowledgeSerial
|
||||
call .ConvertDW
|
||||
call .CheckConnected
|
||||
jr nz, .load_true
|
||||
call .AcknowledgeSerial
|
||||
xor a
|
||||
jr .asm_29e31
|
||||
jr .load_scriptvar
|
||||
|
||||
.asm_29e2f
|
||||
.load_true
|
||||
ld a, $1
|
||||
|
||||
.asm_29e31
|
||||
.load_scriptvar
|
||||
ld [ScriptVar], a
|
||||
ld hl, wcf5b
|
||||
xor a
|
||||
@ -2410,7 +2410,7 @@ Function29e0c: ; 29e0c
|
||||
ret
|
||||
; 29e3b
|
||||
|
||||
Function29e3b: ; 29e3b
|
||||
.CheckConnected: ; 29e3b
|
||||
call Function87d
|
||||
ld hl, wcf5b
|
||||
ld a, [hli]
|
||||
@ -2421,17 +2421,19 @@ Function29e3b: ; 29e3b
|
||||
ret
|
||||
; 29e47
|
||||
|
||||
Function29e47: ; 29e47
|
||||
ld b, $a
|
||||
.asm_29e49
|
||||
.AcknowledgeSerial: ; 29e47
|
||||
ld b, 10
|
||||
.loop
|
||||
call DelayFrame
|
||||
call LinkDataReceived
|
||||
dec b
|
||||
jr nz, .asm_29e49
|
||||
jr nz, .loop
|
||||
ret
|
||||
; 29e53
|
||||
|
||||
Function29e53: ; 29e53
|
||||
.ConvertDW: ; 29e53
|
||||
; hl = ((hl - $100) / 4) + $100
|
||||
; = (hl / 4) + $c0
|
||||
dec h
|
||||
srl h
|
||||
rr l
|
||||
@ -2441,7 +2443,7 @@ Function29e53: ; 29e53
|
||||
ld a, h
|
||||
ld [wcf5b], a
|
||||
ld a, l
|
||||
ld [wcf5c], a
|
||||
ld [wcf5b + 1], a
|
||||
ret
|
||||
; 29e66
|
||||
|
||||
|
@ -4,7 +4,7 @@ SaveMenu: ; 14a1a
|
||||
call SpeechTextBox
|
||||
call UpdateSprites
|
||||
callba SaveMenu_LoadEDTile
|
||||
ld hl, UnknownText_0x15283
|
||||
ld hl, Text_WouldYouLikeToSaveTheGame
|
||||
call SaveTheGame_yesorno
|
||||
jr nz, .refused
|
||||
call AskOverwriteSaveFile
|
||||
@ -23,7 +23,7 @@ SaveMenu: ; 14a1a
|
||||
scf
|
||||
ret
|
||||
|
||||
Function14a58: ; 14a58
|
||||
SaveAfterLinkTrade: ; 14a58
|
||||
call PauseGameLogic
|
||||
callba StageRTCTimeForSave
|
||||
callba BackupMysteryGift
|
||||
@ -40,7 +40,7 @@ Function14a58: ; 14a58
|
||||
|
||||
ChangeBoxSaveGame: ; 14a83 (5:4a83)
|
||||
push de
|
||||
ld hl, UnknownText_0x152a1
|
||||
ld hl, Text_SaveOnBoxSwitch
|
||||
call MenuTextBox
|
||||
call YesNoBox
|
||||
call ExitMenu
|
||||
@ -86,7 +86,7 @@ MovePkmnWOMail_SaveGame: ; 14ac2
|
||||
ret
|
||||
; 14ad5
|
||||
|
||||
Function14ad5: ; 14ad5
|
||||
MovePkmnWOMail_InsertMon_SaveGame: ; 14ad5
|
||||
call PauseGameLogic
|
||||
push de
|
||||
call SaveBox
|
||||
@ -120,7 +120,7 @@ Function14ad5: ; 14ad5
|
||||
; 14b34
|
||||
|
||||
StartMovePkmnWOMail_SaveGame: ; 14b34
|
||||
ld hl, UnknownText_0x152a6
|
||||
ld hl, Text_SaveOnMovePkmnWOMail
|
||||
call MenuTextBox
|
||||
call YesNoBox
|
||||
call ExitMenu
|
||||
@ -184,13 +184,13 @@ AskOverwriteSaveFile: ; 14b89
|
||||
jr z, .erase
|
||||
call CompareLoadedAndSavedPlayerID
|
||||
jr z, .yoursavefile
|
||||
ld hl, UnknownText_0x15297
|
||||
ld hl, Text_AnotherSaveFile
|
||||
call SaveTheGame_yesorno
|
||||
jr nz, .refused
|
||||
jr .erase
|
||||
|
||||
.yoursavefile
|
||||
ld hl, UnknownText_0x15292
|
||||
ld hl, Text_AlreadyASaveFile
|
||||
call SaveTheGame_yesorno
|
||||
jr nz, .refused
|
||||
jr .ok
|
||||
@ -208,7 +208,7 @@ AskOverwriteSaveFile: ; 14b89
|
||||
; 14baf
|
||||
|
||||
SaveTheGame_yesorno: ; 14baf
|
||||
ld b, BANK(UnknownText_0x15283)
|
||||
ld b, BANK(Text_WouldYouLikeToSaveTheGame)
|
||||
call MapTextbox
|
||||
call LoadMenuTextBox
|
||||
lb bc, 0, 7
|
||||
@ -253,7 +253,7 @@ SavedTheGame: ; 14be6
|
||||
ld a, 3
|
||||
ld [Options], a
|
||||
; <PLAYER> saved the game!
|
||||
ld hl, UnknownText_0x1528d
|
||||
ld hl, Text_PlayerSavedTheGame
|
||||
call PrintText
|
||||
; restore the original text speed setting
|
||||
pop af
|
||||
@ -355,7 +355,7 @@ SavingDontTurnOffThePower: ; 14c99
|
||||
ld a, $3
|
||||
ld [Options], a
|
||||
; SAVING... DON'T TURN OFF THE POWER.
|
||||
ld hl, UnknownText_0x15288
|
||||
ld hl, Text_SavingDontTurnOffThePower
|
||||
call PrintText
|
||||
; Restore the text speed setting
|
||||
pop af
|
||||
@ -416,17 +416,18 @@ EraseHallOfFame: ; 14d06
|
||||
; 14d18
|
||||
|
||||
Function14d18: ; 14d18
|
||||
; copy Unknown_14d2c to SRA4:a007
|
||||
; XXX
|
||||
; copy .Data to SRA4:a007
|
||||
ld a, $4
|
||||
call GetSRAMBank
|
||||
ld hl, Unknown_14d2c
|
||||
ld hl, .Data
|
||||
ld de, $a007
|
||||
ld bc, 48
|
||||
ld bc, .DataEnd - .Data
|
||||
call CopyBytes
|
||||
jp CloseSRAM
|
||||
; 14d2c
|
||||
|
||||
Unknown_14d2c: ; 14d2c
|
||||
.Data: ; 14d2c
|
||||
db $0d, $02, $00, $05, $00, $00
|
||||
db $22, $02, $01, $05, $00, $00
|
||||
db $03, $04, $05, $08, $03, $05
|
||||
@ -436,6 +437,7 @@ Unknown_14d2c: ; 14d2c
|
||||
db $0f, $05, $14, $07, $05, $05
|
||||
db $11, $0c, $0c, $06, $06, $04
|
||||
; 14d5c
|
||||
.DataEnd
|
||||
|
||||
EraseBattleTowerStatus: ; 14d5c
|
||||
ld a, BANK(sBattleTowerChallengeState)
|
||||
@ -451,6 +453,7 @@ SaveData: ; 14d68
|
||||
; 14d6c
|
||||
|
||||
Function14d6c: ; 14d6c
|
||||
; XXX
|
||||
ld a, $4
|
||||
call GetSRAMBank
|
||||
ld a, [$a60b]
|
||||
@ -467,6 +470,7 @@ Function14d6c: ; 14d6c
|
||||
; 14d83
|
||||
|
||||
Function14d83: ; 14d83
|
||||
; XXX
|
||||
ld a, $4
|
||||
call GetSRAMBank
|
||||
xor a
|
||||
@ -477,6 +481,7 @@ Function14d83: ; 14d83
|
||||
; 14d93
|
||||
|
||||
Function14d93: ; 14d93
|
||||
; XXX
|
||||
ld a, $7
|
||||
call GetSRAMBank
|
||||
xor a
|
||||
@ -664,7 +669,7 @@ TryLoadSaveFile: ; 14ea5 (5:4ea5)
|
||||
push af
|
||||
set NO_TEXT_SCROLL, a
|
||||
ld [Options], a
|
||||
ld hl, UnknownText_0x1529c
|
||||
ld hl, Text_SaveFileCorrupted
|
||||
call PrintText
|
||||
pop af
|
||||
ld [Options], a
|
||||
@ -1156,49 +1161,49 @@ Checksum: ; 15273
|
||||
; 15283
|
||||
|
||||
|
||||
UnknownText_0x15283: ; 0x15283
|
||||
Text_WouldYouLikeToSaveTheGame: ; 0x15283
|
||||
; Would you like to save the game?
|
||||
text_jump UnknownText_0x1c454b
|
||||
db "@"
|
||||
; 0x15288
|
||||
|
||||
UnknownText_0x15288: ; 0x15288
|
||||
Text_SavingDontTurnOffThePower: ; 0x15288
|
||||
; SAVING… DON'T TURN OFF THE POWER.
|
||||
text_jump UnknownText_0x1c456d
|
||||
db "@"
|
||||
; 0x1528d
|
||||
|
||||
UnknownText_0x1528d: ; 0x1528d
|
||||
Text_PlayerSavedTheGame: ; 0x1528d
|
||||
; saved the game.
|
||||
text_jump UnknownText_0x1c4590
|
||||
db "@"
|
||||
; 0x15292
|
||||
|
||||
UnknownText_0x15292: ; 0x15292
|
||||
Text_AlreadyASaveFile: ; 0x15292
|
||||
; There is already a save file. Is it OK to overwrite?
|
||||
text_jump UnknownText_0x1c45a3
|
||||
db "@"
|
||||
; 0x15297
|
||||
|
||||
UnknownText_0x15297: ; 0x15297
|
||||
Text_AnotherSaveFile: ; 0x15297
|
||||
; There is another save file. Is it OK to overwrite?
|
||||
text_jump UnknownText_0x1c45d9
|
||||
db "@"
|
||||
; 0x1529c
|
||||
|
||||
UnknownText_0x1529c: ; 0x1529c
|
||||
Text_SaveFileCorrupted: ; 0x1529c
|
||||
; The save file is corrupted!
|
||||
text_jump UnknownText_0x1c460d
|
||||
db "@"
|
||||
; 0x152a1
|
||||
|
||||
UnknownText_0x152a1: ; 0x152a1
|
||||
Text_SaveOnBoxSwitch: ; 0x152a1
|
||||
; When you change a #MON BOX, data will be saved. OK?
|
||||
text_jump UnknownText_0x1c462a
|
||||
db "@"
|
||||
; 0x152a6
|
||||
|
||||
UnknownText_0x152a6: ; 0x152a6
|
||||
Text_SaveOnMovePkmnWOMail: ; 0x152a6
|
||||
; Each time you move a #MON, data will be saved. OK?
|
||||
text_jump UnknownText_0x1c465f
|
||||
db "@"
|
||||
|
@ -78,7 +78,7 @@ Serial:: ; 6ef
|
||||
.player2
|
||||
ld a, $1
|
||||
ld [hFFCA], a
|
||||
ld a, -2
|
||||
ld a, $fe
|
||||
ld [hSerialSend], a
|
||||
|
||||
.end
|
||||
@ -126,92 +126,93 @@ Function75f:: ; 75f
|
||||
; 78a
|
||||
|
||||
Function78a:: ; 78a
|
||||
.loop
|
||||
xor a
|
||||
ld [hFFCA], a
|
||||
ld a, [hLinkPlayerNumber]
|
||||
cp $2
|
||||
jr nz, .asm_79b
|
||||
jr nz, .not_player_2
|
||||
ld a, $1
|
||||
ld [rSC], a
|
||||
ld a, $81
|
||||
ld [rSC], a
|
||||
|
||||
.asm_79b
|
||||
.not_player_2
|
||||
.loop2
|
||||
ld a, [hFFCA]
|
||||
and a
|
||||
jr nz, .asm_7e5
|
||||
jr nz, .reset_ffca
|
||||
ld a, [hLinkPlayerNumber]
|
||||
cp $1
|
||||
jr nz, .asm_7c0
|
||||
call Function82b
|
||||
jr z, .asm_7c0
|
||||
call .asm_825
|
||||
jr nz, .not_player_1_or_wcf5b_zero
|
||||
call Checkwcf5bNonzero
|
||||
jr z, .not_player_1_or_wcf5b_zero
|
||||
call .delay_15_cycles
|
||||
push hl
|
||||
ld hl, wcf5c
|
||||
ld hl, wcf5b + 1
|
||||
inc [hl]
|
||||
jr nz, .asm_7b7
|
||||
jr nz, .no_rollover_up
|
||||
dec hl
|
||||
inc [hl]
|
||||
|
||||
.asm_7b7
|
||||
.no_rollover_up
|
||||
pop hl
|
||||
call Function82b
|
||||
jr nz, .asm_79b
|
||||
jp Function833
|
||||
call Checkwcf5bNonzero
|
||||
jr nz, .loop2
|
||||
jp SerialDisconnected
|
||||
|
||||
.asm_7c0
|
||||
.not_player_1_or_wcf5b_zero
|
||||
ld a, [rIE]
|
||||
and $f
|
||||
cp $8
|
||||
jr nz, .asm_79b
|
||||
jr nz, .loop2
|
||||
ld a, [wcf5d]
|
||||
dec a
|
||||
ld [wcf5d], a
|
||||
jr nz, .asm_79b
|
||||
jr nz, .loop2
|
||||
ld a, [wcf5d + 1]
|
||||
dec a
|
||||
ld [wcf5d + 1], a
|
||||
jr nz, .asm_79b
|
||||
jr nz, .loop2
|
||||
ld a, [hLinkPlayerNumber]
|
||||
cp $1
|
||||
jr z, .asm_7e5
|
||||
ld a, $ff
|
||||
.asm_7e2
|
||||
jr z, .reset_ffca
|
||||
ld a, 255
|
||||
.delay_255_cycles
|
||||
dec a
|
||||
jr nz, .asm_7e2
|
||||
jr nz, .delay_255_cycles
|
||||
|
||||
.asm_7e5
|
||||
.reset_ffca
|
||||
xor a
|
||||
ld [hFFCA], a
|
||||
ld a, [rIE]
|
||||
and $f
|
||||
sub $8
|
||||
jr nz, .asm_7f8
|
||||
jr nz, .rIE_not_equal_8
|
||||
ld [wcf5d], a
|
||||
ld a, $50
|
||||
ld [wcf5d + 1], a
|
||||
|
||||
.asm_7f8
|
||||
.rIE_not_equal_8
|
||||
ld a, [hSerialReceive]
|
||||
cp $fe
|
||||
ret nz
|
||||
call Function82b
|
||||
jr z, .asm_813
|
||||
call Checkwcf5bNonzero
|
||||
jr z, .wcf5b_zero
|
||||
push hl
|
||||
ld hl, wcf5c
|
||||
ld hl, wcf5b + 1
|
||||
ld a, [hl]
|
||||
dec a
|
||||
ld [hld], a
|
||||
inc a
|
||||
jr nz, .asm_80d
|
||||
jr nz, .no_rollover
|
||||
dec [hl]
|
||||
|
||||
.asm_80d
|
||||
.no_rollover
|
||||
pop hl
|
||||
call Function82b
|
||||
jr z, Function833
|
||||
call Checkwcf5bNonzero
|
||||
jr z, SerialDisconnected
|
||||
|
||||
.asm_813
|
||||
.wcf5b_zero
|
||||
ld a, [rIE]
|
||||
and $f
|
||||
cp $8
|
||||
@ -220,17 +221,17 @@ Function78a:: ; 78a
|
||||
ld a, [hl]
|
||||
ld [hSerialSend], a
|
||||
call DelayFrame
|
||||
jp Function78a
|
||||
jp .loop
|
||||
|
||||
.asm_825
|
||||
ld a, $f
|
||||
.asm_827
|
||||
.delay_15_cycles
|
||||
ld a, 15
|
||||
.delay_cycles
|
||||
dec a
|
||||
jr nz, .asm_827
|
||||
jr nz, .delay_cycles
|
||||
ret
|
||||
; 82b
|
||||
|
||||
Function82b:: ; 82b
|
||||
Checkwcf5bNonzero:: ; 82b
|
||||
push hl
|
||||
ld hl, wcf5b
|
||||
ld a, [hli]
|
||||
@ -239,10 +240,10 @@ Function82b:: ; 82b
|
||||
ret
|
||||
; 833
|
||||
|
||||
Function833:: ; 833
|
||||
SerialDisconnected:: ; 833
|
||||
dec a
|
||||
ld [wcf5b], a
|
||||
ld [wcf5c], a
|
||||
ld [wcf5b + 1], a
|
||||
ret
|
||||
; 83b
|
||||
|
||||
@ -294,18 +295,19 @@ Function87d:: ; 87d
|
||||
.loop
|
||||
call LinkTransfer
|
||||
call DelayFrame
|
||||
call Function82b
|
||||
call Checkwcf5bNonzero
|
||||
jr z, .check
|
||||
push hl
|
||||
ld hl, wcf5c
|
||||
ld hl, wcf5b + 1
|
||||
dec [hl]
|
||||
jr nz, .skip
|
||||
dec hl
|
||||
dec [hl]
|
||||
jr nz, .skip
|
||||
; We might be disconnected
|
||||
pop hl
|
||||
xor a
|
||||
jp Function833
|
||||
jp SerialDisconnected
|
||||
|
||||
.skip
|
||||
pop hl
|
||||
@ -395,6 +397,7 @@ LinkDataReceived:: ; 908
|
||||
; 919
|
||||
|
||||
Function919:: ; 919
|
||||
; XXX
|
||||
ld a, [wLinkMode]
|
||||
and a
|
||||
ret nz
|
||||
|
@ -5451,7 +5451,7 @@ Function102416: ; 102416
|
||||
Function102423: ; 102423
|
||||
call Function102921
|
||||
ret nc
|
||||
callba Function14a58
|
||||
callba SaveAfterLinkTrade
|
||||
callba MobileFn_1060af
|
||||
callba BackupMobileEventIndex
|
||||
ld hl, wcd4b
|
||||
|
@ -7331,7 +7331,7 @@ Function11b5c0: ; 11b5c0
|
||||
ld [wPokemonWithdrawDepositParameter], a
|
||||
callba RemoveMonFromPartyOrBox
|
||||
callba Function170807
|
||||
callba Function14a58
|
||||
callba SaveAfterLinkTrade
|
||||
jp Function11ad8a
|
||||
; 11b5e0
|
||||
|
||||
@ -7616,7 +7616,7 @@ Function11b7e5: ; 11b7e5
|
||||
callba EvolvePokemon
|
||||
xor a
|
||||
ld [wLinkMode], a
|
||||
callba Function14a58
|
||||
callba SaveAfterLinkTrade
|
||||
ld a, $5
|
||||
call GetSRAMBank
|
||||
ld a, $5
|
||||
@ -7781,7 +7781,7 @@ Function11b93b: ; 11b93b
|
||||
ld a, $c64b / $100
|
||||
ld [wMobileMonMailPointerBuffer + 1], a
|
||||
call AddMobileMonToParty
|
||||
callba Function14a58
|
||||
callba SaveAfterLinkTrade
|
||||
ret
|
||||
; 11b98f
|
||||
|
||||
|
@ -308,7 +308,7 @@ Function17d0f3: ; 17d0f3
|
||||
callba EvolvePokemon
|
||||
xor a
|
||||
ld [wLinkMode], a
|
||||
callba Function14a58
|
||||
callba SaveAfterLinkTrade
|
||||
ld a, $5
|
||||
call GetSRAMBank
|
||||
ld a, $5
|
||||
@ -3059,7 +3059,7 @@ Function17e37e: ; 17e37e
|
||||
push af
|
||||
ld a, $1
|
||||
ld [rSVBK], a
|
||||
callba Function14a58
|
||||
callba SaveAfterLinkTrade
|
||||
pop af
|
||||
ld [rSVBK], a
|
||||
ret
|
||||
|
Loading…
Reference in New Issue
Block a user