A_ChangeVelocity
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.)
Spoiler: Internal modifications
The function was saving intermediate data that would not necessarily be used, as well as data that would evidently never be used. fixed_t vx, vy, vz are no longer defined. The parameters x,y,z are used in their stead. All variables and processing for rotation according to actor angle has been moved into the conditional branch for VELF_RELATIVE, so that it is not processed if it is not used.
A_ScaleVelocity
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.)
Spoiler: Internal modifications
The entire function is without effect if the caller is not already moving. The act of storing "has_moved" based on initial speed and checking it at the end is therefore unnecessary. This has been replaced with a condition for the rest of the function body; no further operation is performed unless the actor was moving in the first place. All subsequent operations consider it proven that the actor had a non-null initial vector.
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.