mirror of
https://github.com/libretro/scummvm.git
synced 2025-01-07 10:21:31 +00:00
ULTIMA4: Changed enter to a keybinder action
This commit is contained in:
parent
e5894a132e
commit
dba370697f
@ -41,11 +41,13 @@ Debugger *g_debugger;
|
||||
Debugger::Debugger() : Shared::Debugger() {
|
||||
g_debugger = this;
|
||||
_collisionOverride = false;
|
||||
_dontEndTurn = false;
|
||||
|
||||
registerCmd("move", WRAP_METHOD(Debugger, cmdMove));
|
||||
registerCmd("attack", WRAP_METHOD(Debugger, cmdAttack));
|
||||
registerCmd("board", WRAP_METHOD(Debugger, cmdBoard));
|
||||
registerCmd("cast", WRAP_METHOD(Debugger, cmdCastSpell));
|
||||
registerCmd("enter", WRAP_METHOD(Debugger, cmdEnter));
|
||||
registerCmd("pass", WRAP_METHOD(Debugger, cmdPass));
|
||||
|
||||
registerCmd("3d", WRAP_METHOD(Debugger, cmd3d));
|
||||
@ -115,9 +117,12 @@ 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() && argv[0] != "move")
|
||||
g_game->finishTurn();
|
||||
if (result && !isActive()) {
|
||||
if (!_dontEndTurn)
|
||||
g_game->finishTurn();
|
||||
}
|
||||
|
||||
_dontEndTurn = false;
|
||||
return result;
|
||||
}
|
||||
|
||||
@ -146,8 +151,8 @@ bool Debugger::cmdMove(int argc, const char **argv) {
|
||||
|
||||
// Let the movement handler decide to end the turn
|
||||
bool endTurn = (retval & MOVE_END_TURN);
|
||||
if (endTurn)
|
||||
g_game->finishTurn();
|
||||
if (!endTurn)
|
||||
dontEndTurn();
|
||||
|
||||
return false;
|
||||
}
|
||||
@ -226,6 +231,17 @@ bool Debugger::cmdCastSpell(int argc, const char **argv) {
|
||||
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))
|
||||
print("%cEnter what?%c\n", FG_GREY, FG_WHITE);
|
||||
} else {
|
||||
dontEndTurn();
|
||||
}
|
||||
|
||||
return isDebuggerActive();
|
||||
}
|
||||
|
||||
bool Debugger::cmdPass(int argc, const char **argv) {
|
||||
print("Pass");
|
||||
return isDebuggerActive();
|
||||
|
@ -37,6 +37,7 @@ namespace Ultima4 {
|
||||
class Debugger : public Shared::Debugger, public DebuggerActions {
|
||||
private:
|
||||
MapTile _horse, _ship, _balloon;
|
||||
bool _dontEndTurn;
|
||||
protected:
|
||||
/**
|
||||
* Returns true if the debugger is active
|
||||
@ -68,6 +69,14 @@ protected:
|
||||
* Gets the direction for an action
|
||||
*/
|
||||
Direction getDirection(int argc, const char **argv);
|
||||
|
||||
/**
|
||||
* Used by methods so that when they're triggered by a keybinding
|
||||
* action, stops the turn from being finished when they're done
|
||||
*/
|
||||
void dontEndTurn() {
|
||||
_dontEndTurn = true;
|
||||
}
|
||||
private:
|
||||
/**
|
||||
* Move the avatar in a given direction
|
||||
@ -89,6 +98,11 @@ private:
|
||||
*/
|
||||
bool cmdCastSpell(int argc, const char **argv);
|
||||
|
||||
/**
|
||||
* Enter location
|
||||
*/
|
||||
bool cmdEnter(int argc, const char **argv);
|
||||
|
||||
/**
|
||||
* Pass turn
|
||||
*/
|
||||
|
@ -717,13 +717,6 @@ bool GameController::keyPressed(int key) {
|
||||
break;
|
||||
}
|
||||
|
||||
case 'e':
|
||||
if (!usePortalAt(g_context->_location, g_context->_location->_coords, ACTION_ENTER)) {
|
||||
if (!g_context->_location->_map->portalAt(g_context->_location->_coords, ACTION_ENTER))
|
||||
screenMessage("%cEnter what?%c\n", FG_GREY, FG_WHITE);
|
||||
} else endTurn = 0; /* entering a portal doesn't end the turn */
|
||||
break;
|
||||
|
||||
case 'f':
|
||||
fire();
|
||||
break;
|
||||
|
@ -46,6 +46,7 @@ static const KeybindingRecord KEYS[] = {
|
||||
{ KEYBIND_ATTACK, "ATTACK", "Attack", "attack", "a", nullptr },
|
||||
{ KEYBIND_BOARD, "BOARD", "Board", "board", "b", nullptr },
|
||||
{ KEYBIND_CAST, "CAST", "Cast", "cast", "c", nullptr },
|
||||
{ KEYBIND_ENTER, "ENTER", "Enter", "enter", "e", nullptr },
|
||||
{ KEYBIND_PASS, "PASS", "Pass", "pass", "SPACE", nullptr },
|
||||
|
||||
{ KEYBIND_NONE, nullptr, nullptr, nullptr, nullptr, nullptr }
|
||||
|
@ -30,7 +30,7 @@ namespace Ultima4 {
|
||||
|
||||
enum KeybindingAction {
|
||||
KEYBIND_UP, KEYBIND_DOWN, KEYBIND_LEFT, KEYBIND_RIGHT,
|
||||
KEYBIND_ATTACK, KEYBIND_BOARD, KEYBIND_CAST,
|
||||
KEYBIND_ATTACK, KEYBIND_BOARD, KEYBIND_CAST, KEYBIND_ENTER,
|
||||
KEYBIND_PASS,
|
||||
|
||||
KEYBIND_NONE
|
||||
|
Loading…
Reference in New Issue
Block a user