All pastes #715431 Raw Edit

Mine

public cpp v1 · immutable
#715431 ·published 2007-09-26 09:16 UTC
rendered paste body
//========= Copyright © 2006-2007, Tom Leighton (Marine), All rights reserved. ============////// Purpose: The Animation Controllers for the CS:S Player Models////=========================================================================================//#include "cbase.h"#include "base_playeranimstate.h"#include "tier0/vprof.h"#include "animation.h"#include "studio.h"#include "apparent_velocity_helper.h"#include "utldict.h"#include "css_anims.h"#include "weapon_hl2mpbasehlmpcombatweapon.h"#ifdef CLIENT_DLL	#include "c_hl2mp_player.h"	#include "bone_setup.h"	#include "interpolatedvar.h"#else	#include "hl2mp_player.h"#endif#define ANIM_TOPSPEED_WALK			100#define ANIM_TOPSPEED_RUN			250#define ANIM_TOPSPEED_RUN_CROUCH	85#define DEFAULT_IDLE_NAME "idle_upper_"#define DEFAULT_CROUCH_IDLE_NAME "crouch_idle_upper_"#define DEFAULT_CROUCH_WALK_NAME "crouch_walk_upper_"#define DEFAULT_WALK_NAME "walk_upper_"#define DEFAULT_RUN_NAME "run_upper_"#define DEFAULT_FIRE_IDLE_NAME "idle_shoot_"#define DEFAULT_FIRE_CROUCH_NAME "crouch_idle_shoot_"#define DEFAULT_FIRE_CROUCH_WALK_NAME "crouch_walk_shoot_"#define DEFAULT_FIRE_WALK_NAME "walk_shoot_"#define DEFAULT_FIRE_RUN_NAME "run_shoot_"#define FIRESEQUENCE_LAYER		(AIMSEQUENCE_LAYER+NUM_AIMSEQUENCE_LAYERS)#define RELOADSEQUENCE_LAYER	(FIRESEQUENCE_LAYER + 1)#define GRENADESEQUENCE_LAYER	(RELOADSEQUENCE_LAYER + 1)#define NUM_LAYERS_WANTED		(GRENADESEQUENCE_LAYER + 1)////// Base Class Undefined (ICSSPlayerAnimState) -- but i have included the header file... The header file is below.////class CCSSPlayerAnimState : public CBasePlayerAnimState, public ICSSPlayerAnimState	{	public:		DECLARE_CLASS( CCSSPlayerAnimState, CBasePlayerAnimState );		friend ICSSPlayerAnimState* CreatePlayerAnimState( CBaseAnimatingOverlay *pEntity, ICSSPlayerAnimStateHelpers *pHelpers, LegAnimType_t legAnimType, bool bUseAimSequences );		CCSSPlayerAnimState();		virtual void DoAnimationEvent( PlayerAnimEvent_t event );		virtual bool IsThrowingGrenade();		virtual int CalcAimLayerSequence( float *flCycle, float *flAimSequenceWeight, bool bForceIdle );		virtual void ClearAnimationState();		virtual bool CanThePlayerMove();		virtual float GetCurrentMaxGroundSpeed();		virtual Activity CalcMainActivity();		virtual void DebugShowAnimState( int iStartLine );		virtual void ComputeSequences( CStudioHdr *pStudioHdr );		virtual void ClearAnimationLayers();			void InitCSS( CBaseAnimatingOverlay *pPlayer, ICSSPlayerAnimStateHelpers *pHelpers, LegAnimType_t legAnimType, bool bUseAimSequences );protected:	int CalcFireLayerSequence(PlayerAnimEvent_t event);	void ComputeFireSequence(CStudioHdr *pStudioHdr);	void ComputeReloadSequence(CStudioHdr *pStudioHdr);	int CalcReloadLayerSequence();	bool IsOuterGrenadePrimed();	void ComputeGrenadeSequence( CStudioHdr *pStudioHdr );	int CalcGrenadePrimeSequence();	int CalcGrenadeThrowSequence();	int GetOuterGrenadeThrowCounter();	const char* GetWeaponSuffix();	bool HandleJumping();	void UpdateLayerSequenceGeneric( CStudioHdr *pStudioHdr, int iLayer, bool &bEnabled, float &flCurCycle, int &iSequence, bool bWaitAtEnd );private:	// Current state variables.	bool m_bJumping;			// Set on a jump event.	float m_flJumpStartTime;	bool m_bFirstJumpFrame;	// Aim sequence plays reload while this is on.	bool m_bReloading;	float m_flReloadCycle;	int m_iReloadSequence;		// This is set to true if ANY animation is being played in the fire layer.	bool m_bFiring;						// If this is on, then it'll continue the fire animation in the fire layer										// until it completes.	int m_iFireSequence;				// (For any sequences in the fire layer, including grenade throw).	float m_flFireCycle;	// These control grenade animations.	bool m_bThrowingGrenade;	bool m_bPrimingGrenade;	float m_flGrenadeCycle;	int m_iGrenadeSequence;	int m_iLastThrowGrenadeCounter;	// used to detect when the guy threw the grenade.		ICSSPlayerAnimStateHelpers *m_pHelpers;};ICSSPlayerAnimState* CreatePlayerAnimState( CBaseAnimatingOverlay *pEntity, ICSSPlayerAnimStateHelpers *pHelpers, LegAnimType_t legAnimType, bool bUseAimSequences )	{CCSSPlayerAnimState *pRet = new CCSSPlayerAnimState;	}////// css_anims.h//////========= Copyright © 2006-2007, Tom Leighton (Marine), All rights reserved. ============////// Purpose: The Animation Controllers for the CS:S Player Models////=========================================================================================//#ifndef CSS_ANIMSTATE#define CSS_ANIMSTATE#else#ifdef _WIN32#pragma once#endif#include "convar.h"#include "iplayeranimstate.h"#include "base_playeranimstate.h"#ifdef CLIENT_DLL	class C_BaseAnimatingOverlay;	class C_BaseHL2MPCombatWeapon;	#define CBaseAnimatingOverlay	C_BaseAnimatingOverlay	#define CBaseHL2MPCombatWeapon C_BaseHL2MPCombatWeapon	#define CHL2MP_Player C_HL2MP_Player#else	class CBaseAnimatingOverlay;	class CBaseHL2MPCombatWeapon;	class CHL2MP_Player;#endif#define ARBITRARY_RUN_SPEED		175.0fenum PlayerAnimEvent_t{	PLAYERANIMEVENT_FIRE_GUN_PRIMARY=0,	PLAYERANIMEVENT_FIRE_GUN_SECONDARY,	PLAYERANIMEVENT_THROW_GRENADE,	PLAYERANIMEVENT_JUMP,	PLAYERANIMEVENT_RELOAD,		PLAYERANIMEVENT_COUNT};public class ICSSPlayerAnimState : virtual public IPlayerAnimState	{	public:		// This is called by both the client and the server in the same way to trigger events for	// players firing, jumping, throwing grenades, etc.	virtual void DoAnimationEvent( PlayerAnimEvent_t event ) = 0;		// Returns true if we're playing the grenade prime or throw animation.	virtual bool IsThrowingGrenade() = 0;	}// This abstracts the differences between CSS players and hostages.class ICSSPlayerAnimStateHelpers{public:	virtual CBaseHL2MPCombatWeapon* CSSAnim_GetActiveWeapon() = 0;	virtual bool CSSAnim_CanMove() = 0;};ICSSPlayerAnimState* CreatePlayerAnimState( CBaseAnimatingOverlay *pEntity, ICSSPlayerAnimStateHelpers *pHelpers, LegAnimType_t legAnimType, bool bUseAimSequences );// If this is set, then the game code needs to make sure to send player animation events// to the local player if he's the one being watched.extern ConVar cl_showanimstate;#endif // CSS_ANIMSTATE