forked from PopRe/Pop-World-Editor
-
Notifications
You must be signed in to change notification settings - Fork 0
/
script_decompile.cpp
5694 lines (5046 loc) · 148 KB
/
script_decompile.cpp
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
/*
Alacn
http://alacn.dnsalias.org:8080/
*/
#include "std.h"
#include "pop.h"
#include "popedt.h"
#include "script.h"
int ScriptDecompile_SkipError();
bool ScriptDecompile_GetField(char *sz);
int ScriptDecompile_BEGIN();
int ScriptDecompile_DO();
int ScriptDecompile_EVERY();
int ScriptDecompile_SET();
int ScriptDecompile_MULTIPLY_DEVIDE();
int ScriptDecompile_test();
int ScriptDecompile_logic();
int ScriptDecompile_condition();
int ScriptDecompile_IF();
bool ScriptDecompile(SCRIPTINFO *scriptinfo, HANDLE hfile)
{
script_fail = false;
script_h = hfile;
script_indent = 0;
script_p = 0;
script_si = scriptinfo;
if(script_si->Codes[0] != SCRIPT_VERSION)
{
sprintf(str, SZ_SCRIPT_ERR_WRONG_VERSION, script_si->Codes[script_p]);
ScriptWriteSz(str);
}
if(!Script_inc_si()) return false;
if(ScriptDecompile_BEGIN() != RES_OK) return false;
if(script_code != TOKEN_SCRIPT_END)
{
sprintf(str, SZ_SCRIPT_ERR_EXPECTED_BUT_FOUND, SZ_TOKEN_SCRIPT_END, TOKEN_SCRIPT_END, script_code);
ScriptWriteSz(str);
return false;
}
ScriptWriteToken(SZ_TOKEN_SCRIPT_END);
return !script_fail;
}
bool ScriptDecompile_GetField(char *sz)
{
if(script_code >= MAX_FIELDS || script_code < 0)
{
sprintf(sz, SZ_SCRIPT_ERR_FIELD_OVERFLOW, script_code);
return false;
}
FIELDINFO *fi = &script_si->Fields[script_code];
switch(fi->Type)
{
case CONSTANT_VAL:
sprintf(sz, "%d", fi->Value);
return true;
case USER_VAL:
if(fi->Index >= MAX_VARS || fi->Index < 0)
{
sprintf(sz, SZ_SCRIPT_ERR_USERVAL_OVERFLOW, fi->Index);
return false;
}
sprintf(sz, VAR_PREFIX "%d", fi->Index);
return true;
case INTERNAL_VAL:
{
switch(fi->Index)
{
case INT_M_SPELL_BURN_COST: strcpy(sz, SZ_INT_M_SPELL_BURN_COST); break;
case INT_M_SPELL_BLAST_COST: strcpy(sz, SZ_INT_M_SPELL_BLAST_COST); break;
case INT_M_SPELL_LIGHTNING_BOLT_COST: strcpy(sz, SZ_INT_M_SPELL_LIGHTNING_BOLT_COST); break;
case INT_M_SPELL_WHIRLWIND_COST: strcpy(sz, SZ_INT_M_SPELL_WHIRLWIND_COST); break;
case INT_M_SPELL_INSECT_PLAGUE_COST: strcpy(sz, SZ_INT_M_SPELL_INSECT_PLAGUE_COST); break;
case INT_M_SPELL_INVISIBILITY_COST: strcpy(sz, SZ_INT_M_SPELL_INVISIBILITY_COST); break;
case INT_M_SPELL_HYPNOTISM_COST: strcpy(sz, SZ_INT_M_SPELL_HYPNOTISM_COST); break;
case INT_M_SPELL_FIRESTORM_COST: strcpy(sz, SZ_INT_M_SPELL_FIRESTORM_COST); break;
case INT_M_SPELL_GHOST_ARMY_COST: strcpy(sz, SZ_INT_M_SPELL_GHOST_ARMY_COST); break;
case INT_M_SPELL_EROSION_COST: strcpy(sz, SZ_INT_M_SPELL_EROSION_COST); break;
case INT_M_SPELL_SWAMP_COST: strcpy(sz, SZ_INT_M_SPELL_SWAMP_COST); break;
case INT_M_SPELL_LAND_BRIDGE_COST: strcpy(sz, SZ_INT_M_SPELL_LAND_BRIDGE_COST); break;
case INT_M_SPELL_ANGEL_OF_DEATH_COST: strcpy(sz, SZ_INT_M_SPELL_ANGEL_OF_DEATH_COST); break;
case INT_M_SPELL_EARTHQUAKE_COST: strcpy(sz, SZ_INT_M_SPELL_EARTHQUAKE_COST); break;
case INT_M_SPELL_FLATTEN_COST: strcpy(sz, SZ_INT_M_SPELL_FLATTEN_COST); break;
case INT_M_SPELL_VOLCANO_COST: strcpy(sz, SZ_INT_M_SPELL_VOLCANO_COST); break;
case INT_M_SPELL_WRATH_OF_GOD_COST: strcpy(sz, SZ_INT_M_SPELL_WRATH_OF_GOD_COST); break;
case INT_M_SPELL_SHIELD_COST: strcpy(sz, SZ_INT_M_SPELL_SHIELD_COST); break;
case INT_MY_MANA: strcpy(sz, SZ_INT_MY_MANA); break;
//
case INT_M_BUILDING_TEPEE: strcpy(sz, SZ_INT_M_BUILDING_TEPEE); break;
case INT_M_BUILDING_HUT: strcpy(sz, SZ_INT_M_BUILDING_HUT); break;
case INT_M_BUILDING_FARM: strcpy(sz, SZ_INT_M_BUILDING_FARM); break;
case INT_M_BUILDING_DRUM_TOWER: strcpy(sz, SZ_INT_M_BUILDING_DRUM_TOWER); break;
case INT_M_BUILDING_TEMPLE: strcpy(sz, SZ_INT_M_BUILDING_TEMPLE); break;
case INT_M_BUILDING_SPY_TRAIN: strcpy(sz, SZ_INT_M_BUILDING_SPY_TRAIN); break;
case INT_M_BUILDING_WARRIOR_TRAIN: strcpy(sz, SZ_INT_M_BUILDING_WARRIOR_TRAIN); break;
case INT_M_BUILDING_FIREWARRIOR_TRAIN: strcpy(sz, SZ_INT_M_BUILDING_FIREWARRIOR_TRAIN); break;
case INT_M_BUILDING_RECONVERSION: strcpy(sz, SZ_INT_M_BUILDING_RECONVERSION); break;
case INT_M_BUILDING_WALL_PIECE: strcpy(sz, SZ_INT_M_BUILDING_WALL_PIECE); break;
case INT_M_BUILDING_GATE: strcpy(sz, SZ_INT_M_BUILDING_GATE); break;
case INT_M_BUILDING_CURR_OE_SLOT: strcpy(sz, SZ_INT_M_BUILDING_CURR_OE_SLOT); break;
case INT_M_BUILDING_BOAT_HUT_1: strcpy(sz, SZ_INT_M_BUILDING_BOAT_HUT_1); break;
case INT_M_BUILDING_BOAT_HUT_2: strcpy(sz, SZ_INT_M_BUILDING_BOAT_HUT_2); break;
case INT_M_BUILDING_AIRSHIP_HUT_1: strcpy(sz, SZ_INT_M_BUILDING_AIRSHIP_HUT_1); break;
case INT_M_BUILDING_AIRSHIP_HUT_2: strcpy(sz, SZ_INT_M_BUILDING_AIRSHIP_HUT_2); break;
//
case INT_B_BUILDING_TEPEE: strcpy(sz, SZ_INT_B_BUILDING_TEPEE); break;
case INT_B_BUILDING_HUT: strcpy(sz, SZ_INT_B_BUILDING_HUT); break;
case INT_B_BUILDING_FARM: strcpy(sz, SZ_INT_B_BUILDING_FARM); break;
case INT_B_BUILDING_DRUM_TOWER: strcpy(sz, SZ_INT_B_BUILDING_DRUM_TOWER); break;
case INT_B_BUILDING_TEMPLE: strcpy(sz, SZ_INT_B_BUILDING_TEMPLE); break;
case INT_B_BUILDING_SPY_TRAIN: strcpy(sz, SZ_INT_B_BUILDING_SPY_TRAIN); break;
case INT_B_BUILDING_WARRIOR_TRAIN: strcpy(sz, SZ_INT_B_BUILDING_WARRIOR_TRAIN); break;
case INT_B_BUILDING_FIREWARRIOR_TRAIN: strcpy(sz, SZ_INT_B_BUILDING_FIREWARRIOR_TRAIN); break;
case INT_B_BUILDING_RECONVERSION: strcpy(sz, SZ_INT_B_BUILDING_RECONVERSION); break;
case INT_B_BUILDING_WALL_PIECE: strcpy(sz, SZ_INT_B_BUILDING_WALL_PIECE); break;
case INT_B_BUILDING_GATE: strcpy(sz, SZ_INT_B_BUILDING_GATE); break;
case INT_B_BUILDING_CURR_OE_SLOT: strcpy(sz, SZ_INT_B_BUILDING_CURR_OE_SLOT); break;
case INT_B_BUILDING_BOAT_HUT_1: strcpy(sz, SZ_INT_B_BUILDING_BOAT_HUT_1); break;
case INT_B_BUILDING_BOAT_HUT_2: strcpy(sz, SZ_INT_B_BUILDING_BOAT_HUT_2); break;
case INT_B_BUILDING_AIRSHIP_HUT_1: strcpy(sz, SZ_INT_B_BUILDING_AIRSHIP_HUT_1); break;
case INT_B_BUILDING_AIRSHIP_HUT_2: strcpy(sz, SZ_INT_B_BUILDING_AIRSHIP_HUT_2); break;
//
case INT_R_BUILDING_TEPEE: strcpy(sz, SZ_INT_R_BUILDING_TEPEE); break;
case INT_R_BUILDING_HUT: strcpy(sz, SZ_INT_R_BUILDING_HUT); break;
case INT_R_BUILDING_FARM: strcpy(sz, SZ_INT_R_BUILDING_FARM); break;
case INT_R_BUILDING_DRUM_TOWER: strcpy(sz, SZ_INT_R_BUILDING_DRUM_TOWER); break;
case INT_R_BUILDING_TEMPLE: strcpy(sz, SZ_INT_R_BUILDING_TEMPLE); break;
case INT_R_BUILDING_SPY_TRAIN: strcpy(sz, SZ_INT_R_BUILDING_SPY_TRAIN); break;
case INT_R_BUILDING_WARRIOR_TRAIN: strcpy(sz, SZ_INT_R_BUILDING_WARRIOR_TRAIN); break;
case INT_R_BUILDING_FIREWARRIOR_TRAIN: strcpy(sz, SZ_INT_R_BUILDING_FIREWARRIOR_TRAIN); break;
case INT_R_BUILDING_RECONVERSION: strcpy(sz, SZ_INT_R_BUILDING_RECONVERSION); break;
case INT_R_BUILDING_WALL_PIECE: strcpy(sz, SZ_INT_R_BUILDING_WALL_PIECE); break;
case INT_R_BUILDING_GATE: strcpy(sz, SZ_INT_R_BUILDING_GATE); break;
case INT_R_BUILDING_CURR_OE_SLOT: strcpy(sz, SZ_INT_R_BUILDING_CURR_OE_SLOT); break;
case INT_R_BUILDING_BOAT_HUT_1: strcpy(sz, SZ_INT_R_BUILDING_BOAT_HUT_1); break;
case INT_R_BUILDING_BOAT_HUT_2: strcpy(sz, SZ_INT_R_BUILDING_BOAT_HUT_2); break;
case INT_R_BUILDING_AIRSHIP_HUT_1: strcpy(sz, SZ_INT_R_BUILDING_AIRSHIP_HUT_1); break;
case INT_R_BUILDING_AIRSHIP_HUT_2: strcpy(sz, SZ_INT_R_BUILDING_AIRSHIP_HUT_2); break;
//
case INT_Y_BUILDING_TEPEE: strcpy(sz, SZ_INT_Y_BUILDING_TEPEE); break;
case INT_Y_BUILDING_HUT: strcpy(sz, SZ_INT_Y_BUILDING_HUT); break;
case INT_Y_BUILDING_FARM: strcpy(sz, SZ_INT_Y_BUILDING_FARM); break;
case INT_Y_BUILDING_DRUM_TOWER: strcpy(sz, SZ_INT_Y_BUILDING_DRUM_TOWER); break;
case INT_Y_BUILDING_TEMPLE: strcpy(sz, SZ_INT_Y_BUILDING_TEMPLE); break;
case INT_Y_BUILDING_SPY_TRAIN: strcpy(sz, SZ_INT_Y_BUILDING_SPY_TRAIN); break;
case INT_Y_BUILDING_WARRIOR_TRAIN: strcpy(sz, SZ_INT_Y_BUILDING_WARRIOR_TRAIN); break;
case INT_Y_BUILDING_FIREWARRIOR_TRAIN: strcpy(sz, SZ_INT_Y_BUILDING_FIREWARRIOR_TRAIN); break;
case INT_Y_BUILDING_RECONVERSION: strcpy(sz, SZ_INT_Y_BUILDING_RECONVERSION); break;
case INT_Y_BUILDING_WALL_PIECE: strcpy(sz, SZ_INT_Y_BUILDING_WALL_PIECE); break;
case INT_Y_BUILDING_GATE: strcpy(sz, SZ_INT_Y_BUILDING_GATE); break;
case INT_Y_BUILDING_CURR_OE_SLOT: strcpy(sz, SZ_INT_Y_BUILDING_CURR_OE_SLOT); break;
case INT_Y_BUILDING_BOAT_HUT_1: strcpy(sz, SZ_INT_Y_BUILDING_BOAT_HUT_1); break;
case INT_Y_BUILDING_BOAT_HUT_2: strcpy(sz, SZ_INT_Y_BUILDING_BOAT_HUT_2); break;
case INT_Y_BUILDING_AIRSHIP_HUT_1: strcpy(sz, SZ_INT_Y_BUILDING_AIRSHIP_HUT_1); break;
case INT_Y_BUILDING_AIRSHIP_HUT_2: strcpy(sz, SZ_INT_Y_BUILDING_AIRSHIP_HUT_2); break;
//
case INT_G_BUILDING_TEPEE: strcpy(sz, SZ_INT_G_BUILDING_TEPEE); break;
case INT_G_BUILDING_HUT: strcpy(sz, SZ_INT_G_BUILDING_HUT); break;
case INT_G_BUILDING_FARM: strcpy(sz, SZ_INT_G_BUILDING_FARM); break;
case INT_G_BUILDING_DRUM_TOWER: strcpy(sz, SZ_INT_G_BUILDING_DRUM_TOWER); break;
case INT_G_BUILDING_TEMPLE: strcpy(sz, SZ_INT_G_BUILDING_TEMPLE); break;
case INT_G_BUILDING_SPY_TRAIN: strcpy(sz, SZ_INT_G_BUILDING_SPY_TRAIN); break;
case INT_G_BUILDING_WARRIOR_TRAIN: strcpy(sz, SZ_INT_G_BUILDING_WARRIOR_TRAIN); break;
case INT_G_BUILDING_FIREWARRIOR_TRAIN: strcpy(sz, SZ_INT_G_BUILDING_FIREWARRIOR_TRAIN); break;
case INT_G_BUILDING_RECONVERSION: strcpy(sz, SZ_INT_G_BUILDING_RECONVERSION); break;
case INT_G_BUILDING_WALL_PIECE: strcpy(sz, SZ_INT_G_BUILDING_WALL_PIECE); break;
case INT_G_BUILDING_GATE: strcpy(sz, SZ_INT_G_BUILDING_GATE); break;
case INT_G_BUILDING_CURR_OE_SLOT: strcpy(sz, SZ_INT_G_BUILDING_CURR_OE_SLOT); break;
case INT_G_BUILDING_BOAT_HUT_1: strcpy(sz, SZ_INT_G_BUILDING_BOAT_HUT_1); break;
case INT_G_BUILDING_BOAT_HUT_2: strcpy(sz, SZ_INT_G_BUILDING_BOAT_HUT_2); break;
case INT_G_BUILDING_AIRSHIP_HUT_1: strcpy(sz, SZ_INT_G_BUILDING_AIRSHIP_HUT_1); break;
case INT_G_BUILDING_AIRSHIP_HUT_2: strcpy(sz, SZ_INT_G_BUILDING_AIRSHIP_HUT_2); break;
//
case INT_M_PERSON_BRAVE: strcpy(sz, SZ_INT_M_PERSON_BRAVE); break;
case INT_M_PERSON_WARRIOR: strcpy(sz, SZ_INT_M_PERSON_WARRIOR); break;
case INT_M_PERSON_RELIGIOUS: strcpy(sz, SZ_INT_M_PERSON_RELIGIOUS); break;
case INT_M_PERSON_SPY: strcpy(sz, SZ_INT_M_PERSON_SPY); break;
case INT_M_PERSON_FIREWARRIOR: strcpy(sz, SZ_INT_M_PERSON_FIREWARRIOR); break;
case INT_M_PERSON_SHAMAN: strcpy(sz, SZ_INT_M_PERSON_SHAMAN); break;
//
case INT_B_PERSON_BRAVE: strcpy(sz, SZ_INT_B_PERSON_BRAVE); break;
case INT_B_PERSON_WARRIOR: strcpy(sz, SZ_INT_B_PERSON_WARRIOR); break;
case INT_B_PERSON_RELIGIOUS: strcpy(sz, SZ_INT_B_PERSON_RELIGIOUS); break;
case INT_B_PERSON_SPY: strcpy(sz, SZ_INT_B_PERSON_SPY); break;
case INT_B_PERSON_FIREWARRIOR: strcpy(sz, SZ_INT_B_PERSON_FIREWARRIOR); break;
case INT_B_PERSON_SHAMAN: strcpy(sz, SZ_INT_B_PERSON_SHAMAN); break;
//
case INT_R_PERSON_BRAVE: strcpy(sz, SZ_INT_R_PERSON_BRAVE); break;
case INT_R_PERSON_WARRIOR: strcpy(sz, SZ_INT_R_PERSON_WARRIOR); break;
case INT_R_PERSON_RELIGIOUS: strcpy(sz, SZ_INT_R_PERSON_RELIGIOUS); break;
case INT_R_PERSON_SPY: strcpy(sz, SZ_INT_R_PERSON_SPY); break;
case INT_R_PERSON_FIREWARRIOR: strcpy(sz, SZ_INT_R_PERSON_FIREWARRIOR); break;
case INT_R_PERSON_SHAMAN: strcpy(sz, SZ_INT_R_PERSON_SHAMAN); break;
//
case INT_Y_PERSON_BRAVE: strcpy(sz, SZ_INT_Y_PERSON_BRAVE); break;
case INT_Y_PERSON_WARRIOR: strcpy(sz, SZ_INT_Y_PERSON_WARRIOR); break;
case INT_Y_PERSON_RELIGIOUS: strcpy(sz, SZ_INT_Y_PERSON_RELIGIOUS); break;
case INT_Y_PERSON_SPY: strcpy(sz, SZ_INT_Y_PERSON_SPY); break;
case INT_Y_PERSON_FIREWARRIOR: strcpy(sz, SZ_INT_Y_PERSON_FIREWARRIOR); break;
case INT_Y_PERSON_SHAMAN: strcpy(sz, SZ_INT_Y_PERSON_SHAMAN); break;
//
case INT_G_PERSON_BRAVE: strcpy(sz, SZ_INT_G_PERSON_BRAVE); break;
case INT_G_PERSON_WARRIOR: strcpy(sz, SZ_INT_G_PERSON_WARRIOR); break;
case INT_G_PERSON_RELIGIOUS: strcpy(sz, SZ_INT_G_PERSON_RELIGIOUS); break;
case INT_G_PERSON_SPY: strcpy(sz, SZ_INT_G_PERSON_SPY); break;
case INT_G_PERSON_FIREWARRIOR: strcpy(sz, SZ_INT_G_PERSON_FIREWARRIOR); break;
case INT_G_PERSON_SHAMAN: strcpy(sz, SZ_INT_G_PERSON_SHAMAN); break;
//
case INT_M_VEHICLE_BOAT_1: strcpy(sz, SZ_INT_M_VEHICLE_BOAT_1); break;
case INT_M_VEHICLE_AIRSHIP_1: strcpy(sz, SZ_INT_M_VEHICLE_AIRSHIP_1); break;
case INT_B_VEHICLE_BOAT_1: strcpy(sz, SZ_INT_B_VEHICLE_BOAT_1); break;
case INT_B_VEHICLE_AIRSHIP_1: strcpy(sz, SZ_INT_B_VEHICLE_AIRSHIP_1); break;
case INT_R_VEHICLE_BOAT_1: strcpy(sz, SZ_INT_R_VEHICLE_BOAT_1); break;
case INT_R_VEHICLE_AIRSHIP_1: strcpy(sz, SZ_INT_R_VEHICLE_AIRSHIP_1); break;
case INT_Y_VEHICLE_BOAT_1: strcpy(sz, SZ_INT_Y_VEHICLE_BOAT_1); break;
case INT_Y_VEHICLE_AIRSHIP_1: strcpy(sz, SZ_INT_Y_VEHICLE_AIRSHIP_1); break;
case INT_G_VEHICLE_BOAT_1: strcpy(sz, SZ_INT_G_VEHICLE_BOAT_1); break;
case INT_G_VEHICLE_AIRSHIP_1: strcpy(sz, SZ_INT_G_VEHICLE_AIRSHIP_1); break;
//
case INT_BLUE_KILLED_BY_ME: strcpy(sz, SZ_INT_BLUE_KILLED_BY_ME);
case INT_RED_KILLED_BY_ME: strcpy(sz, SZ_INT_RED_KILLED_BY_ME); break;
case INT_YELLOW_KILLED_BY_ME: strcpy(sz, SZ_INT_YELLOW_KILLED_BY_ME); break;
case INT_GREEN_KILLED_BY_ME: strcpy(sz, SZ_INT_GREEN_KILLED_BY_ME); break;
//
case INT_MY_NUM_KILLED_BY_BLUE: strcpy(sz, SZ_INT_MY_NUM_KILLED_BY_BLUE); break;
case INT_MY_NUM_KILLED_BY_RED: strcpy(sz, SZ_INT_MY_NUM_KILLED_BY_RED); break;
case INT_MY_NUM_KILLED_BY_YELLOW: strcpy(sz, SZ_INT_MY_NUM_KILLED_BY_YELLOW); break;
case INT_MY_NUM_KILLED_BY_GREEN: strcpy(sz, SZ_INT_MY_NUM_KILLED_BY_GREEN); break;
//
case INT_ATTR_EXPANSION: strcpy(sz, SZ_INT_ATTR_EXPANSION); break;
case INT_ATTR_PREF_SPY_TRAINS: strcpy(sz, SZ_INT_ATTR_PREF_SPY_TRAINS); break;
case INT_ATTR_PREF_RELIGIOUS_TRAINS: strcpy(sz, SZ_INT_ATTR_PREF_RELIGIOUS_TRAINS); break;
case INT_ATTR_PREF_WARRIOR_TRAINS: strcpy(sz, SZ_INT_ATTR_PREF_WARRIOR_TRAINS); break;
case INT_ATTR_PREF_FIREWARRIOR_TRAINS: strcpy(sz, SZ_INT_ATTR_PREF_FIREWARRIOR_TRAINS); break;
case INT_ATTR_PREF_SPY_PEOPLE: strcpy(sz, SZ_INT_ATTR_PREF_SPY_PEOPLE); break;
case INT_ATTR_PREF_RELIGIOUS_PEOPLE: strcpy(sz, SZ_INT_ATTR_PREF_RELIGIOUS_PEOPLE); break;
case INT_ATTR_PREF_WARRIOR_PEOPLE: strcpy(sz, SZ_INT_ATTR_PREF_WARRIOR_PEOPLE); break;
case INT_ATTR_PREF_FIREWARRIOR_PEOPLE: strcpy(sz, SZ_INT_ATTR_PREF_FIREWARRIOR_PEOPLE); break;
case INT_ATTR_MAX_BUILDINGS_ON_GO: strcpy(sz, SZ_INT_ATTR_MAX_BUILDINGS_ON_GO); break;
case INT_ATTR_HOUSE_PERCENTAGE: strcpy(sz, SZ_INT_ATTR_HOUSE_PERCENTAGE); break;
case INT_ATTR_AWAY_BRAVE: strcpy(sz, SZ_INT_ATTR_AWAY_BRAVE); break;
case INT_ATTR_AWAY_WARRIOR: strcpy(sz, SZ_INT_ATTR_AWAY_WARRIOR); break;
case INT_ATTR_AWAY_RELIGIOUS: strcpy(sz, SZ_INT_ATTR_AWAY_RELIGIOUS); break;
case INT_ATTR_DEFENSE_RAD_INCR: strcpy(sz, SZ_INT_ATTR_DEFENSE_RAD_INCR); break;
case INT_ATTR_MAX_DEFENSIVE_ACTIONS: strcpy(sz, SZ_INT_ATTR_MAX_DEFENSIVE_ACTIONS); break;
case INT_ATTR_AWAY_SPY: strcpy(sz, SZ_INT_ATTR_AWAY_SPY); break;
case INT_ATTR_AWAY_FIREWARRIOR: strcpy(sz, SZ_INT_ATTR_AWAY_FIREWARRIOR); break;
case INT_ATTR_ATTACK_PERCENTAGE: strcpy(sz, SZ_INT_ATTR_ATTACK_PERCENTAGE); break;
case INT_ATTR_AWAY_SHAMAN: strcpy(sz, SZ_INT_ATTR_AWAY_SHAMAN); break;
case INT_ATTR_PEOPLE_PER_BOAT: strcpy(sz, SZ_INT_ATTR_PEOPLE_PER_BOAT); break;
case INT_ATTR_PEOPLE_PER_BALLOON: strcpy(sz, SZ_INT_ATTR_PEOPLE_PER_BALLOON); break;
case INT_ATTR_MAX_SPY_ATTACKS: strcpy(sz, SZ_INT_ATTR_MAX_SPY_ATTACKS); break;
case INT_ATTR_ENEMY_SPY_MAX_STAND: strcpy(sz, SZ_INT_ATTR_ENEMY_SPY_MAX_STAND); break;
case INT_ATTR_MAX_ATTACKS: strcpy(sz, SZ_INT_ATTR_MAX_ATTACKS); break;
case INT_ATTR_SPY_CHECK_FREQUENCY: strcpy(sz, SZ_INT_ATTR_SPY_CHECK_FREQUENCY); break;
case INT_ATTR_RETREAT_VALUE: strcpy(sz, SZ_INT_ATTR_RETREAT_VALUE); break;
case INT_ATTR_SHAMEN_BLAST: strcpy(sz, SZ_INT_ATTR_SHAMEN_BLAST); break;
case INT_ATTR_MAX_TRAIN_AT_ONCE: strcpy(sz, SZ_INT_ATTR_MAX_TRAIN_AT_ONCE); break;
case INT_ATTR_GROUP_OPTION: strcpy(sz, SZ_INT_ATTR_GROUP_OPTION); break;
case INT_ATTR_PREF_BOAT_HUTS: strcpy(sz, SZ_INT_ATTR_PREF_BOAT_HUTS); break;
case INT_ATTR_PREF_BALLOON_HUTS: strcpy(sz, SZ_INT_ATTR_PREF_BALLOON_HUTS); break;
case INT_ATTR_PREF_BOAT_DRIVERS: strcpy(sz, SZ_INT_ATTR_PREF_BOAT_DRIVERS); break;
case INT_ATTR_PREF_BALLOON_DRIVERS: strcpy(sz, SZ_INT_ATTR_PREF_BALLOON_DRIVERS); break;
case INT_ATTR_FIGHT_STOP_DISTANCE: strcpy(sz, SZ_INT_ATTR_FIGHT_STOP_DISTANCE); break;
case INT_ATTR_SPY_DISCOVER_CHANCE: strcpy(sz, SZ_INT_ATTR_SPY_DISCOVER_CHANCE); break;
case INT_ATTR_COUNT_PREACH_DAMAGE: strcpy(sz, SZ_INT_ATTR_COUNT_PREACH_DAMAGE); break;
case INT_ATTR_USE_PREACHER_FOR_DEFENCE: strcpy(sz, SZ_INT_ATTR_USE_PREACHER_FOR_DEFENCE); break;
case INT_ATTR_RANDOM_BUILD_SIDE: strcpy(sz, SZ_INT_ATTR_RANDOM_BUILD_SIDE); break;
case INT_ATTR_BASE_UNDER_ATTACK_RETREAT: strcpy(sz, SZ_INT_ATTR_BASE_UNDER_ATTACK_RETREAT); break;
case INT_ATTR_EMPTY_AT_WAYPOINT: strcpy(sz, SZ_INT_ATTR_EMPTY_AT_WAYPOINT); break;
case INT_ATTR_DONT_USE_BOATS: strcpy(sz, SZ_INT_ATTR_DONT_USE_BOATS); break;
case INT_ATTR_DONT_GROUP_AT_DT: strcpy(sz, SZ_INT_ATTR_DONT_GROUP_AT_DT); break;
case INT_ATTR_SPELL_DELAY: strcpy(sz, SZ_INT_ATTR_SPELL_DELAY); break;
case INT_ATTR_DONT_DELETE_USELESS_BOAT_HOUSE: strcpy(sz, SZ_INT_ATTR_DONT_DELETE_USELESS_BOAT_HOUSE); break;
case INT_ATTR_BOAT_HOUSE_BROKEN: strcpy(sz, SZ_INT_ATTR_BOAT_HOUSE_BROKEN); break;
case INT_ATTR_DONT_AUTO_TRAIN_PREACHERS: strcpy(sz, SZ_INT_ATTR_DONT_AUTO_TRAIN_PREACHERS); break;
case INT_ATTR_SPARE_6: strcpy(sz, SZ_INT_ATTR_SPARE_6); break;
//
case INT_NO_SPECIFIC_SPELL: strcpy(sz, SZ_INT_NO_SPECIFIC_SPELL); break;
case INT_BURN: strcpy(sz, SZ_INT_BURN); break;
case INT_BLAST: strcpy(sz, SZ_INT_BLAST); break;
case INT_LIGHTNING_BOLT: strcpy(sz, SZ_INT_LIGHTNING_BOLT); break;
case INT_WHIRLWIND: strcpy(sz, SZ_INT_WHIRLWIND); break;
case INT_INSECT_PLAGUE: strcpy(sz, SZ_INT_INSECT_PLAGUE); break;
case INT_INVISIBILITY: strcpy(sz, SZ_INT_INVISIBILITY); break;
case INT_HYPNOTISM: strcpy(sz, SZ_INT_HYPNOTISM); break;
case INT_FIRESTORM: strcpy(sz, SZ_INT_FIRESTORM); break;
case INT_GHOST_ARMY: strcpy(sz, SZ_INT_GHOST_ARMY); break;
case INT_EROSION: strcpy(sz, SZ_INT_EROSION); break;
case INT_SWAMP: strcpy(sz, SZ_INT_SWAMP); break;
case INT_LAND_BRIDGE: strcpy(sz, SZ_INT_LAND_BRIDGE); break;
case INT_ANGEL_OF_DEATH: strcpy(sz, SZ_INT_ANGEL_OF_DEATH); break;
case INT_EARTHQUAKE: strcpy(sz, SZ_INT_EARTHQUAKE); break;
case INT_FLATTEN: strcpy(sz, SZ_INT_FLATTEN); break;
case INT_VOLCANO: strcpy(sz, SZ_INT_VOLCANO); break;
case INT_WRATH_OF_GOD: strcpy(sz, SZ_INT_WRATH_OF_GOD); break;
case INT_SHIELD: strcpy(sz, SZ_INT_SHIELD); break;
case INT_CONVERT: strcpy(sz, SZ_INT_CONVERT); break;
case INT_TELEPORT: strcpy(sz, SZ_INT_TELEPORT); break;
case INT_BLOODLUST: strcpy(sz, SZ_INT_BLOODLUST); break;
//
case INT_NO_SPECIFIC_PERSON: strcpy(sz, SZ_INT_NO_SPECIFIC_PERSON); break;
case INT_BRAVE: strcpy(sz, SZ_INT_BRAVE); break;
case INT_WARRIOR: strcpy(sz, SZ_INT_WARRIOR); break;
case INT_RELIGIOUS: strcpy(sz, SZ_INT_RELIGIOUS); break;
case INT_SPY: strcpy(sz, SZ_INT_SPY); break;
case INT_FIREWARRIOR: strcpy(sz, SZ_INT_FIREWARRIOR); break;
case INT_SHAMAN: strcpy(sz, SZ_INT_SHAMAN); break;
//
case INT_NO_SPECIFIC_BUILDING: strcpy(sz, SZ_INT_NO_SPECIFIC_BUILDING); break;
case INT_TARGET_SHAMAN: strcpy(sz, SZ_INT_TARGET_SHAMAN); break;
case INT_TEPEE: strcpy(sz, SZ_INT_TEPEE); break;
case INT_HUT: strcpy(sz, SZ_INT_HUT); break;
case INT_FARM: strcpy(sz, SZ_INT_FARM); break;
case INT_DRUM_TOWER: strcpy(sz, SZ_INT_DRUM_TOWER); break;
case INT_TEMPLE: strcpy(sz, SZ_INT_TEMPLE); break;
case INT_SPY_TRAIN: strcpy(sz, SZ_INT_SPY_TRAIN); break;
case INT_WARRIOR_TRAIN: strcpy(sz, SZ_INT_WARRIOR_TRAIN); break;
case INT_FIREWARRIOR_TRAIN: strcpy(sz, SZ_INT_FIREWARRIOR_TRAIN); break;
case INT_WALL_PIECE: strcpy(sz, SZ_INT_WALL_PIECE); break;
case INT_GATE: strcpy(sz, SZ_INT_GATE); break;
case INT_BOAT_HUT_1: strcpy(sz, SZ_INT_BOAT_HUT_1); break;
case INT_BOAT_HUT_2: strcpy(sz, SZ_INT_BOAT_HUT_2); break;
case INT_AIRSHIP_HUT_1: strcpy(sz, SZ_INT_AIRSHIP_HUT_1); break;
case INT_AIRSHIP_HUT_2: strcpy(sz, SZ_INT_AIRSHIP_HUT_2); break;
//
case INT_CP_FREE_ENTRIES: strcpy(sz, SZ_INT_CP_FREE_ENTRIES); break;
case INT_RANDOM_100: strcpy(sz, SZ_INT_RANDOM_100); break;
//
case INT_NUM_SHAMEN_DEFENDERS: strcpy(sz, SZ_INT_NUM_SHAMEN_DEFENDERS); break;
case INT_CAMERA_ANGLE: strcpy(sz, SZ_INT_CAMERA_ANGLE); break;
case INT_CAMERA_X: strcpy(sz, SZ_INT_CAMERA_X); break;
case INT_CAMERA_Z: strcpy(sz, SZ_INT_CAMERA_Z); break;
//
case INT_GAME_TURN: strcpy(sz, SZ_INT_GAME_TURN); break;
case INT_MY_NUM_PEOPLE: strcpy(sz, SZ_INT_MY_NUM_PEOPLE); break;
case INT_BLUE_PEOPLE: strcpy(sz, SZ_INT_BLUE_PEOPLE); break;
case INT_RED_PEOPLE: strcpy(sz, SZ_INT_RED_PEOPLE); break;
case INT_YELLOW_PEOPLE: strcpy(sz, SZ_INT_YELLOW_PEOPLE); break;
case INT_GREEN_PEOPLE: strcpy(sz, SZ_INT_GREEN_PEOPLE); break;
case INT_MY_NUM_KILLED_BY_HUMAN: strcpy(sz, SZ_INT_MY_NUM_KILLED_BY_HUMAN); break;
case INT_RED_KILLED_BY_HUMAN: strcpy(sz, SZ_INT_RED_KILLED_BY_HUMAN); break;
case INT_YELLOW_KILLED_BY_HUMAN: strcpy(sz, SZ_INT_YELLOW_KILLED_BY_HUMAN); break;
case INT_GREEN_KILLED_BY_HUMAN: strcpy(sz, SZ_INT_GREEN_KILLED_BY_HUMAN); break;
case INT_WILD_PEOPLE: strcpy(sz, SZ_INT_WILD_PEOPLE); break;
case INT_BLUE_MANA: strcpy(sz, SZ_INT_BLUE_MANA); break;
case INT_RED_MANA: strcpy(sz, SZ_INT_RED_MANA); break;
case INT_YELLOW_MANA: strcpy(sz, SZ_INT_YELLOW_MANA); break;
case INT_GREEN_MANA: strcpy(sz, SZ_INT_GREEN_MANA); break;
//
default:
sprintf(sz, SZ_SCRIPT_ERR_UNKNOW_INT_VAR, fi->Index);
return false;
}
}
return true;
default:
sprintf(sz, SZ_SCRIPT_ERR_UNKNOW_VAR_TYPE, fi->Type);
return false;
}
}
int ScriptDecompile_SkipError()
{
do
{
if(!Script_inc_si()) return RES_FATAL;
if(script_code >= TOKEN_OFFSET || script_code == 0) return RES_OK;
}
while(script_p < MAX_CODES);
return RES_OK;
}
int ScriptDecompile_BEGIN()
{
if(script_code != TOKEN_BEGIN)
{
sprintf(str, SZ_SCRIPT_ERR_EXPECTED_BUT_FOUND, SZ_TOKEN_BEGIN, TOKEN_BEGIN, script_code);
ScriptWriteSz(str);
return RES_FATAL;
}
if(!Script_inc_si()) return RES_FATAL;
ScriptWriteToken(SZ_TOKEN_BEGIN);
script_indent++;
for(;;)
{
if(script_p >= MAX_CODES)
{
ScriptWriteSz(SZ_SCRIPT_ERR_CODE_EOF);
return RES_FATAL;
}
if(script_code == TOKEN_END)
{
if(script_indent > 0) script_indent--;
ScriptWriteToken(SZ_TOKEN_END);
if(!Script_inc_si()) return RES_FATAL;
return RES_OK;
}
switch(script_code)
{
case 0:
ScriptWriteSz(SZ_SCRIPT_ERR_PREMATURE_END);
return RES_FATAL;
case TOKEN_DO:
{
rs = ScriptDecompile_DO();
if(rs == RES_FATAL)
return RES_FATAL;
else if(rs == RES_ERROR)
if(ScriptDecompile_SkipError() != RES_OK) return RES_FATAL;
}
break;
case TOKEN_EVERY:
{
rs = ScriptDecompile_EVERY();
if(rs == RES_FATAL)
return RES_FATAL;
else if (rs == RES_ERROR)
if(ScriptDecompile_SkipError() != RES_OK) return RES_FATAL;
}
break;
case TOKEN_INCREMENT:
case TOKEN_DECREMENT:
case TOKEN_SET:
{
rs = ScriptDecompile_SET();
if(rs == RES_FATAL)
return RES_FATAL;
else if(rs == RES_ERROR)
if(ScriptDecompile_SkipError() != RES_OK) return RES_FATAL;
}
break;
case TOKEN_MULTIPLY:
case TOKEN_DIVIDE:
{
rs = ScriptDecompile_MULTIPLY_DEVIDE();
if(rs == RES_FATAL)
return RES_FATAL;
else if(rs == RES_ERROR)
if(ScriptDecompile_SkipError() != RES_OK) return RES_FATAL;
}
break;
case TOKEN_IF:
{
rs = ScriptDecompile_IF();
if(rs == RES_FATAL)
return RES_FATAL;
else if(rs == RES_ERROR)
if(ScriptDecompile_SkipError() != RES_OK) return RES_FATAL;
}
break;
default:
sprintf(str, SZ_SCRIPT_ERR_UNKNOW_COMMAND, script_code);
ScriptWriteSz(str);
if(ScriptDecompile_SkipError() != RES_OK) return RES_FATAL;
break;
}
}
}
int ScriptDecompile_DO()
{
if(script_code != TOKEN_DO)
{
sprintf(str, SZ_SCRIPT_ERR_EXPECTED_BUT_FOUND, SZ_TOKEN_DO, TOKEN_DO, script_code);
ScriptWriteSz(str);
return RES_ERROR;
}
if(!Script_inc_si()) return RES_FATAL;
strcpy(str, SZ_TOKEN_DO);
strcat(str, " ");
switch(script_code)
{
case TOKEN_CONSTRUCT_BUILDING:
strcat(str, SZ_TOKEN_CONSTRUCT_BUILDING);
goto _on_off;
case TOKEN_FETCH_WOOD:
strcat(str, SZ_TOKEN_FETCH_WOOD);
goto _on_off;
case TOKEN_SHAMAN_GET_WILDS:
strcat(str, SZ_TOKEN_SHAMAN_GET_WILDS);
goto _on_off;
case TOKEN_HOUSE_A_PERSON:
strcat(str, SZ_TOKEN_HOUSE_A_PERSON);
goto _on_off;
case TOKEN_SEND_GHOSTS:
strcat(str, SZ_TOKEN_SEND_GHOSTS);
goto _on_off;
case TOKEN_BRING_NEW_PEOPLE_BACK:
strcat(str, SZ_TOKEN_BRING_NEW_PEOPLE_BACK);
goto _on_off;
case TOKEN_TRAIN_PEOPLE:
strcat(str, SZ_TOKEN_TRAIN_PEOPLE);
goto _on_off;
case TOKEN_POPULATE_DRUM_TOWER:
strcat(str, SZ_TOKEN_POPULATE_DRUM_TOWER);
goto _on_off;
case TOKEN_DEFEND:
strcat(str, SZ_TOKEN_DEFEND);
goto _on_off;
case TOKEN_DEFEND_BASE:
strcat(str, SZ_TOKEN_DEFEND_BASE);
goto _on_off;
case TOKEN_PREACH:
strcat(str, SZ_TOKEN_PREACH);
goto _on_off;
case TOKEN_BUILD_WALLS:
strcat(str, SZ_TOKEN_BUILD_WALLS);
goto _on_off;
case TOKEN_SABOTAGE:
strcat(str, SZ_TOKEN_SABOTAGE);
goto _on_off;
case TOKEN_SPELL_OFFENSIVE:
strcat(str, SZ_TOKEN_SPELL_OFFENSIVE);
goto _on_off;
case TOKEN_FIREWARRIOR_DEFEND:
strcat(str, SZ_TOKEN_FIREWARRIOR_DEFEND);
goto _on_off;
case TOKEN_BUILD_VEHICLE:
strcat(str, SZ_TOKEN_BUILD_VEHICLE);
goto _on_off;
case TOKEN_FETCH_LOST_PEOPLE:
strcat(str, SZ_TOKEN_FETCH_LOST_PEOPLE);
goto _on_off;
case TOKEN_FETCH_LOST_VEHICLE:
strcat(str, SZ_TOKEN_FETCH_LOST_VEHICLE);
goto _on_off;
case TOKEN_FETCH_FAR_VEHICLE:
strcat(str, SZ_TOKEN_FETCH_FAR_VEHICLE);
goto _on_off;
case TOKEN_AUTO_ATTACK:
strcat(str, SZ_TOKEN_AUTO_ATTACK);
goto _on_off;
case TOKEN_FLATTEN_BASE:
strcat(str, SZ_TOKEN_FLATTEN_BASE);
goto _on_off;
case TOKEN_BUILD_OUTER_DEFENCES:
strcat(str, SZ_TOKEN_BUILD_OUTER_DEFENCES);
goto _on_off;
case TOKEN_SET_AUTO_BUILD:
strcat(str, SZ_TOKEN_SET_AUTO_BUILD);
goto _on_off;
case TOKEN_SET_AUTO_HOUSE:
strcat(str, SZ_TOKEN_SET_AUTO_HOUSE);
goto _on_off;
case TOKEN_DONT_HOUSE_SPECIALISTS:
strcat(str, SZ_TOKEN_DONT_HOUSE_SPECIALISTS);
goto _on_off;
case TOKEN_SET_REINCARNATION:
strcat(str, SZ_TOKEN_SET_REINCARNATION);
goto _on_off;
case TOKEN_EXTRA_WOOD_COLLECTION:
strcat(str, SZ_TOKEN_EXTRA_WOOD_COLLECTION);
goto _on_off;
case TOKEN_SET_BUCKET_USAGE:
strcat(str, SZ_TOKEN_SET_BUCKET_USAGE);
goto _on_off;
case TOKEN_SET_SPECIAL_NO_BLDG_PANEL:
strcat(str, SZ_TOKEN_SET_SPECIAL_NO_BLDG_PANEL);
goto _on_off;
case TOKEN_TURN_PUSH:
strcat(str, SZ_TOKEN_TURN_PUSH);
goto _on_off;
case TOKEN_FLYBY_ALLOW_INTERRUPT:
strcat(str, SZ_TOKEN_FLYBY_ALLOW_INTERRUPT);
goto _on_off;
case TOKEN_GIVE_UP_AND_SULK:
strcat(str, SZ_TOKEN_GIVE_UP_AND_SULK);
goto _on_off;
case TOKEN_AUTO_MESSAGES:
strcat(str, SZ_TOKEN_AUTO_MESSAGES);
goto _on_off;
case TOKEN_ATTACK:
{
if(!Script_inc_si()) return RES_FATAL;
strcat(str, SZ_TOKEN_ATTACK);
strcat(str, " ");
// team
switch(script_code)
{
case TOKEN_BLUE: strcat(str, SZ_TOKEN_BLUE); break;
case TOKEN_RED: strcat(str, SZ_TOKEN_RED); break;
case TOKEN_YELLOW: strcat(str, SZ_TOKEN_YELLOW); break;
case TOKEN_GREEN: strcat(str, SZ_TOKEN_GREEN); break;
default:
if(!ScriptDecompile_GetField(str2))
{
if(!Script_inc_si()) return RES_FATAL; // team
if(!Script_inc_si()) return RES_FATAL; // ppl
if(!Script_inc_si()) return RES_FATAL; // target
if(!Script_inc_si()) return RES_FATAL; // model
if(!Script_inc_si()) return RES_FATAL; // damage
if(!Script_inc_si()) return RES_FATAL; // spell
if(!Script_inc_si()) return RES_FATAL; // spell
if(!Script_inc_si()) return RES_FATAL; // spell
if(!Script_inc_si()) return RES_FATAL; // attack type
if(!Script_inc_si()) return RES_FATAL; // bring back vehicles
if(!Script_inc_si()) return RES_FATAL; // marker
if(!Script_inc_si()) return RES_FATAL; // marker
if(!Script_inc_si()) return RES_FATAL; // marker
ScriptWriteToken(str);
ScriptWriteSz(str2);
script_fail = true;
return RES_OK;
}
strcat(str, str2);
break;
}
if(!Script_inc_si()) return RES_FATAL;
// ppl
if(!ScriptDecompile_GetField(str2))
{
if(!Script_inc_si()) return RES_FATAL; // ppl
if(!Script_inc_si()) return RES_FATAL; // target
if(!Script_inc_si()) return RES_FATAL; // model
if(!Script_inc_si()) return RES_FATAL; // damage
if(!Script_inc_si()) return RES_FATAL; // spell
if(!Script_inc_si()) return RES_FATAL; // spell
if(!Script_inc_si()) return RES_FATAL; // spell
if(!Script_inc_si()) return RES_FATAL; // attack type
if(!Script_inc_si()) return RES_FATAL; // bring back vehicles
if(!Script_inc_si()) return RES_FATAL; // marker
if(!Script_inc_si()) return RES_FATAL; // marker
if(!Script_inc_si()) return RES_FATAL; // marker
ScriptWriteToken(str);
ScriptWriteSz(str2);
script_fail = true;
return RES_OK;
}
if(!Script_inc_si()) return RES_FATAL;
strcat(str, " ");
strcat(str, str2);
strcat(str, " ");
// target
switch(script_code)
{
case TOKEN_ATTACK_MARKER: strcat(str, SZ_TOKEN_ATTACK_MARKER); break;
case TOKEN_ATTACK_BUILDING: strcat(str, SZ_TOKEN_ATTACK_BUILDING); break;
case TOKEN_ATTACK_PERSON: strcat(str, SZ_TOKEN_ATTACK_PERSON); break;
default:
if(!Script_inc_si()) return RES_FATAL; // target
if(!Script_inc_si()) return RES_FATAL; // model
if(!Script_inc_si()) return RES_FATAL; // damage
if(!Script_inc_si()) return RES_FATAL; // spell
if(!Script_inc_si()) return RES_FATAL; // spell
if(!Script_inc_si()) return RES_FATAL; // spell
if(!Script_inc_si()) return RES_FATAL; // attack type
if(!Script_inc_si()) return RES_FATAL; // bring back vehicles
if(!Script_inc_si()) return RES_FATAL; // marker
if(!Script_inc_si()) return RES_FATAL; // marker
if(!Script_inc_si()) return RES_FATAL; // marker
ScriptWriteToken(str);
sprintf(str, SZ_SCRIPT_ERR_TARGET_TYPE_EXPECTED, script_code);
ScriptWriteSz(str);
script_fail = true;
return RES_OK;
}
if(!Script_inc_si()) return RES_FATAL;
// model
if(!ScriptDecompile_GetField(str2))
{
if(!Script_inc_si()) return RES_FATAL; // model
if(!Script_inc_si()) return RES_FATAL; // damage
if(!Script_inc_si()) return RES_FATAL; // spell
if(!Script_inc_si()) return RES_FATAL; // spell
if(!Script_inc_si()) return RES_FATAL; // spell
if(!Script_inc_si()) return RES_FATAL; // attack type
if(!Script_inc_si()) return RES_FATAL; // bring back vehicles
if(!Script_inc_si()) return RES_FATAL; // marker
if(!Script_inc_si()) return RES_FATAL; // marker
if(!Script_inc_si()) return RES_FATAL; // marker
ScriptWriteToken(str);
ScriptWriteSz(str2);
script_fail = true;
return RES_OK;
}
if(!Script_inc_si()) return RES_FATAL;
strcat(str, " ");
strcat(str, str2);
// damage
if(!ScriptDecompile_GetField(str2))
{
if(!Script_inc_si()) return RES_FATAL; // damage
if(!Script_inc_si()) return RES_FATAL; // spell
if(!Script_inc_si()) return RES_FATAL; // spell
if(!Script_inc_si()) return RES_FATAL; // spell
if(!Script_inc_si()) return RES_FATAL; // attack type
if(!Script_inc_si()) return RES_FATAL; // bring back vehicles
if(!Script_inc_si()) return RES_FATAL; // marker
if(!Script_inc_si()) return RES_FATAL; // marker
if(!Script_inc_si()) return RES_FATAL; // marker
ScriptWriteToken(str);
ScriptWriteSz(str2);
script_fail = true;
return RES_OK;
}
if(!Script_inc_si()) return RES_FATAL;
strcat(str, " ");
strcat(str, str2);
// spell 1
if(!ScriptDecompile_GetField(str2))
{
if(!Script_inc_si()) return RES_FATAL; // spell
if(!Script_inc_si()) return RES_FATAL; // spell
if(!Script_inc_si()) return RES_FATAL; // spell
if(!Script_inc_si()) return RES_FATAL; // attack type
if(!Script_inc_si()) return RES_FATAL; // bring back vehicles
if(!Script_inc_si()) return RES_FATAL; // marker
if(!Script_inc_si()) return RES_FATAL; // marker
if(!Script_inc_si()) return RES_FATAL; // marker
ScriptWriteToken(str);
ScriptWriteSz(str2);
script_fail = true;
return RES_OK;
}
if(!Script_inc_si()) return RES_FATAL;
strcat(str, " ");
strcat(str, str2);
// spell 2
if(!ScriptDecompile_GetField(str2))
{
if(!Script_inc_si()) return RES_FATAL; // spell
if(!Script_inc_si()) return RES_FATAL; // spell
if(!Script_inc_si()) return RES_FATAL; // attack type
if(!Script_inc_si()) return RES_FATAL; // bring back vehicles
if(!Script_inc_si()) return RES_FATAL; // marker
if(!Script_inc_si()) return RES_FATAL; // marker
if(!Script_inc_si()) return RES_FATAL; // marker
ScriptWriteToken(str);
ScriptWriteSz(str2);
script_fail = true;
return RES_OK;
}
if(!Script_inc_si()) return RES_FATAL;
strcat(str, " ");
strcat(str, str2);
// spell 3
if(!ScriptDecompile_GetField(str2))
{
if(!Script_inc_si()) return RES_FATAL; // spell
if(!Script_inc_si()) return RES_FATAL; // attack type
if(!Script_inc_si()) return RES_FATAL; // bring back vehicles
if(!Script_inc_si()) return RES_FATAL; // marker
if(!Script_inc_si()) return RES_FATAL; // marker
if(!Script_inc_si()) return RES_FATAL; // marker
ScriptWriteToken(str);
ScriptWriteSz(str2);
script_fail = true;
return RES_OK;
}
if(!Script_inc_si()) return RES_FATAL;
strcat(str, " ");
strcat(str, str2);
strcat(str, " ");
// attack type
switch(script_code)
{
case TOKEN_ATTACK_NORMAL: strcat(str, SZ_TOKEN_ATTACK_NORMAL); break;
case TOKEN_ATTACK_BY_BOAT: strcat(str, SZ_TOKEN_ATTACK_BY_BOAT); break;
case TOKEN_ATTACK_BY_BALLOON: strcat(str, SZ_TOKEN_ATTACK_BY_BALLOON); break;
default:
if(!Script_inc_si()) return RES_FATAL; // attack type
if(!Script_inc_si()) return RES_FATAL; // bring back vehicles
if(!Script_inc_si()) return RES_FATAL; // marker
if(!Script_inc_si()) return RES_FATAL; // marker
if(!Script_inc_si()) return RES_FATAL; // marker
ScriptWriteToken(str);
sprintf(str, SZ_SCRIPT_ERR_ATTACK_TYPE_EXPECTED, script_code);
ScriptWriteSz(str);
script_fail = true;
return RES_OK;
}
if(!Script_inc_si()) return RES_FATAL;
// bring back vehicles
if(!ScriptDecompile_GetField(str2))
{
if(!Script_inc_si()) return RES_FATAL; // bring back vehicles
if(!Script_inc_si()) return RES_FATAL; // marker
if(!Script_inc_si()) return RES_FATAL; // marker
if(!Script_inc_si()) return RES_FATAL; // marker
ScriptWriteToken(str);
ScriptWriteSz(str2);
script_fail = true;
return RES_OK;
}
if(!Script_inc_si()) return RES_FATAL;
strcat(str, " ");
strcat(str, str2);
// marker, attack via
if(!ScriptDecompile_GetField(str2))
{
if(!Script_inc_si()) return RES_FATAL; // marker
if(!Script_inc_si()) return RES_FATAL; // marker
if(!Script_inc_si()) return RES_FATAL; // marker
ScriptWriteToken(str);
ScriptWriteSz(str2);
script_fail = true;
return RES_OK;
}
if(!Script_inc_si()) return RES_FATAL;
strcat(str, " ");
strcat(str, str2);
// marker, cast spell at
if(!ScriptDecompile_GetField(str2))
{
if(!Script_inc_si()) return RES_FATAL; // marker
if(!Script_inc_si()) return RES_FATAL; // marker
ScriptWriteToken(str);
ScriptWriteSz(str2);
script_fail = true;
return RES_OK;
}
if(!Script_inc_si()) return RES_FATAL;
strcat(str, " ");
strcat(str, str2);
// marker, direction to cast spell at
if(!ScriptDecompile_GetField(str2))
{
if(!Script_inc_si()) return RES_FATAL; // marker
ScriptWriteToken(str);
ScriptWriteSz(str2);
script_fail = true;
return RES_OK;
}
if(!Script_inc_si()) return RES_FATAL;
strcat(str, " ");
strcat(str, str2);
ScriptWriteToken(str);
return RES_OK;
}
case TOKEN_SPELL_ATTACK:
{
if(!Script_inc_si()) return RES_FATAL;
strcat(str, SZ_TOKEN_SPELL_ATTACK);
// spell
if(!ScriptDecompile_GetField(str2))
{
if(!Script_inc_si()) return RES_FATAL; // spell
if(!Script_inc_si()) return RES_FATAL; // marker
if(!Script_inc_si()) return RES_FATAL; // direction
ScriptWriteToken(str);
ScriptWriteSz(str2);
script_fail = true;
return RES_OK;
}
if(!Script_inc_si()) return RES_FATAL;
strcat(str, " ");
strcat(str, str2);
// marker
if(!ScriptDecompile_GetField(str2))
{
if(!Script_inc_si()) return RES_FATAL; // marker
if(!Script_inc_si()) return RES_FATAL; // direction
ScriptWriteToken(str);
ScriptWriteSz(str2);
script_fail = true;
return RES_OK;
}
if(!Script_inc_si()) return RES_FATAL;
strcat(str, " ");
strcat(str, str2);
// direction
if(!ScriptDecompile_GetField(str2))
{
if(!Script_inc_si()) return RES_FATAL; // direction
ScriptWriteToken(str);
ScriptWriteSz(str2);
script_fail = true;
return RES_OK;
}
if(!Script_inc_si()) return RES_FATAL;
strcat(str, " ");
strcat(str, str2);
ScriptWriteToken(str);
return RES_OK;
}
case TOKEN_RESET_BASE_MARKER:
{
if(!Script_inc_si()) return RES_FATAL;
strcat(str, SZ_TOKEN_RESET_BASE_MARKER);
ScriptWriteToken(str);
return RES_OK;
}
case TOKEN_SET_BASE_MARKER:
{
if(!Script_inc_si()) return RES_FATAL;
strcat(str, SZ_TOKEN_SET_BASE_MARKER);
// marker
if(!ScriptDecompile_GetField(str2))
{
if(!Script_inc_si()) return RES_FATAL;
ScriptWriteToken(str);
ScriptWriteSz(str2);
script_fail = true;
return RES_OK;
}
if(!Script_inc_si()) return RES_FATAL;
strcat(str, " ");
strcata(str, str2);
ScriptWriteToken(str);
return RES_OK;
}
case TOKEN_SET_BASE_RADIUS:
{
if(!Script_inc_si()) return RES_FATAL;
strcat(str, SZ_TOKEN_SET_BASE_RADIUS);
// radius
if(!ScriptDecompile_GetField(str2))
{
if(!Script_inc_si()) return RES_FATAL;
ScriptWriteToken(str);
ScriptWriteSz(str2);
script_fail = true;
return RES_OK;
}
if(!Script_inc_si()) return RES_FATAL;
strcat(str, " ");
strcata(str, str2);
ScriptWriteToken(str);
return RES_OK;
}
case TOKEN_COUNT_PEOPLE_IN_MARKER:
{
if(!Script_inc_si()) return RES_FATAL;
strcat(str, SZ_TOKEN_COUNT_PEOPLE_IN_MARKER);
strcat(str, " ");
// team
switch(script_code)
{
case TOKEN_BLUE: strcat(str, SZ_TOKEN_BLUE); break;