]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Merge remote-tracking branch 'origin/master' into samual/splashing
authorSamual Lenks <samual@xonotic.org>
Sat, 25 Jan 2014 22:12:10 +0000 (17:12 -0500)
committerSamual Lenks <samual@xonotic.org>
Sat, 25 Jan 2014 22:12:10 +0000 (17:12 -0500)
1  2 
qcsrc/client/movetypes.qc

index 6c5d0ebd056ea4c494f425395560078d54d733e4,402e44cac83210d5a10485cfbf47845f9bbde998..2e75a1bf87bd12af2854bc1dd5d0ee0d323cac56
@@@ -10,112 -10,13 +10,112 @@@ void _Movetype_CheckVelocity() // SV_Ch
  {
  }
  
 -float _Movetype_CheckWater() // SV_CheckWater
 +float Mod_Q1BSP_SuperContentsFromNativeContents(float nativecontents)
  {
 -      return FALSE;
 +      switch(nativecontents)
 +      {
 +              case CONTENT_EMPTY:
 +                      return 0;
 +              case CONTENT_SOLID:
 +                      return DPCONTENTS_SOLID | DPCONTENTS_OPAQUE;
 +              case CONTENT_WATER:
 +                      return DPCONTENTS_WATER;
 +              case CONTENT_SLIME:
 +                      return DPCONTENTS_SLIME;
 +              case CONTENT_LAVA:
 +                      return DPCONTENTS_LAVA | DPCONTENTS_NODROP;
 +              case CONTENT_SKY:
 +                      return DPCONTENTS_SKY | DPCONTENTS_NODROP | DPCONTENTS_OPAQUE; // to match behaviour of Q3 maps, let sky count as opaque
 +      }
 +      return 0;
 +}
 +
 +float Mod_Q1BSP_NativeContentsFromSuperContents(float supercontents)
 +{
 +      if(supercontents & (DPCONTENTS_SOLID | DPCONTENTS_BODY))
 +              return CONTENT_SOLID;
 +      if(supercontents & DPCONTENTS_SKY)
 +              return CONTENT_SKY;
 +      if(supercontents & DPCONTENTS_LAVA)
 +              return CONTENT_LAVA;
 +      if(supercontents & DPCONTENTS_SLIME)
 +              return CONTENT_SLIME;
 +      if(supercontents & DPCONTENTS_WATER)
 +              return CONTENT_WATER;
 +      return CONTENT_EMPTY;
 +}
 +
 +float _Movetype_CheckWater(entity ent) // SV_CheckWater
 +{
 +      float supercontents;
 +      float nativecontents;
 +      vector point;
 +
 +      point = ent.move_origin;
 +      point_z += (ent.mins_z + 1);
 +
 +      nativecontents = pointcontents(point);
 +
 +      if(ent.move_watertype)
 +      if(ent.move_watertype != nativecontents)
 +      {
 +              //print(sprintf("_Movetype_CheckWater(): Original: '%d', New: '%d'\n", ent.move_watertype, nativecontents));
 +              if(ent.contentstransition)
 +                      ent.contentstransition(ent.move_watertype, nativecontents);
 +      }
 +
 +      ent.move_waterlevel = 0;
 +      ent.move_watertype = CONTENT_EMPTY;
 +
 +      supercontents = Mod_Q1BSP_SuperContentsFromNativeContents(nativecontents);
 +      if(supercontents & DPCONTENTS_LIQUIDSMASK)
 +      {
 +              ent.move_watertype = nativecontents;
 +              ent.move_waterlevel = 1;
 +              point_y = (ent.origin_y + ((ent.mins_z + ent.maxs_y) * 0.5));
 +              if(Mod_Q1BSP_SuperContentsFromNativeContents(pointcontents(point)) & DPCONTENTS_LIQUIDSMASK)
 +              {
 +                      ent.move_waterlevel = 2;
 +                      point_y = ent.origin_y + ent.view_ofs_y;
 +                      if(Mod_Q1BSP_SuperContentsFromNativeContents(pointcontents(point)) & DPCONTENTS_LIQUIDSMASK)
 +                              ent.move_waterlevel = 3;
 +              }
 +      }
 +
 +      return (ent.move_waterlevel > 1);
  }
  
 -void _Movetype_CheckWaterTransition() // SV_CheckWaterTransition
 +void _Movetype_CheckWaterTransition(entity ent) // SV_CheckWaterTransition
  {
 +      float contents = pointcontents(ent.move_origin);
 +      
 +      if(!ent.move_watertype)
 +      {
 +              // just spawned here
 +              if(!autocvar_sv_gameplayfix_fixedcheckwatertransition)
 +              {
 +                      ent.move_watertype = contents;
 +                      ent.move_waterlevel = 1;
 +                      return;
 +              }
 +      }
 +      else if(ent.move_watertype != contents)
 +      {
 +              //print(sprintf("_Movetype_CheckWaterTransition(): Origin: %s, Direct: '%d', Original: '%d', New: '%d'\n", vtos(ent.move_origin), pointcontents(ent.move_origin), ent.move_watertype, contents));
 +              if(ent.contentstransition)
 +                      ent.contentstransition(ent.move_watertype, contents);
 +      }
 +
 +      if(contents <= CONTENT_WATER)
 +      {
 +              ent.move_watertype = contents;
 +              ent.move_waterlevel = 1;
 +      }
 +      else
 +      {
 +              ent.move_watertype = CONTENT_EMPTY;
 +              ent.move_waterlevel = (autocvar_sv_gameplayfix_fixedcheckwatertransition ? 0 : contents);
 +      }
  }
  
  void _Movetype_Impact(entity oth) // SV_Impact
@@@ -259,10 -160,10 +259,10 @@@ float _Movetype_UnstickEntity() // SV_U
                if(!_Movetype_TestEntityPosition('0 0 -1' * i)) goto success;
                if(!_Movetype_TestEntityPosition('0 0 1' * i)) goto success;
        }
-       dprint(sprintf(_("Can't unstick an entity (edict: %d, classname: %s, origin: %s)\n"), num_for_edict(self), self.classname, vtos(self.move_origin)));
+       dprintf(_("Can't unstick an entity (edict: %d, classname: %s, origin: %s)\n"), num_for_edict(self), self.classname, vtos(self.move_origin));
        return FALSE;
  :success
-       dprint(sprintf(_("Sucessfully unstuck an entity (edict: %d, classname: %s, origin: %s)\n"), num_for_edict(self), self.classname, vtos(self.move_origin)));
+       dprintf(_("Sucessfully unstuck an entity (edict: %d, classname: %s, origin: %s)\n"), num_for_edict(self), self.classname, vtos(self.move_origin));
        _Movetype_LinkEdict(TRUE);
        return TRUE;
  }
@@@ -441,7 -342,7 +441,7 @@@ void _Movetype_Physics_Toss(float dt) /
                        self.move_velocity_z -= 0.5 * dt * getstatf(STAT_MOVEVARS_GRAVITY);
        }
  
 -      _Movetype_CheckWaterTransition();
 +      _Movetype_CheckWaterTransition(self);
  }
  
  void _Movetype_Physics_Frame(float movedt)
                        error("SV_Physics_Follow not implemented");
                        break;
                case MOVETYPE_NOCLIP:
 -                      _Movetype_CheckWater();
 +                      _Movetype_CheckWater(self);
                        self.move_origin = self.move_origin + ticrate * self.move_velocity;
                        self.move_angles = self.move_angles + ticrate * self.move_avelocity;
                        _Movetype_LinkEdict(FALSE);