33 #include "../shared/ufotypes.h"
34 #include "../shared/shared.h"
35 #include "../shared/mathlib.h"
36 #include "../shared/defines.h"
37 #include "../common/list.h"
45 # define _(String) String
46 # define ngettext(x, y, cnt) x
60 #define TEAM_NO_ACTIVE -1
61 #define TEAM_CIVILIAN 0
62 #define TEAM_PHALANX 1
64 #define TEAM_MAX_HUMAN TEAM_ALIEN - 1
73 #define EVENT_INSTANTLY 0x80
187 #define DOOR_ROTATION_ANGLE 90
216 #define ST_RIGHT_REACTION 1
226 #define ST_LEFT_REACTION 3
231 #define ST_HEADGEAR 4
236 #define ST_NUM_SHOOT_TYPES 5
239 #define IS_SHOT_REACTION(x) ((x) == ST_RIGHT_REACTION || (x) == ST_LEFT_REACTION)
241 #define IS_SHOT_LEFT(x) ((x) == ST_LEFT || (x) == ST_LEFT_REACTION)
243 #define IS_SHOT_RIGHT(x) ((x) == ST_RIGHT || (x) == ST_RIGHT_REACTION)
245 #define IS_SHOT_HEADGEAR(x) ((x) == ST_HEADGEAR)
250 #define SF_BOUNCING 4
255 #define SKIP_LOCAL_ENTITY (-1)
261 #define STATE_PUBLIC 0x00FF
262 #define STATE_DEAD 0x0003
263 #define STATE_CROUCHED 0x0004
264 #define STATE_PANIC 0x0008
266 #define STATE_RAGE 0x0010
267 #define STATE_INSANE 0x0020
268 #define STATE_STUN 0x0043
269 #define STATE_DAZED 0x0080
272 #define STATE_REACTION 0x0300
273 #define STATE_SHAKEN 0x0400
274 #define STATE_XVI 0x0800
276 #define GRAVITY 500.0
278 #define MAX_SKILL 100
279 #define MAX_MAXHP 255
281 #define WEIGHT_LIGHT 0.2f
282 #define WEIGHT_HEAVY 0.5f
283 #define WEIGHT_NORMAL_PENALTY 0.3f
284 #define WEIGHT_HEAVY_PENALTY 0.6f
285 #define WEIGHT_FACTOR 1000.0f
287 #define GET_ENCUMBRANCE_PENALTY(weight, max) (1.0f - ((weight) > (max) * WEIGHT_FACTOR * WEIGHT_HEAVY ? WEIGHT_HEAVY_PENALTY : (weight) > (max) * WEIGHT_FACTOR * WEIGHT_LIGHT ? WEIGHT_NORMAL_PENALTY : 0.0f))
289 #define GET_ACC( ab, sk, pn ) ((pn) - (((float)(ab) - 10) / (MAX_SKILL / 2) + ((float)(sk) - 10) / (MAX_SKILL / 2)) / 2)
290 #define GET_MORALE( ab ) (std::min((100 + (ab) * 150/MAX_SKILL), 255))
291 #define GET_TU( ab, md ) (MIN_TU * (md) + (ab) * 20 / MAX_SKILL)
293 #define DOOR_OPEN_REVERSE 4
294 #define GET_SLIDING_DOOR_SHIFT_VECTOR(dir, speed, vecout) \
295 do { const bool reverse = (dir) & DOOR_OPEN_REVERSE; VectorClear(vecout); vecout[dir & 3] = reverse ? -speed : speed; } while (0);
298 #define MAX_TILESTRINGS 8
299 #define MAX_CLIENTS 256
300 #define MAX_GENERAL (MAX_CLIENTS*2)
301 #define MAX_ENTITYSTRINGS 2
310 #define CS_MAPTITLE 1
311 #define CS_MAXCLIENTS 2
312 #define CS_MAPCHECKSUM 3
313 #define CS_MAXSOLDIERSPERTEAM 4
314 #define CS_MAXSOLDIERSPERPLAYER 5
315 #define CS_ENABLEMORALE 6
316 #define CS_MAXTEAMS 7
317 #define CS_PLAYERCOUNT 8
319 #define CS_UFOCHECKSUM 10
320 #define CS_OBJECTAMOUNT 11
321 #define CS_LIGHTMAP 12
322 #define CS_MAPZONE 13
323 #define CS_VICTORY_CONDITIONS 14
324 #define CS_ENTITYSTRING 15
325 #define CS_TILES (CS_ENTITYSTRING+MAX_ENTITYSTRINGS)
326 #define CS_POSITIONS (CS_TILES+MAX_TILESTRINGS)
327 #define CS_MODELS (CS_POSITIONS+MAX_TILESTRINGS)
328 #define CS_PLAYERNAMES (CS_MODELS+MAX_MODELS)
329 #define CS_GENERAL (CS_PLAYERNAMES+MAX_CLIENTS)
330 #define MAX_CONFIGSTRINGS (CS_GENERAL+MAX_GENERAL)
333 #define MAX_GAMETYPES 16
335 #define MAX_CVARLISTINGAMETYPE 16
366 TerrainDef() : rgbRed(128), rgbGreen(255), rgbBlue(0), survivalChance(2.5
f), rainChance(0.2
f), snowChance(0.1
f) {
367 strcpy(terrainName,
"grass");
369 TerrainDef(
byte _rgbRed,
byte _rgbGreen,
byte _rgbBlue,
const char* _terrainName,
float _survivalChance,
float _rainChance,
float _snowChance) {
371 rgbGreen = _rgbGreen;
373 strcpy(terrainName, _terrainName);
374 survivalChance = _survivalChance;
375 rainChance = _rainChance;
376 snowChance = _snowChance;
388 #define MAX_TERRAINDEFS 16
418 terrainDefTable[0] =
nullptr;
422 if (terrainDefTable[
i])
423 delete terrainDefTable[
i];
501 #define MapDef_ForeachCondition(var, condition) \
502 for (int var##__loopvar = 0; (var) = nullptr, var##__loopvar < Com_GetMapDefNumber(); var##__loopvar++) \
503 if ((var) = Com_GetMapDefByIDX(var##__loopvar), !(condition)) {} else
505 #define MapDef_Foreach(var) MapDef_ForeachCondition(var, 1)
580 #define REJ_PASSWORD_REQUIRED_OR_INCORRECT "Password required or incorrect."
581 #define BAD_RCON_PASSWORD "Bad rcon_password."
582 #define REJ_BANNED "Banned."
583 #define REJ_SERVER_FULL "Server is full."
584 #define REJ_SERVER_VERSION_MISMATCH "The server is running a different version of the game."
585 #define REJ_GAME_ALREADY_STARTED "Game has started already."
586 #define REJ_CONNECTION_REFUSED "Connection refused."
588 #define SV_CMD_CONNECT "connect"
589 #define SV_CMD_RCON "rcon"
590 #define SV_CMD_STATUS "status"
591 #define SV_CMD_TEAMINFO "teaminfo"
592 #define SV_CMD_INFO "info"
593 #define SV_CMD_PRINT "print"
596 #define SV_CMD_ACK "ack"
597 #define CL_CMD_PING "ping"
598 #define CL_CMD_ECHO "echo"
601 #define CL_PRECACHE "precache"
602 #define CL_SPAWNSOLDIERS "spawnsoldiers"
603 #define CL_STARTMATCH "startmatch"
605 #define CL_CMD_COMMAND "cmd"
606 #define CL_CMD_CLIENT_CONNECT "client_connect"
608 #define NET_STATE_NEW "new"
609 #define NET_STATE_BEGIN "begin"
610 #define NET_STATE_STARTMATCH "startmatch"
611 #define NET_STATE_DISCONNECT "disconnect"
612 #define NET_STATE_INFO "info"
#define MAX_CHARACTER_TEMPLATES
#define MAX_CVARLISTINGAMETYPE
mapDef_t mds[MAX_MAPDEFS]
float victoryBonusPerAlien
int Com_GetMapDefNumber(void)
Terrain property table entry Terrain is defined by the file map_earth_terrain.png in pics/geoscape...
Defines a type of UGV/Robot.
linkedList_t * populations
struct csi_s csi_t
The csi structure is the client-server-information structure which contains all the static data neede...
const char * getWeather(const byte *const color)
Translate color value to terrain type to random weather code.
linkedList_t * actorNames
const TerrainDef * findByName(const char *tname) const
invDef_t ids[MAX_INVDEFS]
equipDef_t eds[MAX_EQUIPDEFS]
chrTemplate_t chrTemplates[MAX_CHARACTER_TEMPLATES]
Defines all attributes of objects used in the inventory.
linkedList_t * bodyTemplates
implantDef_t implants[MAX_IMPLANTS]
cvarlist_t cvars[MAX_CVARLISTINGAMETYPE]
float getSurvivalChance(const byte *const color) const
Translate color value to terrain type and then to survival probability.
void Sys_Error(const char *error,...) __attribute__((noreturn
#define MAX_TERRAINDEFS
Terrain property table Terrain is defined by the file map_earth_terrain.png in pics/geoscape. It is a map of the world where the different terrainTypes are drawn in different colors. The colors used in that map must have the exact RGB values as in the table, or they won't be recognized.
struct cvarlist_s cvarlist_t
const teamDef_t * alienTeams[MAX_TEAMS_PER_MISSION]
const TerrainDef * findByColor(byte red, byte green, byte blue) const
bool add(const TerrainDef *tdef)
Translate color value to terrain type to random weather code.
const TerrainDef * findByColor(const byte *const color) const
int32_t shoot_types_t
Available shoot types - also see the ST_ constants.
The csi structure is the client-server-information structure which contains all the static data neede...
float getSnowChance(const byte *const color) const
gametype_t gts[MAX_GAMETYPES]
event_t
Possible event values.
damageType_t dts[MAX_DAMAGETYPES]
const TerrainDef * terrainDefTable[MAX_TERRAINDEFS]
const char * pa_format[PA_NUM_EVENTS]
Player action format strings for netchannel transfer.
teamDef_t teamDef[MAX_TEAMDEFS]
static const vec4_t green
mapDef_t * Com_GetMapDefByIDX(int index)
common object-, inventory-, container- and firemode-related functions headers.
TerrainDef(byte _rgbRed, byte _rgbGreen, byte _rgbBlue, const char *_terrainName, float _survivalChance, float _rainChance, float _snowChance)
#define MAX_TEAMS_PER_MISSION
float getRainChance(const byte *const color) const
inventory definition for our menus
objDef_t ods[MAX_OBJDEFS]
const chrTemplate_t * alienChrTemplates[MAX_TEAMS_PER_MISSION]
struct gametype_s gametype_t
void Com_Printf(const char *msg,...) __attribute__((format(__printf__
mapDef_t * Com_GetMapDefinitionByID(const char *mapDefID)
void void Com_DPrintf(int level, const char *msg,...) __attribute__((format(__printf__
void format(__printf__, 1, 2)))
const char * getTerrainName(const byte *const color) const
Translate color value to terrain type.