Changing encounter tables in r/b
Posted by: Codabra
Date: 2017-07-02 08:28:07
Thanks!
Glitch City Laboratories closed on 1 September 2020 (announcement). This is an archived copy of a thread from Glitch City Laboratories Forums.
You can join Glitch City Research Institute to ask questions or discuss current developments.
You may also download the archive of this forum in .tar.gz, .sql.gz, or .sqlite.gz formats.
struct EncounterTable {
(...) /* Same struct as the game uses */
}
/* Used to store which maps are modded this way, and how they should be modded */
struct ModifMarker {
char mapID;
struct EncounterTable *ptr;
}
struct EncounterTable customTableRoute1 = {
(...)
};
struct ModifMarker moddedMaps[] = {
{
mapID = 1, /* Route 1's ID */
ptr = &customTableRoute1
},
{
(...)
}
};
/* Function ran by the virus's hook */
void customFunc() {
for(int i = 0; i < (...) ; i++) {
if(moddedMaps[i].mapID == *wCurMap) {
memcpy(wGrassMons, moddedMaps[i].ptr, sizeof(struct EncounterTable));
}
}
}