More accurately model RESMx during decode or draw.

This commit is contained in:
Christian Speckner 2017-01-24 22:28:07 +01:00
parent 5033e8bfe6
commit 72b8f6491e
1 changed files with 33 additions and 2 deletions

View File

@ -71,8 +71,39 @@ void Missile::resm(uInt8 counter)
{
myCounter = counter;
if (myIsRendering && myRenderCounter < 0)
if (myIsRendering) {
if (myRenderCounter < 0) {
myRenderCounter = Count::renderCounterOffset + (counter - 157);
} else {
// The following is an effective description of the behavior of missile width after a
// RESMx during draw. It would be much simpler without the HBLANK cases :)
switch (myWidth) {
case 8:
myRenderCounter = (counter != 157 && myRenderCounter >= 4) ? 7 : (counter - 157);
break;
case 4:
myRenderCounter = counter - 157;
break;
case 2:
if (counter != 157) {
if (myRenderCounter == 1 || myRenderCounter == 0) myIsRendering = false;
} else {
if (myRenderCounter == 0) myRenderCounter++;
}
break;
default:
if (counter != 157) {
if (myRenderCounter == 0) myIsRendering = false;
}
break;
}
}
}
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -