I need a Function similar to the GetActorCeilingZ

Discuss all aspects related to modding Zandronum here.
Post Reply
User avatar
ibm5155
Addicted to Zandronum
Posts: 1641
Joined: Tue Jun 05, 2012 9:32 pm
Location: Somewhere, over the rainbow

I need a Function similar to the GetActorCeilingZ

#1

Post by ibm5155 » Mon May 27, 2013 10:19 pm

GetActorCeilingZ does this:"return The lowest ceiling point above the actor, as a fixed point value world coordinate".

But I need the highest D: (Or it´ll rain from the 3D floors lol)

Any Idea how could I get the highest ceiling point?
Projects
Cursed Maze: DONE, V2.0
Zombie Horde - ZM09 map update: [3/15/13]
Need help with English? Then you've come to the right place!

<this post is proof of "Decline">

Ijon Tichy
Frequent Poster Miles card holder
Posts: 901
Joined: Mon Jun 04, 2012 5:07 am

RE: I need a Function similar to the GetActorCeilingZ

#2

Post by Ijon Tichy » Mon May 27, 2013 10:40 pm

try this

Code: Select all

function int unusedTID(int start, int end)
{
    int ret = start - 1;
    int tidNum;

    if (start > end) { start ^= end; end ^= start; start ^= end; }  // good ol' XOR swap
    
    while (ret++ != end)
    {   
        if (ThingCount(0, ret) == 0)
        {   
            return ret;
        }   
    }   
    
    return -1; 
}

function int GetHighestCeilingZ(int tid)
{
    int x = GetActorZ(tid), y = GetActorY(tid);
    int lastheight, curheight = GetActorCeilingZ(tid);
    int newtid = unusedTID(14000, 24000);
    int success, ret;
    int i;

    while (1) 
    {
        lastheight = curheight;
    
        for (i = 0; i < 16; i++)
        {   
            success = Spawn("HeightIndicator", x, y, curheight + (i<<16), newtid);
            if (success) { break; }
        }   

        if (!success) { ret = curheight; break; }

        curheight = GetActorCeilingZ(newtid);

        if (lastheight == curheight) { ret = curheight; break; }

        Thing_Remove(newtid);
    }   

    Thing_Remove(newtid);
    return ret;
}
with this in your DECORATE:

Code: Select all

actor HeightIndicator
{
    +NOINTERACTION
    Radius 0
    Height 0
}
Last edited by Ijon Tichy on Mon May 27, 2013 10:40 pm, edited 1 time in total.

User avatar
ibm5155
Addicted to Zandronum
Posts: 1641
Joined: Tue Jun 05, 2012 9:32 pm
Location: Somewhere, over the rainbow

RE: I need a Function similar to the GetActorCeilingZ

#3

Post by ibm5155 » Mon May 27, 2013 10:52 pm

O_O wow thanks
you did it now from zero?

and "^=" I never saw this term in ansi c, it´s a special thing from acs? :s
Ijon Tichy, the god of acs D:
Projects
Cursed Maze: DONE, V2.0
Zombie Horde - ZM09 map update: [3/15/13]
Need help with English? Then you've come to the right place!

<this post is proof of "Decline">

User avatar
ibm5155
Addicted to Zandronum
Posts: 1641
Joined: Tue Jun 05, 2012 9:32 pm
Location: Somewhere, over the rainbow

RE: I need a Function similar to the GetActorCeilingZ

#4

Post by ibm5155 » Tue May 28, 2013 1:08 am

Double:
I´m trying another method, since I discovered when you pass the higher ceiling the result on getactorceiling ´ll be zero, so, my idea was to do a function that summon map spots until he hit the 0, and then use the latest valid result and use it :D

Code: Select all

function int GetHigherCeiling(int tid2) {
    
    int posx=getactorx(tid2);
    int posy=getactory(tid2);
    int posz=GetActorCeilingZ(tid2);//504
    int z=posz;
    int test=0;
    int tid=unusedTID(1000, 2000);
    print(s:"inicio:",f:posz);//800
    do{
        z=z+25.0;//850.0
        spawn("mapspot",posx,posy,z,tid,0);
        print(s:"inicio:",f:GetActorCeilingZ(tid));//0
        thing_remove(tid);
        test++;
    }while(GetActorCeilingZ(tid)!=0);//0
        spawn("mapspot",posx,posy,z-27.0,tid,0);
        print(s:"loop:", d:test,s:"final:",f:GetActorCeilingZ(tid));
        z=GetActorCeilingZ(tid);
        thing_remove(tid);
    return z;
}
The good part, it works for 3d floors this way, the bad part, it doesn´t work with sectors with no 3d floors ¬¬ (I may be doing some mistake)
Projects
Cursed Maze: DONE, V2.0
Zombie Horde - ZM09 map update: [3/15/13]
Need help with English? Then you've come to the right place!

<this post is proof of "Decline">

Lollipop
Zandrone
Posts: 1124
Joined: Tue Jul 24, 2012 10:34 am
Location: Denmark

RE: I need a Function similar to the GetActorCeilingZ

#5

Post by Lollipop » Tue May 28, 2013 1:59 pm

maybe you somewhere ignore the first ceiling detected from below?..... this stuff is too complicated for me to follow completely, but it sounds a bit obvious to me :S

EDIT: try a sector with 2 3D floors, just to test it
Last edited by Lollipop on Tue May 28, 2013 2:00 pm, edited 1 time in total.
Combinebobnt wrote:i can see the forum league is taking off much better than the ctf ones
GalactusToday at 1:07 PM
are you getting uncomfortable jap
feeling something happen down there

User avatar
ibm5155
Addicted to Zandronum
Posts: 1641
Joined: Tue Jun 05, 2012 9:32 pm
Location: Somewhere, over the rainbow

RE: I need a Function similar to the GetActorCeilingZ

#6

Post by ibm5155 » Tue May 28, 2013 6:36 pm

Tested and didn´t worked '-'
My latest code was working with one 3d floor lol
And I found another problem, it doesn´t rain on place upper the player D:
Projects
Cursed Maze: DONE, V2.0
Zombie Horde - ZM09 map update: [3/15/13]
Need help with English? Then you've come to the right place!

<this post is proof of "Decline">

Lollipop
Zandrone
Posts: 1124
Joined: Tue Jul 24, 2012 10:34 am
Location: Denmark

RE: I need a Function similar to the GetActorCeilingZ

#7

Post by Lollipop » Thu May 30, 2013 3:30 pm

I got new idea, if the rain isn't an actor, than make it... somehow
then make a script that makes the rain follow the forward/backward and sideways cordinates of the actor that it rains above.
make sure the rain actor is a ceilinghugger
test, test again, more testing, changes, testing, slap lolli, test again, tell me that it didn't work cuz I'm stupid.
done
Combinebobnt wrote:i can see the forum league is taking off much better than the ctf ones
GalactusToday at 1:07 PM
are you getting uncomfortable jap
feeling something happen down there

Post Reply