-
Notifications
You must be signed in to change notification settings - Fork 2.7k
Allow Both Latios and Latias Appear.
voloved edited this page Jan 20, 2023
·
1 revision
By devolov
Goal: Make it so if you caught or defeated the first roamer (Latios or Latias) and haven't seen the other, then the other will become the new roamer. This would allow someone to catch both Latios and Latias in the same file.
------------------------------- include/roamer.h -------------------------------
index ba1b09b54..3d8bb2321 100644
@@ -10,8 +10,9 @@ void RoamerMove(void);
bool8 IsRoamerAt(u8 mapGroup, u8 mapNum);
void CreateRoamerMonInstance(void);
u8 TryStartRoamerEncounter(void);
void UpdateRoamerHPStatus(struct Pokemon *mon);
+void NextRoamer(void);
void SetRoamerInactive(void);
void GetRoamerLocation(u8 *mapGroup, u8 *mapNum);
#endif // GUARD_ROAMER_H
------------------------------ src/battle_main.c ------------------------------
index 707c211fd..0f16660f1 100644
@@ -5355,9 +5355,9 @@ static void ReturnFromBattleToOverworld(void)
if ((gBattleOutcome & B_OUTCOME_WON) || gBattleOutcome == B_OUTCOME_CAUGHT)
#else
if ((gBattleOutcome == B_OUTCOME_WON) || gBattleOutcome == B_OUTCOME_CAUGHT) // Bug: When Roar is used by roamer, gBattleOutcome is B_OUTCOME_PLAYER_TELEPORTED (5).
#endif // & with B_OUTCOME_WON (1) will return TRUE and deactivates the roamer.
- SetRoamerInactive();
+ NextRoamer();
}
m4aSongNumStop(SE_LOW_HEALTH);
SetMainCallback2(gMain.savedCallback);
--------------------------------- src/roamer.c ---------------------------------
index e9dc72a99..690f866ce 100644
@@ -2,8 +2,9 @@
#include "event_data.h"
#include "pokemon.h"
#include "random.h"
#include "roamer.h"
+#include "pokedex.h"
// Despite having a variable to track it, the roamer is
// hard-coded to only ever be in map group 0
#define ROAMER_MAP_GROUP 0
@@ -238,8 +239,22 @@ void SetRoamerInactive(void)
{
ROAMER->active = FALSE;
}
+void NextRoamer(void)
+{
+ if ((ROAMER->species == SPECIES_LATIAS && GetSetPokedexFlag(SpeciesToNationalPokedexNum(SPECIES_LATIOS), FLAG_GET_SEEN))
+ || (ROAMER->species == SPECIES_LATIOS && GetSetPokedexFlag(SpeciesToNationalPokedexNum(SPECIES_LATIAS), FLAG_GET_SEEN))){
+ SetRoamerInactive();
+ }
+ else{
+ bool16 createLatios = ROAMER->species == SPECIES_LATIAS;
+ ClearRoamerData();
+ ClearRoamerLocationData();
+ CreateInitialRoamerMon(createLatios);
+ }
+}
+
void GetRoamerLocation(u8 *mapGroup, u8 *mapNum)
{
*mapGroup = sRoamerLocation[MAP_GRP];
*mapNum = sRoamerLocation[MAP_NUM];