teammanager.h 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112
  1. /*
  2. ** Command & Conquer Renegade(tm)
  3. ** Copyright 2025 Electronic Arts Inc.
  4. **
  5. ** This program is free software: you can redistribute it and/or modify
  6. ** it under the terms of the GNU General Public License as published by
  7. ** the Free Software Foundation, either version 3 of the License, or
  8. ** (at your option) any later version.
  9. **
  10. ** This program 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. **
  15. ** You should have received a copy of the GNU General Public License
  16. ** along with this program. If not, see <http://www.gnu.org/licenses/>.
  17. */
  18. /***********************************************************************************************
  19. *** Confidential - Westwood Studios ***
  20. ***********************************************************************************************
  21. * *
  22. * Project Name : Commando *
  23. * *
  24. * $Archive:: /Commando/Code/Commando/teammanager.h $*
  25. * *
  26. * $Author:: Tom_s $*
  27. * *
  28. * $Modtime:: 1/03/02 5:49p $*
  29. * *
  30. * $Revision:: 31 $*
  31. * *
  32. *---------------------------------------------------------------------------------------------*
  33. * Functions: *
  34. * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
  35. #if defined(_MSV_VER)
  36. #pragma once
  37. #endif
  38. #ifndef TEAMMANAGER_H
  39. #define TEAMMANAGER_H
  40. #include "vector3.h"
  41. #include "bittype.h"
  42. #include "slist.h"
  43. #include "team.h"
  44. #include "wwstring.h"
  45. #include "widestring.h"
  46. class Render2DTextClass;
  47. class Font3DInstanceClass;
  48. const int MAX_TEAMS = 2;
  49. //
  50. // cTeamManager
  51. //
  52. // A collection of routines to maintain a list of team objects
  53. //
  54. class cTeamManager {
  55. public:
  56. static void Onetime_Init(void);
  57. static void Onetime_Shutdown(void);
  58. static void Think(void);
  59. static void Render(void);
  60. static void List_Print(WideStringClass & text, Vector3 color);
  61. static void Construct_Heading(WideStringClass & heading);
  62. static void Render_Team_List(void);
  63. static WideStringClass Get_Team_Name(int team_number);
  64. static void Sort_Teams(void);
  65. static int Get_Leaders_Id(void);
  66. static void Reset_Teams(void);
  67. static cTeam * Find_Team(int team_number);
  68. static cTeam* Find_Empty_Team(void);
  69. static SList<cTeam> * Get_Team_Object_List(void) {return &TeamList;}
  70. static void Add(cTeam * p_team);
  71. static void Remove_All(void); // N.B. destructive
  72. static float Get_Team_List_Height(void) {return TeamListHeight;}
  73. static int Count(void) {return TeamList.Get_Count();};
  74. static int Compute_Team_List_Height(void);
  75. static void Log_Team_List(void);
  76. private:
  77. static void Remove(cTeam * p_team); // N.B. destructive
  78. static void Remove(int team_number); // N.B. destructive
  79. static int Get_Non_Empty_Team_Count(void);
  80. static int Sort_Score_Ktd_Kills(cTeam * p_team1, cTeam * p_team2);
  81. static int Team_Compare(const void * elem1, const void * elem2);
  82. static SList<cTeam> TeamList; // list of all team objects
  83. static cTeam * Team_Array[MAX_TEAMS]; // qsort-ed list of non-empty teams
  84. static float TeamListHeight;
  85. static Render2DTextClass * PTextRenderer;
  86. static Font3DInstanceClass * PFont;
  87. static const float Y_INCREMENT_FACTOR;
  88. static int XPos;
  89. static int YPos;
  90. };
  91. #endif // TEAMMANAGER_H