Skip to content

Commit

Permalink
Merge pull request #262 from ravepossum/script_commands_again
Browse files Browse the repository at this point in the history
Yup, Still More Script Commands
  • Loading branch information
lhearachel authored Aug 28, 2024
2 parents 8de20c1 + 8be77c1 commit 1422848
Show file tree
Hide file tree
Showing 162 changed files with 723 additions and 704 deletions.
101 changes: 54 additions & 47 deletions asm/macros/scrcmd.inc
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
.include "macros/movement.inc"
.include "consts/badges.inc"
.include "consts/game_records.inc"
.include "consts/items.inc"
.include "consts/map.inc"
.include "consts/moves.inc"
.include "consts/poketch.inc"
.include "consts/scrcmd.inc"
.include "consts/sdat.inc"
Expand Down Expand Up @@ -267,6 +270,8 @@
.short 48
.endm

// This also sets the player's direction appropriately when a pad
// button is pressed, unlike the WaitABPadPress command.
.macro WaitABXPadPress
.short 49
.endm
Expand Down Expand Up @@ -1153,16 +1158,16 @@
.short \pocket
.endm

.macro ScrCmd_0D3 arg0, arg1
.macro BufferTMHMMoveName templateArg, item
.short 211
.byte \arg0
.short \arg1
.byte \templateArg
.short \item
.endm

.macro ScrCmd_0D4 arg0, arg1
.macro BufferMoveName templateArg, move
.short 212
.byte \arg0
.short \arg1
.byte \templateArg
.short \move
.endm

.macro BufferNumber templateArg, number
Expand Down Expand Up @@ -1222,22 +1227,22 @@
.short \arg0
.endm

.macro ScrCmd_0DF arg0, arg1
.macro BufferUndergroundGoodsName templateArg, goods
.short 223
.byte \arg0
.short \arg1
.byte \templateArg
.short \goods
.endm

.macro ScrCmd_0E0 arg0, arg1
.macro BufferUndergroundTrapName templateArg, trap
.short 224
.byte \arg0
.short \arg1
.byte \templateArg
.short \trap
.endm

.macro ScrCmd_0E1 arg0, arg1
.macro BufferUndergroundItemName templateArg, item
.short 225
.byte \arg0
.short \arg1
.byte \templateArg
.short \item
.endm

.macro ScrCmd_0E2 arg0, arg1
Expand Down Expand Up @@ -1297,14 +1302,14 @@
.short 235
.endm

.macro ScrCmd_0EC arg0
.macro CheckWonBattle destVarID
.short 236
.short \arg0
.short \destVarID
.endm

.macro ScrCmd_0ED arg0
.macro CheckLostBattle destVarID
.short 237
.short \arg0
.short \destVarID
.endm

.macro ScrCmd_0EE arg0
Expand Down Expand Up @@ -1528,9 +1533,9 @@
.short 280
.endm

.macro ScrCmd_119 arg0
.macro CheckPartyPokerus destVarID
.short 281
.short \arg0
.short \destVarID
.endm

.macro ScrCmd_11A arg0, arg1
Expand Down Expand Up @@ -1663,9 +1668,9 @@
.short \arg0
.endm

.macro ScrCmd_133 arg0
.macro RegisterPoketchApp appID
.short 307
.short \arg0
.short \appID
.endm

.macro ScrCmd_134 arg0, arg1
Expand Down Expand Up @@ -1790,12 +1795,12 @@
.short \arg0
.endm

.macro ScrCmd_14D arg0
.macro GetPlayerGender destVarID
.short 333
.short \arg0
.short \destVarID
.endm

.macro ScrCmd_14E
.macro HealParty
.short 334
.endm

Expand Down Expand Up @@ -1853,10 +1858,10 @@
.short 346
.endm

.macro ScrCmd_15B arg0, arg1
.macro CheckBadge badgeID, destVarID
.short 347
.short \arg0
.short \arg1
.short \badgeID
.short \destVarID
.endm

.macro ScrCmd_15C arg0
Expand Down Expand Up @@ -1985,9 +1990,9 @@
.byte \arg0
.endm

.macro ScrCmd_177 arg0
.macro GetPartyCount destVarID
.short 375
.short \arg0
.short \destVarID
.endm

.macro ScrCmd_178 arg0
Expand Down Expand Up @@ -2178,15 +2183,17 @@
.short \arg1
.endm

.macro ScrCmd_19A arg0
.macro GetPartyCountHatched destVarID
.short 410
.short \arg0
.short \destVarID
.endm

.macro ScrCmd_19B arg0, arg1
// Counts alive mons in the party and stores the result in the destVar,
// but excludes the one at the party slot provided.
.macro CountAliveMonsExcept destVarID, partySlot
.short 411
.short \arg0
.short \arg1
.short \destVarID
.short \partySlot
.endm

.macro ScrCmd_19C arg0
Expand Down Expand Up @@ -2274,9 +2281,9 @@
.short 428
.endm

.macro ScrCmd_1AD arg0
.macro Dummy1AD dummy
.short 429
.short \arg0
.short \dummy
.endm

.macro ScrCmd_1AE arg0, arg1
Expand Down Expand Up @@ -2601,9 +2608,9 @@
.short \arg0
.endm

.macro ScrCmd_1E5 arg0
.macro IncrementGameRecord recordID
.short 485
.short \arg0
.short \recordID
.endm

.macro ScrCmd_1E6 arg0, arg1, arg2
Expand Down Expand Up @@ -2696,18 +2703,18 @@
.short \arg1
.endm

.macro ScrCmd_1F7 arg0, arg1
.macro SurvivePoison destVarID, partySlot
.short 503
.short \arg0
.short \arg1
.short \destVarID
.short \partySlot
.endm

.macro ScrCmd_1F8
.short 504
.endm

/* this is a dummy function that doesn't do anything */
.macro Dummy1 dummy
// this is a dummy function that doesn't do anything
.macro Dummy1F9 dummy
.short 505
.short \dummy
.endm
Expand Down Expand Up @@ -3786,9 +3793,9 @@
.short 699
.endm

.macro ScrCmd_2BC arg0
.macro CheckDidNotCapture destVarID
.short 700
.short \arg0
.short \destVarID
.endm

.macro ScrCmd_2BD arg0, arg1
Expand Down
32 changes: 32 additions & 0 deletions consts/badges.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
{
"definitions": {
"@BadgeID": {
"type": "enum",
"values": [
"BADGE_ID_COAL",
"BADGE_ID_FOREST",
"BADGE_ID_COBBLE",
"BADGE_ID_FEN",
"BADGE_ID_RELIC",
"BADGE_ID_MINE",
"BADGE_ID_ICICLE",
"BADGE_ID_BEACON",
"MAX_BADGES"
]
},
"@BadgeLeaderID": {
"type": "aliases",
"as_preproc": true,
"values": {
"BADGE_ID_ROARK": "BADGE_ID_COAL",
"BADGE_ID_GARDENIA": "BADGE_ID_FOREST",
"BADGE_ID_MAYLENE": "BADGE_ID_COBBLE",
"BADGE_ID_CRASHER_WAKE": "BADGE_ID_FEN",
"BADGE_ID_FANTINA": "BADGE_ID_RELIC",
"BADGE_ID_BYRON": "BADGE_ID_MINE",
"BADGE_ID_CANDICE": "BADGE_ID_ICICLE",
"BADGE_ID_VOLKNER": "BADGE_ID_BEACON"
}
}
}
}
1 change: 1 addition & 0 deletions consts/meson.build
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
consts_manifest_basenames = [
'abilities',
'badges',
'battle',
'battle_subscripts',
'btlcmd',
Expand Down
4 changes: 2 additions & 2 deletions include/script_manager.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ enum ScriptManagerMember {
SCRIPT_MANAGER_DATA_PTR = 20,

SCRIPT_MANAGER_PLAYER_TASK = 22,
SCRIPT_MANAGER_PLAYER_WON_BATTLE,
SCRIPT_MANAGER_BATTLE_RESULT,
SCRIPT_MANAGER_TRAINER_0_SIGHT_RANGE,
SCRIPT_MANAGER_TRAINER_0_DIRECTION,
SCRIPT_MANAGER_TRAINER_0_SCRIPT_ID,
Expand Down Expand Up @@ -114,7 +114,7 @@ typedef struct ScriptManager {
u8 isMsgBoxOpen;
u8 numActiveContexts;
u16 scriptID;
BOOL playerWonBattle;
BOOL battleResult;
UnkStruct_ov5_021DC1A4 *unk_10; // appears to be used for multichoice windows
Window window;
UIControlData *ctrlUI;
Expand Down
10 changes: 5 additions & 5 deletions include/unk_020474B8.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ BOOL ScrCmd_BufferPartyMonSpecies(ScriptContext *ctx);
BOOL ScrCmd_2FD(ScriptContext *param0);
BOOL ScrCmd_BufferItemName(ScriptContext *ctx);
BOOL ScrCmd_BufferPocketName(ScriptContext *ctx);
BOOL ScrCmd_0D3(ScriptContext *param0);
BOOL ScrCmd_0D4(ScriptContext *param0);
BOOL ScrCmd_BufferTMHMMoveName(ScriptContext *ctx);
BOOL ScrCmd_BufferMoveName(ScriptContext *ctx);
BOOL ScrCmd_BufferNumber(ScriptContext *ctx);
BOOL ScrCmd_280(ScriptContext *param0);
BOOL ScrCmd_2F5(ScriptContext *param0);
Expand All @@ -25,9 +25,9 @@ BOOL ScrCmd_0DA(ScriptContext *param0);
BOOL ScrCmd_0DB(ScriptContext *param0);
BOOL ScrCmd_0DC(ScriptContext *param0);
BOOL ScrCmd_0DD(ScriptContext *param0);
BOOL ScrCmd_0DF(ScriptContext *param0);
BOOL ScrCmd_0E0(ScriptContext *param0);
BOOL ScrCmd_0E1(ScriptContext *param0);
BOOL ScrCmd_BufferUndergroundGoodsName(ScriptContext *ctx);
BOOL ScrCmd_BufferUndergroundTrapName(ScriptContext *ctx);
BOOL ScrCmd_BufferUndergroundItemName(ScriptContext *ctx);
BOOL ScrCmd_0E2(ScriptContext *param0);
BOOL ScrCmd_17B(ScriptContext *param0);
BOOL ScrCmd_17C(ScriptContext *param0);
Expand Down
6 changes: 3 additions & 3 deletions include/unk_02048614.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@ BOOL ScrCmd_0E8(ScriptContext *param0);
BOOL ScrCmd_0E9(ScriptContext *param0);
BOOL ScrCmd_0EA(ScriptContext *param0);
BOOL ScrCmd_0EB(ScriptContext *param0);
BOOL ScrCmd_0EC(ScriptContext *param0);
BOOL ScrCmd_0ED(ScriptContext *param0);
BOOL ScrCmd_2BC(ScriptContext *param0);
BOOL ScrCmd_CheckWonBattle(ScriptContext *ctx);
BOOL ScrCmd_CheckLostBattle(ScriptContext *ctx);
BOOL ScrCmd_CheckDidNotCapture(ScriptContext *ctx);
BOOL ScrCmd_0EE(ScriptContext *param0);
BOOL ScrCmd_0EF(ScriptContext *param0);
BOOL ScrCmd_0F0(ScriptContext *param0);
Expand Down
2 changes: 1 addition & 1 deletion include/unk_0204CA84.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,6 @@ BOOL ScrCmd_1BF(ScriptContext *param0);
BOOL ScrCmd_1A5(ScriptContext *param0);
BOOL ScrCmd_1A6(ScriptContext *param0);
BOOL ScrCmd_1A7(ScriptContext *param0);
BOOL ScrCmd_1AD(ScriptContext *param0);
BOOL ScrCmd_Dummy1AD(ScriptContext *ctx);

#endif // POKEPLATINUM_UNK_0204CA84_H
10 changes: 5 additions & 5 deletions include/unk_0204CFFC.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ BOOL ScrCmd_097(ScriptContext *param0);
BOOL ScrCmd_098(ScriptContext *param0);
BOOL ScrCmd_099(ScriptContext *param0);
BOOL ScrCmd_09A(ScriptContext *param0);
BOOL ScrCmd_1F7(ScriptContext *param0);
BOOL ScrCmd_SurvivePoison(ScriptContext *ctx);
BOOL ScrCmd_1F6(ScriptContext *param0);
BOOL ScrCmd_278(ScriptContext *param0);
BOOL ScrCmd_212(ScriptContext *param0);
Expand All @@ -21,12 +21,12 @@ BOOL ScrCmd_1BB(ScriptContext *param0);
BOOL ScrCmd_281(ScriptContext *param0);
BOOL ScrCmd_247(ScriptContext *param0);
BOOL ScrCmd_248(ScriptContext *param0);
BOOL ScrCmd_177(ScriptContext *param0);
BOOL ScrCmd_19A(ScriptContext *param0);
BOOL ScrCmd_19B(ScriptContext *param0);
BOOL ScrCmd_GetPartyCount(ScriptContext *ctx);
BOOL ScrCmd_GetPartyCountHatched(ScriptContext *ctx);
BOOL ScrCmd_CountAliveMonsExcept(ScriptContext *ctx);
BOOL ScrCmd_19C(ScriptContext *param0);
BOOL ScrCmd_19D(ScriptContext *param0);
BOOL ScrCmd_119(ScriptContext *param0);
BOOL ScrCmd_CheckPartyPokerus(ScriptContext *ctx);
BOOL ScrCmd_11A(ScriptContext *param0);
BOOL ScrCmd_1C8(ScriptContext *param0);
BOOL ScrCmd_1C9(ScriptContext *param0);
Expand Down
2 changes: 1 addition & 1 deletion include/unk_0204E3CC.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ BOOL ScrCmd_157(ScriptContext *param0);
BOOL ScrCmd_158(ScriptContext *param0);
BOOL ScrCmd_159(ScriptContext *param0);
BOOL ScrCmd_15A(ScriptContext *param0);
BOOL ScrCmd_15B(ScriptContext *param0);
BOOL ScrCmd_CheckBadge(ScriptContext *ctx);
BOOL ScrCmd_15C(ScriptContext *param0);
BOOL ScrCmd_15E(ScriptContext *param0);
BOOL ScrCmd_15D(ScriptContext *param0);
Expand Down
6 changes: 3 additions & 3 deletions include/unk_02051D8C.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@ void sub_020526CC(BattleParams *param0, const FieldSystem *fieldSystem, const u8
void sub_020526E8(const BattleParams *param0, FieldSystem *fieldSystem);
void sub_02052754(const BattleParams *param0, FieldSystem *fieldSystem);
void sub_0205285C(BattleParams *param0);
BOOL sub_02052868(u32 param0);
BOOL sub_02052878(u32 param0);
BOOL sub_02052888(u32 param0);
BOOL BattleParams_PlayerWon(u32 battleResult);
BOOL BattleParams_PlayerLost(u32 battleResult);
BOOL BattleParams_PlayerDidNotCapture(u32 battleResult);

#endif // POKEPLATINUM_UNK_02051D8C_H
2 changes: 1 addition & 1 deletion include/unk_02054884.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,6 @@ Pokemon *Party_FindFirstHatchedMon(const Party *party);
BOOL Party_HasTwoAliveMons(const Party *party);
void Party_GiveChampionRibbons(Party *party);
int sub_02054B04(Party *param0, u16 param1);
BOOL sub_02054B94(Pokemon *param0);
BOOL Pokemon_TrySurvivePoison(Pokemon *mon);

#endif // POKEPLATINUM_UNK_02054884_H
Loading

0 comments on commit 1422848

Please sign in to comment.