]> git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/client/vehicles/vehicles.qc
Define client entity classes
[xonotic/xonotic-data.pk3dir.git] / qcsrc / client / vehicles / vehicles.qc
index 6f9a25a417b8b20b9cf05aa4b4a8ea539f69cbad..0f19c90662bc13f4dc3c580a617185d9435af0bb 100644 (file)
@@ -1,3 +1,21 @@
+#if defined(CSQC)
+    #include "../../dpdefs/csprogsdefs.qh"
+    #include "../defs.qh"
+    #include "../../common/constants.qh"
+    #include "../../common/stats.qh"
+    #include "../../common/util.qh"
+    #include "../../common/buffs.qh"
+    #include "../autocvars.qh"
+    #include "../movetypes.qh"
+    #include "../prandom.qh"
+    #include "../main.qh"
+    #include "vehicles.qh"
+    #include "../../csqcmodellib/cl_model.qh"
+    #include "../../server/t_items.qh"
+#elif defined(MENUQC)
+#elif defined(SVQC)
+#endif
+
 const string hud_bg = "gfx/vehicles/frame.tga";
 const string hud_sh = "gfx/vehicles/vh-shield.tga";
 
@@ -42,10 +60,11 @@ void CSQC_BUMBLE_GUN_HUD();
 const int MAX_AXH = 4;
 entity AuxiliaryXhair[MAX_AXH];
 
-.string axh_image;
-.float  axh_fadetime;
-.float  axh_drawflag;
-.float  axh_scale;
+entityclass(AuxiliaryXhair)
+class(AuxiliaryXhair) .string axh_image;
+class(AuxiliaryXhair) .float  axh_fadetime;
+class(AuxiliaryXhair) .float  axh_drawflag;
+class(AuxiliaryXhair) .float  axh_scale;
 
 const string bumb_ico =  "gfx/vehicles/bumb.tga";
 const string bumb_lgun =  "gfx/vehicles/bumb_lgun.tga";
@@ -77,8 +96,8 @@ void AuxiliaryXhair_Draw2D()
     loc = project_3d_to_2d(self.move_origin) - 0.5 * psize;
     if (!(loc.z < 0 || loc.x < 0 || loc.y < 0 || loc.x > vid_conwidth || loc.y > vid_conheight))
     {
-        loc_z = 0;
-        psize_z = 0;
+        loc.z = 0;
+        psize.z = 0;
         drawpic(loc, self.axh_image, psize, self.colormod, self.alpha, self.axh_drawflag);
     }
 
@@ -208,11 +227,11 @@ void Net_VehicleSetup()
     }
 }
 #define HUD_GETSTATS \
-    int vh_health    = getstati(STAT_VEHICLESTAT_HEALTH);  \
-       int shield    = getstati(STAT_VEHICLESTAT_SHIELD);  \
+    int vh_health       = getstati(STAT_VEHICLESTAT_HEALTH);  \
+       float shield        = getstati(STAT_VEHICLESTAT_SHIELD);  \
        noref int energy    = getstati(STAT_VEHICLESTAT_ENERGY);  \
-       noref int ammo1     = getstati(STAT_VEHICLESTAT_AMMO1);   \
-       noref int reload1   = getstati(STAT_VEHICLESTAT_RELOAD1); \
+       noref float ammo1   = getstati(STAT_VEHICLESTAT_AMMO1);   \
+       noref float reload1 = getstati(STAT_VEHICLESTAT_RELOAD1); \
        noref int ammo2     = getstati(STAT_VEHICLESTAT_AMMO2);   \
        noref int reload2   = getstati(STAT_VEHICLESTAT_RELOAD2);
 
@@ -233,8 +252,8 @@ void CSQC_BUMBLE_HUD()
        HUD_GETSTATS
 
     picsize = draw_getimagesize(hud_bg) * autocvar_cl_vehicles_hudscale;
-    hudloc_y = vid_conheight - picsize.y;
-    hudloc_x = vid_conwidth * 0.5 - picsize.x * 0.5;
+    hudloc.y = vid_conheight - picsize.y;
+    hudloc.x = vid_conwidth * 0.5 - picsize.x * 0.5;
 
     drawpic(hudloc, hud_bg, picsize, '1 1 1', autocvar_cl_vehicles_hudalpha, DRAWFLAG_NORMAL);
 
@@ -384,8 +403,8 @@ void CSQC_BUMBLE_GUN_HUD()
        HUD_GETSTATS
 
     picsize = draw_getimagesize(hud_bg) * autocvar_cl_vehicles_hudscale;
-    hudloc_y = vid_conheight - picsize.y;
-    hudloc_x = vid_conwidth * 0.5 - picsize.x * 0.5;
+    hudloc.y = vid_conheight - picsize.y;
+    hudloc.x = vid_conwidth * 0.5 - picsize.x * 0.5;
 
     drawpic(hudloc, hud_bg, picsize, '1 1 1', autocvar_cl_vehicles_hudalpha, DRAWFLAG_NORMAL);
 
@@ -506,8 +525,8 @@ void CSQC_SPIDER_HUD()
        HUD_GETSTATS
 
     picsize = draw_getimagesize(hud_bg) * autocvar_cl_vehicles_hudscale;
-    hudloc_y = vid_conheight - picsize.y;
-    hudloc_x = vid_conwidth * 0.5 - picsize.x * 0.5;
+    hudloc.y = vid_conheight - picsize.y;
+    hudloc.x = vid_conwidth * 0.5 - picsize.x * 0.5;
 
     drawpic(hudloc, hud_bg, picsize, '1 1 1', autocvar_cl_vehicles_hudalpha, DRAWFLAG_NORMAL);
 
@@ -668,8 +687,8 @@ void CSQC_RAPTOR_HUD()
        HUD_GETSTATS
 
     picsize = draw_getimagesize(hud_bg) * autocvar_cl_vehicles_hudscale;
-    hudloc_y = vid_conheight - picsize.y;
-    hudloc_x = vid_conwidth * 0.5 - picsize.x * 0.5;
+    hudloc.y = vid_conheight - picsize.y;
+    hudloc.x = vid_conwidth * 0.5 - picsize.x * 0.5;
 
     drawpic(hudloc, hud_bg, picsize, '1 1 1', autocvar_cl_vehicles_hudalpha, DRAWFLAG_NORMAL);
 
@@ -809,7 +828,7 @@ void CSQC_RAPTOR_HUD()
             {
                 where.x -= picsize.x * 0.5;
                 where.y -= picsize.y * 0.5;
-                where_z = 0;
+                where.z = 0;
                 drawpic(where, raptor_drop, picsize, '0 2 0', 1, DRAWFLAG_ADDITIVE);
             }
             dropmark.cnt = time + 5;
@@ -826,7 +845,7 @@ void CSQC_RAPTOR_HUD()
                 {
                     where.x -= picsize.x * 0.5;
                     where.y -= picsize.y * 0.5;
-                    where_z = 0;
+                    where.z = 0;
                     drawpic(where, raptor_drop, picsize, '2 0 0', 1, DRAWFLAG_ADDITIVE);
                 }
             }
@@ -862,8 +881,8 @@ void CSQC_WAKIZASHI_HUD()
        HUD_GETSTATS
 
     picsize = draw_getimagesize(hud_bg) * autocvar_cl_vehicles_hudscale;
-    hudloc_y = vid_conheight - picsize.y;
-    hudloc_x = vid_conwidth * 0.5 - picsize.x * 0.5;
+    hudloc.y = vid_conheight - picsize.y;
+    hudloc.x = vid_conwidth * 0.5 - picsize.x * 0.5;
 
     drawpic(hudloc, hud_bg, picsize, '1 1 1', autocvar_cl_vehicles_hudalpha, DRAWFLAG_NORMAL);