mirror of https://github.com/nmlgc/ReC98.git
[Maintenance] [th04/th05] Move `PlayfieldPoint` into TH04's playfield header
It has a hidden dependency on TH04's scroll functions, and TH02 seems to use screen coordinates throughout. Part of P0284, funded by [Anonymous] and Blue Bolt.
This commit is contained in:
parent
15f89da4ee
commit
3b46fd9138
|
@ -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"
|
||||
|
|
|
@ -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<PlayfieldPoint> {
|
||||
// Moves by one step, and returns the new current position.
|
||||
|
|
Loading…
Reference in New Issue