Added the use command

This commit is contained in:
Richard Allen 2002-03-31 23:41:45 +00:00
parent 53dcd07b69
commit 6021992791
4 changed files with 102 additions and 1 deletions

View File

@ -5,6 +5,9 @@
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// //
// $Log$ // $Log$
// Revision 1.41 2002/03/31 23:41:45 jbravo
// Added the use command
//
// Revision 1.40 2002/03/31 17:41:03 makro // Revision 1.40 2002/03/31 17:41:03 makro
// Changed IR vision to be more like AQ2 // Changed IR vision to be more like AQ2
// //
@ -955,6 +958,7 @@ void CG_InitConsoleCommands( void ) {
trap_AddCommand ("irvision"); trap_AddCommand ("irvision");
// JBravo: adding choose and drop commands. // JBravo: adding choose and drop commands.
trap_AddCommand ("choose"); trap_AddCommand ("choose");
trap_AddCommand ("use");
trap_AddCommand ("drop"); trap_AddCommand ("drop");
// JBravo: for zcam // JBravo: for zcam
trap_AddCommand ("camera"); trap_AddCommand ("camera");

View File

@ -5,6 +5,9 @@
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// //
// $Log$ // $Log$
// Revision 1.87 2002/03/31 23:41:45 jbravo
// Added the use command
//
// Revision 1.86 2002/03/31 03:31:24 jbravo // Revision 1.86 2002/03/31 03:31:24 jbravo
// Compiler warning cleanups // Compiler warning cleanups
// //
@ -2950,6 +2953,8 @@ void ClientCommand( int clientNum ) {
RQ3_Cmd_Choose_f (ent); RQ3_Cmd_Choose_f (ent);
else if (Q_stricmp (cmd, "drop") == 0) else if (Q_stricmp (cmd, "drop") == 0)
RQ3_Cmd_Drop_f (ent); RQ3_Cmd_Drop_f (ent);
else if (Q_stricmp (cmd, "use") == 0)
RQ3_Cmd_Use_f (ent);
// JBravo: adding radio // JBravo: adding radio
else if (Q_stricmp (cmd, "radiogender") == 0) else if (Q_stricmp (cmd, "radiogender") == 0)
RQ3_Cmd_Radiogender_f (ent); RQ3_Cmd_Radiogender_f (ent);

View File

@ -5,6 +5,9 @@
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// //
// $Log$ // $Log$
// Revision 1.51 2002/03/31 23:41:45 jbravo
// Added the use command
//
// Revision 1.50 2002/03/31 18:36:27 jbravo // Revision 1.50 2002/03/31 18:36:27 jbravo
// Added $T (Near by teammates) // Added $T (Near by teammates)
// //
@ -648,7 +651,6 @@ void SpawnPlayers()
/* Let the player Choose the weapon and/or item he wants */ /* Let the player Choose the weapon and/or item he wants */
void RQ3_Cmd_Choose_f( gentity_t *ent ) void RQ3_Cmd_Choose_f( gentity_t *ent )
{ {
// char cmd[MAX_STRING_CHARS];
char *cmd; char *cmd;
if ( !ent->client ) { if ( !ent->client ) {
@ -1415,3 +1417,89 @@ void RQ3_SpectatorMode(gentity_t *ent)
va("print \"\n" S_COLOR_MAGENTA "Spectator Mode-" S_COLOR_YELLOW"%s\n", va("print \"\n" S_COLOR_MAGENTA "Spectator Mode-" S_COLOR_YELLOW"%s\n",
(ent->client->sess.spectatorState == SPECTATOR_FREE)? "FREE":"FOLLOW")); (ent->client->sess.spectatorState == SPECTATOR_FREE)? "FREE":"FOLLOW"));
} }
void RQ3_Cmd_Use_f(gentity_t *ent)
{
char *cmd, buf[128];
int weapon;
if (!ent->client) {
return; // not fully in game yet
}
cmd = ConcatArgs(1);
weapon = WP_NONE;
if (Q_stricmp (cmd, RQ3_MP5_NAME) == 0 || Q_stricmp (cmd, "mp5") == 0) {
if ((ent->client->ps.stats[STAT_WEAPONS] & (1 << WP_MP5) ) == (1 << WP_MP5)) {
weapon = WP_MP5;
} else {
trap_SendServerCommand(ent-g_entities, va("print \"Out of item: %s\n\"", RQ3_MP5_NAME));
return;
}
} else if (Q_stricmp (cmd, RQ3_M3_NAME) == 0 || Q_stricmp (cmd, "m3") == 0) {
if ((ent->client->ps.stats[STAT_WEAPONS] & (1 << WP_M3) ) == (1 << WP_M3)) {
weapon = WP_M3;
} else {
trap_SendServerCommand(ent-g_entities, va("print \"Out of item: %s\n\"", RQ3_M3_NAME));
return;
}
} else if (Q_stricmp (cmd, RQ3_M4_NAME) == 0 || Q_stricmp (cmd, "m4") == 0) {
if ((ent->client->ps.stats[STAT_WEAPONS] & (1 << WP_M4) ) == (1 << WP_M4)) {
weapon = WP_M4;
} else {
trap_SendServerCommand(ent-g_entities, va("print \"Out of item: %s\n\"", RQ3_M4_NAME));
return;
}
} else if (Q_stricmp (cmd, RQ3_HANDCANNON_NAME) == 0 || Q_stricmp (cmd, "hc") == 0) {
if ((ent->client->ps.stats[STAT_WEAPONS] & (1 << WP_HANDCANNON) ) == (1 << WP_HANDCANNON)) {
weapon = WP_HANDCANNON;
} else {
trap_SendServerCommand(ent-g_entities, va("print \"Out of item: %s\n\"", RQ3_HANDCANNON_NAME));
return;
}
} else if (Q_stricmp (cmd, RQ3_SSG3000_NAME) == 0 || Q_stricmp (cmd, "sniper") == 0) {
if ((ent->client->ps.stats[STAT_WEAPONS] & (1 << WP_SSG3000) ) == (1 << WP_SSG3000)) {
weapon = WP_SSG3000;
} else {
trap_SendServerCommand(ent-g_entities, va("print \"Out of item: %s\n\"", RQ3_SSG3000_NAME));
return;
}
} else if (Q_stricmp (cmd, RQ3_AKIMBO_NAME) == 0 || Q_stricmp (cmd, "akimbo") == 0) {
if ((ent->client->ps.stats[STAT_WEAPONS] & (1 << WP_AKIMBO) ) == (1 << WP_AKIMBO)) {
weapon = WP_AKIMBO;
} else {
trap_SendServerCommand(ent-g_entities, va("print \"Out of item: %s\n\"", RQ3_AKIMBO_NAME));
return;
}
} else if (Q_stricmp (cmd, RQ3_PISTOL_NAME) == 0 || Q_stricmp (cmd, "pistol") == 0) {
if ((ent->client->ps.stats[STAT_WEAPONS] & (1 << WP_PISTOL) ) == (1 << WP_PISTOL)) {
weapon = WP_PISTOL;
} else {
trap_SendServerCommand(ent-g_entities, va("print \"Out of item: %s\n\"", RQ3_AKIMBO_NAME));
return;
}
} else if (Q_stricmp (cmd, "throwing combat knife") == 0) {
if ((ent->client->ps.stats[STAT_WEAPONS] & (1 << WP_KNIFE) ) == (1 << WP_KNIFE)) {
weapon = WP_KNIFE;
ent->client->ps.persistant[PERS_WEAPONMODES] &= ~RQ3_KNIFEMODE;
} else {
trap_SendServerCommand(ent-g_entities, va("print \"Out of item: %s\n\"", RQ3_KNIFE_NAME));
return;
}
} else if (Q_stricmp (cmd, "slashing combat knife") == 0) {
if ((ent->client->ps.stats[STAT_WEAPONS] & (1 << WP_KNIFE) ) == (1 << WP_KNIFE)) {
weapon = WP_KNIFE;
ent->client->ps.persistant[PERS_WEAPONMODES] |= RQ3_KNIFEMODE;
} else {
trap_SendServerCommand(ent-g_entities, va("print \"Out of item: %s\n\"", RQ3_KNIFE_NAME));
return;
}
}
if (weapon == WP_NONE) {
trap_SendServerCommand(ent-g_entities, va("print \"Unknown item: %s\n\"", cmd));
return;
}
Com_sprintf (buf, sizeof(buf), "weapon %d\n", weapon);
trap_SendConsoleCommand(EXEC_APPEND, buf);
}

View File

@ -5,6 +5,9 @@
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// //
// $Log$ // $Log$
// Revision 1.8 2002/03/31 23:41:45 jbravo
// Added the use command
//
// Revision 1.7 2002/03/30 02:29:43 jbravo // Revision 1.7 2002/03/30 02:29:43 jbravo
// Lots of spectator code updates. Removed debugshit, added some color. // Lots of spectator code updates. Removed debugshit, added some color.
// //
@ -49,6 +52,7 @@ void CleanLevel();
void CheckForUnevenTeams(gentity_t *player); void CheckForUnevenTeams(gentity_t *player);
void EquipPlayer (gentity_t *ent); void EquipPlayer (gentity_t *ent);
void RQ3_Cmd_Choose_f(gentity_t *ent); void RQ3_Cmd_Choose_f(gentity_t *ent);
void RQ3_Cmd_Use_f(gentity_t *ent);
void RQ3_Cmd_Drop_f( gentity_t *ent ); void RQ3_Cmd_Drop_f( gentity_t *ent );
void UnstickPlayer( gentity_t *ent ); void UnstickPlayer( gentity_t *ent );
void MakeSpectator( gentity_t *ent ); void MakeSpectator( gentity_t *ent );