All pastes #386725 Raw Edit

Someone

public text v1 · immutable
·published 2007-03-08 21:12 UTC
rendered paste body
/*
===============
idPlayer::FireWeapon
===============
*/
void idPlayer::FireWeapon( void ) {
	idMat3 axis;
	idVec3 muzzle;

//gameLocal.mpGame.AddChatLine( "weee\n");


	if ( weapon->wsfl.reloading )
		return;

	if ( privateCameraView ) {
		return;
	}

	switch ( weapon->status ) {
		case WP_READY:
			gameLocal.mpGame.AddChatLine( "rdyn\n");
			break;
		case WP_OUTOFAMMO:
			gameLocal.mpGame.AddChatLine( "noammo\n");
			break;		
		case WP_RELOAD:
			gameLocal.mpGame.AddChatLine( "reloadin\n");
			break;
		case WP_HOLSTERED:
			gameLocal.mpGame.AddChatLine( "holstered\n");
			break;
		case WP_RISING:
			gameLocal.mpGame.AddChatLine( "rising\n");
			break;
		case WP_LOWERING:
			gameLocal.mpGame.AddChatLine( "lowering\n");
			break;
		default: {
			gameLocal.mpGame.AddChatLine( "PIECE OF CRAP :(\n");
			return;
		}
	}

	if ( g_editEntityMode.GetInteger() ) {
		GetViewPos( muzzle, axis );
		gameLocal.editEntities->SelectEntity( muzzle, axis[0], this );	
		return;
	}

	if ( gameLocal.time > allowNextFireTime && !isBuilding && !isFacingDispenser && !hiddenWeapon && weapon->IsReady() ) {
		if ( weapon->AmmoInClip() || weapon->AmmoAvailable() ) {
			pfl.attackHeld = true;
			weapon->BeginAttack();
		} else {
			pfl.attackHeld = false;
			pfl.weaponFired = false;
			StopFiring();
			NextBestWeapon();
		}
	}

	// If reloading when fire is hit cancel the reload
	else if ( weapon->IsReloading() ) {
		weapon->CancelReload();
	}

	if ( isPreviewing ) {
		StopPreview();
	}

	ClearDisguise();
}