Added demo system code changes to existing code. #15
@ -5,6 +5,7 @@
|
||||
#include "game/dvars.hpp"
|
||||
|
||||
#include "console.hpp"
|
||||
#include "demo_playback.hpp"
|
||||
|
||||
#include <utils/hook.hpp>
|
||||
#include <utils/string.hpp>
|
||||
@ -13,6 +14,12 @@ namespace dvar_cheats
|
||||
{
|
||||
void apply_sv_cheats(const game::dvar_t* dvar, const game::DvarSetSource source, game::dvar_value* value)
|
||||
{
|
||||
// return early because sv_cheats is enabled when playing back demos
|
||||
if (demo_playback::playing())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (dvar && dvar->name == "sv_cheats"s)
|
||||
{
|
||||
// if dedi, do not allow internal to change value so servers can allow cheats if they want to
|
||||
|
@ -1,5 +1,6 @@
|
||||
#include <std_include.hpp>
|
||||
#include "loader/component_loader.hpp"
|
||||
#include "fps.hpp"
|
||||
#include "scheduler.hpp"
|
||||
|
||||
#include "game/game.hpp"
|
||||
@ -173,6 +174,11 @@ namespace fps
|
||||
}
|
||||
}
|
||||
|
||||
float get_avg_fps()
|
||||
{
|
||||
return 1000.0f / (cg_perf.average + std::numeric_limits<float>::epsilon());
|
||||
}
|
||||
|
||||
class component final : public component_interface
|
||||
{
|
||||
public:
|
||||
|
6
src/client/component/fps.hpp
Normal file
6
src/client/component/fps.hpp
Normal file
@ -0,0 +1,6 @@
|
||||
#pragma once
|
||||
|
||||
namespace fps
|
||||
{
|
||||
[[nodiscard]] float get_avg_fps();
|
||||
}
|
@ -83,6 +83,12 @@ namespace party
|
||||
});
|
||||
}
|
||||
|
||||
void connect_to_dummy_party(const std::string& mapname, const std::string& gametype)
|
||||
{
|
||||
const game::netadr_t dummy_target{};
|
||||
connect_to_party(dummy_target, mapname, gametype);
|
||||
}
|
||||
|
||||
void switch_gamemode_if_necessary(const std::string& gametype)
|
||||
{
|
||||
const auto target_mode = gametype == "aliens" ? game::CODPLAYMODE_ALIENS : game::CODPLAYMODE_CORE;
|
||||
|
@ -2,6 +2,8 @@
|
||||
|
||||
namespace party
|
||||
{
|
||||
void connect_to_dummy_party(const std::string& mapname, const std::string& gametype);
|
||||
|
||||
void switch_gamemode_if_necessary(const std::string& gametype);
|
||||
void perform_game_initialization();
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user