]> de.git.xonotic.org Git - xonotic/darkplaces.git/commitdiff
added loading of .ent files if found (overriding entities in bsp)
authorhavoc <havoc@d7cf8633-e32d-0410-b094-e92efae38249>
Sat, 15 Mar 2003 04:53:24 +0000 (04:53 +0000)
committerhavoc <havoc@d7cf8633-e32d-0410-b094-e92efae38249>
Sat, 15 Mar 2003 04:53:24 +0000 (04:53 +0000)
added sv_entpatch cvar (to allow disabling the feature)

git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@2841 d7cf8633-e32d-0410-b094-e92efae38249

sv_main.c

index be142dc65b2a7911d88e73538687c3d18786ad9b..502a630e90290c9fc15fb9cd3674832e9cb7bd71 100644 (file)
--- a/sv_main.c
+++ b/sv_main.c
@@ -26,6 +26,7 @@ static cvar_t sv_cullentities_pvs = {0, "sv_cullentities_pvs", "0"}; // fast but
 static cvar_t sv_cullentities_portal = {0, "sv_cullentities_portal", "0"}; // extremely accurate visibility checking, but too slow
 static cvar_t sv_cullentities_trace = {0, "sv_cullentities_trace", "1"}; // tends to get false negatives, uses a timeout to keep entities visible a short time after becoming hidden
 static cvar_t sv_cullentities_stats = {0, "sv_cullentities_stats", "0"};
+static cvar_t sv_entpatch = {0, "sv_entpatch", "1"};
 
 server_t               sv;
 server_static_t        svs;
@@ -64,6 +65,7 @@ void SV_Init (void)
        Cvar_RegisterVariable (&sv_cullentities_portal);
        Cvar_RegisterVariable (&sv_cullentities_trace);
        Cvar_RegisterVariable (&sv_cullentities_stats);
+       Cvar_RegisterVariable (&sv_entpatch);
 
        SV_Phys_Init();
        SV_World_Init();
@@ -1730,8 +1732,9 @@ extern float              scr_centertime_off;
 
 void SV_SpawnServer (const char *server)
 {
-       edict_t         *ent;
-       int                     i;
+       edict_t *ent;
+       int i;
+       qbyte *entities;
 
        // let's not have any servers with no name
        if (hostname.string[0] == 0)
@@ -1862,7 +1865,20 @@ void SV_SpawnServer (const char *server)
 // serverflags are for cross level information (sigils)
        pr_global_struct->serverflags = svs.serverflags;
 
-       ED_LoadFromFile (sv.worldmodel->entities);
+       // load replacement entity file if found
+       entities = NULL;
+       if (sv_entpatch.integer)
+               entities = COM_LoadFile(va("maps/%s.ent", sv.name), true);
+       if (entities)
+       {
+               Con_Printf("Loaded maps/%s.ent\n", sv.name);
+               ED_LoadFromFile (entities);
+               Mem_Free(entities);
+       }
+       else
+               ED_LoadFromFile (sv.worldmodel->entities);
+
+
        // LordHavoc: clear world angles (to fix e3m3.bsp)
        VectorClear(sv.edicts->v->angles);