A_CustomMissile flags

Moderator: GZDoom Developers

User avatar
FDARI
Posts: 1097
Joined: Tue Nov 03, 2009 9:19 am

A_CustomMissile flags

Post by FDARI »

New flags for A_CustomMissile:

CMF_ABSOLUTEPITCH

Use the pitch parameter as absolute pitch.
Implied by CMF_AIMDIRECTION. (Pitch is absolute)
Does not imply CMF_AIMDIRECTION. (Target is required, xy-direction is set by normal aim)

CMF_OFFSETPITCH

Calculate aim normally.
Adjust the aim (pitch) according to the pitch parameter.

CMF_AIMDIRECTION (not new)

Fire straight ahead (base pitch = 0), offset by the angle parameter. Requires no target. Implies CMF_ABSOLUTEPITCH and handles the pitch parameter accordingly.

CMF_SAVEPITCH

If absolutepitch of offsetpitch was specified/implied, this flag causes the actual pitch (based on velocity) to be saved in the missile's pitch property. If the pitch parameter has not been used to calculate missile velocity, the parameter's value is assigned to the pitch property.

CMF_ABSOLUTEANGLE

Override the angle of the shot (not affecting pitch), using the angle as an absolute value (not relative to the firing actor). Pass the angle of the actor as part of the parameter to create a relative offset.

Example calls:

A_CustomMissile("Something", 32, 0, angle + random(-10,10), CMF_ABSOLUTEANGLE | CMF_OFFSETPITCH | CMF_SAVEPITCH, random(-1,10))

Fire something, requiring a target.
XY-aim: None, use absolute angle. Caller angle + a value ranging from -10 to 10.
Z-aim: Aim + a value ranging from -1 (lower by 1 degree) to 10 (raise by 10 degrees).
Savepitch: Saves the resultant pitch (angle) in the pitch property

A_CustomMissile("Something", 32, 0,0, CMF_SAVEPITCH, random(0,99))
Fire something, requiring a target.
Aim: All normal
Savepitch: Assign a random value from 0 to 99 to the pitch property.

A_CustomMissile("Something", 32, 0,angle, CMF_ABSOLUTEANGLE | CMF_ABSOLUTEPITCH, 45)
Fire something, requiring a target.
Aim: All absolute (using angle parameter to align with caller)
Savepitch: No

A_CustomMissile("Something", 32, 0,0, CMF_AIMDIRECTION | CMF_SAVEPITCH, 45)
Fire something, not requiring a target
Aim: Absolute pitch, otherwise aligned with caller.
Savepitch: 45 is saved
Attachments
A_CustomMissile.txt
(3.44 KiB) Downloaded 77 times
User avatar
Major Cooke
Posts: 8209
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_CustomMissile flags

Post by Major Cooke »

Looks interesting enough. I might give this a shot later.
User avatar
Major Cooke
Posts: 8209
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_CustomMissile flags

Post by Major Cooke »

So I've been thinking about this... I really like all the current pitch ideas, so I was wondering...

Would it be possible to include a flag for A_FireCustomMissile to transfer the pitch of the player to the projectile? I've tried everything with that but I've been forced to conclude that if I want to spawn things with pitch involved, I'd have to use this instead:

Code: Select all

TNT1 A 0 A_SpawnItemEx("JetsonProjectile",cos(-pitch)*10,12,1+(sin(-pitch)*32),cos(-pitch)*10,0,sin(-pitch)*10,0,32|SXF_TRANSFERPITCH)
Simply put, that's a long-ass formula that, while works, I can't help but get a feeling is a little shaky. Unfortunately, even with specifying +NOAUTOAIM the wiki clearly states there is no turning off vertical auto-aim.

Does this allow the missile to save pitch in the means that you can use things such as A_SetPitch properly, and/or allow objects to spawn from the projectile using A_SpawnItemEx with the flag SXF_TRANSFERPITCH?

I ask because the code above allows me to make laser-like projectiles such as this:

Code: Select all

ACTOR JetsonProjectile
{
	var int user_limit;
	+THRUACTORS
	+NOGRAVITY
	+SKYEXPLODE
	Radius 2
	Height 2
	Speed 10
	Projectile
	DeathSound "Jetson/Explosion"
	Translation "0:255=%[0,0,0]:[0.5,0.8,1.0]"
	States
	{
	Spawn:
		MISL A 1 Bright
	Moving:
		TNT1 A 0 A_SetUserVar("user_limit",user_limit+1)
		TNT1 A 0 A_JumpIf(user_limit>=4000,"End")
		TNT1 A 0 A_SpawnItemEx("JetsonParticle",(sin(-pitch)*random(-5,5)),frandom(-2,2),frandom(-2,2),0,0,frandom(0,0.2),0,32)
		TNT1 A 0 A_Warp(AAPTR_DEFAULT,cos(-pitch)*2,0,sin(-pitch)*2,0,0,"Moving2")
      Goto Death
	Moving2: //Meant to reduce density of particles. Works perfectly.
		TNT1 A 0 A_SetUserVar("user_limit",user_limit+1)
		TNT1 A 0 A_JumpIf(user_limit>=4000,"End")
		TNT1 A 0 A_Warp(AAPTR_DEFAULT,cos(-pitch)*2,0,sin(-pitch)*2,0,0,"Moving")
	Death:
		TNT1 A 1 A_SpawnItemEx("JetsonBomb",0,0,0,0,0,0,0,32|SXF_TRANSFERTRANSLATION|SXF_NOCHECKPOSITION|SXF_TRANSFERPOINTERS)
		Stop
	End:
		TNT1 A 0
		Stop
	}
}
The A_Warp and A_SpawnItemEx both rely upon pitch being there, and unfortunately I just can't seem to make it work with A_FireCustomMissile. :|
User avatar
FDARI
Posts: 1097
Joined: Tue Nov 03, 2009 9:19 am

Re: A_CustomMissile flags

Post by FDARI »

Either that, or A_SetPitch(float pitch[, int flags])

Flags

PITCH_MODIFY: Add to existing pitch (same as A_SetPitch(pitch + modification)).
PITCH_CALCULATE: Add to calculated pitch (uses actual velocities to determine pitch).

The advantage of having A_SetPitch do it, is that you don't need pitch updates from every function that is capable of setting missile velocity (such as A_SeekerMissile). The advantage of having it everywhere else is that the call that causes the pitch change can perform the variable update without a dedicated decorate frame. Of course, if it were to be "everywhere", A_ChangeVelocity would require a flag for it as well.

Having it available for the CustomMissile and FireCustomMissile calls seems reasonable.
User avatar
Major Cooke
Posts: 8209
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_CustomMissile flags

Post by Major Cooke »

That would be extremely helpful if you could do those. If you do manage to set up the A_SetPitch, I wonder how would the PITCH_CALCULATE be used then...

And also, wouldn't A_ScaleVelocity need modifying to check and see if it's using pitch for velocities?

I'll wait to see if you do it first, otherwise I'm derailing the topic.
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_CustomMissile flags

Post by NeuralStunner »

Major Cooke wrote:Would it be possible to include a flag for A_FireCustomMissile to transfer the pitch of the player to the projectile?
That would be fantastic, yes. (Unfortunately, someone got it into his head that Pitch isn't useful anywhere. :( )
User avatar
Major Cooke
Posts: 8209
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_CustomMissile flags

Post by Major Cooke »

Uh... Me? I find pitch to be useful in a lot of things.
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_CustomMissile flags

Post by NeuralStunner »

Major Cooke wrote:Uh... Me?
No.
Major Cooke wrote:I find pitch to be useful in a lot of things.
As do I.
User avatar
FDARI
Posts: 1097
Joined: Tue Nov 03, 2009 9:19 am

Re: A_CustomMissile flags

Post by FDARI »

A_SetPitch with PITCH_CALCULATE would work as follows:

A_SetPitch(0, PITCH_CALCULATE): Calculate the pitch based on current velocity, and save that as the pitch property.
A_SetPitch(10, PITCH_CALCULATE): Calculate the pitch based on current velocity, and save that + 10 degrees as the pitch property.

Sometimes this might not be enough. This works when you need to recalculate your velocuty-based pitch info based on any of several events that can happen to an actor during its lifetime.

The velocity might not always have the pitch you want to know about, of course. A_SetPitch might not actually cover all needs, especially not after A_FireCustomMissile, with autoaims and the lots. I'll think about flags for a possible added parameter.
User avatar
Major Cooke
Posts: 8209
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_CustomMissile flags

Post by Major Cooke »

Well, I'm definitely hoping to see it. What I'm mainly concerned about is just changing, say, a missile's trajectory using A_SetPitch and A_SetAngle. I figure it will still have to call A_ChangeVelocity in a method like this:
Spoiler:
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_CustomMissile flags

Post by Xtyfe »

Bumping for great justice... And with hopes that it will added soon even though I know it wont help :(
User avatar
Graf Zahl
Lead GZDoom+Raze Developer
Lead GZDoom+Raze Developer
Posts: 49230
Joined: Sat Jul 19, 2003 10:19 am
Location: Germany

Re: A_CustomMissile flags

Post by Graf Zahl »

At the moment the priority is to get a new version out, not to add new features.

And bumping for bump's sake won't make it go faster.
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_CustomMissile flags

Post by Xtyfe »

Worth a shot :p
User avatar
Graf Zahl
Lead GZDoom+Raze Developer
Lead GZDoom+Raze Developer
Posts: 49230
Joined: Sat Jul 19, 2003 10:19 am
Location: Germany

Re: A_CustomMissile flags

Post by Graf Zahl »

Ok, this doesn't look too intrusive so I guess it's safe to be added.
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_CustomMissile flags

Post by Xtyfe »

Graf Zahl wrote:Ok, this doesn't look too intrusive so I guess it's safe to be added.
Yep, I just creamed my pants
Post Reply

Return to “Closed Feature Suggestions [GZDoom]”