Names assigned to existing flags: CVF_RELATIVE, CVF_SETSPEED
New flag: CVF_THINGSPEED
Effect: The provided vector is multiplied by the thing's defined speed, so that 1,0,0 means straight ahead. This is good for code organisation and inheritability. Wanted for the ability to call A_ChangeVelocity in several places with the vector magnitude defined only once, and for the ability to efficiently redefine vector magnitude in a child actor. (By assigning the child actor a different speed.)
New parameter: int flags
New flag: SVF_SETSPEED
Effect: Scale velocity to the chosen magnitude, instead of scaling it BY the chosen magnitude. The direction remains unmodified.
New flag: SVF_THINGSPEED
Effect: Multiply the chosen magnitude by the actor's defined speed.
If the actor is not moving, A_ScaleVelocity has no effect, regardless of flags.
A_ScaleVelocity(1, SVF_SETSPEED|SVF_THINGSPEED) would reset any actor's velocity to its speed, without altering its direction. (Unless the actor has no current velocity, in which case nothing happens.)
Bitwise OR on boolean test of vector components has been changed to logical OR.
Recent additions (A_ScaleVelocity):
SVF_SAVESPEED (flag): Assign the resultant velocity as the actor's current speed (set speed property, not just velocity along x,y,z-axis).
SVF_NOUPDATE (flag): Omit the standard operation of updating the actor's speed. Must be used in conjunction with another behaviour. It is meaningless to disable update without adding another effect.
(Currently the only meaningful use of SVF_NOUPDATE is with SVF_SAVESPEED)
Special note: A_ScaleVelocity when the actor is not moving at all
A_ScaleVelocity normally has no effect whatsoever when the actor is not moving already.
I have added one exception to this, and that is when the flags show clearly that you are not using or affecting the current velocity at all:
SVF_NOUPDATE: This shows that you will not be affecting the current velocity, but requires you to provide an alternate operation.
SVF_SAVESPEED: This is the only alternate operation defined.
SVF_SETSPEED: This shows that you will not be using current velocity to calculate resultant velocity.
A_ScaleVelocity(float speed, SVF_SAVESPEED|SVF_NOUPDATE|SVF_SETSPEED) is guaranteed to behave like (ACS) SetActorProperty(0, APROP_SPEED, fixed speed), but also gives you the opportunity to include other relevant flags (SVF_THINGSPEED).
EDIT: The patch and the first post have been edited based on recommendations and new ideas. Flag names were different at the time they were first discussed.