[ZScript] 3D Floor info

Moderator: GZDoom Developers

Post Reply
User avatar
Major Cooke
Posts: 8175
Joined: Sun Jan 28, 2007 3:55 pm
Preferred Pronouns: He/Him
Location: QZDoom Maintenance Team

[ZScript] 3D Floor info

Post by Major Cooke »

The struct F3DFloor could contain data like the floor/ceiling data such as the textures, the height of the floor + ceiling, along with a boolean to indicate if it really is a 3D floor or not.

Or is there another plan for this?
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: [ZScript] 3D Floor info

Post by Graf Zahl »

The main problem here is that F3DFloor is only referencing elements from the model sectors and ZScript is not particularly well equipped to work with such data.
User avatar
Major Cooke
Posts: 8175
Joined: Sun Jan 28, 2007 3:55 pm
Preferred Pronouns: He/Him
Location: QZDoom Maintenance Team

Re: [ZScript] 3D Floor info

Post by Major Cooke »

Hmmm, damn. Okay. I'll try and think of another way in the mean time.
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: [ZScript] 3D Floor info

Post by Graf Zahl »

What are you trying to do?
User avatar
Major Cooke
Posts: 8175
Joined: Sun Jan 28, 2007 3:55 pm
Preferred Pronouns: He/Him
Location: QZDoom Maintenance Team

Re: [ZScript] 3D Floor info

Post by Major Cooke »

Trying to clean up this mess.

It's a rain spawner so the idea behind this is to spawn rain above 3D floors, but not below it. And while I haven't yet implemented the code for it, to grab the 3D sector's floor texture should it be F_SKY1, should it be used in lieu of the actual ceiling.

(Ignore the failsafe stuff. That's just debug.)

Code: Select all

// Get the sector and get the ceiling texture. If it's the sky,
// start doing calculations. This should probably also consider
// if 3D ceilings have sky textures...
Sector s = Sector.PointInSector(check);

if (s)
{
    if (TexMan.GetName(s.GetTexture(s.ceiling)) ~== "F_SKY1")
    {
        double F3DHighestFloor, F3DLowestCeiling, Highest, Lowest;
        
        Highest = s.HighestCeilingAt(check);
        Lowest = s.LowestFloorAt(check);
        F3DHighestFloor = s.NextLowestFloorAt(check.x, check.y, Highest);
        F3DLowestCeiling = s.NextHighestCeilingAt(check.x, check.y, pos.z, Highest);
        // If there is no 3D floor between the player and the sky
        // Or the 3D ceiling is not high enough to block rain
        //    and the 3D floor is lower than the player's position 
        //        spawn the rain drop.
        if ((Highest <= F3DLowestCeiling) ||
            ((Highest > F3DLowestCeiling) &&
            (F3DHighestFloor <= pos.z + SpawnZ)))
        {
            double DropZ = Clamp(pos.z + SpawnZ, Lowest + 4, Highest - 4);
            Vector3 DropPos = (check.x, check.y, DropZ);
            Actor drop = Spawn("RainDrop", DropPos);
            if (drop)    
            {
                drop.vel.z = -30.0;
                failsafe = FailSafeStart;
            }
            else
            {
                failsafe--;
                i--;
            }
        }
        else
        {
            failsafe--;
            i--;
        }
    }
}
Or at least some function to return if a 3D sector is even in the XY position + Z range, the Z coordinates of the ceiling and floor along with the textures of both... or something similar.
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: [ZScript] 3D Floor info

Post by Graf Zahl »

F_SKY on 3D floors should be ignored as its behavior is very much undefined and will cause massive glitches.
User avatar
Major Cooke
Posts: 8175
Joined: Sun Jan 28, 2007 3:55 pm
Preferred Pronouns: He/Him
Location: QZDoom Maintenance Team

Re: [ZScript] 3D Floor info

Post by Major Cooke »

Right then, I'll toss out that part of the idea.

Still, something to ease getting the 3D floor between a certain range and returning both the floor and ceiling height would be fantastic.
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: [ZScript] 3D Floor info

Post by Graf Zahl »

I agree that needs to be accessible, but it will require a bit of an effort because the internal structure is not usable directly.
Post Reply

Return to “Closed Feature Suggestions [GZDoom]”