.:: 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 > General Bot Coding
General Bot Coding See what a pain it is to get those little mechs shooting around

Reply
 
Thread Tools
TRACE_TEXTURE weirdnesses
Old
  (#1)
two_masks
Guest
 
Status:
Posts: n/a
Default TRACE_TEXTURE weirdnesses - 05-05-2004

Got another one for you all:

I'm using TRACE_TEXTURE to determine the texture a player is standing on (for hearing purposes, as covered in a thread from last week). However, it seems to be doing strange things to the stack: depending on how much code follows it, my return values get all messed up. I'm guessing it's a stack corruption because adding a LOG_CONSOLE to track my return value "fixed" the problem, that is, until I added some more code, at which point it went haywire again. Has anybody every experienced this before?

Here's a snippet of my code where the actual call happens:

Code:
 
 	float rgfl1[3];
 	float rgfl2[3];
 
 	const char * pTextureName;
 		    
 	v_source = pPlayer->v.origin;
 	v_dest = pPlayer->v.origin;
 	v_dest.z = v_dest.z - 1000;
 
 	pPlayer->v.origin.CopyToArray(rgfl1);
 	v_dest.CopyToArray(rgfl2);
 
 	pTextureName = TRACE_TEXTURE( ENT(0), rgfl1, rgfl2 );
Any thoughts?

-JB
  
Reply With Quote
Re: TRACE_TEXTURE weirdnesses
Old
  (#2)
botman
Super Moderator
 
Status: Offline
Posts: 280
Join Date: Jan 2004
Location: Plano, TX
Default Re: TRACE_TEXTURE weirdnesses - 05-05-2004

What are you doing with pTextureName in the rest of that function?

You're not trying to return pTextureName back from the function are you? That would cause problems because pTextureName is a local variable on the stack frame of that function.

botman
  
Reply With Quote
Re: TRACE_TEXTURE weirdnesses
Old
  (#3)
two_masks
Guest
 
Status:
Posts: n/a
Default Re: TRACE_TEXTURE weirdnesses - 05-05-2004

Nope, not returning any local variables, I'm just comparing the texture name to a few known textures that I want to cause sound when walked upon.

Any other thoughts? Have you all used TRACE_TEXTURE successfully?

-JB
  
Reply With Quote
Re: TRACE_TEXTURE weirdnesses
Old
  (#4)
Pierre-Marie Baty
Roi de France
 
Pierre-Marie Baty's Avatar
 
Status: Offline
Posts: 5,049
Join Date: Nov 2003
Location: 46°43'60N 0°43'0W 0.187A
Default Re: TRACE_TEXTURE weirdnesses - 06-05-2004

To check what sort of footstep sound belongs to a texture, call the PM_FindTextureType() function in the Game DLL interface. Any MOD code should feature this function. You feed it with the texture name char pointer, and it will return the character describing what type of material it is, according to what's specified in your materials.txt file.

Here's what I am doing:
Code:
		 // ask the engine for the texture name on pGroundEntity under the player's feet
		 texture_name = TRACE_TEXTURE (pGroundEntity, pPlayer->v_origin, Vector (0, 0, -9999));
		 // if the engine found the texture, ask the game DLL for the texture type
		 if (texture_name != NULL)
			texture_type = MDLL_PM_FindTextureType ((char *) texture_name); // ask for texture type
The MDLL_ prefix before PM_FindTextureType is metamod's syntax. If you don't use metamod, don't use the MDLL_ macros and directly call PM_FindTextureType.



RACC home - Bots-United: beer, babies & bots (especially the latter)
"Learn to think by yourself, else others will do it for you."
  
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