[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_MAIN (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_MAIN 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
cmp es:[bx+mikoconfig_t.demo_num], 0
jz short loc_B1CA
nopcall sub_C13E
nopcall demo_load
loc_B1CA:
call sub_B2AB
@ -1949,7 +1949,7 @@ loc_B27A:
; ---------------------------------------------------------------------------
loc_B287:
push word ptr dword_1F4A8+2
push word ptr _DemoBuf+2
call hmem_free
loc_B290:
@ -2798,7 +2798,7 @@ loc_BDA2:
les bx, mikoconfig
cmp es:[bx+mikoconfig_t.demo_num], 0
jz short loc_BDCC
nopcall sub_C1E4
nopcall DemoPlay
loc_BDCC:
call sub_F1D8
@ -3156,14 +3156,13 @@ EGC_START_COPY_DEF 1, near
; =============== S U B R O U T I N E =======================================
; Attributes: bp-based frame
sub_C13E proc far
public demo_load
demo_load proc far
push bp
mov bp, sp
push 36B0h
call hmem_allocbyte
mov word ptr dword_1F4A8+2, ax
mov word ptr dword_1F4A8, 0
call hmem_allocbyte pascal, DEMO_N * 2
mov word ptr _DemoBuf+2, ax
mov word ptr _DemoBuf, 0
mov power, 80
mov word_20272, 0Ch
les bx, mikoconfig
@ -3204,32 +3203,30 @@ loc_C1AE:
mov es:[bx+mikoconfig_t.shottype], 1
loc_C1D0:
pushd [dword_1F4A8]
push 36B0h
call file_read
call file_read pascal, large [_DemoBuf], DEMO_N * 2
call file_close
pop bp
retf
sub_C13E endp
demo_load endp
; =============== S U B R O U T I N E =======================================
; Attributes: bp-based frame
sub_C1E4 proc far
public DEMOPLAY
DemoPlay proc far ; ZUN symbol [MAGNet2010]
push bp
mov bp, sp
cmp _input, 0
jnz short loc_C20B
mov ax, word_1DB86
mov ax, _demo_frame
add ax, ax
les bx, dword_1F4A8
les bx, _DemoBuf
add bx, ax
mov ax, es:[bx]
mov _input, ax
inc word_1DB86
cmp word_1DB86, 1B26h
inc _demo_frame
cmp _demo_frame, DEMO_N - 50
jl short loc_C222
loc_C20B:
@ -3242,7 +3239,7 @@ loc_C20B:
loc_C222:
pop bp
retf
sub_C1E4 endp
DemoPlay endp
include th02/math/randring_fill.asm
RANDRING_NEXT_DEF 1
@ -33976,7 +33973,7 @@ off_1DB7A dd aVdvVVBbvVVVV
off_1DB7E dd aB@b@vVvbavtvVV
; "  はい、やめます。 "
dword_1DB82 dd 0
word_1DB86 dw 0
include th02/demo[data].asm
aTH02_02 db '  博麗 Eastern Wind ',0
aTH02_03 db '  She',27h,'s in a temper!! ',0
aTH02_04 db '  End of Daylight  ',0
@ -35169,7 +35166,7 @@ farfp_1F498 dd ?
_boss_bg_render_func dd ?
farfp_1F4A0 dd ?
farfp_1F4A4 dd ?
dword_1F4A8 dd ?
include th02/demo[bss].asm
byte_1F4AC db ?
unk_1F4AD db ? ;
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_MAINE (336000 >> 4)
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_MAIN equ (320000 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
cmp byte ptr es:[bx+3Eh], 0
jz short loc_AF4A
call main_01:sub_B3EE
call main_01:demo_load
les bx, _humaconfig
mov al, es:[bx+3Ch]
mov es:[bx+11h], al
@ -692,7 +692,7 @@ loc_AEF9:
mov power, 128
add al, 30h ; '0'
mov es:[bx+13h], al
mov fp_23D90, offset sub_B439
mov fp_23D90, offset DemoPlay
mov random_seed, 13Eh
loc_AF4A:
@ -1104,16 +1104,15 @@ sub_B2CF endp
; =============== S U B R O U T I N E =======================================
; Attributes: bp-based frame
sub_B3EE proc near
public demo_load
demo_load proc near
var_4 = dword ptr -4
enter 4, 0
push 1F40h
call hmem_allocbyte
mov word ptr dword_23D92+2, ax
mov word ptr dword_23D92, 0
call hmem_allocbyte pascal, DEMO_N * 2
mov word ptr _DemoBuf+2, ax
mov word ptr _DemoBuf, 0
mov word ptr [bp+var_4+2], ds
mov word ptr [bp+var_4], 1EDh
les bx, _humaconfig
@ -1124,51 +1123,49 @@ var_4 = dword ptr -4
push word ptr [bp+var_4+2]
push bx
call file_ropen
pushd [dword_23D92]
push 1F40h
call file_read
call file_read pascal, large [_DemoBuf], DEMO_N * 2
call file_close
leave
retn
sub_B3EE endp
demo_load endp
; =============== S U B R O U T I N E =======================================
; Attributes: bp-based frame
sub_B439 proc near
public DEMOPLAY
DemoPlay proc near
push bp
mov bp, sp
cmp _input, INPUT_NONE
jnz short loc_B46D
les bx, dword_23D92
jnz short @@demo_end
les bx, _DemoBuf
add bx, frame
mov al, es:[bx]
mov ah, 0
mov _input, ax
mov ax, frame
add ax, 0FA0h
mov bx, word ptr dword_23D92
add ax, DEMO_N
mov bx, word ptr _DemoBuf
add bx, ax
mov al, es:[bx]
mov _input_focus, al
cmp frame, 3996
jb short loc_B486
cmp frame, DEMO_N - 4
jb short @@demo_not_end
loc_B46D:
push word ptr dword_23D92+2
@@demo_end:
push word ptr _DemoBuf+2
call hmem_free
push 0Ah
push 10
call palette_black_out
push ds
push offset aOp_0 ; "op"
nopcall main_01:sub_E7FD
loc_B486:
@@demo_not_end:
pop bp
retn
sub_B439 endp
DemoPlay endp
; =============== 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...
dw ?
fp_23D90 dw ?
dword_23D92 dd ?
include th02/demo[bss].asm
dd ?
dd ?
dd ?

View File

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