Revert rtc based encounters (#5331)
* Revert "RTC-based wild encounters follow up (#5328)" This reverts commit9a95c9b07a
. * Revert "RTC-based wild encounters (#5313)" This reverts commit7c7fd905ba
.
This commit is contained in:
parent
9a95c9b07a
commit
5c86aa126f
5 changed files with 2 additions and 74 deletions
|
@ -74,13 +74,6 @@
|
||||||
#define OW_USE_FAKE_RTC FALSE // When TRUE, seconds on the in-game clock will only advance once every 60 playTimeVBlanks (every 60 frames).
|
#define OW_USE_FAKE_RTC FALSE // When TRUE, seconds on the in-game clock will only advance once every 60 playTimeVBlanks (every 60 frames).
|
||||||
#define OW_ALTERED_TIME_RATIO GEN_LATEST // In GEN_8_PLA, the time in game moves forward 60 seconds for every second in the RTC. In GEN_9, it is 20 seconds. This has no effect if OW_USE_FAKE_RTC is FALSE.
|
#define OW_ALTERED_TIME_RATIO GEN_LATEST // In GEN_8_PLA, the time in game moves forward 60 seconds for every second in the RTC. In GEN_9, it is 20 seconds. This has no effect if OW_USE_FAKE_RTC is FALSE.
|
||||||
|
|
||||||
// Time-based wild Pokemon encounters - Allows you to create additional encounter groups in wild_encounters.json (or in porymap).
|
|
||||||
// The groups are processed by base label's suffix. For example, "gRoute101" (no suffix) contains daytime encounters, and "gRoute101_Night" contains nighttime encounters.
|
|
||||||
// Not every group needs to be defined for every map - you could for example omit them inside caves and it would fall back to the unsuffixed daytime encounter group.
|
|
||||||
#define OW_TIME_BASED_WILD_ENCOUNTERS FALSE // Enables the system. If disabled, all suffixes are ignored and the first encounter group found for a map will be used for wild encounters.
|
|
||||||
#define OW_ENABLE_MORNING_WILD_ENCOUNTERS FALSE // If true, allows definition of morning encounter groups such as "gRoute101_Morning". Otherwise, morning is considered to be day for encounters. No effect if OW_TIME_BASED_WILD_ENCOUNTERS is false.
|
|
||||||
#define OW_ENABLE_EVENING_WILD_ENCOUNTERS FALSE // If true, allows definition of evening encounter groups such as "gRoute101_Evening". Otherwise, evening is considered to be night for encounters. No effect if OW_TIME_BASED_WILD_ENCOUNTERS is false.
|
|
||||||
|
|
||||||
// Overworld flags
|
// Overworld flags
|
||||||
// To use the following features in scripting, replace the 0s with the flag ID you're assigning it to.
|
// To use the following features in scripting, replace the 0s with the flag ID you're assigning it to.
|
||||||
// Eg: Replace with FLAG_UNUSED_0x264 so you can use that flag to toggle the feature.
|
// Eg: Replace with FLAG_UNUSED_0x264 so you can use that flag to toggle the feature.
|
||||||
|
|
|
@ -20,7 +20,6 @@ struct WildPokemonHeader
|
||||||
{
|
{
|
||||||
u8 mapGroup;
|
u8 mapGroup;
|
||||||
u8 mapNum;
|
u8 mapNum;
|
||||||
u8 timeOfDay;
|
|
||||||
const struct WildPokemonInfo *landMonsInfo;
|
const struct WildPokemonInfo *landMonsInfo;
|
||||||
const struct WildPokemonInfo *waterMonsInfo;
|
const struct WildPokemonInfo *waterMonsInfo;
|
||||||
const struct WildPokemonInfo *rockSmashMonsInfo;
|
const struct WildPokemonInfo *rockSmashMonsInfo;
|
||||||
|
|
|
@ -72,7 +72,6 @@ const struct WildPokemonHeader {{ wild_encounter_group.label }}[] =
|
||||||
{
|
{
|
||||||
.mapGroup = {% if wild_encounter_group.for_maps %}MAP_GROUP({{ removePrefix(encounter.map, "MAP_") }}){% else %}0{% endif %},
|
.mapGroup = {% if wild_encounter_group.for_maps %}MAP_GROUP({{ removePrefix(encounter.map, "MAP_") }}){% else %}0{% endif %},
|
||||||
.mapNum = {% if wild_encounter_group.for_maps %}MAP_NUM({{ removePrefix(encounter.map, "MAP_") }}){% else %}{{ loop.index1 }}{% endif %},
|
.mapNum = {% if wild_encounter_group.for_maps %}MAP_NUM({{ removePrefix(encounter.map, "MAP_") }}){% else %}{{ loop.index1 }}{% endif %},
|
||||||
.timeOfDay = {% if stringEndsWith(encounter.base_label, "_Night") or stringContains(encounter.base_label, "_Night_") %}TIME_NIGHT{% else if stringEndsWith(encounter.base_label, "_Morning") or stringContains(encounter.base_label, "_Morning_") %}TIME_MORNING{% else if stringEndsWith(encounter.base_label, "_Evening") or stringContains(encounter.base_label, "_Evening_") %}TIME_EVENING{% else %}TIME_DAY{% endif %},
|
|
||||||
.landMonsInfo = {% if existsIn(encounter, "land_mons") %}&{{ encounter.base_label }}_LandMonsInfo{% else %}NULL{% endif %},
|
.landMonsInfo = {% if existsIn(encounter, "land_mons") %}&{{ encounter.base_label }}_LandMonsInfo{% else %}NULL{% endif %},
|
||||||
.waterMonsInfo = {% if existsIn(encounter, "water_mons") %}&{{ encounter.base_label }}_WaterMonsInfo{% else %}NULL{% endif %},
|
.waterMonsInfo = {% if existsIn(encounter, "water_mons") %}&{{ encounter.base_label }}_WaterMonsInfo{% else %}NULL{% endif %},
|
||||||
.rockSmashMonsInfo = {% if existsIn(encounter, "rock_smash_mons") %}&{{ encounter.base_label }}_RockSmashMonsInfo{% else %}NULL{% endif %},
|
.rockSmashMonsInfo = {% if existsIn(encounter, "rock_smash_mons") %}&{{ encounter.base_label }}_RockSmashMonsInfo{% else %}NULL{% endif %},
|
||||||
|
@ -82,7 +81,6 @@ const struct WildPokemonHeader {{ wild_encounter_group.label }}[] =
|
||||||
{
|
{
|
||||||
.mapGroup = MAP_GROUP(UNDEFINED),
|
.mapGroup = MAP_GROUP(UNDEFINED),
|
||||||
.mapNum = MAP_NUM(UNDEFINED),
|
.mapNum = MAP_NUM(UNDEFINED),
|
||||||
.timeOfDay = TIME_DAY,
|
|
||||||
.landMonsInfo = NULL,
|
.landMonsInfo = NULL,
|
||||||
.waterMonsInfo = NULL,
|
.waterMonsInfo = NULL,
|
||||||
.rockSmashMonsInfo = NULL,
|
.rockSmashMonsInfo = NULL,
|
||||||
|
|
|
@ -11,7 +11,6 @@
|
||||||
#include "pokeblock.h"
|
#include "pokeblock.h"
|
||||||
#include "battle_setup.h"
|
#include "battle_setup.h"
|
||||||
#include "roamer.h"
|
#include "roamer.h"
|
||||||
#include "rtc.h"
|
|
||||||
#include "tv.h"
|
#include "tv.h"
|
||||||
#include "link.h"
|
#include "link.h"
|
||||||
#include "script.h"
|
#include "script.h"
|
||||||
|
@ -355,32 +354,9 @@ static u8 ChooseWildMonLevel(const struct WildPokemon *wildPokemon, u8 wildMonIn
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool32 IsExactTimeOfDayMatchForWildEncounters(u32 currentTimeOfDay, u32 encounterTimeOfDay)
|
|
||||||
{
|
|
||||||
switch (currentTimeOfDay)
|
|
||||||
{
|
|
||||||
case TIME_MORNING:
|
|
||||||
if (OW_ENABLE_MORNING_WILD_ENCOUNTERS)
|
|
||||||
return encounterTimeOfDay == TIME_MORNING;
|
|
||||||
// fallthrough
|
|
||||||
case TIME_DAY:
|
|
||||||
return encounterTimeOfDay == TIME_DAY;
|
|
||||||
case TIME_EVENING:
|
|
||||||
if (OW_ENABLE_EVENING_WILD_ENCOUNTERS)
|
|
||||||
return encounterTimeOfDay == TIME_EVENING;
|
|
||||||
// fallthrough
|
|
||||||
case TIME_NIGHT:
|
|
||||||
return encounterTimeOfDay == TIME_NIGHT;
|
|
||||||
}
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
|
|
||||||
static u16 GetCurrentMapWildMonHeaderId(void)
|
static u16 GetCurrentMapWildMonHeaderId(void)
|
||||||
{
|
{
|
||||||
u16 i;
|
u16 i;
|
||||||
u8 currentTimeOfDay = GetTimeOfDay();
|
|
||||||
u16 dayId = HEADER_NONE;
|
|
||||||
u16 nightId = HEADER_NONE;
|
|
||||||
|
|
||||||
for (i = 0; ; i++)
|
for (i = 0; ; i++)
|
||||||
{
|
{
|
||||||
|
@ -399,30 +375,13 @@ static u16 GetCurrentMapWildMonHeaderId(void)
|
||||||
alteringCaveId = 0;
|
alteringCaveId = 0;
|
||||||
|
|
||||||
i += alteringCaveId;
|
i += alteringCaveId;
|
||||||
return i; // Altering cave is not affected by time-of-day encounters.
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (OW_TIME_BASED_WILD_ENCOUNTERS)
|
return i;
|
||||||
{
|
|
||||||
if (IsExactTimeOfDayMatchForWildEncounters(currentTimeOfDay, gWildMonHeaders[i].timeOfDay))
|
|
||||||
return i;
|
|
||||||
else if (gWildMonHeaders[i].timeOfDay == TIME_DAY && dayId == HEADER_NONE)
|
|
||||||
dayId = i;
|
|
||||||
else if (gWildMonHeaders[i].timeOfDay == TIME_NIGHT && nightId == HEADER_NONE)
|
|
||||||
nightId = i;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
return i;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!OW_TIME_BASED_WILD_ENCOUNTERS)
|
return HEADER_NONE;
|
||||||
return HEADER_NONE;
|
|
||||||
|
|
||||||
// Exact match for time of day was not found. We fall back to other encounter groups for this map
|
|
||||||
if (currentTimeOfDay == TIME_EVENING && OW_ENABLE_EVENING_WILD_ENCOUNTERS && nightId != HEADER_NONE)
|
|
||||||
return nightId;
|
|
||||||
return dayId;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
u8 PickWildMonNature(void)
|
u8 PickWildMonNature(void)
|
||||||
|
|
|
@ -118,27 +118,6 @@ int main(int argc, char *argv[])
|
||||||
return str;
|
return str;
|
||||||
});
|
});
|
||||||
|
|
||||||
env.add_callback("stringContains", 2, [](Arguments& args) {
|
|
||||||
string str = args.at(0)->get<string>();
|
|
||||||
string check = args.at(1)->get<string>();
|
|
||||||
|
|
||||||
return str.find(check) != std::string::npos;
|
|
||||||
});
|
|
||||||
|
|
||||||
env.add_callback("stringStartsWith", 2, [](Arguments& args) {
|
|
||||||
string str = args.at(0)->get<string>();
|
|
||||||
string check = args.at(1)->get<string>();
|
|
||||||
|
|
||||||
return str.find(check) == 0;
|
|
||||||
});
|
|
||||||
|
|
||||||
env.add_callback("stringEndsWith", 2, [](Arguments& args) {
|
|
||||||
string str = args.at(0)->get<string>();
|
|
||||||
string check = args.at(1)->get<string>();
|
|
||||||
|
|
||||||
return str.rfind(check) == (str.length() - check.length());
|
|
||||||
});
|
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
env.write_with_json_file(templateFilepath, jsonfilepath, outputFilepath);
|
env.write_with_json_file(templateFilepath, jsonfilepath, outputFilepath);
|
||||||
|
|
Loading…
Reference in a new issue