From 6ccad3d92adee9b3ce1d51ee8da4b65a62d4f94d Mon Sep 17 00:00:00 2001 From: Richard Allen Date: Sun, 17 Nov 2002 20:14:15 +0000 Subject: [PATCH] Itembanning added --- reaction/ChangeLog | Bin 23578 -> 23794 bytes reaction/game/ai_dmq3.c | 16 +++------ reaction/game/g_client.c | 33 ++++++++++++++---- reaction/game/g_local.h | 12 +++++++ reaction/game/g_main.c | 67 ++++++++++++++++++++++--------------- reaction/game/g_teamplay.c | 51 +++++++++++++++++++++------- 6 files changed, 123 insertions(+), 56 deletions(-) diff --git a/reaction/ChangeLog b/reaction/ChangeLog index 6d99ee89bee3863a4be8548cb33a2098d7205bc1..1b1e6f7fe88c6ada99535c9ecb008144c16d5e05 100644 GIT binary patch delta 162 zcmbQWgYnZ&#t9LVZ?W=-dNPzSq%!0(Brzm1H49N^dV1>C5{Xnrqpz?f%QlRMyU>g#Fc4Px(bAS+}2V#5(gA0Q% USasgynL+ZCZKNeO*363r0Fw$O%m4rY delta 25 hcmeyglX2D##t9LVt@wE+3n=nTR*>P@9Ktv+8UTG52z&ql diff --git a/reaction/game/ai_dmq3.c b/reaction/game/ai_dmq3.c index 5fa41fc7..d665d7c5 100644 --- a/reaction/game/ai_dmq3.c +++ b/reaction/game/ai_dmq3.c @@ -5,6 +5,9 @@ //----------------------------------------------------------------------------- // // $Log$ +// Revision 1.52 2002/11/17 20:14:15 jbravo +// Itembanning added +// // Revision 1.51 2002/09/29 16:06:44 jbravo // Work done at the HPWorld expo // @@ -2710,21 +2713,12 @@ int BotSameTeam(bot_state_t * bs, int entnum) } if (gametype >= GT_TEAM) { //Makro - added teamplay code; changed some stuff - if (gametype != GT_TEAMPLAY) { - trap_GetConfigstring(CS_PLAYERS + bs->client, info1, sizeof(info1)); - trap_GetConfigstring(CS_PLAYERS + entnum, info2, sizeof(info2)); - // - team1 = atoi(Info_ValueForKey(info1, "t")); - team2 = atoi(Info_ValueForKey(info2, "t")); - } else { - team1 = g_entities[bs->client].client->sess.savedTeam; - team2 = g_entities[entnum].client->sess.savedTeam; - } + team1 = g_entities[bs->client].client->sess.savedTeam; + team2 = g_entities[entnum].client->sess.savedTeam; if (team1 == TEAM_SPECTATOR || team2 == TEAM_SPECTATOR) return qfalse; if (team1 == team2) return qtrue; - } return qfalse; } diff --git a/reaction/game/g_client.c b/reaction/game/g_client.c index 4807a33d..82c3be39 100644 --- a/reaction/game/g_client.c +++ b/reaction/game/g_client.c @@ -5,6 +5,9 @@ //----------------------------------------------------------------------------- // // $Log$ +// Revision 1.123 2002/11/17 20:14:15 jbravo +// Itembanning added +// // Revision 1.122 2002/11/13 00:50:38 jbravo // Fixed item dropping, specmode selection on death and helmet probs. // @@ -1486,14 +1489,32 @@ void ClientBegin(int clientNum) // NiceAss: Only set it if there is no value. Fix for going into spectator resetting values. if (ent->r.svFlags & SVF_BOT) { //Makro - changed to m4/laser from pistol/kevlar - if (!client->teamplayWeapon) - client->teamplayWeapon = WP_M4; - if (!client->teamplayItem) + if (!client->teamplayWeapon) { + if ((int) g_RQ3_weaponban.integer & WPF_M4) { + client->teamplayWeapon = WP_M4; + } else if ((int) g_RQ3_weaponban.integer & WPF_MK23) { + client->teamplayWeapon = WP_PISTOL; + } else if ((int) g_RQ3_weaponban.integer & WPF_KNIFE) { + client->teamplayWeapon = WP_KNIFE; + } else { + client->teamplayWeapon = WP_PISTOL; + } + } + if (!client->teamplayItem && ((int) g_RQ3_weaponban.integer & ITF_LASER)) client->teamplayItem = HI_LASER; } else { - if (!client->teamplayWeapon) - client->teamplayWeapon = WP_MP5; - if (!client->teamplayItem) + if (!client->teamplayWeapon) { + if ((int) g_RQ3_weaponban.integer & WPF_MP5) { + client->teamplayWeapon = WP_MP5; + } else if ((int) g_RQ3_weaponban.integer & WPF_MK23) { + client->teamplayWeapon = WP_PISTOL; + } else if ((int) g_RQ3_weaponban.integer & WPF_KNIFE) { + client->teamplayWeapon = WP_KNIFE; + } else { + client->teamplayWeapon = WP_PISTOL; + } + } + if (!client->teamplayItem && ((int) g_RQ3_weaponban.integer & ITF_KEVLAR)) client->teamplayItem = HI_KEVLAR; } i = RQ3TeamCount(-1, client->sess.sessionTeam); diff --git a/reaction/game/g_local.h b/reaction/game/g_local.h index 0239f657..5756b5ff 100644 --- a/reaction/game/g_local.h +++ b/reaction/game/g_local.h @@ -5,6 +5,9 @@ //----------------------------------------------------------------------------- // // $Log$ +// Revision 1.131 2002/11/17 20:14:15 jbravo +// Itembanning added +// // Revision 1.130 2002/10/30 20:04:34 jbravo // Adding helmet // @@ -398,6 +401,14 @@ typedef enum { #define WPF_KNIFE 0x00000080 // 128 #define WPF_GRENADE 0x00000100 // 256 +// JBravo: adding itembanning +#define ITF_SILENCER 0x00000001 // 1 +#define ITF_SLIPPERS 0x00000002 // 2 +#define ITF_BANDOLIER 0x00000004 // 4 +#define ITF_KEVLAR 0x00000008 // 8 +#define ITF_LASER 0x00000010 // 16 +#define ITF_HELMET 0x00000020 // 32 + //============================================================================ typedef struct gentity_s gentity_t; @@ -1390,6 +1401,7 @@ extern vmCvar_t g_RQ3_tkbanrounds; // JBravo: no. of games team killers are bann extern vmCvar_t g_RQ3_ppl_idletime; // JBravo: Seconds Idle before playing an insane sound extern vmCvar_t g_RQ3_idleaction; // JBravo: what to do with Idlers. 0 = sound, 1 = team none, 2 = kick extern vmCvar_t g_RQ3_weaponban; // JBravo: Bitmapped cvar for weaponbanning +extern vmCvar_t g_RQ3_itemban; // JBravo: Bitmapped cvar for itembanning extern vmCvar_t g_RQ3_ctb_respawndelay; // JBravo: delay in seconds for ctb respawns extern vmCvar_t g_RQ3_allWeapons; // JBravo: if set, TP/DM players get all the weapons extern vmCvar_t g_RQ3_allItems; // JBravo: if set, TP/DM players get all the items diff --git a/reaction/game/g_main.c b/reaction/game/g_main.c index 81a29698..9eca4026 100644 --- a/reaction/game/g_main.c +++ b/reaction/game/g_main.c @@ -5,6 +5,9 @@ //----------------------------------------------------------------------------- // // $Log$ +// Revision 1.128 2002/11/17 20:14:15 jbravo +// Itembanning added +// // Revision 1.127 2002/10/31 01:10:07 jbravo // Bumped the version to 2.3 // @@ -463,6 +466,7 @@ vmCvar_t g_RQ3_tkbanrounds; vmCvar_t g_RQ3_ppl_idletime; vmCvar_t g_RQ3_idleaction; vmCvar_t g_RQ3_weaponban; +vmCvar_t g_RQ3_itemban; vmCvar_t g_RQ3_ctb_respawndelay; vmCvar_t g_RQ3_allWeapons; vmCvar_t g_RQ3_allItems; @@ -615,6 +619,7 @@ static cvarTable_t gameCvarTable[] = { {&g_RQ3_haveHelmet, "g_RQ3_haveHelmet", "0", CVAR_ARCHIVE, 0, qtrue}, {&g_RQ3_idleaction, "g_RQ3_idleaction", "0", CVAR_ARCHIVE, 0, qtrue}, {&g_RQ3_weaponban, "g_RQ3_weaponban", "511", CVAR_ARCHIVE, 0, qtrue}, + {&g_RQ3_itemban, "g_RQ3_itemban", "63", CVAR_ARCHIVE, 0, qtrue}, //Blaze: let cvar.cfg be set by the server admins {&g_RQ3_cvarfile, "g_RQ3_cvarfile", "cvar.cfg", CVAR_ARCHIVE, 0, qtrue}, //Slicer: Team Status Cvars for MM @@ -2591,37 +2596,45 @@ void RQ3_StartUniqueItems(void) G_Printf("RQ3_StartUniqueItems: Starting unique item spawn code...\n"); - rq3_item = BG_FindItemForHoldable(HI_SLIPPERS); - rq3_temp = (gentity_t *) SelectRandomDeathmatchSpawnPoint(); - Drop_Item(rq3_temp, rq3_item, angle); - angle += 30; - - rq3_item = BG_FindItemForHoldable(HI_KEVLAR); - rq3_temp = (gentity_t *) SelectRandomDeathmatchSpawnPoint(); - Drop_Item(rq3_temp, rq3_item, angle); - angle += 30; - - rq3_item = BG_FindItemForHoldable(HI_SILENCER); - rq3_temp = (gentity_t *) SelectRandomDeathmatchSpawnPoint(); - Drop_Item(rq3_temp, rq3_item, angle); - angle += 30; - - rq3_item = BG_FindItemForHoldable(HI_BANDOLIER); - rq3_temp = (gentity_t *) SelectRandomDeathmatchSpawnPoint(); - Drop_Item(rq3_temp, rq3_item, angle); - angle += 30; - - rq3_item = BG_FindItemForHoldable(HI_LASER); - rq3_temp = (gentity_t *) SelectRandomDeathmatchSpawnPoint(); - Drop_Item(rq3_temp, rq3_item, angle); - angle += 30; - - if (g_RQ3_haveHelmet.integer) { - rq3_item = BG_FindItemForHoldable(HI_HELMET); + // JBravo: adding itembanning + if ((int) g_RQ3_weaponban.integer & ITF_SLIPPERS) { + rq3_item = BG_FindItemForHoldable(HI_SLIPPERS); rq3_temp = (gentity_t *) SelectRandomDeathmatchSpawnPoint(); Drop_Item(rq3_temp, rq3_item, angle); angle += 30; } + if ((int) g_RQ3_weaponban.integer & ITF_KEVLAR) { + rq3_item = BG_FindItemForHoldable(HI_KEVLAR); + rq3_temp = (gentity_t *) SelectRandomDeathmatchSpawnPoint(); + Drop_Item(rq3_temp, rq3_item, angle); + angle += 30; + } + if ((int) g_RQ3_weaponban.integer & ITF_SILENCER) { + rq3_item = BG_FindItemForHoldable(HI_SILENCER); + rq3_temp = (gentity_t *) SelectRandomDeathmatchSpawnPoint(); + Drop_Item(rq3_temp, rq3_item, angle); + angle += 30; + } + if ((int) g_RQ3_weaponban.integer & ITF_BANDOLIER) { + rq3_item = BG_FindItemForHoldable(HI_BANDOLIER); + rq3_temp = (gentity_t *) SelectRandomDeathmatchSpawnPoint(); + Drop_Item(rq3_temp, rq3_item, angle); + angle += 30; + } + if ((int) g_RQ3_weaponban.integer & ITF_LASER) { + rq3_item = BG_FindItemForHoldable(HI_LASER); + rq3_temp = (gentity_t *) SelectRandomDeathmatchSpawnPoint(); + Drop_Item(rq3_temp, rq3_item, angle); + angle += 30; + } + if (g_RQ3_haveHelmet.integer) { + if ((int) g_RQ3_weaponban.integer & ITF_HELMET) { + rq3_item = BG_FindItemForHoldable(HI_HELMET); + rq3_temp = (gentity_t *) SelectRandomDeathmatchSpawnPoint(); + Drop_Item(rq3_temp, rq3_item, angle); + angle += 30; + } + } } /* diff --git a/reaction/game/g_teamplay.c b/reaction/game/g_teamplay.c index 06724ead..b0dcc78c 100644 --- a/reaction/game/g_teamplay.c +++ b/reaction/game/g_teamplay.c @@ -5,6 +5,9 @@ //----------------------------------------------------------------------------- // // $Log$ +// Revision 1.146 2002/11/17 20:14:15 jbravo +// Itembanning added +// // Revision 1.145 2002/11/13 00:50:38 jbravo // Fixed item dropping, specmode selection on death and helmet probs. // @@ -1096,24 +1099,48 @@ void RQ3_Cmd_Choose_f(gentity_t * ent) trap_SendServerCommand(ent - g_entities, va("print \"%s is disabled on this server.\n\"", RQ3_AKIMBO_NAME)); } } else if (Q_stricmp(cmd, RQ3_KEVLAR_NAME) == 0 || Q_stricmp(cmd, "kevlar") == 0) { - ent->client->teamplayItem = HI_KEVLAR; - trap_SendServerCommand(ent - g_entities, va("print \"Item selected: %s\n\"", RQ3_KEVLAR_NAME)); + if ((int) g_RQ3_weaponban.integer & ITF_KEVLAR) { + ent->client->teamplayItem = HI_KEVLAR; + trap_SendServerCommand(ent - g_entities, va("print \"Item selected: %s\n\"", RQ3_KEVLAR_NAME)); + } else { + trap_SendServerCommand(ent - g_entities, va("print \"%s is disabled on this server.\n\"", RQ3_KEVLAR_NAME)); + } } else if (Q_stricmp(cmd, RQ3_LASER_NAME) == 0 || Q_stricmp(cmd, "laser") == 0) { - ent->client->teamplayItem = HI_LASER; - trap_SendServerCommand(ent - g_entities, va("print \"Item selected: %s\n\"", RQ3_LASER_NAME)); + if ((int) g_RQ3_weaponban.integer & ITF_LASER) { + ent->client->teamplayItem = HI_LASER; + trap_SendServerCommand(ent - g_entities, va("print \"Item selected: %s\n\"", RQ3_LASER_NAME)); + } else { + trap_SendServerCommand(ent - g_entities, va("print \"%s is disabled on this server.\n\"", RQ3_LASER_NAME)); + } } else if (Q_stricmp(cmd, RQ3_SLIPPERS_NAME) == 0 || Q_stricmp(cmd, "slippers") == 0) { - ent->client->teamplayItem = HI_SLIPPERS; - trap_SendServerCommand(ent - g_entities, va("print \"Item selected: %s\n\"", RQ3_SLIPPERS_NAME)); + if ((int) g_RQ3_weaponban.integer & ITF_SLIPPERS) { + ent->client->teamplayItem = HI_SLIPPERS; + trap_SendServerCommand(ent - g_entities, va("print \"Item selected: %s\n\"", RQ3_SLIPPERS_NAME)); + } else { + trap_SendServerCommand(ent - g_entities, va("print \"%s is disabled on this server.\n\"", RQ3_SLIPPERS_NAME)); + } } else if (Q_stricmp(cmd, RQ3_SILENCER_NAME) == 0 || Q_stricmp(cmd, "silencer") == 0) { - ent->client->teamplayItem = HI_SILENCER; - trap_SendServerCommand(ent - g_entities, va("print \"Item selected: %s\n\"", RQ3_SILENCER_NAME)); + if ((int) g_RQ3_weaponban.integer & ITF_SILENCER) { + ent->client->teamplayItem = HI_SILENCER; + trap_SendServerCommand(ent - g_entities, va("print \"Item selected: %s\n\"", RQ3_SILENCER_NAME)); + } else { + trap_SendServerCommand(ent - g_entities, va("print \"%s is disabled on this server.\n\"", RQ3_SILENCER_NAME)); + } } else if (Q_stricmp(cmd, RQ3_BANDOLIER_NAME) == 0 || Q_stricmp(cmd, "bandolier") == 0) { - ent->client->teamplayItem = HI_BANDOLIER; - trap_SendServerCommand(ent - g_entities, va("print \"Item selected: %s\n\"", RQ3_BANDOLIER_NAME)); + if ((int) g_RQ3_weaponban.integer & ITF_BANDOLIER) { + ent->client->teamplayItem = HI_BANDOLIER; + trap_SendServerCommand(ent - g_entities, va("print \"Item selected: %s\n\"", RQ3_BANDOLIER_NAME)); + } else { + trap_SendServerCommand(ent - g_entities, va("print \"%s is disabled on this server.\n\"", RQ3_BANDOLIER_NAME)); + } } else if (Q_stricmp(cmd, RQ3_HELMET_NAME) == 0 || Q_stricmp(cmd, "helmet") == 0) { if (g_RQ3_haveHelmet.integer) { - ent->client->teamplayItem = HI_HELMET; - trap_SendServerCommand(ent - g_entities, va("print \"Item selected: %s\n\"", RQ3_HELMET_NAME)); + if ((int) g_RQ3_weaponban.integer & ITF_HELMET) { + ent->client->teamplayItem = HI_HELMET; + trap_SendServerCommand(ent - g_entities, va("print \"Item selected: %s\n\"", RQ3_HELMET_NAME)); + } else { + trap_SendServerCommand(ent - g_entities, va("print \"%s is disabled on this server.\n\"", RQ3_HELMET_NAME)); + } } else { trap_SendServerCommand(ent - g_entities, va("print \"%s is disabled on this server.\n\"", RQ3_HELMET_NAME)); }