Search In
• More options...
Find results that contain...
Find results in...

# NEW ACS FUNCTIONS: GetLineX and GetLineY

## Recommended Posts

I've added two ACS functions in Eternity:

-300:GetLineX(int lineId, fixed ratioAlongLine, fixed distanceFromLine);
-301:GetLineY(same parameters).

They return the coordinates on top of a linedef tagged as lineId. Other parameters are:

• ratioAlongLine is a "fixed-point" number (expressed as multiples of 65536 or as multiples of 1.0 if with decimal point). 0 means that you get the position of first vertex; 1.0 (65536) means the position of the second vertex. Any value between them is partly between them. Negative values are before the first vertex and values over 1.0 (65536) are beyond the second one.
• distanceFromLine is also a "fixed-point" which is the distance in map units perpendicular from the line. 0 means that you get a coordinate exactly on the linedef. Positive values put it in front of the first sidedef. Negative values put it behind.
If your copy of zspecial.acs doesn't have them, make sure to add the following lines there:
```	-300:GetLineX(3),
-301:GetLineY(3),```
Thanks to Graf Zahl for accepting them into the ZSpecial.acs from ACC. Maybe it will automatically be imported into GZDB!

Potential uses? You can now spawn things (or do other stuff) on top of linedefs at randomized coordinates without having to deploy map spots. And it's useful for moving polyobjects too; you no longer have to synchronize moving map spots (or similar stuff) with the polys.

Bump.

Consider a vertical (north-south) linedef with a certain TID:

```int x  = GetLineX( tid, 0.5, 16.0 );
int x1 = GetLineX( tid, 0.5, -16.0 );
int y  = GetLineY( tid, 0.5, 0.0 );
int y1 = y;

SpawnForced( "DoomImp",  x,  y,  z, tid, byteangle );
SpawnForced( DoomImp", x1, y1, z1, tid, byteangle );

```

This will spawn an Imp to the left and right of this linedef centre. So far so good. Now let's try the same with a horizontal (east-west) linedef:

```x  = GetLineX( tid, 0.5, 0.0 );
x1 = x;
y  = GetLineY( tid, 0.5, 16.0 );
y1 = GetLineY( tid, 0.5, -16.0 );

SpawnForced( "DoomImp",  x,  y,  z, tid, byteangle );
SpawnForced( DoomImp", x1, y1, z1, tid, byteangle );

```

And now the two Imps are spawned on top of eachother.

Sounds like GetLineY does not handle its third argument correctly, while GetLineX does as expected.

Hopefully fixed on next development build.