forked from uakfdotb/ent-ghost
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmap.h
182 lines (156 loc) · 7 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
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
/*
ent-ghost
Copyright [2011-2013] [Jack Lu]
This file is part of the ent-ghost source code.
ent-ghost 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.
ent-ghost source code 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 ent-ghost source code. If not, see <http://www.gnu.org/licenses/>.
ent-ghost is modified from GHost++ (http://ghostplusplus.googlecode.com/)
GHost++ is Copyright [2008] [Trevor Hogan]
*/
#ifndef MAP_H
#define MAP_H
#define MAPSPEED_SLOW 1
#define MAPSPEED_NORMAL 2
#define MAPSPEED_FAST 3
#define MAPVIS_HIDETERRAIN 1
#define MAPVIS_EXPLORED 2
#define MAPVIS_ALWAYSVISIBLE 3
#define MAPVIS_DEFAULT 4
#define MAPOBS_NONE 1
#define MAPOBS_ONDEFEAT 2
#define MAPOBS_ALLOWED 3
#define MAPOBS_REFEREES 4
#define MAPFLAG_TEAMSTOGETHER 1
#define MAPFLAG_FIXEDTEAMS 2
#define MAPFLAG_UNITSHARE 4
#define MAPFLAG_RANDOMHERO 8
#define MAPFLAG_RANDOMRACES 16
#define MAPOPT_HIDEMINIMAP 1 << 0
#define MAPOPT_MODIFYALLYPRIORITIES 1 << 1
#define MAPOPT_MELEE 1 << 2 // the bot cares about this one...
#define MAPOPT_REVEALTERRAIN 1 << 4
#define MAPOPT_FIXEDPLAYERSETTINGS 1 << 5 // and this one...
#define MAPOPT_CUSTOMFORCES 1 << 6 // and this one, the rest don't affect the bot's logic
#define MAPOPT_CUSTOMTECHTREE 1 << 7
#define MAPOPT_CUSTOMABILITIES 1 << 8
#define MAPOPT_CUSTOMUPGRADES 1 << 9
#define MAPOPT_WATERWAVESONCLIFFSHORES 1 << 11
#define MAPOPT_WATERWAVESONSLOPESHORES 1 << 12
#define MAPFILTER_MAKER_USER 1
#define MAPFILTER_MAKER_BLIZZARD 2
#define MAPFILTER_TYPE_MELEE 1
#define MAPFILTER_TYPE_SCENARIO 2
#define MAPFILTER_SIZE_SMALL 1
#define MAPFILTER_SIZE_MEDIUM 2
#define MAPFILTER_SIZE_LARGE 4
#define MAPFILTER_OBS_FULL 1
#define MAPFILTER_OBS_ONDEATH 2
#define MAPFILTER_OBS_NONE 4
#define MAPGAMETYPE_UNKNOWN0 1 // always set except for saved games?
// AuthenticatedMakerBlizzard = 1 << 3
// OfficialMeleeGame = 1 << 5
#define MAPGAMETYPE_SAVEDGAME 1 << 9
#define MAPGAMETYPE_PRIVATEGAME 1 << 11
#define MAPGAMETYPE_MAKERUSER 1 << 13
#define MAPGAMETYPE_MAKERBLIZZARD 1 << 14
#define MAPGAMETYPE_TYPEMELEE 1 << 15
#define MAPGAMETYPE_TYPESCENARIO 1 << 16
#define MAPGAMETYPE_SIZESMALL 1 << 17
#define MAPGAMETYPE_SIZEMEDIUM 1 << 18
#define MAPGAMETYPE_SIZELARGE 1 << 19
#define MAPGAMETYPE_OBSFULL 1 << 20
#define MAPGAMETYPE_OBSONDEATH 1 << 21
#define MAPGAMETYPE_OBSNONE 1 << 22
#include "gameslot.h"
//
// CMap
//
class CMap
{
public:
CGHost *m_GHost;
private:
bool m_Valid;
string m_CFGFile;
string m_MapPath; // config value: map path
BYTEARRAY m_MapSize; // config value: map size (4 bytes)
BYTEARRAY m_MapInfo; // config value: map info (4 bytes) -> this is the real CRC
BYTEARRAY m_MapCRC; // config value: map crc (4 bytes) -> this is not the real CRC, it's the "xoro" value
BYTEARRAY m_MapSHA1; // config value: map sha1 (20 bytes)
unsigned char m_MapSpeed;
unsigned char m_MapVisibility;
unsigned char m_MapObservers;
unsigned char m_MapFlags;
unsigned char m_MapFilterMaker;
unsigned char m_MapFilterType;
unsigned char m_MapFilterSize;
unsigned char m_MapFilterObs;
uint32_t m_MapOptions;
BYTEARRAY m_MapWidth; // config value: map width (2 bytes)
BYTEARRAY m_MapHeight; // config value: map height (2 bytes)
string m_MapType; // config value: map type (for stats class)
string m_MapMatchMakingCategory; // config value: map matchmaking category (for matchmaking)
string m_MapStatsW3MMDCategory; // config value: map stats w3mmd category (for saving w3mmd stats)
string m_MapDefaultHCL; // config value: map default HCL to use (this should really be specified elsewhere and not part of the map config)
uint32_t m_MapDefaultPlayerScore; // config value: map default player score (for matchmaking)
string m_MapLocalPath; // config value: map local path
bool m_MapLoadInGame;
bool m_Tournament; // config value: whether this is involved with uxtourney system
uint32_t m_TournamentFakeSlot; // config value: if tournament, this is SID for fake player
string m_MapData; // the map data itself, for sending the map to players
uint32_t m_MapNumPlayers;
uint32_t m_MapNumTeams;
vector<CGameSlot> m_Slots;
vector<uint32_t> m_TournamentLayout; // tournament layout from config
vector<uint32_t> m_FakePlayers; // fake players layout from config
string m_Conditions; // win conditions, used for some stats processing
public:
CMap( CGHost *nGHost );
CMap( CGHost *nGHost, CConfig *CFG, string nCFGFile );
~CMap( );
bool GetValid( ) { return m_Valid; }
string GetCFGFile( ) { return m_CFGFile; }
string GetMapPath( ) { return m_MapPath; }
BYTEARRAY GetMapSize( ) { return m_MapSize; }
BYTEARRAY GetMapInfo( ) { return m_MapInfo; }
BYTEARRAY GetMapCRC( ) { return m_MapCRC; }
BYTEARRAY GetMapSHA1( ) { return m_MapSHA1; }
unsigned char GetMapSpeed( ) { return m_MapSpeed; }
unsigned char GetMapVisibility( ) { return m_MapVisibility; }
unsigned char GetMapObservers( ) { return m_MapObservers; }
unsigned char GetMapFlags( ) { return m_MapFlags; }
BYTEARRAY GetMapGameFlags( );
uint32_t GetMapGameType( );
uint32_t GetMapOptions( ) { return m_MapOptions; }
unsigned char GetMapLayoutStyle( );
BYTEARRAY GetMapWidth( ) { return m_MapWidth; }
BYTEARRAY GetMapHeight( ) { return m_MapHeight; }
string GetMapType( ) { return m_MapType; }
string GetMapMatchMakingCategory( ) { return m_MapMatchMakingCategory; }
string GetMapStatsW3MMDCategory( ) { return m_MapStatsW3MMDCategory; }
string GetMapDefaultHCL( ) { return m_MapDefaultHCL; }
uint32_t GetMapDefaultPlayerScore( ) { return m_MapDefaultPlayerScore; }
string GetMapLocalPath( ) { return m_MapLocalPath; }
bool GetMapLoadInGame( ) { return m_MapLoadInGame; }
bool GetMapTournament( ) { return m_Tournament; }
uint32_t GetMapTournamentFakeSlot( ) { return m_TournamentFakeSlot; }
string *GetMapData( ) { return &m_MapData; }
uint32_t GetMapNumPlayers( ) { return m_MapNumPlayers; }
uint32_t GetMapNumTeams( ) { return m_MapNumTeams; }
vector<CGameSlot> GetSlots( ) { return m_Slots; }
vector<uint32_t> GetTournamentLayout( ) { return m_TournamentLayout; }
vector<uint32_t> GetFakePlayers( ) { return m_FakePlayers; }
string GetConditions( ) { return m_Conditions; }
void Load( CConfig *CFG, string nCFGFile );
void CheckValid( );
uint32_t XORRotateLeft( unsigned char *data, uint32_t length );
};
#endif