From: havoc Date: Fri, 2 Jul 2010 02:24:32 +0000 (+0000) Subject: fix a bunch of warnings if compiling darkplaces as C++ in MSVC2008 X-Git-Tag: xonotic-v0.1.0preview~230^2~216 X-Git-Url: http://de.git.xonotic.org/?p=xonotic%2Fdarkplaces.git;a=commitdiff_plain;h=861c406b589acf1252ddc231e02f94557a15e2bc fix a bunch of warnings if compiling darkplaces as C++ in MSVC2008 git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@10262 d7cf8633-e32d-0410-b094-e92efae38249 --- diff --git a/cl_main.c b/cl_main.c index dba40bc5..6ca122d1 100644 --- a/cl_main.c +++ b/cl_main.c @@ -122,7 +122,7 @@ void CL_ClearState(void) cl.sensitivityscale = 1.0f; // enable rendering of the world and such - cl.csqc_vidvars.drawworld = r_drawworld.integer; + cl.csqc_vidvars.drawworld = r_drawworld.integer != 0; cl.csqc_vidvars.drawenginesbar = true; cl.csqc_vidvars.drawcrosshair = true; diff --git a/cl_particles.c b/cl_particles.c index c6ae068d..dc181b09 100644 --- a/cl_particles.c +++ b/cl_particles.c @@ -1941,7 +1941,7 @@ static void R_InitBloodTextures (unsigned char *particletexturedata) { int i, j, k, m; size_t datasize = PARTICLETEXTURESIZE*PARTICLETEXTURESIZE*4; - unsigned char *data = Mem_Alloc(tempmempool, datasize); + unsigned char *data = (unsigned char *)Mem_Alloc(tempmempool, datasize); // blood particles for (i = 0;i < 8;i++) @@ -2157,7 +2157,7 @@ static void R_InitParticleTexture (void) } #ifndef DUMPPARTICLEFONT - particletexture[tex_beam].texture = loadtextureimage(particletexturepool, "particles/nexbeam.tga", false, TEXF_ALPHA | TEXF_FORCELINEAR, true, r_texture_convertsRGB_particles.integer); + particletexture[tex_beam].texture = loadtextureimage(particletexturepool, "particles/nexbeam.tga", false, TEXF_ALPHA | TEXF_FORCELINEAR, true, r_texture_convertsRGB_particles.integer != 0); if (!particletexture[tex_beam].texture) #endif { diff --git a/cl_screen.c b/cl_screen.c index 895f5164..2a9df116 100644 --- a/cl_screen.c +++ b/cl_screen.c @@ -1006,14 +1006,14 @@ void SCR_ScreenShot_f (void) buffer1 = (unsigned char *)Mem_Alloc(tempmempool, vid.width * vid.height * 4); buffer2 = (unsigned char *)Mem_Alloc(tempmempool, vid.width * vid.height * (scr_screenshot_alpha.integer ? 4 : 3)); - if (SCR_ScreenShot (filename, buffer1, buffer2, 0, 0, vid.width, vid.height, false, false, false, jpeg, png, true, scr_screenshot_alpha.integer)) + if (SCR_ScreenShot (filename, buffer1, buffer2, 0, 0, vid.width, vid.height, false, false, false, jpeg, png, true, scr_screenshot_alpha.integer != 0)) Con_Printf("Wrote %s\n", filename); else { Con_Printf("Unable to write %s\n", filename); if(jpeg || png) { - if(SCR_ScreenShot (filename, buffer1, buffer2, 0, 0, vid.width, vid.height, false, false, false, false, false, true, scr_screenshot_alpha.integer)) + if(SCR_ScreenShot (filename, buffer1, buffer2, 0, 0, vid.width, vid.height, false, false, false, false, false, true, scr_screenshot_alpha.integer != 0)) { strlcpy(filename + strlen(filename) - 3, "tga", 4); Con_Printf("Wrote %s\n", filename); diff --git a/clvm_cmds.c b/clvm_cmds.c index befe553b..cd2588ed 100644 --- a/clvm_cmds.c +++ b/clvm_cmds.c @@ -723,7 +723,7 @@ void VM_CL_R_ClearScene (void) r_refdef.view.isoverlay = false; // FIXME: restore cl.csqc_origin // FIXME: restore cl.csqc_angles - cl.csqc_vidvars.drawworld = r_drawworld.integer; + cl.csqc_vidvars.drawworld = r_drawworld.integer != 0; cl.csqc_vidvars.drawenginesbar = false; cl.csqc_vidvars.drawcrosshair = false; } @@ -2612,8 +2612,8 @@ void VM_CL_ParticleThemeToGlobals(vmparticletheme_t *theme) void VM_CL_ParticleThemeFromGlobals(vmparticletheme_t *theme) { theme->typeindex = (unsigned short)*vmpartspawner.particle_type; - theme->blendmode = (pblend_t)*vmpartspawner.particle_blendmode; - theme->orientation = (porientation_t)*vmpartspawner.particle_orientation; + theme->blendmode = (pblend_t)(int)*vmpartspawner.particle_blendmode; + theme->orientation = (porientation_t)(int)*vmpartspawner.particle_orientation; theme->color1 = ((int)vmpartspawner.particle_color1[0] << 16) + ((int)vmpartspawner.particle_color1[1] << 8) + ((int)vmpartspawner.particle_color1[2]); theme->color2 = ((int)vmpartspawner.particle_color2[0] << 16) + ((int)vmpartspawner.particle_color2[1] << 8) + ((int)vmpartspawner.particle_color2[2]); theme->tex = (int)*vmpartspawner.particle_tex; @@ -2785,7 +2785,7 @@ void VM_CL_SpawnParticle (void) if (prog->argc < 3) // global-set particle { - part = CL_NewParticle(org, (unsigned short)*vmpartspawner.particle_type, ((int)(vmpartspawner.particle_color1[0]) << 16) + ((int)(vmpartspawner.particle_color1[1]) << 8) + ((int)(vmpartspawner.particle_color1[2])), ((int)vmpartspawner.particle_color2[0] << 16) + ((int)vmpartspawner.particle_color2[1] << 8) + ((int)vmpartspawner.particle_color2[2]), (int)*vmpartspawner.particle_tex, *vmpartspawner.particle_size, *vmpartspawner.particle_sizeincrease, *vmpartspawner.particle_alpha*256, *vmpartspawner.particle_alphafade*256, *vmpartspawner.particle_gravity, *vmpartspawner.particle_bounce, org[0], org[1], org[2], dir[0], dir[1], dir[2], *vmpartspawner.particle_airfriction, *vmpartspawner.particle_liquidfriction, *vmpartspawner.particle_originjitter, *vmpartspawner.particle_velocityjitter, (*vmpartspawner.particle_qualityreduction) ? true : false, *vmpartspawner.particle_time, *vmpartspawner.particle_stretch, (pblend_t)*vmpartspawner.particle_blendmode, (porientation_t)*vmpartspawner.particle_orientation, (int)(vmpartspawner.particle_staincolor1[0])*65536 + (int)(vmpartspawner.particle_staincolor1[1])*256 + (int)(vmpartspawner.particle_staincolor1[2]), (int)(vmpartspawner.particle_staincolor2[0])*65536 + (int)(vmpartspawner.particle_staincolor2[1])*256 + (int)(vmpartspawner.particle_staincolor2[2]), (int)*vmpartspawner.particle_staintex, *vmpartspawner.particle_stainalpha*256, *vmpartspawner.particle_stainsize, *vmpartspawner.particle_angle, *vmpartspawner.particle_spin, NULL); + part = CL_NewParticle(org, (unsigned short)*vmpartspawner.particle_type, ((int)(vmpartspawner.particle_color1[0]) << 16) + ((int)(vmpartspawner.particle_color1[1]) << 8) + ((int)(vmpartspawner.particle_color1[2])), ((int)vmpartspawner.particle_color2[0] << 16) + ((int)vmpartspawner.particle_color2[1] << 8) + ((int)vmpartspawner.particle_color2[2]), (int)*vmpartspawner.particle_tex, *vmpartspawner.particle_size, *vmpartspawner.particle_sizeincrease, *vmpartspawner.particle_alpha*256, *vmpartspawner.particle_alphafade*256, *vmpartspawner.particle_gravity, *vmpartspawner.particle_bounce, org[0], org[1], org[2], dir[0], dir[1], dir[2], *vmpartspawner.particle_airfriction, *vmpartspawner.particle_liquidfriction, *vmpartspawner.particle_originjitter, *vmpartspawner.particle_velocityjitter, (*vmpartspawner.particle_qualityreduction) ? true : false, *vmpartspawner.particle_time, *vmpartspawner.particle_stretch, (pblend_t)(int)*vmpartspawner.particle_blendmode, (porientation_t)(int)*vmpartspawner.particle_orientation, (int)(vmpartspawner.particle_staincolor1[0])*65536 + (int)(vmpartspawner.particle_staincolor1[1])*256 + (int)(vmpartspawner.particle_staincolor1[2]), (int)(vmpartspawner.particle_staincolor2[0])*65536 + (int)(vmpartspawner.particle_staincolor2[1])*256 + (int)(vmpartspawner.particle_staincolor2[2]), (int)*vmpartspawner.particle_staintex, *vmpartspawner.particle_stainalpha*256, *vmpartspawner.particle_stainsize, *vmpartspawner.particle_angle, *vmpartspawner.particle_spin, NULL); if (!part) { PRVM_G_FLOAT(OFS_RETURN) = 0; @@ -2839,7 +2839,7 @@ void VM_CL_SpawnParticleDelayed (void) org = PRVM_G_VECTOR(OFS_PARM0); dir = PRVM_G_VECTOR(OFS_PARM1); if (prog->argc < 5) // global-set particle - part = CL_NewParticle(org, (unsigned short)*vmpartspawner.particle_type, ((int)vmpartspawner.particle_color1[0] << 16) + ((int)vmpartspawner.particle_color1[1] << 8) + ((int)vmpartspawner.particle_color1[2]), ((int)vmpartspawner.particle_color2[0] << 16) + ((int)vmpartspawner.particle_color2[1] << 8) + ((int)vmpartspawner.particle_color2[2]), (int)*vmpartspawner.particle_tex, *vmpartspawner.particle_size, *vmpartspawner.particle_sizeincrease, *vmpartspawner.particle_alpha*256, *vmpartspawner.particle_alphafade*256, *vmpartspawner.particle_gravity, *vmpartspawner.particle_bounce, org[0], org[1], org[2], dir[0], dir[1], dir[2], *vmpartspawner.particle_airfriction, *vmpartspawner.particle_liquidfriction, *vmpartspawner.particle_originjitter, *vmpartspawner.particle_velocityjitter, (*vmpartspawner.particle_qualityreduction) ? true : false, *vmpartspawner.particle_time, *vmpartspawner.particle_stretch, (pblend_t)*vmpartspawner.particle_blendmode, (porientation_t)*vmpartspawner.particle_orientation, ((int)vmpartspawner.particle_staincolor1[0] << 16) + ((int)vmpartspawner.particle_staincolor1[1] << 8) + ((int)vmpartspawner.particle_staincolor1[2]), ((int)vmpartspawner.particle_staincolor2[0] << 16) + ((int)vmpartspawner.particle_staincolor2[1] << 8) + ((int)vmpartspawner.particle_staincolor2[2]), (int)*vmpartspawner.particle_staintex, *vmpartspawner.particle_stainalpha*256, *vmpartspawner.particle_stainsize, *vmpartspawner.particle_angle, *vmpartspawner.particle_spin, NULL); + part = CL_NewParticle(org, (unsigned short)*vmpartspawner.particle_type, ((int)vmpartspawner.particle_color1[0] << 16) + ((int)vmpartspawner.particle_color1[1] << 8) + ((int)vmpartspawner.particle_color1[2]), ((int)vmpartspawner.particle_color2[0] << 16) + ((int)vmpartspawner.particle_color2[1] << 8) + ((int)vmpartspawner.particle_color2[2]), (int)*vmpartspawner.particle_tex, *vmpartspawner.particle_size, *vmpartspawner.particle_sizeincrease, *vmpartspawner.particle_alpha*256, *vmpartspawner.particle_alphafade*256, *vmpartspawner.particle_gravity, *vmpartspawner.particle_bounce, org[0], org[1], org[2], dir[0], dir[1], dir[2], *vmpartspawner.particle_airfriction, *vmpartspawner.particle_liquidfriction, *vmpartspawner.particle_originjitter, *vmpartspawner.particle_velocityjitter, (*vmpartspawner.particle_qualityreduction) ? true : false, *vmpartspawner.particle_time, *vmpartspawner.particle_stretch, (pblend_t)(int)*vmpartspawner.particle_blendmode, (porientation_t)(int)*vmpartspawner.particle_orientation, ((int)vmpartspawner.particle_staincolor1[0] << 16) + ((int)vmpartspawner.particle_staincolor1[1] << 8) + ((int)vmpartspawner.particle_staincolor1[2]), ((int)vmpartspawner.particle_staincolor2[0] << 16) + ((int)vmpartspawner.particle_staincolor2[1] << 8) + ((int)vmpartspawner.particle_staincolor2[2]), (int)*vmpartspawner.particle_staintex, *vmpartspawner.particle_stainalpha*256, *vmpartspawner.particle_stainsize, *vmpartspawner.particle_angle, *vmpartspawner.particle_spin, NULL); else // themed particle { themenum = (int)PRVM_G_FLOAT(OFS_PARM4); @@ -3677,7 +3677,7 @@ static void VM_CL_skel_create(void) break; if (i == MAX_EDICTS) return; - prog->skeletons[i] = skeleton = Mem_Alloc(cls.levelmempool, sizeof(skeleton_t) + model->num_bones * sizeof(matrix4x4_t)); + prog->skeletons[i] = skeleton = (skeleton_t *)Mem_Alloc(cls.levelmempool, sizeof(skeleton_t) + model->num_bones * sizeof(matrix4x4_t)); PRVM_G_FLOAT(OFS_RETURN) = i + 1; skeleton->model = model; skeleton->relativetransforms = (matrix4x4_t *)(skeleton+1); diff --git a/fs.c b/fs.c index a2f057c9..e7a5f536 100644 --- a/fs.c +++ b/fs.c @@ -1283,7 +1283,7 @@ static void FS_AddSelfPack(void) if(fs_selfpack) { searchpath_t *search; - search = Mem_Alloc(fs_mempool, sizeof(searchpath_t)); + search = (searchpath_t *)Mem_Alloc(fs_mempool, sizeof(searchpath_t)); search->next = fs_searchpaths; search->pack = fs_selfpack; fs_searchpaths = search; diff --git a/ft2.c b/ft2.c index a2a97643..7a8b826a 100644 --- a/ft2.c +++ b/ft2.c @@ -290,7 +290,7 @@ ft2_font_t *Font_Alloc(void) { if (!ft2_dll) return NULL; - return Mem_Alloc(font_mempool, sizeof(ft2_font_t)); + return (ft2_font_t *)Mem_Alloc(font_mempool, sizeof(ft2_font_t)); } qboolean Font_Attach(ft2_font_t *font, ft2_attachment_t *attachment) @@ -527,7 +527,7 @@ static qboolean Font_LoadFile(const char *name, int _face, ft2_settings_t *setti args.flags = FT_OPEN_MEMORY; args.memory_base = (const FT_Byte*)font->attachments[i].data; args.memory_size = font->attachments[i].size; - if (qFT_Attach_Stream(font->face, &args)) + if (qFT_Attach_Stream((FT_Face)font->face, &args)) Con_Printf("Failed to add attachment %u to %s\n", (unsigned)i, font->name); } @@ -586,7 +586,7 @@ void Font_Postprocess_Update(ft2_font_t *fnt, int bpp, int w, int h) if(pp.buf) Mem_Free(pp.buf); pp.bufsize = needed * 4; - pp.buf = Mem_Alloc(font_mempool, pp.bufsize); + pp.buf = (unsigned char *)Mem_Alloc(font_mempool, pp.bufsize); pp.buf2 = pp.buf + needed; } } @@ -773,9 +773,9 @@ static qboolean Font_LoadSize(ft2_font_t *font, float size, qboolean check_only) for (r = 0; r < 256; ++r) { FT_ULong ul, ur; - ul = qFT_Get_Char_Index(font->face, l); - ur = qFT_Get_Char_Index(font->face, r); - if (qFT_Get_Kerning(font->face, ul, ur, FT_KERNING_DEFAULT, &kernvec)) + ul = qFT_Get_Char_Index((FT_Face)font->face, l); + ur = qFT_Get_Char_Index((FT_Face)font->face, r); + if (qFT_Get_Kerning((FT_Face)font->face, ul, ur, FT_KERNING_DEFAULT, &kernvec)) { fmap->kerning.kerning[l][r][0] = 0; fmap->kerning.kerning[l][r][1] = 0; @@ -923,9 +923,9 @@ qboolean Font_GetKerningForMap(ft2_font_t *font, int map_index, float w, float h Con_Printf("Failed to get kerning for %s\n", font->name); return false; } - ul = qFT_Get_Char_Index(font->face, left); - ur = qFT_Get_Char_Index(font->face, right); - if (qFT_Get_Kerning(font->face, ul, ur, FT_KERNING_DEFAULT, &kernvec)) + ul = qFT_Get_Char_Index((FT_Face)font->face, left); + ur = qFT_Get_Char_Index((FT_Face)font->face, right); + if (qFT_Get_Kerning((FT_Face)font->face, ul, ur, FT_KERNING_DEFAULT, &kernvec)) { if (outx) *outx = Font_SnapTo(kernvec.x * fmap->sfx, 1 / fmap->size);// * (w / (float)fmap->size); if (outy) *outy = Font_SnapTo(kernvec.y * fmap->sfy, 1 / fmap->size);// * (h / (float)fmap->size); @@ -1107,7 +1107,7 @@ static qboolean Font_LoadMap(ft2_font_t *font, ft2_font_map_t *mapstart, Uchar _ return false; } - map = Mem_Alloc(font_mempool, sizeof(ft2_font_map_t)); + map = (ft2_font_map_t *)Mem_Alloc(font_mempool, sizeof(ft2_font_map_t)); if (!map) { Con_Printf("ERROR: Out of memory when loading fontmap for %s\n", font->name); @@ -1124,7 +1124,7 @@ static qboolean Font_LoadMap(ft2_font_t *font, ft2_font_map_t *mapstart, Uchar _ map->sfy = mapstart->sfy; pitch = map->glyphSize * FONT_CHARS_PER_LINE * bytesPerPixel; - data = Mem_Alloc(font_mempool, (FONT_CHAR_LINES * map->glyphSize) * pitch); + data = (unsigned char *)Mem_Alloc(font_mempool, (FONT_CHAR_LINES * map->glyphSize) * pitch); if (!data) { Con_Printf("ERROR: Failed to allocate memory for font %s size %g\n", font->name, map->size); @@ -1185,7 +1185,7 @@ static qboolean Font_LoadMap(ft2_font_t *font, ft2_font_map_t *mapstart, Uchar _ imagedata += gpad_t * pitch + gpad_l * bytesPerPixel; //status = qFT_Load_Char(face, ch, FT_LOAD_RENDER); // we need the glyphIndex - face = font->face; + face = (FT_Face)font->face; usefont = NULL; if (font->image_font && mapch == ch && img_fontmap[mapch]) { @@ -1202,7 +1202,7 @@ static qboolean Font_LoadMap(ft2_font_t *font, ft2_font_map_t *mapstart, Uchar _ if (!Font_SetSize(usefont, mapstart->intSize, mapstart->intSize)) continue; // try that glyph - face = usefont->face; + face = (FT_Face)usefont->face; glyphIndex = qFT_Get_Char_Index(face, ch); if (glyphIndex == 0) continue; @@ -1215,7 +1215,7 @@ static qboolean Font_LoadMap(ft2_font_t *font, ft2_font_map_t *mapstart, Uchar _ { //Con_Printf("failed to load fallback glyph for char %lx from font %s\n", (unsigned long)ch, font->name); // now we let it use the "missing-glyph"-glyph - face = font->face; + face = (FT_Face)font->face; glyphIndex = 0; } } @@ -1223,7 +1223,7 @@ static qboolean Font_LoadMap(ft2_font_t *font, ft2_font_map_t *mapstart, Uchar _ if (!usefont) { usefont = font; - face = font->face; + face = (FT_Face)font->face; status = qFT_Load_Glyph(face, glyphIndex, FT_LOAD_RENDER | load_flags); if (status) { diff --git a/gl_draw.c b/gl_draw.c index 44aef376..9f887653 100644 --- a/gl_draw.c +++ b/gl_draw.c @@ -359,9 +359,9 @@ cachepic_t *Draw_CachePic_Flags(const char *path, unsigned int cachepicflags) pic->autoload = (cachepicflags & CACHEPICFLAG_NOTPERSISTENT); // load a high quality image from disk if possible - pixels = loadimagepixelsbgra(path, false, true, r_texture_convertsRGB_2d.integer, NULL); + pixels = loadimagepixelsbgra(path, false, true, r_texture_convertsRGB_2d.integer != 0, NULL); if (pixels == NULL && !strncmp(path, "gfx/", 4)) - pixels = loadimagepixelsbgra(path+4, false, true, r_texture_convertsRGB_2d.integer, NULL); + pixels = loadimagepixelsbgra(path+4, false, true, r_texture_convertsRGB_2d.integer != 0, NULL); if (pixels) { pic->width = image_width; @@ -447,9 +447,9 @@ rtexture_t *Draw_GetPicTexture(cachepic_t *pic) { if (pic->autoload && !pic->tex) { - pic->tex = loadtextureimage(drawtexturepool, pic->name, false, pic->texflags, true, r_texture_convertsRGB_2d.integer); + pic->tex = loadtextureimage(drawtexturepool, pic->name, false, pic->texflags, true, r_texture_convertsRGB_2d.integer != 0); if (pic->tex == NULL && !strncmp(pic->name, "gfx/", 4)) - pic->tex = loadtextureimage(drawtexturepool, pic->name+4, false, pic->texflags, true, r_texture_convertsRGB_2d.integer); + pic->tex = loadtextureimage(drawtexturepool, pic->name+4, false, pic->texflags, true, r_texture_convertsRGB_2d.integer != 0); if (pic->tex == NULL) pic->tex = draw_generatepic(pic->name, true); } @@ -718,7 +718,7 @@ dp_font_t *FindFont(const char *title, qboolean allocate_new) dp_fonts.maxsize = dp_fonts.maxsize + FONTS_EXPAND; if (developer_font.integer) Con_Printf("FindFont: enlarging fonts buffer (%i -> %i)\n", i, dp_fonts.maxsize); - dp_fonts.f = Mem_Realloc(fonts_mempool, dp_fonts.f, sizeof(dp_font_t) * dp_fonts.maxsize); + dp_fonts.f = (dp_font_t *)Mem_Realloc(fonts_mempool, dp_fonts.f, sizeof(dp_font_t) * dp_fonts.maxsize); // register a font in first expanded slot strlcpy(dp_fonts.f[i].title, title, sizeof(dp_fonts.f[i].title)); return &dp_fonts.f[i]; @@ -938,7 +938,7 @@ void GL_Draw_Init (void) // allocate fonts storage fonts_mempool = Mem_AllocPool("FONTS", 0, NULL); dp_fonts.maxsize = MAX_FONTS; - dp_fonts.f = Mem_Alloc(fonts_mempool, sizeof(dp_font_t) * dp_fonts.maxsize); + dp_fonts.f = (dp_font_t *)Mem_Alloc(fonts_mempool, sizeof(dp_font_t) * dp_fonts.maxsize); memset(dp_fonts.f, 0, sizeof(dp_font_t) * dp_fonts.maxsize); // assign starting font names diff --git a/gl_rmain.c b/gl_rmain.c index 1593e479..bd582cd1 100644 --- a/gl_rmain.c +++ b/gl_rmain.c @@ -252,6 +252,7 @@ static r_qwskincache_t *r_qwskincache; static int r_qwskincache_size; /// vertex coordinates for a quad that covers the screen exactly +extern const float r_screenvertex3f[12]; const float r_screenvertex3f[12] = { 0, 0, 0, @@ -377,7 +378,7 @@ static void R_BuildNormalizationCube(void) vec_t s, t, intensity; #define NORMSIZE 64 unsigned char *data; - data = Mem_Alloc(tempmempool, 6*NORMSIZE*NORMSIZE*4); + data = (unsigned char *)Mem_Alloc(tempmempool, 6*NORMSIZE*NORMSIZE*4); for (side = 0;side < 6;side++) { for (y = 0;y < NORMSIZE;y++) @@ -517,8 +518,8 @@ static void R_BuildFogHeightTexture(void) } size = image_width; r_refdef.fog_height_tablesize = size; - r_refdef.fog_height_table1d = Mem_Alloc(r_main_mempool, size * 4); - r_refdef.fog_height_table2d = Mem_Alloc(r_main_mempool, size * size * 4); + r_refdef.fog_height_table1d = (unsigned char *)Mem_Alloc(r_main_mempool, size * 4); + r_refdef.fog_height_table2d = (unsigned char *)Mem_Alloc(r_main_mempool, size * size * 4); memcpy(r_refdef.fog_height_table1d, inpixels, size * 4); Mem_Free(inpixels); // LordHavoc: now the magic - what is that table2d for? it is a cooked @@ -4429,8 +4430,8 @@ void R_GLSL_Restart_f(void) } memset(r_cg_permutationhash, 0, sizeof(r_cg_permutationhash)); } - break; #endif + break; case RENDERPATH_GL13: case RENDERPATH_GL11: break; @@ -5541,7 +5542,7 @@ skinframe_t *R_SkinFrame_LoadExternal(const char *name, int textureflags, qboole // check for DDS texture file first if (!r_loaddds || !(ddsbase = R_LoadTextureDDSFile(r_main_texturepool, va("dds/%s.dds", basename), textureflags, &ddshasalpha, ddsavgcolor, miplevel))) { - basepixels = loadimagepixelsbgra(name, complain, true, r_texture_convertsRGB_skin.integer, &miplevel); + basepixels = loadimagepixelsbgra(name, complain, true, r_texture_convertsRGB_skin.integer != 0, &miplevel); if (basepixels == NULL) return NULL; } @@ -5658,7 +5659,7 @@ skinframe_t *R_SkinFrame_LoadExternal(const char *name, int textureflags, qboole // _luma is supported only for tenebrae compatibility // _glow is the preferred name mymiplevel = savemiplevel; - if (skinframe->glow == NULL && ((pixels = loadimagepixelsbgra(va("%s_glow", skinframe->basename), false, false, r_texture_convertsRGB_skin.integer, &mymiplevel)) || (pixels = loadimagepixelsbgra(va("%s_luma", skinframe->basename), false, false, r_texture_convertsRGB_skin.integer, &mymiplevel)))) + if (skinframe->glow == NULL && ((pixels = loadimagepixelsbgra(va("%s_glow", skinframe->basename), false, false, r_texture_convertsRGB_skin.integer != 0, &mymiplevel)) || (pixels = loadimagepixelsbgra(va("%s_luma", skinframe->basename), false, false, r_texture_convertsRGB_skin.integer != 0, &mymiplevel)))) { skinframe->glow = R_LoadTexture2D (r_main_texturepool, va("%s_glow", skinframe->basename), image_width, image_height, pixels, TEXTYPE_BGRA, skinframe->textureflags & (gl_texturecompression_glow.integer ? ~0 : ~TEXF_COMPRESS), mymiplevel, NULL); if (r_savedds && qglGetCompressedTexImageARB && skinframe->glow) @@ -5667,7 +5668,7 @@ skinframe_t *R_SkinFrame_LoadExternal(const char *name, int textureflags, qboole } mymiplevel = savemiplevel; - if (skinframe->gloss == NULL && r_loadgloss && (pixels = loadimagepixelsbgra(va("%s_gloss", skinframe->basename), false, false, r_texture_convertsRGB_skin.integer, &mymiplevel))) + if (skinframe->gloss == NULL && r_loadgloss && (pixels = loadimagepixelsbgra(va("%s_gloss", skinframe->basename), false, false, r_texture_convertsRGB_skin.integer != 0, &mymiplevel))) { skinframe->gloss = R_LoadTexture2D (r_main_texturepool, va("%s_gloss", skinframe->basename), image_width, image_height, pixels, TEXTYPE_BGRA, skinframe->textureflags & (gl_texturecompression_gloss.integer ? ~0 : ~TEXF_COMPRESS), mymiplevel, NULL); if (r_savedds && qglGetCompressedTexImageARB && skinframe->gloss) @@ -5677,7 +5678,7 @@ skinframe_t *R_SkinFrame_LoadExternal(const char *name, int textureflags, qboole } mymiplevel = savemiplevel; - if (skinframe->pants == NULL && (pixels = loadimagepixelsbgra(va("%s_pants", skinframe->basename), false, false, r_texture_convertsRGB_skin.integer, &mymiplevel))) + if (skinframe->pants == NULL && (pixels = loadimagepixelsbgra(va("%s_pants", skinframe->basename), false, false, r_texture_convertsRGB_skin.integer != 0, &mymiplevel))) { skinframe->pants = R_LoadTexture2D (r_main_texturepool, va("%s_pants", skinframe->basename), image_width, image_height, pixels, TEXTYPE_BGRA, skinframe->textureflags & (gl_texturecompression_color.integer ? ~0 : ~TEXF_COMPRESS), mymiplevel, NULL); if (r_savedds && qglGetCompressedTexImageARB && skinframe->pants) @@ -5687,7 +5688,7 @@ skinframe_t *R_SkinFrame_LoadExternal(const char *name, int textureflags, qboole } mymiplevel = savemiplevel; - if (skinframe->shirt == NULL && (pixels = loadimagepixelsbgra(va("%s_shirt", skinframe->basename), false, false, r_texture_convertsRGB_skin.integer, &mymiplevel))) + if (skinframe->shirt == NULL && (pixels = loadimagepixelsbgra(va("%s_shirt", skinframe->basename), false, false, r_texture_convertsRGB_skin.integer != 0, &mymiplevel))) { skinframe->shirt = R_LoadTexture2D (r_main_texturepool, va("%s_shirt", skinframe->basename), image_width, image_height, pixels, TEXTYPE_BGRA, skinframe->textureflags & (gl_texturecompression_color.integer ? ~0 : ~TEXF_COMPRESS), mymiplevel, NULL); if (r_savedds && qglGetCompressedTexImageARB && skinframe->shirt) @@ -5697,7 +5698,7 @@ skinframe_t *R_SkinFrame_LoadExternal(const char *name, int textureflags, qboole } mymiplevel = savemiplevel; - if (skinframe->reflect == NULL && (pixels = loadimagepixelsbgra(va("%s_reflect", skinframe->basename), false, false, r_texture_convertsRGB_skin.integer, &mymiplevel))) + if (skinframe->reflect == NULL && (pixels = loadimagepixelsbgra(va("%s_reflect", skinframe->basename), false, false, r_texture_convertsRGB_skin.integer != 0, &mymiplevel))) { skinframe->reflect = R_LoadTexture2D (r_main_texturepool, va("%s_reflect", skinframe->basename), image_width, image_height, pixels, TEXTYPE_BGRA, skinframe->textureflags & (gl_texturecompression_reflectmask.integer ? ~0 : ~TEXF_COMPRESS), mymiplevel, NULL); if (r_savedds && qglGetCompressedTexImageARB && skinframe->reflect) @@ -5816,7 +5817,7 @@ skinframe_t *R_SkinFrame_LoadInternalQuake(const char *name, int textureflags, i Con_Printf("loading quake skin \"%s\"\n", name); // we actually don't upload anything until the first use, because mdl skins frequently go unused, and are almost never used in both modes (colormapped and non-colormapped) - skinframe->qpixels = Mem_Alloc(r_main_mempool, width*height); + skinframe->qpixels = (unsigned char *)Mem_Alloc(r_main_mempool, width*height); memcpy(skinframe->qpixels, skindata, width*height); skinframe->qwidth = width; skinframe->qheight = height; @@ -6041,7 +6042,7 @@ rtexture_t *R_LoadCubemap(const char *basename) // generate an image name based on the base and and suffix dpsnprintf(name, sizeof(name), "%s%s", basename, suffix[j][i].suffix); // load it - if ((image_buffer = loadimagepixelsbgra(name, false, false, r_texture_convertsRGB_cubemap.integer, NULL))) + if ((image_buffer = loadimagepixelsbgra(name, false, false, r_texture_convertsRGB_cubemap.integer != 0, NULL))) { // an image loaded, make sure width and height are equal if (image_width == image_height && (!cubemappixels || image_width == cubemapsize)) @@ -6140,7 +6141,7 @@ void R_Main_ResizeViewCache(void) r_refdef.viewcache.maxentities = numentities; if (r_refdef.viewcache.entityvisible) Mem_Free(r_refdef.viewcache.entityvisible); - r_refdef.viewcache.entityvisible = Mem_Alloc(r_main_mempool, r_refdef.viewcache.maxentities); + r_refdef.viewcache.entityvisible = (unsigned char *)Mem_Alloc(r_main_mempool, r_refdef.viewcache.maxentities); } if (r_refdef.viewcache.world_numclusters != numclusters) { @@ -6148,21 +6149,21 @@ void R_Main_ResizeViewCache(void) r_refdef.viewcache.world_numclusterbytes = numclusterbytes; if (r_refdef.viewcache.world_pvsbits) Mem_Free(r_refdef.viewcache.world_pvsbits); - r_refdef.viewcache.world_pvsbits = Mem_Alloc(r_main_mempool, r_refdef.viewcache.world_numclusterbytes); + r_refdef.viewcache.world_pvsbits = (unsigned char *)Mem_Alloc(r_main_mempool, r_refdef.viewcache.world_numclusterbytes); } if (r_refdef.viewcache.world_numleafs != numleafs) { r_refdef.viewcache.world_numleafs = numleafs; if (r_refdef.viewcache.world_leafvisible) Mem_Free(r_refdef.viewcache.world_leafvisible); - r_refdef.viewcache.world_leafvisible = Mem_Alloc(r_main_mempool, r_refdef.viewcache.world_numleafs); + r_refdef.viewcache.world_leafvisible = (unsigned char *)Mem_Alloc(r_main_mempool, r_refdef.viewcache.world_numleafs); } if (r_refdef.viewcache.world_numsurfaces != numsurfaces) { r_refdef.viewcache.world_numsurfaces = numsurfaces; if (r_refdef.viewcache.world_surfacevisible) Mem_Free(r_refdef.viewcache.world_surfacevisible); - r_refdef.viewcache.world_surfacevisible = Mem_Alloc(r_main_mempool, r_refdef.viewcache.world_numsurfaces); + r_refdef.viewcache.world_surfacevisible = (unsigned char *)Mem_Alloc(r_main_mempool, r_refdef.viewcache.world_numsurfaces); } } @@ -6731,9 +6732,9 @@ void R_AnimCache_UpdateEntityMeshBuffers(entity_render_t *ent, int numvertices) { int i; if (!ent->animcache_vertexmesh && ent->animcache_normal3f) - ent->animcache_vertexmesh = R_FrameData_Alloc(sizeof(r_vertexmesh_t)*numvertices); + ent->animcache_vertexmesh = (r_vertexmesh_t *)R_FrameData_Alloc(sizeof(r_vertexmesh_t)*numvertices); if (!ent->animcache_vertexposition) - ent->animcache_vertexposition = R_FrameData_Alloc(sizeof(r_vertexposition_t)*numvertices); + ent->animcache_vertexposition = (r_vertexposition_t *)R_FrameData_Alloc(sizeof(r_vertexposition_t)*numvertices); if (ent->animcache_vertexposition) { for (i = 0;i < numvertices;i++) @@ -6776,11 +6777,11 @@ qboolean R_AnimCache_GetEntity(entity_render_t *ent, qboolean wantnormals, qbool { numvertices = model->surfmesh.num_vertices; if (wantnormals) - ent->animcache_normal3f = R_FrameData_Alloc(sizeof(float[3])*numvertices); + ent->animcache_normal3f = (float *)R_FrameData_Alloc(sizeof(float[3])*numvertices); if (wanttangents) { - ent->animcache_svector3f = R_FrameData_Alloc(sizeof(float[3])*numvertices); - ent->animcache_tvector3f = R_FrameData_Alloc(sizeof(float[3])*numvertices); + ent->animcache_svector3f = (float *)R_FrameData_Alloc(sizeof(float[3])*numvertices); + ent->animcache_tvector3f = (float *)R_FrameData_Alloc(sizeof(float[3])*numvertices); } if (!r_framedata_failed) { @@ -6797,13 +6798,13 @@ qboolean R_AnimCache_GetEntity(entity_render_t *ent, qboolean wantnormals, qbool return false; // get some memory for this entity and generate mesh data numvertices = model->surfmesh.num_vertices; - ent->animcache_vertex3f = R_FrameData_Alloc(sizeof(float[3])*numvertices); + ent->animcache_vertex3f = (float *)R_FrameData_Alloc(sizeof(float[3])*numvertices); if (wantnormals) - ent->animcache_normal3f = R_FrameData_Alloc(sizeof(float[3])*numvertices); + ent->animcache_normal3f = (float *)R_FrameData_Alloc(sizeof(float[3])*numvertices); if (wanttangents) { - ent->animcache_svector3f = R_FrameData_Alloc(sizeof(float[3])*numvertices); - ent->animcache_tvector3f = R_FrameData_Alloc(sizeof(float[3])*numvertices); + ent->animcache_svector3f = (float *)R_FrameData_Alloc(sizeof(float[3])*numvertices); + ent->animcache_tvector3f = (float *)R_FrameData_Alloc(sizeof(float[3])*numvertices); } if (!r_framedata_failed) { @@ -7500,7 +7501,7 @@ static void R_Water_StartFrame(void) r_waterstate.numwaterplanes = 0; } -void R_Water_AddWaterPlane(msurface_t *surface) +void R_Water_AddWaterPlane(msurface_t *surface, int entno) { int triangleindex, planeindex; const int *e; @@ -9309,7 +9310,7 @@ texture_t *R_GetCurrentTexture(texture_t *t) r_qwskincache_size = cl.maxclients; if (r_qwskincache) Mem_Free(r_qwskincache); - r_qwskincache = Mem_Alloc(r_main_mempool, sizeof(*r_qwskincache) * r_qwskincache_size); + r_qwskincache = (r_qwskincache_t *)Mem_Alloc(r_main_mempool, sizeof(*r_qwskincache) * r_qwskincache_size); } if (strcmp(r_qwskincache[i].name, cl.scores[i].qw_skin)) R_LoadQWSkin(&r_qwskincache[i], cl.scores[i].qw_skin); @@ -12165,7 +12166,7 @@ static void R_DecalSystem_SpawnTriangle(decalsystem_t *decalsystem, const float qboolean useshortelements; decalsystem->maxdecals = max(16, decalsystem->maxdecals * 2); useshortelements = decalsystem->maxdecals * 3 <= 65536; - decalsystem->decals = Mem_Alloc(cls.levelmempool, decalsystem->maxdecals * (sizeof(tridecal_t) + sizeof(float[3][3]) + sizeof(float[3][2]) + sizeof(float[3][4]) + sizeof(int[3]) + (useshortelements ? sizeof(unsigned short[3]) : 0))); + decalsystem->decals = (tridecal_t *)Mem_Alloc(cls.levelmempool, decalsystem->maxdecals * (sizeof(tridecal_t) + sizeof(float[3][3]) + sizeof(float[3][2]) + sizeof(float[3][4]) + sizeof(int[3]) + (useshortelements ? sizeof(unsigned short[3]) : 0))); decalsystem->color4f = (float *)(decalsystem->decals + decalsystem->maxdecals); decalsystem->texcoord2f = (float *)(decalsystem->color4f + decalsystem->maxdecals*12); decalsystem->vertex3f = (float *)(decalsystem->texcoord2f + decalsystem->maxdecals*6); diff --git a/gl_textures.c b/gl_textures.c index d20a0ecd..881b48c5 100644 --- a/gl_textures.c +++ b/gl_textures.c @@ -1035,7 +1035,7 @@ static rtexture_t *R_SetupTexture(rtexturepool_t *rtexturepool, const char *iden qglGenTextures(1, (GLuint *)&glt->texnum);CHECKGLERROR R_Upload(glt, data, 0, 0, 0, glt->inputwidth, glt->inputheight, glt->inputdepth); if ((glt->flags & TEXF_ALLOWUPDATES) && gl_nopartialtextureupdates.integer) - glt->bufferpixels = Mem_Alloc(texturemempool, glt->tilewidth*glt->tileheight*glt->tiledepth*glt->sides*glt->bytesperpixel); + glt->bufferpixels = (unsigned char *)Mem_Alloc(texturemempool, glt->tilewidth*glt->tileheight*glt->tiledepth*glt->sides*glt->bytesperpixel); // texture converting and uploading can take a while, so make sure we're sending keepalives CL_KeepaliveMessage(false); @@ -1152,7 +1152,7 @@ int R_SaveTextureDDSFile(rtexture_t *rt, const char *filename, qboolean skipunco mipinfo[mip][3] = ddssize; ddssize += mipinfo[mip][2]; } - dds = Mem_Alloc(tempmempool, ddssize); + dds = (unsigned char *)Mem_Alloc(tempmempool, ddssize); if (!dds) return -4; dds_caps1 = 0x1000; // DDSCAPS_TEXTURE diff --git a/host_cmd.c b/host_cmd.c index 530cf4e4..32d8bb35 100644 --- a/host_cmd.c +++ b/host_cmd.c @@ -2491,7 +2491,7 @@ void Host_PQRcon_f (void) SZ_Clear(&net_message); MSG_WriteLong (&net_message, 0); MSG_WriteByte (&net_message, CCREQ_RCON); - SZ_Write(&net_message, (void*)rcon_password.string, n); + SZ_Write(&net_message, (const unsigned char*)rcon_password.string, n); MSG_WriteByte (&net_message, 0); // terminate the (possibly partial) string MSG_WriteString (&net_message, Cmd_Args()); StoreBigLong(net_message.data, NETFLAG_CTL | (net_message.cursize & NETFLAG_LENGTH_MASK)); diff --git a/image.c b/image.c index 41055d7e..e5611d7c 100644 --- a/image.c +++ b/image.c @@ -804,7 +804,7 @@ void Image_MakeLinearColorsFromsRGB(unsigned char *pout, const unsigned char *pi // this math from http://www.opengl.org/registry/specs/EXT/texture_sRGB.txt if (!image_linearfromsrgb[255]) for (i = 0;i < 256;i++) - image_linearfromsrgb[i] = i < 11 ? (int)(i / 12.92f) : (int)(pow((i/256.0f + 0.055f)/1.0555f, 2.4)*256.0f); + image_linearfromsrgb[i] = i < 11 ? (int)(i / 12.92f) : (int)(pow((i/256.0f + 0.055f)/1.0555f, 2.4f)*256.0f); for (i = 0;i < numpixels;i++) { pout[i*4+0] = image_linearfromsrgb[pin[i*4+0]]; diff --git a/lhnet.c b/lhnet.c index 99b9f144..2ba0fcfe 100644 --- a/lhnet.c +++ b/lhnet.c @@ -2,6 +2,7 @@ // Written by Forest Hale 2003-06-15 and placed into public domain. #ifdef WIN32 +#pragma comment(lib, "ws2_32.lib") # ifdef SUPPORTIPV6 // Windows XP or higher is required for getaddrinfo, but the inclusion of wspiapi provides fallbacks for older versions # define _WIN32_WINNT 0x0501 diff --git a/model_brush.c b/model_brush.c index 1cadbecb..46515fcf 100644 --- a/model_brush.c +++ b/model_brush.c @@ -1333,8 +1333,8 @@ void R_Q1BSP_LoadSplitSky (unsigned char *src, int width, int height, int bytesp int x, y; int w = width/2; int h = height; - unsigned *solidpixels = Mem_Alloc(tempmempool, w*h*sizeof(unsigned char[4])); - unsigned *alphapixels = Mem_Alloc(tempmempool, w*h*sizeof(unsigned char[4])); + unsigned int *solidpixels = (unsigned int *)Mem_Alloc(tempmempool, w*h*sizeof(unsigned char[4])); + unsigned int *alphapixels = (unsigned int *)Mem_Alloc(tempmempool, w*h*sizeof(unsigned char[4])); // allocate a texture pool if we need it if (loadmodel->texturepool == NULL && cls.state != ca_dedicated) @@ -1576,9 +1576,9 @@ static void Mod_Q1BSP_LoadTextures(lump_t *l) // LordHavoc: HL sky textures are entirely different than quake if (!loadmodel->brush.ishlbsp && !strncmp(tx->name, "sky", 3) && mtwidth == mtheight * 2) { - data = loadimagepixelsbgra(gamemode == GAME_TENEBRAE ? tx->name : va("textures/%s/%s", mapname, tx->name), false, false, r_texture_convertsRGB_skin.integer, NULL); + data = loadimagepixelsbgra(gamemode == GAME_TENEBRAE ? tx->name : va("textures/%s/%s", mapname, tx->name), false, false, r_texture_convertsRGB_skin.integer != 0, NULL); if (!data) - data = loadimagepixelsbgra(gamemode == GAME_TENEBRAE ? tx->name : va("textures/%s", tx->name), false, false, r_texture_convertsRGB_skin.integer, NULL); + data = loadimagepixelsbgra(gamemode == GAME_TENEBRAE ? tx->name : va("textures/%s", tx->name), false, false, r_texture_convertsRGB_skin.integer != 0, NULL); if (data && image_width == image_height * 2) { R_Q1BSP_LoadSplitSky(data, image_width, image_height, 4); @@ -2454,8 +2454,8 @@ static void Mod_Q1BSP_LoadFaces(lump_t *l) loadmodel->texturepool = R_AllocTexturePool(); // could not find room, make a new lightmap loadmodel->brushq3.num_mergedlightmaps = lightmapnumber + 1; - loadmodel->brushq3.data_lightmaps = Mem_Realloc(loadmodel->mempool, loadmodel->brushq3.data_lightmaps, loadmodel->brushq3.num_mergedlightmaps * sizeof(loadmodel->brushq3.data_lightmaps[0])); - loadmodel->brushq3.data_deluxemaps = Mem_Realloc(loadmodel->mempool, loadmodel->brushq3.data_deluxemaps, loadmodel->brushq3.num_mergedlightmaps * sizeof(loadmodel->brushq3.data_deluxemaps[0])); + loadmodel->brushq3.data_lightmaps = (rtexture_t **)Mem_Realloc(loadmodel->mempool, loadmodel->brushq3.data_lightmaps, loadmodel->brushq3.num_mergedlightmaps * sizeof(loadmodel->brushq3.data_lightmaps[0])); + loadmodel->brushq3.data_deluxemaps = (rtexture_t **)Mem_Realloc(loadmodel->mempool, loadmodel->brushq3.data_deluxemaps, loadmodel->brushq3.num_mergedlightmaps * sizeof(loadmodel->brushq3.data_deluxemaps[0])); loadmodel->brushq3.data_lightmaps[lightmapnumber] = lightmaptexture = R_LoadTexture2D(loadmodel->texturepool, va("lightmap%i", lightmapnumber), lightmapsize, lightmapsize, NULL, TEXTYPE_BGRA, TEXF_FORCELINEAR | TEXF_ALLOWUPDATES, -1, NULL); if (loadmodel->brushq1.nmaplightdata) loadmodel->brushq3.data_deluxemaps[lightmapnumber] = deluxemaptexture = R_LoadTexture2D(loadmodel->texturepool, va("deluxemap%i", lightmapnumber), lightmapsize, lightmapsize, NULL, TEXTYPE_BGRA, TEXF_FORCELINEAR | TEXF_ALLOWUPDATES, -1, NULL); @@ -3182,7 +3182,7 @@ static void Mod_Q1BSP_RecursiveNodePortals(mnode_t *node) if (portalpointsbuffersize < portalpointsbufferoffset + 6*MAX_PORTALPOINTS) { portalpointsbuffersize = portalpointsbufferoffset * 2; - portalpointsbuffer = Mem_Realloc(loadmodel->mempool, portalpointsbuffer, portalpointsbuffersize * sizeof(*portalpointsbuffer)); + portalpointsbuffer = (double *)Mem_Realloc(loadmodel->mempool, portalpointsbuffer, portalpointsbuffersize * sizeof(*portalpointsbuffer)); } frontpoints = portalpointsbuffer + portalpointsbufferoffset; portalpointsbufferoffset += 3*MAX_PORTALPOINTS; @@ -3315,7 +3315,7 @@ static void Mod_Q1BSP_MakePortals(void) Mem_ExpandableArray_NewArray(&portalarray, loadmodel->mempool, sizeof(portal_t), 1020*1024/sizeof(portal_t)); portalpointsbufferoffset = 0; portalpointsbuffersize = 6*MAX_PORTALPOINTS*128; - portalpointsbuffer = Mem_Alloc(loadmodel->mempool, portalpointsbuffersize * sizeof(*portalpointsbuffer)); + portalpointsbuffer = (double *)Mem_Alloc(loadmodel->mempool, portalpointsbuffersize * sizeof(*portalpointsbuffer)); Mod_Q1BSP_RecursiveNodePortals(loadmodel->brush.data_nodes + loadmodel->brushq1.hulls[0].firstclipnode); Mem_Free(portalpointsbuffer); portalpointsbuffer = NULL; @@ -5055,8 +5055,8 @@ static void Mod_Q3BSP_LoadFaces(lump_t *l) Mod_AllocSurfMesh(loadmodel->mempool, meshvertices, meshtriangles, false, true, false); if (collisiontriangles) { - loadmodel->brush.data_collisionvertex3f = Mem_Alloc(loadmodel->mempool, collisionvertices * sizeof(float[3])); - loadmodel->brush.data_collisionelement3i = Mem_Alloc(loadmodel->mempool, collisiontriangles * sizeof(int[3])); + loadmodel->brush.data_collisionvertex3f = (float *)Mem_Alloc(loadmodel->mempool, collisionvertices * sizeof(float[3])); + loadmodel->brush.data_collisionelement3i = (int *)Mem_Alloc(loadmodel->mempool, collisiontriangles * sizeof(int[3])); } meshvertices = 0; meshtriangles = 0; @@ -6638,7 +6638,7 @@ bih_t *Mod_MakeCollisionBIH(dp_model_t *model, qboolean userendersurfaces, bih_t return NULL; // allocate the memory for the BIH leaf nodes - bihleafs = Mem_Alloc(loadmodel->mempool, sizeof(bih_leaf_t) * bihnumleafs); + bihleafs = (bih_leaf_t *)Mem_Alloc(loadmodel->mempool, sizeof(bih_leaf_t) * bihnumleafs); // now populate the BIH leaf nodes bihleafindex = 0; @@ -6706,8 +6706,8 @@ bih_t *Mod_MakeCollisionBIH(dp_model_t *model, qboolean userendersurfaces, bih_t // allocate buffers for the produced and temporary data bihmaxnodes = bihnumleafs - 1; - bihnodes = Mem_Alloc(loadmodel->mempool, sizeof(bih_node_t) * bihmaxnodes); - temp_leafsort = Mem_Alloc(loadmodel->mempool, sizeof(int) * bihnumleafs * 2); + bihnodes = (bih_node_t *)Mem_Alloc(loadmodel->mempool, sizeof(bih_node_t) * bihmaxnodes); + temp_leafsort = (int *)Mem_Alloc(loadmodel->mempool, sizeof(int) * bihnumleafs * 2); temp_leafsortscratch = temp_leafsort + bihnumleafs; // now build it @@ -6720,7 +6720,7 @@ bih_t *Mod_MakeCollisionBIH(dp_model_t *model, qboolean userendersurfaces, bih_t if (out->maxnodes > out->numnodes) { out->maxnodes = out->numnodes; - out->nodes = Mem_Realloc(loadmodel->mempool, out->nodes, out->numnodes * sizeof(bih_node_t)); + out->nodes = (bih_node_t *)Mem_Realloc(loadmodel->mempool, out->nodes, out->numnodes * sizeof(bih_node_t)); } return out; @@ -7358,13 +7358,13 @@ void Mod_OBJ_Load(dp_model_t *mod, void *buffer, void *bufferend) // allocate storage for triangles loadmodel->num_surfaces = loadmodel->nummodelsurfaces = numsurfaces = numtextures; - loadmodel->surfmesh.data_element3i = Mem_Alloc(loadmodel->mempool, numtriangles * sizeof(int[3])); + loadmodel->surfmesh.data_element3i = (int *)Mem_Alloc(loadmodel->mempool, numtriangles * sizeof(int[3])); loadmodel->data_surfaces = (msurface_t *)Mem_Alloc(loadmodel->mempool, loadmodel->num_surfaces * sizeof(msurface_t)); // allocate vertex hash structures to build an optimal vertex subset vertexhashsize = numtriangles*2; - vertexhashtable = Mem_Alloc(loadmodel->mempool, sizeof(int) * vertexhashsize); + vertexhashtable = (int *)Mem_Alloc(loadmodel->mempool, sizeof(int) * vertexhashsize); memset(vertexhashtable, 0xFF, sizeof(int) * vertexhashsize); - vertexhashdata = Mem_Alloc(loadmodel->mempool, sizeof(*vertexhashdata) * numtriangles*3); + vertexhashdata = (objvertex_t *)Mem_Alloc(loadmodel->mempool, sizeof(*vertexhashdata) * numtriangles*3); vertexhashcount = 0; // gather surface stats for assigning vertex/triangle ranges diff --git a/model_shared.c b/model_shared.c index 1b3fc50c..3c706f31 100644 --- a/model_shared.c +++ b/model_shared.c @@ -699,7 +699,7 @@ void Mod_BuildTriangleNeighbors(int *neighbors, const int *elements, int numtria edgehashentry_t *edgehashentries, *hash; if (!numtriangles) return; - edgehash = Mem_Alloc(tempmempool, TRIANGLEEDGEHASH * sizeof(*edgehash)); + edgehash = (edgehashentry_t **)Mem_Alloc(tempmempool, TRIANGLEEDGEHASH * sizeof(*edgehash)); // if there are too many triangles for the stack array, allocate larger buffer edgehashentries = (edgehashentry_t *)Mem_Alloc(tempmempool, numtriangles * 3 * sizeof(edgehashentry_t)); // find neighboring triangles @@ -3232,7 +3232,7 @@ void Mod_AllocLightmap_Init(mod_alloclightmap_state_t *state, int width, int hei state->width = width; state->height = height; state->currentY = 0; - state->rows = Mem_Alloc(loadmodel->mempool, state->height * sizeof(*state->rows)); + state->rows = (mod_alloclightmap_row_t *)Mem_Alloc(loadmodel->mempool, state->height * sizeof(*state->rows)); for (y = 0;y < state->height;y++) { state->rows[y].currentX = 0; @@ -3464,7 +3464,7 @@ static void Mod_GenerateLightmaps_CreateLights_ComputeSVBSP(dp_model_t *model, l VectorSet(mins, lightinfo->origin[0] - lightinfo->radius, lightinfo->origin[1] - lightinfo->radius, lightinfo->origin[2] - lightinfo->radius); VectorSet(maxs, lightinfo->origin[0] + lightinfo->radius, lightinfo->origin[1] + lightinfo->radius, lightinfo->origin[2] + lightinfo->radius); VectorCopy(lightinfo->origin, origin); - nodes = Mem_Alloc(tempmempool, maxnodes * sizeof(*nodes)); + nodes = (svbsp_node_t *)Mem_Alloc(tempmempool, maxnodes * sizeof(*nodes)); for (;;) { SVBSP_Init(&svbsp, origin, maxnodes, nodes); @@ -3478,14 +3478,14 @@ static void Mod_GenerateLightmaps_CreateLights_ComputeSVBSP(dp_model_t *model, l return; } Mem_Free(nodes); - nodes = Mem_Alloc(tempmempool, maxnodes * sizeof(*nodes)); + nodes = (svbsp_node_t *)Mem_Alloc(tempmempool, maxnodes * sizeof(*nodes)); } else break; } if (svbsp.numnodes > 0) { - svbsp.nodes = Mem_Alloc(tempmempool, svbsp.numnodes * sizeof(*nodes)); + svbsp.nodes = (svbsp_node_t *)Mem_Alloc(tempmempool, svbsp.numnodes * sizeof(*nodes)); memcpy(svbsp.nodes, nodes, svbsp.numnodes * sizeof(*nodes)); lightinfo->svbsp = svbsp; } @@ -3511,7 +3511,7 @@ static void Mod_GenerateLightmaps_CreateLights(dp_model_t *model) } if (mod_generatelightmaps_numlights > 0) { - mod_generatelightmaps_lightinfo = Mem_Alloc(tempmempool, mod_generatelightmaps_numlights * sizeof(*mod_generatelightmaps_lightinfo)); + mod_generatelightmaps_lightinfo = (lightmaplight_t *)Mem_Alloc(tempmempool, mod_generatelightmaps_numlights * sizeof(*mod_generatelightmaps_lightinfo)); lightinfo = mod_generatelightmaps_lightinfo; for (index = 0;;index++) { @@ -3862,7 +3862,7 @@ static void Mod_GenerateLightmaps_CreateTriangleInformation(dp_model_t *model) const int *e; lightmaptriangle_t *triangle; // generate lightmap triangle structs - mod_generatelightmaps_lightmaptriangles = Mem_Alloc(model->mempool, model->surfmesh.num_triangles * sizeof(lightmaptriangle_t)); + mod_generatelightmaps_lightmaptriangles = (lightmaptriangle_t *)Mem_Alloc(model->mempool, model->surfmesh.num_triangles * sizeof(lightmaptriangle_t)); for (surfaceindex = 0;surfaceindex < model->num_surfaces;surfaceindex++) { surface = model->data_surfaces + surfaceindex; @@ -4017,10 +4017,10 @@ static void Mod_GenerateLightmaps_CreateLightmaps(dp_model_t *model) model->brushq3.deluxemapping_modelspace = true; model->brushq3.deluxemapping = true; model->brushq3.num_mergedlightmaps = lightmapnumber; - model->brushq3.data_lightmaps = Mem_Alloc(model->mempool, model->brushq3.num_mergedlightmaps * sizeof(rtexture_t *)); - model->brushq3.data_deluxemaps = Mem_Alloc(model->mempool, model->brushq3.num_mergedlightmaps * sizeof(rtexture_t *)); - lightmappixels = Mem_Alloc(tempmempool, model->brushq3.num_mergedlightmaps * lm_texturesize * lm_texturesize * 4); - deluxemappixels = Mem_Alloc(tempmempool, model->brushq3.num_mergedlightmaps * lm_texturesize * lm_texturesize * 4); + model->brushq3.data_lightmaps = (rtexture_t **)Mem_Alloc(model->mempool, model->brushq3.num_mergedlightmaps * sizeof(rtexture_t *)); + model->brushq3.data_deluxemaps = (rtexture_t **)Mem_Alloc(model->mempool, model->brushq3.num_mergedlightmaps * sizeof(rtexture_t *)); + lightmappixels = (unsigned char *)Mem_Alloc(tempmempool, model->brushq3.num_mergedlightmaps * lm_texturesize * lm_texturesize * 4); + deluxemappixels = (unsigned char *)Mem_Alloc(tempmempool, model->brushq3.num_mergedlightmaps * lm_texturesize * lm_texturesize * 4); for (surfaceindex = 0;surfaceindex < model->num_surfaces;surfaceindex++) { surface = model->data_surfaces + surfaceindex; diff --git a/prvm_cmds.c b/prvm_cmds.c index 3976608f..380d81e5 100644 --- a/prvm_cmds.c +++ b/prvm_cmds.c @@ -188,7 +188,7 @@ void VM_UpdateEdictSkeleton(prvm_edict_t *ed, const dp_model_t *edmodel, const f ed->priv.server->skeleton.model = edmodel; } if (!ed->priv.server->skeleton.relativetransforms && ed->priv.server->skeleton.model && ed->priv.server->skeleton.model->num_bones) - ed->priv.server->skeleton.relativetransforms = Mem_Alloc(prog->progs_mempool, ed->priv.server->skeleton.model->num_bones * sizeof(matrix4x4_t)); + ed->priv.server->skeleton.relativetransforms = (matrix4x4_t *)Mem_Alloc(prog->progs_mempool, ed->priv.server->skeleton.model->num_bones * sizeof(matrix4x4_t)); if (ed->priv.server->skeleton.relativetransforms) { int skeletonindex = -1; @@ -6303,13 +6303,13 @@ void animatemodel(dp_model_t *model, prvm_edict_t *ed) need |= (animatemodel_cache.model != model); VM_GenerateFrameGroupBlend(ed->priv.server->framegroupblend, ed); VM_FrameBlendFromFrameGroupBlend(ed->priv.server->frameblend, ed->priv.server->framegroupblend, model); - need |= (memcmp(&animatemodel_cache.frameblend, &ed->priv.server->frameblend, sizeof(ed->priv.server->frameblend))); + need |= (memcmp(&animatemodel_cache.frameblend, &ed->priv.server->frameblend, sizeof(ed->priv.server->frameblend))) != 0; if ((val = PRVM_EDICTFIELDVALUE(ed, prog->fieldoffsets.skeletonindex))) skeletonindex = (int)val->_float - 1; if (!(skeletonindex >= 0 && skeletonindex < MAX_EDICTS && (skeleton = prog->skeletons[skeletonindex]) && skeleton->model->num_bones == ed->priv.server->skeleton.model->num_bones)) skeleton = NULL; need |= (animatemodel_cache.skeleton_p != skeleton); if(skeleton) - need |= (memcmp(&animatemodel_cache.skeleton, skeleton, sizeof(ed->priv.server->skeleton))); + need |= (memcmp(&animatemodel_cache.skeleton, skeleton, sizeof(ed->priv.server->skeleton))) != 0; if(!need) return; if(model->surfmesh.num_vertices > animatemodel_cache.max_vertices) @@ -6319,10 +6319,10 @@ void animatemodel(dp_model_t *model, prvm_edict_t *ed) if(animatemodel_cache.buf_svector3f) Mem_Free(animatemodel_cache.buf_svector3f); if(animatemodel_cache.buf_tvector3f) Mem_Free(animatemodel_cache.buf_tvector3f); if(animatemodel_cache.buf_normal3f) Mem_Free(animatemodel_cache.buf_normal3f); - animatemodel_cache.buf_vertex3f = Mem_Alloc(prog->progs_mempool, sizeof(float[3]) * animatemodel_cache.max_vertices); - animatemodel_cache.buf_svector3f = Mem_Alloc(prog->progs_mempool, sizeof(float[3]) * animatemodel_cache.max_vertices); - animatemodel_cache.buf_tvector3f = Mem_Alloc(prog->progs_mempool, sizeof(float[3]) * animatemodel_cache.max_vertices); - animatemodel_cache.buf_normal3f = Mem_Alloc(prog->progs_mempool, sizeof(float[3]) * animatemodel_cache.max_vertices); + animatemodel_cache.buf_vertex3f = (float *)Mem_Alloc(prog->progs_mempool, sizeof(float[3]) * animatemodel_cache.max_vertices); + animatemodel_cache.buf_svector3f = (float *)Mem_Alloc(prog->progs_mempool, sizeof(float[3]) * animatemodel_cache.max_vertices); + animatemodel_cache.buf_tvector3f = (float *)Mem_Alloc(prog->progs_mempool, sizeof(float[3]) * animatemodel_cache.max_vertices); + animatemodel_cache.buf_normal3f = (float *)Mem_Alloc(prog->progs_mempool, sizeof(float[3]) * animatemodel_cache.max_vertices); } animatemodel_cache.data_vertex3f = animatemodel_cache.buf_vertex3f; animatemodel_cache.data_svector3f = animatemodel_cache.buf_svector3f; diff --git a/prvm_edict.c b/prvm_edict.c index 5a51babb..80803a23 100644 --- a/prvm_edict.c +++ b/prvm_edict.c @@ -1181,7 +1181,7 @@ void PRVM_ED_EdictGet_f(void) } v = (prvm_eval_t *)(ed->fields.vp + key->ofs); - s = PRVM_UglyValueString(key->type, v); + s = PRVM_UglyValueString((etype_t)key->type, v); if(Cmd_Argc() == 5) { cvar_t *cvar = Cvar_FindVar(Cmd_Argv(4)); @@ -1226,7 +1226,7 @@ void PRVM_ED_GlobalGet_f(void) } v = (prvm_eval_t *) &prog->globals.generic[key->ofs]; - s = PRVM_UglyValueString(key->type, v); + s = PRVM_UglyValueString((etype_t)key->type, v); if(Cmd_Argc() == 4) { cvar_t *cvar = Cvar_FindVar(Cmd_Argv(3)); @@ -1893,7 +1893,7 @@ po_t *PRVM_PO_Load(const char *filename, mempool_t *pool) if(!buf) return NULL; - po = Mem_Alloc(pool, sizeof(*po)); + po = (po_t *)Mem_Alloc(pool, sizeof(*po)); memset(po, 0, sizeof(*po)); p = buf; @@ -1957,16 +1957,16 @@ po_t *PRVM_PO_Load(const char *filename, mempool_t *pool) { if(thisstr.key) Mem_Free(thisstr.key); - thisstr.key = Mem_Alloc(pool, decodedpos + 1); + thisstr.key = (char *)Mem_Alloc(pool, decodedpos + 1); memcpy(thisstr.key, decodedbuf, decodedpos + 1); } else if(decodedpos > 0 && thisstr.key) // skip empty translation results { - thisstr.value = Mem_Alloc(pool, decodedpos + 1); + thisstr.value = (char *)Mem_Alloc(pool, decodedpos + 1); memcpy(thisstr.value, decodedbuf, decodedpos + 1); hashindex = CRC_Block((const unsigned char *) thisstr.key, strlen(thisstr.key)) % PO_HASHSIZE; thisstr.nextonhashchain = po->hashtable[hashindex]; - po->hashtable[hashindex] = Mem_Alloc(pool, sizeof(thisstr)); + po->hashtable[hashindex] = (po_string_t *)Mem_Alloc(pool, sizeof(thisstr)); memcpy(po->hashtable[hashindex], &thisstr, sizeof(thisstr)); memset(&thisstr, 0, sizeof(thisstr)); } diff --git a/r_shadow.c b/r_shadow.c index dd052f8c..1363733c 100644 --- a/r_shadow.c +++ b/r_shadow.c @@ -2135,7 +2135,7 @@ static void R_Shadow_MakeShadowMap(int side, int size) Cvar_SetValueQuick(&r_shadow_deferred, 0); } } - + void R_Shadow_RenderMode_ShadowMap(int side, int clear, int size) { float nearclip, farclip, bias; diff --git a/r_sky.c b/r_sky.c index 2f6b9ef8..e49ab578 100644 --- a/r_sky.c +++ b/r_sky.c @@ -109,13 +109,13 @@ int R_LoadSkyBox(void) success = 0; for (i=0; i<6; i++) { - if (dpsnprintf(name, sizeof(name), "%s_%s", skyname, suffix[j][i].suffix) < 0 || !(image_buffer = loadimagepixelsbgra(name, false, false, r_texture_convertsRGB_skybox.integer, NULL))) + if (dpsnprintf(name, sizeof(name), "%s_%s", skyname, suffix[j][i].suffix) < 0 || !(image_buffer = loadimagepixelsbgra(name, false, false, r_texture_convertsRGB_skybox.integer != 0, NULL))) { - if (dpsnprintf(name, sizeof(name), "%s%s", skyname, suffix[j][i].suffix) < 0 || !(image_buffer = loadimagepixelsbgra(name, false, false, r_texture_convertsRGB_skybox.integer, NULL))) + if (dpsnprintf(name, sizeof(name), "%s%s", skyname, suffix[j][i].suffix) < 0 || !(image_buffer = loadimagepixelsbgra(name, false, false, r_texture_convertsRGB_skybox.integer != 0, NULL))) { - if (dpsnprintf(name, sizeof(name), "env/%s%s", skyname, suffix[j][i].suffix) < 0 || !(image_buffer = loadimagepixelsbgra(name, false, false, r_texture_convertsRGB_skybox.integer, NULL))) + if (dpsnprintf(name, sizeof(name), "env/%s%s", skyname, suffix[j][i].suffix) < 0 || !(image_buffer = loadimagepixelsbgra(name, false, false, r_texture_convertsRGB_skybox.integer != 0, NULL))) { - if (dpsnprintf(name, sizeof(name), "gfx/env/%s%s", skyname, suffix[j][i].suffix) < 0 || !(image_buffer = loadimagepixelsbgra(name, false, false, r_texture_convertsRGB_skybox.integer, NULL))) + if (dpsnprintf(name, sizeof(name), "gfx/env/%s%s", skyname, suffix[j][i].suffix) < 0 || !(image_buffer = loadimagepixelsbgra(name, false, false, r_texture_convertsRGB_skybox.integer != 0, NULL))) continue; } } diff --git a/svvm_cmds.c b/svvm_cmds.c index a11eb7c8..5b3a8b19 100644 --- a/svvm_cmds.c +++ b/svvm_cmds.c @@ -2837,7 +2837,7 @@ static void VM_SV_skel_create(void) break; if (i == MAX_EDICTS) return; - prog->skeletons[i] = skeleton = Mem_Alloc(cls.levelmempool, sizeof(skeleton_t) + model->num_bones * sizeof(matrix4x4_t)); + prog->skeletons[i] = skeleton = (skeleton_t *)Mem_Alloc(cls.levelmempool, sizeof(skeleton_t) + model->num_bones * sizeof(matrix4x4_t)); PRVM_G_FLOAT(OFS_RETURN) = i + 1; skeleton->model = model; skeleton->relativetransforms = (matrix4x4_t *)(skeleton+1); diff --git a/sys_shared.c b/sys_shared.c index 3b83a498..f5eb5363 100644 --- a/sys_shared.c +++ b/sys_shared.c @@ -6,6 +6,7 @@ # include # include // timeGetTime # include // localtime +#pragma comment(lib, "winmm.lib") #else # include # include diff --git a/vid.h b/vid.h index b5ffc050..540a0c42 100644 --- a/vid.h +++ b/vid.h @@ -182,7 +182,7 @@ extern qboolean isG200; extern qboolean isRagePro; void *GL_GetProcAddress(const char *name); -int GL_CheckExtension(const char *minglver_or_ext, const dllfunction_t *funcs, const char *disableparm, int silent); +qboolean GL_CheckExtension(const char *minglver_or_ext, const dllfunction_t *funcs, const char *disableparm, int silent); void VID_Shared_Init(void); diff --git a/vid_shared.c b/vid_shared.c index eb6c56d4..20f2b3e1 100644 --- a/vid_shared.c +++ b/vid_shared.c @@ -389,7 +389,7 @@ void (GLAPIENTRY *qglGetQueryObjectuivARB)(GLuint qid, GLenum pname, GLuint *par #define sscanf sscanf_s #endif -int GL_CheckExtension(const char *minglver_or_ext, const dllfunction_t *funcs, const char *disableparm, int silent) +qboolean GL_CheckExtension(const char *minglver_or_ext, const dllfunction_t *funcs, const char *disableparm, int silent) { int failed = false; const dllfunction_t *func; @@ -1227,13 +1227,13 @@ int VID_Mode(int fullscreen, int width, int height, int bpp, float refreshrate, { viddef_mode_t mode; memset(&mode, 0, sizeof(mode)); - mode.fullscreen = fullscreen; + mode.fullscreen = fullscreen != 0; mode.width = width; mode.height = height; mode.bitsperpixel = bpp; mode.refreshrate = vid_userefreshrate.integer ? max(1, refreshrate) : 0; - mode.userefreshrate = vid_userefreshrate.integer; - mode.stereobuffer = stereobuffer; + mode.userefreshrate = vid_userefreshrate.integer != 0; + mode.stereobuffer = stereobuffer != 0; mode.samples = samples; cl_ignoremousemoves = 2; if (VID_InitMode(&mode)) diff --git a/vid_wgl.c b/vid_wgl.c index 1902eef7..1b9e758d 100644 --- a/vid_wgl.c +++ b/vid_wgl.c @@ -19,6 +19,8 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ // vid_wgl.c -- NT GL vid component +#pragma comment(lib, "comctl32.lib") + #ifdef SUPPORTDIRECTX // Include DX libs #pragma comment(lib, "dinput8.lib") diff --git a/zone.c b/zone.c index c6a9fdc2..692879c7 100644 --- a/zone.c +++ b/zone.c @@ -857,7 +857,7 @@ void Memory_Init (void) { static union {unsigned short s;unsigned char b[2];} u; u.s = 0x100; - mem_bigendian = u.b[0]; + mem_bigendian = u.b[0] != 0; sentinel_seed = rand(); poolchain = NULL;