mirror of https://github.com/stella-emu/stella.git
Better naming, implement player position setters
This commit is contained in:
parent
a7fc82cbea
commit
d00698c3e4
|
@ -549,10 +549,8 @@ uInt8 TIADebug::grP1(int newVal)
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
uInt8 TIADebug::posP0(int newVal)
|
uInt8 TIADebug::posP0(int newVal)
|
||||||
{
|
{
|
||||||
#if 0 // FIXME
|
|
||||||
if(newVal > -1)
|
if(newVal > -1)
|
||||||
myTIA.myPOSP0 = newVal;
|
myTIA.myPlayer0.setPosition(newVal);
|
||||||
#endif
|
|
||||||
|
|
||||||
return myTIA.myPlayer0.getPosition();
|
return myTIA.myPlayer0.getPosition();
|
||||||
}
|
}
|
||||||
|
@ -560,10 +558,8 @@ uInt8 TIADebug::posP0(int newVal)
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
uInt8 TIADebug::posP1(int newVal)
|
uInt8 TIADebug::posP1(int newVal)
|
||||||
{
|
{
|
||||||
#if 0 // FIXME
|
|
||||||
if(newVal > -1)
|
if(newVal > -1)
|
||||||
myTIA.myPOSP1 = newVal;
|
myTIA.myPlayer1.setPosition(newVal);
|
||||||
#endif
|
|
||||||
|
|
||||||
return myTIA.myPlayer1.getPosition();
|
return myTIA.myPlayer1.getPosition();
|
||||||
}
|
}
|
||||||
|
|
|
@ -369,7 +369,15 @@ uInt8 Player::getPosition() const
|
||||||
const uInt8 shift = myDivider == 1 ? 0 : 1;
|
const uInt8 shift = myDivider == 1 ? 0 : 1;
|
||||||
|
|
||||||
// Mind the sign of renderCounterOffset: it's defined negative above
|
// Mind the sign of renderCounterOffset: it's defined negative above
|
||||||
return (316 - myCounter - Count::renderCounterOffset + shift + myPositioningProvider->getPosition()) % 160;
|
return (316 - myCounter - Count::renderCounterOffset + shift + myPlayfieldPositionProvider->getPosition()) % 160;
|
||||||
|
}
|
||||||
|
|
||||||
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
|
void Player::setPosition(uInt8 newPosition)
|
||||||
|
{
|
||||||
|
const uInt8 shift = myDivider == 1 ? 0 : 1;
|
||||||
|
|
||||||
|
myCounter = (316 - newPosition - Count::renderCounterOffset + shift + myPlayfieldPositionProvider->getPosition()) % 160;
|
||||||
}
|
}
|
||||||
|
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
|
|
|
@ -20,7 +20,7 @@
|
||||||
|
|
||||||
#include "bspf.hxx"
|
#include "bspf.hxx"
|
||||||
#include "Serializable.hxx"
|
#include "Serializable.hxx"
|
||||||
#include "PositioningProvider.hxx"
|
#include "PlayfieldPositionProvider.hxx"
|
||||||
|
|
||||||
class Player : public Serializable
|
class Player : public Serializable
|
||||||
{
|
{
|
||||||
|
@ -29,8 +29,8 @@ class Player : public Serializable
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
void setPositioningProvider(PositioningProvider* positioningProvider) {
|
void setPlayfieldPositionProvider(PlayfieldPositionProvider* playfieldPositionProvider) {
|
||||||
myPositioningProvider = positioningProvider;
|
myPlayfieldPositionProvider = playfieldPositionProvider;
|
||||||
}
|
}
|
||||||
|
|
||||||
void reset();
|
void reset();
|
||||||
|
@ -74,6 +74,7 @@ class Player : public Serializable
|
||||||
uInt8 getRespClock() const;
|
uInt8 getRespClock() const;
|
||||||
|
|
||||||
uInt8 getPosition() const;
|
uInt8 getPosition() const;
|
||||||
|
void setPosition(uInt8 newPosition);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Serializable methods (see that class for more information).
|
Serializable methods (see that class for more information).
|
||||||
|
@ -125,7 +126,7 @@ class Player : public Serializable
|
||||||
bool myIsReflected;
|
bool myIsReflected;
|
||||||
bool myIsDelaying;
|
bool myIsDelaying;
|
||||||
|
|
||||||
PositioningProvider *myPositioningProvider;
|
PlayfieldPositionProvider *myPlayfieldPositionProvider;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Player(const Player&) = delete;
|
Player(const Player&) = delete;
|
||||||
|
|
|
@ -15,8 +15,8 @@
|
||||||
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
||||||
//============================================================================
|
//============================================================================
|
||||||
|
|
||||||
#ifndef TIA_POSITIONING_PROVIDER
|
#ifndef TIA_PLAYFIELD_PROVIDER
|
||||||
#define TIA_POSITIONING_PROVIDER
|
#define TIA_PLAYFIELD_PROVIDER
|
||||||
|
|
||||||
#include "bspf.hxx"
|
#include "bspf.hxx"
|
||||||
|
|
||||||
|
@ -27,7 +27,7 @@
|
||||||
|
|
||||||
@author Christian Speckner (DirtyHairy) and Stephen Anthony
|
@author Christian Speckner (DirtyHairy) and Stephen Anthony
|
||||||
*/
|
*/
|
||||||
class PositioningProvider
|
class PlayfieldPositionProvider
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
|
||||||
|
@ -38,7 +38,7 @@ class PositioningProvider
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
~PositioningProvider() = default;
|
~PlayfieldPositionProvider() = default;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
|
@ -95,8 +95,8 @@ TIA::TIA(Console& console, Sound& sound, Settings& settings)
|
||||||
|
|
||||||
myTIAPinsDriven = mySettings.getBool("tiadriven");
|
myTIAPinsDriven = mySettings.getBool("tiadriven");
|
||||||
|
|
||||||
myPlayer0.setPositioningProvider(this);
|
myPlayer0.setPlayfieldPositionProvider(this);
|
||||||
myPlayer1.setPositioningProvider(this);
|
myPlayer1.setPlayfieldPositionProvider(this);
|
||||||
|
|
||||||
reset();
|
reset();
|
||||||
}
|
}
|
||||||
|
|
|
@ -35,7 +35,7 @@
|
||||||
#include "Ball.hxx"
|
#include "Ball.hxx"
|
||||||
#include "LatchedInput.hxx"
|
#include "LatchedInput.hxx"
|
||||||
#include "PaddleReader.hxx"
|
#include "PaddleReader.hxx"
|
||||||
#include "PositioningProvider.hxx"
|
#include "PlayfieldPositionProvider.hxx"
|
||||||
|
|
||||||
/**
|
/**
|
||||||
This class is a device that emulates the Television Interface Adaptor
|
This class is a device that emulates the Television Interface Adaptor
|
||||||
|
@ -50,7 +50,7 @@
|
||||||
|
|
||||||
@author Christian Speckner (DirtyHairy) and Stephen Anthony
|
@author Christian Speckner (DirtyHairy) and Stephen Anthony
|
||||||
*/
|
*/
|
||||||
class TIA : public Device, public PositioningProvider
|
class TIA : public Device, public PlayfieldPositionProvider
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
friend class TIADebug;
|
friend class TIADebug;
|
||||||
|
|
Loading…
Reference in New Issue