1
1
#include < base/color.h>
2
2
#include < base/system.h>
3
+ #include < game/generated/protocol7.h>
3
4
4
5
#include " teeinfo.h"
5
6
6
7
struct StdSkin
7
8
{
8
- char m_aSkinName[64 ];
9
+ char m_aSkinName[24 ];
9
10
// body, marking, decoration, hands, feet, eyes
10
- char m_apSkinPartNames[6 ][24 ];
11
- bool m_aUseCustomColors[6 ];
12
- int m_aSkinPartColors[6 ];
11
+ char m_apSkinPartNames[protocol7::NUM_SKINPARTS ][24 ];
12
+ bool m_aUseCustomColors[protocol7::NUM_SKINPARTS ];
13
+ int m_aSkinPartColors[protocol7::NUM_SKINPARTS ];
13
14
};
14
15
15
16
static StdSkin g_aStdSkins[] = {
16
17
{" default" , {" standard" , " " , " " , " standard" , " standard" , " standard" }, {true , false , false , true , true , false }, {1798004 , 0 , 0 , 1799582 , 1869630 , 0 }},
17
- {" bluekitty" , {" kitty" , " whisker" , " " , " standard" , " standard" , " standard " }, {true , true , false , true , true , false }, {8681144 , -8229413 , 0 , 7885547 , 7885547 , 0 }},
18
+ {" bluekitty" , {" kitty" , " whisker" , " " , " standard" , " standard" , " negative " }, {true , true , false , true , true , true }, {8681144 , -8229413 , 0 , 7885547 , 8868585 , 9043712 }},
18
19
{" bluestripe" , {" standard" , " stripes" , " " , " standard" , " standard" , " standard" }, {true , false , false , true , true , false }, {10187898 , 0 , 0 , 750848 , 1944919 , 0 }},
19
20
{" brownbear" , {" bear" , " bear" , " hair" , " standard" , " standard" , " standard" }, {true , true , false , true , true , false }, {1082745 , -15634776 , 0 , 1082745 , 1147174 , 0 }},
20
21
{" cammo" , {" standard" , " cammo2" , " " , " standard" , " standard" , " standard" }, {true , true , false , true , true , false }, {5334342 , -11771603 , 0 , 750848 , 1944919 , 0 }},
21
22
{" cammostripes" , {" standard" , " cammostripes" , " " , " standard" , " standard" , " standard" }, {true , true , false , true , true , false }, {5334342 , -14840320 , 0 , 750848 , 1944919 , 0 }},
22
23
{" coala" , {" koala" , " twinbelly" , " " , " standard" , " standard" , " standard" }, {true , true , false , true , true , false }, {184 , -15397662 , 0 , 184 , 9765959 , 0 }},
23
- {" limekitty" , {" kitty" , " whisker" , " " , " standard" , " standard" , " standard " }, {true , true , false , true , true , false }, {4612803 , -12229920 , 0 , 3827951 , 3827951 , 0 }},
24
+ {" limekitty" , {" kitty" , " whisker" , " " , " standard" , " standard" , " negative " }, {true , true , false , true , true , true }, {4612803 , -12229920 , 0 , 3827951 , 3827951 , 8256000 }},
24
25
{" pinky" , {" standard" , " whisker" , " " , " standard" , " standard" , " standard" }, {true , true , false , true , true , false }, {15911355 , -801066 , 0 , 15043034 , 15043034 , 0 }},
25
26
{" redbopp" , {" standard" , " donny" , " unibop" , " standard" , " standard" , " standard" }, {true , true , true , true , true , false }, {16177260 , -16590390 , 16177260 , 16177260 , 7624169 , 0 }},
26
27
{" redstripe" , {" standard" , " stripe" , " " , " standard" , " standard" , " standard" }, {true , false , false , true , true , false }, {16307835 , 0 , 0 , 184 , 9765959 , 0 }},
@@ -38,9 +39,9 @@ CTeeInfo::CTeeInfo(const char *pSkinName, int UseCustomColor, int ColorBody, int
38
39
m_ColorFeet = ColorFeet;
39
40
}
40
41
41
- CTeeInfo::CTeeInfo (const char *apSkinPartNames[6 ], const int *pUseCustomColors, const int *pSkinPartColors)
42
+ CTeeInfo::CTeeInfo (const char *apSkinPartNames[protocol7::NUM_SKINPARTS ], const int *pUseCustomColors, const int *pSkinPartColors)
42
43
{
43
- for (int i = 0 ; i < 6 ; i++)
44
+ for (int i = 0 ; i < protocol7::NUM_SKINPARTS ; i++)
44
45
{
45
46
str_copy (m_apSkinPartNames[i], apSkinPartNames[i], sizeof (m_apSkinPartNames[i]));
46
47
m_aUseCustomColors[i] = pUseCustomColors[i];
@@ -51,7 +52,7 @@ CTeeInfo::CTeeInfo(const char *apSkinPartNames[6], const int *pUseCustomColors,
51
52
void CTeeInfo::ToSixup ()
52
53
{
53
54
// reset to default skin
54
- for (int p = 0 ; p < 6 ; p++)
55
+ for (int p = 0 ; p < protocol7::NUM_SKINPARTS ; p++)
55
56
{
56
57
str_copy (m_apSkinPartNames[p], g_aStdSkins[0 ].m_apSkinPartNames [p], 24 );
57
58
m_aUseCustomColors[p] = g_aStdSkins[0 ].m_aUseCustomColors [p];
@@ -63,7 +64,7 @@ void CTeeInfo::ToSixup()
63
64
{
64
65
if (!str_comp (m_aSkinName, StdSkin.m_aSkinName ))
65
66
{
66
- for (int p = 0 ; p < 6 ; p++)
67
+ for (int p = 0 ; p < protocol7::NUM_SKINPARTS ; p++)
67
68
{
68
69
str_copy (m_apSkinPartNames[p], StdSkin.m_apSkinPartNames [p], 24 );
69
70
m_aUseCustomColors[p] = StdSkin.m_aUseCustomColors [p];
@@ -75,18 +76,18 @@ void CTeeInfo::ToSixup()
75
76
76
77
if (m_UseCustomColor)
77
78
{
78
- int ColorBody = ColorHSLA (m_ColorBody).UnclampLighting ().Pack (ms_DarkestLGT7 );
79
- int ColorFeet = ColorHSLA (m_ColorFeet).UnclampLighting ().Pack (ms_DarkestLGT7 );
80
- m_aUseCustomColors[0 ] = true ;
81
- m_aUseCustomColors[1 ] = true ;
82
- m_aUseCustomColors[2 ] = true ;
83
- m_aUseCustomColors[3 ] = true ;
84
- m_aUseCustomColors[4 ] = true ;
85
- m_aSkinPartColors[0 ] = ColorBody;
86
- m_aSkinPartColors[1 ] = 0x22FFFFFF ;
87
- m_aSkinPartColors[2 ] = ColorBody;
88
- m_aSkinPartColors[3 ] = ColorBody;
89
- m_aSkinPartColors[4 ] = ColorFeet;
79
+ int ColorBody = ColorHSLA (m_ColorBody).UnclampLighting (ColorHSLA::DARKEST_LGT ).Pack (ColorHSLA::DARKEST_LGT7 );
80
+ int ColorFeet = ColorHSLA (m_ColorFeet).UnclampLighting (ColorHSLA::DARKEST_LGT ).Pack (ColorHSLA::DARKEST_LGT7 );
81
+ m_aUseCustomColors[protocol7::SKINPART_BODY ] = true ;
82
+ m_aUseCustomColors[protocol7::SKINPART_MARKING ] = true ;
83
+ m_aUseCustomColors[protocol7::SKINPART_DECORATION ] = true ;
84
+ m_aUseCustomColors[protocol7::SKINPART_HANDS ] = true ;
85
+ m_aUseCustomColors[protocol7::SKINPART_FEET ] = true ;
86
+ m_aSkinPartColors[protocol7::SKINPART_BODY ] = ColorBody;
87
+ m_aSkinPartColors[protocol7::SKINPART_MARKING ] = 0x22FFFFFF ;
88
+ m_aSkinPartColors[protocol7::SKINPART_DECORATION ] = ColorBody;
89
+ m_aSkinPartColors[protocol7::SKINPART_HANDS ] = ColorBody;
90
+ m_aSkinPartColors[protocol7::SKINPART_FEET ] = ColorFeet;
90
91
}
91
92
}
92
93
@@ -102,7 +103,7 @@ void CTeeInfo::FromSixup()
102
103
for (auto &StdSkin : g_aStdSkins)
103
104
{
104
105
bool match = true ;
105
- for (int p = 0 ; p < 6 ; p++)
106
+ for (int p = 0 ; p < protocol7::NUM_SKINPARTS ; p++)
106
107
{
107
108
if (str_comp (m_apSkinPartNames[p], StdSkin.m_apSkinPartNames [p]) || m_aUseCustomColors[p] != StdSkin.m_aUseCustomColors [p] || (m_aUseCustomColors[p] && m_aSkinPartColors[p] != StdSkin.m_aSkinPartColors [p]))
108
109
{
@@ -118,24 +119,28 @@ void CTeeInfo::FromSixup()
118
119
}
119
120
120
121
// find closest match
121
- int best_skin = 0 ;
122
- int best_matches = -1 ;
122
+ int BestSkin = 0 ;
123
+ int BestMatches = -1 ;
123
124
for (int s = 0 ; s < 16 ; s++)
124
125
{
125
126
int matches = 0 ;
126
127
for (int p = 0 ; p < 3 ; p++)
127
128
if (str_comp (m_apSkinPartNames[p], g_aStdSkins[s].m_apSkinPartNames [p]) == 0 )
128
129
matches++;
129
130
130
- if (matches > best_matches )
131
+ if (matches > BestMatches )
131
132
{
132
- best_matches = matches;
133
- best_skin = s;
133
+ BestMatches = matches;
134
+ BestSkin = s;
134
135
}
135
136
}
136
137
137
- str_copy (m_aSkinName, g_aStdSkins[best_skin ].m_aSkinName , sizeof (m_aSkinName));
138
+ str_copy (m_aSkinName, g_aStdSkins[BestSkin ].m_aSkinName , sizeof (m_aSkinName));
138
139
m_UseCustomColor = true ;
139
- m_ColorBody = ColorHSLA (m_aUseCustomColors[0 ] ? m_aSkinPartColors[0 ] : 255 ).UnclampLighting (ms_DarkestLGT7).Pack (ColorHSLA::DARKEST_LGT);
140
- m_ColorFeet = ColorHSLA (m_aUseCustomColors[4 ] ? m_aSkinPartColors[4 ] : 255 ).UnclampLighting (ms_DarkestLGT7).Pack (ColorHSLA::DARKEST_LGT);
140
+ m_ColorBody = ColorHSLA (m_aUseCustomColors[protocol7::SKINPART_BODY] ? m_aSkinPartColors[protocol7::SKINPART_BODY] : 255 )
141
+ .UnclampLighting (ColorHSLA::DARKEST_LGT7)
142
+ .Pack (ColorHSLA::DARKEST_LGT);
143
+ m_ColorFeet = ColorHSLA (m_aUseCustomColors[protocol7::SKINPART_FEET] ? m_aSkinPartColors[protocol7::SKINPART_FEET] : 255 )
144
+ .UnclampLighting (ColorHSLA::DARKEST_LGT7)
145
+ .Pack (ColorHSLA::DARKEST_LGT);
141
146
}
0 commit comments