-
Notifications
You must be signed in to change notification settings - Fork 0
/
stdafx.h
120 lines (94 loc) · 2.67 KB
/
stdafx.h
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
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
// stdafx.h : include file for standard system include files,
// or project specific include files that are used frequently, but
// are changed infrequently
//
#pragma once
#include "targetver.h"
//Debugging memory leaks
#define _CRTDBG_MAP_ALLOC
#include <stdlib.h>
#include <crtdbg.h>
#ifdef _DEBUG
#ifndef DBG_NEW
#define DBG_NEW new ( _NORMAL_BLOCK , __FILE__ , __LINE__ )
#define new DBG_NEW
#endif
#endif // _DEBUG
#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers
// Windows Header Files:
#include <windows.h>
// C RunTime Header Files
#include <malloc.h>
#include <memory.h>
#include <tchar.h>
#include <stdio.h>
#include <stdlib.h>
#include <string>
using namespace std;
#include <time.h>
#include <math.h>
#include <gl\GL.h>
#include <gl\GLU.h>
#include <gl\glut.h>
#define MAX_WORLD_SIZE 129 //Max bounds for the world size
#define PI 3.1415927
#define GRAVITY -9.8
typedef struct{
double x, y, z, a;
} Vector4;
typedef struct{
double x, y, z;
} Vector3;
typedef struct{
double x, y;
} Vector2;
struct nodePath {
Vector2 nodeData;
double incentive;
nodePath *next;
};
struct nodePath3d {
Vector3 nodeData;
nodePath3d *next;
};
typedef struct{
float x, y, z; //Position coordinates
int type; //Type of terrain
float gradient; //Slope
Vector3 normal1, normal2; //Normal Vector coordinates
Vector3 texCoord1, texCoord2; //Texture coordinates
} tile;
struct OverlayData
{
Vector3 location;
Vector3 color;
int fontSet;
string *text;
int lifeTime;
OverlayData *next;
};
#define BIOME_COUNT 5
enum terrainType {FIELD, FOREST, SAND, SNOW, WATER};
enum biomeType{PLAINS, MOUNTAINS, DESERT, FOREST_MIX, LAKES};
extern bool keys[256]; // Keyboard routines
extern int selectedID; //Object ID selected by the user
void clearCurrentSelection();
void log(string * text);
void log(string text);
string dtos(double number);
string itos(int number);
double getDecimalRandom(int randBound);
double getRandomAsD(int randBound);
int getRandomAsI(int randBound);
bool choose(float probability);
double findDistance(double startX, double startZ, double endX, double endZ);
double find3dDistance(Vector3 v1, Vector3 v2);
double find3dDistance(Vector3 v);
double cosineInterpolate(double height1, double height2, double x);
Vector3 crossProduct(Vector3 v1, Vector3 v2);
double dotProduct(Vector3 v1, Vector3 v2);
void normalize(Vector3 &v);
void setVector(Vector4 &v, double x, double y, double z, double a);
void setVector(Vector3 &v, double x, double y, double z);
void setCoord(Vector2 &v, double x, double y);
BOOL checkLineIntersect(Vector3 tp1, Vector3 tp2, Vector3 tp3, Vector3 lp1, Vector3 lp2, Vector3 &intersect);