diff --git a/th02/main/playfld.hpp b/th02/main/playfld.hpp index 9d903448..290139f1 100644 --- a/th02/main/playfld.hpp +++ b/th02/main/playfld.hpp @@ -181,34 +181,4 @@ PLAYFIELD_TOP + TO_PIXEL(subpixel_center_y) - (sprite_h / 2) \ ) -#ifdef SUBPIXEL_HPP - struct PlayfieldPoint : public SPPoint { - screen_x_t to_screen_left(pixel_t sprite_w_if_centered = 0) const { - return playfield_to_screen_left(x, sprite_w_if_centered); - } - - screen_y_t to_screen_top(pixel_t sprite_h_if_centered = 0) const { - return playfield_to_screen_top(y, sprite_h_if_centered); - } - - #ifdef SCROLL_HPP - vram_y_t to_vram_top_scrolled_seg1( - pixel_t sprite_h_if_centered - ) const { - return scroll_subpixel_y_to_vram_seg1( - y + (PLAYFIELD_TOP - (sprite_h_if_centered / 2)) - ); - } - - vram_y_t to_vram_top_scrolled_seg3( - pixel_t sprite_h_if_centered - ) const { - return scroll_subpixel_y_to_vram_seg3( - y + (PLAYFIELD_TOP - (sprite_h_if_centered / 2)) - ); - } - #endif - }; -#endif - #include "th01/main/playfld.hpp" diff --git a/th04/main/playfld.hpp b/th04/main/playfld.hpp index 17b3e86a..68f0a0a2 100644 --- a/th04/main/playfld.hpp +++ b/th04/main/playfld.hpp @@ -1,5 +1,35 @@ #include "th02/main/playfld.hpp" +#ifdef SUBPIXEL_HPP + struct PlayfieldPoint : public SPPoint { + screen_x_t to_screen_left(pixel_t sprite_w_if_centered = 0) const { + return playfield_to_screen_left(x, sprite_w_if_centered); + } + + screen_y_t to_screen_top(pixel_t sprite_h_if_centered = 0) const { + return playfield_to_screen_top(y, sprite_h_if_centered); + } + + #ifdef SCROLL_HPP + vram_y_t to_vram_top_scrolled_seg1( + pixel_t sprite_h_if_centered + ) const { + return scroll_subpixel_y_to_vram_seg1( + y + (PLAYFIELD_TOP - (sprite_h_if_centered / 2)) + ); + } + + vram_y_t to_vram_top_scrolled_seg3( + pixel_t sprite_h_if_centered + ) const { + return scroll_subpixel_y_to_vram_seg3( + y + (PLAYFIELD_TOP - (sprite_h_if_centered / 2)) + ); + } + #endif + }; +#endif + #if defined(SUBPIXEL_HPP) && defined(MOTION_HPP) struct PlayfieldMotion : public MotionBase { // Moves by one step, and returns the new current position.