Authoring a Brush Entity/Code: Difference between revisions

From Valve Developer Community
Jump to navigation Jump to search
mNo edit summary
(spam is stinky)
Line 1: Line 1:
[http://www.glfeldma.00it.com here] [http://teens.eskout.cn/sweet-tits.html sweet tits] [http://movies.eskout.cn/britney-spears.html britney spears hardcore] [http://women.eskout.cn/apartment-building.html apartment building financing] [http://teens.eskout.cn/guano-apes-mp3.html guano apes mp3] [http://playboy.eskout.cn/ultimate-messy.html ultimate messy directory] [http://sex.eskout.cn/gangbang-sqaud.html gangbang sqaud] [http://www.aihhailaind.teach-nology.com home] [http://nude.eskout.cn/san-jose-grand-prix.html san jose grand prix] [http://www.mcmaing.00home.com home] [http://lesbian.eskout.cn/nudist-pic.html nudist pic] [http://fuck.eskout.cn/isle-of-palms.html isle of palms] [http://www.freewebs.com/5y4ka/ home] [http://playboy.eskout.cn/bj-wholesale.html bj wholesale] [http://fuck.eskout.cn/nude-pictures-free.html nude pictures free] [http://hentai.eskout.cn/incestcartoons.html incestcartoons] [http://sex.eskout.cn/jasmine-porn.html jasmine porn] [http://anal.eskout.cn/smooth-girl.html smooth girl] [http://xxx.eskout.cn/sexual-stamina.html sexual stamina] [http://playboy.eskout.cn/chicago-commercial.html chicago commercial real estate] [http://girl.eskout.cn/free-gagging-on.html free gagging on cum movies] [http://porno.eskout.cn/big-black-bitches.html big black bitches] [http://women.eskout.cn/homes-las-vegas.html homes las vegas realty] [http://anal.eskout.cn/fly-fishing-trips.html fly fishing trips] [http://blondes.eskout.cn/country-boys.html country boys] [http://fuck.eskout.cn/maui-whale-watching.html maui whale watching tours] [http://girl.eskout.cn/free-adult-video.html free adult video chat] [http://fuck.eskout.cn/manga-girl.html manga girl] [http://anal.eskout.cn/first-line-drugs.html first line drugs strep throat] [http://hardcore.eskout.cn/soft-porn.html soft porn] [http://women.eskout.cn/old-man-sex.html old man sex] [http://lesbian.eskout.cn/moms-can-fuck.html moms can fuck] [http://www.myswom.theshoppe.com home] [http://hardcore.eskout.cn/rectal-temperature.html rectal temperature] [http://teens.eskout.cn/free-wired-pussy.html free wired pussy] [http://anal.eskout.cn/horny-spanish.html horny spanish flies] [http://www.boheluky.s5.com here] [http://playboy.eskout.cn/habanos-cigars.html habanos cigars] [http://teens.eskout.cn/starry-eyed-surprise.html starry eyed surprise] [http://nude.eskout.cn/crafts-for-kids.html crafts for kids] [http://incest.eskout.cn/kelley-clarkson.html kelley clarkson] [http://playboy.eskout.cn/cream-pie-pussy.html cream pie pussy] [http://www.luhoward.00cash.com map] [http://teen.eskout.cn/porn-star-movies.html porn star movies] [http://www.obybety.00go.com page] [http://hardcore.eskout.cn/have-a-little.html have a little faith in me] [http://movies.eskout.cn/jersey-shore.html jersey shore vacation rentals] [http://teens.eskout.cn/underage-nude-models.html underage nude models] [http://hentai.eskout.cn/gearfetish.html gearfetish] [http://porno.eskout.cn/russian-lesbian.html russian lesbian] [http://porno.eskout.cn/mom-and-boy.html mom and boy] [http://movies.eskout.cn/bionca.html bionca] [http://www.geocities.com/idimnogh/ map] [http://sex.eskout.cn/aaaa.html aaaa] [http://women.eskout.cn/very-young-nude.html very young nude] [http://porno.eskout.cn/perv.html perv] [http://girls.eskout.cn/hot-asian-porn.html hot asian porn] [http://sex.eskout.cn/adult-bed-wetting.html adult bed wetting] [http://movies.eskout.cn/dwarf-sex.html dwarf sex] [http://www.listelena171986.00cd.com page] [http://movies.eskout.cn/chill-out.html chill out] [http://xxx.eskout.cn/gay-bang.html gay bang] [http://www.ailinekai82.20megsfree.com page] [http://www.ydabkaa.actorsite.com map] [http://girl.eskout.cn/banging-bus.html banging bus] [http://lesbian.eskout.cn/adult-vod.html adult vod] [http://sex.eskout.cn/fit-tv.html fit tv] [http://nude.eskout.cn/sports-illustrated.html sports illustrated swimsuit models] [http://playboy.eskout.cn/trx450r.html trx450r] [http://movies.eskout.cn/fkk-bilder.html fkk bilder] [http://fuck.eskout.cn/xxxpics.html xxxpics] [http://movies.eskout.cn/shape-poems.html shape poems] [http://women.eskout.cn/non-surgical-face.html non surgical face lift] [http://sex.eskout.cn/aloe-vera-product.html aloe vera product] [http://fuck.eskout.cn/freeteenporn.html freeteenporn] [http://lesbian.eskout.cn/sheryl-crow.html sheryl crow naked] [http://fuck.eskout.cn/no-exam-life-insurance.html no exam life insurance] [http://anal.eskout.cn/sucking-clit.html sucking clit] [http://xxx.eskout.cn/atlanta-apartments.html atlanta apartments] [http://girl.eskout.cn/livejasmin.html livejasmin] [http://playboy.eskout.cn/milf-finder.html milf finder] [http://fuck.eskout.cn/naked-soccer-moms.html naked soccer moms] [http://women.eskout.cn/moorhuhn3.html moorhuhn3] [http://teens.eskout.cn/sheep-sex.html sheep sex] [http://www.gwebspace.de/switchcarjimmy/ map] [http://teen.eskout.cn/mom-and-daughter.html mom and daughter sex] [http://www.faicaitrin.00show.com page] [http://teen.eskout.cn/actresses-naked.html actresses naked] [http://sex.eskout.cn/girls-in-panties.html girls in panties] [http://movies.eskout.cn/buster-xl-ht.html buster xl ht] [http://teens.eskout.cn/guys-fingering-girls.html guys fingering girls] [http://hardcore.eskout.cn/wholesale-pet-products.html wholesale pet products] [http://movies.eskout.cn/kids-next-door.html kids next door porn] [http://lesbian.eskout.cn/sexual-transmitted.html sexual transmitted disease] [http://women.eskout.cn/male-images.html male images] [http://incest.eskout.cn/close-up-cunt.html close up cunt] [http://girl.eskout.cn/belly-dance-costumes.html belly dance costumes] [http://porno.eskout.cn/free-lesbian-video.html free lesbian video] [http://nude.eskout.cn/innocent-pussy.html innocent pussy] [http://movies.eskout.cn/hot-black-teens.html hot black teens]
[[Category:Programming]]
[[Category:Programming]]
<pre>
<pre>
//===== Copyright © 1996-2005, Valve Corporation, All rights reserved. ========
//===== Copyright © 1996-2005, Valve Corporation, All rights reserved. ========
//
//
// Purpose: Simple brush entity that moves when touched
// Purpose: Simple brush entity that moves when touched

Revision as of 12:12, 24 November 2007

//===== Copyright © 1996-2005, Valve Corporation, All rights reserved. ========
//
// Purpose: Simple brush entity that moves when touched
//
//=============================================================================

#include "cbase.h"

class CMyBrushEntity : public CBaseToggle
{
public:
	DECLARE_CLASS( CMyBrushEntity, CBaseToggle );
	DECLARE_DATADESC();

	void Spawn( void );
	bool CreateVPhysics( void );

	void BrushTouch( CBaseEntity *pOther );
};

LINK_ENTITY_TO_CLASS( my_brush_entity, CMyBrushEntity );

// Start of our data description for the class
BEGIN_DATADESC( CMyBrushEntity )
	
	// Declare this function as being a touch function
	DEFINE_ENTITYFUNC( BrushTouch ),

END_DATADESC()

//-----------------------------------------------------------------------------
// Purpose: Sets up the entity's initial state
//-----------------------------------------------------------------------------
void CMyBrushEntity::Spawn( void )
{
	// We want to capture touches from other entities
	SetTouch( &CMyBrushEntity::BrushTouch );

	// We should collide with physics
	SetSolid( SOLID_VPHYSICS );
	
	// We push things out of our way
	SetMoveType( MOVETYPE_PUSH );
	
	// Use our brushmodel
	SetModel( STRING( GetModelName() ) );

	// Create our physics hull information
	CreateVPhysics();
}

//-----------------------------------------------------------------------------
// Purpose: Setup our physics information so we collide properly
//-----------------------------------------------------------------------------
bool CMyBrushEntity::CreateVPhysics( void )
{
	// For collisions with physics objects
	VPhysicsInitShadow( false, false );

	return true;
}

//-----------------------------------------------------------------------------
// Purpose: Move away from an entity that touched us
// Input  : *pOther - the entity we touched
//-----------------------------------------------------------------------------
void CMyBrushEntity::BrushTouch( CBaseEntity *pOther )
{
	// Get the collision information
	const trace_t &tr = GetTouchTrace();

	// We want to move away from the impact point along our surface
	Vector	vecPushDir = tr.plane.normal;
	vecPushDir.Negate();
	vecPushDir.z = 0.0f;

	// Move slowly in that direction
	LinearMove( GetAbsOrigin() + ( vecPushDir * 64.0f ), 32.0f );
}