diff --git a/src/common/cm/cm_local.h b/src/common/cm/cm_local.h
index 09ff99311d..4f0d21902e 100644
--- a/src/common/cm/cm_local.h
+++ b/src/common/cm/cm_local.h
@@ -32,6 +32,9 @@ Maryland 20850 USA.
===========================================================================
*/
+#ifndef COMMON_CM_CM_LOCAL_H_
+#define COMMON_CM_CM_LOCAL_H_
+
#include "cm_public.h"
#include "cm_polylib.h"
@@ -313,3 +316,5 @@ bool CM_BoundsIntersect( const vec3_t mins, const vec3_t m
bool CM_BoundsIntersectPoint( const vec3_t mins, const vec3_t maxs, const vec3_t point );
// XreaL END
+
+#endif // COMMON_CM_CM_LOCAL_H_
diff --git a/src/common/cm/cm_patch.h b/src/common/cm/cm_patch.h
index 09f4237912..5bc9fd50fd 100644
--- a/src/common/cm/cm_patch.h
+++ b/src/common/cm/cm_patch.h
@@ -32,6 +32,9 @@ Maryland 20850 USA.
===========================================================================
*/
+#ifndef COMMON_CM_CM_PATCH_H_
+#define COMMON_CM_CM_PATCH_H_
+
//#define CULL_BBOX
/*
@@ -86,3 +89,5 @@ void CM_SetGridWrapWidth( cGrid_t *grid );
void CM_SubdivideGridColumns( cGrid_t *grid );
void CM_RemoveDegenerateColumns( cGrid_t *grid );
void CM_TransposeGrid( cGrid_t *grid );
+
+#endif // COMMON_CM_CM_PATCH_H_
diff --git a/src/common/cm/cm_public.h b/src/common/cm/cm_public.h
index 1747445cca..5b26323407 100644
--- a/src/common/cm/cm_public.h
+++ b/src/common/cm/cm_public.h
@@ -32,6 +32,9 @@ Maryland 20850 USA.
===========================================================================
*/
+#ifndef COMMON_CM_CM_PUBLIC_H_
+#define COMMON_CM_CM_PUBLIC_H_
+
#include "engine/qcommon/q_shared.h"
void CM_LoadMap(Str::StringRef name);
@@ -79,3 +82,5 @@ int CM_WriteAreaBits( byte *buffer, int area );
// cm_marks.c
int CM_MarkFragments( int numPoints, const vec3_t *points, const vec3_t projection,
int maxPoints, vec3_t pointBuffer, int maxFragments, markFragment_t *fragmentBuffer );
+
+#endif // COMMON_CM_CM_PUBLIC_H_
diff --git a/src/engine/client/cg_msgdef.h b/src/engine/client/cg_msgdef.h
index 2fa99c8a98..9774509d65 100644
--- a/src/engine/client/cg_msgdef.h
+++ b/src/engine/client/cg_msgdef.h
@@ -24,7 +24,7 @@ along with this program. If not, see .
#define CG_MSGDEF_H
#include "cg_api.h"
-#include "engine/RefAPI.h"
+#include "engine/renderer/tr_types.h"
#include "common/IPC/CommonSyscalls.h"
#include "common/KeyIdentification.h"
diff --git a/src/engine/qcommon/SurfaceFlags.h b/src/engine/qcommon/SurfaceFlags.h
index e227c0bbca..4aa8316436 100644
--- a/src/engine/qcommon/SurfaceFlags.h
+++ b/src/engine/qcommon/SurfaceFlags.h
@@ -28,6 +28,9 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
===========================================================================
*/
+#ifndef ENGINE_QCOMMON_SURFACEFLAGS_H_
+#define ENGINE_QCOMMON_SURFACEFLAGS_H_
+
// this file is used by both engine and game code
// see engine/qcommon/q_shared.h
@@ -114,3 +117,5 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
// Jedi Knights games (see OpenJK) also define a third bitfield for flags with MATERIAL prefix to tell surface is water, snow, sand, glass, short grasss, long grass, etc.
// Jedi Knights games also redefine a lot of CONTENTS flags (introducing things like CONTENTS_LADDER) and SURF FLAGS (moving SURF_SKY to BIT(13) for example)
// Smokin'Guns uses a special .tex sidecar files to tweak surfaces flags
+
+#endif // ENGINE_QCOMMON_SURFACEFLAGS_H_
diff --git a/src/engine/renderer/ShadeCommon.h b/src/engine/renderer/ShadeCommon.h
index da4cac0fcd..0eca1b1c10 100644
--- a/src/engine/renderer/ShadeCommon.h
+++ b/src/engine/renderer/ShadeCommon.h
@@ -32,6 +32,9 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
===========================================================================
*/
+#ifndef ENGINE_RENDERER_SHADECOMMON_H_
+#define ENGINE_RENDERER_SHADECOMMON_H_
+
inline size_t GetLightMapNum( const shaderCommands_t* tess )
{
return tess->lightmapNum;
@@ -276,3 +279,5 @@ inline uint GetShaderProfilerRenderSubGroupsMode( const uint32_t stateBits ) {
return 0;
}
+
+#endif // ENGINE_RENDERER_SHADECOMMON_H_
diff --git a/src/engine/server/sg_msgdef.h b/src/engine/server/sg_msgdef.h
index 5ace84f369..70a9881474 100644
--- a/src/engine/server/sg_msgdef.h
+++ b/src/engine/server/sg_msgdef.h
@@ -20,6 +20,9 @@ along with this program. If not, see .
===========================================================================
*/
+#ifndef ENGINE_SERVER_SG_MSGDEF_H_
+#define ENGINE_SERVER_SG_MSGDEF_H_
+
#include "common/IPC/CommonSyscalls.h"
// game-module-to-engine calls
@@ -196,3 +199,5 @@ using GameClientThinkMsg = IPC::SyncMessage<
using GameRunFrameMsg = IPC::SyncMessage<
IPC::Message, int>
>;
+
+#endif // ENGINE_SERVER_SG_MSGDEF_H_
diff --git a/src/engine/sys/con_common.h b/src/engine/sys/con_common.h
index 1682171f2e..ba0123ed44 100644
--- a/src/engine/sys/con_common.h
+++ b/src/engine/sys/con_common.h
@@ -31,6 +31,9 @@ Maryland 20850 USA.
===========================================================================
*/
+#ifndef ENGINE_SYS_CON_COMMON_H_
+#define ENGINE_SYS_CON_COMMON_H_
+
#include "common/Color.h"
#include "qcommon/q_shared.h"
#include "qcommon/qcommon.h"
@@ -48,3 +51,5 @@ namespace Color {
int To4bit( const Color& color ) NOEXCEPT;
} // namespace Color
+
+#endif // ENGINE_SYS_CON_COMMON_H_
diff --git a/src/shared/client/cg_api.h b/src/shared/client/cg_api.h
index 69a2087035..67c1e3e9bf 100644
--- a/src/shared/client/cg_api.h
+++ b/src/shared/client/cg_api.h
@@ -33,8 +33,8 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#define SHARED_CLIENT_API_H_
#include "engine/qcommon/q_shared.h"
-#include "engine/RefAPI.h"
#include "engine/client/cg_api.h"
+#include "engine/renderer/tr_types.h"
#include "common/KeyIdentification.h"
#include "shared/CommonProxies.h"
#include