diff options
author | Rangi <remy.oukaour+rangi42@gmail.com> | 2018-07-17 17:13:53 -0400 |
---|---|---|
committer | Rangi <remy.oukaour+rangi42@gmail.com> | 2018-07-17 17:13:53 -0400 |
commit | 245cb70d0e4f90b3f0316b3f8c28ad9c5e022c79 (patch) | |
tree | 60ff07105a240386f145f73bbc63c73938456f93 /Code-cleanup.md | |
parent | 990673424d273060ab910a4c10e5651b94287d0b (diff) |
Use headings for individual items
Diffstat (limited to 'Code-cleanup.md')
-rw-r--r-- | Code-cleanup.md | 63 |
1 files changed, 46 insertions, 17 deletions
diff --git a/Code-cleanup.md b/Code-cleanup.md index d91974e..d192254 100644 --- a/Code-cleanup.md +++ b/Code-cleanup.md @@ -1,19 +1,48 @@ These are all general issues with the pokecrystal code. Keep an eye out for opportunities to refactor them. -- **Meaningless temporary labels:** `UnknownText_*`, `UnknownScript_*`, `Unknown_*`, and `Function_*` - -- **Hard-coded "magic numbers":** Most of the time, raw numbers should not exist because there are more meaningful replacements. Examples: - - `BANK(Label)` (mostly finished for WRAM labels, but still a problem with mobile code) - - `SomeLabelEnd - SomeLabel` (some structs and sub-structs still have hard-coded sizes like this) - - `(SomeGFXLabel.End - SomeGFXLabel) / LEN_2BPP_TILE` (pokered and pokegold-spaceworld already do this) - - `SOME_BIT_F` bit flags, and `1 << SOME_BIT_F` masks (various hex and binary literals indicate an opportunity for this) (you can often use the `maskbits` macro for `and $MASK`) - - Jumptable indexes (look for raw values being loaded into `[wJumptableIndex]`) - -- **Text label styles** in [data/text/](../tree/master/data/text/) should be consistent, not a mixture of `Text_*`, `*Text`, and `BattleText_*`. Likewise for the [engine/](../tree/master/engine/) labels that just `text_jump` to one of them. -- **Style Guide:** Re-formatting code to adhere with [STYLE.md](../tree/master/STYLE.md) (Converting labels to `.snake_case` is one that stands out) -- **WRAM Cleanup:** - - `Curr` -> `Cur` - - `wMapObjects` and friends to be re-formatted to `wObjectEvents` - - `wObjectStructs` and friends to be re-formatted to `wMapObjects` - - Removal of struct macros which include only a partial label definition (e.g. `wNorthMapConnection:: map_connection_struct wNorth`) -- **Future of SECTIONs:** Namely determining the purpose of them and when they should be defined.
\ No newline at end of file + +### Use the [style guide](../tree/master/STYLE.md) + +Reformat code to adhere to [STYLE.md](../tree/master/STYLE.md). (Converting labels to `.snake_case` is one that stands out.) + + +### Meaningless temporary labels + +Look for `UnknownText_*`, `UnknownScript_*`, `Unknown_*`, and `Function_*`. + + +### Hard-coded "magic numbers" + +Most of the time, raw numbers should not exist because there are more meaningful replacements. Examples: + +- `BANK(Label)`: Mostly finished for WRAM labels, but still a problem with mobile code. + +- `SomeLabelEnd - SomeLabel`: Some structs and sub-structs still have hard-coded sizes like this. + +- `(SomeGFXLabel.End - SomeGFXLabel) / LEN_2BPP_TILE`: pokered and pokegold-spaceworld already do this. + +- Bit flags: Use `SOME_BIT_F` constants instead of hard-coding bits 0-7 for the `bit`/`res`/`set` instructions. Find opportunities with: + + grep -rE --include='*.asm' --exclude-dir=mobile '^\s(bit|res|set) [0-7],' + +- Bit masks: Use `1 << SOME_BIT_F` masks and the `maskbits` macro. + +- Jumptable indexes: Look for raw values being loaded into `[wJumptableIndex]`. + + +### Text label styles in [data/text/](../tree/master/data/text/) + +Currently a mixture of `Text_*`, `*Text`, and `BattleText_*`. Likewise for the [engine/](../tree/master/engine/) labels that just `text_jump` to one of them. + + +### WRAM label style + +- `Curr` -> `Cur` +- `wMapObjects` and friends to be re-formatted to `wObjectEvents` +- `wObjectStructs` and friends to be re-formatted to `wMapObjects` +- Removal of struct macros which include only a partial label definition (e.g. `wNorthMapConnection:: map_connection_struct wNorth`) + + +### Future of `SECTION`s + +Namely determining the purpose of them and when they should be defined. |