[Naming] [th02/th04/th05] Demo loading and playback

This commit is contained in:
wintiger0222 2019-11-20 14:02:24 +00:00 committed by nmlgc
parent 7c80fb01f2
commit 37fb6eba32
13 changed files with 88 additions and 80 deletions

2
th02/demo.h Normal file
View File

@ -0,0 +1,2 @@
extern int demo_frame;
extern input_t *DemoBuf; /* ZUN symbol [MAGNet2010] */

2
th02/demo[bss].asm Normal file
View File

@ -0,0 +1,2 @@
public _DemoBuf
_DemoBuf dd ? ; ZUN symbol [MAGNet2010]

2
th02/demo[data].asm Normal file
View File

@ -0,0 +1,2 @@
public _demo_frame
_demo_frame dw 0

View File

@ -2,3 +2,5 @@
#define MEM_ASSIGN_PARAS_OP (256000 >> 4) #define MEM_ASSIGN_PARAS_OP (256000 >> 4)
#define MEM_ASSIGN_PARAS_MAIN (288000 >> 4) #define MEM_ASSIGN_PARAS_MAIN (288000 >> 4)
#define MEM_ASSIGN_PARAS_MAINE (288000 >> 4) #define MEM_ASSIGN_PARAS_MAINE (288000 >> 4)
#define DEMO_N 7000 /* ZUN symbol [MAGNet2010] */

View File

@ -2,3 +2,5 @@
MEM_ASSIGN_PARAS_OP equ (256000 shr 4) MEM_ASSIGN_PARAS_OP equ (256000 shr 4)
MEM_ASSIGN_PARAS_MAIN equ (288000 shr 4) MEM_ASSIGN_PARAS_MAIN equ (288000 shr 4)
MEM_ASSIGN_PARAS_MAINE equ (288000 shr 4) MEM_ASSIGN_PARAS_MAINE equ (288000 shr 4)
DEMO_N = 7000 ; ZUN symbol [MAGNet2010]

View File

@ -1870,7 +1870,7 @@ loc_B1BA:
les bx, mikoconfig les bx, mikoconfig
cmp es:[bx+mikoconfig_t.demo_num], 0 cmp es:[bx+mikoconfig_t.demo_num], 0
jz short loc_B1CA jz short loc_B1CA
nopcall sub_C13E nopcall demo_load
loc_B1CA: loc_B1CA:
call sub_B2AB call sub_B2AB
@ -1949,7 +1949,7 @@ loc_B27A:
; --------------------------------------------------------------------------- ; ---------------------------------------------------------------------------
loc_B287: loc_B287:
push word ptr dword_1F4A8+2 push word ptr _DemoBuf+2
call hmem_free call hmem_free
loc_B290: loc_B290:
@ -2798,7 +2798,7 @@ loc_BDA2:
les bx, mikoconfig les bx, mikoconfig
cmp es:[bx+mikoconfig_t.demo_num], 0 cmp es:[bx+mikoconfig_t.demo_num], 0
jz short loc_BDCC jz short loc_BDCC
nopcall sub_C1E4 nopcall DemoPlay
loc_BDCC: loc_BDCC:
call sub_F1D8 call sub_F1D8
@ -3156,14 +3156,13 @@ EGC_START_COPY_DEF 1, near
; =============== S U B R O U T I N E ======================================= ; =============== S U B R O U T I N E =======================================
; Attributes: bp-based frame ; Attributes: bp-based frame
public demo_load
sub_C13E proc far demo_load proc far
push bp push bp
mov bp, sp mov bp, sp
push 36B0h call hmem_allocbyte pascal, DEMO_N * 2
call hmem_allocbyte mov word ptr _DemoBuf+2, ax
mov word ptr dword_1F4A8+2, ax mov word ptr _DemoBuf, 0
mov word ptr dword_1F4A8, 0
mov power, 80 mov power, 80
mov word_20272, 0Ch mov word_20272, 0Ch
les bx, mikoconfig les bx, mikoconfig
@ -3204,32 +3203,30 @@ loc_C1AE:
mov es:[bx+mikoconfig_t.shottype], 1 mov es:[bx+mikoconfig_t.shottype], 1
loc_C1D0: loc_C1D0:
pushd [dword_1F4A8] call file_read pascal, large [_DemoBuf], DEMO_N * 2
push 36B0h
call file_read
call file_close call file_close
pop bp pop bp
retf retf
sub_C13E endp demo_load endp
; =============== S U B R O U T I N E ======================================= ; =============== S U B R O U T I N E =======================================
; Attributes: bp-based frame ; Attributes: bp-based frame
public DEMOPLAY
sub_C1E4 proc far DemoPlay proc far ; ZUN symbol [MAGNet2010]
push bp push bp
mov bp, sp mov bp, sp
cmp _input, 0 cmp _input, 0
jnz short loc_C20B jnz short loc_C20B
mov ax, word_1DB86 mov ax, _demo_frame
add ax, ax add ax, ax
les bx, dword_1F4A8 les bx, _DemoBuf
add bx, ax add bx, ax
mov ax, es:[bx] mov ax, es:[bx]
mov _input, ax mov _input, ax
inc word_1DB86 inc _demo_frame
cmp word_1DB86, 1B26h cmp _demo_frame, DEMO_N - 50
jl short loc_C222 jl short loc_C222
loc_C20B: loc_C20B:
@ -3242,7 +3239,7 @@ loc_C20B:
loc_C222: loc_C222:
pop bp pop bp
retf retf
sub_C1E4 endp DemoPlay endp
include th02/math/randring_fill.asm include th02/math/randring_fill.asm
RANDRING_NEXT_DEF 1 RANDRING_NEXT_DEF 1
@ -33976,7 +33973,7 @@ off_1DB7A dd aVdvVVBbvVVVV
off_1DB7E dd aB@b@vVvbavtvVV off_1DB7E dd aB@b@vVvbavtvVV
; "  はい、やめます。 " ; "  はい、やめます。 "
dword_1DB82 dd 0 dword_1DB82 dd 0
word_1DB86 dw 0 include th02/demo[data].asm
aTH02_02 db '  博麗 Eastern Wind ',0 aTH02_02 db '  博麗 Eastern Wind ',0
aTH02_03 db '  She',27h,'s in a temper!! ',0 aTH02_03 db '  She',27h,'s in a temper!! ',0
aTH02_04 db '  End of Daylight  ',0 aTH02_04 db '  End of Daylight  ',0
@ -35169,7 +35166,7 @@ farfp_1F498 dd ?
_boss_bg_render_func dd ? _boss_bg_render_func dd ?
farfp_1F4A0 dd ? farfp_1F4A0 dd ?
farfp_1F4A4 dd ? farfp_1F4A4 dd ?
dword_1F4A8 dd ? include th02/demo[bss].asm
byte_1F4AC db ? byte_1F4AC db ?
unk_1F4AD db ? ; unk_1F4AD db ? ;
dd ? ; dd ? ;

1
th04/demo.h Normal file
View File

@ -0,0 +1 @@
extern unsigned char *DemoBuf; /* ZUN symbol [MAGNet2010] */

View File

@ -3,3 +3,5 @@
#define MEM_ASSIGN_PARAS_MAIN (320000 >> 4) #define MEM_ASSIGN_PARAS_MAIN (320000 >> 4)
#define MEM_ASSIGN_PARAS_MAINE (336000 >> 4) #define MEM_ASSIGN_PARAS_MAINE (336000 >> 4)
extern unsigned int mem_assign_paras; extern unsigned int mem_assign_paras;
#define DEMO_N 4000 /* ZUN symbol [MAGNet2010] */

View File

@ -2,3 +2,5 @@
MEM_ASSIGN_PARAS_OP equ (336000 shr 4) MEM_ASSIGN_PARAS_OP equ (336000 shr 4)
MEM_ASSIGN_PARAS_MAIN equ (320000 shr 4) MEM_ASSIGN_PARAS_MAIN equ (320000 shr 4)
MEM_ASSIGN_PARAS_MAINE equ (336000 shr 4) MEM_ASSIGN_PARAS_MAINE equ (336000 shr 4)
DEMO_N = 4000 ; ZUN symbol [MAGNet2010]

View File

@ -684,7 +684,7 @@ loc_AEF9:
les bx, _humaconfig les bx, _humaconfig
cmp byte ptr es:[bx+3Eh], 0 cmp byte ptr es:[bx+3Eh], 0
jz short loc_AF4A jz short loc_AF4A
call main_01:sub_B3EE call main_01:demo_load
les bx, _humaconfig les bx, _humaconfig
mov al, es:[bx+3Ch] mov al, es:[bx+3Ch]
mov es:[bx+11h], al mov es:[bx+11h], al
@ -692,7 +692,7 @@ loc_AEF9:
mov power, 128 mov power, 128
add al, 30h ; '0' add al, 30h ; '0'
mov es:[bx+13h], al mov es:[bx+13h], al
mov fp_23D90, offset sub_B439 mov fp_23D90, offset DemoPlay
mov random_seed, 13Eh mov random_seed, 13Eh
loc_AF4A: loc_AF4A:
@ -1104,16 +1104,15 @@ sub_B2CF endp
; =============== S U B R O U T I N E ======================================= ; =============== S U B R O U T I N E =======================================
; Attributes: bp-based frame ; Attributes: bp-based frame
public demo_load
sub_B3EE proc near demo_load proc near
var_4 = dword ptr -4 var_4 = dword ptr -4
enter 4, 0 enter 4, 0
push 1F40h call hmem_allocbyte pascal, DEMO_N * 2
call hmem_allocbyte mov word ptr _DemoBuf+2, ax
mov word ptr dword_23D92+2, ax mov word ptr _DemoBuf, 0
mov word ptr dword_23D92, 0
mov word ptr [bp+var_4+2], ds mov word ptr [bp+var_4+2], ds
mov word ptr [bp+var_4], 1EDh mov word ptr [bp+var_4], 1EDh
les bx, _humaconfig les bx, _humaconfig
@ -1124,51 +1123,49 @@ var_4 = dword ptr -4
push word ptr [bp+var_4+2] push word ptr [bp+var_4+2]
push bx push bx
call file_ropen call file_ropen
pushd [dword_23D92] call file_read pascal, large [_DemoBuf], DEMO_N * 2
push 1F40h
call file_read
call file_close call file_close
leave leave
retn retn
sub_B3EE endp demo_load endp
; =============== S U B R O U T I N E ======================================= ; =============== S U B R O U T I N E =======================================
; Attributes: bp-based frame ; Attributes: bp-based frame
public DEMOPLAY
sub_B439 proc near DemoPlay proc near
push bp push bp
mov bp, sp mov bp, sp
cmp _input, INPUT_NONE cmp _input, INPUT_NONE
jnz short loc_B46D jnz short @@demo_end
les bx, dword_23D92 les bx, _DemoBuf
add bx, frame add bx, frame
mov al, es:[bx] mov al, es:[bx]
mov ah, 0 mov ah, 0
mov _input, ax mov _input, ax
mov ax, frame mov ax, frame
add ax, 0FA0h add ax, DEMO_N
mov bx, word ptr dword_23D92 mov bx, word ptr _DemoBuf
add bx, ax add bx, ax
mov al, es:[bx] mov al, es:[bx]
mov _input_focus, al mov _input_focus, al
cmp frame, 3996 cmp frame, DEMO_N - 4
jb short loc_B486 jb short @@demo_not_end
loc_B46D: @@demo_end:
push word ptr dword_23D92+2 push word ptr _DemoBuf+2
call hmem_free call hmem_free
push 0Ah push 10
call palette_black_out call palette_black_out
push ds push ds
push offset aOp_0 ; "op" push offset aOp_0 ; "op"
nopcall main_01:sub_E7FD nopcall main_01:sub_E7FD
loc_B486: @@demo_not_end:
pop bp pop bp
retn retn
sub_B439 endp DemoPlay endp
; =============== S U B R O U T I N E ======================================= ; =============== S U B R O U T I N E =======================================
@ -39800,7 +39797,7 @@ word_237F8 dw 0
; TODO: Missing clip[bss].asm (16 bytes) somewhere in there... ; TODO: Missing clip[bss].asm (16 bytes) somewhere in there...
dw ? dw ?
fp_23D90 dw ? fp_23D90 dw ?
dword_23D92 dd ? include th02/demo[bss].asm
dd ? dd ?
dd ? dd ?
dd ? dd ?

View File

@ -3,3 +3,5 @@
#define MEM_ASSIGN_PARAS_MAIN (291200 >> 4) #define MEM_ASSIGN_PARAS_MAIN (291200 >> 4)
#define MEM_ASSIGN_PARAS_MAINE (336000 >> 4) #define MEM_ASSIGN_PARAS_MAINE (336000 >> 4)
extern unsigned int mem_assign_paras; extern unsigned int mem_assign_paras;
#define DEMO_N 5000 /* ZUN symbol [MAGNet2010] */

View File

@ -2,3 +2,5 @@
MEM_ASSIGN_PARAS_OP equ (336000 shr 4) MEM_ASSIGN_PARAS_OP equ (336000 shr 4)
MEM_ASSIGN_PARAS_MAIN equ (291200 shr 4) MEM_ASSIGN_PARAS_MAIN equ (291200 shr 4)
MEM_ASSIGN_PARAS_MAINE equ (336000 shr 4) MEM_ASSIGN_PARAS_MAINE equ (336000 shr 4)
DEMO_N = 5000 ; ZUN symbol [MAGNet2010]

View File

@ -769,7 +769,7 @@ loc_B2A5:
les bx, _ksoconfig les bx, _ksoconfig
cmp byte ptr es:[bx+1Fh], 0 cmp byte ptr es:[bx+1Fh], 0
jz short loc_B2DD jz short loc_B2DD
call sub_B757 call demo_load
les bx, _ksoconfig les bx, _ksoconfig
mov al, es:[bx+1Dh] mov al, es:[bx+1Dh]
mov es:[bx+13h], al mov es:[bx+13h], al
@ -779,7 +779,7 @@ loc_B2A5:
mov power, 128 mov power, 128
loc_B2CE: loc_B2CE:
mov fp_2300E, offset sub_B7B5 mov fp_2300E, offset DemoPlay
mov random_seed, 13Eh mov random_seed, 13Eh
loc_B2DD: loc_B2DD:
@ -1249,8 +1249,8 @@ sub_B638 endp
; =============== S U B R O U T I N E ======================================= ; =============== S U B R O U T I N E =======================================
; Attributes: bp-based frame ; Attributes: bp-based frame
public demo_load
sub_B757 proc near demo_load proc near
var_4 = dword ptr -4 var_4 = dword ptr -4
@ -1258,20 +1258,19 @@ var_4 = dword ptr -4
push si push si
les bx, _ksoconfig les bx, _ksoconfig
cmp byte ptr es:[bx+1Fh], 4 cmp byte ptr es:[bx+1Fh], 4
ja short loc_B76C ja short @@demo_extra
mov ax, 2710h mov ax, DEMO_N * 2
jmp short loc_B76F jmp short loc_B76F
; --------------------------------------------------------------------------- ; ---------------------------------------------------------------------------
loc_B76C: @@demo_extra:
mov ax, 9C40h mov ax, (DEMO_N * 4) * 2
loc_B76F: loc_B76F:
mov si, ax mov si, ax
push ax call hmem_allocbyte pascal, ax
call hmem_allocbyte mov word ptr _DemoBuf+2, ax
mov word ptr dword_25FF4+2, ax mov word ptr _DemoBuf, 0
mov word ptr dword_25FF4, 0
mov word ptr [bp+var_4+2], ds mov word ptr [bp+var_4+2], ds
mov word ptr [bp+var_4], 22Dh mov word ptr [bp+var_4], 22Dh
les bx, _ksoconfig les bx, _ksoconfig
@ -1282,58 +1281,56 @@ loc_B76F:
push word ptr [bp+var_4+2] push word ptr [bp+var_4+2]
push bx push bx
call file_ropen call file_ropen
pushd [dword_25FF4] call file_read pascal, large [_DemoBuf], si
push si
call file_read
call file_close call file_close
pop si pop si
leave leave
retn retn
sub_B757 endp demo_load endp
; =============== S U B R O U T I N E ======================================= ; =============== S U B R O U T I N E =======================================
; Attributes: bp-based frame ; Attributes: bp-based frame
public DEMOPLAY
sub_B7B5 proc near DemoPlay proc near ; ZUN symbol [MAGNet2010]
var_2 = word ptr -2 var_2 = word ptr -2
enter 2, 0 enter 2, 0
les bx, _ksoconfig les bx, _ksoconfig
cmp byte ptr es:[bx+1Fh], 4 cmp byte ptr es:[bx+1Fh], 4
ja short loc_B7C9 ja short @@demo_extra
mov ax, 1388h mov ax, DEMO_N
jmp short loc_B7CC jmp short loc_B7CC
; --------------------------------------------------------------------------- ; ---------------------------------------------------------------------------
loc_B7C9: @@demo_extra:
mov ax, 4E20h mov ax, DEMO_N * 4
loc_B7CC: loc_B7CC:
mov [bp+var_2], ax mov [bp+var_2], ax
test _input, INPUT_REPLAY_END test _input, INPUT_REPLAY_END
jnz short loc_B80C jnz short loc_B80C
les bx, dword_25FF4 les bx, _DemoBuf
add bx, frame add bx, frame
mov al, es:[bx] mov al, es:[bx]
mov ah, 0 mov ah, 0
mov _input, ax mov _input, ax
mov ax, frame mov ax, frame
add ax, [bp+var_2] add ax, [bp+var_2]
mov bx, word ptr dword_25FF4 mov bx, word ptr _DemoBuf
add bx, ax add bx, ax
mov al, es:[bx] mov al, es:[bx]
mov _input_focus, al mov _input_focus, al
les bx, _ksoconfig les bx, _ksoconfig
cmp byte ptr es:[bx+1Fh], 4 cmp byte ptr es:[bx+1Fh], 4
ja short locret_B825 ja short locret_B825
cmp frame, 1384h cmp frame, DEMO_N - 4
jb short locret_B825 jb short locret_B825
loc_B80C: loc_B80C:
push word ptr dword_25FF4+2 push word ptr _DemoBuf+2
call hmem_free call hmem_free
push 8 push 8
call palette_black_out call palette_black_out
@ -1344,7 +1341,7 @@ loc_B80C:
locret_B825: locret_B825:
leave leave
retn retn
sub_B7B5 endp DemoPlay endp
; =============== S U B R O U T I N E ======================================= ; =============== S U B R O U T I N E =======================================
@ -7895,9 +7892,7 @@ sub_F2B4 proc far
push ds push ds
push offset aDemo5_rec ; "DEMO5.REC" push offset aDemo5_rec ; "DEMO5.REC"
call file_ropen call file_ropen
pushd [dword_25FF4] call file_read pascal, large [_DemoBuf], (DEMO_N * 4) * 2
push 9C40h
call file_read
call file_close call file_close
mov frame, 0 mov frame, 0
inc byte_221EC inc byte_221EC
@ -7906,7 +7901,7 @@ sub_F2B4 proc far
; --------------------------------------------------------------------------- ; ---------------------------------------------------------------------------
loc_F318: loc_F318:
push word ptr dword_25FF4+2 push word ptr _DemoBuf+2
call hmem_free call hmem_free
push 8 push 8
call palette_black_out call palette_black_out
@ -34925,7 +34920,7 @@ playchar db ?
word_25FF0 dw ? word_25FF0 dw ?
byte_25FF2 db ? byte_25FF2 db ?
db ? db ?
dword_25FF4 dd ? include th02/demo[bss].asm
byte_25FF8 db ? byte_25FF8 db ?
db ? db ?
word_25FFA dw ? word_25FFA dw ?