|
Quake Style - Quake 3 Tutorials New Game Styles - Banning items and setting starting weapons I think the title sums it up! |
// banned weapons/items/ammo/runes extern vmCvar_t weapflags; extern vmCvar_t banned_items; extern vmCvar_t ammoflags; extern vmCvar_t runeflags; // starting weapons extern vmCvar_t start_weapons;
// banned weapons/items/ammo/runes vmCvar_t weapflags; vmCvar_t banned_items; vmCvar_t ammoflags; vmCvar_t runeflags; // starting weapons vmCvar_t start_weapons;
// banned weapons/items/ammo/runes
{ &weapflags, "weapflags", "0", 0, 0, qfalse },
{ &banned_items, "banned_items", "0", 0, 0, qfalse },
{ &ammoflags, "ammoflags", "0", 0, 0, qfalse },
{ &runeflags, "runeflags", "0", 0, 0, qfalse },
// starting weapons
{ &start_weapons, "start_weapons", "2", 0, 0, qfalse }, // force start with machinegun!
{ &g_allowVote, "g_allowVote", "1", 0, 0, qfalse }
if (weapflags.integer)
{
if ((((int)(weapflags.integer) & 1) && (Q_stricmp(ent->classname, "weapon_gauntlet")==0)) ||
(((int)(weapflags.integer) & 2) && (Q_stricmp(ent->classname, "weapon_shotgun")==0)) ||
(((int)(weapflags.integer) & 4) && (Q_stricmp(ent->classname, "weapon_grenadelauncher")==0)) ||
(((int)(weapflags.integer) & 8) && (Q_stricmp(ent->classname, "weapon_rocketlauncher")==0)) ||
(((int)(weapflags.integer) & 16) && (Q_stricmp(ent->classname, "weapon_lightning")==0)) ||
(((int)(weapflags.integer) & 32) && (Q_stricmp(ent->classname, "weapon_railgun")==0)) ||
(((int)(weapflags.integer) & 64) && (Q_stricmp(ent->classname, "weapon_plasmagun")==0)) ||
(((int)(weapflags.integer) & 128) && (Q_stricmp(ent->classname, "weapon_bfg")==0)))
return qfalse;
}
if (banned_items.integer)
{
if ((((int)(banned_items.integer) & 1) && (Q_stricmp(ent->classname, "item_armor_shard")==0)) ||
(((int)(banned_items.integer) & 2) && (Q_stricmp(ent->classname, "item_armor_combat")==0)) ||
(((int)(banned_items.integer) & 4) && (Q_stricmp(ent->classname, "item_armor_body")==0)) ||
(((int)(banned_items.integer) & 8) && (Q_stricmp(ent->classname, "item_health_small")==0)) ||
(((int)(banned_items.integer) & 16) && (Q_stricmp(ent->classname, "item_health")==0)) ||
(((int)(banned_items.integer) & 32) && (Q_stricmp(ent->classname, "item_health_large")==0)) ||
(((int)(banned_items.integer) & 64) && (Q_stricmp(ent->classname, "item_health_mega")==0)) ||
(((int)(banned_items.integer) & 128) && (Q_stricmp(ent->classname, "holdable_teleporter")==0)) ||
(((int)(banned_items.integer) & 256) && (Q_stricmp(ent->classname, "holdable_medkit")==0)) ||
(((int)(banned_items.integer) & 512) && (Q_stricmp(ent->classname, "item_quad")==0)) ||
(((int)(banned_items.integer) & 1024) && (Q_stricmp(ent->classname, "item_enviro")==0)))
return qfalse;
}
if (ammoflags.integer)
{
if ((((int)(ammoflags.integer) & 1) && (Q_stricmp(ent->classname, "ammo_shells")==0)) ||
(((int)(ammoflags.integer) & 2) && (Q_stricmp(ent->classname, "ammo_bullets")==0)) ||
(((int)(ammoflags.integer) & 4) && (Q_stricmp(ent->classname, "ammo_grenades")==0)) ||
(((int)(ammoflags.integer) & 8) && (Q_stricmp(ent->classname, "ammo_cells")==0)) ||
(((int)(ammoflags.integer) & 16) && (Q_stricmp(ent->classname, "ammo_lightning")==0)) ||
(((int)(ammoflags.integer) & 32) && (Q_stricmp(ent->classname, "ammo_rockets")==0)) ||
(((int)(ammoflags.integer) & 64) && (Q_stricmp(ent->classname, "ammo_bfg")==0)))
return qfalse;
}
if (runeflags.integer)
{
if ((((int)(runeflags.integer) & 1) && (Q_stricmp(ent->classname, "item_haste")==0)) ||
(((int)(runeflags.integer) & 2) && (Q_stricmp(ent->classname, "item_invis")==0)) ||
(((int)(runeflags.integer) & 4) && (Q_stricmp(ent->classname, "item_regen")==0)) ||
(((int)(runeflags.integer) & 8) && (Q_stricmp(ent->classname, "item_flight")==0)))
return qfalse;
}
// Starting Weapons
void CheckStartItems(gentity_t *ent)
{
gclient_t *client;
client = ent->client;
if ((int)(start_weapons.integer) & 1)
{
client->ps.stats[STAT_WEAPONS] |= ( 1 << WP_SHOTGUN );
client->ps.ammo[WP_SHOTGUN] = 10;
}
if ((int)(start_weapons.integer) & 2)
{
client->ps.stats[STAT_WEAPONS] |= ( 1 << WP_MACHINEGUN );
if ( g_gametype.integer == GT_TEAM )
client->ps.ammo[WP_MACHINEGUN] = 50;
else
client->ps.ammo[WP_MACHINEGUN] = 100;
}
if ((int)(start_weapons.integer) & 4)
{
client->ps.stats[STAT_WEAPONS] |= ( 1 << WP_GRENADE_LAUNCHER );
client->ps.ammo[WP_GRENADE_LAUNCHER] = 5;
}
if ((int)(start_weapons.integer) & 8)
{
client->ps.stats[STAT_WEAPONS] |= ( 1 << WP_ROCKET_LAUNCHER );
client->ps.ammo[WP_ROCKET_LAUNCHER] = 5;
}
if ((int)(start_weapons.integer) & 16)
{
client->ps.stats[STAT_WEAPONS] |= ( 1 << WP_LIGHTNING );
client->ps.ammo[WP_LIGHTNING] = 60;
}
if ((int)(start_weapons.integer) & 32)
{
client->ps.stats[STAT_WEAPONS] |= ( 1 << WP_RAILGUN );
client->ps.ammo[WP_RAILGUN] = 10;
}
if ((int)(start_weapons.integer) & 64)
{
client->ps.stats[STAT_WEAPONS] |= ( 1 << WP_PLASMAGUN );
client->ps.ammo[WP_PLASMAGUN] = 30;
}
if ((int)(start_weapons.integer) & 128)
{
client->ps.stats[STAT_WEAPONS] |= ( 1 << WP_BFG );
client->ps.ammo[WP_BFG] = 15;
}
}
client->ps.stats[STAT_WEAPONS] = ( 1 << WP_MACHINEGUN );
if ( g_gametype.integer == GT_TEAM ) {
client->ps.ammo[WP_MACHINEGUN] = 50;
} else {
client->ps.ammo[WP_MACHINEGUN] = 100;
}
CheckStartItems(ent);