]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Begin moving per-weapon crosshair selection as weapon specific info
authorSamual Lenks <samual@xonotic.org>
Thu, 2 Jan 2014 21:07:40 +0000 (16:07 -0500)
committerSamual Lenks <samual@xonotic.org>
Thu, 2 Jan 2014 21:07:40 +0000 (16:07 -0500)
23 files changed:
qcsrc/client/View.qc
qcsrc/common/weapons/w_arc.qc
qcsrc/common/weapons/w_blaster.qc
qcsrc/common/weapons/w_crylink.qc
qcsrc/common/weapons/w_devastator.qc
qcsrc/common/weapons/w_electro.qc
qcsrc/common/weapons/w_fireball.qc
qcsrc/common/weapons/w_hagar.qc
qcsrc/common/weapons/w_hlac.qc
qcsrc/common/weapons/w_hook.qc
qcsrc/common/weapons/w_machinegun.qc
qcsrc/common/weapons/w_minelayer.qc
qcsrc/common/weapons/w_mortar.qc
qcsrc/common/weapons/w_porto.qc
qcsrc/common/weapons/w_rifle.qc
qcsrc/common/weapons/w_seeker.qc
qcsrc/common/weapons/w_shockwave.qc
qcsrc/common/weapons/w_shotgun.qc
qcsrc/common/weapons/w_tuba.qc
qcsrc/common/weapons/w_vaporizer.qc
qcsrc/common/weapons/w_vortex.qc
qcsrc/common/weapons/weapons.qc
qcsrc/common/weapons/weapons.qh

index 837c72f3e5ff3ae3f94158726012badfa28e8804..e6c9d3bb69ce5e48b99c8a05d83a9733ddfb60ba 100644 (file)
@@ -1228,42 +1228,39 @@ void CSQC_UpdateView(float w, float h)
                                shottype = SHOTTYPE_HITWORLD;
 
                        vector wcross_color = '0 0 0', wcross_size = '0 0 0';
-                       string wcross_wep = "", wcross_name;
+                       string wcross_name = "";
                        float wcross_scale, wcross_blur;
 
-                       if (autocvar_crosshair_per_weapon || (autocvar_crosshair_color_special == 1))
+                       if(autocvar_crosshair_per_weapon || (autocvar_crosshair_color_special == 1))
                        {
                                e = get_weaponinfo(switchingweapon);
-                               if (e && e.netname != "")
+                               if(e)
                                {
-                                       wcross_wep = e.netname;
                                        if(autocvar_crosshair_per_weapon)
                                        {
-                                               wcross_resolution *= cvar(strcat("crosshair_", wcross_wep, "_size"));
-                                               if (wcross_resolution == 0)
-                                                       return;
-                                               wcross_alpha *= cvar(strcat("crosshair_", wcross_wep, "_alpha"));
-                                               if (wcross_alpha == 0)
-                                                       return;
-
-                                               wcross_style = cvar_string(strcat("crosshair_", wcross_wep));
-                                               if(wcross_style == "" || wcross_style == "0")
-                                                       wcross_style = wcross_wep;
+                                               // WEAPONTODO: access these through some general settings (with non-balance config settings)
+                                               //wcross_resolution *= cvar(strcat("crosshair_", wcross_wep, "_size"));
+                                               //if (wcross_resolution == 0)
+                                                       //return;
+
+                                               //wcross_style = cvar_string(strcat("crosshair_", wcross_wep));
+                                               wcross_resolution *= e.w_crosshair_size;
+                                               wcross_name = e.w_crosshair;
                                        }
                                }
                        }
 
-                       //printf("crosshair style: %s\n", wcross_style);
-                       wcross_name = strcat("gfx/crosshair", wcross_style);
+                       if(wcross_name == "")
+                               wcross_name = strcat("gfx/crosshair", wcross_style);
 
                        // MAIN CROSSHAIR COLOR DECISION
                        switch(autocvar_crosshair_color_special)
                        {
                                case 1: // crosshair_color_per_weapon
                                {
-                                       if(wcross_wep != "")
+                                       if(e)
                                        {
-                                               wcross_color = stov(cvar_string(sprintf("crosshair_%s_color", wcross_wep)));
+                                               wcross_color = e.wpcolor;
                                                break;
                                        }
                                        else { goto normalcolor; }
index 62bf5dd0034fcb6f01d79a0a031b2eea168f8ca0..b453f5ea4442454c74c1e000d7bbe4528f584953 100644 (file)
@@ -8,6 +8,7 @@ REGISTER_WEAPON(
 /* rating   */ BOT_PICKUP_RATING_HIGH,
 /* color       */ '1 1 1',
 /* model    */ "arc",
+/* crosshair */ "gfx/crosshairhlac",
 /* netname  */ "arc",
 /* fullname */ _("Arc")
 );
index 3d0fced425840d747bdf3be5db5644da3084f188..a20361446a83d3badefd1a5136553822da4ec610 100644 (file)
@@ -8,6 +8,7 @@ REGISTER_WEAPON(
 /* rating   */ 0,
 /* color       */ '1 0.5 0.5',
 /* model    */ "laser",
+/* crosshair */ "gfx/crosshairlaser",
 /* netname  */ "laser",
 /* fullname */ _("Blaster")
 );
index c2f6b49de000be9ac26112c972e811f4a8aec16d..38ca5e5eb9149ec2b8cd5a6700384dd1cb2ec512 100644 (file)
@@ -8,6 +8,7 @@ REGISTER_WEAPON(
 /* rating   */ BOT_PICKUP_RATING_MID,
 /* color       */ '1 0.5 1',
 /* model    */ "crylink",
+/* crosshair */ "gfx/crosshaircrylink",
 /* netname  */ "crylink",
 /* fullname */ _("Crylink")
 );
index 7298ded1517540d2f208982095053dad548fa200..00a0a3068e13c074e4351576bdf0646381a8850e 100644 (file)
@@ -8,6 +8,7 @@ REGISTER_WEAPON(
 /* rating   */ BOT_PICKUP_RATING_HIGH,
 /* color       */ '1 1 0',
 /* model    */ "rl",
+/* crosshair */ "gfx/crosshairrocketlauncher",
 /* netname  */ "devastator",
 /* fullname */ _("Devastator")
 );
index 6fb5e7bdc584e72e77cb587862917a3e3d5874b8..d41c8ff6ccea7acce0f023a6cece02f28a98714c 100644 (file)
@@ -8,6 +8,7 @@ REGISTER_WEAPON(
 /* rating   */ BOT_PICKUP_RATING_MID,
 /* color       */ '0 0.5 1',
 /* model    */ "electro",
+/* crosshair */ "gfx/crosshairelectro",
 /* netname  */ "electro",
 /* fullname */ _("Electro")
 );
index 07b137159bc31d0a46eb318768d01307116fa4bf..d52a565d343b38fa362bcc80477e80709bff03ad 100644 (file)
@@ -8,6 +8,7 @@ REGISTER_WEAPON(
 /* rating   */ BOT_PICKUP_RATING_MID,
 /* color       */ '1 0.5 0',
 /* model    */ "fireball",
+/* crosshair */ "gfx/crosshairfireball",
 /* netname  */ "fireball",
 /* fullname */ _("Fireball")
 );
index b1a8be24f3e9ffb2a777a512e7843dfe0bc07ba7..0e0c589817c1351cd6af3819aa5fa6ccd6b759a1 100644 (file)
@@ -8,6 +8,7 @@ REGISTER_WEAPON(
 /* rating   */ BOT_PICKUP_RATING_MID,
 /* color       */ '1 1 0.5',
 /* model    */ "hagar",
+/* crosshair */ "gfx/crosshairhagar",
 /* netname  */ "hagar",
 /* fullname */ _("Hagar")
 );
index eb6bfcffda896020760b08c5d9f68b1e698edc79..d7aa50483a41c7d311428f6abeef5d1b3f84d303 100644 (file)
@@ -8,6 +8,7 @@ REGISTER_WEAPON(
 /* rating   */ BOT_PICKUP_RATING_MID,
 /* color       */ '0 1 0',
 /* model    */ "hlac",
+/* crosshair */ "gfx/crosshairhlac",
 /* netname  */ "hlac",
 /* fullname */ _("Heavy Laser Assault Cannon")
 );
index a4b07319a8c00323d334ebcc4f463af0e37683a3..f5fdb89229f057563b520e530b0856424be93bac 100644 (file)
@@ -8,6 +8,7 @@ REGISTER_WEAPON(
 /* rating   */ 0,
 /* color       */ '0 0.5 0',
 /* model    */ "hookgun",
+/* crosshair */ "gfx/crosshairhook",
 /* netname  */ "hook",
 /* fullname */ _("Grappling Hook")
 );
index 2fd5bf27d38f5bf1d1980c2854344aeaa7d21310..acc54f05995df895915329713ccfc4434c1b7f01 100644 (file)
@@ -8,6 +8,7 @@ REGISTER_WEAPON(
 /* rating   */ BOT_PICKUP_RATING_MID,
 /* color       */ '1 1 0',
 /* model    */ "uzi",
+/* crosshair */ "gfx/crosshairuzi",
 /* netname  */ "uzi",
 /* fullname */ _("Machine Gun")
 );
index 19d49b50d7d6c9ff5556613cf68df88f99498b2f..62d0e4ac03d9dfde8ce9931b21883c3c8f704a1b 100644 (file)
@@ -8,6 +8,7 @@ REGISTER_WEAPON(
 /* rating   */ BOT_PICKUP_RATING_HIGH,
 /* color       */ '0.75 1 0',
 /* model    */ "minelayer",
+/* crosshair */ "gfx/crosshairminelayer",
 /* netname  */ "minelayer",
 /* fullname */ _("Mine Layer")
 );
index 39fc9c407b30f65f738dc2c02d2b43ab74ede8c3..16b10aca4a3633a9d2bdd82f7f62824421137fbe 100644 (file)
@@ -8,6 +8,7 @@ REGISTER_WEAPON(
 /* rating   */ BOT_PICKUP_RATING_MID,
 /* color       */ '1 0 0',
 /* model    */ "gl",
+/* crosshair */ "gfx/crosshairgrenadelauncher",
 /* netname  */ "grenadelauncher",
 /* fullname */ _("Mortar")
 );
index c5b5585d802c397d8c2174926fd4f0f303464017..1f73ebb8223d4d1cef62b2a9be3ecc62b94fb8a2 100644 (file)
@@ -8,6 +8,7 @@ REGISTER_WEAPON(
 /* rating   */ 0,
 /* color       */ '0.5 0.5 0.5',
 /* model    */ "porto" ,
+/* crosshair */ "gfx/crosshairporto",
 /* netname  */ "porto",
 /* fullname */ _("Port-O-Launch")
 );
index 530eccf715ea965638b227aa218e4d22f240e6c3..79c029355192835b8449f490718a6d9e2ac57323 100644 (file)
@@ -8,6 +8,7 @@ REGISTER_WEAPON(
 /* rating   */ BOT_PICKUP_RATING_MID,
 /* color       */ '0.5 1 0',
 /* model    */ "campingrifle",
+/* crosshair */ "gfx/crosshairrifle",
 /* netname  */ "rifle",
 /* fullname */ _("Rifle")
 );
index 943734b7b5b3a514d9aca88e650ee5b1baee866d..4608c496223ef160c3b2c037eb58c1804553a1e0 100644 (file)
@@ -8,6 +8,7 @@ REGISTER_WEAPON(
 /* rating   */ BOT_PICKUP_RATING_MID,
 /* color       */ '0.5 1 0',
 /* model    */ "seeker",
+/* crosshair */ "gfx/crosshairseeker",
 /* netname  */ "seeker",
 /* fullname */ _("T.A.G. Seeker")
 );
index c1083c401afddabb82fdbe85110a4f165bda660d..1d8e5e6e6269646ba105e368eb82d2b0f188e4ff 100644 (file)
@@ -8,6 +8,7 @@ REGISTER_WEAPON(
 /* rating   */ BOT_PICKUP_RATING_LOW,
 /* color       */ '0.5 0.25 0',
 /* model    */ "shotgun",
+/* crosshair */ "gfx/crosshairshotgun",
 /* netname  */ "shockwave",
 /* fullname */ _("Shockwave")
 );
index 4a678607d2f63c9a3d14495980ecdb0fde669c63..ef6557ef42d6820257c5b7e2594849c1ac3fb128 100644 (file)
@@ -8,6 +8,7 @@ REGISTER_WEAPON(
 /* rating    */ BOT_PICKUP_RATING_LOW,
 /* color       */ '0.5 0.25 0',
 /* model     */ "shotgun",
+/* crosshair */ "gfx/crosshairshotgun",
 /* shortname */ "shotgun",
 /* fullname  */ _("Shotgun")
 );
index 9c8ea1a20222a0df972c31745f83dc0f3fa18ebb..707d3836a0446dfaa188c433ba42522872538f58 100644 (file)
@@ -8,6 +8,7 @@ REGISTER_WEAPON(
 /* rating   */ BOT_PICKUP_RATING_MID,
 /* color       */ '0 1 0',
 /* model    */ "tuba",
+/* crosshair */ "gfx/crosshairtuba",
 /* netname  */ "tuba",
 /* xgettext:no-c-format */
 /* fullname  */ _("@!#%'n Tuba")
index 7ef66ab58411782c38a5a251c4d677652193138c..4e3b8fc684408bb3e3c705df57fc9c9018cad30e 100644 (file)
@@ -8,6 +8,7 @@ REGISTER_WEAPON(
 /* rating   */ BOT_PICKUP_RATING_HIGH,
 /* color       */ '0.5 1 1',
 /* model    */ "minstanex",
+/* crosshair */ "gfx/crosshairminstanex",
 /* netname  */ "minstanex",
 /* fullname */ _("Vaporizer")
 );
index c1bda8400565327f87c71e1f3e536fa0958c8d9d..9900dbefb1fc103cb38d66773eeb0fac6b437819 100644 (file)
@@ -8,6 +8,7 @@ REGISTER_WEAPON(
 /* rating   */ BOT_PICKUP_RATING_HIGH,
 /* color       */ '0.5 1 1',
 /* model    */ "nex",
+/* crosshair */ "gfx/crosshairnex 0.65",
 /* netname  */ "nex",
 /* fullname */ _("Vortex")
 );
index baf6adb617dbcac3c52cfa669d09d391bdd4c0a5..97dda801b0285222e1b4948ddf45f91b235c2f54 100644 (file)
@@ -84,6 +84,7 @@ void register_weapon(
        float pickupbasevalue,
        vector clr,
        string modelname,
+       string crosshair,
        string shortname,
        string wname)
 {
@@ -104,6 +105,14 @@ void register_weapon(
        e.bot_pickupbasevalue = pickupbasevalue;
        e.ammo_field = ammotype;
 
+       // WEAPONTODO: reorganize this
+
+       e.w_crosshair = strzone(car(crosshair));
+       string s = cdr(crosshair);
+       e.w_crosshair_size = ((s != "") ? stof(s) : 1);
+
+       printf("wtf: '%s', '%s', %f.\n", car(crosshair), s, e.w_crosshair_size);
+
        #ifndef MENUQC
        func(WR_INIT);
        #endif
@@ -129,6 +138,9 @@ void register_weapons_done()
        dummy_weapon_info.bot_pickupbasevalue = 0;
        dummy_weapon_info.ammo_field = ammo_none;
 
+       dummy_weapon_info.w_crosshair = "gfx/crosshair1";
+       dummy_weapon_info.w_crosshair_size = 1;
+
        float i;
        weaponorder_byid = "";
        for(i = WEP_MAXCOUNT; i >= 1; --i)
index 0f9fba7298e4a6302351f8d52f8ef8c425b6bf50..3c0ac8577024e3a2139761d0f2194f64678ebb2e 100644 (file)
@@ -139,6 +139,7 @@ void register_weapon(
        float pickupbasevalue,
        vector clr,
        string modelname,
+       string crosshair,
        string shortname,
        string wname);
 
@@ -157,11 +158,14 @@ void register_weapons_done();
 .string model2;             // A: wpn-id     // wpn- sprite name
 .string mdl;                // M: model      // modelname without g_, v_, w_
 .string model;              // A: model      // full name of g_ model
+.string w_crosshair;
+.float w_crosshair_size;
 .string netname;            // M: refname    // reference name name
 .string message;            // M: fullname   // human readable name
 
+
 // note: the fabs call is just there to hide "if result is constant" warning
-#define REGISTER_WEAPON_2(id,bit,function,ammotype,impulse,flags,rating,color,model,refname,wepname) \
+#define REGISTER_WEAPON_2(id,bit,function,ammotype,impulse,flags,rating,color,model,crosshair,refname,wepname) \
        float id; \
        WepSet bit; \
        float function(float); \
@@ -173,15 +177,15 @@ void register_weapons_done();
                if((flags) & WEP_FLAG_SUPERWEAPON) \
                        WEPSET_SUPERWEAPONS |= bit; \
                ++WEP_COUNT; \
-               register_weapon(id,bit,function,ammotype,impulse,flags,rating,color,model,refname,wepname); \
+               register_weapon(id,bit,function,ammotype,impulse,flags,rating,color,model,crosshair,refname,wepname); \
        } \
        ACCUMULATE_FUNCTION(RegisterWeapons, RegisterWeapons_##id)
 #ifdef MENUQC
-#define REGISTER_WEAPON(id,function,ammotype,impulse,flags,rating,color,model,refname,wepname) \
-       REGISTER_WEAPON_2(WEP_##id,WEPSET_##id,w_null,ammotype,impulse,flags,rating,color,model,refname,wepname)
+#define REGISTER_WEAPON(id,function,ammotype,impulse,flags,rating,color,model,crosshair,refname,wepname) \
+       REGISTER_WEAPON_2(WEP_##id,WEPSET_##id,w_null,ammotype,impulse,flags,rating,color,model,crosshair,refname,wepname)
 #else
-#define REGISTER_WEAPON(id,function,ammotype,impulse,flags,rating,color,model,refname,wepname) \
-       REGISTER_WEAPON_2(WEP_##id,WEPSET_##id,function,ammotype,impulse,flags,rating,color,model,refname,wepname)
+#define REGISTER_WEAPON(id,function,ammotype,impulse,flags,rating,color,model,crosshair,refname,wepname) \
+       REGISTER_WEAPON_2(WEP_##id,WEPSET_##id,function,ammotype,impulse,flags,rating,color,model,crosshair,refname,wepname)
 #endif
 
 #include "all.qh"