Confused by XLAT Linedef flags - which HEX is SPAC_PCROSS?

Ask about ACS, DECORATE, ZScript, or any other scripting questions here!
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!)
User avatar
crowbars82
Posts: 40
Joined: Sun Nov 05, 2017 6:22 pm

Confused by XLAT Linedef flags - which HEX is SPAC_PCROSS?

Post by crowbars82 »

Hi all!

This is a monster posting but I have tried to be as detailed as I can because of the technical nature of the problem.

If anyone has had experience with editing their own XLAT translation files, please help to confirm if I am on the right track for solving this problem.


Background to problem

Whilst modding Oblige level maker, I have been able to get the generator to write the linedef flag:

Code: Select all

ML_BLOCKS_ALL  = 32768
This successfully sets the correct linedef flag when I define 'blockseverything=true' in the prefabs.

Code: Select all

    a = { 
        f_rel="floor_h", f_h=8, f_tex="grates_f", 
        c_rel="floor_h", c_h=120, c_tex="grates_c", 
            [4] = { kind = "kind", tag="tag", rail="rail_w",
                    l_peg="bottom", impassible=true, blockseverything=true,
                },
        },

Code: Select all

if blockseverything then flags = flags + ML_BLOCKS_ALL end
I can then load up the generated map in Slade and see that this has worked.

Image


The problem with XLAT

So next to allow this to be recognised using GZDoom I have found I needed to add this linedef flag to the Doom.txt found within the gzdoom\xlat folder.

Code: Select all

lineflag 0 = ML_BLOCKING;
lineflag 1 = ML_BLOCKMONSTERS;
lineflag 2 = ML_TWOSIDED;
lineflag 3 = ML_DONTPEGTOP;
lineflag 4 = ML_DONTPEGBOTTOM;
lineflag 5 = ML_SECRET;
lineflag 6 = ML_SOUNDBLOCK;
lineflag 7 = ML_DONTDRAW;
lineflag 8 = ML_MAPPED;
lineflag 9 = ML_PASSTHROUGH;
lineflag 10 = ML_3DMIDTEX;
lineflag 11 & (ML_BLOCKING|ML_BLOCKMONSTERS|ML_TWOSIDED|ML_DONTPEGTOP|ML_DONTPEGBOTTOM|ML_SECRET|ML_SOUNDBLOCK|ML_DONTDRAW|ML_MAPPED);
lineflag 15 = ML_BLOCKEVERYTHING;      <---- I added this line and now GZDoom understands to allow this flag to block everything
This is where it gets tricky...

By looking at the linedef flags sections on this page I can see there is a problem when wanting to add:

Code: Select all

10-12	0x1400	activated when crossed by projectile
because bit 10-12 seem to use various different flags.

I can see that I want to use 0x1400 for "activated when crossed by projectile" however when I add this to the defines.i file found in the gzdoom\xlat folder, it doesn't work as it did with ML_BLOCKEVERYTHING.

Code: Select all

enum
{
	ML_BLOCKING					= 0x00000001,
	ML_BLOCKMONSTERS			= 0x00000002,
	ML_TWOSIDED					= 0x00000004,
	ML_DONTPEGTOP				= 0x00000008,
	ML_DONTPEGBOTTOM			= 0x00000010,
	ML_SECRET					= 0x00000020,
	ML_SOUNDBLOCK				= 0x00000040,
	ML_DONTDRAW 				= 0x00000080,
	ML_MAPPED					= 0x00000100,
	SPAC_PCROSS                 = 0x00001400,    <--- I tried added this line here so I am able to reference it in Doom.txt

	// Extended flags
	ML_MONSTERSCANACTIVATE		= 0x00002000,
	ML_BLOCK_PLAYERS			= 0x00004000,
	ML_BLOCKEVERYTHING			= 0x00008000,    <--- this line already exists, which I used to reference within Doom.txt
	ML_ZONEBOUNDARY				= 0x00010000,
	ML_RAILING					= 0x00020000,
	ML_BLOCK_FLOATERS			= 0x00040000,
	ML_CLIP_MIDTEX				= 0x00080000,
	ML_WRAP_MIDTEX				= 0x00100000,
	ML_3DMIDTEX					= 0x00200000,
	ML_CHECKSWITCHRANGE			= 0x00400000,
	ML_FIRSTSIDEONLY			= 0x00800000,
	ML_BLOCKPROJECTILE			= 0x01000000,
	ML_BLOCKUSE					= 0x02000000,
	
	// 
	ML_PASSTHROUGH				= -1,
	ML_TRANSLUCENT				= -2,
	ML_TRANSPARENT				= -3
}
The problem is that when now trying to use SPAC_PCROSS I don't know which bit to assign it to because bits 10-12 use different flags, so if I wanted to set "0x0C00 - activated when hit by projectile" AND "0x1400 - activated when crossed by projectile" they would need to be assigned to bit 10 or 11 or 12 but I am unable to determine how to do this correctly.

Code: Select all

lineflag 0 = ML_BLOCKING;
lineflag 1 = ML_BLOCKMONSTERS;
lineflag 2 = ML_TWOSIDED;
lineflag 3 = ML_DONTPEGTOP;
lineflag 4 = ML_DONTPEGBOTTOM;
lineflag 5 = ML_SECRET;
lineflag 6 = ML_SOUNDBLOCK;
lineflag 7 = ML_DONTDRAW;
lineflag 8 = ML_MAPPED;
lineflag 9 = ML_PASSTHROUGH;
lineflag 10 = ML_3DMIDTEX;
lineflag 11 & (ML_BLOCKING|ML_BLOCKMONSTERS|ML_TWOSIDED|ML_DONTPEGTOP|ML_DONTPEGBOTTOM|ML_SECRET|ML_SOUNDBLOCK|ML_DONTDRAW|ML_MAPPED);
lineflag 10 = SPAC_PCROSS;    <--- I added this line in the hope one of them would work, but it doesn't
lineflag 11 = SPAC_PCROSS;    <--- I added this line in the hope one of them would work, but it doesn't
lineflag 12 = SPAC_PCROSS;    <--- I added this line in the hope one of them would work, but it doesn't
lineflag 15 = ML_BLOCKEVERYTHING;

Can the correct flags be displayed in Slade/Doom Builder?

What is strange is that when I load up the generated map in Slade, it does not display ALL of the available flags in contrast to the linedef flags that there should be here.

Instead of the "activated when hit by projectile" flag being checked or the "activated when crossed by projectile" being checked, the "monsters can activate" flag is being checked but I know that these linedef flags are separate, and Slade does not show the other available flags.

Image


Please if this issue makes sense to anyone here I would be truly appreciative if this can be explained and if there is something else that I need to do to get XLAT to understand what I need.

Many thanks!
Gez
 
 
Posts: 17946
Joined: Fri Jul 06, 2007 3:22 pm

Re: Confused by XLAT Linedef flags - which HEX is SPAC_PCROS

Post by Gez »

It's a bit confusing because the SPAC is not a bitfield, it's an enum. So you shouldn't look at each bit independently to figure out which it is, because they are not flags.

So yes, bits 10, 11, and 12 are used together in Hexen maps. With three bits, you can have 8 different values: 000, 001, 010, 011, 100, 101, 110, 111. That's more interesting that just three values if they were treated as flags. But that also means that the SPAC types aren't flags in the binary format -- you can only have one. (In UDMF, you can have several.)

This, however, is not entirely relevant to XLAT, because XLAT does not deal in the Hexen format but in the Doom format, which doesn't have SPAC (activation type is instead dictated by line special). So, to make this simple: you cannot use XLAT to make a SPAC flag. You can, however, define a new linedef type that will have the activation type you want. The available SPAC flags for linedef definitions are those:

Code: Select all

define WALK				(0)
define USE				(2)
define SHOOT			(6)
define MONST			(16)
define MONWALK			(4)
define REP				(1)
define FIRSTSIDE		(32)
Example of use:

Code: Select all

  1 = USE|MONST|REP,	Door_Raise (0, D_SLOW, VDOORWAIT, tag)
Line type 1 can be used by the player, by the monsters, and is repeatable.

Now, three important points.

#1: Keep in mind that there are three different [wiki]map formats[/wiki], and they have important technical differences. SPAC flags do not exist in Doom format maps. Only Doom format maps need and use XLAT. Hexen-format and UDMF maps do not go through XLAT.

#2: Do not use wikia as your reference. I know that it's unfortunately the first result Google spits at you, but please make sure to use the Doom Wiki at doomwiki.org, and [wiki=Main_Page]our own ZDoom wiki[/wiki].
  1. [wiki]Map translator[/wiki]
  2. [wiki]Linedef[/wiki]
  3. Linedef
#3: Do not modify the content of gzdoom.pk3. If you want a custom xlat for your map, make it, and use MAPINFO to associate it to your map.
User avatar
crowbars82
Posts: 40
Joined: Sun Nov 05, 2017 6:22 pm

Re: Confused by XLAT Linedef flags - which HEX is SPAC_PCROS

Post by crowbars82 »

Hey Gez,

Thank you so much for this! You have really helped my understanding of how this all works. I have succesfully replaced:

Code: Select all

49 = USE,		Ceiling_CrushAndRaiseDist (tag, 8, C_SLOW, 10)
(as none of those are used in the maps) with:

Code: Select all

49 = USE|SHOOT|REP,		GlassBreak  (0, 0)
I no longer have to use an ACS Z-Script at map runtime (ENTER) to do the following...

Code: Select all

//BREAKABLE GLASS
//PREVIOUSLY HAS TO TAG THE LINES TO 98 IN OBLIGE

SetLineSpecial(98, 49, 0, 0, 0, 0);
SetLineActivation(98, SPAC_Impact|SPAC_PCross);
...because now I can tell Oblige to set the lines I want as 49 (with also BLOCKMONSTERS and BLOCK_PLAYERS), and then after setting up the textures in ANIMDEFS I now have nice breakable glass!

However, I have noticed that I can shoot the glass, and monsters that shoot projectiles (imp fireball, hellknight green thing, mancubus flameball) can shoot the glass, but hitscan attacks from monsters do not break the glass.

Do you know if something can be done to allow for monster hitscan attacks for custom lines with the SHOOT parameter?

Many thanks! :)
Gez
 
 
Posts: 17946
Joined: Fri Jul 06, 2007 3:22 pm

Re: Confused by XLAT Linedef flags - which HEX is SPAC_PCROS

Post by Gez »

Even though line type 49 wasn't being used and could thus be safely replaced, keep in mind that you could as well have used a free line type number. Like 449.

As far as I know, the engine does not distinguish between player hitscan and monster hitscan. Do you get bullet puff and decals on the glass window when monsters shoot it, or could it just be they've never actually hit it during your tests?
User avatar
crowbars82
Posts: 40
Joined: Sun Nov 05, 2017 6:22 pm

Re: Confused by XLAT Linedef flags - which HEX is SPAC_PCROS

Post by crowbars82 »

I am testing various attacks with a custom NewZombieMan actor which replaces the original.

So far I am thinking if I get the zombies to shoot very fast projectiles, they may class as something that 'activates' the glass like the imp fireball.

Looking at A_SpawnProjectile I can see the line:

Code: Select all

POSS F 8 A_SpawnProjectile("NormalBullet", 48)
however, I cannot for the life of me find a list of existing missiletypes. I am going to try and make some kind of new projectile and see if I can use A_SpawnProjectile from the NewZombieMan and see if that works.

Cheers!
User avatar
Arctangent
Posts: 1235
Joined: Thu Nov 06, 2014 1:53 pm

Re: Confused by XLAT Linedef flags - which HEX is SPAC_PCROS

Post by Arctangent »

Missiles are just standard actors with specific flags set; you can find them wherever you can find the other actors, such as pages like [wiki]Classes:Doom[/wiki].

Return to “Scripting”