GetActorFloorTexture()
Moderator: GZDoom Developers
GetActorFloorTexture()
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.
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.
- 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()
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.
You could also use functions like [wiki]StrLeft[/wiki] to get partial matches (E.G. LAVA*), which would be very helpful for animation sequences.
- Graf Zahl
- Lead GZDoom+Raze Developer
- Posts: 49067
- Joined: Sat Jul 19, 2003 10:19 am
- Location: Germany
Re: GetActorFloorTexture()
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.
- Shadow Hog
- Posts: 173
- Joined: Fri Aug 14, 2015 8:56 pm
Re: GetActorFloorTexture()
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).
Re: GetActorFloorTexture()
That works too, I was thinking something about this: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.
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;
}
Re: GetActorFloorTexture()
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.
- Graf Zahl
- Lead GZDoom+Raze Developer
- Posts: 49067
- Joined: Sat Jul 19, 2003 10:19 am
- Location: Germany
Re: GetActorFloorTexture()
Added both. They will return the name of the requested info as a string, or "" if no matching actor could be found.
Re: GetActorFloorTexture()
1) What about GetActorCeilingTexture?
2) Are these 3D floor friendly?
3) ZScript variants?
2) Are these 3D floor friendly?
3) ZScript variants?
- Graf Zahl
- Lead GZDoom+Raze Developer
- Posts: 49067
- Joined: Sat Jul 19, 2003 10:19 am
- Location: Germany
Re: GetActorFloorTexture()
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.
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.