From 4e1a461b532ca56765e2c24dfac00b3b3e3d4260 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Wed, 15 Apr 2020 18:51:21 -0700 Subject: [PATCH] ULTIMA4: Hook up bulk of the cheat actions to keybinder --- engines/ultima/ultima4/core/debugger.cpp | 37 ++++++++++++------------ engines/ultima/ultima4/meta_engine.cpp | 18 ++++++++++++ engines/ultima/ultima4/meta_engine.h | 7 +++++ 3 files changed, 44 insertions(+), 18 deletions(-) diff --git a/engines/ultima/ultima4/core/debugger.cpp b/engines/ultima/ultima4/core/debugger.cpp index f2b9915d966..1cfb1585d78 100644 --- a/engines/ultima/ultima4/core/debugger.cpp +++ b/engines/ultima/ultima4/core/debugger.cpp @@ -92,6 +92,7 @@ Debugger::Debugger() : Shared::Debugger() { registerCmd("help", WRAP_METHOD(Debugger, cmdHelp)); registerCmd("items", WRAP_METHOD(Debugger, cmdItems)); registerCmd("karma", WRAP_METHOD(Debugger, cmdKarma)); + registerCmd("leave", WRAP_METHOD(Debugger, cmdLeave)); registerCmd("location", WRAP_METHOD(Debugger, cmdLocation)); registerCmd("mixtures", WRAP_METHOD(Debugger, cmdMixtures)); registerCmd("moon", WRAP_METHOD(Debugger, cmdMoon)); @@ -218,7 +219,7 @@ bool Debugger::cmdAttack(int argc, const char **argv) { printN("Attack: "); if (g_context->_party->isFlying()) { - screenMessage("\n%cDrift only!%c\n", FG_GREY, FG_WHITE); + print("\n%cDrift only!%c", FG_GREY, FG_WHITE); return isDebuggerActive(); } @@ -300,7 +301,7 @@ bool Debugger::cmdCastSpell(int argc, const char **argv) { if (spell == -1) return isDebuggerActive(); - screenMessage("%s!\n", spellGetName(spell)); //Prints spell name at prompt + print("%s!", spellGetName(spell)); //Prints spell name at prompt g_context->_stats->setView(STATS_PARTY_OVERVIEW); @@ -317,7 +318,7 @@ bool Debugger::cmdCastSpell(int argc, const char **argv) { break; case Spell::PARAM_PHASE: { - screenMessage("To Phase: "); + printN("To Phase: "); #ifdef IOS U4IOS::IOSConversationChoiceHelper choiceController; choiceController.fullSizeChoicePanel(); @@ -615,7 +616,7 @@ bool Debugger::cmdIgnite(int argc, const char **argv) { } bool Debugger::cmdJimmy(int argc, const char **argv) { - screenMessage("Jimmy: "); + printN("Jimmy: "); Direction dir = gameGetDirection(); if (dir == DIR_NONE) @@ -1121,7 +1122,7 @@ bool Debugger::cmdDestroy(int argc, const char **argv) { print("destroy "); return isDebuggerActive(); } else { - screenMessage("Destroy Object\nDir: "); + printN("Destroy Object\nDir: "); dir = gameGetDirection(); } @@ -1226,9 +1227,9 @@ bool Debugger::cmdGoto(int argc, const char **argv) { print("teleport "); return true; } else { - screenMessage("Goto: "); + printN("Goto: "); dest = gameGetInput(32); - screenMessage("\n"); + print(""); } dest.toLowercase(); @@ -1240,7 +1241,7 @@ bool Debugger::cmdGoto(int argc, const char **argv) { destNameLower.toLowercase(); if (destNameLower.find(dest) != Common::String::npos) { - screenMessage("\n%s\n", mapMgr->get(destid)->getName().c_str()); + print("\n%s", mapMgr->get(destid)->getName().c_str()); g_context->_location->_coords = g_context->_location->_map->_portals[p]->_coords; found = true; break; @@ -1270,12 +1271,12 @@ bool Debugger::cmdGoto(int argc, const char **argv) { bool Debugger::cmdHelp(int argc, const char **argv) { if (!isDebuggerActive()) { - screenMessage("Help!\n"); + print("Help!"); screenPrompt(); } - /* Help! send me to Lord British (who conveniently is right around where you are)! */ - g_game->setMap(mapMgr->get(100), 1, NULL); + // Help! send me to Lord British + g_game->setMap(mapMgr->get(100), 1, nullptr); g_context->_location->_coords.x = 19; g_context->_location->_coords.y = 8; g_context->_location->_coords.z = 0; @@ -1356,7 +1357,7 @@ bool Debugger::cmdMixtures(int argc, const char **argv) { for (int i = 0; i < SPELL_MAX; i++) g_ultima->_saveGame->_mixtures[i] = 99; - screenMessage("All mixtures given"); + print("All mixtures given"); return isDebuggerActive(); } @@ -1382,7 +1383,7 @@ bool Debugger::cmdMoon(int argc, const char **argv) { bool Debugger::cmdOpacity(int argc, const char **argv) { g_context->_opacity = !g_context->_opacity; - screenMessage("Opacity is %s", g_context->_opacity ? "on" : "off"); + print("Opacity is %s", g_context->_opacity ? "on" : "off"); return isDebuggerActive(); } @@ -1420,8 +1421,8 @@ bool Debugger::cmdSummon(int argc, const char **argv) { print("summon "); return true; } else { - screenMessage("Summon!\n"); - screenMessage("What?\n"); + print("Summon!"); + print("What?"); creature = gameGetInput(); } @@ -1485,13 +1486,13 @@ bool Debugger::cmdTransport(int argc, const char **argv) { } else if (isDebuggerActive()) { dir = DIR_NONE; } else { - screenMessage("%s\n", tile->getName().c_str()); + print("%s", tile->getName().c_str()); // Get the direction in which to create the transport ReadDirController readDir; eventHandler->pushController(&readDir); - screenMessage("Dir: "); + printN("Dir: "); dir = readDir.waitFor(); } @@ -1558,7 +1559,7 @@ bool Debugger::cmdVirtue(int argc, const char **argv) { g_ultima->_saveGame->_karma[i] = 0; g_context->_stats->update(); - screenMessage("Full virtues"); + print("Full virtues"); } else { int virtue = strToInt(argv[1]); diff --git a/engines/ultima/ultima4/meta_engine.cpp b/engines/ultima/ultima4/meta_engine.cpp index cee8d0af2ec..39d58b1ce25 100644 --- a/engines/ultima/ultima4/meta_engine.cpp +++ b/engines/ultima/ultima4/meta_engine.cpp @@ -92,6 +92,24 @@ static const KeybindingRecord PARTY_KEYS[] = { }; static const KeybindingRecord CHEAT_KEYS[] = { + { KEYBIND_CHEAT_COLLISIONS, "CHEAT-COLLISIONS", "Toggle Collision Handling", "collisions", "A+c", nullptr }, + { KEYBIND_CHEAT_DESTROY, "CHEAT-DESTROY", "Destroy Object", "destroy", "A+d", nullptr }, + { KEYBIND_CHEAT_EQUIPMENT, "CHEAT-EQUIPMENT", "Full Equipment", "equipment", "A+e", nullptr }, + { KEYBIND_CHEAT_GOTO, "CHEAT-GOTO", "Goto location", "goto", "A+g", nullptr }, + { KEYBIND_CHEAT_HELP, "CHEAT-HELP", "Help - Teleport to Lord British", "goto", "A+h", nullptr }, + { KEYBIND_CHEAT_ITEMS, "CHEAT-ITEMS", "Give Items", "items", "A+i", nullptr }, + { KEYBIND_CHEAT_KARMA, "CHEAT-KARMA", "List Karma", "karma", "A+k", nullptr }, + { KEYBIND_CHEAT_LEAVE, "CHEAT-LEAVE", "Leave Location", "leave", "A+l", nullptr }, + { KEYBIND_CHEAT_MIXTURES, "CHEAT-MIXTURES", "Give Mixtures", "mixtures", "A+m", nullptr }, + { KEYBIND_CHEAT_PARTY, "CHEAT-PARTY", "Full Party", "companions", "A+p", nullptr }, + { KEYBIND_CHEAT_REAGENTS, "CHEAT-REAGENTS", "Give Reagents", "reagents", "A+r", nullptr }, + { KEYBIND_CHEAT_STATS, "CHEAT-STATS", "Full Stats", "fullstats", "A+s", nullptr }, + { KEYBIND_CHEAT_TRANSPORT, "CHEAT-TRANSPORT", "Create Transport", "transport", "A+t", nullptr }, + { KEYBIND_CHEAT_UP, "CHEAT-UP", "Up Level", "up", "A+UP", nullptr }, + { KEYBIND_CHEAT_DOWN, "CHEAT-DOWN", "Down Level", "down", "A+DOWN", nullptr }, + { KEYBIND_CHEAT_VIRTUE, "CHEAT-VIRTUE", "Grant Virtue", "virtue", "A+v", nullptr }, + { KEYBIND_CHEAT_WIND, "CHEAT-WIND", "Change Wind", "wind", "A+w", nullptr }, + { KEYBIND_NONE, nullptr, nullptr, nullptr, nullptr, nullptr } }; diff --git a/engines/ultima/ultima4/meta_engine.h b/engines/ultima/ultima4/meta_engine.h index 46f711a3068..512a7b50923 100644 --- a/engines/ultima/ultima4/meta_engine.h +++ b/engines/ultima/ultima4/meta_engine.h @@ -44,6 +44,13 @@ enum KeybindingAction { KEYBIND_PARTY4, KEYBIND_PARTY5, KEYBIND_PARTY6, KEYBIND_PARTY7, KEYBIND_PARTY8, + KEYBIND_CHEAT_COLLISIONS, KEYBIND_CHEAT_DESTROY, + KEYBIND_CHEAT_EQUIPMENT, KEYBIND_CHEAT_GOTO, KEYBIND_CHEAT_HELP, + KEYBIND_CHEAT_ITEMS, KEYBIND_CHEAT_KARMA, KEYBIND_CHEAT_LEAVE, + KEYBIND_CHEAT_MIXTURES, KEYBIND_CHEAT_PARTY, KEYBIND_CHEAT_REAGENTS, + KEYBIND_CHEAT_STATS, KEYBIND_CHEAT_TRANSPORT, KEYBIND_CHEAT_UP, + KEYBIND_CHEAT_DOWN, KEYBIND_CHEAT_VIRTUE, KEYBIND_CHEAT_WIND, + KEYBIND_NONE };