]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Merge branch 'master' into drjaska/weapontodo drjaska/weapontodo 1118/head
authordrjaska <drjaska83@gmail.com>
Tue, 7 Feb 2023 14:28:21 +0000 (16:28 +0200)
committerdrjaska <drjaska83@gmail.com>
Tue, 7 Feb 2023 14:35:37 +0000 (16:35 +0200)
1  2 
qcsrc/client/hud/panel/ammo.qc
qcsrc/common/mapobjects/trigger/jumppads.qc
qcsrc/common/notifications/all.qh
qcsrc/common/weapons/all.qc
qcsrc/common/weapons/all.qh
qcsrc/common/weapons/weapon.qh
qcsrc/common/weapons/weapon/mortar.qc
qcsrc/server/bot/default/bot.qc
qcsrc/server/chat.qc
qcsrc/server/items/items.qc

Simple merge
index 2df383ce2743292058f0caf10315ea37d15a4e76,9d39c219910f9d6c4fda29544169a7848b7feaa4..42d1867be81af68148d8f090983b388cbea1ae7a
@@@ -632,9 -645,18 +645,9 @@@ string notif_arg_item_wepammo(float f1
  {
        string ammoitems = "";
        Weapon wep = REGISTRY_GET(Weapons, f1);
 -      // TODO: registry handles
 -      switch (wep.ammo_type)
 -      {
 -              case RES_SHELLS:  ammoitems = ITEM_Shells.m_name;      break;
 -              case RES_BULLETS: ammoitems = ITEM_Bullets.m_name;     break;
 -              case RES_ROCKETS: ammoitems = ITEM_Rockets.m_name;     break;
 -              case RES_CELLS:   ammoitems = ITEM_Cells.m_name;       break;
 -              case RES_PLASMA:  ammoitems = ITEM_Plasma.m_name;      break;
 -              case RES_FUEL:    ammoitems = ITEM_JetpackFuel.m_name; break;
 -              default: return ""; // doesn't use ammo
 -      }
 +      if (GETAMMONAME(wep.ammo_type))
 +              ammoitems = GETAMMONAME(wep.ammo_type);
-       return sprintf(_(" with %d %s"), f2, ammoitems);
+       return sprintf(_(" with %d %s"), f2, strtolower(ammoitems));
  }
  
  
index 819d44f08b37ad3503d4042f074d129f8ea41496,effa087e65c57ce2efabc3d2a5d9ad54622d7c74..29e21a762dfa49738ad563a8ac5766e574be0941
@@@ -103,29 -107,20 +103,13 @@@ string W_NameWeaponOrder_MapFunc(strin
        return s;
  }
  
- string W_UndeprecateName(string s)
 -string W_NameWeaponOrder(string order)
--{
-       switch (s)
-       {
-               case "nex": return "vortex";
-               case "rocketlauncher": return "devastator";
-               case "laser": return "blaster";
-               case "minstanex": return "vaporizer";
-               case "grenadelauncher": return "mortar";
-               case "uzi": return "machinegun";
-               case "hmg": return "okhmg";
-               case "rpc": return "okrpc";
-               default: return s;
-       }
 -      return mapPriorityList(order, W_NameWeaponOrder_MapFunc);
--}
 +
  string W_NumberWeaponOrder_MapFunc(string s)
  {
        if (s == "0" || stof(s)) return s;
-       s = W_UndeprecateName(s);
-       FOREACH(Weapons, it != WEP_Null && it.netname == s, return ftos(i));
+       FOREACH(Weapons, it != WEP_Null && (it.netname == s || it.m_deprecated_netname == s), return ftos(i));
        return s;
  }
 -string W_NumberWeaponOrder(string order)
 -{
 -      return mapPriorityList(order, W_NumberWeaponOrder_MapFunc);
 -}
  
  float W_FixWeaponOrder_BuildImpulseList_buf[REGISTRY_MAX(Weapons)];
  string W_FixWeaponOrder_BuildImpulseList_order;
Simple merge
index a771bc9a081e8858118a9f24d432c3393af4e56d,cf0f637f0324d614da2ffe5212cf408a5988f357..06c23d9fbd675bc91b8cffadf23590101e3caaba
@@@ -214,34 -216,22 +216,33 @@@ const int WEP_FLAG_SPECIALATTACK  =  BI
  string weaponorder_byid;
  
  // functions:
- string W_UndeprecateName(string s);
 -string W_FixWeaponOrder(string order, float complete);
 -string W_NameWeaponOrder(string order);
 -string W_NumberWeaponOrder(string order);
 +#define W_FIXWEAPONORDER(order, complete) fixPriorityList(order, WEP_FIRST, WEP_LAST, WEP_IMPULSE_BEGIN - WEP_FIRST, complete)
 +string W_NameWeaponOrder_MapFunc(string s);
 +string W_NumberWeaponOrder_MapFunc(string s);
 +#define W_NAMEWEAPONORDER(order) mapPriorityList(order, W_NameWeaponOrder_MapFunc)
 +#define W_NUMBERWEAPONORDER(order) mapPriorityList(order, W_NumberWeaponOrder_MapFunc)
  string W_FixWeaponOrder_BuildImpulseList(string o);
  string W_FixWeaponOrder_AllowIncomplete(entity this, string order);
 -string W_FixWeaponOrder_ForceComplete(string order);
  WepSet W_RandomWeapons(entity e, WepSet remaining, int n);
 -
 -string GetAmmoPicture(Resource ammotype);
 -
 -string GetAmmoName(Resource ammotype);
 -
 -entity GetAmmoItem(Resource ammotype);
 +#define W_FIXWEAPONORDER_FORCECOMPLETE(order) \
 +      W_FIXWEAPONORDER(((order == "") ? W_NUMBERWEAPONORDER(cvar_defstring("cl_weaponpriority")) : order), 1)
  
  #ifdef CSQC
 -int GetAmmoStat(Resource ammotype);
 +#define GETAMMOTYPEFROMNUM(i) \
 +      i == 0 ? RES_SHELLS : \
 +      i == 1 ? RES_BULLETS : \
 +      i == 2 ? RES_ROCKETS : \
 +      i == 3 ? RES_CELLS : \
 +      i == 4 ? RES_PLASMA : \
 +      i == 5 ? RES_FUEL : RES_NONE
 +
 +#define GETAMMOSTAT(res) \
 +      res == RES_SHELLS ? STAT_SHELLS : \
 +      res == RES_BULLETS ? STAT_NAILS : \
 +      res == RES_ROCKETS ? STAT_ROCKETS : \
 +      res == RES_CELLS ? STAT_CELLS : \
 +      res == RES_PLASMA ? STAT_PLASMA.m_id : \
 +      res == RES_FUEL ? STAT_FUEL.m_id : -1
  #endif
  
  string W_Sound(string w_snd);
Simple merge
Simple merge
Simple merge
index adb11faa35b3096a95d58e1c5d6ccef94ce02ffd,6b653d9c33ebde54776661e4481371a217239eec..877e831da967b21286de4b419168371e1dbefd81
@@@ -826,19 -852,16 +852,16 @@@ float ammo_pickupevalfunc(entity player
        float c = 0;
        float rating = 0;
  
-       // Detect needed ammo
+       // detect needed ammo
        if(item.itemdef.instanceOfWeaponPickup)
        {
-               entity ammo = NULL;
-               if(GetResource(item, RES_SHELLS))       { need_shells  = true; ammo = ITEM_Shells;      }
-               else if(GetResource(item, RES_BULLETS)) { need_nails   = true; ammo = ITEM_Bullets;     }
-               else if(GetResource(item, RES_ROCKETS)) { need_rockets = true; ammo = ITEM_Rockets;     }
-               else if(GetResource(item, RES_CELLS))   { need_cells   = true; ammo = ITEM_Cells;       }
-               else if(GetResource(item, RES_PLASMA))  { need_plasma  = true; ammo = ITEM_Plasma;      }
-               else if(GetResource(item, RES_FUEL))    { need_fuel    = true; ammo = ITEM_JetpackFuel; }
+               entity res = item.itemdef.m_weapon.ammo_type;
 -              entity ammo = (res != RES_NONE) ? GetAmmoItem(res) : NULL;
++              entity ammo = (res != RES_NONE) ? GETAMMOITEM(res) : NULL;
                if(!ammo)
                        return 0;
+               if(res != RES_NONE && GetResource(item, res))
+                       item_resource = res;
                wpn = item;
                rating = ammo.m_botvalue;
        }
@@@ -1289,7 -1294,7 +1295,7 @@@ spawnfunc(target_items
                        {
                                FOREACH(StatusEffect, it.instanceOfBuff,
                                {
-                                       s = Buff_UndeprecateName(s);
 -                                      string s = Buff_CompatName(argv(j));
++                                      s = Buff_CompatName(s);
                                        if(s == it.netname)
                                        {
                                                this.buffdef = it;
                                        }
                                });
                                FOREACH(Weapons, it != WEP_Null, {
-                                       s = W_UndeprecateName(s);
-                                       if(s == it.netname)
 -                                      string s = argv(j);
++                                      s = argv(j);
+                                       if(s == it.netname || s == it.m_deprecated_netname)
                                        {
                                                STAT(WEAPONS, this) |= (it.m_wepset);
                                                if(this.spawnflags == 0 || this.spawnflags == 2)
        n = tokenize_console(this.netname);
        for(int j = 0; j < n; ++j)
        {
 -              string cmd = argv(j);
 -              FOREACH(Weapons, it != WEP_Null && (cmd == it.netname || cmd == it.m_deprecated_netname), {
 +              string s = argv(j);
-               FOREACH(Weapons, it != WEP_Null && W_UndeprecateName(s) == it.netname, {
++              FOREACH(Weapons, it != WEP_Null && (s == it.netname || s == it.m_deprecated_netname), {
                        it.wr_init(it);
                        break;
                });
@@@ -1670,9 -1675,9 +1676,9 @@@ float GiveItems(entity e, float beginar
                                        got += GiveBuff(e, it, op, val);
                                        break;
                                });
-                               FOREACH(Weapons, it != WEP_Null && W_UndeprecateName(cmd) == it.netname, {
+                               FOREACH(Weapons, it != WEP_Null && (cmd == it.netname || cmd == it.m_deprecated_netname), {
 -                    got += GiveWeapon(e, it.m_id, op, val);
 -                    break;
 +                                      got += GiveWeapon(e, it.m_id, op, val);
 +                                      break;
                                });
                                break;
                }