SessionProperties.h 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103
  1. /* Copyright (c) 2002-2012 Croteam Ltd.
  2. This program is free software; you can redistribute it and/or modify
  3. it under the terms of version 2 of the GNU General Public License as published by
  4. the Free Software Foundation
  5. This program is distributed in the hope that it will be useful,
  6. but WITHOUT ANY WARRANTY; without even the implied warranty of
  7. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  8. GNU General Public License for more details.
  9. You should have received a copy of the GNU General Public License along
  10. with this program; if not, write to the Free Software Foundation, Inc.,
  11. 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */
  12. /*
  13. * Class responsible for describing game session
  14. */
  15. class CSessionProperties {
  16. public:
  17. enum GameMode {
  18. GM_FLYOVER = -1,
  19. GM_COOPERATIVE = 0,
  20. GM_SCOREMATCH,
  21. GM_FRAGMATCH,
  22. };
  23. enum GameDifficulty {
  24. GD_TOURIST = -1,
  25. GD_EASY = 0,
  26. GD_NORMAL,
  27. GD_HARD,
  28. GD_EXTREME,
  29. };
  30. INDEX sp_ctMaxPlayers; // maximum number of players in game
  31. BOOL sp_bWaitAllPlayers; // wait for all players to connect
  32. BOOL sp_bQuickTest; // set when game is tested from wed
  33. BOOL sp_bCooperative; // players are not intended to kill each other
  34. BOOL sp_bSinglePlayer; // single player mode has some special rules
  35. BOOL sp_bUseFrags; // set if frags matter instead of score
  36. enum GameMode sp_gmGameMode; // general game rules
  37. enum GameDifficulty sp_gdGameDifficulty;
  38. ULONG sp_ulSpawnFlags;
  39. BOOL sp_bMental; // set if mental mode engaged
  40. INDEX sp_iScoreLimit; // stop game after a player/team reaches given score
  41. INDEX sp_iFragLimit; // stop game after a player/team reaches given score
  42. INDEX sp_iTimeLimit; // stop game after given number of minutes elapses
  43. BOOL sp_bTeamPlay; // players are divided in teams
  44. BOOL sp_bFriendlyFire; // can harm player of same team
  45. BOOL sp_bWeaponsStay; // weapon items do not dissapear when picked-up
  46. BOOL sp_bAmmoStays; // ammo items do not dissapear when picked-up
  47. BOOL sp_bHealthArmorStays; // health/armor items do exist
  48. BOOL sp_bPlayEntireGame; // don't finish after one level in coop
  49. BOOL sp_bAllowHealth; // health items do exist
  50. BOOL sp_bAllowArmor; // armor items do exist
  51. BOOL sp_bInfiniteAmmo; // ammo is not consumed when firing
  52. BOOL sp_bRespawnInPlace; // players respawn on the place where they were killed, not on markers (coop only)
  53. FLOAT sp_fEnemyMovementSpeed; // enemy speed multiplier
  54. FLOAT sp_fEnemyAttackSpeed; // enemy speed multiplier
  55. FLOAT sp_fDamageStrength; // multiplier when damaged
  56. FLOAT sp_fAmmoQuantity; // multiplier when picking up ammo
  57. FLOAT sp_fManaTransferFactor; // multiplier for the killed player mana that is to be added to killer's mana
  58. INDEX sp_iInitialMana; // life price (mana that each player'll have upon respawning)
  59. FLOAT sp_fExtraEnemyStrength; // fixed adder for extra enemy power
  60. FLOAT sp_fExtraEnemyStrengthPerPlayer; // adder for extra enemy power per each player playing
  61. INDEX sp_ctCredits; // number of credits for this game
  62. INDEX sp_ctCreditsLeft; // number of credits left on this level
  63. FLOAT sp_tmSpawnInvulnerability; // how many seconds players are invunerable after respawning
  64. INDEX sp_iBlood; // blood/gibs type (0=none, 1=green, 2=red, 3=hippie)
  65. BOOL sp_bGibs; // enable/disable gibbing
  66. BOOL sp_bEndOfGame; // marked when dm game is finished (any of the limits reached)
  67. ULONG sp_ulLevelsMask; // mask of visited levels so far
  68. BOOL sp_bUseExtraEnemies; // spawn extra multiplayer enemies
  69. };
  70. // NOTE: never instantiate CSessionProperties, as its size is not fixed to the size defined in engine
  71. // use CUniversalSessionProperties for instantiating an object
  72. class CUniversalSessionProperties {
  73. public:
  74. union {
  75. CSessionProperties usp_sp;
  76. UBYTE usp_aubDummy[NET_MAXSESSIONPROPERTIES];
  77. };
  78. // must have exact the size as allocated block in engine
  79. CUniversalSessionProperties() {
  80. ASSERT(sizeof(CSessionProperties)<=NET_MAXSESSIONPROPERTIES);
  81. ASSERT(sizeof(CUniversalSessionProperties)==NET_MAXSESSIONPROPERTIES);
  82. }
  83. operator CSessionProperties&(void) { return usp_sp; }
  84. };