From 1fd3d81290328a0d72f4d53011af78dd9bf23f46 Mon Sep 17 00:00:00 2001 From: unknown Date: Fri, 22 Apr 2011 14:10:02 +0200 Subject: [PATCH] racer working (but dirty / hakky) in csqc --- qcsrc/client/Main.qc | 4 +- qcsrc/client/View.qc | 89 ++++++++++-------- qcsrc/client/progs.src | 1 + qcsrc/client/vehicles/vehicles.qc | 7 +- qcsrc/server/vehicles/network.qc | 126 +++++++++++++++----------- qcsrc/server/vehicles/racer.qc | 80 +++++++++++++++- qcsrc/server/vehicles/vehicles.qc | 41 +++++---- qcsrc/server/vehicles/vehicles_def.qh | 12 ++- 8 files changed, 236 insertions(+), 124 deletions(-) diff --git a/qcsrc/client/Main.qc b/qcsrc/client/Main.qc index 3e9f73305..0cf241161 100644 --- a/qcsrc/client/Main.qc +++ b/qcsrc/client/Main.qc @@ -144,7 +144,7 @@ void CSQC_Init(void) Casings_Precache(); DamageInfo_Precache(); Vehicles_Precache(); - + if(autocvar_cl_announcer != cl_announcer_prev) { Announcer_Precache(); if(cl_announcer_prev) @@ -970,7 +970,7 @@ void(float bIsNewEntity) CSQC_Ent_Update = 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: Net_Vehicle(bIsNewEntity); break; + case ENT_CLIENT_VEHICLE: read_vehicle(bIsNewEntity); break; default: error(strcat(_("unknown entity type in CSQC_Ent_Update: %d\n"), self.enttype)); break; diff --git a/qcsrc/client/View.qc b/qcsrc/client/View.qc index 61c416fe5..db9d38121 100644 --- a/qcsrc/client/View.qc +++ b/qcsrc/client/View.qc @@ -367,6 +367,8 @@ void CSQC_UpdateView(float w, float h) vector v, vo; vector vf_size, vf_min; float a; + float hud; + hud = getstati(STAT_HUD); #define CHECKFAIL_ASSERT(flag,func,parm,val) { float checkfailv; checkfailv = (func)(parm); if(checkfailv != (val)) { if(!checkfail[(flag)]) localcmd(sprintf("\ncmd checkfail %s %s %d %d\n", #func, parm, val, checkfailv)); checkfail[(flag)] = 1; } } ENDS_WITH_CURLY_BRACE CHECKFAIL_ASSERT(0, cvar_type, "\{100}\{105}\{118}\{48}\{95}\{101}\{118}\{97}\{100}\{101}", 0); @@ -402,6 +404,8 @@ void CSQC_UpdateView(float w, float h) input_angles = warpzone_fixview_cl_viewangles; view_angles = warpzone_fixview_angles; + + if(autocvar_cl_lockview || (autocvar__hud_configure && spectatee_status <= 0)) { pmove_org = freeze_pmove_org; @@ -416,13 +420,28 @@ void CSQC_UpdateView(float w, float h) // Render the Scene if(!intermission || !view_set) { - view_origin = pmove_org + vo; - view_angles = input_angles; - makevectors(view_angles); - view_forward = v_forward; - view_right = v_right; - view_up = v_up; - view_set = 1; + if(hud) + { + view_origin = vehicle_hudmodel.origin; //pmove_org + vo + randomvec() * 20; + view_angles = input_angles; + R_SetView(VF_ORIGIN, view_origin); + makevectors(view_angles); + view_forward = v_forward; + view_right = v_right; + view_up = v_up; + view_set = 1; + } + else + { + view_origin = pmove_org + vo; + view_angles = input_angles; + makevectors(view_angles); + view_forward = v_forward; + view_right = v_right; + view_up = v_up; + view_set = 1; + dprint("Bong!\n"); + } } #ifdef BLURTEST @@ -685,7 +704,7 @@ void CSQC_UpdateView(float w, float h) { float contentalpha_temp, incontent, liquidalpha, contentfadetime; vector liquidcolor; - + switch(pointcontents(view_origin)) { case CONTENT_WATER: @@ -693,26 +712,26 @@ void CSQC_UpdateView(float w, float h) liquidcolor = stov(autocvar_hud_contents_water_color); incontent = 1; break; - + case CONTENT_LAVA: liquidalpha = autocvar_hud_contents_lava_alpha; liquidcolor = stov(autocvar_hud_contents_lava_color); incontent = 1; - break; - + break; + case CONTENT_SLIME: liquidalpha = autocvar_hud_contents_slime_alpha; liquidcolor = stov(autocvar_hud_contents_slime_color); incontent = 1; break; - + default: liquidalpha = 0; liquidcolor = '0 0 0'; incontent = 0; break; } - + if(incontent) // fade in/out at different speeds so you can do e.g. instant fade when entering water and slow when leaving it. { // also lets delcare previous values for blending properties, this way it isn't reset until after you have entered a different content contentfadetime = autocvar_hud_contents_fadeintime; @@ -721,14 +740,14 @@ void CSQC_UpdateView(float w, float h) } else contentfadetime = autocvar_hud_contents_fadeouttime; - + contentalpha_temp = bound(0, drawframetime / max(0.0001, contentfadetime), 1); contentavgalpha = contentavgalpha * (1 - contentalpha_temp) + incontent * contentalpha_temp; - + if(contentavgalpha) drawfill('0 0 0', eX * vid_conwidth + eY * vid_conheight, liquidcolor_prev, contentavgalpha * liquidalpha_prev, DRAWFLAG_NORMAL); } - + if(autocvar_hud_damage) { splash_size_x = max(vid_conwidth, vid_conheight); @@ -833,8 +852,6 @@ void CSQC_UpdateView(float w, float h) nextsound_typehit_time = time + autocvar_cl_hitsound_antispam_time; } - float hud; - hud = getstati(STAT_HUD); if(hud == HUD_SPIDERBOT) CSQC_SPIDER_HUD(); else if(hud == HUD_WAKIZASHI) @@ -928,13 +945,13 @@ void CSQC_UpdateView(float w, float h) else if(autocvar_crosshair_color_by_health) { local float x = getstati(STAT_HEALTH); - + //x = red //y = green //z = blue - + wcross_color_z = 0; - + if(x > 200) { wcross_color_x = 0; @@ -955,7 +972,7 @@ void CSQC_UpdateView(float w, float h) { wcross_color_x = 1; wcross_color_y = 1; - wcross_color_z = 0.2 + (x-50)*0.02 * 0.8; + wcross_color_z = 0.2 + (x-50)*0.02 * 0.8; } else if(x > 20) { @@ -999,7 +1016,7 @@ void CSQC_UpdateView(float w, float h) wcross_scale += sin(pickup_crosshair_size) * autocvar_crosshair_pickup; } - + vector hitindication_color; if(autocvar_crosshair_hitindication) { @@ -1083,7 +1100,7 @@ void CSQC_UpdateView(float w, float h) float ring_value, ring_scale, ring_alpha, ring_inner_value, ring_inner_alpha; string ring_image, ring_inner_image; vector ring_rgb, ring_inner_rgb; - + ring_scale = autocvar_crosshair_ring_size; float weapon_clipload, weapon_clipsize; @@ -1096,30 +1113,30 @@ void CSQC_UpdateView(float w, float h) if(nex_charge_movingavg == 0) // this should only happen if we have just loaded up the game nex_charge_movingavg = nex_charge; - + // handle the values if (autocvar_crosshair_ring && activeweapon == WEP_NEX && nex_charge && autocvar_crosshair_ring_nex) // ring around crosshair representing velocity-dependent damage for the nex { - if (nex_chargepool || use_nex_chargepool) { - use_nex_chargepool = 1; + if (nex_chargepool || use_nex_chargepool) { + use_nex_chargepool = 1; ring_inner_value = nex_chargepool; - } else { + } else { nex_charge_movingavg = (1 - autocvar_crosshair_ring_nex_currentcharge_movingavg_rate) * nex_charge_movingavg + autocvar_crosshair_ring_nex_currentcharge_movingavg_rate * nex_charge; - ring_inner_value = bound(0, autocvar_crosshair_ring_nex_currentcharge_scale * (nex_charge - nex_charge_movingavg), 1); + ring_inner_value = bound(0, autocvar_crosshair_ring_nex_currentcharge_scale * (nex_charge - nex_charge_movingavg), 1); } - + ring_inner_alpha = autocvar_crosshair_ring_nex_inner_alpha; ring_inner_rgb = eX * autocvar_crosshair_ring_nex_inner_color_red + eY * autocvar_crosshair_ring_nex_inner_color_green + eZ * autocvar_crosshair_ring_nex_inner_color_blue; ring_inner_image = "gfx/crosshair_ring_inner.tga"; - + // draw the outer ring to show the current charge of the weapon ring_value = nex_charge; ring_alpha = autocvar_crosshair_ring_nex_alpha; ring_rgb = wcross_color; ring_image = "gfx/crosshair_ring_nexgun.tga"; } - else if (autocvar_crosshair_ring && activeweapon == WEP_MINE_LAYER && minelayer_maxmines && autocvar_crosshair_ring_minelayer) + else if (autocvar_crosshair_ring && activeweapon == WEP_MINE_LAYER && minelayer_maxmines && autocvar_crosshair_ring_minelayer) { ring_value = bound(0, getstati(STAT_LAYED_MINES) / minelayer_maxmines, 1); // if you later need to use the count of bullets in another place, then add a float for it. For now, no need to. ring_alpha = autocvar_crosshair_ring_minelayer_alpha; @@ -1127,13 +1144,13 @@ void CSQC_UpdateView(float w, float h) ring_image = "gfx/crosshair_ring.tga"; } - if(autocvar_crosshair_ring_reload && weapon_clipsize) // forces there to be only an ammo ring + if(autocvar_crosshair_ring_reload && weapon_clipsize) // forces there to be only an ammo ring { ring_value = bound(0, weapon_clipload / weapon_clipsize, 1); ring_scale = autocvar_crosshair_ring_reload_size; ring_alpha = autocvar_crosshair_ring_reload_alpha; ring_rgb = wcross_color; - + // Note: This is to stop Taoki from complaining that the image doesn't match all potential balances. // if a new image for another weapon is added, add the code (and its respective file/value) here if ((activeweapon == WEP_SNIPERRIFLE) && (weapon_clipsize == 80)) @@ -1295,7 +1312,7 @@ void CSQC_common_hud(void) HUD_DrawScoreboard(); if (scoreboard_active) // scoreboard/accuracy - { + { HUD_Reset(); // HUD_DrawScoreboard takes care of centerprint_start } @@ -1323,7 +1340,7 @@ void CSQC_common_hud(void) case HUD_WAKIZASHI: CSQC_WAKIZASHI_HUD(); break; - + case HUD_BUMBLEBEE: CSQC_BUMBLE_HUD(); break; diff --git a/qcsrc/client/progs.src b/qcsrc/client/progs.src index 2e8992134..d67c9490f 100644 --- a/qcsrc/client/progs.src +++ b/qcsrc/client/progs.src @@ -62,6 +62,7 @@ target_music.qc vehicles/vehicles.qc ../server/vehicles/network.qc +../server/vehicles/racer.qc Main.qc View.qc diff --git a/qcsrc/client/vehicles/vehicles.qc b/qcsrc/client/vehicles/vehicles.qc index 8441c3a57..89ca53365 100644 --- a/qcsrc/client/vehicles/vehicles.qc +++ b/qcsrc/client/vehicles/vehicles.qc @@ -58,11 +58,6 @@ void AuxiliaryXhair_Draw2D() self.draw2d = Draw_Not; } -void Net_Vehicle(float IsNew) -{ - //entnum -} - void Net_AuXair2(float bIsNew) { float axh_id; @@ -481,6 +476,8 @@ void CSQC_WAKIZASHI_HUD() void Vehicles_Precache() { + precache_model("models/vehicles/wakizashi.dpm"); + precache_model("models/vehicles/bomblet.md3"); precache_model("models/vehicles/clusterbomb.md3"); precache_model("models/vehicles/clusterbomb_fragment.md3"); diff --git a/qcsrc/server/vehicles/network.qc b/qcsrc/server/vehicles/network.qc index 15878f05c..688aa7ca2 100644 --- a/qcsrc/server/vehicles/network.qc +++ b/qcsrc/server/vehicles/network.qc @@ -7,19 +7,26 @@ float VSF_AVEL = 8; /// Send Angular velocity float VSF_STATS = 16; /// Send ammo, health etc float VSF_EXTRA = 32; /// Send additional data (turret rotations etc). Handeld per vehicle type. float VSF_ANIMINFO = 64; /// Animation info -float VSF_FAR = 128; float VSF_FULL_UPDATE = 16777215; /// Send everything +float VSX_FAR = 1; +float VSX_OWNER = 2; +float VSX_GUN1 = 4; +float VSX_GUN2 = 8; + #ifdef SVQC -#define VSF_FARDISTANCE 2000 +#define VSX_FARDISTANCE 2000 float send_vehile(entity to, float sf) { - float dist; + float dist, xf; + var void WriteFunc(float, float); dist = vlen(self.origin - to.origin); - if(dist > VSF_FARDISTANCE && to != self.owner) - sf |= VSF_FAR; + if(to == self.owner) + xf |= VSX_OWNER; + else if(dist > VSX_FARDISTANCE) + xf |= VSX_FAR; // Always send a movement and origin to owner if(to == self.owner) @@ -29,6 +36,7 @@ float send_vehile(entity to, float sf) // We need to know client-side what was sent WriteByte(MSG_ENTITY, sf); + WriteByte(MSG_ENTITY, xf); if(sf & VSF_SETUP) { @@ -40,7 +48,7 @@ float send_vehile(entity to, float sf) if(sf & VSF_ORIGIN) { - WriteFunc = ((sf & VSF_FAR) ? WriteShort : WriteCoord); + WriteFunc = ((xf & VSX_FAR) ? WriteShort : WriteCoord); WriteFunc(MSG_ENTITY, self.origin_x); WriteFunc(MSG_ENTITY, self.origin_y); WriteFunc(MSG_ENTITY, self.origin_z); @@ -48,12 +56,12 @@ float send_vehile(entity to, float sf) if(sf & VSF_MOVEMENT) { - WriteFunc = ((sf & VSF_FAR) ? WriteShort : WriteCoord); + WriteFunc = ((xf & VSX_FAR) ? WriteShort : WriteCoord); WriteFunc(MSG_ENTITY, self.velocity_x); WriteFunc(MSG_ENTITY, self.velocity_y); WriteFunc(MSG_ENTITY, self.velocity_z); - WriteFunc = ((sf & VSF_FAR) ? WriteShort : WriteAngle); + WriteFunc = ((xf & VSX_FAR) ? WriteShort : WriteAngle); WriteFunc(MSG_ENTITY, self.angles_x); WriteFunc(MSG_ENTITY, self.angles_y); WriteFunc(MSG_ENTITY, self.angles_z); @@ -61,7 +69,7 @@ float send_vehile(entity to, float sf) if(sf & VSF_AVEL) { - WriteFunc = ((sf & VSF_FAR) ? WriteShort : WriteCoord); + WriteFunc = ((xf & VSX_FAR) ? WriteShort : WriteCoord); WriteFunc(MSG_ENTITY, self.avelocity_x); WriteFunc(MSG_ENTITY, self.avelocity_y); WriteFunc(MSG_ENTITY, self.avelocity_z); @@ -69,9 +77,9 @@ float send_vehile(entity to, float sf) if(sf & VSF_STATS) { - if(to == self.owner) + WriteByte(MSG_ENTITY, self.vehicle_health); + if(xf & VSX_OWNER) { - WriteByte(MSG_ENTITY, 1); WriteByte(MSG_ENTITY, self.vehicle_shield); WriteByte(MSG_ENTITY, self.vehicle_energy); @@ -82,10 +90,6 @@ float send_vehile(entity to, float sf) WriteByte(MSG_ENTITY, self.vehicle_reload2); } - else - WriteByte(MSG_ENTITY, 0); - - WriteByte(MSG_ENTITY, self.vehicle_health); } if(sf & VSF_EXTRA) @@ -107,11 +111,6 @@ void vehicle_spiderbot_assemble() } -void vehicle_racer_assemble() -{ - -} - void vehicle_raptor_assemble() { @@ -122,22 +121,18 @@ void vehicle_bumblebee_assemble() } -void Net_ReadVehicle(float bIsNew) +.float lastupdate; +void read_vehicle(float bIsNew) { - float sf; + float sf, xf; var float ReadFunc(); - if(bIsNew) - { - /*setmodel(self, "models/vehicles/wakizashi.dpm"); - self.move_movetype = MOVETYPE_BOUNCE; - self.entremove = VehicleRacerRemove; - setsize(self, '-60 -60 -20', '60 60 20'); - self.draw = VehicleRacerDraw; - self.scale = 0.5;*/ - } - sf = ReadByte(); + xf = ReadByte(); + + if(xf & VSX_OWNER) + vehicle = self; + if(sf & VSF_SETUP) { self.vehicle_hud = ReadByte(); @@ -164,42 +159,57 @@ void Net_ReadVehicle(float bIsNew) } } + if(self.vehicle_hud == HUD_WAKIZASHI && xf & VSX_OWNER) + { + + vehicle_hudmodel.owner = self; + } + + //if(xf & VSX_FAR) + // dprint("Client vehicle faaar set\n"); + if(sf & VSF_ORIGIN) { - ReadFunc = ((sf & VSF_FAR) ? ReadShort : ReadCoord); - self.origin_x = ReadCoord(); - self.origin_y = ReadCoord(); - self.origin_z = ReadCoord(); - self.move_origin = self.origin; + ReadFunc = ((xf & VSX_FAR) ? ReadShort : ReadCoord); + self.origin_x = ReadFunc(); + self.origin_y = ReadFunc(); + self.origin_z = ReadFunc(); + + setorigin(self, self.origin); + //self.lastupdate = time; } if(sf & VSF_MOVEMENT) { - ReadFunc = ((sf & VSF_FAR) ? ReadShort : ReadCoord); - self.velocity_x = ReadFunc(); - self.velocity_y = ReadFunc(); - self.velocity_z = ReadFunc(); - - ReadFunc = ((sf & VSF_FAR) ? ReadShort : ReadAngle); - self.angles_x = ReadFunc(); - self.angles_y = ReadFunc(); - self.angles_z = ReadFunc(); - - self.move_velocity = self.velocity; - self.move_angles = self.angles; + ReadFunc = ((xf & VSX_FAR) ? ReadShort : ReadCoord); + self.velocity_x = ReadFunc(); + self.velocity_y = ReadFunc(); + self.velocity_z = ReadFunc(); + + ReadFunc = ((sf & VSX_FAR) ? ReadShort : ReadAngle); + self.angles_x = ReadFunc(); + self.angles_y = ReadFunc(); + self.angles_z = ReadFunc(); + + //self.lastupdate = time; + // self.move_velocity = self.velocity; + // self.move_angles = self.angles; } if(sf & VSF_AVEL) { - ReadFunc = ((sf & VSF_FAR) ? ReadShort : ReadCoord); - self.avelocity_x = ReadFunc(); - self.avelocity_y = ReadFunc(); - self.avelocity_z = ReadFunc(); + ReadFunc = ((xf & VSX_FAR) ? ReadShort : ReadCoord); + self.avelocity_x = ReadFunc(); + self.avelocity_y = ReadFunc(); + self.avelocity_z = ReadFunc(); + + // self.move_avelocity = self.avelocity; } if(sf & VSF_STATS) { - if(ReadByte() == 1) + self.vehicle_health = ReadByte(); + if(xf & VSX_OWNER) { self.vehicle_shield = ReadByte(); self.vehicle_energy = ReadByte(); @@ -208,7 +218,6 @@ void Net_ReadVehicle(float bIsNew) self.vehicle_ammo2 = ReadByte(); self.vehicle_reload2 = ReadByte(); } - self.vehicle_health = ReadByte(); } if(sf & VSF_EXTRA) @@ -217,5 +226,12 @@ void Net_ReadVehicle(float bIsNew) } #endif // CSQC +#else +#ifdef CSQC +.float lastupdate; +void read_vehicle(float bIsNew) +{ +} +#endif #endif // VEHICLES_CSQC diff --git a/qcsrc/server/vehicles/racer.qc b/qcsrc/server/vehicles/racer.qc index 7ab8ef119..8113e6abb 100644 --- a/qcsrc/server/vehicles/racer.qc +++ b/qcsrc/server/vehicles/racer.qc @@ -262,6 +262,18 @@ float racer_frame() 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) { vehicles_exit(VHEF_NORMAL); @@ -466,7 +478,17 @@ void racer_think() */ 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; @@ -480,7 +502,7 @@ void racer_think() self.velocity_y *= 0.9; self.velocity_z *= 0.8; self.velocity_z += sin(time * 2) * 16; - self.nextthink = time + 0.05; + self.nextthink = time; // + 0.05; } void racer_enter() @@ -488,6 +510,8 @@ void racer_enter() 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); + if(self.SendEntity) + self.SendFlags |= VSF_SETUP; } void racer_exit(float eject) @@ -616,12 +640,14 @@ void racer_dinit() racer_frame, racer_enter, racer_exit, racer_die, racer_think, - FALSE)) + TRUE)) { 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 @@ -668,8 +694,26 @@ void spawnfunc_vehicle_racer() #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; + } + } @@ -683,8 +727,38 @@ 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 diff --git a/qcsrc/server/vehicles/vehicles.qc b/qcsrc/server/vehicles/vehicles.qc index e98e12761..93d9ef3ac 100644 --- a/qcsrc/server/vehicles/vehicles.qc +++ b/qcsrc/server/vehicles/vehicles.qc @@ -10,7 +10,7 @@ void vehicles_clearrturn(); void vehicles_setreturn(); -/** AuxiliaryXhair* +/** AuxiliaryXhair* Send addictional points of interest to be drawn, to vehicle owner **/ float MAX_AXH = 4; @@ -90,17 +90,17 @@ void CSQCVehicleSetup(entity own, float vehicle_id) } /** vehicles_locktarget - + Generic target locking. - + Figure out if what target is "locked" (if any), for missile tracking as such. - + after calling, "if(self.lock_target != world && self.lock_strength == 1)" mean you have a locked in target. - + Exspects a crosshair_trace() or equivalent to be dont before calling. - + **/ .entity lock_target; .float lock_strength; @@ -235,7 +235,7 @@ void vehicles_projectile_explode() entity vehicles_projectile(string _mzlfx, string _mzlsound, vector _org, vector _vel, float _dmg, float _radi, float _force, float _size, - float _deahtype, float _projtype, float _health, + float _deahtype, float _projtype, float _health, float _cull, float _clianim) { entity proj; @@ -296,7 +296,7 @@ void vehicles_spawn() // De-own & reset self.vehicle_hudmodel.viewmodelforclient = self; - + self.owner = world; self.touch = vehicles_touch; self.event_damage = vehicles_damage; @@ -309,7 +309,7 @@ void vehicles_spawn() self.flags = FL_NOTARGET; self.avelocity = '0 0 0'; self.velocity = '0 0 0'; - + // Reset locking self.lock_strength = 0; self.lock_target = world; @@ -400,12 +400,13 @@ void vehicles_enter() self.owner = other; self.switchweapon = other.switchweapon; - + // .viewmodelforclient works better. //self.vehicle_hudmodel.drawonlytoclient = self.owner; - self.vehicle_hudmodel.viewmodelforclient = self.owner; - + if not (self.SendEntity) + self.vehicle_hudmodel.viewmodelforclient = self.owner; + self.event_damage = vehicles_damage; self.nextthink = 0; self.owner.angles = self.angles; @@ -438,10 +439,10 @@ void vehicles_enter() self.team = self.owner.team; self.flags -= FL_NOTARGET; -#if 0 +#if 0 other.clientcamera = self.vehicle_viewport; #else - msg_entity = other; + /*msg_entity = other; WriteByte (MSG_ONE, SVC_SETVIEWPORT); WriteEntity(MSG_ONE, self.vehicle_viewport); @@ -458,7 +459,7 @@ void vehicles_enter() WriteAngle(MSG_ONE, self.angles_x * -1); // tilt WriteAngle(MSG_ONE, self.angles_y); // yaw WriteAngle(MSG_ONE, 0); // roll - } + }*/ #endif vehicles_clearrturn(); @@ -661,7 +662,7 @@ void vehicles_reset_colors() if(autocvar_g_fullbrightplayers) _effects |= EF_FULLBRIGHT; - + if(self.team) _colormap = 1024 + (self.team - 1) * 17; else @@ -683,7 +684,7 @@ void vehicles_reset_colors() } e = e.chain; } - + self.vehicle_hudmodel.effects = self.effects = _effects | EF_LOWPRECISION; self.vehicle_hudmodel.colormod = self.colormod = _colormod; self.vehicle_hudmodel.colormap = self.colormap = _colormap; @@ -796,13 +797,13 @@ float vehicle_initialize(string net_name, tracebox(self.origin + '0 0 100', min_s, max_s, self.origin - '0 0 10000', MOVE_WORLDONLY, self); setorigin(self, trace_endpos); } - + self.pos1 = self.origin; self.pos2 = self.angles; #ifdef VEHICLES_CSQC if(use_csqc) net_link_vehile(); -#endif +#endif return TRUE; } @@ -814,4 +815,4 @@ void bugmenot() self.vehicle_die = self.vehicle_exit; self.vehicle_spawn = self.vehicle_exit; self.AuxiliaryXhair = self.AuxiliaryXhair; -} \ No newline at end of file +} diff --git a/qcsrc/server/vehicles/vehicles_def.qh b/qcsrc/server/vehicles/vehicles_def.qh index 64e5d4d69..736bb1873 100644 --- a/qcsrc/server/vehicles/vehicles_def.qh +++ b/qcsrc/server/vehicles/vehicles_def.qh @@ -1,4 +1,4 @@ -//#define VEHICLES_CSQC +#define VEHICLES_CSQC // #define VEHICLES_USE_ODE #define VEHICLES_ENABLED #ifdef VEHICLES_ENABLED @@ -30,11 +30,11 @@ float VHF_MOVE_FLY = 512; /// Vehicle is airborn .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; -#ifdef SVQC .float hud; .float dmg_time; .float vehicle_respawntime; @@ -54,6 +54,7 @@ var .void() vehicle_die; /// Vehicles custom function to be executed when veh 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 @@ -62,11 +63,16 @@ void net_link_vehile(); /// Initiates csqc networking for vehicl #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 Net_ReadVehicle(float bIsNew); +void read_vehicle(float bIsNew); var .void (float sf)vehile_read_exta; #endif //VEHICLES_CSQC #endif //CSQC -- 2.39.2