mirror of
https://github.com/libretro/scummvm.git
synced 2024-12-13 21:31:53 +00:00
ULTIMA4: Party character selection keybindings
This commit is contained in:
parent
fda93e493b
commit
36ef10ffe6
@ -66,6 +66,7 @@ Debugger::Debugger() : Shared::Debugger() {
|
||||
registerCmd("musicToggle", WRAP_METHOD(Debugger, cmdMusicToggle));
|
||||
registerCmd("open", WRAP_METHOD(Debugger, cmdOpenDoor));
|
||||
registerCmd("order", WRAP_METHOD(Debugger, cmdNewOrder));
|
||||
registerCmd("party", WRAP_METHOD(Debugger, cmdParty));
|
||||
registerCmd("pass", WRAP_METHOD(Debugger, cmdPass));
|
||||
registerCmd("peer", WRAP_METHOD(Debugger, cmdPeer));
|
||||
registerCmd("quitAndSave", WRAP_METHOD(Debugger, cmdQuitAndSave));
|
||||
@ -130,7 +131,7 @@ void Debugger::printN(const char *fmt, ...) {
|
||||
// relevant for showing the text in the debugger
|
||||
Common::String s;
|
||||
for (Common::String::iterator it = str.begin(); it != str.end(); ++it) {
|
||||
if (*it <= ' ' && *it != '\n')
|
||||
if (*it >= ' ' || *it == '\n')
|
||||
s += *it;
|
||||
}
|
||||
|
||||
@ -143,9 +144,11 @@ void Debugger::printN(const char *fmt, ...) {
|
||||
bool Debugger::handleCommand(int argc, const char **argv, bool &keepRunning) {
|
||||
bool result = Shared::Debugger::handleCommand(argc, argv, keepRunning);
|
||||
|
||||
if (result && !isActive()) {
|
||||
if (!_dontEndTurn)
|
||||
if (result) {
|
||||
if (!isActive() && !_dontEndTurn)
|
||||
g_game->finishTurn();
|
||||
else if (_dontEndTurn && eventHandler->getController() == g_game)
|
||||
g_context->_location->_turnCompleter->finishTurn();
|
||||
}
|
||||
|
||||
_dontEndTurn = false;
|
||||
@ -773,6 +776,18 @@ bool Debugger::cmdOpenDoor(int argc, const char **argv) {
|
||||
return isDebuggerActive();
|
||||
}
|
||||
|
||||
bool Debugger::cmdParty(int argc, const char **argv) {
|
||||
if (settings._enhancements && settings._enhancementsOptions._activePlayer) {
|
||||
int player = (argc == 2) ? strToInt(argv[1]) - 1 : -1;
|
||||
gameSetActivePlayer(player);
|
||||
} else {
|
||||
print("%cBad command!%c", FG_GREY, FG_WHITE);
|
||||
}
|
||||
|
||||
dontEndTurn();
|
||||
return isDebuggerActive();
|
||||
}
|
||||
|
||||
bool Debugger::cmdPass(int argc, const char **argv) {
|
||||
print("Pass");
|
||||
return isDebuggerActive();
|
||||
@ -1069,8 +1084,6 @@ bool Debugger::cmdCollisions(int argc, const char **argv) {
|
||||
|
||||
bool Debugger::cmdCompanions(int argc, const char **argv) {
|
||||
for (int m = g_ultima->_saveGame->_members; m < 8; m++) {
|
||||
debug("m = %d\n", m);
|
||||
debug("n = %s\n", g_ultima->_saveGame->_players[m].name);
|
||||
if (g_context->_party->canPersonJoin(g_ultima->_saveGame->_players[m].name, NULL)) {
|
||||
g_context->_party->join(g_ultima->_saveGame->_players[m].name);
|
||||
}
|
||||
|
@ -169,6 +169,11 @@ private:
|
||||
*/
|
||||
bool cmdOpenDoor(int argc, const char **argv);
|
||||
|
||||
/**
|
||||
* Specifies a particular party number
|
||||
*/
|
||||
bool cmdParty(int argc, const char **argv);
|
||||
|
||||
/**
|
||||
* Pass turn
|
||||
*/
|
||||
|
@ -615,154 +615,6 @@ bool GameController::keyPressed(int key) {
|
||||
}
|
||||
break;
|
||||
|
||||
case 'h' + U4_ALT: {
|
||||
#ifdef IOS
|
||||
U4IOS::IOSHideActionKeysHelper hideActionKeys;
|
||||
#endif
|
||||
ReadChoiceController pauseController("");
|
||||
|
||||
screenMessage("Key Reference:\n"
|
||||
"Arrow Keys: Move\n"
|
||||
"a: Attack\n"
|
||||
"b: Board\n"
|
||||
"c: Cast Spell\n"
|
||||
"d: Descend\n"
|
||||
"e: Enter\n"
|
||||
"f: Fire Cannons\n"
|
||||
"g: Get Chest\n"
|
||||
"h: Hole up\n"
|
||||
"i: Ignite torch\n"
|
||||
"(more)");
|
||||
|
||||
eventHandler->pushController(&pauseController);
|
||||
pauseController.waitFor();
|
||||
|
||||
screenMessage("\n"
|
||||
"j: Jimmy lock\n"
|
||||
"k: Klimb\n"
|
||||
"l: Locate\n"
|
||||
"m: Mix reagents\n"
|
||||
"n: New Order\n"
|
||||
"o: Open door\n"
|
||||
"p: Peer at Gem\n"
|
||||
"q: Quit & Save\n"
|
||||
"r: Ready weapon\n"
|
||||
"s: Search\n"
|
||||
"t: Talk\n"
|
||||
"(more)");
|
||||
|
||||
eventHandler->pushController(&pauseController);
|
||||
pauseController.waitFor();
|
||||
|
||||
screenMessage("\n"
|
||||
"u: Use Item\n"
|
||||
"v: Volume On/Off\n"
|
||||
"w: Wear armour\n"
|
||||
"x: eXit\n"
|
||||
"y: Yell\n"
|
||||
"z: Ztats\n"
|
||||
"Space: Pass\n"
|
||||
",: - Music Vol\n"
|
||||
".: + Music Vol\n"
|
||||
"<: - Sound Vol\n"
|
||||
">: + Sound Vol\n"
|
||||
"(more)");
|
||||
|
||||
eventHandler->pushController(&pauseController);
|
||||
pauseController.waitFor();
|
||||
|
||||
screenMessage("\n"
|
||||
"Alt-Q: Main Menu\n"
|
||||
"Alt-V: Version\n"
|
||||
"Alt-X: Quit\n"
|
||||
"\n"
|
||||
"\n"
|
||||
"\n"
|
||||
"\n"
|
||||
"\n"
|
||||
"\n"
|
||||
"\n"
|
||||
"\n"
|
||||
);
|
||||
screenPrompt();
|
||||
break;
|
||||
}
|
||||
|
||||
case 'q' + U4_ALT: {
|
||||
// TODO - implement loop in main() and let quit fall back to there
|
||||
// Quit to the main menu
|
||||
endTurn = false;
|
||||
|
||||
screenMessage("Quit to menu?");
|
||||
char choice = ReadChoiceController::get("yn \n\033");
|
||||
screenMessage("%c", choice);
|
||||
if (choice != 'y') {
|
||||
screenMessage("\n");
|
||||
break;
|
||||
}
|
||||
|
||||
eventHandler->setScreenUpdate(NULL);
|
||||
eventHandler->popController();
|
||||
|
||||
eventHandler->pushController(intro);
|
||||
|
||||
// Fade out the music and hide the cursor
|
||||
//before returning to the menu.
|
||||
g_music->fadeOut(1000);
|
||||
screenHideCursor();
|
||||
|
||||
intro->init();
|
||||
eventHandler->run();
|
||||
|
||||
|
||||
if (!g_ultima->shouldQuit()) {
|
||||
eventHandler->setControllerDone(false);
|
||||
eventHandler->popController();
|
||||
eventHandler->pushController(this);
|
||||
|
||||
|
||||
if (intro->hasInitiatedNewGame()) {
|
||||
//Loads current savegame
|
||||
init();
|
||||
} else {
|
||||
//Inits screen stuff without renewing game
|
||||
initScreen();
|
||||
initScreenWithoutReloadingState();
|
||||
}
|
||||
|
||||
this->_mapArea.reinit();
|
||||
|
||||
intro->deleteIntro();
|
||||
eventHandler->run();
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
// Turn sound effects on/off
|
||||
case 's' + U4_ALT:
|
||||
// FIXME: there's probably a more intuitive key combination for this
|
||||
settings._soundVol = !settings._soundVol;
|
||||
screenMessage("Sound FX %s!\n", settings._soundVol ? "on" : "off");
|
||||
endTurn = false;
|
||||
break;
|
||||
|
||||
case '0':
|
||||
case '1':
|
||||
case '2':
|
||||
case '3':
|
||||
case '4':
|
||||
case '5':
|
||||
case '6':
|
||||
case '7':
|
||||
case '8':
|
||||
case '9':
|
||||
if (settings._enhancements && settings._enhancementsOptions._activePlayer)
|
||||
gameSetActivePlayer(key - '1');
|
||||
else screenMessage("%cBad command!%c\n", FG_GREY, FG_WHITE);
|
||||
|
||||
endTurn = 0;
|
||||
break;
|
||||
|
||||
default:
|
||||
valid = false;
|
||||
break;
|
||||
|
@ -77,39 +77,68 @@ static const KeybindingRecord KEYS[] = {
|
||||
{ KEYBIND_NONE, nullptr, nullptr, nullptr, nullptr, nullptr }
|
||||
};
|
||||
|
||||
static const KeybindingRecord PARTY_KEYS[] = {
|
||||
{ KEYBIND_PARTY0, "PARTY0", "Party - None", "party 0", "0", nullptr },
|
||||
{ KEYBIND_PARTY1, "PARTY1", "Party - Character #1", "party 1", "1", nullptr },
|
||||
{ KEYBIND_PARTY2, "PARTY2", "Party - Character #2", "party 2", "2", nullptr },
|
||||
{ KEYBIND_PARTY3, "PARTY3", "Party - Character #3", "party 3", "3", nullptr },
|
||||
{ KEYBIND_PARTY4, "PARTY4", "Party - Character #4", "party 4", "4", nullptr },
|
||||
{ KEYBIND_PARTY5, "PARTY5", "Party - Character #5", "party 5", "5", nullptr },
|
||||
{ KEYBIND_PARTY6, "PARTY6", "Party - Character #6", "party 6", "6", nullptr },
|
||||
{ KEYBIND_PARTY7, "PARTY7", "Party - Character #7", "party 7", "7", nullptr },
|
||||
{ KEYBIND_PARTY8, "PARTY8", "Party - Character #8", "party 8", "8", nullptr },
|
||||
|
||||
{ KEYBIND_NONE, nullptr, nullptr, nullptr, nullptr, nullptr }
|
||||
};
|
||||
|
||||
static const KeybindingRecord CHEAT_KEYS[] = {
|
||||
{ KEYBIND_NONE, nullptr, nullptr, nullptr, nullptr, nullptr }
|
||||
};
|
||||
|
||||
struct KeysRecord {
|
||||
const char *_id;
|
||||
const char *_desc;
|
||||
const KeybindingRecord *_keys;
|
||||
};
|
||||
static const KeysRecord KEYS_RECORDS[3] = {
|
||||
{ "ultima4", "Ultima IV", KEYS },
|
||||
{ "ultima4_party", "Ultima IV - Party", PARTY_KEYS },
|
||||
{ "ultima4_cheats", "Ultima IV - Cheats", CHEAT_KEYS },
|
||||
};
|
||||
|
||||
Common::KeymapArray MetaEngine::initKeymaps() {
|
||||
Common::KeymapArray keymapArray;
|
||||
|
||||
// Core keymaps
|
||||
Common::Keymap *keyMap = new Common::Keymap(Common::Keymap::kKeymapTypeGame, "ultima4", _("Ultima IV"));
|
||||
keymapArray.push_back(keyMap);
|
||||
|
||||
Common::Keymap *keyMap;
|
||||
Common::Action *act;
|
||||
|
||||
act = new Common::Action("LCLK", _("Interact via Left Click"));
|
||||
act->setLeftClickEvent();
|
||||
act->addDefaultInputMapping("MOUSE_LEFT");
|
||||
act->addDefaultInputMapping("JOY_A");
|
||||
keyMap->addAction(act);
|
||||
for (int kCtr = 0; kCtr < 3; ++kCtr) {
|
||||
// Core keymaps
|
||||
keyMap = new Common::Keymap(Common::Keymap::kKeymapTypeGame,
|
||||
KEYS_RECORDS[kCtr]._id, _(KEYS_RECORDS[kCtr]._desc));
|
||||
keymapArray.push_back(keyMap);
|
||||
|
||||
act = new Common::Action("RCLK", _("Interact via Right Click"));
|
||||
act->setRightClickEvent();
|
||||
act->addDefaultInputMapping("MOUSE_RIGHT");
|
||||
act->addDefaultInputMapping("JOY_B");
|
||||
keyMap->addAction(act);
|
||||
if (kCtr == 0) {
|
||||
act = new Common::Action("LCLK", _("Interact via Left Click"));
|
||||
act->setLeftClickEvent();
|
||||
act->addDefaultInputMapping("MOUSE_LEFT");
|
||||
act->addDefaultInputMapping("JOY_A");
|
||||
keyMap->addAction(act);
|
||||
|
||||
for (const KeybindingRecord *r = KEYS; r->_id; ++r) {
|
||||
act = new Common::Action(r->_id, _(r->_desc));
|
||||
act->setCustomEngineActionEvent(r->_action);
|
||||
act->addDefaultInputMapping(r->_key);
|
||||
if (r->_joy)
|
||||
act->addDefaultInputMapping(r->_joy);
|
||||
keyMap->addAction(act);
|
||||
act = new Common::Action("RCLK", _("Interact via Right Click"));
|
||||
act->setRightClickEvent();
|
||||
act->addDefaultInputMapping("MOUSE_RIGHT");
|
||||
act->addDefaultInputMapping("JOY_B");
|
||||
keyMap->addAction(act);
|
||||
}
|
||||
|
||||
for (const KeybindingRecord *r = KEYS_RECORDS[kCtr]._keys; r->_id; ++r) {
|
||||
act = new Common::Action(r->_id, _(r->_desc));
|
||||
act->setCustomEngineActionEvent(r->_action);
|
||||
act->addDefaultInputMapping(r->_key);
|
||||
if (r->_joy)
|
||||
act->addDefaultInputMapping(r->_joy);
|
||||
keyMap->addAction(act);
|
||||
}
|
||||
}
|
||||
|
||||
return keymapArray;
|
||||
@ -127,10 +156,8 @@ void MetaEngine::executeAction(KeybindingAction keyAction) {
|
||||
}
|
||||
|
||||
Common::String MetaEngine::getMethod(KeybindingAction keyAction) {
|
||||
const KeybindingRecord *KEY_ARRAYS[] = { KEYS, CHEAT_KEYS, nullptr };
|
||||
|
||||
for (const KeybindingRecord **arr = KEY_ARRAYS; *arr; ++arr) {
|
||||
for (const KeybindingRecord *r = *arr; r->_id; ++r) {
|
||||
for (int kCtr = 0; kCtr < 3; ++kCtr) {
|
||||
for (const KeybindingRecord *r = KEYS_RECORDS[kCtr]._keys; r->_id; ++r) {
|
||||
if (r->_action == keyAction)
|
||||
return r->_method;
|
||||
}
|
||||
|
@ -40,6 +40,10 @@ enum KeybindingAction {
|
||||
KEYBIND_STATS, KEYBIND_TALK, KEYBIND_TOGGLE_MUSIC, KEYBIND_USE,
|
||||
KEYBIND_WEAR, KEYBIND_YELL,
|
||||
|
||||
KEYBIND_PARTY0, KEYBIND_PARTY1, KEYBIND_PARTY2, KEYBIND_PARTY3,
|
||||
KEYBIND_PARTY4, KEYBIND_PARTY5, KEYBIND_PARTY6, KEYBIND_PARTY7,
|
||||
KEYBIND_PARTY8,
|
||||
|
||||
KEYBIND_NONE
|
||||
};
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user