mirror of https://github.com/nmlgc/ReC98.git
[Decompilation] [th03] Add a type for the paletted playchar IDs
Much better than the previous incorrect comment, since the char_id() method now easily generates the correct sequence of conversion instructions, seen all throughout the ASM. Even within array subscripts! Part of P0076, funded by [Anonymous] and -Tom-.
This commit is contained in:
parent
6363a37d7a
commit
ff777a099e
|
@ -39,6 +39,7 @@ where the scalar-type variable is declared in relation to them.
|
|||
|-|-|
|
||||
| `ADD [m8], imm8` | Only achievable through a C++ method operating on a member? |
|
||||
| `MOV AL, [m8]`<br />`ADD AL, imm8`<br />`MOV [m8], AL` | Opposite; *not* an inlined function |
|
||||
| `CWD`<br />`SUB AX, DX`<br />`SAR AX, 1` | `AX / 2`, `AX` is *int* |
|
||||
|
||||
### Arithmetic on a register *after* assigning it to a variable?
|
||||
|
||||
|
|
|
@ -11,6 +11,23 @@ typedef enum {
|
|||
PLAYCHAR_COUNT = 9,
|
||||
} playchars_t;
|
||||
|
||||
// Encodes a playchars_t together with its alternate palette flag.
|
||||
#pragma option -a1
|
||||
struct playchar_paletted_t {
|
||||
unsigned char v;
|
||||
|
||||
int filename_id() const {
|
||||
return (v - 1);
|
||||
}
|
||||
|
||||
playchars_t char_id() const {
|
||||
return static_cast<playchars_t>(filename_id() / 2);
|
||||
}
|
||||
};
|
||||
#pragma option -a.
|
||||
|
||||
#define TO_PALETTED(playchar) ((playchar << 1) + 1)
|
||||
|
||||
typedef struct {
|
||||
SPPoint8 aligned;
|
||||
SPPoint8 diagonal;
|
|
@ -37,10 +37,7 @@ typedef struct {
|
|||
uint8_t unused_1;
|
||||
unsigned char invincibility_time;
|
||||
char halfhearts;
|
||||
|
||||
// (<value from playchars_t> + 1) << 1 | <alternative palette flag>
|
||||
unsigned char playchar_paletted;
|
||||
|
||||
playchar_paletted_t playchar_paletted;
|
||||
speed_t speed;
|
||||
shot_mode_t shot_mode;
|
||||
unsigned char patnum_movement;
|
||||
|
|
Loading…
Reference in New Issue