Added mappable events for toggling TV color type and left/right A/B difficulty.

git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@3180 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
This commit is contained in:
stephena 2015-06-28 22:32:36 +00:00
parent 26e9f15b86
commit 7350e8f6c1
6 changed files with 123 additions and 10 deletions

View File

@ -14,6 +14,11 @@
4.6.1 to 4.7: (mmm dd, 2015)
* Added mappable events for swapping TV color/BW, left difficulty A/B
and right difficulty A/B. This means that one key. joystick button,
etc can be used to toggle each event. Thanks to Buzbard of AtariAge
for the suggestion.
* Changed 'hidecursor' commandline argument (and associated UI item) to
'cursor'. The new argument allows to set mouse cursor visibility
separately for both UI and emulation modes.

View File

@ -162,8 +162,8 @@ MouseControl::MouseControl(Console& console, const string& mode)
myModeList.push_back(MouseMode("Mouse not used for current controllers"));
#if 0
for(MouseMode m: myModeList)
cerr << mode << endl;
for(const auto& m: myModeList)
cerr << m << endl;
#endif
}

View File

@ -42,6 +42,7 @@ class Event
ConsoleLeftDiffA, ConsoleLeftDiffB,
ConsoleRightDiffA, ConsoleRightDiffB,
ConsoleSelect, ConsoleReset,
ConsoleLeftDiffSwap, ConsoleRightDiffSwap, ConsoleColorSwap,
JoystickZeroUp, JoystickZeroDown, JoystickZeroLeft, JoystickZeroRight,
JoystickZeroFire, JoystickZeroFire5, JoystickZeroFire9,

View File

@ -40,6 +40,7 @@
#include "Settings.hxx"
#include "Sound.hxx"
#include "StateManager.hxx"
#include "Switches.hxx"
#include "M6532.hxx"
#include "MouseControl.hxx"
#include "Version.hxx"
@ -960,25 +961,107 @@ void EventHandler::handleEvent(Event::Type event, int state)
return;
////////////////////////////////////////////////////////////////////////
// Events which generate messages
////////////////////////////////////////////////////////////////////////
// Events which relate to switches()
case Event::ConsoleColor:
if(state) myOSystem.frameBuffer().showMessage("Color Mode");
if(state)
{
myEvent.set(Event::ConsoleBlackWhite, 0);
myOSystem.frameBuffer().showMessage("Color Mode");
}
break;
case Event::ConsoleBlackWhite:
if(state) myOSystem.frameBuffer().showMessage("BW Mode");
if(state)
{
myEvent.set(Event::ConsoleColor, 0);
myOSystem.frameBuffer().showMessage("BW Mode");
}
break;
case Event::ConsoleColorSwap:
if(state)
{
if(myOSystem.console().switches().tvColor())
{
myEvent.set(Event::ConsoleBlackWhite, 1);
myEvent.set(Event::ConsoleColor, 0);
myOSystem.frameBuffer().showMessage("BW Mode");
}
else
{
myEvent.set(Event::ConsoleBlackWhite, 0);
myEvent.set(Event::ConsoleColor, 1);
myOSystem.frameBuffer().showMessage("Color Mode");
}
myOSystem.console().switches().update();
}
return;
case Event::ConsoleLeftDiffA:
if(state) myOSystem.frameBuffer().showMessage("Left Difficulty A");
if(state)
{
myEvent.set(Event::ConsoleLeftDiffB, 0);
myOSystem.frameBuffer().showMessage("Left Difficulty A");
}
break;
case Event::ConsoleLeftDiffB:
if(state) myOSystem.frameBuffer().showMessage("Left Difficulty B");
if(state)
{
myEvent.set(Event::ConsoleLeftDiffA, 0);
myOSystem.frameBuffer().showMessage("Left Difficulty B");
}
break;
case Event::ConsoleLeftDiffSwap:
if(state)
{
if(myOSystem.console().switches().leftDifficultyA())
{
myEvent.set(Event::ConsoleLeftDiffA, 0);
myEvent.set(Event::ConsoleLeftDiffB, 1);
myOSystem.frameBuffer().showMessage("Left Difficulty B");
}
else
{
myEvent.set(Event::ConsoleLeftDiffA, 1);
myEvent.set(Event::ConsoleLeftDiffB, 0);
myOSystem.frameBuffer().showMessage("Left Difficulty A");
}
myOSystem.console().switches().update();
}
return;
case Event::ConsoleRightDiffA:
if(state) myOSystem.frameBuffer().showMessage("Right Difficulty A");
if(state)
{
myEvent.set(Event::ConsoleRightDiffB, 0);
myOSystem.frameBuffer().showMessage("Right Difficulty A");
}
break;
case Event::ConsoleRightDiffB:
if(state) myOSystem.frameBuffer().showMessage("Right Difficulty B");
if(state)
{
myEvent.set(Event::ConsoleRightDiffA, 0);
myOSystem.frameBuffer().showMessage("Right Difficulty B");
}
break;
case Event::ConsoleRightDiffSwap:
if(state)
{
if(myOSystem.console().switches().rightDifficultyA())
{
myEvent.set(Event::ConsoleRightDiffA, 0);
myEvent.set(Event::ConsoleRightDiffB, 1);
myOSystem.frameBuffer().showMessage("Right Difficulty B");
}
else
{
myEvent.set(Event::ConsoleRightDiffA, 1);
myEvent.set(Event::ConsoleRightDiffB, 0);
myOSystem.frameBuffer().showMessage("Right Difficulty A");
}
myOSystem.console().switches().update();
}
return;
////////////////////////////////////////////////////////////////////////
case Event::NoType: // Ignore unmapped events
return;
@ -2013,10 +2096,13 @@ EventHandler::ActionList EventHandler::ourEmulActionList[kEmulActionListSize] =
{ Event::ConsoleReset, "Reset", 0, true },
{ Event::ConsoleColor, "Color TV", 0, true },
{ Event::ConsoleBlackWhite, "Black & White TV", 0, true },
{ Event::ConsoleColorSwap, "Swap Color / B&W TV", 0, true },
{ Event::ConsoleLeftDiffA, "P0 Difficulty A", 0, true },
{ Event::ConsoleLeftDiffB, "P0 Difficulty B", 0, true },
{ Event::ConsoleLeftDiffSwap, "P0 Swap Difficulty", 0, true },
{ Event::ConsoleRightDiffA, "P1 Difficulty A", 0, true },
{ Event::ConsoleRightDiffB, "P1 Difficulty B", 0, true },
{ Event::ConsoleRightDiffSwap,"P1 Swap Difficulty", 0, true },
{ Event::SaveState, "Save State", 0, false },
{ Event::ChangeState, "Change State", 0, false },
{ Event::LoadState, "Load State", 0, false },

View File

@ -500,7 +500,7 @@ class EventHandler
enum {
kComboSize = 16,
kEventsPerCombo = 8,
kEmulActionListSize = 75 + kComboSize,
kEmulActionListSize = 78 + kComboSize,
kMenuActionListSize = 14
};

View File

@ -89,6 +89,27 @@ class Switches : public Serializable
*/
string name() const { return "Switches"; }
/**
Query the 'Console_TelevisionType' switches bit.
@return True if 'Color', false if 'BlackWhite'
*/
bool tvColor() const { return mySwitches & 0x08; }
/**
Query the 'Console_LeftDifficulty' switches bit.
@return True if 'A', false if 'B'
*/
bool leftDifficultyA() const { return mySwitches & 0x40; }
/**
Query the 'Console_RightDifficulty' switches bit.
@return True if 'A', false if 'B'
*/
bool rightDifficultyA() const { return mySwitches & 0x80; }
private:
// Reference to the event object to use
const Event& myEvent;