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

This commit is contained in:
terminx 2008-10-05 09:23:55 +00:00
parent d507a10397
commit 8dc599fc28
17 changed files with 200 additions and 124 deletions

View file

@ -265,7 +265,7 @@ static DIOBJECTDATAFORMAT c_dfDIKeyboard_odf[] = {
const DIDATAFORMAT c_dfDIKeyboard = { 24, 16, 0x00000002, 256, 256, c_dfDIKeyboard_odf }; const DIDATAFORMAT c_dfDIKeyboard = { 24, 16, 0x00000002, 256, 256, c_dfDIKeyboard_odf };
// Mouse // Mouse
/*
static DIOBJECTDATAFORMAT c_dfDIMouse_odf[] = { static DIOBJECTDATAFORMAT c_dfDIMouse_odf[] = {
{ &GUID_XAxis, 0, 0x00FFFF03, 0x00000000 }, { &GUID_XAxis, 0, 0x00FFFF03, 0x00000000 },
{ &GUID_YAxis, 4, 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 }; 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 // Joystick

View file

@ -364,7 +364,7 @@ int app_main(int argc, const char **argv)
loadpics("tiles000.art",1048576*16); loadpics("tiles000.art",1048576*16);
loadnames(); loadnames();
Bstrcpy(kensig,"Based on BUILD by Ken Silverman"); Bstrcpy(kensig,"Uses BUILD technology by Ken Silverman");
initcrc(); initcrc();
if (!loaddefinitionsfile(defsfilename)) initprintf("Definitions file loaded.\n"); if (!loaddefinitionsfile(defsfilename)) initprintf("Definitions file loaded.\n");

View file

@ -11051,7 +11051,7 @@ void draw2dgrid(int posxe, int posye, short ange, int zoome, short gride)
{ {
if (xp1 != xp2) 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; xp2 = xp1;
if ((xp2 >= 0) && (xp2 < xdim)) if ((xp2 >= 0) && (xp2 < xdim))
{ {
drawline16(xp2,yp1,xp2,yp2,25); drawline16(xp2,yp1,xp2,yp2,8);
} }
} }
xp1 = mulscale14(posxe+editorgridextent,zoome); 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)) 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; tempy = yp1;
} }
} }

View file

@ -1367,7 +1367,7 @@ void OSD_Draw(void)
clearbackground(osdcols,osdrowscur+1); clearbackground(osdcols,osdrowscur+1);
if (osdversionstring[0]) 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--) for (; lines>0; lines--, row--)
{ {
@ -1375,9 +1375,9 @@ void OSD_Draw(void)
topoffs+=osdcols; topoffs+=osdcols;
} }
drawosdchar(2,osdrowscur,'>',osdpromptshade,osdpromptpal); drawosdchar(2,osdrowscur,'>',osdpromptshade?osdpromptshade:(sintable[(totalclock<<4)&2047]>>11),osdpromptpal);
if (osdeditcaps) drawosdchar(0,osdrowscur,'C',osdpromptshade,osdpromptpal); if (osdeditcaps) drawosdchar(0,osdrowscur,'C',osdpromptshade?osdpromptshade:(sintable[(totalclock<<4)&2047]>>11),osdpromptpal);
if (osdeditshift) drawosdchar(1,osdrowscur,'H',osdpromptshade,osdpromptpal); if (osdeditshift) drawosdchar(1,osdrowscur,'H',osdpromptshade?osdpromptshade:(sintable[(totalclock<<4)&2047]>>11),osdpromptpal);
len = min(osdcols-1-3, osdeditlen-osdeditwinstart); len = min(osdcols-1-3, osdeditlen-osdeditwinstart);
for (x=len-1; x>=0; x--) for (x=len-1; x>=0; x--)

View file

@ -10,7 +10,7 @@
#error winlayer.c is for Windows only. #error winlayer.c is for Windows only.
#endif #endif
#define DIRECTINPUT_VERSION 0x0500 #define DIRECTINPUT_VERSION 0x0700
#define DIRECTDRAW_VERSION 0x0600 #define DIRECTDRAW_VERSION 0x0600
#define WIN32_LEAN_AND_MEAN #define WIN32_LEAN_AND_MEAN
@ -674,8 +674,8 @@ inline void idle(void)
#define NUM_INPUTS 3 #define NUM_INPUTS 3
static HMODULE hDInputDLL = NULL; static HMODULE hDInputDLL = NULL;
static LPDIRECTINPUTA lpDI = NULL; static LPDIRECTINPUT7A lpDI = NULL;
static LPDIRECTINPUTDEVICE2A lpDID[NUM_INPUTS] = { NULL, NULL, NULL }; static LPDIRECTINPUTDEVICE7A lpDID[NUM_INPUTS] = { NULL, NULL, NULL };
static BOOL bDInputInited = FALSE; static BOOL bDInputInited = FALSE;
#define INPUT_BUFFER_SIZE 32 #define INPUT_BUFFER_SIZE 32
static GUID guidDevs[NUM_INPUTS]; static GUID guidDevs[NUM_INPUTS];
@ -689,12 +689,12 @@ HANDLE mousethread;
static struct static struct
{ {
char *name; char *name;
LPDIRECTINPUTDEVICE2A *did; LPDIRECTINPUTDEVICE7A *did;
const DIDATAFORMAT *df; const DIDATAFORMAT *df;
} devicedef[NUM_INPUTS] = } devicedef[NUM_INPUTS] =
{ {
{ "keyboard", &lpDID[KEYBOARD], &c_dfDIKeyboard }, { "keyboard", &lpDID[KEYBOARD], &c_dfDIKeyboard },
{ "mouse", &lpDID[MOUSE], &c_dfDIMouse }, { "mouse", &lpDID[MOUSE], &c_dfDIMouse2 },
{ "joystick", &lpDID[JOYSTICK], &c_dfDIJoystick } { "joystick", &lpDID[JOYSTICK], &c_dfDIJoystick }
}; };
static struct _joydef static struct _joydef
@ -952,7 +952,7 @@ void setjoydeadzone(int axis, unsigned short dead, unsigned short satur)
} }
dipdw.dwData = dead; dipdw.dwData = dead;
result = IDirectInputDevice2_SetProperty(lpDID[JOYSTICK], DIPROP_DEADZONE, &dipdw.diph); result = IDirectInputDevice7_SetProperty(lpDID[JOYSTICK], DIPROP_DEADZONE, &dipdw.diph);
if FAILED(result) if FAILED(result)
{ {
//ShowDInputErrorBox("Failed setting joystick dead zone", 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; dipdw.dwData = satur;
result = IDirectInputDevice2_SetProperty(lpDID[JOYSTICK], DIPROP_SATURATION, &dipdw.diph); result = IDirectInputDevice7_SetProperty(lpDID[JOYSTICK], DIPROP_SATURATION, &dipdw.diph);
if FAILED(result) if FAILED(result)
{ {
//ShowDInputErrorBox("Failed setting joystick saturation point", 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; 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) if FAILED(result)
{ {
//ShowDInputErrorBox("Failed getting joystick dead zone", 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; *dead = dipdw.dwData;
result = IDirectInputDevice2_GetProperty(lpDID[JOYSTICK], DIPROP_SATURATION, &dipdw.diph); result = IDirectInputDevice7_GetProperty(lpDID[JOYSTICK], DIPROP_SATURATION, &dipdw.diph);
if FAILED(result) if FAILED(result)
{ {
//ShowDInputErrorBox("Failed getting joystick saturation point", result); //ShowDInputErrorBox("Failed getting joystick saturation point", result);
@ -1032,6 +1032,10 @@ void releaseallbuttons(void)
if (mouseb & 8) mousepresscallback(4, 0); if (mouseb & 8) mousepresscallback(4, 0);
if (mousewheel[0]>0) mousepresscallback(5,0); if (mousewheel[0]>0) mousepresscallback(5,0);
if (mousewheel[1]>0) mousepresscallback(6,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; mousewheel[0]=mousewheel[1]=0;
mouseb = 0; mouseb = 0;
@ -1182,10 +1186,10 @@ static BOOL CALLBACK InitDirectInput_enumobjects(LPCDIDEVICEOBJECTINSTANCE lpddo
static BOOL InitDirectInput(void) static BOOL InitDirectInput(void)
{ {
HRESULT result; HRESULT result;
HRESULT(WINAPI *aDirectInputCreateA)(HINSTANCE, DWORD, LPDIRECTINPUTA *, LPUNKNOWN); HRESULT(WINAPI *aDirectInputCreateA)(HINSTANCE, DWORD, LPDIRECTINPUT7A *, LPUNKNOWN);
DIPROPDWORD dipdw; DIPROPDWORD dipdw;
LPDIRECTINPUTDEVICEA dev; LPDIRECTINPUTDEVICE7A dev;
LPDIRECTINPUTDEVICE2A dev2; LPDIRECTINPUTDEVICE7A dev2;
DIDEVCAPS didc; DIDEVCAPS didc;
int devn; int devn;
@ -1219,7 +1223,7 @@ static BOOL InitDirectInput(void)
// enumerate devices to make us look fancy // enumerate devices to make us look fancy
initprintf(" - Enumerating attached input devices\n"); initprintf(" - Enumerating attached input devices\n");
inputdevices = 0; 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); } 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)); else if (result != DI_OK) initprintf(" Enumerated input devices with warning: %s\n",GetDInputError(result));
if (!(inputdevices & (1<<KEYBOARD))) if (!(inputdevices & (1<<KEYBOARD)))
@ -1238,33 +1242,33 @@ static BOOL InitDirectInput(void)
*devicedef[devn].did = NULL; *devicedef[devn].did = NULL;
// initprintf(" - Creating %s device\n", devicedef[devn].name); // 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); } if FAILED(result) { HorribleDInputDeath("Failed creating device", result); }
else if (result != DI_OK) initprintf(" Created device with warning: %s\n",GetDInputError(result)); else if (result != DI_OK) initprintf(" Created device with warning: %s\n",GetDInputError(result));
result = IDirectInputDevice_QueryInterface(dev, &IID_IDirectInputDevice2, (LPVOID *)&dev2); result = IDirectInputDevice7_QueryInterface(dev, &IID_IDirectInputDevice7, (LPVOID *)&dev2);
IDirectInputDevice_Release(dev); IDirectInputDevice7_Release(dev);
if FAILED(result) { HorribleDInputDeath("Failed querying DirectInput2 interface for device", result); } if FAILED(result) { HorribleDInputDeath("Failed querying DirectInput7 interface for device", result); }
else if (result != DI_OK) initprintf(" Queried IDirectInputDevice2 interface with warning: %s\n",GetDInputError(result)); else if (result != DI_OK) initprintf(" Queried IDirectInputDevice7 interface with warning: %s\n",GetDInputError(result));
result = IDirectInputDevice2_SetDataFormat(dev2, devicedef[devn].df); result = IDirectInputDevice7_SetDataFormat(dev2, devicedef[devn].df);
if FAILED(result) { IDirectInputDevice_Release(dev2); HorribleDInputDeath("Failed setting data format", result); } 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)); else if (result != DI_OK) initprintf(" Set data format with warning: %s\n",GetDInputError(result));
inputevt[devn] = CreateEvent(NULL, FALSE, FALSE, NULL); inputevt[devn] = CreateEvent(NULL, FALSE, FALSE, NULL);
if (inputevt[devn] == NULL) if (inputevt[devn] == NULL)
{ {
IDirectInputDevice_Release(dev2); IDirectInputDevice7_Release(dev2);
ShowErrorBox("Couldn't create event object"); ShowErrorBox("Couldn't create event object");
UninitDirectInput(); UninitDirectInput();
return TRUE; return TRUE;
} }
result = IDirectInputDevice2_SetEventNotification(dev2, inputevt[devn]); result = IDirectInputDevice7_SetEventNotification(dev2, inputevt[devn]);
if FAILED(result) { IDirectInputDevice_Release(dev2); HorribleDInputDeath("Failed setting event object", result); } 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)); 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)); memset(&dipdw, 0, sizeof(dipdw));
dipdw.diph.dwSize = sizeof(DIPROPDWORD); dipdw.diph.dwSize = sizeof(DIPROPDWORD);
@ -1273,8 +1277,8 @@ static BOOL InitDirectInput(void)
dipdw.diph.dwHow = DIPH_DEVICE; dipdw.diph.dwHow = DIPH_DEVICE;
dipdw.dwData = INPUT_BUFFER_SIZE; dipdw.dwData = INPUT_BUFFER_SIZE;
result = IDirectInputDevice2_SetProperty(dev2, DIPROP_BUFFERSIZE, &dipdw.diph); result = IDirectInputDevice7_SetProperty(dev2, DIPROP_BUFFERSIZE, &dipdw.diph);
if FAILED(result) { IDirectInputDevice_Release(dev2); HorribleDInputDeath("Failed setting buffering", result); } 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)); else if (result != DI_OK) initprintf(" Set buffering with warning: %s\n",GetDInputError(result));
// set up device // set up device
@ -1284,8 +1288,8 @@ static BOOL InitDirectInput(void)
memset(&didc, 0, sizeof(didc)); memset(&didc, 0, sizeof(didc));
didc.dwSize = sizeof(didc); didc.dwSize = sizeof(didc);
result = IDirectInputDevice2_GetCapabilities(dev2, &didc); result = IDirectInputDevice7_GetCapabilities(dev2, &didc);
if FAILED(result) { IDirectInputDevice_Release(dev2); HorribleDInputDeath("Failed getting joystick capabilities", result); } 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)); else if (result != DI_OK) initprintf(" Fetched joystick capabilities with warning: %s\n",GetDInputError(result));
joynumaxes = (char)didc.dwAxes; joynumaxes = (char)didc.dwAxes;
@ -1300,8 +1304,8 @@ static BOOL InitDirectInput(void)
joyaxis = (int *)Bcalloc(didc.dwAxes, sizeof(int)); joyaxis = (int *)Bcalloc(didc.dwAxes, sizeof(int));
joyhat = (int *)Bcalloc(didc.dwPOVs, sizeof(int)); joyhat = (int *)Bcalloc(didc.dwPOVs, sizeof(int));
result = IDirectInputDevice2_EnumObjects(dev2, InitDirectInput_enumobjects, (LPVOID)typecounts, DIDFT_ALL); result = IDirectInputDevice7_EnumObjects(dev2, InitDirectInput_enumobjects, (LPVOID)typecounts, DIDFT_ALL);
if FAILED(result) { IDirectInputDevice_Release(dev2); HorribleDInputDeath("Failed getting joystick features", result); } 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)); 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); // 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; *devicedef[devn].did = NULL;
} }
if (inputevt[devn]) if (inputevt[devn])
@ -1365,7 +1369,7 @@ static void UninitDirectInput(void)
if (lpDI) if (lpDI)
{ {
// initprintf(" - Releasing DirectInput object\n"); // initprintf(" - Releasing DirectInput object\n");
IDirectInput_Release(lpDI); IDirectInput7_Release(lpDI);
lpDI = NULL; lpDI = NULL;
} }
@ -1396,7 +1400,7 @@ static void GetKeyNames(void)
ZeroMemory(&key,sizeof(key)); ZeroMemory(&key,sizeof(key));
key.dwSize = sizeof(DIDEVICEOBJECTINSTANCE); 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; if (FAILED(res)) continue;
CharToOem(key.tszName, tbuf); 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 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 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; if (i == MOUSE/* && fullscreen*/) flags = DISCL_FOREGROUND|DISCL_EXCLUSIVE;
else flags = DISCL_FOREGROUND|DISCL_NONEXCLUSIVE; 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)) if (FAILED(result))
initprintf("IDirectInputDevice2_SetCooperativeLevel(%s): %s\n", initprintf("IDirectInputDevice7_SetCooperativeLevel(%s): %s\n",
devicedef[i].name, GetDInputError(result)); devicedef[i].name, GetDInputError(result));
if (SUCCEEDED(IDirectInputDevice2_Acquire(*devicedef[i].did))) if (SUCCEEDED(IDirectInputDevice7_Acquire(*devicedef[i].did)))
devacquired[i] = 1; devacquired[i] = 1;
else else
devacquired[i] = 0; devacquired[i] = 0;
@ -1482,11 +1486,11 @@ static void AcquireInputDevices(char acquire, signed char device)
if (! *devicedef[i].did) continue; if (! *devicedef[i].did) continue;
if (device != -1 && i != device) continue; // don't touch other devices if only the mouse is wanted 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)) if (FAILED(result))
initprintf("IDirectInputDevice2_SetCooperativeLevel(%s): %s\n", initprintf("IDirectInputDevice7_SetCooperativeLevel(%s): %s\n",
devicedef[i].name, GetDInputError(result)); devicedef[i].name, GetDInputError(result));
devacquired[i] = 0; devacquired[i] = 0;
@ -1500,69 +1504,105 @@ static void ProcessMouse()
DWORD i; DWORD i;
unsigned t; unsigned t;
int result; int result;
DIDEVICEOBJECTDATA didod[INPUT_BUFFER_SIZE]; DIDEVICEOBJECTDATA didod;
DWORD dwElements = INPUT_BUFFER_SIZE; DWORD dwElements = 1;
while (1) while (1)
{ {
t = getticks(); t = getticks();
if (!mousegrab) break; if (!mousegrab) break;
result = IDirectInputDevice2_GetDeviceData(lpDID[MOUSE], sizeof(DIDEVICEOBJECTDATA), result = IDirectInputDevice7_GetDeviceData(lpDID[MOUSE], sizeof(DIDEVICEOBJECTDATA),
(LPDIDEVICEOBJECTDATA)&didod, &dwElements, 0); (LPDIDEVICEOBJECTDATA)&didod, &dwElements, 0);
if (FAILED(result) || !dwElements)break; if (FAILED(result) || !dwElements)break;
else if (result == DI_OK)
if (result == DI_OK)
{ {
// process the mouse events // process the mouse events
// mousex=0; // mousex=0;
// mousey=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 ((int)didod.dwData > 0) // wheel up
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 (mousewheel[0] > 0 && mousepresscallback) mousepresscallback(5,0); if (mousewheel[0] > 0 && mousepresscallback) mousepresscallback(5,0);
mousewheel[0] = t; mousewheel[0] = t;
mouseb |= 16; if (mousepresscallback) mousepresscallback(5, 1); 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); if (mousewheel[1] > 0 && mousepresscallback) mousepresscallback(6,0);
mousewheel[1] = t; mousewheel[1] = t;
mouseb |= 32; if (mousepresscallback) mousepresscallback(6, 1); 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) 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 (result == DIERR_INPUTLOST || result == DIERR_NOTACQUIRED)
{ {
if (SUCCEEDED(IDirectInputDevice2_Acquire(*devicedef[t].did))) if (SUCCEEDED(IDirectInputDevice7_Acquire(*devicedef[t].did)))
{ {
devacquired[t] = 1; devacquired[t] = 1;
IDirectInputDevice2_Poll(*devicedef[t].did); IDirectInputDevice7_Poll(*devicedef[t].did);
} }
else else
{ {
@ -1639,7 +1679,7 @@ static void ProcessInputDevices(void)
{ {
case KEYBOARD: // keyboard case KEYBOARD: // keyboard
if (!lpDID[KEYBOARD]) break; if (!lpDID[KEYBOARD]) break;
result = IDirectInputDevice2_GetDeviceData(lpDID[KEYBOARD], sizeof(DIDEVICEOBJECTDATA), result = IDirectInputDevice7_GetDeviceData(lpDID[KEYBOARD], sizeof(DIDEVICEOBJECTDATA),
(LPDIDEVICEOBJECTDATA)&didod, &dwElements, 0); (LPDIDEVICEOBJECTDATA)&didod, &dwElements, 0);
if (result == DI_OK) if (result == DI_OK)
{ {
@ -1678,7 +1718,7 @@ static void ProcessInputDevices(void)
case JOYSTICK: // joystick case JOYSTICK: // joystick
if (!lpDID[JOYSTICK]) break; if (!lpDID[JOYSTICK]) break;
result = IDirectInputDevice2_GetDeviceData(lpDID[JOYSTICK], sizeof(DIDEVICEOBJECTDATA), result = IDirectInputDevice7_GetDeviceData(lpDID[JOYSTICK], sizeof(DIDEVICEOBJECTDATA),
(LPDIDEVICEOBJECTDATA)&didod, &dwElements, 0); (LPDIDEVICEOBJECTDATA)&didod, &dwElements, 0);
if (result == DI_OK) 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.

View file

@ -43,7 +43,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include <windows.h> #include <windows.h>
#endif #endif
#define BUILDDATE " 20081002" #define BUILDDATE " 20081005"
#define VERSION " 1.2.0devel" #define VERSION " 1.2.0devel"
static int floor_over_floor; static int floor_over_floor;

View file

@ -25,7 +25,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#define APPNAME "EDuke32" #define APPNAME "EDuke32"
#define VERSION " 1.5.0devel" #define VERSION " 1.5.0devel"
// this is checked against http://eduke32.com/VERSION // this is checked against http://eduke32.com/VERSION
#define BUILDDATE " 20081002" #define BUILDDATE " 20081005"
#define HEAD2 APPNAME VERSION BUILDDATE #define HEAD2 APPNAME VERSION BUILDDATE
#ifdef __cplusplus #ifdef __cplusplus
@ -76,7 +76,7 @@ extern int g_ScriptVersion, g_Shareware, g_GameType;
#define AUTO_AIM_ANGLE 48 #define AUTO_AIM_ANGLE 48
#define RECSYNCBUFSIZ 2520 //2520 is the (LCM of 1-8)*3 #define RECSYNCBUFSIZ 2520 //2520 is the (LCM of 1-8)*3
#define MOVEFIFOSIZ 256 #define MOVEFIFOSIZ 1024
#define FOURSLEIGHT (1<<8) #define FOURSLEIGHT (1<<8)

View file

@ -2061,7 +2061,12 @@ static void coolgaugetext(int snum)
if (sprite[p->i].pal == 1 && p->last_extra < 2) if (sprite[p->i].pal == 1 && p->last_extra < 2)
altdigitalnumber(40,-(200-22),1,-16,10+16); altdigitalnumber(40,-(200-22),1,-16,10+16);
else if (!althud_flashing || p->last_extra > (p->max_player_health>>2) || totalclock&32) 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) 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); 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 x = (xdim <= 640);
int chars = Bsprintf(tempbuf, "%2u ms (%3u fps)", howlong, LastCount); int chars = Bsprintf(tempbuf, "%2u ms (%3u fps)", howlong, LastCount);
if (!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);
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);
}
if (numplayers > 1) if (numplayers > 1)
if ((totalclock - lastpackettime) > 1) if ((totalclock - lastpackettime) > 1)
@ -2903,6 +2900,8 @@ void gameexit(const char *t)
showtwoscreens(); showtwoscreens();
} }
if (*t != 0) initprintf("%s\n",t);
if (qsetmode == 200) if (qsetmode == 200)
Shutdown(); Shutdown();
@ -10717,7 +10716,7 @@ void app_main(int argc,const char **argv)
#endif #endif
OSD_SetLogFile("eduke32.log"); OSD_SetLogFile("eduke32.log");
OSD_SetParameters(6,0, 0,12, 2,12); OSD_SetParameters(0,0, 0,12, 2,12);
OSD_SetFunctions( OSD_SetFunctions(
GAME_drawosdchar, GAME_drawosdchar,
GAME_drawosdstr, GAME_drawosdstr,
@ -10733,7 +10732,7 @@ void app_main(int argc,const char **argv)
initprintf("%s\n",apptitle); initprintf("%s\n",apptitle);
// initprintf("Compiled %s\n",datetimestring); // initprintf("Compiled %s\n",datetimestring);
initprintf("Copyright (c) 1996, 2003 3D Realms Entertainment\n"); 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__) #if defined(__linux__) || defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__)
addsearchpath("/usr/share/games/jfduke3d"); addsearchpath("/usr/share/games/jfduke3d");
@ -11120,17 +11119,37 @@ void app_main(int argc,const char **argv)
ud.last_level = -1; 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) if (WW2GI)
{
ud.last_level = 1;
Bstrcpy(ud.rtsname, "WW2GI.RTS"); Bstrcpy(ud.rtsname, "WW2GI.RTS");
}
else if (NAM) else if (NAM)
{
ud.last_level = 1;
Bstrcpy(ud.rtsname, "NAM.RTS"); Bstrcpy(ud.rtsname, "NAM.RTS");
} }
else
{
ud.last_level = 1;
Bstrcpy(ud.rtsname, "DUKE.RTS");
}
}
RTS_Init(ud.rtsname); RTS_Init(ud.rtsname);
if (numlumps) initprintf("Using .RTS file '%s'\n",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"); initprintf("Initializing OSD...\n");
OSD_SetVersionString(HEAD2, 10,0); OSD_SetVersionString(HEAD2, 10,0);

View file

@ -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) 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 -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)) 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--) for (i=MAXTILES-1;i>=0;i--)
{
Bmemcpy(&projectile[i],&DefaultProjectile,sizeof(projectile_t)); Bmemcpy(&projectile[i],&DefaultProjectile,sizeof(projectile_t));
}
Bmemcpy(&defaultprojectile, &projectile, sizeof(projectile)); Bmemcpy(&defaultprojectile[0], &projectile[0], sizeof(projectile));
} }
extern int g_NumObituaries; extern int g_NumObituaries;
@ -5642,8 +5642,9 @@ void loadefs(const char *filenam)
} }
else if (numgroupfiles == 0) 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" 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.", "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); duke3dgrp,duke3dgrp);
} }
else Bsprintf(tempbuf,"CON file `%s' missing.", filenam); else Bsprintf(tempbuf,"CON file `%s' missing.", filenam);

View file

@ -54,7 +54,7 @@ extern "C" {
// Number of Mouse buttons // Number of Mouse buttons
#define MAXMOUSEBUTTONS 6 #define MAXMOUSEBUTTONS 10
// Number of JOY buttons // Number of JOY buttons

View file

@ -81,7 +81,7 @@ extern "C" {
// Number of Mouse buttons // Number of Mouse buttons
#define MAXMOUSEBUTTONS 6 #define MAXMOUSEBUTTONS 10
// Number of Mouse Axes // Number of Mouse Axes

View file

@ -222,7 +222,7 @@ typedef struct binding {
char laststate; char laststate;
} keybind; } keybind;
#define MAXMOUSEBUTTONS 6 #define MAXMOUSEBUTTONS 10
extern keybind boundkeys[MAXBOUNDKEYS], mousebind[MAXMOUSEBUTTONS]; extern keybind boundkeys[MAXBOUNDKEYS], mousebind[MAXMOUSEBUTTONS];
extern int bindsenabled; extern int bindsenabled;

View file

@ -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 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 curvidset, newvidset = 0;
static int soundbits, soundvoices, soundrate; static int soundbits, soundvoices, soundrate;
#undef MAXMOUSEBUTTONS
static char *mousebuttonnames[] = { "Left", "Right", "Middle", "Thumb", "Wheel Up", "Wheel Down" }; #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; extern int voting;

View file

@ -1113,7 +1113,7 @@ keydef keynames[]=
{0,0} {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) static int osdcmd_bind(const osdfuncparm_t *parm)
{ {