#include "wall.qh"
#include "waypointsprites.qh"
-#include "../common/vehicles/vehicles.qh"
+#include "../common/vehicles/unit/bumblebee.qh"
#include "../common/vehicles/cl_vehicles.qh"
+#include "../common/vehicles/vehicles.qh"
#include "../common/net_notice.qh"
bool autocvar_cl_vehicles_hud_tactical = 1;
void Net_AuXair2(float bIsNew);
-void bumble_raygun_read(float bIsNew);
+
void Net_VehicleSetup();
-void CSQC_BUMBLE_GUN_HUD();
void RaptorCBShellfragDraw();
void RaptorCBShellfragToss(vector _org, vector _vel, vector _ang);
if(DEATH_ISWEAPON(deathtype, WEP_SEEKER))
damage *= autocvar_g_vehicles_tag_damagerate;
+ if(DEATH_WEAPONOFWEAPONDEATH(deathtype))
+ damage *= autocvar_g_vehicles_weapon_damagerate;
+
self.enemy = attacker;
self.pain_finished = time;
#ifdef SVQC
#include "../server/tturrets/include/turrets_early.qh"
+#include "sv_vehicles.qh"
// #define VEHICLES_USE_ODE
float autocvar_g_vehicles_allow_bots;
float autocvar_g_vehicles_teams;
float autocvar_g_vehicles_teleportable;
-var float autocvar_g_vehicles_vortex_damagerate = 0.5;
-var float autocvar_g_vehicles_machinegun_damagerate = 0.5;
-var float autocvar_g_vehicles_rifle_damagerate = 0.75;
-var float autocvar_g_vehicles_vaporizer_damagerate = 0.001;
-var float autocvar_g_vehicles_tag_damagerate = 5;
+float autocvar_g_vehicles_vortex_damagerate = 0.5;
+float autocvar_g_vehicles_machinegun_damagerate = 0.5;
+float autocvar_g_vehicles_rifle_damagerate = 0.75;
+float autocvar_g_vehicles_vaporizer_damagerate = 0.001;
+float autocvar_g_vehicles_tag_damagerate = 5;
+float autocvar_g_vehicles_weapon_damagerate = 1;
// flags:
.int vehicle_flags;
float vehicles_exit_running;
+// macros
+#define VEHICLE_UPDATE_PLAYER(ply,fld,vhname) \
+ ply.vehicle_##fld = (self.vehicle_##fld / autocvar_g_vehicle_##vhname##_##fld) * 100
+
#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
.float vehicle_enter_delay; // prevent players jumping to and from vehicles instantly
-// macros
-#define VEHICLE_UPDATE_PLAYER(ply,fld,vhname) \
- ply.vehicle_##fld = (self.vehicle_##fld / autocvar_g_vehicle_##vhname##_##fld) * 100
-
-#if 0
-#define vehicles_sweap_collision(orig,vel,dt,acm,mult) \
- traceline(orig, orig + vel * dt, MOVE_NORMAL, self); \
- if(trace_fraction != 1) \
- acm += normalize(self.origin - trace_endpos) * (vlen(vel) * mult)
-#endif
-
void vehicles_exit(float eject);
+float vehicle_initialize(float vehicle_id, float nodrop);
#endif
+
#endif
--- /dev/null
+#ifndef BUMBLEBEE_H
+#define BUMBLEBEE_H
+
+void bumble_raygun_read(bool bIsNew);
+
+void CSQC_BUMBLE_GUN_HUD();
+
+#endif
\ No newline at end of file
float autocvar_g_vehicle_racer_water_speed_forward;
float autocvar_g_vehicle_racer_water_speed_strafe;
+float autocvar_g_vehicle_racer_pitchlimit = 30;
+
+float autocvar_g_vehicle_racer_water_downforce = 0.03;
+float autocvar_g_vehicle_racer_water_upforcedamper = 15;
+
float autocvar_g_vehicle_racer_anglestabilizer;
float autocvar_g_vehicle_racer_downforce;
float autocvar_g_vehicle_racer_bouncestop;
vector autocvar_g_vehicle_racer_bouncepain;
+.float racer_watertime;
+
var vector racer_force_from_tag(string tag_name, float spring_length, float max_power);
void racer_align4point(float _delta)
//vehicles_sweap_collision(force_fromtag_origin, self.velocity, _delta, v_add, autocvar_g_vehicle_racer_collision_multiplier);
self.velocity += push_vector * _delta;
+
+ float uforce = autocvar_g_vehicle_racer_upforcedamper;
+
+ int cont = pointcontents(self.origin - '0 0 64');
+ if(cont == CONTENT_WATER || cont == CONTENT_LAVA || cont == CONTENT_SLIME)
+ {
+ uforce = autocvar_g_vehicle_racer_water_upforcedamper;
+
+ if(self.owner.BUTTON_CROUCH && time < self.air_finished)
+ self.velocity_z += 30;
+ else
+ self.velocity_z += 200;
+ }
- if(pointcontents(self.origin - '0 0 64') == CONTENT_WATER)
- if(self.owner.BUTTON_CROUCH && time < self.air_finished)
- self.velocity_z += 30;
- else
- self.velocity_z += 200;
// Anti ocilation
if(self.velocity_z > 0)
- self.velocity_z *= 1 - autocvar_g_vehicle_racer_upforcedamper * _delta;
+ self.velocity_z *= 1 - uforce * _delta;
push_vector_x = (fl_push - bl_push);
push_vector_x += (fr_push - br_push);
self.velocity_z -= 1600 * sys_frametime; // 2x grav looks better for this one
}
- if(pointcontents(self.origin - '0 0 32') == CONTENT_WATER)
+ int cont = pointcontents(self.origin - '0 0 32');
+ if(cont == CONTENT_WATER || cont == CONTENT_LAVA || cont == CONTENT_SLIME)
self.velocity_z += 200;
UpdateCSQCProjectile(self);
// Pitch
ftmp = autocvar_g_vehicle_racer_pitchspeed * frametime;
ftmp = bound(-ftmp, shortangle_f(player.v_angle_x - racer.angles_x, racer.angles_x), ftmp);
- racer.angles_x = bound(-30, anglemods(racer.angles_x + ftmp), 30);
+ racer.angles_x = bound(-autocvar_g_vehicle_racer_pitchlimit, anglemods(racer.angles_x + ftmp), autocvar_g_vehicle_racer_pitchlimit);
makevectors(racer.angles);
racer.angles_x *= -1;
df = racer.velocity * -autocvar_g_vehicle_racer_friction;
//racer.velocity_z = ftmp;
+ int cont = pointcontents(racer.origin);
if(vlen(player.movement) != 0)
{
- if(pointcontents(racer.origin) == CONTENT_WATER)
+ if(cont == CONTENT_WATER || cont == CONTENT_LAVA || cont == CONTENT_SLIME)
{
if(player.movement_x) { df += v_forward * ((player.movement_x > 0) ? autocvar_g_vehicle_racer_water_speed_forward : -autocvar_g_vehicle_racer_water_speed_forward); }
if(player.movement_y) { df += v_right * ((player.movement_y > 0) ? autocvar_g_vehicle_racer_water_speed_strafe : -autocvar_g_vehicle_racer_water_speed_strafe); }
racer.wait = time;
- if(pointcontents(racer.origin) == CONTENT_WATER)
+ if(cont == CONTENT_WATER || cont == CONTENT_LAVA || cont == CONTENT_SLIME)
{
racer.vehicle_energy -= autocvar_g_vehicle_racer_waterburn_cost * frametime;
df += (v_forward * autocvar_g_vehicle_racer_waterburn_speed);
sound (racer.tur_head, CH_TRIGGER_SINGLE, "misc/null.wav", VOL_VEHICLEENGINE, ATTEN_NORM);
}
- df -= v_up * (vlen(racer.velocity) * autocvar_g_vehicle_racer_downforce);
+ if(cont == CONTENT_WATER || cont == CONTENT_LAVA || cont == CONTENT_SLIME)
+ racer.racer_watertime = time;
+
+ float dforce = autocvar_g_vehicle_racer_downforce;
+ if(time - racer.racer_watertime <= 3)
+ dforce = autocvar_g_vehicle_racer_water_downforce;
+
+ df -= v_up * (vlen(racer.velocity) * dforce);
player.movement = racer.velocity += df * frametime;
if(!forbidWeaponUse(player))
vector df = self.velocity * -autocvar_g_vehicle_racer_friction;
df_z += (1 - trace_fraction) * autocvar_g_vehicle_racer_hoverpower + sin(time * 2) * (autocvar_g_vehicle_racer_springlength * 2);
- if(pointcontents(self.origin - '0 0 64') == CONTENT_WATER)
+ float forced = autocvar_g_vehicle_racer_upforcedamper;
+
+ int cont = pointcontents(self.origin - '0 0 64');
+ if(cont == CONTENT_WATER || cont == CONTENT_LAVA || cont == CONTENT_SLIME)
+ {
+ forced = autocvar_g_vehicle_racer_water_upforcedamper;
self.velocity_z += 200;
+ }
self.velocity += df * pushdeltatime;
if(self.velocity_z > 0)
- self.velocity_z *= 1 - autocvar_g_vehicle_racer_upforcedamper * pushdeltatime;
+ self.velocity_z *= 1 - forced * pushdeltatime;
self.angles_x *= 1 - (autocvar_g_vehicle_racer_anglestabilizer * pushdeltatime);
self.angles_z *= 1 - (autocvar_g_vehicle_racer_anglestabilizer * pushdeltatime);
{
switch(_imp)
{
+ case 1:
+ case 230:
+ self.vehicle.vehicle_weapon2mode = RSM_BOMB;
+ CSQCVehicleSetup(self, 0);
+ return true;
+ case 2:
+ case 231:
+ self.vehicle.vehicle_weapon2mode = RSM_FLARE;
+ CSQCVehicleSetup(self, 0);
+ return true;
+
case 10:
case 15:
case 18:
CSQCVehicleSetup(self, 0);
return true;
+ case 11:
case 12:
case 16:
case 19:
float autocvar_g_vehicle_spiderbot_speed_stop;
float autocvar_g_vehicle_spiderbot_speed_strafe;
float autocvar_g_vehicle_spiderbot_speed_walk;
+float autocvar_g_vehicle_spiderbot_speed_run = 700;
float autocvar_g_vehicle_spiderbot_turnspeed;
float autocvar_g_vehicle_spiderbot_turnspeed_strafe;
float autocvar_g_vehicle_spiderbot_movement_inertia;
self.gun2.cnt = time + self.attack_finished_single;
}
+.float jump_delay;
float spiderbot_frame()
{
vector ad, vf;
movelib_groundalign4point(autocvar_g_vehicle_spiderbot_springlength, autocvar_g_vehicle_spiderbot_springup, autocvar_g_vehicle_spiderbot_springblend, autocvar_g_vehicle_spiderbot_tiltlimit);
if(spider.flags & FL_ONGROUND)
+ spider.jump_delay = time; // reset now so movement can begin
+
+ //if(spider.flags & FL_ONGROUND)
{
+ if(spider.flags & FL_ONGROUND)
if(spider.frame == 4 && self.tur_head.wait != 0)
{
sound (self, CH_TRIGGER_SINGLE, "vehicles/spiderbot_land.wav", VOL_VEHICLEENGINE, ATTEN_NORM);
spider.frame = 5;
}
- if(player.BUTTON_JUMP && self.tur_head.wait < time)
+ if(!player.BUTTON_JUMP)
+ spider.BUTTON_JUMP = 0;
+
+ if((spider.flags & FL_ONGROUND) && player.BUTTON_JUMP && !spider.BUTTON_JUMP && self.tur_head.wait < time)
{
sound (self, CH_TRIGGER_SINGLE, "vehicles/spiderbot_jump.wav", VOL_VEHICLEENGINE, ATTEN_NORM);
//dprint("spiderbot_jump:", ftos(soundlength("vehicles/spiderbot_jump.wav")), "\n");
self.delay = 0;
self.tur_head.wait = time + 2;
- player.BUTTON_JUMP = 0;
- spider.velocity = v_forward * 700 + v_up * 600;
+ spider.jump_delay = time + 2;
+ spider.BUTTON_JUMP = 1; // set spider's jump
+ //player.BUTTON_JUMP = 0;
+
+ vector movefix = '0 0 0';
+ if(player.movement_x > 0) movefix_x = 1;
+ if(player.movement_x < 0) movefix_x = -1;
+ if(player.movement_y > 0) movefix_y = 1;
+ if(player.movement_y < 0) movefix_y = -1;
+
+ vector rt = movefix_y * v_right;
+ vector sd = movefix_x * v_forward;
+ if(movefix_y == 0 && movefix_x == 0)
+ sd = v_forward; // always do forward
+
+ spider.flags &= ~FL_ONGROUND;
+
+ spider.velocity = sd * 700 + rt * 600 + v_up * 600;
spider.frame = 4;
}
- else
+ else if(time >= spider.jump_delay)
{
if(vlen(player.movement) == 0)
{
- if(self.sound_nexttime < time || self.delay != 3)
+ if(spider.flags & FL_ONGROUND)
{
- 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, CH_TRIGGER_SINGLE, "vehicles/spiderbot_idle.wav", VOL_VEHICLEENGINE, ATTEN_NORM);
+ if(self.sound_nexttime < time || self.delay != 3)
+ {
+ 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, CH_TRIGGER_SINGLE, "vehicles/spiderbot_idle.wav", VOL_VEHICLEENGINE, ATTEN_NORM);
+ }
+ movelib_beak_simple(autocvar_g_vehicle_spiderbot_speed_stop);
+ spider.frame = 5;
}
- movelib_beak_simple(autocvar_g_vehicle_spiderbot_speed_stop);
- spider.frame = 5;
}
else
{
if(player.movement_x > 0)
{
player.movement_x = 1;
- spider.frame = 0;
+ if(spider.flags & FL_ONGROUND)
+ spider.frame = 0;
}
else if(player.movement_x < 0)
{
player.movement_x = -1;
- spider.frame = 1;
+ if(spider.flags & FL_ONGROUND)
+ spider.frame = 1;
}
player.movement_y = 0;
- movelib_move_simple(normalize(v_forward * player.movement_x),autocvar_g_vehicle_spiderbot_speed_walk,autocvar_g_vehicle_spiderbot_movement_inertia);
-
+ float oldvelz = spider.velocity_z;
+ movelib_move_simple(normalize(v_forward * player.movement_x),((player.BUTTON_JUMP) ? autocvar_g_vehicle_spiderbot_speed_run : autocvar_g_vehicle_spiderbot_speed_walk),autocvar_g_vehicle_spiderbot_movement_inertia);
+ spider.velocity_z = oldvelz;
+ float g = ((autocvar_sv_gameplayfix_gravityunaffectedbyticrate) ? 0.5 : 1);
+ if(spider.velocity_z <= 20) // not while jumping
+ spider.velocity_z -= g * sys_frametime * autocvar_sv_gravity;
+ if(spider.flags & FL_ONGROUND)
if(self.sound_nexttime < time || self.delay != 1)
{
self.delay = 1;
if(player.movement_y < 0)
{
player.movement_y = -1;
- spider.frame = 2;
+ if(spider.flags & FL_ONGROUND)
+ spider.frame = 2;
}
else if(player.movement_y > 0)
{
player.movement_y = 1;
- spider.frame = 3;
+ if(spider.flags & FL_ONGROUND)
+ spider.frame = 3;
}
+
+ float oldvelz = spider.velocity_z;
movelib_move_simple(normalize(v_right * player.movement_y),autocvar_g_vehicle_spiderbot_speed_strafe,autocvar_g_vehicle_spiderbot_movement_inertia);
+ spider.velocity_z = oldvelz;
+ float g = ((autocvar_sv_gameplayfix_gravityunaffectedbyticrate) ? 0.5 : 1);
+ if(spider.velocity_z <= 20) // not while jumping
+ spider.velocity_z -= g * sys_frametime * autocvar_sv_gravity;
+ if(spider.flags & FL_ONGROUND)
if(self.sound_nexttime < time || self.delay != 2)
{
self.delay = 2;
self.vehicle_hudmodel.viewmodelforclient = self;
}
-float spiderbot_impulse(float _imp)
+bool spiderbot_impulse(int _imp)
{
switch(_imp)
{
+ case 1:
+ case 230:
+ self.vehicle.vehicle_weapon2mode = SBRM_VOLLY;
+ CSQCVehicleSetup(self, 0);
+ return true;
+ case 2:
+ case 231:
+ self.vehicle.vehicle_weapon2mode = SBRM_GUIDE;
+ CSQCVehicleSetup(self, 0);
+ return true;
+ case 3:
+ case 232:
+ case 251:
+ self.vehicle.vehicle_weapon2mode = SBRM_ARTILLERY;
+ CSQCVehicleSetup(self, 0);
+ return true;
+
case 10:
case 15:
case 18:
//centerprint(self, strcat("Rocket mode is ", ftos(self.vehicle.vehicle_weapon2mode)));
CSQCVehicleSetup(self, 0);
return true;
+ case 11:
case 12:
case 16:
case 19:
#ifndef VEHICLES_H
#define VEHICLES_H
+#include "sv_vehicles.qh"
+
// vehicle requests
const int VR_SETUP = 1; // (BOTH) setup vehicle data
const int VR_THINK = 2; // (SERVER) logic to run every frame