From: divverent Date: Wed, 28 Jan 2009 12:41:41 +0000 (+0000) Subject: make DP compile with C++ again X-Git-Tag: xonotic-v0.1.0preview~1910 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=27ad2d336694ea2dc50035130bae321316e3936f;p=xonotic%2Fdarkplaces.git make DP compile with C++ again git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@8684 d7cf8633-e32d-0410-b094-e92efae38249 --- diff --git a/cl_collision.c b/cl_collision.c index 09e9349c..bad4efc2 100644 --- a/cl_collision.c +++ b/cl_collision.c @@ -418,9 +418,9 @@ skipnetworkplayers: Matrix4x4_CreateTranslate(&matrix, touch->fields.client->origin[0], touch->fields.client->origin[1], touch->fields.client->origin[2]); Matrix4x4_Invert_Simple(&imatrix, &matrix); if ((int)touch->fields.client->flags & FL_MONSTER) - Collision_ClipToGenericEntity(&trace, model, touch->fields.client->frame, touch->fields.client->mins, touch->fields.client->maxs, bodysupercontents, &matrix, &imatrix, clipstart, clipmins2, clipmaxs2, clipend, hitsupercontentsmask); + Collision_ClipToGenericEntity(&trace, model, (int) touch->fields.client->frame, touch->fields.client->mins, touch->fields.client->maxs, bodysupercontents, &matrix, &imatrix, clipstart, clipmins2, clipmaxs2, clipend, hitsupercontentsmask); else - Collision_ClipToGenericEntity(&trace, model, touch->fields.client->frame, touch->fields.client->mins, touch->fields.client->maxs, bodysupercontents, &matrix, &imatrix, clipstart, clipmins, clipmaxs, clipend, hitsupercontentsmask); + Collision_ClipToGenericEntity(&trace, model, (int) touch->fields.client->frame, touch->fields.client->mins, touch->fields.client->maxs, bodysupercontents, &matrix, &imatrix, clipstart, clipmins, clipmaxs, clipend, hitsupercontentsmask); if (cliptrace.realfraction > trace.realfraction && hitnetworkentity) *hitnetworkentity = 0; diff --git a/cl_gecko.c b/cl_gecko.c index ede73ad8..90d25a04 100644 --- a/cl_gecko.c +++ b/cl_gecko.c @@ -436,7 +436,7 @@ clgecko_t * CL_Gecko_FindBrowser( const char *name ) { } static void cl_gecko_updatecallback( rtexture_t *texture, void* callbackData ) { - clgecko_t *instance = callbackData; + clgecko_t *instance = (clgecko_t *) callbackData; const unsigned char *data; if( instance->browser ) { // TODO: OSGK only supports BGRA right now @@ -514,7 +514,7 @@ static OSGK_ScriptResult dpGlobal_query (void* objTag, void* methTag, OSGK_ScriptVariant** params, OSGK_ScriptVariant** returnVal) { - clgecko_t *instance = objTag; + clgecko_t *instance = (clgecko_t *) objTag; OSGK_ScriptVariant* strVal; OSGK_ScriptResult result = srFailed; prvm_prog_t * saveProg; @@ -789,7 +789,7 @@ static void cl_gecko_injecttext_f( void ) { break; } - CL_Gecko_Event_Key( instance, key, CLG_BET_PRESS ); + CL_Gecko_Event_Key( instance, (keynum_t) key, CLG_BET_PRESS ); } } @@ -902,8 +902,8 @@ void CL_Gecko_Event_CursorMove( clgecko_t *instance, float x, float y ) { return; } - mappedx = x * instance->width; - mappedy = y * instance->height; + mappedx = (int) (x * instance->width); + mappedy = (int) (y * instance->height); osgk_browser_event_mouse_move( instance->browser, mappedx, mappedy ); } diff --git a/cl_input.c b/cl_input.c index f6121674..6edee3ef 100644 --- a/cl_input.c +++ b/cl_input.c @@ -1283,11 +1283,11 @@ void QW_MSG_WriteDeltaUsercmd(sizebuf_t *buf, usercmd_t *from, usercmd_t *to) if (bits & QW_CM_ANGLE3) MSG_WriteAngle16i(buf, to->viewangles[2]); if (bits & QW_CM_FORWARD) - MSG_WriteShort(buf, to->forwardmove); + MSG_WriteShort(buf, (short) to->forwardmove); if (bits & QW_CM_SIDE) - MSG_WriteShort(buf, to->sidemove); + MSG_WriteShort(buf, (short) to->sidemove); if (bits & QW_CM_UP) - MSG_WriteShort(buf, to->upmove); + MSG_WriteShort(buf, (short) to->upmove); if (bits & QW_CM_BUTTONS) MSG_WriteByte(buf, to->buttons); if (bits & QW_CM_IMPULSE) diff --git a/cl_main.c b/cl_main.c index 7beb895a..fb6d9685 100644 --- a/cl_main.c +++ b/cl_main.c @@ -1929,7 +1929,7 @@ void CL_Locs_AddNode(vec3_t mins, vec3_t maxs, const char *name) if (!name) name = ""; namelen = strlen(name); - node = Mem_Alloc(cls.levelmempool, sizeof(cl_locnode_t) + namelen + 1); + node = (cl_locnode_t *) Mem_Alloc(cls.levelmempool, sizeof(cl_locnode_t) + namelen + 1); VectorSet(node->mins, min(mins[0], maxs[0]), min(mins[1], maxs[1]), min(mins[2], maxs[2])); VectorSet(node->maxs, max(mins[0], maxs[0]), max(mins[1], maxs[1]), max(mins[2], maxs[2])); node->name = (char *)(node + 1); diff --git a/cl_parse.c b/cl_parse.c index 3b7b249b..0b8af8ed 100644 --- a/cl_parse.c +++ b/cl_parse.c @@ -188,7 +188,7 @@ void QW_CL_StartUpload(unsigned char *data, int size); //static qboolean QW_CL_IsUploading(void); static void QW_CL_StopUpload(void); void CL_VM_UpdateIntermissionState(int intermission); -qboolean CL_VM_Event_Sound(int sound_num, int volume, int channel, float attenuation, int ent, vec3_t pos); +qboolean CL_VM_Event_Sound(int sound_num, float volume, int channel, float attenuation, int ent, vec3_t pos); /* ================== @@ -1313,7 +1313,7 @@ void CL_DownloadBegin_f(void) // we're really beginning a download now, so initialize stuff strlcpy(cls.qw_downloadname, Cmd_Argv(2), sizeof(cls.qw_downloadname)); cls.qw_downloadmemorymaxsize = size; - cls.qw_downloadmemory = Mem_Alloc(cls.permanentmempool, cls.qw_downloadmemorymaxsize); + cls.qw_downloadmemory = (unsigned char *) Mem_Alloc(cls.permanentmempool, cls.qw_downloadmemorymaxsize); cls.qw_downloadnumber++; cls.qw_download_deflate = false; @@ -2695,7 +2695,7 @@ static void CL_IPLog_Add(const char *address, const char *name, qboolean checkex { cl_iplog_item_t *olditems = cl_iplog_items; cl_iplog_maxitems = max(1024, cl_iplog_maxitems + 256); - cl_iplog_items = Mem_Alloc(cls.permanentmempool, cl_iplog_maxitems * sizeof(cl_iplog_item_t)); + cl_iplog_items = (cl_iplog_item_t *) Mem_Alloc(cls.permanentmempool, cl_iplog_maxitems * sizeof(cl_iplog_item_t)); if (olditems) { if (cl_iplog_numitems) @@ -2703,8 +2703,8 @@ static void CL_IPLog_Add(const char *address, const char *name, qboolean checkex Mem_Free(olditems); } } - cl_iplog_items[cl_iplog_numitems].address = Mem_Alloc(cls.permanentmempool, strlen(address) + 1); - cl_iplog_items[cl_iplog_numitems].name = Mem_Alloc(cls.permanentmempool, strlen(name) + 1); + cl_iplog_items[cl_iplog_numitems].address = (char *) Mem_Alloc(cls.permanentmempool, strlen(address) + 1); + cl_iplog_items[cl_iplog_numitems].name = (char *) Mem_Alloc(cls.permanentmempool, strlen(name) + 1); strlcpy(cl_iplog_items[cl_iplog_numitems].address, address, strlen(address) + 1); // TODO: maybe it would be better to strip weird characters from name when // copying it here rather than using a straight strcpy? diff --git a/cl_particles.c b/cl_particles.c index ee2b0ad5..e2d388ac 100644 --- a/cl_particles.c +++ b/cl_particles.c @@ -30,7 +30,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. // must match ptype_t values particletype_t particletype[pt_total] = { - {0, 0, false}, // pt_dead + {PBLEND_INVALID, PARTICLE_INVALID, false}, //pt_dead (should never happen) {PBLEND_ALPHA, PARTICLE_BILLBOARD, false}, //pt_alphastatic {PBLEND_ADD, PARTICLE_BILLBOARD, false}, //pt_static {PBLEND_ADD, PARTICLE_SPARK, false}, //pt_spark @@ -2164,6 +2164,7 @@ void R_DrawParticle_TransparentCallback(const entity_render_t *ent, const rtligh c4f[3] = p->alpha * colormultiplier[3]; switch (blendmode) { + case PBLEND_INVALID: case PBLEND_INVMOD: case PBLEND_ADD: // additive and modulate can just fade out in fog (this is correct) @@ -2204,6 +2205,7 @@ void R_DrawParticle_TransparentCallback(const entity_render_t *ent, const rtligh tex = &particletexture[p->texnum]; switch(p->orientation) { + case PARTICLE_INVALID: case PARTICLE_BILLBOARD: VectorScale(r_refdef.view.left, -size * p->stretch, right); VectorScale(r_refdef.view.up, size, up); @@ -2274,7 +2276,7 @@ void R_DrawParticle_TransparentCallback(const entity_render_t *ent, const rtligh } // now render batches of particles based on blendmode and texture - blendmode = -1; + blendmode = PBLEND_INVALID; texture = NULL; GL_LockArrays(0, numsurfaces*4); batchstart = 0; @@ -2291,6 +2293,7 @@ void R_DrawParticle_TransparentCallback(const entity_render_t *ent, const rtligh case PBLEND_ALPHA: GL_BlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); break; + case PBLEND_INVALID: case PBLEND_ADD: GL_BlendFunc(GL_SRC_ALPHA, GL_ONE); break; diff --git a/cl_screen.c b/cl_screen.c index 85948994..473d8a60 100644 --- a/cl_screen.c +++ b/cl_screen.c @@ -149,7 +149,7 @@ void SCR_DrawCenterString (void) int l = newline ? (newline - start) : (int)strlen(start); float width = DrawQ_TextWidth_Font(start, l, false, FONT_CENTERPRINT) * 8; - x = (vid_conwidth.integer - width)/2; + x = (int) (vid_conwidth.integer - width)/2; if (l > 0) { if (remaining < l) @@ -1029,7 +1029,7 @@ static void GrowBuf(sizebuf_t *buf, int extralen) unsigned char *olddata; olddata = buf->data; buf->maxsize = max(buf->maxsize * 2, 4096); - buf->data = Mem_Alloc(tempmempool, buf->maxsize); + buf->data = (unsigned char *) Mem_Alloc(tempmempool, buf->maxsize); if(olddata) { memcpy(buf->data, olddata, oldsize); @@ -1173,7 +1173,7 @@ static void FindFraction(double val, int *num, int *denom, int denomMax) for(i = 1; i <= denomMax; ++i) { - int inum = floor(0.5 + val * i); + int inum = (int) floor(0.5 + val * i); double diff = fabs(val - inum / (double)i); if(diff < bestdiff) { @@ -1579,12 +1579,12 @@ static void SCR_ScaleDownBGRA(unsigned char *in, int inw, int inh, unsigned char area = (float)outw * (float)outh / (float)inw / (float)inh; for(y = 0; y < outh; ++y) { - float iny0 = y / (float)outh * inh; int iny0_i = floor(iny0); - float iny1 = (y+1) / (float)outh * inh; int iny1_i = ceil(iny1); + float iny0 = y / (float)outh * inh; int iny0_i = (int) floor(iny0); + float iny1 = (y+1) / (float)outh * inh; int iny1_i = (int) ceil(iny1); for(x = 0; x < outw; ++x) { - float inx0 = x / (float)outw * inw; int inx0_i = floor(inx0); - float inx1 = (x+1) / (float)outw * inw; int inx1_i = ceil(inx1); + float inx0 = x / (float)outw * inw; int inx0_i = (int) floor(inx0); + float inx1 = (x+1) / (float)outw * inw; int inx1_i = (int) ceil(inx1); float r = 0, g = 0, b = 0, alpha = 0; int xx, yy; @@ -1601,10 +1601,10 @@ static void SCR_ScaleDownBGRA(unsigned char *in, int inw, int inh, unsigned char } } - out[4*(x + outw * y)+0] = r * area; - out[4*(x + outw * y)+1] = g * area; - out[4*(x + outw * y)+2] = b * area; - out[4*(x + outw * y)+3] = alpha * area; + out[4*(x + outw * y)+0] = (unsigned char) (r * area); + out[4*(x + outw * y)+1] = (unsigned char) (g * area); + out[4*(x + outw * y)+2] = (unsigned char) (b * area); + out[4*(x + outw * y)+3] = (unsigned char) (alpha * area); } } } @@ -1838,7 +1838,7 @@ void SHOWLMP_decodeshow(void) { showlmp_t *oldshowlmps = cl.showlmps; cl.max_showlmps += 16; - cl.showlmps = Mem_Alloc(cls.levelmempool, cl.max_showlmps * sizeof(showlmp_t)); + cl.showlmps = (showlmp_t *) Mem_Alloc(cls.levelmempool, cl.max_showlmps * sizeof(showlmp_t)); if (cl.num_showlmps) memcpy(cl.showlmps, oldshowlmps, cl.num_showlmps * sizeof(showlmp_t)); if (oldshowlmps) @@ -2172,12 +2172,12 @@ void CL_UpdateScreen(void) if(gamemode == GAME_NEXUIZ) { // play a bit with the palette (experimental) - palette_rgb_pantscolormap[15][0] = 128 + 127 * sin(cl.time / exp(1) + 0*M_PI/3); - palette_rgb_pantscolormap[15][1] = 128 + 127 * sin(cl.time / exp(1) + 2*M_PI/3); - palette_rgb_pantscolormap[15][2] = 128 + 127 * sin(cl.time / exp(1) + 4*M_PI/3); - palette_rgb_shirtcolormap[15][0] = 128 + 127 * sin(cl.time / M_PI + 5*M_PI/3); - palette_rgb_shirtcolormap[15][1] = 128 + 127 * sin(cl.time / M_PI + 3*M_PI/3); - palette_rgb_shirtcolormap[15][2] = 128 + 127 * sin(cl.time / M_PI + 1*M_PI/3); + palette_rgb_pantscolormap[15][0] = (unsigned char) (128 + 127 * sin(cl.time / exp(1) + 0*M_PI/3)); + palette_rgb_pantscolormap[15][1] = (unsigned char) (128 + 127 * sin(cl.time / exp(1) + 2*M_PI/3)); + palette_rgb_pantscolormap[15][2] = (unsigned char) (128 + 127 * sin(cl.time / exp(1) + 4*M_PI/3)); + palette_rgb_shirtcolormap[15][0] = (unsigned char) (128 + 127 * sin(cl.time / M_PI + 5*M_PI/3)); + palette_rgb_shirtcolormap[15][1] = (unsigned char) (128 + 127 * sin(cl.time / M_PI + 3*M_PI/3)); + palette_rgb_shirtcolormap[15][2] = (unsigned char) (128 + 127 * sin(cl.time / M_PI + 1*M_PI/3)); memcpy(palette_rgb_pantsscoreboard[15], palette_rgb_pantscolormap[15], sizeof(*palette_rgb_pantscolormap)); memcpy(palette_rgb_shirtscoreboard[15], palette_rgb_shirtcolormap[15], sizeof(*palette_rgb_shirtcolormap)); } diff --git a/cl_video.c b/cl_video.c index 9ac887c9..4eac2aea 100644 --- a/cl_video.c +++ b/cl_video.c @@ -36,7 +36,7 @@ static qboolean OpenStream( clvideo_t * video ) } static void VideoUpdateCallback(rtexture_t *rt, void *data) { - clvideo_t *video = data; + clvideo_t *video = (clvideo_t *) data; R_UpdateTexture( video->cpif.tex, (unsigned char *)video->imagedata, 0, 0, video->cpif.width, video->cpif.height ); } diff --git a/client.h b/client.h index 1cd40653..96c1c651 100644 --- a/client.h +++ b/client.h @@ -634,7 +634,8 @@ typedef enum PARTICLE_BILLBOARD = 0, PARTICLE_SPARK = 1, PARTICLE_ORIENTED_DOUBLESIDED = 2, - PARTICLE_BEAM = 3 + PARTICLE_BEAM = 3, + PARTICLE_INVALID = -1 } porientation_t; @@ -642,7 +643,8 @@ typedef enum { PBLEND_ALPHA = 0, PBLEND_ADD = 1, - PBLEND_INVMOD = 2 + PBLEND_INVMOD = 2, + PBLEND_INVALID = -1 } pblend_t; @@ -685,8 +687,8 @@ typedef struct particle_s { // fields used by rendering: (40 bytes) unsigned char typeindex; - unsigned char blendmode; - unsigned char orientation; + pblend_t blendmode; + porientation_t orientation; unsigned char texnum; vec3_t org; vec3_t vel; // velocity of particle, or orientation of decal, or end point of beam diff --git a/clvm_cmds.c b/clvm_cmds.c index 82ce9fbd..327cb20d 100644 --- a/clvm_cmds.c +++ b/clvm_cmds.c @@ -1362,7 +1362,7 @@ static void VM_CL_ReadPicture (void) { // texture not found // use the attached jpeg as texture - buf = Mem_Alloc(tempmempool, size); + buf = (unsigned char *) Mem_Alloc(tempmempool, size); MSG_ReadBytes(size, buf); data = JPEG_LoadImage_BGRA(buf, size); Mem_Free(buf); diff --git a/console.c b/console.c index e545b702..e92c433d 100644 --- a/console.c +++ b/console.c @@ -1384,9 +1384,9 @@ int Con_DisplayLineFunc(void *passthrough, const char *line, size_t length, floa (void) 0; else { - int x = ti->x + (ti->width - width) * ti->alignment; + int x = (int) (ti->x + (ti->width - width) * ti->alignment); if(isContinuation && *ti->continuationString) - x += DrawQ_String_Font(x, ti->y, ti->continuationString, strlen(ti->continuationString), ti->fontsize, ti->fontsize, 1.0, 1.0, 1.0, 1.0, 0, NULL, false, ti->font); + x += (int) DrawQ_String_Font(x, ti->y, ti->continuationString, strlen(ti->continuationString), ti->fontsize, ti->fontsize, 1.0, 1.0, 1.0, 1.0, 0, NULL, false, ti->font); if(length > 0) DrawQ_String_Font(x, ti->y, line, length, ti->fontsize, ti->fontsize, 1.0, 1.0, 1.0, 1.0, 0, &(ti->colorindex), false, ti->font); } @@ -1419,7 +1419,7 @@ int Con_DrawNotifyRect(int mask_must, int mask_mustnot, float maxage, float x, f l = 0; Con_WordWidthFunc(&ti, NULL, &l, -1); l = strlen(continuationString); - continuationWidth = Con_WordWidthFunc(&ti, continuationString, &l, -1); + continuationWidth = (int) Con_WordWidthFunc(&ti, continuationString, &l, -1); // first find the first line to draw by backwards iterating and word wrapping to find their length... startidx = con_lines_count; diff --git a/csprogs.c b/csprogs.c index 1abf913a..8539312e 100644 --- a/csprogs.c +++ b/csprogs.c @@ -204,8 +204,8 @@ qboolean CSQC_AddRenderEdict(prvm_edict_t *ed) // self.frame1time is the animation base time for the interpolation target // self.frame2 is the interpolation start (previous frame) // self.frame2time is the animation base time for the interpolation start - entrender->frame1 = entrender->frame2 = ed->fields.client->frame; - if ((val = PRVM_EDICTFIELDVALUE(ed, prog->fieldoffsets.frame2))) entrender->frame2 = val->_float; + entrender->frame1 = entrender->frame2 = (int) ed->fields.client->frame; + if ((val = PRVM_EDICTFIELDVALUE(ed, prog->fieldoffsets.frame2))) entrender->frame2 = (int) val->_float; if ((val = PRVM_EDICTFIELDVALUE(ed, prog->fieldoffsets.frame1time))) entrender->frame2time = val->_float; if ((val = PRVM_EDICTFIELDVALUE(ed, prog->fieldoffsets.frame2time))) entrender->frame1time = val->_float; if ((val = PRVM_EDICTFIELDVALUE(ed, prog->fieldoffsets.lerpfrac))) entrender->framelerp = val->_float; @@ -520,7 +520,7 @@ void CL_VM_UpdateShowingScoresState (int showingscores) CSQC_END } } -qboolean CL_VM_Event_Sound(int sound_num, int volume, int channel, float attenuation, int ent, vec3_t pos) +qboolean CL_VM_Event_Sound(int sound_num, float volume, int channel, float attenuation, int ent, vec3_t pos) { qboolean r = false; if(cl.csqc_loaded) @@ -880,7 +880,7 @@ void CL_VM_Init (void) sizebuf_t sb; unsigned char *demobuf; fs_offset_t demofilesize; - sb.data = (void *) buf; + sb.data = (unsigned char *) buf; sb.maxsize = sizeof(buf); i = 0; diff --git a/cvar.h b/cvar.h index bc30eb6f..70f85fc9 100644 --- a/cvar.h +++ b/cvar.h @@ -206,8 +206,8 @@ cvar_t *Cvar_Get (const char *name, const char *value, int flags, const char *ne // allocates a cvar by name and returns its address, // or merely sets its value if it already exists. -char *cvar_dummy_description; // ALWAYS the same pointer -cvar_t *cvar_vars; // used to list all cvars +extern char *cvar_dummy_description; // ALWAYS the same pointer +extern cvar_t *cvar_vars; // used to list all cvars #endif diff --git a/filematch.c b/filematch.c index 1f5b1395..0755f14a 100644 --- a/filematch.c +++ b/filematch.c @@ -96,14 +96,14 @@ void stringlistappend(stringlist_t *list, const char *text) { oldstrings = list->strings; list->maxstrings += 4096; - list->strings = Z_Malloc(list->maxstrings * sizeof(*list->strings)); + list->strings = (char **) Z_Malloc(list->maxstrings * sizeof(*list->strings)); if (list->numstrings) memcpy(list->strings, oldstrings, list->numstrings * sizeof(*list->strings)); if (oldstrings) Z_Free(oldstrings); } textlen = strlen(text) + 1; - list->strings[list->numstrings] = Z_Malloc(textlen); + list->strings[list->numstrings] = (char *) Z_Malloc(textlen); memcpy(list->strings[list->numstrings], text, textlen); list->numstrings++; } diff --git a/fs.c b/fs.c index 119499f9..30e6ae81 100644 --- a/fs.c +++ b/fs.c @@ -3208,7 +3208,7 @@ unsigned char *FS_Deflate(const unsigned char *data, size_t size, size_t *deflat strm.next_in = (unsigned char*)data; strm.avail_in = size; - tmp = Mem_Alloc(tempmempool, size); + tmp = (unsigned char *) Mem_Alloc(tempmempool, size); if(!tmp) { Con_Printf("FS_Deflate: not enough memory in tempmempool!\n"); @@ -3241,7 +3241,7 @@ unsigned char *FS_Deflate(const unsigned char *data, size_t size, size_t *deflat return NULL; } - out = Mem_Alloc(mempool, strm.total_out); + out = (unsigned char *) Mem_Alloc(mempool, strm.total_out); if(!out) { Con_Printf("FS_Deflate: not enough memory in target mempool!\n"); @@ -3266,7 +3266,7 @@ static void AssertBufsize(sizebuf_t *buf, int length) unsigned char *olddata; olddata = buf->data; buf->maxsize += length; - buf->data = Mem_Alloc(tempmempool, buf->maxsize); + buf->data = (unsigned char *) Mem_Alloc(tempmempool, buf->maxsize); if(olddata) { memcpy(buf->data, olddata, oldsize); @@ -3285,7 +3285,7 @@ unsigned char *FS_Inflate(const unsigned char *data, size_t size, size_t *inflat sizebuf_t outbuf; memset(&outbuf, 0, sizeof(outbuf)); - outbuf.data = Mem_Alloc(tempmempool, sizeof(tmp)); + outbuf.data = (unsigned char *) Mem_Alloc(tempmempool, sizeof(tmp)); outbuf.maxsize = sizeof(tmp); memset(&strm, 0, sizeof(strm)); @@ -3347,7 +3347,7 @@ unsigned char *FS_Inflate(const unsigned char *data, size_t size, size_t *inflat qz_inflateEnd(&strm); - out = Mem_Alloc(mempool, outbuf.cursize); + out = (unsigned char *) Mem_Alloc(mempool, outbuf.cursize); if(!out) { Con_Printf("FS_Inflate: not enough memory in target mempool!\n"); diff --git a/gl_backend.c b/gl_backend.c index d953b47b..8e00108c 100644 --- a/gl_backend.c +++ b/gl_backend.c @@ -1407,7 +1407,7 @@ int R_Mesh_CreateStaticBufferObject(unsigned int target, void *data, size_t size } qglBufferDataARB(target, size, data, GL_STATIC_DRAW_ARB); - info = Mem_ExpandableArray_AllocRecord(&gl_bufferobjectinfoarray); + info = (gl_bufferobjectinfo_t *) Mem_ExpandableArray_AllocRecord(&gl_bufferobjectinfoarray); memset(info, 0, sizeof(*info)); info->target = target; info->object = bufferobject; @@ -1427,7 +1427,7 @@ void R_Mesh_DestroyBufferObject(int bufferobject) endindex = Mem_ExpandableArray_IndexRange(&gl_bufferobjectinfoarray); for (i = 0;i < endindex;i++) { - info = Mem_ExpandableArray_RecordAtIndex(&gl_bufferobjectinfoarray, i); + info = (gl_bufferobjectinfo_t *) Mem_ExpandableArray_RecordAtIndex(&gl_bufferobjectinfoarray, i); if (!info) continue; if (info->object == bufferobject) @@ -1447,7 +1447,7 @@ void GL_Mesh_ListVBOs(qboolean printeach) endindex = Mem_ExpandableArray_IndexRange(&gl_bufferobjectinfoarray); for (i = 0;i < endindex;i++) { - info = Mem_ExpandableArray_RecordAtIndex(&gl_bufferobjectinfoarray, i); + info = (gl_bufferobjectinfo_t *) Mem_ExpandableArray_RecordAtIndex(&gl_bufferobjectinfoarray, i); if (!info) continue; switch(info->target) diff --git a/gl_draw.c b/gl_draw.c index fad253b9..18a4d2a9 100644 --- a/gl_draw.c +++ b/gl_draw.c @@ -963,9 +963,9 @@ float DrawQ_TextWidth_Font_UntilWidth_TrackColors(const char *text, size_t *maxl { if (text[i] == ' ') { - if(x + fnt->width_of[' '] > maxwidth) + if(x + fnt->width_of[(int) ' '] > maxwidth) break; // oops, can't draw this - x += fnt->width_of[' ']; + x += fnt->width_of[(int) ' ']; continue; } if (text[i] == STRING_COLOR_TAG && !ignorecolorcodes && i + 1 < *maxlen) @@ -1108,7 +1108,7 @@ float DrawQ_String_Font(float startx, float starty, const char *text, size_t max { if (text[i] == ' ') { - x += fnt->width_of[' '] * w; + x += fnt->width_of[(int) ' '] * w; continue; } if (text[i] == STRING_COLOR_TAG && !ignorecolorcodes && i + 1 < maxlen) diff --git a/gl_rmain.c b/gl_rmain.c index b229b4b4..e0e7ab43 100644 --- a/gl_rmain.c +++ b/gl_rmain.c @@ -1243,13 +1243,13 @@ static char *R_GLSL_GetText(const char *filename, qboolean printfromdisknotice) } else if (!strcmp(filename, "glsl/default.glsl")) { - shaderstring = Mem_Alloc(r_main_mempool, strlen(builtinshaderstring) + 1); + shaderstring = (char *) Mem_Alloc(r_main_mempool, strlen(builtinshaderstring) + 1); memcpy(shaderstring, builtinshaderstring, strlen(builtinshaderstring) + 1); } return shaderstring; } -static void R_GLSL_CompilePermutation(shadermode_t mode, shaderpermutation_t permutation) +static void R_GLSL_CompilePermutation(unsigned int mode, unsigned int permutation) { int i; shadermodeinfo_t *modeinfo = shadermodeinfo + mode; @@ -1420,8 +1420,8 @@ static void R_GLSL_CompilePermutation(shadermode_t mode, shaderpermutation_t per void R_GLSL_Restart_f(void) { - shadermode_t mode; - shaderpermutation_t permutation; + unsigned int mode; + unsigned int permutation; for (mode = 0;mode < SHADERMODE_COUNT;mode++) for (permutation = 0;permutation < SHADERPERMUTATION_LIMIT;permutation++) if (r_glsl_permutations[mode][permutation].program) @@ -1453,7 +1453,7 @@ void R_GLSL_DumpShader_f(void) Con_Printf("glsl/default.glsl written\n"); } -void R_SetupShader_SetPermutation(shadermode_t mode, unsigned int permutation) +void R_SetupShader_SetPermutation(unsigned int mode, unsigned int permutation) { r_glsl_permutation_t *perm = &r_glsl_permutations[mode][permutation]; if (r_glsl_permutation != perm) @@ -1552,7 +1552,7 @@ void R_SetupSurfaceShader(const vec3_t lightcolorbase, qboolean modellighting, f // minimum features necessary to avoid wasting rendering time in the // fragment shader on features that are not being used unsigned int permutation = 0; - shadermode_t mode = 0; + unsigned int mode = 0; // TODO: implement geometry-shader based shadow volumes someday if (r_glsl_offsetmapping.integer) { @@ -1794,13 +1794,14 @@ void R_SetupSurfaceShader(const vec3_t lightcolorbase, qboolean modellighting, f #define SKINFRAME_HASH 1024 -struct +typedef struct { int loadsequence; // incremented each level change memexpandablearray_t array; skinframe_t *hash[SKINFRAME_HASH]; } -r_skinframe; +r_skinframe_t; +r_skinframe_t r_skinframe; void R_SkinFrame_PrepareForPurge(void) { @@ -4678,11 +4679,11 @@ void R_UpdateTextureInfo(const entity_render_t *ent, texture_t *t) Matrix4x4_CreateTranslate(&matrix, tcmod->parms[0] * r_refdef.scene.time, tcmod->parms[1] * r_refdef.scene.time, 0); break; case Q3TCMOD_PAGE: // poor man's animmap (to store animations into a single file, useful for HTTP downloaded textures) - w = tcmod->parms[0]; - h = tcmod->parms[1]; + w = (int) tcmod->parms[0]; + h = (int) tcmod->parms[1]; f = r_refdef.scene.time / (tcmod->parms[2] * w * h); f = f - floor(f); - idx = floor(f * w * h); + idx = (int) floor(f * w * h); Matrix4x4_CreateTranslate(&matrix, (idx % w) / tcmod->parms[0], (idx / w) / tcmod->parms[1], 0); break; case Q3TCMOD_STRETCH: @@ -6942,7 +6943,7 @@ void R_DrawWorldSurfaces(qboolean skysurfaces, qboolean writedepth, qboolean dep r_maxsurfacelist = model->num_surfaces; if (r_surfacelist) Mem_Free(r_surfacelist); - r_surfacelist = Mem_Alloc(r_main_mempool, r_maxsurfacelist * sizeof(*r_surfacelist)); + r_surfacelist = (msurface_t **) Mem_Alloc(r_main_mempool, r_maxsurfacelist * sizeof(*r_surfacelist)); } RSurf_ActiveWorldEntity(); @@ -7032,7 +7033,7 @@ void R_DrawModelSurfaces(entity_render_t *ent, qboolean skysurfaces, qboolean wr r_maxsurfacelist = model->num_surfaces; if (r_surfacelist) Mem_Free(r_surfacelist); - r_surfacelist = Mem_Alloc(r_main_mempool, r_maxsurfacelist * sizeof(*r_surfacelist)); + r_surfacelist = (msurface_t **) Mem_Alloc(r_main_mempool, r_maxsurfacelist * sizeof(*r_surfacelist)); } // if the model is static it doesn't matter what value we give for diff --git a/gl_rsurf.c b/gl_rsurf.c index cbab40d4..c6fe69e8 100644 --- a/gl_rsurf.c +++ b/gl_rsurf.c @@ -60,7 +60,7 @@ void R_BuildLightMap (const entity_render_t *ent, msurface_t *surface) cl.buildlightmapmemorysize = size*sizeof(int[3]); if (cl.buildlightmapmemory) Mem_Free(cl.buildlightmapmemory); - cl.buildlightmapmemory = Mem_Alloc(cls.levelmempool, cl.buildlightmapmemorysize); + cl.buildlightmapmemory = (unsigned char *) Mem_Alloc(cls.levelmempool, cl.buildlightmapmemorysize); } // these both point at the same buffer, templight is only used for final @@ -819,7 +819,7 @@ void R_Q1BSP_CallRecursiveGetLightInfo(r_q1bsp_getlightinfo_t *info, qboolean us if (!r_svbsp.nodes) { r_svbsp.maxnodes = max(r_svbsp.maxnodes, 1<<18); - r_svbsp.nodes = Mem_Alloc(r_main_mempool, r_svbsp.maxnodes * sizeof(svbsp_node_t)); + r_svbsp.nodes = (svbsp_node_t*) Mem_Alloc(r_main_mempool, r_svbsp.maxnodes * sizeof(svbsp_node_t)); } info->svbsp_active = true; info->svbsp_insertoccluder = true; @@ -835,7 +835,7 @@ void R_Q1BSP_CallRecursiveGetLightInfo(r_q1bsp_getlightinfo_t *info, qboolean us break; Mem_Free(r_svbsp.nodes); r_svbsp.maxnodes *= 2; - r_svbsp.nodes = Mem_Alloc(tempmempool, r_svbsp.maxnodes * sizeof(svbsp_node_t)); + r_svbsp.nodes = (svbsp_node_t*) Mem_Alloc(tempmempool, r_svbsp.maxnodes * sizeof(svbsp_node_t)); } else break; diff --git a/image.c b/image.c index 6bca15aa..a99176e5 100644 --- a/image.c +++ b/image.c @@ -873,7 +873,7 @@ int fixtransparentpixels(unsigned char *data, int w, int h) int const FIXTRANS_HAS_U = 8; int const FIXTRANS_HAS_D = 16; int const FIXTRANS_FIXED = 32; - unsigned char *fixMask = Mem_Alloc(tempmempool, w * h); + unsigned char *fixMask = (unsigned char *) Mem_Alloc(tempmempool, w * h); int fixPixels = 0; int changedPixels = 0; int x, y; diff --git a/jpeg.c b/jpeg.c index 49ebfd95..a248948f 100644 --- a/jpeg.c +++ b/jpeg.c @@ -757,7 +757,7 @@ static void JPEG_MemDest (j_compress_ptr cinfo, void* buf, size_t bufsize) dest->pub.term_destination = JPEG_Mem_TermDestination; dest->outfile = NULL; - dest->buffer = buf; + dest->buffer = (unsigned char *) buf; dest->bufsize = bufsize; } @@ -970,7 +970,7 @@ static void CompressedImageCache_Add(const char *imagename, size_t maxsize, void if(strlen(imagename) >= MAX_QPATH) return; // can't add this - i = Z_Malloc(sizeof(CompressedImageCacheItem)); + i = (CompressedImageCacheItem*) Z_Malloc(sizeof(CompressedImageCacheItem)); strlcpy(i->imagename, imagename, sizeof(i->imagename)); i->maxsize = maxsize; i->compressed = compressed; @@ -1038,7 +1038,7 @@ qboolean Image_Compress(const char *imagename, size_t maxsize, void **buf, size_ Image_MipReduce32(imagedata, imagedata, &image_width, &image_height, &one, image_width/2, image_height/2, 1); } - newimagedata = Mem_Alloc(tempmempool, image_width * image_height * 3); + newimagedata = (unsigned char *) Mem_Alloc(tempmempool, image_width * image_height * 3); // convert the image from BGRA to RGB Image_CopyMux(newimagedata, imagedata, image_width, image_height, false, false, false, 3, 4, components); @@ -1046,7 +1046,7 @@ qboolean Image_Compress(const char *imagename, size_t maxsize, void **buf, size_ // try to compress it to JPEG *buf = Z_Malloc(maxsize); - *size = JPEG_SaveImage_to_Buffer(*buf, maxsize, image_width, image_height, newimagedata); + *size = JPEG_SaveImage_to_Buffer((char *) *buf, maxsize, image_width, image_height, newimagedata); if(!*size) { Z_Free(*buf); diff --git a/libcurl.c b/libcurl.c index f2e1856d..ccbeae11 100644 --- a/libcurl.c +++ b/libcurl.c @@ -886,7 +886,7 @@ void Curl_Run() case 4: // e.g. 404? case 5: // e.g. 500? failed = CURL_DOWNLOAD_SERVERERROR; - result = code; + result = (CURLcode) code; break; } } diff --git a/makefile.inc b/makefile.inc index 5abd9fc8..99a66ad1 100644 --- a/makefile.inc +++ b/makefile.inc @@ -161,7 +161,7 @@ OBJ_SDL= builddate.c sys_sdl.o vid_sdl.o $(OBJ_SND_COMMON) snd_sdl.o cd_sdl.o $( # Compilation -CFLAGS_COMMON=$(CFLAGS_MAKEDEP) $(CFLAGS_PRELOAD) $(CFLAGS_FS) -Wall -Wsign-compare -Wdeclaration-after-statement +CFLAGS_COMMON=$(CFLAGS_MAKEDEP) $(CFLAGS_PRELOAD) $(CFLAGS_FS) -Wall -Wsign-compare CFLAGS_DEBUG=-ggdb CFLAGS_PROFILE=-g -pg -ggdb CFLAGS_RELEASE= diff --git a/model_alias.c b/model_alias.c index 23c22e2c..8d6a1525 100644 --- a/model_alias.c +++ b/model_alias.c @@ -452,7 +452,7 @@ static void Mod_BuildBaseBonePoses(void) { int i, k; double scale; - float *basebonepose = Mem_Alloc(tempmempool, loadmodel->num_bones * sizeof(float[12])); + float *basebonepose = (float *) Mem_Alloc(tempmempool, loadmodel->num_bones * sizeof(float[12])); float *in12f = loadmodel->data_poses; float *out12f = basebonepose; float *outinv12f = loadmodel->data_baseboneposeinverse; @@ -502,7 +502,7 @@ static void Mod_Alias_CalculateBoundingBox(void) frameblend_t frameblend[4]; memset(frameblend, 0, sizeof(frameblend)); frameblend[0].lerp = 1; - vertex3f = Mem_Alloc(loadmodel->mempool, loadmodel->surfmesh.num_vertices * sizeof(float[3])); + vertex3f = (float *) Mem_Alloc(loadmodel->mempool, loadmodel->surfmesh.num_vertices * sizeof(float[3])); VectorClear(loadmodel->normalmins); VectorClear(loadmodel->normalmaxs); yawradius = 0; @@ -749,7 +749,7 @@ static void Mod_BuildAliasSkinFromSkinFrame(texture_t *texture, skinframe_t *ski texture->currentmaterialflags = texture->basematerialflags; } -static void Mod_BuildAliasSkinsFromSkinFiles(texture_t *skin, skinfile_t *skinfile, char *meshname, char *shadername) +static void Mod_BuildAliasSkinsFromSkinFiles(texture_t *skin, skinfile_t *skinfile, const char *meshname, const char *shadername) { int i; skinfileitem_t *skinfileitem; @@ -2565,7 +2565,7 @@ void Mod_PSKMODEL_Load(dp_model_t *mod, void *buffer, void *bufferend) for (i = 0;i < loadmodel->surfmesh.num_triangles*3;i++) loadmodel->surfmesh.data_element3s[i] = loadmodel->surfmesh.data_element3i[i]; } - loadmodel->data_poses = Mem_Alloc(loadmodel->mempool, loadmodel->num_poses * sizeof(float[12])); + loadmodel->data_poses = (float *) Mem_Alloc(loadmodel->mempool, loadmodel->num_poses * sizeof(float[12])); for (i = 0;i < loadmodel->numskins;i++) { diff --git a/model_brush.c b/model_brush.c index 82a692ba..dbd27087 100644 --- a/model_brush.c +++ b/model_brush.c @@ -4526,7 +4526,7 @@ static void Mod_Q3BSP_LoadLightmaps(lump_t *l, lump_t *faceslump) } } - convertedpixels = Mem_Alloc(tempmempool, size*size*4); + convertedpixels = (unsigned char *) Mem_Alloc(tempmempool, size*size*4); loadmodel->brushq3.lightmapsize = size; loadmodel->brushq3.num_originallightmaps = count; @@ -4725,7 +4725,7 @@ static void Mod_Q3BSP_LoadFaces(lump_t *l) loadmodel->num_surfaces = count; if(count > 0) - patchtess = Mem_Alloc(tempmempool, count * sizeof(*patchtess)); + patchtess = (patchtess_t*) Mem_Alloc(tempmempool, count * sizeof(*patchtess)); i = 0; oldi = i; diff --git a/model_shared.c b/model_shared.c index 5aa57b5d..eac0865b 100644 --- a/model_shared.c +++ b/model_shared.c @@ -58,7 +58,7 @@ static void mod_start(void) Mod_LoadQ3Shaders(); for (i = 0;i < nummodels;i++) - if ((mod = Mem_ExpandableArray_RecordAtIndex(&models, i)) && mod->name[0] && mod->name[0] != '*') + if ((mod = (dp_model_t*) Mem_ExpandableArray_RecordAtIndex(&models, i)) && mod->name[0] && mod->name[0] != '*') if (mod->used) Mod_LoadModel(mod, true, false, mod->isworldmodel); } @@ -70,7 +70,7 @@ static void mod_shutdown(void) dp_model_t *mod; for (i = 0;i < nummodels;i++) - if ((mod = Mem_ExpandableArray_RecordAtIndex(&models, i)) && (mod->loaded || mod->mempool)) + if ((mod = (dp_model_t*) Mem_ExpandableArray_RecordAtIndex(&models, i)) && (mod->loaded || mod->mempool)) Mod_UnloadModel(mod); Mem_FreePool (&q3shaders_mem); @@ -86,7 +86,7 @@ static void mod_newmap(void) R_SkinFrame_PrepareForPurge(); for (i = 0;i < nummodels;i++) { - if ((mod = Mem_ExpandableArray_RecordAtIndex(&models, i)) && mod->mempool && mod->data_textures) + if ((mod = (dp_model_t*) Mem_ExpandableArray_RecordAtIndex(&models, i)) && mod->mempool && mod->data_textures) { for (j = 0;j < mod->num_textures;j++) { @@ -104,7 +104,7 @@ static void mod_newmap(void) for (i = 0;i < nummodels;i++) { - if ((mod = Mem_ExpandableArray_RecordAtIndex(&models, i)) && mod->mempool && mod->data_surfaces) + if ((mod = (dp_model_t*) Mem_ExpandableArray_RecordAtIndex(&models, i)) && mod->mempool && mod->data_surfaces) { for (surfacenum = 0, surface = mod->data_surfaces;surfacenum < mod->num_surfaces;surfacenum++, surface++) { @@ -351,7 +351,7 @@ void Mod_ClearUsed(void) int nummodels = Mem_ExpandableArray_IndexRange(&models); dp_model_t *mod; for (i = 0;i < nummodels;i++) - if ((mod = Mem_ExpandableArray_RecordAtIndex(&models, i)) && mod->name[0]) + if ((mod = (dp_model_t*) Mem_ExpandableArray_RecordAtIndex(&models, i)) && mod->name[0]) mod->used = false; } @@ -362,7 +362,7 @@ void Mod_PurgeUnused(void) dp_model_t *mod; for (i = 0;i < nummodels;i++) { - if ((mod = Mem_ExpandableArray_RecordAtIndex(&models, i)) && mod->name[0] && !mod->used) + if ((mod = (dp_model_t*) Mem_ExpandableArray_RecordAtIndex(&models, i)) && mod->name[0] && !mod->used) { Mod_UnloadModel(mod); Mem_ExpandableArray_FreeRecord(&models, mod); @@ -378,7 +378,7 @@ void Mod_RemoveStaleWorldModels(dp_model_t *skip) dp_model_t *mod; for (i = 0;i < nummodels;i++) { - if ((mod = Mem_ExpandableArray_RecordAtIndex(&models, i)) && mod->isworldmodel && mod->loaded && skip != mod) + if ((mod = (dp_model_t*) Mem_ExpandableArray_RecordAtIndex(&models, i)) && mod->isworldmodel && mod->loaded && skip != mod) { Mod_UnloadModel(mod); mod->isworldmodel = false; @@ -405,7 +405,7 @@ dp_model_t *Mod_FindName(const char *name) // search the currently loaded models for (i = 0;i < nummodels;i++) { - if ((mod = Mem_ExpandableArray_RecordAtIndex(&models, i)) && mod->name[0] && !strcmp(mod->name, name)) + if ((mod = (dp_model_t*) Mem_ExpandableArray_RecordAtIndex(&models, i)) && mod->name[0] && !strcmp(mod->name, name)) { mod->used = true; return mod; @@ -413,7 +413,7 @@ dp_model_t *Mod_FindName(const char *name) } // no match found, create a new one - mod = Mem_ExpandableArray_AllocRecord(&models); + mod = (dp_model_t *) Mem_ExpandableArray_AllocRecord(&models); strlcpy(mod->name, name, sizeof(mod->name)); mod->loaded = false; mod->used = true; @@ -449,7 +449,7 @@ void Mod_Reload(void) int nummodels = Mem_ExpandableArray_IndexRange(&models); dp_model_t *mod; for (i = 0;i < nummodels;i++) - if ((mod = Mem_ExpandableArray_RecordAtIndex(&models, i)) && mod->name[0] && mod->name[0] != '*' && mod->used) + if ((mod = (dp_model_t *) Mem_ExpandableArray_RecordAtIndex(&models, i)) && mod->name[0] && mod->name[0] != '*' && mod->used) Mod_LoadModel(mod, true, true, mod->isworldmodel); } @@ -471,7 +471,7 @@ static void Mod_Print(void) Con_Print("Loaded models:\n"); for (i = 0;i < nummodels;i++) - if ((mod = Mem_ExpandableArray_RecordAtIndex(&models, i)) && mod->name[0]) + if ((mod = (dp_model_t *) Mem_ExpandableArray_RecordAtIndex(&models, i)) && mod->name[0]) Con_Printf("%4iK %s\n", mod->mempool ? (int)((mod->mempool->totalsize + 1023) / 1024) : 0, mod->name); } @@ -1403,7 +1403,7 @@ void Mod_LoadQ3Shaders(void) int i; layer->numframes = min(numparameters - 2, TEXTURE_MAXFRAMES); layer->framerate = atof(parameter[1]); - layer->texturename = Mem_Alloc (q3shaders_mem, sizeof (char*) * layer->numframes); + layer->texturename = (char **) Mem_Alloc (q3shaders_mem, sizeof (char*) * layer->numframes); for (i = 0;i < layer->numframes;i++) layer->texturename[i] = Mem_strdup (q3shaders_mem, parameter[i + 2]); } @@ -1445,7 +1445,7 @@ void Mod_LoadQ3Shaders(void) else if (!strcasecmp(parameter[1], "vertex")) layer->alphagen.alphagen = Q3ALPHAGEN_VERTEX; else if (!strcasecmp(parameter[1], "wave")) { - layer->alphagen.alphagen = Q3RGBGEN_WAVE; + layer->alphagen.alphagen = Q3ALPHAGEN_WAVE; layer->alphagen.wavefunc = Mod_LoadQ3Shaders_EnumerateWaveFunc(parameter[2]); for (i = 0;i < numparameters - 3 && i < Q3WAVEPARMS;i++) layer->alphagen.waveparms[i] = atof(parameter[i+3]); diff --git a/model_sprite.c b/model_sprite.c index 0c27bc21..926ea606 100644 --- a/model_sprite.c +++ b/model_sprite.c @@ -192,7 +192,7 @@ static void Mod_Sprite_SharedSetup(const unsigned char *datapointer, int version } if (!(skinframe = R_SkinFrame_LoadExternal(name, texflags | TEXF_COMPRESS, false))) { - unsigned char *pixels = Mem_Alloc(loadmodel->mempool, width*height*4); + unsigned char *pixels = (unsigned char *) Mem_Alloc(loadmodel->mempool, width*height*4); if (version == SPRITE32_VERSION) { for (x = 0;x < width*height;x++) diff --git a/prvm_cmds.c b/prvm_cmds.c index cb3107cf..a819196f 100644 --- a/prvm_cmds.c +++ b/prvm_cmds.c @@ -1941,7 +1941,7 @@ void VM_putentityfieldstring(void) } // parse the string into the value - PRVM_G_FLOAT(OFS_RETURN) = ( PRVM_ED_ParseEpair(ent, d, PRVM_G_STRING(OFS_PARM2)) ) ? 1.0f : 0.0f; + PRVM_G_FLOAT(OFS_RETURN) = ( PRVM_ED_ParseEpair(ent, d, PRVM_G_STRING(OFS_PARM2), false) ) ? 1.0f : 0.0f; } /* @@ -2912,7 +2912,7 @@ dp_font_t *getdrawfont() { if(prog->globaloffsets.drawfont >= 0) { - int f = PRVM_G_FLOAT(prog->globaloffsets.drawfont); + int f = (int) PRVM_G_FLOAT(prog->globaloffsets.drawfont); if(f < 0 || f >= MAX_FONTS) return FONT_DEFAULT; return &dp_fonts[f]; @@ -3593,7 +3593,7 @@ void VM_gecko_keyevent( void ) { return; } - PRVM_G_FLOAT( OFS_RETURN ) = (CL_Gecko_Event_Key( instance, key, eventtype ) == true); + PRVM_G_FLOAT( OFS_RETURN ) = (CL_Gecko_Event_Key( instance, (keynum_t) key, eventtype ) == true); } /* @@ -3646,7 +3646,7 @@ void VM_gecko_resize( void ) { if( !instance ) { return; } - CL_Gecko_Resize( instance, w, h ); + CL_Gecko_Resize( instance, (int) w, (int) h ); } @@ -3979,7 +3979,7 @@ static void BufStr_Expand(prvm_stringbuffer_t *stringbuffer, int strindex) stringbuffer->max_strings = max(stringbuffer->max_strings * 2, 128); while (stringbuffer->max_strings <= strindex) stringbuffer->max_strings *= 2; - stringbuffer->strings = Mem_Alloc(prog->progs_mempool, stringbuffer->max_strings * sizeof(stringbuffer->strings[0])); + stringbuffer->strings = (char **) Mem_Alloc(prog->progs_mempool, stringbuffer->max_strings * sizeof(stringbuffer->strings[0])); if (stringbuffer->num_strings > 0) memcpy(stringbuffer->strings, oldstrings, stringbuffer->num_strings * sizeof(stringbuffer->strings[0])); if (oldstrings) @@ -4035,7 +4035,7 @@ void VM_buf_create (void) prvm_stringbuffer_t *stringbuffer; int i; VM_SAFEPARMCOUNT(0, VM_buf_create); - stringbuffer = Mem_ExpandableArray_AllocRecord(&prog->stringbuffersarray); + stringbuffer = (prvm_stringbuffer_t *) Mem_ExpandableArray_AllocRecord(&prog->stringbuffersarray); for (i = 0;stringbuffer != Mem_ExpandableArray_RecordAtIndex(&prog->stringbuffersarray, i);i++); stringbuffer->origin = PRVM_AllocationOrigin(); PRVM_G_FLOAT(OFS_RETURN) = i; @@ -4617,7 +4617,7 @@ void VM_strstrofs (void) VM_SAFEPARMCOUNTRANGE(2, 3, VM_strstrofs); instr = PRVM_G_STRING(OFS_PARM0); match = PRVM_G_STRING(OFS_PARM1); - firstofs = (prog->argc > 2)?PRVM_G_FLOAT(OFS_PARM2):0; + firstofs = (prog->argc > 2)?(int)PRVM_G_FLOAT(OFS_PARM2):0; if (firstofs && (firstofs < 0 || firstofs > (int)strlen(instr))) { @@ -4746,9 +4746,9 @@ void VM_strconv (void) VM_SAFEPARMCOUNTRANGE(3, 8, VM_strconv); - ccase = PRVM_G_FLOAT(OFS_PARM0); //0 same, 1 lower, 2 upper - redalpha = PRVM_G_FLOAT(OFS_PARM1); //0 same, 1 white, 2 red, 5 alternate, 6 alternate-alternate - rednum = PRVM_G_FLOAT(OFS_PARM2); //0 same, 1 white, 2 red, 3 redspecial, 4 whitespecial, 5 alternate, 6 alternate-alternate + ccase = (int) PRVM_G_FLOAT(OFS_PARM0); //0 same, 1 lower, 2 upper + redalpha = (int) PRVM_G_FLOAT(OFS_PARM1); //0 same, 1 white, 2 red, 5 alternate, 6 alternate-alternate + rednum = (int) PRVM_G_FLOAT(OFS_PARM2); //0 same, 1 white, 2 red, 3 redspecial, 4 whitespecial, 5 alternate, 6 alternate-alternate VM_VarString(3, (char *) resbuf, sizeof(resbuf)); len = strlen((char *) resbuf); @@ -4791,7 +4791,7 @@ void VM_strpad (void) char destbuf[VM_STRINGTEMP_LENGTH]; int pad; VM_SAFEPARMCOUNTRANGE(1, 8, VM_strpad); - pad = PRVM_G_FLOAT(OFS_PARM0); + pad = (int) PRVM_G_FLOAT(OFS_PARM0); VM_VarString(1, src, sizeof(src)); // note: < 0 = left padding, > 0 = right padding, @@ -5046,7 +5046,7 @@ uri_to_prog_t; static void uri_to_string_callback(int status, size_t length_received, unsigned char *buffer, void *cbdata) { - uri_to_prog_t *handle = cbdata; + uri_to_prog_t *handle = (uri_to_prog_t *) cbdata; if(!PRVM_ProgLoaded(handle->prognr)) { @@ -5089,7 +5089,7 @@ void VM_uri_get (void) url = PRVM_G_STRING(OFS_PARM0); id = PRVM_G_FLOAT(OFS_PARM1); - handle = Z_Malloc(sizeof(*handle)); // this can't be the prog's mem pool, as curl may call the callback later! + handle = (uri_to_prog_t *) Z_Malloc(sizeof(*handle)); // this can't be the prog's mem pool, as curl may call the callback later! handle->prognr = PRVM_GetProgNr(); handle->starttime = prog->starttime; @@ -5118,7 +5118,7 @@ void VM_netaddress_resolve (void) ip = PRVM_G_STRING(OFS_PARM0); port = 0; if(prog->argc > 1) - port = PRVM_G_FLOAT(OFS_PARM1); + port = (int) PRVM_G_FLOAT(OFS_PARM1); if(LHNETADDRESS_FromString(&addr, ip, port) && LHNETADDRESS_ToString(&addr, normalized, sizeof(normalized), prog->argc > 1)) PRVM_G_INT(OFS_RETURN) = PRVM_SetTempString(normalized); diff --git a/prvm_cmds.h b/prvm_cmds.h index 535c7681..16785039 100644 --- a/prvm_cmds.h +++ b/prvm_cmds.h @@ -308,7 +308,7 @@ void VM_putentityfieldstring(void); // And declared these ones for VM_getentityfieldstring and VM_putentityfieldstring in prvm_cmds.c // the function is from prvm_edict.c char *PRVM_UglyValueString (etype_t type, prvm_eval_t *val); -qboolean PRVM_ED_ParseEpair(prvm_edict_t *ent, ddef_t *key, const char *s); +qboolean PRVM_ED_ParseEpair(prvm_edict_t *ent, ddef_t *key, const char *s, qboolean parsebackslash); // DRESK - String Length (not counting color codes) void VM_strlennocol(void); diff --git a/prvm_edict.c b/prvm_edict.c index c3bbfb8f..82314f8a 100644 --- a/prvm_edict.c +++ b/prvm_edict.c @@ -2389,7 +2389,7 @@ int PRVM_SetTempString(const char *s) { if (developer.integer >= 100) Con_Printf("PRVM_SetTempString: enlarging tempstrings buffer (%iKB -> %iKB)\n", old.maxsize/1024, vm_tempstringsbuf.maxsize/1024); - vm_tempstringsbuf.data = Mem_Alloc(sv_mempool, vm_tempstringsbuf.maxsize); + vm_tempstringsbuf.data = (unsigned char *) Mem_Alloc(sv_mempool, vm_tempstringsbuf.maxsize); if (old.cursize) memcpy(vm_tempstringsbuf.data, old.data, old.cursize); if (old.data) @@ -2683,7 +2683,7 @@ void PRVM_LeakTest() for (i = 0; i < (int)Mem_ExpandableArray_IndexRange(&prog->stringbuffersarray); ++i) { - prvm_stringbuffer_t *stringbuffer = Mem_ExpandableArray_RecordAtIndex(&prog->stringbuffersarray, i); + prvm_stringbuffer_t *stringbuffer = (prvm_stringbuffer_t*) Mem_ExpandableArray_RecordAtIndex(&prog->stringbuffersarray, i); if(stringbuffer) if(stringbuffer->origin) { diff --git a/r_shadow.c b/r_shadow.c index feed37e4..284f569e 100644 --- a/r_shadow.c +++ b/r_shadow.c @@ -2574,7 +2574,7 @@ void R_Shadow_UncompileWorldLights(void) size_t range = Mem_ExpandableArray_IndexRange(&r_shadow_worldlightsarray); // checked for (lightindex = 0;lightindex < range;lightindex++) { - light = Mem_ExpandableArray_RecordAtIndex(&r_shadow_worldlightsarray, lightindex); + light = (dlight_t *) Mem_ExpandableArray_RecordAtIndex(&r_shadow_worldlightsarray, lightindex); if (!light) continue; R_RTLight_Uncompile(&light->rtlight); @@ -3151,7 +3151,7 @@ void R_ShadowVolumeLighting(qboolean visible) if (r_shadow_debuglight.integer >= 0) { lightindex = r_shadow_debuglight.integer; - light = Mem_ExpandableArray_RecordAtIndex(&r_shadow_worldlightsarray, lightindex); + light = (dlight_t *) Mem_ExpandableArray_RecordAtIndex(&r_shadow_worldlightsarray, lightindex); if (light && (light->flags & flag)) R_DrawRTLight(&light->rtlight, visible); } @@ -3160,7 +3160,7 @@ void R_ShadowVolumeLighting(qboolean visible) range = Mem_ExpandableArray_IndexRange(&r_shadow_worldlightsarray); // checked for (lightindex = 0;lightindex < range;lightindex++) { - light = Mem_ExpandableArray_RecordAtIndex(&r_shadow_worldlightsarray, lightindex); + light = (dlight_t *) Mem_ExpandableArray_RecordAtIndex(&r_shadow_worldlightsarray, lightindex); if (light && (light->flags & flag)) R_DrawRTLight(&light->rtlight, visible); } @@ -3313,7 +3313,7 @@ void R_DrawCoronas(void) range = Mem_ExpandableArray_IndexRange(&r_shadow_worldlightsarray); // checked for (lightindex = 0;lightindex < range;lightindex++) { - light = Mem_ExpandableArray_RecordAtIndex(&r_shadow_worldlightsarray, lightindex); + light = (dlight_t *) Mem_ExpandableArray_RecordAtIndex(&r_shadow_worldlightsarray, lightindex); if (!light) continue; rtlight = &light->rtlight; @@ -3550,7 +3550,7 @@ void R_Shadow_ClearWorldLights(void) size_t range = Mem_ExpandableArray_IndexRange(&r_shadow_worldlightsarray); // checked for (lightindex = 0;lightindex < range;lightindex++) { - light = Mem_ExpandableArray_RecordAtIndex(&r_shadow_worldlightsarray, lightindex); + light = (dlight_t *) Mem_ExpandableArray_RecordAtIndex(&r_shadow_worldlightsarray, lightindex); if (light) R_Shadow_FreeWorldLight(light); } @@ -3614,7 +3614,7 @@ void R_Shadow_DrawLightSprites(void) size_t range = Mem_ExpandableArray_IndexRange(&r_shadow_worldlightsarray); // checked for (lightindex = 0;lightindex < range;lightindex++) { - light = Mem_ExpandableArray_RecordAtIndex(&r_shadow_worldlightsarray, lightindex); + light = (dlight_t *) Mem_ExpandableArray_RecordAtIndex(&r_shadow_worldlightsarray, lightindex); if (light) R_MeshQueue_AddTransparent(light->origin, R_Shadow_DrawLightSprite_TransparentCallback, (entity_render_t *)light, 5, &light->rtlight); } @@ -3632,7 +3632,7 @@ void R_Shadow_SelectLightInView(void) bestrating = 0; for (lightindex = 0;lightindex < range;lightindex++) { - light = Mem_ExpandableArray_RecordAtIndex(&r_shadow_worldlightsarray, lightindex); + light = (dlight_t *) Mem_ExpandableArray_RecordAtIndex(&r_shadow_worldlightsarray, lightindex); if (!light) continue; VectorSubtract(light->origin, r_refdef.view.origin, temp); @@ -3777,7 +3777,7 @@ void R_Shadow_SaveWorldLights(void) buf = NULL; for (lightindex = 0;lightindex < range;lightindex++) { - light = Mem_ExpandableArray_RecordAtIndex(&r_shadow_worldlightsarray, lightindex); + light = (dlight_t *) Mem_ExpandableArray_RecordAtIndex(&r_shadow_worldlightsarray, lightindex); if (!light) continue; if (light->coronasizescale != 0.25f || light->ambientscale != 0 || light->diffusescale != 1 || light->specularscale != 1 || light->flags != LIGHTFLAG_REALTIMEMODE) @@ -4504,7 +4504,7 @@ void R_Shadow_EditLights_EditAll_f(void) range = Mem_ExpandableArray_IndexRange(&r_shadow_worldlightsarray); // checked for (lightindex = 0;lightindex < range;lightindex++) { - light = Mem_ExpandableArray_RecordAtIndex(&r_shadow_worldlightsarray, lightindex); + light = (dlight_t *) Mem_ExpandableArray_RecordAtIndex(&r_shadow_worldlightsarray, lightindex); if (!light) continue; R_Shadow_SelectLight(light); @@ -4529,7 +4529,7 @@ void R_Shadow_EditLights_DrawSelectedLightProperties(void) range = Mem_ExpandableArray_IndexRange(&r_shadow_worldlightsarray); // checked for (lightindex = 0;lightindex < range;lightindex++) { - light = Mem_ExpandableArray_RecordAtIndex(&r_shadow_worldlightsarray, lightindex); + light = (dlight_t *) Mem_ExpandableArray_RecordAtIndex(&r_shadow_worldlightsarray, lightindex); if (!light) continue; if (light == r_shadow_selectedlight) diff --git a/sbar.c b/sbar.c index 9e67b21a..20218ea8 100644 --- a/sbar.c +++ b/sbar.c @@ -1296,14 +1296,14 @@ void Sbar_Draw (void) { // The Impossible Combination[tm] // Can only happen in Key Hunt mode... - Sbar_DrawPic (x, (vid_conheight.integer - sbar_y) - (sbar_flagstatus_pos.value + 128), sb_items[14]); + Sbar_DrawPic ((int) x, (int) ((vid_conheight.integer - sbar_y) - (sbar_flagstatus_pos.value + 128)), sb_items[14]); } else { if (redflag) - Sbar_DrawPic (x, (vid_conheight.integer - sbar_y) - (sbar_flagstatus_pos.value + 64), sb_items[redflag+10]); + Sbar_DrawPic ((int) x, (int) ((vid_conheight.integer - sbar_y) - (sbar_flagstatus_pos.value + 64)), sb_items[redflag+10]); if (blueflag) - Sbar_DrawPic (x, (vid_conheight.integer - sbar_y) - (sbar_flagstatus_pos.value + 128), sb_items[blueflag+14]); + Sbar_DrawPic ((int) x, (int) ((vid_conheight.integer - sbar_y) - (sbar_flagstatus_pos.value + 128)), sb_items[blueflag+14]); } // armor @@ -1401,14 +1401,14 @@ void Sbar_Draw (void) { // The Impossible Combination[tm] // Can only happen in Key Hunt mode... - Sbar_DrawPic (x, -179, sb_items[14]); + Sbar_DrawPic ((int) x, -179, sb_items[14]); } else { if (redflag) - Sbar_DrawPic (x, -117, sb_items[redflag+10]); + Sbar_DrawPic ((int) x, -117, sb_items[redflag+10]); if (blueflag) - Sbar_DrawPic (x, -177, sb_items[blueflag+14]); + Sbar_DrawPic ((int) x, -177, sb_items[blueflag+14]); } // armor @@ -1778,9 +1778,9 @@ void Sbar_DeathmatchOverlay (void) ymax = 40 + 8 + (Sbar_IsTeammatch() ? (teamlines * 8 + 5): 0) + scoreboardlines * 8 - 1; if (cls.protocol == PROTOCOL_QUAKEWORLD) - xmin = (vid_conwidth.integer - (26 + 15) * 8 * FONT_SBAR->maxwidth) / 2; // 26 characters until name, then we assume 15 character names (they can be longer but usually aren't) + xmin = (int) (vid_conwidth.integer - (26 + 15) * 8 * FONT_SBAR->maxwidth) / 2; // 26 characters until name, then we assume 15 character names (they can be longer but usually aren't) else - xmin = (vid_conwidth.integer - (16 + 25) * 8 * FONT_SBAR->maxwidth) / 2; // 16 characters until name, then we assume 25 character names (they can be longer but usually aren't) + xmin = (int) (vid_conwidth.integer - (16 + 25) * 8 * FONT_SBAR->maxwidth) / 2; // 16 characters until name, then we assume 25 character names (they can be longer but usually aren't) xmax = vid_conwidth.integer - xmin; if(gamemode == GAME_NEXUIZ) @@ -1827,7 +1827,7 @@ void Sbar_MiniDeathmatchOverlay (int x, int y) return; // adjust the given y if sbar_miniscoreboard_size doesn't indicate default (< 0) if(sbar_miniscoreboard_size.value > 0) - y = vid_conheight.integer - sbar_miniscoreboard_size.value * 8; + y = (int) (vid_conheight.integer - sbar_miniscoreboard_size.value * 8); // scores Sbar_SortFrags (); @@ -1932,7 +1932,7 @@ void Sbar_Score (int margin) int sbar_y_save = sbar_y; - sbar_y = vid_conheight.value - (32+12); + sbar_y = (int) (vid_conheight.value - (32+12)); sbar_x -= margin; me = cl.playerentity - 1; diff --git a/snd_mem.c b/snd_mem.c index 2678da63..1c859515 100644 --- a/snd_mem.c +++ b/snd_mem.c @@ -59,12 +59,12 @@ snd_ringbuffer_t *Snd_CreateRingBuffer (const snd_format_t* format, unsigned int maxframes = sampleframes; memsize = maxframes * format->width * format->channels; - ringbuffer->ring = Mem_Alloc(snd_mempool, memsize); + ringbuffer->ring = (unsigned char *) Mem_Alloc(snd_mempool, memsize); ringbuffer->maxframes = maxframes; } else { - ringbuffer->ring = buffer; + ringbuffer->ring = (unsigned char *) buffer; ringbuffer->maxframes = sampleframes; } @@ -82,7 +82,7 @@ snd_buffer_t *Snd_CreateSndBuffer (const unsigned char *samples, unsigned int sa size_t newsampleframes, memsize; snd_buffer_t* sb; - newsampleframes = (double)sampleframes * (double)sb_speed / (double)in_format->speed; + newsampleframes = (size_t) ((double)sampleframes * (double)sb_speed / (double)in_format->speed); memsize = newsampleframes * in_format->channels * in_format->width; memsize += sizeof (*sb) - sizeof (sb->samples); @@ -124,7 +124,7 @@ qboolean Snd_AppendToSndBuffer (snd_buffer_t* sb, const unsigned char *samples, return false; } - outcount = (double)sampleframes * (double)sb->format.speed / (double)format->speed; + outcount = (size_t) ((double)sampleframes * (double)sb->format.speed / (double)format->speed); // If the sound buffer is too short if (outcount > sb->maxframes - sb->nbframes) diff --git a/snd_mix.c b/snd_mix.c index 2fa5878e..e0c127bd 100644 --- a/snd_mix.c +++ b/snd_mix.c @@ -455,7 +455,7 @@ void S_MixToBuffer(void *stream, unsigned int bufferframes) unsigned int i; channel_t *ch; unsigned int frames; - unsigned char *outbytes = stream; + unsigned char *outbytes = (unsigned char *) stream; // mix as many times as needed to fill the requested buffer while (bufferframes) diff --git a/snd_modplug.c b/snd_modplug.c index 44903fd7..54a07909 100644 --- a/snd_modplug.c +++ b/snd_modplug.c @@ -96,7 +96,8 @@ static int (*ModPlug_Read) (ModPlugFile* file, void* buffer, int size); static void (*ModPlug_Seek) (ModPlugFile* file, int millisecond); static void (*ModPlug_GetSettings) (ModPlug_Settings* settings); static void (*ModPlug_SetSettings) (const ModPlug_Settings* settings); -static void (*ModPlug_SetMasterVolume) (ModPlugFile* file,unsigned int cvol) ; +typedef void (ModPlug_SetMasterVolume_t) (ModPlugFile* file,unsigned int cvol) ; +ModPlug_SetMasterVolume_t *ModPlug_SetMasterVolume; static dllfunction_t modplugfuncs[] = @@ -159,7 +160,7 @@ qboolean ModPlug_OpenLibrary (void) // the modplug DLL automatically when loading the modplugFile DLL if(Sys_LoadLibrary (dllnames_modplug, &modplug_dll, modplugfuncs)) { - ModPlug_SetMasterVolume = Sys_GetProcAddress(modplug_dll, "ModPlug_SetMasterVolume"); + ModPlug_SetMasterVolume = (ModPlug_SetMasterVolume_t *) Sys_GetProcAddress(modplug_dll, "ModPlug_SetMasterVolume"); if(!ModPlug_SetMasterVolume) Con_Print("Warning: modplug volume control not supported. Try getting a newer version of libmodplug.\n"); return true; @@ -317,7 +318,7 @@ static const snd_buffer_t* ModPlug_FetchSound (void *sfxfetcher, void **chfetche ModPlug_Seek(per_ch->mf, modplug_start); sb->nbframes = 0; - real_start = (float)modplug_start / 1000 * snd_renderbuffer->format.speed; + real_start = (unsigned int) ((float)modplug_start / 1000 * snd_renderbuffer->format.speed); if (*start - real_start + nbsampleframes > sb->maxframes) { Con_Printf ("ModPlug_FetchSound: stream buffer too small after seek (%u sample frames required)\n", diff --git a/snd_ogg.c b/snd_ogg.c index 4c210d21..24752730 100644 --- a/snd_ogg.c +++ b/snd_ogg.c @@ -505,7 +505,7 @@ static const snd_buffer_t* OGG_FetchSound (void *sfxfetcher, void **chfetcherpoi } sb->nbframes = 0; - real_start = (float)ogg_start / per_sfx->format.speed * snd_renderbuffer->format.speed; + real_start = (unsigned int) ((float)ogg_start / per_sfx->format.speed * snd_renderbuffer->format.speed); if (*start - real_start + nbsampleframes > sb->maxframes) { Con_Printf ("OGG_FetchSound: stream buffer too small after seek (%u sample frames required)\n", @@ -645,11 +645,11 @@ static void OGG_DecodeTags(vorbis_comment *vc, unsigned int *start, unsigned int if(startcomment) { - *start = bound(0, atof(startcomment) * samplesfactor, numsamples); + *start = (unsigned int) bound(0, atof(startcomment) * samplesfactor, numsamples); if(endcomment) - *length = bound(0, atof(endcomment) * samplesfactor, numsamples); + *length = (unsigned int) bound(0, atof(endcomment) * samplesfactor, numsamples); else if(lengthcomment) - *length = bound(0, *start + atof(lengthcomment) * samplesfactor, numsamples); + *length = (unsigned int) bound(0, *start + atof(lengthcomment) * samplesfactor, numsamples); } } diff --git a/snd_wav.c b/snd_wav.c index d643ae19..9ca7fa95 100644 --- a/snd_wav.c +++ b/snd_wav.c @@ -330,7 +330,7 @@ qboolean S_LoadWavFile (const char *filename, sfx_t *sfx) if (info.loopstart < 0) sfx->loopstart = sfx->total_length; else - sfx->loopstart = (double)info.loopstart * (double)sb->format.speed / (double)info.rate; + sfx->loopstart = (unsigned int) ((double)info.loopstart * (double)sb->format.speed / (double)info.rate); sfx->loopstart = min(sfx->loopstart, sfx->total_length); sfx->flags &= ~SFXFLAG_STREAMED; diff --git a/sv_main.c b/sv_main.c index 36f25a63..75d43359 100644 --- a/sv_main.c +++ b/sv_main.c @@ -792,7 +792,7 @@ void SV_SendServerinfo (client_t *client) char buf[NET_MAXMESSAGE]; sizebuf_t sb; - sb.data = (void *) buf; + sb.data = (unsigned char *) buf; sb.maxsize = sizeof(buf); i = 0; while(MakeDownloadPacket(sv.csqc_progname, sv.csqc_progdata, sv.csqc_progsize, sv.csqc_progcrc, i++, &sb, sv.protocol)) @@ -1608,8 +1608,8 @@ void SV_WriteClientdataToMessage (client_t *client, prvm_edict_t *ent, sizebuf_t stats[STAT_CELLS] = (int)ent->fields.server->ammo_cells; stats[STAT_ACTIVEWEAPON] = (int)ent->fields.server->weapon; stats[STAT_VIEWZOOM] = viewzoom; - stats[STAT_TOTALSECRETS] = prog->globals.server->total_secrets; - stats[STAT_TOTALMONSTERS] = prog->globals.server->total_monsters; + stats[STAT_TOTALSECRETS] = (int)prog->globals.server->total_secrets; + stats[STAT_TOTALMONSTERS] = (int)prog->globals.server->total_monsters; // the QC bumps these itself by sending svc_'s, so we have to keep them // zero or they'll be corrected by the engine //stats[STAT_SECRETS] = prog->globals.server->found_secrets; @@ -3105,7 +3105,6 @@ static qboolean SV_VM_CB_LoadEdict(prvm_edict_t *ent) static void SV_VM_Setup(void) { - extern cvar_t csqc_progname; //[515]: csqc crc check and right csprogs name according to progs.dat PRVM_Begin; PRVM_InitProg( PRVM_SERVERPROG ); diff --git a/sv_phys.c b/sv_phys.c index bcd461dc..886d640b 100644 --- a/sv_phys.c +++ b/sv_phys.c @@ -225,9 +225,9 @@ trace_t SV_Move(const vec3_t start, const vec3_t mins, const vec3_t maxs, const Matrix4x4_CreateTranslate(&matrix, touch->fields.server->origin[0], touch->fields.server->origin[1], touch->fields.server->origin[2]); Matrix4x4_Invert_Simple(&imatrix, &matrix); if ((int)touch->fields.server->flags & FL_MONSTER) - Collision_ClipToGenericEntity(&trace, model, touch->fields.server->frame, touch->fields.server->mins, touch->fields.server->maxs, bodysupercontents, &matrix, &imatrix, clipstart, clipmins2, clipmaxs2, clipend, hitsupercontentsmask); + Collision_ClipToGenericEntity(&trace, model, (int) touch->fields.server->frame, touch->fields.server->mins, touch->fields.server->maxs, bodysupercontents, &matrix, &imatrix, clipstart, clipmins2, clipmaxs2, clipend, hitsupercontentsmask); else - Collision_ClipToGenericEntity(&trace, model, touch->fields.server->frame, touch->fields.server->mins, touch->fields.server->maxs, bodysupercontents, &matrix, &imatrix, clipstart, clipmins, clipmaxs, clipend, hitsupercontentsmask); + Collision_ClipToGenericEntity(&trace, model, (int) touch->fields.server->frame, touch->fields.server->mins, touch->fields.server->maxs, bodysupercontents, &matrix, &imatrix, clipstart, clipmins, clipmaxs, clipend, hitsupercontentsmask); Collision_CombineTraces(&cliptrace, &trace, (void *)touch, touch->fields.server->solid == SOLID_BSP); } @@ -1215,7 +1215,7 @@ void SV_PushMove (prvm_edict_t *pusher, float movetime) // final position, move it if (!((int)check->fields.server->flags & FL_ONGROUND) || PRVM_PROG_TO_EDICT(check->fields.server->groundentity) != pusher) { - Collision_ClipToGenericEntity(&trace, pushermodel, pusher->fields.server->frame, pusher->fields.server->mins, pusher->fields.server->maxs, SUPERCONTENTS_BODY, &pusherfinalmatrix, &pusherfinalimatrix, check->fields.server->origin, check->fields.server->mins, check->fields.server->maxs, check->fields.server->origin, checkcontents); + Collision_ClipToGenericEntity(&trace, pushermodel, (int) pusher->fields.server->frame, pusher->fields.server->mins, pusher->fields.server->maxs, SUPERCONTENTS_BODY, &pusherfinalmatrix, &pusherfinalimatrix, check->fields.server->origin, check->fields.server->mins, check->fields.server->maxs, check->fields.server->origin, checkcontents); //trace = SV_Move(check->fields.server->origin, check->fields.server->mins, check->fields.server->maxs, check->fields.server->origin, MOVE_NOMONSTERS, check, checkcontents); if (!trace.startsolid) { @@ -1258,7 +1258,7 @@ void SV_PushMove (prvm_edict_t *pusher, float movetime) check->fields.server->flags = (int)check->fields.server->flags & ~FL_ONGROUND; // if it is still inside the pusher, block - Collision_ClipToGenericEntity(&trace, pushermodel, pusher->fields.server->frame, pusher->fields.server->mins, pusher->fields.server->maxs, SUPERCONTENTS_BODY, &pusherfinalmatrix, &pusherfinalimatrix, check->fields.server->origin, check->fields.server->mins, check->fields.server->maxs, check->fields.server->origin, checkcontents); + Collision_ClipToGenericEntity(&trace, pushermodel, (int) pusher->fields.server->frame, pusher->fields.server->mins, pusher->fields.server->maxs, SUPERCONTENTS_BODY, &pusherfinalmatrix, &pusherfinalimatrix, check->fields.server->origin, check->fields.server->mins, check->fields.server->maxs, check->fields.server->origin, checkcontents); if (trace.startsolid) { // try moving the contacted entity a tiny bit further to account for precision errors @@ -1269,7 +1269,7 @@ void SV_PushMove (prvm_edict_t *pusher, float movetime) VectorCopy (check->priv.server->moved_fromangles, check->fields.server->angles); SV_PushEntity (check, move2, true); pusher->fields.server->solid = savesolid; - Collision_ClipToGenericEntity(&trace, pushermodel, pusher->fields.server->frame, pusher->fields.server->mins, pusher->fields.server->maxs, SUPERCONTENTS_BODY, &pusherfinalmatrix, &pusherfinalimatrix, check->fields.server->origin, check->fields.server->mins, check->fields.server->maxs, check->fields.server->origin, checkcontents); + Collision_ClipToGenericEntity(&trace, pushermodel, (int) pusher->fields.server->frame, pusher->fields.server->mins, pusher->fields.server->maxs, SUPERCONTENTS_BODY, &pusherfinalmatrix, &pusherfinalimatrix, check->fields.server->origin, check->fields.server->mins, check->fields.server->maxs, check->fields.server->origin, checkcontents); if (trace.startsolid) { // try moving the contacted entity a tiny bit less to account for precision errors @@ -1279,7 +1279,7 @@ void SV_PushMove (prvm_edict_t *pusher, float movetime) VectorCopy (check->priv.server->moved_fromangles, check->fields.server->angles); SV_PushEntity (check, move2, true); pusher->fields.server->solid = savesolid; - Collision_ClipToGenericEntity(&trace, pushermodel, pusher->fields.server->frame, pusher->fields.server->mins, pusher->fields.server->maxs, SUPERCONTENTS_BODY, &pusherfinalmatrix, &pusherfinalimatrix, check->fields.server->origin, check->fields.server->mins, check->fields.server->maxs, check->fields.server->origin, checkcontents); + Collision_ClipToGenericEntity(&trace, pushermodel, (int) pusher->fields.server->frame, pusher->fields.server->mins, pusher->fields.server->maxs, SUPERCONTENTS_BODY, &pusherfinalmatrix, &pusherfinalimatrix, check->fields.server->origin, check->fields.server->mins, check->fields.server->maxs, check->fields.server->origin, checkcontents); if (trace.startsolid) { // still inside pusher, so it's really blocked diff --git a/sv_user.c b/sv_user.c index 882418c6..ffa9c399 100644 --- a/sv_user.c +++ b/sv_user.c @@ -854,7 +854,7 @@ clc_stringcmd_invalid: int crc; unsigned char *temp; FS_Seek(host_client->download_file, 0, SEEK_SET); - temp = Mem_Alloc(tempmempool, size); + temp = (unsigned char *) Mem_Alloc(tempmempool, size); FS_Read(host_client->download_file, temp, size); crc = CRC_Block(temp, size); Mem_Free(temp); diff --git a/svvm_cmds.c b/svvm_cmds.c index 3fcba476..b7de9977 100644 --- a/svvm_cmds.c +++ b/svvm_cmds.c @@ -1321,7 +1321,7 @@ static void VM_SV_WritePicture (void) VM_SAFEPARMCOUNT(3, VM_SV_WritePicture); imgname = PRVM_G_STRING(OFS_PARM1); - size = PRVM_G_FLOAT(OFS_PARM2); + size = (int) PRVM_G_FLOAT(OFS_PARM2); if(size > 65535) size = 65535; @@ -1330,7 +1330,7 @@ static void VM_SV_WritePicture (void) { // actual picture MSG_WriteShort(WriteDest(), size); - SZ_Write(WriteDest(), buf, size); + SZ_Write(WriteDest(), (unsigned char *) buf, size); } else { diff --git a/sys_shared.c b/sys_shared.c index 91f72d41..683fe0b1 100644 --- a/sys_shared.c +++ b/sys_shared.c @@ -31,10 +31,16 @@ void Sys_Quit (int returnvalue) exit(returnvalue); } +#if defined(__linux__) || defined(__FreeBSD__) +#ifdef __cplusplus +extern "C" +#endif +int moncontrol(int); +#endif + void Sys_AllowProfiling(qboolean enable) { #if defined(__linux__) || defined(__FreeBSD__) -int moncontrol(int); moncontrol(enable); #endif } diff --git a/wad.c b/wad.c index b73717e2..a07f87bb 100644 --- a/wad.c +++ b/wad.c @@ -95,7 +95,7 @@ void W_UnloadAll(void) // close all hlwad files and free their lumps data for (i = 0;i < Mem_ExpandableArray_IndexRange(&wad.hlwads);i++) { - w = Mem_ExpandableArray_RecordAtIndex(&wad.hlwads, i); + w = (mwad_t *) Mem_ExpandableArray_RecordAtIndex(&wad.hlwads, i); if (!w) continue; if (w->file) @@ -187,10 +187,10 @@ void W_LoadTextureWadFile (char *filename, int complain) if (!wad.hlwads.mempool) Mem_ExpandableArray_NewArray(&wad.hlwads, cls.permanentmempool, sizeof(mwad_t), 16); - w = Mem_ExpandableArray_AllocRecord(&wad.hlwads); + w = (mwad_t *) Mem_ExpandableArray_AllocRecord(&wad.hlwads); w->file = file; w->numlumps = numlumps; - w->lumps = Mem_Alloc(cls.permanentmempool, w->numlumps * sizeof(lumpinfo_t)); + w->lumps = (lumpinfo_t *) Mem_Alloc(cls.permanentmempool, w->numlumps * sizeof(lumpinfo_t)); if (!w->lumps) { diff --git a/zone.c b/zone.c index 0895f522..417a290a 100644 --- a/zone.c +++ b/zone.c @@ -411,7 +411,7 @@ void *Mem_ExpandableArray_AllocRecord(memexpandablearray_t *l) { memexpandablearray_array_t *oldarrays = l->arrays; l->maxarrays = max(l->maxarrays * 2, 128); - l->arrays = Mem_Alloc(l->mempool, l->maxarrays * sizeof(*l->arrays)); + l->arrays = (memexpandablearray_array_t*) Mem_Alloc(l->mempool, l->maxarrays * sizeof(*l->arrays)); if (oldarrays) { memcpy(l->arrays, oldarrays, l->numarrays * sizeof(*l->arrays)); @@ -419,7 +419,7 @@ void *Mem_ExpandableArray_AllocRecord(memexpandablearray_t *l) } } l->arrays[i].numflaggedrecords = 0; - l->arrays[i].data = Mem_Alloc(l->mempool, (l->recordsize + 1) * l->numrecordsperarray); + l->arrays[i].data = (unsigned char *) Mem_Alloc(l->mempool, (l->recordsize + 1) * l->numrecordsperarray); l->arrays[i].allocflags = l->arrays[i].data + l->recordsize * l->numrecordsperarray; l->numarrays++; }