27#include "map_overlay.h"
41typedef struct Keybind_ {
52 {
"accel", N_(
"Accelerate"), N_(
"Makes your ship accelerate forward.") },
53 {
"left", N_(
"Turn Left"), N_(
"Makes your ship turn left.") },
54 {
"right", N_(
"Turn Right"), N_(
"Makes your ship turn right.") },
55 {
"reverse", N_(
"Reverse"), N_(
"Makes your ship face the direction you're moving from. Useful for braking.") },
56 {
"stealth", N_(
"Stealth"), N_(
"Tries to enter stealth mode.") },
58 {
"target_next", N_(
"Target Next"), N_(
"Cycles through ship targets.") },
59 {
"target_prev", N_(
"Target Previous"), N_(
"Cycles backwards through ship targets.") },
60 {
"target_nearest", N_(
"Target Nearest"), N_(
"Targets the nearest non-disabled ship.") },
61 {
"target_nextHostile", N_(
"Target Next Hostile"), N_(
"Cycles through hostile ship targets.") },
62 {
"target_prevHostile", N_(
"Target Previous Hostile"), N_(
"Cycles backwards through hostile ship targets.") },
63 {
"target_hostile", N_(
"Target Nearest Hostile"), N_(
"Targets the nearest hostile ship.") },
64 {
"target_clear", N_(
"Clear Target"), N_(
"Clears the currently-targeted ship, space object, or jump point.") },
66 {
"primary", N_(
"Fire Primary Weapon"), N_(
"Fires primary weapons.") },
67 {
"face", N_(
"Face Target"), N_(
"Faces the targeted ship if one is targeted, otherwise faces targeted space object, or jump point.") },
69 {
"secondary", N_(
"Fire Secondary Weapon"), N_(
"Fires secondary weapons.") },
70 {
"weapset1", N_(
"Weapon Set 1"), N_(
"Activates weapon set 1.") },
71 {
"weapset2", N_(
"Weapon Set 2"), N_(
"Activates weapon set 2.") },
72 {
"weapset3", N_(
"Weapon Set 3"), N_(
"Activates weapon set 3.") },
73 {
"weapset4", N_(
"Weapon Set 4"), N_(
"Activates weapon set 4.") },
74 {
"weapset5", N_(
"Weapon Set 5"), N_(
"Activates weapon set 5.") },
75 {
"weapset6", N_(
"Weapon Set 6"), N_(
"Activates weapon set 6.") },
76 {
"weapset7", N_(
"Weapon Set 7"), N_(
"Activates weapon set 7.") },
77 {
"weapset8", N_(
"Weapon Set 8"), N_(
"Activates weapon set 8.") },
78 {
"weapset9", N_(
"Weapon Set 9"), N_(
"Activates weapon set 9.") },
79 {
"weapset0", N_(
"Weapon Set 0"), N_(
"Activates weapon set 0.") },
81 {
"e_targetNext", N_(
"Target Next Escort"), N_(
"Cycles through your escorts.") },
82 {
"e_targetPrev", N_(
"Target Previous Escort"), N_(
"Cycles backwards through your escorts.") },
83 {
"e_attack", N_(
"Escort Attack Command"), N_(
"Orders escorts to attack your target.") },
84 {
"e_hold", N_(
"Escort Hold Command"), N_(
"Orders escorts to hold their formation.") },
85 {
"e_return", N_(
"Escort Return Command"), N_(
"Orders escorts to return to your ship hangars.") },
86 {
"e_clear", N_(
"Escort Clear Commands"), N_(
"Clears your escorts of commands.") },
88 {
"autonav", N_(
"Autonavigation On"), N_(
"Initializes the autonavigation system.") },
89 {
"target_spob", N_(
"Target Space object"), N_(
"Cycles through space object targets.") },
90 {
"approach", N_(
"Approach"), N_(
"Attempts to approach the targeted ship or space object, or targets the nearest landable space object. Requests landing permission if necessary. Prioritizes ships over space objects.") },
91 {
"thyperspace", N_(
"Target Jump Point"), N_(
"Cycles through jump points.") },
92 {
"starmap", N_(
"Star Map"), N_(
"Opens the star map.") },
93 {
"jump", N_(
"Initiate Jump"), N_(
"Attempts to jump via a jump point.") },
94 {
"overlay", N_(
"Overlay Map"), N_(
"Opens the in-system overlay map.") },
95 {
"mousefly", N_(
"Mouse Flight"), N_(
"Toggles mouse flying.") },
96 {
"cooldown", N_(
"Active Cooldown"), N_(
"Begins active cooldown.") },
98 {
"log_up", N_(
"Log Scroll Up"), N_(
"Scrolls the log upwards.") },
99 {
"log_down", N_(
"Log Scroll Down"), N_(
"Scrolls the log downwards.") },
100 {
"hail", N_(
"Hail Target"), N_(
"Attempts to initialize communication with the targeted ship.") },
101 {
"autohail", N_(
"Autohail"), N_(
"Automatically initialize communication with a ship that is hailing you.") },
103 {
"mapzoomin", N_(
"Radar Zoom In"), N_(
"Zooms in on the radar.") },
104 {
"mapzoomout", N_(
"Radar Zoom Out"), N_(
"Zooms out on the radar.") },
105 {
"screenshot", N_(
"Screenshot"), N_(
"Takes a screenshot.") },
106 {
"togglefullscreen", N_(
"Toggle Fullscreen"), N_(
"Toggles between windowed and fullscreen mode.") },
107 {
"pause", N_(
"Pause"), N_(
"Pauses the game.") },
108 {
"speed", N_(
"Toggle Speed"), N_(
"Toggles speed modifier.") },
109 {
"menu", N_(
"Small Menu"), N_(
"Opens the small in-game menu.") },
110 {
"info", N_(
"Information Menu"), N_(
"Opens the information menu.") },
111 {
"console", N_(
"Lua Console"), N_(
"Opens the Lua console.") },
112 {
"switchtab1", N_(
"Switch Tab 1"), N_(
"Switches to tab 1.") },
113 {
"switchtab2", N_(
"Switch Tab 2"), N_(
"Switches to tab 2.") },
114 {
"switchtab3", N_(
"Switch Tab 3"), N_(
"Switches to tab 3.") },
115 {
"switchtab4", N_(
"Switch Tab 4"), N_(
"Switches to tab 4.") },
116 {
"switchtab5", N_(
"Switch Tab 5"), N_(
"Switches to tab 5.") },
117 {
"switchtab6", N_(
"Switch Tab 6"), N_(
"Switches to tab 6.") },
118 {
"switchtab7", N_(
"Switch Tab 7"), N_(
"Switches to tab 7.") },
119 {
"switchtab8", N_(
"Switch Tab 8"), N_(
"Switches to tab 8.") },
120 {
"switchtab9", N_(
"Switch Tab 9"), N_(
"Switches to tab 9.") },
121 {
"switchtab0", N_(
"Switch Tab 0"), N_(
"Switches to tab 0.") },
123 {
"paste", N_(
"Paste"), N_(
"Paste from the operating system's clipboard.") },
162static void input_key(
int keynum,
double value,
double kabs,
int repeat );
194 input_setKeybind(
"target_nextHostile", KEYBIND_NULL, SDLK_UNKNOWN, NMOD_NONE );
195 input_setKeybind(
"target_prevHostile", KEYBIND_NULL, SDLK_UNKNOWN, NMOD_NONE );
203 input_setKeybind(
"target_nextHostile", KEYBIND_KEYBOARD, SDLK_r, NMOD_CTRL );
204 input_setKeybind(
"target_prevHostile", KEYBIND_NULL, SDLK_UNKNOWN, NMOD_NONE );
206 input_setKeybind(
"target_clear", KEYBIND_KEYBOARD, SDLK_BACKSPACE, NMOD_ANY );
253 input_setKeybind(
"mapzoomout", KEYBIND_KEYBOARD, SDLK_KP_MINUS, NMOD_ANY );
254 input_setKeybind(
"screenshot", KEYBIND_KEYBOARD, SDLK_KP_MULTIPLY, NMOD_ANY );
255 input_setKeybind(
"togglefullscreen", KEYBIND_KEYBOARD, SDLK_F11, NMOD_ANY );
281 SDL_EventState( SDL_SYSWMEVENT, SDL_DISABLE );
284 SDL_EventState( SDL_KEYDOWN, SDL_ENABLE );
285 SDL_EventState( SDL_KEYUP, SDL_ENABLE );
288 SDL_EventState( SDL_MOUSEMOTION, SDL_ENABLE );
289 SDL_EventState( SDL_MOUSEBUTTONDOWN, SDL_ENABLE );
290 SDL_EventState( SDL_MOUSEBUTTONUP, SDL_ENABLE );
293 SDL_EventState( SDL_JOYAXISMOTION, SDL_DISABLE );
294 SDL_EventState( SDL_JOYHATMOTION, SDL_DISABLE );
295 SDL_EventState( SDL_JOYBUTTONDOWN, SDL_DISABLE );
296 SDL_EventState( SDL_JOYBUTTONUP, SDL_DISABLE );
299 SDL_EventState( SDL_QUIT, SDL_ENABLE );
302 SDL_EventState( SDL_WINDOWEVENT, SDL_ENABLE );
305 SDL_EventState( SDL_TEXTINPUT, SDL_DISABLE);
308 SDL_EventState( SDL_MOUSEWHEEL, SDL_ENABLE );
315 memset( temp, 0,
sizeof(
Keybind) );
317 temp->
type = KEYBIND_NULL;
318 temp->
key = SDLK_UNKNOWN;
319 temp->
mod = NMOD_NONE;
321 if (strcmp(temp->
name,
"paste")==0)
370 SDL_ShowCursor( SDL_ENABLE );
394 SDL_Keycode k = SDL_GetKeyFromName( name );
395 if (k == SDLK_UNKNOWN)
396 WARN(_(
"Keyname '%s' doesn't match any key."), name);
409void input_setKeybind(
const char *keybind, KeybindType type, SDL_Keycode key, SDL_Keymod mod )
420 WARN(_(
"Unable to set keybinding '%s', that command doesn't exist"), keybind);
442 WARN(_(
"Unable to get keybinding '%s', that command doesn't exist"), keybind);
443 return (SDL_Keycode)-1;
456 KeybindType type = KEYBIND_NULL;
457 SDL_Keymod mod = NMOD_NONE;
463 strncpy( buf, _(
"Not bound"), len );
466 case KEYBIND_KEYBOARD:
470 if ((mod != NMOD_NONE) && (mod != NMOD_ANY))
473 if (key < 0x100 && isalpha(key))
474 p +=
scnprintf( &buf[p], len-p,
"%c", toupper(key) );
480 case KEYBIND_JBUTTON:
481 snprintf( buf, len, _(
"joy button %d"), key );
484 case KEYBIND_JHAT_UP:
485 snprintf( buf, len, _(
"joy hat %d up"), key );
488 case KEYBIND_JHAT_DOWN:
489 snprintf( buf, len, _(
"joy hat %d down"), key );
492 case KEYBIND_JHAT_LEFT:
493 snprintf( buf, len, _(
"joy hat %d left"), key );
496 case KEYBIND_JHAT_RIGHT:
497 snprintf( buf, len, _(
"joy hat %d right"), key );
500 case KEYBIND_JAXISPOS:
501 snprintf( buf, len, _(
"joy axis %d-"), key );
504 case KEYBIND_JAXISNEG:
505 snprintf( buf, len, _(
"joy axis %d+"), key );
519 case NMOD_NONE:
return _(
"None");
520 case NMOD_CTRL:
return _(
"Ctrl");
521 case NMOD_SHIFT:
return _(
"Shift");
522 case NMOD_ALT:
return _(
"Alt");
523 case NMOD_META:
return _(
"Meta");
524 case NMOD_ANY:
return _(
"Any");
525 default:
return _(
"unknown");
552 case KEYBIND_KEYBOARD:
553 if ((k->
mod == NMOD_ANY) || (mod == NMOD_ANY) ||
558 case KEYBIND_JAXISPOS:
559 case KEYBIND_JAXISNEG:
560 case KEYBIND_JBUTTON:
561 case KEYBIND_JHAT_UP:
562 case KEYBIND_JHAT_DOWN:
563 case KEYBIND_JHAT_LEFT:
564 case KEYBIND_JHAT_RIGHT:
587 WARN(_(
"Unable to get keybinding description '%s', that command doesn't exist"), keybind);
599 SDL_Keymod mod_filtered = 0;
600 if (mod & (KMOD_LSHIFT | KMOD_RSHIFT))
601 mod_filtered |= NMOD_SHIFT;
602 if (mod & (KMOD_LCTRL | KMOD_RCTRL))
603 mod_filtered |= NMOD_CTRL;
604 if (mod & (KMOD_LALT | KMOD_RALT))
605 mod_filtered |= NMOD_ALT;
606 if (mod & (KMOD_LGUI | KMOD_RGUI))
607 mod_filtered |= NMOD_META;
621 SDL_ShowCursor( SDL_DISABLE );
645#define KEY(s) (strcmp(input_keybinds[keynum].name,s)==0)
646#define INGAME() (!toolkit_isOpen() && ((value==KEY_RELEASE) || !player_isFlag(PLAYER_CINEMATICS)))
648 ((player.p != NULL) && !pilot_isFlag(player.p,PILOT_HYP_PREP) &&\
649 !pilot_isFlag(player.p,PILOT_HYP_BEGIN) &&\
650 !pilot_isFlag(player.p,PILOT_HYPERSPACE))
651#define NODEAD() ((player.p != NULL) && !pilot_isFlag(player.p,PILOT_DEAD))
652#define NOLAND() ((player.p != NULL) && (!landed && !pilot_isFlag(player.p,PILOT_LANDING)))
661static void input_key(
int keynum,
double value,
double kabs,
int repeat )
668 if ((value==KEY_PRESS) && !repeat) {
673 else if (value==KEY_RELEASE) {
681 if (value==KEY_PRESS) {
682 unsigned int t = SDL_GetTicks();
695 if (
KEY(
"accel") && !repeat) {
703 pilot_outfitLOnkeydoubletap(
player.
p, OUTFIT_KEY_ACCEL );
707 else if (value==KEY_RELEASE) {
709 pilot_outfitLOnkeyrelease(
player.
p, OUTFIT_KEY_ACCEL );
714 if (value==KEY_PRESS) {
716 player_setFlag(PLAYER_ACCEL);
719 else if (value==KEY_RELEASE) {
720 player_rmFlag(PLAYER_ACCEL);
721 if (!player_isFlag(PLAYER_REVERSE))
727 }
else if (
KEY(
"left") && !repeat) {
730 pilot_outfitLOnkeydoubletap(
player.
p, OUTFIT_KEY_LEFT );
732 else if (value==KEY_RELEASE) {
734 pilot_outfitLOnkeyrelease(
player.
p, OUTFIT_KEY_LEFT );
739 player_setFlag(PLAYER_TURN_LEFT);
744 if (value==KEY_PRESS) {
746 player_setFlag(PLAYER_TURN_LEFT);
749 else if (value==KEY_RELEASE) {
750 player_rmFlag(PLAYER_TURN_LEFT);
756 }
else if (
KEY(
"right") && !repeat) {
759 pilot_outfitLOnkeydoubletap(
player.
p, OUTFIT_KEY_RIGHT );
761 else if (value==KEY_RELEASE) {
763 pilot_outfitLOnkeyrelease(
player.
p, OUTFIT_KEY_RIGHT );
768 player_setFlag(PLAYER_TURN_RIGHT);
773 if (value==KEY_PRESS) {
775 player_setFlag(PLAYER_TURN_RIGHT);
778 else if (value==KEY_RELEASE) {
779 player_rmFlag(PLAYER_TURN_RIGHT);
785 }
else if (
KEY(
"reverse") && !repeat) {
786 if (value==KEY_PRESS) {
788 player_setFlag(PLAYER_REVERSE);
790 else if ((value==KEY_RELEASE) && player_isFlag(PLAYER_REVERSE)) {
791 player_rmFlag(PLAYER_REVERSE);
793 if (!player_isFlag(PLAYER_ACCEL))
803 if (value==KEY_PRESS)
807 }
else if (
KEY(
"face") && !repeat) {
808 if (value==KEY_PRESS) {
810 player_setFlag(PLAYER_FACE);
812 else if ((value==KEY_RELEASE) && player_isFlag(PLAYER_FACE))
813 player_rmFlag(PLAYER_FACE);
819 }
else if (
KEY(
"primary") && !repeat) {
820 if (value==KEY_PRESS) {
821 player_setFlag(PLAYER_PRIMARY);
823 else if (value==KEY_RELEASE)
824 player_rmFlag(PLAYER_PRIMARY);
826 }
else if ((
INGAME() || map_isOpen()) &&
NODEAD() &&
KEY(
"target_next")) {
827 if (value==KEY_PRESS) {
829 map_cycleMissions(1);
833 }
else if ((
INGAME() || map_isOpen()) &&
NODEAD() &&
KEY(
"target_prev")) {
834 if (value==KEY_PRESS) {
836 map_cycleMissions(-1);
840 }
else if ((
INGAME() || map_isOpen()) &&
NODEAD() &&
KEY(
"target_nearest")) {
841 if (value==KEY_PRESS) {
843 map_cycleMissions(1);
876 }
else if (
KEY(
"secondary") && !repeat) {
877 if (value==KEY_PRESS) {
878 player_setFlag(PLAYER_SECONDARY);
880 else if (value==KEY_RELEASE)
881 player_rmFlag(PLAYER_SECONDARY);
884 }
else if (
NODEAD() &&
KEY(
"weapset1")) {
886 }
else if (
NODEAD() &&
KEY(
"weapset2")) {
888 }
else if (
NODEAD() &&
KEY(
"weapset3")) {
890 }
else if (
NODEAD() &&
KEY(
"weapset4")) {
892 }
else if (
NODEAD() &&
KEY(
"weapset5")) {
894 }
else if (
NODEAD() &&
KEY(
"weapset6")) {
896 }
else if (
NODEAD() &&
KEY(
"weapset7")) {
898 }
else if (
NODEAD() &&
KEY(
"weapset8")) {
900 }
else if (
NODEAD() &&
KEY(
"weapset9")) {
902 }
else if (
NODEAD() &&
KEY(
"weapset0")) {
909 if (value==KEY_PRESS) {
923 if (value==KEY_PRESS) {
930 if (value==KEY_PRESS) map_open();
931 }
else if (
KEY(
"jump") &&
INGAME() && !repeat) {
932 if (value==KEY_PRESS) {
936 }
else if (
KEY(
"overlay") &&
NODEAD() && (
INGAME() || map_isOpen()) && !repeat) {
941 }
else if (
KEY(
"mousefly") &&
NODEAD() && !repeat) {
942 if (value==KEY_PRESS)
945 if (value==KEY_PRESS) {
954 if (value==KEY_PRESS) {
958 if (value==KEY_PRESS) {
962 if (value==KEY_PRESS) {
966 if (value==KEY_PRESS) {
980 }
else if (
KEY(
"screenshot")) {
983 }
else if (
KEY(
"togglefullscreen") && !repeat) {
984 if (value==KEY_PRESS) naev_toggleFullscreen();
986 }
else if (
KEY(
"pause") && !repeat) {
987 if (value==KEY_PRESS) {
996 }
else if (
KEY(
"speed") && !repeat) {
997 if ((value==KEY_PRESS) && (!player_isFlag( PLAYER_CINEMATICS_2X ))) {
1006 }
else if (
KEY(
"menu") &&
NODEAD() && !repeat) {
1007 if (value==KEY_PRESS) menu_small( 1, 1, 1, 1 );
1014 }
else if (
KEY(
"console") &&
NODEAD() && !repeat) {
1024 hparam[0].
type = HOOK_PARAM_STRING;
1026 hparam[1].
type = HOOK_PARAM_BOOL;
1027 hparam[1].
u.
b = (value > 0.);
1028 hparam[2].
type = HOOK_PARAM_SENTINEL;
1037static void input_joyaxis(
const SDL_Keycode axis,
const int value );
1038static void input_joyevent(
const int event,
const SDL_Keycode button );
1039static void input_keyevent(
const int event,
const SDL_Keycode key,
const SDL_Keymod mod,
const int repeat );
1056 int k = (value > 0) ? KEY_PRESS : KEY_RELEASE;
1065 int k = (value < 0) ? KEY_PRESS : KEY_RELEASE;
1101 int event = (value & SDL_HAT_UP) ? KEY_PRESS : KEY_RELEASE;
1105 int event = (value & SDL_HAT_DOWN) ? KEY_PRESS : KEY_RELEASE;
1109 int event = (value & SDL_HAT_LEFT) ? KEY_PRESS : KEY_RELEASE;
1113 int event = (value & SDL_HAT_RIGHT) ? KEY_PRESS : KEY_RELEASE;
1130static void input_keyevent(
const int event, SDL_Keycode key,
const SDL_Keymod mod,
const int repeat )
1141 (event == KEY_RELEASE))
1179 hparam[0].
type = HOOK_PARAM_NUMBER;
1180 hparam[0].
u.
num =
event->button.button;
1181 hparam[1].
type = HOOK_PARAM_BOOL;
1182 hparam[1].
u.
b = (
event->type == SDL_MOUSEBUTTONDOWN);
1183 hparam[2].
type = HOOK_PARAM_SENTINEL;
1187 if (player_isFlag(PLAYER_CINEMATICS))
1191 if ((
player.
p == NULL) || player_isFlag(PLAYER_DESTROYED))
1195 if (pilot_isFlag(
player.
p, PILOT_DEAD))
1199 if (event->button.button == SDL_BUTTON_MIDDLE) {
1205 if (event->button.button != SDL_BUTTON_LEFT &&
1206 event->button.button != SDL_BUTTON_RIGHT)
1234int input_clickPos( SDL_Event *event,
double x,
double y,
double zoom,
double minpr,
double minr )
1240 int pntid, jpid, astid, fieid;
1244 if (event->button.button == SDL_BUTTON_RIGHT) {
1247 dp =
pow2(x - p->solid.pos.x) +
pow2(y - p->solid.pos.y);
1254 rp =
MAX( 1.5 * PILOT_SIZE_APPROX * p->ship->gfx_space->sw / 2 * zoom, minpr);
1258 r =
MAX( 1.5 * pnt->
radius * zoom, minr );
1260 else if (jpid >= 0) {
1262 r =
MAX( 1.5 * jp->radius * zoom, minr );
1264 else if (astid >= 0) {
1275 if ((dp >
pow2(rp)) || ((
d <
pow2(r)) && (dp >
d)))
1279 jpid = pntid = astid = fieid = -1;
1282 if (event->button.button == SDL_BUTTON_LEFT) {
1283 if (pid != PLAYER_ID) {
1286 else if (pntid >= 0) {
1289 else if (jpid >= 0) {
1292 else if (astid >= 0) {
1297 else if (event->button.button == SDL_BUTTON_RIGHT) {
1326 if (!jp_isUsable(jp))
1333 map_select( jp->target, 0 );
1361 if (!spob_isKnown(pnt))
1373 if (!spob_isFlag(pnt, SPOB_SERVICE_INHABITED) || pnt->
can_land ||
1376 if (ret == PLAYER_LAND_AGAIN) {
1379 else if (ret == PLAYER_LAND_DENIED) {
1420 if (pilot == PLAYER_ID)
1431 if (pilot_isDisabled(p) || pilot_isFlag(p, PILOT_BOARDABLE)) {
1464 unsigned int threshold;
1490 if ((event->type == SDL_MOUSEMOTION) ||
1491 (event->type == SDL_MOUSEBUTTONDOWN) ||
1492 (event->type == SDL_MOUSEBUTTONUP)) {
1494 SDL_ShowCursor( SDL_ENABLE );
1501 if (event->type == SDL_KEYDOWN && SDL_HasClipboardText() &&
1502 SDL_EventState( SDL_TEXTINPUT, SDL_QUERY )==SDL_ENABLE) {
1504 if ((input_paste->
key == event->key.keysym.sym) &&
1505 (input_paste->
mod & mod)) {
1507 char *txt = SDL_GetClipboardText();
1508 evt.type = SDL_TEXTINPUT;
1511 while ((ch = u8_nextchar( txt, &i ))) {
1512 size_t e = u8_wc_toutf8( evt.text.text, ch );
1513 evt.text.text[e] =
'\0';
1514 SDL_PushEvent( &evt );
1528 if (ovr_input(event))
1535 switch (event->type) {
1540 case SDL_JOYAXISMOTION:
1544 case SDL_JOYBUTTONDOWN:
1548 case SDL_JOYBUTTONUP:
1552 case SDL_JOYHATMOTION:
1557 if (event->key.repeat != 0)
1559 input_keyevent(KEY_PRESS, event->key.keysym.sym, event->key.keysym.mod, 0);
1563 if (event->key.repeat != 0)
1565 input_keyevent(KEY_RELEASE, event->key.keysym.sym, event->key.keysym.mod, 0);
1569 case SDL_MOUSEBUTTONDOWN:
1573 case SDL_MOUSEWHEEL:
1574 if (event->wheel.y > 0)
1576 else if (event->wheel.y < 0)
1580 case SDL_MOUSEMOTION:
Provides macros to work with dynamic arrays.
int player_tryBoard(int noisy)
Attempt to board the player's target.
double cam_getZoomTarget(void)
Gets the camera zoom.
double cam_getZoom(void)
Gets the camera zoom.
void cam_setZoomTarget(double zoom, double speed)
Sets the camera zoom target.
void cli_open(void)
Opens the console.
int escorts_hold(const Pilot *parent)
Have a pilot order its escorts to hold position.
int escorts_return(const Pilot *parent)
Have a pilot order its escorts to dock.
int escorts_attack(Pilot *parent)
Have a pilot order its escorts to attack its target.
int escorts_clear(const Pilot *parent)
Have a pilot order its escorts to clear orders.
const char * pgettext_var(const char *msgctxt, const char *msgid)
int gui_radarClickEvent(SDL_Event *event)
Handles a click at a position in the current system.
int gui_handleEvent(SDL_Event *evt)
Handles GUI events.
void gui_messageScrollDown(int lines)
Scrolls up the message box.
int gui_borderClickEvent(SDL_Event *event)
Handles clicks on the GUI border icons.
void gui_setRadarRel(int mod)
Modifies the radar resolution.
void gui_messageScrollUp(int lines)
Scrolls up the message box.
int hooks_runParam(const char *stack, const HookParam *param)
Runs all the hooks of stack.
Header file with generic functions and naev-specifics.
int scnprintf(char *text, size_t maxlen, const char *fmt,...)
Like snprintf(), but returns the number of characters ACTUALLY "printed" into the buffer....
void gl_windowToScreenPos(int *sx, int *sy, int wx, int wy)
Translates the window position to screen position.
void gl_screenToGameCoords(double *nx, double *ny, int bx, int by)
Converts screen coordinates to in-game coordinates.
void pause_player(void)
Pauses the game and marks the pause as player-initiated.
void unpause_game(void)
Unpauses the game.
double pilot_getNearestPos(const Pilot *p, unsigned int *tp, double x, double y, int disabled)
Get the nearest pilot to a pilot from a certain position.
Pilot * pilot_get(unsigned int id)
Pulls a pilot out of the pilot_stack based on ID.
void pilot_afterburnOver(Pilot *p)
Deactivates the afterburner.
void pilot_afterburn(Pilot *p)
Activate the afterburner.
void player_stealth(void)
Input binding for toggling stealth for the player.
void player_weapSetPress(int id, double value, int repeat)
Handles keyboard events involving the player's weapon-set keys. It's valid to call this while gamepla...
void player_autohail(void)
Automatically tries to hail a pilot that hailed the player.
void player_cooldownBrake(void)
Starts braking or active cooldown.
void player_accel(double acc)
Start accelerating.
void player_targetEscort(int prev)
Targets the pilot.
void player_targetAsteroidSet(int field, int id)
Sets the player's target asteroid.
void player_targetSet(unsigned int id)
Sets the player's target.
void player_hailSpob(void)
Opens communication with the player's spob target.
void player_resetSpeed(void)
Resets the player speed stuff.
void player_targetHyperspaceSet(int id, int nomsg)
Sets the player's hyperspace target.
void player_targetHyperspace(void)
Gets a hyperspace target.
void player_hyperspacePreempt(int preempt)
Enables or disables jump points preempting spobs in autoface and target clearing.
void player_toggleMouseFly(void)
Toggles mouse flying.
void player_targetNearest(void)
Player targets nearest pilot.
void player_restoreControl(int reason, const char *str)
Aborts autonav and other states that take control of the ship.
int player_jump(void)
Actually attempts to jump in hyperspace.
void player_targetSpobSet(int id)
Sets the player's target spob.
void player_accelOver(void)
Done accelerating.
int player_land(int loud)
Try to land or target closest spob if no land target.
void player_targetPrev(int mode)
Cycles to previous target.
void player_targetClear(void)
Clears the player's ship, spob or hyperspace target, in that order.
void player_targetHostile(void)
Targets the nearest hostile enemy to the player.
void player_screenshot(void)
Takes a screenshot.
void player_approach(void)
Logic to make the player approach a target pilot to board or spob to land on.
void player_targetSpob(void)
Cycle through spob targets.
void player_targetNext(int mode)
Cycles to next target.
void player_hail(void)
Opens communication with the player's target.
void player_autonavStartWindow(unsigned int wid, const char *str)
Starts autonav and closes the window.
void player_autonavPos(double x, double y)
Starts autonav with a local position destination.
void player_autonavStart(void)
Starts autonav.
void player_autonavPil(unsigned int p)
Starts autonav with a pilot to follow.
void player_autonavBoard(unsigned int p)
Starts autonav with a pilot to board.
void player_autonavSpob(const char *name, int tryland)
Starts autonav with a spob destination.
double system_getClosest(const StarSystem *sys, int *pnt, int *jp, int *ast, int *fie, double x, double y)
Gets the closest feature to a position in the system.
int space_canHyperspace(const Pilot *p)
Checks to make sure if pilot is far enough away to hyperspace.
void spob_updateLand(Spob *p)
Updates the land possibilities of a spob.
Represents an asteroid field anchor.
Represents a single asteroid.
The actual hook parameter.
The representation of an in-game pilot.
unsigned int repeat_delay
unsigned int doubletap_sens
Represents a Space Object (SPOB), including and not limited to planets, stations, wormholes,...