From a8e0cda87380d25f5d8cdf54be16364ac09d232d Mon Sep 17 00:00:00 2001 From: Daniel Gibson Date: Fri, 21 Jun 2024 03:37:30 +0200 Subject: [PATCH] CMake integration of Sikkmod, changes to code to make it compile no idea if it works, but it builds :-p --- CMakeLists.txt | 10 ++++++++-- d3xp/Grab.cpp | 8 ++++---- d3xp/Grab.h | 12 ++++++++++-- d3xp/Player.cpp | 1 + d3xp/Player.h | 1 + d3xp/ai/AI.cpp | 1 + game/Game_local.h | 6 ++++-- game/Grab.cpp | 7 ++++--- game/Grab.h | 11 +++++++++-- game/Player.cpp | 1 + game/Player.h | 1 + game/Projectile.cpp | 4 +++- game/ai/AI.cpp | 2 ++ game/physics/Force_Grab.cpp | 6 ++---- game/physics/Force_Grab.h | 4 +++- idlib/Lib.h | 2 ++ 16 files changed, 56 insertions(+), 21 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index f95fc93..27a0a6f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -2,11 +2,11 @@ cmake_minimum_required(VERSION 2.8...3.22 FATAL_ERROR) project(dhewm3sdk) option(BASE "Build the base (game/) game code" ON) -set(BASE_NAME "base" CACHE STRING "Name of the mod built from game/ (will result in \${BASE_NAME}.dll)") +set(BASE_NAME "sikkmod" CACHE STRING "Name of the mod built from game/ (will result in \${BASE_NAME}.dll)") set(BASE_DEFS "GAME_DLL" CACHE STRING "Compiler definitions for the mod built from game/") option(D3XP "Build the d3xp/ game code" ON) -set(D3XP_NAME "d3xp" CACHE STRING "Name of the mod built from d3xp/ (will result in \${D3XP_NAME}.dll)") +set(D3XP_NAME "sikkmodd3xp" CACHE STRING "Name of the mod built from d3xp/ (will result in \${D3XP_NAME}.dll)") set(D3XP_DEFS "GAME_DLL;_D3XP;CTF" CACHE STRING "Compiler definitions for the mod built from d3xp/") option(ONATIVE "Optimize for the host CPU" OFF) @@ -20,12 +20,18 @@ set(src_game_mod # add additional .cpp files of your mod in game/ # (that you added to the ones already existant in the SDK/in dhewm3) # like "game/MyFile.cpp" (without quotes, one file per line) + game/Grab.h + game/Grab.cpp + game/physics/Force_Grab.h + game/physics/Force_Grab.cpp ) set(src_d3xp_mod # add additional .cpp files of your mod in d3xp/ # (that you added to the ones already existant in the SDK/in dhewm3) # like "d3xp/MyFile.cpp" (without quotes, one file per line) + d3xp/Grab.h + d3xp/Grab.cpp ) diff --git a/d3xp/Grab.cpp b/d3xp/Grab.cpp index 6d1480a..5539b0c 100644 --- a/d3xp/Grab.cpp +++ b/d3xp/Grab.cpp @@ -1,10 +1,10 @@ // sikk---> Object Manipulation -#include "../idlib/precompiled.h" -#pragma hdrstop - #include "Game_local.h" +#include "Grab.h" #include "Misc.h" +#include "Player.h" +#include "gamesys/SysCvar.h" #define MAX_DRAG_TRACE_DISTANCE 80.0f #define TRACE_BOUNDS_SIZE 3.0f @@ -210,4 +210,4 @@ void idGrabEntity::Update( idPlayer *player ) { } prevViewAngles = player->viewAngles; } -// <---sikk \ No newline at end of file +// <---sikk diff --git a/d3xp/Grab.h b/d3xp/Grab.h index badab5f..b4ddfbe 100644 --- a/d3xp/Grab.h +++ b/d3xp/Grab.h @@ -8,6 +8,12 @@ =============================================================================== */ +#ifndef _Grab_h_defined +#define _Grab_h_defined + +#include "Entity.h" +#include "physics/Force_Grab.h" + class idGrabEntity : public idEntity { public: CLASS_PROTOTYPE( idGrabEntity ); @@ -23,7 +29,7 @@ public: idEntity * GetGrabEntity( void ) const { return dragEnt.GetEntity(); } int GetThrownTime( void ) const { return lastThrownTime; } - int SetThrownTime( int time ) { lastThrownTime = time; } + void SetThrownTime( int time ) { lastThrownTime = time; } private: idEntityPtr dragEnt; // entity being dragged @@ -40,4 +46,6 @@ private: int lastThrownTime; }; -// <---sikk \ No newline at end of file +// <---sikk + +#endif // _Grab_h_defined diff --git a/d3xp/Player.cpp b/d3xp/Player.cpp index abdb401..6833ab5 100644 --- a/d3xp/Player.cpp +++ b/d3xp/Player.cpp @@ -40,6 +40,7 @@ If you have questions concerning this license or the applicable additional terms #include "Camera.h" #include "Fx.h" #include "Misc.h" +#include "Moveable.h" const int ASYNC_PLAYER_INV_AMMO_BITS = idMath::BitsForInteger( 999 ); // 9 bits to cover the range [0, 999] const int ASYNC_PLAYER_INV_CLIP_BITS = -7; // -7 bits to cover the range [-1, 60] diff --git a/d3xp/Player.h b/d3xp/Player.h index bb2a4dc..b70cbc4 100644 --- a/d3xp/Player.h +++ b/d3xp/Player.h @@ -38,6 +38,7 @@ If you have questions concerning this license or the applicable additional terms #include "Projectile.h" #include "PlayerIcon.h" #include "GameEdit.h" +#include "Grab.h" // for sikkmod class idAI; class idFuncMountedObject; diff --git a/d3xp/ai/AI.cpp b/d3xp/ai/AI.cpp index a7b0b37..4fda0e7 100644 --- a/d3xp/ai/AI.cpp +++ b/d3xp/ai/AI.cpp @@ -35,6 +35,7 @@ If you have questions concerning this license or the applicable additional terms #include "Fx.h" #include "SmokeParticles.h" #include "Misc.h" +#include "WorldSpawn.h" #include "ai/AI.h" diff --git a/game/Game_local.h b/game/Game_local.h index d22d350..2d196cf 100644 --- a/game/Game_local.h +++ b/game/Game_local.h @@ -317,8 +317,8 @@ public: // sikk---> Portal Sky Box idEntityPtr portalSkyEnt; bool portalSkyActive; - void idGameLocal::SetPortalSkyEnt( idEntity *ent ) { portalSkyEnt = ent; } - bool idGameLocal::IsPortalSkyAcive( void ) { return portalSkyActive; } + void SetPortalSkyEnt( idEntity *ent ) { portalSkyEnt = ent; } + bool IsPortalSkyAcive( void ) { return portalSkyActive; } pvsHandle_t GetPlayerPVS( void ) { return playerPVS; }; // <---sikk @@ -684,6 +684,8 @@ extern const float DEFAULT_GRAVITY; extern const idVec3 DEFAULT_GRAVITY_VEC3; extern const int CINEMATIC_SKIP_DELAY; +#include "Entity.h" + #endif /* !__GAME_LOCAL_H__ */ #if 0 // TODO: DG: ??? diff --git a/game/Grab.cpp b/game/Grab.cpp index 9839b9b..d6b5bca 100644 --- a/game/Grab.cpp +++ b/game/Grab.cpp @@ -1,10 +1,11 @@ // sikk---> Object Manipulation -#include "../idlib/precompiled.h" -#pragma hdrstop #include "Game_local.h" +#include "Grab.h" #include "Misc.h" +#include "Player.h" +#include "gamesys/SysCvar.h" #define MAX_DRAG_TRACE_DISTANCE 80.0f #define TRACE_BOUNDS_SIZE 3.0f @@ -213,4 +214,4 @@ void idGrabEntity::Update( idPlayer *player ) { } prevViewAngles = player->viewAngles; } -// <---sikk \ No newline at end of file +// <---sikk diff --git a/game/Grab.h b/game/Grab.h index badab5f..ae57d3d 100644 --- a/game/Grab.h +++ b/game/Grab.h @@ -8,6 +8,11 @@ =============================================================================== */ +#ifndef _Grab_h_defined +#define _Grab_h_defined + +#include "physics/Force_Grab.h" + class idGrabEntity : public idEntity { public: CLASS_PROTOTYPE( idGrabEntity ); @@ -23,7 +28,7 @@ public: idEntity * GetGrabEntity( void ) const { return dragEnt.GetEntity(); } int GetThrownTime( void ) const { return lastThrownTime; } - int SetThrownTime( int time ) { lastThrownTime = time; } + void SetThrownTime( int time ) { lastThrownTime = time; } private: idEntityPtr dragEnt; // entity being dragged @@ -40,4 +45,6 @@ private: int lastThrownTime; }; -// <---sikk \ No newline at end of file +// <---sikk + +#endif // _Grab_h_defined diff --git a/game/Player.cpp b/game/Player.cpp index 68aaaf8..0c72b9b 100644 --- a/game/Player.cpp +++ b/game/Player.cpp @@ -40,6 +40,7 @@ If you have questions concerning this license or the applicable additional terms #include "Camera.h" #include "Fx.h" #include "Misc.h" +#include "Moveable.h" const int ASYNC_PLAYER_INV_AMMO_BITS = idMath::BitsForInteger( 999 ); // 9 bits to cover the range [0, 999] const int ASYNC_PLAYER_INV_CLIP_BITS = -7; // -7 bits to cover the range [-1, 60] diff --git a/game/Player.h b/game/Player.h index f43bfff..11b2e47 100644 --- a/game/Player.h +++ b/game/Player.h @@ -38,6 +38,7 @@ If you have questions concerning this license or the applicable additional terms #include "Projectile.h" #include "PlayerIcon.h" #include "GameEdit.h" +#include "Grab.h" // for sikkmod class idAI; diff --git a/game/Projectile.cpp b/game/Projectile.cpp index f5969ce..c6d6aa5 100644 --- a/game/Projectile.cpp +++ b/game/Projectile.cpp @@ -921,7 +921,9 @@ void idProjectile::Explode( const trace_t &collision, idEntity *ignore ) { } // sikk---> Entities hit directly by a projectile will no longer be ignored by splash damage // PostEventSec( &EV_RadiusDamage, delay, ignore ); - PostEventSec( &EV_RadiusDamage, delay, NULL ); + //PostEventSec( &EV_RadiusDamage, delay, NULL ); + // DG: the previous line didn't compile, I hope this is equivalent to the original intention + PostEventSec( &EV_RadiusDamage, delay ); } else { // Event_RadiusDamage( ignore ); Event_RadiusDamage( NULL ); diff --git a/game/ai/AI.cpp b/game/ai/AI.cpp index eea44b1..960b2b9 100644 --- a/game/ai/AI.cpp +++ b/game/ai/AI.cpp @@ -33,6 +33,8 @@ If you have questions concerning this license or the applicable additional terms #include "Moveable.h" #include "SmokeParticles.h" +#include "WorldSpawn.h" + #include "ai/AI.h" static const char *moveCommandString[ NUM_MOVE_COMMANDS ] = { diff --git a/game/physics/Force_Grab.cpp b/game/physics/Force_Grab.cpp index e023082..510af2f 100644 --- a/game/physics/Force_Grab.cpp +++ b/game/physics/Force_Grab.cpp @@ -1,8 +1,6 @@ // sikk---> Object Manipulation -#include "../../idlib/precompiled.h" -#pragma hdrstop - +#include "Force_Grab.h" #include "../Game_local.h" CLASS_DECLARATION( idForce, idForce_Grab ) @@ -150,4 +148,4 @@ void idForce_Grab::RemovePhysics( const idPhysics *phys ) { } } -// <---sikk \ No newline at end of file +// <---sikk diff --git a/game/physics/Force_Grab.h b/game/physics/Force_Grab.h index 35fb17b..a7f1100 100644 --- a/game/physics/Force_Grab.h +++ b/game/physics/Force_Grab.h @@ -3,6 +3,8 @@ #ifndef __FORCE_GRAB_H__ #define __FORCE_GRAB_H__ +#include "physics/Force.h" + /* =============================================================================== @@ -51,4 +53,4 @@ private: #endif /* !__FORCE_GRAB_H__ */ -// <---sikk \ No newline at end of file +// <---sikk diff --git a/idlib/Lib.h b/idlib/Lib.h index 5b2e999..5283109 100644 --- a/idlib/Lib.h +++ b/idlib/Lib.h @@ -29,6 +29,8 @@ If you have questions concerning this license or the applicable additional terms #ifndef __LIB_H__ #define __LIB_H__ +#include "sys/platform.h" // dword + /* ===============================================================================