Bot stuff. Added a server command that prints a line to a client

and everyone who is spectating him
This commit is contained in:
Andrei Drexler 2002-05-31 18:17:10 +00:00
parent 91aee071e5
commit abdf718672
4 changed files with 61 additions and 72 deletions

View file

@ -5,6 +5,10 @@
//-----------------------------------------------------------------------------
//
// $Log$
// Revision 1.39 2002/05/31 18:17:10 makro
// Bot stuff. Added a server command that prints a line to a client
// and everyone who is spectating him
//
// Revision 1.38 2002/05/30 21:18:28 makro
// Bots should reload/bandage when roaming around
// Added "pathtarget" key to all the entities
@ -164,6 +168,7 @@
void Cmd_Bandage (gentity_t *ent);
void G_Say( gentity_t *ent, gentity_t *target, int mode, const char *chatText );
gentity_t *SelectRandomDeathmatchSpawnPoint( void );
void Cmd_New_Weapon(gentity_t *ent);
// from aasfile.h
#define AREACONTENTS_MOVER 1024
@ -441,7 +446,9 @@ void RQ3_Bot_SetWeaponMode(bot_state_t *bs, int weapon, int mode) {
//use the weapon command "press" times
for (i = 0; i < press; i++) {
Cmd_Weapon( &g_entities[bs->entitynum] );
//changed it to use Slicer's new command
//Cmd_Weapon( &g_entities[bs->entitynum] );
Cmd_New_Weapon( &g_entities[bs->entitynum] );
}
}

View file

@ -5,6 +5,10 @@
//-----------------------------------------------------------------------------
//
// $Log$
// Revision 1.114 2002/05/31 18:17:10 makro
// Bot stuff. Added a server command that prints a line to a client
// and everyone who is spectating him
//
// Revision 1.113 2002/05/21 04:58:28 blaze
// kicked the reload bugs ass!
//
@ -2465,7 +2469,7 @@ void Cmd_Weapon(gentity_t *ent)
if(ent->client->ps.weaponstate == WEAPON_BANDAGING) {
if(!ent->client->weapon_after_bandage_warned) {
ent->client->weapon_after_bandage_warned = qtrue;
trap_SendServerCommand( ent-g_entities, va("print \"You'll get to your weapon when you are finished bandaging!\n\""));
G_SendClientSpec( ent, va("print \"You'll get to your weapon when you are finished bandaging!\n\""));
}
ent->client->weapon_attempts++;
return;
@ -2525,12 +2529,12 @@ void Cmd_Weapon(gentity_t *ent)
{
ent->client->ps.persistant[PERS_WEAPONMODES] &= ~RQ3_MK23MODE;
trap_SendServerCommand( ent-g_entities, va("print \"Switched to full automatic.\n\""));
G_SendClientSpec( ent, va("print \"Switched to full automatic.\n\""));
}
else
{
ent->client->ps.persistant[PERS_WEAPONMODES] |= RQ3_MK23MODE;
trap_SendServerCommand( ent-g_entities, va("print \"Switched to semi-automatic.\n\""));
G_SendClientSpec( ent, va("print \"Switched to semi-automatic.\n\""));
}
G_Sound(ent, CHAN_ITEM, G_SoundIndex("sound/misc/click.wav"));
break;
@ -2539,12 +2543,12 @@ void Cmd_Weapon(gentity_t *ent)
if ((ent->client->ps.persistant[PERS_WEAPONMODES] & RQ3_M4MODE) == RQ3_M4MODE)
{
ent->client->ps.persistant[PERS_WEAPONMODES] &= ~RQ3_M4MODE;
trap_SendServerCommand( ent-g_entities, va("print \"Switched to full automatic.\n\""));
G_SendClientSpec( ent, va("print \"Switched to full automatic.\n\""));
}
else
{
ent->client->ps.persistant[PERS_WEAPONMODES] |= RQ3_M4MODE;
trap_SendServerCommand( ent-g_entities, va("print \"Switched to 3 round burst.\n\""));
G_SendClientSpec( ent, va("print \"Switched to 3 round burst.\n\""));
}
G_Sound(ent, CHAN_ITEM, G_SoundIndex("sound/misc/click.wav"));
break;
@ -2553,12 +2557,12 @@ void Cmd_Weapon(gentity_t *ent)
if ((ent->client->ps.persistant[PERS_WEAPONMODES] & RQ3_MP5MODE) == RQ3_MP5MODE)
{
ent->client->ps.persistant[PERS_WEAPONMODES] &= ~RQ3_MP5MODE;
trap_SendServerCommand( ent-g_entities, va("print \"Switched to full automatic.\n\""));
G_SendClientSpec( ent, va("print \"Switched to full automatic.\n\""));
}
else
{
ent->client->ps.persistant[PERS_WEAPONMODES] |= RQ3_MP5MODE;
trap_SendServerCommand( ent-g_entities, va("print \"Switched to 3 round burst.\n\""));
G_SendClientSpec( ent, va("print \"Switched to 3 round burst.\n\""));
}
G_Sound(ent, CHAN_ITEM, G_SoundIndex("sound/misc/click.wav"));
break;
@ -2571,7 +2575,7 @@ void Cmd_Weapon(gentity_t *ent)
{
//Elder: added
ent->client->ps.persistant[PERS_WEAPONMODES] &= ~RQ3_KNIFEMODE;
trap_SendServerCommand( ent-g_entities, va("print \"Switched to throwing.\n\""));
G_SendClientSpec( ent, va("print \"Switched to throwing.\n\""));
// Niceass: Animations added
ent->client->ps.weaponstate = WEAPON_MODECHANGE;
ent->client->ps.weaponTime = 550;
@ -2581,7 +2585,7 @@ void Cmd_Weapon(gentity_t *ent)
{
//Elder: we're gonna use this to flag throw or slash with the knife
ent->client->ps.persistant[PERS_WEAPONMODES] |= RQ3_KNIFEMODE;
trap_SendServerCommand( ent-g_entities, va("print \"Switched to slashing.\n\""));
G_SendClientSpec( ent, va("print \"Switched to slashing.\n\""));
// Niceass: Animations added
ent->client->ps.weaponstate = WEAPON_MODECHANGE;
ent->client->ps.weaponTime = 550;
@ -2610,19 +2614,19 @@ void Cmd_Weapon(gentity_t *ent)
{//Going into Short
ent->client->ps.persistant[PERS_WEAPONMODES] |= RQ3_GRENSHORT; //Set the short flag
ent->client->ps.persistant[PERS_WEAPONMODES] &= ~RQ3_GRENMED; //unset the med flag
trap_SendServerCommand( ent-g_entities, va("print \"Grenade set for short range throw.\n\""));
G_SendClientSpec(ent, va("print \"Grenade set for short range throw.\n\""));
}
else if ( (ent->client->ps.persistant[PERS_WEAPONMODES] & RQ3_GRENSHORT) == RQ3_GRENSHORT)
{//Going into Med
ent->client->ps.persistant[PERS_WEAPONMODES] &= ~RQ3_GRENSHORT; //unset the short flag
ent->client->ps.persistant[PERS_WEAPONMODES] |= RQ3_GRENMED; //Set the med flag
trap_SendServerCommand( ent-g_entities, va("print \"Grenade set for medium range throw.\n\""));
G_SendClientSpec(ent, va("print \"Grenade set for medium range throw.\n\""));
}
else if ( (ent->client->ps.persistant[PERS_WEAPONMODES] & RQ3_GRENMED) == RQ3_GRENMED)
{//Going into Long
ent->client->ps.persistant[PERS_WEAPONMODES] |= RQ3_GRENSHORT; //Set the short flag
ent->client->ps.persistant[PERS_WEAPONMODES] |= RQ3_GRENMED; //Set the med flag
trap_SendServerCommand( ent-g_entities, va("print \"Grenade set for long range throw.\n\""));
G_SendClientSpec(ent, va("print \"Grenade set for long range throw.\n\""));
}
//Elder: added
else {
@ -2639,7 +2643,8 @@ void Cmd_Weapon(gentity_t *ent)
default:
break;
}
//Makro - changed all the trap_SendServerCommand prints to G_SendClientSpec prints
//so that players spectating this client get his messages, too
}
//Slicer
void Cmd_New_Weapon(gentity_t *ent) {
@ -3113,3 +3118,32 @@ int RQ3_ValidateSay ( gentity_t *ent )
return SAY_OK;
}
//Makro - this function sends print commands to the client and the ones spectating him
void G_SendClientSpec( gentity_t *ent, const char *msg )
{
int i;
if (!ent) return;
if (!ent->client) return;
trap_SendServerCommand( ent-g_entities, msg );
for (i = 0; i < level.maxclients; i++) {
gclient_t *follower = &level.clients[i];
//no need to send the message twice
if (i == ent-g_entities)
continue;
if (follower->pers.connected != CON_CONNECTED)
continue;
if (follower->sess.sessionTeam != TEAM_SPECTATOR)
continue;
if (follower->sess.spectatorState != SPECTATOR_FOLLOW)
continue;
//gotcha !
if (follower->sess.spectatorClient == ent-g_entities)
trap_SendServerCommand( i, msg );
}
}

View file

@ -5,6 +5,10 @@
//-----------------------------------------------------------------------------
//
// $Log$
// Revision 1.86 2002/05/31 18:17:10 makro
// Bot stuff. Added a server command that prints a line to a client
// and everyone who is spectating him
//
// Revision 1.85 2002/05/31 17:32:11 jbravo
// HC gibs almost working :)
//
@ -771,7 +775,8 @@ void Laser_Think( gentity_t *self );
int RQ3_ValidateSay ( gentity_t *ent );
//Elder: commented out for Homer
//void toggleSemi(gentity_t *ent);
//Makro - sends a command to a client and all the ones spectating him
void G_SendClientSpec( gentity_t *ent, const char *msg );
//
// g_items.c
//

View file

@ -6,63 +6,6 @@
--------------------Configuration: game - Win32 Release--------------------
</h3>
<h3>Command Lines</h3>
Creating temporary file "D:\DOCUME~1\Andrei\LOCALS~1\Temp\RSP189.tmp" with contents
[
/nologo /G6 /ML /W4 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /FR"c:\reactionoutput/" /Fp"c:\reactionoutput/game.pch" /YX /Fo"c:\reactionoutput/" /Fd"c:\reactionoutput/" /FD /c
"C:\Games\Quake3\rq3source\reaction\game\ai_dmnet.c"
"C:\Games\Quake3\rq3source\reaction\game\ai_dmq3.c"
]
Creating command line "cl.exe @D:\DOCUME~1\Andrei\LOCALS~1\Temp\RSP189.tmp"
Creating temporary file "D:\DOCUME~1\Andrei\LOCALS~1\Temp\RSP18A.tmp" with contents
[
kernel32.lib user32.lib winmm.lib /nologo /base:"0x20000000" /subsystem:windows /dll /incremental:no /pdb:"c:\reactionoutput/qagamex86.pdb" /map:"c:\reactionoutput/qagamex86.map" /machine:I386 /def:".\game.def" /out:"..\Release/qagamex86.dll" /implib:"c:\reactionoutput/qagamex86.lib"
\reactionoutput\ai_chat.obj
\reactionoutput\ai_cmd.obj
\reactionoutput\ai_dmnet.obj
\reactionoutput\ai_dmq3.obj
\reactionoutput\ai_main.obj
\reactionoutput\ai_team.obj
\reactionoutput\ai_vcmd.obj
\reactionoutput\bg_misc.obj
\reactionoutput\bg_pmove.obj
\reactionoutput\bg_slidemove.obj
\reactionoutput\g_active.obj
\reactionoutput\g_arenas.obj
\reactionoutput\g_bot.obj
\reactionoutput\g_client.obj
\reactionoutput\g_cmds.obj
\reactionoutput\g_combat.obj
\reactionoutput\g_fileio.obj
\reactionoutput\g_items.obj
\reactionoutput\g_main.obj
\reactionoutput\g_matchmode.obj
\reactionoutput\g_mem.obj
\reactionoutput\g_misc.obj
\reactionoutput\g_missile.obj
\reactionoutput\g_mover.obj
\reactionoutput\g_session.obj
\reactionoutput\g_spawn.obj
\reactionoutput\g_svcmds.obj
\reactionoutput\g_syscalls.obj
\reactionoutput\g_target.obj
\reactionoutput\g_team.obj
\reactionoutput\g_teamplay.obj
\reactionoutput\g_trigger.obj
\reactionoutput\g_utils.obj
\reactionoutput\g_weapon.obj
\reactionoutput\q_math.obj
\reactionoutput\q_shared.obj
\reactionoutput\rxn_game.obj
\reactionoutput\zcam.obj
\reactionoutput\zcam_target.obj
]
Creating command line "link.exe @D:\DOCUME~1\Andrei\LOCALS~1\Temp\RSP18A.tmp"
<h3>Output Window</h3>
Compiling...
ai_dmnet.c
ai_dmq3.c
Linking...
Creating library c:\reactionoutput/qagamex86.lib and object c:\reactionoutput/qagamex86.exp