forked from nmlgc/ReC98
-
Notifications
You must be signed in to change notification settings - Fork 0
/
th03_main.asm
35982 lines (31729 loc) · 654 KB
/
th03_main.asm
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
;
; +-------------------------------------------------------------------------+
; | This file has been generated by The Interactive Disassembler (IDA) |
; | Copyright (c) 2009 by Hex-Rays, <[email protected]> |
; +-------------------------------------------------------------------------+
;
; Input MD5 : 43EE91A800F1F0FE35A87149C90B037D
; File Name : th03/MAIN.EXE
; Format : MS-DOS executable (EXE)
; Base Address: 0h Range: 0h-26470h Loaded length: 1E6E2h
; Entry Point : 0:0
; OS type : MS DOS
; Application type: Executable 16bit
.386
.model use16 large _TEXT
include ReC98.inc
include th03/arg_bx.inc
include th03/th03.inc
include th03/main/playfld.inc
include th03/main/collmap.inc
include th03/main/player/bomb.inc
include th03/sprites/main_s16.inc
include th03/sprite16.inc
include libs/sprite16/sprite16.inc
extern _execl:proc
main_01 group main_0_TEXT, CFG_LRES_TEXT, main_010_TEXT, main_011_TEXT
main_04 group main_04_TEXT, COLLMAP_TEXT, main_04__TEXT
; ===========================================================================
; Segment type: Pure code
_TEXT segment word public 'CODE' use16
assume cs:_TEXT
assume es:nothing, ds:_DATA, fs:nothing, gs:nothing
include libs/master.lib/bfnt_entry_pat.asm
include libs/master.lib/bfnt_extend_header_skip.asm
include libs/master.lib/bfnt_header_read.asm
include libs/master.lib/bfnt_header_analysis.asm
include libs/master.lib/bcloser.asm
include libs/master.lib/bfill.asm
include libs/master.lib/bfnt_palette_set.asm
include libs/master.lib/bgetc.asm
include libs/master.lib/palette_black_out.asm
include libs/master.lib/bopenr.asm
include libs/master.lib/bread.asm
include libs/master.lib/bseek.asm
include libs/master.lib/bseek_.asm
include libs/master.lib/cutline.asm
include libs/master.lib/dos_keyclear.asm
include libs/master.lib/dos_setvect.asm
include libs/master.lib/egc.asm
include libs/master.lib/file_close.asm
include libs/master.lib/file_read.asm
include libs/master.lib/file_ropen.asm
include libs/master.lib/dos_close.asm
include libs/master.lib/dos_ropen.asm
include libs/master.lib/grcg_boxfill.asm
include libs/master.lib/grcg_circle.asm
include libs/master.lib/grcg_circle_x.asm
include libs/master.lib/grc_setclip.asm
include libs/master.lib/grcg_fill.asm
include libs/master.lib/grcg_hline.asm
include libs/master.lib/grcg_line.asm
include libs/master.lib/grcg_setcolor.asm
include libs/master.lib/grcg_settile_1line.asm
include libs/master.lib/grcg_triangle.asm
include libs/master.lib/grcg_vline.asm
include libs/master.lib/grcg_trapezoid.asm
include libs/master.lib/gaiji_backup.asm
include libs/master.lib/gaiji_entry_bfnt.asm
include libs/master.lib/gaiji_putca.asm
include libs/master.lib/gaiji_putsa.asm
include libs/master.lib/gaiji_read.asm
include libs/master.lib/gaiji_write.asm
include libs/master.lib/graph_200line.asm
include libs/master.lib/graph_400line.asm
include libs/master.lib/graph_clear.asm
include libs/master.lib/graph_copy_page.asm
include libs/master.lib/graph_extmode.asm
include libs/master.lib/graph_hide.asm
include libs/master.lib/graph_pi_free.asm
include libs/master.lib/graph_pi_load_pack.asm
include libs/master.lib/iatan2.asm
include libs/master.lib/js_end.asm
include libs/master.lib/make_linework.asm
include libs/master.lib/palette_show.asm
include libs/master.lib/pfclose.asm
include libs/master.lib/pfgetc.asm
include libs/master.lib/pfread.asm
include libs/master.lib/pfrewind.asm
include libs/master.lib/pfseek.asm
include libs/master.lib/random.asm
include libs/master.lib/smem_release.asm
include libs/master.lib/smem_wget.asm
include libs/master.lib/soundio.asm
include libs/master.lib/text_boxfilla.asm
include libs/master.lib/text_clear.asm
include libs/master.lib/text_fillca.asm
include libs/master.lib/text_puts.asm
include libs/master.lib/text_putsa.asm
include libs/master.lib/vsync.asm
include libs/master.lib/vsync_wait.asm
include libs/master.lib/hmem_lallocate.asm
include libs/master.lib/mem_assign_dos.asm
include libs/master.lib/mem_assign.asm
include libs/master.lib/memheap.asm
include libs/master.lib/mem_unassign.asm
include libs/master.lib/super_free.asm
include libs/master.lib/super_entry_pat.asm
include libs/master.lib/super_entry_at.asm
include libs/master.lib/super_entry_bfnt.asm
include libs/master.lib/super_cancel_pat.asm
include libs/master.lib/super_put.asm
include libs/master.lib/respal_exist.asm
include libs/master.lib/respal_get_palettes.asm
include libs/master.lib/pfint21.asm
db 0
include libs/master.lib/js_start.asm
include libs/master.lib/js_sense.asm
db 0
include th03/hardware/sprite16_copy.asm
include libs/master.lib/draw_trapezoid.asm
include th03/formats/pfopen.asm
include libs/master.lib/pf_str_ieq.asm
_TEXT ends
; ===========================================================================
; Segment type: Pure code
main_0_TEXT segment word public 'CODE' use16
assume cs:main_01
;org 5
assume es:nothing, ss:nothing, ds:_DATA, fs:nothing, gs:nothing
; =============== S U B R O U T I N E =======================================
; Attributes: bp-based frame
; int __cdecl main(int argc, const char **argv, const char **envp)
public _main
_main proc far
_argc = word ptr 6
_argv = dword ptr 8
_envp = dword ptr 0Ch
push bp
mov bp, sp
push si
call game_init_main pascal, ds, offset aCOul
call _cfg_load_resident_ptr
or ax, ax
jz short @@ret
mov _snd_midi_active, 0
les bx, _resident
cmp es:[bx+resident_t.bgm_mode], SND_BGM_OFF
jz short loc_970F
call _snd_determine_mode
loc_970F:
call gaiji_backup
push ds
push offset aGameft_bft ; "GAMEFT.bft"
call gaiji_entry_bfnt
call sub_9B14
call farfp_20F20
loc_9724:
mov PaletteTone, 100
call far ptr palette_show
call sub_9778
mov ah, 0
mov si, ax
les bx, _resident
mov eax, _round_frame
mov es:[bx+resident_t.rand], eax
cmp si, 1
jnz short loc_974D
call sub_A21F
jmp short loc_9724
; ---------------------------------------------------------------------------
loc_974D:
call sub_13DF9
kajacall KAJA_SONG_STOP
or si, si
jnz short loc_9764
push ds
push offset aOp ; "op"
jmp short loc_9770
; ---------------------------------------------------------------------------
loc_9764:
les bx, _resident
inc es:[bx+resident_t.story_stage]
push ds
push offset arg0 ; "mainl"
loc_9770:
nopcall @GameExecl$qnxc
@@ret:
pop si
pop bp
retf
_main endp
; =============== S U B R O U T I N E =======================================
; Attributes: bp-based frame
sub_9778 proc near
push bp
mov bp, sp
jmp loc_9AC9
; ---------------------------------------------------------------------------
loc_977E:
call _collmap_reset
call sub_1797F
mov _pid_current, 0
mov _pid_PID_so_attack, SO_ATTACK_P1
call p1_1FE70
call p1_1F32E
call p1_205CE
mov _pid_current, 1
mov _pid_PID_so_attack, SO_ATTACK_P2
call p2_1FE7C
call p2_1F332
call p2_205D2
call sub_B7E5
call shots_update
mov _pid_current, 0
mov _pid_PID_so_attack, SO_ATTACK_P1
call _chargeshot_update_p1
mov _pid_current, 1
mov _pid_PID_so_attack, SO_ATTACK_P2
call _chargeshot_update_p2
call sub_BB12
call sub_13CC7
call sub_17A1B
call sub_1609E
call sub_18059
mov _pid_current, 0
mov _pid_PID_so_attack, SO_ATTACK_P1
call p1_202A4
call p1_202AC
mov _pid_current, 1
mov _pid_PID_so_attack, SO_ATTACK_P2
call p2_202A8
call p2_202B0
nopcall sub_CEB2
call _input_mode
mov _pid_PID_current, 0
push _input_mp_p1
push offset _p1
call sub_DA43
mov _pid_PID_current, 1
push _input_mp_p2
push offset _p2
call sub_DA43
call _snd_se_update
test _input_sp.hi, high INPUT_CANCEL
jz short loc_9845
call sub_C7A5
loc_9845:
nopcall sub_CA3C
push 0
nopcall sub_CB81
push 1
nopcall sub_CB81
call farfp_20F24
cmp byte_23AFA, 0
jz short loc_986C
test byte ptr word_23AF6, 1
jz loc_9A62
loc_986C:
call egc_on
mov _pid_current, 0
mov _pid_PID_so_attack, SO_ATTACK_P1
call bomb_p1
mov _pid_current, 1
mov _pid_PID_so_attack, SO_ATTACK_P2
call bomb_p2
mov _pid_current, 0
mov _pid_PID_so_attack, SO_ATTACK_P1
call p1_1F336
mov _pid_current, 1
mov _pid_PID_so_attack, SO_ATTACK_P2
call p2_1F33A
call shots_render
call sub_164DA
call sub_1837C
call sub_B80B
mov _pid_current, 0
mov _pid_PID_so_attack, SO_ATTACK_P1
call p1_1FE74
call _chargeshot_render_p1
mov _pid_current, 1
mov _pid_PID_so_attack, SO_ATTACK_P2
call p2_1FE80
call _chargeshot_render_p2
mov _pid_PID_current, 0
push offset _p1
call _player_render
mov _pid_PID_current, 1
push offset _p2
call _player_render
call egc_off
mov _pid_PID_current, 0
push offset _p1
call sub_DF18
mov _pid_PID_current, 1
push offset _p2
call sub_DF18
nopcall sub_CEE0
call sub_17BD1
cmp byte_20E3C, 2
jnz loc_99B1
call sub_C2F9
les bx, _resident
cmp es:[bx+resident_t.game_mode], GM_STORY
jz short loc_9973
cmp _p1.rounds_won, 2
jnb short loc_994E
cmp _p2.rounds_won, 2
jnb short loc_994E
cmp word_23AF6, 0A0h
jz short loc_9986
cmp byte_1FBC3, 0
jz short loc_99B1
jmp short loc_99A4
; ---------------------------------------------------------------------------
loc_994E:
call sub_E3F2
mov ax, word_23AF6
cmp ax, word_1E6E8
jz short loc_9986
cmp byte_1FBC3, 0
jz short loc_99B1
les bx, _resident
mov al, es:[bx+resident_t.pid_winner]
mov ah, 0
push ax
call sub_A289
mov al, 2
pop bp
retn
; ---------------------------------------------------------------------------
loc_9973:
les bx, _resident
cmp es:[bx+resident_t.pid_winner], 0
jz short loc_994E
cmp word_23AF6, 0A0h
jnz short loc_998E
loc_9986:
mov fp_1FBC0, offset sub_B4A8
jmp short loc_99B1
; ---------------------------------------------------------------------------
loc_998E:
cmp byte_1FBC3, 0
jz short loc_99B1
les bx, _resident
cmp es:[bx+resident_t.story_lives], 0
jz short loc_99A8
dec es:[bx+resident_t.story_lives]
loc_99A4:
mov al, 1
pop bp
retn
; ---------------------------------------------------------------------------
loc_99A8:
push 0
call sub_A289
mov al, 2
pop bp
retn
; ---------------------------------------------------------------------------
loc_99B1:
call sub_C830
call sub_C8C4
call sub_D52E
push 0
nopcall sub_C9FE
push 1
nopcall sub_C9FE
call sub_BE5D
call _combo_update_and_render
call fp_1FBC0
call fp_1E6EA
cmp byte_23AFA, 0
jnz short loc_99F7
loc_99DF:
mov al, byte_23AF9
mov ah, 0
cmp ax, vsync_Count1
ja short loc_99DF
mov vsync_Count1, 0
mov byte_23AF9, 1
jmp short loc_9A14
; ---------------------------------------------------------------------------
loc_99F7:
test byte ptr word_23AF6, 1
jnz short loc_9A14
mov vsync_Count1, 0
loc_9A04:
mov al, byte_23AF9
mov ah, 0
cmp ax, vsync_Count1
ja short loc_9A04
mov byte_23AF9, 2
loc_9A14:
cmp _palette_changed, 0
jz short loc_9A25
call far ptr palette_show
mov _palette_changed, 0
loc_9A25:
graph_accesspage _page_front
graph_showpage _page_back
mov _page_front, al
xor _page_back, 1
call grcg_setcolor pascal, (GC_RMW shl 16) + 0
mov bx, 3932h
call sub_B37C
call grcg_setcolor pascal, (GC_RMW shl 16) + 1
mov bx, 395Ah
call sub_B37C
call grcg_off
loc_9A62:
inc _round_frame
inc word_23AF6
mov al, byte ptr _round_frame
and al, 0Fh
mov _round_frame_mod16, al
and al, 7
mov _round_frame_mod8, al
and al, 3
mov _round_frame_mod4, al
and al, 1
mov _round_frame_mod2, al
test byte ptr word_23AF6, 3Fh
jnz short loc_9AC9
cmp byte_23AF8, 7Fh
jnb short loc_9A94
inc byte_23AF8
loc_9A94:
test word_23AF6, 3FFh
jnz short loc_9AB5
call @randring_fill$qv
cmp _p1.miss_damage_next, 6
jnb short loc_9AAA
inc _p1.miss_damage_next
loc_9AAA:
cmp _p2.miss_damage_next, 6
jnb short loc_9AB5
inc _p2.miss_damage_next
loc_9AB5:
cmp word_23AF6, 7D0h
jnb short loc_9AC9
mov _p1.cpu_frame, 0
mov _p2.cpu_frame, 0
loc_9AC9:
cmp byte_23B00, 0
jz loc_977E
mov al, 0
pop bp
retn
sub_9778 endp
; =============== S U B R O U T I N E =======================================
; Attributes: bp-based frame
sub_9AD6 proc near
push bp
mov bp, sp
cmp _demo_frame, DEMO_N
jnb short loc_9AE7
inc _demo_frame
jmp short loc_9AF5
; ---------------------------------------------------------------------------
loc_9AE7:
cmp _demo_frame, DEMO_N
jnz short loc_9AF5
mov fp_1FBC0, offset sub_B4A8
loc_9AF5:
cmp byte_1FBC3, 0
jz short loc_9B01
mov byte_23B00, 1
loc_9B01:
cmp _input_sp, INPUT_NONE
jz short loc_9B0D
mov byte_23B00, 1
loc_9B0D:
pop bp
retn
sub_9AD6 endp
; =============== S U B R O U T I N E =======================================
; Attributes: bp-based frame
sub_9B0F proc near
push bp
mov bp, sp
pop bp
retn
sub_9B0F endp
; =============== S U B R O U T I N E =======================================
; Attributes: bp-based frame
sub_9B14 proc near
var_8 = word ptr -8
var_6 = dword ptr -6
var_2 = word ptr -2
enter 8, 0
push si
push di
les bx, _resident
mov eax, es:[bx+resident_t.rand]
mov random_seed, eax
call text_fillca pascal, (' ' shl 16) + TX_BLACK + TX_REVERSE
call graph_copy_page pascal, 0
call sub_13CDD
mov byte_207E3, 0
call sub_9EBF
call _hflip_lut_generate
nopcall sub_D5A2
mov byte_23AFA, 0
les bx, _resident
cmp es:[bx+resident_t.story_stage], 8
jnb short loc_9B68
mov word_1E6E8, 140h
jmp short loc_9B6E
; ---------------------------------------------------------------------------
loc_9B68:
mov word_1E6E8, 1CCh
loc_9B6E:
les bx, _resident
cmp es:[bx+resident_t.game_mode], GM_STORY
jnz loc_9BFF
xor si, si
jmp short loc_9B8E
; ---------------------------------------------------------------------------
loc_9B7F:
les bx, _resident
add bx, si
mov al, es:[bx+resident_t.score_last]
mov _score_p1[si], al
inc si
loc_9B8E:
cmp si, SCORE_DIGITS
jl short loc_9B7F
les bx, _resident
mov al, es:[bx+resident_t.story_stage]
mov ah, 0
mov bx, ax
cmp bx, 5
ja short @@cpu_additional_hit_damage_in_stage_7_8_9
add bx, bx
jmp cs:@@cpu_additional_hit_damage[bx]
@@cpu_additional_hit_damage_in_stage_1_2:
mov _cpu_hit_damage_additional, 3
jmp short loc_9BC5
; ---------------------------------------------------------------------------
@@cpu_additional_hit_damage_in_stage_3_4:
mov _cpu_hit_damage_additional, 2
jmp short loc_9BC5
; ---------------------------------------------------------------------------
@@cpu_additional_hit_damage_in_stage_5_6:
mov _cpu_hit_damage_additional, 1
jmp short loc_9BC5
; ---------------------------------------------------------------------------
@@cpu_additional_hit_damage_in_stage_7_8_9:
mov _cpu_hit_damage_additional, 0
loc_9BC5:
les bx, _resident
mov al, es:[bx+resident_t.story_stage]
inc al
mov byte_202B6, al
mov al, es:[bx+resident_t.story_stage]
inc al
mov byte_202B7, al
mov al, _score_p1[6]
mov byte_220DC, al
cmp byte_220DC, 2
jnb short loc_9BEF
cmp _score_p1[7], 0
jz short loc_9BF4
loc_9BEF:
mov byte_220DC, -1
loc_9BF4:
les bx, _resident
mov al, es:[bx+resident_t.rem_credits]
push ax
jmp short loc_9C70
; ---------------------------------------------------------------------------
loc_9BFF:
les bx, _resident
cmp es:[bx+resident_t.RESIDENT_is_cpu][1], 0
jz short loc_9C13
cmp es:[bx+resident_t.RESIDENT_is_cpu][0], 0
jz short loc_9C13
jmp short @@lunatic
; ---------------------------------------------------------------------------
loc_9C13:
les bx, _resident
mov al, es:[bx+resident_t.rank]
mov ah, 0
mov bx, ax
cmp bx, RANK_LUNATIC
ja short loc_9C51
add bx, bx
jmp cs:off_9EAB[bx]
@@easy:
mov [bp+var_6], 3E8h
jmp short loc_9C51
; ---------------------------------------------------------------------------
@@normal:
mov [bp+var_6], 76Ch
jmp short loc_9C51
; ---------------------------------------------------------------------------
@@hard:
mov [bp+var_6], 0FA0h
jmp short loc_9C51
; ---------------------------------------------------------------------------
@@lunatic:
mov [bp+var_6], 0FFFFh
loc_9C51:
mov ax, word ptr [bp+var_6]
mov _p1.cpu_safety_frames, ax
mov _p2.cpu_safety_frames, ax
mov byte_202B6, 1
mov byte_202B7, 1
mov byte_220DC, -1
mov _cpu_hit_damage_additional, 0
push 3
loc_9C70:
nopcall sub_D6C0
mov di, offset _players
xor si, si
jmp short loc_9C93
; ---------------------------------------------------------------------------
loc_9C7C:
mov [di+player_t.rounds_won], 0
mov [di+player_t.gauge_avail], ((1 shl 6) shl 4)
mov [di+player_t.combo_hits_max], 0
mov [di+player_t.combo_bonus_max], 0
inc si
add di, size player_t
loc_9C93:
cmp si, PLAYER_COUNT
jl short loc_9C7C
les bx, _resident
cmp es:[bx+resident_t.demo_num], 0
jnz short loc_9CAB
mov fp_1E6EA, offset sub_9B0F
jmp short loc_9CD0
; ---------------------------------------------------------------------------
loc_9CAB:
mov _demo_frame, 0
mov fp_1E6EA, offset sub_9AD6
mov byte_23AF8, 40h
mov byte_23E3C, 0
mov byte_1F39E, 8
mov byte_202B6, 9
mov byte_202B7, 9
loc_9CD0:
mov fp_1FBC0, offset sub_B4A3
les bx, _resident
cmp es:[bx+resident_t.demo_num], 0
jz short loc_9CF0
setfarfp _input_mode, input_mode_attract
jmp loc_9D80
; ---------------------------------------------------------------------------
loc_9CF0:
les bx, _resident
cmp es:[bx+resident_t.RESIDENT_is_cpu][1], 0
jz short loc_9D10
cmp es:[bx+resident_t.RESIDENT_is_cpu][0], 0
jz short loc_9D10
setfarfp _input_mode, input_mode_cpu_vs_cpu
jmp short loc_9D80
; ---------------------------------------------------------------------------
loc_9D10:
les bx, _resident
cmp es:[bx+resident_t.RESIDENT_is_cpu][1], 0
jz short loc_9D29
setfarfp _input_mode, input_mode_1p_vs_cpu
jmp short loc_9D80
; ---------------------------------------------------------------------------
loc_9D29:
les bx, _resident
cmp es:[bx+resident_t.RESIDENT_is_cpu][0], 0
jz short loc_9D42
setfarfp _input_mode, input_mode_cpu_vs_1p
jmp short loc_9D80
; ---------------------------------------------------------------------------
loc_9D42:
les bx, _resident
cmp es:[bx+resident_t.key_mode], KM_KEY_KEY
jnz short loc_9D5B
setfarfp _input_mode, input_mode_key_vs_key
jmp short loc_9D80
; ---------------------------------------------------------------------------
loc_9D5B:
les bx, _resident
cmp es:[bx+resident_t.key_mode], KM_JOY_KEY
jnz short loc_9D74
setfarfp _input_mode, input_mode_joy_vs_key
jmp short loc_9D80
; ---------------------------------------------------------------------------
loc_9D74:
setfarfp _input_mode, input_mode_key_vs_joy
loc_9D80:
xor si, si
jmp loc_9E24
; ---------------------------------------------------------------------------
loc_9D85:
mov bx, si
shl bx, 7
mov al, _players[bx].playchar_paletted
mov ah, 0
dec ax
cwd
sub ax, dx
sar ax, 1
mov [bp+var_2], ax
imul ax, size playchar_speed_t
add ax, offset _PLAYCHAR_SPEEDS
mov [bp+var_8], ax
mov ax, si
shl ax, 7
add ax, offset _players
mov di, ax
mov bx, [bp+var_8]
mov al, [bx]
mov [di+player_t.speed.aligned.x8], al
inc [bp+var_8]
mov bx, [bp+var_8]
mov al, [bx]
mov [di+player_t.speed.aligned.y8], al
inc [bp+var_8]
mov bx, [bp+var_8]
mov al, [bx]
mov [di+player_t.speed.diagonal.x8], al
inc [bp+var_8]
mov bx, [bp+var_8]
mov al, [bx]
mov [di+player_t.speed.diagonal.y8], al
inc [bp+var_8]
mov bx, [bp+var_8]
mov al, [bx]
mov [di+player_t.gauge_charge_speed], al
mov bx, [bp+var_2]
cmp bx, PLAYCHAR_COUNT - 1
ja short loc_9E23
add bx, bx
jmp cs:off_9E99[bx]
loc_9DEF:
push si
call set_callbacks_reimu
jmp short loc_9E23
; ---------------------------------------------------------------------------
loc_9DF5:
push si
call set_callbacks_mima
jmp short loc_9E23
; ---------------------------------------------------------------------------
loc_9DFB:
push si
call set_callbacks_marisa
jmp short loc_9E23
; ---------------------------------------------------------------------------
loc_9E01:
push si
call set_callbacks_ellen
jmp short loc_9E23
; ---------------------------------------------------------------------------
loc_9E07:
push si
call set_callbacks_kotohime
jmp short loc_9E23
; ---------------------------------------------------------------------------
loc_9E0D:
push si
call set_callbacks_kana
jmp short loc_9E23
; ---------------------------------------------------------------------------
loc_9E13:
push si
call set_callbacks_rikako
jmp short loc_9E23
; ---------------------------------------------------------------------------
loc_9E19:
push si
call set_callbacks_chiyuri
jmp short loc_9E23
; ---------------------------------------------------------------------------
loc_9E1F:
push si
call set_callbacks_yumemi
loc_9E23:
inc si
loc_9E24:
cmp si, PLAYER_COUNT
jl loc_9D85
call super_entry_bfnt pascal, ds, offset aLose_bf2 ; "lose.bf2"
call super_entry_bfnt pascal, ds, offset aRound_bf2 ; "round.bf2"
call super_entry_bfnt pascal, ds, offset aZikicw_bf2 ; "zikicw.bf2"
call sub_E266
nopcall sub_A38E
call graph_200line pascal, 0
call sprite16_sprites_commit
mov _page_back, 0
mov _page_front, 1
graph_accesspage 0
graph_showpage 1
call _snd_se_reset
nopcall sub_B8F7
nopcall sub_BAE0
call grc_setclip pascal, large 0, ((RES_X - 1) shl 16) or (SPRITE16_RES_Y - 1)
kajacall KAJA_SONG_PLAY
pop di
pop si
leave
retn
; ---------------------------------------------------------------------------
db 0
off_9E99 dw offset loc_9DEF
dw offset loc_9DF5
dw offset loc_9DFB
dw offset loc_9E01
dw offset loc_9E07
dw offset loc_9E0D
dw offset loc_9E13
dw offset loc_9E19
dw offset loc_9E1F
off_9EAB dw offset @@easy
dw offset @@normal
dw offset @@hard
dw offset @@lunatic
@@cpu_additional_hit_damage dw offset @@cpu_additional_hit_damage_in_stage_1_2
dw offset @@cpu_additional_hit_damage_in_stage_1_2
dw offset @@cpu_additional_hit_damage_in_stage_3_4
dw offset @@cpu_additional_hit_damage_in_stage_3_4
dw offset @@cpu_additional_hit_damage_in_stage_5_6
dw offset @@cpu_additional_hit_damage_in_stage_5_6
sub_9B14 endp
; =============== S U B R O U T I N E =======================================
; Attributes: bp-based frame
sub_9EBF proc near
var_6 = dword ptr -6
@@i = word ptr -2
enter 6, 0
push si
push di
mov word_1F32A, 0
mov word_1F32C, 0
mov byte_26356, 0
mov byte_1FBC2, 0
mov byte_1FBC3, 0
mov byte_1F520, 0
call sub_E313
call @randring_fill$qv
call sub_17384
xor di, di
jmp short loc_9EFF
; ---------------------------------------------------------------------------
loc_9EF4:
mov bx, di
imul bx, 30h
mov byte ptr [bx+3ED6h], 0
inc di
loc_9EFF:
cmp di, 40h
jl short loc_9EF4
xor di, di
jmp short loc_9F1D
; ---------------------------------------------------------------------------
loc_9F08:
mov bx, di
shl bx, 5
mov byte ptr [bx+292Ah], 0
mov bx, di
shl bx, 5
mov byte ptr [bx+2B2Ah], 0
inc di
loc_9F1D:
cmp di, 10h
jl short loc_9F08
xor di, di
jmp short loc_9F31
; ---------------------------------------------------------------------------
loc_9F26:
mov bx, di
imul bx, size shotpair_t
mov _shotpairs[bx].SP_alive, 0
inc di
loc_9F31:
cmp di, SHOTPAIR_COUNT
jl short loc_9F26
call sub_14A76
call sub_153BB
call sub_142D0
call sub_1B653
call sub_193BC
les bx, _resident
cmp es:[bx+resident_t.game_mode], GM_STORY