diff --git a/sources/library/application.cpp b/sources/library/application.cpp index 0305632..491ad2a 100644 --- a/sources/library/application.cpp +++ b/sources/library/application.cpp @@ -55,15 +55,15 @@ void CApplication::Run() // if can't obtain directly, find engine functions pointer arrays - m_BuildInfo.Initialize(engineDLL); - g_ClientModule.FindEngfuncs(m_BuildInfo); - g_ServerModule.FindEngfuncs(m_BuildInfo); + m_buildInfo.Initialize(engineDLL); + g_ClientModule.FindEngfuncs(m_buildInfo); + g_ServerModule.FindEngfuncs(m_buildInfo); g_ServerModule.FindHandle(); InitializeConVars(engineDLL); SetCurrentDisplayMode(); PrintTitleText(); - m_Hooks.Apply(); + m_hooks.Apply(); // load configuration file g_pClientEngfuncs->pfnClientCmd("exec gsm_config.cfg"); @@ -71,23 +71,23 @@ void CApplication::Run() void CApplication::InitializeDisplayModes() { - m_pDisplayModes.clear(); - m_pDisplayModes.push_back(std::make_shared()); - m_pDisplayModes.push_back(std::make_shared()); - m_pDisplayModes.push_back(std::make_shared()); - m_pDisplayModes.push_back(std::make_shared()); - m_pDisplayModes.push_back(std::make_shared()); - m_pDisplayModes.push_back(std::make_shared()); + m_displayModes.clear(); + m_displayModes.push_back(std::make_shared()); + m_displayModes.push_back(std::make_shared()); + m_displayModes.push_back(std::make_shared()); + m_displayModes.push_back(std::make_shared()); + m_displayModes.push_back(std::make_shared()); + m_displayModes.push_back(std::make_shared()); } void CApplication::InitializePrimitivesRenderer() { - m_pPrimitivesRenderer = std::make_shared(); + m_primitivesRenderer = std::make_shared(); } void CApplication::HandleChangelevel() { - for (auto &mode : m_pDisplayModes) { + for (auto &mode : m_displayModes) { mode->HandleChangelevel(); } } @@ -211,22 +211,22 @@ void CApplication::InitializeConVars(const SysUtils::ModuleInfo &engineLib) void CApplication::SetCurrentDisplayMode() { - DisplayModeIndex displayMode = Utils::GetCurrentDisplayMode(); - for (auto &mode : m_pDisplayModes) + DisplayModeType displayMode = Utils::GetCurrentDisplayMode(); + for (auto &mode : m_displayModes) { if (mode->GetModeIndex() == displayMode) { - m_pCurrentDisplayMode = mode; + m_currentDisplayMode = mode; return; } } - m_pCurrentDisplayMode = m_pDisplayModes[0]; + m_currentDisplayMode = m_displayModes[0]; } void CApplication::UpdateScreenInfo() { - m_ScreenInfo.iSize = sizeof(m_ScreenInfo); - g_pClientEngfuncs->pfnGetScreenInfo(&m_ScreenInfo); + m_screenInfo.iSize = sizeof(m_screenInfo); + g_pClientEngfuncs->pfnGetScreenInfo(&m_screenInfo); } // should be updated only once in frame @@ -238,17 +238,17 @@ void CApplication::UpdateSmoothFrametime() const float k = 0.24f; const float diffThreshold = 0.13f; float currentTime = g_pClientEngfuncs->GetClientTime(); - float timeDelta = currentTime - m_flLastClientTime; + float timeDelta = currentTime - m_lastClientTime; - if ((timeDelta - m_flLastFrameTime) > diffThreshold) - timeDelta = m_flLastFrameTime; + if ((timeDelta - m_lastFrameTime) > diffThreshold) + timeDelta = m_lastFrameTime; - m_flFrameTime += (timeDelta - m_flFrameTime) * k; - m_flLastFrameTime = m_flFrameTime; - m_flLastClientTime = currentTime; + m_frameTime += (timeDelta - m_frameTime) * k; + m_lastFrameTime = m_frameTime; + m_lastClientTime = currentTime; #elif defined(FILTER_AVG_SIMPLE) float currentTime = g_pClientEngfuncs->GetClientTime(); - float timeDelta = currentTime - m_flLastClientTime; + float timeDelta = currentTime - m_lastClientTime; static float buffer[FILTER_SIZE]; double sum = 0.0; @@ -261,13 +261,13 @@ void CApplication::UpdateSmoothFrametime() sum += buffer[i]; } - m_flLastClientTime = currentTime; - m_flFrameTime = sum / (double)FILTER_SIZE; + m_lastClientTime = currentTime; + m_frameTime = sum / (double)FILTER_SIZE; #else float currentTime = g_pClientEngfuncs->GetClientTime(); - float timeDelta = currentTime - m_flLastClientTime; - m_flFrameTime = timeDelta; - m_flLastClientTime = currentTime; + float timeDelta = currentTime - m_lastClientTime; + m_frameTime = timeDelta; + m_lastClientTime = currentTime; #endif } @@ -276,16 +276,16 @@ void CApplication::DisplayModeRender2D() SetCurrentDisplayMode(); UpdateSmoothFrametime(); UpdateScreenInfo(); - m_pCurrentDisplayMode->Render2D(m_flFrameTime, m_ScreenInfo.iWidth, m_ScreenInfo.iHeight, m_StringStack); + m_currentDisplayMode->Render2D(m_frameTime, m_screenInfo.iWidth, m_screenInfo.iHeight, m_stringStack); } void CApplication::DisplayModeRender3D() { SetCurrentDisplayMode(); - m_pCurrentDisplayMode->Render3D(); + m_currentDisplayMode->Render3D(); } bool CApplication::KeyInput(int keyDown, int keyCode, const char *bindName) { - return m_pCurrentDisplayMode->KeyInput(keyDown != 0, keyCode, bindName); + return m_currentDisplayMode->KeyInput(keyDown != 0, keyCode, bindName); } diff --git a/sources/library/application.h b/sources/library/application.h index 1f4de48..d926c7f 100644 --- a/sources/library/application.h +++ b/sources/library/application.h @@ -36,8 +36,8 @@ class CApplication void DisplayModeRender3D(); void HandleChangelevel(); bool KeyInput(int keyDown, int keyCode, const char *bindName); - inline const SCREENINFO& GetScreenInfo() const { return m_ScreenInfo; }; - inline auto GetRenderer() const { return m_pPrimitivesRenderer; }; + const SCREENINFO& GetScreenInfo() const { return m_screenInfo; }; + auto GetRenderer() const { return m_primitivesRenderer; }; private: CApplication() { @@ -55,15 +55,15 @@ class CApplication void UpdateScreenInfo(); void UpdateSmoothFrametime(); - float m_flFrameTime; - float m_flLastFrameTime; - float m_flLastClientTime; - CHooks m_Hooks; - CBuildInfo m_BuildInfo; - SCREENINFO m_ScreenInfo = { 0 }; - CStringStack m_StringStack = CStringStack(128); - std::shared_ptr m_pCurrentDisplayMode = nullptr; - std::shared_ptr m_pPrimitivesRenderer = nullptr; - std::vector> m_pDisplayModes; + float m_frameTime; + float m_lastFrameTime; + float m_lastClientTime; + CHooks m_hooks; + CBuildInfo m_buildInfo; + SCREENINFO m_screenInfo = { 0 }; + CStringStack m_stringStack = CStringStack(128); + std::shared_ptr m_currentDisplayMode = nullptr; + std::shared_ptr m_primitivesRenderer = nullptr; + std::vector> m_displayModes; }; extern CApplication &g_Application; diff --git a/sources/library/bounding_box.cpp b/sources/library/bounding_box.cpp index 93ee1c4..a4f44ae 100644 --- a/sources/library/bounding_box.cpp +++ b/sources/library/bounding_box.cpp @@ -27,17 +27,17 @@ CBoundingBox::CBoundingBox(const vec3_t &vecMins, const vec3_t &vecMaxs) vec3_t CBoundingBox::GetCenterPoint() const { - return m_vecMins + m_vecSize / 2; + return m_mins + m_size / 2; } void CBoundingBox::SetCenterToPoint(const vec3_t &point) { - Initialize(point - m_vecSize / 2, point + m_vecSize / 2); + Initialize(point - m_size / 2, point + m_size / 2); } CBoundingBox CBoundingBox::GetUnion(const CBoundingBox &operand) const { - CBoundingBox currentBoxCopy(m_vecMins, m_vecMaxs); + CBoundingBox currentBoxCopy(m_mins, m_maxs); currentBoxCopy.CombineWith(operand); return currentBoxCopy; } @@ -46,8 +46,8 @@ void CBoundingBox::CombineWith(const CBoundingBox &operand) { vec3_t unionMins; vec3_t unionMaxs; - const vec3_t &currMins = m_vecMins; - const vec3_t &currMaxs = m_vecMaxs; + const vec3_t &currMins = m_mins; + const vec3_t &currMaxs = m_maxs; const vec3_t &operandMins = operand.GetMins(); const vec3_t &operandMaxs = operand.GetMaxs(); @@ -64,21 +64,21 @@ void CBoundingBox::CombineWith(const CBoundingBox &operand) void CBoundingBox::ExpandToPoint(const vec3_t &point) { - if (point.x < m_vecMins.x) - m_vecMins.x = point.x; - if (point.y < m_vecMins.y) - m_vecMins.y = point.y; - if (point.z < m_vecMins.z) - m_vecMins.z = point.z; - - if (point.x > m_vecMaxs.x) - m_vecMaxs.x = point.x; - if (point.y > m_vecMaxs.y) - m_vecMaxs.y = point.y; - if (point.z > m_vecMaxs.z) - m_vecMaxs.z = point.z; - - Initialize(m_vecMins, m_vecMaxs); + if (point.x < m_mins.x) + m_mins.x = point.x; + if (point.y < m_mins.y) + m_mins.y = point.y; + if (point.z < m_mins.z) + m_mins.z = point.z; + + if (point.x > m_maxs.x) + m_maxs.x = point.x; + if (point.y > m_maxs.y) + m_maxs.y = point.y; + if (point.z > m_maxs.z) + m_maxs.z = point.z; + + Initialize(m_mins, m_maxs); } bool CBoundingBox::Contains(const CBoundingBox &operand) const @@ -86,18 +86,18 @@ bool CBoundingBox::Contains(const CBoundingBox &operand) const const vec3_t &mins = operand.GetMins(); const vec3_t &maxs = operand.GetMaxs(); - if (mins.x < m_vecMins.x || mins.x > m_vecMaxs.x) + if (mins.x < m_mins.x || mins.x > m_maxs.x) return false; - if (mins.y < m_vecMins.y || mins.y > m_vecMaxs.y) + if (mins.y < m_mins.y || mins.y > m_maxs.y) return false; - if (mins.z < m_vecMins.z || mins.z > m_vecMaxs.z) + if (mins.z < m_mins.z || mins.z > m_maxs.z) return false; - if (maxs.x < m_vecMins.x || maxs.x > m_vecMaxs.x) + if (maxs.x < m_mins.x || maxs.x > m_maxs.x) return false; - if (maxs.y < m_vecMins.y || maxs.y > m_vecMaxs.y) + if (maxs.y < m_mins.y || maxs.y > m_maxs.y) return false; - if (maxs.z < m_vecMins.z || maxs.z > m_vecMaxs.z) + if (maxs.z < m_mins.z || maxs.z > m_maxs.z) return false; return true; @@ -105,23 +105,23 @@ bool CBoundingBox::Contains(const CBoundingBox &operand) const bool CBoundingBox::ContainsPoint(const vec3_t &point) const { - if (point.x < m_vecMins.x || point.x > m_vecMaxs.x) + if (point.x < m_mins.x || point.x > m_maxs.x) return false; - if (point.y < m_vecMins.y || point.y > m_vecMaxs.y) + if (point.y < m_mins.y || point.y > m_maxs.y) return false; - if (point.z < m_vecMins.z || point.z > m_vecMaxs.z) + if (point.z < m_mins.z || point.z > m_maxs.z) return false; return true; } double CBoundingBox::GetSurfaceArea() const { - return 2.0 * (m_vecSize.x * m_vecSize.y + m_vecSize.y * m_vecSize.z + m_vecSize.x * m_vecSize.z); + return 2.0 * (m_size.x * m_size.y + m_size.y * m_size.z + m_size.x * m_size.z); } void CBoundingBox::Initialize(const vec3_t &vecMins, const vec3_t &vecMaxs) { - m_vecMins = vecMins; - m_vecMaxs = vecMaxs; - m_vecSize = vecMaxs - vecMins; + m_mins = vecMins; + m_maxs = vecMaxs; + m_size = vecMaxs - vecMins; } diff --git a/sources/library/bounding_box.h b/sources/library/bounding_box.h index d2708b3..7a8854e 100644 --- a/sources/library/bounding_box.h +++ b/sources/library/bounding_box.h @@ -31,14 +31,14 @@ class CBoundingBox bool Contains(const CBoundingBox &operand) const; bool ContainsPoint(const vec3_t &point) const; - inline const vec3_t &GetSize() const { return m_vecSize; }; - inline const vec3_t &GetMins() const { return m_vecMins; }; - inline const vec3_t &GetMaxs() const { return m_vecMaxs; }; + const vec3_t &GetSize() const { return m_size; }; + const vec3_t &GetMins() const { return m_mins; }; + const vec3_t &GetMaxs() const { return m_maxs; }; private: void Initialize(const vec3_t &vecMins, const vec3_t &vecMaxs); - vec3_t m_vecMins = vec3_t(0, 0, 0); - vec3_t m_vecMaxs = vec3_t(0, 0, 0); - vec3_t m_vecSize = vec3_t(0, 0, 0); + vec3_t m_mins = vec3_t(0, 0, 0); + vec3_t m_maxs = vec3_t(0, 0, 0); + vec3_t m_size = vec3_t(0, 0, 0); }; diff --git a/sources/library/build_info.h b/sources/library/build_info.h index 8fd870f..55b0d55 100644 --- a/sources/library/build_info.h +++ b/sources/library/build_info.h @@ -31,6 +31,7 @@ class CBuildInfo PrecacheSound, Count, // keep this last }; + static const size_t k_functionsCount = static_cast(FunctionType::Count); CBuildInfo(); ~CBuildInfo(); diff --git a/sources/library/build_info_entry.cpp b/sources/library/build_info_entry.cpp index 25194df..4ca5499 100644 --- a/sources/library/build_info_entry.cpp +++ b/sources/library/build_info_entry.cpp @@ -17,13 +17,13 @@ GNU General Public License for more details. bool CBuildInfo::Entry::Validate() const { - if (m_iClientEngfuncsOffset > 0) { + if (m_clientEngfuncsOffset > 0) { return true; } for (size_t i = 0; i < static_cast(FunctionType::PrecacheModel); ++i) // check only client-side functions { - const CMemoryPattern &pattern = m_FunctionPatterns[i]; + const CMemoryPattern &pattern = m_functionPatterns[i]; if (!pattern.IsInitialized()) { return false; } diff --git a/sources/library/build_info_entry.h b/sources/library/build_info_entry.h index 10aba33..aab0f47 100644 --- a/sources/library/build_info_entry.h +++ b/sources/library/build_info_entry.h @@ -23,30 +23,35 @@ class CBuildInfo::Entry public: Entry() {}; bool Validate() const; - inline uint32_t GetBuildNumber() const { return m_iBuildNumber; } - inline void SetBuildNumber(uint32_t value) { m_iBuildNumber = value; } - inline bool HasClientEngfuncsOffset() const { return m_iClientEngfuncsOffset != 0; } - inline bool HasServerEngfuncsOffset() const { return m_iServerEngfuncsOffset != 0; } - inline uint64_t GetClientEngfuncsOffset() const { return m_iClientEngfuncsOffset; } - inline uint64_t GetServerEngfuncsOffset() const { return m_iServerEngfuncsOffset; } - inline void SetClientEngfuncsOffset(uint64_t offset) { m_iClientEngfuncsOffset = offset; } - inline void SetServerEngfuncsOffset(uint64_t offset) { m_iServerEngfuncsOffset = offset; } - inline const std::string &GetGameProcessName() const { return m_szGameProcessName; } - inline void SetGameProcessName(const char *value) { m_szGameProcessName.assign(value); } - inline void SetFunctionPattern(CBuildInfo::FunctionType type, CMemoryPattern pattern) { - m_FunctionPatterns[static_cast(type)] = pattern; + + uint32_t GetBuildNumber() const { return m_buildNumber; } + void SetBuildNumber(uint32_t value) { m_buildNumber = value; } + + bool HasClientEngfuncsOffset() const { return m_clientEngfuncsOffset != 0; } + bool HasServerEngfuncsOffset() const { return m_serverEngfuncsOffset != 0; } + uint64_t GetClientEngfuncsOffset() const { return m_clientEngfuncsOffset; } + uint64_t GetServerEngfuncsOffset() const { return m_serverEngfuncsOffset; } + void SetClientEngfuncsOffset(uint64_t offset) { m_clientEngfuncsOffset = offset; } + void SetServerEngfuncsOffset(uint64_t offset) { m_serverEngfuncsOffset = offset; } + + const std::string &GetGameProcessName() const { return m_gameProcessName; } + void SetGameProcessName(const char *value) { m_gameProcessName.assign(value); } + + void SetFunctionPattern(CBuildInfo::FunctionType type, CMemoryPattern pattern) { + m_functionPatterns[static_cast(type)] = pattern; } - inline const CMemoryPattern &GetFunctionPattern(CBuildInfo::FunctionType type) const { - return m_FunctionPatterns[static_cast(type)]; + const CMemoryPattern &GetFunctionPattern(CBuildInfo::FunctionType type) const { + return m_functionPatterns[static_cast(type)]; } - inline bool operator<(const Entry &operand) const { - return m_iBuildNumber < operand.GetBuildNumber(); + + bool operator<(const Entry &operand) const { + return m_buildNumber < operand.GetBuildNumber(); } private: - uint32_t m_iBuildNumber = 0; - std::string m_szGameProcessName; - uint64_t m_iClientEngfuncsOffset = 0x0; - uint64_t m_iServerEngfuncsOffset = 0x0; - CMemoryPattern m_FunctionPatterns[4]; + uint32_t m_buildNumber = 0; + std::string m_gameProcessName; + uint64_t m_clientEngfuncsOffset = 0x0; + uint64_t m_serverEngfuncsOffset = 0x0; + CMemoryPattern m_functionPatterns[CBuildInfo::k_functionsCount]; }; diff --git a/sources/library/build_info_impl.cpp b/sources/library/build_info_impl.cpp index 93137fe..3d08afc 100644 --- a/sources/library/build_info_impl.cpp +++ b/sources/library/build_info_impl.cpp @@ -24,8 +24,8 @@ std::optional CBuildInfo::Impl::GetBuildNumber() const { if (m_pfnGetBuildNumber) return m_pfnGetBuildNumber(); - else if (m_iBuildNumber) - return m_iBuildNumber; + else if (m_buildNumber) + return m_buildNumber; else return std::nullopt; } @@ -230,7 +230,7 @@ bool CBuildInfo::Impl::ApproxBuildNumber(const SysUtils::ModuleInfo &engineModul const char *dateString = FindDateString(probeAddr, scanOffset); if (dateString) { - m_iBuildNumber = DateToBuildNumber(dateString); + m_buildNumber = DateToBuildNumber(dateString); return true; } else diff --git a/sources/library/build_info_impl.h b/sources/library/build_info_impl.h index ed8fd87..b8e537d 100644 --- a/sources/library/build_info_impl.h +++ b/sources/library/build_info_impl.h @@ -37,7 +37,7 @@ class CBuildInfo::Impl bool FindBuildNumberFunc(const SysUtils::ModuleInfo &engineModule); std::optional FindActualInfoEntry(); - uint32_t m_iBuildNumber = -1; + uint32_t m_buildNumber = -1; bool m_infoEntryGameSpecific = false; pfnGetBuildNumber_t m_pfnGetBuildNumber = nullptr; std::string m_initErrorMessage; diff --git a/sources/library/bvh_tree.cpp b/sources/library/bvh_tree.cpp index b93fe64..24e9727 100644 --- a/sources/library/bvh_tree.cpp +++ b/sources/library/bvh_tree.cpp @@ -23,13 +23,13 @@ GNU General Public License for more details. CBVHTree::CBVHTree(const std::vector *descList) { - m_DescList = descList; + m_descList = descList; } void CBVHTree::Reset() { - m_Nodes.clear(); - m_iRootNodeIndex = -1; + m_nodes.clear(); + m_rootNodeIndex = -1; } void CBVHTree::Build() @@ -43,13 +43,13 @@ void CBVHTree::Build() bool CBVHTree::FindLeaf(const CBoundingBox &box, int &nodeIndex, int &iterCount) { std::stack nodesStack; - nodesStack.push(m_iRootNodeIndex); + nodesStack.push(m_rootNodeIndex); iterCount = 0; while (!nodesStack.empty()) { int currNode = nodesStack.top(); - CBVHTreeNode &node = m_Nodes[currNode]; + CBVHTreeNode &node = m_nodes[currNode]; const CBoundingBox &nodeBounds = node.GetBoundingBox(); nodesStack.pop(); @@ -84,9 +84,9 @@ bool CBVHTree::FindLeaf(const CBoundingBox &box, int &nodeIndex, int &iterCount) double CBVHTree::ComputeCost() const { double cost = 0.0; - for (size_t i = 0; i < m_Nodes.size(); ++i) + for (size_t i = 0; i < m_nodes.size(); ++i) { - const CBVHTreeNode &node = m_Nodes[i]; + const CBVHTreeNode &node = m_nodes[i]; if (!node.IsLeaf()) { cost += node.GetBoundingBox().GetSurfaceArea(); } @@ -96,14 +96,14 @@ double CBVHTree::ComputeCost() const void CBVHTree::Visualize(bool textRendering) { - if (m_Nodes.size() < 1) + if (m_nodes.size() < 1) return; std::stack nodesStack; - nodesStack.push(m_iRootNodeIndex); + nodesStack.push(m_rootNodeIndex); while (!nodesStack.empty()) { - CBVHTreeNode &node = m_Nodes[nodesStack.top()]; + CBVHTreeNode &node = m_nodes[nodesStack.top()]; const CBoundingBox &nodeBounds = node.GetBoundingBox(); const int nodeIndex = node.GetIndex(); nodesStack.pop(); @@ -131,9 +131,9 @@ std::string CBVHTree::GetGraphvisDescription() const treeDesc += "digraph bvh_tree {\n"; // mark leaf nodes that has linked descriptions as red boxes - for (size_t i = 0; i < m_Nodes.size(); ++i) + for (size_t i = 0; i < m_nodes.size(); ++i) { - const CBVHTreeNode &node = m_Nodes[i]; + const CBVHTreeNode &node = m_nodes[i]; if (node.IsLeaf()) { treeDesc += std::to_string(i) + " [shape=box]"; @@ -144,10 +144,10 @@ std::string CBVHTree::GetGraphvisDescription() const } } - nodesStack.push(m_iRootNodeIndex); + nodesStack.push(m_rootNodeIndex); while (!nodesStack.empty()) { - const CBVHTreeNode &node = m_Nodes[nodesStack.top()]; + const CBVHTreeNode &node = m_nodes[nodesStack.top()]; int leftChild = node.GetLeftChild(); int rightChild = node.GetRightChild(); nodesStack.pop(); @@ -171,10 +171,10 @@ void CBVHTree::BuildBottomUp() std::vector gameObjects = GetGameObjects(); // create and initialize leaf nodes - m_Nodes.reserve(gameObjects.size()); + m_nodes.reserve(gameObjects.size()); for (int i : gameObjects) { - const CEntityDescription &desc = m_DescList->at(i); + const CEntityDescription &desc = m_descList->at(i); int newNode = AppendNode(desc.GetBoundingBox()); NodeAt(newNode).SetDescriptionIndex(i); inputNodes.push_back(newNode); @@ -184,7 +184,7 @@ void CBVHTree::BuildBottomUp() { if (inputNodes.size() == 1) { - m_iRootNodeIndex = inputNodes[0]; + m_rootNodeIndex = inputNodes[0]; return; } MergeLevelNodes(inputNodes, outputNodes); @@ -258,7 +258,7 @@ void CBVHTree::PrintReport() line.assign(treeDesc, offset, 500); g_pClientEngfuncs->Con_Printf(line.c_str()); } - g_pClientEngfuncs->Con_Printf("BVH nodes: %d\nBVH tree cost: %f\n", m_Nodes.size(), ComputeCost()); + g_pClientEngfuncs->Con_Printf("BVH nodes: %d\nBVH tree cost: %f\n", m_nodes.size(), ComputeCost()); } // Not suitable for game objects, tree doesn't covers all game objects with leaf nodes @@ -266,17 +266,17 @@ void CBVHTree::BuildTopDown() { std::vector rootNodeObjects = GetGameObjects(); int rootNode = AppendNode(CalcNodeBoundingBox(rootNodeObjects)); - m_Nodes.reserve(rootNodeObjects.size()); - m_iRootNodeIndex = rootNode; + m_nodes.reserve(rootNodeObjects.size()); + m_rootNodeIndex = rootNode; - m_NodesStack.push(m_iRootNodeIndex); - m_ObjectListStack.push(rootNodeObjects); - while (!m_NodesStack.empty()) + m_nodesStack.push(m_rootNodeIndex); + m_objectListStack.push(rootNodeObjects); + while (!m_nodesStack.empty()) { - CBVHTreeNode &node = m_Nodes[m_NodesStack.top()]; - ObjectList nodeObjects = m_ObjectListStack.top(); - m_NodesStack.pop(); - m_ObjectListStack.pop(); + CBVHTreeNode &node = m_nodes[m_nodesStack.top()]; + ObjectList nodeObjects = m_objectListStack.top(); + m_nodesStack.pop(); + m_objectListStack.pop(); SplitNode(node, nodeObjects); } } @@ -299,7 +299,7 @@ void CBVHTree::SplitNode(CBVHTreeNode &node, ObjectList nodeObjects) for (int i : nodeObjects) { - const CEntityDescription &desc = m_DescList->at(i); + const CEntityDescription &desc = m_descList->at(i); vec3_t objectCenter = desc.GetBoundingBox().GetCenterPoint(); for (int j = 0; j < 3; ++j) { @@ -346,22 +346,22 @@ void CBVHTree::SplitNode(CBVHTreeNode &node, ObjectList nodeObjects) int leftNode = AppendNode(CalcNodeBoundingBox(*leftElements), nodeIndex); int rightNode = AppendNode(CalcNodeBoundingBox(*rightElements), nodeIndex); - m_NodesStack.push(leftNode); - m_NodesStack.push(rightNode); - m_ObjectListStack.push(*leftElements); - m_ObjectListStack.push(*rightElements); + m_nodesStack.push(leftNode); + m_nodesStack.push(rightNode); + m_objectListStack.push(*leftElements); + m_objectListStack.push(*rightElements); } // Returns appended node index int CBVHTree::AppendNode(const CBoundingBox &nodeBounds, int parent) { if (parent >= 0) { - m_Nodes.emplace_back(CBVHTreeNode(m_Nodes.size(), nodeBounds, m_Nodes[parent])); + m_nodes.emplace_back(CBVHTreeNode(m_nodes.size(), nodeBounds, m_nodes[parent])); } else { - m_Nodes.emplace_back(CBVHTreeNode(m_Nodes.size(), nodeBounds)); + m_nodes.emplace_back(CBVHTreeNode(m_nodes.size(), nodeBounds)); } - return m_Nodes.size() - 1; + return m_nodes.size() - 1; } CBoundingBox CBVHTree::CalcNodeBoundingBox(ObjectList nodeObjects, float epsilon) @@ -370,7 +370,7 @@ CBoundingBox CBVHTree::CalcNodeBoundingBox(ObjectList nodeObjects, float epsilon const vec3_t fudge = vec3_t(epsilon, epsilon, epsilon); for (int i : nodeObjects) { - const CEntityDescription &desc = m_DescList->at(i); + const CEntityDescription &desc = m_descList->at(i); nodeBounds.CombineWith(desc.GetBoundingBox()); } return CBoundingBox(nodeBounds.GetMins() - fudge, nodeBounds.GetMaxs() + fudge); @@ -380,7 +380,7 @@ std::vector CBVHTree::GetGameObjects() { // skip worldspawn here std::vector objectList; - for (size_t i = 1; i < m_DescList->size(); ++i) { + for (size_t i = 1; i < m_descList->size(); ++i) { objectList.push_back(i); } return objectList; diff --git a/sources/library/bvh_tree.h b/sources/library/bvh_tree.h index a1c7120..8406ec6 100644 --- a/sources/library/bvh_tree.h +++ b/sources/library/bvh_tree.h @@ -29,11 +29,11 @@ class CBVHTree double ComputeCost() const; bool FindLeaf(const CBoundingBox &box, int &nodeIndex, int &iterCount); void Visualize(bool textRendering); - inline const CBVHTreeNode &GetNode(int index) const { return m_Nodes[index]; } + const CBVHTreeNode &GetNode(int index) const { return m_nodes[index]; } private: typedef std::vector ObjectList; - inline CBVHTreeNode &NodeAt(int index) { return m_Nodes[index]; } + CBVHTreeNode &NodeAt(int index) { return m_nodes[index]; } void PrintReport(); void BuildTopDown(); @@ -45,9 +45,9 @@ class CBVHTree std::string GetGraphvisDescription() const; std::vector GetGameObjects(); - int m_iRootNodeIndex = -1; - std::stack m_NodesStack; - std::stack m_ObjectListStack; - std::vector m_Nodes; - const std::vector *m_DescList; + int m_rootNodeIndex = -1; + std::stack m_nodesStack; + std::stack m_objectListStack; + std::vector m_nodes; + const std::vector *m_descList; }; diff --git a/sources/library/bvh_tree_node.cpp b/sources/library/bvh_tree_node.cpp index a2f94dd..945ba9c 100644 --- a/sources/library/bvh_tree_node.cpp +++ b/sources/library/bvh_tree_node.cpp @@ -21,15 +21,15 @@ CBVHTreeNode::CBVHTreeNode() CBVHTreeNode::CBVHTreeNode(int index, const CBoundingBox &box) { - m_iIndex = index; - m_BoundingBox = box; + m_index = index; + m_boundingBox = box; } CBVHTreeNode::CBVHTreeNode(int index, const CBoundingBox &box, CBVHTreeNode &parent) { - m_iIndex = index; - m_BoundingBox = box; - m_iParentNode = parent.GetIndex(); + m_index = index; + m_boundingBox = box; + m_parentNode = parent.GetIndex(); if (parent.GetLeftChild() < 0) { parent.SetLeftChild(index); } diff --git a/sources/library/bvh_tree_node.h b/sources/library/bvh_tree_node.h index 0bf128e..9c92c37 100644 --- a/sources/library/bvh_tree_node.h +++ b/sources/library/bvh_tree_node.h @@ -21,25 +21,25 @@ class CBVHTreeNode CBVHTreeNode(); CBVHTreeNode(int index, const CBoundingBox &box); CBVHTreeNode(int index, const CBoundingBox &box, CBVHTreeNode &parent); - inline void SetParent(int index) { m_iParentNode = index; }; - inline void SetLeftChild(int index) { m_iLeftChildNode = index; }; - inline void SetRightChild(int index) { m_iRightChildNode = index; }; - inline void SetBoundingBox(const CBoundingBox &box) { m_BoundingBox = box; }; - inline void SetDescriptionIndex(int value) { m_iDescriptionIndex = value; }; - inline int GetIndex() const { return m_iIndex; }; - inline int GetParent() const { return m_iParentNode; } - inline int GetLeftChild() const { return m_iLeftChildNode; }; - inline int GetRightChild() const { return m_iRightChildNode; }; - inline int GetDescriptionIndex() const { return m_iDescriptionIndex; } - inline const CBoundingBox &GetBoundingBox() const { return m_BoundingBox; }; - inline const vec3_t &GetSize() const { return m_BoundingBox.GetSize(); }; - inline bool IsLeaf() const { return m_iLeftChildNode < 0 && m_iRightChildNode < 0; }; + void SetParent(int index) { m_parentNode = index; }; + void SetLeftChild(int index) { m_leftChildNode = index; }; + void SetRightChild(int index) { m_rightChildNode = index; }; + void SetBoundingBox(const CBoundingBox &box) { m_boundingBox = box; }; + void SetDescriptionIndex(int value) { m_descriptionIndex = value; }; + int GetIndex() const { return m_index; }; + int GetParent() const { return m_parentNode; } + int GetLeftChild() const { return m_leftChildNode; }; + int GetRightChild() const { return m_rightChildNode; }; + int GetDescriptionIndex() const { return m_descriptionIndex; } + const CBoundingBox &GetBoundingBox() const { return m_boundingBox; }; + const vec3_t &GetSize() const { return m_boundingBox.GetSize(); }; + bool IsLeaf() const { return m_leftChildNode < 0 && m_rightChildNode < 0; }; private: - int m_iIndex = 0; - int m_iParentNode = -1; - int m_iLeftChildNode = -1; - int m_iRightChildNode = -1; - int m_iDescriptionIndex = -1; - CBoundingBox m_BoundingBox; + int m_index = 0; + int m_parentNode = -1; + int m_leftChildNode = -1; + int m_rightChildNode = -1; + int m_descriptionIndex = -1; + CBoundingBox m_boundingBox; }; diff --git a/sources/library/client_module.cpp b/sources/library/client_module.cpp index 7372f69..f291ef2 100644 --- a/sources/library/client_module.cpp +++ b/sources/library/client_module.cpp @@ -32,9 +32,9 @@ CClientModule& CClientModule::GetInstance() bool CClientModule::FindHandle() { ProcessHandle currProcess = SysUtils::GetCurrentProcessHandle(); - m_hModule = SysUtils::FindModuleByExport(currProcess, "HUD_ProcessPlayerState"); - SysUtils::GetModuleInfo(currProcess, m_hModule, m_ModuleInfo); - return m_hModule.Valid(); + m_moduleHandle = SysUtils::FindModuleByExport(currProcess, "HUD_ProcessPlayerState"); + SysUtils::GetModuleInfo(currProcess, m_moduleHandle, m_moduleInfo); + return m_moduleHandle.Valid(); } bool CClientModule::FindEngfuncs(const CBuildInfo &buildInfo) @@ -137,7 +137,7 @@ uint8_t* CClientModule::GetFuncAddress(const char *funcName) CClientModule::CClientModule() { - m_ModuleInfo.baseAddress = nullptr; - m_ModuleInfo.entryPointAddress = nullptr; - m_ModuleInfo.imageSize = 0; + m_moduleInfo.baseAddress = nullptr; + m_moduleInfo.entryPointAddress = nullptr; + m_moduleInfo.imageSize = 0; } diff --git a/sources/library/client_module.h b/sources/library/client_module.h index 0fccac9..c0556ff 100644 --- a/sources/library/client_module.h +++ b/sources/library/client_module.h @@ -26,10 +26,10 @@ class CClientModule bool FindHandle(); bool FindEngfuncs(const CBuildInfo &buildInfo); uint8_t *GetFuncAddress(const char *funcName); - inline ModuleHandle GetHandle() const { return m_hModule; } - inline uint8_t *GetBaseAddress() const { return m_ModuleInfo.baseAddress; } - inline uint8_t *GetEntryPoint() const { return m_ModuleInfo.entryPointAddress; } - inline size_t GetSize() const { return m_ModuleInfo.imageSize; } + ModuleHandle GetHandle() const { return m_moduleHandle; } + uint8_t *GetBaseAddress() const { return m_moduleInfo.baseAddress; } + uint8_t *GetEntryPoint() const { return m_moduleInfo.entryPointAddress; } + size_t GetSize() const { return m_moduleInfo.imageSize; } private: CClientModule(); @@ -38,8 +38,8 @@ class CClientModule cl_enginefunc_t* SearchEngfuncsTable(uint8_t *pfnSPR_Load, uint8_t *pfnSPR_Frames); - ModuleHandle m_hModule = NULL; - SysUtils::ModuleInfo m_ModuleInfo; + ModuleHandle m_moduleHandle = NULL; + SysUtils::ModuleInfo m_moduleInfo; }; extern CClientModule& g_ClientModule; diff --git a/sources/library/display_mode.h b/sources/library/display_mode.h index 519ad98..6a99115 100644 --- a/sources/library/display_mode.h +++ b/sources/library/display_mode.h @@ -15,14 +15,14 @@ GNU General Public License for more details. #pragma once #include "string_stack.h" -enum DisplayModeIndex +enum class DisplayModeType { - DISPLAYMODE_FULL, - DISPLAYMODE_SPEEDOMETER, - DISPLAYMODE_ENTITYREPORT, - DISPLAYMODE_MEASUREMENT, - DISPLAYMODE_FACEREPORT, - DISPLAYMODE_ANGLETRACKING + Full, + Speedometer, + EntityReport, + Measurement, + FaceReport, + AngleTracking }; class IDisplayMode @@ -33,5 +33,5 @@ class IDisplayMode virtual void Render3D() = 0; virtual bool KeyInput(bool keyDown, int keyCode, const char *bindName) = 0; virtual void HandleChangelevel() = 0; - virtual DisplayModeIndex GetModeIndex() = 0; + virtual DisplayModeType GetModeIndex() = 0; }; diff --git a/sources/library/displaymode_angletracking.cpp b/sources/library/displaymode_angletracking.cpp index 4939e84..0840044 100644 --- a/sources/library/displaymode_angletracking.cpp +++ b/sources/library/displaymode_angletracking.cpp @@ -19,10 +19,10 @@ GNU General Public License for more details. CModeAngleTracking::CModeAngleTracking() { - m_vecLastAngles = Vector(0.0f, 0.0f, 0.0f); - m_flTrackStartTime = 0.0f; - m_flLastYawVelocity = 0.0f; - m_flLastPitchVelocity = 0.0f; + m_lastAngles = Vector(0.0f, 0.0f, 0.0f); + m_trackStartTime = 0.0f; + m_lastYawVelocity = 0.0f; + m_lastPitchVelocity = 0.0f; } void CModeAngleTracking::Render2D(float frameTime, int scrWidth, int scrHeight, CStringStack &screenText) @@ -32,8 +32,8 @@ void CModeAngleTracking::Render2D(float frameTime, int scrWidth, int scrHeight, const float threshold = 0.001f; const vec3_t &currAngles = g_LocalPlayer.GetAngles(); - float pitchVelocity = (currAngles.x - m_vecLastAngles.x) / frameTime; - float yawVelocity = (currAngles.y - m_vecLastAngles.y) / frameTime; + float pitchVelocity = (currAngles.x - m_lastAngles.x) / frameTime; + float yawVelocity = (currAngles.y - m_lastAngles.y) / frameTime; screenText.Clear(); screenText.PushPrintf(" up : %.2f deg/s", -pitchVelocity); @@ -48,23 +48,23 @@ void CModeAngleTracking::Render2D(float frameTime, int scrWidth, int scrHeight, ); // check for start - if (fabs(m_flLastPitchVelocity) < threshold && fabs(pitchVelocity) > threshold) { - m_flTrackStartTime = g_pClientEngfuncs->GetClientTime(); + if (fabs(m_lastPitchVelocity) < threshold && fabs(pitchVelocity) > threshold) { + m_trackStartTime = g_pClientEngfuncs->GetClientTime(); } if (fabs(pitchVelocity) > threshold) { g_pClientEngfuncs->Con_Printf("(%.5f; %.2f)\n", - (g_pClientEngfuncs->GetClientTime() - m_flTrackStartTime), -pitchVelocity + (g_pClientEngfuncs->GetClientTime() - m_trackStartTime), -pitchVelocity ); } // check for end - if (fabs(pitchVelocity) < threshold && fabs(m_flLastPitchVelocity) > threshold) { + if (fabs(pitchVelocity) < threshold && fabs(m_lastPitchVelocity) > threshold) { g_pClientEngfuncs->Con_Printf("\n"); } - m_vecLastAngles = currAngles; - m_flLastPitchVelocity = pitchVelocity; - m_flLastYawVelocity = yawVelocity; + m_lastAngles = currAngles; + m_lastPitchVelocity = pitchVelocity; + m_lastYawVelocity = yawVelocity; } diff --git a/sources/library/displaymode_angletracking.h b/sources/library/displaymode_angletracking.h index 9530f65..dd5a250 100644 --- a/sources/library/displaymode_angletracking.h +++ b/sources/library/displaymode_angletracking.h @@ -26,11 +26,11 @@ class CModeAngleTracking : public IDisplayMode void Render3D() override {}; bool KeyInput(bool, int, const char *) override { return true; }; void HandleChangelevel() override {}; - DisplayModeIndex GetModeIndex() override { return DISPLAYMODE_ANGLETRACKING; }; + DisplayModeType GetModeIndex() override { return DisplayModeType::AngleTracking; }; private: - vec3_t m_vecLastAngles; - float m_flTrackStartTime; - float m_flLastYawVelocity; - float m_flLastPitchVelocity; + vec3_t m_lastAngles; + float m_trackStartTime; + float m_lastYawVelocity; + float m_lastPitchVelocity; }; diff --git a/sources/library/displaymode_entityreport.cpp b/sources/library/displaymode_entityreport.cpp index 44e2899..c5c37d1 100644 --- a/sources/library/displaymode_entityreport.cpp +++ b/sources/library/displaymode_entityreport.cpp @@ -26,10 +26,10 @@ GNU General Public License for more details. CModeEntityReport::CModeEntityReport() { - m_iEntityIndex = 0; - m_iLockedEntityIndex = 0; - m_EntityIndexList = {}; - m_EntityDistanceList = {}; + m_entityIndex = 0; + m_lockedEntityIndex = 0; + m_entityIndexList = {}; + m_entityDistanceList = {}; } void CModeEntityReport::Render2D(float frameTime, int scrWidth, int scrHeight, CStringStack &screenText) @@ -41,11 +41,11 @@ void CModeEntityReport::Render2D(float frameTime, int scrWidth, int scrHeight, C g_EntityDictionary.Initialize(); screenText.Clear(); - m_iEntityIndex = TraceEntity(); + m_entityIndex = TraceEntity(); if (!PrintEntityInfo(GetActualEntityIndex(), screenText)) { // disable hull highlighting for this entity - m_iEntityIndex = 0; + m_entityIndex = 0; } if (debugMode == 2) { @@ -90,22 +90,22 @@ void CModeEntityReport::Render3D() bool CModeEntityReport::KeyInput(bool keyDown, int keyCode, const char *bindName) { - if (Utils::GetCurrentDisplayMode() != DISPLAYMODE_ENTITYREPORT || !keyDown) { + if (Utils::GetCurrentDisplayMode() != DisplayModeType::EntityReport || !keyDown) { return true; } if (keyCode == 'v') { - if (m_iEntityIndex > 0) { - if (m_iEntityIndex == m_iLockedEntityIndex) { - m_iLockedEntityIndex = 0; + if (m_entityIndex > 0) { + if (m_entityIndex == m_lockedEntityIndex) { + m_lockedEntityIndex = 0; } else { - m_iLockedEntityIndex = m_iEntityIndex; + m_lockedEntityIndex = m_entityIndex; } } else { - m_iLockedEntityIndex = 0; + m_lockedEntityIndex = 0; } g_pClientEngfuncs->pfnPlaySoundByName("buttons/blip1.wav", 0.8f); return false; @@ -127,8 +127,8 @@ int CModeEntityReport::TraceEntity() float worldDistance = lineLen; int ignoredEnt = -1; - m_EntityIndexList.clear(); - m_EntityDistanceList.clear(); + m_entityIndexList.clear(); + m_entityDistanceList.clear(); viewOrigin = g_LocalPlayer.GetViewOrigin(); viewDir = g_LocalPlayer.GetViewDirection(); @@ -161,21 +161,21 @@ int CModeEntityReport::TraceEntity() int physEntIndex = TracePhysEntList(physEntLists[i], physEntListsLen[i], viewOrigin, viewDir, lineLen); if (physEntIndex) { - m_EntityIndexList.push_back(physEntIndex); - m_EntityDistanceList.push_back(GetEntityDistance(physEntIndex)); + m_entityIndexList.push_back(physEntIndex); + m_entityDistanceList.push_back(GetEntityDistance(physEntIndex)); } } // get nearest entity from all lists // also add world for comparision - m_EntityIndexList.push_back(0); - m_EntityDistanceList.push_back(worldDistance); - auto &distanceList = m_EntityDistanceList; + m_entityIndexList.push_back(0); + m_entityDistanceList.push_back(worldDistance); + auto &distanceList = m_entityDistanceList; if (distanceList.size() > 1) { auto iterNearestEnt = std::min_element(std::begin(distanceList), std::end(distanceList)); if (std::end(distanceList) != iterNearestEnt) - return m_EntityIndexList[std::distance(distanceList.begin(), iterNearestEnt)]; + return m_entityIndexList[std::distance(distanceList.begin(), iterNearestEnt)]; } return 0; } @@ -307,7 +307,7 @@ bool CModeEntityReport::PrintEntityInfo(int entityIndex, CStringStack &screenTex screenText.Push("Entity properties not found"); } - if (!m_iLockedEntityIndex) { + if (!m_lockedEntityIndex) { screenText.Push("Press V to hold on current entity"); } } @@ -351,10 +351,10 @@ void CModeEntityReport::PrintEntityCommonInfo(int entityIndex, CStringStack &scr int CModeEntityReport::GetActualEntityIndex() { - if (m_iLockedEntityIndex > 0) { - return m_iLockedEntityIndex; + if (m_lockedEntityIndex > 0) { + return m_lockedEntityIndex; } else { - return m_iEntityIndex; + return m_entityIndex; } } diff --git a/sources/library/displaymode_entityreport.h b/sources/library/displaymode_entityreport.h index 7af18d0..5400aee 100644 --- a/sources/library/displaymode_entityreport.h +++ b/sources/library/displaymode_entityreport.h @@ -27,7 +27,7 @@ class CModeEntityReport : public IDisplayMode void Render3D() override; bool KeyInput(bool keyDown, int keyCode, const char *bindName) override; void HandleChangelevel() override; - DisplayModeIndex GetModeIndex() override { return DISPLAYMODE_ENTITYREPORT; }; + DisplayModeType GetModeIndex() override { return DisplayModeType::EntityReport; }; private: int TraceEntity(); @@ -38,8 +38,8 @@ class CModeEntityReport : public IDisplayMode void PrintEntityCommonInfo(int entityIndex, CStringStack &screenText); int GetActualEntityIndex(); - int m_iEntityIndex; - int m_iLockedEntityIndex; - std::vector m_EntityIndexList; - std::vector m_EntityDistanceList; + int m_entityIndex; + int m_lockedEntityIndex; + std::vector m_entityIndexList; + std::vector m_entityDistanceList; }; diff --git a/sources/library/displaymode_facereport.cpp b/sources/library/displaymode_facereport.cpp index e26f73c..e86e247 100644 --- a/sources/library/displaymode_facereport.cpp +++ b/sources/library/displaymode_facereport.cpp @@ -28,10 +28,10 @@ GNU General Public License for more details. CModeFaceReport::CModeFaceReport() { - m_ColorProbe = { 0 }; - m_pCurrentModel = nullptr; - m_pCurrentFace = nullptr; - m_BoundPoints = {}; + m_colorProbe = { 0 }; + m_currentModel = nullptr; + m_currentFace = nullptr; + m_boundPoints = {}; } void CModeFaceReport::Render2D(float frameTime, int scrWidth, int scrHeight, CStringStack &screenText) @@ -40,35 +40,35 @@ void CModeFaceReport::Render2D(float frameTime, int scrWidth, int scrHeight, CSt vec3_t intersectPoint; vec3_t viewOrigin = g_LocalPlayer.GetViewOrigin(); vec3_t viewDir = g_LocalPlayer.GetViewDirection(); - m_pCurrentFace = TraceSurface(viewOrigin, viewDir, lineLen, intersectPoint); + m_currentFace = TraceSurface(viewOrigin, viewDir, lineLen, intersectPoint); screenText.Clear(); - if (m_pCurrentFace) + if (m_currentFace) { - const mplane_t *plane = m_pCurrentFace->plane; - const Engine::texture_t *texture = Engine::CastType(m_pCurrentFace->texinfo->texture); + const mplane_t *plane = m_currentFace->plane; + const Engine::texture_t *texture = Engine::CastType(m_currentFace->texinfo->texture); vec3_t planeCenter = plane->normal * plane->dist; - int32_t lightmapWidth = (m_pCurrentFace->extents[0] >> 4) + 1; - int32_t lightmapHeight = (m_pCurrentFace->extents[1] >> 4) + 1; + int32_t lightmapWidth = (m_currentFace->extents[0] >> 4) + 1; + int32_t lightmapHeight = (m_currentFace->extents[1] >> 4) + 1; - m_ColorProbe = { 0 }; - GetSurfaceBoundingBox(m_pCurrentFace, m_CurrentFaceBounds); - const vec3_t &surfSize = m_CurrentFaceBounds.GetSize(); + m_colorProbe = { 0 }; + GetSurfaceBoundingBox(m_currentFace, m_currentFaceBounds); + const vec3_t &surfSize = m_currentFaceBounds.GetSize(); - screenText.PushPrintf("Model Name: %s", m_pCurrentModel->name); + screenText.PushPrintf("Model Name: %s", m_currentModel->name); screenText.PushPrintf("Texture Name: %s", texture->name); screenText.PushPrintf("Texture Size: %d x %d", texture->width, texture->height); screenText.PushPrintf("Lightmap Size: %d x %d", lightmapWidth, lightmapHeight); - screenText.PushPrintf("Edges: %d", m_pCurrentFace->numedges); - screenText.PushPrintf("Surfaces: %d", m_pCurrentModel->nummodelsurfaces); + screenText.PushPrintf("Edges: %d", m_currentFace->numedges); + screenText.PushPrintf("Surfaces: %d", m_currentModel->nummodelsurfaces); screenText.PushPrintf("Bounds: (%.1f; %.1f; %.1f)", surfSize.x, surfSize.y, surfSize.z); screenText.PushPrintf("Normal: (%.1f; %.1f; %.1f)", plane->normal.x, plane->normal.y, plane->normal.z); screenText.PushPrintf("Intersect point: (%.1f; %.1f; %.1f)", intersectPoint.x, intersectPoint.y, intersectPoint.z); - if (GetLightmapProbe(m_pCurrentFace, intersectPoint, m_ColorProbe)) + if (GetLightmapProbe(m_currentFace, intersectPoint, m_colorProbe)) { screenText.PushPrintf("Lightmap Color: %d %d %d", - m_ColorProbe.r, m_ColorProbe.g, m_ColorProbe.b); + m_colorProbe.r, m_colorProbe.g, m_colorProbe.b); screenText.Push("Press V to print lightmap info"); } } @@ -85,13 +85,13 @@ void CModeFaceReport::Render2D(float frameTime, int scrWidth, int scrHeight, CSt void CModeFaceReport::Render3D() { - if (m_pCurrentFace && m_pCurrentModel) + if (m_currentFace && m_currentModel) { g_pClientEngfuncs->pTriAPI->RenderMode(kRenderTransColor); g_pClientEngfuncs->pTriAPI->CullFace(TRI_NONE); glDisable(GL_TEXTURE_2D); glDisable(GL_DEPTH_TEST); - DrawFaceOutline(m_pCurrentFace); + DrawFaceOutline(m_currentFace); //DrawSurfaceBounds(m_pCurrentFace); g_pClientEngfuncs->pTriAPI->RenderMode(kRenderNormal); g_pClientEngfuncs->pTriAPI->CullFace(TRI_FRONT); @@ -104,11 +104,11 @@ bool CModeFaceReport::KeyInput(bool keyDown, int keyNum, const char *bindName) { if (keyDown && keyNum == 'v') { - if (m_pCurrentFace) + if (m_currentFace) { - const texture_t *texture = m_pCurrentFace->texinfo->texture; + const texture_t *texture = m_currentFace->texinfo->texture; g_pClientEngfuncs->Con_Printf("%s %d %d %d\n", - texture->name, m_ColorProbe.r, m_ColorProbe.g, m_ColorProbe.b); + texture->name, m_colorProbe.r, m_colorProbe.g, m_colorProbe.b); g_pClientEngfuncs->pfnPlaySoundByName("buttons/blip1.wav", 0.8f); return false; } @@ -118,8 +118,8 @@ bool CModeFaceReport::KeyInput(bool keyDown, int keyNum, const char *bindName) void CModeFaceReport::HandleChangelevel() { - m_pCurrentModel = nullptr; - m_pCurrentFace = nullptr; + m_currentModel = nullptr; + m_currentFace = nullptr; } int CModeFaceReport::TraceEntity(vec3_t origin, vec3_t dir, float distance, vec3_t &intersect) @@ -144,23 +144,23 @@ int CModeFaceReport::TraceEntity(vec3_t origin, vec3_t dir, float distance, vec3 void CModeFaceReport::GetSurfaceBoundingBox(Engine::msurface_t *surf, CBoundingBox &bbox) { bbox = CBoundingBox(); - m_BoundPoints.reserve(surf->numedges * 2); - m_BoundPoints.clear(); + m_boundPoints.reserve(surf->numedges * 2); + m_boundPoints.clear(); for (int i = 0; i < surf->numedges; ++i) { - int edgeIndex = m_pCurrentModel->surfedges[surf->firstedge + i]; - const medge_t *edge = m_pCurrentModel->edges + (edgeIndex >= 0 ? edgeIndex : -edgeIndex); - const mvertex_t *vertex = m_pCurrentModel->vertexes + (edgeIndex >= 0 ? edge->v[0] : edge->v[1]); - m_BoundPoints.push_back(vertex->position); + int edgeIndex = m_currentModel->surfedges[surf->firstedge + i]; + const medge_t *edge = m_currentModel->edges + (edgeIndex >= 0 ? edgeIndex : -edgeIndex); + const mvertex_t *vertex = m_currentModel->vertexes + (edgeIndex >= 0 ? edge->v[0] : edge->v[1]); + m_boundPoints.push_back(vertex->position); } - if (m_BoundPoints.size() > 0) + if (m_boundPoints.size() > 0) { - bbox.SetCenterToPoint(m_BoundPoints[0]); - for (size_t i = 0; i < m_BoundPoints.size(); ++i) + bbox.SetCenterToPoint(m_boundPoints[0]); + for (size_t i = 0; i < m_boundPoints.size(); ++i) { - const vec3_t &vertex = m_BoundPoints[i]; + const vec3_t &vertex = m_boundPoints[i]; bbox.ExpandToPoint(vertex); } } @@ -184,10 +184,10 @@ void CModeFaceReport::DrawFaceOutline(Engine::msurface_t *surf) g_pClientEngfuncs->pTriAPI->Color4f(lineColor.Red(), lineColor.Green(), lineColor.Blue(), lineColor.Alpha()); for (int i = 0; i < surf->numedges; ++i) { - int edgeIndex = m_pCurrentModel->surfedges[surf->firstedge + i]; - const medge_t *edge = m_pCurrentModel->edges + (edgeIndex >= 0 ? edgeIndex : -edgeIndex); - vec3_t &vertex1 = m_pCurrentModel->vertexes[edge->v[0]].position; - vec3_t &vertex2 = m_pCurrentModel->vertexes[edge->v[1]].position; + int edgeIndex = m_currentModel->surfedges[surf->firstedge + i]; + const medge_t *edge = m_currentModel->edges + (edgeIndex >= 0 ? edgeIndex : -edgeIndex); + vec3_t &vertex1 = m_currentModel->vertexes[edge->v[0]].position; + vec3_t &vertex2 = m_currentModel->vertexes[edge->v[1]].position; g_pClientEngfuncs->pTriAPI->Vertex3fv(vertex1); g_pClientEngfuncs->pTriAPI->Vertex3fv(vertex2); } @@ -261,23 +261,23 @@ Engine::msurface_t *CModeFaceReport::TraceSurface(vec3_t origin, vec3_t dir, flo if (entity) { if (entity->model->type != mod_brush) { - m_pCurrentModel = worldModel; + m_currentModel = worldModel; } else { - m_pCurrentModel = entity->model; + m_currentModel = entity->model; } - firstNode = Engine::CastType(m_pCurrentModel->nodes); - firstNode = m_pCurrentModel->hulls[0].firstclipnode + firstNode; + firstNode = Engine::CastType(m_currentModel->nodes); + firstNode = m_currentModel->hulls[0].firstclipnode + firstNode; vec3_t endPoint = origin + (dir * distance); - surf = SurfaceAtPoint(m_pCurrentModel, firstNode, origin, endPoint, intersect); + surf = SurfaceAtPoint(m_currentModel, firstNode, origin, endPoint, intersect); if (surf) { return surf; } } - m_pCurrentModel = nullptr; + m_currentModel = nullptr; return nullptr; } diff --git a/sources/library/displaymode_facereport.h b/sources/library/displaymode_facereport.h index 238afd4..2c4d96c 100644 --- a/sources/library/displaymode_facereport.h +++ b/sources/library/displaymode_facereport.h @@ -29,7 +29,7 @@ class CModeFaceReport : public IDisplayMode void Render3D() override; bool KeyInput(bool keyDown, int keyCode, const char *bindName) override; void HandleChangelevel() override; - DisplayModeIndex GetModeIndex() override { return DISPLAYMODE_FACEREPORT; }; + DisplayModeType GetModeIndex() override { return DisplayModeType::FaceReport; }; private: int TraceEntity(vec3_t origin, vec3_t dir, float distance, vec3_t &intersect); @@ -41,9 +41,9 @@ class CModeFaceReport : public IDisplayMode Engine::msurface_t *TraceSurface(vec3_t origin, vec3_t dir, float distance, vec3_t &intersect); Engine::msurface_t *SurfaceAtPoint(model_t *pModel, Engine::mnode_t *node, vec3_t start, vec3_t end, vec3_t &intersect); - color24 m_ColorProbe; - model_t *m_pCurrentModel; - Engine::msurface_t *m_pCurrentFace; - CBoundingBox m_CurrentFaceBounds; - std::vector m_BoundPoints; + color24 m_colorProbe; + model_t *m_currentModel; + Engine::msurface_t *m_currentFace; + CBoundingBox m_currentFaceBounds; + std::vector m_boundPoints; }; diff --git a/sources/library/displaymode_full.cpp b/sources/library/displaymode_full.cpp index 01cdeb8..4ffa53c 100644 --- a/sources/library/displaymode_full.cpp +++ b/sources/library/displaymode_full.cpp @@ -20,9 +20,9 @@ GNU General Public License for more details. CModeFull::CModeFull() { - m_flFrameTime = 0.0f; - m_flLastFrameTime = 0.0f; - m_flLastSysTime = 0.0f; + m_frameTime = 0.0f; + m_lastFrameTime = 0.0f; + m_lastSysTime = 0.0f; } void CModeFull::Render2D(float frameTime, int scrWidth, int scrHeight, CStringStack &screenText) @@ -90,13 +90,13 @@ float CModeFull::GetSmoothSystemFrametime() const float smoothFactor = 0.24f; const float diffThreshold = 0.13f; float currSysTime = Utils::GetCurrentSysTime(); - float timeDelta = currSysTime - m_flLastSysTime; + float timeDelta = currSysTime - m_lastSysTime; - if ((timeDelta - m_flLastFrameTime) > diffThreshold) - timeDelta = m_flLastFrameTime; + if ((timeDelta - m_lastFrameTime) > diffThreshold) + timeDelta = m_lastFrameTime; - m_flFrameTime += (timeDelta - m_flFrameTime) * smoothFactor; - m_flLastFrameTime = m_flFrameTime; - m_flLastSysTime = currSysTime; - return m_flFrameTime; + m_frameTime += (timeDelta - m_frameTime) * smoothFactor; + m_lastFrameTime = m_frameTime; + m_lastSysTime = currSysTime; + return m_frameTime; } diff --git a/sources/library/displaymode_full.h b/sources/library/displaymode_full.h index fa92dad..186b9bc 100644 --- a/sources/library/displaymode_full.h +++ b/sources/library/displaymode_full.h @@ -25,12 +25,12 @@ class CModeFull : public IDisplayMode void Render3D() override {}; bool KeyInput(bool, int, const char *) override { return true; }; void HandleChangelevel() override {}; - DisplayModeIndex GetModeIndex() override { return DISPLAYMODE_FULL; }; + DisplayModeType GetModeIndex() override { return DisplayModeType::Full; }; private: float GetSmoothSystemFrametime(); - float m_flFrameTime; - float m_flLastFrameTime; - float m_flLastSysTime; + float m_frameTime; + float m_lastFrameTime; + float m_lastSysTime; }; diff --git a/sources/library/displaymode_measurement.cpp b/sources/library/displaymode_measurement.cpp index 1ddd343..0c362a5 100644 --- a/sources/library/displaymode_measurement.cpp +++ b/sources/library/displaymode_measurement.cpp @@ -24,25 +24,25 @@ GNU General Public License for more details. CModeMeasurement::CModeMeasurement() { const vec3_t zeroVector = { 0.0f, 0.0f, 0.0f }; - m_vecPointA = zeroVector; - m_vecPointB = zeroVector; - m_iLineSprite = 0; - m_iSnapMode = SNAPMODE_FREE; + m_pointA = zeroVector; + m_pointB = zeroVector; + m_lineSprite = 0; + m_snapMode = SnapMode::Free; } void CModeMeasurement::UpdatePointOrigin(vec3_t &linePoint, const vec3_t &targetPoint) { - if (m_iSnapMode != SNAPMODE_ALONGLINE) + if (m_snapMode != SnapMode::AlongLine) { - switch (m_iSnapMode) + switch (m_snapMode) { - case SNAPMODE_AXIS_X: + case SnapMode::AxisX: linePoint.x = targetPoint.x; break; - case SNAPMODE_AXIS_Y: + case SnapMode::AxisY: linePoint.y = targetPoint.y; break; - case SNAPMODE_AXIS_Z: + case SnapMode::AxisZ: linePoint.z = targetPoint.z; break; default: @@ -52,7 +52,7 @@ void CModeMeasurement::UpdatePointOrigin(vec3_t &linePoint, const vec3_t &target } else { - vec3_t lineVector = m_vecPointB - m_vecPointA; + vec3_t lineVector = m_pointB - m_pointA; if (lineVector.Length() > 0.0f) { vec3_t targVector = targetPoint - linePoint; @@ -66,7 +66,7 @@ void CModeMeasurement::TraceAlongNormal(pmtrace_t &traceData, float traceLength) { vec3_t traceOrigin = traceData.endpos; vec3_t planeNormal = traceData.plane.normal; - vec3_t *pointsList[2] = { &m_vecPointA, &m_vecPointB }; + vec3_t *pointsList[2] = { &m_pointA, &m_pointB }; for (int i = 0; i < 2; ++i) { @@ -83,26 +83,26 @@ void CModeMeasurement::DrawVisualization(float frameTime, int screenWidth, int s DrawMeasurementLine(lifeTime); DrawLineProjections(screenWidth, screenHeight, lifeTime); PrintPointHints(screenWidth, screenHeight); - PrintLineLength(screenWidth, screenHeight, m_vecPointA, m_vecPointB); + PrintLineLength(screenWidth, screenHeight, m_pointA, m_pointB); - if (m_iSnapMode != SNAPMODE_FREE && m_iSnapMode != SNAPMODE_ALONGLINE) { + if (m_snapMode != SnapMode::Free && m_snapMode != SnapMode::AlongLine) { DrawSupportLines(lifeTime); } } const vec3_t& CModeMeasurement::GetPointOriginA() const { - return m_vecPointA; + return m_pointA; } const vec3_t& CModeMeasurement::GetPointOriginB() const { - return m_vecPointB; + return m_pointB; } float CModeMeasurement::GetPointsDistance() const { - return (m_vecPointB - m_vecPointA).Length(); + return (m_pointB - m_pointA).Length(); } bool CModeMeasurement::KeyInput(bool keyDown, int keyCode, const char *) @@ -113,7 +113,7 @@ bool CModeMeasurement::KeyInput(bool keyDown, int keyCode, const char *) pmtrace_t traceData; const float traceLen = 64000.f; - if (Utils::GetCurrentDisplayMode() != DISPLAYMODE_MEASUREMENT || !keyDown) + if (Utils::GetCurrentDisplayMode() != DisplayModeType::Measurement || !keyDown) return true; if (keyCode >= K_MOUSE1 && keyCode <= K_MOUSE3) @@ -125,18 +125,19 @@ bool CModeMeasurement::KeyInput(bool keyDown, int keyCode, const char *) Utils::TraceLine(viewOrigin, viewDir, traceLen, &traceData); if (keyCode == K_MOUSE1) - UpdatePointOrigin(m_vecPointA, traceData.endpos); + UpdatePointOrigin(m_pointA, traceData.endpos); else if (keyCode == K_MOUSE2) - UpdatePointOrigin(m_vecPointB, traceData.endpos); + UpdatePointOrigin(m_pointB, traceData.endpos); else if (keyCode == K_MOUSE3) TraceAlongNormal(traceData, traceLen); return false; } else if (keyCode == 'v') { - ++m_iSnapMode; - if (m_iSnapMode == SNAPMODE_MAX) - m_iSnapMode = SNAPMODE_FREE; + m_snapMode = static_cast(static_cast(m_snapMode) + 1); + if (m_snapMode == SnapMode::Count) { + m_snapMode = SnapMode::Free; + } g_pClientEngfuncs->pfnPlaySoundByName("buttons/blip1.wav", 0.8f); return false; } @@ -146,10 +147,10 @@ bool CModeMeasurement::KeyInput(bool keyDown, int keyCode, const char *) void CModeMeasurement::HandleChangelevel() { const vec3_t vecNull = vec3_t(0, 0, 0); - m_vecPointA = vecNull; - m_vecPointB = vecNull; - m_iSnapMode = SNAPMODE_FREE; - m_iLineSprite = 0; + m_pointA = vecNull; + m_pointB = vecNull; + m_snapMode = SnapMode::Free; + m_lineSprite = 0; } void CModeMeasurement::DrawMeasurementLine(float lifeTime) @@ -162,7 +163,7 @@ void CModeMeasurement::DrawMeasurementLine(float lifeTime) const float lineColorB = 0.11f; g_pClientEngfuncs->pEfxAPI->R_BeamPoints( - m_vecPointA, m_vecPointB, m_iLineSprite, + m_pointA, m_pointB, m_lineSprite, lifeTime * 2.f, lineWidth, 0, lineBrightness, lineSpeed, 0, 0, lineColorR, lineColorG, lineColorB @@ -175,8 +176,8 @@ void CModeMeasurement::PrintPointHints(int screenWidth, int screenHeight) const int textColorG = 227; const int textColorB = 198; - Utils::DrawString3D(m_vecPointA, "A", textColorR, textColorG, textColorB); - Utils::DrawString3D(m_vecPointB, "B", textColorR, textColorG, textColorB); + Utils::DrawString3D(m_pointA, "A", textColorR, textColorG, textColorB); + Utils::DrawString3D(m_pointB, "B", textColorR, textColorG, textColorB); } void CModeMeasurement::PrintLineLength(int screenWidth, int screenHeight, vec3_t pointStart, vec3_t pointEnd) @@ -199,7 +200,7 @@ void CModeMeasurement::PrintLineLength(int screenWidth, int screenHeight, vec3_t void CModeMeasurement::DrawSupportLines(float lifeTime) { vec3_t axisVector = { 0.f, 0.f, 0.f }; - const vec3_t *pointsList[2] = { &m_vecPointA, &m_vecPointB }; + const vec3_t *pointsList[2] = { &m_pointA, &m_pointB }; const float lineWidth = 0.7f; const float lineLenght = 24.0f; const float lineSpeed = 5.0f; @@ -208,11 +209,11 @@ void CModeMeasurement::DrawSupportLines(float lifeTime) const float lineColorB = 0.5f; const float lineBrightness = 1.2f; - if (m_iSnapMode == SNAPMODE_AXIS_X) + if (m_snapMode == SnapMode::AxisX) axisVector.x = 1.f; - else if (m_iSnapMode == SNAPMODE_AXIS_Y) + else if (m_snapMode == SnapMode::AxisY) axisVector.y = 1.f; - else if (m_iSnapMode == SNAPMODE_AXIS_Z) + else if (m_snapMode == SnapMode::AxisZ) axisVector.z = 1.f; for (int i = 0; i < 2; ++i) @@ -220,7 +221,7 @@ void CModeMeasurement::DrawSupportLines(float lifeTime) g_pClientEngfuncs->pEfxAPI->R_BeamPoints( *pointsList[i] + (axisVector * lineLenght), *pointsList[i] - (axisVector * lineLenght), - m_iLineSprite, + m_lineSprite, lifeTime * 2.0f, lineWidth, 0, lineBrightness, lineSpeed, 0, 0, lineColorR, lineColorG, lineColorB @@ -231,7 +232,7 @@ void CModeMeasurement::DrawSupportLines(float lifeTime) void CModeMeasurement::DrawLineProjections(int screenWidth, int screenHeight, float lifeTime) { bool baseFound = false; - vec3_t basePoint = m_vecPointA; + vec3_t basePoint = m_pointA; const float lineWidth = 0.7f; const float lineLenght = 24.0f; const float lineSpeed = 5.0f; @@ -239,13 +240,13 @@ void CModeMeasurement::DrawLineProjections(int screenWidth, int screenHeight, fl const float lineColorG = 0.08f; const float lineColorB = 0.08f; const float lineBrightness = 1.2f; - const vec3_t *pointsList[2] = { &m_vecPointA, &m_vecPointB }; + const vec3_t *pointsList[2] = { &m_pointA, &m_pointB }; for (int i = 0; i < 3; ++i) { - if (std::fabsf(m_vecPointA[i] - m_vecPointB[i]) > 0.1f) + if (std::fabsf(m_pointA[i] - m_pointB[i]) > 0.1f) { - basePoint[i] = m_vecPointB[i]; + basePoint[i] = m_pointB[i]; baseFound = true; break; } @@ -254,9 +255,9 @@ void CModeMeasurement::DrawLineProjections(int screenWidth, int screenHeight, fl for (int i = 0; baseFound && i < 3; ++i) { vec3_t axisVector = { 0.f, 0.f, 0.f }; - float diff = basePoint[i] - m_vecPointB[i]; + float diff = basePoint[i] - m_pointB[i]; if (std::fabsf(diff) < 0.001f) { - diff = basePoint[i] - m_vecPointA[i]; + diff = basePoint[i] - m_pointA[i]; } axisVector[i] = 1.0f - 2.0f * (diff > 0.0f); @@ -264,7 +265,7 @@ void CModeMeasurement::DrawLineProjections(int screenWidth, int screenHeight, fl g_pClientEngfuncs->pEfxAPI->R_BeamPoints( basePoint, endPoint, - m_iLineSprite, + m_lineSprite, lifeTime * 2.0f, lineWidth, 0, lineBrightness, lineSpeed, 0, 0, lineColorR, lineColorG, lineColorB @@ -275,12 +276,12 @@ void CModeMeasurement::DrawLineProjections(int screenWidth, int screenHeight, fl void CModeMeasurement::LoadLineSprite() { - if (m_iLineSprite) + if (m_lineSprite) return; const char *spritePath = "sprites/laserbeam.spr"; g_pClientEngfuncs->pfnSPR_Load(spritePath); - m_iLineSprite = g_pClientEngfuncs->pEventAPI->EV_FindModelIndex(spritePath); + m_lineSprite = g_pClientEngfuncs->pEventAPI->EV_FindModelIndex(spritePath); } void CModeMeasurement::Render2D(float frameTime, int screenWidth, int screenHeight, CStringStack &screenText) @@ -319,7 +320,7 @@ void CModeMeasurement::Render2D(float frameTime, int screenWidth, int screenHeig screenText.PushPrintf("Snap Mode: %s", snapModeName); LoadLineSprite(); - if (m_vecPointA.Length() > 0.0001f && m_vecPointB.Length() > 0.0001f) { + if (m_pointA.Length() > 0.0001f && m_pointB.Length() > 0.0001f) { DrawVisualization(frameTime, screenWidth, screenHeight); } } @@ -338,21 +339,21 @@ void CModeMeasurement::Render2D(float frameTime, int screenWidth, int screenHeig const char *CModeMeasurement::GetSnapModeName() const { - switch (m_iSnapMode) + switch (m_snapMode) { - case SNAPMODE_FREE: + case SnapMode::Free: return "Free"; break; - case SNAPMODE_AXIS_X: + case SnapMode::AxisX: return "Axis X"; break; - case SNAPMODE_AXIS_Y: + case SnapMode::AxisY: return "Axis Y"; break; - case SNAPMODE_AXIS_Z: + case SnapMode::AxisZ: return "Axis Z"; break; - case SNAPMODE_ALONGLINE: + case SnapMode::AlongLine: return "Along Line"; break; } @@ -365,15 +366,15 @@ float CModeMeasurement::GetLineElevationAngle() const const vec3_t *highPoint; const vec3_t *lowPoint; - if (m_vecPointA.z > m_vecPointB.z) + if (m_pointA.z > m_pointB.z) { - highPoint = &m_vecPointA; - lowPoint = &m_vecPointB; + highPoint = &m_pointA; + lowPoint = &m_pointB; } else { - highPoint = &m_vecPointB; - lowPoint = &m_vecPointA; + highPoint = &m_pointB; + lowPoint = &m_pointA; } lineDirection = *highPoint - *lowPoint; diff --git a/sources/library/displaymode_measurement.h b/sources/library/displaymode_measurement.h index ce63e58..5c07bbf 100644 --- a/sources/library/displaymode_measurement.h +++ b/sources/library/displaymode_measurement.h @@ -19,14 +19,14 @@ GNU General Public License for more details. class CModeMeasurement : public IDisplayMode { public: - enum + enum class SnapMode { - SNAPMODE_FREE, - SNAPMODE_AXIS_X, - SNAPMODE_AXIS_Y, - SNAPMODE_AXIS_Z, - SNAPMODE_ALONGLINE, - SNAPMODE_MAX, + Free, + AxisX, + AxisY, + AxisZ, + AlongLine, + Count, }; public: @@ -37,7 +37,7 @@ class CModeMeasurement : public IDisplayMode void Render3D() override {}; bool KeyInput(bool keyDown, int keyCode, const char *) override; void HandleChangelevel() override; - DisplayModeIndex GetModeIndex() override { return DISPLAYMODE_MEASUREMENT; }; + DisplayModeType GetModeIndex() override { return DisplayModeType::Measurement; }; private: const vec3_t &GetPointOriginA() const; @@ -56,8 +56,8 @@ class CModeMeasurement : public IDisplayMode void DrawLineProjections(int screenWidth, int screenHeight, float lifeTime); void LoadLineSprite(); - vec3_t m_vecPointA; - vec3_t m_vecPointB; - HLSPRITE m_iLineSprite; - int m_iSnapMode; + vec3_t m_pointA; + vec3_t m_pointB; + HLSPRITE m_lineSprite; + SnapMode m_snapMode; }; diff --git a/sources/library/displaymode_speedometer.cpp b/sources/library/displaymode_speedometer.cpp index ce62587..42ec9b4 100644 --- a/sources/library/displaymode_speedometer.cpp +++ b/sources/library/displaymode_speedometer.cpp @@ -25,16 +25,16 @@ void CModeSpeedometer::Render2D(float frameTime, int scrWidth, int scrHeight, CS const float speedUpdateInterval = 0.125f; float currentTime = Utils::GetCurrentSysTime(); - float updateTimeDelta = currentTime - m_flLastUpdateTime; + float updateTimeDelta = currentTime - m_lastUpdateTime; if (updateTimeDelta >= speedUpdateInterval) { CalculateVelocity(frameTime); - m_flLastUpdateTime = currentTime; + m_lastUpdateTime = currentTime; } //DrawVelocityBar(centerX, centerY, m_flVelocity); screenText.Clear(); - screenText.PushPrintf("%3.1f", m_flVelocity); + screenText.PushPrintf("%3.1f", m_velocity); int stringWidth = Utils::GetStringWidth(screenText.StringAt(0)); Utils::DrawStringStack( @@ -61,10 +61,10 @@ void CModeSpeedometer::DrawVelocityBar(int centerX, int centerY, float velocity) void CModeSpeedometer::CalculateVelocity(float frameTime) { if (g_LocalPlayer.IsSpectate()) { - m_flVelocity = GetEntityVelocityApprox(g_LocalPlayer.GetSpectateTargetIndex()); + m_velocity = GetEntityVelocityApprox(g_LocalPlayer.GetSpectateTargetIndex()); } else { - m_flVelocity = (g_LocalPlayer.GetVelocity() + g_LocalPlayer.GetBaseVelocity()).Length2D(); + m_velocity = (g_LocalPlayer.GetVelocity() + g_LocalPlayer.GetBaseVelocity()).Length2D(); } } diff --git a/sources/library/displaymode_speedometer.h b/sources/library/displaymode_speedometer.h index baa91e6..77e8e81 100644 --- a/sources/library/displaymode_speedometer.h +++ b/sources/library/displaymode_speedometer.h @@ -26,13 +26,13 @@ class CModeSpeedometer : public IDisplayMode void Render3D() override {}; bool KeyInput(bool, int, const char *) override { return true; }; void HandleChangelevel() override {}; - DisplayModeIndex GetModeIndex() override { return DISPLAYMODE_SPEEDOMETER; }; + DisplayModeType GetModeIndex() override { return DisplayModeType::Speedometer; }; private: void CalculateVelocity(float frameTime); float GetEntityVelocityApprox(int entityIndex) const; void DrawVelocityBar(int scrWidth, int scrHeight, float velocity) const; - float m_flVelocity; - float m_flLastUpdateTime; + float m_velocity; + float m_lastUpdateTime; }; diff --git a/sources/library/engine_module.cpp b/sources/library/engine_module.cpp index e8ac683..4a23e87 100644 --- a/sources/library/engine_module.cpp +++ b/sources/library/engine_module.cpp @@ -25,31 +25,31 @@ CEngineModule& CEngineModule::GetInstance() bool CEngineModule::FindHandle() { - m_hModule = GetModuleHandle("hw.dll"); - if (!m_hModule) + m_moduleHandle = GetModuleHandle("hw.dll"); + if (!m_moduleHandle) { - m_hModule = GetModuleHandle("sw.dll"); - if (m_hModule) + m_moduleHandle = GetModuleHandle("sw.dll"); + if (m_moduleHandle) { m_isSoftwareRenderer = true; } else { m_isXashEngine = true; - m_hModule = GetModuleHandle("xash.dll"); + m_moduleHandle = GetModuleHandle("xash.dll"); } } - return (m_hModule != NULL) && SetupModuleInfo(); + return (m_moduleHandle != NULL) && SetupModuleInfo(); } bool CEngineModule::GetFunctionsFromAPI(uint8_t **pfnSPR_Load, uint8_t **pfnSPR_Frames) { if (m_isXashEngine) { - pfnEngSrc_pfnSPR_Load_t pfnFunc1 = (pfnEngSrc_pfnSPR_Load_t)GetProcAddress(m_hModule, "pfnSPR_Load"); + pfnEngSrc_pfnSPR_Load_t pfnFunc1 = (pfnEngSrc_pfnSPR_Load_t)GetProcAddress(m_moduleHandle, "pfnSPR_Load"); if (pfnFunc1) { - pfnEngSrc_pfnSPR_Frames_t pfnFunc2 = (pfnEngSrc_pfnSPR_Frames_t)GetProcAddress(m_hModule, "pfnSPR_Frames"); + pfnEngSrc_pfnSPR_Frames_t pfnFunc2 = (pfnEngSrc_pfnSPR_Frames_t)GetProcAddress(m_moduleHandle, "pfnSPR_Frames"); if (pfnFunc2) { *pfnSPR_Load = reinterpret_cast(pfnFunc1); @@ -63,9 +63,9 @@ bool CEngineModule::GetFunctionsFromAPI(uint8_t **pfnSPR_Load, uint8_t **pfnSPR_ bool CEngineModule::SetupModuleInfo() { - if (m_hModule) + if (m_moduleHandle) { - if (SysUtils::GetModuleInfo(GetCurrentProcess(), m_hModule, m_ModuleInfo)) { + if (SysUtils::GetModuleInfo(GetCurrentProcess(), m_moduleHandle, m_moduleInfo)) { return true; } } diff --git a/sources/library/engine_module.h b/sources/library/engine_module.h index 96dc7e9..feb78c9 100644 --- a/sources/library/engine_module.h +++ b/sources/library/engine_module.h @@ -23,11 +23,11 @@ class CEngineModule bool FindHandle(); bool GetFunctionsFromAPI(uint8_t **pfnSPR_Load, uint8_t **pfnSPR_Frames); - inline bool IsXashEngine() const { return m_isXashEngine; } - inline bool IsSoftwareRenderer() const { return m_isSoftwareRenderer; }; - inline ModuleHandle GetHandle() const { return m_hModule; }; - inline uint8_t* GetAddress() const { return m_ModuleInfo.baseAddress; }; - inline size_t GetSize() const { return m_ModuleInfo.imageSize; } + bool IsXashEngine() const { return m_isXashEngine; } + bool IsSoftwareRenderer() const { return m_isSoftwareRenderer; }; + ModuleHandle GetHandle() const { return m_moduleHandle; }; + uint8_t* GetAddress() const { return m_moduleInfo.baseAddress; }; + size_t GetSize() const { return m_moduleInfo.imageSize; } private: CEngineModule() {}; @@ -35,8 +35,8 @@ class CEngineModule CEngineModule& operator=(const CEngineModule&) = delete; bool SetupModuleInfo(); - ModuleHandle m_hModule = NULL; - SysUtils::ModuleInfo m_ModuleInfo; + ModuleHandle m_moduleHandle = NULL; + SysUtils::ModuleInfo m_moduleInfo; bool m_isXashEngine = false; bool m_isSoftwareRenderer = false; }; diff --git a/sources/library/entity_description.cpp b/sources/library/entity_description.cpp index d96b690..ac89407 100644 --- a/sources/library/entity_description.cpp +++ b/sources/library/entity_description.cpp @@ -65,7 +65,7 @@ void CEntityDescription::Reset() m_szClassname.clear(); m_szTargetname.clear(); m_szModelName.clear(); - m_BoundingBox = CBoundingBox(vecNull); + m_boundingBox = CBoundingBox(vecNull); m_iAssociatedEntity = -1; } @@ -82,8 +82,8 @@ void CEntityDescription::EstimateBoundingBox() vec3_t submodelMaxs = submodel->maxs; vec3_t submodelMins = submodel->mins; vec3_t hullSize = submodelMaxs - submodelMins; - m_BoundingBox = CBoundingBox(submodelMins, submodelMaxs); - m_vecOrigin = m_BoundingBox.GetCenterPoint(); + m_boundingBox = CBoundingBox(submodelMins, submodelMaxs); + m_vecOrigin = m_boundingBox.GetCenterPoint(); } } else if (m_vecOrigin.Length() > 0.01f) // is origin != (0, 0, 0) @@ -98,8 +98,8 @@ void CEntityDescription::EstimateBoundingBox() if (mdlHeader) { mstudioseqdesc_t *seqDesc = (mstudioseqdesc_t *)((char *)mdlHeader + mdlHeader->seqindex); - m_BoundingBox = CBoundingBox(seqDesc[0].bbmin, seqDesc[0].bbmax); - m_BoundingBox.SetCenterToPoint(m_vecOrigin); + m_boundingBox = CBoundingBox(seqDesc[0].bbmin, seqDesc[0].bbmax); + m_boundingBox.SetCenterToPoint(m_vecOrigin); return; } } @@ -107,8 +107,8 @@ void CEntityDescription::EstimateBoundingBox() // otherwise just use fixed-size hull for point entities const vec3_t pointEntityHull = vec3_t(32, 32, 32); - m_BoundingBox = CBoundingBox(pointEntityHull); - m_BoundingBox.SetCenterToPoint(m_vecOrigin); + m_boundingBox = CBoundingBox(pointEntityHull); + m_boundingBox.SetCenterToPoint(m_vecOrigin); } } diff --git a/sources/library/entity_description.h b/sources/library/entity_description.h index 6ebac71..af693e3 100644 --- a/sources/library/entity_description.h +++ b/sources/library/entity_description.h @@ -34,7 +34,7 @@ class CEntityDescription inline const std::string& GetModelName() const { return m_szModelName; } inline const vec3_t &GetOrigin() const { return m_vecOrigin; } inline const vec3_t &GetAngles() const { return m_vecAngles; } - inline const CBoundingBox &GetBoundingBox() const { return m_BoundingBox; } + inline const CBoundingBox &GetBoundingBox() const { return m_boundingBox; } private: void Reset(); @@ -48,6 +48,6 @@ class CEntityDescription vec3_t m_vecAngles; vec3_t m_vecOrigin; int m_iAssociatedEntity; - CBoundingBox m_BoundingBox; + CBoundingBox m_boundingBox; std::map m_EntityProps; }; diff --git a/sources/library/entity_dictionary.cpp b/sources/library/entity_dictionary.cpp index 04e6dc7..8e72777 100644 --- a/sources/library/entity_dictionary.cpp +++ b/sources/library/entity_dictionary.cpp @@ -34,14 +34,14 @@ void CEntityDictionary::Initialize() void CEntityDictionary::VisualizeTree(bool textRendering) { - m_EntityDescTree.Visualize(textRendering); + m_entityDescTree.Visualize(textRendering); } void CEntityDictionary::VisualizeDescriptions() const { - for (int i = 0; i < m_EntityDescList.size(); ++i) + for (int i = 0; i < m_entityDescList.size(); ++i) { - const CEntityDescription &description = m_EntityDescList[i]; + const CEntityDescription &description = m_entityDescList[i]; Utils::DrawCuboid( description.GetOrigin(), vec3_t(0, 0, 0), @@ -54,8 +54,8 @@ void CEntityDictionary::VisualizeDescriptions() const void CEntityDictionary::Reset() { - m_EntityDescList.clear(); - m_Associations.clear(); + m_entityDescList.clear(); + m_associations.clear(); } bool CEntityDictionary::FindDescription(int entityIndex, CEntityDescription &destDescription, int &iterCount) @@ -63,18 +63,18 @@ bool CEntityDictionary::FindDescription(int entityIndex, CEntityDescription &des int nodeIndex; CBoundingBox entityBoundingBox; Utils::GetEntityBoundingBox(entityIndex, entityBoundingBox); - if (m_Associations.count(entityIndex) > 0) + if (m_associations.count(entityIndex) > 0) { - int descIndex = m_Associations[entityIndex]; - destDescription = m_EntityDescList[descIndex]; + int descIndex = m_associations[entityIndex]; + destDescription = m_entityDescList[descIndex]; return true; } - else if (m_EntityDescTree.FindLeaf(entityBoundingBox, nodeIndex, iterCount)) + else if (m_entityDescTree.FindLeaf(entityBoundingBox, nodeIndex, iterCount)) { - const CBVHTreeNode &node = m_EntityDescTree.GetNode(nodeIndex); + const CBVHTreeNode &node = m_entityDescTree.GetNode(nodeIndex); int descIndex = node.GetDescriptionIndex(); AssociateDescription(entityIndex, descIndex); - destDescription = m_EntityDescList[descIndex]; + destDescription = m_entityDescList[descIndex]; return true; } return false; @@ -82,15 +82,15 @@ bool CEntityDictionary::FindDescription(int entityIndex, CEntityDescription &des void CEntityDictionary::AssociateDescription(int entityIndex, int descIndex) { - CEntityDescription &entityDesc = m_EntityDescList[descIndex]; + CEntityDescription &entityDesc = m_entityDescList[descIndex]; entityDesc.AssociateEntity(entityIndex); - m_Associations.insert({ entityIndex, descIndex }); + m_associations.insert({ entityIndex, descIndex }); } void CEntityDictionary::BuildDescriptionsTree() { - m_EntityDescTree.Reset(); - m_EntityDescTree.Build(); + m_entityDescTree.Reset(); + m_entityDescTree.Build(); } void CEntityDictionary::ParseEntityData() @@ -125,7 +125,7 @@ void CEntityDictionary::ParseEntityData() if (strcmp(token.data(), "}") == 0) { entityDesc.Initialize(); - m_EntityDescList.push_back(entityDesc); + m_entityDescList.push_back(entityDesc); break; } else diff --git a/sources/library/entity_dictionary.h b/sources/library/entity_dictionary.h index cf80864..b722f91 100644 --- a/sources/library/entity_dictionary.h +++ b/sources/library/entity_dictionary.h @@ -29,8 +29,8 @@ class CEntityDictionary void VisualizeDescriptions() const; bool FindDescription(int entityIndex, CEntityDescription &destDescription, int &iterCount); - inline int GetDescriptionsCount() const { return m_EntityDescList.size(); } - inline bool IsInitialized() const { return m_EntityDescList.size() > 0; } + int GetDescriptionsCount() const { return m_entityDescList.size(); } + bool IsInitialized() const { return m_entityDescList.size() > 0; } private: CEntityDictionary() {}; @@ -41,8 +41,8 @@ class CEntityDictionary void BuildDescriptionsTree(); void ParseEntityData(); - std::map m_Associations; - CBVHTree m_EntityDescTree = CBVHTree(&m_EntityDescList); - std::vector m_EntityDescList; + std::map m_associations; + CBVHTree m_entityDescTree = CBVHTree(&m_entityDescList); + std::vector m_entityDescList; }; extern CEntityDictionary &g_EntityDictionary; diff --git a/sources/library/hooks_logger.cpp b/sources/library/hooks_logger.cpp index 6212d5b..4595cfe 100644 --- a/sources/library/hooks_logger.cpp +++ b/sources/library/hooks_logger.cpp @@ -25,24 +25,24 @@ CHooks::Logger::~Logger() void CHooks::Logger::log(const std::string &msg, PLH::ErrorLevel level) { - if (level >= m_ErrorLevel) + if (level >= m_errorLevel) { switch (level) { case PLH::ErrorLevel::INFO: - Utils::Snprintf(m_szOutputText, "[goldsrc-monitor] INFO: %s\n", msg.c_str()); + Utils::Snprintf(m_outputText, "[goldsrc-monitor] INFO: %s\n", msg.c_str()); break; case PLH::ErrorLevel::WARN: - Utils::Snprintf(m_szOutputText, "[goldsrc-monitor] WARN: %s\n", msg.c_str()); + Utils::Snprintf(m_outputText, "[goldsrc-monitor] WARN: %s\n", msg.c_str()); break; case PLH::ErrorLevel::SEV: - Utils::Snprintf(m_szOutputText, "[goldsrc-monitor] ERROR: %s\n", msg.c_str()); + Utils::Snprintf(m_outputText, "[goldsrc-monitor] ERROR: %s\n", msg.c_str()); break; default: - Utils::Snprintf(m_szOutputText, "[goldsrc-monitor] Unsupported error message logged: %s\n", msg.c_str()); + Utils::Snprintf(m_outputText, "[goldsrc-monitor] Unsupported error message logged: %s\n", msg.c_str()); } #ifdef _WIN32 - OutputDebugStringA(m_szOutputText.c_str()); + OutputDebugStringA(m_outputText.c_str()); #else #pragma warning "Logging is not implemented for this platform" #endif @@ -51,5 +51,5 @@ void CHooks::Logger::log(const std::string &msg, PLH::ErrorLevel level) void CHooks::Logger::setLogLevel(PLH::ErrorLevel level) { - m_ErrorLevel = level; + m_errorLevel = level; } diff --git a/sources/library/hooks_logger.h b/sources/library/hooks_logger.h index 934df59..88e28d0 100644 --- a/sources/library/hooks_logger.h +++ b/sources/library/hooks_logger.h @@ -26,6 +26,6 @@ class CHooks::Logger : public PLH::Logger void setLogLevel(PLH::ErrorLevel level); private: - std::string m_szOutputText; - PLH::ErrorLevel m_ErrorLevel = PLH::ErrorLevel::NONE; + std::string m_outputText; + PLH::ErrorLevel m_errorLevel = PLH::ErrorLevel::NONE; }; diff --git a/sources/library/memory_pattern.cpp b/sources/library/memory_pattern.cpp index e136c21..e52fb03 100644 --- a/sources/library/memory_pattern.cpp +++ b/sources/library/memory_pattern.cpp @@ -30,20 +30,20 @@ CMemoryPattern::CMemoryPattern(const char *pattern, int byteCount, uint8_t wildm void CMemoryPattern::ReserveElements(size_t elemCount) { - m_Mask.reserve(elemCount); - m_Signature.reserve(elemCount); + m_mask.reserve(elemCount); + m_signature.reserve(elemCount); } void CMemoryPattern::Reset() { - m_Mask.clear(); - m_Signature.clear(); + m_mask.clear(); + m_signature.clear(); } void CMemoryPattern::AddByte(uint8_t value, bool shouldCheck) { - m_Mask.push_back(shouldCheck); - m_Signature.push_back(value); + m_mask.push_back(shouldCheck); + m_signature.push_back(value); } void CMemoryPattern::InitFromBytes(uint8_t *pattern, int byteCount, uint8_t wildmark) @@ -56,13 +56,13 @@ void CMemoryPattern::InitFromBytes(uint8_t *pattern, int byteCount, uint8_t wild uint8_t *currentByte = pattern + i; if (currentByte[0] != wildmark) { - m_Signature.push_back(currentByte[0]); - m_Mask.push_back(true); + m_signature.push_back(currentByte[0]); + m_mask.push_back(true); } else { - m_Signature.push_back(0x0); - m_Mask.push_back(false); + m_signature.push_back(0x0); + m_mask.push_back(false); } } } @@ -91,8 +91,8 @@ void CMemoryPattern::InitFromString(const std::string &pattern) } } - m_Mask.shrink_to_fit(); - m_Signature.shrink_to_fit(); + m_mask.shrink_to_fit(); + m_signature.shrink_to_fit(); } catch (std::exception &ex) { @@ -102,7 +102,7 @@ void CMemoryPattern::InitFromString(const std::string &pattern) bool CMemoryPattern::IsInitialized() const { - if (m_Mask.size() < 1 || m_Signature.size() < 1) { + if (m_mask.size() < 1 || m_signature.size() < 1) { return false; } return true; diff --git a/sources/library/memory_pattern.h b/sources/library/memory_pattern.h index 25227bf..14f116c 100644 --- a/sources/library/memory_pattern.h +++ b/sources/library/memory_pattern.h @@ -28,17 +28,17 @@ class CMemoryPattern void InitFromString(const std::string &pattern); bool IsInitialized() const; - inline int GetLength() const { return m_Signature.size(); }; - inline uint8_t GetByteAt(int offset) const { return m_Signature[offset]; }; - inline bool ShouldCheckByteAt(int offset) const { return m_Mask[offset]; }; + inline int GetLength() const { return m_signature.size(); }; + inline uint8_t GetByteAt(int offset) const { return m_signature[offset]; }; + inline bool ShouldCheckByteAt(int offset) const { return m_mask[offset]; }; // To provide an optimal way to finding pattern address - inline const int *GetMaskAddress() const { return m_Mask.data(); }; - inline const uint8_t *GetSignatureAddress() const { return m_Signature.data(); }; + inline const int *GetMaskAddress() const { return m_mask.data(); }; + inline const uint8_t *GetSignatureAddress() const { return m_signature.data(); }; private: void ReserveElements(size_t elemCount); void Reset(); - std::vector m_Mask; - std::vector m_Signature; + std::vector m_mask; + std::vector m_signature; }; diff --git a/sources/library/opengl_primitives_renderer.h b/sources/library/opengl_primitives_renderer.h index 85c4b36..a5c8944 100644 --- a/sources/library/opengl_primitives_renderer.h +++ b/sources/library/opengl_primitives_renderer.h @@ -18,12 +18,14 @@ GNU General Public License for more details. class COpenGLPrimitivesRenderer : public IPrimitivesRenderer { -private: +public: virtual void Begin() override; virtual void End() override; virtual void ToggleDepthTest(bool state) override; virtual void RenderPrimitives(PrimitiveType type, const std::vector& verticesBuffer, const std::vector& colorBuffer) override; + +private: uint32_t GetGlPrimitiveEnum(PrimitiveType pt) const; }; diff --git a/sources/library/server_module.cpp b/sources/library/server_module.cpp index 5d7e2eb..ecae69e 100644 --- a/sources/library/server_module.cpp +++ b/sources/library/server_module.cpp @@ -32,9 +32,9 @@ CServerModule &CServerModule::GetInstance() bool CServerModule::FindHandle() { ProcessHandle currProcess = SysUtils::GetCurrentProcessHandle(); - m_hModule = SysUtils::FindModuleByExport(GetCurrentProcess(), "GetEntityAPI"); - SysUtils::GetModuleInfo(currProcess, m_hModule, m_ModuleInfo); - return m_hModule.Valid(); + m_module = SysUtils::FindModuleByExport(GetCurrentProcess(), "GetEntityAPI"); + SysUtils::GetModuleInfo(currProcess, m_module, m_moduleInfo); + return m_module.Valid(); } bool CServerModule::FindEngfuncs(const CBuildInfo &buildInfo) diff --git a/sources/library/server_module.h b/sources/library/server_module.h index 52a1355..97acba5 100644 --- a/sources/library/server_module.h +++ b/sources/library/server_module.h @@ -26,19 +26,19 @@ class CServerModule bool FindHandle(); bool FindEngfuncs(const CBuildInfo &buildInfo); uint8_t *GetFuncAddress(const char *funcName); - inline ModuleHandle GetHandle() const { return m_hModule; } - inline uint8_t *GetBaseAddress() const { return m_ModuleInfo.baseAddress; } - inline uint8_t *GetEntryPoint() const { return m_ModuleInfo.entryPointAddress; } - inline size_t GetSize() const { return m_ModuleInfo.imageSize; } - inline bool IsInitialized() const { return m_hModule != NULL; } + inline ModuleHandle GetHandle() const { return m_module; } + inline uint8_t *GetBaseAddress() const { return m_moduleInfo.baseAddress; } + inline uint8_t *GetEntryPoint() const { return m_moduleInfo.entryPointAddress; } + inline size_t GetSize() const { return m_moduleInfo.imageSize; } + inline bool IsInitialized() const { return m_module != NULL; } private: CServerModule() {}; CServerModule(const CServerModule&) = delete; CServerModule& operator=(const CServerModule&) = delete; - ModuleHandle m_hModule = NULL; - SysUtils::ModuleInfo m_ModuleInfo; + ModuleHandle m_module = NULL; + SysUtils::ModuleInfo m_moduleInfo; }; extern CServerModule &g_ServerModule; diff --git a/sources/library/utils.cpp b/sources/library/utils.cpp index c5cb0ec..764f8b9 100644 --- a/sources/library/utils.cpp +++ b/sources/library/utils.cpp @@ -510,7 +510,7 @@ float Utils::GetCurrentSysTime() return SysUtils::GetCurrentSysTime(); } -DisplayModeIndex Utils::GetCurrentDisplayMode() +DisplayModeType Utils::GetCurrentDisplayMode() { - return static_cast(ConVars::gsm_mode->value); + return static_cast(ConVars::gsm_mode->value); } diff --git a/sources/library/utils.h b/sources/library/utils.h index 57c0e11..12793ab 100644 --- a/sources/library/utils.h +++ b/sources/library/utils.h @@ -34,7 +34,7 @@ namespace Utils uint8_t *UnwrapJmp(uint8_t *opcodeAddr); float GetCurrentSysTime(); - DisplayModeIndex GetCurrentDisplayMode(); + DisplayModeType GetCurrentDisplayMode(); cvar_t *RegisterConVar(const char *name, const char *value, int flags); int GetStringWidth(const char *str);