-
-
Notifications
You must be signed in to change notification settings - Fork 23
/
Copy pathth05_main.asm
20390 lines (17773 loc) · 456 KB
/
th05_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 : 6A9AB51C7215E3D9CA580CD9F04F4D12
; File Name : th05/MAIN.EXE
; Format : MS-DOS executable (EXE)
; Base Address: 0h Range: 0h-2D1B0h Loaded length: 23A48h
; Entry Point : 0:0
; OS type : MS DOS
; Application type: Executable 16bit
.386
.model use16 large _TEXT
BINARY = 'M'
include ReC98.inc
include th05/th05.inc
include th01/math/area.inc
include th01/math/subpixel.inc
include th02/main/sparks.inc
include th05/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 th05/main/bullet/types.inc
include th04/main/bullet/bullet.inc
include th04/main/gather.inc
include th05/main/player/shot_types.inc
include th05/main/enemy/enemy.inc
extern _execl:proc
main_01 group SLOWDOWN_TEXT, DEMO_TEXT, EMS_TEXT, TILE_TEXT, mai_TEXT, CFG_LRES_TEXT, MB_INV_TEXT, BOSS_BD_TEXT, BOSS_BG_TEXT, SCORE_TEXT, LASER_RH_TEXT, main_TEXT, main__TEXT, PLAYFLD_TEXT, main_0_TEXT, HUD_OVRL_TEXT, DIALOG_TEXT, BOSS_EXP_TEXT, PLAYER_P_TEXT, main_01_TEXT
main_03 group SCROLLY3_TEXT, MOTION_3_TEXT, main_031_TEXT, VECTOR2N_TEXT, SPARK_A_TEXT, BULLET_P_TEXT, GRCG_3_TEXT, PLAYER_A_TEXT, BULLET_A_TEXT, main_032_TEXT, main_033_TEXT, MIDBOSS_TEXT, HUD_HP_TEXT, MB_DFT_TEXT, LASER_SC_TEXT, CHEETO_U_TEXT, IT_SPL_U_TEXT, BULLET_U_TEXT, MIDBOSS1_TEXT, B1_UPDATE_TEXT, B4_UPDATE_TEXT, main_035_TEXT, B6_UPDATE_TEXT, BX_UPDATE_TEXT, main_036_TEXT, BOSS_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_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_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_close.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/dos_close.asm
include libs/master.lib/dos_ropen.asm
include libs/master.lib/grcg_boxfill.asm
include libs/master.lib/grcg_byteboxfill_x.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/grc_clip_polygon_n.asm
include libs/master.lib/grcg_hline.asm
include libs/master.lib/grcg_line.asm
include libs/master.lib/grcg_polygon_cx.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_putca.asm
include libs/master.lib/gaiji_putsa.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/draw_trapezoidx.asm
include libs/master.lib/large_byte.asm
include libs/master.lib/super_large_put.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/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_boxfilla.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_rect.asm
include libs/master.lib/super_put.asm
include libs/master.lib/super_convert_tiny.asm
include libs/master.lib/js_start.asm
include libs/master.lib/js_sense.asm
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/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
include libs/master.lib/super_put_8.asm
db 0
; =============== S U B R O U T I N E =======================================
public MPN_LOAD_INNER
mpn_load_inner proc far
call mpn_free
mov bx, sp
push si
push di
push ds
mov ax, (3Dh shl 8) or 00h
lds dx, ss:[bx+4]
int 21h ; DOS - 2+ - OPEN DISK FILE WITH HANDLE
; DS:DX -> ASCIZ filename
; AL = access mode
; 0 - read
pop ds
mov bx, ax
mov si, bx
mov ah, 3Fh ; '?'
mov dx, offset Palettes
mov cx, 6
int 21h ; DOS - 2+ - READ FROM FILE WITH HANDLE
; BX = file handle, CX = number of bytes to read
; DS:DX -> buffer
mov di, word ptr Palettes+4
mov ah, 3Fh ; '?'
mov dx, offset Palettes
mov cx, size palette_t
int 21h ; DOS - 2+ - READ FROM FILE WITH HANDLE
; BX = file handle, CX = number of bytes to read
; DS:DX -> buffer
mov word_23A5C, di
inc di
shl di, 7
push di
nopcall hmem_allocbyte
mov word_23A5A, ax
mov bx, si
push ds
mov ds, ax
xor dx, dx
mov ah, 3Fh ; '?'
mov cx, di
int 21h ; DOS - 2+ - READ FROM FILE WITH HANDLE
; BX = file handle, CX = number of bytes to read
; DS:DX -> buffer
pop ds
mov ah, 3Eh
int 21h ; DOS - 2+ - CLOSE A FILE WITH HANDLE
; BX = file handle
nopcall palette_show
pop di
pop si
retf 4
mpn_load_inner endp
; =============== S U B R O U T I N E =======================================
public MPN_FREE
mpn_free proc far
cmp word_23A5A, 0
jz short locret_4224
push word_23A5A
nopcall hmem_free
mov word_23A5A, 0
locret_4224:
retf
mpn_free endp
; ---------------------------------------------------------------------------
nop
; =============== S U B R O U T I N E =======================================
sub_4226 proc far
mov bx, sp
push si
mov si, ss:[bx+4]
cmp si, word_23A5C
ja short loc_426D
shl si, 7
push di
mov ax, ss:[bx+8]
mov di, ss:[bx+6]
mov dx, di
sar ax, 3
shl di, 2
add di, dx
shl di, 4
add di, ax
push ds
mov ds, word_23A5A
mov ax, SEG_PLANE_B
call sub_4272
mov ax, SEG_PLANE_R
call sub_4272
mov ax, SEG_PLANE_G
call sub_4272
mov ax, SEG_PLANE_E
call sub_4272
pop ds
pop di
loc_426D:
pop si
retf 6
sub_4226 endp
; ---------------------------------------------------------------------------
nop
; =============== S U B R O U T I N E =======================================
sub_4272 proc near
mov es, ax
assume es:nothing
mov cx, 16
loc_4277:
movsw
add di, (ROW_SIZE - word)
loop loc_4277
sub di, (16 * ROW_SIZE)
retn
sub_4272 endp
include libs/master.lib/pfint21.asm
db 0
include th03/formats/pfopen.asm
include libs/master.lib/pf_str_ieq.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 0Dh
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_AEA4
mov _mem_assign_paras, MEM_ASSIGN_PARAS_MAIN
call @game_init_main$qnxuc pascal, ds, offset aKAIKIDAN2_DAT
les bx, _resident
mov eax, es:[bx+resident_t.rand]
mov random_seed, eax
call @ems_allocate_and_preload_eyecatc$qv
call text_clear
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_AE89:
call sub_B237
call sub_AEA6
cmp _quit, Q_NEXT_STAGE
jnz short loc_AE9B
call sub_B609
jmp short loc_AE89
; ---------------------------------------------------------------------------
loc_AE9B:
push ds
push offset arg0 ; "op"
nopcall @GameExecl$qnxc
loc_AEA4:
pop bp
retf
_main endp
; =============== S U B R O U T I N E =======================================
; Attributes: bp-based frame
sub_AEA6 proc near
push bp
mov bp, sp
mov _slowdown_factor, 1
call @frame_delay$qi pascal, 1
call @input_reset_sense$qv
loc_AEBB:
call @input_sense$qv
call fp_2300E
test _key_det.hi, high INPUT_CANCEL
jz short loc_AED7
call _pause
or ax, ax
jz short loc_AED7
mov _quit, Q_QUIT_TO_OP
loc_AED7:
call _std_update
call _stage_vm
cmp _bombing, 0
jnz short @@bombing
call _bg_render_not_bombing
jmp short @@update
; ---------------------------------------------------------------------------
@@bombing:
call _bg_render_bombing
@@update:
call pointnums_update
call circles_update
call _sparks_update
call sub_1214A
call sub_1240B
call @lasers_update$qv
call @bullets_update$qv
call enemies_update
call _midboss_update
call _boss_update
call items_update
call @gather_update$qv
call _stage_render
cmp _bombing, 0
jz short loc_AF2D
call _playchar_bomb_func
loc_AF2D:
call _boss_fg_render
call _midboss_render
call enemies_render
call @shots_render$qv
call player_render
call @grcg_setmode_rmw$qv
call _boss_custombullets_render
call @lasers_render$qv
call @gather_render$qv
call _sparks_render
call items_render
call pointnums_render
call sub_100C6
call circles_render
GRCG_OFF_CLOBBERING dx
call _overlay1
call _overlay2
call @playfield_shake_update_and_rende$qv
call @input_reset_sense$qv
mov al, _slowdown_caused_by_bullets
mov ah, 0
push ax
mov ax, vsync_Count1
cmp ax, _slowdown_factor
jb short loc_AF86
mov ax, 1
jmp short loc_AF88
; ---------------------------------------------------------------------------
loc_AF86:
xor ax, ax
loc_AF88:
pop dx
or dx, ax
movsx eax, dx
add _total_slow_frames, eax
inc _total_frames
cmp byte_20A71, 0
jz short loc_AFDF
test _key_det.hi, high INPUT_Q
jz short loc_AFC3
cmp byte_20A70, 0
jnz short loc_AFB5
mov byte_20A70, -2
jmp short loc_AFDF
; ---------------------------------------------------------------------------
loc_AFB5:
cmp byte_20A70, -1
jnz short loc_AFDF
mov byte_20A70, 1
jmp short loc_AFDF
; ---------------------------------------------------------------------------
loc_AFC3:
cmp byte_20A70, 1
jnz short loc_AFD1
mov byte_20A70, 0
jmp short loc_AFDF
; ---------------------------------------------------------------------------
loc_AFD1:
cmp byte_20A70, -2
jnz short loc_AFDF
mov byte_20A70, -1
jmp short $+2
loc_AFDF:
cmp byte_20A70, 0
jnz short loc_AFEB
call @slowdown_frame_delay$qv
jmp short loc_AFF0
; ---------------------------------------------------------------------------
loc_AFEB:
mov _player_is_hit, 0
loc_AFF0:
cmp _palette_changed, 0
jz short loc_B003
call far ptr palette_show
mov _palette_changed, 0
jmp short $+2
loc_B003:
call sub_10214
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
test _stage_frame, 4095
jnz short loc_B055
push 1
nopcall playperf_raise
jmp short $+2
loc_B055:
call @score_update_and_render$qv
cmp _quit, Q_KEEP_RUNNING
jz loc_AEBB
pop bp
retn
sub_AEA6 endp
; =============== S U B R O U T I N E =======================================
; Attributes: bp-based frame
sub_B063 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
mov al, es:[bx+resident_t.playchar]
mov _playchar, al
mov al, es:[bx+resident_t.credit_bombs]
mov _bombs, al
mov al, es:[bx+resident_t.credit_lives]
mov _lives, al
xor si, si
jmp short loc_B09F
; ---------------------------------------------------------------------------
loc_B099:
mov _score[si], 0
inc si
loc_B09F:
cmp si, SCORE_DIGITS
jl short loc_B099
mov _power, POWER_MIN
mov _dream, 1
call bb_txt_load
mov al, _playchar
mov ah, 0
mov bx, ax
cmp bx, 3
ja short loc_B112
add bx, bx
jmp cs:off_B22F[bx]
@@reimu:
mov _playchar_speed_aligned, 56
mov _playchar_speed_diagonal, 40
mov _playchar_bomb_func, offset bomb_reimu
jmp short loc_B112
; ---------------------------------------------------------------------------
@@marisa:
mov _playchar_speed_aligned, 64
mov _playchar_speed_diagonal, 48
mov _playchar_bomb_func, offset bomb_marisa
jmp short loc_B112
; ---------------------------------------------------------------------------
@@mima:
mov _playchar_speed_aligned, 72
mov _playchar_speed_diagonal, 52
mov _playchar_bomb_func, offset bomb_mima
jmp short loc_B112
; ---------------------------------------------------------------------------
@@yuuka:
mov _playchar_speed_aligned, 56
mov _playchar_speed_diagonal, 40
mov _playchar_bomb_func, offset bomb_yuuka
loc_B112:
mov al, _playchar
mov ah, 0
imul ax, 20
add ax, offset _SHOT_FUNCS
mov _playchar_shot_funcs, ax
les bx, _resident
cmp es:[bx+resident_t.demo_num], 0
jz short loc_B145
cmp es:[bx+resident_t.demo_num], 5
jnb short loc_B13E
mov _playperf, 40
mov _rank, RANK_LUNATIC
jmp short loc_B156
; ---------------------------------------------------------------------------
loc_B13E:
mov _playperf, 32
jmp short loc_B151
; ---------------------------------------------------------------------------
loc_B145:
mov _playperf, 32
cmp _stage_id, 6
jnz short loc_B15D
loc_B151:
mov _rank, RANK_EXTRA
loc_B156:
mov _turbo_mode, 1
jmp short loc_B16F
; ---------------------------------------------------------------------------
loc_B15D:
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_B16F:
call sub_10398
call sub_E8FE
mov al, _rank
mov ah, 0
mov bx, ax
cmp bx, RANK_EXTRA
ja @@ret
add bx, bx
jmp cs:off_B225[bx]
@@easy:
mov _item_point_score_at_full_dream, 6000
mov _graze_score, 25
mov _playperf_min, 16
mov _playperf_max, 32
mov _bullet_template_tune, offset bullet_template_tune_easy
jmp short @@ret
; ---------------------------------------------------------------------------
@@normal:
mov _item_point_score_at_full_dream, 10000
mov _graze_score, 50
mov _playperf_min, 24
mov _playperf_max, 40
jmp short @@tune_normal
; ---------------------------------------------------------------------------
@@hard:
mov _item_point_score_at_full_dream, 15000
mov _playperf, 44
mov _graze_score, 100
mov _playperf_min, 44
mov _playperf_max, 54
mov _bullet_template_tune, offset bullet_template_tune_hard
jmp short @@ret
; ---------------------------------------------------------------------------
@@lunatic:
mov _item_point_score_at_full_dream, 20000
mov _graze_score, 200
mov _playperf, 48
mov _playperf_min, 48
mov _playperf_max, 58
mov _bullet_template_tune, offset bullet_template_tune_lunatic
jmp short @@ret
; ---------------------------------------------------------------------------
@@extra:
mov _item_point_score_at_full_dream, 40000
mov _graze_score, 500
mov _playperf_min, 32
mov _playperf_max, 36
@@tune_normal:
mov _bullet_template_tune, offset bullet_template_tune_normal
@@ret:
pop si
pop bp
retn
; ---------------------------------------------------------------------------
off_B225 dw offset @@easy
dw offset @@normal
dw offset @@hard
dw offset @@lunatic
dw offset @@extra
off_B22F dw offset @@reimu
dw offset @@marisa
dw offset @@mima
dw offset @@yuuka
sub_B063 endp
; =============== S U B R O U T I N E =======================================
; Attributes: bp-based frame
sub_B237 proc near
push bp
mov bp, sp
push si
mov word_20A84, 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_B260
cmp _stage_id, 6
jnz short loc_B2DD
loc_B260:
mov word_20A84, 1
call text_fillca pascal, (' ' shl 16) + TX_BLACK + TX_REVERSE
mov fp_2300E, offset nullfunc_near
call sub_B063
les bx, _resident
cmp es:[bx+resident_t.debug_mode], 0
jz short loc_B2A5
mov al, es:[bx+resident_t.debug_stage]
mov es:[bx+resident_t.stage], al
mov al, es:[bx+resident_t.stage]
mov _stage_id, al
mov al, es:[bx+resident_t.debug_power]
mov _power, al
mov es:[bx+resident_t.debug_mode], 0
mov byte_20A71, 1
loc_B2A5:
les bx, _resident
cmp es:[bx+resident_t.demo_num], 0
jz short loc_B2DD
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
cmp es:[bx+resident_t.demo_num], 5
jz short loc_B2CE
mov _power, POWER_MAX
loc_B2CE:
mov fp_2300E, offset @DemoPlay$qv
mov random_seed, 318
loc_B2DD:
call sub_CFEE
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 sub_CFEE
call @overlay_wipe$qv
call sub_B55A
nopcall hud_put
call @eyecatch_animate$qv
call @midboss_reset$qv
cmp word_20A84, 0
jz loc_B3CA
call bb_cheeto_load
call @bomb_bg_load__ems_preload_playch$qv
call bb_playchar_load
mov al, _playchar
mov ah, 0
mov bx, ax
cmp bx, PLAYCHAR_COUNT - 1
ja short loc_B359
add bx, bx
jmp cs:off_B552[bx]
loc_B33E:
push ds
push offset aReimu_bft ; "reimu.bft"
jmp short loc_B354
; ---------------------------------------------------------------------------
loc_B344:
push ds
push offset aMari_bft ; "mari.bft"
jmp short loc_B354
; ---------------------------------------------------------------------------
loc_B34A:
push ds
push offset aMima_bft ; "mima.bft"
jmp short loc_B354
; ---------------------------------------------------------------------------
loc_B350:
push ds
push offset aYuka_bft ; "yuka.bft"
loc_B354:
call super_entry_bfnt
loc_B359:
call super_entry_bfnt pascal, ds, offset aMikod_bft ; "mikod.bft"
call super_entry_bfnt pascal, ds, offset aMiko32_bft ; "miko32.bft"
mov al, _playchar
mov ah, 0
mov bx, ax
cmp bx, PLAYCHAR_COUNT - 1
ja short loc_B399
add bx, bx
jmp cs:off_B54A[bx]
loc_B37E:
push ds
push offset aReimu16_bft ; "reimu16.bft"
jmp short loc_B394
; ---------------------------------------------------------------------------
loc_B384:
push ds
push offset aMari16_bft ; "mari16.bft"
jmp short loc_B394
; ---------------------------------------------------------------------------
loc_B38A:
push ds
push offset aMima16_bft ; "mima16.bft"
jmp short loc_B394
; ---------------------------------------------------------------------------
loc_B390:
push ds
push offset aYuka16_bft ; "yuka16.bft"
loc_B394:
call super_entry_bfnt
loc_B399:
call super_entry_bfnt pascal, ds, offset aMiko16_bft ; "miko16.bft"
mov si, 12
jmp short loc_B3AE
; ---------------------------------------------------------------------------
loc_B3A7:
call super_convert_tiny pascal, si
inc si
loc_B3AE:
cmp si, TINY_MIKO16_END
jl short loc_B3A7
cmp _playchar, PLAYCHAR_YUUKA
jnz short loc_B3C1
push ds
push offset _BOMB_SHAPE_YUUKA_FN ; "bomb3.bft"
jmp short loc_B3C5
; ---------------------------------------------------------------------------
loc_B3C1:
push ds
push offset _BOMB_SHAPE_FN ; "bomb0.bft"
loc_B3C5:
call super_entry_bfnt
loc_B3CA:
nopcall @tiles_activate$qv
mov _pellet_bottom_col, GC_RG
mov al, _stage_id
mov ah, 0
mov bx, ax
cmp bx, 6
ja loc_B4A9
add bx, bx
jmp cs:off_B53C[bx]
loc_B3EA:
call @ems_preload_boss_faceset$qnxc pascal, ds, offset aBss0_cd2 ; "BSS0.CD2"
call super_entry_bfnt pascal, ds, offset aSt00_bft ; "st00.bft"
call @stage1_setup$qv
push ds
push offset aSt00_mpn ; "st00.mpn"
jmp loc_B4A6
; ---------------------------------------------------------------------------
loc_B404:
call @ems_preload_boss_faceset$qnxc pascal, ds, offset aBss1_cd2 ; "BSS1.CD2"
call super_entry_bfnt pascal, ds, offset aSt01_bft ; "st01.bft"
call @stage2_setup$qv
push ds
push offset aSt01_mpn ; "st01.mpn"
jmp loc_B4A6
; ---------------------------------------------------------------------------
loc_B41E:
call @ems_preload_boss_faceset$qnxc pascal, ds, offset aBss2_cd2 ; "BSS2.CD2"
call super_entry_bfnt pascal, ds, offset aSt02_bft ; "st02.bft"
call @stage3_setup$qv
push ds
push offset aSt02_mpn ; "st02.mpn"
jmp short loc_B4A6
; ---------------------------------------------------------------------------
loc_B437:
call @ems_preload_boss_faceset$qnxc pascal, ds, offset aBss3_cd2 ; "BSS3.CD2"
call super_entry_bfnt pascal, ds, offset aSt03_bft ; "st03.bft"
call @stage4_setup$qv
push ds
push offset aSt03_mpn ; "st03.mpn"
jmp short loc_B4A6
; ---------------------------------------------------------------------------
loc_B450:
call @ems_preload_boss_faceset$qnxc pascal, ds, offset aBss4_cd2 ; "BSS4.CD2"
call super_entry_bfnt pascal, ds, offset aSt04_bft ; "st04.bft"
call @stage5_setup$qv
push ds
push offset aSt04_mpn ; "st04.mpn"
jmp short loc_B4A6
; ---------------------------------------------------------------------------
loc_B469:
call @ems_preload_boss_faceset$qnxc pascal, ds, offset aBss4_cd2_0 ; "BSS4.CD2"
call super_entry_bfnt pascal, ds, offset aSt04_bft_0 ; "st04.bft"
call @stage6_setup$qv
mov _bg_render_not_bombing, offset @shinki_bg_render$qv
mov _bg_render_bombing_func, offset @shinki_bg_render$qv
jmp short loc_B4A9
; ---------------------------------------------------------------------------
loc_B48A:
nopcall sub_E4FC
call @ems_preload_boss_faceset$qnxc pascal, ds, offset aBss6_cd2 ; "BSS6.CD2"
call super_entry_bfnt pascal, ds, offset aSt06_bft ; "st06.bft"
call @stagex_setup$qv
push ds
push offset aSt06_mpn ; "st06.mpn"
loc_B4A6:
call mpn_load
loc_B4A9:
call @map_load$qv
call @std_load$qv
call @dialog_load$qv
call tiles_fill_initial
graph_accesspage 0
loc_B4BB:
cmp vsync_Count2, 80h
jb short loc_B4BB
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
jz short loc_B506
cmp es:[bx+resident_t.demo_num], 5
jnz short loc_B52C