]> git.rm.cloudns.org Git - voretournament/voretournament.git/commitdiff
Pieces of an attempt to make each display digit an attachable (and skinnable) entity...
authorMirceaKitsune <sonichedgehog_hyperblast00@yahoo.com>
Tue, 23 Aug 2011 20:21:21 +0000 (23:21 +0300)
committerMirceaKitsune <sonichedgehog_hyperblast00@yahoo.com>
Tue, 23 Aug 2011 20:21:21 +0000 (23:21 +0300)
data/models/weapons/v_grabber.md3
data/qcsrc/server/cl_weaponsystem.qc
data/qcsrc/server/miscfunctions.qc
data/qcsrc/server/w_grabber.qc
data/textures/grabber_d.tga [deleted file]
data/textures/grabber_ddigit.tga [new file with mode: 0644]
misc/source/media/models/weapons/v_grabber.blend

index 207973bbcd33bb393297b0000bc87d8d6d13ae99..1d354dddba0e63ca37d635b5f235b0a7b7a302fa 100644 (file)
Binary files a/data/models/weapons/v_grabber.md3 and b/data/models/weapons/v_grabber.md3 differ
index 06ee01e125e8249f7e02b032936bc372c5eb6a04..2590f1a19e0913785bf706757aed9e7074a9e6f5 100644 (file)
@@ -1579,6 +1579,57 @@ void W_SetupProjectileVelocity(entity missile, float pSpeed, float spread)
 #define W_SETUPPROJECTILEVELOCITY_UP(m,s) W_SetupProjectileVelocityEx(m, w_shotdir, v_up, cvar(#s "_speed"), cvar(#s "_speed_up"), cvar(#s "_speed_z"), cvar(#s "_spread"))\r
 #define W_SETUPPROJECTILEVELOCITY(m,s) W_SetupProjectileVelocityEx(m, w_shotdir, v_up, cvar(#s "_speed"), 0, 0, cvar(#s "_spread"))\r
 \r
+.float digit_type;\r
+void W_DisplayThink()\r
+{\r
+       // the owner has switched to another weapon, remove the digits\r
+       if(self.weapon != self.owner.weapon)\r
+       {\r
+               self.nextthink = 0;\r
+               remove(self);\r
+               self = world;\r
+               return;\r
+       }\r
+       self.nextthink = time;\r
+setattachment(self, self.owner.weaponentity.weaponentity, strcat("displaydigit_", ftos(self.cnt)));\r
+       //dprint(strcat(ftos(self.cnt), " --------\n"));\r
+}\r
+\r
+void W_DisplaySetup(entity own, float load_num, float load_scale, float ammo_num, float ammo_scale)\r
+{\r
+       float i;\r
+       for(i = 1; i <= load_num + ammo_num; i += 1)\r
+       {\r
+               entity digit;\r
+               digit = spawn();\r
+               //setmodel(digit, "models/weapons/w_displaydigit.md3");\r
+               setmodel(digit, "models/items/g_h1.md3");\r
+               digit.owner = own;\r
+               digit.weapon = own.weapon;\r
+               digit.cnt = i;\r
+\r
+               if(i <= load_num)\r
+               {\r
+                       // weapon load digit\r
+                       digit.digit_type = 0;\r
+                       digit.scale = load_scale;\r
+               }\r
+               else\r
+               {\r
+                       // ammo count digit\r
+                       digit.digit_type = 1;\r
+                       digit.scale = ammo_scale;\r
+               }\r
+\r
+               digit.think = W_DisplayThink;\r
+               digit.nextthink = time;\r
+               //digit.viewmodelforclient = own;\r
+               //setattachment(digit, own.weaponentity.weaponentity, "");\r
+\r
+               dprint(strcat(own.weaponentity.weaponentity.classname, " --------\n"));\r
+       }\r
+}\r
+\r
 void W_DecreaseAmmo(.float ammo_type, float ammo_use, float ammo_reload)\r
 {\r
        if((self.items & IT_UNLIMITED_WEAPON_AMMO) && !ammo_reload)\r
index d8c72f49cb03da9f54469147ba68ac5063bbcca4..003cfbc053d3337f84a7bb3c0b0e8ea95a89ca1e 100644 (file)
@@ -1441,6 +1441,7 @@ void precache()
     // common weapon precaches\r
     precache_sound ("weapons/weapon_switch.wav");\r
     precache_sound ("weapons/weaponpickup.wav");\r
+       precache_model ("models/weapons/w_displaydigit.md3");\r
 \r
        float i;\r
        for(i = 0; i < 8; i += 1)\r
index 023b9e0533013872fd35068e731e0ae1d4964077..ad5fc9844e2dc003e2fc52e803e2ab11b022b776 100644 (file)
@@ -218,6 +218,7 @@ float w_grabber(float req)
                weapon_setup(WEP_GRABBER);\r
                self.grabber_state &~= GRABBER_WAITING_FOR_RELEASE;\r
                self.current_ammo = ammo_fuel;\r
+               W_DisplaySetup(self, 2, 1, 3, 0.75);\r
        }\r
        else if (req == WR_CHECKAMMO1)\r
        {\r
diff --git a/data/textures/grabber_d.tga b/data/textures/grabber_d.tga
deleted file mode 100644 (file)
index 7bb6358..0000000
Binary files a/data/textures/grabber_d.tga and /dev/null differ
diff --git a/data/textures/grabber_ddigit.tga b/data/textures/grabber_ddigit.tga
new file mode 100644 (file)
index 0000000..7bb6358
Binary files /dev/null and b/data/textures/grabber_ddigit.tga differ
index 129fb502c221903f01e12677daa45476cd53e68d..2c89d677a251a8c3b1d2cc36a926c43db862b5fe 100644 (file)
Binary files a/misc/source/media/models/weapons/v_grabber.blend and b/misc/source/media/models/weapons/v_grabber.blend differ