Line Tracer return texture number mismatch

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
Guest

Line Tracer return texture number mismatch

Post by Guest »

For some reason texture number from the following line tracer code mismatch with texture number from texture manager.

Code: Select all

version "2.4"

class Line_Item : Inventory
{
	Object Tracer_Pointer;
	
	override void DoEffect()
	{
		if(Tracer_Pointer == NULL)
		{
			Tracer_Pointer = New("Test_Tracer");
		}
		Vector3 StartPos = Owner.Pos;
		StartPos.Z += (Owner.Height / 2) + PlayerPawn(Owner).AttackZOffset;
		Vector3 Direction;
		Direction.XY = Actor.AngleToVector(Owner.Angle);
		direction.Z = sin(-Owner.Pitch);

		Test_Tracer (Tracer_Pointer).Trace(StartPos, Owner.CurSector, Direction, 8192.0, TRACE_NoSky);

		Console.Printf("%i", Test_Tracer(Tracer_Pointer).Texture_Number);
		Console.Printf("%i", TexMan.CheckForTexture("Bigdoor1", 0, 1) );
	}
}

class Test_Tracer  : LineTracer
{
	TextureID Texture_Number;
	
	override ETraceStatus TraceCallback()
    {
		if (Results.HitType == TRACE_HitWall)
		{
			if (Results.HitLine.Flags & Line.ML_TWOSIDED == 0)
			{
				Texture_Number = Results.HitTexture;
				return Trace_Stop;
			}
		}
		if (Results.HitType == TRACE_HitActor)
		{
			return TRACE_Skip;
		}
		Texture_Number = Results.HitTexture;
		return TRACE_Stop;
	}
}
Copy that, run gzdoom with Doom2 wad, give to self Line_Item item and take a look at the big door in the hallway. It must print same numbers to the console, but for some reason it mismatch.
Guest

Re: Line Tracer return texture number mismatch

Post by Guest »

Uhhhh, anyone?? Is this bug?
_mental_
 
 
Posts: 3812
Joined: Sun Aug 07, 2011 4:32 am

Re: Line Tracer return texture number mismatch

Post by _mental_ »

No, tracer hits line #105 which has no texture. Move closer to the door and numbers will be the same.
Post Reply

Return to “Scripting”