]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Move common vehicle entity fields into the vehicle class
authorTimePath <andrew.hardaker1995@gmail.com>
Sat, 22 Aug 2015 04:47:43 +0000 (14:47 +1000)
committerTimePath <andrew.hardaker1995@gmail.com>
Sat, 22 Aug 2015 04:47:43 +0000 (14:47 +1000)
qcsrc/common/vehicles/all.qh
qcsrc/common/vehicles/unit/bumblebee.qc
qcsrc/common/vehicles/unit/racer.qc
qcsrc/common/vehicles/unit/raptor.qc
qcsrc/common/vehicles/unit/spiderbot.qc
qcsrc/common/vehicles/vehicle.qh

index 08a3020c753a2b6f3c5e33475f437c4e52e381e6..ccb3a05642830b27140c51bdbd46dbdd6efe5f5d 100644 (file)
@@ -41,22 +41,6 @@ entity get_vehicleinfo(float id);
 .entity tur_head;
 
 
-// entity properties of vehicleinfo:
-.int vehicleid; // VEH_...
-.string netname; // short name
-.string vehicle_name; // human readable name
-.int(int) vehicle_func; // v_...
-.string mdl; // currently a copy of the model
-.string model; // full name of model
-.string head_model; // full name of tur_head model
-.string hud_model; // cockpit model
-.string tag_head; // tur_head model tag
-.string tag_hud; // hud model tag
-.string tag_view; // cockpit model tag
-.int() PlayerPhysplug; // player physics mod
-.int spawnflags;
-.vector mins, maxs; // vehicle hitbox size
-
 // other useful macros
 #define VEH_ACTION(vehicletype,mrequest) (get_vehicleinfo(vehicletype)).vehicle_func(mrequest)
 #define VEH_NAME(vehicletype) (get_vehicleinfo(vehicletype)).vehicle_name
@@ -93,19 +77,7 @@ const int VEH_FIRST = 1;
     REGISTER_INIT(VEH, id)
 REGISTER_REGISTRY(RegisterVehicles)
 
-
-REGISTER_VEHICLE(NULL, Vehicle) {
-    this.vehicleid = 0; // you can recognize dummies by this
-    this.netname = "";
-    this.vehicle_name = "Vehicle";
-    this.vehicle_func = v_null;
-    this.mdl = "";
-    this.mins = '-0 -0 -0';
-    this.maxs = '0 0 0';
-    this.model = "";
-    this.head_model = "";
-    this.hud_model = "";
-}
+REGISTER_VEHICLE(NULL, Vehicle);
 
 #include "all.inc"
 
index b4686d63c311196f680679a04fe590d84d2f553a..3d8eff20eabaf7b405fcd35974dd1a94c034b566 100644 (file)
@@ -13,7 +13,9 @@ REGISTER_VEHICLE_SIMPLE(
 /* tags                  */ "", "", "tag_viewport",
 /* netname       */ "bumblebee",
 /* fullname   */ _("Bumblebee")
-);
+) {
+    this.m_icon = "vehicle_bumble";
+}
 #endif
 
 #ifdef IMPLEMENTATION
@@ -1101,7 +1103,7 @@ float v_bumblebee(float req)
        {
                case VR_HUD:
                {
-                       Vehicles_drawHUD("vehicle_bumble", "vehicle_bumble_weapon1", "vehicle_bumble_weapon2",
+                       Vehicles_drawHUD(VEH_BUMBLEBEE.m_icon, "vehicle_bumble_weapon1", "vehicle_bumble_weapon2",
                                                         "vehicle_icon_ammo1", autocvar_hud_progressbar_vehicles_ammo1_color,
                                                         "vehicle_icon_ammo1", autocvar_hud_progressbar_vehicles_ammo1_color,
                                                         vCROSS_HEAL);
index afcb131e9e8427500310bd341a969176dd9477e6..3cf6215bee3a99ad6a7fd4509cac657c85f1db19 100644 (file)
@@ -12,7 +12,9 @@ REGISTER_VEHICLE_SIMPLE(
 /* tags                  */ "", "", "tag_viewport",
 /* netname       */ "racer",
 /* fullname   */ _("Racer")
-);
+) {
+    this.m_icon = "vehicle_racer";
+}
 #endif
 
 #ifdef IMPLEMENTATION
@@ -808,7 +810,7 @@ bool v_racer(int req)
 #ifdef CSQC
                case VR_HUD:
                {
-                       Vehicles_drawHUD("vehicle_racer", "vehicle_racer_weapon1", "vehicle_racer_weapon2",
+                       Vehicles_drawHUD(VEH_RACER.m_icon, "vehicle_racer_weapon1", "vehicle_racer_weapon2",
                                                         "vehicle_icon_ammo1", autocvar_hud_progressbar_vehicles_ammo1_color,
                                                         "vehicle_icon_ammo2", autocvar_hud_progressbar_vehicles_ammo2_color,
                                                         vCROSS_GUIDE);
index 12bc40589b34e749019576107af9ce9154d2b53b..1e92fa1959aae5e31c90d07a08c7a5d5d18df4f9 100644 (file)
@@ -13,7 +13,9 @@ REGISTER_VEHICLE_SIMPLE(
 /* tags                  */ "", "tag_hud", "tag_camera",
 /* netname       */ "raptor",
 /* fullname   */ _("Raptor")
-);
+) {
+    this.m_icon = "vehicle_raptor";
+}
 #endif
 
 #ifdef IMPLEMENTATION
@@ -1043,7 +1045,7 @@ float v_raptor(float req)
                                default:        crosshair = vCROSS_BURST;
                        }
                        
-                       Vehicles_drawHUD("vehicle_raptor", "vehicle_raptor_weapon1", "vehicle_raptor_weapon2",
+                       Vehicles_drawHUD(VEH_RAPTOR.m_icon, "vehicle_raptor_weapon1", "vehicle_raptor_weapon2",
                                                         "vehicle_icon_ammo1", autocvar_hud_progressbar_vehicles_ammo1_color,
                                                         "vehicle_icon_ammo2", autocvar_hud_progressbar_vehicles_ammo2_color,
                                                         crosshair);
index de3cdbb7afa1b0b6931f236b70d9dc7a538c20c8..0c134acd455ef89d06061221dd0b85c14696bb7a 100644 (file)
@@ -12,7 +12,9 @@ REGISTER_VEHICLE_SIMPLE(
 /* tags                  */ "tag_head", "tag_hud", "",
 /* netname       */ "spiderbot",
 /* fullname   */ _("Spiderbot")
-);
+) {
+    this.m_icon = "vehicle_spider";
+}
 #endif
 
 #ifdef IMPLEMENTATION
@@ -963,7 +965,7 @@ float v_spiderbot(float req)
                                default:             crosshair = vCROSS_BURST;
                        }
 
-                       Vehicles_drawHUD("vehicle_spider", "vehicle_spider_weapon1", "vehicle_spider_weapon2",
+                       Vehicles_drawHUD(VEH_SPIDERBOT.m_icon, "vehicle_spider_weapon1", "vehicle_spider_weapon2",
                                                         "vehicle_icon_ammo1", autocvar_hud_progressbar_vehicles_ammo1_color,
                                                         "vehicle_icon_ammo2", autocvar_hud_progressbar_vehicles_ammo2_color,
                                                         crosshair);
index b085a248bdfd690e253f6f600488ddb78d7a6eb9..7df34206fcd2c5b0462bdefe4fbef2f53d3ff2fb 100644 (file)
@@ -5,6 +5,36 @@ int v_null(int) { return 0; }
 
 CLASS(Vehicle, Object)
     ATTRIB(Vehicle, vehicleid, int, 0)
+    /** hud icon */
+    ATTRIB(Vehicle, m_icon, string, string_null)
+    /** short name */
+    ATTRIB(Vehicle, netname, string, "")
+    /** human readable name */
+    ATTRIB(Vehicle, vehicle_name, string, "Vehicle")
+    /**  */
+    ATTRIB(Vehicle, vehicle_func, int(int), v_null)
+    /** full name of model */
+    ATTRIB(Vehicle, model, string, "")
+    /** currently a copy of the model */
+    ATTRIB(Vehicle, mdl, string, "")
+    /** full name of tur_head model */
+    ATTRIB(Vehicle, head_model, string, "")
+    /** cockpit model */
+    ATTRIB(Vehicle, hud_model, string, "")
+    /** tur_head model tag */
+    ATTRIB(Vehicle, tag_head, string, string_null)
+    /** hud model tag */
+    ATTRIB(Vehicle, tag_hud, string, string_null)
+    /** cockpit model tag */
+    ATTRIB(Vehicle, tag_view, string, string_null)
+    /** player physics mod */
+    ATTRIB(Vehicle, PlayerPhysplug, int(), func_null)
+    /**  */
+    ATTRIB(Vehicle, spawnflags, int, 0)
+    /** vehicle hitbox size */
+    ATTRIB(Vehicle, mins, vector, '-0 -0 -0')
+    /** vehicle hitbox size */
+    ATTRIB(Vehicle, maxs, vector, '0 0 0')
 ENDCLASS(Vehicle)
 
 #endif