1 /* 2 Copyright (C) 2000 Xavier Hosxe <xhosxe@free.fr> 3 4 This program is free software; you can redistribute it and/or modify 5 it under the terms of the GNU General Public License as published by 6 the Free Software Foundation; either version 2 of the License, or 7 (at your option) any later version. 8 9 This program is distributed in the hope that it will be useful, 10 but WITHOUT ANY WARRANTY; without even the implied warranty of 11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 GNU General Public License for more details. 13 14 You should have received a copy of the GNU General Public License 15 along with this program; if not, write to the Free Software 16 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 17 */ 18 19 20 21 #ifndef __GLAXIUM_VARIABLES__ 22 #define __GLAXIUM_VARIABLES__ 23 24 25 #include <stdio.h> 26 27 #ifndef WIN32 28 #include "conf.h" 29 #else 30 #define random rand 31 #endif 32 33 34 #include <GL/gl.h> 35 #include <GL/glext.h> 36 #include "SDL.h" 37 38 #ifdef HAVE_LIBSDL_MIXER 39 #include "SDL_mixer.h" 40 #endif 41 #ifdef HAVE_LIBMIKMOD 42 #include "mikmod.h" 43 #endif 44 45 46 #define SCALE .12 47 48 #if !defined(PI) 49 #define PI 3.141592653589793 50 #endif 51 52 53 enum type_samples { 54 SAMPLE_WELCOME=0, 55 SAMPLE_TIR, 56 SAMPLE_EXPLODE1, 57 SAMPLE_EXPLODE2, 58 SAMPLE_TACHEFIRE, 59 SAMPLE_GLUPS, 60 SAMPLE_POWERUP, 61 SAMPLE_DETECTION, 62 SAMPLE_GAMEOVER, 63 SAMPLE_UNDEF 64 } ; 65 66 67 68 69 // Main class 70 class MyShip; 71 class ListSprite; 72 73 class GlaxiumVariables { 74 public: 75 static GlaxiumVariables* getGlaxiumVariables(); 76 static bool isExtensionSupported(const char *extension); 77 void initOptionsFile(bool bShad); 78 // public method 79 char* getFullPath(char *name); 80 char *getFullOptionsPath(); 81 // Must be called after GLvar initialisation 82 void initAllLists(); 83 bool myRandom(int i); 84 85 // global variables 86 float global_timeadjustment; 87 int global_pause; 88 MyShip* mySpaceShip; 89 int camera; 90 SDL_Joystick* joy; 91 char* installDir; 92 int height, width; 93 float rotateMyShip; 94 float delay; 95 bool bShadows; 96 bool bNVExtension; 97 bool bEXTEnvDot3; 98 bool bARBCubeMap ; 99 float fMaxAnis; 100 bool bSeparateSpecularColor; 101 int details; 102 103 104 // Texture 105 GLuint texture_letters; 106 GLuint texture_title[6]; 107 GLuint texture_fumee[3]; 108 GLuint texture_building; 109 GLuint texture_floor[5]; 110 GLuint texture_floorMap[5]; 111 GLuint texture_bandit1; 112 GLuint texture_bandit2; 113 GLuint texture_myship; 114 GLuint texture_piege; 115 GLuint texture_chaine; 116 GLuint texture_camouflage; 117 GLuint texture_tache; 118 GLuint texture_deadtache; 119 GLuint texture_sphere; 120 GLuint texture_gameover; 121 GLuint texture_board; 122 GLuint texture_galaxy; 123 GLuint texture_border; 124 GLuint texture_mark; 125 GLuint texture_thunder; 126 GLuint texture_specialeffect1; 127 GLuint texture_fire3; 128 GLuint texture_fighter2; 129 GLuint texture_capsule[4]; 130 131 132 // color 133 GLfloat *mat_ambient; 134 GLfloat *mat_specular; 135 GLfloat *light_position; 136 GLfloat *lm_ambient ; 137 GLfloat *lm_diffuse; 138 GLfloat *lm_specular; 139 GLfloat *blanc_diffuse; 140 GLfloat *nothing ; 141 GLfloat *jaune_diffuse; 142 GLfloat *jaune_diffuse_trans; 143 GLfloat *rouge_diffuse_trans; 144 GLfloat *jaune_diffuse_tres_trans; 145 GLfloat *bleu_diffuse_trans ; 146 GLfloat *rouge_diffuse ; 147 GLfloat *jaune_emission; 148 GLfloat *vert_diffuse; 149 GLfloat *bleu_diffuse; 150 GLfloat *bleu_clair_diffuse; 151 GLfloat *gris_diffuse ; 152 GLfloat *gris2_diffuse ; 153 GLfloat *marron_diffuse; 154 GLfloat *noir_diffuse; 155 GLfloat *shadowMatrix; 156 157 158 // Nvidia Hardware Dependent 159 // Number of teture unit 160 int m_nTextureUnits; 161 // Number of register combiners 162 int m_nRegisterCombiners; 163 164 // Modules and samples 165 #ifdef HAVE_LIBMIKMOD 166 MODULE *module1,*module2; 167 SAMPLE *samples[SAMPLE_UNDEF]; 168 #endif 169 #ifdef HAVE_LIBSDL_MIXER 170 Mix_Music *module1, *module2; 171 Mix_Chunk *samples[SAMPLE_UNDEF]; 172 #endif 173 174 175 char **fileSample; 176 177 // Stars 178 #define SPACE 4 179 char *space_name[SPACE]; 180 GLfloat *pos_space ; 181 GLuint texture_space[SPACE]; 182 183 private: 184 GlaxiumVariables(); 185 void initTextures(); 186 void initSound(); 187 void initTexture(GLuint &textureToBind, char* path); 188 void initJoystick(); 189 void initVariables(); 190 void initInstallDir(); 191 192 // private variables 193 194 }; 195 196 extern GlaxiumVariables* GLvar; 197 198 #endif 199