mirror of https://github.com/stella-emu/stella.git
Re-enable fixed debug colors.
This commit is contained in:
parent
9ca6f89778
commit
c526d260a0
|
@ -0,0 +1,102 @@
|
||||||
|
//
|
||||||
|
// SSSS tt lll lll
|
||||||
|
// SS SS tt ll ll
|
||||||
|
// SS tttttt eeee ll ll aaaa
|
||||||
|
// SSSS tt ee ee ll ll aa
|
||||||
|
// SS tt eeeeee ll ll aaaaa -- "An Atari 2600 VCS Emulator"
|
||||||
|
// SS SS tt ee ll ll aa aa
|
||||||
|
// SSSS ttt eeeee llll llll aaaaa
|
||||||
|
//
|
||||||
|
// Copyright (c) 1995-2016 by Bradford W. Mott, Stephen Anthony
|
||||||
|
// and the Stella Team
|
||||||
|
//
|
||||||
|
// See the file "License.txt" for information on usage and redistribution of
|
||||||
|
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
||||||
|
//
|
||||||
|
// $Id$
|
||||||
|
//============================================================================
|
||||||
|
|
||||||
|
#include "Background.hxx"
|
||||||
|
|
||||||
|
namespace TIA6502tsCore {
|
||||||
|
|
||||||
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
|
Background::Background()
|
||||||
|
{
|
||||||
|
reset();
|
||||||
|
}
|
||||||
|
|
||||||
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
|
void Background::reset()
|
||||||
|
{
|
||||||
|
myColor = myObjectColor = myDebugColor = 0;
|
||||||
|
myDebugEnabled = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
|
void Background::setColor(uInt8 color)
|
||||||
|
{
|
||||||
|
myObjectColor = color;
|
||||||
|
applyColors();
|
||||||
|
}
|
||||||
|
|
||||||
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
|
void Background::setDebugColor(uInt8 color)
|
||||||
|
{
|
||||||
|
myDebugColor = color;
|
||||||
|
applyColors();
|
||||||
|
}
|
||||||
|
|
||||||
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
|
void Background::enableDebugColors(bool enabled)
|
||||||
|
{
|
||||||
|
myDebugEnabled = enabled;
|
||||||
|
applyColors();
|
||||||
|
}
|
||||||
|
|
||||||
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
|
void Background::applyColors()
|
||||||
|
{
|
||||||
|
myColor = myDebugEnabled ? myDebugColor : myObjectColor;
|
||||||
|
}
|
||||||
|
|
||||||
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
|
// TODO: implement this once the class is finalized
|
||||||
|
bool Background::save(Serializer& out) const
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
out.putString(name());
|
||||||
|
|
||||||
|
// TODO - save instance variables
|
||||||
|
}
|
||||||
|
catch(...)
|
||||||
|
{
|
||||||
|
cerr << "ERROR: TIA_BK::save" << endl;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
|
// TODO: implement this once the class is finalized
|
||||||
|
bool Background::load(Serializer& in)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
if(in.getString() != name())
|
||||||
|
return false;
|
||||||
|
|
||||||
|
// TODO - load instance variables
|
||||||
|
}
|
||||||
|
catch(...)
|
||||||
|
{
|
||||||
|
cerr << "ERROR: TIA_BK::load" << endl;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
} // namespace TIA6502tsCore
|
|
@ -0,0 +1,66 @@
|
||||||
|
//============================================================================
|
||||||
|
//
|
||||||
|
// SSSS tt lll lll
|
||||||
|
// SS SS tt ll ll
|
||||||
|
// SS tttttt eeee ll ll aaaa
|
||||||
|
// SSSS tt ee ee ll ll aa
|
||||||
|
// SS tt eeeeee ll ll aaaaa -- "An Atari 2600 VCS Emulator"
|
||||||
|
// SS SS tt ee ll ll aa aa
|
||||||
|
// SSSS ttt eeeee llll llll aaaaa
|
||||||
|
//
|
||||||
|
// Copyright (c) 1995-2016 by Bradford W. Mott, Stephen Anthony
|
||||||
|
// and the Stella Team
|
||||||
|
//
|
||||||
|
// See the file "License.txt" for information on usage and redistribution of
|
||||||
|
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
||||||
|
//
|
||||||
|
// $Id$
|
||||||
|
//============================================================================
|
||||||
|
|
||||||
|
#ifndef TIA_6502TS_CORE_BACKGROUND
|
||||||
|
#define TIA_6502TS_CORE_BACKGROUND
|
||||||
|
|
||||||
|
#include "Serializable.hxx"
|
||||||
|
#include "bspf.hxx"
|
||||||
|
|
||||||
|
namespace TIA6502tsCore {
|
||||||
|
|
||||||
|
class Background : public Serializable
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
Background();
|
||||||
|
|
||||||
|
public:
|
||||||
|
void reset();
|
||||||
|
|
||||||
|
void setColor(uInt8 color);
|
||||||
|
void setDebugColor(uInt8 color);
|
||||||
|
void enableDebugColors(bool enabled);
|
||||||
|
|
||||||
|
uInt8 getColor() const { return myColor; }
|
||||||
|
|
||||||
|
/**
|
||||||
|
Serializable methods (see that class for more information).
|
||||||
|
*/
|
||||||
|
bool save(Serializer& out) const override;
|
||||||
|
bool load(Serializer& in) override;
|
||||||
|
string name() const override { return "TIA_BK"; }
|
||||||
|
|
||||||
|
private:
|
||||||
|
void applyColors();
|
||||||
|
|
||||||
|
private:
|
||||||
|
uInt8 myColor;
|
||||||
|
uInt8 myObjectColor, myDebugColor;
|
||||||
|
bool myDebugEnabled;
|
||||||
|
|
||||||
|
private:
|
||||||
|
Background(const Background&) = delete;
|
||||||
|
Background(Background&&) = delete;
|
||||||
|
Background& operator=(const Background&) = delete;
|
||||||
|
Background& operator=(Background&&);
|
||||||
|
};
|
||||||
|
|
||||||
|
} // namespace TIA6502tsCore
|
||||||
|
|
||||||
|
#endif // TIA_6502TS_CORE_BACKGROUND
|
|
@ -36,7 +36,7 @@ Ball::Ball(uInt32 collisionMask)
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
void Ball::reset()
|
void Ball::reset()
|
||||||
{
|
{
|
||||||
myColor = 0;
|
myColor = myObjectColor = myDebugColor = 0;
|
||||||
collision = myCollisionMaskDisabled;
|
collision = myCollisionMaskDisabled;
|
||||||
myIsEnabledOld = false;
|
myIsEnabledOld = false;
|
||||||
myIsEnabledNew = false;
|
myIsEnabledNew = false;
|
||||||
|
@ -47,9 +47,11 @@ void Ball::reset()
|
||||||
myIsMoving = false;
|
myIsMoving = false;
|
||||||
myWidth = 1;
|
myWidth = 1;
|
||||||
myIsRendering = false;
|
myIsRendering = false;
|
||||||
|
myDebugEnabled = false;
|
||||||
myRenderCounter = 0;
|
myRenderCounter = 0;
|
||||||
|
|
||||||
updateEnabled();
|
updateEnabled();
|
||||||
|
applyColors();
|
||||||
}
|
}
|
||||||
|
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
|
@ -99,14 +101,28 @@ void Ball::toggleCollisions(bool enabled)
|
||||||
void Ball::toggleEnabled(bool enabled)
|
void Ball::toggleEnabled(bool enabled)
|
||||||
{
|
{
|
||||||
myIsSuppressed = !enabled;
|
myIsSuppressed = !enabled;
|
||||||
|
|
||||||
updateEnabled();
|
updateEnabled();
|
||||||
}
|
}
|
||||||
|
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
void Ball::setColor(uInt8 color)
|
void Ball::setColor(uInt8 color)
|
||||||
{
|
{
|
||||||
myColor = color;
|
myObjectColor = color;
|
||||||
|
applyColors();
|
||||||
|
}
|
||||||
|
|
||||||
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
|
void Ball::setDebugColor(uInt8 color)
|
||||||
|
{
|
||||||
|
myDebugColor = color;
|
||||||
|
applyColors();
|
||||||
|
}
|
||||||
|
|
||||||
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
|
void Ball::enableDebugColors(bool enabled)
|
||||||
|
{
|
||||||
|
myDebugEnabled = enabled;
|
||||||
|
applyColors();
|
||||||
}
|
}
|
||||||
|
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
|
@ -163,6 +179,12 @@ void Ball::updateEnabled()
|
||||||
myIsEnabled = !myIsSuppressed && (myIsDelaying ? myIsEnabledOld : myIsEnabledNew);
|
myIsEnabled = !myIsSuppressed && (myIsDelaying ? myIsEnabledOld : myIsEnabledNew);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
|
void Ball::applyColors()
|
||||||
|
{
|
||||||
|
myColor = myDebugEnabled ? myDebugColor : myObjectColor;
|
||||||
|
}
|
||||||
|
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
// TODO: implement this once the class is finalized
|
// TODO: implement this once the class is finalized
|
||||||
bool Ball::save(Serializer& out) const
|
bool Ball::save(Serializer& out) const
|
||||||
|
|
|
@ -51,6 +51,9 @@ class Ball : public Serializable
|
||||||
|
|
||||||
void setColor(uInt8 color);
|
void setColor(uInt8 color);
|
||||||
|
|
||||||
|
void setDebugColor(uInt8 color);
|
||||||
|
void enableDebugColors(bool enabled);
|
||||||
|
|
||||||
void startMovement();
|
void startMovement();
|
||||||
|
|
||||||
bool movementTick(uInt32 clock, bool apply);
|
bool movementTick(uInt32 clock, bool apply);
|
||||||
|
@ -79,6 +82,7 @@ class Ball : public Serializable
|
||||||
private:
|
private:
|
||||||
|
|
||||||
void updateEnabled();
|
void updateEnabled();
|
||||||
|
void applyColors();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
|
@ -86,6 +90,8 @@ class Ball : public Serializable
|
||||||
uInt32 myCollisionMaskEnabled;
|
uInt32 myCollisionMaskEnabled;
|
||||||
|
|
||||||
uInt8 myColor;
|
uInt8 myColor;
|
||||||
|
uInt8 myObjectColor, myDebugColor;
|
||||||
|
bool myDebugEnabled;
|
||||||
|
|
||||||
bool myIsEnabledOld;
|
bool myIsEnabledOld;
|
||||||
bool myIsEnabledNew;
|
bool myIsEnabledNew;
|
||||||
|
@ -102,7 +108,6 @@ class Ball : public Serializable
|
||||||
Int8 myRenderCounter;
|
Int8 myRenderCounter;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
Ball() = delete;
|
Ball() = delete;
|
||||||
Ball(const Ball&) = delete;
|
Ball(const Ball&) = delete;
|
||||||
Ball(Ball&&) = delete;
|
Ball(Ball&&) = delete;
|
||||||
|
|
|
@ -48,7 +48,8 @@ void Missile::reset()
|
||||||
myWidth = 1;
|
myWidth = 1;
|
||||||
myIsRendering = false;
|
myIsRendering = false;
|
||||||
myRenderCounter = 0;
|
myRenderCounter = 0;
|
||||||
myColor = 0;
|
myColor = myObjectColor = myDebugColor = 0;
|
||||||
|
myDebugEnabled = false;
|
||||||
collision = myCollisionMaskDisabled;
|
collision = myCollisionMaskDisabled;
|
||||||
|
|
||||||
updateEnabled();
|
updateEnabled();
|
||||||
|
@ -78,11 +79,13 @@ void Missile::resmp(uInt8 value, const Player& player)
|
||||||
{
|
{
|
||||||
const uInt8 resmp = value & 0x02;
|
const uInt8 resmp = value & 0x02;
|
||||||
|
|
||||||
if (resmp == myResmp) return;
|
if (resmp == myResmp)
|
||||||
|
return;
|
||||||
|
|
||||||
myResmp = resmp;
|
myResmp = resmp;
|
||||||
|
|
||||||
if (!myResmp) myCounter = player.getRespClock();
|
if (!myResmp)
|
||||||
|
myCounter = player.getRespClock();
|
||||||
|
|
||||||
updateEnabled();
|
updateEnabled();
|
||||||
}
|
}
|
||||||
|
@ -155,7 +158,22 @@ void Missile::tick()
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
void Missile::setColor(uInt8 color)
|
void Missile::setColor(uInt8 color)
|
||||||
{
|
{
|
||||||
myColor = color;
|
myObjectColor = color;
|
||||||
|
applyColors();
|
||||||
|
}
|
||||||
|
|
||||||
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
|
void Missile::setDebugColor(uInt8 color)
|
||||||
|
{
|
||||||
|
myDebugColor = color;
|
||||||
|
applyColors();
|
||||||
|
}
|
||||||
|
|
||||||
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
|
void Missile::enableDebugColors(bool enabled)
|
||||||
|
{
|
||||||
|
myDebugEnabled = enabled;
|
||||||
|
applyColors();
|
||||||
}
|
}
|
||||||
|
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
|
@ -164,6 +182,12 @@ void Missile::updateEnabled()
|
||||||
myIsEnabled = !myIsSuppressed && myEnam && !myResmp;
|
myIsEnabled = !myIsSuppressed && myEnam && !myResmp;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
|
void Missile::applyColors()
|
||||||
|
{
|
||||||
|
myColor = myDebugEnabled ? myDebugColor : myObjectColor;
|
||||||
|
}
|
||||||
|
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
// TODO: implement this once the class is finalized
|
// TODO: implement this once the class is finalized
|
||||||
bool Missile::save(Serializer& out) const
|
bool Missile::save(Serializer& out) const
|
||||||
|
|
|
@ -55,6 +55,9 @@ class Missile : public Serializable
|
||||||
|
|
||||||
void setColor(uInt8 color);
|
void setColor(uInt8 color);
|
||||||
|
|
||||||
|
void setDebugColor(uInt8 color);
|
||||||
|
void enableDebugColors(bool enabled);
|
||||||
|
|
||||||
void toggleCollisions(bool enabled);
|
void toggleCollisions(bool enabled);
|
||||||
|
|
||||||
void toggleEnabled(bool enabled);
|
void toggleEnabled(bool enabled);
|
||||||
|
@ -77,6 +80,7 @@ class Missile : public Serializable
|
||||||
private:
|
private:
|
||||||
|
|
||||||
void updateEnabled();
|
void updateEnabled();
|
||||||
|
void applyColors();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
|
@ -99,6 +103,8 @@ class Missile : public Serializable
|
||||||
const uInt8* myDecodes;
|
const uInt8* myDecodes;
|
||||||
|
|
||||||
uInt8 myColor;
|
uInt8 myColor;
|
||||||
|
uInt8 myObjectColor, myDebugColor;
|
||||||
|
bool myDebugEnabled;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Missile(const Missile&) = delete;
|
Missile(const Missile&) = delete;
|
||||||
|
|
|
@ -50,6 +50,8 @@ void Player::reset()
|
||||||
myPattern = 0;
|
myPattern = 0;
|
||||||
myIsReflected = 0;
|
myIsReflected = 0;
|
||||||
myIsDelaying = false;
|
myIsDelaying = false;
|
||||||
|
myColor = myObjectColor = myDebugColor = 0;
|
||||||
|
myDebugEnabled = false;
|
||||||
collision = myCollisionMaskDisabled;
|
collision = myCollisionMaskDisabled;
|
||||||
|
|
||||||
updatePattern();
|
updatePattern();
|
||||||
|
@ -132,7 +134,22 @@ void Player::toggleCollisions(bool enabled)
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
void Player::setColor(uInt8 color)
|
void Player::setColor(uInt8 color)
|
||||||
{
|
{
|
||||||
myColor = color;
|
myObjectColor = color;
|
||||||
|
applyColors();
|
||||||
|
}
|
||||||
|
|
||||||
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
|
void Player::setDebugColor(uInt8 color)
|
||||||
|
{
|
||||||
|
myDebugColor = color;
|
||||||
|
applyColors();
|
||||||
|
}
|
||||||
|
|
||||||
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
|
void Player::enableDebugColors(bool enabled)
|
||||||
|
{
|
||||||
|
myDebugEnabled = enabled;
|
||||||
|
applyColors();
|
||||||
}
|
}
|
||||||
|
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
|
@ -214,7 +231,7 @@ void Player::updatePattern()
|
||||||
if (myIsSuppressed) {
|
if (myIsSuppressed) {
|
||||||
myPattern = 0;
|
myPattern = 0;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
const uInt32 pattern = myIsDelaying ? myPatternOld : myPatternNew;
|
const uInt32 pattern = myIsDelaying ? myPatternOld : myPatternNew;
|
||||||
|
|
||||||
|
@ -286,6 +303,12 @@ void Player::updatePattern()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
|
void Player::applyColors()
|
||||||
|
{
|
||||||
|
myColor = myDebugEnabled ? myDebugColor : myObjectColor;
|
||||||
|
}
|
||||||
|
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
// TODO: implement this once the class is finalized
|
// TODO: implement this once the class is finalized
|
||||||
bool Player::save(Serializer& out) const
|
bool Player::save(Serializer& out) const
|
||||||
|
|
|
@ -52,6 +52,9 @@ class Player : public Serializable
|
||||||
|
|
||||||
void setColor(uInt8 color);
|
void setColor(uInt8 color);
|
||||||
|
|
||||||
|
void setDebugColor(uInt8 color);
|
||||||
|
void enableDebugColors(bool enabled);
|
||||||
|
|
||||||
void startMovement();
|
void startMovement();
|
||||||
|
|
||||||
bool movementTick(uInt32 clock, bool apply);
|
bool movementTick(uInt32 clock, bool apply);
|
||||||
|
@ -82,12 +85,15 @@ class Player : public Serializable
|
||||||
private:
|
private:
|
||||||
|
|
||||||
void updatePattern();
|
void updatePattern();
|
||||||
|
void applyColors();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
uInt32 myCollisionMaskDisabled;
|
uInt32 myCollisionMaskDisabled;
|
||||||
uInt32 myCollisionMaskEnabled;
|
uInt32 myCollisionMaskEnabled;
|
||||||
uInt8 myColor;
|
uInt8 myColor;
|
||||||
|
uInt8 myObjectColor, myDebugColor;
|
||||||
|
bool myDebugEnabled;
|
||||||
|
|
||||||
bool myIsSuppressed;
|
bool myIsSuppressed;
|
||||||
|
|
||||||
|
|
|
@ -41,10 +41,11 @@ void Playfield::reset()
|
||||||
myPf1 = 0;
|
myPf1 = 0;
|
||||||
myPf2 = 0;
|
myPf2 = 0;
|
||||||
|
|
||||||
myColor = 0;
|
myObjectColor = myDebugColor = 0;
|
||||||
myColorP0 = 0;
|
myColorP0 = 0;
|
||||||
myColorP1 = 0;
|
myColorP1 = 0;
|
||||||
myColorMode = ColorMode::normal;
|
myColorMode = ColorMode::normal;
|
||||||
|
myDebugEnabled = false;
|
||||||
|
|
||||||
collision = 0;
|
collision = 0;
|
||||||
|
|
||||||
|
@ -109,7 +110,7 @@ void Playfield::toggleCollisions(bool enabled)
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
void Playfield::setColor(uInt8 color)
|
void Playfield::setColor(uInt8 color)
|
||||||
{
|
{
|
||||||
myColor = color;
|
myObjectColor = color;
|
||||||
applyColors();
|
applyColors();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -127,6 +128,20 @@ void Playfield::setColorP1(uInt8 color)
|
||||||
applyColors();
|
applyColors();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
|
void Playfield::setDebugColor(uInt8 color)
|
||||||
|
{
|
||||||
|
myDebugColor = color;
|
||||||
|
applyColors();
|
||||||
|
}
|
||||||
|
|
||||||
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
|
void Playfield::enableDebugColors(bool enabled)
|
||||||
|
{
|
||||||
|
myDebugEnabled = enabled;
|
||||||
|
applyColors();
|
||||||
|
}
|
||||||
|
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
void Playfield::tick(uInt32 x)
|
void Playfield::tick(uInt32 x)
|
||||||
{
|
{
|
||||||
|
@ -154,10 +169,14 @@ void Playfield::tick(uInt32 x)
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
void Playfield::applyColors()
|
void Playfield::applyColors()
|
||||||
{
|
{
|
||||||
|
if (myDebugEnabled)
|
||||||
|
myColorLeft = myColorRight = myDebugColor;
|
||||||
|
else
|
||||||
|
{
|
||||||
switch (myColorMode)
|
switch (myColorMode)
|
||||||
{
|
{
|
||||||
case ColorMode::normal:
|
case ColorMode::normal:
|
||||||
myColorLeft = myColorRight = myColor;
|
myColorLeft = myColorRight = myObjectColor;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ColorMode::score:
|
case ColorMode::score:
|
||||||
|
@ -165,6 +184,7 @@ void Playfield::applyColors()
|
||||||
myColorRight = myColorP1;
|
myColorRight = myColorP1;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
|
|
|
@ -52,6 +52,9 @@ class Playfield : public Serializable
|
||||||
|
|
||||||
void setColorP1(uInt8 color);
|
void setColorP1(uInt8 color);
|
||||||
|
|
||||||
|
void setDebugColor(uInt8 color);
|
||||||
|
void enableDebugColors(bool enabled);
|
||||||
|
|
||||||
void tick(uInt32 x);
|
void tick(uInt32 x);
|
||||||
|
|
||||||
uInt8 getPixel(uInt8 colorIn) const {
|
uInt8 getPixel(uInt8 colorIn) const {
|
||||||
|
@ -90,7 +93,9 @@ class Playfield : public Serializable
|
||||||
uInt8 myColorRight;
|
uInt8 myColorRight;
|
||||||
uInt8 myColorP0;
|
uInt8 myColorP0;
|
||||||
uInt8 myColorP1;
|
uInt8 myColorP1;
|
||||||
uInt8 myColor;
|
uInt8 myObjectColor, myDebugColor;
|
||||||
|
bool myDebugEnabled;
|
||||||
|
|
||||||
ColorMode myColorMode;
|
ColorMode myColorMode;
|
||||||
|
|
||||||
uInt32 myPattern;
|
uInt32 myPattern;
|
||||||
|
|
|
@ -97,11 +97,12 @@ void TIA::reset()
|
||||||
myCollisionMask = 0;
|
myCollisionMask = 0;
|
||||||
myLinesSinceChange = 0;
|
myLinesSinceChange = 0;
|
||||||
myCollisionUpdateRequired = false;
|
myCollisionUpdateRequired = false;
|
||||||
myColorBk = 0;
|
myColorHBlank = 0;
|
||||||
|
|
||||||
myLastCycle = 0;
|
myLastCycle = 0;
|
||||||
mySubClock = 0;
|
mySubClock = 0;
|
||||||
|
|
||||||
|
myBackground.reset();
|
||||||
myPlayfield.reset();
|
myPlayfield.reset();
|
||||||
myMissile0.reset();
|
myMissile0.reset();
|
||||||
myMissile1.reset();
|
myMissile1.reset();
|
||||||
|
@ -119,6 +120,8 @@ void TIA::reset()
|
||||||
mySound.reset();
|
mySound.reset();
|
||||||
myDelayQueue.reset();
|
myDelayQueue.reset();
|
||||||
myFrameManager.reset();
|
myFrameManager.reset();
|
||||||
|
toggleFixedColors(0); // Turn off debug colours
|
||||||
|
|
||||||
frameReset(); // Recalculate the size of the display
|
frameReset(); // Recalculate the size of the display
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -128,7 +131,7 @@ void TIA::frameReset()
|
||||||
// Clear frame buffers
|
// Clear frame buffers
|
||||||
clearBuffers();
|
clearBuffers();
|
||||||
|
|
||||||
// TODO - make use of ystart and height
|
// TODO - make use of ystart and height, maybe move to FrameManager
|
||||||
}
|
}
|
||||||
|
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
|
@ -370,7 +373,7 @@ bool TIA::poke(uInt16 address, uInt8 value)
|
||||||
|
|
||||||
case COLUBK:
|
case COLUBK:
|
||||||
myLinesSinceChange = 0;
|
myLinesSinceChange = 0;
|
||||||
myColorBk = value & 0xFE;
|
myBackground.setColor(value & 0xFE);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case COLUP0:
|
case COLUP0:
|
||||||
|
@ -724,10 +727,31 @@ bool TIA::toggleCollisions()
|
||||||
}
|
}
|
||||||
|
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
// TODO: stub
|
|
||||||
bool TIA::toggleFixedColors(uInt8 mode)
|
bool TIA::toggleFixedColors(uInt8 mode)
|
||||||
{
|
{
|
||||||
return false;
|
// If mode is 0 or 1, use it as a boolean (off or on)
|
||||||
|
// Otherwise, flip the state
|
||||||
|
bool on = (mode == 0 || mode == 1) ? bool(mode) : myColorHBlank == 0;
|
||||||
|
|
||||||
|
bool pal = isPAL();
|
||||||
|
myMissile0.setDebugColor(pal ? M0ColorPAL : M0ColorNTSC);
|
||||||
|
myMissile1.setDebugColor(pal ? M1ColorPAL : M1ColorNTSC);
|
||||||
|
myPlayer0.setDebugColor(pal ? P0ColorPAL : P0ColorNTSC);
|
||||||
|
myPlayer1.setDebugColor(pal ? P1ColorPAL : P1ColorNTSC);
|
||||||
|
myBall.setDebugColor(pal ? BLColorPAL : BLColorNTSC);
|
||||||
|
myPlayfield.setDebugColor(pal ? PFColorPAL : PFColorNTSC);
|
||||||
|
myBackground.setDebugColor(pal ? BKColorPAL : BKColorNTSC);
|
||||||
|
|
||||||
|
myMissile0.enableDebugColors(on);
|
||||||
|
myMissile1.enableDebugColors(on);
|
||||||
|
myPlayer0.enableDebugColors(on);
|
||||||
|
myPlayer1.enableDebugColors(on);
|
||||||
|
myBall.enableDebugColors(on);
|
||||||
|
myPlayfield.enableDebugColors(on);
|
||||||
|
myBackground.enableDebugColors(on);
|
||||||
|
myColorHBlank = on ? HBLANKColor : 0x00;
|
||||||
|
|
||||||
|
return on;
|
||||||
}
|
}
|
||||||
|
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
|
@ -735,7 +759,7 @@ bool TIA::driveUnusedPinsRandom(uInt8 mode)
|
||||||
{
|
{
|
||||||
// If mode is 0 or 1, use it as a boolean (off or on)
|
// If mode is 0 or 1, use it as a boolean (off or on)
|
||||||
// Otherwise, return the state
|
// Otherwise, return the state
|
||||||
if(mode == 0 || mode == 1)
|
if (mode == 0 || mode == 1)
|
||||||
{
|
{
|
||||||
myTIAPinsDriven = bool(mode);
|
myTIAPinsDriven = bool(mode);
|
||||||
mySettings.setValue("tiadriven", myTIAPinsDriven);
|
mySettings.setValue("tiadriven", myTIAPinsDriven);
|
||||||
|
@ -905,7 +929,7 @@ void TIA::updateCollision()
|
||||||
void TIA::renderPixel(uInt32 x, uInt32 y, bool lineNotCached)
|
void TIA::renderPixel(uInt32 x, uInt32 y, bool lineNotCached)
|
||||||
{
|
{
|
||||||
if (lineNotCached) {
|
if (lineNotCached) {
|
||||||
uInt8 color = myColorBk;
|
uInt8 color = myBackground.getColor();
|
||||||
|
|
||||||
switch (myPriority)
|
switch (myPriority)
|
||||||
{
|
{
|
||||||
|
@ -959,7 +983,8 @@ void TIA::renderPixel(uInt32 x, uInt32 y, bool lineNotCached)
|
||||||
void TIA::clearHmoveComb()
|
void TIA::clearHmoveComb()
|
||||||
{
|
{
|
||||||
if (myFrameManager.isRendering() && myHstate == HState::blank)
|
if (myFrameManager.isRendering() && myHstate == HState::blank)
|
||||||
memset(myCurrentFrameBuffer.get() + myFrameManager.currentLine() * 160, 0, 8);
|
memset(myCurrentFrameBuffer.get() + myFrameManager.currentLine() * 160,
|
||||||
|
myColorHBlank, 8);
|
||||||
}
|
}
|
||||||
|
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
|
|
|
@ -27,6 +27,7 @@
|
||||||
#include "TIATypes.hxx"
|
#include "TIATypes.hxx"
|
||||||
#include "DelayQueue.hxx"
|
#include "DelayQueue.hxx"
|
||||||
#include "FrameManager.hxx"
|
#include "FrameManager.hxx"
|
||||||
|
#include "Background.hxx"
|
||||||
#include "Playfield.hxx"
|
#include "Playfield.hxx"
|
||||||
#include "Missile.hxx"
|
#include "Missile.hxx"
|
||||||
#include "Player.hxx"
|
#include "Player.hxx"
|
||||||
|
@ -179,6 +180,24 @@ class TIA : public AbstractTIA
|
||||||
enum HState {blank, frame};
|
enum HState {blank, frame};
|
||||||
enum Priority {pfp, score, normal};
|
enum Priority {pfp, score, normal};
|
||||||
|
|
||||||
|
enum FixedColors {
|
||||||
|
P0ColorNTSC = 0x30,
|
||||||
|
P1ColorNTSC = 0x16,
|
||||||
|
M0ColorNTSC = 0x38,
|
||||||
|
M1ColorNTSC = 0x12,
|
||||||
|
BLColorNTSC = 0x7e,
|
||||||
|
PFColorNTSC = 0x76,
|
||||||
|
BKColorNTSC = 0x0a,
|
||||||
|
P0ColorPAL = 0x62,
|
||||||
|
P1ColorPAL = 0x26,
|
||||||
|
M0ColorPAL = 0x68,
|
||||||
|
M1ColorPAL = 0x2e,
|
||||||
|
BLColorPAL = 0xde,
|
||||||
|
PFColorPAL = 0xd8,
|
||||||
|
BKColorPAL = 0x1c,
|
||||||
|
HBLANKColor = 0x0e
|
||||||
|
};
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
void updateEmulation();
|
void updateEmulation();
|
||||||
|
@ -245,7 +264,7 @@ class TIA : public AbstractTIA
|
||||||
uInt8 mySpriteEnabledBits;
|
uInt8 mySpriteEnabledBits;
|
||||||
uInt8 myCollisionsEnabledBits;
|
uInt8 myCollisionsEnabledBits;
|
||||||
|
|
||||||
uInt8 myColorBk;
|
uInt8 myColorHBlank;
|
||||||
|
|
||||||
double myTimestamp;
|
double myTimestamp;
|
||||||
|
|
||||||
|
@ -253,6 +272,7 @@ class TIA : public AbstractTIA
|
||||||
BytePtr myCurrentFrameBuffer;
|
BytePtr myCurrentFrameBuffer;
|
||||||
BytePtr myPreviousFrameBuffer;
|
BytePtr myPreviousFrameBuffer;
|
||||||
|
|
||||||
|
Background myBackground;
|
||||||
Playfield myPlayfield;
|
Playfield myPlayfield;
|
||||||
Missile myMissile0;
|
Missile myMissile0;
|
||||||
Missile myMissile1;
|
Missile myMissile1;
|
||||||
|
|
|
@ -10,6 +10,7 @@ MODULE_OBJS := \
|
||||||
src/emucore/tia/core_6502ts/Missile.o \
|
src/emucore/tia/core_6502ts/Missile.o \
|
||||||
src/emucore/tia/core_6502ts/Player.o \
|
src/emucore/tia/core_6502ts/Player.o \
|
||||||
src/emucore/tia/core_6502ts/Ball.o \
|
src/emucore/tia/core_6502ts/Ball.o \
|
||||||
|
src/emucore/tia/core_6502ts/Background.o \
|
||||||
src/emucore/tia/core_6502ts/LatchedInput.o \
|
src/emucore/tia/core_6502ts/LatchedInput.o \
|
||||||
src/emucore/tia/core_6502ts/PaddleReader.o
|
src/emucore/tia/core_6502ts/PaddleReader.o
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue