diff options
author | Rangi <remy.oukaour+rangi42@gmail.com> | 2018-09-15 15:12:18 -0400 |
---|---|---|
committer | Rangi <remy.oukaour+rangi42@gmail.com> | 2018-09-15 15:12:18 -0400 |
commit | d899da01e938ffa2f9b68cfb9d21618f9c58225c (patch) | |
tree | 10cae4d70e8f4ff7726287423a84568920180c43 /Code-cleanup.md | |
parent | 666a25fa57ce5e27c3ec016697f8698f1e890bf4 (diff) |
Formatting
Diffstat (limited to 'Code-cleanup.md')
-rw-r--r-- | Code-cleanup.md | 8 |
1 files changed, 2 insertions, 6 deletions
diff --git a/Code-cleanup.md b/Code-cleanup.md index aa457a3..1e294ac 100644 --- a/Code-cleanup.md +++ b/Code-cleanup.md @@ -26,17 +26,11 @@ Look for `UnknownText_*`, `UnknownScript_*`, `Unknown_*`, and `Function_*`. 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]`. @@ -45,6 +39,7 @@ Most of the time, raw numbers should not exist because there are more meaningful Currently a mixture of `Text_*`, `*Text`, and `BattleText_*`. Likewise for the [engine/](../tree/master/engine/) labels that just `text_jump` to one of them. The convention that should be used is as follows: + - Use suffixes, i.e. not `Text_Something`, but `SomethingText`. Same for `Movement`. - Labels that are referenced through `text_jump` should be prefixed with an underscore, e.g. `SomethingText: text_jump _SomethingText`. @@ -57,6 +52,7 @@ The convention that should be used is as follows: ### Project structure + - Split big files into meaningful parts - Give files meaningful names - Remove redundancy in names such as `thing/thing_subthing.asm` → `thing/subthing.asm` |