This repository has been archived by the owner on Mar 8, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
/
CPalette.h
56 lines (46 loc) · 1.46 KB
/
CPalette.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
#pragma once
#include "FA2PP.h"
struct BGRStruct
{
BGRStruct(unsigned char b = 0, unsigned char g = 0, unsigned char r = 0)
{
B = b;
G = g;
R = r;
Zero = 0;
}
unsigned char B, G, R, Zero;
bool operator< (const BGRStruct& rhs) const { return *(int*)this < *(int*)&rhs; }
bool operator==(const BGRStruct& rhs) const { return *(int*)this == *(int*)&rhs; }
};
struct ColorStruct
{
unsigned char red, green, blue;
};
class BytePalette
{
public:
static constexpr reference<int, 0x884034> const LoadedPaletteCount{};
static constexpr reference<int, 0x81E098, 254> const LoadedPaletteFlag{};
static constexpr reference<BytePalette, 0x7EDD9C, 255> const LoadedPalettes{}; // count is not sure in fact
ColorStruct Data[256];
ColorStruct& operator[](int index) { return Data[index]; }
};
class Palette
{
public:
static constexpr constant_ptr<Palette, 0x72B4C4> PALETTE_UNIT{};
static constexpr constant_ptr<Palette, 0x72B8C4> PALETTE_ISO{};
static constexpr constant_ptr<Palette, 0x72ACC4> PALETTE_THEATER{};
static constexpr constant_ptr<Palette, 0x72A8C4> PALETTE_LIB{};
BGRStruct Data[256];
BGRStruct& operator[](int index) { return Data[index]; }
ColorStruct GetByteColor(int index) { // It's BGR color
ColorStruct ret;
BGRStruct& tmp = *(BGRStruct*)&Data[index];
ret.red = tmp.R;
ret.green = tmp.G;
ret.blue = tmp.B;
return ret;
}
};