host_cmd.c, console.c, gl_draw.c, image.c, gl_model.c, r_sprite.c, cl_parse.c,

gl_warp.c, host.c, gl_mesh.c, gl_sky.c, gl_texmgr.c, cvar.c, sv_main.c, cvar.h,
gl_screen.c, r_brush.c, gl_vidsdl.c, zone.c, cl_main.c, cmd.c, snd_dma.c,
snd_mem.c, common.c, sv_phys.c: Added explicit casts to eliminate -Wc++-compat
warnings.


git-svn-id: svn://svn.code.sf.net/p/quakespasm/code/trunk/quakespasm@170 af15c1b1-3010-417e-b628-4374ebc0bcbd
This commit is contained in:
Ozkan Sezer 2010-05-31 07:42:36 +00:00
parent def1c058f4
commit c24d592580
25 changed files with 127 additions and 124 deletions

View file

@ -87,7 +87,7 @@ void CL_ClearState (void)
//johnfitz -- cl_entities is now dynamically allocated
cl_max_edicts = CLAMP (MIN_EDICTS,(int)max_edicts.value,MAX_EDICTS);
cl_entities = Hunk_AllocName (cl_max_edicts*sizeof(entity_t), "cl_entities");
cl_entities = (entity_t *) Hunk_AllocName (cl_max_edicts*sizeof(entity_t), "cl_entities");
//johnfitz
//

View file

@ -280,7 +280,7 @@ void CL_ParseServerInfo (void)
Con_Printf("Bad maxclients (%u) from server\n", cl.maxclients);
return;
}
cl.scores = Hunk_AllocName (cl.maxclients*sizeof(*cl.scores), "scores");
cl.scores = (scoreboard_t *) Hunk_AllocName (cl.maxclients*sizeof(*cl.scores), "scores");
// parse gametype
cl.gametype = MSG_ReadByte ();

View file

@ -121,7 +121,7 @@ void Cbuf_InsertText (char *text)
templen = cmd_text.cursize;
if (templen)
{
temp = Z_Malloc (templen);
temp = (char *) Z_Malloc (templen);
Q_memcpy (temp, cmd_text.data, templen);
SZ_Clear (&cmd_text);
}
@ -295,7 +295,7 @@ char *CopyString (char *in)
{
char *out;
out = Z_Malloc (strlen(in)+1);
out = (char *) Z_Malloc (strlen(in)+1);
strcpy (out, in);
return out;
}
@ -350,7 +350,7 @@ void Cmd_Alias_f (void)
if (!a)
{
a = Z_Malloc (sizeof(cmdalias_t));
a = (cmdalias_t *) Z_Malloc (sizeof(cmdalias_t));
a->next = cmd_alias;
cmd_alias = a;
}
@ -589,7 +589,7 @@ void Cmd_TokenizeString (char *text)
if (cmd_argc < MAX_ARGS)
{
cmd_argv[cmd_argc] = Z_Malloc (Q_strlen(com_token)+1);
cmd_argv[cmd_argc] = (char *) Z_Malloc (Q_strlen(com_token)+1);
Q_strcpy (cmd_argv[cmd_argc], com_token);
cmd_argc++;
}
@ -627,7 +627,7 @@ void Cmd_AddCommand (char *cmd_name, xcommand_t function)
}
}
cmd = Hunk_Alloc (sizeof(cmd_function_t));
cmd = (cmd_function_t *) Hunk_Alloc (sizeof(cmd_function_t));
cmd->name = cmd_name;
cmd->function = function;

View file

@ -534,7 +534,7 @@ void MSG_WriteChar (sizebuf_t *sb, int c)
Sys_Error ("MSG_WriteChar: range error");
#endif
buf = SZ_GetSpace (sb, 1);
buf = (byte *) SZ_GetSpace (sb, 1);
buf[0] = c;
}
@ -547,7 +547,7 @@ void MSG_WriteByte (sizebuf_t *sb, int c)
Sys_Error ("MSG_WriteByte: range error");
#endif
buf = SZ_GetSpace (sb, 1);
buf = (byte *) SZ_GetSpace (sb, 1);
buf[0] = c;
}
@ -560,7 +560,7 @@ void MSG_WriteShort (sizebuf_t *sb, int c)
Sys_Error ("MSG_WriteShort: range error");
#endif
buf = SZ_GetSpace (sb, 2);
buf = (byte *) SZ_GetSpace (sb, 2);
buf[0] = c&0xff;
buf[1] = c>>8;
}
@ -569,7 +569,7 @@ void MSG_WriteLong (sizebuf_t *sb, int c)
{
byte *buf;
buf = SZ_GetSpace (sb, 4);
buf = (byte *) SZ_GetSpace (sb, 4);
buf[0] = c&0xff;
buf[1] = (c>>8)&0xff;
buf[2] = (c>>16)&0xff;
@ -801,7 +801,7 @@ void SZ_Alloc (sizebuf_t *buf, int startsize)
{
if (startsize < 256)
startsize = 256;
buf->data = Hunk_AllocName (startsize, "sizebuf");
buf->data = (byte *) Hunk_AllocName (startsize, "sizebuf");
buf->maxsize = startsize;
buf->cursize = 0;
}
@ -1639,17 +1639,17 @@ byte *COM_LoadFile (char *path, int usehunk)
COM_FileBase (path, base);
if (usehunk == 1)
buf = Hunk_AllocName (len+1, base);
buf = (byte *) Hunk_AllocName (len+1, base);
else if (usehunk == 2)
buf = Hunk_TempAlloc (len+1);
buf = (byte *) Hunk_TempAlloc (len+1);
else if (usehunk == 0)
buf = Z_Malloc (len+1);
buf = (byte *) Z_Malloc (len+1);
else if (usehunk == 3)
buf = Cache_Alloc (loadcache, len+1, base);
buf = (byte *) Cache_Alloc (loadcache, len+1, base);
else if (usehunk == 4)
{
if (len+1 > loadsize)
buf = Hunk_TempAlloc (len+1);
buf = (byte *) Hunk_TempAlloc (len+1);
else
buf = loadbuf;
}
@ -1737,7 +1737,7 @@ pack_t *COM_LoadPackFile (char *packfile)
//johnfitz -- dynamic gamedir loading
//Hunk_AllocName (numpackfiles * sizeof(packfile_t), "packfile");
newfiles = Z_Malloc(numpackfiles * sizeof(packfile_t));
newfiles = (packfile_t *) Z_Malloc(numpackfiles * sizeof(packfile_t));
//johnfitz
Sys_FileSeek (packhandle, header.dirofs);
@ -1760,7 +1760,7 @@ pack_t *COM_LoadPackFile (char *packfile)
//johnfitz -- dynamic gamedir loading
//pack = Hunk_Alloc (sizeof (pack_t));
pack = Z_Malloc (sizeof (pack_t));
pack = (pack_t *) Z_Malloc (sizeof (pack_t));
//johnfitz
strcpy (pack->filename, packfile);
@ -1787,7 +1787,7 @@ void COM_AddGameDirectory (char *dir)
strcpy (com_gamedir, dir);
// add the directory to the search path
search = Z_Malloc(sizeof(searchpath_t));
search = (searchpath_t *) Z_Malloc(sizeof(searchpath_t));
strcpy (search->filename, dir);
search->next = com_searchpaths;
com_searchpaths = search;
@ -1799,7 +1799,7 @@ void COM_AddGameDirectory (char *dir)
pak = COM_LoadPackFile (pakfile);
if (!pak)
break;
search = Z_Malloc(sizeof(searchpath_t));
search = (searchpath_t *) Z_Malloc(sizeof(searchpath_t));
search->pack = pak;
search->next = com_searchpaths;
com_searchpaths = search;
@ -1897,7 +1897,7 @@ void COM_InitFilesystem (void) //johnfitz -- modified based on topaz's tutorial
{
if (!com_argv[i] || com_argv[i][0] == '+' || com_argv[i][0] == '-')
break;
search = Hunk_Alloc (sizeof(searchpath_t));
search = (searchpath_t *) Hunk_Alloc (sizeof(searchpath_t));
if (!strcmp(COM_FileExtension(com_argv[i]), "pak") )
{
search->pack = COM_LoadPackFile (com_argv[i]);

View file

@ -300,7 +300,7 @@ void Con_CheckResize (void)
numchars = con_linewidth;
mark = Hunk_LowMark (); //johnfitz
tbuf = Hunk_Alloc (con_buffersize); //johnfitz
tbuf = (char *) Hunk_Alloc (con_buffersize); //johnfitz
Q_memcpy (tbuf, con_text, con_buffersize);//johnfitz -- con_buffersize replaces CON_TEXTSIZE
Q_memset (con_text, ' ', con_buffersize);//johnfitz -- con_buffersize replaces CON_TEXTSIZE
@ -337,7 +337,7 @@ void Con_Init (void)
con_buffersize = CON_TEXTSIZE;
//johnfitz
con_text = Hunk_AllocName (con_buffersize, "context");//johnfitz -- con_buffersize replaces CON_TEXTSIZE
con_text = (char *) Hunk_AllocName (con_buffersize, "context");//johnfitz -- con_buffersize replaces CON_TEXTSIZE
Q_memset (con_text, ' ', con_buffersize);//johnfitz -- con_buffersize replaces CON_TEXTSIZE
con_linewidth = -1;
@ -767,7 +767,7 @@ void AddToTabList (char *name, char *type)
*i_bash = 0;
}
t = Hunk_Alloc(sizeof(tab_t));
t = (tab_t *) Hunk_Alloc(sizeof(tab_t));
t->name = name;
t->type = type;

View file

@ -334,7 +334,7 @@ void Cvar_Set (char *var_name, char *value)
Z_Free (var->string); // free the old value string
var->string = Z_Malloc (Q_strlen(value)+1);
var->string = (char *) Z_Malloc (Q_strlen(value)+1);
Q_strcpy (var->string, value);
var->value = Q_atof (var->string);
@ -342,7 +342,7 @@ void Cvar_Set (char *var_name, char *value)
if (!host_initialized)
{
Z_Free (var->default_string);
var->default_string = Z_Malloc (Q_strlen(value)+1);
var->default_string = (char *) Z_Malloc (Q_strlen(value)+1);
Q_strcpy (var->default_string, value);
}
//johnfitz
@ -400,12 +400,12 @@ void Cvar_RegisterVariable (cvar_t *variable, void *function)
// copy the value off, because future sets will Z_Free it
oldstr = variable->string;
variable->string = Z_Malloc (Q_strlen(variable->string)+1);
variable->string = (char *) Z_Malloc (Q_strlen(variable->string)+1);
Q_strcpy (variable->string, oldstr);
variable->value = Q_atof (variable->string);
//johnfitz -- save initial value for "reset" command
variable->default_string = Z_Malloc (Q_strlen(variable->string)+1);
variable->default_string = (char *) Z_Malloc (Q_strlen(variable->string)+1);
Q_strcpy (variable->default_string, oldstr);
//johnfitz
@ -431,7 +431,7 @@ void Cvar_RegisterVariable (cvar_t *variable, void *function)
}
//johnfitz
variable->callback = function; //johnfitz
variable->callback = (cvarcallback_t) function; //johnfitz
}
/*

View file

@ -58,6 +58,8 @@ Cvars are restricted from having the same names as commands to keep this
interface from being ambiguous.
*/
typedef void (*cvarcallback_t) (void);
typedef struct cvar_s
{
char *name;
@ -67,7 +69,7 @@ typedef struct cvar_s
float value;
struct cvar_s *next;
char *default_string; //johnfitz -- remember defaults for reset function
void (*callback) (void); //johnfitz
cvarcallback_t callback; //johnfitz
} cvar_t;
void Cvar_RegisterVariable (cvar_t *variable, void *function); //johnfitz -- cvar callback

View file

@ -218,7 +218,7 @@ qpic_t *Draw_PicFromWad (char *name)
glpic_t gl;
src_offset_t offset; //johnfitz
p = W_GetLumpName (name);
p = (qpic_t *) W_GetLumpName (name);
if (!p) return pic_nul; //johnfitz
// load little ones into the scrap
@ -377,7 +377,7 @@ qpic_t *Draw_MakePic (char *name, int width, int height, byte *data)
qpic_t *pic;
glpic_t gl;
pic = Hunk_Alloc (sizeof(qpic_t) - 4 + sizeof (glpic_t));
pic = (qpic_t *) Hunk_Alloc (sizeof(qpic_t) - 4 + sizeof (glpic_t));
pic->width = width;
pic->height = height;
@ -407,7 +407,7 @@ void Draw_LoadPics (void)
byte *data;
src_offset_t offset;
data = W_GetLumpName ("conchars");
data = (byte *) W_GetLumpName ("conchars");
if (!data) Sys_Error ("Draw_LoadPics: couldn't load conchars");
offset = (src_offset_t)data - (src_offset_t)wad_base;
char_texture = TexMgr_LoadImage (NULL, WADFILENAME":conchars", 128, 128, SRC_INDEXED, data,

View file

@ -312,7 +312,7 @@ void GL_MakeAliasModelDisplayLists (model_t *m, aliashdr_t *hdr)
paliashdr->poseverts = numorder;
cmds = Hunk_Alloc (numcommands * 4);
cmds = (int *) Hunk_Alloc (numcommands * 4);
paliashdr->commands = (byte *)cmds - (byte *)paliashdr;
//johnfitz -- precompute texcoords for padded skins
@ -335,7 +335,7 @@ void GL_MakeAliasModelDisplayLists (model_t *m, aliashdr_t *hdr)
}
//johnfitz
verts = Hunk_Alloc (paliashdr->numposes * paliashdr->poseverts * sizeof(trivertx_t));
verts = (trivertx_t *) Hunk_Alloc (paliashdr->numposes * paliashdr->poseverts * sizeof(trivertx_t));
paliashdr->posedata = (byte *)verts - (byte *)paliashdr;
for (i=0 ; i<paliashdr->numposes ; i++)
for (j=0 ; j<numorder ; j++)

View file

@ -53,11 +53,11 @@ void Mod_Init (void)
memset (mod_novis, 0xff, sizeof(mod_novis));
//johnfitz -- create notexture miptex
r_notexture_mip = Hunk_AllocName (sizeof(texture_t), "r_notexture_mip");
r_notexture_mip = (texture_t *) Hunk_AllocName (sizeof(texture_t), "r_notexture_mip");
strcpy (r_notexture_mip->name, "notexture");
r_notexture_mip->height = r_notexture_mip->width = 32;
r_notexture_mip2 = Hunk_AllocName (sizeof(texture_t), "r_notexture_mip2");
r_notexture_mip2 = (texture_t *) Hunk_AllocName (sizeof(texture_t), "r_notexture_mip2");
strcpy (r_notexture_mip2->name, "notexture2");
r_notexture_mip2->height = r_notexture_mip2->width = 32;
//johnfitz
@ -398,7 +398,7 @@ void Mod_LoadTextures (lump_t *l)
//johnfitz
loadmodel->numtextures = nummiptex + 2; //johnfitz -- need 2 dummy texture chains for missing textures
loadmodel->textures = Hunk_AllocName (loadmodel->numtextures * sizeof(*loadmodel->textures) , loadname);
loadmodel->textures = (texture_t **) Hunk_AllocName (loadmodel->numtextures * sizeof(*loadmodel->textures) , loadname);
for (i=0 ; i<nummiptex ; i++)
{
@ -414,7 +414,7 @@ void Mod_LoadTextures (lump_t *l)
if ( (mt->width & 15) || (mt->height & 15) )
Sys_Error ("Texture %s is not 16 aligned", mt->name);
pixels = mt->width*mt->height/64*85;
tx = Hunk_AllocName (sizeof(texture_t) +pixels, loadname );
tx = (texture_t *) Hunk_AllocName (sizeof(texture_t) +pixels, loadname );
loadmodel->textures[i] = tx;
memcpy (tx->name, mt->name, sizeof(tx->name));
@ -630,7 +630,6 @@ Mod_LoadLighting -- johnfitz -- replaced with lit support code via lordhavoc
*/
void Mod_LoadLighting (lump_t *l)
{
//
int i;
byte *in, *out, *data;
byte d;
@ -661,7 +660,7 @@ void Mod_LoadLighting (lump_t *l)
// LordHavoc: no .lit found, expand the white lighting data to color
if (!l->filelen)
return;
loadmodel->lightdata = Hunk_AllocName ( l->filelen*3, litfilename);
loadmodel->lightdata = (byte *) Hunk_AllocName ( l->filelen*3, litfilename);
in = loadmodel->lightdata + l->filelen*2; // place the file at the end, so it will not be overwritten until the very last write
out = loadmodel->lightdata;
memcpy (in, mod_base + l->fileofs, l->filelen);
@ -687,7 +686,7 @@ void Mod_LoadVisibility (lump_t *l)
loadmodel->visdata = NULL;
return;
}
loadmodel->visdata = Hunk_AllocName ( l->filelen, loadname);
loadmodel->visdata = (byte *) Hunk_AllocName ( l->filelen, loadname);
memcpy (loadmodel->visdata, mod_base + l->fileofs, l->filelen);
}
@ -704,7 +703,7 @@ void Mod_LoadEntities (lump_t *l)
loadmodel->entities = NULL;
return;
}
loadmodel->entities = Hunk_AllocName ( l->filelen, loadname);
loadmodel->entities = (char *) Hunk_AllocName ( l->filelen, loadname);
memcpy (loadmodel->entities, mod_base + l->fileofs, l->filelen);
}
@ -720,11 +719,11 @@ void Mod_LoadVertexes (lump_t *l)
mvertex_t *out;
int i, count;
in = (void *)(mod_base + l->fileofs);
in = (dvertex_t *)(mod_base + l->fileofs);
if (l->filelen % sizeof(*in))
Sys_Error ("MOD_LoadBmodel: funny lump size in %s",loadmodel->name);
count = l->filelen / sizeof(*in);
out = Hunk_AllocName ( count*sizeof(*out), loadname);
out = (mvertex_t *) Hunk_AllocName ( count*sizeof(*out), loadname);
loadmodel->vertexes = out;
loadmodel->numvertexes = count;
@ -746,13 +745,13 @@ void Mod_LoadEdges (lump_t *l)
{
dedge_t *in;
medge_t *out;
int i, count;
int i, count;
in = (void *)(mod_base + l->fileofs);
in = (dedge_t *)(mod_base + l->fileofs);
if (l->filelen % sizeof(*in))
Sys_Error ("MOD_LoadBmodel: funny lump size in %s",loadmodel->name);
count = l->filelen / sizeof(*in);
out = Hunk_AllocName ( (count + 1) * sizeof(*out), loadname);
out = (medge_t *) Hunk_AllocName ( (count + 1) * sizeof(*out), loadname);
loadmodel->edges = out;
loadmodel->numedges = count;
@ -773,15 +772,15 @@ void Mod_LoadTexinfo (lump_t *l)
{
texinfo_t *in;
mtexinfo_t *out;
int i, j, count, miptex;
int i, j, count, miptex;
float len1, len2;
int missing = 0; //johnfitz
in = (void *)(mod_base + l->fileofs);
in = (texinfo_t *)(mod_base + l->fileofs);
if (l->filelen % sizeof(*in))
Sys_Error ("MOD_LoadBmodel: funny lump size in %s",loadmodel->name);
count = l->filelen / sizeof(*in);
out = Hunk_AllocName ( count*sizeof(*out), loadname);
out = (mtexinfo_t *) Hunk_AllocName ( count*sizeof(*out), loadname);
loadmodel->texinfo = out;
loadmodel->numtexinfo = count;
@ -923,7 +922,7 @@ void Mod_PolyForUnlitSurface (msurface_t *fa)
}
//create the poly
poly = Hunk_Alloc (sizeof(glpoly_t) + (numverts-4) * VERTEXSIZE*sizeof(float));
poly = (glpoly_t *) Hunk_Alloc (sizeof(glpoly_t) + (numverts-4) * VERTEXSIZE*sizeof(float));
poly->next = NULL;
fa->polys = poly;
poly->numverts = numverts;
@ -984,11 +983,11 @@ void Mod_LoadFaces (lump_t *l)
int i, count, surfnum;
int planenum, side;
in = (void *)(mod_base + l->fileofs);
in = (dface_t *)(mod_base + l->fileofs);
if (l->filelen % sizeof(*in))
Sys_Error ("MOD_LoadBmodel: funny lump size in %s",loadmodel->name);
count = l->filelen / sizeof(*in);
out = Hunk_AllocName ( count*sizeof(*out), loadname);
out = (msurface_t *) Hunk_AllocName ( count*sizeof(*out), loadname);
//johnfitz -- warn mappers about exceeding old limits
if (count > 32767)
@ -1018,7 +1017,6 @@ void Mod_LoadFaces (lump_t *l)
Mod_CalcSurfaceBounds (out); //johnfitz -- for per-surface frustum culling
// lighting info
for (i=0 ; i<MAXLIGHTMAPS ; i++)
out->styles[i] = in->styles[i];
i = LittleLong(in->lightofs);
@ -1079,13 +1077,13 @@ void Mod_LoadNodes (lump_t *l)
{
int i, j, count, p;
dnode_t *in;
mnode_t *out;
mnode_t *out;
in = (void *)(mod_base + l->fileofs);
in = (dnode_t *)(mod_base + l->fileofs);
if (l->filelen % sizeof(*in))
Sys_Error ("MOD_LoadBmodel: funny lump size in %s",loadmodel->name);
count = l->filelen / sizeof(*in);
out = Hunk_AllocName ( count*sizeof(*out), loadname);
out = (mnode_t *) Hunk_AllocName ( count*sizeof(*out), loadname);
//johnfitz -- warn mappers about exceeding old limits
if (count > 32767)
@ -1140,15 +1138,15 @@ Mod_LoadLeafs
*/
void Mod_LoadLeafs (lump_t *l)
{
dleaf_t *in;
mleaf_t *out;
dleaf_t *in;
mleaf_t *out;
int i, j, count, p;
in = (void *)(mod_base + l->fileofs);
in = (dleaf_t *)(mod_base + l->fileofs);
if (l->filelen % sizeof(*in))
Sys_Error ("MOD_LoadBmodel: funny lump size in %s",loadmodel->name);
count = l->filelen / sizeof(*in);
out = Hunk_AllocName ( count*sizeof(*out), loadname);
out = (mleaf_t *) Hunk_AllocName ( count*sizeof(*out), loadname);
//johnfitz
if (count > 32767)
@ -1198,11 +1196,11 @@ void Mod_LoadClipnodes (lump_t *l)
int i, count;
hull_t *hull;
in = (void *)(mod_base + l->fileofs);
in = (dclipnode_t *)(mod_base + l->fileofs);
if (l->filelen % sizeof(*in))
Sys_Error ("MOD_LoadBmodel: funny lump size in %s",loadmodel->name);
count = l->filelen / sizeof(*in);
out = Hunk_AllocName ( count*sizeof(*out), loadname);
out = (mclipnode_t *) Hunk_AllocName ( count*sizeof(*out), loadname);
//johnfitz -- warn about exceeding old limits
if (count > 32767)
@ -1274,7 +1272,7 @@ void Mod_MakeHull0 (void)
in = loadmodel->nodes;
count = loadmodel->numnodes;
out = Hunk_AllocName ( count*sizeof(*out), loadname);
out = (mclipnode_t *) Hunk_AllocName ( count*sizeof(*out), loadname);
hull->clipnodes = out;
hull->firstclipnode = 0;
@ -1306,11 +1304,11 @@ void Mod_LoadMarksurfaces (lump_t *l)
short *in;
msurface_t **out;
in = (void *)(mod_base + l->fileofs);
in = (short *)(mod_base + l->fileofs);
if (l->filelen % sizeof(*in))
Sys_Error ("MOD_LoadBmodel: funny lump size in %s",loadmodel->name);
count = l->filelen / sizeof(*in);
out = Hunk_AllocName ( count*sizeof(*out), loadname);
out = (msurface_t **) Hunk_AllocName ( count*sizeof(*out), loadname);
loadmodel->marksurfaces = out;
loadmodel->nummarksurfaces = count;
@ -1339,11 +1337,11 @@ void Mod_LoadSurfedges (lump_t *l)
int i, count;
int *in, *out;
in = (void *)(mod_base + l->fileofs);
in = (int *)(mod_base + l->fileofs);
if (l->filelen % sizeof(*in))
Sys_Error ("MOD_LoadBmodel: funny lump size in %s",loadmodel->name);
count = l->filelen / sizeof(*in);
out = Hunk_AllocName ( count*sizeof(*out), loadname);
out = (int *) Hunk_AllocName ( count*sizeof(*out), loadname);
loadmodel->surfedges = out;
loadmodel->numsurfedges = count;
@ -1366,11 +1364,11 @@ void Mod_LoadPlanes (lump_t *l)
int count;
int bits;
in = (void *)(mod_base + l->fileofs);
in = (dplane_t *)(mod_base + l->fileofs);
if (l->filelen % sizeof(*in))
Sys_Error ("MOD_LoadBmodel: funny lump size in %s",loadmodel->name);
count = l->filelen / sizeof(*in);
out = Hunk_AllocName ( count*2*sizeof(*out), loadname);
out = (mplane_t *) Hunk_AllocName ( count*2*sizeof(*out), loadname);
loadmodel->planes = out;
loadmodel->numplanes = count;
@ -1420,11 +1418,11 @@ void Mod_LoadSubmodels (lump_t *l)
dmodel_t *out;
int i, j, count;
in = (void *)(mod_base + l->fileofs);
in = (dmodel_t *)(mod_base + l->fileofs);
if (l->filelen % sizeof(*in))
Sys_Error ("MOD_LoadBmodel: funny lump size in %s",loadmodel->name);
count = l->filelen / sizeof(*in);
out = Hunk_AllocName ( count*sizeof(*out), loadname);
out = (dmodel_t *) Hunk_AllocName ( count*sizeof(*out), loadname);
loadmodel->submodels = out;
loadmodel->numsubmodels = count;
@ -1826,7 +1824,7 @@ void *Mod_LoadAllSkins (int numskins, daliasskintype_t *pskintype)
Mod_FloodFillSkin( skin, pheader->skinwidth, pheader->skinheight );
// save 8 bit texels for the player model to remap
texels = Hunk_AllocName(size, loadname);
texels = (byte *) Hunk_AllocName(size, loadname);
pheader->texels[i] = texels - (byte *)pheader;
memcpy (texels, (byte *)(pskintype + 1), size);
@ -1862,13 +1860,13 @@ void *Mod_LoadAllSkins (int numskins, daliasskintype_t *pskintype)
groupskins = LittleLong (pinskingroup->numskins);
pinskinintervals = (daliasskininterval_t *)(pinskingroup + 1);
pskintype = (void *)(pinskinintervals + groupskins);
pskintype = (daliasskintype_t *)(pinskinintervals + groupskins);
for (j=0 ; j<groupskins ; j++)
{
Mod_FloodFillSkin( skin, pheader->skinwidth, pheader->skinheight );
if (j == 0) {
texels = Hunk_AllocName(size, loadname);
texels = (byte *) Hunk_AllocName(size, loadname);
pheader->texels[i] = texels - (byte *)pheader;
memcpy (texels, (byte *)(pskintype), size);
}
@ -2038,7 +2036,7 @@ void Mod_LoadAliasModel (model_t *mod, void *buffer)
size = sizeof (aliashdr_t)
+ (LittleLong (pinmodel->numframes) - 1) *
sizeof (pheader->frames[0]);
pheader = Hunk_AllocName (size, loadname);
pheader = (aliashdr_t *) Hunk_AllocName (size, loadname);
mod->flags = LittleLong (pinmodel->flags);
@ -2088,7 +2086,7 @@ void Mod_LoadAliasModel (model_t *mod, void *buffer)
// load the skins
//
pskintype = (daliasskintype_t *)&pinmodel[1];
pskintype = Mod_LoadAllSkins (pheader->numskins, pskintype);
pskintype = (daliasskintype_t *) Mod_LoadAllSkins (pheader->numskins, pskintype);
//
// load base s and t vertices
@ -2182,7 +2180,7 @@ void * Mod_LoadSpriteFrame (void * pin, mspriteframe_t **ppframe, int framenum)
height = LittleLong (pinframe->height);
size = width * height;
pspriteframe = Hunk_AllocName (sizeof (mspriteframe_t),loadname);
pspriteframe = (mspriteframe_t *) Hunk_AllocName (sizeof (mspriteframe_t),loadname);
Q_memset (pspriteframe, 0, sizeof (mspriteframe_t));
@ -2231,7 +2229,7 @@ void * Mod_LoadSpriteGroup (void * pin, mspriteframe_t **ppframe, int framenum)
numframes = LittleLong (pingroup->numframes);
pspritegroup = Hunk_AllocName (sizeof (mspritegroup_t) +
pspritegroup = (mspritegroup_t *) Hunk_AllocName (sizeof (mspritegroup_t) +
(numframes - 1) * sizeof (pspritegroup->frames[0]), loadname);
pspritegroup->numframes = numframes;
@ -2240,7 +2238,7 @@ void * Mod_LoadSpriteGroup (void * pin, mspriteframe_t **ppframe, int framenum)
pin_intervals = (dspriteinterval_t *)(pingroup + 1);
poutintervals = Hunk_AllocName (numframes * sizeof (float), loadname);
poutintervals = (float *) Hunk_AllocName (numframes * sizeof (float), loadname);
pspritegroup->intervals = poutintervals;
@ -2292,7 +2290,7 @@ void Mod_LoadSpriteModel (model_t *mod, void *buffer)
size = sizeof (msprite_t) + (numframes - 1) * sizeof (psprite->frames);
psprite = Hunk_AllocName (size, loadname);
psprite = (msprite_t *) Hunk_AllocName (size, loadname);
mod->cache.data = psprite;
@ -2362,4 +2360,3 @@ void Mod_Print (void)
Con_Printf ("%i models\n",mod_numknown); //johnfitz -- print the total too
}

View file

@ -750,7 +750,7 @@ void SCR_ScreenShot_f (void)
}
//get data
buffer = malloc(glwidth*glheight*3);
buffer = (byte *) malloc(glwidth*glheight*3);
glReadPixels (glx, gly, glwidth, glheight, GL_RGB, GL_UNSIGNED_BYTE, buffer);
// now write the file

View file

@ -591,7 +591,7 @@ void Sky_ProcessEntities (void)
{
//copy the polygon and translate manually, since Sky_ProcessPoly needs it to be in world space
mark = Hunk_LowMark();
p = Hunk_Alloc (sizeof(*s->polys)); //FIXME: don't allocate for each poly
p = (glpoly_t *) Hunk_Alloc (sizeof(*s->polys)); //FIXME: don't allocate for each poly
p->numverts = s->polys->numverts;
for (k=0; k<p->numverts; k++)
{
@ -891,7 +891,7 @@ void Sky_DrawFace (int axis)
Sky_SetBoxVert(1.0, -1.0, axis, verts[3]);
start = Hunk_LowMark ();
p = Hunk_Alloc(sizeof(glpoly_t));
p = (glpoly_t *) Hunk_Alloc(sizeof(glpoly_t));
VectorSubtract(verts[2],verts[3],vup);
VectorSubtract(verts[2],verts[1],vright);

View file

@ -245,13 +245,13 @@ void TexMgr_Imagedump_f (void)
GL_Bind (glt);
if (glt->flags & TEXPREF_ALPHA)
{
buffer = malloc(glt->width*glt->height*4);
buffer = (byte *) malloc(glt->width*glt->height*4);
glGetTexImage(GL_TEXTURE_2D, 0, GL_RGBA, GL_UNSIGNED_BYTE, buffer);
Image_WriteTGA (tganame, buffer, glt->width, glt->height, 32, true);
}
else
{
buffer = malloc(glt->width*glt->height*3);
buffer = (byte *) malloc(glt->width*glt->height*3);
glGetTexImage(GL_TEXTURE_2D, 0, GL_RGB, GL_UNSIGNED_BYTE, buffer);
Image_WriteTGA (tganame, buffer, glt->width, glt->height, 24, true);
}
@ -438,7 +438,7 @@ void TexMgr_LoadPalette (void)
Sys_Error ("Couldn't load gfx/palette.lmp");
mark = Hunk_LowMark ();
pal = Hunk_Alloc (768);
pal = (byte *) Hunk_Alloc (768);
fread (pal, 1, 768, f);
fclose(f);
@ -532,7 +532,7 @@ void TexMgr_RecalcWarpImageSize (void)
// resize the textures in opengl
//
mark = Hunk_LowMark();
dummy = Hunk_Alloc (gl_warpimagesize*gl_warpimagesize*4);
dummy = (byte *) Hunk_Alloc (gl_warpimagesize*gl_warpimagesize*4);
for (glt=active_gltextures; glt; glt=glt->next)
{
@ -709,7 +709,7 @@ unsigned *TexMgr_ResampleTexture (unsigned *in, int inwidth, int inheight, qbool
outwidth = TexMgr_Pad(inwidth);
outheight = TexMgr_Pad(inheight);
out = Hunk_Alloc(outwidth*outheight*4);
out = (unsigned *) Hunk_Alloc(outwidth*outheight*4);
xfrac = ((inwidth-1) << 16) / (outwidth-1);
yfrac = ((inheight-1) << 16) / (outheight-1);
@ -889,7 +889,7 @@ unsigned *TexMgr_8to32 (byte *in, int pixels, unsigned int *usepal)
int i;
unsigned *out, *data;
out = data = Hunk_Alloc(pixels*4);
out = data = (unsigned *) Hunk_Alloc(pixels*4);
for (i=0 ; i<pixels ; i++)
*out++ = usepal[*in++];
@ -912,7 +912,7 @@ byte *TexMgr_PadImageW (byte *in, int width, int height, byte padbyte)
outwidth = TexMgr_Pad(width);
out = data = Hunk_Alloc(outwidth*height);
out = data = (byte *) Hunk_Alloc(outwidth*height);
for (i=0; i<height; i++)
{
@ -941,7 +941,7 @@ byte *TexMgr_PadImageH (byte *in, int width, int height, byte padbyte)
srcpix = width * height;
dstpix = width * TexMgr_Pad(height);
out = data = Hunk_Alloc(dstpix);
out = data = (byte *) Hunk_Alloc(dstpix);
for (i=0; i<srcpix; i++)
*out++ = *in++;
@ -1279,7 +1279,7 @@ invalid:
//translate texture
size = glt->width * glt->height;
dst = translated = Hunk_Alloc (size);
dst = translated = (byte *) Hunk_Alloc (size);
src = data;
for (i=0; i<size; i++)

View file

@ -526,10 +526,10 @@ char *GL_MakeNiceExtensionsList (const char *in)
for (i = 0, count = 1; i < strlen(in); i++)
if (in[i] == ' ')
count++;
out = Z_Malloc (strlen(in) + count*3 + 1); //usually about 1-2k
out = (char *) Z_Malloc (strlen(in) + count*3 + 1); //usually about 1-2k
out[0] = 0;
copy = Z_Malloc(strlen(in) + 1);
copy = (char *) Z_Malloc(strlen(in) + 1);
strcpy(copy, in);
for (token = strtok(copy, " "); token; token = strtok(NULL, " "))
@ -608,8 +608,10 @@ void GL_CheckExtensions (void)
else
if (strstr(gl_extensions, "GL_ARB_multitexture"))
{
GL_MTexCoord2fFunc = SDL_GL_GetProcAddress("glMultiTexCoord2fARB");
GL_SelectTextureFunc = SDL_GL_GetProcAddress("glActiveTextureARB");
GL_MTexCoord2fFunc = (PFNGLMULTITEXCOORD2FARBPROC)
SDL_GL_GetProcAddress("glMultiTexCoord2fARB");
GL_SelectTextureFunc = (PFNGLACTIVETEXTUREARBPROC)
SDL_GL_GetProcAddress("glActiveTextureARB");
if (GL_MTexCoord2fFunc && GL_SelectTextureFunc)
{
Con_Printf("FOUND: ARB_multitexture\n");
@ -623,8 +625,10 @@ void GL_CheckExtensions (void)
else
if (strstr(gl_extensions, "GL_SGIS_multitexture"))
{
GL_MTexCoord2fFunc = SDL_GL_GetProcAddress("glMTexCoord2fSGIS");
GL_SelectTextureFunc = SDL_GL_GetProcAddress("glSelectTextureSGIS");
GL_MTexCoord2fFunc = (PFNGLMULTITEXCOORD2FARBPROC)
SDL_GL_GetProcAddress("glMTexCoord2fSGIS");
GL_SelectTextureFunc = (PFNGLACTIVETEXTUREARBPROC)
SDL_GL_GetProcAddress("glSelectTextureSGIS");
if (GL_MTexCoord2fFunc && GL_SelectTextureFunc)
{
Con_Printf("FOUND: SGIS_multitexture\n");

View file

@ -138,7 +138,7 @@ void SubdividePolygon (int numverts, float *verts)
return;
}
poly = Hunk_Alloc (sizeof(glpoly_t) + (numverts-4) * VERTEXSIZE*sizeof(float));
poly = (glpoly_t *) Hunk_Alloc (sizeof(glpoly_t) + (numverts-4) * VERTEXSIZE*sizeof(float));
poly->next = warpface->polys->next;
warpface->polys->next = poly;
poly->numverts = numverts;

View file

@ -214,7 +214,7 @@ void Host_FindMaxClients (void)
svs.maxclientslimit = svs.maxclients;
if (svs.maxclientslimit < 4)
svs.maxclientslimit = 4;
svs.clients = Hunk_AllocName (svs.maxclientslimit*sizeof(client_t), "clients");
svs.clients = (struct client_s *) Hunk_AllocName (svs.maxclientslimit*sizeof(client_t), "clients");
if (svs.maxclients > 1)
Cvar_SetValue ("deathmatch", 1.0);

View file

@ -170,7 +170,7 @@ void Host_Game_f (void)
if (Q_strcasecmp(Cmd_Argv(1), GAMENAME)) //game is not id1
{
search = Z_Malloc(sizeof(searchpath_t));
search = (searchpath_t *) Z_Malloc(sizeof(searchpath_t));
strcpy (search->filename, pakfile);
search->next = com_searchpaths;
com_searchpaths = search;
@ -182,7 +182,7 @@ void Host_Game_f (void)
pak = COM_LoadPackFile (pakfile);
if (!pak)
break;
search = Z_Malloc(sizeof(searchpath_t));
search = (searchpath_t *) Z_Malloc(sizeof(searchpath_t));
search->pack = pak;
search->next = com_searchpaths;
com_searchpaths = search;
@ -227,7 +227,7 @@ void ExtraMaps_Add (char *name)
if (!Q_strcmp (name, level->name))
return;
level = Z_Malloc(sizeof(extralevel_t));
level = (extralevel_t *) Z_Malloc(sizeof(extralevel_t));
strcpy (level->name, name);
//insert each entry in alphabetical order
@ -359,7 +359,7 @@ void Modlist_Add (char *name)
if (!Q_strcmp (name, mod->name))
return;
mod = Z_Malloc(sizeof(mod_t));
mod = (mod_t *) Z_Malloc(sizeof(mod_t));
strcpy (mod->name, name);
//insert each entry in alphabetical order
@ -1149,7 +1149,7 @@ void Host_Loadgame_f (void)
for (i=0 ; i<MAX_LIGHTSTYLES ; i++)
{
fscanf (f, "%s\n", str);
sv.lightstyles[i] = Hunk_Alloc (strlen(str)+1);
sv.lightstyles[i] = (char *) Hunk_Alloc (strlen(str)+1);
strcpy (sv.lightstyles[i], str);
}

View file

@ -177,7 +177,7 @@ byte *Image_LoadTGA (FILE *fin, int *width, int *height)
numPixels = columns * rows;
upside_down = !(targa_header.attributes & 0x20); //johnfitz -- fix for upside-down targas
targa_rgba = Hunk_Alloc (numPixels*4);
targa_rgba = (byte *) Hunk_Alloc (numPixels*4);
if (targa_header.id_length != 0)
fseek(fin, targa_header.id_length, SEEK_CUR); // skip TARGA image comment
@ -378,7 +378,7 @@ byte *Image_LoadPCX (FILE *f, int *width, int *height)
w = pcx.xmax - pcx.xmin + 1;
h = pcx.ymax - pcx.ymin + 1;
data = Hunk_Alloc((w*h+1)*4); //+1 to allow reading padding byte on last line
data = (byte *) Hunk_Alloc((w*h+1)*4); //+1 to allow reading padding byte on last line
//load palette
fseek (f, start + com_filesize - 768, SEEK_SET);

View file

@ -792,7 +792,7 @@ void BuildSurfaceDisplayList (msurface_t *fa)
//
// draw texture
//
poly = Hunk_Alloc (sizeof(glpoly_t) + (lnumverts-4) * VERTEXSIZE*sizeof(float));
poly = (glpoly_t *) Hunk_Alloc (sizeof(glpoly_t) + (lnumverts-4) * VERTEXSIZE*sizeof(float));
poly->next = fa->polys;
fa->polys = poly;
poly->numverts = lnumverts;

View file

@ -35,7 +35,7 @@ mspriteframe_t *R_GetSpriteFrame (entity_t *currententity)
int i, numframes, frame;
float *pintervals, fullinterval, targettime, time;
psprite = currententity->model->cache.data;
psprite = (msprite_t *) currententity->model->cache.data;
frame = currententity->frame;
if ((frame >= psprite->numframes) || (frame < 0))
@ -89,7 +89,7 @@ void R_DrawSpriteModel (entity_t *e)
//TODO: frustum cull it?
frame = R_GetSpriteFrame (e);
psprite = currententity->model->cache.data;
psprite = (msprite_t *) currententity->model->cache.data;
switch(psprite->type)
{

View file

@ -171,7 +171,7 @@ void S_Init (void)
SND_InitScaletable ();
known_sfx = Hunk_AllocName (MAX_SFX*sizeof(sfx_t), "sfx_t");
known_sfx = (sfx_t *) Hunk_AllocName (MAX_SFX*sizeof(sfx_t), "sfx_t");
num_sfx = 0;
snd_initialized = true;
@ -885,7 +885,7 @@ void S_SoundList(void)
total = 0;
for (sfx=known_sfx, i=0 ; i<num_sfx ; i++, sfx++)
{
sc = Cache_Check (&sfx->cache);
sc = (sfxcache_t *) Cache_Check (&sfx->cache);
if (!sc)
continue;
size = sc->length*sc->width*(sc->stereo+1);

View file

@ -40,7 +40,7 @@ void ResampleSfx (sfx_t *sfx, int inrate, int inwidth, byte *data)
int sample, samplefrac, fracstep;
sfxcache_t *sc;
sc = Cache_Check (&sfx->cache);
sc = (sfxcache_t *) Cache_Check (&sfx->cache);
if (!sc)
return;
@ -106,7 +106,7 @@ sfxcache_t *S_LoadSound (sfx_t *s)
byte stackbuf[1*1024]; // avoid dirtying the cache heap
// see if still in memory
sc = Cache_Check (&s->cache);
sc = (sfxcache_t *) Cache_Check (&s->cache);
if (sc)
return sc;
@ -137,7 +137,7 @@ sfxcache_t *S_LoadSound (sfx_t *s)
len = len * info.width * info.channels;
sc = Cache_Alloc ( &s->cache, len + sizeof(sfxcache_t), s->name);
sc = (sfxcache_t *) Cache_Alloc ( &s->cache, len + sizeof(sfxcache_t), s->name);
if (!sc)
return NULL;

View file

@ -1323,7 +1323,7 @@ void SV_SpawnServer (char *server)
// allocate server memory
sv.max_edicts = CLAMP (MIN_EDICTS,(int)max_edicts.value,MAX_EDICTS); //johnfitz -- max_edicts cvar
sv.edicts = Hunk_AllocName (sv.max_edicts*pr_edict_size, "edicts");
sv.edicts = (edict_t *) Hunk_AllocName (sv.max_edicts*pr_edict_size, "edicts");
sv.datagram.maxsize = sizeof(sv.datagram_buf);
sv.datagram.cursize = 0;

View file

@ -474,8 +474,8 @@ void SV_PushMove (edict_t *pusher, float movetime)
//johnfitz -- dynamically allocate
mark = Hunk_LowMark ();
moved_edict = Hunk_Alloc (sv.num_edicts*sizeof(edict_t *));
moved_from = Hunk_Alloc (sv.num_edicts*sizeof(vec3_t));
moved_edict = (edict_t **) Hunk_Alloc (sv.num_edicts*sizeof(edict_t *));
moved_from = (vec3_t *) Hunk_Alloc (sv.num_edicts*sizeof(vec3_t));
//johnfitz
// see if any solid entities are inside the final position

View file

@ -962,7 +962,7 @@ void Memory_Init (void *buf, int size)
int p;
int zonesize = DYNAMIC_SIZE;
hunk_base = buf;
hunk_base = (byte *) buf;
hunk_size = size;
hunk_low_used = 0;
hunk_high_used = 0;
@ -976,7 +976,7 @@ void Memory_Init (void *buf, int size)
else
Sys_Error ("Memory_Init: you must specify a size in KB after -zone");
}
mainzone = Hunk_AllocName (zonesize, "zone" );
mainzone = (memzone_t *) Hunk_AllocName (zonesize, "zone" );
Memory_InitZone (mainzone, zonesize);
Cmd_AddCommand ("hunk_print", Hunk_Print_f); //johnfitz