-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathTeamData.h
244 lines (212 loc) · 6.5 KB
/
TeamData.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
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
#pragma once
enum class Handedness
{
Left, Right
};
enum class WhichStat
{
PlayerIndex = 0,
PlayerName = 1,
PlayerNumber = 2,
WeightClass = 3,
Agility = 4,
Speed = 5,
OffAware = 6,
DefAware = 7,
ShotPower = 8,
Checking = 9,
Handedness = 10,
StickHandling = 11,
ShotAccuracy = 12,
Endurance = 13,
Roughness = 14,
PassAccuracy = 15,
Aggression = 16
};
template<typename T>
struct ModifiableStat
{
int SourceROMAddress;
public:
void Initialize(int srcAddr, T n)
{
OriginalValue = n;
NewValue = n;
SourceROMAddress = srcAddr;
}
bool IsChanged() const
{
return OriginalValue != NewValue;
}
void Set(T const& v)
{
NewValue = v;
}
T const& GetOriginal() const
{
return OriginalValue;
}
T const& Get() const
{
return NewValue;
}
private:
T OriginalValue;
T NewValue;
};
struct PlayerData
{
int OriginalROMAddress;
int ReplacedROMAddressForRename;
ModifiableStat<std::string> Name;
ModifiableStat<int> PlayerNumber;
ModifiableStat<int> WeightFactor;
int WeightInPounds;
ModifiableStat<int> BaseAgility;
ModifiableStat<int> BaseSpeed;
ModifiableStat<int> BaseOffAware;
ModifiableStat<int> BaseDefAware;
ModifiableStat<int> BaseShotPower;
ModifiableStat<int> BaseChecking;
ModifiableStat<int> HandednessValue;
Handedness WhichHandedness;
ModifiableStat<int> BaseStickHandling;
ModifiableStat<int> BaseShotAccuracy;
ModifiableStat<int> BaseEndurance;
ModifiableStat<int> Roughness; // Not reported in the game card
ModifiableStat<int> BasePassAccuracy;
ModifiableStat<int> BaseAggression;
int ProfileImageIndex; // -1 means no profile image
void SetNumericalStat(WhichStat s, int v)
{
switch (s)
{
case WhichStat::PlayerNumber: PlayerNumber.Set(v); break;
case WhichStat::WeightClass: WeightFactor.Set(v); break;
case WhichStat::Agility: BaseAgility.Set(v); break;
case WhichStat::Speed: BaseSpeed.Set(v); break;
case WhichStat::OffAware: BaseOffAware.Set(v); break;
case WhichStat::DefAware: BaseDefAware.Set(v); break;
case WhichStat::ShotPower: BaseShotPower.Set(v); break;
case WhichStat::Checking: BaseChecking.Set(v); break;
case WhichStat::Handedness: HandednessValue.Set(v); break;
case WhichStat::StickHandling: BaseStickHandling.Set(v); break;
case WhichStat::ShotAccuracy: BaseShotAccuracy.Set(v); break;
case WhichStat::Endurance: BaseEndurance.Set(v); break;
case WhichStat::Roughness: Roughness.Set(v); break;
case WhichStat::PassAccuracy: BasePassAccuracy.Set(v); break;
case WhichStat::Aggression: BaseAggression.Set(v); break;
case WhichStat::PlayerIndex:
case WhichStat::PlayerName:
System::Diagnostics::Debug::Assert(false); // Unexpected stat
break;
}
}
bool IsNumericalStatChanged(WhichStat s)
{
switch (s)
{
case WhichStat::PlayerNumber: return PlayerNumber.IsChanged(); break;
case WhichStat::WeightClass: return WeightFactor.IsChanged(); break;
case WhichStat::Agility: return BaseAgility.IsChanged(); break;
case WhichStat::Speed: return BaseSpeed.IsChanged(); break;
case WhichStat::OffAware: return BaseOffAware.IsChanged(); break;
case WhichStat::DefAware: return BaseDefAware.IsChanged(); break;
case WhichStat::ShotPower: return BaseShotPower.IsChanged(); break;
case WhichStat::Checking: return BaseChecking.IsChanged(); break;
case WhichStat::Handedness: return HandednessValue.IsChanged(); break;
case WhichStat::StickHandling: return BaseStickHandling.IsChanged(); break;
case WhichStat::ShotAccuracy: return BaseShotAccuracy.IsChanged(); break;
case WhichStat::Endurance: return BaseEndurance.IsChanged(); break;
case WhichStat::Roughness: return Roughness.IsChanged(); break;
case WhichStat::PassAccuracy: return BasePassAccuracy.IsChanged(); break;
case WhichStat::Aggression: return BaseAggression.IsChanged(); break;
case WhichStat::PlayerIndex:
case WhichStat::PlayerName:
System::Diagnostics::Debug::Assert(false); // Unexpected stat
break;
}
return false;
}
};
struct StringWithSourceROMAddress
{
std::string Str;
int SourceROMAddress;
};
struct TeamData
{
int SourceDataROMAddress;
int DestDataROMAddress;
std::vector<unsigned char> Header;
ModifiableStat<std::string> TeamCity;
ModifiableStat<std::string> Acronym;
ModifiableStat<std::string> TeamName;
ModifiableStat<std::string> Venue;
std::vector<PlayerData> Players;
int HeaderColorIndex;
int HomeColorIndex;
int AwayColorIndex;
int SkinColorOverrideIndex; // 0 if unused
PlayerData* GetPlayerByOriginalName(std::string name)
{
for (int i = 0; i < Players.size(); ++i)
{
if (Players[i].Name.GetOriginal().find(name) != -1)
{
return &Players[i];
}
}
return nullptr;
}
};
struct PlayerPallette
{
struct ColorSet
{
int SourceDataROMAddress;
int SourceDataFileOffset;
union
{
struct
{
unsigned short Reserved;
unsigned short Skateblade;
unsigned short Skate;
unsigned short Gear0;
unsigned short Gear1;
unsigned short Gear2;
unsigned short Gear3;
unsigned short Skin;
unsigned short Gear4;
unsigned short Gear5;
unsigned short Gear6;
unsigned short Gear7;
unsigned short Gear8;
unsigned short Gear9;
unsigned short Wood;
unsigned short IceShadow;
} Named;
unsigned char Bytes[0x20];
};
};
ColorSet Home;
ColorSet Away;
};
struct ProfilePalletteData
{
int PalletteFileOffset;
int PalletteROMAddress;
std::vector<unsigned char> PalletteBytes;
};
struct ProfileImageData
{
int ImageDataROMAddress;
std::wstring Path;
std::vector<unsigned char> ImageBytes;
};
struct MultiFormatPallette
{
int PortableR8G8B8[16];
int SnesB5G5R5[16];
};