diff --git a/planar.h b/planar.h index ede10a19..cb49a154 100644 --- a/planar.h +++ b/planar.h @@ -129,11 +129,7 @@ static inline vram_offset_t vram_offset_muldiv(screen_x_t x, vram_y_t y) { return (y * ROW_SIZE) + (x / BYTE_DOTS); } -static inline vram_offset_t vram_offset_divmul(screen_x_t x, vram_y_t y) { - return (x / BYTE_DOTS) + (y * ROW_SIZE); -} - -static inline vram_offset_t vram_offset_divmul_double(double x, double y) { +template inline vram_offset_t vram_offset_divmul(T x, T y) { return (x / BYTE_DOTS) + (y * ROW_SIZE); } diff --git a/th01/main/boss/b20m.cpp b/th01/main/boss/b20m.cpp index 97c231e4..5570736f 100644 --- a/th01/main/boss/b20m.cpp +++ b/th01/main/boss/b20m.cpp @@ -245,7 +245,7 @@ static const int PARTICLE2X2_COUNT = 30; static const dots8_t sPARTICLE2X2 = 0xC0; // (** ) #define particle2x2_linear_vram_offset(vo, first_bit, left, top) { \ - vo = vram_offset_divmul_double(left, top); \ + vo = vram_offset_divmul(left, top); \ first_bit = (static_cast(left) % BYTE_DOTS); \ } @@ -1342,7 +1342,7 @@ void pascal near particles2x2_vertical_unput_update_render(bool16 from_bottom) top[i] += velocity_y[i]; // Recalculate VRAM offset and clip - vo = vram_offset_divmul_double(left[i], top[i]); + vo = vram_offset_divmul(left[i], top[i]); if((vo >= (((RES_Y - PARTICLE2X2_H) + 1) * ROW_SIZE) || (vo < 0))) { col[i] = 0; continue;