1 /*
2 Copyright (C) 2004-2011 Parallel Realities
3 Copyright (C) 2011-2015 Perpendicular Dimensions
4 
5 This program is free software; you can redistribute it and/or
6 modify it under the terms of the GNU General Public License
7 as published by the Free Software Foundation; either version 2
8 of the License, or (at your option) any later version.
9 
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
13 
14 See the GNU General Public License for more details.
15 
16 You should have received a copy of the GNU General Public License
17 along with this program; if not, write to the Free Software
18 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
19 
20 */
21 
22 class Map {
23 
24 	private:
25 
26 		Entity *allowableEnemy[10];
27 		int maxAllowableEnemies;
28 
29 	public:
30 
31 		char name[255];
32 
33 		unsigned char data[MAPWIDTH][MAPHEIGHT];
34 
35 		int offsetX, offsetY;
36 		int limitLeft, limitRight, limitUp, limitDown;
37 
38 		int foundItems, totalItems;
39 		int foundMIAs, totalMIAs;
40 		int requiredMIAs;
41 
42 		// time limit for extreme setting
43 		int remainingMinutes;
44 		int remainingSeconds;
45 
46 		// special for ice levels
47 		bool isIceLevel;
48 
49 		// special for flooded tunnel #4
50 		float waterLevel;
51 		int requiredWaterLevel;
52 
53 		// special for arctic wastes
54 		bool isBlizzardLevel;
55 		int windChangeTime;
56 		float windPower;
57 
58 		// air/water decoration
59 		bool isCavesTileset;
60 		bool isGrasslandsTileset;
61 
62 		// Boss Stuff
63 		bool fightingGaldov;
64 		bool isBossMission;
65 		unsigned int bossNextThink;
66 		void (*doBossLevelAction) (void);
67 		Boss *boss[10];
68 		Boss *mainBossPart;
69 		float bossEnergyMeterBit;
70 
71 		List persistantList;
72 
73 		List trainList;
74 		List itemList;
75 		List bulletList;
76 		List enemyList;
77 		List miaList;
78 		List obstacleList;
79 		List particleList;
80 		List switchList;
81 		List spawnList;
82 		List effectList;
83 		List objectiveList;
84 		List teleportList;
85 		List lineList;
86 		List trapList;
87 
88 	Map();
89 
90 	void clear();
91 	void destroy();
92 
93 	bool isPracticeMission();
94 	bool isValid(int x, int y);
95 	bool isSolid(int x, int y);
96 	bool isBreakable(int x, int y);
97 	bool isNoReset(int x, int y);
98 	bool isLiquid(int x, int y);
99 	bool isTopLayer(int x, int y);
100 
101 	Persistant *getPersistant(const char *name);
102 	Persistant *createPersistant(const char *name);
103 	void destroyPersistant(const char *name);
104 
105 	void setName(const char *name);
106 	void setClipping(int limitLeft, int limitRight, int limitUp, int limitDown);
107 	void addTrain(const char *name, int startX, int startY, int endX, int endY, int pause, bool atStart, bool active);
108 	void addDoor(const char *name, int type, int startX, int startY, int endX, int endY, bool active);
109 	void addSwitch(const char *name, const char *linkName, const char *requiredObjectName, const char *activateMessage, int type, int x, int y, bool activated);
110 	void addItem(Entity *item);
111 	void addBullet(Entity *bullet);
112 	void addParticle(float x, float y, float dx, float dy, int health, int color, Sprite *sprite, int flags);
113 	void addEnemy(Entity *enemy);
114 	void addMIA(Entity *mia);
115 	void addObstacle(Entity *obstacle);
116 	void addSpawnPoint(const char *name, int x, int y, int type, int subtype, int min, int max, bool active);
117 	void addEffect(Effect *effect);
118 	void addObjective(const char *description, const char *target, int targetValue, bool required);
119 	void addTeleporter(Teleporter *teleporter);
120 	void addLineDef(LineDef *lineDef);
121 	void addTrap(Trap *trap);
122 	void evalTileset(const char *baseDir);
123 
124 	void killAllEnemies();
125 
126 	void setAllowableEnemy(Entity *enemy);
127 	char *getSpawnableEnemy();
128 	char *getSpawnableEnemy(int i);
129 
130 	void getRandomEntityPosition(int *x, int *y);
131 	void setMainBossPart(Boss *boss);
132 };
133