00001
00025 #ifndef _HCLEVEL_
00026 #define _HCLEVEL_
00027
00028 #define LO_VACUUM 0 // nic
00029 #define LO_WALL 1 // zed
00030 #define LO_WAY 2 // pruchodna cesta
00031 #define LO_TARGET 3 // cil
00032 #define LO_CRATE 4 // bedna
00033 #define LO_START 5 // startovni pozice
00034 #define LO_CRATE_TARGET 6 // box v cili
00035 #include "GameObject3D.h"
00036 #include "Plane.h"
00037
00038 class CLevel: public CGameObject3D {
00039
00040 public:
00041
00042 typedef struct SActor {
00043 CGameObject3D* object;
00044 int positionX;
00045 int positionZ;
00046 } SACTOR;
00047
00048 typedef struct SLevelObjects {
00049 CGameObject3D* m_pTarget;
00050 CGameObject3D* m_pBox;
00051 CGameObject3D* m_pCrate;
00052 SActor m_actor;
00053 } SLEVELOBJECTS;
00054
00055 CLevel();
00056 ~CLevel();
00057
00058 void render();
00059 void update() {
00060 }
00061 ;
00062
00063 void setWallTexId(int num, int texId) {
00064 if (num < 6) {
00065 walls[num].setTextureId(texId);
00066 }
00067 }
00068 ;
00069 void setCrateTexId(int texId);
00070 void setBoxTexId(int texId);
00071 void setDoorsTex(int texId) {
00072 doors.setTextureId(texId);
00073 }
00074 ;
00075 void setWindow(int texId) {
00076 window.setTextureId(texId);
00077 }
00078 ;
00079
00080 void createMap(int** map, int width, int length, int playerPositionX,
00081 int playerPositionZ);
00082
00083 bool moveActorTo(int x, int y);
00084 bool isFinished() {
00085 return m_finished;
00086 }
00087 ;
00088
00089 void clearMap();
00090
00094 int getActorTurns() const {
00095 return m_actorTurns;
00096 }
00097
00098 private:
00099
00100 void setPlayerPosition(int x, int y);
00101 int getPlayerPositionX() {
00102 return m_objects.m_actor.positionX;
00103 }
00104 ;
00105 int getPlayerPositionY() {
00106 return m_objects.m_actor.positionZ;
00107 }
00108 ;
00109
00110 string m_levelName;
00111
00112
00113 CGOPlane walls[6];
00114 CGOPlane doors;
00115 CGOPlane window;
00116
00117 int** m_map;
00118
00119 int m_mapWidth;
00120 int m_mapLength;
00121 int m_countTargets;
00122 bool m_finished;
00123
00124 SACTOR m_pActor;
00125 int m_actorTurns;
00126
00127 SLevelObjects m_objects;
00128
00129 };
00130
00131 #endif
00132