add Mappings for SaveState/LoadState/UndoState also

This commit is contained in:
dinkc64 2014-09-18 19:54:34 +00:00
parent da86b30e2c
commit 0392eb89a4
4 changed files with 69 additions and 11 deletions

View File

@ -113,6 +113,12 @@ extern TCHAR szPlayerDefaultIni[4][MAX_PATH];
// mappable System Macros for the Input Dialogue
extern UINT8 macroSystemPause;
extern UINT8 macroSystemFFWD;
extern UINT8 macroSystemSaveState;
extern UINT8 macroSystemLoadState;
extern UINT8 macroSystemUNDOState;
// scrn.cpp
extern void scrnSSUndo();
// cong.cpp
extern const INT32 nConfigMinVersion; // Minimum version of application for which input files are valid

View File

@ -21,6 +21,9 @@ bool bLeftAltkeyMapped = false;
// These are mappable global macros for mapping Pause/FFWD etc to controls in the input mapping dialogue. -dink
UINT8 macroSystemPause = 0;
UINT8 macroSystemFFWD = 0;
UINT8 macroSystemSaveState = 0;
UINT8 macroSystemLoadState = 0;
UINT8 macroSystemUNDOState = 0;
// ---------------------------------------------------------------------------
@ -268,6 +271,35 @@ static void GameInpInitMacros()
nMacroCount++;
pgi++;
pgi->nInput = GIT_MACRO_AUTO;
pgi->nType = BIT_DIGITAL;
pgi->Macro.nMode = 0;
pgi->Macro.nSysMacro = 1;
sprintf(pgi->Macro.szName, "System Load State");
pgi->Macro.pVal[0] = &macroSystemLoadState;
pgi->Macro.nVal[0] = 1;
nMacroCount++;
pgi++;
pgi->nInput = GIT_MACRO_AUTO;
pgi->nType = BIT_DIGITAL;
pgi->Macro.nMode = 0;
pgi->Macro.nSysMacro = 1;
sprintf(pgi->Macro.szName, "System Save State");
pgi->Macro.pVal[0] = &macroSystemSaveState;
pgi->Macro.nVal[0] = 1;
nMacroCount++;
pgi++;
pgi->nInput = GIT_MACRO_AUTO;
pgi->nType = BIT_DIGITAL;
pgi->Macro.nMode = 0;
pgi->Macro.nSysMacro = 1;
sprintf(pgi->Macro.szName, "System UNDO State");
pgi->Macro.pVal[0] = &macroSystemUNDOState;
pgi->Macro.nVal[0] = 1;
nMacroCount++;
pgi++;
}
for (INT32 nPlayer = 0; nPlayer < nMaxPlayers; nPlayer++) {

View File

@ -27,7 +27,7 @@ static int nNormalFrac = 0; // Extra fraction we did
static bool bAppDoStep = 0;
static bool bAppDoFast = 0;
static int nFastSpeed = 6;
static int prevPause = 0;
static int prevPause = 0, prevSState = 0, prevLState = 0, prevUState = 0;
static void CheckSystemMacros() // These are the Pause / FFWD macros added to the input dialog
{
@ -38,6 +38,21 @@ static void CheckSystemMacros() // These are the Pause / FFWD macros added to th
prevPause = macroSystemPause;
// FFWD
if (!kNetGame) bAppDoFast = macroSystemFFWD;
// Load State
if (macroSystemLoadState && macroSystemLoadState != prevLState) {
PostMessage(hScrnWnd, WM_KEYDOWN, VK_F9, 0);
}
prevLState = macroSystemLoadState;
// Save State
if (macroSystemSaveState && macroSystemSaveState != prevSState) {
PostMessage(hScrnWnd, WM_KEYDOWN, VK_F10, 0);
}
prevSState = macroSystemSaveState;
// UNDO State
if (macroSystemUNDOState && macroSystemUNDOState != prevUState) {
scrnSSUndo();
}
prevUState = macroSystemUNDOState;
}
static int GetInput(bool bCopy)

View File

@ -772,6 +772,20 @@ int BurnerLoadDriver(TCHAR *szDriverName)
return 0;
}
void scrnSSUndo() // called from the menu (shift+F8) and CheckSystemMacros() in run.cpp
{
if (bDrvOkay) {
TCHAR szString[256] = _T("state undo");
TCHAR szStringFailed[256] = _T("state: nothing to undo");
if (!StatedUNDO(nSavestateSlot)) {
VidSNewShortMsg(szString);
} else {
VidSNewShortMsg(szStringFailed);
}
PausedRedraw();
}
}
static void OnCommand(HWND /*hDlg*/, int id, HWND /*hwndCtl*/, UINT codeNotify)
{
//if(id >= ID_MDI_START_CHILD) {
@ -1088,16 +1102,7 @@ static void OnCommand(HWND /*hDlg*/, int id, HWND /*hwndCtl*/, UINT codeNotify)
break;
}
case MENU_STATE_UNDO:
if (bDrvOkay) {
TCHAR szString[256] = _T("state undo");
TCHAR szStringFailed[256] = _T("state: nothing to undo");
if (!StatedUNDO(nSavestateSlot)) {
VidSNewShortMsg(szString);
} else {
VidSNewShortMsg(szStringFailed);
}
PausedRedraw();
}
scrnSSUndo();
break;
case MENU_STATE_LOAD_SLOT:
if (bDrvOkay && !kNetGame) {