Convert raw enum to 'enum class'.

This commit is contained in:
Stephen Anthony 2017-12-22 23:57:40 -03:30
parent 93dcc9807d
commit e6dcce60de
4 changed files with 61 additions and 61 deletions

View File

@ -421,76 +421,76 @@ bool TIADebug::collision(CollisionBit id, bool toggle) const
{
switch(id)
{
case Cx_M0P1:
case CollisionBit::M0P1:
if(toggle)
myTIA.toggleCollP1M0();
return myTIA.collCXM0P() & 0x80;
case Cx_M0P0:
case CollisionBit::M0P0:
if(toggle)
myTIA.toggleCollP0M0();
return myTIA.collCXM0P() & 0x40;
case Cx_M1P0:
case CollisionBit::M1P0:
if(toggle)
myTIA.toggleCollP0M1();
return myTIA.collCXM1P() & 0x80;
case Cx_M1P1:
case CollisionBit::M1P1:
if(toggle)
myTIA.toggleCollP1M1();
return myTIA.collCXM1P() & 0x40;
case Cx_P0PF:
case CollisionBit::P0PF:
if(toggle)
myTIA.toggleCollP0PF();
return myTIA.collCXP0FB() & 0x80;
case Cx_P0BL:
case CollisionBit::P0BL:
if(toggle)
myTIA.toggleCollP0BL();
return myTIA.collCXP0FB() & 0x40;
case Cx_P1PF:
case CollisionBit::P1PF:
if(toggle)
myTIA.toggleCollP1PF();
return myTIA.collCXP1FB() & 0x80;
case Cx_P1BL:
case CollisionBit::P1BL:
if(toggle)
myTIA.toggleCollP1BL();
return myTIA.collCXP1FB() & 0x40;
case Cx_M0PF:
case CollisionBit::M0PF:
if(toggle)
myTIA.toggleCollM0PF();
return myTIA.collCXM0FB() & 0x80;
case Cx_M0BL:
case CollisionBit::M0BL:
if(toggle)
myTIA.toggleCollM0BL();
return myTIA.collCXM0FB() & 0x40;
case Cx_M1PF:
case CollisionBit::M1PF:
if(toggle)
myTIA.toggleCollM1PF();
return myTIA.collCXM1FB() & 0x80;
case Cx_M1BL:
case CollisionBit::M1BL:
if(toggle)
myTIA.toggleCollM1BL();
return myTIA.collCXM1FB() & 0x40;
case Cx_BLPF:
case CollisionBit::BLPF:
if(toggle)
myTIA.toggleCollBLPF();
return myTIA.collCXBLPF() & 0x80;
case Cx_P0P1:
case CollisionBit::P0P1:
if(toggle)
myTIA.toggleCollP0P1();
return myTIA.collCXPPMM() & 0x80;
case Cx_M0M1:
case CollisionBit::M0M1:
if(toggle)
myTIA.toggleCollM0M1();
return myTIA.collCXPPMM() & 0x40;

View File

@ -134,21 +134,21 @@ class TIADebug : public DebuggerSystem
bool collision(CollisionBit id, bool toggle = false) const;
// Collision registers
bool collM0_P1() const { return collision(Cx_M0P1); }
bool collM0_P0() const { return collision(Cx_M0P0); }
bool collM1_P0() const { return collision(Cx_M1P0); }
bool collM1_P1() const { return collision(Cx_M1P1); }
bool collP0_PF() const { return collision(Cx_P0PF); }
bool collP0_BL() const { return collision(Cx_P0BL); }
bool collP1_PF() const { return collision(Cx_P1PF); }
bool collP1_BL() const { return collision(Cx_P1BL); }
bool collM0_PF() const { return collision(Cx_M0PF); }
bool collM0_BL() const { return collision(Cx_M0BL); }
bool collM1_PF() const { return collision(Cx_M1PF); }
bool collM1_BL() const { return collision(Cx_M1BL); }
bool collBL_PF() const { return collision(Cx_BLPF); }
bool collP0_P1() const { return collision(Cx_P0P1); }
bool collM0_M1() const { return collision(Cx_M0M1); }
bool collM0_P1() const { return collision(CollisionBit::M0P1); }
bool collM0_P0() const { return collision(CollisionBit::M0P0); }
bool collM1_P0() const { return collision(CollisionBit::M1P0); }
bool collM1_P1() const { return collision(CollisionBit::M1P1); }
bool collP0_PF() const { return collision(CollisionBit::P0PF); }
bool collP0_BL() const { return collision(CollisionBit::P0BL); }
bool collP1_PF() const { return collision(CollisionBit::P1PF); }
bool collP1_BL() const { return collision(CollisionBit::P1BL); }
bool collM0_PF() const { return collision(CollisionBit::M0PF); }
bool collM0_BL() const { return collision(CollisionBit::M0BL); }
bool collM1_PF() const { return collision(CollisionBit::M1PF); }
bool collM1_BL() const { return collision(CollisionBit::M1BL); }
bool collBL_PF() const { return collision(CollisionBit::BLPF); }
bool collP0_P1() const { return collision(CollisionBit::P0P1); }
bool collM0_M1() const { return collision(CollisionBit::M0M1); }
// TIA strobe registers
void strobeWsync();

View File

@ -827,61 +827,61 @@ void TiaWidget::handleCommand(CommandSender* sender, int cmd, int data, int id)
switch(id)
{
case kP0_PFID:
tia.collision(Cx_P0PF, true);
tia.collision(CollisionBit::P0PF, true);
break;
case kP0_BLID:
tia.collision(Cx_P0BL, true);
tia.collision(CollisionBit::P0BL, true);
break;
case kP0_M1ID:
tia.collision(Cx_M1P0, true);
tia.collision(CollisionBit::M1P0, true);
break;
case kP0_M0ID:
tia.collision(Cx_M0P0, true);
tia.collision(CollisionBit::M0P0, true);
break;
case kP0_P1ID:
tia.collision(Cx_P0P1, true);
tia.collision(CollisionBit::P0P1, true);
break;
case kP1_PFID:
tia.collision(Cx_P1PF, true);
tia.collision(CollisionBit::P1PF, true);
break;
case kP1_BLID:
tia.collision(Cx_P1BL, true);
tia.collision(CollisionBit::P1BL, true);
break;
case kP1_M1ID:
tia.collision(Cx_M1P1, true);
tia.collision(CollisionBit::M1P1, true);
break;
case kP1_M0ID:
tia.collision(Cx_M0P1, true);
tia.collision(CollisionBit::M0P1, true);
break;
case kM0_PFID:
tia.collision(Cx_M0PF, true);
tia.collision(CollisionBit::M0PF, true);
break;
case kM0_BLID:
tia.collision(Cx_M0BL, true);
tia.collision(CollisionBit::M0BL, true);
break;
case kM0_M1ID:
tia.collision(Cx_M0M1, true);
tia.collision(CollisionBit::M0M1, true);
break;
case kM1_PFID:
tia.collision(Cx_M1PF, true);
tia.collision(CollisionBit::M1PF, true);
break;
case kM1_BLID:
tia.collision(Cx_M1BL, true);
tia.collision(CollisionBit::M1BL, true);
break;
case kBL_PFID:
tia.collision(Cx_BLPF, true);
tia.collision(CollisionBit::BLPF, true);
break;
case kRefP0ID:

View File

@ -50,23 +50,23 @@ enum TIAColor {
HBLANKColor = 7 // Color index for HMove blank area
};
enum CollisionBit
enum class CollisionBit
{
Cx_M0P1 = 1 << 0, // Missle0 - Player1 collision
Cx_M0P0 = 1 << 1, // Missle0 - Player0 collision
Cx_M1P0 = 1 << 2, // Missle1 - Player0 collision
Cx_M1P1 = 1 << 3, // Missle1 - Player1 collision
Cx_P0PF = 1 << 4, // Player0 - Playfield collision
Cx_P0BL = 1 << 5, // Player0 - Ball collision
Cx_P1PF = 1 << 6, // Player1 - Playfield collision
Cx_P1BL = 1 << 7, // Player1 - Ball collision
Cx_M0PF = 1 << 8, // Missle0 - Playfield collision
Cx_M0BL = 1 << 9, // Missle0 - Ball collision
Cx_M1PF = 1 << 10, // Missle1 - Playfield collision
Cx_M1BL = 1 << 11, // Missle1 - Ball collision
Cx_BLPF = 1 << 12, // Ball - Playfield collision
Cx_P0P1 = 1 << 13, // Player0 - Player1 collision
Cx_M0M1 = 1 << 14 // Missle0 - Missle1 collision
M0P1 = 1 << 0, // Missle0 - Player1 collision
M0P0 = 1 << 1, // Missle0 - Player0 collision
M1P0 = 1 << 2, // Missle1 - Player0 collision
M1P1 = 1 << 3, // Missle1 - Player1 collision
P0PF = 1 << 4, // Player0 - Playfield collision
P0BL = 1 << 5, // Player0 - Ball collision
P1PF = 1 << 6, // Player1 - Playfield collision
P1BL = 1 << 7, // Player1 - Ball collision
M0PF = 1 << 8, // Missle0 - Playfield collision
M0BL = 1 << 9, // Missle0 - Ball collision
M1PF = 1 << 10, // Missle1 - Playfield collision
M1BL = 1 << 11, // Missle1 - Ball collision
BLPF = 1 << 12, // Ball - Playfield collision
P0P1 = 1 << 13, // Player0 - Player1 collision
M0M1 = 1 << 14 // Missle0 - Missle1 collision
};
// TIA Write/Read register names