]> git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Merge remote branch 'refs/remotes/origin/mirceakitsune/pickup_crosshair'
authorRudolf Polzer <divverent@alientrap.org>
Sun, 31 Oct 2010 13:40:16 +0000 (14:40 +0100)
committerRudolf Polzer <divverent@alientrap.org>
Sun, 31 Oct 2010 13:40:16 +0000 (14:40 +0100)
defaultXonotic.cfg
qcsrc/client/View.qc
qcsrc/common/constants.qh
qcsrc/server/cl_client.qc
qcsrc/server/defs.qh
qcsrc/server/g_world.qc
qcsrc/server/t_items.qc

index b89fdda7eade17330b48c422494d80c48b2ee4c8..af27e5d9c746eaafa411df1c1ae242477ba55d57 100644 (file)
@@ -96,6 +96,8 @@ seta crosshair_size 0.35
 seta crosshair_dot 1
 seta crosshair_dot_alpha 1
 seta crosshair_dot_size 1
+seta crosshair_pickup 0.25
+seta crosshair_pickup_speed 4
 seta crosshair_per_weapon 0    "when 1, each gun will display a different crosshair"
 seta crosshair_color_override 0        "when 1, crosshair_color_* overrides the per-weapon color"
 seta crosshair_effect_speed -1 "how fast (in seconds) some crosshair effects should take place, 0 = instant, -1 = 2x weapon switch time"
index 39f0586b17b9c701483ba75f71f64b27dbebdf04..733bab0c1469617277def55115e18855b3c5b7ef 100644 (file)
@@ -349,6 +349,8 @@ void CSQC_RAPTOR_HUD();
 vector freeze_pmove_org, freeze_input_angles;
 entity nightvision_noise, nightvision_noise2;
 
+float pickup_crosshair_time, pickup_crosshair_size;
+
 void CSQC_UpdateView(float w, float h)
 {
        entity e;
@@ -769,6 +771,22 @@ void CSQC_UpdateView(float w, float h)
                                        wcross_scale = 1;
                                }
 
+                               if(cvar("crosshair_pickup"))
+                               {
+                                       if(pickup_crosshair_time < getstatf(STAT_LAST_PICKUP))
+                                       {
+                                               pickup_crosshair_size = 1;
+                                               pickup_crosshair_time = getstatf(STAT_LAST_PICKUP);
+                                       }
+
+                                       if(pickup_crosshair_size > 0)
+                                               pickup_crosshair_size -= cvar("crosshair_pickup_speed") * frametime;
+                                       else
+                                               pickup_crosshair_size = 0;
+
+                                       wcross_scale += sin(pickup_crosshair_size) * cvar("crosshair_pickup");
+                               }
+
                                if(shottype == SHOTTYPE_HITENEMY)
                                        wcross_scale *= cvar("crosshair_hittest"); // is not queried if hittest is 0
                                if(shottype == SHOTTYPE_HITTEAM)
index b4b92ff8bd2e72cc41cc07b01bf8a339eb9e1006..36ea68ddd87db7eac868dbcafb68fc3b04e1f328 100644 (file)
@@ -310,7 +310,8 @@ const float STAT_SHOTORG = 46; // compressShotOrigin
 const float STAT_LEADLIMIT = 47;
 const float STAT_BULLETS_LOADED = 48;
 const float STAT_NEX_CHARGE = 49;
-const float STAT_HUD = 50;
+const float    STAT_LAST_PICKUP = 50;
+const float STAT_HUD = 51;
 
 // see DP source, quakedef.h
 const float STAT_MOVEVARS_AIRSPEEDLIMIT_NONQW = 222;
index 955c0a45d2e0660d002343905515cf34f67b6647..b03723ae45b78745a353f5919a0da35020e31eeb 100644 (file)
@@ -2225,6 +2225,7 @@ void SpectateCopy(entity spectatee) {
        self.health = spectatee.health;
        self.impulse = 0;
        self.items = spectatee.items;
+       self.last_pickup = spectatee.last_pickup;
        self.metertime = spectatee.metertime;
        self.strength_finished = spectatee.strength_finished;
        self.invincible_finished = spectatee.invincible_finished;
index 5be04141dfce6b62dfc424369323fb7803bd8448..aaddcbb2888504ae0cde64a1a02228a0292ab133 100644 (file)
@@ -603,6 +603,8 @@ string matchid;
 .float stats_hit[WEP_MAXCOUNT];  // for hitscan bullets hit
 .float stats_fired[WEP_MAXCOUNT];  // for hitscan bullets fired
 
+.float last_pickup;
+
 FTEQCC_YOU_SUCK_THIS_IS_NOT_UNREFERENCED(stats_hit);
 FTEQCC_YOU_SUCK_THIS_IS_NOT_UNREFERENCED(stats_fired);
 
index 73ae5605f0c713955d4e5e2760b12f20d41c5507..d55b7f6fab6497375c7aea6ef219aeabfd22f488 100644 (file)
@@ -641,6 +641,7 @@ void spawnfunc_worldspawn (void)
        addstat(STAT_SHOTORG, AS_INT, stat_shotorg);
        addstat(STAT_LEADLIMIT, AS_FLOAT, stat_leadlimit);
        addstat(STAT_BULLETS_LOADED, AS_INT, campingrifle_bulletcounter);
+       addstat(STAT_LAST_PICKUP, AS_FLOAT, last_pickup);
 
        addstat(STAT_NEX_CHARGE, AS_FLOAT, nex_charge);
 
index ba0cb8bb3e00c9873fcad5ada9cede5d344a61d8..9f0075afa53756b1f278443e979f7d37bde3c424 100644 (file)
@@ -489,6 +489,8 @@ void Item_Touch (void)
        if(!Item_GiveTo(self, other))
                return;
 
+       other.last_pickup = time;
+
        pointparticles(particleeffectnum("item_pickup"), self.origin, '0 0 0', 1);
 
        if (self.classname == "droppedweapon")