]> git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/common/mapobjects/trigger/viewloc.qc
Merge branch 'terencehill/menu_registries' into 'master'
[xonotic/xonotic-data.pk3dir.git] / qcsrc / common / mapobjects / trigger / viewloc.qc
index ba5dcbe443ea4c26e955adfa68b9f997eb0f8d69..9efaf9588d55a17d03e9d8ee549034c0ddff132e 100644 (file)
@@ -3,7 +3,9 @@
 #elif defined(MENUQC)
 #elif defined(SVQC)
     #include <lib/warpzone/util_server.qh>
-    #include <server/defs.qh>
+       #include <common/mapobjects/triggers.qh>
+    #include <common/weapons/_all.qh>
+    #include <common/stats.qh>
 #endif
 
 REGISTER_NET_LINKED(ENT_CLIENT_VIEWLOC)
@@ -30,37 +32,16 @@ void viewloc_think(entity this)
 #if 1
        FOREACH_CLIENT(!it.viewloc && IS_PLAYER(it),
        {
-               vector emin = it.absmin;
-               vector emax = it.absmax;
-               if(this.solid == SOLID_BSP)
-               {
-                       emin -= '1 1 1';
-                       emax += '1 1 1';
-               }
-               if(boxesoverlap(emin, emax, this.absmin, this.absmax)) // quick
-               {
-                       if(WarpZoneLib_BoxTouchesBrush(emin, emax, this, it)) // accurate
-                               it.viewloc = this;
-               }
+               if (WarpZoneLib_ExactTrigger_Touch(this, it, false))
+                       it.viewloc = this;
        });
 #else
-
-               for(e = findradius((this.absmin + this.absmax) * 0.5, vlen(this.absmax - this.absmin) * 0.5 + 1); e; e = e.chain)
-                       if(!e.viewloc)
-                               if(IS_PLAYER(e)) // should we support non-player entities with this?
-                               //if(!IS_DEAD(e)) // death view is handled separately, we can't override this just yet
-                               {
-                                       vector emin = e.absmin;
-                                       vector emax = e.absmax;
-                                       if(this.solid == SOLID_BSP)
-                                       {
-                                               emin -= '1 1 1';
-                                               emax += '1 1 1';
-                                       }
-                                       if(boxesoverlap(emin, emax, this.absmin, this.absmax)) // quick
-                                               if(WarpZoneLib_BoxTouchesBrush(emin, emax, this, e)) // accurate
-                                                       e.viewloc = this;
-                               }
+       for(e = findradius((this.absmin + this.absmax) * 0.5, vlen(this.absmax - this.absmin) * 0.5 + 1); e; e = e.chain)
+               if(!e.viewloc)
+                       if(IS_PLAYER(e)) // should we support non-player entities with this?
+                       //if(!IS_DEAD(e)) // death view is handled separately, we can't override this just yet
+                               if (WarpZoneLib_ExactTrigger_Touch(this, it, false))
+                                       e.viewloc = this;
 #endif
 
        this.nextthink = time;
@@ -113,7 +94,7 @@ spawnfunc(trigger_viewlocation)
        // we won't check target2 here yet, as it may not even need to exist
        if(this.target == "") { LOG_INFO("^1FAIL!"); delete(this); return; }
 
-       EXACTTRIGGER_INIT;
+       WarpZoneLib_ExactTrigger_Init(this, false);
        InitializeEntity(this, viewloc_init, INITPRIO_FINDTARGET);
 }
 
@@ -125,9 +106,7 @@ bool viewloc_send(entity this, entity to, int sf)
 
        WriteVector(MSG_ENTITY, this.origin);
 
-       WriteAngle(MSG_ENTITY, this.angles_x);
-       WriteAngle(MSG_ENTITY, this.angles_y);
-       WriteAngle(MSG_ENTITY, this.angles_z);
+       WriteAngleVector(MSG_ENTITY, this.angles);
 
        return true;
 }
@@ -142,13 +121,11 @@ void viewloc_link(entity this)
 
 spawnfunc(target_viewlocation_start)
 {
-       this.classname = "target_viewlocation_start";
        this.cnt = 1;
        viewloc_link(this);
 }
 spawnfunc(target_viewlocation_end)
 {
-       this.classname = "target_viewlocation_end";
        this.cnt = 2;
        viewloc_link(this);
 }
@@ -189,7 +166,6 @@ NET_HANDLE(ENT_CLIENT_VIEWLOC_TRIGGER, bool isnew)
        setthink(this, trigger_viewloc_updatelink);
        this.nextthink = time + 1; // we need to delay this or else
 
-       this.classname = "trigger_viewlocation";
        this.drawmask = MASK_NORMAL; // not so concerned, but better keep it alive
 }
 
@@ -200,9 +176,7 @@ NET_HANDLE(ENT_CLIENT_VIEWLOC, bool isnew)
        this.origin = ReadVector();
        setorigin(this, this.origin);
 
-       this.movedir_x = ReadAngle();
-       this.movedir_y = ReadAngle();
-       this.movedir_z = ReadAngle();
+       this.movedir = ReadAngleVector();
 
        return = true;