From: Mario Date: Sat, 2 Jan 2016 08:37:52 +0000 (+1000) Subject: Make view offset and view height attributes to vehicles X-Git-Tag: xonotic-v0.8.2~1322 X-Git-Url: http://git.xonotic.org/?a=commitdiff_plain;h=a4e7352b17ac26fde335abcc1b21c19228d253f2;p=xonotic%2Fxonotic-data.pk3dir.git Make view offset and view height attributes to vehicles --- diff --git a/qcsrc/client/view.qc b/qcsrc/client/view.qc index 207a46883..80b1770c3 100644 --- a/qcsrc/client/view.qc +++ b/qcsrc/client/view.qc @@ -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) diff --git a/qcsrc/common/vehicles/vehicle.qh b/qcsrc/common/vehicles/vehicle.qh index 58a2b7330..7eef32256 100644 --- a/qcsrc/common/vehicles/vehicle.qh +++ b/qcsrc/common/vehicles/vehicle.qh @@ -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)) { } diff --git a/qcsrc/common/vehicles/vehicle/bumblebee.qc b/qcsrc/common/vehicles/vehicle/bumblebee.qc index b567221c4..2169e8d78 100644 --- a/qcsrc/common/vehicles/vehicle/bumblebee.qc +++ b/qcsrc/common/vehicles/vehicle/bumblebee.qc @@ -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, ""); diff --git a/qcsrc/common/vehicles/vehicle/racer.qc b/qcsrc/common/vehicles/vehicle/racer.qc index 3c0eba969..ce3094091 100644 --- a/qcsrc/common/vehicles/vehicle/racer.qc +++ b/qcsrc/common/vehicles/vehicle/racer.qc @@ -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"); diff --git a/qcsrc/common/vehicles/vehicle/raptor.qc b/qcsrc/common/vehicles/vehicle/raptor.qc index 2c88c424d..688d79385 100644 --- a/qcsrc/common/vehicles/vehicle/raptor.qc +++ b/qcsrc/common/vehicles/vehicle/raptor.qc @@ -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, ""); diff --git a/qcsrc/common/vehicles/vehicle/spiderbot.qc b/qcsrc/common/vehicles/vehicle/spiderbot.qc index d7d5e1d62..4e659e253 100644 --- a/qcsrc/common/vehicles/vehicle/spiderbot.qc +++ b/qcsrc/common/vehicles/vehicle/spiderbot.qc @@ -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");