]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/common/vehicles/vehicle.qh
Optimize vehicle impact code by only calling vlen() if damage would be taken
[xonotic/xonotic-data.pk3dir.git] / qcsrc / common / vehicles / vehicle.qh
index c49218db18eb297b1eec933804b307a4d3b83759..5b30b845e1a8d67b18d08fddc4970900e01c276c 100644 (file)
@@ -1,40 +1,39 @@
-#ifndef VEHICLE_H
-#define VEHICLE_H
+#pragma once
 
 CLASS(Vehicle, Object)
-    ATTRIB(Vehicle, vehicleid, int, 0)
+    ATTRIB(Vehicle, vehicleid, int, 0);
     /** hud icon */
-    ATTRIB(Vehicle, m_icon, string, string_null)
+    ATTRIB(Vehicle, m_icon, string);
     /** short name */
-    ATTRIB(Vehicle, netname, string, "")
+    ATTRIB(Vehicle, netname, string, "");
     /** human readable name */
-    ATTRIB(Vehicle, vehicle_name, string, "Vehicle")
+    ATTRIB(Vehicle, vehicle_name, string, "Vehicle");
     /** full name of model */
-    ATTRIB(Vehicle, model, string, "")
+    ATTRIB(Vehicle, model, string, "");
     /** currently a copy of the model */
-    ATTRIB(Vehicle, mdl, string, "")
+    ATTRIB(Vehicle, mdl, string, "");
     /** full name of tur_head model */
-    ATTRIB(Vehicle, head_model, string, "")
+    ATTRIB(Vehicle, head_model, string, "");
     /** cockpit model */
-    ATTRIB(Vehicle, hud_model, string, "")
+    ATTRIB(Vehicle, hud_model, string, "");
     /** tur_head model tag */
-    ATTRIB(Vehicle, tag_head, string, string_null)
+    ATTRIB(Vehicle, tag_head, string);
     /** hud model tag */
-    ATTRIB(Vehicle, tag_hud, string, string_null)
+    ATTRIB(Vehicle, tag_hud, string);
     /** cockpit model tag */
-    ATTRIB(Vehicle, tag_view, string, string_null)
+    ATTRIB(Vehicle, tag_view, string);
     /** player physics mod */
-    ATTRIB(Vehicle, PlayerPhysplug, bool(entity), func_null)
+    ATTRIB(Vehicle, PlayerPhysplug, bool(entity,float));
     /**  */
-    ATTRIB(Vehicle, spawnflags, int, 0)
+    ATTRIB(Vehicle, spawnflags, int, 0);
     /** vehicle hitbox size */
-    ATTRIB(Vehicle, mins, vector, '-0 -0 -0')
+    ATTRIB(Vehicle, m_mins, vector, '-0 -0 -0');
     /** vehicle hitbox size */
-    ATTRIB(Vehicle, maxs, vector, '0 0 0')
+    ATTRIB(Vehicle, m_maxs, vector, '0 0 0');
     /** vehicle 3rd person view offset */
-    ATTRIB(Vehicle, view_ofs, vector, '0 0 0')
+    ATTRIB(Vehicle, view_ofs, vector, '0 0 0');
     /** vehicle 3rd person view distance */
-    ATTRIB(Vehicle, height, float, 0)
+    ATTRIB(Vehicle, height, float, 0);
 
     /** (BOTH) setup vehicle data */
     METHOD(Vehicle, vr_setup, void(Vehicle this, entity instance)) { }
@@ -46,33 +45,35 @@ CLASS(Vehicle, Object)
     METHOD(Vehicle, vr_precache, void(Vehicle this)) { }
     /** (SERVER) called when a player enters this vehicle */
     METHOD(Vehicle, vr_enter, void(Vehicle this, entity instance)) { }
+    /** (SERVER) called when a player enters this vehicle while occupied */
+    METHOD(Vehicle, vr_gunner_enter, void(Vehicle this, entity instance, entity actor)) { }
     /** (SERVER) called when the vehicle re-spawns */
     METHOD(Vehicle, vr_spawn, void(Vehicle this, entity instance)) { }
     /** (SERVER) called when a vehicle hits something */
     METHOD(Vehicle, vr_impact, void(Vehicle this, entity instance)) { }
+    /** (SERVER) called when a vehicle's colors are being reset, so modules can be updated */
+    METHOD(Vehicle, vr_setcolors, void(Vehicle this, entity instance)) { }
     /** (CLIENT) logic to run every frame */
     METHOD(Vehicle, vr_hud, void(Vehicle this)) { }
     /** (CLIENT) logic to run every frame */
-    METHOD(Vehicle, vr_crosshair, void(Vehicle this)) { }
+    METHOD(Vehicle, vr_crosshair, void(Vehicle thisveh, entity player)) { }
 ENDCLASS(Vehicle)
 
 // vehicle spawn flags (need them here for common registrations)
-const int VHF_ISVEHICLE                        = 2; /// Indicates vehicle
-const int VHF_HASSHIELD                        = 4; /// Vehicle has shileding
-const int VHF_SHIELDREGEN              = 8; /// Vehicles shield regenerates
-const int VHF_HEALTHREGEN              = 16; /// Vehicles health regenerates
-const int VHF_ENERGYREGEN              = 32; /// Vehicles energy regenerates
-const int VHF_DEATHEJECT               = 64; /// Vehicle ejects pilot upon fatal damage
-const int VHF_MOVE_GROUND              = 128; /// Vehicle moves on gound
-const int VHF_MOVE_HOVER               = 256; /// Vehicle hover close to gound
-const int VHF_MOVE_FLY                 = 512; /// Vehicle is airborn
-const int VHF_DMGSHAKE                 = 1024; /// Add random velocity each frame if health < 50%
-const int VHF_DMGROLL                  = 2048; /// Add random angles each frame if health < 50%
-const int VHF_DMGHEADROLL              = 4096; /// Add random head angles each frame if health < 50%
-const int VHF_MULTISLOT                        = 8192; /// Vehicle has multiple player slots
-const int VHF_PLAYERSLOT               = 16384; /// This ent is a player slot on a multi-person vehicle
+const int VHF_ISVEHICLE                        = BIT(1); /// Indicates vehicle
+const int VHF_HASSHIELD                        = BIT(2); /// Vehicle has shileding
+const int VHF_SHIELDREGEN              = BIT(3); /// Vehicles shield regenerates
+const int VHF_HEALTHREGEN              = BIT(4); /// Vehicles health regenerates
+const int VHF_ENERGYREGEN              = BIT(5); /// Vehicles energy regenerates
+const int VHF_DEATHEJECT               = BIT(6); /// Vehicle ejects pilot upon fatal damage
+const int VHF_MOVE_GROUND              = BIT(7); /// Vehicle moves on gound
+const int VHF_MOVE_HOVER               = BIT(8); /// Vehicle hover close to gound
+const int VHF_MOVE_FLY                 = BIT(9); /// Vehicle is airborn
+const int VHF_DMGSHAKE                 = BIT(10); /// Add random velocity each frame if health < 50%
+const int VHF_DMGROLL                  = BIT(11); /// Add random angles each frame if health < 50%
+const int VHF_DMGHEADROLL              = BIT(12); /// Add random head angles each frame if health < 50%
+const int VHF_MULTISLOT                        = BIT(13); /// Vehicle has multiple player slots
+const int VHF_PLAYERSLOT               = BIT(14); /// This ent is a player slot on a multi-person vehicle
 
 // fields:
 .entity tur_head;
-
-#endif