-
Notifications
You must be signed in to change notification settings - Fork 3
/
monkcave.tsct
890 lines (865 loc) · 19.3 KB
/
monkcave.tsct
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
/*
* This file was auto-generated using 'silver-reversing-sct' tool
* to better understand the scripts presented, one is encouraged to
* view the catalogs at:
* https://github.com/nadavshemesh/silver-reversing-sct/blob/master/docs/index.md
*
* Any further information and support of this project please visit:
* https://github.com/nadavshemesh/silver-reversing-sct
*/
._DATA
VAR_18 { 0, 0, -1 }
VAR_23 -1
david1 { 0, 0 }
VAR_60 { 0, 0 }
init_position { -1119, -189, 593 }
VAR_90 { -6295, -1265, 625 }
VAR_103 -1
init_position1 { 315, -189, 143 }
walk_position { -587, -189, 1050 }
VAR_113 { 0, 0 }
position { -490, -189, 818 }
VAR_119 -1
._on_load
execute SCRIPT_3
execute SCRIPT_4
call load_sound_set(int 30)
/* play the sound 'torches2' */
call play_loaded_sound(int 1, int -1, int 30, int 0)
call load_sound_set(int 64)
var cavelp_sound_ref = call play_loaded_sound(int 1, int -1, int 64, int 0)
call set_sound_volume(var cavelp_sound_ref, int 25)
call load_sound_set(int 59)
var bird1_sound_ref = call play_loaded_sound(int 2, int -1, int 59, int 0)
call set_sound_volume(var bird1_sound_ref, int 12)
call load_sound_set(int 65)
var dog1_sound_ref = call play_loaded_sound(int 7, int -1, int 65, int 0)
call set_sound_volume(var dog1_sound_ref, int 7)
execute SCRIPT_17
if(gamevar is_room_cleared)
{
execute SCRIPT_15
}
else
{
switch(gamevar room_state)
{
case 1
execute SCRIPT_6
break
case 2
execute SCRIPT_8
break
case 3
execute SCRIPT_11
break
case 20
execute SCRIPT_12
break
case 0
break
}
}
._infinite_loop
execute SCRIPT_16
var VAR_0 = int 20
execute SCRIPT_18
if(gamevar !is_room_cleared)
{
switch(gamevar room_state)
{
case 1
execute SCRIPT_5
break
case 2
execute SCRIPT_7
if(var VAR_53 == int 6)
{
var david = call get_david_char()
while(var david)
{
if(call create_item(int 105 /* unknown */ ))
{
var VAR_55 = int 1
}
var david = call get_next_char_from_list()
}
if(var VAR_55 == int 0)
{
call func_108("ARSE")
}
}
break
case 3
execute SCRIPT_10
break
case 20
execute SCRIPT_13
break
case 0
break
}
}
var VAR_53 ++
._on_exit
execute SCRIPT_19
if(gamevar !is_room_cleared)
{
switch(gamevar room_state)
{
case 1
if(var VAR_60)
{
gamevar room_state ++
}
break
case 2
if(var VAR_57)
{
gamevar room_state ++
var david1 = call get_david_char()
while(var david1)
{
if(var david1 != gamevar control_char_p)
{
call func_34(var david1)
var VAR_59 = var david1
}
else
{
var VAR_59 = int 0
}
var david1 = call get_next_char_from_list()
if(var VAR_59)
{
call remove_char(var VAR_59)
}
}
call func_34(var nmedmonk)
}
break
case 3
gamevar room_state = int 20
break
case 20
break
case 0
break
default
gamevar room_state = int 0
break
}
}
._SCRIPT_3
gamevar SMACKER_X = int 268
gamevar SMACKER_Y = int 48
call play_2d_anim("monkcave", int 1, int 0, int 0)
._SCRIPT_4
var david1 = call get_david_char()
while(var david1)
{
var VAR_61 = call get_char_handle_id(var david1)
switch(var VAR_61)
{
case 65536
call log_string("david")
var VAR_42 = var david1
break
case 786432
call log_string("sekune")
var VAR_44 = var david1
break
case 327680
call log_string("jug")
var VAR_43 = var david1
break
case 196608
call log_string("vivienne")
var VAR_45 = var david1
break
case 131072
call log_string("chiaro")
var VAR_46 = var david1
break
case 262144
call log_string("cagen")
var VAR_47 = var david1
break
default
call log_string("WARNING! Unknown hero while checking heroes")
call log_string("Get a goober -- QUICKLY!!")
break
}
var VAR_62 ++
var david1 = call get_next_char_from_list()
}
._SCRIPT_5
switch(var VAR_74)
{
case 0
if(call ! func_127(var nmedmonk))
{
var selected_hero = call get_selected_hero()
if(var selected_hero)
{
if(var selected_hero == var VAR_42)
{
if(var VAR_45)
{
call func_10c(var nmedmonk, "WIT_VIV")
}
if(var VAR_44)
{
call func_10c(var nmedmonk, "WIT_SEK")
}
if(var VAR_47)
{
call func_10c(var nmedmonk, "WIT_CAG")
}
}
else
{
call func_10c(var nmedmonk, "NULL")
}
}
else
{
var VAR_74 = int -1
var VAR_75 = int 0
}
}
else
{
call func_116("gno", "entrance", int 5)
call set_scene_overwrite_act("gno", "entrance", int 0)
call func_116("gno", "libarea1", int 4)
call set_scene_overwrite_act("gno", "libarea1", int 1)
var VAR_60 = int 1
var VAR_74 ++
var VAR_75 = int 0
}
break
case 1
break
}
var VAR_75 ++
._SCRIPT_6
var nmedmonk = call create_char(var &init_position, "nmedmonk", int 25, int 13)
._SCRIPT_7
if(var VAR_103 != var VAR_98)
{
var VAR_103 = var VAR_98
call log_var(var VAR_98)
}
switch(var VAR_98)
{
case 0
if(var VAR_99 == int 5)
{
call func_108("ACT_2")
var VAR_98 ++
var VAR_99 = int 0
}
break
case 1
var unknown1 = call create_item(int 105)
if(var unknown1)
{
var VAR_98 ++
var VAR_99 = int 0
}
else
{
var VAR_98 = int -1
var VAR_99 = int 0
}
break
case 2
if(call func_127(var nmedmonk))
{
var VAR_57 = int 1
var VAR_98 ++
var VAR_99 = int 0
}
break
case 3
if(call func_6d() == int 1)
{
call set_input_system(int 2)
var selected_hero1 = call get_selected_hero()
call char_remove_magic_and_weapons(var selected_hero1)
var VAR_98 ++
var VAR_99 = int 0
}
break
case 4
if(var VAR_99 > int 80)
{
call play_char_anim(var selected_hero1, var jangive_anim, int 0)
var VAR_99 = int 0
var VAR_98 ++
}
break
case 5
if(call func_5c(var selected_hero1))
{
call func_f9(var unknown1, int 100)
call func_b6(var selected_hero1, var unknown1)
var VAR_98 ++
var VAR_99 = int 0
}
break
case 6
if(var VAR_99 > int 130)
{
call resume_conversation()
var VAR_98 ++
var VAR_99 = int 0
}
break
case 7
if(call get_input_sys() != int 4)
{
call set_input_system(int 2)
call play_char_anim(var nmedmonk, var jangive_anim, int 0)
var VAR_98 ++
var VAR_99 = int 0
}
break
case 8
if(call func_5c(var nmedmonk))
{
call func_f9(var ethpot1, int 100)
var ethpot = call add_item_to_char(var selected_hero1, int 97, int 1, int 0)
var VAR_98 ++
var VAR_99 = int 0
}
break
case 9
if(var VAR_99 > int 60)
{
call func_55(var selected_hero1, int 97)
var VAR_99 = int 0
var VAR_98 ++
}
break
case 10
if(var VAR_99 > int 200)
{
var VAR_99 = int 0
var VAR_98 ++
call play_char_anim(var selected_hero1, var dazed_anim, int 0)
var VAR_39 = int 1
var VAR_48 = var selected_hero1
}
break
case 11
if(var VAR_99 > int 30)
{
var VAR_98 ++
call func_e6("monarea", "gallery1", var &VAR_90, int 1)
}
break
}
call log_var(var VAR_98)
var VAR_99 ++
if(var VAR_39)
{
execute SCRIPT_14
}
._SCRIPT_8
var nmedmonk = call create_char(var &init_position, "nmedmonk", int 25, int 13)
var ethpot1 = call add_item_to_char(var nmedmonk, int 97, int 0, int 0)
execute SCRIPT_9
._SCRIPT_9
var jangive_anim = call load_anim("jangive")
var sheatmp_anim = call load_anim("sheatmp")
var dazed_anim = call load_anim("dazed")
._SCRIPT_10
if(var VAR_119 != var VAR_108)
{
var VAR_119 = var VAR_108
call log_var(var VAR_108)
}
switch(var VAR_108)
{
case 0
if(var VAR_109 == int 10)
{
call func_108("dogwank")
call func_10c(var fade_chronicler, int 0)
}
if(var VAR_109 > int 30)
{
var VAR_108 ++
var VAR_109 = int 0
}
break
case 1
var david1 = call get_david_char()
while(var david1)
{
if(var david1 != gamevar control_char_p)
{
var VAR_114 = call get_char_handle_id(var david1)
switch(var VAR_114)
{
case 65536
if(var ! VAR_112)
{
var VAR_112 = var VAR_42
}
else
{
if(var ! VAR_113)
{
var VAR_113 = var VAR_42
}
else
{
call log_string("SOMETHING IS WRONG!")
}
}
break
case 786432
if(var ! VAR_112)
{
var VAR_112 = var VAR_44
}
else
{
if(var ! VAR_113)
{
var VAR_113 = var VAR_44
}
else
{
call log_string("SOMETHING IS WRONG!")
}
}
break
case 327680
if(var ! VAR_112)
{
var VAR_112 = var VAR_43
}
else
{
if(var ! VAR_113)
{
var VAR_113 = var VAR_43
}
else
{
call log_string("SOMETHING IS WRONG!")
}
}
break
case 196608
if(var ! VAR_112)
{
var VAR_112 = var VAR_45
}
else
{
if(var ! VAR_113)
{
var VAR_113 = var VAR_45
}
else
{
call log_string("SOMETHING IS WRONG!")
}
}
break
case 131072
if(var ! VAR_112)
{
var VAR_112 = var VAR_46
}
else
{
if(var ! VAR_113)
{
var VAR_113 = var VAR_46
}
else
{
call log_string("SOMETHING IS WRONG!")
}
}
break
case 262144
if(var ! VAR_112)
{
var VAR_112 = var VAR_47
}
else
{
if(var ! VAR_113)
{
var VAR_113 = var VAR_47
}
else
{
call log_string("SOMETHING IS WRONG!")
}
}
break
default
call log_string("SOMETHING IS WRONG!")
break
}
}
var VAR_62 ++
var david1 = call get_next_char_from_list()
}
if(var VAR_112)
{
call set_char_running(var VAR_112)
call char_walk_to_pos(var VAR_112, ""þÿÿCÿÿÿM")
}
if(var VAR_113)
{
call set_char_running(var VAR_113)
call char_walk_to_pos(var VAR_113, var &walk_position)
}
var VAR_108 ++
var VAR_109 = int 0
break
case 2
if(var ! VAR_115)
{
if(var VAR_112)
{
if(call is_char_standing(var VAR_112))
{
call char_turn_to_pos(var VAR_112, call get_char_pos(gamevar control_char_p))
var VAR_115 = int 1
}
}
else
{
var VAR_115 = int 1
}
}
if(var ! VAR_116)
{
if(var VAR_113)
{
if(call is_char_standing(var VAR_113))
{
call char_turn_to_pos(var VAR_113, call get_char_pos(gamevar control_char_p))
var VAR_116 = int 1
}
}
else
{
var VAR_116 = int 1
}
}
if(var VAR_115&&var VAR_116)
{
call char_turn_to_pos(gamevar control_char_p, var &position)
var VAR_108 ++
var VAR_109 = int 0
}
break
case 3
if(var VAR_109 > int 30)
{
var VAR_108 ++
var VAR_109 = int 0
}
break
case 4
var VAR_117 = call get_char_handle_id(gamevar control_char_p)
switch(var VAR_117)
{
case 65536
if(var VAR_112)
{
var VAR_114 = call get_char_handle_id(var VAR_112)
switch(var VAR_114)
{
case 786432
call start_dialog("S_DVDPOT", "NULL")
break
case 327680
call start_dialog("J_DVDPOT", "NULL")
break
case 196608
call start_dialog("V_DVDPOT", "NULL")
break
case 262144
call start_dialog("C_DVDPOT", "NULL")
break
case 131072
call log_string("no chiaro dialog!")
break
}
}
else
{
call log_string("Ooops! Only 1 hero!!")
}
break
case 196608
call start_dialog("S_VIVPOT", "NULL")
break
case 327680
call start_dialog("S_JUGPOT", "NULL")
break
case 262144
call start_dialog("S_CAGPOT", "NULL")
break
case 786432
call start_dialog("S_SEKPOT", "NULL")
break
case 131072
call log_string("no chiaro dialog!")
break
}
var VAR_108 ++
var VAR_109 = int 0
break
case 5
if(call get_input_sys() != int 4)
{
call set_input_system(int 1)
var VAR_108 ++
var VAR_109 = int 0
}
break
}
var VAR_109 ++
._SCRIPT_11
var fade_chronicler = call create_enemy(int 178, int 0, var &init_position1, int 325)
call set_input_system(int 2)
._SCRIPT_12
var nmedmonk = call create_char(var &init_position, "nmedmonk", int 25, int 13)
call func_108("DOGWANK")
call log_string("init_act20")
._SCRIPT_13
switch(var VAR_150)
{
}
var VAR_151 ++
._SCRIPT_14
var VAR_41 ++
if(var VAR_41 == int 16)
{
call func_f1(var VAR_48, var VAR_40)
var VAR_41 = int 0
var VAR_40 ++
if(var VAR_40 == int 8)
{
var VAR_39 = int 0
}
}
._SCRIPT_15
._SCRIPT_16
if(gamevar script_time > var VAR_157)
{
var VAR_157 = gamevar script_time + int 60 + call randomize_int(int 0, int 40)
var VAR_155 = int 8 + call randomize_int(int 0, int 3)
var VAR_154 = call play_loaded_sound(var VAR_155, int 0, int 59, int 0)
if(var VAR_154)
{
call set_sound_volume(var VAR_154, int 7)
}
}
if(gamevar script_time > var VAR_156)
{
var VAR_156 = gamevar script_time + int 120 + call randomize_int(int 0, int 60)
var inwindlp_sound_ref = call play_loaded_sound(int 2, int 0, int 65, int 0)
if(var inwindlp_sound_ref)
{
call set_sound_volume(var inwindlp_sound_ref, int 9)
}
}
._SCRIPT_17
if(call ! is_char_handle_in_level(int 6291456 /* CHRONICL */ ))
{
exit_script
}
else
{
if(var fade_chronicler == int 0)
{
var fade_chronicler = call get_char_handle(int 6291456)
}
}
._SCRIPT_18
if(call ! is_char_handle_in_level(int 6291456 /* CHRONICL */ ))
{
exit_script
}
else
{
if(var fade_chronicler == int 0)
{
var fade_chronicler = call get_char_handle(int 6291456)
}
}
if(var VAR_23 != var VAR_17)
{
var VAR_23 = var VAR_17
call log_var(var VAR_17)
}
switch(var VAR_17)
{
case 0
if(gamevar chronicler_variation != int -1)
{
execute SCRIPT_20
}
gamevar script_object = var fade_chronicler
var VAR_20 = gamevar *character_movement_p+3
var VAR_21 = gamevar *character_movement_p+4
var VAR_22 = gamevar *character_movement_p+5
var VAR_3 = int 0
call func_10c(var fade_chronicler, int 0)
var VAR_17 ++
var VAR_18 = int 0
break
case 1
if(call func_127(var fade_chronicler))
{
var VAR_19 = gamevar saved_games_count
var VAR_3 = int 1
var VAR_17 ++
var VAR_18 = int 0
}
break
case 2
if(call get_input_sys() != int 4)
{
call set_input_system(int 2)
var VAR_17 ++
var VAR_18 = int 0
}
break
case 3
if(var VAR_18 > int 40)
{
call open_save_screen(var VAR_0)
var VAR_17 ++
var VAR_18 = int 0
}
break
case 4
if(var VAR_18 > int 10)
{
if(gamevar !current_menu_level_p)
{
var VAR_17 ++
var VAR_18 = int 0
}
}
break
case 5
if(var VAR_19 != gamevar saved_games_count)
{
call log_string("game saved")
call func_11d()
var VAR_17 = int 7
var VAR_18 = int 0
}
else
{
call log_string("game not saved")
call func_2a(var fade_chronicler, var &VAR_20)
execute SCRIPT_21
gamevar chronicler_variation = var VAR_2
var VAR_17 ++
var VAR_18 = int 0
}
break
case 6
if(var VAR_18 > int 30)
{
call set_input_system(int 1)
gamevar clicked_character = int 0
var VAR_3 = int 0
var VAR_17 = int 1
var VAR_18 = int 0
}
break
case 7
if(var VAR_18 > int 40)
{
call apply_effect_on_char(gamevar char_gen_fx_scripts, int 8, int 0, var fade_chronicler)
execute SCRIPT_21
gamevar chronicler_variation = var VAR_2
var VAR_17 ++
var VAR_18 = int 0
}
break
case 8
if(var VAR_18 > int 100)
{
call remove_char(var fade_chronicler)
call set_input_system(int 1)
var VAR_3 = int 0
var VAR_17 ++
var VAR_18 = int 0
}
break
}
var VAR_18 ++
._SCRIPT_19
if(call is_char_handle_in_level(int 6291456 /* CHRONICL */ ))
{
if(var fade_chronicler == int 0)
{
var fade_chronicler = call get_char_handle(int 6291456)
}
call func_34(var fade_chronicler)
}
._SCRIPT_20
var VAR_4 = call get_char_handle_id(gamevar control_char_p)
switch(var VAR_4)
{
case 65536
call load_dialog_by_number("DVDCHR", "NULL", gamevar chronicler_variation)
break
case 786432
call load_dialog_by_number("SEKCHR", "NULL", gamevar chronicler_variation)
break
case 262144
call load_dialog_by_number("CAGCHR", "NULL", gamevar chronicler_variation)
break
case 327680
call load_dialog_by_number("JUGCHR", "NULL", gamevar chronicler_variation)
break
case 131072
call load_dialog_by_number("CHICHR", "NULL", gamevar chronicler_variation)
break
case 196608
call load_dialog_by_number("VIVCHR", "NULL", gamevar chronicler_variation)
break
}
._SCRIPT_21
var VAR_26 = call get_char_handle_id(gamevar control_char_p)
switch(var VAR_26)
{
case 65536
var VAR_2 = call load_next_dialog("DVDCHR", "NULL")
break
case 786432
var VAR_2 = call load_next_dialog("SEKCHR", "NULL")
break
case 262144
var VAR_2 = call load_next_dialog("CAGCHR", "NULL")
break
case 327680
var VAR_2 = call load_next_dialog("JUGCHR", "NULL")
break
case 131072
var VAR_2 = call load_next_dialog("CHICHR", "NULL")
break
case 196608
var VAR_2 = call load_next_dialog("VIVCHR", "NULL")
break
}