moved "give all" into items trigger code, so an items trigger can also cause it
authordiv0 <div0@f962a42d-fe04-0410-a3ab-8c8b0445ebaa>
Mon, 25 Jan 2010 17:10:19 +0000 (17:10 +0000)
committerdiv0 <div0@f962a42d-fe04-0410-a3ab-8c8b0445ebaa>
Mon, 25 Jan 2010 17:10:19 +0000 (17:10 +0000)
git-svn-id: svn://svn.icculus.org/nexuiz/trunk@8566 f962a42d-fe04-0410-a3ab-8c8b0445ebaa

data/qcsrc/server/cheats.qc
data/qcsrc/server/t_items.qc

index 69c713f..0f94c1f 100644 (file)
@@ -61,9 +61,11 @@ float CheatsAllowed(float i, float argc, float fr) // the cheat gets passed as a
        cheating = 0
 #define DID_CHEAT() \
        ++cheating
+#define ADD_CHEATS(e,n) \
+       cheatcount_total += n; \
+       e.cheatcount += n
 #define END_CHEAT_FUNCTION() \
-       cheatcount_total += cheating; \
-       self.cheatcount += cheating; \
+       ADD_CHEATS(self,cheating); \
        return cheating
 
 float CheatImpulse(float i)
@@ -243,11 +245,10 @@ float CheatCommand(float argc)
        cmd = argv(0);
        switch(cmd)
        {
-               entity e, wi;
-               float effectnum, f, j;
+               entity e;
+               float effectnum, f;
                vector start, end;
                entity oldself;
-               string s;
 
                case "pointparticles":
                        if(argc == 5)
@@ -614,20 +615,7 @@ float CheatCommand(float argc)
                        }
                        break;
                case "give":
-                       if(argv(1) == "all")
-                       {
-                               s = "jetpack cells shells nails rockets health armor fuel";
-                               for(j = WEP_FIRST; j <= WEP_LAST; ++j)
-                               {
-                                       wi = get_weaponinfo(j);
-                                       if(wi.weapon)
-                                               s = strcat(s, " ", wi.netname);
-                               }
-                               argc = tokenize_console(s);
-                               GiveItems(self, 0, tokenize_console(s));
-                               DID_CHEAT();
-                       }
-                       else if(GiveItems(self, 1, argc))
+                       if(GiveItems(self, 1, argc))
                                DID_CHEAT();
                        break;
        }
index 16ed338..094da9b 100644 (file)
@@ -1653,6 +1653,34 @@ float GiveItems(entity e, float beginarg, float endarg)
                        case "minus":
                                op = OP_MINUS;
                                continue;
+                       case "all":
+                               got += GiveBit(e, items, IT_UNLIMITED_AMMO | IT_JETPACK, op, val, "misc/powerup.wav", "misc/poweroff.wav");
+                               got += GiveValue(e, ammo_cells, op, val, "misc/itempickup.wav", string_null);
+                               got += GiveValue(e, ammo_shells, op, val, "misc/itempickup.wav", string_null);
+                               got += GiveValue(e, ammo_nails, op, val, "misc/itempickup.wav", string_null);
+                               got += GiveValue(e, ammo_rockets, op, val, "misc/itempickup.wav", string_null);
+                               got += GiveValueRot(e, health, pauserothealth_finished, cvar("g_balance_pause_health_rot"), pauseregen_finished, cvar("g_balance_pause_health_regen"), op, val, "misc/megahealth.wav", string_null);
+                               got += GiveValueRot(e, armorvalue, pauserotarmor_finished, cvar("g_balance_pause_armor_rot"), pauseregen_finished, cvar("g_balance_pause_health_regen"), op, val, "misc/armor25.wav", string_null);
+                               got += GiveValueRot(e, ammo_fuel, pauserotfuel_finished, cvar("g_balance_pause_fuel_rot"), pauseregen_finished, cvar("g_balance_pause_fuel_regen"), op, val, "misc/itempickup.wav", string_null);
+                               for(j = WEP_FIRST; j <= WEP_LAST; ++j)
+                               {
+                                       wi = get_weaponinfo(j);
+                                       if(wi.weapons)
+                                       {
+                                               if(e.weapons & wi.weapons)
+                                               {
+                                                       got += GiveBit(e, weapons, wi.weapons, op, val, "weapons/weaponpickup.wav", "");
+                                               }
+                                               else
+                                               {
+                                                       got += GiveBit(e, weapons, wi.weapons, op, val, "weapons/weaponpickup.wav", "");
+                                                       if(e.weapons & wi.weapons)
+                                                               weapon_action(wi.weapon, WR_PRECACHE);
+                                               }
+                                               break;
+                                       }
+                               }
+                               break;
                        case "unlimited_ammo":
                                got += GiveBit(e, items, IT_UNLIMITED_AMMO, op, val, "misc/powerup.wav", "misc/poweroff.wav");
                                break;