Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[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.
- Loading branch information
Showing
10 changed files
with
553 additions
and
502 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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; | ||
// ----- |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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<dots16_t>* 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; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 ? |
6 changes: 6 additions & 0 deletions
6
th04/cutscene/box[data].asm → th03/cutscene/cutscene[data].asm
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.