All pastes #516202 Raw Edit

Nial

public text v1 · immutable
#516202 ·published 2007-05-28 16:15 UTC
rendered paste body
// =============================================================================
// rne_player.cpp - server-side player

#include "cbase.h"
#include "rne_player.h"
#include "globalstate.h"
#include "game.h"
#include "gamerules.h"
#include "hl2mp_player_shared.h"
#include "predicted_viewmodel.h"
#include "in_buttons.h"
#include "hl2mp_gamerules.h"
#include "KeyValues.h"
#include "team.h"
#include "weapon_hl2mpbase.h"
#include "grenade_satchel.h"
#include "eventqueue.h"

#include "engine/IEngineSound.h"
#include "SoundEmitterSystem/isoundemittersystembase.h"

#include "ilagcompensationmanager.h"
#include "items.h"
#include "rne_defs.h"

IMPLEMENT_SERVERCLASS_ST(RNE_Player, DT_RNE_Player)

	SendPropInt		(SENDINFO(iActiveRune), 10 ),

END_SEND_TABLE()

BEGIN_DATADESC( RNE_Player )
END_DATADESC()

LINK_ENTITY_TO_CLASS( player, RNE_Player );


//BEGIN_PREDICTION_DATA( RNE_Player )
//END_PREDICTION_DATA()

RNE_Player::RNE_Player()
{
}

RNE_Player::~RNE_Player( void )
{
}

void RNE_Player::Spawn( void )
{

	BaseClass::Spawn();
	Msg("Spawn!");
	UpdateRuneState( EmptyRune, 0 );

}



// =============================================================================
// rne_player.h - server-side player

#ifndef RNE_PLAYER_H
#define RNE_PLAYER_H
#pragma once

#include "hl2mp_player.h"

class RNE_Player;

class RNE_Player : public CHL2MP_Player
{
public:
	DECLARE_CLASS( RNE_Player, CHL2MP_Player );

	DECLARE_SERVERCLASS();
	DECLARE_DATADESC();
	//DECLARE_PREDICTABLE();

	RNE_Player();
	~RNE_Player( void );

	int						UpdateRuneState( int NewRuneState, int AcquireType );
	void					ActivateRune( int RuneId );
	void					DeactivateRune( int RuneId );
	void					RuneAction( void );
	void					RuneButtonAction( void );
	float					m_flRegenTime;
	float					m_flElectricTime;
	bool					m_bRecallPoint;
	Vector					m_RecallVectorOrigin;
	QAngle					m_RecallVectorAngle;

	void					Spawn( void );
	void					PostThink( void );
	int						OnTakeDamage( const CTakeDamageInfo &inputInfo );

public:
	float					m_flWaterJumpTime;
	float					m_flLastJumpTime;
	float					m_surfaceFriction;
	float					m_flSwimSoundTime;
	surfacedata_t*			m_pSurfaceData;

public:
	int ActiveRune() const	{ return iActiveRune; }
	CNetworkVar( int, iActiveRune );

	static RNE_Player *CreatePlayer( const char *className, edict_t *ed )
	{

		RNE_Player::s_PlayerEdict = ed;
		return (RNE_Player*)CreateEntityByName( className );

	}

private:
	CNetworkVarForDerived( int, m_ArmorValue );

protected:
	friend class RNE_GameMovement;
	
};

inline RNE_Player *ToRNEPlayer( CBaseEntity *pEntity )
{
	if ( !pEntity || !pEntity->IsPlayer() )
		return NULL;

	return static_cast<RNE_Player*>( pEntity );
}

#endif




// =============================================================================
// rne_c_player.c - client-side player

#include "cbase.h"
#include "rne_c_player.h"

#if defined( CBasePlayer )
#undef CBasePlayer
#endif

IMPLEMENT_CLIENTCLASS_DT(RNE_C_Player, DT_RNE_Player, RNE_Player)

	RecvPropInt( RECVINFO( iActiveRune ) ),

END_RECV_TABLE()

BEGIN_PREDICTION_DATA( RNE_C_Player )
END_PREDICTION_DATA()

LINK_ENTITY_TO_CLASS( player, RNE_C_Player );


RNE_C_Player::RNE_C_Player()
{
}

RNE_C_Player::~RNE_C_Player( void )
{
}



// =============================================================================
// rne_c_player.h - client-side player


#ifndef RNE_C_PLAYER_H
#define RNE_C_PLAYER_H
#pragma once

//#include "c_basehlplayer.h"
#include "c_hl2mp_player.h"

class RNE_C_Player;

class RNE_C_Player : public C_HL2MP_Player
{
public:
	DECLARE_CLASS( RNE_C_Player, C_HL2MP_Player );
	DECLARE_CLIENTCLASS();
	DECLARE_PREDICTABLE();
	DECLARE_INTERPOLATION();

	RNE_C_Player();
	~RNE_C_Player( void );

	int						iActiveRune;

public:
	float					m_flWaterJumpTime;
	float					m_flLastJumpTime;
	float					m_surfaceFriction;
	float					m_flSwimSoundTime;
	surfacedata_t*	m_pSurfaceData;

};

inline RNE_C_Player *ToRNEPlayer( C_BaseEntity *pEntity )
{
	if ( !pEntity || !pEntity->IsPlayer() )
		return NULL;

	return static_cast<RNE_C_Player*>( pEntity );
}

#endif;


// =============================================================================
// gamemovement.cpp

#include "cbase.h"
#include "gamemovement.h"
#include "in_buttons.h"
#include <stdarg.h>
#include "movevars_shared.h"
#include "engine/IEngineTrace.h"
#include "SoundEmitterSystem/isoundemittersystembase.h"
#include "decals.h"
#include "coordsize.h"
#include "rne_list.h"

#ifdef CLIENT_DLL
#include "rne_c_player.h"
#else
#include "rne_player.h"
#endif


bool CRuneBase::MyTouch( CBasePlayer *pPlayer )
{

	RNE_Player *nPlayer = RNE_Player::ToRNEPlayer(player);