diff options
author | Tim Angus <tim@ngus.net> | 2006-05-16 20:41:57 +0000 |
---|---|---|
committer | Tim Angus <tim@ngus.net> | 2006-05-16 20:41:57 +0000 |
commit | 5c0efda0ef811b2bafedb2b4f53b083a9b90e1b4 (patch) | |
tree | 972db3bf7fabe5293b383bb51fcb1aa74cc0e309 /src/server | |
parent | f68a49a146f20c7b6fc8e19dd1c4e6d58cf473e9 (diff) |
* Removal of bot code
* Refactored botlib parsing code into qcommon
Diffstat (limited to 'src/server')
-rw-r--r-- | src/server/sv_bot.c | 636 | ||||
-rw-r--r-- | src/server/sv_ccmds.c | 9 | ||||
-rw-r--r-- | src/server/sv_client.c | 38 | ||||
-rw-r--r-- | src/server/sv_game.c | 401 | ||||
-rw-r--r-- | src/server/sv_init.c | 47 | ||||
-rw-r--r-- | src/server/sv_main.c | 15 | ||||
-rw-r--r-- | src/server/sv_snapshot.c | 6 |
7 files changed, 26 insertions, 1126 deletions
diff --git a/src/server/sv_bot.c b/src/server/sv_bot.c deleted file mode 100644 index 12eb4563..00000000 --- a/src/server/sv_bot.c +++ /dev/null @@ -1,636 +0,0 @@ -/* -=========================================================================== -Copyright (C) 1999-2005 Id Software, Inc. -Copyright (C) 2000-2006 Tim Angus - -This file is part of Tremulous. - -Tremulous is free software; you can redistribute it -and/or modify it under the terms of the GNU General Public License as -published by the Free Software Foundation; either version 2 of the License, -or (at your option) any later version. - -Tremulous is distributed in the hope that it will be -useful, but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with Tremulous; if not, write to the Free Software -Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA -=========================================================================== -*/ -// sv_bot.c - -#include "server.h" -#include "../botlib/botlib.h" - -typedef struct bot_debugpoly_s -{ - int inuse; - int color; - int numPoints; - vec3_t points[128]; -} bot_debugpoly_t; - -static bot_debugpoly_t *debugpolygons; -int bot_maxdebugpolys; - -extern botlib_export_t *botlib_export; -int bot_enable; - - -/* -================== -SV_BotAllocateClient -================== -*/ -int SV_BotAllocateClient(void) { - int i; - client_t *cl; - - // find a client slot - for ( i = 0, cl = svs.clients; i < sv_maxclients->integer; i++, cl++ ) { - if ( cl->state == CS_FREE ) { - break; - } - } - - if ( i == sv_maxclients->integer ) { - return -1; - } - - cl->gentity = SV_GentityNum( i ); - cl->gentity->s.number = i; - cl->state = CS_ACTIVE; - cl->lastPacketTime = svs.time; - cl->netchan.remoteAddress.type = NA_BOT; - cl->rate = 16384; - - return i; -} - -/* -================== -SV_BotFreeClient -================== -*/ -void SV_BotFreeClient( int clientNum ) { - client_t *cl; - - if ( clientNum < 0 || clientNum >= sv_maxclients->integer ) { - Com_Error( ERR_DROP, "SV_BotFreeClient: bad clientNum: %i", clientNum ); - } - cl = &svs.clients[clientNum]; - cl->state = CS_FREE; - cl->name[0] = 0; - if ( cl->gentity ) { - cl->gentity->r.svFlags &= ~SVF_BOT; - } -} - -/* -================== -BotDrawDebugPolygons -================== -*/ -void BotDrawDebugPolygons(void (*drawPoly)(int color, int numPoints, float *points), int value) { - static cvar_t *bot_debug, *bot_groundonly, *bot_reachability, *bot_highlightarea; - bot_debugpoly_t *poly; - int i, parm0; - - if (!debugpolygons) - return; - //bot debugging - if (!bot_debug) bot_debug = Cvar_Get("bot_debug", "0", 0); - // - if (bot_enable && bot_debug->integer) { - //show reachabilities - if (!bot_reachability) bot_reachability = Cvar_Get("bot_reachability", "0", 0); - //show ground faces only - if (!bot_groundonly) bot_groundonly = Cvar_Get("bot_groundonly", "1", 0); - //get the hightlight area - if (!bot_highlightarea) bot_highlightarea = Cvar_Get("bot_highlightarea", "0", 0); - // - parm0 = 0; - if (svs.clients[0].lastUsercmd.buttons & BUTTON_ATTACK) parm0 |= 1; - if (bot_reachability->integer) parm0 |= 2; - if (bot_groundonly->integer) parm0 |= 4; - botlib_export->BotLibVarSet("bot_highlightarea", bot_highlightarea->string); - botlib_export->Test(parm0, NULL, svs.clients[0].gentity->r.currentOrigin, - svs.clients[0].gentity->r.currentAngles); - } //end if - //draw all debug polys - for (i = 0; i < bot_maxdebugpolys; i++) { - poly = &debugpolygons[i]; - if (!poly->inuse) continue; - drawPoly(poly->color, poly->numPoints, (float *) poly->points); - //Com_Printf("poly %i, numpoints = %d\n", i, poly->numPoints); - } -} - -/* -================== -BotImport_Print -================== -*/ -void QDECL BotImport_Print(int type, char *fmt, ...) -{ - char str[2048]; - va_list ap; - - va_start(ap, fmt); - vsprintf(str, fmt, ap); - va_end(ap); - - switch(type) { - case PRT_MESSAGE: { - Com_Printf("%s", str); - break; - } - case PRT_WARNING: { - Com_Printf(S_COLOR_YELLOW "Warning: %s", str); - break; - } - case PRT_ERROR: { - Com_Printf(S_COLOR_RED "Error: %s", str); - break; - } - case PRT_FATAL: { - Com_Printf(S_COLOR_RED "Fatal: %s", str); - break; - } - case PRT_EXIT: { - Com_Error(ERR_DROP, S_COLOR_RED "Exit: %s", str); - break; - } - default: { - Com_Printf("unknown print type\n"); - break; - } - } -} - -/* -================== -BotImport_Trace -================== -*/ -void BotImport_Trace(bsp_trace_t *bsptrace, vec3_t start, vec3_t mins, vec3_t maxs, vec3_t end, int passent, int contentmask) { - trace_t trace; - - SV_Trace(&trace, start, mins, maxs, end, passent, contentmask, qfalse); - //copy the trace information - bsptrace->allsolid = trace.allsolid; - bsptrace->startsolid = trace.startsolid; - bsptrace->fraction = trace.fraction; - VectorCopy(trace.endpos, bsptrace->endpos); - bsptrace->plane.dist = trace.plane.dist; - VectorCopy(trace.plane.normal, bsptrace->plane.normal); - bsptrace->plane.signbits = trace.plane.signbits; - bsptrace->plane.type = trace.plane.type; - bsptrace->surface.value = trace.surfaceFlags; - bsptrace->ent = trace.entityNum; - bsptrace->exp_dist = 0; - bsptrace->sidenum = 0; - bsptrace->contents = 0; -} - -/* -================== -BotImport_EntityTrace -================== -*/ -void BotImport_EntityTrace(bsp_trace_t *bsptrace, vec3_t start, vec3_t mins, vec3_t maxs, vec3_t end, int entnum, int contentmask) { - trace_t trace; - - SV_ClipToEntity(&trace, start, mins, maxs, end, entnum, contentmask, qfalse); - //copy the trace information - bsptrace->allsolid = trace.allsolid; - bsptrace->startsolid = trace.startsolid; - bsptrace->fraction = trace.fraction; - VectorCopy(trace.endpos, bsptrace->endpos); - bsptrace->plane.dist = trace.plane.dist; - VectorCopy(trace.plane.normal, bsptrace->plane.normal); - bsptrace->plane.signbits = trace.plane.signbits; - bsptrace->plane.type = trace.plane.type; - bsptrace->surface.value = trace.surfaceFlags; - bsptrace->ent = trace.entityNum; - bsptrace->exp_dist = 0; - bsptrace->sidenum = 0; - bsptrace->contents = 0; -} - - -/* -================== -BotImport_PointContents -================== -*/ -int BotImport_PointContents(vec3_t point) { - return SV_PointContents(point, -1); -} - -/* -================== -BotImport_inPVS -================== -*/ -int BotImport_inPVS(vec3_t p1, vec3_t p2) { - return SV_inPVS (p1, p2); -} - -/* -================== -BotImport_BSPEntityData -================== -*/ -char *BotImport_BSPEntityData(void) { - return CM_EntityString(); -} - -/* -================== -BotImport_BSPModelMinsMaxsOrigin -================== -*/ -void BotImport_BSPModelMinsMaxsOrigin(int modelnum, vec3_t angles, vec3_t outmins, vec3_t outmaxs, vec3_t origin) { - clipHandle_t h; - vec3_t mins, maxs; - float max; - int i; - - h = CM_InlineModel(modelnum); - CM_ModelBounds(h, mins, maxs); - //if the model is rotated - if ((angles[0] || angles[1] || angles[2])) { - // expand for rotation - - max = RadiusFromBounds(mins, maxs); - for (i = 0; i < 3; i++) { - mins[i] = -max; - maxs[i] = max; - } - } - if (outmins) VectorCopy(mins, outmins); - if (outmaxs) VectorCopy(maxs, outmaxs); - if (origin) VectorClear(origin); -} - -/* -================== -BotImport_GetMemory -================== -*/ -void *BotImport_GetMemory(int size) { - void *ptr; - - ptr = Z_TagMalloc( size, TAG_BOTLIB ); - return ptr; -} - -/* -================== -BotImport_FreeMemory -================== -*/ -void BotImport_FreeMemory(void *ptr) { - Z_Free(ptr); -} - -/* -================= -BotImport_HunkAlloc -================= -*/ -void *BotImport_HunkAlloc( int size ) { - if( Hunk_CheckMark() ) { - Com_Error( ERR_DROP, "SV_Bot_HunkAlloc: Alloc with marks already set\n" ); - } - return Hunk_Alloc( size, h_high ); -} - -/* -================== -BotImport_DebugPolygonCreate -================== -*/ -int BotImport_DebugPolygonCreate(int color, int numPoints, vec3_t *points) { - bot_debugpoly_t *poly; - int i; - - if (!debugpolygons) - return 0; - - for (i = 1; i < bot_maxdebugpolys; i++) { - if (!debugpolygons[i].inuse) - break; - } - if (i >= bot_maxdebugpolys) - return 0; - poly = &debugpolygons[i]; - poly->inuse = qtrue; - poly->color = color; - poly->numPoints = numPoints; - Com_Memcpy(poly->points, points, numPoints * sizeof(vec3_t)); - // - return i; -} - -/* -================== -BotImport_DebugPolygonShow -================== -*/ -void BotImport_DebugPolygonShow(int id, int color, int numPoints, vec3_t *points) { - bot_debugpoly_t *poly; - - if (!debugpolygons) return; - poly = &debugpolygons[id]; - poly->inuse = qtrue; - poly->color = color; - poly->numPoints = numPoints; - Com_Memcpy(poly->points, points, numPoints * sizeof(vec3_t)); -} - -/* -================== -BotImport_DebugPolygonDelete -================== -*/ -void BotImport_DebugPolygonDelete(int id) -{ - if (!debugpolygons) return; - debugpolygons[id].inuse = qfalse; -} - -/* -================== -BotImport_DebugLineCreate -================== -*/ -int BotImport_DebugLineCreate(void) { - vec3_t points[1]; - return BotImport_DebugPolygonCreate(0, 0, points); -} - -/* -================== -BotImport_DebugLineDelete -================== -*/ -void BotImport_DebugLineDelete(int line) { - BotImport_DebugPolygonDelete(line); -} - -/* -================== -BotImport_DebugLineShow -================== -*/ -void BotImport_DebugLineShow(int line, vec3_t start, vec3_t end, int color) { - vec3_t points[4], dir, cross, up = {0, 0, 1}; - float dot; - - VectorCopy(start, points[0]); - VectorCopy(start, points[1]); - //points[1][2] -= 2; - VectorCopy(end, points[2]); - //points[2][2] -= 2; - VectorCopy(end, points[3]); - - - VectorSubtract(end, start, dir); - VectorNormalize(dir); - dot = DotProduct(dir, up); - if (dot > 0.99 || dot < -0.99) VectorSet(cross, 1, 0, 0); - else CrossProduct(dir, up, cross); - - VectorNormalize(cross); - - VectorMA(points[0], 2, cross, points[0]); - VectorMA(points[1], -2, cross, points[1]); - VectorMA(points[2], -2, cross, points[2]); - VectorMA(points[3], 2, cross, points[3]); - - BotImport_DebugPolygonShow(line, color, 4, points); -} - -/* -================== -SV_BotClientCommand -================== -*/ -void BotClientCommand( int client, char *command ) { - SV_ExecuteClientCommand( &svs.clients[client], command, qtrue ); -} - -/* -================== -SV_BotFrame -================== -*/ -void SV_BotFrame( int time ) { - if (!bot_enable) return; - //NOTE: maybe the game is already shutdown - if (!gvm) return; - VM_Call( gvm, BOTAI_START_FRAME, time ); -} - -/* -=============== -SV_BotLibSetup -=============== -*/ -int SV_BotLibSetup( void ) { - if (!bot_enable) { - return 0; - } - - if ( !botlib_export ) { - Com_Printf( S_COLOR_RED "Error: SV_BotLibSetup without SV_BotInitBotLib\n" ); - return -1; - } - - return botlib_export->BotLibSetup(); -} - -/* -=============== -SV_ShutdownBotLib - -Called when either the entire server is being killed, or -it is changing to a different game directory. -=============== -*/ -int SV_BotLibShutdown( void ) { - - if ( !botlib_export ) { - return -1; - } - - return botlib_export->BotLibShutdown(); -} - -/* -================== -SV_BotInitCvars -================== -*/ -void SV_BotInitCvars(void) { - - Cvar_Get("bot_enable", "1", 0); //enable the bot - Cvar_Get("bot_developer", "0", CVAR_CHEAT); //bot developer mode - Cvar_Get("bot_debug", "0", CVAR_CHEAT); //enable bot debugging - Cvar_Get("bot_maxdebugpolys", "2", 0); //maximum number of debug polys - Cvar_Get("bot_groundonly", "1", 0); //only show ground faces of areas - Cvar_Get("bot_reachability", "0", 0); //show all reachabilities to other areas - Cvar_Get("bot_visualizejumppads", "0", CVAR_CHEAT); //show jumppads - Cvar_Get("bot_forceclustering", "0", 0); //force cluster calculations - Cvar_Get("bot_forcereachability", "0", 0); //force reachability calculations - Cvar_Get("bot_forcewrite", "0", 0); //force writing aas file - Cvar_Get("bot_aasoptimize", "0", 0); //no aas file optimisation - Cvar_Get("bot_saveroutingcache", "0", 0); //save routing cache - Cvar_Get("bot_thinktime", "100", CVAR_CHEAT); //msec the bots thinks - Cvar_Get("bot_reloadcharacters", "0", 0); //reload the bot characters each time - Cvar_Get("bot_testichat", "0", 0); //test ichats - Cvar_Get("bot_testrchat", "0", 0); //test rchats - Cvar_Get("bot_testsolid", "0", CVAR_CHEAT); //test for solid areas - Cvar_Get("bot_testclusters", "0", CVAR_CHEAT); //test the AAS clusters - Cvar_Get("bot_fastchat", "0", 0); //fast chatting bots - Cvar_Get("bot_nochat", "0", 0); //disable chats - Cvar_Get("bot_pause", "0", CVAR_CHEAT); //pause the bots thinking - Cvar_Get("bot_report", "0", CVAR_CHEAT); //get a full report in ctf - Cvar_Get("bot_grapple", "0", 0); //enable grapple - Cvar_Get("bot_rocketjump", "1", 0); //enable rocket jumping - Cvar_Get("bot_challenge", "0", 0); //challenging bot - Cvar_Get("bot_minplayers", "0", 0); //minimum players in a team or the game - Cvar_Get("bot_interbreedchar", "", CVAR_CHEAT); //bot character used for interbreeding - Cvar_Get("bot_interbreedbots", "10", CVAR_CHEAT); //number of bots used for interbreeding - Cvar_Get("bot_interbreedcycle", "20", CVAR_CHEAT); //bot interbreeding cycle - Cvar_Get("bot_interbreedwrite", "", CVAR_CHEAT); //write interbreeded bots to this file -} - -/* -================== -SV_BotInitBotLib -================== -*/ -void SV_BotInitBotLib(void) { - botlib_import_t botlib_import; - - if ( !Cvar_VariableValue("fs_restrict") && !Sys_CheckCD() ) { - Com_Error( ERR_NEED_CD, "Game CD not in drive" ); - } - - if (debugpolygons) Z_Free(debugpolygons); - bot_maxdebugpolys = Cvar_VariableIntegerValue("bot_maxdebugpolys"); - debugpolygons = Z_Malloc(sizeof(bot_debugpoly_t) * bot_maxdebugpolys); - - botlib_import.Print = BotImport_Print; - botlib_import.Trace = BotImport_Trace; - botlib_import.EntityTrace = BotImport_EntityTrace; - botlib_import.PointContents = BotImport_PointContents; - botlib_import.inPVS = BotImport_inPVS; - botlib_import.BSPEntityData = BotImport_BSPEntityData; - botlib_import.BSPModelMinsMaxsOrigin = BotImport_BSPModelMinsMaxsOrigin; - botlib_import.BotClientCommand = BotClientCommand; - - //memory management - botlib_import.GetMemory = BotImport_GetMemory; - botlib_import.FreeMemory = BotImport_FreeMemory; - botlib_import.AvailableMemory = Z_AvailableMemory; - botlib_import.HunkAlloc = BotImport_HunkAlloc; - - // file system access - botlib_import.FS_FOpenFile = FS_FOpenFileByMode; - botlib_import.FS_Read = FS_Read2; - botlib_import.FS_Write = FS_Write; - botlib_import.FS_FCloseFile = FS_FCloseFile; - botlib_import.FS_Seek = FS_Seek; - - //debug lines - botlib_import.DebugLineCreate = BotImport_DebugLineCreate; - botlib_import.DebugLineDelete = BotImport_DebugLineDelete; - botlib_import.DebugLineShow = BotImport_DebugLineShow; - - //debug polygons - botlib_import.DebugPolygonCreate = BotImport_DebugPolygonCreate; - botlib_import.DebugPolygonDelete = BotImport_DebugPolygonDelete; - - botlib_export = (botlib_export_t *)GetBotLibAPI( BOTLIB_API_VERSION, &botlib_import ); - assert(botlib_export); // bk001129 - somehow we end up with a zero import. -} - - -// -// * * * BOT AI CODE IS BELOW THIS POINT * * * -// - -/* -================== -SV_BotGetConsoleMessage -================== -*/ -int SV_BotGetConsoleMessage( int client, char *buf, int size ) -{ - client_t *cl; - int index; - - cl = &svs.clients[client]; - cl->lastPacketTime = svs.time; - - if ( cl->reliableAcknowledge == cl->reliableSequence ) { - return qfalse; - } - - cl->reliableAcknowledge++; - index = cl->reliableAcknowledge & ( MAX_RELIABLE_COMMANDS - 1 ); - - if ( !cl->reliableCommands[index][0] ) { - return qfalse; - } - - Q_strncpyz( buf, cl->reliableCommands[index], size ); - return qtrue; -} - -#if 0 -/* -================== -EntityInPVS -================== -*/ -int EntityInPVS( int client, int entityNum ) { - client_t *cl; - clientSnapshot_t *frame; - int i; - - cl = &svs.clients[client]; - frame = &cl->frames[cl->netchan.outgoingSequence & PACKET_MASK]; - for ( i = 0; i < frame->num_entities; i++ ) { - if ( svs.snapshotEntities[(frame->first_entity + i) % svs.numSnapshotEntities].number == entityNum ) { - return qtrue; - } - } - return qfalse; -} -#endif - -/* -================== -SV_BotGetSnapshotEntity -================== -*/ -int SV_BotGetSnapshotEntity( int client, int sequence ) { - client_t *cl; - clientSnapshot_t *frame; - - cl = &svs.clients[client]; - frame = &cl->frames[cl->netchan.outgoingSequence & PACKET_MASK]; - if (sequence < 0 || sequence >= frame->num_entities) { - return -1; - } - return svs.snapshotEntities[(frame->first_entity + sequence) % svs.numSnapshotEntities].number; -} - diff --git a/src/server/sv_ccmds.c b/src/server/sv_ccmds.c index 0e016056..a89b0f21 100644 --- a/src/server/sv_ccmds.c +++ b/src/server/sv_ccmds.c @@ -210,7 +210,6 @@ static void SV_MapRestart_f( void ) { int i; client_t *client; char *denied; - qboolean isBot; int delay; // make sure we aren't restarting twice in the same frame @@ -290,17 +289,11 @@ static void SV_MapRestart_f( void ) { continue; } - if ( client->netchan.remoteAddress.type == NA_BOT ) { - isBot = qtrue; - } else { - isBot = qfalse; - } - // add the map_restart command SV_AddServerCommand( client, "map_restart\n" ); // connect the client again, without the firstTime flag - denied = VM_ExplicitArgPtr( gvm, VM_Call( gvm, GAME_CLIENT_CONNECT, i, qfalse, isBot ) ); + denied = VM_ExplicitArgPtr( gvm, VM_Call( gvm, GAME_CLIENT_CONNECT, i, qfalse ) ); if ( denied ) { // this generally shouldn't happen, because the client // was connected before the level change diff --git a/src/server/sv_client.c b/src/server/sv_client.c index fe7cc905..3ee193dd 100644 --- a/src/server/sv_client.c +++ b/src/server/sv_client.c @@ -233,22 +233,8 @@ void SV_DirectConnect( netadr_t from ) { if ( !newcl ) { if ( NET_IsLocalAddress( from ) ) { - count = 0; - for ( i = startIndex; i < sv_maxclients->integer ; i++ ) { - cl = &svs.clients[i]; - if (cl->netchan.remoteAddress.type == NA_BOT) { - count++; - } - } - // if they're all bots - if (count >= sv_maxclients->integer - startIndex) { - SV_DropClient(&svs.clients[sv_maxclients->integer - 1], "only bots on server"); - newcl = &svs.clients[sv_maxclients->integer - 1]; - } - else { - Com_Error( ERR_FATAL, "server is full on local connect\n" ); - return; - } + Com_Error( ERR_FATAL, "server is full on local connect\n" ); + return; } else { NET_OutOfBandPrint( NS_SERVER, from, "print\nServer is full" ); @@ -282,7 +268,7 @@ gotnewcl: Q_strncpyz( newcl->userinfo, userinfo, sizeof(newcl->userinfo) ); // get the game a chance to reject this connection or modify the userinfo - denied = VM_Call( gvm, GAME_CLIENT_CONNECT, clientNum, qtrue, qfalse ); // firstTime = qtrue + denied = VM_Call( gvm, GAME_CLIENT_CONNECT, clientNum, qtrue ); // firstTime = qtrue if ( denied ) { // we can't just use VM_ArgPtr, because that is only valid inside a VM_Call char *str = VM_ExplicitArgPtr( gvm, denied ); @@ -340,15 +326,13 @@ void SV_DropClient( client_t *drop, const char *reason ) { return; // already dropped } - if (drop->netchan.remoteAddress.type != NA_BOT) { - // see if we already have a challenge for this ip - challenge = &svs.challenges[0]; + // see if we already have a challenge for this ip + challenge = &svs.challenges[0]; - for (i = 0 ; i < MAX_CHALLENGES ; i++, challenge++) { - if ( NET_CompareAdr( drop->netchan.remoteAddress, challenge->adr ) ) { - challenge->connected = qfalse; - break; - } + for (i = 0 ; i < MAX_CHALLENGES ; i++, challenge++) { + if ( NET_CompareAdr( drop->netchan.remoteAddress, challenge->adr ) ) { + challenge->connected = qfalse; + break; } } @@ -373,10 +357,6 @@ void SV_DropClient( client_t *drop, const char *reason ) { // add the disconnect command SV_SendServerCommand( drop, "disconnect \"%s\"", reason); - if ( drop->netchan.remoteAddress.type == NA_BOT ) { - SV_BotFreeClient( drop - svs.clients ); - } - // nuke user info SV_SetUserinfo( drop - svs.clients, "" ); diff --git a/src/server/sv_game.c b/src/server/sv_game.c index cd6354f5..82a02184 100644 --- a/src/server/sv_game.c +++ b/src/server/sv_game.c @@ -24,10 +24,6 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA #include "server.h" -#include "../botlib/botlib.h" - -botlib_export_t *botlib_export; - void SV_GameError( const char *string ) { Com_Error( ERR_DROP, "%s", string ); } @@ -413,12 +409,6 @@ intptr_t SV_GameSystemCalls( intptr_t *args ) { case G_AREAS_CONNECTED: return CM_AreasConnected( args[1], args[2] ); - case G_BOT_ALLOCATE_CLIENT: - return SV_BotAllocateClient(); - case G_BOT_FREE_CLIENT: - SV_BotFreeClient( args[1] ); - return 0; - case G_GET_USERCMD: SV_GetUsercmd( args[1], VMA(2) ); return 0; @@ -435,11 +425,6 @@ intptr_t SV_GameSystemCalls( intptr_t *args ) { } } - case G_DEBUG_POLYGON_CREATE: - return BotImport_DebugPolygonCreate( args[1], args[2], VMA(3) ); - case G_DEBUG_POLYGON_DELETE: - BotImport_DebugPolygonDelete( args[1] ); - return 0; case G_REAL_TIME: return Com_RealTime( VMA(1) ); case G_SNAPVECTOR: @@ -450,370 +435,18 @@ intptr_t SV_GameSystemCalls( intptr_t *args ) { SV_MasterGameStat( VMA(1) ); return 0; - //==================================== - - case BOTLIB_SETUP: - return SV_BotLibSetup(); - case BOTLIB_SHUTDOWN: - return SV_BotLibShutdown(); - case BOTLIB_LIBVAR_SET: - return botlib_export->BotLibVarSet( VMA(1), VMA(2) ); - case BOTLIB_LIBVAR_GET: - return botlib_export->BotLibVarGet( VMA(1), VMA(2), args[3] ); - - case BOTLIB_PC_ADD_GLOBAL_DEFINE: - return botlib_export->PC_AddGlobalDefine( VMA(1) ); - case BOTLIB_PC_LOAD_SOURCE: - return botlib_export->PC_LoadSourceHandle( VMA(1) ); - case BOTLIB_PC_FREE_SOURCE: - return botlib_export->PC_FreeSourceHandle( args[1] ); - case BOTLIB_PC_READ_TOKEN: - return botlib_export->PC_ReadTokenHandle( args[1], VMA(2) ); - case BOTLIB_PC_SOURCE_FILE_AND_LINE: - return botlib_export->PC_SourceFileAndLine( args[1], VMA(2), VMA(3) ); - - case BOTLIB_START_FRAME: - return botlib_export->BotLibStartFrame( VMF(1) ); - case BOTLIB_LOAD_MAP: - return botlib_export->BotLibLoadMap( VMA(1) ); - case BOTLIB_UPDATENTITY: - return botlib_export->BotLibUpdateEntity( args[1], VMA(2) ); - case BOTLIB_TEST: - return botlib_export->Test( args[1], VMA(2), VMA(3), VMA(4) ); - - case BOTLIB_GET_SNAPSHOT_ENTITY: - return SV_BotGetSnapshotEntity( args[1], args[2] ); - case BOTLIB_GET_CONSOLE_MESSAGE: - return SV_BotGetConsoleMessage( args[1], VMA(2), args[3] ); - case BOTLIB_USER_COMMAND: - SV_ClientThink( &svs.clients[args[1]], VMA(2) ); - return 0; - - case BOTLIB_AAS_BBOX_AREAS: - return botlib_export->aas.AAS_BBoxAreas( VMA(1), VMA(2), VMA(3), args[4] ); - case BOTLIB_AAS_AREA_INFO: - return botlib_export->aas.AAS_AreaInfo( args[1], VMA(2) ); - case BOTLIB_AAS_ALTERNATIVE_ROUTE_GOAL: - return botlib_export->aas.AAS_AlternativeRouteGoals( VMA(1), args[2], VMA(3), args[4], args[5], VMA(6), args[7], args[8] ); - case BOTLIB_AAS_ENTITY_INFO: - botlib_export->aas.AAS_EntityInfo( args[1], VMA(2) ); - return 0; - - case BOTLIB_AAS_INITIALIZED: - return botlib_export->aas.AAS_Initialized(); - case BOTLIB_AAS_PRESENCE_TYPE_BOUNDING_BOX: - botlib_export->aas.AAS_PresenceTypeBoundingBox( args[1], VMA(2), VMA(3) ); - return 0; - case BOTLIB_AAS_TIME: - return FloatAsInt( botlib_export->aas.AAS_Time() ); - - case BOTLIB_AAS_POINT_AREA_NUM: - return botlib_export->aas.AAS_PointAreaNum( VMA(1) ); - case BOTLIB_AAS_POINT_REACHABILITY_AREA_INDEX: - return botlib_export->aas.AAS_PointReachabilityAreaIndex( VMA(1) ); - case BOTLIB_AAS_TRACE_AREAS: - return botlib_export->aas.AAS_TraceAreas( VMA(1), VMA(2), VMA(3), VMA(4), args[5] ); - - case BOTLIB_AAS_POINT_CONTENTS: - return botlib_export->aas.AAS_PointContents( VMA(1) ); - case BOTLIB_AAS_NEXT_BSP_ENTITY: - return botlib_export->aas.AAS_NextBSPEntity( args[1] ); - case BOTLIB_AAS_VALUE_FOR_BSP_EPAIR_KEY: - return botlib_export->aas.AAS_ValueForBSPEpairKey( args[1], VMA(2), VMA(3), args[4] ); - case BOTLIB_AAS_VECTOR_FOR_BSP_EPAIR_KEY: - return botlib_export->aas.AAS_VectorForBSPEpairKey( args[1], VMA(2), VMA(3) ); - case BOTLIB_AAS_FLOAT_FOR_BSP_EPAIR_KEY: - return botlib_export->aas.AAS_FloatForBSPEpairKey( args[1], VMA(2), VMA(3) ); - case BOTLIB_AAS_INT_FOR_BSP_EPAIR_KEY: - return botlib_export->aas.AAS_IntForBSPEpairKey( args[1], VMA(2), VMA(3) ); - - case BOTLIB_AAS_AREA_REACHABILITY: - return botlib_export->aas.AAS_AreaReachability( args[1] ); - - case BOTLIB_AAS_AREA_TRAVEL_TIME_TO_GOAL_AREA: - return botlib_export->aas.AAS_AreaTravelTimeToGoalArea( args[1], VMA(2), args[3], args[4] ); - case BOTLIB_AAS_ENABLE_ROUTING_AREA: - return botlib_export->aas.AAS_EnableRoutingArea( args[1], args[2] ); - case BOTLIB_AAS_PREDICT_ROUTE: - return botlib_export->aas.AAS_PredictRoute( VMA(1), args[2], VMA(3), args[4], args[5], args[6], args[7], args[8], args[9], args[10], args[11] ); - - case BOTLIB_AAS_SWIMMING: - return botlib_export->aas.AAS_Swimming( VMA(1) ); - case BOTLIB_AAS_PREDICT_CLIENT_MOVEMENT: - return botlib_export->aas.AAS_PredictClientMovement( VMA(1), args[2], VMA(3), args[4], args[5], - VMA(6), VMA(7), args[8], args[9], VMF(10), args[11], args[12], args[13] ); - - case BOTLIB_EA_SAY: - botlib_export->ea.EA_Say( args[1], VMA(2) ); - return 0; - case BOTLIB_EA_SAY_TEAM: - botlib_export->ea.EA_SayTeam( args[1], VMA(2) ); - return 0; - case BOTLIB_EA_COMMAND: - botlib_export->ea.EA_Command( args[1], VMA(2) ); - return 0; - - case BOTLIB_EA_ACTION: - botlib_export->ea.EA_Action( args[1], args[2] ); - break; - case BOTLIB_EA_GESTURE: - botlib_export->ea.EA_Gesture( args[1] ); - return 0; - case BOTLIB_EA_TALK: - botlib_export->ea.EA_Talk( args[1] ); - return 0; - case BOTLIB_EA_ATTACK: - botlib_export->ea.EA_Attack( args[1] ); - return 0; - case BOTLIB_EA_USE: - botlib_export->ea.EA_Use( args[1] ); - return 0; - case BOTLIB_EA_RESPAWN: - botlib_export->ea.EA_Respawn( args[1] ); - return 0; - case BOTLIB_EA_CROUCH: - botlib_export->ea.EA_Crouch( args[1] ); - return 0; - case BOTLIB_EA_MOVE_UP: - botlib_export->ea.EA_MoveUp( args[1] ); - return 0; - case BOTLIB_EA_MOVE_DOWN: - botlib_export->ea.EA_MoveDown( args[1] ); - return 0; - case BOTLIB_EA_MOVE_FORWARD: - botlib_export->ea.EA_MoveForward( args[1] ); - return 0; - case BOTLIB_EA_MOVE_BACK: - botlib_export->ea.EA_MoveBack( args[1] ); - return 0; - case BOTLIB_EA_MOVE_LEFT: - botlib_export->ea.EA_MoveLeft( args[1] ); - return 0; - case BOTLIB_EA_MOVE_RIGHT: - botlib_export->ea.EA_MoveRight( args[1] ); - return 0; - - case BOTLIB_EA_SELECT_WEAPON: - botlib_export->ea.EA_SelectWeapon( args[1], args[2] ); - return 0; - case BOTLIB_EA_JUMP: - botlib_export->ea.EA_Jump( args[1] ); - return 0; - case BOTLIB_EA_DELAYED_JUMP: - botlib_export->ea.EA_DelayedJump( args[1] ); - return 0; - case BOTLIB_EA_MOVE: - botlib_export->ea.EA_Move( args[1], VMA(2), VMF(3) ); - return 0; - case BOTLIB_EA_VIEW: - botlib_export->ea.EA_View( args[1], VMA(2) ); - return 0; - - case BOTLIB_EA_END_REGULAR: - botlib_export->ea.EA_EndRegular( args[1], VMF(2) ); - return 0; - case BOTLIB_EA_GET_INPUT: - botlib_export->ea.EA_GetInput( args[1], VMF(2), VMA(3) ); - return 0; - case BOTLIB_EA_RESET_INPUT: - botlib_export->ea.EA_ResetInput( args[1] ); - return 0; - - case BOTLIB_AI_LOAD_CHARACTER: - return botlib_export->ai.BotLoadCharacter( VMA(1), VMF(2) ); - case BOTLIB_AI_FREE_CHARACTER: - botlib_export->ai.BotFreeCharacter( args[1] ); - return 0; - case BOTLIB_AI_CHARACTERISTIC_FLOAT: - return FloatAsInt( botlib_export->ai.Characteristic_Float( args[1], args[2] ) ); - case BOTLIB_AI_CHARACTERISTIC_BFLOAT: - return FloatAsInt( botlib_export->ai.Characteristic_BFloat( args[1], args[2], VMF(3), VMF(4) ) ); - case BOTLIB_AI_CHARACTERISTIC_INTEGER: - return botlib_export->ai.Characteristic_Integer( args[1], args[2] ); - case BOTLIB_AI_CHARACTERISTIC_BINTEGER: - return botlib_export->ai.Characteristic_BInteger( args[1], args[2], args[3], args[4] ); - case BOTLIB_AI_CHARACTERISTIC_STRING: - botlib_export->ai.Characteristic_String( args[1], args[2], VMA(3), args[4] ); - return 0; + //==================================== - case BOTLIB_AI_ALLOC_CHAT_STATE: - return botlib_export->ai.BotAllocChatState(); - case BOTLIB_AI_FREE_CHAT_STATE: - botlib_export->ai.BotFreeChatState( args[1] ); - return 0; - case BOTLIB_AI_QUEUE_CONSOLE_MESSAGE: - botlib_export->ai.BotQueueConsoleMessage( args[1], args[2], VMA(3) ); - return 0; - case BOTLIB_AI_REMOVE_CONSOLE_MESSAGE: - botlib_export->ai.BotRemoveConsoleMessage( args[1], args[2] ); - return 0; - case BOTLIB_AI_NEXT_CONSOLE_MESSAGE: - return botlib_export->ai.BotNextConsoleMessage( args[1], VMA(2) ); - case BOTLIB_AI_NUM_CONSOLE_MESSAGE: - return botlib_export->ai.BotNumConsoleMessages( args[1] ); - case BOTLIB_AI_INITIAL_CHAT: - botlib_export->ai.BotInitialChat( args[1], VMA(2), args[3], VMA(4), VMA(5), VMA(6), VMA(7), VMA(8), VMA(9), VMA(10), VMA(11) ); - return 0; - case BOTLIB_AI_NUM_INITIAL_CHATS: - return botlib_export->ai.BotNumInitialChats( args[1], VMA(2) ); - case BOTLIB_AI_REPLY_CHAT: - return botlib_export->ai.BotReplyChat( args[1], VMA(2), args[3], args[4], VMA(5), VMA(6), VMA(7), VMA(8), VMA(9), VMA(10), VMA(11), VMA(12) ); - case BOTLIB_AI_CHAT_LENGTH: - return botlib_export->ai.BotChatLength( args[1] ); - case BOTLIB_AI_ENTER_CHAT: - botlib_export->ai.BotEnterChat( args[1], args[2], args[3] ); - return 0; - case BOTLIB_AI_GET_CHAT_MESSAGE: - botlib_export->ai.BotGetChatMessage( args[1], VMA(2), args[3] ); - return 0; - case BOTLIB_AI_STRING_CONTAINS: - return botlib_export->ai.StringContains( VMA(1), VMA(2), args[3] ); - case BOTLIB_AI_FIND_MATCH: - return botlib_export->ai.BotFindMatch( VMA(1), VMA(2), args[3] ); - case BOTLIB_AI_MATCH_VARIABLE: - botlib_export->ai.BotMatchVariable( VMA(1), args[2], VMA(3), args[4] ); - return 0; - case BOTLIB_AI_UNIFY_WHITE_SPACES: - botlib_export->ai.UnifyWhiteSpaces( VMA(1) ); - return 0; - case BOTLIB_AI_REPLACE_SYNONYMS: - botlib_export->ai.BotReplaceSynonyms( VMA(1), args[2] ); - return 0; - case BOTLIB_AI_LOAD_CHAT_FILE: - return botlib_export->ai.BotLoadChatFile( args[1], VMA(2), VMA(3) ); - case BOTLIB_AI_SET_CHAT_GENDER: - botlib_export->ai.BotSetChatGender( args[1], args[2] ); - return 0; - case BOTLIB_AI_SET_CHAT_NAME: - botlib_export->ai.BotSetChatName( args[1], VMA(2), args[3] ); - return 0; - - case BOTLIB_AI_RESET_GOAL_STATE: - botlib_export->ai.BotResetGoalState( args[1] ); - return 0; - case BOTLIB_AI_RESET_AVOID_GOALS: - botlib_export->ai.BotResetAvoidGoals( args[1] ); - return 0; - case BOTLIB_AI_REMOVE_FROM_AVOID_GOALS: - botlib_export->ai.BotRemoveFromAvoidGoals( args[1], args[2] ); - return 0; - case BOTLIB_AI_PUSH_GOAL: - botlib_export->ai.BotPushGoal( args[1], VMA(2) ); - return 0; - case BOTLIB_AI_POP_GOAL: - botlib_export->ai.BotPopGoal( args[1] ); - return 0; - case BOTLIB_AI_EMPTY_GOAL_STACK: - botlib_export->ai.BotEmptyGoalStack( args[1] ); - return 0; - case BOTLIB_AI_DUMP_AVOID_GOALS: - botlib_export->ai.BotDumpAvoidGoals( args[1] ); - return 0; - case BOTLIB_AI_DUMP_GOAL_STACK: - botlib_export->ai.BotDumpGoalStack( args[1] ); - return 0; - case BOTLIB_AI_GOAL_NAME: - botlib_export->ai.BotGoalName( args[1], VMA(2), args[3] ); - return 0; - case BOTLIB_AI_GET_TOP_GOAL: - return botlib_export->ai.BotGetTopGoal( args[1], VMA(2) ); - case BOTLIB_AI_GET_SECOND_GOAL: - return botlib_export->ai.BotGetSecondGoal( args[1], VMA(2) ); - case BOTLIB_AI_CHOOSE_LTG_ITEM: - return botlib_export->ai.BotChooseLTGItem( args[1], VMA(2), VMA(3), args[4] ); - case BOTLIB_AI_CHOOSE_NBG_ITEM: - return botlib_export->ai.BotChooseNBGItem( args[1], VMA(2), VMA(3), args[4], VMA(5), VMF(6) ); - case BOTLIB_AI_TOUCHING_GOAL: - return botlib_export->ai.BotTouchingGoal( VMA(1), VMA(2) ); - case BOTLIB_AI_ITEM_GOAL_IN_VIS_BUT_NOT_VISIBLE: - return botlib_export->ai.BotItemGoalInVisButNotVisible( args[1], VMA(2), VMA(3), VMA(4) ); - case BOTLIB_AI_GET_LEVEL_ITEM_GOAL: - return botlib_export->ai.BotGetLevelItemGoal( args[1], VMA(2), VMA(3) ); - case BOTLIB_AI_GET_NEXT_CAMP_SPOT_GOAL: - return botlib_export->ai.BotGetNextCampSpotGoal( args[1], VMA(2) ); - case BOTLIB_AI_GET_MAP_LOCATION_GOAL: - return botlib_export->ai.BotGetMapLocationGoal( VMA(1), VMA(2) ); - case BOTLIB_AI_AVOID_GOAL_TIME: - return FloatAsInt( botlib_export->ai.BotAvoidGoalTime( args[1], args[2] ) ); - case BOTLIB_AI_SET_AVOID_GOAL_TIME: - botlib_export->ai.BotSetAvoidGoalTime( args[1], args[2], VMF(3)); - return 0; - case BOTLIB_AI_INIT_LEVEL_ITEMS: - botlib_export->ai.BotInitLevelItems(); - return 0; - case BOTLIB_AI_UPDATE_ENTITY_ITEMS: - botlib_export->ai.BotUpdateEntityItems(); - return 0; - case BOTLIB_AI_LOAD_ITEM_WEIGHTS: - return botlib_export->ai.BotLoadItemWeights( args[1], VMA(2) ); - case BOTLIB_AI_FREE_ITEM_WEIGHTS: - botlib_export->ai.BotFreeItemWeights( args[1] ); - return 0; - case BOTLIB_AI_INTERBREED_GOAL_FUZZY_LOGIC: - botlib_export->ai.BotInterbreedGoalFuzzyLogic( args[1], args[2], args[3] ); - return 0; - case BOTLIB_AI_SAVE_GOAL_FUZZY_LOGIC: - botlib_export->ai.BotSaveGoalFuzzyLogic( args[1], VMA(2) ); - return 0; - case BOTLIB_AI_MUTATE_GOAL_FUZZY_LOGIC: - botlib_export->ai.BotMutateGoalFuzzyLogic( args[1], VMF(2) ); - return 0; - case BOTLIB_AI_ALLOC_GOAL_STATE: - return botlib_export->ai.BotAllocGoalState( args[1] ); - case BOTLIB_AI_FREE_GOAL_STATE: - botlib_export->ai.BotFreeGoalState( args[1] ); - return 0; - - case BOTLIB_AI_RESET_MOVE_STATE: - botlib_export->ai.BotResetMoveState( args[1] ); - return 0; - case BOTLIB_AI_ADD_AVOID_SPOT: - botlib_export->ai.BotAddAvoidSpot( args[1], VMA(2), VMF(3), args[4] ); - return 0; - case BOTLIB_AI_MOVE_TO_GOAL: - botlib_export->ai.BotMoveToGoal( VMA(1), args[2], VMA(3), args[4] ); - return 0; - case BOTLIB_AI_MOVE_IN_DIRECTION: - return botlib_export->ai.BotMoveInDirection( args[1], VMA(2), VMF(3), args[4] ); - case BOTLIB_AI_RESET_AVOID_REACH: - botlib_export->ai.BotResetAvoidReach( args[1] ); - return 0; - case BOTLIB_AI_RESET_LAST_AVOID_REACH: - botlib_export->ai.BotResetLastAvoidReach( args[1] ); - return 0; - case BOTLIB_AI_REACHABILITY_AREA: - return botlib_export->ai.BotReachabilityArea( VMA(1), args[2] ); - case BOTLIB_AI_MOVEMENT_VIEW_TARGET: - return botlib_export->ai.BotMovementViewTarget( args[1], VMA(2), args[3], VMF(4), VMA(5) ); - case BOTLIB_AI_PREDICT_VISIBLE_POSITION: - return botlib_export->ai.BotPredictVisiblePosition( VMA(1), args[2], VMA(3), args[4], VMA(5) ); - case BOTLIB_AI_ALLOC_MOVE_STATE: - return botlib_export->ai.BotAllocMoveState(); - case BOTLIB_AI_FREE_MOVE_STATE: - botlib_export->ai.BotFreeMoveState( args[1] ); - return 0; - case BOTLIB_AI_INIT_MOVE_STATE: - botlib_export->ai.BotInitMoveState( args[1], VMA(2) ); - return 0; - - case BOTLIB_AI_CHOOSE_BEST_FIGHT_WEAPON: - return botlib_export->ai.BotChooseBestFightWeapon( args[1], VMA(2) ); - case BOTLIB_AI_GET_WEAPON_INFO: - botlib_export->ai.BotGetWeaponInfo( args[1], args[2], VMA(3) ); - return 0; - case BOTLIB_AI_LOAD_WEAPON_WEIGHTS: - return botlib_export->ai.BotLoadWeaponWeights( args[1], VMA(2) ); - case BOTLIB_AI_ALLOC_WEAPON_STATE: - return botlib_export->ai.BotAllocWeaponState(); - case BOTLIB_AI_FREE_WEAPON_STATE: - botlib_export->ai.BotFreeWeaponState( args[1] ); - return 0; - case BOTLIB_AI_RESET_WEAPON_STATE: - botlib_export->ai.BotResetWeaponState( args[1] ); - return 0; - - case BOTLIB_AI_GENETIC_PARENTS_AND_CHILD_SELECTION: - return botlib_export->ai.GeneticParentsAndChildSelection(args[1], VMA(2), VMA(3), VMA(4), VMA(5)); + case G_PARSE_ADD_GLOBAL_DEFINE: + return Parse_AddGlobalDefine( VMA(1) ); + case G_PARSE_LOAD_SOURCE: + return Parse_LoadSourceHandle( VMA(1) ); + case G_PARSE_FREE_SOURCE: + return Parse_FreeSourceHandle( args[1] ); + case G_PARSE_READ_TOKEN: + return Parse_ReadTokenHandle( args[1], VMA(2) ); + case G_PARSE_SOURCE_FILE_AND_LINE: + return Parse_SourceFileAndLine( args[1], VMA(2), VMA(3) ); case TRAP_MEMSET: Com_Memset( VMA(1), args[2], args[3] ); @@ -939,18 +572,6 @@ Called on a normal map change, not on a map_restart =============== */ void SV_InitGameProgs( void ) { - cvar_t *var; - //FIXME these are temp while I make bots run in vm - extern int bot_enable; - - var = Cvar_Get( "bot_enable", "1", CVAR_LATCH ); - if ( var ) { - bot_enable = var->integer; - } - else { - bot_enable = 0; - } - // load the dll or bytecode gvm = VM_Create( "game", SV_GameSystemCalls, Cvar_VariableValue( "vm_game" ) ); if ( !gvm ) { diff --git a/src/server/sv_init.c b/src/server/sv_init.c index 76cb8297..22f45729 100644 --- a/src/server/sv_init.c +++ b/src/server/sv_init.c @@ -348,7 +348,6 @@ This is NOT called for map_restart void SV_SpawnServer( char *server, qboolean killBots ) { int i; int checksum; - qboolean isBot; char systemInfo[16384]; const char *p; @@ -441,7 +440,6 @@ void SV_SpawnServer( char *server, qboolean killBots ) { for (i = 0;i < 3; i++) { VM_Call (gvm, GAME_RUN_FRAME, sv.time); - SV_BotFrame (sv.time); sv.time += 100; svs.time += 100; } @@ -454,51 +452,22 @@ void SV_SpawnServer( char *server, qboolean killBots ) { if (svs.clients[i].state >= CS_CONNECTED) { char *denied; - if ( svs.clients[i].netchan.remoteAddress.type == NA_BOT ) { - if ( killBots ) { - SV_DropClient( &svs.clients[i], "" ); - continue; - } - isBot = qtrue; - } - else { - isBot = qfalse; - } - // connect the client again - denied = VM_ExplicitArgPtr( gvm, VM_Call( gvm, GAME_CLIENT_CONNECT, i, qfalse, isBot ) ); // firstTime = qfalse + denied = VM_ExplicitArgPtr( gvm, VM_Call( gvm, GAME_CLIENT_CONNECT, i, qfalse ) ); // firstTime = qfalse if ( denied ) { // this generally shouldn't happen, because the client // was connected before the level change SV_DropClient( &svs.clients[i], denied ); } else { - if( !isBot ) { - // when we get the next packet from a connected client, - // the new gamestate will be sent - svs.clients[i].state = CS_CONNECTED; - } - else { - client_t *client; - sharedEntity_t *ent; - - client = &svs.clients[i]; - client->state = CS_ACTIVE; - ent = SV_GentityNum( i ); - ent->s.number = i; - client->gentity = ent; - - client->deltaMessage = -1; - client->nextSnapshotTime = svs.time; // generate a snapshot immediately - - VM_Call( gvm, GAME_CLIENT_BEGIN, i ); - } + // when we get the next packet from a connected client, + // the new gamestate will be sent + svs.clients[i].state = CS_CONNECTED; } } } // run another frame to allow things to look at all the players VM_Call (gvm, GAME_RUN_FRAME, sv.time); - SV_BotFrame (sv.time); sv.time += 100; svs.time += 100; @@ -558,8 +527,6 @@ SV_Init Only called at main exe startup, not for each game =============== */ -void SV_BotInitBotLib(void); - void SV_Init (void) { SV_AddOperatorCommands (); @@ -605,12 +572,6 @@ void SV_Init (void) { sv_mapChecksum = Cvar_Get ("sv_mapChecksum", "", CVAR_ROM); sv_lanForceRate = Cvar_Get ("sv_lanForceRate", "1", CVAR_ARCHIVE ); sv_dequeuePeriod = Cvar_Get ("sv_dequeuePeriod", "500", CVAR_ARCHIVE ); - - // initialize bot cvars so they are listed and can be set before loading the botlib - SV_BotInitCvars(); - - // init the botlib here because we need the pre-compiler in the UI - SV_BotInitBotLib(); } diff --git a/src/server/sv_main.c b/src/server/sv_main.c index 2e3135b6..f4d960d9 100644 --- a/src/server/sv_main.c +++ b/src/server/sv_main.c @@ -104,11 +104,6 @@ int SV_ReplacePendingServerCommands( client_t *client, const char *cmd ) { sscanf(client->reliableCommands[ index ], "cs %i", &csnum2); if ( csnum1 == csnum2 ) { Q_strncpyz( client->reliableCommands[ index ], cmd, sizeof( client->reliableCommands[ index ] ) ); - /* - if ( client->netchan.remoteAddress.type != NA_BOT ) { - Com_Printf( "WARNING: client %i removed double pending config string %i: %s\n", client-svs.clients, csnum1, cmd ); - } - */ return qtrue; } } @@ -660,10 +655,6 @@ void SV_CalcPings( void ) { cl->ping = 999; continue; } - if ( cl->gentity->r.svFlags & SVF_BOT ) { - cl->ping = 0; - continue; - } total = 0; count = 0; @@ -756,7 +747,7 @@ qboolean SV_CheckPaused( void ) { // only pause if there is just a single client connected count = 0; for (i=0,cl=svs.clients ; i < sv_maxclients->integer ; i++,cl++) { - if ( cl->state >= CS_CONNECTED && cl->netchan.remoteAddress.type != NA_BOT ) { + if ( cl->state >= CS_CONNECTED ) { count++; } } @@ -809,8 +800,6 @@ void SV_Frame( int msec ) { sv.timeResidual += msec; - if (!com_dedicated->integer) SV_BotFrame (sv.time + sv.timeResidual); - if ( com_dedicated->integer && sv.timeResidual < frameMsec ) { // NET_Sleep will give the OS time slices until either get a packet // or time enough for a server frame has gone by @@ -859,8 +848,6 @@ void SV_Frame( int msec ) { // update ping based on the all received frames SV_CalcPings(); - if (com_dedicated->integer) SV_BotFrame (sv.time); - // run the game simulation in chunks while ( sv.timeResidual >= frameMsec ) { sv.timeResidual -= frameMsec; diff --git a/src/server/sv_snapshot.c b/src/server/sv_snapshot.c index 26e3d31b..cd295edf 100644 --- a/src/server/sv_snapshot.c +++ b/src/server/sv_snapshot.c @@ -625,12 +625,6 @@ void SV_SendClientSnapshot( client_t *client ) { // build the snapshot SV_BuildClientSnapshot( client ); - // bots need to have their snapshots build, but - // the query them directly without needing to be sent - if ( client->gentity && client->gentity->r.svFlags & SVF_BOT ) { - return; - } - MSG_Init (&msg, msg_buf, sizeof(msg_buf)); msg.allowoverflow = qtrue; |