-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathChoosePaintScreen.h
428 lines (399 loc) · 14.4 KB
/
ChoosePaintScreen.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
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
#include "stdio.h"
#include "InGameFunctions.h"
// 0x563C4C
void __declspec(naked) PushCantPaintTrunkDialogText()
{
_asm
{
mov ebx, 0x740E3098 // CUSTOMIZE_CANT_PAINT_STOCK_TRUNK
push 0x5636CD
retn
}
}
// 0x55CEB0
void __declspec(naked) TrunkAnimCodeCave_ChoosePaintScreen_StopBrowsingPaints()
{
_asm
{
cmp eax, 0x48
jz TrunkAnimClose
cmp eax, 0x44
jnz loc_55CEE9
EngineAnimClose:
push 0x55CEB5
retn
TrunkAnimClose:
mov ecx, dword ptr ds : [_FECarConfigRef]
mov eax, dword ptr ds : [ecx]
call dword ptr ds : [eax + 8]
push eax
call IsCarPartsAnimLoadedForCar
add esp, 4
test al, al
jz loc_55CEE0
push 0x3F800000
push 0
push 1
call FEDoCarPartAnimNow
add esp, 0x0C
push 0x55CEF5
retn
loc_55CEE0 :
push 0x55CEE0
retn
loc_55CEE9:
push 0x55CEE9
retn
}
}
// 0x55CCBE
void __declspec(naked) TrunkAnimCodeCave_ChoosePaintScreen_StartBrowsingPaints()
{
_asm
{
mov dword ptr ds: [esi + 0x28], 0x4E4485FE
mov byte ptr ds: [esi + 0x188], 1
cmp edi, 0x48
jz TrunkAnimOpen
cmp edi, 0x44
EngineAnimOpen:
push 0x55CCCF
retn
TrunkAnimOpen:
mov ecx, dword ptr ds: [_FECarConfigRef]
mov eax, dword ptr ds : [ecx]
call dword ptr ds: [eax+8]
push eax
call IsCarPartsAnimLoadedForCar
add esp,4
test al,al
jz loc_55CCFC
push 0x3F800000
push 1
push 1
call FEDoCarPartAnimNow
add esp, 0x0C
push 0x55CD11
retn
loc_55CCFC:
push 0x55CCFC
retn
}
}
bool __fastcall ChoosePaintScreen_CanPaintThisPart(DWORD* ChoosePaintScreen, void* EDX_Unused)
{
bool result = 1; // al
int SomeRef; // eax MAPDST
int CarSlotID; // ecx
int CarSlotIDToCheck; // esi
DWORD* TheCarPart; // eax MAPDST
if (*(DWORD*)0x8389A0 == 1)
return 1;
SomeRef = ChoosePaintScreen[22];
CarSlotID = 169;
if (SomeRef)
CarSlotID = *(DWORD*)(SomeRef + 72);
switch (CarSlotID)
{
case 63: // BASE_PAINT
return 1;
case 68: // PAINT_ENGINE
return CarCustomizeManager_IsEnginePaintable((DWORD*)gCarCustomizeManager_0);
case 69: // PAINT_SPOILER
CarSlotIDToCheck = 12;
goto CheckIfPaintable;
case 70: // PAINT_BRAKE
return CarCustomizeManager_AreBrakesPaintable((DWORD*)gCarCustomizeManager_0);
case 71: // PAINT_EXHAUST
CarSlotIDToCheck = 16;
goto CheckIfPaintable;
case 72: // TRUNK_AUDIO
return CarCustomizeManager_IsTrunkPaintable((DWORD*)gCarCustomizeManager_0, EDX_Unused);
case 73: // PAINT_RIM
case 74: // PAINT_SPINNER
CarSlotIDToCheck = 29;
goto CheckIfPaintable;
case 75: // PAINT_ROOF
CarSlotIDToCheck = 7;
goto CheckIfPaintable;
case 76: // PAINT_MIRROR
CarSlotIDToCheck = 32;
CheckIfPaintable:
TheCarPart = CarCustomizeManager_GetInstalledPart((DWORD*)gCarCustomizeManager, CarSlotIDToCheck);
if (!TheCarPart
|| (*((BYTE*)TheCarPart + 5) & 0xE0) == 0
|| (CarSlotIDToCheck == 12 || CarSlotIDToCheck == 7 || CarSlotIDToCheck == 32) // SPOILER, ROOF, WING_MIRROR
&& (CarPart_GetAppliedAttributeUParam(TheCarPart, bStringHash("CARBONFIBRE"), 0)
|| CarPart_GetAppliedAttributeUParam(TheCarPart, 0x6509EC92, 0))) // ALUMINUM ??
{
return 0;
}
if (SomeRef)
{
if (CarSlotID == 74) result = CarPart_HasAppliedAttribute(TheCarPart, bStringHash("SPINNER_TEXTURE"));
}
else
result = 1;
break;
default:
result = 0;
break;
}
return result;
}
void __fastcall ChoosePaintScreen_BuildPaintCategoryList(DWORD* ChoosePaintScreen, void* EDX_Unused)
{
DWORD* CarPart; // edi
unsigned int NumColours; // eax
DWORD* APaintSelectionThing; // edi MAPDST
bool IsLocked; // al MAPDST
if (!*(DWORD*)0x8389A0)
{
APaintSelectionThing = (DWORD*)j__malloc(0x4Cu);
if (APaintSelectionThing)
{
IsLocked = ChoosePaintScreen_IsPaintMenuLocked(ChoosePaintScreen, 63);
PaintSelectionThing_Create(APaintSelectionThing, 63, bStringHash("PAINT_MOD_BASE"), bStringHash("PAINT_BASE"), 0, IsLocked);
(*(void(__thiscall**)(DWORD*, DWORD*))(*(DWORD*)ChoosePaintScreen + 24))(ChoosePaintScreen, APaintSelectionThing);
}
else
{
APaintSelectionThing = 0;
}
APaintSelectionThing = (DWORD*)j__malloc(0x4Cu);
if (APaintSelectionThing)
{
IsLocked = ChoosePaintScreen_IsPaintMenuLocked(ChoosePaintScreen, 69);
PaintSelectionThing_Create(APaintSelectionThing, 69, bStringHash("PAINT_MOD_PART_SPOILER"), bStringHash("PAINT_SPOILER"), 0, IsLocked);
(*(void(__thiscall**)(DWORD*, DWORD*))(*(DWORD*)ChoosePaintScreen + 24))(ChoosePaintScreen, APaintSelectionThing);
}
else
{
APaintSelectionThing = 0;
}
APaintSelectionThing = (DWORD*)j__malloc(0x4Cu);
if (APaintSelectionThing)
{
IsLocked = ChoosePaintScreen_IsPaintMenuLocked(ChoosePaintScreen, 75);
PaintSelectionThing_Create(APaintSelectionThing, 75, bStringHash("PAINT_MOD_PART_ROOF"), bStringHash("PAINT_ROOF"), 0, IsLocked);
(*(void(__thiscall**)(DWORD*, DWORD*))(*(DWORD*)ChoosePaintScreen + 24))(ChoosePaintScreen, APaintSelectionThing);
}
else
{
APaintSelectionThing = 0;
}
APaintSelectionThing = (DWORD*)j__malloc(0x4Cu);
if (APaintSelectionThing)
{
IsLocked = ChoosePaintScreen_IsPaintMenuLocked(ChoosePaintScreen, 76);
PaintSelectionThing_Create(APaintSelectionThing, 76, bStringHash("PAINT_MOD_PART_MIRROR"), bStringHash("PAINT_MIRROR"), 0, IsLocked);
(*(void(__thiscall**)(DWORD*, DWORD*))(*(DWORD*)ChoosePaintScreen + 24))(ChoosePaintScreen, APaintSelectionThing);
}
else
{
APaintSelectionThing = 0;
}
APaintSelectionThing = (DWORD*)j__malloc(0x4Cu);
if (APaintSelectionThing)
{
IsLocked = ChoosePaintScreen_IsPaintMenuLocked(ChoosePaintScreen, 73);
PaintSelectionThing_Create(APaintSelectionThing, 73, bStringHash("PAINT_MOD_PART_RIMS"), bStringHash("PAINT_RIM"), 0, IsLocked);
(*(void(__thiscall**)(DWORD*, DWORD*))(*(DWORD*)ChoosePaintScreen + 24))(ChoosePaintScreen, APaintSelectionThing);
}
else
{
APaintSelectionThing = 0;
}
APaintSelectionThing = (DWORD*)j__malloc(0x4Cu);
if (APaintSelectionThing)
{
IsLocked = ChoosePaintScreen_IsPaintMenuLocked(ChoosePaintScreen, 74);
PaintSelectionThing_Create(APaintSelectionThing, 74, bStringHash("PAINT_MOD_PART_RIMS"), bStringHash("PAINT_SPINNER"), 0, IsLocked);
(*(void(__thiscall**)(DWORD*, DWORD*))(*(DWORD*)ChoosePaintScreen + 24))(ChoosePaintScreen, APaintSelectionThing);
}
else
{
APaintSelectionThing = 0;
}
APaintSelectionThing = (DWORD*)j__malloc(0x4Cu);
if (APaintSelectionThing)
{
IsLocked = ChoosePaintScreen_IsPaintMenuLocked(ChoosePaintScreen, 70);
PaintSelectionThing_Create(APaintSelectionThing, 70, bStringHash("PAINT_MOD_PART_BRAKE_CALIPERS"), bStringHash("PAINT_BRAKE"), 0, IsLocked);
(*(void(__thiscall**)(DWORD*, DWORD*))(*(DWORD*)ChoosePaintScreen + 24))(ChoosePaintScreen, APaintSelectionThing);
}
else
{
APaintSelectionThing = 0;
}
APaintSelectionThing = (DWORD*)j__malloc(0x4Cu);
if (APaintSelectionThing)
{
IsLocked = ChoosePaintScreen_IsPaintMenuLocked(ChoosePaintScreen, 68);
PaintSelectionThing_Create(APaintSelectionThing, 68, bStringHash("PAINT_MOD_PART_ENGINE_ACCENT"), bStringHash("PAINT_ENGINE"), 0, IsLocked);
(*(void(__thiscall**)(DWORD*, DWORD*))(*(DWORD*)ChoosePaintScreen + 24))(ChoosePaintScreen, APaintSelectionThing);
}
else
{
APaintSelectionThing = 0;
}
APaintSelectionThing = (DWORD*)j__malloc(0x4Cu);
if (APaintSelectionThing)
{
IsLocked = 0; //ChoosePaintScreen_IsPaintMenuLocked(ChoosePaintScreen, 72);
PaintSelectionThing_Create(APaintSelectionThing, 72, bStringHash("PAINT_MOD_PART_TRUNK_AUDIO"), bStringHash("PAINT_AUDIO"), 0, IsLocked);
(*(void(__thiscall**)(DWORD*, DWORD*))(*(DWORD*)ChoosePaintScreen + 24))(ChoosePaintScreen, APaintSelectionThing);
}
else
{
APaintSelectionThing = 0;
}
APaintSelectionThing = (DWORD*)j__malloc(0x4Cu);
if (APaintSelectionThing)
{
IsLocked = ChoosePaintScreen_IsPaintMenuLocked(ChoosePaintScreen, 71);
PaintSelectionThing_Create(APaintSelectionThing, 71, bStringHash("PAINT_MOD_PART_MUFFLER_TIP"), bStringHash("PAINT_EXHAUST"), 0, IsLocked);
(*(void(__thiscall**)(DWORD*, DWORD*))(*(DWORD*)ChoosePaintScreen + 24))(ChoosePaintScreen, APaintSelectionThing);
}
else
{
APaintSelectionThing = 0;
}
goto LABEL_42;
}
if (*(DWORD*)0x8389A0 != 1)
{
if (*(DWORD*)0x8389A0 != 2)
goto LABEL_42;
APaintSelectionThing = (DWORD*)j__malloc(0x4Cu);
if (APaintSelectionThing)
{
PaintSelectionThing_Create(APaintSelectionThing, 97, bStringHash("PAINT_ICON_1"), bStringHash("PAINT_CHOOSE_DECAL_COLORS"), 0, 0);
(*(void(__thiscall**)(DWORD*, DWORD*))(*(DWORD*)ChoosePaintScreen + 24))(ChoosePaintScreen, APaintSelectionThing);
}
else
APaintSelectionThing = 0;
goto LABEL_42;
}
CarPart = (DWORD*)*(DWORD*)0x839BB8;
if (CarPart)
{
NumColours = CarPart_GetAppliedAttributeUParam(CarPart, bStringHash("NUMREMAPCOLOURS"), 0);
for (int i = 1; i <= NumColours; i++)
{
APaintSelectionThing = (DWORD*)j__malloc(0x4Cu);
if (APaintSelectionThing)
{
PaintSelectionThing_Create(APaintSelectionThing, ChoosePaintScreen_GetCarSlotIDForVinylPaintLayer(ChoosePaintScreen, *(DWORD*)0x8389A8, i), FEngHashString("PAINT_ICON_%d", i), bStringHash("PAINT_CHOOSE_VINYL_COLORS"), 0, 0);
(*(void(__thiscall**)(DWORD*, DWORD*))(*(DWORD*)ChoosePaintScreen + 24))(ChoosePaintScreen, APaintSelectionThing);
}
else
{
APaintSelectionThing = 0;
}
}
}
LABEL_42:
(*(void(__thiscall**)(DWORD*, int))(ChoosePaintScreen[19] + 32))(ChoosePaintScreen + 19, 1);
if (ChoosePaintScreen[22])
ChoosePaintScreen[93] = ChoosePaintScreen_GetPaintBrandHashFromCarSlotId(ChoosePaintScreen, *(DWORD*)(ChoosePaintScreen[22] + 72));
else
ChoosePaintScreen[93] = bStringHash("GLOSS");
}
void __fastcall ChoosePaintScreen_ScrollPaintTypes(DWORD* ChoosePaintScreen, void* EDX_Unused, unsigned int MessageHash)
{
DWORD v4; // eax
DWORD* v5; // eax
DWORD v6; // ecx
DWORD v7; // eax
DWORD* v8; // eax
int v10; // eax
DWORD CurrPaintType = ChoosePaintScreen[93];
char const* PackageName = (char const* )ChoosePaintScreen[1];
switch (MessageHash)
{
case 0x5073EF13: // PAD_LTRIGGER
switch (CurrPaintType)
{
case 0x2DAAB07: // GLOSS
ChoosePaintScreen[93] = 0x66350F0;
break;
case 0x3437A52: // METAL
ChoosePaintScreen[93] = 0x2DAAB07;
break;
case 0x3797533: // PEARL
ChoosePaintScreen[93] = 0x3437A52;
break;
case 0x16BDCE: // HOSE
ChoosePaintScreen[93] = 0x3797533;
break;
case 0x66350F0: // MUFFLER
ChoosePaintScreen[93] = 0x16BDCE;
break;
}
break;
case 0xD9FEEC59: // PAD_RTRIGGER
switch (CurrPaintType)
{
case 0x2DAAB07: // GLOSS
ChoosePaintScreen[93] = 0x3437A52;
break;
case 0x3437A52: // METAL
ChoosePaintScreen[93] = 0x3797533;
break;
case 0x3797533: // PEARL
ChoosePaintScreen[93] = 0x16BDCE;
break;
case 0x16BDCE: // HOSE
ChoosePaintScreen[93] = 0x66350F0;
break;
case 0x66350F0: // MUFFLER
ChoosePaintScreen[93] = 0x2DAAB07;
break;
}
break;
}
if (ChoosePaintScreen[93] == CurrPaintType)
return;
v4 = ChoosePaintScreen[90];
if (v4)
{
v5 = *(DWORD**)(v4 + 16);
if (v5)
FEngSetScript_Obj(v5, "Unhighlight", 1);
}
ChoosePaintScreen_BuildPaintList(ChoosePaintScreen);
if ((DWORD*)ChoosePaintScreen[86] == ChoosePaintScreen + 86)
{
FEngSetInvisible_Pkg(PackageName, 0x9BA6D658);
FEngSetScript_Pkg(PackageName, 0x23A43844, "SHOW", 1);
if (*(int*)0x850078 == 1)
FEngSetInvisible_Pkg(PackageName, 0x13C45E);
goto RefreshHeader;
}
FEngSetVisible_Pkg(PackageName, 0x9BA6D658);
FEngSetScript_Pkg(PackageName, 0x9BA6D658, "BLINK", 1);
FEngSetScript_Pkg(PackageName, 0x23A43844, "HIDE", 1);
if (*(int*)0x850078 == 1)
FEngSetVisible_Pkg(PackageName, 0x13C45E);
v6 = ChoosePaintScreen[90];
if (!v6 || (v7 = ChoosePaintScreen[22]) == 0)
{
RefreshHeader:
(*(void(__thiscall**)(DWORD*))(*ChoosePaintScreen + 16))(ChoosePaintScreen);
return;
}
CarCustomizeManager_PreviewPaintPart(
(DWORD*)gCarCustomizeManager_0,
*(DWORD*)(v7 + 72),
*(DWORD**)(v6 + 8));
v8 = *(DWORD**)(ChoosePaintScreen[90] + 16);
if (v8)
FEngSetScript_Obj(v8, "Highlight", 1);
v10 = PlayerCareerState_GetCarPartCost(
(DWORD*)ThePlayerCareer,
*(DWORD*)(ChoosePaintScreen[22] + 72),
*(DWORD**)(ChoosePaintScreen[90] + 8));
FEPrintf_ObjName(PackageName, "CASH", "%$d", v10);
(*(void(__thiscall**)(DWORD*))(*ChoosePaintScreen + 16))(ChoosePaintScreen);
}