X-Git-Url: http://de.git.xonotic.org/?p=xonotic%2Fdarkplaces.git;a=blobdiff_plain;f=view.c;h=de0bf4d56eb4b2e7bd8baf987b816b0c4b3b2cf1;hp=d216df298086b47279959a18fbd1a1124c6277f0;hb=29779ce432d34c9f0bc8878761d07c194162e6d0;hpb=2dbee12045f16a65478af929fad75de917d1fa2e diff --git a/view.c b/view.c index d216df29..de0bf4d5 100644 --- a/view.c +++ b/view.c @@ -214,7 +214,7 @@ void V_ParseDamage (void) armor = MSG_ReadByte (); blood = MSG_ReadByte (); - MSG_ReadVector(from); + MSG_ReadVector(from, cl.protocol); count = blood*0.5 + armor*0.5; if (count < 10) @@ -313,7 +313,7 @@ void V_CalcRefdef (void) { static float oldz; entity_t *ent; - float vieworg[3], viewangles[3], newz; + float vieworg[3], viewangles[3]; Matrix4x4_CreateIdentity(&viewmodelmatrix); Matrix4x4_CreateIdentity(&r_refdef.viewentitymatrix); if (cls.state == ca_connected && cls.signon == SIGNONS) @@ -334,12 +334,19 @@ void V_CalcRefdef (void) VectorCopy(cl.viewangles, viewangles); // stair smoothing - newz = vieworg[2]; - oldz -= newz; - oldz += (cl.time - cl.oldtime) * cl_stairsmoothspeed.value; - oldz = bound(-16, oldz, 0); - vieworg[2] += oldz; - oldz += newz; + //Con_Printf("cl.onground %i oldz %f newz %f\n", cl.onground, oldz, vieworg[2]); + if (cl.onground && oldz < vieworg[2]) + { + oldz += (cl.time - cl.oldtime) * cl_stairsmoothspeed.value; + oldz = vieworg[2] = bound(vieworg[2] - 16, oldz, vieworg[2]); + } + else if (cl.onground && oldz > vieworg[2]) + { + oldz -= (cl.time - cl.oldtime) * cl_stairsmoothspeed.value; + oldz = vieworg[2] = bound(vieworg[2], oldz, vieworg[2] + 16); + } + else + oldz = vieworg[2]; if (chase_active.value) { @@ -378,7 +385,7 @@ void V_CalcRefdef (void) { // first person view from entity // angles - if (cl.stats[STAT_HEALTH] <= 0) + if (cl.stats[STAT_HEALTH] <= 0 && gamemode != GAME_FNIGGIUM) viewangles[ROLL] = 80; // dead view angle VectorAdd(viewangles, cl.punchangle, viewangles); viewangles[ROLL] += V_CalcRoll(cl.viewangles, cl.velocity); @@ -390,7 +397,7 @@ void V_CalcRefdef (void) } // origin VectorAdd(vieworg, cl.punchvector, vieworg); - vieworg[2] += cl.viewheight; + vieworg[2] += cl.stats[STAT_VIEWHEIGHT]; if (cl.stats[STAT_HEALTH] > 0 && cl_bob.value && cl_bobcycle.value) { double bob, cycle; @@ -442,7 +449,7 @@ void V_CalcViewBlend(void) r_refdef.viewblend[1] = 0; r_refdef.viewblend[2] = 0; r_refdef.viewblend[3] = 0; - if (cls.state == ca_connected && cls.signon == SIGNONS) + if (cls.state == ca_connected && cls.signon == SIGNONS && gl_polyblend.value > 0) { // set contents color switch (CL_PointQ1Contents(r_vieworigin)) @@ -475,28 +482,28 @@ void V_CalcViewBlend(void) if (gamemode != GAME_TRANSFUSION) { - if (cl.items & IT_QUAD) + if (cl.stats[STAT_ITEMS] & IT_QUAD) { cl.cshifts[CSHIFT_POWERUP].destcolor[0] = 0; cl.cshifts[CSHIFT_POWERUP].destcolor[1] = 0; cl.cshifts[CSHIFT_POWERUP].destcolor[2] = 255; cl.cshifts[CSHIFT_POWERUP].percent = 30; } - else if (cl.items & IT_SUIT) + else if (cl.stats[STAT_ITEMS] & IT_SUIT) { cl.cshifts[CSHIFT_POWERUP].destcolor[0] = 0; cl.cshifts[CSHIFT_POWERUP].destcolor[1] = 255; cl.cshifts[CSHIFT_POWERUP].destcolor[2] = 0; cl.cshifts[CSHIFT_POWERUP].percent = 20; } - else if (cl.items & IT_INVISIBILITY) + else if (cl.stats[STAT_ITEMS] & IT_INVISIBILITY) { cl.cshifts[CSHIFT_POWERUP].destcolor[0] = 100; cl.cshifts[CSHIFT_POWERUP].destcolor[1] = 100; cl.cshifts[CSHIFT_POWERUP].destcolor[2] = 100; cl.cshifts[CSHIFT_POWERUP].percent = 100; } - else if (cl.items & IT_INVULNERABILITY) + else if (cl.stats[STAT_ITEMS] & IT_INVULNERABILITY) { cl.cshifts[CSHIFT_POWERUP].destcolor[0] = 255; cl.cshifts[CSHIFT_POWERUP].destcolor[1] = 255; @@ -519,7 +526,7 @@ void V_CalcViewBlend(void) if (a2 > 0) { VectorLerp(r_refdef.viewblend, a2, cl.cshifts[j].destcolor, r_refdef.viewblend); - r_refdef.viewblend[3] = 1 - (1 - r_refdef.viewblend[3]) * (1 - a2); // correct alpha multiply... took a while to find it on the web + r_refdef.viewblend[3] = (1 - (1 - r_refdef.viewblend[3]) * (1 - a2)); // correct alpha multiply... took a while to find it on the web } } // saturate color (to avoid blending in black) @@ -532,7 +539,7 @@ void V_CalcViewBlend(void) r_refdef.viewblend[0] = bound(0.0f, r_refdef.viewblend[0] * (1.0f/255.0f), 1.0f); r_refdef.viewblend[1] = bound(0.0f, r_refdef.viewblend[1] * (1.0f/255.0f), 1.0f); r_refdef.viewblend[2] = bound(0.0f, r_refdef.viewblend[2] * (1.0f/255.0f), 1.0f); - r_refdef.viewblend[3] = bound(0.0f, r_refdef.viewblend[3] , 1.0f); + r_refdef.viewblend[3] = bound(0.0f, r_refdef.viewblend[3] * gl_polyblend.value, 1.0f); } }