blob: 53e123213db67feb0a211da6105b2680948add84 (
plain)
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
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
|
#include "StdAfx.h"
#include "CResFile.h"
#include "GlobalFunc.h"
#include "T2DLL.h"
#include "T2PaletteAnimeDef.h"
T2PaletteAnimeDef::T2PaletteAnimeDef(HINSTANCE instance, CResFile* resFile) {
int i, j;
Init();
*resFile >> mNumOfTowerColor;
*resFile >> mNumOfAnimColor;
*resFile >> mAnimStartIndex;
*resFile >> mNumOfRefrectColor;
*resFile >> mNumOfSkyColor;
*resFile >> mNumOfSEKind;
*resFile >> mNumOfSEColor;
*resFile >> mSEInterval;
LOGPALETTE *basePal = LoadACTPaletteEntries(instance, 100);
#line 22
_ASSERT(basePal);
for (i = mAnimStartIndex; i < (mAnimStartIndex + mNumOfAnimColor); i++)
basePal->palPalEntry[i].peFlags = PC_RESERVED;
basePal->palPalEntry[253].peFlags = PC_RESERVED;
basePal->palPalEntry[254].peFlags = PC_RESERVED;
mTowerPalette = new CPalette;
mTowerPalette->CreatePalette(basePal);
mSEPalette = LoadACTPaletteEntries(instance, 102);
#line 31
_ASSERT(mSEPalette);
for (i = 0; i < (mNumOfSEKind * mNumOfSEColor); i++)
mSEPalette->palPalEntry[i].peFlags = PC_RESERVED;
mDayLightPalette = LoadACTPaletteEntries(instance, 101);
#line 36
_ASSERT(mDayLightPalette);
for (i = 0; i < (mNumOfRefrectColor + mNumOfSkyColor); i++)
mDayLightPalette->palPalEntry[i].peFlags = PC_RESERVED;
mUnknownPalette = LoadACTPaletteEntries(instance, 103);
#line 41
_ASSERT(mUnknownPalette);
gCommonColor[0] = 0;
gCommonColor[1] = 255;
for (i = 2; i <= 19; i++) {
if (
mUnknownPalette->palPalEntry[i].peRed == 0 &&
mUnknownPalette->palPalEntry[i].peGreen == 0 &&
mUnknownPalette->palPalEntry[i].peBlue == 0
)
{
gCommonColor[i] = 255;
}
else {
for (j = 0; j < mNumOfTowerColor; j++) {
if (
basePal->palPalEntry[j].peRed == mUnknownPalette->palPalEntry[i].peRed &&
basePal->palPalEntry[j].peGreen == mUnknownPalette->palPalEntry[i].peGreen &&
basePal->palPalEntry[j].peBlue == mUnknownPalette->palPalEntry[i].peBlue
)
{
break;
}
}
#line 53
_ASSERT(j < mNumOfTowerColor);
gCommonColor[i] = j;
}
}
free(basePal);
}
T2PaletteAnimeDef::~T2PaletteAnimeDef() {
delete mTowerPalette;
free(mSEPalette);
free(mDayLightPalette);
free(mUnknownPalette);
}
void T2PaletteAnimeDef::Init() {
mUnknownPalette = NULL;
mSEPalette = NULL;
mDayLightPalette = NULL;
}
void T2PaletteAnimeDef::ReplaceDayLightPalette(HINSTANCE instance, int id) {
LOGPALETTE *pal = LoadACTPaletteEntries(instance, id);
#line 80
_ASSERT(pal);
for (int i = 0; i < (mNumOfRefrectColor + mNumOfSkyColor); i++) {
pal->palPalEntry[i].peFlags = PC_RESERVED;
mDayLightPalette->palPalEntry[i] = pal->palPalEntry[i];
}
}
/*static*/ int T2PaletteAnimeDef::GetCommonColor(int i) {
return gCommonColor[i];
}
|