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
|
#include "common.h"
#include "Script.h"
#include "ScriptCommands.h"
#include "CarCtrl.h"
#include "DMAudio.h"
#include "Frontend.h"
#include "GameLogic.h"
#include "General.h"
#include "Hud.h"
#include "Messages.h"
#include "Object.h"
#include "Pad.h"
#include "Pickups.h"
#include "PlayerPed.h"
#include "Pools.h"
#include "Vehicle.h"
#include "SpecialFX.h"
#include "Stats.h"
#include "User.h"
#include "Weather.h"
#include "World.h"
bool gDeveloperFlag;
int8 CRunningScript::ProcessCommands1600To1699(int32 command)
{
switch (command) {
case COMMAND_ADD_NOODLES_DELIEVERED:
CollectParameters(&m_nIp, 1);
// CStats::NoodlesDelievered += GET_INTEGER_PARAM(0);
return 0;
case COMMAND_REGISTER_SCRAPYARD_CHALLENGE_SCORE:
//CStats::TopScrapyardChallengeScore = Max(CStats::TopScrapyardChallengeScore, GET_INTEGER_PARAM(0));
return 0;
case COMMAND_REGISTER_9MM_MAYHEM_SCORE:
//CStats::Top9mmMayhemScore = Max(CStats::Top9mmMayhemScore, GET_INTEGER_PARAM(0));
return 0;
case COMMAND_REGISTER_SCOOTER_SHOOTER_SCORE:
//CStats::TopScooterShooterScore = Max(CStats::TopScooterShooterScore, GET_INTEGER_PARAM(0));
return 0;
case COMMAND_ADD_MONEY_MADE_FROM_TOURIST:
CollectParameters(&m_nIp, 1);
// CStats::MoneyMadeFromTourist += GET_INTEGER_PARAM(0);
return 0;
case COMMAND_ADD_TOURISTS_TAKEN_TO_SPOTS:
CollectParameters(&m_nIp, 1);
// CStats::TouristsTakenToSpots += GET_INTEGER_PARAM(0);
return 0;
case COMMAND_ADD_EXPORTED_CARS:
CollectParameters(&m_nIp, 1);
// CStats::NumberOfExportedCars += GET_INTEGER_PARAM(0);
return 0;
case COMMAND_SET_TOTAL_EXPORT_CARS:
CollectParameters(&m_nIp, 1);
// CStats::TotalNumberOfCarExport = GET_INTEGER_PARAM(0);
return 0;
case COMMAND_REGISTER_DIRT_BIKE_FASTEST_LAP:
CollectParameters(&m_nIp, 2);
// CStats::RegisterDirtBikeFastestLap(GET_INTEGER_PARAM(0), GET_INTEGER_PARAM(1));
return 0;
case COMMAND_REGISTER_DIRT_BIKE_FASTEST_TIME:
CollectParameters(&m_nIp, 2);
// CStats::RegisterDirtBikeFastestTime(GET_INTEGER_PARAM(0), GET_INTEGER_PARAM(1));
return 0;
case COMMAND_REGISTER_DIRT_BIKE_AIR_TIME:
//CStats::DirtBikeMostAir = Max(CStats::DirtBikeMostAir, GET_INTEGER_PARAM(0));
return 0;
case COMMAND_ADD_ARROW_3D_MARKER:
{
uint32 ip = m_nIp;
uint32 id = (uint32)(uintptr)GetPointerToScriptVariable(&m_nIp, 0);
CollectParameters(&m_nIp, 10);
CVector pos = GET_VECTOR_PARAM(0);
CVector dir = GET_VECTOR_PARAM(3);
pos.z += GET_FLOAT_PARAM(9) + 7.0f;
//C3dMarkers::PlaceMarker(id, MARKERTYPE_ARROW, pos, GET_INTEGER_PARAM(6), GET_INTEGER_PARAM(7), GET_INTEGER_PARAM(8), 200, 1, 3.2f, 1, dir, 1.0f, 0, 0); - TODO
return 0;
}
case COMMAND_PRINT_NOW_OVERRIDE_FADE:
{
wchar* key = CTheScripts::GetTextByKeyFromScript(&m_nIp);
CollectParameters(&m_nIp, 2);
CMessages::AddMessageJumpQ(key, GET_INTEGER_PARAM(0), GET_INTEGER_PARAM(1)); // true, true
return 0;
}
case COMMAND_GET_PICKUP_VALUE:
{
CollectParameters(&m_nIp, 1);
SET_INTEGER_PARAM(0, CPickups::GetValue(GET_INTEGER_PARAM(0)));
return 0;
}
case COMMAND_SET_PICKUP_VALUE:
{
CollectParameters(&m_nIp, 2);
CPickups::SetValue(GET_INTEGER_PARAM(0), GET_INTEGER_PARAM(1));
return 0;
}
case COMMAND_IS_DEVELOPER:
UpdateCompareFlag(gDeveloperFlag);
return 0;
case COMMAND_SET_DEVELOPER_FLAG:
CollectParameters(&m_nIp, 1);
gDeveloperFlag = GET_INTEGER_PARAM(0);
return 0;
case COMMAND_REGISTER_WICHITA_WIPEOUT_SCORE:
CollectParameters(&m_nIp, 1);
//CStats::TopWichitaWipeoutScore = Max(CStats::TopWichitaWipeoutScore, GET_INTEGER_PARAM(0));
return 0;
case COMMAND_ATTACH_OBJECT_TO_CAR:
{
CollectParameters(&m_nIp, 5);
CObject* pObject = CPools::GetObjectPool()->GetAt(GET_INTEGER_PARAM(0));
script_assert(pObject);
CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(GET_INTEGER_PARAM(1));
script_assert(pVehicle);
CVector offset = GET_VECTOR_PARAM(2);
// pObject->AttachObjectToEntity(pVehicle, offset);
return 0;
}
case COMMAND_DETACH_OBJECT_FROM_CAR:
{
CollectParameters(&m_nIp, 1);
CObject* pObject = CPools::GetObjectPool()->GetAt(GET_INTEGER_PARAM(0));
script_assert(pObject);
// if (pObject && pObject->m_pAttachedTo)
// pObject->DettachObjectFromEntity();
return 0;
}
case COMMAND_SET_PAD_STICKS_MULTIPLIER:
{
CollectParameters(&m_nIp, 2);
CPad::GetPad(0)->unk_B4 = GET_FLOAT_PARAM(0);
CPad::GetPad(0)->unk_B8 = GET_FLOAT_PARAM(1);
return 0;
}
case COMMAND_PRINT_SUBTITLE_NOW:
{
wchar* key = CTheScripts::GetTextByKeyFromScript(&m_nIp);
CollectParameters(&m_nIp, 2);
if (FrontEndMenuManager.m_PrefsShowSubtitles)
CMessages::AddMessageJumpQ(key, GET_INTEGER_PARAM(0), GET_INTEGER_PARAM(1)); // false, true
else
CMessages::AddToPreviousBriefArray(key, -1, -1, -1, -1, -1, -1, nil);
return 0;
}
case COMMAND_PRINT_SUBTITLE_NOW_OVERRIDE_FADE:
{
wchar* key = CTheScripts::GetTextByKeyFromScript(&m_nIp);
CollectParameters(&m_nIp, 2);
if (FrontEndMenuManager.m_PrefsShowSubtitles)
CMessages::AddMessageJumpQ(key, GET_INTEGER_PARAM(0), GET_INTEGER_PARAM(1)); // true, true
else
CMessages::AddToPreviousBriefArray(key, -1, -1, -1, -1, -1, -1, nil);
return 0;
}
case COMMAND_PRINT_SUBTITLE_NOW_NO_BRIEF:
{
wchar* key = CTheScripts::GetTextByKeyFromScript(&m_nIp);
CollectParameters(&m_nIp, 2);
if (FrontEndMenuManager.m_PrefsShowSubtitles)
CMessages::AddMessageJumpQ(key, GET_INTEGER_PARAM(0), GET_INTEGER_PARAM(1)); // false, false
else
CMessages::AddToPreviousBriefArray(key, -1, -1, -1, -1, -1, -1, nil);
return 0;
}
case COMMAND_PRINT_WITH_NUMBER_NOW_NO_BRIEF:
{
wchar* key = CTheScripts::GetTextByKeyFromScript(&m_nIp);
CollectParameters(&m_nIp, 3);
CMessages::AddMessageJumpQWithNumber(key, GET_INTEGER_PARAM(1), GET_INTEGER_PARAM(2), GET_INTEGER_PARAM(0), -1, -1, -1, -1, -1); // 0
return 0;
}
case COMMAND_GET_ANGLE_BETWEEN_POINTS:
{
CollectParameters(&m_nIp, 4);
SET_FLOAT_PARAM(0, CGeneral::GetAngleBetweenPoints(GET_FLOAT_PARAM(0), GET_FLOAT_PARAM(1), GET_FLOAT_PARAM(2), GET_FLOAT_PARAM(3)));
StoreParameters(&m_nIp, 1);
return 0;
}
case COMMAND_OVERRIDE_CHAR_MOVE_ANIM:
{
CollectParameters(&m_nIp, 1);
CPed* pPed = CPools::GetPedPool()->GetAt(GET_INTEGER_PARAM(0));
script_assert(pPed);
pPed->bOverrideMoveAnim = true;
return 0;
}
case COMMAND_1627:
{
CollectParameters(&m_nIp, 1);
// something related to debug menu, not implemented
return 0;
}
case COMMAND_ENABLE_EMERGENCY_VEHICLES:
{
CollectParameters(&m_nIp, 1);
gbEmergencyVehiclesEnabled = GET_INTEGER_PARAM(0) != 0;
return 0;
}
case COMMAND_ADD_UNLOCKED_COSTUME:
CollectParameters(&m_nIp, 1);
// CStats::AddUnlockedCostume(GET_INTEGER_PARAM(0));
return 0;
case COMMAND_CLEAR_MULTIPLAYER_SPLASH_SCREEN:
// ClearMultiplayerSplashScreen();
return 0;
case COMMAND_PRINT_WITH_2_NUMBERS_NOW_NO_BRIEF:
{
wchar* key = CTheScripts::GetTextByKeyFromScript(&m_nIp);
CollectParameters(&m_nIp, 3);
CMessages::AddMessageJumpQWithNumber(key, GET_INTEGER_PARAM(2), GET_INTEGER_PARAM(3), GET_INTEGER_PARAM(0), GET_INTEGER_PARAM(1), -1, -1, -1, -1); // 0
return 0;
}
case COMMAND_GET_OBJECT_ORIENTATION:
{
CollectParameters(&m_nIp, 1);
CObject* pObject = CPools::GetObjectPool()->GetAt(GET_INTEGER_PARAM(0));
script_assert(pObject);
SET_FLOAT_PARAM(1, LimitAngleOnCircle(RADTODEG(Asin(pObject->GetForward().z))));
SET_FLOAT_PARAM(2, LimitAngleOnCircle(RADTODEG(CGeneral::GetATanOfXY(pObject->GetForward().x, pObject->GetForward().y))));
SET_FLOAT_PARAM(0, LimitAngleOnCircle(RADTODEG(CGeneral::GetATanOfXY(pObject->GetUp().z, pObject->GetRight().z))));
StoreParameters(&m_nIp, 3);
return 0;
}
case COMMAND_SET_OBJECT_ORIENTATION:
{
CollectParameters(&m_nIp, 4);
CObject* pObject = CPools::GetObjectPool()->GetAt(GET_INTEGER_PARAM(0));
script_assert(pObject);
pObject->SetOrientation(DEGTORAD(GET_FLOAT_PARAM(2)), DEGTORAD(GET_FLOAT_PARAM(1)), DEGTORAD(GET_FLOAT_PARAM(3)));
return 0;
}
case COMMAND_CHANGE_ONSCREEN_COUNTER_PREFIX:
{
uint16 offset = (uint8*)GetPointerToScriptVariable(&m_nIp, VAR_GLOBAL) - CTheScripts::ScriptSpace;
CollectParameters(&m_nIp, 1);
//CUserDisplay::OnscnTimer.ChangeCounterPrefix(offset, GET_INTEGER_PARAMS(0));
return 0;
}
case COMMAND_STORE_PLAYER_OUTFIT:
{
char tmp[12]; // TODO
CTheScripts::ReadTextLabelFromScript(&m_nIp, tmp);
for (int i = 0; i < KEY_LENGTH_IN_SCRIPT; i++)
CGameLogic::mStoredPlayerOutfit[i] = tmp[i];
printf("STORED PLAYOUR OUTFIT : %s\n", CGameLogic::mStoredPlayerOutfit);
m_nIp += KEY_LENGTH_IN_SCRIPT;
return 0;
}
case COMMAND_DISPLAY_ONSCREEN_TIMER_WITH_NUMBER_AND_STRING:
{
char onscreen_str1[12];
uint16 var = (uint8*)GetPointerToScriptVariable(&m_nIp, 0) - CTheScripts::ScriptSpace;
CollectParameters(&m_nIp, 2);
wchar* text = TheText.Get((char*)&CTheScripts::ScriptSpace[m_nIp]);
strncpy(onscreen_str1, (char*)&CTheScripts::ScriptSpace[m_nIp], KEY_LENGTH_IN_SCRIPT);
m_nIp += KEY_LENGTH_IN_SCRIPT;
CUserDisplay::OnscnTimer.AddCounter(var, GET_INTEGER_PARAM(1), onscreen_str1, 0); // TODO - second set of data
return 0;
}
case COMMAND_SET_PLAYER_CURRENT_WEAPON_AMMO_IN_CLIP:
{
CollectParameters(&m_nIp, 1);
CWeapon* pWeapon = FindPlayerPed()->GetWeapon();
if (pWeapon && GET_INTEGER_PARAM(0))
pWeapon->m_nAmmoInClip = GET_INTEGER_PARAM(0);
return 0;
}
case COMMAND_SET_CHAR_WAIT_STATE_REPEAT:
{
CollectParameters(&m_nIp, 3);
CPed* pPed = CPools::GetPedPool()->GetAt(GET_INTEGER_PARAM(0));
if (pPed)
pPed->SetWaitState((eWaitState)GET_INTEGER_PARAM(0), GET_INTEGER_PARAM(1) >= 0 ? (void*)GET_INTEGER_PARAM(0) : nil); // + true
return 0;
}
case COMMAND_REGISTER_BEST_TIME_GOGO_FAGGIO:
CollectParameters(&m_nIp, 1);
// CStats::RegisterBestTimeGoGoFaggio(GET_INTEGER_PARAM(0));
return 0;
case COMMAND_LOCK_GARAGE:
CollectParameters(&m_nIp, 2);
// CGarages::LockGarage(GET_INTEGER_PARAM(0), GET_INTEGER_PARAM(1));
return 0;
case COMMAND_IS_FINAL_GAME:
#ifdef FINAL
UpdateCompareFlag(false);
#else
UpdateCompareFlag(true);
#endif
return 0;
case COMMAND_SET_ALLOWED_COLLISION:
{
CollectParameters(&m_nIp, 2);
CTheScripts::AllowedCollision[0] = GET_INTEGER_PARAM(0);
CTheScripts::AllowedCollision[1] = GET_INTEGER_PARAM(1);
return 0;
}
case COMMAND_REGISTER_GUARDIAN_ANGEL_LEVEL:
CollectParameters(&m_nIp, 3);
//CStats::GuardianAngelHighestLevel_Ind = Max(CStats::GuardianAngelHighestLevel_Ind, GET_INTEGER_PARAM(0));
//CStats::GuardianAngelHighestLevel_Com = Max(CStats::GuardianAngelHighestLevel_Com, GET_INTEGER_PARAM(1));
//CStats::GuardianAngelHighestLevel_Sub = Max(CStats::GuardianAngelHighestLevel_Sub, GET_INTEGER_PARAM(2));
return 0;
case COMMAND_DISPLAY_ONSCREEN_TIMER_WITH_NUMBER_AND_2_STRINGS:
{
char onscreen_str1[12];
char onscreen_str2[12];
uint16 var = (uint8*)GetPointerToScriptVariable(&m_nIp, 0) - CTheScripts::ScriptSpace;
CollectParameters(&m_nIp, 3);
wchar* text = TheText.Get((char*)&CTheScripts::ScriptSpace[m_nIp]);
strncpy(onscreen_str1, (char*)&CTheScripts::ScriptSpace[m_nIp], KEY_LENGTH_IN_SCRIPT);
m_nIp += KEY_LENGTH_IN_SCRIPT;
wchar* text2 = TheText.Get((char*)&CTheScripts::ScriptSpace[m_nIp]);
strncpy(onscreen_str2, (char*)&CTheScripts::ScriptSpace[m_nIp], KEY_LENGTH_IN_SCRIPT);
m_nIp += KEY_LENGTH_IN_SCRIPT;
CUserDisplay::OnscnTimer.AddCounter(var, GET_INTEGER_PARAM(1), onscreen_str1, 0); // TODO - second set of data
}
case COMMAND_GET_PLAYER_STORED_WEAPON:
{
CollectParameters(&m_nIp, 1);
CPed* pPed = CWorld::Players[GET_INTEGER_PARAM(0)].m_pPed;
script_assert(pPed);
SET_INTEGER_PARAM(0, pPed->m_storedWeapon);
StoreParameters(&m_nIp, 1);
return 0;
}
case COMMAND_DISABLE_PAUSE_MENU:
CollectParameters(&m_nIp, 1);
// FrontEndMenuManager.mDisablePauseMenu = GET_INTEGER_PARAM(0) != 0; // TODO: static + member
return 0;
case COMMAND_IS_CHANNEL_PLAYING:
CollectParameters(&m_nIp, 1);
//UpdateCompareFlag(DMAudio.IsChannelPlaying(GET_INTEGER_PARAM(0));
UpdateCompareFlag(false);
return 0;
case COMMAND_SET_CLOCK_EVENT_WARNING:
CollectParameters(&m_nIp, 3);
/*
if (CHud::m_ClockEventWarningMinutes || GET_INTEGER_PARAMS(2)){
CHud::m_ClockEventWarningMinutes = GET_INTEGER_PARAMS(2);
CHud::m_ClockEventMinutes = GET_INTEGER_PARAMS(1);
CHud::m_ClockEventHours = GET_INTEGER_PARAMS(0);
CHud::m_ClockEventFlashTimer = 0;
}
*/
return 0;
case COMMAND_SET_EXTRA_COLOUR_LIGHT_DIRECTION:
CollectParameters(&m_nIp, 3);
// CWeather::ExtraColourLightDir = GET_VECTOR_PARAM(0);
// CWeather::ExtraColourLightDir.Normalise();
return 0;
case COMMAND_SET_CHAR_CAN_BE_TARGETTED_BY_LEADER:
{
CollectParameters(&m_nIp, 2);
CPed* pPed = CPools::GetPedPool()->GetAt(GET_INTEGER_PARAM(0));
script_assert(pPed);
pPed->bCanBeTargettedByLeader = GET_INTEGER_PARAM(1) != 0;
return 0;
}
case COMMAND_PRINT_HELP_NO_BRIEF:
{
wchar* text = CTheScripts::GetTextByKeyFromScript(&m_nIp);
CHud::SetHelpMessage(text, false); // + false, false
return 0;
}
case COMMAND_PRINT_HELP_FOREVER_NO_BRIEF:
{
wchar* text = CTheScripts::GetTextByKeyFromScript(&m_nIp);
CHud::SetHelpMessage(text, false, true); // + false
return 0;
}
case COMMAND_PRINT_HELP_ALWAYS_NO_BRIEF:
{
// CHud::mAlwaysAllowHelpText = true;
wchar* text = CTheScripts::GetTextByKeyFromScript(&m_nIp);
CHud::SetHelpMessage(text, false); // + false, false
return 0;
}
case COMMAND_PRINT_HELP_FOREVER_ALWAYS_NO_BRIEF:
{
// CHud::mAlwaysAllowHelpText = true;
wchar* text = CTheScripts::GetTextByKeyFromScript(&m_nIp);
CHud::SetHelpMessage(text, false, true); // + false
return 0;
}
case COMMAND_SET_MISSION_CAR_CAN_BE_STORED_IN_GARAGE:
{
CollectParameters(&m_nIp, 2);
CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(GET_INTEGER_PARAM(0));
script_assert(pVehicle);
pVehicle->bAllowGarageToStore = (GET_INTEGER_PARAM(1) != 0);
return 0;
}
case COMMAND_FREEZE_ALL_PLAYER_FOLLOWERS:
{
CollectParameters(&m_nIp, 2);
CPlayerPed* pPlayerPed = CWorld::Players[GET_INTEGER_PARAM(0)].m_pPed;
script_assert(pPlayerPed);
for (int i = 0; i < CPools::GetVehiclePool()->GetSize(); i++) {
CPed* pPed = CPools::GetPedPool()->GetSlot(i);
if (pPed && IsPedPointerValid(pPed)) {
if (pPed->m_leader == pPlayerPed || (pPed->m_objective == OBJECTIVE_FOLLOW_CHAR_IN_FORMATION && pPed->m_pedInObjective == pPlayerPed))
pPed->bIsFrozen = (GET_INTEGER_PARAM(1) != 0);
}
}
return 0;
}
default:
script_assert(0);
}
return -1;
}
|