00001 00002 // 00003 // Das Tank - Copyright (C) 2006, 2007 Windsor Schmidt <windsor@windsorworld.net> 00004 // 00005 // This program is free software; you can redistribute it and/or modify it 00006 // under the terms of the GNU General Public License as published by the Free 00007 // Software Foundation; either version 2 of the License, or (at your option) 00008 // any later version. 00009 // 00010 // This program is distributed in the hope that it will be useful, but WITHOUT 00011 // ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 00012 // FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for 00013 // more details. 00014 // 00015 // You should have received a copy of the GNU General Public License along with 00016 // this program; if not, write to the Free Software Foundation, Inc., 59 Temple 00017 // Place, Suite 330, Boston, MA 02111-1307 USA 00018 // 00020 00021 00022 #define STDAFX 00023 #define WIN32_LEAN_AND_MEAN 00024 #define _CRT_SECURE_NO_DEPRECATE 00025 00026 //#define DEBUG_IMPATIENT 00027 00028 // constants 00029 #define PI 3.1415926535897932384626433 00030 #define SCREEN_WIDTH 1024 00031 #define SCREEN_HEIGHT 768 00032 #define TILEMAP_DISTANCE -0.01 00033 #define DAS_ERROR -1 00034 #define INTERACTION_MATRIX_SIZE 15 00035 00036 #define TANK_FCR_MEDIAL 0.01f 00037 #define TANK_FCR_LATERAL 0.05f 00038 #define MAX_TANK_SPEED 0.07f 00039 00040 #define RUN_FULLSCREEN 0 00041 #define NUM_PLAYERS 2 00042 #define PAGE_WIDTH 80 // used for credits scroller, screen width in text chars 00043 #define PAGE_HEIGHT 16 // screen height in text lines 00044 #define MAX_LEVELS 100 // total number of level files possible 00045 #define MAX_JOYSTICKS 4 // total number of joysticks possible 00046 #define DEFAULT_SFX_VOLUME 40 00047 #define DEFAULT_BGM_VOLUME 100 00048 #define TILEANIM_FADEOUT_TIME 1000 00049 #define DEFAULT_LINGER_TIME 2000 // time (ms) that TILEANIM effects stay on the screen 00050 00051 // rendering style types 00052 #define RENDERSTYLE_PERSPECTIVE 0 00053 #define RENDERSTYLE_FLAT 1 00054 00055 // animation system flags 00056 #define ANIM_CYCLE_ONESHOT 0 00057 #define ANIM_CYCLE_CYCLE 1 00058 #define DEFAULT_ANIMATION_SPEED 1000 // time to show each frame, in milliseconds 00059 00060 // general flags 00061 #define DRAW_BOUNDING_BOXES 0 00062 #define DEFAULT_RENDERSTYLE RENDERSTYLE_FLAT 00063 #define ENABLE_SOUND 1 00064 00065 // game defines / constants 00066 #define MAP_SIZE 16 // this squared = number of cells used for tile system 00067 #define PLAYFIELD_SIZE 32 // this squared = area of playfield (OpenGL units) 00068 #define CELL_SIZE PLAYFIELD_SIZE / MAP_SIZE 00069 #define DEFAULT_LIVES 1 00070 #define DEFAULT_HEALTH 1 00071 #define DEFAULT_DAMAGE 1 00072 #define DEFAULT_SUB_ANGLE 0 00073 #define DEFAULT_ANGLE 0 00074 #define DEFAULT_BB_LEFT -0.9 00075 #define DEFAULT_BB_RIGHT 0.9 00076 #define DEFAULT_BB_BOTTOM -0.9 00077 #define DEFAULT_BB_TOP 0.9 00078 #define DEFAULT_DRAW_LEFT -1 00079 #define DEFAULT_DRAW_RIGHT 1 00080 #define DEFAULT_DRAW_BOTTOM -1 00081 #define DEFAULT_DRAW_TOP 1 00082 #define DEFAULT_PS_AMMO -1 00083 #define DEFAULT_BS_AMMO 10 00084 #define DEFAULT_SB_AMMO 5 00085 #define DEFAULT_LM_AMMO 3 00086 #define DEFAULT_HS_AMMO 5 00087 00088 // limits 00089 #define MAX_HEALTH 100 00090 00091 // game starting states 00092 #define STARTINGSTATE_NULL 0 00093 #define STARTINGSTATE_IDLE 1 00094 #define STARTINGSTATE_READY 2 00095 #define STARTINGSTATE_SET 3 00096 #define STARTINGSTATE_GO 4 00097 #define STARTINGSTATE_RUN 5 00098 #define STARTINGSTATE_VICTORY 6 00099 00100 // interaction response IDs 00101 #define RESPONSE_NULL 0 00102 #define RESPONSE_COL_REFLECT_A 1 00103 #define RESPONSE_COL_REFLECT_B 2 00104 #define RESPONSE_COL_REFLECT_BOTH 3 00105 #define RESPONSE_COL_STOP_A 4 00106 #define RESPONSE_COL_STOP_B 5 00107 #define RESPONSE_COL_STOP_BOTH 6 00108 #define RESPONSE_COL_ELASTIC 7 00109 #define RESPONSE_COL_DAMPED 8 00110 #define RESPONSE_DMG_A 9 00111 #define RESPONSE_DMG_B 10 00112 #define RESPONSE_DMG_BOTH 11 00113 #define RESPONSE_EFF_EQUIP_A 12 00114 #define RESPONSE_EFF_EQUIP_B 13 00115 #define RESPONSE_DMG_KILL_A 14 00116 #define RESPONSE_DMG_KILL_B 15 00117 #define RESPONSE_DMG_KILL_BOTH 16 00118 00119 // player input IDs 00120 #define INPUT_NULL 0 00121 #define INPUT_LEFT 1 00122 #define INPUT_RIGHT 2 00123 #define INPUT_DOWN 3 00124 #define INPUT_UP 4 00125 #define INPUT_FIRE 5 00126 00127 // menu input IDs 00128 #define MENUINPUT_NULL 0 00129 #define MENUINPUT_LEFT 1 00130 #define MENUINPUT_RIGHT 2 00131 #define MENUINPUT_UP 3 00132 #define MENUINPUT_DOWN 4 00133 #define MENUINPUT_SELECT 5 00134 #define MENUINPUT_ESCAPE 6 00135 00136 // effect interaction matrix IDs 00137 #define MATRIXID_COLLISION 0 00138 #define MATRIXID_DAMAGE 1 00139 #define MATRIXID_EFFECT 2 00140 00141 // game object type IDs 00142 #define TYPEID_PEA_SHOT 0 00143 #define TYPEID_BOUNCY_SHOT 1 00144 #define TYPEID_SUPER_BULLET 2 00145 #define TYPEID_LAND_MINE 3 00146 #define TYPEID_HEAT_SEEKER 4 00147 #define TYPEID_POWERUP_HEALTH 5 00148 #define TYPEID_POWERUP_PS 6 00149 #define TYPEID_POWERUP_BS 7 00150 #define TYPEID_POWERUP_SB 8 00151 #define TYPEID_POWERUP_LM 9 00152 #define TYPEID_POWERUP_HS 10 00153 #define TYPEID_TNT_BLOCK 11 00154 #define TYPEID_WALL_BLOCK 12 00155 #define TYPEID_WOOD_BLOCK 13 00156 #define TYPEID_TANK 14 00157 #define TYPEID_NULL 15 // unused 00158 00159 // tile IDs 00160 #define TILEID_NULL 0 00161 #define TILEID_BLANK 1 00162 #define TILEID_DIRT 2 00163 #define TILEID_SAND 3 00164 #define TILEID_MUD 4 00165 #define TILEID_WATER 5 00166 #define TILEID_LAVA 6 00167 #define TILEID_ICE 7 00168 #define TILEID_TARMAC 8 00169 #define TILEID_GRASS 9 00170 00171 // tile effect IDs 00172 #define TILE_EFFECT_NULL 0 00173 #define TILE_EFFECT_DAMAGE 1 00174 00175 // tile defaults 00176 #define TILE_DAMAGE_LAVA 1 00177 #define TILE_EFFECT_TIMER 20 00178 #define TILE_SOUND_TIMER 250 00179 00180 // texture IDs 00181 #define TEXID_NULL 0 00182 #define TEXID_BLANK 1 00183 #define TEXID_DIRT 2 00184 #define TEXID_SAND 3 00185 #define TEXID_MUD 4 00186 #define TEXID_WATER 5 00187 #define TEXID_LAVA 6 00188 #define TEXID_ICE 7 00189 #define TEXID_TARMAC 8 00190 #define TEXID_GRASS 9 00191 #define TEXID_TANK 10 00192 #define TEXID_PEA_SHOT 11 00193 #define TEXID_BOUNCY_SHOT 12 00194 #define TEXID_SUPER_BULLET 13 00195 #define TEXID_LAND_MINE 14 00196 #define TEXID_HEAT_SEEKER 15 00197 #define TEXID_POWERUP_HEALTH 16 00198 #define TEXID_POWERUP_PS 17 00199 #define TEXID_POWERUP_BS 18 00200 #define TEXID_POWERUP_SB 19 00201 #define TEXID_POWERUP_LM 20 00202 #define TEXID_POWERUP_HS 21 00203 #define TEXID_TNT_BLOCK 22 00204 #define TEXID_WALL_BLOCK 23 00205 #define TEXID_CRATE 24 00206 #define TEXID_CHECKERBOARD 25 00207 #define TEXID_GRID 26 00208 #define TEXID_MENUBACK 27 00209 #define TEXID_EZRAS_HEAD 28 00210 00211 #define ANIMSTAGE_NULL 0 00212 #define ANIMSTAGE_INTRO 1 00213 #define ANIMSTAGE_NORMAL 2 00214 #define ANIMSTAGE_OUTRO 3 00215 00216 // animation IDs 00217 #define ANIMID_NULL 0 00218 #define ANIMID_TANKROLL 1 00219 #define ANIMID_GREENTANKEXPLODE 2 00220 #define ANIMID_BROWNTANKEXPLODE 3 00221 #define ANIMID_CRATECRUSH 4 00222 #define ANIMID_EXPLOSION 5 00223 #define ANIMID_GREEN_HOP_IN 6 00224 #define ANIMID_BROWN_HOP_IN 7 00225 00226 // weapon IDs 00227 #define WEAPONID_NULL 0 // unused 00228 #define WEAPONID_PEA_SHOT 1 00229 #define WEAPONID_BOUNCY_SHOT 2 00230 #define WEAPONID_SUPER_BULLET 3 00231 #define WEAPONID_LAND_MINE 4 00232 #define WEAPONID_HEAT_SEEKER 5 00233 00234 // tint color IDs 00235 #define TINTID_NULL 0 00236 #define TINTID_RED 1 00237 #define TINTID_ORANGE 2 00238 #define TINTID_YELLOW 3 00239 #define TINTID_GREEN 4 00240 #define TINTID_BLUE 5 00241 #define TINTID_PURPLE 6 00242 #define TINTID_ARMYGREEN 7 00243 #define TINTID_ARMYBROWN 8 00244 00245 00246 // CEffect IDs 00247 #define EFFECTID_NULL 0 00248 #define EFFECTID_PSYSTEM 1 00249 #define EFFECTID_SHOCKWAVE 2 00250 #define EFFECTID_TILEANIM 3 00251 #define EFFECTID_TILESTORM 4 00252 #define EFFECTID_MINISHOCK 5 00253 00254 // sound effect IDs 00255 #define SOUNDID_NULL 0 00256 #define SOUNDID_FIRE_PS 1 00257 #define SOUNDID_FIRE_BS 2 00258 #define SOUNDID_FIRE_SB 3 00259 #define SOUNDID_FIRE_LM 4 00260 #define SOUNDID_FIRE_HS 5 00261 #define SOUNDID_REFLECT 6 00262 #define SOUNDID_BIG_BOMB 7 00263 #define SOUNDID_EXPLOSION 8 00264 #define SOUNDID_RICOCHET 9 00265 #define SOUNDID_FIREMISSILE 10 00266 #define SOUNDID_PROXALERT 11 00267 #define SOUNDID_SCREAM 12 00268 #define SOUNDID_VICTORY 13 00269 #define SOUNDID_BURNING 14 00270 #define SOUNDID_AMMO 15 00271 #define SOUNDID_ENGINE 16 00272 #define SOUNDID_TURRET 17 00273 #define SOUNDID_ROCKETFLY 18 00274 #define SOUNDID_READY 19 00275 #define SOUNDID_SET 20 00276 #define SOUNDID_GO 21 00277 #define SOUNDID_MENUSELECT 22 00278 #define SOUNDID_CLICK 23 00279 #define SOUNDID_POWERUP_HEALTH 24 00280 #define SOUNDID_POWERUP 25 00281 #define SOUNDID_BOUNCE 26 00282 #define SOUNDID_HIT 27 00283 #define SOUNDID_CRUNCH 28 00284 00285 // music IDs 00286 #define MUSICID_NULL 0 00287 #define MUSICID_INGAME 1 00288 #define MUSICID_MENU 2 00289 #define MUSICID_VICTORY 3 00290 00291 // menu IDs 00292 #define MENUID_NULL 0 00293 #define MENUID_START 1 00294 #define MENUID_OPTIONS 2 00295 #define MENUID_HIGHSCORES 3 00296 #define MENUID_CREDITS 4 00297 #define MENUID_QUIT 5 00298 00299 // guichan includes 00300 #include <iostream> 00301 #include <guichan.hpp> 00302 #include <guichan/sdl.hpp> 00303 #include <guichan/opengl.hpp> 00304 #include <guichan/opengl/openglsdlimageloader.hpp> 00305 00306 // support includes 00307 #include "SDL.h" // SDL multimedia library 00308 #include "SDL_main.h" // SDL support library 00309 #include "bass.h" // BASS sound library 00310 #include "SDL_ttf.h" 00311 #include <gl\gl.h> // Header File For The OpenGL32 Library 00312 #include <gl\glu.h> // Header File For The GLu32 Library 00313 #include <glut.h> 00314 #include <math.h> 00315 #include <fstream> 00316 00317 // game includes 00318 #include "CAnimation.h" 00319 #include "Vector.h" 00320 #include "PSystem.h" 00321 #include "TileStorm.h" 00322 #include "TileAnim.h" 00323 #include "Shockwave.h" 00324 #include "MiniShock.h" 00325 #include "structs.h" 00326 #include "GameState.h" 00327 #include "main.h" 00328 #include "display.h" 00329 #include "sound.h" 00330 #include "credits.h" 00331 #include "menu.h" 00332 #include "game.h" 00333 #include "physics.h" 00334 #include "collision.h"
Copyright Windsor Schmidt 2006 - All rights reserved.