1 /* 2 * DESCRIPCION DEL JUEGO 3 * Copyright (C) 2007 Javier P�rez Pacheco 4 * 5 * Este juego tienen licencia Creative Commons y se permite 6 * su modificacion y utilizacion libremente siempre y cuando se 7 * cite al autor original y se comparta con la misma licencia. 8 * No se permite su uso comercial. 9 * 10 * Para mas informacion visite la web: 11 * http://creativecommons.org/licenses/by-nc-sa/2.0/es/ 12 * 13 * PROGRAMADOR 14 * Javier P�rez Pacheco 15 * Cadiz (Spain) 16 * javielinux@gmail.com 17 * 18 * GRAFISMO Y 3D 19 * Jesus Carrasco 20 * Cadiz (Spain) 21 * carrasco.carrasco@gmail.com 22 * 23 * MUSICA Y GRAFISMO 24 * Shano Lores 25 * Cadiz (Spain) 26 * shanakla@gmail.com 27 * 28 */ 29 30 #ifndef CLASSEDITGAME_H_ 31 #define CLASSEDITGAME_H_ 32 33 #include "martian.h" 34 #include "defines_game.h" 35 #include "scene_editgame.h" 36 #include "scene_createmissions.h" 37 #include "scene_infotown.h" 38 #include "class_game.h" 39 #include "elements.h" 40 41 using namespace std; 42 using namespace Martian; 43 44 void parseEditScreenXML(char fileXML[128]); 45 46 class SceneEditGame; 47 48 49 class EditDoor : public Door { 50 51 public: 52 53 EditDoor(); 54 ~EditDoor (); 55 bool setForcePosition(BoardPosition p); 56 bool setForcePosition(int x, int y); 57 unLoad()58 void unLoad() { } 59 }; 60 61 class EditScenary : public Scenary { 62 63 public: 64 EditScenary(); 65 ~EditScenary (); 66 67 void setTypeTiled(int t); 68 void setTypeTerrain(int t); 69 void setTypeWall(int t); 70 71 void draw(); 72 void drawScenaryClosed(); 73 void drawScenaryOpened(); 74 void paintTiled(); 75 unLoad()76 void unLoad() { } 77 78 }; 79 80 typedef struct 81 { 82 string title1; 83 string text1; 84 string title2; 85 string text2; 86 string distanceSecondText; 87 string lang; 88 } EditMap; 89 90 class EditBoard : public Group { 91 92 private: 93 static EditBoard *instance; 94 EditBoard(); 95 96 SceneEditGame *sceneeditgame; 97 98 EditScenary *scenary; 99 EditDoor *door; 100 ElementIsometric *ghost; 101 ElementIsometric *nimuh; 102 ElementIsometric *enemy1, *enemy2, *enemy3; 103 ElementIsometric *floorOn; 104 Element *floor0, *floor1; 105 Element *trap; 106 107 int typeFloor; 108 int rows, cols; 109 int indexz; 110 111 int typeMusic; 112 113 ElementIsometric *wallBottom; 114 ElementIsometric *wallRight; 115 int typeWall; 116 117 Element *floorShadow; 118 119 BoardPosition posBegPlayer, posBegEnemy1, posBegEnemy2, posBegEnemy3, posExit; 120 Walls walls[MAX_TILES_INLINE*MAX_TILES_INLINE]; 121 122 int typeSize; 123 124 bool hasEnemy1; 125 bool hasEnemy2; 126 bool hasEnemy3; 127 128 BoardPosition posTrap; 129 bool hasTrap; 130 131 ElementIsometric *tray; 132 bool hasTray; 133 134 ElementIsometric *blackHole0, *blackHole1; 135 bool hasBlackHole0, hasBlackHole1; 136 137 ElementIsometric *doorKeyBottom, *doorKeyRight, *key; 138 string directionKey; 139 bool hasKey; 140 141 Element *pavementTop, *pavementBottom; 142 int typePavement; 143 144 145 public: 146 147 bool multiLanguage; 148 149 bool wallsOfLevel; 150 bool terrainOfLevel; 151 bool wallScennaryOfLevel; 152 bool musicOfLevel; 153 bool pavementOfLevel; 154 bool floorOfLevel; 155 bool tiledOfLevel; 156 157 vector<InformationTown> infoTown; 158 string helpName; 159 Town town; 160 vector<InfoTray> infoTray; 161 162 bool hasMap; 163 string fileFromDataMap; 164 string fileFromLevelMap; 165 vector<EditMap> map; 166 167 static EditBoard * GetInstance (); 168 getScenary()169 EditScenary* getScenary() { return scenary; } 170 171 ~EditBoard (); 172 173 void load(); 174 void loadLevel(); 175 bool save(); 176 void clear(); 177 setSceneEditGame(SceneEditGame * s)178 void setSceneEditGame(SceneEditGame *s) { sceneeditgame = s; } getSceneEditGame()179 SceneEditGame* getSceneEditGame() { return sceneeditgame; } 180 181 void setTypeSize(int t); getTypeSize()182 int getTypeSize() { return typeSize; } 183 void setTypeFloor(int t); 184 void setTypeWall(int t); 185 void setTypePavement(int t); 186 187 bool verifyHasObject(string obj, BoardPosition p); 188 setTypeMusic(int t)189 void setTypeMusic(int t) { typeMusic = t; } getTypeMusic()190 int getTypeMusic() { return typeMusic; } 191 setCols(int c)192 void setCols(int c) { cols = c; } getCols()193 int getCols() { return cols; } setRows(int r)194 void setRows(int r) { rows = r; } getRows()195 int getRows() { return rows; } 196 BoardPosition getPositionMouse(); 197 bool positionIsOnBoard(BoardPosition p); 198 bool verifyPositions(BoardPosition p1, BoardPosition p2); 199 int referencePositions(BoardPosition p1, BoardPosition p2); 200 getPositionFromXY(int x,int y)201 BoardPosition getPositionFromXY(int x, int y) { BoardPosition p; p.x=x; p.y=y; p.out = !Board::GetInstance()->positionIsOnBoard(p); return p; } 202 203 void verifyMouseOnBoard(); 204 void verifyClickOnBoard(); 205 void verifyUnClickOnBoard(); 206 207 /********************* 208 * SURFACE 209 **********************/ 210 void draw(); setIndexZ(int z)211 void setIndexZ (int z) { indexz = z; } getIndexZ()212 int getIndexZ () { return indexz; } 213 /********************* 214 * ELEMENTS 215 **********************/ 216 BoardPosition getPositionPlayer(); 217 BoardPosition getPositionEnemy1(); 218 BoardPosition getPositionEnemy2(); 219 BoardPosition getPositionEnemy3(); 220 void setBlackHole0(int x, int y); 221 void setBlackHole1(int x, int y); 222 void setKey(int x, int y); 223 void setDoorKey(int x, int y, string dk); 224 void setPositionPlayer(int x, int y); 225 void setPositionEnemy1(int x, int y); 226 void setPositionEnemy2(int x, int y); 227 void setPositionEnemy3(int x, int y); 228 void setPositionExit(int x, int y); 229 void setPositionTrap(int x, int y); 230 void setPositionTray(int x, int y); 231 232 void cleanWalls(); 233 void cleanScenary(); 234 setWallBottom(int x,int y,bool state)235 void setWallBottom(int x, int y, bool state) { walls[(y*MAX_TILES_INLINE)+x].wallBottom = state; } setWallRight(int x,int y,bool state)236 void setWallRight(int x, int y, bool state) { walls[(y*MAX_TILES_INLINE)+x].wallRight = state; } hasWallBottom(int x,int y)237 bool hasWallBottom(int x, int y) { if (positionIsOnBoard(getPositionFromXY(x,y))) { return walls[(y*MAX_TILES_INLINE)+x].wallBottom; } else { return false; } } hasWallRight(int x,int y)238 bool hasWallRight(int x, int y) { if (positionIsOnBoard(getPositionFromXY(x,y))) { return walls[(y*MAX_TILES_INLINE)+x].wallRight; } else { return false; } } 239 240 bool hasWallBetweenCells(BoardPosition p1, BoardPosition p2); 241 242 void insertObject(BoardPosition p); 243 void changeGhost(); 244 245 void unLoad(); 246 247 }; 248 249 #endif /* CLASSEDITGAME_H_ */ 250