]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Make view offset and view height attributes to vehicles
authorMario <mario@smbclan.net>
Sat, 2 Jan 2016 08:37:52 +0000 (18:37 +1000)
committerMario <mario@smbclan.net>
Sat, 2 Jan 2016 08:37:52 +0000 (18:37 +1000)
qcsrc/client/view.qc
qcsrc/common/vehicles/vehicle.qh
qcsrc/common/vehicles/vehicle/bumblebee.qc
qcsrc/common/vehicles/vehicle/racer.qc
qcsrc/common/vehicles/vehicle/raptor.qc
qcsrc/common/vehicles/vehicle/spiderbot.qc

index 207a4688377de35ec3c9d85fa68902cdfd62ee1a..80b1770c3a689902d91961cd09c35b75e3cc76e8 100644 (file)
@@ -1459,6 +1459,19 @@ void CSQC_UpdateView(float w, float h)
                float ons_roundlost = (gametype == MAPINFO_TYPE_ONSLAUGHT && STAT(ROUNDLOST));
                entity gen = world;
 
+               float vehicle_viewdist = 0;
+               vector vehicle_viewofs = '0 0 0';
+
+               if(vehicle_chase)
+               {
+                       if(hud != HUD_BUMBLEBEE_GUN)
+                       {
+                               Vehicle info = get_vehicleinfo(hud);
+                               vehicle_viewdist = info.height;
+                               vehicle_viewofs = info.view_ofs;
+                       }
+               }
+
                if(ons_roundlost)
                {
                        FOREACH_ENTITY_CLASS("onslaught_generator", it.health <= 0, LAMBDA(
@@ -1478,7 +1491,13 @@ void CSQC_UpdateView(float w, float h)
 
                        // detect maximum viewoffset and use it
                        vector view_offset = autocvar_cl_eventchase_viewoffset;
-                       if(vehicle_chase && autocvar_cl_eventchase_vehicle_viewoffset) { view_offset = autocvar_cl_eventchase_vehicle_viewoffset; }
+                       if(vehicle_chase)
+                       {
+                               if(vehicle_viewofs)
+                                       view_offset = vehicle_viewofs;
+                               else
+                                       view_offset = autocvar_cl_eventchase_vehicle_viewoffset;
+                       }
                        if(ons_roundlost) { view_offset = autocvar_cl_eventchase_generator_viewoffset; }
 
                        if(view_offset)
@@ -1495,7 +1514,13 @@ void CSQC_UpdateView(float w, float h)
 
                        // make the camera smooth back
                        float chase_distance = autocvar_cl_eventchase_distance;
-                       if(vehicle_chase && autocvar_cl_eventchase_vehicle_distance) { chase_distance = autocvar_cl_eventchase_vehicle_distance; }
+                       if(vehicle_chase)
+                       {
+                               if(vehicle_viewofs)
+                                       chase_distance = vehicle_viewdist;
+                               else
+                                       chase_distance = autocvar_cl_eventchase_vehicle_distance;
+                       }
                        if(ons_roundlost) { chase_distance = autocvar_cl_eventchase_generator_distance; }
 
                        if(autocvar_cl_eventchase_speed && eventchase_current_distance < chase_distance)
index 58a2b7330eb517c282cc0662f6d8493a01eb2f0e..7eef322569d61eb6e59641050aeac26045f43423 100644 (file)
@@ -31,6 +31,10 @@ CLASS(Vehicle, Object)
     ATTRIB(Vehicle, mins, vector, '-0 -0 -0')
     /** vehicle hitbox size */
     ATTRIB(Vehicle, maxs, vector, '0 0 0')
+    /** vehicle 3rd person view offset */
+    ATTRIB(Vehicle, view_ofs, vector, '0 0 0')
+    /** vehicle 3rd person view distance */
+    ATTRIB(Vehicle, height, float, 0)
 
     /** (BOTH) setup vehicle data */
     METHOD(Vehicle, vr_setup, void(Vehicle)) { }
index b567221c46b37f87bb6eaa4a045aa5233a576cf6..2169e8d7868ac4313eea2d02868804b03e8c3de7 100644 (file)
@@ -8,6 +8,8 @@ CLASS(Bumblebee, Vehicle)
 /* spawnflags */ ATTRIB(Bumblebee, spawnflags, int, VHF_DMGSHAKE);
 /* mins       */ ATTRIB(Bumblebee, mins, vector, '-245 -130 -130');
 /* maxs       */ ATTRIB(Bumblebee, maxs, vector, '230 130 130');
+/* view offset*/ ATTRIB(Bumblebee, view_ofs, vector, '0 0 300');
+/* view dist  */ ATTRIB(Bumblebee, height, float, 450);
 /* model         */ ATTRIB(Bumblebee, mdl, string, "models/vehicles/bumblebee_body.dpm");
 /* model         */ ATTRIB(Bumblebee, model, string, "models/vehicles/bumblebee_body.dpm");
 /* head_model */ ATTRIB(Bumblebee, head_model, string, "");
index 3c0eba96953cdfeebc1811a3959e746ea51dcf0a..ce3094091d42f8a9a313a86499f9efefc11e12ee 100644 (file)
@@ -7,6 +7,8 @@ CLASS(Racer, Vehicle)
 /* spawnflags */ ATTRIB(Racer, spawnflags, int, VHF_DMGSHAKE | VHF_DMGROLL);
 /* mins       */ ATTRIB(Racer, mins, vector, '-120 -120 -40' * 0.5);
 /* maxs       */ ATTRIB(Racer, maxs, vector, '120 120 40' * 0.5);
+/* view offset*/ ATTRIB(Racer, view_ofs, vector, '0 0 50');
+/* view dist  */ ATTRIB(Racer, height, float, 200);
 /* model         */ ATTRIB(Racer, mdl, string, "models/vehicles/wakizashi.dpm");
 /* model         */ ATTRIB(Racer, model, string, "models/vehicles/wakizashi.dpm");
 /* head_model */ ATTRIB(Racer, head_model, string, "null");
index 2c88c424d17a8ea9c6cff9616806acfea3296ed3..688d79385e0ed0b22ebdb586b02c6c166a2bc035 100644 (file)
@@ -8,6 +8,8 @@ CLASS(Raptor, Vehicle)
 /* spawnflags */ ATTRIB(Raptor, spawnflags, int, VHF_DMGSHAKE | VHF_DMGROLL);
 /* mins       */ ATTRIB(Raptor, mins, vector, '-80 -80 0');
 /* maxs       */ ATTRIB(Raptor, maxs, vector, '80 80 70');
+/* view offset*/ ATTRIB(Raptor, view_ofs, vector, '0 0 160');
+/* view dist  */ ATTRIB(Raptor, height, float, 200);
 /* model         */ ATTRIB(Raptor, mdl, string, "models/vehicles/raptor.dpm");
 /* model         */ ATTRIB(Raptor, model, string, "models/vehicles/raptor.dpm");
 /* head_model */ ATTRIB(Raptor, head_model, string, "");
index d7d5e1d6220d166252ab4fc07db815b7c4b2a54d..4e659e2539c90a1a8e53da3375610c43e66c60ea 100644 (file)
@@ -7,6 +7,8 @@ CLASS(Spiderbot, Vehicle)
 /* spawnflags */ ATTRIB(Spiderbot, spawnflags, int, VHF_DMGSHAKE);
 /* mins       */ ATTRIB(Spiderbot, mins, vector, '-75 -75 10');
 /* maxs       */ ATTRIB(Spiderbot, maxs, vector, '75 75 125');
+/* view offset*/ ATTRIB(Spiderbot, view_ofs, vector, '0 0 70');
+/* view dist  */ ATTRIB(Spiderbot, height, float, 170);
 /* model         */ ATTRIB(Spiderbot, mdl, string, "models/vehicles/spiderbot.dpm");
 /* model         */ ATTRIB(Spiderbot, model, string, "models/vehicles/spiderbot.dpm");
 /* head_model */ ATTRIB(Spiderbot, head_model, string, "models/vehicles/spiderbot_top.dpm");