mirror of
https://github.com/ZDoom/raze-gles.git
synced 2024-12-24 18:50:47 +00:00
Beginnings of baselayer.cpp/.h refactor. This is 99.9% renames.
git-svn-id: https://svn.eduke32.com/eduke32@6827 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
parent
f41dc7b9c4
commit
ee63d2c070
25 changed files with 641 additions and 708 deletions
|
@ -51,8 +51,6 @@ void calc_ylookup(int32_t bpl, int32_t lastyidx);
|
||||||
|
|
||||||
#ifdef USE_OPENGL
|
#ifdef USE_OPENGL
|
||||||
extern int32_t (*baselayer_osdcmd_vidmode_func)(osdfuncparm_t const * const parm);
|
extern int32_t (*baselayer_osdcmd_vidmode_func)(osdfuncparm_t const * const parm);
|
||||||
|
|
||||||
void fullscreen_tint_gl(uint8_t r, uint8_t g, uint8_t b, uint8_t f);
|
|
||||||
extern int32_t osdcmd_glinfo(osdfuncparm_t const * const parm);
|
extern int32_t osdcmd_glinfo(osdfuncparm_t const * const parm);
|
||||||
|
|
||||||
struct glinfo_t {
|
struct glinfo_t {
|
||||||
|
@ -89,40 +87,60 @@ struct glinfo_t {
|
||||||
extern struct glinfo_t glinfo;
|
extern struct glinfo_t glinfo;
|
||||||
#endif
|
#endif
|
||||||
extern int32_t setvsync(int32_t newSync);
|
extern int32_t setvsync(int32_t newSync);
|
||||||
|
extern vec2_t const g_defaultVideoModes[];
|
||||||
|
|
||||||
extern char inputdevices;
|
extern char inputdevices;
|
||||||
|
|
||||||
// keys
|
// keys
|
||||||
#define NUMKEYS 256
|
#define NUMKEYS 256
|
||||||
#define KEYSTATUSSIZ 256
|
|
||||||
#define KEYFIFOSIZ 64
|
#define KEYFIFOSIZ 64
|
||||||
extern char keystatus[KEYSTATUSSIZ], keyfifo[KEYFIFOSIZ], keyasciififo[KEYFIFOSIZ];
|
extern char const g_keyAsciiTable[128];
|
||||||
extern uint8_t keyasciififoplc, keyasciififoend, keyfifoplc, keyfifoend;
|
|
||||||
extern char scantoasc[128], keyremap[KEYSTATUSSIZ], key_names[NUMKEYS][24];
|
|
||||||
extern int32_t keyremapinit;
|
|
||||||
|
|
||||||
extern int32_t defaultres[][2];
|
extern char keystatus[NUMKEYS];
|
||||||
|
extern char g_keyFIFO[KEYFIFOSIZ];
|
||||||
|
extern char g_keyAsciiFIFO[KEYFIFOSIZ];
|
||||||
|
extern uint8_t g_keyAsciiPos;
|
||||||
|
extern uint8_t g_keyAsciiEnd;
|
||||||
|
extern uint8_t g_keyFIFOend;
|
||||||
|
extern char g_keyRemapTable[NUMKEYS];
|
||||||
|
extern char g_keyNameTable[NUMKEYS][24];
|
||||||
|
|
||||||
extern int32_t GetKey(int32_t key);
|
extern int32_t keyGetState(int32_t key);
|
||||||
extern void SetKey(int32_t key, int32_t state);
|
extern void keySetState(int32_t key, int32_t state);
|
||||||
|
|
||||||
// mouse
|
// mouse
|
||||||
extern int32_t mousex, mousey, mouseb;
|
extern vec2_t g_mousePos;
|
||||||
extern vec2_t mouseabs;
|
extern vec2_t g_mouseAbs;
|
||||||
extern uint8_t mousepressstate;
|
extern int32_t g_mouseBits;
|
||||||
extern uint8_t mousegrab, moustat, mouseinwindow, AppMouseGrab;
|
extern uint8_t g_mouseClickState;
|
||||||
|
extern bool g_mouseGrabbed;
|
||||||
|
extern bool g_mouseEnabled;
|
||||||
|
extern bool g_mouseInsideWindow;
|
||||||
|
extern bool g_mouseLockedToWindow;
|
||||||
|
|
||||||
enum
|
enum
|
||||||
{
|
{
|
||||||
Mouse_Idle = 0,
|
MOUSE_IDLE = 0,
|
||||||
Mouse_Pressed = 1,
|
MOUSE_PRESSED,
|
||||||
Mouse_Held = 2,
|
MOUSE_HELD,
|
||||||
Mouse_Released = 3,
|
MOUSE_RELEASED,
|
||||||
};
|
};
|
||||||
extern int32_t mousepressstateadvance(void);
|
extern int32_t mouseAdvanceClickState(void);
|
||||||
|
|
||||||
// joystick
|
// joystick
|
||||||
extern int32_t *joyaxis, *joyhat, joyb;
|
|
||||||
extern char joyisgamepad, joynumaxes, joynumbuttons, joynumhats;
|
typedef struct
|
||||||
extern int32_t joyaxespresent;
|
{
|
||||||
|
int32_t *pAxis;
|
||||||
|
int32_t *pHat;
|
||||||
|
void (*pCallback)(int32_t, int32_t);
|
||||||
|
int32_t bits;
|
||||||
|
int32_t numAxes;
|
||||||
|
int32_t numButtons;
|
||||||
|
int32_t numHats;
|
||||||
|
} controllerinput_t;
|
||||||
|
|
||||||
|
extern controllerinput_t joystick;
|
||||||
|
|
||||||
extern int32_t qsetmode;
|
extern int32_t qsetmode;
|
||||||
|
|
||||||
|
@ -132,7 +150,7 @@ int32_t initsystem(void);
|
||||||
void uninitsystem(void);
|
void uninitsystem(void);
|
||||||
void system_getcvars(void);
|
void system_getcvars(void);
|
||||||
|
|
||||||
extern int32_t flushlogwindow;
|
extern int32_t g_logFlushWindow;
|
||||||
void initputs(const char *);
|
void initputs(const char *);
|
||||||
#define buildputs initputs
|
#define buildputs initputs
|
||||||
void initprintf(const char *, ...) ATTRIBUTE((format(printf,1,2)));
|
void initprintf(const char *, ...) ATTRIBUTE((format(printf,1,2)));
|
||||||
|
@ -143,44 +161,43 @@ int32_t handleevents(void);
|
||||||
int32_t handleevents_peekkeys(void);
|
int32_t handleevents_peekkeys(void);
|
||||||
|
|
||||||
extern void (*keypresscallback)(int32_t,int32_t);
|
extern void (*keypresscallback)(int32_t,int32_t);
|
||||||
extern void (*mousepresscallback)(int32_t,int32_t);
|
extern void (*g_mouseCallback)(int32_t,int32_t);
|
||||||
extern void (*joypresscallback)(int32_t,int32_t);
|
|
||||||
|
|
||||||
int32_t initinput(void);
|
int32_t initinput(void);
|
||||||
void uninitinput(void);
|
void uninitinput(void);
|
||||||
void releaseallbuttons(void);
|
void keySetCallback(void (*callback)(int32_t,int32_t));
|
||||||
void setkeypresscallback(void (*callback)(int32_t,int32_t));
|
void mouseSetCallback(void (*callback)(int32_t,int32_t));
|
||||||
void setmousepresscallback(void (*callback)(int32_t,int32_t));
|
void joySetCallback(void (*callback)(int32_t,int32_t));
|
||||||
void setjoypresscallback(void (*callback)(int32_t,int32_t));
|
const char *keyGetName(int32_t num);
|
||||||
const char *getkeyname(int32_t num);
|
const char *joyGetName(int32_t what, int32_t num); // what: 0=axis, 1=button, 2=hat
|
||||||
const char *getjoyname(int32_t what, int32_t num); // what: 0=axis, 1=button, 2=hat
|
|
||||||
|
|
||||||
char bgetchar(void);
|
char keyGetChar(void);
|
||||||
#define bkbhit() (keyasciififoplc != keyasciififoend)
|
#define keyBufferWaiting() (g_keyAsciiPos != g_keyAsciiEnd)
|
||||||
|
|
||||||
static FORCE_INLINE int keyascfifo_isfull(void)
|
static FORCE_INLINE int keyBufferFull(void)
|
||||||
{
|
{
|
||||||
return ((keyasciififoend+1)&(KEYFIFOSIZ-1)) == keyasciififoplc;
|
return ((g_keyAsciiEnd+1)&(KEYFIFOSIZ-1)) == g_keyAsciiPos;
|
||||||
}
|
}
|
||||||
|
|
||||||
static FORCE_INLINE void keyascfifo_insert(char code)
|
static FORCE_INLINE void keyBufferInsert(char code)
|
||||||
{
|
{
|
||||||
keyasciififo[keyasciififoend] = code;
|
g_keyAsciiFIFO[g_keyAsciiEnd] = code;
|
||||||
keyasciififoend = ((keyasciififoend+1)&(KEYFIFOSIZ-1));
|
g_keyAsciiEnd = ((g_keyAsciiEnd+1)&(KEYFIFOSIZ-1));
|
||||||
}
|
}
|
||||||
|
|
||||||
void bflushchars(void);
|
void keyFlushChars(void);
|
||||||
|
|
||||||
int32_t initmouse(void);
|
int32_t mouseInit(void);
|
||||||
void uninitmouse(void);
|
void mouseUninit(void);
|
||||||
void grabmouse(char a);
|
void mouseGrabInput(char a);
|
||||||
void AppGrabMouse(char a);
|
void mouseLockToWindow(char a);
|
||||||
void readmousexy(int32_t *x, int32_t *y);
|
void mouseReadPos(int32_t *x, int32_t *y);
|
||||||
int32_t readmouseabsxy(vec2_t * const destination, vec2_t const * const source);
|
int32_t mouseReadAbs(vec2_t * const destination, vec2_t const * const source);
|
||||||
void readmousebstatus(int32_t *b);
|
void mouseReadButtons(int32_t *b);
|
||||||
void readjoybstatus(int32_t *b);
|
|
||||||
void setjoydeadzone(int32_t axis, uint16_t dead, uint16_t satur);
|
void joyReadButtons(int32_t *b);
|
||||||
void getjoydeadzone(int32_t axis, uint16_t *dead, uint16_t *satur);
|
void joySetDeadZone(int32_t axis, uint16_t dead, uint16_t satur);
|
||||||
|
void joyGetDeadZone(int32_t axis, uint16_t *dead, uint16_t *satur);
|
||||||
extern int32_t inputchecked;
|
extern int32_t inputchecked;
|
||||||
|
|
||||||
int32_t inittimer(int32_t);
|
int32_t inittimer(int32_t);
|
||||||
|
|
|
@ -1054,18 +1054,7 @@ int32_t qloadkvx(int32_t voxindex, const char *filename);
|
||||||
void vox_undefine(int32_t const);
|
void vox_undefine(int32_t const);
|
||||||
intptr_t allocatepermanenttile(int16_t tilenume, int32_t xsiz, int32_t ysiz);
|
intptr_t allocatepermanenttile(int16_t tilenume, int32_t xsiz, int32_t ysiz);
|
||||||
void copytilepiece(int32_t tilenume1, int32_t sx1, int32_t sy1, int32_t xsiz, int32_t ysiz, int32_t tilenume2, int32_t sx2, int32_t sy2);
|
void copytilepiece(int32_t tilenume1, int32_t sx1, int32_t sy1, int32_t xsiz, int32_t ysiz, int32_t tilenume2, int32_t sx2, int32_t sy2);
|
||||||
void makepalookup(int32_t palnum, const char *remapbuf, uint8_t r, uint8_t g, uint8_t b, char noFloorPal);
|
|
||||||
//void setvgapalette(void);
|
|
||||||
void setbasepal(int32_t id, uint8_t const *table);
|
|
||||||
void removebasepal(int32_t id);
|
|
||||||
void setblendtab(int32_t blend, const char *tab);
|
|
||||||
void removeblendtab(int32_t blend);
|
|
||||||
int32_t setpalookup(int32_t palnum, const uint8_t *shtab);
|
|
||||||
void removepalookup(int32_t palnum);
|
|
||||||
void setbrightness(char dabrightness, uint8_t dapalid, uint8_t flags);
|
|
||||||
void setpalettefade(uint8_t r, uint8_t g, uint8_t b, uint8_t offset);
|
|
||||||
void squarerotatetile(int16_t tilenume);
|
void squarerotatetile(int16_t tilenume);
|
||||||
void fade_screen_black(int32_t moreopaquep);
|
|
||||||
|
|
||||||
int32_t setgamemode(char davidoption, int32_t daxdim, int32_t daydim, int32_t dabpp);
|
int32_t setgamemode(char davidoption, int32_t daxdim, int32_t daydim, int32_t dabpp);
|
||||||
void nextpage(void);
|
void nextpage(void);
|
||||||
|
|
|
@ -36,7 +36,19 @@ typedef struct {
|
||||||
uint8_t r, g, b;
|
uint8_t r, g, b;
|
||||||
} rgb24_t;
|
} rgb24_t;
|
||||||
extern palette_t curpalette[256], curpalettefaded[256], palfadergb;
|
extern palette_t curpalette[256], curpalettefaded[256], palfadergb;
|
||||||
|
|
||||||
extern char palfadedelta;
|
extern char palfadedelta;
|
||||||
|
extern void fullscreen_tint_gl(uint8_t r, uint8_t g, uint8_t b, uint8_t f);
|
||||||
|
extern void fade_screen_black(int32_t moreopaquep);
|
||||||
|
void makepalookup(int32_t palnum, const char *remapbuf, uint8_t r, uint8_t g, uint8_t b, char noFloorPal);
|
||||||
|
void setbasepal(int32_t id, uint8_t const *table);
|
||||||
|
void removebasepal(int32_t id);
|
||||||
|
void setblendtab(int32_t blend, const char *tab);
|
||||||
|
void removeblendtab(int32_t blend);
|
||||||
|
int32_t setpalookup(int32_t palnum, const uint8_t *shtab);
|
||||||
|
void removepalookup(int32_t palnum);
|
||||||
|
void setbrightness(char dabrightness, uint8_t dapalid, uint8_t flags);
|
||||||
|
void setpalettefade(uint8_t r, uint8_t g, uint8_t b, uint8_t offset);
|
||||||
|
|
||||||
extern int32_t realmaxshade;
|
extern int32_t realmaxshade;
|
||||||
extern float frealmaxshade;
|
extern float frealmaxshade;
|
||||||
|
|
|
@ -9,6 +9,7 @@
|
||||||
#include "polymost.h"
|
#include "polymost.h"
|
||||||
#include "cache1d.h"
|
#include "cache1d.h"
|
||||||
|
|
||||||
|
// video
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
extern "C"
|
extern "C"
|
||||||
{
|
{
|
||||||
|
@ -17,145 +18,131 @@ extern "C"
|
||||||
}
|
}
|
||||||
#endif // _WIN32
|
#endif // _WIN32
|
||||||
|
|
||||||
|
vec2_t const g_defaultVideoModes[]
|
||||||
|
= { { 2560, 1440 }, { 2560, 1200 }, { 2560, 1080 }, { 1920, 1440 }, { 1920, 1200 }, { 1920, 1080 }, { 1680, 1050 },
|
||||||
|
{ 1600, 1200 }, { 1600, 900 }, { 1366, 768 }, { 1280, 1024 }, { 1280, 960 }, { 1280, 720 }, { 1152, 864 },
|
||||||
|
{ 1024, 768 }, { 1024, 600 }, { 800, 600 }, { 640, 480 }, { 640, 400 }, { 512, 384 }, { 480, 360 },
|
||||||
|
{ 400, 300 }, { 320, 240 }, { 320, 200 }, { 0, 0 } };
|
||||||
|
|
||||||
// input
|
// input
|
||||||
char inputdevices=0;
|
char inputdevices = 0;
|
||||||
char keystatus[KEYSTATUSSIZ], keyfifo[KEYFIFOSIZ], keyasciififo[KEYFIFOSIZ];
|
|
||||||
uint8_t keyfifoplc, keyfifoend, keyasciififoplc, keyasciififoend;
|
|
||||||
char keyremap[KEYSTATUSSIZ];
|
|
||||||
int32_t keyremapinit=0;
|
|
||||||
char key_names[NUMKEYS][24];
|
|
||||||
int32_t mousex=0,mousey=0,mouseb=0;
|
|
||||||
vec2_t mouseabs;
|
|
||||||
uint8_t mousepressstate;
|
|
||||||
uint8_t moustat = 0, mousegrab = 0, mouseinwindow = 1, AppMouseGrab = 1;
|
|
||||||
|
|
||||||
int32_t mousepressstateadvance(void)
|
char keystatus[NUMKEYS];
|
||||||
{
|
char g_keyFIFO[KEYFIFOSIZ];
|
||||||
if (mousepressstate == Mouse_Pressed)
|
char g_keyAsciiFIFO[KEYFIFOSIZ];
|
||||||
{
|
uint8_t g_keyFIFOend;
|
||||||
mousepressstate = Mouse_Held;
|
uint8_t g_keyAsciiPos;
|
||||||
return 1;
|
uint8_t g_keyAsciiEnd;
|
||||||
}
|
char g_keyRemapTable[NUMKEYS];
|
||||||
else if (mousepressstate == Mouse_Released)
|
char g_keyNameTable[NUMKEYS][24];
|
||||||
{
|
|
||||||
mousepressstate = Mouse_Idle;
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
else if (mousepressstate == Mouse_Held)
|
|
||||||
return 1;
|
|
||||||
|
|
||||||
return 0;
|
void (*keypresscallback)(int32_t, int32_t);
|
||||||
}
|
|
||||||
|
|
||||||
int32_t *joyaxis = NULL, joyb=0, *joyhat = NULL;
|
void keySetCallback(void (*callback)(int32_t, int32_t)) { keypresscallback = callback; }
|
||||||
char joyisgamepad=0, joynumaxes=0, joynumbuttons=0, joynumhats=0;
|
|
||||||
int32_t joyaxespresent=0;
|
|
||||||
|
|
||||||
void(*keypresscallback)(int32_t,int32_t) = 0;
|
char const g_keyAsciiTable[128] = {
|
||||||
void(*mousepresscallback)(int32_t,int32_t) = 0;
|
0 , 0, '1', '2', '3', '4', '5', '6', '7', '8', '9', '0', '-', '=', 0, 0, 'q', 'w', 'e', 'r', 't', 'y', 'u', 'i', 'o', 'p',
|
||||||
void(*joypresscallback)(int32_t,int32_t) = 0;
|
|
||||||
|
|
||||||
extern int16_t brightness;
|
|
||||||
|
|
||||||
//
|
|
||||||
// set{key|mouse|joy}presscallback() -- sets a callback which gets notified when keys are pressed
|
|
||||||
//
|
|
||||||
void setkeypresscallback(void (*callback)(int32_t, int32_t)) { keypresscallback = callback; }
|
|
||||||
void setmousepresscallback(void (*callback)(int32_t, int32_t)) { mousepresscallback = callback; }
|
|
||||||
void setjoypresscallback(void (*callback)(int32_t, int32_t)) { joypresscallback = callback; }
|
|
||||||
|
|
||||||
char scantoasc[128] = {
|
|
||||||
0, 0, '1', '2', '3', '4', '5', '6', '7', '8', '9', '0', '-', '=', 0, 0, 'q', 'w', 'e', 'r', 't', 'y', 'u', 'i', 'o', 'p',
|
|
||||||
'[', ']', 0, 0, 'a', 's', 'd', 'f', 'g', 'h', 'j', 'k', 'l', ';', 39, '`', 0, 92, 'z', 'x', 'c', 'v', 'b', 'n', 'm', ',',
|
'[', ']', 0, 0, 'a', 's', 'd', 'f', 'g', 'h', 'j', 'k', 'l', ';', 39, '`', 0, 92, 'z', 'x', 'c', 'v', 'b', 'n', 'm', ',',
|
||||||
'.', '/', 0, '*', 0, 32, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, '7', '8', '9', '-', '4', '5', '6',
|
'.', '/', 0, '*', 0, 32, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, '7', '8', '9', '-', '4', '5', '6',
|
||||||
'+', '1', '2', '3', '0', '.', 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
'+', '1', '2', '3', '0', '.', 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
0 , 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||||
};
|
};
|
||||||
|
|
||||||
int32_t defaultres[][2]
|
int32_t keyGetState(int32_t key) { return keystatus[g_keyRemapTable[key]]; }
|
||||||
= { { 2560, 1440 }, { 2560, 1200 }, { 2560, 1080 }, { 1920, 1440 }, { 1920, 1200 }, { 1920, 1080 }, { 1680, 1050 }, { 1600, 1200 },
|
|
||||||
{ 1600, 900 }, { 1366, 768 }, { 1280, 1024 }, { 1280, 960 }, { 1280, 720 }, { 1152, 864 }, { 1024, 768 }, { 1024, 600 },
|
|
||||||
{ 800, 600 }, { 640, 480 }, { 640, 400 }, { 512, 384 }, { 480, 360 }, { 400, 300 }, { 320, 240 }, { 320, 200 },
|
|
||||||
{ 0, 0 } };
|
|
||||||
|
|
||||||
|
void keySetState(int32_t key, int32_t state)
|
||||||
int32_t GetKey(int32_t key)
|
|
||||||
{
|
{
|
||||||
return keystatus[keyremap[key]];
|
keystatus[g_keyRemapTable[key]] = state;
|
||||||
}
|
|
||||||
|
|
||||||
void SetKey(int32_t key, int32_t state)
|
|
||||||
{
|
|
||||||
keystatus[keyremap[key]] = state;
|
|
||||||
|
|
||||||
if (state)
|
if (state)
|
||||||
{
|
{
|
||||||
keyfifo[keyfifoend] = keyremap[key];
|
g_keyFIFO[g_keyFIFOend] = g_keyRemapTable[key];
|
||||||
keyfifo[(keyfifoend+1)&(KEYFIFOSIZ-1)] = state;
|
g_keyFIFO[(g_keyFIFOend+1)&(KEYFIFOSIZ-1)] = state;
|
||||||
keyfifoend = ((keyfifoend+2)&(KEYFIFOSIZ-1));
|
g_keyFIFOend = ((g_keyFIFOend+2)&(KEYFIFOSIZ-1));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// bgetchar, bflushchars -- character-based input functions
|
// character-based input functions
|
||||||
//
|
//
|
||||||
char bgetchar(void)
|
char keyGetChar(void)
|
||||||
{
|
{
|
||||||
if (keyasciififoplc == keyasciififoend)
|
if (g_keyAsciiPos == g_keyAsciiEnd)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
|
char const c = g_keyAsciiFIFO[g_keyAsciiPos];
|
||||||
|
g_keyAsciiPos = ((g_keyAsciiPos + 1) & (KEYFIFOSIZ - 1));
|
||||||
|
|
||||||
|
return c;
|
||||||
|
}
|
||||||
|
|
||||||
|
void keyFlushChars(void)
|
||||||
|
{
|
||||||
|
Bmemset(&g_keyAsciiFIFO,0,sizeof(g_keyAsciiFIFO));
|
||||||
|
g_keyAsciiPos = g_keyAsciiEnd = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
const char *keyGetName(int32_t num) { return ((unsigned)num >= NUMKEYS) ? NULL : g_keyNameTable[num]; }
|
||||||
|
|
||||||
|
vec2_t g_mousePos;
|
||||||
|
vec2_t g_mouseAbs;
|
||||||
|
int32_t g_mouseBits;
|
||||||
|
uint8_t g_mouseClickState;
|
||||||
|
|
||||||
|
bool g_mouseEnabled;
|
||||||
|
bool g_mouseGrabbed;
|
||||||
|
bool g_mouseInsideWindow = 1;
|
||||||
|
bool g_mouseLockedToWindow = 1;
|
||||||
|
|
||||||
|
void (*g_mouseCallback)(int32_t, int32_t);
|
||||||
|
void mouseSetCallback(void(*callback)(int32_t, int32_t)) { g_mouseCallback = callback; }
|
||||||
|
|
||||||
|
int32_t mouseAdvanceClickState(void)
|
||||||
|
{
|
||||||
|
switch (g_mouseClickState)
|
||||||
{
|
{
|
||||||
char c = keyasciififo[keyasciififoplc];
|
case MOUSE_PRESSED: g_mouseClickState = MOUSE_HELD; return 1;
|
||||||
keyasciififoplc = ((keyasciififoplc+1)&(KEYFIFOSIZ-1));
|
case MOUSE_RELEASED: g_mouseClickState = MOUSE_IDLE; return 1;
|
||||||
return c;
|
case MOUSE_HELD: return 1;
|
||||||
}
|
}
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void bflushchars(void)
|
void mouseReadPos(int32_t *x, int32_t *y)
|
||||||
{
|
{
|
||||||
Bmemset(&keyasciififo,0,sizeof(keyasciififo));
|
if (!g_mouseEnabled || !g_mouseGrabbed || !appactive)
|
||||||
keyasciififoplc = keyasciififoend = 0;
|
{
|
||||||
|
*x = *y = 0;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
*x = g_mousePos.x;
|
||||||
|
*y = g_mousePos.y;
|
||||||
|
g_mousePos.x = g_mousePos.y = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
const char *getkeyname(int32_t num)
|
int32_t mouseReadAbs(vec2_t * const pResult, vec2_t const * const pInput)
|
||||||
{
|
{
|
||||||
return ((unsigned)num >= 256) ? NULL : key_names[num];
|
if (!g_mouseEnabled || !appactive || !g_mouseInsideWindow || (osd && osd->flags & OSD_CAPTURE))
|
||||||
}
|
|
||||||
|
|
||||||
void readmousexy(int32_t *x, int32_t *y)
|
|
||||||
{
|
|
||||||
if (!moustat || !mousegrab || !appactive) { *x = *y = 0; return; }
|
|
||||||
*x = mousex;
|
|
||||||
*y = mousey;
|
|
||||||
mousex = mousey = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
int32_t readmouseabsxy(vec2_t * const destination, vec2_t const * const source)
|
|
||||||
{
|
|
||||||
int32_t xwidth;
|
|
||||||
|
|
||||||
if (!moustat || !appactive || !mouseinwindow || (osd && osd->flags & OSD_CAPTURE))
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
xwidth = max(scale(240<<16, xdim, ydim), 320<<16);
|
int32_t const xwidth = max(scale(240<<16, xdim, ydim), 320<<16);
|
||||||
|
|
||||||
destination->x = scale(source->x, xwidth, xdim) - ((xwidth>>1) - (320<<15));
|
pResult->x = scale(pInput->x, xwidth, xdim) - ((xwidth>>1) - (320<<15));
|
||||||
destination->y = scale(source->y, 200<<16, ydim);
|
pResult->y = scale(pInput->y, 200<<16, ydim);
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
void readmousebstatus(int32_t *b)
|
void mouseReadButtons(int32_t *pResult)
|
||||||
{
|
{
|
||||||
if (!moustat || !appactive || !mouseinwindow || (osd && osd->flags & OSD_CAPTURE)) { *b = 0; return; }
|
*pResult = (!g_mouseEnabled || !appactive || !g_mouseInsideWindow || (osd && osd->flags & OSD_CAPTURE)) ? 0 : g_mouseBits;
|
||||||
*b = mouseb;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void readjoybstatus(int32_t *b)
|
controllerinput_t joystick;
|
||||||
{
|
|
||||||
if (!appactive) { *b = 0; return; }
|
void joySetCallback(void (*callback)(int32_t, int32_t)) { joystick.pCallback = callback; }
|
||||||
*b = joyb;
|
void joyReadButtons(int32_t *pResult) { *pResult = appactive ? joystick.bits : 0; }
|
||||||
}
|
|
||||||
|
|
||||||
#if defined __linux || defined EDUKE32_BSD || defined __APPLE__
|
#if defined __linux || defined EDUKE32_BSD || defined __APPLE__
|
||||||
# include <sys/mman.h>
|
# include <sys/mman.h>
|
||||||
|
@ -259,41 +246,9 @@ void makeasmwriteable(void)
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t vsync=0;
|
int32_t vsync=0;
|
||||||
|
int32_t g_logFlushWindow = 1;
|
||||||
|
|
||||||
#ifdef USE_OPENGL
|
#ifdef USE_OPENGL
|
||||||
extern int32_t nofog;
|
|
||||||
|
|
||||||
void fullscreen_tint_gl(uint8_t r, uint8_t g, uint8_t b, uint8_t f)
|
|
||||||
{
|
|
||||||
glMatrixMode(GL_PROJECTION);
|
|
||||||
glPushMatrix();
|
|
||||||
glLoadIdentity();
|
|
||||||
glMatrixMode(GL_MODELVIEW);
|
|
||||||
glPushMatrix();
|
|
||||||
glLoadIdentity();
|
|
||||||
|
|
||||||
glDisable(GL_DEPTH_TEST);
|
|
||||||
glDisable(GL_ALPHA_TEST);
|
|
||||||
glDisable(GL_TEXTURE_2D);
|
|
||||||
polymost_setFogEnabled(false);
|
|
||||||
|
|
||||||
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
|
||||||
glEnable(GL_BLEND);
|
|
||||||
glColor4ub(r, g, b, f);
|
|
||||||
|
|
||||||
polymost_useColorOnly(true);
|
|
||||||
glBegin(GL_TRIANGLES);
|
|
||||||
glVertex2f(-2.5f, 1.f);
|
|
||||||
glVertex2f(2.5f, 1.f);
|
|
||||||
glVertex2f(.0f, -2.5f);
|
|
||||||
glEnd();
|
|
||||||
polymost_useColorOnly(false);
|
|
||||||
|
|
||||||
glPopMatrix();
|
|
||||||
glMatrixMode(GL_PROJECTION);
|
|
||||||
glPopMatrix();
|
|
||||||
}
|
|
||||||
|
|
||||||
struct glinfo_t glinfo =
|
struct glinfo_t glinfo =
|
||||||
{
|
{
|
||||||
"Unknown", // vendor
|
"Unknown", // vendor
|
||||||
|
@ -325,11 +280,7 @@ struct glinfo_t glinfo =
|
||||||
0, // Sync
|
0, // Sync
|
||||||
0, // GL info dumped
|
0, // GL info dumped
|
||||||
};
|
};
|
||||||
#endif
|
|
||||||
|
|
||||||
int32_t flushlogwindow = 1;
|
|
||||||
|
|
||||||
#ifdef USE_OPENGL
|
|
||||||
// Used to register the game's / editor's osdcmd_vidmode() functions here.
|
// Used to register the game's / editor's osdcmd_vidmode() functions here.
|
||||||
int32_t (*baselayer_osdcmd_vidmode_func)(osdfuncparm_t const * const parm);
|
int32_t (*baselayer_osdcmd_vidmode_func)(osdfuncparm_t const * const parm);
|
||||||
|
|
||||||
|
@ -393,7 +344,7 @@ static int32_t osdfunc_setrendermode(osdfuncparm_t const * const parm)
|
||||||
|
|
||||||
return OSDCMD_OK;
|
return OSDCMD_OK;
|
||||||
}
|
}
|
||||||
#if defined(USE_OPENGL)
|
|
||||||
#ifdef DEBUGGINGAIDS
|
#ifdef DEBUGGINGAIDS
|
||||||
static int32_t osdcmd_hicsetpalettetint(osdfuncparm_t const * const parm)
|
static int32_t osdcmd_hicsetpalettetint(osdfuncparm_t const * const parm)
|
||||||
{
|
{
|
||||||
|
@ -416,8 +367,6 @@ static int32_t osdcmd_hicsetpalettetint(osdfuncparm_t const * const parm)
|
||||||
|
|
||||||
int32_t osdcmd_glinfo(osdfuncparm_t const * const UNUSED(parm))
|
int32_t osdcmd_glinfo(osdfuncparm_t const * const UNUSED(parm))
|
||||||
{
|
{
|
||||||
char *s,*t,*u,i;
|
|
||||||
|
|
||||||
UNREFERENCED_CONST_PARAMETER(parm);
|
UNREFERENCED_CONST_PARAMETER(parm);
|
||||||
|
|
||||||
if (bpp == 8)
|
if (bpp == 8)
|
||||||
|
@ -432,83 +381,41 @@ int32_t osdcmd_glinfo(osdfuncparm_t const * const UNUSED(parm))
|
||||||
if (!glinfo.dumped)
|
if (!glinfo.dumped)
|
||||||
return OSDCMD_OK;
|
return OSDCMD_OK;
|
||||||
|
|
||||||
initprintf(
|
char const *s[] = { "supported", "not supported" };
|
||||||
" BGRA textures: %s\n"
|
|
||||||
" Non-power-of-2 textures: %s\n"
|
|
||||||
" Clamp-to-edge: %s\n"
|
|
||||||
" Multitexturing: %s\n"
|
|
||||||
" Frame Buffer Objects: %s\n"
|
|
||||||
#ifndef EDUKE32_GLES
|
|
||||||
" Texture compression: %s\n"
|
|
||||||
" Multisampling: %s\n"
|
|
||||||
" NVIDIA multisample hint: %s\n"
|
|
||||||
" ARBfp fragment programs: %s\n"
|
|
||||||
" Depth textures: %s\n"
|
|
||||||
" Shadow textures: %s\n"
|
|
||||||
" Rectangle textures: %s\n"
|
|
||||||
" env_combine: %s\n"
|
|
||||||
" Vertex Buffer Objects: %s\n"
|
|
||||||
" Shader Model 4: %s\n"
|
|
||||||
" Occlusion queries: %s\n"
|
|
||||||
" GLSL: %s\n"
|
|
||||||
" Debug Output: %s\n"
|
|
||||||
" Buffer Storage: %s\n"
|
|
||||||
" Sync: %s\n"
|
|
||||||
#endif
|
|
||||||
" Maximum anisotropy: %.1f%s\n"
|
|
||||||
" Extensions:\n",
|
|
||||||
glinfo.bgra ? "supported": "not supported",
|
|
||||||
glinfo.texnpot ? "supported": "not supported",
|
|
||||||
glinfo.clamptoedge ? "supported": "not supported",
|
|
||||||
glinfo.multitex ? "supported": "not supported",
|
|
||||||
glinfo.fbos ? "supported": "not supported",
|
|
||||||
#ifndef EDUKE32_GLES
|
|
||||||
glinfo.texcompr ? "supported": "not supported",
|
|
||||||
glinfo.multisample ? "supported": "not supported",
|
|
||||||
glinfo.nvmultisamplehint ? "supported": "not supported",
|
|
||||||
glinfo.arbfp ? "supported": "not supported",
|
|
||||||
glinfo.depthtex ? "supported": "not supported",
|
|
||||||
glinfo.shadow ? "supported": "not supported",
|
|
||||||
glinfo.rect ? "supported": "not supported",
|
|
||||||
glinfo.envcombine ? "supported": "not supported",
|
|
||||||
glinfo.vbos ? "supported": "not supported",
|
|
||||||
glinfo.sm4 ? "supported": "not supported",
|
|
||||||
glinfo.occlusionqueries ? "supported": "not supported",
|
|
||||||
glinfo.glsl ? "supported": "not supported",
|
|
||||||
glinfo.debugoutput ? "supported": "not supported",
|
|
||||||
glinfo.bufferstorage ? "supported" : "not supported",
|
|
||||||
glinfo.sync ? "supported" : "not supported",
|
|
||||||
#endif
|
|
||||||
glinfo.maxanisotropy, glinfo.maxanisotropy>1.0?"":" (no anisotropic filtering)"
|
|
||||||
);
|
|
||||||
|
|
||||||
s = Bstrdup(glinfo.extensions);
|
#define SUPPORTED(x) (x ? s[0] : s[1])
|
||||||
if (!s) initprintf("%s", glinfo.extensions);
|
|
||||||
else
|
initprintf(" BGRA textures: %s\n", SUPPORTED(glinfo.bgra));
|
||||||
{
|
initprintf(" Non-power-of-2 textures: %s\n", SUPPORTED(glinfo.texnpot));
|
||||||
i = 0; t = u = s;
|
initprintf(" Clamp-to-edge: %s\n", SUPPORTED(glinfo.clamptoedge));
|
||||||
while (*t)
|
initprintf(" Multi-texturing: %s\n", SUPPORTED(glinfo.multitex));
|
||||||
{
|
initprintf(" Framebuffer objects: %s\n", SUPPORTED(glinfo.fbos));
|
||||||
if (*t == ' ')
|
#ifndef EDUKE32_GLES
|
||||||
{
|
initprintf(" Texture compression: %s\n", SUPPORTED(glinfo.texcompr));
|
||||||
if (i&1)
|
initprintf(" Multi-sampling: %s\n", SUPPORTED(glinfo.multisample));
|
||||||
{
|
initprintf(" NVIDIA multisample hint: %s\n", SUPPORTED(glinfo.nvmultisamplehint));
|
||||||
*t = 0;
|
initprintf(" ARBfp fragment programs: %s\n", SUPPORTED(glinfo.arbfp));
|
||||||
initprintf(" %s\n",u);
|
initprintf(" Depth textures: %s\n", SUPPORTED(glinfo.depthtex));
|
||||||
u = t+1;
|
initprintf(" Shadow textures: %s\n", SUPPORTED(glinfo.shadow));
|
||||||
}
|
initprintf(" Rectangle textures: %s\n", SUPPORTED(glinfo.rect));
|
||||||
i++;
|
initprintf(" env_combine: %s\n", SUPPORTED(glinfo.envcombine));
|
||||||
}
|
initprintf(" Vertex buffer objects: %s\n", SUPPORTED(glinfo.vbos));
|
||||||
t++;
|
initprintf(" Shader model 4: %s\n", SUPPORTED(glinfo.sm4));
|
||||||
}
|
initprintf(" Occlusion queries: %s\n", SUPPORTED(glinfo.occlusionqueries));
|
||||||
if (i&1) initprintf(" %s\n",u);
|
initprintf(" GLSL: %s\n", SUPPORTED(glinfo.glsl));
|
||||||
Bfree(s);
|
initprintf(" Debug output: %s\n", SUPPORTED(glinfo.debugoutput));
|
||||||
}
|
initprintf(" Buffer storage: %s\n", SUPPORTED(glinfo.bufferstorage));
|
||||||
|
initprintf(" Sync: %s\n", SUPPORTED(glinfo.sync));
|
||||||
|
#endif
|
||||||
|
initprintf(" Maximum anisotropy: %.1f%s\n", glinfo.maxanisotropy, glinfo.maxanisotropy > 1.0 ? "" : " (no anisotropic filtering)");
|
||||||
|
|
||||||
|
#undef SUPPORTED
|
||||||
|
|
||||||
|
initprintf(" Extensions:\n%s", glinfo.extensions);
|
||||||
|
|
||||||
return OSDCMD_OK;
|
return OSDCMD_OK;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
#endif
|
|
||||||
|
|
||||||
static int32_t osdcmd_cvar_set_baselayer(osdfuncparm_t const * const parm)
|
static int32_t osdcmd_cvar_set_baselayer(osdfuncparm_t const * const parm)
|
||||||
{
|
{
|
||||||
|
@ -528,7 +435,6 @@ static int32_t osdcmd_cvar_set_baselayer(osdfuncparm_t const * const parm)
|
||||||
|
|
||||||
int32_t baselayer_init(void)
|
int32_t baselayer_init(void)
|
||||||
{
|
{
|
||||||
uint32_t i;
|
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
// on Windows, don't save the "r_screenaspect" cvar because the physical screen size is
|
// on Windows, don't save the "r_screenaspect" cvar because the physical screen size is
|
||||||
// determined at startup
|
// determined at startup
|
||||||
|
@ -560,7 +466,7 @@ int32_t baselayer_init(void)
|
||||||
#endif
|
#endif
|
||||||
};
|
};
|
||||||
|
|
||||||
for (i=0; i<ARRAY_SIZE(cvars_engine); i++)
|
for (native_t i=0; i<ARRAY_SIZE(cvars_engine); i++)
|
||||||
OSD_RegisterCvar(&cvars_engine[i], (cvars_engine[i].flags & CVAR_FUNCPTR) ? osdcmd_cvar_set_baselayer : osdcmd_cvar_set);
|
OSD_RegisterCvar(&cvars_engine[i], (cvars_engine[i].flags & CVAR_FUNCPTR) ? osdcmd_cvar_set_baselayer : osdcmd_cvar_set);
|
||||||
|
|
||||||
#ifdef USE_OPENGL
|
#ifdef USE_OPENGL
|
||||||
|
@ -583,6 +489,8 @@ int32_t baselayer_init(void)
|
||||||
polymost_initosdfuncs();
|
polymost_initosdfuncs();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
for (native_t i = 0; i < NUMKEYS; i++) g_keyRemapTable[i] = i;
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -592,20 +500,19 @@ void maybe_redirect_outputs(void)
|
||||||
char *argp;
|
char *argp;
|
||||||
|
|
||||||
// pipe standard outputs to files
|
// pipe standard outputs to files
|
||||||
if ((argp = Bgetenv("BUILD_LOGSTDOUT")) != NULL)
|
if ((argp = Bgetenv("BUILD_LOGSTDOUT")) == NULL || Bstrcasecmp(argp, "TRUE"))
|
||||||
if (!Bstrcasecmp(argp, "TRUE"))
|
return;
|
||||||
{
|
|
||||||
FILE *fp = freopen("stdout.txt", "w", stdout);
|
|
||||||
|
|
||||||
if (!fp)
|
FILE *fp = freopen("stdout.txt", "w", stdout);
|
||||||
fp = fopen("stdout.txt", "w");
|
|
||||||
|
|
||||||
if (fp)
|
if (!fp)
|
||||||
{
|
fp = fopen("stdout.txt", "w");
|
||||||
setvbuf(fp, 0, _IONBF, 0);
|
|
||||||
*stdout = *fp;
|
if (fp)
|
||||||
*stderr = *fp;
|
{
|
||||||
}
|
setvbuf(fp, 0, _IONBF, 0);
|
||||||
}
|
*stdout = *fp;
|
||||||
|
*stderr = *fp;
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
|
@ -563,7 +563,7 @@ void M32_DrawRoomsAndMasks(void)
|
||||||
|
|
||||||
void M32_OnShowOSD(int32_t shown)
|
void M32_OnShowOSD(int32_t shown)
|
||||||
{
|
{
|
||||||
AppGrabMouse((!shown) + 2);
|
mouseLockToWindow((!shown) + 2);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void M32_FatalEngineError(void)
|
static void M32_FatalEngineError(void)
|
||||||
|
@ -672,7 +672,7 @@ int app_main(int argc, char const * const * argv)
|
||||||
|
|
||||||
if (initinput()) return -1;
|
if (initinput()) return -1;
|
||||||
|
|
||||||
initmouse();
|
mouseInit();
|
||||||
|
|
||||||
inittimer(TIMERINTSPERSECOND);
|
inittimer(TIMERINTSPERSECOND);
|
||||||
installusertimercallback(keytimerstuff);
|
installusertimercallback(keytimerstuff);
|
||||||
|
@ -756,7 +756,7 @@ int app_main(int argc, char const * const * argv)
|
||||||
|
|
||||||
updatesector(pos.x,pos.y,&cursectnum);
|
updatesector(pos.x,pos.y,&cursectnum);
|
||||||
|
|
||||||
setkeypresscallback(&m32_keypresscallback);
|
keySetCallback(&m32_keypresscallback);
|
||||||
M32_OnShowOSD(0); // make sure the desktop's mouse cursor is hidden
|
M32_OnShowOSD(0); // make sure the desktop's mouse cursor is hidden
|
||||||
|
|
||||||
if (cursectnum == -1)
|
if (cursectnum == -1)
|
||||||
|
@ -4283,7 +4283,7 @@ rotate_hlsect_out:
|
||||||
if (!smoothRotation || manualAngle)
|
if (!smoothRotation || manualAngle)
|
||||||
keystatus[0x33] = keystatus[0x34] = 0;
|
keystatus[0x33] = keystatus[0x34] = 0;
|
||||||
|
|
||||||
mouseb &= ~(16|32);
|
g_mouseBits &= ~(16|32);
|
||||||
bstatus &= ~(16|32);
|
bstatus &= ~(16|32);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -4299,7 +4299,7 @@ rotate_hlsect_out:
|
||||||
keystatus[0x33] = keystatus[0x34] = 0;
|
keystatus[0x33] = keystatus[0x34] = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
mouseb &= ~(16|32);
|
g_mouseBits &= ~(16|32);
|
||||||
bstatus &= ~(16|32);
|
bstatus &= ~(16|32);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -5918,7 +5918,7 @@ end_point_dragging:
|
||||||
if (circlepoints > 1)
|
if (circlepoints > 1)
|
||||||
circlepoints--;
|
circlepoints--;
|
||||||
keystatus[0x4a] = 0;
|
keystatus[0x4a] = 0;
|
||||||
mouseb &= ~32;
|
g_mouseBits &= ~32;
|
||||||
bstatus &= ~32;
|
bstatus &= ~32;
|
||||||
}
|
}
|
||||||
if (circlewall != -1 && (keystatus[0x4e] || ((bstatus&16) && !eitherCTRL))) // +, mousewheel up
|
if (circlewall != -1 && (keystatus[0x4e] || ((bstatus&16) && !eitherCTRL))) // +, mousewheel up
|
||||||
|
@ -5926,7 +5926,7 @@ end_point_dragging:
|
||||||
if (circlepoints < 63)
|
if (circlepoints < 63)
|
||||||
circlepoints++;
|
circlepoints++;
|
||||||
keystatus[0x4e] = 0;
|
keystatus[0x4e] = 0;
|
||||||
mouseb &= ~16;
|
g_mouseBits &= ~16;
|
||||||
bstatus &= ~16;
|
bstatus &= ~16;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -7976,7 +7976,7 @@ CANCEL:
|
||||||
printext16(16*8, ydim-STATUS2DSIZ2-12, editorcolors[15], -1, GetSaveBoardFilename(NULL), 0);
|
printext16(16*8, ydim-STATUS2DSIZ2-12, editorcolors[15], -1, GetSaveBoardFilename(NULL), 0);
|
||||||
|
|
||||||
showframe(1);
|
showframe(1);
|
||||||
bflushchars();
|
keyFlushChars();
|
||||||
bad = 1;
|
bad = 1;
|
||||||
while (bad == 1)
|
while (bad == 1)
|
||||||
{
|
{
|
||||||
|
@ -7989,7 +7989,7 @@ CANCEL:
|
||||||
}
|
}
|
||||||
idle();
|
idle();
|
||||||
|
|
||||||
ch = bgetchar();
|
ch = keyGetChar();
|
||||||
|
|
||||||
if (keystatus[1])
|
if (keystatus[1])
|
||||||
{
|
{
|
||||||
|
@ -8114,7 +8114,7 @@ CANCEL:
|
||||||
i -= 4;
|
i -= 4;
|
||||||
boardfilename[i] = 0;
|
boardfilename[i] = 0;
|
||||||
|
|
||||||
bflushchars();
|
keyFlushChars();
|
||||||
while (bad == 0)
|
while (bad == 0)
|
||||||
{
|
{
|
||||||
_printmessage16("%sSave as: ^011%s%s", corrupt>=4?"(map corrupt) ":"",
|
_printmessage16("%sSave as: ^011%s%s", corrupt>=4?"(map corrupt) ":"",
|
||||||
|
@ -8126,7 +8126,7 @@ CANCEL:
|
||||||
|
|
||||||
idle();
|
idle();
|
||||||
|
|
||||||
ch = bgetchar();
|
ch = keyGetChar();
|
||||||
|
|
||||||
if (keystatus[1]) bad = 1;
|
if (keystatus[1]) bad = 1;
|
||||||
else if (ch == 13) bad = 2;
|
else if (ch == 13) bad = 2;
|
||||||
|
@ -8293,7 +8293,7 @@ int32_t ask_if_sure(const char *query, uint32_t flags)
|
||||||
else
|
else
|
||||||
_printmessage16("%s", query);
|
_printmessage16("%s", query);
|
||||||
showframe(1);
|
showframe(1);
|
||||||
bflushchars();
|
keyFlushChars();
|
||||||
|
|
||||||
while ((keystatus[1]|keystatus[0x2e]) == 0 && ret==-1)
|
while ((keystatus[1]|keystatus[0x2e]) == 0 && ret==-1)
|
||||||
{
|
{
|
||||||
|
@ -8309,7 +8309,7 @@ int32_t ask_if_sure(const char *query, uint32_t flags)
|
||||||
}
|
}
|
||||||
idle();
|
idle();
|
||||||
|
|
||||||
ch = bgetchar();
|
ch = keyGetChar();
|
||||||
|
|
||||||
if (ch == 'y' || ch == 'Y')
|
if (ch == 'y' || ch == 'Y')
|
||||||
ret = 1;
|
ret = 1;
|
||||||
|
@ -8334,7 +8334,7 @@ int32_t editor_ask_function(const char *question, const char *dachars, int32_t n
|
||||||
_printmessage16("%s", question);
|
_printmessage16("%s", question);
|
||||||
|
|
||||||
showframe(1);
|
showframe(1);
|
||||||
bflushchars();
|
keyFlushChars();
|
||||||
|
|
||||||
// 'c' is cancel too, but can be overridden
|
// 'c' is cancel too, but can be overridden
|
||||||
while ((keystatus[1]|keystatus[0x2e]) == 0 && ret==-1)
|
while ((keystatus[1]|keystatus[0x2e]) == 0 && ret==-1)
|
||||||
|
@ -8343,7 +8343,7 @@ int32_t editor_ask_function(const char *question, const char *dachars, int32_t n
|
||||||
quitevent = 0;
|
quitevent = 0;
|
||||||
|
|
||||||
idle();
|
idle();
|
||||||
ch = bgetchar();
|
ch = keyGetChar();
|
||||||
|
|
||||||
for (i=0; i<numchars; i++)
|
for (i=0; i<numchars; i++)
|
||||||
if (ch==Btolower(dachars[i]) || ch==Btoupper(dachars[i]))
|
if (ch==Btolower(dachars[i]) || ch==Btoupper(dachars[i]))
|
||||||
|
@ -8549,7 +8549,7 @@ static int32_t getlinehighlight(int32_t xplc, int32_t yplc, int32_t line, int8_t
|
||||||
if (numwalls == 0)
|
if (numwalls == 0)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
if (mouseb & 1 || searchlock)
|
if (g_mouseBits & 1 || searchlock)
|
||||||
return line;
|
return line;
|
||||||
|
|
||||||
if (!ignore_pointhighlight && (pointhighlight&0xc000) == 16384)
|
if (!ignore_pointhighlight && (pointhighlight&0xc000) == 16384)
|
||||||
|
@ -8624,7 +8624,7 @@ int32_t getpointhighlight(int32_t xplc, int32_t yplc, int32_t point)
|
||||||
if (numwalls == 0)
|
if (numwalls == 0)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
if (mouseb & 1 || searchlock)
|
if (g_mouseBits & 1 || searchlock)
|
||||||
return point;
|
return point;
|
||||||
|
|
||||||
if (grid < 1)
|
if (grid < 1)
|
||||||
|
@ -9316,14 +9316,14 @@ int32_t _getnumber16(const char *namestart, int32_t num, int32_t maxnumber, char
|
||||||
// ("^011", max. string length of an int32, "_ ")
|
// ("^011", max. string length of an int32, "_ ")
|
||||||
Bstrncpyz(ournamestart, namestart, sizeof(ournamestart));
|
Bstrncpyz(ournamestart, namestart, sizeof(ournamestart));
|
||||||
|
|
||||||
bflushchars();
|
keyFlushChars();
|
||||||
while (keystatus[0x1] == 0)
|
while (keystatus[0x1] == 0)
|
||||||
{
|
{
|
||||||
if (handleevents())
|
if (handleevents())
|
||||||
quitevent = 0;
|
quitevent = 0;
|
||||||
|
|
||||||
idle();
|
idle();
|
||||||
ch = bgetchar();
|
ch = keyGetChar();
|
||||||
|
|
||||||
Bsprintf(buffer, "%s^011%d", ournamestart, danum);
|
Bsprintf(buffer, "%s^011%d", ournamestart, danum);
|
||||||
n = Bstrlen(buffer); // maximum is 62+4+11 == 77
|
n = Bstrlen(buffer); // maximum is 62+4+11 == 77
|
||||||
|
@ -9387,7 +9387,7 @@ int32_t _getnumber256(const char *namestart, int32_t num, int32_t maxnumber, cha
|
||||||
// (max. string length of an int32, "_ ")
|
// (max. string length of an int32, "_ ")
|
||||||
Bstrncpyz(ournamestart, namestart, sizeof(ournamestart));
|
Bstrncpyz(ournamestart, namestart, sizeof(ournamestart));
|
||||||
|
|
||||||
bflushchars();
|
keyFlushChars();
|
||||||
while (keystatus[0x1] == 0)
|
while (keystatus[0x1] == 0)
|
||||||
{
|
{
|
||||||
if (handleevents())
|
if (handleevents())
|
||||||
|
@ -9396,12 +9396,12 @@ int32_t _getnumber256(const char *namestart, int32_t num, int32_t maxnumber, cha
|
||||||
if ((flags&8)==0)
|
if ((flags&8)==0)
|
||||||
M32_DrawRoomsAndMasks();
|
M32_DrawRoomsAndMasks();
|
||||||
|
|
||||||
ch = bgetchar();
|
ch = keyGetChar();
|
||||||
if (keystatus[0x1])
|
if (keystatus[0x1])
|
||||||
break;
|
break;
|
||||||
clearkeys();
|
clearkeys();
|
||||||
|
|
||||||
mouseb = 0;
|
g_mouseBits = 0;
|
||||||
searchx = osearchx;
|
searchx = osearchx;
|
||||||
searchy = osearchy;
|
searchy = osearchy;
|
||||||
|
|
||||||
|
@ -9457,7 +9457,7 @@ const char *getstring_simple(const char *querystr, const char *defaultstr, int32
|
||||||
int32_t ei=0, qrylen=0, maxidx, havecompl=0;
|
int32_t ei=0, qrylen=0, maxidx, havecompl=0;
|
||||||
char ch;
|
char ch;
|
||||||
|
|
||||||
bflushchars();
|
keyFlushChars();
|
||||||
clearkeys();
|
clearkeys();
|
||||||
|
|
||||||
Bmemset(buf, 0, sizeof(buf));
|
Bmemset(buf, 0, sizeof(buf));
|
||||||
|
@ -9498,7 +9498,7 @@ const char *getstring_simple(const char *querystr, const char *defaultstr, int32
|
||||||
quitevent = 0;
|
quitevent = 0;
|
||||||
|
|
||||||
idle();
|
idle();
|
||||||
ch = bgetchar();
|
ch = keyGetChar();
|
||||||
|
|
||||||
if (ch==13)
|
if (ch==13)
|
||||||
{
|
{
|
||||||
|
@ -9818,7 +9818,7 @@ static int32_t menuselect(void)
|
||||||
|
|
||||||
idle();
|
idle();
|
||||||
|
|
||||||
ch = bgetchar();
|
ch = keyGetChar();
|
||||||
|
|
||||||
{
|
{
|
||||||
// JBF 20040208: seek to first name matching pressed character
|
// JBF 20040208: seek to first name matching pressed character
|
||||||
|
@ -10998,7 +10998,7 @@ void test_map(int32_t mode)
|
||||||
OSD_Printf("...as `%s'\n", fullparam);
|
OSD_Printf("...as `%s'\n", fullparam);
|
||||||
|
|
||||||
showframe(1);
|
showframe(1);
|
||||||
uninitmouse();
|
mouseUninit();
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
{
|
{
|
||||||
STARTUPINFO si;
|
STARTUPINFO si;
|
||||||
|
@ -11023,7 +11023,7 @@ void test_map(int32_t mode)
|
||||||
else system(fullparam);
|
else system(fullparam);
|
||||||
#endif
|
#endif
|
||||||
printmessage16("Game process exited");
|
printmessage16("Game process exited");
|
||||||
initmouse();
|
mouseInit();
|
||||||
clearkeys();
|
clearkeys();
|
||||||
|
|
||||||
Bfree(fullparam);
|
Bfree(fullparam);
|
||||||
|
|
|
@ -258,10 +258,6 @@ int32_t loadsetup(const char *fn)
|
||||||
|
|
||||||
if (readconfig(fp, "osdtryscript", val, VL) > 0) m32_osd_tryscript = !!atoi_safe(val);
|
if (readconfig(fp, "osdtryscript", val, VL) > 0) m32_osd_tryscript = !!atoi_safe(val);
|
||||||
|
|
||||||
for (i=0; i<256; i++)
|
|
||||||
keyremap[i]=i;
|
|
||||||
|
|
||||||
keyremapinit=1;
|
|
||||||
if (readconfig(fp, "remap", val, VL) > 0)
|
if (readconfig(fp, "remap", val, VL) > 0)
|
||||||
{
|
{
|
||||||
char *p=val; int32_t v1,v2;
|
char *p=val; int32_t v1,v2;
|
||||||
|
@ -271,7 +267,7 @@ int32_t loadsetup(const char *fn)
|
||||||
if ((p=strchr(p,'-'))==0)break;
|
if ((p=strchr(p,'-'))==0)break;
|
||||||
p++;
|
p++;
|
||||||
if (!sscanf(p,"%x",&v2))break;
|
if (!sscanf(p,"%x",&v2))break;
|
||||||
keyremap[v1]=v2;
|
g_keyRemapTable[v1]=v2;
|
||||||
initprintf("Remap %X key to %X\n",v1,v2);
|
initprintf("Remap %X key to %X\n",v1,v2);
|
||||||
if ((p=strchr(p,','))==0)break;
|
if ((p=strchr(p,','))==0)break;
|
||||||
p++;
|
p++;
|
||||||
|
@ -673,9 +669,9 @@ int32_t writesetup(const char *fn)
|
||||||
);
|
);
|
||||||
|
|
||||||
for (i=0; i<256; i++)
|
for (i=0; i<256; i++)
|
||||||
if (keyremap[i]!=i)
|
if (g_keyRemapTable[i]!=i)
|
||||||
{
|
{
|
||||||
Bfprintf(fp,first?"%02X-%02X":",%02X-%02X",i,keyremap[i]);
|
Bfprintf(fp,first?"%02X-%02X":",%02X-%02X",i,g_keyRemapTable[i]);
|
||||||
first=0;
|
first=0;
|
||||||
}
|
}
|
||||||
Bfprintf(fp,"\n\n");
|
Bfprintf(fp,"\n\n");
|
||||||
|
|
|
@ -155,9 +155,9 @@ static void defsparser_include(const char *fn, const scriptfile *script, const c
|
||||||
{
|
{
|
||||||
if (!cmdtokptr)
|
if (!cmdtokptr)
|
||||||
{
|
{
|
||||||
flushlogwindow = 1;
|
g_logFlushWindow = 1;
|
||||||
initprintf("Loading module \"%s\"\n",fn);
|
initprintf("Loading module \"%s\"\n",fn);
|
||||||
flushlogwindow = 0;
|
g_logFlushWindow = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
defsparser(included);
|
defsparser(included);
|
||||||
|
@ -410,9 +410,9 @@ static int32_t defsparser(scriptfile *script)
|
||||||
#ifdef USE_DEF_PROGRESS
|
#ifdef USE_DEF_PROGRESS
|
||||||
if (++iter >= 50)
|
if (++iter >= 50)
|
||||||
{
|
{
|
||||||
flushlogwindow = 1;
|
g_logFlushWindow = 1;
|
||||||
initprintf(".");
|
initprintf(".");
|
||||||
flushlogwindow = 0;
|
g_logFlushWindow = 0;
|
||||||
iter = 0;
|
iter = 0;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
@ -3633,15 +3633,15 @@ static int32_t defsparser(scriptfile *script)
|
||||||
int32_t loaddefinitionsfile(const char *fn)
|
int32_t loaddefinitionsfile(const char *fn)
|
||||||
{
|
{
|
||||||
scriptfile *script;
|
scriptfile *script;
|
||||||
int32_t f = flushlogwindow;
|
int32_t f = g_logFlushWindow;
|
||||||
|
|
||||||
script = scriptfile_fromfile(fn);
|
script = scriptfile_fromfile(fn);
|
||||||
|
|
||||||
if (script)
|
if (script)
|
||||||
{
|
{
|
||||||
flushlogwindow = 1;
|
g_logFlushWindow = 1;
|
||||||
initprintf("Loading \"%s\"\n",fn);
|
initprintf("Loading \"%s\"\n",fn);
|
||||||
flushlogwindow = 0;
|
g_logFlushWindow = 0;
|
||||||
|
|
||||||
defsparser(script);
|
defsparser(script);
|
||||||
}
|
}
|
||||||
|
@ -3649,7 +3649,7 @@ int32_t loaddefinitionsfile(const char *fn)
|
||||||
for (char const * m : g_defModules)
|
for (char const * m : g_defModules)
|
||||||
defsparser_include(m, NULL, NULL);
|
defsparser_include(m, NULL, NULL);
|
||||||
|
|
||||||
flushlogwindow = f;
|
g_logFlushWindow = f;
|
||||||
|
|
||||||
if (script)
|
if (script)
|
||||||
scriptfile_close(script);
|
scriptfile_close(script);
|
||||||
|
|
|
@ -11514,8 +11514,8 @@ void rotatepoint(vec2_t const pivot, vec2_t p, int16_t daang, vec2_t *p2)
|
||||||
|
|
||||||
void getmousevalues(int32_t *mousx, int32_t *mousy, int32_t *bstatus)
|
void getmousevalues(int32_t *mousx, int32_t *mousy, int32_t *bstatus)
|
||||||
{
|
{
|
||||||
readmousexy(mousx,mousy);
|
mouseReadPos(mousx,mousy);
|
||||||
readmousebstatus(bstatus);
|
mouseReadButtons(bstatus);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1439,13 +1439,10 @@ void OSD_CaptureInput(int32_t cap)
|
||||||
{
|
{
|
||||||
osd->flags = (osd->flags & ~(OSD_CAPTURE|OSD_CTRL|OSD_SHIFT)) | (-cap & OSD_CAPTURE);
|
osd->flags = (osd->flags & ~(OSD_CAPTURE|OSD_CTRL|OSD_SHIFT)) | (-cap & OSD_CAPTURE);
|
||||||
|
|
||||||
grabmouse(cap == 0 ? AppMouseGrab : 0);
|
mouseGrabInput(cap == 0 ? g_mouseLockedToWindow : 0);
|
||||||
onshowosd(cap);
|
onshowosd(cap);
|
||||||
|
|
||||||
if (cap)
|
keyFlushChars();
|
||||||
releaseallbuttons();
|
|
||||||
|
|
||||||
bflushchars();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -36,6 +36,39 @@ int32_t curbrightness = 0, gammabrightness = 0;
|
||||||
|
|
||||||
static void setpalettefade_calc(uint8_t offset);
|
static void setpalettefade_calc(uint8_t offset);
|
||||||
|
|
||||||
|
#ifdef USE_OPENGL
|
||||||
|
void fullscreen_tint_gl(uint8_t r, uint8_t g, uint8_t b, uint8_t f)
|
||||||
|
{
|
||||||
|
glMatrixMode(GL_PROJECTION);
|
||||||
|
glPushMatrix();
|
||||||
|
glLoadIdentity();
|
||||||
|
glMatrixMode(GL_MODELVIEW);
|
||||||
|
glPushMatrix();
|
||||||
|
glLoadIdentity();
|
||||||
|
|
||||||
|
glDisable(GL_DEPTH_TEST);
|
||||||
|
glDisable(GL_ALPHA_TEST);
|
||||||
|
glDisable(GL_TEXTURE_2D);
|
||||||
|
polymost_setFogEnabled(false);
|
||||||
|
|
||||||
|
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
||||||
|
glEnable(GL_BLEND);
|
||||||
|
glColor4ub(r, g, b, f);
|
||||||
|
|
||||||
|
polymost_useColorOnly(true);
|
||||||
|
glBegin(GL_TRIANGLES);
|
||||||
|
glVertex2f(-2.5f, 1.f);
|
||||||
|
glVertex2f(2.5f, 1.f);
|
||||||
|
glVertex2f(.0f, -2.5f);
|
||||||
|
glEnd();
|
||||||
|
polymost_useColorOnly(false);
|
||||||
|
|
||||||
|
glPopMatrix();
|
||||||
|
glMatrixMode(GL_PROJECTION);
|
||||||
|
glPopMatrix();
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
void fade_screen_black(int32_t moreopaquep)
|
void fade_screen_black(int32_t moreopaquep)
|
||||||
{
|
{
|
||||||
#ifdef USE_OPENGL
|
#ifdef USE_OPENGL
|
||||||
|
|
|
@ -10,8 +10,8 @@
|
||||||
static BOOL rawinput_started = 0;
|
static BOOL rawinput_started = 0;
|
||||||
static uint8_t KeyboardState[256] = {0}; // VKeys
|
static uint8_t KeyboardState[256] = {0}; // VKeys
|
||||||
|
|
||||||
extern uint8_t moustat, mousegrab;
|
extern uint8_t g_mouseEnabled, g_mouseGrabbed;
|
||||||
extern void SetKey(int32_t key, int32_t state);
|
extern void keySetState(int32_t key, int32_t state);
|
||||||
|
|
||||||
//#define MASK_DOWN (1<<(i<<1))
|
//#define MASK_DOWN (1<<(i<<1))
|
||||||
//#define MASK_UP (MASK_DOWN<<1)
|
//#define MASK_UP (MASK_DOWN<<1)
|
||||||
|
@ -24,11 +24,11 @@ static inline void RI_ProcessMouse(const RAWMOUSE *rmouse)
|
||||||
int32_t i, mask;
|
int32_t i, mask;
|
||||||
int8_t MWheel = 0;
|
int8_t MWheel = 0;
|
||||||
|
|
||||||
if (!mousegrab || !appactive)
|
if (!g_mouseGrabbed || !appactive)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
mousex += rmouse->lLastX;
|
g_mousePos.x += rmouse->lLastX;
|
||||||
mousey += rmouse->lLastY;
|
g_mousePos.y += rmouse->lLastY;
|
||||||
|
|
||||||
if (rmouse->usFlags & MOUSE_MOVE_ABSOLUTE)
|
if (rmouse->usFlags & MOUSE_MOVE_ABSOLUTE)
|
||||||
{
|
{
|
||||||
|
@ -37,8 +37,8 @@ static inline void RI_ProcessMouse(const RAWMOUSE *rmouse)
|
||||||
|
|
||||||
ClientToScreen((HWND)win_gethwnd(), &pos);
|
ClientToScreen((HWND)win_gethwnd(), &pos);
|
||||||
|
|
||||||
mousex -= pos.x;
|
g_mousePos.x -= pos.x;
|
||||||
mousey -= pos.y;
|
g_mousePos.y -= pos.y;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (i = 0, mask = (1<<0); mask <= (1<<8); i++, mask<<=2)
|
for (i = 0, mask = (1<<0); mask <= (1<<8); i++, mask<<=2)
|
||||||
|
@ -56,15 +56,15 @@ static inline void RI_ProcessMouse(const RAWMOUSE *rmouse)
|
||||||
|
|
||||||
if (rmouse->usButtonFlags & mask) // button down
|
if (rmouse->usButtonFlags & mask) // button down
|
||||||
{
|
{
|
||||||
if (mousepresscallback)
|
if (g_mouseCallback)
|
||||||
mousepresscallback(i+1, 1);
|
g_mouseCallback(i+1, 1);
|
||||||
mouseb |= 1<<i;
|
g_mouseBits |= 1<<i;
|
||||||
}
|
}
|
||||||
else if (rmouse->usButtonFlags & (mask<<1)) // button up
|
else if (rmouse->usButtonFlags & (mask<<1)) // button up
|
||||||
{
|
{
|
||||||
if (mousepresscallback)
|
if (g_mouseCallback)
|
||||||
mousepresscallback(i+1, 0);
|
g_mouseCallback(i+1, 0);
|
||||||
mouseb &= ~(1<<i);
|
g_mouseBits &= ~(1<<i);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -72,13 +72,13 @@ static inline void RI_ProcessMouse(const RAWMOUSE *rmouse)
|
||||||
|
|
||||||
if (MWheel > 0) // wheel up
|
if (MWheel > 0) // wheel up
|
||||||
{
|
{
|
||||||
mouseb |= 16;
|
g_mouseBits |= 16;
|
||||||
if (mousepresscallback) mousepresscallback(5, 1);
|
if (g_mouseCallback) g_mouseCallback(5, 1);
|
||||||
}
|
}
|
||||||
else if (MWheel < 0) // wheel down
|
else if (MWheel < 0) // wheel down
|
||||||
{
|
{
|
||||||
mouseb |= 32;
|
g_mouseBits |= 32;
|
||||||
if (mousepresscallback) mousepresscallback(6, 1);
|
if (g_mouseCallback) g_mouseCallback(6, 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -166,7 +166,7 @@ static inline void RI_ProcessKeyboard(const RAWKEYBOARD *rkbd)
|
||||||
if (rkbd->Flags & RI_KEY_BREAK)
|
if (rkbd->Flags & RI_KEY_BREAK)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
SetKey(sc_Pause, 1);
|
keySetState(sc_Pause, 1);
|
||||||
|
|
||||||
if (keypresscallback)
|
if (keypresscallback)
|
||||||
keypresscallback(sc_Pause, 1);
|
keypresscallback(sc_Pause, 1);
|
||||||
|
@ -178,25 +178,25 @@ static inline void RI_ProcessKeyboard(const RAWKEYBOARD *rkbd)
|
||||||
|
|
||||||
if (OSD_HandleScanCode(key, KeyboardState[VKey] > 0))
|
if (OSD_HandleScanCode(key, KeyboardState[VKey] > 0))
|
||||||
{
|
{
|
||||||
SetKey(key, KeyboardState[VKey] != 0);
|
keySetState(key, KeyboardState[VKey] != 0);
|
||||||
|
|
||||||
if (keypresscallback)
|
if (keypresscallback)
|
||||||
keypresscallback(key, KeyboardState[VKey] != 0);
|
keypresscallback(key, KeyboardState[VKey] != 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (rkbd->Flags & RI_KEY_BREAK) return;
|
if (rkbd->Flags & RI_KEY_BREAK) return;
|
||||||
if (((keyasciififoend+1)&(KEYFIFOSIZ-1)) == keyasciififoplc) return;
|
if (((g_keyAsciiEnd+1)&(KEYFIFOSIZ-1)) == g_keyAsciiPos) return;
|
||||||
if ((keyasciififoend - keyasciififoplc) > 0) return;
|
if ((g_keyAsciiEnd - g_keyAsciiPos) > 0) return;
|
||||||
|
|
||||||
{
|
{
|
||||||
uint8_t buf[2];
|
uint8_t buf[2];
|
||||||
|
|
||||||
if (ToAscii(VKey, key, &KeyboardState[0], (LPWORD)&buf[0], 0) != 1) return;
|
if (ToAscii(VKey, key, &KeyboardState[0], (LPWORD)&buf[0], 0) != 1) return;
|
||||||
if ((OSD_OSDKey() < 128) && (Btolower(scantoasc[OSD_OSDKey()]) == Btolower(buf[0]))) return;
|
if ((OSD_OSDKey() < 128) && (Btolower(g_keyAsciiTable[OSD_OSDKey()]) == Btolower(buf[0]))) return;
|
||||||
if (OSD_HandleChar(buf[0]) == 0) return;
|
if (OSD_HandleChar(buf[0]) == 0) return;
|
||||||
|
|
||||||
keyasciififo[keyasciififoend] = buf[0];
|
g_keyAsciiFIFO[g_keyAsciiEnd] = buf[0];
|
||||||
keyasciififoend = ((keyasciififoend+1)&(KEYFIFOSIZ-1));
|
g_keyAsciiEnd = ((g_keyAsciiEnd+1)&(KEYFIFOSIZ-1));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -215,7 +215,7 @@ BOOL RI_CaptureInput(BOOL grab, HWND target)
|
||||||
raw[1].dwFlags = 0;
|
raw[1].dwFlags = 0;
|
||||||
raw[1].hwndTarget = target;
|
raw[1].hwndTarget = target;
|
||||||
|
|
||||||
mousegrab = grab;
|
g_mouseGrabbed = grab;
|
||||||
|
|
||||||
return (RegisterRawInputDevices(raw, 2, sizeof(raw[0])) == FALSE);
|
return (RegisterRawInputDevices(raw, 2, sizeof(raw[0])) == FALSE);
|
||||||
}
|
}
|
||||||
|
@ -252,14 +252,14 @@ void RI_PollDevices(BOOL loop)
|
||||||
|
|
||||||
if (inputchecked)
|
if (inputchecked)
|
||||||
{
|
{
|
||||||
if (mousepresscallback)
|
if (g_mouseCallback)
|
||||||
{
|
{
|
||||||
if (mouseb & 16)
|
if (g_mouseBits & 16)
|
||||||
mousepresscallback(5, 0);
|
g_mouseCallback(5, 0);
|
||||||
if (mouseb & 32)
|
if (g_mouseBits & 32)
|
||||||
mousepresscallback(6, 0);
|
g_mouseCallback(6, 0);
|
||||||
}
|
}
|
||||||
mouseb &= ~(16|32);
|
g_mouseBits &= ~(16|32);
|
||||||
}
|
}
|
||||||
|
|
||||||
// snapshot the whole keyboard state so we can translate key presses into ascii later
|
// snapshot the whole keyboard state so we can translate key presses into ascii later
|
||||||
|
@ -269,7 +269,7 @@ void RI_PollDevices(BOOL loop)
|
||||||
while (loop && PeekMessage(&msg, 0, WM_INPUT, WM_INPUT, PM_REMOVE | PM_QS_INPUT))
|
while (loop && PeekMessage(&msg, 0, WM_INPUT, WM_INPUT, PM_REMOVE | PM_QS_INPUT))
|
||||||
RI_ProcessMessage(&msg);
|
RI_ProcessMessage(&msg);
|
||||||
|
|
||||||
if (mousegrab && appactive)
|
if (g_mouseGrabbed && appactive)
|
||||||
{
|
{
|
||||||
// center the cursor in the window
|
// center the cursor in the window
|
||||||
POINT pt = { xdim>>1, ydim>>1 };
|
POINT pt = { xdim>>1, ydim>>1 };
|
||||||
|
@ -279,27 +279,27 @@ void RI_PollDevices(BOOL loop)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t initmouse(void)
|
int32_t mouseInit(void)
|
||||||
{
|
{
|
||||||
if (moustat) return 0;
|
if (g_mouseEnabled) return 0;
|
||||||
grabmouse(moustat = AppMouseGrab);
|
mouseGrabInput(g_mouseEnabled = g_mouseLockedToWindow);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void uninitmouse(void)
|
void mouseUninit(void)
|
||||||
{
|
{
|
||||||
if (!moustat) return;
|
if (!g_mouseEnabled) return;
|
||||||
grabmouse(moustat = 0);
|
mouseGrabInput(g_mouseEnabled = 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
void grabmouse(char a)
|
void mouseGrabInput(char a)
|
||||||
{
|
{
|
||||||
static POINT pos;
|
static POINT pos;
|
||||||
static int32_t d = 0;
|
static int32_t d = 0;
|
||||||
|
|
||||||
if (!moustat) return;
|
if (!g_mouseEnabled) return;
|
||||||
|
|
||||||
if (!mousegrab || !d)
|
if (!g_mouseGrabbed || !d)
|
||||||
{
|
{
|
||||||
GetCursorPos(&pos);
|
GetCursorPos(&pos);
|
||||||
d++;
|
d++;
|
||||||
|
@ -310,7 +310,7 @@ void grabmouse(char a)
|
||||||
SetCursorPos(pos.x, pos.y);
|
SetCursorPos(pos.x, pos.y);
|
||||||
}
|
}
|
||||||
|
|
||||||
void AppGrabMouse(char a)
|
void mouseLockToWindow(char a)
|
||||||
{
|
{
|
||||||
UNREFERENCED_PARAMETER(a);
|
UNREFERENCED_PARAMETER(a);
|
||||||
}
|
}
|
||||||
|
|
|
@ -732,7 +732,7 @@ void initputs(const char *buf)
|
||||||
|
|
||||||
Bstrcat(dabuf,buf);
|
Bstrcat(dabuf,buf);
|
||||||
|
|
||||||
if (flushlogwindow || Bstrlen(dabuf) > 768)
|
if (g_logFlushWindow || Bstrlen(dabuf) > 768)
|
||||||
{
|
{
|
||||||
startwin_puts(dabuf);
|
startwin_puts(dabuf);
|
||||||
#ifndef _WIN32
|
#ifndef _WIN32
|
||||||
|
@ -794,14 +794,10 @@ int32_t initinput(void)
|
||||||
putenv(sdl_has3buttonmouse);
|
putenv(sdl_has3buttonmouse);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (!keyremapinit)
|
|
||||||
for (i = 0; i < 256; i++) keyremap[i] = i;
|
|
||||||
keyremapinit = 1;
|
|
||||||
|
|
||||||
inputdevices = 1 | 2; // keyboard (1) and mouse (2)
|
inputdevices = 1 | 2; // keyboard (1) and mouse (2)
|
||||||
mousegrab = 0;
|
g_mouseGrabbed = 0;
|
||||||
|
|
||||||
memset(key_names, 0, sizeof(key_names));
|
memset(g_keyNameTable, 0, sizeof(g_keyNameTable));
|
||||||
|
|
||||||
#if SDL_MAJOR_VERSION == 1
|
#if SDL_MAJOR_VERSION == 1
|
||||||
#define SDL_SCANCODE_TO_KEYCODE(x) (SDLKey)(x)
|
#define SDL_SCANCODE_TO_KEYCODE(x) (SDLKey)(x)
|
||||||
|
@ -817,7 +813,7 @@ int32_t initinput(void)
|
||||||
if (!keytranslation[i])
|
if (!keytranslation[i])
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
Bstrncpyz(key_names[keytranslation[i]], SDL_GetKeyName(SDL_SCANCODE_TO_KEYCODE(i)), sizeof(key_names[i]));
|
Bstrncpyz(g_keyNameTable[keytranslation[i]], SDL_GetKeyName(SDL_SCANCODE_TO_KEYCODE(i)), sizeof(g_keyNameTable[i]));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!SDL_InitSubSystem(SDL_INIT_JOYSTICK))
|
if (!SDL_InitSubSystem(SDL_INIT_JOYSTICK))
|
||||||
|
@ -836,20 +832,20 @@ int32_t initinput(void)
|
||||||
inputdevices |= 4;
|
inputdevices |= 4;
|
||||||
|
|
||||||
// KEEPINSYNC duke3d/src/gamedefs.h, mact/include/_control.h
|
// KEEPINSYNC duke3d/src/gamedefs.h, mact/include/_control.h
|
||||||
joynumaxes = min(9, SDL_JoystickNumAxes(joydev));
|
joystick.numAxes = min(9, SDL_JoystickNumAxes(joydev));
|
||||||
joynumbuttons = min(32, SDL_JoystickNumButtons(joydev));
|
joystick.numButtons = min(32, SDL_JoystickNumButtons(joydev));
|
||||||
joynumhats = min((36-joynumbuttons)/4,SDL_JoystickNumHats(joydev));
|
joystick.numHats = min((36-joystick.numButtons)/4,SDL_JoystickNumHats(joydev));
|
||||||
initprintf("Joystick 1 has %d axes, %d buttons, and %d hat(s).\n", joynumaxes, joynumbuttons, joynumhats);
|
initprintf("Joystick 1 has %d axes, %d buttons, and %d hat(s).\n", joystick.numAxes, joystick.numButtons, joystick.numHats);
|
||||||
|
|
||||||
joyaxis = (int32_t *)Bcalloc(joynumaxes, sizeof(int32_t));
|
joystick.pAxis = (int32_t *)Bcalloc(joystick.numAxes, sizeof(int32_t));
|
||||||
|
|
||||||
if (joynumhats)
|
if (joystick.numHats)
|
||||||
joyhat = (int32_t *)Bcalloc(joynumhats, sizeof(int32_t));
|
joystick.pHat = (int32_t *)Bcalloc(joystick.numHats, sizeof(int32_t));
|
||||||
|
|
||||||
for (i = 0; i < joynumhats; i++) joyhat[i] = -1; // centre
|
for (i = 0; i < joystick.numHats; i++) joystick.pHat[i] = -1; // centre
|
||||||
|
|
||||||
joydead = (uint16_t *)Bcalloc(joynumaxes, sizeof(uint16_t));
|
joydead = (uint16_t *)Bcalloc(joystick.numAxes, sizeof(uint16_t));
|
||||||
joysatur = (uint16_t *)Bcalloc(joynumaxes, sizeof(uint16_t));
|
joysatur = (uint16_t *)Bcalloc(joystick.numAxes, sizeof(uint16_t));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -864,7 +860,7 @@ void uninitinput(void)
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
Win_SetKeyboardLayoutUS(0);
|
Win_SetKeyboardLayoutUS(0);
|
||||||
#endif
|
#endif
|
||||||
uninitmouse();
|
mouseUninit();
|
||||||
|
|
||||||
if (joydev)
|
if (joydev)
|
||||||
{
|
{
|
||||||
|
@ -874,26 +870,26 @@ void uninitinput(void)
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifndef GEKKO
|
#ifndef GEKKO
|
||||||
const char *getjoyname(int32_t what, int32_t num)
|
const char *joyGetName(int32_t what, int32_t num)
|
||||||
{
|
{
|
||||||
static char tmp[64];
|
static char tmp[64];
|
||||||
|
|
||||||
switch (what)
|
switch (what)
|
||||||
{
|
{
|
||||||
case 0: // axis
|
case 0: // axis
|
||||||
if ((unsigned)num > (unsigned)joynumaxes)
|
if ((unsigned)num > (unsigned)joystick.numAxes)
|
||||||
return NULL;
|
return NULL;
|
||||||
Bsprintf(tmp, "Axis %d", num);
|
Bsprintf(tmp, "Axis %d", num);
|
||||||
return (char *)tmp;
|
return (char *)tmp;
|
||||||
|
|
||||||
case 1: // button
|
case 1: // button
|
||||||
if ((unsigned)num > (unsigned)joynumbuttons)
|
if ((unsigned)num > (unsigned)joystick.numButtons)
|
||||||
return NULL;
|
return NULL;
|
||||||
Bsprintf(tmp, "Button %d", num);
|
Bsprintf(tmp, "Button %d", num);
|
||||||
return (char *)tmp;
|
return (char *)tmp;
|
||||||
|
|
||||||
case 2: // hat
|
case 2: // hat
|
||||||
if ((unsigned)num > (unsigned)joynumhats)
|
if ((unsigned)num > (unsigned)joystick.numHats)
|
||||||
return NULL;
|
return NULL;
|
||||||
Bsprintf(tmp, "Hat %d", num);
|
Bsprintf(tmp, "Hat %d", num);
|
||||||
return (char *)tmp;
|
return (char *)tmp;
|
||||||
|
@ -907,20 +903,20 @@ const char *getjoyname(int32_t what, int32_t num)
|
||||||
//
|
//
|
||||||
// initmouse() -- init mouse input
|
// initmouse() -- init mouse input
|
||||||
//
|
//
|
||||||
int32_t initmouse(void)
|
int32_t mouseInit(void)
|
||||||
{
|
{
|
||||||
moustat=AppMouseGrab;
|
g_mouseEnabled=g_mouseLockedToWindow;
|
||||||
grabmouse(AppMouseGrab); // FIXME - SA
|
mouseGrabInput(g_mouseLockedToWindow); // FIXME - SA
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// uninitmouse() -- uninit mouse input
|
// uninitmouse() -- uninit mouse input
|
||||||
//
|
//
|
||||||
void uninitmouse(void)
|
void mouseUninit(void)
|
||||||
{
|
{
|
||||||
grabmouse(0);
|
mouseGrabInput(0);
|
||||||
moustat = 0;
|
g_mouseEnabled = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -948,27 +944,27 @@ static inline char grabmouse_low(char a)
|
||||||
//
|
//
|
||||||
// grabmouse() -- show/hide mouse cursor
|
// grabmouse() -- show/hide mouse cursor
|
||||||
//
|
//
|
||||||
void grabmouse(char a)
|
void mouseGrabInput(char a)
|
||||||
{
|
{
|
||||||
if (appactive && moustat)
|
if (appactive && g_mouseEnabled)
|
||||||
{
|
{
|
||||||
#if !defined EDUKE32_TOUCH_DEVICES
|
#if !defined EDUKE32_TOUCH_DEVICES
|
||||||
if ((a != mousegrab) && !grabmouse_low(a))
|
if ((a != g_mouseGrabbed) && !grabmouse_low(a))
|
||||||
#endif
|
#endif
|
||||||
mousegrab = a;
|
g_mouseGrabbed = a;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
mousegrab = a;
|
g_mouseGrabbed = a;
|
||||||
|
|
||||||
mousex = mousey = 0;
|
g_mousePos.x = g_mousePos.y = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void AppGrabMouse(char a)
|
void mouseLockToWindow(char a)
|
||||||
{
|
{
|
||||||
if (!(a & 2))
|
if (!(a & 2))
|
||||||
{
|
{
|
||||||
grabmouse(a);
|
mouseGrabInput(a);
|
||||||
AppMouseGrab = mousegrab;
|
g_mouseLockedToWindow = g_mouseGrabbed;
|
||||||
}
|
}
|
||||||
|
|
||||||
SDL_ShowCursor((osd && osd->flags & OSD_CAPTURE) ? SDL_ENABLE : SDL_DISABLE);
|
SDL_ShowCursor((osd && osd->flags & OSD_CAPTURE) ? SDL_ENABLE : SDL_DISABLE);
|
||||||
|
@ -977,7 +973,7 @@ void AppGrabMouse(char a)
|
||||||
//
|
//
|
||||||
// setjoydeadzone() -- sets the dead and saturation zones for the joystick
|
// setjoydeadzone() -- sets the dead and saturation zones for the joystick
|
||||||
//
|
//
|
||||||
void setjoydeadzone(int32_t axis, uint16_t dead, uint16_t satur)
|
void joySetDeadZone(int32_t axis, uint16_t dead, uint16_t satur)
|
||||||
{
|
{
|
||||||
joydead[axis] = dead;
|
joydead[axis] = dead;
|
||||||
joysatur[axis] = satur;
|
joysatur[axis] = satur;
|
||||||
|
@ -987,20 +983,13 @@ void setjoydeadzone(int32_t axis, uint16_t dead, uint16_t satur)
|
||||||
//
|
//
|
||||||
// getjoydeadzone() -- gets the dead and saturation zones for the joystick
|
// getjoydeadzone() -- gets the dead and saturation zones for the joystick
|
||||||
//
|
//
|
||||||
void getjoydeadzone(int32_t axis, uint16_t *dead, uint16_t *satur)
|
void joyGetDeadZone(int32_t axis, uint16_t *dead, uint16_t *satur)
|
||||||
{
|
{
|
||||||
*dead = joydead[axis];
|
*dead = joydead[axis];
|
||||||
*satur = joysatur[axis];
|
*satur = joysatur[axis];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//
|
|
||||||
// releaseallbuttons()
|
|
||||||
//
|
|
||||||
void releaseallbuttons(void)
|
|
||||||
{}
|
|
||||||
|
|
||||||
|
|
||||||
//
|
//
|
||||||
//
|
//
|
||||||
// ---------------------------------------
|
// ---------------------------------------
|
||||||
|
@ -1200,19 +1189,19 @@ void getvalidmodes(void)
|
||||||
SDL_CHECKFSMODES(maxx, maxy);
|
SDL_CHECKFSMODES(maxx, maxy);
|
||||||
|
|
||||||
// add windowed modes next
|
// add windowed modes next
|
||||||
for (i = 0; defaultres[i][0]; i++)
|
for (i = 0; g_defaultVideoModes[i].x; i++)
|
||||||
{
|
{
|
||||||
if (!SDL_CHECKMODE(defaultres[i][0], defaultres[i][1]))
|
if (!SDL_CHECKMODE(g_defaultVideoModes[i].x, g_defaultVideoModes[i].y))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
// HACK: 8-bit == Software, 32-bit == OpenGL
|
// HACK: 8-bit == Software, 32-bit == OpenGL
|
||||||
SDL_ADDMODE(defaultres[i][0], defaultres[i][1], 8, 0);
|
SDL_ADDMODE(g_defaultVideoModes[i].x, g_defaultVideoModes[i].y, 8, 0);
|
||||||
|
|
||||||
#ifdef USE_OPENGL
|
#ifdef USE_OPENGL
|
||||||
if (nogl)
|
if (nogl)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
SDL_ADDMODE(defaultres[i][0], defaultres[i][1], 32, 0);
|
SDL_ADDMODE(g_defaultVideoModes[i].x, g_defaultVideoModes[i].y, 32, 0);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1453,10 +1442,10 @@ int32_t setvideomode_sdlcommon(int32_t *x, int32_t *y, int32_t c, int32_t fs, in
|
||||||
|
|
||||||
startwin_close();
|
startwin_close();
|
||||||
|
|
||||||
if (mousegrab)
|
if (g_mouseGrabbed)
|
||||||
{
|
{
|
||||||
*regrab = 1;
|
*regrab = 1;
|
||||||
grabmouse(0);
|
mouseGrabInput(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
while (lockcount) enddrawing();
|
while (lockcount) enddrawing();
|
||||||
|
@ -1514,7 +1503,7 @@ void setvideomode_sdlcommonpost(int32_t x, int32_t y, int32_t c, int32_t fs, int
|
||||||
setpalettefade(palfadergb.r, palfadergb.g, palfadergb.b, palfadedelta);
|
setpalettefade(palfadergb.r, palfadergb.g, palfadergb.b, palfadedelta);
|
||||||
|
|
||||||
if (regrab)
|
if (regrab)
|
||||||
grabmouse(AppMouseGrab);
|
mouseGrabInput(g_mouseLockedToWindow);
|
||||||
}
|
}
|
||||||
|
|
||||||
#if SDL_MAJOR_VERSION!=1
|
#if SDL_MAJOR_VERSION!=1
|
||||||
|
@ -1988,7 +1977,7 @@ int32_t handleevents_peekkeys(void)
|
||||||
|
|
||||||
void handleevents_updatemousestate(uint8_t state)
|
void handleevents_updatemousestate(uint8_t state)
|
||||||
{
|
{
|
||||||
mousepressstate = state == SDL_RELEASED ? Mouse_Released : Mouse_Pressed;
|
g_mouseClickState = state == SDL_RELEASED ? MOUSE_RELEASED : MOUSE_PRESSED;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -2004,21 +1993,21 @@ int32_t handleevents_sdlcommon(SDL_Event *ev)
|
||||||
#if !defined EDUKE32_IOS
|
#if !defined EDUKE32_IOS
|
||||||
case SDL_MOUSEMOTION:
|
case SDL_MOUSEMOTION:
|
||||||
#ifndef GEKKO
|
#ifndef GEKKO
|
||||||
mouseabs.x = ev->motion.x;
|
g_mouseAbs.x = ev->motion.x;
|
||||||
mouseabs.y = ev->motion.y;
|
g_mouseAbs.y = ev->motion.y;
|
||||||
#endif
|
#endif
|
||||||
// SDL <VER> doesn't handle relative mouse movement correctly yet as the cursor still clips to the
|
// SDL <VER> doesn't handle relative mouse movement correctly yet as the cursor still clips to the
|
||||||
// screen edges
|
// screen edges
|
||||||
// so, we call SDL_WarpMouse() to center the cursor and ignore the resulting motion event that occurs
|
// so, we call SDL_WarpMouse() to center the cursor and ignore the resulting motion event that occurs
|
||||||
// <VER> is 1.3 for PK, 1.2 for tueidj
|
// <VER> is 1.3 for PK, 1.2 for tueidj
|
||||||
if (appactive && mousegrab)
|
if (appactive && g_mouseGrabbed)
|
||||||
{
|
{
|
||||||
# if SDL_MAJOR_VERSION==1
|
# if SDL_MAJOR_VERSION==1
|
||||||
if (ev->motion.x != xdim >> 1 || ev->motion.y != ydim >> 1)
|
if (ev->motion.x != xdim >> 1 || ev->motion.y != ydim >> 1)
|
||||||
# endif
|
# endif
|
||||||
{
|
{
|
||||||
mousex += ev->motion.xrel;
|
g_mousePos.x += ev->motion.xrel;
|
||||||
mousey += ev->motion.yrel;
|
g_mousePos.y += ev->motion.yrel;
|
||||||
# if SDL_MAJOR_VERSION==1
|
# if SDL_MAJOR_VERSION==1
|
||||||
SDL_WarpMouse(xdim>>1, ydim>>1);
|
SDL_WarpMouse(xdim>>1, ydim>>1);
|
||||||
# endif
|
# endif
|
||||||
|
@ -2062,44 +2051,44 @@ int32_t handleevents_sdlcommon(SDL_Event *ev)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
if (ev->button.state == SDL_PRESSED)
|
if (ev->button.state == SDL_PRESSED)
|
||||||
mouseb |= (1 << j);
|
g_mouseBits |= (1 << j);
|
||||||
else
|
else
|
||||||
#if SDL_MAJOR_VERSION==1
|
#if SDL_MAJOR_VERSION==1
|
||||||
if (j != SDL_BUTTON_WHEELUP && j != SDL_BUTTON_WHEELDOWN)
|
if (j != SDL_BUTTON_WHEELUP && j != SDL_BUTTON_WHEELDOWN)
|
||||||
#endif
|
#endif
|
||||||
mouseb &= ~(1 << j);
|
g_mouseBits &= ~(1 << j);
|
||||||
|
|
||||||
if (mousepresscallback)
|
if (g_mouseCallback)
|
||||||
mousepresscallback(j+1, ev->button.state == SDL_PRESSED);
|
g_mouseCallback(j+1, ev->button.state == SDL_PRESSED);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
# if SDL_MAJOR_VERSION != 1
|
# if SDL_MAJOR_VERSION != 1
|
||||||
case SDL_FINGERUP:
|
case SDL_FINGERUP:
|
||||||
mousepressstate = Mouse_Released;
|
g_mouseClickState = MOUSE_RELEASED;
|
||||||
break;
|
break;
|
||||||
case SDL_FINGERDOWN:
|
case SDL_FINGERDOWN:
|
||||||
mousepressstate = Mouse_Pressed;
|
g_mouseClickState = MOUSE_PRESSED;
|
||||||
case SDL_FINGERMOTION:
|
case SDL_FINGERMOTION:
|
||||||
mouseabs.x = Blrintf(ev->tfinger.x * xdim);
|
g_mouseAbs.x = Blrintf(ev->tfinger.x * xdim);
|
||||||
mouseabs.y = Blrintf(ev->tfinger.y * ydim);
|
g_mouseAbs.y = Blrintf(ev->tfinger.y * ydim);
|
||||||
break;
|
break;
|
||||||
# endif
|
# endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
case SDL_JOYAXISMOTION:
|
case SDL_JOYAXISMOTION:
|
||||||
if (appactive && ev->jaxis.axis < joynumaxes)
|
if (appactive && ev->jaxis.axis < joystick.numAxes)
|
||||||
{
|
{
|
||||||
joyaxis[ev->jaxis.axis] = ev->jaxis.value * 10000 / 32767;
|
joystick.pAxis[ev->jaxis.axis] = ev->jaxis.value * 10000 / 32767;
|
||||||
if ((joyaxis[ev->jaxis.axis] < joydead[ev->jaxis.axis]) &&
|
if ((joystick.pAxis[ev->jaxis.axis] < joydead[ev->jaxis.axis]) &&
|
||||||
(joyaxis[ev->jaxis.axis] > -joydead[ev->jaxis.axis]))
|
(joystick.pAxis[ev->jaxis.axis] > -joydead[ev->jaxis.axis]))
|
||||||
joyaxis[ev->jaxis.axis] = 0;
|
joystick.pAxis[ev->jaxis.axis] = 0;
|
||||||
else if (joyaxis[ev->jaxis.axis] >= joysatur[ev->jaxis.axis])
|
else if (joystick.pAxis[ev->jaxis.axis] >= joysatur[ev->jaxis.axis])
|
||||||
joyaxis[ev->jaxis.axis] = 10000;
|
joystick.pAxis[ev->jaxis.axis] = 10000;
|
||||||
else if (joyaxis[ev->jaxis.axis] <= -joysatur[ev->jaxis.axis])
|
else if (joystick.pAxis[ev->jaxis.axis] <= -joysatur[ev->jaxis.axis])
|
||||||
joyaxis[ev->jaxis.axis] = -10000;
|
joystick.pAxis[ev->jaxis.axis] = -10000;
|
||||||
else
|
else
|
||||||
joyaxis[ev->jaxis.axis] = joyaxis[ev->jaxis.axis] * 10000 / joysatur[ev->jaxis.axis];
|
joystick.pAxis[ev->jaxis.axis] = joystick.pAxis[ev->jaxis.axis] * 10000 / joysatur[ev->jaxis.axis];
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -2123,19 +2112,19 @@ int32_t handleevents_sdlcommon(SDL_Event *ev)
|
||||||
-1, // left+down+right!! 14
|
-1, // left+down+right!! 14
|
||||||
-1, // left+down+right+up!! 15
|
-1, // left+down+right+up!! 15
|
||||||
};
|
};
|
||||||
if (appactive && ev->jhat.hat < joynumhats)
|
if (appactive && ev->jhat.hat < joystick.numHats)
|
||||||
joyhat[ev->jhat.hat] = hatvals[ev->jhat.value & 15];
|
joystick.pHat[ev->jhat.hat] = hatvals[ev->jhat.value & 15];
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
case SDL_JOYBUTTONDOWN:
|
case SDL_JOYBUTTONDOWN:
|
||||||
case SDL_JOYBUTTONUP:
|
case SDL_JOYBUTTONUP:
|
||||||
if (appactive && ev->jbutton.button < joynumbuttons)
|
if (appactive && ev->jbutton.button < joystick.numButtons)
|
||||||
{
|
{
|
||||||
if (ev->jbutton.state == SDL_PRESSED)
|
if (ev->jbutton.state == SDL_PRESSED)
|
||||||
joyb |= 1 << ev->jbutton.button;
|
joystick.bits |= 1 << ev->jbutton.button;
|
||||||
else
|
else
|
||||||
joyb &= ~(1 << ev->jbutton.button);
|
joystick.bits &= ~(1 << ev->jbutton.button);
|
||||||
|
|
||||||
#ifdef GEKKO
|
#ifdef GEKKO
|
||||||
if (ev->jbutton.button == 0) // WII_A
|
if (ev->jbutton.button == 0) // WII_A
|
||||||
|
@ -2170,10 +2159,10 @@ int32_t handleevents_pollsdl(void)
|
||||||
{
|
{
|
||||||
code = ev.text.text[j];
|
code = ev.text.text[j];
|
||||||
|
|
||||||
if (code != scantoasc[OSD_OSDKey()] && !keyascfifo_isfull())
|
if (code != g_keyAsciiTable[OSD_OSDKey()] && !keyBufferFull())
|
||||||
{
|
{
|
||||||
if (OSD_HandleChar(code))
|
if (OSD_HandleChar(code))
|
||||||
keyascfifo_insert(code);
|
keyBufferInsert(code);
|
||||||
}
|
}
|
||||||
} while (j < SDL_TEXTINPUTEVENT_TEXT_SIZE && ev.text.text[++j]);
|
} while (j < SDL_TEXTINPUTEVENT_TEXT_SIZE && ev.text.text[++j]);
|
||||||
break;
|
break;
|
||||||
|
@ -2191,7 +2180,7 @@ int32_t handleevents_pollsdl(void)
|
||||||
KMOD_LALT|KMOD_RALT|KMOD_LGUI|KMOD_RGUI;
|
KMOD_LALT|KMOD_RALT|KMOD_LGUI|KMOD_RGUI;
|
||||||
|
|
||||||
// XXX: see osd.c, OSD_HandleChar(), there are more...
|
// XXX: see osd.c, OSD_HandleChar(), there are more...
|
||||||
if (ev.key.type == SDL_KEYDOWN && !keyascfifo_isfull() &&
|
if (ev.key.type == SDL_KEYDOWN && !keyBufferFull() &&
|
||||||
(sc == SDL_SCANCODE_RETURN || sc == SDL_SCANCODE_KP_ENTER ||
|
(sc == SDL_SCANCODE_RETURN || sc == SDL_SCANCODE_KP_ENTER ||
|
||||||
sc == SDL_SCANCODE_ESCAPE ||
|
sc == SDL_SCANCODE_ESCAPE ||
|
||||||
sc == SDL_SCANCODE_BACKSPACE ||
|
sc == SDL_SCANCODE_BACKSPACE ||
|
||||||
|
@ -2209,10 +2198,10 @@ int32_t handleevents_pollsdl(void)
|
||||||
default: keyvalue = sc - SDL_SCANCODE_A + 1; break; // Ctrl+A --> 1, etc.
|
default: keyvalue = sc - SDL_SCANCODE_A + 1; break; // Ctrl+A --> 1, etc.
|
||||||
}
|
}
|
||||||
if (OSD_HandleChar(keyvalue))
|
if (OSD_HandleChar(keyvalue))
|
||||||
keyascfifo_insert(keyvalue);
|
keyBufferInsert(keyvalue);
|
||||||
}
|
}
|
||||||
else if (ev.key.type == SDL_KEYDOWN &&
|
else if (ev.key.type == SDL_KEYDOWN &&
|
||||||
ev.key.keysym.sym != scantoasc[OSD_OSDKey()] && !keyascfifo_isfull() &&
|
ev.key.keysym.sym != g_keyAsciiTable[OSD_OSDKey()] && !keyBufferFull() &&
|
||||||
!SDL_IsTextInputActive())
|
!SDL_IsTextInputActive())
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
|
@ -2288,7 +2277,7 @@ int32_t handleevents_pollsdl(void)
|
||||||
if ((unsigned)keyvalue <= 0x7Fu)
|
if ((unsigned)keyvalue <= 0x7Fu)
|
||||||
{
|
{
|
||||||
if (OSD_HandleChar(keyvalue))
|
if (OSD_HandleChar(keyvalue))
|
||||||
keyascfifo_insert(keyvalue);
|
keyBufferInsert(keyvalue);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2298,10 +2287,10 @@ int32_t handleevents_pollsdl(void)
|
||||||
if ((j = OSD_HandleScanCode(code, (ev.key.type == SDL_KEYDOWN))) <= 0)
|
if ((j = OSD_HandleScanCode(code, (ev.key.type == SDL_KEYDOWN))) <= 0)
|
||||||
{
|
{
|
||||||
if (j == -1) // osdkey
|
if (j == -1) // osdkey
|
||||||
for (j = 0; j < KEYSTATUSSIZ; ++j)
|
for (j = 0; j < NUMKEYS; ++j)
|
||||||
if (GetKey(j))
|
if (keyGetState(j))
|
||||||
{
|
{
|
||||||
SetKey(j, 0);
|
keySetState(j, 0);
|
||||||
if (keypresscallback)
|
if (keypresscallback)
|
||||||
keypresscallback(j, 0);
|
keypresscallback(j, 0);
|
||||||
}
|
}
|
||||||
|
@ -2310,9 +2299,9 @@ int32_t handleevents_pollsdl(void)
|
||||||
|
|
||||||
if (ev.key.type == SDL_KEYDOWN)
|
if (ev.key.type == SDL_KEYDOWN)
|
||||||
{
|
{
|
||||||
if (!GetKey(code))
|
if (!keyGetState(code))
|
||||||
{
|
{
|
||||||
SetKey(code, 1);
|
keySetState(code, 1);
|
||||||
if (keypresscallback)
|
if (keypresscallback)
|
||||||
keypresscallback(code, 1);
|
keypresscallback(code, 1);
|
||||||
}
|
}
|
||||||
|
@ -2326,7 +2315,7 @@ int32_t handleevents_pollsdl(void)
|
||||||
if (code == 0x59) // pause
|
if (code == 0x59) // pause
|
||||||
break;
|
break;
|
||||||
# endif
|
# endif
|
||||||
SetKey(code, 0);
|
keySetState(code, 0);
|
||||||
if (keypresscallback)
|
if (keypresscallback)
|
||||||
keypresscallback(code, 0);
|
keypresscallback(code, 0);
|
||||||
}
|
}
|
||||||
|
@ -2337,15 +2326,15 @@ int32_t handleevents_pollsdl(void)
|
||||||
// initprintf("wheel y %d\n",ev.wheel.y);
|
// initprintf("wheel y %d\n",ev.wheel.y);
|
||||||
if (ev.wheel.y > 0)
|
if (ev.wheel.y > 0)
|
||||||
{
|
{
|
||||||
mouseb |= 16;
|
g_mouseBits |= 16;
|
||||||
if (mousepresscallback)
|
if (g_mouseCallback)
|
||||||
mousepresscallback(5, 1);
|
g_mouseCallback(5, 1);
|
||||||
}
|
}
|
||||||
if (ev.wheel.y < 0)
|
if (ev.wheel.y < 0)
|
||||||
{
|
{
|
||||||
mouseb |= 32;
|
g_mouseBits |= 32;
|
||||||
if (mousepresscallback)
|
if (g_mouseCallback)
|
||||||
mousepresscallback(6, 1);
|
g_mouseCallback(6, 1);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -2355,7 +2344,7 @@ int32_t handleevents_pollsdl(void)
|
||||||
case SDL_WINDOWEVENT_FOCUS_GAINED:
|
case SDL_WINDOWEVENT_FOCUS_GAINED:
|
||||||
case SDL_WINDOWEVENT_FOCUS_LOST:
|
case SDL_WINDOWEVENT_FOCUS_LOST:
|
||||||
appactive = (ev.window.event == SDL_WINDOWEVENT_FOCUS_GAINED);
|
appactive = (ev.window.event == SDL_WINDOWEVENT_FOCUS_GAINED);
|
||||||
if (mousegrab && moustat)
|
if (g_mouseGrabbed && g_mouseEnabled)
|
||||||
grabmouse_low(appactive);
|
grabmouse_low(appactive);
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
// Win_SetKeyboardLayoutUS(appactive);
|
// Win_SetKeyboardLayoutUS(appactive);
|
||||||
|
@ -2373,10 +2362,10 @@ int32_t handleevents_pollsdl(void)
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case SDL_WINDOWEVENT_ENTER:
|
case SDL_WINDOWEVENT_ENTER:
|
||||||
mouseinwindow = 1;
|
g_mouseInsideWindow = 1;
|
||||||
break;
|
break;
|
||||||
case SDL_WINDOWEVENT_LEAVE:
|
case SDL_WINDOWEVENT_LEAVE:
|
||||||
mouseinwindow = 0;
|
g_mouseInsideWindow = 0;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@ -2399,16 +2388,16 @@ int32_t handleevents(void)
|
||||||
|
|
||||||
int32_t rv;
|
int32_t rv;
|
||||||
|
|
||||||
if (inputchecked && moustat)
|
if (inputchecked && g_mouseEnabled)
|
||||||
{
|
{
|
||||||
if (mousepresscallback)
|
if (g_mouseCallback)
|
||||||
{
|
{
|
||||||
if (mouseb & 16)
|
if (g_mouseBits & 16)
|
||||||
mousepresscallback(5, 0);
|
g_mouseCallback(5, 0);
|
||||||
if (mouseb & 32)
|
if (g_mouseBits & 32)
|
||||||
mousepresscallback(6, 0);
|
g_mouseCallback(6, 0);
|
||||||
}
|
}
|
||||||
mouseb &= ~(16 | 32);
|
g_mouseBits &= ~(16 | 32);
|
||||||
}
|
}
|
||||||
|
|
||||||
rv = handleevents_pollsdl();
|
rv = handleevents_pollsdl();
|
||||||
|
|
|
@ -135,20 +135,20 @@ static const char *joynames[3][15] = {
|
||||||
"Hat 11", "Hat 12", "Hat 13", "Hat 14", "Hat 15",
|
"Hat 11", "Hat 12", "Hat 13", "Hat 14", "Hat 15",
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
const char *getjoyname(int32_t what, int32_t num)
|
const char *joyGetName(int32_t what, int32_t num)
|
||||||
{
|
{
|
||||||
switch (what)
|
switch (what)
|
||||||
{
|
{
|
||||||
case 0: // axis
|
case 0: // axis
|
||||||
if ((unsigned)num > (unsigned)joynumaxes) return NULL;
|
if ((unsigned)num > (unsigned)joystick.numAxes) return NULL;
|
||||||
return joynames[0][num];
|
return joynames[0][num];
|
||||||
|
|
||||||
case 1: // button
|
case 1: // button
|
||||||
if ((unsigned)num > (unsigned)joynumbuttons) return NULL;
|
if ((unsigned)num > (unsigned)joystick.numButtons) return NULL;
|
||||||
return joynames[1][num];
|
return joynames[1][num];
|
||||||
|
|
||||||
case 2: // hat
|
case 2: // hat
|
||||||
if ((unsigned)num > (unsigned)joynumhats) return NULL;
|
if ((unsigned)num > (unsigned)joystick.numHats) return NULL;
|
||||||
return joynames[2][num];
|
return joynames[2][num];
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
@ -267,8 +267,8 @@ void getvalidmodes(void)
|
||||||
|
|
||||||
if (modes == (SDL_Rect **)-1)
|
if (modes == (SDL_Rect **)-1)
|
||||||
{
|
{
|
||||||
for (i = 0; defaultres[i][0]; i++)
|
for (i = 0; g_defaultVideoModes[i].x; i++)
|
||||||
SDL_ADDMODE(defaultres[i][0], defaultres[i][1], cdepths[j], 1);
|
SDL_ADDMODE(g_defaultVideoModes[i].x, g_defaultVideoModes[i].y, cdepths[j], 1);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -300,12 +300,12 @@ void getvalidmodes(void)
|
||||||
if (cdepths[j] < 0)
|
if (cdepths[j] < 0)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
for (i = 0; defaultres[i][0]; i++)
|
for (i = 0; g_defaultVideoModes[i].x; i++)
|
||||||
{
|
{
|
||||||
if (!SDL_CHECKMODE(defaultres[i][0], defaultres[i][1]))
|
if (!SDL_CHECKMODE(g_defaultVideoModes[i].x, g_defaultVideoModes[i].y))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
SDL_ADDMODE(defaultres[i][0], defaultres[i][1], cdepths[j], 0);
|
SDL_ADDMODE(g_defaultVideoModes[i].x, g_defaultVideoModes[i].y, cdepths[j], 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -484,14 +484,14 @@ int32_t handleevents_pollsdl(void)
|
||||||
case SDL_KEYUP:
|
case SDL_KEYUP:
|
||||||
code = keytranslation[ev.key.keysym.sym];
|
code = keytranslation[ev.key.keysym.sym];
|
||||||
#ifdef KEY_PRINT_DEBUG
|
#ifdef KEY_PRINT_DEBUG
|
||||||
printf("keytranslation[%d] = %s (%d) %s\n", ev.key.keysym.sym, key_names[code], code,
|
printf("keytranslation[%d] = %s (%d) %s\n", ev.key.keysym.sym, g_keyNameTable[code], code,
|
||||||
ev.key.type == SDL_KEYDOWN ? "DOWN" : "UP");
|
ev.key.type == SDL_KEYDOWN ? "DOWN" : "UP");
|
||||||
#endif
|
#endif
|
||||||
if (code != OSD_OSDKey() && ev.key.keysym.unicode != 0 && ev.key.type == SDL_KEYDOWN &&
|
if (code != OSD_OSDKey() && ev.key.keysym.unicode != 0 && ev.key.type == SDL_KEYDOWN &&
|
||||||
(ev.key.keysym.unicode & 0xff80) == 0 && !keyascfifo_isfull())
|
(ev.key.keysym.unicode & 0xff80) == 0 && !keyBufferFull())
|
||||||
{
|
{
|
||||||
if (OSD_HandleChar(ev.key.keysym.unicode & 0x7f))
|
if (OSD_HandleChar(ev.key.keysym.unicode & 0x7f))
|
||||||
keyascfifo_insert(ev.key.keysym.unicode & 0x7f);
|
keyBufferInsert(ev.key.keysym.unicode & 0x7f);
|
||||||
}
|
}
|
||||||
|
|
||||||
// hook in the osd
|
// hook in the osd
|
||||||
|
@ -499,11 +499,11 @@ int32_t handleevents_pollsdl(void)
|
||||||
{
|
{
|
||||||
if (j == -1) // osdkey
|
if (j == -1) // osdkey
|
||||||
{
|
{
|
||||||
for (j = 0; j < KEYSTATUSSIZ; ++j)
|
for (j = 0; j < NUMKEYS; ++j)
|
||||||
{
|
{
|
||||||
if (GetKey(j))
|
if (keyGetState(j))
|
||||||
{
|
{
|
||||||
SetKey(j, 0);
|
keySetState(j, 0);
|
||||||
if (keypresscallback)
|
if (keypresscallback)
|
||||||
keypresscallback(j, 0);
|
keypresscallback(j, 0);
|
||||||
}
|
}
|
||||||
|
@ -514,9 +514,9 @@ int32_t handleevents_pollsdl(void)
|
||||||
|
|
||||||
if (ev.key.type == SDL_KEYDOWN)
|
if (ev.key.type == SDL_KEYDOWN)
|
||||||
{
|
{
|
||||||
if (!GetKey(code))
|
if (!keyGetState(code))
|
||||||
{
|
{
|
||||||
SetKey(code, 1);
|
keySetState(code, 1);
|
||||||
if (keypresscallback)
|
if (keypresscallback)
|
||||||
keypresscallback(code, 1);
|
keypresscallback(code, 1);
|
||||||
}
|
}
|
||||||
|
@ -527,7 +527,7 @@ int32_t handleevents_pollsdl(void)
|
||||||
if (code == 0x59) // pause
|
if (code == 0x59) // pause
|
||||||
break;
|
break;
|
||||||
#endif
|
#endif
|
||||||
SetKey(code, 0);
|
keySetState(code, 0);
|
||||||
if (keypresscallback)
|
if (keypresscallback)
|
||||||
keypresscallback(code, 0);
|
keypresscallback(code, 0);
|
||||||
}
|
}
|
||||||
|
@ -537,7 +537,7 @@ int32_t handleevents_pollsdl(void)
|
||||||
if (ev.active.state & SDL_APPINPUTFOCUS)
|
if (ev.active.state & SDL_APPINPUTFOCUS)
|
||||||
{
|
{
|
||||||
appactive = ev.active.gain;
|
appactive = ev.active.gain;
|
||||||
if (mousegrab && moustat)
|
if (g_mouseGrabbed && g_mouseEnabled)
|
||||||
grabmouse_low(!!appactive);
|
grabmouse_low(!!appactive);
|
||||||
# ifdef _WIN32
|
# ifdef _WIN32
|
||||||
// Win_SetKeyboardLayoutUS(appactive);
|
// Win_SetKeyboardLayoutUS(appactive);
|
||||||
|
@ -549,7 +549,7 @@ int32_t handleevents_pollsdl(void)
|
||||||
rv = -1;
|
rv = -1;
|
||||||
|
|
||||||
if (ev.active.state & SDL_APPMOUSEFOCUS)
|
if (ev.active.state & SDL_APPMOUSEFOCUS)
|
||||||
mouseinwindow = ev.active.gain;
|
g_mouseInsideWindow = ev.active.gain;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -560,8 +560,8 @@ int32_t handleevents_pollsdl(void)
|
||||||
if (ev.motion.state & SDL_BUTTON_X2MASK)
|
if (ev.motion.state & SDL_BUTTON_X2MASK)
|
||||||
{
|
{
|
||||||
// the absolute values are used to draw the crosshair
|
// the absolute values are used to draw the crosshair
|
||||||
mouseabs.x = ev.motion.x;
|
g_mouseAbs.x = ev.motion.x;
|
||||||
mouseabs.y = ev.motion.y;
|
g_mouseAbs.y = ev.motion.y;
|
||||||
// hack: reduce the scale of the "relative" motions
|
// hack: reduce the scale of the "relative" motions
|
||||||
// to make it act more like a real mouse
|
// to make it act more like a real mouse
|
||||||
ev.motion.xrel /= 16;
|
ev.motion.xrel /= 16;
|
||||||
|
|
|
@ -597,7 +597,7 @@ void initputs(const char *buf)
|
||||||
|
|
||||||
Bstrcat(dabuf,buf);
|
Bstrcat(dabuf,buf);
|
||||||
|
|
||||||
if (flushlogwindow || Bstrlen(dabuf) > 768)
|
if (g_logFlushWindow || Bstrlen(dabuf) > 768)
|
||||||
{
|
{
|
||||||
startwin_puts(dabuf);
|
startwin_puts(dabuf);
|
||||||
handleevents();
|
handleevents();
|
||||||
|
@ -691,19 +691,13 @@ int32_t initinput(void)
|
||||||
Win_GetOriginalLayoutName();
|
Win_GetOriginalLayoutName();
|
||||||
Win_SetKeyboardLayoutUS(1);
|
Win_SetKeyboardLayoutUS(1);
|
||||||
|
|
||||||
moustat=0;
|
g_mouseEnabled=0;
|
||||||
memset(keystatus, 0, sizeof(keystatus));
|
memset(keystatus, 0, sizeof(keystatus));
|
||||||
|
|
||||||
if (!keyremapinit)
|
g_keyFIFOend = g_keyAsciiPos = g_keyAsciiEnd = 0;
|
||||||
for (i=0; i<256; i++)
|
|
||||||
keyremap[i]=i;
|
|
||||||
|
|
||||||
keyremapinit=1;
|
|
||||||
keyfifoplc = keyfifoend = 0;
|
|
||||||
keyasciififoplc = keyasciififoend = 0;
|
|
||||||
|
|
||||||
inputdevices = 1|2;
|
inputdevices = 1|2;
|
||||||
joyisgamepad = joynumaxes = joynumbuttons = joynumhats=0;
|
joystick.numAxes = joystick.numButtons = joystick.numHats=0;
|
||||||
|
|
||||||
GetKeyNames();
|
GetKeyNames();
|
||||||
InitDirectInput();
|
InitDirectInput();
|
||||||
|
@ -719,7 +713,7 @@ void uninitinput(void)
|
||||||
{
|
{
|
||||||
Win_SetKeyboardLayoutUS(0);
|
Win_SetKeyboardLayoutUS(0);
|
||||||
|
|
||||||
uninitmouse();
|
mouseUninit();
|
||||||
UninitDirectInput();
|
UninitDirectInput();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -751,7 +745,7 @@ void idle_waitevent_timeout(uint32_t timeout)
|
||||||
//
|
//
|
||||||
// setjoydeadzone() -- sets the dead and saturation zones for the joystick
|
// setjoydeadzone() -- sets the dead and saturation zones for the joystick
|
||||||
//
|
//
|
||||||
void setjoydeadzone(int32_t axis, uint16_t dead, uint16_t satur)
|
void joySetDeadZone(int32_t axis, uint16_t dead, uint16_t satur)
|
||||||
{
|
{
|
||||||
DIPROPDWORD dipdw;
|
DIPROPDWORD dipdw;
|
||||||
HRESULT result;
|
HRESULT result;
|
||||||
|
@ -761,7 +755,7 @@ void setjoydeadzone(int32_t axis, uint16_t dead, uint16_t satur)
|
||||||
if (dead > 10000) dead = 10000;
|
if (dead > 10000) dead = 10000;
|
||||||
if (satur > 10000) satur = 10000;
|
if (satur > 10000) satur = 10000;
|
||||||
if (dead >= satur) dead = satur-100;
|
if (dead >= satur) dead = satur-100;
|
||||||
if (axis >= joynumaxes) return;
|
if (axis >= joystick.numAxes) return;
|
||||||
|
|
||||||
memset(&dipdw, 0, sizeof(dipdw));
|
memset(&dipdw, 0, sizeof(dipdw));
|
||||||
dipdw.diph.dwSize = sizeof(DIPROPDWORD);
|
dipdw.diph.dwSize = sizeof(DIPROPDWORD);
|
||||||
|
@ -801,14 +795,14 @@ void setjoydeadzone(int32_t axis, uint16_t dead, uint16_t satur)
|
||||||
//
|
//
|
||||||
// getjoydeadzone() -- gets the dead and saturation zones for the joystick
|
// getjoydeadzone() -- gets the dead and saturation zones for the joystick
|
||||||
//
|
//
|
||||||
void getjoydeadzone(int32_t axis, uint16_t *dead, uint16_t *satur)
|
void joyGetDeadZone(int32_t axis, uint16_t *dead, uint16_t *satur)
|
||||||
{
|
{
|
||||||
DIPROPDWORD dipdw;
|
DIPROPDWORD dipdw;
|
||||||
HRESULT result;
|
HRESULT result;
|
||||||
|
|
||||||
if (!dead || !satur) return;
|
if (!dead || !satur) return;
|
||||||
if (!lpDID) { *dead = *satur = 0; return; }
|
if (!lpDID) { *dead = *satur = 0; return; }
|
||||||
if (axis >= joynumaxes) { *dead = *satur = 0; return; }
|
if (axis >= joystick.numAxes) { *dead = *satur = 0; return; }
|
||||||
|
|
||||||
memset(&dipdw, 0, sizeof(dipdw));
|
memset(&dipdw, 0, sizeof(dipdw));
|
||||||
dipdw.diph.dwSize = sizeof(DIPROPDWORD);
|
dipdw.diph.dwSize = sizeof(DIPROPDWORD);
|
||||||
|
@ -845,41 +839,41 @@ void getjoydeadzone(int32_t axis, uint16_t *dead, uint16_t *satur)
|
||||||
*satur = dipdw.dwData;
|
*satur = dipdw.dwData;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if 0
|
||||||
void releaseallbuttons(void)
|
void releaseallbuttons(void)
|
||||||
{
|
{
|
||||||
int32_t i;
|
int32_t i;
|
||||||
|
|
||||||
if (mousepresscallback)
|
if (g_mouseCallback)
|
||||||
{
|
{
|
||||||
if (mouseb & 1) mousepresscallback(1, 0);
|
if (g_mouseBits & 1) g_mouseCallback(1, 0);
|
||||||
if (mouseb & 2) mousepresscallback(2, 0);
|
if (g_mouseBits & 2) g_mouseCallback(2, 0);
|
||||||
if (mouseb & 4) mousepresscallback(3, 0);
|
if (g_mouseBits & 4) g_mouseCallback(3, 0);
|
||||||
if (mouseb & 8) mousepresscallback(4, 0);
|
if (g_mouseBits & 8) g_mouseCallback(4, 0);
|
||||||
if (mouseb & 16) mousepresscallback(5, 0);
|
if (g_mouseBits & 16) g_mouseCallback(5, 0);
|
||||||
if (mouseb & 32) mousepresscallback(6, 0);
|
if (g_mouseBits & 32) g_mouseCallback(6, 0);
|
||||||
if (mouseb & 64) mousepresscallback(7, 0);
|
if (g_mouseBits & 64) g_mouseCallback(7, 0);
|
||||||
}
|
}
|
||||||
mouseb = 0;
|
g_mouseBits = 0;
|
||||||
|
|
||||||
if (joypresscallback)
|
if (joystick.pCallback)
|
||||||
{
|
{
|
||||||
for (i=0; i<32; i++)
|
for (i=0; i<32; i++)
|
||||||
if (joyb & (1<<i)) joypresscallback(i+1, 0);
|
if (joystick.bits & (1<<i)) joystick.pCallback(i+1, 0);
|
||||||
}
|
}
|
||||||
joyb = joyblast = 0;
|
joystick.bits = joyblast = 0;
|
||||||
|
|
||||||
for (i=0; i<KEYSTATUSSIZ; i++)
|
for (i=0; i<NUMKEYS; i++)
|
||||||
{
|
{
|
||||||
//if (!keystatus[i]) continue;
|
//if (!keystatus[i]) continue;
|
||||||
//if (OSD_HandleKey(i, 0) != 0) {
|
//if (OSD_HandleKey(i, 0) != 0) {
|
||||||
OSD_HandleScanCode(i, 0);
|
OSD_HandleScanCode(i, 0);
|
||||||
SetKey(i, 0);
|
keySetState(i, 0);
|
||||||
if (keypresscallback) keypresscallback(i, 0);
|
if (keypresscallback) keypresscallback(i, 0);
|
||||||
//}
|
//}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
//
|
//
|
||||||
// InitDirectInput() -- get DirectInput started
|
// InitDirectInput() -- get DirectInput started
|
||||||
|
@ -896,8 +890,7 @@ static BOOL CALLBACK InitDirectInput_enum(LPCDIDEVICEINSTANCE lpddi, LPVOID pvRe
|
||||||
return DIENUM_CONTINUE;
|
return DIENUM_CONTINUE;
|
||||||
|
|
||||||
inputdevices |= 4;
|
inputdevices |= 4;
|
||||||
joyisgamepad = ((lpddi->dwDevType & (DIDEVTYPEJOYSTICK_GAMEPAD<<8)) != 0);
|
d = "CONTROLLER"
|
||||||
d = joyisgamepad ? "GAMEPAD" : "JOYSTICK";
|
|
||||||
Bmemcpy(&guidDevs, &lpddi->guidInstance, sizeof(GUID));
|
Bmemcpy(&guidDevs, &lpddi->guidInstance, sizeof(GUID));
|
||||||
|
|
||||||
initprintf(" * %s: %s\n", d, lpddi->tszProductName);
|
initprintf(" * %s: %s\n", d, lpddi->tszProductName);
|
||||||
|
@ -1043,19 +1036,19 @@ static BOOL InitDirectInput(void)
|
||||||
if (FAILED(result)) { IDirectInputDevice7_Release(dev2); HorribleDInputDeath("Failed getting controller capabilities", result); }
|
if (FAILED(result)) { IDirectInputDevice7_Release(dev2); HorribleDInputDeath("Failed getting controller capabilities", result); }
|
||||||
else if (result != DI_OK) initprintf(" Fetched controller capabilities with warning: %s\n",GetDInputError(result));
|
else if (result != DI_OK) initprintf(" Fetched controller capabilities with warning: %s\n",GetDInputError(result));
|
||||||
|
|
||||||
joynumaxes = (uint8_t)didc.dwAxes;
|
joystick.numAxes = (uint8_t)didc.dwAxes;
|
||||||
joynumbuttons = min(32,(uint8_t)didc.dwButtons);
|
joystick.numButtons = min(32,(uint8_t)didc.dwButtons);
|
||||||
joynumhats = (uint8_t)didc.dwPOVs;
|
joystick.numHats = (uint8_t)didc.dwPOVs;
|
||||||
initprintf("Controller has %d axes, %d buttons, and %d hat(s).\n",joynumaxes,joynumbuttons,joynumhats);
|
initprintf("Controller has %d axes, %d buttons, and %d hat(s).\n",joystick.numAxes,joystick.numButtons,joystick.numHats);
|
||||||
|
|
||||||
axisdefs = (struct _joydef *)Bcalloc(didc.dwAxes, sizeof(struct _joydef));
|
axisdefs = (struct _joydef *)Bcalloc(didc.dwAxes, sizeof(struct _joydef));
|
||||||
buttondefs = (struct _joydef *)Bcalloc(didc.dwButtons, sizeof(struct _joydef));
|
buttondefs = (struct _joydef *)Bcalloc(didc.dwButtons, sizeof(struct _joydef));
|
||||||
if (didc.dwPOVs)
|
if (didc.dwPOVs)
|
||||||
hatdefs = (struct _joydef *)Bcalloc(didc.dwPOVs, sizeof(struct _joydef));
|
hatdefs = (struct _joydef *)Bcalloc(didc.dwPOVs, sizeof(struct _joydef));
|
||||||
|
|
||||||
joyaxis = (int32_t *)Bcalloc(didc.dwAxes, sizeof(int32_t));
|
joystick.pAxis = (int32_t *)Bcalloc(didc.dwAxes, sizeof(int32_t));
|
||||||
if (didc.dwPOVs)
|
if (didc.dwPOVs)
|
||||||
joyhat = (int32_t *)Bcalloc(didc.dwPOVs, sizeof(int32_t));
|
joystick.pHat = (int32_t *)Bcalloc(didc.dwPOVs, sizeof(int32_t));
|
||||||
|
|
||||||
result = IDirectInputDevice7_EnumObjects(dev2, InitDirectInput_enumobjects, (LPVOID)typecounts, DIDFT_ALL);
|
result = IDirectInputDevice7_EnumObjects(dev2, InitDirectInput_enumobjects, (LPVOID)typecounts, DIDFT_ALL);
|
||||||
if (FAILED(result)) { IDirectInputDevice7_Release(dev2); HorribleDInputDeath("Failed getting controller features", result); }
|
if (FAILED(result)) { IDirectInputDevice7_Release(dev2); HorribleDInputDeath("Failed getting controller features", result); }
|
||||||
|
@ -1083,17 +1076,17 @@ static void UninitDirectInput(void)
|
||||||
|
|
||||||
if (axisdefs)
|
if (axisdefs)
|
||||||
{
|
{
|
||||||
for (i=joynumaxes-1; i>=0; i--) Bfree(axisdefs[i].name);
|
for (i=joystick.numAxes-1; i>=0; i--) Bfree(axisdefs[i].name);
|
||||||
DO_FREE_AND_NULL(axisdefs);
|
DO_FREE_AND_NULL(axisdefs);
|
||||||
}
|
}
|
||||||
if (buttondefs)
|
if (buttondefs)
|
||||||
{
|
{
|
||||||
for (i=joynumbuttons-1; i>=0; i--) Bfree(buttondefs[i].name);
|
for (i=joystick.numButtons-1; i>=0; i--) Bfree(buttondefs[i].name);
|
||||||
DO_FREE_AND_NULL(buttondefs);
|
DO_FREE_AND_NULL(buttondefs);
|
||||||
}
|
}
|
||||||
if (hatdefs)
|
if (hatdefs)
|
||||||
{
|
{
|
||||||
for (i=joynumhats-1; i>=0; i--) Bfree(hatdefs[i].name);
|
for (i=joystick.numHats-1; i>=0; i--) Bfree(hatdefs[i].name);
|
||||||
DO_FREE_AND_NULL(hatdefs);
|
DO_FREE_AND_NULL(hatdefs);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1131,29 +1124,29 @@ static void GetKeyNames(void)
|
||||||
int32_t i;
|
int32_t i;
|
||||||
char tbuf[MAX_PATH], *cp;
|
char tbuf[MAX_PATH], *cp;
|
||||||
|
|
||||||
memset(key_names,0,sizeof(key_names));
|
memset(g_keyNameTable,0,sizeof(g_keyNameTable));
|
||||||
|
|
||||||
for (i=0; i<256; i++)
|
for (i=0; i<256; i++)
|
||||||
{
|
{
|
||||||
tbuf[0] = 0;
|
tbuf[0] = 0;
|
||||||
GetKeyNameText((i>128?(i+128):i)<<16, tbuf, sizeof(key_names[i])-1);
|
GetKeyNameText((i>128?(i+128):i)<<16, tbuf, sizeof(g_keyNameTable[i])-1);
|
||||||
Bstrncpy(&key_names[i][0], tbuf, sizeof(key_names[i])-1);
|
Bstrncpy(&g_keyNameTable[i][0], tbuf, sizeof(g_keyNameTable[i])-1);
|
||||||
for (cp=key_names[i]; *cp; cp++)
|
for (cp=g_keyNameTable[i]; *cp; cp++)
|
||||||
if (!(*cp>=32 && *cp<127))
|
if (!(*cp>=32 && *cp<127))
|
||||||
*cp = '?';
|
*cp = '?';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const char *getjoyname(int32_t what, int32_t num)
|
const char *joyGetName(int32_t what, int32_t num)
|
||||||
{
|
{
|
||||||
switch (what)
|
switch (what)
|
||||||
{
|
{
|
||||||
case 0: // axis
|
case 0: // axis
|
||||||
return ((unsigned)num > (unsigned)joynumaxes) ? NULL : (char *)axisdefs[num].name;
|
return ((unsigned)num > (unsigned)joystick.numAxes) ? NULL : (char *)axisdefs[num].name;
|
||||||
case 1: // button
|
case 1: // button
|
||||||
return ((unsigned)num > (unsigned)joynumbuttons) ? NULL : (char *)buttondefs[num].name;
|
return ((unsigned)num > (unsigned)joystick.numButtons) ? NULL : (char *)buttondefs[num].name;
|
||||||
case 2: // hat
|
case 2: // hat
|
||||||
return ((unsigned)num > (unsigned)joynumhats) ? NULL : (char *)hatdefs[num].name;
|
return ((unsigned)num > (unsigned)joystick.numHats) ? NULL : (char *)hatdefs[num].name;
|
||||||
default:
|
default:
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
@ -1195,7 +1188,7 @@ static void AcquireInputDevices(char acquire)
|
||||||
|
|
||||||
di_devacquired = 0;
|
di_devacquired = 0;
|
||||||
|
|
||||||
releaseallbuttons();
|
// releaseallbuttons();
|
||||||
|
|
||||||
if (! *devicedef.did) return;
|
if (! *devicedef.did) return;
|
||||||
|
|
||||||
|
@ -1250,31 +1243,31 @@ static inline void DI_PollJoysticks(void)
|
||||||
int32_t j;
|
int32_t j;
|
||||||
|
|
||||||
// check axes
|
// check axes
|
||||||
for (j=0; j<joynumaxes; j++)
|
for (j=0; j<joystick.numAxes; j++)
|
||||||
{
|
{
|
||||||
if (axisdefs[j].ofs != didod[i].dwOfs) continue;
|
if (axisdefs[j].ofs != didod[i].dwOfs) continue;
|
||||||
joyaxis[j] = didod[i].dwData - 32767;
|
joystick.pAxis[j] = didod[i].dwData - 32767;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (j<joynumaxes) continue;
|
if (j<joystick.numAxes) continue;
|
||||||
|
|
||||||
// check buttons
|
// check buttons
|
||||||
for (j=0; j<joynumbuttons; j++)
|
for (j=0; j<joystick.numButtons; j++)
|
||||||
{
|
{
|
||||||
if (buttondefs[j].ofs != didod[i].dwOfs) continue;
|
if (buttondefs[j].ofs != didod[i].dwOfs) continue;
|
||||||
if (didod[i].dwData & 0x80) joyb |= (1<<j);
|
if (didod[i].dwData & 0x80) joystick.bits |= (1<<j);
|
||||||
else joyb &= ~(1<<j);
|
else joystick.bits &= ~(1<<j);
|
||||||
if (joypresscallback)
|
if (joystick.pCallback)
|
||||||
joypresscallback(j+1, (didod[i].dwData & 0x80)==0x80);
|
joystick.pCallback(j+1, (didod[i].dwData & 0x80)==0x80);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (j<joynumbuttons) continue;
|
if (j<joystick.numButtons) continue;
|
||||||
|
|
||||||
// check hats
|
// check hats
|
||||||
for (j=0; j<joynumhats; j++)
|
for (j=0; j<joystick.numHats; j++)
|
||||||
{
|
{
|
||||||
if (hatdefs[j].ofs != didod[i].dwOfs) continue;
|
if (hatdefs[j].ofs != didod[i].dwOfs) continue;
|
||||||
joyhat[j] = didod[i].dwData;
|
joystick.pHat[j] = didod[i].dwData;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1800,8 +1793,8 @@ void getvalidmodes(void)
|
||||||
for (j=0; j < 2; j++)
|
for (j=0; j < 2; j++)
|
||||||
{
|
{
|
||||||
if (cdepths[j] == 0) continue;
|
if (cdepths[j] == 0) continue;
|
||||||
for (i=0; defaultres[i][0]; i++)
|
for (i=0; g_defaultVideoModes[i].x; i++)
|
||||||
ADDMODE(defaultres[i][0],defaultres[i][1],cdepths[j],1,-1)
|
ADDMODE(g_defaultVideoModes[i].x,g_defaultVideoModes[i].y,cdepths[j],1,-1)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1817,9 +1810,9 @@ void getvalidmodes(void)
|
||||||
for (j=0; j < 2; j++)
|
for (j=0; j < 2; j++)
|
||||||
{
|
{
|
||||||
if (cdepths[j] == 0) continue;
|
if (cdepths[j] == 0) continue;
|
||||||
for (i=0; defaultres[i][0]; i++)
|
for (i=0; g_defaultVideoModes[i].x; i++)
|
||||||
CHECK(defaultres[i][0],defaultres[i][1])
|
CHECK(g_defaultVideoModes[i].x,g_defaultVideoModes[i].y)
|
||||||
ADDMODE(defaultres[i][0],defaultres[i][1],cdepths[j],0,-1)
|
ADDMODE(g_defaultVideoModes[i].x,g_defaultVideoModes[i].y,cdepths[j],0,-1)
|
||||||
}
|
}
|
||||||
|
|
||||||
qsort((void *)validmode, validmodecnt, sizeof(struct validmode_t), &sortmodes);
|
qsort((void *)validmode, validmodecnt, sizeof(struct validmode_t), &sortmodes);
|
||||||
|
@ -3515,9 +3508,9 @@ static LRESULT CALLBACK WndProcCallback(HWND hWnd, UINT uMsg, WPARAM wParam, LPA
|
||||||
{
|
{
|
||||||
if (!appactive && fullscreen)
|
if (!appactive && fullscreen)
|
||||||
{
|
{
|
||||||
if (mousegrab)
|
if (g_mouseGrabbed)
|
||||||
{
|
{
|
||||||
grabmouse(0);
|
mouseGrabInput(0);
|
||||||
regrabmouse = 1;
|
regrabmouse = 1;
|
||||||
}
|
}
|
||||||
realfs = fullscreen;
|
realfs = fullscreen;
|
||||||
|
@ -3529,7 +3522,7 @@ static LRESULT CALLBACK WndProcCallback(HWND hWnd, UINT uMsg, WPARAM wParam, LPA
|
||||||
{
|
{
|
||||||
if (regrabmouse)
|
if (regrabmouse)
|
||||||
{
|
{
|
||||||
grabmouse(AppMouseGrab);
|
mouseGrabInput(g_mouseLockedToWindow);
|
||||||
regrabmouse = 0;
|
regrabmouse = 0;
|
||||||
}
|
}
|
||||||
ShowWindow(hWindow, SW_RESTORE);
|
ShowWindow(hWindow, SW_RESTORE);
|
||||||
|
|
|
@ -1499,7 +1499,7 @@ static void IntegratedHelp(void)
|
||||||
for (i=0; i<IHELP_PATLEN+1; i++) pattern[i]=0;
|
for (i=0; i<IHELP_PATLEN+1; i++) pattern[i]=0;
|
||||||
|
|
||||||
i=0;
|
i=0;
|
||||||
bflushchars();
|
keyFlushChars();
|
||||||
while (bad == 0)
|
while (bad == 0)
|
||||||
{
|
{
|
||||||
_printmessage16("Search: %s_", pattern);
|
_printmessage16("Search: %s_", pattern);
|
||||||
|
@ -1510,7 +1510,7 @@ static void IntegratedHelp(void)
|
||||||
if (handleevents())
|
if (handleevents())
|
||||||
quitevent = 0;
|
quitevent = 0;
|
||||||
|
|
||||||
ch = bgetchar();
|
ch = keyGetChar();
|
||||||
|
|
||||||
if (keystatus[1]) bad = 1;
|
if (keystatus[1]) bad = 1;
|
||||||
else if (ch == 13) bad = 2;
|
else if (ch == 13) bad = 2;
|
||||||
|
@ -1971,14 +1971,14 @@ static void SoundDisplay(void)
|
||||||
showframe(1);
|
showframe(1);
|
||||||
|
|
||||||
i=0;
|
i=0;
|
||||||
bflushchars();
|
keyFlushChars();
|
||||||
while (bad == 0)
|
while (bad == 0)
|
||||||
{
|
{
|
||||||
idle_waitevent();
|
idle_waitevent();
|
||||||
if (handleevents())
|
if (handleevents())
|
||||||
quitevent = 0;
|
quitevent = 0;
|
||||||
|
|
||||||
ch = bgetchar();
|
ch = keyGetChar();
|
||||||
|
|
||||||
if (keystatus[1]) bad = 1;
|
if (keystatus[1]) bad = 1;
|
||||||
|
|
||||||
|
@ -2743,12 +2743,12 @@ static int32_t m32gettile(int32_t idInitialTile)
|
||||||
scrollmode = !(eitherCTRL^revertCTRL);
|
scrollmode = !(eitherCTRL^revertCTRL);
|
||||||
if (bstatus&16 && scrollmode && iTopLeftTile > 0)
|
if (bstatus&16 && scrollmode && iTopLeftTile > 0)
|
||||||
{
|
{
|
||||||
mouseb &= ~16;
|
g_mouseBits &= ~16;
|
||||||
iTopLeftTile -= (nXTiles*scrollamount);
|
iTopLeftTile -= (nXTiles*scrollamount);
|
||||||
}
|
}
|
||||||
else if (bstatus&32 && scrollmode && iTopLeftTile < localartlookupnum-nDisplayedTiles-1)
|
else if (bstatus&32 && scrollmode && iTopLeftTile < localartlookupnum-nDisplayedTiles-1)
|
||||||
{
|
{
|
||||||
mouseb &= ~32;
|
g_mouseBits &= ~32;
|
||||||
iTopLeftTile += (nXTiles*scrollamount);
|
iTopLeftTile += (nXTiles*scrollamount);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2769,7 +2769,7 @@ static int32_t m32gettile(int32_t idInitialTile)
|
||||||
{
|
{
|
||||||
if (PRESSED_KEYSC(gSLASH) || (!scrollmode && bstatus&16))
|
if (PRESSED_KEYSC(gSLASH) || (!scrollmode && bstatus&16))
|
||||||
{
|
{
|
||||||
mouseb &= ~16;
|
g_mouseBits &= ~16;
|
||||||
bstatus &= ~16;
|
bstatus &= ~16;
|
||||||
|
|
||||||
// Watch out : If editor window is small, then the next zoom level
|
// Watch out : If editor window is small, then the next zoom level
|
||||||
|
@ -2783,7 +2783,7 @@ static int32_t m32gettile(int32_t idInitialTile)
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
keystatus[KEYSC_gSTAR] = 0;
|
keystatus[KEYSC_gSTAR] = 0;
|
||||||
mouseb &= ~32;
|
g_mouseBits &= ~32;
|
||||||
bstatus &= ~32;
|
bstatus &= ~32;
|
||||||
s_Zoom--;
|
s_Zoom--;
|
||||||
}
|
}
|
||||||
|
@ -2966,7 +2966,7 @@ static int32_t m32gettile(int32_t idInitialTile)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
mousex = mousey = mouseb = 0;
|
g_mousePos.x = g_mousePos.y = g_mouseBits = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
|
@ -3269,7 +3269,7 @@ static int32_t OnSelectTile(int32_t tileNum)
|
||||||
|
|
||||||
SelectAllTiles(tileNum);
|
SelectAllTiles(tileNum);
|
||||||
|
|
||||||
bflushchars();
|
keyFlushChars();
|
||||||
|
|
||||||
setpolymost2dview();
|
setpolymost2dview();
|
||||||
#ifdef USE_OPENGL
|
#ifdef USE_OPENGL
|
||||||
|
@ -3314,7 +3314,7 @@ static int32_t OnSelectTile(int32_t tileNum)
|
||||||
}
|
}
|
||||||
showframe(1);
|
showframe(1);
|
||||||
|
|
||||||
ch = bgetchar();
|
ch = keyGetChar();
|
||||||
|
|
||||||
for (i = 0; i < tile_groups; i++)
|
for (i = 0; i < tile_groups; i++)
|
||||||
{
|
{
|
||||||
|
@ -3575,7 +3575,7 @@ restart:
|
||||||
|
|
||||||
tilescreen_drawrest(iSelected, showmsg);
|
tilescreen_drawrest(iSelected, showmsg);
|
||||||
|
|
||||||
k = (mousex || mousey || mouseb);
|
k = (g_mousePos.x || g_mousePos.y || g_mouseBits);
|
||||||
if (!k)
|
if (!k)
|
||||||
for (i=0; i<(signed)ARRAY_SIZE(keystatus); i++)
|
for (i=0; i<(signed)ARRAY_SIZE(keystatus); i++)
|
||||||
if (keystatus[i])
|
if (keystatus[i])
|
||||||
|
@ -3758,7 +3758,7 @@ static void getnumberptr256(const char *namestart, void *num, int32_t bytes, int
|
||||||
}
|
}
|
||||||
|
|
||||||
oldnum = danum;
|
oldnum = danum;
|
||||||
bflushchars();
|
keyFlushChars();
|
||||||
while (keystatus[0x1] == 0)
|
while (keystatus[0x1] == 0)
|
||||||
{
|
{
|
||||||
if (handleevents())
|
if (handleevents())
|
||||||
|
@ -3766,13 +3766,13 @@ static void getnumberptr256(const char *namestart, void *num, int32_t bytes, int
|
||||||
|
|
||||||
M32_DrawRoomsAndMasks();
|
M32_DrawRoomsAndMasks();
|
||||||
|
|
||||||
ch = bgetchar();
|
ch = keyGetChar();
|
||||||
|
|
||||||
if (keystatus[0x1]) break;
|
if (keystatus[0x1]) break;
|
||||||
|
|
||||||
clearkeys();
|
clearkeys();
|
||||||
|
|
||||||
mouseb = 0;
|
g_mouseBits = 0;
|
||||||
searchx = osearchx;
|
searchx = osearchx;
|
||||||
searchy = osearchy;
|
searchy = osearchy;
|
||||||
|
|
||||||
|
@ -3921,7 +3921,7 @@ ENDFOR1:
|
||||||
sp->pal = 0;
|
sp->pal = 0;
|
||||||
sp->cstat = 18;
|
sp->cstat = 18;
|
||||||
|
|
||||||
bflushchars();
|
keyFlushChars();
|
||||||
while (keystatus[0x1] == 0)
|
while (keystatus[0x1] == 0)
|
||||||
{
|
{
|
||||||
if (handleevents())
|
if (handleevents())
|
||||||
|
@ -3960,13 +3960,13 @@ ENDFOR1:
|
||||||
|
|
||||||
M32_DrawRoomsAndMasks();
|
M32_DrawRoomsAndMasks();
|
||||||
|
|
||||||
ch = bgetchar();
|
ch = keyGetChar();
|
||||||
|
|
||||||
if (keystatus[0x1]) break;
|
if (keystatus[0x1]) break;
|
||||||
|
|
||||||
clearkeys();
|
clearkeys();
|
||||||
|
|
||||||
mouseb = 0;
|
g_mouseBits = 0;
|
||||||
searchx = osearchx;
|
searchx = osearchx;
|
||||||
searchy = osearchy;
|
searchy = osearchy;
|
||||||
|
|
||||||
|
@ -5011,7 +5011,7 @@ static void Keys3d(void)
|
||||||
|
|
||||||
if (tsign)
|
if (tsign)
|
||||||
{
|
{
|
||||||
mouseb &= ~(16|32);
|
g_mouseBits &= ~(16|32);
|
||||||
bstatus &= ~(16|32);
|
bstatus &= ~(16|32);
|
||||||
|
|
||||||
if (eitherALT) //ALT
|
if (eitherALT) //ALT
|
||||||
|
@ -5143,7 +5143,7 @@ static void Keys3d(void)
|
||||||
asksave = 1;
|
asksave = 1;
|
||||||
}
|
}
|
||||||
keystatus[KEYSC_DASH] = keystatus[KEYSC_EQUAL] = 0;
|
keystatus[KEYSC_DASH] = keystatus[KEYSC_EQUAL] = 0;
|
||||||
mouseb &= ~(16|32);
|
g_mouseBits &= ~(16|32);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (PRESSED_KEYSC(E)) // E (expand)
|
if (PRESSED_KEYSC(E)) // E (expand)
|
||||||
|
@ -5244,10 +5244,10 @@ static void Keys3d(void)
|
||||||
mouseaction=0;
|
mouseaction=0;
|
||||||
if (eitherALT && (bstatus&1))
|
if (eitherALT && (bstatus&1))
|
||||||
{
|
{
|
||||||
mousex=0; mskip=1;
|
g_mousePos.x=0; mskip=1;
|
||||||
if (mousey!=0)
|
if (g_mousePos.y!=0)
|
||||||
{
|
{
|
||||||
updownunits=klabs(mousey*128);
|
updownunits=klabs(g_mousePos.y*128);
|
||||||
mouseaction=1;
|
mouseaction=1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -5257,8 +5257,8 @@ static void Keys3d(void)
|
||||||
if (ASSERT_AIMING)
|
if (ASSERT_AIMING)
|
||||||
{
|
{
|
||||||
// PK: PGUP/PGDN, rmb only & mwheel
|
// PK: PGUP/PGDN, rmb only & mwheel
|
||||||
tsign -= (PRESSED_KEYSC(PGUP) || (mouseaction && mousey<0) || ((bstatus&(16|2|1))==(16|2)));
|
tsign -= (PRESSED_KEYSC(PGUP) || (mouseaction && g_mousePos.y<0) || ((bstatus&(16|2|1))==(16|2)));
|
||||||
tsign += (PRESSED_KEYSC(PGDN) || (mouseaction && mousey>0) || ((bstatus&(32|2|1))==(32|2)));
|
tsign += (PRESSED_KEYSC(PGDN) || (mouseaction && g_mousePos.y>0) || ((bstatus&(32|2|1))==(32|2)));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (tsign)
|
if (tsign)
|
||||||
|
@ -5424,7 +5424,7 @@ static void Keys3d(void)
|
||||||
}
|
}
|
||||||
|
|
||||||
asksave = 1;
|
asksave = 1;
|
||||||
mouseb &= ~(16|32);
|
g_mouseBits &= ~(16|32);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* end Mapster32 */
|
/* end Mapster32 */
|
||||||
|
@ -5919,10 +5919,10 @@ static void Keys3d(void)
|
||||||
|
|
||||||
if (eitherCTRL && !eitherSHIFT && (bstatus&1) && AIMING_AT_CEILING_OR_FLOOR)
|
if (eitherCTRL && !eitherSHIFT && (bstatus&1) && AIMING_AT_CEILING_OR_FLOOR)
|
||||||
{
|
{
|
||||||
mousex=0; mskip=1;
|
g_mousePos.x=0; mskip=1;
|
||||||
if (mousey)
|
if (g_mousePos.y)
|
||||||
{
|
{
|
||||||
i=klabs(mousey*2);
|
i=klabs(g_mousePos.y*2);
|
||||||
mouseaction=1;
|
mouseaction=1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -5930,8 +5930,8 @@ static void Keys3d(void)
|
||||||
tsign = 0;
|
tsign = 0;
|
||||||
if (ASSERT_AIMING)
|
if (ASSERT_AIMING)
|
||||||
{
|
{
|
||||||
tsign -= (PRESSED_KEYSC(LBRACK) || (mouseaction && mousey<0)); // [
|
tsign -= (PRESSED_KEYSC(LBRACK) || (mouseaction && g_mousePos.y<0)); // [
|
||||||
tsign += (PRESSED_KEYSC(RBRACK) || (mouseaction && mousey>0)); // ]
|
tsign += (PRESSED_KEYSC(RBRACK) || (mouseaction && g_mousePos.y>0)); // ]
|
||||||
}
|
}
|
||||||
|
|
||||||
if (tsign)
|
if (tsign)
|
||||||
|
@ -6005,7 +6005,7 @@ static void Keys3d(void)
|
||||||
if ((bstatus&1) && eitherSHIFT)
|
if ((bstatus&1) && eitherSHIFT)
|
||||||
mskip=1;
|
mskip=1;
|
||||||
|
|
||||||
if ((bstatus&1) && eitherSHIFT && AIMING_AT_CEILING_OR_FLOOR && (mousex|mousey))
|
if ((bstatus&1) && eitherSHIFT && AIMING_AT_CEILING_OR_FLOOR && (g_mousePos.x|g_mousePos.y))
|
||||||
{
|
{
|
||||||
int32_t fw,x1,y1,x2,y2,stat,ma,a=0;
|
int32_t fw,x1,y1,x2,y2,stat,ma,a=0;
|
||||||
|
|
||||||
|
@ -6017,7 +6017,7 @@ static void Keys3d(void)
|
||||||
x2=POINT2(fw).x,y2=POINT2(fw).y;
|
x2=POINT2(fw).x,y2=POINT2(fw).y;
|
||||||
a=getangle(x1-x2,y1-y2);
|
a=getangle(x1-x2,y1-y2);
|
||||||
}
|
}
|
||||||
mouseax+=mousex; mouseay+=mousey;
|
mouseax+=g_mousePos.x; mouseay+=g_mousePos.y;
|
||||||
ma = getangle(mouseax,mouseay);
|
ma = getangle(mouseax,mouseay);
|
||||||
ma += ang-a;
|
ma += ang-a;
|
||||||
|
|
||||||
|
@ -6082,8 +6082,8 @@ static void Keys3d(void)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
mousex=0;
|
g_mousePos.x=0;
|
||||||
mousey=0;
|
g_mousePos.y=0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -6094,7 +6094,7 @@ static void Keys3d(void)
|
||||||
updownunits=1;
|
updownunits=1;
|
||||||
mouseaction=0;
|
mouseaction=0;
|
||||||
|
|
||||||
if (!mouseb)
|
if (!g_mouseBits)
|
||||||
{
|
{
|
||||||
mouseax=0;
|
mouseax=0;
|
||||||
mouseay=0;
|
mouseay=0;
|
||||||
|
@ -6105,10 +6105,10 @@ static void Keys3d(void)
|
||||||
if (eitherSHIFT)
|
if (eitherSHIFT)
|
||||||
{
|
{
|
||||||
mskip=1;
|
mskip=1;
|
||||||
if (mousex)
|
if (g_mousePos.x)
|
||||||
{
|
{
|
||||||
mouseaction = 1;
|
mouseaction = 1;
|
||||||
mouseax += mousex;
|
mouseax += g_mousePos.x;
|
||||||
updownunits = klabs(mouseax/2);
|
updownunits = klabs(mouseax/2);
|
||||||
if (updownunits)
|
if (updownunits)
|
||||||
mouseax=0;
|
mouseax=0;
|
||||||
|
@ -6117,11 +6117,11 @@ static void Keys3d(void)
|
||||||
else if (eitherCTRL && !eitherALT)
|
else if (eitherCTRL && !eitherALT)
|
||||||
{
|
{
|
||||||
mskip=1;
|
mskip=1;
|
||||||
if (mousex)
|
if (g_mousePos.x)
|
||||||
{
|
{
|
||||||
mouseaction = 2;
|
mouseaction = 2;
|
||||||
repeatpanalign = 0;
|
repeatpanalign = 0;
|
||||||
updownunits = klabs(mouseax+=mousex)/(16 - 12*AIMING_AT_SPRITE);
|
updownunits = klabs(mouseax+=g_mousePos.x)/(16 - 12*AIMING_AT_SPRITE);
|
||||||
if (updownunits)
|
if (updownunits)
|
||||||
mouseax=0;
|
mouseax=0;
|
||||||
}
|
}
|
||||||
|
@ -6133,9 +6133,9 @@ static void Keys3d(void)
|
||||||
if (repeatcountx == 0 || repeatcountx > 32 || mouseaction)
|
if (repeatcountx == 0 || repeatcountx > 32 || mouseaction)
|
||||||
{
|
{
|
||||||
changedir = 0;
|
changedir = 0;
|
||||||
if (keystatus[KEYSC_gLEFT] || mousex>0)
|
if (keystatus[KEYSC_gLEFT] || g_mousePos.x>0)
|
||||||
changedir = -1;
|
changedir = -1;
|
||||||
if (keystatus[KEYSC_gRIGHT] || mousex<0)
|
if (keystatus[KEYSC_gRIGHT] || g_mousePos.x<0)
|
||||||
changedir = 1;
|
changedir = 1;
|
||||||
|
|
||||||
if (AIMING_AT_WALL_OR_MASK)
|
if (AIMING_AT_WALL_OR_MASK)
|
||||||
|
@ -6189,7 +6189,7 @@ static void Keys3d(void)
|
||||||
static int32_t sumxvect=0, sumyvect=0;
|
static int32_t sumxvect=0, sumyvect=0;
|
||||||
|
|
||||||
if (mouseaction==1)
|
if (mouseaction==1)
|
||||||
mouseaction_movesprites(&sumxvect, &sumyvect, 1536, mousex);
|
mouseaction_movesprites(&sumxvect, &sumyvect, 1536, g_mousePos.x);
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
sumxvect = sumyvect = 0;
|
sumxvect = sumyvect = 0;
|
||||||
|
@ -6222,23 +6222,23 @@ static void Keys3d(void)
|
||||||
if (eitherSHIFT)
|
if (eitherSHIFT)
|
||||||
{
|
{
|
||||||
mskip=1;
|
mskip=1;
|
||||||
if (mousey)
|
if (g_mousePos.y)
|
||||||
{
|
{
|
||||||
mouseaction = 1;
|
mouseaction = 1;
|
||||||
updownunits = klabs(mousey);
|
updownunits = klabs(g_mousePos.y);
|
||||||
|
|
||||||
if (!AIMING_AT_SPRITE)
|
if (!AIMING_AT_SPRITE)
|
||||||
updownunits = klabs((int32_t)(mousey*128./tilesiz[wall[searchwall].picnum].y));
|
updownunits = klabs((int32_t)(g_mousePos.y*128./tilesiz[wall[searchwall].picnum].y));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (eitherCTRL && !eitherALT)
|
else if (eitherCTRL && !eitherALT)
|
||||||
{
|
{
|
||||||
mskip=1;
|
mskip=1;
|
||||||
if (mousey)
|
if (g_mousePos.y)
|
||||||
{
|
{
|
||||||
mouseaction = 2;
|
mouseaction = 2;
|
||||||
repeatpanalign = 0;
|
repeatpanalign = 0;
|
||||||
mouseay += mousey;
|
mouseay += g_mousePos.y;
|
||||||
updownunits = klabs(mouseay)/(32 - 28*AIMING_AT_SPRITE);
|
updownunits = klabs(mouseay)/(32 - 28*AIMING_AT_SPRITE);
|
||||||
if (updownunits)
|
if (updownunits)
|
||||||
mouseay=0;
|
mouseay=0;
|
||||||
|
@ -6246,7 +6246,7 @@ static void Keys3d(void)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!mouseb)
|
if (!g_mouseBits)
|
||||||
{
|
{
|
||||||
mouseax=0;
|
mouseax=0;
|
||||||
mouseay=0;
|
mouseay=0;
|
||||||
|
@ -6257,9 +6257,9 @@ static void Keys3d(void)
|
||||||
if (repeatcounty == 0 || repeatcounty > 32 || mouseaction)
|
if (repeatcounty == 0 || repeatcounty > 32 || mouseaction)
|
||||||
{
|
{
|
||||||
changedir = 0;
|
changedir = 0;
|
||||||
if (keystatus[KEYSC_gUP] || mousey>0)
|
if (keystatus[KEYSC_gUP] || g_mousePos.y>0)
|
||||||
changedir = -1;
|
changedir = -1;
|
||||||
if (keystatus[KEYSC_gDOWN] || mousey<0)
|
if (keystatus[KEYSC_gDOWN] || g_mousePos.y<0)
|
||||||
changedir = 1;
|
changedir = 1;
|
||||||
|
|
||||||
if (AIMING_AT_WALL_OR_MASK)
|
if (AIMING_AT_WALL_OR_MASK)
|
||||||
|
@ -6298,7 +6298,7 @@ static void Keys3d(void)
|
||||||
static int32_t sumxvect=0, sumyvect=0;
|
static int32_t sumxvect=0, sumyvect=0;
|
||||||
|
|
||||||
if (mouseaction==1)
|
if (mouseaction==1)
|
||||||
mouseaction_movesprites(&sumxvect, &sumyvect, 2048, mousey);
|
mouseaction_movesprites(&sumxvect, &sumyvect, 2048, g_mousePos.y);
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
sumxvect = sumyvect = 0;
|
sumxvect = sumyvect = 0;
|
||||||
|
@ -10853,7 +10853,7 @@ void ExtCheckKeys(void)
|
||||||
}
|
}
|
||||||
|
|
||||||
lastbstatus = bstatus;
|
lastbstatus = bstatus;
|
||||||
readmousebstatus(&bstatus);
|
mouseReadButtons(&bstatus);
|
||||||
|
|
||||||
Keys2d3d();
|
Keys2d3d();
|
||||||
|
|
||||||
|
|
|
@ -6358,7 +6358,7 @@ int app_main(int argc, char const * const * argv)
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
flushlogwindow = 0;
|
g_logFlushWindow = 0;
|
||||||
G_LoadGroups(!g_noAutoLoad && !ud.config.NoAutoLoad);
|
G_LoadGroups(!g_noAutoLoad && !ud.config.NoAutoLoad);
|
||||||
// flushlogwindow = 1;
|
// flushlogwindow = 1;
|
||||||
|
|
||||||
|
@ -6517,8 +6517,8 @@ int app_main(int argc, char const * const * argv)
|
||||||
CONTROL_MouseEnabled = (ud.config.UseMouse && CONTROL_MousePresent);
|
CONTROL_MouseEnabled = (ud.config.UseMouse && CONTROL_MousePresent);
|
||||||
|
|
||||||
// JBF 20040215: evil and nasty place to do this, but joysticks are evil and nasty too
|
// JBF 20040215: evil and nasty place to do this, but joysticks are evil and nasty too
|
||||||
for (bssize_t i=0; i<joynumaxes; i++)
|
for (bssize_t i=0; i<joystick.numAxes; i++)
|
||||||
setjoydeadzone(i,ud.config.JoystickAnalogueDead[i],ud.config.JoystickAnalogueSaturate[i]);
|
joySetDeadZone(i,ud.config.JoystickAnalogueDead[i],ud.config.JoystickAnalogueSaturate[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef HAVE_CLIPSHAPE_FEATURE
|
#ifdef HAVE_CLIPSHAPE_FEATURE
|
||||||
|
|
|
@ -6625,7 +6625,7 @@ void C_Compile(const char *fileName)
|
||||||
|
|
||||||
initprintf("Compiling: %s (%d bytes)\n", fileName, kFileLen);
|
initprintf("Compiling: %s (%d bytes)\n", fileName, kFileLen);
|
||||||
|
|
||||||
flushlogwindow = 0;
|
g_logFlushWindow = 0;
|
||||||
|
|
||||||
uint32_t const startcompiletime = getticks();
|
uint32_t const startcompiletime = getticks();
|
||||||
|
|
||||||
|
@ -6663,7 +6663,7 @@ void C_Compile(const char *fileName)
|
||||||
}
|
}
|
||||||
g_scriptModules.clear();
|
g_scriptModules.clear();
|
||||||
|
|
||||||
flushlogwindow = 1;
|
g_logFlushWindow = 1;
|
||||||
|
|
||||||
if (g_errorCnt > 63)
|
if (g_errorCnt > 63)
|
||||||
initprintf("fatal error: too many errors: Aborted\n");
|
initprintf("fatal error: too many errors: Aborted\n");
|
||||||
|
|
|
@ -34,7 +34,7 @@ int32_t I_CheckAllInput(void)
|
||||||
{
|
{
|
||||||
return (
|
return (
|
||||||
#if defined EDUKE32_IOS
|
#if defined EDUKE32_IOS
|
||||||
mousepressstate == Mouse_Pressed ||
|
g_mouseClickState == MOUSE_PRESSED ||
|
||||||
#endif
|
#endif
|
||||||
KB_KeyWaiting() ||
|
KB_KeyWaiting() ||
|
||||||
MOUSE_GetButtons() ||
|
MOUSE_GetButtons() ||
|
||||||
|
@ -44,7 +44,7 @@ int32_t I_CheckAllInput(void)
|
||||||
void I_ClearAllInput(void)
|
void I_ClearAllInput(void)
|
||||||
{
|
{
|
||||||
#if defined EDUKE32_IOS
|
#if defined EDUKE32_IOS
|
||||||
mousepressstateadvance();
|
mouseAdvanceClickState();
|
||||||
#endif
|
#endif
|
||||||
KB_FlushKeyboardQueue();
|
KB_FlushKeyboardQueue();
|
||||||
KB_ClearKeysDown();
|
KB_ClearKeysDown();
|
||||||
|
|
|
@ -1633,7 +1633,7 @@ void Menu_Init(void)
|
||||||
MEOS_Gamefuncs.numOptions = k;
|
MEOS_Gamefuncs.numOptions = k;
|
||||||
|
|
||||||
for (i = 0; i < NUMKEYS; ++i)
|
for (i = 0; i < NUMKEYS; ++i)
|
||||||
MEOSN_Keys[i] = key_names[i];
|
MEOSN_Keys[i] = g_keyNameTable[i];
|
||||||
MEOSN_Keys[NUMKEYS-1] = MenuKeyNone;
|
MEOSN_Keys[NUMKEYS-1] = MenuKeyNone;
|
||||||
|
|
||||||
|
|
||||||
|
@ -1761,18 +1761,18 @@ void Menu_Init(void)
|
||||||
MEO_MOUSESETUPBTNS[i] = MEO_MOUSEJOYSETUPBTNS_TEMPLATE;
|
MEO_MOUSESETUPBTNS[i] = MEO_MOUSEJOYSETUPBTNS_TEMPLATE;
|
||||||
MEO_MOUSESETUPBTNS[i].data = &ud.config.MouseFunctions[MenuMouseDataIndex[i][0]][MenuMouseDataIndex[i][1]];
|
MEO_MOUSESETUPBTNS[i].data = &ud.config.MouseFunctions[MenuMouseDataIndex[i][0]][MenuMouseDataIndex[i][1]];
|
||||||
}
|
}
|
||||||
for (i = 0; i < 2*joynumbuttons + 8*joynumhats; ++i)
|
for (i = 0; i < 2*joystick.numButtons + 8*joystick.numHats; ++i)
|
||||||
{
|
{
|
||||||
if (i < 2*joynumbuttons)
|
if (i < 2*joystick.numButtons)
|
||||||
{
|
{
|
||||||
if (i & 1)
|
if (i & 1)
|
||||||
Bsnprintf(MenuJoystickNames[i], MAXJOYBUTTONSTRINGLENGTH, "Double %s", getjoyname(1, i>>1));
|
Bsnprintf(MenuJoystickNames[i], MAXJOYBUTTONSTRINGLENGTH, "Double %s", joyGetName(1, i>>1));
|
||||||
else
|
else
|
||||||
Bstrncpy(MenuJoystickNames[i], getjoyname(1, i>>1), MAXJOYBUTTONSTRINGLENGTH);
|
Bstrncpy(MenuJoystickNames[i], joyGetName(1, i>>1), MAXJOYBUTTONSTRINGLENGTH);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Bsnprintf(MenuJoystickNames[i], MAXJOYBUTTONSTRINGLENGTH, (i & 1) ? "Double Hat %d %s" : "Hat %d %s", ((i - 2*joynumbuttons)>>3), MenuJoystickHatDirections[((i - 2*joynumbuttons)>>1) % 4]);
|
Bsnprintf(MenuJoystickNames[i], MAXJOYBUTTONSTRINGLENGTH, (i & 1) ? "Double Hat %d %s" : "Hat %d %s", ((i - 2*joystick.numButtons)>>3), MenuJoystickHatDirections[((i - 2*joystick.numButtons)>>1) % 4]);
|
||||||
}
|
}
|
||||||
|
|
||||||
MEL_JOYSTICKBTNS[i] = &ME_JOYSTICKBTNS[i];
|
MEL_JOYSTICKBTNS[i] = &ME_JOYSTICKBTNS[i];
|
||||||
|
@ -1782,15 +1782,15 @@ void Menu_Init(void)
|
||||||
MEO_JOYSTICKBTNS[i] = MEO_MOUSEJOYSETUPBTNS_TEMPLATE;
|
MEO_JOYSTICKBTNS[i] = MEO_MOUSEJOYSETUPBTNS_TEMPLATE;
|
||||||
MEO_JOYSTICKBTNS[i].data = &ud.config.JoystickFunctions[i>>1][i&1];
|
MEO_JOYSTICKBTNS[i].data = &ud.config.JoystickFunctions[i>>1][i&1];
|
||||||
}
|
}
|
||||||
M_JOYSTICKBTNS.numEntries = 2*joynumbuttons + 8*joynumhats;
|
M_JOYSTICKBTNS.numEntries = 2*joystick.numButtons + 8*joystick.numHats;
|
||||||
for (i = 0; i < joynumaxes; ++i)
|
for (i = 0; i < joystick.numAxes; ++i)
|
||||||
{
|
{
|
||||||
ME_JOYSTICKAXES[i] = ME_JOYSTICKAXES_TEMPLATE;
|
ME_JOYSTICKAXES[i] = ME_JOYSTICKAXES_TEMPLATE;
|
||||||
Bstrncpy(MenuJoystickAxes[i], getjoyname(0, i), MAXJOYBUTTONSTRINGLENGTH);
|
Bstrncpy(MenuJoystickAxes[i], joyGetName(0, i), MAXJOYBUTTONSTRINGLENGTH);
|
||||||
ME_JOYSTICKAXES[i].name = MenuJoystickAxes[i];
|
ME_JOYSTICKAXES[i].name = MenuJoystickAxes[i];
|
||||||
MEL_JOYSTICKAXES[i] = &ME_JOYSTICKAXES[i];
|
MEL_JOYSTICKAXES[i] = &ME_JOYSTICKAXES[i];
|
||||||
}
|
}
|
||||||
M_JOYSTICKAXES.numEntries = joynumaxes;
|
M_JOYSTICKAXES.numEntries = joystick.numAxes;
|
||||||
|
|
||||||
// prepare video setup
|
// prepare video setup
|
||||||
for (i = 0; i < validmodecnt; ++i)
|
for (i = 0; i < validmodecnt; ++i)
|
||||||
|
@ -3000,7 +3000,7 @@ static void Menu_EntryLinkActivate(MenuEntry_t *entry)
|
||||||
}
|
}
|
||||||
|
|
||||||
case MENU_JOYSTICKAXES:
|
case MENU_JOYSTICKAXES:
|
||||||
M_JOYSTICKAXIS.title = getjoyname(0, M_JOYSTICKAXES.currentEntry);
|
M_JOYSTICKAXIS.title = joyGetName(0, M_JOYSTICKAXES.currentEntry);
|
||||||
MEO_JOYSTICKAXIS_ANALOG.data = &ud.config.JoystickAnalogueAxes[M_JOYSTICKAXES.currentEntry];
|
MEO_JOYSTICKAXIS_ANALOG.data = &ud.config.JoystickAnalogueAxes[M_JOYSTICKAXES.currentEntry];
|
||||||
MEO_JOYSTICKAXIS_SCALE.variable = &ud.config.JoystickAnalogueScale[M_JOYSTICKAXES.currentEntry];
|
MEO_JOYSTICKAXIS_SCALE.variable = &ud.config.JoystickAnalogueScale[M_JOYSTICKAXES.currentEntry];
|
||||||
MEO_JOYSTICKAXIS_DEAD.variable = &ud.config.JoystickAnalogueDead[M_JOYSTICKAXES.currentEntry];
|
MEO_JOYSTICKAXIS_DEAD.variable = &ud.config.JoystickAnalogueDead[M_JOYSTICKAXES.currentEntry];
|
||||||
|
@ -3327,9 +3327,9 @@ static int32_t Menu_EntryRangeInt32Modify(MenuEntry_t *entry, int32_t newValue)
|
||||||
else if (entry == &ME_JOYSTICKAXIS_SCALE)
|
else if (entry == &ME_JOYSTICKAXIS_SCALE)
|
||||||
CONTROL_SetAnalogAxisScale(M_JOYSTICKAXES.currentEntry, newValue, controldevice_joystick);
|
CONTROL_SetAnalogAxisScale(M_JOYSTICKAXES.currentEntry, newValue, controldevice_joystick);
|
||||||
else if (entry == &ME_JOYSTICKAXIS_DEAD)
|
else if (entry == &ME_JOYSTICKAXIS_DEAD)
|
||||||
setjoydeadzone(M_JOYSTICKAXES.currentEntry, newValue, *MEO_JOYSTICKAXIS_SATU.variable);
|
joySetDeadZone(M_JOYSTICKAXES.currentEntry, newValue, *MEO_JOYSTICKAXIS_SATU.variable);
|
||||||
else if (entry == &ME_JOYSTICKAXIS_SATU)
|
else if (entry == &ME_JOYSTICKAXIS_SATU)
|
||||||
setjoydeadzone(M_JOYSTICKAXES.currentEntry, *MEO_JOYSTICKAXIS_DEAD.variable, newValue);
|
joySetDeadZone(M_JOYSTICKAXES.currentEntry, *MEO_JOYSTICKAXIS_DEAD.variable, newValue);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -3638,7 +3638,7 @@ static void Menu_TextFormSubmit(char *input)
|
||||||
|
|
||||||
int8_t cheatID = -1;
|
int8_t cheatID = -1;
|
||||||
|
|
||||||
if (inputlength > 2 && tempbuf[0] == scantoasc[CheatKeys[0]] && tempbuf[1] == scantoasc[CheatKeys[1]])
|
if (inputlength > 2 && tempbuf[0] == g_keyAsciiTable[CheatKeys[0]] && tempbuf[1] == g_keyAsciiTable[CheatKeys[1]])
|
||||||
{
|
{
|
||||||
for (size_t i = 0; i < NUMCHEATS; i++)
|
for (size_t i = 0; i < NUMCHEATS; i++)
|
||||||
if (Menu_CheatStringMatch(tempbuf+2, CheatStrings[i]))
|
if (Menu_CheatStringMatch(tempbuf+2, CheatStrings[i]))
|
||||||
|
@ -4317,14 +4317,14 @@ void Menu_Open(size_t playerID)
|
||||||
{
|
{
|
||||||
g_player[playerID].ps->gm |= MODE_MENU;
|
g_player[playerID].ps->gm |= MODE_MENU;
|
||||||
|
|
||||||
readmouseabsxy(&m_prevmousepos, &mouseabs);
|
mouseReadAbs(&m_prevmousepos, &g_mouseAbs);
|
||||||
m_mouselastactivity = -M_MOUSETIMEOUT;
|
m_mouselastactivity = -M_MOUSETIMEOUT;
|
||||||
|
|
||||||
#if !defined EDUKE32_TOUCH_DEVICES
|
#if !defined EDUKE32_TOUCH_DEVICES
|
||||||
m_mousewake_watchpoint = 0;
|
m_mousewake_watchpoint = 0;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
AppGrabMouse(0);
|
mouseLockToWindow(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Menu_Close(size_t playerID)
|
void Menu_Close(size_t playerID)
|
||||||
|
@ -4333,7 +4333,7 @@ void Menu_Close(size_t playerID)
|
||||||
{
|
{
|
||||||
// The following lines are here so that you cannot close the menu when no game is running.
|
// The following lines are here so that you cannot close the menu when no game is running.
|
||||||
g_player[playerID].ps->gm &= ~MODE_MENU;
|
g_player[playerID].ps->gm &= ~MODE_MENU;
|
||||||
AppGrabMouse(1);
|
mouseLockToWindow(1);
|
||||||
|
|
||||||
if ((!g_netServer && ud.multimode < 2) && ud.recstat != 2)
|
if ((!g_netServer && ud.multimode < 2) && ud.recstat != 2)
|
||||||
{
|
{
|
||||||
|
@ -4524,7 +4524,7 @@ static void Menu_RunScrollbar(Menu_t *cm, MenuMenuFormat_t const * const format,
|
||||||
|
|
||||||
rotatesprite_fs(scrollx + (scrollwidth>>1) - ((tilesiz[scrollTileCursor].x*ud.menu_scrollcursorz)>>1), scrollregionstart + scale(scrollregionheight, *scrollPos, scrollPosMax), ud.menu_scrollcursorz, 0, scrollTileCursor, 0, 0, 26);
|
rotatesprite_fs(scrollx + (scrollwidth>>1) - ((tilesiz[scrollTileCursor].x*ud.menu_scrollcursorz)>>1), scrollregionstart + scale(scrollregionheight, *scrollPos, scrollPosMax), ud.menu_scrollcursorz, 0, scrollTileCursor, 0, 0, 26);
|
||||||
|
|
||||||
if (cm == m_currentMenu && !m_mousecaught && MOUSEACTIVECONDITIONAL(mousepressstate == Mouse_Pressed || mousepressstate == Mouse_Held))
|
if (cm == m_currentMenu && !m_mousecaught && MOUSEACTIVECONDITIONAL(g_mouseClickState == MOUSE_PRESSED || g_mouseClickState == MOUSE_HELD))
|
||||||
{
|
{
|
||||||
const int32_t scrolltilehalfheight = (tilesiz[scrollTileCursor].y*ud.menu_scrollcursorz)>>1;
|
const int32_t scrolltilehalfheight = (tilesiz[scrollTileCursor].y*ud.menu_scrollcursorz)>>1;
|
||||||
const int32_t scrollregiony = scrollregionstart + scrolltilehalfheight;
|
const int32_t scrollregiony = scrollregionstart + scrolltilehalfheight;
|
||||||
|
@ -4733,7 +4733,7 @@ static int32_t M_RunMenu_Menu(Menu_t *cm, MenuMenu_t *menu, MenuEntry_t *current
|
||||||
Menu_RunInput_Menu_MovementVerify(menu);
|
Menu_RunInput_Menu_MovementVerify(menu);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!m_mousecaught && mousepressstate == Mouse_Released && !Menu_MouseOutsideBounds(&m_mousedownpos, mousex, mousey, mousewidth, entry->font->get_yline()))
|
if (!m_mousecaught && g_mouseClickState == MOUSE_RELEASED && !Menu_MouseOutsideBounds(&m_mousedownpos, mousex, mousey, mousewidth, entry->font->get_yline()))
|
||||||
{
|
{
|
||||||
menu->currentEntry = e;
|
menu->currentEntry = e;
|
||||||
Menu_RunInput_Menu_MovementVerify(menu);
|
Menu_RunInput_Menu_MovementVerify(menu);
|
||||||
|
@ -4778,7 +4778,7 @@ static int32_t M_RunMenu_Menu(Menu_t *cm, MenuMenu_t *menu, MenuEntry_t *current
|
||||||
Menu_RunInput_Menu_MovementVerify(menu);
|
Menu_RunInput_Menu_MovementVerify(menu);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!m_mousecaught && mousepressstate == Mouse_Released && !Menu_MouseOutsideBounds(&m_mousedownpos, mousex, mousey, mousewidth, entry->font->get_yline()))
|
if (!m_mousecaught && g_mouseClickState == MOUSE_RELEASED && !Menu_MouseOutsideBounds(&m_mousedownpos, mousex, mousey, mousewidth, entry->font->get_yline()))
|
||||||
{
|
{
|
||||||
menu->currentEntry = e;
|
menu->currentEntry = e;
|
||||||
Menu_RunInput_Menu_MovementVerify(menu);
|
Menu_RunInput_Menu_MovementVerify(menu);
|
||||||
|
@ -4828,7 +4828,7 @@ static int32_t M_RunMenu_Menu(Menu_t *cm, MenuMenu_t *menu, MenuEntry_t *current
|
||||||
menu->currentColumn = 1;
|
menu->currentColumn = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!m_mousecaught && mousepressstate == Mouse_Released && !Menu_MouseOutsideBounds(&m_mousedownpos, columnx[1], mousey, column1textsize.x, object->font->get_yline()))
|
if (!m_mousecaught && g_mouseClickState == MOUSE_RELEASED && !Menu_MouseOutsideBounds(&m_mousedownpos, columnx[1], mousey, column1textsize.x, object->font->get_yline()))
|
||||||
{
|
{
|
||||||
menu->currentEntry = e;
|
menu->currentEntry = e;
|
||||||
Menu_RunInput_Menu_MovementVerify(menu);
|
Menu_RunInput_Menu_MovementVerify(menu);
|
||||||
|
@ -4851,7 +4851,7 @@ static int32_t M_RunMenu_Menu(Menu_t *cm, MenuMenu_t *menu, MenuEntry_t *current
|
||||||
menu->currentColumn = 0;
|
menu->currentColumn = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!m_mousecaught && mousepressstate == Mouse_Released && !Menu_MouseOutsideBounds(&m_mousedownpos, columnx[0], mousey, column0textsize.x, object->font->get_yline()))
|
if (!m_mousecaught && g_mouseClickState == MOUSE_RELEASED && !Menu_MouseOutsideBounds(&m_mousedownpos, columnx[0], mousey, column0textsize.x, object->font->get_yline()))
|
||||||
{
|
{
|
||||||
menu->currentEntry = e;
|
menu->currentEntry = e;
|
||||||
Menu_RunInput_Menu_MovementVerify(menu);
|
Menu_RunInput_Menu_MovementVerify(menu);
|
||||||
|
@ -4936,7 +4936,7 @@ static int32_t M_RunMenu_Menu(Menu_t *cm, MenuMenu_t *menu, MenuEntry_t *current
|
||||||
Menu_RunInput_Menu_MovementVerify(menu);
|
Menu_RunInput_Menu_MovementVerify(menu);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!m_mousecaught && (mousepressstate == Mouse_Pressed || mousepressstate == Mouse_Held))
|
if (!m_mousecaught && (g_mouseClickState == MOUSE_PRESSED || g_mouseClickState == MOUSE_HELD))
|
||||||
{
|
{
|
||||||
const int32_t slidepointhalfwidth = mulscale16((((tilesiz[SLIDEBAR+1].x)*ud.menu_slidecursorz)>>2) + ud.menu_slidebarmargin, z);
|
const int32_t slidepointhalfwidth = mulscale16((((tilesiz[SLIDEBAR+1].x)*ud.menu_slidecursorz)>>2) + ud.menu_slidebarmargin, z);
|
||||||
const int32_t slideregionx = slidebarx + slidepointhalfwidth;
|
const int32_t slideregionx = slidebarx + slidepointhalfwidth;
|
||||||
|
@ -5035,7 +5035,7 @@ static int32_t M_RunMenu_Menu(Menu_t *cm, MenuMenu_t *menu, MenuEntry_t *current
|
||||||
Menu_RunInput_Menu_MovementVerify(menu);
|
Menu_RunInput_Menu_MovementVerify(menu);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!m_mousecaught && (mousepressstate == Mouse_Pressed || mousepressstate == Mouse_Held))
|
if (!m_mousecaught && (g_mouseClickState == MOUSE_PRESSED || g_mouseClickState == MOUSE_HELD))
|
||||||
{
|
{
|
||||||
const int32_t slidepointhalfwidth = mulscale16((2+tilesiz[SLIDEBAR+1].x)<<15, z);
|
const int32_t slidepointhalfwidth = mulscale16((2+tilesiz[SLIDEBAR+1].x)<<15, z);
|
||||||
const int32_t slideregionx = slidebarx + slidepointhalfwidth;
|
const int32_t slideregionx = slidebarx + slidepointhalfwidth;
|
||||||
|
@ -5135,7 +5135,7 @@ static int32_t M_RunMenu_Menu(Menu_t *cm, MenuMenu_t *menu, MenuEntry_t *current
|
||||||
Menu_RunInput_Menu_MovementVerify(menu);
|
Menu_RunInput_Menu_MovementVerify(menu);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!m_mousecaught && (mousepressstate == Mouse_Pressed || mousepressstate == Mouse_Held))
|
if (!m_mousecaught && (g_mouseClickState == MOUSE_PRESSED || g_mouseClickState == MOUSE_HELD))
|
||||||
{
|
{
|
||||||
const int32_t slidepointhalfwidth = mulscale16((2+tilesiz[SLIDEBAR+1].x)<<15, z);
|
const int32_t slidepointhalfwidth = mulscale16((2+tilesiz[SLIDEBAR+1].x)<<15, z);
|
||||||
const int32_t slideregionx = slidebarx + slidepointhalfwidth;
|
const int32_t slideregionx = slidebarx + slidepointhalfwidth;
|
||||||
|
@ -5208,7 +5208,7 @@ static int32_t M_RunMenu_Menu(Menu_t *cm, MenuMenu_t *menu, MenuEntry_t *current
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifndef EDUKE32_TOUCH_DEVICES
|
#ifndef EDUKE32_TOUCH_DEVICES
|
||||||
if (!m_mousecaught && mousepressstate == Mouse_Released && !Menu_MouseOutsideBounds(&m_mousepos, mousex, mousey, mousewidth, h) && !Menu_MouseOutsideBounds(&m_mousedownpos, mousex, mousey, mousewidth, h))
|
if (!m_mousecaught && g_mouseClickState == MOUSE_RELEASED && !Menu_MouseOutsideBounds(&m_mousepos, mousex, mousey, mousewidth, h) && !Menu_MouseOutsideBounds(&m_mousedownpos, mousex, mousey, mousewidth, h))
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
if (entry == currentry && object->editfield != NULL)
|
if (entry == currentry && object->editfield != NULL)
|
||||||
|
@ -5336,7 +5336,7 @@ static void Menu_RunOptionList(Menu_t *cm, MenuEntry_t *entry, MenuOption_t *obj
|
||||||
object->options->currentEntry = e;
|
object->options->currentEntry = e;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!m_mousecaught && mousepressstate == Mouse_Released && !Menu_MouseOutsideBounds(&m_mousedownpos, mousex, mousey, mousewidth, object->options->font->get_yline()))
|
if (!m_mousecaught && g_mouseClickState == MOUSE_RELEASED && !Menu_MouseOutsideBounds(&m_mousedownpos, mousex, mousey, mousewidth, object->options->font->get_yline()))
|
||||||
{
|
{
|
||||||
object->options->currentEntry = e;
|
object->options->currentEntry = e;
|
||||||
|
|
||||||
|
@ -5359,7 +5359,7 @@ static void Menu_RunOptionList(Menu_t *cm, MenuEntry_t *entry, MenuOption_t *obj
|
||||||
|
|
||||||
static int32_t Menu_RunInput_MouseAdvance(void)
|
static int32_t Menu_RunInput_MouseAdvance(void)
|
||||||
{
|
{
|
||||||
return MOUSEACTIVECONDITIONAL(!m_mousecaught && mousepressstate == Mouse_Released);
|
return MOUSEACTIVECONDITIONAL(!m_mousecaught && g_mouseClickState == MOUSE_RELEASED);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int32_t Menu_RunInput_MouseReturn_status;
|
static int32_t Menu_RunInput_MouseReturn_status;
|
||||||
|
@ -5404,10 +5404,10 @@ static int32_t Menu_RunInput_MouseReturn(void)
|
||||||
#if !defined EDUKE32_TOUCH_DEVICES
|
#if !defined EDUKE32_TOUCH_DEVICES
|
||||||
Menu_RunInput_MouseReturn_status = 1;
|
Menu_RunInput_MouseReturn_status = 1;
|
||||||
#else
|
#else
|
||||||
Menu_RunInput_MouseReturn_status = (mousepressstate == Mouse_Pressed || mousepressstate == Mouse_Held);
|
Menu_RunInput_MouseReturn_status = (g_mouseClickState == MOUSE_PRESSED || g_mouseClickState == MOUSE_HELD);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return !m_mousecaught && mousepressstate == Mouse_Released && !Menu_MouseOutsideBounds(&m_mousedownpos, MouseReturnRegionX, 0, backbuttonbound.x, backbuttonbound.y);
|
return !m_mousecaught && g_mouseClickState == MOUSE_RELEASED && !Menu_MouseOutsideBounds(&m_mousedownpos, MouseReturnRegionX, 0, backbuttonbound.x, backbuttonbound.y);
|
||||||
}
|
}
|
||||||
|
|
||||||
Menu_RunInput_MouseReturn_status = 0;
|
Menu_RunInput_MouseReturn_status = 0;
|
||||||
|
@ -5607,7 +5607,7 @@ static void Menu_Run(Menu_t *cm, const vec2_t origin)
|
||||||
Menu_RunInput_FileSelect_MovementVerify(object);
|
Menu_RunInput_FileSelect_MovementVerify(object);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!m_mousecaught && mousepressstate == Mouse_Released && !Menu_MouseOutsideBounds(&m_mousedownpos, mousex, mousey, textdim.x, object->font[i]->get_yline()))
|
if (!m_mousecaught && g_mouseClickState == MOUSE_RELEASED && !Menu_MouseOutsideBounds(&m_mousedownpos, mousex, mousey, textdim.x, object->font[i]->get_yline()))
|
||||||
{
|
{
|
||||||
object->findhigh[i] = dir;
|
object->findhigh[i] = dir;
|
||||||
object->currentList = i;
|
object->currentList = i;
|
||||||
|
@ -6814,8 +6814,8 @@ void M_DisplayMenus(void)
|
||||||
if (!Menu_IsTextInput(m_currentMenu) && KB_KeyPressed(sc_Q))
|
if (!Menu_IsTextInput(m_currentMenu) && KB_KeyPressed(sc_Q))
|
||||||
Menu_AnimateChange(MENU_QUIT, MA_Advance);
|
Menu_AnimateChange(MENU_QUIT, MA_Advance);
|
||||||
|
|
||||||
int32_t mousestatus = readmouseabsxy(&m_mousepos, &mouseabs);
|
int32_t mousestatus = mouseReadAbs(&m_mousepos, &g_mouseAbs);
|
||||||
if (mousestatus && mousepressstate == Mouse_Pressed)
|
if (mousestatus && g_mouseClickState == MOUSE_PRESSED)
|
||||||
m_mousedownpos = m_mousepos;
|
m_mousedownpos = m_mousepos;
|
||||||
|
|
||||||
Menu_RunInput(m_currentMenu);
|
Menu_RunInput(m_currentMenu);
|
||||||
|
@ -6920,7 +6920,7 @@ void M_DisplayMenus(void)
|
||||||
m_mousewake_watchpoint = 1;
|
m_mousewake_watchpoint = 1;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (MOUSEACTIVECONDITIONAL(mousepressstateadvance()) || m_mousepos.x != m_prevmousepos.x || m_mousepos.y != m_prevmousepos.y)
|
if (MOUSEACTIVECONDITIONAL(mouseAdvanceClickState()) || m_mousepos.x != m_prevmousepos.x || m_mousepos.y != m_prevmousepos.y)
|
||||||
{
|
{
|
||||||
m_prevmousepos = m_mousepos;
|
m_prevmousepos = m_mousepos;
|
||||||
m_mouselastactivity = totalclock;
|
m_mouselastactivity = totalclock;
|
||||||
|
@ -6984,7 +6984,7 @@ void M_DisplayMenus(void)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
mousepressstate = Mouse_Idle;
|
g_mouseClickState = MOUSE_IDLE;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if ((g_player[myconnectindex].ps->gm&MODE_MENU) != MODE_MENU)
|
if ((g_player[myconnectindex].ps->gm&MODE_MENU) != MODE_MENU)
|
||||||
|
|
|
@ -128,7 +128,7 @@ void GAME_onshowosd(int32_t shown)
|
||||||
{
|
{
|
||||||
G_UpdateScreenArea();
|
G_UpdateScreenArea();
|
||||||
|
|
||||||
AppGrabMouse((!shown) + 2);
|
mouseLockToWindow((!shown) + 2);
|
||||||
|
|
||||||
osdshown = shown;
|
osdshown = shown;
|
||||||
|
|
||||||
|
|
|
@ -1186,7 +1186,7 @@ void G_DisplayRest(int32_t smoothratio)
|
||||||
#ifdef GEKKO
|
#ifdef GEKKO
|
||||||
// like the mouse cursor, the pointer doesn't use the crosshair enabled / scale options
|
// like the mouse cursor, the pointer doesn't use the crosshair enabled / scale options
|
||||||
if (g_player[myconnectindex].ps->newowner == -1 && ud.overhead_on == 0 && ud.camerasprite == -1 &&
|
if (g_player[myconnectindex].ps->newowner == -1 && ud.overhead_on == 0 && ud.camerasprite == -1 &&
|
||||||
(g_player[myconnectindex].ps->gm&MODE_MENU) == 0 && readmouseabsxy((vec2_t *)&ud.returnvar[0], &mouseabs))
|
(g_player[myconnectindex].ps->gm&MODE_MENU) == 0 && mouseReadAbs((vec2_t *)&ud.returnvar[0], &g_mouseAbs))
|
||||||
{
|
{
|
||||||
int32_t a = VM_OnEventWithReturn(EVENT_DISPLAYPOINTER, g_player[screenpeek].ps->i, screenpeek, CROSSHAIR);
|
int32_t a = VM_OnEventWithReturn(EVENT_DISPLAYPOINTER, g_player[screenpeek].ps->i, screenpeek, CROSSHAIR);
|
||||||
if ((unsigned) a < MAXTILES)
|
if ((unsigned) a < MAXTILES)
|
||||||
|
|
|
@ -59,9 +59,9 @@ extern kb_scancode KB_LastScan;
|
||||||
keystatus[(scan)] = FALSE; \
|
keystatus[(scan)] = FALSE; \
|
||||||
}
|
}
|
||||||
#define KB_UnBoundKeyPressed(scan) (keystatus[(scan)] != 0 && !CONTROL_KeyBinds[scan].cmdstr)
|
#define KB_UnBoundKeyPressed(scan) (keystatus[(scan)] != 0 && !CONTROL_KeyBinds[scan].cmdstr)
|
||||||
#define KB_GetCh bgetchar
|
#define KB_GetCh keyGetChar
|
||||||
#define KB_KeyWaiting bkbhit
|
#define KB_KeyWaiting keyBufferWaiting
|
||||||
#define KB_FlushKeyboardQueue bflushchars
|
#define KB_FlushKeyboardQueue keyFlushChars
|
||||||
|
|
||||||
static inline void KB_ClearKeysDown(void)
|
static inline void KB_ClearKeysDown(void)
|
||||||
{
|
{
|
||||||
|
@ -75,8 +75,8 @@ static inline void KB_KeyEvent(int32_t scancode, int32_t keypressed)
|
||||||
KB_LastScan = scancode;
|
KB_LastScan = scancode;
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline void KB_Startup(void) { setkeypresscallback(KB_KeyEvent); }
|
static inline void KB_Startup(void) { keySetCallback(KB_KeyEvent); }
|
||||||
static inline void KB_Shutdown(void) { setkeypresscallback((void (*)(int32_t, int32_t))NULL); }
|
static inline void KB_Shutdown(void) { keySetCallback((void (*)(int32_t, int32_t))NULL); }
|
||||||
const char * KB_ScanCodeToString( kb_scancode scancode ); // convert scancode into a string
|
const char * KB_ScanCodeToString( kb_scancode scancode ); // convert scancode into a string
|
||||||
kb_scancode KB_StringToScanCode( const char * string ); // convert a string into a scancode
|
kb_scancode KB_StringToScanCode( const char * string ); // convert a string into a scancode
|
||||||
|
|
||||||
|
|
|
@ -48,12 +48,12 @@ extern "C" {
|
||||||
|
|
||||||
static inline int32_t Mouse_Init(void)
|
static inline int32_t Mouse_Init(void)
|
||||||
{
|
{
|
||||||
initmouse();
|
mouseInit();
|
||||||
return ((inputdevices & 2) == 2);
|
return ((inputdevices & 2) == 2);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static inline void MOUSE_Shutdown(void) { uninitmouse(); }
|
static inline void MOUSE_Shutdown(void) { mouseUninit(); }
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
static inline void MOUSE_ShowCursor(void) {}
|
static inline void MOUSE_ShowCursor(void) {}
|
||||||
|
@ -63,13 +63,13 @@ static inline void MOUSE_HideCursor(void) {}
|
||||||
static inline int32_t MOUSE_GetButtons(void)
|
static inline int32_t MOUSE_GetButtons(void)
|
||||||
{
|
{
|
||||||
int32_t buttons;
|
int32_t buttons;
|
||||||
readmousebstatus(&buttons);
|
mouseReadButtons(&buttons);
|
||||||
return buttons;
|
return buttons;
|
||||||
}
|
}
|
||||||
|
|
||||||
#define MOUSE_ClearButton(b) (mouseb &= ~b)
|
#define MOUSE_ClearButton(b) (g_mouseBits &= ~b)
|
||||||
#define MOUSE_ClearAllButtons() mouseb = 0
|
#define MOUSE_ClearAllButtons() g_mouseBits = 0
|
||||||
#define MOUSE_GetDelta(x, y) readmousexy(x, y)
|
#define MOUSE_GetDelta(x, y) mouseReadPos(x, y)
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
|
|
|
@ -642,14 +642,14 @@ static void CONTROL_PollDevices(ControlInfo *info)
|
||||||
|
|
||||||
if (CONTROL_JoystickEnabled)
|
if (CONTROL_JoystickEnabled)
|
||||||
{
|
{
|
||||||
int32_t i = joynumaxes-1;
|
int32_t i = joystick.numAxes-1;
|
||||||
|
|
||||||
Bmemcpy(CONTROL_LastJoyAxes, CONTROL_JoyAxes, sizeof(CONTROL_JoyAxes));
|
Bmemcpy(CONTROL_LastJoyAxes, CONTROL_JoyAxes, sizeof(CONTROL_JoyAxes));
|
||||||
memset(CONTROL_JoyAxes, 0, sizeof(CONTROL_JoyAxes));
|
memset(CONTROL_JoyAxes, 0, sizeof(CONTROL_JoyAxes));
|
||||||
|
|
||||||
for (; i>=0; i--)
|
for (; i>=0; i--)
|
||||||
{
|
{
|
||||||
CONTROL_JoyAxes[i].analog = joyaxis[i];
|
CONTROL_JoyAxes[i].analog = joystick.pAxis[i];
|
||||||
|
|
||||||
CONTROL_DigitizeAxis(i, controldevice_joystick);
|
CONTROL_DigitizeAxis(i, controldevice_joystick);
|
||||||
CONTROL_ScaleAxis(i, controldevice_joystick);
|
CONTROL_ScaleAxis(i, controldevice_joystick);
|
||||||
|
@ -859,8 +859,8 @@ int32_t CONTROL_Startup(controltype which, int32_t(*TimeFunction)(void), int32_t
|
||||||
// break;
|
// break;
|
||||||
|
|
||||||
// case controltype_keyboardandjoystick:
|
// case controltype_keyboardandjoystick:
|
||||||
CONTROL_NumJoyAxes = min(MAXJOYAXES,joynumaxes);
|
CONTROL_NumJoyAxes = min(MAXJOYAXES,joystick.numAxes);
|
||||||
CONTROL_NumJoyButtons = min(MAXJOYBUTTONS,joynumbuttons + 4*(joynumhats>0));
|
CONTROL_NumJoyButtons = min(MAXJOYBUTTONS,joystick.numButtons + 4*(joystick.numHats>0));
|
||||||
CONTROL_JoystickEnabled = CONTROL_JoyPresent = (inputdevices&4)>>2;
|
CONTROL_JoystickEnabled = CONTROL_JoyPresent = (inputdevices&4)>>2;
|
||||||
// break;
|
// break;
|
||||||
//}
|
//}
|
||||||
|
|
|
@ -44,31 +44,31 @@ int32_t JOYSTICK_GetButtons(void)
|
||||||
{
|
{
|
||||||
int32_t buttons;
|
int32_t buttons;
|
||||||
|
|
||||||
readjoybstatus(&buttons);
|
joyReadButtons(&buttons);
|
||||||
|
|
||||||
if (joynumhats > 0)
|
if (joystick.numHats > 0)
|
||||||
{
|
{
|
||||||
int32_t hat = JOYSTICK_GetHat(0);
|
int32_t hat = JOYSTICK_GetHat(0);
|
||||||
if (hat != 0)
|
if (hat != 0)
|
||||||
buttons |= hat << min(MAXJOYBUTTONS, joynumbuttons);
|
buttons |= hat << min(MAXJOYBUTTONS, joystick.numButtons);
|
||||||
}
|
}
|
||||||
|
|
||||||
return buttons;
|
return buttons;
|
||||||
}
|
}
|
||||||
int32_t JOYSTICK_ClearButton(int32_t b)
|
int32_t JOYSTICK_ClearButton(int32_t b)
|
||||||
{
|
{
|
||||||
return (joyb &= ~b);
|
return (joystick.bits &= ~b);
|
||||||
}
|
}
|
||||||
void JOYSTICK_ClearAllButtons(void)
|
void JOYSTICK_ClearAllButtons(void)
|
||||||
{
|
{
|
||||||
joyb = 0;
|
joystick.bits = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t JOYSTICK_GetHat(int32_t h)
|
int32_t JOYSTICK_GetHat(int32_t h)
|
||||||
{
|
{
|
||||||
if (h>=0 && h<joynumhats)
|
if (h>=0 && h<joystick.numHats)
|
||||||
{
|
{
|
||||||
if (joyhat[h] == -1)
|
if (joystick.pHat[h] == -1)
|
||||||
return (HAT_CENTERED);
|
return (HAT_CENTERED);
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -76,7 +76,7 @@ int32_t JOYSTICK_GetHat(int32_t h)
|
||||||
int32_t val;
|
int32_t val;
|
||||||
|
|
||||||
// thanks SDL for this much more sensible method
|
// thanks SDL for this much more sensible method
|
||||||
val = ((joyhat[0] + 4500 / 2) % 36000) / 4500;
|
val = ((joystick.pHat[0] + 4500 / 2) % 36000) / 4500;
|
||||||
if (val < 8)
|
if (val < 8)
|
||||||
return hatstate[val];
|
return hatstate[val];
|
||||||
}
|
}
|
||||||
|
@ -85,28 +85,28 @@ int32_t JOYSTICK_GetHat(int32_t h)
|
||||||
}
|
}
|
||||||
void JOYSTICK_ClearHat(int32_t h)
|
void JOYSTICK_ClearHat(int32_t h)
|
||||||
{
|
{
|
||||||
if (h>=0 && h<joynumhats)
|
if (h>=0 && h<joystick.numHats)
|
||||||
joyhat[h] = -1;
|
joystick.pHat[h] = -1;
|
||||||
}
|
}
|
||||||
void JOYSTICK_ClearAllHats(void)
|
void JOYSTICK_ClearAllHats(void)
|
||||||
{
|
{
|
||||||
int32_t h;
|
int32_t h;
|
||||||
for (h=0; h<joynumhats; ++h)
|
for (h=0; h<joystick.numHats; ++h)
|
||||||
joyhat[h] = -1;
|
joystick.pHat[h] = -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t JOYSTICK_GetAxis(int32_t a)
|
int32_t JOYSTICK_GetAxis(int32_t a)
|
||||||
{
|
{
|
||||||
return ((a>=0 && a<joynumaxes)?joyaxis[a]:0);
|
return ((a>=0 && a<joystick.numAxes)?joystick.pAxis[a]:0);
|
||||||
}
|
}
|
||||||
void JOYSTICK_ClearAxis(int32_t a)
|
void JOYSTICK_ClearAxis(int32_t a)
|
||||||
{
|
{
|
||||||
if (a>=0 && a<joynumaxes)
|
if (a>=0 && a<joystick.numAxes)
|
||||||
joyaxis[a] = 0;
|
joystick.pAxis[a] = 0;
|
||||||
}
|
}
|
||||||
void JOYSTICK_ClearAllAxes(void)
|
void JOYSTICK_ClearAllAxes(void)
|
||||||
{
|
{
|
||||||
int32_t a;
|
int32_t a;
|
||||||
for (a=0; a<joynumaxes; ++a)
|
for (a=0; a<joystick.numAxes; ++a)
|
||||||
joyaxis[a] = 0;
|
joystick.pAxis[a] = 0;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue