GetActorFloorTexture()

Moderator: GZDoom Developers

Post Reply
User avatar
Fused
Posts: 72
Joined: Wed Jul 02, 2014 2:44 pm
Contact:

GetActorFloorTexture()

Post by Fused »

Like CheckActorFloorTexture(), but instead directly retreives the floor you stand on instead of having to compare with a texture as argument.
Most useful for for example the footstep addon (http://forum.zdoom.org/viewtopic.php?f=37&t=35388), which will save a major amount of time because you wont need to make the array.
For example you could directly retreive the LANGUAGE equivelant from the retreived texture with the result instead of having to skip through the massive array.
User avatar
NeuralStunner
 
 
Posts: 12326
Joined: Tue Jul 21, 2009 12:04 pm
Preferred Pronouns: He/Him
Graphics Processor: nVidia with Vulkan support
Location: capital N, capital S, no space
Contact:

Re: GetActorFloorTexture()

Post by NeuralStunner »

This would also be a single function call instead of potentially hundreds to check against every possibility. (I imagine string comparisons are much less costly.)

You could also use functions like [wiki]StrLeft[/wiki] to get partial matches (E.G. LAVA*), which would be very helpful for animation sequences.
User avatar
Graf Zahl
Lead GZDoom+Raze Developer
Lead GZDoom+Raze Developer
Posts: 49067
Joined: Sat Jul 19, 2003 10:19 am
Location: Germany

Re: GetActorFloorTexture()

Post by Graf Zahl »

No problem, but the footstep thing is a great example how NOT to do it. For that a GetActorFloorTerrain function would make much more sense because you can make the relevant assignments outside the script, and more importantly, since you can override a texture's terrain in UDMF, take that override also into account.
User avatar
Shadow Hog
Posts: 173
Joined: Fri Aug 14, 2015 8:56 pm

Re: GetActorFloorTexture()

Post by Shadow Hog »

Honestly, I would like some way to quickly poll for the TERRAIN type of a given texture, yeah. Maybe (maybe) extend that to walls, in case I wanted different sounds for swinging a sword against different wall materials, or similar (although in the grand scheme of things, if I could only pick one, getting the floor's TERRAIN type would be more desirable).
User avatar
Fused
Posts: 72
Joined: Wed Jul 02, 2014 2:44 pm
Contact:

Re: GetActorFloorTexture()

Post by Fused »

Graf Zahl wrote:No problem, but the footstep thing is a great example how NOT to do it. For that a GetActorFloorTerrain function would make much more sense because you can make the relevant assignments outside the script, and more importantly, since you can override a texture's terrain in UDMF, take that override also into account.
That works too, I was thinking something about this:

Code: Select all

...
	ActivatorSound(GetFloorSound(), 255);
...


// str probably wont even work but this is a rough example anyway
Function str GetFloorSound (void)
{
	str FloorSoundDef = StrParam(s:"STEP_", s:GetActorFloorTexture());
	str FloorSound = StrParam(l:FloorSoundDef);

	// FloorSound should NOT be identical when the LANGUAGE lump had something defined.
	if (FloorSoundDef == FloorSound)
		FloorSound = StrParam(l:"STEP_DEFAULT");

	RETURN FloorSound;
}
Of course, whatever works is fine by me.
User avatar
Fused
Posts: 72
Joined: Wed Jul 02, 2014 2:44 pm
Contact:

Re: GetActorFloorTexture()

Post by Fused »

Hate to bump, but how is this coming along? I'm fine with either being implemented, as long as it saves the hassle of having to define every single texture.
User avatar
Graf Zahl
Lead GZDoom+Raze Developer
Lead GZDoom+Raze Developer
Posts: 49067
Joined: Sat Jul 19, 2003 10:19 am
Location: Germany

Re: GetActorFloorTexture()

Post by Graf Zahl »

Added both. They will return the name of the requested info as a string, or "" if no matching actor could be found.
User avatar
Nash
 
 
Posts: 17439
Joined: Mon Oct 27, 2003 12:07 am
Location: Kuala Lumpur, Malaysia
Contact:

Re: GetActorFloorTexture()

Post by Nash »

1) What about GetActorCeilingTexture?

2) Are these 3D floor friendly?

3) ZScript variants?
User avatar
Graf Zahl
Lead GZDoom+Raze Developer
Lead GZDoom+Raze Developer
Posts: 49067
Joined: Sat Jul 19, 2003 10:19 am
Location: Germany

Re: GetActorFloorTexture()

Post by Graf Zahl »

1) could be added but has far less use.
2) Yes.
3) These only read existing fields from the actor object ('actor.floorpic' and 'actor.floorterrain') and return their string representation, so they are readily accessible.
Post Reply

Return to “Closed Feature Suggestions [GZDoom]”