-
Notifications
You must be signed in to change notification settings - Fork 88
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Generate enum-based battle constants at build-time #121
Conversation
enum { | ||
OVERWORLD_WEATHER_CLEAR = 0, | ||
OVERWORLD_WEATHER_CLOUDY, | ||
OVERWORLD_WEATHER_RAINING, | ||
OVERWORLD_WEATHER_HEAVY_RAIN, | ||
OVERWORLD_WEATHER_THUNDERSTORM, | ||
OVERWORLD_WEATHER_SNOWING, | ||
OVERWORLD_WEATHER_HEAVY_SNOW, | ||
OVERWORLD_WEATHER_BLIZZARD, | ||
OVERWORLD_WEATHER_CLEAR_8, | ||
OVERWORLD_WEATHER_SLOW_ASHFALL, | ||
OVERWORLD_WEATHER_SANDSTORM, | ||
OVERWORLD_WEATHER_HAILING, | ||
OVERWORLD_WEATHER_SPIRITS, | ||
OVERWORLD_WEATHER_CLEAR_13, | ||
OVERWORLD_WEATHER_FOG, | ||
OVERWORLD_WEATHER_DEEP_FOG, | ||
OVERWORLD_WEATHER_DARK_FLASH, | ||
|
||
// these are only for the Battle Frontier | ||
OVERWORLD_WEATHER_HARSH_SUN = 1001, | ||
OVERWORLD_WEATHER_TRICK_ROOM, | ||
}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I moved these to #define
syntax, since there is a break in values outside the usual step-increments.
@@ -18,3 +18,9 @@ if not nitrogfx_exe.found() | |||
subproject('nitrogfx', default_options: 'native=true') | |||
nitrogfx_exe = find_program('nitrogfx', native: true) | |||
endif | |||
|
|||
constgen_py = find_program('constgen_py', native: true, required: false) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can't you use the fallback:
parameter? Granted, that's a new meson feature I think.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This isn't really a fallback
candidate, since it's not a different name. We're expecting to find it under this name.
My only complaint is that nobody is gonna be able to find the source of truth through neither their IDE nor a simple Either:
Or both, preferably both. |
I decided both was worthwhile, too. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good!
This makes use of a subproject that I wrote for generating constants files from a basic manifest schema. The goal here is to support having a single source of truth for such definitions that can be utilized by both the compiler and a direct assembler invocation for building data files (which we will need for battle scripts). The assembler does not support reading
enum
definitions out-of-the-box, so these definitions would need to either be:#define
syntax, which is less-than-ideal for self-documentation of function signatures