src/tron/gFloor.cpp

Go to the documentation of this file.
00001 /*
00002 
00003 *************************************************************************
00004 
00005 ArmageTron -- Just another Tron Lightcycle Game in 3D.
00006 Copyright (C) 2000  Manuel Moos (manuel@moosnet.de)
00007 
00008 **************************************************************************
00009 
00010 This program is free software; you can redistribute it and/or
00011 modify it under the terms of the GNU General Public License
00012 as published by the Free Software Foundation; either version 2
00013 of the License, or (at your option) any later version.
00014 
00015 This program is distributed in the hope that it will be useful,
00016 but WITHOUT ANY WARRANTY; without even the implied warranty of
00017 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00018 GNU General Public License for more details.
00019 
00020 You should have received a copy of the GNU General Public License
00021 along with this program; if not, write to the Free Software
00022 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
00023   
00024 ***************************************************************************
00025 
00026 */
00027 
00028 #include "rSDL.h"
00029 
00030 #include "defs.h"
00031 #include "gStuff.h"
00032 #include "gLogo.h"
00033 #include "eFloor.h"
00034 #include "tConfiguration.h"
00035 #include "rScreen.h"
00036 
00037 
00038 // grid size
00039 static REAL sg_gridSize=1;
00040 static tSettingItem<REAL> g_s("GRID_SIZE",sg_gridSize);
00041 static REAL sg_gridSizeMoviePack=2;
00042 static tSettingItem<REAL> g_sm("GRID_SIZE_MOVIEPACK",sg_gridSizeMoviePack);
00043 
00044 static REAL moviepack_floor_red=.5,moviepack_floor_green=.5,moviepack_floor_blue=.5;
00045 static REAL floor_red=.15,floor_green=.3,floor_blue=.15;
00046 
00047 static tSettingItem<REAL>
00048 mfr("MOVIEPACK_FLOOR_RED",moviepack_floor_red),
00049 mfg("MOVIEPACK_FLOOR_GREEN",moviepack_floor_green),
00050 mfb("MOVIEPACK_FLOOR_BLUE",moviepack_floor_blue),
00051 fr("FLOOR_RED",floor_red),
00052 fg("FLOOR_GREEN",floor_green),
00053 fb("FLOOR_BLUE",floor_blue);
00054 
00055 #ifndef DEDICATED
00056 #include "rTexture.h"
00057 #include "rRender.h"
00058 #include "uMenu.h"
00059 #include "tSysTime.h"
00060 
00061 #include "nConfig.h"
00062 /*
00063 static tString lala_floor_a("Anonymous/original/textures/floor_a.png");
00064 static nSettingItem<tString> lalala_floor_a("TEXTURE_FLOOR_A", lala_floor_a);
00065 rFileTexture floor_a(rTextureGroups::TEX_FLOOR, lala_floor_a, 1,1);
00066 
00067 static tString lala_floor_b("Anonymous/original/textures/floor_b.png");
00068 static nSettingItem<tString> lalala_floor_b("TEXTURE_FLOOR_B", lala_floor_b);
00069 rFileTexture floor_b(rTextureGroups::TEX_FLOOR, lala_floor_b, 1,1);
00070 
00071 static tString lala_mp_floor_a("Anonymous/original/moviepack/floor_a.png");
00072 static nSettingItem<tString> lalala_mp_floor_a("TEXTURE_MP_FLOOR_A", lala_mp_floor_a);
00073 rFileTexture mp_floor_a(rTextureGroups::TEX_FLOOR, lala_mp_floor_a, 1,1,true);
00074 
00075 static tString lala_mp_floor_b("Anonymous/original/moviepack/floor_b.png");
00076 static nSettingItem<tString> lalala_mp_floor_b("TEXTURE_MP_FLOOR_B", lala_mp_floor_b);
00077 rFileTexture mp_floor_b(rTextureGroups::TEX_FLOOR, lala_mp_floor_b, 1,1,true);
00078 
00079 static tString lala_floor("Anonymous/original/textures/floor.png");
00080 static nSettingItem<tString> lalala_floor("TEXTURE_FLOOR", lala_floor);
00081 rFileTexture ArmageTron_floor(rTextureGroups::TEX_FLOOR, lala_floor, 1,1);
00082 
00083 static tString lala_mp_floor("Anonymous/original/moviepack/floor.png");
00084 static nSettingItem<tString> lalala_mp_floor("TEXTURE_MP_FLOOR", lala_mp_floor);
00085 rFileTexture ArmageTron_mp_floor(rTextureGroups::TEX_FLOOR, lala_mp_floor, 1,1);
00086 */
00087 
00088 static rFileTexture floor_a(rTextureGroups::TEX_FLOOR,"textures/floor_a.png",1,1);
00089 static rFileTexture floor_b(rTextureGroups::TEX_FLOOR,"textures/floor_b.png",1,1);
00090 static rFileTexture mp_floor_a(rTextureGroups::TEX_FLOOR,"moviepack/floor_a.png",1,1);
00091 static rFileTexture mp_floor_b(rTextureGroups::TEX_FLOOR,"moviepack/floor_b.png",1,1);
00092 rFileTexture ArmageTron_floor(rTextureGroups::TEX_FLOOR,"textures/floor.png",1,1);
00093 rFileTexture ArmageTron_mp_floor(rTextureGroups::TEX_FLOOR,"moviepack/floor.png",1,1);
00094 
00095 class gFloor: public eFloor{
00096 public:
00097     gFloor(){};
00098     virtual ~gFloor(){};
00099 
00100     virtual void glFloorColor(REAL alpha, REAL intens){
00101         if (!sr_glOut)
00102             return;
00103 
00104         REAL r, g, b;
00105         FloorColor(r, g, b);
00106         renderer->Color(r, g, b, alpha);
00107     }
00108 
00109     virtual void FloorColor(REAL& r, REAL& g, REAL&b){
00110         if (sg_MoviePack())
00111         {
00112             r = moviepack_floor_red;
00113             g = moviepack_floor_green;
00114             b = moviepack_floor_blue;
00115         }
00116         else
00117         {
00118             r = floor_red;
00119             g = floor_green;
00120             b = floor_blue;
00121         }
00122     }
00123 
00124 
00125     virtual void glFloorTexture(){
00126         if (sg_MoviePack())
00127             ArmageTron_mp_floor.Select();
00128         else
00129             ArmageTron_floor.Select();
00130     }
00131 
00132     virtual void glFloorTexture_a(){
00133         if (sg_MoviePack())
00134             mp_floor_a.Select();
00135         else
00136             floor_a.Select();
00137     }
00138 
00139     virtual void glFloorTexture_b(){
00140         if (sg_MoviePack())
00141             mp_floor_b.Select();
00142         else
00143             floor_b.Select();
00144     }
00145 
00146     virtual REAL GridSize(){
00147         if (sg_MoviePack())
00148             return sg_gridSizeMoviePack;
00149         else
00150             return sg_gridSize;
00151     }
00152 
00153     virtual bool BlackSky(){
00154         return sg_MoviePack();
00155     }
00156 
00157 };
00158 
00159 static gFloor GFLOOR;
00160 
00161 static void MenuBackground(){
00162     if (rTextureGroups::TextureMode[rTextureGroups::TEX_FLOOR]>=0){
00163         se_glFloorTexture();
00164         se_glFloorColor(1,1);
00165 
00166         REAL x=tSysTimeFloat()/3.0;
00167         REAL y=tSysTimeFloat()/5.0;
00168         REAL width=16;
00169         REAL height=12;
00170 
00171         static GLfloat tm[4][4]={{.8,.2,0,0},
00172                                  {-.2,.8,0,0},
00173                                  {0,0,1,0},
00174                                  {0,0,0,1}};
00175 
00176         TexMatrix();
00177         glLoadMatrixf(&tm[0][0]);
00178 
00179         glScalef((REAL)sr_screenWidth/sr_screenHeight/4. * 3., 1., 1.);
00180 
00181 
00182         BeginQuads();
00183 
00184         glTexCoord2d(x,y);
00185         glVertex2f(-1,-1);
00186 
00187         glTexCoord2d(x+width,y);
00188         glVertex2f(1,-1);
00189 
00190         glTexCoord2d(x+width,y-height);
00191         glVertex2f(1,1);
00192 
00193         glTexCoord2d(x,y-height);
00194         glVertex2f(-1,1);
00195 
00196         RenderEnd();
00197 
00198         TexMatrix();
00199         glLoadIdentity();
00200     }
00201 
00202     gLogo::Display();
00203 }
00204 
00205 static uCallbackMenuBackground backgr(&MenuBackground);
00206 
00207 #endif

Generated on Sat Mar 15 22:56:07 2008 for Armagetron Advanced by  doxygen 1.5.4