summaryrefslogtreecommitdiff
path: root/src/server/sv_game.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/server/sv_game.c')
-rw-r--r--src/server/sv_game.c401
1 files changed, 11 insertions, 390 deletions
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 ) {