00001 #ifndef sw_GameH
00002 #define sw_GameH
00003
00004 #include "sw_Level.h"
00005 #include "sw_Player.h"
00006 #include "sw_Object.h"
00007 #include "sw_Obstacle.h"
00008 #include "sw_IniFile.h"
00009 #include "sw_globals.h"
00010 #include "sw_utilities.h"
00011 #include "sw_MD2.h"
00012 #include <Windows.h>
00013
00014
00015 struct TChairLift {
00016 CObstacle *Obstacle;
00017 GLint ObstacleIndex;
00018 };
00019
00020 struct TAnimatedModel {
00021 MD2 *Model;
00022 GLfloat x,z,RotX,RotY;
00023 };
00024
00039 class CGame
00040 {
00041 private:
00042 CLevel Level;
00043 CPlayer Player;
00044 CObstacle Obstacles[700];
00045 CObstacle ChairObstacle;
00046 TChairLift ChairLift[100];
00047 TPairOfGuides POGuides[100];
00048 TChair Chairs[80];
00049
00050 TPairOfGuides StartPairGuide,FinishPairGuide;
00051 CMatrix ModelViewMatrix;
00052 CIniFile *IniFile;
00053 TMaterial RedMaterial,BlueMaterial,NoShineMaterial;
00054
00055 GLint ObstacleCount,LookRowDistance,POGuideCount,POGuideIndex,ChairLiftCount,
00056 ShowObstaclesStartIndex,ShowObstaclesEndIndex,StartObstacleIndex,FinishObstacleIndex,
00057 ChairCount,ShowObstaclesStartIndex_AtLastGuide,ShowObstaclesEndIndex_AtLastGuide,
00058 AnimatedModelCount;
00059
00060 CObject Fence1,Fence2,Mast,Chair,Rock1,Rock2,Rock3,Rock4,Sign1,Guide,Ice,StartGuide,FinishGuide,Tree;
00061 MD2 GruntModel;
00062 TAnimatedModel AnimatedModels[100];
00063 LARGE_INTEGER Frequency,StartTime,StartTurning;
00064 GLuint SkyboxTexID[4];
00065 bool TurningLeft,TurningRight,Started,PanoramaMode;
00066 GLfloat Back,Up,Side,PositionZ,PositionX,LevelzStride;
00067
00068 GLint LoadSkyTexture(GLuint *ID,char *filename);
00069 GLvoid RenderSkybox();
00070 GLvoid RenderObstacles(RenderMode rm);
00071 GLvoid RenderChairLift(RenderMode rm);
00072
00073 GLvoid SetModelViewMatrix(TPoint3 pos,CVector3 v);
00074 GLvoid AddAnimatedModel(MD2 *object,GLfloat x,GLfloat z,GLfloat RotX,GLfloat RotY);
00075 GLint AddObstacle(CObject *object,ObstacleType p_ObstacleType,GLfloat x,GLfloat z,GLfloat Scale,GLint Width,GLfloat RotX,GLfloat RotY,TMaterial *Mat=(TMaterial*)(0));
00076 GLvoid SetMaterial(TMaterial *M,GLfloat AmbDiff0,GLfloat AmbDiff1,GLfloat AmbDiff2,GLfloat AmbDiff3,GLfloat Spec0,GLfloat Spec1,GLfloat Spec2,GLfloat Spec3,GLfloat Shine);
00077 long isCollision();
00078 public:
00079 bool Finish,MissedGuide,PassedStartGuide,PassedFinishGuide;
00080
00081 char CollInfo[100];
00082
00083 CGame();
00084 ~CGame();
00085
00090 GLvoid Initialize();
00091
00102 GLint LoadLevel(char *filename,char *snow_filename,char *ice_filename,char *grass_filename);
00103
00109 GLint LoadPlayerModel(char *filename);
00110
00115 GLint LoadObstacles();
00116
00117
00127 GLint LoadSkybox(char *front_filename,char *top_filename,char *left_filename,char *right_filename);
00128
00135 GLint LoadObstacleMap(char *filename);
00136
00140 GLvoid SetIniFile(CIniFile *p_IniFile);
00141
00148 GLvoid Render(RenderMode rm);
00149
00154 GLvoid Move(MoveType p_Move);
00155
00162 GLvoid StopTurning(MoveType p_Move);
00163
00166 GLvoid Start();
00167
00170 GLvoid Stop();
00171
00180 GLvoid ChangeCameraPosition(GLint Parameter,GLfloat Increment);
00181
00184 GLvoid ResetCameraPosition();
00185
00186 GLvoid RenderPanorama(RenderMode rm);
00187 GLvoid StartPanorama();
00188 GLvoid MoveChairs();
00189 };
00190
00191
00192 #endif