From c4152ff0390162f5797b998bd65d59c7bae2787f Mon Sep 17 00:00:00 2001 From: Jan Laupetin Date: Thu, 6 Nov 2025 19:08:07 +0100 Subject: [PATCH] chore: do not use using namespace in headers --- src/ObjLoading/Game/T6/BSP/BSP.h | 19 ++++++----- src/ObjLoading/Game/T6/BSP/BSPCalculation.h | 8 ++--- src/ObjLoading/Game/T6/BSP/BSPCreator.cpp | 2 +- src/ObjLoading/Game/T6/BSP/BSPUtil.cpp | 2 ++ src/ObjLoading/Game/T6/BSP/BSPUtil.h | 22 ++++++------- .../Game/T6/BSP/Linker/BSPLinker.cpp | 2 ++ src/ObjLoading/Game/T6/BSP/Linker/BSPLinker.h | 2 +- .../Game/T6/BSP/Linker/ClipMapLinker.cpp | 2 ++ .../Game/T6/BSP/Linker/ClipMapLinker.h | 32 +++++++++---------- .../Game/T6/BSP/Linker/ComWorldLinker.cpp | 2 ++ .../Game/T6/BSP/Linker/ComWorldLinker.h | 2 +- .../Game/T6/BSP/Linker/GameWorldMpLinker.cpp | 2 ++ .../Game/T6/BSP/Linker/GameWorldMpLinker.h | 2 +- .../Game/T6/BSP/Linker/GfxWorldLinker.cpp | 2 ++ .../Game/T6/BSP/Linker/GfxWorldLinker.h | 32 +++++++++---------- .../Game/T6/BSP/Linker/MapEntsLinker.cpp | 2 ++ .../Game/T6/BSP/Linker/MapEntsLinker.h | 2 +- .../Game/T6/BSP/Linker/SkinnedVertsLinker.cpp | 4 +-- .../Game/T6/BSP/Linker/SkinnedVertsLinker.h | 2 +- 19 files changed, 78 insertions(+), 65 deletions(-) diff --git a/src/ObjLoading/Game/T6/BSP/BSP.h b/src/ObjLoading/Game/T6/BSP/BSP.h index dc3ca43e..56f6c433 100644 --- a/src/ObjLoading/Game/T6/BSP/BSP.h +++ b/src/ObjLoading/Game/T6/BSP/BSP.h @@ -7,7 +7,6 @@ #include #include #include -using namespace T6; namespace BSP { @@ -20,11 +19,11 @@ namespace BSP struct BSPVertex { - vec3_t pos; - vec4_t color; - vec2_t texCoord; - vec3_t normal; - vec3_t tangent; + T6::vec3_t pos; + T6::vec4_t color; + T6::vec2_t texCoord; + T6::vec3_t normal; + T6::vec3_t tangent; }; struct BSPMaterial @@ -153,7 +152,7 @@ namespace BSP // Default xmodel values // Unused as there is no support for xmodels right now constexpr float DEFAULT_SMODEL_CULL_DIST = 10000.0f; - constexpr int DEFAULT_SMODEL_FLAGS = STATIC_MODEL_FLAG_NO_SHADOW; + constexpr int DEFAULT_SMODEL_FLAGS = T6::STATIC_MODEL_FLAG_NO_SHADOW; constexpr int DEFAULT_SMODEL_LIGHT = 1; constexpr int DEFAULT_SMODEL_REFLECTION_PROBE = 0; @@ -161,7 +160,7 @@ namespace BSP constexpr int DEFAULT_SURFACE_LIGHT = BSPGameConstants::SUN_LIGHT_INDEX; constexpr int DEFAULT_SURFACE_LIGHTMAP = 0; constexpr int DEFAULT_SURFACE_REFLECTION_PROBE = 0; - constexpr int DEFAULT_SURFACE_FLAGS = (GFX_SURFACE_CASTS_SUN_SHADOW | GFX_SURFACE_CASTS_SHADOW); + constexpr int DEFAULT_SURFACE_FLAGS = (T6::GFX_SURFACE_CASTS_SUN_SHADOW | T6::GFX_SURFACE_CASTS_SHADOW); // material flags determine the features of a surface // unsure which flag type changes what right now @@ -180,7 +179,7 @@ namespace BSP constexpr unsigned char LIGHTGRID_COLOUR = 128; // Sunlight values - constexpr vec4_t SUNLIGHT_COLOR = {0.75f, 0.75f, 0.75f, 1.0f}; - constexpr vec3_t SUNLIGHT_DIRECTION = {0.0f, 0.0f, 0.0f}; + constexpr T6::vec4_t SUNLIGHT_COLOR = {0.75f, 0.75f, 0.75f, 1.0f}; + constexpr T6::vec3_t SUNLIGHT_DIRECTION = {0.0f, 0.0f, 0.0f}; }; // namespace BSPEditableConstants } // namespace BSP diff --git a/src/ObjLoading/Game/T6/BSP/BSPCalculation.h b/src/ObjLoading/Game/T6/BSP/BSPCalculation.h index 1d35cbe9..1af70a20 100644 --- a/src/ObjLoading/Game/T6/BSP/BSPCalculation.h +++ b/src/ObjLoading/Game/T6/BSP/BSPCalculation.h @@ -21,8 +21,8 @@ namespace BSP class BSPObject { public: - vec3_t min; - vec3_t max; + T6::vec3_t min; + T6::vec3_t max; int partitionIndex; // index of the partition the object is contained in BSPObject(float xMin, float yMin, float zMin, float xMax, float yMax, float zMax, int objPartitionIndex); @@ -61,8 +61,8 @@ namespace BSP std::unique_ptr node; int level; // level in the BSP tree - vec3_t min; - vec3_t max; + T6::vec3_t min; + T6::vec3_t max; BSPTree(float xMin, float yMin, float zMin, float xMax, float yMax, float zMax, int treeLevel); void splitTree(); diff --git a/src/ObjLoading/Game/T6/BSP/BSPCreator.cpp b/src/ObjLoading/Game/T6/BSP/BSPCreator.cpp index eab04426..fdb4a997 100644 --- a/src/ObjLoading/Game/T6/BSP/BSPCreator.cpp +++ b/src/ObjLoading/Game/T6/BSP/BSPCreator.cpp @@ -91,7 +91,7 @@ namespace uint32_t index = tempIndices[idxOfIndex]; ufbx_vec3 transformedPos = ufbx_transform_position(&meshMatrix, ufbx_get_vertex_vec3(&mesh->vertex_position, index)); - vec3_t blenderCoords; + T6::vec3_t blenderCoords; blenderCoords.x = static_cast(transformedPos.x); blenderCoords.y = static_cast(transformedPos.y); blenderCoords.z = static_cast(transformedPos.z); diff --git a/src/ObjLoading/Game/T6/BSP/BSPUtil.cpp b/src/ObjLoading/Game/T6/BSP/BSPUtil.cpp index 7f60d536..fdb9a632 100644 --- a/src/ObjLoading/Game/T6/BSP/BSPUtil.cpp +++ b/src/ObjLoading/Game/T6/BSP/BSPUtil.cpp @@ -3,6 +3,8 @@ #include #include +using namespace T6; + namespace BSP { std::string BSPUtil::getFileNameForBSPAsset(std::string& assetName) diff --git a/src/ObjLoading/Game/T6/BSP/BSPUtil.h b/src/ObjLoading/Game/T6/BSP/BSPUtil.h index f1196667..fdd49154 100644 --- a/src/ObjLoading/Game/T6/BSP/BSPUtil.h +++ b/src/ObjLoading/Game/T6/BSP/BSPUtil.h @@ -8,16 +8,16 @@ namespace BSP { public: static std::string getFileNameForBSPAsset(std::string& assetName); - static vec3_t convertToBO2Coords(vec3_t& OGL_coordinate); - static vec3_t convertFromBO2Coords(vec3_t& bo2_coordinate); - static void updateAABB(vec3_t& newAABBMins, vec3_t& newAABBMaxs, vec3_t& AABBMins, vec3_t& AABBMaxs); - static void updateAABBWithPoint(vec3_t& point, vec3_t& AABBMins, vec3_t& AABBMaxs); - static vec3_t calcMiddleOfAABB(vec3_t& mins, vec3_t& maxs); - static vec3_t calcHalfSizeOfAABB(vec3_t& mins, vec3_t& maxs); - static float distBetweenPoints(vec3_t& p1, vec3_t& p2); - static void convertAnglesToAxis(vec3_t* angles, vec3_t* axis); - static void matrixTranspose3x3(const vec3_t* in, vec3_t* out); - static vec3_t convertStringToVec3(std::string& str); - static std::string convertVec3ToString(vec3_t& vec); + static T6::vec3_t convertToBO2Coords(T6::vec3_t& OGL_coordinate); + static T6::vec3_t convertFromBO2Coords(T6::vec3_t& bo2_coordinate); + static void updateAABB(T6::vec3_t& newAABBMins, T6::vec3_t& newAABBMaxs, T6::vec3_t& AABBMins, T6::vec3_t& AABBMaxs); + static void updateAABBWithPoint(T6::vec3_t& point, T6::vec3_t& AABBMins, T6::vec3_t& AABBMaxs); + static T6::vec3_t calcMiddleOfAABB(T6::vec3_t& mins, T6::vec3_t& maxs); + static T6::vec3_t calcHalfSizeOfAABB(T6::vec3_t& mins, T6::vec3_t& maxs); + static float distBetweenPoints(T6::vec3_t& p1, T6::vec3_t& p2); + static void convertAnglesToAxis(T6::vec3_t* angles, T6::vec3_t* axis); + static void matrixTranspose3x3(const T6::vec3_t* in, T6::vec3_t* out); + static T6::vec3_t convertStringToVec3(std::string& str); + static std::string convertVec3ToString(T6::vec3_t& vec); }; } // namespace BSP diff --git a/src/ObjLoading/Game/T6/BSP/Linker/BSPLinker.cpp b/src/ObjLoading/Game/T6/BSP/Linker/BSPLinker.cpp index 7f29b639..374127d7 100644 --- a/src/ObjLoading/Game/T6/BSP/Linker/BSPLinker.cpp +++ b/src/ObjLoading/Game/T6/BSP/Linker/BSPLinker.cpp @@ -7,6 +7,8 @@ #include "MapEntsLinker.h" #include "SkinnedVertsLinker.h" +using namespace T6; + namespace BSP { FootstepTableDef* BSPLinker::addEmptyFootstepTableAsset(std::string assetName) diff --git a/src/ObjLoading/Game/T6/BSP/Linker/BSPLinker.h b/src/ObjLoading/Game/T6/BSP/Linker/BSPLinker.h index e4d53a2a..7220109e 100644 --- a/src/ObjLoading/Game/T6/BSP/Linker/BSPLinker.h +++ b/src/ObjLoading/Game/T6/BSP/Linker/BSPLinker.h @@ -14,7 +14,7 @@ namespace BSP bool linkBSP(BSPData* bsp); private: - FootstepTableDef* addEmptyFootstepTableAsset(std::string assetName); + T6::FootstepTableDef* addEmptyFootstepTableAsset(std::string assetName); bool addDefaultRequiredAssets(BSPData* bsp); MemoryManager& m_memory; diff --git a/src/ObjLoading/Game/T6/BSP/Linker/ClipMapLinker.cpp b/src/ObjLoading/Game/T6/BSP/Linker/ClipMapLinker.cpp index 56be1b95..fd857f4c 100644 --- a/src/ObjLoading/Game/T6/BSP/Linker/ClipMapLinker.cpp +++ b/src/ObjLoading/Game/T6/BSP/Linker/ClipMapLinker.cpp @@ -2,6 +2,8 @@ #include "../BSPUtil.h" +using namespace T6; + namespace BSP { ClipMapLinker::ClipMapLinker(MemoryManager& memory, ISearchPath& searchPath, AssetCreationContext& context) diff --git a/src/ObjLoading/Game/T6/BSP/Linker/ClipMapLinker.h b/src/ObjLoading/Game/T6/BSP/Linker/ClipMapLinker.h index 4b6dcd6e..fd20d114 100644 --- a/src/ObjLoading/Game/T6/BSP/Linker/ClipMapLinker.h +++ b/src/ObjLoading/Game/T6/BSP/Linker/ClipMapLinker.h @@ -12,29 +12,29 @@ namespace BSP { public: ClipMapLinker(MemoryManager& memory, ISearchPath& searchPath, AssetCreationContext& context); - clipMap_t* linkClipMap(BSPData* bsp); + T6::clipMap_t* linkClipMap(BSPData* bsp); private: MemoryManager& m_memory; ISearchPath& m_search_path; AssetCreationContext& m_context; - void loadBoxData(clipMap_t* clipMap); - void loadVisibility(clipMap_t* clipMap); - void loadDynEnts(clipMap_t* clipMap); - void loadRopesAndConstraints(clipMap_t* clipMap); - void loadSubModelCollision(clipMap_t* clipMap, BSPData* bsp); - void loadXModelCollision(clipMap_t* clipMap); + void loadBoxData(T6::clipMap_t* clipMap); + void loadVisibility(T6::clipMap_t* clipMap); + void loadDynEnts(T6::clipMap_t* clipMap); + void loadRopesAndConstraints(T6::clipMap_t* clipMap); + void loadSubModelCollision(T6::clipMap_t* clipMap, BSPData* bsp); + void loadXModelCollision(T6::clipMap_t* clipMap); - std::vector planeVec; - std::vector nodeVec; - std::vector leafVec; - std::vector AABBTreeVec; + std::vector planeVec; + std::vector nodeVec; + std::vector leafVec; + std::vector AABBTreeVec; size_t highestLeafObjectCount = 0; - void addAABBTreeFromLeaf(clipMap_t* clipMap, BSPTree* tree, size_t* out_parentCount, size_t* out_parentStartIndex); - int16_t loadBSPNode(clipMap_t* clipMap, BSPTree* tree); - void loadBSPTree(clipMap_t* clipMap, BSPData* bsp); - bool loadPartitions(clipMap_t* clipMap, BSPData* bsp); - bool loadWorldCollision(clipMap_t* clipMap, BSPData* bsp); + void addAABBTreeFromLeaf(T6::clipMap_t* clipMap, BSPTree* tree, size_t* out_parentCount, size_t* out_parentStartIndex); + int16_t loadBSPNode(T6::clipMap_t* clipMap, BSPTree* tree); + void loadBSPTree(T6::clipMap_t* clipMap, BSPData* bsp); + bool loadPartitions(T6::clipMap_t* clipMap, BSPData* bsp); + bool loadWorldCollision(T6::clipMap_t* clipMap, BSPData* bsp); }; } // namespace BSP diff --git a/src/ObjLoading/Game/T6/BSP/Linker/ComWorldLinker.cpp b/src/ObjLoading/Game/T6/BSP/Linker/ComWorldLinker.cpp index c4c7c7ff..e47a25fe 100644 --- a/src/ObjLoading/Game/T6/BSP/Linker/ComWorldLinker.cpp +++ b/src/ObjLoading/Game/T6/BSP/Linker/ComWorldLinker.cpp @@ -1,5 +1,7 @@ #include "ComWorldLinker.h" +using namespace T6; + namespace BSP { ComWorldLinker::ComWorldLinker(MemoryManager& memory, ISearchPath& searchPath, AssetCreationContext& context) diff --git a/src/ObjLoading/Game/T6/BSP/Linker/ComWorldLinker.h b/src/ObjLoading/Game/T6/BSP/Linker/ComWorldLinker.h index 2c688e38..06c7c6b0 100644 --- a/src/ObjLoading/Game/T6/BSP/Linker/ComWorldLinker.h +++ b/src/ObjLoading/Game/T6/BSP/Linker/ComWorldLinker.h @@ -11,7 +11,7 @@ namespace BSP { public: ComWorldLinker(MemoryManager& memory, ISearchPath& searchPath, AssetCreationContext& context); - ComWorld* linkComWorld(BSPData* bsp); + T6::ComWorld* linkComWorld(BSPData* bsp); private: MemoryManager& m_memory; diff --git a/src/ObjLoading/Game/T6/BSP/Linker/GameWorldMpLinker.cpp b/src/ObjLoading/Game/T6/BSP/Linker/GameWorldMpLinker.cpp index 6852b1aa..03bf5d89 100644 --- a/src/ObjLoading/Game/T6/BSP/Linker/GameWorldMpLinker.cpp +++ b/src/ObjLoading/Game/T6/BSP/Linker/GameWorldMpLinker.cpp @@ -1,5 +1,7 @@ #include "GameWorldMpLinker.h" +using namespace T6; + namespace BSP { GameWorldMpLinker::GameWorldMpLinker(MemoryManager& memory, ISearchPath& searchPath, AssetCreationContext& context) diff --git a/src/ObjLoading/Game/T6/BSP/Linker/GameWorldMpLinker.h b/src/ObjLoading/Game/T6/BSP/Linker/GameWorldMpLinker.h index 69c8bef5..ac426916 100644 --- a/src/ObjLoading/Game/T6/BSP/Linker/GameWorldMpLinker.h +++ b/src/ObjLoading/Game/T6/BSP/Linker/GameWorldMpLinker.h @@ -11,7 +11,7 @@ namespace BSP { public: GameWorldMpLinker(MemoryManager& memory, ISearchPath& searchPath, AssetCreationContext& context); - GameWorldMp* linkGameWorldMp(BSPData* bsp); + T6::GameWorldMp* linkGameWorldMp(BSPData* bsp); private: MemoryManager& m_memory; diff --git a/src/ObjLoading/Game/T6/BSP/Linker/GfxWorldLinker.cpp b/src/ObjLoading/Game/T6/BSP/Linker/GfxWorldLinker.cpp index dbc63064..5c5b8442 100644 --- a/src/ObjLoading/Game/T6/BSP/Linker/GfxWorldLinker.cpp +++ b/src/ObjLoading/Game/T6/BSP/Linker/GfxWorldLinker.cpp @@ -4,6 +4,8 @@ #include "Utils/Alignment.h" #include "Utils/Pack.h" +using namespace T6; + namespace BSP { GfxWorldLinker::GfxWorldLinker(MemoryManager& memory, ISearchPath& searchPath, AssetCreationContext& context) diff --git a/src/ObjLoading/Game/T6/BSP/Linker/GfxWorldLinker.h b/src/ObjLoading/Game/T6/BSP/Linker/GfxWorldLinker.h index 23063590..bea9f4ee 100644 --- a/src/ObjLoading/Game/T6/BSP/Linker/GfxWorldLinker.h +++ b/src/ObjLoading/Game/T6/BSP/Linker/GfxWorldLinker.h @@ -11,27 +11,27 @@ namespace BSP { public: GfxWorldLinker(MemoryManager& memory, ISearchPath& searchPath, AssetCreationContext& context); - GfxWorld* linkGfxWorld(BSPData* bsp); + T6::GfxWorld* linkGfxWorld(BSPData* bsp); private: MemoryManager& m_memory; ISearchPath& m_search_path; AssetCreationContext& m_context; - void loadDrawData(BSPData* projInfo, GfxWorld* gfxWorld); - bool loadMapSurfaces(BSPData* projInfo, GfxWorld* gfxWorld); - void loadXModels(BSPData* projInfo, GfxWorld* gfxWorld); - void cleanGfxWorld(GfxWorld* gfxWorld); - void loadGfxLights(GfxWorld* gfxWorld); - void loadLightGrid(GfxWorld* gfxWorld); - void loadGfxCells(GfxWorld* gfxWorld); - void loadModels(GfxWorld* gfxWorld); - bool loadReflectionProbeData(GfxWorld* gfxWorld); - bool loadLightmapData(GfxWorld* gfxWorld); - void loadSkyBox(BSPData* projInfo, GfxWorld* gfxWorld); - void loadDynEntData(GfxWorld* gfxWorld); - bool loadOutdoors(GfxWorld* gfxWorld); - void loadSunData(GfxWorld* gfxWorld); - void loadWorldBounds(GfxWorld* gfxWorld); + void loadDrawData(BSPData* projInfo, T6::GfxWorld* gfxWorld); + bool loadMapSurfaces(BSPData* projInfo, T6::GfxWorld* gfxWorld); + void loadXModels(BSPData* projInfo, T6::GfxWorld* gfxWorld); + void cleanGfxWorld(T6::GfxWorld* gfxWorld); + void loadGfxLights(T6::GfxWorld* gfxWorld); + void loadLightGrid(T6::GfxWorld* gfxWorld); + void loadGfxCells(T6::GfxWorld* gfxWorld); + void loadModels(T6::GfxWorld* gfxWorld); + bool loadReflectionProbeData(T6::GfxWorld* gfxWorld); + bool loadLightmapData(T6::GfxWorld* gfxWorld); + void loadSkyBox(BSPData* projInfo, T6::GfxWorld* gfxWorld); + void loadDynEntData(T6::GfxWorld* gfxWorld); + bool loadOutdoors(T6::GfxWorld* gfxWorld); + void loadSunData(T6::GfxWorld* gfxWorld); + void loadWorldBounds(T6::GfxWorld* gfxWorld); }; } // namespace BSP diff --git a/src/ObjLoading/Game/T6/BSP/Linker/MapEntsLinker.cpp b/src/ObjLoading/Game/T6/BSP/Linker/MapEntsLinker.cpp index 8a293297..061484b0 100644 --- a/src/ObjLoading/Game/T6/BSP/Linker/MapEntsLinker.cpp +++ b/src/ObjLoading/Game/T6/BSP/Linker/MapEntsLinker.cpp @@ -3,7 +3,9 @@ #include "../BSPUtil.h" #include + using namespace nlohmann; +using namespace T6; namespace { diff --git a/src/ObjLoading/Game/T6/BSP/Linker/MapEntsLinker.h b/src/ObjLoading/Game/T6/BSP/Linker/MapEntsLinker.h index 0c7681b3..de3b5b8f 100644 --- a/src/ObjLoading/Game/T6/BSP/Linker/MapEntsLinker.h +++ b/src/ObjLoading/Game/T6/BSP/Linker/MapEntsLinker.h @@ -11,7 +11,7 @@ namespace BSP { public: MapEntsLinker(MemoryManager& memory, ISearchPath& searchPath, AssetCreationContext& context); - MapEnts* linkMapEnts(BSPData* bsp); + T6::MapEnts* linkMapEnts(BSPData* bsp); private: MemoryManager& m_memory; diff --git a/src/ObjLoading/Game/T6/BSP/Linker/SkinnedVertsLinker.cpp b/src/ObjLoading/Game/T6/BSP/Linker/SkinnedVertsLinker.cpp index 33dba83e..7a17e3d2 100644 --- a/src/ObjLoading/Game/T6/BSP/Linker/SkinnedVertsLinker.cpp +++ b/src/ObjLoading/Game/T6/BSP/Linker/SkinnedVertsLinker.cpp @@ -9,11 +9,11 @@ namespace BSP { } - SkinnedVertsDef* SkinnedVertsLinker::linkSkinnedVerts(BSPData* bsp) + T6::SkinnedVertsDef* SkinnedVertsLinker::linkSkinnedVerts(BSPData* bsp) { // Pretty sure maxSkinnedVerts relates to the max amount of xmodel skinned verts a map will have // But setting it to the world vertex count seems to work - SkinnedVertsDef* skinnedVerts = m_memory.Alloc(); + T6::SkinnedVertsDef* skinnedVerts = m_memory.Alloc(); skinnedVerts->name = m_memory.Dup("skinnedverts"); skinnedVerts->maxSkinnedVerts = static_cast(bsp->gfxWorld.vertices.size()); diff --git a/src/ObjLoading/Game/T6/BSP/Linker/SkinnedVertsLinker.h b/src/ObjLoading/Game/T6/BSP/Linker/SkinnedVertsLinker.h index d64b0c20..e7a09239 100644 --- a/src/ObjLoading/Game/T6/BSP/Linker/SkinnedVertsLinker.h +++ b/src/ObjLoading/Game/T6/BSP/Linker/SkinnedVertsLinker.h @@ -11,7 +11,7 @@ namespace BSP { public: SkinnedVertsLinker(MemoryManager& memory, ISearchPath& searchPath, AssetCreationContext& context); - SkinnedVertsDef* linkSkinnedVerts(BSPData* bsp); + T6::SkinnedVertsDef* linkSkinnedVerts(BSPData* bsp); private: MemoryManager& m_memory;