Line action/special across different map formats

Ask about ACS, DECORATE, ZScript, or any other scripting questions here!

Moderator: GZDoom Developers

Forum rules
Before asking on how to use a ZDoom feature, read the ZDoom wiki first. If you still don't understand how to use a feature, then ask here.

Please bear in mind that the people helping you do not automatically know how much you know. You may be asked to upload your project file to look at. Don't be afraid to ask questions about what things mean, but also please be patient with the people trying to help you. (And helpers, please be patient with the person you're trying to help!)
Post Reply
User avatar
Apeirogon
Posts: 1606
Joined: Mon Jun 12, 2017 12:57 am

Line action/special across different map formats

Post by Apeirogon »

After some checks I turns out that gzdoom dont convert line special from doom/hexeretic/boom/etc. formats to specials defined here
https://zdoom.org/wiki/Action_specials

For example, my script which check line for doors special number, and expect that door would have action numbers 10, 11, 12, 13 and 14, simply dont work with doors from map01 because they uses
special 1 DR door open wait close(also monsters)
special 31 D1 door open stay
with no additional arguments provided. This is confuses my script and it return, after checking lines with such special, something like "this is impassable blank wall, cant do anything with it"

There are "native readonly int maptype;" variable in levellocals struct
https://github.com/coelckers/gzdoom/blo ... se.zs#L688
but looks like it uses internal enums for it
https://github.com/coelckers/gzdoom/blo ... nfo.h#L269
so technically I can use it to determine what map type loaded right now.

Question is, is that okay?
Did I understand correct and there are no more convenient way to do so? I mean, I must define doors line special definition for doom/hexeretic/boom/etc. in order to use it for checks "is this door"?
User avatar
Graf Zahl
Lead GZDoom+Raze Developer
Lead GZDoom+Raze Developer
Posts: 49237
Joined: Sat Jul 19, 2003 10:19 am
Location: Germany

Re: Line action/special across different map formats

Post by Graf Zahl »

Since you did not post any code, I cannot say. The Doom format specials are one of the first thing to be converted when a map gets loaded. The main engine knows nothing about them.
User avatar
Kappes Buur
 
 
Posts: 4184
Joined: Thu Jul 17, 2003 12:19 am
Graphics Processor: nVidia (Legacy GZDoom)
Location: British Columbia, Canada
Contact:

Re: Line action/special across different map formats

Post by Kappes Buur »

Are you trying to convert a map from DOOM in DOOM format to DOOM in Hexen format
and then keep working on it?

If so, then you have to use zwadconv.exe first.
User avatar
Apeirogon
Posts: 1606
Joined: Mon Jun 12, 2017 12:57 am

Re: Line action/special across different map formats

Post by Apeirogon »

Code out of context, but looks like I forced it to work...or at least do something, since it now correctly recognizes doors/lifts

Code: Select all

    //if ceiling/floor of one sector higher/lower than floor/ceiling of other sector 
    if(self_floor >= other_ceiling || other_floor >= self_ceiling || other_floor >= other_ceiling || other_ceiling <= other_floor)
    {
        //still need check is there are any special on line between this sectors
        if(boundary_lines[internal_sector_number].special > 0)
        {
            //doom line special maptype too primitive and it automatically apply to line backsector
            //so make assumption it is correct special true here
            if(level.maptype == MAPTYPE_DOOM)
            {
                movable_sector = true;
            }
            
            //hexen more complicated and it use line args[0]
            //which define sector tag which are activates by this
            //unfortunately it uses tags even if activating sector located on the line backside
            else if(level.maptype == MAPTYPE_HEXEN)
            {
                if(boundary_lines[internal_sector_number].args[0] > 0)
                {
                    //so try find this sector activation line in precomputed array of "line which activate sector(s) by its tag"
                    if(path_algorithm(all_graph_list).sector_to_line_special(node_base(representation).get_sector(), true )  != null)
                    {
                        //so assumption was correct
                        movable_sector = true;
                    }

                    //else, its acs/zscript script which do so
                    else
                        return false;
                }
            }
            
            //in udmf usually "args[0] > 0" means sector tag
            //also, args[1] must be greater than zero, because it usually define sector speed
            else if(level.maptype == MAPTYPE_UDMF)
            {
                //args[0] means activate backside sector
                if(boundary_lines[internal_sector_number].args[0] == 0 && boundary_lines[internal_sector_number].args[1] > 0)
                {
                    movable_sector = true;
                }
                
                else if(boundary_lines[internal_sector_number].args[0] > 0 && boundary_lines[internal_sector_number].args[1] > 0)
                {
                    //so try find this sector activation line in precomputed array of "line which activate sector(s) by its tag"
                    if(path_algorithm(all_graph_list).sector_to_line_special(node_base(representation).get_sector(), true )  != null)
                    {
                        //sector change height by some line
                        //it just point here that this is possible
                        //without explictly definig what exactly line, what activation type, etc
                        movable_sector = true;
                    }

                    //else, its acs/zscript script which do so
                    else
                        return false;
                }
            }
        }

        //probably sector have some specific activation logic like a_bossdeath
        else
            return false;
    }

Are you trying to convert a map from DOOM in DOOM format to DOOM in Hexen format
No, I want read map data after loading and then use it to do something.
Post Reply

Return to “Scripting”