case ENT_CLIENT_GAUNTLET: Ent_ReadHook(bIsNewEntity, ENT_CLIENT_GAUNTLET); break;
case ENT_CLIENT_ACCURACY: Ent_ReadAccuracy(); break;
case ENT_CLIENT_AUXILIARYXHAIR: Net_AuXair2(bIsNewEntity); break;
- case ENT_CLIENT_VEHICLE: read_vehicle(bIsNewEntity); break;
default:
//error(strcat(_("unknown entity type in CSQC_Ent_Update: %d\n"), self.enttype));
error(sprintf(_("Unknown entity type in CSQC_Ent_Update (enttype: %d, edict: %d, classname: %s)\n"), self.enttype, num_for_edict(self), self.classname));
main.qh
vehicles/vehicles.qh
-../server/vehicles/vehicles_def.qh
sortlist.qc
miscfunctions.qc
target_music.qc
vehicles/vehicles.qc
-../server/vehicles/network.qc
-../server/vehicles/racer.qc
shownames.qh
shownames.qc
player.BUTTON_ZOOM = player.BUTTON_CROUCH = 0;
self = racer;
-
-#ifdef VEHICLES_CSQC
- racer.SendFlags |= VSF_MOVEMENT;
-
- // Send a origin update every 10'th serevr frame.
- racer.framecounter += 1;
- if(racer.framecounter >= 600)
- {
- racer.SendFlags |= VSF_ORIGIN;
- racer.framecounter = 0;
- }
-#endif
if(player.BUTTON_USE)
{
crosshair_trace(player);
-#if VEHICLES_VIEWROTATE_CROSSHAIR
- float ftmp2;
- racer.angles_x *= -1;
- df = vectoangles(normalize(trace_endpos - self.origin + '0 0 32'));
- if(df_x > 180) df_x -= 360;
- if(df_x < -180) df_x += 360;
- if(df_y > 180) df_y -= 360;
- if(df_y < -180) df_y += 360;
-
- // Yaw
- ftmp = autocvar_g_vehicle_racer_turnspeed * frametime;
- ftmp2 = ftmp * -1;
-
- ftmp = bound(ftmp2, shortangle_f(df_y - racer.angles_y, racer.angles_y), ftmp);
- ftmp2 = anglemods(racer.angles_y + ftmp);
-
- // Roll
- ftmp = bound(-45, shortangle_f(df_z + ((racer.angles_y - ftmp2) * autocvar_g_vehicle_racer_turnroll), racer.angles_z), 45);
- ftmp = anglemods(racer.angles_z + ftmp) * frametime;
- racer.angles_z = bound(-65, racer.angles_z + ftmp, 65);
-
- // Turn
- racer.angles_y = ftmp2;
-
- // Pitch
- ftmp = autocvar_g_vehicle_racer_pitchspeed * frametime;
- ftmp2 = ftmp * -1;
-
- ftmp = bound(ftmp2, shortangle_f(player.v_angle_x - racer.angles_x, racer.angles_x), ftmp);
- racer.angles_x = anglemods(racer.angles_x + ftmp);
-
- makevectors(racer.angles);
- racer.angles_x *= -1;
-#else
racer.angles_x *= -1;
// Yaw
makevectors(racer.angles);
racer.angles_x *= -1;
-#endif
+
ftmp = racer.velocity_z;
df = racer.velocity * -autocvar_g_vehicle_racer_friction;
{
self.sounds = 1;
self.sound_nexttime = time + 10.922667; //soundlength("vehicles/racer_move.wav");
- sound (self, CHAN_VOICE, "vehicles/racer_move.wav", VOL_BASE, ATTN_NORM);
+ sound (self, CHAN_VOICE, "vehicles/racer_move.wav", VOL_VEHICLEENGINE, ATTN_NORM);
}
}
else
{
self.sounds = 0;
self.sound_nexttime = time + 11.888604; //soundlength("vehicles/racer_idle.wav");
- sound (self, CHAN_VOICE, "vehicles/racer_idle.wav", VOL_BASE, ATTN_NORM);
+ sound (self, CHAN_VOICE, "vehicles/racer_idle.wav", VOL_VEHICLEENGINE, ATTN_NORM);
}
}
{
//self.sounds = 2;
self.strength_finished = time + 10.922667; //soundlength("vehicles/racer_boost.wav");
- sound (self, CHAN_PLAYER, "vehicles/racer_boost.wav", VOL_BASE, ATTN_NORM);
+ sound (self, CHAN_PLAYER, "vehicles/racer_boost.wav", VOL_VEHICLEENGINE, ATTN_NORM);
}
}
else
{
self.strength_finished = 0;
- sound (self, CHAN_PLAYER, "misc/null.wav", VOL_BASE, ATTN_NORM);
+ sound (self, CHAN_PLAYER, "misc/null.wav", VOL_VEHICLEENGINE, ATTN_NORM);
}
*/
racer_align4point(); //time - self.nextthink);
-#ifdef VEHICLES_CSQC
- self.SendFlags |= VSF_MOVEMENT;
- // Send a origin update every 10'th serevr frame.
- self.framecounter += 1;
- if(self.framecounter >= 10)
- {
- self.SendFlags |= VSF_ORIGIN;
- self.framecounter = 0;
- }
-#endif
/*
//if(self.velocity_z > 0)
// self.velocity_z *= 0.95;
self.movetype = MOVETYPE_BOUNCE;
self.owner.vehicle_health = (self.vehicle_health / autocvar_g_vehicle_racer_health);
self.owner.vehicle_shield = (self.vehicle_shield / autocvar_g_vehicle_racer_shield);
-#ifdef VEHICLES_CSQC
- if(self.SendEntity)
- self.SendFlags |= VSF_SETUP;
-#endif
}
void racer_exit(float eject)
self.nextthink = 2 + time + random() * 3;
}
-#ifdef VEHICLES_CSQC
-void racer_send_exta(entity to)
-{
-
-}
-#endif
-
void racer_dinit()
{
if not (vehicle_initialize(
remove(self);
return;
}
-#ifdef VEHICLES_CSQC
- self.vehile_send_exta = racer_send_exta;
-#endif
+
if(autocvar_g_vehicle_racer_hovertype != 0)
racer_force_from_tag = vehicles_force_fromtag_maglev;
else
self.think = racer_dinit;
self.nextthink = time + (autocvar_g_vehicles_delayspawn ? autocvar_g_vehicle_racer_respawntime + (random() * autocvar_g_vehicles_delayspawn_jitter) : 0.5);
}
-
#endif // SVQC
-
-#ifdef CSQC
-#ifdef VEHICLES_CSQC
-void racer_draw()
-{
- /*float dt;
-
- dt = time - self.lastupdate;
- self.lastupdate = time;
- if(dt < 0)
- return;
- */
- //self.origin += dt * self.velocity;
- //self.origin_z -= dt * getstatf(STAT_MOVEVARS_GRAVITY);
- //setorigin(self, self.origin);
-
- if(vehicle_hudmodel.owner == self)
- {
- setorigin(vehicle_hudmodel, self.origin);
- vehicle_hudmodel.angles = self.angles;
- }
-
-
-}
-
-void racer_draw2d()
-{
-
-}
-
-void racer_read_extra()
-{
-
-}
-
-entity racer_hud;
-entity racer_vp;
-void racer_hud_draw()
-{
-
-}
-
-void vehicle_racer_assemble()
-{
- setmodel(self, "models/vehicles/wakizashi.dpm");
- self.scale = 0.5;
- self.movetype = MOVETYPE_BOUNCE;
-
- //self.entremove = VehicleRacerRemove;
- setsize(self, '-60 -60 -20', '60 60 20');
- self.draw = racer_draw;
- self.drawmask = MASK_NORMAL;
- self.solid = SOLID_BBOX;
- self.lastupdate = time;
- self.vehile_read_exta = racer_read_extra;
-
- if(racer_hud == world)
- {
- dprint("SpawnHUUUOOOUUUDDD\n");
- racer_hud = spawn();
- setmodel(racer_hud, "models/vehicles/wakizashi_cockpit.dpm");
- racer_hud.drawmask = MASK_NORMAL;
- racer_hud.renderflags = RF_VIEWMODEL;
- racer_hud.scale = 0.5;
- }
- vehicle_hudmodel = racer_hud; // FIXME!!
- racer_hud.draw = racer_hud_draw;
-}
-#endif
-#endif //CSQC
.entity bomb1;
.entity bomb2;
-//#define RAPTOR_RETARDCAMERA
-
float raptor_altitude(float amax)
{
tracebox(self.origin, self.mins, self.maxs, self.origin - ('0 0 1' * amax), TRUE, self);
entity bomblet;
float i;
- //sound (self, CHAN_PROJECTILE, "weapons/rocket_impact.wav", VOL_BASE, ATTN_NORM);
- //pointparticles(particleeffectnum("raptor_bomb_spread"), self.origin, self.velocity, 1);
-
Damage_DamageInfo(self.origin, 0, 0, 0, '0 0 0', DEATH_RAPTOR_BOMB_SPLIT, self);
for(i = 0; i < autocvar_g_vehicle_raptor_bomblets; ++i)
{
entity bomb_1, bomb_2;
- //self.bomb1.alpha = 0;
- //self.bomb2.alpha = 0;
-
bomb_1 = spawn();
bomb_2 = spawn();
self.delay = time + autocvar_g_vehicle_raptor_bombs_refire;
self.lip = time;
-#ifdef RAPTOR_RETARDCAMERA
- setorigin(self.vehicle_viewport, self.origin);
-#endif
}
void raptor_land()
if(self.sound_nexttime < time)
{
self.sound_nexttime = time + 7.955812; //soundlength("vehicles/raptor_fly.wav");
- sound (self, CHAN_VOICE, "vehicles/raptor_fly.wav", VOL_BASE, ATTN_NORM);
+ sound (self, CHAN_VOICE, "vehicles/raptor_fly.wav", VOL_VEHICLEENGINE, ATTN_NORM);
}
// Takeoff sequense
}
crosshair_trace(player);
-#if VEHICLES_VIEWROTATE_CROSSHAIR
- df = vectoangles(normalize(trace_endpos - self.origin + '0 0 32'));
- if(df_x > 180) df_x -= 360;
- if(df_x < -180) df_x += 360;
- if(df_y > 180) df_y -= 360;
- if(df_y < -180) df_y += 360;
- // Rotate Body
- ftmp = autocvar_g_vehicle_raptor_turnspeed * sys_frametime;
- ftmp = bound(-ftmp, shortangle_f(df_y - raptor.angles_y, raptor.angles_y), ftmp);
-
- // Turn
- //raptor.angles_y = anglemods(raptor.angles_y + ftmp);
- raptor.avelocity_y = anglemods(raptor.angles_y + ftmp);
-
- // Pitch Body
- ftmp = autocvar_g_vehicle_raptor_pitchspeed * sys_frametime;
- ftmp = bound(-ftmp, shortangle_f(df_x - raptor.angles_x, raptor.angles_x), ftmp);
-
- //raptor.angles_x = bound(-autocvar_g_vehicle_raptor_pitchlimit, anglemods(raptor.angles_x + ftmp), autocvar_g_vehicle_raptor_pitchlimit);
- raptor.avelocity_x = bound(-autocvar_g_vehicle_raptor_pitchlimit, anglemods(raptor.angles_x + ftmp), autocvar_g_vehicle_raptor_pitchlimit);
-#else
vector vang;
vang = raptor.angles;
df = vectoangles(normalize(trace_endpos - self.origin + '0 0 32'));
raptor.angles_y = anglemods(raptor.angles_y);
raptor.angles_z = anglemods(raptor.angles_z);
-#endif
if(autocvar_g_vehicle_raptor_movestyle == 1)
makevectors('0 1 0' * raptor.angles_y);
else
makevectors(player.v_angle);
-#ifdef RAPTOR_RETARDCAMERA
- float spd, back, up;
- spd = vlen(self.velocity) + 0.01;
- back = spd / autocvar_g_vehicle_raptor_speed_forward;
- up = 1 - back;
- back = back;
- back = back * 1250;
- back += 150;
- up = up * 200;
- up = up + 100;
-
- setorigin(self.vehicle_viewport, self.origin + (v_up * up) + (v_forward * -back));
-#endif
-
df = raptor.velocity * -autocvar_g_vehicle_raptor_friction;
if(player.movement_x != 0)
self.gun1 = spawn();
self.gun2 = spawn();
-#ifdef RAPTOR_RETARDCAMERA
- setattachment(self.vehicle_viewport, world, "");
-#endif
-
setmodel(self.bomb1,"models/vehicles/clusterbomb_folded.md3");
setmodel(self.bomb2,"models/vehicles/clusterbomb_folded.md3");
setmodel(self.gun1, "models/vehicles/raptor_gun.dpm");
self.nextthink = time + (autocvar_g_vehicles_delayspawn ? autocvar_g_vehicle_raptor_respawntime + (random() * autocvar_g_vehicles_delayspawn_jitter) : 0.5);
}
#endif // SVQC
-
-#ifdef CSQC
-void raptor_draw()
-{
-
-}
-
-void raptor_draw2d()
-{
-
-}
-
-void raptor_read_extra()
-{
-
-}
-
-void vehicle_raptor_assemble()
-{
-
-}
-#endif //CSQC
player = self;
spider = self.vehicle;
+ self = spider;
player.BUTTON_ZOOM = 0;
player.BUTTON_CROUCH = 0;
if(player.BUTTON_USE)
{
- self = spider;
vehicles_exit(VHEF_NORMAL);
self = player;
return 0;
}
- self = spider;
-
crosshair_trace(player);
//UpdateAuxiliaryXhair(player, trace_endpos, ('1 0 0' * player.vehicle_reload2) + ('0 1 0' * (1 - player.vehicle_reload2)), 2);
-#if VEHICLES_VIEWROTATE_CROSSHAIR
- ad = vectoangles(normalize(trace_endpos - gettaginfo(spider.tur_head,gettagindex(spider.tur_head,"tag_hud")))) - (spider.tur_head.angles + spider.angles);
- if(ad_x > 180) ad_x -= 360;
- if(ad_x < -180) ad_x += 360;
- if(ad_y > 180) ad_y -= 360;
- if(ad_y < -180) ad_y += 360;
-
- // Rotate head
- ftmp = autocvar_g_vehicle_spiderbot_head_turnspeed * sys_frametime;
- ad_y = bound(-ftmp, ad_y, ftmp);
- spider.tur_head.angles_y = bound(autocvar_g_vehicle_spiderbot_head_turnlimit * -1, spider.tur_head.angles_y + ad_y, autocvar_g_vehicle_spiderbot_head_turnlimit);
-
- // Pitch head
- ftmp = autocvar_g_vehicle_spiderbot_head_pitchspeed * sys_frametime;
- //ad_x = bound(-ftmp, ad_x, ftmp);
- spider.tur_head.angles_x = bound(autocvar_g_vehicle_spiderbot_head_pitchlimit_down, spider.tur_head.angles_x + ad_x, autocvar_g_vehicle_spiderbot_head_pitchlimit_up);
-
- // Turn Body
- ftmp = autocvar_g_vehicle_spiderbot_turnspeed * sys_frametime;
- ftmp = bound(-ftmp, spider.tur_head.angles_y, ftmp);
-#else
-
player.v_angle_x *= -1;
ad = player.v_angle - (spider.tur_head.angles + spider.angles);
player.v_angle_x *= -1;
ftmp = autocvar_g_vehicle_spiderbot_turnspeed * sys_frametime;
ftmp = bound(-ftmp, spider.tur_head.angles_y, ftmp);
-#endif
makevectors(spider.angles + '-2 0 0' * spider.angles_x);
/*
{
if(spider.frame == 4 && self.tur_head.wait != 0)
{
- sound (self, CHAN_VOICE, "vehicles/spiderbot_land.wav", VOL_BASE, ATTN_NORM);
+ sound (self, CHAN_VOICE, "vehicles/spiderbot_land.wav", VOL_VEHICLEENGINE, ATTN_NORM);
spider.frame = 5;
}
if(player.BUTTON_JUMP && self.tur_head.wait < time)
{
- sound (self, CHAN_VOICE, "vehicles/spiderbot_jump.wav", VOL_BASE, ATTN_NORM);
+ sound (self, CHAN_VOICE, "vehicles/spiderbot_jump.wav", VOL_VEHICLEENGINE, ATTN_NORM);
//dprint("spiderbot_jump:", ftos(soundlength("vehicles/spiderbot_jump.wav")), "\n");
self.delay = 0;
self.delay = 3;
self.sound_nexttime = time + 6.486500; //soundlength("vehicles/spiderbot_idle.wav");
//dprint("spiderbot_idle:", ftos(soundlength("vehicles/spiderbot_idle.wav")), "\n");
- sound (self, CHAN_VOICE, "vehicles/spiderbot_idle.wav", VOL_BASE, ATTN_NORM);
+ sound (self, CHAN_VOICE, "vehicles/spiderbot_idle.wav", VOL_VEHICLEENGINE, ATTN_NORM);
}
movelib_beak_simple(autocvar_g_vehicle_spiderbot_speed_stop);
spider.frame = 5;
{
self.delay = 1;
self.sound_nexttime = time + 6.486500; //soundlength("vehicles/spiderbot_walk.wav");
- sound (self, CHAN_VOICE, "vehicles/spiderbot_walk.wav", VOL_BASE, ATTN_NORM);
+ sound (self, CHAN_VOICE, "vehicles/spiderbot_walk.wav", VOL_VEHICLEENGINE, ATTN_NORM);
//dprint("spiderbot_walk:", ftos(soundlength("vehicles/spiderbot_walk.wav")), "\n");
}
}
{
self.delay = 2;
self.sound_nexttime = time + 6.486500; //soundlength("vehicles/spiderbot_strafe.wav");
- sound (self, CHAN_VOICE, "vehicles/spiderbot_strafe.wav", VOL_BASE, ATTN_NORM);
+ sound (self, CHAN_VOICE, "vehicles/spiderbot_strafe.wav", VOL_VEHICLEENGINE, ATTN_NORM);
//dprint("spiderbot_strafe:", ftos(soundlength("vehicles/spiderbot_strafe.wav")), "\n");
}
}
void spiderbot_die()
{
sound (self, CHAN_VOICE, "vehicles/spiderbot_die.wav", VOL_BASE, ATTN_NORM);
- //sound (self, CHAN_PROJECTILE, "weapons/rocket_impact.wav", VOL_BASE, ATTN_NORM);
pointparticles(particleeffectnum("explosion_medium"), self.origin + '0 0 100', '0 0 0', 1);
self.health = 0;
self.nextthink = time + (autocvar_g_vehicles_delayspawn ? autocvar_g_vehicle_spiderbot_respawntime + (random() * autocvar_g_vehicles_delayspawn_jitter) : 0.5);
}
#endif // SVQC
-
-#ifdef CSQC
-void spiderbot_draw()
-{
-
-}
-
-void spiderbot_draw2d()
-{
-
-}
-
-void spiderbot_read_extra()
-{
-
-}
-
-void vehicle_spiderbot_assemble()
-{
-
-}
-#endif //CSQC
/** AuxiliaryXhair*
- Send addictional points of interest to be drawn, to vehicle owner
+ Send additional points of interest to be drawn, to vehicle owner
**/
float MAX_AXH = 4;
.entity AuxiliaryXhair[MAX_AXH];
*/
// End AuxiliaryXhair
+/**
+ Notifies the client that he enterd a vehicle, and sends
+ realavent data.
+
+ only sends vehicle_id atm (wich is a HUD_* constant, ex. HUD_SPIDERBOT)
+**/
void CSQCVehicleSetup(entity own, float vehicle_id)
{
msg_entity = own;
return;
}
-
if(trace_ent != world)
{
// End generic vehile projectile system
/** vehicles_spawn
- Exetuted for all vehiles on (re)spawn.
+ Exetuted for all vehicles on (re)spawn.
Sets defaults for newly spawned units.
**/
void vehicles_spawn()
// .viewmodelforclient works better.
//self.vehicle_hudmodel.drawonlytoclient = self.owner;
-#ifndef VEHICLES_CSQC
- self.vehicle_hudmodel.viewmodelforclient = self.owner;
-#endif
+ self.vehicle_hudmodel.viewmodelforclient = self.owner;
self.event_damage = vehicles_damage;
self.nextthink = 0;
self.team = self.owner.team;
self.flags -= FL_NOTARGET;
-#ifndef VEHICLES_CSQC
msg_entity = other;
WriteByte (MSG_ONE, SVC_SETVIEWPORT);
WriteEntity(MSG_ONE, self.vehicle_viewport);
WriteAngle(MSG_ONE, self.angles_y); // yaw
WriteAngle(MSG_ONE, 0); // roll
}
-#endif
-//#endif
vehicles_clearrturn();
self.vehicle_enter();
}
+/** vehicles_findgoodexit
+ Locates a valid location for the player to exit the vehicle.
+ Will first try prefer_spot, then up 100 random spots arround the vehicle
+ wich are in direct line of sight and empty enougth to hold a players bbox
+**/
vector vehicles_findgoodexit(vector prefer_spot)
{
vector exitspot;
return self.origin;
}
+/** vehicles_exit
+ Standarrd vehicle release fucntion.
+ custom code goes in self.vehicle_exit
+**/
void vehicles_exit(float eject)
{
self.flags |= FL_NOTARGET;
ret.nextthink = time + 0.1;
return;
}
-
ret = ret.chain;
}
}
ret.enemy = self;
ret.think = vehicles_return;
ret.nextthink = time + self.vehicle_respawntime;
-}
-
-float vehicles_customizeentityforclient()
-{
- if(self.deadflag == DEAD_DEAD)
- return FALSE;
- else
- return TRUE;
-}
+}
void vehicles_configcheck(string configname, float check_cvar)
{
self.iscreature = TRUE;
self.hud = vhud;
- //self.customizeentityforclient = vehicles_customizeentityforclient;
self.vehicle_die = dieproc;
self.vehicle_exit = exitfunc;
self.vehicle_enter = enterproc;
self.pos1 = self.origin;
self.pos2 = self.angles;
-#ifdef VEHICLES_CSQC
- if(use_csqc)
- net_link_vehile();
-#endif
+
return TRUE;
}
-
void bugmenot()
{
self.vehicle_exit = self.vehicle_exit;
#ifdef VEHICLES_ENABLED
-//#include "collision.qc"
-#include "network.qc"
#include "vehicles.qc"
#include "racer.qc"
-//#define VEHICLES_CSQC
// #define VEHICLES_USE_ODE
#define VEHICLES_ENABLED
#ifdef VEHICLES_ENABLED
-//#define VEHICLES_VIEWROTATE_CROSSHAIR
//#message "with tZork vehicles (experimental)"
.float vehicle_flags;
.float vehicle_ammo2; /// If self is player this field's use depends on the individual vehile. If self is vehile, this is the real ammo2 value.
.float vehicle_reload2; /// If self is player this field's use depends on the individual vehile. If self is vehile, this is the real reload2 value.
-#ifdef SVQC
.entity vehicle;
.entity vehicle_viewport;
.entity vehicle_hudmodel;
.float sound_nexttime;
+#define VOL_VEHICLEENGINE 1
.float hud;
.float dmg_time;
var .void() vehicle_die; /// Vehicles custom function to be executed when vehile die
var .void() vehicle_spawn; /// Vehicles custom fucntion to be efecuted when vehicle (re)spawns
-#ifdef VEHICLES_CSQC
-.float framecounter; /// Used to count server frames, so that we may send soem updates less often
-var .void(entity to, float sflags) vehile_send_exta; /// Vehicles custom send func
-void net_link_vehile(); /// Initiates csqc networking for vehicle
-#endif //VEHICLES_CSQC
-#endif //SVQC
-
-#ifdef CSQC
-#ifdef VEHICLES_CSQC
-.float vehicle_hud;
-
-entity vehicle;
-entity vehicle_viewport;
-entity vehicle_hudmodel;
-
-void vehicle_spiderbot_assemble();
-void vehicle_racer_assemble();
-void vehicle_raptor_assemble();
-void vehicle_bumblebee_assemble();
-void read_vehicle(float bIsNew);
-var .void (float sf)vehile_read_exta;
-#endif //VEHICLES_CSQC
-#endif //CSQC
-
#ifdef VEHICLES_USE_ODE
void(entity e, float physics_enabled) physics_enable = #540; // enable or disable physics on object
void(entity e, vector force, vector force_pos) physics_addforce = #541; // apply a force from certain origin, length of force vector is power of force