A_ScaleVelocity not saved while Teleporting

Bugs that have been investigated and resolved somehow.

Moderator: GZDoom Developers

Forum rules
Please don't bump threads here if you have a problem - it will often be forgotten about if you do. Instead, make a new thread here.
Post Reply
User avatar
Xtyfe
Posts: 1490
Joined: Fri Dec 14, 2007 6:29 pm
Preferred Pronouns: He/Him
Operating System Version (Optional): Windows 11
Graphics Processor: nVidia with Vulkan support

A_ScaleVelocity not saved while Teleporting

Post by Xtyfe »

If I shoot a missile through a teleport (with -NOTELEPORT active) using A_ScaleVelocity it will lose the function coming out the other end. Here is a videro showing the issue as well as the code I use for the missile.


Code: Select all

Actor XtRocket : Rocket replaces Rocket
{
+EXPLODEONWATER
+BLOODSPLATTER
+THRUGHOST
-NOTELEPORT
Damage (Random(9,11)*10)
DamageType "Kinetic"
Speed 1
Decal Scorch
SeeSound ""
States
	{
	Spawn:
		TNT1 A 0
		TNT1 A 0 A_PlaySound ("weapons/rocketloop", 6, 1, 1)
		ROCK AAAAAAAA 1 Bright A_ScaleVelocity (1.1)
		ROCK AAAAAAAAAAAA 1 Bright A_ScaleVelocity (1.25)
	SpawnLoop:
		ROCK A 1 Bright
		Loop
	Death:
		TNT1 A 0 A_StopSound (6)
		RTEX A 4 Bright A_CustomMissile ("XtRocketExplosion")
		RTEX BCDE 4 Bright
		Stop
	}
}

Actor XtRocketExplosion
{
+BLOODSPLATTER
DamageType "Fire"
Speed 0
States
	{
	Spawn:
		TNT1 A 0
		TNT1 A 1 A_Explode (100, 128)
		Stop
	}
}

Last edited by Xtyfe on Fri Nov 25, 2011 6:38 pm, edited 1 time in total.
User avatar
NeuralStunner
 
 
Posts: 12328
Joined: Tue Jul 21, 2009 12:04 pm
Preferred Pronouns: No Preference
Operating System Version (Optional): Windows 11
Graphics Processor: nVidia with Vulkan support
Location: capital N, capital S, no space
Contact:

Re: A_ScaleVelocity not saved will Teleporting

Post by NeuralStunner »

Have you tried the [wiki]Teleport_NoStop[/wiki] action instead?
User avatar
TheDarkArchon
Posts: 7656
Joined: Sat Aug 07, 2004 5:14 am
Location: Some cold place

Re: A_ScaleVelocity not saved will Teleporting

Post by TheDarkArchon »

NeuralStunner wrote:Have you tried the [wiki]Teleport_NoStop[/wiki] action instead?
I suspect this is a weapons mod, given the demonstration on the teleporter at the end of MAP03, thus using that action would be of no use.
User avatar
NeuralStunner
 
 
Posts: 12328
Joined: Tue Jul 21, 2009 12:04 pm
Preferred Pronouns: No Preference
Operating System Version (Optional): Windows 11
Graphics Processor: nVidia with Vulkan support
Location: capital N, capital S, no space
Contact:

Re: A_ScaleVelocity not saved will Teleporting

Post by NeuralStunner »

TheDarkArchon wrote:I suspect this is a weapons mod, given the demonstration on the teleporter at the end of MAP03, thus using that action would be of no use.
But that's not an assumption is it? I test stuff on stock maps all the time.

Given that actors lose all velocity when teleported, I imagine there's a special case for projectiles to begin with.
User avatar
Graf Zahl
Lead GZDoom+Raze Developer
Lead GZDoom+Raze Developer
Posts: 49252
Joined: Sat Jul 19, 2003 10:19 am
Location: Germany

Re: A_ScaleVelocity not saved will Teleporting

Post by Graf Zahl »

There indeed is:

Code: Select all

	if (thing->flags & MF_MISSILE)
	{
		angle >>= ANGLETOFINESHIFT;
		thing->velx = FixedMul (thing->Speed, finecosine[angle]);
		thing->vely = FixedMul (thing->Speed, finesine[angle]);
	}
And the obvious problem is that the velocity has to be changed to the new direction after teleporting. And as with many other cases (as the recently added option for A_SeekerMissile) the same problem is the culprit: thing->Speed is not the current speed but merely the default speed.
User avatar
NeuralStunner
 
 
Posts: 12328
Joined: Tue Jul 21, 2009 12:04 pm
Preferred Pronouns: No Preference
Operating System Version (Optional): Windows 11
Graphics Processor: nVidia with Vulkan support
Location: capital N, capital S, no space
Contact:

Re: A_ScaleVelocity not saved will Teleporting

Post by NeuralStunner »

Yeah, that's what I expected.

I wonder if any of Randy's new seeker code could be adapted? I'm not sure if simply changing it would bring up any compatibility issues, but I can't think why it would.
User avatar
Graf Zahl
Lead GZDoom+Raze Developer
Lead GZDoom+Raze Developer
Posts: 49252
Joined: Sat Jul 19, 2003 10:19 am
Location: Germany

Re: A_ScaleVelocity not saved will Teleporting

Post by Graf Zahl »

Of course it could. That new code does precisely what's needed here (i.e. get a speed value from a velocity vector and uses that instead of thing->Speed)
User avatar
Xtyfe
Posts: 1490
Joined: Fri Dec 14, 2007 6:29 pm
Preferred Pronouns: He/Him
Operating System Version (Optional): Windows 11
Graphics Processor: nVidia with Vulkan support

Re: A_ScaleVelocity not saved will Teleporting

Post by Xtyfe »

Would A_ChangeVelocity suffer from the same as well?
User avatar
Xaser
 
 
Posts: 10774
Joined: Sun Jul 20, 2003 12:15 pm
Contact:

Re: A_ScaleVelocity not saved will Teleporting

Post by Xaser »

Yes, it would. The trouble in either case is that when resetting velocity during teleport/seek, the code is looking at the thing's Speed property instead of the actual current speed of the projectile.

Also, the thread title made me do a triple-take until I figured out what it was saying. I assume "will" was supposed to be "when" or "while" :P
User avatar
Xtyfe
Posts: 1490
Joined: Fri Dec 14, 2007 6:29 pm
Preferred Pronouns: He/Him
Operating System Version (Optional): Windows 11
Graphics Processor: nVidia with Vulkan support

Re: A_ScaleVelocity not saved will Teleporting

Post by Xtyfe »

oh opps, ya it was supposed to be while
User avatar
randi
Site Admin
Posts: 7749
Joined: Wed Jul 09, 2003 10:30 pm
Contact:

Re: A_ScaleVelocity not saved while Teleporting

Post by randi »

Fixed.
User avatar
Enjay
 
 
Posts: 27320
Joined: Tue Jul 15, 2003 4:58 pm
Location: Scotland
Contact:

Re: A_ScaleVelocity not saved while Teleporting

Post by Enjay »

Just tried messing around with some sample maps and teleporting rocket puzzles. I wonder, is it possible to set things up somehow so that the vertical angle does not get preserved across the teleport?

I think it is fine as it is ATM for most uses (and I'm not asking for it to be changed). However, there could be occasions where the rocket (or whatever) needs to come out of the teleport perfectly horizontally. The way it works ATM is that, assuming the player is using freelook, it is very unlikely that they will launch a rocket perfectly horizontally and therefore the rocket comes out of the teleport non-horizontally and this can quite quickly accumulate to the rocket being in a position that scuppers the puzzle.
User avatar
Xtyfe
Posts: 1490
Joined: Fri Dec 14, 2007 6:29 pm
Preferred Pronouns: He/Him
Operating System Version (Optional): Windows 11
Graphics Processor: nVidia with Vulkan support

Re: A_ScaleVelocity not saved while Teleporting

Post by Xtyfe »

Indeed, as you can see in that video, I had a hard time making them fly out the other end straight :roll:
User avatar
Major Cooke
Posts: 8218
Joined: Sun Jan 28, 2007 3:55 pm
Preferred Pronouns: He/Him
Operating System Version (Optional): Windows 10
Graphics Processor: nVidia with Vulkan support
Location: GZBoomer Town
Contact:

Re: A_ScaleVelocity not saved while Teleporting

Post by Major Cooke »

Enjay wrote:Just tried messing around with some sample maps and teleporting rocket puzzles. I wonder, is it possible to set things up somehow so that the vertical angle does not get preserved across the teleport?

I think it is fine as it is ATM for most uses (and I'm not asking for it to be changed). However, there could be occasions where the rocket (or whatever) needs to come out of the teleport perfectly horizontally. The way it works ATM is that, assuming the player is using freelook, it is very unlikely that they will launch a rocket perfectly horizontally and therefore the rocket comes out of the teleport non-horizontally and this can quite quickly accumulate to the rocket being in a position that scuppers the puzzle.
I definitely would like to see this be placed in.
Post Reply

Return to “Closed Bugs [GZDoom]”