2023-10-11 00:45:19 +00:00
|
|
|
|
/// Internal dialog code, shared between TH04 and TH05
|
|
|
|
|
/// --------------------------------------------------
|
|
|
|
|
|
2023-10-15 00:26:32 +00:00
|
|
|
|
#include <stddef.h>
|
2023-10-11 00:45:19 +00:00
|
|
|
|
#include "platform.h"
|
2023-10-15 01:26:54 +00:00
|
|
|
|
#include "x86real.h"
|
2023-10-11 00:45:19 +00:00
|
|
|
|
#include "pc98.h"
|
|
|
|
|
#include "planar.h"
|
2023-10-15 00:26:32 +00:00
|
|
|
|
#include "master.hpp"
|
|
|
|
|
#include "th01/math/subpixel.hpp"
|
|
|
|
|
extern "C" {
|
|
|
|
|
#include "th02/hardware/frmdelay.h"
|
|
|
|
|
#include "th02/hardware/pages.hpp"
|
|
|
|
|
#include "th02/formats/tile.hpp"
|
|
|
|
|
#include "th03/formats/cdg.h"
|
|
|
|
|
}
|
|
|
|
|
#include "th04/common.h"
|
|
|
|
|
#if (GAME == 4)
|
|
|
|
|
#include "th04/playchar.h"
|
|
|
|
|
#include "th04/formats/map.hpp"
|
|
|
|
|
#include "th04/formats/std.hpp"
|
|
|
|
|
#endif
|
|
|
|
|
#include "th04/math/motion.hpp"
|
|
|
|
|
#include "th04/main/bg.hpp"
|
|
|
|
|
#include "th04/main/frames.h"
|
|
|
|
|
#include "th04/main/scroll.hpp"
|
|
|
|
|
#include "th04/main/phase.hpp"
|
2023-10-11 00:45:19 +00:00
|
|
|
|
#include "th04/main/playfld.hpp"
|
2023-10-15 00:26:32 +00:00
|
|
|
|
#include "th04/main/boss/boss.hpp"
|
|
|
|
|
#include "th04/main/hud/overlay.hpp"
|
|
|
|
|
#include "th04/main/stage/stage.hpp"
|
|
|
|
|
#include "th04/main/dialog/dialog.hpp"
|
2023-10-11 00:45:19 +00:00
|
|
|
|
#include "th04/sprites/main_cdg.h"
|
|
|
|
|
|
|
|
|
|
// A silly TH05 micro-optimization. Could have been 8-bit variables then.
|
|
|
|
|
#if (GAME == 5)
|
|
|
|
|
typedef tram_x_t dialog_x_t;
|
|
|
|
|
typedef tram_y_t dialog_y_t;
|
|
|
|
|
#else
|
|
|
|
|
typedef screen_x_t dialog_x_t;
|
|
|
|
|
typedef screen_y_t dialog_y_t;
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
extern struct {
|
|
|
|
|
dialog_x_t x;
|
|
|
|
|
dialog_y_t y;
|
|
|
|
|
} dialog_cursor;
|
|
|
|
|
|
|
|
|
|
enum dialog_side_t {
|
2023-10-15 22:45:35 +00:00
|
|
|
|
SIDE_PLAYCHAR = 0,
|
|
|
|
|
SIDE_BOSS = 1,
|
2023-10-11 00:45:19 +00:00
|
|
|
|
|
|
|
|
|
_dialog_side_t_FORCE_INT16 = 0x7FFF
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
extern dialog_side_t dialog_side;
|
|
|
|
|
|
|
|
|
|
// Metrics
|
|
|
|
|
// -------
|
|
|
|
|
|
2023-10-15 22:45:35 +00:00
|
|
|
|
static const pixel_t BOX_W = 320;
|
|
|
|
|
static const pixel_t BOX_H = 48;
|
2023-10-11 00:45:19 +00:00
|
|
|
|
|
2023-10-15 22:45:35 +00:00
|
|
|
|
static const pixel_t MARGIN = 16;
|
|
|
|
|
static const pixel_t TEXT_W = (PLAYFIELD_W - MARGIN - FACE_W);
|
2023-10-11 00:45:19 +00:00
|
|
|
|
|
2023-10-15 22:45:35 +00:00
|
|
|
|
static const screen_x_t TEXT_PLAYCHAR_LEFT = (
|
|
|
|
|
PLAYFIELD_RIGHT - MARGIN - TEXT_W
|
2023-10-11 00:45:19 +00:00
|
|
|
|
);
|
2023-10-15 22:45:35 +00:00
|
|
|
|
static const screen_y_t TEXT_PLAYCHAR_TOP = (PLAYFIELD_BOTTOM - MARGIN - BOX_H);
|
2023-10-11 00:45:19 +00:00
|
|
|
|
|
2023-10-15 22:45:35 +00:00
|
|
|
|
static const screen_x_t TEXT_BOSS_LEFT = (PLAYFIELD_LEFT + MARGIN);
|
|
|
|
|
static const screen_y_t TEXT_BOSS_TOP = (TEXT_PLAYCHAR_TOP - FACE_H);
|
2023-10-11 00:45:19 +00:00
|
|
|
|
// -------
|
|
|
|
|
|
|
|
|
|
// Restores the [FACE_W]×[FACE_H] pixels starting at (⌊left/8⌋*8, top) on the
|
|
|
|
|
// currently active VRAM page with the same pixels from the other VRAM page.
|
|
|
|
|
void pascal near dialog_face_unput_8(uscreen_x_t left, uvram_y_t top);
|
|
|
|
|
|
|
|
|
|
void pascal near dialog_box_fade_in();
|