mirror of https://github.com/stella-emu/stella.git
Microoptimization: pre-invert collision bitmasks.
This commit is contained in:
parent
a1eb8fd9ab
commit
a717890c29
|
@ -27,7 +27,7 @@ namespace TIA6502tsCore {
|
|||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
Ball::Ball(uInt32 collisionMask)
|
||||
: myCollisionMaskDisabled(collisionMask),
|
||||
myCollisionMaskEnabled(0x8000),
|
||||
myCollisionMaskEnabled(0xFFFF),
|
||||
mySupressed(false)
|
||||
{
|
||||
reset();
|
||||
|
@ -92,7 +92,7 @@ void Ball::vdelbl(uInt8 value)
|
|||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
void Ball::toggleCollisions(bool enabled)
|
||||
{
|
||||
myCollisionMaskEnabled = enabled ? 0x8000 : (0x8000 | myCollisionMaskDisabled);
|
||||
myCollisionMaskEnabled = enabled ? 0xFFFF : (0x8000 | myCollisionMaskDisabled);
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
|
|
|
@ -29,7 +29,7 @@ namespace TIA6502tsCore {
|
|||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
Missile::Missile(uInt32 collisionMask)
|
||||
: myCollisionMaskDisabled(collisionMask),
|
||||
myCollisionMaskEnabled(0x8000),
|
||||
myCollisionMaskEnabled(0xFFFF),
|
||||
mySupressed(false)
|
||||
{
|
||||
reset();
|
||||
|
@ -90,7 +90,7 @@ void Missile::resmp(uInt8 value, const Player& player)
|
|||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
void Missile::toggleCollisions(bool enabled)
|
||||
{
|
||||
myCollisionMaskEnabled = enabled ? 0x8000 : (0x8000 | myCollisionMaskDisabled);
|
||||
myCollisionMaskEnabled = enabled ? 0xFFFF : (0x8000 | myCollisionMaskDisabled);
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
|
|
|
@ -29,7 +29,7 @@ namespace TIA6502tsCore {
|
|||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
Player::Player(uInt32 collisionMask)
|
||||
: myCollisionMaskDisabled(collisionMask),
|
||||
myCollisionMaskEnabled(0x8000),
|
||||
myCollisionMaskEnabled(0xFFFF),
|
||||
mySupressed(false)
|
||||
{
|
||||
reset();
|
||||
|
@ -126,7 +126,7 @@ void Player::toggleEnabled(bool enabled)
|
|||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
void Player::toggleCollisions(bool enabled)
|
||||
{
|
||||
myCollisionMaskEnabled = enabled ? 0x8000 : (0x8000 | myCollisionMaskDisabled);
|
||||
myCollisionMaskEnabled = enabled ? 0xFFFF : (0x8000 | myCollisionMaskDisabled);
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
|
|
|
@ -24,7 +24,7 @@ namespace TIA6502tsCore {
|
|||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
Playfield::Playfield(uInt32 collisionMask)
|
||||
: myCollisionMaskDisabled(collisionMask),
|
||||
myCollisionMaskEnabled(0x8000),
|
||||
myCollisionMaskEnabled(0xFFFF),
|
||||
mySupressed(false)
|
||||
{
|
||||
reset();
|
||||
|
@ -103,7 +103,7 @@ void Playfield::toggleEnabled(bool enabled)
|
|||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
void Playfield::toggleCollisions(bool enabled)
|
||||
{
|
||||
myCollisionMaskEnabled = enabled ? 0x8000 : (0x8000 | myCollisionMaskDisabled);
|
||||
myCollisionMaskEnabled = enabled ? 0xFFFF : (0x8000 | myCollisionMaskDisabled);
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
|
|
|
@ -58,12 +58,12 @@ TIA::TIA(Console& console, Sound& sound, Settings& settings)
|
|||
myDelayQueue(10, 20),
|
||||
mySpriteEnabledBits(0xFF),
|
||||
myCollisionsEnabledBits(0xFF),
|
||||
myPlayfield(CollisionMask::playfield),
|
||||
myMissile0(CollisionMask::missile0),
|
||||
myMissile1(CollisionMask::missile1),
|
||||
myPlayer0(CollisionMask::player0),
|
||||
myPlayer1(CollisionMask::player1),
|
||||
myBall(CollisionMask::ball)
|
||||
myPlayfield(~CollisionMask::playfield & 0x7FFF),
|
||||
myMissile0(~CollisionMask::missile0 & 0x7FFF),
|
||||
myMissile1(~CollisionMask::missile1 & 0x7FFF),
|
||||
myPlayer0(~CollisionMask::player0 & 0x7FFF),
|
||||
myPlayer1(~CollisionMask::player1 & 0x7FFF),
|
||||
myBall(~CollisionMask::ball & 0x7FFF)
|
||||
{
|
||||
myFrameManager.setHandlers(
|
||||
[this] () {
|
||||
|
@ -900,12 +900,12 @@ void TIA::nextLine()
|
|||
void TIA::updateCollision()
|
||||
{
|
||||
myCollisionMask |= (
|
||||
~myPlayer0.collision &
|
||||
~myPlayer1.collision &
|
||||
~myMissile0.collision &
|
||||
~myMissile1.collision &
|
||||
~myBall.collision &
|
||||
~myPlayfield.collision
|
||||
myPlayer0.collision &
|
||||
myPlayer1.collision &
|
||||
myMissile0.collision &
|
||||
myMissile1.collision &
|
||||
myBall.collision &
|
||||
myPlayfield.collision
|
||||
);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue