Fixed TIA score mode bug, as reported on AtariAge.

git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@3261 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
This commit is contained in:
stephena 2016-01-25 17:28:49 +00:00
parent 211454f699
commit 647aeb62b0
2 changed files with 55 additions and 47 deletions

View File

@ -31,6 +31,9 @@
paddle will move when you move the mouse). The movement itself paddle will move when you move the mouse). The movement itself
is now also smoother than before. is now also smoother than before.
* Fixed bug in 'Score mode' in TIA emulation; the TIA object colours
were correct, but the associated priority was sometimes incorrect.
* Fixed bug in ROM launcher; selecting 'Options -> Game Properties' after * Fixed bug in ROM launcher; selecting 'Options -> Game Properties' after
loading a ROM would always point to the last opened ROM, not to the one loading a ROM would always point to the last opened ROM, not to the one
currently selected. currently selected.

View File

@ -775,18 +775,12 @@ bool TIA::toggleCollision(TIABit b, uInt8 mode)
// Assume all collisions are on, then selectively turn the desired ones off // Assume all collisions are on, then selectively turn the desired ones off
uInt16 mask = 0xffff; uInt16 mask = 0xffff;
if(!(enabled & P0Bit)) if(!(enabled & P0Bit)) mask &= ~(Cx_M0P0 | Cx_M1P0 | Cx_P0PF | Cx_P0BL | Cx_P0P1);
mask &= ~(Cx_M0P0 | Cx_M1P0 | Cx_P0PF | Cx_P0BL | Cx_P0P1); if(!(enabled & P1Bit)) mask &= ~(Cx_M0P1 | Cx_M1P1 | Cx_P1PF | Cx_P1BL | Cx_P0P1);
if(!(enabled & P1Bit)) if(!(enabled & M0Bit)) mask &= ~(Cx_M0P0 | Cx_M0P1 | Cx_M0PF | Cx_M0BL | Cx_M0M1);
mask &= ~(Cx_M0P1 | Cx_M1P1 | Cx_P1PF | Cx_P1BL | Cx_P0P1); if(!(enabled & M1Bit)) mask &= ~(Cx_M1P0 | Cx_M1P1 | Cx_M1PF | Cx_M1BL | Cx_M0M1);
if(!(enabled & M0Bit)) if(!(enabled & BLBit)) mask &= ~(Cx_P0BL | Cx_P1BL | Cx_M0BL | Cx_M1BL | Cx_BLPF);
mask &= ~(Cx_M0P0 | Cx_M0P1 | Cx_M0PF | Cx_M0BL | Cx_M0M1); if(!(enabled & PFBit)) mask &= ~(Cx_P0PF | Cx_P1PF | Cx_M0PF | Cx_M1PF | Cx_BLPF);
if(!(enabled & M1Bit))
mask &= ~(Cx_M1P0 | Cx_M1P1 | Cx_M1PF | Cx_M1BL | Cx_M0M1);
if(!(enabled & BLBit))
mask &= ~(Cx_P0BL | Cx_P1BL | Cx_M0BL | Cx_M1BL | Cx_BLPF);
if(!(enabled & PFBit))
mask &= ~(Cx_P0PF | Cx_P1PF | Cx_M0PF | Cx_M1PF | Cx_BLPF);
// Now combine the masks // Now combine the masks
myCollisionEnabledMask = (enabled << 16) | mask; myCollisionEnabledMask = (enabled << 16) | mask;
@ -826,48 +820,59 @@ bool TIA::toggleFixedColors(uInt8 mode)
{ {
for(uInt16 enabled = 0; enabled < 256; ++enabled) for(uInt16 enabled = 0; enabled < 256; ++enabled)
{ {
uInt8 color = BKColor;
if(enabled & PriorityBit) if(enabled & PriorityBit)
{ {
// Priority from highest to lowest: // NOTE: Playfield has priority so ScoreBit isn't used
// Priority from highest to lowest: CTRLPF D2=1, D1=ignored
// PF/BL => P0/M0 => P1/M1 => BK // PF/BL => P0/M0 => P1/M1 => BK
uInt8 color = BKColor; if((enabled & M1Bit) != 0) color = M1Color;
if((enabled & P1Bit) != 0) color = P1Color;
if((enabled & M1Bit) != 0) if((enabled & M0Bit) != 0) color = M0Color;
color = M1Color; if((enabled & P0Bit) != 0) color = P0Color;
if((enabled & P1Bit) != 0) if((enabled & BLBit) != 0) color = BLColor;
color = P1Color; if((enabled & PFBit) != 0) color = PFColor;
if((enabled & M0Bit) != 0)
color = M0Color;
if((enabled & P0Bit) != 0)
color = P0Color;
if((enabled & BLBit) != 0)
color = BLColor;
if((enabled & PFBit) != 0)
color = PFColor; // NOTE: Playfield has priority so ScoreBit isn't used
myPriorityEncoder[x][enabled] = color;
} }
else else
{ {
// Priority from highest to lowest: if(enabled & ScoreBit) // CTRLPF D2=0, D1=1
// P0/M0 => P1/M1 => PF/BL => BK {
uInt8 color = BKColor; if(x == 0) // Score mode left half
{
if((enabled & BLBit) != 0) // Priority from highest to lowest:
color = BLColor; // PF/P0/M0 => P1/M1 => BL => BK
if((enabled & PFBit) != 0) if((enabled & BLBit) != 0) color = BLColor;
color = (!on && (enabled & ScoreBit)) ? ((x == 0) ? P0Color : P1Color) : PFColor; if((enabled & M1Bit) != 0) color = M1Color;
if((enabled & M1Bit) != 0) if((enabled & P1Bit) != 0) color = P1Color;
color = M1Color; if((enabled & M0Bit) != 0) color = M0Color;
if((enabled & P1Bit) != 0) if((enabled & P0Bit) != 0) color = P0Color;
color = P1Color; if((enabled & PFBit) != 0) color = !on ? P0Color : PFColor;
if((enabled & M0Bit) != 0) }
color = M0Color; else // Score mode right half
if((enabled & P0Bit) != 0) {
color = P0Color; // Priority from highest to lowest:
// P0/M0 => PF/P1/M1 => BL => BK
myPriorityEncoder[x][enabled] = color; if((enabled & BLBit) != 0) color = BLColor;
if((enabled & M1Bit) != 0) color = M1Color;
if((enabled & P1Bit) != 0) color = P1Color;
if((enabled & PFBit) != 0) color = !on ? P1Color : PFColor;
if((enabled & M0Bit) != 0) color = M0Color;
if((enabled & P0Bit) != 0) color = P0Color;
}
}
else
{
// Priority from highest to lowest: CTRLPF D2=0, D1=0
// P0/M0 => P1/M1 => PF/BL => BK
if((enabled & BLBit) != 0) color = BLColor;
if((enabled & PFBit) != 0) color = PFColor;
if((enabled & M1Bit) != 0) color = M1Color;
if((enabled & P1Bit) != 0) color = P1Color;
if((enabled & M0Bit) != 0) color = M0Color;
if((enabled & P0Bit) != 0) color = P0Color;
}
} }
myPriorityEncoder[x][enabled] = color;
} }
} }