diff --git a/src/game/server/CMakeLists.txt b/src/game/server/CMakeLists.txt index 98a199b1..6c913826 100644 --- a/src/game/server/CMakeLists.txt +++ b/src/game/server/CMakeLists.txt @@ -153,8 +153,8 @@ set(HL1 "shurispritedefs.h" "triggers.cpp" "world.cpp" - #"entities.cpp" - #"entities.h" + "entities.cpp" + "entities.h" "../shared/movement/pm_defs.h" "../shared/movement/pm_math.cpp" "../shared/movement/pm_movevars.h" diff --git a/src/game/server/entities.cpp b/src/game/server/entities.cpp index 24bcc8eb..44ec0b6f 100644 --- a/src/game/server/entities.cpp +++ b/src/game/server/entities.cpp @@ -1,28 +1,22 @@ -/*** -* -* Copyright (c) 1996-2002, Valve LLC. All rights reserved. -* -* This product contains software technology licensed from Id -* Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc. -* All Rights Reserved. -* -* This source code contains proprietary and confidential information of -* Valve LLC and its suppliers. Access to this code is restricted to -* persons who have executed a written SDK license with Valve. Any access, -* use or distribution of this code by or to any unlicensed person is illegal. -* -****/ -//========================================================= -// entities.cpp - Extra entity stuff. -//========================================================= +//============================================================================= +// +// ms.dll - Master Sword server .dll/.so +// +// https://msrebirth.net/ +// +// Author: Tom 'tschumann' Schumann +// Notes: load entities from .ent file +// +//============================================================================= #include "extdll.h" #include "util.h" +#include "iscript.h" #include "cbase.h" #include "entities.h" extern char *COM_Parse (char *data); -extern char com_token[]; +char com_token[1500]; CEntity WorldEntity; @@ -47,10 +41,9 @@ void CEntity::FixKeyName( char *key ) } //========================================================= -// CGraph - FLoadGraph - attempts to load a node graph from disk. -// if the current level is maps/snar.bsp, maps/graphs/snar.nod -// will be loaded. If file cannot be loaded, the node tree -// will be created and saved to disk. +// CEntity - FLoadEntity - attempts to load an entity file from disk. +// if the current level is maps/snar.bsp, maps/graphs/snar.ent +// will be loaded. //========================================================= int CEntity::FLoadEntity ( char *szMapName ) { @@ -183,7 +176,6 @@ int CEntity::FLoadEntity ( char *szMapName ) int CEntity::CheckENTFile ( char *szMapName ) { int retValue; - char szEntityFilename[MAX_PATH]; @@ -197,11 +189,12 @@ int CEntity::CheckENTFile ( char *szMapName ) if( !aMemFile ) { - ALERT ( at_aiconsole, ".ENT File not found\n\n" ); + ALERT ( at_aiconsole, ".ent File not found\n\n" ); retValue = FALSE; } else { + ENGINE_FORCE_UNMODIFIED( force_exactfile, NULL, NULL, szEntityFilename ); retValue = TRUE; } diff --git a/src/game/server/entities.h b/src/game/server/entities.h index 9f245f1e..bf4152c9 100644 --- a/src/game/server/entities.h +++ b/src/game/server/entities.h @@ -1,20 +1,13 @@ -/*** -* -* Copyright (c) 1996-2002, Valve LLC. All rights reserved. -* -* This product contains software technology licensed from Id -* Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc. -* All Rights Reserved. -* -* This source code contains proprietary and confidential information of -* Valve LLC and its suppliers. Access to this code is restricted to -* persons who have executed a written SDK license with Valve. Any access, -* use or distribution of this code by or to any unlicensed person is illegal. -* -****/ -//========================================================= -// entities.h -//========================================================= +//============================================================================= +// +// ms.dll - Master Sword server .dll/.so +// +// https://msrebirth.net/ +// +// Author: Tom 'tschumann' Schumann +// Notes: load entities from .ent file +// +//============================================================================= struct entity_t { @@ -36,10 +29,9 @@ class CEntity int FLoadEntity(char *szMapName); private: void FixKeyName( char *key ); - char *aMemFile; - char *pMemFile; - int length; + char *aMemFile; + char *pMemFile; + int length; }; - extern CEntity WorldEntity; diff --git a/src/game/server/world.cpp b/src/game/server/world.cpp index 7166ba18..809fac88 100644 --- a/src/game/server/world.cpp +++ b/src/game/server/world.cpp @@ -22,6 +22,7 @@ #include "msdllheaders.h" #include "nodes.h" +#include "entities.h" #include "soundent.h" #include "client.h" #include "decals.h" @@ -555,6 +556,9 @@ void CWorld ::Precache(void) // init the WorldGraph. WorldGraph.InitGraph(); + // init the WorldEntity + WorldEntity.InitEntity(); + // make sure the .NOD file is newer than the .BSP file. if (!WorldGraph.CheckNODFile((char *)STRING(gpGlobals->mapname))) { // NOD file is not present, or is older than the BSP file. @@ -573,6 +577,21 @@ void CWorld ::Precache(void) } } + // make sure the .ENT file exists + if (WorldEntity.CheckENTFile((char*)STRING(gpGlobals->mapname))) + { + // Load the node graph for this level + if (!WorldEntity.FLoadEntity((char*)STRING(gpGlobals->mapname))) + { + // couldn't parse + ALERT(at_console, "*Error parsing .ent file*\n"); + } + else + { + ALERT(at_console, "\n*Entities Loaded!\n"); + } + } + if (pev->speed > 0) CVAR_SET_FLOAT("sv_zmax", pev->speed); else