summaryrefslogtreecommitdiffstats
path: root/src/control/Script8.cpp
blob: 2f52b1501014dc562799340ef9bfce9e33209cf6 (plain) (blame)
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
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
#include "common.h"

#include "Script.h"
#include "ScriptCommands.h"

#include "DMAudio.h"
#if ((defined GTAVC_JP_PATCH || defined SUPPORT_JAPANESE_SCRIPT) && defined MORE_LANGUAGES)
#include "Frontend.h"
#endif
#include "GameLogic.h"
#include "Garages.h"
#ifdef MISSION_REPLAY
#include "GenericGameStorage.h"
#endif
#if (defined GTA_PC && !defined GTAVC_JP_PATCH || defined GTA_XBOX || defined SUPPORT_XBOX_SCRIPT || defined GTA_MOBILE || defined SUPPORT_MOBILE_SCRIPT)
#include "General.h"
#include "maths.h"
#endif
#include "Hud.h"
#include "Pad.h"
#include "PedAttractor.h"
#include "Population.h"
#include "Pools.h"
#include "RpAnimBlend.h"
#include "Stats.h"
#include "VisibilityPlugins.h"
#include "Wanted.h"
#include "WaterLevel.h"
#include "World.h"
#include "Zones.h"

int8 CRunningScript::ProcessCommands1400To1499(int32 command)
{
	switch (command) {
	case COMMAND_REGISTER_VIGILANTE_LEVEL:
		CollectParameters(&m_nIp, 1);
		CStats::RegisterLevelVigilanteMission(ScriptParams[0]);
		return 0;
	case COMMAND_CLEAR_ALL_CHAR_ANIMS:
	{
		CollectParameters(&m_nIp, 1);
		CPed* pPed = CPools::GetPedPool()->GetAt(ScriptParams[0]);
		script_assert(pPed);
		if (!pPed->bInVehicle) {
			pPed->m_pVehicleAnim = nil;
			pPed->RestartNonPartialAnims();
			RpAnimBlendClumpRemoveAllAssociations(pPed->GetClump());
			pPed->SetPedState(PED_IDLE);
			pPed->SetMoveState(PEDMOVE_STILL);
			pPed->m_nLastPedState = PED_NONE;
			pPed->ClearAimFlag();
			pPed->ClearLookFlag();
			pPed->bIsPointingGunAt = false;
			if (pPed->IsPlayer())
				((CPlayerPed*)pPed)->m_fMoveSpeed = 0.0f;
			else
				pPed->m_nStoredMoveState = PEDMOVE_STILL;
			CAnimManager::AddAnimation(pPed->GetClump(), pPed->m_animGroup, ANIM_IDLE_STANCE);
			pPed->bIsPedDieAnimPlaying = false;
		}
		return 0;
	}
	case COMMAND_SET_MAXIMUM_NUMBER_OF_CARS_IN_GARAGE:
		CollectParameters(&m_nIp, 2);
		CGarages::SetMaxNumStoredCarsForGarage(ScriptParams[0], ScriptParams[1]);
		return 0;
	case COMMAND_WANTED_STARS_ARE_FLASHING:
	{
		CWanted *pWanted = CWorld::Players[CWorld::PlayerInFocus].m_pPed->m_pWanted;
		UpdateCompareFlag(pWanted->m_nMinWantedLevel - pWanted->m_nWantedLevel > 0);
		return 0;
	}
	case COMMAND_SET_ALLOW_HURRICANES:
		CollectParameters(&m_nIp, 1);
		CStats::NoMoreHurricanes = ScriptParams[0];
		return 0;
	case COMMAND_PLAY_ANNOUNCEMENT:
	{
		CollectParameters(&m_nIp, 1);
		DMAudio.PlayRadioAnnouncement(ScriptParams[0] + STREAMED_SOUND_NEWS_A);
		return 0;
	}
	case COMMAND_SET_PLAYER_IS_IN_STADIUM:
	{
		CollectParameters(&m_nIp, 1);
		CTheScripts::bPlayerIsInTheStatium = ScriptParams[0];
		return 0;
	}
	case COMMAND_GET_BUS_FARES_COLLECTED_BY_PLAYER:
	{
		CollectParameters(&m_nIp, 1);
		CPlayerInfo* pPlayerInfo = &CWorld::Players[ScriptParams[0]];
		ScriptParams[0] = pPlayerInfo->m_pPed->m_nLastBusFareCollected;
		pPlayerInfo->m_pPed->m_nLastBusFareCollected = 0;
		StoreParameters(&m_nIp, 1);
		return 0;
	}
	case COMMAND_SET_CHAR_OBJ_BUY_ICE_CREAM:
	{
		CollectParameters(&m_nIp, 2);
		CPed* pPed = CPools::GetPedPool()->GetAt(ScriptParams[0]);
		script_assert(pPed);
		CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(ScriptParams[1]);
		script_assert(pVehicle);
		ScriptParams[0] = 0;
		if (pPed->m_objective == OBJECTIVE_NONE && !pPed->bHasAlreadyUsedAttractor) {
			C2dEffect* pEffect = (C2dEffect*)GetPedAttractorManager()->GetEffectForIceCreamVan(pVehicle, pPed->GetPosition()); // has to be casted, because inner methods are const
			if (pEffect) {
				CVector pos;
				CPedAttractorManager::ComputeEffectPos(pEffect, pVehicle->GetMatrix(), pos);
				if ((pPed->GetPosition() - pos).MagnitudeSqr() < SQR(20.0f)) {
					if (GetPedAttractorManager()->HasEmptySlot(pEffect) && GetPedAttractorManager()->IsApproachable(pEffect, pVehicle->GetMatrix(), 0, pPed)) {
						if (GetPedAttractorManager()->RegisterPedWithAttractor(pPed, pEffect, pVehicle->GetMatrix()))
							ScriptParams[0] = 1;
					}
				}
			}
		}
		StoreParameters(&m_nIp, 1);
		return 0;
	}
	case COMMAND_DISPLAY_RADAR:
		CollectParameters(&m_nIp, 1);
		CHud::m_HideRadar = ScriptParams[0] == 0;
		return 0;
	case COMMAND_REGISTER_BEST_POSITION:
		CollectParameters(&m_nIp, 2);
		CStats::RegisterBestPosition(ScriptParams[0], ScriptParams[1]);
		return 0;
	case COMMAND_IS_PLAYER_IN_INFO_ZONE:
	{
		CollectParameters(&m_nIp, 1);
		CPlayerInfo* pPlayerInfo = &CWorld::Players[ScriptParams[0]];
		char key[KEY_LENGTH_IN_SCRIPT];
		memset(key, 0, KEY_LENGTH_IN_SCRIPT);
		CTheScripts::ReadTextLabelFromScript(&m_nIp, key);
		m_nIp += KEY_LENGTH_IN_SCRIPT;
		CVector pos = pPlayerInfo->GetPos();
		CZone *infoZone = CTheZones::FindInformationZoneForPosition(&pos);
		UpdateCompareFlag(strncmp(key, infoZone->name, 8) == 0); // original code doesn't seem to be using strncmp in here and compare 2 ints instead
		return 0;
	}
	case COMMAND_CLEAR_CHAR_ICE_CREAM_PURCHASE:
	{
		CollectParameters(&m_nIp, 1);
		CPed* pPed = CPools::GetPedPool()->GetAt(ScriptParams[0]);
		script_assert(pPed);
		if (pPed->m_attractor)
			GetPedAttractorManager()->DeRegisterPed(pPed, pPed->m_attractor);
		return 0;
	}
	case COMMAND_IS_IN_CAR_FIRE_BUTTON_PRESSED:
		UpdateCompareFlag(CPad::GetPad(0)->GetCarGunFired());
		return 0;
	case COMMAND_HAS_CHAR_ATTEMPTED_ATTRACTOR:
	{
		CollectParameters(&m_nIp, 1);
		CPed* pPed = CPools::GetPedPool()->GetAt(ScriptParams[0]);
		script_assert(pPed);
		UpdateCompareFlag(pPed->bHasAlreadyUsedAttractor);
		return 0;
	}
	case COMMAND_SET_LOAD_COLLISION_FOR_CAR_FLAG:
	{
		CollectParameters(&m_nIp, 2);
		CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(ScriptParams[0]);
		script_assert(pVehicle);
		if (ScriptParams[1]) {
			pVehicle->bDontLoadCollision = false;
			if (m_bMissionFlag) {
				CWorld::Remove(pVehicle);
				pVehicle->bIsStaticWaitingForCollision = true;
				CWorld::Add(pVehicle);
			}
		}
		else {
			pVehicle->bDontLoadCollision = true;
			if (pVehicle->bIsStaticWaitingForCollision) {
				pVehicle->bIsStaticWaitingForCollision = false;
				if (!pVehicle->GetIsStatic())
					pVehicle->AddToMovingList();
			}
		}
		return 0;
	}
	case COMMAND_SET_LOAD_COLLISION_FOR_CHAR_FLAG:
	{
		CollectParameters(&m_nIp, 2);
		CPed* pPed = CPools::GetPedPool()->GetAt(ScriptParams[0]);
		script_assert(pPed);
		if (ScriptParams[1]) {
			pPed->bDontLoadCollision = false;
			if (m_bMissionFlag) {
				CWorld::Remove(pPed);
				pPed->bIsStaticWaitingForCollision = true;
				CWorld::Add(pPed);
			}
		}
		else {
			pPed->bDontLoadCollision = true;
			if (pPed->bIsStaticWaitingForCollision) {
				pPed->bIsStaticWaitingForCollision = false;
				if (!pPed->GetIsStatic())
					pPed->AddToMovingList();
			}
		}
		return 0;
	}
	//case COMMAND_SET_LOAD_COLLISION_FOR_OBJECT_FLAG:
	case COMMAND_ADD_BIG_GUN_FLASH:
	{
		CollectParameters(&m_nIp, 6);
		CWeapon::AddGunFlashBigGuns(*(CVector*)&ScriptParams[0], *(CVector*)&ScriptParams[3]);
		return 0;
	}
	case COMMAND_HAS_CHAR_BOUGHT_ICE_CREAM:
	{
		CollectParameters(&m_nIp, 1);
		CPed* pPed = CPools::GetPedPool()->GetAt(ScriptParams[0]);
		script_assert(pPed);
		UpdateCompareFlag(pPed->bBoughtIceCream);
		return 0;
	}
	case COMMAND_GET_PROGRESS_PERCENTAGE:
		*(float*)&ScriptParams[0] = CStats::GetPercentageProgress();
		StoreParameters(&m_nIp, 1);
		return 0;
	case COMMAND_SET_SHORTCUT_PICKUP_POINT:
	{
		CollectParameters(&m_nIp, 4);
		CGameLogic::AddShortCutPointAfterDeath(*(CVector*)&ScriptParams[0], *(float*)&ScriptParams[3]);
		return 0;
	}
	case COMMAND_SET_SHORTCUT_DROPOFF_POINT_FOR_MISSION:
	{
		CollectParameters(&m_nIp, 4);
		CGameLogic::AddShortCutDropOffPointForMission(*(CVector*)&ScriptParams[0], *(float*)&ScriptParams[3]);
		return 0;
	}
	case COMMAND_GET_RANDOM_ICE_CREAM_CUSTOMER_IN_AREA:
	{
		CollectParameters(&m_nIp, 7);
		int ped_handle = -1;
		CVector pos = FindPlayerCoors();
		float x1 = *(float*)&ScriptParams[0];
		float y1 = *(float*)&ScriptParams[1];
		float x2 = *(float*)&ScriptParams[2];
		float y2 = *(float*)&ScriptParams[3];
		int i = CPools::GetPedPool()->GetSize();
		while (--i && ped_handle == -1) {
			CPed* pPed = CPools::GetPedPool()->GetSlot(i);
			if (!pPed)
				continue;
			if (CTheScripts::LastRandomPedId == CPools::GetPedPool()->GetIndex(pPed))
				continue;
			if (pPed->CharCreatedBy != RANDOM_CHAR)
				continue;
			if (!pPed->IsPedInControl())
				continue;
			if (pPed->bRemoveFromWorld)
				continue;
			if (pPed->bFadeOut)
				continue;
			if (pPed->m_nWaitState != WAITSTATE_FALSE)
				continue;
			if (pPed->bHasAlreadyUsedAttractor)
				continue;
			if (pPed->m_attractor)
				continue;
			if (!ThisIsAValidRandomPed(pPed->m_nPedType, ScriptParams[4], ScriptParams[5], ScriptParams[6]))
				continue;
			if (pPed->bIsLeader || pPed->m_leader)
				continue;
			if (!pPed->IsWithinArea(x1, y1, x2, y2))
				continue;
			if (pos.z - PED_FIND_Z_OFFSET > pPed->GetPosition().z)
				continue;
			if (pos.z + PED_FIND_Z_OFFSET < pPed->GetPosition().z)
				continue;
			ped_handle = CPools::GetPedPool()->GetIndex(pPed);
			CTheScripts::LastRandomPedId = ped_handle;
			pPed->CharCreatedBy = MISSION_CHAR;
			pPed->bRespondsToThreats = false;
			++CPopulation::ms_nTotalMissionPeds;
			if (m_bIsMissionScript)
				CTheScripts::MissionCleanUp.AddEntityToList(ped_handle, CLEANUP_CHAR);
		}
		ScriptParams[0] = ped_handle;
		StoreParameters(&m_nIp, 1);
		return 0;
	}
	//case COMMAND_GET_RANDOM_ICE_CREAM_CUSTOMER_IN_ZONE:
	case COMMAND_UNLOCK_ALL_CAR_DOORS_IN_AREA:
	{
		CollectParameters(&m_nIp, 4);
		uint32 i = CPools::GetVehiclePool()->GetSize();
		float infX = *(float*)&ScriptParams[0];
		float infY = *(float*)&ScriptParams[1];
		float supX = *(float*)&ScriptParams[2];
		float supY = *(float*)&ScriptParams[3];
		while (i--) {
			CVehicle* pVehicle = CPools::GetVehiclePool()->GetSlot(i);
			if (!pVehicle)
				continue;
			if (pVehicle->IsWithinArea(infX, infY, supX, supY))
				pVehicle->m_nDoorLock = CARLOCK_UNLOCKED;
		}
		return 0;
	}
	case COMMAND_SET_GANG_ATTACK_PLAYER_WITH_COPS:
		CollectParameters(&m_nIp, 2);
		CGangs::SetWillAttackPlayerWithCops((ePedType)((int)PEDTYPE_GANG1 + ScriptParams[0]), !!ScriptParams[1]);
		return 0;
	case COMMAND_SET_CHAR_FRIGHTENED_IN_JACKED_CAR:
	{
		CollectParameters(&m_nIp, 2);
		CPed* pPed = CPools::GetPedPool()->GetAt(ScriptParams[0]);
		script_assert(pPed);
		pPed->bHeldHostageInCar = ScriptParams[1];
		return 0;
	}
	case COMMAND_SET_VEHICLE_TO_FADE_IN:
	{
		CollectParameters(&m_nIp, 2);
		CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(ScriptParams[0]);
		script_assert(pVehicle);
		CVisibilityPlugins::SetClumpAlpha(pVehicle->GetClump(), ScriptParams[1]);
		return 0;
	}
	case COMMAND_REGISTER_ODDJOB_MISSION_PASSED:
		++CStats::MissionsPassed;
		CStats::CheckPointReachedSuccessfully();
		CTheScripts::LastMissionPassedTime = CTimer::GetTimeInMilliseconds();
		CGameLogic::RemoveShortCutDropOffPointForMission();
		return 0;
	case COMMAND_IS_PLAYER_IN_SHORTCUT_TAXI:
	{
		CollectParameters(&m_nIp, 1);
		CPed* pPed = CWorld::Players[ScriptParams[0]].m_pPed;
		script_assert(pPed);
		UpdateCompareFlag(pPed->bInVehicle && pPed->m_pMyVehicle && pPed->m_pMyVehicle == CGameLogic::pShortCutTaxi);
		return 0;
	}
	case COMMAND_IS_CHAR_DUCKING:
	{
		CollectParameters(&m_nIp, 1);
		CPed* pPed = CPools::GetPedPool()->GetAt(ScriptParams[0]);
		script_assert(pPed);
		UpdateCompareFlag(RpAnimBlendClumpGetAssociation(pPed->GetClump(), ANIM_DUCK_DOWN) != nil);
		return 0;
	}
	case COMMAND_CREATE_DUST_EFFECT_FOR_CUTSCENE_HELI:
	{
		CollectParameters(&m_nIp, 3);
		CObject *pHeli = CPools::GetObjectPool()->GetAt(ScriptParams[0]);
		bool found = false;
		float waterLevel = -1000.0f;
		CVector pos = pHeli->GetPosition();
		float radius = *(float*)&ScriptParams[1];
		float ground = CWorld::FindGroundZFor3DCoord(pos.x, pos.y, pos.z, &found);
		if (!CWaterLevel::GetWaterLevel(pos.x, pos.y, pos.z, &waterLevel, false))
			waterLevel = 0.0f;
		if (waterLevel > ground)
			ground = waterLevel;
		if (ScriptParams[2] > 8)
			ScriptParams[2] = 8;
		CVehicle::HeliDustGenerate(pHeli, (pos.z - ground - 1.0f - radius) * 0.3 + radius, ground, ScriptParams[2]);
		return 0;
	}
	case COMMAND_REGISTER_FIRE_LEVEL:
		CollectParameters(&m_nIp, 1);
		CStats::RegisterLevelFireMission(ScriptParams[0]);
		return 0;
	case COMMAND_IS_AUSTRALIAN_GAME:
		UpdateCompareFlag(false); // should we make some check?
		return 0;
	case COMMAND_DISARM_CAR_BOMB:
	{
		CollectParameters(&m_nIp, 1);
		CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(ScriptParams[0]);
		if (pVehicle->m_bombType != CARBOMB_NONE) {
			pVehicle->m_bombType = CARBOMB_NONE;
			pVehicle->m_pBombRigger = nil;
		}
		return 0;
	}
	case COMMAND_IS_JAPANESE_GAME:
#ifdef MORE_LANGUAGES
		UpdateCompareFlag(FrontEndMenuManager.m_PrefsLanguage == LANGUAGE_JAPANESE);
#elif (defined GTAVC_JP_PATCH)
		UpdateCompareFlag(true);
#else
		UpdateCompareFlag(false);
#endif
		return 0;
	case COMMAND_1442:
		script_assert(false);
		return 0;
	case COMMAND_1443:
		script_assert(false);
		return 0;
	case COMMAND_1444:
		script_assert(false);
		return 0;
	case COMMAND_1445:
		script_assert(false);
		return 0;
	case COMMAND_1446:
		script_assert(false);
		return 0;
	case COMMAND_1447:
		script_assert(false);
		return 0;
	case COMMAND_1448:
		script_assert(false);
		return 0;
	case COMMAND_1449:
		script_assert(false);
		return 0;
	case COMMAND_1450:
		script_assert(false);
		return 0;
	case COMMAND_1451:
		CollectParameters(&m_nIp, 1);
		// TODO (GET_PAD_BUTTON_STATE)
		ScriptParams[0] = 0;
		StoreParameters(&m_nIp, 1);
		return 0;
	case COMMAND_1452:
		script_assert(false);
		return 0;
	case COMMAND_1453:
		script_assert(false);
		return 0;
	case COMMAND_CALL:
	case COMMAND_NOTCALL:
	{
		m_anStack[m_nStackPointer++] = m_nIp | BIT(STACKVALUE_IS_FUNCTION_CALL_BIT) | ((command == COMMAND_NOTCALL) ? BIT(STACKVALUE_INVERT_RETURN_BIT) : 0);
		uint8 nInputParams = CTheScripts::Read1ByteFromScript(&m_nIp);
		uint8 nOutputParameters = CTheScripts::Read1ByteFromScript(&m_nIp);
		uint8 nLocalsOffset = CTheScripts::Read1ByteFromScript(&m_nIp);
		uint32 nIPBeforeParameters = m_nIp;
		CollectParameters(&m_nIp, 1);
		if (nInputParams)
			CollectParameters(&m_nIp, nInputParams, &m_anLocalVariables[m_nLocalsPointer + nLocalsOffset]);
		m_nLocalsPointer += nLocalsOffset;
		m_anStack[m_nStackPointer - 1] |= (m_nIp - nIPBeforeParameters) << STACKVALUE_IP_PARAMS_OFFSET;
		if (ScriptParams[0] < 0)
			m_nIp = CTheScripts::MainScriptSize - ScriptParams[0];
		else
			m_nIp = ScriptParams[0];
		return 0;
	}
	case COMMAND_1456:
		script_assert(false);
		return 0;
	case COMMAND_1457:
		script_assert(false);
		return 0;
	case COMMAND_1458:
		script_assert(false);
		return 0;
	case COMMAND_1459:
		script_assert(false);
		return 0;
	case COMMAND_1460:
		script_assert(false);
		return 0;
	case COMMAND_1461:
		script_assert(false);
		return 0;
	case COMMAND_1462:
		script_assert(false);
		return 0;
	case COMMAND_1463:
		script_assert(false);
		return 0;
	case COMMAND_1464:
		script_assert(false);
		return 0;
	case COMMAND_1465:
		script_assert(false);
		return 0;
	case COMMAND_1466:
		script_assert(false);
		return 0;
	case COMMAND_1467:
		script_assert(false);
		return 0;
	case COMMAND_1468:
		script_assert(false);
		return 0;
	case COMMAND_1469:
		script_assert(false);
		return 0;
	case COMMAND_1470:
		script_assert(false);
		return 0;
	case COMMAND_1471:
		script_assert(false);
		return 0;
	case COMMAND_1472:
		script_assert(false);
		return 0;
	case COMMAND_1473:
		script_assert(false);
		return 0;
	case COMMAND_1474:
		script_assert(false);
		return 0;
	case COMMAND_1475:
		script_assert(false);
		return 0;
	case COMMAND_1476:
		script_assert(false);
		return 0;
	case COMMAND_1477:
		script_assert(false);
		return 0;
	case COMMAND_1478:
		script_assert(false);
		return 0;
	case COMMAND_1479:
		CollectParameters(&m_nIp, 2);
		// TODO (SET_CHAR_ONLY_ENTER_BACK_DOOR)
		return 0;
	case COMMAND_1480:
		script_assert(false);
		return 0;
	case COMMAND_1481:
		script_assert(false);
		return 0;
	case COMMAND_1482:
		script_assert(false);
		return 0;
	case COMMAND_1483:
		script_assert(false);
		return 0;
	case COMMAND_1484:
		script_assert(false);
		return 0;
	case COMMAND_1485:
		script_assert(false);
		return 0;
	case COMMAND_1486:
		script_assert(false);
		return 0;
	case COMMAND_1487:
		script_assert(false);
		return 0;
	case COMMAND_1488:
		script_assert(false);
		return 0;
	case COMMAND_1489:
		script_assert(false);
		return 0;
	case COMMAND_1490:
		script_assert(false);
		return 0;
	case COMMAND_1491:
		script_assert(false);
		return 0;
	case COMMAND_1492:
		script_assert(false);
		return 0;
	case COMMAND_1493:
		script_assert(false);
		return 0;
	case COMMAND_1494:
		script_assert(false);
		return 0;
	case COMMAND_1495:
		script_assert(false);
		return 0;
	case COMMAND_1496:
		script_assert(false);
		return 0;
	case COMMAND_1497:
		script_assert(false);
		return 0;
	case COMMAND_1498:
		script_assert(false);
		return 0;
	case COMMAND_1499:
		script_assert(false);
		return 0;
	default:
		script_assert(0);
	}
	return -1;
}

int8 CRunningScript::ProcessCommands1500To1599(int32 command)
{
	switch (command) {
	case COMMAND_1500:
		script_assert(false);
		return 0;
	case COMMAND_1501:
		script_assert(false);
		return 0;
	case COMMAND_1502:
		script_assert(false);
		return 0;
	case COMMAND_1503:
		script_assert(false);
		return 0;
	case COMMAND_1504:
		script_assert(false);
		return 0;
	case COMMAND_1505:
		script_assert(false);
		return 0;
	case COMMAND_1506:
		script_assert(false);
		return 0;
	case COMMAND_1507:
		script_assert(false);
		return 0;
	case COMMAND_1508:
		script_assert(false);
		return 0;
	case COMMAND_1509:
		script_assert(false);
		return 0;
	case COMMAND_1510:
		script_assert(false);
		return 0;
	case COMMAND_1511:
		script_assert(false);
		return 0;
	case COMMAND_1512:
		script_assert(false);
		return 0;
	case COMMAND_1513:
		script_assert(false);
		return 0;
	case COMMAND_1514:
		script_assert(false);
		return 0;
	case COMMAND_1515:
		script_assert(false);
		return 0;
	case COMMAND_1516:
		script_assert(false);
		return 0;
	case COMMAND_1517:
		script_assert(false);
		return 0;
	case COMMAND_1518:
		// TODO (?)
		UpdateCompareFlag(true);
		return 0;
	case COMMAND_1519:
		CollectParameters(&m_nIp, 1);
		// TODO (SET_NUMBER_USJ_FOUND?)
		return 0;
	case COMMAND_1520:
		CollectParameters(&m_nIp, 1);
		// TODO (SET_TOTAL_HIDDEN_PACKAGES?)
		return 0;
	case COMMAND_1521:
		script_assert(false);
		return 0;
	case COMMAND_1522:
		script_assert(false);
		return 0;
	case COMMAND_1523:
		script_assert(false);
		return 0;
	case COMMAND_1524:
		script_assert(false);
		return 0;
	case COMMAND_1525:
		script_assert(false);
		return 0;
	case COMMAND_1526:
		script_assert(false);
		return 0;
	case COMMAND_1527:
		script_assert(false);
		return 0;
	case COMMAND_1528:
		script_assert(false);
		return 0;
	case COMMAND_1529:
		script_assert(false);
		return 0;
	case COMMAND_1530:
		script_assert(false);
		return 0;
	case COMMAND_1531:
		script_assert(false);
		return 0;
	case COMMAND_1532:
		script_assert(false);
		return 0;
	case COMMAND_1533:
		script_assert(false);
		return 0;
	case COMMAND_1534:
		script_assert(false);
		return 0;
	case COMMAND_1535:
		script_assert(false);
		return 0;
	case COMMAND_1536:
		script_assert(false);
		return 0;
	case COMMAND_1537:
		script_assert(false);
		return 0;
	case COMMAND_1538:
		script_assert(false);
		return 0;
	case COMMAND_1539:
		//TODO (REGISTER_OUTFIT_CHANGE)
		return 0;
	case COMMAND_1540:
		script_assert(false);
		return 0;
	case COMMAND_1541:
		script_assert(false);
		return 0;
	case COMMAND_1542:
		script_assert(false);
		return 0;
	case COMMAND_1543:
		script_assert(false);
		return 0;
	case COMMAND_1544:
		script_assert(false);
		return 0;
	case COMMAND_1545:
		script_assert(false);
		return 0;
	case COMMAND_1546:
		script_assert(false);
		return 0;
	case COMMAND_1547:
		script_assert(false);
		return 0;
	case COMMAND_1548:
		// TODO (GET_ONFOOT_CAMERA_MODE)
		ScriptParams[0] = 0;
		StoreParameters(&m_nIp, 1);
		return 0;
	case COMMAND_1549:
		CollectParameters(&m_nIp, 1);
		// TODO (SET_ONFOOT_CAMERA_MODE?)
		return 0;
	case COMMAND_1550:
		script_assert(false);
		return 0;
	case COMMAND_1551:
		script_assert(false);
		return 0;
	case COMMAND_1552:
		script_assert(false);
		return 0;
	case COMMAND_1553:
		script_assert(false);
		return 0;
	case COMMAND_1554:
		script_assert(false);
		return 0;
	case COMMAND_1555:
		CollectParameters(&m_nIp, 1);
		// TODO (FREEZE_ONFOOT_CAMERA_MODE?)
		return 0;
	case COMMAND_1556:
		script_assert(false);
		return 0;
	case COMMAND_1557:
		script_assert(false);
		return 0;
	case COMMAND_1558:
		UpdateCompareFlag(false);
		// TODO
		return 0;
	case COMMAND_1559:
		script_assert(false);
		return 0;
	case COMMAND_1560:
		// TODO (IS_E3_BUILD?)
		UpdateCompareFlag(false);
		return 0;
	case COMMAND_1561:
		// TODO (check, SET_FS_DESTROYED_FLAG)
		CTheScripts::FSDestroyedFlag = GetPointerToScriptVariable(&m_nIp, VAR_GLOBAL) - (int32*)CTheScripts::ScriptSpace;
		return 0;
	case COMMAND_1562:
		script_assert(false);
		return 0;
	case COMMAND_1563:
		script_assert(false);
		return 0;
	case COMMAND_1564:
		script_assert(false);
		return 0;
	case COMMAND_1565:
		script_assert(false);
		return 0;
	case COMMAND_1566:
		script_assert(false);
		return 0;
	case COMMAND_1567:
		CollectParameters(&m_nIp, 1);
		// TODO (BUILD_WORLD_GEOMETRY)
		return 0;
	case COMMAND_1568:
		script_assert(false);
		return 0;
	case COMMAND_1569:
		// TODO (IS_MULTIPLAYER_ACTIVE?)
		UpdateCompareFlag(false);
		return 0;
	case COMMAND_1570:
		script_assert(false);
		return 0;
	case COMMAND_1571:
		script_assert(false);
		return 0;
	case COMMAND_1572:
		script_assert(false);
		return 0;
	case COMMAND_1573:
		script_assert(false);
		return 0;
	case COMMAND_1574:
		script_assert(false);
		return 0;
	case COMMAND_1575:
		script_assert(false);
		return 0;
	case COMMAND_1576:
		script_assert(false);
		return 0;
	case COMMAND_1577:
		script_assert(false);
		return 0;
	case COMMAND_1578:
		script_assert(false);
		return 0;
	case COMMAND_1579:
		script_assert(false);
		return 0;
	case COMMAND_1580:
		script_assert(false);
		return 0;
	case COMMAND_1581:
	{
		// TODO (SET_HELP_MESSAGE?)
		wchar* key = CTheScripts::GetTextByKeyFromScript(&m_nIp);
		return 0;
	}
	case COMMAND_1582:
		script_assert(false);
		return 0;
	case COMMAND_1583:
		script_assert(false);
		return 0;
	case COMMAND_1584:
		script_assert(false);
		return 0;
	case COMMAND_1585:
		script_assert(false);
		return 0;
	case COMMAND_1586:
		script_assert(false);
		return 0;
	case COMMAND_1587:
		script_assert(false);
		return 0;
	case COMMAND_1588:
		script_assert(false);
		return 0;
	case COMMAND_1589:
		CollectParameters(&m_nIp, 2);
		// TODO (SWAP_BUILDING?)
		return 0;
	case COMMAND_1590:
		script_assert(false);
		return 0;
	case COMMAND_1591:
		script_assert(false);
		return 0;
	case COMMAND_1592:
		script_assert(false);
		return 0;
	case COMMAND_1593:
		script_assert(false);
		return 0;
	case COMMAND_1594:
		script_assert(false);
		return 0;
	case COMMAND_1595:
		script_assert(false);
		return 0;
	case COMMAND_1596:
		script_assert(false);
		return 0;
	case COMMAND_1597:
		script_assert(false);
		return 0;
	case COMMAND_1598:
		script_assert(false);
		return 0;
	case COMMAND_1599:
		script_assert(false);
		return 0;
	default:
		script_assert(0);
	}
	return -1;
}

int8 CRunningScript::ProcessCommands1600To1699(int32 command)
{
	switch (command) {
	case COMMAND_1600:
		script_assert(false);
		return 0;
	case COMMAND_1601:
		script_assert(false);
		return 0;
	case COMMAND_1602:
		script_assert(false);
		return 0;
	case COMMAND_1603:
		script_assert(false);
		return 0;
	case COMMAND_1604:
		script_assert(false);
		return 0;
	case COMMAND_1605:
		script_assert(false);
		return 0;
	case COMMAND_1606:
		script_assert(false);
		return 0;
	case COMMAND_1607:
		CollectParameters(&m_nIp, 1);
		// TODO (SET_TOTAL_CARS_FOR_EXPORT)
		return 0;
	case COMMAND_1608:
		script_assert(false);
		return 0;
	case COMMAND_1609:
		script_assert(false);
		return 0;
	case COMMAND_1610:
		script_assert(false);
		return 0;
	case COMMAND_1611:
		script_assert(false);
		return 0;
	case COMMAND_1612:
		script_assert(false);
		return 0;
	case COMMAND_1613:
		script_assert(false);
		return 0;
	case COMMAND_1614:
		script_assert(false);
		return 0;
	case COMMAND_1615:
		// TODO (GET_DEVELOPER_FLAG?)
		UpdateCompareFlag(false);
		return 0;
	case COMMAND_1616:
		// TODO (SET_DEVELOPER_FLAG)
		return 0;
	case COMMAND_1617:
		script_assert(false);
		return 0;
	case COMMAND_1618:
		script_assert(false);
		return 0;
	case COMMAND_1619:
		script_assert(false);
		return 0;
	case COMMAND_1620:
		script_assert(false);
		return 0;
	case COMMAND_1621:
	{
		wchar* key = CTheScripts::GetTextByKeyFromScript(&m_nIp);
		CollectParameters(&m_nIp, 2);
		// TODO (SET_SUBTITLE_TEXT)
		return 0;
	}
	case COMMAND_1622:
		script_assert(false);
		return 0;
	case COMMAND_1623:
		script_assert(false);
		return 0;
	case COMMAND_1624:
		script_assert(false);
		return 0;
	case COMMAND_1625:
		script_assert(false);
		return 0;
	case COMMAND_1626:
		script_assert(false);
		return 0;
	case COMMAND_1627:
		script_assert(false);
		return 0;
	case COMMAND_1628:
		script_assert(false);
		return 0;
	case COMMAND_1629:
		script_assert(false);
		return 0;
	case COMMAND_1630:
		script_assert(false);
		return 0;
	case COMMAND_1631:
		script_assert(false);
		return 0;
	case COMMAND_1632:
		script_assert(false);
		return 0;
	case COMMAND_1633:
		script_assert(false);
		return 0;
	case COMMAND_1634:
		script_assert(false);
		return 0;
	case COMMAND_1635:
	{
		char tmp[12]; // TODO
		CTheScripts::ReadTextLabelFromScript(&m_nIp, tmp);
		m_nIp += KEY_LENGTH_IN_SCRIPT;
		// TODO (CHANGE_STORED_PLAYER_OUTFIT?)
		return 0;
	}
	case COMMAND_1636:
		script_assert(false);
		return 0;
	case COMMAND_1637:
		script_assert(false);
		return 0;
	case COMMAND_1638:
		script_assert(false);
		return 0;
	case COMMAND_1639:
		script_assert(false);
		return 0;
	case COMMAND_1640:
		CollectParameters(&m_nIp, 2);
		// TODO (LOCK_GARAGE?)
		return 0;
	case COMMAND_1641:
		// TODO
		UpdateCompareFlag(true);
		return 0;
	case COMMAND_1642:
		script_assert(false);
		return 0;
	case COMMAND_1643:
		script_assert(false);
		return 0;
	case COMMAND_1644:
		script_assert(false);
		return 0;
	case COMMAND_1645:
	{
		CollectParameters(&m_nIp, 1);
		// TODO (GET_STORED_WEAPON?)
		CPed* pPed = CWorld::Players[ScriptParams[0]].m_pPed;
		script_assert(pPed);
		ScriptParams[0] = pPed->m_storedWeapon;
		StoreParameters(&m_nIp, 1);
		return 0;
	}
	case COMMAND_1646:
		CollectParameters(&m_nIp, 1);
		// TODO (DISABLE_PAUSE_MENU?)
		return 0;
	case COMMAND_1647:
		CollectParameters(&m_nIp, 1);
		// TODO (IS_CHANNEL_PLAYING?)
		UpdateCompareFlag(false);
		return 0;
	case COMMAND_1648:
		CollectParameters(&m_nIp, 3);
		// TODO (SET_CLOCK_EVENT_WARNING);
		return 0;
	case COMMAND_1649:
		CollectParameters(&m_nIp, 3);
		// TODO (SET_EXTRA_COLOUR_DIRECTION)
		return 0;
	case COMMAND_1650:
		script_assert(false);
		return 0;
	case COMMAND_1651:
		script_assert(false);
		return 0;
	case COMMAND_1652:
		script_assert(false);
		return 0;
	case COMMAND_1653:
		script_assert(false);
		return 0;
	case COMMAND_1654:
		script_assert(false);
		return 0;
	case COMMAND_1655:
		script_assert(false);
		return 0;
	case COMMAND_1656:
		CollectParameters(&m_nIp, 2);
		// TODO (?)
		return 0;
	default:
		script_assert(0);
	}
	return -1;
}