mirror of
https://github.com/ZDoom/raze-gles.git
synced 2024-12-24 02:30:46 +00:00
git-svn-id: https://svn.eduke32.com/eduke32@1089 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
parent
d507a10397
commit
8dc599fc28
17 changed files with 200 additions and 124 deletions
|
@ -265,7 +265,7 @@ static DIOBJECTDATAFORMAT c_dfDIKeyboard_odf[] = {
|
|||
const DIDATAFORMAT c_dfDIKeyboard = { 24, 16, 0x00000002, 256, 256, c_dfDIKeyboard_odf };
|
||||
|
||||
// Mouse
|
||||
|
||||
/*
|
||||
static DIOBJECTDATAFORMAT c_dfDIMouse_odf[] = {
|
||||
{ &GUID_XAxis, 0, 0x00FFFF03, 0x00000000 },
|
||||
{ &GUID_YAxis, 4, 0x00FFFF03, 0x00000000 },
|
||||
|
@ -277,6 +277,21 @@ static DIOBJECTDATAFORMAT c_dfDIMouse_odf[] = {
|
|||
};
|
||||
|
||||
const DIDATAFORMAT c_dfDIMouse = { 24, 16, 0x00000002, 16, 7, c_dfDIMouse_odf };
|
||||
*/
|
||||
static DIOBJECTDATAFORMAT c_dfDIMouse2_odf[] = {
|
||||
{&GUID_XAxis, 0, 16776963, 0},
|
||||
{&GUID_YAxis, 4, 16776963, 0},
|
||||
{&GUID_ZAxis, 8, -2130706685, 0},
|
||||
{0, 12, 16776972, 0},
|
||||
{0, 13, 16776972, 0},
|
||||
{0, 14, -2130706676, 0},
|
||||
{0, 15, -2130706676, 0},
|
||||
{0, 16, -2130706676, 0},
|
||||
{0, 17, -2130706676, 0},
|
||||
{0, 18, -2130706676,0},
|
||||
{0, 19, -2130706676, 0}
|
||||
};
|
||||
const DIDATAFORMAT c_dfDIMouse2 = {24, 16, 2, 20, 11, c_dfDIMouse2_odf};
|
||||
|
||||
// Joystick
|
||||
|
||||
|
|
|
@ -364,7 +364,7 @@ int app_main(int argc, const char **argv)
|
|||
loadpics("tiles000.art",1048576*16);
|
||||
loadnames();
|
||||
|
||||
Bstrcpy(kensig,"Based on BUILD by Ken Silverman");
|
||||
Bstrcpy(kensig,"Uses BUILD technology by Ken Silverman");
|
||||
initcrc();
|
||||
|
||||
if (!loaddefinitionsfile(defsfilename)) initprintf("Definitions file loaded.\n");
|
||||
|
|
|
@ -11051,7 +11051,7 @@ void draw2dgrid(int posxe, int posye, short ange, int zoome, short gride)
|
|||
{
|
||||
if (xp1 != xp2)
|
||||
{
|
||||
drawline16(xp1,yp1,xp1,yp2,25);
|
||||
drawline16(xp1,yp1,xp1,yp2,8);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -11059,7 +11059,7 @@ void draw2dgrid(int posxe, int posye, short ange, int zoome, short gride)
|
|||
xp2 = xp1;
|
||||
if ((xp2 >= 0) && (xp2 < xdim))
|
||||
{
|
||||
drawline16(xp2,yp1,xp2,yp2,25);
|
||||
drawline16(xp2,yp1,xp2,yp2,8);
|
||||
}
|
||||
}
|
||||
xp1 = mulscale14(posxe+editorgridextent,zoome);
|
||||
|
@ -11072,7 +11072,7 @@ void draw2dgrid(int posxe, int posye, short ange, int zoome, short gride)
|
|||
{
|
||||
if ((yp1 > midydim16-ydim16) && (yp1 <= midydim16))
|
||||
{
|
||||
drawline16(halfxdim16-xp1,midydim16-yp1,halfxdim16-xp2,midydim16-yp1,25);
|
||||
drawline16(halfxdim16-xp1,midydim16-yp1,halfxdim16-xp2,midydim16-yp1,8);
|
||||
tempy = yp1;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1367,7 +1367,7 @@ void OSD_Draw(void)
|
|||
clearbackground(osdcols,osdrowscur+1);
|
||||
|
||||
if (osdversionstring[0])
|
||||
drawosdstr(osdcols-osdversionstringlen,osdrowscur,osdversionstring,osdversionstringlen,osdversionstringshade,osdversionstringpal);
|
||||
drawosdstr(osdcols-osdversionstringlen,osdrowscur,osdversionstring,osdversionstringlen,(sintable[(totalclock<<4)&2047]>>11),osdversionstringpal);
|
||||
|
||||
for (; lines>0; lines--, row--)
|
||||
{
|
||||
|
@ -1375,9 +1375,9 @@ void OSD_Draw(void)
|
|||
topoffs+=osdcols;
|
||||
}
|
||||
|
||||
drawosdchar(2,osdrowscur,'>',osdpromptshade,osdpromptpal);
|
||||
if (osdeditcaps) drawosdchar(0,osdrowscur,'C',osdpromptshade,osdpromptpal);
|
||||
if (osdeditshift) drawosdchar(1,osdrowscur,'H',osdpromptshade,osdpromptpal);
|
||||
drawosdchar(2,osdrowscur,'>',osdpromptshade?osdpromptshade:(sintable[(totalclock<<4)&2047]>>11),osdpromptpal);
|
||||
if (osdeditcaps) drawosdchar(0,osdrowscur,'C',osdpromptshade?osdpromptshade:(sintable[(totalclock<<4)&2047]>>11),osdpromptpal);
|
||||
if (osdeditshift) drawosdchar(1,osdrowscur,'H',osdpromptshade?osdpromptshade:(sintable[(totalclock<<4)&2047]>>11),osdpromptpal);
|
||||
|
||||
len = min(osdcols-1-3, osdeditlen-osdeditwinstart);
|
||||
for (x=len-1; x>=0; x--)
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
#error winlayer.c is for Windows only.
|
||||
#endif
|
||||
|
||||
#define DIRECTINPUT_VERSION 0x0500
|
||||
#define DIRECTINPUT_VERSION 0x0700
|
||||
#define DIRECTDRAW_VERSION 0x0600
|
||||
|
||||
#define WIN32_LEAN_AND_MEAN
|
||||
|
@ -674,8 +674,8 @@ inline void idle(void)
|
|||
#define NUM_INPUTS 3
|
||||
|
||||
static HMODULE hDInputDLL = NULL;
|
||||
static LPDIRECTINPUTA lpDI = NULL;
|
||||
static LPDIRECTINPUTDEVICE2A lpDID[NUM_INPUTS] = { NULL, NULL, NULL };
|
||||
static LPDIRECTINPUT7A lpDI = NULL;
|
||||
static LPDIRECTINPUTDEVICE7A lpDID[NUM_INPUTS] = { NULL, NULL, NULL };
|
||||
static BOOL bDInputInited = FALSE;
|
||||
#define INPUT_BUFFER_SIZE 32
|
||||
static GUID guidDevs[NUM_INPUTS];
|
||||
|
@ -689,12 +689,12 @@ HANDLE mousethread;
|
|||
static struct
|
||||
{
|
||||
char *name;
|
||||
LPDIRECTINPUTDEVICE2A *did;
|
||||
LPDIRECTINPUTDEVICE7A *did;
|
||||
const DIDATAFORMAT *df;
|
||||
} devicedef[NUM_INPUTS] =
|
||||
{
|
||||
{ "keyboard", &lpDID[KEYBOARD], &c_dfDIKeyboard },
|
||||
{ "mouse", &lpDID[MOUSE], &c_dfDIMouse },
|
||||
{ "mouse", &lpDID[MOUSE], &c_dfDIMouse2 },
|
||||
{ "joystick", &lpDID[JOYSTICK], &c_dfDIJoystick }
|
||||
};
|
||||
static struct _joydef
|
||||
|
@ -952,7 +952,7 @@ void setjoydeadzone(int axis, unsigned short dead, unsigned short satur)
|
|||
}
|
||||
dipdw.dwData = dead;
|
||||
|
||||
result = IDirectInputDevice2_SetProperty(lpDID[JOYSTICK], DIPROP_DEADZONE, &dipdw.diph);
|
||||
result = IDirectInputDevice7_SetProperty(lpDID[JOYSTICK], DIPROP_DEADZONE, &dipdw.diph);
|
||||
if FAILED(result)
|
||||
{
|
||||
//ShowDInputErrorBox("Failed setting joystick dead zone", result);
|
||||
|
@ -962,7 +962,7 @@ void setjoydeadzone(int axis, unsigned short dead, unsigned short satur)
|
|||
|
||||
dipdw.dwData = satur;
|
||||
|
||||
result = IDirectInputDevice2_SetProperty(lpDID[JOYSTICK], DIPROP_SATURATION, &dipdw.diph);
|
||||
result = IDirectInputDevice7_SetProperty(lpDID[JOYSTICK], DIPROP_SATURATION, &dipdw.diph);
|
||||
if FAILED(result)
|
||||
{
|
||||
//ShowDInputErrorBox("Failed setting joystick saturation point", result);
|
||||
|
@ -998,7 +998,7 @@ void getjoydeadzone(int axis, unsigned short *dead, unsigned short *satur)
|
|||
dipdw.diph.dwHow = DIPH_BYOFFSET;
|
||||
}
|
||||
|
||||
result = IDirectInputDevice2_GetProperty(lpDID[JOYSTICK], DIPROP_DEADZONE, &dipdw.diph);
|
||||
result = IDirectInputDevice7_GetProperty(lpDID[JOYSTICK], DIPROP_DEADZONE, &dipdw.diph);
|
||||
if FAILED(result)
|
||||
{
|
||||
//ShowDInputErrorBox("Failed getting joystick dead zone", result);
|
||||
|
@ -1008,7 +1008,7 @@ void getjoydeadzone(int axis, unsigned short *dead, unsigned short *satur)
|
|||
|
||||
*dead = dipdw.dwData;
|
||||
|
||||
result = IDirectInputDevice2_GetProperty(lpDID[JOYSTICK], DIPROP_SATURATION, &dipdw.diph);
|
||||
result = IDirectInputDevice7_GetProperty(lpDID[JOYSTICK], DIPROP_SATURATION, &dipdw.diph);
|
||||
if FAILED(result)
|
||||
{
|
||||
//ShowDInputErrorBox("Failed getting joystick saturation point", result);
|
||||
|
@ -1032,6 +1032,10 @@ void releaseallbuttons(void)
|
|||
if (mouseb & 8) mousepresscallback(4, 0);
|
||||
if (mousewheel[0]>0) mousepresscallback(5,0);
|
||||
if (mousewheel[1]>0) mousepresscallback(6,0);
|
||||
if (mouseb & 64) mousepresscallback(7, 0);
|
||||
if (mouseb & 128) mousepresscallback(8, 0);
|
||||
if (mouseb & 256) mousepresscallback(9, 0);
|
||||
if (mouseb & 512) mousepresscallback(10, 0);
|
||||
}
|
||||
mousewheel[0]=mousewheel[1]=0;
|
||||
mouseb = 0;
|
||||
|
@ -1182,10 +1186,10 @@ static BOOL CALLBACK InitDirectInput_enumobjects(LPCDIDEVICEOBJECTINSTANCE lpddo
|
|||
static BOOL InitDirectInput(void)
|
||||
{
|
||||
HRESULT result;
|
||||
HRESULT(WINAPI *aDirectInputCreateA)(HINSTANCE, DWORD, LPDIRECTINPUTA *, LPUNKNOWN);
|
||||
HRESULT(WINAPI *aDirectInputCreateA)(HINSTANCE, DWORD, LPDIRECTINPUT7A *, LPUNKNOWN);
|
||||
DIPROPDWORD dipdw;
|
||||
LPDIRECTINPUTDEVICEA dev;
|
||||
LPDIRECTINPUTDEVICE2A dev2;
|
||||
LPDIRECTINPUTDEVICE7A dev;
|
||||
LPDIRECTINPUTDEVICE7A dev2;
|
||||
DIDEVCAPS didc;
|
||||
|
||||
int devn;
|
||||
|
@ -1219,7 +1223,7 @@ static BOOL InitDirectInput(void)
|
|||
// enumerate devices to make us look fancy
|
||||
initprintf(" - Enumerating attached input devices\n");
|
||||
inputdevices = 0;
|
||||
result = IDirectInput_EnumDevices(lpDI, 0, InitDirectInput_enum, NULL, DIEDFL_ATTACHEDONLY);
|
||||
result = IDirectInput7_EnumDevices(lpDI, 0, InitDirectInput_enum, NULL, DIEDFL_ATTACHEDONLY);
|
||||
if FAILED(result) { HorribleDInputDeath("Failed enumerating attached input devices", result); }
|
||||
else if (result != DI_OK) initprintf(" Enumerated input devices with warning: %s\n",GetDInputError(result));
|
||||
if (!(inputdevices & (1<<KEYBOARD)))
|
||||
|
@ -1238,33 +1242,33 @@ static BOOL InitDirectInput(void)
|
|||
*devicedef[devn].did = NULL;
|
||||
|
||||
// initprintf(" - Creating %s device\n", devicedef[devn].name);
|
||||
result = IDirectInput_CreateDevice(lpDI, &guidDevs[devn], &dev, NULL);
|
||||
result = IDirectInput7_CreateDevice(lpDI, &guidDevs[devn], &dev, NULL);
|
||||
if FAILED(result) { HorribleDInputDeath("Failed creating device", result); }
|
||||
else if (result != DI_OK) initprintf(" Created device with warning: %s\n",GetDInputError(result));
|
||||
|
||||
result = IDirectInputDevice_QueryInterface(dev, &IID_IDirectInputDevice2, (LPVOID *)&dev2);
|
||||
IDirectInputDevice_Release(dev);
|
||||
if FAILED(result) { HorribleDInputDeath("Failed querying DirectInput2 interface for device", result); }
|
||||
else if (result != DI_OK) initprintf(" Queried IDirectInputDevice2 interface with warning: %s\n",GetDInputError(result));
|
||||
result = IDirectInputDevice7_QueryInterface(dev, &IID_IDirectInputDevice7, (LPVOID *)&dev2);
|
||||
IDirectInputDevice7_Release(dev);
|
||||
if FAILED(result) { HorribleDInputDeath("Failed querying DirectInput7 interface for device", result); }
|
||||
else if (result != DI_OK) initprintf(" Queried IDirectInputDevice7 interface with warning: %s\n",GetDInputError(result));
|
||||
|
||||
result = IDirectInputDevice2_SetDataFormat(dev2, devicedef[devn].df);
|
||||
if FAILED(result) { IDirectInputDevice_Release(dev2); HorribleDInputDeath("Failed setting data format", result); }
|
||||
result = IDirectInputDevice7_SetDataFormat(dev2, devicedef[devn].df);
|
||||
if FAILED(result) { IDirectInputDevice7_Release(dev2); HorribleDInputDeath("Failed setting data format", result); }
|
||||
else if (result != DI_OK) initprintf(" Set data format with warning: %s\n",GetDInputError(result));
|
||||
|
||||
inputevt[devn] = CreateEvent(NULL, FALSE, FALSE, NULL);
|
||||
if (inputevt[devn] == NULL)
|
||||
{
|
||||
IDirectInputDevice_Release(dev2);
|
||||
IDirectInputDevice7_Release(dev2);
|
||||
ShowErrorBox("Couldn't create event object");
|
||||
UninitDirectInput();
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
result = IDirectInputDevice2_SetEventNotification(dev2, inputevt[devn]);
|
||||
if FAILED(result) { IDirectInputDevice_Release(dev2); HorribleDInputDeath("Failed setting event object", result); }
|
||||
result = IDirectInputDevice7_SetEventNotification(dev2, inputevt[devn]);
|
||||
if FAILED(result) { IDirectInputDevice7_Release(dev2); HorribleDInputDeath("Failed setting event object", result); }
|
||||
else if (result != DI_OK) initprintf(" Set event object with warning: %s\n",GetDInputError(result));
|
||||
|
||||
IDirectInputDevice2_Unacquire(dev2);
|
||||
IDirectInputDevice7_Unacquire(dev2);
|
||||
|
||||
memset(&dipdw, 0, sizeof(dipdw));
|
||||
dipdw.diph.dwSize = sizeof(DIPROPDWORD);
|
||||
|
@ -1273,8 +1277,8 @@ static BOOL InitDirectInput(void)
|
|||
dipdw.diph.dwHow = DIPH_DEVICE;
|
||||
dipdw.dwData = INPUT_BUFFER_SIZE;
|
||||
|
||||
result = IDirectInputDevice2_SetProperty(dev2, DIPROP_BUFFERSIZE, &dipdw.diph);
|
||||
if FAILED(result) { IDirectInputDevice_Release(dev2); HorribleDInputDeath("Failed setting buffering", result); }
|
||||
result = IDirectInputDevice7_SetProperty(dev2, DIPROP_BUFFERSIZE, &dipdw.diph);
|
||||
if FAILED(result) { IDirectInputDevice7_Release(dev2); HorribleDInputDeath("Failed setting buffering", result); }
|
||||
else if (result != DI_OK) initprintf(" Set buffering with warning: %s\n",GetDInputError(result));
|
||||
|
||||
// set up device
|
||||
|
@ -1284,8 +1288,8 @@ static BOOL InitDirectInput(void)
|
|||
|
||||
memset(&didc, 0, sizeof(didc));
|
||||
didc.dwSize = sizeof(didc);
|
||||
result = IDirectInputDevice2_GetCapabilities(dev2, &didc);
|
||||
if FAILED(result) { IDirectInputDevice_Release(dev2); HorribleDInputDeath("Failed getting joystick capabilities", result); }
|
||||
result = IDirectInputDevice7_GetCapabilities(dev2, &didc);
|
||||
if FAILED(result) { IDirectInputDevice7_Release(dev2); HorribleDInputDeath("Failed getting joystick capabilities", result); }
|
||||
else if (result != DI_OK) initprintf(" Fetched joystick capabilities with warning: %s\n",GetDInputError(result));
|
||||
|
||||
joynumaxes = (char)didc.dwAxes;
|
||||
|
@ -1300,8 +1304,8 @@ static BOOL InitDirectInput(void)
|
|||
joyaxis = (int *)Bcalloc(didc.dwAxes, sizeof(int));
|
||||
joyhat = (int *)Bcalloc(didc.dwPOVs, sizeof(int));
|
||||
|
||||
result = IDirectInputDevice2_EnumObjects(dev2, InitDirectInput_enumobjects, (LPVOID)typecounts, DIDFT_ALL);
|
||||
if FAILED(result) { IDirectInputDevice_Release(dev2); HorribleDInputDeath("Failed getting joystick features", result); }
|
||||
result = IDirectInputDevice7_EnumObjects(dev2, InitDirectInput_enumobjects, (LPVOID)typecounts, DIDFT_ALL);
|
||||
if FAILED(result) { IDirectInputDevice7_Release(dev2); HorribleDInputDeath("Failed getting joystick features", result); }
|
||||
else if (result != DI_OK) initprintf(" Fetched joystick features with warning: %s\n",GetDInputError(result));
|
||||
}
|
||||
|
||||
|
@ -1350,9 +1354,9 @@ static void UninitDirectInput(void)
|
|||
{
|
||||
// initprintf(" - Releasing %s device\n", devicedef[devn].name);
|
||||
|
||||
if (devn != JOYSTICK) IDirectInputDevice2_SetEventNotification(*devicedef[devn].did, NULL);
|
||||
if (devn != JOYSTICK) IDirectInputDevice7_SetEventNotification(*devicedef[devn].did, NULL);
|
||||
|
||||
IDirectInputDevice2_Release(*devicedef[devn].did);
|
||||
IDirectInputDevice7_Release(*devicedef[devn].did);
|
||||
*devicedef[devn].did = NULL;
|
||||
}
|
||||
if (inputevt[devn])
|
||||
|
@ -1365,7 +1369,7 @@ static void UninitDirectInput(void)
|
|||
if (lpDI)
|
||||
{
|
||||
// initprintf(" - Releasing DirectInput object\n");
|
||||
IDirectInput_Release(lpDI);
|
||||
IDirectInput7_Release(lpDI);
|
||||
lpDI = NULL;
|
||||
}
|
||||
|
||||
|
@ -1396,7 +1400,7 @@ static void GetKeyNames(void)
|
|||
ZeroMemory(&key,sizeof(key));
|
||||
key.dwSize = sizeof(DIDEVICEOBJECTINSTANCE);
|
||||
|
||||
res = IDirectInputDevice_GetObjectInfo(*devicedef[KEYBOARD].did, &key, i, DIPH_BYOFFSET);
|
||||
res = IDirectInputDevice7_GetObjectInfo(*devicedef[KEYBOARD].did, &key, i, DIPH_BYOFFSET);
|
||||
if (FAILED(res)) continue;
|
||||
|
||||
CharToOem(key.tszName, tbuf);
|
||||
|
@ -1457,17 +1461,17 @@ static void AcquireInputDevices(char acquire, signed char device)
|
|||
if (device != -1 && i != device) continue; // don't touch other devices if only the mouse is wanted
|
||||
else if (!mousegrab && i == MOUSE) continue; // don't grab the mouse if we don't want it grabbed
|
||||
|
||||
IDirectInputDevice2_Unacquire(*devicedef[i].did);
|
||||
IDirectInputDevice7_Unacquire(*devicedef[i].did);
|
||||
|
||||
if (i == MOUSE/* && fullscreen*/) flags = DISCL_FOREGROUND|DISCL_EXCLUSIVE;
|
||||
else flags = DISCL_FOREGROUND|DISCL_NONEXCLUSIVE;
|
||||
|
||||
result = IDirectInputDevice2_SetCooperativeLevel(*devicedef[i].did, hWindow, flags);
|
||||
result = IDirectInputDevice7_SetCooperativeLevel(*devicedef[i].did, hWindow, flags);
|
||||
if (FAILED(result))
|
||||
initprintf("IDirectInputDevice2_SetCooperativeLevel(%s): %s\n",
|
||||
initprintf("IDirectInputDevice7_SetCooperativeLevel(%s): %s\n",
|
||||
devicedef[i].name, GetDInputError(result));
|
||||
|
||||
if (SUCCEEDED(IDirectInputDevice2_Acquire(*devicedef[i].did)))
|
||||
if (SUCCEEDED(IDirectInputDevice7_Acquire(*devicedef[i].did)))
|
||||
devacquired[i] = 1;
|
||||
else
|
||||
devacquired[i] = 0;
|
||||
|
@ -1482,11 +1486,11 @@ static void AcquireInputDevices(char acquire, signed char device)
|
|||
if (! *devicedef[i].did) continue;
|
||||
if (device != -1 && i != device) continue; // don't touch other devices if only the mouse is wanted
|
||||
|
||||
IDirectInputDevice2_Unacquire(*devicedef[i].did);
|
||||
IDirectInputDevice7_Unacquire(*devicedef[i].did);
|
||||
|
||||
result = IDirectInputDevice2_SetCooperativeLevel(*devicedef[i].did, hWindow, DISCL_FOREGROUND|DISCL_NONEXCLUSIVE);
|
||||
result = IDirectInputDevice7_SetCooperativeLevel(*devicedef[i].did, hWindow, DISCL_FOREGROUND|DISCL_NONEXCLUSIVE);
|
||||
if (FAILED(result))
|
||||
initprintf("IDirectInputDevice2_SetCooperativeLevel(%s): %s\n",
|
||||
initprintf("IDirectInputDevice7_SetCooperativeLevel(%s): %s\n",
|
||||
devicedef[i].name, GetDInputError(result));
|
||||
|
||||
devacquired[i] = 0;
|
||||
|
@ -1500,69 +1504,105 @@ static void ProcessMouse()
|
|||
DWORD i;
|
||||
unsigned t;
|
||||
int result;
|
||||
DIDEVICEOBJECTDATA didod[INPUT_BUFFER_SIZE];
|
||||
DWORD dwElements = INPUT_BUFFER_SIZE;
|
||||
DIDEVICEOBJECTDATA didod;
|
||||
DWORD dwElements = 1;
|
||||
|
||||
while (1)
|
||||
{
|
||||
t = getticks();
|
||||
if (!mousegrab) break;
|
||||
result = IDirectInputDevice2_GetDeviceData(lpDID[MOUSE], sizeof(DIDEVICEOBJECTDATA),
|
||||
result = IDirectInputDevice7_GetDeviceData(lpDID[MOUSE], sizeof(DIDEVICEOBJECTDATA),
|
||||
(LPDIDEVICEOBJECTDATA)&didod, &dwElements, 0);
|
||||
|
||||
if (FAILED(result) || !dwElements)break;
|
||||
|
||||
if (result == DI_OK)
|
||||
else if (result == DI_OK)
|
||||
{
|
||||
// process the mouse events
|
||||
// mousex=0;
|
||||
// mousey=0;
|
||||
for (i=0; i<dwElements; i++)
|
||||
// for (i=0; i<dwElements; i++)
|
||||
{
|
||||
switch (didod[i].dwOfs)
|
||||
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)
|
||||
{
|
||||
case DIMOFS_BUTTON0:
|
||||
if (didod[i].dwData & 0x80) mouseb |= 1;
|
||||
else mouseb &= ~1;
|
||||
if (mousepresscallback)
|
||||
mousepresscallback(1, (mouseb&1)==1);
|
||||
break;
|
||||
case DIMOFS_BUTTON1:
|
||||
if (didod[i].dwData & 0x80) mouseb |= 2;
|
||||
else mouseb &= ~2;
|
||||
if (mousepresscallback)
|
||||
mousepresscallback(2, (mouseb&2)==2);
|
||||
break;
|
||||
case DIMOFS_BUTTON2:
|
||||
if (didod[i].dwData & 0x80) mouseb |= 4;
|
||||
else mouseb &= ~4;
|
||||
if (mousepresscallback)
|
||||
mousepresscallback(3, (mouseb&4)==4);
|
||||
break;
|
||||
case DIMOFS_BUTTON3:
|
||||
if (didod[i].dwData & 0x80) mouseb |= 8;
|
||||
else mouseb &= ~8;
|
||||
if (mousepresscallback)
|
||||
mousepresscallback(4, (mouseb&8)==8);
|
||||
break;
|
||||
case DIMOFS_X:
|
||||
mousex += (short)didod[i].dwData; break;
|
||||
case DIMOFS_Y:
|
||||
mousey += (short)didod[i].dwData; break;
|
||||
case DIMOFS_Z:
|
||||
if ((int)didod[i].dwData > 0) // wheel up
|
||||
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[i].dwData < 0) // wheel down
|
||||
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);
|
||||
}
|
||||
break;
|
||||
}
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1588,13 +1628,13 @@ static void ProcessInputDevices(void)
|
|||
{
|
||||
if (*devicedef[t].did&&t!=MOUSE)
|
||||
{
|
||||
result = IDirectInputDevice2_Poll(*devicedef[t].did);
|
||||
result = IDirectInputDevice7_Poll(*devicedef[t].did);
|
||||
if (result == DIERR_INPUTLOST || result == DIERR_NOTACQUIRED)
|
||||
{
|
||||
if (SUCCEEDED(IDirectInputDevice2_Acquire(*devicedef[t].did)))
|
||||
if (SUCCEEDED(IDirectInputDevice7_Acquire(*devicedef[t].did)))
|
||||
{
|
||||
devacquired[t] = 1;
|
||||
IDirectInputDevice2_Poll(*devicedef[t].did);
|
||||
IDirectInputDevice7_Poll(*devicedef[t].did);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -1639,7 +1679,7 @@ static void ProcessInputDevices(void)
|
|||
{
|
||||
case KEYBOARD: // keyboard
|
||||
if (!lpDID[KEYBOARD]) break;
|
||||
result = IDirectInputDevice2_GetDeviceData(lpDID[KEYBOARD], sizeof(DIDEVICEOBJECTDATA),
|
||||
result = IDirectInputDevice7_GetDeviceData(lpDID[KEYBOARD], sizeof(DIDEVICEOBJECTDATA),
|
||||
(LPDIDEVICEOBJECTDATA)&didod, &dwElements, 0);
|
||||
if (result == DI_OK)
|
||||
{
|
||||
|
@ -1678,7 +1718,7 @@ static void ProcessInputDevices(void)
|
|||
|
||||
case JOYSTICK: // joystick
|
||||
if (!lpDID[JOYSTICK]) break;
|
||||
result = IDirectInputDevice2_GetDeviceData(lpDID[JOYSTICK], sizeof(DIDEVICEOBJECTDATA),
|
||||
result = IDirectInputDevice7_GetDeviceData(lpDID[JOYSTICK], sizeof(DIDEVICEOBJECTDATA),
|
||||
(LPDIDEVICEOBJECTDATA)&didod, &dwElements, 0);
|
||||
if (result == DI_OK)
|
||||
{
|
||||
|
|
Binary file not shown.
Before Width: | Height: | Size: 28 KiB After Width: | Height: | Size: 28 KiB |
Binary file not shown.
Before Width: | Height: | Size: 28 KiB After Width: | Height: | Size: 28 KiB |
Binary file not shown.
|
@ -43,7 +43,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|||
#include <windows.h>
|
||||
#endif
|
||||
|
||||
#define BUILDDATE " 20081002"
|
||||
#define BUILDDATE " 20081005"
|
||||
#define VERSION " 1.2.0devel"
|
||||
|
||||
static int floor_over_floor;
|
||||
|
|
|
@ -25,7 +25,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|||
#define APPNAME "EDuke32"
|
||||
#define VERSION " 1.5.0devel"
|
||||
// this is checked against http://eduke32.com/VERSION
|
||||
#define BUILDDATE " 20081002"
|
||||
#define BUILDDATE " 20081005"
|
||||
#define HEAD2 APPNAME VERSION BUILDDATE
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
@ -76,7 +76,7 @@ extern int g_ScriptVersion, g_Shareware, g_GameType;
|
|||
|
||||
#define AUTO_AIM_ANGLE 48
|
||||
#define RECSYNCBUFSIZ 2520 //2520 is the (LCM of 1-8)*3
|
||||
#define MOVEFIFOSIZ 256
|
||||
#define MOVEFIFOSIZ 1024
|
||||
|
||||
#define FOURSLEIGHT (1<<8)
|
||||
|
||||
|
|
|
@ -2061,7 +2061,12 @@ static void coolgaugetext(int snum)
|
|||
if (sprite[p->i].pal == 1 && p->last_extra < 2)
|
||||
altdigitalnumber(40,-(200-22),1,-16,10+16);
|
||||
else if (!althud_flashing || p->last_extra > (p->max_player_health>>2) || totalclock&32)
|
||||
altdigitalnumber(40,-(200-22),p->last_extra,-16,10+16);
|
||||
{
|
||||
int s = -8;
|
||||
if (althud_flashing && p->last_extra > p->max_player_health)
|
||||
s += (sintable[(totalclock<<5)&2047]>>10);
|
||||
altdigitalnumber(40,-(200-22),p->last_extra,s,10+16);
|
||||
}
|
||||
|
||||
if (althud_shadows)
|
||||
rotatesprite(sbarx(62+1),sbary(200-25+1),sbarsc(49152L),0,SHIELD,0,4,10+16+1+32,0,0,xdim-1,ydim-1);
|
||||
|
@ -2592,16 +2597,8 @@ static void ShowFrameRate(void)
|
|||
int x = (xdim <= 640);
|
||||
int chars = Bsprintf(tempbuf, "%2u ms (%3u fps)", howlong, LastCount);
|
||||
|
||||
if (!x)
|
||||
{
|
||||
printext256(windowx2-(chars<<3)+1,windowy1+2,0,-1,tempbuf,x);
|
||||
printext256(windowx2-(chars<<3),windowy1+1,COLOR_WHITE,-1,tempbuf,x);
|
||||
}
|
||||
else
|
||||
{
|
||||
printext256(windowx2-(chars<<2)+1,windowy1+2,0,-1,tempbuf,x);
|
||||
printext256(windowx2-(chars<<2),windowy1+1,COLOR_WHITE,-1,tempbuf,x);
|
||||
}
|
||||
printext256(windowx2-(chars<<(3-x))+1,windowy1+2,0,-1,tempbuf,x);
|
||||
printext256(windowx2-(chars<<(3-x)),windowy1+1,COLOR_WHITE,-1,tempbuf,x);
|
||||
|
||||
if (numplayers > 1)
|
||||
if ((totalclock - lastpackettime) > 1)
|
||||
|
@ -2903,6 +2900,8 @@ void gameexit(const char *t)
|
|||
showtwoscreens();
|
||||
}
|
||||
|
||||
if (*t != 0) initprintf("%s\n",t);
|
||||
|
||||
if (qsetmode == 200)
|
||||
Shutdown();
|
||||
|
||||
|
@ -10717,7 +10716,7 @@ void app_main(int argc,const char **argv)
|
|||
#endif
|
||||
|
||||
OSD_SetLogFile("eduke32.log");
|
||||
OSD_SetParameters(6,0, 0,12, 2,12);
|
||||
OSD_SetParameters(0,0, 0,12, 2,12);
|
||||
OSD_SetFunctions(
|
||||
GAME_drawosdchar,
|
||||
GAME_drawosdstr,
|
||||
|
@ -10733,7 +10732,7 @@ void app_main(int argc,const char **argv)
|
|||
initprintf("%s\n",apptitle);
|
||||
// initprintf("Compiled %s\n",datetimestring);
|
||||
initprintf("Copyright (c) 1996, 2003 3D Realms Entertainment\n");
|
||||
initprintf("Copyright (c) 2008 EDuke32 team\n");
|
||||
initprintf("Copyright (c) 2008 EDuke32 team and contributors\n");
|
||||
|
||||
#if defined(__linux__) || defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__)
|
||||
addsearchpath("/usr/share/games/jfduke3d");
|
||||
|
@ -11120,17 +11119,37 @@ void app_main(int argc,const char **argv)
|
|||
|
||||
ud.last_level = -1;
|
||||
|
||||
if (Bstrcasecmp(ud.rtsname,"DUKE.RTS") == 0)
|
||||
if (Bstrcasecmp(ud.rtsname,"DUKE.RTS") == 0 ||
|
||||
Bstrcasecmp(ud.rtsname,"WW2GI.RTS") == 0 ||
|
||||
Bstrcasecmp(ud.rtsname,"NAM.RTS") == 0)
|
||||
{
|
||||
// ud.last_level is used as a flag here to reset the string to DUKE.RTS after load
|
||||
if (WW2GI)
|
||||
{
|
||||
ud.last_level = 1;
|
||||
Bstrcpy(ud.rtsname, "WW2GI.RTS");
|
||||
}
|
||||
else if (NAM)
|
||||
{
|
||||
ud.last_level = 1;
|
||||
Bstrcpy(ud.rtsname, "NAM.RTS");
|
||||
}
|
||||
else
|
||||
{
|
||||
ud.last_level = 1;
|
||||
Bstrcpy(ud.rtsname, "DUKE.RTS");
|
||||
}
|
||||
}
|
||||
|
||||
RTS_Init(ud.rtsname);
|
||||
if (numlumps) initprintf("Using .RTS file '%s'\n",ud.rtsname);
|
||||
|
||||
if (ud.last_level == 1)
|
||||
{
|
||||
ud.last_level = -1;
|
||||
Bstrcpy(ud.rtsname, "DUKE.RTS");
|
||||
}
|
||||
|
||||
initprintf("Initializing OSD...\n");
|
||||
|
||||
OSD_SetVersionString(HEAD2, 10,0);
|
||||
|
|
|
@ -5433,7 +5433,7 @@ void copydefaultcons(void)
|
|||
}
|
||||
}
|
||||
|
||||
/* Anything added with AddDefinition cannot be overwritten in the CONs */
|
||||
/* Anything added with AddDefinition() cannot be overwritten in the CONs */
|
||||
|
||||
static void AddDefinition(const char *lLabel,int lValue,int lType)
|
||||
{
|
||||
|
@ -5588,14 +5588,14 @@ static void InitProjectiles(void)
|
|||
-1, -1, -1, -1, -96, 18, 18, 0, 1
|
||||
};
|
||||
|
||||
// this will only happen if I forget to update this function...
|
||||
if (sizeof(projectile_t) != sizeof(DefaultProjectile))
|
||||
gameexit("ERROR: InitProjectiles() doesn't match projectile_t");
|
||||
gameexit("ERROR: InitProjectiles() projectile_t mismatch!");
|
||||
|
||||
for (i=MAXTILES-1;i>=0;i--)
|
||||
{
|
||||
Bmemcpy(&projectile[i],&DefaultProjectile,sizeof(projectile_t));
|
||||
}
|
||||
Bmemcpy(&defaultprojectile, &projectile, sizeof(projectile));
|
||||
|
||||
Bmemcpy(&defaultprojectile[0], &projectile[0], sizeof(projectile));
|
||||
}
|
||||
|
||||
extern int g_NumObituaries;
|
||||
|
@ -5642,8 +5642,9 @@ void loadefs(const char *filenam)
|
|||
}
|
||||
else if (numgroupfiles == 0)
|
||||
{
|
||||
Bsprintf(tempbuf,"Duke Nukem 3D was not found in this directory. A copy of '%s' or its contents is needed to run EDuke32.\n"
|
||||
"You can find '%s' in the \"DN3DINST\" or \"ATOMINST\" directory on your Duke Nukem 3D installation CD-ROM.",
|
||||
Bsprintf(tempbuf,"Duke Nukem 3D game data was not found. A copy of '%s' or other compatible data is needed to run EDuke32.\n"
|
||||
"You can find '%s' in the \"DN3DINST\" or \"ATOMINST\" directory on your Duke Nukem 3D installation CD-ROM.\n\n"
|
||||
"EDuke32 will now close.",
|
||||
duke3dgrp,duke3dgrp);
|
||||
}
|
||||
else Bsprintf(tempbuf,"CON file `%s' missing.", filenam);
|
||||
|
|
|
@ -54,7 +54,7 @@ extern "C" {
|
|||
|
||||
// Number of Mouse buttons
|
||||
|
||||
#define MAXMOUSEBUTTONS 6
|
||||
#define MAXMOUSEBUTTONS 10
|
||||
|
||||
// Number of JOY buttons
|
||||
|
||||
|
|
|
@ -81,7 +81,7 @@ extern "C" {
|
|||
|
||||
// Number of Mouse buttons
|
||||
|
||||
#define MAXMOUSEBUTTONS 6
|
||||
#define MAXMOUSEBUTTONS 10
|
||||
|
||||
// Number of Mouse Axes
|
||||
|
||||
|
|
|
@ -222,7 +222,7 @@ typedef struct binding {
|
|||
char laststate;
|
||||
} keybind;
|
||||
|
||||
#define MAXMOUSEBUTTONS 6
|
||||
#define MAXMOUSEBUTTONS 10
|
||||
|
||||
extern keybind boundkeys[MAXBOUNDKEYS], mousebind[MAXMOUSEBUTTONS];
|
||||
extern int bindsenabled;
|
||||
|
|
|
@ -47,8 +47,9 @@ static int changesmade, newvidmode, curvidmode, newfullscreen;
|
|||
static int vidsets[16] = { -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1 };
|
||||
static int curvidset, newvidset = 0;
|
||||
static int soundbits, soundvoices, soundrate;
|
||||
|
||||
static char *mousebuttonnames[] = { "Left", "Right", "Middle", "Thumb", "Wheel Up", "Wheel Down" };
|
||||
#undef MAXMOUSEBUTTONS
|
||||
#define MAXMOUSEBUTTONS 6 // FIXME: menu needs an update for extra buttons
|
||||
static char *mousebuttonnames[] = { "Mouse1", "Mouse2", "Mouse3", "Mouse4", "Wheel Up", "Wheel Down", "Mouse5", "Mouse6", "Mouse7", "Mouse8"};
|
||||
|
||||
extern int voting;
|
||||
|
||||
|
|
|
@ -1113,7 +1113,7 @@ keydef keynames[]=
|
|||
{0,0}
|
||||
};
|
||||
|
||||
char *mousenames[] = { "mouse1", "mouse2", "mouse3", "mouse4", "mouse5", "mouse6" };
|
||||
char *mousenames[] = { "mouse1", "mouse2", "mouse3", "mouse4", "mwheelup", "mwheeldn", "mouse5", "mouse6", "mouse7", "mouse8" };
|
||||
|
||||
static int osdcmd_bind(const osdfuncparm_t *parm)
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue