win_localuser.cpp 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122
  1. /*
  2. ===========================================================================
  3. Doom 3 BFG Edition GPL Source Code
  4. Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.
  5. This file is part of the Doom 3 BFG Edition GPL Source Code ("Doom 3 BFG Edition Source Code").
  6. Doom 3 BFG Edition Source Code is free software: you can redistribute it and/or modify
  7. it under the terms of the GNU General Public License as published by
  8. the Free Software Foundation, either version 3 of the License, or
  9. (at your option) any later version.
  10. Doom 3 BFG Edition Source Code is distributed in the hope that it will be useful,
  11. but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  13. GNU General Public License for more details.
  14. You should have received a copy of the GNU General Public License
  15. along with Doom 3 BFG Edition Source Code. If not, see <http://www.gnu.org/licenses/>.
  16. In addition, the Doom 3 BFG Edition Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 BFG Edition Source Code. If not, please request a copy in writing from id Software at the address below.
  17. If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA.
  18. ===========================================================================
  19. */
  20. #pragma hdrstop
  21. #include "../../idlib/precompiled.h"
  22. #include "win_localuser.h"
  23. extern idCVar win_userPersistent;
  24. extern idCVar win_userOnline;
  25. extern idCVar win_isInParty;
  26. extern idCVar win_partyCount;
  27. /*
  28. ========================
  29. idLocalUserWin::Init
  30. ========================
  31. */
  32. void idLocalUserWin::Init( int inputDevice_, const char * gamertag_, int numLocalUsers ) {
  33. if ( numLocalUsers == 1 ) { // Check for 1, since this is now incremented before we get in here
  34. // This is the master user
  35. gamertag = gamertag_;
  36. } else {
  37. // On steam, we need to generate a name based off the master user for split-screen users.
  38. // We use the number of users on the system to generate the name rather than the device
  39. // number so that it is always consistently "username (2)" for the second player.
  40. gamertag.Format( "%s (%i)", gamertag_, numLocalUsers );
  41. }
  42. inputDevice = inputDevice_;
  43. }
  44. /*
  45. ========================
  46. idLocalUserWin::IsProfileReady
  47. ========================
  48. */
  49. bool idLocalUserWin::IsProfileReady() const {
  50. #ifdef _DEBUG
  51. return win_userPersistent.GetBool();
  52. #else
  53. return true;
  54. #endif
  55. }
  56. /*
  57. ========================
  58. idLocalUserWin::IsOnline
  59. ========================
  60. */
  61. bool idLocalUserWin::IsOnline() const {
  62. #ifdef _DEBUG
  63. return win_userOnline.GetBool();
  64. #else
  65. return true;
  66. #endif
  67. }
  68. /*
  69. ========================
  70. idLocalUserWin::IsInParty
  71. ========================
  72. */
  73. bool idLocalUserWin::IsInParty() const {
  74. #ifdef _DEBUG
  75. return win_isInParty.GetBool();
  76. #else
  77. return false;
  78. #endif
  79. }
  80. /*
  81. ========================
  82. idLocalUserWin::GetPartyCount
  83. ========================
  84. */
  85. int idLocalUserWin::GetPartyCount() const {
  86. // TODO: Implement
  87. #ifdef _DEBUG
  88. return win_partyCount.GetInteger();
  89. #else
  90. return 0;
  91. #endif
  92. }
  93. /*
  94. ========================
  95. idLocalUserWin::VerifyUserState
  96. ========================
  97. */
  98. bool idLocalUserWin::VerifyUserState( winUserState_t & state ) {
  99. if ( state.inputDevice != inputDevice ) {
  100. return false;
  101. }
  102. return true;
  103. }