diff options
author | Jack <66967891+ASpoonPlaysGames@users.noreply.github.com> | 2023-12-20 13:24:07 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-12-20 14:24:07 +0100 |
commit | 0438b5c8cfa99ac01c7e142d959aa40f88f1cc70 (patch) | |
tree | bbfdded20f8686cf188dba148db4b6c1b1211872 /NorthstarDLL/engine/hoststate.cpp | |
parent | 210dab2b0e5c686829bafdc857d2910f6b216b85 (diff) | |
download | NorthstarLauncher-0438b5c8cfa99ac01c7e142d959aa40f88f1cc70.tar.gz NorthstarLauncher-0438b5c8cfa99ac01c7e142d959aa40f88f1cc70.zip |
Cherry pick "remove unnecessary namespaces" from primedev (#618)v1.21.2-rc2
Cherry-picks the removal of unnecessary namespaces from `primedev`
https://github.com/F1F7Y/NorthstarPrime/
Co-authored-by: F1F7Y <filip.bartos07@proton.me>
Diffstat (limited to 'NorthstarDLL/engine/hoststate.cpp')
-rw-r--r-- | NorthstarDLL/engine/hoststate.cpp | 33 |
1 files changed, 13 insertions, 20 deletions
diff --git a/NorthstarDLL/engine/hoststate.cpp b/NorthstarDLL/engine/hoststate.cpp index 1734a1c3..ec728afb 100644 --- a/NorthstarDLL/engine/hoststate.cpp +++ b/NorthstarDLL/engine/hoststate.cpp @@ -12,13 +12,7 @@ AUTOHOOK_INIT() -using namespace R2; - -// use the R2 namespace for game funcs -namespace R2 -{ - CHostState* g_pHostState; -} // namespace R2 +CHostState* g_pHostState; std::string sLastMode; @@ -35,15 +29,14 @@ void ServerStartingOrChangingMap() memset(commandBuf, 0, sizeof(commandBuf)); CCommand tempCommand = *(CCommand*)&commandBuf; if (sLastMode.length() && - CCommand__Tokenize( - tempCommand, fmt::format("exec server/cleanup_gamemode_{}", sLastMode).c_str(), R2::cmd_source_t::kCommandSrcCode)) + CCommand__Tokenize(tempCommand, fmt::format("exec server/cleanup_gamemode_{}", sLastMode).c_str(), cmd_source_t::kCommandSrcCode)) _Cmd_Exec_f(tempCommand, false, false); memset(commandBuf, 0, sizeof(commandBuf)); if (CCommand__Tokenize( tempCommand, fmt::format("exec server/setup_gamemode_{}", sLastMode = Cvar_mp_gamemode->GetString()).c_str(), - R2::cmd_source_t::kCommandSrcCode)) + cmd_source_t::kCommandSrcCode)) { _Cmd_Exec_f(tempCommand, false, false); } @@ -73,18 +66,18 @@ void, __fastcall, (CHostState* self)) // need to do this to ensure we don't go to private match if (g_pServerAuthentication->m_bNeedLocalAuthForNewgame) - SetCurrentPlaylist("tdm"); + R2::SetCurrentPlaylist("tdm"); ServerStartingOrChangingMap(); - double dStartTime = Tier0::Plat_FloatTime(); + double dStartTime = Plat_FloatTime(); CHostState__State_NewGame(self); - spdlog::info("loading took {}s", Tier0::Plat_FloatTime() - dStartTime); + spdlog::info("loading took {}s", Plat_FloatTime() - dStartTime); // setup server presence g_pServerPresence->CreatePresence(); g_pServerPresence->SetMap(g_pHostState->m_levelName, true); - g_pServerPresence->SetPlaylist(GetCurrentPlaylistName()); + g_pServerPresence->SetPlaylist(R2::GetCurrentPlaylistName()); g_pServerPresence->SetPort(Cvar_hostport->GetInt()); g_pServerAuthentication->m_bNeedLocalAuthForNewgame = false; @@ -107,9 +100,9 @@ void, __fastcall, (CHostState* self)) g_pCVar->FindVar("net_data_block_enabled")->SetValue(true); g_pServerAuthentication->m_bStartingLocalSPGame = true; - double dStartTime = Tier0::Plat_FloatTime(); + double dStartTime = Plat_FloatTime(); CHostState__State_LoadGame(self); - spdlog::info("loading took {}s", Tier0::Plat_FloatTime() - dStartTime); + spdlog::info("loading took {}s", Plat_FloatTime() - dStartTime); // no server presence, can't do it because no map name in hoststate // and also not super important for sp saves really @@ -126,9 +119,9 @@ void, __fastcall, (CHostState* self)) ServerStartingOrChangingMap(); - double dStartTime = Tier0::Plat_FloatTime(); + double dStartTime = Plat_FloatTime(); CHostState__State_ChangeLevelMP(self); - spdlog::info("loading took {}s", Tier0::Plat_FloatTime() - dStartTime); + spdlog::info("loading took {}s", Plat_FloatTime() - dStartTime); g_pServerPresence->SetMap(g_pHostState->m_levelName); } @@ -151,7 +144,7 @@ void, __fastcall, (CHostState* self)) memset(commandBuf, 0, sizeof(commandBuf)); CCommand tempCommand = *(CCommand*)&commandBuf; if (CCommand__Tokenize( - tempCommand, fmt::format("exec server/cleanup_gamemode_{}", sLastMode).c_str(), R2::cmd_source_t::kCommandSrcCode)) + tempCommand, fmt::format("exec server/cleanup_gamemode_{}", sLastMode).c_str(), cmd_source_t::kCommandSrcCode)) { _Cmd_Exec_f(tempCommand, false, false); Cbuf_Execute(); @@ -168,7 +161,7 @@ void, __fastcall, (CHostState* self, double flCurrentTime, float flFrameTime)) { CHostState__FrameUpdate(self, flCurrentTime, flFrameTime); - if (*R2::g_pServerState == R2::server_state_t::ss_active) + if (*g_pServerState == server_state_t::ss_active) { // update server presence g_pServerPresence->RunFrame(flCurrentTime); |