mirror of
https://github.com/Ninjdai1/pokeemerald.git
synced 2025-02-04 10:20:01 +01:00
Changed how scripted wild encounters work to include double battles
Removed the old commands for scripted wild double encounters
This commit is contained in:
parent
b83a87c8e8
commit
151aca8365
@ -1327,13 +1327,19 @@
|
||||
.2byte \count
|
||||
.endm
|
||||
|
||||
@ Prepares to start a wild battle against a species at Level level holding item. Running this command will not affect
|
||||
@ normal wild battles. You start the prepared battle with dowildbattle.
|
||||
.macro setwildbattle species:req, level:req, item:req
|
||||
@ Prepares to start a wild battle against a species at Level level holding item.
|
||||
@ If species2 is something other than SPECIES_NONE, then the battle is a double battle with another pokemon
|
||||
@ with species species2 at Level level2 holding item2.
|
||||
@ Running this command will not affect normal wild battles. You start the prepared battle with dowildbattle.
|
||||
@ If the player only has one pokemon, a scripted double battle will be buggy.
|
||||
.macro setwildbattle species:req, level:req, item:req, species2=SPECIES_NONE, level2=0, item2=ITEM_NONE
|
||||
.byte 0xb6
|
||||
.2byte \species
|
||||
.byte \level
|
||||
.2byte \item
|
||||
.2byte \species2
|
||||
.byte \level2
|
||||
.2byte \item2
|
||||
.endm
|
||||
|
||||
@ Starts a wild battle against the Pokemon generated by setwildbattle. Blocks script execution until the battle finishes.
|
||||
@ -1778,21 +1784,3 @@
|
||||
setfieldeffectargument 2, \priority
|
||||
dofieldeffect FLDEFF_SPARKLE
|
||||
.endm
|
||||
|
||||
@ Prepares to start a double wild battle against a species1 at Level level1 holding item1 and a species2 at Level level2 holding item2.
|
||||
@ Running this command will not affect normal wild battles. You start the prepared battle with dodoublewildbattle.
|
||||
@ BUG: If the player only has one pokemon, the scripted double battle has undefined behaviours...
|
||||
.macro setdoublewildbattle species1:req, level1:req, item1:req, species2:req, level2:req, item2:req
|
||||
.byte 0xe3
|
||||
.2byte \species1
|
||||
.byte \level1
|
||||
.2byte \item1
|
||||
.2byte \species2
|
||||
.byte \level2
|
||||
.2byte \item2
|
||||
.endm
|
||||
|
||||
@ Starts a wild battle against the Pokemon generated by setdoublewildbattle. Blocks script execution until the battle finishes.
|
||||
.macro dodoublewildbattle
|
||||
.byte 0xe4
|
||||
.endm
|
||||
|
@ -227,8 +227,6 @@ gScriptCmdTable:: @ 81DB67C
|
||||
.4byte ScrCmd_warpsootopolislegend @ 0xe0
|
||||
.4byte ScrCmd_buffercontesttype @ 0xe1
|
||||
.4byte ScrCmd_bufferitemnameplural @ 0xe2
|
||||
.4byte ScrCmd_setdoublewildbattle @ 0xe3
|
||||
.4byte ScrCmd_dodoublewildbattle @ 0xe4
|
||||
|
||||
gScriptCmdTableEnd:: @ 81DBA08
|
||||
.4byte ScrCmd_nop
|
||||
|
49
src/scrcmd.c
49
src/scrcmd.c
@ -62,6 +62,7 @@ static EWRAM_DATA u16 sMovingNpcMapId = 0;
|
||||
static EWRAM_DATA u16 sFieldEffectScriptId = 0;
|
||||
|
||||
static u8 gBrailleWindowId;
|
||||
static bool8 gIsScriptedWildDouble;
|
||||
|
||||
extern const SpecialFunc gSpecials[];
|
||||
extern const u8 *gStdScripts[];
|
||||
@ -1870,15 +1871,37 @@ bool8 ScrCmd_setwildbattle(struct ScriptContext *ctx)
|
||||
u16 species = ScriptReadHalfword(ctx);
|
||||
u8 level = ScriptReadByte(ctx);
|
||||
u16 item = ScriptReadHalfword(ctx);
|
||||
u16 species2 = ScriptReadHalfword(ctx);
|
||||
u8 level2 = ScriptReadByte(ctx);
|
||||
u16 item2 = ScriptReadHalfword(ctx);
|
||||
|
||||
if(species2 == SPECIES_NONE)
|
||||
{
|
||||
CreateScriptedWildMon(species, level, item);
|
||||
gIsScriptedWildDouble = FALSE;
|
||||
}
|
||||
else
|
||||
{
|
||||
CreateScriptedDoubleWildMon(species, level, item, species2, level2, item2);
|
||||
gIsScriptedWildDouble = TRUE;
|
||||
}
|
||||
|
||||
CreateScriptedWildMon(species, level, item);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
bool8 ScrCmd_dowildbattle(struct ScriptContext *ctx)
|
||||
{
|
||||
BattleSetup_StartScriptedWildBattle();
|
||||
ScriptContext1_Stop();
|
||||
if(gIsScriptedWildDouble == FALSE)
|
||||
{
|
||||
BattleSetup_StartScriptedWildBattle();
|
||||
ScriptContext1_Stop();
|
||||
}
|
||||
else
|
||||
{
|
||||
BattleSetup_StartScriptedDoubleWildBattle();
|
||||
ScriptContext1_Stop();
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
@ -2302,23 +2325,3 @@ bool8 ScrCmd_warpsootopolislegend(struct ScriptContext *ctx)
|
||||
ResetInitialPlayerAvatarState();
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
bool8 ScrCmd_setdoublewildbattle(struct ScriptContext *ctx)
|
||||
{
|
||||
u16 species1 = ScriptReadHalfword(ctx);
|
||||
u8 level1 = ScriptReadByte(ctx);
|
||||
u16 item1 = ScriptReadHalfword(ctx);
|
||||
u16 species2 = ScriptReadHalfword(ctx);
|
||||
u8 level2 = ScriptReadByte(ctx);
|
||||
u16 item2 = ScriptReadHalfword(ctx);
|
||||
|
||||
CreateScriptedDoubleWildMon(species1, level1, item1, species2, level2, item2);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
bool8 ScrCmd_dodoublewildbattle(struct ScriptContext *ctx)
|
||||
{
|
||||
BattleSetup_StartScriptedDoubleWildBattle();
|
||||
ScriptContext1_Stop();
|
||||
return TRUE;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user