diff options
Diffstat (limited to 'zoom')
-rw-r--r-- | zoom/collision.h | 11 | ||||
-rw-r--r-- | zoom/init.h | 7 | ||||
-rw-r--r-- | zoom/level.h | 48 | ||||
-rw-r--r-- | zoom/math.h | 21 | ||||
-rw-r--r-- | zoom/player.h | 24 | ||||
-rw-r--r-- | zoom/render.h | 6 | ||||
-rw-r--r-- | zoom/texture.h | 11 | ||||
-rw-r--r-- | zoom/types.h | 63 |
8 files changed, 191 insertions, 0 deletions
diff --git a/zoom/collision.h b/zoom/collision.h new file mode 100644 index 0000000..6d35079 --- /dev/null +++ b/zoom/collision.h @@ -0,0 +1,11 @@ +#ifndef GAME_COLLISION_H
+#define GAME_COLLISION_H
+
+#include "types.h"
+
+int CollisionPointTriangle(VERTEX, TRIANGLE);
+int CollisionRayTriangle(VERTEX, VECTOR, TRIANGLE, float*);
+int CollisionSphereTriangle(VERTEX, float,TRIANGLE);
+int CollisionMovingSphereTriangle(VERTEX, float, VECTOR, float, TRIANGLE);
+
+#endif
diff --git a/zoom/init.h b/zoom/init.h new file mode 100644 index 0000000..482102d --- /dev/null +++ b/zoom/init.h @@ -0,0 +1,7 @@ +#ifndef GAME_INIT_H
+#define GAME_INIT_H
+
+int InitGame();
+void UninitGame();
+
+#endif
diff --git a/zoom/level.h b/zoom/level.h new file mode 100644 index 0000000..50911b0 --- /dev/null +++ b/zoom/level.h @@ -0,0 +1,48 @@ +#ifndef GAME_LEVEL_H
+#define GAME_LEVEL_H
+
+#include <GL/gl.h>
+#include "types.h"
+
+#pragma pack(push, 2)
+typedef struct _LEVELHEADER {
+ char l, f;
+ int nRooms;
+ int nTextures;
+} LEVELHEADER;
+
+typedef struct _ROOMHEADER {
+ int nTriangles;
+ int nObjects;
+ int nGates;
+} ROOMHEADER;
+
+typedef struct _GATEINFO {
+ unsigned short state;
+ unsigned short timer;
+} GATEINFO;
+
+typedef struct _ROOM {
+ int nTriangles;
+ int nObjects;
+ int nGates;
+ TRIANGLE *triangles;
+ OBJECT *objects;
+ GATE *gates;
+ GATEINFO *gateinfo;
+} ROOM;
+
+typedef struct _LEVEL {
+ int nRooms;
+ ROOM *rooms;
+ int nTextures;
+ GLuint *textures;
+} LEVEL;
+#pragma pack(pop)
+
+
+int LoadLevel(char *, LEVEL *);
+void DrawRoom(LEVEL *, int);
+void FreeLevel(LEVEL *);
+
+#endif
diff --git a/zoom/math.h b/zoom/math.h new file mode 100644 index 0000000..5644e60 --- /dev/null +++ b/zoom/math.h @@ -0,0 +1,21 @@ +#ifndef GAME_MATH_H +#define GAME_MATH_H + +#include "types.h" + +float VectorDot(VECTOR, VECTOR); +VECTOR VectorCross(VECTOR, VECTOR); +VECTOR VectorSub(VECTOR, VECTOR); +VECTOR VectorAdd(VECTOR, VECTOR); +VECTOR VectorMul(VECTOR, float); +VECTOR VectorNormalize(VECTOR);
+VECTOR VectorNeg(VECTOR);
+float VectorLength(VECTOR);
+float VectorLengthSq(VECTOR); +int VectorEqual(VECTOR, VECTOR);
+MATRIX MatrixMul(MATRIX, MATRIX);
+MATRIX MatrixIdentity();
+MATRIX VectorMatrix(VERTEX, VECTOR, VERTEX, VECTOR);
+VECTOR VectorMatrixMul(VECTOR, MATRIX); + +#endif diff --git a/zoom/player.h b/zoom/player.h new file mode 100644 index 0000000..200edcc --- /dev/null +++ b/zoom/player.h @@ -0,0 +1,24 @@ +#ifndef GAME_PLAYER_H
+#define GAME_PLAYER_H
+
+#include "types.h"
+
+#define INPUT_UP 1
+#define INPUT_DOWN 2
+#define INPUT_RIGHT 4
+#define INPUT_LEFT 8
+#define INPUT_OPEN 16
+
+typedef struct _PLAYER {
+ VERTEX pos;
+ float rotx;
+ float rotysin, rotycos;
+ int health;
+ int shield;
+ int room;
+} PLAYER;
+
+void MouseInput(int, int);
+void DoInput(int);
+
+#endif
diff --git a/zoom/render.h b/zoom/render.h new file mode 100644 index 0000000..d114ddd --- /dev/null +++ b/zoom/render.h @@ -0,0 +1,6 @@ +#ifndef GAME_RENDER_H +#define GAME_RENDER_H + +void Render(); + +#endif diff --git a/zoom/texture.h b/zoom/texture.h new file mode 100644 index 0000000..c40f2f6 --- /dev/null +++ b/zoom/texture.h @@ -0,0 +1,11 @@ +#ifndef GAME_TEXTURE_H
+#define GAME_TEXTURE_H
+
+typedef struct _TEXLIST {
+ char name[30];
+ GLuint id;
+} TEXLIST;
+
+GLuint LoadTexture(char *);
+
+#endif
diff --git a/zoom/types.h b/zoom/types.h new file mode 100644 index 0000000..1fce68b --- /dev/null +++ b/zoom/types.h @@ -0,0 +1,63 @@ +#ifndef GAME_TYPES_H
+#define GAME_TYPES_H
+
+#include <GL/gl.h>
+
+#define TRIANGLE_UNKNOWN 0
+#define TRIANGLE_WALL 1
+#define TRIANGLE_FLOOR 2
+
+#define OBJECT_UNKNOWN 0
+#define OBJECT_MEDIPAK25 1
+#define OBJECT_MEDIPAK50 2
+#define OBJECT_MEDIPAK100 3
+
+#define GATE_UNKNOWN 0
+#define GATE_SIDE 1
+
+#define STATE_UNKNOWN 0
+#define STATE_OPENED 1
+#define STATE_CLOSED 2
+#define STATE_OPENING 3
+#define STATE_CLOSING 4
+
+#pragma pack(push, 2)
+typedef union _MATRIX {
+ float m[4][4];
+ float f[16];
+} MATRIX;
+
+typedef struct _VECTOR_VERTEX {
+ float x, y, z;
+} VECTOR, VERTEX;
+
+typedef struct _TEXCOORDS {
+ float s, t;
+} TEXCOORDS;
+
+typedef struct _TRIANGLE {
+ unsigned char type;
+ unsigned char visible;
+ VERTEX vertices[3];
+ VECTOR normal;
+ int texture;
+ TEXCOORDS texcoords[3];
+} TRIANGLE;
+
+typedef struct _OBJECT {
+ unsigned char type;
+ unsigned char visible;
+ VERTEX pos;
+} OBJECT;
+
+typedef struct _GATE {
+ unsigned char type;
+ unsigned char open;
+ TRIANGLE triangles[2];
+ VERTEX point;
+ int room;
+ int gate;
+} GATE;
+#pragma pack(pop)
+
+#endif
|