}
-void CDAudio_SysSetVolume (float volume)
+void CDAudio_SysSetVolume (float fvolume)
{
}
}
-void CDAudio_SysSetVolume (float volume)
+void CDAudio_SysSetVolume (float fvolume)
{
}
}
-void CDAudio_SysSetVolume (float volume)
+void CDAudio_SysSetVolume (float fvolume)
{
// IMPLEMENTME
}
if( wishspeed > curspeed * 1.01f )
{
- float accelspeed = curspeed + airforwardaccel * cl.movevars_maxairspeed * s->cmd.frametime;
- if( accelspeed < wishspeed )
- wishspeed = accelspeed;
+ float faccelspeed = curspeed + airforwardaccel * cl.movevars_maxairspeed * s->cmd.frametime;
+ if( faccelspeed < wishspeed )
+ wishspeed = faccelspeed;
}
else
{
// if cl_netrepeatinput is 1 and client framerate matches server
// framerate, this is 10 bytes, if client framerate is lower this
// will be more...
- int i, j;
unsigned int oldsequence = cl.cmd.sequence;
unsigned int delta = bound(1, cl_netrepeatinput.integer + 1, 3);
if (oldsequence > delta)
vec3_t pos;
int channel, ent;
int sound_num;
- int volume;
+ int nvolume;
int field_mask;
float attenuation;
float speed;
channel = MSG_ReadShort(&cl_message);
if (channel & (1<<15))
- volume = MSG_ReadByte(&cl_message);
+ nvolume = MSG_ReadByte(&cl_message);
else
- volume = DEFAULT_SOUND_PACKET_VOLUME;
+ nvolume = DEFAULT_SOUND_PACKET_VOLUME;
if (channel & (1<<14))
attenuation = MSG_ReadByte(&cl_message) / 64.0;
field_mask = MSG_ReadByte(&cl_message);
if (field_mask & SND_VOLUME)
- volume = MSG_ReadByte(&cl_message);
+ nvolume = MSG_ReadByte(&cl_message);
else
- volume = DEFAULT_SOUND_PACKET_VOLUME;
+ nvolume = DEFAULT_SOUND_PACKET_VOLUME;
if (field_mask & SND_ATTENUATION)
attenuation = MSG_ReadByte(&cl_message) / 64.0;
if (ent >= cl.max_entities)
CL_ExpandEntities(ent);
- if( !CL_VM_Event_Sound(sound_num, volume / 255.0f, channel, attenuation, ent, pos, fflags, speed) )
- S_StartSound_StartPosition_Flags (ent, channel, cl.sound_precache[sound_num], pos, volume/255.0f, attenuation, 0, fflags, speed);
+ if( !CL_VM_Event_Sound(sound_num, nvolume / 255.0f, channel, attenuation, ent, pos, fflags, speed) )
+ S_StartSound_StartPosition_Flags (ent, channel, cl.sound_precache[sound_num], pos, nvolume/255.0f, attenuation, 0, fflags, speed);
}
/*
if (!cmdlogname[cmdindex])
{
// LordHavoc: fix for bizarre problem in MSVC that I do not understand (if I assign the string pointer directly it ends up storing a NULL pointer)
- temp = "<unknown>";
- cmdlogname[cmdindex] = temp;
+ const char *d = "<unknown>";
+ cmdlogname[cmdindex] = d;
}
// other commands
{
default:
{
- char description[32*64], temp[64];
+ char description[32*64], logtemp[64];
int count;
strlcpy(description, "packet dump: ", sizeof(description));
i = cmdcount - 32;
i &= 31;
while(count > 0)
{
- dpsnprintf(temp, sizeof(temp), "%3i:%s ", cmdlog[i], cmdlogname[i]);
- strlcat(description, temp, sizeof(description));
+ dpsnprintf(logtemp, sizeof(logtemp), "%3i:%s ", cmdlog[i], cmdlogname[i]);
+ strlcat(description, logtemp, sizeof(description));
count--;
i++;
i &= 31;
if (!cmdlogname[cmdindex])
{
// LordHavoc: fix for bizarre problem in MSVC that I do not understand (if I assign the string pointer directly it ends up storing a NULL pointer)
- temp = "<unknown>";
- cmdlogname[cmdindex] = temp;
+ const char *d = "<unknown>";
+ cmdlogname[cmdindex] = d;
}
// other commands
{
default:
{
- char description[32*64], temp[64];
+ char description[32*64], tempdesc[64];
int count;
strlcpy (description, "packet dump: ", sizeof(description));
i = cmdcount - 32;
i &= 31;
while(count > 0)
{
- dpsnprintf (temp, sizeof (temp), "%3i:%s ", cmdlog[i], cmdlogname[i]);
- strlcat (description, temp, sizeof (description));
+ dpsnprintf (tempdesc, sizeof (tempdesc), "%3i:%s ", cmdlog[i], cmdlogname[i]);
+ strlcat (description, tempdesc, sizeof (description));
count--;
i++;
i &= 31;
}
else
{
- int i = (unsigned short)MSG_ReadShort(&cl_message);
- char *s = MSG_ReadString(&cl_message, cl_readstring, sizeof(cl_readstring));
+ char *s;
+ i = (unsigned short)MSG_ReadShort(&cl_message);
+ s = MSG_ReadString(&cl_message, cl_readstring, sizeof(cl_readstring));
if (i < 32768)
{
if (i >= 1 && i < MAX_MODELS)
{
int i;
particle_t *part2;
- float lifetime = part->die - cl.time;
vec3_t endvec;
trace_t trace;
// turn raindrop into simple spark and create delayedspawn splash effect
static void CL_ParticleEffect_Fallback(int effectnameindex, float count, const vec3_t originmins, const vec3_t originmaxs, const vec3_t velocitymins, const vec3_t velocitymaxs, entity_t *ent, int palettecolor, qboolean spawndlight, qboolean spawnparticles, qboolean wanttrail)
{
vec3_t center;
- matrix4x4_t tempmatrix;
+ matrix4x4_t lightmatrix;
particle_t *part;
VectorLerp(originmins, 0.5, originmaxs, center);
- Matrix4x4_CreateTranslate(&tempmatrix, center[0], center[1], center[2]);
+ Matrix4x4_CreateTranslate(&lightmatrix, center[0], center[1], center[2]);
if (effectnameindex == EFFECT_SVC_PARTICLE)
{
if (cl_particles.integer)
// bullet hole
R_Stain(center, 16, 40, 40, 40, 64, 88, 88, 88, 64);
CL_SpawnDecalParticleForPoint(center, 6, 3, 255, tex_bulletdecal[rand()&7], 0xFFFFFF, 0xFFFFFF);
- CL_AllocLightFlash(NULL, &tempmatrix, 100, 0.15f, 0.15f, 1.5f, 500, 0.2, 0, -1, true, 1, 0.25, 1, 0, 0, LIGHTFLAG_NORMALMODE | LIGHTFLAG_REALTIMEMODE);
+ CL_AllocLightFlash(NULL, &lightmatrix, 100, 0.15f, 0.15f, 1.5f, 500, 0.2, 0, -1, true, 1, 0.25, 1, 0, 0, LIGHTFLAG_NORMALMODE | LIGHTFLAG_REALTIMEMODE);
}
else if (effectnameindex == EFFECT_TE_SUPERSPIKE)
{
// bullet hole
R_Stain(center, 16, 40, 40, 40, 64, 88, 88, 88, 64);
CL_SpawnDecalParticleForPoint(center, 6, 3, 255, tex_bulletdecal[rand()&7], 0xFFFFFF, 0xFFFFFF);
- CL_AllocLightFlash(NULL, &tempmatrix, 100, 0.15f, 0.15f, 1.5f, 500, 0.2, 0, -1, true, 1, 0.25, 1, 0, 0, LIGHTFLAG_NORMALMODE | LIGHTFLAG_REALTIMEMODE);
+ CL_AllocLightFlash(NULL, &lightmatrix, 100, 0.15f, 0.15f, 1.5f, 500, 0.2, 0, -1, true, 1, 0.25, 1, 0, 0, LIGHTFLAG_NORMALMODE | LIGHTFLAG_REALTIMEMODE);
}
else if (effectnameindex == EFFECT_TE_BLOOD)
{
// plasma scorch mark
R_Stain(center, 40, 40, 40, 40, 64, 88, 88, 88, 64);
CL_SpawnDecalParticleForPoint(center, 6, 6, 255, tex_bulletdecal[rand()&7], 0xFFFFFF, 0xFFFFFF);
- CL_AllocLightFlash(NULL, &tempmatrix, 200, 1, 1, 1, 1000, 0.2, 0, -1, true, 1, 0.25, 1, 0, 0, LIGHTFLAG_NORMALMODE | LIGHTFLAG_REALTIMEMODE);
+ CL_AllocLightFlash(NULL, &lightmatrix, 200, 1, 1, 1, 1000, 0.2, 0, -1, true, 1, 0.25, 1, 0, 0, LIGHTFLAG_NORMALMODE | LIGHTFLAG_REALTIMEMODE);
}
else if (effectnameindex == EFFECT_TE_GUNSHOT)
{
// bullet hole
R_Stain(center, 16, 40, 40, 40, 64, 88, 88, 88, 64);
CL_SpawnDecalParticleForPoint(center, 6, 3, 255, tex_bulletdecal[rand()&7], 0xFFFFFF, 0xFFFFFF);
- CL_AllocLightFlash(NULL, &tempmatrix, 100, 0.15f, 0.15f, 1.5f, 500, 0.2, 0, -1, true, 1, 0.25, 1, 0, 0, LIGHTFLAG_NORMALMODE | LIGHTFLAG_REALTIMEMODE);
+ CL_AllocLightFlash(NULL, &lightmatrix, 100, 0.15f, 0.15f, 1.5f, 500, 0.2, 0, -1, true, 1, 0.25, 1, 0, 0, LIGHTFLAG_NORMALMODE | LIGHTFLAG_REALTIMEMODE);
}
else if (effectnameindex == EFFECT_TE_EXPLOSION)
{
CL_ParticleExplosion(center);
- CL_AllocLightFlash(NULL, &tempmatrix, 350, 4.0f, 2.0f, 0.50f, 700, 0.5, 0, -1, true, 1, 0.25, 0.25, 1, 1, LIGHTFLAG_NORMALMODE | LIGHTFLAG_REALTIMEMODE);
+ CL_AllocLightFlash(NULL, &lightmatrix, 350, 4.0f, 2.0f, 0.50f, 700, 0.5, 0, -1, true, 1, 0.25, 0.25, 1, 1, LIGHTFLAG_NORMALMODE | LIGHTFLAG_REALTIMEMODE);
}
else if (effectnameindex == EFFECT_TE_EXPLOSIONQUAD)
{
CL_ParticleExplosion(center);
- CL_AllocLightFlash(NULL, &tempmatrix, 350, 2.5f, 2.0f, 4.0f, 700, 0.5, 0, -1, true, 1, 0.25, 0.25, 1, 1, LIGHTFLAG_NORMALMODE | LIGHTFLAG_REALTIMEMODE);
+ CL_AllocLightFlash(NULL, &lightmatrix, 350, 2.5f, 2.0f, 4.0f, 700, 0.5, 0, -1, true, 1, 0.25, 0.25, 1, 1, LIGHTFLAG_NORMALMODE | LIGHTFLAG_REALTIMEMODE);
}
else if (effectnameindex == EFFECT_TE_TAREXPLOSION)
{
}
else
CL_ParticleExplosion(center);
- CL_AllocLightFlash(NULL, &tempmatrix, 600, 1.6f, 0.8f, 2.0f, 1200, 0.5, 0, -1, true, 1, 0.25, 0.25, 1, 1, LIGHTFLAG_NORMALMODE | LIGHTFLAG_REALTIMEMODE);
+ CL_AllocLightFlash(NULL, &lightmatrix, 600, 1.6f, 0.8f, 2.0f, 1200, 0.5, 0, -1, true, 1, 0.25, 0.25, 1, 1, LIGHTFLAG_NORMALMODE | LIGHTFLAG_REALTIMEMODE);
}
else if (effectnameindex == EFFECT_TE_SMALLFLASH)
- CL_AllocLightFlash(NULL, &tempmatrix, 200, 2, 2, 2, 1000, 0.2, 0, -1, true, 1, 0.25, 0.25, 1, 1, LIGHTFLAG_NORMALMODE | LIGHTFLAG_REALTIMEMODE);
+ CL_AllocLightFlash(NULL, &lightmatrix, 200, 2, 2, 2, 1000, 0.2, 0, -1, true, 1, 0.25, 0.25, 1, 1, LIGHTFLAG_NORMALMODE | LIGHTFLAG_REALTIMEMODE);
else if (effectnameindex == EFFECT_TE_FLAMEJET)
{
count *= cl_particles_quality.value;
}
if (!cl_particles_quake.integer)
CL_NewParticle(center, pt_static, 0xffffff, 0xffffff, tex_particle, 30, 0, 256, 512, 0, 0, center[0], center[1], center[2], 0, 0, 0, 0, 0, 0, 0, false, 0, 1, PBLEND_ADD, PARTICLE_BILLBOARD, -1, -1, -1, 1, 1, 0, 0, NULL);
- CL_AllocLightFlash(NULL, &tempmatrix, 200, 2.0f, 2.0f, 2.0f, 400, 99.0f, 0, -1, true, 1, 0.25, 1, 0, 0, LIGHTFLAG_NORMALMODE | LIGHTFLAG_REALTIMEMODE);
+ CL_AllocLightFlash(NULL, &lightmatrix, 200, 2.0f, 2.0f, 2.0f, 400, 99.0f, 0, -1, true, 1, 0.25, 1, 0, 0, LIGHTFLAG_NORMALMODE | LIGHTFLAG_REALTIMEMODE);
}
else if (effectnameindex == EFFECT_TE_TEI_G3)
CL_NewParticle(center, pt_beam, 0xFFFFFF, 0xFFFFFF, tex_beam, 8, 0, 256, 256, 0, 0, originmins[0], originmins[1], originmins[2], originmaxs[0], originmaxs[1], originmaxs[2], 0, 0, 0, 0, false, 0, 1, PBLEND_ADD, PARTICLE_HBEAM, -1, -1, -1, 1, 1, 0, 0, NULL);
else if (effectnameindex == EFFECT_TE_TEI_BIGEXPLOSION)
{
CL_ParticleExplosion(center);
- CL_AllocLightFlash(NULL, &tempmatrix, 500, 2.5f, 2.0f, 1.0f, 500, 9999, 0, -1, true, 1, 0.25, 0.5, 1, 1, LIGHTFLAG_NORMALMODE | LIGHTFLAG_REALTIMEMODE);
+ CL_AllocLightFlash(NULL, &lightmatrix, 500, 2.5f, 2.0f, 1.0f, 500, 9999, 0, -1, true, 1, 0.25, 0.5, 1, 1, LIGHTFLAG_NORMALMODE | LIGHTFLAG_REALTIMEMODE);
}
else if (effectnameindex == EFFECT_TE_TEI_PLASMAHIT)
{
if (cl_particles_sparks.integer)
for (f = 0;f < count;f += 1.0f / cl_particles_quality.value)
CL_NewParticle(center, pt_spark, 0x2030FF, 0x80C0FF, tex_particle, 2.0f, 0, lhrandom(64, 255), 512, 0, 0, lhrandom(originmins[0], originmaxs[0]), lhrandom(originmins[1], originmaxs[1]), lhrandom(originmins[2], originmaxs[2]), lhrandom(velocitymins[0], velocitymaxs[0]), lhrandom(velocitymins[1], velocitymaxs[1]), lhrandom(velocitymins[2], velocitymaxs[2]), 0, 0, 0, 465, true, 0, 1, PBLEND_ADD, PARTICLE_SPARK, -1, -1, -1, 1, 1, 0, 0, NULL);
- CL_AllocLightFlash(NULL, &tempmatrix, 500, 0.6f, 1.2f, 2.0f, 2000, 9999, 0, -1, true, 1, 0.25, 0.25, 1, 1, LIGHTFLAG_NORMALMODE | LIGHTFLAG_REALTIMEMODE);
+ CL_AllocLightFlash(NULL, &lightmatrix, 500, 0.6f, 1.2f, 2.0f, 2000, 9999, 0, -1, true, 1, 0.25, 0.25, 1, 1, LIGHTFLAG_NORMALMODE | LIGHTFLAG_REALTIMEMODE);
}
else if (effectnameindex == EFFECT_EF_FLAME)
{
count *= 300 * cl_particles_quality.value;
while (count-- > 0)
CL_NewParticle(center, pt_smoke, 0x6f0f00, 0xe3974f, tex_particle, 4, 0, lhrandom(64, 128), 384, -1, 0, lhrandom(originmins[0], originmaxs[0]), lhrandom(originmins[1], originmaxs[1]), lhrandom(originmins[2], originmaxs[2]), lhrandom(velocitymins[0], velocitymaxs[0]), lhrandom(velocitymins[1], velocitymaxs[1]), lhrandom(velocitymins[2], velocitymaxs[2]), 1, 4, 16, 128, true, 0, 1, PBLEND_ADD, PARTICLE_BILLBOARD, -1, -1, -1, 1, 1, 0, 0, NULL);
- CL_AllocLightFlash(NULL, &tempmatrix, 200, 2.0f, 1.5f, 0.5f, 0, 0, 0, -1, true, 1, 0.25, 0.25, 1, 1, LIGHTFLAG_NORMALMODE | LIGHTFLAG_REALTIMEMODE);
+ CL_AllocLightFlash(NULL, &lightmatrix, 200, 2.0f, 1.5f, 0.5f, 0, 0, 0, -1, true, 1, 0.25, 0.25, 1, 1, LIGHTFLAG_NORMALMODE | LIGHTFLAG_REALTIMEMODE);
}
else if (effectnameindex == EFFECT_EF_STARDUST)
{
count *= 200 * cl_particles_quality.value;
while (count-- > 0)
CL_NewParticle(center, pt_static, 0x903010, 0xFFD030, tex_particle, 4, 0, lhrandom(64, 128), 128, 1, 0, lhrandom(originmins[0], originmaxs[0]), lhrandom(originmins[1], originmaxs[1]), lhrandom(originmins[2], originmaxs[2]), lhrandom(velocitymins[0], velocitymaxs[0]), lhrandom(velocitymins[1], velocitymaxs[1]), lhrandom(velocitymins[2], velocitymaxs[2]), 0.2, 0.8, 16, 128, true, 0, 1, PBLEND_ADD, PARTICLE_BILLBOARD, -1, -1, -1, 1, 1, 0, 0, NULL);
- CL_AllocLightFlash(NULL, &tempmatrix, 200, 1.0f, 0.7f, 0.3f, 0, 0, 0, -1, true, 1, 0.25, 0.25, 1, 1, LIGHTFLAG_NORMALMODE | LIGHTFLAG_REALTIMEMODE);
+ CL_AllocLightFlash(NULL, &lightmatrix, 200, 1.0f, 0.7f, 0.3f, 0, 0, 0, -1, true, 1, 0.25, 0.25, 1, 1, LIGHTFLAG_NORMALMODE | LIGHTFLAG_REALTIMEMODE);
}
else if (!strncmp(particleeffectname[effectnameindex], "TR_", 3))
{
vec3_t dir, pos;
float len, dec, qd;
- int smoke, blood, bubbles, r, color, count;
+ int smoke, blood, bubbles, r, color, spawnedcount;
if (spawndlight && r_refdef.scene.numlights < MAX_DLIGHTS)
{
if (light[3])
{
- matrix4x4_t tempmatrix;
- Matrix4x4_CreateFromQuakeEntity(&tempmatrix, originmaxs[0], originmaxs[1], originmaxs[2], 0, 0, 0, light[3]);
- R_RTLight_Update(&r_refdef.scene.templights[r_refdef.scene.numlights], false, &tempmatrix, light, -1, NULL, true, 1, 0.25, 0, 1, 1, LIGHTFLAG_NORMALMODE | LIGHTFLAG_REALTIMEMODE);
+ matrix4x4_t traillightmatrix;
+ Matrix4x4_CreateFromQuakeEntity(&traillightmatrix, originmaxs[0], originmaxs[1], originmaxs[2], 0, 0, 0, light[3]);
+ R_RTLight_Update(&r_refdef.scene.templights[r_refdef.scene.numlights], false, &traillightmatrix, light, -1, NULL, true, 1, 0.25, 0, 1, 1, LIGHTFLAG_NORMALMODE | LIGHTFLAG_REALTIMEMODE);
r_refdef.scene.lights[r_refdef.scene.numlights] = &r_refdef.scene.templights[r_refdef.scene.numlights];r_refdef.scene.numlights++;
}
}
blood = cl_particles.integer && cl_particles_blood.integer;
bubbles = cl_particles.integer && cl_particles_bubbles.integer && !cl_particles_quake.integer && (CL_PointSuperContents(pos) & (SUPERCONTENTS_WATER | SUPERCONTENTS_SLIME));
qd = 1.0f / cl_particles_quality.value;
- count = 0;
+ spawnedcount = 0;
- while (len >= 0 && ++count <= 16384)
+ while (len >= 0 && ++spawnedcount <= 16384)
{
dec = 3;
if (blood)
extern float viewscalefpsadjusted;
static void R_TimeReport_EndFrame(void)
{
- int i, j, lines, y;
+ int j, lines;
cl_locnode_t *loc;
char string[1024+4096];
mleaf_t *viewleaf;
if (string[0])
{
+ int i, y;
if (string[strlen(string)-1] == '\n')
string[strlen(string)-1] = 0;
lines = 1;
if (r_speeds_graph.integer)
{
// if we currently have no graph data, reset the graph data entirely
+ int i;
if (!cls.r_speeds_graph_data)
for (i = 0;i < r_stat_count;i++)
cls.r_speeds_graph_datamin[i] = cls.r_speeds_graph_datamax[i] = 0;
if (cls.r_speeds_graph_length != r_speeds_graph_length.integer)
{
- int i, stat, index, d, graph_length, *graph_data;
+ int stat, index, d, graph_length, *graph_data;
cls.r_speeds_graph_length = r_speeds_graph_length.integer;
cls.r_speeds_graph_current = 0;
if (cls.r_speeds_graph_data)
{
char legend[128];
r_vertexgeneric_t *v;
- int numlines;
+ int i, numlines;
const int *data;
float x, y, width, height, scalex, scaley;
int range_default = max(r_speeds_graph_maxdefault.integer, 1);
if (qglPolygonStipple && !scr_stipple.integer && cl_video_stipple.integer)
{
GLubyte stipple[128];
- int i, s, width, parts;
+ int s, width, parts;
s = cl_video_stipple.integer;
parts = (s & 007);
const char *sample;
int channel;
prvm_edict_t *entity;
- float volume;
+ float fvolume;
float attenuation;
float pitchchange;
float startposition;
entity = PRVM_G_EDICT(OFS_PARM0);
channel = (int)PRVM_G_FLOAT(OFS_PARM1);
sample = PRVM_G_STRING(OFS_PARM2);
- volume = PRVM_G_FLOAT(OFS_PARM3);
+ fvolume = PRVM_G_FLOAT(OFS_PARM3);
attenuation = PRVM_G_FLOAT(OFS_PARM4);
- if (volume < 0 || volume > 1)
+ if (fvolume < 0 || fvolume > 1)
{
VM_Warning(prog, "VM_CL_sound: volume must be in range 0-1\n");
return;
}
CL_VM_GetEntitySoundOrigin(MAX_EDICTS + PRVM_NUM_FOR_EDICT(entity), org);
- S_StartSound_StartPosition_Flags(MAX_EDICTS + PRVM_NUM_FOR_EDICT(entity), channel, S_FindName(sample), org, volume, attenuation, startposition, flags, pitchchange > 0.0f ? pitchchange * 0.01f : 1.0f);
+ S_StartSound_StartPosition_Flags(MAX_EDICTS + PRVM_NUM_FOR_EDICT(entity), channel, S_FindName(sample), org, fvolume, attenuation, startposition, flags, pitchchange > 0.0f ? pitchchange * 0.01f : 1.0f);
}
// #483 void(vector origin, string sample, float volume, float attenuation) pointsound
static void VM_CL_pointsound(prvm_prog_t *prog)
{
const char *sample;
- float volume;
+ float fvolume;
float attenuation;
vec3_t org;
VectorCopy( PRVM_G_VECTOR(OFS_PARM0), org);
sample = PRVM_G_STRING(OFS_PARM1);
- volume = PRVM_G_FLOAT(OFS_PARM2);
+ fvolume = PRVM_G_FLOAT(OFS_PARM2);
attenuation = PRVM_G_FLOAT(OFS_PARM3);
- if (volume < 0 || volume > 1)
+ if (fvolume < 0 || fvolume > 1)
{
VM_Warning(prog, "VM_CL_pointsound: volume must be in range 0-1\n");
return;
}
// Send World Entity as Entity to Play Sound (for CSQC, that is MAX_EDICTS)
- S_StartSound(MAX_EDICTS, 0, S_FindName(sample), org, volume, attenuation);
+ S_StartSound(MAX_EDICTS, 0, S_FindName(sample), org, fvolume, attenuation);
}
// #14 entity() spawn
else
{
// queue the polygon as 3D for sorted transparent rendering later
- int i;
if (polys->max_triangles < polys->num_triangles + polys->begin_vertices-2)
{
while (polys->max_triangles < polys->num_triangles + polys->begin_vertices-2)
colbrushf_t *Collision_NewBrushFromPlanes(mempool_t *mempool, int numoriginalplanes, const colplanef_t *originalplanes, int supercontents, int q3surfaceflags, const texture_t *texture, int hasaabbplanes)
{
// TODO: planesbuf could be replaced by a remapping table
- int j, k, l, m, w, xyzflags;
+ int j, k, w, xyzflags;
int numpointsbuf = 0, maxpointsbuf = 256, numedgedirsbuf = 0, maxedgedirsbuf = 256, numplanesbuf = 0, maxplanesbuf = 256, numelementsbuf = 0, maxelementsbuf = 256;
int isaabb = true;
double maxdist;
// whose polygon is clipped away by the other planes)
for (j = 0;j < numoriginalplanes;j++)
{
+ int n;
// add the new plane
VectorCopy(originalplanes[j].normal, planesbuf[numplanesbuf].normal);
planesbuf[numplanesbuf].dist = originalplanes[j].dist;
// add the unique points for this polygon
for (k = 0;k < pnumpoints;k++)
{
+ int m;
float v[3];
// downgrade to float precision before comparing
VectorCopy(&p[w][k*3], v);
}
// add the unique edgedirs for this polygon
- for (k = 0, l = pnumpoints-1;k < pnumpoints;l = k, k++)
+ for (k = 0, n = pnumpoints-1;k < pnumpoints;n = k, k++)
{
+ int m;
float dir[3];
// downgrade to float precision before comparing
- VectorSubtract(&p[w][k*3], &p[w][l*3], dir);
+ VectorSubtract(&p[w][k*3], &p[w][n*3], dir);
VectorNormalize(dir);
// check if there is already a matching edgedir (no duplicates)
void Collision_CalcPlanesForTriangleBrushFloat(colbrushf_t *brush)
{
- int i;
float edge0[3], edge1[3], edge2[3];
colpointf_t *p;
if (developer_extra.integer)
{
+ int i;
// validity check - will be disabled later
Collision_ValidateBrush(brush);
for (i = 0;i < brush->numplanes;i++)
int startidx;
int nskip = 0;
int continuationWidth = 0;
- size_t l;
+ size_t len;
double t = cl.time; // saved so it won't change
con_text_info_t ti;
ti.ymax = y + height;
ti.continuationString = continuationString;
- l = 0;
- Con_WordWidthFunc(&ti, NULL, &l, -1);
- l = strlen(continuationString);
- continuationWidth = (int) Con_WordWidthFunc(&ti, continuationString, &l, -1);
+ len = 0;
+ Con_WordWidthFunc(&ti, NULL, &len, -1);
+ len = strlen(continuationString);
+ continuationWidth = (int) Con_WordWidthFunc(&ti, continuationString, &len, -1);
// first find the first line to draw by backwards iterating and word wrapping to find their length...
startidx = CON_LINES_COUNT;
{
float width = vid_conwidth.value;
con_text_info_t ti;
- con_lineinfo_t *li = &CON_LINES(lineno);
ti.fontsize = con_textsize.value;
ti.font = FONT_CONSOLE;
li->height = COM_Wordwrap(li->start, li->len, 0, width, Con_WordWidthFunc, &ti, Con_CountLineFunc, NULL);
return CRYPTO_NOMATCH; // will be later accepted if encryption was set up
// validate the challenge
for (i = 0;i < MAX_CHALLENGES;i++)
- if(challenge[i].time > 0)
- if (!LHNETADDRESS_Compare(peeraddress, &challenge[i].address) && !strcmp(challenge[i].string, s))
+ if(challenges[i].time > 0)
+ if (!LHNETADDRESS_Compare(peeraddress, &challenges[i].address) && !strcmp(challenges[i].string, s))
break;
// if the challenge is not recognized, drop the packet
if (i == MAX_CHALLENGES) // challenge mismatch is silent
return Crypto_SoftServerError(data_out, len_out, "missing challenge in d0pk\\0");
// validate the challenge
for (i = 0;i < MAX_CHALLENGES;i++)
- if(challenge[i].time > 0)
- if (!LHNETADDRESS_Compare(peeraddress, &challenge[i].address) && !strcmp(challenge[i].string, s))
+ if(challenges[i].time > 0)
+ if (!LHNETADDRESS_Compare(peeraddress, &challenges[i].address) && !strcmp(challenges[i].string, s))
break;
// if the challenge is not recognized, drop the packet
if (i == MAX_CHALLENGES)
CSQC_END
}
}
-qboolean CL_VM_Event_Sound(int sound_num, float volume, int channel, float attenuation, int ent, vec3_t pos, int flags, float speed)
+qboolean CL_VM_Event_Sound(int sound_num, float fvolume, int channel, float attenuation, int ent, vec3_t pos, int flags, float speed)
{
prvm_prog_t *prog = CLVM_prog;
qboolean r = false;
PRVM_G_FLOAT(OFS_PARM0) = ent;
PRVM_G_FLOAT(OFS_PARM1) = CHAN_ENGINE2USER(channel);
PRVM_G_INT(OFS_PARM2) = PRVM_SetTempString(prog, cl.sound_name[sound_num] );
- PRVM_G_FLOAT(OFS_PARM3) = volume;
+ PRVM_G_FLOAT(OFS_PARM3) = fvolume;
PRVM_G_FLOAT(OFS_PARM4) = attenuation;
VectorCopy(pos, PRVM_G_VECTOR(OFS_PARM5) );
PRVM_G_FLOAT(OFS_PARM6) = speed * 100.0f;
static void DPSOFTRAST_Vertex_Transform(float *out4f, const float *in4f, int numitems, const float *inmatrix16f)
{
#ifdef SSE_POSSIBLE
- static const float identitymatrix[4][4] = {{1,0,0,0},{0,1,0,0},{0,0,1,0},{0,0,0,1}};
+ static const float identitymatrix16f[4][4] = {{1,0,0,0},{0,1,0,0},{0,0,1,0},{0,0,0,1}};
__m128 m0, m1, m2, m3;
float *end;
- if (!memcmp(identitymatrix, inmatrix16f, sizeof(float[16])))
+ if (!memcmp(identitymatrix16f, inmatrix16f, sizeof(float[16])))
{
// fast case for identity matrix
if (out4f != in4f) memcpy(out4f, in4f, numitems * sizeof(float[4]));
static int DPSOFTRAST_Vertex_Project(float *out4f, float *screen4f, int *starty, int *endy, const float *in4f, int numitems)
{
- static const float identitymatrix[16] = {1,0,0,0, 0,1,0,0, 0,0,1,0, 0,0,0,1};
+ static const float identitymatrix16f[16] = {1,0,0,0, 0,1,0,0, 0,0,1,0, 0,0,0,1};
float *end = out4f + numitems*4;
__m128 viewportcenter = _mm_load_ps(dpsoftrast.fb_viewportcenter), viewportscale = _mm_load_ps(dpsoftrast.fb_viewportscale);
__m128 minpos, maxpos;
ALIGN(float maxposf[4]);
_mm_store_ps(minposf, minpos);
_mm_store_ps(maxposf, maxpos);
- return DPSOFTRAST_Vertex_BoundY(starty, endy, minposf, maxposf, identitymatrix);
+ return DPSOFTRAST_Vertex_BoundY(starty, endy, minposf, maxposf, identitymatrix16f);
}
return 0;
}
static int DPSOFTRAST_Vertex_TransformProject(float *out4f, float *screen4f, int *starty, int *endy, const float *in4f, int numitems, const float *inmatrix16f)
{
- static const float identitymatrix[16] = {1,0,0,0, 0,1,0,0, 0,0,1,0, 0,0,0,1};
+ static const float identitymatrix16f[16] = {1,0,0,0, 0,1,0,0, 0,0,1,0, 0,0,0,1};
__m128 m0, m1, m2, m3, viewportcenter, viewportscale, minpos, maxpos;
float *end;
- if (!memcmp(identitymatrix, inmatrix16f, sizeof(float[16])))
+ if (!memcmp(identitymatrix16f, inmatrix16f, sizeof(float[16])))
return DPSOFTRAST_Vertex_Project(out4f, screen4f, starty, endy, in4f, numitems);
end = out4f + numitems*4;
viewportcenter = _mm_load_ps(dpsoftrast.fb_viewportcenter);
pixelbase = (unsigned char *)texture->bytes + texture->mipmap[mip][0] + texture->mipmap[mip][1] - 4*width;
if(texture->filter & DPSOFTRAST_TEXTURE_FILTER_LINEAR)
{
- unsigned int tc[2] = { x * (width<<12) - 2048, y * (height<<12) - 2048};
+ unsigned int tc[2] = { (unsigned int)floor(x) * (width<<12) - 2048, (unsigned int)floor(y) * (height<<12) - 2048};
unsigned int frac[2] = { tc[0]&0xFFF, tc[1]&0xFFF };
unsigned int ifrac[2] = { 0x1000 - frac[0], 0x1000 - frac[1] };
unsigned int lerp[4] = { ifrac[0]*ifrac[1], frac[0]*ifrac[1], ifrac[0]*frac[1], frac[0]*frac[1] };
- int tci[2] = { tc[0]>>12, tc[1]>>12 };
- int tci1[2] = { tci[0] + 1, tci[1] + 1 };
+ int tci[2] = { (int)tc[0]>>12, (int)tc[1]>>12 };
+ int tci1[2] = { (int)tci[0] + 1, (int)tci[1] + 1 };
if (texture->flags & DPSOFTRAST_TEXTURE_FLAG_CLAMPTOEDGE)
{
tci[0] = tci[0] >= 0 ? (tci[0] <= wrapmask[0] ? tci[0] : wrapmask[0]) : 0;
}
else
{
- int tci[2] = { x * width, y * height };
+ int tci[2] = { (int)floor(x) * width, (int)floor(y) * height };
if (texture->flags & DPSOFTRAST_TEXTURE_FLAG_CLAMPTOEDGE)
{
tci[0] = tci[0] >= 0 ? (tci[0] <= wrapmask[0] ? tci[0] : wrapmask[0]) : 0;
stringlist_t dirlist;
const char *slash, *backslash, *colon, *separator;
char *basepath;
- char temp[MAX_OSPATH];
for (i = 0;pattern[i] == '.' || pattern[i] == ':' || pattern[i] == '/' || pattern[i] == '\\';i++)
;
pak = searchpath->pack;
for (i = 0;i < pak->numfiles;i++)
{
+ char temp[MAX_OSPATH];
strlcpy(temp, pak->files[i].name, sizeof(temp));
while (temp[0])
{
// for each entry in matchedSet try to open the subdirectories specified in subpath
for( dirlistindex = 0 ; dirlistindex < matchedSet.numstrings ; dirlistindex++ ) {
+ char temp[MAX_OSPATH];
strlcpy( temp, matchedSet.strings[ dirlistindex ], sizeof(temp) );
strlcat( temp, subpath, sizeof(temp) );
listdirectory( &foundSet, searchpath->filename, temp );
for (dirlistindex = 0;dirlistindex < matchedSet.numstrings;dirlistindex++)
{
- const char *temp = matchedSet.strings[dirlistindex];
- if (matchpattern(temp, (char *)pattern, true))
+ const char *matchtemp = matchedSet.strings[dirlistindex];
+ if (matchpattern(matchtemp, (char *)pattern, true))
{
for (resultlistindex = 0;resultlistindex < resultlist.numstrings;resultlistindex++)
- if (!strcmp(resultlist.strings[resultlistindex], temp))
+ if (!strcmp(resultlist.strings[resultlistindex], matchtemp))
break;
if (resultlistindex == resultlist.numstrings)
{
- stringlistappend(&resultlist, temp);
+ stringlistappend(&resultlist, matchtemp);
if (!quiet && developer_loading.integer)
- Con_Printf("SearchDirFile: %s\n", temp);
+ Con_Printf("SearchDirFile: %s\n", matchtemp);
}
}
}
dst += bytesPerPixel - 1; // shift to alpha byte
for (x = 0; x < bmp->width; x += 8)
{
- unsigned char ch = *src++;
- *dst = 255 * !!((ch & 0x80) >> 7); dst += bytesPerPixel;
- *dst = 255 * !!((ch & 0x40) >> 6); dst += bytesPerPixel;
- *dst = 255 * !!((ch & 0x20) >> 5); dst += bytesPerPixel;
- *dst = 255 * !!((ch & 0x10) >> 4); dst += bytesPerPixel;
- *dst = 255 * !!((ch & 0x08) >> 3); dst += bytesPerPixel;
- *dst = 255 * !!((ch & 0x04) >> 2); dst += bytesPerPixel;
- *dst = 255 * !!((ch & 0x02) >> 1); dst += bytesPerPixel;
- *dst = 255 * !!((ch & 0x01) >> 0); dst += bytesPerPixel;
+ unsigned char c = *src++;
+ *dst = 255 * !!((c & 0x80) >> 7); dst += bytesPerPixel;
+ *dst = 255 * !!((c & 0x40) >> 6); dst += bytesPerPixel;
+ *dst = 255 * !!((c & 0x20) >> 5); dst += bytesPerPixel;
+ *dst = 255 * !!((c & 0x10) >> 4); dst += bytesPerPixel;
+ *dst = 255 * !!((c & 0x08) >> 3); dst += bytesPerPixel;
+ *dst = 255 * !!((c & 0x04) >> 2); dst += bytesPerPixel;
+ *dst = 255 * !!((c & 0x02) >> 1); dst += bytesPerPixel;
+ *dst = 255 * !!((c & 0x01) >> 0); dst += bytesPerPixel;
}
break;
case FT_PIXEL_MODE_GRAY2:
dst += bytesPerPixel - 1; // shift to alpha byte
for (x = 0; x < bmp->width; x += 4)
{
- unsigned char ch = *src++;
- *dst = ( ((ch & 0xA0) >> 6) * 0x55 ); ch <<= 2; dst += bytesPerPixel;
- *dst = ( ((ch & 0xA0) >> 6) * 0x55 ); ch <<= 2; dst += bytesPerPixel;
- *dst = ( ((ch & 0xA0) >> 6) * 0x55 ); ch <<= 2; dst += bytesPerPixel;
- *dst = ( ((ch & 0xA0) >> 6) * 0x55 ); ch <<= 2; dst += bytesPerPixel;
+ unsigned char c = *src++;
+ *dst = ( ((c & 0xA0) >> 6) * 0x55 ); c <<= 2; dst += bytesPerPixel;
+ *dst = ( ((c & 0xA0) >> 6) * 0x55 ); c <<= 2; dst += bytesPerPixel;
+ *dst = ( ((c & 0xA0) >> 6) * 0x55 ); c <<= 2; dst += bytesPerPixel;
+ *dst = ( ((c & 0xA0) >> 6) * 0x55 ); c <<= 2; dst += bytesPerPixel;
}
break;
case FT_PIXEL_MODE_GRAY4:
dst += bytesPerPixel - 1; // shift to alpha byte
for (x = 0; x < bmp->width; x += 2)
{
- unsigned char ch = *src++;
- *dst = ( ((ch & 0xF0) >> 4) * 0x11); dst += bytesPerPixel;
- *dst = ( ((ch & 0x0F) ) * 0x11); dst += bytesPerPixel;
+ unsigned char c = *src++;
+ *dst = ( ((c & 0xF0) >> 4) * 0x11); dst += bytesPerPixel;
+ *dst = ( ((c & 0x0F) ) * 0x11); dst += bytesPerPixel;
}
break;
case FT_PIXEL_MODE_GRAY:
int gl_maxdrawrangeelementsindices;
#ifdef DEBUGGL
-int errornumber = 0;
+int gl_errornumber = 0;
void GL_PrintError(int errornumber, const char *filename, int linenumber)
{
extern rtexture_t *r_shadow_shadowmap2ddepthtexture;
extern rtexture_t *r_shadow_shadowmapvsdcttexture;
extern matrix4x4_t r_shadow_shadowmapmatrix;
-extern int r_shadow_shadowmaplod; // changes for each light based on distance
extern int r_shadow_prepass_width;
extern int r_shadow_prepass_height;
extern rtexture_t *r_shadow_prepassgeometrydepthbuffer;
skinframe_t *R_SkinFrame_LoadInternalBGRA(const char *name, int textureflags, const unsigned char *skindata, int width, int height, qboolean sRGB)
{
int i;
- unsigned char *temp1, *temp2;
skinframe_t *skinframe;
char vabuf[1024];
if (r_loadnormalmap && r_shadow_bumpscale_basetexture.value > 0)
{
- temp1 = (unsigned char *)Mem_Alloc(tempmempool, width * height * 8);
- temp2 = temp1 + width * height * 4;
- Image_HeightmapToNormalmap_BGRA(skindata, temp2, width, height, false, r_shadow_bumpscale_basetexture.value);
- skinframe->nmap = R_LoadTexture2D(r_main_texturepool, va(vabuf, sizeof(vabuf), "%s_nmap", skinframe->basename), width, height, temp2, TEXTYPE_BGRA, (textureflags | TEXF_ALPHA) & (r_mipnormalmaps.integer ? ~0 : ~TEXF_MIPMAP), -1, NULL);
- Mem_Free(temp1);
+ unsigned char *a = (unsigned char *)Mem_Alloc(tempmempool, width * height * 8);
+ unsigned char *b = a + width * height * 4;
+ Image_HeightmapToNormalmap_BGRA(skindata, b, width, height, false, r_shadow_bumpscale_basetexture.value);
+ skinframe->nmap = R_LoadTexture2D(r_main_texturepool, va(vabuf, sizeof(vabuf), "%s_nmap", skinframe->basename), width, height, b, TEXTYPE_BGRA, (textureflags | TEXF_ALPHA) & (r_mipnormalmaps.integer ? ~0 : ~TEXF_MIPMAP), -1, NULL);
+ Mem_Free(a);
}
skinframe->base = skinframe->merged = R_LoadTexture2D(r_main_texturepool, skinframe->basename, width, height, skindata, sRGB ? TEXTYPE_SRGB_BGRA : TEXTYPE_BGRA, textureflags, -1, NULL);
if (textureflags & TEXF_ALPHA)
if (skinframe->qgeneratenmap)
{
- unsigned char *temp1, *temp2;
+ unsigned char *a, *b;
skinframe->qgeneratenmap = false;
- temp1 = (unsigned char *)Mem_Alloc(tempmempool, width * height * 8);
- temp2 = temp1 + width * height * 4;
+ a = (unsigned char *)Mem_Alloc(tempmempool, width * height * 8);
+ b = a + width * height * 4;
// use either a custom palette or the quake palette
- Image_Copy8bitBGRA(skindata, temp1, width * height, palette_bgra_complete);
- Image_HeightmapToNormalmap_BGRA(temp1, temp2, width, height, false, r_shadow_bumpscale_basetexture.value);
- skinframe->nmap = R_LoadTexture2D(r_main_texturepool, va(vabuf, sizeof(vabuf), "%s_nmap", skinframe->basename), width, height, temp2, TEXTYPE_BGRA, (skinframe->textureflags | TEXF_ALPHA) & (r_mipnormalmaps.integer ? ~0 : ~TEXF_MIPMAP), -1, NULL);
- Mem_Free(temp1);
+ Image_Copy8bitBGRA(skindata, a, width * height, palette_bgra_complete);
+ Image_HeightmapToNormalmap_BGRA(a, b, width, height, false, r_shadow_bumpscale_basetexture.value);
+ skinframe->nmap = R_LoadTexture2D(r_main_texturepool, va(vabuf, sizeof(vabuf), "%s_nmap", skinframe->basename), width, height, b, TEXTYPE_BGRA, (skinframe->textureflags | TEXF_ALPHA) & (r_mipnormalmaps.integer ? ~0 : ~TEXF_MIPMAP), -1, NULL);
+ Mem_Free(a);
}
if (skinframe->qgenerateglow)
qboolean dynamicvertex;
float amplitude;
float animpos;
- float scale;
float center[3], forward[3], right[3], up[3], v[3], newforward[3], newright[3], newup[3];
float waveparms[4];
unsigned char *ub;
// in place
for (deformindex = 0, deform = rsurface.texture->deforms;deformindex < Q3MAXDEFORMS && deform->deform && r_deformvertexes.integer;deformindex++, deform++)
{
+ float scale;
switch (deform->deform)
{
default:
batchvertex = R_Mesh_PrepareVertices_Generic_Lock(rsurface.batchnumvertices);
for (j = 0, vi = 0;j < rsurface.batchnumvertices;j++, vi++)
{
- unsigned char c = (vi << 3) * (1.0f / 256.0f);
+ unsigned char d = (vi << 3) * (1.0f / 256.0f);
VectorCopy(rsurface.batchvertex3f + 3*vi, batchvertex[vi].vertex3f);
- Vector4Set(batchvertex[vi].color4f, c, c, c, 1);
+ Vector4Set(batchvertex[vi].color4f, d, d, d, 1);
}
R_Mesh_PrepareVertices_Generic_Unlock();
RSurf_DrawBatch();
batchvertex = R_Mesh_PrepareVertices_Generic_Lock(3*rsurface.batchnumtriangles);
for (j = 0, e = rsurface.batchelement3i + 3 * rsurface.batchfirsttriangle;j < rsurface.batchnumtriangles;j++, e += 3)
{
- unsigned char c = ((j + rsurface.batchfirsttriangle) << 3) * (1.0f / 256.0f);
+ unsigned char d = ((j + rsurface.batchfirsttriangle) << 3) * (1.0f / 256.0f);
VectorCopy(rsurface.batchvertex3f + 3*e[0], batchvertex[j*3+0].vertex3f);
VectorCopy(rsurface.batchvertex3f + 3*e[1], batchvertex[j*3+1].vertex3f);
VectorCopy(rsurface.batchvertex3f + 3*e[2], batchvertex[j*3+2].vertex3f);
- Vector4Set(batchvertex[j*3+0].color4f, c, c, c, 1);
- Vector4Set(batchvertex[j*3+1].color4f, c, c, c, 1);
- Vector4Set(batchvertex[j*3+2].color4f, c, c, c, 1);
+ Vector4Set(batchvertex[j*3+0].color4f, d, d, d, 1);
+ Vector4Set(batchvertex[j*3+1].color4f, d, d, d, 1);
+ Vector4Set(batchvertex[j*3+2].color4f, d, d, d, 1);
}
R_Mesh_PrepareVertices_Generic_Unlock();
R_Mesh_Draw(0, rsurface.batchnumtriangles*3, 0, rsurface.batchnumtriangles, NULL, NULL, 0, NULL, NULL, 0);
#ifdef DEBUGGL
#ifdef USE_GLES2
-#define CHECKGLERROR {if (gl_paranoid.integer){if (gl_printcheckerror.integer) Con_Printf("CHECKGLERROR at %s:%d\n", __FILE__, __LINE__);errornumber = glGetError();if (errornumber) GL_PrintError(errornumber, __FILE__, __LINE__);}}
+#define CHECKGLERROR {if (gl_paranoid.integer){if (gl_printcheckerror.integer) Con_Printf("CHECKGLERROR at %s:%d\n", __FILE__, __LINE__);gl_errornumber = glGetError();if (gl_errornumber) GL_PrintError(gl_errornumber, __FILE__, __LINE__);}}
#else
-#define CHECKGLERROR {if (gl_paranoid.integer){if (gl_printcheckerror.integer) Con_Printf("CHECKGLERROR at %s:%d\n", __FILE__, __LINE__);errornumber = qglGetError ? qglGetError() : 0;if (errornumber) GL_PrintError(errornumber, __FILE__, __LINE__);}}
+#define CHECKGLERROR {if (gl_paranoid.integer){if (gl_printcheckerror.integer) Con_Printf("CHECKGLERROR at %s:%d\n", __FILE__, __LINE__);gl_errornumber = qglGetError ? qglGetError() : 0;if (gl_errornumber) GL_PrintError(gl_errornumber, __FILE__, __LINE__);}}
#endif
-extern int errornumber;
+extern int gl_errornumber;
void GL_PrintError(int errornumber, const char *filename, int linenumber);
#else
#define CHECKGLERROR
#include "lhnet.h"
#if defined(WIN32)
+// as of Visual Studio 2015, EWOULDBLOCK and ECONNREFUSED are real things, with different values than we want when talking to WinSock, so we have to undef them here or change the rest of the code.
+#undef EWOULDBLOCK
+#undef ECONNREFUSED
#define EWOULDBLOCK WSAEWOULDBLOCK
#define ECONNREFUSED WSAECONNREFUSED
// already downloading the file?
{
- downloadinfo *di = Curl_Find(fn);
- if(di)
+ downloadinfo *existingdownloadinfo = Curl_Find(fn);
+ if(existingdownloadinfo)
{
- Con_Printf("Can't download %s, already getting it from %s!\n", fn, CleanURL(di->url, urlbuf, sizeof(urlbuf)));
+ Con_Printf("Can't download %s, already getting it from %s!\n", fn, CleanURL(existingdownloadinfo->url, urlbuf, sizeof(urlbuf)));
// however, if it was not for this map yet...
- if(forthismap && !di->forthismap)
+ if(forthismap && !existingdownloadinfo->forthismap)
{
- di->forthismap = true;
+ existingdownloadinfo->forthismap = true;
// this "fakes" a download attempt so the client will wait for
// the download to finish and then reconnect
++numdownloads_added;
qfile_t *f = FS_OpenRealFile(fn, "rb", false);
if(f)
{
- char buf[4] = {0};
- FS_Read(f, buf, sizeof(buf)); // no "-1", I will use memcmp
+ char b[4] = {0};
+ FS_Read(f, b, sizeof(b)); // no "-1", I will use memcmp
- if(memcmp(buf, "PK\x03\x04", 4) && memcmp(buf, "PACK", 4))
+ if(memcmp(b, "PK\x03\x04", 4) && memcmp(b, "PACK", 4))
{
Con_DPrintf("Detected non-PAK %s, clearing and NOT resuming.\n", fn);
FS_Close(f);
float m_bytenormals[NUMVERTEXNORMALS][3] =
{
-{-0.525731, 0.000000, 0.850651}, {-0.442863, 0.238856, 0.864188},
-{-0.295242, 0.000000, 0.955423}, {-0.309017, 0.500000, 0.809017},
-{-0.162460, 0.262866, 0.951056}, {0.000000, 0.000000, 1.000000},
-{0.000000, 0.850651, 0.525731}, {-0.147621, 0.716567, 0.681718},
-{0.147621, 0.716567, 0.681718}, {0.000000, 0.525731, 0.850651},
-{0.309017, 0.500000, 0.809017}, {0.525731, 0.000000, 0.850651},
-{0.295242, 0.000000, 0.955423}, {0.442863, 0.238856, 0.864188},
-{0.162460, 0.262866, 0.951056}, {-0.681718, 0.147621, 0.716567},
-{-0.809017, 0.309017, 0.500000}, {-0.587785, 0.425325, 0.688191},
-{-0.850651, 0.525731, 0.000000}, {-0.864188, 0.442863, 0.238856},
-{-0.716567, 0.681718, 0.147621}, {-0.688191, 0.587785, 0.425325},
-{-0.500000, 0.809017, 0.309017}, {-0.238856, 0.864188, 0.442863},
-{-0.425325, 0.688191, 0.587785}, {-0.716567, 0.681718, -0.147621},
-{-0.500000, 0.809017, -0.309017}, {-0.525731, 0.850651, 0.000000},
-{0.000000, 0.850651, -0.525731}, {-0.238856, 0.864188, -0.442863},
-{0.000000, 0.955423, -0.295242}, {-0.262866, 0.951056, -0.162460},
-{0.000000, 1.000000, 0.000000}, {0.000000, 0.955423, 0.295242},
-{-0.262866, 0.951056, 0.162460}, {0.238856, 0.864188, 0.442863},
-{0.262866, 0.951056, 0.162460}, {0.500000, 0.809017, 0.309017},
-{0.238856, 0.864188, -0.442863}, {0.262866, 0.951056, -0.162460},
-{0.500000, 0.809017, -0.309017}, {0.850651, 0.525731, 0.000000},
-{0.716567, 0.681718, 0.147621}, {0.716567, 0.681718, -0.147621},
-{0.525731, 0.850651, 0.000000}, {0.425325, 0.688191, 0.587785},
-{0.864188, 0.442863, 0.238856}, {0.688191, 0.587785, 0.425325},
-{0.809017, 0.309017, 0.500000}, {0.681718, 0.147621, 0.716567},
-{0.587785, 0.425325, 0.688191}, {0.955423, 0.295242, 0.000000},
-{1.000000, 0.000000, 0.000000}, {0.951056, 0.162460, 0.262866},
-{0.850651, -0.525731, 0.000000}, {0.955423, -0.295242, 0.000000},
-{0.864188, -0.442863, 0.238856}, {0.951056, -0.162460, 0.262866},
-{0.809017, -0.309017, 0.500000}, {0.681718, -0.147621, 0.716567},
-{0.850651, 0.000000, 0.525731}, {0.864188, 0.442863, -0.238856},
-{0.809017, 0.309017, -0.500000}, {0.951056, 0.162460, -0.262866},
-{0.525731, 0.000000, -0.850651}, {0.681718, 0.147621, -0.716567},
-{0.681718, -0.147621, -0.716567}, {0.850651, 0.000000, -0.525731},
-{0.809017, -0.309017, -0.500000}, {0.864188, -0.442863, -0.238856},
-{0.951056, -0.162460, -0.262866}, {0.147621, 0.716567, -0.681718},
-{0.309017, 0.500000, -0.809017}, {0.425325, 0.688191, -0.587785},
-{0.442863, 0.238856, -0.864188}, {0.587785, 0.425325, -0.688191},
-{0.688191, 0.587785, -0.425325}, {-0.147621, 0.716567, -0.681718},
-{-0.309017, 0.500000, -0.809017}, {0.000000, 0.525731, -0.850651},
-{-0.525731, 0.000000, -0.850651}, {-0.442863, 0.238856, -0.864188},
-{-0.295242, 0.000000, -0.955423}, {-0.162460, 0.262866, -0.951056},
-{0.000000, 0.000000, -1.000000}, {0.295242, 0.000000, -0.955423},
-{0.162460, 0.262866, -0.951056}, {-0.442863, -0.238856, -0.864188},
-{-0.309017, -0.500000, -0.809017}, {-0.162460, -0.262866, -0.951056},
-{0.000000, -0.850651, -0.525731}, {-0.147621, -0.716567, -0.681718},
-{0.147621, -0.716567, -0.681718}, {0.000000, -0.525731, -0.850651},
-{0.309017, -0.500000, -0.809017}, {0.442863, -0.238856, -0.864188},
-{0.162460, -0.262866, -0.951056}, {0.238856, -0.864188, -0.442863},
-{0.500000, -0.809017, -0.309017}, {0.425325, -0.688191, -0.587785},
-{0.716567, -0.681718, -0.147621}, {0.688191, -0.587785, -0.425325},
-{0.587785, -0.425325, -0.688191}, {0.000000, -0.955423, -0.295242},
-{0.000000, -1.000000, 0.000000}, {0.262866, -0.951056, -0.162460},
-{0.000000, -0.850651, 0.525731}, {0.000000, -0.955423, 0.295242},
-{0.238856, -0.864188, 0.442863}, {0.262866, -0.951056, 0.162460},
-{0.500000, -0.809017, 0.309017}, {0.716567, -0.681718, 0.147621},
-{0.525731, -0.850651, 0.000000}, {-0.238856, -0.864188, -0.442863},
-{-0.500000, -0.809017, -0.309017}, {-0.262866, -0.951056, -0.162460},
-{-0.850651, -0.525731, 0.000000}, {-0.716567, -0.681718, -0.147621},
-{-0.716567, -0.681718, 0.147621}, {-0.525731, -0.850651, 0.000000},
-{-0.500000, -0.809017, 0.309017}, {-0.238856, -0.864188, 0.442863},
-{-0.262866, -0.951056, 0.162460}, {-0.864188, -0.442863, 0.238856},
-{-0.809017, -0.309017, 0.500000}, {-0.688191, -0.587785, 0.425325},
-{-0.681718, -0.147621, 0.716567}, {-0.442863, -0.238856, 0.864188},
-{-0.587785, -0.425325, 0.688191}, {-0.309017, -0.500000, 0.809017},
-{-0.147621, -0.716567, 0.681718}, {-0.425325, -0.688191, 0.587785},
-{-0.162460, -0.262866, 0.951056}, {0.442863, -0.238856, 0.864188},
-{0.162460, -0.262866, 0.951056}, {0.309017, -0.500000, 0.809017},
-{0.147621, -0.716567, 0.681718}, {0.000000, -0.525731, 0.850651},
-{0.425325, -0.688191, 0.587785}, {0.587785, -0.425325, 0.688191},
-{0.688191, -0.587785, 0.425325}, {-0.955423, 0.295242, 0.000000},
-{-0.951056, 0.162460, 0.262866}, {-1.000000, 0.000000, 0.000000},
-{-0.850651, 0.000000, 0.525731}, {-0.955423, -0.295242, 0.000000},
-{-0.951056, -0.162460, 0.262866}, {-0.864188, 0.442863, -0.238856},
-{-0.951056, 0.162460, -0.262866}, {-0.809017, 0.309017, -0.500000},
-{-0.864188, -0.442863, -0.238856}, {-0.951056, -0.162460, -0.262866},
-{-0.809017, -0.309017, -0.500000}, {-0.681718, 0.147621, -0.716567},
-{-0.681718, -0.147621, -0.716567}, {-0.850651, 0.000000, -0.525731},
-{-0.688191, 0.587785, -0.425325}, {-0.587785, 0.425325, -0.688191},
-{-0.425325, 0.688191, -0.587785}, {-0.425325, -0.688191, -0.587785},
-{-0.587785, -0.425325, -0.688191}, {-0.688191, -0.587785, -0.425325},
+{-0.525731f, 0.000000f, 0.850651f}, {-0.442863f, 0.238856f, 0.864188f},
+{-0.295242f, 0.000000f, 0.955423f}, {-0.309017f, 0.500000f, 0.809017f},
+{-0.162460f, 0.262866f, 0.951056f}, {0.000000f, 0.000000f, 1.000000f},
+{0.000000f, 0.850651f, 0.525731f}, {-0.147621f, 0.716567f, 0.681718f},
+{0.147621f, 0.716567f, 0.681718f}, {0.000000f, 0.525731f, 0.850651f},
+{0.309017f, 0.500000f, 0.809017f}, {0.525731f, 0.000000f, 0.850651f},
+{0.295242f, 0.000000f, 0.955423f}, {0.442863f, 0.238856f, 0.864188f},
+{0.162460f, 0.262866f, 0.951056f}, {-0.681718f, 0.147621f, 0.716567f},
+{-0.809017f, 0.309017f, 0.500000f}, {-0.587785f, 0.425325f, 0.688191f},
+{-0.850651f, 0.525731f, 0.000000f}, {-0.864188f, 0.442863f, 0.238856f},
+{-0.716567f, 0.681718f, 0.147621f}, {-0.688191f, 0.587785f, 0.425325f},
+{-0.500000f, 0.809017f, 0.309017f}, {-0.238856f, 0.864188f, 0.442863f},
+{-0.425325f, 0.688191f, 0.587785f}, {-0.716567f, 0.681718f, -0.147621f},
+{-0.500000f, 0.809017f, -0.309017f}, {-0.525731f, 0.850651f, 0.000000f},
+{0.000000f, 0.850651f, -0.525731f}, {-0.238856f, 0.864188f, -0.442863f},
+{0.000000f, 0.955423f, -0.295242f}, {-0.262866f, 0.951056f, -0.162460f},
+{0.000000f, 1.000000f, 0.000000f}, {0.000000f, 0.955423f, 0.295242f},
+{-0.262866f, 0.951056f, 0.162460f}, {0.238856f, 0.864188f, 0.442863f},
+{0.262866f, 0.951056f, 0.162460f}, {0.500000f, 0.809017f, 0.309017f},
+{0.238856f, 0.864188f, -0.442863f}, {0.262866f, 0.951056f, -0.162460f},
+{0.500000f, 0.809017f, -0.309017f}, {0.850651f, 0.525731f, 0.000000f},
+{0.716567f, 0.681718f, 0.147621f}, {0.716567f, 0.681718f, -0.147621f},
+{0.525731f, 0.850651f, 0.000000f}, {0.425325f, 0.688191f, 0.587785f},
+{0.864188f, 0.442863f, 0.238856f}, {0.688191f, 0.587785f, 0.425325f},
+{0.809017f, 0.309017f, 0.500000f}, {0.681718f, 0.147621f, 0.716567f},
+{0.587785f, 0.425325f, 0.688191f}, {0.955423f, 0.295242f, 0.000000f},
+{1.000000f, 0.000000f, 0.000000f}, {0.951056f, 0.162460f, 0.262866f},
+{0.850651f, -0.525731f, 0.000000f}, {0.955423f, -0.295242f, 0.000000f},
+{0.864188f, -0.442863f, 0.238856f}, {0.951056f, -0.162460f, 0.262866f},
+{0.809017f, -0.309017f, 0.500000f}, {0.681718f, -0.147621f, 0.716567f},
+{0.850651f, 0.000000f, 0.525731f}, {0.864188f, 0.442863f, -0.238856f},
+{0.809017f, 0.309017f, -0.500000f}, {0.951056f, 0.162460f, -0.262866f},
+{0.525731f, 0.000000f, -0.850651f}, {0.681718f, 0.147621f, -0.716567f},
+{0.681718f, -0.147621f, -0.716567f}, {0.850651f, 0.000000f, -0.525731f},
+{0.809017f, -0.309017f, -0.500000f}, {0.864188f, -0.442863f, -0.238856f},
+{0.951056f, -0.162460f, -0.262866f}, {0.147621f, 0.716567f, -0.681718f},
+{0.309017f, 0.500000f, -0.809017f}, {0.425325f, 0.688191f, -0.587785f},
+{0.442863f, 0.238856f, -0.864188f}, {0.587785f, 0.425325f, -0.688191f},
+{0.688191f, 0.587785f, -0.425325f}, {-0.147621f, 0.716567f, -0.681718f},
+{-0.309017f, 0.500000f, -0.809017f}, {0.000000f, 0.525731f, -0.850651f},
+{-0.525731f, 0.000000f, -0.850651f}, {-0.442863f, 0.238856f, -0.864188f},
+{-0.295242f, 0.000000f, -0.955423f}, {-0.162460f, 0.262866f, -0.951056f},
+{0.000000f, 0.000000f, -1.000000f}, {0.295242f, 0.000000f, -0.955423f},
+{0.162460f, 0.262866f, -0.951056f}, {-0.442863f, -0.238856f, -0.864188f},
+{-0.309017f, -0.500000f, -0.809017f}, {-0.162460f, -0.262866f, -0.951056f},
+{0.000000f, -0.850651f, -0.525731f}, {-0.147621f, -0.716567f, -0.681718f},
+{0.147621f, -0.716567f, -0.681718f}, {0.000000f, -0.525731f, -0.850651f},
+{0.309017f, -0.500000f, -0.809017f}, {0.442863f, -0.238856f, -0.864188f},
+{0.162460f, -0.262866f, -0.951056f}, {0.238856f, -0.864188f, -0.442863f},
+{0.500000f, -0.809017f, -0.309017f}, {0.425325f, -0.688191f, -0.587785f},
+{0.716567f, -0.681718f, -0.147621f}, {0.688191f, -0.587785f, -0.425325f},
+{0.587785f, -0.425325f, -0.688191f}, {0.000000f, -0.955423f, -0.295242f},
+{0.000000f, -1.000000f, 0.000000f}, {0.262866f, -0.951056f, -0.162460f},
+{0.000000f, -0.850651f, 0.525731f}, {0.000000f, -0.955423f, 0.295242f},
+{0.238856f, -0.864188f, 0.442863f}, {0.262866f, -0.951056f, 0.162460f},
+{0.500000f, -0.809017f, 0.309017f}, {0.716567f, -0.681718f, 0.147621f},
+{0.525731f, -0.850651f, 0.000000f}, {-0.238856f, -0.864188f, -0.442863f},
+{-0.500000f, -0.809017f, -0.309017f}, {-0.262866f, -0.951056f, -0.162460f},
+{-0.850651f, -0.525731f, 0.000000f}, {-0.716567f, -0.681718f, -0.147621f},
+{-0.716567f, -0.681718f, 0.147621f}, {-0.525731f, -0.850651f, 0.000000f},
+{-0.500000f, -0.809017f, 0.309017f}, {-0.238856f, -0.864188f, 0.442863f},
+{-0.262866f, -0.951056f, 0.162460f}, {-0.864188f, -0.442863f, 0.238856f},
+{-0.809017f, -0.309017f, 0.500000f}, {-0.688191f, -0.587785f, 0.425325f},
+{-0.681718f, -0.147621f, 0.716567f}, {-0.442863f, -0.238856f, 0.864188f},
+{-0.587785f, -0.425325f, 0.688191f}, {-0.309017f, -0.500000f, 0.809017f},
+{-0.147621f, -0.716567f, 0.681718f}, {-0.425325f, -0.688191f, 0.587785f},
+{-0.162460f, -0.262866f, 0.951056f}, {0.442863f, -0.238856f, 0.864188f},
+{0.162460f, -0.262866f, 0.951056f}, {0.309017f, -0.500000f, 0.809017f},
+{0.147621f, -0.716567f, 0.681718f}, {0.000000f, -0.525731f, 0.850651f},
+{0.425325f, -0.688191f, 0.587785f}, {0.587785f, -0.425325f, 0.688191f},
+{0.688191f, -0.587785f, 0.425325f}, {-0.955423f, 0.295242f, 0.000000f},
+{-0.951056f, 0.162460f, 0.262866f}, {-1.000000f, 0.000000f, 0.000000f},
+{-0.850651f, 0.000000f, 0.525731f}, {-0.955423f, -0.295242f, 0.000000f},
+{-0.951056f, -0.162460f, 0.262866f}, {-0.864188f, 0.442863f, -0.238856f},
+{-0.951056f, 0.162460f, -0.262866f}, {-0.809017f, 0.309017f, -0.500000f},
+{-0.864188f, -0.442863f, -0.238856f}, {-0.951056f, -0.162460f, -0.262866f},
+{-0.809017f, -0.309017f, -0.500000f}, {-0.681718f, 0.147621f, -0.716567f},
+{-0.681718f, -0.147621f, -0.716567f}, {-0.850651f, 0.000000f, -0.525731f},
+{-0.688191f, 0.587785f, -0.425325f}, {-0.587785f, 0.425325f, -0.688191f},
+{-0.425325f, 0.688191f, -0.587785f}, {-0.425325f, -0.688191f, -0.587785f},
+{-0.587785f, -0.425325f, -0.688191f}, {-0.688191f, -0.587785f, -0.425325f},
};
#if 0
#endif
}
-static int optnum;
-static int opty;
-static int optcursor;
+static int m_optnum;
+static int m_opty;
+static int m_optcursor;
static void M_Options_PrintCommand(const char *s, int enabled)
{
- if (opty >= 32)
+ if (m_opty >= 32)
{
- if (optnum == optcursor)
- DrawQ_Fill(menu_x + 48, menu_y + opty, 320, 8, optnum == optcursor ? (0.5 + 0.2 * sin(realtime * M_PI)) : 0, 0, 0, 0.5, 0);
- M_ItemPrint(0 + 48, opty, s, enabled);
+ if (m_optnum == m_optcursor)
+ DrawQ_Fill(menu_x + 48, menu_y + m_opty, 320, 8, m_optnum == m_optcursor ? (0.5 + 0.2 * sin(realtime * M_PI)) : 0, 0, 0, 0.5, 0);
+ M_ItemPrint(0 + 48, m_opty, s, enabled);
}
- opty += 8;
- optnum++;
+ m_opty += 8;
+ m_optnum++;
}
static void M_Options_PrintCheckbox(const char *s, int enabled, int yes)
{
- if (opty >= 32)
+ if (m_opty >= 32)
{
- if (optnum == optcursor)
- DrawQ_Fill(menu_x + 48, menu_y + opty, 320, 8, optnum == optcursor ? (0.5 + 0.2 * sin(realtime * M_PI)) : 0, 0, 0, 0.5, 0);
- M_ItemPrint(0 + 48, opty, s, enabled);
- M_DrawCheckbox(0 + 48 + (int)strlen(s) * 8 + 8, opty, yes);
+ if (m_optnum == m_optcursor)
+ DrawQ_Fill(menu_x + 48, menu_y + m_opty, 320, 8, m_optnum == m_optcursor ? (0.5 + 0.2 * sin(realtime * M_PI)) : 0, 0, 0, 0.5, 0);
+ M_ItemPrint(0 + 48, m_opty, s, enabled);
+ M_DrawCheckbox(0 + 48 + (int)strlen(s) * 8 + 8, m_opty, yes);
}
- opty += 8;
- optnum++;
+ m_opty += 8;
+ m_optnum++;
}
static void M_Options_PrintSlider(const char *s, int enabled, float value, float minvalue, float maxvalue)
{
- if (opty >= 32)
+ if (m_opty >= 32)
{
- if (optnum == optcursor)
- DrawQ_Fill(menu_x + 48, menu_y + opty, 320, 8, optnum == optcursor ? (0.5 + 0.2 * sin(realtime * M_PI)) : 0, 0, 0, 0.5, 0);
- M_ItemPrint(0 + 48, opty, s, enabled);
- M_DrawSlider(0 + 48 + (int)strlen(s) * 8 + 8, opty, value, minvalue, maxvalue);
+ if (m_optnum == m_optcursor)
+ DrawQ_Fill(menu_x + 48, menu_y + m_opty, 320, 8, m_optnum == m_optcursor ? (0.5 + 0.2 * sin(realtime * M_PI)) : 0, 0, 0, 0.5, 0);
+ M_ItemPrint(0 + 48, m_opty, s, enabled);
+ M_DrawSlider(0 + 48 + (int)strlen(s) * 8 + 8, m_opty, value, minvalue, maxvalue);
}
- opty += 8;
- optnum++;
+ m_opty += 8;
+ m_optnum++;
}
static void M_Options_Draw (void)
p = Draw_CachePic ("gfx/p_option");
M_DrawPic((320-p->width)/2, 4, "gfx/p_option");
- optnum = 0;
- optcursor = options_cursor;
+ m_optnum = 0;
+ m_optcursor = options_cursor;
visible = (int)((menu_height - 32) / 8);
- opty = 32 - bound(0, optcursor - (visible >> 1), max(0, OPTIONS_ITEMS - visible)) * 8;
+ m_opty = 32 - bound(0, m_optcursor - (visible >> 1), max(0, OPTIONS_ITEMS - visible)) * 8;
M_Options_PrintCommand( " Customize controls", true);
M_Options_PrintCommand( " Go to console", true);
p = Draw_CachePic ("gfx/p_option");
M_DrawPic((320-p->width)/2, 4, "gfx/p_option");
- optcursor = options_effects_cursor;
- optnum = 0;
+ m_optcursor = options_effects_cursor;
+ m_optnum = 0;
visible = (int)((menu_height - 32) / 8);
- opty = 32 - bound(0, optcursor - (visible >> 1), max(0, OPTIONS_EFFECTS_ITEMS - visible)) * 8;
+ m_opty = 32 - bound(0, m_optcursor - (visible >> 1), max(0, OPTIONS_EFFECTS_ITEMS - visible)) * 8;
M_Options_PrintCheckbox(" Particles", true, cl_particles.integer);
M_Options_PrintCheckbox(" Quake-style Particles", true, cl_particles_quake.integer);
p = Draw_CachePic ("gfx/p_option");
M_DrawPic((320-p->width)/2, 4, "gfx/p_option");
- optcursor = options_graphics_cursor;
- optnum = 0;
+ m_optcursor = options_graphics_cursor;
+ m_optnum = 0;
visible = (int)((menu_height - 32) / 8);
- opty = 32 - bound(0, optcursor - (visible >> 1), max(0, OPTIONS_GRAPHICS_ITEMS - visible)) * 8;
+ m_opty = 32 - bound(0, m_optcursor - (visible >> 1), max(0, OPTIONS_GRAPHICS_ITEMS - visible)) * 8;
M_Options_PrintSlider( " Corona Intensity", true, r_coronas.value, 0, 4);
M_Options_PrintCheckbox(" Use Only Coronas", true, gl_flashblend.integer);
p = Draw_CachePic ("gfx/p_option");
M_DrawPic((320-p->width)/2, 4, "gfx/p_option");
- optcursor = options_colorcontrol_cursor;
- optnum = 0;
+ m_optcursor = options_colorcontrol_cursor;
+ m_optnum = 0;
visible = (int)((menu_height - 32) / 8);
- opty = 32 - bound(0, optcursor - (visible >> 1), max(0, OPTIONS_COLORCONTROL_ITEMS - visible)) * 8;
+ m_opty = 32 - bound(0, m_optcursor - (visible >> 1), max(0, OPTIONS_COLORCONTROL_ITEMS - visible)) * 8;
M_Options_PrintCommand( " Reset to defaults", true);
M_Options_PrintCheckbox("Hardware Gamma Control", vid_hardwaregammasupported.integer, v_hwgamma.integer);
M_Options_PrintSlider( " White: Blue ", v_color_enable.integer, v_color_white_b.value, 1, 5);
M_Options_PrintSlider( " White: Grey ", v_color_enable.integer, (v_color_white_r.value + v_color_white_g.value + v_color_white_b.value) / 3, 1, 5);
- opty += 4;
- DrawQ_Fill(menu_x, menu_y + opty, 320, 4 + 64 + 8 + 64 + 4, 0, 0, 0, 1, 0);opty += 4;
+ m_opty += 4;
+ DrawQ_Fill(menu_x, menu_y + m_opty, 320, 4 + 64 + 8 + 64 + 4, 0, 0, 0, 1, 0);m_opty += 4;
s = (float) 312 / 2 * vid.width / vid_conwidth.integer;
t = (float) 4 / 2 * vid.height / vid_conheight.integer;
- DrawQ_SuperPic(menu_x + 4, menu_y + opty, dither, 312, 4, 0,0, 1,0,0,1, s,0, 1,0,0,1, 0,t, 1,0,0,1, s,t, 1,0,0,1, 0);opty += 4;
- DrawQ_SuperPic(menu_x + 4, menu_y + opty, NULL , 312, 4, 0,0, 0,0,0,1, 1,0, 1,0,0,1, 0,1, 0,0,0,1, 1,1, 1,0,0,1, 0);opty += 4;
- DrawQ_SuperPic(menu_x + 4, menu_y + opty, dither, 312, 4, 0,0, 0,1,0,1, s,0, 0,1,0,1, 0,t, 0,1,0,1, s,t, 0,1,0,1, 0);opty += 4;
- DrawQ_SuperPic(menu_x + 4, menu_y + opty, NULL , 312, 4, 0,0, 0,0,0,1, 1,0, 0,1,0,1, 0,1, 0,0,0,1, 1,1, 0,1,0,1, 0);opty += 4;
- DrawQ_SuperPic(menu_x + 4, menu_y + opty, dither, 312, 4, 0,0, 0,0,1,1, s,0, 0,0,1,1, 0,t, 0,0,1,1, s,t, 0,0,1,1, 0);opty += 4;
- DrawQ_SuperPic(menu_x + 4, menu_y + opty, NULL , 312, 4, 0,0, 0,0,0,1, 1,0, 0,0,1,1, 0,1, 0,0,0,1, 1,1, 0,0,1,1, 0);opty += 4;
- DrawQ_SuperPic(menu_x + 4, menu_y + opty, dither, 312, 4, 0,0, 1,1,1,1, s,0, 1,1,1,1, 0,t, 1,1,1,1, s,t, 1,1,1,1, 0);opty += 4;
- DrawQ_SuperPic(menu_x + 4, menu_y + opty, NULL , 312, 4, 0,0, 0,0,0,1, 1,0, 1,1,1,1, 0,1, 0,0,0,1, 1,1, 1,1,1,1, 0);opty += 4;
+ DrawQ_SuperPic(menu_x + 4, menu_y + m_opty, dither, 312, 4, 0,0, 1,0,0,1, s,0, 1,0,0,1, 0,t, 1,0,0,1, s,t, 1,0,0,1, 0);m_opty += 4;
+ DrawQ_SuperPic(menu_x + 4, menu_y + m_opty, NULL , 312, 4, 0,0, 0,0,0,1, 1,0, 1,0,0,1, 0,1, 0,0,0,1, 1,1, 1,0,0,1, 0);m_opty += 4;
+ DrawQ_SuperPic(menu_x + 4, menu_y + m_opty, dither, 312, 4, 0,0, 0,1,0,1, s,0, 0,1,0,1, 0,t, 0,1,0,1, s,t, 0,1,0,1, 0);m_opty += 4;
+ DrawQ_SuperPic(menu_x + 4, menu_y + m_opty, NULL , 312, 4, 0,0, 0,0,0,1, 1,0, 0,1,0,1, 0,1, 0,0,0,1, 1,1, 0,1,0,1, 0);m_opty += 4;
+ DrawQ_SuperPic(menu_x + 4, menu_y + m_opty, dither, 312, 4, 0,0, 0,0,1,1, s,0, 0,0,1,1, 0,t, 0,0,1,1, s,t, 0,0,1,1, 0);m_opty += 4;
+ DrawQ_SuperPic(menu_x + 4, menu_y + m_opty, NULL , 312, 4, 0,0, 0,0,0,1, 1,0, 0,0,1,1, 0,1, 0,0,0,1, 1,1, 0,0,1,1, 0);m_opty += 4;
+ DrawQ_SuperPic(menu_x + 4, menu_y + m_opty, dither, 312, 4, 0,0, 1,1,1,1, s,0, 1,1,1,1, 0,t, 1,1,1,1, s,t, 1,1,1,1, 0);m_opty += 4;
+ DrawQ_SuperPic(menu_x + 4, menu_y + m_opty, NULL , 312, 4, 0,0, 0,0,0,1, 1,0, 1,1,1,1, 0,1, 0,0,0,1, 1,1, 1,1,1,1, 0);m_opty += 4;
c = menu_options_colorcontrol_correctionvalue.value; // intensity value that should be matched up to a 50% dither to 'correct' quake
s = (float) 48 / 2 * vid.width / vid_conwidth.integer;
t = (float) 48 / 2 * vid.height / vid_conheight.integer;
u = s * 0.5;
v = t * 0.5;
- opty += 8;
+ m_opty += 8;
x = 4;
- DrawQ_Fill(menu_x + x, menu_y + opty, 64, 48, c, 0, 0, 1, 0);
- DrawQ_SuperPic(menu_x + x + 16, menu_y + opty + 16, dither, 16, 16, 0,0, 1,0,0,1, s,0, 1,0,0,1, 0,t, 1,0,0,1, s,t, 1,0,0,1, 0);
- DrawQ_SuperPic(menu_x + x + 32, menu_y + opty + 16, dither, 16, 16, 0,0, 1,0,0,1, u,0, 1,0,0,1, 0,v, 1,0,0,1, u,v, 1,0,0,1, 0);
+ DrawQ_Fill(menu_x + x, menu_y + m_opty, 64, 48, c, 0, 0, 1, 0);
+ DrawQ_SuperPic(menu_x + x + 16, menu_y + m_opty + 16, dither, 16, 16, 0,0, 1,0,0,1, s,0, 1,0,0,1, 0,t, 1,0,0,1, s,t, 1,0,0,1, 0);
+ DrawQ_SuperPic(menu_x + x + 32, menu_y + m_opty + 16, dither, 16, 16, 0,0, 1,0,0,1, u,0, 1,0,0,1, 0,v, 1,0,0,1, u,v, 1,0,0,1, 0);
x += 80;
- DrawQ_Fill(menu_x + x, menu_y + opty, 64, 48, 0, c, 0, 1, 0);
- DrawQ_SuperPic(menu_x + x + 16, menu_y + opty + 16, dither, 16, 16, 0,0, 0,1,0,1, s,0, 0,1,0,1, 0,t, 0,1,0,1, s,t, 0,1,0,1, 0);
- DrawQ_SuperPic(menu_x + x + 32, menu_y + opty + 16, dither, 16, 16, 0,0, 0,1,0,1, u,0, 0,1,0,1, 0,v, 0,1,0,1, u,v, 0,1,0,1, 0);
+ DrawQ_Fill(menu_x + x, menu_y + m_opty, 64, 48, 0, c, 0, 1, 0);
+ DrawQ_SuperPic(menu_x + x + 16, menu_y + m_opty + 16, dither, 16, 16, 0,0, 0,1,0,1, s,0, 0,1,0,1, 0,t, 0,1,0,1, s,t, 0,1,0,1, 0);
+ DrawQ_SuperPic(menu_x + x + 32, menu_y + m_opty + 16, dither, 16, 16, 0,0, 0,1,0,1, u,0, 0,1,0,1, 0,v, 0,1,0,1, u,v, 0,1,0,1, 0);
x += 80;
- DrawQ_Fill(menu_x + x, menu_y + opty, 64, 48, 0, 0, c, 1, 0);
- DrawQ_SuperPic(menu_x + x + 16, menu_y + opty + 16, dither, 16, 16, 0,0, 0,0,1,1, s,0, 0,0,1,1, 0,t, 0,0,1,1, s,t, 0,0,1,1, 0);
- DrawQ_SuperPic(menu_x + x + 32, menu_y + opty + 16, dither, 16, 16, 0,0, 0,0,1,1, u,0, 0,0,1,1, 0,v, 0,0,1,1, u,v, 0,0,1,1, 0);
+ DrawQ_Fill(menu_x + x, menu_y + m_opty, 64, 48, 0, 0, c, 1, 0);
+ DrawQ_SuperPic(menu_x + x + 16, menu_y + m_opty + 16, dither, 16, 16, 0,0, 0,0,1,1, s,0, 0,0,1,1, 0,t, 0,0,1,1, s,t, 0,0,1,1, 0);
+ DrawQ_SuperPic(menu_x + x + 32, menu_y + m_opty + 16, dither, 16, 16, 0,0, 0,0,1,1, u,0, 0,0,1,1, 0,v, 0,0,1,1, u,v, 0,0,1,1, 0);
x += 80;
- DrawQ_Fill(menu_x + x, menu_y + opty, 64, 48, c, c, c, 1, 0);
- DrawQ_SuperPic(menu_x + x + 16, menu_y + opty + 16, dither, 16, 16, 0,0, 1,1,1,1, s,0, 1,1,1,1, 0,t, 1,1,1,1, s,t, 1,1,1,1, 0);
- DrawQ_SuperPic(menu_x + x + 32, menu_y + opty + 16, dither, 16, 16, 0,0, 1,1,1,1, u,0, 1,1,1,1, 0,v, 1,1,1,1, u,v, 1,1,1,1, 0);
+ DrawQ_Fill(menu_x + x, menu_y + m_opty, 64, 48, c, c, c, 1, 0);
+ DrawQ_SuperPic(menu_x + x + 16, menu_y + m_opty + 16, dither, 16, 16, 0,0, 1,1,1,1, s,0, 1,1,1,1, 0,t, 1,1,1,1, s,t, 1,1,1,1, 0);
+ DrawQ_SuperPic(menu_x + x + 32, menu_y + m_opty + 16, dither, 16, 16, 0,0, 1,1,1,1, u,0, 1,1,1,1, 0,v, 1,1,1,1, u,v, 1,1,1,1, 0);
}
if (menu_video_resolutions[i].height == h && menu_video_resolutions[menu_video_resolution].height == h)
{
// if the new mode would be a worse match in pixel aspect, skip it
- if (abs(menu_video_resolutions[i].pixelheight - a) > abs(menu_video_resolutions[menu_video_resolution].pixelheight - a))
+ if (fabs(menu_video_resolutions[i].pixelheight - a) > fabs(menu_video_resolutions[menu_video_resolution].pixelheight - a))
continue;
// if it is equal in everything, skip it (prefer earlier modes)
if (menu_video_resolutions[i].pixelheight == a && menu_video_resolutions[menu_video_resolution].pixelheight == a)
static void M_ServerList_Draw (void)
{
- int n, y, visible, start, end, numplayers, maxplayers;
+ int n, y, visible, start, end, statnumplayers, statmaxplayers;
cachepic_t *p;
const char *s;
char vabuf[1024];
else
M_Background(640, vid_conheight.integer);
// scroll the list as the cursor moves
- ServerList_GetPlayerStatistics(&numplayers, &maxplayers);
- s = va(vabuf, sizeof(vabuf), "%i/%i masters %i/%i servers %i/%i players", masterreplycount, masterquerycount, serverreplycount, serverquerycount, numplayers, maxplayers);
+ ServerList_GetPlayerStatistics(&statnumplayers, &statmaxplayers);
+ s = va(vabuf, sizeof(vabuf), "%i/%i masters %i/%i servers %i/%i players", masterreplycount, masterquerycount, serverreplycount, serverquerycount, statnumplayers, statmaxplayers);
M_PrintRed((640 - strlen(s) * 8) / 2, 32, s);
if (*m_return_reason)
M_Print(16, menu_height - 8, m_return_reason);
const float * RESTRICT n = model->surfmesh.data_normal3f;
if (svector3f && tvector3f)
{
- const float * RESTRICT sv = model->surfmesh.data_svector3f;
- const float * RESTRICT tv = model->surfmesh.data_tvector3f;
+ const float * RESTRICT svec = model->surfmesh.data_svector3f;
+ const float * RESTRICT tvec = model->surfmesh.data_tvector3f;
// Note that for SSE each iteration stores one element past end, so we break one vertex short
// and handle that with scalars in that case
- for (i = 0; i < model->surfmesh.num_vertices; i++, v += 3, n += 3, sv += 3, tv += 3, b++,
+ for (i = 0; i < model->surfmesh.num_vertices; i++, v += 3, n += 3, svec += 3, tvec += 3, b++,
vertex3f += 3, normal3f += 3, svector3f += 3, tvector3f += 3)
{
LOAD_MATRIX4();
TRANSFORM_POSITION(v, vertex3f);
TRANSFORM_VECTOR(n, normal3f);
- TRANSFORM_VECTOR(sv, svector3f);
- TRANSFORM_VECTOR(tv, tvector3f);
+ TRANSFORM_VECTOR(svec, svector3f);
+ TRANSFORM_VECTOR(tvec, tvector3f);
}
return;
if (svector3f)
{
- const float * RESTRICT sv = model->surfmesh.data_svector3f;
+ const float * RESTRICT svec = model->surfmesh.data_svector3f;
const unsigned short * RESTRICT b = model->surfmesh.blends;
- for (i = 0; i < model->surfmesh.num_vertices; i++, sv += 3, b++, svector3f += 3)
+ for (i = 0; i < model->surfmesh.num_vertices; i++, svec += 3, b++, svector3f += 3)
{
LOAD_MATRIX3();
- TRANSFORM_VECTOR(sv, svector3f);
+ TRANSFORM_VECTOR(svec, svector3f);
}
}
if (tvector3f)
{
- const float * RESTRICT tv = model->surfmesh.data_tvector3f;
+ const float * RESTRICT tvec = model->surfmesh.data_tvector3f;
const unsigned short * RESTRICT b = model->surfmesh.blends;
- for (i = 0; i < model->surfmesh.num_vertices; i++, tv += 3, b++, tvector3f += 3)
+ for (i = 0; i < model->surfmesh.num_vertices; i++, tvec += 3, b++, tvector3f += 3)
{
LOAD_MATRIX3();
- TRANSFORM_VECTOR(tv, tvector3f);
+ TRANSFORM_VECTOR(tvec, tvector3f);
}
}
}
int blends;
matrix4x4_t *bonepose;
matrix4x4_t *boneposerelative;
- float m[12];
const blendweights_t * RESTRICT weights;
int num_vertices_minus_one;
{
for (i = 0;i < model->num_bones;i++)
{
- const short * RESTRICT pose7s = model->data_poses7s + 7 * (frameblend[0].subframe * model->num_bones + i);
- float lerp = frameblend[0].lerp,
- tx = pose7s[0], ty = pose7s[1], tz = pose7s[2],
- rx = pose7s[3] * lerp,
- ry = pose7s[4] * lerp,
- rz = pose7s[5] * lerp,
- rw = pose7s[6] * lerp,
- dx = tx*rw + ty*rz - tz*ry,
- dy = -tx*rz + ty*rw + tz*rx,
- dz = tx*ry - ty*rx + tz*rw,
- dw = -tx*rx - ty*ry - tz*rz,
+ float m[12];
+ const short * RESTRICT firstpose7s = model->data_poses7s + 7 * (frameblend[0].subframe * model->num_bones + i);
+ float firstlerp = frameblend[0].lerp,
+ firsttx = firstpose7s[0], firstty = firstpose7s[1], firsttz = firstpose7s[2],
+ rx = firstpose7s[3] * firstlerp,
+ ry = firstpose7s[4] * firstlerp,
+ rz = firstpose7s[5] * firstlerp,
+ rw = firstpose7s[6] * firstlerp,
+ dx = firsttx*rw + firstty*rz - firsttz*ry,
+ dy = -firsttx*rz + firstty*rw + firsttz*rx,
+ dz = firsttx*ry - firstty*rx + firsttz*rw,
+ dw = -firsttx*rx - firstty*ry - firsttz*rz,
scale, sx, sy, sz, sw;
for (blends = 1;blends < MAX_FRAMEBLENDS && frameblend[blends].lerp > 0;blends++)
{
- const short * RESTRICT pose7s = model->data_poses7s + 7 * (frameblend[blends].subframe * model->num_bones + i);
- float lerp = frameblend[blends].lerp,
- tx = pose7s[0], ty = pose7s[1], tz = pose7s[2],
- qx = pose7s[3], qy = pose7s[4], qz = pose7s[5], qw = pose7s[6];
- if(rx*qx + ry*qy + rz*qz + rw*qw < 0) lerp = -lerp;
- qx *= lerp;
- qy *= lerp;
- qz *= lerp;
- qw *= lerp;
+ const short * RESTRICT blendpose7s = model->data_poses7s + 7 * (frameblend[blends].subframe * model->num_bones + i);
+ float blendlerp = frameblend[blends].lerp,
+ blendtx = blendpose7s[0], blendty = blendpose7s[1], blendtz = blendpose7s[2],
+ qx = blendpose7s[3], qy = blendpose7s[4], qz = blendpose7s[5], qw = blendpose7s[6];
+ if(rx*qx + ry*qy + rz*qz + rw*qw < 0) blendlerp = -blendlerp;
+ qx *= blendlerp;
+ qy *= blendlerp;
+ qz *= blendlerp;
+ qw *= blendlerp;
rx += qx;
ry += qy;
rz += qz;
rw += qw;
- dx += tx*qw + ty*qz - tz*qy;
- dy += -tx*qz + ty*qw + tz*qx;
- dz += tx*qy - ty*qx + tz*qw;
- dw += -tx*qx - ty*qy - tz*qz;
+ dx += blendtx*qw + blendty*qz - blendtz*qy;
+ dy += -blendtx*qz + blendty*qw + blendtz*qx;
+ dz += blendtx*qy - blendty*qx + blendtz*qw;
+ dw += -blendtx*qx - blendty*qy - blendtz*qz;
}
scale = 1.0f / (rx*rx + ry*ry + rz*rz + rw*rw);
sx = rx * scale;
const float * RESTRICT n = model->surfmesh.data_normal3f;
if (svector3f && tvector3f)
{
- const float * RESTRICT sv = model->surfmesh.data_svector3f;
- const float * RESTRICT tv = model->surfmesh.data_tvector3f;
+ const float * RESTRICT svec = model->surfmesh.data_svector3f;
+ const float * RESTRICT tvec = model->surfmesh.data_tvector3f;
// Note that for SSE each iteration stores one element past end, so we break one vertex short
// and handle that with scalars in that case
- for (i = 0; i < num_vertices_minus_one; i++, v += 3, n += 3, sv += 3, tv += 3, b++,
+ for (i = 0; i < num_vertices_minus_one; i++, v += 3, n += 3, svec += 3, tvec += 3, b++,
vertex3f += 3, normal3f += 3, svector3f += 3, tvector3f += 3)
{
LOAD_MATRIX4();
TRANSFORM_POSITION(v, vertex3f);
TRANSFORM_VECTOR(n, normal3f);
- TRANSFORM_VECTOR(sv, svector3f);
- TRANSFORM_VECTOR(tv, tvector3f);
+ TRANSFORM_VECTOR(svec, svector3f);
+ TRANSFORM_VECTOR(tvec, tvector3f);
}
// Last vertex needs to be done with scalars to avoid reading/writing 1 word past end of arrays
LOAD_MATRIX_SCALAR();
TRANSFORM_POSITION_SCALAR(v, vertex3f);
TRANSFORM_VECTOR_SCALAR(n, normal3f);
- TRANSFORM_VECTOR_SCALAR(sv, svector3f);
- TRANSFORM_VECTOR_SCALAR(tv, tvector3f);
+ TRANSFORM_VECTOR_SCALAR(svec, svector3f);
+ TRANSFORM_VECTOR_SCALAR(tvec, tvector3f);
}
//printf("elapsed ticks: %llu\n", rdtsc() - ts); // XXX
return;
if (svector3f)
{
- const float * RESTRICT sv = model->surfmesh.data_svector3f;
+ const float * RESTRICT svec = model->surfmesh.data_svector3f;
const unsigned short * RESTRICT b = model->surfmesh.blends;
- for (i = 0; i < num_vertices_minus_one; i++, sv += 3, b++, svector3f += 3)
+ for (i = 0; i < num_vertices_minus_one; i++, svec += 3, b++, svector3f += 3)
{
LOAD_MATRIX3();
- TRANSFORM_VECTOR(sv, svector3f);
+ TRANSFORM_VECTOR(svec, svector3f);
}
{
LOAD_MATRIX_SCALAR();
- TRANSFORM_VECTOR_SCALAR(sv, svector3f);
+ TRANSFORM_VECTOR_SCALAR(svec, svector3f);
}
}
if (tvector3f)
{
- const float * RESTRICT tv = model->surfmesh.data_tvector3f;
+ const float * RESTRICT tvec = model->surfmesh.data_tvector3f;
const unsigned short * RESTRICT b = model->surfmesh.blends;
- for (i = 0; i < num_vertices_minus_one; i++, tv += 3, b++, tvector3f += 3)
+ for (i = 0; i < num_vertices_minus_one; i++, tvec += 3, b++, tvector3f += 3)
{
LOAD_MATRIX3();
- TRANSFORM_VECTOR(tv, tvector3f);
+ TRANSFORM_VECTOR(tvec, tvector3f);
}
{
LOAD_MATRIX_SCALAR();
- TRANSFORM_VECTOR_SCALAR(tv, tvector3f);
+ TRANSFORM_VECTOR_SCALAR(tvec, tvector3f);
}
}
for (i = 0;i < model->num_bones;i++)
{
// blend by transform each quaternion/translation into a dual-quaternion first, then blending
- const short * RESTRICT pose7s = model->data_poses7s + 7 * (frameblend[0].subframe * model->num_bones + i);
- float lerp = frameblend[0].lerp,
- tx = pose7s[0], ty = pose7s[1], tz = pose7s[2],
- rx = pose7s[3] * lerp,
- ry = pose7s[4] * lerp,
- rz = pose7s[5] * lerp,
- rw = pose7s[6] * lerp,
- dx = tx*rw + ty*rz - tz*ry,
- dy = -tx*rz + ty*rw + tz*rx,
- dz = tx*ry - ty*rx + tz*rw,
- dw = -tx*rx - ty*ry - tz*rz,
+ const short * RESTRICT firstpose7s = model->data_poses7s + 7 * (frameblend[0].subframe * model->num_bones + i);
+ float firstlerp = frameblend[0].lerp,
+ firsttx = firstpose7s[0], firstty = firstpose7s[1], firsttz = firstpose7s[2],
+ rx = firstpose7s[3] * firstlerp,
+ ry = firstpose7s[4] * firstlerp,
+ rz = firstpose7s[5] * firstlerp,
+ rw = firstpose7s[6] * firstlerp,
+ dx = firsttx*rw + firstty*rz - firsttz*ry,
+ dy = -firsttx*rz + firstty*rw + firsttz*rx,
+ dz = firsttx*ry - firstty*rx + firsttz*rw,
+ dw = -firsttx*rx - firstty*ry - firsttz*rz,
scale, sx, sy, sz, sw;
for (blends = 1;blends < MAX_FRAMEBLENDS && frameblend[blends].lerp > 0;blends++)
{
- const short * RESTRICT pose7s = model->data_poses7s + 7 * (frameblend[blends].subframe * model->num_bones + i);
- float lerp = frameblend[blends].lerp,
- tx = pose7s[0], ty = pose7s[1], tz = pose7s[2],
- qx = pose7s[3], qy = pose7s[4], qz = pose7s[5], qw = pose7s[6];
- if(rx*qx + ry*qy + rz*qz + rw*qw < 0) lerp = -lerp;
- qx *= lerp;
- qy *= lerp;
- qz *= lerp;
- qw *= lerp;
+ const short * RESTRICT blendpose7s = model->data_poses7s + 7 * (frameblend[blends].subframe * model->num_bones + i);
+ float blendlerp = frameblend[blends].lerp,
+ blendtx = blendpose7s[0], blendty = blendpose7s[1], blendtz = blendpose7s[2],
+ qx = blendpose7s[3], qy = blendpose7s[4], qz = blendpose7s[5], qw = blendpose7s[6];
+ if(rx*qx + ry*qy + rz*qz + rw*qw < 0) blendlerp = -blendlerp;
+ qx *= blendlerp;
+ qy *= blendlerp;
+ qz *= blendlerp;
+ qw *= blendlerp;
rx += qx;
ry += qy;
rz += qz;
rw += qw;
- dx += tx*qw + ty*qz - tz*qy;
- dy += -tx*qz + ty*qw + tz*qx;
- dz += tx*qy - ty*qx + tz*qw;
- dw += -tx*qx - ty*qy - tz*qz;
+ dx += blendtx*qw + blendty*qz - blendtz*qy;
+ dy += -blendtx*qz + blendty*qw + blendtz*qx;
+ dz += blendtx*qy - blendty*qx + blendtz*qw;
+ dw += -blendtx*qx - blendty*qy - blendtz*qz;
}
// generate a matrix from the dual-quaternion, implicitly normalizing it in the process
scale = 1.0f / (rx*rx + ry*ry + rz*rz + rw*rw);
Mod_AllocLightmap_Init(&allocState, lightmapsize, lightmapsize);
for (surfacenum = 0, surface = loadmodel->data_surfaces;surfacenum < count;surfacenum++, surface++)
{
- int i, iu, iv, lightmapx = 0, lightmapy = 0;
+ int iu, iv, lightmapx = 0, lightmapy = 0;
float u, v, ubase, vbase, uscale, vscale;
if (!loadmodel->brushq1.lightmapupdateflags[surfacenum])
static void Mod_Q2BSP_LoadTexinfo(sizebuf_t *sb)
{
mtexinfo_t *out;
- int i, j, k, l, count;
+ int i, l, count;
int structsize = 76;
int maxtextures = 1024; // hardcoded limit of quake2 engine, so we may as well use it as an upper bound
char filename[MAX_QPATH];
for (i = 0;i < count;i++, out++)
{
+ int j, k;
for (k = 0;k < 2;k++)
for (j = 0;j < 4;j++)
out->vecs[k][j] = MSG_ReadLittleFloat(sb);
// if we encounter the textures out of order, the later ones won't mark the earlier ones in a sequence, so the earlier
for (i = 0, out = loadmodel->brushq1.texinfo;i < count;i++, out++)
{
- int j;
+ int j, k;
texture_t *t = loadmodel->data_textures + out->textureindex;
t->currentframe = t; // fix the reallocated pointer
int maxvn = 0, numvn = 1;
char *texturenames = NULL;
float dist, modelradius, modelyawradius, yawradius;
- float *v = NULL;
- float *vt = NULL;
- float *vn = NULL;
+ float *obj_v = NULL;
+ float *obj_vt = NULL;
+ float *obj_vn = NULL;
float mins[3];
float maxs[3];
float corner[3];
skinfile_t *skinfiles = NULL;
unsigned char *data = NULL;
int *submodelfirstsurface;
- msurface_t *surface;
+ msurface_t *tempsurface;
msurface_t *tempsurfaces;
memset(&vfirst, 0, sizeof(vfirst));
if (maxv <= numv)
{
maxv = max(maxv * 2, 1024);
- v = (float *)Mem_Realloc(tempmempool, v, maxv * sizeof(float[3]));
+ obj_v = (float *)Mem_Realloc(tempmempool, obj_v, maxv * sizeof(float[3]));
}
if(mod_obj_orientation.integer)
{
- v[numv*3+0] = atof(argv[1]);
- v[numv*3+2] = atof(argv[2]);
- v[numv*3+1] = atof(argv[3]);
+ obj_v[numv*3+0] = atof(argv[1]);
+ obj_v[numv*3+2] = atof(argv[2]);
+ obj_v[numv*3+1] = atof(argv[3]);
}
else
{
- v[numv*3+0] = atof(argv[1]);
- v[numv*3+1] = atof(argv[2]);
- v[numv*3+2] = atof(argv[3]);
+ obj_v[numv*3+0] = atof(argv[1]);
+ obj_v[numv*3+1] = atof(argv[2]);
+ obj_v[numv*3+2] = atof(argv[3]);
}
numv++;
}
if (maxvt <= numvt)
{
maxvt = max(maxvt * 2, 1024);
- vt = (float *)Mem_Realloc(tempmempool, vt, maxvt * sizeof(float[2]));
+ obj_vt = (float *)Mem_Realloc(tempmempool, obj_vt, maxvt * sizeof(float[2]));
}
- vt[numvt*2+0] = atof(argv[1]);
- vt[numvt*2+1] = 1-atof(argv[2]);
+ obj_vt[numvt*2+0] = atof(argv[1]);
+ obj_vt[numvt*2+1] = 1-atof(argv[2]);
numvt++;
}
else if (!strcmp(argv[0], "vn"))
if (maxvn <= numvn)
{
maxvn = max(maxvn * 2, 1024);
- vn = (float *)Mem_Realloc(tempmempool, vn, maxvn * sizeof(float[3]));
+ obj_vn = (float *)Mem_Realloc(tempmempool, obj_vn, maxvn * sizeof(float[3]));
}
if(mod_obj_orientation.integer)
{
- vn[numvn*3+0] = atof(argv[1]);
- vn[numvn*3+2] = atof(argv[2]);
- vn[numvn*3+1] = atof(argv[3]);
+ obj_vn[numvn*3+0] = atof(argv[1]);
+ obj_vn[numvn*3+2] = atof(argv[2]);
+ obj_vn[numvn*3+1] = atof(argv[3]);
}
else
{
- vn[numvn*3+0] = atof(argv[1]);
- vn[numvn*3+1] = atof(argv[2]);
- vn[numvn*3+2] = atof(argv[3]);
+ obj_vn[numvn*3+0] = atof(argv[1]);
+ obj_vn[numvn*3+1] = atof(argv[2]);
+ obj_vn[numvn*3+2] = atof(argv[3]);
}
numvn++;
}
vcurrent.nextindex = -1;
vcurrent.textureindex = textureindex;
vcurrent.submodelindex = submodelindex;
- if (v && index1 >= 0 && index1 < numv)
- VectorCopy(v + 3*index1, vcurrent.v);
- if (vt && index2 >= 0 && index2 < numvt)
- Vector2Copy(vt + 2*index2, vcurrent.vt);
- if (vn && index3 >= 0 && index3 < numvn)
- VectorCopy(vn + 3*index3, vcurrent.vn);
+ if (obj_v && index1 >= 0 && index1 < numv)
+ VectorCopy(obj_v + 3*index1, vcurrent.v);
+ if (obj_vt && index2 >= 0 && index2 < numvt)
+ Vector2Copy(obj_vt + 2*index2, vcurrent.vt);
+ if (obj_vn && index3 >= 0 && index3 < numvn)
+ VectorCopy(obj_vn + 3*index3, vcurrent.vn);
if (numtriangles == 0)
{
VectorCopy(vcurrent.v, mins);
// allocate storage for the worst case number of surfaces, later we resize
tempsurfaces = (msurface_t *)Mem_Alloc(loadmodel->mempool, numtextures * loadmodel->brush.numsubmodels * sizeof(msurface_t));
submodelfirstsurface = (int *)Mem_Alloc(loadmodel->mempool, (loadmodel->brush.numsubmodels+1) * sizeof(int));
- surface = tempsurfaces;
+ tempsurface = tempsurfaces;
for (submodelindex = 0;submodelindex < loadmodel->brush.numsubmodels;submodelindex++)
{
submodelfirstsurface[submodelindex] = loadmodel->num_surfaces;
surfacevertices = 0;
surfaceelements = 0;
// we hack in a texture index in the surface to be fixed up later...
- surface->texture = (texture_t *)((size_t)textureindex);
+ tempsurface->texture = (texture_t *)((size_t)textureindex);
// calculate bounds as we go
- VectorCopy(thisvertex->v, surface->mins);
- VectorCopy(thisvertex->v, surface->maxs);
+ VectorCopy(thisvertex->v, tempsurface->mins);
+ VectorCopy(thisvertex->v, tempsurface->maxs);
for (;vertexindex < numtriangles*3;vertexindex++)
{
thisvertex = vertices + vertexindex;
if (thisvertex->textureindex != textureindex)
continue;
// add vertex to surface bounds
- surface->mins[0] = min(surface->mins[0], thisvertex->v[0]);
- surface->mins[1] = min(surface->mins[1], thisvertex->v[1]);
- surface->mins[2] = min(surface->mins[2], thisvertex->v[2]);
- surface->maxs[0] = max(surface->maxs[0], thisvertex->v[0]);
- surface->maxs[1] = max(surface->maxs[1], thisvertex->v[1]);
- surface->maxs[2] = max(surface->maxs[2], thisvertex->v[2]);
+ tempsurface->mins[0] = min(tempsurface->mins[0], thisvertex->v[0]);
+ tempsurface->mins[1] = min(tempsurface->mins[1], thisvertex->v[1]);
+ tempsurface->mins[2] = min(tempsurface->mins[2], thisvertex->v[2]);
+ tempsurface->maxs[0] = max(tempsurface->maxs[0], thisvertex->v[0]);
+ tempsurface->maxs[1] = max(tempsurface->maxs[1], thisvertex->v[1]);
+ tempsurface->maxs[2] = max(tempsurface->maxs[2], thisvertex->v[2]);
// add the vertex if it is not found in the merged set, and
// get its index (triangle element) for the surface
vertexhashindex = (unsigned int)(thisvertex->v[0] * 3571 + thisvertex->v[0] * 1777 + thisvertex->v[0] * 457) % (unsigned int)vertexhashsize;
surfaceelements++;
}
surfacetriangles = surfaceelements / 3;
- surface->num_vertices = surfacevertices;
- surface->num_triangles = surfacetriangles;
- surface->num_firstvertex = firstvertex;
- surface->num_firsttriangle = firsttriangle;
- firstvertex += surface->num_vertices;
- firsttriangle += surface->num_triangles;
- surface++;
+ tempsurface->num_vertices = surfacevertices;
+ tempsurface->num_triangles = surfacetriangles;
+ tempsurface->num_firstvertex = firstvertex;
+ tempsurface->num_firsttriangle = firsttriangle;
+ firstvertex += tempsurface->num_vertices;
+ firsttriangle += tempsurface->num_triangles;
+ tempsurface++;
loadmodel->num_surfaces++;
}
}
// free data
Mem_Free(vertices);
Mem_Free(texturenames);
- Mem_Free(v);
- Mem_Free(vt);
- Mem_Free(vn);
+ Mem_Free(obj_v);
+ Mem_Free(obj_vt);
+ Mem_Free(obj_vn);
Mem_Free(vertexhashtable);
Mem_Free(vertexhashdata);
for (j = 0;j < mod->nummodelsurfaces;j++)
{
const msurface_t *surface = mod->data_surfaces + j + mod->firstmodelsurface;
- const float *v = mod->surfmesh.data_vertex3f + 3 * surface->num_firstvertex;
+ const float *v3f = mod->surfmesh.data_vertex3f + 3 * surface->num_firstvertex;
int k;
if (!surface->num_vertices)
continue;
if (!l)
{
l = true;
- VectorCopy(v, mod->normalmins);
- VectorCopy(v, mod->normalmaxs);
+ VectorCopy(v3f, mod->normalmins);
+ VectorCopy(v3f, mod->normalmaxs);
}
- for (k = 0;k < surface->num_vertices;k++, v += 3)
+ for (k = 0;k < surface->num_vertices;k++, v3f += 3)
{
- mod->normalmins[0] = min(mod->normalmins[0], v[0]);
- mod->normalmins[1] = min(mod->normalmins[1], v[1]);
- mod->normalmins[2] = min(mod->normalmins[2], v[2]);
- mod->normalmaxs[0] = max(mod->normalmaxs[0], v[0]);
- mod->normalmaxs[1] = max(mod->normalmaxs[1], v[1]);
- mod->normalmaxs[2] = max(mod->normalmaxs[2], v[2]);
+ mod->normalmins[0] = min(mod->normalmins[0], v3f[0]);
+ mod->normalmins[1] = min(mod->normalmins[1], v3f[1]);
+ mod->normalmins[2] = min(mod->normalmins[2], v3f[2]);
+ mod->normalmaxs[0] = max(mod->normalmaxs[0], v3f[0]);
+ mod->normalmaxs[1] = max(mod->normalmaxs[1], v3f[1]);
+ mod->normalmaxs[2] = max(mod->normalmaxs[2], v3f[2]);
}
}
corner[0] = max(fabs(mod->normalmins[0]), fabs(mod->normalmaxs[0]));
void Mod_BuildTextureVectorsFromNormals(int firstvertex, int numvertices, int numtriangles, const float *vertex3f, const float *texcoord2f, const float *normal3f, const int *elements, float *svector3f, float *tvector3f, qboolean areaweighting)
{
int i, tnum;
- float sdir[3], tdir[3], normal[3], *sv, *tv;
+ float sdir[3], tdir[3], normal[3], *svec, *tvec;
const float *v0, *v1, *v2, *tc0, *tc1, *tc2, *n;
float f, tangentcross[3], v10[3], v20[3], tc10[2], tc20[2];
const int *e;
// make the tangents completely perpendicular to the surface normal, and
// then normalize them
// 16 assignments, 2 divide, 2 sqrt, 2 negates, 14 adds, 24 multiplies
- for (i = 0, sv = svector3f + 3 * firstvertex, tv = tvector3f + 3 * firstvertex, n = normal3f + 3 * firstvertex;i < numvertices;i++, sv += 3, tv += 3, n += 3)
+ for (i = 0, svec = svector3f + 3 * firstvertex, tvec = tvector3f + 3 * firstvertex, n = normal3f + 3 * firstvertex;i < numvertices;i++, svec += 3, tvec += 3, n += 3)
{
- f = -DotProduct(sv, n);
- VectorMA(sv, f, n, sv);
- VectorNormalize(sv);
- f = -DotProduct(tv, n);
- VectorMA(tv, f, n, tv);
- VectorNormalize(tv);
+ f = -DotProduct(svec, n);
+ VectorMA(svec, f, n, svec);
+ VectorNormalize(svec);
+ f = -DotProduct(tvec, n);
+ VectorMA(tvec, f, n, tvec);
+ VectorNormalize(tvec);
}
}
for (j = 0;j < mod->nummodelsurfaces;j++)
{
const msurface_t *surface = mod->data_surfaces + j + mod->firstmodelsurface;
- int t = (int)(surface->texture - mod->data_textures);
+ t = (int)(surface->texture - mod->data_textures);
numsurfacesfortexture[t]++;
}
j = 0;
for (j = 0;j < mod->nummodelsurfaces;j++)
{
const msurface_t *surface = mod->data_surfaces + j + mod->firstmodelsurface;
- int t = (int)(surface->texture - mod->data_textures);
+ t = (int)(surface->texture - mod->data_textures);
mod->sortedmodelsurfaces[firstsurfacefortexture[t]++] = j + mod->firstmodelsurface;
}
Mem_Free(firstsurfacefortexture);
int serverquerycount = 0;
int serverreplycount = 0;
-challenge_t challenge[MAX_CHALLENGES];
+challenge_t challenges[MAX_CHALLENGES];
#ifdef CONFIG_MENU
/// this is only false if there are still servers left to query
int length;
char teambuf[3];
const char *crypto_idstring;
- const char *str;
+ const char *worldstatusstr;
// How many clients are there?
for (i = 0;i < (unsigned int)svs.maxclients;i++)
}
*qcstatus = 0;
- str = PRVM_GetString(prog, PRVM_serverglobalstring(worldstatus));
- if(str && *str)
+ worldstatusstr = PRVM_GetString(prog, PRVM_serverglobalstring(worldstatus));
+ if(worldstatusstr && *worldstatusstr)
{
char *p;
const char *q;
p = qcstatus;
- for(q = str; *q && (size_t)(p - qcstatus) < (sizeof(qcstatus) - 1); ++q)
+ for(q = worldstatusstr; *q && (size_t)(p - qcstatus) < (sizeof(qcstatus) - 1); ++q)
if(*q != '\\' && *q != '\n')
*p++ = *q;
*p = 0;
for (i = 0;i < (unsigned int)svs.maxclients;i++)
{
- client_t *cl = &svs.clients[i];
- if (cl->active)
+ client_t *client = &svs.clients[i];
+ if (client->active)
{
int nameind, cleanind, pingvalue;
char curchar;
- char cleanname [sizeof(cl->name)];
- const char *str;
+ char cleanname [sizeof(client->name)];
+ const char *statusstr;
prvm_edict_t *ed;
// Remove all characters '"' and '\' in the player name
cleanind = 0;
do
{
- curchar = cl->name[nameind++];
+ curchar = client->name[nameind++];
if (curchar != '"' && curchar != '\\')
{
cleanname[cleanind++] = curchar;
} while (curchar != '\0');
cleanname[cleanind] = 0; // cleanind is always a valid index even at this point
- pingvalue = (int)(cl->ping * 1000.0f);
- if(cl->netconnection)
+ pingvalue = (int)(client->ping * 1000.0f);
+ if(client->netconnection)
pingvalue = bound(1, pingvalue, 9999);
else
pingvalue = 0;
*qcstatus = 0;
ed = PRVM_EDICT_NUM(i + 1);
- str = PRVM_GetString(prog, PRVM_serveredictstring(ed, clientstatus));
- if(str && *str)
+ statusstr = PRVM_GetString(prog, PRVM_serveredictstring(ed, clientstatus));
+ if(statusstr && *statusstr)
{
char *p;
const char *q;
p = qcstatus;
- for(q = str; *q && p != qcstatus + sizeof(qcstatus) - 1; ++q)
+ for(q = statusstr; *q && p != qcstatus + sizeof(qcstatus) - 1; ++q)
if(*q != '\\' && *q != '"' && !ISWHITESPACE(*q))
*p++ = *q;
*p = 0;
if (IS_NEXUIZ_DERIVED(gamemode) && (teamplay.integer > 0))
{
- if(cl->frags == -666) // spectator
+ if(client->frags == -666) // spectator
strlcpy(teambuf, " 0", sizeof(teambuf));
- else if(cl->colors == 0x44) // red team
+ else if(client->colors == 0x44) // red team
strlcpy(teambuf, " 1", sizeof(teambuf));
- else if(cl->colors == 0xDD) // blue team
+ else if(client->colors == 0xDD) // blue team
strlcpy(teambuf, " 2", sizeof(teambuf));
- else if(cl->colors == 0xCC) // yellow team
+ else if(client->colors == 0xCC) // yellow team
strlcpy(teambuf, " 3", sizeof(teambuf));
- else if(cl->colors == 0x99) // pink team
+ else if(client->colors == 0x99) // pink team
strlcpy(teambuf, " 4", sizeof(teambuf));
else
strlcpy(teambuf, " 0", sizeof(teambuf));
cleanname);
else
length = dpsnprintf(ptr, left, "%d %d%s \"%s\"\n",
- cl->frags,
+ client->frags,
pingvalue,
teambuf,
cleanname);
char mdfourbuf[16];
int i;
- if(slen < (int)(sizeof(challenge[0].string)) - 1)
+ if(slen < (int)(sizeof(challenges[0].string)) - 1)
return false;
// validate the challenge
for (i = 0;i < MAX_CHALLENGES;i++)
- if(challenge[i].time > 0)
- if (!LHNETADDRESS_Compare(peeraddress, &challenge[i].address) && !strncmp(challenge[i].string, s, sizeof(challenge[0].string) - 1))
+ if(challenges[i].time > 0)
+ if (!LHNETADDRESS_Compare(peeraddress, &challenges[i].address) && !strncmp(challenges[i].string, s, sizeof(challenges[0].string) - 1))
break;
// if the challenge is not recognized, drop the packet
if (i == MAX_CHALLENGES)
return false;
// unmark challenge to prevent replay attacks
- challenge[i].time = 0;
+ challenges[i].time = 0;
return true;
}
{
int i, ret, clientnum, best;
double besttime;
- client_t *client;
- char *s, *string, response[1400], addressstring2[128];
+ char *string, response[1400], addressstring2[128];
static char stringbuf[16384]; // server only
qboolean islocal = (LHNETADDRESS_GetAddressType(peeraddress) == LHNETADDRESSTYPE_LOOP);
char senddata[NET_HEADERSIZE+NET_MAXMESSAGE+CRYPTO_HEADERSIZE];
{
for (i = 0, best = 0, besttime = realtime;i < MAX_CHALLENGES;i++)
{
- if(challenge[i].time > 0)
- if (!LHNETADDRESS_Compare(peeraddress, &challenge[i].address))
+ if(challenges[i].time > 0)
+ if (!LHNETADDRESS_Compare(peeraddress, &challenges[i].address))
break;
- if (besttime > challenge[i].time)
- besttime = challenge[best = i].time;
+ if (besttime > challenges[i].time)
+ besttime = challenges[best = i].time;
}
// if we did not find an exact match, choose the oldest and
// update address and string
if (i == MAX_CHALLENGES)
{
i = best;
- challenge[i].address = *peeraddress;
- NetConn_BuildChallengeString(challenge[i].string, sizeof(challenge[i].string));
+ challenges[i].address = *peeraddress;
+ NetConn_BuildChallengeString(challenges[i].string, sizeof(challenges[i].string));
}
else
{
// flood control: drop if requesting challenge too often
- if(challenge[i].time > realtime - net_challengefloodblockingtimeout.value)
+ if(challenges[i].time > realtime - net_challengefloodblockingtimeout.value)
return true;
}
- challenge[i].time = realtime;
+ challenges[i].time = realtime;
// send the challenge
memcpy(response, "\377\377\377\377", 4);
- dpsnprintf(response+4, sizeof(response)-4, "challenge %s", challenge[i].string);
+ dpsnprintf(response+4, sizeof(response)-4, "challenge %s", challenges[i].string);
response_len = strlen(response) + 1;
Crypto_ServerAppendToChallenge(string, length, response, &response_len, sizeof(response));
NetConn_Write(mysocket, response, (int)response_len, peeraddress);
}
if (length > 8 && !memcmp(string, "connect\\", 8))
{
+ char *s;
+ client_t *client;
crypto_t *crypto = Crypto_ServerGetInstance(peeraddress);
string += 7;
length -= 7;
{
// validate the challenge
for (i = 0;i < MAX_CHALLENGES;i++)
- if(challenge[i].time > 0)
- if (!LHNETADDRESS_Compare(peeraddress, &challenge[i].address) && !strcmp(challenge[i].string, s))
+ if(challenges[i].time > 0)
+ if (!LHNETADDRESS_Compare(peeraddress, &challenges[i].address) && !strcmp(challenges[i].string, s))
break;
// if the challenge is not recognized, drop the packet
if (i == MAX_CHALLENGES)
}
if (length >= 5 && !memcmp(string, "rcon ", 5))
{
- int i;
+ int j;
char *s = string + 5;
char *endpos = string + length + 1; // one behind the NUL, so adding strlen+1 will eventually reach it
char password[64];
if(rcon_secure.integer > 0)
return true;
- for (i = 0;!ISWHITESPACE(*s);s++)
- if (i < (int)sizeof(password) - 1)
- password[i++] = *s;
+ for (j = 0;!ISWHITESPACE(*s);s++)
+ if (j < (int)sizeof(password) - 1)
+ password[j++] = *s;
if(ISWHITESPACE(*s) && s != endpos) // skip leading ugly space
++s;
- password[i] = 0;
+ password[j] = 0;
if (!ISWHITESPACE(password[0]))
{
const char *userlevel = RCon_Authenticate(peeraddress, password, s, endpos, plaintext_matching, NULL, 0);
int c;
int protocolnumber;
const char *protocolname;
+ client_t *knownclient;
+ client_t *newclient;
data += 4;
length -= 4;
SZ_Clear(&sv_message);
}
// see if this connect request comes from a known client
- for (clientnum = 0, client = svs.clients;clientnum < svs.maxclients;clientnum++, client++)
+ for (clientnum = 0, knownclient = svs.clients;clientnum < svs.maxclients;clientnum++, knownclient++)
{
- if (client->netconnection && LHNETADDRESS_Compare(peeraddress, &client->netconnection->peeraddress) == 0)
+ if (knownclient->netconnection && LHNETADDRESS_Compare(peeraddress, &knownclient->netconnection->peeraddress) == 0)
{
// this is either a duplicate connection request
// or coming back from a timeout
// (if so, keep their stuff intact)
crypto_t *crypto = Crypto_ServerGetInstance(peeraddress);
- if((crypto && crypto->authenticated) || client->netconnection->crypto.authenticated)
+ if((crypto && crypto->authenticated) || knownclient->netconnection->crypto.authenticated)
{
if (developer_extra.integer)
Con_Printf("Datagram_ParseConnectionless: sending CCREP_REJECT \"Attempt to downgrade crypto.\" to %s.\n", addressstring2);
// save space for the header, filled in later
MSG_WriteLong(&sv_message, 0);
MSG_WriteByte(&sv_message, CCREP_ACCEPT);
- MSG_WriteLong(&sv_message, LHNETADDRESS_GetPort(LHNET_AddressFromSocket(client->netconnection->mysocket)));
+ MSG_WriteLong(&sv_message, LHNETADDRESS_GetPort(LHNET_AddressFromSocket(knownclient->netconnection->mysocket)));
StoreBigLong(sv_message.data, NETFLAG_CTL | (sv_message.cursize & NETFLAG_LENGTH_MASK));
NetConn_Write(mysocket, sv_message.data, sv_message.cursize, peeraddress);
SZ_Clear(&sv_message);
// if client is already spawned, re-send the
// serverinfo message as they'll need it to play
- if (client->begun)
- SV_SendServerinfo(client);
+ if (knownclient->begun)
+ SV_SendServerinfo(knownclient);
return true;
}
}
break;
// find a slot for the new client
- for (clientnum = 0, client = svs.clients;clientnum < svs.maxclients;clientnum++, client++)
+ for (clientnum = 0, newclient = svs.clients;clientnum < svs.maxclients;clientnum++, newclient++)
{
netconn_t *conn;
- if (!client->active && (client->netconnection = conn = NetConn_Open(mysocket, peeraddress)) != NULL)
+ if (!newclient->active && (newclient->netconnection = conn = NetConn_Open(mysocket, peeraddress)) != NULL)
{
// connect to the client
// everything is allocated, just fill in the details
}
challenge_t;
-extern challenge_t challenge[MAX_CHALLENGES];
+extern challenge_t challenges[MAX_CHALLENGES];
#endif
#define ENTITYSIZEPROFILING_END(msg, num, flags) \
if(developer_networkentities.integer >= 2) \
{ \
- prvm_edict_t *ed = prog->edicts + num; \
- Con_Printf("sent entity update of size %u for %d classname %s flags %d\n", (msg->cursize - entityprofiling_startsize), num, PRVM_serveredictstring(ed, classname) ? PRVM_GetString(prog, PRVM_serveredictstring(ed, classname)) : "(no classname)", flags); \
+ prvm_edict_t *edict = prog->edicts + num; \
+ Con_Printf("sent entity update of size %u for %d classname %s flags %d\n", (msg->cursize - entityprofiling_startsize), num, PRVM_serveredictstring(edict, classname) ? PRVM_GetString(prog, PRVM_serveredictstring(edict, classname)) : "(no classname)", flags); \
}
// CSQC entity scope values. Bitflags!
void MVM_ExecuteProgram (prvm_prog_t *prog, func_t fnum, const char *errormessage)
{
mstatement_t *st, *startst;
- mfunction_t *f, *newf;
+ mfunction_t *func, *enterfunc;
prvm_edict_t *ed;
prvm_eval_t *ptr;
int jumpcount, cachedpr_trace, exitdepth;
prog->error_cmd("MVM_ExecuteProgram: %s", errormessage);
}
- f = &prog->functions[fnum];
+ func = &prog->functions[fnum];
// after executing this function, delete all tempstrings it created
restorevm_tempstringsbuf_cursize = prog->tempstringsbuf.cursize;
exitdepth = prog->depth;
// make a stack frame
- st = &prog->statements[PRVM_EnterFunction(prog, f)];
+ st = &prog->statements[PRVM_EnterFunction(prog, func)];
// save the starting statement pointer for profiling
// (when the function exits or jumps, the (st - startst) integer value is
// added to the function's profile counter)
prog->tempstringsbuf.cursize = restorevm_tempstringsbuf_cursize;
tm = Sys_DirtyTime() - calltime;if (tm < 0 || tm >= 1800) tm = 0;
- f->totaltime += tm;
+ func->totaltime += tm;
if (prog == SVVM_prog)
SV_FlushBroadcastMessages();
void CLVM_ExecuteProgram (prvm_prog_t *prog, func_t fnum, const char *errormessage)
{
mstatement_t *st, *startst;
- mfunction_t *f, *newf;
+ mfunction_t *func, *enterfunc;
prvm_edict_t *ed;
prvm_eval_t *ptr;
int jumpcount, cachedpr_trace, exitdepth;
prog->error_cmd("CLVM_ExecuteProgram: %s", errormessage);
}
- f = &prog->functions[fnum];
+ func = &prog->functions[fnum];
// after executing this function, delete all tempstrings it created
restorevm_tempstringsbuf_cursize = prog->tempstringsbuf.cursize;
exitdepth = prog->depth;
// make a stack frame
- st = &prog->statements[PRVM_EnterFunction(prog, f)];
+ st = &prog->statements[PRVM_EnterFunction(prog, func)];
// save the starting statement pointer for profiling
// (when the function exits or jumps, the (st - startst) integer value is
// added to the function's profile counter)
prog->tempstringsbuf.cursize = restorevm_tempstringsbuf_cursize;
tm = Sys_DirtyTime() - calltime;if (tm < 0 || tm >= 1800) tm = 0;
- f->totaltime += tm;
+ func->totaltime += tm;
if (prog == SVVM_prog)
SV_FlushBroadcastMessages();
#endif
{
mstatement_t *st, *startst;
- mfunction_t *f, *newf;
+ mfunction_t *func, *enterfunc;
prvm_edict_t *ed;
prvm_eval_t *ptr;
int jumpcount, cachedpr_trace, exitdepth;
prog->error_cmd("SVVM_ExecuteProgram: %s", errormessage);
}
- f = &prog->functions[fnum];
+ func = &prog->functions[fnum];
// after executing this function, delete all tempstrings it created
restorevm_tempstringsbuf_cursize = prog->tempstringsbuf.cursize;
exitdepth = prog->depth;
// make a stack frame
- st = &prog->statements[PRVM_EnterFunction(prog, f)];
+ st = &prog->statements[PRVM_EnterFunction(prog, func)];
// save the starting statement pointer for profiling
// (when the function exits or jumps, the (st - startst) integer value is
// added to the function's profile counter)
prog->tempstringsbuf.cursize = restorevm_tempstringsbuf_cursize;
tm = Sys_DirtyTime() - calltime;if (tm < 0 || tm >= 1800) tm = 0;
- f->totaltime += tm;
+ func->totaltime += tm;
if (prog == SVVM_prog)
SV_FlushBroadcastMessages();
{
if (prog->watch_global_type != ev_void)
{
- prvm_eval_t *f = PRVM_GLOBALFIELDVALUE(prog->watch_global);
+ prvm_eval_t *g = PRVM_GLOBALFIELDVALUE(prog->watch_global);
prog->xstatement = st + 1 - cached_statements;
- PRVM_Watchpoint(prog, 1, "Global watchpoint hit by engine", prog->watch_global_type, &prog->watch_global_value, f);
+ PRVM_Watchpoint(prog, 1, "Global watchpoint hit by engine", prog->watch_global_type, &prog->watch_global_value, g);
}
if (prog->watch_field_type != ev_void && prog->watch_edict < prog->max_edicts)
{
- prvm_eval_t *f = PRVM_EDICTFIELDVALUE(prog->edicts + prog->watch_edict, prog->watch_field);
+ prvm_eval_t *g = PRVM_EDICTFIELDVALUE(prog->edicts + prog->watch_edict, prog->watch_field);
prog->xstatement = st + 1 - cached_statements;
- PRVM_Watchpoint(prog, 1, "Entityfield watchpoint hit by engine", prog->watch_field_type, &prog->watch_edictfield_value, f);
+ PRVM_Watchpoint(prog, 1, "Entityfield watchpoint hit by engine", prog->watch_field_type, &prog->watch_edictfield_value, g);
}
}
#endif
goto cleanup;
}
- newf = &prog->functions[OPA->function];
- if (newf->callcount++ == 0 && (prvm_coverage.integer & 1))
- PRVM_FunctionCoverageEvent(prog, newf);
+ enterfunc = &prog->functions[OPA->function];
+ if (enterfunc->callcount++ == 0 && (prvm_coverage.integer & 1))
+ PRVM_FunctionCoverageEvent(prog, enterfunc);
- if (newf->first_statement < 0)
+ if (enterfunc->first_statement < 0)
{
// negative first_statement values are built in functions
- int builtinnumber = -newf->first_statement;
+ int builtinnumber = -enterfunc->first_statement;
prog->xfunction->builtinsprofile++;
if (builtinnumber < prog->numbuiltins && prog->builtins[builtinnumber])
{
prog->builtins[builtinnumber](prog);
#ifdef PRVMTIMEPROFILING
tm = Sys_DirtyTime();
- newf->tprofile += (tm - starttm >= 0 && tm - starttm < 1800) ? (tm - starttm) : 0;
+ enterfunc->tprofile += (tm - starttm >= 0 && tm - starttm < 1800) ? (tm - starttm) : 0;
prog->xfunction->tbprofile += (tm - starttm >= 0 && tm - starttm < 1800) ? (tm - starttm) : 0;
starttm = tm;
#endif
prog->error_cmd("No such builtin #%i in %s; most likely cause: outdated engine build. Try updating!", builtinnumber, prog->name);
}
else
- st = cached_statements + PRVM_EnterFunction(prog, newf);
+ st = cached_statements + PRVM_EnterFunction(prog, enterfunc);
startst = st;
DISPATCH_OPCODE();
{
if (prog->watch_global_type != ev_void)
{
- prvm_eval_t *f = PRVM_GLOBALFIELDVALUE(prog->watch_global);
+ prvm_eval_t *g = PRVM_GLOBALFIELDVALUE(prog->watch_global);
prog->xstatement = st - cached_statements;
- PRVM_Watchpoint(prog, 0, "Global watchpoint hit", prog->watch_global_type, &prog->watch_global_value, f);
+ PRVM_Watchpoint(prog, 0, "Global watchpoint hit", prog->watch_global_type, &prog->watch_global_value, g);
}
if (prog->watch_field_type != ev_void && prog->watch_edict < prog->max_edicts)
{
- prvm_eval_t *f = PRVM_EDICTFIELDVALUE(prog->edicts + prog->watch_edict, prog->watch_field);
+ prvm_eval_t *g = PRVM_EDICTFIELDVALUE(prog->edicts + prog->watch_edict, prog->watch_field);
prog->xstatement = st - cached_statements;
- PRVM_Watchpoint(prog, 0, "Entityfield watchpoint hit", prog->watch_field_type, &prog->watch_edictfield_value, f);
+ PRVM_Watchpoint(prog, 0, "Entityfield watchpoint hit", prog->watch_field_type, &prog->watch_edictfield_value, g);
}
}
#endif
rtexture_t *r_shadow_shadowmap2ddepthtexture;
rtexture_t *r_shadow_shadowmapvsdcttexture;
int r_shadow_shadowmapsize; // changes for each light based on distance
-int r_shadow_shadowmaplod; // changes for each light based on distance
GLuint r_shadow_prepassgeometryfbo;
GLuint r_shadow_prepasslightingdiffusespecularfbo;
r_shadow_shadowmapshadowsampler = r_shadow_shadowmapping_useshadowsampler.integer != 0;
r_shadow_shadowmapdepthbits = r_shadow_shadowmapping_depthbits.integer;
r_shadow_shadowmapborder = bound(0, r_shadow_shadowmapping_bordersize.integer, 16);
- r_shadow_shadowmaplod = -1;
r_shadow_shadowmapsize = 0;
r_shadow_shadowmapsampler = false;
r_shadow_shadowmappcf = 0;
r_shadow_shadowmapvsdcttexture = NULL;
r_shadow_shadowmapmaxsize = 0;
r_shadow_shadowmapsize = 0;
- r_shadow_shadowmaplod = 0;
r_shadow_shadowmapfilterquality = -1;
r_shadow_shadowmapdepthbits = 0;
r_shadow_shadowmapvsdct = false;
switch (floatcolors)
{
case 0:
- pixelsbgra8 = R_FrameData_Alloc(r_shadow_bouncegrid_state.numpixels * sizeof(unsigned char[4]));
+ pixelsbgra8 = (unsigned char *)R_FrameData_Alloc(r_shadow_bouncegrid_state.numpixels * sizeof(unsigned char[4]));
for (pixelband = 0;pixelband < pixelbands;pixelband++)
{
if (pixelband == 1)
r_shadow_bouncegrid_state.texture = R_LoadTexture3D(r_shadow_texturepool, "bouncegrid", resolution[0], resolution[1], resolution[2]*pixelbands, pixelsbgra8, TEXTYPE_BGRA, TEXF_CLAMP | TEXF_ALPHA | TEXF_FORCELINEAR, 0, NULL);
break;
case 1:
- pixelsrgba16f = R_FrameData_Alloc(r_shadow_bouncegrid_state.numpixels * sizeof(unsigned short[4]));
+ pixelsrgba16f = (unsigned short *)R_FrameData_Alloc(r_shadow_bouncegrid_state.numpixels * sizeof(unsigned short[4]));
memset(pixelsrgba16f, 0, r_shadow_bouncegrid_state.numpixels * sizeof(unsigned short[4]));
for (z = 1;z < resolution[2]-1;z++)
{
matrix4x4_t radiustolight = rtlight->matrix_worldtolight;
Matrix4x4_Abs(&radiustolight);
- r_shadow_shadowmaplod = 0;
- for (i = 1;i < R_SHADOW_SHADOWMAP_NUMCUBEMAPS;i++)
- if ((r_shadow_shadowmapmaxsize >> i) > lodlinear)
- r_shadow_shadowmaplod = i;
-
size = bound(r_shadow_shadowmapborder, lodlinear, r_shadow_shadowmapmaxsize);
borderbias = r_shadow_shadowmapborder / (float)(size - r_shadow_shadowmapborder);
castermask |= (entitysides_noselfshadow[i] = R_Shadow_CalcEntitySideMask(shadowentities_noselfshadow[i], &rtlight->matrix_worldtolight, &radiustolight, borderbias));
}
- //Con_Printf("distance %f lodlinear %i (lod %i) size %i\n", distance, lodlinear, r_shadow_shadowmaplod, size);
+ //Con_Printf("distance %f lodlinear %i size %i\n", distance, lodlinear, size);
// render shadow casters into 6 sided depth texture
for (side = 0;side < 6;side++) if (receivermask & (1 << side))
{
"surround71", 8,
{
- {0, 45, 0.2, 0.2, 0.5}, // front left
- {1, 315, 0.2, 0.2, 0.5}, // front right
- {2, 135, 0.2, 0.2, 0.5}, // rear left
- {3, 225, 0.2, 0.2, 0.5}, // rear right
- {4, 0, 0.2, 0.2, 0.5}, // front center
+ {0, 45, 0.2f, 0.2f, 0.5f}, // front left
+ {1, 315, 0.2f, 0.2f, 0.5f}, // front right
+ {2, 135, 0.2f, 0.2f, 0.5f}, // rear left
+ {3, 225, 0.2f, 0.2f, 0.5f}, // rear right
+ {4, 0, 0.2f, 0.2f, 0.5f}, // front center
{5, 0, 0, 0, 0}, // lfe (we don't have any good lfe sound sources and it would take some filtering work to generate them (and they'd probably still be wrong), so... no lfe)
- {6, 90, 0.2, 0.2, 0.5}, // side left
- {7, 180, 0.2, 0.2, 0.5}, // side right
+ {6, 90, 0.2f, 0.2f, 0.5f}, // side left
+ {7, 180, 0.2f, 0.2f, 0.5f}, // side right
}
},
{
"surround51", 6,
{
- {0, 45, 0.2, 0.2, 0.5}, // front left
- {1, 315, 0.2, 0.2, 0.5}, // front right
- {2, 135, 0.2, 0.2, 0.5}, // rear left
- {3, 225, 0.2, 0.2, 0.5}, // rear right
- {4, 0, 0.2, 0.2, 0.5}, // front center
+ {0, 45, 0.2f, 0.2f, 0.5f}, // front left
+ {1, 315, 0.2f, 0.2f, 0.5f}, // front right
+ {2, 135, 0.2f, 0.2f, 0.5f}, // rear left
+ {3, 225, 0.2f, 0.2f, 0.5f}, // rear right
+ {4, 0, 0.2f, 0.2f, 0.5f}, // front center
{5, 0, 0, 0, 0}, // lfe (we don't have any good lfe sound sources and it would take some filtering work to generate them (and they'd probably still be wrong), so... no lfe)
{0, 0, 0, 0, 0},
{0, 0, 0, 0, 0},
// channel of its own
"surround40", 4,
{
- {0, 45, 0.3, 0.3, 0.8}, // front left
- {1, 315, 0.3, 0.3, 0.8}, // front right
- {2, 135, 0.3, 0.3, 0.8}, // rear left
- {3, 225, 0.3, 0.3, 0.8}, // rear right
+ {0, 45, 0.3f, 0.3f, 0.8f}, // front left
+ {1, 315, 0.3f, 0.3f, 0.8f}, // front right
+ {2, 135, 0.3f, 0.3f, 0.8f}, // rear left
+ {3, 225, 0.3f, 0.3f, 0.8f}, // rear right
{0, 0, 0, 0, 0},
{0, 0, 0, 0, 0},
{0, 0, 0, 0, 0},
// channel of its own
"stereo", 2,
{
- {0, 90, 0.5, 0.5, 1}, // side left
- {1, 270, 0.5, 0.5, 1}, // side right
+ {0, 90, 0.5f, 0.5f, 1}, // side left
+ {1, 270, 0.5f, 0.5f, 1}, // side right
{0, 0, 0, 0, 0},
{0, 0, 0, 0, 0},
{0, 0, 0, 0, 0},
extern cvar_t snd_softclip;
-static void S_SoftClipPaintBuffer(portable_sampleframe_t *painted_ptr, int nbframes, int width, int channels)
+static void S_SoftClipPaintBuffer(portable_sampleframe_t *painted_ptr, int nbframes, int width, int nchannels)
{
int i;
maxvol = max(1.0f, maxvol * (1.0f - nbframes / (0.4f * snd_renderbuffer->format.speed)));
#define SOFTCLIP(x) if(fabs(x)>maxvol) maxvol=fabs(x); (x) /= maxvol;
- if (channels == 8) // 7.1 surround
+ if (nchannels == 8) // 7.1 surround
{
for (i = 0;i < nbframes;i++, p++)
{
SOFTCLIP(p->sample[7]);
}
}
- else if (channels == 6) // 5.1 surround
+ else if (nchannels == 6) // 5.1 surround
{
for (i = 0; i < nbframes; i++, p++)
{
SOFTCLIP(p->sample[5]);
}
}
- else if (channels == 4) // 4.0 surround
+ else if (nchannels == 4) // 4.0 surround
{
for (i = 0; i < nbframes; i++, p++)
{
SOFTCLIP(p->sample[3]);
}
}
- else if (channels == 2) // 2.0 stereo
+ else if (nchannels == 2) // 2.0 stereo
{
for (i = 0; i < nbframes; i++, p++)
{
SOFTCLIP(p->sample[1]);
}
}
- else if (channels == 1) // 1.0 mono
+ else if (nchannels == 1) // 1.0 mono
{
for (i = 0; i < nbframes; i++, p++)
{
}
}
-static void S_ConvertPaintBuffer(portable_sampleframe_t *painted_ptr, void *rb_ptr, int nbframes, int width, int channels)
+static void S_ConvertPaintBuffer(portable_sampleframe_t *painted_ptr, void *rb_ptr, int nbframes, int width, int nchannels)
{
int i, val;
if (width == 2) // 16bit
{
short *snd_out = (short*)rb_ptr;
- if (channels == 8) // 7.1 surround
+ if (nchannels == 8) // 7.1 surround
{
for (i = 0;i < nbframes;i++, painted_ptr++)
{
val = (int)(painted_ptr->sample[7] * 32768.0f);*snd_out++ = bound(-32768, val, 32767);
}
}
- else if (channels == 6) // 5.1 surround
+ else if (nchannels == 6) // 5.1 surround
{
for (i = 0; i < nbframes; i++, painted_ptr++)
{
val = (int)(painted_ptr->sample[5] * 32768.0f);*snd_out++ = bound(-32768, val, 32767);
}
}
- else if (channels == 4) // 4.0 surround
+ else if (nchannels == 4) // 4.0 surround
{
for (i = 0; i < nbframes; i++, painted_ptr++)
{
val = (int)(painted_ptr->sample[3] * 32768.0f);*snd_out++ = bound(-32768, val, 32767);
}
}
- else if (channels == 2) // 2.0 stereo
+ else if (nchannels == 2) // 2.0 stereo
{
for (i = 0; i < nbframes; i++, painted_ptr++)
{
val = (int)(painted_ptr->sample[1] * 32768.0f);*snd_out++ = bound(-32768, val, 32767);
}
}
- else if (channels == 1) // 1.0 mono
+ else if (nchannels == 1) // 1.0 mono
{
for (i = 0; i < nbframes; i++, painted_ptr++)
{
// noise is really really annoying
if (cls.timedemo)
- memset(rb_ptr, 0, nbframes * channels * width);
+ memset(rb_ptr, 0, nbframes * nchannels * width);
}
else // 8bit
{
unsigned char *snd_out = (unsigned char*)rb_ptr;
- if (channels == 8) // 7.1 surround
+ if (nchannels == 8) // 7.1 surround
{
for (i = 0; i < nbframes; i++, painted_ptr++)
{
val = (int)(painted_ptr->sample[7] * 128.0f) + 128; *snd_out++ = bound(0, val, 255);
}
}
- else if (channels == 6) // 5.1 surround
+ else if (nchannels == 6) // 5.1 surround
{
for (i = 0; i < nbframes; i++, painted_ptr++)
{
val = (int)(painted_ptr->sample[5] * 128.0f) + 128; *snd_out++ = bound(0, val, 255);
}
}
- else if (channels == 4) // 4.0 surround
+ else if (nchannels == 4) // 4.0 surround
{
for (i = 0; i < nbframes; i++, painted_ptr++)
{
val = (int)(painted_ptr->sample[3] * 128.0f) + 128; *snd_out++ = bound(0, val, 255);
}
}
- else if (channels == 2) // 2.0 stereo
+ else if (nchannels == 2) // 2.0 stereo
{
for (i = 0; i < nbframes; i++, painted_ptr++)
{
val = (int)(painted_ptr->sample[1] * 128.0f) + 128; *snd_out++ = bound(0, val, 255);
}
}
- else if (channels == 1) // 1.0 mono
+ else if (nchannels == 1) // 1.0 mono
{
for (i = 0;i < nbframes;i++, painted_ptr++)
{
// noise is really really annoying
if (cls.timedemo)
- memset(rb_ptr, 128, nbframes * channels);
+ memset(rb_ptr, 128, nbframes * nchannels);
}
}
==================
*/
-void SV_StartSound (prvm_edict_t *entity, int channel, const char *sample, int volume, float attenuation, qboolean reliable, float speed)
+void SV_StartSound (prvm_edict_t *entity, int channel, const char *sample, int nvolume, float attenuation, qboolean reliable, float speed)
{
prvm_prog_t *prog = SVVM_prog;
sizebuf_t *dest;
dest = (reliable ? &sv.reliable_datagram : &sv.datagram);
- if (volume < 0 || volume > 255)
+ if (nvolume < 0 || nvolume > 255)
{
- Con_Printf ("SV_StartSound: volume = %i\n", volume);
+ Con_Printf ("SV_StartSound: volume = %i\n", nvolume);
return;
}
speed4000 = (int)floor(speed * 4000.0f + 0.5f);
field_mask = 0;
- if (volume != DEFAULT_SOUND_PACKET_VOLUME)
+ if (nvolume != DEFAULT_SOUND_PACKET_VOLUME)
field_mask |= SND_VOLUME;
if (attenuation != DEFAULT_SOUND_PACKET_ATTENUATION)
field_mask |= SND_ATTENUATION;
MSG_WriteByte (dest, svc_sound);
MSG_WriteByte (dest, field_mask);
if (field_mask & SND_VOLUME)
- MSG_WriteByte (dest, volume);
+ MSG_WriteByte (dest, nvolume);
if (field_mask & SND_ATTENUATION)
MSG_WriteByte (dest, (int)(attenuation*64));
if (field_mask & SND_SPEEDUSHORT4000)
==================
*/
-void SV_StartPointSound (vec3_t origin, const char *sample, int volume, float attenuation, float speed)
+void SV_StartPointSound (vec3_t origin, const char *sample, int nvolume, float attenuation, float speed)
{
int sound_num, field_mask, i, speed4000;
- if (volume < 0 || volume > 255)
+ if (nvolume < 0 || nvolume > 255)
{
- Con_Printf ("SV_StartPointSound: volume = %i\n", volume);
+ Con_Printf ("SV_StartPointSound: volume = %i\n", nvolume);
return;
}
speed4000 = (int)(speed * 40.0f);
field_mask = 0;
- if (volume != DEFAULT_SOUND_PACKET_VOLUME)
+ if (nvolume != DEFAULT_SOUND_PACKET_VOLUME)
field_mask |= SND_VOLUME;
if (attenuation != DEFAULT_SOUND_PACKET_ATTENUATION)
field_mask |= SND_ATTENUATION;
MSG_WriteByte (&sv.datagram, svc_sound);
MSG_WriteByte (&sv.datagram, field_mask);
if (field_mask & SND_VOLUME)
- MSG_WriteByte (&sv.datagram, volume);
+ MSG_WriteByte (&sv.datagram, nvolume);
if (field_mask & SND_ATTENUATION)
MSG_WriteByte (&sv.datagram, (int)(attenuation*64));
if (field_mask & SND_SPEEDUSHORT4000)
{
char demofile[MAX_OSPATH];
char ipaddress[MAX_QPATH];
- size_t i;
+ size_t j;
// start a new demo file
LHNETADDRESS_ToString(&(client->netconnection->peeraddress), ipaddress, sizeof(ipaddress), true);
- for(i = 0; ipaddress[i]; ++i)
- if(!isalnum(ipaddress[i]))
- ipaddress[i] = '-';
+ for(j = 0; ipaddress[j]; ++j)
+ if(!isalnum(ipaddress[j]))
+ ipaddress[j] = '-';
dpsnprintf (demofile, sizeof(demofile), "%s_%s_%d_%s.dem", Sys_TimeString (sv_autodemo_perclient_nameformat.string), sv.worldbasename, PRVM_NUM_FOR_EDICT(client->edict), ipaddress);
SV_StartDemoRecording(client, demofile, -1);
if(client->sv_demo_file != NULL)
{
- int i;
+ int k;
static char buf[NET_MAXMESSAGE];
sizebuf_t sb;
sb.data = (unsigned char *) buf;
sb.maxsize = sizeof(buf);
- i = 0;
- while(MakeDownloadPacket(sv.csqc_progname, svs.csqc_progdata, sv.csqc_progsize, sv.csqc_progcrc, i++, &sb, sv.protocol))
+ k = 0;
+ while(MakeDownloadPacket(sv.csqc_progname, svs.csqc_progdata, sv.csqc_progsize, sv.csqc_progcrc, k++, &sb, sv.protocol))
SV_WriteDemoMessage(client, &sb, false);
}
prvm_prog_t *prog = SVVM_prog;
int i;
vec3_t wishvel, v_angle;
- vec_t speed, newspeed, wishspeed, addspeed, accelspeed, temp;
+ vec_t speed, newspeed, fwishspeed, addspeed, accelspeed, temp;
// user intentions
VectorCopy(PRVM_serveredictvector(host_client->edict, v_angle), v_angle);
else
wishvel[2] += cmd.upmove;
- wishspeed = VectorLength(wishvel);
- if (wishspeed > sv_maxspeed.value)
+ fwishspeed = VectorLength(wishvel);
+ if (fwishspeed > sv_maxspeed.value)
{
- temp = sv_maxspeed.value/wishspeed;
+ temp = sv_maxspeed.value/fwishspeed;
VectorScale (wishvel, temp, wishvel);
- wishspeed = sv_maxspeed.value;
+ fwishspeed = sv_maxspeed.value;
}
- wishspeed *= 0.7;
+ fwishspeed *= 0.7;
// water friction
speed = VectorLength(PRVM_serveredictvector(host_client->edict, velocity));
newspeed = 0;
// water acceleration
- if (!wishspeed)
+ if (!fwishspeed)
return;
- addspeed = wishspeed - newspeed;
+ addspeed = fwishspeed - newspeed;
if (addspeed <= 0)
return;
VectorNormalize (wishvel);
- accelspeed = (sv_wateraccelerate.value < 0 ? sv_accelerate.value : sv_wateraccelerate.value) * wishspeed * sv.frametime;
+ accelspeed = (sv_wateraccelerate.value < 0 ? sv_accelerate.value : sv_wateraccelerate.value) * fwishspeed * sv.frametime;
if (accelspeed > addspeed)
accelspeed = addspeed;
void SV_ReadClientMessage(void)
{
prvm_prog_t *prog = SVVM_prog;
- int cmd, num, start;
+ int netcmd, num, start;
char *s, *p, *q;
if(sv_autodemo_perclient.integer >= 2)
return;
}
- cmd = MSG_ReadByte(&sv_message);
- if (cmd == -1)
+ netcmd = MSG_ReadByte(&sv_message);
+ if (netcmd == -1)
{
// end of message
// apply the moves that were read this frame
break;
}
- switch (cmd)
+ switch (netcmd)
{
default:
- Con_Printf("SV_ReadClientMessage: unknown command char %i (at offset 0x%x)\n", cmd, sv_message.readcount);
+ Con_Printf("SV_ReadClientMessage: unknown command char %i (at offset 0x%x)\n", netcmd, sv_message.readcount);
if (developer_networking.integer)
Com_HexDumpToConsole(sv_message.data, sv_message.cursize);
SV_DropClient (false);
const char *sample;
int channel;
prvm_edict_t *entity;
- int volume;
+ int nvolume;
int flags;
float attenuation;
float pitchchange;
entity = PRVM_G_EDICT(OFS_PARM0);
channel = (int)PRVM_G_FLOAT(OFS_PARM1);
sample = PRVM_G_STRING(OFS_PARM2);
- volume = (int)(PRVM_G_FLOAT(OFS_PARM3) * 255);
+ nvolume = (int)(PRVM_G_FLOAT(OFS_PARM3) * 255);
if (prog->argc < 5)
{
Con_DPrintf("VM_SV_sound: given only 4 parameters, expected 5, assuming attenuation = ATTN_NORMAL\n");
flags = (int)PRVM_G_FLOAT(OFS_PARM6) & (CHANNELFLAG_RELIABLE | CHANNELFLAG_FORCELOOP | CHANNELFLAG_PAUSED);
}
- if (volume < 0 || volume > 255)
+ if (nvolume < 0 || nvolume > 255)
{
VM_Warning(prog, "SV_StartSound: volume must be in range 0-1\n");
return;
return;
}
- SV_StartSound (entity, channel, sample, volume, attenuation, flags & CHANNELFLAG_RELIABLE, pitchchange);
+ SV_StartSound (entity, channel, sample, nvolume, attenuation, flags & CHANNELFLAG_RELIABLE, pitchchange);
}
/*
static void VM_SV_pointsound(prvm_prog_t *prog)
{
const char *sample;
- int volume;
+ int nvolume;
float attenuation;
float pitchchange;
vec3_t org;
VectorCopy(PRVM_G_VECTOR(OFS_PARM0), org);
sample = PRVM_G_STRING(OFS_PARM1);
- volume = (int)(PRVM_G_FLOAT(OFS_PARM2) * 255);
+ nvolume = (int)(PRVM_G_FLOAT(OFS_PARM2) * 255);
attenuation = PRVM_G_FLOAT(OFS_PARM3);
pitchchange = prog->argc < 5 ? 0 : PRVM_G_FLOAT(OFS_PARM4) * 0.01f;
- if (volume < 0 || volume > 255)
+ if (nvolume < 0 || nvolume > 255)
{
VM_Warning(prog, "SV_StartPointSound: volume must be in range 0-1\n");
return;
return;
}
- SV_StartPointSound (org, sample, volume, attenuation, pitchchange);
+ SV_StartPointSound (org, sample, nvolume, attenuation, pitchchange);
}
/*
static int video_bpp;
#if SDL_MAJOR_VERSION == 1
-static SDL_Surface *screen;
+static SDL_Surface *video_screen;
static int video_flags;
#else
static SDL_GLContext context;
vid.width = event.resize.w;
vid.height = event.resize.h;
if (!vid_isfullscreen)
- screen = SDL_SetVideoMode(vid.width, vid.height, video_bpp, video_flags);
+ video_screen = SDL_SetVideoMode(vid.width, vid.height, video_bpp, video_flags);
if (vid_softsurface)
{
SDL_FreeSurface(vid_softsurface);
video_bpp = mode->bitsperpixel;
#if SDL_MAJOR_VERSION == 1
video_flags = flags;
- screen = VID_WrapSDL_SetVideoMode(mode->width, mode->height, mode->bitsperpixel, flags);
- if (screen == NULL)
+ video_screen = VID_WrapSDL_SetVideoMode(mode->width, mode->height, mode->bitsperpixel, flags);
+ if (video_screen == NULL)
{
Con_Printf("Failed to set video mode to %ix%i: %s\n", mode->width, mode->height, SDL_GetError());
VID_Shutdown();
return false;
}
- mode->width = screen->w;
- mode->height = screen->h;
+ mode->width = video_screen->w;
+ mode->height = video_screen->h;
#else
window_flags = windowflags;
window = SDL_CreateWindow(gamename, xPos, yPos, mode->width, mode->height, windowflags);
video_bpp = mode->bitsperpixel;
#if SDL_MAJOR_VERSION == 1
video_flags = flags;
- screen = VID_WrapSDL_SetVideoMode(mode->width, mode->height, mode->bitsperpixel, flags);
- if (screen == NULL)
+ video_screen = VID_WrapSDL_SetVideoMode(mode->width, mode->height, mode->bitsperpixel, flags);
+ if (video_screen == NULL)
{
Con_Printf("Failed to set video mode to %ix%i: %s\n", mode->width, mode->height, SDL_GetError());
VID_Shutdown();
return false;
}
- mode->width = screen->w;
- mode->height = screen->h;
+ mode->width = video_screen->w;
+ mode->height = video_screen->h;
#else
window_flags = windowflags;
window = SDL_CreateWindow(gamename, SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED, mode->width, mode->height, windowflags);
#if SDL_MAJOR_VERSION == 1
// if (!r_test.integer)
{
- SDL_BlitSurface(vid_softsurface, NULL, screen, NULL);
- SDL_Flip(screen);
+ SDL_BlitSurface(vid_softsurface, NULL, video_screen, NULL);
+ SDL_Flip(video_screen);
}
#else
{
}
#endif
-float VID_JoyState_GetAxis(const vid_joystate_t *joystate, int axis, float sensitivity, float deadzone)
+float VID_JoyState_GetAxis(const vid_joystate_t *joystate, int axis, float fsensitivity, float deadzone)
{
float value;
value = (axis >= 0 && axis < MAXJOYAXIS) ? joystate->axis[axis] : 0.0f;
value = value > deadzone ? (value - deadzone) : (value < -deadzone ? (value + deadzone) : 0.0f);
value *= deadzone > 0 ? (1.0f / (1.0f - deadzone)) : 1.0f;
value = bound(-1, value, 1);
- return value * sensitivity;
+ return value * fsensitivity;
}
qboolean VID_JoyBlockEmulatedKeys(int keycode)