about summary refs log tree commit diff
path: root/src/misc.h
blob: 9c06ea4fe9bd2cb6060b90dbf1cd0f7453d70c37 (plain) (blame)
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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
#ifndef BLACKSHADES_MISC_H
#define BLACKSHADES_MISC_H

#include <stdbool.h>
#include <stddef.h>
#include <stdint.h>

#include <AL/al.h>
#include <GL/gl.h>

struct AnimationData {
	struct {
		struct { float x, y, z; } joints[20];
		float speed;
	} *ptr;
	size_t len;
};

struct JointData {
	float x, y, z;
	float length;
	unsigned char model;
	bool visible;
	bool lower;
	signed char parent;
};

struct MuscleData {
	float length, initlen, minlen, maxlen;
	bool flag;
	bool visible;
	signed char parent1;
	signed char parent2;
};

struct Scores {
	size_t high_score;
	bool completed;
};

struct Fog {
	GLfloat color[4];
	GLfloat density;
	GLfloat start;
	GLfloat end;
};

#ifdef __cplusplus
extern "C" {
#endif // __cplusplus
	bool keyPress(int key);
	struct AnimationData loadAnimation(const char*);
	void loadJoints(struct JointData*);
	void loadMuscles(struct MuscleData*);
	ALuint loadSound(const char*);
	GLuint loadTexture(const char*);
	void playSound(ALuint source, ALfloat x, ALfloat y, ALfloat z);
	float randFloat();
	int32_t randInt(int32_t at_least, int32_t at_most);
	uint32_t randUint(uint32_t less_than);

	void setFog(struct Fog*, GLfloat, GLfloat, GLfloat,
	            GLfloat, GLfloat, GLfloat);
	void tempFog(struct Fog*, GLfloat, GLfloat, GLfloat);
	void resetFog(struct Fog*);
#ifdef __cplusplus
} // extern "C"
#endif // __cplusplus

#endif // BLACKSHADES_MISC_H