break;
string[l] = c;
l++;
- } while (l < sizeof(string)-1);
+ } while (l < (int)sizeof(string)-1);
string[l] = 0;
while (remaining)
{
- if (remaining < sizeof(buf))
+ if (remaining < (int)sizeof(buf))
count = remaining;
else
count = sizeof(buf);
sprintf(temptext, "say_team:%s%c", chat_buffer, (int) 10+((int)(realtime*con_cursorspeed)&1));
else
sprintf(temptext, "say:%s%c", chat_buffer, (int) 10+((int)(realtime*con_cursorspeed)&1));
- while (strlen(temptext) >= con_linewidth)
+ while (strlen(temptext) >= (size_t) con_linewidth)
{
DrawQ_String (0, v, temptext, con_linewidth, 8, 8, 1, 1, 1, 1, 0);
strcpy(temptext, &temptext[con_linewidth]);
typedef struct gltextureunit_s
{
- unsigned int t1d, t2d, t3d, tcubemap;
- unsigned int arrayenabled;
+ int t1d, t2d, t3d, tcubemap;
+ int arrayenabled;
float rgbscale, alphascale;
int combinergb, combinealpha;
// FIXME: add more combine stuff
skinframe_t *R_FetchSkinFrame(const entity_render_t *ent)
{
model_t *model = ent->model;
- unsigned int s = (unsigned int) ent->skinnum;
- if (s >= model->numskins)
+ int s = ent->skinnum;
+ if ((unsigned int)s >= (unsigned int)model->numskins)
s = 0;
if (model->skinscenes[s].framecount > 1)
return &model->skinframes[model->skinscenes[s].firstframe + (int) (cl.time * 10) % model->skinscenes[s].framecount];
typedef struct gltexturepool_s
{
- int sentinel;
+ unsigned int sentinel;
struct gltextureimage_s *imagechain;
struct gltexture_s *gltchain;
struct gltexturepool_s *next;
entnum = -1;
while (!Qeof(f))
{
- for (i = 0;i < sizeof(buf) - 1;i++)
+ for (i = 0;i < (int)sizeof(buf) - 1;i++)
{
r = Qgetc (f);
if (r == EOF || !r)
}
while (p2 > p1 && (p2[-1] == '\n' || p2[-1] == '\r'))
p2--;
- for (j = strlen(text);j < (sizeof(text) - 2) && p1 < p2;)
+ for (j = strlen(text);j < (int)(sizeof(text) - 2) && p1 < p2;)
text[j++] = *p1++;
text[j++] = '\n';
text[j++] = 0;
}
while (p2 > p1 && (p2[-1] == '\n' || p2[-1] == '\r'))
p2--;
- for (j = strlen(text);j < (sizeof(text) - 2) && p1 < p2;)
+ for (j = strlen(text);j < (int)(sizeof(text) - 2) && p1 < p2;)
text[j++] = *p1++;
text[j++] = '\n';
text[j++] = 0;
const qbyte *palette, *fin, *enddata;
int x, y, x2, dataByte;
- if (loadsize < sizeof(pcx) + 768)
+ if (loadsize < (int)sizeof(pcx) + 768)
{
Con_Printf ("Bad pcx file\n");
return NULL;
if (key == K_DEL) // delete char on cursor
{
- if (key_linepos < strlen(key_lines[edit_line]))
+ if ((size_t)key_linepos < strlen(key_lines[edit_line]))
strcpy(key_lines[edit_line] + key_linepos, key_lines[edit_line] + key_linepos + 1);
return;
}
// otherwise just go right one
if (key == K_RIGHTARROW)
{
- if (strlen(key_lines[edit_line]) == key_linepos)
+ if (strlen(key_lines[edit_line]) == (size_t)key_linepos)
{
- if (strlen(key_lines[(edit_line + 31) & 31]) <= key_linepos)
+ if (strlen(key_lines[(edit_line + 31) & 31]) <= (size_t)key_linepos)
return; // no character to get
key_lines[edit_line][key_linepos] = key_lines[(edit_line + 31) & 31][key_linepos];
##### Variables that you may want to modify #####
#choose the compiler you want to use
-CC=gcc-3.1
+CC=gcc-cvs
#recommended for: anyone not using ALSA 0.5
OBJ_SND=snd_oss.o snd_dma.o snd_mix.o snd_mem.o
m_entersound = true;
// Look for the current resolution
- for (video_resolution = 0; video_resolution < sizeof (video_resolutions) / sizeof (video_resolutions[0]); video_resolution++)
+ for (video_resolution = 0; video_resolution < (int) (sizeof (video_resolutions) / sizeof (video_resolutions[0])); video_resolution++)
{
if (video_resolutions[video_resolution][0] == current_vid_width &&
video_resolutions[video_resolution][1] == current_vid_height)
// Fullscreen
M_Print(16, video_cursor_table[2], " Fullscreen");
M_DrawCheckbox(220, video_cursor_table[2], vid_fullscreen.integer);
-
+
// Stencil
M_Print(16, video_cursor_table[3], " Stencil");
M_DrawCheckbox(220, video_cursor_table[3], vid_stencil.integer);
int new_resolution = video_resolution + dir;
if (new_resolution < 0)
video_resolution = sizeof (video_resolutions) / sizeof (video_resolutions[0]) - 1;
- else if (new_resolution > sizeof (video_resolutions) / sizeof (video_resolutions[0]) - 1)
+ else if (new_resolution > (int) (sizeof (video_resolutions) / sizeof (video_resolutions[0]) - 1))
video_resolution = 0;
else
video_resolution = new_resolution;
// go through the lumps, swapping things
{
- unsigned int i, numposes;
+ int i, numposes;
zymscene_t *scene;
// 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);
loadmodel->animscenes[i].framecount = BigLong(scene->length);
loadmodel->animscenes[i].framerate = BigFloat(scene->framerate);
loadmodel->animscenes[i].loop = (BigLong(scene->flags) & ZYMSCENEFLAG_NOLOOP) == 0;
- if ((unsigned int) loadmodel->animscenes[i].firstframe >= numposes)
+ if ((unsigned int) loadmodel->animscenes[i].firstframe >= (unsigned int) numposes)
Host_Error("Mod_LoadZymoticModel: scene firstframe (%i) >= numposes (%i)\n", loadmodel->animscenes[i].firstframe, numposes);
- if ((unsigned int) loadmodel->animscenes[i].firstframe + (unsigned int) loadmodel->animscenes[i].framecount > numposes)
+ if ((unsigned int) loadmodel->animscenes[i].firstframe + (unsigned int) loadmodel->animscenes[i].framecount > (unsigned int) numposes)
Host_Error("Mod_LoadZymoticModel: scene firstframe (%i) + framecount (%i) >= numposes (%i)\n", loadmodel->animscenes[i].firstframe, loadmodel->animscenes[i].framecount, numposes);
if (loadmodel->animscenes[i].framerate < 0)
Host_Error("Mod_LoadZymoticModel: scene framerate (%f) < 0\n", loadmodel->animscenes[i].framerate);
}
{
- unsigned int i;
+ int i;
float *poses;
// zymlump_t lump_poses; // float pose[numposes][numbones][3][4]; // animation data
loadmodel->zymdata_poses = Mem_Alloc(loadmodel->mempool, pheader->lump_poses.length);
}
{
- unsigned int i;
+ int i;
zymbone_t *bone;
// zymlump_t lump_bones; // zymbone_t bone[numbones];
loadmodel->zymdata_bones = Mem_Alloc(loadmodel->mempool, pheader->numbones * sizeof(zymbone_t));
}
{
- unsigned int i, *bonecount;
+ int i, *bonecount;
// zymlump_t lump_vertbonecounts; // int vertbonecounts[numvertices]; // how many bones influence each vertex (separate mainly to make this compress better)
loadmodel->zymdata_vertbonecounts = Mem_Alloc(loadmodel->mempool, pheader->numbones * sizeof(int));
bonecount = (void *) (pheader->lump_vertbonecounts.start + pbase);
}
{
- unsigned int i;
+ int i;
zymvertex_t *vertdata;
// zymlump_t lump_verts; // zymvertex_t vert[numvertices]; // see vertex struct
loadmodel->zymdata_verts = Mem_Alloc(loadmodel->mempool, pheader->lump_verts.length);
}
{
- unsigned int i;
+ int i;
float *intexcoord, *outtexcoord;
// zymlump_t lump_texcoords; // float texcoords[numvertices][2];
loadmodel->zymdata_texcoords = outtexcoord = Mem_Alloc(loadmodel->mempool, pheader->numverts * sizeof(float[4]));
}
{
- unsigned int i, count, a, b, c, *renderlist, *renderlistend, *outrenderlist;
+ int i, count, a, b, c, *renderlist, *renderlistend, *outrenderlist;
// zymlump_t lump_render; // int renderlist[rendersize]; // sorted by shader with run lengths (int count), shaders are sequentially used, each run can be used with glDrawElements (each triangle is 3 int indices)
loadmodel->zymdata_renderlist = Mem_Alloc(loadmodel->mempool, pheader->lump_render.length);
// byteswap, validate, and swap winding order of tris
}
{
- unsigned int i;
+ int i;
char *shadername;
// zymlump_t lump_shaders; // char shadername[numshaders][32]; // shaders used on this model
shadername = (void *) (pheader->lump_shaders.start + pbase);
Image_Copy8bitRGBA(mtdata, basepixels, basepixels_width * basepixels_height, palette_nofullbrights);
if (!glowpixels)
{
- for (j = 0;j < tx->width*tx->height;j++)
+ for (j = 0;j < (int)(tx->width*tx->height);j++)
if (((qbyte *)&palette_onlyfullbrights[mtdata[j]])[3] > 0) // fullbright
break;
- if (j < tx->width * tx->height)
+ if (j < (int)(tx->width * tx->height))
{
glowpixels_width = tx->width;
glowpixels_height = tx->height;
// swap all the lumps
mod_base = (qbyte *)header;
- for (i=0 ; i<sizeof(dheader_t)/4 ; i++)
+ for (i = 0;i < (int) sizeof(dheader_t) / 4;i++)
((int *)header)[i] = LittleLong ( ((int *)header)[i]);
// load into heap
*/
static model_t *Mod_LoadModel (model_t *mod, qboolean crash, qboolean checkdisk, qboolean isworldmodel)
{
- int crc;
+ unsigned int crc;
void *buf;
mod->used = true;
{
int i;
for (i = 0;i < numtriangles * 3;i++)
- if ((unsigned int)elements[i] >= numverts)
+ if ((unsigned int)elements[i] >= (unsigned int)numverts)
Con_Printf("Mod_ValidateElements: out of bounds element detected at %s:%d\n", filename, fileline);
}
if (length == 0)
break;
- if (length == -1)
+ if ((int)length == -1)
{
Con_Printf("Read error\n");
return -1;
while (1)
{
len = dfunc.Read (testSocket, net_message.data, net_message.maxsize, &clientaddr);
- if (len < sizeof(int))
+ if (len < (int)sizeof(int))
break;
net_message.cursize = len;
MSG_ReadLong();
if (control == -1)
break;
- if ((control & (~NETFLAG_LENGTH_MASK)) != NETFLAG_CTL)
+ if ((control & (~NETFLAG_LENGTH_MASK)) != (int)NETFLAG_CTL)
break;
if ((control & NETFLAG_LENGTH_MASK) != len)
break;
name[0] = 0;
len = dfunc.Read (test2Socket, net_message.data, net_message.maxsize, &clientaddr);
- if (len < sizeof(int))
+ if (len < (int)sizeof(int))
goto Reschedule;
net_message.cursize = len;
MSG_ReadLong();
if (control == -1)
goto Error;
- if ((control & (~NETFLAG_LENGTH_MASK)) != NETFLAG_CTL)
+ if ((control & (~NETFLAG_LENGTH_MASK)) != (int)NETFLAG_CTL)
goto Error;
if ((control & NETFLAG_LENGTH_MASK) != len)
goto Error;
SZ_Clear(&net_message);
len = dfunc.Read (acceptsock, net_message.data, net_message.maxsize, &clientaddr);
- if (len < sizeof(int))
+ if (len < (int)sizeof(int))
return NULL;
net_message.cursize = len;
MSG_BeginReading ();
control = BigLong(*((int *)net_message.data));
MSG_ReadLong();
-
+
// Messages starting by 0xFFFFFFFF are master server messages
- if (control == 0xFFFFFFFF)
+ if ((unsigned int)control == 0xFFFFFFFF)
{
int responsesize = Master_HandleMessage();
if (responsesize > 0)
}
return NULL;
}
- if ((control & (~NETFLAG_LENGTH_MASK)) != NETFLAG_CTL)
+ if ((control & (~NETFLAG_LENGTH_MASK)) != (int)NETFLAG_CTL)
return NULL;
if ((control & NETFLAG_LENGTH_MASK) != len)
return NULL;
int control;
int c, n, i;
- if (net_message.cursize < sizeof(int))
+ if (net_message.cursize < (int)sizeof(int))
return false;
// don't answer our own query
MSG_ReadLong();
if (control == -1)
return false;
- if ((control & (~NETFLAG_LENGTH_MASK)) != NETFLAG_CTL)
+ if ((control & (~NETFLAG_LENGTH_MASK)) != (int)NETFLAG_CTL)
return false;
if ((control & NETFLAG_LENGTH_MASK) != net_message.cursize)
return false;
Con_DPrintf("Datagram_SearchForInetHosts: Recv received %d byte message\n", net_message.cursize);
Master_ParseServerList (&dfunc);
}
-
+
while ((ret = dfunc.Read (dfunc.controlSock, net_message.data, net_message.maxsize, &readaddr)) > 0)
{
net_message.cursize = ret;
if (_Datagram_SearchForInetHosts (master))
result = true;
}
-
+
return result;
}
continue;
}
- if (ret < sizeof(int))
+ if (ret < (int)sizeof(int))
{
ret = 0;
continue;
ret = 0;
continue;
}
- if ((control & (~NETFLAG_LENGTH_MASK)) != NETFLAG_CTL)
+ if ((control & (~NETFLAG_LENGTH_MASK)) != (int)NETFLAG_CTL)
{
ret = 0;
continue;
cvar_t* sv_master;
char request [256];
- if (nextmaster >= sizeof (sv_masters) / sizeof (sv_masters[0]))
+ if (nextmaster >= (int)(sizeof (sv_masters) / sizeof (sv_masters[0])))
{
nextmaster = 0;
return NULL;
{
static int nextmaster = 0;
cvar_t* sv_master;
-
- if (nextmaster >= sizeof (sv_masters) / sizeof (sv_masters[0]))
+
+ if (nextmaster >= (int)(sizeof (sv_masters) / sizeof (sv_masters[0])))
{
nextmaster = 0;
return NULL;
struct qsockaddr svaddr;
char ipstring [32];
- if (net_message.cursize < sizeof(int))
+ if (net_message.cursize < (int)sizeof(int))
return;
// is the cache full?
}
*(int *)d = G_INT(def->ofs);
break;
-
+
case ev_function:
func = ED_FindFunction (s);
if (!func)
pr_crc = CRC_Block((qbyte *)progs, com_filesize);
// byte swap the header
- for (i=0 ; i<sizeof(*progs)/4 ; i++)
+ for (i = 0;i < (int) sizeof(*progs) / 4;i++)
((int *)progs)[i] = LittleLong ( ((int *)progs)[i] );
if (progs->version != PROG_VERSION)
}
// append the darkplaces fields
- for (i = 0;i < DPFIELDS;i++)
+ for (i = 0;i < (int) DPFIELDS;i++)
{
pr_fielddefs[progs->numfielddefs].type = dpfields[i].type;
pr_fielddefs[progs->numfielddefs].ofs = progs->entityfields;
{
int n;
n = e - sv.edicts;
- if ((unsigned int)n >= sv.max_edicts)
+ if ((unsigned int)n >= (unsigned int)sv.max_edicts)
Host_Error("EDICT_TO_PROG: invalid edict %8p (number %i compared to world at %8p)\n", e, n, sv.edicts);
return n;// EXPERIMENTAL
//return (qbyte *)e->v - (qbyte *)sv.edictsfields;
}
edict_t *PROG_TO_EDICT(int n)
{
- if ((unsigned int)n >= sv.max_edicts)
+ if ((unsigned int)n >= (unsigned int)sv.max_edicts)
Host_Error("PROG_TO_EDICT: invalid edict number %i\n", n);
return sv.edictstable[n]; // EXPERIMENTAL
//return sv.edictstable[(n) / (progs->entityfields * 4)];
int localstack_used;
-qboolean pr_trace;
+int pr_trace;
dfunction_t *pr_xfunction;
int pr_xstatement;
case OP_ADDRESS:
pr_xstatement = st - pr_statements;
#if PRBOUNDSCHECK
- if ((unsigned int)OPB->_int >= progs->entityfields)
+ if ((unsigned int)(OPB->_int) >= (unsigned int)(progs->entityfields))
{
Host_Error("Progs attempted to address an invalid field (%i) in an edict\n", OPB->_int);
return;
case OP_LOAD_FNC:
pr_xstatement = st - pr_statements;
#if PRBOUNDSCHECK
- if ((unsigned int)OPB->_int >= progs->entityfields)
+ if ((unsigned int)(OPB->_int) >= (unsigned int)(progs->entityfields))
{
Host_Error("Progs attempted to read an invalid field in an edict (%i)\n", OPB->_int);
return;
extern int pr_argc;
-extern qboolean pr_trace;
+extern int pr_trace;
extern dfunction_t *pr_xfunction;
extern int pr_xstatement;
Qexpand_squiggle (path, e_path);
path = e_path;
- for (p = m; *mode && p - m < (sizeof (m) - 1); mode++) {
+ for (p = m; *mode && p - m < (int)(sizeof (m) - 1); mode++) {
if (*mode == 'z') {
zip = 1;
continue;
char m[80], *p;
int zip = 0;
- for (p = m; *mode && p - m < (sizeof (m) - 1); mode++) {
+ for (p = m; *mode && p - m < (int)(sizeof (m) - 1); mode++) {
if (*mode == 'z') {
zip = 1;
continue;
void S_TouchSound (char *name)
{
sfx_t *sfx;
-
+
if (!sound_started)
return;
// mix ahead of current position
endtime = soundtime + _snd_mixahead.value * shm->speed;
samps = shm->samples >> (shm->channels-1);
- if (endtime - soundtime > samps)
+ if (endtime > (unsigned int)(soundtime + samps))
endtime = soundtime + samps;
#ifdef _WIN32
out[i] = in[i];
//Con_Printf("S_RawSamples_Dequeue: normal %i\n", l);
}
- if (l < length)
+ if (l < (int)length)
{
memset(samples + l * 2, 0, (length - l) * sizeof(int[2]));
//Con_Printf("S_RawSamples_Dequeue: padding with %i samples\n", length - l);
shm->speed = atoi(com_argv[i+1]);
else
{
- for (i=0 ; i<sizeof(tryrates)/4 ; i++) {
+ for (i = 0;i < (int) sizeof(tryrates) / 4;i++)
if (!ioctl(audio_fd, SNDCTL_DSP_SPEED, &tryrates[i]))
break;
- }
shm->speed = tryrates[i];
}
{
lumpinfo_t *lump_p;
wadinfo_t *header;
- unsigned i;
+ int i;
int infotableofs;
void *temp;
{
lumpinfo_t *lumps, *lump_p;
wadinfo_t header;
- unsigned i, j;
+ int i, j;
int infotableofs;
QFile *file;
int numlumps;
if (!(lumps = Mem_Alloc(tempmempool, sizeof(lumpinfo_t)*numlumps)))
{Con_Printf ("W_LoadTextureWadFile: unable to allocate temporary memory for lump table");return;}
- if (Qread(file, lumps, sizeof(lumpinfo_t) * numlumps) != sizeof(lumpinfo_t) * numlumps)
+ if (Qread(file, lumps, sizeof(lumpinfo_t) * numlumps) != (int)sizeof(lumpinfo_t) * numlumps)
{Con_Printf ("W_LoadTextureWadFile: unable to read lump table");return;}
for (i=0, lump_p = lumps ; i<numlumps ; i++,lump_p++)
const char *filename;
int fileline;
// should always be MEMHEADER_SENTINEL1
- int sentinel1;
+ unsigned int sentinel1;
// immediately followed by data, which is followed by a MEMHEADER_SENTINEL2 byte
}
memheader_t;
// contents of the clump
qbyte block[MEMCLUMPSIZE];
// should always be MEMCLUMP_SENTINEL
- int sentinel1;
+ unsigned int sentinel1;
// if a bit is on, it means that the MEMUNIT bytes it represents are
// allocated, otherwise free
int bits[MEMBITINTS];
// should always be MEMCLUMP_SENTINEL
- int sentinel2;
+ unsigned int sentinel2;
// if this drops to 0, the clump is freed
int blocksinuse;
// largest block of memory available (this is reset to an optimistic
typedef struct mempool_s
{
// should always be MEMHEADER_SENTINEL1
- int sentinel1;
+ unsigned int sentinel1;
// chain of individual memory allocations
struct memheader_s *chain;
#if MEMCLUMPING
const char *filename;
int fileline;
// should always be MEMHEADER_SENTINEL1
- int sentinel2;
+ unsigned int sentinel2;
}
mempool_t;