All pastes #584749 Raw Edit

Mine

public text v1 · immutable
·published 2007-06-22 22:20 UTC
rendered paste body
void PlayerPostThink()
{
	float vel;
//dprint ("post think\n");

/* FIXME: really comment?

    if (intermission_running)
    {
        setorigin (self, intermission_spot.origin);
        self.velocity = VEC_ORIGIN;	// don't stray off the intermission spot too far
        return;
    }

*/

	if( k_pause ) {
		ImpulseCommands();
		return;
	}

	if ( self->s.v.view_ofs[0] == 0 && self->s.v.view_ofs[1] == 0 && self->s.v.view_ofs[2] == 0 )
		return;		// intermission or finale

	if ( self->s.v.deadflag )
		return;

//team

// WaterMove function call moved here from PlayerPreThink to avoid
// occurrence of the spawn lavaburn bug and to fix the problem on spawning
// and playing the leave water sound if the player died underwater.

    WaterMove ();


// clear the flag if we landed
    if( (int)self->s.v.flags & FL_ONGROUND )
		self->brokenankle = 0;

// check to see if player landed and play landing sound 
	if ( ( self->jump_flag < -300 ) && ( ( ( int ) ( self->s.v.flags ) ) & FL_ONGROUND ) )
	{
// Falling often results in 5-5 points of damage through 2 frames.
// This fixes the bug
        self->s.v.velocity[2] = 0;

		if ( self->s.v.watertype == CONTENT_WATER )
			sound( self, CHAN_BODY, "player/h2ojump.wav", 1, ATTN_NORM );
		else if ( self->jump_flag < jumpf_flag )
		{
			gedict_t *gre = PROG_TO_EDICT ( self->s.v.groundentity );

			if ( self->s.v.waterlevel < 2 )
			{
				// Jawnmode: fallbunny is always enabled, but with a modification: speed is capped
				// - Molgrum
				if ( get_fallbunny() )
				{
					vel = vlen( other->old_vel ) * ( 1.0 - cvar( "k_fallbunny_cap" ) / 100.0 );
					VectorScale( g_globalvars.v_forward, vel, other->s.v.velocity );
				}
				else
				{
	               	self->brokenankle = 1;  // Yes we have just broken it
				}
			}

			self->deathtype = dtFALL;
			T_Damage( self, world, world, 5 );
			sound( self, CHAN_VOICE, "player/land2.wav", 1, ATTN_NORM );

			if ( gre && gre->s.v.takedamage == DAMAGE_AIM && gre != self )
			{
				// we landed on someone's head, hurt him
				gre->deathtype = dtSTOMP;
				T_Damage (gre, self, self, 10);
			}
		} else
			sound( self, CHAN_VOICE, "player/land.wav", 1, ATTN_NORM );
	}

	self->jump_flag = self->s.v.velocity[2];

	CheckPowerups();
	CheckStuffRune();

	mv_record();

	W_WeaponFrame();

#ifdef VWEP_TEST
    // update vwep frame
    if(!strnull(ezinfokey(world, "vwep")) && vw_available > 0)
    {
        if (self->s.v.health <= 0)
        {
            self->vw_index = 0;
            self->vw_frame = 0;
        }
        else
            self->vw_frame = self->s.v.frame;
    }
#endif

	{
		float velocity = sqrt(self->s.v.velocity[0] * self->s.v.velocity[0] + 
							  self->s.v.velocity[1] * self->s.v.velocity[1]);
		if ( !match_in_progress && !match_over && !k_captains )
		{
			if ( iKey( self, "kf" ) & KF_SPEED ) {
				float velocity_vert_abs	= fabs(self->s.v.velocity[2]);
				self->s.v.armorvalue	= (int)(velocity < 1000 ? velocity + 1000 : -velocity);
				self->s.v.frags			= (int)(velocity) / 1000;
				self->s.v.ammo_shells   = 100 + (int)(velocity_vert_abs) / 100000000;
				self->s.v.ammo_nails    = 100 + (int)(velocity_vert_abs) %   1000000 / 10000;
				self->s.v.ammo_rockets  = 100 + (int)(velocity_vert_abs) %     10000 / 100;
				self->s.v.ammo_cells    = 100 + (int)(velocity_vert_abs) %       100;
			}
			else {
				self->s.v.armorvalue = 1000;
				self->s.v.frags = 0;
			}
 		}
		if( match_in_progress == 2 )
		{
			self->ps.vel_frames++;
			self->ps.velocity_sum += velocity;
			if (self->ps.velocity_max < velocity)
				self->ps.velocity_max = velocity;
		}
	}
}