Pretty close to the original binary except for the first loop, which generates differently. (TODO comment added) There are also some questionable double address calculations, which hopfully clear up when the loop is fixed as well.
Also added enums `inv_body_loc` and `inv_xy_slot` to clean up a lot of magic numbers.
Now binary exact except for the usual `xor; inc` vs `push 1; pop` switch.
Updated the type of `_iIdentified` to `BOOL` as well (since every write to it actually is 0 or 1).
- Now 99% accurate (can't get the last `GetPlrHandSeed` call in the switch to optimize the way it is in the binary, TODO for that added)
- Switched `_ui_classes` enum members out with `plr_classes` ones
- Added TODO tags for missing debug logic from the 1.00 build
This is now as close as it gets without switching to enum types/parameters everywhere, so the compiler can optimize all accesses/checks accordingly. This is especially noticeable in the way the code for the switch is generated (line 775). In the original binary you can see it does weird stuff if c is not one of the classes' enum value (probably due to optimization since the switch should be exhaustive).
I've tried switching the type of c to _ui_classes, also removing the UI_NUM_CLASSES value to see if that'd be enough to let it generate the optimized code, but nope, seems like we need to change it all at once. Currently, _pClass is a char, but an enum value would fit there as well, size-wise (alignment).
That's also why I'm guessing there had to be another enum for player classes, without the UI_NUM_CLASSES value...
The stack var setup is now 100% correct, and the function is only 5 bytes larger than the original now.
Some minor differences remain, but it's very close now!