mirror of https://github.com/nmlgc/ReC98.git
[Decompilation] [th02] Dialog: Box rendering
Part of P0260, funded by Yanga.
This commit is contained in:
parent
f2b7f78012
commit
c468e2a113
|
@ -12,6 +12,23 @@
|
|||
#include "th02/main/player/player.hpp"
|
||||
#include "th02/sprites/main_pat.h"
|
||||
|
||||
// Coordinates
|
||||
// -----------
|
||||
|
||||
static const pixel_t BOX_W = PLAYFIELD_W;
|
||||
static const pixel_t BOX_H = (
|
||||
(DIALOG_BOX_PART_H / 2) +
|
||||
(DIALOG_BOX_LINES * GLYPH_H) +
|
||||
(DIALOG_BOX_PART_H / 2)
|
||||
);
|
||||
|
||||
static const pixel_t BOX_MIDDLE_W = (
|
||||
BOX_W - DIALOG_BOX_LEFT_W - DIALOG_BOX_PART_W
|
||||
);
|
||||
|
||||
static const pixel_t BOX_SLIDE_SPEED = (PLAYFIELD_W / 24);
|
||||
// -----------
|
||||
|
||||
// State
|
||||
// -----
|
||||
|
||||
|
@ -86,3 +103,61 @@ void near dialog_put_player(void)
|
|||
|
||||
#undef option_left_topleft
|
||||
}
|
||||
|
||||
void pascal near dialog_box_put_top_and_bottom_part(
|
||||
screen_x_t& left,
|
||||
vram_y_t top_top,
|
||||
vram_y_t bottom_top,
|
||||
int top_patnum // ACTUAL TYPE: main_patnum_t
|
||||
)
|
||||
{
|
||||
enum {
|
||||
PATNUM_TO_BOTTOM = (
|
||||
PAT_DIALOG_BOX_LEFT_BOTTOM - PAT_DIALOG_BOX_LEFT_TOP
|
||||
),
|
||||
};
|
||||
|
||||
// Assuming the constant slide speed, these are the last coordinates where
|
||||
// the box part wouldn't be fully covered by black TRAM cells.
|
||||
// ZUN bloat: Using the playfield_clip_left*() and playfield_clip_right*()
|
||||
// functions would have been cleaner and more consistent.
|
||||
static_assert(BOX_SLIDE_SPEED == (DIALOG_BOX_PART_W / 2));
|
||||
if(
|
||||
(left >= (PLAYFIELD_LEFT - BOX_SLIDE_SPEED)) &&
|
||||
(left <= (PLAYFIELD_RIGHT - BOX_SLIDE_SPEED))
|
||||
) {
|
||||
static_assert(BOX_H == (DIALOG_BOX_PART_H * 2));
|
||||
static_assert(
|
||||
(PAT_DIALOG_BOX_MIDDLE_BOTTOM - PAT_DIALOG_BOX_MIDDLE_TOP) ==
|
||||
PATNUM_TO_BOTTOM
|
||||
);
|
||||
static_assert(
|
||||
(PAT_DIALOG_BOX_RIGHT_BOTTOM - PAT_DIALOG_BOX_RIGHT_TOP) ==
|
||||
PATNUM_TO_BOTTOM
|
||||
);
|
||||
super_roll_put(left, top_top, (top_patnum + 0));
|
||||
super_roll_put(left, bottom_top, (top_patnum + PATNUM_TO_BOTTOM));
|
||||
}
|
||||
left += DIALOG_BOX_PART_W;
|
||||
}
|
||||
|
||||
// ZUN bloat: Passing [left] by reference made sense in the function above, but
|
||||
// here it doesn't.
|
||||
void pascal near dialog_box_put(
|
||||
screen_x_t& left, vram_y_t top_top, vram_y_t bottom_top
|
||||
)
|
||||
{
|
||||
int i;
|
||||
|
||||
for(i = PAT_DIALOG_BOX_LEFT_TOP; i < PAT_DIALOG_BOX_MIDDLE_TOP; i++) {
|
||||
dialog_box_put_top_and_bottom_part(left, top_top, bottom_top, i);
|
||||
}
|
||||
for(i = 0; i < (BOX_MIDDLE_W / DIALOG_BOX_PART_W); i++) {
|
||||
dialog_box_put_top_and_bottom_part(
|
||||
left, top_top, bottom_top, PAT_DIALOG_BOX_MIDDLE_TOP
|
||||
);
|
||||
}
|
||||
dialog_box_put_top_and_bottom_part(
|
||||
left, top_top, bottom_top, PAT_DIALOG_BOX_RIGHT_TOP
|
||||
);
|
||||
}
|
||||
|
|
|
@ -1,5 +1,16 @@
|
|||
#define MISS_ANIM_CELS 6
|
||||
|
||||
/// Sprite sizes
|
||||
/// ------------
|
||||
|
||||
#define DIALOG_BOX_PART_W 32
|
||||
#define DIALOG_BOX_PART_H 32
|
||||
|
||||
#define DIALOG_BOX_LEFT_W 96
|
||||
|
||||
#define DIALOG_BOX_LEFT_PARTS (DIALOG_BOX_LEFT_W / DIALOG_BOX_PART_W)
|
||||
/// ------------
|
||||
|
||||
/// Stage-independent pattern numbers for the super_*() functions
|
||||
/// -------------------------------------------------------------
|
||||
typedef enum {
|
||||
|
@ -11,6 +22,22 @@ typedef enum {
|
|||
PAT_PLAYCHAR_MISS,
|
||||
PAT_PLAYCHAR_MISS_last = (PAT_PLAYCHAR_MISS + MISS_ANIM_CELS - 1),
|
||||
// --------
|
||||
// miko32.bft
|
||||
// ----------
|
||||
PAT_DIALOG_BOX_LEFT_TOP = 34,
|
||||
PAT_DIALOG_BOX_LEFT_TOP_last = (
|
||||
PAT_DIALOG_BOX_LEFT_TOP + DIALOG_BOX_LEFT_PARTS - 1
|
||||
),
|
||||
PAT_DIALOG_BOX_MIDDLE_TOP,
|
||||
PAT_DIALOG_BOX_RIGHT_TOP,
|
||||
|
||||
PAT_DIALOG_BOX_LEFT_BOTTOM = 42,
|
||||
PAT_DIALOG_BOX_LEFT_BOTTOM_last = (
|
||||
PAT_DIALOG_BOX_LEFT_BOTTOM + DIALOG_BOX_LEFT_PARTS - 1
|
||||
),
|
||||
PAT_DIALOG_BOX_MIDDLE_BOTTOM,
|
||||
PAT_DIALOG_BOX_RIGHT_BOTTOM,
|
||||
// ----------
|
||||
// miko16.bft
|
||||
// ----------
|
||||
PAT_ITEM_POWER = 68,
|
||||
|
|
114
th02_main.asm
114
th02_main.asm
|
@ -12370,104 +12370,12 @@ sub_12B9E endp
|
|||
extern @dialog_load_and_init$qv:proc
|
||||
@egc_start_copy_2$qv procdesc pascal near
|
||||
@dialog_put_player$qv procdesc near
|
||||
@DIALOG_BOX_PUT$QMIII procdesc pascal near \
|
||||
left:dword, top_top:word, bottom_top:word
|
||||
DIALOG_TEXT ends
|
||||
|
||||
main_03__TEXT segment byte public 'CODE' use16
|
||||
|
||||
; =============== S U B R O U T I N E =======================================
|
||||
|
||||
; Attributes: bp-based frame
|
||||
|
||||
sub_12D56 proc near
|
||||
|
||||
arg_0 = word ptr 4
|
||||
arg_2 = word ptr 6
|
||||
@@y = word ptr 8
|
||||
arg_6 = dword ptr 0Ah
|
||||
|
||||
push bp
|
||||
mov bp, sp
|
||||
push si
|
||||
mov si, [bp+arg_0]
|
||||
les bx, [bp+arg_6]
|
||||
cmp word ptr es:[bx], 16
|
||||
jl short loc_12D8B
|
||||
cmp word ptr es:[bx], 400
|
||||
jg short loc_12D8B
|
||||
call super_roll_put pascal, word ptr es:[bx], [bp+@@y], si
|
||||
les bx, [bp+arg_6]
|
||||
push word ptr es:[bx]
|
||||
push [bp+arg_2]
|
||||
lea ax, [si+8]
|
||||
push ax
|
||||
call super_roll_put
|
||||
|
||||
loc_12D8B:
|
||||
les bx, [bp+arg_6]
|
||||
add word ptr es:[bx], 20h ; ' '
|
||||
pop si
|
||||
pop bp
|
||||
retn 0Ah
|
||||
sub_12D56 endp
|
||||
|
||||
|
||||
; =============== S U B R O U T I N E =======================================
|
||||
|
||||
; Attributes: bp-based frame
|
||||
|
||||
sub_12D97 proc near
|
||||
|
||||
arg_0 = word ptr 4
|
||||
arg_2 = word ptr 6
|
||||
arg_4 = dword ptr 8
|
||||
|
||||
push bp
|
||||
mov bp, sp
|
||||
push si
|
||||
push di
|
||||
mov di, [bp+arg_2]
|
||||
mov si, 22h ; '"'
|
||||
jmp short loc_12DB1
|
||||
; ---------------------------------------------------------------------------
|
||||
|
||||
loc_12DA4:
|
||||
pushd [bp+arg_4]
|
||||
push di
|
||||
push [bp+arg_0]
|
||||
push si
|
||||
call sub_12D56
|
||||
inc si
|
||||
|
||||
loc_12DB1:
|
||||
cmp si, 25h ; '%'
|
||||
jl short loc_12DA4
|
||||
xor si, si
|
||||
jmp short loc_12DC8
|
||||
; ---------------------------------------------------------------------------
|
||||
|
||||
loc_12DBA:
|
||||
pushd [bp+arg_4]
|
||||
push di
|
||||
push [bp+arg_0]
|
||||
push 25h ; '%'
|
||||
call sub_12D56
|
||||
inc si
|
||||
|
||||
loc_12DC8:
|
||||
cmp si, 8
|
||||
jl short loc_12DBA
|
||||
pushd [bp+arg_4]
|
||||
push di
|
||||
push [bp+arg_0]
|
||||
push 26h ; '&'
|
||||
call sub_12D56
|
||||
pop di
|
||||
pop si
|
||||
pop bp
|
||||
retn 8
|
||||
sub_12D97 endp
|
||||
|
||||
|
||||
; =============== S U B R O U T I N E =======================================
|
||||
|
||||
; Attributes: bp-based frame
|
||||
|
@ -12475,7 +12383,7 @@ sub_12D97 endp
|
|||
sub_12DE0 proc near
|
||||
|
||||
var_4 = word ptr -4
|
||||
var_2 = word ptr -2
|
||||
@@left = word ptr -2
|
||||
|
||||
enter 4, 0
|
||||
push si
|
||||
|
@ -12522,7 +12430,7 @@ loc_12E48:
|
|||
loc_12E4F:
|
||||
sub [bp+var_4], 10h
|
||||
mov ax, [bp+var_4]
|
||||
mov [bp+var_2], ax
|
||||
mov [bp+@@left], ax
|
||||
call frame_delay pascal, 1
|
||||
call @egc_start_copy_2$qv
|
||||
call @tiles_invalidate_rect$qiiii pascal, (32 shl 16) or 320, (384 shl 16) or 80
|
||||
|
@ -12530,11 +12438,11 @@ loc_12E4F:
|
|||
call egc_off
|
||||
call @dialog_put_player$qv
|
||||
push ss
|
||||
lea ax, [bp+var_2]
|
||||
lea ax, [bp+@@left]
|
||||
push ax
|
||||
push si
|
||||
push di
|
||||
call sub_12D97
|
||||
call @dialog_box_put$qmiii
|
||||
|
||||
loc_12E8B:
|
||||
cmp [bp+var_4], 20h ; ' '
|
||||
|
@ -12553,7 +12461,7 @@ sub_12DE0 endp
|
|||
sub_12E95 proc near
|
||||
|
||||
var_4 = word ptr -4
|
||||
var_2 = word ptr -2
|
||||
@@left = word ptr -2
|
||||
|
||||
enter 4, 0
|
||||
push si
|
||||
|
@ -12578,7 +12486,7 @@ loc_12EC0:
|
|||
loc_12EC5:
|
||||
sub [bp+var_4], 10h
|
||||
mov ax, [bp+var_4]
|
||||
mov [bp+var_2], ax
|
||||
mov [bp+@@left], ax
|
||||
call frame_delay pascal, 1
|
||||
call @egc_start_copy_2$qv
|
||||
call @tiles_invalidate_rect$qiiii pascal, (32 shl 16) or 320, (384 shl 16) or 80
|
||||
|
@ -12586,12 +12494,12 @@ loc_12EC5:
|
|||
call egc_off
|
||||
call @dialog_put_player$qv
|
||||
push ss
|
||||
lea ax, [bp+var_2]
|
||||
lea ax, [bp+@@left]
|
||||
push ax
|
||||
push si
|
||||
push di
|
||||
call sub_12D97
|
||||
cmp [bp+var_2], 30h ; '0'
|
||||
call @dialog_box_put$qmiii
|
||||
cmp [bp+@@left], 48
|
||||
jge short loc_12EC5
|
||||
cmp byte_24E7B, 1
|
||||
jnz short loc_12F18
|
||||
|
|
Loading…
Reference in New Issue