[Maintenance] Declare distinct types for screen, VRAM, and TRAM coordinates

Whew, time to look at every `int` variable we ever declared! The best
moment to do this would have been a year ago, but well, better late
than never. No need to communicate that in comments anymore.

These shouldn't be used for widths, heights, or sprite-space
coordinates. Maybe we'll cover that another time, this commit is
already large enough.

Part of P0111, funded by [Anonymous] and Blue Bolt.
This commit is contained in:
nmlgc 2020-08-20 21:59:45 +02:00
parent 8b5c1463f6
commit 368f151759
104 changed files with 672 additions and 478 deletions

View File

@ -29,6 +29,11 @@
struct point_t {
int x, y;
};
struct screen_point_t {
screen_x_t x;
screen_y_t y;
};
// ---------------------
// Macros

28
pc98.h
View File

@ -2,6 +2,34 @@
// -----
// PC-98 hardware constants not covered by master.lib
/// Coordinate systems
/// ------------------
/// All of these are relative to the top-left corner of the final display.
/// MODDERS: Remove the unsigned varieties.
// Display-space coordinate, with [0; RES_X[ being the visible area.
typedef int screen_x_t;
typedef unsigned int uscreen_x_t;
// Display-space coordinate, with [0; RES_Y[ being the visible area. Does not
// care about 200- or 400-line graphics modes or vertical scrolling.
typedef int screen_y_t;
typedef unsigned int uscreen_y_t;
// VRAM X coordinate, ranging from 0 to (RES_X / BYTE_DOTS).
typedef int vram_x_t;
// VRAM Y coordinate, ranging from 0 to either 400 or 200 depending on the
// current graphics mode, and with an added vertical scrolling offset.
typedef int vram_y_t;
typedef unsigned int uvram_y_t;
// Text RAM X coordinate, ranging from 0 to (RES_X / GLYPH_HALF_W).
typedef int tram_x_t;
typedef unsigned int utram_x_t;
// Text RAM Y coordinate, ranging from 0 to (RES_Y / GLYPH_H).
typedef int tram_y_t;
typedef unsigned int utram_y_t;
/// ------------------
/// Text
/// ----
#define GAIJI_W 16

View File

@ -69,22 +69,22 @@ extern dots8_t *VRAM_PLANE_E;
#ifdef __cplusplus
// MODDERS: Replace with a single function
static inline unsigned int vram_offset_shift(int x, int y)
static inline unsigned int vram_offset_shift(screen_x_t x, vram_y_t y)
{
return VRAM_OFFSET_SHIFT(x, y);
}
static inline unsigned int vram_offset_muldiv(int x, int y)
static inline unsigned int vram_offset_muldiv(screen_x_t x, vram_y_t y)
{
return (y * ROW_SIZE) + (x / BYTE_DOTS);
}
static inline unsigned int vram_offset_divmul(int x, int y)
static inline unsigned int vram_offset_divmul(screen_x_t x, vram_y_t y)
{
return (x / BYTE_DOTS) + (y * ROW_SIZE);
}
static inline unsigned int vram_offset_mulshift(int x, int y)
static inline unsigned int vram_offset_mulshift(screen_x_t x, vram_y_t y)
{
return (y * ROW_SIZE) + (x >> 3);
}

View File

@ -14,8 +14,8 @@ void pascal end_pics_load_palette_show(const char *fn)
static const int PIC_W = (RES_X / 2);
static const int PIC_H = (RES_Y / 2);
static const int PIC_LEFT = ((RES_X / 2) - (PIC_W / 2));
static const int PIC_TOP = ((RES_Y / 2) - (PIC_H / 2));
static const screen_x_t PIC_LEFT = ((RES_X / 2) - (PIC_W / 2));
static const screen_y_t PIC_TOP = ((RES_Y / 2) - (PIC_H / 2));
static const int PIC_VRAM_W = (PIC_W / BYTE_DOTS);

View File

@ -1,4 +1,8 @@
// Types [len] half- (ank) or full-width (kanji) characters of [str] onto the
// given position in VRAM, with a frame delay between each character.
void pascal graph_type_ank(int left, int top, int len, const char *str);
void pascal graph_type_kanji(int left, int top, int len, const char *str);
void pascal graph_type_ank(
screen_x_t left, vram_y_t top, int len, const char *str
);
void pascal graph_type_kanji(
screen_x_t left, vram_y_t top, int len, const char *str
);

View File

@ -43,14 +43,14 @@ int grc_load(int slot, const char fn[PF_FN_LEN])
return 0;
}
void grc_put_8(int left, int top, int slot, int image, int col)
void grc_put_8(screen_x_t left, vram_y_t top, int slot, int image, int col)
{
int16_t vram_offset_row = vram_offset_shift(left, top);
int16_t vram_offset;
int16_t grc_y;
int16_t grc_x;
size_t grc_p = 0;
int16_t vram_y;
vram_y_t vram_y;
#define grc_slot grc_images[slot]
if(

View File

@ -34,5 +34,5 @@ void grc_free(int slot);
// Blits the sub[image] from the given [slot] to (⌊left/8⌋*8, top) with the
// given [col]. Correctly clips the sprite at all 4 edges of VRAM.
void grc_put_8(int left, int top, int slot, int image, int col);
void grc_put_8(screen_x_t left, vram_y_t top, int slot, int image, int col);
/// ------------------------------------------

View File

@ -102,7 +102,7 @@ void ptn_free(int slot)
}
}
void ptn_put_noalpha_8(int left, int top, int ptn_id)
void ptn_put_noalpha_8(screen_x_t left, vram_y_t top, int ptn_id)
{
unsigned int vram_offset = vram_offset_shift(left, top);
ptn_t *ptn = ptn_with_id(ptn_id);
@ -118,7 +118,9 @@ void ptn_put_noalpha_8(int left, int top, int ptn_id)
}
}
void ptn_put_quarter_noalpha_8(int left, int top, int ptn_id, int quarter)
void ptn_put_quarter_noalpha_8(
screen_x_t left, vram_y_t top, int ptn_id, int quarter
)
{
int y;
unsigned int vram_offset = vram_offset_muldiv(left, top);

View File

@ -95,23 +95,23 @@ extern bool ptn_unput_before_alpha_put;
// ------------
// Displays the given [ptn_id] at (⌊left/8⌋*8, top), disregarding its alpha
// plane.
void ptn_put_noalpha_8(int left, int top, int ptn_id);
void ptn_put_noalpha_8(screen_x_t left, vram_y_t top, int ptn_id);
// Overwrites the 4 color planes of [ptn_id] with the current VRAM content of
// the 32×32 pixels starting at (⌊left/8⌋*8, top).
void ptn_snap_8(int left, int top, int ptn_id);
void ptn_snap_8(screen_x_t left, vram_y_t top, int ptn_id);
// Copies the 32×32 pixels starting at (⌊left/8⌋*8, top) from VRAM page 0 to
// VRAM page 1.
void ptn_copy_8_0_to_1(int left, int top);
void ptn_copy_8_0_to_1(screen_x_t left, vram_y_t top);
// Restores the 32×32 pixels starting at (⌊left/8⌋*8, top) on VRAM page 0 with
// the same (background) pixels from VRAM page 1, applying the alpha mask from
// the given [ptn_id].
void ptn_unput_8(int left, int top, int ptn_id);
void ptn_unput_8(screen_x_t left, vram_y_t top, int ptn_id);
// Displays the given [ptn_id] at (⌊left/8⌋*8, top).
void ptn_put_8(int left, int top, int ptn_id);
void ptn_put_8(screen_x_t left, vram_y_t top, int ptn_id);
// ------------
// 16×16 access
@ -138,21 +138,29 @@ struct PTNQuarter
// Displays the given [quarter] of the given [ptn_id] at (⌊left/8⌋*8, top),
// diregarding its alpha plane.
void ptn_put_quarter_noalpha_8(int left, int top, int ptn_id, int quarter);
void ptn_put_quarter_noalpha_8(
screen_x_t left, vram_y_t top, int ptn_id, int quarter
);
// Overwrites the 4 color planes of the given [quarter] of [ptn_id] with the
// current VRAM content of the 16×16 pixels starting at (⌊left/8⌋*8, top).
void ptn_snap_quarter_8(int left, int top, int ptn_id, int quarter);
void ptn_snap_quarter_8(
screen_x_t left, vram_y_t top, int ptn_id, int quarter
);
// Restores the 16×16 pixels starting at (⌊left/8⌋*8, top) on VRAM page 0 with
// the same (background) pixels from VRAM page 1, applying the alpha mask from
// the given [quarter] of [ptn_id].
void ptn_unput_quarter_8(int left, int top, int ptn_id, int quarter);
void ptn_unput_quarter_8(
screen_x_t left, vram_y_t top, int ptn_id, int quarter
);
// Displays the given [quarter] of the given [ptn_id] at (⌊left/8⌋*8, top).
void ptn_put_quarter_8(int left, int top, int ptn_id, int quarter);
void ptn_put_quarter_8(
screen_x_t left, vram_y_t top, int ptn_id, int quarter
);
// Displays the given [quarter] of the given [ptn_id] at (left, top).
void ptn_put_quarter(int left, int top, int ptn_id, int quarter);
void ptn_put_quarter(screen_x_t left, vram_y_t top, int ptn_id, int quarter);
// ------------
/// -----------------------------------------

View File

@ -1,6 +1,6 @@
#include "th01/formats/ptn.hpp"
void ptn_copy_8_0_to_1(int left, int top)
void ptn_copy_8_0_to_1(screen_x_t left, vram_y_t top)
{
planar_t(PTN_W) row;
unsigned int vram_offset = vram_offset_shift(left, top);

View File

@ -30,7 +30,7 @@ static inline ptn_t* ptn_with_id_shift(int id)
VRAM_CHUNK(G, vram_offset, w) |= ((ptn->planes.G[y] >> q.x) & mask); \
VRAM_CHUNK(E, vram_offset, w) |= ((ptn->planes.E[y] >> q.x) & mask);
void ptn_unput_8(int left, int top, int ptn_id)
void ptn_unput_8(screen_x_t left, vram_y_t top, int ptn_id)
{
ptn_dots_t mask = 0;
uint16_t vram_offset = vram_offset_shift(left, top);
@ -57,7 +57,7 @@ void ptn_unput_8(int left, int top, int ptn_id)
}
}
void ptn_put_8(int left, int top, int ptn_id)
void ptn_put_8(screen_x_t left, vram_y_t top, int ptn_id)
{
unsigned int y;
dots_t(PTN_W) mask = 0;
@ -80,7 +80,9 @@ void ptn_put_8(int left, int top, int ptn_id)
}
}
void ptn_unput_quarter_8(int left, int top, int ptn_id, int quarter)
void ptn_unput_quarter_8(
screen_x_t left, vram_y_t top, int ptn_id, int quarter
)
{
sdots_t(PTN_QUARTER_W) mask;
unsigned int y;
@ -109,7 +111,7 @@ void ptn_unput_quarter_8(int left, int top, int ptn_id, int quarter)
}
}
void ptn_put_quarter_8(int left, int top, int ptn_id, int quarter)
void ptn_put_quarter_8(screen_x_t left, vram_y_t top, int ptn_id, int quarter)
{
sdots_t(PTN_QUARTER_W) mask;
unsigned int y;
@ -134,7 +136,7 @@ void ptn_put_quarter_8(int left, int top, int ptn_id, int quarter)
}
}
void ptn_put_quarter(int left, int top, int ptn_id, int quarter)
void ptn_put_quarter(screen_x_t left, vram_y_t top, int ptn_id, int quarter)
{
union dots16_unaligned_t {
dots8_t d8[3];

View File

@ -1,6 +1,6 @@
extern "C" {
void ptn_snap_8(int left, int top, int ptn_id)
void ptn_snap_8(screen_x_t left, vram_y_t top, int ptn_id)
{
unsigned int vram_offset = vram_offset_muldiv(left, top);
ptn_t *ptn = ptn_with_id(ptn_id);
@ -21,7 +21,9 @@ static inline ptn_dots_t dot_mask(int x, int w)
return static_cast<ptn_dots_t>((1u << w) - 1u) << (w - x);
}
void ptn_snap_quarter_8(int left, int top, int ptn_id, int quarter)
void ptn_snap_quarter_8(
screen_x_t left, vram_y_t top, int ptn_id, int quarter
)
{
int y;
unsigned int vram_offset = vram_offset_muldiv(left, top);

View File

@ -98,7 +98,9 @@ void pascal grp_palette_white_in(unsigned int frames)
#pragma option -O-
void pascal graph_type_ank(int left, int top, int len, const char *str)
void pascal graph_type_ank(
screen_x_t left, vram_y_t top, int len, const char *str
)
{
extern const char graph_type_ank_fmt[];
for(int i = 0; i < len; i++) {
@ -110,7 +112,9 @@ void pascal graph_type_ank(int left, int top, int len, const char *str)
}
}
void pascal graph_type_kanji(int left, int top, int len, const char *str)
void pascal graph_type_kanji(
screen_x_t left, vram_y_t top, int len, const char *str
)
{
extern const char graph_type_kanji_fmt[];
for(int i = 0; i < len; i++) {

View File

@ -2,4 +2,4 @@
// Blits the rectangle from (⌊x/16⌋*16, y) to (⌈((x + w)/16)*16⌉, (y + h))
// from VRAM page 1 to the same position on VRAM page 0.
void DEFCONV egc_copy_rect_1_to_0_16(int x, int y, int w, int h);
void DEFCONV egc_copy_rect_1_to_0_16(screen_x_t x, vram_y_t y, int w, int h);

View File

@ -1,11 +1,11 @@
#include "th01/hardware/egcscopy.c"
void egc_copy_rect_1_to_0_16(int x, int y, int w, int h)
void egc_copy_rect_1_to_0_16(screen_x_t x, vram_y_t y, int w, int h)
{
register int x_end = x;
register int x_floor = x_end;
register screen_x_t x_end = x;
register screen_x_t x_floor = x_end;
int row;
int col;
screen_x_t col;
int row_p;
dots16_t dots;
int p;

View File

@ -265,7 +265,7 @@ void graph_copy_page_back_to_front(void)
Planes_declare(p);
page_t page_front = (page_back ^ 1);
for(int y = 0; y < RES_Y; y++) {
for(screen_y_t y = 0; y < RES_Y; y++) {
PlanarRow_blit(tmp, p, ROW_SIZE);
graph_accesspage(page_front);
PlanarRow_blit(p, tmp, ROW_SIZE);
@ -364,14 +364,14 @@ void z_palette_show(void)
#define VRAM_SBYTE(plane, offset) \
*reinterpret_cast<sdots8_t *>(MK_FP(SEG_PLANE_##plane, offset))
void z_grcg_pset(int x, int y, int col)
void z_grcg_pset(screen_x_t x, vram_y_t y, int col)
{
grcg_setcolor_rmw(col);
VRAM_SBYTE(B, vram_offset_mulshift(x, y)) = (0x80 >> (x & (BYTE_DOTS - 1)));
grcg_off_func();
}
int z_graph_readdot(int x, int y)
int z_graph_readdot(screen_x_t x, vram_y_t y)
{
int ret;
int16_t vram_offset = vram_offset_mulshift(x, y);
@ -404,7 +404,7 @@ extern bool graph_r_unput;
// Not used for purely horizontal lines.
extern dots16_t graph_r_pattern;
void graph_r_hline(int left, int right, int y, int col)
void graph_r_hline(screen_x_t left, screen_x_t right, vram_y_t y, int col)
{
int x;
int full_bytes_to_put;
@ -445,9 +445,9 @@ void graph_r_hline(int left, int right, int y, int col)
}
}
void graph_r_vline(int x, int top, int bottom, int col)
void graph_r_vline(screen_x_t x, vram_y_t top, vram_y_t bottom, int col)
{
int y;
vram_y_t y;
int order_tmp;
dots16_t pattern;
int vram_row_offset;
@ -476,7 +476,9 @@ void graph_r_vline(int x, int top, int bottom, int col)
grcg_off_func();
}
void graph_r_line_unput(int left, int top, int right, int bottom)
void graph_r_line_unput(
screen_x_t left, vram_y_t top, screen_x_t right, vram_y_t bottom
)
{
graph_r_unput = true;
graph_r_line(left, top, right, bottom, 7);
@ -484,7 +486,12 @@ void graph_r_line_unput(int left, int top, int right, int bottom)
}
void graph_r_line_patterned(
int left, int top, int right, int bottom, int col, dots16_t pattern
screen_x_t left,
vram_y_t top,
screen_x_t right,
vram_y_t bottom,
int col,
dots16_t pattern
)
{
graph_r_pattern = pattern;
@ -492,16 +499,24 @@ void graph_r_line_patterned(
graph_r_pattern = 0x80;
}
void graph_r_line(int left, int top, int right, int bottom, int col)
void graph_r_line(
screen_x_t left,
vram_y_t top,
screen_x_t right,
vram_y_t bottom,
int col
)
{
register int vram_offset;
int i;
int x_cur, y_cur;
screen_x_t x_cur;
vram_y_t y_cur;
int w, h;
int error;
int y_direction;
int order_tmp;
int x_vram, y_vram;
vram_x_t x_vram;
vram_y_t y_vram;
dots16_t pixels;
planar32_t page1;
@ -628,10 +643,16 @@ end:
}
/// -----------------------
void z_grcg_boxfill(int left, int top, int right, int bottom, int col)
void z_grcg_boxfill(
screen_x_t left,
vram_y_t top,
screen_x_t right,
vram_y_t bottom,
int col
)
{
int x;
int y;
vram_y_t y;
int full_bytes_to_put;
int order_tmp;
dots8_t left_pixels;
@ -664,7 +685,13 @@ void z_grcg_boxfill(int left, int top, int right, int bottom, int col)
grcg_off_func();
}
void graph_r_box(int left, int top, int right, int bottom, int col)
void graph_r_box(
screen_x_t left,
vram_y_t top,
screen_x_t right,
vram_y_t bottom,
int col
)
{
graph_r_hline(left, right, top, col);
graph_r_vline(left, top, bottom, col);
@ -699,9 +726,11 @@ int text_extent_fx(int fx, const unsigned char *str)
#include "th01/hardware/grppsafx.cpp"
void graph_putsa_fx(int left, int top, int fx, const unsigned char *str)
void graph_putsa_fx(
screen_x_t left, vram_y_t top, int fx, const unsigned char *str
)
{
register int x = left;
register screen_x_t x = left;
uint16_t codepoint;
dots16_t glyph_row;
unsigned char far *vram;
@ -756,7 +785,7 @@ void graph_putsa_fx(int left, int top, int fx, const unsigned char *str)
}
void graph_copy_byterect_back_to_front(
int left, int top, int right, int bottom
screen_x_t left, vram_y_t top, screen_x_t right, vram_y_t bottom
)
{
int w = (right - left) / BYTE_DOTS;
@ -777,8 +806,12 @@ void graph_copy_byterect_back_to_front(
}
void graph_move_byterect_interpage(
int src_left, int src_top, int src_right, int src_bottom,
int dst_left, int dst_top,
screen_x_t src_left,
vram_y_t src_top,
screen_x_t src_right,
vram_y_t src_bottom,
screen_x_t dst_left,
vram_y_t dst_top,
int src, int dst
)
{

View File

@ -35,36 +35,49 @@ void grcg_off_func(void);
#undef grcg_off
#define grcg_off grcg_off_func
void z_grcg_boxfill(int left, int top, int right, int bottom, int col);
void z_grcg_boxfill(
screen_x_t left, vram_y_t top, screen_x_t right, vram_y_t bottom, int col
);
/// ----
/// Points
/// ------
void z_grcg_pset(int x, int y, int col);
void z_grcg_pset(screen_x_t x, vram_y_t y, int col);
// Returns the color value at the given point on the current VRAM page.
int z_graph_readdot(int x, int y);
int z_graph_readdot(screen_x_t x, vram_y_t y);
/// ------
/// Restorable line drawing
/// -----------------------
// Draws straight horizontal or vertical lines.
void graph_r_hline(int left, int right, int y, int col);
void graph_r_vline(int x, int top, int bottom, int col);
void graph_r_hline(screen_x_t left, screen_x_t right, vram_y_t y, int col);
void graph_r_vline(screen_x_t x, vram_y_t top, vram_y_t bottom, int col);
// Draws a line with an arbitrary angle between the two points.
void graph_r_line(int left, int top, int right, int bottom, int col);
void graph_r_line(
screen_x_t left, vram_y_t top, screen_x_t right, vram_y_t bottom, int col
);
// Draws a line with an arbitrary angle and an arbitrary 16-pixel pattern
// between the two points.
void graph_r_line_patterned(
int left, int top, int right, int bottom, int col, dots16_t pattern
screen_x_t left,
vram_y_t top,
screen_x_t right,
vram_y_t bottom,
int col,
dots16_t pattern
);
// Recovers the pixels on the given arbitrary-angle line from page 1.
void graph_r_line_unput(int left, int top, int right, int bottom);
void graph_r_line_unput(
screen_x_t left, vram_y_t top, screen_x_t right, vram_y_t bottom
);
// Draws the outline of a rectangle.
void graph_r_box(int left, int top, int right, int bottom, int col);
void graph_r_box(
screen_x_t left, vram_y_t top, screen_x_t right, vram_y_t bottom, int col
);
/// -----------------------
/// Text
@ -82,7 +95,9 @@ int text_extent_fx(int fx, const unsigned char *str);
#define FX_REVERSE 0x800
// ----------------------
#include "th01/hardware/grppsafx.h"
void graph_printf_fx(int left, int top, int fx, const char *fmt, ...);
void graph_printf_fx(
screen_x_t left, vram_y_t top, int fx, const char *fmt, ...
);
// Puts the rightmost N [digits] of [num] onto the graphics RAM, using
// full-width digits, and applying the given effect. (Consequently, the units
@ -91,7 +106,7 @@ void graph_printf_fx(int left, int top, int fx, const char *fmt, ...);
// only blits the digits of [num] that differ from those in [num_prev].
// Will put nothing if [put_leading_zeroes] is false and [num] is 0.
void graph_putfwnum_fx(
int left, int top, int fx, int digits,
screen_x_t left, vram_y_t top, int fx, int digits,
long num, long num_prev, bool16 put_leading_zeroes
);
/// ----
@ -104,7 +119,7 @@ void graph_putfwnum_fx(
// (⌊left/8⌋*8 + ⌊(right-left)/8⌋*8, bottom)
// on the current back page to the same position on the current front page.
void graph_copy_byterect_back_to_front(
int left, int top, int right, int bottom
screen_x_t left, vram_y_t top, screen_x_t right, vram_y_t bottom
);
// Moves the given source rectangle from
@ -113,8 +128,12 @@ void graph_copy_byterect_back_to_front(
// (⌊left/8⌋*8 + ⌊(right-left)/8⌋*8, bottom)
// on the [dst] page. Already assumes [src] to be the currently accessed page.
void graph_move_byterect_interpage(
int src_left, int src_top, int src_right, int src_bottom,
int dst_left, int dst_top,
screen_x_t src_left,
vram_y_t src_top,
screen_x_t src_right,
vram_y_t src_bottom,
screen_x_t dst_left,
vram_y_t dst_top,
int src, int dst
);
/// --------

View File

@ -18,8 +18,8 @@ void scale_2x(dots32_t &dst32, sdots16_t src16)
}
void graph_2xscale_byterect_1_to_0_slow(
int left_0, int top_0,
int left_1, int top_1, int w_1, int h_1
screen_x_t left_0, vram_y_t top_0,
screen_x_t left_1, vram_y_t top_1, int w_1, int h_1
)
{
int row_p1 = vram_offset_divmul(left_1, top_1);

View File

@ -5,6 +5,6 @@
// (⌊left_0/8⌋*8, top_0) - (⌊left_1/8⌋*8 + ⌊w_1/16⌋*32, top_1 + h_1*2)
// on plane #0.
void graph_2xscale_byterect_1_to_0_slow(
int left_0, int top_0,
int left_1, int top_1, int w_1, int h_1
screen_x_t left_0, vram_y_t top_0,
screen_x_t left_1, vram_y_t top_1, int w_1, int h_1
);

View File

@ -5,7 +5,9 @@
#include "ReC98.h"
#include "th01/hardware/graph.h"
void graph_printf_fx(int left, int top, int fx, const char *fmt, ...)
void graph_printf_fx(
screen_x_t left, vram_y_t top, int fx, const char *fmt, ...
)
{
char str[256];
va_list ap;

View File

@ -2,10 +2,11 @@ struct hack { const char* NUM[10]; }; // XXX
extern const hack FULLWIDTH_NUMBERS;
void graph_putfwnum_fx(
int left, int top, int fx, int digits, long num, long num_prev, bool16 put
screen_x_t left, vram_y_t top, int fx, int digits,
long num, long num_prev, bool16 put
)
{
int x = left;
screen_x_t x = left;
int divisor_i;
int digit;
int digit_prev;

View File

@ -2,4 +2,6 @@
// the given effect.
#define FX(color, weight, spacing) \
((color) | (weight & 3) << 4 | (spacing & 7) << 6)
void graph_putsa_fx(int left, int top, int fx, const unsigned char *str);
void graph_putsa_fx(
screen_x_t left, vram_y_t top, int fx, const unsigned char *str
);

View File

@ -2,7 +2,7 @@ static const int GDC_ROW_SIZE = (ROW_SIZE / 2);
// Actually taken straight from the setgsta() example function from the
// PC-9801 Programmers' Bible, p. 150.
void z_vsync_wait_and_scrollup(int line_on_top)
void z_vsync_wait_and_scrollup(vram_y_t line_on_top)
{
line_on_top %= RES_Y;

View File

@ -1,4 +1,4 @@
// Waits until VSync, then sets the GDC's hardware scroll registers so that
// the given line will appear at the top of the screen for all subsequent
// frames.
void z_vsync_wait_and_scrollup(int line_on_top);
void z_vsync_wait_and_scrollup(vram_y_t line_on_top);

View File

@ -110,7 +110,7 @@ void z_text_locate(char x, char y)
int86(0xDC, &regs, &regs);
}
void z_text_putsa(int x, int y, int z_atrb, const char *str)
void z_text_putsa(tram_x_t x, tram_y_t y, int z_atrb, const char *str)
{
uint16_t codepoint;
int p = ((y * text_width()) + x) * 2;
@ -177,7 +177,7 @@ void z_text_putsa(int x, int y, int z_atrb, const char *str)
}
}
void z_text_vputsa(int x, int y, int z_atrb, const char *fmt, ...)
void z_text_vputsa(tram_x_t x, tram_y_t y, int z_atrb, const char *fmt, ...)
{
char str[256];
va_list ap;

View File

@ -9,12 +9,12 @@
#define TITLE_LEFT 48
#define TITLE_TOP 0
static const int TITLE_BACK_LEFT = 0;
static const int TITLE_BACK_TOP = (RES_Y - GLYPH_H);
static const screen_x_t TITLE_BACK_LEFT = 0;
static const screen_y_t TITLE_BACK_TOP = (RES_Y - GLYPH_H);
static const int TITLE_BACK_W = 288;
static const int TITLE_BACK_H = GLYPH_H;
static const int TITLE_BACK_RIGHT = (TITLE_BACK_LEFT + TITLE_BACK_W);
static const int TITLE_BACK_BOTTOM = (TITLE_BACK_TOP + TITLE_BACK_H);
static const screen_x_t TITLE_BACK_RIGHT = (TITLE_BACK_LEFT + TITLE_BACK_W);
static const screen_y_t TITLE_BACK_BOTTOM = (TITLE_BACK_TOP + TITLE_BACK_H);
/// Table
/// -----
@ -25,33 +25,33 @@ static const int TITLE_BACK_BOTTOM = (TITLE_BACK_TOP + TITLE_BACK_H);
#define table_row_top(place) (TABLE_BODY_TOP + (place * TABLE_ROW_H))
// Recursively defining column positions \o/
inline int table_left(int x_kanji) {
inline screen_x_t table_left(int x_kanji) {
return 32 + (x_kanji * GLYPH_FULL_W);
}
inline int table_place_left(int x_kanji) {
inline screen_x_t table_place_left(int x_kanji) {
return table_left(x_kanji);
}
inline int table_name_left(int x_kanji) {
inline screen_x_t table_name_left(int x_kanji) {
return table_place_left(7 + x_kanji);
}
inline int table_points_left(int x_kanji) {
inline screen_x_t table_points_left(int x_kanji) {
return table_name_left(SCOREDAT_NAME_KANJI + 5 + x_kanji);
}
inline int table_stage_route_left(int x_kanji) {
inline screen_x_t table_stage_route_left(int x_kanji) {
return table_points_left(SCORE_DIGITS + 3 + x_kanji);
}
inline int table_stage_left(int x_kanji) {
inline screen_x_t table_stage_left(int x_kanji) {
return table_stage_route_left(1 + x_kanji);
}
// Code generation actually prohibits this from being a Point!
extern int entered_name_left;
extern int entered_name_top;
extern screen_x_t entered_name_left;
extern screen_y_t entered_name_top;
/// -----
/// Alphabet
@ -173,7 +173,7 @@ void alphabet_put_initial()
alphabet_putsa_fx(NUM_TOP, i, fx, ALPHABET_ENTER); i++;
}
inline void header_cell_put(int left, const char str[])
inline void header_cell_put(screen_x_t left, const char str[])
{
graph_putsa_fx(left, TABLE_TOP, FX(COL_SELECTED, 3, 0), str);
}
@ -232,7 +232,7 @@ void regist_put_initial(
# define top table_row_top(i)
#else
int place_col = (i == entered_place) ? COL_SELECTED : COL_REGULAR;
int top = table_row_top(i);
vram_y_t top = table_row_top(i);
#endif
switch(i) {
@ -333,7 +333,7 @@ void regist_put_initial(
on_enter \
}
void alphabet_put_at(int left, int top, bool16 is_selected)
void alphabet_put_at(screen_x_t left, screen_y_t top, bool16 is_selected)
{
// Placement matters with -O-!
extern const char ALPHABET_SPACE_0[];
@ -372,8 +372,10 @@ void alphabet_put_at(int left, int top, bool16 is_selected)
name.byte[(pos * 2) + 1] = kanji_lo(kanji);
int regist_on_shot(
int left, int top,
scoredat_name_z_t& entered_name, int& entered_name_cursor
screen_x_t left,
screen_y_t top,
scoredat_name_z_t &entered_name,
int &entered_name_cursor
)
{
int16_t kanji = '\0';
@ -436,7 +438,7 @@ enum regist_input_ret_t {
#pragma option -b.
regist_input_ret_t regist_on_input(
int& left, int& top,
screen_x_t &left, screen_y_t &top,
scoredat_name_z_t& entered_name, int& entered_name_cursor
)
{
@ -590,8 +592,8 @@ void regist_name_enter(int entered_place)
{
scoredat_name_z_t entered_name;
regist_input_timeout_declare();
int left;
int top;
screen_x_t left;
screen_y_t top;
int entered_name_cursor;
int i;

View File

@ -14,7 +14,7 @@ extern bool bos_header_only;
/// ----------------
// Part of ZUN's attempt at clipping at the left or right edges of VRAM, by
// comparing [vram_offset] against the value returned from this function.
inline int16_t vram_intended_y_for(int16_t vram_offset, int first_x) {
inline vram_y_t vram_intended_y_for(int16_t vram_offset, screen_x_t first_x) {
return (first_x < 0)
? ((vram_offset / ROW_SIZE) + 1)
: ((vram_offset / ROW_SIZE) + 0);
@ -94,14 +94,14 @@ void CBossEntity::bos_metadata_get(
/// Blitting
/// --------
void CBossEntity::put_8(int left, int top, int image) const
void CBossEntity::put_8(screen_x_t left, vram_y_t top, int image) const
{
int16_t vram_offset_row = vram_offset_divmul(left, top);
int16_t vram_offset;
size_t bos_p = 0;
int bos_y;
int bos_word_x;
int16_t intended_y;
vram_y_t intended_y;
bos_image_t &bos = bos_images[bos_slot].image[image];
if(bos_image_count <= image) {
@ -133,12 +133,14 @@ void CBossEntity::put_8(int left, int top, int image) const
}
}
}
void CBossEntity::put_1line(int left, int y, int image, int row) const
void CBossEntity::put_1line(
screen_x_t left, vram_y_t y, int image, int row
) const
{
int16_t vram_offset_row = vram_offset_shift(left, y);
int bos_word_x;
size_t bos_p = 0;
int16_t intended_y;
vram_y_t intended_y;
char first_bit = (left & (BYTE_DOTS - 1));
char other_shift = ((1 * BYTE_DOTS) - first_bit);
@ -249,12 +251,14 @@ void pascal near vram_put_unaligned_bg_fg(
vram_put_unaligned_bg_fg(fg.G, VRAM_PLANE_G, vram_offset, bg.G, first_bit); \
vram_put_unaligned_bg_fg(fg.E, VRAM_PLANE_E, vram_offset, bg.E, first_bit);
void CBossEntity::unput_and_put_1line(int left, int y, int image, int row) const
void CBossEntity::unput_and_put_1line(
screen_x_t left, vram_y_t y, int image, int row
) const
{
int16_t vram_offset_row = vram_offset_shift(left, y);
int bos_word_x;
size_t bos_p = 0;
int16_t intended_y;
vram_y_t intended_y;
char first_bit = (left & (BYTE_DOTS - 1));
char other_shift = ((2 * BYTE_DOTS) - first_bit);
Planar<dots16_t> bg_masked;
@ -300,14 +304,16 @@ void CBossEntity::unput_and_put_1line(int left, int y, int image, int row) const
}
}
void CBossEntity::unput_and_put_8(int left, int top, int image) const
void CBossEntity::unput_and_put_8(
screen_x_t left, vram_y_t top, int image
) const
{
int16_t vram_offset_row = vram_offset_divmul(left, top);
int16_t vram_offset;
size_t bos_p = 0;
int bos_y;
int bos_word_x;
int16_t intended_y;
vram_y_t intended_y;
Planar<dots16_t> bg_masked;
bos_image_t &bos = bos_images[bos_slot].image[image];
@ -361,14 +367,14 @@ void CBossEntity::unput_and_put_8(int left, int top, int image) const
vram_unput_masked_emptyopt(G, offset, bit_count, mask, tmp_dots); \
vram_unput_masked_emptyopt(E, offset, bit_count, mask, tmp_dots);
void CBossEntity::unput_8(int left, int top, int image) const
void CBossEntity::unput_8(screen_x_t left, vram_y_t top, int image) const
{
int16_t vram_offset_row = vram_offset_divmul(left, top);
int16_t vram_offset;
int bos_y;
int bos_word_x;
size_t bos_p = 0;
int16_t intended_y;
vram_y_t intended_y;
bos_image_t &bos = bos_images[bos_slot].image[image];
if(bos_image_count <= image) {
@ -409,20 +415,20 @@ void CBossEntity::unput_8(int left, int top, int image) const
#define wave_func(func, left, top, image, len, amp, phase) \
int t = phase; \
for(int bos_y = 0; h > bos_y; bos_y++) { \
int x = (wave_x(amp, t) + left); \
screen_x_t x = (wave_x(amp, t) + left); \
t += (0x100 / len); \
func(x, (top + bos_y), image, bos_y); \
}
void CBossEntity::wave_put(
int left, int top, int image, int len, int amp, int phase
screen_x_t left, vram_y_t top, int image, int len, int amp, int phase
) const
{
wave_func(put_1line, left, top, image, len, amp, phase);
}
void CBossEntity::wave_unput_and_put(
int left, int top, int image, int len, int amp, int phase
screen_x_t left, vram_y_t top, int image, int len, int amp, int phase
) const
{
wave_func(unput_and_put_1line, left, top, image, len, amp, phase);
@ -433,15 +439,15 @@ inline int word_align(int v) {
}
void CBossEntity::egc_sloppy_wave_unput_double_broken(
int left_1, int top, int,
screen_x_t left_1, vram_y_t top, int,
int len_1, int amp_1, int phase_1,
int left_2,
screen_x_t left_2,
int len_2, int amp_2, int phase_2
) const
{
int x_1;
screen_x_t x_1;
int t_1 = phase_1;
int x_2;
screen_x_t x_2;
int t_2 = phase_2;
for(int bos_y = 0; h > bos_y; bos_y++) {
x_1 = wave_x(amp_1, t_1) + left_1;
@ -466,7 +472,7 @@ void CBossEntity::unput_and_put_16x8_8(int bos_left, int bos_top) const
int16_t vram_offset_row = vram_offset_shift(cur_left, cur_top);
int bos_row;
size_t bos_p = 0;
int intended_y;
vram_y_t intended_y;
int image = bos_image;
Planar<dots16_t> bg_masked;
bos_image_t &bos = bos_images[bos_slot].image[image];
@ -506,13 +512,13 @@ void CBossEntity::unput_and_put_16x8_8(int bos_left, int bos_top) const
/// --------
void CBossEntity::pos_set(
int left,
int top,
screen_x_t left,
screen_y_t top,
int unknown,
int move_clamp_left,
int move_clamp_right,
int move_clamp_top,
int move_clamp_bottom
screen_x_t move_clamp_left,
screen_x_t move_clamp_right,
screen_y_t move_clamp_top,
screen_y_t move_clamp_bottom
)
{
this->cur_left = left;
@ -537,12 +543,12 @@ void CBossEntity::move_lock_unput_and_put_8(
if(move_lock_frame == 0) {
move(delta_x, delta_y);
int unput_left = (prev_delta_x > 0)
screen_x_t unput_left = (prev_delta_x > 0)
? ((prev_left / BYTE_DOTS) * BYTE_DOTS)
: (((cur_left / BYTE_DOTS) * BYTE_DOTS) + (vram_w * BYTE_DOTS));
egc_copy_rect_1_to_0_16(unput_left, prev_top, 8, h);
int unput_top = (cur_top > prev_top)
vram_y_t unput_top = (cur_top > prev_top)
? prev_top
: (cur_top + h);
egc_copy_rect_1_to_0_16(

View File

@ -2,14 +2,14 @@
// be animated, and may or may not have a hitbox for collision with the Orb.
class CBossEntity {
public:
int cur_left;
int cur_top;
int prev_left;
int prev_top;
screen_x_t cur_left;
screen_y_t cur_top;
screen_x_t prev_left;
screen_y_t prev_top;
int vram_w;
int h;
area_t<int> move_clamp; // Relative to VRAM
area_t<int> hitbox_orb; // Relative to [cur_left] and [cur_top]
area_t<screen_x_t, screen_y_t> move_clamp; // Relative to VRAM
area_t<int, int> hitbox_orb; // Relative to [cur_left] and [cur_top]
// Never actually read outside of the functions that set them...
int prev_delta_y;
@ -49,47 +49,49 @@ public:
// Blits [image] to (⌊left/8⌋*8, top).
// Additionally clips at the bottom edge of VRAM.
void put_8(int left, int top, int image) const;
void put_8(screen_x_t left, vram_y_t top, int image) const;
// Precisely restores pixels according to the alpha mask of [image] from
// VRAM page 1, starting at (⌊left/8⌋*8, top).
// Additionally clips at the top and bottom edges of VRAM.
void unput_8(int left, int top, int image) const;
void unput_8(screen_x_t left, vram_y_t top, int image) const;
// Like put_8(), but restores all pixels in the blitted sprite
// rectangle from VRAM page 1 prior to blitting.
// Additionally clips at the top and bottom edges of VRAM.
void unput_and_put_8(int left, int top, int image) const;
void unput_and_put_8(screen_x_t left, vram_y_t top, int image) const;
// Blits line #[row] of [image] to (left, top).
// Additionally clips at the bottom edge of VRAM.
void put_1line(int left, int y, int image, int row) const;
void put_1line(screen_x_t left, vram_y_t y, int image, int row) const;
// Like put_1line(), but restores all pixels along the line from VRAM page
// 1 prior to blitting the line.
void unput_and_put_1line(int left, int y, int image, int row) const;
void unput_and_put_1line(
screen_x_t left, vram_y_t y, int image, int row
) const;
// Blits [image] with a wave function applied to the starting X coordinate
// for each row, based at the given (left, top) point. Used for Elis'
// entrance animation.
// Calls put_1line() for each row, and clips the sprite accordingly.
void wave_put(
int left, int top, int image, int len, int amp, int phase
screen_x_t left, vram_y_t top, int image, int len, int amp, int phase
) const;
// Like wave_put(), but calls unput_and_put_1line() for each line instead.
// For a sloppy, EGC-accelerated unblitter function, see egc_wave_unput().
void wave_unput_and_put(
int left, int top, int image, int len, int amp, int phase
screen_x_t left, vram_y_t top, int image, int len, int amp, int phase
) const;
// Tries to unblit the two sprites at (left_1, top) and (left_2, top) that
// were previously blitted with the given wave function using the EGC, but
// fails.
void egc_sloppy_wave_unput_double_broken(
int left_1, int top, int unused,
screen_x_t left_1, vram_y_t top, int unused,
int len_1, int amp_1, int phase_1,
int left_2,
screen_x_t left_2,
int len_2, int amp_2, int phase_2
) const;
@ -135,13 +137,13 @@ protected:
public:
// Sets [cur_left], [cur_top], [unknown], and the [move_clamp] area.
void pos_set(
int left,
int top,
screen_x_t left,
screen_y_t top,
int unknown,
int move_clamp_left,
int move_clamp_right,
int move_clamp_top,
int move_clamp_bottom
screen_x_t move_clamp_left,
screen_x_t move_clamp_right,
screen_y_t move_clamp_top,
screen_y_t move_clamp_bottom
);
// (Just read the actual function code, it's impossible to summarize these

View File

@ -41,7 +41,12 @@ CPellets::CPellets(void)
}
void vector2_to_player_from(
int x, int y, int &ret_x, int &ret_y, int length, unsigned char plus_angle
screen_x_t x,
screen_y_t y,
subpixel_t &ret_x,
subpixel_t &ret_y,
subpixel_t length,
unsigned char plus_angle
)
{
plus_angle = iatan2(
@ -60,8 +65,8 @@ bool16 pattern_velocity_set(
pellet_pattern_t pattern,
subpixel_t speed,
int &i,
int pellet_left,
int pellet_top
screen_x_t pellet_left,
screen_y_t pellet_top
)
{
// ZUN bug: Due to this default, add_pattern() ends up repeatedly calling
@ -190,7 +195,7 @@ inline subpixel_t base_speed_for_rank(void)
pellet->from_pattern = pattern;
void CPellets::add_pattern(
int left, int top, pellet_pattern_t pattern, subpixel_t speed
screen_x_t left, screen_y_t top, pellet_pattern_t pattern, subpixel_t speed
)
{
int i;
@ -237,14 +242,14 @@ void CPellets::add_pattern(
}
void CPellets::add_single(
int left,
int top,
screen_x_t left,
screen_y_t top,
int angle,
subpixel_t speed_base,
pellet_motion_t motion_type,
subpixel_t speed_for_motion_fixed,
int spin_center_x,
int spin_center_y
screen_x_t spin_center_x,
screen_y_t spin_center_y
)
{
int i;
@ -397,7 +402,7 @@ void CPellets::motion_type_apply_for_cur(void)
}
}
void pellet_put(int left, int top, int cel)
void pellet_put(screen_x_t left, vram_y_t top, int cel)
{
// Some `__asm` statements here look like they could be expressed using
// register pseudovariables. However, TCC would then use a different
@ -430,14 +435,16 @@ void pellet_put(int left, int top, int cel)
__asm loop put_loop;
}
void pellet_render(int left, int top, int cel)
void pellet_render(screen_x_t left, screen_y_t top, int cel)
{
grcg_setcolor_rmw(7);
pellet_put(left, top, cel);
grcg_off();
}
inline bool16 overlaps_shot(int pellet_left, int pellet_top, int i)
inline bool16 overlaps_shot(
screen_x_t pellet_left, screen_y_t pellet_top, int i
)
{
return overlap_lt_gt(
pellet_left, pellet_top, PELLET_W, PELLET_H,
@ -445,7 +452,7 @@ inline bool16 overlaps_shot(int pellet_left, int pellet_top, int i)
);
}
inline bool16 overlaps_orb(int pellet_left, int pellet_top)
inline bool16 overlaps_orb(screen_x_t pellet_left, screen_y_t pellet_top)
{
return overlap_lt_gt(
pellet_left, pellet_top, PELLET_W, PELLET_H,
@ -453,7 +460,9 @@ inline bool16 overlaps_orb(int pellet_left, int pellet_top)
);
}
bool16 CPellets::visible_after_hittests_for_cur(int pellet_left, int pellet_top)
bool16 CPellets::visible_after_hittests_for_cur(
screen_x_t pellet_left, screen_y_t pellet_top
)
{
// Well, well. Since ZUN uses this super sloppy 16x8 rectangle to unblit
// 8x8 pellets, there's now the (completely unnecessary) possibility of

View File

@ -151,8 +151,8 @@ public:
Subpixel speed; // for recalculating velocities with certain motion types
int decay_frame;
int cloud_frame;
int cloud_left; // Not subpixels!
int cloud_top; // Not subpixels!
screen_x_t cloud_left; // Not subpixels!
screen_y_t cloud_top; // Not subpixels!
int angle; // for recalculating velocities with certain motion types
// Direction for PM_SLING_AIMED. Not reset when a pellet is destroyed -
@ -191,7 +191,9 @@ protected:
//
// (And yes, this function does operate on the currently iterated pellet,
// despite taking separate position parameters!)
bool16 visible_after_hittests_for_cur(int pellet_left, int pellet_top);
bool16 visible_after_hittests_for_cur(
screen_x_t pellet_left, screen_y_t pellet_top
);
void clouds_unput_update_render(void);
@ -203,7 +205,10 @@ public:
// according to the currently played difficulty and the resident
// [pellet_speed]. The [motion_type] for the new pellets is PM_NORMAL.
void add_pattern(
int left, int top, pellet_pattern_t pattern, subpixel_t speed_base
screen_x_t left,
screen_y_t top,
pellet_pattern_t pattern,
subpixel_t speed_base
);
// Spawns a single new pellet with a customizable [motion_type].
@ -213,14 +218,14 @@ public:
// [spin_center_x] and [spin_center_y] are only used with PM_SPIN,
// while [speed_base] is *ignored* for PM_SPIN.
void add_single(
int left,
int top,
screen_x_t left,
screen_y_t top,
int angle,
subpixel_t speed_base,
pellet_motion_t motion_type,
subpixel_t speed_for_motion_fixed = to_sp(0.0f),
int spin_center_x = 0,
int spin_center_y = 0
screen_x_t spin_center_x = 0,
screen_y_t spin_center_y = 0
);
// Transitions all living pellets into their decay state, awarding points

View File

@ -9,7 +9,7 @@ extern "C" {
#include "th01/main/bullet/pellet_c.hpp"
#include "th01/sprites/pellet_c.h"
void pellet_cloud_put_8(int left, int top, int col, int cel)
void pellet_cloud_put_8(screen_x_t left, vram_y_t top, int col, int cel)
{
uint16_t vram_offset = vram_offset_shift(left, top);
@ -26,7 +26,7 @@ void pellet_cloud_put_8(int left, int top, int col, int cel)
grcg_off();
}
void pellet_cloud_unput_8(int left, int top, int cel)
void pellet_cloud_unput_8(screen_x_t left, vram_y_t top, int cel)
{
planar_t(PELLET_CLOUD_W) page1;
uint16_t vram_offset = vram_offset_shift(left, top);

View File

@ -1,8 +1,8 @@
// Displays a pellet delay cloud [cel] in the given [col] at
// (⌊left/8⌋*8, top).
void pellet_cloud_put_8(int left, int top, int col, int cel);
void pellet_cloud_put_8(screen_x_t left, vram_y_t top, int col, int cel);
// Restores the pixels of the given pellet delay cloud [cel], starting at
// (⌊left/8⌋*8, top), from VRAM page 1, effectively removing a cloud that was
// previously blitted to that position.
void pellet_cloud_unput_8(int left, int top, int cel);
void pellet_cloud_unput_8(screen_x_t left, vram_y_t top, int cel);

View File

@ -9,19 +9,19 @@
/// Constants
/// ---------
static const int LIVES_LEFT = 128;
static const int LIVES_TOP = 0;
static const screen_x_t LIVES_LEFT = 128;
static const screen_y_t LIVES_TOP = 0;
static const int LIVES_PER_ROW = 6; // for all the cheaters?
static const int BOMBS_LEFT = 128;
static const int BOMBS_TOP = 16;
static const screen_x_t BOMBS_LEFT = 128;
static const screen_y_t BOMBS_TOP = 16;
static const int SCORE_LEFT = 256;
static const int MAX_TOP = 0;
static const int CUR_TOP = 16;
static const screen_x_t SCORE_LEFT = 256;
static const screen_y_t MAX_TOP = 0;
static const screen_y_t CUR_TOP = 16;
static const int STAGE_LEFT = 608;
static const int STAGE_TOP = 32;
static const screen_x_t STAGE_LEFT = 608;
static const screen_y_t STAGE_TOP = 32;
static const int PTN_LIFE_QUARTER = 0;
static const int PTN_BOMB_QUARTER = 1;
@ -40,9 +40,11 @@ static const int ROW_H = PTN_QUARTER_H;
static const int SCORE_W = (SCORE_DIGITS * COL_W);
static const int CARDCOMBO_LEFT = (SCORE_LEFT + ((SCORE_DIGITS + 2) * COL_W));
static const screen_x_t CARDCOMBO_LEFT = (
SCORE_LEFT + ((SCORE_DIGITS + 2) * COL_W)
);
static const int CARDCOMBO_W = (CARDCOMBO_DIGITS * COL_W);
static const int CARDCOMBO_RIGHT = (CARDCOMBO_LEFT + CARDCOMBO_W);
static const screen_x_t CARDCOMBO_RIGHT = (CARDCOMBO_LEFT + CARDCOMBO_W);
static const int SCORE_AND_CARDCOMBO_W = (CARDCOMBO_RIGHT - SCORE_LEFT);
/// ---------
@ -61,7 +63,7 @@ extern unsigned char hud_cardcombo_max; // Why a separate variable???
/// Functions
/// ---------
inline int col_left(int first_left, int col) {
inline screen_x_t col_left(screen_x_t first_left, int col) {
return (first_left + (col * COL_W));
}
@ -83,12 +85,17 @@ inline int col_left(int first_left, int col) {
// Copies the (⌊[w]/16⌋*16)×[ROW_H] pixels starting at (⌊left/8⌋*8, top) from
// VRAM page 0 to VRAM page 1.
void graph_copy_hud_row_0_to_1_8(int left, int top, int w);
void graph_copy_hud_row_0_to_1_8(screen_x_t left, vram_y_t top, int w);
/// ---------
}
template <class T1, class T2> inline void fwnum_put(
int left, int top, int fx, int digits, const T1 &val, const T2 &val_prev
screen_x_t left,
screen_y_t top,
int fx,
int digits,
const T1 &val,
const T2 &val_prev
) {
graph_putfwnum_fx(
left, top, fx, digits, val,
@ -102,7 +109,7 @@ template <class T1, class T2> inline void fwnum_put(
#define score_max_bg(func, digit) \
score_bg(func, digit, MAX_TOP, PTN_BG_MAX_SCORE)
inline void score_put(int top, int fx, const long &prev) {
inline void score_put(screen_y_t top, int fx, const long &prev) {
fwnum_put(SCORE_LEFT, top, fx, SCORE_DIGITS, score, prev);
}
@ -112,7 +119,7 @@ inline void score_put(int top, int fx, const long &prev) {
#define cardcombo_max_bg(func, digit) \
cardcombo_bg(func, digit, MAX_TOP, PTN_BG_MAX_CARDCOMBO)
inline void cardcombo_put(int top, int fx, const int &prev) {
inline void cardcombo_put(screen_y_t top, int fx, const int &prev) {
fwnum_put(CARDCOMBO_LEFT, top, fx, CARDCOMBO_DIGITS, cardcombo_cur, prev);
}
@ -216,7 +223,7 @@ void hud_score_and_cardcombo_render(void)
cardcombo_bg(func, digit, top, ptn_id); \
} \
inline void cardcombo_put_initial(int top, int fx) {
inline void cardcombo_put_initial(screen_y_t top, int fx) {
graph_putfwnum_fx(CARDCOMBO_LEFT, top, fx, CARDCOMBO_DIGITS, 0, 99, true);
}
@ -321,7 +328,7 @@ int hud_bg_load(const char *fn)
}
/// ----------
void graph_copy_hud_row_0_to_1_8(int left, int top, int w)
void graph_copy_hud_row_0_to_1_8(screen_x_t left, vram_y_t top, int w)
{
uint16_t vram_offset;
dots16_t dots;
@ -354,7 +361,7 @@ inline int lives_col(int i) {
return (i % LIVES_PER_ROW);
}
inline int lives_top(int i) {
inline screen_y_t lives_top(int i) {
return (LIVES_TOP + ((i / LIVES_PER_ROW) * ROW_H));
}

View File

@ -1,16 +1,18 @@
static const int ORB_W = 32;
static const int ORB_H = 32;
static const int ORB_LEFT_MIN = (PLAYFIELD_LEFT);
static const int ORB_LEFT_MAX = (PLAYFIELD_RIGHT - ORB_W);
static const int ORB_TOP_MIN = (PLAYFIELD_TOP);
static const int ORB_TOP_MAX = (PLAYFIELD_BOTTOM - ORB_H);
static const screen_x_t ORB_LEFT_MIN = (PLAYFIELD_LEFT);
static const screen_x_t ORB_LEFT_MAX = (PLAYFIELD_RIGHT - ORB_W);
static const screen_y_t ORB_TOP_MIN = (PLAYFIELD_TOP);
static const screen_y_t ORB_TOP_MAX = (PLAYFIELD_BOTTOM - ORB_H);
static const int ORB_LEFT_START = (ORB_LEFT_MAX - 8);
static const int ORB_TOP_START = ( ORB_TOP_MAX - 88);
static const screen_x_t ORB_LEFT_START = (ORB_LEFT_MAX - 8);
static const screen_y_t ORB_TOP_START = ( ORB_TOP_MAX - 88);
extern int orb_cur_left, orb_cur_top;
extern int orb_prev_left, orb_prev_top;
extern screen_x_t orb_cur_left;
extern screen_y_t orb_cur_top;
extern screen_x_t orb_prev_left;
extern screen_y_t orb_prev_top;
extern bool16 orb_in_portal;
/// Physics

View File

@ -1,14 +1,14 @@
static const int PLAYER_W = 32;
static const int PLAYER_H = 32;
static const int PLAYER_LEFT_MIN = (PLAYFIELD_LEFT);
static const int PLAYER_LEFT_MAX = (PLAYFIELD_RIGHT - PLAYER_W);
static const screen_x_t PLAYER_LEFT_MIN = (PLAYFIELD_LEFT);
static const screen_x_t PLAYER_LEFT_MAX = (PLAYFIELD_RIGHT - PLAYER_W);
static const int PLAYER_LEFT_START = (PLAYFIELD_CENTER - (PLAYER_W / 2));
static const screen_x_t PLAYER_LEFT_START = (PLAYFIELD_CENTER - (PLAYER_W / 2));
extern int player_left;
static const int player_top = (PLAYFIELD_BOTTOM - PLAYER_H);
static const int player_center_y = (PLAYFIELD_BOTTOM - (PLAYER_H / 2));
extern screen_x_t player_left;
static const screen_y_t player_top = (PLAYFIELD_BOTTOM - PLAYER_H);
static const screen_y_t player_center_y = (PLAYFIELD_BOTTOM - (PLAYER_H / 2));
void player_move_and_clamp(int delta);

View File

@ -6,7 +6,7 @@ static const int SHOT_DECAY_FRAMES = 7;
#define sloppy_unput(i) \
egc_copy_rect_1_to_0_16(left[i], top[i], SHOT_W, SHOT_H);
void CShots::add(int new_left, int new_top)
void CShots::add(screen_x_t new_left, screen_y_t new_top)
{
if(new_left < PLAYFIELD_LEFT || new_left > (PLAYFIELD_RIGHT - 1)) {
return;
@ -78,7 +78,7 @@ void CShots::unput_update_render(void)
}
}
bool16 CShots::hittest_orb(int i, int orb_left, int orb_top)
bool16 CShots::hittest_orb(int i, screen_x_t orb_left, screen_y_t orb_top)
{
if(moving[i] == false) {
return false;
@ -111,7 +111,7 @@ bool16 CShots::hittest_orb(int i, int orb_left, int orb_top)
decay_frame[i] = 1; \
mdrv2_se_play(16);
bool16 CShots::hittest_pellet(int pellet_left, int pellet_top)
bool16 CShots::hittest_pellet(screen_x_t pellet_left, screen_y_t pellet_top)
{
for(int i = 0; i < SHOT_COUNT; i++) {
if(moving[i] == false) {
@ -137,7 +137,7 @@ bool16 CShots::hittest_pellet(int pellet_left, int pellet_top)
}
bool16 CShots::hittest_boss(
int hitbox_left, int hitbox_top, int hitbox_w, int hitbox_h
screen_x_t hitbox_left, screen_y_t hitbox_top, int hitbox_w, int hitbox_h
)
{
for(int i = 0; i < SHOT_COUNT; i++) {

View File

@ -6,15 +6,15 @@ static const int SHOT_W = 16;
static const int SHOT_H = 16;
struct CShots {
int left[SHOT_COUNT];
int top[SHOT_COUNT];
screen_x_t left[SHOT_COUNT];
screen_y_t top[SHOT_COUNT];
int unknown[SHOT_COUNT];
// A shot slot can be considered "alive" if either of these are nonzero.
unsigned char moving[SHOT_COUNT];
unsigned char decay_frame[SHOT_COUNT];
void add(int new_left, int new_top);
void add(screen_x_t new_left, screen_y_t new_top);
void unput_and_reset_all(void);
void unput_update_render(void);
@ -24,16 +24,19 @@ struct CShots {
// Processes any collision between *the given* shot and the Orb, placed at
// the given position, and returns true if they did collide.
bool16 hittest_orb(int i, int orb_left, int orb_top);
bool16 hittest_orb(int i, screen_x_t orb_left, screen_y_t orb_top);
// Processes any collision between *any* shot and a pellet, placed at the
// given position, and returns true if they did collide.
bool16 hittest_pellet(int pellet_left, int pellet_top);
bool16 hittest_pellet(screen_x_t pellet_left, screen_y_t pellet_top);
// Processes any collision between *any* shot and a boss with the given
// hitbox, and returns true if they did collide.
bool16 hittest_boss(
int hitbox_left, int hitbox_top, int hitbox_w, int hitbox_h
screen_x_t hitbox_left,
screen_y_t hitbox_top,
int hitbox_w,
int hitbox_h
);
};

View File

@ -1,8 +1,8 @@
static const int PLAYFIELD_LEFT = 0;
static const int PLAYFIELD_TOP = 64;
static const int PLAYFIELD_RIGHT = RES_X;
static const int PLAYFIELD_BOTTOM = RES_Y;
static const screen_x_t PLAYFIELD_LEFT = 0;
static const screen_y_t PLAYFIELD_TOP = 64;
static const screen_x_t PLAYFIELD_RIGHT = RES_X;
static const screen_y_t PLAYFIELD_BOTTOM = RES_Y;
static const int PLAYFIELD_CENTER = (
static const screen_x_t PLAYFIELD_CENTER = (
((PLAYFIELD_RIGHT - PLAYFIELD_LEFT) / 2) + PLAYFIELD_LEFT
);

View File

@ -1,5 +1,5 @@
extern int portal_dst_left;
extern int portal_dst_top;
extern screen_x_t portal_dst_left;
extern screen_y_t portal_dst_top;
// Additional flag on top of [orb_in_portal]. Left as true for a few more
// frames after the orb has exited a portal, to prevent it from immediately
// re-entering.

View File

@ -10,17 +10,17 @@
} \
grcg_put_8x8_mono(vram_offset_topleft, first_bit, sprite.rows, col);
void shape8x8_diamond_put(int left, int top, int col)
void shape8x8_diamond_put(screen_x_t left, vram_y_t top, int col)
{
shape8x8_put(SHAPE8X8_DIAMOND, left, top, col);
}
void shape8x8_star_put(int left, int top, int col)
void shape8x8_star_put(screen_x_t left, vram_y_t top, int col)
{
shape8x8_put(SHAPE8X8_STAR, left, top, col);
}
void shape8x8_flake_put(int left, int top, int col)
void shape8x8_flake_put(screen_x_t left, vram_y_t top, int col)
{
shape8x8_put(SHAPE8X8_FLAKE, left, top, col);
}

View File

@ -1,5 +1,5 @@
// Blits the hardcoded diamond, star, or snowflake sprites in the given [col]
// to the given position.
void shape8x8_diamond_put(int left, int top, int col);
void shape8x8_star_put(int left, int top, int col);
void shape8x8_flake_put(int left, int top, int col);
void shape8x8_diamond_put(screen_x_t left, vram_y_t top, int col);
void shape8x8_star_put(screen_x_t left, vram_y_t top, int col);
void shape8x8_flake_put(screen_x_t left, vram_y_t top, int col);

View File

@ -13,17 +13,21 @@ extern "C" {
#include "th01/hardware/grp2xscs.cpp"
void egc_wave_unput(int left, int top, int len, int amp, int ph, int w, int h)
void egc_wave_unput(
screen_x_t left, vram_y_t top, int len, int amp, int ph, int w, int h
)
{
int t = ph;
for(int y = 0; y < h; y++) {
int x = (wave_x(amp, t) + left);
screen_x_t x = (wave_x(amp, t) + left);
t += (0x100 / len);
egc_copy_rect_1_to_0_16(x, top + y, w, 1);
}
}
void graph_hline_unput_masked(int left, int top, dots8_t *mask, int w)
void graph_hline_unput_masked(
screen_x_t left, vram_y_t top, dots8_t *mask, int w
)
{
planar8_t px8;
register uint16_t p = vram_offset_shift(left, top);

View File

@ -1,3 +1,4 @@
template <class T> struct area_t {
T left, right, top, bottom;
template <class TX, class TY> struct area_t {
TX left, right;
TY top, bottom;
};

View File

@ -20,8 +20,8 @@ extern "C" {
void snap_col_4(void)
{
extern dots8_t* columns[ROW_SIZE];
register int x;
register int y;
register vram_x_t x;
register screen_y_t y;
int vram_offset;
for(x = 0; x < ROW_SIZE; x++) {
@ -217,7 +217,7 @@ void option_input_sense(void)
/// White line animation
/// --------------------
void whiteline_put(int y)
void whiteline_put(screen_y_t y)
{
size_t vram_offset = vram_offset_shift(0, y);
int x;
@ -240,8 +240,8 @@ void whitelines_animate(void)
extern const hack WHITELINES_DRAWN_AT;
unsigned int i = 0;
int y1 = 0;
int y2 = 0;
screen_y_t y1 = 0;
screen_y_t y2 = 0;
hack drawn_at = WHITELINES_DRAWN_AT;
while(i++ < (RES_Y / 4)) {
egc_copy_rect_1_to_0_16(0, y1, RES_X, 1);

View File

@ -18,7 +18,7 @@ void DEFCONV pi_slot_palette_apply(int slot);
// Displays the PI image in slot #[slot] at ([left], [top]). Horizontally, the
// image is cut off at 640 pixels; vertically, it is wrapped if it exceeds the
// clipping frame defined via grc_setclip().
void DEFCONV pi_slot_put(int left, int top, int slot);
void DEFCONV pi_slot_put(screen_x_t left, vram_y_t top, int slot);
#define pi_load_put_free(slot, fn) \
pi_slot_load(slot, (fn)); \

View File

@ -4,7 +4,7 @@ void pi_slot_palette_apply(int slot)
palette_show();
}
void pi_slot_put(int left, int top, int slot)
void pi_slot_put(screen_x_t left, vram_y_t top, int slot)
{
char *row_p = pi_slot_buffers[slot];
int y;

View File

@ -2,7 +2,9 @@
#include <mbstring.h>
#include "th01/hardware/grppsafx.cpp"
void graph_putsa_fx(int left, int top, int fx, const unsigned char *str)
void graph_putsa_fx(
screen_x_t left, vram_y_t top, int fx, const unsigned char *str
)
{
uint16_t codepoint;
dots16_t glyph_row;

View File

@ -1,2 +1,2 @@
// Renders a pellet at the given position.
void pascal near pellet_render(int left, int top);
void pascal near pellet_render(screen_x_t left, screen_y_t top);

View File

@ -2,7 +2,7 @@
extern const dots16_t sPELLET[PELLET_CELS][PRESHIFT][PELLET_H];
void pascal near pellet_render(int left, int top)
void pascal near pellet_render(screen_x_t left, vram_y_t top)
{
_ES = SEG_PLANE_B;
_BX = _BX; // Keeps any parameters from being put into BX

View File

@ -2,7 +2,7 @@ HUD_CONTINUES_X = HUD_X + ((SCORE_DIGITS - 1) * 2)
; Only prints the seven score digits, in contrast to the TH04/TH05 version!
; void pascal near hud_score_put(unsigned int y, long value);
; void pascal near hud_score_put(utram_y_t y, long value);
public HUD_SCORE_PUT
hud_score_put proc near
@@result = word ptr [bp-4]
@ -44,7 +44,7 @@ hud_score_put proc near
hud_score_put endp
; void pascal near hud_continues_put(unsigned int y, int continues_used);
; void pascal near hud_continues_put(utram_y_t y, int continues_used);
public HUD_CONTINUES_PUT
hud_continues_put proc near

View File

@ -4,4 +4,6 @@ extern unsigned char pointnum_operand;
// Blits the given point[num] sprite to the given position. Assumptions:
// • ES is already be set to the beginning of a VRAM segment
// • The GRCG is active, and set to the intended color
void pascal near pointnum_put(int left, int top, unsigned int num);
void pascal near pointnum_put(
screen_x_t left, vram_y_t top, unsigned int num
);

View File

@ -3,7 +3,7 @@
; • The GRCG is active, and set to the intended color
; • [sprite_id] ≤ SPARK_SPRITES
; void pascal near spark_render(int x, int vram_y, int sprite_id);
; void pascal near spark_render(screen_x_t x, vram_y_t vram_y, int sprite_id);
spark_render proc near
@@sprite_id = word ptr 4
@@vram_y = word ptr 6

View File

@ -40,9 +40,9 @@ void pascal scoredat_defaults_set(void)
}
// Slightly differs from the same function in OP.EXE!
void pascal score_points_put(unsigned y, long points, unsigned atrb)
void pascal score_points_put(tram_y_t y, long points, unsigned atrb)
{
int x;
tram_x_t x;
int digit;
long divisor = 10000000;
long result;

View File

@ -8,7 +8,8 @@ extern "C" {
void pascal near rotrect_draw(int rad, unsigned char angle)
{
int x[4], y[4];
screen_x_t x[4];
screen_y_t y[4];
int i;
for(i = 0; i < 4; i++) {
x[i] = ((rad * (long)CosTable8[angle]) >> 8) + 192;

View File

@ -112,7 +112,9 @@ void pascal near pi_load_put_free_to(const char near *fn, char page)
void op_animate(void)
{
int door_x, door_y; // Sony Vegas calls this a "Barn Door" transition.
// Sony Vegas calls this a "Barn Door" transition.
int door_x;
tram_y_t door_y;
const char gbZUN[] = {gb_Z_, gb_U_, gb_N_, 0};
text_wipe();

View File

@ -24,7 +24,7 @@ long unused_5;
#include "th01/hardware/vplanset.c"
#include "th02/formats/pi_load.c"
void pascal graph_copy_rect_1_to_0(int x, int y, int w, int h)
void pascal graph_copy_rect_1_to_0(screen_x_t x, vram_y_t y, int w, int h)
{
int row_p = vram_offset_shift(x, y);
int row;

View File

@ -53,7 +53,7 @@ void pascal near score_points_put(unsigned y, long points, unsigned atrb)
}
}
void pascal near shottype_put(int y, int type, int atrb)
void pascal near shottype_put(tram_y_t y, int type, int atrb)
{
text_putsa(48, y, SHOTTYPES[type], atrb);
}
@ -76,7 +76,7 @@ void int_to_string(char *str, int val, int chars)
str[c] = 0;
}
void pascal near scoredat_date_put(int y, int place, int atrb)
void pascal near scoredat_date_put(tram_y_t y, int place, int atrb)
{
char str[6];
int_to_string(str, hi.score.date[place].da_year, 4);
@ -126,7 +126,8 @@ void pascal near scores_put(int place_to_highlight)
void pascal near logo_render(void)
{
int i;
int x, y;
screen_x_t x;
screen_y_t y;
grcg_setcolor(GC_RMW, 10);
grcg_fill();
grcg_off();

View File

@ -38,11 +38,10 @@ char cleared_game_with[SHOTTYPE_COUNT];
char cleared_extra_with[SHOTTYPE_COUNT];
long unused[2];
void pascal graph_copy_rect_1_to_0(int x, int y, int w, int h);
void copy_pic_back(int sel, int highlight)
{
int x, y;
screen_x_t x;
screen_y_t y;
if(!highlight) {
switch(sel) {
case 0: x = 16; y = 128; break;
@ -67,7 +66,7 @@ void copy_pic_back(int sel, int highlight)
}
}
void darken_pic_at(int x, int y)
void darken_pic_at(screen_x_t x, screen_y_t y)
{
int row_p = vram_offset_shift(x, y);
int row, col;
@ -83,7 +82,8 @@ void darken_pic_at(int x, int y)
void draw_shottype_desc(int sel, int color)
{
int x, y;
screen_x_t x;
screen_y_t y;
switch(sel) {
case 0: x = 16; y = 296; break;
case 1: x = 224; y = 136; break;
@ -158,8 +158,8 @@ void pascal shottype_menu_init(void)
void pascal shottype_menu(void)
{
int input_locked = 0;
int pic_x[] = { 16, 224, 432};
int pic_y[] = {128, 224, 128};
screen_x_t pic_x[] = { 16, 224, 432};
screen_y_t pic_y[] = {128, 224, 128};
unsigned int input_delay = 0;
shottype_menu_init();

View File

@ -54,8 +54,8 @@ const char *MUSIC_FILES[] = {
// Polygon state
char initialized = 0;
point_t points[10];
point_t pos[MUSIC_POLYGONS];
screen_point_t points[10];
screen_point_t pos[MUSIC_POLYGONS];
point_t move_speed[MUSIC_POLYGONS];
char angle[MUSIC_POLYGONS];
char rot_speed[MUSIC_POLYGONS];
@ -101,7 +101,12 @@ void pascal near screen_back_B_put(void)
}
void pascal near polygon_build(
point_t near *pts, int x, int y, int rad, int npoint, char angle
screen_point_t near *pts,
screen_x_t x,
screen_y_t y,
int rad,
int npoint,
char angle
)
{
int i;
@ -198,7 +203,10 @@ void pascal near music_flip(void)
void pascal near cmt_back_snap(void)
{
int ps, x, pd, y;
int ps;
screen_x_t x;
int pd;
screen_y_t y;
int i;
for(i = 0; i < PL_COUNT; i++) {
cmt_back[i] = reinterpret_cast<dots8_t *>(MK_FP(
@ -220,7 +228,10 @@ void pascal near cmt_back_free(void)
void pascal near cmt_back_put(void)
{
int ps, x, pd, y;
int ps;
screen_x_t x;
int pd;
screen_y_t y;
CMT_BACK_BLIT(VRAM_PLANE, pd, cmt_back, ps);
}

View File

@ -41,7 +41,7 @@ void pascal mptn_free(void);
#include "th01/hardware/grppsafx.h"
void pascal graph_copy_rect_1_to_0(int x, int y, int w, int h);
void pascal graph_copy_rect_1_to_0(screen_x_t x, vram_y_t y, int w, int h);
// -------
typedef enum {

View File

@ -1,12 +1,12 @@
; Displays the CDG image in the given [slot] at (⌊x/8⌋*8, y).
; Displays the CDG image in the given [slot] at (⌊left/8⌋*8, top).
; void pascal cdg_put(int x, int y, int slot);
; void pascal cdg_put(screen_x_t left, vram_y_t top, int slot);
public CDG_PUT
cdg_put proc far
@@slot = word ptr 6
@@y = word ptr 8
@@x = word ptr 10
@@top = word ptr 8
@@left = word ptr 10
push bp
mov bp, sp
@ -18,7 +18,7 @@ cdg_put proc far
add si, offset _cdg_slots
mov ax, [si+CDGSlot.sgm_colors]
mov word ptr cs:@@sgm_colors+1, ax
mov ax, [bp+@@x]
mov ax, [bp+@@left]
sar ax, 3
add ax, [si+CDGSlot.vram_byte_at_bottom_left]
mov di, ax
@ -30,7 +30,7 @@ cdg_put proc far
add ax, (640 / 8)
mov word ptr cs:@@stride+1, ax
jmp short $+2
mov ax, [bp+@@y]
mov ax, [bp+@@top]
mov bx, ax
shl ax, 2
add ax, bx

View File

@ -1,8 +1,8 @@
; Displays the CDG image in the given [slot] centered at (⌊x_center/8⌋*8,
; y_center), then applies a dissolve effect with the given [strength]
; Displays the CDG image in the given [slot] centered at (⌊center_x/8⌋*8,
; center_y), then applies a dissolve effect with the given [strength]
; (mod 8, 0 = none, 7 = full) on the E bitplane.
; void pascal cdg_put_dissolve_e(int x_center, int y_center, int slot, int strength);
; void pascal cdg_put_dissolve_e(screen_x_t center_x, vram_y_t center_y, int slot, int strength);
public CDG_PUT_DISSOLVE_E
cdg_put_dissolve_e proc near
@ -11,8 +11,8 @@ cdg_put_dissolve_e proc near
@@p_offset = word ptr -2
@@strength = word ptr 4
@@slot = word ptr 6
@@y_center = word ptr 8
@@x_center = word ptr 0Ah
@@center_y = word ptr 8
@@center_x = word ptr 0Ah
enter 6, 0
push si
@ -29,23 +29,23 @@ cdg_put_dissolve_e proc near
cwd
sub ax, dx
sar ax, 1
sub [bp+@@x_center], ax
sub [bp+@@center_x], ax
mov ax, [bp+@@h]
cwd
sub ax, dx
sar ax, 1
sub [bp+@@y_center], ax
sub [bp+@@center_y], ax
cmp byte_10BC7, 0
jz short @@put_noalpha
cmp byte_10BB5, 0
jnz short @@put_alpha
@@put_noalpha:
call cdg_put_noalpha pascal, [bp+@@x_center], [bp+@@y_center], [bp+@@slot]
call cdg_put_noalpha pascal, [bp+@@center_x], [bp+@@center_y], [bp+@@slot]
jmp short @@dissolve_prepare
@@put_alpha:
call cdg_put pascal, [bp+@@x_center], [bp+@@y_center], [bp+@@slot]
call cdg_put pascal, [bp+@@center_x], [bp+@@center_y], [bp+@@slot]
@@dissolve_prepare:
and [bp+@@strength], 7
@ -56,14 +56,14 @@ cdg_put_dissolve_e proc near
cwd
idiv bx
mov [bp+@@w], ax
mov ax, [bp+@@y_center]
mov ax, [bp+@@center_y]
add [bp+@@h], ax
mov ax, [bp+@@x_center]
mov ax, [bp+@@center_x]
sar ax, 3
mov dx, [bp+@@y_center]
mov dx, [bp+@@center_y]
shl dx, 6
add ax, dx
mov dx, [bp+@@y_center]
mov dx, [bp+@@center_y]
shl dx, 4
add ax, dx
mov [bp+@@p_offset], ax
@ -73,7 +73,7 @@ cdg_put_dissolve_e proc near
mov bx, [bp+@@strength]
shl bx, 3
add bx, offset CDG_DISSOLVE_PATTERN
mov dx, [bp+@@y_center]
mov dx, [bp+@@center_y]
@@dissolve_next_row:
mov si, dx

View File

@ -1,12 +1,12 @@
; Displays the CDG image in the given [slot] at (⌊x/8⌋*8, y), flipped
; Displays the CDG image in the given [slot] at (⌊left/8⌋*8, top), flipped
; horizontally.
; void DEFCONV cdg_put_hflip(int x, int y, int slot);
; void DEFCONV cdg_put_hflip(screen_x_t left, vram_y_t top, int slot);
proc_defconv cdg_put_hflip
@@slot = word ptr 6
@@y = word ptr 8
@@x = word ptr 10
@@top = word ptr 8
@@left = word ptr 10
push bp
mov bp, sp
@ -16,7 +16,7 @@ proc_defconv cdg_put_hflip
mov si, [bp+@@slot]
shl si, 4
add si, offset _cdg_slots
mov ax, [bp+@@x]
mov ax, [bp+@@left]
sar ax, 3
add ax, [si+CDGSlot.vram_byte_at_bottom_left]
mov bx, [si+CDGSlot.width_divided_by_32]
@ -33,7 +33,7 @@ proc_defconv cdg_put_hflip
mov word ptr cs:@@stride_alpha+1, ax
mov word ptr cs:@@stride_colors+1, ax
jmp short $+2
mov ax, [bp+@@y]
mov ax, [bp+@@top]
mov bx, ax
shl ax, 2
add ax, bx

View File

@ -1,13 +1,13 @@
; Displays the CDG image in the given [slot] at (⌊x/8⌋*8, y), disregarding its
; alpha plane.
; Displays the CDG image in the given [slot] at (⌊left/8⌋*8, top),
; disregarding its alpha plane.
; void pascal cdg_put_noalpha(int x, int y, int slot);
; void pascal cdg_put_noalpha(screen_x_t left, vram_y_t top, int slot);
public CDG_PUT_NOALPHA
cdg_put_noalpha proc far
@@slot = word ptr 6
@@y = word ptr 8
@@x = word ptr 10
@@top = word ptr 8
@@left = word ptr 10
push bp
mov bp, sp
@ -16,7 +16,7 @@ cdg_put_noalpha proc far
mov si, [bp+@@slot]
shl si, 4
add si, offset _cdg_slots
mov ax, [bp+@@x]
mov ax, [bp+@@left]
sar ax, 3
add ax, [si+CDGSlot.vram_byte_at_bottom_left]
mov di, ax
@ -26,7 +26,7 @@ cdg_put_noalpha proc far
shl ax, 2
add ax, (640 / 8)
mov dx, ax
mov ax, [bp+@@y]
mov ax, [bp+@@top]
mov bx, ax
shl ax, 2
add ax, bx

View File

@ -1,17 +1,17 @@
; Assuming that the CDG image in the given [slot] was previously displayed
; centered at (⌊x_center/8⌋*8, y_center), this function clears the two lines
; centered at (⌊center_x/8⌋*8, center_y), this function clears the two lines
; at the bottom of that image, as well as the one line immediately below, from
; the VRAM's E plane.
; void cdg_unput_for_upwards_motion_e(int x_center, int y_center, int slot);
; void cdg_unput_for_upwards_motion_e(screen_x_t center_x, vram_y_t center_y, int slot);
public CDG_UNPUT_FOR_UPWARDS_MOTION_E
cdg_unput_for_upwards_motion_e proc near
@@h = word ptr -4
@@w = word ptr -2
@@slot = word ptr 4
@@y_center = word ptr 6
@@x_center = word ptr 8
@@center_y = word ptr 6
@@center_x = word ptr 8
enter 4, 0
push si
@ -28,19 +28,19 @@ cdg_unput_for_upwards_motion_e proc near
cwd
sub ax, dx
sar ax, 1
sub [bp+@@x_center], ax
sub [bp+@@center_x], ax
mov ax, [bp+@@h]
cwd
sub ax, dx
sar ax, 1
add ax, -2
add [bp+@@y_center], ax
mov ax, [bp+@@x_center]
add [bp+@@center_y], ax
mov ax, [bp+@@center_x]
sar ax, 3
mov dx, [bp+@@y_center]
mov dx, [bp+@@center_y]
shl dx, 6
add ax, dx
mov dx, [bp+@@y_center]
mov dx, [bp+@@center_y]
shl dx, 4
add ax, dx
mov di, ax

View File

@ -5,8 +5,10 @@
extern const dots16_t PI_MASKS[PI_MASK_COUNT][PI_MASK_H];
// Like pi_slot_put(), but only displays every second row in the given PI.
int pascal pi_slot_put_interlace(int x, int y, int slot);
int pascal pi_slot_put_interlace(screen_x_t left, vram_y_t top, int slot);
// Like pi_slot_put(), but only displays the n-th 320x200 [quarter], counted
// from the top left, of the PI image in slot #[slot] at ([x], [y]).
int pascal pi_slot_put_quarter(int x, int y, int slot, int quarter);
// from the top left, of the PI image in slot #[slot] at ([left], [top]).
int pascal pi_slot_put_quarter(
screen_x_t left, vram_y_t top, int slot, int quarter
);

View File

@ -1,10 +1,10 @@
proc_defconv pi_slot_put_interlace
arg @@x:word, @@y:word, @@slot:word
arg @@left:word, @@top:word, @@slot:word
local @@row_num:word, @@row_buf:dword
push si
push di
mov si, @@y
mov si, @@top
mov di, @@slot
mov bx, di
shl bx, 2
@ -16,7 +16,7 @@ proc_defconv pi_slot_put_interlace
jmp short @@check
@@put:
push @@x
push @@left
push si
pushd @@row_buf
mov bx, di

View File

@ -1,10 +1,10 @@
proc_defconv pi_slot_put_quarter
arg @@x:word, @@y:word, @@slot:word, @@quarter:word
arg @@left:word, @@top:word, @@slot:word, @@quarter:word
local @@row_num:word, @@row_buf:dword
push si
push di
mov si, @@y
mov si, @@top
mov di, @@quarter
mov bx, @@slot
shl bx, 2
@ -42,7 +42,7 @@ proc_defconv pi_slot_put_quarter
jmp short @@check
@@put:
call graph_pack_put_8 pascal, @@x, si, @@row_buf, 320
call graph_pack_put_8 pascal, @@left, si, @@row_buf, 320
inc si
cmp si, 400
jl short @@next_row

View File

@ -19,6 +19,6 @@
#define PLAYFIELD_VRAM_W_BORDERED (PLAYFIELD_W_BORDERED / BYTE_DOTS)
extern int playfield_fg_shift_x[PLAYFIELD_COUNT];
extern screen_x_t playfield_fg_shift_x[PLAYFIELD_COUNT];
int pascal playfield_fg_x_to_screen(Subpixel x, unsigned int pid);
screen_x_t pascal playfield_fg_x_to_screen(Subpixel x, unsigned int pid);

View File

@ -36,10 +36,10 @@ void pascal near shots_render(void)
for(int i = 0; i < SHOTPAIR_COUNT; i++, shotpair++) {
if(shotpair->flag) {
int so = shotpair->so_anim + shotpair->so_pid;
int left = playfield_fg_x_to_screen(
screen_x_t left = playfield_fg_x_to_screen(
shotpair->topleft.x, shotpair->pid
);
int top = shotpair->topleft.y.to_screen() + PLAYFIELD_Y;
screen_y_t top = shotpair->topleft.y.to_screen() + PLAYFIELD_Y;
sprite16_put(left + 0, top, so);
sprite16_put(left + SHOTPAIR_DISTANCE, top, so);

View File

@ -7,6 +7,8 @@
extern "C" {
#include <dos.h>
#include "platform.h"
#include "pc98.h"
#include "libs/sprite16/sprite16.h"
#include "th03/sprite16.hpp"
@ -22,7 +24,7 @@ extern "C" {
#define RESULT_IS_ZERO (_FLAGS & 0x40)
#define SETUP_VARS(left, screen_top, sprite_offset) \
#define SETUP_VARS(left, top, sprite_offset) \
sprite_offset_local = sprite_offset; \
putpos_left = left; \
put_w_words = sprite16_put_w.v; \
@ -33,10 +35,10 @@ extern "C" {
clip_left = sprite16_clip_left; \
clip_right = sprite16_clip_right;
#define CALL_PUT(left, screen_top, put_w_words, sprite_offset) \
#define CALL_PUT(left, top, put_w_words, sprite_offset) \
_AH = SPRITE16_PUT; \
_DX = putpos_left; \
_BX = screen_top; \
_BX = top; \
static_cast<int>(_BX) >>= 1; \
_AL = put_w_words; \
_CX = sprite16_put_h; \
@ -62,13 +64,13 @@ extern "C" {
} \
} while(putpos_right >= clip_right);
void pascal sprite16_put(int left, int screen_top, int sprite_offset)
void pascal sprite16_put(screen_x_t left, screen_y_t top, int sprite_offset)
{
SETUP_VARS(left, screen_top, sprite_offset);
SETUP_VARS(left, top, sprite_offset);
if(putpos_right < clip_right) {
if(putpos_left >= clip_left) {
put:
CALL_PUT(putpos_left, screen_top, put_w_words, sprite_offset_local);
CALL_PUT(putpos_left, top, put_w_words, sprite_offset_local);
return;
} else if(putpos_right < clip_left) {
return;
@ -87,16 +89,16 @@ put:
#pragma codestring "\x90"
void pascal sprite16_putx(
int left, int screen_top, int sprite_offset, sprite16_put_func_t func
screen_x_t left, screen_y_t top, int sprite_offset, sprite16_put_func_t func
)
{
SETUP_VARS(left, screen_top, sprite_offset);
SETUP_VARS(left, top, sprite_offset);
if(putpos_right < clip_right) {
if(putpos_left >= clip_left) {
put:
_AH = SPRITE16_PUT;
_DX = putpos_left;
_BX = screen_top;
_BX = top;
static_cast<int>(_BX) >>= 1;
_AL = put_w_words;
_CX = sprite16_put_h;
@ -129,7 +131,9 @@ end:
#pragma codestring "\x90"
void pascal sprite16_put_noclip(int left, int screen_top, int sprite_offset)
void pascal sprite16_put_noclip(
screen_x_t left, screen_y_t top, int sprite_offset
)
{
// A completely useless SETUP_VARS variant without the `put_w_words`
// assignment, which actually makes it incorrect...
@ -140,7 +144,7 @@ void pascal sprite16_put_noclip(int left, int screen_top, int sprite_offset)
putpos_right <<= 4;
putpos_right += putpos_left;
CALL_PUT(putpos_left, screen_top, sprite16_put_w.v, sprite_offset_local);
CALL_PUT(putpos_left, top, sprite16_put_w.v, sprite_offset_local);
}
}

View File

@ -2,8 +2,8 @@
extern int sprite16_put_h;
extern VRAMWord sprite16_put_w;
extern int sprite16_clip_left;
extern int sprite16_clip_right;
extern screen_x_t sprite16_clip_left;
extern screen_x_t sprite16_clip_right;
enum sprite16_put_func_t {
SPF_NORMAL = 0,
@ -20,10 +20,12 @@ enum sprite16_put_func_t {
// the left and right clipping points, so make sure to hide at least 16 more
// pixels right of `sprite16_clip_left` and left of `sprite16_clip_right` on
// purpose.
void pascal sprite16_put(int left, int screen_top, int sprite_offset);
void pascal sprite16_put(screen_x_t left, screen_y_t top, int sprite_offset);
// Like sprite16_put(), but using an optional drawing function.
void pascal sprite16_putx(
int left, int screen_top, int sprite_offset, sprite16_put_func_t func
screen_x_t left, screen_y_t top, int sprite_offset, sprite16_put_func_t func
);
// Like sprite16_put(), but ignores the clipping points.
void pascal sprite16_put_noclip(int left, int screen_top, int sprite_offset);
void pascal sprite16_put_noclip(
screen_x_t left, screen_y_t top, int sprite_offset
);

View File

@ -6,4 +6,4 @@ void pascal bgimage_put(void);
void pascal bgimage_free(void);
// Blits the rectangle from (⌊x/16⌋*16, y) to (⌈((x + w)/16)*16⌉, (y + h))
// on the [bgimage] to the same position in VRAM.
void pascal bgimage_put_rect(int x, int y, int w, int h);
void pascal bgimage_put_rect(screen_x_t left, screen_y_t top, int w, int h);

View File

@ -3,8 +3,8 @@ bgimage_put_rect proc far
@@h = word ptr 6
@@w = word ptr 8
@@y = word ptr 0Ah
@@x = word ptr 0Ch
@@top = word ptr 0Ah
@@left = word ptr 0Ch
push bp
mov bp, sp
@ -12,8 +12,8 @@ bgimage_put_rect proc far
push si
push ds
cld
mov ax, [bp+@@x]
mov dx, [bp+@@y]
mov ax, [bp+@@left]
mov dx, [bp+@@top]
mov bx, ax
sar bx, 4
shl bx, 1

View File

@ -21,5 +21,5 @@ void pascal near bb_stage_load(const char far* fn);
#define bb_txt_put_8(left, top, sprite) \
_CX = sprite; \
bb_txt_put_8_raw(left, top);
void __fastcall near bb_txt_put_8_raw(unsigned int left, unsigned int top);
void __fastcall near bb_txt_put_8_raw(uscreen_x_t left, uvram_y_t top);
/// ---------------------

View File

@ -1,5 +1,9 @@
// ORs a single plane of the CDG image in the given [slot] into the given
// VRAM destination plane at (⌊x/8⌋*8, y), wrapped vertically.
// VRAM destination plane at (⌊left/8⌋*8, top), wrapped vertically.
void pascal cdg_put_plane_roll(
int x, int y, int slot, vram_plane_t plane_src, void __seg *plane_dst
screen_x_t left,
vram_y_t top,
int slot,
vram_plane_t plane_src,
void __seg *plane_dst
);

View File

@ -1,6 +1,6 @@
; Displays the CDG image in the given [slot] at (⌊x/8⌋*8, y).
; Displays the CDG image in the given [slot] at (⌊left/8⌋*8, top).
; void pascal cdg_put(int x, int y, int slot);
; void pascal cdg_put(screen_x_t left, vram_y_t top, int slot);
public CDG_PUT
cdg_put proc far

View File

@ -1,20 +1,20 @@
; Displays the CDG image in the given [slot] at (⌊x/8⌋*8, y), disregarding its
; alpha plane.
; Displays the CDG image in the given [slot] at (⌊left/8⌋*8, top),
; disregarding its alpha plane.
; void pascal cdg_put_noalpha(int x, int y, int slot);
; void pascal cdg_put_noalpha(screen_x_t left, vram_y_t top, int slot);
public CDG_PUT_NOALPHA
cdg_put_noalpha proc far
@@slot = word ptr 6
@@y = word ptr 8
@@x = word ptr 10
@@top = word ptr 8
@@left = word ptr 10
push bp
mov bp, sp
push si
push di
push ds
mov ax, [bp+@@y]
mov ax, [bp+@@top]
mov bx, ax
shl ax, 2
add ax, bx
@ -29,7 +29,7 @@ cdg_put_noalpha proc far
mov si, [bp+@@slot]
shl si, 4
add si, offset _cdg_slots
mov bx, [bp+@@x]
mov bx, [bp+@@left]
sar bx, 3
add bx, [si+CDGSlot.vram_byte_at_bottom_left]
mov ax, [si+CDGSlot.width_divided_by_32]

View File

@ -1,13 +1,13 @@
; Displays the CDG image in the given [slot] at (⌊x/8⌋*8, y), disregarding its
; color planes.
; Displays the CDG image in the given [slot] at (⌊left/8⌋*8, top),
; disregarding its color planes.
; void pascal cdg_put_nocolors(int x, int y, int slot);
; void pascal cdg_put_nocolors(screen_x_t left, vram_y_t top, int slot);
public CDG_PUT_NOCOLORS
cdg_put_nocolors proc far
@@slot = word ptr 6
@@y = word ptr 8
@@x = word ptr 10
@@top = word ptr 8
@@left = word ptr 10
push bp
mov bp, sp
@ -16,7 +16,7 @@ cdg_put_nocolors proc far
mov si, [bp+@@slot]
shl si, 4
add si, offset _cdg_slots
mov di, [bp+@@x]
mov di, [bp+@@left]
sar di, 3
add di, [si+CDGSlot.vram_byte_at_bottom_left]
mov ax, [si+CDGSlot.width_divided_by_32]
@ -29,7 +29,7 @@ endif
shl ax, 2
add ax, (640 / 8)
mov dx, ax
mov ax, [bp+@@y]
mov ax, [bp+@@top]
if GAME eq 4
mov bx, ax
shl ax, 2

View File

@ -6,14 +6,14 @@
; actually doesn't apply any sort of effect on the pixel data, and relies on
; the individual planes being pre-dissolved.)
; void pascal cdg_put_plane(int x, int y, int slot, int plane)
; void pascal cdg_put_plane(screen_x_t left, vram_y_t top, int slot, int plane)
public CDG_PUT_PLANE
cdg_put_plane proc far
@@plane = word ptr 6
@@slot = word ptr 8
@@y = word ptr 0Ah
@@x = word ptr 0Ch
@@top = word ptr 0Ah
@@left = word ptr 0Ch
push bp
mov bp, sp
@ -22,7 +22,7 @@ cdg_put_plane proc far
mov si, [bp+@@slot]
shl si, 4
add si, offset _cdg_slots
mov cx, [bp+@@x]
mov cx, [bp+@@left]
mov di, cx
sar di, 4
shl di, 1
@ -40,7 +40,7 @@ cdg_put_plane proc far
shl ax, 1
add ax, (640 / 8)
mov dx, ax
mov ax, [bp+@@y]
mov ax, [bp+@@top]
mov bx, ax
shl ax, 2
add ax, bx

View File

@ -4,8 +4,8 @@ cdg_put_plane_roll proc far
@@plane_dst = word ptr [bp+6]
@@plane_src = word ptr [bp+8]
@@slot = word ptr [bp+10]
@@y = word ptr [bp+12]
@@x = word ptr [bp+14]
@@top = word ptr [bp+12]
@@left = word ptr [bp+14]
@@stride_backwards equ dx
@@h equ bx
@ -19,10 +19,10 @@ cdg_put_plane_roll proc far
mov si, @@slot
shl si, 4
add si, offset _cdg_slots
mov di, @@x
mov di, @@left
sar di, 3
mov @@h, [si+CDGSlot.pixel_height]
mov ax, @@y
mov ax, @@top
add ax, @@h
dec ax
shl ax, 6

View File

@ -11,6 +11,6 @@
extern const dots16_t DIALOG_BOX_TILES[DIALOG_BOX_TILE_COUNT][DIALOG_BOX_TILE_H];
void pascal near dialog_box_put(unsigned int left, unsigned int top, int tile);
void pascal near dialog_box_put(uscreen_x_t left, uvram_y_t top, int tile);
void pascal near dialog_box_fade_in();
// ---

View File

@ -4,8 +4,12 @@
; パターンの表示(16x16/32x32限定, 4色以内, 画面上下連続)
;
; Functions/Procedures:
; void z_super_roll_put_tiny_32x32( int left<ax>, int top<dx>, int num ) ;
; void z_super_roll_put_tiny_16x16( int left<ax>, int top<dx>, int num ) ;
; void z_super_roll_put_tiny_32x32(
; screen_x_t left<ax>, vram_y_t top<dx>, int num
; );
; void z_super_roll_put_tiny_16x16(
; screen_x_t left<ax>, vram_y_t top<dx>, int num
; );
;
; Parameters:
; x,y 描画する座標

View File

@ -3,4 +3,6 @@
extern int graph_putsa_fx_func;
extern int graph_putsa_fx_spacing;
void pascal graph_putsa_fx(int x, int y, int color, const unsigned char *str);
void pascal graph_putsa_fx(
screen_x_t left, vram_y_t top, int color, const unsigned char *str
);

View File

@ -1 +1,3 @@
void pascal near score_stage_put(int x, int y, unsigned int g_stage);
void pascal near score_stage_put(
screen_x_t x, screen_y_t y, unsigned int g_stage
);

View File

@ -1,7 +1,7 @@
; Renders the boss battle background image at the given position, surrounded
; by the given background [color].
; void pascal near boss_backdrop_render(int x, int y, char color);
; void pascal near boss_backdrop_render(screen_x_t left, screen_y_t top, uint4_t color);
public BOSS_BACKDROP_RENDER
boss_backdrop_render proc near

View File

@ -123,8 +123,8 @@ extern bullet_t bullets[BULLET_COUNT];
/// ---------
union pellet_render_t {
struct {
int left;
int top;
screen_x_t left;
vram_y_t top;
} top;
struct {
uint16_t vram_offset;

View File

@ -2,7 +2,7 @@
; stored at pixel precision, as master.lib's grcg_circle() function doesn't
; support more than that anyway.
; void pascal circles_add_growing(int center_x, int center_y);
; void pascal circles_add_growing(Subpixel center_x, Subpixel center_y);
public CIRCLES_ADD_GROWING
circles_add_growing proc far
@@center_y = word ptr 6
@ -50,7 +50,7 @@ circles_add_growing proc far
circles_add_growing endp
; void pascal circles_add_shrinking(int center_x, int center_y);
; void pascal circles_add_shrinking(Subpixel center_x, Subpixel center_y);
public CIRCLES_ADD_SHRINKING
circles_add_shrinking proc far
@@center_y = word ptr 6

View File

@ -1,5 +1,5 @@
; void pascal far hud_bar_put(
; unsigned int y, unsigned char value, unsigned int atrb
; utram_y_t y, unsigned char value, unsigned int atrb
; );
public HUD_BAR_PUT
hud_bar_put proc far

View File

@ -61,11 +61,11 @@ extern const char gEXTRA_STAGE[12];
#define BGM_TRAM_CENTER_Y (vram_y_to_tram(BGM_CENTER_Y))
#define BGM_TRAM_RIGHT (PLAYFIELD_TRAM_RIGHT - 1)
inline int bgm_note_tram_left(int title_len)
inline tram_x_t bgm_note_tram_left(int title_len)
{
return ((BGM_TRAM_RIGHT - (GAIJI_TRAM_W + 1)) - title_len);
}
inline int bgm_title_tram_left(int title_len)
inline tram_x_t bgm_title_tram_left(int title_len)
{
return (BGM_TRAM_RIGHT - title_len);
}
@ -74,10 +74,12 @@ inline int bgm_title_tram_left(int title_len)
// with the given halfwidth length, starting at the given text RAM X column
// and playfield-space Y position.
// Assumes that the GRCG is active, and set to the intended color.
void pascal near popup_dissolve_put(int tram_left, subpixel_t top, int ank_len)
void pascal near popup_dissolve_put(
tram_x_t tram_left, subpixel_t top, int ank_len
)
{
int vram_left = tram_left;
int vram_right = ank_len;
vram_x_t vram_left = tram_left;
vram_x_t vram_right = ank_len;
vram_left--;
vram_right += vram_left;

View File

@ -21,7 +21,7 @@ struct item_splash_t {
extern item_splash_t item_splashes[ITEM_SPLASH_COUNT];
extern unsigned char item_splash_last_id;
void __fastcall near item_splash_dot_render(int x, int vram_y);
void __fastcall near item_splash_dot_render(screen_x_t x, vram_y_t vram_y);
void pascal near item_splashes_init(void);
void pascal near item_splashes_add(Subpixel x, Subpixel y);
void pascal near item_splashes_update(void);

View File

@ -81,7 +81,7 @@ extern pointnum_t near *pointnum_first_yellow_alive;
#define pointnum_put(left, top, numeral) \
_CX = numeral; \
pointnum_put_raw(patnum);
void __fastcall near pointnum_put_raw(int top, int left);
void __fastcall near pointnum_put_raw(vram_y_t top, screen_x_t left);
void pascal near pointnums_render(void);
/// ---------

View File

@ -5,8 +5,8 @@ extern SubpixelLength8 scroll_subpixel_line;
extern SubpixelLength8 scroll_speed;
// Current line at the top of VRAM.
extern int scroll_line;
extern int scroll_line_on_page[2];
extern vram_y_t scroll_line;
extern vram_y_t scroll_line_on_page[2];
// Playfield-space pixels scrolled in the last frame.
extern Subpixel scroll_last_delta;
@ -17,8 +17,8 @@ extern bool scroll_active;
// Transforms [y] to its corresponding VRAM line, adding the current
// [scroll_line] or 0 if scrolling is disabled.
int pascal near scroll_subpixel_y_to_vram_seg1(subpixel_t y);
int pascal near scroll_subpixel_y_to_vram_seg3(subpixel_t y);
vram_y_t pascal near scroll_subpixel_y_to_vram_seg1(subpixel_t y);
vram_y_t pascal near scroll_subpixel_y_to_vram_seg3(subpixel_t y);
// Like the one above, but always adds [scroll_line], even if scrolling is
// disabled.
int pascal near scroll_subpixel_y_to_vram_always(subpixel_t y);
vram_y_t pascal near scroll_subpixel_y_to_vram_always(subpixel_t y);

View File

@ -1,9 +1,9 @@
; Draws the hardcoded spark sprite with the given ID, with ([x], [vram_y])
; Draws the hardcoded spark sprite with the given ID at the given position.
; pointing to the top-left point. Assumptions:
; • ES is already be set to the beginning of a VRAM segment
; • The GRCG is active, and set to the intended color
; void near fastcall spark_render(int x, int vram_y, int sprite_id);
; void near fastcall spark_render(screen_x_t left, vram_y_t top, int sprite_id);
public @spark_render
@spark_render proc near
push si

View File

@ -1,24 +1,20 @@
; [playfield_x], [playfield_y], and [distance] are given in units of 1/16th of
; a pixel.
; ----------------------------------------------------------------------------
; Adds [count] new spark sprites with the given [distance] in random
; directions away from ([playfield_x], [playfield_y]).
; directions away from ([center_x], [center_y]).
; int pascal sparks_add_random(unsigned int playfield_x, unsigned int playfield_y, int distance, int count);
; int pascal sparks_add_random(Subpixel center_x, Subpixel center_y, Subpixel distance, int count);
public SPARKS_ADD_RANDOM
sparks_add_random proc far
@@count = word ptr 6
@@distance = word ptr 8
@@playfield_y = word ptr 0Ah
@@playfield_x = word ptr 0Ch
@@count = word ptr 6
@@distance = word ptr 8
@@center_y = word ptr 0Ah
@@center_x = word ptr 0Ch
push bp
mov bp, sp
cmp [bp+@@playfield_x], (PLAYFIELD_W shl 4)
cmp [bp+@@center_x], (PLAYFIELD_W shl 4)
ja short @@ret
cmp [bp+@@playfield_y], (PLAYFIELD_H shl 4)
cmp [bp+@@center_y], (PLAYFIELD_H shl 4)
ja short @@ret
push si
push di
@ -30,9 +26,9 @@ sparks_add_random proc far
cmp [si+spark_t.flag], 0
jnz short @@wrap_offset?
mov word ptr [si+spark_t.flag], 1
mov ax, [bp+@@playfield_x]
mov ax, [bp+@@center_x]
mov [si+spark_t.pos.cur.x], ax
mov ax, [bp+@@playfield_y]
mov ax, [bp+@@center_y]
mov [si+spark_t.pos.cur.y], ax
call randring2_next16_and pascal, ((2 shl 4) - 1)
add ax, [bp+@@distance]
@ -58,23 +54,23 @@ sparks_add_random endp
; Adds [count] new spark sprites along a circle with the given [distance] away
; from ([playfield_x], [playfield_y]). Obviously ignores the random angle set
; in sparks_init().
; from ([center_x], [center_y]). Obviously ignores the random angle set in
; sparks_init().
; int pascal sparks_add_circle(unsigned int playfield_x, unsigned int playfield_y, int distance, int count);
; int pascal sparks_add_circle(Subpixel center_x, Subpixel center_y, Subpixel distance, int count);
public SPARKS_ADD_CIRCLE
sparks_add_circle proc near
@@count = word ptr 4
@@distance = word ptr 6
@@playfield_y = word ptr 8
@@playfield_x = word ptr 0Ah
@@count = word ptr 4
@@distance = word ptr 6
@@center_y = word ptr 8
@@center_x = word ptr 0Ah
push bp
mov bp, sp
cmp [bp+@@playfield_x], (PLAYFIELD_W shl 4)
cmp [bp+@@center_x], (PLAYFIELD_W shl 4)
ja short @@ret
cmp [bp+@@playfield_y], (PLAYFIELD_H shl 4)
cmp [bp+@@center_y], (PLAYFIELD_H shl 4)
ja short @@ret
push si
push di
@ -87,9 +83,9 @@ sparks_add_circle proc near
cmp [si+spark_t.flag], 0
jnz short @@wrap_offset?
mov word ptr [si+spark_t.flag], 1
mov ax, [bp+@@playfield_x]
mov ax, [bp+@@center_x]
mov [si+spark_t.pos.cur.x], ax
mov ax, [bp+@@playfield_y]
mov ax, [bp+@@center_y]
mov [si+spark_t.pos.cur.y], ax
lea ax, [si+spark_t.pos.velocity]
push ax

View File

@ -11,23 +11,23 @@
// Window width and height, including the border
extern Point window_tiles;
void pascal near window_dropdown_row(int left_x, int bottom_y)
void pascal near window_dropdown_row(screen_x_t left_x, screen_y_t bottom_y)
{
}
void pascal near window_rollup_row(int left_x, int bottom_y)
void pascal near window_rollup_row(screen_x_t left_x, screen_y_t bottom_y)
{
}
void pascal near window_dropdown_animate(int left_x, int top_y)
void pascal near window_dropdown_animate(screen_x_t left_x, screen_y_t top_y)
{
}
void pascal near window_singleline(int left_x, int top_y)
void pascal near window_singleline(screen_x_t left_x, screen_y_t top_y)
{
}
void pascal near window_rollup_animate(int left_x, int top_y)
void pascal near window_rollup_animate(screen_x_t left_x, screen_y_t top_y)
{
}

View File

@ -4,7 +4,9 @@ int pascal pi_slot_free(int slot);
// Like pi_slot_put() and pi_slot_put_quarter(), but applying the mask with
// the given ID while blitting.
int pascal pi_slot_put_mask(int x, int y, int slot, int mask_id);
int pascal pi_slot_put_quarter_mask(
int x, int y, int slot, int quarter, int mask_id
int pascal pi_slot_put_mask(
screen_x_t left, vram_y_t top, int slot, int mask_id
);
int pascal pi_slot_put_quarter_mask(
screen_x_t left, vram_y_t top, int slot, int quarter, int mask_id
);

View File

@ -1,7 +1,7 @@
proc_defconv pi_slot_put
@@slot = word ptr [bp + (cPtrSize + 2)]
@@y = word ptr [bp + (cPtrSize + 4)]
@@x = word ptr [bp + (cPtrSize + 6)]
@@top = word ptr [bp + (cPtrSize + 4)]
@@left = word ptr [bp + (cPtrSize + 6)]
push bp
mov bp, sp
@ -12,8 +12,8 @@ proc_defconv pi_slot_put
shl si, 2
les si, _pi_slot_buffers[si]
imul di, size PiHeader
push @@x
push @@y
push @@left
push @@top
mov ax, _pi_slot_headers.PiHeader._xsize[di]
push ax
shr ax, 1
@ -32,8 +32,8 @@ endp_defconv
proc_defconv pi_slot_put_quarter
@@quarter = byte ptr [bp + (cPtrSize + 2)]
@@slot = word ptr [bp + (cPtrSize + 4)]
@@y = word ptr [bp + (cPtrSize + 6)]
@@x = word ptr [bp + (cPtrSize + 8)]
@@top = word ptr [bp + (cPtrSize + 6)]
@@left = word ptr [bp + (cPtrSize + 8)]
push bp
mov bp, sp
@ -59,8 +59,8 @@ proc_defconv pi_slot_put_quarter
mov ax, es
add ax, dx
mov es, ax
push @@x
push @@y
push @@left
push @@top
push 320
push 320
mov di, 200
@ -76,25 +76,25 @@ endp_defconv
; void pascal pi_slot_put_mask_rowloop(
; void far *pi_buf<es:si>,
; int h<di>,
; int x, int y, int w, size_t stride_packed
; screen_x_t x, vram_y_t y, int w, size_t stride_packed
; );
pi_slot_put_rowloop proc near
@@stride_packed = word ptr [bp+2]
@@w = word ptr [bp+4]
@@y = word ptr [bp+6]
@@x = word ptr [bp+8]
@@top = word ptr [bp+6]
@@left = word ptr [bp+8]
@@h equ di
mov bp, sp
@@put_row:
push es
call graph_pack_put_8_noclip pascal, @@x, @@y, es, si, @@w
call graph_pack_put_8_noclip pascal, @@left, @@top, es, si, @@w
pop es
inc @@y
cmp @@y, RES_Y
inc @@top
cmp @@top, RES_Y
jb short @@next_row
sub @@y, RES_Y
sub @@top, RES_Y
@@next_row:
add si, @@stride_packed

View File

@ -2,8 +2,8 @@ public PI_SLOT_PUT_MASK
pi_slot_put_mask proc far
@@mask_id = word ptr 6
@@slot = word ptr 8
@@y = word ptr 0Ah
@@x = word ptr 0Ch
@@top = word ptr 0Ah
@@left = word ptr 0Ch
push bp
mov bp, sp
@ -15,8 +15,8 @@ pi_slot_put_mask proc far
les si, _pi_slot_buffers[si]
assume es:nothing
imul di, size PiHeader
push [bp+@@x]
push [bp+@@y]
push [bp+@@left]
push [bp+@@top]
mov ax, _pi_slot_headers._xsize[di]
push ax
shr ax, 1
@ -38,8 +38,8 @@ pi_slot_put_quarter_mask proc far
@@mask_id = word ptr 6
@@quarter = byte ptr 8
@@slot = word ptr 0Ah
@@y = word ptr 0Ch
@@x = word ptr 0Eh
@@top = word ptr 0Ch
@@left = word ptr 0Eh
push bp
mov bp, sp
@ -67,8 +67,8 @@ pi_slot_put_quarter_mask proc far
mov es, ax
assume es:nothing
mov di, 200
push [bp+@@x]
push [bp+@@y]
push [bp+@@left]
push [bp+@@top]
push 320
push 320
mov ax, [bp+@@mask_id]
@ -86,13 +86,13 @@ pi_slot_put_quarter_mask endp
; int mask_id<ax>,
; void far *pi_buf<es:si>,
; int h<di>,
; int x, int y, int w, size_t stride_packed
; screen_x_t left, vram_y_t top, int w, size_t stride_packed
; );
pi_slot_put_mask_rowloop proc near
@@stride_packed = word ptr [bp+2]
@@w = word ptr [bp+4]
@@y = word ptr [bp+6]
@@x = word ptr [bp+8]
@@top = word ptr [bp+6]
@@left = word ptr [bp+8]
@@mask_id equ ax
@@h equ di
@ -102,9 +102,9 @@ TEMP_ROW = RES_Y
add @@mask_id, offset _PI_MASKS
mov _pi_mask_ptr, @@mask_id
mov bp, sp
mov dx, @@x
mov dx, @@left
shr dx, 3
mov ax, @@y
mov ax, @@top
shl ax, 6
add dx, ax
shr ax, 2

View File

@ -13,7 +13,7 @@ MAIN_01_TEXT segment word public 'CODE' use16
assume cs:MAIN_01_TEXT
; void pascal near hud_bar_put(
; unsigned int y, unsigned char value, unsigned int atrb
; utram_y_t y, unsigned char value, unsigned int atrb
; );
public HUD_BAR_PUT
HUD_BAR_PUT proc near

Some files were not shown because too many files have changed in this diff Show More