pokeemerald icon indicating copy to clipboard operation
pokeemerald copied to clipboard

Missing wild encounter constant usage in Match Call

Open GriffinRichards opened this issue 4 years ago • 3 comments

Currently constants for the distribution of wild Pokémon are generated from data in wild_encounters.json and written by the inja template to wild_encounters.h. Because this file contains data it can't be included elsewhere, and the constants can only be used in wild_encounter.c.

The constants should instead be defined in a separate file that can be included repeatedly so that they can be used in other places the values are referenced (in match call, specifically). If a user changes the encounter chances without the constants there then the distribution of wild Pokémon mentioned in match calls can skew, or it could read out of bounds of the encounter table.

GriffinRichards avatar Feb 22 '22 17:02 GriffinRichards

(somewhat related): Also, the constants from include/constants/wild_encounter.h are "missing" (it's not actually required in any vanilla code but would very much be nice to have) something like:

#define FISH_WILD_COUNT_OLD_ROD   2
#define FISH_WILD_COUNT_GOOD_ROD  3
#define FISH_WILD_COUNT_SUPER_ROD 5

nonchip avatar Apr 28 '22 20:04 nonchip

They were defined in a .h file before being made into JSON, we'd have to revert that in order to fix this issue That or we make the modifications to the inja template and JSON

rawr51919 avatar Jun 21 '22 19:06 rawr51919

we'd have to revert that in order to fix this issue

um no, obviously we wouldn't have to do that.

That or we make the madifications to the inja template

well yeah that's the point. make the template generate a .c file, drop the static, and have extern ... in a .h file that can be included wherever.

and JSON

nah that's not necessary either.

nonchip avatar Jun 22 '22 10:06 nonchip