2019-12-01 15:32:22 +00:00
|
|
|
typedef enum {
|
2020-01-29 07:57:06 +00:00
|
|
|
PLAYCHAR_REIMU = 0,
|
|
|
|
PLAYCHAR_MIMA = 1,
|
|
|
|
PLAYCHAR_MARISA = 2,
|
|
|
|
PLAYCHAR_ELLEN = 3,
|
|
|
|
PLAYCHAR_KOTOHIME = 4,
|
|
|
|
PLAYCHAR_KANA = 5,
|
|
|
|
PLAYCHAR_RIKAKO = 6,
|
|
|
|
PLAYCHAR_CHIYURI = 7,
|
|
|
|
PLAYCHAR_YUMEMI = 8,
|
|
|
|
PLAYCHAR_COUNT = 9,
|
2021-12-18 15:48:20 +00:00
|
|
|
} playchar_t;
|
2019-12-01 17:13:28 +00:00
|
|
|
|
2023-10-28 13:09:09 +00:00
|
|
|
typedef unsigned char playchar_paletted_t;
|
|
|
|
|
2023-10-27 21:16:56 +00:00
|
|
|
// Uses 0 to indicate "no character" and shifts all IDs up by 1.
|
|
|
|
struct PlaycharOptional {
|
2020-02-19 14:53:51 +00:00
|
|
|
unsigned char v;
|
|
|
|
|
2023-10-27 21:16:56 +00:00
|
|
|
playchar_t char_id() const {
|
|
|
|
return static_cast<playchar_t>(v - 1);
|
2020-02-19 14:53:51 +00:00
|
|
|
}
|
|
|
|
|
2023-10-27 21:16:56 +00:00
|
|
|
void set_none() {
|
|
|
|
v = 0;
|
2020-02-19 14:53:51 +00:00
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2023-10-27 21:16:56 +00:00
|
|
|
// Encodes a playchar_t together with its alternate palette flag in the lowest
|
|
|
|
// bit.
|
|
|
|
struct PlaycharPaletted {
|
2023-10-28 13:09:09 +00:00
|
|
|
playchar_paletted_t v;
|
2021-12-21 13:14:28 +00:00
|
|
|
|
|
|
|
playchar_t char_id() const {
|
2023-10-27 21:16:56 +00:00
|
|
|
return static_cast<playchar_t>(v / 2);
|
2021-12-21 13:14:28 +00:00
|
|
|
}
|
|
|
|
|
2023-10-28 13:09:09 +00:00
|
|
|
// ZUN bloat
|
|
|
|
int char_id_16() const {
|
|
|
|
return (v / 2);
|
|
|
|
}
|
|
|
|
|
2023-10-27 21:16:56 +00:00
|
|
|
bool16 palette_id() const {
|
|
|
|
return (v & 1);
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
// Like PlaycharPaletted, but with all IDs shifted up by 1 to reserve 0 for "no
|
|
|
|
// character".
|
|
|
|
struct PlaycharPalettedOptional {
|
|
|
|
unsigned char v;
|
|
|
|
|
|
|
|
int filename_id() const {
|
|
|
|
return (v - 1);
|
|
|
|
}
|
|
|
|
|
|
|
|
playchar_t char_id() const {
|
|
|
|
return static_cast<playchar_t>(filename_id() / 2);
|
2021-12-21 13:14:28 +00:00
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2023-10-27 21:16:56 +00:00
|
|
|
#define TO_OPTIONAL_PALETTED(playchar) ((playchar << 1) + 1)
|