mirror of https://github.com/stella-emu/stella.git
Fully match missile starfield to hardware.
This commit is contained in:
parent
3b45bbd238
commit
7325cd8034
|
@ -151,42 +151,42 @@ void Missile::startMovement()
|
|||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
bool Missile::movementTick(uInt32 clock, bool apply)
|
||||
bool Missile::movementTick(uInt8 clock, uInt8 hclock, bool apply)
|
||||
{
|
||||
myLastMovementTick = myCounter;
|
||||
|
||||
if (clock == myHmmClocks) myIsMoving = false;
|
||||
|
||||
if (myIsMoving && apply) {
|
||||
render();
|
||||
tick(false);
|
||||
render(hclock);
|
||||
tick(hclock);
|
||||
}
|
||||
|
||||
return myIsMoving;
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
void Missile::render()
|
||||
void Missile::render(uInt8 hclock)
|
||||
{
|
||||
collision = (myIsRendering && myRenderCounter >= 0 && myIsEnabled) ?
|
||||
myCollisionMaskEnabled :
|
||||
myCollisionMaskDisabled;
|
||||
bool render =
|
||||
myIsRendering &&
|
||||
(myRenderCounter >= 0 || (myIsMoving && myRenderCounter == -1 && ((hclock + 1) % 4 == 3))) &&
|
||||
myIsEnabled;
|
||||
|
||||
collision = render ? myCollisionMaskEnabled : myCollisionMaskDisabled;
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
void Missile::tick(bool isReceivingMclock)
|
||||
void Missile::tick(uInt8 hclock)
|
||||
{
|
||||
if (myDecodes[myCounter]) {
|
||||
myIsRendering = true;
|
||||
myRenderCounter = Count::renderCounterOffset;
|
||||
|
||||
} else if (myIsRendering) {
|
||||
bool starfieldEffect = myIsMoving && isReceivingMclock;
|
||||
uInt8 starfieldDelta = (myCounter + 160 - myLastMovementTick + 2) % 4;
|
||||
|
||||
if (myRenderCounter == -2 && starfieldEffect) {
|
||||
if (myIsMoving && myRenderCounter == -1) {
|
||||
|
||||
switch (starfieldDelta) {
|
||||
switch ((hclock + 1) % 4) {
|
||||
case 3:
|
||||
myEffectiveWidth = myWidth == 1 ? 2 : myWidth;
|
||||
if (myWidth < 4) myRenderCounter++;
|
||||
|
@ -203,7 +203,7 @@ void Missile::tick(bool isReceivingMclock)
|
|||
|
||||
}
|
||||
|
||||
if (++myRenderCounter >= (starfieldEffect ? myEffectiveWidth : myWidth)) myIsRendering = false;
|
||||
if (++myRenderCounter >= (myIsMoving ? myEffectiveWidth : myWidth)) myIsRendering = false;
|
||||
}
|
||||
|
||||
if (++myCounter >= 160) myCounter = 0;
|
||||
|
|
|
@ -46,11 +46,11 @@ class Missile : public Serializable
|
|||
|
||||
void startMovement();
|
||||
|
||||
bool movementTick(uInt32 clock, bool apply);
|
||||
bool movementTick(uInt8 clock, uInt8 hclock, bool apply);
|
||||
|
||||
void render();
|
||||
void render(uInt8 hclock);
|
||||
|
||||
void tick(bool isReceivingMclock = true);
|
||||
void tick(uInt8 hclock);
|
||||
|
||||
void setColor(uInt8 color);
|
||||
|
||||
|
|
|
@ -897,8 +897,8 @@ void TIA::tickMovement()
|
|||
bool m = false;
|
||||
uInt8 movementCounter = myMovementClock > 15 ? 0 : myMovementClock;
|
||||
|
||||
m = myMissile0.movementTick(movementCounter, apply) || m;
|
||||
m = myMissile1.movementTick(movementCounter, apply) || m;
|
||||
m = myMissile0.movementTick(movementCounter, myHctr, apply) || m;
|
||||
m = myMissile1.movementTick(movementCounter, myHctr, apply) || m;
|
||||
m = myPlayer0.movementTick(movementCounter, apply) || m;
|
||||
m = myPlayer1.movementTick(movementCounter, apply) || m;
|
||||
m = myBall.movementTick(movementCounter, apply) || m;
|
||||
|
@ -960,16 +960,16 @@ void TIA::renderSprites()
|
|||
{
|
||||
myPlayer0.render();
|
||||
myPlayer1.render();
|
||||
myMissile0.render();
|
||||
myMissile1.render();
|
||||
myMissile0.render(myHctr);
|
||||
myMissile1.render(myHctr);
|
||||
myBall.render();
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
void TIA::tickSprites()
|
||||
{
|
||||
myMissile0.tick();
|
||||
myMissile1.tick();
|
||||
myMissile0.tick(myHctr);
|
||||
myMissile1.tick(myHctr);
|
||||
myPlayer0.tick();
|
||||
myPlayer1.tick();
|
||||
myBall.tick();
|
||||
|
|
Loading…
Reference in New Issue