Phasor  01.00.10.059
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
MapLoader.h
Go to the documentation of this file.
1 #pragma once
2 
3 #include "../../../Common/Types.h"
4 #include "../../../Common/Streams.h"
5 #include "../Addresses.h"
6 #include "../../Commands.h"
7 #include <vector>
8 
10 
11 namespace halo { namespace server { namespace maploader
12 {
14  {
15  std::string map;
16  std::wstring gametype;
17  std::vector<std::string> scripts;
18  };
19 
20 #pragma pack(push, 1)
22  {
24  char** script_names;
25  };
27  {
28  char* map;
29  char* gametype;
31  BYTE gametype_data[GAMET_BUFFER_SIZE];
32  };
33  static_assert(sizeof(s_mapcycle_entry) == CONST_MENTRY_SIZE,
34  "sizeof(s_mapcycle_entry) != CONST_MENTRY_SIZE");
35 
37  {
41  DWORD current; // index of game being executed
42  };
43 #pragma pack(pop)
44 
45  void Initialize(COutStream& out);
46 
47  // Checks if the map, gametype and all scripts are valid.
48  bool ValidateUserInput(const s_phasor_mapcycle_entry& entry, COutStream& out);
49 
50  // Effectively executes sv_map to run a new game
51  bool LoadGame(const s_phasor_mapcycle_entry& game, COutStream& out);
52 
54  const s_phasor_mapcycle_entry& new_entry,
55  COutStream& out);
56 
57  // Checks if a map exists
58  bool IsValidMap(const std::string& map);
59 
60  //Non-default map loading
61  // --------------------------------------------------------------------
62 #ifdef PHASOR_PC
63  // Returns the address of the loading buffer Halo should use
64  char* GetLoadingMapBuffer();
65 
66  // Generates the map list
68  void BuildMapList(COutStream& out);
69 
70  // This function returns the address of our map table
71  DWORD GetMapTable();
72 
73  // Called when a map is being loaded.
74  void OnMapLoad(char* map);
75 
76  // Called to fix the loaded map name
77  void OnNewGame();
78 
79  // Returns the base name for a map (ie bloodgulch1 -> bloodgulch)
80  bool GetBaseMapName(const char* actual_map, const char** out);
81 #endif
82 
83  // Get a pointer to the current map in the playlist
85 
87  commands::CArgParser& args, COutStream& out);
89  commands::CArgParser& args, COutStream& out);
90  e_command_result sv_mapcycle_del(void* exec_player,
91  commands::CArgParser& args, COutStream& out);
93  commands::CArgParser& args, COutStream& out);
94  e_command_result sv_map(void*,
95  commands::CArgParser& args, COutStream& out);
98 }}}