diff --git a/pc98.h b/pc98.h index 32a7a121..81d28bfa 100644 --- a/pc98.h +++ b/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 { diff --git a/th01/main/boss/b10j.cpp b/th01/main/boss/b10j.cpp index e3abbf92..711fa566 100644 --- a/th01/main/boss/b10j.cpp +++ b/th01/main/boss/b10j.cpp @@ -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 diff --git a/th01/math/subpixel.hpp b/th01/math/subpixel.hpp index aadf5470..6c91a388 100644 --- a/th01/math/subpixel.hpp +++ b/th01/math/subpixel.hpp @@ -102,8 +102,8 @@ struct SPPoint : public SPPointBase { }; // 8-bit (Q4.4) -typedef SubpixelBase SubpixelLength8; -typedef SubpixelBase Subpixel8; +typedef SubpixelBase SubpixelLength8; +typedef SubpixelBase Subpixel8; typedef SPPointBase SPPoint8; // ------------------------------------------------------------------------- diff --git a/th02/main/player/bomb.cpp b/th02/main/player/bomb.cpp index b7de2718..6e2be03d 100644 --- a/th02/main/player/bomb.cpp +++ b/th02/main/player/bomb.cpp @@ -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( diff --git a/th02/main/scroll.hpp b/th02/main/scroll.hpp index c0477c5f..3b7b974d 100644 --- a/th02/main/scroll.hpp +++ b/th02/main/scroll.hpp @@ -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; diff --git a/th02/main/tile/tile.cpp b/th02/main/tile/tile.cpp index 44c3d3e7..985b85c0 100644 --- a/th02/main/tile/tile.cpp +++ b/th02/main/tile/tile.cpp @@ -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) { diff --git a/th05/main/bullet/laser.cpp b/th05/main/bullet/laser.cpp index fc38cd76..057e7582 100644 --- a/th05/main/bullet/laser.cpp +++ b/th05/main/bullet/laser.cpp @@ -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, diff --git a/th05/main/bullet/laser.hpp b/th05/main/bullet/laser.hpp index 6a852f36..6ec7d488 100644 --- a/th05/main/bullet/laser.hpp +++ b/th05/main/bullet/laser.hpp @@ -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) {