.:: Bots United ::.  
filebase forums discord server github wiki web
cubebot epodbot fritzbot gravebot grogbot hpbbot ivpbot jkbotti joebot
meanmod podbotmm racc rcbot realbot sandbot shrikebot soulfathermaps yapb

Go Back   .:: Bots United ::. > Developer's Farm > SDK Programming discussions > Half-Life 2 SDK
Half-Life 2 SDK For developments focused around the Half-Life 2 engine Half-Life 2

Reply
 
Thread Tools
draw beam
Old
  (#1)
Cheeseh
[rcbot]
 
Cheeseh's Avatar
 
Status: Offline
Posts: 361
Join Date: Dec 2003
Location: China
Default draw beam - 01-01-2005

okay I've been making a new bot template from botmans so far, I'm trying to do some waypoint stuff, just trying to wonder how to draw a waypoint.

I can't really include the beam stuff as I need to include lots of files that can't find lots of stuff.

I have:
Code:
void CWaypoint :: draw ( edict_t *pEdict )
{
	CTEBeamPoints *beam = new CTEBeamPoints();

	CEdictRecipient *filter = new CEdictRecipient(pEdict,false);

	engine->UserMessageBegin(filter,TE_BEAMPOINTS); // TE_BEAMPOINTS in here?? what about tempentity...?
	// are these in right order??
	WRITE_COORD(/*???*/) // ??? start and end points???
	WRITE_BYTE( m_nModelIndex ); //???
	WRITE_BYTE( m_nHaloIndex );
	WRITE_BYTE( m_nStartFrame );
	WRITE_BYTE( m_nFrameRate );
	WRITE_FLOAT( m_fLife );
	WRITE_FLOAT( m_fWidth );
	WRITE_FLOAT( m_fEndWidth );
	WRITE_BYTE( m_nFadeLength );
	WRITE_FLOAT( m_fAmplitude );
	WRITE_BYTE( r );
	WRITE_BYTE( g );
	WRITE_BYTE( b );
	WRITE_BYTE( a );
	WRITE_BYTE( m_nSpeed );
	WRITE_BYTE( m_nFlags );
	engine->MessageEnd();	

	delete filter;
}
I had to make a filter:
Code:
class CEdictRecipient : public IRecipientFilter
{
public:
	CEdictRecipient ( edict_t *pEdict, bool bReliable )
	{
		m_pEdict = pEdict;
		m_bReliable = bReliable;
	}

	// require destructor
	~CEdictRecipient ()
	{
		m_pEdict = NULL;
		m_bReliable = false;
	}

	bool	IsReliable( void ) const { return m_bReliable; }

	bool	IsInitMessage( void ) const { return false; }

	int		GetRecipientCount( void ) const { return 1; }
	int		GetRecipientIndex( int slot ) const { return ENTINDEX(m_pEdict); } // only 1 stored
private:
	edict_t *m_pEdict;
	bool m_bReliable;
};
anyone found anything?
  
Reply With Quote
Re: draw beam
Old
  (#2)
sfx1999
Member
 
sfx1999's Avatar
 
Status: Offline
Posts: 534
Join Date: Jan 2004
Location: Pittsburgh, PA, USA
Default Re: draw beam - 01-01-2005

Isn't there a beam entity?


sfx1999.postcount++
  
Reply With Quote
Re: draw beam
Old
  (#3)
Cheeseh
[rcbot]
 
Cheeseh's Avatar
 
Status: Offline
Posts: 361
Join Date: Dec 2003
Location: China
Default Re: draw beam - 02-01-2005

aye but remember that this is a plugin, no access to lots of stuff, and when you try to include the beam code you get hundreds of errors and external errors because a lot of the stuff is non plugin related.
  
Reply With Quote
Re: draw beam
Old
  (#4)
botman
Super Moderator
 
Status: Offline
Posts: 280
Join Date: Jan 2004
Location: Plano, TX
Default Re: draw beam - 02-01-2005

You might want to consider using NDebugOverlay stuff instead of beams. NDebugOverlay includes...
Code:
 void Box(const Vector &origin, const Vector &mins, const Vector &maxs, int r, int g, int b, int a, float flDuration);
 void BoxDirection(const Vector &origin, const Vector &mins, const Vector &maxs, const Vector &forward, int r, int g, int b, int a, float flDuration);
 void BoxAngles(const Vector &origin, const Vector &mins, const Vector &maxs, const QAngle &angles, int r, int g, int b, int a, float flDuration);
 void SweptBox(const Vector& start, const Vector& end, const Vector& mins, const Vector& maxs, const QAngle & angles, int r, int g, int b, int a, float flDuration);
 void EntityBounds( const CBaseEntity *pEntity, int r, int g, int b, int a, float flDuration );
 void Line( const Vector &origin, const Vector &target, int r, int g, int b, bool noDepthTest, float flDuration );
 void Triangle( const Vector &p1, const Vector &p2, const Vector &p3, int r, int g, int b, int a, bool noDepthTest, float duration );
 void EntityText( int entityID, int text_offset, const char *text, float flDuration, int r = 255, int g = 255, int b = 255, int a = 255);
 void Grid( const Vector &vPosition );
 void Text( const Vector &origin, const char *text, bool bViewCheck, float flDuration );
 void ScreenText( float fXpos, float fYpos, const char *text, int r, int g, int b, int a, float flDuration);
 void Cross3D(const Vector &position, const Vector &mins, const Vector &maxs, int r, int g, int b, bool noDepthTest, float flDuration );
 void Cross3D(const Vector &position, float size, int r, int g, int b, bool noDepthTest, float flDuration );
 void Cross3DOriented( const Vector &position, const QAngle &angles, float size, int r, int g, int b, bool noDepthTest, float flDuration );
 void Cross3DOriented( const matrix3x4_t &m, float size, int c, bool noDepthTest, float flDuration );
 void DrawOverlayLines(void);
 void DrawTickMarkedLine(const Vector &startPos, const Vector &endPos, float tickDist, int tickTextDist, int r, int g, int b, bool noDepthTest, float flDuration );
 void DrawGroundCrossHairOverlay();
 void HorzArrow( const Vector &startPos, const Vector &endPos, float width, int r, int g, int b, int a, bool noDepthTest, float flDuration);
 void YawArrow( const Vector &startPos, float yaw, float length, float width, int r, int g, int b, int a, bool noDepthTest, float flDuration);
 void VertArrow( const Vector &startPos, const Vector &endPos, float width, int r, int g, int b, int a, bool noDepthTest, float flDuration);
See src\dlls\ndebugoverlay.cpp for details.

I'm not sure if/how NDebugOverlay would work from a plugin, but it seems like a much better system for drawing "debug" lines/boxes/text/etc in the game.

botman
  
Reply With Quote
Re: draw beam
Old
  (#5)
Cheeseh
[rcbot]
 
Cheeseh's Avatar
 
Status: Offline
Posts: 361
Join Date: Dec 2003
Location: China
Default Re: draw beam - 02-01-2005

thanks, yeah I've had a small look at that. There is a small thing though, there was a comment saying that is won't work on HL dedicated server (The interface would be NULL), meaning that clients wanting to make waypoints on a dedicated server might not be able to. I'll have a go at it anyway for now.

edit:

Actually I think the DebugOverlay stuff will ever only work for the local client, there is no input as to what player this should be sent to, even in the Line function it just picks the local player and works with it to determine what the local player can see to clip lines, but is not passed to the engine debugoverlay functions.

Last edited by Cheeseh; 02-01-2005 at 00:37..
  
Reply With Quote
Re: draw beam
Old
  (#6)
sfx1999
Member
 
sfx1999's Avatar
 
Status: Offline
Posts: 534
Join Date: Jan 2004
Location: Pittsburgh, PA, USA
Default Re: draw beam - 02-01-2005

Is there a network message you can send to trigger a beam on the client?


sfx1999.postcount++
  
Reply With Quote
Re: draw beam
Old
  (#7)
Cheeseh
[rcbot]
 
Cheeseh's Avatar
 
Status: Offline
Posts: 361
Join Date: Dec 2003
Location: China
Default Re: draw beam - 02-01-2005

The only thing I know is I need to fire a TempEntity net message, with TE_BEAMPOINTS. But that needs access to a ServerClass() what ever that is, which means you really need the TE_BeamPoints class, but again when you try to include that it's a pian because it includes lots of non plugin stuff.
  
Reply With Quote
Re: draw beam
Old
  (#8)
Cheeseh
[rcbot]
 
Cheeseh's Avatar
 
Status: Offline
Posts: 361
Join Date: Dec 2003
Location: China
Default Re: draw beam - 02-01-2005

Actually I think I#ve got it, I think you've got to get the Server Effects Interface :

IEffects *g_pEffects = NULL;

..

g_pEffects = (IEffects* )interfaceFactory(IEFFECTS_INTERFACE_VERSION,NULL) ;

...

g_pEffects->Beam(..,..);

Haven't tried it yet though but it compiles okay

Edit:

Arrrrgh.. Okay the interfaceFactory returns NULL.. :@

Last edited by Cheeseh; 02-01-2005 at 13:38..
  
Reply With Quote
Re: draw beam
Old
  (#9)
Jerry
Member
 
Jerry's Avatar
 
Status: Offline
Posts: 10
Join Date: Dec 2004
Location: Woerden, The Netherlands
Default Re: draw beam - 02-01-2005

Quote:
Originally Posted by Cheeseh
Actually I think I#ve got it, I think you've got to get the Server Effects Interface :

IEffects *g_pEffects = NULL;

..

g_pEffects = (IEffects* )interfaceFactory(IEFFECTS_INTERFACE_VERSION,NULL) ;

...

g_pEffects->Beam(..,..);

Haven't tried it yet though but it compiles okay

Edit:

Arrrrgh.. Okay the interfaceFactory returns NULL.. :@
Don't use interfaceFactory.
Use this instead:

Code:
 effects = (IEffects*)gameServerFactory(IEFFECTS_INTERFACE_VERSION, NULL);


Imagination is more important than knowledge. Knowledge is limited - Albert Einstein
  
Reply With Quote
Re: draw beam
Old
  (#10)
Cheeseh
[rcbot]
 
Cheeseh's Avatar
 
Status: Offline
Posts: 361
Join Date: Dec 2003
Location: China
Default Re: draw beam - 02-01-2005

Thanks!
  
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump



Powered by vBulletin® Version 3.8.2
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
vBulletin Skin developed by: vBStyles.com