22 #ifndef NUVIE_CORE_EVENT_H 23 #define NUVIE_CORE_EVENT_H 25 #include "ultima/shared/engine/events.h" 26 #include "ultima/shared/std/containers.h" 27 #include "ultima/shared/std/string.h" 28 #include "ultima/nuvie/misc/call_back.h" 29 #include "ultima/nuvie/keybinding/keys_enum.h" 30 #include "ultima/nuvie/core/obj_manager.h" 55 #define NUVIE_INTERVAL 50 56 #define PUSH_FROM_PLAYER false 57 #define PUSH_FROM_OBJECT true 80 extern uint32 nuvieGameCounter;
83 #define EVENTINPUT_MAPCOORD 0 84 #define EVENTINPUT_KEY 1 85 #define EVENTINPUT_STRING 2 86 #define EVENTINPUT_OBJECT 3 87 #define EVENTINPUT_MAPCOORD_DIR 4 88 #define EVENTINPUT_SPELL_NUM 5 93 const Common::KeyCode FIRST_JOY = (Common::KeyCode)400;
94 const Common::KeyCode JOY_UP = FIRST_JOY;
95 const Common::KeyCode JOY_DOWN = (Common::KeyCode)(FIRST_JOY + 1);
96 const Common::KeyCode JOY_LEFT = (Common::KeyCode)(FIRST_JOY + 2);
97 const Common::KeyCode JOY_RIGHT = (Common::KeyCode)(FIRST_JOY + 3);
98 const Common::KeyCode JOY_RIGHTUP = (Common::KeyCode)(FIRST_JOY + 4);
99 const Common::KeyCode JOY_RIGHTDOWN = (Common::KeyCode)(FIRST_JOY + 5);
100 const Common::KeyCode JOY_LEFTUP = (Common::KeyCode)(FIRST_JOY + 6);
101 const Common::KeyCode JOY_LEFTDOWN = (Common::KeyCode)(FIRST_JOY + 7);
102 const Common::KeyCode JOY_UP2 = (Common::KeyCode)(FIRST_JOY + 8);
103 const Common::KeyCode JOY_DOWN2 = (Common::KeyCode)(FIRST_JOY + 9);
104 const Common::KeyCode JOY_LEFT2 = (Common::KeyCode)(FIRST_JOY + 10);
105 const Common::KeyCode JOY_RIGHT2 = (Common::KeyCode)(FIRST_JOY + 11);
106 const Common::KeyCode JOY_RIGHTUP2 = (Common::KeyCode)(FIRST_JOY + 12);
107 const Common::KeyCode JOY_RIGHTDOWN2 = (Common::KeyCode)(FIRST_JOY + 13);
108 const Common::KeyCode JOY_LEFTUP2 = (Common::KeyCode)(FIRST_JOY + 14);
109 const Common::KeyCode JOY_LEFTDOWN2 = (Common::KeyCode)(FIRST_JOY + 15);
110 const Common::KeyCode JOY_UP3 = (Common::KeyCode)(FIRST_JOY + 16);
111 const Common::KeyCode JOY_DOWN3 = (Common::KeyCode)(FIRST_JOY + 17);
112 const Common::KeyCode JOY_LEFT3 = (Common::KeyCode)(FIRST_JOY + 18);
113 const Common::KeyCode JOY_RIGHT3 = (Common::KeyCode)(FIRST_JOY + 19);
114 const Common::KeyCode JOY_RIGHTUP3 = (Common::KeyCode)(FIRST_JOY + 20);
115 const Common::KeyCode JOY_RIGHTDOWN3 = (Common::KeyCode)(FIRST_JOY + 21);
116 const Common::KeyCode JOY_LEFTUP3 = (Common::KeyCode)(FIRST_JOY + 22);
117 const Common::KeyCode JOY_LEFTDOWN3 = (Common::KeyCode)(FIRST_JOY + 23);
118 const Common::KeyCode JOY_UP4 = (Common::KeyCode)(FIRST_JOY + 24);
119 const Common::KeyCode JOY_DOWN4 = (Common::KeyCode)(FIRST_JOY + 25);
120 const Common::KeyCode JOY_LEFT4 = (Common::KeyCode)(FIRST_JOY + 26);
121 const Common::KeyCode JOY_RIGHT4 = (Common::KeyCode)(FIRST_JOY + 27);
122 const Common::KeyCode JOY_RIGHTUP4 = (Common::KeyCode)(FIRST_JOY + 28);
123 const Common::KeyCode JOY_RIGHTDOWN4 = (Common::KeyCode)(FIRST_JOY + 29);
124 const Common::KeyCode JOY_LEFTUP4 = (Common::KeyCode)(FIRST_JOY + 30);
125 const Common::KeyCode JOY_LEFTDOWN4 = (Common::KeyCode)(FIRST_JOY + 31);
126 const Common::KeyCode JOY_HAT_UP = (Common::KeyCode)(FIRST_JOY + 32);
127 const Common::KeyCode JOY_HAT_DOWN = (Common::KeyCode)(FIRST_JOY + 33);
128 const Common::KeyCode JOY_HAT_LEFT = (Common::KeyCode)(FIRST_JOY + 34);
129 const Common::KeyCode JOY_HAT_RIGHT = (Common::KeyCode)(FIRST_JOY + 35);
130 const Common::KeyCode JOY_HAT_RIGHTUP = (Common::KeyCode)(FIRST_JOY + 36);
131 const Common::KeyCode JOY_HAT_RIGHTDOWN = (Common::KeyCode)(FIRST_JOY + 37);
132 const Common::KeyCode JOY_HAT_LEFTUP = (Common::KeyCode)(FIRST_JOY + 38);
133 const Common::KeyCode JOY_HAT_LEFTDOWN = (Common::KeyCode)(FIRST_JOY + 39);
134 const Common::KeyCode JOY0 = (Common::KeyCode)(FIRST_JOY + 40);
135 const Common::KeyCode JOY1 = (Common::KeyCode)(FIRST_JOY + 41);
136 const Common::KeyCode JOY2 = (Common::KeyCode)(FIRST_JOY + 42);
137 const Common::KeyCode JOY3 = (Common::KeyCode)(FIRST_JOY + 43);
138 const Common::KeyCode JOY4 = (Common::KeyCode)(FIRST_JOY + 44);
139 const Common::KeyCode JOY5 = (Common::KeyCode)(FIRST_JOY + 45);
140 const Common::KeyCode JOY6 = (Common::KeyCode)(FIRST_JOY + 46);
141 const Common::KeyCode JOY7 = (Common::KeyCode)(FIRST_JOY + 47);
142 const Common::KeyCode JOY8 = (Common::KeyCode)(FIRST_JOY + 48);
143 const Common::KeyCode JOY9 = (Common::KeyCode)(FIRST_JOY + 49);
144 const Common::KeyCode JOY10 = (Common::KeyCode)(FIRST_JOY + 50);
145 const Common::KeyCode JOY11 = (Common::KeyCode)(FIRST_JOY + 51);
146 const Common::KeyCode JOY12 = (Common::KeyCode)(FIRST_JOY + 52);
147 const Common::KeyCode JOY13 = (Common::KeyCode)(FIRST_JOY + 53);
148 const Common::KeyCode JOY14 = (Common::KeyCode)(FIRST_JOY + 54);
149 const Common::KeyCode JOY15 = (Common::KeyCode)(FIRST_JOY + 55);
150 const Common::KeyCode JOY16 = (Common::KeyCode)(FIRST_JOY + 56);
151 const Common::KeyCode JOY17 = (Common::KeyCode)(FIRST_JOY + 57);
152 const Common::KeyCode JOY18 = (Common::KeyCode)(FIRST_JOY + 58);
153 const Common::KeyCode JOY19 = (Common::KeyCode)(FIRST_JOY + 59);
161 ActionKeyType action_key_type;
166 EventInput_s() : loc(0), str(0), obj(0), actor(0), get_direction(
false), get_text(
false),
167 target_init(0), select_from_inventory(
false), select_range(0), key(Common::KEYCODE_INVALID),
168 action_key_type(ActionKeyType::CANCEL_ACTION_KEY), spell_num(0), type(0) {
177 bool select_from_inventory;
203 EventMode mode, last_mode;
208 uint16 active_alt_code;
209 uint8 alt_code_input_num;
214 sint32 drop_x, drop_y;
222 bool showingQuitDialog;
223 bool ignore_timeleft;
224 bool move_in_inventory;
225 bool in_control_cheat;
226 bool looking_at_spellbook;
227 bool direction_selects_target;
228 bool _keymapperStateBeforeKEYINPUT;
230 uint32 fps_timestamp;
237 inline uint32 TimeLeft();
239 uint16 callback(uint16 msg,
CallBack *caller,
void *data =
nullptr)
override;
241 const char *print_mode(EventMode mode);
242 void try_next_attack();
253 return gamemenu_dialog;
259 return game_time_queue;
261 EventMode get_mode()
const {
264 EventMode get_last_mode()
const {
267 void set_mode(EventMode new_mode);
269 bool is_direction_selecting_targets()
const {
270 return direction_selects_target;
272 void set_direction_selects_target(
bool val) {
273 direction_selects_target = val;
275 bool using_pickpocket_cheat;
277 void update_timers();
280 void request_input(
CallBack *caller,
void *user_data =
nullptr);
282 void close_spellbook();
287 void get_scroll_input(
const char *allowed =
nullptr,
bool can_escape =
true,
bool using_target_cursor =
false,
bool set_numbers_only_to_true =
true);
288 void get_inventory_obj(
Actor *actor,
bool getting_target =
true);
289 void get_spell_num(
Actor *caster,
Obj *spell_container);
291 void get_direction(
const char *prompt);
292 void get_direction(
const MapCoord &from,
const char *prompt);
293 void get_target(
const char *prompt);
294 void get_target(
const MapCoord &init,
const char *prompt);
296 void display_portrait(
Actor *actor,
const char *name =
nullptr);
298 bool newAction(EventMode new_mode);
303 void endAction(
bool prompt =
false);
305 bool select_obj(
Obj *obj,
Actor *actor =
nullptr);
306 bool select_view_obj(
Obj *obj,
Actor *actor);
307 bool select_actor(
Actor *actor);
308 bool select_direction(sint16 rel_x, sint16 rel_y);
309 bool select_target(uint16 x, uint16 y, uint8 z = 0);
310 bool select_party_member(uint8 num);
311 bool select_spell_num(sint16 spell_num);
317 void key_redirect(
CallBack *caller,
void *user_data);
318 void cancel_key_redirect();
321 bool move(sint16 rel_x, sint16 rel_y);
324 bool use(sint16 rel_x, sint16 rel_y);
327 bool use(
Actor *actor, uint16 x, uint16 y);
331 bool get(sint16 rel_x, sint16 rel_y);
332 bool perform_get(
Obj *obj,
Obj *container_obj =
nullptr,
Actor *actor =
nullptr);
335 bool lookAtCursor(
bool delayed =
false, uint16 x = 0, uint16 y = 0, uint8 z = 0,
Obj *obj =
nullptr,
Actor *actor =
nullptr);
337 bool look(
Actor *actor);
338 bool search(
Obj *obj);
342 bool talk(
Actor *actor);
344 bool perform_talk(
Actor *actor);
349 bool pushFrom(
Obj *obj);
350 bool pushFrom(sint16 rel_x, sint16 rel_y);
351 bool pushFrom(
const MapCoord &target);
352 bool pushTo(
Obj *obj,
Actor *actor);
353 bool pushTo(sint16 rel_x, sint16 rel_y,
bool push_from = PUSH_FROM_PLAYER);
355 void solo_mode(uint32 actor_num);
357 bool toggle_combat();
359 bool ready(
Obj *obj,
Actor *actor =
nullptr);
360 bool unready(
Obj *obj);
363 bool drop_select(
Obj *obj, uint16 qty = 0);
364 bool drop_count(uint16 qty);
366 void set_drop_from_key(
bool closing_gumps) {
367 drop_from_key = closing_gumps;
369 bool drop(
Obj *obj, uint16 qty, uint16 x, uint16 y);
370 bool drop(uint16 x, uint16 y) {
371 return (drop(drop_obj, drop_qty, x, y));
373 void set_drop_target(uint16 x, uint16 y) {
377 bool can_move_obj_between_actors(
Obj *obj,
Actor *src_actor,
Actor *target_actor,
bool display_name =
false);
378 void display_not_aboard_vehicle(
bool show_prompt =
true);
379 void display_move_text(
Actor *target_actor,
Obj *obj);
380 bool can_get_to_actor(
const Actor *actor, uint16 x, uint16 y);
381 bool using_control_cheat()
const {
382 return in_control_cheat;
384 void set_control_cheat(
bool control_cheat) {
385 in_control_cheat = control_cheat;
387 bool is_looking_at_spellbook()
const {
388 return looking_at_spellbook;
390 void set_looking_at_spellbook(
bool looking) {
391 looking_at_spellbook = looking;
395 bool rest_input(uint16 input);
397 void cast_spell_directly(uint8 spell_num);
398 bool can_target_icon();
401 void walk_to_mouse_cursor(uint32 mx, uint32 my);
402 void multiuse(uint16 wx, uint16 wy);
404 void alt_code(
int c);
405 void alt_code_input(
const char *in);
406 void clear_alt_code() { altCodeVal = 0; }
408 void toggleAltCodeMode(
bool enable);
409 void appendAltCode(
int code);
411 bool alt_code_teleport(
const char *location_string);
412 void alt_code_infostring();
413 void alt_code_teleport_menu(uint32 selection);
414 bool alt_code_teleport_to_person(uint32 npc);
417 void set_ignore_timeleft(
bool newsetting) {
418 ignore_timeleft = newsetting;
420 EventInput *get_input() {
426 void moveCursorToMapWindow(
bool ToggleCursor =
false);
427 void moveCursorToInventory();
429 void toggleFpsDisplay();
431 bool do_not_show_target_cursor;
432 bool dont_show_target_cursor()
const;
433 bool input_really_needs_directon()
const;
435 void gameMenuDialog();
437 bool actor_exists(
const Actor *a)
const;
445 static Events *
get() {
return g_events; }
448 extern bool shouldQuit();
Definition: map_window.h:73
Definition: configuration.h:61
Definition: usecode.h:151
Definition: game_clock.h:49
Definition: gui_dialog.h:36
Definition: detection.h:27
Definition: timed_event.h:45
Definition: call_back.h:50
Out move(In first, In last, Out dst)
Definition: algorithm.h:109
Definition: obj_manager.h:75
Definition: fps_counter.h:33
Definition: view_manager.h:57
Definition: converse.h:81