Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 18 additions & 18 deletions asm/macros/scrcmd.inc
Original file line number Diff line number Diff line change
Expand Up @@ -4301,30 +4301,30 @@
.short \challengeType
.endm

.macro ScrCmd_2D2 arg0, arg1, arg2
.short SCRCMD_2D2
.short \arg0
.short \arg1
.short \arg2
.macro CallBattleCastleLobbyFunction action, arg, result
.short SCRCMD_CALLBATTLECASTLELOBBYFUNCTION
.short \action
.short \arg
.short \result
.endm

.macro ScrCmd_2D3 arg0, arg1, arg2
.short SCRCMD_2D3
.short \arg0
.short \arg1
.short \arg2
.macro CheckBattleCastlePartnerUsesDifferentSpecies species1, species2, result
.short SCRCMD_CHECKBATTLECASTLEPARTNERUSESDIFFERENTSPECIES
.short \species1
.short \species2
.short \result
.endm

.macro ScrCmd_2D4 arg0, arg1, arg2
.short SCRCMD_2D4
.short \arg0
.short \arg1
.short \arg2
.macro GetBattleCastleSelectedSlots selectedSlot1, selectedSlot2, selectedSlot3
.short SCRCMD_GETBATTLECASTLESELECTEDSLOTS
.short \selectedSlot1
.short \selectedSlot2
.short \selectedSlot3
.endm

.macro ScrCmd_2D5 arg0
.short SCRCMD_2D5
.short \arg0
.macro DeleteActiveBattleCastleStreak challengeType
.short SCRCMD_DELETEACTIVEBATTLECASTLESTREAK
.short \challengeType
.endm

.macro SaveExtraData
Expand Down
8 changes: 8 additions & 0 deletions include/constants/battle_castle_functions.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,14 @@
#ifndef POKEPLATINUM_CONSTANTS_BATTLE_CASTLE_FUNCTIONS_H
#define POKEPLATINUM_CONSTANTS_BATTLE_CASTLE_FUNCTIONS_H

enum BattleCastleLobbyFunction {
BC_LOBBY_FUNC_CHECK_PARTY_ELIGIBLE = 0,
BC_LOBBY_FUNC_CHECK_STREAK_ACTIVE,
BC_LOBBY_FUNC_UNUSED,
BC_LOBBY_FUNC_DELETE_ACTIVE_STREAK,
BC_LOBBY_FUNC_SELECT_POKEMON,
};

enum BattleCastleFunction {
BC_FUNC_UNK_0 = 0,
BC_FUNC_UNK_1,
Expand Down
8 changes: 4 additions & 4 deletions include/data/scripts/scrcmd.h
Original file line number Diff line number Diff line change
Expand Up @@ -727,10 +727,10 @@ ScriptCommand(SCRCMD_UNUSED_2CE, ScrCm
ScriptCommand(SCRCMD_CHECKBATTLEHALLPARTNERUSESDIFFERENTSPECIES, ScrCmd_CheckBattleHallPartnerUsesDifferentSpecies)
ScriptCommand(SCRCMD_GETBATTLEHALLSELECTEDSLOTS, ScrCmd_GetBattleHallSelectedSlots)
ScriptCommand(SCRCMD_DELETEACTIVEBATTLEHALLSTREAK, ScrCmd_DeleteActiveBattleHallStreak)
ScriptCommand(SCRCMD_2D2, ScrCmd_2D2)
ScriptCommand(SCRCMD_2D3, ScrCmd_2D3)
ScriptCommand(SCRCMD_2D4, ScrCmd_2D4)
ScriptCommand(SCRCMD_2D5, ScrCmd_2D5)
ScriptCommand(SCRCMD_CALLBATTLECASTLELOBBYFUNCTION, ScrCmd_CallBattleCastleLobbyFunction)
ScriptCommand(SCRCMD_CHECKBATTLECASTLEPARTNERUSESDIFFERENTSPECIES, ScrCmd_CheckBattleCastlePartnerUsesDifferentSpecies)
ScriptCommand(SCRCMD_GETBATTLECASTLESELECTEDSLOTS, ScrCmd_GetBattleCastleSelectedSlots)
ScriptCommand(SCRCMD_DELETEACTIVEBATTLECASTLESTREAK, ScrCmd_DeleteActiveBattleCastleStreak)
ScriptCommand(SCRCMD_SAVEEXTRADATA, ScrCmd_SaveExtraData)
ScriptCommand(SCRCMD_CHECKISMISCSAVEINIT, ScrCmd_CheckIsMiscSaveInit)
ScriptCommand(SCRCMD_POKEMARTFRONTIER, ScrCmd_PokeMartFrontier)
Expand Down
11 changes: 11 additions & 0 deletions include/scrcmd_battle_castle.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#ifndef POKEPLATINUM_SCRCMD_BATTLE_CASTLE_H
#define POKEPLATINUM_SCRCMD_BATTLE_CASTLE_H

#include "field_script_context.h"

BOOL ScrCmd_CallBattleCastleLobbyFunction(ScriptContext *ctx);
BOOL ScrCmd_DeleteActiveBattleCastleStreak(ScriptContext *ctx);
BOOL ScrCmd_CheckBattleCastlePartnerUsesDifferentSpecies(ScriptContext *ctx);
void BattleCastle_ProcessSpeciesCheckMsg(int netID, int unused, void *data, void *context);

#endif // POKEPLATINUM_SCRCMD_BATTLE_CASTLE_H
13 changes: 0 additions & 13 deletions include/struct_defs/struct_0204FCF8.h

This file was deleted.

10 changes: 0 additions & 10 deletions include/unk_0204FAB4.h

This file was deleted.

6 changes: 0 additions & 6 deletions include/unk_0205001C.h

This file was deleted.

3 changes: 1 addition & 2 deletions platinum.us/main.lsf
Original file line number Diff line number Diff line change
Expand Up @@ -212,8 +212,7 @@ Static main
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_scrcmd_battle_hall.c.o
Object main.nef.p/src_unk_0204FAB4.c.o
Object main.nef.p/src_unk_0205001C.c.o
Object main.nef.p/src_scrcmd_battle_castle.c.o
Object main.nef.p/src_unk_0205003C.c.o
Object main.nef.p/src_unk_02050548.c.o
Object main.nef.p/src_binoculars_vista_lighthouse.c.o
Expand Down
15 changes: 8 additions & 7 deletions res/field/scripts/scripts_battle_castle.s
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
#include "res/text/bank/battle_castle.h"
#include "res/text/bank/menu_entries.h"
#include "constants/battle_frontier.h"
#include "constants/battle_castle_functions.h"


ScriptEntry BattleCastle_SingleAttendant
Expand Down Expand Up @@ -88,7 +89,7 @@ BattleCastle_HopeToSeeYouAgain:

BattleCastle_TryTakeSingleChallenge:
SetVar VAR_BATTLE_CASTLE_CHALLENGE_TYPE, FRONTIER_CHALLENGE_SINGLE
ScrCmd_2D2 0, 3, VAR_RESULT
CallBattleCastleLobbyFunction BC_LOBBY_FUNC_CHECK_PARTY_ELIGIBLE, 3, VAR_RESULT
BufferNumber 0, 3
BufferNumber 1, 3
GoToIfEq VAR_RESULT, 0, BattleCastle_NotEnoughEligiblePokemonSingleDouble
Expand All @@ -97,7 +98,7 @@ BattleCastle_TryTakeSingleChallenge:

BattleCastle_TryTakeDoubleChallenge:
SetVar VAR_BATTLE_CASTLE_CHALLENGE_TYPE, FRONTIER_CHALLENGE_DOUBLE
ScrCmd_2D2 0, 3, VAR_RESULT
CallBattleCastleLobbyFunction BC_LOBBY_FUNC_CHECK_PARTY_ELIGIBLE, 3, VAR_RESULT
BufferNumber 0, 3
BufferNumber 1, 3
GoToIfEq VAR_RESULT, 0, BattleCastle_NotEnoughEligiblePokemonSingleDouble
Expand All @@ -106,7 +107,7 @@ BattleCastle_TryTakeDoubleChallenge:

BattleCastle_TryTakeMultiChallenge:
SetVar VAR_BATTLE_CASTLE_CHALLENGE_TYPE, FRONTIER_CHALLENGE_MULTI
ScrCmd_2D2 0, 2, VAR_RESULT
CallBattleCastleLobbyFunction BC_LOBBY_FUNC_CHECK_PARTY_ELIGIBLE, 2, VAR_RESULT
BufferNumber 0, 2
BufferNumber 1, 2
GoToIfEq VAR_RESULT, 0, BattleCastle_NotEnoughEligiblePokemonMulti
Expand All @@ -130,8 +131,8 @@ BattleCastle_SelectPokemon:
CloseMessage
FadeScreenOut
WaitFadeScreen
ScrCmd_2D2 4, VAR_BATTLE_CASTLE_CHALLENGE_TYPE, VAR_RESULT
ScrCmd_2D4 VAR_MAP_LOCAL_0x02, VAR_MAP_LOCAL_0x05, VAR_MAP_LOCAL_0x06
CallBattleCastleLobbyFunction BC_LOBBY_FUNC_SELECT_POKEMON, VAR_BATTLE_CASTLE_CHALLENGE_TYPE, VAR_RESULT
GetBattleCastleSelectedSlots VAR_MAP_LOCAL_0x02, VAR_MAP_LOCAL_0x05, VAR_MAP_LOCAL_0x06
ReturnToField
FadeScreenIn
WaitFadeScreen
Expand Down Expand Up @@ -222,7 +223,7 @@ BattleCastle_StartMultiChallenge:
ScrCmd_135 136
GetPartyMonSpecies VAR_MAP_LOCAL_0x02, VAR_0x8000
GetPartyMonSpecies VAR_MAP_LOCAL_0x05, VAR_0x8001
ScrCmd_2D3 VAR_0x8000, VAR_0x8001, VAR_RESULT
CheckBattleCastlePartnerUsesDifferentSpecies VAR_0x8000, VAR_0x8001, VAR_RESULT
SetVar VAR_0x8008, VAR_RESULT
GoToIfEq VAR_0x8008, 1, BattleCastle_BothTrainerChosePokemon1
GoToIfEq VAR_0x8008, 2, BattleCastle_BothTrainerChosePokemon2
Expand Down Expand Up @@ -459,7 +460,7 @@ BattleCastle_SaveGame:

BattleCastle_OnFrame_DidntSaveBeforeQuit:
Message BattleCastle_Text_DidntSaveBeforeQuit
ScrCmd_2D5 VAR_BATTLE_CASTLE_CHALLENGE_TYPE
DeleteActiveBattleCastleStreak VAR_BATTLE_CASTLE_CHALLENGE_TYPE
GoTo BattleCastle_EndChallenge
End

Expand Down
3 changes: 1 addition & 2 deletions src/meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -200,8 +200,7 @@ pokeplatinum_c = files(
'scrcmd_dummy_23F_242.c',
'unk_0204F04C.c',
'scrcmd_battle_hall.c',
'unk_0204FAB4.c',
'unk_0205001C.c',
'scrcmd_battle_castle.c',
'unk_0205003C.c',
'unk_02050548.c',
'binoculars_vista_lighthouse.c',
Expand Down
44 changes: 22 additions & 22 deletions src/scrcmd.c
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,7 @@
#include "save_player.h"
#include "savedata.h"
#include "scrcmd_amity_square.h"
#include "scrcmd_battle_castle.h"
#include "scrcmd_battle_hall.h"
#include "scrcmd_berry.h"
#include "scrcmd_catching_show.h"
Expand Down Expand Up @@ -199,7 +200,6 @@
#include "unk_020494DC.h"
#include "unk_0204AEE8.h"
#include "unk_0204F04C.h"
#include "unk_0204FAB4.h"
#include "unk_0205003C.h"
#include "unk_020528D0.h"
#include "unk_020559DC.h"
Expand Down Expand Up @@ -526,7 +526,7 @@ static BOOL ScriptContext_DecrementABPressTimer(ScriptContext *ctx);
static BOOL ScrCmd_SelectMoveTutorPokemon(ScriptContext *ctx);
static BOOL ScrCmd_GetSelectedPartySlot(ScriptContext *ctx);
static BOOL ScrCmd_GetBattleHallSelectedSlots(ScriptContext *ctx);
static BOOL ScrCmd_2D4(ScriptContext *ctx);
static BOOL ScrCmd_GetBattleCastleSelectedSlots(ScriptContext *ctx);
static BOOL ScrCmd_2DB(ScriptContext *ctx);
static BOOL ScrCmd_OpenPartyMenuForTrade(ScriptContext *ctx);
static BOOL ScrCmd_SetMonSummary(ScriptContext *ctx);
Expand Down Expand Up @@ -2654,36 +2654,36 @@ static BOOL ScrCmd_GetBattleHallSelectedSlots(ScriptContext *ctx)
return FALSE;
}

static BOOL ScrCmd_2D4(ScriptContext *ctx)
static BOOL ScrCmd_GetBattleCastleSelectedSlots(ScriptContext *ctx)
{
u16 *v3 = ScriptContext_GetVarPointer(ctx);
u16 *v4 = ScriptContext_GetVarPointer(ctx);
u16 *v5 = 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);
u16 *selectedSlot3 = 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 = PARTY_SLOT_NONE;
} else if (v1 == MAX_PARTY_SIZE) {
*v3 = partyMenu->selectionOrder[0];
*v3 -= 1;
if (slot == MAX_PARTY_SIZE + 1) {
*selectedSlot1 = PARTY_SLOT_NONE;
} else if (slot == MAX_PARTY_SIZE) {
*selectedSlot1 = partyMenu->selectionOrder[0];
*selectedSlot1 -= 1;

*v4 = partyMenu->selectionOrder[1];
*v4 -= 1;
*selectedSlot2 = partyMenu->selectionOrder[1];
*selectedSlot2 -= 1;

*v5 = partyMenu->selectionOrder[2];
*selectedSlot3 = partyMenu->selectionOrder[2];

if (*v5 > 0) {
*v5 -= 1;
if (*selectedSlot3 > 0) {
*selectedSlot3 -= 1;
}
}

Heap_Free(*v2);
*v2 = NULL;
Heap_Free(*partySelect);
*partySelect = NULL;

return FALSE;
}
Expand Down
Loading