Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Team Arena support #650

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion code/qcommon/common.c
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ int demo_protocols[] =
#define MIN_DEDICATED_COMHUNKMEGS 1
#define MIN_COMHUNKMEGS 56
#define DEF_COMHUNKMEGS 128
#define DEF_COMZONEMEGS 24
#define DEF_COMZONEMEGS 48
#define DEF_COMHUNKMEGS_S XSTRING(DEF_COMHUNKMEGS)
#define DEF_COMZONEMEGS_S XSTRING(DEF_COMZONEMEGS)

Expand Down
1 change: 1 addition & 0 deletions code/server/server.h
Original file line number Diff line number Diff line change
Expand Up @@ -291,6 +291,7 @@ extern cvar_t *sv_gametype;
extern cvar_t *sv_pure;
extern cvar_t *sv_floodProtect;
extern cvar_t *sv_lanForceRate;
extern cvar_t *sv_entityPath;
#ifndef STANDALONE
extern cvar_t *sv_strictAuth;
#endif
Expand Down
37 changes: 36 additions & 1 deletion code/server/sv_game.c
Original file line number Diff line number Diff line change
Expand Up @@ -865,6 +865,37 @@ void SV_ShutdownGameProgs( void ) {
gvm = NULL;
}

/*
==================
SV_GetCustomEntityString
Read custom entity string from entity file for current map if it exists
Author: Wiz
==================
*/
static char *SV_GetCustomEntityString(void)
{
char filename[MAX_QPATH];
union {
char *c;
void *v;
} f;

if ( sv_entityPath->string[0] != '\0' )
Com_sprintf(filename, sizeof(filename), "%s%c%s.ent", sv_entityPath->string, PATH_SEP, sv_mapname->string);
else
Com_sprintf(filename, sizeof(filename), "%s.ent", sv_mapname->string);

FS_ReadFile(filename, &f.v);

if (!f.v)
return NULL;

FS_FreeFile(f.v);

return f.c;
}


/*
==================
SV_InitGameVM
Expand All @@ -876,7 +907,11 @@ static void SV_InitGameVM( qboolean restart ) {
int i;

// start the entity parsing at the beginning
sv.entityParsePoint = CM_EntityString();
//sv.entityParsePoint = CM_EntityString();

// now we can replace all entities on the map with our own
if ( !( sv.entityParsePoint = SV_GetCustomEntityString() ) )
sv.entityParsePoint = CM_EntityString();

// clear all gentity pointers that might still be set from
// a previous level
Expand Down
2 changes: 2 additions & 0 deletions code/server/sv_init.c
Original file line number Diff line number Diff line change
Expand Up @@ -669,6 +669,8 @@ void SV_Init (void)
sv_zombietime = Cvar_Get ("sv_zombietime", "2", CVAR_TEMP );
Cvar_Get ("nextmap", "", CVAR_TEMP );

sv_entityPath = Cvar_Get("sv_entityPath", "maps", CVAR_ARCHIVE );

sv_allowDownload = Cvar_Get ("sv_allowDownload", "0", CVAR_SERVERINFO);
Cvar_Get ("sv_dlURL", "", CVAR_SERVERINFO | CVAR_ARCHIVE);

Expand Down
2 changes: 2 additions & 0 deletions code/server/sv_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,8 @@ cvar_t *sv_gametype;
cvar_t *sv_pure;
cvar_t *sv_floodProtect;
cvar_t *sv_lanForceRate; // dedicated 1 (LAN) server forces local client rates to 99999 (bug #491)

cvar_t *sv_entityPath;
#ifndef STANDALONE
cvar_t *sv_strictAuth;
#endif
Expand Down