ULTIMA4: Descend to keybinder

This commit is contained in:
Paul Gilbert 2020-04-13 21:18:11 -07:00
parent f6761f0088
commit 1d43f7a132
5 changed files with 41 additions and 29 deletions

View File

@ -431,6 +431,34 @@ bool Debugger::cmdClimb(int argc, const char **argv) {
return isDebuggerActive();
}
bool Debugger::cmdDescend(int argc, const char **argv) {
// unload the map for the second level of Lord British's Castle. The reason
// why is that Lord British's farewell is dependent on the number of party members.
// Instead of just redoing the dialog, it's a bit severe, but easier to unload the
// whole level.
bool cleanMap = (g_context->_party->size() == 1 && g_context->_location->_map->_id == 100);
if (!usePortalAt(g_context->_location, g_context->_location->_coords, ACTION_DESCEND)) {
if (g_context->_transportContext == TRANSPORT_BALLOON) {
print("Land Balloon");
if (!g_context->_party->isFlying())
print("%cAlready Landed!%c", FG_GREY, FG_WHITE);
else if (g_context->_location->_map->tileTypeAt(g_context->_location->_coords, WITH_OBJECTS)->canLandBalloon()) {
g_ultima->_saveGame->_balloonState = 0;
g_context->_opacity = 1;
} else {
print("%cNot Here!%c", FG_GREY, FG_WHITE);
}
} else {
print("%cDescend what?%c", FG_GREY, FG_WHITE);
}
} else {
if (cleanMap)
mapMgr->unloadMap(100);
}
return isDebuggerActive();
}
bool Debugger::cmdEnter(int argc, const char **argv) {
if (!usePortalAt(g_context->_location, g_context->_location->_coords, ACTION_ENTER)) {
if (!g_context->_location->_map->portalAt(g_context->_location->_coords, ACTION_ENTER))

View File

@ -103,6 +103,11 @@ private:
*/
bool cmdClimb(int argc, const char **argv);
/**
* Descend
*/
bool cmdDescend(int argc, const char **argv);
/**
* Enter location
*/

View File

@ -659,29 +659,6 @@ bool GameController::keyPressed(int key) {
endTurn = false;
break;
case 'd': {
// unload the map for the second level of Lord British's Castle. The reason
// why is that Lord British's farewell is dependent on the number of party members.
// Instead of just redoing the dialog, it's a bit severe, but easier to unload the
// whole level.
bool cleanMap = (g_context->_party->size() == 1 && g_context->_location->_map->_id == 100);
if (!usePortalAt(g_context->_location, g_context->_location->_coords, ACTION_DESCEND)) {
if (g_context->_transportContext == TRANSPORT_BALLOON) {
screenMessage("Land Balloon\n");
if (!g_context->_party->isFlying())
screenMessage("%cAlready Landed!%c\n", FG_GREY, FG_WHITE);
else if (g_context->_location->_map->tileTypeAt(g_context->_location->_coords, WITH_OBJECTS)->canLandBalloon()) {
g_ultima->_saveGame->_balloonState = 0;
g_context->_opacity = 1;
} else screenMessage("%cNot Here!%c\n", FG_GREY, FG_WHITE);
} else screenMessage("%cDescend what?%c\n", FG_GREY, FG_WHITE);
} else {
if (cleanMap)
mapMgr->unloadMap(100);
}
break;
}
case 'v':
if (g_music->toggle())
screenMessage("Volume On!\n");

View File

@ -47,6 +47,7 @@ static const KeybindingRecord KEYS[] = {
{ KEYBIND_BOARD, "BOARD", "Board", "board", "b", nullptr },
{ KEYBIND_CAST, "CAST", "Cast", "cast", "c", nullptr },
{ KEYBIND_CLIMB, "CLIMB", "Climb", "climb", "k", nullptr },
{ KEYBIND_DESCEND, "DESCEND", "Descend", "descend", "d", nullptr },
{ KEYBIND_ENTER, "ENTER", "Enter", "enter", "e", nullptr },
{ KEYBIND_EXIT, "EXIT", "Exit", "exit", "x", nullptr },
{ KEYBIND_FIRE, "FIRE", "Fire", "fire", "f", nullptr },

View File

@ -31,12 +31,13 @@ namespace Ultima4 {
enum KeybindingAction {
KEYBIND_UP, KEYBIND_DOWN, KEYBIND_LEFT, KEYBIND_RIGHT,
KEYBIND_ATTACK, KEYBIND_BOARD, KEYBIND_CAST, KEYBIND_CLIMB,
KEYBIND_ENTER, KEYBIND_EXIT, KEYBIND_FIRE, KEYBIND_GET,
KEYBIND_HOLE_UP, KEYBIND_IGNITE, KEYBIND_JIMMY, KEYBIND_LOCATE,
KEYBIND_MIX, KEYBIND_NEW_ORDER, KEYBIND_OPEN_DOOR, KEYBIND_PASS,
KEYBIND_PEER, KEYBIND_QUIT_SAVE, KEYBIND_READY_WEAPON,
KEYBIND_SEARCH, KEYBIND_STATS, KEYBIND_TALK, KEYBIND_USE,
KEYBIND_WEAR, KEYBIND_YELL,
KEYBIND_DESCEND, KEYBIND_ENTER, KEYBIND_EXIT, KEYBIND_FIRE,
KEYBIND_GET, KEYBIND_HOLE_UP, KEYBIND_IGNITE, KEYBIND_JIMMY,
KEYBIND_LOCATE, KEYBIND_MIX, KEYBIND_NEW_ORDER,
KEYBIND_OPEN_DOOR, KEYBIND_PASS, KEYBIND_PEER,
KEYBIND_QUIT_SAVE, KEYBIND_READY_WEAPON, KEYBIND_SEARCH,
KEYBIND_STATS, KEYBIND_TALK, KEYBIND_USE, KEYBIND_WEAR,
KEYBIND_YELL,
KEYBIND_NONE
};