From 245cb5ddb59729048e753dc14f55513ca8a53cf1 Mon Sep 17 00:00:00 2001 From: "havoc havoc@d7cf8633-e32d-0410-b094-e92efae38249" <> Date: Thu, 19 Aug 2010 14:38:49 +0000 Subject: [PATCH] UNMERGE fix almost all g++ -pedantic warnings git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@10402 d7cf8633-e32d-0410-b094-e92efae38249 ::stable-branch::unmerge=0f80ff51ff9f369233d17b3377d3a0d34b4c8e5a --- bih.h | 6 ++-- cap_ogg.c | 2 +- cl_parse.c | 6 ++-- cl_screen.c | 4 +-- cl_video.c | 2 +- client.h | 2 +- cmd.c | 3 +- common.c | 4 ++- common.h | 2 +- csprogs.c | 2 +- cvar.c | 40 ++++++++++----------- cvar.h | 10 +++--- dpvsimpledecode.c | 4 +-- dpvsimpledecode.h | 4 +-- draw.h | 2 +- filematch.c | 8 ++--- gl_backend.c | 2 +- gl_textures.c | 6 ++-- glquake.h | 2 +- host_cmd.c | 2 +- image_png.c | 8 ++--- lhnet.c | 4 --- lhnet.h | 2 +- libcurl.c | 4 +-- menu.c | 46 ++++++++++++------------- menu.h | 2 +- model_brush.c | 3 +- model_shared.h | 2 +- mvm_cmds.c | 2 +- progsvm.h | 12 +++---- prvm_cmds.c | 2 +- prvm_edict.c | 4 +-- prvm_exec.c | 2 +- r_modules.c | 4 +-- r_modules.h | 2 +- r_shadow.c | 2 +- r_textures.h | 2 +- render.h | 4 +-- snd_ogg.c | 2 +- snd_wav.c | 4 +-- sv_main.c | 15 ++++---- svvm_cmds.c | 2 +- sys_linux.c | 2 +- sys_shared.c | 4 +-- vid.h | 2 +- vid_wgl.c | 88 ++++++++++++++++++++++++++++++----------------- 46 files changed, 174 insertions(+), 165 deletions(-) diff --git a/bih.h b/bih.h index 810cf9ca..90ec71db 100644 --- a/bih.h +++ b/bih.h @@ -9,7 +9,7 @@ typedef enum biherror_e { BIHERROR_OK, // no error, be happy - BIHERROR_OUT_OF_NODES // could not produce complete hierarchy, maxnodes too low (should be roughly half of numleafs) + BIHERROR_OUT_OF_NODES, // could not produce complete hierarchy, maxnodes too low (should be roughly half of numleafs) } biherror_t; @@ -17,7 +17,7 @@ typedef enum bih_nodetype_e { BIH_SPLITX = 0, BIH_SPLITY = 1, - BIH_SPLITZ = 2 + BIH_SPLITZ = 2, } bih_nodetype_t; @@ -25,7 +25,7 @@ typedef enum bih_leaftype_e { BIH_BRUSH = 3, BIH_COLLISIONTRIANGLE = 4, - BIH_RENDERTRIANGLE = 5 + BIH_RENDERTRIANGLE = 5, } bih_leaftype_t; diff --git a/cap_ogg.c b/cap_ogg.c index 3318c356..b3c29023 100644 --- a/cap_ogg.c +++ b/cap_ogg.c @@ -345,7 +345,7 @@ typedef enum { OC_PF_420, /**< Chroma subsampling by 2 in each direction (4:2:0) */ OC_PF_RSVD, /**< Reserved value */ OC_PF_422, /**< Horizonatal chroma subsampling by 2 (4:2:2) */ - OC_PF_444 /**< No chroma subsampling at all (4:4:4) */ + OC_PF_444, /**< No chroma subsampling at all (4:4:4) */ } theora_pixelformat; /** * Theora bitstream info. diff --git a/cl_parse.c b/cl_parse.c index 72e377da..0c6d1c31 100644 --- a/cl_parse.c +++ b/cl_parse.c @@ -26,7 +26,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include "libcurl.h" #include "utf8lib.h" -const char *svc_strings[128] = +char *svc_strings[128] = { "svc_bad", "svc_nop", @@ -100,7 +100,7 @@ const char *svc_strings[128] = "svc_pointparticles1", // 62 // [short] effectnum [vector] start, same as svc_pointparticles except velocity is zero and count is 1 }; -const char *qw_svc_strings[128] = +char *qw_svc_strings[128] = { "qw_svc_bad", // 0 "qw_svc_nop", // 1 @@ -3288,7 +3288,7 @@ void CL_ParseServerMessage(void) int i; protocolversion_t protocol; unsigned char cmdlog[32]; - const char *cmdlogname[32], *temp; + char *cmdlogname[32], *temp; int cmdindex, cmdcount = 0; qboolean qwplayerupdatereceived; qboolean strip_pqc; diff --git a/cl_screen.c b/cl_screen.c index 3236056d..5dbf4d21 100644 --- a/cl_screen.c +++ b/cl_screen.c @@ -696,7 +696,7 @@ int speedstringcount, r_timereport_active; double r_timereport_temp = 0, r_timereport_current = 0, r_timereport_start = 0; int r_speeds_longestitem = 0; -void R_TimeReport(const char *desc) +void R_TimeReport(char *desc) { char tempbuf[256]; int length; @@ -1314,7 +1314,7 @@ Grab six views for environment mapping tests struct envmapinfo_s { float angles[3]; - const char *name; + char *name; qboolean flipx, flipy, flipdiagonaly; } envmapinfo[12] = diff --git a/cl_video.c b/cl_video.c index 59a5b603..a6a5e0ea 100644 --- a/cl_video.c +++ b/cl_video.c @@ -34,7 +34,7 @@ static clvideo_t *FindUnusedVid( void ) static qboolean OpenStream( clvideo_t * video ) { - const char *errorstring; + char *errorstring; video->stream = dpvsimpledecode_open( video->filename, &errorstring); if (!video->stream ) { diff --git a/client.h b/client.h index 2ab8079c..b90ca35b 100644 --- a/client.h +++ b/client.h @@ -537,7 +537,7 @@ qw_downloadtype_t; typedef enum capturevideoformat_e { CAPTUREVIDEOFORMAT_AVI_I420, - CAPTUREVIDEOFORMAT_OGG_VORBIS_THEORA + CAPTUREVIDEOFORMAT_OGG_VORBIS_THEORA, } capturevideoformat_t; diff --git a/cmd.c b/cmd.c index 995473c6..18cb6a13 100644 --- a/cmd.c +++ b/cmd.c @@ -857,7 +857,6 @@ static const char *Cmd_GetCvarValue(const char *var, size_t varlen, cmdalias_t * static char varval[MAX_INPUTLINE]; const char *varstr; char *varfunc; -static char asis[] = "asis"; // just to suppress const char warnings if(varlen >= MAX_INPUTLINE) varlen = MAX_INPUTLINE - 1; @@ -888,7 +887,7 @@ static char asis[] = "asis"; // just to suppress const char warnings varstr = Cmd_GetDirectCvarValue(varname, alias, &is_multiple); if(is_multiple) if(!varfunc) - varfunc = asis; + varfunc = "asis"; } if(!varstr) diff --git a/common.c b/common.c index 9615b5a7..8c5e7dbd 100644 --- a/common.c +++ b/common.c @@ -606,7 +606,7 @@ void SZ_Write (sizebuf_t *buf, const unsigned char *data, int length) // attention, it has been eradicated from here, its only (former) use in // all of darkplaces. -static const char *hexchar = "0123456789ABCDEF"; +static char *hexchar = "0123456789ABCDEF"; void Com_HexDumpToConsole(const unsigned char *data, int size) { int i, j, n; @@ -1999,6 +1999,8 @@ void InfoString_GetValue(const char *buffer, const char *key, char *value, size_ size_t keylength; if (!key) key = ""; + if (!value) + value = ""; keylength = strlen(key); if (valuelength < 1 || !value) { diff --git a/common.h b/common.h index 0902ca77..104521fb 100644 --- a/common.h +++ b/common.h @@ -134,7 +134,7 @@ typedef enum protocolversion_e PROTOCOL_QUAKEWORLD, ///< quakeworld protocol PROTOCOL_NEHAHRABJP, ///< same as QUAKEDP but with 16bit modelindex PROTOCOL_NEHAHRABJP2, ///< same as NEHAHRABJP but with 16bit soundindex - PROTOCOL_NEHAHRABJP3 ///< same as NEHAHRABJP2 but with some changes + PROTOCOL_NEHAHRABJP3, ///< same as NEHAHRABJP2 but with some changes } protocolversion_t; diff --git a/csprogs.c b/csprogs.c index 33f2987f..8aac1a18 100644 --- a/csprogs.c +++ b/csprogs.c @@ -30,7 +30,7 @@ void CL_VM_PreventInformationLeaks(void) } //[515]: these are required funcs -static const char *cl_required_func[] = +static char *cl_required_func[] = { "CSQC_Init", "CSQC_InputEvent", diff --git a/cvar.c b/cvar.c index 4696034a..c6f69360 100644 --- a/cvar.c +++ b/cvar.c @@ -21,11 +21,11 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include "quakedef.h" -const char *cvar_dummy_description = "custom cvar"; +char *cvar_dummy_description = "custom cvar"; cvar_t *cvar_vars = NULL; cvar_t *cvar_hashtable[CVAR_HASHSIZE]; -const char *cvar_null_string = ""; +char *cvar_null_string = ""; /* ============ @@ -324,11 +324,11 @@ void Cvar_SetQuick_Internal (cvar_t *var, const char *value) valuelen = strlen(value); if (!var->string || strlen(var->string) != valuelen) { - Z_Free ((char *)var->string); // free the old value string + Z_Free (var->string); // free the old value string var->string = (char *)Z_Malloc (valuelen + 1); } - memcpy ((char *)var->string, value, valuelen + 1); + memcpy (var->string, value, valuelen + 1); var->value = atof (var->string); var->integer = (int) var->value; if ((var->flags & CVAR_NOTIFY) && changed && sv.active) @@ -504,7 +504,7 @@ void Cvar_RegisterVariable (cvar_t *variable) // get rid of old allocated cvar // (but not cvar->string and cvar->defstring, because we kept those) - Z_Free((char *)cvar->name); + Z_Free(cvar->name); Z_Free(cvar); } else @@ -520,12 +520,12 @@ void Cvar_RegisterVariable (cvar_t *variable) } // copy the value off, because future sets will Z_Free it - oldstr = (char *)variable->string; + oldstr = variable->string; alloclen = strlen(variable->string) + 1; variable->string = (char *)Z_Malloc (alloclen); - memcpy ((char *)variable->string, oldstr, alloclen); + memcpy (variable->string, oldstr, alloclen); variable->defstring = (char *)Z_Malloc (alloclen); - memcpy ((char *)variable->defstring, oldstr, alloclen); + memcpy (variable->defstring, oldstr, alloclen); variable->value = atof (variable->string); variable->integer = (int) variable->value; @@ -571,13 +571,13 @@ cvar_t *Cvar_Get (const char *name, const char *value, int flags, const char *ne if(newdescription && (cvar->flags & CVAR_ALLOCATED)) { if(cvar->description != cvar_dummy_description) - Z_Free((char *)cvar->description); + Z_Free(cvar->description); if(*newdescription) { alloclen = strlen(newdescription) + 1; cvar->description = (char *)Z_Malloc(alloclen); - memcpy((char *)cvar->description, newdescription, alloclen); + memcpy(cvar->description, newdescription, alloclen); } else cvar->description = cvar_dummy_description; @@ -606,12 +606,12 @@ cvar_t *Cvar_Get (const char *name, const char *value, int flags, const char *ne cvar->flags = flags | CVAR_ALLOCATED; alloclen = strlen(name) + 1; cvar->name = (char *)Z_Malloc(alloclen); - memcpy((char *)cvar->name, name, alloclen); + memcpy(cvar->name, name, alloclen); alloclen = strlen(value) + 1; cvar->string = (char *)Z_Malloc(alloclen); - memcpy((char *)cvar->string, value, alloclen); + memcpy(cvar->string, value, alloclen); cvar->defstring = (char *)Z_Malloc(alloclen); - memcpy((char *)cvar->defstring, value, alloclen); + memcpy(cvar->defstring, value, alloclen); cvar->value = atof (cvar->string); cvar->integer = (int) cvar->value; @@ -619,7 +619,7 @@ cvar_t *Cvar_Get (const char *name, const char *value, int flags, const char *ne { alloclen = strlen(newdescription) + 1; cvar->description = (char *)Z_Malloc(alloclen); - memcpy((char *)cvar->description, newdescription, alloclen); + memcpy(cvar->description, newdescription, alloclen); } else cvar->description = cvar_dummy_description; // actually checked by VM_cvar_type @@ -702,10 +702,10 @@ void Cvar_LockDefaults_f (void) //Con_Printf("locking cvar %s (%s -> %s)\n", var->name, var->string, var->defstring); var->flags |= CVAR_DEFAULTSET; - Z_Free((char *)var->defstring); + Z_Free(var->defstring); alloclen = strlen(var->string) + 1; var->defstring = (char *)Z_Malloc(alloclen); - memcpy((char *)var->defstring, var->string, alloclen); + memcpy(var->defstring, var->string, alloclen); } } } @@ -912,11 +912,11 @@ void Cvar_Del_f (void) *link = cvar->nextonhashchain; if(cvar->description != cvar_dummy_description) - Z_Free((char *)cvar->description); + Z_Free(cvar->description); - Z_Free((char *)cvar->name); - Z_Free((char *)cvar->string); - Z_Free((char *)cvar->defstring); + Z_Free(cvar->name); + Z_Free(cvar->string); + Z_Free(cvar->defstring); Z_Free(cvar); } } diff --git a/cvar.h b/cvar.h index 1509f756..3c94aae2 100644 --- a/cvar.h +++ b/cvar.h @@ -114,15 +114,15 @@ typedef struct cvar_s { int flags; - const char *name; + char *name; - const char *string; - const char *description; + char *string; + char *description; int integer; float value; float vector[3]; - const char *defstring; + char *defstring; unsigned int globaldefindex_progid[3]; int globaldefindex[3]; @@ -213,7 +213,7 @@ void Cvar_Del_f (void); /// or merely sets its value if it already exists. cvar_t *Cvar_Get (const char *name, const char *value, int flags, const char *newdescription); -extern const char *cvar_dummy_description; // ALWAYS the same pointer +extern char *cvar_dummy_description; // ALWAYS the same pointer extern cvar_t *cvar_vars; // used to list all cvars void Cvar_UpdateAllAutoCvars(void); // updates ALL autocvars of the active prog to the cvar values (savegame loading) diff --git a/dpvsimpledecode.c b/dpvsimpledecode.c index 8ad43bea..3f6567bd 100644 --- a/dpvsimpledecode.c +++ b/dpvsimpledecode.c @@ -333,7 +333,7 @@ static int dpvsimpledecode_setpixelformat(dpvsimpledecodestream_t *s, unsigned i // opening and closing streams // opens a stream -void *dpvsimpledecode_open(char *filename, const char **errorstring) +void *dpvsimpledecode_open(char *filename, char **errorstring) { dpvsimpledecodestream_t *s; char t[8], *wavename; @@ -437,7 +437,7 @@ void dpvsimpledecode_close(void *stream) // number to DPVSIMPLEDECODEERROR_NONE // if the supplied string pointer variable is not NULL, it will be set to the // error message -int dpvsimpledecode_error(void *stream, const char **errorstring) +int dpvsimpledecode_error(void *stream, char **errorstring) { dpvsimpledecodestream_t *s = (dpvsimpledecodestream_t *)stream; int e; diff --git a/dpvsimpledecode.h b/dpvsimpledecode.h index 075f3652..2d1f99c9 100644 --- a/dpvsimpledecode.h +++ b/dpvsimpledecode.h @@ -16,7 +16,7 @@ // opening and closing streams // opens a stream -void *dpvsimpledecode_open(char *filename, const char **errorstring); +void *dpvsimpledecode_open(char *filename, char **errorstring); // closes a stream void dpvsimpledecode_close(void *stream); @@ -26,7 +26,7 @@ void dpvsimpledecode_close(void *stream); // number to DPVDECODEERROR_NONE // if the supplied string pointer variable is not NULL, it will be set to the // error message -int dpvsimpledecode_error(void *stream, const char **errorstring); +int dpvsimpledecode_error(void *stream, char **errorstring); // returns the width of the image data unsigned int dpvsimpledecode_getwidth(void *stream); diff --git a/draw.h b/draw.h index cd220ce0..ace96f8c 100644 --- a/draw.h +++ b/draw.h @@ -51,7 +51,7 @@ typedef enum cachepicflags_e CACHEPICFLAG_NOTPERSISTENT = 1, CACHEPICFLAG_QUIET = 2, CACHEPICFLAG_NOCOMPRESSION = 4, - CACHEPICFLAG_NOCLAMP = 8 + CACHEPICFLAG_NOCLAMP = 8, } cachepicflags_t; diff --git a/filematch.c b/filematch.c index 4bacbc15..9ff8a767 100644 --- a/filematch.c +++ b/filematch.c @@ -1,10 +1,4 @@ -#ifdef WIN32 -#include -#else -#include -#endif - #include "quakedef.h" // LordHavoc: some portable directory listing code I wrote for lmp2pcx, now used in darkplaces to load id1/*.pak and such... @@ -147,6 +141,7 @@ static void adddirentry(stringlist_t *list, const char *path, const char *name) } } #ifdef WIN32 +#include void listdirectory(stringlist_t *list, const char *basepath, const char *path) { int i; @@ -172,6 +167,7 @@ void listdirectory(stringlist_t *list, const char *basepath, const char *path) *c += 'a' - 'A'; } #else +#include void listdirectory(stringlist_t *list, const char *basepath, const char *path) { char fullpath[MAX_OSPATH]; diff --git a/gl_backend.c b/gl_backend.c index f91b54a3..cbcab90d 100644 --- a/gl_backend.c +++ b/gl_backend.c @@ -45,7 +45,7 @@ int gl_maxdrawrangeelementsindices; #ifdef DEBUGGL int errornumber = 0; -void GL_PrintError(int errornumber, const char *filename, int linenumber) +void GL_PrintError(int errornumber, char *filename, int linenumber) { switch(errornumber) { diff --git a/gl_textures.c b/gl_textures.c index d244f006..7dc8dfb6 100644 --- a/gl_textures.c +++ b/gl_textures.c @@ -341,7 +341,7 @@ void R_FreeTexturePool(rtexturepool_t **rtexturepool) typedef struct glmode_s { - const char *name; + char *name; int minification, magnification; } glmode_t; @@ -359,7 +359,7 @@ static glmode_t modes[6] = #ifdef SUPPORTD3D typedef struct d3dmode_s { - const char *name; + char *name; int m1, m2; } d3dmode_t; @@ -2161,7 +2161,7 @@ void R_UpdateTexture(rtexture_t *rt, const unsigned char *data, int x, int y, in Host_Error("R_UpdateTexture: no texture supplied"); if (!glt->texnum && !glt->d3dtexture) { - Con_Printf("R_UpdateTexture: texture %p \"%s\" in pool %p has not been uploaded yet", (void *)glt, glt->identifier, (void *)glt->pool); + Con_Printf("R_UpdateTexture: texture %p \"%s\" in pool %p has not been uploaded yet", glt, glt->identifier, glt->pool); return; } // update part of the texture diff --git a/glquake.h b/glquake.h index c1311f49..cd59c5ae 100644 --- a/glquake.h +++ b/glquake.h @@ -964,7 +964,7 @@ extern void (GLAPIENTRY *qglGetQueryObjectuivARB)(GLuint qid, GLenum pname, GLui #ifdef DEBUGGL #define CHECKGLERROR {if (gl_paranoid.integer){if (gl_printcheckerror.integer) Con_Printf("CHECKGLERROR at %s:%d\n", __FILE__, __LINE__);errornumber = qglGetError();if (errornumber) GL_PrintError(errornumber, __FILE__, __LINE__);}} extern int errornumber; -void GL_PrintError(int errornumber, const char *filename, int linenumber); +void GL_PrintError(int errornumber, char *filename, int linenumber); #else #define CHECKGLERROR #endif diff --git a/host_cmd.c b/host_cmd.c index b54559b8..0934d595 100644 --- a/host_cmd.c +++ b/host_cmd.c @@ -1937,7 +1937,7 @@ Kicks a user off of the server */ void Host_Kick_f (void) { - const char *who; + char *who; const char *message = NULL; client_t *save; int i; diff --git a/image_png.c b/image_png.c index 4267331b..0d58d4a3 100644 --- a/image_png.c +++ b/image_png.c @@ -286,9 +286,7 @@ unsigned char *PNG_LoadImage_BGRA (const unsigned char *raw, int filesize, int * // NOTE: this relies on jmp_buf being the first thing in the png structure // created by libpng! (this is correct for libpng 1.2.x) #ifdef __cplusplus -#ifdef WIN64 - if (setjmp((_JBTYPE *)png)) -#elif defined(MACOSX) || defined(WIN32) +#if defined(MACOSX) || defined(WIN32) if (setjmp((int *)png)) #else if (setjmp((__jmp_buf_tag *)png)) @@ -481,9 +479,7 @@ qboolean PNG_SaveImage_preflipped (const char *filename, int width, int height, // NOTE: this relies on jmp_buf being the first thing in the png structure // created by libpng! (this is correct for libpng 1.2.x) #ifdef __cplusplus -#ifdef WIN64 - if (setjmp((_JBTYPE *)png)) -#elif defined(MACOSX) || defined(WIN32) +#if defined(MACOSX) || defined(WIN32) if (setjmp((int *)png)) #else if (setjmp((__jmp_buf_tag *)png)) diff --git a/lhnet.c b/lhnet.c index aa6cbc94..e2e513ee 100644 --- a/lhnet.c +++ b/lhnet.c @@ -839,11 +839,7 @@ void LHNET_SleepUntilPacket_Microseconds(int microseconds) { if (lastfd < s->inetsocket) lastfd = s->inetsocket; -#ifdef WIN32 - FD_SET((int)s->inetsocket, &fdreadset); -#else FD_SET((unsigned int)s->inetsocket, &fdreadset); -#endif } } tv.tv_sec = microseconds / 1000000; diff --git a/lhnet.h b/lhnet.h index d46dbe99..701045e3 100644 --- a/lhnet.h +++ b/lhnet.h @@ -9,7 +9,7 @@ typedef enum lhnetaddresstype_e LHNETADDRESSTYPE_NONE, LHNETADDRESSTYPE_LOOP, LHNETADDRESSTYPE_INET4, - LHNETADDRESSTYPE_INET6 + LHNETADDRESSTYPE_INET6, } lhnetaddresstype_t; diff --git a/libcurl.c b/libcurl.c index c6e2b472..48f5bf35 100644 --- a/libcurl.c +++ b/libcurl.c @@ -55,7 +55,7 @@ typedef enum CINIT(LOW_SPEED_LIMIT, LONG , 19), CINIT(LOW_SPEED_TIME, LONG, 20), CINIT(PROTOCOLS, LONG, 181), - CINIT(REDIR_PROTOCOLS, LONG, 182) + CINIT(REDIR_PROTOCOLS, LONG, 182), } CURLoption; #define CURLPROTO_HTTP (1<<0) @@ -108,7 +108,7 @@ typedef enum CURLINFO_PROXYAUTH_AVAIL = CURLINFO_LONG + 24, CURLINFO_OS_ERRNO = CURLINFO_LONG + 25, CURLINFO_NUM_CONNECTS = CURLINFO_LONG + 26, - CURLINFO_SSL_ENGINES = CURLINFO_SLIST + 27 + CURLINFO_SSL_ENGINES = CURLINFO_SLIST + 27, } CURLINFO; diff --git a/menu.c b/menu.c index 864dcbbb..c9e8d1fa 100644 --- a/menu.c +++ b/menu.c @@ -107,7 +107,7 @@ static void M_ModList_Key (int key, int ascii); static qboolean m_entersound; ///< play after drawing a frame, so caching won't disrupt the sound -void M_Update_Return_Reason(const char *s) +void M_Update_Return_Reason(char *s) { strlcpy(m_return_reason, s, sizeof(m_return_reason)); if (s) @@ -121,8 +121,8 @@ void M_Update_Return_Reason(const char *s) #define NumberOfNehahraDemos 34 typedef struct nehahrademonames_s { - const char *name; - const char *desc; + char *name; + char *desc; } nehahrademonames_t; static nehahrademonames_t NehahraDemos[NumberOfNehahraDemos] = @@ -167,8 +167,8 @@ static float menu_x, menu_y, menu_width, menu_height; static void M_Background(int width, int height) { - menu_width = bound(1.0f, (float)width, vid_conwidth.value); - menu_height = bound(1.0f, (float)height, vid_conheight.value); + menu_width = bound(1, width, vid_conwidth.integer); + menu_height = bound(1, height, vid_conheight.integer); menu_x = (vid_conwidth.integer - menu_width) * 0.5; menu_y = (vid_conheight.integer - menu_height) * 0.5; //DrawQ_Fill(menu_x, menu_y, menu_width, menu_height, 0, 0, 0, 0.5, 0); @@ -1266,7 +1266,7 @@ static unsigned int *menuplyr_translated; typedef struct ratetable_s { int rate; - const char *name; + char *name; } ratetable_t; @@ -2315,7 +2315,7 @@ static void M_Options_ColorControl_Key (int k, int ascii) //============================================================================= /* KEYS MENU */ -static const char *quakebindnames[][2] = +static char *quakebindnames[][2] = { {"+attack", "attack"}, {"impulse 10", "next weapon"}, @@ -2338,7 +2338,7 @@ static const char *quakebindnames[][2] = {"+movedown", "swim down"} }; -static const char *transfusionbindnames[][2] = +static char *transfusionbindnames[][2] = { {"", "Movement"}, // Movement commands {"+forward", "walk forward"}, @@ -2396,7 +2396,7 @@ static const char *transfusionbindnames[][2] = {"impulse 79", "taunt 9"} }; -static const char *goodvsbad2bindnames[][2] = +static char *goodvsbad2bindnames[][2] = { {"impulse 69", "Power 1"}, {"impulse 70", "Power 2"}, @@ -2420,7 +2420,7 @@ static const char *goodvsbad2bindnames[][2] = }; static int numcommands; -static const char *(*bindnames)[2]; +static char *(*bindnames)[2]; /* typedef struct binditem_s @@ -2525,10 +2525,10 @@ void M_Menu_Keys_f (void) #define NUMKEYS 5 -static void M_UnbindCommand (const char *command) +static void M_UnbindCommand (char *command) { int j; - const char *b; + char *b; for (j = 0; j < (int)sizeof (keybindings[0]) / (int)sizeof (keybindings[0][0]); j++) { @@ -3107,12 +3107,12 @@ static void M_Credits_Key (int key, int ascii) //============================================================================= /* QUIT MENU */ -static const char *m_quit_message[9]; +static char *m_quit_message[9]; static int m_quit_prevstate; static qboolean wasInMenus; -static int M_QuitMessage(const char *line1, const char *line2, const char *line3, const char *line4, const char *line5, const char *line6, const char *line7, const char *line8) +static int M_QuitMessage(char *line1, char *line2, char *line3, char *line4, char *line5, char *line6, char *line7, char *line8) { m_quit_message[0] = line1; m_quit_message[1] = line2; @@ -3292,8 +3292,8 @@ static void M_LanConfig_Draw (void) { cachepic_t *p; int basex; - const char *startJoin; - const char *protocol; + char *startJoin; + char *protocol; M_Background(320, 200); @@ -3456,20 +3456,20 @@ static void M_LanConfig_Key (int key, int ascii) typedef struct level_s { - const char *name; - const char *description; + char *name; + char *description; } level_t; typedef struct episode_s { - const char *description; + char *description; int firstLevel; int levels; } episode_t; typedef struct gamelevels_s { - const char *gamename; + char *gamename; level_t *levels; episode_t *episodes; int numepisodes; @@ -3976,7 +3976,7 @@ void M_GameOptions_Draw (void) M_Print(0, 72, " Teamplay"); if (gamemode == GAME_ROGUE) { - const char *msg; + char *msg; switch((int)teamplay.integer) { @@ -3992,7 +3992,7 @@ void M_GameOptions_Draw (void) } else { - const char *msg; + char *msg; switch (teamplay.integer) { @@ -5029,7 +5029,7 @@ void M_Restart(void) //============================================================================ // Menu prog handling -static const char *m_required_func[] = { +static char *m_required_func[] = { "m_init", "m_keydown", "m_draw", diff --git a/menu.h b/menu.h index 7fdf78ba..cef87e2e 100644 --- a/menu.h +++ b/menu.h @@ -53,7 +53,7 @@ enum m_state_e { extern enum m_state_e m_state; extern char m_return_reason[32]; -void M_Update_Return_Reason(const char *s); +void M_Update_Return_Reason(char *s); /* // hard-coded menus diff --git a/model_brush.c b/model_brush.c index e84a7ff9..bb6b1888 100644 --- a/model_brush.c +++ b/model_brush.c @@ -7273,7 +7273,6 @@ void Mod_OBJ_Load(dp_model_t *mod, void *buffer, void *bufferend) // parse the OBJ text now for(;;) { - static char emptyarg[1] = ""; if (!*text) break; linenumber++; @@ -7282,7 +7281,7 @@ void Mod_OBJ_Load(dp_model_t *mod, void *buffer, void *bufferend) line[linelen] = text[linelen]; line[linelen] = 0; for (argc = 0;argc < 4;argc++) - argv[argc] = emptyarg; + argv[argc] = ""; argc = 0; s = line; while (*s == ' ' || *s == '\t') diff --git a/model_shared.h b/model_shared.h index 73972184..65bc2b29 100644 --- a/model_shared.h +++ b/model_shared.h @@ -488,7 +488,7 @@ typedef enum texturelayertype_e TEXTURELAYERTYPE_INVALID, TEXTURELAYERTYPE_LITTEXTURE, TEXTURELAYERTYPE_TEXTURE, - TEXTURELAYERTYPE_FOG + TEXTURELAYERTYPE_FOG, } texturelayertype_t; diff --git a/mvm_cmds.c b/mvm_cmds.c index e9cc68a9..b7bbc8b0 100644 --- a/mvm_cmds.c +++ b/mvm_cmds.c @@ -9,7 +9,7 @@ //============================================================================ // Menu -const char *vm_m_extensions = +char *vm_m_extensions = "BX_WAL_SUPPORT " "DP_CINEMATIC_DPV " "DP_CSQC_BINDMAPS " diff --git a/progsvm.h b/progsvm.h index 5bf4080d..53eb4d31 100644 --- a/progsvm.h +++ b/progsvm.h @@ -487,12 +487,12 @@ typedef struct prvm_prog_s qboolean allowworldwrites; // name of the prog, e.g. "Server", "Client" or "Menu" (used for text output) - const char *name; // [INIT] + char *name; // [INIT] // flag - used to store general flags like PRVM_GE_SELF, etc. int flag; - const char *extensionstring; // [INIT] + char *extensionstring; // [INIT] qboolean loadintoworld; // [INIT] @@ -557,8 +557,8 @@ extern const int vm_sv_numbuiltins; extern const int vm_cl_numbuiltins; extern const int vm_m_numbuiltins; -extern const char * vm_sv_extensions; // client also uses this -extern const char * vm_m_extensions; +extern char * vm_sv_extensions; // client also uses this +extern char * vm_m_extensions; void VM_SV_Cmd_Init(void); void VM_SV_Cmd_Reset(void); @@ -632,7 +632,7 @@ void PRVM_ED_ParseGlobals (const char *data); void PRVM_ED_LoadFromFile (const char *data); -unsigned int PRVM_EDICT_NUM_ERROR(unsigned int n, const char *filename, int fileline); +unsigned int PRVM_EDICT_NUM_ERROR(unsigned int n, char *filename, int fileline); #define PRVM_EDICT(n) (((unsigned)(n) < (unsigned int)prog->max_edicts) ? (unsigned int)(n) : PRVM_EDICT_NUM_ERROR((unsigned int)(n), __FILE__, __LINE__)) #define PRVM_EDICT_NUM(n) (prog->edicts + PRVM_EDICT(n)) @@ -715,7 +715,7 @@ Load a program with LoadProgs */ void PRVM_InitProg(int prognr); // LoadProgs expects to be called right after InitProg -void PRVM_LoadProgs (const char *filename, int numrequiredfunc, const char **required_func, int numrequiredfields, prvm_required_field_t *required_field, int numrequiredglobals, char **required_global); +void PRVM_LoadProgs (const char *filename, int numrequiredfunc, char **required_func, int numrequiredfields, prvm_required_field_t *required_field, int numrequiredglobals, char **required_global); void PRVM_ResetProg(void); qboolean PRVM_ProgLoaded(int prognr); diff --git a/prvm_cmds.c b/prvm_cmds.c index 391f9e27..20f06119 100644 --- a/prvm_cmds.c +++ b/prvm_cmds.c @@ -269,7 +269,7 @@ checkextension(extensionname) static qboolean checkextension(const char *name) { int len; - const char *e, *start; + char *e, *start; len = (int)strlen(name); for (e = prog->extensionstring;*e;e++) diff --git a/prvm_edict.c b/prvm_edict.c index 7a81d008..70148794 100644 --- a/prvm_edict.c +++ b/prvm_edict.c @@ -2074,7 +2074,7 @@ void PRVM_LoadLNO( const char *progname ) { PRVM_LoadProgs =============== */ -void PRVM_LoadProgs (const char * filename, int numrequiredfunc, const char **required_func, int numrequiredfields, prvm_required_field_t *required_field, int numrequiredglobals, char **required_global) +void PRVM_LoadProgs (const char * filename, int numrequiredfunc, char **required_func, int numrequiredfields, prvm_required_field_t *required_field, int numrequiredglobals, char **required_global) { int i; dstatement_t *st; @@ -2808,7 +2808,7 @@ void _PRVM_FreeAll(const char *filename, int fileline) } // LordHavoc: turned PRVM_EDICT_NUM into a #define for speed reasons -unsigned int PRVM_EDICT_NUM_ERROR(unsigned int n, const char *filename, int fileline) +unsigned int PRVM_EDICT_NUM_ERROR(unsigned int n, char *filename, int fileline) { PRVM_ERROR ("PRVM_EDICT_NUM: %s: bad number %i (called at %s:%i)", PRVM_NAME, n, filename, fileline); return 0; diff --git a/prvm_exec.c b/prvm_exec.c index ca1c191c..ea85df9e 100644 --- a/prvm_exec.c +++ b/prvm_exec.c @@ -21,7 +21,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include "quakedef.h" #include "progsvm.h" -const char *prvm_opnames[] = +char *prvm_opnames[] = { "^5DONE", diff --git a/r_modules.c b/r_modules.c index 818637e8..541ef043 100644 --- a/r_modules.c +++ b/r_modules.c @@ -6,7 +6,7 @@ typedef struct rendermodule_s { int active; // set by start, cleared by shutdown - const char *name; + char *name; void(*start)(void); void(*shutdown)(void); void(*newmap)(void); @@ -22,7 +22,7 @@ void R_Modules_Init(void) Cmd_AddCommand("r_restart", R_Modules_Restart, "restarts renderer"); } -void R_RegisterModule(const char *name, void(*start)(void), void(*shutdown)(void), void(*newmap)(void), void(*devicelost)(void), void(*devicerestored)(void)) +void R_RegisterModule(char *name, void(*start)(void), void(*shutdown)(void), void(*newmap)(void), void(*devicelost)(void), void(*devicerestored)(void)) { int i; for (i = 0;i < MAXRENDERMODULES;i++) diff --git a/r_modules.h b/r_modules.h index ad838d17..9316515c 100644 --- a/r_modules.h +++ b/r_modules.h @@ -3,7 +3,7 @@ #define R_MODULES_H void R_Modules_Init(void); -void R_RegisterModule(const char *name, void(*start)(void), void(*shutdown)(void), void(*newmap)(void), void(*devicelost)(void), void(*devicerestored)(void)); +void R_RegisterModule(char *name, void(*start)(void), void(*shutdown)(void), void(*newmap)(void), void(*devicelost)(void), void(*devicerestored)(void)); void R_Modules_Start(void); void R_Modules_Shutdown(void); void R_Modules_NewMap(void); diff --git a/r_shadow.c b/r_shadow.c index 899c1454..4392b2ed 100644 --- a/r_shadow.c +++ b/r_shadow.c @@ -165,7 +165,7 @@ typedef enum r_shadow_rendermode_e R_SHADOW_RENDERMODE_VISIBLELIGHTING, R_SHADOW_RENDERMODE_SHADOWMAP2D, R_SHADOW_RENDERMODE_SHADOWMAPRECTANGLE, - R_SHADOW_RENDERMODE_SHADOWMAPCUBESIDE + R_SHADOW_RENDERMODE_SHADOWMAPCUBESIDE, } r_shadow_rendermode_t; diff --git a/r_textures.h b/r_textures.h index c8981183..85e7dfb6 100644 --- a/r_textures.h +++ b/r_textures.h @@ -54,7 +54,7 @@ typedef enum textype_e // 4x4 block compressed 15bit color plus 8bit alpha (8 bits per pixel) TEXTYPE_DXT5, // this represents the same format as the framebuffer, for fast copies - TEXTYPE_COLORBUFFER + TEXTYPE_COLORBUFFER, } textype_t; diff --git a/render.h b/render.h index b5dea8db..7f85446b 100644 --- a/render.h +++ b/render.h @@ -220,7 +220,7 @@ extern unsigned int r_queries[MAX_OCCLUSION_QUERIES]; extern unsigned int r_numqueries; extern unsigned int r_maxqueries; -void R_TimeReport(const char *name); +void R_TimeReport(char *name); // r_stain void R_Stain(const vec3_t origin, float radius, int cr1, int cg1, int cb1, int ca1, int cr2, int cg2, int cb2, int ca2); @@ -462,7 +462,7 @@ typedef enum rsurfacepass_e RSURFPASS_BASE, RSURFPASS_BACKGROUND, RSURFPASS_RTLIGHT, - RSURFPASS_DEFERREDGEOMETRY + RSURFPASS_DEFERREDGEOMETRY, } rsurfacepass_t; diff --git a/snd_ogg.c b/snd_ogg.c index 2431430b..66ad014d 100644 --- a/snd_ogg.c +++ b/snd_ogg.c @@ -222,7 +222,7 @@ typedef struct static int (*qov_clear) (OggVorbis_File *vf); static vorbis_info* (*qov_info) (OggVorbis_File *vf,int link); static vorbis_comment* (*qov_comment) (OggVorbis_File *vf,int link); -static char * (*qvorbis_comment_query) (vorbis_comment *vc, const char *tag, int count); +static char * (*qvorbis_comment_query) (vorbis_comment *vc, char *tag, int count); static int (*qov_open_callbacks) (void *datasource, OggVorbis_File *vf, char *initial, long ibytes, ov_callbacks callbacks); diff --git a/snd_wav.c b/snd_wav.c index 7eb118d7..438db2ba 100644 --- a/snd_wav.c +++ b/snd_wav.c @@ -65,7 +65,7 @@ static int GetLittleLong(void) return val; } -static void FindNextChunk(const char *name) +static void FindNextChunk(char *name) { while (1) { @@ -91,7 +91,7 @@ static void FindNextChunk(const char *name) } } -static void FindChunk(const char *name) +static void FindChunk(char *name) { last_chunk = iff_data; FindNextChunk (name); diff --git a/sv_main.c b/sv_main.c index bb272231..34b05933 100644 --- a/sv_main.c +++ b/sv_main.c @@ -979,19 +979,14 @@ void SV_ConnectClient (int clientnum, netconn_t *netconnection) { client_t *client; int i; + float spawn_parms[NUM_SPAWN_PARMS]; client = svs.clients + clientnum; // set up the client_t if (sv.loadgame) - { - float backupparms[NUM_SPAWN_PARMS]; - memcpy(backupparms, client->spawn_parms, sizeof(backupparms)); - memset(client, 0, sizeof(*client)); - memcpy(client->spawn_parms, backupparms, sizeof(backupparms)); - } - else - memset(client, 0, sizeof(*client)); + memcpy (spawn_parms, client->spawn_parms, sizeof(spawn_parms)); + memset (client, 0, sizeof(*client)); client->active = true; client->netconnection = netconnection; @@ -1013,7 +1008,9 @@ void SV_ConnectClient (int clientnum, netconn_t *netconnection) client->rate = 1000000000; client->connecttime = realtime; - if (!sv.loadgame) + if (sv.loadgame) + memcpy (client->spawn_parms, spawn_parms, sizeof(spawn_parms)); + else { // call the progs to get default spawn parms for the new client // set self to world to intentionally cause errors with broken SetNewParms code in some mods diff --git a/svvm_cmds.c b/svvm_cmds.c index 459c73f4..35cb8bee 100644 --- a/svvm_cmds.c +++ b/svvm_cmds.c @@ -8,7 +8,7 @@ -const char *vm_sv_extensions = +char *vm_sv_extensions = "BX_WAL_SUPPORT " "DP_BUTTONCHAT " "DP_BUTTONUSE " diff --git a/sys_linux.c b/sys_linux.c index bddb5d7d..167121a8 100644 --- a/sys_linux.c +++ b/sys_linux.c @@ -1,3 +1,4 @@ +#include "quakedef.h" #ifdef WIN32 #include @@ -12,7 +13,6 @@ #include -#include "quakedef.h" // ======================================================================= // General routines diff --git a/sys_shared.c b/sys_shared.c index dd00b48b..903bee1e 100644 --- a/sys_shared.c +++ b/sys_shared.c @@ -4,9 +4,7 @@ #ifdef WIN32 # ifdef _WIN64 -# ifndef _WIN32_WINNT -# define _WIN32_WINNT 0x0502 -# endif +# define _WIN32_WINNT 0x0502 // for SetDllDirectory # endif # include diff --git a/vid.h b/vid.h index 7eecb295..90062807 100644 --- a/vid.h +++ b/vid.h @@ -36,7 +36,7 @@ typedef enum renderpath_e RENDERPATH_CGGL, RENDERPATH_D3D9, RENDERPATH_D3D10, - RENDERPATH_D3D11 + RENDERPATH_D3D11, } renderpath_t; diff --git a/vid_wgl.c b/vid_wgl.c index fb98973c..53153e02 100644 --- a/vid_wgl.c +++ b/vid_wgl.c @@ -1208,7 +1208,7 @@ qboolean VID_InitModeGL(viddef_mode_t *mode) mainwindow = CreateWindowEx (ExWindowStyle, "DarkPlacesWindowClass", gamename, WindowStyle, rect.left, rect.top, rect.right - rect.left, rect.bottom - rect.top, NULL, NULL, global_hInstance, NULL); if (!mainwindow) { - Con_Printf("CreateWindowEx(%d, %s, %s, %d, %d, %d, %d, %d, %p, %p, %p, %p) failed\n", (int)ExWindowStyle, "DarkPlacesWindowClass", gamename, (int)WindowStyle, (int)(rect.left), (int)(rect.top), (int)(rect.right - rect.left), (int)(rect.bottom - rect.top), (void *)NULL, (void *)NULL, (void *)global_hInstance, (void *)NULL); + Con_Printf("CreateWindowEx(%d, %s, %s, %d, %d, %d, %d, %d, %p, %p, %p, %p) failed\n", (int)ExWindowStyle, "DarkPlacesWindowClass", gamename, (int)WindowStyle, (int)(rect.left), (int)(rect.top), (int)(rect.right - rect.left), (int)(rect.bottom - rect.top), NULL, NULL, global_hInstance, NULL); VID_Shutdown(); return false; } @@ -1221,14 +1221,14 @@ qboolean VID_InitModeGL(viddef_mode_t *mode) if (!pixelformat) { VID_Shutdown(); - Con_Printf("ChoosePixelFormat(%p, %p) failed\n", (void *)baseDC, (void *)&pfd); + Con_Printf("ChoosePixelFormat(%p, %p) failed\n", baseDC, &pfd); return false; } if (SetPixelFormat(baseDC, pixelformat, &pfd) == false) { VID_Shutdown(); - Con_Printf("SetPixelFormat(%p, %d, %p) failed\n", (void *)baseDC, pixelformat, (void *)&pfd); + Con_Printf("SetPixelFormat(%p, %d, %p) failed\n", baseDC, pixelformat, &pfd); return false; } @@ -1249,7 +1249,7 @@ qboolean VID_InitModeGL(viddef_mode_t *mode) if (!qwglMakeCurrent(baseDC, baseRC)) { VID_Shutdown(); - Con_Printf("wglMakeCurrent(%p, %p) failed\n", (void *)baseDC, (void *)baseRC); + Con_Printf("wglMakeCurrent(%p, %p) failed\n", baseDC, baseRC); return false; } @@ -1430,7 +1430,7 @@ qboolean VID_InitModeDX(viddef_mode_t *mode, int version) mainwindow = CreateWindowEx (ExWindowStyle, "DarkPlacesWindowClass", gamename, WindowStyle, rect.left, rect.top, rect.right - rect.left, rect.bottom - rect.top, NULL, NULL, global_hInstance, NULL); if (!mainwindow) { - Con_Printf("CreateWindowEx(%d, %s, %s, %d, %d, %d, %d, %d, %p, %p, %p, %p) failed\n", (int)ExWindowStyle, "DarkPlacesWindowClass", gamename, (int)WindowStyle, (int)(rect.left), (int)(rect.top), (int)(rect.right - rect.left), (int)(rect.bottom - rect.top), (void *)NULL, (void *)NULL, global_hInstance, (void *)NULL); + Con_Printf("CreateWindowEx(%d, %s, %s, %d, %d, %d, %d, %d, %p, %p, %p, %p) failed\n", (int)ExWindowStyle, "DarkPlacesWindowClass", gamename, (int)WindowStyle, (int)(rect.left), (int)(rect.top), (int)(rect.right - rect.left), (int)(rect.bottom - rect.top), NULL, NULL, global_hInstance, NULL); VID_Shutdown(); return false; } @@ -1513,10 +1513,10 @@ qboolean VID_InitModeDX(viddef_mode_t *mode, int version) Con_Printf("D3D9 adapter info:\n"); Con_Printf("Description: %s\n", d3d9adapteridentifier.Description); - Con_Printf("DeviceId: %x\n", (unsigned int)d3d9adapteridentifier.DeviceId); - Con_Printf("DeviceName: %p\n", d3d9adapteridentifier.DeviceName); + Con_Printf("DeviceId: %x\n", d3d9adapteridentifier.DeviceId); + Con_Printf("DeviceName: %x\n", d3d9adapteridentifier.DeviceName); Con_Printf("Driver: %s\n", d3d9adapteridentifier.Driver); - Con_Printf("DriverVersion: %08x%08x\n", (unsigned int)d3d9adapteridentifier.DriverVersion.u.HighPart, (unsigned int)d3d9adapteridentifier.DriverVersion.u.LowPart); + Con_Printf("DriverVersion: %x\n", d3d9adapteridentifier.DriverVersion); Con_DPrintf("GL_EXTENSIONS: %s\n", gl_extensions); Con_DPrintf("%s_EXTENSIONS: %s\n", gl_platform, gl_platformextensions); @@ -1904,31 +1904,57 @@ static void IN_MouseMove (void) /* Look at the element to see what happened */ - if ((int)od.dwOfs == DIMOFS_X) - in_mouse_x += (LONG) od.dwData; - if ((int)od.dwOfs == DIMOFS_Y) - in_mouse_y += (LONG) od.dwData; - if ((int)od.dwOfs == DIMOFS_Z) + switch (od.dwOfs) { - if((LONG)od.dwData < 0) - { - Key_Event(K_MWHEELDOWN, 0, true); - Key_Event(K_MWHEELDOWN, 0, false); - } - else if((LONG)od.dwData > 0) - { - Key_Event(K_MWHEELUP, 0, true); - Key_Event(K_MWHEELUP, 0, false); - } + case DIMOFS_X: + in_mouse_x += (LONG) od.dwData; + break; + + case DIMOFS_Y: + in_mouse_y += (LONG) od.dwData; + break; + + case DIMOFS_Z: + if((LONG) od.dwData < 0) + { + Key_Event (K_MWHEELDOWN, 0, true); + Key_Event (K_MWHEELDOWN, 0, false); + } + else if((LONG) od.dwData > 0) + { + Key_Event (K_MWHEELUP, 0, true); + Key_Event (K_MWHEELUP, 0, false); + } + break; + + case DIMOFS_BUTTON0: + if (od.dwData & 0x80) + mstate_di |= 1; + else + mstate_di &= ~1; + break; + + case DIMOFS_BUTTON1: + if (od.dwData & 0x80) + mstate_di |= (1<<1); + else + mstate_di &= ~(1<<1); + break; + + case DIMOFS_BUTTON2: + if (od.dwData & 0x80) + mstate_di |= (1<<2); + else + mstate_di &= ~(1<<2); + break; + + case DIMOFS_BUTTON3: + if (od.dwData & 0x80) + mstate_di |= (1<<3); + else + mstate_di &= ~(1<<3); + break; } - if ((int)od.dwOfs == DIMOFS_BUTTON0) - mstate_di = (mstate_di & ~1) | ((od.dwData & 0x80) >> 7); - if ((int)od.dwOfs == DIMOFS_BUTTON1) - mstate_di = (mstate_di & ~2) | ((od.dwData & 0x80) >> 6); - if ((int)od.dwOfs == DIMOFS_BUTTON2) - mstate_di = (mstate_di & ~4) | ((od.dwData & 0x80) >> 5); - if ((int)od.dwOfs == DIMOFS_BUTTON3) - mstate_di = (mstate_di & ~8) | ((od.dwData & 0x80) >> 4); } // perform button actions -- 2.39.2