added different debug colors for player/missile copies (resolves #713)

This commit is contained in:
Thomas Jentzsch 2021-08-28 10:54:49 +02:00
parent eba34b5320
commit 7aa40d4c73
7 changed files with 56 additions and 13 deletions

View File

@ -42,16 +42,17 @@ DrawCounterDecodes::DrawCounterDecodes()
for (uInt8 *decodes : decodeTables) for (uInt8 *decodes : decodeTables)
{ {
memset(decodes, 0, 160); memset(decodes, 0, 160); // TJ: magic number 160 = pixel/scanline
decodes[156] = 1; decodes[156] = 1; // TJ: set for all copy pattern (first copy)
} }
myDecodes1[12] = 1; myDecodes1[12] = 2; // TJ: two copies close (+16)
myDecodes2[28] = 1; myDecodes2[28] = 2; // TJ: two copies med (+32)
myDecodes3[12] = myDecodes3[28] = 1; myDecodes3[12] = 2; myDecodes3[28] = 3; // TJ: three copies close (+16, +32)
myDecodes4[60] = 1; myDecodes4[60] = 2; // TJ: two copies wide (+64)
myDecodes6[28] = myDecodes6[60] = 1; myDecodes6[28] = 2; myDecodes6[60] = 3; // TJ: three copies medium (+32, +64)
// TJ: assigning decodes to players
myPlayerDecodes[0] = myDecodes0; myPlayerDecodes[0] = myDecodes0;
myPlayerDecodes[1] = myDecodes1; myPlayerDecodes[1] = myDecodes1;
myPlayerDecodes[2] = myDecodes2; myPlayerDecodes[2] = myDecodes2;
@ -61,6 +62,7 @@ DrawCounterDecodes::DrawCounterDecodes()
myPlayerDecodes[6] = myDecodes6; myPlayerDecodes[6] = myDecodes6;
myPlayerDecodes[7] = myDecodes0; myPlayerDecodes[7] = myDecodes0;
// TJ: assigning decodes to missiles
myMissileDecodes[0] = myDecodes0; myMissileDecodes[0] = myDecodes0;
myMissileDecodes[1] = myDecodes1; myMissileDecodes[1] = myDecodes1;
myMissileDecodes[2] = myDecodes2; myMissileDecodes[2] = myDecodes2;

View File

@ -36,10 +36,11 @@ class DrawCounterDecodes
private: private:
uInt8* myPlayerDecodes[8]{nullptr}; uInt8* myPlayerDecodes[8]{nullptr}; // TJ: one per NUSIZ number and size
uInt8* myMissileDecodes[8]{nullptr}; uInt8* myMissileDecodes[8]{nullptr}; // TJ: one per NUSIZ number and size
// TJ: 6 scanline pixel arrays, one for each copy pattern
uInt8 myDecodes0[160], myDecodes1[160], myDecodes2[160], myDecodes3[160], uInt8 myDecodes0[160], myDecodes1[160], myDecodes2[160], myDecodes3[160],
myDecodes4[160], myDecodes6[160]; myDecodes4[160], myDecodes6[160];

View File

@ -40,6 +40,7 @@ void Missile::reset()
myIsRendering = false; myIsRendering = false;
myIsVisible = false; myIsVisible = false;
myRenderCounter = 0; myRenderCounter = 0;
myCopy = 1;
myColor = myObjectColor = myDebugColor = 0; myColor = myObjectColor = myDebugColor = 0;
myDebugEnabled = false; myDebugEnabled = false;
collision = myCollisionMaskDisabled; collision = myCollisionMaskDisabled;
@ -220,6 +221,23 @@ void Missile::applyColors()
myColor = myDebugColor; myColor = myDebugColor;
} }
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
uInt8 Missile::getColor() const
{
if(!myDebugEnabled)
return myColor;
else
switch (myCopy)
{
case 2:
return myColor - 2;
case 3:
return myColor + 2;
default:
return myColor;
}
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
uInt8 Missile::getPosition() const uInt8 Missile::getPosition() const
{ {

View File

@ -65,7 +65,7 @@ class Missile : public Serializable
void toggleEnabled(bool enabled); void toggleEnabled(bool enabled);
bool isOn() const { return (collision & 0x8000); } bool isOn() const { return (collision & 0x8000); }
uInt8 getColor() const { return myColor; } uInt8 getColor() const;
uInt8 getPosition() const; uInt8 getPosition() const;
void setPosition(uInt8 newPosition); void setPosition(uInt8 newPosition);
@ -115,6 +115,7 @@ class Missile : public Serializable
bool myIsRendering{false}; bool myIsRendering{false};
bool myIsVisible{false}; bool myIsVisible{false};
Int8 myRenderCounter{0}; Int8 myRenderCounter{0};
Int8 myCopy{1};
const uInt8* myDecodes{nullptr}; const uInt8* myDecodes{nullptr};
uInt8 myDecodesOffset{0}; // needed for state saving uInt8 myDecodesOffset{0}; // needed for state saving
@ -169,6 +170,7 @@ void Missile::tick(uInt8 hclock, bool isReceivingMclock)
if (myDecodes[myCounter] && !myResmp) { if (myDecodes[myCounter] && !myResmp) {
myIsRendering = true; myIsRendering = true;
myRenderCounter = renderCounterOffset; myRenderCounter = renderCounterOffset;
myCopy = myDecodes[myCounter];
} else if (myIsRendering) { } else if (myIsRendering) {
if (myRenderCounter == -1) { if (myRenderCounter == -1) {

View File

@ -34,6 +34,7 @@ void Player::reset()
isMoving = false; isMoving = false;
myIsRendering = false; myIsRendering = false;
myRenderCounter = 0; myRenderCounter = 0;
myCopy = 1;
myPatternOld = 0; myPatternOld = 0;
myPatternNew = 0; myPatternNew = 0;
myIsReflected = 0; myIsReflected = 0;
@ -355,6 +356,23 @@ void Player::applyColors()
myColor = myDebugColor; myColor = myDebugColor;
} }
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
uInt8 Player::getColor() const
{
if(!myDebugEnabled)
return myColor;
else
switch(myCopy)
{
case 2:
return myColor - 2;
case 3:
return myColor + 2;
default:
return myColor;
}
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
uInt8 Player::getPosition() const uInt8 Player::getPosition() const
{ {

View File

@ -67,7 +67,7 @@ class Player : public Serializable
uInt8 getClock() const { return myCounter; } uInt8 getClock() const { return myCounter; }
bool isOn() const { return (collision & 0x8000); } bool isOn() const { return (collision & 0x8000); }
uInt8 getColor() const { return myColor; } uInt8 getColor() const;
void shufflePatterns(); void shufflePatterns();
@ -125,6 +125,7 @@ class Player : public Serializable
bool myIsRendering{false}; bool myIsRendering{false};
Int8 myRenderCounter{0}; Int8 myRenderCounter{0};
Int8 myRenderCounterTripPoint{0}; Int8 myRenderCounterTripPoint{0};
Int8 myCopy{1};
uInt8 myDivider{0}; uInt8 myDivider{0};
uInt8 myDividerPending{0}; uInt8 myDividerPending{0};
uInt8 mySampleCounter{0}; uInt8 mySampleCounter{0};
@ -186,6 +187,7 @@ void Player::tick()
myIsRendering = true; myIsRendering = true;
mySampleCounter = 0; mySampleCounter = 0;
myRenderCounter = renderCounterOffset; myRenderCounter = renderCounterOffset;
myCopy = myDecodes[myCounter];
} else if (myIsRendering) { } else if (myIsRendering) {
++myRenderCounter; ++myRenderCounter;

View File

@ -76,7 +76,7 @@ class TIA : public Device
* Possible palette entries for objects in "fixed debug color mode". * Possible palette entries for objects in "fixed debug color mode".
*/ */
enum FixedColor { enum FixedColor {
NTSC_RED = 0x30, NTSC_RED = 0x42,
NTSC_ORANGE = 0x38, NTSC_ORANGE = 0x38,
NTSC_YELLOW = 0x1c, NTSC_YELLOW = 0x1c,
NTSC_GREEN = 0xc6, NTSC_GREEN = 0xc6,
@ -86,7 +86,7 @@ class TIA : public Device
PAL_RED = 0x62, PAL_RED = 0x62,
PAL_ORANGE = 0x4a, PAL_ORANGE = 0x4a,
PAL_YELLOW = 0x2e, PAL_YELLOW = 0x2c,
PAL_GREEN = 0x36, PAL_GREEN = 0x36,
PAL_BLUE = 0xbc, PAL_BLUE = 0xbc,
PAL_PURPLE = 0xa6, PAL_PURPLE = 0xa6,