// called by engine
void CG_Init(void)
{
- localentity = CGVM_Malloc(sizeof(*localentity) * MAX_LOCALENTITIES);
- localentityactive = CGVM_Malloc(sizeof(*localentityactive) * MAX_LOCALENTITIES);
- localentityfreetime = CGVM_Malloc(sizeof(*localentityfreetime) * MAX_LOCALENTITIES);
- phys_entity = CGVM_Malloc(sizeof(*phys_entity) * MAX_LOCALENTITIES);
+ localentity = (localentity_t *)CGVM_Malloc(sizeof(*localentity) * MAX_LOCALENTITIES);
+ localentityactive = (unsigned char *)CGVM_Malloc(sizeof(*localentityactive) * MAX_LOCALENTITIES);
+ localentityfreetime = (float *)CGVM_Malloc(sizeof(*localentityfreetime) * MAX_LOCALENTITIES);
+ phys_entity = (cgphysentity_t *)CGVM_Malloc(sizeof(*phys_entity) * MAX_LOCALENTITIES);
CGVM_RegisterNetworkCode(1, net_explosion);
CGVM_RegisterNetworkCode(2, net_gibshower);
gametime = 0;
cl_max_lightstyle = MAX_LIGHTSTYLES;
cl_max_brushmodel_entities = MAX_EDICTS;
- cl_entities = Mem_Alloc(cl_mempool, cl_max_entities * sizeof(entity_t));
- cl_entities_active = Mem_Alloc(cl_mempool, cl_max_brushmodel_entities * sizeof(qbyte));
- cl_static_entities = Mem_Alloc(cl_mempool, cl_max_static_entities * sizeof(entity_t));
- cl_temp_entities = Mem_Alloc(cl_mempool, cl_max_temp_entities * sizeof(entity_t));
- cl_effects = Mem_Alloc(cl_mempool, cl_max_effects * sizeof(cl_effect_t));
- cl_beams = Mem_Alloc(cl_mempool, cl_max_beams * sizeof(beam_t));
- cl_dlights = Mem_Alloc(cl_mempool, cl_max_dlights * sizeof(dlight_t));
- cl_lightstyle = Mem_Alloc(cl_mempool, cl_max_lightstyle * sizeof(lightstyle_t));
- cl_brushmodel_entities = Mem_Alloc(cl_mempool, cl_max_brushmodel_entities * sizeof(int));
+ cl_entities = (entity_t *)Mem_Alloc(cl_mempool, cl_max_entities * sizeof(entity_t));
+ cl_entities_active = (qbyte *)Mem_Alloc(cl_mempool, cl_max_brushmodel_entities * sizeof(qbyte));
+ cl_static_entities = (entity_t *)Mem_Alloc(cl_mempool, cl_max_static_entities * sizeof(entity_t));
+ cl_temp_entities = (entity_t *)Mem_Alloc(cl_mempool, cl_max_temp_entities * sizeof(entity_t));
+ cl_effects = (cl_effect_t *)Mem_Alloc(cl_mempool, cl_max_effects * sizeof(cl_effect_t));
+ cl_beams = (beam_t *)Mem_Alloc(cl_mempool, cl_max_beams * sizeof(beam_t));
+ cl_dlights = (dlight_t *)Mem_Alloc(cl_mempool, cl_max_dlights * sizeof(dlight_t));
+ cl_lightstyle = (lightstyle_t *)Mem_Alloc(cl_mempool, cl_max_lightstyle * sizeof(lightstyle_t));
+ cl_brushmodel_entities = (int *)Mem_Alloc(cl_mempool, cl_max_brushmodel_entities * sizeof(int));
cl_lastquakeentity = 0;
memset(cl_isquakeentity, 0, sizeof(cl_isquakeentity));
oldmaxentities = cl_max_entities;
oldentities = cl_entities;
cl_max_entities = (num & ~255) + 256;
- cl_entities = Mem_Alloc(cl_mempool, cl_max_entities * sizeof(entity_t));
+ cl_entities = (entity_t *)Mem_Alloc(cl_mempool, cl_max_entities * sizeof(entity_t));
memcpy(cl_entities, oldentities, oldmaxentities * sizeof(entity_t));
Mem_Free(oldentities);
for (i = oldmaxentities;i < cl_max_entities;i++)
memset(&r_refdef, 0, sizeof(r_refdef));
// max entities sent to renderer per frame
r_refdef.maxentities = MAX_EDICTS + 256 + 512;
- r_refdef.entities = Mem_Alloc(cl_mempool, sizeof(entity_render_t *) * r_refdef.maxentities);
+ r_refdef.entities = (entity_render_t **)Mem_Alloc(cl_mempool, sizeof(entity_render_t *) * r_refdef.maxentities);
// 256k drawqueue buffer
r_refdef.maxdrawqueuesize = 256 * 1024;
- r_refdef.drawqueue = Mem_Alloc(cl_mempool, r_refdef.maxdrawqueuesize);
+ r_refdef.drawqueue = (qbyte *)Mem_Alloc(cl_mempool, r_refdef.maxdrawqueuesize);
cls.message.data = cls.message_buf;
cls.message.maxsize = sizeof(cls.message_buf);
Host_Error("Bad maxclients (%u) from server\n", cl.maxclients);
return;
}
- cl.scores = Mem_Alloc(cl_mempool, cl.maxclients*sizeof(*cl.scores));
+ cl.scores = (scoreboard_t *)Mem_Alloc(cl_mempool, cl.maxclients*sizeof(*cl.scores));
// parse gametype
cl.gametype = MSG_ReadByte ();
// and white on black background) so we can alpha fade it to black, then
// we invert it again during the blendfunc to make it work...
- particletexturedata = Mem_Alloc(tempmempool, PARTICLEFONTSIZE*PARTICLEFONTSIZE*4);
+ particletexturedata = (qbyte *)Mem_Alloc(tempmempool, PARTICLEFONTSIZE*PARTICLEFONTSIZE*4);
memset(particletexturedata, 255, PARTICLEFONTSIZE*PARTICLEFONTSIZE*4);
// smoke
#else
void R_DrawParticleCallback(const void *calldata1, int calldata2)
{
- const particle_t *p = calldata1;
+ const particle_t *p = (particle_t *)calldata1;
rmeshstate_t m;
#endif
pblend_t blendmode;
green = bound(0, green, 1);
blue = bound(0, blue, 1);
alpha = bound(0, alpha, 1);
- dq = (void *)(r_refdef.drawqueue + r_refdef.drawqueuesize);
+ dq = (drawqueue_t *)(r_refdef.drawqueue + r_refdef.drawqueuesize);
dq->size = size;
dq->command = DRAWQUEUE_STRING;
dq->flags = flags;
size += sizeof(float[4]) * mesh->num_vertices;
if (r_refdef.drawqueuesize + size > r_refdef.maxdrawqueuesize)
return;
- dq = (void *)(r_refdef.drawqueue + r_refdef.drawqueuesize);
+ dq = (drawqueue_t *)(r_refdef.drawqueue + r_refdef.drawqueuesize);
dq->size = size;
dq->command = DRAWQUEUE_MESH;
dq->flags = flags;
dq->scalex = 0;
dq->scaley = 0;
p = (void *)(dq + 1);
- m = p;p = (qbyte*)p + sizeof(drawqueuemesh_t);
+ m = (drawqueuemesh_t *)p;p = (qbyte*)p + sizeof(drawqueuemesh_t);
m->num_triangles = mesh->num_triangles;
m->num_vertices = mesh->num_vertices;
m->texture = mesh->texture;
- m->data_element3i = p;memcpy(m->data_element3i , mesh->data_element3i , m->num_triangles * sizeof(int[3]));p = (qbyte*)p + m->num_triangles * sizeof(int[3]);
- m->data_vertex3f = p;memcpy(m->data_vertex3f , mesh->data_vertex3f , m->num_vertices * sizeof(float[3]));p = (qbyte*)p + m->num_vertices * sizeof(float[3]);
- m->data_texcoord2f = p;memcpy(m->data_texcoord2f, mesh->data_texcoord2f, m->num_vertices * sizeof(float[2]));p = (qbyte*)p + m->num_vertices * sizeof(float[2]);
- m->data_color4f = p;memcpy(m->data_color4f , mesh->data_color4f , m->num_vertices * sizeof(float[4]));p = (qbyte*)p + m->num_vertices * sizeof(float[4]);
+ m->data_element3i = (int *)p;memcpy(m->data_element3i , mesh->data_element3i , m->num_triangles * sizeof(int[3]));p = (qbyte*)p + m->num_triangles * sizeof(int[3]);
+ m->data_vertex3f = (float *)p;memcpy(m->data_vertex3f , mesh->data_vertex3f , m->num_vertices * sizeof(float[3]));p = (qbyte*)p + m->num_vertices * sizeof(float[3]);
+ m->data_texcoord2f = (float *)p;memcpy(m->data_texcoord2f, mesh->data_texcoord2f, m->num_vertices * sizeof(float[2]));p = (qbyte*)p + m->num_vertices * sizeof(float[2]);
+ m->data_color4f = (float *)p;memcpy(m->data_color4f , mesh->data_color4f , m->num_vertices * sizeof(float[4]));p = (qbyte*)p + m->num_vertices * sizeof(float[4]);
r_refdef.drawqueuesize += dq->size;
}
Con_DPrint("DrawQueue full !\n");
return;
}
- dq = (void*) (r_refdef.drawqueue + r_refdef.drawqueuesize);
+ dq = (drawqueue_t *) (r_refdef.drawqueue + r_refdef.drawqueuesize);
dq->size = sizeof(*dq);
dq->command = DRAWQUEUE_SETCLIP;
dq->x = x;
Con_DPrint("DrawQueue full !\n");
return;
}
- dq = (void*) (r_refdef.drawqueue + r_refdef.drawqueuesize);
+ dq = (drawqueue_t *) (r_refdef.drawqueue + r_refdef.drawqueuesize);
dq->size = sizeof(*dq);
dq->command = DRAWQUEUE_RESETCLIP;
dq->x = 0;
sprintf(filename, "%s%06d.%s", base, shotnumber, jpeg ? "jpg" : "tga");
- buffer1 = Mem_Alloc(tempmempool, vid.width * vid.height * 3);
- buffer2 = Mem_Alloc(tempmempool, vid.width * vid.height * 3);
- buffer3 = Mem_Alloc(tempmempool, vid.width * vid.height * 3 + 18);
+ buffer1 = (qbyte *)Mem_Alloc(tempmempool, vid.width * vid.height * 3);
+ buffer2 = (qbyte *)Mem_Alloc(tempmempool, vid.width * vid.height * 3);
+ buffer3 = (qbyte *)Mem_Alloc(tempmempool, vid.width * vid.height * 3 + 18);
if (SCR_ScreenShot (filename, buffer1, buffer2, buffer3, 0, 0, vid.width, vid.height, false, false, false, jpeg, true))
Con_Printf("Wrote %s\n", filename);
cl_capturevideo_framerate = bound(1, cl_capturevideo_fps.value, 1000);
cl_capturevideo_soundrate = 0;
cl_capturevideo_frame = 0;
- cl_capturevideo_buffer = Mem_Alloc(tempmempool, vid.width * vid.height * (3+3+3) + 18);
+ cl_capturevideo_buffer = (qbyte *)Mem_Alloc(tempmempool, vid.width * vid.height * (3+3+3) + 18);
gamma = 1.0/scr_screenshot_gamma.value;
/*
r_refdef.fov_x = 90;
r_refdef.fov_y = 90;
- buffer1 = Mem_Alloc(tempmempool, size * size * 3);
- buffer2 = Mem_Alloc(tempmempool, size * size * 3);
- buffer3 = Mem_Alloc(tempmempool, size * size * 3 + 18);
+ buffer1 = (qbyte *)Mem_Alloc(tempmempool, size * size * 3);
+ buffer2 = (qbyte *)Mem_Alloc(tempmempool, size * size * 3);
+ buffer3 = (qbyte *)Mem_Alloc(tempmempool, size * size * 3 + 18);
for (j = 0;j < 12;j++)
{
return;
}
} while( video->framenum < destframe );
- R_UpdateTexture( video->cpif.tex, video->imagedata );
+ R_UpdateTexture( video->cpif.tex, (qbyte *)video->imagedata );
}
}
}
refdef_t;
-refdef_t r_refdef;
+extern refdef_t r_refdef;
#include "cgamevm.h"
return;
}
- SZ_Write (&cmd_text, text, (int)strlen (text));
+ SZ_Write (&cmd_text, (const qbyte *)text, (int)strlen (text));
}
templen = cmd_text.cursize;
if (templen)
{
- temp = Mem_Alloc (tempmempool, templen);
+ temp = (char *)Mem_Alloc (tempmempool, templen);
memcpy (temp, cmd_text.data, templen);
SZ_Clear (&cmd_text);
}
// add the copied off data
if (temp != NULL)
{
- SZ_Write (&cmd_text, temp, templen);
+ SZ_Write (&cmd_text, (const qbyte *)temp, templen);
Mem_Free (temp);
}
}
{
cmdalias_t *prev, *current;
- a = Z_Malloc (sizeof(cmdalias_t));
+ a = (cmdalias_t *)Z_Malloc (sizeof(cmdalias_t));
strlcpy (a->name, s, sizeof (a->name));
// insert it at the right alphanumeric position
for( prev = NULL, current = cmd_alias ; current && strcmp( current->name, a->name ) < 0 ; prev = current, current = current->next )
}
strlcat (cmd, "\n", sizeof (cmd));
- a->value = Z_Malloc (strlen (cmd) + 1);
+ a->value = (char *)Z_Malloc (strlen (cmd) + 1);
strcpy (a->value, cmd);
}
}
}
- cmd = Mem_Alloc(cmd_mempool, sizeof(cmd_function_t));
+ cmd = (cmd_function_t *)Mem_Alloc(cmd_mempool, sizeof(cmd_function_t));
cmd->name = cmd_name;
cmd->function = function;
cmd->next = cmd_functions;
const char **buf;
len = strlen(partial);
- buf = Mem_Alloc(tempmempool, sizeofbuf + sizeof (const char *));
+ buf = (const char **)Mem_Alloc(tempmempool, sizeofbuf + sizeof (const char *));
// Loop through the alias list and print all matches
for (cmd = cmd_functions; cmd; cmd = cmd->next)
if (!strncasecmp(partial, cmd->name, len))
const char **buf;
len = strlen(partial);
- buf = Mem_Alloc(tempmempool, sizeofbuf + sizeof (const char *));
+ buf = (const char **)Mem_Alloc(tempmempool, sizeofbuf + sizeof (const char *));
// Loop through the alias list and print all matches
for (alias = cmd_alias; alias; alias = alias->next)
if (!strncasecmp(partial, alias->name, len))
// attention, it has been eradicated from here, its only (former) use in
// all of darkplaces.
MSG_WriteByte(&cls.message, clc_stringcmd);
- SZ_Write(&cls.message, s, (int)strlen(s) + 1);
+ SZ_Write(&cls.message, (const qbyte *)s, (int)strlen(s) + 1);
}
/*
colbrushf_t *Collision_AllocBrushFloat(mempool_t *mempool, int numpoints, int numplanes, int numtriangles, int supercontents)
{
colbrushf_t *brush;
- brush = Mem_Alloc(mempool, sizeof(colbrushf_t) + sizeof(colpointf_t) * numpoints + sizeof(colplanef_t) * numplanes + sizeof(int[3]) * numtriangles);
+ brush = (colbrushf_t *)Mem_Alloc(mempool, sizeof(colbrushf_t) + sizeof(colpointf_t) * numpoints + sizeof(colplanef_t) * numplanes + sizeof(int[3]) * numtriangles);
brush->supercontents = supercontents;
brush->numplanes = numplanes;
brush->numpoints = numpoints;
brush->numtriangles = numtriangles;
- brush->planes = (void *)(brush + 1);
- brush->points = (void *)(brush->planes + brush->numplanes);
- brush->elements = (void *)(brush->points + brush->numpoints);
+ brush->planes = (colplanef_t *)(brush + 1);
+ brush->points = (colpointf_t *)(brush->planes + brush->numplanes);
+ brush->elements = (int *)(brush->points + brush->numpoints);
return brush;
}
colbrushf_t *Collision_AllocBrushFromPermanentPolygonFloat(mempool_t *mempool, int numpoints, float *points, int supercontents)
{
colbrushf_t *brush;
- brush = Mem_Alloc(mempool, sizeof(colbrushf_t) + sizeof(colplanef_t) * (numpoints + 2));
+ brush = (colbrushf_t *)Mem_Alloc(mempool, sizeof(colbrushf_t) + sizeof(colplanef_t) * (numpoints + 2));
brush->supercontents = supercontents;
brush->numpoints = numpoints;
brush->numplanes = numpoints + 2;
- brush->planes = (void *)(brush + 1);
+ brush->planes = (colplanef_t *)(brush + 1);
brush->points = (colpointf_t *)points;
Sys_Error("Collision_AllocBrushFromPermanentPolygonFloat: FIXME: this code needs to be updated to generate a mesh...\n");
return brush;
colbsp_t *Collision_CreateCollisionBSP(mempool_t *mempool)
{
colbsp_t *bsp;
- bsp = Mem_Alloc(mempool, sizeof(colbsp_t));
+ bsp = (colbsp_t *)Mem_Alloc(mempool, sizeof(colbsp_t));
bsp->mempool = mempool;
- bsp->nodes = Mem_Alloc(bsp->mempool, sizeof(colbspnode_t));
+ bsp->nodes = (colbspnode_t *)Mem_Alloc(bsp->mempool, sizeof(colbspnode_t));
return bsp;
}
dat.f = f;
dat.l = LittleLong (dat.l);
- SZ_Write (sb, &dat.l, 4);
+ SZ_Write (sb, (qbyte *)&dat.l, 4);
}
void MSG_WriteString (sizebuf_t *sb, const char *s)
{
if (!s)
- SZ_Write (sb, "", 1);
+ SZ_Write (sb, (qbyte *)"", 1);
else
- SZ_Write (sb, s, (int)strlen(s)+1);
+ SZ_Write (sb, (qbyte *)s, (int)strlen(s)+1);
}
void MSG_WriteUnterminatedString (sizebuf_t *sb, const char *s)
{
if (s)
- SZ_Write (sb, s, (int)strlen(s));
+ SZ_Write (sb, (qbyte *)s, (int)strlen(s));
}
void MSG_WriteCoord13i (sizebuf_t *sb, float f)
buf->cursize = 0;
}
-void *SZ_GetSpace (sizebuf_t *buf, int length)
+qbyte *SZ_GetSpace (sizebuf_t *buf, int length)
{
- void *data;
+ qbyte *data;
if (buf->cursize + length > buf->maxsize)
{
return data;
}
-void SZ_Write (sizebuf_t *buf, const void *data, int length)
+void SZ_Write (sizebuf_t *buf, const qbyte *data, int length)
{
memcpy (SZ_GetSpace(buf,length),data,length);
}
for (i = 1; i < sizeof (gamemode_info) / sizeof (gamemode_info[0]); i++)
if (strstr (name, gamemode_info[i].prog_name))
{
- gamemode = i;
+ gamemode = (gamemode_t)i;
break;
}
for (i = 0; i < sizeof (gamemode_info) / sizeof (gamemode_info[0]); i++)
if (COM_CheckParm (gamemode_info[i].cmdline))
{
- gamemode = i;
+ gamemode = (gamemode_t)i;
break;
}
} sizebuf_t;
void SZ_Clear (sizebuf_t *buf);
-void *SZ_GetSpace (sizebuf_t *buf, int length);
-void SZ_Write (sizebuf_t *buf, const void *data, int length);
+qbyte *SZ_GetSpace (sizebuf_t *buf, int length);
+void SZ_Write (sizebuf_t *buf, const qbyte *data, int length);
void SZ_HexDumpToConsole(const sizebuf_t *buf);
void Com_HexDumpToConsole(const qbyte *data, int size);
qbyte* newqueue;
logq_size *= factor;
- newqueue = Mem_Alloc (tempmempool, logq_size);
+ newqueue = (qbyte *)Mem_Alloc (tempmempool, logq_size);
memcpy (newqueue, logqueue, logq_ind);
Mem_Free (logqueue);
logqueue = newqueue;
// Allocate a log queue
logq_size = 512;
- logqueue = Mem_Alloc (tempmempool, logq_size);
+ logqueue = (qbyte *)Mem_Alloc (tempmempool, logq_size);
logq_ind = 0;
Cvar_RegisterVariable (&log_file);
if (index == 0)
{
// if this is the beginning of a new line, print timestamp
- char *timestamp = timestamps.integer ? Sys_TimeString(timeformat.string) : "";
+ const char *timestamp = timestamps.integer ? Sys_TimeString(timeformat.string) : "";
// reset the color
// FIXME: 1. perhaps we should use a terminal system 2. use a constant instead of 7!
line[index++] = STRING_COLOR_TAG;
char *text;
int i;
float time;
- extern char chat_buffer[];
+ extern char chat_buffer[256];
char temptext[256];
int colorindex = -1; //-1 for default
The typing input line at the bottom should only be drawn if typing is allowed
================
*/
-extern char engineversion[40];
void Con_DrawConsole (int lines)
{
int i, y, rows, j;
const char **buf;
len = strlen(partial);
- buf = Mem_Alloc(tempmempool, sizeofbuf + sizeof (const char *));
+ buf = (const char **)Mem_Alloc(tempmempool, sizeofbuf + sizeof (const char *));
// Loop through the alias list and print all matches
for (cvar = cvar_vars; cvar; cvar = cvar->next)
if (!strncasecmp(partial, cvar->name, len))
{
Z_Free (var->string); // free the old value string
- var->string = Z_Malloc (strlen(value)+1);
+ var->string = (char *)Z_Malloc (strlen(value)+1);
}
strcpy (var->string, value);
var->value = atof (var->string);
// copy the value off, because future sets will Z_Free it
oldstr = variable->string;
- variable->string = Z_Malloc (strlen(variable->string)+1);
+ variable->string = (char *)Z_Malloc (strlen(variable->string)+1);
strcpy (variable->string, oldstr);
- variable->defstring = Z_Malloc (strlen(variable->string)+1);
+ variable->defstring = (char *)Z_Malloc (strlen(variable->string)+1);
strcpy (variable->defstring, oldstr);
variable->value = atof (variable->string);
variable->integer = (int) variable->value;
cvar->flags |= CVAR_DEFAULTSET;
Z_Free(cvar->defstring);
- cvar->defstring = Z_Malloc(strlen(value) + 1);
+ cvar->defstring = (char *)Z_Malloc(strlen(value) + 1);
strcpy(cvar->defstring, value);
}
return cvar;
// allocate a new cvar, cvar name, and cvar string
// FIXME: these never get Z_Free'd
- cvar = Z_Malloc(sizeof(cvar_t));
+ cvar = (cvar_t *)Z_Malloc(sizeof(cvar_t));
cvar->flags = flags | CVAR_ALLOCATED | CVAR_DEFAULTSET;
- cvar->name = Z_Malloc(strlen(name)+1);
+ cvar->name = (char *)Z_Malloc(strlen(name)+1);
strcpy(cvar->name, name);
- cvar->string = Z_Malloc(strlen(value)+1);
+ cvar->string = (char *)Z_Malloc(strlen(value)+1);
strcpy(cvar->string, value);
- cvar->defstring = Z_Malloc(strlen(value)+1);
+ cvar->defstring = (char *)Z_Malloc(strlen(value)+1);
strcpy(cvar->defstring, value);
cvar->value = atof (cvar->string);
cvar->integer = (int) cvar->value;
hz_bitstream_read_t *stream;
if ((file = FS_Open (filename, "rb", false, false)))
{
- stream = malloc(sizeof(hz_bitstream_read_t));
+ stream = (hz_bitstream_read_t *)malloc(sizeof(hz_bitstream_read_t));
memset(stream, 0, sizeof(*stream));
stream->file = file;
return stream;
hz_bitstream_readblocks_t *hz_bitstream_read_blocks_new(void)
{
hz_bitstream_readblocks_t *blocks;
- blocks = malloc(sizeof(hz_bitstream_readblocks_t));
+ blocks = (hz_bitstream_readblocks_t *)malloc(sizeof(hz_bitstream_readblocks_t));
if (blocks == NULL)
return NULL;
memset(blocks, 0, sizeof(hz_bitstream_readblocks_t));
{
if (b == NULL)
{
- b = malloc(sizeof(hz_bitstream_readblock_t));
+ b = (hz_bitstream_readblock_t *)malloc(sizeof(hz_bitstream_readblock_t));
if (b == NULL)
return HZREADERROR_MALLOCFAILED;
b->next = NULL;
void hz_bitstream_read_bytes(hz_bitstream_readblocks_t *blocks, void *outdata, unsigned int size)
{
unsigned char *out;
- out = outdata;
+ out = (unsigned char *)outdata;
while (size--)
*out++ = hz_bitstream_read_byte(blocks);
}
char t[8], *wavename;
if (errorstring != NULL)
*errorstring = NULL;
- s = malloc(sizeof(dpvsimpledecodestream_t));
+ s = (dpvsimpledecodestream_t *)Z_Malloc(sizeof(dpvsimpledecodestream_t));
if (s != NULL)
{
s->bitstream = hz_bitstream_read_open(filename);
if (s->info_framerate > 0.0)
{
- s->videopixels = malloc(s->info_imagewidth * s->info_imageheight * sizeof(*s->videopixels));
+ s->videopixels = (unsigned int *)Z_Malloc(s->info_imagewidth * s->info_imageheight * sizeof(*s->videopixels));
if (s->videopixels != NULL)
{
- wavename = malloc(strlen(filename) + 10);
+ wavename = (char *)Z_Malloc(strlen(filename) + 10);
if (wavename)
{
sfx_t* sfx;
// closes a stream
void dpvsimpledecode_close(void *stream)
{
- dpvsimpledecodestream_t *s = stream;
+ dpvsimpledecodestream_t *s = (dpvsimpledecodestream_t *)stream;
if (s == NULL)
return;
if (s->videopixels)
// error message
int dpvsimpledecode_error(void *stream, char **errorstring)
{
- dpvsimpledecodestream_t *s = stream;
+ dpvsimpledecodestream_t *s = (dpvsimpledecodestream_t *)stream;
int e;
e = s->error;
s->error = 0;
// returns the width of the image data
unsigned int dpvsimpledecode_getwidth(void *stream)
{
- dpvsimpledecodestream_t *s = stream;
+ dpvsimpledecodestream_t *s = (dpvsimpledecodestream_t *)stream;
return s->info_imagewidth;
}
// returns the height of the image data
unsigned int dpvsimpledecode_getheight(void *stream)
{
- dpvsimpledecodestream_t *s = stream;
+ dpvsimpledecodestream_t *s = (dpvsimpledecodestream_t *)stream;
return s->info_imageheight;
}
// returns the framerate of the stream
double dpvsimpledecode_getframerate(void *stream)
{
- dpvsimpledecodestream_t *s = stream;
+ dpvsimpledecodestream_t *s = (dpvsimpledecodestream_t *)stream;
return s->info_framerate;
}
unsigned int *outrow;
for (y = 0;y < height;y++)
{
- outrow = (void *)((unsigned char *)imagedata + y * imagebytesperrow);
+ outrow = (unsigned int *)((unsigned char *)imagedata + y * imagebytesperrow);
for (x = 0;x < width;x++)
{
a = *in++;
unsigned short *outrow;
for (y = 0;y < height;y++)
{
- outrow = (void *)((unsigned char *)imagedata + y * imagebytesperrow);
+ outrow = (unsigned short *)((unsigned char *)imagedata + y * imagebytesperrow);
if (Rloss == 19 && Gloss == 10 && Bloss == 3 && Rshift == 11 && Gshift == 5 && Bshift == 0)
{
// optimized
// decodes a video frame to the supplied output pixels
int dpvsimpledecode_video(void *stream, void *imagedata, unsigned int Rmask, unsigned int Gmask, unsigned int Bmask, unsigned int bytesperpixel, int imagebytesperrow)
{
- dpvsimpledecodestream_t *s = stream;
+ dpvsimpledecodestream_t *s = (dpvsimpledecodestream_t *)stream;
unsigned int framedatasize;
char t[4];
s->error = DPVSIMPLEDECODEERROR_NONE;
stringlist_t *stringlistappend(stringlist_t *current, char *text)
{
stringlist_t *newitem;
- newitem = Z_Malloc(strlen(text) + 1 + sizeof(stringlist_t));
+ newitem = (stringlist_t *)Z_Malloc(strlen(text) + 1 + sizeof(stringlist_t));
newitem->next = NULL;
newitem->text = (char *)(newitem + 1);
strcpy(newitem->text, text);
startgrid = bound(0, startgrid, size);
amplitude = 0xFFFF; // this gets halved before use
- noisebuf = Mem_Alloc(tempmempool, size*size*sizeof(int));
+ noisebuf = (int *)Mem_Alloc(tempmempool, size*size*sizeof(int));
memset(noisebuf, 0, size*size*sizeof(int));
for (g2 = startgrid;g2;g2 >>= 1)
} z_stream;
-typedef enum
-{
- QFILE_FLAG_NONE = 0,
- QFILE_FLAG_PACKED = (1 << 0), // inside a package (PAK or PK3)
- QFILE_FLAG_DEFLATED = (1 << 1) // file is compressed using the deflate algorithm (PK3 only)
-} qfile_flags_t;
+// inside a package (PAK or PK3)
+#define QFILE_FLAG_PACKED (1 << 0)
+// file is compressed using the deflate algorithm (PK3 only)
+#define QFILE_FLAG_DEFLATED (1 << 1)
#define FILE_BUFF_SIZE 2048
typedef struct
struct qfile_s
{
- qfile_flags_t flags;
+ int flags;
int handle; // file descriptor
fs_offset_t real_length; // uncompressed file size (for files opened in "read" mode)
fs_offset_t position; // current position in the file
// Packages in memory
-typedef enum
-{
- PACKFILE_FLAG_NONE = 0,
- PACKFILE_FLAG_TRUEOFFS = (1 << 0), // the offset in packfile_t is the true contents offset
- PACKFILE_FLAG_DEFLATED = (1 << 1) // file compressed using the deflate algorithm
-} packfile_flags_t;
+// the offset in packfile_t is the true contents offset
+#define PACKFILE_FLAG_TRUEOFFS (1 << 0)
+// file compressed using the deflate algorithm
+#define PACKFILE_FLAG_DEFLATED (1 << 1)
typedef struct
{
char name [MAX_QPATH];
- packfile_flags_t flags;
+ int flags;
fs_offset_t offset;
fs_offset_t packsize; // size in the package
fs_offset_t realsize; // real file size (uncompressed)
static packfile_t* FS_AddFileToPack (const char* name, pack_t* pack,
fs_offset_t offset, fs_offset_t packsize,
- fs_offset_t realsize, packfile_flags_t flags);
+ fs_offset_t realsize, int flags);
/*
maxsize = filesize;
else
maxsize = ZIP_MAX_COMMENTS_SIZE + ZIP_END_CDIR_SIZE;
- buffer = Mem_Alloc (tempmempool, maxsize);
+ buffer = (qbyte *)Mem_Alloc (tempmempool, maxsize);
lseek (packhandle, filesize - maxsize, SEEK_SET);
if (read (packhandle, buffer, maxsize) != (fs_offset_t) maxsize)
{
fs_offset_t remaining;
// Load the central directory in memory
- central_dir = Mem_Alloc (tempmempool, eocd->cdir_size);
+ central_dir = (qbyte *)Mem_Alloc (tempmempool, eocd->cdir_size);
lseek (pack->handle, eocd->cdir_offset, SEEK_SET);
read (pack->handle, central_dir, eocd->cdir_size);
{
char filename [sizeof (pack->files[0].name)];
fs_offset_t offset, packsize, realsize;
- packfile_flags_t flags;
+ int flags;
// Extract the name (strip it if necessary)
namesize = min(namesize, (int)sizeof (filename) - 1);
#endif
// Create a package structure in memory
- pack = Mem_Alloc(fs_mempool, sizeof (pack_t));
+ pack = (pack_t *)Mem_Alloc(fs_mempool, sizeof (pack_t));
pack->ignorecase = true; // PK3 ignores case
strlcpy (pack->filename, packfile, sizeof (pack->filename));
pack->handle = packhandle;
pack->numfiles = eocd.nbentries;
- pack->files = Mem_Alloc(fs_mempool, eocd.nbentries * sizeof(packfile_t));
+ pack->files = (packfile_t *)Mem_Alloc(fs_mempool, eocd.nbentries * sizeof(packfile_t));
pack->next = packlist;
packlist = pack;
*/
static packfile_t* FS_AddFileToPack (const char* name, pack_t* pack,
fs_offset_t offset, fs_offset_t packsize,
- fs_offset_t realsize, packfile_flags_t flags)
+ fs_offset_t realsize, int flags)
{
int (*strcmp_funct) (const char* str1, const char* str2);
int left, right, middle;
return NULL;
}
- pack = Mem_Alloc(fs_mempool, sizeof (pack_t));
+ pack = (pack_t *)Mem_Alloc(fs_mempool, sizeof (pack_t));
pack->ignorecase = false; // PAK is case sensitive
strlcpy (pack->filename, packfile, sizeof (pack->filename));
pack->handle = packhandle;
pack->numfiles = 0;
- pack->files = Mem_Alloc(fs_mempool, numpackfiles * sizeof(packfile_t));
+ pack->files = (packfile_t *)Mem_Alloc(fs_mempool, numpackfiles * sizeof(packfile_t));
pack->next = packlist;
packlist = pack;
- info = Mem_Alloc(tempmempool, sizeof(*info) * numpackfiles);
+ info = (dpackfile_t *)Mem_Alloc(tempmempool, sizeof(*info) * numpackfiles);
lseek (packhandle, header.dirofs, SEEK_SET);
read (packhandle, (void *)info, header.dirlen);
pak = FS_LoadPackPAK (pakfile);
if (pak)
{
- search = Mem_Alloc(fs_mempool, sizeof(searchpath_t));
+ search = (searchpath_t *)Mem_Alloc(fs_mempool, sizeof(searchpath_t));
search->pack = pak;
search->next = fs_searchpaths;
fs_searchpaths = search;
pak = FS_LoadPackPK3 (pakfile);
if (pak)
{
- search = Mem_Alloc(fs_mempool, sizeof(searchpath_t));
+ search = (searchpath_t *)Mem_Alloc(fs_mempool, sizeof(searchpath_t));
search->pack = pak;
search->next = fs_searchpaths;
fs_searchpaths = search;
// Add the directory to the search path
// (unpacked files have the priority over packed files)
- search = Mem_Alloc(fs_mempool, sizeof(searchpath_t));
+ search = (searchpath_t *)Mem_Alloc(fs_mempool, sizeof(searchpath_t));
strlcpy (search->filename, dir, sizeof (search->filename));
search->next = fs_searchpaths;
fs_searchpaths = search;
if (!com_argv[i] || com_argv[i][0] == '+' || com_argv[i][0] == '-')
break;
- search = Mem_Alloc(fs_mempool, sizeof(searchpath_t));
+ search = (searchpath_t *)Mem_Alloc(fs_mempool, sizeof(searchpath_t));
if (!strcasecmp (FS_FileExtension(com_argv[i]), "pak"))
{
search->pack = FS_LoadPackPAK (com_argv[i]);
if (nonblocking)
opt |= O_NONBLOCK;
- file = Mem_Alloc (fs_mempool, sizeof (*file));
+ file = (qfile_t *)Mem_Alloc (fs_mempool, sizeof (*file));
memset (file, 0, sizeof (*file));
file->ungetc = EOF;
return NULL;
}
- file = Mem_Alloc (fs_mempool, sizeof (*file));
+ file = (qfile_t *)Mem_Alloc (fs_mempool, sizeof (*file));
memset (file, 0, sizeof (*file));
file->handle = dup_handle;
file->flags = QFILE_FLAG_PACKED;
file->flags |= QFILE_FLAG_DEFLATED;
// We need some more variables
- ztk = Mem_Alloc (fs_mempool, sizeof (*ztk));
+ ztk = (ztoolkit_t *)Mem_Alloc (fs_mempool, sizeof (*ztk));
ztk->comp_length = pfile->packsize;
char *tempbuff = NULL;
buff_size = 1024;
- tempbuff = Mem_Alloc (tempmempool, buff_size);
+ tempbuff = (char *)Mem_Alloc (tempmempool, buff_size);
len = dpvsnprintf (tempbuff, buff_size, format, ap);
while (len < 0)
{
Mem_Free (tempbuff);
buff_size *= 2;
- tempbuff = Mem_Alloc (tempmempool, buff_size);
+ tempbuff = (char *)Mem_Alloc (tempmempool, buff_size);
len = dpvsnprintf (tempbuff, buff_size, format, ap);
}
// We need a big buffer to force inflating into it directly
buffersize = 2 * sizeof (file->buff);
- buffer = Mem_Alloc (tempmempool, buffersize);
+ buffer = (qbyte *)Mem_Alloc (tempmempool, buffersize);
// Skip all data until we reach the requested offset
while (offset > file->position)
if (!file)
return NULL;
- buf = Mem_Alloc (pool, fs_filesize + 1);
+ buf = (qbyte *)Mem_Alloc (pool, fs_filesize + 1);
buf[fs_filesize] = '\0';
FS_Read (file, buf, fs_filesize);
separator = max(slash, backslash);
separator = max(separator, colon);
basepathlength = separator ? (separator + 1 - pattern) : 0;
- basepath = Mem_Alloc (tempmempool, basepathlength + 1);
+ basepath = (char *)Mem_Alloc (tempmempool, basepathlength + 1);
if (basepathlength)
memcpy(basepath, pattern, basepathlength);
basepath[basepathlength] = 0;
numfiles++;
numchars += (int)strlen(listtemp->text) + 1;
}
- search = Z_Malloc(sizeof(fssearch_t) + numchars + numfiles * sizeof(char *));
+ search = (fssearch_t *)Z_Malloc(sizeof(fssearch_t) + numchars + numfiles * sizeof(char *));
search->filenames = (char **)((char *)search + sizeof(fssearch_t));
search->filenamesbuffer = (char *)((char *)search + sizeof(fssearch_t) + numfiles * sizeof(char *));
search->numfilenames = (int)numfiles;
unsigned int i;
gltextureunit_t *unit;
CHECKGLERROR
- gl_state.unit = -1;
- gl_state.clientunit = -1;
+ gl_state.unit = MAX_TEXTUREUNITS;
+ gl_state.clientunit = MAX_TEXTUREUNITS;
for (i = 0;i < MAX_TEXTUREUNITS;i++)
{
unit = gl_state.units + i;
//R_Mesh_CacheArray_ValidateState(3);
// calculate a hashindex to choose a cache chain
r->data = NULL;
- hashindex = CRC_Block((void *)r, sizeof(*r)) % RCACHEARRAY_HASHSIZE;
+ hashindex = CRC_Block((qbyte *)r, sizeof(*r)) % RCACHEARRAY_HASHSIZE;
// is it already cached?
for (lhead = &r_mesh_rcachechain[hashindex], l = lhead->next;l != lhead;l = l->next)
#include "lhfont.h"
};
-extern qbyte *LoadTGA (qbyte *f, int matchwidth, int matchheight);
-
static rtexture_t *draw_generateconchars(void)
{
int i;
return R_LoadTexture2D(drawtexturepool, "conchars", 256, 256, &buffer[0][0], TEXTYPE_RGBA, TEXF_ALPHA | TEXF_PRECACHE, NULL);
}
-static qbyte pointerimage[256] =
-{
+static char *pointerimage =
"333333332......."
"26777761........"
"2655541........."
"................"
"................"
"................"
-};
+;
static rtexture_t *draw_generatemousepointer(void)
{
// must match NUMCROSSHAIRS in r_crosshairs.c
#define NUMCROSSHAIRS 6
-static qbyte crosshairtexdata[NUMCROSSHAIRS][16*16] =
+static char *crosshairtexdata[NUMCROSSHAIRS] =
{
- {
"................"
"................"
"................"
"................"
"................"
"................"
- },
- {
+ ,
"................"
"................"
"................"
"................"
"................"
"................"
- },
- {
+ ,
"................"
".......77......."
".......77......."
".......77......."
".......77......."
"................"
- },
- {
+ ,
"................"
"................"
"................"
"........7......."
"........7......."
"................"
- },
- {
+ ,
"................"
"................"
"................"
"................"
"................"
"................"
- },
- {
+ ,
"................"
"................"
"................"
"................"
"................"
"................"
- }
};
static rtexture_t *draw_generatecrosshair(int num)
{
int i;
- qbyte *in;
+ char *in;
qbyte data[16*16][4];
in = crosshairtexdata[num];
for (i = 0;i < 16*16;i++)
// compatibility with older versions
pic->tex = loadtextureimage(drawtexturepool, path + 4, 0, 0, false, flags);
// failed to find gfx/whatever.tga or similar, try the wad
- if (pic->tex == NULL && (p = W_GetLumpName (path + 4)))
+ if (pic->tex == NULL && (p = (qpic_t *)W_GetLumpName (path + 4)))
{
if (!strcmp(path, "gfx/conchars"))
{
}
break;
case DRAWQUEUE_MESH:
- mesh = (void *)(dq + 1);
+ mesh = (drawqueuemesh_t *)(dq + 1);
m.pointer_vertex = mesh->data_vertex3f;
m.pointer_color = mesh->data_color4f;
m.pointer_texcoord[0] = mesh->data_texcoord2f;
void R_DrawNoModelCallback(const void *calldata1, int calldata2)
{
- const entity_render_t *ent = calldata1;
+ const entity_render_t *ent = (entity_render_t *)calldata1;
int i;
float f1, f2, *c, diff[3];
float color4f[6*4];
static void RSurfShader_Transparent_Callback(const void *calldata1, int calldata2)
{
- const entity_render_t *ent = calldata1;
+ const entity_render_t *ent = (entity_render_t *)calldata1;
const msurface_t *surface = ent->model->data_surfaces + calldata2;
vec3_t modelorg;
texture_t *texture;
int i;
float *v;
rmeshstate_t m;
- const mportal_t *portal = calldata1;
+ const mportal_t *portal = (mportal_t *)calldata1;
GL_BlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
GL_DepthMask(false);
GL_DepthTest(true);
gltexturepool_t *pool;
if (texturemempool == NULL)
return NULL;
- pool = Mem_Alloc(texturemempool, sizeof(gltexturepool_t));
+ pool = (gltexturepool_t *)Mem_Alloc(texturemempool, sizeof(gltexturepool_t));
if (pool == NULL)
return NULL;
pool->next = gltexturepoolchain;
R_TextureStats_Print(true, true, true);
}
-char engineversion[40];
-
static void r_textures_start(void)
{
// deal with size limits of various drivers (3dfx in particular)
Mem_Free(resizebuffer);
if (colorconvertbuffer)
Mem_Free(colorconvertbuffer);
- resizebuffer = Mem_Alloc(texturemempool, resizebuffersize);
- colorconvertbuffer = Mem_Alloc(texturemempool, resizebuffersize);
+ resizebuffer = (qbyte *)Mem_Alloc(texturemempool, resizebuffersize);
+ colorconvertbuffer = (qbyte *)Mem_Alloc(texturemempool, resizebuffersize);
if (!resizebuffer || !colorconvertbuffer)
Host_Error("R_Upload: out of memory\n");
}
return;
}
- image = Mem_Alloc(texturemempool, sizeof(gltextureimage_t));
+ image = (gltextureimage_t *)Mem_Alloc(texturemempool, sizeof(gltextureimage_t));
if (image == NULL)
{
Con_Printf ("R_FindImageForTexture: ran out of memory\n");
image->depth = 1;
if (gltexturetypedimensions[glt->texturetype] >= 3)
for (image->depth = block_size;image->depth < glt->depth;image->depth <<= 1);
- image->blockallocation = Mem_Alloc(texturemempool, image->width * sizeof(short));
+ image->blockallocation = (short int *)Mem_Alloc(texturemempool, image->width * sizeof(short));
memset(image->blockallocation, 0, image->width * sizeof(short));
x = 0;
{
for (imagechainpointer = &pool->imagechain;*imagechainpointer;imagechainpointer = &(*imagechainpointer)->imagechain);
- image = Mem_Alloc(texturemempool, sizeof(gltextureimage_t));
+ image = (gltextureimage_t *)Mem_Alloc(texturemempool, sizeof(gltextureimage_t));
if (image == NULL)
{
Con_Printf ("R_FindImageForTexture: ran out of memory\n");
Host_Error("R_LoadTexture: unknown texture type\n");
}
- glt = Mem_Alloc(texturemempool, sizeof(gltexture_t));
+ glt = (gltexture_t *)Mem_Alloc(texturemempool, sizeof(gltexture_t));
if (identifier)
strlcpy (glt->identifier, identifier, sizeof(glt->identifier));
glt->pool = pool;
if (data)
{
- glt->inputtexels = Mem_Alloc(texturemempool, size);
+ glt->inputtexels = (qbyte *)Mem_Alloc(texturemempool, size);
if (glt->inputtexels == NULL)
Con_Printf ("R_LoadTexture: out of memory\n");
else
svs.maxclients = bound(1, svs.maxclients, MAX_SCOREBOARD);
- svs.clients = Mem_Alloc(sv_mempool, sizeof(client_t) * svs.maxclients);
+ svs.clients = (client_t *)Mem_Alloc(sv_mempool, sizeof(client_t) * svs.maxclients);
if (svs.maxclients > 1 && !deathmatch.integer)
Cvar_SetValueQuick(&deathmatch, 1);
if (svs.clients)
Mem_Free(svs.clients);
svs.maxclients = n;
- svs.clients = Mem_Alloc(sv_mempool, sizeof(client_t) * svs.maxclients);
+ svs.clients = (client_t *)Mem_Alloc(sv_mempool, sizeof(client_t) * svs.maxclients);
if (n == 1)
Cvar_Set ("deathmatch", "0");
else
// note: pal must be 32bit color
void Image_Copy8bitRGBA(const qbyte *in, qbyte *out, int pixels, const unsigned int *pal)
{
- int *iout = (void *)out;
+ int *iout = (int *)out;
while (pixels >= 8)
{
iout[0] = pal[in[0]];
palette = f + fs_filesize - 768;
- image_rgba = Mem_Alloc(tempmempool, image_width*image_height*4);
+ image_rgba = (qbyte *)Mem_Alloc(tempmempool, image_width*image_height*4);
if (!image_rgba)
{
Con_Printf("LoadPCX: not enough memory for %i by %i image\n", image_width, image_height);
return NULL;
}
- image_rgba = Mem_Alloc(tempmempool, image_width * image_height * 4);
+ image_rgba = (qbyte *)Mem_Alloc(tempmempool, image_width * image_height * 4);
if (!image_rgba)
{
Con_Printf("LoadTGA: not enough memory for %i by %i image\n", image_width, image_height);
if (loadAs8Bit)
{
- image_buffer = Mem_Alloc(tempmempool, image_width * image_height);
+ image_buffer = (qbyte *)Mem_Alloc(tempmempool, image_width * image_height);
memcpy(image_buffer, f + 8, image_width * image_height);
}
else
{
- image_buffer = Mem_Alloc(tempmempool, image_width * image_height * 4);
+ image_buffer = (qbyte *)Mem_Alloc(tempmempool, image_width * image_height * 4);
Image_Copy8bitRGBA(f + 8, image_buffer, image_width * image_height, palette_complete);
}
return image_buffer;
qbyte *LoadWAL (const qbyte *f, int matchwidth, int matchheight)
{
qbyte *image_rgba;
- const q2wal_t *inwal = (const void *)f;
+ const q2wal_t *inwal = (const q2wal_t *)f;
if (fs_filesize < (int) sizeof(q2wal_t))
{
return NULL;
}
- image_rgba = Mem_Alloc(tempmempool, image_width * image_height * 4);
+ image_rgba = (qbyte *)Mem_Alloc(tempmempool, image_width * image_height * 4);
if (!image_rgba)
{
Con_Printf("LoadLMP: not enough memory for %i by %i image\n", image_width, image_height);
if (!(data = loadimagepixels (filename, complain, matchwidth, matchheight)))
return 0;
- data2 = Mem_Alloc(tempmempool, image_width * image_height * 4);
+ data2 = (qbyte *)Mem_Alloc(tempmempool, image_width * image_height * 4);
rt = R_LoadTexture2D(pool, filename, image_width, image_height, data, TEXTYPE_RGBA, flags, NULL);
rtexture_t *rt;
if (!(data = loadimagepixels (filename, complain, matchwidth, matchheight)))
return 0;
- data2 = Mem_Alloc(tempmempool, image_width * image_height * 4);
+ data2 = (qbyte *)Mem_Alloc(tempmempool, image_width * image_height * 4);
Image_HeightmapToNormalmap(data, data2, image_width, image_height, (flags & TEXF_CLAMP) != 0, bumpscale);
rt = R_LoadTexture2D(pool, filename, image_width, image_height, data2, TEXTYPE_RGBA, flags, NULL);
qbyte *buffer, *out;
const qbyte *in, *end;
- buffer = Mem_Alloc(tempmempool, width*height*3 + 18);
+ buffer = (qbyte *)Mem_Alloc(tempmempool, width*height*3 + 18);
memset (buffer, 0, 18);
buffer[2] = 2; // uncompressed type
qbyte *buffer, *out;
const qbyte *in, *end;
- buffer = Mem_Alloc(tempmempool, width*height*4 + 18);
+ buffer = (qbyte *)Mem_Alloc(tempmempool, width*height*4 + 18);
memset (buffer, 0, 18);
buffer[2] = 2; // uncompressed type
const qbyte *inrow;
qbyte *resamplerow1;
qbyte *resamplerow2;
- out = outdata;
+ out = (qbyte *)outdata;
fstep = (int) (inheight*65536.0f/outheight);
- resamplerow1 = Mem_Alloc(tempmempool, outwidth*4*2);
+ resamplerow1 = (qbyte *)Mem_Alloc(tempmempool, outwidth*4*2);
resamplerow2 = resamplerow1 + outwidth*4;
- inrow = indata;
+ inrow = (const qbyte *)indata;
oldy = 0;
Image_Resample32LerpLine (inrow, resamplerow1, inwidth, outwidth);
Image_Resample32LerpLine (inrow + inwidth4, resamplerow2, inwidth, outwidth);
unsigned frac, fracstep;
// relies on int being 4 bytes
int *inrow, *out;
- out = outdata;
+ out = (int *)outdata;
fracstep = inwidth*0x10000/outwidth;
for (i = 0;i < outheight;i++)
const qbyte *inrow;
qbyte *resamplerow1;
qbyte *resamplerow2;
- out = outdata;
+ out = (qbyte *)outdata;
fstep = (int) (inheight*65536.0f/outheight);
- resamplerow1 = Mem_Alloc(tempmempool, outwidth*3*2);
+ resamplerow1 = (qbyte *)Mem_Alloc(tempmempool, outwidth*3*2);
resamplerow2 = resamplerow1 + outwidth*3;
- inrow = indata;
+ inrow = (const qbyte *)indata;
oldy = 0;
Image_Resample24LerpLine (inrow, resamplerow1, inwidth, outwidth);
Image_Resample24LerpLine (inrow + inwidth3, resamplerow2, inwidth, outwidth);
int i, j, f, inwidth3 = inwidth * 3;
unsigned frac, fracstep;
qbyte *inrow, *out;
- out = outdata;
+ out = (qbyte *)outdata;
fracstep = inwidth*0x10000/outwidth;
for (i = 0;i < outheight;i++)
bumppixels = NULL;bumppixels_width = 0;bumppixels_height = 0;
if (Image_CheckAlpha(s->basepixels, s->basepixels_width * s->basepixels_height, true))
{
- s->maskpixels = Mem_Alloc(loadmodel->mempool, s->basepixels_width * s->basepixels_height * 4);
+ s->maskpixels = (qbyte *)Mem_Alloc(loadmodel->mempool, s->basepixels_width * s->basepixels_height * 4);
s->maskpixels_width = s->basepixels_width;
s->maskpixels_height = s->basepixels_height;
memcpy(s->maskpixels, s->basepixels, s->maskpixels_width * s->maskpixels_height * 4);
{
if (r_shadow_bumpscale_bumpmap.value > 0)
{
- s->nmappixels = Mem_Alloc(loadmodel->mempool, bumppixels_width * bumppixels_height * 4);
+ s->nmappixels = (qbyte *)Mem_Alloc(loadmodel->mempool, bumppixels_width * bumppixels_height * 4);
s->nmappixels_width = bumppixels_width;
s->nmappixels_height = bumppixels_height;
Image_HeightmapToNormalmap(bumppixels, s->nmappixels, s->nmappixels_width, s->nmappixels_height, false, r_shadow_bumpscale_bumpmap.value);
{
if (r_shadow_bumpscale_basetexture.value > 0)
{
- s->nmappixels = Mem_Alloc(loadmodel->mempool, s->basepixels_width * s->basepixels_height * 4);
+ s->nmappixels = (qbyte *)Mem_Alloc(loadmodel->mempool, s->basepixels_width * s->basepixels_height * 4);
s->nmappixels_width = s->basepixels_width;
s->nmappixels_height = s->basepixels_height;
Image_HeightmapToNormalmap(s->basepixels, s->nmappixels, s->nmappixels_width, s->nmappixels_height, false, r_shadow_bumpscale_basetexture.value);
// makes a RGBA mask from RGBA input, in can be the same as out
int image_makemask (const qbyte *in, qbyte *out, int size);
+qbyte *LoadTGA (const qbyte *f, int matchwidth, int matchheight);
+
// loads a texture, as pixel data
qbyte *loadimagepixels (const char *filename, qboolean complain, int matchwidth, int matchheight);
rtexture_t *loadtextureimagemask (rtexturepool_t *pool, const char *filename, int matchwidth, int matchheight, qboolean complain, int flags);
// loads a texture and it's alpha mask at once (NULL if it has no translucent pixels)
-rtexture_t *image_masktex;
-rtexture_t *image_nmaptex;
+extern rtexture_t *image_masktex;
+extern rtexture_t *image_nmaptex;
rtexture_t *loadtextureimagewithmask (rtexturepool_t *pool, const char *filename, int matchwidth, int matchheight, qboolean complain, int flags);
rtexture_t *loadtextureimagewithmaskandnmap (rtexturepool_t *pool, const char *filename, int matchwidth, int matchheight, qboolean complain, int flags, float bumpscale);
rtexture_t *loadtextureimagebumpasnmap (rtexturepool_t *pool, const char *filename, int matchwidth, int matchheight, qboolean complain, int flags, float bumpscale);
static void JPEG_MemSrc (j_decompress_ptr cinfo, const qbyte *buffer)
{
- cinfo->src = cinfo->mem->alloc_small ((j_common_ptr) cinfo, JPOOL_PERMANENT, sizeof (struct jpeg_source_mgr));
+ cinfo->src = (struct jpeg_source_mgr *)cinfo->mem->alloc_small ((j_common_ptr) cinfo, JPOOL_PERMANENT, sizeof (struct jpeg_source_mgr));
cinfo->src->next_input_byte = buffer;
cinfo->src->bytes_in_buffer = fs_filesize;
return NULL;
}
- image_rgba = Mem_Alloc(tempmempool, image_width * image_height * 4);
- scanline = Mem_Alloc(tempmempool, image_width * cinfo.output_components);
+ image_rgba = (qbyte *)Mem_Alloc(tempmempool, image_width * image_height * 4);
+ scanline = (qbyte *)Mem_Alloc(tempmempool, image_width * cinfo.output_components);
if (!image_rgba || !scanline)
{
if (!image_rgba)
void
Key_SetBinding (int keynum, int bindmap, const char *binding)
{
- char *new;
+ char *newbinding;
size_t l;
if (keynum == -1)
}
// allocate memory for new binding
l = strlen (binding);
- new = Z_Malloc (l + 1);
- strcpy (new, binding);
- new[l] = 0;
- keybindings[bindmap][keynum] = new;
+ newbinding = (char *)Z_Malloc (l + 1);
+ strcpy (newbinding, binding);
+ newbinding[l] = 0;
+ keybindings[bindmap][keynum] = newbinding;
}
static void
lhnetsocket_t *lhnetsocket, *s;
if (!address)
return NULL;
- lhnetsocket = Z_Malloc(sizeof(*lhnetsocket));
+ lhnetsocket = (lhnetsocket_t *)Z_Malloc(sizeof(*lhnetsocket));
if (lhnetsocket)
{
memset(lhnetsocket, 0, sizeof(*lhnetsocket));
socklen_t namelen;
#endif
namelen = address->addresstype == LHNETADDRESSTYPE_INET6 ? sizeof(lhnetsocket->address.addressdata.inet6) : sizeof(lhnetsocket->address.addressdata.inet4);
- if (bind(lhnetsocket->inetsocket, (void *)&lhnetsocket->address.addressdata, namelen) != -1)
+ if (bind(lhnetsocket->inetsocket, (struct sockaddr *)&lhnetsocket->address.addressdata, namelen) != -1)
{
int i = 1;
- getsockname(lhnetsocket->inetsocket, (void *)&lhnetsocket->address.addressdata, &namelen);
+ getsockname(lhnetsocket->inetsocket, (struct sockaddr *)&lhnetsocket->address.addressdata, &namelen);
// enable broadcast on this socket
setsockopt(lhnetsocket->inetsocket, SOL_SOCKET, SO_BROADCAST, (char *)&i, sizeof(i));
lhnetsocket->next = &lhnet_socketlist;
if (lhnetsocket->address.addresstype == LHNETADDRESSTYPE_LOOP)
{
lhnetpacket_t *p;
- p = Z_Malloc(sizeof(*p) + contentlength);
+ p = (lhnetpacket_t *)Z_Malloc(sizeof(*p) + contentlength);
p->data = (void *)(p + 1);
memcpy(p->data, content, contentlength);
p->length = contentlength;
DrawQ_String(menu_x + cx, menu_y + cy, str, 0, 8, 8, 1, 0, 0, 1, 0);
}
-void M_ItemPrint(float cx, float cy, char *str, int unghosted)
+void M_ItemPrint(float cx, float cy, const char *str, int unghosted)
{
if (unghosted)
DrawQ_String(menu_x + cx, menu_y + cy, str, 0, 8, 8, 1, 1, 1, 1, 0);
DrawQ_String(menu_x + cx, menu_y + cy, str, 0, 8, 8, 0.4, 0.4, 0.4, 1, 0);
}
-void M_DrawPic (float cx, float cy, char *picname)
+void M_DrawPic (float cx, float cy, const char *picname)
{
DrawQ_Pic (menu_x + cx, menu_y + cy, picname, 0, 0, 1, 1, 1, 1, 0);
}
menuplyr_width = image_width;
menuplyr_height = image_height;
Mem_Free(f);
- menuplyr_pixels = Mem_Alloc(cl_mempool, menuplyr_width * menuplyr_height);
- menuplyr_translated = Mem_Alloc(cl_mempool, menuplyr_width * menuplyr_height * 4);
+ menuplyr_pixels = (qbyte *)Mem_Alloc(cl_mempool, menuplyr_width * menuplyr_height);
+ menuplyr_translated = (unsigned int *)Mem_Alloc(cl_mempool, menuplyr_width * menuplyr_height * 4);
memcpy(menuplyr_pixels, data, menuplyr_width * menuplyr_height);
Mem_Free(data);
}
int opty;
int optcursor;
-void M_Options_PrintCommand(char *s, int enabled)
+void M_Options_PrintCommand(const char *s, int enabled)
{
if (opty >= 32)
{
optnum++;
}
-void M_Options_PrintCheckbox(char *s, int enabled, int yes)
+void M_Options_PrintCheckbox(const char *s, int enabled, int yes)
{
if (opty >= 32)
{
optnum++;
}
-void M_Options_PrintSlider(char *s, int enabled, float value, float minvalue, float maxvalue)
+void M_Options_PrintSlider(const char *s, int enabled, float value, float minvalue, float maxvalue)
{
if (opty >= 32)
{
case 'N':
if (wasInMenus)
{
- m_state = m_quit_prevstate;
+ m_state = (enum m_state_e)m_quit_prevstate;
m_entersound = true;
}
else
{GAME_BATTLEMECH, &battlemechgame, &battlemechgame},
{GAME_OPENQUARTZ, &openquartzgame, &openquartzgame},
{GAME_DEFEATINDETAIL2, &defeatindetail2game, &defeatindetail2game},
- {-1, &sharewarequakegame, ®isteredquakegame} // final fallback
+ {(gamemode_t)-1, &sharewarequakegame, ®isteredquakegame} // final fallback
};
gamelevels_t *lookupgameinfo(void)
static cvar_t forceqmenu = { 0, "forceqmenu", "0" };
+void (*MR_Keydown) (int key, char ascii);
+void (*MR_Draw) (void);
+void (*MR_ToggleMenu_f) (void);
+void (*MR_Shutdown) (void);
+
void MR_SetRouting(qboolean forceold)
{
static qboolean m_init = FALSE, mp_init = FALSE;
void MR_Init_Commands (void);
void MR_Init (void);
void MR_Restart (void);
-void (*MR_Keydown) (int key, char ascii);
-void (*MR_Draw) (void);
-void (*MR_ToggleMenu_f) (void);
-void (*MR_Shutdown) (void);
+extern void (*MR_Keydown) (int key, char ascii);
+extern void (*MR_Draw) (void);
+extern void (*MR_ToggleMenu_f) (void);
+extern void (*MR_Shutdown) (void);
#endif
static void R_MeshQueue_EnlargeTransparentArray(int newtotal)
{
meshqueue_t *newarray;
- newarray = Mem_Alloc(cl_mempool, newtotal * sizeof(meshqueue_t));
+ newarray = (meshqueue_t *)Mem_Alloc(cl_mempool, newtotal * sizeof(meshqueue_t));
if (mqt_array)
{
memcpy(newarray, mqt_array, mqt_total * sizeof(meshqueue_t));
mq_total = r_meshqueue_entries.integer;
if (mq_array)
Mem_Free(mq_array);
- mq_array = Mem_Alloc(cl_mempool, mq_total * sizeof(meshqueue_t));
+ mq_array = (meshqueue_t *)Mem_Alloc(cl_mempool, mq_total * sizeof(meshqueue_t));
}
if (mqt_array == NULL)
- mqt_array = Mem_Alloc(cl_mempool, mqt_total * sizeof(meshqueue_t));
+ mqt_array = (meshqueue_t *)Mem_Alloc(cl_mempool, mqt_total * sizeof(meshqueue_t));
mq_count = 0;
mqt_count = 0;
static void Mod_Alias_Mesh_CompileFrameZero(surfmesh_t *mesh)
{
frameblend_t frameblend[4] = {{0, 1}, {0, 0}, {0, 0}, {0, 0}};
- mesh->data_vertex3f = Mem_Alloc(loadmodel->mempool, mesh->num_vertices * sizeof(float[3][4]));
+ mesh->data_vertex3f = (float *)Mem_Alloc(loadmodel->mempool, mesh->num_vertices * sizeof(float[3][4]));
mesh->data_svector3f = mesh->data_vertex3f + mesh->num_vertices * 3;
mesh->data_tvector3f = mesh->data_vertex3f + mesh->num_vertices * 6;
mesh->data_normal3f = mesh->data_vertex3f + mesh->num_vertices * 9;
int *vertonseam, *vertremap;
skinfile_t *skinfiles;
- datapointer = buffer;
+ datapointer = (qbyte *)buffer;
pinmodel = (mdl_t *)datapointer;
datapointer += sizeof(mdl_t);
loadmodel->num_surfaces = 1;
loadmodel->nummodelsurfaces = loadmodel->num_surfaces;
loadmodel->nummeshes = loadmodel->num_surfaces;
- data = Mem_Alloc(loadmodel->mempool, loadmodel->num_surfaces * sizeof(msurface_t) + loadmodel->num_surfaces * sizeof(int) + loadmodel->nummeshes * sizeof(surfmesh_t *) + loadmodel->nummeshes * sizeof(surfmesh_t));
- loadmodel->data_surfaces = (void *)data;data += loadmodel->num_surfaces * sizeof(msurface_t);
- loadmodel->surfacelist = (void *)data;data += loadmodel->num_surfaces * sizeof(int);
- loadmodel->meshlist = (void *)data;data += loadmodel->num_surfaces * sizeof(surfmesh_t *);
+ data = (qbyte *)Mem_Alloc(loadmodel->mempool, loadmodel->num_surfaces * sizeof(msurface_t) + loadmodel->num_surfaces * sizeof(int) + loadmodel->nummeshes * sizeof(surfmesh_t *) + loadmodel->nummeshes * sizeof(surfmesh_t));
+ loadmodel->data_surfaces = (msurface_t *)data;data += loadmodel->num_surfaces * sizeof(msurface_t);
+ loadmodel->surfacelist = (int *)data;data += loadmodel->num_surfaces * sizeof(int);
+ loadmodel->meshlist = (surfmesh_t **)data;data += loadmodel->num_surfaces * sizeof(surfmesh_t *);
for (i = 0;i < loadmodel->num_surfaces;i++)
{
loadmodel->surfacelist[i] = i;
- loadmodel->meshlist[i] = (void *)data;data += sizeof(surfmesh_t);
+ loadmodel->meshlist[i] = (surfmesh_t *)data;data += sizeof(surfmesh_t);
}
loadmodel->numskins = LittleLong(pinmodel->numskins);
// store texture coordinates into temporary array, they will be stored
// after usage is determined (triangle data)
- vertst = Mem_Alloc(tempmempool, numverts * 2 * sizeof(float[2]));
- vertremap = Mem_Alloc(tempmempool, numverts * 3 * sizeof(int));
+ vertst = (float *)Mem_Alloc(tempmempool, numverts * 2 * sizeof(float[2]));
+ vertremap = (int *)Mem_Alloc(tempmempool, numverts * 3 * sizeof(int));
vertonseam = vertremap + numverts * 2;
scales = 1.0 / skinwidth;
}
// load triangle data
- loadmodel->meshlist[0]->data_element3i = Mem_Alloc(loadmodel->mempool, sizeof(int[3]) * loadmodel->meshlist[0]->num_triangles);
+ loadmodel->meshlist[0]->data_element3i = (int *)Mem_Alloc(loadmodel->mempool, sizeof(int[3]) * loadmodel->meshlist[0]->num_triangles);
// read the triangle elements
for (i = 0;i < loadmodel->meshlist[0]->num_triangles;i++)
for (i = 0;i < loadmodel->meshlist[0]->num_triangles * 3;i++)
loadmodel->meshlist[0]->data_element3i[i] = vertremap[loadmodel->meshlist[0]->data_element3i[i]];
// store the texture coordinates
- loadmodel->meshlist[0]->data_texcoordtexture2f = Mem_Alloc(loadmodel->mempool, sizeof(float[2]) * loadmodel->meshlist[0]->num_vertices);
+ loadmodel->meshlist[0]->data_texcoordtexture2f = (float *)Mem_Alloc(loadmodel->mempool, sizeof(float[2]) * loadmodel->meshlist[0]->num_vertices);
for (i = 0;i < loadmodel->meshlist[0]->num_vertices;i++)
{
loadmodel->meshlist[0]->data_texcoordtexture2f[i*2+0] = vertst[i*2+0];
}
// load the frames
- loadmodel->animscenes = Mem_Alloc(loadmodel->mempool, sizeof(animscene_t) * loadmodel->numframes);
- loadmodel->meshlist[0]->data_morphvertex3f = Mem_Alloc(loadmodel->mempool, sizeof(float[3]) * loadmodel->meshlist[0]->num_morphframes * loadmodel->meshlist[0]->num_vertices);
- loadmodel->meshlist[0]->data_neighbor3i = Mem_Alloc(loadmodel->mempool, loadmodel->meshlist[0]->num_triangles * sizeof(int[3]));
+ loadmodel->animscenes = (animscene_t *)Mem_Alloc(loadmodel->mempool, sizeof(animscene_t) * loadmodel->numframes);
+ loadmodel->meshlist[0]->data_morphvertex3f = (float *)Mem_Alloc(loadmodel->mempool, sizeof(float[3]) * loadmodel->meshlist[0]->num_morphframes * loadmodel->meshlist[0]->num_vertices);
+ loadmodel->meshlist[0]->data_neighbor3i = (int *)Mem_Alloc(loadmodel->mempool, loadmodel->meshlist[0]->num_triangles * sizeof(int[3]));
Mod_MDL_LoadFrames (startframes, numverts, scale, translate, vertremap);
Mod_BuildTriangleNeighbors(loadmodel->meshlist[0]->data_neighbor3i, loadmodel->meshlist[0]->data_element3i, loadmodel->meshlist[0]->num_triangles);
Mod_CalcAliasModelBBoxes();
// load the skins
skinfiles = Mod_LoadSkinFiles();
- loadmodel->skinscenes = Mem_Alloc(loadmodel->mempool, loadmodel->numskins * sizeof(animscene_t));
+ loadmodel->skinscenes = (animscene_t *)Mem_Alloc(loadmodel->mempool, loadmodel->numskins * sizeof(animscene_t));
loadmodel->num_textures = loadmodel->num_surfaces;
- loadmodel->data_textures = Mem_Alloc(loadmodel->mempool, loadmodel->num_surfaces * totalskins * sizeof(texture_t));
+ loadmodel->data_textures = (texture_t *)Mem_Alloc(loadmodel->mempool, loadmodel->num_surfaces * totalskins * sizeof(texture_t));
if (skinfiles)
{
Mod_BuildAliasSkinsFromSkinFiles(loadmodel->data_textures, skinfiles, "default", "");
{
// expand the arrays to make room
tempskinscenes = loadmodel->skinscenes;
- loadmodel->skinscenes = Mem_Alloc(loadmodel->mempool, (loadmodel->numskins + 1) * sizeof(animscene_t));
+ loadmodel->skinscenes = (animscene_t *)Mem_Alloc(loadmodel->mempool, (loadmodel->numskins + 1) * sizeof(animscene_t));
memcpy(loadmodel->skinscenes, tempskinscenes, loadmodel->numskins * sizeof(animscene_t));
Mem_Free(tempskinscenes);
tempaliasskins = loadmodel->data_textures;
- loadmodel->data_textures = Mem_Alloc(loadmodel->mempool, loadmodel->num_surfaces * (totalskins + 1) * sizeof(texture_t));
+ loadmodel->data_textures = (texture_t *)Mem_Alloc(loadmodel->mempool, loadmodel->num_surfaces * (totalskins + 1) * sizeof(texture_t));
memcpy(loadmodel->data_textures, tempaliasskins, loadmodel->num_surfaces * totalskins * sizeof(texture_t));
Mem_Free(tempaliasskins);
skinframe_t tempskinframe;
skinfile_t *skinfiles;
- pinmodel = buffer;
- base = buffer;
+ pinmodel = (md2_t *)buffer;
+ base = (qbyte *)buffer;
version = LittleLong (pinmodel->version);
if (version != MD2ALIAS_VERSION)
loadmodel->num_surfaces = 1;
loadmodel->nummodelsurfaces = loadmodel->num_surfaces;
loadmodel->nummeshes = loadmodel->num_surfaces;
- data = Mem_Alloc(loadmodel->mempool, loadmodel->num_surfaces * sizeof(msurface_t) + loadmodel->num_surfaces * sizeof(int) + loadmodel->nummeshes * sizeof(surfmesh_t *) + loadmodel->nummeshes * sizeof(surfmesh_t));
- loadmodel->data_surfaces = (void *)data;data += loadmodel->num_surfaces * sizeof(msurface_t);
- loadmodel->surfacelist = (void *)data;data += loadmodel->num_surfaces * sizeof(int);
- loadmodel->meshlist = (void *)data;data += loadmodel->num_surfaces * sizeof(surfmesh_t *);
+ data = (qbyte *)Mem_Alloc(loadmodel->mempool, loadmodel->num_surfaces * sizeof(msurface_t) + loadmodel->num_surfaces * sizeof(int) + loadmodel->nummeshes * sizeof(surfmesh_t *) + loadmodel->nummeshes * sizeof(surfmesh_t));
+ loadmodel->data_surfaces = (msurface_t *)data;data += loadmodel->num_surfaces * sizeof(msurface_t);
+ loadmodel->surfacelist = (int *)data;data += loadmodel->num_surfaces * sizeof(int);
+ loadmodel->meshlist = (surfmesh_t **)data;data += loadmodel->num_surfaces * sizeof(surfmesh_t *);
for (i = 0;i < loadmodel->num_surfaces;i++)
{
loadmodel->surfacelist[i] = i;
- loadmodel->meshlist[i] = (void *)data;data += sizeof(surfmesh_t);
+ loadmodel->meshlist[i] = (surfmesh_t *)data;data += sizeof(surfmesh_t);
}
loadmodel->numskins = LittleLong(pinmodel->num_skins);
loadmodel->meshlist[0]->num_triangles = LittleLong(pinmodel->num_tris);
loadmodel->numframes = LittleLong(pinmodel->num_frames);
loadmodel->meshlist[0]->num_morphframes = loadmodel->numframes;
- loadmodel->animscenes = Mem_Alloc(loadmodel->mempool, loadmodel->numframes * sizeof(animscene_t));
+ loadmodel->animscenes = (animscene_t *)Mem_Alloc(loadmodel->mempool, loadmodel->numframes * sizeof(animscene_t));
loadmodel->flags = 0; // there are no MD2 flags
loadmodel->synctype = ST_RAND;
// load the skins
- inskin = (void*)(base + LittleLong(pinmodel->ofs_skins));
+ inskin = (char *)(base + LittleLong(pinmodel->ofs_skins));
skinfiles = Mod_LoadSkinFiles();
if (skinfiles)
{
loadmodel->num_textures = loadmodel->num_surfaces;
- loadmodel->data_textures = Mem_Alloc(loadmodel->mempool, loadmodel->num_surfaces * loadmodel->numskins * sizeof(texture_t));
+ loadmodel->data_textures = (texture_t *)Mem_Alloc(loadmodel->mempool, loadmodel->num_surfaces * loadmodel->numskins * sizeof(texture_t));
Mod_BuildAliasSkinsFromSkinFiles(loadmodel->data_textures, skinfiles, "default", "");
Mod_FreeSkinFiles(skinfiles);
}
{
// skins found (most likely not a player model)
loadmodel->num_textures = loadmodel->num_surfaces;
- loadmodel->data_textures = Mem_Alloc(loadmodel->mempool, loadmodel->num_surfaces * loadmodel->numskins * sizeof(texture_t));
+ loadmodel->data_textures = (texture_t *)Mem_Alloc(loadmodel->mempool, loadmodel->num_surfaces * loadmodel->numskins * sizeof(texture_t));
for (i = 0;i < loadmodel->numskins;i++, inskin += MD2_SKINNAME)
{
if (Mod_LoadSkinFrame(&tempskinframe, inskin, (r_mipskins.integer ? TEXF_MIPMAP : 0) | TEXF_ALPHA | TEXF_PRECACHE | TEXF_PICMIP, true, true))
// no skins (most likely a player model)
loadmodel->numskins = 1;
loadmodel->num_textures = loadmodel->num_surfaces;
- loadmodel->data_textures = Mem_Alloc(loadmodel->mempool, loadmodel->num_surfaces * loadmodel->numskins * sizeof(texture_t));
+ loadmodel->data_textures = (texture_t *)Mem_Alloc(loadmodel->mempool, loadmodel->num_surfaces * loadmodel->numskins * sizeof(texture_t));
Mod_BuildAliasSkinFromSkinFrame(loadmodel->data_textures, NULL);
}
- loadmodel->skinscenes = Mem_Alloc(loadmodel->mempool, sizeof(animscene_t) * loadmodel->numskins);
+ loadmodel->skinscenes = (animscene_t *)Mem_Alloc(loadmodel->mempool, sizeof(animscene_t) * loadmodel->numskins);
for (i = 0;i < loadmodel->numskins;i++)
{
loadmodel->skinscenes[i].firstframe = i;
}
// load the triangles and stvert data
- inst = (void*)(base + LittleLong(pinmodel->ofs_st));
- intri = (void*)(base + LittleLong(pinmodel->ofs_tris));
+ inst = (unsigned short *)(base + LittleLong(pinmodel->ofs_st));
+ intri = (md2triangle_t *)(base + LittleLong(pinmodel->ofs_tris));
skinwidth = LittleLong(pinmodel->skinwidth);
skinheight = LittleLong(pinmodel->skinheight);
- stverts = Mem_Alloc(tempmempool, numst * sizeof(float[2]));
+ stverts = (float *)Mem_Alloc(tempmempool, numst * sizeof(float[2]));
s = 1.0f / skinwidth;
t = 1.0f / skinheight;
for (i = 0;i < numst;i++)
stverts[i*2+1] = k * t;
}
- md2verthash = Mem_Alloc(tempmempool, 256 * sizeof(hash));
- md2verthashdata = Mem_Alloc(tempmempool, loadmodel->meshlist[0]->num_triangles * 3 * sizeof(*hash));
+ md2verthash = (struct md2verthash_s **)Mem_Alloc(tempmempool, 256 * sizeof(hash));
+ md2verthashdata = (struct md2verthash_s *)Mem_Alloc(tempmempool, loadmodel->meshlist[0]->num_triangles * 3 * sizeof(*hash));
// swap the triangle list
num = 0;
- loadmodel->meshlist[0]->data_element3i = Mem_Alloc(loadmodel->mempool, loadmodel->meshlist[0]->num_triangles * sizeof(int[3]));
+ loadmodel->meshlist[0]->data_element3i = (int *)Mem_Alloc(loadmodel->mempool, loadmodel->meshlist[0]->num_triangles * sizeof(int[3]));
for (i = 0;i < loadmodel->meshlist[0]->num_triangles;i++)
{
for (j = 0;j < 3;j++)
numverts = num;
loadmodel->meshlist[0]->num_vertices = numverts;
- vertremap = Mem_Alloc(loadmodel->mempool, num * sizeof(int));
- loadmodel->meshlist[0]->data_texcoordtexture2f = Mem_Alloc(loadmodel->mempool, num * sizeof(float[2]));
+ vertremap = (int *)Mem_Alloc(loadmodel->mempool, num * sizeof(int));
+ loadmodel->meshlist[0]->data_texcoordtexture2f = (float *)Mem_Alloc(loadmodel->mempool, num * sizeof(float[2]));
for (i = 0;i < num;i++)
{
hash = md2verthashdata + i;
// load the frames
datapointer = (base + LittleLong(pinmodel->ofs_frames));
- loadmodel->meshlist[0]->data_morphvertex3f = Mem_Alloc(loadmodel->mempool, numverts * loadmodel->meshlist[0]->num_morphframes * sizeof(float[3]));
+ loadmodel->meshlist[0]->data_morphvertex3f = (float *)Mem_Alloc(loadmodel->mempool, numverts * loadmodel->meshlist[0]->num_morphframes * sizeof(float[3]));
for (i = 0;i < loadmodel->meshlist[0]->num_morphframes;i++)
{
pinframe = (md2frame_t *)datapointer;
scale[j] = LittleFloat(pinframe->scale[j]);
translate[j] = LittleFloat(pinframe->translate[j]);
}
- Mod_MD2_ConvertVerts(scale, translate, (void *)datapointer, loadmodel->meshlist[0]->data_morphvertex3f + i * numverts * 3, numverts, vertremap);
+ Mod_MD2_ConvertVerts(scale, translate, (trivertx_t *)datapointer, loadmodel->meshlist[0]->data_morphvertex3f + i * numverts * 3, numverts, vertremap);
datapointer += numxyz * sizeof(trivertx_t);
strcpy(loadmodel->animscenes[i].name, pinframe->name);
Mem_Free(vertremap);
- loadmodel->meshlist[0]->data_neighbor3i = Mem_Alloc(loadmodel->mempool, loadmodel->meshlist[0]->num_triangles * sizeof(int[3]));
+ loadmodel->meshlist[0]->data_neighbor3i = (int *)Mem_Alloc(loadmodel->mempool, loadmodel->meshlist[0]->num_triangles * sizeof(int[3]));
Mod_BuildTriangleNeighbors(loadmodel->meshlist[0]->data_neighbor3i, loadmodel->meshlist[0]->data_element3i, loadmodel->meshlist[0]->num_triangles);
Mod_CalcAliasModelBBoxes();
Mod_Alias_Mesh_CompileFrameZero(loadmodel->meshlist[0]);
md3tag_t *pintag;
skinfile_t *skinfiles;
- pinmodel = buffer;
+ pinmodel = (md3modelheader_t *)buffer;
if (memcmp(pinmodel->identifier, "IDP3", 4))
Host_Error ("%s is not a MD3 (IDP3) file\n", loadmodel->name);
loadmodel->num_surfaces = LittleLong(pinmodel->num_meshes);
// make skinscenes for the skins (no groups)
- loadmodel->skinscenes = Mem_Alloc(loadmodel->mempool, sizeof(animscene_t) * loadmodel->numskins);
+ loadmodel->skinscenes = (animscene_t *)Mem_Alloc(loadmodel->mempool, sizeof(animscene_t) * loadmodel->numskins);
for (i = 0;i < loadmodel->numskins;i++)
{
loadmodel->skinscenes[i].firstframe = i;
}
// load frameinfo
- loadmodel->animscenes = Mem_Alloc(loadmodel->mempool, loadmodel->numframes * sizeof(animscene_t));
+ loadmodel->animscenes = (animscene_t *)Mem_Alloc(loadmodel->mempool, loadmodel->numframes * sizeof(animscene_t));
for (i = 0, pinframe = (md3frameinfo_t *)((qbyte *)pinmodel + LittleLong(pinmodel->lump_frameinfo));i < loadmodel->numframes;i++, pinframe++)
{
strcpy(loadmodel->animscenes[i].name, pinframe->name);
// load tags
loadmodel->num_tagframes = loadmodel->numframes;
loadmodel->num_tags = LittleLong(pinmodel->num_tags);
- loadmodel->data_tags = Mem_Alloc(loadmodel->mempool, loadmodel->num_tagframes * loadmodel->num_tags * sizeof(aliastag_t));
+ loadmodel->data_tags = (aliastag_t *)Mem_Alloc(loadmodel->mempool, loadmodel->num_tagframes * loadmodel->num_tags * sizeof(aliastag_t));
for (i = 0, pintag = (md3tag_t *)((qbyte *)pinmodel + LittleLong(pinmodel->lump_tags));i < loadmodel->num_tagframes * loadmodel->num_tags;i++, pintag++)
{
strcpy(loadmodel->data_tags[i].name, pintag->name);
loadmodel->nummodelsurfaces = loadmodel->num_surfaces;
loadmodel->nummeshes = loadmodel->num_surfaces;
loadmodel->num_textures = loadmodel->num_surfaces;
- data = Mem_Alloc(loadmodel->mempool, loadmodel->num_surfaces * sizeof(msurface_t) + loadmodel->num_surfaces * sizeof(int) + loadmodel->nummeshes * sizeof(surfmesh_t *) + loadmodel->nummeshes * sizeof(surfmesh_t) + loadmodel->num_surfaces * loadmodel->numskins * sizeof(texture_t));
- loadmodel->data_surfaces = (void *)data;data += loadmodel->num_surfaces * sizeof(msurface_t);
- loadmodel->surfacelist = (void *)data;data += loadmodel->num_surfaces * sizeof(int);
- loadmodel->meshlist = (void *)data;data += loadmodel->num_surfaces * sizeof(surfmesh_t *);
- loadmodel->data_textures = (void *)data;data += loadmodel->num_surfaces * loadmodel->numskins * sizeof(texture_t);
+ data = (qbyte *)Mem_Alloc(loadmodel->mempool, loadmodel->num_surfaces * sizeof(msurface_t) + loadmodel->num_surfaces * sizeof(int) + loadmodel->nummeshes * sizeof(surfmesh_t *) + loadmodel->nummeshes * sizeof(surfmesh_t) + loadmodel->num_surfaces * loadmodel->numskins * sizeof(texture_t));
+ loadmodel->data_surfaces = (msurface_t *)data;data += loadmodel->num_surfaces * sizeof(msurface_t);
+ loadmodel->surfacelist = (int *)data;data += loadmodel->num_surfaces * sizeof(int);
+ loadmodel->meshlist = (surfmesh_t **)data;data += loadmodel->num_surfaces * sizeof(surfmesh_t *);
+ loadmodel->data_textures = (texture_t *)data;data += loadmodel->num_surfaces * loadmodel->numskins * sizeof(texture_t);
for (i = 0;i < loadmodel->num_surfaces;i++)
{
loadmodel->surfacelist[i] = i;
- loadmodel->meshlist[i] = (void *)data;data += sizeof(surfmesh_t);
+ loadmodel->meshlist[i] = (surfmesh_t *)data;data += sizeof(surfmesh_t);
}
for (i = 0, pinmesh = (md3mesh_t *)((qbyte *)pinmodel + LittleLong(pinmodel->lump_meshes));i < loadmodel->num_surfaces;i++, pinmesh = (md3mesh_t *)((qbyte *)pinmesh + LittleLong(pinmesh->lump_end)))
{
mesh->num_morphframes = LittleLong(pinmesh->num_frames);
mesh->num_vertices = LittleLong(pinmesh->num_vertices);
mesh->num_triangles = LittleLong(pinmesh->num_triangles);
- mesh->data_element3i = Mem_Alloc(loadmodel->mempool, mesh->num_triangles * sizeof(int[3]));
- mesh->data_neighbor3i = Mem_Alloc(loadmodel->mempool, mesh->num_triangles * sizeof(int[3]));
- mesh->data_texcoordtexture2f = Mem_Alloc(loadmodel->mempool, mesh->num_vertices * sizeof(float[2]));
- mesh->data_morphvertex3f = Mem_Alloc(loadmodel->mempool, mesh->num_vertices * mesh->num_morphframes * sizeof(float[3]));
+ mesh->data_element3i = (int *)Mem_Alloc(loadmodel->mempool, mesh->num_triangles * sizeof(int[3]));
+ mesh->data_neighbor3i = (int *)Mem_Alloc(loadmodel->mempool, mesh->num_triangles * sizeof(int[3]));
+ mesh->data_texcoordtexture2f = (float *)Mem_Alloc(loadmodel->mempool, mesh->num_vertices * sizeof(float[2]));
+ mesh->data_morphvertex3f = (float *)Mem_Alloc(loadmodel->mempool, mesh->num_vertices * mesh->num_morphframes * sizeof(float[3]));
for (j = 0;j < mesh->num_triangles * 3;j++)
mesh->data_element3i[j] = LittleLong(((int *)((qbyte *)pinmesh + LittleLong(pinmesh->lump_elements)))[j]);
for (j = 0;j < mesh->num_vertices;j++)
msurface_t *surface;
surfmesh_t *mesh;
- pinmodel = (void *)buffer;
- pbase = buffer;
+ pinmodel = (zymtype1header_t *)buffer;
+ pbase = (qbyte *)buffer;
if (memcmp(pinmodel->id, "ZYMOTICMODEL", 12))
Host_Error ("Mod_ZYMOTICMODEL_Load: %s is not a zymotic model\n");
if (BigLong(pinmodel->type) != 1)
loadmodel->numskins = 1;
// make skinscenes for the skins (no groups)
- loadmodel->skinscenes = Mem_Alloc(loadmodel->mempool, sizeof(animscene_t) * loadmodel->numskins);
+ loadmodel->skinscenes = (animscene_t *)Mem_Alloc(loadmodel->mempool, sizeof(animscene_t) * loadmodel->numskins);
for (i = 0;i < loadmodel->numskins;i++)
{
loadmodel->skinscenes[i].firstframe = i;
// go through the lumps, swapping things
//zymlump_t lump_scenes; // zymscene_t scene[numscenes]; // name and other information for each scene (see zymscene struct)
- loadmodel->animscenes = Mem_Alloc(loadmodel->mempool, sizeof(animscene_t) * loadmodel->numframes);
- scene = (void *) (pheader->lump_scenes.start + pbase);
+ loadmodel->animscenes = (animscene_t *)Mem_Alloc(loadmodel->mempool, sizeof(animscene_t) * loadmodel->numframes);
+ scene = (zymscene_t *) (pheader->lump_scenes.start + pbase);
numposes = pheader->lump_poses.length / pheader->numbones / sizeof(float[3][4]);
for (i = 0;i < pheader->numscenes;i++)
{
//zymlump_t lump_poses; // float pose[numposes][numbones][3][4]; // animation data
loadmodel->num_poses = pheader->lump_poses.length / sizeof(float[3][4]);
- loadmodel->data_poses = Mem_Alloc(loadmodel->mempool, pheader->lump_poses.length);
- poses = (void *) (pheader->lump_poses.start + pbase);
+ loadmodel->data_poses = (float *)Mem_Alloc(loadmodel->mempool, pheader->lump_poses.length);
+ poses = (float *) (pheader->lump_poses.start + pbase);
for (i = 0;i < pheader->lump_poses.length / 4;i++)
loadmodel->data_poses[i] = BigFloat(poses[i]);
//zymlump_t lump_bones; // zymbone_t bone[numbones];
loadmodel->num_bones = pheader->numbones;
- loadmodel->data_bones = Mem_Alloc(loadmodel->mempool, pheader->numbones * sizeof(aliasbone_t));
- bone = (void *) (pheader->lump_bones.start + pbase);
+ loadmodel->data_bones = (aliasbone_t *)Mem_Alloc(loadmodel->mempool, pheader->numbones * sizeof(aliasbone_t));
+ bone = (zymbone_t *) (pheader->lump_bones.start + pbase);
for (i = 0;i < pheader->numbones;i++)
{
memcpy(loadmodel->data_bones[i].name, bone[i].name, sizeof(bone[i].name));
}
//zymlump_t lump_vertbonecounts; // int vertbonecounts[numvertices]; // how many bones influence each vertex (separate mainly to make this compress better)
- vertbonecounts = Mem_Alloc(loadmodel->mempool, pheader->numverts * sizeof(int));
- bonecount = (void *) (pheader->lump_vertbonecounts.start + pbase);
+ vertbonecounts = (int *)Mem_Alloc(loadmodel->mempool, pheader->numverts * sizeof(int));
+ bonecount = (int *) (pheader->lump_vertbonecounts.start + pbase);
for (i = 0;i < pheader->numverts;i++)
{
vertbonecounts[i] = BigLong(bonecount[i]);
}
//zymlump_t lump_verts; // zymvertex_t vert[numvertices]; // see vertex struct
- verts = Mem_Alloc(loadmodel->mempool, pheader->lump_verts.length);
- vertdata = (void *) (pheader->lump_verts.start + pbase);
+ verts = (zymvertex_t *)Mem_Alloc(loadmodel->mempool, pheader->lump_verts.length);
+ vertdata = (zymvertex_t *) (pheader->lump_verts.start + pbase);
for (i = 0;i < pheader->lump_verts.length / (int) sizeof(zymvertex_t);i++)
{
verts[i].bonenum = BigLong(vertdata[i].bonenum);
}
//zymlump_t lump_texcoords; // float texcoords[numvertices][2];
- outtexcoord2f = Mem_Alloc(loadmodel->mempool, pheader->numverts * sizeof(float[2]));
- intexcoord2f = (void *) (pheader->lump_texcoords.start + pbase);
+ outtexcoord2f = (float *)Mem_Alloc(loadmodel->mempool, pheader->numverts * sizeof(float[2]));
+ intexcoord2f = (float *) (pheader->lump_texcoords.start + pbase);
for (i = 0;i < pheader->numverts;i++)
{
outtexcoord2f[i*2+0] = BigFloat(intexcoord2f[i*2+0]);
loadmodel->nummodelsurfaces = loadmodel->num_surfaces;
loadmodel->nummeshes = loadmodel->num_surfaces;
loadmodel->num_textures = loadmodel->num_surfaces;
- data = Mem_Alloc(loadmodel->mempool, loadmodel->num_surfaces * sizeof(msurface_t) + loadmodel->num_surfaces * sizeof(int) + loadmodel->nummeshes * sizeof(surfmesh_t *) + loadmodel->nummeshes * sizeof(surfmesh_t) + loadmodel->num_surfaces * loadmodel->numskins * sizeof(texture_t));
- loadmodel->data_surfaces = (void *)data;data += loadmodel->num_surfaces * sizeof(msurface_t);
- loadmodel->surfacelist = (void *)data;data += loadmodel->num_surfaces * sizeof(int);
- loadmodel->meshlist = (void *)data;data += loadmodel->num_surfaces * sizeof(surfmesh_t *);
- loadmodel->data_textures = (void *)data;data += loadmodel->num_surfaces * loadmodel->numskins * sizeof(texture_t);
+ data = (qbyte *)Mem_Alloc(loadmodel->mempool, loadmodel->num_surfaces * sizeof(msurface_t) + loadmodel->num_surfaces * sizeof(int) + loadmodel->nummeshes * sizeof(surfmesh_t *) + loadmodel->nummeshes * sizeof(surfmesh_t) + loadmodel->num_surfaces * loadmodel->numskins * sizeof(texture_t));
+ loadmodel->data_surfaces = (msurface_t *)data;data += loadmodel->num_surfaces * sizeof(msurface_t);
+ loadmodel->surfacelist = (int *)data;data += loadmodel->num_surfaces * sizeof(int);
+ loadmodel->meshlist = (surfmesh_t **)data;data += loadmodel->num_surfaces * sizeof(surfmesh_t *);
+ loadmodel->data_textures = (texture_t *)data;data += loadmodel->num_surfaces * loadmodel->numskins * sizeof(texture_t);
for (i = 0;i < loadmodel->num_surfaces;i++)
{
loadmodel->surfacelist[i] = i;
- loadmodel->meshlist[i] = (void *)data;data += sizeof(surfmesh_t);
+ loadmodel->meshlist[i] = (surfmesh_t *)data;data += sizeof(surfmesh_t);
}
//zymlump_t lump_shaders; // char shadername[numshaders][32]; // shaders used on this model
count = pheader->numshaders * sizeof(int) + pheader->numtris * sizeof(int[3]);
if (pheader->lump_render.length != count)
Host_Error("%s renderlist is wrong size (%i bytes, should be %i bytes)\n", loadmodel->name, pheader->lump_render.length, count);
- renderlist = (void *) (pheader->lump_render.start + pbase);
- renderlistend = (void *) ((qbyte *) renderlist + pheader->lump_render.length);
+ renderlist = (int *) (pheader->lump_render.start + pbase);
+ renderlistend = (int *) ((qbyte *) renderlist + pheader->lump_render.length);
for (i = 0;i < loadmodel->num_surfaces;i++)
{
if (renderlist >= renderlistend)
Host_Error("%s corrupt renderlist (wrong size)\n", loadmodel->name);
mesh = loadmodel->meshlist[i];
mesh->num_triangles = count;
- mesh->data_element3i = Mem_Alloc(loadmodel->mempool, mesh->num_triangles * sizeof(int[3]));
- mesh->data_neighbor3i = Mem_Alloc(loadmodel->mempool, mesh->num_triangles * sizeof(int[3]));
+ mesh->data_element3i = (int *)Mem_Alloc(loadmodel->mempool, mesh->num_triangles * sizeof(int[3]));
+ mesh->data_neighbor3i = (int *)Mem_Alloc(loadmodel->mempool, mesh->num_triangles * sizeof(int[3]));
outelements = mesh->data_element3i;
for (j = 0;j < mesh->num_triangles;j++)
{
renderlist += 3;
outelements += 3;
}
- remapvertices = Mem_Alloc(loadmodel->mempool, pheader->numverts * sizeof(int));
+ remapvertices = (int *)Mem_Alloc(loadmodel->mempool, pheader->numverts * sizeof(int));
mesh->num_vertices = Mod_BuildVertexRemapTableFromElements(mesh->num_triangles * 3, mesh->data_element3i, pheader->numverts, remapvertices);
for (j = 0;j < mesh->num_triangles * 3;j++)
mesh->data_element3i[j] = remapvertices[mesh->data_element3i[j]];
- mesh->data_texcoordtexture2f = Mem_Alloc(loadmodel->mempool, mesh->num_vertices * sizeof(float[2]));
+ mesh->data_texcoordtexture2f = (float *)Mem_Alloc(loadmodel->mempool, mesh->num_vertices * sizeof(float[2]));
for (j = 0;j < pheader->numverts;j++)
{
if (remapvertices[j] >= 0)
for (j = 0;j < pheader->numverts;j++)
if (remapvertices[j] >= 0)
mesh->num_vertexboneweights += vertbonecounts[remapvertices[j]];
- mesh->data_vertexboneweights = Mem_Alloc(loadmodel->mempool, mesh->num_vertexboneweights * sizeof(surfmeshvertexboneweight_t));
+ mesh->data_vertexboneweights = (surfmeshvertexboneweight_t *)Mem_Alloc(loadmodel->mempool, mesh->num_vertexboneweights * sizeof(surfmeshvertexboneweight_t));
mesh->num_vertexboneweights = 0;
// note this vertexboneweight ordering requires that the remapvertices array is sequential numbers (separated by -1 values for omitted vertices)
l = 0;
skinfile_t *skinfiles;
qbyte *data;
- pheader = (void *)buffer;
- pbase = buffer;
+ pheader = (dpmheader_t *)buffer;
+ pbase = (qbyte *)buffer;
if (memcmp(pheader->id, "DARKPLACESMODEL\0", 16))
Host_Error ("Mod_DARKPLACESMODEL_Load: %s is not a darkplaces model\n");
if (BigLong(pheader->type) != 2)
loadmodel->num_textures = loadmodel->nummeshes = loadmodel->nummodelsurfaces = loadmodel->num_surfaces = pheader->num_meshs;
// do most allocations as one merged chunk
- data = Mem_Alloc(loadmodel->mempool, loadmodel->num_surfaces * sizeof(msurface_t) + loadmodel->num_surfaces * sizeof(int) + loadmodel->nummeshes * sizeof(surfmesh_t *) + loadmodel->nummeshes * sizeof(surfmesh_t) + loadmodel->num_surfaces * loadmodel->numskins * sizeof(texture_t) + loadmodel->numskins * sizeof(animscene_t) + loadmodel->num_bones * sizeof(aliasbone_t) + loadmodel->num_poses * sizeof(float[12]) + loadmodel->numframes * sizeof(animscene_t));
- loadmodel->data_surfaces = (void *)data;data += loadmodel->num_surfaces * sizeof(msurface_t);
- loadmodel->surfacelist = (void *)data;data += loadmodel->num_surfaces * sizeof(int);
- loadmodel->meshlist = (void *)data;data += loadmodel->num_surfaces * sizeof(surfmesh_t *);
- loadmodel->data_textures = (void *)data;data += loadmodel->num_surfaces * loadmodel->numskins * sizeof(texture_t);
- loadmodel->skinscenes = (void *)data;data += loadmodel->numskins * sizeof(animscene_t);
- loadmodel->data_bones = (void *)data;data += loadmodel->num_bones * sizeof(aliasbone_t);
- loadmodel->data_poses = (void *)data;data += loadmodel->num_poses * sizeof(float[12]);
- loadmodel->animscenes = (void *)data;data += loadmodel->numframes * sizeof(animscene_t);
+ data = (qbyte *)Mem_Alloc(loadmodel->mempool, loadmodel->num_surfaces * sizeof(msurface_t) + loadmodel->num_surfaces * sizeof(int) + loadmodel->nummeshes * sizeof(surfmesh_t *) + loadmodel->nummeshes * sizeof(surfmesh_t) + loadmodel->num_surfaces * loadmodel->numskins * sizeof(texture_t) + loadmodel->numskins * sizeof(animscene_t) + loadmodel->num_bones * sizeof(aliasbone_t) + loadmodel->num_poses * sizeof(float[12]) + loadmodel->numframes * sizeof(animscene_t));
+ loadmodel->data_surfaces = (msurface_t *)data;data += loadmodel->num_surfaces * sizeof(msurface_t);
+ loadmodel->surfacelist = (int *)data;data += loadmodel->num_surfaces * sizeof(int);
+ loadmodel->meshlist = (surfmesh_t **)data;data += loadmodel->num_surfaces * sizeof(surfmesh_t *);
+ loadmodel->data_textures = (texture_t *)data;data += loadmodel->num_surfaces * loadmodel->numskins * sizeof(texture_t);
+ loadmodel->skinscenes = (animscene_t *)data;data += loadmodel->numskins * sizeof(animscene_t);
+ loadmodel->data_bones = (aliasbone_t *)data;data += loadmodel->num_bones * sizeof(aliasbone_t);
+ loadmodel->data_poses = (float *)data;data += loadmodel->num_poses * sizeof(float[12]);
+ loadmodel->animscenes = (animscene_t *)data;data += loadmodel->numframes * sizeof(animscene_t);
for (i = 0;i < loadmodel->numskins;i++)
{
loadmodel->skinscenes[i].firstframe = i;
for (i = 0;i < loadmodel->num_surfaces;i++)
{
loadmodel->surfacelist[i] = i;
- loadmodel->meshlist[i] = (void *)data;data += sizeof(surfmesh_t);
+ loadmodel->meshlist[i] = (surfmesh_t *)data;data += sizeof(surfmesh_t);
}
// load the bone info
- bone = (void *) (pbase + pheader->ofs_bones);
+ bone = (dpmbone_t *) (pbase + pheader->ofs_bones);
for (i = 0;i < loadmodel->num_bones;i++)
{
memcpy(loadmodel->data_bones[i].name, bone[i].name, sizeof(bone[i].name));
}
// load the frames
- frame = (void *) (pbase + pheader->ofs_frames);
+ frame = (dpmframe_t *) (pbase + pheader->ofs_frames);
for (i = 0;i < loadmodel->numframes;i++)
{
const float *poses;
loadmodel->animscenes[i].loop = true;
loadmodel->animscenes[i].framerate = 10;
// load the bone poses for this frame
- poses = (void *) (pbase + BigLong(frame->ofs_bonepositions));
+ poses = (float *) (pbase + BigLong(frame->ofs_bonepositions));
for (j = 0;j < loadmodel->num_bones*12;j++)
loadmodel->data_poses[i * loadmodel->num_bones*12 + j] = BigFloat(poses[j]);
// stuff not processed here: mins, maxs, yawradius, allradius
}
// load the meshes now
- dpmmesh = (void *) (pbase + pheader->ofs_meshs);
+ dpmmesh = (dpmmesh_t *) (pbase + pheader->ofs_meshs);
for (i = 0;i < loadmodel->num_surfaces;i++)
{
const int *inelements;
// to find out how many weights exist we two a two-stage load...
mesh->num_vertexboneweights = 0;
- data = (void *) (pbase + BigLong(dpmmesh->ofs_verts));
+ data = (qbyte *) (pbase + BigLong(dpmmesh->ofs_verts));
for (j = 0;j < mesh->num_vertices;j++)
{
int numweights = BigLong(((dpmvertex_t *)data)->numbones);
}
// allocate things now that we know how many
- mesh->data_vertexboneweights = Mem_Alloc(loadmodel->mempool, mesh->num_vertexboneweights * sizeof(surfmeshvertexboneweight_t));
- mesh->data_element3i = Mem_Alloc(loadmodel->mempool, mesh->num_triangles * sizeof(int[3]));
- mesh->data_neighbor3i = Mem_Alloc(loadmodel->mempool, mesh->num_triangles * sizeof(int[3]));
- mesh->data_texcoordtexture2f = Mem_Alloc(loadmodel->mempool, mesh->num_vertices * sizeof(float[2]));
+ mesh->data_vertexboneweights = (surfmeshvertexboneweight_t *)Mem_Alloc(loadmodel->mempool, mesh->num_vertexboneweights * sizeof(surfmeshvertexboneweight_t));
+ mesh->data_element3i = (int *)Mem_Alloc(loadmodel->mempool, mesh->num_triangles * sizeof(int[3]));
+ mesh->data_neighbor3i = (int *)Mem_Alloc(loadmodel->mempool, mesh->num_triangles * sizeof(int[3]));
+ mesh->data_texcoordtexture2f = (float *)Mem_Alloc(loadmodel->mempool, mesh->num_vertices * sizeof(float[2]));
- inelements = (void *) (pbase + BigLong(dpmmesh->ofs_indices));
+ inelements = (int *) (pbase + BigLong(dpmmesh->ofs_indices));
outelements = mesh->data_element3i;
for (j = 0;j < mesh->num_triangles;j++)
{
outelements += 3;
}
- intexcoord = (void *) (pbase + BigLong(dpmmesh->ofs_texcoords));
+ intexcoord = (float *) (pbase + BigLong(dpmmesh->ofs_texcoords));
for (j = 0;j < mesh->num_vertices*2;j++)
mesh->data_texcoordtexture2f[j] = BigFloat(intexcoord[j]);
// now load them for real
mesh->num_vertexboneweights = 0;
- data = (void *) (pbase + BigLong(dpmmesh->ofs_verts));
+ data = (qbyte *) (pbase + BigLong(dpmmesh->ofs_verts));
for (j = 0;j < mesh->num_vertices;j++)
{
int numweights = BigLong(((dpmvertex_t *)data)->numbones);
data += sizeof(dpmvertex_t);
for (k = 0;k < numweights;k++)
{
- const dpmbonevert_t *vert = (void *) data;
+ const dpmbonevert_t *vert = (dpmbonevert_t *) data;
// stuff not processed here: normal
mesh->data_vertexboneweights[mesh->num_vertexboneweights].vertexindex = j;
mesh->data_vertexboneweights[mesh->num_vertexboneweights].boneindex = BigLong(vert->bonenum);
skinfile_t *skinfiles;
char animname[MAX_QPATH];
- pchunk = (void *)buffer;
+ pchunk = (pskchunk_t *)buffer;
if (strcmp(pchunk->id, "ACTRHEAD"))
Host_Error ("Mod_PSKMODEL_Load: %s is not a ActorX model\n");
skinfiles = Mod_LoadSkinFiles();
if (loadmodel->numskins < 1)
loadmodel->numskins = 1;
- loadmodel->skinscenes = Mem_Alloc(loadmodel->mempool, loadmodel->numskins * sizeof(animscene_t));
+ loadmodel->skinscenes = (animscene_t *)Mem_Alloc(loadmodel->mempool, loadmodel->numskins * sizeof(animscene_t));
for (i = 0;i < loadmodel->numskins;i++)
{
loadmodel->skinscenes[i].firstframe = i;
while (buffer < bufferend)
{
- pchunk = buffer;
+ pchunk = (pskchunk_t *)buffer;
buffer = (void *)((unsigned char *)buffer + sizeof(pskchunk_t));
version = LittleLong(pchunk->version);
recordsize = LittleLong(pchunk->recordsize);
Host_Error("%s: %s has unsupported recordsize\n", loadmodel->name, pchunk->id);
// byteswap in place and keep the pointer
numpnts = numrecords;
- pnts = buffer;
- for (index = 0, p = buffer;index < numrecords;index++, p++)
+ pnts = (pskpnts_t *)buffer;
+ for (index = 0, p = (pskpnts_t *)buffer;index < numrecords;index++, p++)
{
p->origin[0] = LittleFloat(p->origin[0]);
p->origin[1] = LittleFloat(p->origin[1]);
Host_Error("%s: %s has unsupported recordsize\n", loadmodel->name, pchunk->id);
// byteswap in place and keep the pointer
numvtxw = numrecords;
- vtxw = buffer;
- for (index = 0, p = buffer;index < numrecords;index++, p++)
+ vtxw = (pskvtxw_t *)buffer;
+ for (index = 0, p = (pskvtxw_t *)buffer;index < numrecords;index++, p++)
{
p->pntsindex = LittleShort(p->pntsindex);
p->texcoord[0] = LittleFloat(p->texcoord[0]);
Host_Error("%s: %s has unsupported recordsize\n", loadmodel->name, pchunk->id);
// byteswap in place and keep the pointer
numfaces = numrecords;
- faces = buffer;
- for (index = 0, p = buffer;index < numrecords;index++, p++)
+ faces = (pskface_t *)buffer;
+ for (index = 0, p = (pskface_t *)buffer;index < numrecords;index++, p++)
{
p->vtxwindex[0] = LittleShort(p->vtxwindex[0]);
p->vtxwindex[1] = LittleShort(p->vtxwindex[1]);
Host_Error("%s: %s has unsupported recordsize\n", loadmodel->name, pchunk->id);
// byteswap in place and keep the pointer
nummatts = numrecords;
- matts = buffer;
- for (index = 0, p = buffer;index < numrecords;index++, p++)
+ matts = (pskmatt_t *)buffer;
+ for (index = 0, p = (pskmatt_t *)buffer;index < numrecords;index++, p++)
{
}
buffer = p;
Host_Error("%s: %s has unsupported recordsize\n", loadmodel->name, pchunk->id);
// byteswap in place and keep the pointer
numbones = numrecords;
- bones = buffer;
- for (index = 0, p = buffer;index < numrecords;index++, p++)
+ bones = (pskboneinfo_t *)buffer;
+ for (index = 0, p = (pskboneinfo_t *)buffer;index < numrecords;index++, p++)
{
p->numchildren = LittleLong(p->numchildren);
p->parent = LittleLong(p->parent);
Host_Error("%s: %s has unsupported recordsize\n", loadmodel->name, pchunk->id);
// byteswap in place and keep the pointer
numrawweights = numrecords;
- rawweights = buffer;
- for (index = 0, p = buffer;index < numrecords;index++, p++)
+ rawweights = (pskrawweights_t *)buffer;
+ for (index = 0, p = (pskrawweights_t *)buffer;index < numrecords;index++, p++)
{
p->weight = LittleFloat(p->weight);
p->pntsindex = LittleLong(p->pntsindex);
while (animbuffer < animbufferend)
{
- pchunk = animbuffer;
+ pchunk = (pskchunk_t *)animbuffer;
animbuffer = (void *)((unsigned char *)animbuffer + sizeof(pskchunk_t));
version = LittleLong(pchunk->version);
recordsize = LittleLong(pchunk->recordsize);
Host_Error("%s: %s has unsupported recordsize\n", animname, pchunk->id);
// byteswap in place and keep the pointer
numanimbones = numrecords;
- animbones = animbuffer;
+ animbones = (pskboneinfo_t *)animbuffer;
// NOTE: supposedly psa does not need to match the psk model, the
// bones missing from the psa would simply use their base
// positions from the psk, but this is hard for me to implement
// and people can easily make animations that match.
if (numanimbones != numbones)
Host_Error("%s: this loader only supports animations with the same bones as the mesh\n");
- for (index = 0, p = animbuffer;index < numrecords;index++, p++)
+ for (index = 0, p = (pskboneinfo_t *)animbuffer;index < numrecords;index++, p++)
{
p->numchildren = LittleLong(p->numchildren);
p->parent = LittleLong(p->parent);
Host_Error("%s: %s has unsupported recordsize\n", animname, pchunk->id);
// byteswap in place and keep the pointer
numanims = numrecords;
- anims = animbuffer;
- for (index = 0, p = animbuffer;index < numrecords;index++, p++)
+ anims = (pskaniminfo_t *)animbuffer;
+ for (index = 0, p = (pskaniminfo_t *)animbuffer;index < numrecords;index++, p++)
{
p->numbones = LittleLong(p->numbones);
p->playtime = LittleFloat(p->playtime);
if (recordsize != sizeof(*p))
Host_Error("%s: %s has unsupported recordsize\n", animname, pchunk->id);
numanimkeys = numrecords;
- animkeys = animbuffer;
- for (index = 0, p = animbuffer;index < numrecords;index++, p++)
+ animkeys = (pskanimkeys_t *)animbuffer;
+ for (index = 0, p = (pskanimkeys_t *)animbuffer;index < numrecords;index++, p++)
{
p->origin[0] = LittleFloat(p->origin[0]);
p->origin[1] = LittleFloat(p->origin[1]);
if (numanimkeys != loadmodel->num_bones * loadmodel->numframes)
Host_Error("%s: %s has incorrect number of animation keys\n", animname, pchunk->id);
- loadmodel->data_poses = Mem_Alloc(loadmodel->mempool, loadmodel->num_poses * sizeof(float[12]));
- loadmodel->animscenes = Mem_Alloc(loadmodel->mempool, loadmodel->numframes * sizeof(animscene_t));
- loadmodel->data_textures = Mem_Alloc(loadmodel->mempool, loadmodel->num_surfaces * loadmodel->numskins * sizeof(texture_t));
- loadmodel->data_surfaces = Mem_Alloc(loadmodel->mempool, loadmodel->num_surfaces * sizeof(msurface_t));
- loadmodel->surfacelist = Mem_Alloc(loadmodel->mempool, loadmodel->num_surfaces * sizeof(int));
- loadmodel->data_bones = Mem_Alloc(loadmodel->mempool, loadmodel->num_bones * sizeof(aliasbone_t));
+ loadmodel->data_poses = (float *)Mem_Alloc(loadmodel->mempool, loadmodel->num_poses * sizeof(float[12]));
+ loadmodel->animscenes = (animscene_t *)Mem_Alloc(loadmodel->mempool, loadmodel->numframes * sizeof(animscene_t));
+ loadmodel->data_textures = (texture_t *)Mem_Alloc(loadmodel->mempool, loadmodel->num_surfaces * loadmodel->numskins * sizeof(texture_t));
+ loadmodel->data_surfaces = (msurface_t *)Mem_Alloc(loadmodel->mempool, loadmodel->num_surfaces * sizeof(msurface_t));
+ loadmodel->surfacelist = (int *)Mem_Alloc(loadmodel->mempool, loadmodel->num_surfaces * sizeof(int));
+ loadmodel->data_bones = (aliasbone_t *)Mem_Alloc(loadmodel->mempool, loadmodel->num_bones * sizeof(aliasbone_t));
- loadmodel->meshlist = Mem_Alloc(loadmodel->mempool, sizeof(surfmesh_t *));
- mesh = loadmodel->meshlist[0] = Mem_Alloc(loadmodel->mempool, sizeof(surfmesh_t));
+ loadmodel->meshlist = (surfmesh_t **)Mem_Alloc(loadmodel->mempool, sizeof(surfmesh_t *));
+ mesh = loadmodel->meshlist[0] = (surfmesh_t *)Mem_Alloc(loadmodel->mempool, sizeof(surfmesh_t));
mesh->num_vertices = numvtxw;
mesh->num_triangles = numfaces;
- mesh->data_element3i = Mem_Alloc(loadmodel->mempool, mesh->num_triangles * sizeof(int[3]));
- mesh->data_neighbor3i = Mem_Alloc(loadmodel->mempool, mesh->num_triangles * sizeof(int[3]));
- mesh->data_texcoordtexture2f = Mem_Alloc(loadmodel->mempool, mesh->num_vertices * sizeof(float[2]));
+ mesh->data_element3i = (int *)Mem_Alloc(loadmodel->mempool, mesh->num_triangles * sizeof(int[3]));
+ mesh->data_neighbor3i = (int *)Mem_Alloc(loadmodel->mempool, mesh->num_triangles * sizeof(int[3]));
+ mesh->data_texcoordtexture2f = (float *)Mem_Alloc(loadmodel->mempool, mesh->num_vertices * sizeof(float[2]));
// create surfaces
for (index = 0, i = 0;index < nummatts;index++)
for (j = 0;j < numrawweights;j++)
if (rawweights[j].pntsindex == vtxw[index].pntsindex)
mesh->num_vertexboneweights++;
- mesh->data_vertexboneweights = Mem_Alloc(loadmodel->mempool, mesh->num_vertexboneweights * sizeof(surfmeshvertexboneweight_t));
+ mesh->data_vertexboneweights = (surfmeshvertexboneweight_t *)Mem_Alloc(loadmodel->mempool, mesh->num_vertexboneweights * sizeof(surfmeshvertexboneweight_t));
mesh->num_vertexboneweights = 0;
for (index = 0;index < numvtxw;index++)
{
loadmodel->num_textures = 2;
}
- loadmodel->data_textures = Mem_Alloc(loadmodel->mempool, loadmodel->num_textures * sizeof(texture_t));
+ loadmodel->data_textures = (texture_t *)Mem_Alloc(loadmodel->mempool, loadmodel->num_textures * sizeof(texture_t));
// fill out all slots with notexture
for (i = 0, tx = loadmodel->data_textures;i < loadmodel->num_textures;i++, tx++)
tx->skin.base = tx->skin.merged = R_LoadTexture2D(loadmodel->texturepool, tx->name, image_width, image_height, pixels, TEXTYPE_RGBA, TEXF_MIPMAP | TEXF_ALPHA | TEXF_PRECACHE | TEXF_PICMIP, NULL);
if (Image_CheckAlpha(pixels, image_width * image_height, true))
{
- fogpixels = Mem_Alloc(tempmempool, image_width * image_height * 4);
+ fogpixels = (qbyte *)Mem_Alloc(tempmempool, image_width * image_height * 4);
for (j = 0;j < image_width * image_height * 4;j += 4)
{
fogpixels[j + 0] = 255;
loadmodel->brushq1.lightdata = NULL;
if (loadmodel->brush.ishlbsp) // LordHavoc: load the colored lighting data straight
{
- loadmodel->brushq1.lightdata = Mem_Alloc(loadmodel->mempool, l->filelen);
+ loadmodel->brushq1.lightdata = (qbyte *)Mem_Alloc(loadmodel->mempool, l->filelen);
for (i=0; i<l->filelen; i++)
loadmodel->brushq1.lightdata[i] = mod_base[l->fileofs+i] >>= 1;
}
else if (loadmodel->brush.ismcbsp)
{
- loadmodel->brushq1.lightdata = Mem_Alloc(loadmodel->mempool, l->filelen);
+ loadmodel->brushq1.lightdata = (qbyte *)Mem_Alloc(loadmodel->mempool, l->filelen);
memcpy(loadmodel->brushq1.lightdata, mod_base + l->fileofs, l->filelen);
}
else // LordHavoc: bsp version 29 (normal white lighting)
if (i == 1)
{
Con_DPrintf("loaded %s\n", litfilename);
- loadmodel->brushq1.lightdata = Mem_Alloc(loadmodel->mempool, fs_filesize - 8);
+ loadmodel->brushq1.lightdata = (qbyte *)Mem_Alloc(loadmodel->mempool, fs_filesize - 8);
memcpy(loadmodel->brushq1.lightdata, data + 8, fs_filesize - 8);
Mem_Free(data);
return;
// LordHavoc: oh well, expand the white lighting data
if (!l->filelen)
return;
- loadmodel->brushq1.lightdata = Mem_Alloc(loadmodel->mempool, l->filelen*3);
+ loadmodel->brushq1.lightdata = (qbyte *)Mem_Alloc(loadmodel->mempool, l->filelen*3);
in = loadmodel->brushq1.lightdata + l->filelen*2; // place the file at the end, so it will not be overwritten until the very last write
out = loadmodel->brushq1.lightdata;
memcpy(in, mod_base + l->fileofs, l->filelen);
s++;
numlights++;
}
- loadmodel->brushq1.lights = Mem_Alloc(loadmodel->mempool, numlights * sizeof(mlight_t));
+ loadmodel->brushq1.lights = (mlight_t *)Mem_Alloc(loadmodel->mempool, numlights * sizeof(mlight_t));
s = lightsstring;
n = 0;
while (*s && n < numlights)
if (!l->filelen)
return;
loadmodel->brushq1.num_compressedpvs = l->filelen;
- loadmodel->brushq1.data_compressedpvs = Mem_Alloc(loadmodel->mempool, l->filelen);
+ loadmodel->brushq1.data_compressedpvs = (qbyte *)Mem_Alloc(loadmodel->mempool, l->filelen);
memcpy(loadmodel->brushq1.data_compressedpvs, mod_base + l->fileofs, l->filelen);
}
loadmodel->brush.entities = NULL;
if (!l->filelen)
return;
- loadmodel->brush.entities = Mem_Alloc(loadmodel->mempool, l->filelen);
+ loadmodel->brush.entities = (char *)Mem_Alloc(loadmodel->mempool, l->filelen);
memcpy(loadmodel->brush.entities, mod_base + l->fileofs, l->filelen);
if (loadmodel->brush.ishlbsp)
Mod_Q1BSP_ParseWadsFromEntityLump(loadmodel->brush.entities);
mvertex_t *out;
int i, count;
- in = (void *)(mod_base + l->fileofs);
+ in = (dvertex_t *)(mod_base + l->fileofs);
if (l->filelen % sizeof(*in))
Host_Error("Mod_Q1BSP_LoadVertexes: funny lump size in %s",loadmodel->name);
count = l->filelen / sizeof(*in);
- out = Mem_Alloc(loadmodel->mempool, count*sizeof(*out));
+ out = (mvertex_t *)Mem_Alloc(loadmodel->mempool, count*sizeof(*out));
loadmodel->brushq1.vertexes = out;
loadmodel->brushq1.numvertexes = count;
Host_Error ("Mod_Q1BSP_LoadSubmodels: funny lump size in %s", loadmodel->name);
count = l->filelen / (48+4*hullinfo->filehulls);
- out = Mem_Alloc (loadmodel->mempool, count*sizeof(*out));
+ out = (dmodel_t *)Mem_Alloc (loadmodel->mempool, count*sizeof(*out));
loadmodel->brushq1.submodels = out;
loadmodel->brush.numsubmodels = count;
medge_t *out;
int i, count;
- in = (void *)(mod_base + l->fileofs);
+ in = (dedge_t *)(mod_base + l->fileofs);
if (l->filelen % sizeof(*in))
Host_Error("Mod_Q1BSP_LoadEdges: funny lump size in %s",loadmodel->name);
count = l->filelen / sizeof(*in);
- out = Mem_Alloc(loadmodel->mempool, count * sizeof(*out));
+ out = (medge_t *)Mem_Alloc(loadmodel->mempool, count * sizeof(*out));
loadmodel->brushq1.edges = out;
loadmodel->brushq1.numedges = count;
mtexinfo_t *out;
int i, j, k, count, miptex;
- in = (void *)(mod_base + l->fileofs);
+ in = (texinfo_t *)(mod_base + l->fileofs);
if (l->filelen % sizeof(*in))
Host_Error("Mod_Q1BSP_LoadTexinfo: funny lump size in %s",loadmodel->name);
count = l->filelen / sizeof(*in);
- out = Mem_Alloc(loadmodel->mempool, count * sizeof(*out));
+ out = (mtexinfo_t *)Mem_Alloc(loadmodel->mempool, count * sizeof(*out));
loadmodel->brushq1.texinfo = out;
loadmodel->brushq1.numtexinfo = count;
int i, j, count, surfacenum, planenum, smax, tmax, ssize, tsize, firstedge, numedges, totalverts, totaltris;
float texmins[2], texmaxs[2], val;
- in = (void *)(mod_base + l->fileofs);
+ in = (dface_t *)(mod_base + l->fileofs);
if (l->filelen % sizeof(*in))
Host_Error("Mod_Q1BSP_LoadFaces: funny lump size in %s",loadmodel->name);
count = l->filelen / sizeof(*in);
- loadmodel->data_surfaces = Mem_Alloc(loadmodel->mempool, count*sizeof(msurface_t));
- loadmodel->data_surfaces_lightmapinfo = Mem_Alloc(loadmodel->mempool, count*sizeof(msurface_lightmapinfo_t));
+ loadmodel->data_surfaces = (msurface_t *)Mem_Alloc(loadmodel->mempool, count*sizeof(msurface_t));
+ loadmodel->data_surfaces_lightmapinfo = (msurface_lightmapinfo_t *)Mem_Alloc(loadmodel->mempool, count*sizeof(msurface_lightmapinfo_t));
loadmodel->num_surfaces = count;
totalverts = 0;
totaltris = 0;
- for (surfacenum = 0, in = (void *)(mod_base + l->fileofs);surfacenum < count;surfacenum++, in++)
+ for (surfacenum = 0, in = (dface_t *)(mod_base + l->fileofs);surfacenum < count;surfacenum++, in++)
{
numedges = LittleShort(in->numedges);
totalverts += numedges;
// TODO: split up into multiple meshes as needed to avoid exceeding 65536
// vertex limit
loadmodel->nummeshes = 1;
- loadmodel->meshlist = Mem_Alloc(loadmodel->mempool, sizeof(surfmesh_t *));
+ loadmodel->meshlist = (surfmesh_t **)Mem_Alloc(loadmodel->mempool, sizeof(surfmesh_t *));
loadmodel->meshlist[0] = Mod_AllocSurfMesh(loadmodel->mempool, totalverts, totaltris, true, false, false);
totalverts = 0;
totaltris = 0;
- for (surfacenum = 0, in = (void *)(mod_base + l->fileofs), surface = loadmodel->data_surfaces;surfacenum < count;surfacenum++, in++, surface++)
+ for (surfacenum = 0, in = (dface_t *)(mod_base + l->fileofs), surface = loadmodel->data_surfaces;surfacenum < count;surfacenum++, in++, surface++)
{
surface->lightmapinfo = loadmodel->data_surfaces_lightmapinfo + surfacenum;
// give non-lightmapped water a 1x white lightmap
if ((surface->texture->basematerialflags & MATERIALFLAG_WATER) && (surface->lightmapinfo->texinfo->flags & TEX_SPECIAL) && ssize <= 256 && tsize <= 256)
{
- surface->lightmapinfo->samples = Mem_Alloc(loadmodel->mempool, ssize * tsize * 3);
+ surface->lightmapinfo->samples = (qbyte *)Mem_Alloc(loadmodel->mempool, ssize * tsize * 3);
surface->lightmapinfo->styles[0] = 0;
memset(surface->lightmapinfo->samples, 128, ssize * tsize * 3);
}
if (ssize > 256 || tsize > 256)
Host_Error("Bad surface extents");
// stainmap for permanent marks on walls
- surface->lightmapinfo->stainsamples = Mem_Alloc(loadmodel->mempool, ssize * tsize * 3);
+ surface->lightmapinfo->stainsamples = (qbyte *)Mem_Alloc(loadmodel->mempool, ssize * tsize * 3);
// clear to white
memset(surface->lightmapinfo->stainsamples, 255, ssize * tsize * 3);
dnode_t *in;
mnode_t *out;
- in = (void *)(mod_base + l->fileofs);
+ in = (dnode_t *)(mod_base + l->fileofs);
if (l->filelen % sizeof(*in))
Host_Error("Mod_Q1BSP_LoadNodes: funny lump size in %s",loadmodel->name);
count = l->filelen / sizeof(*in);
- out = Mem_Alloc(loadmodel->mempool, count*sizeof(*out));
+ out = (mnode_t *)Mem_Alloc(loadmodel->mempool, count*sizeof(*out));
loadmodel->brush.data_nodes = out;
loadmodel->brush.num_nodes = count;
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))
Host_Error("Mod_Q1BSP_LoadLeafs: funny lump size in %s",loadmodel->name);
count = l->filelen / sizeof(*in);
- out = Mem_Alloc(loadmodel->mempool, count*sizeof(*out));
+ out = (mleaf_t *)Mem_Alloc(loadmodel->mempool, count*sizeof(*out));
loadmodel->brush.data_leafs = out;
loadmodel->brush.num_leafs = count;
// get visleafs from the submodel data
loadmodel->brush.num_pvsclusters = loadmodel->brushq1.submodels[0].visleafs;
loadmodel->brush.num_pvsclusterbytes = (loadmodel->brush.num_pvsclusters+7)>>3;
- loadmodel->brush.data_pvsclusters = Mem_Alloc(loadmodel->mempool, loadmodel->brush.num_pvsclusters * loadmodel->brush.num_pvsclusterbytes);
+ loadmodel->brush.data_pvsclusters = (unsigned char *)Mem_Alloc(loadmodel->mempool, loadmodel->brush.num_pvsclusters * loadmodel->brush.num_pvsclusterbytes);
memset(loadmodel->brush.data_pvsclusters, 0xFF, loadmodel->brush.num_pvsclusters * loadmodel->brush.num_pvsclusterbytes);
for ( i=0 ; i<count ; i++, in++, out++)
int i, count;
hull_t *hull;
- in = (void *)(mod_base + l->fileofs);
+ in = (dclipnode_t *)(mod_base + l->fileofs);
if (l->filelen % sizeof(*in))
Host_Error("Mod_Q1BSP_LoadClipnodes: funny lump size in %s",loadmodel->name);
count = l->filelen / sizeof(*in);
- out = Mem_Alloc(loadmodel->mempool, count*sizeof(*out));
+ out = (dclipnode_t *)Mem_Alloc(loadmodel->mempool, count*sizeof(*out));
loadmodel->brushq1.clipnodes = out;
loadmodel->brushq1.numclipnodes = count;
hull = &loadmodel->brushq1.hulls[0];
in = loadmodel->brush.data_nodes;
- out = Mem_Alloc(loadmodel->mempool, loadmodel->brush.num_nodes * sizeof(dclipnode_t));
+ out = (dclipnode_t *)Mem_Alloc(loadmodel->mempool, loadmodel->brush.num_nodes * sizeof(dclipnode_t));
hull->clipnodes = out;
hull->firstclipnode = 0;
int i, j;
short *in;
- in = (void *)(mod_base + l->fileofs);
+ in = (short *)(mod_base + l->fileofs);
if (l->filelen % sizeof(*in))
Host_Error("Mod_Q1BSP_LoadLeaffaces: funny lump size in %s",loadmodel->name);
loadmodel->brush.num_leafsurfaces = l->filelen / sizeof(*in);
- loadmodel->brush.data_leafsurfaces = Mem_Alloc(loadmodel->mempool, loadmodel->brush.num_leafsurfaces * sizeof(int));
+ loadmodel->brush.data_leafsurfaces = (int *)Mem_Alloc(loadmodel->mempool, loadmodel->brush.num_leafsurfaces * sizeof(int));
for (i = 0;i < loadmodel->brush.num_leafsurfaces;i++)
{
int i;
int *in;
- in = (void *)(mod_base + l->fileofs);
+ in = (int *)(mod_base + l->fileofs);
if (l->filelen % sizeof(*in))
Host_Error("Mod_Q1BSP_LoadSurfedges: funny lump size in %s",loadmodel->name);
loadmodel->brushq1.numsurfedges = l->filelen / sizeof(*in);
- loadmodel->brushq1.surfedges = Mem_Alloc(loadmodel->mempool, loadmodel->brushq1.numsurfedges * sizeof(int));
+ loadmodel->brushq1.surfedges = (int *)Mem_Alloc(loadmodel->mempool, loadmodel->brushq1.numsurfedges * sizeof(int));
for (i = 0;i < loadmodel->brushq1.numsurfedges;i++)
loadmodel->brushq1.surfedges[i] = LittleLong(in[i]);
mplane_t *out;
dplane_t *in;
- in = (void *)(mod_base + l->fileofs);
+ in = (dplane_t *)(mod_base + l->fileofs);
if (l->filelen % sizeof(*in))
Host_Error("Mod_Q1BSP_LoadPlanes: funny lump size in %s", loadmodel->name);
loadmodel->brush.num_planes = l->filelen / sizeof(*in);
- loadmodel->brush.data_planes = out = Mem_Alloc(loadmodel->mempool, loadmodel->brush.num_planes * sizeof(*out));
+ loadmodel->brush.data_planes = out = (mplane_t *)Mem_Alloc(loadmodel->mempool, loadmodel->brush.num_planes * sizeof(*out));
for (i = 0;i < loadmodel->brush.num_planes;i++, in++, out++)
{
static portal_t *AllocPortal(void)
{
portal_t *p;
- p = Mem_Alloc(loadmodel->mempool, sizeof(portal_t));
+ p = (portal_t *)Mem_Alloc(loadmodel->mempool, sizeof(portal_t));
p->chain = portalchain;
portalchain = p;
return p;
}
p = p->chain;
}
- loadmodel->brush.data_portals = Mem_Alloc(loadmodel->mempool, numportals * sizeof(mportal_t) + numpoints * sizeof(mvertex_t));
+ loadmodel->brush.data_portals = (mportal_t *)Mem_Alloc(loadmodel->mempool, numportals * sizeof(mportal_t) + numpoints * sizeof(mvertex_t));
loadmodel->brush.num_portals = numportals;
- loadmodel->brush.data_portalpoints = (void *)((qbyte *) loadmodel->brush.data_portals + numportals * sizeof(mportal_t));
+ loadmodel->brush.data_portalpoints = (mvertex_t *)((qbyte *) loadmodel->brush.data_portals + numportals * sizeof(mportal_t));
loadmodel->brush.num_portalpoints = numpoints;
// clear all leaf portal chains
for (i = 0;i < loadmodel->brush.num_leafs;i++)
portalpointer = (void **) &node->portals;
while (1)
{
- t = *portalpointer;
+ t = (portal_t *)*portalpointer;
if (!t)
Host_Error("RemovePortalFromNodes: portal not in leaf");
}
if (!totalcount)
return;
- model->brushq1.light_style = Mem_Alloc(mempool, model->brushq1.light_styles * sizeof(qbyte));
- model->brushq1.light_stylevalue = Mem_Alloc(mempool, model->brushq1.light_styles * sizeof(int));
- model->brushq1.light_styleupdatechains = Mem_Alloc(mempool, model->brushq1.light_styles * sizeof(msurface_t **));
- model->brushq1.light_styleupdatechainsbuffer = Mem_Alloc(mempool, totalcount * sizeof(msurface_t *));
+ model->brushq1.light_style = (qbyte *)Mem_Alloc(mempool, model->brushq1.light_styles * sizeof(qbyte));
+ model->brushq1.light_stylevalue = (int *)Mem_Alloc(mempool, model->brushq1.light_styles * sizeof(int));
+ model->brushq1.light_styleupdatechains = (msurface_t ***)Mem_Alloc(mempool, model->brushq1.light_styles * sizeof(msurface_t **));
+ model->brushq1.light_styleupdatechainsbuffer = (msurface_t **)Mem_Alloc(mempool, totalcount * sizeof(msurface_t *));
model->brushq1.light_styles = 0;
for (i = 0;i < 255;i++)
if (stylecounts[i])
Mod_BuildTriangleNeighbors(loadmodel->brush.shadowmesh->neighbor3i, loadmodel->brush.shadowmesh->element3i, loadmodel->brush.shadowmesh->numtriangles);
if (loadmodel->brush.numsubmodels)
- loadmodel->brush.submodels = Mem_Alloc(loadmodel->mempool, loadmodel->brush.numsubmodels * sizeof(model_t *));
+ loadmodel->brush.submodels = (model_t **)Mem_Alloc(loadmodel->mempool, loadmodel->brush.numsubmodels * sizeof(model_t *));
if (loadmodel->isworldmodel)
{
mod->nummodelsurfaces = bm->numfaces;
// make the model surface list (used by shadowing/lighting)
- mod->surfacelist = Mem_Alloc(loadmodel->mempool, mod->nummodelsurfaces * sizeof(*mod->surfacelist));
+ mod->surfacelist = (int *)Mem_Alloc(loadmodel->mempool, mod->nummodelsurfaces * sizeof(*mod->surfacelist));
for (j = 0;j < mod->nummodelsurfaces;j++)
mod->surfacelist[j] = mod->firstmodelsurface + j;
loadmodel->brushq3.num_lightgrid_cellsize[2] = 128;
if (!l->filelen)
return;
- loadmodel->brush.entities = Mem_Alloc(loadmodel->mempool, l->filelen);
+ loadmodel->brush.entities = (char *)Mem_Alloc(loadmodel->mempool, l->filelen);
memcpy(loadmodel->brush.entities, mod_base + l->fileofs, l->filelen);
data = loadmodel->brush.entities;
// some Q3 maps override the lightgrid_cellsize with a worldspawn key
char firstpasstexturename[Q3PATHLENGTH];
char parameter[4][Q3PATHLENGTH];
- in = (void *)(mod_base + l->fileofs);
+ in = (q3dtexture_t *)(mod_base + l->fileofs);
if (l->filelen % sizeof(*in))
Host_Error("Mod_Q3BSP_LoadTextures: funny lump size in %s",loadmodel->name);
count = l->filelen / sizeof(*in);
- out = Mem_Alloc(loadmodel->mempool, count * sizeof(*out));
+ out = (texture_t *)Mem_Alloc(loadmodel->mempool, count * sizeof(*out));
loadmodel->data_textures = out;
loadmodel->num_textures = count;
mplane_t *out;
int i, count;
- in = (void *)(mod_base + l->fileofs);
+ in = (q3dplane_t *)(mod_base + l->fileofs);
if (l->filelen % sizeof(*in))
Host_Error("Mod_Q3BSP_LoadPlanes: funny lump size in %s",loadmodel->name);
count = l->filelen / sizeof(*in);
- out = Mem_Alloc(loadmodel->mempool, count * sizeof(*out));
+ out = (mplane_t *)Mem_Alloc(loadmodel->mempool, count * sizeof(*out));
loadmodel->brush.data_planes = out;
loadmodel->brush.num_planes = count;
q3mbrushside_t *out;
int i, n, count;
- in = (void *)(mod_base + l->fileofs);
+ in = (q3dbrushside_t *)(mod_base + l->fileofs);
if (l->filelen % sizeof(*in))
Host_Error("Mod_Q3BSP_LoadBrushSides: funny lump size in %s",loadmodel->name);
count = l->filelen / sizeof(*in);
- out = Mem_Alloc(loadmodel->mempool, count * sizeof(*out));
+ out = (q3mbrushside_t *)Mem_Alloc(loadmodel->mempool, count * sizeof(*out));
loadmodel->brush.data_brushsides = out;
loadmodel->brush.num_brushsides = count;
int i, j, n, c, count, maxplanes;
mplane_t *planes;
- in = (void *)(mod_base + l->fileofs);
+ in = (q3dbrush_t *)(mod_base + l->fileofs);
if (l->filelen % sizeof(*in))
Host_Error("Mod_Q3BSP_LoadBrushes: funny lump size in %s",loadmodel->name);
count = l->filelen / sizeof(*in);
- out = Mem_Alloc(loadmodel->mempool, count * sizeof(*out));
+ out = (q3mbrush_t *)Mem_Alloc(loadmodel->mempool, count * sizeof(*out));
loadmodel->brush.data_brushes = out;
loadmodel->brush.num_brushes = count;
maxplanes = out->numbrushsides;
if (planes)
Mem_Free(planes);
- planes = Mem_Alloc(tempmempool, sizeof(mplane_t) * maxplanes);
+ planes = (mplane_t *)Mem_Alloc(tempmempool, sizeof(mplane_t) * maxplanes);
}
for (j = 0;j < out->numbrushsides;j++)
{
q3deffect_t *out;
int i, n, count;
- in = (void *)(mod_base + l->fileofs);
+ in = (q3deffect_t *)(mod_base + l->fileofs);
if (l->filelen % sizeof(*in))
Host_Error("Mod_Q3BSP_LoadEffects: funny lump size in %s",loadmodel->name);
count = l->filelen / sizeof(*in);
- out = Mem_Alloc(loadmodel->mempool, count * sizeof(*out));
+ out = (q3deffect_t *)Mem_Alloc(loadmodel->mempool, count * sizeof(*out));
loadmodel->brushq3.data_effects = out;
loadmodel->brushq3.num_effects = count;
q3dvertex_t *in;
int i, count;
- in = (void *)(mod_base + l->fileofs);
+ in = (q3dvertex_t *)(mod_base + l->fileofs);
if (l->filelen % sizeof(*in))
Host_Error("Mod_Q3BSP_LoadVertices: funny lump size in %s",loadmodel->name);
loadmodel->brushq3.num_vertices = count = l->filelen / sizeof(*in);
- loadmodel->brushq3.data_vertex3f = Mem_Alloc(loadmodel->mempool, count * (sizeof(float) * (3 + 2 + 2 + 4)));
+ loadmodel->brushq3.data_vertex3f = (float *)Mem_Alloc(loadmodel->mempool, count * (sizeof(float) * (3 + 2 + 2 + 4)));
loadmodel->brushq3.data_texcoordtexture2f = loadmodel->brushq3.data_vertex3f + count * 3;
loadmodel->brushq3.data_texcoordlightmap2f = loadmodel->brushq3.data_texcoordtexture2f + count * 2;
loadmodel->brushq3.data_color4f = loadmodel->brushq3.data_texcoordlightmap2f + count * 2;
int *out;
int i, count;
- in = (void *)(mod_base + l->fileofs);
+ in = (int *)(mod_base + l->fileofs);
if (l->filelen % sizeof(int[3]))
Host_Error("Mod_Q3BSP_LoadTriangles: funny lump size in %s",loadmodel->name);
count = l->filelen / sizeof(*in);
- out = Mem_Alloc(loadmodel->mempool, count * sizeof(*out));
+ out = (int *)Mem_Alloc(loadmodel->mempool, count * sizeof(*out));
loadmodel->brushq3.num_triangles = count / 3;
loadmodel->brushq3.data_element3i = out;
if (!l->filelen)
return;
- in = (void *)(mod_base + l->fileofs);
+ in = (q3dlightmap_t *)(mod_base + l->fileofs);
if (l->filelen % sizeof(*in))
Host_Error("Mod_Q3BSP_LoadLightmaps: funny lump size in %s",loadmodel->name);
count = l->filelen / sizeof(*in);
- out = Mem_Alloc(loadmodel->mempool, count * sizeof(*out));
+ out = (rtexture_t **)Mem_Alloc(loadmodel->mempool, count * sizeof(*out));
loadmodel->brushq3.data_lightmaps = out;
loadmodel->brushq3.num_lightmaps = count;
float *v;
surfmesh_t *mesh, *tempmeshlist[1024];
- in = (void *)(mod_base + l->fileofs);
+ in = (q3dface_t *)(mod_base + l->fileofs);
if (l->filelen % sizeof(*in))
Host_Error("Mod_Q3BSP_LoadFaces: funny lump size in %s",loadmodel->name);
count = l->filelen / sizeof(*in);
- out = Mem_Alloc(loadmodel->mempool, count * sizeof(*out));
+ out = (msurface_t *)Mem_Alloc(loadmodel->mempool, count * sizeof(*out));
loadmodel->data_surfaces = out;
loadmodel->num_surfaces = count;
finalvertices = finalwidth * finalheight;
finaltriangles = (finalwidth - 1) * (finalheight - 1) * 2;
- out->data_collisionvertex3f = Mem_Alloc(loadmodel->mempool, sizeof(float[3]) * finalvertices);
- out->data_collisionelement3i = Mem_Alloc(loadmodel->mempool, sizeof(int[3]) * finaltriangles);
+ out->data_collisionvertex3f = (float *)Mem_Alloc(loadmodel->mempool, sizeof(float[3]) * finalvertices);
+ out->data_collisionelement3i = (int *)Mem_Alloc(loadmodel->mempool, sizeof(int[3]) * finaltriangles);
out->num_collisionvertices = finalvertices;
out->num_collisiontriangles = finaltriangles;
Q3PatchTesselateFloat(3, sizeof(float[3]), out->data_collisionvertex3f, patchsize[0], patchsize[1], sizeof(float[3]), originalvertex3f, xtess, ytess);
loadmodel->nummeshes = meshnum;
if (loadmodel->nummeshes)
{
- loadmodel->meshlist = Mem_Alloc(loadmodel->mempool, sizeof(surfmesh_t *) * loadmodel->nummeshes);
+ loadmodel->meshlist = (surfmesh_t **)Mem_Alloc(loadmodel->mempool, sizeof(surfmesh_t *) * loadmodel->nummeshes);
memcpy(loadmodel->meshlist, tempmeshlist, sizeof(surfmesh_t *) * loadmodel->nummeshes);
}
q3dmodel_t *out;
int i, j, n, c, count;
- in = (void *)(mod_base + l->fileofs);
+ in = (q3dmodel_t *)(mod_base + l->fileofs);
if (l->filelen % sizeof(*in))
Host_Error("Mod_Q3BSP_LoadModels: funny lump size in %s",loadmodel->name);
count = l->filelen / sizeof(*in);
- out = Mem_Alloc(loadmodel->mempool, count * sizeof(*out));
+ out = (q3dmodel_t *)Mem_Alloc(loadmodel->mempool, count * sizeof(*out));
loadmodel->brushq3.data_models = out;
loadmodel->brushq3.num_models = count;
int *out;
int i, n, count;
- in = (void *)(mod_base + l->fileofs);
+ in = (int *)(mod_base + l->fileofs);
if (l->filelen % sizeof(*in))
Host_Error("Mod_Q3BSP_LoadLeafBrushes: funny lump size in %s",loadmodel->name);
count = l->filelen / sizeof(*in);
- out = Mem_Alloc(loadmodel->mempool, count * sizeof(*out));
+ out = (int *)Mem_Alloc(loadmodel->mempool, count * sizeof(*out));
loadmodel->brush.data_leafbrushes = out;
loadmodel->brush.num_leafbrushes = count;
int *out;
int i, n, count;
- in = (void *)(mod_base + l->fileofs);
+ in = (int *)(mod_base + l->fileofs);
if (l->filelen % sizeof(*in))
Host_Error("Mod_Q3BSP_LoadLeafFaces: funny lump size in %s",loadmodel->name);
count = l->filelen / sizeof(*in);
- out = Mem_Alloc(loadmodel->mempool, count * sizeof(*out));
+ out = (int *)Mem_Alloc(loadmodel->mempool, count * sizeof(*out));
loadmodel->brush.data_leafsurfaces = out;
loadmodel->brush.num_leafsurfaces = count;
mleaf_t *out;
int i, j, n, c, count;
- in = (void *)(mod_base + l->fileofs);
+ in = (q3dleaf_t *)(mod_base + l->fileofs);
if (l->filelen % sizeof(*in))
Host_Error("Mod_Q3BSP_LoadLeafs: funny lump size in %s",loadmodel->name);
count = l->filelen / sizeof(*in);
- out = Mem_Alloc(loadmodel->mempool, count * sizeof(*out));
+ out = (mleaf_t *)Mem_Alloc(loadmodel->mempool, count * sizeof(*out));
loadmodel->brush.data_leafs = out;
loadmodel->brush.num_leafs = count;
mnode_t *out;
int i, j, n, count;
- in = (void *)(mod_base + l->fileofs);
+ in = (q3dnode_t *)(mod_base + l->fileofs);
if (l->filelen % sizeof(*in))
Host_Error("Mod_Q3BSP_LoadNodes: funny lump size in %s",loadmodel->name);
count = l->filelen / sizeof(*in);
- out = Mem_Alloc(loadmodel->mempool, count * sizeof(*out));
+ out = (mnode_t *)Mem_Alloc(loadmodel->mempool, count * sizeof(*out));
loadmodel->brush.data_nodes = out;
loadmodel->brush.num_nodes = count;
q3dlightgrid_t *out;
int count;
- in = (void *)(mod_base + l->fileofs);
+ in = (q3dlightgrid_t *)(mod_base + l->fileofs);
if (l->filelen % sizeof(*in))
Host_Error("Mod_Q3BSP_LoadLightGrid: funny lump size in %s",loadmodel->name);
loadmodel->brushq3.num_lightgrid_scale[0] = 1.0f / loadmodel->brushq3.num_lightgrid_cellsize[0];
Host_Error("Mod_Q3BSP_LoadLightGrid: invalid lightgrid lump size %i bytes, should be %i bytes (%ix%ix%i)\n", l->filelen, count * sizeof(*in), loadmodel->brushq3.num_lightgrid_dimensions[0], loadmodel->brushq3.num_lightgrid_dimensions[1], loadmodel->brushq3.num_lightgrid_dimensions[2]);
if (l->filelen != count * (int)sizeof(*in))
Con_Printf("Mod_Q3BSP_LoadLightGrid: Warning: calculated lightgrid size %i bytes does not match lump size %i\n", count * sizeof(*in), l->filelen);
- out = Mem_Alloc(loadmodel->mempool, count * sizeof(*out));
+ out = (q3dlightgrid_t *)Mem_Alloc(loadmodel->mempool, count * sizeof(*out));
loadmodel->brushq3.data_lightgrid = out;
loadmodel->brushq3.num_lightgrid = count;
// no swapping or validation necessary
// create clusters
loadmodel->brush.num_pvsclusterbytes = (loadmodel->brush.num_pvsclusters + 7) / 8;
totalchains = loadmodel->brush.num_pvsclusterbytes * loadmodel->brush.num_pvsclusters;
- loadmodel->brush.data_pvsclusters = Mem_Alloc(loadmodel->mempool, totalchains);
+ loadmodel->brush.data_pvsclusters = (unsigned char *)Mem_Alloc(loadmodel->mempool, totalchains);
memset(loadmodel->brush.data_pvsclusters, 0xFF, totalchains);
return;
}
- in = (void *)(mod_base + l->fileofs);
+ in = (q3dpvs_t *)(mod_base + l->fileofs);
if (l->filelen < 9)
Host_Error("Mod_Q3BSP_LoadPVS: funny lump size in %s",loadmodel->name);
if (l->filelen < totalchains + (int)sizeof(*in))
Host_Error("Mod_Q3BSP_LoadPVS: lump too small ((numclusters = %i) * (chainlength = %i) + sizeof(q3dpvs_t) == %i bytes, lump is %i bytes)\n", loadmodel->brush.num_pvsclusters, loadmodel->brush.num_pvsclusterbytes, totalchains + sizeof(*in), l->filelen);
- loadmodel->brush.data_pvsclusters = Mem_Alloc(loadmodel->mempool, totalchains);
+ loadmodel->brush.data_pvsclusters = (unsigned char *)Mem_Alloc(loadmodel->mempool, totalchains);
memcpy(loadmodel->brush.data_pvsclusters, (qbyte *)(in + 1), totalchains);
}
mod->nummodelsurfaces = mod->brushq3.data_models[i].numfaces;
mod->firstmodelbrush = mod->brushq3.data_models[i].firstbrush;
mod->nummodelbrushes = mod->brushq3.data_models[i].numbrushes;
- mod->surfacelist = Mem_Alloc(loadmodel->mempool, mod->nummodelsurfaces * sizeof(*mod->surfacelist));
+ mod->surfacelist = (int *)Mem_Alloc(loadmodel->mempool, mod->nummodelsurfaces * sizeof(*mod->surfacelist));
for (j = 0;j < mod->nummodelsurfaces;j++)
mod->surfacelist[j] = mod->firstmodelsurface + j;
buf = FS_LoadFile (mod->name, tempmempool, false);
if (buf)
{
- crc = CRC_Block(buf, fs_filesize);
+ crc = CRC_Block((qbyte *)buf, fs_filesize);
if (mod->crc != crc)
mod->loaded = false;
}
else if (!memcmp(buf, "IBSP", 4)) Mod_IBSP_Load(mod, buf, bufend);
else if (!memcmp(buf, "ZYMOTICMODEL", 12)) Mod_ZYMOTICMODEL_Load(mod, buf, bufend);
else if (!memcmp(buf, "DARKPLACESMODEL", 16)) Mod_DARKPLACESMODEL_Load(mod, buf, bufend);
- else if (!strcmp(buf, "ACTRHEAD")) Mod_PSKMODEL_Load(mod, buf, bufend);
+ else if (!memcmp(buf, "ACTRHEAD", 8)) Mod_PSKMODEL_Load(mod, buf, bufend);
else if (strlen(mod->name) >= 4 && !strcmp(mod->name - 4, ".map")) Mod_MAP_Load(mod, buf, bufend);
else if (!memcmp(buf, "MCBSPpad", 8)) Mod_Q1BSP_Load(mod, buf, bufend);
else if (num == BSPVERSION || num == 30) Mod_Q1BSP_Load(mod, buf, bufend);
{
int i, count;
qbyte *used;
- used = Mem_Alloc(tempmempool, numvertices);
+ used = (qbyte *)Mem_Alloc(tempmempool, numvertices);
memset(used, 0, numvertices);
for (i = 0;i < numelements;i++)
used[elements[i]] = 1;
edgehashentries = edgehashentriesbuffer;
// if there are too many triangles for the stack array, allocate larger buffer
if (numtriangles > TRIANGLEEDGEHASH)
- edgehashentries = Mem_Alloc(tempmempool, numtriangles * 3 * sizeof(edgehashentry_t));
+ edgehashentries = (edgehashentry_t *)Mem_Alloc(tempmempool, numtriangles * 3 * sizeof(edgehashentry_t));
// find neighboring triangles
for (i = 0, e = elements, n = neighbors;i < numtriangles;i++, e += 3, n += 3)
{
{
surfmesh_t *mesh;
qbyte *data;
- mesh = Mem_Alloc(mempool, sizeof(surfmesh_t) + numvertices * (3 + 3 + 3 + 3 + 2 + 2 + (vertexcolors ? 4 : 0)) * sizeof(float) + numvertices * (lightmapoffsets ? 1 : 0) * sizeof(int) + numtriangles * (3 + (neighbors ? 3 : 0)) * sizeof(int));
+ mesh = (surfmesh_t *)Mem_Alloc(mempool, sizeof(surfmesh_t) + numvertices * (3 + 3 + 3 + 3 + 2 + 2 + (vertexcolors ? 4 : 0)) * sizeof(float) + numvertices * (lightmapoffsets ? 1 : 0) * sizeof(int) + numtriangles * (3 + (neighbors ? 3 : 0)) * sizeof(int));
mesh->num_vertices = numvertices;
mesh->num_triangles = numtriangles;
data = (qbyte *)(mesh + 1);
size += maxtriangles * sizeof(int[3]);
if (expandable)
size += SHADOWMESHVERTEXHASH * sizeof(shadowmeshvertexhash_t *) + maxverts * sizeof(shadowmeshvertexhash_t);
- data = Mem_Alloc(mempool, size);
- newmesh = (void *)data;data += sizeof(*newmesh);
+ data = (qbyte *)Mem_Alloc(mempool, size);
+ newmesh = (shadowmesh_t *)data;data += sizeof(*newmesh);
newmesh->map_diffuse = map_diffuse;
newmesh->map_specular = map_specular;
newmesh->map_normal = map_normal;
newmesh->numverts = 0;
newmesh->numtriangles = 0;
- newmesh->vertex3f = (void *)data;data += maxverts * sizeof(float[3]);
+ newmesh->vertex3f = (float *)data;data += maxverts * sizeof(float[3]);
if (light)
{
- newmesh->svector3f = (void *)data;data += maxverts * sizeof(float[3]);
- newmesh->tvector3f = (void *)data;data += maxverts * sizeof(float[3]);
- newmesh->normal3f = (void *)data;data += maxverts * sizeof(float[3]);
- newmesh->texcoord2f = (void *)data;data += maxverts * sizeof(float[2]);
+ newmesh->svector3f = (float *)data;data += maxverts * sizeof(float[3]);
+ newmesh->tvector3f = (float *)data;data += maxverts * sizeof(float[3]);
+ newmesh->normal3f = (float *)data;data += maxverts * sizeof(float[3]);
+ newmesh->texcoord2f = (float *)data;data += maxverts * sizeof(float[2]);
}
- newmesh->element3i = (void *)data;data += maxtriangles * sizeof(int[3]);
+ newmesh->element3i = (int *)data;data += maxtriangles * sizeof(int[3]);
if (neighbors)
{
- newmesh->neighbor3i = (void *)data;data += maxtriangles * sizeof(int[3]);
+ newmesh->neighbor3i = (int *)data;data += maxtriangles * sizeof(int[3]);
}
if (expandable)
{
- newmesh->vertexhashtable = (void *)data;data += SHADOWMESHVERTEXHASH * sizeof(shadowmeshvertexhash_t *);
- newmesh->vertexhashentries = (void *)data;data += maxverts * sizeof(shadowmeshvertexhash_t);
+ newmesh->vertexhashtable = (shadowmeshvertexhash_t **)data;data += SHADOWMESHVERTEXHASH * sizeof(shadowmeshvertexhash_t *);
+ newmesh->vertexhashentries = (shadowmeshvertexhash_t *)data;data += maxverts * sizeof(shadowmeshvertexhash_t);
}
return newmesh;
}
return false;
if (r_shadow_bumpscale_basetexture.value > 0)
{
- temp1 = Mem_Alloc(loadmodel->mempool, width * height * 8);
+ temp1 = (qbyte *)Mem_Alloc(loadmodel->mempool, width * height * 8);
temp2 = temp1 + width * height * 4;
Image_Copy8bitRGBA(skindata, temp1, width * height, palette_nofullbrights);
Image_HeightmapToNormalmap(temp1, temp2, width, height, false, r_shadow_bumpscale_basetexture.value);
// If it's the first file we parse
if (skinfile == NULL)
{
- skinfile = Mem_Alloc(tempmempool, sizeof(skinfile_t));
+ skinfile = (skinfile_t *)Mem_Alloc(tempmempool, sizeof(skinfile_t));
first = skinfile;
}
else
{
- skinfile->next = Mem_Alloc(tempmempool, sizeof(skinfile_t));
+ skinfile->next = (skinfile_t *)Mem_Alloc(tempmempool, sizeof(skinfile_t));
skinfile = skinfile->next;
}
skinfile->next = NULL;
if (words == 3)
{
Con_DPrintf("Mod_LoadSkinFiles: parsed mesh \"%s\" shader replacement \"%s\"\n", word[1], word[2]);
- skinfileitem = Mem_Alloc(tempmempool, sizeof(skinfileitem_t));
+ skinfileitem = (skinfileitem_t *)Mem_Alloc(tempmempool, sizeof(skinfileitem_t));
skinfileitem->next = skinfile->items;
skinfile->items = skinfileitem;
strlcpy (skinfileitem->name, word[1], sizeof (skinfileitem->name));
{
// mesh shader name, like "U_RArm,models/players/Legoman/BikerA1.tga"
Con_DPrintf("Mod_LoadSkinFiles: parsed mesh \"%s\" shader replacement \"%s\"\n", word[0], word[2]);
- skinfileitem = Mem_Alloc(tempmempool, sizeof(skinfileitem_t));
+ skinfileitem = (skinfileitem_t *)Mem_Alloc(tempmempool, sizeof(skinfileitem_t));
skinfileitem->next = skinfile->items;
skinfile->items = skinfileitem;
strlcpy (skinfileitem->name, word[0], sizeof (skinfileitem->name));
overridetagnameset_t *t;
t = tagsets + i;
t->num_overridetagnames = numtags;
- t->data_overridetagnames = Mem_Alloc(loadmodel->mempool, t->num_overridetagnames * sizeof(overridetagname_t));
+ t->data_overridetagnames = (overridetagname_t *)Mem_Alloc(loadmodel->mempool, t->num_overridetagnames * sizeof(overridetagname_t));
memcpy(t->data_overridetagnames, tags, t->num_overridetagnames * sizeof(overridetagname_t));
tagsetsused = true;
}
}
if (tagsetsused)
{
- loadmodel->data_overridetagnamesforskin = Mem_Alloc(loadmodel->mempool, i * sizeof(overridetagnameset_t));
+ loadmodel->data_overridetagnamesforskin = (overridetagnameset_t *)Mem_Alloc(loadmodel->mempool, i * sizeof(overridetagnameset_t));
memcpy(loadmodel->data_overridetagnamesforskin, tagsets, i * sizeof(overridetagnameset_t));
}
if (i)
realframes += groupframes;
}
- loadmodel->animscenes = Mem_Alloc(loadmodel->mempool, sizeof(animscene_t) * loadmodel->numframes);
- loadmodel->sprite.sprdata_frames = Mem_Alloc(loadmodel->mempool, sizeof(mspriteframe_t) * realframes);
+ loadmodel->animscenes = (animscene_t *)Mem_Alloc(loadmodel->mempool, sizeof(animscene_t) * loadmodel->numframes);
+ loadmodel->sprite.sprdata_frames = (mspriteframe_t *)Mem_Alloc(loadmodel->mempool, sizeof(mspriteframe_t) * realframes);
- datapointer = startframes;
+ datapointer = (qbyte *)startframes;
realframes = 0;
for (i = 0;i < loadmodel->numframes;i++)
{
{
loadmodel->sprite.sprdata_frames[realframes].texture = R_LoadTexture2D(loadmodel->texturepool, name, width, height, datapointer, TEXTYPE_RGBA, TEXF_ALPHA | (r_mipsprites.integer ? TEXF_MIPMAP : 0) | TEXF_CLAMP | TEXF_PRECACHE | TEXF_PICMIP, NULL);
// make fog version (just alpha)
- pixbuf = Mem_Alloc(tempmempool, width*height*4);
+ pixbuf = (qbyte *)Mem_Alloc(tempmempool, width*height*4);
Image_CopyMux(pixbuf, datapointer, width, height, false, false, false, 4, 4, alphaonlytable);
loadmodel->sprite.sprdata_frames[realframes].fogtexture = R_LoadTexture2D(loadmodel->texturepool, fogname, width, height, pixbuf, TEXTYPE_RGBA, TEXF_ALPHA | (r_mipsprites.integer ? TEXF_MIPMAP : 0) | TEXF_CLAMP | TEXF_PRECACHE | TEXF_PICMIP, NULL);
Mem_Free(pixbuf);
int version;
const qbyte *datapointer;
- datapointer = buffer;
+ datapointer = (qbyte *)buffer;
loadmodel->type = mod_sprite;
loadmodel->flags2 = EF_FULLBRIGHT;
}
}
- loadmodel->animscenes = Mem_Alloc(loadmodel->mempool, sizeof(animscene_t) * loadmodel->numframes);
- loadmodel->sprite.sprdata_frames = Mem_Alloc(loadmodel->mempool, sizeof(mspriteframe_t) * loadmodel->numframes);
+ loadmodel->animscenes = (animscene_t *)Mem_Alloc(loadmodel->mempool, sizeof(animscene_t) * loadmodel->numframes);
+ loadmodel->sprite.sprdata_frames = (mspriteframe_t *)Mem_Alloc(loadmodel->mempool, sizeof(mspriteframe_t) * loadmodel->numframes);
modelradius = 0;
for (i = 0;i < loadmodel->numframes;i++)
if( !file ) {
return;
}
-
+
ent = PRVM_G_EDICT(OFS_PARM1);
if(ent->priv.required->free)
{
}
mask->active = true;
- mask->tests[field] = (int) PRVM_G_FLOAT( OFS_PARM3 );
+ mask->tests[field] = (serverlist_maskop_t) PRVM_G_FLOAT( OFS_PARM3 );
}
/*
}
mask->active = true;
- mask->tests[field] = (int) PRVM_G_FLOAT( OFS_PARM3 );
+ mask->tests[field] = (serverlist_maskop_t) PRVM_G_FLOAT( OFS_PARM3 );
}
{
VM_SAFEPARMCOUNT( 2, VM_M_setserverlistsort );
- serverlist_sortbyfield = (int) PRVM_G_FLOAT( OFS_PARM0 );
+ serverlist_sortbyfield = (serverlist_infofield_t) PRVM_G_FLOAT( OFS_PARM0 );
serverlist_sortdescending = (qboolean) PRVM_G_FLOAT( OFS_PARM1 );
}
{
LHNETADDRESS_ToString(peeraddress, addressstring2, sizeof(addressstring2), true);
Con_Printf("LHNET_Read(%p (%s), %p, %i, %p) = %i from %s:\n", mysocket, addressstring, data, maxlength, peeraddress, length, addressstring2);
- Com_HexDumpToConsole(data, length);
+ Com_HexDumpToConsole((qbyte *)data, length);
}
else
Con_Printf("LHNET_Read(%p (%s), %p, %i, %p) = %i\n", mysocket, addressstring, data, maxlength, peeraddress, length);
LHNETADDRESS_ToString(LHNET_AddressFromSocket(mysocket), addressstring, sizeof(addressstring), true);
LHNETADDRESS_ToString(peeraddress, addressstring2, sizeof(addressstring2), true);
Con_Printf("LHNET_Write(%p (%s), %p, %i, %p (%s)) = %i%s\n", mysocket, addressstring, data, length, peeraddress, addressstring2, length, ret == length ? "" : " (ERROR)");
- Com_HexDumpToConsole(data, length);
+ Com_HexDumpToConsole((qbyte *)data, length);
}
return ret;
}
packetLen = NET_HEADERSIZE + dataLen;
- header = (void *)sendbuffer;
+ header = (unsigned int *)sendbuffer;
header[0] = BigLong(packetLen | (NETFLAG_DATA | eom));
header[1] = BigLong(conn->sendSequence);
memcpy(sendbuffer + NET_HEADERSIZE, conn->sendMessage, dataLen);
packetLen = NET_HEADERSIZE + dataLen;
- header = (void *)sendbuffer;
+ header = (unsigned int *)sendbuffer;
header[0] = BigLong(packetLen | (NETFLAG_DATA | eom));
header[1] = BigLong(conn->sendSequence);
memcpy(sendbuffer + NET_HEADERSIZE, conn->sendMessage, dataLen);
packetLen = NET_HEADERSIZE + dataLen;
- header = (void *)sendbuffer;
+ header = (unsigned int *)sendbuffer;
header[0] = BigLong(packetLen | (NETFLAG_DATA | eom));
header[1] = BigLong(conn->sendSequence - 1);
memcpy(sendbuffer + NET_HEADERSIZE, conn->sendMessage, dataLen);
int NetConn_SendUnreliableMessage(netconn_t *conn, sizebuf_t *data)
{
int packetLen;
- int *header;
+ unsigned int *header;
packetLen = NET_HEADERSIZE + data->cursize;
}
//#endif
- header = (void *)sendbuffer;
+ header = (unsigned int *)sendbuffer;
header[0] = BigLong(packetLen | NETFLAG_UNRELIABLE);
header[1] = BigLong(conn->unreliableSendSequence);
memcpy(sendbuffer + NET_HEADERSIZE, data->data, data->cursize);
netconn_t *NetConn_Open(lhnetsocket_t *mysocket, lhnetaddress_t *peeraddress)
{
netconn_t *conn;
- conn = Mem_Alloc(netconn_mempool, sizeof(*conn));
+ conn = (netconn_t *)Mem_Alloc(netconn_mempool, sizeof(*conn));
conn->mysocket = mysocket;
conn->peeraddress = *peeraddress;
conn->canSend = true;
int i;
for (i = 1;protocolversioninfo[i].name;i++)
if (!strcasecmp(s, protocolversioninfo[i].name))
- return i;
+ return (protocolversion_t)i;
return PROTOCOL_UNKNOWN;
}
int i;
for (i = 1;protocolversioninfo[i].name;i++)
if (protocolversioninfo[i].number == n)
- return i;
+ return (protocolversion_t)i;
return PROTOCOL_UNKNOWN;
}
// (client and server) allocates a new empty database
entityframe_database_t *EntityFrame_AllocDatabase(mempool_t *mempool)
{
- return Mem_Alloc(mempool, sizeof(entityframe_database_t));
+ return (entityframe_database_t *)Mem_Alloc(mempool, sizeof(entityframe_database_t));
}
// (client and server) frees the database
int oldmax = d->maxreferenceentities;
entity_state_t *oldentity = d->referenceentity;
d->maxreferenceentities = (number + 15) & ~7;
- d->referenceentity = Mem_Alloc(d->mempool, d->maxreferenceentities * sizeof(*d->referenceentity));
+ d->referenceentity = (entity_state_t *)Mem_Alloc(d->mempool, d->maxreferenceentities * sizeof(*d->referenceentity));
if (oldentity)
{
memcpy(d->referenceentity, oldentity, oldmax * sizeof(*d->referenceentity));
{
entity_state_t *oldentity = d->currentcommit->entity;
d->currentcommit->maxentities += 8;
- d->currentcommit->entity = Mem_Alloc(d->mempool, d->currentcommit->maxentities * sizeof(*d->currentcommit->entity));
+ d->currentcommit->entity = (entity_state_t *)Mem_Alloc(d->mempool, d->currentcommit->maxentities * sizeof(*d->currentcommit->entity));
if (oldentity)
{
memcpy(d->currentcommit->entity, oldentity, d->currentcommit->numentities * sizeof(*d->currentcommit->entity));
entityframe4_database_t *EntityFrame4_AllocDatabase(mempool_t *pool)
{
entityframe4_database_t *d;
- d = Mem_Alloc(pool, sizeof(*d));
+ d = (entityframe4_database_t *)Mem_Alloc(pool, sizeof(*d));
d->mempool = pool;
EntityFrame4_ResetDatabase(d);
return d;
entityframe5_database_t *EntityFrame5_AllocDatabase(mempool_t *pool)
{
entityframe5_database_t *d;
- d = Mem_Alloc(pool, sizeof(*d));
+ d = (entityframe5_database_t *)Mem_Alloc(pool, sizeof(*d));
EntityFrame5_ResetDatabase(d);
return d;
}
entity_state_t *oldstates = d->states;
qbyte *oldvisiblebits = d->visiblebits;
d->maxedicts = newmax;
- data = Mem_Alloc(sv_mempool, d->maxedicts * sizeof(int) + d->maxedicts * sizeof(qbyte) + d->maxedicts * sizeof(int) + d->maxedicts * sizeof(entity_state_t) + (d->maxedicts+7)/8 * sizeof(qbyte));
- d->deltabits = (void *)data;data += d->maxedicts * sizeof(int);
- d->priorities = (void *)data;data += d->maxedicts * sizeof(qbyte);
- d->updateframenum = (void *)data;data += d->maxedicts * sizeof(int);
- d->states = (void *)data;data += d->maxedicts * sizeof(entity_state_t);
- d->visiblebits = (void *)data;data += (d->maxedicts+7)/8 * sizeof(qbyte);
+ data = (qbyte *)Mem_Alloc(sv_mempool, d->maxedicts * sizeof(int) + d->maxedicts * sizeof(qbyte) + d->maxedicts * sizeof(int) + d->maxedicts * sizeof(entity_state_t) + (d->maxedicts+7)/8 * sizeof(qbyte));
+ d->deltabits = (int *)data;data += d->maxedicts * sizeof(int);
+ d->priorities = (qbyte *)data;data += d->maxedicts * sizeof(qbyte);
+ d->updateframenum = (int *)data;data += d->maxedicts * sizeof(int);
+ d->states = (entity_state_t *)data;data += d->maxedicts * sizeof(entity_state_t);
+ d->visiblebits = (qbyte *)data;data += (d->maxedicts+7)/8 * sizeof(qbyte);
if (oldmaxedicts)
{
memcpy(d->deltabits, olddeltabits, oldmaxedicts * sizeof(int));
entity_state_t;
// baseline state values
-entity_state_t defaultstate;
+extern entity_state_t defaultstate;
// reads a quake entity from the network stream
void EntityFrameQuake_ReadEntity(int bits);
// writes a list of quake entities to the network stream
{
float *value1;
vec3_t newvalue;
- float new;
+ double f;
VM_SAFEPARMCOUNT(1,VM_normalize);
value1 = PRVM_G_VECTOR(OFS_PARM0);
- new = value1[0] * value1[0] + value1[1] * value1[1] + value1[2]*value1[2];
- new = sqrt(new);
-
- if (new == 0)
- newvalue[0] = newvalue[1] = newvalue[2] = 0;
- else
+ f = VectorLength2(value1);
+ if (f)
{
- new = 1/new;
- newvalue[0] = value1[0] * new;
- newvalue[1] = value1[1] * new;
- newvalue[2] = value1[2] * new;
+ f = 1.0 / sqrt(f);
+ VectorScale(value1, f, newvalue);
}
+ else
+ VectorClear(newvalue);
VectorCopy (newvalue, PRVM_G_VECTOR(OFS_RETURN));
}
*/
void VM_vlen (void)
{
- float *value1;
- float new;
-
VM_SAFEPARMCOUNT(1,VM_vlen);
-
- value1 = PRVM_G_VECTOR(OFS_PARM0);
-
- new = value1[0] * value1[0] + value1[1] * value1[1] + value1[2]*value1[2];
- new = sqrt(new);
-
- PRVM_G_FLOAT(OFS_RETURN) = new;
+ PRVM_G_FLOAT(OFS_RETURN) = VectorLength(PRVM_G_VECTOR(OFS_PARM0));
}
/*
name = PRVM_G_STRING( OFS_PARM0 );
VM_CheckEmptyString( name );
- state = PRVM_G_FLOAT( OFS_PARM1 );
+ state = (clvideostate_t)PRVM_G_FLOAT( OFS_PARM1 );
video = CL_GetVideo( name );
if( video && state > CLVIDEO_UNUSED && state < CLVIDEO_STATECOUNT )
prog->edictprivate_size = max(prog->edictprivate_size,(int)sizeof(prvm_edict_private_t));
// alloc edicts
- prog->edicts = Mem_Alloc(prog->progs_mempool,prog->limit_edicts * sizeof(prvm_edict_t));
+ prog->edicts = (prvm_edict_t *)Mem_Alloc(prog->progs_mempool,prog->limit_edicts * sizeof(prvm_edict_t));
// alloc edict private space
prog->edictprivate = Mem_Alloc(prog->progs_mempool, prog->max_edicts * prog->edictprivate_size);
mfunction_t *f;
int n;
- type &= ~DEF_SAVEGLOBAL;
+ type = (etype_t)((int) type & ~DEF_SAVEGLOBAL);
switch (type)
{
ddef_t *def;
mfunction_t *f;
- type &= ~DEF_SAVEGLOBAL;
+ type = (etype_t)((int)type & ~DEF_SAVEGLOBAL);
switch (type)
{
sprintf (line,"%i(?)", ofs);
else
{
- s = PRVM_ValueString (def->type, val);
+ s = PRVM_ValueString ((etype_t)def->type, (prvm_eval_t *)val);
sprintf (line,"%i(%s)%s", ofs, PRVM_GetString(def->s_name), s);
}
strcat(tempstring, " ");
strcat(tempstring, " ");
- name = PRVM_ValueString(d->type, (prvm_eval_t *)v);
+ name = PRVM_ValueString((etype_t)d->type, (prvm_eval_t *)v);
if (strlen(name) > 256)
{
memcpy (tempstring2, name, 256);
continue;
FS_Printf(f,"\"%s\" ",name);
- FS_Printf(f,"\"%s\"\n", PRVM_UglyValueString(d->type, (prvm_eval_t *)v));
+ FS_Printf(f,"\"%s\"\n", PRVM_UglyValueString((etype_t)d->type, (prvm_eval_t *)v));
}
FS_Print(f, "}\n");
name = PRVM_GetString(def->s_name);
FS_Printf(f,"\"%s\" ", name);
- FS_Printf(f,"\"%s\"\n", PRVM_UglyValueString(type, (prvm_eval_t *)&prog->globals.generic[def->ofs]));
+ FS_Printf(f,"\"%s\"\n", PRVM_UglyValueString((etype_t)type, (prvm_eval_t *)&prog->globals.generic[def->ofs]));
}
FS_Print(f,"}\n");
}
(unsigned int)LittleLong( header[ 4 ] ) == (unsigned int)prog->progs->numfielddefs &&
(unsigned int)LittleLong( header[ 5 ] ) == (unsigned int)prog->progs->numstatements )
{
- prog->statement_linenums = Mem_Alloc(prog->progs_mempool, prog->progs->numstatements * sizeof( int ) );
+ prog->statement_linenums = (int *)Mem_Alloc(prog->progs_mempool, prog->progs->numstatements * sizeof( int ) );
memcpy( prog->statement_linenums, (int *) lno + 6, prog->progs->numstatements * sizeof( int ) );
}
Mem_Free( lno );
// so allocate a new place for it
infielddefs = (ddef_t *)((qbyte *)prog->progs + prog->progs->ofs_fielddefs);
// ( + DPFIELDS )
- prog->fielddefs = Mem_Alloc(prog->progs_mempool, (prog->progs->numfielddefs + numrequiredfields) * sizeof(ddef_t));
+ prog->fielddefs = (ddef_t *)Mem_Alloc(prog->progs_mempool, (prog->progs->numfielddefs + numrequiredfields) * sizeof(ddef_t));
prog->statements = (dstatement_t *)((qbyte *)prog->progs + prog->progs->ofs_statements);
prog->statements[i].c = LittleShort(prog->statements[i].c);
}
- prog->functions = Mem_Alloc(prog->progs_mempool, sizeof(mfunction_t) * prog->progs->numfunctions);
+ prog->functions = (mfunction_t *)Mem_Alloc(prog->progs_mempool, sizeof(mfunction_t) * prog->progs->numfunctions);
for (i = 0;i < prog->progs->numfunctions;i++)
{
prog->functions[i].first_statement = LittleLong (dfunctions[i].first_statement);
if(!PRVM_SetProgFromString(Cmd_Argv(1)))
return;
- counts = Mem_Alloc(tempmempool, prog->progs->numfielddefs * sizeof(int));
+ counts = (int *)Mem_Alloc(tempmempool, prog->progs->numfielddefs * sizeof(int));
for (ednum = 0;ednum < prog->max_edicts;ednum++)
{
ed = PRVM_EDICT_NUM(ednum);
if( !global )
Con_Printf( "No global '%s' in %s!\n", Cmd_Argv(2), Cmd_Argv(1) );
else
- Con_Printf( "%s: %s\n", Cmd_Argv(2), PRVM_ValueString( global->type, (prvm_eval_t *) &prog->globals.generic[ global->ofs ] ) );
+ Con_Printf( "%s: %s\n", Cmd_Argv(2), PRVM_ValueString( (etype_t)global->type, (prvm_eval_t *) &prog->globals.generic[ global->ofs ] ) );
PRVM_End;
}
const char **oldstrings = prog->knownstrings;
const qbyte *oldstrings_freeable = prog->knownstrings_freeable;
prog->maxknownstrings += 128;
- prog->knownstrings = PRVM_Alloc(prog->maxknownstrings * sizeof(char *));
- prog->knownstrings_freeable = PRVM_Alloc(prog->maxknownstrings * sizeof(qbyte));
+ prog->knownstrings = (const char **)PRVM_Alloc(prog->maxknownstrings * sizeof(char *));
+ prog->knownstrings_freeable = (qbyte *)PRVM_Alloc(prog->maxknownstrings * sizeof(qbyte));
if (prog->numknownstrings)
{
memcpy((char **)prog->knownstrings, oldstrings, prog->numknownstrings * sizeof(char *));
const char **oldstrings = prog->knownstrings;
const qbyte *oldstrings_freeable = prog->knownstrings_freeable;
prog->maxknownstrings += 128;
- prog->knownstrings = PRVM_Alloc(prog->maxknownstrings * sizeof(char *));
- prog->knownstrings_freeable = PRVM_Alloc(prog->maxknownstrings * sizeof(qbyte));
+ prog->knownstrings = (const char **)PRVM_Alloc(prog->maxknownstrings * sizeof(char *));
+ prog->knownstrings_freeable = (qbyte *)PRVM_Alloc(prog->maxknownstrings * sizeof(qbyte));
if (prog->numknownstrings)
{
memcpy((char **)prog->knownstrings, oldstrings, prog->numknownstrings * sizeof(char *));
prog->numknownstrings++;
}
prog->firstfreeknownstring = i + 1;
- prog->knownstrings[i] = PRVM_Alloc(bufferlength);
+ prog->knownstrings[i] = (char *)PRVM_Alloc(bufferlength);
prog->knownstrings_freeable[i] = true;
if (pointer)
*pointer = (char *)(prog->knownstrings[i]);
#undef true
#undef false
+#ifndef __cplusplus
typedef enum {false, true} qboolean;
+#else
+typedef bool qboolean;
+#endif
#if defined(WIN32) && !defined(WIN64)
# define ssize_t long
#endif
#ifndef FALSE
-#define FALSE 0
-#define TRUE 1
+#define FALSE false
+#define TRUE true
#endif
// up / down
#include "qtypes.h"
extern char *buildstring;
+extern char engineversion[128];
#define GAMENAME "id1"
float alpha;
rmeshstate_t m;
const explosion_t *e;
- e = calldata1;
+ e = (explosion_t *)calldata1;
GL_BlendFunc(GL_SRC_ALPHA, GL_ONE);
GL_DepthMask(false);
int x, y;
qbyte *data, *noise1, *noise2;
- data = Mem_Alloc(tempmempool, BEAMWIDTH * BEAMHEIGHT * 4);
- noise1 = Mem_Alloc(tempmempool, BEAMHEIGHT * BEAMHEIGHT);
- noise2 = Mem_Alloc(tempmempool, BEAMHEIGHT * BEAMHEIGHT);
+ data = (qbyte *)Mem_Alloc(tempmempool, BEAMWIDTH * BEAMHEIGHT * 4);
+ noise1 = (qbyte *)Mem_Alloc(tempmempool, BEAMHEIGHT * BEAMHEIGHT);
+ noise2 = (qbyte *)Mem_Alloc(tempmempool, BEAMHEIGHT * BEAMHEIGHT);
fractalnoise(noise1, BEAMHEIGHT, BEAMHEIGHT / 8);
fractalnoise(noise2, BEAMHEIGHT, BEAMHEIGHT / 16);
void R_DrawLightningBeamCallback(const void *calldata1, int calldata2)
{
- const beam_t *b = calldata1;
+ const beam_t *b = (beam_t *)calldata1;
rmeshstate_t m;
vec3_t beamdir, right, up, offset;
float length, t1, t2;
maxshadowelements = numtris * 24;
if (shadowelements)
Mem_Free(shadowelements);
- shadowelements = Mem_Alloc(r_shadow_mempool, maxshadowelements * sizeof(int));
+ shadowelements = (int *)Mem_Alloc(r_shadow_mempool, maxshadowelements * sizeof(int));
}
return shadowelements;
}
if (r_shadow_buffer_leaflist)
Mem_Free(r_shadow_buffer_leaflist);
r_shadow_buffer_numleafpvsbytes = numleafpvsbytes;
- r_shadow_buffer_leafpvs = Mem_Alloc(r_shadow_mempool, r_shadow_buffer_numleafpvsbytes);
- r_shadow_buffer_leaflist = Mem_Alloc(r_shadow_mempool, r_shadow_buffer_numleafpvsbytes * 8 * sizeof(*r_shadow_buffer_leaflist));
+ r_shadow_buffer_leafpvs = (qbyte *)Mem_Alloc(r_shadow_mempool, r_shadow_buffer_numleafpvsbytes);
+ r_shadow_buffer_leaflist = (int *)Mem_Alloc(r_shadow_mempool, r_shadow_buffer_numleafpvsbytes * 8 * sizeof(*r_shadow_buffer_leaflist));
}
if (r_shadow_buffer_numsurfacepvsbytes < numsurfacepvsbytes)
{
if (r_shadow_buffer_surfacelist)
Mem_Free(r_shadow_buffer_surfacelist);
r_shadow_buffer_numsurfacepvsbytes = numsurfacepvsbytes;
- r_shadow_buffer_surfacepvs = Mem_Alloc(r_shadow_mempool, r_shadow_buffer_numsurfacepvsbytes);
- r_shadow_buffer_surfacelist = Mem_Alloc(r_shadow_mempool, r_shadow_buffer_numsurfacepvsbytes * 8 * sizeof(*r_shadow_buffer_surfacelist));
+ r_shadow_buffer_surfacepvs = (qbyte *)Mem_Alloc(r_shadow_mempool, r_shadow_buffer_numsurfacepvsbytes);
+ r_shadow_buffer_surfacelist = (int *)Mem_Alloc(r_shadow_mempool, r_shadow_buffer_numsurfacepvsbytes * 8 * sizeof(*r_shadow_buffer_surfacelist));
}
}
Mem_Free(shadowmark);
if (shadowmarklist)
Mem_Free(shadowmarklist);
- shadowmark = Mem_Alloc(r_shadow_mempool, maxshadowmark * sizeof(*shadowmark));
- shadowmarklist = Mem_Alloc(r_shadow_mempool, maxshadowmark * sizeof(*shadowmarklist));
+ shadowmark = (int *)Mem_Alloc(r_shadow_mempool, maxshadowmark * sizeof(*shadowmark));
+ shadowmarklist = (int *)Mem_Alloc(r_shadow_mempool, maxshadowmark * sizeof(*shadowmarklist));
shadowmarkcount = 0;
}
shadowmarkcount++;
Mem_Free(vertexupdate);
if (vertexremap)
Mem_Free(vertexremap);
- vertexupdate = Mem_Alloc(r_shadow_mempool, maxvertexupdate * sizeof(int));
- vertexremap = Mem_Alloc(r_shadow_mempool, maxvertexupdate * sizeof(int));
+ vertexupdate = (int *)Mem_Alloc(r_shadow_mempool, maxvertexupdate * sizeof(int));
+ vertexremap = (int *)Mem_Alloc(r_shadow_mempool, maxvertexupdate * sizeof(int));
vertexupdatenum = 0;
}
vertexupdatenum++;
r_shadow_attenscale = r_shadow_lightattenuationscale.value;
#define ATTEN2DSIZE 64
#define ATTEN3DSIZE 32
- data = Mem_Alloc(tempmempool, max(ATTEN3DSIZE*ATTEN3DSIZE*ATTEN3DSIZE*4, ATTEN2DSIZE*ATTEN2DSIZE*4));
+ data = (qbyte *)Mem_Alloc(tempmempool, max(ATTEN3DSIZE*ATTEN3DSIZE*ATTEN3DSIZE*4, ATTEN2DSIZE*ATTEN2DSIZE*4));
for (y = 0;y < ATTEN2DSIZE;y++)
{
for (x = 0;x < ATTEN2DSIZE;x++)
R_Shadow_EnlargeLeafSurfaceBuffer(model->brush.num_leafs, model->num_surfaces);
model->GetLightInfo(ent, rtlight->shadoworigin, rtlight->radius, rtlight->cullmins, rtlight->cullmaxs, r_shadow_buffer_leaflist, r_shadow_buffer_leafpvs, &numleafs, r_shadow_buffer_surfacelist, r_shadow_buffer_surfacepvs, &numsurfaces);
numleafpvsbytes = (model->brush.num_leafs + 7) >> 3;
- data = Mem_Alloc(r_shadow_mempool, sizeof(int) * numleafs + numleafpvsbytes + sizeof(int) * numsurfaces);
+ data = (qbyte *)Mem_Alloc(r_shadow_mempool, sizeof(int) * numleafs + numleafpvsbytes + sizeof(int) * numsurfaces);
rtlight->static_numleafs = numleafs;
rtlight->static_numleafpvsbytes = numleafpvsbytes;
- rtlight->static_leaflist = (void *)data;data += sizeof(int) * numleafs;
- rtlight->static_leafpvs = (void *)data;data += numleafpvsbytes;
+ rtlight->static_leaflist = (int *)data;data += sizeof(int) * numleafs;
+ rtlight->static_leafpvs = (qbyte *)data;data += numleafpvsbytes;
rtlight->static_numsurfaces = numsurfaces;
- rtlight->static_surfacelist = (void *)data;data += sizeof(int) * numsurfaces;
+ rtlight->static_surfacelist = (int *)data;data += sizeof(int) * numsurfaces;
if (numleafs)
memcpy(rtlight->static_leaflist, r_shadow_buffer_leaflist, rtlight->static_numleafs * sizeof(*rtlight->static_leaflist));
if (numleafpvsbytes)
{
cubemapsize = image_width;
// note this clears to black, so unavailable sides are black
- cubemappixels = Mem_Alloc(tempmempool, 6*cubemapsize*cubemapsize*4);
+ cubemappixels = (qbyte *)Mem_Alloc(tempmempool, 6*cubemapsize*cubemapsize*4);
}
// copy the image with any flipping needed by the suffix (px and posx types don't need flipping)
if (cubemappixels)
dlight_t *R_Shadow_NewWorldLight(void)
{
dlight_t *light;
- light = Mem_Alloc(r_shadow_mempool, sizeof(dlight_t));
+ light = (dlight_t *)Mem_Alloc(r_shadow_mempool, sizeof(dlight_t));
light->next = r_shadow_worldlightchain;
r_shadow_worldlightchain = light;
return light;
{
float intensity;
const dlight_t *light;
- light = calldata1;
+ light = (dlight_t *)calldata1;
intensity = 0.5;
if (light->selected)
intensity = 0.75 + 0.25 * sin(realtime * M_PI * 4.0);
{
bufmaxchars = bufchars + strlen(line) + 2048;
oldbuf = buf;
- buf = Mem_Alloc(tempmempool, bufmaxchars);
+ buf = (char *)Mem_Alloc(tempmempool, bufmaxchars);
if (oldbuf)
{
if (bufchars)
}
}
}
- temp = Mem_Alloc(tempmempool, image_width*image_height*4);
+ temp = (qbyte *)Mem_Alloc(tempmempool, image_width*image_height*4);
Image_CopyMux (temp, image_rgba, image_width, image_height, suffix[j][i].flipx, suffix[j][i].flipy, suffix[j][i].flipdiagonal, 4, 4, indices);
skyboxside[i] = R_LoadTexture2D(skytexturepool, va("skyboxside%d", i), image_width, image_height, temp, TEXTYPE_RGBA, TEXF_CLAMP | TEXF_PRECACHE, NULL);
Mem_Free(image_rgba);
void R_DrawSpriteModelCallback(const void *calldata1, int calldata2)
{
- const entity_render_t *ent = calldata1;
+ const entity_render_t *ent = (entity_render_t *)calldata1;
int i;
vec3_t left, up, org, color, diffusecolor, diffusenormal;
mspriteframe_t *frame;
// flag arrays used for visibility checking on world model
// (all other entities have no per-surface/per-leaf visibility checks)
// TODO: dynamic resize according to r_refdef.worldmodel->brush.num_clusters
-qbyte r_pvsbits[(32768+7)>>3];
+extern qbyte r_pvsbits[(32768+7)>>3];
// TODO: dynamic resize according to r_refdef.worldmodel->brush.num_leafs
-qbyte r_worldleafvisible[32768];
+extern qbyte r_worldleafvisible[32768];
// TODO: dynamic resize according to r_refdef.worldmodel->num_surfaces
-qbyte r_worldsurfacevisible[262144];
+extern qbyte r_worldsurfacevisible[262144];
extern matrix4x4_t r_identitymatrix;
qboolean SV_CheckBottom (prvm_edict_t *ent);
qboolean SV_movestep (prvm_edict_t *ent, vec3_t move, qboolean relink);
+struct trace_s SV_ClipMoveToEntity(prvm_edict_t *ent, const vec3_t start, const vec3_t mins, const vec3_t maxs, const vec3_t end, int movetype, int hitsupercontents);
+
void SV_WriteClientdataToMessage (client_t *client, prvm_edict_t *ent, sizebuf_t *msg, int *stats);
void SV_MoveToGoal (void);
offset *= shm->format.channels;
nframes *= shm->format.channels;
shm->samplepos = offset;
- shm->buffer = areas->addr;
+ shm->buffer = (qbyte *)areas->addr;
return shm->samplepos;
}
shm->format.channels = 2;
shm->samples = 32768;
shm->samplepos = 0;
- shm->buffer = Mem_Alloc(snd_mempool, shm->format.channels * shm->samples * shm->format.width);
+ shm->buffer = (qbyte *)Mem_Alloc(snd_mempool, shm->format.channels * shm->samples * shm->format.width);
}
else
{
return sfx;
// Add a sfx_t struct for this sound
- sfx = Mem_Alloc (snd_mempool, sizeof (*sfx));
+ sfx = (sfx_t *)Mem_Alloc (snd_mempool, sizeof (*sfx));
memset (sfx, 0, sizeof(*sfx));
strlcpy (sfx->name, name, sizeof (sfx->name));
sfx->memsize = sizeof(*sfx);
memset(channels, 0, MAX_CHANNELS * sizeof(channel_t));
// Clear sound buffer
- pbuf = S_LockBuffer();
+ pbuf = (unsigned char *)S_LockBuffer();
if (pbuf != NULL)
{
int setsize = shm->samples * shm->format.width;
unsigned int factor;
size_t buff_len;
- per_ch = ch->fetcher_data;
+ per_ch = (ogg_stream_perchannel_t *)ch->fetcher_data;
sfx = ch->sfx;
- per_sfx = sfx->fetcher_data;
+ per_sfx = (ogg_stream_persfx_t *)sfx->fetcher_data;
format = &sfx->format;
buff_len = STREAM_BUFFER_SIZE(format);
ogg_stream_persfx_t* per_sfx;
memsize = sizeof (*per_ch) - sizeof (per_ch->sb.data) + buff_len;
- per_ch = Mem_Alloc (snd_mempool, memsize);
+ per_ch = (ogg_stream_perchannel_t *)Mem_Alloc (snd_mempool, memsize);
sfx->memsize += memsize;
- per_sfx = sfx->fetcher_data;
+ per_sfx = (ogg_stream_persfx_t *)sfx->fetcher_data;
// Open it with the VorbisFile API
per_ch->ov_decode.buffer = per_sfx->file;
{
ogg_stream_perchannel_t* per_ch;
- per_ch = ch->fetcher_data;
+ per_ch = (ogg_stream_perchannel_t *)ch->fetcher_data;
if (per_ch != NULL)
{
size_t buff_len;
*/
static void OGG_FreeSfx (sfx_t* sfx)
{
- ogg_stream_persfx_t* per_sfx = sfx->fetcher_data;
+ ogg_stream_persfx_t* per_sfx = (ogg_stream_persfx_t *)sfx->fetcher_data;
// Free the Ogg Vorbis file
Mem_Free(per_sfx->file);
ogg_stream_persfx_t* per_sfx;
Con_DPrintf ("\"%s\" will be streamed\n", filename);
- per_sfx = Mem_Alloc (snd_mempool, sizeof (*per_sfx));
+ per_sfx = (ogg_stream_persfx_t *)Mem_Alloc (snd_mempool, sizeof (*per_sfx));
s->memsize += sizeof (*per_sfx);
per_sfx->file = data;
per_sfx->filesize = fs_filesize;
Con_DPrintf ("\"%s\" will be cached\n", filename);
// Decode it
- buff = Mem_Alloc (snd_mempool, (int)len);
+ buff = (char *)Mem_Alloc (snd_mempool, (int)len);
done = 0;
bs = 0;
#if BYTE_ORDER == LITTLE_ENDIAN
// Resample it
memsize = (size_t)len + sizeof (*sb) - sizeof (sb->data);
- sb = Mem_Alloc (snd_mempool, memsize);
+ sb = (sfxbuffer_t *)Mem_Alloc (snd_mempool, memsize);
s->memsize += memsize;
s->fetcher_data = sb;
s->fetcher = &wav_fetcher;
// Init the shm structure
memset( (void*) shm, 0, sizeof(*shm) );
-
+
shm->format.channels = 2; //stereo
shm->format.width = 2;
shm->samplepos = 0;
shm->samples = AUDIO_SDL_SAMPLES * AUDIO_LOCALFACTOR;
shm->bufferlength = shm->samples * shm->format.width;
- shm->buffer = Mem_Alloc( snd_mempool, shm->bufferlength );
+ shm->buffer = (qbyte *)Mem_Alloc( snd_mempool, shm->bufferlength );
// Init the as structure
as.buffer = shm->buffer;
spec.format = AUDIO_S16SYS;
spec.freq = shm->format.speed;
spec.userdata = NULL;
- spec.samples = AUDIO_SDL_SAMPLES;
-
+ spec.samples = AUDIO_SDL_SAMPLES;
+
if( SDL_OpenAudio( &spec, NULL ) ) {
Con_Print( "Failed to open the audio device!\n" );
- Con_DPrintf(
+ Con_DPrintf(
"Audio Specification:\n"
"\tChannels : %i\n"
"\tFormat : %x\n"
"\tFrequency : %i\n"
- "\tBuffersize: %i Bytes(%i Samples)\n",
+ "\tBuffersize: %i Bytes(%i Samples)\n",
spec.channels, spec.format, spec.freq, shm->bufferlength , spec.samples );
- Mem_Free( shm->buffer );
+ Mem_Free( shm->buffer );
return false;
}
*/
static const sfxbuffer_t* WAV_FetchSound (channel_t* ch, unsigned int start, unsigned int nbsamples)
{
- return ch->sfx->fetcher_data;
+ return (sfxbuffer_t *)ch->sfx->fetcher_data;
}
/*
*/
static void WAV_FreeSfx (sfx_t* sfx)
{
- sfxbuffer_t* sb = sfx->fetcher_data;
+ sfxbuffer_t* sb = (sfxbuffer_t *)sfx->fetcher_data;
// Free the sound buffer
sfx->memsize -= (sb->length * sfx->format.channels * sfx->format.width) + sizeof (*sb) - sizeof (sb->data);
len = len * info.width * info.channels;
memsize = len + sizeof (*sb) - sizeof (sb->data);
- sb = Mem_Alloc (snd_mempool, memsize);
+ sb = (sfxbuffer_t *)Mem_Alloc (snd_mempool, memsize);
if (sb == NULL)
{
Con_Printf("failed to allocate memory for sound \"%s\"\n", s->name);
// progs fields, often accessed by server
prog->edictsfields = PR_Alloc(prog->max_edicts * prog->edict_size);*/
// used by PushMove to move back pushed entities
- sv.moved_edicts = PRVM_Alloc(prog->max_edicts * sizeof(prvm_edict_t *));
+ sv.moved_edicts = (prvm_edict_t **)PRVM_Alloc(prog->max_edicts * sizeof(prvm_edict_t *));
/*for (i = 0;i < prog->max_edicts;i++)
{
ent = prog->edicts + i;
prvm_edict_t *ent;
PRVM_Free( sv.moved_edicts );
- sv.moved_edicts = PRVM_Alloc(prog->max_edicts * sizeof(prvm_edict_t *));
+ sv.moved_edicts = (prvm_edict_t **)PRVM_Alloc(prog->max_edicts * sizeof(prvm_edict_t *));
// links don't survive the transition, so unlink everything
for (i = 0, ent = prog->edicts;i < prog->max_edicts;i++, ent++)
// run the impact function
if (impact)
{
- SV_Impact(ent, trace.ent);
+ SV_Impact(ent, (prvm_edict_t *)trace.ent);
// break if removed by the impact function
if (ent->priv.server->free)
SV_LinkEdict (ent, true);
if (trace.ent && (!((int)ent->fields.server->flags & FL_ONGROUND) || ent->fields.server->groundentity != PRVM_EDICT_TO_PROG(trace.ent)))
- SV_Impact (ent, trace.ent);
+ SV_Impact (ent, (prvm_edict_t *)trace.ent);
return trace;
}
============
*/
-trace_t SV_ClipMoveToEntity (prvm_edict_t *ent, vec3_t start, vec3_t mins, vec3_t maxs, vec3_t end, int movetype, int hitsupercontents);
void SV_PushMove (prvm_edict_t *pusher, float movetime)
{
int i, e, index;
ui_item_t UI_CloneItem(ui_item_t item)
{
ui_item_t clone;
- clone = UI_Alloc(item->size);
- clone = memcpy(clone, item, item->size);
+ clone = (ui_item_t)UI_Alloc(item->size);
+ memcpy(clone, item, item->size);
return clone;
}
// itemlist stuff
ui_itemlist_t UI_CreateItemList(void)
{
- return UI_Alloc(sizeof(ui_itemlist_t));
+ return (ui_itemlist_t)UI_Alloc(sizeof(ui_itemlist_t));
}
ui_itemlist_t UI_CloneItemList(ui_itemlist_t list)
// used to build the item list
struct ui_item_s *prev, *next; // items are allowed to be freed everywhere
- // called for system events (true means message processed)
+ // called for system events (true means message processed)
int (*eventhandler)(ui_itemlist_t list, ui_item_t self, ui_message_t *in, ui_message_queue_t *out);
// z-order (the higher, the later it is drawn)
typedef struct ui_label_s *ui_label_t;
typedef struct ui_text_s *ui_text_t;
-struct ui_label_t
+struct ui_label_s
{
struct ui_item_s item;
const char *caption;
};
-ui_item_t UI_CreateButton(void);
+ui_item_t UI_CreateButton(void);
ui_item_t UI_CreateLabel(void);
ui_item_t UI_CreateText(void);
scr_width = width;
scr_height = height;
- if ((qglGetString = GL_GetProcAddress("glGetString")) == NULL)
+ if ((qglGetString = (const GLubyte* (GLAPIENTRY *)(GLenum name))GL_GetProcAddress("glGetString")) == NULL)
Sys_Error("glGetString not found in %s", gl_driver);
if (fullscreen)
{
void *p = NULL;
if (qglXGetProcAddressARB != NULL)
- p = (void *) qglXGetProcAddressARB(name);
+ p = (void *) qglXGetProcAddressARB((GLubyte *)name);
if (p == NULL)
p = (void *) dlsym(prjobj, name);
return p;
vidmode_ext = true;
}
- if ((qglXChooseVisual = GL_GetProcAddress("glXChooseVisual")) == NULL
- || (qglXCreateContext = GL_GetProcAddress("glXCreateContext")) == NULL
- || (qglXMakeCurrent = GL_GetProcAddress("glXMakeCurrent")) == NULL
- || (qglXSwapBuffers = GL_GetProcAddress("glXSwapBuffers")) == NULL
- || (qglXQueryExtensionsString = GL_GetProcAddress("glXQueryExtensionsString")) == NULL)
+ if ((qglXChooseVisual = (XVisualInfo *(GLAPIENTRY *)(Display *dpy, int screen, int *attribList))GL_GetProcAddress("glXChooseVisual")) == NULL
+ || (qglXCreateContext = (GLXContext (GLAPIENTRY *)(Display *dpy, XVisualInfo *vis, GLXContext shareList, Bool direct))GL_GetProcAddress("glXCreateContext")) == NULL
+ || (qglXDestroyContext = (void (GLAPIENTRY *)(Display *dpy, GLXContext ctx))GL_GetProcAddress("glXDestroyContext")) == NULL
+ || (qglXMakeCurrent = (Bool (GLAPIENTRY *)(Display *dpy, GLXDrawable drawable, GLXContext ctx))GL_GetProcAddress("glXMakeCurrent")) == NULL
+ || (qglXSwapBuffers = (void (GLAPIENTRY *)(Display *dpy, GLXDrawable drawable))GL_GetProcAddress("glXSwapBuffers")) == NULL
+ || (qglXQueryExtensionsString = (const char *(GLAPIENTRY *)(Display *dpy, int screen))GL_GetProcAddress("glXQueryExtensionsString")) == NULL)
{
Con_Printf("glX functions not found in %s\n", gl_driver);
return false;
XSync(vidx11_display, False);
- if ((qglGetString = GL_GetProcAddress("glGetString")) == NULL)
+ if ((qglGetString = (const GLubyte* (GLAPIENTRY *)(GLenum name))GL_GetProcAddress("glGetString")) == NULL)
{
Con_Printf ("glGetString not found in %s", gl_driver);
return false;
}
- gl_renderer = qglGetString(GL_RENDERER);
- gl_vendor = qglGetString(GL_VENDOR);
- gl_version = qglGetString(GL_VERSION);
- gl_extensions = qglGetString(GL_EXTENSIONS);
+ gl_renderer = (const char *)qglGetString(GL_RENDERER);
+ gl_vendor = (const char *)qglGetString(GL_VENDOR);
+ gl_version = (const char *)qglGetString(GL_VERSION);
+ gl_extensions = (const char *)qglGetString(GL_EXTENSIONS);
gl_platform = "GLX";
gl_platformextensions = qglXQueryExtensionsString(vidx11_display, vidx11_screen);
return false;
}
- qglGetString = GL_GetProcAddress("glGetString");
-
- // Knghtbrd: should do platform-specific extension string function here
-
- if (qglGetString == NULL)
+ if ((qglGetString = (const GLubyte* (GLAPIENTRY *)(GLenum name))GL_GetProcAddress("glGetString")) == NULL)
{
VID_Shutdown();
Con_Print("Required OpenGL function glGetString not found\n");
return false;
}
+ // Knghtbrd: should do platform-specific extension string function here
+
vid_isfullscreen = false;
if (fullscreen) {
flags |= SDL_FULLSCREEN;
return false;
}
- qglGetString = GL_GetProcAddress("glGetString");
- qwglGetExtensionsStringARB = GL_GetProcAddress("wglGetExtensionsStringARB");
- if (qglGetString == NULL)
+ if ((qglGetString = (const GLubyte* (GLAPIENTRY *)(GLenum name))GL_GetProcAddress("glGetString")) == NULL)
{
VID_Shutdown();
Con_Print("glGetString not found\n");
return false;
}
+ if ((qwglGetExtensionsStringARB = (const char *(WINAPI *)(HDC hdc))GL_GetProcAddress("wglGetExtensionsStringARB")) == NULL)
+ Con_Print("wglGetExtensionsStringARB not found\n");
gl_renderer = qglGetString(GL_RENDERER);
gl_vendor = qglGetString(GL_VENDOR);
gl_version = qglGetString(GL_VERSION);
Con_Print("gfx.wad doesn't have WAD2 id\n");
else
{
- wad_base = Mem_Alloc(cl_mempool, fs_filesize);
+ wad_base = (qbyte *)Mem_Alloc(cl_mempool, fs_filesize);
memcpy(wad_base, temp, fs_filesize);
Mem_Free(temp);
infotableofs = LittleLong(header.infotableofs);
if (FS_Seek (file, infotableofs, SEEK_SET))
{Con_Print("W_LoadTextureWadFile: unable to seek to lump table\n");return;}
- if (!(lumps = Mem_Alloc(tempmempool, sizeof(lumpinfo_t)*numlumps)))
+ if (!(lumps = (lumpinfo_t *)Mem_Alloc(tempmempool, sizeof(lumpinfo_t)*numlumps)))
{Con_Print("W_LoadTextureWadFile: unable to allocate temporary memory for lump table\n");return;}
if (FS_Read(file, lumps, sizeof(lumpinfo_t) * numlumps) != (fs_offset_t)sizeof(lumpinfo_t) * numlumps)
int d, p;
in = (qbyte *)tex + tex->offsets[0];
- data = out = Mem_Alloc(tempmempool, tex->width * tex->height * 4);
+ data = out = (qbyte *)Mem_Alloc(tempmempool, tex->width * tex->height * 4);
if (!data)
return NULL;
image_width = tex->width;
if (FS_Seek(file, texwadlump[i].position, SEEK_SET))
{Con_Print("W_GetTexture: corrupt WAD3 file\n");return NULL;}
- tex = Mem_Alloc(tempmempool, texwadlump[i].size);
+ tex = (miptex_t *)Mem_Alloc(tempmempool, texwadlump[i].size);
if (!tex)
return NULL;
if (FS_Read(file, tex, texwadlump[i].size) < texwadlump[i].size)
// big allocations are not clumped
#endif
pool->realsize += sizeof(memheader_t) + size + sizeof(int);
- mem = malloc(sizeof(memheader_t) + size + sizeof(int));
+ mem = (memheader_t *)malloc(sizeof(memheader_t) + size + sizeof(int));
if (mem == NULL)
Sys_Error("Mem_Alloc: out of memory (alloc at %s:%i)", filename, fileline);
#if MEMCLUMPING
mempool_t *pool;
if (developer.integer && developer_memorydebug.integer)
_Mem_CheckSentinelsGlobal(filename, fileline);
- pool = malloc(sizeof(mempool_t));
+ pool = (mempool_t *)malloc(sizeof(mempool_t));
if (pool == NULL)
Sys_Error("Mem_AllocPool: out of memory (allocpool at %s:%i)", filename, fileline);
memset(pool, 0, sizeof(mempool_t));
qboolean Mem_IsAllocated(mempool_t *pool, void *data);
// used for temporary allocations
-mempool_t *tempmempool;
+extern mempool_t *tempmempool;
void Memory_Init (void);
void Memory_Shutdown (void);