]> git.rm.cloudns.org Git - voretournament/voretournament.git/commitdiff
Port crosshair pickup effect from Xonotic
authorMirceaKitsune <sonichedgehog_hyperblast00@yahoo.com>
Fri, 25 Feb 2011 18:23:00 +0000 (20:23 +0200)
committerMirceaKitsune <sonichedgehog_hyperblast00@yahoo.com>
Fri, 25 Feb 2011 18:23:00 +0000 (20:23 +0200)
data/qcsrc/client/View.qc
data/qcsrc/common/constants.qh
data/qcsrc/server/cl_client.qc
data/qcsrc/server/defs.qh
data/qcsrc/server/g_world.qc
data/qcsrc/server/t_items.qc

index ff0d8b68be1af8714856ddbaa748a389ce9ec4eb..9ae5a03b4ab6b1a2afdd22d3126003213a2e12d4 100644 (file)
@@ -252,6 +252,7 @@ float view_set;
 float camera_mode;\r
 float chase_active_old;\r
 float artwork_fade;\r
+float pickup_crosshair_time, pickup_crosshair_size;\r
 string artwork_image;\r
 string intermission_song;\r
 string NextFrameCommand;\r
@@ -645,6 +646,22 @@ void CSQC_UpdateView(float w, float h)
                                        wcross_scale = 1;\r
                                }\r
 \r
+                               if(cvar("crosshair_pickup"))\r
+                               {\r
+                                       if(pickup_crosshair_time < getstatf(STAT_LAST_PICKUP))\r
+                                       {\r
+                                               pickup_crosshair_size = 1;\r
+                                               pickup_crosshair_time = getstatf(STAT_LAST_PICKUP);\r
+                                       }\r
+\r
+                                       if(pickup_crosshair_size > 0)\r
+                                               pickup_crosshair_size -= cvar("crosshair_pickup_speed") * frametime;\r
+                                       else\r
+                                               pickup_crosshair_size = 0;\r
+\r
+                                       wcross_scale += sin(pickup_crosshair_size) * cvar("crosshair_pickup");\r
+                               }\r
+\r
                                if(shottype == SHOTTYPE_HITENEMY)\r
                                        wcross_scale *= cvar("crosshair_hittest"); // is not queried if hittest is 0\r
                                if(shottype == SHOTTYPE_HITTEAM)\r
index 53362b4c00264a5ad0d1d2dc3354e97cbdc7d49c..c13b426e1e75ffd1a787e8449012fda66f12faae 100644 (file)
@@ -277,10 +277,11 @@ const float STAT_NB_METERSTART = 45;
 const float STAT_SHOTORG = 46; // compressShotOrigin\r
 const float STAT_LEADLIMIT = 47;\r
 const float STAT_WINNING = 48;\r
-const float STAT_VORE_LOAD = 49;\r
-const float STAT_VORE_DIGESTING = 50;\r
-const float STAT_VORE_EATEN = 51;\r
-const float STAT_VORE_CANLEAVE = 52;\r
+const float STAT_LAST_PICKUP = 49;\r
+const float STAT_VORE_LOAD = 50;\r
+const float STAT_VORE_DIGESTING = 51;\r
+const float STAT_VORE_EATEN = 52;\r
+const float STAT_VORE_CANLEAVE = 53;\r
 const float CTF_STATE_ATTACK = 1;\r
 const float CTF_STATE_DEFEND = 2;\r
 const float CTF_STATE_COMMANDER = 3;\r
index 26021e448bb2567767223b6bd83471a1a667a7b8..5eff6c80b80f98e248cddc15520e56951918406e 100644 (file)
@@ -2007,6 +2007,7 @@ void SpectateCopy(entity spectatee) {
        self.health = spectatee.health;\r
        self.impulse = 0;\r
        self.items = spectatee.items;\r
+       self.last_pickup = spectatee.last_pickup;\r
        self.strength_finished = spectatee.strength_finished;\r
        self.invincible_finished = spectatee.invincible_finished;\r
        self.pressedkeys = spectatee.pressedkeys;\r
index 099096cee54c427d54184a98c372ab11e5733e20..8bfb0ac9943a1fea3f3868f783ee75aced7bae3a 100644 (file)
@@ -587,6 +587,8 @@ string matchid;
 .float hitplotfh;\r
 .string noise4;\r
 \r
+.float last_pickup;\r
+\r
 .float stat_hit;\r
 .float stat_fired;\r
 .float stat_count;\r
index 9a8db612727f86ae86f9904af8c98c452bcd8a38..82186ec3193dae039983b20b63a9e117f6b7bfea 100644 (file)
@@ -654,6 +654,7 @@ void spawnfunc_worldspawn (void)
        addstat(STAT_DAMAGE_FIRED, AS_INT, stat_fired);\r
        addstat(STAT_SHOTORG, AS_INT, stat_shotorg);\r
        addstat(STAT_LEADLIMIT, AS_FLOAT, stat_leadlimit);\r
+       addstat(STAT_LAST_PICKUP, AS_FLOAT, last_pickup);\r
        addstat(STAT_WINNING, AS_FLOAT, winning);\r
        addstat(STAT_VORE_LOAD, AS_INT, stat_stomachload);\r
        addstat(STAT_VORE_DIGESTING, AS_INT, stat_digesting);\r
index 1048dfbab6016e30d28f5371f990340c38b36fe0..3505039f3fe1b525b2d1854712a5d0b48a2c7d6c 100644 (file)
@@ -355,6 +355,8 @@ void Item_Touch (void)
        if(!Item_GiveTo(self, other))\r
                return;\r
 \r
+       other.last_pickup = time;\r
+\r
        pointparticles(particleeffectnum("item_pickup"), self.origin, '0 0 0', 1);\r
 \r
        if (self.classname == "droppedweapon")\r