1 #include "game/game.h" 2 #include "video/video.h" 3 #include "input/input.h" 4 5 /* globals */ 6 Game main_game; 7 Game *game; 8 Game2 main_game2; 9 Game2 *game2; 10 Visual *gScreen; 11 int gViewportType; 12 PlayerVisual *gPlayerVisuals; 13 Input gInput; 14 15 SettingsCache gSettingsCache; 16 17 int viewport_content[4]; /* max. 4 individual viewports on the screen */ 18 19 /* TexFont *txf = NULL; */ 20 FontTex *guiFtx = NULL; 21 FontTex *gameFtx = NULL; 22 int fontID = 6; 23 24 Mesh* recognizer_quad; 25 float rec_outline_color[] = {0.8f, 0.0, 0.0}; 26 float rec_spec_color[] = {0.05f, 0.14f, 0.05f, 0.50f}; 27 28 Mesh* recognizer; 29 Mesh* lightcycle[LC_LOD]; 30 char *lc_lod_names[] = { 31 "lightcycle-high.obj", 32 "lightcycle-med.obj", 33 "lightcycle-low.obj" 34 }; 35 36 float camAngle = 0; 37 float cam_phi = 0; 38 float cam_chi = PI / 6.0f; 39 float cam_r_mouse = CAM_CIRCLE_DIST; 40 float cam_r_follow = CAM_FOLLOW_DIST; 41 float cam_r_circle = CAM_CIRCLE_DIST; 42 43 unsigned char* debugtex = NULL; 44 int ogl_debugtex; 45 int colwidth; 46 segment2 walls[4]; 47 48 int dirsX[] = { 0, -1, 0, 1 }; 49 int dirsY[] = { -1, 0, 1, 0 }; 50 float camAngles[] = { PI / 2, 0, 3 * PI / 2, PI, 2 * PI }; 51 52 float cam_defaults[][3] = { 53 { CAM_CIRCLE_DIST, PI / 3, 0 }, /* circle */ 54 { CAM_FOLLOW_DIST, PI / 4, PI / 72 }, /* follow */ 55 { CAM_COCKPIT_Z, PI / 8, 0 }, /* cockpit */ 56 { CAM_CIRCLE_DIST, PI / 3, 0 } /* free */ 57 }; 58 59 /* int lasttime; 60 double dt; */ 61 /* milliseconds since last frame */ 62 63 int polycount; /* poly count - how much do we draw each frame? */ 64 65 unsigned char debugcolors[6][4] = { 66 { 0, 0, 0, 0 }, 67 { 255, 0, 0, 255 }, 68 { 0, 255, 255, 255 }, 69 { 0, 255, 0, 255 }, 70 { 0, 0, 255, 255 }, 71 { 255, 255, 255, 255 } 72 }; 73 74 int vps = 4; 75 int vp_max[] = { 1, 2, 4, 1 }; /* windows in this display setting */ 76 77 /* currently, the screen is partitioned into 32 units horizontally, 78 and 24 units vertically */ 79 80 /* these arrays have four members, for the four different visuals: 81 single, split, quad, unused */ 82 83 /* the offset of the view, in virtual units */ 84 float vp_x[4][4] = { { 0 }, { 1, 1 }, { 1, 16, 1, 16 }, { 10 } }; 85 float vp_y[4][4] = { { 0 }, { 0.5f, 12.5f }, { 1, 1, 12.5f, 12.5f }, { 4.5 } } ; 86 87 /* the width/height of the view, in virtual units */ 88 float vp_w[4][4] = { { 32 }, { 30, 30 }, { 14, 14, 14, 14 }, { 20 } }; 89 float vp_h[4][4] = { { 24 }, { 11.5f, 11.5f }, { 10.5f, 10.5f, 10.5f, 10.5f }, { 15 } }; 90 91 #ifdef DEPTH_SORT 92 int quadBufSize = 100; 93 Quad *quadBuf; 94 int *quadBufIndex; 95 #endif 96 97 int game_textures = TEX_COUNT + 5; /* 11 + 6 + debug texture */ 98 int n_textures = 11; 99 100 #ifndef GL_VERSION_1_2 101 # define GL_CLAMP_TO_EDGE GL_CLAMP 102 #endif 103 104 TextureInfo textures[] = { 105 { 1, "gltron_floor", GL_DONT_CARE, GL_REPEAT, GL_REPEAT, TEX_FLOOR, 64 }, 106 { 1, "gltron", GL_RGB, GL_REPEAT, GL_REPEAT, TEX_GUI, 1 }, 107 { 1, "gltron_logo", GL_RGBA, 108 GL_CLAMP_TO_EDGE, GL_CLAMP_TO_EDGE, TEX_LOGO, 1 }, 109 { 1, "gltron_wall_1", GL_DONT_CARE, 110 GL_REPEAT, GL_CLAMP_TO_EDGE, TEX_WALL1, 1 }, 111 { 1, "gltron_wall_2", GL_DONT_CARE, 112 GL_REPEAT, GL_CLAMP_TO_EDGE, TEX_WALL2, 1 }, 113 { 1, "gltron_wall_3", GL_DONT_CARE, 114 GL_REPEAT, GL_CLAMP_TO_EDGE, TEX_WALL3, 1 }, 115 { 1, "gltron_wall_4", GL_DONT_CARE, 116 GL_REPEAT, GL_CLAMP_TO_EDGE, TEX_WALL4, 1 }, 117 { 1, "gltron_trail", GL_RGBA, 118 GL_CLAMP_TO_EDGE, GL_CLAMP_TO_EDGE, TEX_TRAIL, 1 }, 119 { 1, "gltron_traildecal", GL_RGBA, 120 GL_REPEAT, GL_CLAMP_TO_EDGE, TEX_DECAL, 1 }, 121 { 6, "skybox", GL_RGB, 122 GL_CLAMP_TO_EDGE, GL_CLAMP_TO_EDGE, TEX_SKYBOX, 1 }, 123 { 1, "gltron_impact", GL_RGBA, GL_REPEAT, GL_CLAMP_TO_EDGE, TEX_IMPACT, 1 }, 124 125 }; 126 127 float shadow_color[] = { 0, 0, 0, .8f }; 128 129 #define LX 2.0f 130 #define LY 2.0f 131 float shadow_matrix[] = { LX * LY, 0, 0, 0, 132 0, LX * LY, 0, 0, 133 -LY, -LX, 0, 0, 134 0, 0, 0, LX * LY }; 135 #undef LX 136 #undef LY 137 138 139