git-svn-id: https://svn.eduke32.com/eduke32@1092 1a8010ca-5511-0410-912e-c29ae57300e0

This commit is contained in:
terminx 2008-10-08 03:16:34 +00:00
parent 255c10c8a7
commit 205f62496b
3 changed files with 122 additions and 122 deletions

View file

@ -100,8 +100,6 @@ static void DestroyAppWindow(void);
static void SaveSystemColours(void); static void SaveSystemColours(void);
static void SetBWSystemColours(void); static void SetBWSystemColours(void);
static void RestoreSystemColours(void); static void RestoreSystemColours(void);
static void ProcessMouse(void);
// video // video
static int desktopxdim=0,desktopydim=0,desktopbpp=0,modesetusing=-1; static int desktopxdim=0,desktopydim=0,desktopbpp=0,modesetusing=-1;
@ -815,14 +813,127 @@ void setmousepresscallback(void (*callback)(int, int)) { mousepresscallback = ca
void setjoypresscallback(void (*callback)(int, int)) { joypresscallback = callback; } void setjoypresscallback(void (*callback)(int, int)) { joypresscallback = callback; }
DWORD WINAPI MouseFunc() DWORD WINAPI ProcessMouse()
{ {
while (moustat && lpDID[MOUSE]) while (moustat && lpDID[MOUSE])
{ {
if (!appactive)Sleep(50);else if (!appactive)
if ((WaitForSingleObject(inputevt[MOUSE], INFINITE)) == WAIT_OBJECT_0)
{ {
ProcessMouse(); Sleep(100);
continue;
}
if ((WaitForSingleObject(inputevt[MOUSE], INFINITE)) != WAIT_OBJECT_0)
continue;
{
DWORD i;
unsigned t;
int result;
DIDEVICEOBJECTDATA didod;
DWORD dwElements = 1;
do
{
if (!mousegrab)
break;
t = getticks();
result = IDirectInputDevice7_GetDeviceData(lpDID[MOUSE], sizeof(DIDEVICEOBJECTDATA),
(LPDIDEVICEOBJECTDATA)&didod, &dwElements, 0);
if (!dwElements || result != DI_OK)
break;
// else if (result == DI_OK)
{
// process the mouse events
// mousex=0;
// mousey=0;
// for (i=0; i<dwElements; i++)
{
if (didod.dwOfs == DIMOFS_X)
mousex += (short)didod.dwData;
else if (didod.dwOfs == DIMOFS_Y)
mousey += (short)didod.dwData;
else if (didod.dwOfs == DIMOFS_Z)
{
if ((int)didod.dwData > 0) // wheel up
{
if (mousewheel[0] > 0 && mousepresscallback) mousepresscallback(5,0);
mousewheel[0] = t;
mouseb |= 16; if (mousepresscallback) mousepresscallback(5, 1);
}
else if ((int)didod.dwData < 0) // wheel down
{
if (mousewheel[1] > 0 && mousepresscallback) mousepresscallback(6,0);
mousewheel[1] = t;
mouseb |= 32; if (mousepresscallback) mousepresscallback(6, 1);
}
}
else if (didod.dwOfs >= DIMOFS_BUTTON0 && didod.dwOfs <= DIMOFS_BUTTON7)
{
if (didod.dwOfs == DIMOFS_BUTTON0)
{
if (didod.dwData & 0x80) mouseb |= 1;
else mouseb &= ~1;
if (mousepresscallback)
mousepresscallback(1, (mouseb&1)==1);
}
else if (didod.dwOfs == DIMOFS_BUTTON1)
{
if (didod.dwData & 0x80) mouseb |= 2;
else mouseb &= ~2;
if (mousepresscallback)
mousepresscallback(2, (mouseb&2)==2);
}
else if (didod.dwOfs == DIMOFS_BUTTON2)
{
if (didod.dwData & 0x80) mouseb |= 4;
else mouseb &= ~4;
if (mousepresscallback)
mousepresscallback(3, (mouseb&4)==4);
}
else if (didod.dwOfs == DIMOFS_BUTTON3)
{
if (didod.dwData & 0x80) mouseb |= 8;
else mouseb &= ~8;
if (mousepresscallback)
mousepresscallback(4, (mouseb&8)==8);
}
else if (didod.dwOfs == DIMOFS_BUTTON4)
{
OSD_Printf("got button4\n");
if (didod.dwData & 0x80) mouseb |= 64;
else mouseb &= ~64;
if (mousepresscallback)
mousepresscallback(7, (mouseb&64)==64);
}
else if (didod.dwOfs == DIMOFS_BUTTON5)
{
OSD_Printf("got button5\n");
if (didod.dwData & 0x80) mouseb |= 128;
else mouseb &= ~128;
if (mousepresscallback)
mousepresscallback(8, (mouseb&128)==128);
}
else if (didod.dwOfs == DIMOFS_BUTTON6)
{
OSD_Printf("got button6\n");
if (didod.dwData & 0x80) mouseb |= 256;
else mouseb &= ~256;
if (mousepresscallback)
mousepresscallback(9, (mouseb&256)==256);
}
else if (didod.dwOfs == DIMOFS_BUTTON7)
{
OSD_Printf("got button7\n");
if (didod.dwData & 0x80) mouseb |= 512;
else mouseb &= ~512;
if (mousepresscallback)
mousepresscallback(10, (mouseb&512)==512);
}
}
}
}
} while (1);
} }
} }
return 0; return 0;
@ -843,7 +954,7 @@ int initmouse(void)
( (
NULL, NULL,
0, 0,
MouseFunc, ProcessMouse,
NULL, NULL,
CREATE_SUSPENDED, CREATE_SUSPENDED,
&threadid &threadid
@ -1498,117 +1609,6 @@ static void AcquireInputDevices(char acquire, signed char device)
} }
} }
static void ProcessMouse()
{
DWORD i;
unsigned t;
int result;
DIDEVICEOBJECTDATA didod;
DWORD dwElements = 1;
while (1)
{
t = getticks();
if (!mousegrab) break;
result = IDirectInputDevice7_GetDeviceData(lpDID[MOUSE], sizeof(DIDEVICEOBJECTDATA),
(LPDIDEVICEOBJECTDATA)&didod, &dwElements, 0);
if (FAILED(result) || !dwElements)break;
else if (result == DI_OK)
{
// process the mouse events
// mousex=0;
// mousey=0;
// for (i=0; i<dwElements; i++)
{
if (didod.dwOfs == DIMOFS_X)
mousex += (short)didod.dwData;
else if (didod.dwOfs == DIMOFS_Y)
mousey += (short)didod.dwData;
else if (didod.dwOfs == DIMOFS_Z)
{
if ((int)didod.dwData > 0) // wheel up
{
if (mousewheel[0] > 0 && mousepresscallback) mousepresscallback(5,0);
mousewheel[0] = t;
mouseb |= 16; if (mousepresscallback) mousepresscallback(5, 1);
}
else if ((int)didod.dwData < 0) // wheel down
{
if (mousewheel[1] > 0 && mousepresscallback) mousepresscallback(6,0);
mousewheel[1] = t;
mouseb |= 32; if (mousepresscallback) mousepresscallback(6, 1);
}
}
else if (didod.dwOfs >= DIMOFS_BUTTON0 && didod.dwOfs <= DIMOFS_BUTTON7)
{
if (didod.dwOfs == DIMOFS_BUTTON0)
{
if (didod.dwData & 0x80) mouseb |= 1;
else mouseb &= ~1;
if (mousepresscallback)
mousepresscallback(1, (mouseb&1)==1);
}
else if (didod.dwOfs == DIMOFS_BUTTON1)
{
if (didod.dwData & 0x80) mouseb |= 2;
else mouseb &= ~2;
if (mousepresscallback)
mousepresscallback(2, (mouseb&2)==2);
}
else if (didod.dwOfs == DIMOFS_BUTTON2)
{
if (didod.dwData & 0x80) mouseb |= 4;
else mouseb &= ~4;
if (mousepresscallback)
mousepresscallback(3, (mouseb&4)==4);
}
else if (didod.dwOfs == DIMOFS_BUTTON3)
{
if (didod.dwData & 0x80) mouseb |= 8;
else mouseb &= ~8;
if (mousepresscallback)
mousepresscallback(4, (mouseb&8)==8);
}
else if (didod.dwOfs == DIMOFS_BUTTON4)
{
OSD_Printf("got button4\n");
if (didod.dwData & 0x80) mouseb |= 64;
else mouseb &= ~64;
if (mousepresscallback)
mousepresscallback(7, (mouseb&64)==64);
}
else if (didod.dwOfs == DIMOFS_BUTTON5)
{
OSD_Printf("got button5\n");
if (didod.dwData & 0x80) mouseb |= 128;
else mouseb &= ~128;
if (mousepresscallback)
mousepresscallback(8, (mouseb&128)==128);
}
else if (didod.dwOfs == DIMOFS_BUTTON6)
{
OSD_Printf("got button6\n");
if (didod.dwData & 0x80) mouseb |= 256;
else mouseb &= ~256;
if (mousepresscallback)
mousepresscallback(9, (mouseb&256)==256);
}
else if (didod.dwOfs == DIMOFS_BUTTON7)
{
OSD_Printf("got button7\n");
if (didod.dwData & 0x80) mouseb |= 512;
else mouseb &= ~512;
if (mousepresscallback)
mousepresscallback(10, (mouseb&512)==512);
}
}
}
}
}
}
// //
// ProcessInputDevices() -- processes the input devices // ProcessInputDevices() -- processes the input devices
// //

View file

@ -772,7 +772,7 @@ int32 CONFIG_ReadSetup(void)
SCRIPT_GetNumber(ud.config.scripthandle, "Misc", "StatusBarMode",&ud.statusbarmode); SCRIPT_GetNumber(ud.config.scripthandle, "Misc", "StatusBarMode",&ud.statusbarmode);
SCRIPT_GetNumber(ud.config.scripthandle, "Misc", "AutoVote",&ud.autovote); SCRIPT_GetNumber(ud.config.scripthandle, "Misc", "AutoVote",&ud.autovote);
SCRIPT_GetNumber(ud.config.scripthandle, "Misc", "AutoMsg",&ud.automsg); SCRIPT_GetNumber(ud.config.scripthandle, "Misc", "AutoMsg",&ud.automsg);
SCRIPT_GetNumber(ud.config.scripthandle, "Misc", "IDPlayers",&ud.automsg); SCRIPT_GetNumber(ud.config.scripthandle, "Misc", "IDPlayers",&ud.idplayers);
SCRIPT_GetNumber(ud.config.scripthandle, "Misc", "ViewBobbing",&ud.viewbob); SCRIPT_GetNumber(ud.config.scripthandle, "Misc", "ViewBobbing",&ud.viewbob);
SCRIPT_GetNumber(ud.config.scripthandle, "Misc", "WeaponSway",&ud.weaponsway); SCRIPT_GetNumber(ud.config.scripthandle, "Misc", "WeaponSway",&ud.weaponsway);
SCRIPT_GetNumber(ud.config.scripthandle, "Misc", "AltHud",&ud.althud); SCRIPT_GetNumber(ud.config.scripthandle, "Misc", "AltHud",&ud.althud);

View file

@ -725,16 +725,16 @@ cvarmappings cvar[] =
{ "hud_flashing", "hud_flashing: enable/disable althud flashing", (void*)&althud_flashing, CVAR_BOOL, 0, 0, 1 }, { "hud_flashing", "hud_flashing: enable/disable althud flashing", (void*)&althud_flashing, CVAR_BOOL, 0, 0, 1 },
{ "hud_glowingquotes", "hud_glowingquotes: enable/disable \"glowing\" quote text", (void*)&hud_glowingquotes, CVAR_BOOL, 0, 0, 1 }, { "hud_glowingquotes", "hud_glowingquotes: enable/disable \"glowing\" quote text", (void*)&hud_glowingquotes, CVAR_BOOL, 0, 0, 1 },
{ "hud_showmapname", "hud_showmapname: enable/disable map name display on load", (void*)&hud_showmapname, CVAR_BOOL, 0, 0, 1 }, { "hud_showmapname", "hud_showmapname: enable/disable map name display on load", (void*)&hud_showmapname, CVAR_BOOL, 0, 0, 1 },
{ "hud_stats", "hud_stats: enable/disable level statistics display\n", (void*)&ud.levelstats, CVAR_BOOL, 0, 0, 1 },
{ "cl_autoaim", "cl_autoaim: enable/disable weapon autoaim", (void*)&ud.config.AutoAim, CVAR_INT|CVAR_MULTI, 0, 0, 2 }, { "cl_autoaim", "cl_autoaim: enable/disable weapon autoaim", (void*)&ud.config.AutoAim, CVAR_INT|CVAR_MULTI, 0, 0, 2 },
{ "cl_automsg", "cl_automsg: enable/disable automatically sending messages to all players", (void*)&ud.automsg, CVAR_BOOL, 0, 0, 1 }, { "cl_automsg", "cl_automsg: enable/disable automatically sending messages to all players", (void*)&ud.automsg, CVAR_BOOL, 0, 0, 1 },
{ "cl_autovote", "cl_autovote: enable/disable automatic voting", (void*)&ud.autovote, CVAR_INT|CVAR_MULTI, 0, 0, 2 }, { "cl_autovote", "cl_autovote: enable/disable automatic voting", (void*)&ud.autovote, CVAR_INT|CVAR_MULTI, 0, 0, 2 },
{ "cl_obituaries", "cl_obituaries: enable/disable multiplayer death messages", (void*)&ud.obituaries, CVAR_BOOL, 0, 0, 1 }, { "cl_obituaries", "cl_obituaries: enable/disable multiplayer death messages", (void*)&ud.obituaries, CVAR_BOOL, 0, 0, 1 },
{ "cl_democams", "cl_democams: enable/disable demo playback cameras", (void*)&ud.democams, CVAR_BOOL, 0, 0, 1 }, { "cl_democams", "cl_democams: enable/disable demo playback cameras", (void*)&ud.democams, CVAR_BOOL, 0, 0, 1 },
{ "cl_idplayers", "cl_idplayers: enable/disable name display when aiming at opponents", (void*)&ud.idplayers, CVAR_BOOL, 0, 0, 1 }, { "cl_idplayers", "cl_idplayers: enable/disable name display when aiming at opponents", (void*)&ud.idplayers, CVAR_BOOL, 0, 0, 1 },
{ "cl_levelstats", "cl_levelstats: enable/disable level statistics display\n", (void*)&ud.levelstats, CVAR_BOOL, 0, 0, 1 },
{ "cl_messagetime", "cl_messagetime: length of time to display multiplayer chat messages\n", (void*)&ud.msgdisptime, CVAR_INT, 0, 0, 3600 }, { "cl_messagetime", "cl_messagetime: length of time to display multiplayer chat messages\n", (void*)&ud.msgdisptime, CVAR_INT, 0, 0, 3600 },
{ "cl_showcoords", "cl_showcoords: show your position in the game world", (void*)&ud.coords, CVAR_BOOL, 0, 0, 1 }, { "cl_showcoords", "cl_showcoords: show your position in the game world", (void*)&ud.coords, CVAR_BOOL, 0, 0, 1 },