Platz Type velocity

From Uzebox Wiki
Jump to navigation Jump to search

Single-axis velocity with 0.25 pixels per frame (ppf) intervals. The true velocity will be equal to one quarter of vel. This structure gives us fractional movement without the need for linking to floating point libraries or having to perform floating point math. See GET_VEL for conveniently finding the true velocity.

typedef struct velocity {		
    char vel;       // Base velocity - implemented as mod, modDisp and disp.
    char dir;       // Direction of travel - useful for when vel == 0.
    u8	 frames;    // Counts the game frames for use by mod.
    u8	 mod;       // Fractional speed adjustment (n-1).
    char modDisp;   // Special case displacement when frames&mod == 0.
    char disp;      // Typical displacement.
} velocity;