Raised This Month: $51 Target: $400
 12% 

HL (UTIL.h) functions in module?


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Jinto
Member
Join Date: Jun 2004
Location: Seattle, WA
Old 08-01-2004 , 15:55   HL (UTIL.h) functions in module?
Reply With Quote #1

I want to use UTIL_DecalTrace in my module but can't seem to figure out how to get it working.. I might have to just rewrite the function as a helper function in the module?

Its a pretty simple function.. Just wondering if there is a way I can use it without rewriting it.

Code:
void UTIL_DecalTrace( TraceResult *pTrace, int decalNumber );
Jinto is offline
Send a message via ICQ to Jinto Send a message via AIM to Jinto Send a message via MSN to Jinto Send a message via Yahoo to Jinto
Twilight Suzuka
bad
Join Date: Jul 2004
Location: CS lab
Old 08-23-2004 , 00:51  
Reply With Quote #2

Why wont it work?
__________________
Twilight Suzuka is offline
Send a message via AIM to Twilight Suzuka Send a message via MSN to Twilight Suzuka
Freecode
Never Fall Asleep
Join Date: Jan 2004
Old 08-28-2004 , 07:45  
Reply With Quote #3

whats this do?
Freecode is offline
mahnsawce
Senior Member
Join Date: Apr 2004
Location: internet
Old 08-28-2004 , 08:51  
Reply With Quote #4

That's just a declaration of the function. You would need to include the actual function in your module source somewhere. It's in multiplayer/dlls/util.cpp in the HLSDK source. But note that the default UTIL_DecalTrace uses CBaseEntities, unless you use those in your module you may want to consider converting it to use edicts instead.
mahnsawce is offline
Jinto
Member
Join Date: Jun 2004
Location: Seattle, WA
Old 09-09-2004 , 22:33  
Reply With Quote #5

Yes I know its just the declaration.. And I do have it included..
It crashes I presume cause I can't find the proper decal ID's

I Stuck the decal list in but it just crashes no matter what decal I use.
Jinto is offline
Send a message via ICQ to Jinto Send a message via AIM to Jinto Send a message via MSN to Jinto Send a message via Yahoo to Jinto
mahnsawce
Senior Member
Join Date: Apr 2004
Location: internet
Old 09-09-2004 , 23:09  
Reply With Quote #6

This could be a couple reasons...

My initial guesses are:

1. CBaseEntities are used in the standard decaltrace. CBaseEntities are generally bad when you're dealing with a metamod (or module).

2. You're passing an invalid decal index.

I use decals in a module I'm working on, but I modified the function a bit.

Here's what I use:

Code:
void UTIL_DecalTrace( TraceResult *pTrace, const char *decalName )
{
	short entityIndex;
	int index;
	int message;
	index = DECAL_INDEX(decalName);
	if ( index < 0 )
		return;

	if (pTrace->flFraction == 1.0)
		return;

	// Only decal BSP models
	if ( pTrace->pHit )
	{
		if (!(pTrace->pHit->v.solid == SOLID_BSP || pTrace->pHit->v.movetype == MOVETYPE_PUSHSTEP))
			return;
		entityIndex = ENTINDEX( pTrace->pHit );
	}
	else 
		entityIndex = 0;

	message = TE_DECAL;
	if ( entityIndex != 0 )
	{
		if ( index > 255 )
		{
			message = TE_DECALHIGH;
			index -= 256;
		}
	}
	else
	{
		message = TE_WORLDDECAL;
		if ( index > 255 )
		{
			message = TE_WORLDDECALHIGH;
			index -= 256;
		}
	}
	
	MESSAGE_BEGIN( MSG_BROADCAST, SVC_TEMPENTITY );
		WRITE_BYTE( message );
		WRITE_COORD( pTrace->vecEndPos.x );
		WRITE_COORD( pTrace->vecEndPos.y );
		WRITE_COORD( pTrace->vecEndPos.z );
		WRITE_BYTE( index );
		if ( entityIndex )
			WRITE_SHORT( entityIndex );
	MESSAGE_END();
}
You need to declare this version too (unless you modify it to use decal indexes rather than names), then just call something like `UTIL_DecalTrace(&tr,"{blood1")`.
mahnsawce is offline
Jinto
Member
Join Date: Jun 2004
Location: Seattle, WA
Old 09-10-2004 , 21:45  
Reply With Quote #7

YAY it works... Now I can finish... Thanks..
Jinto is offline
Send a message via ICQ to Jinto Send a message via AIM to Jinto Send a message via MSN to Jinto Send a message via Yahoo to Jinto
Da Bishop
Senior Member
Join Date: Aug 2004
Location: Chester County PA
Old 09-12-2004 , 09:44  
Reply With Quote #8

mahnsawce is just too smart for us
Da Bishop is offline
Send a message via MSN to Da Bishop
Reply



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


All times are GMT -4. The time now is 02:51.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode