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)
|
||||
{
|
||||
#if 0 // FIXME
|
||||
if(newVal > -1)
|
||||
myTIA.myPOSP0 = newVal;
|
||||
#endif
|
||||
myTIA.myPlayer0.setPosition(newVal);
|
||||
|
||||
return myTIA.myPlayer0.getPosition();
|
||||
}
|
||||
|
@ -560,10 +558,8 @@ uInt8 TIADebug::posP0(int newVal)
|
|||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
uInt8 TIADebug::posP1(int newVal)
|
||||
{
|
||||
#if 0 // FIXME
|
||||
if(newVal > -1)
|
||||
myTIA.myPOSP1 = newVal;
|
||||
#endif
|
||||
myTIA.myPlayer1.setPosition(newVal);
|
||||
|
||||
return myTIA.myPlayer1.getPosition();
|
||||
}
|
||||
|
|
|
@ -369,7 +369,15 @@ uInt8 Player::getPosition() const
|
|||
const uInt8 shift = myDivider == 1 ? 0 : 1;
|
||||
|
||||
// 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 "Serializable.hxx"
|
||||
#include "PositioningProvider.hxx"
|
||||
#include "PlayfieldPositionProvider.hxx"
|
||||
|
||||
class Player : public Serializable
|
||||
{
|
||||
|
@ -29,8 +29,8 @@ class Player : public Serializable
|
|||
|
||||
public:
|
||||
|
||||
void setPositioningProvider(PositioningProvider* positioningProvider) {
|
||||
myPositioningProvider = positioningProvider;
|
||||
void setPlayfieldPositionProvider(PlayfieldPositionProvider* playfieldPositionProvider) {
|
||||
myPlayfieldPositionProvider = playfieldPositionProvider;
|
||||
}
|
||||
|
||||
void reset();
|
||||
|
@ -74,6 +74,7 @@ class Player : public Serializable
|
|||
uInt8 getRespClock() const;
|
||||
|
||||
uInt8 getPosition() const;
|
||||
void setPosition(uInt8 newPosition);
|
||||
|
||||
/**
|
||||
Serializable methods (see that class for more information).
|
||||
|
@ -125,7 +126,7 @@ class Player : public Serializable
|
|||
bool myIsReflected;
|
||||
bool myIsDelaying;
|
||||
|
||||
PositioningProvider *myPositioningProvider;
|
||||
PlayfieldPositionProvider *myPlayfieldPositionProvider;
|
||||
|
||||
private:
|
||||
Player(const Player&) = delete;
|
||||
|
|
|
@ -15,8 +15,8 @@
|
|||
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
||||
//============================================================================
|
||||
|
||||
#ifndef TIA_POSITIONING_PROVIDER
|
||||
#define TIA_POSITIONING_PROVIDER
|
||||
#ifndef TIA_PLAYFIELD_PROVIDER
|
||||
#define TIA_PLAYFIELD_PROVIDER
|
||||
|
||||
#include "bspf.hxx"
|
||||
|
||||
|
@ -27,7 +27,7 @@
|
|||
|
||||
@author Christian Speckner (DirtyHairy) and Stephen Anthony
|
||||
*/
|
||||
class PositioningProvider
|
||||
class PlayfieldPositionProvider
|
||||
{
|
||||
public:
|
||||
|
||||
|
@ -38,7 +38,7 @@ class PositioningProvider
|
|||
|
||||
protected:
|
||||
|
||||
~PositioningProvider() = default;
|
||||
~PlayfieldPositionProvider() = default;
|
||||
|
||||
};
|
||||
|
|
@ -95,8 +95,8 @@ TIA::TIA(Console& console, Sound& sound, Settings& settings)
|
|||
|
||||
myTIAPinsDriven = mySettings.getBool("tiadriven");
|
||||
|
||||
myPlayer0.setPositioningProvider(this);
|
||||
myPlayer1.setPositioningProvider(this);
|
||||
myPlayer0.setPlayfieldPositionProvider(this);
|
||||
myPlayer1.setPlayfieldPositionProvider(this);
|
||||
|
||||
reset();
|
||||
}
|
||||
|
|
|
@ -35,7 +35,7 @@
|
|||
#include "Ball.hxx"
|
||||
#include "LatchedInput.hxx"
|
||||
#include "PaddleReader.hxx"
|
||||
#include "PositioningProvider.hxx"
|
||||
#include "PlayfieldPositionProvider.hxx"
|
||||
|
||||
/**
|
||||
This class is a device that emulates the Television Interface Adaptor
|
||||
|
@ -50,7 +50,7 @@
|
|||
|
||||
@author Christian Speckner (DirtyHairy) and Stephen Anthony
|
||||
*/
|
||||
class TIA : public Device, public PositioningProvider
|
||||
class TIA : public Device, public PlayfieldPositionProvider
|
||||
{
|
||||
public:
|
||||
friend class TIADebug;
|
||||
|
|
Loading…
Reference in New Issue