-
-
Notifications
You must be signed in to change notification settings - Fork 23
/
th04_main.asm
30696 lines (26614 loc) · 707 KB
/
th04_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, <support@hex-rays.com> |
; +-------------------------------------------------------------------------+
;
; Input MD5 : 06D74719B6F72B11014A392FD34D5F57
; File Name : th04/MAIN.EXE
; Format : MS-DOS executable (EXE)
; Base Address: 0h Range: 0h-2D180h Loaded length: 24A62h
; Entry Point : 0:0
; OS type : MS DOS
; Application type: Executable 16bit
.386
.model use16 large _TEXT
BINARY = 'M'
include ReC98.inc
include th04/th04.inc
include th01/math/subpixel.inc
include th02/main/sparks.inc
include th04/sprites/main_pat.inc
include th04/sprites/main_cdg.inc
include th04/sprites/blit.inc
include th04/main/phase.inc
include th04/main/tile/tile.inc
include th04/main/bullet/types.inc
bullet_template_delta_t union
spread_angle db ?
stack_speed db ?
bullet_template_delta_t ends
include th04/main/bullet/bullet.inc
include th04/main/gather.inc
include th04/main/enemy/enemy.inc
extern SCOPY@:proc
extern _execl:proc
extern __ctype:byte
main_01 group SLOWDOWN_TEXT, DEMO_TEXT, EMS_TEXT, TILE_SET_TEXT, STD_TEXT, TILE_TEXT, mai_TEXT, PLAYFLD_TEXT, M4_RENDER_TEXT, DIALOG_TEXT, BOSS_EXP_TEXT, main_TEXT, STAGES_TEXT, main__TEXT, PLAYER_M_TEXT, PLAYER_P_TEXT, main_0_TEXT, HUD_OVRL_TEXT, main_01_TEXT, main_012_TEXT, CFG_LRES_TEXT, main_013_TEXT, CHECKERB_TEXT, MB_INV_TEXT, BOSS_BD_TEXT, BOSS_BG_TEXT
main_03 group GATHER_TEXT, SCROLLY3_TEXT, MOTION_3_TEXT, main_032_TEXT, VECTOR2N_TEXT, SPARK_A_TEXT, GRCG_3_TEXT, IT_SPL_U_TEXT, B4M_UPDATE_TEXT, main_033_TEXT, MIDBOSS_TEXT, HUD_HP_TEXT, MB_DFT_TEXT, main_034_TEXT, BULLET_U_TEXT, BULLET_A_TEXT, main_035_TEXT, BOSS_TEXT, main_036_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/atrtcmod.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_in.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_axdx.asm
include libs/master.lib/dos_filesize.asm
include libs/master.lib/dos_keyclear.asm
include libs/master.lib/dos_read.asm
include libs/master.lib/dos_seek.asm
include libs/master.lib/dos_setvect.asm
include libs/master.lib/egc.asm
include libs/master.lib/egc_shift_down.asm
include libs/master.lib/egc_shift_left.asm
include libs/master.lib/egc_shift_right.asm
include libs/master.lib/egc_shift_up.asm
include libs/master.lib/file_append.asm
include libs/master.lib/file_close.asm
include libs/master.lib/file_create.asm
include libs/master.lib/file_exist.asm
include libs/master.lib/file_read.asm
include libs/master.lib/file_ropen.asm
include libs/master.lib/file_seek.asm
include libs/master.lib/file_size.asm
include libs/master.lib/file_write.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_circlefill.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_hline.asm
include libs/master.lib/grcg_line.asm
include libs/master.lib/grcg_pset.asm
include libs/master.lib/grcg_setcolor.asm
include libs/master.lib/grcg_vline.asm
include libs/master.lib/gdc_outpw.asm
include libs/master.lib/get_machine_98.asm
include libs/master.lib/get_machine_at.asm
include libs/master.lib/get_machine_dosbox.asm
include libs/master.lib/check_machine_fmr.asm
include libs/master.lib/get_machine.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_400line.asm
include libs/master.lib/graph_clear.asm
include libs/master.lib/graph_extmode.asm
include libs/master.lib/graph_hide.asm
include libs/master.lib/graph_scrollup.asm
include libs/master.lib/iatan2.asm
include libs/master.lib/js_end.asm
include libs/master.lib/large_byte.asm
include libs/master.lib/super_large_put.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/palette_entry_rgb.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_clear.asm
include libs/master.lib/text_fillca.asm
include libs/master.lib/text_putca.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/palette_white_in.asm
include libs/master.lib/palette_white_out.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_put_1plane.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_clean.asm
include libs/master.lib/super_roll_put_1plane.asm
include libs/master.lib/super_roll_put.asm
include libs/master.lib/super_put.asm
include libs/master.lib/super_convert_tiny.asm
include libs/master.lib/super_zoom.asm
include libs/master.lib/pfint21.asm
db 0
include libs/master.lib/js_start.asm
include th03/formats/pfopen.asm
include libs/master.lib/pf_str_ieq.asm
include libs/master.lib/js_sense.asm
db 0
; =============== S U B R O U T I N E =======================================
; Attributes: bp-based frame
sub_3680 proc far
arg_0 = word ptr 6
arg_2 = word ptr 8
arg_4 = word ptr 0Ah
arg_6 = word ptr 0Ch
push bp
mov bp, sp
push si
push di
push ds
mov ax, [bp+arg_6]
sar ax, 3
mov dx, [bp+arg_4]
shl dx, 6
add ax, dx
shr dx, 2
add ax, dx
mov di, ax
mov bx, [bp+arg_2]
shl bx, 6
mov ax, [bp+arg_0]
cmp ax, _mpn_slots[bx].MPN_count
ja short loc_36EE
shl ax, 7
mov si, ax
add si, 40h
mov dx, word ptr _mpn_slots[bx].MPN_images+2
mov ds, dx
mov ax, SEG_PLANE_B
mov fs, ax
assume fs:nothing
mov ax, SEG_PLANE_R
mov gs, ax
assume gs:nothing
mov ax, SEG_PLANE_G
mov es, ax
assume es:nothing
mov cx, TILE_H
loc_36CA:
mov ax, [si-40h]
mov fs:[di], ax
mov ax, [si-20h]
mov gs:[di], ax
movsw
add di, (ROW_SIZE - word)
loop loc_36CA
sub di, (TILE_H * ROW_SIZE)
mov ax, SEG_PLANE_E
mov es, ax
assume es:nothing
mov cx, TILE_H
loc_36E8:
movsw
add di, (ROW_SIZE - word)
loop loc_36E8
loc_36EE:
pop ds
pop di
pop si
pop bp
retf 8
sub_3680 endp
include libs/master.lib/bgm_bell_org.asm
include libs/master.lib/bgm_mget.asm
include libs/master.lib/bgm_read_sdata.asm
include libs/master.lib/bgm_timer.asm
include libs/master.lib/bgm_pinit.asm
include libs/master.lib/bgm_timerhook.asm
include libs/master.lib/bgm_play.asm
include libs/master.lib/bgm_sound.asm
include libs/master.lib/bgm_effect_sound.asm
include libs/master.lib/bgm_stop_play.asm
include libs/master.lib/bgm_set_tempo.asm
include libs/master.lib/bgm_init_finish.asm
include libs/master.lib/bgm_stop_sound.asm
include libs/master.lib/super_wave_put.asm
include libs/master.lib/ems_read.asm
include libs/master.lib/ems_allocate.asm
include libs/master.lib/ems_enablepageframe.asm
include libs/master.lib/ems_exist.asm
include libs/master.lib/ems_free.asm
include libs/master.lib/ems_movememoryregion.asm
include libs/master.lib/ems_setname.asm
include libs/master.lib/ems_write.asm
include libs/master.lib/ems_space.asm
_TEXT ends
; ===========================================================================
SLOWDOWN_TEXT segment word public 'CODE' use16
@slowdown_frame_delay$qv procdesc near
SLOWDOWN_TEXT ends
; Segment type: Pure code
DEMO_TEXT segment word public 'CODE' use16
assume cs:main_01
;org 1
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
call @cfg_load_resident_ptr$qv
or ax, ax
jz short loc_AB86
mov _mem_assign_paras, MEM_ASSIGN_PARAS_MAIN
call @game_init_main$qnxuc pascal, ds, offset aUmx
les bx, _resident
mov eax, es:[bx+resident_t.rand]
mov random_seed, eax
call @ems_allocate_and_preload_eyecatc$qv
call text_clear
call gaiji_backup
push ds
push offset aGameft_bft ; "GAMEFT.bft"
call gaiji_entry_bfnt
les bx, _resident
mov al, es:[bx+resident_t.bgm_mode]
mov ah, 0
push ax
mov al, es:[bx+resident_t.se_mode]
mov ah, 0
push ax
call snd_determine_modes
call snd_load pascal, ds, offset aMiko, SND_LOAD_SE
loc_AB6B:
call main_01:sub_AED0
call main_01:sub_AB88
cmp _quit, Q_NEXT_STAGE
jnz short loc_AB7D
call main_01:sub_B29E
jmp short loc_AB6B
; ---------------------------------------------------------------------------
loc_AB7D:
push ds
push offset arg0 ; "op"
nopcall @GameExecl$qnxc
loc_AB86:
pop bp
retf
_main endp
; =============== S U B R O U T I N E =======================================
; Attributes: bp-based frame
sub_AB88 proc near
push bp
mov bp, sp
push si
mov _slowdown_factor, 1
call @frame_delay$qi pascal, 1
call @input_reset_sense$qv
loc_AB9E:
call @input_sense$qv
call fp_23D90
test _key_det.hi, high INPUT_CANCEL
jz short loc_ABBA
call main_01:_pause
or ax, ax
jz short loc_ABBA
mov _quit, Q_QUIT_TO_OP
loc_ABBA:
call _std_update
call @midboss_activate_if_stage_frame_$qv
call _stage_vm
cmp _bombing, 0
jnz short @@bombing
call _bg_render_not_bombing
jmp short @@update
; ---------------------------------------------------------------------------
@@bombing:
call _bg_render_bombing
@@update:
call main_01:pointnums_update
call main_01:circles_update
call _sparks_update
call main_01:sub_10ABF
call main_01:sub_104B6
call @bullets_update$qv
call enemies_update
call _midboss_update
call _boss_update
call items_update
call @gather_update$qv
call _stage_render
call main_01:sub_1020A
call _boss_fg_render
call _midboss_render
call main_01:enemies_render
call @shots_render$qv
call main_01:player_render
call @grcg_setmode_rmw$qv
call @gather_render$qv
call _sparks_render
call main_01:items_render
call main_01:pointnums_render
call main_01:bullets_render
call main_01:circles_render
GRCG_OFF_CLOBBERING dx
call _overlay1
call _overlay2
call @playfield_shake_update_and_rende$qv
call @input_reset_sense$qv
mov ax, vsync_Count1
cmp ax, _slowdown_factor
jb short loc_AC56
mov ax, 1
jmp short loc_AC58
; ---------------------------------------------------------------------------
loc_AC56:
xor ax, ax
loc_AC58:
cwde
add _total_slow_frames, eax
inc _total_frames
call @slowdown_frame_delay$qv
cmp _palette_changed, 0
jz short loc_AC7A
call far ptr palette_show
mov _palette_changed, 0
jmp short $+2
loc_AC7A:
call main_01:sub_CCD6
graph_accesspage _page_front
graph_showpage _page_back
mov _page_front, al
xor _page_back, 1
call _snd_se_update
inc _frames_unused
mov ax, _stage_frame
mov dx, ax
inc ax
mov _stage_frame, ax
and ax, 0Fh
mov _stage_frame_mod16, al
and al, 7
mov _stage_frame_mod8, al
and al, 3
mov _stage_frame_mod4, al
and al, 1
mov _stage_frame_mod2, al
les bx, _resident
mov al, es:[bx+resident_t.rem_lives]
mov ah, 0
mov si, ax
cmp si, 10
jl short loc_ACD1
mov ax, 1000
jmp short loc_ACDE
; ---------------------------------------------------------------------------
loc_ACD1:
mov ax, si
imul ax, 500
push ax
mov ax, 6000
pop dx
sub ax, dx
loc_ACDE:
mov si, ax
mov ax, _stage_frame
xor dx, dx
div si
or dx, dx
jnz short loc_ACF4
push 1
nopcall playperf_raise
jmp short $+2
loc_ACF4:
call @score_update_and_render$qv
cmp _quit, Q_KEEP_RUNNING
jz loc_AB9E
pop si
pop bp
retn
sub_AB88 endp
; =============== S U B R O U T I N E =======================================
; Attributes: bp-based frame
sub_AD03 proc near
push bp
mov bp, sp
push si
les bx, _resident
mov es:[bx+resident_t.graze], 0
mov es:[bx+resident_t.miss_count], 0
mov es:[bx+resident_t.bombs_used], 0
mov es:[bx+resident_t.end_sequence], ES_INGAME
cmp es:[bx+resident_t.playchar_ascii], '0' + PLAYCHAR_MARISA
jnz short loc_AD2C
mov ax, PLAYCHAR_MARISA
jmp short loc_AD2E
; ---------------------------------------------------------------------------
loc_AD2C:
xor ax, ax
loc_AD2E:
mov _playchar, al
xor si, si
jmp short loc_AD3B
; ---------------------------------------------------------------------------
loc_AD35:
mov _score[si], 0
inc si
loc_AD3B:
cmp si, SCORE_DIGITS
jl short loc_AD35
mov _power, POWER_MIN
les bx, _resident
mov al, es:[bx+resident_t.credit_bombs]
mov es:[bx+resident_t.rem_bombs], al
mov al, es:[bx+resident_t.credit_lives]
mov es:[bx+resident_t.rem_lives], al
call main_01:bb_txt_load
cmp _playchar, PLAYCHAR_REIMU
jnz short loc_AD90
mov _player_option_patnum, PAT_OPTION_REIMU
les bx, _resident
cmp es:[bx+resident_t.shottype], SHOTTYPE_A
jnz short loc_AD7C
mov playchar_shot_funcs, offset SHOT_FUNCS_REIMU_A
jmp short loc_AD82
; ---------------------------------------------------------------------------
loc_AD7C:
mov playchar_shot_funcs, offset SHOT_FUNCS_REIMU_B
loc_AD82:
mov _player_bomb_func, offset player_bomb
mov _playchar_bomb_func, offset bomb_reimu
jmp short loc_ADBB
; ---------------------------------------------------------------------------
loc_AD90:
mov _player_option_patnum, PAT_OPTION_MARISA
les bx, _resident
cmp es:[bx+resident_t.shottype], SHOTTYPE_A
jnz short loc_ADA9
mov playchar_shot_funcs, offset SHOT_FUNCS_MARISA_A
jmp short loc_ADAF
; ---------------------------------------------------------------------------
loc_ADA9:
mov playchar_shot_funcs, offset SHOT_FUNCS_MARISA_B
loc_ADAF:
mov _player_bomb_func, offset player_bomb
mov _playchar_bomb_func, offset bomb_marisa
loc_ADBB:
les bx, _resident
cmp es:[bx+resident_t.demo_num], 0
jz short loc_ADD7
mov _playperf, 28
mov _rank, RANK_HARD
loc_ADD0:
mov _turbo_mode, 1
jmp short loc_ADFC
; ---------------------------------------------------------------------------
loc_ADD7:
mov _playperf, 16
cmp _stage_id, 6
jnz short loc_ADEA
mov _rank, RANK_EXTRA
jmp short loc_ADD0
; ---------------------------------------------------------------------------
loc_ADEA:
les bx, _resident
mov al, es:[bx+resident_t.rank]
mov _rank, al
mov al, es:[bx+resident_t.turbo_mode]
mov _turbo_mode, al
loc_ADFC:
call main_01:sub_EEB0
call main_01:sub_12CC7
mov al, _rank
mov ah, 0
mov bx, ax
cmp bx, 4
ja @@ret
add bx, bx
jmp cs:off_AEC6[bx]
@@easy:
mov _graze_score, 100
mov _playperf_min, 4
mov _playperf_max, 16
mov _bullets_add_regular, offset bullets_add_regular_easy
mov _bullets_add_special, offset bullets_add_special_easy
mov _bullet_template_tune, offset bullet_template_tune_easy
jmp @@ret
; ---------------------------------------------------------------------------
@@normal:
mov _graze_score, 250
mov _playperf_min, 11
mov _playperf_max, 24
jmp short @@tune_normal
; ---------------------------------------------------------------------------
@@hard:
mov _playperf, 20
mov _graze_score, 400
mov _playperf_min, 20
mov _playperf_max, 32
mov _bullets_add_regular, offset bullets_add_regular_hard_lunatic
mov _bullets_add_special, offset bullets_add_special_hard_lunatic
mov _bullet_template_tune, offset bullet_template_tune_hard
jmp short @@ret
; ---------------------------------------------------------------------------
@@lunatic:
mov _graze_score, 500
mov _playperf, 22
mov _playperf_min, 22
mov _playperf_max, 34
mov _bullets_add_regular, offset bullets_add_regular_hard_lunatic
mov _bullets_add_special, offset bullets_add_special_hard_lunatic
mov _bullet_template_tune, offset bullet_template_tune_lunatic
jmp short @@ret
; ---------------------------------------------------------------------------
@@extra:
mov _graze_score, 2560
mov _playperf_min, 16
mov _playperf_max, 20
@@tune_normal:
mov _bullets_add_regular, offset bullets_add_regular_normal
mov _bullets_add_special, offset bullets_add_special_normal
mov _bullet_template_tune, offset bullet_template_tune_normal
@@ret:
pop si
pop bp
retn
; ---------------------------------------------------------------------------
db 0
off_AEC6 dw offset @@easy
dw offset @@normal
dw offset @@hard
dw offset @@lunatic
dw offset @@extra
sub_AD03 endp
; =============== S U B R O U T I N E =======================================
; Attributes: bp-based frame
sub_AED0 proc near
push bp
mov bp, sp
push si
mov word_213DE, 0
mov vsync_Count2, 0
les bx, _resident
mov al, es:[bx+resident_t.stage]
mov _stage_id, al
cmp _stage_id, 0
jz short loc_AEF9
cmp _stage_id, 6
jnz short loc_AF4A
loc_AEF9:
mov word_213DE, 1
call text_fillca pascal, (' ' shl 16) + TX_BLACK + TX_REVERSE
mov fp_23D90, offset nullfunc_near
call main_01:sub_AD03
les bx, _resident
cmp es:[bx+resident_t.demo_num], 0
jz short loc_AF4A
call @demo_load$qv
les bx, _resident
mov al, es:[bx+resident_t.demo_stage]
mov es:[bx+resident_t.stage], al
mov _stage_id, al
mov _power, POWER_MAX
add al, '0'
mov es:[bx+resident_t.stage_ascii], al
mov fp_23D90, offset @DemoPlay$qv
mov random_seed, 318
loc_AF4A:
call main_01:sub_12024
graph_accesspage 0
graph_showpage al
push ds
push offset aEye_rgb ; "eye.rgb"
call palette_entry_rgb
call far ptr palette_show
mov PaletteTone, 0
call far ptr palette_show
call main_01:sub_12024
call @overlay_wipe$qv
call main_01:sub_B1D0
nopcall main_01:hud_put
call @eyecatch_animate$qv
call @midboss_reset$qv
cmp word_213DE, 0
jz short loc_AFD5
call @bomb_bg_load__ems_preload_playch$qv
call main_01:bb_playchar_load
cmp _playchar, PLAYCHAR_REIMU
jnz short loc_AFA0
push ds
push offset aMiko_bft ; "miko.bft"
jmp short loc_AFA4
; ---------------------------------------------------------------------------
loc_AFA0:
push ds
push offset aMari_bft ; "mari.bft"
loc_AFA4:
call super_entry_bfnt
call super_entry_bfnt pascal, ds, offset aMikod_bft ; "mikod.bft"
call super_entry_bfnt pascal, ds, offset aMiko32_bft ; "miko32.bft"
call super_entry_bfnt pascal, ds, offset aMiko16_bft ; "miko16.bft"
mov si, 20
jmp short loc_AFD0
; ---------------------------------------------------------------------------
loc_AFC9:
call super_convert_tiny pascal, si
inc si
loc_AFD0:
cmp si, 120
jl short loc_AFC9
loc_AFD5:
les bx, off_213E0
mov byte ptr es:[bx+2], '0'
les bx, _resident
mov al, es:[bx+resident_t.stage_ascii]
les bx, off_213E0
mov es:[bx+3], al
mov al, _stage_id
mov ah, 0
mov bx, ax
cmp bx, 6
ja loc_B144
add bx, bx
jmp cs:off_B1C2[bx]
loc_B003:
mov word_2CFF4, 9
call cdg_load_all pascal, CDG_FACESET_BOSS, ds, offset aBss0_cd2
les bx, _resident
mov al, es:[bx+resident_t.playchar_ascii]
les bx, off_213E0
mov es:[bx+2], al
call super_entry_bfnt pascal, ds, offset aSt00_bft ; "st00.bft"
call stage1_setup
les bx, _resident
cmp es:[bx+resident_t.playchar_ascii], '0' + PLAYCHAR_REIMU
jnz short loc_B044
push ds
push offset aSt00_mpn ; "st00.mpn"
jmp loc_B141
; ---------------------------------------------------------------------------
loc_B044:
push ds
push offset aSt10_mpn ; "st10.mpn"
jmp loc_B141
; ---------------------------------------------------------------------------
loc_B04B:
mov word_2CFF4, 9
call cdg_load_all pascal, CDG_FACESET_BOSS, ds, offset aBss1_cd2
call super_entry_bfnt pascal, ds, offset aSt01_bft ; "st01.bft"
call stage2_setup
push ds
push offset aSt01_mpn ; "st01.mpn"
jmp loc_B141
; ---------------------------------------------------------------------------
loc_B071:
mov word_2CFF4, 9
call cdg_load_all pascal, CDG_FACESET_BOSS, ds, offset aBss2_cd2
call super_entry_bfnt pascal, ds, offset aSt02_bft ; "st02.bft"
call stage3_setup
push ds
push offset aSt02_mpn ; "st02.mpn"
jmp loc_B141
; ---------------------------------------------------------------------------
loc_B097:
mov word_2CFF4, 9
cmp _playchar, PLAYCHAR_REIMU
jnz short loc_B0AC
push CDG_FACESET_BOSS
push ds
push offset aKao3_cd2 ; "KAO3.CD2"
jmp short loc_B0B2
; ---------------------------------------------------------------------------
loc_B0AC:
push CDG_FACESET_BOSS
push ds
push offset aKao2_cd2 ; "KAO2.CD2"
loc_B0B2:
call cdg_load_all
call super_entry_bfnt pascal, ds, offset aSt03_bft ; "st03.bft"
call stage4_setup
call mpn_load pascal, ds, offset aSt03_mpn ; "st03.mpn"
mov _stage_render, offset @stage4_render$qv
jmp short loc_B144
; ---------------------------------------------------------------------------
loc_B0D4:
mov word_2CFF4, 9
call cdg_load_all pascal, CDG_FACESET_BOSS, ds, offset aBss4_cd2
call super_entry_bfnt pascal, ds, offset aSt04_bft ; "st04.bft"
call stage5_setup
push ds
push offset aSt04_mpn ; "st04.mpn"
jmp short loc_B141
; ---------------------------------------------------------------------------
loc_B0F9:
mov word_2CFF4, 9
call super_entry_bfnt pascal, ds, offset aSt05_bft ; "st05.bft"
call cdg_load_all pascal, CDG_FACESET_BOSS, ds, offset aBss5_cd2
call stage6_setup
push ds
push offset aSt05_mpn ; "st05.mpn"
jmp short loc_B141
; ---------------------------------------------------------------------------
loc_B11E:
mov word_2CFF4, 9
call super_entry_bfnt pascal, ds, offset aSt06_bft ; "st06.bft"
call cdg_load_all pascal, CDG_FACESET_BOSS, ds, offset aBss6_cd2
call stagex_setup
push ds
push offset aSt06_mpn ; "st06.mpn"
loc_B141:
call mpn_load
loc_B144:
call @map_load$qv
call @std_load$qv
call @dialog_load$qv
call tiles_fill_initial
graph_accesspage 0
loc_B156:
cmp vsync_Count2, 80h
jb short loc_B156
push 1
call palette_black_out
mov PaletteTone, 100
call far ptr palette_show
call @overlay_black$qv
call @tiles_render_all$qv
mov _page_back, 1
mov _page_front, 0
graph_accesspage 1
graph_showpage 0
call @tiles_render_all$qv
les bx, _resident
cmp es:[bx+resident_t.demo_num], 0
jnz short loc_B1AE
call snd_load pascal, [off_213E0], SND_LOAD_SONG
kajacall KAJA_SONG_PLAY
loc_B1AE:
nopcall @tiles_activate$qv
mov _overlay1, offset @overlay_stage_enter_update_and_r$qv
mov _overlay2, offset nullfunc_near
pop si
pop bp
retn
sub_AED0 endp
; ---------------------------------------------------------------------------
off_B1C2 dw offset loc_B003
dw offset loc_B04B
dw offset loc_B071
dw offset loc_B097
dw offset loc_B0D4
dw offset loc_B0F9
dw offset loc_B11E
; =============== S U B R O U T I N E =======================================
; Attributes: bp-based frame
sub_B1D0 proc near
push bp
mov bp, sp
call main_01:sub_11ECB
mov _stage_frame, 0
mov _bombing_disabled, 0
mov _scroll_line, 0
mov word_25100, 0
mov _scroll_line_on_page[0 * 2], 0
mov _scroll_line_on_page[1 * 2], 0
mov _scroll_subpixel_line, 0
mov byte_25104, 0
mov byte_250FE, 0
mov _playfield_shake_x, 0
mov _playfield_shake_y, 0
mov _player_pos.cur.x, 192 * 16
mov _player_pos.cur.y, 320 * 16
mov _player_pos.prev.x, 192 * 16
mov _player_pos.prev.y, 320 * 16
mov word_2599A, 40h
mov word_2599C, 40h
mov word_2599E, 30h ; '0'
mov word_259A0, 30h ; '0'
mov byte_259A3, 0
mov _miss_time, 0
mov _player_is_hit, 0
mov _player_invincibility_time, STAGE_START_INVINCIBILITY_FRAMES
mov _stage_point_items_collected, 0
mov _dream_items_collected, 0
mov _std_update, offset @std_update_frames_then_animate_d$qv
mov _scroll_active, 1
call main_01:sub_1042A
nopcall main_01:sub_11DE6
call @randring_fill$qv
call sub_1DA1B
call main_01:sub_FFA4
call _sparks_init
call hud_score_put
call sub_15D74
call main_01:pointnums_init
nopcall main_01:hud_put
mov _bg_render_bombing_func, offset @tiles_render_all$qv
call main_01:tiles_invalidate_reset
pop bp
retn
sub_B1D0 endp
; =============== S U B R O U T I N E =======================================
; Attributes: bp-based frame
sub_B29E proc near
push bp
mov bp, sp
push si
call @bb_boss_free$qv
call @dialog_free$qv
call @std_free$qv
call @map_free$qv
call super_clean pascal, (128 shl 16) or 256
mov si, CDG_FACESET_BOSS
jmp short loc_B2C7
; ---------------------------------------------------------------------------
loc_B2C0:
call cdg_free pascal, si
inc si
loc_B2C7:
cmp si, (CDG_COUNT - 1)
jl short loc_B2C0
pop si
pop bp
retn
sub_B29E endp
include th04/main/pause.asm
@demo_load$qv procdesc near
@DemoPlay$qv procdesc near
DEMO_TEXT ends
EMS_TEXT segment byte public 'CODE' use16
@ems_allocate_and_preload_eyecatc$qv procdesc near
@bomb_bg_load__ems_preload_playch$qv procdesc near
@eyecatch_animate$qv procdesc near
EMS_TEXT ends
TILE_SET_TEXT segment byte public 'CODE' use16
extern @TILE_RING_SET_VO$QIII:proc
TILE_SET_TEXT ends
STD_TEXT segment byte public 'CODE' use16
@std_load$qv procdesc near
STD_TEXT ends