-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathmap.h
126 lines (114 loc) · 3.69 KB
/
map.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
/*
Copyright 2013-2015 Rohit Nirmal
This file is part of Clonepoint.
Clonepoint is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Clonepoint is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with Clonepoint. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef MAP_H
#define MAP_H
#include <memory>
#include <vector>
class TiXmlElement;
struct Line
{
vec2f p1;
vec2f p2;
};
class Map
{
public:
Map();
~Map();
bool loadFromFile(const char* filename, bool savegame);
size_t getNumberOfCollideVols();
size_t getNumberOfEnts();
size_t getNumberOfStairs();
size_t getNumberOfStairwells();
size_t getNumberOfLights();
size_t getNumberOfLines();
size_t getNumberOfLightLinks();
size_t getNumberOfShafts();
size_t getNumberOfEnemies();
int indexOfCollideVol(CollisionVolume* vol);
int indexOfEntity(Entity* ent);
int indexOfFOV(FieldOfView* fov);
CollisionVolume getCollideVolAt(int i);
CollisionVolume* getCollideVolPointerAt(int i);
Entity* getEntAt(size_t i);
Enemy* getEnemyAt(size_t i);
Stairs* getStairsAt(size_t i);
Stairwell* getStairwellAt(size_t i);
FieldOfView* getLightAt(size_t i);
ElevatorShaft* getShaftAt(size_t i);
Line getLineAt(size_t i);
Line getLightLinkAt(size_t i);
unsigned int getMapWidth();
unsigned int getMapHeight();
vec2f getPlayerStartPos();
void addSavedLink(vec2f start, vec2f end);
void clearLinks();
GLuint getMapTexture();
GLuint getCrosslinkTexture();
bool subwayFound();
vec2f getSubwayPosition();
void getLinkableIters(std::vector<LinkableEntity*>::iterator* begin,
std::vector<LinkableEntity*>::iterator* end);
void getTutorialIters(std::vector<TutorialMark*>::iterator* begin,
std::vector<TutorialMark*>::iterator* end);
void removeEnemyGun(EnemyGun* gun);
void addMissingGuns();
void addSniper();
void removeSniper();
Enemy* getSniper();
float getBackGroundYOffset();
private:
unsigned int _tilesHigh;
unsigned int _tilesWide;
unsigned int _mapWidth;
unsigned int _mapHeight;
float _backgroundYOffset;
vec2f _playerStartPos;
vec2f _subwayPos;
bool _subwayFound;
std::vector<CollisionVolume*> _collideVols;
std::vector<Entity*> _entities;
std::vector<Stairs*> _stairDoors;
std::vector<Stairwell*> _stairwells;
std::vector<FieldOfView*> _lights;
std::vector<ElevatorShaft*> _shafts;
std::vector<LinkableEntity*> _linkableEnts;
std::vector<Line> _lines;
std::vector<Line> _lightLinks;
std::vector<size_t> _enemyIndices;
std::vector<TutorialMark*> _tutorials;
Enemy* _sniper;
void parseLinkableObject(TiXmlElement* element, Circuit c);
void parseCollisionVolume(TiXmlElement* element);
void parseEntity(TiXmlElement* element, bool savegame);
void parseObjective(TiXmlElement* element);
void parseLight(TiXmlElement* element);
void parseProp(TiXmlElement* element);
void parsePolyline(TiXmlElement* element, float ox, float oy, std::vector<Line>* container);
void getPolylineComponent(std::string point, float* x, float* y);
void makeElevatorShafts();
int doesElevatorShaftExist(int x);
int doesStairwellExist(int x);
void setShaftOpenings();
void makeStairwells();
void calculateStairDirections();
void calculateElevatorOrder();
void parseTileLayer(char* data);
void findBackGroundYOffset(std::string filename);
SDL_Surface* _tilesetImage;
GLuint _mapTex;
GLuint _crosslinkTex;
};
#endif