From: havoc Date: Wed, 24 Dec 2003 21:05:17 +0000 (+0000) Subject: added "sv_saveentfile" command to allow easy dumping of .ent files from maps so they... X-Git-Tag: xonotic-v0.1.0preview~6195 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=52bb3f7e43667d443f017bacdeaa5d99a2619e49;p=xonotic%2Fdarkplaces.git added "sv_saveentfile" command to allow easy dumping of .ent files from maps so they can then be edited in a text editor git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@3751 d7cf8633-e32d-0410-b094-e92efae38249 --- diff --git a/sv_main.c b/sv_main.c index 7f1b6a90..832b3b24 100644 --- a/sv_main.c +++ b/sv_main.c @@ -37,6 +37,7 @@ mempool_t *sv_edicts_mempool = NULL; extern void SV_Phys_Init (void); extern void SV_World_Init (void); +static void SV_SaveEntFile_f(void); /* =============== @@ -47,6 +48,7 @@ void SV_Init (void) { int i; + Cmd_AddCommand("sv_saveentfile", SV_SaveEntFile_f); Cvar_RegisterVariable (&sv_maxvelocity); Cvar_RegisterVariable (&sv_gravity); Cvar_RegisterVariable (&sv_friction); @@ -72,6 +74,18 @@ void SV_Init (void) sv_edicts_mempool = Mem_AllocPool("server edicts"); } +static void SV_SaveEntFile_f(void) +{ + char basename[MAX_QPATH]; + if (!sv.active || !sv.worldmodel) + { + Con_Printf("Not running a server\n"); + return; + } + FS_StripExtension(sv.worldmodel->name, basename, sizeof(basename)); + FS_WriteFile(va("%s.ent", basename), sv.worldmodel->brush.entities, strlen(sv.worldmodel->brush.entities)); +} + /* =============================================================================