AI Scripting quake3 Project Source Code Changes

 

The following source code changes are required in the quake3 project to support AI scripting.

In cl_keys.c about line 24 add :

#include "client.h"

// ai script
extern cvar_t *cl_inCameraMode;
// end ai script

/* key up events are sent even if in console mode */ field_t historyEditLines[COMMAND_HISTORY];

In cl_keys.c in function CL_KeyEvent about line 1106 add :

if ( !( cls.keyCatchers & KEYCATCH_UI ) ) {
if ( cls.state == CA_ACTIVE && !clc.demoplaying ) {
// ai script
if(cl_inCameraMode->integer>0)
{
cl_inCameraMode->integer = 2;
}
else
// end ai script

VM_Call( uivm, UI_SET_ACTIVE_MENU, UIMENU_INGAME );
}
else {
CL_Disconnect_f();

In cl_main.c about line 66 add :

cvar_t	*cl_conXOffset;
cvar_t *cl_inGameVideo;
// ai script
cvar_t *cl_inCameraMode;
// end ai script

cvar_t *cl_serverStatusResendTime;

In cl_main.c in function CL_Init about line 2343 add :

cl_motdString = Cvar_Get( "cl_motdString", "", CVAR_ROM );
// ai script
cl_inCameraMode = Cvar_Get ("cl_inCameraMode", "0", CVAR_USERINFO ); // end ai script

Cvar_Get( "cl_maxPing", "800", CVAR_ARCHIVE );

In common.c between function Com_DPrintf and function Com_Error about line 225 add :

// ai script
void Com_EndGame( void )
{
SV_Shutdown ("Game Finished\n");
CL_Disconnect( qtrue );
CL_FlushMemory( );
longjmp (abortframe, -1);
Com_Shutdown ();
}
// end ai script

In qcommon.h about line 707 add :

char		*CopyString( const char *in );
void Info_Print( const char *s );
// ai script
void Com_EndGame( void );
// end ai script

In sv_game.c in function SV_GameSystemCalls about line 313 add :

case G_ERROR:
Com_Error( ERR_DROP, "%s", VMA(1) );
return 0;
// ai script
case G_ENDGAME:
Com_EndGame();
return 0;
// end ai script

case G_MILLISECONDS:
return Sys_Milliseconds();


This project can not be compiled until the changes to the game and cgame projects are made.

 

Return to Home Page