pret / pokeemerald

Decompilation of Pokémon Emerald

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Things to consider changing

DizzyEggg opened this issue · comments

  1. Move #define HEAP_SIZE 0x1C000 from global.h to malloc.h, ✅
  2. Rename malloc.h to alloc.h.✅
  3. Create a define for number of moves a pokemon can have at once. So far, we've just been using a raw number 4.
  4. There is BATTLE_STATS_NO and NUM_STATS, these should be standardized, I think. ✅
  5. Move struct Bitmap defnition from global.h to blit.h. ✅
  6. Rename struct Window's field from priority to bg. ✅
  7. Change all const Window Templates to show struct fields instead of raw bytes(applies to other structs too). ✅
  8. Use EOS in string_util.c, text.c and other early decompiled files. ✅
  9. Fix gpu regs arguments from raw values to defines. in early decompiled files.
  10. Gamefreak likes to use 0xFF, 0xFFFF and -1 for values that are invalid/wrong/out of bounds. I've been thinking of creating a series of macros such as INVALID_U16, INVALID_S16, INVALID_U8, etc. as I think they're betten than just a raw 0xFF. ❌ Scrapped, it is a bad idea, makes the code less readable.
  11. Use MAX_SPRITES macro instead of raw 64 ✅

I made this issue, because I sometimes think of things to improve but forget them afterwards. I may come up with other ideas, so I'll just add another id. Please tell me what you think about these changes.

As for 3, we actually do have a define for that, MAX_MON_MOVES in battle.h. If it's not being used then that needs to be fixed.