Minor code cleanup and fix a warning.

This commit is contained in:
Stephen Anthony 2018-08-21 20:19:55 -02:30
parent 797ced56b0
commit 59fb2214ed
4 changed files with 19 additions and 19 deletions

View File

@ -124,53 +124,53 @@ void DebuggerDialog::handleKeyDown(StellaKey key, StellaMod mod)
instance().console().toggleP0Collision(); instance().console().toggleP0Collision();
else else
instance().console().toggleP0Bit(); instance().console().toggleP0Bit();
break; return;
case KBDK_X: case KBDK_X:
if(StellaModTest::isShift(mod)) if(StellaModTest::isShift(mod))
instance().console().toggleP1Collision(); instance().console().toggleP1Collision();
else else
instance().console().toggleP1Bit(); instance().console().toggleP1Bit();
break; return;
case KBDK_C: case KBDK_C:
if(StellaModTest::isShift(mod)) if(StellaModTest::isShift(mod))
instance().console().toggleM0Collision(); instance().console().toggleM0Collision();
else else
instance().console().toggleM0Bit(); instance().console().toggleM0Bit();
break; return;
case KBDK_V: case KBDK_V:
if(StellaModTest::isShift(mod)) if(StellaModTest::isShift(mod))
instance().console().toggleM1Collision(); instance().console().toggleM1Collision();
else else
instance().console().toggleM1Bit(); instance().console().toggleM1Bit();
break; return;
case KBDK_B: case KBDK_B:
if(StellaModTest::isShift(mod)) if(StellaModTest::isShift(mod))
instance().console().toggleBLCollision(); instance().console().toggleBLCollision();
else else
instance().console().toggleBLBit(); instance().console().toggleBLBit();
break; return;
case KBDK_N: case KBDK_N:
if(StellaModTest::isShift(mod)) if(StellaModTest::isShift(mod))
instance().console().togglePFCollision(); instance().console().togglePFCollision();
else else
instance().console().togglePFBit(); instance().console().togglePFBit();
break; return;
case KBDK_COMMA: case KBDK_COMMA:
instance().console().toggleFixedColors(); instance().console().toggleFixedColors();
break; return;
case KBDK_PERIOD: case KBDK_PERIOD:
if(StellaModTest::isShift(mod)) if(StellaModTest::isShift(mod))
instance().console().toggleCollisions(); instance().console().toggleCollisions();
else else
instance().console().toggleBits(); instance().console().toggleBits();
break; return;
case KBDK_T: // Alt-t toggles Time Machine case KBDK_T: // Alt-t toggles Time Machine
instance().state().toggleTimeMachine(); instance().state().toggleTimeMachine();

View File

@ -43,8 +43,7 @@ AudioDialog::AudioDialog(OSystem& osystem, DialogContainer& parent,
const int INDENT = 20; const int INDENT = 20;
const int VGAP = 4; const int VGAP = 4;
const int lineHeight = font.getLineHeight(), const int lineHeight = font.getLineHeight(),
fontWidth = font.getMaxCharWidth(), fontWidth = font.getMaxCharWidth();
fontHeight = font.getFontHeight();
int xpos, ypos; int xpos, ypos;
int lwidth = font.getStringWidth("Volume "), int lwidth = font.getStringWidth("Volume "),
pwidth; pwidth;

View File

@ -58,9 +58,9 @@ void DialogContainer::updateTime(uInt64 time)
Dialog* activeDialog = myDialogStack.top(); Dialog* activeDialog = myDialogStack.top();
// Key still pressed // Key still pressed
if(myCurrentKeyDown.keycode != 0 && myKeyRepeatTime < myTime) if(myCurrentKeyDown.key != KBDK_UNKNOWN && myKeyRepeatTime < myTime)
{ {
activeDialog->handleKeyDown(myCurrentKeyDown.keycode, myCurrentKeyDown.flags); activeDialog->handleKeyDown(myCurrentKeyDown.key, myCurrentKeyDown.mod);
myKeyRepeatTime = myTime + kRepeatSustainDelay; myKeyRepeatTime = myTime + kRepeatSustainDelay;
} }
@ -184,8 +184,8 @@ void DialogContainer::handleKeyEvent(StellaKey key, StellaMod mod, bool state)
Dialog* activeDialog = myDialogStack.top(); Dialog* activeDialog = myDialogStack.top();
if(state) if(state)
{ {
myCurrentKeyDown.keycode = key; myCurrentKeyDown.key = key;
myCurrentKeyDown.flags = mod; myCurrentKeyDown.mod = mod;
myKeyRepeatTime = myTime + kRepeatInitialDelay; myKeyRepeatTime = myTime + kRepeatInitialDelay;
activeDialog->handleKeyDown(key, mod); activeDialog->handleKeyDown(key, mod);
@ -195,8 +195,8 @@ void DialogContainer::handleKeyEvent(StellaKey key, StellaMod mod, bool state)
activeDialog->handleKeyUp(key, mod); activeDialog->handleKeyUp(key, mod);
// Only stop firing events if it's the current key // Only stop firing events if it's the current key
if (key == myCurrentKeyDown.keycode) if(key == myCurrentKeyDown.key)
myCurrentKeyDown.keycode = KBDK_UNKNOWN; myCurrentKeyDown.key = KBDK_UNKNOWN;
} }
} }
@ -363,7 +363,8 @@ void DialogContainer::handleJoyHatEvent(int stick, int hat, JoyHat value)
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void DialogContainer::reset() void DialogContainer::reset()
{ {
myCurrentKeyDown.keycode = KBDK_UNKNOWN; myCurrentKeyDown.key = KBDK_UNKNOWN;
myCurrentKeyDown.mod = KBDM_NONE;
myCurrentMouseDown.b = MouseButton::NONE; myCurrentMouseDown.b = MouseButton::NONE;
myLastClick.x = myLastClick.y = 0; myLastClick.x = myLastClick.y = 0;
myLastClick.time = 0; myLastClick.time = 0;

View File

@ -179,8 +179,8 @@ class DialogContainer
// For continuous 'key down' events // For continuous 'key down' events
struct { struct {
StellaKey keycode; StellaKey key;
StellaMod flags; StellaMod mod;
} myCurrentKeyDown; } myCurrentKeyDown;
uInt64 myKeyRepeatTime; uInt64 myKeyRepeatTime;