summaryrefslogtreecommitdiffstats
path: root/src/game/globals.c
blob: 1867d5848dd7872141440f5c64ea8737af0ca91a (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
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
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
#include "game/game.h"
#include "video/video.h"
#include "input/input.h"

/* globals */
Game main_game;
Game *game;
Game2 main_game2;
Game2 *game2;
Visual *gScreen;
int gViewportType;
PlayerVisual *gPlayerVisuals;
Input gInput;

SettingsCache gSettingsCache;

int viewport_content[4]; /* max. 4 individual viewports on the screen */

/* TexFont *txf = NULL; */
FontTex *guiFtx = NULL;
FontTex *gameFtx = NULL;
int fontID = 6;

Mesh* recognizer_quad;
float rec_outline_color[] = {0.8f, 0.0, 0.0};
float rec_spec_color[] = {0.05f, 0.14f, 0.05f, 0.50f};

Mesh* recognizer;
Mesh* lightcycle[LC_LOD];
char *lc_lod_names[] = {
  "lightcycle-high.obj",
  "lightcycle-med.obj",
  "lightcycle-low.obj"
};

float camAngle = 0;
float cam_phi = 0;
float cam_chi = PI / 6.0f;
float cam_r_mouse = CAM_CIRCLE_DIST;
float cam_r_follow = CAM_FOLLOW_DIST;
float cam_r_circle = CAM_CIRCLE_DIST;

unsigned char* debugtex = NULL;
int ogl_debugtex;
int colwidth;
segment2 walls[4];

int dirsX[] = { 0, -1, 0, 1 };
int dirsY[] = { -1, 0, 1, 0 };
float camAngles[] = { PI / 2, 0, 3 * PI / 2, PI, 2 * PI };

float cam_defaults[][3] =  { 
  { CAM_CIRCLE_DIST, PI / 3, 0 }, /* circle */
  { CAM_FOLLOW_DIST, PI / 4, PI / 72 }, /* follow */
  { CAM_COCKPIT_Z, PI / 8, 0 }, /* cockpit */
  { CAM_CIRCLE_DIST, PI / 3, 0 } /* free */
};

/* int lasttime; 
   double dt; */
/* milliseconds since last frame */

int polycount; /* poly count - how much do we draw each frame? */

unsigned char debugcolors[6][4] = {
  { 0, 0, 0, 0 },
  { 255, 0, 0, 255 },
  { 0, 255, 255, 255 },
  { 0, 255, 0, 255 },
  { 0, 0, 255, 255 },
  { 255, 255, 255, 255 }
};

int vps = 4;
int vp_max[] = { 1, 2, 4, 1 }; /* windows in this display setting */

/* currently, the screen is partitioned into 32 units horizontally,
   and 24 units vertically */

/* these arrays have four members, for the four different visuals:
   single, split, quad, unused */

/* the offset of the view, in virtual units */
float vp_x[4][4] = { { 0 },    { 1, 1 },  { 1, 16, 1, 16 }, { 10 } };
float vp_y[4][4] = { { 0 },    { 0.5f, 12.5f },   { 1, 1, 12.5f, 12.5f }, { 4.5 } } ;

/* the width/height of the view, in virtual units */
float vp_w[4][4] = { { 32 },   { 30, 30 }, { 14, 14, 14, 14 }, { 20 } };
float vp_h[4][4] = { { 24 }, { 11.5f, 11.5f }, { 10.5f, 10.5f, 10.5f, 10.5f }, { 15 } };

#ifdef DEPTH_SORT
int quadBufSize = 100;
Quad *quadBuf;
int *quadBufIndex;
#endif

int game_textures = TEX_COUNT + 5; /* 11 + 6 + debug texture */
int n_textures = 11;

#ifndef GL_VERSION_1_2
#  define GL_CLAMP_TO_EDGE GL_CLAMP
#endif

TextureInfo textures[] = {
  { 1, "gltron_floor", GL_DONT_CARE, GL_REPEAT, GL_REPEAT, TEX_FLOOR, 64 },
  { 1, "gltron", GL_RGB, GL_REPEAT, GL_REPEAT, TEX_GUI, 1 },
  { 1, "gltron_logo", GL_RGBA, 
    GL_CLAMP_TO_EDGE, GL_CLAMP_TO_EDGE, TEX_LOGO, 1 },
  { 1, "gltron_wall_1", GL_DONT_CARE, 
    GL_REPEAT, GL_CLAMP_TO_EDGE, TEX_WALL1, 1 },
  { 1, "gltron_wall_2", GL_DONT_CARE, 
    GL_REPEAT, GL_CLAMP_TO_EDGE, TEX_WALL2, 1 },
  { 1, "gltron_wall_3", GL_DONT_CARE, 
    GL_REPEAT, GL_CLAMP_TO_EDGE, TEX_WALL3, 1 },
  { 1, "gltron_wall_4", GL_DONT_CARE, 
    GL_REPEAT, GL_CLAMP_TO_EDGE, TEX_WALL4, 1 },
  { 1, "gltron_trail", GL_RGBA, 
    GL_CLAMP_TO_EDGE, GL_CLAMP_TO_EDGE, TEX_TRAIL, 1 },
  { 1, "gltron_traildecal", GL_RGBA, 
    GL_REPEAT, GL_CLAMP_TO_EDGE, TEX_DECAL, 1 },
  { 6, "skybox", GL_RGB, 
    GL_CLAMP_TO_EDGE, GL_CLAMP_TO_EDGE, TEX_SKYBOX, 1 },
  { 1, "gltron_impact", GL_RGBA, GL_REPEAT, GL_CLAMP_TO_EDGE, TEX_IMPACT, 1 },

};

float shadow_color[] = { 0, 0, 0, .8f };

#define LX 2.0f
#define LY 2.0f
float shadow_matrix[] = { LX * LY, 0,       0, 0, 
			  0,       LX * LY, 0, 0, 
			  -LY,    -LX,      0, 0, 
			  0,       0,       0, LX * LY };
#undef LX
#undef LY