summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarcus Huderle <huderlem@gmail.com>2019-02-07 11:37:28 -0600
committerMarcus Huderle <huderlem@gmail.com>2019-02-07 11:51:03 -0600
commit3a88ab831d2fb57e1f3e0908aeb79395700867d4 (patch)
tree79323a659a2ad1f81645566d434296966e2dad19
parenta1ad1bad3a96222e8575bb2ce4625864593daa73 (diff)
Document more battle pyramid
-rw-r--r--data/event_scripts.s2
-rw-r--r--data/maps/BattleFrontier_BattlePyramidEmptySquare/scripts.inc12
-rw-r--r--data/maps/BattlePyramidSquare01/map.json14
-rw-r--r--data/maps/BattlePyramidSquare02/map.json14
-rw-r--r--data/maps/BattlePyramidSquare03/map.json14
-rw-r--r--data/maps/BattlePyramidSquare04/map.json14
-rw-r--r--data/maps/BattlePyramidSquare05/map.json14
-rw-r--r--data/maps/BattlePyramidSquare06/map.json14
-rw-r--r--data/maps/BattlePyramidSquare07/map.json14
-rw-r--r--data/maps/BattlePyramidSquare08/map.json14
-rw-r--r--data/maps/BattlePyramidSquare09/map.json14
-rw-r--r--data/maps/BattlePyramidSquare10/map.json14
-rw-r--r--data/maps/BattlePyramidSquare11/map.json14
-rw-r--r--data/maps/BattlePyramidSquare12/map.json14
-rw-r--r--data/maps/BattlePyramidSquare13/map.json14
-rw-r--r--data/maps/BattlePyramidSquare14/map.json14
-rw-r--r--data/maps/BattlePyramidSquare15/map.json14
-rw-r--r--data/maps/BattlePyramidSquare16/map.json14
-rw-r--r--include/battle_pyramid.h10
-rw-r--r--include/event_scripts.h4
-rw-r--r--include/global.h2
-rwxr-xr-xporymap.project.cfg1
-rw-r--r--src/battle_factory.c4
-rw-r--r--src/battle_pike.c14
-rw-r--r--src/battle_pyramid.c403
-rw-r--r--src/battle_setup.c6
-rw-r--r--src/battle_tent.c4
-rw-r--r--src/battle_tower.c86
-rw-r--r--src/frontier_util.c2
-rw-r--r--src/overworld.c5
-rw-r--r--src/pokemon.c2
-rw-r--r--src/start_menu.c5
-rw-r--r--src/trainer_hill.c10
33 files changed, 406 insertions, 390 deletions
diff --git a/data/event_scripts.s b/data/event_scripts.s
index fbee3987c..c6ebcd695 100644
--- a/data/event_scripts.s
+++ b/data/event_scripts.s
@@ -7498,7 +7498,7 @@ TrainerHill_1F_Movement_2C83EE:: @ 82C83EE
step_end
EventScript_2C83F0:: @ 82C83F0
- trainerbattle TRAINER_BATTLE_12, TRAINER_PHILLIP, 0, BattleFrontier_BattlePyramidEmptySquare_Text_252C8D, BattleFrontier_BattlePyramidEmptySquare_Text_252C8D
+ trainerbattle TRAINER_BATTLE_12, TRAINER_PHILLIP, 0, BattleFacility_TrainerBattle_PlaceholderText, BattleFacility_TrainerBattle_PlaceholderText
setvar VAR_0x8004, 11
special CallTrainerHillFunction
waitmessage
diff --git a/data/maps/BattleFrontier_BattlePyramidEmptySquare/scripts.inc b/data/maps/BattleFrontier_BattlePyramidEmptySquare/scripts.inc
index 459d2adad..43586bba0 100644
--- a/data/maps/BattleFrontier_BattlePyramidEmptySquare/scripts.inc
+++ b/data/maps/BattleFrontier_BattlePyramidEmptySquare/scripts.inc
@@ -152,8 +152,8 @@ BattleFrontier_BattlePyramidEmptySquare_EventScript_252C45:: @ 8252C45
waitstate
end
-BattleFrontier_BattlePyramidEmptySquare_EventScript_252C4F:: @ 8252C4F
- trainerbattle TRAINER_BATTLE_PYRAMID, TRAINER_PHILLIP, 0, BattleFrontier_BattlePyramidEmptySquare_Text_252C8D, BattleFrontier_BattlePyramidEmptySquare_Text_252C8D
+BattlePyramid_TrainerBattle:: @ 8252C4F
+ trainerbattle TRAINER_BATTLE_PYRAMID, TRAINER_PHILLIP, 0, BattleFacility_TrainerBattle_PlaceholderText, BattleFacility_TrainerBattle_PlaceholderText
setvar VAR_0x8004, 10
special CallBattlePyramidFunction
waitmessage
@@ -162,22 +162,22 @@ BattleFrontier_BattlePyramidEmptySquare_EventScript_252C4F:: @ 8252C4F
releaseall
end
-BattleFrontier_BattlePyramidEmptySquare_EventScript_252C6A:: @ 8252C6A
+BattlePyramid_FindItemBall:: @ 8252C6A
setvar VAR_0x8004, 7
special CallBattlePyramidFunction
callstd STD_FIND_ITEM
compare VAR_0x8007, 0
- goto_if_eq BattleFrontier_BattlePyramidEmptySquare_EventScript_252C87
+ goto_if_eq BattlePyramid_FindItemBall_End
setvar VAR_0x8004, 8
special CallBattlePyramidFunction
-BattleFrontier_BattlePyramidEmptySquare_EventScript_252C87:: @ 8252C87
+BattlePyramid_FindItemBall_End:: @ 8252C87
end
BattleFrontier_BattlePyramidEmptySquare_EventScript_252C88:: @ 8252C88
goto BattleFrontier_BattlePyramidTop_EventScript_252B42
-BattleFrontier_BattlePyramidEmptySquare_Text_252C8D: @ 8252C8D
+BattleFacility_TrainerBattle_PlaceholderText: @ 8252C8D
.string "This is a sample message.$"
gText_BattlePyramidConfirmRest:: @ 8252CA7
diff --git a/data/maps/BattlePyramidSquare01/map.json b/data/maps/BattlePyramidSquare01/map.json
index 38320ece6..57e51307b 100644
--- a/data/maps/BattlePyramidSquare01/map.json
+++ b/data/maps/BattlePyramidSquare01/map.json
@@ -24,7 +24,7 @@
"movement_range_y": 1,
"trainer_type": 1,
"trainer_sight_or_berry_tree_id": 3,
- "script": "BattleFrontier_BattlePyramidEmptySquare_EventScript_252C4F",
+ "script": "BattlePyramid_TrainerBattle",
"flag": "0"
},
{
@@ -37,7 +37,7 @@
"movement_range_y": 1,
"trainer_type": 1,
"trainer_sight_or_berry_tree_id": 3,
- "script": "BattleFrontier_BattlePyramidEmptySquare_EventScript_252C4F",
+ "script": "BattlePyramid_TrainerBattle",
"flag": "0"
},
{
@@ -50,7 +50,7 @@
"movement_range_y": 1,
"trainer_type": 1,
"trainer_sight_or_berry_tree_id": 5,
- "script": "BattleFrontier_BattlePyramidEmptySquare_EventScript_252C4F",
+ "script": "BattlePyramid_TrainerBattle",
"flag": "0"
},
{
@@ -63,7 +63,7 @@
"movement_range_y": 1,
"trainer_type": 1,
"trainer_sight_or_berry_tree_id": 4,
- "script": "BattleFrontier_BattlePyramidEmptySquare_EventScript_252C4F",
+ "script": "BattlePyramid_TrainerBattle",
"flag": "0"
},
{
@@ -76,7 +76,7 @@
"movement_range_y": 1,
"trainer_type": 0,
"trainer_sight_or_berry_tree_id": 0,
- "script": "BattleFrontier_BattlePyramidEmptySquare_EventScript_252C6A",
+ "script": "BattlePyramid_FindItemBall",
"flag": "0"
},
{
@@ -89,7 +89,7 @@
"movement_range_y": 1,
"trainer_type": 0,
"trainer_sight_or_berry_tree_id": 0,
- "script": "BattleFrontier_BattlePyramidEmptySquare_EventScript_252C6A",
+ "script": "BattlePyramid_FindItemBall",
"flag": "0"
},
{
@@ -102,7 +102,7 @@
"movement_range_y": 1,
"trainer_type": 0,
"trainer_sight_or_berry_tree_id": 0,
- "script": "BattleFrontier_BattlePyramidEmptySquare_EventScript_252C6A",
+ "script": "BattlePyramid_FindItemBall",
"flag": "0"
}
],
diff --git a/data/maps/BattlePyramidSquare02/map.json b/data/maps/BattlePyramidSquare02/map.json
index 0dc6f713a..3f3d6ca93 100644
--- a/data/maps/BattlePyramidSquare02/map.json
+++ b/data/maps/BattlePyramidSquare02/map.json
@@ -24,7 +24,7 @@
"movement_range_y": 1,
"trainer_type": 1,
"trainer_sight_or_berry_tree_id": 5,
- "script": "BattleFrontier_BattlePyramidEmptySquare_EventScript_252C4F",
+ "script": "BattlePyramid_TrainerBattle",
"flag": "0"
},
{
@@ -37,7 +37,7 @@
"movement_range_y": 1,
"trainer_type": 1,
"trainer_sight_or_berry_tree_id": 5,
- "script": "BattleFrontier_BattlePyramidEmptySquare_EventScript_252C4F",
+ "script": "BattlePyramid_TrainerBattle",
"flag": "0"
},
{
@@ -50,7 +50,7 @@
"movement_range_y": 1,
"trainer_type": 1,
"trainer_sight_or_berry_tree_id": 5,
- "script": "BattleFrontier_BattlePyramidEmptySquare_EventScript_252C4F",
+ "script": "BattlePyramid_TrainerBattle",
"flag": "0"
},
{
@@ -63,7 +63,7 @@
"movement_range_y": 1,
"trainer_type": 1,
"trainer_sight_or_berry_tree_id": 5,
- "script": "BattleFrontier_BattlePyramidEmptySquare_EventScript_252C4F",
+ "script": "BattlePyramid_TrainerBattle",
"flag": "0"
},
{
@@ -76,7 +76,7 @@
"movement_range_y": 1,
"trainer_type": 0,
"trainer_sight_or_berry_tree_id": 0,
- "script": "BattleFrontier_BattlePyramidEmptySquare_EventScript_252C6A",
+ "script": "BattlePyramid_FindItemBall",
"flag": "0"
},
{
@@ -89,7 +89,7 @@
"movement_range_y": 1,
"trainer_type": 0,
"trainer_sight_or_berry_tree_id": 0,
- "script": "BattleFrontier_BattlePyramidEmptySquare_EventScript_252C6A",
+ "script": "BattlePyramid_FindItemBall",
"flag": "0"
},
{
@@ -102,7 +102,7 @@
"movement_range_y": 1,
"trainer_type": 0,
"trainer_sight_or_berry_tree_id": 0,
- "script": "BattleFrontier_BattlePyramidEmptySquare_EventScript_252C6A",
+ "script": "BattlePyramid_FindItemBall",
"flag": "0"
}
],
diff --git a/data/maps/BattlePyramidSquare03/map.json b/data/maps/BattlePyramidSquare03/map.json
index 4e446e24b..104579553 100644
--- a/data/maps/BattlePyramidSquare03/map.json
+++ b/data/maps/BattlePyramidSquare03/map.json
@@ -24,7 +24,7 @@
"movement_range_y": 1,
"trainer_type": 1,
"trainer_sight_or_berry_tree_id": 5,
- "script": "BattleFrontier_BattlePyramidEmptySquare_EventScript_252C4F",
+ "script": "BattlePyramid_TrainerBattle",
"flag": "0"
},
{
@@ -37,7 +37,7 @@
"movement_range_y": 1,
"trainer_type": 1,
"trainer_sight_or_berry_tree_id": 4,
- "script": "BattleFrontier_BattlePyramidEmptySquare_EventScript_252C4F",
+ "script": "BattlePyramid_TrainerBattle",
"flag": "0"
},
{
@@ -50,7 +50,7 @@
"movement_range_y": 1,
"trainer_type": 1,
"trainer_sight_or_berry_tree_id": 3,
- "script": "BattleFrontier_BattlePyramidEmptySquare_EventScript_252C4F",
+ "script": "BattlePyramid_TrainerBattle",
"flag": "0"
},
{
@@ -63,7 +63,7 @@
"movement_range_y": 1,
"trainer_type": 1,
"trainer_sight_or_berry_tree_id": 4,
- "script": "BattleFrontier_BattlePyramidEmptySquare_EventScript_252C4F",
+ "script": "BattlePyramid_TrainerBattle",
"flag": "0"
},
{
@@ -76,7 +76,7 @@
"movement_range_y": 1,
"trainer_type": 0,
"trainer_sight_or_berry_tree_id": 0,
- "script": "BattleFrontier_BattlePyramidEmptySquare_EventScript_252C6A",
+ "script": "BattlePyramid_FindItemBall",
"flag": "0"
},
{
@@ -89,7 +89,7 @@
"movement_range_y": 1,
"trainer_type": 0,
"trainer_sight_or_berry_tree_id": 0,
- "script": "BattleFrontier_BattlePyramidEmptySquare_EventScript_252C6A",
+ "script": "BattlePyramid_FindItemBall",
"flag": "0"
},
{
@@ -102,7 +102,7 @@
"movement_range_y": 1,
"trainer_type": 0,
"trainer_sight_or_berry_tree_id": 0,
- "script": "BattleFrontier_BattlePyramidEmptySquare_EventScript_252C6A",
+ "script": "BattlePyramid_FindItemBall",
"flag": "0"
}
],
diff --git a/data/maps/BattlePyramidSquare04/map.json b/data/maps/BattlePyramidSquare04/map.json
index 67dfdaa11..153130999 100644
--- a/data/maps/BattlePyramidSquare04/map.json
+++ b/data/maps/BattlePyramidSquare04/map.json
@@ -24,7 +24,7 @@
"movement_range_y": 1,
"trainer_type": 1,
"trainer_sight_or_berry_tree_id": 5,
- "script": "BattleFrontier_BattlePyramidEmptySquare_EventScript_252C4F",
+ "script": "BattlePyramid_TrainerBattle",
"flag": "0"
},
{
@@ -37,7 +37,7 @@
"movement_range_y": 1,
"trainer_type": 1,
"trainer_sight_or_berry_tree_id": 5,
- "script": "BattleFrontier_BattlePyramidEmptySquare_EventScript_252C4F",
+ "script": "BattlePyramid_TrainerBattle",
"flag": "0"
},
{
@@ -50,7 +50,7 @@
"movement_range_y": 1,
"trainer_type": 1,
"trainer_sight_or_berry_tree_id": 6,
- "script": "BattleFrontier_BattlePyramidEmptySquare_EventScript_252C4F",
+ "script": "BattlePyramid_TrainerBattle",
"flag": "0"
},
{
@@ -63,7 +63,7 @@
"movement_range_y": 1,
"trainer_type": 1,
"trainer_sight_or_berry_tree_id": 6,
- "script": "BattleFrontier_BattlePyramidEmptySquare_EventScript_252C4F",
+ "script": "BattlePyramid_TrainerBattle",
"flag": "0"
},
{
@@ -76,7 +76,7 @@
"movement_range_y": 1,
"trainer_type": 0,
"trainer_sight_or_berry_tree_id": 0,
- "script": "BattleFrontier_BattlePyramidEmptySquare_EventScript_252C6A",
+ "script": "BattlePyramid_FindItemBall",
"flag": "0"
},
{
@@ -89,7 +89,7 @@
"movement_range_y": 1,
"trainer_type": 0,
"trainer_sight_or_berry_tree_id": 0,
- "script": "BattleFrontier_BattlePyramidEmptySquare_EventScript_252C6A",
+ "script": "BattlePyramid_FindItemBall",
"flag": "0"
},
{
@@ -102,7 +102,7 @@
"movement_range_y": 1,
"trainer_type": 0,
"trainer_sight_or_berry_tree_id": 0,
- "script": "BattleFrontier_BattlePyramidEmptySquare_EventScript_252C6A",
+ "script": "BattlePyramid_FindItemBall",
"flag": "0"
}
],
diff --git a/data/maps/BattlePyramidSquare05/map.json b/data/maps/BattlePyramidSquare05/map.json
index ac8bd5d7d..d08cc103b 100644
--- a/data/maps/BattlePyramidSquare05/map.json
+++ b/data/maps/BattlePyramidSquare05/map.json
@@ -24,7 +24,7 @@
"movement_range_y": 1,
"trainer_type": 1,
"trainer_sight_or_berry_tree_id": 3,
- "script": "BattleFrontier_BattlePyramidEmptySquare_EventScript_252C4F",
+ "script": "BattlePyramid_TrainerBattle",
"flag": "0"
},
{
@@ -37,7 +37,7 @@
"movement_range_y": 1,
"trainer_type": 1,
"trainer_sight_or_berry_tree_id": 5,
- "script": "BattleFrontier_BattlePyramidEmptySquare_EventScript_252C4F",
+ "script": "BattlePyramid_TrainerBattle",
"flag": "0"
},
{
@@ -50,7 +50,7 @@
"movement_range_y": 1,
"trainer_type": 1,
"trainer_sight_or_berry_tree_id": 5,
- "script": "BattleFrontier_BattlePyramidEmptySquare_EventScript_252C4F",
+ "script": "BattlePyramid_TrainerBattle",
"flag": "0"
},
{
@@ -63,7 +63,7 @@
"movement_range_y": 1,
"trainer_type": 1,
"trainer_sight_or_berry_tree_id": 3,
- "script": "BattleFrontier_BattlePyramidEmptySquare_EventScript_252C4F",
+ "script": "BattlePyramid_TrainerBattle",
"flag": "0"
},
{
@@ -76,7 +76,7 @@
"movement_range_y": 1,
"trainer_type": 0,
"trainer_sight_or_berry_tree_id": 0,
- "script": "BattleFrontier_BattlePyramidEmptySquare_EventScript_252C6A",
+ "script": "BattlePyramid_FindItemBall",
"flag": "0"
},
{
@@ -89,7 +89,7 @@
"movement_range_y": 1,
"trainer_type": 0,
"trainer_sight_or_berry_tree_id": 0,
- "script": "BattleFrontier_BattlePyramidEmptySquare_EventScript_252C6A",
+ "script": "BattlePyramid_FindItemBall",
"flag": "0"
},
{
@@ -102,7 +102,7 @@
"movement_range_y": 1,
"trainer_type": 0,
"trainer_sight_or_berry_tree_id": 0,
- "script": "BattleFrontier_BattlePyramidEmptySquare_EventScript_252C6A",
+ "script": "BattlePyramid_FindItemBall",
"flag": "0"
}
],
diff --git a/data/maps/BattlePyramidSquare06/map.json b/data/maps/BattlePyramidSquare06/map.json
index d9fa40ccd..0528d33bd 100644
--- a/data/maps/BattlePyramidSquare06/map.json
+++ b/data/maps/BattlePyramidSquare06/map.json
@@ -24,7 +24,7 @@
"movement_range_y": 1,
"trainer_type": 1,
"trainer_sight_or_berry_tree_id": 3,
- "script": "BattleFrontier_BattlePyramidEmptySquare_EventScript_252C4F",
+ "script": "BattlePyramid_TrainerBattle",
"flag": "0"
},
{
@@ -37,7 +37,7 @@
"movement_range_y": 1,
"trainer_type": 1,
"trainer_sight_or_berry_tree_id": 3,
- "script": "BattleFrontier_BattlePyramidEmptySquare_EventScript_252C4F",
+ "script": "BattlePyramid_TrainerBattle",
"flag": "0"
},
{
@@ -50,7 +50,7 @@
"movement_range_y": 1,
"trainer_type": 1,
"trainer_sight_or_berry_tree_id": 3,
- "script": "BattleFrontier_BattlePyramidEmptySquare_EventScript_252C4F",
+ "script": "BattlePyramid_TrainerBattle",
"flag": "0"
},
{
@@ -63,7 +63,7 @@
"movement_range_y": 1,
"trainer_type": 1,
"trainer_sight_or_berry_tree_id": 3,
- "script": "BattleFrontier_BattlePyramidEmptySquare_EventScript_252C4F",
+ "script": "BattlePyramid_TrainerBattle",
"flag": "0"
},
{
@@ -76,7 +76,7 @@
"movement_range_y": 1,
"trainer_type": 0,
"trainer_sight_or_berry_tree_id": 0,
- "script": "BattleFrontier_BattlePyramidEmptySquare_EventScript_252C6A",
+ "script": "BattlePyramid_FindItemBall",
"flag": "0"
},
{
@@ -89,7 +89,7 @@
"movement_range_y": 1,
"trainer_type": 0,
"trainer_sight_or_berry_tree_id": 0,
- "script": "BattleFrontier_BattlePyramidEmptySquare_EventScript_252C6A",
+ "script": "BattlePyramid_FindItemBall",
"flag": "0"
},
{
@@ -102,7 +102,7 @@
"movement_range_y": 1,
"trainer_type": 0,
"trainer_sight_or_berry_tree_id": 0,
- "script": "BattleFrontier_BattlePyramidEmptySquare_EventScript_252C6A",
+ "script": "BattlePyramid_FindItemBall",
"flag": "0"
}
],
diff --git a/data/maps/BattlePyramidSquare07/map.json b/data/maps/BattlePyramidSquare07/map.json
index a097f60ba..23a4874ea 100644
--- a/data/maps/BattlePyramidSquare07/map.json
+++ b/data/maps/BattlePyramidSquare07/map.json
@@ -24,7 +24,7 @@
"movement_range_y": 1,
"trainer_type": 1,
"trainer_sight_or_berry_tree_id": 6,
- "script": "BattleFrontier_BattlePyramidEmptySquare_EventScript_252C4F",
+ "script": "BattlePyramid_TrainerBattle",
"flag": "0"
},
{
@@ -37,7 +37,7 @@
"movement_range_y": 1,
"trainer_type": 1,
"trainer_sight_or_berry_tree_id": 4,
- "script": "BattleFrontier_BattlePyramidEmptySquare_EventScript_252C4F",
+ "script": "BattlePyramid_TrainerBattle",
"flag": "0"
},
{
@@ -50,7 +50,7 @@
"movement_range_y": 1,
"trainer_type": 1,
"trainer_sight_or_berry_tree_id": 3,
- "script": "BattleFrontier_BattlePyramidEmptySquare_EventScript_252C4F",
+ "script": "BattlePyramid_TrainerBattle",
"flag": "0"
},
{
@@ -63,7 +63,7 @@
"movement_range_y": 1,
"trainer_type": 1,
"trainer_sight_or_berry_tree_id": 4,
- "script": "BattleFrontier_BattlePyramidEmptySquare_EventScript_252C4F",
+ "script": "BattlePyramid_TrainerBattle",
"flag": "0"
},
{
@@ -76,7 +76,7 @@
"movement_range_y": 1,
"trainer_type": 0,
"trainer_sight_or_berry_tree_id": 0,
- "script": "BattleFrontier_BattlePyramidEmptySquare_EventScript_252C6A",
+ "script": "BattlePyramid_FindItemBall",
"flag": "0"
},
{
@@ -89,7 +89,7 @@
"movement_range_y": 1,
"trainer_type": 0,
"trainer_sight_or_berry_tree_id": 0,
- "script": "BattleFrontier_BattlePyramidEmptySquare_EventScript_252C6A",
+ "script": "BattlePyramid_FindItemBall",
"flag": "0"
},
{
@@ -102,7 +102,7 @@
"movement_range_y": 1,
"trainer_type": 0,
"trainer_sight_or_berry_tree_id": 0,
- "script": "BattleFrontier_BattlePyramidEmptySquare_EventScript_252C6A",
+ "script": "BattlePyramid_FindItemBall",
"flag": "0"
}
],
diff --git a/data/maps/BattlePyramidSquare08/map.json b/data/maps/BattlePyramidSquare08/map.json
index 6939b8a7e..ab7be039c 100644
--- a/data/maps/BattlePyramidSquare08/map.json
+++ b/data/maps/BattlePyramidSquare08/map.json
@@ -24,7 +24,7 @@
"movement_range_y": 1,
"trainer_type": 1,
"trainer_sight_or_berry_tree_id": 5,
- "script": "BattleFrontier_BattlePyramidEmptySquare_EventScript_252C4F",
+ "script": "BattlePyramid_TrainerBattle",
"flag": "0"
},
{
@@ -37,7 +37,7 @@
"movement_range_y": 1,
"trainer_type": 1,
"trainer_sight_or_berry_tree_id": 5,
- "script": "BattleFrontier_BattlePyramidEmptySquare_EventScript_252C4F",
+ "script": "BattlePyramid_TrainerBattle",
"flag": "0"
},
{
@@ -50,7 +50,7 @@
"movement_range_y": 1,
"trainer_type": 1,
"trainer_sight_or_berry_tree_id": 5,
- "script": "BattleFrontier_BattlePyramidEmptySquare_EventScript_252C4F",
+ "script": "BattlePyramid_TrainerBattle",
"flag": "0"
},
{
@@ -63,7 +63,7 @@
"movement_range_y": 1,
"trainer_type": 1,
"trainer_sight_or_berry_tree_id": 5,
- "script": "BattleFrontier_BattlePyramidEmptySquare_EventScript_252C4F",
+ "script": "BattlePyramid_TrainerBattle",
"flag": "0"
},
{
@@ -76,7 +76,7 @@
"movement_range_y": 1,
"trainer_type": 0,
"trainer_sight_or_berry_tree_id": 0,
- "script": "BattleFrontier_BattlePyramidEmptySquare_EventScript_252C6A",
+ "script": "BattlePyramid_FindItemBall",
"flag": "0"
},
{
@@ -89,7 +89,7 @@
"movement_range_y": 1,
"trainer_type": 0,
"trainer_sight_or_berry_tree_id": 0,
- "script": "BattleFrontier_BattlePyramidEmptySquare_EventScript_252C6A",
+ "script": "BattlePyramid_FindItemBall",
"flag": "0"
},
{
@@ -102,7 +102,7 @@
"movement_range_y": 1,
"trainer_type": 0,
"trainer_sight_or_berry_tree_id": 0,
- "script": "BattleFrontier_BattlePyramidEmptySquare_EventScript_252C6A",
+ "script": "BattlePyramid_FindItemBall",
"flag": "0"
}
],
diff --git a/data/maps/BattlePyramidSquare09/map.json b/data/maps/BattlePyramidSquare09/map.json
index 56380e991..1add766dc 100644
--- a/data/maps/BattlePyramidSquare09/map.json
+++ b/data/maps/BattlePyramidSquare09/map.json
@@ -24,7 +24,7 @@
"movement_range_y": 1,
"trainer_type": 1,
"trainer_sight_or_berry_tree_id": 5,
- "script": "BattleFrontier_BattlePyramidEmptySquare_EventScript_252C4F",
+ "script": "BattlePyramid_TrainerBattle",
"flag": "0"
},
{
@@ -37,7 +37,7 @@
"movement_range_y": 1,
"trainer_type": 1,
"trainer_sight_or_berry_tree_id": 4,
- "script": "BattleFrontier_BattlePyramidEmptySquare_EventScript_252C4F",
+ "script": "BattlePyramid_TrainerBattle",
"flag": "0"
},
{
@@ -50,7 +50,7 @@
"movement_range_y": 1,
"trainer_type": 1,
"trainer_sight_or_berry_tree_id": 4,
- "script": "BattleFrontier_BattlePyramidEmptySquare_EventScript_252C4F",
+ "script": "BattlePyramid_TrainerBattle",
"flag": "0"
},
{
@@ -63,7 +63,7 @@
"movement_range_y": 1,
"trainer_type": 1,
"trainer_sight_or_berry_tree_id": 5,
- "script": "BattleFrontier_BattlePyramidEmptySquare_EventScript_252C4F",
+ "script": "BattlePyramid_TrainerBattle",
"flag": "0"
},
{
@@ -76,7 +76,7 @@
"movement_range_y": 1,
"trainer_type": 0,
"trainer_sight_or_berry_tree_id": 0,
- "script": "BattleFrontier_BattlePyramidEmptySquare_EventScript_252C6A",
+ "script": "BattlePyramid_FindItemBall",
"flag": "0"
},
{
@@ -89,7 +89,7 @@
"movement_range_y": 1,
"trainer_type": 0,
"trainer_sight_or_berry_tree_id": 0,
- "script": "BattleFrontier_BattlePyramidEmptySquare_EventScript_252C6A",
+ "script": "BattlePyramid_FindItemBall",
"flag": "0"
},
{
@@ -102,7 +102,7 @@
"movement_range_y": 1,
"trainer_type": 0,
"trainer_sight_or_berry_tree_id": 0,
- "script": "BattleFrontier_BattlePyramidEmptySquare_EventScript_252C6A",
+ "script": "BattlePyramid_FindItemBall",
"flag": "0"
}
],
diff --git a/data/maps/BattlePyramidSquare10/map.json b/data/maps/BattlePyramidSquare10/map.json
index 33534391b..1450e644c 100644
--- a/data/maps/BattlePyramidSquare10/map.json
+++ b/data/maps/BattlePyramidSquare10/map.json
@@ -24,7 +24,7 @@
"movement_range_y": 1,
"trainer_type": 1,
"trainer_sight_or_berry_tree_id": 3,
- "script": "BattleFrontier_BattlePyramidEmptySquare_EventScript_252C4F",
+ "script": "BattlePyramid_TrainerBattle",
"flag": "0"
},
{
@@ -37,7 +37,7 @@
"movement_range_y": 1,
"trainer_type": 1,
"trainer_sight_or_berry_tree_id": 3,
- "script": "BattleFrontier_BattlePyramidEmptySquare_EventScript_252C4F",
+ "script": "BattlePyramid_TrainerBattle",
"flag": "0"
},
{
@@ -50,7 +50,7 @@
"movement_range_y": 1,
"trainer_type": 1,
"trainer_sight_or_berry_tree_id": 6,
- "script": "BattleFrontier_BattlePyramidEmptySquare_EventScript_252C4F",
+ "script": "BattlePyramid_TrainerBattle",
"flag": "0"
},
{
@@ -63,7 +63,7 @@
"movement_range_y": 1,
"trainer_type": 1,
"trainer_sight_or_berry_tree_id": 7,
- "script": "BattleFrontier_BattlePyramidEmptySquare_EventScript_252C4F",
+ "script": "BattlePyramid_TrainerBattle",
"flag": "0"
},
{
@@ -76,7 +76,7 @@
"movement_range_y": 1,
"trainer_type": 0,
"trainer_sight_or_berry_tree_id": 0,
- "script": "BattleFrontier_BattlePyramidEmptySquare_EventScript_252C6A",
+ "script": "BattlePyramid_FindItemBall",
"flag": "0"
},
{
@@ -89,7 +89,7 @@
"movement_range_y": 1,
"trainer_type": 0,
"trainer_sight_or_berry_tree_id": 0,
- "script": "BattleFrontier_BattlePyramidEmptySquare_EventScript_252C6A",
+ "script": "BattlePyramid_FindItemBall",
"flag": "0"
},
{
@@ -102,7 +102,7 @@
"movement_range_y": 1,
"trainer_type": 0,
"trainer_sight_or_berry_tree_id": 0,
- "script": "BattleFrontier_BattlePyramidEmptySquare_EventScript_252C6A",
+ "script": "BattlePyramid_FindItemBall",
"flag": "0"
}
],
diff --git a/data/maps/BattlePyramidSquare11/map.json b/data/maps/BattlePyramidSquare11/map.json
index f22855aa2..d4ebaaa2d 100644
--- a/data/maps/BattlePyramidSquare11/map.json
+++ b/data/maps/BattlePyramidSquare11/map.json
@@ -24,7 +24,7 @@
"movement_range_y": 1,
"trainer_type": 1,
"trainer_sight_or_berry_tree_id": 5,
- "script": "BattleFrontier_BattlePyramidEmptySquare_EventScript_252C4F",
+ "script": "BattlePyramid_TrainerBattle",
"flag": "0"
},
{
@@ -37,7 +37,7 @@
"movement_range_y": 1,
"trainer_type": 1,
"trainer_sight_or_berry_tree_id": 4,
- "script": "BattleFrontier_BattlePyramidEmptySquare_EventScript_252C4F",
+ "script": "BattlePyramid_TrainerBattle",
"flag": "0"
},
{
@@ -50,7 +50,7 @@
"movement_range_y": 1,
"trainer_type": 1,
"trainer_sight_or_berry_tree_id": 3,
- "script": "BattleFrontier_BattlePyramidEmptySquare_EventScript_252C4F",
+ "script": "BattlePyramid_TrainerBattle",
"flag": "0"
},
{
@@ -63,7 +63,7 @@
"movement_range_y": 1,
"trainer_type": 1,
"trainer_sight_or_berry_tree_id": 3,
- "script": "BattleFrontier_BattlePyramidEmptySquare_EventScript_252C4F",
+ "script": "BattlePyramid_TrainerBattle",
"flag": "0"
},
{
@@ -76,7 +76,7 @@
"movement_range_y": 1,
"trainer_type": 0,
"trainer_sight_or_berry_tree_id": 0,
- "script": "BattleFrontier_BattlePyramidEmptySquare_EventScript_252C6A",
+ "script": "BattlePyramid_FindItemBall",
"flag": "0"
},
{
@@ -89,7 +89,7 @@
"movement_range_y": 1,
"trainer_type": 0,
"trainer_sight_or_berry_tree_id": 0,
- "script": "BattleFrontier_BattlePyramidEmptySquare_EventScript_252C6A",
+ "script": "BattlePyramid_FindItemBall",
"flag": "0"
},
{
@@ -102,7 +102,7 @@
"movement_range_y": 1,
"trainer_type": 0,
"trainer_sight_or_berry_tree_id": 0,
- "script": "BattleFrontier_BattlePyramidEmptySquare_EventScript_252C6A",
+ "script": "BattlePyramid_FindItemBall",
"flag": "0"
}
],
diff --git a/data/maps/BattlePyramidSquare12/map.json b/data/maps/BattlePyramidSquare12/map.json
index d8e0d45a9..29063c950 100644
--- a/data/maps/BattlePyramidSquare12/map.json
+++ b/data/maps/BattlePyramidSquare12/map.json
@@ -24,7 +24,7 @@
"movement_range_y": 1,
"trainer_type": 1,
"trainer_sight_or_berry_tree_id": 7,
- "script": "BattleFrontier_BattlePyramidEmptySquare_EventScript_252C4F",
+ "script": "BattlePyramid_TrainerBattle",
"flag": "0"
},
{
@@ -37,7 +37,7 @@
"movement_range_y": 1,
"trainer_type": 1,
"trainer_sight_or_berry_tree_id": 7,
- "script": "BattleFrontier_BattlePyramidEmptySquare_EventScript_252C4F",
+ "script": "BattlePyramid_TrainerBattle",
"flag": "0"
},
{
@@ -50,7 +50,7 @@
"movement_range_y": 1,
"trainer_type": 1,
"trainer_sight_or_berry_tree_id": 6,
- "script": "BattleFrontier_BattlePyramidEmptySquare_EventScript_252C4F",
+ "script": "BattlePyramid_TrainerBattle",
"flag": "0"
},
{
@@ -63,7 +63,7 @@
"movement_range_y": 1,
"trainer_type": 1,
"trainer_sight_or_berry_tree_id": 3,
- "script": "BattleFrontier_BattlePyramidEmptySquare_EventScript_252C4F",
+ "script": "BattlePyramid_TrainerBattle",
"flag": "0"
},
{
@@ -76,7 +76,7 @@
"movement_range_y": 1,
"trainer_type": 0,
"trainer_sight_or_berry_tree_id": 0,
- "script": "BattleFrontier_BattlePyramidEmptySquare_EventScript_252C6A",
+ "script": "BattlePyramid_FindItemBall",
"flag": "0"
},
{
@@ -89,7 +89,7 @@
"movement_range_y": 1,
"trainer_type": 0,
"trainer_sight_or_berry_tree_id": 0,
- "script": "BattleFrontier_BattlePyramidEmptySquare_EventScript_252C6A",
+ "script": "BattlePyramid_FindItemBall",
"flag": "0"
},
{
@@ -102,7 +102,7 @@
"movement_range_y": 1,
"trainer_type": 0,
"trainer_sight_or_berry_tree_id": 0,
- "script": "BattleFrontier_BattlePyramidEmptySquare_EventScript_252C6A",
+ "script": "BattlePyramid_FindItemBall",
"flag": "0"
}
],
diff --git a/data/maps/BattlePyramidSquare13/map.json b/data/maps/BattlePyramidSquare13/map.json
index 880178e0e..71fb71e5d 100644
--- a/data/maps/BattlePyramidSquare13/map.json
+++ b/data/maps/BattlePyramidSquare13/map.json
@@ -24,7 +24,7 @@
"movement_range_y": 1,
"trainer_type": 1,
"trainer_sight_or_berry_tree_id": 6,
- "script": "BattleFrontier_BattlePyramidEmptySquare_EventScript_252C4F",
+ "script": "BattlePyramid_TrainerBattle",
"flag": "0"
},
{
@@ -37,7 +37,7 @@
"movement_range_y": 1,
"trainer_type": 1,
"trainer_sight_or_berry_tree_id": 6,
- "script": "BattleFrontier_BattlePyramidEmptySquare_EventScript_252C4F",
+ "script": "BattlePyramid_TrainerBattle",
"flag": "0"
},
{
@@ -50,7 +50,7 @@
"movement_range_y": 1,
"trainer_type": 1,
"trainer_sight_or_berry_tree_id": 6,
- "script": "BattleFrontier_BattlePyramidEmptySquare_EventScript_252C4F",
+ "script": "BattlePyramid_TrainerBattle",
"flag": "0"
},
{
@@ -63,7 +63,7 @@
"movement_range_y": 1,
"trainer_type": 1,
"trainer_sight_or_berry_tree_id": 6,
- "script": "BattleFrontier_BattlePyramidEmptySquare_EventScript_252C4F",
+ "script": "BattlePyramid_TrainerBattle",
"flag": "0"
},
{
@@ -76,7 +76,7 @@
"movement_range_y": 1,
"trainer_type": 0,
"trainer_sight_or_berry_tree_id": 0,
- "script": "BattleFrontier_BattlePyramidEmptySquare_EventScript_252C6A",
+ "script": "BattlePyramid_FindItemBall",
"flag": "0"
},
{
@@ -89,7 +89,7 @@
"movement_range_y": 1,
"trainer_type": 0,
"trainer_sight_or_berry_tree_id": 0,
- "script": "BattleFrontier_BattlePyramidEmptySquare_EventScript_252C6A",
+ "script": "BattlePyramid_FindItemBall",
"flag": "0"
},
{
@@ -102,7 +102,7 @@
"movement_range_y": 1,
"trainer_type": 0,
"trainer_sight_or_berry_tree_id": 0,
- "script": "BattleFrontier_BattlePyramidEmptySquare_EventScript_252C6A",
+ "script": "BattlePyramid_FindItemBall",
"flag": "0"
}
],
diff --git a/data/maps/BattlePyramidSquare14/map.json b/data/maps/BattlePyramidSquare14/map.json
index 423346532..3398dcd47 100644
--- a/data/maps/BattlePyramidSquare14/map.json
+++ b/data/maps/BattlePyramidSquare14/map.json
@@ -24,7 +24,7 @@
"movement_range_y": 1,
"trainer_type": 1,
"trainer_sight_or_berry_tree_id": 7,
- "script": "BattleFrontier_BattlePyramidEmptySquare_EventScript_252C4F",
+ "script": "BattlePyramid_TrainerBattle",
"flag": "0"
},
{
@@ -37,7 +37,7 @@
"movement_range_y": 1,
"trainer_type": 1,
"trainer_sight_or_berry_tree_id": 6,
- "script": "BattleFrontier_BattlePyramidEmptySquare_EventScript_252C4F",
+ "script": "BattlePyramid_TrainerBattle",
"flag": "0"
},
{
@@ -50,7 +50,7 @@
"movement_range_y": 1,
"trainer_type": 1,
"trainer_sight_or_berry_tree_id": 6,
- "script": "BattleFrontier_BattlePyramidEmptySquare_EventScript_252C4F",
+ "script": "BattlePyramid_TrainerBattle",
"flag": "0"
},
{
@@ -63,7 +63,7 @@
"movement_range_y": 1,
"trainer_type": 1,
"trainer_sight_or_berry_tree_id": 7,
- "script": "BattleFrontier_BattlePyramidEmptySquare_EventScript_252C4F",
+ "script": "BattlePyramid_TrainerBattle",
"flag": "0"
},
{
@@ -76,7 +76,7 @@
"movement_range_y": 1,
"trainer_type": 0,
"trainer_sight_or_berry_tree_id": 0,
- "script": "BattleFrontier_BattlePyramidEmptySquare_EventScript_252C6A",
+ "script": "BattlePyramid_FindItemBall",
"flag": "0"
},
{
@@ -89,7 +89,7 @@
"movement_range_y": 1,
"trainer_type": 0,
"trainer_sight_or_berry_tree_id": 0,
- "script": "BattleFrontier_BattlePyramidEmptySquare_EventScript_252C6A",
+ "script": "BattlePyramid_FindItemBall",
"flag": "0"
},
{
@@ -102,7 +102,7 @@
"movement_range_y": 1,
"trainer_type": 0,
"trainer_sight_or_berry_tree_id": 0,
- "script": "BattleFrontier_BattlePyramidEmptySquare_EventScript_252C6A",
+ "script": "BattlePyramid_FindItemBall",
"flag": "0"
}
],
diff --git a/data/maps/BattlePyramidSquare15/map.json b/data/maps/BattlePyramidSquare15/map.json
index 12b1f4cb8..0eb433ae1 100644
--- a/data/maps/BattlePyramidSquare15/map.json
+++ b/data/maps/BattlePyramidSquare15/map.json
@@ -24,7 +24,7 @@
"movement_range_y": 1,
"trainer_type": 1,
"trainer_sight_or_berry_tree_id": 5,
- "script": "BattleFrontier_BattlePyramidEmptySquare_EventScript_252C4F",
+ "script": "BattlePyramid_TrainerBattle",
"flag": "0"
},
{
@@ -37,7 +37,7 @@
"movement_range_y": 1,
"trainer_type": 1,
"trainer_sight_or_berry_tree_id": 6,
- "script": "BattleFrontier_BattlePyramidEmptySquare_EventScript_252C4F",
+ "script": "BattlePyramid_TrainerBattle",
"flag": "0"
},
{
@@ -50,7 +50,7 @@
"movement_range_y": 1,
"trainer_type": 1,
"trainer_sight_or_berry_tree_id": 4,
- "script": "BattleFrontier_BattlePyramidEmptySquare_EventScript_252C4F",
+ "script": "BattlePyramid_TrainerBattle",
"flag": "0"
},
{
@@ -63,7 +63,7 @@
"movement_range_y": 1,
"trainer_type": 1,
"trainer_sight_or_berry_tree_id": 4,
- "script": "BattleFrontier_BattlePyramidEmptySquare_EventScript_252C4F",
+ "script": "BattlePyramid_TrainerBattle",
"flag": "0"
},
{
@@ -76,7 +76,7 @@
"movement_range_y": 1,
"trainer_type": 0,
"trainer_sight_or_berry_tree_id": 0,
- "script": "BattleFrontier_BattlePyramidEmptySquare_EventScript_252C6A",
+ "script": "BattlePyramid_FindItemBall",
"flag": "0"
},
{
@@ -89,7 +89,7 @@
"movement_range_y": 1,
"trainer_type": 0,
"trainer_sight_or_berry_tree_id": 0,
- "script": "BattleFrontier_BattlePyramidEmptySquare_EventScript_252C6A",
+ "script": "BattlePyramid_FindItemBall",
"flag": "0"
},
{
@@ -102,7 +102,7 @@
"movement_range_y": 1,
"trainer_type": 0,
"trainer_sight_or_berry_tree_id": 0,
- "script": "BattleFrontier_BattlePyramidEmptySquare_EventScript_252C6A",
+ "script": "BattlePyramid_FindItemBall",
"flag": "0"
}
],
diff --git a/data/maps/BattlePyramidSquare16/map.json b/data/maps/BattlePyramidSquare16/map.json
index 65fa0a361..e6827e1a3 100644
--- a/data/maps/BattlePyramidSquare16/map.json
+++ b/data/maps/BattlePyramidSquare16/map.json
@@ -24,7 +24,7 @@
"movement_range_y": 1,
"trainer_type": 1,
"trainer_sight_or_berry_tree_id": 6,
- "script": "BattleFrontier_BattlePyramidEmptySquare_EventScript_252C4F",
+ "script": "BattlePyramid_TrainerBattle",
"flag": "0"
},
{
@@ -37,7 +37,7 @@
"movement_range_y": 1,
"trainer_type": 1,
"trainer_sight_or_berry_tree_id": 6,
- "script": "BattleFrontier_BattlePyramidEmptySquare_EventScript_252C4F",
+ "script": "BattlePyramid_TrainerBattle",
"flag": "0"
},
{
@@ -50,7 +50,7 @@
"movement_range_y": 1,
"trainer_type": 1,
"trainer_sight_or_berry_tree_id": 6,
- "script": "BattleFrontier_BattlePyramidEmptySquare_EventScript_252C4F",
+ "script": "BattlePyramid_TrainerBattle",
"flag": "0"
},
{
@@ -63,7 +63,7 @@
"movement_range_y": 1,
"trainer_type": 1,
"trainer_sight_or_berry_tree_id": 6,
- "script": "BattleFrontier_BattlePyramidEmptySquare_EventScript_252C4F",
+ "script": "BattlePyramid_TrainerBattle",
"flag": "0"
},
{
@@ -76,7 +76,7 @@
"movement_range_y": 1,
"trainer_type": 0,
"trainer_sight_or_berry_tree_id": 0,
- "script": "BattleFrontier_BattlePyramidEmptySquare_EventScript_252C6A",
+ "script": "BattlePyramid_FindItemBall",
"flag": "0"
},
{
@@ -89,7 +89,7 @@
"movement_range_y": 1,
"trainer_type": 0,
"trainer_sight_or_berry_tree_id": 0,
- "script": "BattleFrontier_BattlePyramidEmptySquare_EventScript_252C6A",
+ "script": "BattlePyramid_FindItemBall",
"flag": "0"
},
{
@@ -102,7 +102,7 @@
"movement_range_y": 1,
"trainer_type": 0,
"trainer_sight_or_berry_tree_id": 0,
- "script": "BattleFrontier_BattlePyramidEmptySquare_EventScript_252C6A",
+ "script": "BattlePyramid_FindItemBall",
"flag": "0"
}
],
diff --git a/include/battle_pyramid.h b/include/battle_pyramid.h
index 6936cfd42..d77172d0b 100644
--- a/include/battle_pyramid.h
+++ b/include/battle_pyramid.h
@@ -4,20 +4,20 @@
void CallBattlePyramidFunction(void);
u16 LocalIdToPyramidTrainerId(u8 localId);
bool8 GetBattlePyramidTrainerFlag(u8 eventId);
-void sub_81A9B04(void);
+void MarkApproachingPyramidTrainersAsBattled(void);
void GenerateBattlePyramidWildMon(void);
u8 GetPyramidRunMultiplier(void);
u8 InBattlePyramid(void);
bool8 InBattlePyramid_(void);
void sub_81A9E90(void);
-void sub_81A9EC8(void);
+void SoftResetInBattlePyramid(void);
void CopyPyramidTrainerSpeechBefore(u16 trainerId);
void CopyPyramidTrainerWinSpeech(u16 trainerId);
void CopyPyramidTrainerLoseSpeech(u16 trainerId);
-u8 GetTrainerEncounterMusicIdInBattlePyramind(u16 trainerId);
+u8 GetBattlePyramindTrainerEncounterMusicId(u16 trainerId);
void GenerateBattlePyramidFloorLayout(u16 *mapArg, bool8 setPlayerPosition);
-void sub_81AA1D8(void);
-void sub_81AA2F8(void);
+void LoadBattlePyramidEventObjectTemplates(void);
+void LoadBattlePyramidFloorEventObjectScripts(void);
u8 GetNumBattlePyramidEventObjects(void);
u16 GetBattlePyramidPickupItemId(void);
diff --git a/include/event_scripts.h b/include/event_scripts.h
index afeac6628..65e2c74b7 100644
--- a/include/event_scripts.h
+++ b/include/event_scripts.h
@@ -576,8 +576,8 @@ extern const u8 gUnknown_082A8350[];
// Battle Pyramid.
extern const u8 BattleFrontier_BattlePyramidEmptySquare_EventScript_252C88[];
-extern const u8 BattleFrontier_BattlePyramidEmptySquare_EventScript_252C4F[];
-extern const u8 BattleFrontier_BattlePyramidEmptySquare_EventScript_252C6A[];
+extern const u8 BattlePyramid_TrainerBattle[];
+extern const u8 BattlePyramid_FindItemBall[];
// fldeff misc
extern const u8 EventScript_275A86[];
diff --git a/include/global.h b/include/global.h
index 903dbe63a..6c1b7c5bb 100644
--- a/include/global.h
+++ b/include/global.h
@@ -316,7 +316,7 @@ struct BattleFrontier
/*0xCAA*/ u16 selectedPartyMons[3];
/*0xCB0*/ u16 field_CB0;
/*0xCB2*/ u16 curChallengeBattleNum; // In case of battle pyramid, the floor.
- /*0xCB4*/ u16 field_CB4[20];
+ /*0xCB4*/ u16 trainerIds[20];
/*0xCDC*/ u32 field_CDC;
/*0xCE0*/ u16 towerWinStreaks[4][2];
/*0xCF0*/ u16 towerRecordWinStreaks[4][2];
diff --git a/porymap.project.cfg b/porymap.project.cfg
new file mode 100755
index 000000000..c6ba8781e
--- /dev/null
+++ b/porymap.project.cfg
@@ -0,0 +1 @@
+base_game_version=pokeemerald
diff --git a/src/battle_factory.c b/src/battle_factory.c
index c025dc139..db67b0b13 100644
--- a/src/battle_factory.c
+++ b/src/battle_factory.c
@@ -304,14 +304,14 @@ static void sub_81A61B0(void)
trainerId = sub_8162548(challengeNum, gSaveBlock2Ptr->frontier.curChallengeBattleNum);
for (i = 0; i < gSaveBlock2Ptr->frontier.curChallengeBattleNum; i++)
{
- if (gSaveBlock2Ptr->frontier.field_CB4[i] == trainerId)
+ if (gSaveBlock2Ptr->frontier.trainerIds[i] == trainerId)
break;
}
} while (i != gSaveBlock2Ptr->frontier.curChallengeBattleNum);
gTrainerBattleOpponent_A = trainerId;
if (gSaveBlock2Ptr->frontier.curChallengeBattleNum < 6)
- gSaveBlock2Ptr->frontier.field_CB4[gSaveBlock2Ptr->frontier.curChallengeBattleNum] = trainerId;
+ gSaveBlock2Ptr->frontier.trainerIds[gSaveBlock2Ptr->frontier.curChallengeBattleNum] = trainerId;
i = 0;
while (i != 3)
diff --git a/src/battle_pike.c b/src/battle_pike.c
index bdf6e8027..a93a5725d 100644
--- a/src/battle_pike.c
+++ b/src/battle_pike.c
@@ -1393,7 +1393,7 @@ static void PrepareOneTrainer(bool8 difficult)
trainerId = sub_8162548(challengeNum, battleNum);
for (i = 0; i < gSaveBlock2Ptr->frontier.curChallengeBattleNum - 1; i++)
{
- if (gSaveBlock2Ptr->frontier.field_CB4[i] == trainerId)
+ if (gSaveBlock2Ptr->frontier.trainerIds[i] == trainerId)
break;
}
} while (i != gSaveBlock2Ptr->frontier.curChallengeBattleNum - 1);
@@ -1402,7 +1402,7 @@ static void PrepareOneTrainer(bool8 difficult)
gFacilityTrainers = gBattleFrontierTrainers;
SetBattleFacilityTrainerGfxId(gTrainerBattleOpponent_A, 0);
if (gSaveBlock2Ptr->frontier.curChallengeBattleNum < 14)
- gSaveBlock2Ptr->frontier.field_CB4[gSaveBlock2Ptr->frontier.curChallengeBattleNum - 1] = gTrainerBattleOpponent_A;
+ gSaveBlock2Ptr->frontier.trainerIds[gSaveBlock2Ptr->frontier.curChallengeBattleNum - 1] = gTrainerBattleOpponent_A;
}
static void PrepareTwoTrainers(void)
@@ -1418,7 +1418,7 @@ static void PrepareTwoTrainers(void)
trainerId = sub_8162548(challengeNum, 1);
for (i = 0; i < gSaveBlock2Ptr->frontier.curChallengeBattleNum - 1; i++)
{
- if (gSaveBlock2Ptr->frontier.field_CB4[i] == trainerId)
+ if (gSaveBlock2Ptr->frontier.trainerIds[i] == trainerId)
break;
}
} while (i != gSaveBlock2Ptr->frontier.curChallengeBattleNum - 1);
@@ -1426,14 +1426,14 @@ static void PrepareTwoTrainers(void)
gTrainerBattleOpponent_A = trainerId;
SetBattleFacilityTrainerGfxId(gTrainerBattleOpponent_A, 0);
if (gSaveBlock2Ptr->frontier.curChallengeBattleNum <= 14)
- gSaveBlock2Ptr->frontier.field_CB4[gSaveBlock2Ptr->frontier.curChallengeBattleNum - 1] = gTrainerBattleOpponent_A;
+ gSaveBlock2Ptr->frontier.trainerIds[gSaveBlock2Ptr->frontier.curChallengeBattleNum - 1] = gTrainerBattleOpponent_A;
do
{
trainerId = sub_8162548(challengeNum, 1);
for (i = 0; i < gSaveBlock2Ptr->frontier.curChallengeBattleNum; i++)
{
- if (gSaveBlock2Ptr->frontier.field_CB4[i] == trainerId)
+ if (gSaveBlock2Ptr->frontier.trainerIds[i] == trainerId)
break;
}
} while (i != gSaveBlock2Ptr->frontier.curChallengeBattleNum);
@@ -1441,7 +1441,7 @@ static void PrepareTwoTrainers(void)
gTrainerBattleOpponent_B = trainerId;
SetBattleFacilityTrainerGfxId(gTrainerBattleOpponent_B, 1);
if (gSaveBlock2Ptr->frontier.curChallengeBattleNum < 14)
- gSaveBlock2Ptr->frontier.field_CB4[gSaveBlock2Ptr->frontier.curChallengeBattleNum - 2] = gTrainerBattleOpponent_B;
+ gSaveBlock2Ptr->frontier.trainerIds[gSaveBlock2Ptr->frontier.curChallengeBattleNum - 2] = gTrainerBattleOpponent_B;
}
static void sub_81A84B4(void)
@@ -1449,7 +1449,7 @@ static void sub_81A84B4(void)
u8 i;
for (i = 0; i < 14; i++)
- gSaveBlock2Ptr->frontier.field_CB4[i] = 0xFFFF;
+ gSaveBlock2Ptr->frontier.trainerIds[i] = 0xFFFF;
}
static void sub_81A84EC(void)
diff --git a/src/battle_pyramid.c b/src/battle_pyramid.c
index 9aa006985..aa088e6c6 100644
--- a/src/battle_pyramid.c
+++ b/src/battle_pyramid.c
@@ -57,6 +57,21 @@ enum
HINT_EXIT_FAR_REMAINING_ITEMS,
};
+enum
+{
+ OBJ_TRAINERS,
+ OBJ_ITEMS,
+};
+
+enum
+{
+ OBJ_POSITIONS_UNIFORM,
+ OBJ_POSITIONS_IN_AND_NEAR_ENTRANCE,
+ OBJ_POSITIONS_IN_AND_NEAR_EXIT,
+ OBJ_POSITIONS_NEAR_NEAR_ENTRANCE,
+ OBJ_POSITIONS_NEAR_NEAR_EXIT,
+};
+
struct PyramidWildMon
{
u16 species;
@@ -69,8 +84,8 @@ struct PyramidFloorTemplate
{
u8 numItems;
u8 numTrainers;
- u8 unk2;
- u8 unk3;
+ u8 itemPositions;
+ u8 trainerPositions;
u8 runMultiplier;
u8 layoutOffsets[8];
};
@@ -99,19 +114,19 @@ static void UpdatePyramidLightRadius(void);
static void ClearPyramidPartyHeldItems(void);
static void SetPyramidFloorPalette(void);
static void sub_81A9828(void);
-static void RestorePlayerPartyAfterPyramid(void);
+static void RestorePyramidPlayerParty(void);
static void InitPyramidBagItems(u8 lvlMode);
static u8 GetPyramidFloorTemplateId(void);
static u8 GetPostBattleDirectionHintTextIndex(int *, u8, u8);
static void Task_SetPyramidFloorPalette(u8 taskId);
-static void sub_81A9B44(u16 trainerId);
-static void SetPyramidFloorLayoutOffsets(u8 *layoutOffsets);
-static void SetPyramidEntranceAndExitSquareIds(u8 *, u8 *);
-static void sub_81AA398(u8);
-static bool8 sub_81AA4D8(u8, u8);
-static bool8 sub_81AA648(u8, u8);
-static bool8 sub_81AA760(u8 arg0, u8 *floorLayoutOffsets, u8 squareId, u8 eventObjectId);
-static bool8 sub_81AA810(u8 arg0, u8 x, u8 y, u8 *floorLayoutOffsets, u8 squareId, u8 eventObjectId);
+static void MarkPyramidTrainerAsBattled(u16 trainerId);
+static void GetPyramidFloorLayoutOffsets(u8 *layoutOffsets);
+static void GetPyramidEntranceAndExitSquareIds(u8 *, u8 *);
+static void SetPyramidObjectPositionsUniformly(u8);
+static bool8 SetPyramidObjectPositionsInAndNearSquare(u8, u8);
+static bool8 SetPyramidObjectPositionsNearSquare(u8, u8);
+static bool8 TrySetPyramidEventObjectPositionInSquare(u8 arg0, u8 *floorLayoutOffsets, u8 squareId, u8 eventObjectId);
+static bool8 TrySetPyramidEventObjectPositionAtCoords(bool8 objType, u8 x, u8 y, u8 *floorLayoutOffsets, u8 squareId, u8 eventObjectId);
// Const rom data.
#include "data/battle_frontier/battle_pyramid_level_50_wild_mons.h"
@@ -122,129 +137,129 @@ static const struct PyramidFloorTemplate sPyramidFloorTemplates[] =
{
.numItems = 7,
.numTrainers = 3,
- .unk2 = 0x00,
- .unk3 = 0x00,
- .runMultiplier = 0x80,
+ .itemPositions = OBJ_POSITIONS_UNIFORM,
+ .trainerPositions = OBJ_POSITIONS_UNIFORM,
+ .runMultiplier = 128,
.layoutOffsets = {0, 0, 1, 1, 2, 2, 3, 3},
},
{
.numItems = 6,
.numTrainers = 3,
- .unk2 = 0x00,
- .unk3 = 0x00,
- .runMultiplier = 0x80,
+ .itemPositions = OBJ_POSITIONS_UNIFORM,
+ .trainerPositions = OBJ_POSITIONS_UNIFORM,
+ .runMultiplier = 128,
.layoutOffsets = {1, 1, 2, 2, 3, 3, 4, 4},
},
{
.numItems = 5,
.numTrainers = 3,
- .unk2 = 0x00,
- .unk3 = 0x00,
- .runMultiplier = 0x78,
+ .itemPositions = OBJ_POSITIONS_UNIFORM,
+ .trainerPositions = OBJ_POSITIONS_UNIFORM,
+ .runMultiplier = 120,
.layoutOffsets = {2, 2, 3, 3, 4, 4, 5, 5},
},
{
.numItems = 4,
.numTrainers = 4,
- .unk2 = 0x00,
- .unk3 = 0x00,
- .runMultiplier = 0x78,
+ .itemPositions = OBJ_POSITIONS_UNIFORM,
+ .trainerPositions = OBJ_POSITIONS_UNIFORM,
+ .runMultiplier = 120,
.layoutOffsets = {3, 3, 4, 4, 5, 5, 6, 6},
},
{
.numItems = 4,
.numTrainers = 4,
- .unk2 = 0x00,
- .unk3 = 0x01,
- .runMultiplier = 0x70,
+ .itemPositions = OBJ_POSITIONS_UNIFORM,
+ .trainerPositions = OBJ_POSITIONS_IN_AND_NEAR_ENTRANCE,
+ .runMultiplier = 112,
.layoutOffsets = {4, 4, 5, 5, 6, 6, 7, 7},
},
{
.numItems = 3,
.numTrainers = 5,
- .unk2 = 0x00,
- .unk3 = 0x02,
- .runMultiplier = 0x70,
+ .itemPositions = OBJ_POSITIONS_UNIFORM,
+ .trainerPositions = OBJ_POSITIONS_IN_AND_NEAR_EXIT,
+ .runMultiplier = 112,
.layoutOffsets = {5, 6, 7, 8, 9, 10, 11, 12},
},
{
.numItems = 3,
.numTrainers = 5,
- .unk2 = 0x00,
- .unk3 = 0x00,
- .runMultiplier = 0x68,
+ .itemPositions = OBJ_POSITIONS_UNIFORM,
+ .trainerPositions = OBJ_POSITIONS_UNIFORM,
+ .runMultiplier = 104,
.layoutOffsets = {6, 7, 8, 9, 10, 11, 12, 13},
},
{
.numItems = 2,
.numTrainers = 4,
- .unk2 = 0x00,
- .unk3 = 0x01,
- .runMultiplier = 0x68,
+ .itemPositions = OBJ_POSITIONS_UNIFORM,
+ .trainerPositions = OBJ_POSITIONS_IN_AND_NEAR_ENTRANCE,
+ .runMultiplier = 104,
.layoutOffsets = {7, 8, 9, 10, 11, 12, 13, 14},
},
{
.numItems = 4,
.numTrainers = 5,
- .unk2 = 0x00,
- .unk3 = 0x02,
- .runMultiplier = 0x60,
+ .itemPositions = OBJ_POSITIONS_UNIFORM,
+ .trainerPositions = OBJ_POSITIONS_IN_AND_NEAR_EXIT,
+ .runMultiplier = 96,
.layoutOffsets = {8, 9, 10, 11, 12, 13, 14, 15},
},
{
.numItems = 3,
.numTrainers = 6,
- .unk2 = 0x00,
- .unk3 = 0x04,
- .runMultiplier = 0x60,
+ .itemPositions = OBJ_POSITIONS_UNIFORM,
+ .trainerPositions = OBJ_POSITIONS_NEAR_NEAR_EXIT,
+ .runMultiplier = 96,
.layoutOffsets = {8, 9, 10, 11, 12, 13, 14, 15},
},
{
.numItems = 2,
.numTrainers = 3,
- .unk2 = 0x00,
- .unk3 = 0x00,
- .runMultiplier = 0x58,
+ .itemPositions = OBJ_POSITIONS_UNIFORM,
+ .trainerPositions = OBJ_POSITIONS_UNIFORM,
+ .runMultiplier = 88,
.layoutOffsets = {12, 13, 14, 12, 13, 14, 12, 13},
},
{
.numItems = 4,
.numTrainers = 5,
- .unk2 = 0x00,
- .unk3 = 0x00,
- .runMultiplier = 0x58,
+ .itemPositions = OBJ_POSITIONS_UNIFORM,
+ .trainerPositions = OBJ_POSITIONS_UNIFORM,
+ .runMultiplier = 88,
.layoutOffsets = {11, 11, 11, 11, 11, 11, 11, 11},
},
{
.numItems = 3,
.numTrainers = 7,
- .unk2 = 0x00,
- .unk3 = 0x00,
- .runMultiplier = 0x50,
+ .itemPositions = OBJ_POSITIONS_UNIFORM,
+ .trainerPositions = OBJ_POSITIONS_UNIFORM,
+ .runMultiplier = 80,
.layoutOffsets = {12, 12, 12, 12, 12, 12, 12, 12},
},
{
.numItems = 2,
.numTrainers = 4,
- .unk2 = 0x00,
- .unk3 = 0x00,
- .runMultiplier = 0x50,
+ .itemPositions = OBJ_POSITIONS_UNIFORM,
+ .trainerPositions = OBJ_POSITIONS_UNIFORM,
+ .runMultiplier = 80,
.layoutOffsets = {13, 13, 13, 13, 13, 13, 13, 13},
},
{
.numItems = 3,
.numTrainers = 6,
- .unk2 = 0x00,
- .unk3 = 0x00,
- .runMultiplier = 0x50,
+ .itemPositions = OBJ_POSITIONS_UNIFORM,
+ .trainerPositions = OBJ_POSITIONS_UNIFORM,
+ .runMultiplier = 80,
.layoutOffsets = {14, 14, 14, 14, 14, 14, 14, 14},
},
{
.numItems = 3,
.numTrainers = 8,
- .unk2 = 0x00,
- .unk3 = 0x00,
- .runMultiplier = 0x50,
+ .itemPositions = OBJ_POSITIONS_UNIFORM,
+ .trainerPositions = OBJ_POSITIONS_UNIFORM,
+ .runMultiplier = 80,
.layoutOffsets = {15, 15, 15, 15, 15, 15, 15, 15},
}
};
@@ -816,7 +831,7 @@ static void (* const sBattlePyramidFunctions[])(void) =
ClearPyramidPartyHeldItems,
SetPyramidFloorPalette,
sub_81A9828,
- RestorePlayerPartyAfterPyramid,
+ RestorePyramidPlayerParty,
};
static const u16 sShortStreakRewardItems[] = {ITEM_HP_UP, ITEM_PROTEIN, ITEM_IRON, ITEM_CALCIUM, ITEM_CARBOS, ITEM_ZINC};
@@ -1209,7 +1224,7 @@ static void sub_81A9828(void)
sub_809FDD4();
}
-static void RestorePlayerPartyAfterPyramid(void)
+static void RestorePyramidPlayerParty(void)
{
int i, j, k, l;
@@ -1317,7 +1332,7 @@ static u8 GetPostBattleDirectionHintTextIndex(int *hintType, u8 minDistanceForEx
u16 LocalIdToPyramidTrainerId(u8 localId)
{
- return gSaveBlock2Ptr->frontier.field_CB4[localId - 1];
+ return gSaveBlock2Ptr->frontier.trainerIds[localId - 1];
}
bool8 GetBattlePyramidTrainerFlag(u8 eventId)
@@ -1325,23 +1340,23 @@ bool8 GetBattlePyramidTrainerFlag(u8 eventId)
return gSaveBlock2Ptr->frontier.pyramidTrainerFlags & gBitTable[gEventObjects[eventId].localId - 1];
}
-void sub_81A9B04(void)
+void MarkApproachingPyramidTrainersAsBattled(void)
{
- sub_81A9B44(gTrainerBattleOpponent_A);
+ MarkPyramidTrainerAsBattled(gTrainerBattleOpponent_A);
if (gBattleTypeFlags & BATTLE_TYPE_TWO_OPPONENTS)
{
gSelectedEventObject = GetChosenApproachingTrainerEventObjectId(1);
- sub_81A9B44(gTrainerBattleOpponent_B);
+ MarkPyramidTrainerAsBattled(gTrainerBattleOpponent_B);
}
}
-static void sub_81A9B44(u16 trainerId)
+static void MarkPyramidTrainerAsBattled(u16 trainerId)
{
- s32 i;
+ int i;
for (i = 0; i < 8; i++)
{
- if (gSaveBlock2Ptr->frontier.field_CB4[i] == trainerId)
+ if (gSaveBlock2Ptr->frontier.trainerIds[i] == trainerId)
gSaveBlock2Ptr->frontier.pyramidTrainerFlags |= gBitTable[i];
}
@@ -1354,7 +1369,7 @@ static void sub_81A9B44(u16 trainerId)
void GenerateBattlePyramidWildMon(void)
{
u8 name[POKEMON_NAME_LENGTH + 1];
- s32 i;
+ int i;
const struct PyramidWildMon *wildMons;
u32 id;
u32 lvl = gSaveBlock2Ptr->frontier.lvlMode;
@@ -1410,7 +1425,8 @@ void GenerateBattlePyramidWildMon(void)
for (i = 0; i < MAX_MON_MOVES; i++)
SetMonMoveSlot(&gEnemyParty[0], wildMons[id].moves[i], i);
- if (gSaveBlock2Ptr->frontier.pyramidWinStreaks[lvl] >= 140) // BUG: Reading outside the array as lvl was used for mon level instead of frontier lvl mode.
+ // BUG: Reading outside the array as lvl was used for mon level instead of frontier lvl mode.
+ if (gSaveBlock2Ptr->frontier.pyramidWinStreaks[lvl] >= 140)
{
id = (Random() % 17) + 15;
for (i = 0; i < NUM_STATS; i++)
@@ -1445,14 +1461,14 @@ void sub_81A9E90(void)
{
if (InBattlePyramid())
{
- RestorePlayerPartyAfterPyramid();
+ RestorePyramidPlayerParty();
gSaveBlock2Ptr->frontier.field_CA8 = 2;
VarSet(VAR_TEMP_E, 0);
LoadPlayerParty();
}
}
-void sub_81A9EC8(void)
+void SoftResetInBattlePyramid(void)
{
if (InBattlePyramid())
DoSoftReset();
@@ -1473,7 +1489,7 @@ void CopyPyramidTrainerLoseSpeech(u16 trainerId)
FrontierSpeechToString(gFacilityTrainers[trainerId].speechLose);
}
-u8 GetTrainerEncounterMusicIdInBattlePyramind(u16 trainerId)
+u8 GetBattlePyramindTrainerEncounterMusicId(u16 trainerId)
{
int i;
@@ -1485,12 +1501,12 @@ u8 GetTrainerEncounterMusicIdInBattlePyramind(u16 trainerId)
return TRAINER_ENCOUNTER_MUSIC_MALE;
}
-static void sub_81A9F80(void)
+void sub_81A9F80(void)
{
ScriptContext1_SetupScript(BattleFrontier_BattlePyramidEmptySquare_EventScript_252C88);
}
-static u16 sub_81A9F90(u8 count)
+static u16 GetUniqueTrainerId(u8 eventObjectId)
{
int i;
u16 trainerId;
@@ -1502,24 +1518,24 @@ static u16 sub_81A9F90(u8 count)
do
{
trainerId = sub_8162548(challengeNum + 1, battleNum);
- for (i = 0; i < count; i++)
+ for (i = 0; i < eventObjectId; i++)
{
- if (gSaveBlock2Ptr->frontier.field_CB4[i] == trainerId)
+ if (gSaveBlock2Ptr->frontier.trainerIds[i] == trainerId)
break;
}
- } while (i != count);
+ } while (i != eventObjectId);
}
else
{
do
{
trainerId = sub_8162548(challengeNum, battleNum);
- for (i = 0; i < count; i++)
+ for (i = 0; i < eventObjectId; i++)
{
- if (gSaveBlock2Ptr->frontier.field_CB4[i] == trainerId)
+ if (gSaveBlock2Ptr->frontier.trainerIds[i] == trainerId)
break;
}
- } while (i != count);
+ } while (i != eventObjectId);
}
return trainerId;
@@ -1532,8 +1548,8 @@ void GenerateBattlePyramidFloorLayout(u16 *backupMapData, bool8 setPlayerPositio
u8 entranceSquareId, exitSquareId;
u8 *floorLayoutOffsets = AllocZeroed(16);
- SetPyramidFloorLayoutOffsets(floorLayoutOffsets);
- SetPyramidEntranceAndExitSquareIds(&entranceSquareId, &exitSquareId);
+ GetPyramidFloorLayoutOffsets(floorLayoutOffsets);
+ GetPyramidEntranceAndExitSquareIds(&entranceSquareId, &exitSquareId);
for (i = 0; i < 16; i++)
{
u16 *map;
@@ -1578,67 +1594,67 @@ void GenerateBattlePyramidFloorLayout(u16 *backupMapData, bool8 setPlayerPositio
free(floorLayoutOffsets);
}
-void sub_81AA1D8(void)
+void LoadBattlePyramidEventObjectTemplates(void)
{
int i;
u8 id;
u8 entranceSquareId, exitSquareId;
for (i = 0; i < 8; i++)
- gSaveBlock2Ptr->frontier.field_CB4[i] = 0xFFFF;
+ gSaveBlock2Ptr->frontier.trainerIds[i] = 0xFFFF;
id = GetPyramidFloorTemplateId();
- SetPyramidEntranceAndExitSquareIds(&entranceSquareId, &exitSquareId);
+ GetPyramidEntranceAndExitSquareIds(&entranceSquareId, &exitSquareId);
CpuFill32(0, gSaveBlock1Ptr->eventObjectTemplates, sizeof(gSaveBlock1Ptr->eventObjectTemplates));
for (i = 0; i < 2; i++)
{
- u8 value;
+ u8 objectPositionsType;
- if (i == 0)
- value = sPyramidFloorTemplates[id].unk3;
- else
- value = sPyramidFloorTemplates[id].unk2;
+ if (i == OBJ_TRAINERS)
+ objectPositionsType = sPyramidFloorTemplates[id].trainerPositions;
+ else // OBJ_ITEMS
+ objectPositionsType = sPyramidFloorTemplates[id].itemPositions;
- switch (value)
+ switch (objectPositionsType)
{
- case 0:
- sub_81AA398(i);
+ case OBJ_POSITIONS_UNIFORM:
+ SetPyramidObjectPositionsUniformly(i);
break;
- case 1:
- if (sub_81AA4D8(i, entranceSquareId))
- sub_81AA398(i);
+ case OBJ_POSITIONS_IN_AND_NEAR_ENTRANCE:
+ if (SetPyramidObjectPositionsInAndNearSquare(i, entranceSquareId))
+ SetPyramidObjectPositionsUniformly(i);
break;
- case 2:
- if (sub_81AA4D8(i, exitSquareId))
- sub_81AA398(i);
+ case OBJ_POSITIONS_IN_AND_NEAR_EXIT:
+ if (SetPyramidObjectPositionsInAndNearSquare(i, exitSquareId))
+ SetPyramidObjectPositionsUniformly(i);
break;
- case 3:
- if (sub_81AA648(i, entranceSquareId))
- sub_81AA398(i);
+ case OBJ_POSITIONS_NEAR_NEAR_ENTRANCE:
+ if (SetPyramidObjectPositionsNearSquare(i, entranceSquareId))
+ SetPyramidObjectPositionsUniformly(i);
break;
- case 4:
- if (sub_81AA648(i, exitSquareId))
- sub_81AA398(i);
+ case OBJ_POSITIONS_NEAR_NEAR_EXIT:
+ if (SetPyramidObjectPositionsNearSquare(i, exitSquareId))
+ SetPyramidObjectPositionsUniformly(i);
break;
}
}
}
-void sub_81AA2F8(void)
+void LoadBattlePyramidFloorEventObjectScripts(void)
{
- s32 i;
+ int i;
struct EventObjectTemplate *events = gSaveBlock1Ptr->eventObjectTemplates;
for (i = 0; i < EVENT_OBJECT_TEMPLATES_COUNT; i++)
{
if (events[i].graphicsId != EVENT_OBJ_GFX_ITEM_BALL)
- events[i].script = BattleFrontier_BattlePyramidEmptySquare_EventScript_252C4F;
+ events[i].script = BattlePyramid_TrainerBattle;
else
- events[i].script = BattleFrontier_BattlePyramidEmptySquare_EventScript_252C6A;
+ events[i].script = BattlePyramid_FindItemBall;
}
}
-static void SetPyramidEntranceAndExitSquareIds(u8 *entranceSquareId, u8 *exitSquareId)
+static void GetPyramidEntranceAndExitSquareIds(u8 *entranceSquareId, u8 *exitSquareId)
{
*entranceSquareId = gSaveBlock2Ptr->frontier.pyramidRandoms[3] % 16;
*exitSquareId = gSaveBlock2Ptr->frontier.pyramidRandoms[0] % 16;
@@ -1650,30 +1666,30 @@ static void SetPyramidEntranceAndExitSquareIds(u8 *entranceSquareId, u8 *exitSqu
}
}
-static void sub_81AA398(u8 arg0)
+static void SetPyramidObjectPositionsUniformly(u8 objType)
{
int i;
- int count;
- int var_28;
+ int numObjects;
+ int objectStartIndex;
int squareId;
u32 bits = 0;
u8 id = GetPyramidFloorTemplateId();
u8 *floorLayoutOffsets = AllocZeroed(16);
- SetPyramidFloorLayoutOffsets(floorLayoutOffsets);
+ GetPyramidFloorLayoutOffsets(floorLayoutOffsets);
squareId = gSaveBlock2Ptr->frontier.pyramidRandoms[2] % 16;
- if (arg0 == 0)
+ if (objType == OBJ_TRAINERS)
{
- count = sPyramidFloorTemplates[id].numTrainers;
- var_28 = 0;
+ numObjects = sPyramidFloorTemplates[id].numTrainers;
+ objectStartIndex = 0;
}
- else
+ else // OBJ_ITEMS
{
- count = sPyramidFloorTemplates[id].numItems;
- var_28 = sPyramidFloorTemplates[id].numTrainers;
+ numObjects = sPyramidFloorTemplates[id].numItems;
+ objectStartIndex = sPyramidFloorTemplates[id].numTrainers;
}
- for (i = 0; i < count; i++)
+ for (i = 0; i < numObjects; i++)
{
do
{
@@ -1701,47 +1717,47 @@ static void sub_81AA398(u8 arg0)
}
} while (!(bits & 2));
- } while (!(bits & 4) && sub_81AA760(arg0, floorLayoutOffsets, squareId, var_28 + i));
+ } while (!(bits & 4) && TrySetPyramidEventObjectPositionInSquare(objType, floorLayoutOffsets, squareId, objectStartIndex + i));
bits &= 1;
}
free(floorLayoutOffsets);
}
-static bool8 sub_81AA4D8(u8 arg0, u8 squareId)
+static bool8 SetPyramidObjectPositionsInAndNearSquare(u8 objType, u8 squareId)
{
int i;
- int var_28;
+ int objectStartIndex;
int borderedIndex = 0;
int r7 = 0;
- int var_34 = 0;
- int count;
+ int numPlacedObjects = 0;
+ int numObjects;
u8 id = GetPyramidFloorTemplateId();
u8 *floorLayoutOffsets = AllocZeroed(16);
- SetPyramidFloorLayoutOffsets(floorLayoutOffsets);
- if (arg0 == 0)
+ GetPyramidFloorLayoutOffsets(floorLayoutOffsets);
+ if (objType == OBJ_TRAINERS)
{
- count = sPyramidFloorTemplates[id].numTrainers;
- var_28 = 0;
+ numObjects = sPyramidFloorTemplates[id].numTrainers;
+ objectStartIndex = 0;
}
- else
+ else // OBJ_ITEMS
{
- count = sPyramidFloorTemplates[id].numItems;
- var_28 = sPyramidFloorTemplates[id].numTrainers;
+ numObjects = sPyramidFloorTemplates[id].numItems;
+ objectStartIndex = sPyramidFloorTemplates[id].numTrainers;
}
- for (i = 0; i < count; i++)
+ for (i = 0; i < numObjects; i++)
{
if (r7 == 0)
{
- if (sub_81AA760(arg0, floorLayoutOffsets, squareId, var_28 + i))
+ if (TrySetPyramidEventObjectPositionInSquare(objType, floorLayoutOffsets, squareId, objectStartIndex + i))
r7 = 1;
else
- var_34++;
+ numPlacedObjects++;
}
if (r7 & 1)
{
- if (sub_81AA760(arg0, floorLayoutOffsets, sBorderedSquareIds[squareId][borderedIndex], var_28 + i))
+ if (TrySetPyramidEventObjectPositionInSquare(objType, floorLayoutOffsets, sBorderedSquareIds[squareId][borderedIndex], objectStartIndex + i))
{
do
{
@@ -1749,15 +1765,15 @@ static bool8 sub_81AA4D8(u8 arg0, u8 squareId)
if (sBorderedSquareIds[squareId][borderedIndex] == 0xFF || borderedIndex >= 4)
borderedIndex = 0;
r7 += 2;
- } while (r7 >> 1 != 4 && sub_81AA760(arg0, floorLayoutOffsets, sBorderedSquareIds[squareId][borderedIndex], var_28 + i));
- var_34++;
+ } while (r7 >> 1 != 4 && TrySetPyramidEventObjectPositionInSquare(objType, floorLayoutOffsets, sBorderedSquareIds[squareId][borderedIndex], objectStartIndex + i));
+ numPlacedObjects++;
}
else
{
borderedIndex++;
if (sBorderedSquareIds[squareId][borderedIndex] == 0xFF || borderedIndex >= 4)
borderedIndex = 0;
- var_34++;
+ numPlacedObjects++;
}
}
@@ -1768,51 +1784,51 @@ static bool8 sub_81AA4D8(u8 arg0, u8 squareId)
}
// free(floorLayoutOffsets); BUG: floorLayoutOffsets memory not freed
- return (count / 2 > var_34);
+ return (numObjects / 2) > numPlacedObjects;
}
-static bool8 sub_81AA648(u8 arg0, u8 squareId)
+static bool8 SetPyramidObjectPositionsNearSquare(u8 objType, u8 squareId)
{
int i;
- int var_28;
- int r4 = 0;
- int r7 = 0;
+ int objectStartIndex;
+ int borderOffset = 0;
+ int numPlacedObjects = 0;
int r8 = 0;
- int count;
+ int numObjects;
u8 id = GetPyramidFloorTemplateId();
u8 *floorLayoutOffsets = AllocZeroed(16);
- SetPyramidFloorLayoutOffsets(floorLayoutOffsets);
- if (arg0 == 0)
+ GetPyramidFloorLayoutOffsets(floorLayoutOffsets);
+ if (objType == OBJ_TRAINERS)
{
- count = sPyramidFloorTemplates[id].numTrainers;
- var_28 = 0;
+ numObjects = sPyramidFloorTemplates[id].numTrainers;
+ objectStartIndex = 0;
}
- else
+ else // OBJ_ITEMS
{
- count = sPyramidFloorTemplates[id].numItems;
- var_28 = sPyramidFloorTemplates[id].numTrainers;
+ numObjects = sPyramidFloorTemplates[id].numItems;
+ objectStartIndex = sPyramidFloorTemplates[id].numTrainers;
}
- for (i = 0; i < count; i++)
+ for (i = 0; i < numObjects; i++)
{
- if (sub_81AA760(arg0, floorLayoutOffsets, sBorderedSquareIds[squareId][r4], var_28 + i))
+ if (TrySetPyramidEventObjectPositionInSquare(objType, floorLayoutOffsets, sBorderedSquareIds[squareId][borderOffset], objectStartIndex + i))
{
do
{
- r4++;
- if (sBorderedSquareIds[squareId][r4] == 0xFF || r4 >= 4)
- r4 = 0;
+ borderOffset++;
+ if (sBorderedSquareIds[squareId][borderOffset] == 0xFF || borderOffset >= 4)
+ borderOffset = 0;
r8++;
- } while (r8 != 4 && sub_81AA760(arg0, floorLayoutOffsets, sBorderedSquareIds[squareId][r4], var_28 + i));
- r7++;
+ } while (r8 != 4 && TrySetPyramidEventObjectPositionInSquare(objType, floorLayoutOffsets, sBorderedSquareIds[squareId][borderOffset], objectStartIndex + i));
+ numPlacedObjects++;
}
else
{
- r4++;
- if (sBorderedSquareIds[squareId][r4] == 0xFF || r4 >= 4)
- r4 = 0;
- r7++;
+ borderOffset++;
+ if (sBorderedSquareIds[squareId][borderOffset] == 0xFF || borderOffset >= 4)
+ borderOffset = 0;
+ numPlacedObjects++;
}
if (r8 == 4)
@@ -1820,32 +1836,31 @@ static bool8 sub_81AA648(u8 arg0, u8 squareId)
}
// free(floorLayoutOffsets); BUG: floorLayoutOffsets memory not freed
- return (count / 2 > r7);
+ return (numObjects / 2) > numPlacedObjects;
}
-static bool8 sub_81AA760(u8 arg0, u8 *floorLayoutOffsets, u8 squareId, u8 eventObjectId)
+static bool8 TrySetPyramidEventObjectPositionInSquare(u8 objType, u8 *floorLayoutOffsets, u8 squareId, u8 eventObjectId)
{
- int i, j;
+ int x, y;
if (gSaveBlock2Ptr->frontier.pyramidRandoms[0] & 1)
{
- int minus1 = -1;
- for (i = 7; i > minus1; i--)
+ for (y = 7; y > -1; y--)
{
- for (j = 7; j >= 0; j--)
+ for (x = 7; x > -1; x--)
{
- if (!sub_81AA810(arg0, j, i, floorLayoutOffsets, squareId, eventObjectId))
+ if (!TrySetPyramidEventObjectPositionAtCoords(objType, x, y, floorLayoutOffsets, squareId, eventObjectId))
return FALSE;
}
}
}
else
{
- for (i = 0; i < 8; i++)
+ for (y = 0; y < 8; y++)
{
- for (j = 0; j < 8; j++)
+ for (x = 0; x < 8; x++)
{
- if (!sub_81AA810(arg0, j, i, floorLayoutOffsets, squareId, eventObjectId))
+ if (!TrySetPyramidEventObjectPositionAtCoords(objType, x, y, floorLayoutOffsets, squareId, eventObjectId))
return FALSE;
}
}
@@ -1854,11 +1869,11 @@ static bool8 sub_81AA760(u8 arg0, u8 *floorLayoutOffsets, u8 squareId, u8 eventO
return TRUE;
}
-static bool8 sub_81AA810(u8 arg0, u8 x, u8 y, u8 *floorLayoutOffsets, u8 squareId, u8 eventObjectId)
+static bool8 TrySetPyramidEventObjectPositionAtCoords(u8 objType, u8 x, u8 y, u8 *floorLayoutOffsets, u8 squareId, u8 eventObjectId)
{
int i, j;
const struct MapHeader *mapHeader;
- struct EventObjectTemplate *events = gSaveBlock1Ptr->eventObjectTemplates;
+ struct EventObjectTemplate *floorEvents = gSaveBlock1Ptr->eventObjectTemplates;
mapHeader = Overworld_GetMapHeaderByGroupAndId(MAP_GROUP(BATTLE_PYRAMID_SQUARE01), floorLayoutOffsets[squareId] + MAP_NUM(BATTLE_PYRAMID_SQUARE01));
for (i = 0; i < mapHeader->events->eventObjectCount; i++)
@@ -1866,37 +1881,39 @@ static bool8 sub_81AA810(u8 arg0, u8 x, u8 y, u8 *floorLayoutOffsets, u8 squareI
if (mapHeader->events->eventObjects[i].x != x || mapHeader->events->eventObjects[i].y != y)
continue;
- if (arg0 != 0 || mapHeader->events->eventObjects[i].graphicsId == EVENT_OBJ_GFX_ITEM_BALL)
+ if (objType != OBJ_TRAINERS || mapHeader->events->eventObjects[i].graphicsId == EVENT_OBJ_GFX_ITEM_BALL)
{
- if (arg0 != 1 || mapHeader->events->eventObjects[i].graphicsId != EVENT_OBJ_GFX_ITEM_BALL)
+ if (objType != OBJ_ITEMS || mapHeader->events->eventObjects[i].graphicsId != EVENT_OBJ_GFX_ITEM_BALL)
continue;
}
+ // Ensure an object wasn't previously placed in the exact same position.
for (j = 0; j < eventObjectId; j++)
{
- if (events[j].x == x + ((squareId % 4) * 8) && events[j].y == y + ((squareId / 4) * 8))
+ if (floorEvents[j].x == x + ((squareId % 4) * 8) && floorEvents[j].y == y + ((squareId / 4) * 8))
break;
}
- if (j != eventObjectId)
- continue;
- events[eventObjectId] = mapHeader->events->eventObjects[i];
- events[eventObjectId].x += ((squareId % 4) * 8);
- events[eventObjectId].y += ((squareId / 4) * 8);
- events[eventObjectId].localId = eventObjectId + 1;
- if (events[eventObjectId].graphicsId != EVENT_OBJ_GFX_ITEM_BALL)
+ if (j == eventObjectId)
{
- i = sub_81A9F90(eventObjectId);
- events[eventObjectId].graphicsId = GetBattleFacilityTrainerGfxId(i);
- gSaveBlock2Ptr->frontier.field_CB4[eventObjectId] = i;
+ floorEvents[eventObjectId] = mapHeader->events->eventObjects[i];
+ floorEvents[eventObjectId].x += (squareId % 4) * 8;
+ floorEvents[eventObjectId].y += (squareId / 4) * 8;
+ floorEvents[eventObjectId].localId = eventObjectId + 1;
+ if (floorEvents[eventObjectId].graphicsId != EVENT_OBJ_GFX_ITEM_BALL)
+ {
+ i = GetUniqueTrainerId(eventObjectId);
+ floorEvents[eventObjectId].graphicsId = GetBattleFacilityTrainerGfxId(i);
+ gSaveBlock2Ptr->frontier.trainerIds[eventObjectId] = i;
+ }
+ return FALSE;
}
- return FALSE;
}
return TRUE;
}
-static void SetPyramidFloorLayoutOffsets(u8 *layoutOffsets)
+static void GetPyramidFloorLayoutOffsets(u8 *layoutOffsets)
{
int i;
int rand = (gSaveBlock2Ptr->frontier.pyramidRandoms[0]) | (gSaveBlock2Ptr->frontier.pyramidRandoms[1] << 16);
@@ -1944,7 +1961,7 @@ u8 GetNumBattlePyramidEventObjects(void)
static void InitPyramidBagItems(u8 lvlMode)
{
- s32 i;
+ int i;
for (i = 0; i < PYRAMID_BAG_ITEMS_COUNT; i++)
{
diff --git a/src/battle_setup.c b/src/battle_setup.c
index f5e9e3e9e..7626420e9 100644
--- a/src/battle_setup.c
+++ b/src/battle_setup.c
@@ -874,8 +874,8 @@ u8 sub_80B100C(s32 arg0)
return sUnknown_0854FE98[Random() % ARRAY_COUNT(sUnknown_0854FE98)];
}
- var = gSaveBlock2Ptr->frontier.field_CB4[gSaveBlock2Ptr->frontier.curChallengeBattleNum * 2 + 0]
- + gSaveBlock2Ptr->frontier.field_CB4[gSaveBlock2Ptr->frontier.curChallengeBattleNum * 2 + 1];
+ var = gSaveBlock2Ptr->frontier.trainerIds[gSaveBlock2Ptr->frontier.curChallengeBattleNum * 2 + 0]
+ + gSaveBlock2Ptr->frontier.trainerIds[gSaveBlock2Ptr->frontier.curChallengeBattleNum * 2 + 1];
return sUnknown_0854FE98[var % ARRAY_COUNT(sUnknown_0854FE98)];
}
@@ -1266,7 +1266,7 @@ void BattleSetup_StartTrainerBattle(void)
ZeroMonData(&gEnemyParty[2]);
}
- sub_81A9B04();
+ MarkApproachingPyramidTrainersAsBattled();
}
else if (sub_81D5C18())
{
diff --git a/src/battle_tent.c b/src/battle_tent.c
index cb8149253..d85883cd5 100644
--- a/src/battle_tent.c
+++ b/src/battle_tent.c
@@ -356,7 +356,7 @@ static void sub_81BA040(void)
trainerId = Random() % 30;
for (i = 0; i < gSaveBlock2Ptr->frontier.curChallengeBattleNum; i++)
{
- if (gSaveBlock2Ptr->frontier.field_CB4[i] == trainerId)
+ if (gSaveBlock2Ptr->frontier.trainerIds[i] == trainerId)
break;
}
} while (i != gSaveBlock2Ptr->frontier.curChallengeBattleNum);
@@ -370,7 +370,7 @@ static void sub_81BA040(void)
}
if (gSaveBlock2Ptr->frontier.curChallengeBattleNum < 2)
- gSaveBlock2Ptr->frontier.field_CB4[gSaveBlock2Ptr->frontier.curChallengeBattleNum] = gTrainerBattleOpponent_A;
+ gSaveBlock2Ptr->frontier.trainerIds[gSaveBlock2Ptr->frontier.curChallengeBattleNum] = gTrainerBattleOpponent_A;
monSets = gFacilityTrainers[gTrainerBattleOpponent_A].monSets;
i = 0;
diff --git a/src/battle_tower.c b/src/battle_tower.c
index 088ef7972..fbb77789e 100644
--- a/src/battle_tower.c
+++ b/src/battle_tower.c
@@ -1311,15 +1311,15 @@ static void ChooseNextBattleTowerTrainer(void)
if (battleMode == FRONTIER_MODE_MULTIS || battleMode == FRONTIER_MODE_LINK_MULTIS)
{
id = gSaveBlock2Ptr->frontier.curChallengeBattleNum;
- gTrainerBattleOpponent_A = gSaveBlock2Ptr->frontier.field_CB4[id * 2];
- gTrainerBattleOpponent_B = gSaveBlock2Ptr->frontier.field_CB4[id * 2 + 1];
+ gTrainerBattleOpponent_A = gSaveBlock2Ptr->frontier.trainerIds[id * 2];
+ gTrainerBattleOpponent_B = gSaveBlock2Ptr->frontier.trainerIds[id * 2 + 1];
SetBattleFacilityTrainerGfxId(gTrainerBattleOpponent_A, 0);
SetBattleFacilityTrainerGfxId(gTrainerBattleOpponent_B, 1);
}
else if (ChooseSpecialBattleTowerTrainer())
{
SetBattleFacilityTrainerGfxId(gTrainerBattleOpponent_A, 0);
- gSaveBlock2Ptr->frontier.field_CB4[gSaveBlock2Ptr->frontier.curChallengeBattleNum] = gTrainerBattleOpponent_A;
+ gSaveBlock2Ptr->frontier.trainerIds[gSaveBlock2Ptr->frontier.curChallengeBattleNum] = gTrainerBattleOpponent_A;
}
else
{
@@ -1331,7 +1331,7 @@ static void ChooseNextBattleTowerTrainer(void)
// Ensure trainer wasn't previously fought in this challenge.
for (i = 0; i < gSaveBlock2Ptr->frontier.curChallengeBattleNum; i++)
{
- if (gSaveBlock2Ptr->frontier.field_CB4[i] == id)
+ if (gSaveBlock2Ptr->frontier.trainerIds[i] == id)
break;
}
if (i == gSaveBlock2Ptr->frontier.curChallengeBattleNum)
@@ -1341,7 +1341,7 @@ static void ChooseNextBattleTowerTrainer(void)
gTrainerBattleOpponent_A = id;
SetBattleFacilityTrainerGfxId(gTrainerBattleOpponent_A, 0);
if (gSaveBlock2Ptr->frontier.curChallengeBattleNum + 1 < 7)
- gSaveBlock2Ptr->frontier.field_CB4[gSaveBlock2Ptr->frontier.curChallengeBattleNum] = gTrainerBattleOpponent_A;
+ gSaveBlock2Ptr->frontier.trainerIds[gSaveBlock2Ptr->frontier.curChallengeBattleNum] = gTrainerBattleOpponent_A;
}
}
}
@@ -2250,7 +2250,7 @@ void DoSpecialTrainerBattle(void)
break;
case FRONTIER_MODE_MULTIS:
FillFrontierTrainersParties(2);
- gPartnerTrainerId = gSaveBlock2Ptr->frontier.field_CB4[17];
+ gPartnerTrainerId = gSaveBlock2Ptr->frontier.trainerIds[17];
FillPartnerParty(gPartnerTrainerId);
gBattleTypeFlags |= BATTLE_TYPE_DOUBLE | BATTLE_TYPE_INGAME_PARTNER | BATTLE_TYPE_MULTI | BATTLE_TYPE_TWO_OPPONENTS;
break;
@@ -2524,32 +2524,32 @@ static void sub_81642A0(void)
trainerId = sub_8162548(challengeNum, 0);
for (i = 0; i < j; i++)
{
- if (gSaveBlock2Ptr->frontier.field_CB4[i] == trainerId)
+ if (gSaveBlock2Ptr->frontier.trainerIds[i] == trainerId)
break;
- if (gFacilityTrainers[gSaveBlock2Ptr->frontier.field_CB4[i]].facilityClass == gFacilityTrainers[trainerId].facilityClass)
+ if (gFacilityTrainers[gSaveBlock2Ptr->frontier.trainerIds[i]].facilityClass == gFacilityTrainers[trainerId].facilityClass)
break;
}
} while (i != j);
- gSaveBlock2Ptr->frontier.field_CB4[j] = trainerId;
+ gSaveBlock2Ptr->frontier.trainerIds[j] = trainerId;
j++;
} while (j < 6);
r10 = 8;
for (i = 0; i < 6; i++)
{
- trainerId = gSaveBlock2Ptr->frontier.field_CB4[i];
+ trainerId = gSaveBlock2Ptr->frontier.trainerIds[i];
eventObjTemplates[i + 1].graphicsId = GetBattleFacilityTrainerGfxId(trainerId);
for (j = 0; j < 2; j++)
{
while (1)
{
monSetId = RandomizeFacilityTrainerMonSet(trainerId);
- if (j % 2 != 0 && gFacilityTrainerMons[gSaveBlock2Ptr->frontier.field_CB4[r10 - 1]].itemTableId == gFacilityTrainerMons[monSetId].itemTableId)
+ if (j % 2 != 0 && gFacilityTrainerMons[gSaveBlock2Ptr->frontier.trainerIds[r10 - 1]].itemTableId == gFacilityTrainerMons[monSetId].itemTableId)
continue;
for (k = 8; k < r10; k++)
{
- if (gFacilityTrainerMons[gSaveBlock2Ptr->frontier.field_CB4[k]].species == gFacilityTrainerMons[monSetId].species)
+ if (gFacilityTrainerMons[gSaveBlock2Ptr->frontier.trainerIds[k]].species == gFacilityTrainerMons[monSetId].species)
break;
if (species1 == gFacilityTrainerMons[monSetId].species)
break;
@@ -2560,7 +2560,7 @@ static void sub_81642A0(void)
break;
}
- gSaveBlock2Ptr->frontier.field_CB4[r10] = monSetId;
+ gSaveBlock2Ptr->frontier.trainerIds[r10] = monSetId;
r10++;
}
}
@@ -2591,10 +2591,10 @@ static void sub_81642A0(void)
}
if (r10 != 0)
{
- gSaveBlock2Ptr->frontier.field_CB4[6] = spArray[Random() % r10];
- eventObjTemplates[7].graphicsId = GetBattleFacilityTrainerGfxId(gSaveBlock2Ptr->frontier.field_CB4[6]);
+ gSaveBlock2Ptr->frontier.trainerIds[6] = spArray[Random() % r10];
+ eventObjTemplates[7].graphicsId = GetBattleFacilityTrainerGfxId(gSaveBlock2Ptr->frontier.trainerIds[6]);
FlagClear(FLAG_HIDE_BATTLE_TOWER_MULTI_BATTLE_PARTNER_ALT_1);
- sub_81640E0(gSaveBlock2Ptr->frontier.field_CB4[6]);
+ sub_81640E0(gSaveBlock2Ptr->frontier.trainerIds[6]);
}
r10 = 0;
@@ -2634,10 +2634,10 @@ static void sub_81642A0(void)
}
if (r10 != 0)
{
- gSaveBlock2Ptr->frontier.field_CB4[7] = spArray[Random() % r10];
- eventObjTemplates[8].graphicsId = GetBattleFacilityTrainerGfxId(gSaveBlock2Ptr->frontier.field_CB4[7]);
+ gSaveBlock2Ptr->frontier.trainerIds[7] = spArray[Random() % r10];
+ eventObjTemplates[8].graphicsId = GetBattleFacilityTrainerGfxId(gSaveBlock2Ptr->frontier.trainerIds[7]);
FlagClear(FLAG_HIDE_BATTLE_TOWER_MULTI_BATTLE_PARTNER_ALT_2);
- sub_8164188(gSaveBlock2Ptr->frontier.field_CB4[7]);
+ sub_8164188(gSaveBlock2Ptr->frontier.trainerIds[7]);
}
}
@@ -2684,7 +2684,7 @@ static void sub_8164828(void)
u16 winStreak = GetCurrentFacilityWinStreak();
s32 challengeNum = winStreak / 7;
s32 k = gSpecialVar_LastTalked - 2;
- s32 trainerId = gSaveBlock2Ptr->frontier.field_CB4[k];
+ s32 trainerId = gSaveBlock2Ptr->frontier.trainerIds[k];
for (arrId = 0; arrId < ARRAY_COUNT(gUnknown_085DD500); arrId++)
{
@@ -2717,29 +2717,29 @@ static void sub_8164828(void)
}
break;
case 1:
- monSetId = gSaveBlock2Ptr->frontier.field_CB4[8 + k * 2];
+ monSetId = gSaveBlock2Ptr->frontier.trainerIds[8 + k * 2];
sub_81646BC(trainerId, monSetId);
break;
case 2:
- monSetId = gSaveBlock2Ptr->frontier.field_CB4[9 + k * 2];
+ monSetId = gSaveBlock2Ptr->frontier.trainerIds[9 + k * 2];
sub_81646BC(trainerId, monSetId);
break;
case 3:
gPartnerTrainerId = trainerId;
if (trainerId < TRAINER_RECORD_MIXING_FRIEND)
{
- gSaveBlock2Ptr->frontier.field_CB4[18] = gSaveBlock2Ptr->frontier.field_CB4[8 + k * 2];
- gSaveBlock2Ptr->frontier.field_CB4[19] = gSaveBlock2Ptr->frontier.field_CB4[9 + k * 2];
+ gSaveBlock2Ptr->frontier.trainerIds[18] = gSaveBlock2Ptr->frontier.trainerIds[8 + k * 2];
+ gSaveBlock2Ptr->frontier.trainerIds[19] = gSaveBlock2Ptr->frontier.trainerIds[9 + k * 2];
}
else if (trainerId < TRAINER_RECORD_MIXING_APPRENTICE)
{
- gSaveBlock2Ptr->frontier.field_CB4[18] = gUnknown_03006298[2];
- gSaveBlock2Ptr->frontier.field_CB4[19] = gUnknown_03006298[3];
+ gSaveBlock2Ptr->frontier.trainerIds[18] = gUnknown_03006298[2];
+ gSaveBlock2Ptr->frontier.trainerIds[19] = gUnknown_03006298[3];
}
else
{
- gSaveBlock2Ptr->frontier.field_CB4[18] = gUnknown_03006298[0];
- gSaveBlock2Ptr->frontier.field_CB4[19] = gUnknown_03006298[1];
+ gSaveBlock2Ptr->frontier.trainerIds[18] = gUnknown_03006298[0];
+ gSaveBlock2Ptr->frontier.trainerIds[19] = gUnknown_03006298[1];
}
for (k = 0; k < 14; k++)
{
@@ -2751,15 +2751,15 @@ static void sub_8164828(void)
for (j = 0; j < k; j++)
{
- if (gSaveBlock2Ptr->frontier.field_CB4[j] == i)
+ if (gSaveBlock2Ptr->frontier.trainerIds[j] == i)
break;
}
if (j == k)
break;
}
- gSaveBlock2Ptr->frontier.field_CB4[k] = i;
+ gSaveBlock2Ptr->frontier.trainerIds[k] = i;
}
- gSaveBlock2Ptr->frontier.field_CB4[17] = trainerId;
+ gSaveBlock2Ptr->frontier.trainerIds[17] = trainerId;
break;
case 4:
break;
@@ -2825,12 +2825,12 @@ static void sub_8164B74(void)
trainerId = sub_8162548(challengeNum, i / 2);
for (j = 0; j < i; j++)
{
- if (gSaveBlock2Ptr->frontier.field_CB4[j] == trainerId)
+ if (gSaveBlock2Ptr->frontier.trainerIds[j] == trainerId)
break;
}
} while (i != j);
if (i == j) // This condition is always true, because of the loop above.
- gSaveBlock2Ptr->frontier.field_CB4[i] = trainerId;
+ gSaveBlock2Ptr->frontier.trainerIds[i] = trainerId;
}
gSpecialVar_Result = 2;
}
@@ -2838,7 +2838,7 @@ static void sub_8164B74(void)
case 2:
if (IsLinkTaskFinished())
{
- SendBlock(bitmask_all_link_players_but_self(), &gSaveBlock2Ptr->frontier.field_CB4, sizeof(gSaveBlock2Ptr->frontier.field_CB4));
+ SendBlock(bitmask_all_link_players_but_self(), &gSaveBlock2Ptr->frontier.trainerIds, sizeof(gSaveBlock2Ptr->frontier.trainerIds));
gSpecialVar_Result = 3;
}
break;
@@ -2846,9 +2846,9 @@ static void sub_8164B74(void)
if ((GetBlockReceivedStatus() & 3) == 3)
{
ResetBlockReceivedFlags();
- memcpy(&gSaveBlock2Ptr->frontier.field_CB4, gBlockRecvBuffer, sizeof(gSaveBlock2Ptr->frontier.field_CB4));
- gTrainerBattleOpponent_A = gSaveBlock2Ptr->frontier.field_CB4[battleNum * 2];
- gTrainerBattleOpponent_B = gSaveBlock2Ptr->frontier.field_CB4[battleNum * 2 + 1];
+ memcpy(&gSaveBlock2Ptr->frontier.trainerIds, gBlockRecvBuffer, sizeof(gSaveBlock2Ptr->frontier.trainerIds));
+ gTrainerBattleOpponent_A = gSaveBlock2Ptr->frontier.trainerIds[battleNum * 2];
+ gTrainerBattleOpponent_B = gSaveBlock2Ptr->frontier.trainerIds[battleNum * 2 + 1];
SetBattleFacilityTrainerGfxId(gTrainerBattleOpponent_A, 0);
SetBattleFacilityTrainerGfxId(gTrainerBattleOpponent_B, 1);
if (gReceivedRemoteLinkPlayers != 0 && gWirelessCommType == 0)
@@ -2880,7 +2880,7 @@ static void sub_8164DCC(void)
static void sub_8164DE4(void)
{
- SetBattleFacilityTrainerGfxId(gSaveBlock2Ptr->frontier.field_CB4[17], 0xF);
+ SetBattleFacilityTrainerGfxId(gSaveBlock2Ptr->frontier.trainerIds[17], 0xF);
}
static void sub_8164E04(void)
@@ -3213,7 +3213,7 @@ static void FillPartnerParty(u16 trainerId)
otID = Random32();
for (i = 0; i < 2; i++)
{
- monSetId = gSaveBlock2Ptr->frontier.field_CB4[i + 18];
+ monSetId = gSaveBlock2Ptr->frontier.trainerIds[i + 18];
CreateMonWithEVSpreadNatureOTID(&gPlayerParty[3 + i],
gFacilityTrainerMons[monSetId].species,
level,
@@ -3243,7 +3243,7 @@ static void FillPartnerParty(u16 trainerId)
for (i = 0; i < 2; i++)
{
struct EmeraldBattleTowerRecord *record = &gSaveBlock2Ptr->frontier.towerRecords[trainerId];
- struct BattleTowerPokemon monData = record->party[gSaveBlock2Ptr->frontier.field_CB4[18 + i]];
+ struct BattleTowerPokemon monData = record->party[gSaveBlock2Ptr->frontier.trainerIds[18 + i]];
StringCopy(trainerName, record->name);
if (record->language == LANGUAGE_JAPANESE)
{
@@ -3269,7 +3269,7 @@ static void FillPartnerParty(u16 trainerId)
trainerId -= TRAINER_RECORD_MIXING_APPRENTICE;
for (i = 0; i < 2; i++)
{
- CreateApprenticeMon(&gPlayerParty[3 + i], &gSaveBlock2Ptr->apprentices[trainerId], gSaveBlock2Ptr->frontier.field_CB4[18 + i]);
+ CreateApprenticeMon(&gPlayerParty[3 + i], &gSaveBlock2Ptr->apprentices[trainerId], gSaveBlock2Ptr->frontier.trainerIds[18 + i]);
j = IsFrontierTrainerFemale(trainerId + TRAINER_RECORD_MIXING_APPRENTICE);
SetMonData(&gPlayerParty[3 + i], MON_DATA_OT_GENDER, &j);
}
@@ -3564,7 +3564,7 @@ static void sub_8165E18(void)
trainerId = sub_8165D40();
for (i = 0; i < gSaveBlock2Ptr->frontier.curChallengeBattleNum; i++)
{
- if (gSaveBlock2Ptr->frontier.field_CB4[i] == trainerId)
+ if (gSaveBlock2Ptr->frontier.trainerIds[i] == trainerId)
break;
}
} while (i != gSaveBlock2Ptr->frontier.curChallengeBattleNum);
@@ -3572,7 +3572,7 @@ static void sub_8165E18(void)
gTrainerBattleOpponent_A = trainerId;
SetBattleFacilityTrainerGfxId(gTrainerBattleOpponent_A, 0);
if (gSaveBlock2Ptr->frontier.curChallengeBattleNum + 1 < 3)
- gSaveBlock2Ptr->frontier.field_CB4[gSaveBlock2Ptr->frontier.curChallengeBattleNum] = gTrainerBattleOpponent_A;
+ gSaveBlock2Ptr->frontier.trainerIds[gSaveBlock2Ptr->frontier.curChallengeBattleNum] = gTrainerBattleOpponent_A;
}
static void FillTentTrainerParty_(u16 trainerId, u8 firstMonId, u8 monCount)
diff --git a/src/frontier_util.c b/src/frontier_util.c
index 742b73858..e6954c356 100644
--- a/src/frontier_util.c
+++ b/src/frontier_util.c
@@ -1827,7 +1827,7 @@ void sub_81A3ACC(void)
s32 i;
for (i = 0; i < 20; i++)
- gSaveBlock2Ptr->frontier.field_CB4[i] = 0xFFFF;
+ gSaveBlock2Ptr->frontier.trainerIds[i] = 0xFFFF;
}
static void sub_81A3B00(void)
diff --git a/src/overworld.c b/src/overworld.c
index 8119204f2..2bc4f96d5 100644
--- a/src/overworld.c
+++ b/src/overworld.c
@@ -124,7 +124,6 @@ extern void sub_80AF3C8(void);
extern void ExecuteTruckSequence(void);
extern void sub_80A0A38(void);
extern void WriteFlashScanlineEffectBuffer(u8);
-extern void sub_81AA2F8(void);
extern void InitMatchCallCounters(void);
extern void sub_80EDB44(void);
extern void InitFieldMessageBox(void);
@@ -886,7 +885,7 @@ static void mli0_load_map(u32 a1)
if (!(sUnknown_020322D8 & 1))
{
if (gMapHeader.mapLayoutId == LAYOUT_BATTLE_FRONTIER_BATTLE_PYRAMID_EMPTY_SQUARE)
- sub_81AA1D8();
+ LoadBattlePyramidEventObjectTemplates();
else if (InTrainerHill())
sub_81D5DF8();
else
@@ -1753,7 +1752,7 @@ void CB2_ContinueSavedGame(void)
ClearDiveAndHoleWarps();
trainerHillMapId = GetCurrentTrainerHillMapId();
if (gMapHeader.mapLayoutId == LAYOUT_BATTLE_FRONTIER_BATTLE_PYRAMID_EMPTY_SQUARE)
- sub_81AA2F8();
+ LoadBattlePyramidFloorEventObjectScripts();
else if (trainerHillMapId != 0 && trainerHillMapId != 6)
sub_81D5F48();
else
diff --git a/src/pokemon.c b/src/pokemon.c
index 5f1664450..9553fdf17 100644
--- a/src/pokemon.c
+++ b/src/pokemon.c
@@ -6081,7 +6081,7 @@ s32 GetBattlerMultiplayerId(u16 a1)
u8 GetTrainerEncounterMusicId(u16 trainerOpponentId)
{
if (InBattlePyramid())
- return GetTrainerEncounterMusicIdInBattlePyramind(trainerOpponentId);
+ return GetBattlePyramindTrainerEncounterMusicId(trainerOpponentId);
else if (sub_81D5C18())
return GetTrainerEncounterMusicIdInTrainerHill(trainerOpponentId);
else
diff --git a/src/start_menu.c b/src/start_menu.c
index d932e1d6b..334330b67 100644
--- a/src/start_menu.c
+++ b/src/start_menu.c
@@ -36,6 +36,7 @@
#include "international_string_util.h"
#include "constants/songs.h"
#include "field_player_avatar.h"
+#include "battle_pyramid.h"
#include "battle_pyramid_bag.h"
#include "battle_pike.h"
#include "new_game.h"
@@ -94,9 +95,7 @@ extern void CB2_Pokedex(void);
extern void PlayRainSoundEffect(void);
extern void CB2_PokeNav(void);
extern void ScriptUnfreezeEventObjects(void);
-extern void sub_81A9EC8(void);
extern void save_serialize_map(void);
-extern void sub_81A9E90(void);
// Menu action callbacks
static bool8 StartMenuPokedexCallback(void);
@@ -798,7 +797,7 @@ static bool8 SaveCallback(void)
sub_8197DF8(0, TRUE);
ScriptUnfreezeEventObjects();
ScriptContext2_Disable();
- sub_81A9EC8();
+ SoftResetInBattlePyramid();
return TRUE;
}
diff --git a/src/trainer_hill.c b/src/trainer_hill.c
index 309ffdb1d..efe11b0c7 100644
--- a/src/trainer_hill.c
+++ b/src/trainer_hill.c
@@ -660,7 +660,7 @@ void sub_81D5DF8(void)
SetUpDataStruct();
for (i = 0; i < 2; i++)
- gSaveBlock2Ptr->frontier.field_CB4[i] = 0xFFFF;
+ gSaveBlock2Ptr->frontier.trainerIds[i] = 0xFFFF;
CpuFill32(0, gSaveBlock1Ptr->eventObjectTemplates, sizeof(gSaveBlock1Ptr->eventObjectTemplates));
floorId = GetFloorId();
@@ -677,7 +677,7 @@ void sub_81D5DF8(void)
eventTemplates[i].movementType = ((sHillData->tag.floors[floorId].direction >> bits) & 0xF) + MOVEMENT_TYPE_FACE_UP;
eventTemplates[i].trainerRange_berryTreeId = (sHillData->tag.floors[floorId].range >> bits) & 0xF;
eventTemplates[i].script = EventScript_2C83F0;
- gSaveBlock2Ptr->frontier.field_CB4[i] = i + 1;
+ gSaveBlock2Ptr->frontier.trainerIds[i] = i + 1;
}
FreeDataStruct();
@@ -874,7 +874,7 @@ const struct WarpEvent* sub_81D6134(u8 warpEventId)
u16 LocalIdToHillTrainerId(u8 localId)
{
- return gSaveBlock2Ptr->frontier.field_CB4[localId - 1];
+ return gSaveBlock2Ptr->frontier.trainerIds[localId - 1];
}
bool8 GetHillTrainerFlag(u8 eventObjectId)
@@ -892,7 +892,7 @@ void SetHillTrainerFlag(void)
for (i = 0; i < 2; i++)
{
- if (gSaveBlock2Ptr->frontier.field_CB4[i] == gTrainerBattleOpponent_A)
+ if (gSaveBlock2Ptr->frontier.trainerIds[i] == gTrainerBattleOpponent_A)
{
gSaveBlock2Ptr->frontier.field_EE0 |= gBitTable[floorId + i];
break;
@@ -903,7 +903,7 @@ void SetHillTrainerFlag(void)
{
for (i = 0; i < 2; i++)
{
- if (gSaveBlock2Ptr->frontier.field_CB4[i] == gTrainerBattleOpponent_B)
+ if (gSaveBlock2Ptr->frontier.trainerIds[i] == gTrainerBattleOpponent_B)
{
gSaveBlock2Ptr->frontier.field_EE0 |= gBitTable[floorId + i];
break;