From 24bd8c73e17fa8795808a1b53745854026b8c3a0 Mon Sep 17 00:00:00 2001 From: Diegoisawesome Date: Thu, 12 Oct 2017 22:34:58 -0500 Subject: [PATCH] Name some new script commands --- data/event_script_command_function_table.inc | 44 +++++++-------- include/data2.h | 10 ++++ src/scrcmd.c | 57 ++++++++++---------- 3 files changed, 61 insertions(+), 50 deletions(-) diff --git a/data/event_script_command_function_table.inc b/data/event_script_command_function_table.inc index 675da0ea7a..7cd00c37d7 100644 --- a/data/event_script_command_function_table.inc +++ b/data/event_script_command_function_table.inc @@ -114,9 +114,9 @@ gScriptCmdTable:: @ 81DB67C .4byte ScrCmd_multichoice .4byte ScrCmd_multichoicedefault .4byte ScrCmd_multichoicegrid - .4byte ScrCmd_cmd72 - .4byte ScrCmd_cmd73 - .4byte ScrCmd_cmd74 + .4byte ScrCmd_drawbox + .4byte ScrCmd_erasebox + .4byte ScrCmd_drawboxtext .4byte ScrCmd_drawpokepic .4byte ScrCmd_erasepokepic .4byte ScrCmd_drawcontestwinner @@ -177,8 +177,8 @@ gScriptCmdTable:: @ 81DB67C .4byte ScrCmd_waitdooranim .4byte ScrCmd_setdooropen .4byte ScrCmd_setdoorclosed - .4byte ScrCmd_cmdB1 - .4byte ScrCmd_cmdB2 + .4byte ScrCmd_addelevmenuitem + .4byte ScrCmd_showelevmenu .4byte ScrCmd_checkcoins .4byte ScrCmd_givecoins .4byte ScrCmd_takecoins @@ -198,32 +198,32 @@ gScriptCmdTable:: @ 81DB67C .4byte ScrCmd_incrementgamestat .4byte ScrCmd_setescapewarp .4byte ScrCmd_waitpokecry - .4byte ScrCmd_cmdC6 + .4byte ScrCmd_getboxname .4byte ScrCmd_nop1 .4byte ScrCmd_nop1 .4byte ScrCmd_nop1 .4byte ScrCmd_nop1 .4byte ScrCmd_nop1 .4byte ScrCmd_nop1 - .4byte ScrCmd_cmdCD - .4byte ScrCmd_cmdCE + .4byte ScrCmd_setpokeobedient + .4byte ScrCmd_checkpokeobedience .4byte ScrCmd_cmdCF .4byte ScrCmd_nop1 - .4byte ScrCmd_cmdD1 - .4byte ScrCmd_cmdD2 - .4byte ScrCmd_cmdD3 - .4byte ScrCmd_cmdD4 - .4byte ScrCmd_cmdD5 - .4byte ScrCmd_cmdD6 - .4byte ScrCmd_cmdD7 + .4byte ScrCmd_warpD1 + .4byte ScrCmd_setpokemetlocation + .4byte ScrCmd_mossdeepgym1 + .4byte ScrCmd_mossdeepgym2 + .4byte ScrCmd_mossdeepgym3 + .4byte ScrCmd_mossdeepgym4 + .4byte ScrCmd_warpD7 .4byte ScrCmd_cmdD8 .4byte ScrCmd_cmdD9 .4byte ScrCmd_cmdDA .4byte ScrCmd_cmdDB - .4byte ScrCmd_cmdDC - .4byte ScrCmd_cmdDD - .4byte ScrCmd_cmdDE - .4byte ScrCmd_cmdDF - .4byte ScrCmd_cmdE0 - .4byte ScrCmd_cmdE1 - .4byte ScrCmd_cmdE2 + .4byte ScrCmd_fadescreenswapbuffers + .4byte ScrCmd_gettrainerclass + .4byte ScrCmd_gettrainername + .4byte ScrCmd_pokenavcall + .4byte ScrCmd_warpE0 + .4byte ScrCmd_getcontesttype + .4byte ScrCmd_getitemnameplural diff --git a/include/data2.h b/include/data2.h index ccb9b4b7e2..db9532811a 100644 --- a/include/data2.h +++ b/include/data2.h @@ -1,6 +1,16 @@ #ifndef GUARD_DATA2_H #define GUARD_DATA2_H +struct MonCoords +{ + // This would use a bitfield, but some function + // uses it as a u8 and casting won't match. + u8 coords; // u8 x:4, y:4; + u8 y_offset; +}; + +extern struct MonCoords gTrainerBackPicCoords[]; + extern const u8 gSpeciesNames[][POKEMON_NAME_LENGTH + 1]; extern const u8 gMoveNames[][13]; extern const u8 gAbilityNames[][13]; diff --git a/src/scrcmd.c b/src/scrcmd.c index 1bc7d709ab..f6039142cf 100644 --- a/src/scrcmd.c +++ b/src/scrcmd.c @@ -643,29 +643,29 @@ bool8 ScrCmd_fadescreen(struct ScriptContext *ctx) bool8 ScrCmd_fadescreendelay(struct ScriptContext *ctx) { - u8 duration = ScriptReadByte(ctx); + u8 mode = ScriptReadByte(ctx); u8 delay = ScriptReadByte(ctx); - fade_screen(duration, delay); + fade_screen(mode, delay); SetupNativeScript(ctx, IsPaletteNotActive); return TRUE; } -int ScrCmd_cmdDC(struct ScriptContext *ctx) +bool8 ScrCmd_fadescreenswapbuffers(struct ScriptContext *ctx) { - u8 duration = ScriptReadByte(ctx); + u8 mode = ScriptReadByte(ctx); - switch (duration) + switch (mode) { case 1: default: CpuCopy32(gPlttBufferUnfaded, gPaletteDecompressionBuffer, PLTT_DECOMP_BUFFER_SIZE); - fade_screen(duration, 0); + fade_screen(mode, 0); break; case 0: case 2: CpuCopy32(gPaletteDecompressionBuffer, gPlttBufferUnfaded, PLTT_DECOMP_BUFFER_SIZE); - fade_screen(duration, 0); + fade_screen(mode, 0); break; } @@ -821,7 +821,7 @@ bool8 ScrCmd_warpteleport(struct ScriptContext *ctx) return TRUE; } -bool8 ScrCmd_cmdD7(struct ScriptContext *ctx) +bool8 ScrCmd_warpD7(struct ScriptContext *ctx) { u8 mapGroup = ScriptReadByte(ctx); u8 mapNum = ScriptReadByte(ctx); @@ -1282,7 +1282,7 @@ bool8 ScrCmd_message(struct ScriptContext *ctx) return FALSE; } -bool8 ScrCmd_cmdDF(struct ScriptContext *ctx) +bool8 ScrCmd_pokenavcall(struct ScriptContext *ctx) { const u8 *msg = (const u8 *)ScriptReadWord(ctx); @@ -1396,7 +1396,7 @@ bool8 ScrCmd_multichoicedefault(struct ScriptContext *ctx) } } -bool8 ScrCmd_cmd72(struct ScriptContext *ctx) +bool8 ScrCmd_drawbox(struct ScriptContext *ctx) { /*u8 left = ScriptReadByte(ctx); u8 top = ScriptReadByte(ctx); @@ -1426,7 +1426,7 @@ bool8 ScrCmd_multichoicegrid(struct ScriptContext *ctx) } } -bool8 ScrCmd_cmd73(struct ScriptContext *ctx) +bool8 ScrCmd_erasebox(struct ScriptContext *ctx) { u8 left = ScriptReadByte(ctx); u8 top = ScriptReadByte(ctx); @@ -1437,7 +1437,7 @@ bool8 ScrCmd_cmd73(struct ScriptContext *ctx) return FALSE; } -bool8 ScrCmd_cmd74(struct ScriptContext *ctx) +bool8 ScrCmd_drawboxtext(struct ScriptContext *ctx) { u8 left = ScriptReadByte(ctx); u8 top = ScriptReadByte(ctx); @@ -1721,7 +1721,7 @@ bool8 ScrCmd_getitemname(struct ScriptContext *ctx) return FALSE; } -bool8 ScrCmd_cmdE2(struct ScriptContext *ctx) +bool8 ScrCmd_getitemnameplural(struct ScriptContext *ctx) { u8 stringVarIndex = ScriptReadByte(ctx); u16 itemId = VarGet(ScriptReadHalfword(ctx)); @@ -1768,7 +1768,7 @@ bool8 ScrCmd_getstdstring(struct ScriptContext *ctx) return FALSE; } -bool8 ScrCmd_cmdE1(struct ScriptContext *ctx) +bool8 ScrCmd_getcontesttype(struct ScriptContext *ctx) { u8 stringVarIndex = ScriptReadByte(ctx); u16 index = VarGet(ScriptReadHalfword(ctx)); @@ -1805,7 +1805,7 @@ bool8 ScrCmd_vgetstring(struct ScriptContext *ctx) return FALSE; } -bool8 ScrCmd_cmdC6(struct ScriptContext *ctx) +bool8 ScrCmd_getboxname(struct ScriptContext *ctx) { u8 stringVarIndex = ScriptReadByte(ctx); u16 boxId = VarGet(ScriptReadHalfword(ctx)); @@ -2242,7 +2242,7 @@ bool8 ScrCmd_setdoorclosed(struct ScriptContext *ctx) return FALSE; } -bool8 ScrCmd_cmdB1(struct ScriptContext *ctx) +bool8 ScrCmd_addelevmenuitem(struct ScriptContext *ctx) { u8 v3 = ScriptReadByte(ctx); u16 v5 = VarGet(ScriptReadHalfword(ctx)); @@ -2253,7 +2253,7 @@ bool8 ScrCmd_cmdB1(struct ScriptContext *ctx) return FALSE; } -bool8 ScrCmd_cmdB2(struct ScriptContext *ctx) +bool8 ScrCmd_showelevmenu(struct ScriptContext *ctx) { /*ScriptShowElevatorMenu(); ScriptContext1_Stop(); @@ -2290,7 +2290,7 @@ bool8 ScrCmd_takecoins(struct ScriptContext *ctx) return FALSE; } -bool8 ScrCmd_cmdD3(struct ScriptContext *ctx) +bool8 ScrCmd_mossdeepgym1(struct ScriptContext *ctx) { u16 v1 = VarGet(ScriptReadHalfword(ctx)); @@ -2298,13 +2298,13 @@ bool8 ScrCmd_cmdD3(struct ScriptContext *ctx) return FALSE; } -bool8 ScrCmd_cmdD4(struct ScriptContext *ctx) +bool8 ScrCmd_mossdeepgym2(struct ScriptContext *ctx) { sub_81A8AF8(); return FALSE; } -bool8 ScrCmd_cmdD5(struct ScriptContext *ctx) +bool8 ScrCmd_mossdeepgym3(struct ScriptContext *ctx) { u16 v1 = VarGet(ScriptReadHalfword(ctx)); @@ -2312,7 +2312,7 @@ bool8 ScrCmd_cmdD5(struct ScriptContext *ctx) return FALSE; } -bool8 ScrCmd_cmdD6(struct ScriptContext *ctx) +bool8 ScrCmd_mossdeepgym4(struct ScriptContext *ctx) { sub_81A895C(); return FALSE; @@ -2341,7 +2341,8 @@ bool8 ScrCmd_cmdD9(struct ScriptContext *ctx) } } -bool8 ScrCmd_cmdCD(struct ScriptContext *ctx) +// This command will force the Pokémon to be obedient, you don't get to choose which value to set its obedience to +bool8 ScrCmd_setpokeobedient(struct ScriptContext *ctx) { bool8 obedient = TRUE; u16 partyIndex = VarGet(ScriptReadHalfword(ctx)); @@ -2350,7 +2351,7 @@ bool8 ScrCmd_cmdCD(struct ScriptContext *ctx) return FALSE; } -bool8 ScrCmd_cmdCE(struct ScriptContext *ctx) +bool8 ScrCmd_checkpokeobedience(struct ScriptContext *ctx) { u16 partyIndex = VarGet(ScriptReadHalfword(ctx)); @@ -2370,7 +2371,7 @@ bool8 ScrCmd_cmdCF(struct ScriptContext *ctx) return FALSE; } -bool8 ScrCmd_cmdD1(struct ScriptContext *ctx) +bool8 ScrCmd_warpD1(struct ScriptContext *ctx) { u8 mapGroup = ScriptReadByte(ctx); u8 mapNum = ScriptReadByte(ctx); @@ -2385,7 +2386,7 @@ bool8 ScrCmd_cmdD1(struct ScriptContext *ctx) return TRUE; } -bool8 ScrCmd_cmdD2(struct ScriptContext *ctx) +bool8 ScrCmd_setpokemetlocation(struct ScriptContext *ctx) { u16 partyIndex = VarGet(ScriptReadHalfword(ctx)); u8 location = ScriptReadByte(ctx); @@ -2401,7 +2402,7 @@ void sub_809BDB4(void) RemoveWindow(gUnknown_03000F30); } -bool8 ScrCmd_cmdDD(struct ScriptContext *ctx) +bool8 ScrCmd_gettrainerclass(struct ScriptContext *ctx) { u8 stringVarIndex = ScriptReadByte(ctx); u16 trainerClassId = VarGet(ScriptReadHalfword(ctx)); @@ -2410,7 +2411,7 @@ bool8 ScrCmd_cmdDD(struct ScriptContext *ctx) return FALSE; } -bool8 ScrCmd_cmdDE(struct ScriptContext *ctx) +bool8 ScrCmd_gettrainername(struct ScriptContext *ctx) { u8 stringVarIndex = ScriptReadByte(ctx); u16 trainerClassId = VarGet(ScriptReadHalfword(ctx)); @@ -2424,7 +2425,7 @@ void sub_809BE48(u16 npcId) sMovingNpcId = npcId; } -bool8 ScrCmd_cmdE0(struct ScriptContext *ctx) +bool8 ScrCmd_warpE0(struct ScriptContext *ctx) { u8 mapGroup = ScriptReadByte(ctx); u8 mapNum = ScriptReadByte(ctx);