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;
{
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++)
}
#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
{
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);
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;
}
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;
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;
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);
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);
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;
{
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)
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);
}
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;
}
}
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;
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);
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);
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);
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])
{
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;
{
//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;
}
}
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)
{
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;
{
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);
}
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];
// 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
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,
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++)
}
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
}
memset(r_cg_permutationhash, 0, sizeof(r_cg_permutationhash));
}
- break;
#endif
+ break;
case RENDERPATH_GL13:
case RENDERPATH_GL11:
break;
// 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;
}
// _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)
}
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)
}
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)
}
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)
}
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)
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;
// 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))
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)
{
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);
}
}
{
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++)
{
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)
{
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)
{
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;
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);
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);
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);
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
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));
// 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]];
// 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
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)
// 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);
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);
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;
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;
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;
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;
// 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
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;
// 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
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
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;
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);
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;
}
}
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++)
{
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;
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;
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;
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)
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;
}
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));
}
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));
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;
{
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));
}
Cvar_SetValueQuick(&r_shadow_deferred, 0);
}
}
-
+
void R_Shadow_RenderMode_ShadowMap(int side, int clear, int size)
{
float nearclip, farclip, bias;
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;
}
}
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);
# include <windows.h>
# include <mmsystem.h> // timeGetTime
# include <time.h> // localtime
+#pragma comment(lib, "winmm.lib")
#else
# include <unistd.h>
# include <fcntl.h>
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);
#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;
{
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))
*/
// vid_wgl.c -- NT GL vid component
+#pragma comment(lib, "comctl32.lib")
+
#ifdef SUPPORTDIRECTX
// Include DX libs
#pragma comment(lib, "dinput8.lib")
{
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;