summaryrefslogtreecommitdiff
path: root/include/quake.h
blob: c6259c7675f3c640d60dc68849765fa3c8533077 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
#ifndef QUAKE_H
#define QUAKE_H

#include "camera.h"
#include "z_math.h"

typedef struct ShakeInfo {
    /* 0x00 */ Vec3f atOffset;
    /* 0x0C */ Vec3f eyeOffset;
    /* 0x18 */ s16 upPitchOffset; // gives a "roll" effect by offsetting the Up vector
    /* 0x1A */ s16 upYawOffset; // gives a "roll" effect by offsetting the Up vector
    /* 0x1C */ s16 fovOffset; // binary angle
    /* 0x20 */ f32 maxOffset;
} ShakeInfo; // size = 0x24

typedef enum QuakeType {
    /* 0 */ QUAKE_TYPE_NONE,
    /* 1 */ QUAKE_TYPE_1, // Periodic, sustaining, random X perturbations
    /* 2 */ QUAKE_TYPE_2, // Aperiodic, sustaining, random X perturbations
    /* 3 */ QUAKE_TYPE_3, // Periodic, decaying
    /* 4 */ QUAKE_TYPE_4, // Aperiodic, decaying, random X perturbations
    /* 5 */ QUAKE_TYPE_5, // Periodic, sustaining
    /* 6 */ QUAKE_TYPE_6 // See below
} QuakeType;

// Quake type 6 is Jump-Periodic, sustaining, random X perturbations,
// resets period every 16 frames (jumps, similar to sawtooth),
// continues indefinitely i.e. does not terminate when the timer reaches 0
// must be manually removed

s16 Quake_Request(Camera* camera, u32 type);

u32 Quake_SetSpeed(s16 index, s16 speed);
u32 Quake_SetPerturbations(s16 index, s16 y, s16 x, s16 fov, s16 roll);
u32 Quake_SetDuration(s16 index, s16 duration);
u32 Quake_SetOrientation(s16 index, s16 isRelativeToScreen, Vec3s orientation);

s16 Quake_GetTimeLeft(s16 index);
u32 Quake_RemoveRequest(s16 index);

void Quake_Init(void);
s16 Quake_Update(Camera* camera, ShakeInfo* camShake);

#endif