]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
All vehicle stats as 0--100 (%) int. Spider minigun simplified
authorJakob MG <jakob_mg@hotmail.com>
Tue, 12 Apr 2011 14:36:56 +0000 (16:36 +0200)
committerJakob MG <jakob_mg@hotmail.com>
Tue, 12 Apr 2011 14:36:56 +0000 (16:36 +0200)
qcsrc/client/vehicles/vehicles.qc
qcsrc/server/vehicles/racer.qc
qcsrc/server/vehicles/raptor.qc
qcsrc/server/vehicles/spiderbot.qc
qcsrc/server/vehicles/vehicles.qc
vehicle_spiderbot.cfg

index 20d3fab75e954ad83710a9c114dd894166fad8aa..1daefac011639dbd616acd8bd2fb52977834859a 100644 (file)
@@ -99,9 +99,8 @@ void Net_AuXair2(float bIsNew)
 
 void VehicleRacerDraw()
 {
-    //Movetype_Physics_MatchServer(autocvar_cl_projectiles_sloppy);
     Movetype_Physics_NoMatchServer();
-    self.drawmask = MASK_NORMAL;    
+    self.drawmask = MASK_NORMAL;
 }
 
 void VehicleRacerRemove()
@@ -113,19 +112,19 @@ void Net_VehicleRacer(float bIsNew)
     if(bIsNew)
     {
         setmodel(self, "models/vehicles/wakizashi.dpm");
-        self.move_movetype = MOVETYPE_BOUNCE;        
+        self.move_movetype = MOVETYPE_BOUNCE;
         self.entremove = VehicleRacerRemove;
-        setsize(self,  '-60 -60 -20', '60 60 20');        
+        setsize(self,  '-60 -60 -20', '60 60 20');
         self.draw = VehicleRacerDraw;
         self.scale = 0.5;
     }
-    
+
     self.cnt = ReadByte();
-    
+
     self.origin_x = ReadCoord();
     self.origin_y = ReadCoord();
     self.origin_z = ReadCoord();
-    
+
     self.velocity_x = ReadCoord();
     self.velocity_y = ReadCoord();
     self.velocity_z = ReadCoord();
@@ -137,7 +136,7 @@ void Net_VehicleRacer(float bIsNew)
     self.move_origin    = self.origin;
     self.move_velocity  = self.velocity;
     self.move_angles    = self.angles;
-    
+
     setorigin(self, self.origin);
 }
 
@@ -150,7 +149,6 @@ void Net_VehicleSetup()
     hud_id = bound(HUD_SPIDERBOT, ReadByte(), HUD_RAPTOR);
 
     // Init auxiliary crosshairs
-//#if 1
     entity axh;
     for(i = 0; i < MAX_AXH; ++i)
     {
@@ -168,24 +166,7 @@ void Net_VehicleSetup()
         axh.alpha         = 1;
                AuxiliaryXhair[i] = axh;
     }
-/*
-#else
-    for(i = 0; i < MAX_AXH; ++i)
-    {
-        if(AuxiliaryXhair[i] != world && !wasfreed(AuxiliaryXhair[i]))
-            remove(AuxiliaryXhair[i]);
-
-        AuxiliaryXhair[i]               = spawn();
-               AuxiliaryXhair[i].draw2d        = Draw_Not;
-               AuxiliaryXhair[i].drawmask      = MASK_NORMAL;
-               AuxiliaryXhair[i].axh_drawflag  = DRAWFLAG_ADDITIVE;
-               AuxiliaryXhair[i].axh_fadetime  = 0.1;
-               AuxiliaryXhair[i].axh_image     = "gfx/vehicles/axh-ring.tga";
-               AuxiliaryXhair[i].axh_scale     = 1;
-               AuxiliaryXhair[i].alpha         = 1;
-    }
-#endif
-*/
+
     switch(hud_id)
     {
         case HUD_SPIDERBOT:
@@ -216,53 +197,60 @@ void Net_VehicleSetup()
             break;
     }
 }
+#define HUD_GETSTATS \
+    float health    = getstati(STAT_VEHICLESTAT_HEALTH); \
+       float shield    = getstati(STAT_VEHICLESTAT_SHIELD); \
+       float energy    = getstati(STAT_VEHICLESTAT_ENERGY); \
+       float ammo1     = getstati(STAT_VEHICLESTAT_AMMO1); \
+       float reload1   = getstati(STAT_VEHICLESTAT_RELOAD1); \
+       float ammo2     = getstati(STAT_VEHICLESTAT_AMMO2); \
+       float reload2   = getstati(STAT_VEHICLESTAT_RELOAD2);
 
 void CSQC_SPIDER_HUD()
 {
-       float rockets, reload, heat, hp, shield;
        vector picsize, hudloc;
 
     // Fetch health & ammo stats
-    hp      = bound(0,getstatf(STAT_VEHICLESTAT_HEALTH), 1);
-       shield  = bound(0,getstatf(STAT_VEHICLESTAT_SHIELD), 1);
-       heat    = min(getstatf(STAT_VEHICLESTAT_RELOAD1), 2);
-       rockets =     getstati(STAT_VEHICLESTAT_AMMO2);
-       reload  = min(getstatf(STAT_VEHICLESTAT_RELOAD2), 1);
-
-
+       HUD_GETSTATS
+       
     hudloc_y = 4;
     hudloc_x = 4;
-    drawfill('130 28 0', ('115 0 0' * hp) + '0 10 0', hp * '0 1 0' + (1 - hp) * '1 0 0', 0.5, DRAWFLAG_NORMAL);
+    
     picsize = drawgetimagesize(spider_h) * 0.5;
     drawpic(hudloc, spider_h, picsize, '1 1 1', 1, DRAWFLAG_NORMAL);
 
     picsize = drawgetimagesize(spider_a2) * 0.5;
     drawpic(hudloc + '120 96  0', spider_a2, picsize, '1 1 1', 1, DRAWFLAG_NORMAL);
 
-    drawstring(hudloc + '145 19  0', strcat(ftos(rint(hp * 100)), "%"),'15 15 0','0 1 0', 1, DRAWFLAG_NORMAL);
-    drawstring(hudloc + '175 34  0', strcat(ftos(rint(shield * 100)), "%"),'15 15 0','0 0 1', 1, DRAWFLAG_NORMAL);
-    drawstring(hudloc + '136 102  0', strcat(ftos(100 - rint(heat * 100)), "%"),'14 14 0','1 1 0', 1, DRAWFLAG_NORMAL);
+    drawstring(hudloc + '145 19  0', strcat(ftos(health), "%"),'15 15 0','0 1 0', 1, DRAWFLAG_NORMAL);
+    drawstring(hudloc + '175 34  0', strcat(ftos(shield), "%"),'15 15 0','0 0 1', 1, DRAWFLAG_NORMAL);
+    drawstring(hudloc + '136 102  0', strcat(ftos(ammo1), "%"),'14 14 0','1 1 0', 1, DRAWFLAG_NORMAL);
 
     picsize = drawgetimagesize(spider_a1) * 0.85;
-    if(rockets == 9)
+    if(ammo2 == 9)
     {
         drawpic(hudloc + '132 54  0', spider_a1, picsize, '-1 -1 -1', 1, DRAWFLAG_NORMAL);
-        drawstring(hudloc + '179 69 0', strcat(ftos(rint(reload * 100)), "%"),'14 14 0','1 1 0', 1, DRAWFLAG_NORMAL);
+        drawstring(hudloc + '179 69 0', strcat(ftos(reload2), "%"),'14 14 0','1 1 0', 1, DRAWFLAG_NORMAL);
     }
     else
     {
         drawpic(hudloc + '132 54  0', spider_a1, picsize, '1 1 1', 1, DRAWFLAG_NORMAL);
-        drawstring(hudloc + '179 69  0', strcat(ftos(9 - rockets), "/8"),'14 14 0','1 1 0', 1, DRAWFLAG_NORMAL);
+        drawstring(hudloc + '179 69  0', strcat(ftos(9 - ammo2), " / 8"),'14 14 0','1 1 0', 1, DRAWFLAG_NORMAL);
     }
 
     picsize = drawgetimagesize(spider_b) * 0.5;
     hudloc_y = 10.5;
     hudloc_x = 10.5;
-
+    
+    ammo1  /= 100; 
+    shield /= 100;
+    health /= 100;
+    reload2 /= 100;
+    
     drawpic(hudloc, spider_s, picsize, '1 1 1', shield, DRAWFLAG_NORMAL);
-    drawpic(hudloc, spider_b, picsize, '0 1 0' * hp + '1 0 0' * (1 - hp), 1, DRAWFLAG_NORMAL);
-    drawpic(hudloc, spider_r, picsize, '1 1 1' * reload + '1 0 0' * (1 - reload), 1, DRAWFLAG_NORMAL);
-    drawpic(hudloc, spider_g, picsize, '1 1 1' * (1 - heat) + '1 0 0' *  heat, 1, DRAWFLAG_NORMAL);
+    drawpic(hudloc, spider_b, picsize, '0 1 0' * health + '1 0 0' * (1 - health), 1, DRAWFLAG_NORMAL);
+    drawpic(hudloc, spider_r, picsize, '1 1 1' * reload2 + '1 0 0' * (1 - reload2), 1, DRAWFLAG_NORMAL);
+    drawpic(hudloc, spider_g, picsize, '1 1 1' * ammo1 + '1 0 0' *  (1 - ammo1), 1, DRAWFLAG_NORMAL);
 
 
        if (scoreboard_showscores)
@@ -285,18 +273,15 @@ void CSQC_RAPTOR_HUD()
 {
        if(autocvar_r_letterbox)
         return;
-
-       float reload, hp, shield, energy;
+       
        vector picsize, hudloc, vel;
        float movedt;
     vector where;
 
-    // Fetch health & ammo stats
-    hp      = bound(0,getstatf(STAT_VEHICLESTAT_HEALTH), 1);
-       shield  = bound(0,getstatf(STAT_VEHICLESTAT_SHIELD), 1);
-       reload  = min(getstatf(STAT_VEHICLESTAT_RELOAD1), 1);
-       energy  = min(getstatf(STAT_VEHICLESTAT_ENERGY),  1);
 
+    // Fetch health & ammo stats
+    HUD_GETSTATS
+    
     // Draw the crosshairs
     picsize = drawgetimagesize("gfx/vehicles/axh-cross.tga");
     picsize_x *= 0.75;
@@ -312,31 +297,34 @@ void CSQC_RAPTOR_HUD()
     picsize = drawgetimagesize(spider_a2) * 0.5;
     drawpic(hudloc + '120 96  0', spider_a2, picsize, '1 1 1', 1, DRAWFLAG_NORMAL);
 
-    drawstring(hudloc + '145 19  0', strcat(ftos(rint(hp * 100)), "%"),'15 15 0','0 1 0', 1, DRAWFLAG_NORMAL);
-    drawstring(hudloc + '175 34  0', strcat(ftos(rint(shield * 100)), "%"),'15 15 0','0 0 1', 1, DRAWFLAG_NORMAL);
-    drawstring(hudloc + '136 102 0', strcat(ftos(rint(energy * 100)), "%"),'15 15 0','0.5 0.5 1', 1, DRAWFLAG_NORMAL);
+    drawstring(hudloc + '145 19  0', strcat(ftos(health), "%"),'15 15 0','0 1 0', 1, DRAWFLAG_NORMAL);
+    drawstring(hudloc + '175 34  0', strcat(ftos(shield), "%"),'15 15 0','0 0 1', 1, DRAWFLAG_NORMAL);
+    drawstring(hudloc + '136 102 0', strcat(ftos(energy), "%"),'15 15 0','0.5 0.5 1', 1, DRAWFLAG_NORMAL);
 
+    health /= 100;
+    shield /= 100;
+    energy /= 100;
 
     picsize = drawgetimagesize(spider_a1) * 0.85;
-    if(reload == 1)
+    if(reload2 == 100)
     {
         drawpic(hudloc + '132 54  0', spider_a1, picsize, '1 1 1', 1, DRAWFLAG_NORMAL);
-        drawstring(hudloc + '179 69  0', strcat(ftos(rint(reload * 100)), "%"),'14 14 0','0 1 0', 0.5, DRAWFLAG_NORMAL);
+        drawstring(hudloc + '179 69  0', strcat(ftos(reload2), "%"),'14 14 0','0 1 0', 0.5, DRAWFLAG_NORMAL);
     }
     else
     {
         drawpic(hudloc + '132 54  0', spider_a1, picsize, '1 1 1', 1, DRAWFLAG_NORMAL);
-        drawstring(hudloc + '179 69  0', strcat(ftos(rint(reload * 100)), "%"),'14 14 0','0 0 1', 1, DRAWFLAG_NORMAL);
+        drawstring(hudloc + '179 69  0', strcat(ftos(reload2), "%"),'14 14 0','0 0 1', 1, DRAWFLAG_NORMAL);
     }
 
     picsize = drawgetimagesize(raptor_b) * 0.5;
     hudloc_y = 10.5;
     hudloc_x = 10.5;
-
+    reload1 = reload2 / 100;
     drawpic(hudloc, raptor_s, picsize, '1 1 1', shield, DRAWFLAG_NORMAL);
-    drawpic(hudloc, raptor_b, picsize, '0 1 0' * hp + '1 0 0' * (1 - hp), 1, DRAWFLAG_NORMAL);
+    drawpic(hudloc, raptor_b, picsize, '0 1 0' * health + '1 0 0' * (1 - health), 1, DRAWFLAG_NORMAL);
     drawpic(hudloc, raptor_g1, picsize, '1 1 1' * energy + '1 0 0' * (1 - energy), 1, DRAWFLAG_NORMAL);
-    drawpic(hudloc, raptor_g2, picsize, '1 1 1' * reload + '1 0 0' *  (1 - reload), 1, DRAWFLAG_NORMAL);
+    drawpic(hudloc, raptor_g2, picsize, '1 1 1' * reload1 + '1 0 0' *  (1 - reload1), 1, DRAWFLAG_NORMAL);
 
     if(!dropmark)
     {
@@ -345,7 +333,7 @@ void CSQC_RAPTOR_HUD()
         dropmark.gravity = 1;
     }
 
-    if(reload == 1)
+    if(reload2 == 100)
     {
         where = dropmark.origin;
         setorigin(dropmark, pmove_org);
@@ -403,8 +391,6 @@ void CSQC_RAPTOR_HUD()
 
 void CSQC_WAKIZASHI_HUD()
 {
-       // 0--1 floats. 1 = 100%, 0.6 = 50%.
-       float health, shield, energy, rockets;
        vector picsize, hudloc;
 
     picsize = drawgetimagesize(SPIDER_CROSS);
@@ -412,11 +398,15 @@ void CSQC_WAKIZASHI_HUD()
     picsize_y *= autocvar_cl_vehicle_spiderbot_cross_size;
     drawpic('0.5 0 0' * (vid_conwidth - picsize_x) + '0 0.5 0' * (vid_conheight - picsize_y), SPIDER_CROSS, picsize, '1 1 1', autocvar_cl_vehicle_spiderbot_cross_alpha, DRAWFLAG_NORMAL);
 
+    /*
     health  = min(getstatf(STAT_VEHICLESTAT_HEALTH),  1);
        shield  = min(getstatf(STAT_VEHICLESTAT_SHIELD),  1);
        energy  = min(getstatf(STAT_VEHICLESTAT_ENERGY),  1);
        rockets = bound(0,getstatf(STAT_VEHICLESTAT_RELOAD1), 1);
-
+       */
+    
+    HUD_GETSTATS
+    
     hudloc_y =  4;
     hudloc_x = 4;
 
@@ -427,13 +417,12 @@ void CSQC_WAKIZASHI_HUD()
     drawpic(hudloc + '116 92  0', waki_a2, picsize, '1 1 1', 1, DRAWFLAG_NORMAL);
 
 
-    drawstring(hudloc + '145 19  0', strcat(ftos(rint(health * 100)), "%"),'15 15 0','0 1 0', 1, DRAWFLAG_NORMAL);
-    drawstring(hudloc + '175 34  0', strcat(ftos(rint(shield * 100)), "%"),'15 15 0','0 0 1', 1, DRAWFLAG_NORMAL);
-
-    drawstring(hudloc + '136 102  0', strcat(ftos(rint(energy * 100)), "%"),'14 14 0','1 1 1', 1, DRAWFLAG_NORMAL);
+    drawstring(hudloc + '145 19  0', strcat(ftos(health), "%"),'15 15 0','0 1 0', 1, DRAWFLAG_NORMAL);
+    drawstring(hudloc + '175 34  0', strcat(ftos(shield), "%"),'15 15 0','0 0 1', 1, DRAWFLAG_NORMAL);
+    drawstring(hudloc + '136 102  0', strcat(ftos(energy), "%"),'14 14 0','1 1 1', 1, DRAWFLAG_NORMAL);
 
     picsize = drawgetimagesize(waki_a1) * 0.75;
-    if(rockets == 1)
+    if(reload1 == 100)
     {
         drawpic(hudloc + '140 55  0', waki_a1, picsize, '1 1 1', 1, DRAWFLAG_NORMAL);
         drawpic(hudloc + '144 59  0', waki_a1, picsize, '1 1 1', 1, DRAWFLAG_NORMAL);
@@ -442,17 +431,22 @@ void CSQC_WAKIZASHI_HUD()
     {
         drawpic(hudloc + '140 55  0', waki_a1, picsize, '-1 -1 -1', 1, DRAWFLAG_NORMAL);
         drawpic(hudloc + '144 59  0', waki_a1, picsize, '-1 -1 -1', 1, DRAWFLAG_NORMAL);
-        drawstring(hudloc + '165 69 0', strcat(ftos(rint(rockets * 100)), "%"),'14 14 0','1 1 0', 1, DRAWFLAG_NORMAL);
+        drawstring(hudloc + '165 69 0', strcat(ftos(reload1), "%"),'14 14 0','1 1 0', 1, DRAWFLAG_NORMAL);
     }
 
     picsize = drawgetimagesize(waki_b) * 0.5;
     hudloc_y = 10.5;
     hudloc_x = 10.5;
-
+    
+    health /= 100;
+    energy /= 100;
+    shield /= 100;
+    reload1 /= 100;
+    
     drawpic(hudloc, waki_s, picsize, '1 1 1', shield, DRAWFLAG_NORMAL);
-    drawpic(hudloc, waki_b, picsize, '0 1 0' * health + '1 0 0' * (1 - health), 1, DRAWFLAG_NORMAL);
-    drawpic(hudloc, waki_r, picsize, '1 1 1' * rockets + '1 0 0' * (1 - rockets), 1, DRAWFLAG_NORMAL);
-    drawpic(hudloc, waki_e, picsize, '1 1 1' * energy + '1 0 0'  (1 - energy), 1, DRAWFLAG_NORMAL);
+    drawpic(hudloc, waki_b, picsize, '0 1 0' * health + '1 0 0'  * (1 - health), 1, DRAWFLAG_NORMAL);
+    drawpic(hudloc, waki_r, picsize, '1 1 1' * reload1 + '1 0 0' * (1 - reload1), 1, DRAWFLAG_NORMAL);
+    drawpic(hudloc, waki_e, picsize, '1 1 1' * energy + '1 0 0'  * (1 - energy), 1, DRAWFLAG_NORMAL);
 
        if (scoreboard_showscores)
        {
@@ -490,11 +484,11 @@ void RaptorCBShellfragDraw()
 void RaptorCBShellfragToss(vector _org, vector _vel, vector _ang)
 {
     entity sfrag;
-    
+
     sfrag = spawn();
     setmodel(sfrag, "models/vehicles/clusterbomb_fragment.md3");
     setorigin(sfrag, _org);
-    
+
        sfrag.move_movetype = MOVETYPE_BOUNCE;
        sfrag.gravity = 0.15;
        sfrag.solid = SOLID_CORPSE;
@@ -505,14 +499,13 @@ void RaptorCBShellfragToss(vector _org, vector _vel, vector _ang)
        sfrag.move_velocity = _vel;
        sfrag.move_avelocity = prandomvec() * vlen(sfrag.move_velocity);
        sfrag.angles = self.move_angles = _ang;
-       
+
        sfrag.move_time = time;
        sfrag.damageforcescale = 4;
 
        sfrag.nextthink = time + 3;
        sfrag.cnt = time + 2;
     sfrag.drawmask = MASK_NORMAL;
-    
-    
+
+
 }
-                    
\ No newline at end of file
index 1efc4fe7b4c4e2bc42c27a1923019e53dad57022..680ebae5e1cd74bb00a220259e71bd4ab3a71911 100644 (file)
@@ -353,7 +353,7 @@ float racer_frame()
         else if(player.movement_y > 0)
             df += v_right * autocvar_g_vehicle_racer_speed_strafe;
     }
-
+    
     // Afterburn
     if (player.BUTTON_JUMP)
     if(racer.vehicle_energy >= (autocvar_g_vehicle_racer_afterburn_cost * frametime))
@@ -361,7 +361,7 @@ float racer_frame()
         racer.wait = time;
         racer.vehicle_energy -= autocvar_g_vehicle_racer_afterburn_cost * frametime;
         df += (v_forward * autocvar_g_vehicle_racer_speed_afterburn);
-        self.owner.vehicle_energy = racer.vehicle_energy / autocvar_g_vehicle_racer_energy;
+        //self.owner.vehicle_energy = racer.vehicle_energy / autocvar_g_vehicle_racer_energy;
     }
 
     racer.velocity  += df * frametime;
@@ -389,7 +389,7 @@ float racer_frame()
             racer.cnt = 1;
         }
         racer.attack_finished_single = time + autocvar_g_vehicle_racer_cannon_refire;
-        self.owner.vehicle_energy = racer.vehicle_energy / autocvar_g_vehicle_racer_energy;
+        //self.owner.vehicle_energy = racer.vehicle_energy / autocvar_g_vehicle_racer_energy;
     }
 
     if(autocvar_g_vehicle_racer_rocket_locktarget)
@@ -427,7 +427,7 @@ float racer_frame()
             racer.lip = time;
         }
     }
-    player.vehicle_reload1 = (time - racer.lip) / (racer.delay - racer.lip);
+    player.vehicle_reload1 = bound(0, 100 * ((time - racer.lip) / (racer.delay - racer.lip)), 100);
 
     if(self.vehicle_flags  & VHF_SHIELDREGEN)
         vehicles_regen(dmg_time, vehicle_shield, autocvar_g_vehicle_racer_shield, autocvar_g_vehicle_racer_shield_regen_pause, autocvar_g_vehicle_racer_shield_regen, frametime);
@@ -440,6 +440,7 @@ float racer_frame()
 
 
     VEHICLE_UPDATE_PLAYER(health, racer);
+    VEHICLE_UPDATE_PLAYER(energy, racer);
 
     if(self.vehicle_flags & VHF_HASSHIELD)
         VEHICLE_UPDATE_PLAYER(shield, racer);
index 9bd257acce01ba48907b0b4b82db9ae69d7a0c25..d9e8f2433d21e1ca3f62081b9d6232394e09921a 100644 (file)
@@ -308,8 +308,6 @@ float raptor_frame()
         return 1;
     }
 
-
-
     crosshair_trace(player);
 
 #if VEHICLES_VIEWROTATE_CROSSHAIR
@@ -531,9 +529,9 @@ float raptor_frame()
         raptor.delay = time + autocvar_g_vehicle_raptor_bombs_refire;
         raptor.lip   = time;
     }
-
-    player.vehicle_reload1 = (time - raptor.lip) / (raptor.delay - raptor.lip);
-    raptor.bomb1.alpha = raptor.bomb2.alpha = player.vehicle_reload1;
+    
+    raptor.bomb1.alpha = raptor.bomb2.alpha = (time - raptor.lip) / (raptor.delay - raptor.lip);
+    player.vehicle_reload2 = bound(0, raptor.bomb1.alpha * 100, 100);
 
     VEHICLE_UPDATE_PLAYER(health, raptor);
     VEHICLE_UPDATE_PLAYER(energy, raptor);
index 536667560f594dba08b19e0bbacd1d956533eb6b..531207b1889b5e44e6bbe946281b6c007f0d4b76 100644 (file)
@@ -3,9 +3,6 @@ const vector SPIDERBOT_MAX  = '75 75 125';
 
 float autocvar_g_vehicle_spiderbot_respawntime;
 
-//float autocvar_g_vehicle_spiderbot_crush_dmg;
-//float autocvar_g_vehicle_spiderbot_crush_force;
-
 float autocvar_g_vehicle_spiderbot_speed_stop;
 float autocvar_g_vehicle_spiderbot_speed_strafe;
 float autocvar_g_vehicle_spiderbot_speed_walk;
@@ -37,8 +34,11 @@ float autocvar_g_vehicle_spiderbot_shield_regen_pause;
 float autocvar_g_vehicle_spiderbot_minigun_damage;
 float autocvar_g_vehicle_spiderbot_minigun_refire;
 float autocvar_g_vehicle_spiderbot_minigun_spread;
-float autocvar_g_vehicle_spiderbot_minigun_cooldown;
-float autocvar_g_vehicle_spiderbot_minigun_heat;
+float autocvar_g_vehicle_spiderbot_minigun_ammo_cost;
+float autocvar_g_vehicle_spiderbot_minigun_ammo_max;
+float autocvar_g_vehicle_spiderbot_minigun_ammo_regen;
+float autocvar_g_vehicle_spiderbot_minigun_ammo_regen_pause;
+
 
 float autocvar_g_vehicle_spiderbot_rocket_damage;
 float autocvar_g_vehicle_spiderbot_rocket_edgedamage;
@@ -148,7 +148,7 @@ void spiderbot_rocket_do()
         return;
 
     crosshair_trace(self.owner);
-//normalize(v_forward + (v_up * 0.5) + randomvec() * 0.25) * autocvar_g_vehicle_spiderbot_rocket_speed,
+
     v = gettaginfo(self.tur_head,gettagindex(self.tur_head,"tag_fire"));
     rocket = vehicles_projectile("spiderbot_rocket_launch", "weapons/rocket_fire.wav",
                            v, normalize(v_forward) * autocvar_g_vehicle_spiderbot_rocket_speed,
@@ -161,7 +161,6 @@ void spiderbot_rocket_do()
     rocket.think      = spiderbot_rocket_guided;
     rocket.nextthink  = time;
     rocket.cnt        = time + autocvar_g_vehicle_spiderbot_rocket_lifetime;
-    
 
     self.tur_head.frame += 1;
     if (self.tur_head.frame == 9)
@@ -172,86 +171,6 @@ void spiderbot_rocket_do()
     self.gun2.cnt = time + self.attack_finished_single;
 }
 
-void spiderbot_minigun_fire(entity gun, float trail)
-{
-    vector v;
-
-    v = gettaginfo(gun, gettagindex(gun,"barrels"));
-    v_forward = normalize(v_forward);
-    v += v_forward * 50;
-
-    fireBullet (v, v_forward, autocvar_g_vehicle_spiderbot_minigun_spread, autocvar_g_vehicle_spiderbot_minigun_damage,
-        autocvar_g_vehicle_spiderbot_minigun_spread, DEATH_SBMINIGUN, 0);
-
-    if(trail)
-    {
-        sound (gun, CHAN_WEAPON, "weapons/uzi_fire.wav", VOL_BASE, ATTN_NORM);
-        trailparticles(self, particleeffectnum("spiderbot_minigun_trail"), v, trace_endpos);
-        pointparticles(particleeffectnum("spiderbot_minigun_muzzleflash"), v, v_forward * 2500, 1);
-        //pointparticles(particleeffectnum("spiderbot_minigun_impact"), trace_endpos, trace_plane_normal * 2500,1);
-    }
-}
-
-void spiderbot_miniguns_do()
-{
-    float ftmp;
-
-    if((self.vehicle_reload1 == 1) || (!self.owner.BUTTON_ATCK))
-    {
-        ftmp = 1 / autocvar_g_vehicle_spiderbot_minigun_cooldown * sys_frametime;
-        self.owner.vehicle_reload1 = max(self.owner.vehicle_reload1 - ftmp, 0);
-        if(self.owner.vehicle_reload1 <= 0)
-            self.vehicle_reload1 = 0;
-
-        return;
-    }
-
-    if (self.owner.BUTTON_ATCK)
-    {
-
-        // Animate miniguns
-        self.gun1.angles_z += (1440 * sys_frametime);
-        self.gun2.angles_z -= (1440 * sys_frametime);
-        if(self.gun1.angles_z >= 360)
-        {
-            self.gun1.angles_z = 0;
-            self.gun2.angles_z = 360;
-        }
-
-        if (self.tur_head.attack_finished_single < time)
-        {
-            // Fire bullets, alternating trails left<->right
-            self = self.owner;
-            if(self.misc_bulletcounter == 1)
-            {
-                spiderbot_minigun_fire(self.vehicle.gun1, 0);
-                spiderbot_minigun_fire(self.vehicle.gun2, 1);
-                self.misc_bulletcounter = 0;
-            }
-            else
-            {
-                spiderbot_minigun_fire(self.vehicle.gun1, 1);
-                spiderbot_minigun_fire(self.vehicle.gun2, 0);
-                self.misc_bulletcounter += 1;
-            }
-            self = self.vehicle;
-
-            ftmp = autocvar_g_vehicle_spiderbot_minigun_refire / autocvar_g_vehicle_spiderbot_minigun_heat;
-            self.owner.vehicle_reload1 +=  ftmp;
-
-            if(self.owner.vehicle_reload1 >= 1)
-            {
-                self.vehicle_reload1 = 1;
-                self.owner.vehicle_reload1 = 1;
-                self.tur_head.attack_finished_single = autocvar_g_vehicle_spiderbot_minigun_cooldown + time;
-            }
-            else
-                self.tur_head.attack_finished_single = autocvar_g_vehicle_spiderbot_minigun_refire + time;
-        }
-        return;
-    }
-}
-
 float spiderbot_frame()
 {
     vector ad;
@@ -274,10 +193,7 @@ float spiderbot_frame()
     }
 
     self = spider;
-    
-    //vector v;
-    //v = gettaginfo(self.tur_head,gettagindex(self.tur_head,"tag_fire"));
-    //te_lightning1(world, v, v + normalize(v_forward + (v_up * 0.5) + randomvec() * 0.25) * autocvar_g_vehicle_spiderbot_rocket_speed);
+
     crosshair_trace(player);
     //UpdateAuxiliaryXhair(player, trace_endpos, ('1 0 0' * player.vehicle_reload2) + ('0 1 0' * (1 - player.vehicle_reload2)), 2);
 
@@ -316,24 +232,19 @@ float spiderbot_frame()
     ad_y = bound(-ftmp, ad_y, ftmp);
     spider.tur_head.angles_y = bound(autocvar_g_vehicle_spiderbot_head_turnlimit * -1, spider.tur_head.angles_y + ad_y, autocvar_g_vehicle_spiderbot_head_turnlimit);
 
-
     // Pitch head
     ad = vectoangles(normalize(trace_endpos - gettaginfo(spider.tur_head,gettagindex(spider.tur_head,"tag_hud")))) - (spider.tur_head.angles + spider.angles);
     if(ad_x > 180) ad_x -= 360;
     if(ad_x < -180) ad_x += 360;
 
-
     ftmp = autocvar_g_vehicle_spiderbot_head_pitchspeed * sys_frametime;
     ad_x = bound(ftmp * -1, ad_x, ftmp);
     spider.tur_head.angles_x = bound(autocvar_g_vehicle_spiderbot_head_pitchlimit_down, spider.tur_head.angles_x + ad_x, autocvar_g_vehicle_spiderbot_head_pitchlimit_up);
 
-
-
     // Turn Body
     ftmp = autocvar_g_vehicle_spiderbot_turnspeed * sys_frametime;
     ftmp = bound(-ftmp, spider.tur_head.angles_y, ftmp);
 
-
 #endif
     makevectors(spider.angles + '-1 0 0' * spider.angles_x);
 
@@ -403,8 +314,44 @@ float spiderbot_frame()
 
     self.angles_x = bound(-45, self.angles_x, 45);
     self.angles_z = bound(-45, self.angles_z, 45);
+    
+    if(player.BUTTON_ATCK)
+    {
+        spider.cnt = time;
+        if(spider.vehicle_ammo1 >= autocvar_g_vehicle_spiderbot_minigun_ammo_cost && spider.tur_head.attack_finished_single <= time)
+        {
+            entity gun;
+            vector v;
+            spider.misc_bulletcounter += 1;
+            
+            self = player;
+            
+            mod(spider.misc_bulletcounter, 2) ? gun = spider.gun1 : gun = spider.gun2;
+            v = gettaginfo(gun, gettagindex(gun, "barrels"));
+            v_forward = normalize(v_forward);
+            v += v_forward * 50;
+
+            fireBullet (v, v_forward, autocvar_g_vehicle_spiderbot_minigun_spread, autocvar_g_vehicle_spiderbot_minigun_damage,
+                autocvar_g_vehicle_spiderbot_minigun_spread, DEATH_SBMINIGUN, 0);
+
+            sound (gun, CHAN_WEAPON, "weapons/uzi_fire.wav", VOL_BASE, ATTN_NORM);
+            trailparticles(self, particleeffectnum("spiderbot_minigun_trail"), v, trace_endpos);
+            pointparticles(particleeffectnum("spiderbot_minigun_muzzleflash"), v, v_forward * 2500, 1);
+            
+            self = spider;
+            
+            spider.vehicle_ammo1 -= autocvar_g_vehicle_spiderbot_minigun_ammo_cost;
+            spider.tur_head.attack_finished_single = time + autocvar_g_vehicle_spiderbot_minigun_refire;
+            player.vehicle_ammo1 = (spider.vehicle_ammo1 / autocvar_g_vehicle_spiderbot_minigun_ammo_max) * 100;
+        }
+    }
+    else
+        vehicles_regen(cnt, vehicle_ammo1, autocvar_g_vehicle_spiderbot_minigun_ammo_max,
+                                           autocvar_g_vehicle_spiderbot_minigun_ammo_regen_pause,
+                                           autocvar_g_vehicle_spiderbot_minigun_ammo_regen, frametime);
 
-    spiderbot_miniguns_do();
+    dprint("1: ammo1:", ftos(spider.vehicle_ammo1), "\n");
+    
     spiderbot_rocket_do();
 
     if(self.vehicle_flags  & VHF_SHIELDREGEN)
index fbb114bc623977cbdcbe9b5db3ce5cc7403e9e8c..b06e23599dad62876a6460e283242a350ded6d70 100644 (file)
@@ -153,7 +153,7 @@ void vehicles_locktarget(float incr, float decr, float _lock_time)
 }
 
 #define VEHICLE_UPDATE_PLAYER(fld,vhname) \
-self.owner.vehicle_##fld = self.vehicle_##fld / autocvar_g_vehicle_##vhname##_##fld
+self.owner.vehicle_##fld = (self.vehicle_##fld / autocvar_g_vehicle_##vhname##_##fld) * 100
 
 #define vehicles_sweap_collision(orig,vel,dt,acm,mult) \
 traceline(orig, orig + vel * dt, MOVE_NORMAL, self); \
@@ -519,7 +519,7 @@ void vehicles_regen(.float timer, .float regen_field, float field_max, float rpa
         self.regen_field = min(self.regen_field + regen * delta_time, field_max);
 
         if(self.owner)
-            self.owner.regen_field = self.regen_field / field_max;
+            self.owner.regen_field = (self.regen_field / field_max) * 100;
     }
 }
 
@@ -710,15 +710,15 @@ float vehicle_initialize(string  net_name,
                          void() thinkproc )
 {
     addstat(STAT_HUD, AS_INT,  hud);
-       addstat(STAT_VEHICLESTAT_HEALTH,  AS_FLOAT, vehicle_health);
-       addstat(STAT_VEHICLESTAT_SHIELD,  AS_FLOAT, vehicle_shield);
-       addstat(STAT_VEHICLESTAT_ENERGY,  AS_FLOAT, vehicle_energy);
+       addstat(STAT_VEHICLESTAT_HEALTH,  AS_INT, vehicle_health);
+       addstat(STAT_VEHICLESTAT_SHIELD,  AS_INT, vehicle_shield);
+       addstat(STAT_VEHICLESTAT_ENERGY,  AS_INT, vehicle_energy);
 
        addstat(STAT_VEHICLESTAT_AMMO1,   AS_INT,   vehicle_ammo1);
-       addstat(STAT_VEHICLESTAT_RELOAD1, AS_FLOAT, vehicle_reload1);
+       addstat(STAT_VEHICLESTAT_RELOAD1, AS_INT, vehicle_reload1);
 
        addstat(STAT_VEHICLESTAT_AMMO2,   AS_INT,   vehicle_ammo2);
-       addstat(STAT_VEHICLESTAT_RELOAD2, AS_FLOAT, vehicle_reload2);
+       addstat(STAT_VEHICLESTAT_RELOAD2, AS_INT, vehicle_reload2);
 
     if(bodymodel == "")
         error("vehicles: missing bodymodel!");
@@ -818,7 +818,6 @@ float VSF_EXTRA       = 32;         /// Send additional data (turret rotations a
 float VSF_ANIMINFO    = 64;         /// Animation info
 float VSF_FULL_UPDATE = 16777215    /// Send everything
 
-
 #ifdef SVQC
 float send_vehile(entity to, float sf)
 {
@@ -867,13 +866,15 @@ float send_vehile(entity to, float sf)
     
     if(sf & VSF_STATS)
     {
-        WriteShort(MSG_ENTITY, self.vehicle_health);
-        WriteShort(MSG_ENTITY, self.vehicle_shield);
-        WriteShort(MSG_ENTITY, self.vehicle_energy);
-        WriteShort(MSG_ENTITY, self.vehicle_ammo1);
-        WriteShort(MSG_ENTITY, self.vehicle_reload1);
-        WriteShort(MSG_ENTITY, self.vehicle_ammo2);
-        WriteShort(MSG_ENTITY, self.vehicle_reload2);
+        WriteByte(MSG_ENTITY, self.vehicle_health);
+        WriteByte(MSG_ENTITY, self.vehicle_shield);
+        WriteByte(MSG_ENTITY, self.vehicle_energy);
+        
+        WriteByte(MSG_ENTITY, self.vehicle_ammo1);
+        WriteByte(MSG_ENTITY, self.vehicle_reload1);
+        
+        WriteByte(MSG_ENTITY, self.vehicle_ammo2);
+        WriteByte(MSG_ENTITY, self.vehicle_reload2);
     }
     
     if(sf & VSF_EXTRA)
index 8de8cbb0eeb5a651328fd3f1adb6c6ca31128091..787ea99c05c018de1e11e704a1bd87a793e890e5 100644 (file)
@@ -29,9 +29,10 @@ set g_vehicle_spiderbot_minigun_damage         10
 set g_vehicle_spiderbot_minigun_spread         0.015
 set g_vehicle_spiderbot_minigun_speed          50000
 set g_vehicle_spiderbot_minigun_refire         0.05
-
-set g_vehicle_spiderbot_minigun_heat           10
-set g_vehicle_spiderbot_minigun_cooldown       10
+set g_vehicle_spiderbot_minigun_ammo_cost      1
+set g_vehicle_spiderbot_minigun_ammo_max       100
+set g_vehicle_spiderbot_minigun_ammo_regen     5
+set g_vehicle_spiderbot_minigun_ammo_regen_pause 1
 
 set g_vehicle_spiderbot_springlength         150
 set g_vehicle_spiderbot_springup             5