| 1 | /*************************************************************************** |
| 2 | main.h - description |
| 3 | ------------------- |
| 4 | begin : may 28th, 2003 |
| 5 | copyright : (C) 2003-2008 by Duong Khang NGUYEN |
| 6 | email : neoneurone @ gmail com |
| 7 | |
| 8 | $Id: main.h 467 2014-04-18 17:25:19Z neoneurone $ |
| 9 | ***************************************************************************/ |
| 10 | |
| 11 | /*************************************************************************** |
| 12 | * * |
| 13 | * This program is free software; you can redistribute it and/or modify * |
| 14 | * it under the terms of the GNU General Public License as published by * |
| 15 | * the Free Software Foundation; either version 2 of the License, or * |
| 16 | * any later version. * |
| 17 | * * |
| 18 | ***************************************************************************/ |
| 19 | |
| 20 | |
| 21 | #ifndef _OPENCITY_MAIN_H_ |
| 22 | #define _OPENCITY_MAIN_H_ 1 |
| 23 | |
| 24 | #ifndef __WIN32__ |
| 25 | #ifdef HAVE_CONFIG_H |
| 26 | #include "config.h" // Checks for headers generated by configure |
| 27 | #endif |
| 28 | #else |
| 29 | #include "../win32/config.h" |
| 30 | #endif |
| 31 | |
| 32 | /* for reference, included by "SDL_opengl.h" |
| 33 | #include <GL/gl.h> // OpenGL |
| 34 | #include <GL/glu.h> |
| 35 | *--- |
| 36 | Under Windows, OpenGL 1.2 & 1.3 functionalities are not defined. |
| 37 | They are treated as extensions, that's why we have the following lines |
| 38 | Without this, glEnable( GL_RESCALE_NORMAL ) doesn't work under win32 |
| 39 | ----* |
| 40 | #ifdef __WIN32__ |
| 41 | #include <GL/glext.h> |
| 42 | #endif |
| 43 | |
| 44 | // Use glext prototypes from SDL library |
| 45 | #if defined(__WIN32__) && !defined(GL_GLEXT_PROTOTYPES) |
| 46 | #define GL_GLEXT_PROTOTYPES 1 |
| 47 | #endif |
| 48 | */ |
| 49 | |
| 50 | /* for reference, included by GCC's option "-ansi" |
| 51 | #ifndef __STRICT_ANSI__ |
| 52 | #define __STRICT_ANSI__ 1 // Let's stay with the standard |
| 53 | // This avoids "long long" from SDL.h |
| 54 | #endif |
| 55 | */ |
| 56 | |
| 57 | #include "SDL.h" // Simple Directmedia Library |
| 58 | #include "SDL_thread.h" // Portable thread |
| 59 | #include "SDL_opengl.h" // Portable OpenGL headers |
| 60 | |
| 61 | #include <string> // New standard not something.h ok ? |
| 62 | using std::string; |
| 63 | |
| 64 | #include "macros.h" // Our macros |
| 65 | #include "enum.h" // Our enums |
| 66 | |
| 67 | class UI; |
| 68 | |
| 69 | |
| 70 | // OpenCity's types --> for future releases and porting work |
| 71 | #define OC_SHORT short int |
| 72 | #define OC_USHORT short unsigned int |
| 73 | |
| 74 | #define OC_INT int |
| 75 | #define OC_UINT unsigned int |
| 76 | |
| 77 | #define OC_LINT long int |
| 78 | #define OC_ULINT unsigned long int |
| 79 | |
| 80 | #define OC_CHAR char |
| 81 | #define OC_UCHAR unsigned char |
| 82 | #define OC_BYTE unsigned char |
| 83 | |
| 84 | #define OC_FLOAT float |
| 85 | |
| 86 | #define OC_DATE int |
| 87 | |
| 88 | // game default parameters |
| 89 | #define OC_FUND_START 15000 |
| 90 | #define OC_R_INCOME_TAX 8 |
| 91 | #define OC_C_INCOME_TAX 8 |
| 92 | #define OC_I_INCOME_TAX 9 |
| 93 | #define OC_INCOME_HELP 10 // let's say this is government help ;) |
| 94 | |
| 95 | #define OC_MAP_HEIGHT_MAX 10 |
| 96 | #define OC_MAP_HEIGHT_MIN -10 |
| 97 | |
| 98 | #define OC_CITY_W 100 // Watch out ! if you change this you must change |
| 99 | #define OC_CITY_L 100 // the value of OC_SIMULATOR_LAG* too, |
| 100 | // It's dangerous ! |
| 101 | // Don't touch it if you don't know what you do |
| 102 | |
| 103 | #define OC_CHANCE_COUNTER_MAX 300 // help the random method to find a structure |
| 104 | // should be equal to 3% of city surface |
| 105 | |
| 106 | // Sound & Music list file's name |
| 107 | #define OC_MUSIC_LIST_FILENAME "music/music.m3u" |
| 108 | #define OC_SOUND_LIST_FILENAME "sound/sound.m3u" |
| 109 | |
| 110 | // OpenCity's config file |
| 111 | #define OC_GRAPHISM_FILE_FILENAME "config/graphism.conf" |
| 112 | |
| 113 | // Simulators' defines. |
| 114 | // Bad values can block your system, don't change them ! |
| 115 | #define OC_MS_PER_FRAME 10 // Milliseconds delay per frame |
| 116 | #define OC_MS_PER_DAY 1750 // Milliseconds delay per day |
| 117 | #define OC_MS_GLOBAL_LOG_FACTOR 500 |
| 118 | #define OC_MS_STRUCTURE_LOG_FACTOR 400 |
| 119 | |
| 120 | // Color defines |
| 121 | #define OC_CLEAR_COLOR .0, .0, 0.25, 1.0 |
| 122 | #define OC_RED_COLOR 255, 0, 0 |
| 123 | #define OC_GREEN_COLOR 0, 255, 0 |
| 124 | #define OC_BLUE_COLOR 0, 0, 255 |
| 125 | #define OC_YELLOW_COLOR 255, 255, 0 |
| 126 | #define OC_PINK_COLOR 255, 0, 255 |
| 127 | #define OC_WHITE_COLOR 255, 255, 255 |
| 128 | #define OC_BLACK_COLOR 0, 0, 0 |
| 129 | |
| 130 | #define OC_LIGHT_MODEL_AMBIENT 0.7, 0.7, 0.7, 1.0 |
| 131 | |
| 132 | |
| 133 | |
| 134 | /*=====================================================================*/ |
| 135 | /* GLOBAL FUNCTIONS */ |
| 136 | /*=====================================================================*/ |
| 137 | |
| 138 | //======================================================================== |
| 139 | /** Prefix the specified path "s" with the data home directory |
| 140 | \param s The path to be prefixed |
| 141 | \return The modified path |
| 142 | */ |
| 143 | string ocDataDirPrefix( const string& s ); |
| 144 | |
| 145 | string ocConfigDirPrefix( const string& s ); |
| 146 | |
| 147 | |
| 148 | //======================================================================== |
| 149 | /** Prefix the specified path "s" with the save directory |
| 150 | \param s The path to be prefixed |
| 151 | \return The modified path |
| 152 | */ |
| 153 | string ocSaveDirPrefix( const string& s ); |
| 154 | |
| 155 | |
| 156 | //======================================================================== |
| 157 | /** Get the current version of the application as a string value. |
| 158 | \return The string value of the current version. |
| 159 | */ |
| 160 | string ocStrVersion(); |
| 161 | |
| 162 | |
| 163 | //======================================================================== |
| 164 | /** Get the current version of the application as a long value. |
| 165 | \return The long value of the current version. |
| 166 | */ |
| 167 | long ocLongVersion(); |
| 168 | |
| 169 | |
| 170 | /*=====================================================================*/ |
| 171 | /* MAIN FUNCTIONS */ |
| 172 | /*=====================================================================*/ |
| 173 | void ocRestart(); |
| 174 | void ocQuit( const int = 0 ); |
| 175 | void ocSetNewUI( UI* ); |
| 176 | |
| 177 | |
| 178 | #endif |
| 179 | |
| 180 | |
| 181 | |
| 182 | |
| 183 | |
| 184 | |
| 185 | |
| 186 | |
| 187 | |
| 188 | |
| 189 | |
| 190 | |
| 191 | |
| 192 | |
| 193 | |
| 194 | |
| 195 | |
| 196 | |
| 197 | |
| 198 | |
| 199 | |
| 200 | |
| 201 | |
| 202 | |
| 203 | |
| 204 | |
| 205 | |
| 206 |