mirror of https://github.com/nmlgc/ReC98.git
[Maintenance] Declare 8-bit pixel delta and length types
Part of P0242, funded by Yanga.
This commit is contained in:
parent
08352a5a81
commit
9aad9ad114
2
pc98.h
2
pc98.h
|
@ -12,6 +12,8 @@
|
|||
// Display-space widths, heights, and object-space coordinates
|
||||
typedef int pixel_t;
|
||||
typedef unsigned int upixel_t;
|
||||
typedef int8_t pixel_delta_8_t;
|
||||
typedef uint8_t pixel_length_8_t;
|
||||
|
||||
// A version of master.lib's Point without the constructor, even in C++
|
||||
struct point_t {
|
||||
|
|
|
@ -98,7 +98,7 @@ bool meteor_active = true;
|
|||
uint8_t spreadin_interval = 4;
|
||||
|
||||
// Sprite pixels to spread in per frame, in one half of Mima's sprite
|
||||
uint8_t spreadin_speed = 8;
|
||||
pixel_length_8_t spreadin_speed = 8;
|
||||
// -----
|
||||
|
||||
// Entities
|
||||
|
|
|
@ -102,8 +102,8 @@ struct SPPoint : public SPPointBase<Subpixel> {
|
|||
};
|
||||
|
||||
// 8-bit (Q4.4)
|
||||
typedef SubpixelBase<subpixel_length_8_t, subpixel_length_8_t> SubpixelLength8;
|
||||
typedef SubpixelBase<char, char> Subpixel8;
|
||||
typedef SubpixelBase<subpixel_length_8_t, pixel_length_8_t> SubpixelLength8;
|
||||
typedef SubpixelBase<char, pixel_delta_8_t> Subpixel8;
|
||||
typedef SPPointBase<Subpixel8> SPPoint8;
|
||||
// -------------------------------------------------------------------------
|
||||
|
||||
|
|
|
@ -64,7 +64,7 @@ void near bomb_update_and_render(void)
|
|||
}
|
||||
|
||||
// ZUN bloat: Needed to circumvent 16-bit promotion in a single comparison.
|
||||
inline int8_t bomb_particle_h(void) {
|
||||
inline pixel_delta_8_t bomb_particle_h(void) {
|
||||
return BOMB_PARTICLE_H;
|
||||
}
|
||||
|
||||
|
@ -74,7 +74,7 @@ void pascal near bomb_circle_point_put(screen_x_t left, screen_y_t top)
|
|||
#define first_bit_mirrored _DX
|
||||
|
||||
register const bomb_particle_dots_t near* sprite;
|
||||
int8_t y;
|
||||
pixel_delta_8_t y;
|
||||
unsigned int first_bit;
|
||||
|
||||
if(!overlap_xy_ltrb_lt_gt(
|
||||
|
|
|
@ -6,7 +6,7 @@ extern vram_y_t scroll_line;
|
|||
#if (GAME == 2)
|
||||
// Amount of pixels to be added to [scroll_line] on every scrolling
|
||||
// operation.
|
||||
extern uint8_t scroll_speed;
|
||||
extern pixel_length_8_t scroll_speed;
|
||||
|
||||
extern uint8_t scroll_cycle;
|
||||
|
||||
|
|
|
@ -24,7 +24,7 @@ typedef dots_t(TILE_W) tile_line_dots_t;
|
|||
// State
|
||||
// -----
|
||||
|
||||
extern int8_t tile_line_at_top;
|
||||
extern pixel_delta_8_t tile_line_at_top;
|
||||
extern vram_offset_t tile_image_vos[TILE_IMAGE_COUNT];
|
||||
extern pixel_t tile_copy_lines_top;
|
||||
extern pixel_t tile_copy_lines_h;
|
||||
|
@ -178,7 +178,7 @@ void pascal near tile_grcg_clear_8(vram_offset_t vo_topleft)
|
|||
}
|
||||
|
||||
// Enforces signed 8-bit comparisons in one place. MODDERS: Just remove this.
|
||||
inline int8_t tile_line_0(void) { return 0; }
|
||||
inline pixel_delta_8_t tile_line_0(void) { return 0; }
|
||||
|
||||
bool16 pascal tiles_scroll_and_egc_render_both(pixel_t speed)
|
||||
{
|
||||
|
|
|
@ -153,9 +153,9 @@ void near lasers_render(void)
|
|||
|
||||
// ZUN bloat: Only needed because we mutate [coords] for rendering the
|
||||
// inner ray.
|
||||
uint8_t width_orig = laser->coords.width.nonshrink;
|
||||
pixel_length_8_t width_orig = laser->coords.width.nonshrink;
|
||||
|
||||
uint8_t radius = laser->coords.width.nonshrink;
|
||||
pixel_length_8_t radius = laser->coords.width.nonshrink;
|
||||
|
||||
vector2_at(
|
||||
drawpoint,
|
||||
|
|
|
@ -38,20 +38,19 @@ struct laser_coords_t {
|
|||
|
||||
unsigned char angle;
|
||||
|
||||
// In pixels.
|
||||
union {
|
||||
// ZUN landmine: LF_FIXED_SHRINK and LF_FIXED_SHRINK_AND_WAIT_TO_GROW
|
||||
// are effectively limited to a maximum width of 127 pixels due to an
|
||||
// implementation convenience in their update code. For larger values,
|
||||
// their shrink animation wouldn't play, and the laser will transition
|
||||
// to its next flag immediately.
|
||||
int8_t shrink;
|
||||
pixel_delta_8_t shrink;
|
||||
|
||||
// Other types have no limit besides the 8-bit one inherent to the
|
||||
// type. Shootout lasers should probably still be kept below
|
||||
// LASER_SHOOTOUT_DECAY_WIDTH_MAX though, as any larger value would
|
||||
// skip the decay animation.
|
||||
uint8_t nonshrink;
|
||||
pixel_length_8_t nonshrink;
|
||||
} width;
|
||||
};
|
||||
|
||||
|
@ -77,9 +76,11 @@ struct Laser {
|
|||
// [age] at which a fixed laser should transition from LF_FIXED_ACTIVE to
|
||||
// LF_FIXED_SHRINK.
|
||||
int shrink_at_age;
|
||||
|
||||
// [width] (in pixels) at which a fixed laser should transition from
|
||||
// LF_FIXED_GROW to LF_FIXED_ACTIVE.
|
||||
uint8_t grow_to_width;
|
||||
pixel_length_8_t grow_to_width;
|
||||
|
||||
uint8_t padding[3];
|
||||
|
||||
void fixed_init(const PlayfieldPoint &origin) {
|
||||
|
|
Loading…
Reference in New Issue