if (cdfile == -1)
return;
- vol.channel0 = vol.channel1 = volume * 255;
+ vol.channel0 = vol.channel1 = (__u8)(volume * 255);
vol.channel2 = vol.channel3 = 0;
if (ioctl (cdfile, CDROMVOLCTRL, &vol) == -1)
MSG_WriteByte (&buf, impulse);
// PRYDON_CLIENTCURSOR
// 30 bytes
- MSG_WriteShort (&buf, cl.cmd.cursor_screen[0] * 32767.0f);
- MSG_WriteShort (&buf, cl.cmd.cursor_screen[1] * 32767.0f);
+ MSG_WriteShort (&buf, (short)(cl.cmd.cursor_screen[0] * 32767.0f));
+ MSG_WriteShort (&buf, (short)(cl.cmd.cursor_screen[1] * 32767.0f));
MSG_WriteFloat (&buf, cl.cmd.cursor_start[0]);
MSG_WriteFloat (&buf, cl.cmd.cursor_start[1]);
MSG_WriteFloat (&buf, cl.cmd.cursor_start[2]);
oldmaxentities = cl.max_csqcentities;
oldentities = cl.csqcentities;
cl.max_csqcentities = (num & ~255) + 256;
- cl.csqcentities = Mem_Alloc(cls.levelmempool, cl.max_csqcentities * sizeof(entity_t));
+ cl.csqcentities = (entity_t *)Mem_Alloc(cls.levelmempool, cl.max_csqcentities * sizeof(entity_t));
memcpy(cl.csqcentities, oldentities, oldmaxentities * sizeof(entity_t));
Mem_Free(oldentities);
for (i = oldmaxentities;i < cl.max_csqcentities;i++)
l = (i-1) % cl.lightstyle[j].length;
k = cl.lightstyle[j].map[k] - 'a';
l = cl.lightstyle[j].map[l] - 'a';
- r_refdef.lightstylevalue[j] = ((k*frac)+(l*(1-frac)))*22;
+ r_refdef.lightstylevalue[j] = (unsigned short)(((k*frac)+(l*(1-frac)))*22);
}
}
if (e->active)
{
frame = (cl.time - e->starttime) * e->framerate + e->startframe;
- intframe = frame;
+ intframe = (int)frame;
if (intframe < 0 || intframe >= e->endframe)
{
memset(e, 0, sizeof(*e));
while (cls.qw_downloadmemorymaxsize < cls.qw_downloadmemorycursize + size)
cls.qw_downloadmemorymaxsize *= 2;
old = cls.qw_downloadmemory;
- cls.qw_downloadmemory = Mem_Alloc(cls.permanentmempool, cls.qw_downloadmemorymaxsize);
+ cls.qw_downloadmemory = (unsigned char *)Mem_Alloc(cls.permanentmempool, cls.qw_downloadmemorymaxsize);
if (old)
{
memcpy(cls.qw_downloadmemory, old, cls.qw_downloadmemorycursize);
Con_DPrintf("Starting upload of %d bytes...\n", size);
- cls.qw_uploaddata = Mem_Alloc(cls.permanentmempool, size);
+ cls.qw_uploaddata = (unsigned char *)Mem_Alloc(cls.permanentmempool, size);
memcpy(cls.qw_uploaddata, data, size);
cls.qw_uploadsize = size;
cls.qw_uploadpos = 0;
colorStart = MSG_ReadByte(); // color
colorLength = MSG_ReadByte(); // gravity (1 or 0)
velspeed = MSG_ReadCoord(cls.protocol); // randomvel
- CL_ParticleCube(pos, pos2, dir, count, colorStart, colorLength, velspeed);
+ CL_ParticleCube(pos, pos2, dir, count, colorStart, colorLength != 0, velspeed);
break;
case TE_PARTICLERAIN:
float lightradiusfade;
float lighttime;
float lightcolor[3];
- float lightshadow;
- float lightcubemapnum;
+ qboolean lightshadow;
+ int lightcubemapnum;
}
particleeffectinfo_t;
}
}
-void CL_ParticleCube (const vec3_t mins, const vec3_t maxs, const vec3_t dir, int count, int colorbase, int gravity, int randomvel)
+void CL_ParticleCube (const vec3_t mins, const vec3_t maxs, const vec3_t dir, int count, int colorbase, vec_t gravity, vec_t randomvel)
{
int k;
if (!cl_particles.integer) return;
- count *= cl_particles_quality.value;
+ count = (int)(count * cl_particles_quality.value);
while (count--)
{
k = particlepalette[colorbase + (rand()&3)];
- particle(particletype + pt_alphastatic, k, k, tex_particle, 2, 255, 128, gravity ? 1 : 0, 0, lhrandom(mins[0], maxs[0]), lhrandom(mins[1], maxs[1]), lhrandom(mins[2], maxs[2]), dir[0], dir[1], dir[2], 0, 0, randomvel);
+ particle(particletype + pt_alphastatic, k, k, tex_particle, 2, 255, 128, gravity, 0, lhrandom(mins[0], maxs[0]), lhrandom(mins[1], maxs[1]), lhrandom(mins[2], maxs[2]), dir[0], dir[1], dir[2], 0, 0, randomvel);
}
}
minz = bound(mins[2], minz, maxs[2]);
maxz = bound(mins[2], maxz, maxs[2]);
- count *= cl_particles_quality.value;
+ count = (int)(count * cl_particles_quality.value);
switch(type)
{
VectorCopy(trace.plane.normal, p->vel);
VectorAdd(p->org, p->vel, p->org);
if (cl_stainmaps.integer)
- R_Stain(p->org, 32, 32, 16, 16, p->alpha * p->size * (1.0f / 40.0f), 192, 48, 48, p->alpha * p->size * (1.0f / 40.0f));
+ R_Stain(p->org, 32, 32, 16, 16, (int)(p->alpha * p->size * (1.0f / 40.0f)), 192, 48, 48, (int)(p->alpha * p->size * (1.0f / 40.0f)));
p->type = particletype + pt_decal;
p->texnum = tex_blooddecal[rand()&7];
p->type = NULL;
break;
case pt_raindecal:
- a = max(0, (cl.time - p->time2) * 40);
+ a = (int)max(0, (cl.time - p->time2) * 40);
if (a < 16)
p->texnum = tex_rainsplash[a];
else
if (f > 0)
{
d = data + (y * PARTICLETEXTURESIZE + x) * 4;
- d[0] += f * (red - d[0]);
- d[1] += f * (green - d[1]);
- d[2] += f * (blue - d[2]);
+ d[0] += (int)(f * (red - d[0]));
+ d[1] += (int)(f * (green - d[1]));
+ d[2] += (int)(f * (blue - d[2]));
}
}
}
dx = (x - 0.5f*PARTICLETEXTURESIZE) / (PARTICLETEXTURESIZE*0.5f-1);
d = (noise2[y][x] - 128) * 3 + 192;
if (d > 0)
- d = d * (1-(dx*dx+dy*dy));
+ d = (int)(d * (1-(dx*dx+dy*dy)));
d = (d * noise1[y][x]) >> 7;
d = bound(0, d, 255);
data[y][x][3] = (unsigned char) d;
for (x = 0;x < PARTICLETEXTURESIZE;x++)
{
dx = (x - 0.5f*PARTICLETEXTURESIZE) / (PARTICLETEXTURESIZE*0.5f-1);
- d = 256 * (1 - (dx*dx+dy*dy));
+ d = (int)(256 * (1 - (dx*dx+dy*dy)));
d = bound(0, d, 255);
data[y][x][3] = (unsigned char) d;
}
for (x = 0;x < 16;x++)
{
dx = (x - 0.5f*16) / (16*0.5f-2);
- d = (1 - sqrt(fabs(dx))) * noise3[y][x];
+ d = (int)((1 - sqrt(fabs(dx))) * noise3[y][x]);
data2[y][x][0] = data2[y][x][1] = data2[y][x][2] = (unsigned char) bound(0, d, 255);
data2[y][x][3] = 255;
}
// the finale prints the characters one at a time
if (cl.intermission)
- remaining = scr_printspeed.value * (cl.time - scr_centertime_start);
+ remaining = (int)(scr_printspeed.value * (cl.time - scr_centertime_start));
else
remaining = 9999;
return;
if (scr_center_lines <= 4)
- y = vid_conheight.integer*0.35;
+ y = (int)(vid_conheight.integer*0.35);
else
y = 48;
Con_DrawConsole (vid_conheight.integer);
}
else if (scr_con_current)
- Con_DrawConsole (scr_con_current);
+ Con_DrawConsole ((int)scr_con_current);
else
{
con_vislines = 0;
if (cls.capturevideo_soundfile)
{
// preserve sound sync by duplicating frames when running slow
- newframenum = (Sys_DoubleTime() - cls.capturevideo_starttime) * cls.capturevideo_framerate;
+ newframenum = (int)((Sys_DoubleTime() - cls.capturevideo_starttime) * cls.capturevideo_framerate);
}
else
newframenum = cls.capturevideo_frame + 1;
if (r_stereo_sidebyside.integer)
{
- r_refdef.width = vid.width * size / 2.5;
- r_refdef.height = vid.height * size / 2.5 * (1 - bound(0, r_letterbox.value, 100) / 100);
- r_refdef.x = (vid.width - r_refdef.width * 2.5) * 0.5;
- r_refdef.y = (vid.height - r_refdef.height)/2;
+ r_refdef.width = (int)(vid.width * size / 2.5);
+ r_refdef.height = (int)(vid.height * size / 2.5 * (1 - bound(0, r_letterbox.value, 100) / 100));
+ r_refdef.x = (int)((vid.width - r_refdef.width * 2.5) * 0.5);
+ r_refdef.y = (int)((vid.height - r_refdef.height)/2);
if (r_stereo_side)
- r_refdef.x += r_refdef.width * 1.5;
+ r_refdef.x += (int)(r_refdef.width * 1.5);
}
else
{
- r_refdef.width = vid.width * size;
- r_refdef.height = vid.height * size * (1 - bound(0, r_letterbox.value, 100) / 100);
- r_refdef.x = (vid.width - r_refdef.width)/2;
- r_refdef.y = (vid.height - r_refdef.height)/2;
+ r_refdef.width = (int)(vid.width * size);
+ r_refdef.height = (int)(vid.height * size * (1 - bound(0, r_letterbox.value, 100) / 100));
+ r_refdef.x = (int)((vid.width - r_refdef.width)/2);
+ r_refdef.y = (int)((vid.height - r_refdef.height)/2);
}
// LordHavoc: viewzoom (zoom in for sniper rifles, etc)
{
float sizex = bound(10, scr_zoomwindow_viewsizex.value, 100) / 100.0;
float sizey = bound(10, scr_zoomwindow_viewsizey.value, 100) / 100.0;
- r_refdef.width = vid.width * sizex;
- r_refdef.height = vid.height * sizey;
- r_refdef.x = (vid.width - r_refdef.width)/2;
+ r_refdef.width = (int)(vid.width * sizex);
+ r_refdef.height = (int)(vid.height * sizey);
+ r_refdef.x = (int)((vid.width - r_refdef.width)/2);
r_refdef.y = 0;
r_refdef.frustum_y = tan(scr_zoomwindow_fov.value * cl.viewzoom * M_PI / 360.0) * (3.0/4.0);
if( video->state == CLVIDEO_FIRSTFRAME )
destframe = 0;
else
- destframe = (realtime - video->starttime) * video->framerate;
+ destframe = (int)((realtime - video->starttime) * video->framerate);
if( destframe < 0 )
destframe = 0;
if( video->framenum < destframe ) {
// don't change view angle, full screen, etc
int intermission;
// latched at intermission start
- int completed_time;
+ double completed_time;
// the timestamp of the last two messages
double mtime[2];
const char *CL_ParticleEffectNameForIndex(int i);
void CL_ParticleEffect(int effectindex, float pcount, const vec3_t originmins, const vec3_t originmaxs, const vec3_t velocitymins, const vec3_t velocitymaxs, entity_t *ent, int palettecolor);
void CL_ParseParticleEffect (void);
-void CL_ParticleCube (const vec3_t mins, const vec3_t maxs, const vec3_t dir, int count, int colorbase, int gravity, int randomvel);
+void CL_ParticleCube (const vec3_t mins, const vec3_t maxs, const vec3_t dir, int count, int colorbase, vec_t gravity, vec_t randomvel);
void CL_ParticleRain (const vec3_t mins, const vec3_t maxs, const vec3_t dir, int count, int colorbase, int type);
void CL_EntityParticles (const entity_t *ent);
void CL_ParticleExplosion (const vec3_t org);
VM_SAFEPARMCOUNT(5, VM_CL_sound);
entity = PRVM_G_EDICT(OFS_PARM0);
- channel = PRVM_G_FLOAT(OFS_PARM1);
+ channel = (int)PRVM_G_FLOAT(OFS_PARM1);
sample = PRVM_G_STRING(OFS_PARM2);
- volume = PRVM_G_FLOAT(OFS_PARM3)*255;
+ volume = (int)(PRVM_G_FLOAT(OFS_PARM3)*255.0f);
attenuation = PRVM_G_FLOAT(OFS_PARM4);
if (volume < 0 || volume > 255)
VM_SAFEPARMCOUNT(2, VM_CL_lightstyle);
- i = PRVM_G_FLOAT(OFS_PARM0);
+ i = (int)PRVM_G_FLOAT(OFS_PARM0);
c = PRVM_G_STRING(OFS_PARM1);
if (i >= cl.max_lightstyle)
PF_WARNING("VM_CL_lightstyle >= MAX_LIGHTSTYLES\n");
org = PRVM_G_VECTOR(OFS_PARM0);
dir = PRVM_G_VECTOR(OFS_PARM1);
- color = PRVM_G_FLOAT(OFS_PARM2);
- count = PRVM_G_FLOAT(OFS_PARM3);
+ color = (int)PRVM_G_FLOAT(OFS_PARM2);
+ count = (int)PRVM_G_FLOAT(OFS_PARM3);
CL_ParticleEffect(EFFECT_SVC_PARTICLE, count, org, org, dir, dir, NULL, color);
}
void VM_R_AddEntities (void)
{
VM_SAFEPARMCOUNT(1, VM_R_AddEntities);
- csqc_drawmask = PRVM_G_FLOAT(OFS_PARM0);
+ csqc_drawmask = (int)PRVM_G_FLOAT(OFS_PARM0);
}
//#302 void(entity ent) addentity (EXT_CSQC)
if(prog->argc < 2)
VM_SAFEPARMCOUNT(2, VM_R_SetView);
- c = PRVM_G_FLOAT(OFS_PARM0);
+ c = (int)PRVM_G_FLOAT(OFS_PARM0);
f = PRVM_G_VECTOR(OFS_PARM1);
k = PRVM_G_FLOAT(OFS_PARM1);
switch(c)
{
- case VF_MIN: r_refdef.x = f[0];
- r_refdef.y = f[1];
+ case VF_MIN: r_refdef.x = (int)f[0];
+ r_refdef.y = (int)f[1];
break;
- case VF_MIN_X: r_refdef.x = k;
+ case VF_MIN_X: r_refdef.x = (int)k;
break;
- case VF_MIN_Y: r_refdef.y = k;
+ case VF_MIN_Y: r_refdef.y = (int)k;
break;
- case VF_SIZE: r_refdef.width = f[0];
- r_refdef.height = f[1];
+ case VF_SIZE: r_refdef.width = (int)f[0];
+ r_refdef.height = (int)f[1];
break;
- case VF_SIZE_Y: r_refdef.width = k;
+ case VF_SIZE_Y: r_refdef.width = (int)k;
break;
- case VF_SIZE_X: r_refdef.height = k;
+ case VF_SIZE_X: r_refdef.height = (int)k;
break;
- case VF_VIEWPORT: r_refdef.x = f[0];
- r_refdef.y = f[1];
+ case VF_VIEWPORT: r_refdef.x = (int)f[0];
+ r_refdef.y = (int)f[1];
f = PRVM_G_VECTOR(OFS_PARM2);
- r_refdef.width = f[0];
- r_refdef.height = f[1];
+ r_refdef.width = (int)f[0];
+ r_refdef.height = (int)f[1];
break;
case VF_FOV: //r_refdef.fov_x = f[0]; // FIXME!
//r_refdef.fov_y = f[1]; // FIXME!
int l;
}dat;
VM_SAFEPARMCOUNT(1, VM_CL_getstatf);
- i = PRVM_G_FLOAT(OFS_PARM0);
+ i = (int)PRVM_G_FLOAT(OFS_PARM0);
if(i < 0 || i >= MAX_CL_STATS)
{
Con_Printf("VM_CL_getstatf: index>=MAX_CL_STATS or index<0\n");
{
int i, index;
VM_SAFEPARMCOUNT(1, VM_CL_getstati);
- index = PRVM_G_FLOAT(OFS_PARM0);
+ index = (int)PRVM_G_FLOAT(OFS_PARM0);
if(index < 0 || index >= MAX_CL_STATS)
{
int i;
char *t;
VM_SAFEPARMCOUNT(1, VM_CL_getstats);
- i = PRVM_G_FLOAT(OFS_PARM0);
+ i = (int)PRVM_G_FLOAT(OFS_PARM0);
if(i < 0 || i > MAX_CL_STATS-4)
{
Con_Printf("VM_CL_getstats: index>MAX_CL_STATS-4 or index<0\n");
VM_SAFEPARMCOUNT(1, VM_CL_modelnameforindex);
PRVM_G_INT(OFS_RETURN) = 0;
- i = PRVM_G_FLOAT(OFS_PARM0);
+ i = (int)PRVM_G_FLOAT(OFS_PARM0);
if(i<0)
{
i = -(i+1);
t = PRVM_G_EDICT(OFS_PARM0);
entnum = PRVM_NUM_FOR_EDICT(t);
- i = PRVM_G_FLOAT(OFS_PARM1);
+ i = (int)PRVM_G_FLOAT(OFS_PARM1);
start = PRVM_G_VECTOR(OFS_PARM2);
end = PRVM_G_VECTOR(OFS_PARM3);
if (entnum >= cl.max_csqcentities)
CL_ExpandCSQCEntities(entnum);
- CL_ParticleEffect(i, VectorDistance(start, end), start, end, t->fields.client->velocity, t->fields.client->velocity, &cl.csqcentities[entnum], PRVM_G_FLOAT(OFS_PARM4));
+ CL_ParticleEffect(i, VectorDistance(start, end), start, end, t->fields.client->velocity, t->fields.client->velocity, &cl.csqcentities[entnum], (int)PRVM_G_FLOAT(OFS_PARM4));
}
//#337 void(float effectnum, vector origin, vector dir, float count) pointparticles (EXT_CSQC)
int i, n;
float *f, *v;
VM_SAFEPARMCOUNT(4, VM_CL_pointparticles);
- i = PRVM_G_FLOAT(OFS_PARM0);
+ i = (int)PRVM_G_FLOAT(OFS_PARM0);
f = PRVM_G_VECTOR(OFS_PARM1);
v = PRVM_G_VECTOR(OFS_PARM2);
- n = PRVM_G_FLOAT(OFS_PARM3);
+ n = (int)PRVM_G_FLOAT(OFS_PARM3);
CL_ParticleEffect(i, n, f, f, v, v, NULL, 0);
}
int i;
VM_SAFEPARMCOUNT(1, VM_CL_getkeybind);
- i = PRVM_G_FLOAT(OFS_PARM0);
+ i = (int)PRVM_G_FLOAT(OFS_PARM0);
PRVM_G_INT(OFS_RETURN) = PRVM_SetEngineString(Key_GetBind(i));
}
{
int i, frame;
VM_SAFEPARMCOUNT(1, VM_CL_getinputstate);
- frame = PRVM_G_FLOAT(OFS_PARM0);
+ frame = (int)PRVM_G_FLOAT(OFS_PARM0);
for (i = 0;i < cl.movement_numqueue;i++)
if (cl.movement_queue[i].sequence == frame)
{
VM_SAFEPARMCOUNT(2, VM_CL_getplayerkey);
- i = PRVM_G_FLOAT(OFS_PARM0);
+ i = (int)PRVM_G_FLOAT(OFS_PARM0);
c = PRVM_G_STRING(OFS_PARM1);
PRVM_G_INT(OFS_RETURN) = OFS_NULL;
Sbar_SortFrags();
VM_SAFEPARMCOUNT(1, VM_CL_registercmd);
if(!Cmd_Exists(PRVM_G_STRING(OFS_PARM0)))
{
- t = Z_Malloc(strlen(PRVM_G_STRING(OFS_PARM0))+1);
+ t = (char *)Z_Malloc(strlen(PRVM_G_STRING(OFS_PARM0))+1);
strcpy(t, PRVM_G_STRING(OFS_PARM0));
Cmd_AddCommand(t, NULL, "console command created by QuakeC");
}
void VM_CL_effect (void)
{
VM_SAFEPARMCOUNT(5, VM_CL_effect);
- CL_Effect(PRVM_G_VECTOR(OFS_PARM0), PRVM_G_FLOAT(OFS_PARM1), PRVM_G_FLOAT(OFS_PARM2), PRVM_G_FLOAT(OFS_PARM3), PRVM_G_FLOAT(OFS_PARM4));
+ CL_Effect(PRVM_G_VECTOR(OFS_PARM0), (int)PRVM_G_FLOAT(OFS_PARM1), (int)PRVM_G_FLOAT(OFS_PARM2), (int)PRVM_G_FLOAT(OFS_PARM3), PRVM_G_FLOAT(OFS_PARM4));
}
// #405 void(vector org, vector velocity, float howmany) te_blood (DP_TE_BLOOD)
void VM_CL_te_particlecube (void)
{
VM_SAFEPARMCOUNT(7, VM_CL_te_particlecube);
- CL_ParticleCube(PRVM_G_VECTOR(OFS_PARM0), PRVM_G_VECTOR(OFS_PARM1), PRVM_G_VECTOR(OFS_PARM2), PRVM_G_FLOAT(OFS_PARM3), PRVM_G_FLOAT(OFS_PARM4), PRVM_G_FLOAT(OFS_PARM5), PRVM_G_FLOAT(OFS_PARM6));
+ CL_ParticleCube(PRVM_G_VECTOR(OFS_PARM0), PRVM_G_VECTOR(OFS_PARM1), PRVM_G_VECTOR(OFS_PARM2), (int)PRVM_G_FLOAT(OFS_PARM3), (int)PRVM_G_FLOAT(OFS_PARM4), PRVM_G_FLOAT(OFS_PARM5), PRVM_G_FLOAT(OFS_PARM6));
}
// #409 void(vector mincorner, vector maxcorner, vector vel, float howmany, float color) te_particlerain (DP_TE_PARTICLERAIN)
void VM_CL_te_particlerain (void)
{
VM_SAFEPARMCOUNT(5, VM_CL_te_particlerain);
- CL_ParticleRain(PRVM_G_VECTOR(OFS_PARM0), PRVM_G_VECTOR(OFS_PARM1), PRVM_G_VECTOR(OFS_PARM2), PRVM_G_FLOAT(OFS_PARM3), PRVM_G_FLOAT(OFS_PARM4), 0);
+ CL_ParticleRain(PRVM_G_VECTOR(OFS_PARM0), PRVM_G_VECTOR(OFS_PARM1), PRVM_G_VECTOR(OFS_PARM2), (int)PRVM_G_FLOAT(OFS_PARM3), (int)PRVM_G_FLOAT(OFS_PARM4), 0);
}
// #410 void(vector mincorner, vector maxcorner, vector vel, float howmany, float color) te_particlesnow (DP_TE_PARTICLESNOW)
void VM_CL_te_particlesnow (void)
{
VM_SAFEPARMCOUNT(5, VM_CL_te_particlesnow);
- CL_ParticleRain(PRVM_G_VECTOR(OFS_PARM0), PRVM_G_VECTOR(OFS_PARM1), PRVM_G_VECTOR(OFS_PARM2), PRVM_G_FLOAT(OFS_PARM3), PRVM_G_FLOAT(OFS_PARM4), 1);
+ CL_ParticleRain(PRVM_G_VECTOR(OFS_PARM0), PRVM_G_VECTOR(OFS_PARM1), PRVM_G_VECTOR(OFS_PARM2), (int)PRVM_G_FLOAT(OFS_PARM3), (int)PRVM_G_FLOAT(OFS_PARM4), 1);
}
// #411 void(vector org, vector vel, float howmany) te_spark
VM_SAFEPARMCOUNT(3, VM_CL_te_explosion2);
pos = PRVM_G_VECTOR(OFS_PARM0);
- colorStart = PRVM_G_FLOAT(OFS_PARM1);
- colorLength = PRVM_G_FLOAT(OFS_PARM2);
+ colorStart = (int)PRVM_G_FLOAT(OFS_PARM1);
+ colorLength = (int)PRVM_G_FLOAT(OFS_PARM2);
CL_FindNonSolidLocation(pos, pos2, 10);
CL_ParticleExplosion2(pos2, colorStart, colorLength);
tempcolor = (unsigned char *)&palette_complete[(rand()%colorLength) + colorStart];
//====================================================================
//DP_QC_GETSURFACE
-void clippointtosurface(msurface_t *surface, vec3_t p, vec3_t out);
+extern void clippointtosurface(model_t *model, msurface_t *surface, vec3_t p, vec3_t out);
static model_t *cl_getmodel(prvm_edict_t *ed)
{
int modelindex;
model_t *model = NULL;
if (!ed || ed->priv.server->free)
return NULL;
- modelindex = ed->fields.client->modelindex;
+ modelindex = (int)ed->fields.client->modelindex;
if(!modelindex)
return NULL;
if(modelindex<0)
model_t *model = cl_getmodel(PRVM_G_EDICT(OFS_PARM0));
msurface_t *surface;
// return 0 if no such surface
- if (!model || !(surface = cl_getsurface(model, PRVM_G_FLOAT(OFS_PARM1))))
+ if (!model || !(surface = cl_getsurface(model, (int)PRVM_G_FLOAT(OFS_PARM1))))
{
PRVM_G_FLOAT(OFS_RETURN) = 0;
return;
int pointnum;
VectorClear(PRVM_G_VECTOR(OFS_RETURN));
ed = PRVM_G_EDICT(OFS_PARM0);
- if (!(model = cl_getmodel(ed)) || !(surface = cl_getsurface(model, PRVM_G_FLOAT(OFS_PARM1))))
+ if (!(model = cl_getmodel(ed)) || !(surface = cl_getsurface(model, (int)PRVM_G_FLOAT(OFS_PARM1))))
return;
// note: this (incorrectly) assumes it is a simple polygon
- pointnum = PRVM_G_FLOAT(OFS_PARM2);
+ pointnum = (int)PRVM_G_FLOAT(OFS_PARM2);
if (pointnum < 0 || pointnum >= surface->num_vertices)
return;
// FIXME: implement rotation/scaling
msurface_t *surface;
vec3_t normal;
VectorClear(PRVM_G_VECTOR(OFS_RETURN));
- if (!(model = cl_getmodel(PRVM_G_EDICT(OFS_PARM0))) || !(surface = cl_getsurface(model, PRVM_G_FLOAT(OFS_PARM1))))
+ if (!(model = cl_getmodel(PRVM_G_EDICT(OFS_PARM0))) || !(surface = cl_getsurface(model, (int)PRVM_G_FLOAT(OFS_PARM1))))
return;
// FIXME: implement rotation/scaling
// note: this (incorrectly) assumes it is a simple polygon
model_t *model;
msurface_t *surface;
PRVM_G_INT(OFS_RETURN) = 0;
- if (!(model = cl_getmodel(PRVM_G_EDICT(OFS_PARM0))) || !(surface = cl_getsurface(model, PRVM_G_FLOAT(OFS_PARM1))))
+ if (!(model = cl_getmodel(PRVM_G_EDICT(OFS_PARM0))) || !(surface = cl_getsurface(model, (int)PRVM_G_FLOAT(OFS_PARM1))))
return;
PRVM_G_INT(OFS_RETURN) = PRVM_SetEngineString(surface->texture->name);
}
if (dist < bestdist)
{
// it is, check the nearest point on the actual geometry
- clippointtosurface(surface, p, clipped);
+ clippointtosurface(model, surface, p, clipped);
VectorSubtract(clipped, p, clipped);
dist += VectorLength2(clipped);
if (dist < bestdist)
vec3_t p, out;
VectorClear(PRVM_G_VECTOR(OFS_RETURN));
ed = PRVM_G_EDICT(OFS_PARM0);
- if (!(model = cl_getmodel(ed)) || !(surface = cl_getsurface(model, PRVM_G_FLOAT(OFS_PARM1))))
+ if (!(model = cl_getmodel(ed)) || !(surface = cl_getsurface(model, (int)PRVM_G_FLOAT(OFS_PARM1))))
return;
// FIXME: implement rotation/scaling
VectorSubtract(PRVM_G_VECTOR(OFS_PARM2), ed->fields.client->origin, p);
- clippointtosurface(surface, p, out);
+ clippointtosurface(model, surface, p, out);
// FIXME: implement rotation/scaling
VectorAdd(out, ed->fields.client->origin, PRVM_G_VECTOR(OFS_RETURN));
}
if (model)
{
- v->_float = Mod_Alias_GetTagIndexForName(model, tagentity->fields.client->skin, tagname);
+ v->_float = Mod_Alias_GetTagIndexForName(model, (int)tagentity->fields.client->skin, tagname);
if (v->_float == 0)
Con_DPrintf("setattachment(edict %i, edict %i, string \"%s\"): tried to find tag named \"%s\" on entity %i (model \"%s\") but could not find it\n", PRVM_NUM_FOR_EDICT(e), PRVM_NUM_FOR_EDICT(tagentity), tagname, tagname, PRVM_NUM_FOR_EDICT(tagentity), model->name);
}
int i;
model_t *m;
- i = e->fields.client->modelindex;
+ i = (int)e->fields.client->modelindex;
if(!i)
return -1;
else
m = cl.model_precache[i];
- return Mod_Alias_GetTagIndexForName(m, e->fields.client->skin, tagname);
+ return Mod_Alias_GetTagIndexForName(m, (int)e->fields.client->skin, tagname);
};
// Warnings/errors code:
val = PRVM_GETEDICTFIELDVALUE(ent, csqc_fieldoff_tag_index);
model = NULL;
- i = attachent->fields.client->modelindex;
+ i = (int)attachent->fields.client->modelindex;
if(i<0)
{
i = -(i+1);
model = cl.model_precache[i];
if (model && val->_float >= 1 && model->animscenes && attachent->fields.client->frame >= 0 && attachent->fields.client->frame < model->numframes)
- Mod_Alias_GetTagMatrix(model, model->animscenes[(int)attachent->fields.client->frame].firstframe, val->_float - 1, &attachmatrix);
+ Mod_Alias_GetTagMatrix(model, model->animscenes[(int)attachent->fields.client->frame].firstframe, (int)val->_float - 1, &attachmatrix);
else
attachmatrix = identitymatrix;
v1 = PRVM_G_VECTOR(OFS_PARM0);
v2 = PRVM_G_VECTOR(OFS_PARM1);
- ignore = PRVM_G_FLOAT(OFS_PARM2);
- csqcents = PRVM_G_FLOAT(OFS_PARM3);
+ ignore = (int)PRVM_G_FLOAT(OFS_PARM2);
+ csqcents = (int)PRVM_G_FLOAT(OFS_PARM3);
ent = 0;
if((csqcents && ignore > cl.num_csqcentities) || (!csqcents && ignore > cl.num_entities))
return false;
if (t->numfilenames > 1)
Con_Printf("^1 %i maps found :\n", t->numfilenames);
- len = Z_Malloc(t->numfilenames);
+ len = (unsigned char *)Z_Malloc(t->numfilenames);
min = 666;
for(max=i=0;i<t->numfilenames;i++)
{
if (!entities && lumplen >= 10)
{
FS_Seek(f, lumpofs, SEEK_SET);
- entities = Z_Malloc(lumplen + 1);
+ entities = (char *)Z_Malloc(lumplen + 1);
FS_Read(f, entities, lumplen);
}
if (entities)
if(CSQC_Parse_Print)
{
- csqc_printtextbuf = Mem_Alloc(csqc_mempool, CSQC_PRINTBUFFERLEN);
+ csqc_printtextbuf = (char *)Mem_Alloc(csqc_mempool, CSQC_PRINTBUFFERLEN);
csqc_printtextbuf[0] = 0;
}
}
int i;
prvm_eval_t *val;
- i = ed->fields.client->modelindex;
+ i = (int)ed->fields.client->modelindex;
e->state_current.modelindex = 0;
if(i >= MAX_MODELS || i <= -MAX_MODELS) //[515]: make work as error ?
{
i = 0;
if((val = PRVM_GETEDICTFIELDVALUE(ed, csqc_fieldoff_renderflags)) && val->_float)
{
- i = val->_float;
+ i = (int)val->_float;
if(i & RF_VIEWMODEL) e->state_current.flags |= RENDER_VIEWMODEL;
if(i & RF_EXTERNALMODEL)e->state_current.flags |= RENDER_EXTERIORMODEL;
if(i & RF_DEPTHHACK) e->state_current.effects |= EF_NODEPTHTEST;
VectorCopy(ed->fields.client->origin, e->persistent.neworigin);
VectorCopy(ed->fields.client->origin, e->state_current.origin);
- e->state_current.colormap = ed->fields.client->colormap;
- e->state_current.effects = ed->fields.client->effects;
- e->state_current.frame = ed->fields.client->frame;
- e->state_current.skin = ed->fields.client->skin;
-
- if((val = PRVM_GETEDICTFIELDVALUE(ed, csqc_fieldoff_alpha)) && val->_float) e->state_current.alpha = val->_float*255;
- if((val = PRVM_GETEDICTFIELDVALUE(ed, csqc_fieldoff_scale)) && val->_float) e->state_current.scale = val->_float*16;
- if((val = PRVM_GETEDICTFIELDVALUE(ed, csqc_fieldoff_colormod)) && VectorLength2(val->vector)) VectorScale(val->vector, 32, e->state_current.colormod);
- if((val = PRVM_GETEDICTFIELDVALUE(ed, csqc_fieldoff_effects)) && val->_float) e->state_current.effects = val->_float;
+ e->state_current.colormap = (int)ed->fields.client->colormap;
+ e->state_current.effects = (int)ed->fields.client->effects;
+ e->state_current.frame = (int)ed->fields.client->frame;
+ e->state_current.skin = (int)ed->fields.client->skin;
+
+ if((val = PRVM_GETEDICTFIELDVALUE(ed, csqc_fieldoff_alpha)) && val->_float) e->state_current.alpha = (int)(val->_float*255);
+ if((val = PRVM_GETEDICTFIELDVALUE(ed, csqc_fieldoff_scale)) && val->_float) e->state_current.scale = (int)(val->_float*16);
+ if((val = PRVM_GETEDICTFIELDVALUE(ed, csqc_fieldoff_colormod)) && VectorLength2(val->vector)) {int j;for (j = 0;j < 3;j++) e->state_current.colormod[j] = (unsigned char)bound(0, val->vector[j] * 32.0f, 255);}
+ if((val = PRVM_GETEDICTFIELDVALUE(ed, csqc_fieldoff_effects)) && val->_float) e->state_current.effects = (int)val->_float;
if((val = PRVM_GETEDICTFIELDVALUE(ed, csqc_fieldoff_tag_entity)) && val->edict)
{
e->state_current.tagentity = val->edict;
if((val = PRVM_GETEDICTFIELDVALUE(ed, csqc_fieldoff_tag_index)) && val->_float)
- e->state_current.tagindex = val->_float;
+ e->state_current.tagindex = (int)val->_float;
}
return true;
PRVM_End;
csqc_loaded = true;
- csqc_sv2csqcents = Mem_Alloc(csqc_mempool, MAX_EDICTS*sizeof(unsigned short));
+ csqc_sv2csqcents = (unsigned short *)Mem_Alloc(csqc_mempool, MAX_EDICTS*sizeof(unsigned short));
memset(csqc_sv2csqcents, 0, MAX_EDICTS*sizeof(unsigned short));
cl.csqc_vidvars.drawcrosshair = false;
int arrayenabled;
unsigned int arraycomponents;
const void *pointer_texcoord;
- float rgbscale, alphascale;
+ int rgbscale, alphascale;
int combinergb, combinealpha;
// FIXME: add more combine stuff
// texmatrixenabled exists only to avoid unnecessary texmatrix compares
// We have to convert the con coords into real coords
// OGL uses top to bottom
- GL_Scissor(x * ((float)vid.width / vid_conwidth.integer), y * ((float) vid.height / vid_conheight.integer), width * ((float)vid.width / vid_conwidth.integer), height * ((float)vid.height / vid_conheight.integer));
+ GL_Scissor((int)(x * ((float)vid.width / vid_conwidth.integer)), (int)(y * ((float) vid.height / vid_conheight.integer)), (int)(width * ((float)vid.width / vid_conwidth.integer)), (int)(height * ((float)vid.height / vid_conheight.integer)));
GL_ScissorTest(true);
}
break;
}
intensity = 127.0f / sqrt(DotProduct(v, v));
- data[side][y][x][0] = 128.0f + intensity * v[0];
- data[side][y][x][1] = 128.0f + intensity * v[1];
- data[side][y][x][2] = 128.0f + intensity * v[2];
+ data[side][y][x][0] = (unsigned char)(128.0f + intensity * v[0]);
+ data[side][y][x][1] = (unsigned char)(128.0f + intensity * v[1]);
+ data[side][y][x][2] = (unsigned char)(128.0f + intensity * v[2]);
data[side][y][x][3] = 255;
}
}
if (rsurface_array_vertex3f)
Mem_Free(rsurface_array_vertex3f);
rsurface_array_size = (newvertices + 1023) & ~1023;
- rsurface_array_vertex3f = Mem_Alloc(r_main_mempool, rsurface_array_size * sizeof(float[19]));
+ rsurface_array_vertex3f = (float *)Mem_Alloc(r_main_mempool, rsurface_array_size * sizeof(float[19]));
rsurface_array_svector3f = rsurface_array_vertex3f + rsurface_array_size * 3;
rsurface_array_tvector3f = rsurface_array_vertex3f + rsurface_array_size * 6;
rsurface_array_normal3f = rsurface_array_vertex3f + rsurface_array_size * 9;
smax = (surface->lightmapinfo->extents[0] >> 4) + 1;
tmax = (surface->lightmapinfo->extents[1] >> 4) + 1;
- impacts = DotProduct (impact, surface->lightmapinfo->texinfo->vecs[0]) + surface->lightmapinfo->texinfo->vecs[0][3] - surface->lightmapinfo->texturemins[0];
- impactt = DotProduct (impact, surface->lightmapinfo->texinfo->vecs[1]) + surface->lightmapinfo->texinfo->vecs[1][3] - surface->lightmapinfo->texturemins[1];
+ impacts = (int)(DotProduct (impact, surface->lightmapinfo->texinfo->vecs[0]) + surface->lightmapinfo->texinfo->vecs[0][3] - surface->lightmapinfo->texturemins[0]);
+ impactt = (int)(DotProduct (impact, surface->lightmapinfo->texinfo->vecs[1]) + surface->lightmapinfo->texinfo->vecs[1][3] - surface->lightmapinfo->texturemins[1]);
s = bound(0, impacts, smax * 16) - impacts;
t = bound(0, impactt, tmax * 16) - impactt;
- i = s * s + t * t + dist2;
+ i = (int)(s * s + t * t + dist2);
if (i > maxdist)
continue;
if (host_speeds.integer)
{
- pass1 = (time1 - time3)*1000000;
+ pass1 = (int)((time1 - time3)*1000000);
time3 = Sys_DoubleTime();
- pass2 = (time2 - time1)*1000000;
- pass3 = (time3 - time2)*1000000;
+ pass2 = (int)((time2 - time1)*1000000);
+ pass3 = (int)((time3 - time2)*1000000);
Con_Printf("%6ius total %6ius server %6ius gfx %6ius snd\n",
pass1+pass2+pass3, pass1, pass2, pass3);
}
if (timecount < 1000)
return;
- m = timetotal*1000/timecount;
+ m = (int)(timetotal*1000/timecount);
timecount = 0;
timetotal = 0;
c = 0;
// send some stats
MSG_WriteByte (&host_client->netconnection->message, svc_updatestat);
MSG_WriteByte (&host_client->netconnection->message, STAT_TOTALSECRETS);
- MSG_WriteLong (&host_client->netconnection->message, prog->globals.server->total_secrets);
+ MSG_WriteLong (&host_client->netconnection->message, (int)prog->globals.server->total_secrets);
MSG_WriteByte (&host_client->netconnection->message, svc_updatestat);
MSG_WriteByte (&host_client->netconnection->message, STAT_TOTALMONSTERS);
- MSG_WriteLong (&host_client->netconnection->message, prog->globals.server->total_monsters);
+ MSG_WriteLong (&host_client->netconnection->message, (int)prog->globals.server->total_monsters);
MSG_WriteByte (&host_client->netconnection->message, svc_updatestat);
MSG_WriteByte (&host_client->netconnection->message, STAT_SECRETS);
- MSG_WriteLong (&host_client->netconnection->message, prog->globals.server->found_secrets);
+ MSG_WriteLong (&host_client->netconnection->message, (int)prog->globals.server->found_secrets);
MSG_WriteByte (&host_client->netconnection->message, svc_updatestat);
MSG_WriteByte (&host_client->netconnection->message, STAT_MONSTERS);
- MSG_WriteLong (&host_client->netconnection->message, prog->globals.server->killed_monsters);
+ MSG_WriteLong (&host_client->netconnection->message, (int)prog->globals.server->killed_monsters);
// send a fixangle
// Never send a roll angle, because savegames can catch the server
if (Cmd_Argc() > 2 && strcmp(Cmd_Argv(1), "#") == 0)
{
- i = atof(Cmd_Argv(2)) - 1;
+ i = (int)(atof(Cmd_Argv(2)) - 1);
if (i < 0 || i >= svs.maxclients || !(host_client = svs.clients + i)->active)
return;
byNumber = true;
if (e->fields.server->frame >= m->numframes)
e->fields.server->frame = m->numframes - 1;
- PrintFrameName (m, e->fields.server->frame);
+ PrintFrameName (m, (int)e->fields.server->frame);
}
/*
if (e->fields.server->frame < 0)
e->fields.server->frame = 0;
- PrintFrameName (m, e->fields.server->frame);
+ PrintFrameName (m, (int)e->fields.server->frame);
}
/*
n[2] = ibumpscale;
VectorNormalize(n);
*/
- out[0] = 128.0f + n[0] * 127.0f;
- out[1] = 128.0f + n[1] * 127.0f;
- out[2] = 128.0f + n[2] * 127.0f;
+ out[0] = (int)(128.0f + n[0] * 127.0f);
+ out[1] = (int)(128.0f + n[1] * 127.0f);
+ out[2] = (int)(128.0f + n[2] * 127.0f);
out[3] = (p0[0] + p0[1] + p0[2]) / 3;
out += 4;
}
#define PNG_INFO_tRNS 0x0010
// this struct is only used for status information during loading
-struct
+static struct
{
const unsigned char *tmpBuf;
int tmpBuflength;
if(qpng_sig_cmp(raw, 0, filesize))
return NULL;
- png = qpng_create_read_struct(PNG_LIBPNG_VER_STRING, 0, PNG_error_fn, PNG_warning_fn);
+ png = (void *)qpng_create_read_struct(PNG_LIBPNG_VER_STRING, 0, (void *)PNG_error_fn, (void *)PNG_warning_fn);
if(!png)
return NULL;
// NOTE: this relies on jmp_buf being the first thing in the png structure
// created by libpng! (this is correct for libpng 1.2.x)
+#ifdef __cplusplus
+ if (setjmp((__jmp_buf_tag *)png))
+#else
if (setjmp(png))
+#endif
{
qpng_destroy_read_struct(&png, &pnginfo, 0);
return NULL;
//my_png.Interlace = 0;
//my_png.Compression = 0;
//my_png.Filter = 0;
- qpng_set_read_fn(png, ioBuffer, PNG_fReadData);
+ qpng_set_read_fn(png, ioBuffer, (void *)PNG_fReadData);
qpng_read_info(png, pnginfo);
qpng_get_IHDR(png, pnginfo, &my_png.Width, &my_png.Height,&my_png.BitDepth, &my_png.ColorType, &my_png.Interlace, &my_png.Compression, &my_png.Filter);
if ((matchwidth && my_png.Width != (unsigned int)matchwidth) || (matchheight && my_png.Height != (unsigned int)matchheight))
my_png.FRowBytes = qpng_get_rowbytes(png, pnginfo);
my_png.BytesPerPixel = qpng_get_channels(png, pnginfo);
- my_png.FRowPtrs = Mem_Alloc(tempmempool, my_png.Height * sizeof(*my_png.FRowPtrs));
+ my_png.FRowPtrs = (unsigned char **)Mem_Alloc(tempmempool, my_png.Height * sizeof(*my_png.FRowPtrs));
if (my_png.FRowPtrs)
{
- my_png.Data = Mem_Alloc(tempmempool, my_png.Height * my_png.FRowBytes);
+ my_png.Data = (unsigned char *)Mem_Alloc(tempmempool, my_png.Height * my_png.FRowBytes);
if(my_png.Data)
{
for(y = 0;y < my_png.Height;y++)
cinfo.in_color_space = JCS_RGB;
cinfo.input_components = 3;
qjpeg_set_defaults (&cinfo);
- qjpeg_set_quality (&cinfo, scr_screenshot_jpeg_quality.value * 100, TRUE);
+ qjpeg_set_quality (&cinfo, (int)(scr_screenshot_jpeg_quality.value * 100), TRUE);
qjpeg_start_compress (&cinfo, true);
// Compress each scanline
strcat(key_lines[edit_line], cbd);
key_linepos += i;
}
- free(cbd);
+ Z_Free(cbd);
}
return;
}
optnum = 0;
optcursor = options_cursor;
- visible = (menu_height - 32) / 8;
+ visible = (int)((menu_height - 32) / 8);
opty = 32 - bound(0, optcursor - (visible >> 1), max(0, OPTIONS_ITEMS - visible)) * 8;
M_Options_PrintCommand( "Customize controls", true);
optcursor = options_effects_cursor;
optnum = 0;
- visible = (menu_height - 32) / 8;
+ visible = (int)((menu_height - 32) / 8);
opty = 32 - bound(0, optcursor - (visible >> 1), max(0, OPTIONS_EFFECTS_ITEMS - visible)) * 8;
M_Options_PrintSlider( " Corona Intensity", true, r_coronas.value, 0, 4);
optcursor = options_graphics_cursor;
optnum = 0;
- visible = (menu_height - 32) / 8;
+ visible = (int)((menu_height - 32) / 8);
opty = 32 - bound(0, optcursor - (visible >> 1), max(0, OPTIONS_GRAPHICS_ITEMS - visible)) * 8;
M_Options_PrintSlider( " Gloss Mode", true, r_shadow_gloss.integer, 0, 2);
optcursor = options_colorcontrol_cursor;
optnum = 0;
- visible = (menu_height - 32) / 8;
+ visible = (int)((menu_height - 32) / 8);
opty = 32 - bound(0, optcursor - (visible >> 1), max(0, OPTIONS_COLORCONTROL_ITEMS - visible)) * 8;
M_Options_PrintCommand( " Reset to defaults", true);
if (*m_return_reason)
M_Print(16, menu_height - 8, m_return_reason);
y = 48;
- visible = (menu_height - 16 - y) / 8 / 2;
+ visible = (int)((menu_height - 16 - y) / 8 / 2);
start = bound(0, slist_cursor - (visible >> 1), serverlist_viewcount - visible);
end = min(start + visible, serverlist_viewcount);
if (vertex3f)
Z_Free(vertex3f);
maxvertices = (model->surfmesh.num_vertices + 255) & ~255;
- vertex3f = Z_Malloc(maxvertices * sizeof(float[3]));
+ vertex3f = (float *)Z_Malloc(maxvertices * sizeof(float[3]));
}
if (VectorLength2(boxmins) + VectorLength2(boxmaxs) == 0)
{
if (vertex3f)
Z_Free(vertex3f);
maxvertices = (model->surfmesh.num_vertices + 255) & ~255;
- vertex3f = Z_Malloc(maxvertices * sizeof(float[3]));
+ vertex3f = (float *)Z_Malloc(maxvertices * sizeof(float[3]));
}
Mod_Alias_GetMesh_Vertex3f(model, frameblend, vertex3f);
Collision_TraceBrushTriangleMeshFloat(trace, thisbrush_start, thisbrush_end, model->surfmesh.num_triangles, model->surfmesh.data_element3i, vertex3f, SUPERCONTENTS_SOLID, 0, surface->texture, segmentmins, segmentmaxs);
static int Mod_Q1BSP_LightPoint_RecursiveBSPNode(model_t *model, vec3_t ambientcolor, vec3_t diffusecolor, vec3_t diffusenormal, const mnode_t *node, float x, float y, float startz, float endz)
{
- int side, distz = endz - startz;
+ int side;
float front, back;
- float mid;
+ float mid, distz = endz - startz;
loc0:
if (!node->plane)
loadmodel->brushq3.num_lightgrid_scale[0] = 1.0f / loadmodel->brushq3.num_lightgrid_cellsize[0];
loadmodel->brushq3.num_lightgrid_scale[1] = 1.0f / loadmodel->brushq3.num_lightgrid_cellsize[1];
loadmodel->brushq3.num_lightgrid_scale[2] = 1.0f / loadmodel->brushq3.num_lightgrid_cellsize[2];
- loadmodel->brushq3.num_lightgrid_imins[0] = ceil(loadmodel->brushq3.data_models->mins[0] * loadmodel->brushq3.num_lightgrid_scale[0]);
- loadmodel->brushq3.num_lightgrid_imins[1] = ceil(loadmodel->brushq3.data_models->mins[1] * loadmodel->brushq3.num_lightgrid_scale[1]);
- loadmodel->brushq3.num_lightgrid_imins[2] = ceil(loadmodel->brushq3.data_models->mins[2] * loadmodel->brushq3.num_lightgrid_scale[2]);
- loadmodel->brushq3.num_lightgrid_imaxs[0] = floor(loadmodel->brushq3.data_models->maxs[0] * loadmodel->brushq3.num_lightgrid_scale[0]);
- loadmodel->brushq3.num_lightgrid_imaxs[1] = floor(loadmodel->brushq3.data_models->maxs[1] * loadmodel->brushq3.num_lightgrid_scale[1]);
- loadmodel->brushq3.num_lightgrid_imaxs[2] = floor(loadmodel->brushq3.data_models->maxs[2] * loadmodel->brushq3.num_lightgrid_scale[2]);
+ loadmodel->brushq3.num_lightgrid_imins[0] = (int)ceil(loadmodel->brushq3.data_models->mins[0] * loadmodel->brushq3.num_lightgrid_scale[0]);
+ loadmodel->brushq3.num_lightgrid_imins[1] = (int)ceil(loadmodel->brushq3.data_models->mins[1] * loadmodel->brushq3.num_lightgrid_scale[1]);
+ loadmodel->brushq3.num_lightgrid_imins[2] = (int)ceil(loadmodel->brushq3.data_models->mins[2] * loadmodel->brushq3.num_lightgrid_scale[2]);
+ loadmodel->brushq3.num_lightgrid_imaxs[0] = (int)floor(loadmodel->brushq3.data_models->maxs[0] * loadmodel->brushq3.num_lightgrid_scale[0]);
+ loadmodel->brushq3.num_lightgrid_imaxs[1] = (int)floor(loadmodel->brushq3.data_models->maxs[1] * loadmodel->brushq3.num_lightgrid_scale[1]);
+ loadmodel->brushq3.num_lightgrid_imaxs[2] = (int)floor(loadmodel->brushq3.data_models->maxs[2] * loadmodel->brushq3.num_lightgrid_scale[2]);
loadmodel->brushq3.num_lightgrid_isize[0] = loadmodel->brushq3.num_lightgrid_imaxs[0] - loadmodel->brushq3.num_lightgrid_imins[0] + 1;
loadmodel->brushq3.num_lightgrid_isize[1] = loadmodel->brushq3.num_lightgrid_imaxs[1] - loadmodel->brushq3.num_lightgrid_imins[1] + 1;
loadmodel->brushq3.num_lightgrid_isize[2] = loadmodel->brushq3.num_lightgrid_imaxs[2] - loadmodel->brushq3.num_lightgrid_imins[2] + 1;
break;
if (i < width * height * 4)
{
- unsigned char *fogpixels = Mem_Alloc(loadmodel->mempool, width * height * 4);
+ unsigned char *fogpixels = (unsigned char *)Mem_Alloc(loadmodel->mempool, width * height * 4);
memcpy(fogpixels, skindata, width * height * 4);
for (i = 0;i < width * height * 4;i += 4)
fogpixels[i] = fogpixels[i+1] = fogpixels[i+2] = 255;
loadmodel->sprite.sprdata_frames[realframes].up = origin[1];
loadmodel->sprite.sprdata_frames[realframes].down = origin[1] - height;
- x = max(loadmodel->sprite.sprdata_frames[realframes].left * loadmodel->sprite.sprdata_frames[realframes].left, loadmodel->sprite.sprdata_frames[realframes].right * loadmodel->sprite.sprdata_frames[realframes].right);
- y = max(loadmodel->sprite.sprdata_frames[realframes].up * loadmodel->sprite.sprdata_frames[realframes].up, loadmodel->sprite.sprdata_frames[realframes].down * loadmodel->sprite.sprdata_frames[realframes].down);
+ x = (int)max(loadmodel->sprite.sprdata_frames[realframes].left * loadmodel->sprite.sprdata_frames[realframes].left, loadmodel->sprite.sprdata_frames[realframes].right * loadmodel->sprite.sprdata_frames[realframes].right);
+ y = (int)max(loadmodel->sprite.sprdata_frames[realframes].up * loadmodel->sprite.sprdata_frames[realframes].up, loadmodel->sprite.sprdata_frames[realframes].down * loadmodel->sprite.sprdata_frames[realframes].down);
if (modelradius < x + y)
modelradius = x + y;
sprframe->up = origin[1];
sprframe->down = origin[1] - height;
- x = max(sprframe->left * sprframe->left, sprframe->right * sprframe->right);
- y = max(sprframe->up * sprframe->up, sprframe->down * sprframe->down);
+ x = (int)max(sprframe->left * sprframe->left, sprframe->right * sprframe->right);
+ y = (int)max(sprframe->up * sprframe->up, sprframe->down * sprframe->down);
if (modelradius < x + y)
modelradius = x + y;
VM_SAFEPARMCOUNT(2, VM_M_writetofile);
- file = VM_GetFileHandle( PRVM_G_FLOAT(OFS_PARM0) );
+ file = VM_GetFileHandle( (int)PRVM_G_FLOAT(OFS_PARM0) );
if( !file ) {
return;
}
int nr;
VM_SAFEPARMCOUNT(1, VM_getresolution);
- nr = PRVM_G_FLOAT(OFS_PARM0);
+ nr = (int)PRVM_G_FLOAT(OFS_PARM0);
PRVM_G_VECTOR(OFS_RETURN)[0] = video_resolutions[nr][0];
PRVM_G_FLOAT( OFS_RETURN ) = 0;
- type = PRVM_G_FLOAT( OFS_PARM0 );
+ type = (int)PRVM_G_FLOAT( OFS_PARM0 );
switch(type)
{
case 0:
if( !str )
PRVM_ERROR( "VM_M_setserverlistmaskstring: null string passed!" );
- masknr = PRVM_G_FLOAT( OFS_PARM0 );
+ masknr = (int)PRVM_G_FLOAT( OFS_PARM0 );
if( masknr >= 0 && masknr <= SERVERLIST_ANDMASKCOUNT )
mask = &serverlist_andmasks[masknr];
else if( masknr >= 512 && masknr - 512 <= SERVERLIST_ORMASKCOUNT )
int field;
VM_SAFEPARMCOUNT( 4, VM_M_setserverlistmasknumber );
- masknr = PRVM_G_FLOAT( OFS_PARM0 );
+ masknr = (int)PRVM_G_FLOAT( OFS_PARM0 );
if( masknr >= 0 && masknr <= SERVERLIST_ANDMASKCOUNT )
mask = &serverlist_andmasks[masknr];
else if( masknr >= 512 && masknr - 512 <= SERVERLIST_ORMASKCOUNT )
return;
}
- number = PRVM_G_FLOAT( OFS_PARM2 );
+ number = (int)PRVM_G_FLOAT( OFS_PARM2 );
field = (int) PRVM_G_FLOAT( OFS_PARM1 );
switch( field ) {
PRVM_G_INT(OFS_RETURN) = 0;
- hostnr = PRVM_G_FLOAT(OFS_PARM1);
+ hostnr = (int)PRVM_G_FLOAT(OFS_PARM1);
if(hostnr < 0 || hostnr >= serverlist_viewcount)
{
PRVM_G_INT(OFS_RETURN) = 0;
- hostnr = PRVM_G_FLOAT(OFS_PARM1);
+ hostnr = (int)PRVM_G_FLOAT(OFS_PARM1);
if(hostnr < 0 || hostnr >= serverlist_viewcount)
{
if(!sv.active)
PRVM_ERROR("VM_WriteDest: game is not server (%s)", PRVM_NAME);
- dest = PRVM_G_FLOAT(OFS_PARM1);
+ dest = (int)PRVM_G_FLOAT(OFS_PARM1);
switch (dest)
{
case MSG_BROADCAST:
void VM_M_WriteByte (void)
{
- MSG_WriteByte (VM_WriteDest(), PRVM_G_FLOAT(OFS_PARM0));
+ MSG_WriteByte (VM_WriteDest(), (int)PRVM_G_FLOAT(OFS_PARM0));
}
void VM_M_WriteChar (void)
{
- MSG_WriteChar (VM_WriteDest(), PRVM_G_FLOAT(OFS_PARM0));
+ MSG_WriteChar (VM_WriteDest(), (int)PRVM_G_FLOAT(OFS_PARM0));
}
void VM_M_WriteShort (void)
{
- MSG_WriteShort (VM_WriteDest(), PRVM_G_FLOAT(OFS_PARM0));
+ MSG_WriteShort (VM_WriteDest(), (int)PRVM_G_FLOAT(OFS_PARM0));
}
void VM_M_WriteLong (void)
{
- MSG_WriteLong (VM_WriteDest(), PRVM_G_FLOAT(OFS_PARM0));
+ MSG_WriteLong (VM_WriteDest(), (int)PRVM_G_FLOAT(OFS_PARM0));
}
void VM_M_WriteAngle (void)
pingtime = (int)((Sys_DoubleTime() - serverlist_cache[n].querytime) * 1000.0 + 0.5);
pingtime = bound(0, pingtime, 9999);
// update the ping
- info->ping = pingtime;
+ info->ping = (int)pingtime;
// legacy/old stuff move it to the menu ASAP
pingtime = (int)((Sys_DoubleTime() - serverlist_cache[n].querytime) * 1000.0 + 0.5);
pingtime = bound(0, pingtime, 9999);
// update the ping
- info->ping = pingtime;
+ info->ping = (int)pingtime;
// legacy/old stuff move it to the menu ASAP
if (cls.protocol == PROTOCOL_NEHAHRAMOVIE && (bits & U_EXTEND1))
{
// LordHavoc: evil format
- int i = MSG_ReadFloat();
- int j = MSG_ReadFloat() * 255.0f;
+ int i = (int)MSG_ReadFloat();
+ int j = (int)(MSG_ReadFloat() * 255.0f);
if (i == 2)
{
- i = MSG_ReadFloat();
+ i = (int)MSG_ReadFloat();
if (i)
s.effects |= EF_FULLBRIGHT;
}
Mem_Free(sv2csqcents_version[client]);
sv2csqcents_version[client] = NULL;
}
- sv2csqcents_version[client] = Mem_Alloc(sv2csqc, MAX_EDICTS);
+ sv2csqcents_version[client] = (unsigned char *)Mem_Alloc(sv2csqc, MAX_EDICTS);
memset(sv2csqcents_version[client], 0, MAX_EDICTS);
}
char string[VM_STRINGTEMP_LENGTH];
//find client for this entity
- clientnum = PRVM_G_FLOAT(OFS_PARM0);
+ clientnum = (int)PRVM_G_FLOAT(OFS_PARM0);
if (!sv.active || clientnum < 0 || clientnum >= svs.maxclients || !svs.clients[clientnum].active)
{
Con_Printf("VM_sprint: %s: invalid client or server is not active !\n", PRVM_NAME);
int ent;
VM_SAFEPARMCOUNT(1, VM_ftoi);
- ent = PRVM_G_FLOAT(OFS_PARM0);
+ ent = (int)PRVM_G_FLOAT(OFS_PARM0);
if(PRVM_PROG_TO_EDICT(ent)->priv.required->free)
PRVM_ERROR ("VM_ftoe: %s tried to access a freed entity (entity %i)!", PRVM_NAME, ent);
name = PRVM_G_STRING(OFS_PARM0);
value = PRVM_G_STRING(OFS_PARM1);
- flags = PRVM_G_FLOAT(OFS_PARM2);
+ flags = (int)PRVM_G_FLOAT(OFS_PARM2);
PRVM_G_FLOAT(OFS_RETURN) = 0;
if(flags > CVAR_MAXFLAGSVAL)
PRVM_G_FLOAT(OFS_RETURN) = -2;
return;
}
- mode = PRVM_G_FLOAT(OFS_PARM1);
+ mode = (int)PRVM_G_FLOAT(OFS_PARM1);
switch(mode)
{
case 0: // FILE_READ
VM_SAFEPARMCOUNT(1,VM_fclose);
- filenum = PRVM_G_FLOAT(OFS_PARM0);
+ filenum = (int)PRVM_G_FLOAT(OFS_PARM0);
if (filenum < 0 || filenum >= MAX_VMFILES)
{
Con_Printf("VM_fclose: invalid file handle %i used in %s\n", filenum, PRVM_NAME);
VM_SAFEPARMCOUNT(1,VM_fgets);
- filenum = PRVM_G_FLOAT(OFS_PARM0);
+ filenum = (int)PRVM_G_FLOAT(OFS_PARM0);
if (filenum < 0 || filenum >= MAX_VMFILES)
{
Con_Printf("VM_fgets: invalid file handle %i used in %s\n", filenum, PRVM_NAME);
VM_SAFEPARMCOUNT(2,VM_fputs);
- filenum = PRVM_G_FLOAT(OFS_PARM0);
+ filenum = (int)PRVM_G_FLOAT(OFS_PARM0);
if (filenum < 0 || filenum >= MAX_VMFILES)
{
Con_Printf("VM_fputs: invalid file handle %i used in %s\n", filenum, PRVM_NAME);
string = VM_GetTempString();
s = PRVM_G_STRING(OFS_PARM0);
- start = PRVM_G_FLOAT(OFS_PARM1);
- length = PRVM_G_FLOAT(OFS_PARM2);
+ start = (int)PRVM_G_FLOAT(OFS_PARM1);
+ length = (int)PRVM_G_FLOAT(OFS_PARM2);
if (!s)
s = "";
for (i = 0;i < start && *s;i++, s++);
VM_SAFEPARMCOUNT(2,VM_clcommand);
- i = PRVM_G_FLOAT(OFS_PARM0);
+ i = (int)PRVM_G_FLOAT(OFS_PARM0);
if (!sv.active || i < 0 || i >= svs.maxclients || !svs.clients[i].active)
{
Con_Printf("VM_clientcommand: %s: invalid client/server is not active !\n", PRVM_NAME);
VM_SAFEPARMCOUNT(1,VM_argv);
- token_num = PRVM_G_FLOAT(OFS_PARM0);
+ token_num = (int)PRVM_G_FLOAT(OFS_PARM0);
if (token_num >= 0 && token_num < num_tokens)
PRVM_G_INT(OFS_RETURN) = PRVM_SetEngineString(tokens[token_num]);
VM_CheckEmptyString(pattern);
- caseinsens = PRVM_G_FLOAT(OFS_PARM1);
- quiet = PRVM_G_FLOAT(OFS_PARM2);
+ caseinsens = (int)PRVM_G_FLOAT(OFS_PARM1);
+ quiet = (int)PRVM_G_FLOAT(OFS_PARM2);
for(handle = 0; handle < MAX_VMSEARCHES; handle++)
if(!VM_SEARCHLIST[handle])
int handle;
VM_SAFEPARMCOUNT(1, VM_search_end);
- handle = PRVM_G_FLOAT(OFS_PARM0);
+ handle = (int)PRVM_G_FLOAT(OFS_PARM0);
if(handle < 0 || handle >= MAX_VMSEARCHES)
{
int handle;
VM_SAFEPARMCOUNT(1, VM_M_search_getsize);
- handle = PRVM_G_FLOAT(OFS_PARM0);
+ handle = (int)PRVM_G_FLOAT(OFS_PARM0);
if(handle < 0 || handle >= MAX_VMSEARCHES)
{
char *tmp;
VM_SAFEPARMCOUNT(2, VM_search_getfilename);
- handle = PRVM_G_FLOAT(OFS_PARM0);
- filenum = PRVM_G_FLOAT(OFS_PARM1);
+ handle = (int)PRVM_G_FLOAT(OFS_PARM0);
+ filenum = (int)PRVM_G_FLOAT(OFS_PARM1);
if(handle < 0 || handle >= MAX_VMSEARCHES)
{
char *tmp;
VM_SAFEPARMCOUNT(1, VM_keynumtostring);
- keynum = PRVM_G_FLOAT(OFS_PARM0);
+ keynum = (int)PRVM_G_FLOAT(OFS_PARM0);
tmp = VM_GetTempString();
c2 = PRVM_G_VECTOR(OFS_PARM2);
rgb = PRVM_G_VECTOR(OFS_PARM3);
alpha = PRVM_G_FLOAT(OFS_PARM4);
- flags = PRVM_G_FLOAT(OFS_PARM5);
+ flags = (int)PRVM_G_FLOAT(OFS_PARM5);
DrawQ_Line(width, c1[0], c1[1], c2[0], c2[1], rgb[0], rgb[1], rgb[2], alpha, flags);
}
void VM_InitPolygons (void)
{
vm_polygons_pool = Mem_AllocPool("VMPOLY", 0, NULL);
- vm_polygons = Mem_Alloc(vm_polygons_pool, VM_DEFPOLYNUM*sizeof(vm_polygon_t));
+ vm_polygons = (vm_polygon_t *)Mem_Alloc(vm_polygons_pool, VM_DEFPOLYNUM*sizeof(vm_polygon_t));
memset(vm_polygons, 0, VM_DEFPOLYNUM*sizeof(vm_polygon_t));
vm_polygons_num = VM_DEFPOLYNUM;
- vm_polygonbegin = vm_drawpolygons_num = 0;
+ vm_drawpolygons_num = 0;
+ vm_polygonbegin = false;
vm_polygons_initialized = true;
}
}
if(vm_drawpolygons_num >= vm_polygons_num)
{
- p = Mem_Alloc(vm_polygons_pool, 2 * vm_polygons_num * sizeof(vm_polygon_t));
+ p = (vm_polygon_t *)Mem_Alloc(vm_polygons_pool, 2 * vm_polygons_num * sizeof(vm_polygon_t));
memset(p, 0, 2 * vm_polygons_num * sizeof(vm_polygon_t));
memcpy(p, vm_polygons, vm_polygons_num * sizeof(vm_polygon_t));
Mem_Free(vm_polygons);
altstr = PRVM_G_STRING( OFS_PARM0 );
//VM_CheckEmptyString( altstr );
- count = PRVM_G_FLOAT( OFS_PARM1 );
+ count = (int)PRVM_G_FLOAT( OFS_PARM1 );
count = count * 2 + 1;
for( pos = altstr ; *pos && count ; pos++ )
altstr = PRVM_G_STRING( OFS_PARM0 );
//VM_CheckEmptyString( altstr );
- num = PRVM_G_FLOAT( OFS_PARM1 );
+ num = (int)PRVM_G_FLOAT( OFS_PARM1 );
str = PRVM_G_STRING( OFS_PARM2 );
//VM_CheckEmptyString( str );
char *out;
in = instr = PRVM_G_STRING( OFS_PARM0 );
- num = PRVM_G_FLOAT( OFS_PARM1 );
+ num = (int)PRVM_G_FLOAT( OFS_PARM1 );
set = setstr = PRVM_G_STRING( OFS_PARM2 );
out = outstr = VM_GetTempString();
for(i=0;i<MAX_QCSTR_BUFFERS;i++)
if(!qcstringbuffers[i])
{
- qcstringbuffers[i] = malloc(sizeof(qcstrbuffer_t));
+ qcstringbuffers[i] = (qcstrbuffer_t *)Z_Malloc(sizeof(qcstrbuffer_t));
memset(qcstringbuffers[i], 0, sizeof(qcstrbuffer_t));
return i;
}
{
for(i=0;i<b->num_strings;i++)
if(b->strings[i])
- free(b->strings[i]);
+ Z_Free(b->strings[i]);
num_qcstringbuffers--;
}
- free(qcstringbuffers[index]);
+ Z_Free(qcstringbuffers[index]);
qcstringbuffers[index] = NULL;
}
}
Con_Printf("VM_buf_copy: invalid source buffer %i used in %s\n", (int)PRVM_G_FLOAT(OFS_PARM0), PRVM_NAME);
return;
}
- i = PRVM_G_FLOAT(OFS_PARM1);
+ i = (int)PRVM_G_FLOAT(OFS_PARM1);
if(i == (int)PRVM_G_FLOAT(OFS_PARM0))
{
Con_Printf("VM_buf_copy: source == destination (%i) in %s\n", i, PRVM_NAME);
}
BufStr_ClearBuffer(i);
- qcstringbuffers[i] = malloc(sizeof(qcstrbuffer_t));
+ qcstringbuffers[i] = (qcstrbuffer_t *)Z_Malloc(sizeof(qcstrbuffer_t));
memset(qcstringbuffers[i], 0, sizeof(qcstrbuffer_t));
b2->num_strings = b1->num_strings;
for(i=0;i<b1->num_strings;i++)
if(b1->strings[i] && b1->strings[i][0])
{
- b2->strings[i] = malloc(strlen(b1->strings[i])+1);
+ b2->strings[i] = (char *)Z_Malloc(strlen(b1->strings[i])+1);
if(!b2->strings[i])
{
Con_Printf("VM_buf_copy: not enough memory for buffer %i used in %s\n", (int)PRVM_G_FLOAT(OFS_PARM1), PRVM_NAME);
Con_Printf("VM_buf_sort: tried to sort empty buffer %i in %s\n", (int)PRVM_G_FLOAT(OFS_PARM0), PRVM_NAME);
return;
}
- buf_sortpower = PRVM_G_FLOAT(OFS_PARM1);
+ buf_sortpower = (int)PRVM_G_FLOAT(OFS_PARM1);
if(buf_sortpower <= 0)
buf_sortpower = 99999999;
break;
else
{
- free(b->strings[i]);
+ Z_Free(b->strings[i]);
--b->num_strings;
b->strings[i] = NULL;
}
VM_SAFEPARMCOUNT(3, VM_bufstr_set);
- bufindex = PRVM_G_FLOAT(OFS_PARM0);
+ bufindex = (int)PRVM_G_FLOAT(OFS_PARM0);
b = BUFSTR_BUFFER(bufindex);
if(!b)
{
Con_Printf("VM_bufstr_set: invalid buffer %i used in %s\n", bufindex, PRVM_NAME);
return;
}
- strindex = PRVM_G_FLOAT(OFS_PARM1);
+ strindex = (int)PRVM_G_FLOAT(OFS_PARM1);
if(strindex < 0 || strindex > MAX_QCSTR_STRINGS)
{
Con_Printf("VM_bufstr_set: invalid string index %i used in %s\n", strindex, PRVM_NAME);
return;
}
if(b->strings[strindex])
- free(b->strings[strindex]);
- b->strings[strindex] = malloc(strlen(news)+1);
+ Z_Free(b->strings[strindex]);
+ b->strings[strindex] = (char *)Z_Malloc(strlen(news)+1);
strcpy(b->strings[strindex], news);
}
VM_SAFEPARMCOUNT(3, VM_bufstr_add);
- bufindex = PRVM_G_FLOAT(OFS_PARM0);
+ bufindex = (int)PRVM_G_FLOAT(OFS_PARM0);
b = BUFSTR_BUFFER(bufindex);
PRVM_G_FLOAT(OFS_RETURN) = -1;
if(!b)
return;
}
- order = PRVM_G_FLOAT(OFS_PARM2);
+ order = (int)PRVM_G_FLOAT(OFS_PARM2);
if(order)
strindex = b->num_strings;
else
b->num_strings++;
}
if(b->strings[strindex])
- free(b->strings[strindex]);
- b->strings[strindex] = malloc(strlen(string)+1);
+ Z_Free(b->strings[strindex]);
+ b->strings[strindex] = (char *)Z_Malloc(strlen(string)+1);
strcpy(b->strings[strindex], string);
PRVM_G_FLOAT(OFS_RETURN) = strindex;
}
Con_Printf("VM_bufstr_free: invalid buffer %i used in %s\n", (int)PRVM_G_FLOAT(OFS_PARM0), PRVM_NAME);
return;
}
- i = PRVM_G_FLOAT(OFS_PARM1);
+ i = (int)PRVM_G_FLOAT(OFS_PARM1);
if(i < 0 || i > MAX_QCSTR_STRINGS)
{
Con_Printf("VM_bufstr_free: invalid string index %i used in %s\n", i, PRVM_NAME);
return;
}
if(b->strings[i])
- free(b->strings[i]);
+ Z_Free(b->strings[i]);
b->strings[i] = NULL;
if(i+1 == b->num_strings)
--b->num_strings;
for (x = 0;x < 32;x++)
{
dx = (x - 15.5f) * (1.0f / 16.0f);
- a = ((1.0f / (dx * dx + dy * dy + 0.2f)) - (1.0f / (1.0f + 0.2))) * 32.0f / (1.0f / (1.0f + 0.2));
+ a = (int)(((1.0f / (dx * dx + dy * dy + 0.2f)) - (1.0f / (1.0f + 0.2))) * 32.0f / (1.0f / (1.0f + 0.2)));
a = bound(0, a, 255);
pixels[y][x][0] = a;
pixels[y][x][1] = a;
intensity = 1.0f - sqrt(DotProduct(v, v));
if (intensity > 0)
intensity = pow(intensity, r_shadow_attenpower) * r_shadow_attenscale * 256.0f;
- d = bound(0, intensity, 255);
+ d = (int)bound(0, intensity, 255);
data[(y*ATTEN2DSIZE+x)*4+0] = d;
data[(y*ATTEN2DSIZE+x)*4+1] = d;
data[(y*ATTEN2DSIZE+x)*4+2] = d;
intensity = 1.0f - sqrt(DotProduct(v, v));
if (intensity > 0)
intensity = pow(intensity, r_shadow_attenpower) * r_shadow_attenscale * 256.0f;
- d = bound(0, intensity, 255);
+ d = (int)bound(0, intensity, 255);
data[((z*ATTEN3DSIZE+y)*ATTEN3DSIZE+x)*4+0] = d;
data[((z*ATTEN3DSIZE+y)*ATTEN3DSIZE+x)*4+1] = d;
data[((z*ATTEN3DSIZE+y)*ATTEN3DSIZE+x)*4+2] = d;
}
// now convert the scissor rectangle to integer screen coordinates
- ix1 = x1 - 1.0f;
- iy1 = y1 - 1.0f;
- ix2 = x2 + 1.0f;
- iy2 = y2 + 1.0f;
+ ix1 = (int)(x1 - 1.0f);
+ iy1 = (int)(y1 - 1.0f);
+ ix2 = (int)(x2 + 1.0f);
+ iy2 = (int)(y2 + 1.0f);
//Con_Printf("%f %f %f %f\n", x1, y1, x2, y2);
// clamp it to the screen
// information about each possible shader permutation
extern r_glsl_permutation_t r_glsl_permutations[SHADERPERMUTATION_COUNT];
// currently selected permutation
-r_glsl_permutation_t *r_glsl_permutation;
+extern r_glsl_permutation_t *r_glsl_permutation;
void R_GLSL_CompilePermutation(int permutation);
void R_SetupSurfaceShader(const entity_render_t *ent, const texture_t *texture, const vec3_t modelorg, const vec3_t lightcolorbase, qboolean modellighting);
}
// time
- minutes = cl.time / 60;
- seconds = cl.time - 60*minutes;
+ minutes = (int)(cl.time / 60);
+ seconds = (int)(cl.time - 60*minutes);
tens = seconds / 10;
units = seconds - 10*tens;
sprintf (str,"Time :%3i:%i%i", minutes, tens, units);
kickoffset[0] = (v_dmg_time/v_kicktime.value*v_dmg_roll) * 10 * scale;
kickoffset[1] = (v_dmg_time/v_kicktime.value*v_dmg_pitch) * 10 * scale;
}
- sbar_x = (vid_conwidth.integer - 256 * scale)/2 + kickoffset[0];
- sbar_y = (vid_conheight.integer - 256 * scale)/2 + kickoffset[1];
+ sbar_x = (int)((vid_conwidth.integer - 256 * scale)/2 + kickoffset[0]);
+ sbar_y = (int)((vid_conheight.integer - 256 * scale)/2 + kickoffset[1]);
// left1 16, 48 : 126 -66
// left2 16, 128 : 196 -66
// right 176, 48 : 196 -136
{
// show team scores first
for (i = 0;i < teamlines && y < vid_conheight.integer;i++)
- y += Sbar_PrintScoreboardItem((teams + teamsort[i]), x, y);
+ y += (int)Sbar_PrintScoreboardItem((teams + teamsort[i]), x, y);
y += 5;
}
for (i = 0;i < scoreboardlines && y < vid_conheight.integer;i++)
- y += Sbar_PrintScoreboardItem(cl.scores + fragsort[i], x, y);
+ y += (int)Sbar_PrintScoreboardItem(cl.scores + fragsort[i], x, y);
}
/*
if (gamemode == GAME_TRANSFUSION)
{
for (;i < scoreboardlines && x < vid_conwidth.integer;i++)
- x += 128 + Sbar_PrintScoreboardItem(cl.scores + fragsort[i], x, y);
+ x += 128 + (int)Sbar_PrintScoreboardItem(cl.scores + fragsort[i], x, y);
}
else
{
for (;i < scoreboardlines && y < vid_conheight.integer;i++)
- y += Sbar_PrintScoreboardItem(cl.scores + fragsort[i], x, y);
+ y += (int)Sbar_PrintScoreboardItem(cl.scores + fragsort[i], x, y);
}
}
DrawQ_Pic (sbar_x + 0, sbar_y + 56, Draw_CachePic("gfx/inter", true), 0, 0, 1, 1, 1, 1 * sbar_alpha_fg.value, 0);
// time
- dig = cl.completed_time/60;
+ dig = (int)(cl.completed_time/60);
Sbar_DrawNum (160, 64, dig, 3, 0);
- num = cl.completed_time - dig*60;
+ num = (int)(cl.completed_time - dig*60);
if (gamemode != GAME_NEXUIZ)
Sbar_DrawPic (234,64,sb_colon);
Sbar_DrawPic (246,64,sb_nums[0][num/10]);
for (i = 0;i < SND_LISTENERS;i++)
{
vol = mastervol * snd_speakerlayout.listeners[i].ambientvolume;
- ch->listener_volume[i] = bound(0, vol, 255);
+ ch->listener_volume[i] = (int)bound(0, vol, 255);
}
}
else
Matrix4x4_Transform(&listener_matrix[i], ch->origin, source_vec);
VectorNormalize(source_vec);
vol = intensity * max(0, source_vec[0] * snd_speakerlayout.listeners[i].dotscale + snd_speakerlayout.listeners[i].dotbias);
- ch->listener_volume[i] = bound(0, vol, 255);
+ ch->listener_volume[i] = (int)bound(0, vol, 255);
}
}
else
// Initialize the channel
memset (target_chan, 0, sizeof (*target_chan));
VectorCopy (origin, target_chan->origin);
- target_chan->master_vol = fvol * 255;
+ target_chan->master_vol = (int)(fvol * 255);
target_chan->sfx = sfx;
target_chan->end = paintedtime + sfx->total_length;
target_chan->lastptime = paintedtime;
continue;
if (check->sfx == sfx && !check->pos)
{
- skip = 0.1 * sfx->format.speed;
+ skip = (int)(0.1 * sfx->format.speed);
if (skip > (int)sfx->total_length)
skip = (int)sfx->total_length;
if (skip > 0)
void S_SetChannelVolume (unsigned int ch_ind, float fvol)
{
- channels[ch_ind].master_vol = fvol * 255;
+ channels[ch_ind].master_vol = (int)(fvol * 255);
}
void S_UpdateAmbientSounds (void)
{
int i;
- float vol;
+ int vol;
int ambient_channel;
channel_t *chan;
unsigned char ambientlevels[NUM_AMBIENTS];
if (chan->sfx == NULL || chan->sfx->fetcher == NULL)
continue;
- vol = ambientlevels[ambient_channel];
+ vol = (int)ambientlevels[ambient_channel];
if (vol < 8)
vol = 0;
// Don't adjust volume too fast
+ // FIXME: this rounds off to an int each frame, meaning there is little to no fade at extremely high framerates!
if (chan->master_vol < vol)
{
- chan->master_vol += host_realframetime * ambient_fade.value;
+ chan->master_vol += (int)(host_realframetime * ambient_fade.value);
if (chan->master_vol > vol)
chan->master_vol = vol;
}
else if (chan->master_vol > vol)
{
- chan->master_vol -= host_realframetime * ambient_fade.value;
+ chan->master_vol -= (int)(host_realframetime * ambient_fade.value);
if (chan->master_vol < vol)
chan->master_vol = vol;
}
paintedtime = soundtime;
// mix ahead of current position
- endtime = soundtime + _snd_mixahead.value * shm->format.speed;
+ endtime = (int)(soundtime + _snd_mixahead.value * shm->format.speed);
endtime = min(endtime, (unsigned int)(soundtime + shm->sampleframes));
S_PaintChannels (endtime);
size_t srclength, outcount;
srclength = in_length * in_format->channels;
- outcount = (double)in_length * shm->format.speed / in_format->speed;
+ outcount = (int)((double)in_length * shm->format.speed / in_format->speed);
//Con_DPrintf("ResampleSfx(%s): %d samples @ %dHz -> %d samples @ %dHz\n",
// sfxname, in_length, in_format->speed, outcount, shm->format.speed);
# define INTEGER_BITS (sizeof(samplefrac)*8 - FRACTIONAL_BITS)
else
{
- const unsigned int fracstep = (double)in_format->speed / shm->format.speed * (1 << FRACTIONAL_BITS);
+ const unsigned int fracstep = (unsigned int)((double)in_format->speed / shm->format.speed * (1 << FRACTIONAL_BITS));
size_t remain_in = srclength, total_out = 0;
unsigned int samplefrac;
const unsigned char *in_ptr = in_data;
else
{
tmpcount = outcount - total_out;
- interpolation_limit = ceil((double)(((remain_in / in_format->channels) - 1) << FRACTIONAL_BITS) / fracstep);
+ interpolation_limit = (int)ceil((double)(((remain_in / in_format->channels) - 1) << FRACTIONAL_BITS) / fracstep);
if (interpolation_limit > tmpcount)
interpolation_limit = tmpcount;
}
if (ch->flags & CHANNELFLAG_FULLVOLUME)
snd_vol = 256;
else
- snd_vol = volume.value * 256;
+ snd_vol = (int)(volume.value * 256);
for (i = 0;i < SND_LISTENERS;i++)
vol[i] = ch->listener_volume[i] * snd_vol;
*/
#define STREAM_BUFFER_DURATION 1.5f // 1.5 sec
-#define STREAM_BUFFER_SIZE(format_ptr) (ceil (STREAM_BUFFER_DURATION * ((format_ptr)->speed * (format_ptr)->width * (format_ptr)->channels)))
+#define STREAM_BUFFER_SIZE(format_ptr) ((int)(ceil (STREAM_BUFFER_DURATION * ((format_ptr)->speed * (format_ptr)->width * (format_ptr)->channels))))
// We work with 1 sec sequences, so this buffer must be able to contain
// 1 sec of sound of the highest quality (48 KHz, 16 bit samples, stereo)
len = qov_pcm_total (&vf, -1) * vi->channels * 2; // 16 bits => "* 2"
// Decide if we go for a stream or a simple PCM cache
- buff_len = ceil (STREAM_BUFFER_DURATION * (shm->format.speed * 2 * vi->channels));
+ buff_len = (int)ceil (STREAM_BUFFER_DURATION * (shm->format.speed * 2 * vi->channels));
if (snd_streaming.integer && len > (ogg_int64_t)filesize + 3 * buff_len)
{
ogg_stream_persfx_t* per_sfx;
s->fetcher = &ogg_fetcher;
s->loopstart = -1;
s->flags |= SFXFLAG_STREAMED;
- s->total_length = (size_t)len / per_sfx->format.channels / 2 * ((float)s->format.speed / per_sfx->format.speed);
+ s->total_length = (int)((size_t)len / per_sfx->format.channels / 2 * ((float)s->format.speed / per_sfx->format.speed));
}
else
{
done += ret;
// Calculate resampled length
- len = (double)done * (double)shm->format.speed / (double)vi->rate;
+ // FIXME: is this using the correct rounding direction? ceil may be better
+ len = (int)((double)done * (double)shm->format.speed / (double)vi->rate);
// Resample it
memsize = (size_t)len + sizeof (*sb) - sizeof (sb->data);
if (info.loopstart < 0)
s->loopstart = -1;
else
- s->loopstart = (double)info.loopstart * (double)shm->format.speed / (double)s->format.speed;
+ s->loopstart = (int)((double)info.loopstart * (double)shm->format.speed / (double)s->format.speed);
s->flags &= ~SFXFLAG_STREAMED;
#if BYTE_ORDER != LITTLE_ENDIAN
*/
void SV_StartParticle (vec3_t org, vec3_t dir, int color, int count)
{
- int i, v;
+ int i;
if (sv.datagram.cursize > MAX_PACKETFRAGMENT-18)
return;
MSG_WriteCoord (&sv.datagram, org[1], sv.protocol);
MSG_WriteCoord (&sv.datagram, org[2], sv.protocol);
for (i=0 ; i<3 ; i++)
- {
- v = dir[i]*16;
- if (v > 127)
- v = 127;
- else if (v < -128)
- v = -128;
- MSG_WriteChar (&sv.datagram, v);
- }
+ MSG_WriteChar (&sv.datagram, (int)bound(-128, dir[i]*16, 127));
MSG_WriteByte (&sv.datagram, count);
MSG_WriteByte (&sv.datagram, color);
}
if (field_mask & SND_VOLUME)
MSG_WriteByte (&sv.datagram, volume);
if (field_mask & SND_ATTENUATION)
- MSG_WriteByte (&sv.datagram, attenuation*64);
+ MSG_WriteByte (&sv.datagram, (int)(attenuation*64));
if (field_mask & SND_LARGEENTITY)
{
MSG_WriteShort (&sv.datagram, ent);
// send music
MSG_WriteByte (&client->netconnection->message, svc_cdtrack);
- MSG_WriteByte (&client->netconnection->message, prog->edicts->fields.server->sounds);
- MSG_WriteByte (&client->netconnection->message, prog->edicts->fields.server->sounds);
+ MSG_WriteByte (&client->netconnection->message, (int)prog->edicts->fields.server->sounds);
+ MSG_WriteByte (&client->netconnection->message, (int)prog->edicts->fields.server->sounds);
// set view
MSG_WriteByte (&client->netconnection->message, svc_setview);
if (effects & 32)
{
effects &= ~32;
- light[0] = 0.2;
- light[1] = 1;
- light[2] = 0.2;
+ light[0] = (int)(0.2*256);
+ light[1] = (int)(1.0*256);
+ light[2] = (int)(0.2*256);
light[3] = 200;
lightpflags |= PFLAGS_FULLDYNAMIC;
}
val = PRVM_GETEDICTFIELDVALUE(ent, eval_colormod);
if (val->vector[0] || val->vector[1] || val->vector[2])
{
- i = val->vector[0] * 32.0f;cs->colormod[0] = bound(0, i, 255);
- i = val->vector[1] * 32.0f;cs->colormod[1] = bound(0, i, 255);
- i = val->vector[2] * 32.0f;cs->colormod[2] = bound(0, i, 255);
+ i = (int)(val->vector[0] * 32.0f);cs->colormod[0] = bound(0, i, 255);
+ i = (int)(val->vector[1] * 32.0f);cs->colormod[1] = bound(0, i, 255);
+ i = (int)(val->vector[2] * 32.0f);cs->colormod[2] = bound(0, i, 255);
}
cs->modelindex = modelindex;
int items;
prvm_eval_t *val;
vec3_t punchvector;
- unsigned char viewzoom;
+ int viewzoom;
const char *s;
//
{
other = PRVM_PROG_TO_EDICT(ent->fields.server->dmg_inflictor);
MSG_WriteByte (msg, svc_damage);
- MSG_WriteByte (msg, ent->fields.server->dmg_save);
- MSG_WriteByte (msg, ent->fields.server->dmg_take);
+ MSG_WriteByte (msg, (int)ent->fields.server->dmg_save);
+ MSG_WriteByte (msg, (int)ent->fields.server->dmg_take);
for (i=0 ; i<3 ; i++)
MSG_WriteCoord (msg, other->fields.server->origin[i] + 0.5*(other->fields.server->mins[i] + other->fields.server->maxs[i]), sv.protocol);
viewzoom = 255;
if ((val = PRVM_GETEDICTFIELDVALUE(ent, eval_viewzoom)))
- viewzoom = val->_float * 255.0f;
+ viewzoom = (int)(val->_float * 255.0f);
if (viewzoom == 0)
viewzoom = 255;
}
memset(stats, 0, sizeof(int[MAX_CL_STATS]));
- stats[STAT_VIEWHEIGHT] = ent->fields.server->view_ofs[2];
+ stats[STAT_VIEWHEIGHT] = (int)ent->fields.server->view_ofs[2];
stats[STAT_ITEMS] = items;
- stats[STAT_WEAPONFRAME] = ent->fields.server->weaponframe;
- stats[STAT_ARMOR] = ent->fields.server->armorvalue;
+ stats[STAT_WEAPONFRAME] = (int)ent->fields.server->weaponframe;
+ stats[STAT_ARMOR] = (int)ent->fields.server->armorvalue;
stats[STAT_WEAPON] = client->weaponmodelindex;
- stats[STAT_HEALTH] = ent->fields.server->health;
- stats[STAT_AMMO] = ent->fields.server->currentammo;
- stats[STAT_SHELLS] = ent->fields.server->ammo_shells;
- stats[STAT_NAILS] = ent->fields.server->ammo_nails;
- stats[STAT_ROCKETS] = ent->fields.server->ammo_rockets;
- stats[STAT_CELLS] = ent->fields.server->ammo_cells;
- stats[STAT_ACTIVEWEAPON] = ent->fields.server->weapon;
+ stats[STAT_HEALTH] = (int)ent->fields.server->health;
+ stats[STAT_AMMO] = (int)ent->fields.server->currentammo;
+ stats[STAT_SHELLS] = (int)ent->fields.server->ammo_shells;
+ stats[STAT_NAILS] = (int)ent->fields.server->ammo_nails;
+ stats[STAT_ROCKETS] = (int)ent->fields.server->ammo_rockets;
+ stats[STAT_CELLS] = (int)ent->fields.server->ammo_cells;
+ stats[STAT_ACTIVEWEAPON] = (int)ent->fields.server->weapon;
stats[STAT_VIEWZOOM] = viewzoom;
// the QC bumps these itself by sending svc_'s, so we have to keep them
// zero or they'll be corrected by the engine
MSG_WriteChar (msg, stats[STAT_VIEWHEIGHT]);
if (bits & SU_IDEALPITCH)
- MSG_WriteChar (msg, ent->fields.server->idealpitch);
+ MSG_WriteChar (msg, (int)ent->fields.server->idealpitch);
for (i=0 ; i<3 ; i++)
{
if (bits & (SU_PUNCH1<<i))
{
if (sv.protocol == PROTOCOL_QUAKE || sv.protocol == PROTOCOL_QUAKEDP || sv.protocol == PROTOCOL_NEHAHRAMOVIE)
- MSG_WriteChar(msg, ent->fields.server->punchangle[i]);
+ MSG_WriteChar(msg, (int)ent->fields.server->punchangle[i]);
else
MSG_WriteAngle16i(msg, ent->fields.server->punchangle[i]);
}
if (bits & (SU_VELOCITY1<<i))
{
if (sv.protocol == PROTOCOL_QUAKE || sv.protocol == PROTOCOL_DARKPLACES1 || sv.protocol == PROTOCOL_DARKPLACES2 || sv.protocol == PROTOCOL_DARKPLACES3 || sv.protocol == PROTOCOL_DARKPLACES4)
- MSG_WriteChar(msg, ent->fields.server->velocity[i] * (1.0f / 16.0f));
+ MSG_WriteChar(msg, (int)(ent->fields.server->velocity[i] * (1.0f / 16.0f)));
else
MSG_WriteCoord32f(msg, ent->fields.server->velocity[i]);
}
MSG_WriteShort (msg, stats[STAT_CELLS]);
MSG_WriteShort (msg, stats[STAT_ACTIVEWEAPON]);
if (bits & SU_VIEWZOOM)
- MSG_WriteShort (msg, min(stats[STAT_VIEWZOOM], 65535));
+ MSG_WriteShort (msg, bound(0, stats[STAT_VIEWZOOM], 65535));
}
else if (sv.protocol == PROTOCOL_QUAKE || sv.protocol == PROTOCOL_QUAKEDP || sv.protocol == PROTOCOL_NEHAHRAMOVIE || sv.protocol == PROTOCOL_DARKPLACES1 || sv.protocol == PROTOCOL_DARKPLACES2 || sv.protocol == PROTOCOL_DARKPLACES3 || sv.protocol == PROTOCOL_DARKPLACES4)
{
if (bits & SU_VIEWZOOM)
{
if (sv.protocol == PROTOCOL_DARKPLACES2 || sv.protocol == PROTOCOL_DARKPLACES3 || sv.protocol == PROTOCOL_DARKPLACES4)
- MSG_WriteByte (msg, min(stats[STAT_VIEWZOOM], 255));
+ MSG_WriteByte (msg, bound(0, stats[STAT_VIEWZOOM], 255));
else
- MSG_WriteShort (msg, min(stats[STAT_VIEWZOOM], 65535));
+ MSG_WriteShort (msg, bound(0, stats[STAT_VIEWZOOM], 65535));
}
}
}
// create entity baseline
VectorCopy (svent->fields.server->origin, svent->priv.server->baseline.origin);
VectorCopy (svent->fields.server->angles, svent->priv.server->baseline.angles);
- svent->priv.server->baseline.frame = svent->fields.server->frame;
- svent->priv.server->baseline.skin = svent->fields.server->skin;
+ svent->priv.server->baseline.frame = (int)svent->fields.server->frame;
+ svent->priv.server->baseline.skin = (int)svent->fields.server->skin;
if (entnum > 0 && entnum <= svs.maxclients)
{
svent->priv.server->baseline.colormap = entnum;
else
{
svent->priv.server->baseline.colormap = 0;
- svent->priv.server->baseline.modelindex = svent->fields.server->modelindex;
+ svent->priv.server->baseline.modelindex = (int)svent->fields.server->modelindex;
}
large = false;
{
int i, j;
- svs.serverflags = prog->globals.server->serverflags;
+ svs.serverflags = (int)prog->globals.server->serverflags;
for (i = 0, host_client = svs.clients;i < svs.maxclients;i++, host_client++)
{
}
// try other directions
- if ( ((rand()&3) & 1) || abs(deltay)>abs(deltax))
+ if ( ((rand()&3) & 1) || fabs(deltay)>fabs(deltax))
{
tdir=d[1];
d[1]=d[2];
#define MAX_FORWARD 6
void SV_SetIdealPitch (void)
{
- float angleval, sinval, cosval;
+ float angleval, sinval, cosval, step, dir;
trace_t tr;
vec3_t top, bottom;
float z[MAX_FORWARD];
int i, j;
- int step, dir, steps;
+ int steps;
if (!((int)host_client->edict->fields.server->flags & FL_ONGROUND))
return;
dir = PRVM_G_VECTOR(OFS_PARM1);
color = PRVM_G_FLOAT(OFS_PARM2);
count = PRVM_G_FLOAT(OFS_PARM3);
- SV_StartParticle (org, dir, color, count);
+ SV_StartParticle (org, dir, (int)color, (int)count);
}
else
MSG_WriteByte (&sv.signon, soundnum);
- MSG_WriteByte (&sv.signon, vol*255);
- MSG_WriteByte (&sv.signon, attenuation*64);
+ MSG_WriteByte (&sv.signon, (int)(vol*255));
+ MSG_WriteByte (&sv.signon, (int)(attenuation*64));
}
float attenuation;
entity = PRVM_G_EDICT(OFS_PARM0);
- channel = PRVM_G_FLOAT(OFS_PARM1);
+ channel = (int)PRVM_G_FLOAT(OFS_PARM1);
sample = PRVM_G_STRING(OFS_PARM2);
- volume = PRVM_G_FLOAT(OFS_PARM3) * 255;
+ volume = (int)(PRVM_G_FLOAT(OFS_PARM3) * 255);
attenuation = PRVM_G_FLOAT(OFS_PARM4);
if (volume < 0 || volume > 255)
v1 = PRVM_G_VECTOR(OFS_PARM0);
v2 = PRVM_G_VECTOR(OFS_PARM1);
- move = PRVM_G_FLOAT(OFS_PARM2);
+ move = (int)PRVM_G_FLOAT(OFS_PARM2);
ent = PRVM_G_EDICT(OFS_PARM3);
if (IS_NAN(v1[0]) || IS_NAN(v1[1]) || IS_NAN(v1[2]) || IS_NAN(v2[0]) || IS_NAN(v1[2]) || IS_NAN(v2[2]))
m1 = PRVM_G_VECTOR(OFS_PARM1);
m2 = PRVM_G_VECTOR(OFS_PARM2);
v2 = PRVM_G_VECTOR(OFS_PARM3);
- move = PRVM_G_FLOAT(OFS_PARM4);
+ move = (int)PRVM_G_FLOAT(OFS_PARM4);
ent = PRVM_G_EDICT(OFS_PARM5);
if (IS_NAN(v1[0]) || IS_NAN(v1[1]) || IS_NAN(v1[2]) || IS_NAN(v2[0]) || IS_NAN(v1[2]) || IS_NAN(v2[2]))
client_t *client;
int j;
- style = PRVM_G_FLOAT(OFS_PARM0);
+ style = (int)PRVM_G_FLOAT(OFS_PARM0);
val = PRVM_G_STRING(OFS_PARM1);
if( (unsigned) style >= MAX_LIGHTSTYLES ) {
prvm_edict_t *ent;
extern sizebuf_t *sv2csqcbuf;
- dest = PRVM_G_FLOAT(OFS_PARM0);
+ dest = (int)PRVM_G_FLOAT(OFS_PARM0);
switch (dest)
{
case MSG_BROADCAST:
void PF_WriteByte (void)
{
- MSG_WriteByte (WriteDest(), PRVM_G_FLOAT(OFS_PARM1));
+ MSG_WriteByte (WriteDest(), (int)PRVM_G_FLOAT(OFS_PARM1));
}
void PF_WriteChar (void)
{
- MSG_WriteChar (WriteDest(), PRVM_G_FLOAT(OFS_PARM1));
+ MSG_WriteChar (WriteDest(), (int)PRVM_G_FLOAT(OFS_PARM1));
}
void PF_WriteShort (void)
{
- MSG_WriteShort (WriteDest(), PRVM_G_FLOAT(OFS_PARM1));
+ MSG_WriteShort (WriteDest(), (int)PRVM_G_FLOAT(OFS_PARM1));
}
void PF_WriteLong (void)
{
- MSG_WriteLong (WriteDest(), PRVM_G_FLOAT(OFS_PARM1));
+ MSG_WriteLong (WriteDest(), (int)PRVM_G_FLOAT(OFS_PARM1));
}
void PF_WriteAngle (void)
if (large)
{
MSG_WriteByte (&sv.signon,svc_spawnstatic2);
- MSG_WriteShort (&sv.signon, ent->fields.server->modelindex);
- MSG_WriteShort (&sv.signon, ent->fields.server->frame);
+ MSG_WriteShort (&sv.signon, (int)ent->fields.server->modelindex);
+ MSG_WriteShort (&sv.signon, (int)ent->fields.server->frame);
}
else
{
MSG_WriteByte (&sv.signon,svc_spawnstatic);
- MSG_WriteByte (&sv.signon, ent->fields.server->modelindex);
- MSG_WriteByte (&sv.signon, ent->fields.server->frame);
+ MSG_WriteByte (&sv.signon, (int)ent->fields.server->modelindex);
+ MSG_WriteByte (&sv.signon, (int)ent->fields.server->frame);
}
- MSG_WriteByte (&sv.signon, ent->fields.server->colormap);
- MSG_WriteByte (&sv.signon, ent->fields.server->skin);
+ MSG_WriteByte (&sv.signon, (int)ent->fields.server->colormap);
+ MSG_WriteByte (&sv.signon, (int)ent->fields.server->skin);
for (i=0 ; i<3 ; i++)
{
MSG_WriteCoord(&sv.signon, ent->fields.server->origin[i], sv.protocol);
{
if(vm_autosentstats)
{
- free(vm_autosentstats);
+ Z_Free(vm_autosentstats);
vm_autosentstats = NULL;
vm_autosentstats_last = -1;
}
break;
//integer
case 8:
- v = PRVM_E_FLOAT(ent, vm_autosentstats[i].fieldoffset); //[515]: use PRVM_E_INT ?
+ v = (int)PRVM_E_FLOAT(ent, vm_autosentstats[i].fieldoffset); //[515]: use PRVM_E_INT ?
if (!send)
stats[i+32] = v;
else
if(!vm_autosentstats)
{
- vm_autosentstats = malloc((MAX_CL_STATS-32) * sizeof(autosentstat_t));
+ vm_autosentstats = (autosentstat_t *)Z_Malloc((MAX_CL_STATS-32) * sizeof(autosentstat_t));
if(!vm_autosentstats)
{
Con_Printf("PF_SV_AddStat: not enough memory\n");
return;
}
}
- i = PRVM_G_FLOAT(OFS_PARM0);
- type = PRVM_G_FLOAT(OFS_PARM1);
+ i = (int)PRVM_G_FLOAT(OFS_PARM0);
+ type = (int)PRVM_G_FLOAT(OFS_PARM1);
off = PRVM_G_INT (OFS_PARM2);
i -= 32;
prvm_eval_t *val;
entnum = PRVM_G_EDICTNUM(OFS_PARM0);
- i = PRVM_G_FLOAT(OFS_PARM1);
+ i = (int)PRVM_G_FLOAT(OFS_PARM1);
if (entnum < 1 || entnum > svs.maxclients || !svs.clients[entnum-1].active)
{
i = SV_ModelIndex(s, 1);
if (!i)
PF_WARNING("effect: model not precached\n");
- SV_StartEffect(PRVM_G_VECTOR(OFS_PARM0), i, PRVM_G_FLOAT(OFS_PARM2), PRVM_G_FLOAT(OFS_PARM3), PRVM_G_FLOAT(OFS_PARM4));
+ SV_StartEffect(PRVM_G_VECTOR(OFS_PARM0), i, (int)PRVM_G_FLOAT(OFS_PARM2), (int)PRVM_G_FLOAT(OFS_PARM3), (int)PRVM_G_FLOAT(OFS_PARM4));
}
void PF_te_blood (void)
// speed
MSG_WriteCoord(&sv.datagram, PRVM_G_FLOAT(OFS_PARM2), sv.protocol);
// count
- MSG_WriteShort(&sv.datagram, bound(0, PRVM_G_FLOAT(OFS_PARM3), 65535));
+ MSG_WriteShort(&sv.datagram, (int)bound(0, PRVM_G_FLOAT(OFS_PARM3), 65535));
}
void PF_te_explosionrgb (void)
MSG_WriteCoord(&sv.datagram, PRVM_G_VECTOR(OFS_PARM2)[1], sv.protocol);
MSG_WriteCoord(&sv.datagram, PRVM_G_VECTOR(OFS_PARM2)[2], sv.protocol);
// count
- MSG_WriteShort(&sv.datagram, bound(0, PRVM_G_FLOAT(OFS_PARM3), 65535));
+ MSG_WriteShort(&sv.datagram, (int)bound(0, PRVM_G_FLOAT(OFS_PARM3), 65535));
// color
- MSG_WriteByte(&sv.datagram, PRVM_G_FLOAT(OFS_PARM4));
+ MSG_WriteByte(&sv.datagram, (int)PRVM_G_FLOAT(OFS_PARM4));
// gravity true/false
MSG_WriteByte(&sv.datagram, ((int) PRVM_G_FLOAT(OFS_PARM5)) != 0);
// randomvel
MSG_WriteCoord(&sv.datagram, PRVM_G_VECTOR(OFS_PARM2)[1], sv.protocol);
MSG_WriteCoord(&sv.datagram, PRVM_G_VECTOR(OFS_PARM2)[2], sv.protocol);
// count
- MSG_WriteShort(&sv.datagram, bound(0, PRVM_G_FLOAT(OFS_PARM3), 65535));
+ MSG_WriteShort(&sv.datagram, (int)bound(0, PRVM_G_FLOAT(OFS_PARM3), 65535));
// color
- MSG_WriteByte(&sv.datagram, PRVM_G_FLOAT(OFS_PARM4));
+ MSG_WriteByte(&sv.datagram, (int)PRVM_G_FLOAT(OFS_PARM4));
}
void PF_te_particlesnow (void)
MSG_WriteCoord(&sv.datagram, PRVM_G_VECTOR(OFS_PARM2)[1], sv.protocol);
MSG_WriteCoord(&sv.datagram, PRVM_G_VECTOR(OFS_PARM2)[2], sv.protocol);
// count
- MSG_WriteShort(&sv.datagram, bound(0, PRVM_G_FLOAT(OFS_PARM3), 65535));
+ MSG_WriteShort(&sv.datagram, (int)bound(0, PRVM_G_FLOAT(OFS_PARM3), 65535));
// color
- MSG_WriteByte(&sv.datagram, PRVM_G_FLOAT(OFS_PARM4));
+ MSG_WriteByte(&sv.datagram, (int)PRVM_G_FLOAT(OFS_PARM4));
}
void PF_te_spark (void)
MSG_WriteCoord(&sv.datagram, PRVM_G_VECTOR(OFS_PARM0)[1], sv.protocol);
MSG_WriteCoord(&sv.datagram, PRVM_G_VECTOR(OFS_PARM0)[2], sv.protocol);
// radius
- MSG_WriteByte(&sv.datagram, bound(0, PRVM_G_FLOAT(OFS_PARM1) / 8 - 1, 255));
+ MSG_WriteByte(&sv.datagram, (int)bound(0, PRVM_G_FLOAT(OFS_PARM1) / 8 - 1, 255));
// lifetime
- MSG_WriteByte(&sv.datagram, bound(0, PRVM_G_FLOAT(OFS_PARM2) * 256 - 1, 255));
+ MSG_WriteByte(&sv.datagram, (int)bound(0, PRVM_G_FLOAT(OFS_PARM2) * 256 - 1, 255));
// color
- MSG_WriteByte(&sv.datagram, bound(0, PRVM_G_VECTOR(OFS_PARM3)[0] * 255, 255));
- MSG_WriteByte(&sv.datagram, bound(0, PRVM_G_VECTOR(OFS_PARM3)[1] * 255, 255));
- MSG_WriteByte(&sv.datagram, bound(0, PRVM_G_VECTOR(OFS_PARM3)[2] * 255, 255));
+ MSG_WriteByte(&sv.datagram, (int)bound(0, PRVM_G_VECTOR(OFS_PARM3)[0] * 255, 255));
+ MSG_WriteByte(&sv.datagram, (int)bound(0, PRVM_G_VECTOR(OFS_PARM3)[1] * 255, 255));
+ MSG_WriteByte(&sv.datagram, (int)bound(0, PRVM_G_VECTOR(OFS_PARM3)[2] * 255, 255));
}
void PF_te_gunshot (void)
MSG_WriteCoord(&sv.datagram, PRVM_G_VECTOR(OFS_PARM0)[1], sv.protocol);
MSG_WriteCoord(&sv.datagram, PRVM_G_VECTOR(OFS_PARM0)[2], sv.protocol);
// color
- MSG_WriteByte(&sv.datagram, PRVM_G_FLOAT(OFS_PARM1));
- MSG_WriteByte(&sv.datagram, PRVM_G_FLOAT(OFS_PARM2));
+ MSG_WriteByte(&sv.datagram, (int)PRVM_G_FLOAT(OFS_PARM1));
+ MSG_WriteByte(&sv.datagram, (int)PRVM_G_FLOAT(OFS_PARM2));
}
void PF_te_lightning1 (void)
MSG_WriteCoord(&sv.datagram, PRVM_G_VECTOR(OFS_PARM1)[1], sv.protocol);
MSG_WriteCoord(&sv.datagram, PRVM_G_VECTOR(OFS_PARM1)[2], sv.protocol);
// count
- MSG_WriteByte(&sv.datagram, PRVM_G_FLOAT(OFS_PARM2));
+ MSG_WriteByte(&sv.datagram, (int)PRVM_G_FLOAT(OFS_PARM2));
}
void clippointtosurface(model_t *model, msurface_t *surface, vec3_t p, vec3_t out)
int modelindex;
if (!ed || ed->priv.server->free)
return NULL;
- modelindex = ed->fields.server->modelindex;
+ modelindex = (int)ed->fields.server->modelindex;
if (modelindex < 1 || modelindex >= MAX_MODELS)
return NULL;
return sv.models[modelindex];
model_t *model;
msurface_t *surface;
// return 0 if no such surface
- if (!(model = getmodel(PRVM_G_EDICT(OFS_PARM0))) || !(surface = getsurface(model, PRVM_G_FLOAT(OFS_PARM1))))
+ if (!(model = getmodel(PRVM_G_EDICT(OFS_PARM0))) || !(surface = getsurface(model, (int)PRVM_G_FLOAT(OFS_PARM1))))
{
PRVM_G_FLOAT(OFS_RETURN) = 0;
return;
int pointnum;
VectorClear(PRVM_G_VECTOR(OFS_RETURN));
ed = PRVM_G_EDICT(OFS_PARM0);
- if (!(model = getmodel(ed)) || !(surface = getsurface(model, PRVM_G_FLOAT(OFS_PARM1))))
+ if (!(model = getmodel(ed)) || !(surface = getsurface(model, (int)PRVM_G_FLOAT(OFS_PARM1))))
return;
// note: this (incorrectly) assumes it is a simple polygon
- pointnum = PRVM_G_FLOAT(OFS_PARM2);
+ pointnum = (int)PRVM_G_FLOAT(OFS_PARM2);
if (pointnum < 0 || pointnum >= surface->num_vertices)
return;
// FIXME: implement rotation/scaling
msurface_t *surface;
vec3_t normal;
VectorClear(PRVM_G_VECTOR(OFS_RETURN));
- if (!(model = getmodel(PRVM_G_EDICT(OFS_PARM0))) || !(surface = getsurface(model, PRVM_G_FLOAT(OFS_PARM1))))
+ if (!(model = getmodel(PRVM_G_EDICT(OFS_PARM0))) || !(surface = getsurface(model, (int)PRVM_G_FLOAT(OFS_PARM1))))
return;
// FIXME: implement rotation/scaling
// note: this (incorrectly) assumes it is a simple polygon
model_t *model;
msurface_t *surface;
PRVM_G_INT(OFS_RETURN) = 0;
- if (!(model = getmodel(PRVM_G_EDICT(OFS_PARM0))) || !(surface = getsurface(model, PRVM_G_FLOAT(OFS_PARM1))))
+ if (!(model = getmodel(PRVM_G_EDICT(OFS_PARM0))) || !(surface = getsurface(model, (int)PRVM_G_FLOAT(OFS_PARM1))))
return;
PRVM_G_INT(OFS_RETURN) = PRVM_SetEngineString(surface->texture->name);
}
vec3_t p, out;
VectorClear(PRVM_G_VECTOR(OFS_RETURN));
ed = PRVM_G_EDICT(OFS_PARM0);
- if (!(model = getmodel(ed)) || !(surface = getsurface(model, PRVM_G_FLOAT(OFS_PARM1))))
+ if (!(model = getmodel(ed)) || !(surface = getsurface(model, (int)PRVM_G_FLOAT(OFS_PARM1))))
return;
// FIXME: implement rotation/scaling
VectorSubtract(PRVM_G_VECTOR(OFS_PARM2), ed->fields.server->origin, p);
modelindex = (int)tagentity->fields.server->modelindex;
if (modelindex >= 0 && modelindex < MAX_MODELS && (model = sv.models[modelindex]))
{
- v->_float = Mod_Alias_GetTagIndexForName(model, tagentity->fields.server->skin, tagname);
+ v->_float = Mod_Alias_GetTagIndexForName(model, (int)tagentity->fields.server->skin, tagname);
if (v->_float == 0)
Con_DPrintf("setattachment(edict %i, edict %i, string \"%s\"): tried to find tag named \"%s\" on entity %i (model \"%s\") but could not find it\n", PRVM_NUM_FOR_EDICT(e), PRVM_NUM_FOR_EDICT(tagentity), tagname, tagname, PRVM_NUM_FOR_EDICT(tagentity), model->name);
}
int i;
model_t *model;
- i = e->fields.server->modelindex;
+ i = (int)e->fields.server->modelindex;
if (i < 1 || i >= MAX_MODELS)
return -1;
model = sv.models[i];
- return Mod_Alias_GetTagIndexForName(model, e->fields.server->skin, tagname);
+ return Mod_Alias_GetTagIndexForName(model, (int)e->fields.server->skin, tagname);
};
void SV_GetEntityMatrix (prvm_edict_t *ent, matrix4x4_t *out, qboolean viewmatrix)
int frame;
model_t *model;
if (tagindex >= 0
- && (modelindex = ent->fields.server->modelindex) >= 1 && modelindex < MAX_MODELS
+ && (modelindex = (int)ent->fields.server->modelindex) >= 1 && modelindex < MAX_MODELS
&& (model = sv.models[(int)ent->fields.server->modelindex])
&& model->animscenes)
{
// next iteration we process the parent entity
if ((val = PRVM_GETEDICTFIELDVALUE(ent, eval_tag_entity)) && val->edict)
{
- tagindex = PRVM_GETEDICTFIELDVALUE(ent, eval_tag_index)->_float;
+ tagindex = (int)PRVM_GETEDICTFIELDVALUE(ent, eval_tag_index)->_float;
ent = PRVM_EDICT_NUM(val->edict);
}
else
{
if ((cliptext = GlobalLock (hClipboardData)) != 0)
{
- data = malloc (GlobalSize(hClipboardData)+1);
+ data = Z_Malloc (GlobalSize(hClipboardData)+1);
strcpy (data, cliptext);
GlobalUnlock (hClipboardData);
}
{
if ((cliptext = GlobalLock (hClipboardData)) != 0)
{
- data = malloc (GlobalSize(hClipboardData)+1);
+ data = Z_Malloc (GlobalSize(hClipboardData)+1);
strcpy (data, cliptext);
GlobalUnlock (hClipboardData);
}
-d (yummyluv) feature darkplaces protocol: add buttons 9-16 (yummyluv)
-f (James D) bug darkplaces server: losing runes on episode completion, completing episode 1 then 2 then 3 causes it to forget 1, then 4 causes it to forget 2 and 3, making it impossible to open the boss gate (James D)
-f (Wazat) bug darkplaces: client's slowmo detection (measuring packet times and comparing to game time changes) may be making the game unpleasant (Wazat)
+0 bug dpmod: go through http://www.inside3d.com/qip/q1/bugsmap.htm and fix map bugs by using replacement .ent files (Lardarse)
+0 bug dpmod: the id1 map e2m4 has a bug where 4 scrags don't spawn in normal/hard skills because of a mislinked trigger, the Quake Done Quick team figured this out and a trigger_relay with target "t58" should be changed to target "t66" (Lardarse)
0 bug darkplaces client/server: viewzoom values above 1 are not working properly
0 bug darkplaces client: GAME_NEHAHRA: make sure cutscenes and movies work, got a report of seeing a black screen (NightFright)
0 bug darkplaces client: fix cl_bobmodel bug which momentarily jolts the gun when you pass through a trigger, pick up an item, etc, Sajt thinks this is related to console prints as well as centerprint (Sajt)
vid_gammarampsize = rampsize;
if (vid_gammaramps)
Z_Free(vid_gammaramps);
- vid_gammaramps = Z_Malloc(6 * vid_gammarampsize * sizeof(unsigned short));
+ vid_gammaramps = (unsigned short *)Z_Malloc(6 * vid_gammarampsize * sizeof(unsigned short));
vid_systemgammaramps = vid_gammaramps + 3 * vid_gammarampsize;
}
Cvar_SetValueQuick(&vid_hardwaregammasupported, VID_GetGamma(vid_systemgammaramps, vid_gammarampsize));
for (x = 0, ramp = vid_gammaramps;x < 3;x++)
for (y = 0, t = n[x] - 0.75f;y < vid_gammarampsize;y++, t += 0.75f * (2.0f / vid_gammarampsize))
- *ramp++ = cos(t*(M_PI*2.0)) * 32767.0f + 32767.0f;
+ *ramp++ = (unsigned short)(cos(t*(M_PI*2.0)) * 32767.0f + 32767.0f);
}
Cvar_SetValueQuick(&vid_hardwaregammasupported, VID_SetGamma(vid_gammaramps, vid_gammarampsize));
cl.faceanimtime = cl.time + 0.2; // put sbar face into pain frame
- cl.cshifts[CSHIFT_DAMAGE].percent += 3*count;
+ cl.cshifts[CSHIFT_DAMAGE].percent += (int)(3*count);
if (cl.cshifts[CSHIFT_DAMAGE].percent < 0)
cl.cshifts[CSHIFT_DAMAGE].percent = 0;
if (cl.cshifts[CSHIFT_DAMAGE].percent > 150)
void V_FadeViewFlashs(void)
{
// drop the damage value
- cl.cshifts[CSHIFT_DAMAGE].percent -= (cl.time - cl.oldtime)*150;
+ cl.cshifts[CSHIFT_DAMAGE].percent -= (int)((cl.time - cl.oldtime)*150);
if (cl.cshifts[CSHIFT_DAMAGE].percent <= 0)
cl.cshifts[CSHIFT_DAMAGE].percent = 0;
// drop the bonus value
- cl.cshifts[CSHIFT_BONUS].percent -= (cl.time - cl.oldtime)*100;
+ cl.cshifts[CSHIFT_BONUS].percent -= (int)((cl.time - cl.oldtime)*100);
if (cl.cshifts[CSHIFT_BONUS].percent <= 0)
cl.cshifts[CSHIFT_BONUS].percent = 0;
}
if (ent->fields.server->solid == SOLID_BSP)
{
- int modelindex = ent->fields.server->modelindex;
+ int modelindex = (int)ent->fields.server->modelindex;
if (modelindex < 0 || modelindex > MAX_MODELS)
{
Con_Printf("edict %i: SOLID_BSP with invalid modelindex!\n", PRVM_NUM_FOR_EDICT(ent));
if ((int) ent->fields.server->solid == SOLID_BSP || movetype == MOVE_HITMODEL)
{
- unsigned int modelindex = ent->fields.server->modelindex;
+ unsigned int modelindex = (unsigned int)ent->fields.server->modelindex;
// if the modelindex is 0, it shouldn't be SOLID_BSP!
if (modelindex == 0)
{
if (ent->fields.client->solid == SOLID_BSP)
{
- int modelindex = ent->fields.client->modelindex;
+ int modelindex = (int)ent->fields.client->modelindex;
if (modelindex < 0 || modelindex > MAX_MODELS)
{
Con_Printf("edict %i: SOLID_BSP with invalid modelindex!\n", PRVM_NUM_FOR_EDICT(ent));
if ((int) ent->fields.client->solid == SOLID_BSP || movetype == MOVE_HITMODEL)
{
- unsigned int modelindex = ent->fields.client->modelindex;
+ unsigned int modelindex = (unsigned int)ent->fields.client->modelindex;
// if the modelindex is 0, it shouldn't be SOLID_BSP!
if (modelindex == 0)
{