From: havoc Date: Sat, 10 Sep 2016 19:36:13 +0000 (+0000) Subject: Fix MSVC++ 2015 warnings about variable scope and some narrowing conversions without... X-Git-Tag: xonotic-v0.8.2~19 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=cf8dfc912d76d0a26c5d80202fb0b8089df0901f;p=xonotic%2Fdarkplaces.git Fix MSVC++ 2015 warnings about variable scope and some narrowing conversions without type casts. Fix some missing type casts in recent r_shadow.c changes that didn't compile as C++ successfully. Remove r_shadow_shadowmaplod variable which is unused. git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@12279 d7cf8633-e32d-0410-b094-e92efae38249 ::stable-branch::merge=ad37bc7de1dce1d858f74df2d70dc214983fb934 --- diff --git a/cd_null.c b/cd_null.c index 13826f05..2ac9141f 100644 --- a/cd_null.c +++ b/cd_null.c @@ -44,7 +44,7 @@ float CDAudio_SysGetVolume (void) } -void CDAudio_SysSetVolume (float volume) +void CDAudio_SysSetVolume (float fvolume) { } diff --git a/cd_sdl.c b/cd_sdl.c index 9674e8d3..410dd390 100644 --- a/cd_sdl.c +++ b/cd_sdl.c @@ -234,7 +234,7 @@ float CDAudio_SysGetVolume (void) } -void CDAudio_SysSetVolume (float volume) +void CDAudio_SysSetVolume (float fvolume) { } diff --git a/cd_win.c b/cd_win.c index 76ac51ed..ec94e560 100644 --- a/cd_win.c +++ b/cd_win.c @@ -93,7 +93,7 @@ float CDAudio_SysGetVolume (void) } -void CDAudio_SysSetVolume (float volume) +void CDAudio_SysSetVolume (float fvolume) { // IMPLEMENTME } diff --git a/cl_input.c b/cl_input.c index a393f669..e55f501b 100644 --- a/cl_input.c +++ b/cl_input.c @@ -1261,9 +1261,9 @@ static void CL_ClientMovement_Physics_PM_AirAccelerate(cl_clientmovement_state_t 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 { @@ -2061,7 +2061,6 @@ void CL_SendMove(void) // 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) diff --git a/cl_parse.c b/cl_parse.c index 923e48e7..82d64cb8 100644 --- a/cl_parse.c +++ b/cl_parse.c @@ -208,7 +208,7 @@ static void CL_ParseStartSoundPacket(int largesoundindex) vec3_t pos; int channel, ent; int sound_num; - int volume; + int nvolume; int field_mask; float attenuation; float speed; @@ -219,9 +219,9 @@ static void CL_ParseStartSoundPacket(int largesoundindex) 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; @@ -240,9 +240,9 @@ static void CL_ParseStartSoundPacket(int largesoundindex) 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; @@ -291,8 +291,8 @@ static void CL_ParseStartSoundPacket(int largesoundindex) 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); } /* @@ -3462,8 +3462,8 @@ void CL_ParseServerMessage(void) 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 = ""; - cmdlogname[cmdindex] = temp; + const char *d = ""; + cmdlogname[cmdindex] = d; } // other commands @@ -3471,7 +3471,7 @@ void CL_ParseServerMessage(void) { default: { - char description[32*64], temp[64]; + char description[32*64], logtemp[64]; int count; strlcpy(description, "packet dump: ", sizeof(description)); i = cmdcount - 32; @@ -3481,8 +3481,8 @@ void CL_ParseServerMessage(void) 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; @@ -3827,8 +3827,8 @@ void CL_ParseServerMessage(void) 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 = ""; - cmdlogname[cmdindex] = temp; + const char *d = ""; + cmdlogname[cmdindex] = d; } // other commands @@ -3836,7 +3836,7 @@ void CL_ParseServerMessage(void) { default: { - char description[32*64], temp[64]; + char description[32*64], tempdesc[64]; int count; strlcpy (description, "packet dump: ", sizeof(description)); i = cmdcount - 32; @@ -3846,8 +3846,8 @@ void CL_ParseServerMessage(void) 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; @@ -3998,8 +3998,9 @@ void CL_ParseServerMessage(void) } 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) diff --git a/cl_particles.c b/cl_particles.c index 54f73efb..d8fc8111 100644 --- a/cl_particles.c +++ b/cl_particles.c @@ -765,7 +765,6 @@ particle_t *CL_NewParticle(const vec3_t sortorigin, unsigned short ptypeindex, i { 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 @@ -934,11 +933,11 @@ static void CL_NewParticlesFromEffectinfo(int effectnameindex, float pcount, con 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) @@ -1002,7 +1001,7 @@ static void CL_ParticleEffect_Fallback(int effectnameindex, float count, const v // 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) { @@ -1043,7 +1042,7 @@ static void CL_ParticleEffect_Fallback(int effectnameindex, float count, const v // 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) { @@ -1075,7 +1074,7 @@ static void CL_ParticleEffect_Fallback(int effectnameindex, float count, const v // 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) { @@ -1110,17 +1109,17 @@ static void CL_ParticleEffect_Fallback(int effectnameindex, float count, const v // 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) { @@ -1137,10 +1136,10 @@ static void CL_ParticleEffect_Fallback(int effectnameindex, float count, const v } 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; @@ -1195,7 +1194,7 @@ static void CL_ParticleEffect_Fallback(int effectnameindex, float count, const v } 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); @@ -1211,7 +1210,7 @@ static void CL_ParticleEffect_Fallback(int effectnameindex, float count, const v 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) { @@ -1224,7 +1223,7 @@ static void CL_ParticleEffect_Fallback(int effectnameindex, float count, const v 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) { @@ -1233,7 +1232,7 @@ static void CL_ParticleEffect_Fallback(int effectnameindex, float count, const v 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) { @@ -1242,13 +1241,13 @@ static void CL_ParticleEffect_Fallback(int effectnameindex, float count, const v 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) { @@ -1269,9 +1268,9 @@ static void CL_ParticleEffect_Fallback(int effectnameindex, float count, const v 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++; } } @@ -1306,9 +1305,9 @@ static void CL_ParticleEffect_Fallback(int effectnameindex, float count, const v 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) diff --git a/cl_screen.c b/cl_screen.c index 284f8543..68bf62da 100644 --- a/cl_screen.c +++ b/cl_screen.c @@ -1001,7 +1001,7 @@ extern cvar_t r_viewscale; 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; @@ -1065,6 +1065,7 @@ static void R_TimeReport_EndFrame(void) if (string[0]) { + int i, y; if (string[strlen(string)-1] == '\n') string[strlen(string)-1] = 0; lines = 1; @@ -1096,12 +1097,13 @@ static void R_TimeReport_EndFrame(void) 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) @@ -1136,7 +1138,7 @@ static void R_TimeReport_EndFrame(void) { 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); diff --git a/cl_video.c b/cl_video.c index db2302d6..bcaa85b1 100644 --- a/cl_video.c +++ b/cl_video.c @@ -540,7 +540,7 @@ void CL_DrawVideo(void) 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); diff --git a/clvm_cmds.c b/clvm_cmds.c index f43bf7fe..28e62c29 100644 --- a/clvm_cmds.c +++ b/clvm_cmds.c @@ -171,7 +171,7 @@ static void VM_CL_sound (prvm_prog_t *prog) const char *sample; int channel; prvm_edict_t *entity; - float volume; + float fvolume; float attenuation; float pitchchange; float startposition; @@ -183,10 +183,10 @@ static void VM_CL_sound (prvm_prog_t *prog) 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; @@ -229,14 +229,14 @@ static void VM_CL_sound (prvm_prog_t *prog) } 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; @@ -244,10 +244,10 @@ static void VM_CL_pointsound(prvm_prog_t *prog) 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; @@ -260,7 +260,7 @@ static void VM_CL_pointsound(prvm_prog_t *prog) } // 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 @@ -3381,7 +3381,6 @@ static void VMPolygons_Store(vmpolygons_t *polys) 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) diff --git a/collision.c b/collision.c index 3d148a8b..547ad236 100644 --- a/collision.c +++ b/collision.c @@ -162,7 +162,7 @@ static void Collision_CalcEdgeDirsForPolygonBrushFloat(colbrushf_t *brush) 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; @@ -203,6 +203,7 @@ colbrushf_t *Collision_NewBrushFromPlanes(mempool_t *mempool, int numoriginalpla // 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; @@ -268,6 +269,7 @@ colbrushf_t *Collision_NewBrushFromPlanes(mempool_t *mempool, int numoriginalpla // 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); @@ -305,11 +307,12 @@ colbrushf_t *Collision_NewBrushFromPlanes(mempool_t *mempool, int numoriginalpla } // 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) @@ -446,7 +449,6 @@ colbrushf_t *Collision_NewBrushFromPlanes(mempool_t *mempool, int numoriginalpla void Collision_CalcPlanesForTriangleBrushFloat(colbrushf_t *brush) { - int i; float edge0[3], edge1[3], edge2[3]; colpointf_t *p; @@ -539,6 +541,7 @@ void Collision_CalcPlanesForTriangleBrushFloat(colbrushf_t *brush) if (developer_extra.integer) { + int i; // validity check - will be disabled later Collision_ValidateBrush(brush); for (i = 0;i < brush->numplanes;i++) diff --git a/console.c b/console.c index 4337a730..51a1a123 100644 --- a/console.c +++ b/console.c @@ -1664,7 +1664,7 @@ static int Con_DrawNotifyRect(int mask_must, int mask_mustnot, float maxage, flo 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; @@ -1676,10 +1676,10 @@ static int Con_DrawNotifyRect(int mask_must, int mask_mustnot, float maxage, flo 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; @@ -1856,7 +1856,6 @@ static int Con_LineHeight(int lineno) { 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); diff --git a/crypto.c b/crypto.c index 00bcf0a1..05d763d6 100644 --- a/crypto.c +++ b/crypto.c @@ -1727,8 +1727,8 @@ static int Crypto_ServerParsePacket_Internal(const char *data_in, size_t len_in, 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 @@ -1758,8 +1758,8 @@ static int Crypto_ServerParsePacket_Internal(const char *data_in, size_t len_in, 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) diff --git a/csprogs.c b/csprogs.c index fa364ce7..5f73c6ec 100644 --- a/csprogs.c +++ b/csprogs.c @@ -717,7 +717,7 @@ void CL_VM_UpdateShowingScoresState (int showingscores) 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; @@ -731,7 +731,7 @@ qboolean CL_VM_Event_Sound(int sound_num, float volume, int channel, float atten 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; diff --git a/dpsoftrast.c b/dpsoftrast.c index bca738af..7f13246b 100644 --- a/dpsoftrast.c +++ b/dpsoftrast.c @@ -1664,10 +1664,10 @@ static void DPSOFTRAST_Fill4f(float *dst, const float *src, int size) 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])); @@ -1810,7 +1810,7 @@ static int DPSOFTRAST_Vertex_BoundY(int *starty, int *endy, const float *minposf 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; @@ -1852,17 +1852,17 @@ static int DPSOFTRAST_Vertex_Project(float *out4f, float *screen4f, int *starty, 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); @@ -2294,12 +2294,12 @@ static void DPSOFTRAST_Texture2DBGRA8(DPSOFTRAST_Texture *texture, int mip, floa 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; @@ -2325,7 +2325,7 @@ static void DPSOFTRAST_Texture2DBGRA8(DPSOFTRAST_Texture *texture, int mip, floa } 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; diff --git a/fs.c b/fs.c index a7074e5f..87367a77 100644 --- a/fs.c +++ b/fs.c @@ -3566,7 +3566,6 @@ fssearch_t *FS_Search(const char *pattern, int caseinsensitive, int quiet) 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++) ; @@ -3601,6 +3600,7 @@ fssearch_t *FS_Search(const char *pattern, int caseinsensitive, int quiet) 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]) { @@ -3684,6 +3684,7 @@ fssearch_t *FS_Search(const char *pattern, int caseinsensitive, int quiet) // 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 ); @@ -3707,17 +3708,17 @@ fssearch_t *FS_Search(const char *pattern, int caseinsensitive, int quiet) 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); } } } diff --git a/ft2.c b/ft2.c index bc9544f2..e30c22e6 100644 --- a/ft2.c +++ b/ft2.c @@ -1515,35 +1515,35 @@ static qboolean Font_LoadMap(ft2_font_t *font, ft2_font_map_t *mapstart, Uchar _ 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: diff --git a/gl_backend.c b/gl_backend.c index 3c497f48..450d194f 100644 --- a/gl_backend.c +++ b/gl_backend.c @@ -130,7 +130,7 @@ int gl_maxdrawrangeelementsvertices; int gl_maxdrawrangeelementsindices; #ifdef DEBUGGL -int errornumber = 0; +int gl_errornumber = 0; void GL_PrintError(int errornumber, const char *filename, int linenumber) { diff --git a/gl_rmain.c b/gl_rmain.c index 3d5cf6fc..b0c146c0 100644 --- a/gl_rmain.c +++ b/gl_rmain.c @@ -2143,7 +2143,6 @@ extern rtexture_t *r_shadow_shadowmap2ddepthbuffer; 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; @@ -3581,7 +3580,6 @@ skinframe_t *R_SkinFrame_LoadExternal(const char *name, int textureflags, qboole 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]; @@ -3615,11 +3613,11 @@ skinframe_t *R_SkinFrame_LoadInternalBGRA(const char *name, int textureflags, co 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) @@ -3739,15 +3737,15 @@ static void R_SkinFrame_GenerateTexturesFromQPixels(skinframe_t *skinframe, qboo 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) @@ -9066,7 +9064,6 @@ void RSurf_PrepareVerticesForBatch(int batchneed, int texturenumsurfaces, const 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; @@ -9864,6 +9861,7 @@ void RSurf_PrepareVerticesForBatch(int batchneed, int texturenumsurfaces, const // in place for (deformindex = 0, deform = rsurface.texture->deforms;deformindex < Q3MAXDEFORMS && deform->deform && r_deformvertexes.integer;deformindex++, deform++) { + float scale; switch (deform->deform) { default: @@ -11139,9 +11137,9 @@ static void R_DrawTextureSurfaceList_ShowSurfaces(int texturenumsurfaces, const 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(); @@ -11153,13 +11151,13 @@ static void R_DrawTextureSurfaceList_ShowSurfaces(int texturenumsurfaces, const 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); diff --git a/glquake.h b/glquake.h index 5f4cc84d..1375c8e6 100644 --- a/glquake.h +++ b/glquake.h @@ -1129,11 +1129,11 @@ extern void (GLAPIENTRY *qglBlendFuncSeparate)(GLenum sfactorRGB, GLenum dfactor #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 diff --git a/lhnet.c b/lhnet.c index 20781f82..3ac17a0a 100644 --- a/lhnet.c +++ b/lhnet.c @@ -57,6 +57,9 @@ #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 diff --git a/libcurl.c b/libcurl.c index 2f001d5b..72ec15d2 100644 --- a/libcurl.c +++ b/libcurl.c @@ -966,15 +966,15 @@ static qboolean Curl_Begin(const char *URL, const char *extraheaders, double max // 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; @@ -1012,10 +1012,10 @@ static qboolean Curl_Begin(const char *URL, const char *extraheaders, double max 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); diff --git a/mathlib.c b/mathlib.c index a58d76e8..738965a0 100644 --- a/mathlib.c +++ b/mathlib.c @@ -30,87 +30,87 @@ float ixtable[4096]; 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 diff --git a/menu.c b/menu.c index fc76081c..6295d462 100644 --- a/menu.c +++ b/menu.c @@ -1629,46 +1629,46 @@ static void M_Menu_Options_AdjustSliders (int dir) #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) @@ -1682,10 +1682,10 @@ 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); @@ -1891,10 +1891,10 @@ static void M_Options_Effects_Draw (void) 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); @@ -2038,10 +2038,10 @@ static void M_Options_Graphics_Draw (void) 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); @@ -2229,10 +2229,10 @@ static void M_Options_ColorControl_Draw (void) 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); @@ -2253,41 +2253,41 @@ static void M_Options_ColorControl_Draw (void) 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); } @@ -2885,7 +2885,7 @@ static void M_Menu_Video_FindResolution(int w, int h, float a) 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) @@ -4413,7 +4413,7 @@ void M_Menu_ServerList_f (void) 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]; @@ -4424,8 +4424,8 @@ static void M_ServerList_Draw (void) 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); diff --git a/mod_skeletal_animatevertices_generic.c b/mod_skeletal_animatevertices_generic.c index 43563457..5a1047d9 100644 --- a/mod_skeletal_animatevertices_generic.c +++ b/mod_skeletal_animatevertices_generic.c @@ -66,19 +66,19 @@ void Mod_Skeletal_AnimateVertices_Generic(const dp_model_t * RESTRICT model, con 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; @@ -114,23 +114,23 @@ void Mod_Skeletal_AnimateVertices_Generic(const dp_model_t * RESTRICT model, con 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); } } } diff --git a/mod_skeletal_animatevertices_sse.c b/mod_skeletal_animatevertices_sse.c index 648ab31a..ea39f8a0 100644 --- a/mod_skeletal_animatevertices_sse.c +++ b/mod_skeletal_animatevertices_sse.c @@ -15,7 +15,6 @@ void Mod_Skeletal_AnimateVertices_SSE(const dp_model_t * RESTRICT model, const f int blends; matrix4x4_t *bonepose; matrix4x4_t *boneposerelative; - float m[12]; const blendweights_t * RESTRICT weights; int num_vertices_minus_one; @@ -105,37 +104,38 @@ void Mod_Skeletal_AnimateVertices_SSE(const dp_model_t * RESTRICT model, const f { 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; @@ -336,19 +336,19 @@ void Mod_Skeletal_AnimateVertices_SSE(const dp_model_t * RESTRICT model, const f 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 @@ -356,8 +356,8 @@ void Mod_Skeletal_AnimateVertices_SSE(const dp_model_t * RESTRICT model, const f 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; @@ -406,31 +406,31 @@ void Mod_Skeletal_AnimateVertices_SSE(const dp_model_t * RESTRICT model, const f 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); } } diff --git a/model_alias.c b/model_alias.c index ca4c88ef..aeb512e9 100644 --- a/model_alias.c +++ b/model_alias.c @@ -94,37 +94,37 @@ void Mod_Skeletal_BuildTransforms(const dp_model_t * RESTRICT model, const frame 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); diff --git a/model_brush.c b/model_brush.c index 2761d7d6..842be1ae 100644 --- a/model_brush.c +++ b/model_brush.c @@ -2688,7 +2688,7 @@ static void Mod_Q1BSP_LoadFaces(sizebuf_t *sb) 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]) @@ -4303,7 +4303,7 @@ static void Mod_Q2BSP_LoadNodes(sizebuf_t *sb) 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]; @@ -4319,6 +4319,7 @@ static void Mod_Q2BSP_LoadTexinfo(sizebuf_t *sb) 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); @@ -4442,7 +4443,7 @@ static void Mod_Q2BSP_LoadTexinfo(sizebuf_t *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 @@ -8027,9 +8028,9 @@ void Mod_OBJ_Load(dp_model_t *mod, void *buffer, void *bufferend) 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]; @@ -8043,7 +8044,7 @@ void Mod_OBJ_Load(dp_model_t *mod, void *buffer, void *bufferend) skinfile_t *skinfiles = NULL; unsigned char *data = NULL; int *submodelfirstsurface; - msurface_t *surface; + msurface_t *tempsurface; msurface_t *tempsurfaces; memset(&vfirst, 0, sizeof(vfirst)); @@ -8149,19 +8150,19 @@ void Mod_OBJ_Load(dp_model_t *mod, void *buffer, void *bufferend) 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++; } @@ -8170,10 +8171,10 @@ void Mod_OBJ_Load(dp_model_t *mod, void *buffer, void *bufferend) 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")) @@ -8181,19 +8182,19 @@ void Mod_OBJ_Load(dp_model_t *mod, void *buffer, void *bufferend) 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++; } @@ -8234,12 +8235,12 @@ void Mod_OBJ_Load(dp_model_t *mod, void *buffer, void *bufferend) 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); @@ -8343,7 +8344,7 @@ void Mod_OBJ_Load(dp_model_t *mod, void *buffer, void *bufferend) // 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; @@ -8362,10 +8363,10 @@ void Mod_OBJ_Load(dp_model_t *mod, void *buffer, void *bufferend) 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; @@ -8374,12 +8375,12 @@ void Mod_OBJ_Load(dp_model_t *mod, void *buffer, void *bufferend) 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; @@ -8402,13 +8403,13 @@ void Mod_OBJ_Load(dp_model_t *mod, void *buffer, void *bufferend) 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++; } } @@ -8455,9 +8456,9 @@ void Mod_OBJ_Load(dp_model_t *mod, void *buffer, void *bufferend) // 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); @@ -8547,24 +8548,24 @@ void Mod_OBJ_Load(dp_model_t *mod, void *buffer, void *bufferend) 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])); diff --git a/model_shared.c b/model_shared.c index c1bd882f..14186218 100644 --- a/model_shared.c +++ b/model_shared.c @@ -921,7 +921,7 @@ static void Mod_BuildBumpVectors(const float *v0, const float *v1, const float * 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; @@ -987,14 +987,14 @@ void Mod_BuildTextureVectorsFromNormals(int firstvertex, int numvertices, int nu // 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); } } @@ -2967,7 +2967,7 @@ void Mod_MakeSortedSurfaces(dp_model_t *mod) 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; @@ -2979,7 +2979,7 @@ void Mod_MakeSortedSurfaces(dp_model_t *mod) 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); diff --git a/netconn.c b/netconn.c index 72d33263..97f07bac 100755 --- a/netconn.c +++ b/netconn.c @@ -111,7 +111,7 @@ int masterreplycount = 0; 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 @@ -2511,7 +2511,7 @@ static qboolean NetConn_BuildStatusResponse(const char* challenge, char* out_msg 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++) @@ -2525,13 +2525,13 @@ static qboolean NetConn_BuildStatusResponse(const char* challenge, char* out_msg } *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; @@ -2572,13 +2572,13 @@ static qboolean NetConn_BuildStatusResponse(const char* challenge, char* out_msg 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 @@ -2586,7 +2586,7 @@ static qboolean NetConn_BuildStatusResponse(const char* challenge, char* out_msg cleanind = 0; do { - curchar = cl->name[nameind++]; + curchar = client->name[nameind++]; if (curchar != '"' && curchar != '\\') { cleanname[cleanind++] = curchar; @@ -2596,21 +2596,21 @@ static qboolean NetConn_BuildStatusResponse(const char* challenge, char* out_msg } 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; @@ -2618,15 +2618,15 @@ static qboolean NetConn_BuildStatusResponse(const char* challenge, char* out_msg 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)); @@ -2643,7 +2643,7 @@ static qboolean NetConn_BuildStatusResponse(const char* challenge, char* out_msg cleanname); else length = dpsnprintf(ptr, left, "%d %d%s \"%s\"\n", - cl->frags, + client->frags, pingvalue, teambuf, cleanname); @@ -2755,13 +2755,13 @@ static qboolean hmac_mdfour_challenge_matching(lhnetaddress_t *peeraddress, cons 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) @@ -2774,7 +2774,7 @@ static qboolean hmac_mdfour_challenge_matching(lhnetaddress_t *peeraddress, cons return false; // unmark challenge to prevent replay attacks - challenge[i].time = 0; + challenges[i].time = 0; return true; } @@ -2925,8 +2925,7 @@ static int NetConn_ServerParsePacket(lhnetsocket_t *mysocket, unsigned char *dat { 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]; @@ -2996,30 +2995,30 @@ static int NetConn_ServerParsePacket(lhnetsocket_t *mysocket, unsigned char *dat { 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); @@ -3027,6 +3026,8 @@ static int NetConn_ServerParsePacket(lhnetsocket_t *mysocket, unsigned char *dat } if (length > 8 && !memcmp(string, "connect\\", 8)) { + char *s; + client_t *client; crypto_t *crypto = Crypto_ServerGetInstance(peeraddress); string += 7; length -= 7; @@ -3054,8 +3055,8 @@ static int NetConn_ServerParsePacket(lhnetsocket_t *mysocket, unsigned char *dat { // 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) @@ -3253,7 +3254,7 @@ static int NetConn_ServerParsePacket(lhnetsocket_t *mysocket, unsigned char *dat } 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]; @@ -3261,12 +3262,12 @@ static int NetConn_ServerParsePacket(lhnetsocket_t *mysocket, unsigned char *dat 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); @@ -3306,6 +3307,8 @@ static int NetConn_ServerParsePacket(lhnetsocket_t *mysocket, unsigned char *dat int c; int protocolnumber; const char *protocolname; + client_t *knownclient; + client_t *newclient; data += 4; length -= 4; SZ_Clear(&sv_message); @@ -3351,16 +3354,16 @@ static int NetConn_ServerParsePacket(lhnetsocket_t *mysocket, unsigned char *dat } // 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); @@ -3382,15 +3385,15 @@ static int NetConn_ServerParsePacket(lhnetsocket_t *mysocket, unsigned char *dat // 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; } } @@ -3400,10 +3403,10 @@ static int NetConn_ServerParsePacket(lhnetsocket_t *mysocket, unsigned char *dat 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 diff --git a/netconn.h b/netconn.h index 44ea4775..7341359e 100755 --- a/netconn.h +++ b/netconn.h @@ -482,7 +482,7 @@ typedef struct challenge_s } challenge_t; -extern challenge_t challenge[MAX_CHALLENGES]; +extern challenge_t challenges[MAX_CHALLENGES]; #endif diff --git a/protocol.c b/protocol.c index de55ed37..e9d9489f 100644 --- a/protocol.c +++ b/protocol.c @@ -6,8 +6,8 @@ #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! diff --git a/prvm_exec.c b/prvm_exec.c index ad11c113..37daaaa2 100644 --- a/prvm_exec.c +++ b/prvm_exec.c @@ -737,7 +737,7 @@ MVM_ExecuteProgram 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; @@ -768,7 +768,7 @@ void MVM_ExecuteProgram (prvm_prog_t *prog, func_t fnum, const char *errormessag 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; @@ -779,7 +779,7 @@ void MVM_ExecuteProgram (prvm_prog_t *prog, func_t fnum, const char *errormessag 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) @@ -829,7 +829,7 @@ cleanup: 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(); @@ -844,7 +844,7 @@ CLVM_ExecuteProgram 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; @@ -875,7 +875,7 @@ void CLVM_ExecuteProgram (prvm_prog_t *prog, func_t fnum, const char *errormessa 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; @@ -886,7 +886,7 @@ void CLVM_ExecuteProgram (prvm_prog_t *prog, func_t fnum, const char *errormessa 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) @@ -936,7 +936,7 @@ cleanup: 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(); @@ -955,7 +955,7 @@ void PRVM_ExecuteProgram (prvm_prog_t *prog, func_t fnum, const char *errormessa #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; @@ -986,7 +986,7 @@ void PRVM_ExecuteProgram (prvm_prog_t *prog, func_t fnum, const char *errormessa 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; @@ -997,7 +997,7 @@ void PRVM_ExecuteProgram (prvm_prog_t *prog, func_t fnum, const char *errormessa 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) @@ -1047,7 +1047,7 @@ cleanup: 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(); diff --git a/prvm_execprogram.h b/prvm_execprogram.h index 1607bcfe..6578d789 100644 --- a/prvm_execprogram.h +++ b/prvm_execprogram.h @@ -125,15 +125,15 @@ { 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 @@ -482,21 +482,21 @@ 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 @@ -521,7 +521,7 @@ 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(); @@ -840,15 +840,15 @@ { 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 diff --git a/r_shadow.c b/r_shadow.c index 65c822a9..6e4d9a0c 100644 --- a/r_shadow.c +++ b/r_shadow.c @@ -249,7 +249,6 @@ rtexture_t *r_shadow_shadowmap2ddepthbuffer; 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; @@ -432,7 +431,6 @@ static void R_Shadow_SetShadowMode(void) 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; @@ -547,7 +545,6 @@ static void r_shadow_start(void) 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; @@ -3010,7 +3007,7 @@ static void R_Shadow_BounceGrid_ConvertPixelsAndUpload(void) 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) @@ -3062,7 +3059,7 @@ static void R_Shadow_BounceGrid_ConvertPixelsAndUpload(void) 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++) { @@ -4673,11 +4670,6 @@ static void R_Shadow_DrawLight(rtlight_t *rtlight) 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); @@ -4721,7 +4713,7 @@ static void R_Shadow_DrawLight(rtlight_t *rtlight) 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)) diff --git a/snd_main.c b/snd_main.c index d54267bd..e435485e 100644 --- a/snd_main.c +++ b/snd_main.c @@ -51,24 +51,24 @@ static const speakerlayout_t snd_speakerlayouts[] = { "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}, @@ -79,10 +79,10 @@ static const speakerlayout_t snd_speakerlayouts[] = // 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}, @@ -94,8 +94,8 @@ static const speakerlayout_t snd_speakerlayouts[] = // 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}, diff --git a/snd_mix.c b/snd_mix.c index 38e6253a..10da4004 100644 --- a/snd_mix.c +++ b/snd_mix.c @@ -51,7 +51,7 @@ static void S_CaptureAVISound(const portable_sampleframe_t *paintbuffer, size_t 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; @@ -70,7 +70,7 @@ static void S_SoftClipPaintBuffer(portable_sampleframe_t *painted_ptr, int nbfra 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++) { @@ -84,7 +84,7 @@ static void S_SoftClipPaintBuffer(portable_sampleframe_t *painted_ptr, int nbfra 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++) { @@ -96,7 +96,7 @@ static void S_SoftClipPaintBuffer(portable_sampleframe_t *painted_ptr, int nbfra 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++) { @@ -106,7 +106,7 @@ static void S_SoftClipPaintBuffer(portable_sampleframe_t *painted_ptr, int nbfra 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++) { @@ -114,7 +114,7 @@ static void S_SoftClipPaintBuffer(portable_sampleframe_t *painted_ptr, int nbfra 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++) { @@ -125,7 +125,7 @@ static void S_SoftClipPaintBuffer(portable_sampleframe_t *painted_ptr, int nbfra } } -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; @@ -134,7 +134,7 @@ static void S_ConvertPaintBuffer(portable_sampleframe_t *painted_ptr, void *rb_p 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++) { @@ -148,7 +148,7 @@ static void S_ConvertPaintBuffer(portable_sampleframe_t *painted_ptr, void *rb_p 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++) { @@ -160,7 +160,7 @@ static void S_ConvertPaintBuffer(portable_sampleframe_t *painted_ptr, void *rb_p 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++) { @@ -170,7 +170,7 @@ static void S_ConvertPaintBuffer(portable_sampleframe_t *painted_ptr, void *rb_p 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++) { @@ -178,7 +178,7 @@ static void S_ConvertPaintBuffer(portable_sampleframe_t *painted_ptr, void *rb_p 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++) { @@ -188,12 +188,12 @@ static void S_ConvertPaintBuffer(portable_sampleframe_t *painted_ptr, void *rb_p // 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++) { @@ -207,7 +207,7 @@ static void S_ConvertPaintBuffer(portable_sampleframe_t *painted_ptr, void *rb_p 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++) { @@ -219,7 +219,7 @@ static void S_ConvertPaintBuffer(portable_sampleframe_t *painted_ptr, void *rb_p 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++) { @@ -229,7 +229,7 @@ static void S_ConvertPaintBuffer(portable_sampleframe_t *painted_ptr, void *rb_p 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++) { @@ -237,7 +237,7 @@ static void S_ConvertPaintBuffer(portable_sampleframe_t *painted_ptr, void *rb_p 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++) { @@ -247,7 +247,7 @@ static void S_ConvertPaintBuffer(portable_sampleframe_t *painted_ptr, void *rb_p // noise is really really annoying if (cls.timedemo) - memset(rb_ptr, 128, nbframes * channels); + memset(rb_ptr, 128, nbframes * nchannels); } } diff --git a/sv_main.c b/sv_main.c index d0738905..85ca4fe5 100644 --- a/sv_main.c +++ b/sv_main.c @@ -710,7 +710,7 @@ Larger attenuations will drop off. (max 4 attenuation) ================== */ -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; @@ -718,9 +718,9 @@ void SV_StartSound (prvm_edict_t *entity, int channel, const char *sample, int v 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; } @@ -750,7 +750,7 @@ void SV_StartSound (prvm_edict_t *entity, int channel, const char *sample, int v 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; @@ -765,7 +765,7 @@ void SV_StartSound (prvm_edict_t *entity, int channel, const char *sample, int v 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) @@ -802,13 +802,13 @@ function, therefore the check for it is omitted. ================== */ -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; } @@ -828,7 +828,7 @@ void SV_StartPointSound (vec3_t origin, const char *sample, int volume, float at 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; @@ -841,7 +841,7 @@ void SV_StartPointSound (vec3_t origin, const char *sample, int volume, float at 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) @@ -939,13 +939,13 @@ void SV_SendServerinfo (client_t *client) { 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); @@ -964,14 +964,14 @@ void SV_SendServerinfo (client_t *client) 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); } diff --git a/sv_user.c b/sv_user.c index 15b521d5..1e9050df 100644 --- a/sv_user.c +++ b/sv_user.c @@ -233,7 +233,7 @@ static void SV_WaterMove (void) 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); @@ -247,14 +247,14 @@ static void SV_WaterMove (void) 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)); @@ -270,15 +270,15 @@ static void SV_WaterMove (void) 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; @@ -800,7 +800,7 @@ SV_ReadClientMessage 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) @@ -825,8 +825,8 @@ void SV_ReadClientMessage(void) 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 @@ -834,10 +834,10 @@ void SV_ReadClientMessage(void) 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); diff --git a/svvm_cmds.c b/svvm_cmds.c index befc567b..c6fe7c89 100644 --- a/svvm_cmds.c +++ b/svvm_cmds.c @@ -524,7 +524,7 @@ static void VM_SV_sound(prvm_prog_t *prog) const char *sample; int channel; prvm_edict_t *entity; - int volume; + int nvolume; int flags; float attenuation; float pitchchange; @@ -534,7 +534,7 @@ static void VM_SV_sound(prvm_prog_t *prog) 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"); @@ -562,7 +562,7 @@ static void VM_SV_sound(prvm_prog_t *prog) 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; @@ -582,7 +582,7 @@ static void VM_SV_sound(prvm_prog_t *prog) return; } - SV_StartSound (entity, channel, sample, volume, attenuation, flags & CHANNELFLAG_RELIABLE, pitchchange); + SV_StartSound (entity, channel, sample, nvolume, attenuation, flags & CHANNELFLAG_RELIABLE, pitchchange); } /* @@ -598,7 +598,7 @@ is omitted (since no entity is being tracked). static void VM_SV_pointsound(prvm_prog_t *prog) { const char *sample; - int volume; + int nvolume; float attenuation; float pitchchange; vec3_t org; @@ -607,11 +607,11 @@ static void VM_SV_pointsound(prvm_prog_t *prog) 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; @@ -623,7 +623,7 @@ static void VM_SV_pointsound(prvm_prog_t *prog) return; } - SV_StartPointSound (org, sample, volume, attenuation, pitchchange); + SV_StartPointSound (org, sample, nvolume, attenuation, pitchchange); } /* diff --git a/vid_sdl.c b/vid_sdl.c index 805a45b4..9fbe57c6 100644 --- a/vid_sdl.c +++ b/vid_sdl.c @@ -84,7 +84,7 @@ static int win_half_height = 50; 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; @@ -1154,7 +1154,7 @@ void Sys_SendKeyEvents( void ) 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); @@ -2622,15 +2622,15 @@ static qboolean VID_InitModeGL(viddef_mode_t *mode) 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); @@ -2734,15 +2734,15 @@ static qboolean VID_InitModeSoft(viddef_mode_t *mode) 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); @@ -2927,8 +2927,8 @@ void VID_Finish (void) #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 { diff --git a/vid_shared.c b/vid_shared.c index 66b3c93a..c60e6efc 100644 --- a/vid_shared.c +++ b/vid_shared.c @@ -1230,14 +1230,14 @@ void VID_CheckExtensions(void) } #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)