]> git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Merge branch 'master' into Mario/use1 298/head
authorMario <mario@smbclan.net>
Fri, 29 Apr 2016 01:13:24 +0000 (11:13 +1000)
committerMario <mario@smbclan.net>
Fri, 29 Apr 2016 01:13:24 +0000 (11:13 +1000)
1  2 
qcsrc/common/gamemodes/gamemode/onslaught/onslaught.qc
qcsrc/common/mutators/mutator/nades/nades.qc
qcsrc/common/t_items.qc
qcsrc/common/triggers/trigger/jumppads.qc
qcsrc/common/util.qh
qcsrc/common/weapons/weapon/hagar.qc
qcsrc/server/cl_client.qc
qcsrc/server/miscfunctions.qh
qcsrc/server/mutators/mutator/gamemode_domination.qc

index ec69def5efe71e1a44574230e0d1c4d89273348c,95c789841dfeb9828f280953d458c657fc066962..bb302998f2e9c6c8daeb19e08562987126a11153
@@@ -13,7 -13,7 +13,7 @@@ REGISTER_MUTATOR(ons, false
                ons_Initialize();
  
                ActivateTeamplay();
-               SetLimits(autocvar_g_onslaught_point_limit, -1, -1, -1);
+               SetLimits(autocvar_g_onslaught_point_limit, autocvar_leadlimit_override, autocvar_timelimit_override, -1);
                have_team_spawns = -1; // request team spawns
        }
  
@@@ -546,7 -546,10 +546,7 @@@ void ons_ControlPoint_Icon_Damage(entit
                onslaught_updatelinks();
  
                // Use targets now (somebody make sure this is in the right place..)
 -              setself(this.owner);
 -              activator = this;
 -              WITHSELF(this, SUB_UseTargets());
 -              setself(this);
 +              SUB_UseTargets(this.owner, this, NULL);
  
                this.owner.waslinked = this.owner.islinked;
                if(this.owner.model != "models/onslaught/controlpoint_pad.md3")
@@@ -608,7 -611,10 +608,7 @@@ void ons_ControlPoint_Icon_Think(
                if(!self.owner.islinked)
                        self.owner.team = 0;
  
 -              setself(self.owner);
 -              activator = self;
 -              SUB_UseTargets ();
 -              setself(this);
 +              SUB_UseTargets(self.owner, self, NULL);
  
                self.owner.team = t;
  
@@@ -670,7 -676,10 +670,7 @@@ void ons_ControlPoint_Icon_BuildThink(
                onslaught_updatelinks();
  
                // Use targets now (somebody make sure this is in the right place..)
 -              setself(self.owner);
 -              activator = self;
 -              SUB_UseTargets ();
 -              setself(this);
 +              SUB_UseTargets(self.owner, self, NULL);
  
                self.SendFlags |= CPSF_SETUP;
        }
@@@ -840,7 -849,8 +840,7 @@@ void ons_ControlPoint_Reset(entity this
  
        onslaught_updatelinks();
  
 -      activator = this;
 -      SUB_UseTargets(); // to reset the structures, playerspawns etc.
 +      SUB_UseTargets(this, this, NULL); // to reset the structures, playerspawns etc.
  
        CSQCMODEL_AUTOUPDATE(this);
  }
@@@ -1943,22 -1953,23 +1943,22 @@@ MUTATOR_HOOKFUNCTION(ons, MonsterMove
  
  void ons_MonsterSpawn_Delayed(entity this)
  {
 -      entity e, own = self.owner;
 +      entity own = self.owner;
  
 -      if(!own) { remove(self); return; }
 +      if(!own) { remove(this); return; }
  
        if(own.targetname)
        {
 -              e = find(world, target, own.targetname);
 +              entity e = find(world, target, own.targetname);
                if(e != world)
                {
                        own.team = e.team;
  
 -                      activator = e;
 -                      own.use();
 +                      own.use(own, e, NULL);
                }
        }
  
 -      remove(self);
 +      remove(this);
  }
  
  MUTATOR_HOOKFUNCTION(ons, MonsterSpawn)
  
  void ons_TurretSpawn_Delayed(entity this)
  {
 -      entity e, own = self.owner;
 +      entity own = self.owner;
  
        if(!own) { remove(self); return; }
  
        if(own.targetname)
        {
 -              e = find(world, target, own.targetname);
 +              entity e = find(world, target, own.targetname);
                if(e != world)
                {
                        own.team = e.team;
                        own.active = ACTIVE_NOT;
  
 -                      activator = e;
 -                      own.use();
 +                      own.use(own, e, NULL);
                }
        }
  
index a66597d3d7b70bc63761e9a941ac97b988bb621c,44847f27de94043bdde6e02921a4f3c6c288c81a..cabfd31b816ec03e53e3eae5c8f94e0bf840aa2f
@@@ -4,6 -4,7 +4,7 @@@
  
  #ifdef SVQC
  bool autocvar_g_nades_nade_small;
+ float autocvar_g_nades_spread = 0.04;
  #endif
  
  REGISTER_STAT(NADES_SMALL, int, autocvar_g_nades_nade_small)
@@@ -804,7 -805,7 +805,7 @@@ void nade_damage(entity this, entity in
                this.realowner = attacker;
  
        if(this.health <= 0)
 -              WITHSELF(this, W_PrepareExplosionByDamage(attacker, nade_boom));
 +              W_PrepareExplosionByDamage(this, attacker, nade_boom);
        else
                nade_burn_spawn(this);
  }
@@@ -1068,7 -1069,9 +1069,9 @@@ void nades_CheckThrow(
                        float _force = time - held_nade.nade_time_primed;
                        _force /= autocvar_g_nades_nade_lifetime;
                        _force = autocvar_g_nades_nade_minforce + (_force * (autocvar_g_nades_nade_maxforce - autocvar_g_nades_nade_minforce));
-                       toss_nade(self, true, (v_forward * 0.75 + v_up * 0.2 + v_right * 0.05) * _force, 0);
+                       vector dir = (v_forward * 0.75 + v_up * 0.2 + v_right * 0.05);
+                       dir = W_CalculateSpread(dir, autocvar_g_nades_spread, g_weaponspreadfactor, autocvar_g_projectiles_spread_style);
+                       toss_nade(self, true, dir * _force, 0);
                }
        }
  }
@@@ -1122,7 -1125,9 +1125,9 @@@ CLASS(NadeOffhand, OffhandWeapon
                                float _force = time - held_nade.nade_time_primed;
                                _force /= autocvar_g_nades_nade_lifetime;
                                _force = autocvar_g_nades_nade_minforce + (_force * (autocvar_g_nades_nade_maxforce - autocvar_g_nades_nade_minforce));
-                               toss_nade(player, false, (v_forward * 0.7 + v_up * 0.2 + v_right * 0.1) * _force, 0);
+                               vector dir = (v_forward * 0.7 + v_up * 0.2 + v_right * 0.1);
+                               dir = W_CalculateSpread(dir, autocvar_g_nades_spread, g_weaponspreadfactor, autocvar_g_projectiles_spread_style);
+                               toss_nade(player, false, dir * _force, 0);
                        }
                }
      }
diff --combined qcsrc/common/t_items.qc
index 957a6fcc7ca23b8653eb32bbfed17023e0686152,85ba9f51b3471bac94a42f0d967f1dd7f2e7961b..a3ac40b670010a39cfff08aea30f1c7c826b4037
@@@ -816,7 -816,7 +816,7 @@@ LABEL(pickup
        other.last_pickup = time;
  
        Send_Effect(EFFECT_ITEM_PICKUP, CENTER_OR_VIEWOFS(this), '0 0 0', 1);
-       _sound (other, CH_TRIGGER, (this.item_pickupsound ? this.item_pickupsound : Sound_fixpath(this.item_pickupsound_ent)), VOL_BASE, ATTEN_NORM);
+       _sound (other, (this.itemdef.instanceOfPowerup ? CH_TRIGGER_SINGLE : CH_TRIGGER), (this.item_pickupsound ? this.item_pickupsound : Sound_fixpath(this.item_pickupsound_ent)), VOL_BASE, ATTEN_NORM);
  
        if (this.classname == "droppedweapon")
                remove (this);
@@@ -1421,31 -1421,29 +1421,31 @@@ spawnfunc(item_invincible
  // compatibility:
  spawnfunc(item_quad) { this.classname = "item_strength";spawnfunc_item_strength(this);}
  
 -void target_items_use()
 -{SELFPARAM();
 -      if(activator.classname == "droppedweapon")
 +void target_items_use(entity this, entity actor, entity trigger)
 +{
 +      other = trigger; // TODO
 +
 +      if(actor.classname == "droppedweapon")
        {
                EXACTTRIGGER_TOUCH;
 -              remove(activator);
 +              remove(actor);
                return;
        }
  
 -      if (!IS_PLAYER(activator))
 +      if (!IS_PLAYER(actor))
                return;
 -      if(IS_DEAD(activator))
 +      if(IS_DEAD(actor))
                return;
        EXACTTRIGGER_TOUCH;
  
 -      FOREACH_ENTITY_ENT(enemy, activator,
 +      FOREACH_ENTITY_ENT(enemy, actor,
        {
                if(it.classname == "droppedweapon")
                        remove(it);
        });
  
 -      if(GiveItems(activator, 0, tokenize_console(self.netname)))
 -              centerprint(activator, self.message);
 +      if(GiveItems(actor, 0, tokenize_console(this.netname)))
 +              centerprint(actor, this.message);
  }
  
  spawnfunc(target_items)
index e52e7c2f92af4f24078712daac2ec27c41531035,8d08e968bdff08d9b419f8fef259df3d9035c840..44413a9c4b9171f8182c0cf8a04f9de0b08e8e24
@@@ -3,12 -3,12 +3,12 @@@
  #include "jumppads.qh"
  #include <common/physics/movetypes/movetypes.qh>
  
 -void trigger_push_use()
 -{SELFPARAM();
 +void trigger_push_use(entity this, entity actor, entity trigger)
 +{
        if(teamplay)
        {
 -              self.team = activator.team;
 -              self.SendFlags |= 2;
 +              this.team = actor.team;
 +              this.SendFlags |= 2;
        }
  }
  #endif
@@@ -235,7 -235,10 +235,7 @@@ void trigger_push_touch(
        }
  
        if(this.enemy.target)
 -      {
 -              activator = other;
 -              WITHSELF(this.enemy, SUB_UseTargets());
 -      }
 +              SUB_UseTargets(this.enemy, other, other); // TODO: do we need other as trigger too?
  
        if (other.flags & FL_PROJECTILE)
        {
@@@ -437,8 -440,6 +437,6 @@@ spawnfunc(target_position) { target_pus
  
  NET_HANDLE(ENT_CLIENT_TRIGGER_PUSH, bool isnew)
  {
-       make_pure(this);
        this.classname = "jumppad";
        int mytm = ReadByte(); if(mytm) { this.team = mytm - 1; }
        this.spawnflags = ReadInt24_t();
diff --combined qcsrc/common/util.qh
index ef36eb230d9bf39ed31ecf848625492a2663f339,de2c32513b064f3c9e73dc116a7b75eea3b4e865..066033a175a1791a2ce05326b223de57db40d4ae
@@@ -2,7 -2,6 +2,7 @@@
  #define COMMON_UTIL_H
  
  #ifndef MENUQC
 +
  vector real_origin(entity ent);
  #endif
  
@@@ -28,8 -27,8 +28,8 @@@ void depthfirst(entity start, .entity u
  float median(float a, float b, float c);
  
  // converts a number to a string with the indicated number of decimals
- // works for up to 10 decimals!
  string ftos_decimals(float number, float decimals);
+ string ftos_mindecimals(float number);
  
  bool fexists(string f);
  
@@@ -274,10 -273,6 +274,6 @@@ string CCR(string input)
  vector animfixfps(entity e, vector a, vector b);
  #endif
  
- #ifdef SVQC
- void dedicated_print(string input);
- #endif
  #ifndef MENUQC
  const float CNT_NORMAL = 1;
  const float CNT_GAMESTART = 2;
index 2e648f780e0bb7d400b5972477186bf023381f32,d1ce0578bd91e2db18eaa520b8ce2065ad917987..4b0367fb5e6478079b1fc6ddc91c9f5467821105
@@@ -71,11 -71,6 +71,11 @@@ void W_Hagar_Explode(
        remove(self);
  }
  
 +void W_Hagar_Explode_use(entity this, entity actor, entity trigger)
 +{
 +      WITHSELF(this, W_Hagar_Explode());
 +}
 +
  void W_Hagar_Explode2()
  {SELFPARAM();
        self.event_damage = func_null;
        remove(self);
  }
  
 +void W_Hagar_Explode2_use(entity this, entity actor, entity trigger)
 +{
 +      WITHSELF(this, W_Hagar_Explode2());
 +}
 +
  void W_Hagar_Damage(entity this, entity inflictor, entity attacker, float damage, int deathtype, vector hitloc, vector force)
  {
        if(this.health <= 0)
        this.angles = vectoangles(this.velocity);
  
        if(this.health <= 0)
 -              WITHSELF(this, W_PrepareExplosionByDamage(attacker, this.think));
 +              W_PrepareExplosionByDamage(this, attacker, this.think);
  }
  
  void W_Hagar_Touch()
  {SELFPARAM();
        PROJECTILE_TOUCH;
 -      self.use();
 +      this.use(this, NULL, NULL);
  }
  
  void W_Hagar_Touch2()
        PROJECTILE_TOUCH;
  
        if(self.cnt > 0 || other.takedamage == DAMAGE_AIM) {
 -              self.use();
 +              this.use(this, NULL, NULL);
        } else {
                self.cnt++;
                Send_Effect(EFFECT_HAGAR_BOUNCE, self.origin, self.velocity, 1);
@@@ -156,7 -146,7 +156,7 @@@ void W_Hagar_Attack(Weapon thiswep
        missile.damagedbycontents = true;
  
        missile.touch = W_Hagar_Touch;
 -      missile.use = W_Hagar_Explode;
 +      missile.use = W_Hagar_Explode_use;
        missile.think = adaptor_think2use_hittype_splash;
        missile.nextthink = time + WEP_CVAR_PRI(hagar, lifetime);
        PROJECTILE_MAKETRIGGER(missile);
@@@ -199,7 -189,7 +199,7 @@@ void W_Hagar_Attack2(Weapon thiswep
  
        missile.touch = W_Hagar_Touch2;
        missile.cnt = 0;
 -      missile.use = W_Hagar_Explode2;
 +      missile.use = W_Hagar_Explode2_use;
        missile.think = adaptor_think2use_hittype_splash;
        missile.nextthink = time + WEP_CVAR_SEC(hagar, lifetime_min) + random() * WEP_CVAR_SEC(hagar, lifetime_rand);
        PROJECTILE_MAKETRIGGER(missile);
@@@ -257,7 -247,7 +257,7 @@@ void W_Hagar_Attack2_Load_Release(.enti
                missile.damagedbycontents = true;
  
                missile.touch = W_Hagar_Touch; // not bouncy
 -              missile.use = W_Hagar_Explode2;
 +              missile.use = W_Hagar_Explode2_use;
                missile.think = adaptor_think2use_hittype_splash;
                missile.nextthink = time + WEP_CVAR_SEC(hagar, lifetime_min) + random() * WEP_CVAR_SEC(hagar, lifetime_rand);
                PROJECTILE_MAKETRIGGER(missile);
@@@ -407,6 -397,36 +407,36 @@@ void W_Hagar_Attack2_Load(Weapon thiswe
        }
  }
  
+ void W_Hagar_Attack_Auto(Weapon thiswep, entity actor, .entity weaponentity, int fire)
+ {
+       if(!(fire & 1) || actor.hagar_load || actor.hagar_loadblock)
+       {
+               w_ready(thiswep, actor, weaponentity, fire);
+               return;
+       }
+       if(!thiswep.wr_checkammo1(thiswep))
+       if(!(actor.items & IT_UNLIMITED_WEAPON_AMMO))
+       {
+               W_SwitchWeapon_Force(actor, w_getbestweapon(actor));
+               w_ready(thiswep, actor, weaponentity, fire);
+               return;
+       }
+       W_Hagar_Attack(thiswep);
+       int slot = weaponslot(weaponentity);
+       ATTACK_FINISHED(actor, slot) = time + WEP_CVAR_PRI(hagar, refire) * W_WeaponRateFactor();
+       int theframe = WFRAME_FIRE1;
+       entity this = actor.(weaponentity);
+       if(this)
+       {
+               if(this.wframe == WFRAME_FIRE1)
+                       theframe = WFRAME_DONTCHANGE;
+       }
+       weapon_thinkf(actor, weaponentity, theframe, WEP_CVAR_PRI(hagar, refire), W_Hagar_Attack_Auto);
+ }
  METHOD(Hagar, wr_aim, void(entity thiswep))
  {
      SELFPARAM();
@@@ -424,14 -444,12 +454,12 @@@ METHOD(Hagar, wr_think, void(entity thi
          W_Hagar_Attack2_Load(thiswep, weaponentity); // must always run each frame
      if(autocvar_g_balance_hagar_reload_ammo && actor.clip_load < min(WEP_CVAR_PRI(hagar, ammo), WEP_CVAR_SEC(hagar, ammo))) { // forced reload
          thiswep.wr_reload(thiswep, actor, weaponentity);
-     } else if((fire & 1) && !actor.hagar_load && !actor.hagar_loadblock) // not while secondary is loaded or awaiting reset
-     {
-         if(weapon_prepareattack(thiswep, actor, weaponentity, false, WEP_CVAR_PRI(hagar, refire)))
-         {
-             W_Hagar_Attack(thiswep);
-             weapon_thinkf(actor, weaponentity, WFRAME_FIRE1, WEP_CVAR_PRI(hagar, refire), w_ready);
-         }
      }
+     else if((fire & 1) && !actor.hagar_load && !actor.hagar_loadblock) // not while secondary is loaded or awaiting reset
+       {
+               if(weapon_prepareattack(thiswep, actor, weaponentity, false, 0))
+                       W_Hagar_Attack_Auto(thiswep, actor, weaponentity, fire);
+       }
      else if((fire & 2) && !loadable_secondary && WEP_CVAR(hagar, secondary))
      {
          if(weapon_prepareattack(thiswep, actor, weaponentity, true, WEP_CVAR_SEC(hagar, refire)))
index e859f6f328044a7db81a1dd4866dffb023f4318f,ffbb55087bef4ac48a98e36c8d9402fc9c7eb64c..c157530fa7d39b9cbbb1e7597ce03aba5db0aa58
@@@ -371,6 -371,19 +371,19 @@@ void FixPlayermodel(entity player
                        defaultmodel = substring(defaultmodel, 0, i);
                }
        }
+       if(autocvar_sv_defaultcharacterskin && !defaultskin)
+       {
+               if(teamplay)
+               {
+                       string s = Static_Team_ColorName_Lower(player.team);
+                       if (s != "neutral")
+                               defaultskin = cvar(strcat("sv_defaultplayerskin_", s));
+               }
+               if(!defaultskin)
+                       defaultskin = autocvar_sv_defaultplayerskin;
+       }
        MUTATOR_CALLHOOK(FixPlayermodel, defaultmodel, defaultskin);
        defaultmodel = ret_string;
        defaultskin = ret_int;
                        chmdl = true;
                }
  
-               oldskin = player.skin;
-               player.skin = stof(player.playerskin);
+               if(!autocvar_sv_defaultcharacterskin)
+               {
+                       oldskin = player.skin;
+                       player.skin = stof(player.playerskin);
+               }
+               else
+               {
+                       oldskin = player.skin;
+                       player.skin = defaultskin;
+               }
        }
  
        if(chmdl || oldskin != player.skin) // model or skin has changed
@@@ -569,7 -590,8 +590,8 @@@ void PutClientInServer(
                this.oldorigin = this.origin;
                this.prevorigin = this.origin;
                this.lastteleporttime = time; // prevent insane speeds due to changing origin
-         this.hud = HUD_NORMAL;
+               this.conveyor = NULL; // prevent conveyors at the previous location from moving a freshly spawned player
+               this.hud = HUD_NORMAL;
  
                this.event_damage = PlayerDamage;
  
                {
                        string s = spot.target;
                        spot.target = string_null;
 -                      WITH(entity, activator, this, LAMBDA(
 -                              WITHSELF(spot, SUB_UseTargets())
 -                      ));
 +                      SUB_UseTargets(spot, this, NULL);
                        spot.target = s;
                }
  
index 71e24f5134d0ebb1e29b7a1aaf8ec94c16ed7e45,634d3fb647185594e04001b18c1b1790ecf17942..2e947f29db24ca9bae03343c332df2c69c97a2a2
@@@ -116,8 -116,6 +116,8 @@@ void WarpZone_crosshair_trace(entity pl
  
  void WarpZone_traceline_antilag (entity source, vector v1, vector v2, float nomonst, entity forent, float lag);
  
 +void adaptor_think2use();
 +
  #define IS_DEAD(s) ((s).deadflag != DEAD_NO)
  
  
@@@ -264,8 -262,6 +264,6 @@@ void readlevelcvars(
  
        warmup_stage = cvar("g_warmup");
        warmup_limit = cvar("g_warmup_limit");
-       if(warmup_limit == 0)
-               warmup_limit = (autocvar_timelimit > 0) ? autocvar_timelimit * 60 : autocvar_timelimit;
        g_warmup_allguns = cvar("g_warmup_allguns");
        g_warmup_allow_timeout = cvar("g_warmup_allow_timeout");
  
index 18ca2f9dc4dcdec7220c03728a0e378d0f2d99bd,3a32c203140d754cc97eed98aefd38f1af99600d..141837c260071c9e71f3ce928fb1a10d82a98b10
@@@ -22,7 -22,7 +22,7 @@@ REGISTER_MUTATOR(dom, false
                        fraglimit_override = autocvar_g_domination_roundbased_point_limit;
  
                ActivateTeamplay();
-               SetLimits(fraglimit_override, autocvar_g_domination_point_leadlimit, -1, -1);
+               SetLimits(fraglimit_override, autocvar_g_domination_point_leadlimit, autocvar_timelimit_override, -1);
                have_team_spawns = -1; // request team spawns
        }
  
@@@ -150,7 -150,8 +150,7 @@@ void dompoint_captured (
        old_team = self.team;
        self.team = real_team;
        self.delay = 0;
 -      activator = self;
 -      SUB_UseTargets ();
 +      SUB_UseTargets (self, self, NULL);
        self.delay = old_delay;
        self.team = old_team;