Serious-Engine/Sources/GameMP/SessionProperties.h

90 lines
3.7 KiB
C
Raw Normal View History

2016-03-11 14:57:17 +01:00
/* Copyright (c) 2002-2012 Croteam Ltd. All rights reserved. */
/*
* Class responsible for describing game session
*/
class CSessionProperties {
public:
enum GameMode {
GM_FLYOVER = -1,
GM_COOPERATIVE = 0,
GM_SCOREMATCH,
GM_FRAGMATCH,
};
enum GameDifficulty {
GD_TOURIST = -1,
GD_EASY = 0,
GD_NORMAL,
GD_HARD,
GD_EXTREME,
};
INDEX sp_ctMaxPlayers; // maximum number of players in game
BOOL sp_bWaitAllPlayers; // wait for all players to connect
BOOL sp_bQuickTest; // set when game is tested from wed
BOOL sp_bCooperative; // players are not intended to kill each other
BOOL sp_bSinglePlayer; // single player mode has some special rules
BOOL sp_bUseFrags; // set if frags matter instead of score
enum GameMode sp_gmGameMode; // general game rules
enum GameDifficulty sp_gdGameDifficulty;
ULONG sp_ulSpawnFlags;
BOOL sp_bMental; // set if mental mode engaged
INDEX sp_iScoreLimit; // stop game after a player/team reaches given score
INDEX sp_iFragLimit; // stop game after a player/team reaches given score
INDEX sp_iTimeLimit; // stop game after given number of minutes elapses
BOOL sp_bTeamPlay; // players are divided in teams
BOOL sp_bFriendlyFire; // can harm player of same team
BOOL sp_bWeaponsStay; // weapon items do not dissapear when picked-up
BOOL sp_bAmmoStays; // ammo items do not dissapear when picked-up
BOOL sp_bHealthArmorStays; // health/armor items do exist
BOOL sp_bPlayEntireGame; // don't finish after one level in coop
BOOL sp_bAllowHealth; // health items do exist
BOOL sp_bAllowArmor; // armor items do exist
BOOL sp_bInfiniteAmmo; // ammo is not consumed when firing
BOOL sp_bRespawnInPlace; // players respawn on the place where they were killed, not on markers (coop only)
FLOAT sp_fEnemyMovementSpeed; // enemy speed multiplier
FLOAT sp_fEnemyAttackSpeed; // enemy speed multiplier
FLOAT sp_fDamageStrength; // multiplier when damaged
FLOAT sp_fAmmoQuantity; // multiplier when picking up ammo
FLOAT sp_fManaTransferFactor; // multiplier for the killed player mana that is to be added to killer's mana
INDEX sp_iInitialMana; // life price (mana that each player'll have upon respawning)
FLOAT sp_fExtraEnemyStrength; // fixed adder for extra enemy power
FLOAT sp_fExtraEnemyStrengthPerPlayer; // adder for extra enemy power per each player playing
INDEX sp_ctCredits; // number of credits for this game
INDEX sp_ctCreditsLeft; // number of credits left on this level
FLOAT sp_tmSpawnInvulnerability; // how many seconds players are invunerable after respawning
INDEX sp_iBlood; // blood/gibs type (0=none, 1=green, 2=red, 3=hippie)
BOOL sp_bGibs; // enable/disable gibbing
BOOL sp_bEndOfGame; // marked when dm game is finished (any of the limits reached)
ULONG sp_ulLevelsMask; // mask of visited levels so far
BOOL sp_bUseExtraEnemies; // spawn extra multiplayer enemies
};
// NOTE: never instantiate CSessionProperties, as its size is not fixed to the size defined in engine
// use CUniversalSessionProperties for instantiating an object
class CUniversalSessionProperties {
public:
union {
CSessionProperties usp_sp;
UBYTE usp_aubDummy[NET_MAXSESSIONPROPERTIES];
};
// must have exact the size as allocated block in engine
CUniversalSessionProperties() {
ASSERT(sizeof(CSessionProperties)<=NET_MAXSESSIONPROPERTIES);
ASSERT(sizeof(CUniversalSessionProperties)==NET_MAXSESSIONPROPERTIES);
}
operator CSessionProperties&(void) { return usp_sp; }
};