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();
else
instance().console().toggleP0Bit();
break;
return;
case KBDK_X:
if(StellaModTest::isShift(mod))
instance().console().toggleP1Collision();
else
instance().console().toggleP1Bit();
break;
return;
case KBDK_C:
if(StellaModTest::isShift(mod))
instance().console().toggleM0Collision();
else
instance().console().toggleM0Bit();
break;
return;
case KBDK_V:
if(StellaModTest::isShift(mod))
instance().console().toggleM1Collision();
else
instance().console().toggleM1Bit();
break;
return;
case KBDK_B:
if(StellaModTest::isShift(mod))
instance().console().toggleBLCollision();
else
instance().console().toggleBLBit();
break;
return;
case KBDK_N:
if(StellaModTest::isShift(mod))
instance().console().togglePFCollision();
else
instance().console().togglePFBit();
break;
return;
case KBDK_COMMA:
instance().console().toggleFixedColors();
break;
return;
case KBDK_PERIOD:
if(StellaModTest::isShift(mod))
instance().console().toggleCollisions();
else
instance().console().toggleBits();
break;
return;
case KBDK_T: // Alt-t toggles Time Machine
instance().state().toggleTimeMachine();

View File

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

View File

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

View File

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