]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Still broken, but more fun
authorMario <zacjardine@y7mail.com>
Thu, 29 Jan 2015 19:00:33 +0000 (06:00 +1100)
committerMario <zacjardine@y7mail.com>
Thu, 29 Jan 2015 19:00:33 +0000 (06:00 +1100)
19 files changed:
qcsrc/client/Main.qc
qcsrc/client/damage.qc
qcsrc/client/waypointsprites.qc
qcsrc/common/constants.qh
qcsrc/common/triggers/func/conveyor.qh [new file with mode: 0644]
qcsrc/common/triggers/func/include.qh
qcsrc/common/triggers/func/ladder.qc
qcsrc/common/triggers/func/ladder.qh
qcsrc/common/triggers/func/plat.qc
qcsrc/common/triggers/func/plat.qh [new file with mode: 0644]
qcsrc/common/triggers/platforms.qc
qcsrc/common/triggers/platforms.qh
qcsrc/common/triggers/subs.qc
qcsrc/common/triggers/trigger/include.qh
qcsrc/common/triggers/trigger/jumppads.qc
qcsrc/common/triggers/trigger/jumppads.qh [new file with mode: 0644]
qcsrc/common/triggers/triggers.qc
qcsrc/common/triggers/triggers.qh
qcsrc/server/miscfunctions.qc

index f163ad73a030f0250211151642786cbdbd6ac187..10c7dd1d0f5571ee42eaff2fa8f4dd62302fcc51 100644 (file)
@@ -331,34 +331,6 @@ float CSQC_InputEvent(float bInputType, float nPrimary, float nSecondary)
 
 // --------------------------------------------------------------------------
 // BEGIN OPTIONAL CSQC FUNCTIONS
-void trigger_touch_generic(void() touchfunc)
-{
-       entity e;
-       for(e = findradius((self.absmin + self.absmax) * 0.5, vlen(self.absmax - self.absmin) * 0.5 + 1); e; e = e.chain)
-       if(e.isplayermodel)
-       {
-               vector emin = e.absmin, emax = e.absmax;
-               if(self.solid == SOLID_BSP)
-               {
-                       emin -= '1 1 1';
-                       emax += '1 1 1';
-               }
-               if(boxesoverlap(emin, emax, self.absmin, self.absmax)) // quick
-               if(WarpZoneLib_BoxTouchesBrush(emin, emax, self, e)) // accurate
-               {
-                       other = e;
-                       touchfunc();
-               }
-       }
-}
-void trigger_draw_generic()
-{
-       float dt = time - self.move_time;
-       self.move_time = time;
-       if(dt <= 0) { return; }
-
-       if(self.trigger_touch) { trigger_touch_generic(self.trigger_touch); }
-}
 
 void Ent_RemoveEntCS()
 {
@@ -771,10 +743,6 @@ void Ent_ReadSpawnEvent(float is_new)
 void Ent_RadarLink();
 void Ent_Init();
 void Ent_ScoresInfo();
-void ent_func_ladder();
-void ent_trigger_push();
-void ent_target_push();
-void ent_conveyor();
 void CSQC_Ent_Update(float bIsNewEntity)
 {
        float t;
@@ -865,6 +833,8 @@ void CSQC_Ent_Update(float bIsNewEntity)
                case ENT_CLIENT_CONVEYOR: ent_conveyor(); break;
                case ENT_CLIENT_DOOR: ent_door(); break;
                case ENT_CLIENT_DOOR_TRIGGER: ent_door_trigger(); break;
+               case ENT_CLIENT_PLAT: ent_plat(); break;
+               case ENT_CLIENT_PLAT_TRIGGER: ent_plat_trigger(); break;
 
                default:
                        //error(strcat(_("unknown entity type in CSQC_Ent_Update: %d\n"), self.enttype));
index 162ef6a07eb17560ebf4ffeb4d7a6c745affdaae..9966c760e6eb03715b5679c78ecc3727ba749909 100644 (file)
@@ -31,7 +31,7 @@ void DamageEffect_Think()
        pointparticles(self.team, org, '0 0 0', 1);
 }
 
-void DamageEffect(vector hitorg, float dmg, float type, float specnum)
+void DamageEffect(vector hitorg, float thedamage, float type, float specnum)
 {
        // particle effects for players and objects damaged by weapons (eg: flames coming out of victims shot with rockets)
 
@@ -75,7 +75,7 @@ void DamageEffect(vector hitorg, float dmg, float type, float specnum)
                        return; // allow a single damage on non-skeletal models
        }
 
-       life = bound(autocvar_cl_damageeffect_lifetime_min, dmg * autocvar_cl_damageeffect_lifetime, autocvar_cl_damageeffect_lifetime_max);
+       life = bound(autocvar_cl_damageeffect_lifetime_min, thedamage * autocvar_cl_damageeffect_lifetime, autocvar_cl_damageeffect_lifetime_max);
 
        effectname = get_weaponinfo(DEATH_WEAPONOF(type)).netname;
 
@@ -104,7 +104,7 @@ void DamageEffect(vector hitorg, float dmg, float type, float specnum)
 
 void Ent_DamageInfo(float isNew)
 {
-       float dmg, rad, edge, thisdmg, forcemul, species, hitplayer = FALSE;
+       float thedamage, rad, edge, thisdmg, forcemul, species, hitplayer = FALSE;
        vector force, thisforce;
        entity oldself;
 
@@ -118,7 +118,7 @@ void Ent_DamageInfo(float isNew)
        w_org_y = ReadCoord();
        w_org_z = ReadCoord();
 
-       dmg = ReadByte();
+       thedamage = ReadByte();
        rad = ReadByte();
        edge = ReadByte();
        force = decompressShortVector(ReadShort());
@@ -149,10 +149,10 @@ void Ent_DamageInfo(float isNew)
                                continue;
                        if(thisdmg < 0)
                                thisdmg = 0;
-                       if(dmg)
+                       if(thedamage)
                        {
-                               thisdmg = dmg + (edge - dmg) * thisdmg;
-                               thisforce = forcemul * vlen(force) * (thisdmg / dmg) * normalize(self.origin - w_org);
+                               thisdmg = thedamage + (edge - thedamage) * thisdmg;
+                               thisforce = forcemul * vlen(force) * (thisdmg / thedamage) * normalize(self.origin - w_org);
                        }
                        else
                        {
@@ -165,7 +165,7 @@ void Ent_DamageInfo(float isNew)
                        if(vlen(nearest - w_org) > bound(MIN_DAMAGEEXTRARADIUS, self.damageextraradius, MAX_DAMAGEEXTRARADIUS))
                                continue;
 
-                       thisdmg = dmg;
+                       thisdmg = thedamage;
                        thisforce = forcemul * force;
                }
 
index 2df3dd411bc6d9f4da76ef4124a81fa51658c8fc..1e16f925cbab5747641426c8938172834cc05273 100644 (file)
@@ -85,7 +85,7 @@ void drawquad(vector o, vector ri, vector up, string pic, vector rgb, float a, f
        R_EndPolygon();
 }
 
-void drawhealthbar(vector org, float rot, float h, vector sz, vector hotspot, float width, float height, float margin, float border, float align, vector rgb, float a, vector hrgb, float ha, float f)
+void drawhealthbar(vector org, float rot, float h, vector sz, vector hotspot, float width, float theheight, float margin, float border, float align, vector rgb, float a, vector hrgb, float ha, float f)
 {
        vector o, ri, up;
        float owidth; // outer width
@@ -103,13 +103,13 @@ void drawhealthbar(vector org, float rot, float h, vector sz, vector hotspot, fl
        up = rotate(up, rot);
 
        owidth = width + 2 * border;
-       o = o - up * (margin + border + height) + ri * (sz_x - owidth) * 0.5;
+       o = o - up * (margin + border + theheight) + ri * (sz_x - owidth) * 0.5;
 
        drawquad(o - up * border,                               ri * owidth,    up * border, "", rgb,  a,  f);
-       drawquad(o + up * height,                               ri * owidth,    up * border, "", rgb,  a,  f);
-       drawquad(o,                                             ri * border,    up * height, "", rgb,  a,  f);
-       drawquad(o + ri * (owidth - border),                    ri * border,    up * height, "", rgb,  a,  f);
-       drawquad(o + ri * (border + align * ((1 - h) * width)), ri * width * h, up * height, "", hrgb, ha, f);
+       drawquad(o + up * theheight,                               ri * owidth,    up * border, "", rgb,  a,  f);
+       drawquad(o,                                             ri * border,    up * theheight, "", rgb,  a,  f);
+       drawquad(o + ri * (owidth - border),                    ri * border,    up * theheight, "", rgb,  a,  f);
+       drawquad(o + ri * (border + align * ((1 - h) * width)), ri * width * h, up * theheight, "", hrgb, ha, f);
 }
 
 // returns location of sprite text
index 054364f12a99faaa5bf40608f4419db5e081f3a5..a3a8093a7f1a0a06eda143a977786fae784c9950 100644 (file)
@@ -106,6 +106,8 @@ const float ENT_CLIENT_TARGET_PUSH = 63;
 const float ENT_CLIENT_CONVEYOR = 64;
 const float ENT_CLIENT_DOOR = 65;
 const float ENT_CLIENT_DOOR_TRIGGER = 66;
+const float ENT_CLIENT_PLAT = 67;
+const float ENT_CLIENT_PLAT_TRIGGER = 68;
 
 const float ENT_CLIENT_HEALING_ORB = 80;
 
diff --git a/qcsrc/common/triggers/func/conveyor.qh b/qcsrc/common/triggers/func/conveyor.qh
new file mode 100644 (file)
index 0000000..f272030
--- /dev/null
@@ -0,0 +1,3 @@
+#ifdef CSQC
+void ent_conveyor();
+#endif
index 67558ff4efbbb0772f6e48ea14af3bb0add43fa4..70740c21fad6b312c7ada4242bc1228fb6642e25 100644 (file)
@@ -1,2 +1,4 @@
+#include "conveyor.qh"
 #include "door.qh"
 #include "ladder.qh"
+#include "plat.qh"
index dfa3194a460d14bd9a48936169edde7b140166cc..76cda7536e60eca37e6bd02e6afd8e340cfe2e53 100644 (file)
@@ -73,15 +73,6 @@ void spawnfunc_func_water()
 #elif defined(CSQC)
 .float speed;
 
-void func_ladder_draw()
-{
-       float dt = time - self.move_time;
-       self.move_time = time;
-       if(dt <= 0) { return; }
-
-       trigger_touch_generic(func_ladder_touch);
-}
-
 void ent_func_ladder()
 {
        self.classname = strzone(ReadString());
@@ -108,7 +99,8 @@ void ent_func_ladder()
        self.angles_z = ReadCoord();
 
        self.solid = SOLID_TRIGGER;
-       self.draw = func_ladder_draw;
+       self.draw = trigger_draw_generic;
+       self.trigger_touch = func_ladder_touch;
        self.drawmask = MASK_NORMAL;
        self.move_time = time;
 }
index 774e7cf408857c945a1a8a85a29a99512ab09795..11eeeda26aed6182fa44cf8eccd39f083a75164f 100644 (file)
@@ -1,2 +1,6 @@
 .float ladder_time;
 .entity ladder_entity;
+
+#ifdef CSQC
+void ent_func_ladder();
+#endif
index 14b17d87dca9d00b62e5bd664fab7c662e12c638..7184c5bec61c00e80518dcb36af6e8a301aac3aa 100644 (file)
@@ -1,4 +1,80 @@
 #ifdef SVQC
+void plat_delayedinit()
+{
+       plat_spawn_inside_trigger ();   // the "start moving" trigger
+}
+
+float plat_send(entity to, float sf)
+{
+       WriteByte(MSG_ENTITY, ENT_CLIENT_PLAT);
+       WriteByte(MSG_ENTITY, sf);
+
+       if(sf & SF_TRIGGER_INIT)
+       {
+               WriteShort(MSG_ENTITY, num_for_edict(self));
+               WriteString(MSG_ENTITY, self.target);
+               WriteString(MSG_ENTITY, self.target2);
+               WriteString(MSG_ENTITY, self.target3);
+               WriteString(MSG_ENTITY, self.target4);
+               WriteString(MSG_ENTITY, self.targetname);
+
+               WriteByte(MSG_ENTITY, self.platmovetype_start);
+               WriteByte(MSG_ENTITY, self.platmovetype_turn);
+               WriteByte(MSG_ENTITY, self.platmovetype_end);
+
+               WriteCoord(MSG_ENTITY, self.origin_x);
+               WriteCoord(MSG_ENTITY, self.origin_y);
+               WriteCoord(MSG_ENTITY, self.origin_z);
+
+               WriteString(MSG_ENTITY, self.model);
+
+               WriteCoord(MSG_ENTITY, self.mins_x);
+               WriteCoord(MSG_ENTITY, self.mins_y);
+               WriteCoord(MSG_ENTITY, self.mins_z);
+               WriteCoord(MSG_ENTITY, self.maxs_x);
+               WriteCoord(MSG_ENTITY, self.maxs_y);
+               WriteCoord(MSG_ENTITY, self.maxs_z);
+
+               WriteCoord(MSG_ENTITY, self.pos1_x);
+               WriteCoord(MSG_ENTITY, self.pos1_y);
+               WriteCoord(MSG_ENTITY, self.pos1_z);
+               WriteCoord(MSG_ENTITY, self.pos2_x);
+               WriteCoord(MSG_ENTITY, self.pos2_y);
+               WriteCoord(MSG_ENTITY, self.pos2_z);
+
+               WriteCoord(MSG_ENTITY, self.size_x);
+               WriteCoord(MSG_ENTITY, self.size_y);
+               WriteCoord(MSG_ENTITY, self.size_z);
+
+               WriteAngle(MSG_ENTITY, self.angles_x);
+               WriteAngle(MSG_ENTITY, self.angles_y);
+               WriteAngle(MSG_ENTITY, self.angles_z);
+
+               WriteAngle(MSG_ENTITY, self.mangle_x);
+               WriteAngle(MSG_ENTITY, self.mangle_y);
+               WriteAngle(MSG_ENTITY, self.mangle_z);
+
+               WriteShort(MSG_ENTITY, self.speed);
+               WriteShort(MSG_ENTITY, self.height);
+               WriteByte(MSG_ENTITY, self.lip);
+               WriteByte(MSG_ENTITY, self.state);
+
+               WriteShort(MSG_ENTITY, self.dmg);
+       }
+
+       if(sf & SF_TRIGGER_RESET)
+       {
+               // used on client
+       }
+
+       return TRUE;
+}
+
+void plat_link()
+{
+       Net_LinkEntity(self, 0, FALSE, plat_send);
+}
+
 void spawnfunc_func_plat()
 {
        if (self.sounds == 0)
@@ -64,6 +140,87 @@ void spawnfunc_func_plat()
        self.reset = plat_reset;
        plat_reset();
 
-       plat_spawn_inside_trigger ();   // the "start moving" trigger
+       plat_link();
+
+       InitializeEntity(self, plat_delayedinit, INITPRIO_FINDTARGET);
+}
+#elif defined(CSQC)
+void plat_draw()
+{
+
+}
+
+void ent_plat()
+{
+       float sf = ReadByte();
+
+       if(sf & SF_TRIGGER_INIT)
+       {
+               self.sv_entnum = ReadShort();
+               self.target = strzone(ReadString());
+               self.target2 = strzone(ReadString());
+               self.target3 = strzone(ReadString());
+               self.target4 = strzone(ReadString());
+               self.targetname = strzone(ReadString());
+
+               self.platmovetype_start = ReadByte();
+               self.platmovetype_turn = ReadByte();
+               self.platmovetype_end = ReadByte();
+
+               self.origin_x = ReadCoord();
+               self.origin_y = ReadCoord();
+               self.origin_z = ReadCoord();
+               setorigin(self, self.origin);
+
+               self.model = strzone(ReadString());
+               setmodel(self, self.model);
+
+               self.mins_x = ReadCoord();
+               self.mins_y = ReadCoord();
+               self.mins_z = ReadCoord();
+               self.maxs_x = ReadCoord();
+               self.maxs_y = ReadCoord();
+               self.maxs_z = ReadCoord();
+               setsize(self, self.mins, self.maxs);
+
+               self.pos1_x = ReadCoord();
+               self.pos1_y = ReadCoord();
+               self.pos1_z = ReadCoord();
+               self.pos2_x = ReadCoord();
+               self.pos2_y = ReadCoord();
+               self.pos2_z = ReadCoord();
+
+               self.size_x = ReadCoord();
+               self.size_y = ReadCoord();
+               self.size_z = ReadCoord();
+
+               self.angles_x = ReadAngle();
+               self.angles_y = ReadAngle();
+               self.angles_z = ReadAngle();
+
+               self.mangle_x = ReadAngle();
+               self.mangle_y = ReadAngle();
+               self.mangle_z = ReadAngle();
+
+               self.speed = ReadShort();
+               self.height = ReadShort();
+               self.lip = ReadByte();
+               self.state = ReadByte();
+
+               self.dmg = ReadShort();
+
+               self.solid = SOLID_BSP;
+               self.movetype = MOVETYPE_PUSH;
+               self.drawmask = MASK_NORMAL;
+               self.draw = plat_draw;
+               self.use = plat_use;
+
+               plat_reset(); // also called here
+       }
+
+       if(sf & SF_TRIGGER_RESET)
+       {
+               plat_reset();
+       }
 }
 #endif
diff --git a/qcsrc/common/triggers/func/plat.qh b/qcsrc/common/triggers/func/plat.qh
new file mode 100644 (file)
index 0000000..e3562f4
--- /dev/null
@@ -0,0 +1,3 @@
+#ifdef CSQC
+void ent_plat();
+#endif
index 7dff8429e3e83077d6dc42366e57d701f2d7ed22..03c2f0fe5d06be6ce800f910391bf17827662c60 100644 (file)
@@ -1,16 +1,38 @@
-#ifdef SVQC
 void generic_plat_blocked()
 {
-    if(self.dmg && other.takedamage != DAMAGE_NO) {
-        if(self.dmgtime2 < time) {
-            Damage (other, self, self, self.dmg, DEATH_HURTTRIGGER, other.origin, '0 0 0');
-            self.dmgtime2 = time + self.dmgtime;
-        }
-
-        // Gib dead/dying stuff
-        if(other.deadflag != DEAD_NO)
-            Damage (other, self, self, 10000, DEATH_HURTTRIGGER, other.origin, '0 0 0');
-    }
+#ifdef SVQC
+       if(self.dmg && other.takedamage != DAMAGE_NO)
+       {
+               if(self.dmgtime2 < time)
+               {
+                       Damage (other, self, self, self.dmg, DEATH_HURTTRIGGER, other.origin, '0 0 0');
+                       self.dmgtime2 = time + self.dmgtime;
+               }
+
+               // Gib dead/dying stuff
+               if(other.deadflag != DEAD_NO)
+                       Damage (other, self, self, 10000, DEATH_HURTTRIGGER, other.origin, '0 0 0');
+       }
+#endif
+}
+
+#ifdef SVQC
+float plat_trigger_send(entity to, float sf)
+{
+       WriteByte(MSG_ENTITY, ENT_CLIENT_PLAT_TRIGGER);
+       WriteShort(MSG_ENTITY, num_for_edict(self.enemy));
+
+       WriteCoord(MSG_ENTITY, self.origin_x);
+       WriteCoord(MSG_ENTITY, self.origin_y);
+       WriteCoord(MSG_ENTITY, self.origin_z);
+
+       WriteCoord(MSG_ENTITY, self.mins_x);
+       WriteCoord(MSG_ENTITY, self.mins_y);
+       WriteCoord(MSG_ENTITY, self.mins_z);
+       WriteCoord(MSG_ENTITY, self.maxs_x);
+       WriteCoord(MSG_ENTITY, self.maxs_y);
+       WriteCoord(MSG_ENTITY, self.maxs_z);
+       return TRUE;
 }
 
 void plat_spawn_inside_trigger()
@@ -46,6 +68,7 @@ void plat_spawn_inside_trigger()
                        if(tmin_z < tmax_z)
                        {
                                setsize (trigger, tmin, tmax);
+                               Net_LinkEntity(trigger, FALSE, 0, plat_trigger_send);
                                return;
                        }
 
@@ -53,6 +76,31 @@ void plat_spawn_inside_trigger()
        remove(trigger);
        objerror("plat_spawn_inside_trigger: platform has odd size or lip, can't spawn");
 }
+#elif defined(CSQC)
+void ent_plat_trigger()
+{
+       float myenemy = ReadShort();
+       self.origin_x = ReadCoord();
+       self.origin_y = ReadCoord();
+       self.origin_z = ReadCoord();
+       setorigin(self, self.origin);
+
+       self.mins_x = ReadCoord();
+       self.mins_y = ReadCoord();
+       self.mins_z = ReadCoord();
+       self.maxs_x = ReadCoord();
+       self.maxs_y = ReadCoord();
+       self.maxs_z = ReadCoord();
+       setsize(self, self.mins, self.maxs);
+
+       self.enemy = findfloat(world, sv_entnum, myenemy);
+       if(!self.enemy) { print("^1BAD BAD BAD!!!\n"); }
+       self.drawmask = MASK_NORMAL;
+       self.draw = trigger_draw_generic;
+       self.trigger_touch = plat_center_touch;
+       self.solid = SOLID_TRIGGER;
+}
+#endif
 
 void plat_hit_top()
 {
@@ -84,11 +132,20 @@ void plat_go_up()
 
 void plat_center_touch()
 {
+#ifdef SVQC
        if (!other.iscreature)
                return;
 
        if (other.health <= 0)
                return;
+#elif defined(CSQC)
+       if (!IS_PLAYER(other))
+               return;
+#endif
+
+#ifdef CSQC
+       print("Got this far\n");
+#endif
 
        self = self.enemy;
        if (self.state == 2)
@@ -99,11 +156,16 @@ void plat_center_touch()
 
 void plat_outside_touch()
 {
+#ifdef SVQC
        if (!other.iscreature)
                return;
 
        if (other.health <= 0)
                return;
+#elif defined(CSQC)
+       if (!IS_PLAYER(other))
+               return;
+#endif
 
        self = self.enemy;
        if (self.state == 1)
@@ -120,24 +182,32 @@ void plat_trigger_use()
 
 void plat_crush()
 {
-    if((self.spawnflags & 4) && (other.takedamage != DAMAGE_NO)) { // KIll Kill Kill!!
-        Damage (other, self, self, 10000, DEATH_HURTTRIGGER, other.origin, '0 0 0');
-    } else {
-        if((self.dmg) && (other.takedamage != DAMAGE_NO)) {   // Shall we bite?
-            Damage (other, self, self, self.dmg, DEATH_HURTTRIGGER, other.origin, '0 0 0');
-            // Gib dead/dying stuff
-            if(other.deadflag != DEAD_NO)
-                Damage (other, self, self, 10000, DEATH_HURTTRIGGER, other.origin, '0 0 0');
-        }
-
-        if (self.state == 4)
-            plat_go_down ();
-        else if (self.state == 3)
-            plat_go_up ();
+       if((self.spawnflags & 4) && (other.takedamage != DAMAGE_NO))
+       { // KIll Kill Kill!!
+#ifdef SVQC
+               Damage (other, self, self, 10000, DEATH_HURTTRIGGER, other.origin, '0 0 0');
+#endif
+       }
+       else
+       {
+#ifdef SVQC
+               if((self.dmg) && (other.takedamage != DAMAGE_NO))
+               {   // Shall we bite?
+                       Damage (other, self, self, self.dmg, DEATH_HURTTRIGGER, other.origin, '0 0 0');
+                       // Gib dead/dying stuff
+                       if(other.deadflag != DEAD_NO)
+                               Damage (other, self, self, 10000, DEATH_HURTTRIGGER, other.origin, '0 0 0');
+               }
+#endif
+
+               if (self.state == 4)
+                       plat_go_down ();
+               else if (self.state == 3)
+                       plat_go_up ();
        // when in other states, then the plat_crush event came delayed after
        // plat state already had changed
        // this isn't a bug per se!
-    }
+       }
 }
 
 void plat_use()
@@ -164,8 +234,13 @@ void plat_reset()
                self.state = 2;
                self.use = plat_trigger_use;
        }
+
+#ifdef SVQC
+       self.SendFlags |= SF_TRIGGER_RESET;
+#endif
 }
 
+#ifdef SVQC
 .float platmovetype_start_default, platmovetype_end_default;
 float set_platmovetype(entity e, string s)
 {
index 426b3c52a52b52e38fe87e490bdd3f1dbde86968..84d9f7a91676742a8b11be269a697fc236c9320a 100644 (file)
@@ -1,11 +1,15 @@
 .float dmgtime2;
 
-#ifdef SVQC
 void() plat_center_touch;
 void() plat_outside_touch;
 void() plat_trigger_use;
 void() plat_go_up;
 void() plat_go_down;
 void() plat_crush;
-#endif
 const float PLAT_LOW_TRIGGER = 1;
+
+.float dmg;
+
+#ifdef CSQC
+void ent_plat_trigger();
+#endif
index d7c813a1760e0dfec74a6a6917b4a99ba87f30f8..04860cd85912eb80a20cc6a148c2d46613e3aa22 100644 (file)
@@ -117,7 +117,8 @@ void SUB_CalcMove_controller_think (void)
        vector nextpos;
        delta = self.destvec;
        delta2 = self.destvec2;
-       if(time < self.animstate_endtime) {
+       if(time < self.animstate_endtime)
+       {
                nexttick = time + PHYS_INPUT_FRAMETIME;
 
                traveltime = self.animstate_endtime - self.animstate_starttime;
@@ -149,7 +150,9 @@ void SUB_CalcMove_controller_think (void)
 
                self.owner.velocity = veloc;
                self.nextthink = nexttick;
-       } else {
+       }
+       else
+       {
                // derivative: delta + 2 * delta2 (e.g. for angle positioning)
                oldself = self;
                self.owner.think = self.think1;
index ebde18dae3fd3c86b9127d3a4e062cac8dccae7c..46b50b4fb24a94e8dd9fc4684882da52ee174334 100644 (file)
@@ -1 +1,2 @@
 #include "multi.qh"
+#include "jumppads.qh"
index 9b1f112ca942dd4a166cd2ff11fda1d677636b8f..f2074f031e92faba1e4e9ba26fc1840abd89abe8 100644 (file)
@@ -1,7 +1,5 @@
 // TODO: split target_push and put it in the target folder
 
-.float height;
-
 #ifdef SVQC
 
 const float PUSH_ONCE = 1;
diff --git a/qcsrc/common/triggers/trigger/jumppads.qh b/qcsrc/common/triggers/trigger/jumppads.qh
new file mode 100644 (file)
index 0000000..2c5363b
--- /dev/null
@@ -0,0 +1,4 @@
+#ifdef CSQC
+void ent_trigger_push();
+void ent_target_push();
+#endif
index c9b5fdc6df6b2531d25bc8aea41abbfc6082c5c2..e8131b47b71e024ed5fa9a4da4f9ffec94cfb0bb 100644 (file)
@@ -142,3 +142,34 @@ void SUB_UseTargets()
        self = stemp;
        other = otemp;
 }
+
+#ifdef CSQC
+void trigger_touch_generic(void() touchfunc)
+{
+       entity e;
+       for(e = findradius((self.absmin + self.absmax) * 0.5, vlen(self.absmax - self.absmin) * 0.5 + 1); e; e = e.chain)
+       if(e.isplayermodel)
+       {
+               vector emin = e.absmin, emax = e.absmax;
+               if(self.solid == SOLID_BSP)
+               {
+                       emin -= '1 1 1';
+                       emax += '1 1 1';
+               }
+               if(boxesoverlap(emin, emax, self.absmin, self.absmax)) // quick
+               if(WarpZoneLib_BoxTouchesBrush(emin, emax, self, e)) // accurate
+               {
+                       other = e;
+                       touchfunc();
+               }
+       }
+}
+void trigger_draw_generic()
+{
+       float dt = time - self.move_time;
+       self.move_time = time;
+       if(dt <= 0) { return; }
+
+       if(self.trigger_touch) { trigger_touch_generic(self.trigger_touch); }
+}
+#endif
index 281c4c37581d195500a8d628b874f9f47a77bad9..68eaf1a472d0a6dab930b924847a819efd61345a 100644 (file)
@@ -7,6 +7,11 @@ const float    SPAWNFLAG_NOTOUCH = 1;
 
 .void() trigger_touch;
 
+.float height;
+
+.float nottargeted;
+#define IFTARGETED if(!self.nottargeted && self.targetname != "")
+
 .string bgmscript;
 .float bgmscriptattack;
 .float bgmscriptdecay;
index b029850b8b34247fc9e525633a7bdd7b89f9361d..7b4e76381916c24a7f76c448ad676288df741ea2 100644 (file)
@@ -1559,9 +1559,6 @@ void SetCustomizer(entity e, float(void) customizer, void(void) uncustomizer)
     e.uncustomizeentityforclient_set = !!uncustomizer;
 }
 
-.float nottargeted;
-#define IFTARGETED if(!self.nottargeted && self.targetname != "")
-
 void Net_LinkEntity(entity e, float docull, float dt, float(entity, float) sendfunc)
 {
     vector mi, ma;