]> git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Merge branch 'master' into Juhu/velocity_pads
authorJuhu <5894800-Juhu_@users.noreply.gitlab.com>
Fri, 2 Jun 2023 13:43:25 +0000 (15:43 +0200)
committerJuhu <5894800-Juhu_@users.noreply.gitlab.com>
Fri, 2 Jun 2023 13:54:21 +0000 (15:54 +0200)
make trigger_push_velocity code compatible with the latest ExactTrigger changes

1  2 
qcsrc/common/mapobjects/trigger/jumppads.qc
qcsrc/common/mapobjects/trigger/jumppads.qh
qcsrc/common/util.qc

index 8c7ca3e9c48894d54c250854f0260208283d6cf4,0ff3ba0a99c58d05de97458666ba703825b9d998..1f91619ed61c9ebb08037841daff4f3d27082af7
@@@ -241,35 -143,12 +249,32 @@@ bool jumppad_push(entity this, entity t
  
        vector org = targ.origin;
  
-       if(STAT(Q3COMPAT))
-       {
-               org.z += targ.mins_z;
-               org.z += 1; // off by 1!
-       }
+       if(Q3COMPAT_COMMON || this.spawnflags & PUSH_STATIC)
+               org = (this.absmin + this.absmax) * 0.5;
  
 +      bool already_pushed = false;
 +      if(is_velocity_pad) // remember velocity jump pads
 +      {
 +              if(this == targ.last_pushed || (targ.last_pushed && !STAT(Q3COMPAT, targ))) // if q3compat is active overwrite last stored jump pad, otherwise ignore
 +              {
 +                      already_pushed = true;
 +              }
 +              else
 +              {
 +                      targ.last_pushed = this; // may be briefly out of sync between client and server if client prediction is toggled
 +              }
 +      }
 +
        if(this.enemy)
        {
 -              targ.velocity = trigger_push_calculatevelocity(org, this.enemy, this.height, targ);
 +              if(!is_velocity_pad)
 +              {
 +                      targ.velocity = trigger_push_calculatevelocity(org, this.enemy, this.height, targ);
 +              }
 +              else
 +              {
 +                      targ.velocity = trigger_push_velocity_calculatevelocity(this, org, this.enemy, this.speed, this.count, targ, already_pushed);
 +              }
        }
        else if(this.target && this.target != "")
        {
@@@ -800,29 -629,6 +805,30 @@@ spawnfunc(trigger_push
        InitializeEntity(this, trigger_push_findtarget, INITPRIO_FINDTARGET);
  }
  
-       trigger_init(this);
 +/*
 + * ENTITY PARAMETERS:
 + *
 + *   target:  this points to the target_position to which the player will jump.
 + *   speed:   XY speed for player-directional velocity pads - either sets or adds to the player's horizontal velocity.
 + *   count:   Z speed for player-directional velocity pads - either sets or adds to the player's vertical velocity.
 + */
 +spawnfunc(trigger_push_velocity)
 +{
++      EXACTTRIGGER_INIT;
++      BITSET_ASSIGN(this.effects, EF_NODEPTHTEST);
 +
 +      this.active = ACTIVE_ACTIVE;
 +      this.use = trigger_push_use;
 +      settouch(this, trigger_push_velocity_touch);
 +
 +      // normal push setup
 +      if (!this.noise)
 +              this.noise = "misc/jumppad.wav";
 +      precache_sound (this.noise);
 +
 +      trigger_push_velocity_link(this); // link it now
 +}
 +
  
  bool target_push_send(entity this, entity to, float sf)
  {
index 7b3a9caede6f53af7634cc303c45de328a16ed0f,c994bc61085b5971ee3c32aa7ea19e9b8d81e56a..7146cc52cb057a3d4d12f19c5664017d0aa71a8f
@@@ -3,15 -3,8 +3,16 @@@
  
  const int PUSH_ONCE = BIT(0); // legacy, deactivate with relay instead
  const int PUSH_SILENT = BIT(1); // not used?
+ const int PUSH_STATIC = BIT(12); // xonotic-only, Q3 already behaves like this by default
  
 +#define PUSH_VELOCITY_PLAYERDIR_XY        BIT(0)
 +#define PUSH_VELOCITY_ADD_XY              BIT(1)
 +#define PUSH_VELOCITY_PLAYERDIR_Z         BIT(2)
 +#define PUSH_VELOCITY_ADD_Z               BIT(3)
 +#define PUSH_VELOCITY_BIDIRECTIONAL_XY    BIT(4)
 +#define PUSH_VELOCITY_BIDIRECTIONAL_Z     BIT(5)
 +#define PUSH_VELOCITY_CLAMP_NEGATIVE_ADDS BIT(6)
 +
  IntrusiveList g_jumppads;
  STATIC_INIT(g_jumppads) { g_jumppads = IL_NEW(); }
  
index 368ffd73fe3133726205c7bf609ec23314af6318,df54e3536b10acdf149037ddacc8b6c4c133da12..08bd71298b6e70e2fa2f638d8ad8270fe1c6f5f4
@@@ -1675,21 -1677,6 +1677,21 @@@ void Skeleton_SetBones(entity e
  string to_execute_next_frame;
  void execute_next_frame()
  {
-               if(WarpZoneLib_ExactTrigger_Touch(it.last_pushed, it))
 +#ifdef SVQC
 +      IL_EACH(g_moveables, it.last_pushed,
 +      {
-       if(csqcplayer.last_pushed && WarpZoneLib_ExactTrigger_Touch(csqcplayer.last_pushed, csqcplayer))
++              if(!WarpZoneLib_ExactTrigger_Touch(it.last_pushed, it, false))
 +              {
 +                      it.last_pushed = NULL;
 +              }
 +      });
 +#elif defined(CSQC)
++      if(csqcplayer.last_pushed && !WarpZoneLib_ExactTrigger_Touch(csqcplayer.last_pushed, csqcplayer, false))
 +      {
 +              csqcplayer.last_pushed = NULL;
 +      }
 +#endif
 +
        if(to_execute_next_frame)
        {
                localcmd("\n", to_execute_next_frame, "\n");