1 #ifndef SPRITECHECKER_HH
2 #define SPRITECHECKER_HH
56 void reset(EmuTime::param time);
62 inline void sync(EmuTime::param time) {
63 if (!updateSpritesMethod) {
73 static bool syncInProgress =
false;
74 assert(!syncInProgress);
75 syncInProgress =
true;
80 syncInProgress =
false;
177 if (currentLine < limit) {
179 (this->*updateSpritesMethod)(limit);
202 collisionX = collisionY = 0;
209 frameStartTime.
reset(time);
242 if (line < 0)
return 0;
244 visibleSprites = spriteBuffer[line];
245 return spriteCount[line];
258 template<
typename Archive>
259 void serialize(Archive& ar,
unsigned version);
267 updateSpritesMethod =
nullptr;
270 updateSpritesMethod = &SpriteChecker::updateSprites1;
273 updateSpritesMethod = &SpriteChecker::updateSprites2;
285 void updateSprites1(
int limit);
289 void updateSprites2(
int limit);
299 [[nodiscard]]
inline SpritePattern calculatePatternNP(
unsigned patternNr,
unsigned y);
300 [[nodiscard]]
inline SpritePattern calculatePatternPlanar(
unsigned patternNr,
unsigned y);
312 inline void checkSprites1(
int minLine,
int maxLine);
324 inline void checkSprites2(
int minLine,
int maxLine);
327 using UpdateSpritesMethod = void (
SpriteChecker::*)(
int limit);
328 UpdateSpritesMethod updateSpritesMethod;
344 BooleanSetting& limitSpritesSetting;
348 Clock<VDP::TICKS_PER_SECOND> frameStartTime;
369 SpriteInfo spriteBuffer[313][32 + 1];
376 uint8_t spriteCount[313];
constexpr void reset(EmuTime::param e)
Reset the clock to start ticking at the given time.
constexpr unsigned getTicksTill_fast(EmuTime::param e) const
Same as above, only faster, Though the time interval may not be too large.
Represents a VDP display mode.
constexpr bool isPlanar() const
Is VRAM "planar" in the current display mode? Graphic 6 and 7 spread their bytes over two VRAM ICs,...
constexpr int getSpriteMode(bool isMSX1) const
Get the sprite mode of this display mode.
Class containing all settings for renderers.
void frameStart(EmuTime::param time)
Signals the start of a new frame.
void sync(EmuTime::param time)
Update sprite checking to specified time.
void reset(EmuTime::param time)
Puts the sprite checker in its initial state.
void serialize(Archive &ar, unsigned version)
void frameEnd(EmuTime::param time)
Signals the end of the current frame.
uint32_t SpritePattern
Bitmap of length 32 describing a sprite pattern.
void updateTransparency(bool tp, EmuTime::param time)
Informs the sprite checker of a change in the TP bit (R#8 bit 5)
int getCollisionX(EmuTime::param time)
Get X coordinate of sprite collision.
void updateVerticalScroll(int scroll, EmuTime::param time)
Informs the sprite checker of a vertical scroll change.
void updateWindow(bool, EmuTime::param time) override
Informs the observer that the entire VRAM window will change.
void updateDisplayMode(DisplayMode mode, EmuTime::param time)
Informs the sprite checker of a VDP display mode change.
void resetStatus()
Clear status bits triggered by reading of S#0.
void updateDisplayEnabled(bool enabled, EmuTime::param time)
Informs the sprite checker of a VDP display enabled change.
void checkUntil(EmuTime::param time)
Update sprite checking until specified line.
void updateSpriteSizeMag(byte sizeMag, EmuTime::param time)
Informs the sprite checker of sprite size or magnification changes.
int getCollisionY(EmuTime::param time)
Get Y coordinate of sprite collision.
void resetCollision()
Reset sprite collision coordinates.
void updateVRAM(unsigned, EmuTime::param time) override
Informs the observer of a change in VRAM contents.
SpriteChecker(VDP &vdp, RenderSettings &renderSettings, EmuTime::param time)
Create a sprite checker.
void updateSpritesEnabled(bool enabled, EmuTime::param time)
Informs the sprite checker of sprite enable changes.
int getSprites(int line, const SpriteInfo *&visibleSprites) const
Get sprites for a display line.
void sync(EmuTime::param time)
Update VRAM state to specified moment in time.
Unified implementation of MSX Video Display Processors (VDPs).
byte getStatusReg0() const
Should only be used by SpriteChecker.
static constexpr int TICKS_PER_LINE
Number of VDP clock ticks per line.
void setSpriteStatus(byte value)
Should only be used by SpriteChecker.
bool isMSX1VDP() const
Is this an MSX1 VDP?
Interface that can be registered at VRAMWindow, to be called when the contents of the VRAM inside tha...
This file implemented 3 utility functions:
SERIALIZE_CLASS_VERSION(CassettePlayer, 2)
void fill(ForwardRange &&range, const T &value)
Contains all the information to draw a line of a sprite.
SpritePattern pattern
Pattern of this sprite line, corrected for magnification.
byte colorAttrib
Bit 3..0 are index in palette.
int16_t x
X-coordinate of sprite, corrected for early clock.