Revision: 6320
http://exult.svn.sourceforge.net/exult/?rev=6320&view=rev
Author: marzojr
Date: 2010-07-28 18:05:47 +0000 (Wed, 28 Jul 2010)
Log Message:
-----------
* gamewin.cc, exult.cc, keys.cc: fixed bug #3011719 avatar can do stuff
while passed out. The player will be unable to do almost anything (similar
to the originals) if the avatar is asleep, unconscious, paralyzed or dead.
As a rule, cheat and mapedit actions are still allowed in these cases, and
hackmove allows dragging even in these conditions. Also, purely interface
actions will also work -- like esc, scrolling the map with the mouse wheel
and so on.
* configure.ac: AC_PATH_XTRA is actually causing linking problems in Ubuntu
Karmic, so it has been removed (again).
* Others: Eliminated a few warnings.
Modified Paths:
--------------
exult/trunk/ChangeLog
exult/trunk/audio/Audio.cc
exult/trunk/audio/Midi.cc
exult/trunk/configure.ac
exult/trunk/exult.cc
exult/trunk/gamemap.cc
exult/trunk/gamewin.cc
exult/trunk/gamewin.h
exult/trunk/gumps/Gump.cc
exult/trunk/gumps/Gump_ToggleButton.h
exult/trunk/gumps/Gump_manager.cc
exult/trunk/gumps/Newfile_gump.cc
exult/trunk/gumps/Notebook_gump.cc
exult/trunk/gumps/Paperdoll_gump.cc
exult/trunk/gumps/Spellbook_gump.cc
exult/trunk/keys.cc
Modified: exult/trunk/ChangeLog
===================================================================
--- exult/trunk/ChangeLog 2010-07-26 12:22:43 UTC (rev 6319)
+++ exult/trunk/ChangeLog 2010-07-28 18:05:47 UTC (rev 6320)
@@ -1,3 +1,15 @@
+2010-07-28 Marzo Sette Torres Junior <marzojr@...>
+ * gamewin.cc, exult.cc, keys.cc: fixed bug #3011719 avatar can do stuff
+ while passed out. The player will be unable to do almost anything (similar
+ to the originals) if the avatar is asleep, unconscious, paralyzed or dead.
+ As a rule, cheat and mapedit actions are still allowed in these cases, and
+ hackmove allows dragging even in these conditions. Also, purely interface
+ actions will also work -- like esc, scrolling the map with the mouse wheel
+ and so on.
+ * configure.ac: AC_PATH_XTRA is actually causing linking problems in Ubuntu
+ Karmic, so it has been removed (again).
+ * Others: Eliminated a few warnings.
+
2010-07-26 Willem Jan Palenstijn <wjpalenstijn@...>
* configure.ac: Don't expand AC_PATH_XTRA in a conditional. This broke
configure on all platforms other than linux.
Modified: exult/trunk/audio/Audio.cc
===================================================================
--- exult/trunk/audio/Audio.cc 2010-07-26 12:22:43 UTC (rev 6319)
+++ exult/trunk/audio/Audio.cc 2010-07-28 18:05:47 UTC (rev 6320)
@@ -282,8 +282,7 @@
Audio::Audio() :
truthful_(false),speech_enabled(true), music_enabled(true),
-effects_enabled(true), mixer(0),
-initialized(false), sfx_file(0)
+effects_enabled(true), initialized(false), mixer(0), sfx_file(0)
{
assert(self == NULL);
@@ -735,6 +734,7 @@
return instance_id;
}
+/*
static int slow_sqrt(int i)
{
for (int r = i/2; r != 0; r--)
@@ -744,6 +744,7 @@
return 0;
}
+*/
void Audio::get_2d_position_for_tile(const Tile_coord &tile, int &distance, int &balance)
{
Modified: exult/trunk/audio/Midi.cc
===================================================================
--- exult/trunk/audio/Midi.cc 2010-07-26 12:22:43 UTC (rev 6319)
+++ exult/trunk/audio/Midi.cc 2010-07-28 18:05:47 UTC (rev 6320)
@@ -160,7 +160,7 @@
// Try in patch dir first.
string pflex("<PATCH>/");
- int prefix_len = 0;
+ size_t prefix_len = 0;
if (flex[0] == '<')
{
prefix_len = flex.find(">/");
Modified: exult/trunk/configure.ac
===================================================================
--- exult/trunk/configure.ac 2010-07-26 12:22:43 UTC (rev 6319)
+++ exult/trunk/configure.ac 2010-07-28 18:05:47 UTC (rev 6320)
@@ -49,9 +49,6 @@
EXULT_DATADIR="$datadir/exult"
ARCH=""
-# (Part of) the output of this is currently only used in the linux case below
-AC_PATH_XTRA
-
# determine windowing system from 'host'
AC_MSG_CHECKING([windowing system])
case "$host_os" in
@@ -68,8 +65,6 @@
enable_data="yes"
else
AC_MSG_RESULT([X11 (GNU/Linux)])
- SYSLIBS="$X_LIBS"
- CXXFLAGS="$CXXFLAGS $X_CFLAGS"
fi
;;
beos*)
Modified: exult/trunk/exult.cc
===================================================================
--- exult/trunk/exult.cc 2010-07-26 12:22:43 UTC (rev 6319)
+++ exult/trunk/exult.cc 2010-07-28 18:05:47 UTC (rev 6320)
@@ -1356,6 +1356,7 @@
// Mouse scale factor
int scale = gwin->get_fastmouse() ? 1 : gwin->get_win()->get_scale();
bool dont_move_mode = gwin->main_actor_dont_move();
+ bool avatar_can_act = gwin->main_actor_can_act();
// We want this
Gump_manager *gump_man = gwin->get_gump_man();
@@ -1371,78 +1372,86 @@
if (dont_move_mode)
break;
#ifdef UNDER_CE
- if (gkeyboard->handle_event(&event))
- break;
- Touchscreen->handle_event(&event);
+ if (gkeyboard->handle_event(&event))
+ break;
+ Touchscreen->handle_event(&event);
#endif
int x = event.button.x/scale, y = event.button.y/scale;
if (event.button.button == 1)
{
+ // Allow dragging only either if the avatar can act or if map edit
+ // or hackmove is on.
+ if (avatar_can_act || cheat.in_hack_mover())
+ {
#ifdef USE_EXULTSTUDIO
- if (cheat.in_map_editor())
- { // Paint if shift-click.
- if (cheat.get_edit_shape() >= 0 &&
- // But always if painting.
- (cheat.get_edit_mode() == Cheat::paint ||
- (SDL_GetModState() & KMOD_SHIFT)))
- {
- Paint_with_shape(event, false);
- break;
+ if (cheat.in_map_editor())
+ { // Paint if shift-click.
+ if (cheat.get_edit_shape() >= 0 &&
+ // But always if painting.
+ (cheat.get_edit_mode() == Cheat::paint ||
+ (SDL_GetModState() & KMOD_SHIFT)))
+ {
+ Paint_with_shape(event, false);
+ break;
+ }
+ else if (cheat.get_edit_chunknum() >= 0 &&
+ cheat.get_edit_mode() == Cheat::paint_chunks)
+ {
+ Paint_with_chunk(event, false);
+ break;
+ }
+ else if (cheat.get_edit_mode() ==
+ Cheat::select_chunks)
+ {
+ Select_chunks(event, false,
+ SDL_GetModState()&KMOD_CTRL);
+ break;
+ }
+ else if (cheat.get_edit_mode() ==
+ Cheat::combo_pick)
+ {
+ Select_for_combo(event, false,
+ SDL_GetModState()&KMOD_CTRL);
+ break;
+ }
+ // Don't drag if not in 'move' mode.
+ else if (cheat.get_edit_mode() != Cheat::move)
+ break;
}
- else if (cheat.get_edit_chunknum() >= 0 &&
- cheat.get_edit_mode() == Cheat::paint_chunks)
- {
- Paint_with_chunk(event, false);
- break;
- }
- else if (cheat.get_edit_mode() ==
- Cheat::select_chunks)
- {
- Select_chunks(event, false,
- SDL_GetModState()&KMOD_CTRL);
- break;
- }
- else if (cheat.get_edit_mode() ==
- Cheat::combo_pick)
- {
- Select_for_combo(event, false,
- SDL_GetModState()&KMOD_CTRL);
- break;
- }
- // Don't drag if not in 'move' mode.
- else if (cheat.get_edit_mode() != Cheat::move)
- break;
+#endif
+ dragging = gwin->start_dragging(x, y);
+ //Mouse::mouse->set_shape(Mouse::hand);
+ dragged = false;
}
-#endif
- dragging = gwin->start_dragging(x, y);
- //Mouse::mouse->set_shape(Mouse::hand);
- dragged = false;
left_down_x = x; left_down_y = y;
}
- // Move sprite toward mouse
- // when right button pressed.
+
+ // Middle click, use targetting crosshairs.
if (gwin->get_mouse3rd())
if (event.button.button == 2)
- {
- ActionTarget(0);
- }
- if (event.button.button == 3) {
-
- // Try removing old queue entry.
- gwin->get_tqueue()->remove(gwin->get_main_actor());
+ ActionTarget(0);
+ // Right click. Only walk if avatar can act.
+ if (event.button.button == 3)
+ {
if (!dragging && // Causes crash if dragging.
gump_man->can_right_click_close() &&
gump_man->gump_mode() &&
- gump_man->find_gump(x, y, false)) {
+ gump_man->find_gump(x, y, false))
+ {
gump = 0;
right_on_gump = true;
- }
- else
+ }
+ else if (avatar_can_act)
+ {
+ // Try removing old queue entry.
+ gwin->get_tqueue()->remove(gwin->get_main_actor());
gwin->start_actor(x, y,
Mouse::mouse->avatar_speed);
+ }
+ }
- }
+ // Mousewheel scrolling of view port.
if (event.button.button == 4 || event.button.button == 5)
{
if (!cheat()) break;
@@ -1465,15 +1474,15 @@
if (dont_move_mode)
break;
#ifdef UNDER_CE
- if (gkeyboard->handle_event(&event))
- break;
- Touchscreen->handle_event(&event);
+ if (gkeyboard->handle_event(&event))
+ break;
+ Touchscreen->handle_event(&event);
#endif
int x = event.button.x/scale, y = event.button.y/scale;
if (event.button.button == 3)
{
uint32 curtime = SDL_GetTicks();
- // If showing gumps, ignore all other double-right-click results
+ // If showing gumps, ignore all double-right-click results
if (gump_man->gump_mode())
{
if (right_on_gump &&
@@ -1486,15 +1495,18 @@
right_on_gump = false;
}
}
+ else if (avatar_can_act)
+ {
// Last click within .5 secs?
- else if (gwin->get_allow_double_right_move() && curtime - last_b3_click < 500)
- gwin->start_actor_along_path(x, y,
- Mouse::mouse->avatar_speed);
- else
- {
- gwin->stop_actor();
- if (Combat::is_paused() && gwin->in_combat())
- gwin->paused_combat_select(x, y);
+ if (gwin->get_allow_double_right_move() && curtime - last_b3_click < 500)
+ gwin->start_actor_along_path(x, y,
+ Mouse::mouse->avatar_speed);
+ else
+ {
+ gwin->stop_actor();
+ if (Combat::is_paused() && gwin->in_combat())
+ gwin->paused_combat_select(x, y);
+ }
}
last_b3_click = curtime;
}
@@ -1502,17 +1514,19 @@
{
uint32 curtime = SDL_GetTicks();
bool click_handled = false;
- if (dragging) {
- click_handled = gwin->drop_dragged(x, y,
- dragged);
+ if (dragging)
+ {
+ click_handled = gwin->drop_dragged(x, y, dragged);
Mouse::mouse->set_speed_cursor();
- }
- // Last click within .5 secs?
+ }
+ // Last click within .5 secs?
if (curtime - last_b1_click < 500 &&
left_down_x - 1 <= x && x <= left_down_x + 1 &&
left_down_y - 1 <= y && y <= left_down_y + 1)
- {
+ {
dragging = dragged = false;
+ // This function handles the trouble of deciding what to
+ // do when the avatar cannot act.
gwin->double_clicked(x, y);
Mouse::mouse->set_speed_cursor();
show_items_clicked = false;
@@ -1521,19 +1535,20 @@
if (!dragging || !dragged)
last_b1_click = curtime;
- if (!click_handled &&
+ if (!click_handled && avatar_can_act &&
left_down_x - 1 <= x && x <= left_down_x + 1 &&
left_down_y - 1 <= y && y <= left_down_y + 1)
- {
+ {
show_items_x = x; show_items_y = y;
// Identify item(s) clicked on.
- if (cheat.in_map_editor()) {
+ if (cheat.in_map_editor())
gwin->show_items(x,y,(SDL_GetModState() & KMOD_CTRL) != 0);
- } else {
+ else
+ {
show_items_time = curtime + 500;
show_items_clicked = true;
+ }
}
- }
dragging = dragged = false;
}
break;
@@ -1593,8 +1608,11 @@
}
// Dragging with right?
else if ((event.motion.state & SDL_BUTTON(3)) && !right_on_gump)
- gwin->start_actor(event.motion.x / scale,
- event.motion.y / scale, Mouse::mouse->avatar_speed);
+ {
+ if (avatar_can_act)
+ gwin->start_actor(event.motion.x / scale,
+ event.motion.y / scale, Mouse::mouse->avatar_speed);
+ }
#ifdef USE_EXULTSTUDIO // Painting?
else if (cheat.in_map_editor() &&
cheat.get_edit_shape() >= 0 &&
@@ -1612,7 +1630,7 @@
break;
}
case SDL_ACTIVEEVENT:
- if (event.active.state & SDL_APPMOUSEFOCUS)
+ if (event.active.state & SDL_APPMOUSEFOCUS)
{
if (event.active.gain)
{
Modified: exult/trunk/gamemap.cc
===================================================================
--- exult/trunk/gamemap.cc 2010-07-26 12:22:43 UTC (rev 6319)
+++ exult/trunk/gamemap.cc 2010-07-28 18:05:47 UTC (rev 6320)
@@ -660,7 +660,6 @@
)
{
Ifix_game_object *obj;
- Game_window *gwin = Game_window::get_instance();
ifix->seek(filepos); // Get to actual shape.
// Get buffer to hold entries' indices.
unsigned char *entries = new unsigned char[len];
Modified: exult/trunk/gamewin.cc
===================================================================
--- exult/trunk/gamewin.cc 2010-07-26 12:22:43 UTC (rev 6319)
+++ exult/trunk/gamewin.cc 2010-07-28 18:05:47 UTC (rev 6320)
@@ -84,6 +84,7 @@
#include "Notebook_gump.h"
#include "AudioMixer.h"
#include "combat.h"
+#include "keyactions.h"
#ifdef USE_EXULTSTUDIO
#include "server.h"
@@ -684,6 +685,15 @@
}
/*
+ * Are we in dont_move mode?
+ */
+
+bool Game_window::main_actor_can_act()
+ {
+ return main_actor->can_act();
+ }
+
+/*
* Add time for a light spell.
*/
@@ -2427,13 +2437,20 @@
// Look for obj. in open gump.
Game_object *obj = 0;
bool gump = gump_man->double_clicked(x, y, obj);
+ bool avatar_can_act = main_actor_can_act();
// If gump manager didn't handle it, we search the world for an object
if (!gump)
{
obj = find_object(x, y);
+ if (!avatar_can_act && obj && obj->as_actor()
+ && obj->as_actor() == main_actor->as_actor())
+ {
+ ActionFileGump(0);
+ return;
+ }
// Check path, except if an NPC, sign, or if editing.
- if (obj && !obj->as_actor() &&
+ if (obj && !obj->as_actor() &&
!cheat.in_hack_mover() &&
//!Is_sign(obj->get_shapenum()) &&
!Fast_pathfinder_client::is_grabable(main_actor, obj))
@@ -2442,8 +2459,8 @@
return;
}
}
- if (!obj)
- return; // Nothing found.
+ if (!obj || !avatar_can_act)
+ return; // Nothing found or avatar disabled.
if (combat && !gump && // In combat?
!Combat::is_paused() &&
(!gump_man->gump_mode() || gump_man->gumps_dont_pause_game()))
Modified: exult/trunk/gamewin.h
===================================================================
--- exult/trunk/gamewin.h 2010-07-26 12:22:43 UTC (rev 6319)
+++ exult/trunk/gamewin.h 2010-07-28 18:05:47 UTC (rev 6320)
@@ -269,6 +269,7 @@
{ return skip_above_actor < skip_lift ?
skip_above_actor : skip_lift; }
bool main_actor_dont_move();
+ bool main_actor_can_act();
inline bool set_in_dungeon(unsigned int lift)
{
if (in_dungeon == lift)
Modified: exult/trunk/gumps/Gump.cc
===================================================================
--- exult/trunk/gumps/Gump.cc 2010-07-26 12:22:43 UTC (rev 6319)
+++ exult/trunk/gumps/Gump.cc 2010-07-28 18:05:47 UTC (rev 6320)
@@ -73,8 +73,8 @@
Gump *from
) : ShapeID(from->get_shapenum(), from->get_framenum(),
from->get_shapefile()),
- container(cont), handles_kbd(false), x(initx), y(inity),
- object_area(from->object_area)
+ container(cont), x(initx), y(inity),
+ object_area(from->object_area), handles_kbd(false)
{
// Clone widgets.
for (Gump_elems::iterator it = from->elems.begin();
Modified: exult/trunk/gumps/Gump_ToggleButton.h
===================================================================
--- exult/trunk/gumps/Gump_ToggleButton.h 2010-07-26 12:22:43 UTC (rev 6319)
+++ exult/trunk/gumps/Gump_ToggleButton.h 2010-07-28 18:05:47 UTC (rev 6320)
@@ -55,8 +55,8 @@
public:
Gump_ToggleTextButton(Gump *par, std::string *s, int selectionnum, int numsel,
int px, int py, int width, int height = 0)
- : Text_button(par, "", px, py, width, height), selections(s),
- numselections(numsel)
+ : Text_button(par, "", px, py, width, height),
+ numselections(numsel), selections(s)
{
set_frame(selectionnum);
text = selections[selectionnum];
Modified: exult/trunk/gumps/Gump_manager.cc
===================================================================
--- exult/trunk/gumps/Gump_manager.cc 2010-07-26 12:22:43 UTC (rev 6319)
+++ exult/trunk/gumps/Gump_manager.cc 2010-07-28 18:05:47 UTC (rev 6320)
@@ -49,8 +49,8 @@
using std::endl;
Gump_manager::Gump_manager()
- : open_gumps(0), non_persistent_count(0), modal_gump_count(0),
- right_click_close(true), dont_pause_game(false), kbd_focus(0)
+ : open_gumps(0), non_persistent_count(0), kbd_focus(0 ),
+ modal_gump_count(0), right_click_close(true), dont_pause_game(false)
{
std::string str;
config->value("config/gameplay/right_click_closes_gumps", str, "yes");
@@ -388,23 +388,32 @@
Gump *gump = find_gump(x, y);
if (gump)
- { // Find object in gump.
+ {
+ // If avatar cannot act, a double-click will only close gumps, and
+ // nothing else.
+ if (!gwin->main_actor_can_act() && gwin->get_double_click_closes_gumps())
+ {
+ gump->close();
+ gwin->paint();
+ return true;
+ }
+ // Find object in gump.
obj = gump->find_object(x, y);
if (!obj) // Maybe it's a spell.
- {
+ {
Gump_button *btn = gump->on_button(x, y);
if (btn) btn->double_clicked(x, y);
else if (gwin->get_double_click_closes_gumps())
- {
+ {
gump->close();
gwin->paint();
+ }
}
+ return true;
}
- return true;
- }
return false;
-}
+ }
/*
* Send kbd. event to gump that has focus.
Modified: exult/trunk/gumps/Newfile_gump.cc
===================================================================
--- exult/trunk/gumps/Newfile_gump.cc 2010-07-26 12:22:43 UTC (rev 6319)
+++ exult/trunk/gumps/Newfile_gump.cc 2010-07-28 18:05:47 UTC (rev 6320)
@@ -1291,20 +1291,6 @@
return num - other->num;
}
-static int _U7SaveSeqNr(const char *a)
-{
- int i;
-
-
- for (i = strlen((char*)a) - 1; !isdigit(((char*)a)[i]); i--)
- ;
- for (; isdigit(((char*)a)[i]); i--)
- ;
-
-
- return atoi(&a[i+1]);
-}
-
// Compare Games Static
int Newfile_gump::SaveInfo::CompareGames(const void *a, const void *b)
{
Modified: exult/trunk/gumps/Notebook_gump.cc
===================================================================
--- exult/trunk/gumps/Notebook_gump.cc 2010-07-26 12:22:43 UTC (rev 6319)
+++ exult/trunk/gumps/Notebook_gump.cc 2010-07-28 18:05:47 UTC (rev 6320)
@@ -302,8 +302,8 @@
Notebook_gump::Notebook_gump
(
- ) : Gump(0, EXULT_FLX_NOTEBOOK_SHP, SF_EXULT_FLX), curpage(0),
- curnote(0), updnx(0)
+ ) : Gump(0, EXULT_FLX_NOTEBOOK_SHP, SF_EXULT_FLX), curnote(0),
+ curpage(0), updnx(0)
{
handles_kbd = true;
cursor.offset = 0;
@@ -563,7 +563,6 @@
{
if (!curpage)
return;
- One_note *note = notes[curnote];
Notebook_top &pinfo = page_info[curpage];
--curpage;
curnote = page_info[curpage].notenum;
@@ -583,7 +582,6 @@
{
if (curpage >= page_info.size())
return;
- One_note *note = notes[curnote];
++curpage;
Notebook_top &pinfo = page_info[curpage];
curnote = pinfo.notenum;
Modified: exult/trunk/gumps/Paperdoll_gump.cc
===================================================================
--- exult/trunk/gumps/Paperdoll_gump.cc 2010-07-26 12:22:43 UTC (rev 6319)
+++ exult/trunk/gumps/Paperdoll_gump.cc 2010-07-28 18:05:47 UTC (rev 6320)
@@ -516,7 +516,6 @@
char text[20];
snprintf(text, 20, "%d/%d", weight, max_weight);
int twidth = sman->get_text_width(2, text);
- const int boxw = 102;
sman->paint_text(2, text, x + 84 - (twidth/2), y + 114);
}
Modified: exult/trunk/gumps/Spellbook_gump.cc
===================================================================
--- exult/trunk/gumps/Spellbook_gump.cc 2010-07-26 12:22:43 UTC (rev 6319)
+++ exult/trunk/gumps/Spellbook_gump.cc 2010-07-28 18:05:47 UTC (rev 6320)
@@ -249,7 +249,7 @@
Spellbook_gump::Spellbook_gump
(
Spellbook_object *b
- ) : Spelltype_gump(SPELLBOOK), page(0), book(b), turning_page(0)
+ ) : Spelltype_gump(SPELLBOOK), page(0), turning_page(0), book(b)
{
set_object_area(Rectangle(36, 28, 102, 66), 7, 54);
Modified: exult/trunk/keys.cc
===================================================================
--- exult/trunk/keys.cc 2010-07-26 12:22:43 UTC (rev 6319)
+++ exult/trunk/keys.cc 2010-07-28 18:05:47 UTC (rev 6320)
@@ -77,140 +77,141 @@
} key_type;
Exult_Game game;
bool allow_during_dont_move;
+ bool allow_if_cant_act;
} ExultActions[] = {
- { "QUIT", ActionQuit, 0, "Quit", Action::normal_keys, NONE, true },
- { "SAVE_RESTORE", ActionFileGump, 0, "Save/restore", Action::normal_keys, NONE, true },
- { "QUICKSAVE", ActionQuicksave, 0, "Quick-save", Action::normal_keys, NONE, false },
+ { "QUIT", ActionQuit, 0, "Quit", Action::normal_keys, NONE, true, true },
+ { "SAVE_RESTORE", ActionFileGump, 0, "Save/restore", Action::normal_keys, NONE, true, true },
+ { "QUICKSAVE", ActionQuicksave, 0, "Quick-save", Action::normal_keys, NONE, false, true },
{ "QUICKRESTORE",
- ActionQuickrestore, 0, "Quick-restore", Action::normal_keys, NONE, true },
- { "ABOUT", ActionAbout, 0, "About Exult", Action::normal_keys, NONE, false },
- { "HELP", ActionHelp, 0, "List keys", Action::normal_keys, NONE, false },
- { "CLOSE_GUMPS", ActionCloseGumps, 0, "Close gumps", Action::dont_show, NONE, false},
- { "CLOSE_OR_MENU", ActionCloseOrMenu, 0, "Game menu", Action::normal_keys, NONE, true },
+ ActionQuickrestore, 0, "Quick-restore", Action::normal_keys, NONE, true, true },
+ { "ABOUT", ActionAbout, 0, "About Exult", Action::normal_keys, NONE, false, true },
+ { "HELP", ActionHelp, 0, "List keys", Action::normal_keys, NONE, false, true },
+ { "CLOSE_GUMPS", ActionCloseGumps, 0, "Close gumps", Action::dont_show, NONE, false, true },
+ { "CLOSE_OR_MENU", ActionCloseOrMenu, 0, "Game menu", Action::normal_keys, NONE, true, true },
{ "SCREENSHOT",
- ActionScreenshot, 0, "Take screenshot", Action::normal_keys, NONE, true },
- { "GAME_MENU", ActionMenuGump, 0, "Game Menu", Action::normal_keys, NONE, true },
+ ActionScreenshot, 0, "Take screenshot", Action::normal_keys, NONE, true, true },
+ { "GAME_MENU", ActionMenuGump, 0, "Game Menu", Action::normal_keys, NONE, true, true },
{ "OLD_FILE_GUMP",
- ActionOldFileGump, 0, "Save/restore", Action::normal_keys, NONE, true },
+ ActionOldFileGump, 0, "Save/restore", Action::normal_keys, NONE, true, true },
#ifdef UNDER_CE
- { "MINIMIZE_GAME", ActionMinimizeGame, 0, "Minimize game", Action::normal_keys, NONE, true },
- { "TOUCHSCREEN_MODE", ActionTouchscreenMode, 0, "Touchscreen mode", Action::normal_keys, NONE, true },
- { "KEYBOARD_POSITION", ActionKeyboardPosition, 0, "Keyboard position", Action::normal_keys, NONE, true },
- { "KEYBOARD_MODE", ActionKeyboardMode, 0, "Keyboard mode", Action::normal_keys, NONE, true },
+ { "MINIMIZE_GAME", ActionMinimizeGame, 0, "Minimize game", Action::normal_keys, NONE, true, true },
+ { "TOUCHSCREEN_MODE", ActionTouchscreenMode, 0, "Touchscreen mode", Action::normal_keys, NONE, true, true },
+ { "KEYBOARD_POSITION", ActionKeyboardPosition, 0, "Keyboard position", Action::normal_keys, NONE, true, true },
+ { "KEYBOARD_MODE", ActionKeyboardMode, 0, "Keyboard mode", Action::normal_keys, NONE, true, true },
#endif
{ "RESOLUTION_INCREASE",
- ActionResIncrease, 0, "Increase resolution", Action::cheat_keys, NONE, true },
+ ActionResIncrease, 0, "Increase resolution", Action::cheat_keys, NONE, true, true },
{ "RESOLUTION_DECREASE",
- ActionResDecrease, 0, "Decrease resolution", Action::cheat_keys, NONE, true },
+ ActionResDecrease, 0, "Decrease resolution", Action::cheat_keys, NONE, true, true },
{ "BRIGHTER",
- ActionBrighter, 0, "Increase brightness", Action::normal_keys, NONE, true },
- { "DARKER", ActionDarker, 0, "Decrease brightness", Action::normal_keys, NONE, true },
+ ActionBrighter, 0, "Increase brightness", Action::normal_keys, NONE, true, true },
+ { "DARKER", ActionDarker, 0, "Decrease brightness", Action::normal_keys, NONE, true, true },
{ "TOGGLE_FULLSCREEN",
- ActionFullscreen, 0, "Toggle fullscreen", Action::normal_keys, NONE, true },
+ ActionFullscreen, 0, "Toggle fullscreen", Action::normal_keys, NONE, true, true },
- { "USEITEM", ActionUseItem, 0, "Use item", Action::dont_show, NONE, false },
- { "USEFOOD", ActionUseFood, 0, "Use food", Action::dont_show, NONE, false },
- { "CALL_USECODE", ActionCallUsecode, 0, "Call Usecode", Action::dont_show, NONE, false },
- { "TOGGLE_COMBAT", ActionCombat, 0, "Toggle combat", Action::normal_keys, NONE, false },
- { "PAUSE_COMBAT", ActionCombatPause, 0, "Pause combat", Action::normal_keys, NONE, false },
- { "TARGET_MODE", ActionTarget, 0, "Target mode", Action::normal_keys, NONE, false },
- { "INVENTORY", ActionInventory, 0, "Show inventory", Action::normal_keys, NONE, false },
- { "TRY_KEYS", ActionTryKeys, 0, "Try keys", Action::normal_keys, NONE, false },
- { "STATS", ActionStats, 0, "Show stats", Action::normal_keys, NONE, false },
+ { "USEITEM", ActionUseItem, 0, "Use item", Action::dont_show, NONE, false, false },
+ { "USEFOOD", ActionUseFood, 0, "Use food", Action::dont_show, NONE, false, false },
+ { "CALL_USECODE", ActionCallUsecode, 0, "Call Usecode", Action::dont_show, NONE, false, false },
+ { "TOGGLE_COMBAT", ActionCombat, 0, "Toggle combat", Action::normal_keys, NONE, false, false },
+ { "PAUSE_COMBAT", ActionCombatPause, 0, "Pause combat", Action::normal_keys, NONE, false, false },
+ { "TARGET_MODE", ActionTarget, 0, "Target mode", Action::normal_keys, NONE, false, false },
+ { "INVENTORY", ActionInventory, 0, "Show inventory", Action::normal_keys, NONE, false, false },
+ { "TRY_KEYS", ActionTryKeys, 0, "Try keys", Action::normal_keys, NONE, false, false },
+ { "STATS", ActionStats, 0, "Show stats", Action::normal_keys, NONE, false, true },
{ "COMBAT_STATS",
- ActionCombatStats, 0, "Show combat stats", Action::normal_keys, SERPENT_ISLE, false },
+ ActionCombatStats, 0, "Show combat stats", Action::normal_keys, SERPENT_ISLE, false, false },
{ "FACE_STATS",
- ActionFaceStats, 0, "Change Face Stats State", Action::normal_keys, NONE, false },
+ ActionFaceStats, 0, "Change Face Stats State", Action::normal_keys, NONE, false, true },
{ "SHOW_SI_INTRO",
- ActionSIIntro, 0, "Show Alternate SI intro", Action::cheat_keys, SERPENT_ISLE, false },
- { "SHOW_ENDGAME", ActionEndgame, 0, "Show endgame", Action::cheat_keys, NONE, false },
- { "SCROLL_LEFT", ActionScrollLeft, 0, "Scroll left", Action::cheat_keys, NONE, false },
- { "SCROLL_RIGHT", ActionScrollRight, 0, "Scroll right", Action::cheat_keys, NONE, false },
- { "SCROLL_UP", ActionScrollUp, 0, "Scroll up", Action::cheat_keys, NONE, false },
- { "SCROLL_DOWN", ActionScrollDown, 0, "Scroll down", Action::cheat_keys, NONE, false },
- { "WALK_WEST", ActionWalkWest, ActionStopWalking, "Walk west", Action::normal_keys, NONE, false },
- { "WALK_EAST", ActionWalkEast, ActionStopWalking, "Walk east", Action::normal_keys, NONE, false },
- { "WALK_NORTH", ActionWalkNorth, ActionStopWalking, "Walk north", Action::normal_keys, NONE, false },
- { "WALK_SOUTH", ActionWalkSouth, ActionStopWalking, "Walk south", Action::normal_keys, NONE, false },
- { "WALK_NORTH_EAST", ActionWalkNorthEast, ActionStopWalking, "Walk north-east", Action::normal_keys, NONE, false },
- { "WALK_SOUTH_EAST", ActionWalkSouthEast, ActionStopWalking, "Walk south-east", Action::normal_keys, NONE, false },
- { "WALK_NORTH_WEST", ActionWalkNorthWest, ActionStopWalking, "Walk north-west", Action::normal_keys, NONE, false },
- { "WALK_SOUTH_WEST", ActionWalkSouthWest, ActionStopWalking, "Walk south-west", Action::normal_keys, NONE, false },
- { "CENTER_SCREEN", ActionCenter, 0, "Center screen", Action::cheat_keys, NONE, false },
+ ActionSIIntro, 0, "Show Alternate SI intro", Action::cheat_keys, SERPENT_ISLE, false, true },
+ { "SHOW_ENDGAME", ActionEndgame, 0, "Show endgame", Action::cheat_keys, NONE, false, true },
+ { "SCROLL_LEFT", ActionScrollLeft, 0, "Scroll left", Action::cheat_keys, NONE, false, true },
+ { "SCROLL_RIGHT", ActionScrollRight, 0, "Scroll right", Action::cheat_keys, NONE, false, true },
+ { "SCROLL_UP", ActionScrollUp, 0, "Scroll up", Action::cheat_keys, NONE, false, true },
+ { "SCROLL_DOWN", ActionScrollDown, 0, "Scroll down", Action::cheat_keys, NONE, false, true },
+ { "WALK_WEST", ActionWalkWest, ActionStopWalking, "Walk west", Action::normal_keys, NONE, false, false },
+ { "WALK_EAST", ActionWalkEast, ActionStopWalking, "Walk east", Action::normal_keys, NONE, false, false },
+ { "WALK_NORTH", ActionWalkNorth, ActionStopWalking, "Walk north", Action::normal_keys, NONE, false, false },
+ { "WALK_SOUTH", ActionWalkSouth, ActionStopWalking, "Walk south", Action::normal_keys, NONE, false, false },
+ { "WALK_NORTH_EAST", ActionWalkNorthEast, ActionStopWalking, "Walk north-east", Action::normal_keys, NONE, false, false },
+ { "WALK_SOUTH_EAST", ActionWalkSouthEast, ActionStopWalking, "Walk south-east", Action::normal_keys, NONE, false, false },
+ { "WALK_NORTH_WEST", ActionWalkNorthWest, ActionStopWalking, "Walk north-west", Action::normal_keys, NONE, false, false },
+ { "WALK_SOUTH_WEST", ActionWalkSouthWest, ActionStopWalking, "Walk south-west", Action::normal_keys, NONE, false, false },
+ { "CENTER_SCREEN", ActionCenter, 0, "Center screen", Action::cheat_keys, NONE, false, true },
{ "SHAPE_BROWSER",
- ActionShapeBrowser, 0, "Shape browser", Action::cheat_keys, NONE, false },
+ ActionShapeBrowser, 0, "Shape browser", Action::cheat_keys, NONE, false, true },
{ "CREATE_ITEM",
- ActionCreateShape, 0, "Create last shape", Action::cheat_keys, NONE, false },
+ ActionCreateShape, 0, "Create last shape", Action::cheat_keys, NONE, false, true },
{ "DELETE_OBJECT",
- ActionDeleteObject, 0, "Delete object", Action::cheat_keys, NONE, false },
+ ActionDeleteObject, 0, "Delete object", Action::cheat_keys, NONE, false, true },
{ "TOGGLE_EGGS",
- ActionToggleEggs, 0, "Toggle egg display", Action::cheat_keys, NONE, false },
+ ActionToggleEggs, 0, "Toggle egg display", Action::cheat_keys, NONE, false, true },
{ "TOGGLE_GOD_MODE",
- ActionGodMode, 0, "Toggle god mode", Action::cheat_keys, NONE, false },
+ ActionGodMode, 0, "Toggle god mode", Action::cheat_keys, NONE, false, true },
{ "CHANGE_GENDER",
- ActionGender, 0, "Change gender", Action::cheat_keys, NONE, false },
+ ActionGender, 0, "Change gender", Action::cheat_keys, NONE, false, true },
{ "CHEAT_HELP",
- ActionCheatHelp, 0, "List cheat keys", Action::cheat_keys, NONE, false },
+ ActionCheatHelp, 0, "List cheat keys", Action::cheat_keys, NONE, false, true },
{ "TOGGLE_INFRAVISION",
- ActionInfravision, 0, "Toggle infravision", Action::cheat_keys, NONE, false },
+ ActionInfravision, 0, "Toggle infravision", Action::cheat_keys, NONE, false, true },
{ "TOGGLE_HACK_MOVER",
- ActionHackMover, 0, "Toggle hack-mover mode", Action::cheat_keys, NONE, false },
+ ActionHackMover, 0, "Toggle hack-mover mode", Action::cheat_keys, NONE, false, true },
{ "MAP_TELEPORT",
- ActionMapTeleport, 0, "Map teleport", Action::cheat_keys, NONE, false },
+ ActionMapTeleport, 0, "Map teleport", Action::cheat_keys, NONE, false, true },
{ "CURSOR_TELEPORT",
- ActionTeleport, 0, "Teleport to cursor", Action::cheat_keys, NONE, false },
+ ActionTeleport, 0, "Teleport to cursor", Action::cheat_keys, NONE, false, true },
{ "NEXT_MAP_TELEPORT",
- ActionNextMapTeleport, 0, "Teleport to next map", Action::cheat_keys, NONE, false },
+ ActionNextMapTeleport, 0, "Teleport to next map", Action::cheat_keys, NONE, false, true },
{ "NEXT_TIME_PERIOD",
- ActionTime, 0, "Next time period", Action::cheat_keys, NONE, false },
+ ActionTime, 0, "Next time period", Action::cheat_keys, NONE, false, true },
{ "TOGGLE_WIZARD_MODE",
- ActionWizard, 0, "Toggle archwizard mode", Action::cheat_keys, NONE, false },
- { "PARTY_HEAL", ActionHeal, 0, "Heal party", Action::cheat_keys, NONE, false },
+ ActionWizard, 0, "Toggle archwizard mode", Action::cheat_keys, NONE, false, true },
+ { "PARTY_HEAL", ActionHeal, 0, "Heal party", Action::cheat_keys, NONE, false, true },
{ "PARTY_INCREASE_LEVEL",
- ActionLevelup, 0, "Level-up party", Action::cheat_keys, NONE, false },
+ ActionLevelup, 0, "Level-up party", Action::cheat_keys, NONE, false, true },
{ "CHEAT_SCREEN",
- ActionCheatScreen, 0, "Cheat Screen", Action::cheat_keys, NONE, true },
+ ActionCheatScreen, 0, "Cheat Screen", Action::cheat_keys, NONE, true, true },
{ "PICK_POCKET",
- ActionPickPocket, 0, "Toggle Pick Pocket", Action::cheat_keys, NONE, false },
+ ActionPickPocket, 0, "Toggle Pick Pocket", Action::cheat_keys, NONE, false, true },
{ "NPC_NUMBERS",
- ActionNPCNumbers, 0, "Toggle NPC Numbers", Action::cheat_keys, NONE, false },
+ ActionNPCNumbers, 0, "Toggle NPC Numbers", Action::cheat_keys, NONE, false, true },
{ "GRAB_ACTOR",
- ActionGrabActor, 0, "Grab NPC for Cheat Screen", Action::cheat_keys, NONE, false },
- { "PLAY_MUSIC", ActionPlayMusic, 0, "Play song", Action::cheat_keys, NONE, false },
+ ActionGrabActor, 0, "Grab NPC for Cheat Screen", Action::cheat_keys, NONE, false, true },
+ { "PLAY_MUSIC", ActionPlayMusic, 0, "Play song", Action::cheat_keys, NONE, false, true },
{ "TOGGLE_NAKED",
- ActionNaked, 0, "Toggle naked mode", Action::cheat_keys, SERPENT_ISLE, false },
+ ActionNaked, 0, "Toggle naked mode", Action::cheat_keys, SERPENT_ISLE, false, true },
{ "TOGGLE_PETRA",
- ActionPetra, 0, "Toggle Petra mode", Action::cheat_keys, SERPENT_ISLE, false },
+ ActionPetra, 0, "Toggle Petra mode", Action::cheat_keys, SERPENT_ISLE, false, true },
{ "CHANGE_SKIN",
- ActionSkinColour, 0, "Change skin colour", Action::cheat_keys, NONE, false },
+ ActionSkinColour, 0, "Change skin colour", Action::cheat_keys, NONE, false, true },
{ "NOTEBOOK", ActionNotebook, 0, "Show notebook", Action::normal_keys,
- NONE, false },
+ NONE, false, false },
{ "SOUND_TESTER",
- ActionSoundTester, 0, "Sound tester", Action::cheat_keys, NONE, false },
- { "TEST", ActionTest, 0, "Test", Action::dont_show, NONE, false },
+ ActionSoundTester, 0, "Sound tester", Action::cheat_keys, NONE, false, true },
+ { "TEST", ActionTest, 0, "Test", Action::dont_show, NONE, false, true },
{ "MAPEDIT_HELP",
- ActionMapeditHelp, 0, "List mapedit keys", Action::mapedit_keys, NONE, false },
+ ActionMapeditHelp, 0, "List mapedit keys", Action::mapedit_keys, NONE, false, true },
{ "TOGGLE_MAP_EDITOR",
- ActionMapEditor, 0, "Toggle map-editor mode", Action::mapedit_keys, NONE, true },
+ ActionMapEditor, 0, "Toggle map-editor mode", Action::mapedit_keys, NONE, true, true },
{ "SKIPLIFT_DECREMENT",
- ActionSkipLift, 0, "Decrement skiplift", Action::mapedit_keys, NONE, false },
+ ActionSkipLift, 0, "Decrement skiplift", Action::mapedit_keys, NONE, false, true },
{ "CUT",
- ActionCut, 0, "Cut Selected Objects", Action::mapedit_keys, NONE, true},
+ ActionCut, 0, "Cut Selected Objects", Action::mapedit_keys, NONE, true, true },
{ "COPY",
- ActionCopy, 0, "Copy Selected Objects", Action::mapedit_keys, NONE, true},
+ ActionCopy, 0, "Copy Selected Objects", Action::mapedit_keys, NONE, true, true },
{ "PASTE",
- ActionPaste, 0, "Paste Selected Objects", Action::mapedit_keys, NONE, true},
+ ActionPaste, 0, "Paste Selected Objects", Action::mapedit_keys, NONE, true, true },
{ "DELETE_SELECTED",
- ActionDeleteSelected, 0, "Delete selected", Action::mapedit_keys, NONE, true },
+ ActionDeleteSelected, 0, "Delete selected", Action::mapedit_keys, NONE, true, true },
{ "MOVE_SELECTED",
- ActionMoveSelected, 0, "Move selected", Action::mapedit_keys, NONE, true },
+ ActionMoveSelected, 0, "Move selected", Action::mapedit_keys, NONE, true, true },
{ "WRITE_MINIMAP",
- ActionWriteMiniMap, 0, "Write minimap", Action::mapedit_keys, NONE, false },
- { "REPAINT", ActionRepaint, 0, "Repaint screen", Action::dont_show, NONE, true },
- { "", 0, 0, "", Action::dont_show, NONE, false } //terminator
+ ActionWriteMiniMap, 0, "Write minimap", Action::mapedit_keys, NONE, false, true },
+ { "REPAINT", ActionRepaint, 0, "Repaint screen", Action::dont_show, NONE, true, true },
+ { "", 0, 0, "", Action::dont_show, NONE, false, false } //terminator
};
const struct {
@@ -313,16 +314,21 @@
return true;
// Restrict key actions in dont_move mode
- if (a.action->allow_during_dont_move
- || !Game_window::get_instance()->main_actor_dont_move())
+ if (!a.action->allow_during_dont_move
+ && Game_window::get_instance()->main_actor_dont_move())
+ return true;
+
+ // Restrict keys if avatar is sleeping/paralyzed/unconscious/dead
+ if (!a.action->allow_if_cant_act
+ && !Game_window::get_instance()->main_actor_can_act())
+ return true;
+
+ if (press)
+ a.action->func(a.params);
+ else
{
- if (press)
- a.action->func(a.params);
- else
- {
- if(a.action->func_release != NULL)
- a.action->func_release(a.params);
- }
+ if(a.action->func_release != NULL)
+ a.action->func_release(a.params);
}
return true;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|