From ee717c1d19048c74e514977a7f9021ceac7dfa02 Mon Sep 17 00:00:00 2001 From: nmlgc Date: Mon, 7 Nov 2022 23:56:25 +0100 Subject: [PATCH] [Reverse-engineering] [th03/th04/th05] Cutscenes: State variables You can fast-forward through cutscenes by holding Escape in these games?! And the script interpreter adds automatic line breaks?! Part of P0223, funded by Blue Bolt and rosenrose. --- th03/cutscene/cutscene.cpp | 32 ++ th03/cutscene/cutscene.hpp | 28 ++ th03/cutscene/cutscene[bss].asm | 47 +++ .../cutscene/cutscene[data].asm | 6 + th03_mainl.asm | 342 +++++++++--------- th04/cutscene/box.cpp | 12 +- th04/cutscene/cutscene[bss].asm | 3 - th04_maine.asm | 307 ++++++++-------- th05/maine011.cpp | 12 +- th05_maine.asm | 266 ++++++-------- 10 files changed, 553 insertions(+), 502 deletions(-) create mode 100644 th03/cutscene/cutscene.cpp create mode 100644 th03/cutscene/cutscene.hpp create mode 100644 th03/cutscene/cutscene[bss].asm rename th04/cutscene/box[data].asm => th03/cutscene/cutscene[data].asm (74%) delete mode 100644 th04/cutscene/cutscene[bss].asm diff --git a/th03/cutscene/cutscene.cpp b/th03/cutscene/cutscene.cpp new file mode 100644 index 00000000..3ccea9cc --- /dev/null +++ b/th03/cutscene/cutscene.cpp @@ -0,0 +1,32 @@ +// High-level overview of the differences between the three games that can't be +// easily abstracted away: +// +// 1) TH03 and TH04 allocate dedicated memory for backing up the text box area +// in VRAM ([box_bg]), TH05 uses the bgimage system instead. + +#include "platform.h" +#include "pc98.h" +#include "planar.h" +#include "shiftjis.hpp" +#include "master.hpp" + +// State +// ----- + +#if (GAME >= 4) + // Statically allocated. MODDERS: TH03's dynamic allocation was better than + // hardcoding a maximum size... + extern unsigned char script[8192]; + + extern unsigned char near *script_p; +#else + // Dynamically allocated. + extern unsigned char far *script; + + #define script_p script +#endif + +extern uint4_t text_col; +extern uint8_t text_fx; // TH04 and TH05 directly set [graph_putsa_fx_func]. +extern int script_number_param_default; +// ----- diff --git a/th03/cutscene/cutscene.hpp b/th03/cutscene/cutscene.hpp new file mode 100644 index 00000000..c8994299 --- /dev/null +++ b/th03/cutscene/cutscene.hpp @@ -0,0 +1,28 @@ +static const shiftjis_ank_amount_t NAME_LEN = 6; +static const shiftjis_kanji_amount_t NAME_KANJI_LEN = ( + NAME_LEN / sizeof(shiftjis_kanji_t) +); + +// Adding a fullwidth colon after the name +static const pixel_t NAME_W = ((NAME_LEN * GLYPH_HALF_W) + GLYPH_FULL_W); + +// Note that this does not correspond to the tiled area painted into TH05's +// EDBK?.PI images. +static const screen_x_t BOX_LEFT = 80; +static const screen_y_t BOX_TOP = 320; +static const pixel_t BOX_W = 480; +static const pixel_t BOX_H = (GLYPH_H * 4); + +static const vram_byte_amount_t BOX_VRAM_W = (BOX_W / BYTE_DOTS); +static const screen_x_t BOX_RIGHT = (BOX_LEFT + BOX_W); +static const screen_y_t BOX_BOTTOM = (BOX_TOP + BOX_H); + +extern Planar* box_bg; + +// Skips most delays during the cutscene if `true`. +extern bool fast_forward; + +// [y] is always aligned to GLYPH_H pixels. +extern screen_point_t cursor; + +extern int text_interval; diff --git a/th03/cutscene/cutscene[bss].asm b/th03/cutscene/cutscene[bss].asm new file mode 100644 index 00000000..8d8b6be0 --- /dev/null +++ b/th03/cutscene/cutscene[bss].asm @@ -0,0 +1,47 @@ +NAME_LEN = 6 +NAME_KANJI_LEN = (NAME_LEN / 2) +NAME_W = ((NAME_LEN * GLYPH_HALF_W) + GLYPH_FULL_W) + +BOX_LEFT = 80 +BOX_TOP = 320 +BOX_W = 480 +BOX_H = (GLYPH_H * 4) + +BOX_VRAM_W = (BOX_W / BYTE_DOTS) +BOX_RIGHT = (BOX_LEFT + BOX_W) +BOX_BOTTOM = (BOX_TOP + BOX_H) + +public _script, _fast_forward, _box_bg +if (GAME ge 4) + public _script_p + _script db 8192 dup(?) + _script_p dw ? +else + _script dd ? +endif +_box_bg dd ? +_fast_forward db ? + +if (GAME ge 4) + db 60 dup(?) +endif +if (GAME eq 5) + COLMAP_COUNT = 8 + + colmap_t struc + CM_values db COLMAP_COUNT dup (?) + CM_keys dw (NAME_KANJI_LEN * COLMAP_COUNT) dup (?) + colmap_t ends + + public _colmap + _colmap colmap_t +endif + evendata + +public _cursor, _text_interval, _text_col, _text_fx +public _script_number_param_default +_cursor Point +_text_interval dw ? +_text_col db ? +_text_fx db ? +_script_number_param_default dw ? diff --git a/th04/cutscene/box[data].asm b/th03/cutscene/cutscene[data].asm similarity index 74% rename from th04/cutscene/box[data].asm rename to th03/cutscene/cutscene[data].asm index ac49a3ed..2d72311c 100644 --- a/th04/cutscene/box[data].asm +++ b/th03/cutscene/cutscene[data].asm @@ -1,3 +1,9 @@ +if (GAME eq 5) + public _colmap_count + _colmap_count db 0 + evendata +endif + public _BOX_MASKS _BOX_MASKS label word dw 8888h, 0h, 2222h, 0h diff --git a/th03_mainl.asm b/th03_mainl.asm index 4879380b..1ad8da1f 100644 --- a/th03_mainl.asm +++ b/th03_mainl.asm @@ -1223,10 +1223,10 @@ loc_A147: mov si, ax push ax call hmem_allocbyte - mov word ptr _cutscene_script+2, ax - mov word ptr _cutscene_script, 0 + mov word ptr _script+2, ax + mov word ptr _script, 0 push ax - push word ptr _cutscene_script + push word ptr _script push si call file_read call file_close @@ -1246,11 +1246,11 @@ sub_A12E endp sub_A174 proc near push bp mov bp, sp - cmp _cutscene_script, 0 + cmp _script, 0 jz short loc_A191 - push word ptr _cutscene_script+2 + push word ptr _script+2 call hmem_free - mov _cutscene_script, 0 + mov _script, 0 loc_A191: pop bp @@ -1453,34 +1453,33 @@ sub_A23C endp sub_A36B proc near -var_8 = word ptr -8 -var_6 = word ptr -6 -var_4 = word ptr -4 -var_2 = word ptr -2 +@@vo = word ptr -8 +@@dst_byte = word ptr -6 +@@dst_y = word ptr -4 +@@src_x = word ptr -2 enter 8, 0 push si push di call sub_A43C graph_accesspage 0 - push 3C00h - call hmem_allocbyte - mov word ptr dword_105CA+2, ax - mov word ptr dword_105CA, 0 + call hmem_allocbyte pascal, (BOX_VRAM_W * BOX_H * PLANE_COUNT) + mov word ptr _box_bg+2, ax + mov word ptr _box_bg, 0 xor si, si - mov di, 140h - mov [bp+var_4], 0 + mov di, BOX_TOP + mov [bp+@@dst_y], 0 jmp loc_A430 ; --------------------------------------------------------------------------- loc_A398: - mov [bp+var_2], 50h ; 'P' - mov [bp+var_6], 0 + mov [bp+@@src_x], BOX_LEFT + mov [bp+@@dst_byte], 0 jmp loc_A424 ; --------------------------------------------------------------------------- loc_A3A5: - mov ax, [bp+var_2] + mov ax, [bp+@@src_x] sar ax, 3 mov dx, di shl dx, 6 @@ -1488,54 +1487,54 @@ loc_A3A5: mov dx, di shl dx, 4 add ax, dx - mov [bp+var_8], ax + mov [bp+@@vo], ax les bx, _VRAM_PLANE_B - add bx, [bp+var_8] + add bx, [bp+@@vo] mov ax, es:[bx] mov dx, si add dx, dx - les bx, dword_105CA + les bx, _box_bg add bx, dx mov es:[bx], ax inc si les bx, _VRAM_PLANE_R - add bx, [bp+var_8] + add bx, [bp+@@vo] mov ax, es:[bx] mov dx, si add dx, dx - les bx, dword_105CA + les bx, _box_bg add bx, dx mov es:[bx], ax inc si les bx, _VRAM_PLANE_G - add bx, [bp+var_8] + add bx, [bp+@@vo] mov ax, es:[bx] mov dx, si add dx, dx - les bx, dword_105CA + les bx, _box_bg add bx, dx mov es:[bx], ax inc si les bx, _VRAM_PLANE_E - add bx, [bp+var_8] + add bx, [bp+@@vo] mov ax, es:[bx] mov dx, si add dx, dx - les bx, dword_105CA + les bx, _box_bg add bx, dx mov es:[bx], ax inc si - add [bp+var_6], 2 - add [bp+var_2], 10h + add [bp+@@dst_byte], 2 + add [bp+@@src_x], (2 * BYTE_DOTS) loc_A424: - cmp [bp+var_6], 3Ch ; '<' + cmp [bp+@@dst_byte], BOX_VRAM_W jl loc_A3A5 - inc [bp+var_4] + inc [bp+@@dst_y] inc di loc_A430: - cmp [bp+var_4], 40h + cmp [bp+@@dst_y], BOX_H jl loc_A398 pop di pop si @@ -1551,11 +1550,11 @@ sub_A36B endp sub_A43C proc near push bp mov bp, sp - cmp dword_105CA, 0 + cmp _box_bg, 0 jz short loc_A459 - push word ptr dword_105CA+2 + push word ptr _box_bg+2 call hmem_free - mov dword_105CA, 0 + mov _box_bg, 0 loc_A459: pop bp @@ -1569,27 +1568,27 @@ sub_A43C endp sub_A45B proc near -var_6 = word ptr -6 -var_4 = word ptr -4 -var_2 = word ptr -2 +@@byte_ = word ptr -6 +@@dst_y = word ptr -4 +@@src_x = word ptr -2 enter 6, 0 push si push di xor cx, cx - mov si, 140h - mov [bp+var_4], 0 + mov si, BOX_TOP + mov [bp+@@dst_y], 0 jmp loc_A4FE ; --------------------------------------------------------------------------- loc_A46E: - mov [bp+var_2], 50h ; 'P' - mov [bp+var_6], 0 + mov [bp+@@src_x], BOX_LEFT + mov [bp+@@byte_], 0 jmp short loc_A4F4 ; --------------------------------------------------------------------------- loc_A47A: - mov ax, [bp+var_2] + mov ax, [bp+@@src_x] sar ax, 3 mov dx, si shl dx, 6 @@ -1600,7 +1599,7 @@ loc_A47A: mov di, ax mov ax, cx add ax, ax - les bx, dword_105CA + les bx, _box_bg add bx, ax mov ax, es:[bx] les bx, _VRAM_PLANE_B @@ -1609,7 +1608,7 @@ loc_A47A: inc cx mov ax, cx add ax, ax - les bx, dword_105CA + les bx, _box_bg add bx, ax mov ax, es:[bx] les bx, _VRAM_PLANE_R @@ -1618,7 +1617,7 @@ loc_A47A: inc cx mov ax, cx add ax, ax - les bx, dword_105CA + les bx, _box_bg add bx, ax mov ax, es:[bx] les bx, _VRAM_PLANE_G @@ -1627,24 +1626,24 @@ loc_A47A: inc cx mov ax, cx add ax, ax - les bx, dword_105CA + les bx, _box_bg add bx, ax mov ax, es:[bx] les bx, _VRAM_PLANE_E add bx, di mov es:[bx], ax inc cx - add [bp+var_6], 2 - add [bp+var_2], 10h + add [bp+@@byte_], 2 + add [bp+@@src_x], (2 * BYTE_DOTS) loc_A4F4: - cmp [bp+var_6], 3Ch ; '<' + cmp [bp+@@byte_], BOX_VRAM_W jl short loc_A47A - inc [bp+var_4] + inc [bp+@@dst_y] inc si loc_A4FE: - cmp [bp+var_4], 40h + cmp [bp+@@dst_y], BOX_H jl loc_A46E pop di pop si @@ -1664,26 +1663,26 @@ var_1 = byte ptr -1 arg_0 = dword ptr 4 enter 2, 0 - les bx, _cutscene_script + les bx, _script mov cl, es:[bx] - inc word ptr _cutscene_script - les bx, _cutscene_script + inc word ptr _script + les bx, _script mov al, es:[bx] mov [bp+var_1], al - inc word ptr _cutscene_script - les bx, _cutscene_script + inc word ptr _script + les bx, _script mov al, es:[bx] mov [bp+var_2], al - inc word ptr _cutscene_script + inc word ptr _script mov al, cl mov ah, 0 mov bx, ax test (__ctype + 1)[bx], _IS_DIG jnz short loc_A554 les bx, [bp+arg_0] - mov ax, word_105D8 + mov ax, _script_number_param_default mov es:[bx], ax - sub word ptr _cutscene_script, 3 + sub word ptr _script, 3 leave retn 4 ; --------------------------------------------------------------------------- @@ -1699,7 +1698,7 @@ loc_A554: add ax, 0FFD0h les bx, [bp+arg_0] mov es:[bx], ax - sub word ptr _cutscene_script, 2 + sub word ptr _script, 2 leave retn 4 ; --------------------------------------------------------------------------- @@ -1720,7 +1719,7 @@ loc_A578: add ax, 0FFD0h les bx, [bp+arg_0] mov es:[bx], ax - dec word ptr _cutscene_script + dec word ptr _script leave retn 4 ; --------------------------------------------------------------------------- @@ -1756,10 +1755,10 @@ arg_0 = dword ptr 4 push bp mov bp, sp - les bx, _cutscene_script + les bx, _script cmp byte ptr es:[bx], ',' jnz short loc_A5EF - inc word ptr _cutscene_script + inc word ptr _script pushd [bp+arg_0] call sub_A50A pop bp @@ -1768,7 +1767,7 @@ arg_0 = dword ptr 4 loc_A5EF: les bx, [bp+arg_0] - mov ax, word_105D8 + mov ax, _script_number_param_default mov es:[bx], ax pop bp retn 4 @@ -1782,20 +1781,20 @@ sub_A5D3 endp sub_A5FC proc near push bp mov bp, sp - add point_105D0.x, 16 - cmp point_105D0.x, 560 + add _cursor.x, GLYPH_FULL_W + cmp _cursor.x, BOX_RIGHT jl short loc_A64B - add point_105D0.y, 16 - mov point_105D0.x, 144 - cmp point_105D0.y, 384 + add _cursor.y, GLYPH_H + mov _cursor.x, (BOX_LEFT + NAME_W) + cmp _cursor.y, BOX_BOTTOM jl short loc_A64B - cmp byte_105CE, 0 + cmp _fast_forward, 0 jnz short loc_A62D call input_wait_for_change pascal, 0 loc_A62D: - mov point_105D0.x, 80 - mov point_105D0.y, 320 + mov _cursor.x, BOX_LEFT + mov _cursor.y, BOX_TOP graph_accesspage 1 call sub_A45B graph_accesspage 0 @@ -1845,34 +1844,34 @@ loc_A67C: jmp word ptr cs:[bx+20h] ; switch jump loc_A680: - add point_105D0.y, 16 ; jumptable 0000A67C case 110 - mov point_105D0.x, 80 - cmp point_105D0.y, 384 + add _cursor.y, GLYPH_H ; jumptable 0000A67C case 110 + mov _cursor.x, BOX_LEFT + cmp _cursor.y, BOX_BOTTOM jl loc_AC1E ; default loc_A695: - les bx, _cutscene_script ; jumptable 0000A67C case 115 + les bx, _script ; jumptable 0000A67C case 115 mov al, es:[bx] mov [bp+arg_0], al cmp [bp+arg_0], '-' jz short loc_A6C4 - mov word_105D8, 0 + mov _script_number_param_default, 0 push ss lea ax, [bp+var_2] push ax call sub_A50A - cmp byte_105CE, 0 + cmp _fast_forward, 0 jnz short loc_A6C8 call input_wait_for_change pascal, [bp+var_2] jmp short loc_A6C8 ; --------------------------------------------------------------------------- loc_A6C4: - inc word ptr _cutscene_script + inc word ptr _script loc_A6C8: - mov point_105D0.x, 80 - mov point_105D0.y, 320 + mov _cursor.x, BOX_LEFT + mov _cursor.y, BOX_TOP graph_accesspage 1 call sub_A45B graph_accesspage 0 @@ -1881,18 +1880,18 @@ loc_A6C8: ; --------------------------------------------------------------------------- loc_A6E9: - mov word_105D8, 0Fh ; jumptable 0000A67C case 99 + mov _script_number_param_default, V_WHITE ; jumptable 0000A67C case 99 push ss lea ax, [bp+var_2] push ax call sub_A50A mov al, byte ptr [bp+var_2] - mov col_105D6, al + mov _text_col, al jmp loc_AC1E ; default ; --------------------------------------------------------------------------- loc_A700: - mov word_105D8, 2 ; jumptable 0000A67C case 98 + mov _script_number_param_default, WEIGHT_BOLD ; jumptable 0000A67C case 98 push ss lea ax, [bp+var_2] push ax @@ -1904,27 +1903,27 @@ loc_A700: jmp cs:off_AC26[bx] loc_A71F: - mov byte_105D7, 0 + mov _text_fx, FX_WEIGHT_NORMAL jmp loc_AC1E ; default ; --------------------------------------------------------------------------- loc_A727: - mov byte_105D7, 10h + mov _text_fx, FX_WEIGHT_HEAVY jmp loc_AC1E ; default ; --------------------------------------------------------------------------- loc_A72F: - mov byte_105D7, 20h ; ' ' + mov _text_fx, FX_WEIGHT_BOLD jmp loc_AC1E ; default ; --------------------------------------------------------------------------- loc_A737: - mov byte_105D7, 30h ; '0' + mov _text_fx, FX_WEIGHT_BLACK jmp loc_AC1E ; default ; --------------------------------------------------------------------------- loc_A73F: - les bx, _cutscene_script ; jumptable 0000A67C case 119 + les bx, _script ; jumptable 0000A67C case 119 mov al, es:[bx] mov ah, 0 push ax ; ch @@ -1937,8 +1936,8 @@ loc_A73F: jnz short loc_A78C loc_A75E: - inc word ptr _cutscene_script - mov word_105D8, 1 + inc word ptr _script + mov _script_number_param_default, 1 push ss lea ax, [bp+var_2] push ax @@ -1957,19 +1956,19 @@ loc_A781: ; --------------------------------------------------------------------------- loc_A78C: - mov word_105D8, 40h + mov _script_number_param_default, 64 cmp [bp+arg_0], 'm' jz short loc_A7CF cmp [bp+arg_0], 'k' jnz short loc_A7A2 - inc word ptr _cutscene_script + inc word ptr _script loc_A7A2: push ss lea ax, [bp+var_2] push ax call sub_A50A - cmp byte_105CE, 0 + cmp _fast_forward, 0 jnz loc_AC1E ; default cmp [bp+arg_0], 'k' jz short loc_A7C4 @@ -1984,13 +1983,13 @@ loc_A7C4: ; --------------------------------------------------------------------------- loc_A7CF: - inc word ptr _cutscene_script - les bx, _cutscene_script + inc word ptr _script + les bx, _script mov al, es:[bx] mov [bp+arg_0], al cmp [bp+arg_0], 'k' jnz short loc_A7E7 - inc word ptr _cutscene_script + inc word ptr _script loc_A7E7: push ss @@ -2001,7 +2000,7 @@ loc_A7E7: lea ax, [bp+var_4] push ax call sub_A5D3 - cmp byte_105CE, 0 + cmp _fast_forward, 0 jnz loc_AC1E ; default cmp [bp+arg_0], 'k' jz short loc_A814 @@ -2017,22 +2016,22 @@ loc_A814: ; --------------------------------------------------------------------------- loc_A822: - les bx, _cutscene_script ; jumptable 0000A67C case 118 + les bx, _script ; jumptable 0000A67C case 118 cmp byte ptr es:[bx], 'p' jz short loc_A843 - mov word_105D8, 1 + mov _script_number_param_default, 1 push ss lea ax, [bp+var_2] push ax call sub_A50A mov ax, [bp+var_2] - mov word_105D4, ax + mov _text_interval, ax jmp loc_AC1E ; default ; --------------------------------------------------------------------------- loc_A843: - inc word ptr _cutscene_script - mov word_105D8, 0 + inc word ptr _script + mov _script_number_param_default, 0 push ss lea ax, [bp+var_2] push ax @@ -2042,12 +2041,12 @@ loc_A843: ; --------------------------------------------------------------------------- loc_A85F: - mov word_105D8, 64h ; 'd' ; jumptable 0000A67C case 116 + mov _script_number_param_default, 100 ; jumptable 0000A67C case 116 push ss lea ax, [bp+var_2] push ax call sub_A50A - cmp byte_105CE, 0 + cmp _fast_forward, 0 jnz short loc_A87B push 1 call frame_delay @@ -2060,7 +2059,7 @@ loc_A87B: ; --------------------------------------------------------------------------- loc_A889: - les bx, _cutscene_script ; jumptable 0000A67C case 102 + les bx, _script ; jumptable 0000A67C case 102 mov al, es:[bx] mov [bp+arg_0], al cmp [bp+arg_0], 'm' @@ -2071,8 +2070,8 @@ loc_A889: jnz loc_AC1E ; default loc_A8A7: - inc word ptr _cutscene_script - mov word_105D8, 1 + inc word ptr _script + mov _script_number_param_default, 1 push ss lea ax, [bp+var_2] push ax @@ -2091,8 +2090,8 @@ loc_A8CA: ; --------------------------------------------------------------------------- loc_A8D5: - inc word ptr _cutscene_script - mov word_105D8, 1 + inc word ptr _script + mov _script_number_param_default, 1 push ss lea ax, [bp+var_2] push ax @@ -2104,10 +2103,10 @@ loc_A8D5: ; --------------------------------------------------------------------------- loc_A8F1: - les bx, _cutscene_script ; jumptable 0000A67C case 103 + les bx, _script ; jumptable 0000A67C case 103 cmp byte ptr es:[bx], 'a' jz short loc_A945 - mov word_105D8, 8 + mov _script_number_param_default, 8 push ss lea ax, [bp+var_2] push ax @@ -2128,7 +2127,7 @@ loc_A91A: loc_A91D: call graph_scrollup - cmp byte_105CE, 0 + cmp _fast_forward, 0 jnz short loc_A930 push 1 call frame_delay @@ -2145,27 +2144,27 @@ loc_A933: ; --------------------------------------------------------------------------- loc_A945: - inc word ptr _cutscene_script - mov word_105D8, 0 + inc word ptr _script + mov _script_number_param_default, 0 push ss lea ax, [bp+var_2] push ax call sub_A50A graph_accesspage 1 - push point_105D0.x - push point_105D0.y + push _cursor.x + push _cursor.y mov ax, [bp+var_2] dec ax push ax - mov al, col_105D6 + mov al, _text_col mov ah, 0 push ax call graph_gaiji_putc graph_accesspage 0 - push point_105D0.x - push point_105D0.y + push _cursor.x + push _cursor.y push [bp+var_2] - mov al, col_105D6 + mov al, _text_col mov ah, 0 push ax call graph_gaiji_putc @@ -2174,12 +2173,12 @@ loc_A945: ; --------------------------------------------------------------------------- loc_A997: - mov word_105D8, 0 ; jumptable 0000A67C case 107 + mov _script_number_param_default, 0 ; jumptable 0000A67C case 107 push ss lea ax, [bp+var_2] push ax call sub_A50A - cmp byte_105CE, 0 + cmp _fast_forward, 0 jnz loc_AC1E ; default call input_wait_for_change pascal, 0 jmp loc_AB90 @@ -2194,10 +2193,10 @@ loc_A9B8: ; --------------------------------------------------------------------------- loc_A9D1: - les bx, _cutscene_script ; jumptable 0000A67C case 112 + les bx, _script ; jumptable 0000A67C case 112 mov al, es:[bx] mov [bp+arg_0], al - inc word ptr _cutscene_script + inc word ptr _script cmp [bp+arg_0], '=' jz short loc_A9EB cmp [bp+arg_0], '@' @@ -2234,7 +2233,7 @@ loc_AA32: loc_AA42: cmp [bp+arg_0], ',' jz short loc_AA4F - dec word ptr _cutscene_script + dec word ptr _script jmp loc_AC1E ; default ; --------------------------------------------------------------------------- @@ -2244,10 +2243,10 @@ loc_AA4F: ; --------------------------------------------------------------------------- loc_AA56: - les bx, _cutscene_script + les bx, _script mov al, es:[bx] mov [bp+arg_0], al - inc word ptr _cutscene_script + inc word ptr _script mov ah, 0 mov bx, ax test (__ctype + 1)[bx], _IS_CTL @@ -2277,8 +2276,8 @@ loc_AA8A: ; --------------------------------------------------------------------------- loc_AAA3: - mov word_105D8, 4 ; jumptable 0000A67C case 61 - les bx, _cutscene_script + mov _script_number_param_default, 4 ; jumptable 0000A67C case 61 + les bx, _script mov al, es:[bx] mov [bp+arg_0], al cmp [bp+arg_0], 3Dh ; '=' @@ -2302,12 +2301,12 @@ loc_AAD5: ; --------------------------------------------------------------------------- loc_AAF8: - inc word ptr _cutscene_script + inc word ptr _script push ss lea ax, [bp+var_2] push ax call sub_A50A - mov word_105D8, 1 + mov _script_number_param_default, 1 push ss lea ax, [bp+var_4] push ax @@ -2321,7 +2320,7 @@ loc_AB16: push [bp+var_2] push si call sub_A23C - cmp byte_105CE, 0 + cmp _fast_forward, 0 jnz short loc_AB32 push [bp+var_4] call frame_delay @@ -2348,12 +2347,12 @@ loc_AB63: ; --------------------------------------------------------------------------- loc_AB66: - les bx, _cutscene_script ; jumptable 0000A67C case 109 + les bx, _script ; jumptable 0000A67C case 109 mov al, es:[bx] mov [bp+arg_0], al cmp [bp+arg_0], 24h ; '$' jnz short loc_AB7F - inc word ptr _cutscene_script + inc word ptr _script push (KAJA_SONG_STOP shl 8) jmp short loc_AB8B ; --------------------------------------------------------------------------- @@ -2361,7 +2360,7 @@ loc_AB66: loc_AB7F: cmp [bp+arg_0], 2Ah ; '*' jnz short loc_AB93 - inc word ptr _cutscene_script + inc word ptr _script loc_AB89: push (KAJA_SONG_PLAY shl 8) @@ -2376,16 +2375,16 @@ loc_AB90: loc_AB93: cmp [bp+arg_0], 2Ch ; ',' jnz loc_AC1E ; default - inc word ptr _cutscene_script + inc word ptr _script mov [bp+var_2], 0 jmp short loc_ABD4 ; --------------------------------------------------------------------------- loc_ABA6: - les bx, _cutscene_script + les bx, _script mov al, es:[bx] mov [bp+arg_0], al - inc word ptr _cutscene_script + inc word ptr _script mov ah, 0 mov bx, ax test (__ctype + 1)[bx], _IS_CTL @@ -2482,31 +2481,31 @@ var_1 = byte ptr -1 push si mov word ptr [bp+var_6+2], ds mov word ptr [bp+var_6], offset asc_EFC2 - mov point_105D0.x, 80 - mov point_105D0.y, 320 - mov word_105D4, 1 - mov col_105D6, V_WHITE - mov byte_105D7, 20h ; ' ' + mov _cursor.x, BOX_LEFT + mov _cursor.y, BOX_TOP + mov _text_interval, 1 + mov _text_col, V_WHITE + mov _text_fx, FX_WEIGHT_BOLD mov [bp+var_2], 0 call sub_A36B - mov byte_105CE, 0 + mov _fast_forward, 0 loc_ACA3: call input_mode_interface test _input_sp.hi, high INPUT_CANCEL jz short loc_ACB6 - mov byte_105CE, 1 + mov _fast_forward, 1 jmp short loc_ACBB ; --------------------------------------------------------------------------- loc_ACB6: - mov byte_105CE, 0 + mov _fast_forward, 0 loc_ACBB: - les bx, _cutscene_script + les bx, _script mov al, es:[bx] mov [bp+var_1], al - inc word ptr _cutscene_script + inc word ptr _script mov ah, 0 mov bx, ax test (__ctype + 1)[bx], _IS_CTL @@ -2515,10 +2514,10 @@ loc_ACBB: jz short loc_ACA3 cmp [bp+var_1], '\' jnz short loc_ACFB - les bx, _cutscene_script + les bx, _script mov al, es:[bx] mov [bp+var_1], al - inc word ptr _cutscene_script + inc word ptr _script push word ptr [bp+var_1] call sub_A64D cmp al, -1 @@ -2530,43 +2529,43 @@ loc_ACFB: les bx, [bp+var_6] mov al, [bp+var_1] mov es:[bx], al - les bx, _cutscene_script + les bx, _script mov al, es:[bx] mov [bp+var_1], al les bx, [bp+var_6] mov es:[bx+1], al - inc word ptr _cutscene_script + inc word ptr _script graph_accesspage 1 - push point_105D0.x - push point_105D0.y - mov al, col_105D6 - or al, byte_105D7 + push _cursor.x + push _cursor.y + mov al, _text_col + or al, _text_fx mov ah, 0 push ax push word ptr [bp+var_6+2] push bx call graph_putsa_fx graph_accesspage 0 - push point_105D0.x - push point_105D0.y - mov al, col_105D6 - or al, byte_105D7 + push _cursor.x + push _cursor.y + mov al, _text_col + or al, _text_fx mov ah, 0 push ax pushd [bp+var_6] call graph_putsa_fx call sub_A5FC - cmp byte_105CE, 0 + cmp _fast_forward, 0 jnz loc_ACA3 cmp _input_sp, INPUT_NONE jnz short loc_AD7A - push word_105D4 + push _text_interval call frame_delay jmp loc_ACA3 ; --------------------------------------------------------------------------- loc_AD7A: - mov ax, word_105D4 + mov ax, _text_interval mov bx, 3 cwd idiv bx @@ -4586,16 +4585,7 @@ include th03/hardware/input[bss].asm include th03/formats/cdg[bss].asm include th02/formats/pi_slots[bss].asm include th03/formats/hfliplut[bss].asm -public _cutscene_script -_cutscene_script dd ? -dword_105CA dd ? -byte_105CE db ? - db ? -point_105D0 Point -word_105D4 dw ? -col_105D6 db ? -byte_105D7 db ? -word_105D8 dw ? +include th03/cutscene/cutscene[bss].asm public _resident _resident dd ? public _hi diff --git a/th04/cutscene/box.cpp b/th04/cutscene/box.cpp index b8e128d7..1246a58b 100644 --- a/th04/cutscene/box.cpp +++ b/th04/cutscene/box.cpp @@ -3,17 +3,9 @@ #include "pc98.h" #include "planar.h" #include "decomp.hpp" +#include "shiftjis.hpp" #include "master.hpp" - -// Note that this does not correspond to the tiled area painted into TH05's -// EDBK?.PI images. -static const screen_x_t BOX_LEFT = 80; -static const screen_y_t BOX_TOP = 320; -static const pixel_t BOX_W = 480; -static const pixel_t BOX_H = (GLYPH_H * 4); - -static const screen_y_t BOX_RIGHT = (BOX_LEFT + BOX_W); -static const screen_y_t BOX_BOTTOM = (BOX_TOP + BOX_H); +#include "th03/cutscene/cutscene.hpp" typedef enum { BOX_MASK_0, diff --git a/th04/cutscene/cutscene[bss].asm b/th04/cutscene/cutscene[bss].asm deleted file mode 100644 index 19042947..00000000 --- a/th04/cutscene/cutscene[bss].asm +++ /dev/null @@ -1,3 +0,0 @@ -public _cutscene_script, _cutscene_script_ptr -_cutscene_script db 8192 dup(?) -_cutscene_script_ptr dw ? diff --git a/th04_maine.asm b/th04_maine.asm index ca6dcd31..03826476 100644 --- a/th04_maine.asm +++ b/th04_maine.asm @@ -357,9 +357,9 @@ arg_0 = dword ptr 4 loc_A2AD: call file_size mov [bp+var_2], ax - mov _cutscene_script_ptr, offset _cutscene_script + mov _script_p, offset _script push ds - push _cutscene_script_ptr + push _script_p push ax call file_read call file_close @@ -576,34 +576,33 @@ sub_A37F endp sub_A4AE proc near -var_8 = word ptr -8 -var_6 = word ptr -6 -var_4 = word ptr -4 -var_2 = word ptr -2 +@@vo = word ptr -8 +@@byte_ = word ptr -6 +@@dst_y = word ptr -4 +@@src_x = word ptr -2 enter 8, 0 push si push di call sub_A57F graph_accesspage 0 - push 3C00h - call hmem_allocbyte - mov word ptr dword_1247A+2, ax - mov word ptr dword_1247A, 0 + call hmem_allocbyte pascal, (BOX_VRAM_W * BOX_H * PLANE_COUNT) + mov word ptr _box_bg+2, ax + mov word ptr _box_bg, 0 xor si, si - mov di, 140h - mov [bp+var_4], 0 + mov di, BOX_TOP + mov [bp+@@dst_y], 0 jmp loc_A573 ; --------------------------------------------------------------------------- loc_A4DB: - mov [bp+var_2], 50h ; 'P' - mov [bp+var_6], 0 + mov [bp+@@src_x], BOX_LEFT + mov [bp+@@byte_], 0 jmp loc_A567 ; --------------------------------------------------------------------------- loc_A4E8: - mov ax, [bp+var_2] + mov ax, [bp+@@src_x] sar ax, 3 mov dx, di shl dx, 6 @@ -611,54 +610,54 @@ loc_A4E8: mov dx, di shl dx, 4 add ax, dx - mov [bp+var_8], ax + mov [bp+@@vo], ax les bx, _VRAM_PLANE_B - add bx, [bp+var_8] + add bx, [bp+@@vo] mov ax, es:[bx] mov dx, si add dx, dx - les bx, dword_1247A + les bx, _box_bg add bx, dx mov es:[bx], ax inc si les bx, _VRAM_PLANE_R - add bx, [bp+var_8] + add bx, [bp+@@vo] mov ax, es:[bx] mov dx, si add dx, dx - les bx, dword_1247A + les bx, _box_bg add bx, dx mov es:[bx], ax inc si les bx, _VRAM_PLANE_G - add bx, [bp+var_8] + add bx, [bp+@@vo] mov ax, es:[bx] mov dx, si add dx, dx - les bx, dword_1247A + les bx, _box_bg add bx, dx mov es:[bx], ax inc si les bx, _VRAM_PLANE_E - add bx, [bp+var_8] + add bx, [bp+@@vo] mov ax, es:[bx] mov dx, si add dx, dx - les bx, dword_1247A + les bx, _box_bg add bx, dx mov es:[bx], ax inc si - add [bp+var_6], 2 - add [bp+var_2], 10h + add [bp+@@byte_], 2 + add [bp+@@src_x], (2 * BYTE_DOTS) loc_A567: - cmp [bp+var_6], 3Ch ; '<' + cmp [bp+@@byte_], BOX_VRAM_W jl loc_A4E8 - inc [bp+var_4] + inc [bp+@@dst_y] inc di loc_A573: - cmp [bp+var_4], 40h + cmp [bp+@@dst_y], BOX_H jl loc_A4DB pop di pop si @@ -674,11 +673,11 @@ sub_A4AE endp sub_A57F proc near push bp mov bp, sp - cmp dword_1247A, 0 + cmp _box_bg, 0 jz short loc_A59C - push word ptr dword_1247A+2 + push word ptr _box_bg+2 call hmem_free - mov dword_1247A, 0 + mov _box_bg, 0 loc_A59C: pop bp @@ -692,27 +691,27 @@ sub_A57F endp sub_A59E proc near -var_6 = word ptr -6 -var_4 = word ptr -4 -var_2 = word ptr -2 +@@byte_ = word ptr -6 +@@dst_y = word ptr -4 +@@src_x = word ptr -2 enter 6, 0 push si push di xor cx, cx - mov si, 140h - mov [bp+var_4], 0 + mov si, BOX_TOP + mov [bp+@@dst_y], 0 jmp loc_A641 ; --------------------------------------------------------------------------- loc_A5B1: - mov [bp+var_2], 50h ; 'P' - mov [bp+var_6], 0 + mov [bp+@@src_x], BOX_LEFT + mov [bp+@@byte_], 0 jmp short loc_A637 ; --------------------------------------------------------------------------- loc_A5BD: - mov ax, [bp+var_2] + mov ax, [bp+@@src_x] sar ax, 3 mov dx, si shl dx, 6 @@ -723,7 +722,7 @@ loc_A5BD: mov di, ax mov ax, cx add ax, ax - les bx, dword_1247A + les bx, _box_bg add bx, ax mov ax, es:[bx] les bx, _VRAM_PLANE_B @@ -732,7 +731,7 @@ loc_A5BD: inc cx mov ax, cx add ax, ax - les bx, dword_1247A + les bx, _box_bg add bx, ax mov ax, es:[bx] les bx, _VRAM_PLANE_R @@ -741,7 +740,7 @@ loc_A5BD: inc cx mov ax, cx add ax, ax - les bx, dword_1247A + les bx, _box_bg add bx, ax mov ax, es:[bx] les bx, _VRAM_PLANE_G @@ -750,24 +749,24 @@ loc_A5BD: inc cx mov ax, cx add ax, ax - les bx, dword_1247A + les bx, _box_bg add bx, ax mov ax, es:[bx] les bx, _VRAM_PLANE_E add bx, di mov es:[bx], ax inc cx - add [bp+var_6], 2 - add [bp+var_2], 10h + add [bp+@@byte_], 2 + add [bp+@@src_x], (2 * BYTE_DOTS) loc_A637: - cmp [bp+var_6], 3Ch ; '<' + cmp [bp+@@byte_], BOX_VRAM_W jl short loc_A5BD - inc [bp+var_4] + inc [bp+@@dst_y] inc si loc_A641: - cmp [bp+var_4], 40h + cmp [bp+@@dst_y], BOX_H jl loc_A5B1 pop di pop si @@ -787,26 +786,26 @@ var_1 = byte ptr -1 arg_0 = dword ptr 4 enter 2, 0 - mov bx, _cutscene_script_ptr + mov bx, _script_p mov cl, [bx] - inc _cutscene_script_ptr - mov bx, _cutscene_script_ptr + inc _script_p + mov bx, _script_p mov al, [bx] mov [bp+var_1], al - inc _cutscene_script_ptr - mov bx, _cutscene_script_ptr + inc _script_p + mov bx, _script_p mov al, [bx] mov [bp+var_2], al - inc _cutscene_script_ptr + inc _script_p mov al, cl mov ah, 0 mov bx, ax test (__ctype + 1)[bx], _IS_DIG jnz short loc_A694 les bx, [bp+arg_0] - mov ax, word_124C4 + mov ax, _script_number_param_default mov es:[bx], ax - sub _cutscene_script_ptr, 3 + sub _script_p, 3 leave retn 4 ; --------------------------------------------------------------------------- @@ -822,7 +821,7 @@ loc_A694: add ax, 0FFD0h les bx, [bp+arg_0] mov es:[bx], ax - sub _cutscene_script_ptr, 2 + sub _script_p, 2 leave retn 4 ; --------------------------------------------------------------------------- @@ -843,7 +842,7 @@ loc_A6B8: add ax, 0FFD0h les bx, [bp+arg_0] mov es:[bx], ax - dec _cutscene_script_ptr + dec _script_p leave retn 4 ; --------------------------------------------------------------------------- @@ -879,10 +878,10 @@ arg_0 = dword ptr 4 push bp mov bp, sp - mov bx, _cutscene_script_ptr + mov bx, _script_p cmp byte ptr [bx], ',' jnz short loc_A72E - inc _cutscene_script_ptr + inc _script_p pushd [bp+arg_0] call sub_A64D pop bp @@ -891,7 +890,7 @@ arg_0 = dword ptr 4 loc_A72E: les bx, [bp+arg_0] - mov ax, word_124C4 + mov ax, _script_number_param_default mov es:[bx], ax pop bp retn 4 @@ -905,21 +904,21 @@ sub_A713 endp sub_A73B proc near push bp mov bp, sp - add point_124BC.x, 16 - cmp point_124BC.x, 560 + add _cursor.x, GLYPH_FULL_W + cmp _cursor.x, BOX_RIGHT jl short loc_A78D - add point_124BC.y, 16 - mov point_124BC.x, 144 - cmp point_124BC.y, 384 + add _cursor.y, GLYPH_H + mov _cursor.x, (BOX_LEFT + NAME_W) + cmp _cursor.y, BOX_BOTTOM jl short loc_A78D call sub_A815 - cmp byte_1247E, 0 + cmp _fast_forward, 0 jnz short loc_A76F call input_wait_for_change pascal, 0 loc_A76F: - mov point_124BC.x, 80 - mov point_124BC.y, 320 + mov _cursor.x, BOX_LEFT + mov _cursor.y, BOX_TOP graph_accesspage 1 call sub_A59E graph_accesspage 0 @@ -944,7 +943,7 @@ sub_A815 proc near mov bp, sp push si call @egc_start_copy_1$qv - cmp byte_1247E, 0 + cmp _fast_forward, 0 jnz short loc_A83A xor si, si jmp short loc_A835 @@ -952,7 +951,7 @@ sub_A815 proc near loc_A827: call @box_1_to_0_masked$q10box_mask_t pascal, si - push word_124C0 + push _text_interval call frame_delay inc si @@ -1007,35 +1006,35 @@ loc_A876: jmp word ptr cs:[bx+20h] ; switch jump loc_A87A: - add point_124BC.y, 16 ; jumptable 0000A876 case 110 - mov point_124BC.x, 80 - cmp point_124BC.y, 384 + add _cursor.y, GLYPH_H ; jumptable 0000A876 case 110 + mov _cursor.x, BOX_LEFT + cmp _cursor.y, BOX_BOTTOM jl loc_ADB5 ; default loc_A88F: - mov bx, _cutscene_script_ptr ; jumptable 0000A876 case 115 + mov bx, _script_p ; jumptable 0000A876 case 115 mov al, [bx] mov [bp+arg_0], al call sub_A815 cmp [bp+arg_0], '-' jz short loc_A8C0 - mov word_124C4, 0 + mov _script_number_param_default, 0 push ss lea ax, [bp+var_2] push ax call sub_A64D - cmp byte_1247E, 0 + cmp _fast_forward, 0 jnz short loc_A8C4 call input_wait_for_change pascal, [bp+var_2] jmp short loc_A8C4 ; --------------------------------------------------------------------------- loc_A8C0: - inc _cutscene_script_ptr + inc _script_p loc_A8C4: - mov point_124BC.x, 80 - mov point_124BC.y, 320 + mov _cursor.x, BOX_LEFT + mov _cursor.y, BOX_TOP graph_accesspage 1 call sub_A59E graph_accesspage 0 @@ -1044,18 +1043,18 @@ loc_A8C4: ; --------------------------------------------------------------------------- loc_A8E5: - mov word_124C4, 0Fh ; jumptable 0000A876 case 99 + mov _script_number_param_default, V_WHITE ; jumptable 0000A876 case 99 push ss lea ax, [bp+var_2] push ax call sub_A64D mov al, byte ptr [bp+var_2] - mov col_124C2, al + mov _text_col, al jmp loc_ADB5 ; default ; --------------------------------------------------------------------------- loc_A8FC: - mov word_124C4, 2 ; jumptable 0000A876 case 98 + mov _script_number_param_default, WEIGHT_BOLD ; jumptable 0000A876 case 98 push ss lea ax, [bp+var_2] push ax @@ -1066,7 +1065,7 @@ loc_A8FC: ; --------------------------------------------------------------------------- loc_A913: - mov bx, _cutscene_script_ptr ; jumptable 0000A876 case 119 + mov bx, _script_p ; jumptable 0000A876 case 119 mov al, [bx] mov ah, 0 push ax ; ch @@ -1079,8 +1078,8 @@ loc_A913: jnz short loc_A95F loc_A931: - inc _cutscene_script_ptr - mov word_124C4, 1 + inc _script_p + mov _script_number_param_default, 1 push ss lea ax, [bp+var_2] push ax @@ -1100,19 +1099,19 @@ loc_A954: loc_A95F: call sub_A815 - mov word_124C4, 40h + mov _script_number_param_default, 64 cmp [bp+arg_0], 'm' jz short loc_A994 cmp [bp+arg_0], 'k' jnz short loc_A978 - inc _cutscene_script_ptr + inc _script_p loc_A978: push ss lea ax, [bp+var_2] push ax call sub_A64D - cmp byte_1247E, 0 + cmp _fast_forward, 0 jnz loc_ADB5 ; default push [bp+var_2] call frame_delay @@ -1120,13 +1119,13 @@ loc_A978: ; --------------------------------------------------------------------------- loc_A994: - inc _cutscene_script_ptr - mov bx, _cutscene_script_ptr + inc _script_p + mov bx, _script_p mov al, [bx] mov [bp+arg_0], al cmp [bp+arg_0], 'k' jnz short loc_A9AB - inc _cutscene_script_ptr + inc _script_p loc_A9AB: push ss @@ -1137,7 +1136,7 @@ loc_A9AB: lea ax, [bp+var_4] push ax call sub_A713 - cmp byte_1247E, 0 + cmp _fast_forward, 0 jnz loc_ADB5 ; default push [bp+var_2] push [bp+var_4] @@ -1146,22 +1145,22 @@ loc_A9AB: ; --------------------------------------------------------------------------- loc_A9D2: - mov bx, _cutscene_script_ptr ; jumptable 0000A876 case 118 + mov bx, _script_p ; jumptable 0000A876 case 118 cmp byte ptr [bx], 'p' jz short loc_A9F2 - mov word_124C4, 1 + mov _script_number_param_default, 1 push ss lea ax, [bp+var_2] push ax call sub_A64D mov ax, [bp+var_2] - mov word_124C0, ax + mov _text_interval, ax jmp loc_ADB5 ; default ; --------------------------------------------------------------------------- loc_A9F2: - inc _cutscene_script_ptr - mov word_124C4, 0 + inc _script_p + mov _script_number_param_default, 0 push ss lea ax, [bp+var_2] push ax @@ -1171,12 +1170,12 @@ loc_A9F2: ; --------------------------------------------------------------------------- loc_AA0E: - mov word_124C4, 64h ; 'd' ; jumptable 0000A876 case 116 + mov _script_number_param_default, 100 ; jumptable 0000A876 case 116 push ss lea ax, [bp+var_2] push ax call sub_A64D - cmp byte_1247E, 0 + cmp _fast_forward, 0 jnz short loc_AA2A push 1 call frame_delay @@ -1189,7 +1188,7 @@ loc_AA2A: ; --------------------------------------------------------------------------- loc_AA38: - mov bx, _cutscene_script_ptr ; jumptable 0000A876 case 102 + mov bx, _script_p ; jumptable 0000A876 case 102 mov al, [bx] mov [bp+arg_0], al cmp [bp+arg_0], 'm' @@ -1200,8 +1199,8 @@ loc_AA38: jnz loc_ADB5 ; default loc_AA55: - inc _cutscene_script_ptr - mov word_124C4, 1 + inc _script_p + mov _script_number_param_default, 1 push ss lea ax, [bp+var_2] push ax @@ -1220,8 +1219,8 @@ loc_AA78: ; --------------------------------------------------------------------------- loc_AA83: - inc _cutscene_script_ptr - mov word_124C4, 1 + inc _script_p + mov _script_number_param_default, 1 push ss lea ax, [bp+var_2] push ax @@ -1233,10 +1232,10 @@ loc_AA83: ; --------------------------------------------------------------------------- loc_AA9F: - mov bx, _cutscene_script_ptr ; jumptable 0000A876 case 103 + mov bx, _script_p ; jumptable 0000A876 case 103 cmp byte ptr [bx], 'a' jz short loc_AAF2 - mov word_124C4, 8 + mov _script_number_param_default, 8 push ss lea ax, [bp+var_2] push ax @@ -1257,7 +1256,7 @@ loc_AAC7: loc_AACA: call graph_scrollup - cmp byte_1247E, 0 + cmp _fast_forward, 0 jnz short loc_AADD push 1 call frame_delay @@ -1274,17 +1273,17 @@ loc_AAE0: ; --------------------------------------------------------------------------- loc_AAF2: - inc _cutscene_script_ptr - mov word_124C4, 0 + inc _script_p + mov _script_number_param_default, 0 push ss lea ax, [bp+var_2] push ax call sub_A64D graph_accesspage 1 - push point_124BC.x - push point_124BC.y + push _cursor.x + push _cursor.y push [bp+var_2] - mov al, col_124C2 + mov al, _text_col mov ah, 0 push ax call graph_gaiji_putc @@ -1293,12 +1292,12 @@ loc_AAF2: ; --------------------------------------------------------------------------- loc_AB26: - mov word_124C4, 0 ; jumptable 0000A876 case 107 + mov _script_number_param_default, 0 ; jumptable 0000A876 case 107 push ss lea ax, [bp+var_2] push ax call sub_A64D - cmp byte_1247E, 0 + cmp _fast_forward, 0 jnz loc_ADB5 ; default call input_wait_for_change pascal, [bp+var_2] jmp loc_AD2B @@ -1313,10 +1312,10 @@ loc_AB48: ; --------------------------------------------------------------------------- loc_AB61: - mov bx, _cutscene_script_ptr ; jumptable 0000A876 case 112 + mov bx, _script_p ; jumptable 0000A876 case 112 mov al, [bx] mov [bp+arg_0], al - inc _cutscene_script_ptr + inc _script_p cmp [bp+arg_0], '=' jz short loc_AB7A cmp [bp+arg_0], '@' @@ -1353,7 +1352,7 @@ loc_ABC1: loc_ABD1: cmp [bp+arg_0], ',' jz short loc_ABDE - dec _cutscene_script_ptr + dec _script_p jmp loc_ADB5 ; default ; --------------------------------------------------------------------------- @@ -1363,10 +1362,10 @@ loc_ABDE: ; --------------------------------------------------------------------------- loc_ABE5: - mov bx, _cutscene_script_ptr + mov bx, _script_p mov al, [bx] mov [bp+arg_0], al - inc _cutscene_script_ptr + inc _script_p mov ah, 0 mov bx, ax test (__ctype + 1)[bx], _IS_CTL @@ -1397,8 +1396,8 @@ loc_AC18: ; --------------------------------------------------------------------------- loc_AC3F: - mov word_124C4, 4 ; jumptable 0000A876 case 61 - mov bx, _cutscene_script_ptr + mov _script_number_param_default, 4 ; jumptable 0000A876 case 61 + mov bx, _script_p mov al, [bx] mov [bp+arg_0], al cmp [bp+arg_0], '=' @@ -1422,12 +1421,12 @@ loc_AC70: ; --------------------------------------------------------------------------- loc_AC94: - inc _cutscene_script_ptr + inc _script_p push ss lea ax, [bp+var_2] push ax call sub_A64D - mov word_124C4, 1 + mov _script_number_param_default, 1 push ss lea ax, [bp+var_4] push ax @@ -1441,7 +1440,7 @@ loc_ACB2: push [bp+var_2] push si call sub_A37F - cmp byte_1247E, 0 + cmp _fast_forward, 0 jnz short loc_ACCE push [bp+var_4] call frame_delay @@ -1468,12 +1467,12 @@ loc_ACFF: ; --------------------------------------------------------------------------- loc_AD02: - mov bx, _cutscene_script_ptr ; jumptable 0000A876 case 109 + mov bx, _script_p ; jumptable 0000A876 case 109 mov al, [bx] mov [bp+arg_0], al cmp [bp+arg_0], '$' jnz short loc_AD1A - inc _cutscene_script_ptr + inc _script_p push (KAJA_SONG_STOP shl 8) jmp short loc_AD26 ; --------------------------------------------------------------------------- @@ -1481,7 +1480,7 @@ loc_AD02: loc_AD1A: cmp [bp+arg_0], '*' jnz short loc_AD2E - inc _cutscene_script_ptr + inc _script_p loc_AD24: push (KAJA_SONG_PLAY shl 8) @@ -1503,16 +1502,16 @@ loc_AD2E: db 085h db 07fh db 000h - inc _cutscene_script_ptr + inc _script_p mov [bp+var_2], 0 jmp short loc_AD6E ; --------------------------------------------------------------------------- loc_AD41: - mov bx, _cutscene_script_ptr + mov bx, _script_p mov al, [bx] mov [bp+arg_0], al - inc _cutscene_script_ptr + inc _script_p mov ah, 0 mov bx, ax test (__ctype + 1)[bx], _IS_CTL @@ -1601,30 +1600,30 @@ var_1 = byte ptr -1 enter 6, 0 mov word ptr [bp+var_6+2], ds mov word ptr [bp+var_6], offset asc_EB84 - mov point_124BC.x, 80 - mov point_124BC.y, 320 - mov word_124C0, 1 - mov col_124C2, V_WHITE + mov _cursor.x, BOX_LEFT + mov _cursor.y, BOX_TOP + mov _text_interval, 1 + mov _text_col, V_WHITE mov _graph_putsa_fx_func, FX_WEIGHT_BOLD call sub_A4AE - mov byte_1247E, 0 + mov _fast_forward, 0 loc_AE2D: call far ptr _input_reset_sense test _key_det.hi, high INPUT_CANCEL jz short loc_AE40 - mov byte_1247E, 1 + mov _fast_forward, 1 jmp short loc_AE45 ; --------------------------------------------------------------------------- loc_AE40: - mov byte_1247E, 0 + mov _fast_forward, 0 loc_AE45: - mov bx, _cutscene_script_ptr + mov bx, _script_p mov al, [bx] mov [bp+var_1], al - inc _cutscene_script_ptr + inc _script_p mov ah, 0 mov bx, ax test (__ctype + 1)[bx], _IS_CTL @@ -1633,10 +1632,10 @@ loc_AE45: jz short loc_AE2D cmp [bp+var_1], '\' jnz short loc_AE82 - mov bx, _cutscene_script_ptr + mov bx, _script_p mov al, [bx] mov [bp+var_1], al - inc _cutscene_script_ptr + inc _script_p push word ptr [bp+var_1] call sub_A847 cmp al, -1 @@ -1648,17 +1647,17 @@ loc_AE82: les bx, [bp+var_6] mov al, [bp+var_1] mov es:[bx], al - mov bx, _cutscene_script_ptr + mov bx, _script_p mov al, [bx] mov [bp+var_1], al mov bx, word ptr [bp+var_6] mov es:[bx+1], al - inc _cutscene_script_ptr + inc _script_p graph_showpage 0 graph_accesspage 1 - push point_124BC.x - push point_124BC.y - mov al, col_124C2 + push _cursor.x + push _cursor.y + mov al, _text_col mov ah, 0 push ax push word ptr [bp+var_6+2] @@ -4665,7 +4664,7 @@ include th03/snd/se_state[data].asm include th04/hardware/bgimage[data].asm include th03/formats/cdg[data].asm include th03/formats/pi_put_masked[data].asm -include th04/cutscene/box[data].asm +include th03/cutscene/cutscene[data].asm asc_EB84 db ' ', 0 even aSff1_pi db 'sff1.pi',0 @@ -4752,15 +4751,7 @@ include th02/snd/load[bss].asm include th04/mem[bss].asm include th04/hardware/input[bss].asm include th04/formats/cdg[bss].asm -include th04/cutscene/cutscene[bss].asm -dword_1247A dd ? -byte_1247E db ? - db 61 dup(?) -point_124BC Point -word_124C0 dw ? -col_124C2 db ? - db ? ; -word_124C4 dw ? +include th03/cutscene/cutscene[bss].asm byte_124C6 db ? angle_124C7 db ? fp_124C8 dw ? diff --git a/th05/maine011.cpp b/th05/maine011.cpp index 4d1f3026..c76eb8ec 100644 --- a/th05/maine011.cpp +++ b/th05/maine011.cpp @@ -6,7 +6,6 @@ #pragma option -zCmaine_01_TEXT #include "th04/cutscene/box.cpp" -#include "shiftjis.hpp" /// String-to-color map /// ------------------- @@ -15,18 +14,13 @@ static const int COLMAP_COUNT = 8; -typedef struct { - shiftjis_kanji_t kanji; - int8_t padding[4]; // Might have been originally meant for full strings? -} colmap_key_t; - typedef struct { uint4_t values[COLMAP_COUNT]; - colmap_key_t keys[COLMAP_COUNT]; + + // Might have been originally meant for a complete character name? + shiftjis_kanji_t keys[COLMAP_COUNT][NAME_KANJI_LEN]; } colmap_t; extern colmap_t colmap; extern unsigned char colmap_count; /// ------------------- - -extern unsigned char text_col; diff --git a/th05_maine.asm b/th05_maine.asm index d6d945a7..fde2b2e0 100644 --- a/th05_maine.asm +++ b/th05_maine.asm @@ -324,9 +324,9 @@ arg_0 = dword ptr 4 loc_A6AD: call file_size mov [bp+var_2], ax - mov _cutscene_script_ptr, offset _cutscene_script + mov _script_p, offset _script push ds - push _cutscene_script_ptr + push _script_p push ax call file_read call file_close @@ -380,26 +380,26 @@ var_1 = byte ptr -1 arg_0 = dword ptr 4 enter 2, 0 - mov bx, _cutscene_script_ptr + mov bx, _script_p mov cl, [bx] - inc _cutscene_script_ptr - mov bx, _cutscene_script_ptr + inc _script_p + mov bx, _script_p mov al, [bx] mov [bp+var_1], al - inc _cutscene_script_ptr - mov bx, _cutscene_script_ptr + inc _script_p + mov bx, _script_p mov al, [bx] mov [bp+var_2], al - inc _cutscene_script_ptr + inc _script_p mov al, cl mov ah, 0 mov bx, ax test (__ctype + 1)[bx], _IS_DIG jnz short loc_A77F les bx, [bp+arg_0] - mov ax, word_1500C + mov ax, _script_number_param_default mov es:[bx], ax - sub _cutscene_script_ptr, 3 + sub _script_p, 3 leave retn 4 ; --------------------------------------------------------------------------- @@ -415,7 +415,7 @@ loc_A77F: add ax, 0FFD0h les bx, [bp+arg_0] mov es:[bx], ax - sub _cutscene_script_ptr, 2 + sub _script_p, 2 leave retn 4 ; --------------------------------------------------------------------------- @@ -436,7 +436,7 @@ loc_A7A3: add ax, 0FFD0h les bx, [bp+arg_0] mov es:[bx], ax - dec _cutscene_script_ptr + dec _script_p leave retn 4 ; --------------------------------------------------------------------------- @@ -472,12 +472,12 @@ arg_0 = dword ptr 4 push bp mov bp, sp - mov bx, _cutscene_script_ptr + mov bx, _script_p cmp byte ptr [bx], ',' loc_A808: jnz short loc_A819 - inc _cutscene_script_ptr + inc _script_p pushd [bp+arg_0] call sub_A738 pop bp @@ -486,7 +486,7 @@ loc_A808: loc_A819: les bx, [bp+arg_0] - mov ax, word_1500C + mov ax, _script_number_param_default mov es:[bx], ax pop bp retn 4 @@ -500,22 +500,22 @@ sub_A7FE endp sub_A826 proc near push bp mov bp, sp - add point_15004.x, 16 - cmp point_15004.x, 560 + add _cursor.x, GLYPH_FULL_W + cmp _cursor.x, BOX_RIGHT jl short loc_A864 - add point_15004.y, 16 - mov point_15004.x, 144 - cmp point_15004.y, 384 + add _cursor.y, GLYPH_H + mov _cursor.x, (BOX_LEFT + NAME_W) + cmp _cursor.y, BOX_BOTTOM jl short loc_A864 call sub_A8EC - cmp byte_14F8E, 0 + cmp _fast_forward, 0 jnz short loc_A858 push 0 call sub_A92B loc_A858: - mov point_15004.x, 80 - mov point_15004.y, 320 + mov _cursor.x, BOX_LEFT + mov _cursor.y, BOX_TOP loc_A864: pop bp @@ -537,7 +537,7 @@ sub_A8EC proc near push si graph_accesspage 0 call @egc_start_copy_1$qv - cmp byte_14F8E, 0 + cmp _fast_forward, 0 jnz short loc_A917 xor si, si jmp short loc_A912 @@ -545,7 +545,7 @@ sub_A8EC proc near loc_A904: call @box_1_to_0_masked$q10box_mask_t pascal, si - push word_15008 + push _text_interval call frame_delay inc si @@ -600,7 +600,7 @@ loc_A95C: loc_A962: call _input_reset_sense_held - call bgimage_put_rect pascal, 576, point_15004.y, (16 shl 16) or 16 + call bgimage_put_rect pascal, 576, _cursor.y, (GLYPH_FULL_W shl 16) or GLYPH_H or si, si jle short loc_A9BD test _key_det.hi, high INPUT_OK @@ -610,7 +610,7 @@ loc_A962: test _key_det.hi, high INPUT_CANCEL jnz short loc_A9BD push 576 - push point_15004.y + push _cursor.y mov ax, di shr ax, 3 and ax, ga_RETURN_KEY_CELS - 1 @@ -640,17 +640,6 @@ sub_A92B endp ; =============== S U B R O U T I N E ======================================= ; Attributes: bp-based frame -COLMAP_COUNT = 8 - -colmap_key_t struc - CMK_kanji dw ? - db 4 dup (?) -colmap_key_t ends - -colmap_t struc - CM_values db COLMAP_COUNT dup (?) - CM_keys colmap_key_t COLMAP_COUNT dup () -colmap_t ends sub_A9C3 proc near @@ -686,24 +675,24 @@ loc_A9F2: jmp word ptr cs:[bx+20h] ; switch jump loc_A9F6: - add point_15004.y, 16 ; jumptable 0000A9F2 case 110 - mov point_15004.x, 80 - cmp point_15004.y, 384 + add _cursor.y, GLYPH_FULL_W ; jumptable 0000A9F2 case 110 + mov _cursor.x, BOX_LEFT + cmp _cursor.y, BOX_BOTTOM jl loc_AF8F ; default loc_AA0B: - mov bx, _cutscene_script_ptr ; jumptable 0000A9F2 case 115 + mov bx, _script_p ; jumptable 0000A9F2 case 115 mov al, [bx] mov [bp+arg_0], al call sub_A8EC cmp [bp+arg_0], '-' jz short loc_AA3A - mov word_1500C, 0 + mov _script_number_param_default, 0 push ss lea ax, [bp+var_2] push ax call sub_A738 - cmp byte_14F8E, 0 + cmp _fast_forward, 0 jnz short loc_AA3E push [bp+var_2] call sub_A92B @@ -711,13 +700,13 @@ loc_AA0B: ; --------------------------------------------------------------------------- loc_AA3A: - inc _cutscene_script_ptr + inc _script_p loc_AA3E: - mov point_15004.x, 80 - mov point_15004.y, 320 + mov _cursor.x, BOX_LEFT + mov _cursor.y, BOX_TOP graph_accesspage 1 - call bgimage_put_rect pascal, (80 shl 16) or 320, (480 shl 16) or 64 + call bgimage_put_rect pascal, (BOX_LEFT shl 16) or BOX_TOP, (BOX_W shl 16) or BOX_H mov dx, 166 ; Port 00A6h: Page access register mov al, 0 @@ -727,7 +716,7 @@ loc_AA66: ; --------------------------------------------------------------------------- loc_AA6A: - mov bx, _cutscene_script_ptr ; jumptable 0000A9F2 case 99 + mov bx, _script_p ; jumptable 0000A9F2 case 99 mov al, [bx] mov ah, 0 push ax ; ch @@ -736,7 +725,7 @@ loc_AA6A: mov [bp+arg_0], al cmp [bp+arg_0], '=' jz @@colmap_add - mov word_1500C, 0Fh + mov _script_number_param_default, 15 push ss lea ax, [bp+var_2] push ax @@ -747,7 +736,7 @@ loc_AA6A: ; --------------------------------------------------------------------------- loc_AA9B: - mov word_1500C, 2 ; jumptable 0000A9F2 case 98 + mov _script_number_param_default, WEIGHT_BOLD ; jumptable 0000A9F2 case 98 push ss lea ax, [bp+var_2] push ax @@ -758,7 +747,7 @@ loc_AA9B: ; --------------------------------------------------------------------------- loc_AAB2: - mov bx, _cutscene_script_ptr ; jumptable 0000A9F2 case 119 + mov bx, _script_p ; jumptable 0000A9F2 case 119 mov al, [bx] mov ah, 0 push ax ; ch @@ -771,8 +760,8 @@ loc_AAB2: jnz short loc_AAFE loc_AAD0: - inc _cutscene_script_ptr - mov word_1500C, 1 + inc _script_p + mov _script_number_param_default, 1 push ss lea ax, [bp+var_2] push ax @@ -792,19 +781,19 @@ loc_AAF3: loc_AAFE: call sub_A8EC - mov word_1500C, 40h + mov _script_number_param_default, 64 cmp [bp+arg_0], 'm' jz short loc_AB33 cmp [bp+arg_0], 'k' jnz short loc_AB17 - inc _cutscene_script_ptr + inc _script_p loc_AB17: push ss lea ax, [bp+var_2] push ax call sub_A738 - cmp byte_14F8E, 0 + cmp _fast_forward, 0 jnz loc_AF8F ; default push [bp+var_2] call frame_delay @@ -812,13 +801,13 @@ loc_AB17: ; --------------------------------------------------------------------------- loc_AB33: - inc _cutscene_script_ptr - mov bx, _cutscene_script_ptr + inc _script_p + mov bx, _script_p mov al, [bx] mov [bp+arg_0], al cmp [bp+arg_0], 'k' jnz short loc_AB4A - inc _cutscene_script_ptr + inc _script_p loc_AB4A: push ss @@ -829,29 +818,29 @@ loc_AB4A: lea ax, [bp+var_4] push ax call sub_A7FE - cmp byte_14F8E, 0 + cmp _fast_forward, 0 jnz loc_AF8F ; default call snd_delay_until_measure pascal, [bp+var_2], [bp+var_4] jmp loc_AF8F ; default ; --------------------------------------------------------------------------- loc_AB71: - mov bx, _cutscene_script_ptr ; jumptable 0000A9F2 case 118 + mov bx, _script_p ; jumptable 0000A9F2 case 118 cmp byte ptr [bx], 'p' jz short loc_AB91 - mov word_1500C, 2 + mov _script_number_param_default, 2 push ss lea ax, [bp+var_2] push ax call sub_A738 mov ax, [bp+var_2] - mov word_15008, ax + mov _text_interval, ax jmp loc_AF8F ; default ; --------------------------------------------------------------------------- loc_AB91: - inc _cutscene_script_ptr - mov word_1500C, 0 + inc _script_p + mov _script_number_param_default, 0 push ss lea ax, [bp+var_2] push ax @@ -862,12 +851,12 @@ loc_AB91: ; --------------------------------------------------------------------------- loc_ABAC: - mov word_1500C, 64h ; 'd' ; jumptable 0000A9F2 case 116 + mov _script_number_param_default, 100 ; jumptable 0000A9F2 case 116 push ss lea ax, [bp+var_2] push ax call sub_A738 - cmp byte_14F8E, 0 + cmp _fast_forward, 0 jnz short loc_ABC8 push 1 call frame_delay @@ -880,7 +869,7 @@ loc_ABC8: ; --------------------------------------------------------------------------- loc_ABD6: - mov bx, _cutscene_script_ptr ; jumptable 0000A9F2 case 102 + mov bx, _script_p ; jumptable 0000A9F2 case 102 mov al, [bx] mov [bp+arg_0], al cmp [bp+arg_0], 'm' @@ -891,8 +880,8 @@ loc_ABD6: jnz loc_AF8F ; default loc_ABF3: - inc _cutscene_script_ptr - mov word_1500C, 1 + inc _script_p + mov _script_number_param_default, 1 push ss lea ax, [bp+var_2] push ax @@ -911,8 +900,8 @@ loc_AC16: ; --------------------------------------------------------------------------- loc_AC21: - inc _cutscene_script_ptr - mov word_1500C, 1 + inc _script_p + mov _script_number_param_default, 1 push ss lea ax, [bp+var_2] push ax @@ -924,7 +913,7 @@ loc_AC21: ; --------------------------------------------------------------------------- loc_AC3D: - mov word_1500C, 8 ; jumptable 0000A9F2 case 103 + mov _script_number_param_default, 8 ; jumptable 0000A9F2 case 103 push ss lea ax, [bp+var_2] push ax @@ -945,7 +934,7 @@ loc_AC5C: loc_AC5F: call graph_scrollup - cmp byte_14F8E, 0 + cmp _fast_forward, 0 jnz short loc_AC72 push 1 call frame_delay @@ -963,12 +952,12 @@ loc_AC75: loc_AC87: call sub_A8EC ; jumptable 0000A9F2 case 107 - mov word_1500C, 0 + mov _script_number_param_default, 0 push ss lea ax, [bp+var_2] push ax call sub_A738 - cmp byte_14F8E, 0 + cmp _fast_forward, 0 jnz loc_AF8F ; default push [bp+var_2] call sub_A92B @@ -985,10 +974,10 @@ loc_ACAA: ; --------------------------------------------------------------------------- loc_ACC8: - mov bx, _cutscene_script_ptr ; jumptable 0000A9F2 case 112 + mov bx, _script_p ; jumptable 0000A9F2 case 112 mov al, [bx] mov [bp+arg_0], al - inc _cutscene_script_ptr + inc _script_p cmp [bp+arg_0], '=' jz short loc_ACE1 cmp [bp+arg_0], 40h @@ -1025,7 +1014,7 @@ loc_AD23: loc_AD33: cmp [bp+arg_0], 2Ch ; ',' jz short loc_AD40 - dec _cutscene_script_ptr + dec _script_p jmp loc_AF8F ; default ; --------------------------------------------------------------------------- @@ -1035,10 +1024,10 @@ loc_AD40: ; --------------------------------------------------------------------------- loc_AD47: - mov bx, _cutscene_script_ptr + mov bx, _script_p mov al, [bx] mov [bp+arg_0], al - inc _cutscene_script_ptr + inc _script_p mov ah, 0 mov bx, ax test (__ctype + 1)[bx], _IS_CTL @@ -1071,8 +1060,8 @@ loc_AD7A: ; --------------------------------------------------------------------------- loc_AD9A: - mov word_1500C, 4 ; jumptable 0000A9F2 case 61 - mov bx, _cutscene_script_ptr + mov _script_number_param_default, 4 ; jumptable 0000A9F2 case 61 + mov bx, _script_p mov al, [bx] mov [bp+arg_0], al cmp [bp+arg_0], '=' @@ -1099,12 +1088,12 @@ loc_ADE3: ; --------------------------------------------------------------------------- loc_AE07: - inc _cutscene_script_ptr + inc _script_p push ss lea ax, [bp+var_2] push ax call sub_A738 - mov word_1500C, 1 + mov _script_number_param_default, 1 push ss loc_AE1A: @@ -1120,7 +1109,7 @@ loc_AE25: push [bp+var_2] push si call sub_A705 - cmp byte_14F8E, 0 + cmp _fast_forward, 0 jnz short loc_AE41 push [bp+var_4] call frame_delay @@ -1142,12 +1131,12 @@ loc_AE64: ; --------------------------------------------------------------------------- loc_AE78: - mov bx, _cutscene_script_ptr ; jumptable 0000A9F2 case 109 + mov bx, _script_p ; jumptable 0000A9F2 case 109 mov al, [bx] mov [bp+arg_0], al cmp [bp+arg_0], '$' jnz short loc_AE96 - inc _cutscene_script_ptr + inc _script_p kajacall KAJA_SONG_STOP jmp loc_AF8F ; default ; --------------------------------------------------------------------------- @@ -1155,7 +1144,7 @@ loc_AE78: loc_AE96: cmp [bp+arg_0], '*' jnz short loc_AEAA - inc _cutscene_script_ptr + inc _script_p kajacall KAJA_SONG_PLAY jmp loc_AF8F ; default ; --------------------------------------------------------------------------- @@ -1163,16 +1152,16 @@ loc_AE96: loc_AEAA: cmp [bp+arg_0], ',' jnz loc_AF8F ; default - inc _cutscene_script_ptr + inc _script_p mov [bp+var_2], 0 jmp short loc_AEEA ; --------------------------------------------------------------------------- loc_AEBD: - mov bx, _cutscene_script_ptr + mov bx, _script_p mov al, [bx] mov [bp+arg_0], al - inc _cutscene_script_ptr + inc _script_p mov ah, 0 mov bx, ax test (__ctype + 1)[bx], _IS_CTL @@ -1218,24 +1207,24 @@ loc_AF18: ; --------------------------------------------------------------------------- @@colmap_add: - inc _cutscene_script_ptr + inc _script_p mov al, _colmap_count mov ah, 0 - imul ax, size colmap_key_t - mov bx, _cutscene_script_ptr + imul ax, NAME_LEN + mov bx, _script_p mov dl, [bx] mov bx, ax - mov byte ptr (_colmap.CM_keys[bx].CMK_kanji + 0), dl - inc _cutscene_script_ptr + mov byte ptr (_colmap.CM_keys[bx] + 0), dl + inc _script_p mov al, _colmap_count mov ah, 0 - imul ax, size colmap_key_t - mov bx, _cutscene_script_ptr + imul ax, NAME_LEN + mov bx, _script_p mov dl, [bx] mov bx, ax - mov byte ptr (_colmap.CM_keys[bx].CMK_kanji + 1), dl - add _cutscene_script_ptr, 2 - mov word_1500C, 0Fh + mov byte ptr (_colmap.CM_keys[bx] + 1), dl + add _script_p, 2 + mov _script_number_param_default, 15 push ss lea ax, [bp+var_2] push ax @@ -1300,30 +1289,30 @@ var_3 = word ptr -3 push si mov word ptr [bp+@@str+2], ds mov word ptr [bp+@@str], offset asc_1085A - mov point_15004.x, 80 - mov point_15004.y, 320 - mov word_15008, 2 + mov _cursor.x, BOX_LEFT + mov _cursor.y, BOX_TOP + mov _text_interval, 2 mov _text_col, V_WHITE mov _graph_putsa_fx_func, FX_WEIGHT_BOLD - mov byte_14F8E, 0 + mov _fast_forward, 0 loc_B005: call _input_reset_sense_held test _key_det.hi, high INPUT_CANCEL jz short loc_B018 - mov byte_14F8E, 1 + mov _fast_forward, 1 jmp short loc_B01D ; --------------------------------------------------------------------------- loc_B018: - mov byte_14F8E, 0 + mov _fast_forward, 0 loc_B01D: xor si, si - mov bx, _cutscene_script_ptr + mov bx, _script_p mov al, [bx] mov byte ptr [bp+var_3], al - inc _cutscene_script_ptr + inc _script_p mov ah, 0 mov bx, ax test (__ctype + 1)[bx], _IS_CTL @@ -1332,10 +1321,10 @@ loc_B01D: jz short loc_B005 cmp byte ptr [bp+var_3], '\' jnz short loc_B05D - mov bx, _cutscene_script_ptr + mov bx, _script_p mov al, [bx] mov byte ptr [bp+var_3], al - inc _cutscene_script_ptr + inc _script_p push [bp+var_3] call sub_A9C3 cmp al, -1 @@ -1346,14 +1335,14 @@ loc_B01D: loc_B05D: cmp byte ptr [bp+var_3], '@' jnz loc_B118 - mov bx, _cutscene_script_ptr + mov bx, _script_p mov al, [bx] mov ah, 0 push ax ; ch call _tolower pop cx mov byte ptr [bp+var_3], al - inc _cutscene_script_ptr + inc _script_p mov ah, 0 mov [bp+var_A], ax mov cx, 4 ; switch 4 cases @@ -1387,10 +1376,10 @@ loc_B0A7: ; --------------------------------------------------------------------------- loc_B0AE: - mov bx, _cutscene_script_ptr ; jumptable 0000B095 case 33 + mov bx, _script_p ; jumptable 0000B095 case 33 mov al, [bx] mov byte ptr [bp+var_3], al - inc _cutscene_script_ptr + inc _script_p mov ah, 0 cmp ax, '!' jz short loc_B0C9 @@ -1410,14 +1399,14 @@ loc_B0D0: ; --------------------------------------------------------------------------- loc_B0D7: - dec _cutscene_script_ptr + dec _script_p mov [bp+@@ch], 7 jmp short loc_B0F4 ; --------------------------------------------------------------------------- loc_B0E2: - dec _cutscene_script_ptr ; default - mov word_1500C, 3 + dec _script_p ; default + mov _script_number_param_default, 3 push ss lea ax, [bp+@@ch] push ax @@ -1426,8 +1415,8 @@ loc_B0E2: loc_B0F4: graph_showpage 0 graph_accesspage 1 - push point_15004.x - push point_15004.y + push _cursor.x + push _cursor.y push [bp+@@ch] mov al, _text_col mov ah, 0 @@ -1440,13 +1429,13 @@ loc_B118: les bx, [bp+@@str] mov al, byte ptr [bp+var_3] mov es:[bx], al - mov bx, _cutscene_script_ptr + mov bx, _script_p mov al, [bx] mov byte ptr [bp+var_3], al mov bx, word ptr [bp+@@str] mov es:[bx+1], al - inc _cutscene_script_ptr - cmp point_15004.x, 80 + inc _script_p + cmp _cursor.x, 80 jnz short loc_B164 xor si, si jmp short @@colmap_more? @@ -1454,8 +1443,8 @@ loc_B118: @@colmap_loop: mov bx, si - imul bx, size colmap_key_t - mov ax, _colmap.CM_keys[bx].CMK_kanji + imul bx, NAME_LEN + mov ax, _colmap.CM_keys[bx] les bx, [bp+@@str] cmp ax, es:[bx] jnz short @@colmap_next @@ -1476,8 +1465,8 @@ loc_B118: loc_B164: graph_showpage 0 graph_accesspage 1 - push point_15004.x - push point_15004.y + push _cursor.x + push _cursor.y mov al, _text_col mov ah, 0 push ax @@ -7601,10 +7590,7 @@ include th03/formats/pi_put_masked[data].asm include th05/formats/pi_buffers[bss].asm include th05/hardware/vram_planes[data].asm include th03/formats/cdg[data].asm -public _colmap_count -_colmap_count db 0 - evendata -include th04/cutscene/box[data].asm +include th03/cutscene/cutscene[data].asm asc_1085A db ' ', 0 even byte_1085E db 0 @@ -7886,19 +7872,7 @@ include th04/hardware/input[bss].asm include th04/formats/cdg[bss].asm include libs/master.lib/pfint21[bss].asm include th04/hardware/egcrect[bss].asm -include th04/cutscene/cutscene[bss].asm - db 4 dup(?) -byte_14F8E db ? - db 60 dup(?) -public _colmap -_colmap colmap_t - evendata -point_15004 Point -word_15008 dw ? -public _text_col -_text_col db ? - db ? -word_1500C dw ? +include th03/cutscene/cutscene[bss].asm measure_1500E dw ? word_15010 dw ? word_15012 dw ?