forked from Ares-Developers/YRpp
-
Notifications
You must be signed in to change notification settings - Fork 30
/
ColorScheme.h
90 lines (72 loc) · 2.61 KB
/
ColorScheme.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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
/*
[Colors]
*/
#pragma once
#include <ArrayClasses.h>
#include <GeneralStructures.h>
#include <HashTable.h>
#include <Helpers/CompileTime.h>
class LightConvertClass;
class ColorScheme
{
public:
enum {
//ColorScheme indices, since they are hardcoded all over the exe, why shan't we do it as well?
Yellow = 3,
White = 5,
Grey = 7,
Red = 11,
Orange = 13,
Pink = 15,
Purple = 17,
Blue = 21,
Green = 29,
};
//global array
static constexpr constant_ptr<DynamicVectorClass<ColorScheme*>, 0xB054D0u> const Array{};
/*
* trap! most schemes are duplicated - ShadeCount 1 and ShadeCount 53
*/
static ColorScheme* Find(const char* pID, int ShadeCount = 1) {
int index = FindIndex(pID, ShadeCount);
return Array->GetItemOrDefault(index);
}
static int FindIndex(const char* pID, int ShadeCount = 1) {
for(int i = 0; i < Array->Count; ++i) {
ColorScheme* pItem = Array->GetItem(i);
if(!_strcmpi(pItem->ID, pID)) {
if(pItem->ShadeCount == ShadeCount) {
return i;
}
}
}
return -1;
}
static ColorScheme * __fastcall FindByName(const char* pID, const ColorStruct &BaseColor, const BytePalette &Pal1, const BytePalette &Pal2, int ShadeCount)
{ JMP_THIS(0x68C9C0); }
static int __fastcall GetNumberOfSchemes()
{ JMP_STD(0x626C60); }
static DynamicVectorClass<ColorScheme*>* __fastcall GeneratePalette(char* name)
{ JMP_STD(0x6263D0); }
// Game uses a hash table to store color scheme vectors for extra palettes, this table can be iterated by calling this function.
static DynamicVectorClass<ColorScheme*>* __fastcall GetPaletteSchemesFromIterator(HashIterator* it)
{ JMP_STD(0x626690); }
//Constructor, Destructor
ColorScheme(const char* pID, const ColorStruct &BaseColor, const BytePalette &Pal1, const BytePalette &Pal2, int ShadeCount, bool AddToArray)
{ JMP_THIS(0x68C710); }
~ColorScheme()
{ JMP_THIS(0x68C8D0); }
//===========================================================================
//===== Properties ==========================================================
//===========================================================================
public:
int ArrayIndex; // this is off by one (always one higher than the actual index). that's because consistency and reason suck.
BytePalette Colors;
char* ID;
ColorStruct BaseColor;
LightConvertClass* LightConvert; //??? remap - indices #16-#31 are changed to mathefuckikally derived shades of BaseColor, think unittem.pal
int ShadeCount;
PROTECTED_PROPERTY(BYTE, unknown_314[0x1C]);
int MainShadeIndex;
PROTECTED_PROPERTY(BYTE, unknown_334[0x8]);
};