Merge branch 'master' into Mario/wepent_experimental
authorMario <mario@smbclan.net>
Mon, 17 Oct 2016 13:37:30 +0000 (23:37 +1000)
committerMario <mario@smbclan.net>
Mon, 17 Oct 2016 13:37:30 +0000 (23:37 +1000)
1  2 
qcsrc/common/gamemodes/gamemode/nexball/nexball.qc
qcsrc/common/physics/player.qc

index 4fffabdcdedfea21dafa92f6874b0c64944fd88d,c9cfb00f6ed475ed324fdf65813dda0dc2ca0f30..2cad55f166da384fd9c254179b028dc5079530a6
@@@ -34,6 -34,7 +34,7 @@@ float autocvar_g_nexball_football_bounc
  bool autocvar_g_nexball_radar_showallplayers;
  bool autocvar_g_nexball_sound_bounce;
  int autocvar_g_nexball_trail_color;
+ bool autocvar_g_nexball_playerclip_collisions = true;
  
  float autocvar_g_nexball_safepass_turnrate;
  float autocvar_g_nexball_safepass_maxdist;
@@@ -167,7 -168,6 +168,7 @@@ void GiveBall(entity plyr, entity ball
                ball.teamtime = time + autocvar_g_nexball_basketball_delay_hold_forteam;
  
        ball.owner = ball.pusher = plyr; //"owner" is set to the player carrying, "pusher" to the last player who touched it
 +      ball.weaponentity_fld = weaponentity;
        ball.team = plyr.team;
        plyr.ballcarried = ball;
        ball.nb_dropper = plyr;
        }
  
        plyr.(weaponentity).weapons = plyr.weapons;
 -      plyr.(weaponentity).m_switchweapon = PS(plyr).m_weapon;
 +      plyr.m_switchweapon = plyr.(weaponentity).m_weapon;
        plyr.weapons = WEPSET(NEXBALL);
        Weapon w = WEP_NEXBALL;
        w.wr_resetplayer(w, plyr);
 -      PS(plyr).m_switchweapon = WEP_NEXBALL;
 -      W_SwitchWeapon(plyr, WEP_NEXBALL);
 +      plyr.(weaponentity).m_switchweapon = WEP_NEXBALL;
 +      W_SwitchWeapon(plyr, WEP_NEXBALL, weaponentity);
  }
  
  void DropBall(entity ball, vector org, vector vel)
        if(ball.owner.metertime)
        {
                ball.owner.metertime = 0;
 -              .entity weaponentity = weaponentities[0]; // TODO: find ballstealer
 +              .entity weaponentity = ball.weaponentity_fld;
                ball.owner.(weaponentity).state = WS_READY;
        }
  
@@@ -553,6 -553,12 +554,12 @@@ void SpawnBall(entity this
  
        set_movetype(this, MOVETYPE_FLY);
  
+       if(autocvar_g_nexball_playerclip_collisions)
+       {
+               this.dphitcontentsmask = DPCONTENTS_BODY | DPCONTENTS_SOLID | DPCONTENTS_PLAYERCLIP;
+               this.dphitcontentsmask |= DPCONTENTS_PLAYERCLIP;
+       }
        if(!autocvar_g_nexball_sound_bounce)
                this.noise = "";
        else if(this.noise == "")
@@@ -900,19 -906,19 +907,19 @@@ METHOD(BallStealer, wr_think, void(Ball
      }
  }
  
 -METHOD(BallStealer, wr_setup, void(BallStealer this, entity actor))
 +METHOD(BallStealer, wr_setup, void(BallStealer this, entity actor, .entity weaponentity))
  {
      TC(BallStealer, this);
      //weapon_setup(WEP_PORTO.m_id);
  }
  
 -METHOD(BallStealer, wr_checkammo1, bool(BallStealer this, entity actor))
 +METHOD(BallStealer, wr_checkammo1, bool(BallStealer this, entity actor, .entity weaponentity))
  {
      TC(BallStealer, this);
      return true;
  }
  
 -METHOD(BallStealer, wr_checkammo2, bool(BallStealer this, entity actor))
 +METHOD(BallStealer, wr_checkammo2, bool(BallStealer this, entity actor, .entity weaponentity))
  {
      TC(BallStealer, this);
      return true;
@@@ -995,20 -1001,16 +1002,20 @@@ MUTATOR_HOOKFUNCTION(nb, PlayerPreThink
                }
                else
                {
 -                      .entity weaponentity = weaponentities[0]; // TODO
 -                      if(player.(weaponentity).weapons)
 +                      for(int slot = 0; slot < MAX_WEAPONSLOTS; ++slot)
                        {
 -                              player.weapons = player.(weaponentity).weapons;
 -                              Weapon w = WEP_NEXBALL;
 -                              w.wr_resetplayer(w, player);
 -                              PS(player).m_switchweapon = player.(weaponentity).m_switchweapon;
 -                              W_SwitchWeapon(player, PS(player).m_switchweapon);
 +                              .entity weaponentity = weaponentities[slot];
  
 -                              player.(weaponentity).weapons = '0 0 0';
 +                              if(player.(weaponentity).weapons)
 +                              {
 +                                      player.weapons = player.(weaponentity).weapons;
 +                                      Weapon w = WEP_NEXBALL;
 +                                      w.wr_resetplayer(w, player);
 +                                      player.(weaponentity).m_switchweapon = player.m_switchweapon;
 +                                      W_SwitchWeapon(player, player.(weaponentity).m_switchweapon, weaponentity);
 +
 +                                      player.(weaponentity).weapons = '0 0 0';
 +                              }
                        }
                }
  
@@@ -1030,11 -1032,8 +1037,11 @@@ MUTATOR_HOOKFUNCTION(nb, PlayerSpawn
        entity player = M_ARGV(0, entity);
  
        player.metertime = 0;
 -      .entity weaponentity = weaponentities[0];
 -      player.(weaponentity).weapons = '0 0 0';
 +      for(int slot = 0; slot < MAX_WEAPONSLOTS; ++slot)
 +      {
 +              .entity weaponentity = weaponentities[slot];
 +              player.(weaponentity).weapons = '0 0 0';
 +      }
  
        if (nexball_mode & NBM_BASKETBALL)
                player.weapons |= WEPSET(NEXBALL);
@@@ -1060,18 -1059,16 +1067,18 @@@ MUTATOR_HOOKFUNCTION(nb, PlayerPhysics
  
  MUTATOR_HOOKFUNCTION(nb, ForbidThrowCurrentWeapon)
  {
 -      entity player = M_ARGV(0, entity);
 +      //entity player = M_ARGV(0, entity);
 +      entity wepent = M_ARGV(1, entity);
  
 -      return PS(player).m_weapon == WEP_NEXBALL;
 +      return wepent.m_weapon == WEP_NEXBALL;
  }
  
  MUTATOR_HOOKFUNCTION(nb, ForbidDropCurrentWeapon)
  {
 -      entity player = M_ARGV(0, entity);
 +      //entity player = M_ARGV(0, entity);
 +      int wep = M_ARGV(1, int);
  
 -      return PS(player).m_weapon == WEP_MORTAR; // TODO: what is this for?
 +      return wep == WEP_MORTAR.m_id; // TODO: what is this for?
  }
  
  MUTATOR_HOOKFUNCTION(nb, FilterItem)
index fd57e974ac8c242773500ec2edfd835655528adc,b5635e0945e0625dce91d9877bdb67fe7ab32285..76b81266ed95c1cb6caa6caf90eb48abc67c1671
@@@ -96,15 -96,8 +96,15 @@@ void PM_ClientMovement_UpdateStatus(ent
  
        // set crouched
        bool do_crouch = PHYS_INPUT_BUTTON_CROUCH(this);
 -      if(this.hook && !wasfreed(this.hook))
 -              do_crouch = false;
 +      for(int slot = 0; slot < MAX_WEAPONSLOTS; ++slot)
 +      {
 +              entity wep = viewmodels[slot];
 +              if(wep.hook && !wasfreed(wep.hook))
 +              {
 +                      do_crouch = false;
 +                      break; // don't bother checking the others
 +              }
 +      }
        if(this.waterlevel >= WATERLEVEL_SWIMMING)
                do_crouch = false;
        if(hud != HUD_NORMAL)
@@@ -615,12 -608,7 +615,12 @@@ void PM_check_hitground(entity this
      this.wasFlying = false;
      if (this.waterlevel >= WATERLEVEL_SWIMMING) return;
      if (time < this.ladder_time) return;
 -    if (this.hook) return;
 +    for(int slot = 0; slot < MAX_WEAPONSLOTS; ++slot)
 +    {
 +      .entity weaponentity = weaponentities[slot];
 +      if(this.(weaponentity).hook)
 +              return;
 +    }
      this.nextstep = time + 0.3 + random() * 0.1;
      trace_dphitq3surfaceflags = 0;
      tracebox(this.origin, this.mins, this.maxs, this.origin - '0 0 1', MOVE_NOMONSTERS, this);
@@@ -682,8 -670,6 +682,6 @@@ void PM_check_blocked(entity this
  #endif
  }
  
- .vector oldmovement;
  void PM_jetpack(entity this, float maxspd_mod, float dt)
  {
        //makevectors(this.v_angle.y * '0 1 0');