Document Battle Hall script (#957)

This commit is contained in:
VicSevenT 2026-02-21 14:44:45 -06:00 committed by GitHub
parent e5fb75a339
commit bb8f64b627
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
24 changed files with 1286 additions and 1380 deletions

View File

@ -4271,16 +4271,16 @@
.short 718
.endm
.macro ScrCmd_2CF arg0, arg1
.macro BattleHallCheckUsingSameSpeciesAsPartner species, result
.short 719
.short \arg0
.short \arg1
.short \species
.short \result
.endm
.macro ScrCmd_2D0 arg0, arg1
.macro GetBattleHallSelectedSlots slot1, slot2
.short 720
.short \arg0
.short \arg1
.short \slot1
.short \slot2
.endm
.macro ScrCmd_2D1 arg0
@ -4765,24 +4765,24 @@
.short \arg0
.endm
.macro ScrCmd_324 arg0, arg1, arg2, arg3, arg4, arg5
.macro GetBattleHallRecordKeeperStats curStreakIdx, passedMilestoneIdx, nextMilestoneIdx, earnedBPIdx, nextMilestone, response
.short 804
.byte \arg0
.byte \arg1
.byte \arg2
.byte \arg3
.short \arg4
.short \arg5
.byte \curStreakIdx
.byte \passedMilestoneIdx
.byte \nextMilestoneIdx
.byte \earnedBPIdx
.short \nextMilestone
.short \response
.endm
.macro ScrCmd_325 arg0
.macro GetNumSpeciesWithBattleHallRecords result
.short 805
.short \arg0
.short \result
.endm
.macro ScrCmd_326 arg0
.macro GetBattleHallTotalSinglesRecord result
.short 806
.short \arg0
.short \result
.endm
.macro ShowListMenuSetWidth width

View File

@ -38,7 +38,7 @@ TRAINER_SCORE_EVENT_UNDERGROUND_ENTERED
TRAINER_SCORE_EVENT_UNDERGROUND_100_STEPS
TRAINER_SCORE_EVENT_UNK_38
TRAINER_SCORE_EVENT_UNK_39
TRAINER_SCORE_EVENT_UNK_40
TRAINER_SCORE_EVENT_BATTLE_HALL_ROUND_COMPLETED
TRAINER_SCORE_EVENT_UNK_41
TRAINER_SCORE_EVENT_ALL_BATTLE_FRONTIER_GOLD_PRINTS
TRAINER_SCORE_EVENT_UNK_43

View File

@ -188,7 +188,7 @@ FLAG_TEAM_GALACTIC_LEFT_LAKE_VERITY
FLAG_UNK_0x00BB
FLAG_UNK_0x00BC
FLAG_UNK_0x00BD
FLAG_UNK_0x00BE
FLAG_SPOKEN_TO_BATTLE_HALL_RECORD_KEEPER
FLAG_OBTAINED_QUICK_CLAW
FLAG_UNK_0x00C0
FLAG_UNK_0x00C1
@ -703,7 +703,7 @@ FLAG_ROTOM_ROOM_HIDE_REFRIGERATOR
FLAG_ROTOM_ROOM_HIDE_ROTARY_FAN
FLAG_ROTOM_ROOM_HIDE_LAWN_MOWER
FLAG_UNK_0x02C0
FLAG_UNK_0x02C1
FLAG_BATTLE_HALL_HIDE_REPORTER
FLAG_UNK_0x02C2
FLAG_UNK_0x02C3
FLAG_HIDE_SANDGEM_TOWN_PROF_ROWAN
@ -713,7 +713,7 @@ FLAG_UNK_0x02C7
FLAG_UNK_0x02C8
FLAG_UNK_0x02C9
FLAG_UNK_0x02CA
FLAG_UNK_0x02CB
FLAG_HIDE_BATTLE_HALL_MAJOR_NPC
FLAG_HIDE_CANALAVE_CITY_RIVAL
FLAG_UNK_0x02CD
FLAG_UNK_0x02CE
@ -4197,8 +4197,8 @@ VAR_ROAMING_MOLTRES_STATE
VAR_ROAMING_ZAPDOS_STATE
VAR_ROAMING_ARTICUNO_STATE
VAR_UNK_0x4061
VAR_UNK_0x4062
VAR_UNK_0x4063
VAR_BATTLE_HALL_NEXT_TOTAL_RECORD_MILESTONE
VAR_BATTLE_HALL_MAJOR_NPC
VAR_WIFI_FRONTIER_CLEARED
VAR_UNK_0x4065
VAR_UNK_0x4066
@ -4285,8 +4285,8 @@ VAR_UNK_0x40B6
VAR_UNK_0x40B7
VAR_UNK_0x40B8
VAR_UNK_0x40B9
VAR_UNK_0x40BA
VAR_UNK_0x40BB
VAR_BATTLE_HALL_LOBBY_LOAD_ACTION
VAR_BATTLE_HALL_CHALLENGE_TYPE
VAR_UNK_0x40BC
VAR_UNK_0x40BD
VAR_UNK_0x40BE

View File

@ -0,0 +1,14 @@
#ifndef POKEPLATINUM_SCRCMD_BATTLE_HALL_H
#define POKEPLATINUM_SCRCMD_BATTLE_HALL_H
#include "field_script_context.h"
BOOL ScrCmd_2CC(ScriptContext *param0);
BOOL ScrCmd_2D1(ScriptContext *param0);
BOOL ScrCmd_BattleHallCheckUsingSameSpeciesAsPartner(ScriptContext *param0);
BOOL ScrCmd_GetBattleHallRecordKeeperStats(ScriptContext *param0);
BOOL ScrCmd_GetNumSpeciesWithBattleHallRecords(ScriptContext *param0);
BOOL ScrCmd_GetBattleHallTotalSinglesRecord(ScriptContext *param0);
BOOL ScrCmd_32A(ScriptContext *param0);
#endif // POKEPLATINUM_SCRCMD_BATTLE_HALL_H

View File

@ -1,13 +0,0 @@
#ifndef POKEPLATINUM_STRUCT_0204F3D0_H
#define POKEPLATINUM_STRUCT_0204F3D0_H
typedef struct {
u8 unk_00;
u8 unk_01;
u8 padding_02[2];
u16 unk_04;
u16 unk_06;
u16 *unk_08;
} UnkStruct_0204F3D0;
#endif // POKEPLATINUM_STRUCT_0204F3D0_H

View File

@ -1,14 +0,0 @@
#ifndef POKEPLATINUM_UNK_0204F13C_H
#define POKEPLATINUM_UNK_0204F13C_H
#include "field_script_context.h"
BOOL ScrCmd_2CC(ScriptContext *param0);
BOOL ScrCmd_2D1(ScriptContext *param0);
BOOL ScrCmd_2CF(ScriptContext *param0);
BOOL ScrCmd_324(ScriptContext *param0);
BOOL ScrCmd_325(ScriptContext *param0);
BOOL ScrCmd_326(ScriptContext *param0);
BOOL ScrCmd_32A(ScriptContext *param0);
#endif // POKEPLATINUM_UNK_0204F13C_H

View File

@ -5,7 +5,16 @@
#include "savedata.h"
void sub_0204FA34(int param0, int param1, void *param2, void *param3);
typedef struct BattleHallSameSpeciesCheck {
u8 taskState;
u8 receivedMessages;
u16 unused;
u16 species;
u16 partnersSpecies;
u16 *speciesAreDifferent;
} BattleHallSameSpeciesCheck;
void BattleHall_ProcessSelectedSpeciesMsg(int netID, int unused, void *data, void *context);
void sub_0204FA50(SaveData *saveData, UnkStruct_0203026C *param1, u8 param2);
#endif // POKEPLATINUM_UNK_0204FA34_H

View File

@ -210,7 +210,7 @@ Static main
Object main.nef.p/src_scrcmd_party_mon_moves.c.o
Object main.nef.p/src_scrcmd_dummy_23F_242.c.o
Object main.nef.p/src_unk_0204F04C.c.o
Object main.nef.p/src_unk_0204F13C.c.o
Object main.nef.p/src_scrcmd_battle_hall.c.o
Object main.nef.p/src_unk_0204FA34.c.o
Object main.nef.p/src_unk_0204FAB4.c.o
Object main.nef.p/src_unk_0205001C.c.o

View File

@ -11,7 +11,7 @@
],
"object_events": [
{
"id": "BATTLE_HALL_FRONTIER_SINGLE_ATTENDANT_0",
"id": "LOCALID_SINGLE_ATTENDANT",
"graphics_id": "OBJ_EVENT_GFX_FRONTIER_SINGLE_ATTENDANT",
"movement_type": "MOVEMENT_TYPE_LOOK_EAST",
"trainer_type": "TRAINER_TYPE_NONE",
@ -26,7 +26,7 @@
"y": 0
},
{
"id": "BATTLE_HALL_FRONTIER_MULTI_ATTENDANT_1",
"id": "LOCALID_MULTI_ATTENDANT",
"graphics_id": "OBJ_EVENT_GFX_FRONTIER_MULTI_ATTENDANT",
"movement_type": "MOVEMENT_TYPE_LOOK_EAST",
"trainer_type": "TRAINER_TYPE_NONE",
@ -41,7 +41,7 @@
"y": 0
},
{
"id": "BATTLE_HALL_MAID_2",
"id": "LOCALID_MAID",
"graphics_id": "OBJ_EVENT_GFX_MAID",
"movement_type": "MOVEMENT_TYPE_LOOK_NORTH_AND_EAST",
"trainer_type": "TRAINER_TYPE_NONE",
@ -56,7 +56,7 @@
"y": 0
},
{
"id": "BATTLE_HALL_POKEFAN_F_3",
"id": "LOCALID_POKEFAN_F",
"graphics_id": "OBJ_EVENT_GFX_POKEFAN_F",
"movement_type": "MOVEMENT_TYPE_WANDER_AROUND",
"trainer_type": "TRAINER_TYPE_NONE",
@ -71,7 +71,7 @@
"y": 0
},
{
"id": "BATTLE_HALL_TWIN_4",
"id": "LOCALID_TWIN",
"graphics_id": "OBJ_EVENT_GFX_TWIN",
"movement_type": "MOVEMENT_TYPE_NONE",
"trainer_type": "TRAINER_TYPE_NONE",
@ -86,7 +86,7 @@
"y": 0
},
{
"id": "BATTLE_HALL_PACHIRISU_5",
"id": "LOCALID_PACHIRISU",
"graphics_id": "OBJ_EVENT_GFX_PACHIRISU",
"movement_type": "MOVEMENT_TYPE_LOOK_NORTH_AND_EAST",
"trainer_type": "TRAINER_TYPE_NONE",
@ -101,7 +101,7 @@
"y": 0
},
{
"id": "BATTLE_HALL_SNOWPOINT_NPC_F_6",
"id": "LOCALID_SNOWPOINT_NPC_F",
"graphics_id": "OBJ_EVENT_GFX_SNOWPOINT_NPC_F",
"movement_type": "MOVEMENT_TYPE_WANDER_AROUND",
"trainer_type": "TRAINER_TYPE_NONE",
@ -116,7 +116,7 @@
"y": 0
},
{
"id": "BATTLE_HALL_HIKER_7",
"id": "LOCALID_HIKER",
"graphics_id": "OBJ_EVENT_GFX_HIKER",
"movement_type": "MOVEMENT_TYPE_WANDER_AROUND",
"trainer_type": "TRAINER_TYPE_NONE",
@ -131,7 +131,7 @@
"y": 0
},
{
"id": "BATTLE_HALL_EXPERT_M_8",
"id": "LOCALID_EXPERT_M",
"graphics_id": "OBJ_EVENT_GFX_EXPERT_M",
"movement_type": "MOVEMENT_TYPE_NONE",
"trainer_type": "TRAINER_TYPE_NONE",
@ -146,7 +146,7 @@
"y": 0
},
{
"id": "BATTLE_HALL_IDOL_9",
"id": "LOCALID_IDOL",
"graphics_id": "OBJ_EVENT_GFX_IDOL",
"movement_type": "MOVEMENT_TYPE_NONE",
"trainer_type": "TRAINER_TYPE_NONE",
@ -161,11 +161,11 @@
"y": 0
},
{
"id": "BATTLE_HALL_REPORTER_10",
"id": "LOCALID_REPORTER",
"graphics_id": "OBJ_EVENT_GFX_REPORTER",
"movement_type": "MOVEMENT_TYPE_LOOK_SOUTH",
"trainer_type": "TRAINER_TYPE_NONE",
"hidden_flag": "FLAG_UNK_0x02C1",
"hidden_flag": "FLAG_BATTLE_HALL_HIDE_REPORTER",
"script": 10163,
"initial_dir": 1,
"data": [],
@ -176,7 +176,7 @@
"y": 0
},
{
"id": "BATTLE_HALL_BUG_CATCHER_11",
"id": "LOCALID_BUG_CATCHER",
"graphics_id": "OBJ_EVENT_GFX_BUG_CATCHER",
"movement_type": "MOVEMENT_TYPE_NONE",
"trainer_type": "TRAINER_TYPE_NONE",
@ -191,7 +191,7 @@
"y": 0
},
{
"id": "BATTLE_HALL_UNK_104_12",
"id": "LOCALID_SERENA_WINSTON",
"graphics_id": "OBJ_EVENT_GFX_UNK_104",
"movement_type": "MOVEMENT_TYPE_LOOK_WEST",
"trainer_type": "TRAINER_TYPE_NONE",
@ -206,11 +206,11 @@
"y": 0
},
{
"id": "BATTLE_HALL_UNK_102_13",
"id": "LOCALID_MAJOR_NPC",
"graphics_id": "OBJ_EVENT_GFX_UNK_102",
"movement_type": "MOVEMENT_TYPE_LOOK_SOUTH",
"trainer_type": "TRAINER_TYPE_NONE",
"hidden_flag": "FLAG_UNK_0x02CB",
"hidden_flag": "FLAG_HIDE_BATTLE_HALL_MAJOR_NPC",
"script": 20,
"initial_dir": 1,
"data": [],
@ -221,7 +221,7 @@
"y": 0
},
{
"id": "BATTLE_HALL_FRONTIER_SINGLE_ATTENDANT_14",
"id": "LOCALID_RECORD_KEEPER",
"graphics_id": "OBJ_EVENT_GFX_FRONTIER_SINGLE_ATTENDANT",
"movement_type": "MOVEMENT_TYPE_LOOK_SOUTH",
"trainer_type": "TRAINER_TYPE_NONE",

View File

@ -43,7 +43,7 @@
ScriptEntryEnd
_009A:
SetFlag FLAG_UNK_0x02CB
SetFlag FLAG_HIDE_BATTLE_HALL_MAJOR_NPC
CheckTVInterviewEligible TV_PROGRAM_SEGMENT_BATTLE_FRONTIER_FRONTLINE_NEWS_MULTI, VAR_MAP_LOCAL_0
GoToIfEq VAR_MAP_LOCAL_0, 0, _00D5
ScrCmd_329 VAR_MAP_LOCAL_1, VAR_MAP_LOCAL_2, VAR_MAP_LOCAL_3, VAR_MAP_LOCAL_4

File diff suppressed because it is too large Load Diff

View File

@ -8,10 +8,10 @@
InitScriptEntryEnd
InitScriptFrameTable:
InitScriptGoToIfEqual VAR_UNK_0x40BA, 1, 4
InitScriptGoToIfEqual VAR_UNK_0x40BA, 2, 2
InitScriptGoToIfEqual VAR_UNK_0x40BA, 3, 5
InitScriptGoToIfEqual VAR_UNK_0x40BA, 0xFF, 3
InitScriptGoToIfEqual VAR_BATTLE_HALL_LOBBY_LOAD_ACTION, 1, 4
InitScriptGoToIfEqual VAR_BATTLE_HALL_LOBBY_LOAD_ACTION, 2, 2
InitScriptGoToIfEqual VAR_BATTLE_HALL_LOBBY_LOAD_ACTION, 3, 5
InitScriptGoToIfEqual VAR_BATTLE_HALL_LOBBY_LOAD_ACTION, 0xFF, 3
InitScriptFrameTableEnd
InitScriptEnd

View File

@ -327,12 +327,12 @@ _043C:
SetVar VAR_UNK_0x40B8, 0
SetVar VAR_UNK_0x40B9, 0
SetVar VAR_UNK_0x40BD, 0
SetVar VAR_UNK_0x40BB, 0
SetVar VAR_BATTLE_HALL_CHALLENGE_TYPE, 0
SetVar VAR_UNK_0x40BE, 0
SetVar VAR_UNK_0x40D8, 0
SetVar VAR_UNK_0x40B7, 0
SetVar VAR_UNK_0x40BC, 0
SetVar VAR_UNK_0x40BA, 0
SetVar VAR_BATTLE_HALL_LOBBY_LOAD_ACTION, 0
SetVar VAR_UNK_0x40BF, 0
Dummy1F9 VAR_UNK_0x40B8
End

View File

@ -2,7 +2,7 @@
"key": 5194,
"messages": [
{
"id": "pl_msg_00000311_00000",
"id": "BattleHall_Text_WelcomeToSingleChallenge",
"en_US": [
"Welcome to the Battle Hall!\r",
"I am your guide to the Single and\n",
@ -12,11 +12,11 @@
]
},
{
"id": "pl_msg_00000311_00001",
"id": "BattleHall_Text_SelectChallenge",
"en_US": "Which challenge would you like to take?"
},
{
"id": "pl_msg_00000311_00002",
"id": "BattleHall_Text_SingleChallengeInfo",
"en_US": [
"At the Battle Hall, you may take Single\n",
"or Double Battle challenges alone.\r",
@ -42,7 +42,7 @@
]
},
{
"id": "pl_msg_00000311_00003",
"id": "BattleHall_Text_WelcomeToMultiChallenge",
"en_US": [
"Welcome to the Battle Hall!\r",
"I am your guide to the Multi Battle\n",
@ -52,14 +52,14 @@
]
},
{
"id": "pl_msg_00000311_00004",
"id": "BattleHall_Text_AcceptMultiChallenge",
"en_US": [
"Would you like to take the Battle Hall\n",
"Multi Battle challenge?"
]
},
{
"id": "pl_msg_00000311_00005",
"id": "BattleHall_Text_MultiChallengeInfo",
"en_US": [
"You may team up with a friend for a\n",
"Multi Battle challenge using the\r",
@ -75,27 +75,27 @@
]
},
{
"id": "pl_msg_00000311_00006",
"id": "BattleHall_Text_HopeToSeeYouAgain",
"en_US": "We hope to see you again!"
},
{
"id": "pl_msg_00000311_00007",
"id": "BattleHall_Text_Dummy1",
"garbage": 32
},
{
"id": "pl_msg_00000311_00008",
"id": "BattleHall_Text_Dummy2",
"garbage": 32
},
{
"id": "pl_msg_00000311_00009",
"id": "BattleHall_Text_ThisWayPlease",
"en_US": "Right this way, please!"
},
{
"id": "pl_msg_00000311_00010",
"id": "BattleHall_Text_Dummy3",
"garbage": 27
},
{
"id": "pl_msg_00000311_00011",
"id": "BattleHall_Text_MustSaveBeforeResuming",
"en_US": [
"Weve missed you!\r",
"You must save the game before you\n",
@ -103,7 +103,7 @@
]
},
{
"id": "pl_msg_00000311_00012",
"id": "BattleHall_Text_DidntSaveBeforeQuit",
"en_US": [
"Excuse me!\r",
"You didnt save before you quit your\n",
@ -113,7 +113,7 @@
]
},
{
"id": "pl_msg_00000311_00013",
"id": "BattleHall_Text_YouveEarnedAPrint",
"en_US": [
"Congratulations!\r",
"In honor of your victory, we present\n",
@ -121,77 +121,77 @@
]
},
{
"id": "pl_msg_00000311_00014",
"id": "BattleHall_Text_GoldPrintAdded",
"en_US": [
"The Gold Print was added to\n",
"{STRVAR_1 3, 0, 0}s Vs. Recorder!\r"
]
},
{
"id": "pl_msg_00000311_00015",
"id": "BattleHall_Text_SilverPrintAdded",
"en_US": [
"The Silver Print was added to\n",
"{STRVAR_1 3, 0, 0}s Vs. Recorder!\r"
]
},
{
"id": "pl_msg_00000311_00016",
"id": "BattleHall_Text_SingleBattle",
"en_US": "SINGLE BATTLE"
},
{
"id": "pl_msg_00000311_00017",
"id": "BattleHall_Text_DoubleBattle",
"en_US": "DOUBLE BATTLE"
},
{
"id": "pl_msg_00000311_00018",
"id": "BattleHall_Text_TakeChallenge",
"en_US": "TAKE CHALLENGE"
},
{
"id": "pl_msg_00000311_00019",
"id": "BattleHall_Text_Info",
"en_US": "INFO"
},
{
"id": "pl_msg_00000311_00020",
"id": "BattleHall_Text_Cancel",
"en_US": "CANCEL"
},
{
"id": "pl_msg_00000311_00021",
"id": "BattleHall_Text_Dummy4",
"garbage": 5
},
{
"id": "pl_msg_00000311_00022",
"id": "BattleHall_Text_Dummy5",
"garbage": 7
},
{
"id": "pl_msg_00000311_00023",
"id": "BattleHall_Text_Dummy6",
"garbage": 3
},
{
"id": "pl_msg_00000311_00024",
"id": "BattleHall_Text_Dummy7",
"garbage": 85
},
{
"id": "pl_msg_00000311_00025",
"id": "BattleHall_Text_Dummy8",
"garbage": 86
},
{
"id": "pl_msg_00000311_00026",
"id": "BattleHall_Text_Dummy9",
"garbage": 59
},
{
"id": "pl_msg_00000311_00027",
"id": "BattleHall_Text_Dummy10",
"garbage": 44
},
{
"id": "pl_msg_00000311_00028",
"id": "BattleHall_Text_Dummy11",
"garbage": 50
},
{
"id": "pl_msg_00000311_00029",
"id": "BattleHall_Text_Dummy12",
"garbage": 65
},
{
"id": "pl_msg_00000311_00030",
"id": "BattleHall_Text_BecomeLeaderOrJoinGroup",
"en_US": [
"One Trainer should select\n",
"“BECOME LEADER.”\r",
@ -200,28 +200,28 @@
]
},
{
"id": "pl_msg_00000311_00031",
"id": "BattleHall_Text_NeedToLaunchWifiComm",
"en_US": [
"We need to launch DS Wireless\n",
"Communications."
]
},
{
"id": "pl_msg_00000311_00032",
"id": "BattleHall_Text_MustSaveFirst",
"en_US": [
"You must save the game before I\n",
"show you in. Please wait."
]
},
{
"id": "pl_msg_00000311_00033",
"id": "BattleHall_Text_ChoosePokemonToEnter",
"en_US": [
"Please choose the Pokémon you wish to\n",
"enter.\r"
]
},
{
"id": "pl_msg_00000311_00034",
"id": "BattleHall_Text_DeleteOngoingStreak",
"en_US": [
"There is an ongoing winning streak\n",
"saved for {STRVAR_1 0, 0, 0}.\r",
@ -230,7 +230,7 @@
]
},
{
"id": "pl_msg_00000311_00035",
"id": "BattleHall_Text_NeedOneLvl30Pokemon",
"en_US": [
"Excuse me!\r",
"You dont have a single eligible Pokémon\n",
@ -238,7 +238,7 @@
]
},
{
"id": "pl_msg_00000311_00036",
"id": "BattleHall_Text_NeedTwoLvl30Pokemon",
"en_US": [
"Excuse me!\r",
"For Double Battles, you must have two\n",
@ -247,25 +247,25 @@
]
},
{
"id": "pl_msg_00000311_00037",
"id": "BattleHall_Text_BanList",
"en_US": "Also, Eggs are ineligible to enter.\r"
},
{
"id": "pl_msg_00000311_00038",
"id": "BattleHall_Text_BanList1",
"en_US": [
"Eggs and {STRVAR_1 0, 1, 0} are not allowed\n",
"to enter.\r"
]
},
{
"id": "pl_msg_00000311_00039",
"id": "BattleHall_Text_BanList2",
"en_US": [
"Eggs, {STRVAR_1 0, 1, 0}, and {STRVAR_1 0, 2, 0}\n",
"are not allowed to enter.\r"
]
},
{
"id": "pl_msg_00000311_00040",
"id": "BattleHall_Text_BanList3",
"en_US": [
"Eggs, {STRVAR_1 0, 1, 0}, {STRVAR_1 0, 2, 0},\n",
"and {STRVAR_1 0, 3, 0} are not allowed\f",
@ -273,7 +273,7 @@
]
},
{
"id": "pl_msg_00000311_00041",
"id": "BattleHall_Text_BanList4",
"en_US": [
"Eggs, {STRVAR_1 0, 1, 0}, {STRVAR_1 0, 2, 0},\n",
"{STRVAR_1 0, 3, 0}, and {STRVAR_1 0, 4, 0}\f",
@ -281,7 +281,7 @@
]
},
{
"id": "pl_msg_00000311_00042",
"id": "BattleHall_Text_BanList5",
"en_US": [
"Eggs, {STRVAR_1 0, 1, 0}, {STRVAR_1 0, 2, 0},\n",
"{STRVAR_1 0, 3, 0}, {STRVAR_1 0, 4, 0}, and\f",
@ -289,7 +289,7 @@
]
},
{
"id": "pl_msg_00000311_00043",
"id": "BattleHall_Text_BanList6",
"en_US": [
"Eggs, {STRVAR_1 0, 1, 0}, {STRVAR_1 0, 2, 0},\n",
"{STRVAR_1 0, 3, 0}, {STRVAR_1 0, 4, 0},\f",
@ -298,7 +298,7 @@
]
},
{
"id": "pl_msg_00000311_00044",
"id": "BattleHall_Text_BanList7",
"en_US": [
"Eggs, {STRVAR_1 0, 1, 0}, {STRVAR_1 0, 2, 0},\n",
"{STRVAR_1 0, 3, 0}, {STRVAR_1 0, 4, 0},\f",
@ -307,7 +307,7 @@
]
},
{
"id": "pl_msg_00000311_00045",
"id": "BattleHall_Text_BanList8",
"en_US": [
"Eggs, {STRVAR_1 0, 1, 0}, {STRVAR_1 0, 2, 0},\n",
"{STRVAR_1 0, 3, 0}, {STRVAR_1 0, 4, 0},\f",
@ -317,7 +317,7 @@
]
},
{
"id": "pl_msg_00000311_00046",
"id": "BattleHall_Text_BanList9",
"en_US": [
"Eggs, {STRVAR_1 0, 1, 0}, {STRVAR_1 0, 2, 0},\n",
"{STRVAR_1 0, 3, 0}, {STRVAR_1 0, 4, 0},\f",
@ -327,7 +327,7 @@
]
},
{
"id": "pl_msg_00000311_00047",
"id": "BattleHall_Text_BanList10",
"en_US": [
"Eggs, {STRVAR_1 0, 1, 0}, {STRVAR_1 0, 2, 0},\n",
"{STRVAR_1 0, 3, 0}, {STRVAR_1 0, 4, 0},\f",
@ -338,7 +338,7 @@
]
},
{
"id": "pl_msg_00000311_00048",
"id": "BattleHall_Text_BanList11",
"en_US": [
"Eggs, {STRVAR_1 0, 1, 0}, {STRVAR_1 0, 2, 0},\n",
"{STRVAR_1 0, 3, 0}, {STRVAR_1 0, 4, 0},\f",
@ -349,7 +349,7 @@
]
},
{
"id": "pl_msg_00000311_00049",
"id": "BattleHall_Text_BanList12",
"en_US": [
"Eggs, {STRVAR_1 0, 1, 0}, {STRVAR_1 0, 2, 0},\n",
"{STRVAR_1 0, 3, 0}, {STRVAR_1 0, 4, 0},\f",
@ -361,7 +361,7 @@
]
},
{
"id": "pl_msg_00000311_00050",
"id": "BattleHall_Text_BanList13",
"en_US": [
"Eggs, {STRVAR_1 0, 1, 0}, {STRVAR_1 0, 2, 0},\n",
"{STRVAR_1 0, 3, 0}, {STRVAR_1 0, 4, 0},\f",
@ -373,7 +373,7 @@
]
},
{
"id": "pl_msg_00000311_00051",
"id": "BattleHall_Text_BanList14",
"en_US": [
"Eggs, {STRVAR_1 0, 1, 0}, {STRVAR_1 0, 2, 0},\n",
"{STRVAR_1 0, 3, 0}, {STRVAR_1 0, 4, 0},\f",
@ -386,7 +386,7 @@
]
},
{
"id": "pl_msg_00000311_00052",
"id": "BattleHall_Text_BanList15",
"en_US": [
"Eggs, {STRVAR_1 0, 1, 0}, {STRVAR_1 0, 2, 0},\n",
"{STRVAR_1 0, 3, 0}, {STRVAR_1 0, 4, 0},\f",
@ -399,7 +399,7 @@
]
},
{
"id": "pl_msg_00000311_00053",
"id": "BattleHall_Text_BanList16",
"en_US": [
"Eggs, {STRVAR_1 0, 1, 0}, {STRVAR_1 0, 2, 0},\n",
"{STRVAR_1 0, 3, 0}, {STRVAR_1 0, 4, 0},\f",
@ -413,7 +413,7 @@
]
},
{
"id": "pl_msg_00000311_00054",
"id": "BattleHall_Text_BanList17",
"en_US": [
"Eggs, {STRVAR_1 0, 1, 0}, {STRVAR_1 0, 2, 0},\n",
"{STRVAR_1 0, 3, 0}, {STRVAR_1 0, 4, 0},\f",
@ -427,7 +427,7 @@
]
},
{
"id": "pl_msg_00000311_00055",
"id": "BattleHall_Text_BanList18",
"en_US": [
"Eggs, {STRVAR_1 0, 1, 0}, {STRVAR_1 0, 2, 0},\n",
"{STRVAR_1 0, 3, 0}, {STRVAR_1 0, 4, 0},\f",
@ -442,11 +442,11 @@
]
},
{
"id": "pl_msg_00000311_00056",
"id": "BattleHall_Text_SeeMeWhenReady",
"en_US": "Please come see me when you are ready.\r"
},
{
"id": "pl_msg_00000311_00057",
"id": "BattleHall_Text_MultiChallengeMustUseSamePokemon",
"en_US": [
"The Battle Hall Multi Battle challenge\n",
"requires both partners to enter the\f",
@ -456,11 +456,11 @@
]
},
{
"id": "pl_msg_00000311_00058",
"id": "BattleHall_Text_Dummy13",
"garbage": 7
},
{
"id": "pl_msg_00000311_00059",
"id": "BattleHall_Text_StartWithHardMatchups",
"en_US": [
"When it comes to food, this Hiker\n",
"chows down on the favorites first.\r",
@ -471,7 +471,7 @@
]
},
{
"id": "pl_msg_00000311_00060",
"id": "BattleHall_Text_TryForARecord",
"en_US": [
"That opulent stage!\n",
"Every Pokémon can get up there.\r",
@ -482,7 +482,7 @@
]
},
{
"id": "pl_msg_00000311_00061",
"id": "BattleHall_Text_PachirisusACutie",
"en_US": [
"Pachipachi...\r",
"My PACHIRISU is a cutie, but hes even\n",
@ -492,11 +492,11 @@
]
},
{
"id": "pl_msg_00000311_00062",
"id": "BattleHall_Text_Pachirisu",
"en_US": "PACHIRISU: Pachipachi pacchipachii!"
},
{
"id": "pl_msg_00000311_00063",
"id": "BattleHall_Text_TryDifferentPokemon",
"en_US": [
"You should try the Battle Hall with\n",
"different kinds of Pokémon, too.\r",
@ -505,7 +505,7 @@
]
},
{
"id": "pl_msg_00000311_00064",
"id": "BattleHall_Text_TrySameSpeciesDifferentMoves",
"en_US": [
"Theres a key point to keep in mind\n",
"here.\r",
@ -518,7 +518,7 @@
]
},
{
"id": "pl_msg_00000311_00065",
"id": "BattleHall_Text_CroagunkHasTwoTypes",
"en_US": [
"You know how CROAGUNK has two types:\n",
"Poison and Fighting?\r",
@ -527,7 +527,7 @@
]
},
{
"id": "pl_msg_00000311_00066",
"id": "BattleHall_Text_MysteriousMaid",
"en_US": [
"Ohoho! Ohohohoho!\n",
"Im the mysterious maid!\r",
@ -541,7 +541,7 @@
]
},
{
"id": "pl_msg_00000311_00067",
"id": "BattleHall_Text_CompeteWithAFriend",
"en_US": [
"Theres this game that Im totally into\n",
"right now.\r",
@ -552,7 +552,7 @@
]
},
{
"id": "pl_msg_00000311_00068",
"id": "BattleHall_Text_RecordKeeperIntro",
"en_US": [
"I keep track of the total number of\n",
"wins from your longest Single Battle\f",
@ -562,7 +562,7 @@
]
},
{
"id": "pl_msg_00000311_00069",
"id": "BattleHall_Text_StreakIsPresentlyX",
"en_US": [
"When your total win-streak record hits\n",
"certain figures, you will earn BP as\f",
@ -572,7 +572,7 @@
]
},
{
"id": "pl_msg_00000311_00070",
"id": "BattleHall_Text_BPRewardForStreak",
"en_US": [
"Your total win-streak record has\n",
"reached {STRVAR_1 55, 2, 0}.\f",
@ -580,25 +580,25 @@
]
},
{
"id": "pl_msg_00000311_00071",
"id": "BattleHall_Text_WillEarnBPForStreak",
"en_US": [
"When your total win-streak record\n",
"reaches {STRVAR_1 55, 3, 0}, you will earn BP."
]
},
{
"id": "pl_msg_00000311_00072",
"id": "BattleHall_Text_PlayerReceivedBP",
"en_US": "{STRVAR_1 3, 0, 0} received {STRVAR_1 53, 4, 0} BP!"
},
{
"id": "pl_msg_00000311_00073",
"id": "BattleHall_Text_RecordStandsAtX",
"en_US": [
"{STRVAR_1 3, 0, 0}, your total win-streak\n",
"record stands at {STRVAR_1 55, 1, 0}.\r"
]
},
{
"id": "pl_msg_00000311_00074",
"id": "BattleHall_Text_FantasticRecord",
"en_US": [
"{STRVAR_1 3, 0, 0}, your total win-streak\n",
"record stands at {STRVAR_1 55, 1, 0}.\r",
@ -607,7 +607,7 @@
]
},
{
"id": "pl_msg_00000311_00075",
"id": "BattleHall_Text_Winston0Species",
"en_US": [
"Winston: The Battle Halls been kind of\n",
"boring lately.\r",
@ -618,7 +618,7 @@
]
},
{
"id": "pl_msg_00000311_00076",
"id": "BattleHall_Text_Winston1Species",
"en_US": [
"Winston: Let me take a wild guess.\n",
"Are you getting into the Battle Hall?\f",
@ -628,7 +628,7 @@
]
},
{
"id": "pl_msg_00000311_00077",
"id": "BattleHall_Text_Winston11Species",
"en_US": [
"Winston: ...\n",
"...Oh, sorry for staring!\r",
@ -639,7 +639,7 @@
]
},
{
"id": "pl_msg_00000311_00078",
"id": "BattleHall_Text_Winston31Species",
"en_US": [
"Winston: I check you out every time\n",
"you get up on stage.\r",
@ -650,7 +650,7 @@
]
},
{
"id": "pl_msg_00000311_00079",
"id": "BattleHall_Text_Winston51Species",
"en_US": [
"Winston: Hey, there!\n",
"What are you going to do this time?\r",
@ -662,7 +662,7 @@
]
},
{
"id": "pl_msg_00000311_00080",
"id": "BattleHall_Text_Winston101Species",
"en_US": [
"Winston: Awesome!\n",
"Seriously awesome!\f",
@ -672,7 +672,7 @@
]
},
{
"id": "pl_msg_00000311_00081",
"id": "BattleHall_Text_Winston151Species",
"en_US": [
"Winston: Ive never seen Pokémon\n",
"battle as enjoyably as yours do.\r",
@ -685,7 +685,7 @@
]
},
{
"id": "pl_msg_00000311_00082",
"id": "BattleHall_Text_Winston251Species",
"en_US": [
"Winston: Go, {STRVAR_1 3, 0, 0}, go!\n",
"Go, {STRVAR_1 3, 0, 0}, go!\r",
@ -696,7 +696,7 @@
]
},
{
"id": "pl_msg_00000311_00083",
"id": "BattleHall_Text_Winston351Species",
"en_US": [
"Winston: Youre phenomenal.\n",
"All the battles you waged on stage...\f",
@ -706,7 +706,7 @@
]
},
{
"id": "pl_msg_00000311_00084",
"id": "BattleHall_Text_Winston475Species",
"en_US": [
"Winston: The love for Pokémon you\n",
"exhibited at the Battle Hall is as\f",
@ -718,7 +718,7 @@
]
},
{
"id": "pl_msg_00000311_00085",
"id": "BattleHall_Text_Serena0Species",
"en_US": [
"Serena: Its about the Battle Hall...\n",
"It hasnt excited me lately.\r",
@ -729,7 +729,7 @@
]
},
{
"id": "pl_msg_00000311_00086",
"id": "BattleHall_Text_Serena1Species",
"en_US": [
"Serena: Um... Excuse me?\r",
"If you dont mind me asking, are you\n",
@ -741,7 +741,7 @@
]
},
{
"id": "pl_msg_00000311_00087",
"id": "BattleHall_Text_Serena11Species",
"en_US": [
"Serena: Um... Excuse me?\r",
"I watched you when you were on stage.\n",
@ -751,7 +751,7 @@
]
},
{
"id": "pl_msg_00000311_00088",
"id": "BattleHall_Text_Serena31Species",
"en_US": [
"Serena: Um... Excuse me?\r",
"I cheer for you the best I can.\r",
@ -761,7 +761,7 @@
]
},
{
"id": "pl_msg_00000311_00089",
"id": "BattleHall_Text_Serena51Species",
"en_US": [
"Serena: Um... Excuse me?\r",
"Can you tell me what kind of Pokémon\n",
@ -773,7 +773,7 @@
]
},
{
"id": "pl_msg_00000311_00090",
"id": "BattleHall_Text_Serena101Species",
"en_US": [
"Serena: Um... Excuse me?\r",
"Fantastic! Its fantastic!\n",
@ -783,7 +783,7 @@
]
},
{
"id": "pl_msg_00000311_00091",
"id": "BattleHall_Text_Serena151Species",
"en_US": [
"Serena: Ive never seen Pokémon\n",
"battle as enjoyably as yours do.\r",
@ -796,7 +796,7 @@
]
},
{
"id": "pl_msg_00000311_00092",
"id": "BattleHall_Text_Serena251Species",
"en_US": [
"Serena: Hurray, hurray, {STRVAR_1 3, 0, 0}!\n",
"Go, Pokémon, go!\r",
@ -808,7 +808,7 @@
]
},
{
"id": "pl_msg_00000311_00093",
"id": "BattleHall_Text_Serena351Species",
"en_US": [
"Serena: Youre so inspiring to me.\r",
"All the glory you earned while battling\n",
@ -818,7 +818,7 @@
]
},
{
"id": "pl_msg_00000311_00094",
"id": "BattleHall_Text_Serena475Species",
"en_US": [
"Serena: Your Pokémon love that youve\n",
"shown at the Battle Hall is as infinitely\f",
@ -830,7 +830,7 @@
]
},
{
"id": "pl_msg_00000311_00095",
"id": "BattleHall_Text_Dawn",
"en_US": [
"Dawn: Hi, {STRVAR_1 3, 0, 0}.\n",
"Do you know what Ive been doing?\r",
@ -843,7 +843,7 @@
]
},
{
"id": "pl_msg_00000311_00096",
"id": "BattleHall_Text_Lucas",
"en_US": [
"Lucas: These stage battles are lots\n",
"of fun just to watch!\r",
@ -852,7 +852,7 @@
]
},
{
"id": "pl_msg_00000311_00097",
"id": "BattleHall_Text_Mom",
"en_US": [
"Mom: {STRVAR_1 3, 0, 0}!\r",
"When I come here, I cheer for everyone\n",
@ -864,7 +864,7 @@
]
},
{
"id": "pl_msg_00000311_00098",
"id": "BattleHall_Text_Oak",
"en_US": [
"Oak: You keep amazing me over and over.\n",
"What a Trainer you turned out to be!\r",
@ -877,7 +877,7 @@
]
},
{
"id": "pl_msg_00000311_00099",
"id": "BattleHall_Text_Jasmine",
"en_US": [
"Jasmine: I love showy events like\n",
"Battle Hall challenges and Contests.\r",

View File

@ -166,11 +166,11 @@
"en_US": "RULES"
},
{
"id": "pl_msg_00000361_00041",
"id": "MenuEntries_Text_Yes",
"en_US": "YES"
},
{
"id": "pl_msg_00000361_00042",
"id": "MenuEntries_Text_No",
"en_US": "NO"
},
{

View File

@ -298,7 +298,7 @@ static const u16 sTrainerScoreIncrements[MAX_TRAINER_SCORE_EVENTS] = {
[TRAINER_SCORE_EVENT_UNDERGROUND_100_STEPS] = 1,
[TRAINER_SCORE_EVENT_UNK_38] = 7,
[TRAINER_SCORE_EVENT_UNK_39] = 7,
[TRAINER_SCORE_EVENT_UNK_40] = 7,
[TRAINER_SCORE_EVENT_BATTLE_HALL_ROUND_COMPLETED] = 7,
[TRAINER_SCORE_EVENT_UNK_41] = 7,
[TRAINER_SCORE_EVENT_ALL_BATTLE_FRONTIER_GOLD_PRINTS] = 1000,
[TRAINER_SCORE_EVENT_UNK_43] = 11,

View File

@ -354,8 +354,8 @@ Menu *Menu_MakeYesNoChoiceWithCursorAt(BgConfig *bgConfig, const WindowTemplate
MessageLoader *msgLoader = MessageLoader_Init(MSG_LOADER_LOAD_ON_DEMAND, NARC_INDEX_MSGDATA__PL_MSG, TEXT_BANK_MENU_ENTRIES, heapID);
StringList *choices = StringList_New(2, heapID);
StringList_AddFromMessageBank(choices, msgLoader, pl_msg_00000361_00041, 0);
StringList_AddFromMessageBank(choices, msgLoader, pl_msg_00000361_00042, MENU_CANCELED);
StringList_AddFromMessageBank(choices, msgLoader, MenuEntries_Text_Yes, 0);
StringList_AddFromMessageBank(choices, msgLoader, MenuEntries_Text_No, MENU_CANCELED);
MessageLoader_Free(msgLoader);
menuTemplate.choices = choices;

View File

@ -198,7 +198,7 @@ pokeplatinum_c = files(
'scrcmd_party_mon_moves.c',
'scrcmd_dummy_23F_242.c',
'unk_0204F04C.c',
'unk_0204F13C.c',
'scrcmd_battle_hall.c',
'unk_0204FA34.c',
'unk_0204FAB4.c',
'unk_0205001C.c',

View File

@ -145,6 +145,7 @@
#include "save_player.h"
#include "savedata.h"
#include "scrcmd_amity_square.h"
#include "scrcmd_battle_hall.h"
#include "scrcmd_berry.h"
#include "scrcmd_catching_show.h"
#include "scrcmd_coins.h"
@ -198,7 +199,6 @@
#include "unk_020494DC.h"
#include "unk_0204AEE8.h"
#include "unk_0204F04C.h"
#include "unk_0204F13C.h"
#include "unk_0204FAB4.h"
#include "unk_0205003C.h"
#include "unk_02050568.h"
@ -532,7 +532,7 @@ static BOOL ScrCmd_WaitABPressTime(ScriptContext *ctx);
static BOOL ScriptContext_DecrementABPressTimer(ScriptContext *ctx);
static BOOL ScrCmd_SelectMoveTutorPokemon(ScriptContext *ctx);
static BOOL ScrCmd_GetSelectedPartySlot(ScriptContext *ctx);
static BOOL ScrCmd_2D0(ScriptContext *ctx);
static BOOL ScrCmd_GetBattleHallSelectedSlots(ScriptContext *ctx);
static BOOL ScrCmd_2D4(ScriptContext *ctx);
static BOOL ScrCmd_2DB(ScriptContext *ctx);
static BOOL ScrCmd_OpenPartyMenuForTrade(ScriptContext *ctx);
@ -1488,8 +1488,8 @@ const ScrCmdFunc Unk_020EAC58[] = {
ScrCmd_2CC,
ScrCmd_2CD,
ScrCmd_Unused_2CE,
ScrCmd_2CF,
ScrCmd_2D0,
ScrCmd_BattleHallCheckUsingSameSpeciesAsPartner,
ScrCmd_GetBattleHallSelectedSlots,
ScrCmd_2D1,
ScrCmd_2D2,
ScrCmd_2D3,
@ -1573,9 +1573,9 @@ const ScrCmdFunc Unk_020EAC58[] = {
ScrCmd_StartDistortionWorldGiratinaShadowEvent,
ScrCmd_FinishDistortionWorldGiratinaShadowEvent,
ScrCmd_323,
ScrCmd_324,
ScrCmd_325,
ScrCmd_326,
ScrCmd_GetBattleHallRecordKeeperStats,
ScrCmd_GetNumSpeciesWithBattleHallRecords,
ScrCmd_GetBattleHallTotalSinglesRecord,
ScrCmd_ShowListMenuSetWidth,
ScrCmd_SetPartyGiratinaForm,
ScrCmd_329,
@ -3471,33 +3471,31 @@ static BOOL ScrCmd_GetSelectedPartySlot(ScriptContext *ctx)
return FALSE;
}
static BOOL ScrCmd_2D0(ScriptContext *ctx)
static BOOL ScrCmd_GetBattleHallSelectedSlots(ScriptContext *ctx)
{
u16 *v3 = ScriptContext_GetVarPointer(ctx);
u16 *v4 = ScriptContext_GetVarPointer(ctx);
void **v2 = FieldSystem_GetScriptMemberPtr(ctx->fieldSystem, SCRIPT_MANAGER_PARTY_MANAGEMENT_DATA);
PartyMenu *partyMenu = *v2;
u16 *selectedSlot1 = ScriptContext_GetVarPointer(ctx);
u16 *selectedSlot2 = ScriptContext_GetVarPointer(ctx);
void **partySelect = FieldSystem_GetScriptMemberPtr(ctx->fieldSystem, SCRIPT_MANAGER_PARTY_MANAGEMENT_DATA);
PartyMenu *partyMenu = *partySelect;
GF_ASSERT(*v2 != 0);
GF_ASSERT(*partySelect != NULL);
int v1 = PartyMenu_GetSelectedSlot(*v2);
int slot = PartyMenu_GetSelectedSlot(*partySelect);
if (v1 == MAX_PARTY_SIZE + 1) {
*v3 = 0xff;
} else if (v1 == MAX_PARTY_SIZE) {
u16 v0 = partyMenu->selectionOrder[0];
*v3 = v0;
*v3 -= 1;
v0 = partyMenu->selectionOrder[1];
*v4 = v0;
if (slot == MAX_PARTY_SIZE + 1) {
*selectedSlot1 = 0xff;
} else if (slot == MAX_PARTY_SIZE) {
*selectedSlot1 = partyMenu->selectionOrder[0];
*selectedSlot1 -= 1;
if (*v4 > 0) {
*v4 -= 1;
*selectedSlot2 = partyMenu->selectionOrder[1];
if (*selectedSlot2 > 0) {
*selectedSlot2 -= 1;
}
}
Heap_Free(*v2);
*v2 = NULL;
Heap_Free(*partySelect);
*partySelect = NULL;
return FALSE;
}

631
src/scrcmd_battle_hall.c Normal file
View File

@ -0,0 +1,631 @@
#include "scrcmd_battle_hall.h"
#include <nitro.h>
#include <string.h>
#include "generated/game_records.h"
#include "struct_decls/struct_02030114_decl.h"
#include "struct_decls/struct_0203026C_decl.h"
#include "struct_decls/struct_020308A0_decl.h"
#include "applications/party_menu/defs.h"
#include "applications/party_menu/main.h"
#include "applications/pokemon_summary_screen/main.h"
#include "field/field_system.h"
#include "bag.h"
#include "communication_system.h"
#include "dexmode_checker.h"
#include "field_script_context.h"
#include "field_system.h"
#include "field_task.h"
#include "game_records.h"
#include "heap.h"
#include "inlines.h"
#include "mail.h"
#include "party.h"
#include "pokemon.h"
#include "save_player.h"
#include "savedata.h"
#include "script_manager.h"
#include "string_template.h"
#include "unk_0202D05C.h"
#include "unk_0202D778.h"
#include "unk_02030108.h"
#include "unk_0203061C.h"
#include "unk_02030880.h"
#include "unk_0204FA34.h"
#include "unk_0205DFC4.h"
#include "unk_02099500.h"
#include "constdata/const_020F410C.h"
typedef struct BattleHallTaskEnv {
int subTask;
u8 challengeType;
u8 selectedMonSlot;
u8 selectedChallengers[2];
void **partyMenu;
} BattleHallTaskEnv;
enum BattleHallSelectionSubTask {
SUBTASK_OPEN_PARTY_MENU,
SUBTASK_PROCESS_PARTY_MENU,
SUBTASK_OPEN_MON_SUMMARY,
SUBTASK_PROCESS_MON_SUMMARY,
SUBTASK_END_TASK,
};
static BOOL CheckPartyIsBattleHallEligible(u16 numPokemonNeeded, SaveData *saveData);
static void CheckSameSpeciesAsPartner(FieldTask *param0, u16 param1, u16 *param2);
static BOOL CheckSameSpeciesAsPartnerTask(FieldTask *param0);
static void SelectBattleHallChallengers(FieldTask *task, void **partySelect, u8 challengeType);
static BOOL BattleHallSelectChallengersTask(FieldTask *task);
static int SubTask_SetupPartyMenu(BattleHallTaskEnv *taskEnv, FieldSystem *fieldSystem, int unused);
static int SubTaskProcessPartyMenu(BattleHallTaskEnv *taskEnv, FieldSystem *fieldSystem);
static int SubTask_SetupMonSummary(BattleHallTaskEnv *taskEnv, FieldSystem *fieldSystem, enum HeapID heapID);
static int SubTask_ProcessMonSummary(BattleHallTaskEnv *taskEnv, FieldSystem *fieldSystem);
BOOL ScrCmd_2CC(ScriptContext *ctx)
{
u8 challengeType;
u16 action = ScriptContext_ReadHalfWord(ctx);
u16 arg = ScriptContext_GetVar(ctx);
u16 *result = FieldSystem_GetVarPointer(ctx->fieldSystem, ScriptContext_ReadHalfWord(ctx));
UnkStruct_02030114 *v10 = sub_02030114(ctx->fieldSystem->saveData);
UnkStruct_0203026C *v11 = sub_0203026C(ctx->fieldSystem->saveData);
void **partySelect = FieldSystem_GetScriptMemberPtr(ctx->fieldSystem, SCRIPT_MANAGER_PARTY_MANAGEMENT_DATA);
switch (action) {
case 0:
*result = CheckPartyIsBattleHallEligible(arg, ctx->fieldSystem->saveData);
break;
case 1:
if (arg == 3) {
*result = sub_02030698(SaveData_GetBattleFrontier(ctx->fieldSystem->saveData),
106,
sub_0205E6A8(106));
} else {
*result = sub_020302B4(v11, 5, arg, 0, NULL);
}
break;
case 2:
*result = sub_02030698(SaveData_GetBattleFrontier(ctx->fieldSystem->saveData),
sub_0205E55C(arg),
sub_0205E6A8(sub_0205E55C(arg)));
break;
case 3:
sub_0204FA50(ctx->fieldSystem->saveData, v11, arg);
break;
case 4:
if (arg == 0) {
challengeType = 0;
} else if (arg == 1) {
challengeType = 1;
} else {
challengeType = 2;
}
SelectBattleHallChallengers(ctx->task, partySelect, challengeType);
return TRUE;
default:;
GF_ASSERT(FALSE);
*result = 0;
break;
}
return FALSE;
}
static BOOL CheckPartyIsBattleHallEligible(u16 numPokemonNeeded, SaveData *saveData)
{
u8 i, j, numEligible;
u16 species, level;
Party *party = SaveData_GetParty(saveData);
u8 partyCount = Party_GetCurrentCount(party);
if (partyCount < numPokemonNeeded) {
return FALSE;
}
u16 eligibleSpecies[MAX_PARTY_SIZE];
for (i = 0; i < MAX_PARTY_SIZE; i++) {
eligibleSpecies[i] = 0;
}
for (i = 0, numEligible = 0; i < partyCount; i++) {
Pokemon *mon = Party_GetPokemonBySlotIndex(party, i);
species = Pokemon_GetValue(mon, MON_DATA_SPECIES, NULL);
level = Pokemon_GetValue(mon, MON_DATA_LEVEL, NULL);
if (Pokemon_GetValue(mon, MON_DATA_IS_EGG, NULL) != FALSE) {
continue;
}
if (level < 30) {
continue;
}
if (Pokemon_IsOnBattleFrontierBanlist(species) == TRUE) {
continue;
}
numEligible++;
eligibleSpecies[i] = species;
}
if (numPokemonNeeded == 2) {
for (j = 0; j < partyCount; j++) {
for (i = 0; i < partyCount; i++) {
if (j != i) {
if (eligibleSpecies[j] != 0) {
if (eligibleSpecies[j] == eligibleSpecies[i]) {
return TRUE;
}
}
}
}
}
return FALSE;
}
if (numEligible < numPokemonNeeded) {
return FALSE;
}
return TRUE;
}
BOOL ScrCmd_2D1(ScriptContext *ctx)
{
u16 challengeType = ScriptContext_GetVar(ctx);
UnkStruct_0203026C *v0 = sub_0203026C(ctx->fieldSystem->saveData);
sub_0204FA50(ctx->fieldSystem->saveData, v0, challengeType);
return FALSE;
}
BOOL ScrCmd_BattleHallCheckUsingSameSpeciesAsPartner(ScriptContext *ctx)
{
u16 species = ScriptContext_GetVar(ctx);
u16 *result = ScriptContext_GetVarPointer(ctx);
CheckSameSpeciesAsPartner(ctx->task, species, result);
return TRUE;
}
static void CheckSameSpeciesAsPartner(FieldTask *task, u16 species, u16 *speciesAreDifferent)
{
BattleHallSameSpeciesCheck *taskEnv = Heap_Alloc(HEAP_ID_FIELD2, sizeof(BattleHallSameSpeciesCheck));
memset(taskEnv, 0, sizeof(BattleHallSameSpeciesCheck));
taskEnv->species = species;
taskEnv->speciesAreDifferent = speciesAreDifferent;
CommFieldCmd_Init(taskEnv);
FieldTask_InitCall(task, CheckSameSpeciesAsPartnerTask, taskEnv);
return;
}
static BOOL CheckSameSpeciesAsPartnerTask(FieldTask *task)
{
BattleHallSameSpeciesCheck *data = FieldTask_GetEnv(task);
switch (data->taskState) {
case 0:
if (CommSys_SendData(132, data, sizeof(BattleHallSameSpeciesCheck)) == TRUE) {
data->taskState++;
}
break;
case 1:
if (data->receivedMessages >= 2) {
if (data->species == data->partnersSpecies) {
*data->speciesAreDifferent = FALSE;
} else {
*data->speciesAreDifferent = TRUE;
}
data->taskState++;
}
break;
case 2:
Heap_Free(data);
return TRUE;
};
return FALSE;
}
static void SelectBattleHallChallengers(FieldTask *task, void **partySelect, u8 challengeType)
{
FieldSystem *fieldSystem = FieldTask_GetFieldSystem(task);
BattleHallTaskEnv *taskEnv = Heap_Alloc(HEAP_ID_FIELD2, sizeof(BattleHallTaskEnv));
MI_CpuClear8(taskEnv, sizeof(BattleHallTaskEnv));
taskEnv->challengeType = challengeType;
taskEnv->partyMenu = partySelect;
FieldTask_InitCall(fieldSystem->task, BattleHallSelectChallengersTask, taskEnv);
}
static BOOL BattleHallSelectChallengersTask(FieldTask *task)
{
FieldSystem *fieldSystem = FieldTask_GetFieldSystem(task);
BattleHallTaskEnv *taskEnv = FieldTask_GetEnv(task);
switch (taskEnv->subTask) {
case SUBTASK_OPEN_PARTY_MENU:
taskEnv->subTask = SubTask_SetupPartyMenu(taskEnv, fieldSystem, 11);
break;
case SUBTASK_PROCESS_PARTY_MENU:
taskEnv->subTask = SubTaskProcessPartyMenu(taskEnv, fieldSystem);
break;
case SUBTASK_OPEN_MON_SUMMARY:
taskEnv->subTask = SubTask_SetupMonSummary(taskEnv, fieldSystem, HEAP_ID_FIELD2);
break;
case SUBTASK_PROCESS_MON_SUMMARY:
taskEnv->subTask = SubTask_ProcessMonSummary(taskEnv, fieldSystem);
break;
case SUBTASK_END_TASK:
Heap_Free(taskEnv);
return TRUE;
}
return FALSE;
}
static int SubTask_SetupPartyMenu(BattleHallTaskEnv *taskEnv, FieldSystem *fieldSystem, int unused)
{
PartyMenu *partyMenu = Heap_Alloc(HEAP_ID_FIELD2, sizeof(PartyMenu));
MI_CpuClearFast(partyMenu, sizeof(PartyMenu));
partyMenu->party = SaveData_GetParty(fieldSystem->saveData);
partyMenu->bag = SaveData_GetBag(fieldSystem->saveData);
partyMenu->mailbox = SaveData_GetMailbox(fieldSystem->saveData);
partyMenu->options = SaveData_GetOptions(fieldSystem->saveData);
partyMenu->type = PARTY_MENU_TYPE_BASIC;
partyMenu->mode = PARTY_MENU_MODE_BATTLE_HALL;
partyMenu->fieldSystem = fieldSystem;
partyMenu->selectedMonSlot = taskEnv->selectedMonSlot;
for (u8 i = 0; i < 2; i++) {
partyMenu->selectionOrder[i] = taskEnv->selectedChallengers[i];
}
partyMenu->reqLevel = 30;
partyMenu->minSelectionSlots = 1;
partyMenu->maxSelectionSlots = 1;
if (taskEnv->challengeType == 1) {
partyMenu->minSelectionSlots = 2;
partyMenu->maxSelectionSlots = 2;
}
FieldSystem_StartChildProcess(fieldSystem, &gPokemonPartyAppTemplate, partyMenu);
*taskEnv->partyMenu = partyMenu;
return SUBTASK_PROCESS_PARTY_MENU;
}
static int SubTaskProcessPartyMenu(BattleHallTaskEnv *taskEnv, FieldSystem *fieldSystem)
{
if (FieldSystem_IsRunningApplication(fieldSystem)) {
return SUBTASK_PROCESS_PARTY_MENU;
}
PartyMenu *partyMenu = *taskEnv->partyMenu;
switch (partyMenu->selectedMonSlot) {
case 7:
return SUBTASK_END_TASK;
case 6:
return SUBTASK_END_TASK;
default:
break;
}
MI_CpuCopy8(partyMenu->selectionOrder, taskEnv->selectedChallengers, 2);
taskEnv->selectedMonSlot = partyMenu->selectedMonSlot;
Heap_Free(partyMenu);
*taskEnv->partyMenu = NULL;
return SUBTASK_OPEN_MON_SUMMARY;
}
static int SubTask_SetupMonSummary(BattleHallTaskEnv *taskEnv, FieldSystem *fieldSystem, enum HeapID heapID)
{
static const u8 sMonSummaryPages[] = {
SUMMARY_PAGE_INFO,
SUMMARY_PAGE_MEMO,
SUMMARY_PAGE_SKILLS,
SUMMARY_PAGE_CONDITION,
SUMMARY_PAGE_BATTLE_MOVES,
SUMMARY_PAGE_CONTEST_MOVES,
SUMMARY_PAGE_RIBBONS,
SUMMARY_PAGE_EXIT,
SUMMARY_PAGE_MAX
};
SaveData *saveData = fieldSystem->saveData;
PokemonSummary *monSummary = Heap_AllocAtEnd(heapID, sizeof(PokemonSummary));
MI_CpuClear8(monSummary, sizeof(PokemonSummary));
monSummary->options = SaveData_GetOptions(saveData);
monSummary->monData = SaveData_GetParty(saveData);
monSummary->dexMode = SaveData_GetDexMode(saveData);
monSummary->showContest = PokemonSummaryScreen_ShowContestData(saveData);
monSummary->dataType = SUMMARY_DATA_PARTY_MON;
monSummary->monIndex = taskEnv->selectedMonSlot;
monSummary->monMax = Party_GetCurrentCount(monSummary->monData);
monSummary->move = 0;
monSummary->mode = SUMMARY_MODE_NORMAL;
monSummary->specialRibbons = SaveData_GetRibbons(saveData);
PokemonSummaryScreen_FlagVisiblePages(monSummary, sMonSummaryPages);
PokemonSummaryScreen_SetPlayerProfile(monSummary, SaveData_GetTrainerInfo(saveData));
FieldSystem_StartChildProcess(fieldSystem, &gPokemonSummaryScreenApp, monSummary);
*taskEnv->partyMenu = monSummary;
return SUBTASK_PROCESS_MON_SUMMARY;
}
static int SubTask_ProcessMonSummary(BattleHallTaskEnv *taskEnv, FieldSystem *fieldSystem)
{
if (FieldSystem_IsRunningApplication(fieldSystem)) {
return SUBTASK_PROCESS_MON_SUMMARY;
}
PokemonSummary *monSummary = *taskEnv->partyMenu;
taskEnv->selectedMonSlot = monSummary->monIndex;
Heap_Free(monSummary);
*taskEnv->partyMenu = NULL;
return SUBTASK_OPEN_PARTY_MENU;
}
typedef struct BattleHallMilestone {
u32 record;
u32 bp;
} BattleHallMilestone;
static const BattleHallMilestone sBattleHallRecordMilestones[] = {
{ 10, 1 },
{ 30, 3 },
{ 50, 5 },
{ 100, 5 },
{ 150, 5 },
{ 200, 5 },
{ 250, 5 },
{ 300, 5 },
{ 350, 5 },
{ 400, 5 },
{ 450, 5 },
{ 500, 10 },
{ 600, 10 },
{ 700, 10 },
{ 800, 10 },
{ 900, 10 },
{ 1000, 10 },
{ 1200, 30 },
{ 1400, 30 },
{ 1600, 30 },
{ 1800, 30 },
{ 2000, 50 },
{ 2500, 50 },
{ 3000, 50 },
{ 3500, 50 },
{ 4000, 50 },
{ 4500, 50 },
{ 5000, 50 },
{ 5500, 50 },
{ 6000, 50 },
{ 6500, 50 },
{ 7000, 50 },
{ 7500, 50 },
{ 8000, 50 },
{ 8500, 50 },
{ 9000, 50 },
{ 9500, 50 },
{ 10000, 100 },
{ 20000, 200 },
{ 30000, 300 },
{ 40000, 400 },
{ 50000, 500 },
{ 60000, 600 },
{ 70000, 700 },
{ 80000, 800 },
{ 90000, 900 },
{ 100000, 1000 },
};
BOOL ScrCmd_GetBattleHallRecordKeeperStats(ScriptContext *ctx)
{
BattleFrontierStage *frontierStage;
FieldSystem *fieldSystem = ctx->fieldSystem;
StringTemplate **strTemplate = FieldSystem_GetScriptMemberPtr(fieldSystem, SCRIPT_MANAGER_STR_TEMPLATE);
u8 curStreakStrIndex = ScriptContext_ReadByte(ctx);
u8 passedMilestoneStrIndex = ScriptContext_ReadByte(ctx);
u8 nextMilestoneStrIndex = ScriptContext_ReadByte(ctx);
u8 earnedBPStrIndex = ScriptContext_ReadByte(ctx);
u16 *nextMilestone = ScriptContext_GetVarPointer(ctx);
u16 *recordKeepersResponse = ScriptContext_GetVarPointer(ctx);
u32 totalWinRecord = 0;
int loadResult = LOAD_RESULT_OK;
if (!SaveData_MiscSaveBlock_InitFlag(fieldSystem->saveData)) {
*recordKeepersResponse = 0;
return FALSE;
}
frontierStage = sub_020308A0(fieldSystem->saveData, HEAP_ID_FIELD3, &loadResult);
if (loadResult != LOAD_RESULT_OK) {
totalWinRecord = 0;
} else {
for (u32 species = 0; species < NATIONAL_DEX_COUNT; species++) {
totalWinRecord += sub_020308BC(fieldSystem->saveData, frontierStage, 0, species);
}
}
if (frontierStage != NULL) {
Heap_Free(frontierStage);
}
StringTemplate_SetNumber(*strTemplate, curStreakStrIndex, totalWinRecord, GetNumberDigitCount(totalWinRecord), 1, 1);
u16 earnedBP = 0;
u32 reachedMilestone = 0;
u16 nextMilestoneInitial = *nextMilestone;
for (u32 i = *nextMilestone; i < NELEMS(sBattleHallRecordMilestones); i++) {
if (sBattleHallRecordMilestones[i].record <= totalWinRecord) {
earnedBP += sBattleHallRecordMilestones[i].bp;
*nextMilestone += 1;
reachedMilestone = i;
}
}
GameRecords_AddToRecordValue(SaveData_GetGameRecords(ctx->fieldSystem->saveData), RECORD_UNK_068, earnedBP);
if (earnedBP != 0) {
BattlePoints_ApplyFuncAndGet(
sub_0202D750(ctx->fieldSystem->saveData), earnedBP, BATTLE_POINTS_FUNC_ADD);
}
if (totalWinRecord == 0) {
*recordKeepersResponse = 0;
} else {
if (nextMilestoneInitial != *nextMilestone) {
*recordKeepersResponse = 1;
} else {
*recordKeepersResponse = 2;
}
if (nextMilestoneInitial >= NELEMS(sBattleHallRecordMilestones)) {
*recordKeepersResponse = 3;
return FALSE;
}
}
StringTemplate_SetNumber(*strTemplate, passedMilestoneStrIndex, sBattleHallRecordMilestones[reachedMilestone].record, GetNumberDigitCount(sBattleHallRecordMilestones[reachedMilestone].record), 1, 1);
StringTemplate_SetNumber(*strTemplate, nextMilestoneStrIndex, sBattleHallRecordMilestones[*nextMilestone].record, GetNumberDigitCount(sBattleHallRecordMilestones[*nextMilestone].record), 1, 1);
StringTemplate_SetNumber(*strTemplate, earnedBPStrIndex, earnedBP, GetNumberDigitCount(earnedBP), 1, 1);
return FALSE;
}
BOOL ScrCmd_GetNumSpeciesWithBattleHallRecords(ScriptContext *ctx)
{
BattleFrontierStage *frontierStage;
u32 combinedRecord, species;
FieldSystem *fieldSystem = ctx->fieldSystem;
u16 *result = ScriptContext_GetVarPointer(ctx);
u32 numSpeciesWithRecord = 0;
int loadResult = LOAD_RESULT_OK;
if (!SaveData_MiscSaveBlock_InitFlag(fieldSystem->saveData)) {
*result = 0;
return FALSE;
}
frontierStage = sub_020308A0(fieldSystem->saveData, HEAP_ID_FIELD3, &loadResult);
if (loadResult != LOAD_RESULT_OK) {
numSpeciesWithRecord = 0;
} else {
for (species = 0; species < NATIONAL_DEX_COUNT; species++) {
combinedRecord = 0;
combinedRecord += sub_020308BC(fieldSystem->saveData, frontierStage, 0, species);
combinedRecord += sub_020308BC(fieldSystem->saveData, frontierStage, 1, species);
combinedRecord += sub_020308BC(fieldSystem->saveData, frontierStage, 2, species);
if (combinedRecord > 0) {
numSpeciesWithRecord++;
}
}
}
if (frontierStage != NULL) {
Heap_Free(frontierStage);
}
*result = numSpeciesWithRecord;
return FALSE;
}
BOOL ScrCmd_GetBattleHallTotalSinglesRecord(ScriptContext *ctx)
{
BattleFrontierStage *frontierStage;
FieldSystem *fieldSystem = ctx->fieldSystem;
u16 *result = ScriptContext_GetVarPointer(ctx);
u32 totalRecord = 0;
int loadResult = LOAD_RESULT_OK;
if (!SaveData_MiscSaveBlock_InitFlag(fieldSystem->saveData)) {
*result = 0;
return FALSE;
}
frontierStage = sub_020308A0(fieldSystem->saveData, HEAP_ID_FIELD3, &loadResult);
if (loadResult != LOAD_RESULT_OK) {
totalRecord = 0;
} else {
for (u32 species = 0; species < NATIONAL_DEX_COUNT; species++) {
totalRecord += sub_020308BC(fieldSystem->saveData, frontierStage, 0, species);
}
}
if (frontierStage != NULL) {
Heap_Free(frontierStage);
}
if (totalRecord > 10000) {
totalRecord = 10000;
}
*result = totalRecord;
return FALSE;
}
BOOL ScrCmd_32A(ScriptContext *ctx)
{
u16 *v2 = ScriptContext_GetVarPointer(ctx);
u16 v0 = sub_02030698(SaveData_GetBattleFrontier(ctx->fieldSystem->saveData),
sub_0205E55C(0),
0xff);
u16 v1 = sub_02030698(SaveData_GetBattleFrontier(ctx->fieldSystem->saveData),
sub_0205E50C(0),
0xff);
*v2 = 0;
if (v1 == 50) {
*v2 = 1;
}
return FALSE;
}

View File

@ -53,19 +53,19 @@ int sub_020308A8(SaveData *saveData, BattleFrontierStage *param1)
return v0;
}
u16 sub_020308BC(SaveData *saveData, BattleFrontierStage *param1, int param2, int param3)
u16 sub_020308BC(SaveData *saveData, BattleFrontierStage *frontierStage, int challengeType, int species)
{
if (SaveData_MiscSaveBlock_InitFlag(saveData) == 0) {
if (!SaveData_MiscSaveBlock_InitFlag(saveData)) {
return 0;
}
switch (param2) {
switch (challengeType) {
case 0:
return param1->unk_04.unk_00[param3];
return frontierStage->unk_04.unk_00[species];
case 1:
return param1->unk_04.unk_3DE[param3];
return frontierStage->unk_04.unk_3DE[species];
case 2:
return param1->unk_04.unk_7BC[param3];
return frontierStage->unk_04.unk_7BC[species];
}
GF_ASSERT(0);

View File

@ -1,712 +0,0 @@
#include "unk_0204F13C.h"
#include <nitro.h>
#include <string.h>
#include "constants/species.h"
#include "generated/game_records.h"
#include "struct_decls/struct_02030114_decl.h"
#include "struct_decls/struct_0203026C_decl.h"
#include "struct_decls/struct_020308A0_decl.h"
#include "struct_defs/battle_frontier.h"
#include "struct_defs/battle_tower.h"
#include "struct_defs/struct_0204F3D0.h"
#include "applications/party_menu/defs.h"
#include "applications/party_menu/main.h"
#include "applications/pokemon_summary_screen/main.h"
#include "field/field_system.h"
#include "bag.h"
#include "communication_system.h"
#include "dexmode_checker.h"
#include "field_script_context.h"
#include "field_system.h"
#include "field_task.h"
#include "game_records.h"
#include "heap.h"
#include "inlines.h"
#include "mail.h"
#include "party.h"
#include "pokemon.h"
#include "save_player.h"
#include "savedata.h"
#include "script_manager.h"
#include "string_template.h"
#include "unk_0202D05C.h"
#include "unk_0202D778.h"
#include "unk_02030108.h"
#include "unk_0203061C.h"
#include "unk_02030880.h"
#include "unk_0204FA34.h"
#include "unk_0205DFC4.h"
#include "unk_02099500.h"
#include "constdata/const_020F410C.h"
typedef struct UnkStruct_0204F470_t {
int unk_00;
u8 unk_04;
u8 unk_05;
u8 unk_06[2];
void **unk_08;
} UnkStruct_0204F470;
enum {
UnkEnum_0204F13C_1,
UnkEnum_0204F13C_2,
UnkEnum_0204F13C_3,
UnkEnum_0204F13C_4,
UnkEnum_0204F13C_5,
};
BOOL ScrCmd_2CC(ScriptContext *param0);
static BOOL sub_0204F268(u16 param0, SaveData *saveData);
BOOL ScrCmd_2D1(ScriptContext *param0);
BOOL ScrCmd_2CF(ScriptContext *param0);
void sub_0204F3D0(FieldTask *param0, u16 param1, u16 *param2);
static BOOL sub_0204F414(FieldTask *param0);
void sub_0204F470(FieldTask *param0, void **param1, u8 param2);
static BOOL sub_0204F4A4(FieldTask *param0);
static int sub_0204F50C(UnkStruct_0204F470 *param0, FieldSystem *fieldSystem, int param2);
static int sub_0204F5D8(UnkStruct_0204F470 *param0, FieldSystem *fieldSystem);
static int sub_0204F628(UnkStruct_0204F470 *param0, FieldSystem *fieldSystem, enum HeapID heapID);
static int sub_0204F6B0(UnkStruct_0204F470 *param0, FieldSystem *fieldSystem);
BOOL ScrCmd_2CC(ScriptContext *param0)
{
u8 v0;
u8 v1[4];
u16 v2[4];
u16 v3, v4, v5;
u16 *v6, *v7;
void **v8;
UnkStruct_02030114 *v10;
UnkStruct_0203026C *v11;
v3 = ScriptContext_ReadHalfWord(param0);
v4 = ScriptContext_GetVar(param0);
v5 = ScriptContext_ReadHalfWord(param0);
v6 = FieldSystem_GetVarPointer(param0->fieldSystem, v5);
v10 = sub_02030114(param0->fieldSystem->saveData);
v11 = sub_0203026C(param0->fieldSystem->saveData);
v8 = FieldSystem_GetScriptMemberPtr(param0->fieldSystem, 19);
switch (v3) {
case 0:
*v6 = sub_0204F268(v4, param0->fieldSystem->saveData);
break;
case 1:
if (v4 == 3) {
*v6 = sub_02030698(SaveData_GetBattleFrontier(param0->fieldSystem->saveData),
106,
sub_0205E6A8(106));
} else {
*v6 = (u16)sub_020302B4(v11, 5, v4, 0, NULL);
}
break;
case 2:
*v6 = sub_02030698(SaveData_GetBattleFrontier(param0->fieldSystem->saveData),
sub_0205E55C(v4),
sub_0205E6A8(sub_0205E55C(v4)));
break;
case 3:
sub_0204FA50(param0->fieldSystem->saveData, v11, v4);
break;
case 4:
if (v4 == 0) {
v0 = 0;
} else if (v4 == 1) {
v0 = 1;
} else if (v4 == 2) {
v0 = 2;
} else {
v0 = 2;
}
;
sub_0204F470(param0->task, v8, v0);
return 1;
default:;
GF_ASSERT(FALSE);
*v6 = 0;
break;
}
return 0;
}
static BOOL sub_0204F268(u16 param0, SaveData *saveData)
{
u8 v0, v1, v2, v3;
u16 v4, v5;
Party *v6;
Pokemon *v7;
u16 v8[6];
v6 = SaveData_GetParty(saveData);
v3 = Party_GetCurrentCount(v6);
if (v3 < param0) {
return 0;
}
for (v0 = 0; v0 < 6; v0++) {
v8[v0] = 0;
}
for (v0 = 0, v2 = 0; v0 < v3; v0++) {
v7 = Party_GetPokemonBySlotIndex(v6, v0);
v4 = Pokemon_GetValue(v7, MON_DATA_SPECIES, NULL);
v5 = Pokemon_GetValue(v7, MON_DATA_LEVEL, NULL);
if (Pokemon_GetValue(v7, MON_DATA_IS_EGG, NULL) != 0) {
continue;
}
if (v5 < 30) {
continue;
}
if (Pokemon_IsOnBattleFrontierBanlist(v4) == 1) {
continue;
}
v2++;
v8[v0] = v4;
}
if (param0 == 2) {
for (v1 = 0; v1 < v3; v1++) {
for (v0 = 0; v0 < v3; v0++) {
if (v1 != v0) {
if (v8[v1] != 0) {
if (v8[v1] == v8[v0]) {
return 1;
}
}
}
}
}
return 0;
}
if (v2 < param0) {
return 0;
}
return 1;
}
BOOL ScrCmd_2D1(ScriptContext *param0)
{
UnkStruct_0203026C *v0;
u16 v1 = ScriptContext_GetVar(param0);
v0 = sub_0203026C(param0->fieldSystem->saveData);
sub_0204FA50(param0->fieldSystem->saveData, v0, v1);
return 0;
}
BOOL ScrCmd_2CF(ScriptContext *param0)
{
u16 v0 = ScriptContext_GetVar(param0);
u16 *v1 = ScriptContext_GetVarPointer(param0);
;
;
sub_0204F3D0(param0->task, v0, v1);
return 1;
}
void sub_0204F3D0(FieldTask *param0, u16 param1, u16 *param2)
{
UnkStruct_0204F3D0 *v0 = Heap_Alloc(HEAP_ID_FIELD2, sizeof(UnkStruct_0204F3D0));
memset(v0, 0, sizeof(UnkStruct_0204F3D0));
v0->unk_04 = param1;
v0->unk_08 = param2;
CommFieldCmd_Init(v0);
FieldTask_InitCall(param0, sub_0204F414, v0);
return;
}
static BOOL sub_0204F414(FieldTask *param0)
{
UnkStruct_0204F3D0 *v0 = FieldTask_GetEnv(param0);
switch (v0->unk_00) {
case 0:
if (CommSys_SendData(132, v0, sizeof(UnkStruct_0204F3D0)) == 1) {
v0->unk_00++;
}
break;
case 1:
if (v0->unk_01 >= 2) {
if (v0->unk_04 == v0->unk_06) {
*v0->unk_08 = 0;
} else {
*v0->unk_08 = 1;
}
;
;
;
v0->unk_00++;
}
break;
case 2:
Heap_Free(v0);
return 1;
};
return 0;
}
void sub_0204F470(FieldTask *param0, void **param1, u8 param2)
{
FieldSystem *fieldSystem = FieldTask_GetFieldSystem(param0);
UnkStruct_0204F470 *v1 = Heap_Alloc(HEAP_ID_FIELD2, sizeof(UnkStruct_0204F470));
MI_CpuClear8(v1, sizeof(UnkStruct_0204F470));
v1->unk_04 = param2;
v1->unk_08 = param1;
FieldTask_InitCall(fieldSystem->task, sub_0204F4A4, v1);
return;
}
static BOOL sub_0204F4A4(FieldTask *param0)
{
FieldSystem *fieldSystem = FieldTask_GetFieldSystem(param0);
UnkStruct_0204F470 *v1 = FieldTask_GetEnv(param0);
switch (v1->unk_00) {
case UnkEnum_0204F13C_1:
v1->unk_00 = sub_0204F50C(v1, fieldSystem, 11);
break;
case UnkEnum_0204F13C_2:
v1->unk_00 = sub_0204F5D8(v1, fieldSystem);
break;
case UnkEnum_0204F13C_3:
v1->unk_00 = sub_0204F628(v1, fieldSystem, HEAP_ID_FIELD2);
break;
case UnkEnum_0204F13C_4:
v1->unk_00 = sub_0204F6B0(v1, fieldSystem);
break;
case UnkEnum_0204F13C_5:
Heap_Free(v1);
return 1;
}
return 0;
}
static int sub_0204F50C(UnkStruct_0204F470 *param0, FieldSystem *fieldSystem, int param2)
{
u8 v0;
PartyMenu *partyMenu = Heap_Alloc(HEAP_ID_FIELD2, sizeof(PartyMenu));
MI_CpuClearFast(partyMenu, sizeof(PartyMenu));
partyMenu->party = SaveData_GetParty(fieldSystem->saveData);
partyMenu->bag = SaveData_GetBag(fieldSystem->saveData);
partyMenu->mailbox = SaveData_GetMailbox(fieldSystem->saveData);
partyMenu->options = SaveData_GetOptions(fieldSystem->saveData);
partyMenu->type = PARTY_MENU_TYPE_BASIC;
partyMenu->mode = PARTY_MENU_MODE_BATTLE_HALL;
partyMenu->fieldSystem = fieldSystem;
partyMenu->selectedMonSlot = param0->unk_05;
for (v0 = 0; v0 < 2; v0++) {
partyMenu->selectionOrder[v0] = param0->unk_06[v0];
}
partyMenu->reqLevel = 30;
partyMenu->minSelectionSlots = 1;
partyMenu->maxSelectionSlots = 1;
if (param0->unk_04 == 1) {
partyMenu->minSelectionSlots = 2;
partyMenu->maxSelectionSlots = 2;
}
FieldSystem_StartChildProcess(fieldSystem, &gPokemonPartyAppTemplate, partyMenu);
*(param0->unk_08) = partyMenu;
return UnkEnum_0204F13C_2;
}
static int sub_0204F5D8(UnkStruct_0204F470 *param0, FieldSystem *fieldSystem)
{
int v0;
PartyMenu *partyMenu;
if (FieldSystem_IsRunningApplication(fieldSystem)) {
return UnkEnum_0204F13C_2;
}
partyMenu = *(param0->unk_08);
switch (partyMenu->selectedMonSlot) {
case 7:
return UnkEnum_0204F13C_5;
case 6:
return UnkEnum_0204F13C_5;
default:
break;
}
MI_CpuCopy8(partyMenu->selectionOrder, param0->unk_06, 2);
param0->unk_05 = partyMenu->selectedMonSlot;
Heap_Free(partyMenu);
*(param0->unk_08) = NULL;
return UnkEnum_0204F13C_3;
}
static int sub_0204F628(UnkStruct_0204F470 *param0, FieldSystem *fieldSystem, enum HeapID heapID)
{
PokemonSummary *v0;
SaveData *saveData;
static const u8 v2[] = {
0,
1,
2,
4,
3,
5,
6,
7,
8
};
saveData = fieldSystem->saveData;
v0 = Heap_AllocAtEnd(heapID, sizeof(PokemonSummary));
MI_CpuClear8(v0, sizeof(PokemonSummary));
v0->options = SaveData_GetOptions(saveData);
v0->monData = SaveData_GetParty(saveData);
v0->dexMode = SaveData_GetDexMode(saveData);
v0->showContest = PokemonSummaryScreen_ShowContestData(saveData);
v0->dataType = SUMMARY_DATA_PARTY_MON;
v0->monIndex = param0->unk_05;
v0->monMax = Party_GetCurrentCount(v0->monData);
v0->move = 0;
v0->mode = SUMMARY_MODE_NORMAL;
v0->specialRibbons = SaveData_GetRibbons(saveData);
PokemonSummaryScreen_FlagVisiblePages(v0, v2);
PokemonSummaryScreen_SetPlayerProfile(v0, SaveData_GetTrainerInfo(saveData));
FieldSystem_StartChildProcess(fieldSystem, &gPokemonSummaryScreenApp, v0);
*(param0->unk_08) = v0;
return UnkEnum_0204F13C_4;
}
static int sub_0204F6B0(UnkStruct_0204F470 *param0, FieldSystem *fieldSystem)
{
PokemonSummary *v0;
if (FieldSystem_IsRunningApplication(fieldSystem)) {
return UnkEnum_0204F13C_4;
}
v0 = *(param0->unk_08);
param0->unk_05 = v0->monIndex;
Heap_Free(v0);
*(param0->unk_08) = NULL;
return UnkEnum_0204F13C_1;
}
BOOL ScrCmd_324(ScriptContext *param0);
typedef struct {
u32 unk_00;
u32 unk_04;
} UnkStruct_020EC078;
static const UnkStruct_020EC078 Unk_020EC078[] = {
{ 10, 1 },
{ 30, 3 },
{ 50, 5 },
{ 100, 5 },
{ 150, 5 },
{ 200, 5 },
{ 250, 5 },
{ 300, 5 },
{ 350, 5 },
{ 400, 5 },
{ 450, 5 },
{ 500, 10 },
{ 600, 10 },
{ 700, 10 },
{ 800, 10 },
{ 900, 10 },
{ 1000, 10 },
{ 1200, 30 },
{ 1400, 30 },
{ 1600, 30 },
{ 1800, 30 },
{ 2000, 50 },
{ 2500, 50 },
{ 3000, 50 },
{ 3500, 50 },
{ 4000, 50 },
{ 4500, 50 },
{ 5000, 50 },
{ 5500, 50 },
{ 6000, 50 },
{ 6500, 50 },
{ 7000, 50 },
{ 7500, 50 },
{ 8000, 50 },
{ 8500, 50 },
{ 9000, 50 },
{ 9500, 50 },
{ 10000, 100 },
{ 20000, 200 },
{ 30000, 300 },
{ 40000, 400 },
{ 50000, 500 },
{ 60000, 600 },
{ 70000, 700 },
{ 80000, 800 },
{ 90000, 900 },
{ 100000, 1000 },
};
BOOL ScrCmd_324(ScriptContext *param0)
{
int v0;
int v1;
BattleFrontierStage *v2;
BattleFrontier *frontier;
u32 v4, v5, v6;
u16 v7, v8;
FieldSystem *fieldSystem = param0->fieldSystem;
StringTemplate **v10 = FieldSystem_GetScriptMemberPtr(fieldSystem, SCRIPT_MANAGER_STR_TEMPLATE);
u8 v11 = ScriptContext_ReadByte(param0);
u8 v12 = ScriptContext_ReadByte(param0);
u8 v13 = ScriptContext_ReadByte(param0);
u8 v14 = ScriptContext_ReadByte(param0);
u16 *v15 = ScriptContext_GetVarPointer(param0);
u16 *v16 = ScriptContext_GetVarPointer(param0);
v4 = 0;
v0 = 1;
v1 = 2;
if (SaveData_MiscSaveBlock_InitFlag(fieldSystem->saveData) == 0) {
*v16 = 0;
return 0;
}
v2 = sub_020308A0(fieldSystem->saveData, HEAP_ID_FIELD3, &v0);
if (v0 != 1) {
v4 = 0;
} else {
for (v5 = 0; v5 < NATIONAL_DEX_COUNT; v5++) {
v4 += sub_020308BC(fieldSystem->saveData, v2, 0, v5);
;
}
}
;
if (v2 != NULL) {
Heap_Free(v2);
}
StringTemplate_SetNumber(*v10, v11, v4, GetNumberDigitCount(v4), 1, 1);
v7 = 0;
v6 = 0;
v8 = *v15;
for (v5 = (*v15); v5 < (NELEMS(Unk_020EC078)); v5++) {
if (Unk_020EC078[v5].unk_00 <= v4) {
v7 += Unk_020EC078[v5].unk_04;
*v15 += 1;
v6 = v5;
}
}
GameRecords_AddToRecordValue(SaveData_GetGameRecords(param0->fieldSystem->saveData), RECORD_UNK_068, v7);
if (v7 != 0) {
BattlePoints_ApplyFuncAndGet(
sub_0202D750(param0->fieldSystem->saveData), v7, BATTLE_POINTS_FUNC_ADD);
}
if (v4 == 0) {
*v16 = 0;
} else {
if (v8 != (*v15)) {
*v16 = 1;
} else {
*v16 = 2;
}
if (v8 >= (NELEMS(Unk_020EC078))) {
*v16 = 3;
return 0;
}
}
StringTemplate_SetNumber(*v10, v12, Unk_020EC078[v6].unk_00, GetNumberDigitCount(Unk_020EC078[v6].unk_00), 1, 1);
StringTemplate_SetNumber(*v10, v13, Unk_020EC078[*v15].unk_00, GetNumberDigitCount(Unk_020EC078[*v15].unk_00), 1, 1);
StringTemplate_SetNumber(*v10, v14, v7, GetNumberDigitCount(v7), 1, 1);
return 0;
}
BOOL ScrCmd_325(ScriptContext *param0);
BOOL ScrCmd_325(ScriptContext *param0)
{
int v0;
BattleFrontierStage *v1;
u32 v2, v3, v4;
FieldSystem *fieldSystem = param0->fieldSystem;
u16 *v6 = ScriptContext_GetVarPointer(param0);
v4 = 0;
v0 = 1;
if (SaveData_MiscSaveBlock_InitFlag(fieldSystem->saveData) == 0) {
*v6 = 0;
return 0;
}
v1 = sub_020308A0(fieldSystem->saveData, HEAP_ID_FIELD3, &v0);
if (v0 != 1) {
v4 = 0;
} else {
for (v3 = 0; v3 < NATIONAL_DEX_COUNT; v3++) {
v2 = 0;
v2 += sub_020308BC(fieldSystem->saveData, v1, 0, v3);
v2 += sub_020308BC(fieldSystem->saveData, v1, 1, v3);
v2 += sub_020308BC(fieldSystem->saveData, v1, 2, v3);
if (v2 > 0) {
v4++;
}
}
}
;
if (v1 != NULL) {
Heap_Free(v1);
}
*v6 = v4;
return 0;
}
BOOL ScrCmd_326(ScriptContext *param0);
BOOL ScrCmd_326(ScriptContext *param0)
{
int v0;
int v1;
BattleFrontierStage *v2;
BattleFrontier *frontier;
u32 v4, v5;
FieldSystem *fieldSystem = param0->fieldSystem;
u16 *v7 = ScriptContext_GetVarPointer(param0);
v4 = 0;
v0 = 1;
v1 = 2;
if (SaveData_MiscSaveBlock_InitFlag(fieldSystem->saveData) == 0) {
*v7 = 0;
return 0;
}
v2 = sub_020308A0(fieldSystem->saveData, HEAP_ID_FIELD3, &v0);
if (v0 != 1) {
v4 = 0;
} else {
for (v5 = 0; v5 < NATIONAL_DEX_COUNT; v5++) {
v4 += sub_020308BC(fieldSystem->saveData, v2, 0, v5);
;
}
}
;
if (v2 != NULL) {
Heap_Free(v2);
}
if (v4 > 10000) {
v4 = 10000;
}
*v7 = v4;
return 0;
}
BOOL ScrCmd_32A(ScriptContext *param0);
BOOL ScrCmd_32A(ScriptContext *param0)
{
u16 v0, v1;
u16 *v2 = ScriptContext_GetVarPointer(param0);
v0 = sub_02030698(SaveData_GetBattleFrontier(param0->fieldSystem->saveData),
sub_0205E55C(0),
0xff);
v1 = sub_02030698(SaveData_GetBattleFrontier(param0->fieldSystem->saveData),
sub_0205E50C(0),
0xff);
*v2 = 0;
if (v1 == 50) {
*v2 = 1;
}
;
;
return 0;
}

View File

@ -1,10 +1,8 @@
#include "unk_0204FA34.h"
#include <nitro.h>
#include <string.h>
#include "struct_decls/struct_0203026C_decl.h"
#include "struct_defs/struct_0204F3D0.h"
#include "communication_system.h"
#include "savedata.h"
@ -12,40 +10,33 @@
#include "unk_0203061C.h"
#include "unk_0205DFC4.h"
void sub_0204FA34(int param0, int param1, void *param2, void *param3);
void sub_0204FA50(SaveData *saveData, UnkStruct_0203026C *param1, u8 param2);
void sub_0204FA34(int param0, int param1, void *param2, void *param3)
void BattleHall_ProcessSelectedSpeciesMsg(int netID, int unused, void *data, void *context)
{
int v0, v1;
UnkStruct_0204F3D0 *v2 = param3;
const UnkStruct_0204F3D0 *v3 = param2;
BattleHallSameSpeciesCheck *myData = context;
const BattleHallSameSpeciesCheck *partnersData = data;
v1 = 0;
v2->unk_01++;
myData->receivedMessages++;
if (CommSys_CurNetId() == param0) {
if (CommSys_CurNetId() == netID) {
return;
}
v2->unk_06 = v3->unk_04;
myData->partnersSpecies = partnersData->species;
return;
}
void sub_0204FA50(SaveData *saveData, UnkStruct_0203026C *param1, u8 param2)
void sub_0204FA50(SaveData *saveData, UnkStruct_0203026C *param1, u8 challengeType)
{
int v0;
u8 v1[4];
u16 v2, v3;
v1[0] = 0;
sub_02030280(param1, 5, param2, 0, v1);
sub_02030280(param1, 5, challengeType, 0, v1);
if (param2 == 3) {
if (challengeType == 3) {
sub_020306E4(SaveData_GetBattleFrontier(saveData), 106, sub_0205E6A8(106), 0);
}
sub_020306E4(SaveData_GetBattleFrontier(saveData), sub_0205E50C(param2), sub_0205E6A8(sub_0205E50C(param2)), 0);
sub_020306E4(SaveData_GetBattleFrontier(saveData), sub_0205E50C(challengeType), sub_0205E6A8(sub_0205E50C(challengeType)), 0);
return;
}

View File

@ -156,7 +156,7 @@ static const CommCmdTable Unk_020F68A4[] = {
{ sub_02099510, CommPacketSizeOf_Nothing, NULL },
{ sub_02099510, sub_02099504, NULL },
{ sub_02099510, sub_02099508, NULL },
{ sub_0204FA34, CommPacketSizeOf_Variable, NULL },
{ BattleHall_ProcessSelectedSpeciesMsg, CommPacketSizeOf_Variable, NULL },
{ sub_0205001C, CommPacketSizeOf_Variable, NULL },
{ sub_02050548, CommPacketSizeOf_Variable, NULL }
};