From 2e997854aab821963d76a3d5a986f9cecbfed2e6 Mon Sep 17 00:00:00 2001 From: Rudolf Polzer Date: Thu, 15 Dec 2011 15:43:08 +0100 Subject: [PATCH] make powerups rules game mode dependent --- defaultXonotic.cfg | 3 +- .../dialog_multiplayer_create_mutators.c | 4 +- qcsrc/server/g_world.qc | 4 +- qcsrc/server/t_items.qc | 54 ++++++++++--------- qcsrc/server/teamplay.qc | 4 +- 5 files changed, 40 insertions(+), 29 deletions(-) diff --git a/defaultXonotic.cfg b/defaultXonotic.cfg index af797c1e9..7f0844af8 100644 --- a/defaultXonotic.cfg +++ b/defaultXonotic.cfg @@ -500,7 +500,7 @@ set g_shootfromfixedorigin "" "if set to a string like 0 y z, the gun is moved t set g_pinata 0 "if set to 1 you will not only drop your current weapon when you are killed, but you will drop all weapons that you possessed" set g_weapon_stay 0 "if set to 1 or 2, weapons stay after they were picked up (1: weapons you don't have yet give you ammo of their type and they can not be dropped, 2: weapons don't give ammo, but instead players start with one pickup-load of ammo by default, 3: weapons give ammo, weapons only stay as ammo-less ghosts)" set g_weapon_throwable 1 "if set to 1, weapons can be dropped" -set g_powerups 1 "if set to 0 the strength and shield (invincibility) will not spawn on the map" +set g_powerups -1 "if set to 0 the strength and shield (invincibility) will not spawn on the map, if 1 they will spawn in all game modes, -1 is game mode default" set g_use_ammunition 1 "if set to 0 all weapons have unlimited ammunition" set g_pickup_items 1 "if set to 0 all items (health, armor, ammo, weapons...) are removed from the map" set g_minstagib 0 "enable minstagib" @@ -835,7 +835,6 @@ set g_arena 0 "Arena: many one-on-one rounds are played to find the winner" set g_arena_maxspawned 2 "maximum number of players to spawn at once (the rest is spectating, waiting for their turn)" set g_arena_roundbased 1 "if disabled, the next player will spawn as soon as someone dies" set g_arena_warmup 5 "time, newly spawned players have to prepare themselves in round based matches" -set g_arena_powerups 0 "enables powerups (superhealth, strength and shield), which are removed by default" // ca set g_ca 0 "Clan Arena: Played in rounds, once you're dead you're out! The team with survivors wins the round." diff --git a/qcsrc/menu/xonotic/dialog_multiplayer_create_mutators.c b/qcsrc/menu/xonotic/dialog_multiplayer_create_mutators.c index 7cdbdb8d0..7133eb67f 100644 --- a/qcsrc/menu/xonotic/dialog_multiplayer_create_mutators.c +++ b/qcsrc/menu/xonotic/dialog_multiplayer_create_mutators.c @@ -96,8 +96,10 @@ string XonoticMutatorsDialog_toString(entity me) s = strcat(s, ", ", _("Blood loss")); if(cvar("g_jetpack")) s = strcat(s, ", ", _("Jet pack")); - if(!cvar("g_powerups")) + if(cvar("g_powerups") == 0) s = strcat(s, ", ", _("No powerups")); + if(cvar("g_powerups") > 0) + s = strcat(s, ", ", _("Powerups")); if(s == "") return ZCTX(_("MUT^None")); else diff --git a/qcsrc/server/g_world.qc b/qcsrc/server/g_world.qc index dc8ab56c9..3b6ada702 100644 --- a/qcsrc/server/g_world.qc +++ b/qcsrc/server/g_world.qc @@ -767,8 +767,10 @@ void spawnfunc_worldspawn (void) s = strcat(s, ":minstagib"); // TODO to mutator system - if(!autocvar_g_powerups) + if(autocvar_g_powerups == 0) s = strcat(s, ":no_powerups"); + if(autocvar_g_powerups > 0) + s = strcat(s, ":powerups"); GameLogEcho(s); GameLogEcho(":gameinfo:end"); diff --git a/qcsrc/server/t_items.qc b/qcsrc/server/t_items.qc index eb6331a88..6cf81edca 100644 --- a/qcsrc/server/t_items.qc +++ b/qcsrc/server/t_items.qc @@ -744,21 +744,6 @@ void StartItem (string itemmodel, string pickupsound, float defaultrespawntime, } */ - if(autocvar_spawn_debug >= 2) - { - entity otheritem; - for(otheritem = findradius(self.origin, 3); otheritem; otheritem = otheritem.chain) - { - if(otheritem.is_item) - { - dprint("XXX Found duplicated item: ", itemname, vtos(self.origin)); - dprint(" vs ", otheritem.netname, vtos(otheritem.origin), "\n"); - error("Mapper sucks."); - } - } - self.is_item = TRUE; - } - if(g_lms || g_ca) { startitem_failed = TRUE; @@ -781,13 +766,28 @@ void StartItem (string itemmodel, string pickupsound, float defaultrespawntime, return; } } - else if (!autocvar_g_pickup_items && itemid != IT_STRENGTH && itemid != IT_INVINCIBLE && itemid != IT_HEALTH) + else if (!autocvar_g_pickup_items && itemid != IT_STRENGTH && itemid != IT_INVINCIBLE) { startitem_failed = TRUE; remove (self); return; } + if(autocvar_spawn_debug >= 2) + { + entity otheritem; + for(otheritem = findradius(self.origin, 3); otheritem; otheritem = otheritem.chain) + { + if(otheritem.is_item) + { + dprint("XXX Found duplicated item: ", itemname, vtos(self.origin)); + dprint(" vs ", otheritem.netname, vtos(otheritem.origin), "\n"); + error("Mapper sucks."); + } + } + self.is_item = TRUE; + } + weaponsInMap |= weaponid; precache_model (itemmodel); @@ -1240,11 +1240,20 @@ void spawnfunc_item_health1() { spawnfunc_item_health_small(); } void spawnfunc_item_health25() { spawnfunc_item_health_medium(); } void spawnfunc_item_health100() { spawnfunc_item_health_mega(); } -void spawnfunc_item_strength (void) { - if(!autocvar_g_powerups) - return; +float have_powerups(void) +{ + if(autocvar_g_powerups > 0) + return TRUE; + else if(autocvar_g_powerups == 0) + return FALSE; + else if(g_arena) + return FALSE; + else + return TRUE; +} - if((g_arena || g_ca) && !autocvar_g_arena_powerups) +void spawnfunc_item_strength (void) { + if(!have_powerups()) return; if(g_minstagib) { @@ -1257,10 +1266,7 @@ void spawnfunc_item_strength (void) { } void spawnfunc_item_invincible (void) { - if(!autocvar_g_powerups) - return; - - if((g_arena || g_ca) && !autocvar_g_arena_powerups) + if(!have_powerups()) return; if(g_minstagib) { diff --git a/qcsrc/server/teamplay.qc b/qcsrc/server/teamplay.qc index 5df502525..66e909eec 100644 --- a/qcsrc/server/teamplay.qc +++ b/qcsrc/server/teamplay.qc @@ -478,8 +478,10 @@ string getwelcomemessage(void) modifications = strcat(modifications, ", Blood loss"); if(g_jetpack) modifications = strcat(modifications, ", Jet pack"); - if(!autocvar_g_powerups) + if(autocvar_g_powerups == 0) modifications = strcat(modifications, ", No powerups"); + if(autocvar_g_powerups > 0) + modifications = strcat(modifications, ", Powerups"); modifications = substring(modifications, 2, strlen(modifications) - 2); string versionmessage; -- 2.39.2