Skip to content

Commit

Permalink
Add configs for measurement systems and decimal separators (#4183)
Browse files Browse the repository at this point in the history
* Allow developers to choose metric or imperial, and their decimal seperator of choice for Pokédex entries
- Creates  which cleans up the existing implementing of printing height and weight to the pokedex
- Developers can choose to use metric or imperial units of measurement in the Pokédex
- - Developers can choose to use any character as a decimal seperator in the Pokédex
- Allows users to define units and decimal seperators independently
- Fixes a bug in Lotad / Seedot house

* Fixed compilation issue with agbcc

* Updated to include HGSS Dex and address PR Feedback
  • Loading branch information
pkmnsnfrn authored Feb 14, 2024
1 parent ce99db0 commit 7f6e1e2
Show file tree
Hide file tree
Showing 8 changed files with 278 additions and 180 deletions.
17 changes: 7 additions & 10 deletions include/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,16 +34,6 @@
#define LOG_HANDLER (LOG_HANDLER_MGBA_PRINT)
#endif

#define ENGLISH

#ifdef ENGLISH
#define UNITS_IMPERIAL
#define CHAR_DEC_SEPARATOR CHAR_PERIOD // Period is used as a decimal separator only in the UK and the US.
#else
#define UNITS_METRIC
#define CHAR_DEC_SEPARATOR CHAR_COMMA
#endif

// Uncomment to fix some identified minor bugs
#define BUGFIX

Expand Down Expand Up @@ -81,4 +71,11 @@
#define SUMMARY_SCREEN_NATURE_COLORS TRUE // If TRUE, nature-based stat boosts and reductions will be red and blue in the summary screen.
#define HQ_RANDOM TRUE // If TRUE, replaces the default RNG with an implementation of SFC32 RNG. May break code that relies on RNG.

// Measurement system constants to be used for UNITS
#define UNITS_IMPERIAL 0 // Inches, feet, pounds
#define UNITS_METRIC 1 // meters, kilograms

#define UNITS UNITS_IMPERIAL
#define CHAR_DEC_SEPARATOR CHAR_PERIOD // CHAR_PERIOD is used as a decimal separator only in the UK and the US. The rest of the world uses CHAR_COMMA.

#endif // GUARD_CONFIG_H
20 changes: 20 additions & 0 deletions include/constants/pokedex.h
Original file line number Diff line number Diff line change
Expand Up @@ -1307,4 +1307,24 @@ enum {

#define HOENN_DEX_COUNT (HOENN_DEX_DEOXYS + 1)

#define DECAGRAMS_IN_POUND 4536
#define CM_PER_INCH 2.54
#define CM_PER_INCH_FACTOR (CM_PER_INCH * 100)
#define INCHES_IN_FOOT 12
#define INCHES_IN_ONE_AND_HALF_FOOT (INCHES_IN_FOOT * 1.5)
#define INCHES_IN_FOOT_FACTOR (INCHES_IN_FOOT * 10)

#define WEIGHT_HEIGHT_STR_LEN 16
#define WEIGHT_HEIGHT_STR_MEM (WEIGHT_HEIGHT_STR_LEN * sizeof(u8))

#define DEX_HEADER_X 96
#define DEX_Y_TOP 57
#define DEX_Y_BOTTOM 73
#define DEX_MEASUREMENT_X 129

#define DEX_HGSS_HEADER_X_PADDING 59
#define DEX_HGSS_Y_TOP_PADDING 7
#define DEX_HGSS_Y_BOTTOM_PADDING 4
#define DEX_HGSS_MEASUREMENT_X_PADDING 51

#endif // GUARD_CONSTANTS_POKEDEX_H
1 change: 1 addition & 0 deletions include/pokedex.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,5 +29,6 @@ bool16 HasAllHoennMons(void);
void ResetPokedexScrollPositions(void);
bool16 HasAllMons(void);
void CB2_OpenPokedex(void);
void PrintMonMeasurements(u16 species, u32 owned);

#endif // GUARD_POKEDEX_H
2 changes: 2 additions & 0 deletions include/strings.h
Original file line number Diff line number Diff line change
Expand Up @@ -531,7 +531,9 @@ extern const u8 gText_PokedexRegistration[];
extern const u8 gText_NumberClear01[];
extern const u8 gText_5MarksPokemon[];
extern const u8 gText_UnkHeight[];
extern const u8 gText_UnkHeightMetric[];
extern const u8 gText_UnkWeight[];
extern const u8 gText_UnkWeightMetric[];
extern const u8 gText_HTHeight[];
extern const u8 gText_WTWeight[];
extern const u8 gText_SearchingPleaseWait[];
Expand Down
Loading

0 comments on commit 7f6e1e2

Please sign in to comment.