summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDizzyEggg <jajkodizzy@wp.pl>2018-04-29 14:21:59 +0200
committerDizzyEggg <jajkodizzy@wp.pl>2018-04-29 14:21:59 +0200
commitfd40e93cb5fe4eb43551ae1a8f584e86bcc7ecf1 (patch)
treef11f19ec5a47723dd02f35d48d5935d5c5c08579
parent25c669e36b8d23a24da567007bda1210ad9ce97e (diff)
clear item, save and load save files
-rw-r--r--asm/battle_frontier_2.s4
-rw-r--r--asm/cable_club.s8
-rw-r--r--asm/field_screen.s2
-rw-r--r--asm/rom_8011DC0.s16
-rw-r--r--common_syms/load_save.txt4
-rw-r--r--common_syms/random.txt2
-rw-r--r--data/scripts/cable_club.inc4
-rw-r--r--data/scripts/maps/BattleFrontier_BattleArenaBattleRoom.inc4
-rw-r--r--data/scripts/maps/BattleFrontier_BattleArenaLobby.inc10
-rw-r--r--data/scripts/maps/BattleFrontier_BattleDomeLobby.inc16
-rw-r--r--data/scripts/maps/BattleFrontier_BattleDomePreBattleRoom.inc2
-rw-r--r--data/scripts/maps/BattleFrontier_BattleFactoryLobby.inc10
-rw-r--r--data/scripts/maps/BattleFrontier_BattleFactoryPreBattleRoom.inc2
-rw-r--r--data/scripts/maps/BattleFrontier_BattlePalaceBattleRoom.inc4
-rw-r--r--data/scripts/maps/BattleFrontier_BattlePalaceLobby.inc10
-rw-r--r--data/scripts/maps/BattleFrontier_BattlePikeLobby.inc12
-rw-r--r--data/scripts/maps/BattleFrontier_BattlePikeThreePathRoom.inc4
-rw-r--r--data/scripts/maps/BattleFrontier_BattlePyramidEmptySquare.inc2
-rw-r--r--data/scripts/maps/BattleFrontier_BattlePyramidLobby.inc12
-rw-r--r--data/scripts/maps/BattleFrontier_BattlePyramidTop.inc2
-rw-r--r--data/scripts/maps/BattleFrontier_BattleTowerBattleRoom2.inc2
-rw-r--r--data/scripts/maps/BattleFrontier_BattleTowerLobby.inc22
-rw-r--r--data/scripts/maps/FallarborTown_BattleTentBattleRoom.inc8
-rw-r--r--data/scripts/maps/FallarborTown_BattleTentLobby.inc8
-rw-r--r--data/scripts/maps/MossdeepCity_SpaceCenter_2F.inc6
-rw-r--r--data/scripts/maps/PetalburgCity.inc4
-rw-r--r--data/scripts/maps/SlateportCity_BattleTentBattleRoom.inc4
-rw-r--r--data/scripts/maps/SlateportCity_BattleTentCorridor.inc2
-rw-r--r--data/scripts/maps/SlateportCity_BattleTentLobby.inc4
-rw-r--r--data/scripts/maps/SootopolisCity_MysteryEventsHouse_1F.inc10
-rw-r--r--data/scripts/maps/SootopolisCity_MysteryEventsHouse_B1F.inc2
-rw-r--r--data/scripts/maps/VerdanturfTown_BattleTentBattleRoom.inc8
-rw-r--r--data/scripts/maps/VerdanturfTown_BattleTentLobby.inc8
-rw-r--r--data/specials.inc6
-rw-r--r--include/item.h38
-rw-r--r--include/load_save.h26
-rw-r--r--include/strings.h12
-rw-r--r--src/item.c49
-rw-r--r--src/load_save.c83
-rw-r--r--src/random.c4
-rw-r--r--src/save.c31
-rw-r--r--sym_common.txt20
-rw-r--r--sym_ewram.txt5
43 files changed, 239 insertions, 253 deletions
diff --git a/asm/battle_frontier_2.s b/asm/battle_frontier_2.s
index 84228bc2d..71f105df8 100644
--- a/asm/battle_frontier_2.s
+++ b/asm/battle_frontier_2.s
@@ -19841,7 +19841,7 @@ _081A4C4E:
ble _081A4C4E
ldr r4, =gPlayerPartyCount
ldrb r5, [r4]
- bl copy_player_party_from_sav1
+ bl LoadPlayerParty
bl sub_8076D5C
movs r0, 0x1
bl TrySavingData
@@ -29770,7 +29770,7 @@ sub_81A9E90: @ 81A9E90
ldr r0, =0x0000400e
movs r1, 0
bl VarSet
- bl copy_player_party_from_sav1
+ bl LoadPlayerParty
_081A9EB8:
pop {r0}
bx r0
diff --git a/asm/cable_club.s b/asm/cable_club.s
index e6fbd1886..16264b9da 100644
--- a/asm/cable_club.s
+++ b/asm/cable_club.s
@@ -2157,8 +2157,8 @@ sub_80B360C: @ 80B360C
ands r0, r1
str r0, [r2]
bl Overworld_ResetMapMusic
- bl copy_player_party_from_sav1
- bl copy_bags_and_unk_data_to_save_blocks
+ bl LoadPlayerParty
+ bl SavePlayerBag
bl sub_813BF10
ldr r0, =gSpecialVar_0x8004
ldrh r0, [r0]
@@ -2251,8 +2251,8 @@ sub_80B36EC: @ 80B36EC
cmp r0, 0x9
bne _080B370E
_080B3706:
- bl copy_player_party_from_sav1
- bl copy_bags_and_unk_data_to_save_blocks
+ bl LoadPlayerParty
+ bl SavePlayerBag
_080B370E:
movs r0, 0x7F
bl copy_saved_warp2_bank_and_enter_x_to_warp1
diff --git a/asm/field_screen.s b/asm/field_screen.s
index 2a539d111..e3d48f882 100644
--- a/asm/field_screen.s
+++ b/asm/field_screen.s
@@ -8861,7 +8861,7 @@ sub_80AF87C: @ 80AF87C
movs r0, 0x1
bl sub_8085540
bl ScriptContext2_Enable
- bl save_serialize_npcs
+ bl SaveMapObjects
bl music_something
bl sub_80AF0B4
movs r0, 0x2D
diff --git a/asm/rom_8011DC0.s b/asm/rom_8011DC0.s
index 3a7f41d0b..21a9cca33 100644
--- a/asm/rom_8011DC0.s
+++ b/asm/rom_8011DC0.s
@@ -3278,8 +3278,8 @@ sub_8014210: @ 8014210
lsls r6, 16
lsrs r6, 16
bl HealPlayerParty
- bl copy_player_party_to_sav1
- bl copy_bags_and_unk_data_from_save_blocks
+ bl SavePlayerParty
+ bl LoadPlayerBag
ldr r5, =gLinkPlayers
ldr r0, =0x00002211
str r0, [r5, 0x14]
@@ -3646,8 +3646,8 @@ _080145F4:
movs r1, 0x1
bl sub_80143E4
bl HealPlayerParty
- bl copy_player_party_to_sav1
- bl copy_bags_and_unk_data_from_save_blocks
+ bl SavePlayerParty
+ bl LoadPlayerBag
movs r0, 0x1
str r0, [sp]
movs r0, 0x19
@@ -3659,8 +3659,8 @@ _080145F4:
_08014620:
bl overworld_free_bg_tilemaps
bl HealPlayerParty
- bl copy_player_party_to_sav1
- bl copy_bags_and_unk_data_from_save_blocks
+ bl SavePlayerParty
+ bl LoadPlayerBag
ldr r0, =gBlockSendBuffer
movs r1, 0x1
bl sub_80143E4
@@ -3675,8 +3675,8 @@ _08014620:
_0801464C:
bl overworld_free_bg_tilemaps
bl HealPlayerParty
- bl copy_player_party_to_sav1
- bl copy_bags_and_unk_data_from_save_blocks
+ bl SavePlayerParty
+ bl LoadPlayerBag
ldr r0, =gBlockSendBuffer
movs r1, 0x1
bl sub_80143E4
diff --git a/common_syms/load_save.txt b/common_syms/load_save.txt
new file mode 100644
index 000000000..2d3d9b802
--- /dev/null
+++ b/common_syms/load_save.txt
@@ -0,0 +1,4 @@
+gFlashMemoryPresent
+gSaveBlock1Ptr
+gSaveBlock2Ptr
+gPokemonStoragePtr
diff --git a/common_syms/random.txt b/common_syms/random.txt
new file mode 100644
index 000000000..8037c6958
--- /dev/null
+++ b/common_syms/random.txt
@@ -0,0 +1,2 @@
+gRngValue
+gRng2Value
diff --git a/data/scripts/cable_club.inc b/data/scripts/cable_club.inc
index e5b330bf3..4c9f2d4d7 100644
--- a/data/scripts/cable_club.inc
+++ b/data/scripts/cable_club.inc
@@ -450,8 +450,8 @@ OldaleTown_PokemonCenter_2F_EventScript_276F60:: @ 8276F60
OldaleTown_PokemonCenter_2F_EventScript_276FBD:: @ 8276FBD
special HealPlayerParty
- special copy_player_party_to_sav1
- special copy_bags_and_unk_data_from_save_blocks
+ special SavePlayerParty
+ special LoadPlayerBag
copyvar VAR_0x4087, VAR_0x8004
messageautoscroll OldaleTown_PokemonCenter_2F_Text_278197
waitmessage
diff --git a/data/scripts/maps/BattleFrontier_BattleArenaBattleRoom.inc b/data/scripts/maps/BattleFrontier_BattleArenaBattleRoom.inc
index 52351b549..88a0f9989 100644
--- a/data/scripts/maps/BattleFrontier_BattleArenaBattleRoom.inc
+++ b/data/scripts/maps/BattleFrontier_BattleArenaBattleRoom.inc
@@ -136,8 +136,8 @@ BattleFrontier_BattleArenaBattleRoom_EventScript_257630:: @ 8257630
applymovement 8, BattleFrontier_BattleArenaBattleRoom_Movement_257BEB
waitmovement 0
msgbox BattleFrontier_BattleArenaBattleRoom_Text_257CE9, 4
- special copy_player_party_from_sav1
- special copy_player_party_to_sav1
+ special LoadPlayerParty
+ special SavePlayerParty
setvar VAR_0x8004, 3
setvar VAR_0x8005, 3
special sub_81A1780
diff --git a/data/scripts/maps/BattleFrontier_BattleArenaLobby.inc b/data/scripts/maps/BattleFrontier_BattleArenaLobby.inc
index 303a2c4c9..85147b418 100644
--- a/data/scripts/maps/BattleFrontier_BattleArenaLobby.inc
+++ b/data/scripts/maps/BattleFrontier_BattleArenaLobby.inc
@@ -89,7 +89,7 @@ BattleFrontier_BattleArenaLobby_EventScript_255D2B:: @ 8255D2B
BattleFrontier_BattleArenaLobby_EventScript_255D59:: @ 8255D59
setvar VAR_0x8004, 8
special sub_81A1780
- special copy_player_party_from_sav1
+ special LoadPlayerParty
special HealPlayerParty
setvar VAR_0x8004, 3
setvar VAR_0x8005, 0
@@ -134,7 +134,7 @@ BattleFrontier_BattleArenaLobby_EventScript_255DF4:: @ 8255DF4
faceplayer
setvar VAR_FRONTIER_FACILITY, 3
setvar VAR_0x40CE, 0
- special copy_player_party_to_sav1
+ special SavePlayerParty
msgbox BattleFrontier_BattleArenaLobby_Text_256166, 4
BattleFrontier_BattleArenaLobby_EventScript_255E0B:: @ 8255E0B
@@ -196,7 +196,7 @@ BattleFrontier_BattleArenaLobby_EventScript_255EE8:: @ 8255EE8
setvar VAR_0x8005, 3
setvar VAR_0x8006, 0
special sub_81A1780
- special copy_player_party_from_sav1
+ special LoadPlayerParty
closemessage
delay 2
call BattleFrontier_BattleArenaLobby_EventScript_27134F
@@ -205,7 +205,7 @@ BattleFrontier_BattleArenaLobby_EventScript_255EE8:: @ 8255EE8
goto_eq BattleFrontier_BattleArenaLobby_EventScript_255FE1
BattleFrontier_BattleArenaLobby_EventScript_255F54:: @ 8255F54
- special copy_player_party_to_sav1
+ special SavePlayerParty
setvar VAR_0x8004, 3
setvar VAR_0x8005, 3
special sub_81A1780
@@ -248,7 +248,7 @@ BattleFrontier_BattleArenaLobby_EventScript_255FE1:: @ 8255FE1
goto BattleFrontier_BattleArenaLobby_EventScript_255FFB
BattleFrontier_BattleArenaLobby_EventScript_255FF8:: @ 8255FF8
- special copy_player_party_from_sav1
+ special LoadPlayerParty
BattleFrontier_BattleArenaLobby_EventScript_255FFB:: @ 8255FFB
msgbox BattleFrontier_BattleArenaLobby_Text_25621F, 4
diff --git a/data/scripts/maps/BattleFrontier_BattleDomeLobby.inc b/data/scripts/maps/BattleFrontier_BattleDomeLobby.inc
index 33b5654d0..aebe5abe3 100644
--- a/data/scripts/maps/BattleFrontier_BattleDomeLobby.inc
+++ b/data/scripts/maps/BattleFrontier_BattleDomeLobby.inc
@@ -76,7 +76,7 @@ BattleFrontier_BattleDomeLobby_EventScript_2498C9:: @ 82498C9
msgbox BattleFrontier_BattleDomeLobby_Text_241520, 9
message BattleFrontier_BattleDomeLobby_Text_24A5D6
waitmessage
- special copy_player_party_from_sav1
+ special LoadPlayerParty
setvar VAR_0x8004, 3
setvar VAR_0x8005, 3
special sub_81A1780
@@ -94,7 +94,7 @@ BattleFrontier_BattleDomeLobby_EventScript_2498C9:: @ 82498C9
setvar VAR_0x8005, 1
setvar VAR_0x8006, 1
special sub_818E9AC
- special copy_player_party_from_sav1
+ special LoadPlayerParty
special HealPlayerParty
goto BattleFrontier_BattleDomeLobby_EventScript_249991
@@ -103,7 +103,7 @@ BattleFrontier_BattleDomeLobby_EventScript_249940:: @ 8249940
msgbox BattleFrontier_BattleDomeLobby_Text_24A5BF, 4
message BattleFrontier_BattleDomeLobby_Text_24A5D6
waitmessage
- special copy_player_party_from_sav1
+ special LoadPlayerParty
setvar VAR_0x8004, 3
setvar VAR_0x8005, 3
special sub_81A1780
@@ -117,7 +117,7 @@ BattleFrontier_BattleDomeLobby_EventScript_249940:: @ 8249940
setvar VAR_0x8005, 6
setvar VAR_0x8006, 1
special sub_818E9AC
- special copy_player_party_from_sav1
+ special LoadPlayerParty
special HealPlayerParty
BattleFrontier_BattleDomeLobby_EventScript_249991:: @ 8249991
@@ -181,7 +181,7 @@ BattleFrontier_BattleDomeLobby_EventScript_249A47:: @ 8249A47
end
BattleFrontier_BattleDomeLobby_EventScript_249A59:: @ 8249A59
- special copy_player_party_to_sav1
+ special SavePlayerParty
compare VAR_0x40CE, 0
call_if 1, BattleFrontier_BattleDomeLobby_EventScript_249CFD
compare VAR_0x40CE, 1
@@ -245,7 +245,7 @@ BattleFrontier_BattleDomeLobby_EventScript_249B60:: @ 8249B60
setvar VAR_0x8005, 3
setvar VAR_0x8006, 0
special sub_81A1780
- special copy_player_party_from_sav1
+ special LoadPlayerParty
closemessage
delay 2
call BattleFrontier_BattleDomeLobby_EventScript_27134F
@@ -256,7 +256,7 @@ BattleFrontier_BattleDomeLobby_EventScript_249B60:: @ 8249B60
special sub_818E9AC
BattleFrontier_BattleDomeLobby_EventScript_249BC2:: @ 8249BC2
- special copy_player_party_to_sav1
+ special SavePlayerParty
setvar VAR_0x8004, 3
setvar VAR_0x8005, 3
special sub_81A1780
@@ -299,7 +299,7 @@ BattleFrontier_BattleDomeLobby_EventScript_249C4A:: @ 8249C4A
goto BattleFrontier_BattleDomeLobby_EventScript_249C64
BattleFrontier_BattleDomeLobby_EventScript_249C61:: @ 8249C61
- special copy_player_party_from_sav1
+ special LoadPlayerParty
BattleFrontier_BattleDomeLobby_EventScript_249C64:: @ 8249C64
msgbox BattleFrontier_BattleDomeLobby_Text_249F74, 4
diff --git a/data/scripts/maps/BattleFrontier_BattleDomePreBattleRoom.inc b/data/scripts/maps/BattleFrontier_BattleDomePreBattleRoom.inc
index 5de099292..a9b6af7f7 100644
--- a/data/scripts/maps/BattleFrontier_BattleDomePreBattleRoom.inc
+++ b/data/scripts/maps/BattleFrontier_BattleDomePreBattleRoom.inc
@@ -243,7 +243,7 @@ BattleFrontier_BattleDomePreBattleRoom_EventScript_24B5BE:: @ 824B5BE
BattleFrontier_BattleDomePreBattleRoom_EventScript_24B5C7:: @ 824B5C7
setvar VAR_0x4000, 1
msgbox BattleFrontier_BattleDomePreBattleRoom_Text_24B760, 4
- special copy_player_party_from_sav1
+ special LoadPlayerParty
setvar VAR_0x8004, 3
setvar VAR_0x8005, 3
special sub_81A1780
diff --git a/data/scripts/maps/BattleFrontier_BattleFactoryLobby.inc b/data/scripts/maps/BattleFrontier_BattleFactoryLobby.inc
index 791a666d5..5822ca318 100644
--- a/data/scripts/maps/BattleFrontier_BattleFactoryLobby.inc
+++ b/data/scripts/maps/BattleFrontier_BattleFactoryLobby.inc
@@ -74,7 +74,7 @@ BattleFrontier_BattleFactoryLobby_EventScript_2584C6:: @ 82584C6
waitmessage
setvar VAR_0x8004, 8
special sub_81A1780
- special copy_player_party_from_sav1
+ special LoadPlayerParty
setvar VAR_0x8004, 3
setvar VAR_0x8005, 0
special sub_81A5E74
@@ -89,7 +89,7 @@ BattleFrontier_BattleFactoryLobby_EventScript_258506:: @ 8258506
waitmessage
setvar VAR_0x8004, 8
special sub_81A1780
- special copy_player_party_from_sav1
+ special LoadPlayerParty
setvar VAR_0x8004, 2
setvar VAR_0x8005, 2
setvar VAR_0x8006, 0
@@ -154,7 +154,7 @@ BattleFrontier_BattleFactoryLobby_EventScript_2585DD:: @ 82585DD
end
BattleFrontier_BattleFactoryLobby_EventScript_2585ED:: @ 82585ED
- special copy_player_party_to_sav1
+ special SavePlayerParty
compare VAR_0x40CE, 0
call_if 1, BattleFrontier_BattleFactoryLobby_EventScript_2587B1
compare VAR_0x40CE, 1
@@ -215,7 +215,7 @@ BattleFrontier_BattleFactoryLobby_EventScript_2586B9:: @ 82586B9
setvar VAR_0x8006, 0
BattleFrontier_BattleFactoryLobby_EventScript_25871A:: @ 825871A
- special copy_player_party_to_sav1
+ special SavePlayerParty
msgbox BattleFrontier_BattleFactoryLobby_Text_258CB1, 4
closemessage
compare VAR_0x40CE, 0
@@ -253,7 +253,7 @@ BattleFrontier_BattleFactoryLobby_EventScript_258783:: @ 8258783
goto BattleFrontier_BattleFactoryLobby_EventScript_25879D
BattleFrontier_BattleFactoryLobby_EventScript_25879A:: @ 825879A
- special copy_player_party_from_sav1
+ special LoadPlayerParty
BattleFrontier_BattleFactoryLobby_EventScript_25879D:: @ 825879D
msgbox BattleFrontier_BattleFactoryLobby_Text_258BC5, 4
diff --git a/data/scripts/maps/BattleFrontier_BattleFactoryPreBattleRoom.inc b/data/scripts/maps/BattleFrontier_BattleFactoryPreBattleRoom.inc
index 4c0528e34..2f5cdeef2 100644
--- a/data/scripts/maps/BattleFrontier_BattleFactoryPreBattleRoom.inc
+++ b/data/scripts/maps/BattleFrontier_BattleFactoryPreBattleRoom.inc
@@ -236,7 +236,7 @@ BattleFrontier_BattleFactoryPreBattleRoom_EventScript_259E47:: @ 8259E47
end
BattleFrontier_BattleFactoryPreBattleRoom_EventScript_259E69:: @ 8259E69
- special copy_player_party_to_sav1
+ special SavePlayerParty
setvar VAR_0x8004, 10
setvar VAR_0x8005, 0
special sub_81A5E74
diff --git a/data/scripts/maps/BattleFrontier_BattlePalaceBattleRoom.inc b/data/scripts/maps/BattleFrontier_BattlePalaceBattleRoom.inc
index ccd285a3a..8393d7501 100644
--- a/data/scripts/maps/BattleFrontier_BattlePalaceBattleRoom.inc
+++ b/data/scripts/maps/BattleFrontier_BattlePalaceBattleRoom.inc
@@ -93,8 +93,8 @@ BattleFrontier_BattlePalaceBattleRoom_EventScript_24F911:: @ 824F911
applymovement 3, BattleFrontier_BattlePalaceBattleRoom_Movement_24FEAC
waitmovement 0
msgbox BattleFrontier_BattlePalaceBattleRoom_Text_24FF00, 4
- special copy_player_party_from_sav1
- special copy_player_party_to_sav1
+ special LoadPlayerParty
+ special SavePlayerParty
setvar VAR_0x8004, 3
setvar VAR_0x8005, 3
special sub_81A1780
diff --git a/data/scripts/maps/BattleFrontier_BattlePalaceLobby.inc b/data/scripts/maps/BattleFrontier_BattlePalaceLobby.inc
index 2e0f152b4..5cb6baad0 100644
--- a/data/scripts/maps/BattleFrontier_BattlePalaceLobby.inc
+++ b/data/scripts/maps/BattleFrontier_BattlePalaceLobby.inc
@@ -89,7 +89,7 @@ BattleFrontier_BattlePalaceLobby_EventScript_24D873:: @ 824D873
BattleFrontier_BattlePalaceLobby_EventScript_24D8A1:: @ 824D8A1
setvar VAR_0x8004, 8
special sub_81A1780
- special copy_player_party_from_sav1
+ special LoadPlayerParty
special HealPlayerParty
setvar VAR_0x8004, 7
setvar VAR_0x8005, 0
@@ -152,7 +152,7 @@ BattleFrontier_BattlePalaceLobby_EventScript_24D968:: @ 824D968
special sub_8195960
compare VAR_RESULT, 0
goto_if 5, BattleFrontier_BattlePalaceLobby_EventScript_24D817
- special copy_player_party_to_sav1
+ special SavePlayerParty
compare VAR_0x40CE, 0
call_if 1, BattleFrontier_BattlePalaceLobby_EventScript_24DB9E
compare VAR_0x40CE, 1
@@ -220,7 +220,7 @@ BattleFrontier_BattlePalaceLobby_EventScript_24DA87:: @ 824DA87
setvar VAR_0x8005, 3
setvar VAR_0x8006, 0
special sub_81A1780
- special copy_player_party_from_sav1
+ special LoadPlayerParty
closemessage
delay 2
call BattleFrontier_BattlePalaceLobby_EventScript_27134F
@@ -229,7 +229,7 @@ BattleFrontier_BattlePalaceLobby_EventScript_24DA87:: @ 824DA87
goto_eq BattleFrontier_BattlePalaceLobby_EventScript_24DB7A
BattleFrontier_BattlePalaceLobby_EventScript_24DAF3:: @ 824DAF3
- special copy_player_party_to_sav1
+ special SavePlayerParty
setvar VAR_0x8004, 3
setvar VAR_0x8005, 3
special sub_81A1780
@@ -272,7 +272,7 @@ BattleFrontier_BattlePalaceLobby_EventScript_24DB7A:: @ 824DB7A
goto BattleFrontier_BattlePalaceLobby_EventScript_24DB94
BattleFrontier_BattlePalaceLobby_EventScript_24DB91:: @ 824DB91
- special copy_player_party_from_sav1
+ special LoadPlayerParty
BattleFrontier_BattlePalaceLobby_EventScript_24DB94:: @ 824DB94
msgbox BattleFrontier_BattlePalaceLobby_Text_24E0D8, 4
diff --git a/data/scripts/maps/BattleFrontier_BattlePikeLobby.inc b/data/scripts/maps/BattleFrontier_BattlePikeLobby.inc
index 40b5e437f..05eb8ea33 100644
--- a/data/scripts/maps/BattleFrontier_BattlePikeLobby.inc
+++ b/data/scripts/maps/BattleFrontier_BattlePikeLobby.inc
@@ -76,7 +76,7 @@ BattleFrontier_BattlePikeLobby_EventScript_25B78D:: @ 825B78D
setvar VAR_0x8005, 3
copyvar VAR_0x8006, VAR_RESULT
special sub_81A703C
- special copy_player_party_from_sav1
+ special LoadPlayerParty
special HealPlayerParty
setvar VAR_0x8004, 27
special sub_81A703C
@@ -107,7 +107,7 @@ BattleFrontier_BattlePikeLobby_EventScript_25B806:: @ 825B806
setvar VAR_0x8005, 4
setvar VAR_0x8006, 0
special sub_81A703C
- special copy_player_party_from_sav1
+ special LoadPlayerParty
special HealPlayerParty
setvar VAR_0x8004, 27
special sub_81A703C
@@ -127,7 +127,7 @@ BattleFrontier_BattlePikeLobby_EventScript_25B868:: @ 825B868
faceplayer
setvar VAR_FRONTIER_FACILITY, 5
setvar VAR_0x40CE, 0
- special copy_player_party_to_sav1
+ special SavePlayerParty
msgbox BattleFrontier_BattlePikeLobby_Text_25BB52, 4
BattleFrontier_BattlePikeLobby_EventScript_25B87F:: @ 825B87F
@@ -192,7 +192,7 @@ BattleFrontier_BattlePikeLobby_EventScript_25B95C:: @ 825B95C
setvar VAR_0x8005, 3
setvar VAR_0x8006, 0
special sub_81A1780
- special copy_player_party_from_sav1
+ special LoadPlayerParty
closemessage
delay 2
call BattleFrontier_BattlePikeLobby_EventScript_27134F
@@ -201,7 +201,7 @@ BattleFrontier_BattlePikeLobby_EventScript_25B95C:: @ 825B95C
special sub_81A703C
compare VAR_RESULT, 0
goto_eq BattleFrontier_BattlePikeLobby_EventScript_25BA5C
- special copy_player_party_to_sav1
+ special SavePlayerParty
setvar VAR_0x8004, 3
setvar VAR_0x8005, 3
special sub_81A1780
@@ -242,7 +242,7 @@ BattleFrontier_BattlePikeLobby_EventScript_25BA5C:: @ 825BA5C
goto BattleFrontier_BattlePikeLobby_EventScript_25BA76
BattleFrontier_BattlePikeLobby_EventScript_25BA73:: @ 825BA73
- special copy_player_party_from_sav1
+ special LoadPlayerParty
BattleFrontier_BattlePikeLobby_EventScript_25BA76:: @ 825BA76
msgbox BattleFrontier_BattlePikeLobby_Text_25BE02, 4
diff --git a/data/scripts/maps/BattleFrontier_BattlePikeThreePathRoom.inc b/data/scripts/maps/BattleFrontier_BattlePikeThreePathRoom.inc
index 74da4c01c..d4723acc7 100644
--- a/data/scripts/maps/BattleFrontier_BattlePikeThreePathRoom.inc
+++ b/data/scripts/maps/BattleFrontier_BattlePikeThreePathRoom.inc
@@ -45,7 +45,7 @@ BattleFrontier_BattlePikeThreePathRoom_EventScript_25C8A4:: @ 825C8A4
setvar VAR_0x8006, 0
special sub_81A1780
setvar VAR_0x4000, 255
- special copy_player_party_to_sav1
+ special SavePlayerParty
setvar VAR_0x8004, 3
setvar VAR_0x8005, 3
special sub_81A1780
@@ -136,7 +136,7 @@ BattleFrontier_BattlePikeThreePathRoom_EventScript_25C9FD:: @ 825C9FD
special sub_81A1780
message BattleFrontier_BattlePikeThreePathRoom_Text_25CE08
waitmessage
- special copy_player_party_from_sav1
+ special LoadPlayerParty
setvar VAR_0x8004, 8
setvar VAR_0x8005, 2
special sub_81A703C
diff --git a/data/scripts/maps/BattleFrontier_BattlePyramidEmptySquare.inc b/data/scripts/maps/BattleFrontier_BattlePyramidEmptySquare.inc
index b7dc59257..29485ef12 100644
--- a/data/scripts/maps/BattleFrontier_BattlePyramidEmptySquare.inc
+++ b/data/scripts/maps/BattleFrontier_BattlePyramidEmptySquare.inc
@@ -99,7 +99,7 @@ BattleFrontier_BattlePyramidEmptySquare_EventScript_252B8D:: @ 8252B8D
setvar VAR_0x8004, 3
setvar VAR_0x8005, 1
special sub_81A8E7C
- special copy_player_party_to_sav1
+ special SavePlayerParty
setvar VAR_0x8004, 2
setvar VAR_0x8005, 0
setvar VAR_0x8006, 0
diff --git a/data/scripts/maps/BattleFrontier_BattlePyramidLobby.inc b/data/scripts/maps/BattleFrontier_BattlePyramidLobby.inc
index 9455479a7..17218658e 100644
--- a/data/scripts/maps/BattleFrontier_BattlePyramidLobby.inc
+++ b/data/scripts/maps/BattleFrontier_BattlePyramidLobby.inc
@@ -67,7 +67,7 @@ BattleFrontier_BattlePyramidLobby_EventScript_2507DA:: @ 82507DA
clearflag FLAG_SPECIAL_FLAG_0x4004
setvar VAR_0x8004, 8
special sub_81A1780
- special copy_player_party_from_sav1
+ special LoadPlayerParty
setvar VAR_0x8004, 14
special sub_81A8E7C
special HealPlayerParty
@@ -97,7 +97,7 @@ BattleFrontier_BattlePyramidLobby_EventScript_2507DA:: @ 82507DA
BattleFrontier_BattlePyramidLobby_EventScript_250852:: @ 8250852
setvar VAR_0x8004, 8
special sub_81A1780
- special copy_player_party_from_sav1
+ special LoadPlayerParty
setvar VAR_0x8004, 14
special sub_81A8E7C
special HealPlayerParty
@@ -131,7 +131,7 @@ BattleFrontier_BattlePyramidLobby_EventScript_2508B1:: @ 82508B1
faceplayer
setvar VAR_FRONTIER_FACILITY, 6
setvar VAR_0x40CE, 0
- special copy_player_party_to_sav1
+ special SavePlayerParty
msgbox BattleFrontier_BattlePyramidLobby_Text_250F31, 4
BattleFrontier_BattlePyramidLobby_EventScript_2508C8:: @ 82508C8
@@ -197,7 +197,7 @@ BattleFrontier_BattlePyramidLobby_EventScript_2509A5:: @ 82509A5
special sub_81A8E7C
setvar VAR_0x8004, 9
special sub_81A8E7C
- special copy_player_party_from_sav1
+ special LoadPlayerParty
closemessage
delay 2
call BattleFrontier_BattlePyramidLobby_EventScript_27134F
@@ -206,7 +206,7 @@ BattleFrontier_BattlePyramidLobby_EventScript_2509A5:: @ 82509A5
goto_eq BattleFrontier_BattlePyramidLobby_EventScript_250AAA
BattleFrontier_BattlePyramidLobby_EventScript_250A21:: @ 8250A21
- special copy_player_party_to_sav1
+ special SavePlayerParty
setvar VAR_0x8004, 3
setvar VAR_0x8005, 3
special sub_81A1780
@@ -249,7 +249,7 @@ BattleFrontier_BattlePyramidLobby_EventScript_250AAA:: @ 8250AAA
goto BattleFrontier_BattlePyramidLobby_EventScript_250AC4
BattleFrontier_BattlePyramidLobby_EventScript_250AC1:: @ 8250AC1
- special copy_player_party_from_sav1
+ special LoadPlayerParty
BattleFrontier_BattlePyramidLobby_EventScript_250AC4:: @ 8250AC4
msgbox BattleFrontier_BattlePyramidLobby_Text_250FE5, 4
diff --git a/data/scripts/maps/BattleFrontier_BattlePyramidTop.inc b/data/scripts/maps/BattleFrontier_BattlePyramidTop.inc
index 3ba3a5a6a..07e66efa8 100644
--- a/data/scripts/maps/BattleFrontier_BattlePyramidTop.inc
+++ b/data/scripts/maps/BattleFrontier_BattlePyramidTop.inc
@@ -72,7 +72,7 @@ BattleFrontier_BattlePyramidTop_EventScript_255193:: @ 8255193
setvar VAR_0x8004, 3
setvar VAR_0x8005, 1
special sub_81A8E7C
- special copy_player_party_to_sav1
+ special SavePlayerParty
setvar VAR_0x8004, 2
setvar VAR_0x8005, 0
setvar VAR_0x8006, 0
diff --git a/data/scripts/maps/BattleFrontier_BattleTowerBattleRoom2.inc b/data/scripts/maps/BattleFrontier_BattleTowerBattleRoom2.inc
index feaa18c8d..ec2994591 100644
--- a/data/scripts/maps/BattleFrontier_BattleTowerBattleRoom2.inc
+++ b/data/scripts/maps/BattleFrontier_BattleTowerBattleRoom2.inc
@@ -153,7 +153,7 @@ BattleFrontier_BattleTowerBattleRoom2_EventScript_249118:: @ 8249118
delay 48
BattleFrontier_BattleTowerBattleRoom2_EventScript_249121:: @ 8249121
- special copy_player_party_from_sav1
+ special LoadPlayerParty
setvar VAR_0x8004, 3
setvar VAR_0x8005, 2
special sub_81A1780
diff --git a/data/scripts/maps/BattleFrontier_BattleTowerLobby.inc b/data/scripts/maps/BattleFrontier_BattleTowerLobby.inc
index def3dd122..350d1f05a 100644
--- a/data/scripts/maps/BattleFrontier_BattleTowerLobby.inc
+++ b/data/scripts/maps/BattleFrontier_BattleTowerLobby.inc
@@ -152,7 +152,7 @@ BattleFrontier_BattleTowerLobby_EventScript_23E84D:: @ 823E84D
waitmessage
setvar VAR_0x8004, 8
special sub_81A1780
- special copy_player_party_from_sav1
+ special LoadPlayerParty
special HealPlayerParty
setvar VAR_0x8004, 6
setvar VAR_0x8005, 0
@@ -240,7 +240,7 @@ BattleFrontier_BattleTowerLobby_EventScript_23E936:: @ 823E936
lock
faceplayer
setvar VAR_FRONTIER_FACILITY, 0
- special copy_player_party_to_sav1
+ special SavePlayerParty
msgbox BattleFrontier_BattleTowerLobby_Text_240537, 4
BattleFrontier_BattleTowerLobby_EventScript_23E948:: @ 823E948
@@ -299,7 +299,7 @@ BattleFrontier_BattleTowerLobby_EventScript_23EA2A:: @ 823EA2A
setvar VAR_0x8005, 3
setvar VAR_0x8006, 0
special sub_81A1780
- special copy_player_party_from_sav1
+ special LoadPlayerParty
closemessage
delay 2
call BattleFrontier_BattleTowerLobby_EventScript_27134F
@@ -320,7 +320,7 @@ BattleFrontier_BattleTowerLobby_EventScript_23EA9F:: @ 823EA9F
lock
faceplayer
setvar VAR_FRONTIER_FACILITY, 0
- special copy_player_party_to_sav1
+ special SavePlayerParty
msgbox BattleFrontier_BattleTowerLobby_Text_2407E2, 4
BattleFrontier_BattleTowerLobby_EventScript_23EAB1:: @ 823EAB1
@@ -379,7 +379,7 @@ BattleFrontier_BattleTowerLobby_EventScript_23EB93:: @ 823EB93
setvar VAR_0x8005, 3
setvar VAR_0x8006, 0
special sub_81A1780
- special copy_player_party_from_sav1
+ special LoadPlayerParty
closemessage
delay 2
call BattleFrontier_BattleTowerLobby_EventScript_27134F
@@ -401,7 +401,7 @@ BattleFrontier_BattleTowerLobby_EventScript_23EC08:: @ 823EC08
faceplayer
setvar VAR_FRONTIER_FACILITY, 0
clearflag FLAG_0x152
- special copy_player_party_to_sav1
+ special SavePlayerParty
msgbox BattleFrontier_BattleTowerLobby_Text_240A8B, 4
BattleFrontier_BattleTowerLobby_EventScript_23EC1D:: @ 823EC1D
@@ -460,7 +460,7 @@ BattleFrontier_BattleTowerLobby_EventScript_23ECFF:: @ 823ECFF
setvar VAR_0x8005, 3
setvar VAR_0x8006, 0
special sub_81A1780
- special copy_player_party_from_sav1
+ special LoadPlayerParty
closemessage
delay 2
call BattleFrontier_BattleTowerLobby_EventScript_27134F
@@ -481,7 +481,7 @@ BattleFrontier_BattleTowerLobby_EventScript_23ED74:: @ 823ED74
lock
faceplayer
setvar VAR_FRONTIER_FACILITY, 0
- special copy_player_party_to_sav1
+ special SavePlayerParty
msgbox BattleFrontier_BattleTowerLobby_Text_240E15, 4
BattleFrontier_BattleTowerLobby_EventScript_23ED86:: @ 823ED86
@@ -540,7 +540,7 @@ BattleFrontier_BattleTowerLobby_EventScript_23EE68:: @ 823EE68
setvar VAR_0x8005, 3
setvar VAR_0x8006, 0
special sub_81A1780
- special copy_player_party_from_sav1
+ special LoadPlayerParty
closemessage
delay 2
setvar VAR_0x8004, 6
@@ -722,7 +722,7 @@ BattleFrontier_BattleTowerLobby_EventScript_23F0D0:: @ 823F0D0
end
BattleFrontier_BattleTowerLobby_EventScript_23F0E3:: @ 823F0E3
- special copy_player_party_from_sav1
+ special LoadPlayerParty
BattleFrontier_BattleTowerLobby_EventScript_23F0E6:: @ 823F0E6
special CloseLink
@@ -733,7 +733,7 @@ BattleFrontier_BattleTowerLobby_EventScript_23F0F1:: @ 823F0F1
end
BattleFrontier_BattleTowerLobby_EventScript_23F0F3:: @ 823F0F3
- special copy_player_party_to_sav1
+ special SavePlayerParty
setvar VAR_0x8004, 3
call BattleFrontier_BattleTowerLobby_EventScript_23F272
special sub_81A1780
diff --git a/data/scripts/maps/FallarborTown_BattleTentBattleRoom.inc b/data/scripts/maps/FallarborTown_BattleTentBattleRoom.inc
index b4d0a5d9c..16cb9fff5 100644
--- a/data/scripts/maps/FallarborTown_BattleTentBattleRoom.inc
+++ b/data/scripts/maps/FallarborTown_BattleTentBattleRoom.inc
@@ -72,7 +72,7 @@ FallarborTown_BattleTentBattleRoom_EventScript_20097E:: @ 820097E
setvar VAR_0x8005, 0
setvar VAR_0x8006, 4
special sub_81A1780
- special copy_player_party_from_sav1
+ special LoadPlayerParty
warp FALLARBOR_TOWN_BATTLE_TENT_LOBBY, 255, 6, 6
waitstate
@@ -103,8 +103,8 @@ FallarborTown_BattleTentBattleRoom_EventScript_2009B3:: @ 82009B3
applymovement 1, FallarborTown_BattleTentBattleRoom_Movement_200B94
waitmovement 0
msgbox FallarborTown_BattleTentBattleRoom_Text_257CE9, 4
- special copy_player_party_from_sav1
- special copy_player_party_to_sav1
+ special LoadPlayerParty
+ special SavePlayerParty
setvar VAR_0x8004, 3
setvar VAR_0x8005, 3
special sub_81A1780
@@ -157,7 +157,7 @@ FallarborTown_BattleTentBattleRoom_EventScript_200AF3:: @ 8200AF3
setvar VAR_0x8005, 0
setvar VAR_0x8006, 3
special sub_81A1780
- special copy_player_party_from_sav1
+ special LoadPlayerParty
warp FALLARBOR_TOWN_BATTLE_TENT_LOBBY, 255, 6, 6
waitstate
setvar VAR_0x8004, 1
diff --git a/data/scripts/maps/FallarborTown_BattleTentLobby.inc b/data/scripts/maps/FallarborTown_BattleTentLobby.inc
index 347c55659..78a067a55 100644
--- a/data/scripts/maps/FallarborTown_BattleTentLobby.inc
+++ b/data/scripts/maps/FallarborTown_BattleTentLobby.inc
@@ -134,7 +134,7 @@ FallarborTown_BattleTentLobby_EventScript_200001:: @ 8200001
special sub_81B9B80
compare VAR_RESULT, 0
goto_if 5, FallarborTown_BattleTentLobby_EventScript_1FFF84
- special copy_player_party_to_sav1
+ special SavePlayerParty
msgbox FallarborTown_BattleTentLobby_Text_2C47EB, 4
FallarborTown_BattleTentLobby_EventScript_200021:: @ 8200021
@@ -188,7 +188,7 @@ FallarborTown_BattleTentLobby_EventScript_2000E2:: @ 82000E2
setvar VAR_0x8005, 3
setvar VAR_0x8006, 0
special sub_81A1780
- special copy_player_party_from_sav1
+ special LoadPlayerParty
closemessage
delay 2
call FallarborTown_BattleTentLobby_EventScript_27134F
@@ -197,7 +197,7 @@ FallarborTown_BattleTentLobby_EventScript_2000E2:: @ 82000E2
goto_eq FallarborTown_BattleTentLobby_EventScript_2001AB
FallarborTown_BattleTentLobby_EventScript_20013C:: @ 820013C
- special copy_player_party_to_sav1
+ special SavePlayerParty
setvar VAR_0x8004, 3
setvar VAR_0x8005, 3
special sub_81A1780
@@ -234,7 +234,7 @@ FallarborTown_BattleTentLobby_EventScript_2001AB:: @ 82001AB
goto FallarborTown_BattleTentLobby_EventScript_2001C5
FallarborTown_BattleTentLobby_EventScript_2001C2:: @ 82001C2
- special copy_player_party_from_sav1
+ special LoadPlayerParty
FallarborTown_BattleTentLobby_EventScript_2001C5:: @ 82001C5
msgbox FallarborTown_BattleTentLobby_Text_2C487F, 4
diff --git a/data/scripts/maps/MossdeepCity_SpaceCenter_2F.inc b/data/scripts/maps/MossdeepCity_SpaceCenter_2F.inc
index b23da6481..cee99c4d5 100644
--- a/data/scripts/maps/MossdeepCity_SpaceCenter_2F.inc
+++ b/data/scripts/maps/MossdeepCity_SpaceCenter_2F.inc
@@ -250,13 +250,13 @@ MossdeepCity_SpaceCenter_2F_EventScript_223FDA:: @ 8223FDA
MossdeepCity_SpaceCenter_2F_EventScript_22400C:: @ 822400C
applymovement VAR_LAST_TALKED, MossdeepCity_SpaceCenter_2F_Movement_2725AA
waitmovement 0
- special copy_player_party_to_sav1
+ special SavePlayerParty
fadescreen 1
special sub_80F9438
waitstate
compare VAR_RESULT, 0
goto_if 5, MossdeepCity_SpaceCenter_2F_EventScript_224032
- special copy_player_party_from_sav1
+ special LoadPlayerParty
goto MossdeepCity_SpaceCenter_2F_EventScript_223FDA
MossdeepCity_SpaceCenter_2F_EventScript_224032:: @ 8224032
@@ -270,7 +270,7 @@ MossdeepCity_SpaceCenter_2F_EventScript_224032:: @ 8224032
waitstate
setvar VAR_0x8004, 6
special sub_81A1780
- special copy_player_party_from_sav1
+ special LoadPlayerParty
switch VAR_RESULT
case 1, MossdeepCity_SpaceCenter_2F_EventScript_224071
fadescreen 1
diff --git a/data/scripts/maps/PetalburgCity.inc b/data/scripts/maps/PetalburgCity.inc
index 0da686052..c297d61a7 100644
--- a/data/scripts/maps/PetalburgCity.inc
+++ b/data/scripts/maps/PetalburgCity.inc
@@ -30,7 +30,7 @@ PetalburgCity_MapScript2_1DC31C: @ 81DC31C
PetalburgCity_EventScript_1DC32E:: @ 81DC32E
lockall
- special copy_player_party_to_sav1
+ special SavePlayerParty
special PutZigzagoonInPlayerParty
applymovement 2, PetalburgCity_Movement_1DC451
applymovement 255, PetalburgCity_Movement_1DC430
@@ -47,7 +47,7 @@ PetalburgCity_EventScript_1DC32E:: @ 81DC32E
setvar VAR_0x4057, 3
fadedefaultbgm
clearflag FLAG_SPECIAL_FLAG_0x4001
- special copy_player_party_from_sav1
+ special LoadPlayerParty
setvar VAR_0x4085, 1
warp PETALBURG_CITY_GYM, 255, 4, 108
waitstate
diff --git a/data/scripts/maps/SlateportCity_BattleTentBattleRoom.inc b/data/scripts/maps/SlateportCity_BattleTentBattleRoom.inc
index e0c6da76c..e52828a19 100644
--- a/data/scripts/maps/SlateportCity_BattleTentBattleRoom.inc
+++ b/data/scripts/maps/SlateportCity_BattleTentBattleRoom.inc
@@ -67,7 +67,7 @@ SlateportCity_BattleTentCorridor_EventScript_209A1B:: @ 8209A1B
setvar VAR_0x8005, 0
setvar VAR_0x8006, 4
special sub_81A1780
- special copy_player_party_from_sav1
+ special LoadPlayerParty
warp SLATEPORT_CITY_BATTLE_TENT_LOBBY, 255, 6, 6
waitstate
@@ -93,7 +93,7 @@ SlateportCity_BattleTentCorridor_EventScript_209A7B:: @ 8209A7B
setvar VAR_0x8005, 0
setvar VAR_0x8006, 3
special sub_81A1780
- special copy_player_party_from_sav1
+ special LoadPlayerParty
warp SLATEPORT_CITY_BATTLE_TENT_LOBBY, 255, 6, 6
waitstate
@ forced stop
diff --git a/data/scripts/maps/SlateportCity_BattleTentCorridor.inc b/data/scripts/maps/SlateportCity_BattleTentCorridor.inc
index 6a0bafb45..b293dc140 100644
--- a/data/scripts/maps/SlateportCity_BattleTentCorridor.inc
+++ b/data/scripts/maps/SlateportCity_BattleTentCorridor.inc
@@ -140,7 +140,7 @@ SlateportCity_BattleTentCorridor_EventScript_209022:: @ 8209022
end
SlateportCity_BattleTentCorridor_EventScript_209044:: @ 8209044
- special copy_player_party_to_sav1
+ special SavePlayerParty
setvar VAR_0x8004, 10
setvar VAR_0x8005, 0
special sub_81A5E74
diff --git a/data/scripts/maps/SlateportCity_BattleTentLobby.inc b/data/scripts/maps/SlateportCity_BattleTentLobby.inc
index ca51ab57e..e5f510179 100644
--- a/data/scripts/maps/SlateportCity_BattleTentLobby.inc
+++ b/data/scripts/maps/SlateportCity_BattleTentLobby.inc
@@ -122,7 +122,7 @@ SlateportCity_BattleTentLobby_EventScript_2088AA:: @ 82088AA
special sub_81B9D08
compare VAR_RESULT, 0
goto_if 5, SlateportCity_BattleTentLobby_EventScript_2087E9
- special copy_player_party_to_sav1
+ special SavePlayerParty
msgbox SlateportCity_BattleTentLobby_Text_2C5810, 4
SlateportCity_BattleTentLobby_EventScript_2088CA:: @ 82088CA
@@ -228,7 +228,7 @@ SlateportCity_BattleTentLobby_EventScript_208A14:: @ 8208A14
goto SlateportCity_BattleTentLobby_EventScript_208A2E
SlateportCity_BattleTentLobby_EventScript_208A2B:: @ 8208A2B
- special copy_player_party_from_sav1
+ special LoadPlayerParty
SlateportCity_BattleTentLobby_EventScript_208A2E:: @ 8208A2E
msgbox SlateportCity_BattleTentLobby_Text_2C5AA5, 4
diff --git a/data/scripts/maps/SootopolisCity_MysteryEventsHouse_1F.inc b/data/scripts/maps/SootopolisCity_MysteryEventsHouse_1F.inc
index 019bdce10..eaca36e59 100644
--- a/data/scripts/maps/SootopolisCity_MysteryEventsHouse_1F.inc
+++ b/data/scripts/maps/SootopolisCity_MysteryEventsHouse_1F.inc
@@ -45,7 +45,7 @@ SootopolisCity_MysteryEventsHouse_1F_EventScript_2279B7:: @ 82279B7
call_if 1, SootopolisCity_MysteryEventsHouse_1F_EventScript_227A0D
compare VAR_0x40C0, 3
call_if 1, SootopolisCity_MysteryEventsHouse_1F_EventScript_227A16
- special copy_player_party_from_sav1
+ special LoadPlayerParty
setvar VAR_0x40C0, 0
releaseall
end
@@ -90,7 +90,7 @@ SootopolisCity_MysteryEventsHouse_1F_EventScript_227A4E:: @ 8227A4E
end
SootopolisCity_MysteryEventsHouse_1F_EventScript_227A58:: @ 8227A58
- special copy_player_party_to_sav1
+ special SavePlayerParty
special sub_8139238
msgbox SootopolisCity_MysteryEventsHouse_1F_Text_227BFC, 5
compare VAR_RESULT, 0
@@ -101,11 +101,11 @@ SootopolisCity_MysteryEventsHouse_1F_EventScript_227A58:: @ 8227A58
msgbox SootopolisCity_MysteryEventsHouse_1F_Text_227CEB, 5
compare VAR_RESULT, 0
goto_eq SootopolisCity_MysteryEventsHouse_1F_EventScript_227AE2
- special copy_player_party_from_sav1
+ special LoadPlayerParty
call SootopolisCity_MysteryEventsHouse_1F_EventScript_27134F
compare VAR_RESULT, 0
goto_eq SootopolisCity_MysteryEventsHouse_1F_EventScript_227AE2
- special copy_player_party_to_sav1
+ special SavePlayerParty
special sub_80F94E8
msgbox SootopolisCity_MysteryEventsHouse_1F_Text_227D21, 4
closemessage
@@ -121,7 +121,7 @@ SootopolisCity_MysteryEventsHouse_1F_EventScript_227A58:: @ 8227A58
end
SootopolisCity_MysteryEventsHouse_1F_EventScript_227AE2:: @ 8227AE2
- special copy_player_party_from_sav1
+ special LoadPlayerParty
msgbox SootopolisCity_MysteryEventsHouse_1F_Text_227C44, 4
release
end
diff --git a/data/scripts/maps/SootopolisCity_MysteryEventsHouse_B1F.inc b/data/scripts/maps/SootopolisCity_MysteryEventsHouse_B1F.inc
index 78c7303ae..0dec00967 100644
--- a/data/scripts/maps/SootopolisCity_MysteryEventsHouse_B1F.inc
+++ b/data/scripts/maps/SootopolisCity_MysteryEventsHouse_B1F.inc
@@ -32,7 +32,7 @@ SootopolisCity_MysteryEventsHouse_B1F_EventScript_227E68:: @ 8227E68
special HealPlayerParty
applymovement 255, SootopolisCity_MysteryEventsHouse_B1F_Movement_227EF9
waitmovement 0
- special copy_player_party_from_sav1
+ special LoadPlayerParty
setvar VAR_0x4001, 1
warp SOOTOPOLIS_CITY_MYSTERY_EVENTS_HOUSE_1F, 255, 3, 1
waitstate
diff --git a/data/scripts/maps/VerdanturfTown_BattleTentBattleRoom.inc b/data/scripts/maps/VerdanturfTown_BattleTentBattleRoom.inc
index b673e959b..ad2749ba8 100644
--- a/data/scripts/maps/VerdanturfTown_BattleTentBattleRoom.inc
+++ b/data/scripts/maps/VerdanturfTown_BattleTentBattleRoom.inc
@@ -59,7 +59,7 @@ VerdanturfTown_BattleTentBattleRoom_EventScript_2023AA:: @ 82023AA
setvar VAR_0x8005, 0
setvar VAR_0x8006, 4
special sub_81A1780
- special copy_player_party_from_sav1
+ special LoadPlayerParty
warp VERDANTURF_TOWN_BATTLE_TENT_LOBBY, 255, 6, 6
waitstate
@@ -81,8 +81,8 @@ VerdanturfTown_BattleTentBattleRoom_EventScript_2023C8:: @ 82023C8
applymovement 1, VerdanturfTown_BattleTentBattleRoom_Movement_2725A6
waitmovement 0
msgbox VerdanturfTown_BattleTentBattleRoom_Text_24FF00, 4
- special copy_player_party_from_sav1
- special copy_player_party_to_sav1
+ special LoadPlayerParty
+ special SavePlayerParty
setvar VAR_0x8004, 3
setvar VAR_0x8005, 3
special sub_81A1780
@@ -132,7 +132,7 @@ VerdanturfTown_BattleTentBattleRoom_EventScript_202501:: @ 8202501
setvar VAR_0x8005, 0
setvar VAR_0x8006, 3
special sub_81A1780
- special copy_player_party_from_sav1
+ special LoadPlayerParty
warp VERDANTURF_TOWN_BATTLE_TENT_LOBBY, 255, 6, 6
waitstate
diff --git a/data/scripts/maps/VerdanturfTown_BattleTentLobby.inc b/data/scripts/maps/VerdanturfTown_BattleTentLobby.inc
index a7f496820..6f1624a2d 100644
--- a/data/scripts/maps/VerdanturfTown_BattleTentLobby.inc
+++ b/data/scripts/maps/VerdanturfTown_BattleTentLobby.inc
@@ -135,7 +135,7 @@ VerdanturfTown_BattleTentLobby_EventScript_201873:: @ 8201873
special sub_81B99B4
compare VAR_RESULT, 0
goto_if 5, VerdanturfTown_BattleTentLobby_EventScript_2017EE
- special copy_player_party_to_sav1
+ special SavePlayerParty
msgbox VerdanturfTown_BattleTentLobby_Text_2C50C3, 4
VerdanturfTown_BattleTentLobby_EventScript_201893:: @ 8201893
@@ -189,7 +189,7 @@ VerdanturfTown_BattleTentLobby_EventScript_201954:: @ 8201954
setvar VAR_0x8005, 3
setvar VAR_0x8006, 0
special sub_81A1780
- special copy_player_party_from_sav1
+ special LoadPlayerParty
closemessage
delay 2
call VerdanturfTown_BattleTentLobby_EventScript_27134F
@@ -198,7 +198,7 @@ VerdanturfTown_BattleTentLobby_EventScript_201954:: @ 8201954
goto_eq VerdanturfTown_BattleTentLobby_EventScript_201A1D
VerdanturfTown_BattleTentLobby_EventScript_2019AE:: @ 82019AE
- special copy_player_party_to_sav1
+ special SavePlayerParty
setvar VAR_0x8004, 3
setvar VAR_0x8005, 3
special sub_81A1780
@@ -235,7 +235,7 @@ VerdanturfTown_BattleTentLobby_EventScript_201A1D:: @ 8201A1D
goto VerdanturfTown_BattleTentLobby_EventScript_201A37
VerdanturfTown_BattleTentLobby_EventScript_201A34:: @ 8201A34
- special copy_player_party_from_sav1
+ special LoadPlayerParty
VerdanturfTown_BattleTentLobby_EventScript_201A37:: @ 8201A37
msgbox VerdanturfTown_BattleTentLobby_Text_2C539A, 4
diff --git a/data/specials.inc b/data/specials.inc
index 91580fa96..04867ee66 100644
--- a/data/specials.inc
+++ b/data/specials.inc
@@ -48,8 +48,8 @@ gSpecials:: @ 81DBA64
def_special sub_80B2FD8
def_special GetLinkPartnerNames
def_special SpawnLinkPartnerFieldObject
- def_special copy_player_party_to_sav1
- def_special copy_player_party_from_sav1
+ def_special SavePlayerParty
+ def_special LoadPlayerParty
def_special sub_80F9438
def_special sp02A_crash_sound
def_special FieldObjectInteractionGetBerryTreeData
@@ -341,7 +341,7 @@ gSpecials:: @ 81DBA64
def_special sub_81B98DC
def_special nullsub_54
def_special sub_80E9B70
- def_special copy_bags_and_unk_data_from_save_blocks
+ def_special LoadPlayerBag
def_special sub_80B05B4
def_special sub_8139754
def_special sub_813970C
diff --git a/include/item.h b/include/item.h
index 3153807c4..0943f3656 100644
--- a/include/item.h
+++ b/include/item.h
@@ -39,28 +39,41 @@ struct BagPocket
extern struct BagPocket gBagPockets[];
-void GetBerryCountString(u8* dst, const u8* berryName, u32 quantity);
-void CopyItemName(u16 itemId, u8 *string);
-void CopyItemNameHandlePlural(u16 itemId, u8 *string, u32 quantity);
+void ApplyNewEncryptionKeyToBagItems(u32 newKey);
+void ApplyNewEncryptionKeyToBagItems_(u32 newKey);
+void SetBagItemsPointers(void);
+void CopyItemName(u16 itemId, u8 *dst);
+void CopyItemNameHandlePlural(u16 itemId, u8 *dst, u32 quantity);
+void GetBerryCountString(u8 *dst, const u8 *berryName, u32 quantity);
bool8 IsBagPocketNonEmpty(u8 pocket);
bool8 CheckBagHasItem(u16 itemId, u16 count);
+bool8 HasAtLeastOneBerry(void);
bool8 CheckBagHasSpace(u16 itemId, u16 count);
bool8 AddBagItem(u16 itemId, u16 count);
bool8 RemoveBagItem(u16 itemId, u16 count);
u8 GetPocketByItemId(u16 itemId);
-void ClearItemSlots(struct ItemSlot *itemSlots, u8 b);
+void ClearItemSlots(struct ItemSlot *itemSlots, u8 itemCount);
u8 CountUsedPCItemSlots(void);
bool8 CheckPCHasItem(u16 itemId, u16 count);
bool8 AddPCItem(u16 itemId, u16 count);
void RemovePCItem(u8 index, u16 count);
+void CompactPCItems(void);
void SwapRegisteredBike(void);
-const struct Item *ItemId_GetItem(u16 itemId);
+u16 BagGetItemIdByPocketPosition(u8 pocketId, u16 pocketPos);
+u16 BagGetQuantityByPocketPosition(u8 pocketId, u16 pocketPos);
+void CompactItemsInBagPocket(struct BagPocket *bagPocket);
+void SortBerriesOrTMHMs(struct BagPocket *bagPocket);
+void MoveItemSlotInList(struct ItemSlot* itemSlots_, u32 from, u32 to_);
+void ClearBag(void);
+u16 CountTotalItemQuantityInBag(u16 itemId);
+bool8 AddPyramidBagItem(u16 itemId, u16 count);
+bool8 RemovePyramidBagItem(u16 itemId, u16 count);
+const u8 *ItemId_GetName(u16 itemId);
u16 ItemId_GetId(u16 itemId);
u16 ItemId_GetPrice(u16 itemId);
u8 ItemId_GetHoldEffect(u16 itemId);
u8 ItemId_GetHoldEffectParam(u16 itemId);
const u8 *ItemId_GetDescription(u16 itemId);
-bool32 ItemId_CopyDescription(u8 *a, u32 itemId, u32 c);
u8 ItemId_GetImportance(u16 itemId);
u8 ItemId_GetUnknownValue(u16 itemId);
u8 ItemId_GetPocket(u16 itemId);
@@ -69,18 +82,5 @@ ItemUseFunc ItemId_GetFieldFunc(u16 itemId);
u8 ItemId_GetBattleUsage(u16 itemId);
ItemUseFunc ItemId_GetBattleFunc(u16 itemId);
u8 ItemId_GetSecondaryId(u16 itemId);
-u16 itemid_get_market_price(u16 itemId);
-u16 BagGetItemIdByPocketPosition(u8 pocketId, u16 pocketPos);
-void sub_80D6FB4(struct BagPocket*);
-void sub_80D6F64(struct BagPocket*);
-void MoveItemSlotInList(struct ItemSlot* itemSlots, u32 a1, u32 a2);
-u8 sub_80D6CE4();
-bool8 itemid_is_unique(u16 itemId);
-void sub_80D6E48(u8, u16);
-void sub_80D6E84(void);
-void CompactPCItems(void);
-void SortBerriesOrTMHMs(struct BagPocket *bagPocket);
-void CompactItemsInBagPocket(struct BagPocket *bagPocket);
-const u8 *ItemId_GetName(u16 itemId);
#endif // GUARD_ITEM_H
diff --git a/include/load_save.h b/include/load_save.h
index 460cdf6f3..0868316c8 100644
--- a/include/load_save.h
+++ b/include/load_save.h
@@ -1,27 +1,35 @@
#ifndef GUARD_LOAD_SAVE_H
#define GUARD_LOAD_SAVE_H
-extern bool32 gFlashMemoryPresent;
+extern struct SaveBlock1 gSaveblock1;
extern struct SaveBlock2 gSaveblock2;
extern struct PokemonStorage gPokemonStorage;
+extern bool32 gFlashMemoryPresent;
+extern struct SaveBlock1 *gSaveBlock1Ptr;
+extern struct SaveBlock2 *gSaveBlock2Ptr;
+extern struct PokemonStorage *gPokemonStoragePtr;
+
+void CheckForFlashMemory(void);
void ClearSav2(void);
void ClearSav1(void);
-void CheckForFlashMemory(void);
+void SetSaveBlocksPointers(u16 offset);
void MoveSaveBlocks_ResetHeap(void);
-bool32 GetSecretBase2Field_9(void);
+u32 GetSecretBase2Field_9(void);
void ClearSecretBase2Field_9(void);
-void SetSecretBase2Field_9(void);
-void SetSecretBase2Field_9_AndHideBG(void);
-void ClearSecretBase2Field_9_2(void);
+void sub_8076D48(void);
+void sub_8076D5C(void);
+void sav2_gender2_inplace_and_xFE(void);
void SavePlayerParty(void);
void LoadPlayerParty(void);
+void SaveMapObjects(void);
+void LoadMapObjects(void);
void SaveSerializedGame(void);
void LoadSerializedGame(void);
void LoadPlayerBag(void);
void SavePlayerBag(void);
-void SetSaveBlocksPointers(u16);
-void sub_8076D5C(void);
-void sav2_gender2_inplace_and_xFE(void);
+void ApplyNewEncryptionKeyToHword(u16 *hWord, u32 newKey);
+void ApplyNewEncryptionKeyToWord(u32 *word, u32 newKey);
+void ApplyNewEncryptionKeyToAllEncryptedData(u32 encryptionKey);
#endif // GUARD_LOAD_SAVE_H
diff --git a/include/strings.h b/include/strings.h
index 7c81dbcfb..ec2a5b4aa 100644
--- a/include/strings.h
+++ b/include/strings.h
@@ -74,6 +74,10 @@ extern const u8 gText_DecorationWillBeDiscarded[];
extern const u8 gText_CantThrowAwayInUse[];
extern const u8 gText_DecorationThrownAway[];
+extern const u8 gText_PokeBalls[];
+extern const u8 gText_Berries[];
+extern const u8 gText_Berry[];
+
extern const u8 gText_Desk[];
extern const u8 gText_Chair[];
extern const u8 gText_Plant[];
@@ -336,7 +340,7 @@ extern const u8 gText_Var1DotVar2[];
extern const u8 gText_ThreeMarks[];
extern const u8 gText_FirmSlash[];
-//item menu screen text
+// item menu screen text
extern const u8 gText_CloseBag[];
extern const u8 gText_ClearTo11Var1Clear5Var2[];
extern const u8 gText_UnkF908Var1Clear7Var2[];
@@ -362,11 +366,11 @@ extern const u8 gText_DepositedVar2Var1s[];
extern const u8 gText_NoRoomForItems[];
extern const u8 gText_ThreeDashes[];
-//party menu text
+// party menu text
extern const u8 gText_PkmnHPRestoredByVar2[];
extern const u8 gText_CantBeUsedOnPkmn[];
-//birch dex rating text
+// birch dex rating text
extern const u8 gBirchDexRatingText_LessThan10[];
extern const u8 gBirchDexRatingText_LessThan20[];
extern const u8 gBirchDexRatingText_LessThan30[];
@@ -389,7 +393,7 @@ extern const u8 gBirchDexRatingText_LessThan190[];
extern const u8 gBirchDexRatingText_LessThan200[];
extern const u8 gBirchDexRatingText_DexCompleted[];
-//player pc text
+// player pc text
extern const u8 gText_WhatWouldYouLike[];
extern const u8 gText_NoMailHere[];
diff --git a/src/item.c b/src/item.c
index a6e89a8e5..01166f5d6 100644
--- a/src/item.c
+++ b/src/item.c
@@ -8,6 +8,8 @@
#include "malloc.h"
#include "secret_base.h"
#include "item_menu.h"
+#include "strings.h"
+#include "load_save.h"
// These constants are used in gItems
enum
@@ -20,40 +22,34 @@ enum
POCKET_KEY_ITEMS,
};
-extern void ApplyNewEncryptionKeyToHword(u16 *hword, u32 newKey);
extern bool8 InBattlePyramid(void);
-
-extern const u8 gText_PokeBalls[];
-extern const u8 gText_Berries[];
-extern const u8 gText_Berry[];
-
+extern u16 gUnknown_0203CF30[];
extern const struct Item gItems[];
// this file's functions
-
static bool8 CheckPyramidBagHasItem(u16 itemId, u16 count);
static bool8 CheckPyramidBagHasSpace(u16 itemId, u16 count);
-static bool8 AddPyramidBagItem(u16 itemId, u16 count);
-static bool8 RemovePyramidBagItem(u16 itemId, u16 count);
-// code
+// EWRAM variables
+EWRAM_DATA struct BagPocket gBagPockets[POCKETS_COUNT] = {0};
-u16 GetBagItemQuantity(u16 *quantity)
+// code
+static u16 GetBagItemQuantity(u16 *quantity)
{
return gSaveBlock2Ptr->encryptionKey ^ *quantity;
}
-void SetBagItemQuantity(u16 *quantity, u16 newValue)
+static void SetBagItemQuantity(u16 *quantity, u16 newValue)
{
*quantity = newValue ^ gSaveBlock2Ptr->encryptionKey;
}
-u16 GetPCItemQuantity(u16 *quantity)
+static u16 GetPCItemQuantity(u16 *quantity)
{
return *quantity;
}
-void SetPCItemQuantity(u16 *quantity, u16 newValue)
+static void SetPCItemQuantity(u16 *quantity, u16 newValue)
{
*quantity = newValue;
}
@@ -91,26 +87,26 @@ void SetBagItemsPointers(void)
gBagPockets[BERRIES_POCKET].capacity = BAG_BERRIES_COUNT;
}
-void CopyItemName(u16 itemId, u8 *string)
+void CopyItemName(u16 itemId, u8 *dst)
{
- StringCopy(string, ItemId_GetName(itemId));
+ StringCopy(dst, ItemId_GetName(itemId));
}
-void CopyItemNameHandlePlural(u16 itemId, u8 *string, u32 quantity)
+void CopyItemNameHandlePlural(u16 itemId, u8 *dst, u32 quantity)
{
if (itemId == ITEM_POKE_BALL)
{
if (quantity < 2)
- StringCopy(string, ItemId_GetName(ITEM_POKE_BALL));
+ StringCopy(dst, ItemId_GetName(ITEM_POKE_BALL));
else
- StringCopy(string, gText_PokeBalls);
+ StringCopy(dst, gText_PokeBalls);
}
else
{
if (itemId >= ITEM_CHERI_BERRY && itemId <= ITEM_ENIGMA_BERRY)
- GetBerryCountString(string, gBerries[itemId - ITEM_CHERI_BERRY].name, quantity);
+ GetBerryCountString(dst, gBerries[itemId - ITEM_CHERI_BERRY].name, quantity);
else
- StringCopy(string, ItemId_GetName(itemId));
+ StringCopy(dst, ItemId_GetName(itemId));
}
}
@@ -157,12 +153,12 @@ bool8 CheckBagHasItem(u16 itemId, u16 count)
if (gBagPockets[pocket].itemSlots[i].itemId == itemId)
{
u16 quantity;
- //Does this item slot contain enough of the item?
+ // Does this item slot contain enough of the item?
quantity = GetBagItemQuantity(&gBagPockets[pocket].itemSlots[i].quantity);
if (quantity >= count)
return TRUE;
count -= quantity;
- //Does this item slot and all previous slots contain enough of the item?
+ // Does this item slot and all previous slots contain enough of the item?
if (count == 0)
return TRUE;
}
@@ -901,7 +897,7 @@ static bool8 CheckPyramidBagHasSpace(u16 itemId, u16 count)
return FALSE;
}
-static bool8 AddPyramidBagItem(u16 itemId, u16 count)
+bool8 AddPyramidBagItem(u16 itemId, u16 count)
{
u16 i;
@@ -974,9 +970,7 @@ static bool8 AddPyramidBagItem(u16 itemId, u16 count)
}
}
-extern u16 gUnknown_0203CF30[];
-
-static bool8 RemovePyramidBagItem(u16 itemId, u16 count)
+bool8 RemovePyramidBagItem(u16 itemId, u16 count)
{
u16 i;
@@ -1077,7 +1071,6 @@ const u8 *ItemId_GetDescription(u16 itemId)
return gItems[SanitizeItemId(itemId)].description;
}
-
u8 ItemId_GetImportance(u16 itemId)
{
return gItems[SanitizeItemId(itemId)].importance;
diff --git a/src/load_save.c b/src/load_save.c
index e3de66bb8..917c1dfe1 100644
--- a/src/load_save.c
+++ b/src/load_save.c
@@ -4,33 +4,30 @@
#include "main.h"
#include "pokemon.h"
#include "random.h"
+#include "malloc.h"
+#include "item.h"
extern void* gUnknown_0203CF5C;
extern bool16 IdentifyFlash(void);
-extern void SetBagItemsPointers(void);
extern void SetDecorationInventoriesPointers(void);
extern void ApplyNewEncryptionKeyToGameStats(u32 key);
-extern void ApplyNewEncryptionKeyToBagItems(u32 newKey);
-extern void ApplyNewEncryptionKeyToBagItems_(u32 key);
extern void ApplyNewEncryptionKeyToBerryPowder(u32 key);
extern void sub_8084FAC(int unused);
-// this is probably wrong or misleading due to it being used in ResetHeap...
-extern void InitHeap(void *pointer, u32 size);
-
#define SAVEBLOCK_MOVE_RANGE 128
struct LoadedSaveData
{
- /*0x0000*/ struct ItemSlot items[30];
- /*0x0078*/ struct ItemSlot keyItems[30];
- /*0x00F0*/ struct ItemSlot pokeBalls[16];
- /*0x0130*/ struct ItemSlot TMsHMs[64];
- /*0x0230*/ struct ItemSlot berries[46];
+ /*0x0000*/ struct ItemSlot items[BAG_ITEMS_COUNT];
+ /*0x0078*/ struct ItemSlot keyItems[BAG_KEYITEMS_COUNT];
+ /*0x00F0*/ struct ItemSlot pokeBalls[BAG_POKEBALLS_COUNT];
+ /*0x0130*/ struct ItemSlot TMsHMs[BAG_TMHM_COUNT];
+ /*0x0230*/ struct ItemSlot berries[BAG_BERRIES_COUNT];
/*0x02E8*/ struct MailStruct mail[MAIL_COUNT];
};
+// EWRAM DATA
EWRAM_DATA struct SaveBlock2 gSaveblock2 = {0};
EWRAM_DATA u8 gSaveblock2_DMA[SAVEBLOCK_MOVE_RANGE] = {0};
@@ -43,8 +40,13 @@ EWRAM_DATA u8 gSaveblock3_DMA[SAVEBLOCK_MOVE_RANGE] = {0};
EWRAM_DATA struct LoadedSaveData gLoadedSaveData = {0};
EWRAM_DATA u32 gLastEncryptionKey = {0};
-void ApplyNewEncryptionKeyToAllEncryptedData(u32 encryptionKey);
+// IWRAM common
+IWRAM_DATA bool32 gFlashMemoryPresent;
+IWRAM_DATA struct SaveBlock1 *gSaveBlock1Ptr;
+IWRAM_DATA struct SaveBlock2 *gSaveBlock2Ptr;
+IWRAM_DATA struct PokemonStorage *gPokemonStoragePtr;
+// code
void CheckForFlashMemory(void)
{
if (!IdentifyFlash())
@@ -53,7 +55,9 @@ void CheckForFlashMemory(void)
InitFlashTimer();
}
else
+ {
gFlashMemoryPresent = FALSE;
+ }
}
void ClearSav2(void)
@@ -80,8 +84,6 @@ void SetSaveBlocksPointers(u16 offset)
SetDecorationInventoriesPointers();
}
-extern u8 gHeap[];
-
void MoveSaveBlocks_ResetHeap(void)
{
void *vblankCB, *hblankCB;
@@ -132,7 +134,6 @@ void MoveSaveBlocks_ResetHeap(void)
gSaveBlock2Ptr->encryptionKey = encryptionKey;
}
-
u32 GetSecretBase2Field_9(void)
{
return gSaveBlock2Ptr->specialSaveWarp & 1;
@@ -159,112 +160,112 @@ void sav2_gender2_inplace_and_xFE(void)
gSaveBlock2Ptr->specialSaveWarp &= ~1;
}
-void copy_player_party_to_sav1(void) // SavePlayerParty
+void SavePlayerParty(void)
{
int i;
gSaveBlock1Ptr->playerPartyCount = gPlayerPartyCount;
- for (i = 0; i < 6; i++)
+ for (i = 0; i < PARTY_SIZE; i++)
gSaveBlock1Ptr->playerParty[i] = gPlayerParty[i];
}
-void copy_player_party_from_sav1(void) // LoadPlayerParty
+void LoadPlayerParty(void)
{
int i;
gPlayerPartyCount = gSaveBlock1Ptr->playerPartyCount;
- for (i = 0; i < 6; i++)
+ for (i = 0; i < PARTY_SIZE; i++)
gPlayerParty[i] = gSaveBlock1Ptr->playerParty[i];
}
-void save_serialize_npcs(void) // SaveMapObjects
+void SaveMapObjects(void)
{
int i;
- for (i = 0; i < 16; i++)
+ for (i = 0; i < MAP_OBJECTS_COUNT; i++)
gSaveBlock1Ptr->mapObjects[i] = gMapObjects[i];
}
-void save_deserialize_npcs(void) // LoadMapObjects
+void LoadMapObjects(void)
{
int i;
- for (i = 0; i < 16; i++)
+ for (i = 0; i < MAP_OBJECTS_COUNT; i++)
gMapObjects[i] = gSaveBlock1Ptr->mapObjects[i];
}
void SaveSerializedGame(void)
{
- copy_player_party_to_sav1();
- save_serialize_npcs();
+ SavePlayerParty();
+ SaveMapObjects();
}
void LoadSerializedGame(void)
{
- copy_player_party_from_sav1();
- save_deserialize_npcs();
+ LoadPlayerParty();
+ LoadMapObjects();
}
-void copy_bags_and_unk_data_from_save_blocks(void)
+void LoadPlayerBag(void)
{
int i;
// load player items.
- for (i = 0; i < 30; i++)
+ for (i = 0; i < BAG_ITEMS_COUNT; i++)
gLoadedSaveData.items[i] = gSaveBlock1Ptr->bagPocket_Items[i];
// load player key items.
- for (i = 0; i < 30; i++)
+ for (i = 0; i < BAG_KEYITEMS_COUNT; i++)
gLoadedSaveData.keyItems[i] = gSaveBlock1Ptr->bagPocket_KeyItems[i];
// load player pokeballs.
- for (i = 0; i < 16; i++)
+ for (i = 0; i < BAG_POKEBALLS_COUNT; i++)
gLoadedSaveData.pokeBalls[i] = gSaveBlock1Ptr->bagPocket_PokeBalls[i];
// load player TMs and HMs.
- for (i = 0; i < 64; i++)
+ for (i = 0; i < BAG_TMHM_COUNT; i++)
gLoadedSaveData.TMsHMs[i] = gSaveBlock1Ptr->bagPocket_TMHM[i];
// load player berries.
- for (i = 0; i < 46; i++)
+ for (i = 0; i < BAG_BERRIES_COUNT; i++)
gLoadedSaveData.berries[i] = gSaveBlock1Ptr->bagPocket_Berries[i];
// load mail.
- for (i = 0; i < 16; i++)
+ for (i = 0; i < MAIL_COUNT; i++)
gLoadedSaveData.mail[i] = gSaveBlock1Ptr->mail[i];
gLastEncryptionKey = gSaveBlock2Ptr->encryptionKey;
}
-void copy_bags_and_unk_data_to_save_blocks(void)
+void SavePlayerBag(void)
{
int i;
u32 encryptionKeyBackup;
// save player items.
- for (i = 0; i < 30; i++)
+ for (i = 0; i < BAG_ITEMS_COUNT; i++)
gSaveBlock1Ptr->bagPocket_Items[i] = gLoadedSaveData.items[i];
// save player key items.
- for (i = 0; i < 30; i++)
+ for (i = 0; i < BAG_KEYITEMS_COUNT; i++)
gSaveBlock1Ptr->bagPocket_KeyItems[i] = gLoadedSaveData.keyItems[i];
// save player pokeballs.
- for (i = 0; i < 16; i++)
+ for (i = 0; i < BAG_POKEBALLS_COUNT; i++)
gSaveBlock1Ptr->bagPocket_PokeBalls[i] = gLoadedSaveData.pokeBalls[i];
// save player TMs and HMs.
- for (i = 0; i < 64; i++)
+ for (i = 0; i < BAG_TMHM_COUNT; i++)
gSaveBlock1Ptr->bagPocket_TMHM[i] = gLoadedSaveData.TMsHMs[i];
// save player berries.
- for (i = 0; i < 46; i++)
+ for (i = 0; i < BAG_BERRIES_COUNT; i++)
gSaveBlock1Ptr->bagPocket_Berries[i] = gLoadedSaveData.berries[i];
// save mail.
- for (i = 0; i < 16; i++)
+ for (i = 0; i < MAIL_COUNT; i++)
gSaveBlock1Ptr->mail[i] = gLoadedSaveData.mail[i];
encryptionKeyBackup = gSaveBlock2Ptr->encryptionKey;
diff --git a/src/random.c b/src/random.c
index f2f0ede58..f0b2d9e5f 100644
--- a/src/random.c
+++ b/src/random.c
@@ -7,6 +7,10 @@
EWRAM_DATA static u8 sUnknown = 0;
EWRAM_DATA static u32 sRandCount = 0;
+// IWRAM common
+IWRAM_DATA u32 gRngValue;
+IWRAM_DATA u32 gRng2Value;
+
u16 Random(void)
{
gRngValue = 1103515245 * gRngValue + 24691;
diff --git a/src/save.c b/src/save.c
index 8025d6586..81731692e 100644
--- a/src/save.c
+++ b/src/save.c
@@ -4,17 +4,15 @@
#include "constants/game_stat.h"
#include "task.h"
#include "decompress.h"
+#include "load_save.h"
+#include "overworld.h"
// for the chunk declarations
-extern struct SaveBlock2 gSaveblock2;
-extern struct SaveBlock1 gSaveblock1;
-extern struct PokemonStorage gPokemonStorage;
extern struct SaveSectionLocation gRamSaveSectionLocations[0xE];
-extern u8 gDecompressionBuffer[];
-extern u32 gFlashMemoryPresent;
extern u16 gUnknown_03006294;
extern bool8 gSoftResetDisabled;
+extern u32 gUnknown_0203CF5C;
// Divide save blocks into individual chunks to be written to flash sectors
@@ -24,13 +22,13 @@ extern bool8 gSoftResetDisabled;
/*
* Sector Layout:
- *
+ *
* Sectors 0 - 13: Save Slot 1
* Sectors 14 - 27: Save Slot 2
* Sectors 28 - 29: Hall of Fame
* Sector 30: e-Reader/Mystery Gift Stuff (note: e-Reader is deprecated in Emerald US)
* Sector 31: Recorded Battle
- *
+ *
* There are two save slots for saving the player's game data. We alternate between
* them each time the game is saved, so that if the current save slot is corrupt,
* we can load the previous one. We also rotate the sectors in each save slot
@@ -41,7 +39,7 @@ extern bool8 gSoftResetDisabled;
// (u8 *)structure was removed from the first statement of the macro in Emerald.
// This is because malloc is used to allocate addresses so storing the raw
-// addresses should not be done in the offsets information.
+// addresses should not be done in the offsets information.
#define SAVEBLOCK_CHUNK(structure, chunkNum) \
{ \
chunkNum * SECTOR_DATA_SIZE, \
@@ -69,8 +67,10 @@ const struct SaveSectionOffsets gSaveSectionOffsets[] =
};
extern void DoSaveFailedScreen(u8); // save_failed_screen
-extern void LoadSerializedGame(void); // load_save
extern bool32 ProgramFlashSectorAndVerify(u8 sector, u8 *data);
+extern void save_serialize_map(void);
+extern void sub_800ADF8(void);
+extern bool8 sub_800A520(void);
// iwram common
u16 gLastWrittenSector;
@@ -656,11 +656,6 @@ void UpdateSaveAddresses(void)
}
}
-extern u32 GetGameStat(u8 index); // rom4
-extern void IncrementGameStat(u8 index); // rom4
-extern void SaveSerializedGame(void); // load_save
-extern u32 gUnknown_0203CF5C;
-
u8 HandleSavingData(u8 saveType)
{
u8 i;
@@ -836,7 +831,7 @@ u16 sub_815355C(void)
struct SaveSection* savSection;
savSection = gFastSaveSection = &gSaveDataBuffer;
- if (gFlashMemoryPresent != 1)
+ if (gFlashMemoryPresent != TRUE)
return 0;
UpdateSaveAddresses();
GetSaveValidStatus(gRamSaveSectionLocations);
@@ -897,12 +892,6 @@ u32 sub_8153634(u8 sector, u8* src)
return 1;
}
-extern void save_serialize_map(void);
-extern void sub_8076D5C(void);
-extern void sav2_gender2_inplace_and_xFE(void);
-extern void sub_800ADF8(void);
-extern bool8 sub_800A520(void);
-
void sub_8153688(u8 taskId)
{
s16* taskData = gTasks[taskId].data;
diff --git a/sym_common.txt b/sym_common.txt
index b0548a84c..b05f850e1 100644
--- a/sym_common.txt
+++ b/sym_common.txt
@@ -8,24 +8,8 @@
.include "link_rfu.o"
.include "rtc.o"
.include "battle_main.o"
-
-gRngValue: @ 3005D80
- .space 0x4
-
-gRng2Value: @ 3005D84
- .space 0x4
-
-gFlashMemoryPresent: @ 3005D88
- .space 0x4
-
-gSaveBlock1Ptr: @ 3005D8C
- .space 0x4
-
-gSaveBlock2Ptr: @ 3005D90
- .space 0x4
-
-gPokemonStoragePtr: @ 3005D94
- .space 0x4
+ .include "random.o"
+ .include "load_save.o"
gInGameOpponentsNo: @ 3005D98
.space 0x4
diff --git a/sym_ewram.txt b/sym_ewram.txt
index 9bf04d201..02ecb0eee 100644
--- a/sym_ewram.txt
+++ b/sym_ewram.txt
@@ -414,10 +414,7 @@ gUnknown_02039DD0: @ 2039DD0
.space 0x4
.include "src/map_name_popup.o"
- .space 0x3
-
-gBagPockets: @ 2039DD8
- .space 0x28
+ .include "src/item.o"
gUnknown_02039E00: @ 2039E00
.space 0x100