mirror of
https://github.com/TES3MP/openmw-tes3mp.git
synced 2025-01-19 23:23:52 +00:00
Added quicksave and quickload
This commit is contained in:
parent
ee581f593b
commit
f90810223a
2 changed files with 45 additions and 0 deletions
|
@ -26,6 +26,7 @@
|
||||||
#include "../mwworld/esmstore.hpp"
|
#include "../mwworld/esmstore.hpp"
|
||||||
|
|
||||||
#include "../mwmechanics/creaturestats.hpp"
|
#include "../mwmechanics/creaturestats.hpp"
|
||||||
|
#include "../mwstate/character.hpp"
|
||||||
|
|
||||||
using namespace ICS;
|
using namespace ICS;
|
||||||
|
|
||||||
|
@ -252,6 +253,12 @@ namespace MWInput
|
||||||
case A_ToggleHUD:
|
case A_ToggleHUD:
|
||||||
MWBase::Environment::get().getWindowManager()->toggleHud();
|
MWBase::Environment::get().getWindowManager()->toggleHud();
|
||||||
break;
|
break;
|
||||||
|
case A_QuickSave:
|
||||||
|
quickSave();
|
||||||
|
break;
|
||||||
|
case A_QuickLoad:
|
||||||
|
quickLoad();
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -638,6 +645,36 @@ namespace MWInput
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void InputManager::quickLoad() {
|
||||||
|
MWState::Character* mCurrentCharacter = MWBase::Environment::get().getStateManager()->getCurrentCharacter(false); //Get current character
|
||||||
|
if(mCurrentCharacter) { //Ensure a current character exists
|
||||||
|
const MWState::Slot* slot = &*mCurrentCharacter->begin(); //Get newest save
|
||||||
|
if(slot) //Don't even try loading it if there's no prior save.
|
||||||
|
MWBase::Environment::get().getStateManager()->loadGame (mCurrentCharacter, slot); //load newest save. That was easy!
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void InputManager::quickSave() {
|
||||||
|
const MWState::Slot* slot = NULL;
|
||||||
|
MWState::Character* mCurrentCharacter = MWBase::Environment::get().getStateManager()->getCurrentCharacter(false); //Get current character
|
||||||
|
if (mCurrentCharacter) //Ensure one exists, otherwise do nothing
|
||||||
|
{
|
||||||
|
//Find quicksave slot
|
||||||
|
for (MWState::Character::SlotIterator it = mCurrentCharacter->begin(); it != mCurrentCharacter->end(); ++it)
|
||||||
|
{
|
||||||
|
if (it->mProfile.mDescription == "Quicksave")
|
||||||
|
slot = &*it;
|
||||||
|
}
|
||||||
|
//If no quicksave works create a new slot with Signature
|
||||||
|
if(slot == NULL) {
|
||||||
|
slot = mCurrentCharacter->createSlot(mCurrentCharacter->getSignature());
|
||||||
|
if(slot==NULL)
|
||||||
|
std::cout << "Couldn't work out" << std::endl;
|
||||||
|
}
|
||||||
|
//MWBase::Environment::get().getWindowManager()->messageBox("#{sQuick_save}"); //No message on quicksave?
|
||||||
|
MWBase::Environment::get().getStateManager()->saveGame("Quicksave", slot);
|
||||||
|
}
|
||||||
|
}
|
||||||
void InputManager::toggleSpell()
|
void InputManager::toggleSpell()
|
||||||
{
|
{
|
||||||
if (MWBase::Environment::get().getWindowManager()->isGuiMode()) return;
|
if (MWBase::Environment::get().getWindowManager()->isGuiMode()) return;
|
||||||
|
@ -842,6 +879,8 @@ namespace MWInput
|
||||||
defaultKeyBindings[A_Screenshot] = SDL_GetKeyFromScancode(SDL_SCANCODE_F12);
|
defaultKeyBindings[A_Screenshot] = SDL_GetKeyFromScancode(SDL_SCANCODE_F12);
|
||||||
defaultKeyBindings[A_ToggleHUD] = SDL_GetKeyFromScancode(SDL_SCANCODE_F11);
|
defaultKeyBindings[A_ToggleHUD] = SDL_GetKeyFromScancode(SDL_SCANCODE_F11);
|
||||||
defaultKeyBindings[A_AlwaysRun] = SDL_GetKeyFromScancode(SDL_SCANCODE_Y);
|
defaultKeyBindings[A_AlwaysRun] = SDL_GetKeyFromScancode(SDL_SCANCODE_Y);
|
||||||
|
defaultKeyBindings[A_QuickSave] = SDL_GetKeyFromScancode(SDL_SCANCODE_F5);
|
||||||
|
defaultKeyBindings[A_QuickLoad] = SDL_GetKeyFromScancode(SDL_SCANCODE_F9);
|
||||||
|
|
||||||
std::map<int, int> defaultMouseButtonBindings;
|
std::map<int, int> defaultMouseButtonBindings;
|
||||||
defaultMouseButtonBindings[A_Inventory] = SDL_BUTTON_RIGHT;
|
defaultMouseButtonBindings[A_Inventory] = SDL_BUTTON_RIGHT;
|
||||||
|
@ -918,6 +957,8 @@ namespace MWInput
|
||||||
descriptions[A_QuickKey9] = "sQuick9Cmd";
|
descriptions[A_QuickKey9] = "sQuick9Cmd";
|
||||||
descriptions[A_QuickKey10] = "sQuick10Cmd";
|
descriptions[A_QuickKey10] = "sQuick10Cmd";
|
||||||
descriptions[A_AlwaysRun] = "sAlways_Run";
|
descriptions[A_AlwaysRun] = "sAlways_Run";
|
||||||
|
descriptions[A_QuickSave] = "sQuickSaveCmd";
|
||||||
|
descriptions[A_QuickLoad] = "sQuickLoadCmd";
|
||||||
|
|
||||||
if (descriptions[action] == "")
|
if (descriptions[action] == "")
|
||||||
return ""; // not configurable
|
return ""; // not configurable
|
||||||
|
@ -961,6 +1002,8 @@ namespace MWInput
|
||||||
ret.push_back(A_Journal);
|
ret.push_back(A_Journal);
|
||||||
ret.push_back(A_Rest);
|
ret.push_back(A_Rest);
|
||||||
ret.push_back(A_Console);
|
ret.push_back(A_Console);
|
||||||
|
ret.push_back(A_QuickSave);
|
||||||
|
ret.push_back(A_QuickLoad);
|
||||||
ret.push_back(A_Screenshot);
|
ret.push_back(A_Screenshot);
|
||||||
ret.push_back(A_QuickKeysMenu);
|
ret.push_back(A_QuickKeysMenu);
|
||||||
ret.push_back(A_QuickKey1);
|
ret.push_back(A_QuickKey1);
|
||||||
|
|
|
@ -183,6 +183,8 @@ namespace MWInput
|
||||||
void toggleWalking();
|
void toggleWalking();
|
||||||
void toggleAutoMove();
|
void toggleAutoMove();
|
||||||
void rest();
|
void rest();
|
||||||
|
void quickLoad();
|
||||||
|
void quickSave();
|
||||||
|
|
||||||
void quickKey (int index);
|
void quickKey (int index);
|
||||||
void showQuickKeysMenu();
|
void showQuickKeysMenu();
|
||||||
|
|
Loading…
Reference in a new issue