mirror of https://github.com/stella-emu/stella.git
Fixed write to CTRLPF with score mode enabled and playfield priority disabled;
the priority as well as the colours change from left/right screen. Made getPixel method from each of the TIA objects inline, since they're called so often.
This commit is contained in:
parent
7fad9b7cfa
commit
1924013daf
|
@ -131,12 +131,6 @@ void Ball::tick()
|
|||
myCounter = 0;
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
uInt8 Ball::getPixel(uInt8 colorIn) const
|
||||
{
|
||||
return collision > 0 ? colorIn : myColor;
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
void Ball::shuffleStatus()
|
||||
{
|
||||
|
|
|
@ -55,7 +55,9 @@ class Ball : public Serializable
|
|||
|
||||
void tick();
|
||||
|
||||
uInt8 getPixel(uInt8 colorIn) const;
|
||||
uInt8 getPixel(uInt8 colorIn) const {
|
||||
return collision > 0 ? colorIn : myColor;
|
||||
}
|
||||
|
||||
void shuffleStatus();
|
||||
|
||||
|
|
|
@ -37,7 +37,8 @@ void LatchedInput::reset()
|
|||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
void LatchedInput::vblank(uInt8 value)
|
||||
{
|
||||
if (value & 0x40) myModeLatched = true;
|
||||
if (value & 0x40)
|
||||
myModeLatched = true;
|
||||
else {
|
||||
myModeLatched = false;
|
||||
myLatchedValue = 0x80;
|
||||
|
@ -57,4 +58,4 @@ uInt8 LatchedInput::inpt(bool pinState)
|
|||
return value;
|
||||
}
|
||||
|
||||
} // namespace TIA6502tsCore {
|
||||
} // namespace TIA6502tsCore
|
||||
|
|
|
@ -27,7 +27,6 @@ namespace TIA6502tsCore {
|
|||
class LatchedInput
|
||||
{
|
||||
public:
|
||||
|
||||
LatchedInput();
|
||||
|
||||
public:
|
||||
|
@ -45,7 +44,6 @@ class LatchedInput
|
|||
uInt8 myLatchedValue;
|
||||
|
||||
private:
|
||||
|
||||
LatchedInput(const LatchedInput&) = delete;
|
||||
LatchedInput(LatchedInput&&) = delete;
|
||||
LatchedInput& operator=(const LatchedInput&) = delete;
|
||||
|
@ -54,4 +52,4 @@ class LatchedInput
|
|||
|
||||
} // namespace TIA6502tsCore
|
||||
|
||||
#endif // TIA_6502TS_CORE_LATCHED_INPUT
|
||||
#endif // TIA_6502TS_CORE_LATCHED_INPUT
|
||||
|
|
|
@ -142,12 +142,6 @@ void Missile::setColor(uInt8 color)
|
|||
myColor = color;
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
uInt8 Missile::getPixel(uInt8 colorIn) const
|
||||
{
|
||||
return collision ? colorIn : myColor;
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
// TODO: implement this once the class is finalized
|
||||
bool Missile::save(Serializer& out) const
|
||||
|
|
|
@ -55,7 +55,9 @@ class Missile : public Serializable
|
|||
|
||||
void setColor(uInt8 color);
|
||||
|
||||
uInt8 getPixel(uInt8 colorIn) const;
|
||||
uInt8 getPixel(uInt8 colorIn) const {
|
||||
return collision ? colorIn : myColor;
|
||||
}
|
||||
|
||||
/**
|
||||
Serializable methods (see that class for more information).
|
||||
|
|
|
@ -162,12 +162,6 @@ void Player::tick()
|
|||
if (++myCounter >= 160) myCounter = 0;
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
uInt8 Player::getPixel(uInt8 colorIn) const
|
||||
{
|
||||
return collision ? colorIn : myColor;
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
void Player::shufflePatterns()
|
||||
{
|
||||
|
|
|
@ -56,7 +56,9 @@ class Player : public Serializable
|
|||
|
||||
void tick();
|
||||
|
||||
uInt8 getPixel(uInt8 colorIn) const;
|
||||
uInt8 getPixel(uInt8 colorIn) const {
|
||||
return collision ? colorIn : myColor;
|
||||
}
|
||||
|
||||
void shufflePatterns();
|
||||
|
||||
|
|
|
@ -128,14 +128,6 @@ void Playfield::tick(uInt32 x)
|
|||
collision = currentPixel ? 0 : myCollisionMask;
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
uInt8 Playfield::getPixel(uInt8 colorIn) const
|
||||
{
|
||||
if (!collision) return myX < 80 ? myColorLeft : myColorRight;
|
||||
|
||||
return colorIn;
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
void Playfield::applyColors()
|
||||
{
|
||||
|
|
|
@ -50,7 +50,10 @@ class Playfield : public Serializable
|
|||
|
||||
void tick(uInt32 x);
|
||||
|
||||
uInt8 getPixel(uInt8 colorIn) const;
|
||||
uInt8 getPixel(uInt8 colorIn) const {
|
||||
if (!collision) return myX < 80 ? myColorLeft : myColorRight;
|
||||
return colorIn;
|
||||
}
|
||||
|
||||
/**
|
||||
Serializable methods (see that class for more information).
|
||||
|
|
|
@ -346,7 +346,8 @@ bool TIA::poke(uInt16 address, uInt8 value)
|
|||
|
||||
case CTRLPF:
|
||||
myLinesSinceChange = 0;
|
||||
myPriority = (value & 0x04) ? Priority::inverted : Priority::normal;
|
||||
myPriority = (value & 0x04) ? Priority::pfp :
|
||||
(value & 0x02) ? Priority::score : Priority::normal;
|
||||
myPlayfield.ctrlpf(value);
|
||||
myBall.ctrlpf(value);
|
||||
break;
|
||||
|
@ -834,20 +835,55 @@ void TIA::renderPixel(uInt32 x, uInt32 y, bool lineNotCached)
|
|||
if (lineNotCached) {
|
||||
uInt8 color = myColorBk;
|
||||
|
||||
if (myPriority == Priority::normal) {
|
||||
color = myPlayfield.getPixel(color);
|
||||
color = myBall.getPixel(color);
|
||||
color = myMissile1.getPixel(color);
|
||||
color = myPlayer1.getPixel(color);
|
||||
color = myMissile0.getPixel(color);
|
||||
color = myPlayer0.getPixel(color);
|
||||
} else {
|
||||
color = myMissile1.getPixel(color);
|
||||
color = myPlayer1.getPixel(color);
|
||||
color = myMissile0.getPixel(color);
|
||||
color = myPlayer0.getPixel(color);
|
||||
color = myPlayfield.getPixel(color);
|
||||
color = myBall.getPixel(color);
|
||||
switch (myPriority)
|
||||
{
|
||||
// Playfield has priority so ScoreBit isn't used
|
||||
// Priority from highest to lowest:
|
||||
// BL/PF => P0/M0 => P1/M1 => BK
|
||||
case Priority::pfp: // CTRLPF D2=1, D1=ignored
|
||||
color = myMissile1.getPixel(color);
|
||||
color = myPlayer1.getPixel(color);
|
||||
color = myMissile0.getPixel(color);
|
||||
color = myPlayer0.getPixel(color);
|
||||
color = myPlayfield.getPixel(color);
|
||||
color = myBall.getPixel(color);
|
||||
break;
|
||||
|
||||
case Priority::score: // CTRLPF D2=0, D1=1
|
||||
// Score mode left half
|
||||
if (x < 80) {
|
||||
// Priority from highest to lowest:
|
||||
// PF/P0/M0 => P1/M1 => BL => BK
|
||||
color = myBall.getPixel(color);
|
||||
color = myMissile1.getPixel(color);
|
||||
color = myPlayer1.getPixel(color);
|
||||
color = myMissile0.getPixel(color);
|
||||
color = myPlayer0.getPixel(color);
|
||||
color = myPlayfield.getPixel(color);
|
||||
}
|
||||
else // Score mode right half
|
||||
{
|
||||
// Priority from highest to lowest:
|
||||
// P0/M0 => PF/P1/M1 => BL => BK
|
||||
color = myBall.getPixel(color);
|
||||
color = myMissile1.getPixel(color);
|
||||
color = myPlayer1.getPixel(color);
|
||||
color = myPlayfield.getPixel(color);
|
||||
color = myMissile0.getPixel(color);
|
||||
color = myPlayer0.getPixel(color);
|
||||
}
|
||||
break;
|
||||
|
||||
// Priority from highest to lowest:
|
||||
// P0/M0 => P1/M1 => BL/PF => BK
|
||||
case Priority::normal: // CTRLPF D2=0, D1=0
|
||||
color = myPlayfield.getPixel(color);
|
||||
color = myBall.getPixel(color);
|
||||
color = myMissile1.getPixel(color);
|
||||
color = myPlayer1.getPixel(color);
|
||||
color = myMissile0.getPixel(color);
|
||||
color = myPlayer0.getPixel(color);
|
||||
break;
|
||||
}
|
||||
|
||||
myCurrentFrameBuffer.get()[y * 160 + x] = myFrameManager.vblank() ? 0 : color;
|
||||
|
|
|
@ -144,7 +144,7 @@ class TIA : public AbstractTIA
|
|||
|
||||
enum HState {blank, frame};
|
||||
|
||||
enum Priority {normal, inverted};
|
||||
enum Priority {pfp, score, normal};
|
||||
|
||||
private:
|
||||
|
||||
|
|
Loading…
Reference in New Issue