Cleanup of inplib: don't include stuff from uqm/, some funcs and vars moved around, some dead stuff removed, others
git-svn-id: svn://svn.code.sf.net/p/sc2/code/trunk@3226 8092fc87-c524-0410-9efc-e669fe64eaf9
This commit is contained in:
@@ -23,13 +23,10 @@
|
|||||||
#include "libs/compiler.h"
|
#include "libs/compiler.h"
|
||||||
#include "libs/uio.h"
|
#include "libs/uio.h"
|
||||||
|
|
||||||
typedef DWORD INPUT_STATE;
|
|
||||||
|
|
||||||
extern BOOLEAN InitInput (void);
|
|
||||||
extern BOOLEAN UninitInput (void);
|
|
||||||
extern BOOLEAN AnyButtonPress (BOOLEAN DetectSpecial);
|
extern BOOLEAN AnyButtonPress (BOOLEAN DetectSpecial);
|
||||||
|
|
||||||
extern void FlushInput (void);
|
extern void TFB_ResetControls (void);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Not used right now
|
* Not used right now
|
||||||
|
|||||||
@@ -20,6 +20,6 @@
|
|||||||
#define _INPINTRN_H
|
#define _INPINTRN_H
|
||||||
|
|
||||||
#include "libs/inplib.h"
|
#include "libs/inplib.h"
|
||||||
|
#include "libs/input/input_common.h"
|
||||||
|
|
||||||
#endif /* _INPINTRN_H */
|
#endif /* _INPINTRN_H */
|
||||||
|
|||||||
@@ -17,7 +17,4 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include "port.h"
|
#include "port.h"
|
||||||
#include "input_common.h"
|
|
||||||
#include "inpintrn.h"
|
#include "inpintrn.h"
|
||||||
|
|
||||||
volatile BOOLEAN ExitRequested, GamePaused;
|
|
||||||
|
|||||||
@@ -28,7 +28,12 @@ enum
|
|||||||
// flags for TFB_InitInput
|
// flags for TFB_InitInput
|
||||||
//#define TFB_INPUTFLAGS_ETC (1<<0)
|
//#define TFB_INPUTFLAGS_ETC (1<<0)
|
||||||
|
|
||||||
int TFB_InitInput (int driver, int flags);
|
extern int TFB_InitInput (int driver, int flags);
|
||||||
void TFB_UninitInput (void);
|
extern void TFB_UninitInput (void);
|
||||||
|
|
||||||
|
#define MAX_FLIGHT_ALTERNATES 2
|
||||||
|
|
||||||
|
extern void TFB_SetInputVectors (volatile int menu[], int num_menu,
|
||||||
|
volatile int flight[], int num_templ, int num_flight);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -20,8 +20,8 @@
|
|||||||
|
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
|
#include "../inpintrn.h"
|
||||||
#include "libs/graphics/sdl/sdl_common.h"
|
#include "libs/graphics/sdl/sdl_common.h"
|
||||||
#include "libs/input/input_common.h"
|
|
||||||
#include "libs/input/sdl/vcontrol.h"
|
#include "libs/input/sdl/vcontrol.h"
|
||||||
#include "libs/input/sdl/keynames.h"
|
#include "libs/input/sdl/keynames.h"
|
||||||
#include "libs/memlib.h"
|
#include "libs/memlib.h"
|
||||||
@@ -29,8 +29,6 @@
|
|||||||
#include "libs/log.h"
|
#include "libs/log.h"
|
||||||
#include "libs/reslib.h"
|
#include "libs/reslib.h"
|
||||||
#include "options.h"
|
#include "options.h"
|
||||||
// XXX: we should not include anything from uqm/ inside libs/
|
|
||||||
#include "uqm/controls.h"
|
|
||||||
|
|
||||||
|
|
||||||
#define KBDBUFSIZE (1 << 8)
|
#define KBDBUFSIZE (1 << 8)
|
||||||
@@ -41,6 +39,14 @@ static int num_keys = 0;
|
|||||||
static int *kbdstate = NULL;
|
static int *kbdstate = NULL;
|
||||||
// Holds all SDL keys +1 for holding invalid values
|
// Holds all SDL keys +1 for holding invalid values
|
||||||
|
|
||||||
|
static volatile int *menu_vec;
|
||||||
|
static int num_menu;
|
||||||
|
// The last vector element is the character repeat "key"
|
||||||
|
#define KEY_MENU_ANY (num_menu - 1)
|
||||||
|
static volatile int *flight_vec;
|
||||||
|
static int num_templ;
|
||||||
|
static int num_flight;
|
||||||
|
|
||||||
static BOOLEAN InputInitialized = FALSE;
|
static BOOLEAN InputInitialized = FALSE;
|
||||||
|
|
||||||
static BOOLEAN in_character_mode = FALSE;
|
static BOOLEAN in_character_mode = FALSE;
|
||||||
@@ -98,12 +104,15 @@ register_menu_controls (int index)
|
|||||||
if (!res_HasKey (buf))
|
if (!res_HasKey (buf))
|
||||||
break;
|
break;
|
||||||
VControl_ParseGesture (&g, res_GetString (buf));
|
VControl_ParseGesture (&g, res_GetString (buf));
|
||||||
VControl_AddGestureBinding (&g, (int *)&ImmediateInputState.menu[index]);
|
VControl_AddGestureBinding (&g, (int *)&menu_vec[index]);
|
||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static VCONTROL_GESTURE controls[NUM_TEMPLATES][NUM_KEYS][2];
|
|
||||||
|
static VCONTROL_GESTURE *controls;
|
||||||
|
#define CONTROL_PTR(i, j, k) \
|
||||||
|
(controls + ((i) * num_flight + (j)) * MAX_FLIGHT_ALTERNATES + (k))
|
||||||
|
|
||||||
static void
|
static void
|
||||||
register_flight_controls (void)
|
register_flight_controls (void)
|
||||||
@@ -113,7 +122,7 @@ register_flight_controls (void)
|
|||||||
|
|
||||||
buf[39] = '\0';
|
buf[39] = '\0';
|
||||||
|
|
||||||
for (i = 0; i < NUM_TEMPLATES; i++)
|
for (i = 0; i < num_templ; i++)
|
||||||
{
|
{
|
||||||
/* Copy in name */
|
/* Copy in name */
|
||||||
snprintf (buf, 39, "keys.%d.name", i+1);
|
snprintf (buf, 39, "keys.%d.name", i+1);
|
||||||
@@ -126,11 +135,11 @@ register_flight_controls (void)
|
|||||||
{
|
{
|
||||||
input_templates[i].name[0] = '\0';
|
input_templates[i].name[0] = '\0';
|
||||||
}
|
}
|
||||||
for (j = 0; j < NUM_KEYS; j++)
|
for (j = 0; j < num_flight; j++)
|
||||||
{
|
{
|
||||||
for (k = 0; k < 2; k++)
|
for (k = 0; k < MAX_FLIGHT_ALTERNATES; k++)
|
||||||
{
|
{
|
||||||
VCONTROL_GESTURE *g = &controls[i][j][k];
|
VCONTROL_GESTURE *g = CONTROL_PTR(i, j, k);
|
||||||
snprintf (buf, 39, "keys.%d.%s.%d", i+1, flight_res_names[j], k+1);
|
snprintf (buf, 39, "keys.%d.%s.%d", i+1, flight_res_names[j], k+1);
|
||||||
if (!res_HasKey (buf))
|
if (!res_HasKey (buf))
|
||||||
{
|
{
|
||||||
@@ -138,7 +147,7 @@ register_flight_controls (void)
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
VControl_ParseGesture (g, res_GetString (buf));
|
VControl_ParseGesture (g, res_GetString (buf));
|
||||||
VControl_AddGestureBinding (g, (int *)&ImmediateInputState.key[i][j]);
|
VControl_AddGestureBinding (g, (int *)(flight_vec + i * num_flight + j));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -149,10 +158,19 @@ initKeyConfig (void)
|
|||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
|
if (!menu_vec || !flight_vec)
|
||||||
|
{
|
||||||
|
log_add (log_Fatal, "initKeyConfig(): invalid input vectors");
|
||||||
|
exit (EXIT_FAILURE);
|
||||||
|
}
|
||||||
|
|
||||||
|
controls = HCalloc (sizeof (*controls) * num_templ * num_flight
|
||||||
|
* MAX_FLIGHT_ALTERNATES);
|
||||||
|
|
||||||
/* First, load in the menu keys */
|
/* First, load in the menu keys */
|
||||||
LoadResourceIndex (contentDir, "menu.key", "menu.");
|
LoadResourceIndex (contentDir, "menu.key", "menu.");
|
||||||
LoadResourceIndex (configDir, "override.cfg", "menu.");
|
LoadResourceIndex (configDir, "override.cfg", "menu.");
|
||||||
for (i = 0; i < NUM_MENU_KEYS; i++)
|
for (i = 0; i < num_menu; i++)
|
||||||
{
|
{
|
||||||
if (!menu_res_names[i])
|
if (!menu_res_names[i])
|
||||||
break;
|
break;
|
||||||
@@ -178,7 +196,23 @@ static void
|
|||||||
resetKeyboardState (void)
|
resetKeyboardState (void)
|
||||||
{
|
{
|
||||||
memset (kbdstate, 0, sizeof (int) * num_keys);
|
memset (kbdstate, 0, sizeof (int) * num_keys);
|
||||||
ImmediateInputState.menu[KEY_MENU_ANY] = 0;
|
menu_vec[KEY_MENU_ANY] = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
TFB_SetInputVectors (volatile int menu[], int num_menu_, volatile int flight[],
|
||||||
|
int num_templ_, int num_flight_)
|
||||||
|
{
|
||||||
|
if (num_menu_ < 0 || num_templ_ < 0 || num_flight_ < 0)
|
||||||
|
{
|
||||||
|
log_add (log_Fatal, "TFB_SetInputVectors(): invalid vector size");
|
||||||
|
exit (EXIT_FAILURE);
|
||||||
|
}
|
||||||
|
menu_vec = menu;
|
||||||
|
num_menu = num_menu_;
|
||||||
|
flight_vec = flight;
|
||||||
|
num_templ = num_templ_;
|
||||||
|
num_flight = num_flight_;
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
@@ -189,8 +223,6 @@ TFB_InitInput (int driver, int flags)
|
|||||||
(void)driver;
|
(void)driver;
|
||||||
(void)flags;
|
(void)flags;
|
||||||
|
|
||||||
GamePaused = ExitRequested = FALSE;
|
|
||||||
|
|
||||||
SDL_EnableUNICODE(1);
|
SDL_EnableUNICODE(1);
|
||||||
(void)SDL_GetKeyState (&num_keys);
|
(void)SDL_GetKeyState (&num_keys);
|
||||||
kbdstate = (int *)HMalloc (sizeof (int) * (num_keys + 1));
|
kbdstate = (int *)HMalloc (sizeof (int) * (num_keys + 1));
|
||||||
@@ -237,6 +269,7 @@ void
|
|||||||
TFB_UninitInput (void)
|
TFB_UninitInput (void)
|
||||||
{
|
{
|
||||||
VControl_Uninit ();
|
VControl_Uninit ();
|
||||||
|
HFree (controls);
|
||||||
HFree (kbdstate);
|
HFree (kbdstate);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -342,7 +375,7 @@ ProcessInputEvent (const SDL_Event *Event)
|
|||||||
kbdbuf[kbdtail] = map_key;
|
kbdbuf[kbdtail] = map_key;
|
||||||
kbdtail = newtail;
|
kbdtail = newtail;
|
||||||
lastchar = map_key;
|
lastchar = map_key;
|
||||||
ImmediateInputState.menu[KEY_MENU_ANY]++;
|
menu_vec[KEY_MENU_ANY]++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (Event->type == SDL_KEYUP)
|
else if (Event->type == SDL_KEYUP)
|
||||||
@@ -350,13 +383,13 @@ ProcessInputEvent (const SDL_Event *Event)
|
|||||||
if (kbdstate[k] == 0)
|
if (kbdstate[k] == 0)
|
||||||
{ // something is fishy -- better to reset the
|
{ // something is fishy -- better to reset the
|
||||||
// repeatable state to avoid big problems
|
// repeatable state to avoid big problems
|
||||||
ImmediateInputState.menu[KEY_MENU_ANY] = 0;
|
menu_vec[KEY_MENU_ANY] = 0;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
kbdstate[k]--;
|
kbdstate[k]--;
|
||||||
if (ImmediateInputState.menu[KEY_MENU_ANY] > 0)
|
if (menu_vec[KEY_MENU_ANY] > 0)
|
||||||
ImmediateInputState.menu[KEY_MENU_ANY]--;
|
menu_vec[KEY_MENU_ANY]--;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -372,17 +405,18 @@ TFB_ResetControls (void)
|
|||||||
lastchar = 0;
|
lastchar = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
|
||||||
FlushInput (void)
|
|
||||||
{
|
|
||||||
TFB_ResetControls ();
|
|
||||||
FlushInputState ();
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
void
|
||||||
InterrogateInputState (int template, int control, int index, char *buffer, int maxlen)
|
InterrogateInputState (int template, int control, int index, char *buffer, int maxlen)
|
||||||
{
|
{
|
||||||
VCONTROL_GESTURE *g = &controls[template][control][index];
|
VCONTROL_GESTURE *g = CONTROL_PTR(template, control, index);
|
||||||
|
|
||||||
|
if (template >= num_templ || control >= num_flight
|
||||||
|
|| index >= MAX_FLIGHT_ALTERNATES)
|
||||||
|
{
|
||||||
|
log_add (log_Warning, "InterrogateInputState(): invalid control index");
|
||||||
|
buffer[0] = 0;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
switch (g->type)
|
switch (g->type)
|
||||||
{
|
{
|
||||||
@@ -411,11 +445,19 @@ InterrogateInputState (int template, int control, int index, char *buffer, int m
|
|||||||
void
|
void
|
||||||
RemoveInputState (int template, int control, int index)
|
RemoveInputState (int template, int control, int index)
|
||||||
{
|
{
|
||||||
VCONTROL_GESTURE *g = &controls[template][control][index];
|
VCONTROL_GESTURE *g = CONTROL_PTR(template, control, index);
|
||||||
char keybuf[40];
|
char keybuf[40];
|
||||||
keybuf[39] = '\0';
|
keybuf[39] = '\0';
|
||||||
|
|
||||||
VControl_RemoveGestureBinding (g, (int *)&ImmediateInputState.key[template][control]);
|
if (template >= num_templ || control >= num_flight
|
||||||
|
|| index >= MAX_FLIGHT_ALTERNATES)
|
||||||
|
{
|
||||||
|
log_add (log_Warning, "RemoveInputState(): invalid control index");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
VControl_RemoveGestureBinding (g,
|
||||||
|
(int *)(flight_vec + template * num_flight + control));
|
||||||
g->type = VCONTROL_NONE;
|
g->type = VCONTROL_NONE;
|
||||||
|
|
||||||
snprintf (keybuf, 39, "keys.%d.%s.%d", template+1, flight_res_names[control], index+1);
|
snprintf (keybuf, 39, "keys.%d.%s.%d", template+1, flight_res_names[control], index+1);
|
||||||
@@ -431,6 +473,13 @@ RebindInputState (int template, int control, int index)
|
|||||||
char keybuf[40], valbuf[40];
|
char keybuf[40], valbuf[40];
|
||||||
keybuf[39] = valbuf[39] = '\0';
|
keybuf[39] = valbuf[39] = '\0';
|
||||||
|
|
||||||
|
if (template >= num_templ || control >= num_flight
|
||||||
|
|| index >= MAX_FLIGHT_ALTERNATES)
|
||||||
|
{
|
||||||
|
log_add (log_Warning, "RebindInputState(): invalid control index");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
/* Remove the old binding on this spot */
|
/* Remove the old binding on this spot */
|
||||||
RemoveInputState (template, control, index);
|
RemoveInputState (template, control, index);
|
||||||
|
|
||||||
@@ -442,8 +491,9 @@ RebindInputState (int template, int control, int index)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* And now, add the new binding. */
|
/* And now, add the new binding. */
|
||||||
VControl_AddGestureBinding (&g, (int *)&ImmediateInputState.key[template][control]);
|
VControl_AddGestureBinding (&g,
|
||||||
controls[template][control][index] = g;
|
(int *)(flight_vec + template * num_flight + control));
|
||||||
|
*CONTROL_PTR(template, control, index) = g;
|
||||||
snprintf (keybuf, 39, "keys.%d.%s.%d", template+1, flight_res_names[control], index+1);
|
snprintf (keybuf, 39, "keys.%d.%s.%d", template+1, flight_res_names[control], index+1);
|
||||||
VControl_DumpGesture (valbuf, 39, &g);
|
VControl_DumpGesture (valbuf, 39, &g);
|
||||||
res_PutString (keybuf, valbuf);
|
res_PutString (keybuf, valbuf);
|
||||||
|
|||||||
@@ -19,7 +19,6 @@
|
|||||||
#ifndef INPUT_H
|
#ifndef INPUT_H
|
||||||
#define INPUT_H
|
#define INPUT_H
|
||||||
|
|
||||||
void FlushInput (void);
|
extern void ProcessInputEvent (const SDL_Event *Event);
|
||||||
void ProcessInputEvent (const SDL_Event *Event);
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -482,6 +482,11 @@ main (int argc, char *argv[])
|
|||||||
initAudio calls AssignTask, which currently blocks on
|
initAudio calls AssignTask, which currently blocks on
|
||||||
ProcessThreadLifecycles... */
|
ProcessThreadLifecycles... */
|
||||||
// initAudio (snddriver, soundflags);
|
// initAudio (snddriver, soundflags);
|
||||||
|
// Make sure that the compiler treats multidim arrays the way we expect
|
||||||
|
assert (sizeof (int [NUM_TEMPLATES * NUM_KEYS]) ==
|
||||||
|
sizeof (int [NUM_TEMPLATES][NUM_KEYS]));
|
||||||
|
TFB_SetInputVectors (ImmediateInputState.menu, NUM_MENU_KEYS,
|
||||||
|
(volatile int *)ImmediateInputState.key, NUM_TEMPLATES, NUM_KEYS);
|
||||||
TFB_InitInput (TFB_INPUTDRIVER_SDL, 0);
|
TFB_InitInput (TFB_INPUTDRIVER_SDL, 0);
|
||||||
|
|
||||||
StartThread (Starcon2Main, NULL, 1024, "Starcon2Main");
|
StartThread (Starcon2Main, NULL, 1024, "Starcon2Main");
|
||||||
|
|||||||
@@ -24,7 +24,6 @@
|
|||||||
#include "uqm/setup.h"
|
#include "uqm/setup.h"
|
||||||
#include "uqm/shipcont.h"
|
#include "uqm/shipcont.h"
|
||||||
#include "libs/graphics/gfx_common.h"
|
#include "libs/graphics/gfx_common.h"
|
||||||
#include "libs/inplib.h"
|
|
||||||
#include "libs/mathlib.h"
|
#include "libs/mathlib.h"
|
||||||
#include "libs/inplib.h"
|
#include "libs/inplib.h"
|
||||||
#include "libs/sound/sound.h"
|
#include "libs/sound/sound.h"
|
||||||
|
|||||||
@@ -25,7 +25,6 @@
|
|||||||
#include "sounds.h"
|
#include "sounds.h"
|
||||||
#include "gamestr.h"
|
#include "gamestr.h"
|
||||||
#include "libs/graphics/widgets.h"
|
#include "libs/graphics/widgets.h"
|
||||||
#include "libs/inplib.h"
|
|
||||||
#include "libs/sound/trackplayer.h"
|
#include "libs/sound/trackplayer.h"
|
||||||
#include "libs/log.h"
|
#include "libs/log.h"
|
||||||
#include "libs/resource/stringbank.h"
|
#include "libs/resource/stringbank.h"
|
||||||
@@ -266,7 +265,6 @@ DoPopupWindow (const char *msg)
|
|||||||
|
|
||||||
DrawStamp (&s);
|
DrawStamp (&s);
|
||||||
DestroyDrawable (ReleaseDrawable (s.frame));
|
DestroyDrawable (ReleaseDrawable (s.frame));
|
||||||
FlushInput ();
|
|
||||||
SetContextClipRect (&oldRect);
|
SetContextClipRect (&oldRect);
|
||||||
SetContext (oldContext);
|
SetContext (oldContext);
|
||||||
UnlockMutex (GraphicsLock);
|
UnlockMutex (GraphicsLock);
|
||||||
|
|||||||
@@ -95,8 +95,7 @@ extern volatile CONTROLLER_INPUT_STATE ImmediateInputState;
|
|||||||
extern CONTROL_TEMPLATE PlayerControls[];
|
extern CONTROL_TEMPLATE PlayerControls[];
|
||||||
|
|
||||||
void UpdateInputState (void);
|
void UpdateInputState (void);
|
||||||
void FlushInputState (void);
|
extern void FlushInput (void);
|
||||||
void TFB_ResetControls (void);
|
|
||||||
void SetMenuRepeatDelay (DWORD min, DWORD max, DWORD step, BOOLEAN gestalt);
|
void SetMenuRepeatDelay (DWORD min, DWORD max, DWORD step, BOOLEAN gestalt);
|
||||||
void SetDefaultMenuRepeatDelay (void);
|
void SetDefaultMenuRepeatDelay (void);
|
||||||
void ResetKeyRepeat (void);
|
void ResetKeyRepeat (void);
|
||||||
|
|||||||
@@ -24,7 +24,6 @@
|
|||||||
#include "intel.h"
|
#include "intel.h"
|
||||||
#include "setup.h"
|
#include "setup.h"
|
||||||
#include "units.h"
|
#include "units.h"
|
||||||
#include "libs/inplib.h"
|
|
||||||
#include "libs/mathlib.h"
|
#include "libs/mathlib.h"
|
||||||
#include "libs/log.h"
|
#include "libs/log.h"
|
||||||
|
|
||||||
@@ -572,7 +571,7 @@ ThrustShip (ELEMENT *ShipPtr, COUNT angle)
|
|||||||
void
|
void
|
||||||
Pursue (ELEMENT *ShipPtr, EVALUATE_DESC *EvalDescPtr)
|
Pursue (ELEMENT *ShipPtr, EVALUATE_DESC *EvalDescPtr)
|
||||||
{
|
{
|
||||||
INPUT_STATE maneuver_state;
|
BYTE maneuver_state;
|
||||||
COUNT desired_thrust_angle, desired_turn_angle;
|
COUNT desired_thrust_angle, desired_turn_angle;
|
||||||
SIZE delta_x, delta_y;
|
SIZE delta_x, delta_y;
|
||||||
SIZE ship_delta_x, ship_delta_y;
|
SIZE ship_delta_x, ship_delta_y;
|
||||||
@@ -703,7 +702,7 @@ Pursue (ELEMENT *ShipPtr, EVALUATE_DESC *EvalDescPtr)
|
|||||||
void
|
void
|
||||||
Entice (ELEMENT *ShipPtr, EVALUATE_DESC *EvalDescPtr)
|
Entice (ELEMENT *ShipPtr, EVALUATE_DESC *EvalDescPtr)
|
||||||
{
|
{
|
||||||
INPUT_STATE maneuver_state;
|
BYTE maneuver_state;
|
||||||
COUNT desired_thrust_angle, desired_turn_angle;
|
COUNT desired_thrust_angle, desired_turn_angle;
|
||||||
COUNT cone_of_fire, travel_angle;
|
COUNT cone_of_fire, travel_angle;
|
||||||
SIZE delta_x, delta_y;
|
SIZE delta_x, delta_y;
|
||||||
|
|||||||
@@ -65,6 +65,9 @@ static MENU_SOUND_FLAGS sound_0, sound_1;
|
|||||||
|
|
||||||
volatile CONTROLLER_INPUT_STATE ImmediateInputState;
|
volatile CONTROLLER_INPUT_STATE ImmediateInputState;
|
||||||
|
|
||||||
|
volatile BOOLEAN ExitRequested;
|
||||||
|
volatile BOOLEAN GamePaused;
|
||||||
|
|
||||||
static void
|
static void
|
||||||
_clear_menu_state (void)
|
_clear_menu_state (void)
|
||||||
{
|
{
|
||||||
@@ -291,8 +294,9 @@ SetDefaultMenuRepeatDelay ()
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
FlushInputState (void)
|
FlushInput (void)
|
||||||
{
|
{
|
||||||
|
TFB_ResetControls ();
|
||||||
_clear_menu_state ();
|
_clear_menu_state ();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -334,7 +338,7 @@ DoInput (void *pInputState, BOOLEAN resetInput)
|
|||||||
SetMenuRepeatDelay (ACCELERATION_INCREMENT, MENU_REPEAT_DELAY,
|
SetMenuRepeatDelay (ACCELERATION_INCREMENT, MENU_REPEAT_DELAY,
|
||||||
ACCELERATION_INCREMENT, FALSE);
|
ACCELERATION_INCREMENT, FALSE);
|
||||||
if (resetInput)
|
if (resetInput)
|
||||||
TFB_ResetControls ();
|
FlushInput ();
|
||||||
|
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
@@ -376,7 +380,7 @@ DoInput (void *pInputState, BOOLEAN resetInput)
|
|||||||
} while (((INPUT_STATE_DESC*)pInputState)->InputFunc (pInputState));
|
} while (((INPUT_STATE_DESC*)pInputState)->InputFunc (pInputState));
|
||||||
|
|
||||||
if (resetInput)
|
if (resetInput)
|
||||||
TFB_ResetControls ();
|
FlushInput ();
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|||||||
@@ -25,7 +25,6 @@
|
|||||||
#include "encount.h"
|
#include "encount.h"
|
||||||
#include "planets/lander.h"
|
#include "planets/lander.h"
|
||||||
#include "gamestr.h"
|
#include "gamestr.h"
|
||||||
#include "libs/inplib.h"
|
|
||||||
#include "load.h"
|
#include "load.h"
|
||||||
#include "options.h"
|
#include "options.h"
|
||||||
#include "save.h"
|
#include "save.h"
|
||||||
|
|||||||
@@ -28,7 +28,6 @@
|
|||||||
#include "libs/graphics/drawable.h"
|
#include "libs/graphics/drawable.h"
|
||||||
#include "libs/sound/sound.h"
|
#include "libs/sound/sound.h"
|
||||||
#include "libs/vidlib.h"
|
#include "libs/vidlib.h"
|
||||||
#include "libs/inplib.h"
|
|
||||||
#include "libs/log.h"
|
#include "libs/log.h"
|
||||||
|
|
||||||
#include <ctype.h>
|
#include <ctype.h>
|
||||||
@@ -785,7 +784,6 @@ ShowSlidePresentation (STRING PresStr)
|
|||||||
OldFont = SetContextFont (NULL);
|
OldFont = SetContextFont (NULL);
|
||||||
UnlockMutex (GraphicsLock);
|
UnlockMutex (GraphicsLock);
|
||||||
|
|
||||||
FlushInput ();
|
|
||||||
SetMenuSounds (MENU_SOUND_NONE, MENU_SOUND_NONE);
|
SetMenuSounds (MENU_SOUND_NONE, MENU_SOUND_NONE);
|
||||||
pis.MenuRepeatDelay = 0;
|
pis.MenuRepeatDelay = 0;
|
||||||
pis.InputFunc = DoPresentation;
|
pis.InputFunc = DoPresentation;
|
||||||
@@ -891,8 +889,6 @@ ShowLegacyVideo (LEGACY_VIDEO vid)
|
|||||||
if (!ref)
|
if (!ref)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
// XXX: FlushInput() won't be need once DoInput(reset-input) works right
|
|
||||||
FlushInput ();
|
|
||||||
vis.MenuRepeatDelay = 0;
|
vis.MenuRepeatDelay = 0;
|
||||||
vis.InputFunc = DoVideoInput;
|
vis.InputFunc = DoVideoInput;
|
||||||
vis.CurVideo = ref;
|
vis.CurVideo = ref;
|
||||||
|
|||||||
+1
-2
@@ -48,7 +48,6 @@
|
|||||||
#include "util.h"
|
#include "util.h"
|
||||||
#include "libs/graphics/drawable.h"
|
#include "libs/graphics/drawable.h"
|
||||||
#include "libs/gfxlib.h"
|
#include "libs/gfxlib.h"
|
||||||
#include "libs/inplib.h"
|
|
||||||
#include "libs/mathlib.h"
|
#include "libs/mathlib.h"
|
||||||
#include "libs/log.h"
|
#include "libs/log.h"
|
||||||
|
|
||||||
@@ -1098,7 +1097,7 @@ DoEdit (MELEE_STATE *pMS)
|
|||||||
pMS->Initialized = 0;
|
pMS->Initialized = 0;
|
||||||
else
|
else
|
||||||
pMS->Initialized = -1;
|
pMS->Initialized = -1;
|
||||||
TFB_ResetControls ();
|
FlushInput ();
|
||||||
DoPickShip (pMS);
|
DoPickShip (pMS);
|
||||||
}
|
}
|
||||||
else if (pMS->row < NUM_MELEE_ROWS &&
|
else if (pMS->row < NUM_MELEE_ROWS &&
|
||||||
|
|||||||
@@ -651,7 +651,7 @@ Devices (MENU_STATE *pMS)
|
|||||||
pMS->first_item.y = 0;
|
pMS->first_item.y = 0;
|
||||||
|
|
||||||
pMS->CurFrame = (FRAME)DeviceMap;
|
pMS->CurFrame = (FRAME)DeviceMap;
|
||||||
TFB_ResetControls ();
|
FlushInput ();
|
||||||
DoManipulateDevices (pMS); /* to make sure it's initialized */
|
DoManipulateDevices (pMS); /* to make sure it's initialized */
|
||||||
SetMenuSounds (MENU_SOUND_ARROWS, MENU_SOUND_SELECT);
|
SetMenuSounds (MENU_SOUND_ARROWS, MENU_SOUND_SELECT);
|
||||||
DoInput (pMS, TRUE);
|
DoInput (pMS, TRUE);
|
||||||
|
|||||||
@@ -35,7 +35,6 @@
|
|||||||
#include "../uqmdebug.h"
|
#include "../uqmdebug.h"
|
||||||
#include "libs/graphics/gfx_common.h"
|
#include "libs/graphics/gfx_common.h"
|
||||||
#include "libs/mathlib.h"
|
#include "libs/mathlib.h"
|
||||||
#include "libs/inplib.h"
|
|
||||||
#include "libs/log.h"
|
#include "libs/log.h"
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -317,7 +317,6 @@ RestartMenu (MENU_STATE *pMS)
|
|||||||
if (TimeOut == ONE_SECOND / 8)
|
if (TimeOut == ONE_SECOND / 8)
|
||||||
SleepThread (ONE_SECOND * 3);
|
SleepThread (ONE_SECOND * 3);
|
||||||
DrawRestartMenuGraphic (pMS);
|
DrawRestartMenuGraphic (pMS);
|
||||||
FlushInput ();
|
|
||||||
GLOBAL (CurrentActivity) &= ~CHECK_ABORT;
|
GLOBAL (CurrentActivity) &= ~CHECK_ABORT;
|
||||||
SetMenuSounds (MENU_SOUND_UP | MENU_SOUND_DOWN, MENU_SOUND_SELECT);
|
SetMenuSounds (MENU_SOUND_UP | MENU_SOUND_DOWN, MENU_SOUND_SELECT);
|
||||||
DoInput (pMS, TRUE);
|
DoInput (pMS, TRUE);
|
||||||
|
|||||||
+2
-3
@@ -606,7 +606,8 @@ SaveProblem (void)
|
|||||||
FlushGraphics ();
|
FlushGraphics ();
|
||||||
UnlockMutex (GraphicsLock);
|
UnlockMutex (GraphicsLock);
|
||||||
|
|
||||||
while (AnyButtonPress (FALSE));
|
while (AnyButtonPress (FALSE))
|
||||||
|
;
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
TaskSwitch ();
|
TaskSwitch ();
|
||||||
@@ -622,8 +623,6 @@ SaveProblem (void)
|
|||||||
SetContext (OldContext);
|
SetContext (OldContext);
|
||||||
DestroyDrawable (ReleaseDrawable (s.frame));
|
DestroyDrawable (ReleaseDrawable (s.frame));
|
||||||
UnlockMutex (GraphicsLock);
|
UnlockMutex (GraphicsLock);
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// This function first writes to a memory file, and then writes the whole
|
// This function first writes to a memory file, and then writes the whole
|
||||||
|
|||||||
@@ -30,7 +30,6 @@
|
|||||||
#include "sounds.h"
|
#include "sounds.h"
|
||||||
#include "libs/graphics/gfx_common.h"
|
#include "libs/graphics/gfx_common.h"
|
||||||
#include "libs/tasklib.h"
|
#include "libs/tasklib.h"
|
||||||
#include "libs/inplib.h"
|
|
||||||
|
|
||||||
|
|
||||||
MENU_STATE *pMenuState;
|
MENU_STATE *pMenuState;
|
||||||
|
|||||||
@@ -37,7 +37,6 @@
|
|||||||
#include "libs/log.h"
|
#include "libs/log.h"
|
||||||
#include "libs/gfxlib.h"
|
#include "libs/gfxlib.h"
|
||||||
#include "libs/graphics/gfx_common.h"
|
#include "libs/graphics/gfx_common.h"
|
||||||
#include "libs/inplib.h"
|
|
||||||
#include "libs/misc.h"
|
#include "libs/misc.h"
|
||||||
|
|
||||||
#include "uqmversion.h"
|
#include "uqmversion.h"
|
||||||
|
|||||||
Reference in New Issue
Block a user