[Added] A_CustomMissile flags

Moderator: Developers

A_CustomMissile flags

Postby FDARI » Mon Jul 11, 2011 5:32 pm

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 30 times
User avatar
FDARI
Bronies eunt domus
 
Joined: 03 Nov 2009

Re: A_CustomMissile flags

Postby Major Cooke » Wed Jul 13, 2011 7:44 am

Looks interesting enough. I might give this a shot later.
User avatar
Major Cooke
That's how my uncle stole christmas three times in a row in a single year. -DBT
 
Joined: 28 Jan 2007

Re: A_CustomMissile flags

Postby Major Cooke » Fri Jul 29, 2011 9:05 am

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 allExpand view
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 allExpand view
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
Major Cooke
That's how my uncle stole christmas three times in a row in a single year. -DBT
 
Joined: 28 Jan 2007

Re: A_CustomMissile flags

Postby FDARI » Fri Jul 29, 2011 11:03 am

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
FDARI
Bronies eunt domus
 
Joined: 03 Nov 2009

Re: A_CustomMissile flags

Postby Major Cooke » Fri Jul 29, 2011 11:14 am

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
Major Cooke
That's how my uncle stole christmas three times in a row in a single year. -DBT
 
Joined: 28 Jan 2007

Re: A_CustomMissile flags

Postby NeuralStunner » Fri Jul 29, 2011 3:46 pm

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
NeuralStunner
O'Neill with it.
 
Joined: 21 Jul 2009
Location: The Colonies

Re: A_CustomMissile flags

Postby Major Cooke » Fri Jul 29, 2011 3:53 pm

Uh... Me? I find pitch to be useful in a lot of things.
User avatar
Major Cooke
That's how my uncle stole christmas three times in a row in a single year. -DBT
 
Joined: 28 Jan 2007

Re: A_CustomMissile flags

Postby NeuralStunner » Fri Jul 29, 2011 4:00 pm

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
NeuralStunner
O'Neill with it.
 
Joined: 21 Jul 2009
Location: The Colonies

Re: A_CustomMissile flags

Postby FDARI » Fri Jul 29, 2011 6:12 pm

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
FDARI
Bronies eunt domus
 
Joined: 03 Nov 2009

Re: A_CustomMissile flags

Postby Major Cooke » Mon Aug 01, 2011 9:25 am

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
Major Cooke
That's how my uncle stole christmas three times in a row in a single year. -DBT
 
Joined: 28 Jan 2007

Re: A_CustomMissile flags

Postby Xtyfe » Wed Apr 04, 2012 9:24 pm

Bumping for great justice... And with hopes that it will added soon even though I know it wont help :(
Xtyfe
 
Joined: 14 Dec 2007
Location: Kitchener, Ontario

Re: A_CustomMissile flags

Postby Graf Zahl » Thu Apr 05, 2012 4:53 am

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
Graf Zahl
 
Joined: 19 Jul 2003
Location: Germany

Re: A_CustomMissile flags

Postby Xtyfe » Thu Apr 05, 2012 2:10 pm

Worth a shot :p
Xtyfe
 
Joined: 14 Dec 2007
Location: Kitchener, Ontario

Re: A_CustomMissile flags

Postby Graf Zahl » Sat Apr 07, 2012 7:37 am

Ok, this doesn't look too intrusive so I guess it's safe to be added.
User avatar
Graf Zahl
 
Joined: 19 Jul 2003
Location: Germany

Re: A_CustomMissile flags

Postby Xtyfe » Sat Apr 07, 2012 12:10 pm

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
Xtyfe
 
Joined: 14 Dec 2007
Location: Kitchener, Ontario

Next

Return to Closed Feature Suggestions

Who is online

Users browsing this forum: No registered users and 0 guests