From 08aeb81af14b417bf4ae02233ece56c5f3790eed Mon Sep 17 00:00:00 2001 From: subject9x Date: Thu, 28 Sep 2023 21:33:05 -0400 Subject: [PATCH] large refactor: Thanks to Spoike for clearing up some SendEntity information; SendEntity takes an entity as the first arg, not a float. + SENDFLAG_NEWENT (128) was largely an incorrect name for the value, more accurate name is SENDFLAG_FULL_UPDATE. + isNew and FULL_UPDATE don't sync up, isNew is the source of truth for an entity new to the client...but might arrive out of order. + in light of these changes, I've sorted out the edge-case where user(s) are pre-existing as mechs, but a new user(s) connect having missed the NEWUNIT flag send. + FULL_UPDATE will now make sure that all clients receive other clients as-mechs when necessary. + I also sorted out critical hit events vs existing crits, and a newly found respawn bug where critical hits carry over. --- client/data/data_buildings.qc | 2 +- client/data/data_mapobjs.qc | 10 +- client/data/data_turrets.qc | 2 +- client/data/headers/data_buildings.qh | 2 +- client/data/headers/data_turrets.qh | 2 +- client/network/net_building.qc | 4 +- client/network/net_client.qc | 467 +++++++++--------- client/network/net_general.qc | 14 +- client/network/net_gev.qc | 4 +- client/network/net_mech_ai.qc | 4 +- client/network/net_spg.qc | 4 +- client/network/net_tank.qc | 4 +- client/network/net_turret.qc | 4 +- client/ui/menu/ui_util.qc | 2 +- .../data/buildings/data_building_barracks.qc | 2 +- .../data/buildings/data_building_fuel_tank.qc | 2 +- .../buildings/data_building_guard_tower.qc | 2 +- .../buildings/data_building_hangar_large.qc | 2 +- .../buildings/data_building_hangar_med.qc | 2 +- .../buildings/data_building_power_plant.qc | 2 +- common/data/buildings/data_building_radar.qc | 2 +- .../buildings/data_building_repair_bay.qc | 2 +- .../data_building_shield_generator.qc | 2 +- .../buildings/data_building_supply_depot.qc | 2 +- common/data/data_values_game.qc | 2 +- common/data/defs/defs_world.qc | 8 +- common/data/defs/defs_world.qh | 4 +- dp/dpextensions.qc | 2 +- main/ai/ai_ctrl.qc | 2 +- main/ai/behaviors/turret/ai_turret.qc | 2 +- main/client_utils.qc | 6 +- main/controllers/ctrl_building.qc | 12 +- main/controllers/ctrl_mech.qc | 6 +- main/controllers/ctrl_tank.qc | 18 +- main/controllers/ctrl_units.qc | 35 +- main/controllers/ctrl_weapon.qc | 4 +- main/controllers/headers/controllers.qh | 22 +- main/effectinfo_api.qc | 4 +- main/entityFactory_player.qc | 12 +- main/extensions/ext_world.qc | 2 - main/headers/effectinfo_api.qh | 2 +- main/map/map_damage_zone.qc | 2 +- main/map/map_deploy_point.qc | 6 +- main/map/map_misc_buildings.qc | 4 +- main/map/map_misc_model.qc | 4 +- main/map/map_nav_point.qc | 6 +- main/map/map_objective.qc | 2 +- main/map/map_particlecube_effect.qc | 6 +- main/map/map_scenery.qc | 14 +- main/sv/headers/sv_player_api.qh | 4 +- main/sv/sv_client_api.qc | 64 +-- main/sv/sv_player_api.qc | 1 + main/t_damage.qc | 8 +- 53 files changed, 403 insertions(+), 406 deletions(-) diff --git a/client/data/data_buildings.qc b/client/data/data_buildings.qc index 6be95d417..8e24fdc8a 100644 --- a/client/data/data_buildings.qc +++ b/client/data/data_buildings.qc @@ -116,7 +116,7 @@ void() sendent_building_settle={ /* - client_main.CSQC_ent_update()->Ent Type == building, SENDFLAG_NEWENT + client_main.CSQC_ent_update()->Ent Type == building, SENDFLAG_UPDATE_FULL scope = self self is building */ diff --git a/client/data/data_mapobjs.qc b/client/data/data_mapobjs.qc index 58ba79bbb..dec7b3dd6 100644 --- a/client/data/data_mapobjs.qc +++ b/client/data/data_mapobjs.qc @@ -83,7 +83,7 @@ void( float isNew, float entFlags ) data_nav_point={ } //EVENT - new to player - if( (entFlags & SENDFLAG_NEWENT) ){ + if( (entFlags & SENDFLAG_UPDATE_FULL) ){ self.data_idx = ReadByte(); } @@ -166,7 +166,7 @@ void( float isNew, float entFlags ) data_objective={ } //EVENT - new to player - if( entFlags & SENDFLAG_NEWENT ){ + if( entFlags & SENDFLAG_UPDATE_FULL ){ self.data_idx = ReadByte(); self.data_type = DATA_OBJT; } @@ -227,7 +227,7 @@ void( float isNew, float entFlags ) data_deploy={ } //EVENT - new to player - if( (entFlags & SENDFLAG_NEWENT) ){ + if( (entFlags & SENDFLAG_UPDATE_FULL) ){ self.data_idx = ReadByte(); nextOrg_x = ReadCoord(); nextOrg_y = ReadCoord(); @@ -504,7 +504,7 @@ void( float isNew, float entFlags ) data_map_damage={ self.angles_z = anglemod(ReadAngle()); } - if( (entFlags & SENDFLAG_NEWENT) ){ + if( (entFlags & SENDFLAG_UPDATE_FULL) ){ self.data_idx = ReadByte(); self.spawnflags = rint(ceil(ReadLong())); self.damageType = ReadByte(); @@ -573,7 +573,7 @@ void( float isNew, float entFlags ) data_particle_cube_meta={ particleCubeMetaData = self; } } - if( (entFlags & SENDFLAG_NEWENT) ){ + if( (entFlags & SENDFLAG_UPDATE_FULL) ){ self.absmin = te_read_vector(); self.absmax = te_read_vector(); self.origin = self.absmax - self.absmin; diff --git a/client/data/data_turrets.qc b/client/data/data_turrets.qc index 4f0e6522c..5799683d2 100644 --- a/client/data/data_turrets.qc +++ b/client/data/data_turrets.qc @@ -7,7 +7,7 @@ Overview: */ /* - client_main.CSQC_ent_update()->Ent Type == building, SENDFLAG_NEWENT + client_main.CSQC_ent_update()->Ent Type == building, SENDFLAG_UPDATE_FULL scope = self self is building */ diff --git a/client/data/headers/data_buildings.qh b/client/data/headers/data_buildings.qh index 6de64ee8b..e57c9fd1d 100644 --- a/client/data/headers/data_buildings.qh +++ b/client/data/headers/data_buildings.qh @@ -7,7 +7,7 @@ Overview: */ /* - client_main.CSQC_ent_update()->Ent Type == building, SENDFLAG_NEWENT + client_main.CSQC_ent_update()->Ent Type == building, SENDFLAG_UPDATE_FULL scope = self self is building */ diff --git a/client/data/headers/data_turrets.qh b/client/data/headers/data_turrets.qh index 4a9bd832a..f3021d314 100644 --- a/client/data/headers/data_turrets.qh +++ b/client/data/headers/data_turrets.qh @@ -7,7 +7,7 @@ Overview: */ /* - client_main.CSQC_ent_update()->Ent Type == building, SENDFLAG_NEWENT + client_main.CSQC_ent_update()->Ent Type == building, SENDFLAG_UPDATE_FULL scope = self self is building */ diff --git a/client/network/net_building.qc b/client/network/net_building.qc index 8f6860de0..4db71c523 100644 --- a/client/network/net_building.qc +++ b/client/network/net_building.qc @@ -94,7 +94,7 @@ void( float isNew, float changeFlags) sendent_handle_building={ self.clientServerNum = self.entnum; - if( (changeFlags & SENDFLAG_NEWENT) ){ + if( (changeFlags & SENDFLAG_UPDATE_FULL) ){ self.origin_x = ReadCoord(); self.origin_y = ReadCoord(); self.origin_z = ReadCoord(); @@ -219,7 +219,7 @@ void( float isNew, float changeFlags) sendent_handle_building={ //EVENT - voice chatter if( (changeFlags & SENDFLAG_VOICE) ){ - if( !(changeFlags & SENDFLAG_NEWENT) ){ + if( !(changeFlags & SENDFLAG_UPDATE_FULL) ){ voiceId = ReadByte(); snd_hud_trnsmsn_addtoqueue(self.ai_voice_group, voiceId, self.ai_voice_limit, self.entnum); } diff --git a/client/network/net_client.qc b/client/network/net_client.qc index 8c6d48519..2db5ead34 100644 --- a/client/network/net_client.qc +++ b/client/network/net_client.qc @@ -26,7 +26,7 @@ float() remove_client={ }; float VFX_RAM_TIME; -float SFX_SHLD_UP_TIME; +float SFX_SHLD_TIME; void() client_entity_think={ local vector laserHit; @@ -193,8 +193,8 @@ void() client_predraw={ CLIENT_mech_armR_org1 = self.armR_org; } } - } + newLerp = (time - self.frame2time) / (self.frame2time - self.frame1time); newLerp = bound(0, newLerp, 1); self.lerpfrac = newLerp; @@ -205,6 +205,10 @@ void() client_predraw={ self.rootOrigin = self.origin; self.rootAngle = self.angles; + if( self.isLocalPlayer ){ + CLIENT_lerp = self.lerpfrac; + } + if( self.data_type == DATA_POBS){ self.alpha = 0.01; self.scale = 0.01; @@ -214,206 +218,203 @@ void() client_predraw={ if( self.data_type == DATA_MECH ){ self.alpha = 1.0; self.scale = 1.0; - self.effects = self.effects - (self.effects & (EF_FULLBRIGHT | EF_NOSHADOW) ); //just in case they creeped in? - - self.laser_sight_org = self.laser_sight_org1 + (self.laser_sight_org2 - self.laser_sight_org1 ) * self.lerpfrac; - - if( self.isLocalPlayer ){ - CLIENT_lerp = self.lerpfrac; - } - - self.cl_lod_unit = TRUE; - traceline(self.origin, CLIENT_vis_org, FALSE, self); - if( (trace_fraction != 1.0 && trace_ent == world) || vlen(CLIENT_vis_org - self.origin) > PARTICLE_HAZ_DISTANCE){ - self.cl_lod_unit = FALSE; - } - - if(self.cl_lod_unit){ - self.cl_lod_weapon = TRUE; - if( vlen(self.origin - CLIENT_vis_org ) > PARTICLE_HAZ_DISTANCE / 2 ){ - self.cl_lod_weapon = FALSE; - } - - makevectors( [0, self.angles_y, self.angles_z] ); + if( self.deadflag == DEAD_NO ){ + self.effects = self.effects - (self.effects & (EF_FULLBRIGHT | EF_NOSHADOW) ); //just in case they creeped in? - setsize(self, self.cache_mins, self.cache_maxs); - self.renderflags = 0; - predraw_legs(); - self.origin = self.rootOrigin; - self.angles = self.rootAngle; + self.laser_sight_org = self.laser_sight_org1 + (self.laser_sight_org2 - self.laser_sight_org1 ) * self.lerpfrac; - self.torC_angl = self.rootAngle; - self.torC_org = predraw_unit_part_and_angle(self.torC_compOffset, torC_angl) + (CLIENT_mech_torC_org2 - CLIENT_mech_torC_org1) * self.lerpfrac; - self.torC_angl = [0, self.rootAngle_y, 0]; - if((self.unitModFlags & MOD_MODEL_PITCH_TOR_C)){ - self.torC_angl_x = self.rootAngle_x * -1; + self.cl_lod_unit = TRUE; + traceline(self.origin, CLIENT_vis_org, FALSE, self); + if( (trace_fraction != 1.0 && trace_ent == world) || vlen(CLIENT_vis_org - self.origin) > PARTICLE_HAZ_DISTANCE){ + self.cl_lod_unit = FALSE; } - setmodel(self, self.torC_mdl); - self.angles = self.torC_angl; - self.origin = self.torC_org; - self.colormod = CLR_PLAYER_LIST[self.unitColorCT] * (self.torC_hp / 100) * 2; - addentity(self); - if( (self.unitModFlags & MOD_HAS_TOR_L) && !(self.unitModFlags & MOD_MODEL_NO_TOR_L) ){ - self.torL_org = predraw_unit_part_and_angle(self.torL_compOffset, torL_angl) + (CLIENT_mech_torL_org2 - CLIENT_mech_torL_org1) * self.lerpfrac; - self.torL_org = predraw_unit_part_and_angle(self.torL_compOffset, torL_angl); + if(self.cl_lod_unit){ + self.cl_lod_weapon = TRUE; + if( vlen(self.origin - CLIENT_vis_org ) > PARTICLE_HAZ_DISTANCE / 2 ){ + self.cl_lod_weapon = FALSE; + } + + makevectors( [0, self.angles_y, self.angles_z] ); + + setsize(self, self.cache_mins, self.cache_maxs); + self.renderflags = 0; + predraw_legs(); + self.origin = self.rootOrigin; + self.angles = self.rootAngle; + + self.torC_angl = self.rootAngle; + self.torC_org = predraw_unit_part_and_angle(self.torC_compOffset, torC_angl) + (CLIENT_mech_torC_org2 - CLIENT_mech_torC_org1) * self.lerpfrac; + self.torC_angl = [0, self.rootAngle_y, 0]; + if((self.unitModFlags & MOD_MODEL_PITCH_TOR_C)){ + self.torC_angl_x = self.rootAngle_x * -1; + } + setmodel(self, self.torC_mdl); + self.angles = self.torC_angl; + self.origin = self.torC_org; + self.colormod = CLR_PLAYER_LIST[self.unitColorCT] * (self.torC_hp / 100) * 2; + addentity(self); + if( !(self.criticalHits & M_TOR_LEFT) ){ - self.torL_angl = [0, self.rootAngle_y, 0]; - if( (self.unitModFlags & MOD_MODEL_PITCH_TOR_L) ){ - self.torL_angl_x = self.rootAngle_x * -1; + if( (self.unitModFlags & MOD_HAS_TOR_L) && !(self.unitModFlags & MOD_MODEL_NO_TOR_L) ){ + self.torL_org = predraw_unit_part_and_angle(self.torL_compOffset, torL_angl) + (CLIENT_mech_torL_org2 - CLIENT_mech_torL_org1) * self.lerpfrac; + self.torL_org = predraw_unit_part_and_angle(self.torL_compOffset, torL_angl); + self.torL_angl = [0, self.rootAngle_y, 0]; + if( (self.unitModFlags & MOD_MODEL_PITCH_TOR_L) ){ + self.torL_angl_x = self.rootAngle_x * -1; + } + self.colormod = CLR_PLAYER_LIST[self.unitColorLT] * (self.armL_hp / 100) * 2; + setmodel(self, self.torL_mdl); + self.angles = self.torL_angl; + self.origin = self.torL_org; + addentity(self); } - self.colormod = CLR_PLAYER_LIST[self.unitColorLT] * (self.armL_hp / 100) * 2; - setmodel(self, self.torL_mdl); - self.angles = self.torL_angl; - self.origin = self.torL_org; - addentity(self); } - } - - if( (self.unitModFlags & MOD_HAS_TOR_R) && !(self.unitModFlags & MOD_MODEL_NO_TOR_R) ){ - self.torR_org = predraw_unit_part_and_angle(self.torR_compOffset, torR_angl) + (CLIENT_mech_torR_org2 - CLIENT_mech_torR_org1) * self.lerpfrac; + if( !(self.criticalHits & M_TOR_RIGHT) ){ - self.torR_angl = [0, self.rootAngle_y, 0]; - if( (self.unitModFlags & MOD_MODEL_PITCH_TOR_R) ){ - self.torR_angl_x = self.rootAngle_x * -1; + if( (self.unitModFlags & MOD_HAS_TOR_R) && !(self.unitModFlags & MOD_MODEL_NO_TOR_R) ){ + self.torR_org = predraw_unit_part_and_angle(self.torR_compOffset, torR_angl) + (CLIENT_mech_torR_org2 - CLIENT_mech_torR_org1) * self.lerpfrac; + self.torR_angl = [0, self.rootAngle_y, 0]; + if( (self.unitModFlags & MOD_MODEL_PITCH_TOR_R) ){ + self.torR_angl_x = self.rootAngle_x * -1; + } + self.colormod = CLR_PLAYER_LIST[self.unitColorRT] * (self.torR_hp / 100) * 2; + setmodel(self, self.torR_mdl); + self.angles = self.torR_angl; + self.origin = self.torR_org; + addentity(self); } - self.colormod = CLR_PLAYER_LIST[self.unitColorRT] * (self.torR_hp / 100) * 2; - setmodel(self, self.torR_mdl); - self.angles = self.torR_angl; - self.origin = self.torR_org; - addentity(self); } - } - - if( (self.unitModFlags & MOD_HAS_TOR_L) && (self.unitModFlags & MOD_HAS_ARM_L) ){ - self.armL_org = predraw_unit_part_and_angle(self.armL_compOffset, armL_angl) + (CLIENT_mech_armL_org2 - CLIENT_mech_armL_org1) * self.lerpfrac; + if( !(self.criticalHits & M_ARM_LEFT) ){ - self.armL_angl = [0, self.rootAngle_y, 0]; - if((self.unitModFlags & MOD_MODEL_PITCH_ARM_L)){ - self.armL_angl_x = self.rootAngle_x * -1; + if( (self.unitModFlags & MOD_HAS_TOR_L) && (self.unitModFlags & MOD_HAS_ARM_L) ){ + self.armL_org = predraw_unit_part_and_angle(self.armL_compOffset, armL_angl) + (CLIENT_mech_armL_org2 - CLIENT_mech_armL_org1) * self.lerpfrac; + self.armL_angl = [0, self.rootAngle_y, 0]; + if((self.unitModFlags & MOD_MODEL_PITCH_ARM_L)){ + self.armL_angl_x = self.rootAngle_x * -1; + } + self.colormod = CLR_PLAYER_LIST[self.unitColorLA] * (self.armL_hp / 100) * 2; + setmodel(self, self.armL_mdl); + self.angles = self.armL_angl; + self.origin = self.armL_org; + addentity(self); } - self.colormod = CLR_PLAYER_LIST[self.unitColorLA] * (self.armL_hp / 100) * 2; - setmodel(self, self.armL_mdl); - self.angles = self.armL_angl; - self.origin = self.armL_org; - addentity(self); } - } - - if( (self.unitModFlags & MOD_HAS_TOR_R) && (self.unitModFlags & MOD_HAS_ARM_R) ){ - self.armR_org = predraw_unit_part_and_angle(self.armR_compOffset, armR_angl) + (CLIENT_mech_armR_org2 - CLIENT_mech_armR_org1) * self.lerpfrac; + if( !(self.criticalHits & M_ARM_RIGHT) ){ - self.armR_angl = [0, self.rootAngle_y, 0]; - if((self.unitModFlags & MOD_MODEL_PITCH_ARM_R)){ - self.armR_angl_x = self.rootAngle_x * -1; + if( (self.unitModFlags & MOD_HAS_TOR_R) && (self.unitModFlags & MOD_HAS_ARM_R) ){ + self.armR_org = predraw_unit_part_and_angle(self.armR_compOffset, armR_angl) + (CLIENT_mech_armR_org2 - CLIENT_mech_armR_org1) * self.lerpfrac; + self.armR_angl = [0, self.rootAngle_y, 0]; + if((self.unitModFlags & MOD_MODEL_PITCH_ARM_R)){ + self.armR_angl_x = self.rootAngle_x * -1; + } + self.colormod = CLR_PLAYER_LIST[self.unitColorRA] * (self.armR_hp / self.armR_hpMax) * 2; + setmodel(self, self.armR_mdl); + self.angles = self.armR_angl; + self.origin = self.armR_org; + addentity(self); } - self.colormod = CLR_PLAYER_LIST[self.unitColorRA] * (self.armR_hp / self.armR_hpMax) * 2; - setmodel(self, self.armR_mdl); - self.angles = self.armR_angl; - self.origin = self.armR_org; - addentity(self); } - } - //cockpit draw needs to be distinct because its always on, even in-death. - if( self.isLocalPlayer ){ - hud_model_cockpit_draw_frame(); - } - if(self.deadflag == DEAD_NO){ - if(self.cl_lod_weapon){ - //client_event_burn(); //placing this here because weapon-LoD is a fairly tight radius. - render_mech_effect_burning(); - - if(self.weaponEnt1.data_idx > 0){ - predraw_unit_weapon(self.weaponEnt1); - } - if(self.weaponEnt2.data_idx > 0){ - predraw_unit_weapon(self.weaponEnt2); - } - if(self.weaponEnt3.data_idx > 0){ - predraw_unit_weapon(self.weaponEnt3); - } - if(self.weaponEnt4.data_idx > 0){ - predraw_unit_weapon(self.weaponEnt4); - } - if(self.weaponEnt5.data_idx > 0){ - predraw_unit_weapon(self.weaponEnt5); - } - if(self.weaponEnt6.data_idx > 0){ - predraw_unit_weapon(self.weaponEnt6); - } - if(self.weaponEnt7.data_idx > 0){ - predraw_unit_weapon(self.weaponEnt7); - } - if(self.weaponEnt8.data_idx > 0){ - predraw_unit_weapon(self.weaponEnt8); + if(self.deadflag == DEAD_NO){ + if(self.cl_lod_weapon){ + //client_event_burn(); //placing this here because weapon-LoD is a fairly tight radius. + render_mech_effect_burning(); + + if(self.weaponEnt1.data_idx > 0){ + predraw_unit_weapon(self.weaponEnt1); + } + if(self.weaponEnt2.data_idx > 0){ + predraw_unit_weapon(self.weaponEnt2); + } + if(self.weaponEnt3.data_idx > 0){ + predraw_unit_weapon(self.weaponEnt3); + } + if(self.weaponEnt4.data_idx > 0){ + predraw_unit_weapon(self.weaponEnt4); + } + if(self.weaponEnt5.data_idx > 0){ + predraw_unit_weapon(self.weaponEnt5); + } + if(self.weaponEnt6.data_idx > 0){ + predraw_unit_weapon(self.weaponEnt6); + } + if(self.weaponEnt7.data_idx > 0){ + predraw_unit_weapon(self.weaponEnt7); + } + if(self.weaponEnt8.data_idx > 0){ + predraw_unit_weapon(self.weaponEnt8); + } + if(self.weaponEnt9.data_idx > 0){ + predraw_unit_weapon(self.weaponEnt9); + } } - if(self.weaponEnt9.data_idx > 0){ - predraw_unit_weapon(self.weaponEnt9); + if( self.isLocalPlayer ){ + //apparently when menu running, these just get STACCCCCCKED and murder framerate. + if(MENU_PROG_OFF && HUD_HEADLIGHT_ACTIVE){ + self.unit_light_org = self.unit_light_org1 + (self.unit_light_org2-self.unit_light_org1)*self.lerpfrac; + particleDraw = vlen(self.rootOrigin - CLIENT_vis_org); + if( particleDraw <= PARTICLE_HAZ_DISTANCE ){ + adddynamiclight2(self.unit_light_org, 150, '1.0 1.0 1.0', 0, "", PFLAGS_NOSHADOW); + } + } } - } - if( self.isLocalPlayer ){ - //apparently when menu running, these just get STACCCCCCKED and murder framerate. - if(MENU_PROG_OFF && HUD_HEADLIGHT_ACTIVE){ - self.unit_light_org = self.unit_light_org1 + (self.unit_light_org2-self.unit_light_org1)*self.lerpfrac; - particleDraw = vlen(self.rootOrigin - CLIENT_vis_org); - if( particleDraw <= PARTICLE_HAZ_DISTANCE ){ - adddynamiclight2(self.unit_light_org, 150, '1.0 1.0 1.0', 0, "", PFLAGS_NOSHADOW); + else{ + if(self.headlight && MENU_PROG_OFF){ + self.unit_light_org = self.unit_light_org1 + (self.unit_light_org2-self.unit_light_org1)*self.lerpfrac; + particleDraw = vlen(self.rootOrigin - CLIENT_vis_org); + if( particleDraw <= PARTICLE_HAZ_DISTANCE ){ + adddynamiclight2(self.unit_light_org, 150, '1.0 1.0 1.0', 0, "", PFLAGS_NOSHADOW); + } } } - } - else{ - if(self.headlight && MENU_PROG_OFF){ - self.unit_light_org = self.unit_light_org1 + (self.unit_light_org2-self.unit_light_org1)*self.lerpfrac; - particleDraw = vlen(self.rootOrigin - CLIENT_vis_org); - if( particleDraw <= PARTICLE_HAZ_DISTANCE ){ - adddynamiclight2(self.unit_light_org, 150, '1.0 1.0 1.0', 0, "", PFLAGS_NOSHADOW); + //RAMSHOCKS EFFECT + particleDraw = vlen(CLIENT_vis_org - self.origin); + if( particleDraw <= PARTICLE_HAZ_DISTANCE / 2 ){ + if( self.moveState > MOVE_SPRINT ){ + makevectors(self.legs_angl); + + boostLeft = self.legs_org + (v_up * (self.cache_mins_z * 0.75)); + boostRight = self.legs_org + (v_up * (self.cache_mins_z * 0.75)); + + boostLeft = self.legs_org + (v_right * self.cache_mins_x * 0.5); + boostRight = self.legs_org + (v_right * self.cache_maxs_x * 0.5); + + traceline(boostLeft, boostLeft + (v_up * (self.cache_mins_z * 0.75)), TRUE, self); + boostLeft = trace_endpos; + + traceline(boostRight, boostRight + (v_up * (self.cache_mins_z * 0.75)), TRUE, self); + boostRight = trace_endpos; + + backLeft = boostLeft - (v_forward * 16); + backRight = boostRight - (v_forward * 16); + + pointparticles(particleeffectnum("TE_RAM_MOVE"), boostLeft, normalize(backLeft - boostLeft) * 4, random()*2); + pointparticles(particleeffectnum("TE_RAM_MOVE"), boostRight, normalize(backRight - boostRight) * 4, random()*2); + + vfxVel = self.legs_org + (v_forward * 64); + vfxVel = normalize(vfxVel - (self.legs_org + (v_forward * -64)) ); + + pointparticles(particleeffectnum("TE_RAM_RING"), self.rootOrigin + (v_up * self.cache_maxs_z/2) + (v_forward * self.cache_maxs_x), vfxVel , 1); + + traceline(self.legs_org, self.legs_org + (v_up * self.cache_mins_z * 2), TRUE, self); + adddynamiclight2(trace_endpos + (v_up * 15), self.vec_size * 200, '0.50 2.0 1.25', 4, "", PFLAGS_NOSHADOW); } } } } - - //RAMSHOCKS EFFECT - particleDraw = vlen(CLIENT_vis_org - self.origin); - if( particleDraw <= PARTICLE_HAZ_DISTANCE / 2 ){ - if( self.moveState > MOVE_SPRINT ){ - makevectors(self.legs_angl); - - boostLeft = self.legs_org + (v_up * (self.cache_mins_z * 0.75)); - boostRight = self.legs_org + (v_up * (self.cache_mins_z * 0.75)); - - boostLeft = self.legs_org + (v_right * self.cache_mins_x * 0.5); - boostRight = self.legs_org + (v_right * self.cache_maxs_x * 0.5); - - traceline(boostLeft, boostLeft + (v_up * (self.cache_mins_z * 0.75)), TRUE, self); - boostLeft = trace_endpos; - - traceline(boostRight, boostRight + (v_up * (self.cache_mins_z * 0.75)), TRUE, self); - boostRight = trace_endpos; - - backLeft = boostLeft - (v_forward * 16); - backRight = boostRight - (v_forward * 16); - - pointparticles(particleeffectnum("TE_RAM_MOVE"), boostLeft, normalize(backLeft - boostLeft) * 4, random()*2); - pointparticles(particleeffectnum("TE_RAM_MOVE"), boostRight, normalize(backRight - boostRight) * 4, random()*2); - - vfxVel = self.legs_org + (v_forward * 64); - vfxVel = normalize(vfxVel - (self.legs_org + (v_forward * -64)) ); - - pointparticles(particleeffectnum("TE_RAM_RING"), self.rootOrigin + (v_up * self.cache_maxs_z/2) + (v_forward * self.cache_maxs_x), vfxVel , 1); - - traceline(self.legs_org, self.legs_org + (v_up * self.cache_mins_z * 2), TRUE, self); - adddynamiclight2(trace_endpos + (v_up * 15), self.vec_size * 200, '0.50 2.0 1.25', 4, "", PFLAGS_NOSHADOW); - } - } } + //cockpit draw needs to be distinct because its always on, even in-death. + if( self.isLocalPlayer ){ + hud_model_cockpit_draw_frame(); + } + self.origin = self.torC_org; + self.angles = self.angles; + setmodel(self, "models/testball.md3"); + self.mins = self.cache_mins; + self.maxs = self.cache_maxs; + self.origin = self.rootOrigin; + self.angles = self.rootAngle; } - self.origin = self.torC_org; - self.angles = self.angles; - setmodel(self, "models/testball.md3"); - self.mins = self.cache_mins; - self.maxs = self.cache_maxs; - self.origin = self.rootOrigin; - self.angles = self.rootAngle; }; void( float isNew, float changeFlags ) sendent_handle_client={ @@ -436,24 +437,39 @@ void( float isNew, float changeFlags ) sendent_handle_client={ //Receive from server self.data_type = ReadByte(); //Always received, important switch value. - + self.clientServerNum = self.entnum; self.clientLocalNum = self.entnum - 1; self.isLocalPlayer = FALSE; if( self.entnum == player_localentnum ){ self.isLocalPlayer = TRUE; } - + /*EVENT - Client is new to receiver */ - if( (changeFlags & SENDFLAG_NEWENT) ){ - self.data_type = ReadByte(); + if( (changeFlags & SENDFLAG_UPDATE_FULL) ){ + self.data_idx = ReadByte(); self.deadflag = ReadByte(); - if( self.data_type == DATA_MECH && self.deadflag != DEAD_NO){ - handle_existing_crits(isNew, fabs(rint(ReadLong()))); - handle_existing_hp(isNew, ReadByte(), ReadByte(),ReadByte(),ReadByte(),ReadByte(),ReadByte()); + + if( self.deadflag == DEAD_NO ){ + if( self.data_type != DATA_POBS ){ + self.next_wepn1 = ReadByte(); + self.next_wepn2 = ReadByte(); + self.next_wepn3 = ReadByte(); + self.next_wepn4 = ReadByte(); + self.next_wepn5 = ReadByte(); + self.next_wepn6 = ReadByte(); + self.next_wepn7 = ReadByte(); + self.next_wepn8 = ReadByte(); + self.next_wepn9 = ReadByte(); + + client_event_mech_spawn( self.data_idx ); + + handle_existing_crits(isNew, ReadLong()); + handle_existing_hp(isNew, ReadByte(), ReadByte(),ReadByte(),ReadByte(),ReadByte(),ReadByte()); + } } } - + if(isNew){ self.flags = self.flags | FL_CLIENT; if( self.isLocalPlayer ){ @@ -487,9 +503,10 @@ void( float isNew, float changeFlags ) sendent_handle_client={ self.t_remove = remove_client; } + /* EVENT - Send client.flags total value*/ if( (changeFlags & SENDFLAG_EFLAGS) ){ - self.flags = fabs(rint(ReadLong())); + self.flags = ReadLong(); if(lastFlags != self.flags){ if( (lastFlags & FL_ONGROUND) && !(self.flags & FL_ONGROUND) ){ self.moveFlags = self.moveFlags - (self.moveFlags | PMF_ONGROUND); @@ -544,32 +561,20 @@ void( float isNew, float changeFlags ) sendent_handle_client={ self.data_speed_strafe = ReadFloat(); self.data_speed_backward = ReadFloat(); self.data_speed_accel = ReadFloat(); - - if( self.data_type != DATA_POBS ){ - self.data_idx = ReadByte(); - self.next_wepn1 = ReadByte(); - self.next_wepn2 = ReadByte(); - self.next_wepn3 = ReadByte(); - self.next_wepn4 = ReadByte(); - self.next_wepn5 = ReadByte(); - self.next_wepn6 = ReadByte(); - self.next_wepn7 = ReadByte(); - self.next_wepn8 = ReadByte(); - self.next_wepn9 = ReadByte(); - - if( self.prevDataType == DATA_POBS ){ - //genuine spawn event. - if( self.isLocalPlayer ){ - self.classname = "UI_ITEM"; //hack, investigate - cvar_set( "cl_forwardspeed", ftos(self.data_speed_forward) ); - cvar_set( "cl_sidespeed", ftos(self.data_speed_strafe) ); - cvar_set( "cl_backspeed", ftos(self.data_speed_backward) ); - cvar_set( "cl_movespeedkey", ftos(self.data_speed_accel) ); - } - client_event_mech_spawn( self.data_idx ); + //genuine spawn event. + if( self.isLocalPlayer ){ + self.classname = "UI_ITEM"; //hack, investigate + cvar_set( "cl_forwardspeed", ftos(self.data_speed_forward) ); + cvar_set( "cl_sidespeed", ftos(self.data_speed_strafe) ); + cvar_set( "cl_backspeed", ftos(self.data_speed_backward) ); + cvar_set( "cl_movespeedkey", ftos(self.data_speed_accel) ); + + //MODELS - COCKPIT + hud_model_cockpit_ini(); + + //MODELS - PLAYER ARMOR + hud_model_armor_player_ini(); } - handle_existing_hp(TRUE, ReadByte(), ReadByte(),ReadByte(),ReadByte(),ReadByte(),ReadByte()); - } } /* EVENT - Client has changed their unit color settings.*/ @@ -701,7 +706,7 @@ void( float isNew, float changeFlags ) sendent_handle_client={ CLIENT_data_type = self.data_type; CLIENT_data_idx = self.data_idx; - if(self.data_type == DATA_MECH){ + if( self.data_type == DATA_MECH && self.deadflag == DEAD_NO ){ CLIENT_stat_rdr_mode = self.stat_rdr_mode; CLIENT_move_state = self.moveState; CLIENT_shield = self.shield; @@ -711,14 +716,17 @@ void( float isNew, float changeFlags ) sendent_handle_client={ else{ CLIENT_shield = 0; } - if(self.shieldHitFlag > SHIELD_HIT_EMP){ - pointsound(CLIENT_vis_org, SND_HUD_SHLD_DN, 1.0, ATTN_NONE); - pointsound(CLIENT_vis_org, SND_HUD_SHLD_DN_SFX, 1.0, ATTN_NONE); + if( self.shieldHitFlag > SHIELD_HIT_EMP ){ + if( time > SFX_SHLD_TIME){ + SFX_SHLD_TIME = time + 5; + pointsound(CLIENT_vis_org, SND_HUD_SHLD_DN, 1.0, ATTN_NONE); + pointsound(CLIENT_vis_org, SND_HUD_SHLD_DN_SFX, 1.0, ATTN_NONE); + } } - else if(self.prevShield == 101 ) { - if(time > SFX_SHLD_UP_TIME){ + else if( self.prevShield == 101 ) { + if(time > SFX_SHLD_TIME){ pointsound(CLIENT_vis_org, SND_HUD_SHLD_UP_SFX, 1.0, ATTN_NONE); - SFX_SHLD_UP_TIME = time + 1; + SFX_SHLD_TIME = time + 1; } } @@ -754,8 +762,8 @@ void( float unit_id ) client_event_mech_spawn={ self.flags = self.flags - (self.flags & FL_FLY); self.flags = self.flags | FL_TURRET; - self.deadflag = DEAD_NO; - self.criticalHits = rint(0); + self.criticalHits = -1; + self.criticalHits = 0; initialize_data_mech_(unit_id); @@ -789,22 +797,31 @@ void( float unit_id ) client_event_mech_spawn={ //hud shenanigans if( self.isLocalPlayer ){ - //MODELS - COCKPIT - hud_model_cockpit_ini(); + // //MODELS - COCKPIT + // hud_model_cockpit_ini(); - //MODELS - PLAYER ARMOR - hud_model_armor_player_ini(); + // //MODELS - PLAYER ARMOR + // hud_model_armor_player_ini(); } self.shieldEffectTime = 0; self.predraw = client_predraw; self.canTarget = TRUE; - self.unit_legs = spawn(); + if( self.unit_legs == world){ + self.unit_legs = spawn(); + } + self.unit_legs.skin = self.skin; self.fixangle = TRUE; - + + self.torC_hp = 100.0; + self.torL_hp = 100.0; + self.torR_hp = 100.0; + self.armL_hp = 100.0; + self.armR_hp = 100.0; + self.legs_hp = 100.0; }; /* diff --git a/client/network/net_general.qc b/client/network/net_general.qc index 2054a6767..2f6bed0fd 100644 --- a/client/network/net_general.qc +++ b/client/network/net_general.qc @@ -109,7 +109,7 @@ void() interpolate_ground={ SendEntity - Map Objects ==================================== */ void( float isNew, float changeFlags ) sendent_handle_terrain={ - if( (changeFlags & SENDFLAG_NEWENT) ){ + if( (changeFlags & SENDFLAG_UPDATE_FULL) ){ setmodel( self, modelnameforindex(ReadShort()) ); self.origin_x = ReadCoord(); self.origin_y = ReadCoord(); @@ -166,7 +166,7 @@ void( float isNew, float changeFlags ) sendent_handle_misc_bld={ prevDeadflag = self.deadflag; - if( (changeFlags & SENDFLAG_NEWENT) ){ + if( (changeFlags & SENDFLAG_UPDATE_FULL) ){ self.clientServerNum = fabs(rint(ReadLong())); self.origin_x = ReadCoord(); self.origin_y = ReadCoord(); @@ -255,7 +255,7 @@ void( float isNew, float changeFlags ) sendent_handle_missile={ prevImpactType = self.impactType; self.oldvelocity = self.velocity; - if( (changeFlags & SENDFLAG_NEWENT) ){ + if( (changeFlags & SENDFLAG_UPDATE_FULL) ){ self.data_idx = ReadByte(); self.damageValue = ReadByte(); ownerId = ReadShort(); @@ -336,7 +336,7 @@ void( float isNew, float changeFlags ) sendent_handle_item={ if( (changeFlags & SENDFLAG_MOVE) ){} - if( (changeFlags & SENDFLAG_NEWENT) ){ + if( (changeFlags & SENDFLAG_UPDATE_FULL) ){ ownerEntId = fabs(rint(ReadLong())); self.owner = findfloat(world, entnum, ownerEntId); @@ -698,11 +698,9 @@ void(float isnew, float existCrits) handle_existing_crits={ */ void( float critical ) sendevent_mech_crit={ if( vlen(self.rootOrigin - CLIENT_vis_org) < PARTICLE_HAZ_DISTANCE){ - - traceline(self.rootOrigin, CLIENT_vis_org, TRUE, self); + traceline(self.rootOrigin, CLIENT_vis_org, TRUE, self); if( trace_ent != world || trace_fraction == 1.0){ - sound7(self, CHAN_AUTO, "sound/fx_boom.ogg", 1, ATTN_NORM, (0.5 + (random() * 0.75)) * 100, 0 ); if( ((self.unitModFlags & MOD_EXPLODE_TOR_L) && !(self.unitModFlags & MOD_MODEL_NO_TOR_L)) && (self.critBits & M_TOR_LEFT) ){ @@ -758,7 +756,7 @@ void( float isNew, float changeFlags ) sendent_handle_misc={ self.angles_z = ReadAngle(); } - if( (changeFlags & SENDFLAG_NEWENT) ){ + if( (changeFlags & SENDFLAG_UPDATE_FULL) ){ self.skin = ReadByte(); self.modelindex = ReadShort(); } diff --git a/client/network/net_gev.qc b/client/network/net_gev.qc index 7297c37e4..bc44162ba 100644 --- a/client/network/net_gev.qc +++ b/client/network/net_gev.qc @@ -66,7 +66,7 @@ void( float isNew, float changeFlags) sendent_handle_gev={ self.deadflag = ReadByte(); } - if( (changeFlags & SENDFLAG_NEWENT) ){ + if( (changeFlags & SENDFLAG_UPDATE_FULL) ){ self.data_idx = ReadByte(); self.flags = ReadLong(); self.faction = ReadByte(); @@ -141,7 +141,7 @@ void( float isNew, float changeFlags) sendent_handle_gev={ //EVENT - voice chatter if( (changeFlags & SENDFLAG_VOICE) ){ - if( !(changeFlags & SENDFLAG_NEWENT) ){ + if( !(changeFlags & SENDFLAG_UPDATE_FULL) ){ voiceId = ReadByte(); snd_hud_trnsmsn_addtoqueue(self.ai_voice_group, voiceId, self.ai_voice_limit, self.entnum); } diff --git a/client/network/net_mech_ai.qc b/client/network/net_mech_ai.qc index 615bef319..c0815111a 100644 --- a/client/network/net_mech_ai.qc +++ b/client/network/net_mech_ai.qc @@ -116,7 +116,7 @@ void( float isNew, float changeFlags ) sendent_handle_mech_ai={ self.critBits = 0; } } - if( (changeFlags & SENDFLAG_NEWENT) ){ + if( (changeFlags & SENDFLAG_UPDATE_FULL) ){ self.data_idx = ReadByte(); self.flags = ReadLong(); self.faction = ReadByte(); @@ -206,7 +206,7 @@ void( float isNew, float changeFlags ) sendent_handle_mech_ai={ //EVENT - voice chatter if( (changeFlags & SENDFLAG_VOICE) ){ - if( !(changeFlags & SENDFLAG_NEWENT) ){ + if( !(changeFlags & SENDFLAG_UPDATE_FULL) ){ voiceId = ReadByte(); snd_hud_trnsmsn_addtoqueue(self.ai_voice_group, voiceId, self.ai_voice_limit, self.entnum); } diff --git a/client/network/net_spg.qc b/client/network/net_spg.qc index 3bfed1336..e2ff1b103 100644 --- a/client/network/net_spg.qc +++ b/client/network/net_spg.qc @@ -52,7 +52,7 @@ void( float isNew, float changeFlags) sendent_handle_spg={ self.deadflag = ReadByte(); } - if( (changeFlags & SENDFLAG_NEWENT) ){ + if( (changeFlags & SENDFLAG_UPDATE_FULL) ){ self.data_idx = ReadByte(); self.flags = ReadLong(); self.faction = ReadByte(); @@ -117,7 +117,7 @@ void( float isNew, float changeFlags) sendent_handle_spg={ //EVENT - voice chatter if( (changeFlags & SENDFLAG_VOICE) ){ - if( !(changeFlags & SENDFLAG_NEWENT) ){ + if( !(changeFlags & SENDFLAG_UPDATE_FULL) ){ voiceId = ReadByte(); snd_hud_trnsmsn_addtoqueue(self.ai_voice_group, voiceId, self.ai_voice_limit, self.entnum); } diff --git a/client/network/net_tank.qc b/client/network/net_tank.qc index 250c0c233..e320d0ea8 100644 --- a/client/network/net_tank.qc +++ b/client/network/net_tank.qc @@ -54,7 +54,7 @@ void( float isNew, float changeFlags ) sendent_handle_tank={ } //EVENT - NEW ENTITY - if( (changeFlags & SENDFLAG_NEWENT) ){ + if( (changeFlags & SENDFLAG_UPDATE_FULL) ){ self.data_idx = ReadByte(); self.flags = ReadLong(); self.faction = ReadByte(); @@ -129,7 +129,7 @@ void( float isNew, float changeFlags ) sendent_handle_tank={ //EVENT - voice chatter if( (changeFlags & SENDFLAG_VOICE) ){ - if( !(changeFlags & SENDFLAG_NEWENT) ){ + if( !(changeFlags & SENDFLAG_UPDATE_FULL) ){ voiceId = ReadByte(); snd_hud_trnsmsn_addtoqueue(self.ai_voice_group, voiceId, self.ai_voice_limit, self.entnum); } diff --git a/client/network/net_turret.qc b/client/network/net_turret.qc index 0091f83ac..042272fdc 100644 --- a/client/network/net_turret.qc +++ b/client/network/net_turret.qc @@ -55,7 +55,7 @@ void( float isNew, float changeFlags) sendent_handle_turret={ self.clientServerNum = self.entnum; - if( (changeFlags & SENDFLAG_NEWENT) ){ + if( (changeFlags & SENDFLAG_UPDATE_FULL) ){ self.origin_x = ReadCoord(); self.origin_y = ReadCoord(); self.origin_z = ReadCoord(); @@ -147,7 +147,7 @@ void( float isNew, float changeFlags) sendent_handle_turret={ //EVENT - voice chatter if( (changeFlags & SENDFLAG_VOICE) ){ - if( !(changeFlags & SENDFLAG_NEWENT) ){ + if( !(changeFlags & SENDFLAG_UPDATE_FULL) ){ voiceId = ReadByte(); snd_hud_trnsmsn_addtoqueue(self.ai_voice_group, voiceId, self.ai_voice_limit, self.entnum); } diff --git a/client/ui/menu/ui_util.qc b/client/ui/menu/ui_util.qc index 7b8e70595..10a170212 100644 --- a/client/ui/menu/ui_util.qc +++ b/client/ui/menu/ui_util.qc @@ -377,7 +377,7 @@ void() scoreboard_sort={ }; /* - sendent_handle_player()-> SENDFLAG_NEWENT && isNew + sendent_handle_player()-> SENDFLAG_UPDATE_FULL && isNew scope: self == player data ent player data ent's ID at this point IS the player's Server EntID therefore scoreId is then decremented to equal player's local entId; diff --git a/common/data/buildings/data_building_barracks.qc b/common/data/buildings/data_building_barracks.qc index 33ca6ad08..b6410085b 100644 --- a/common/data/buildings/data_building_barracks.qc +++ b/common/data/buildings/data_building_barracks.qc @@ -242,7 +242,7 @@ void() building_barracks={ } if( self.canTarget || (self.spawnflags & IS_MAPKEY) ){ self.SendEntity = ctrl_send_building; - self.SendFlags = self.SendFlags | SENDFLAG_NEWENT; + self.SendFlags = self.SendFlags | SENDFLAG_UPDATE_FULL; } self.think = building_bbox_settle; self.nextthink = time + 0.01; diff --git a/common/data/buildings/data_building_fuel_tank.qc b/common/data/buildings/data_building_fuel_tank.qc index d79753aa3..538b62487 100644 --- a/common/data/buildings/data_building_fuel_tank.qc +++ b/common/data/buildings/data_building_fuel_tank.qc @@ -274,7 +274,7 @@ void() building_fuel_tank={ } if( self.canTarget || (self.spawnflags & IS_MAPKEY) ){ self.SendEntity = ctrl_send_building; - self.SendFlags = self.SendFlags | SENDFLAG_NEWENT; + self.SendFlags = self.SendFlags | SENDFLAG_UPDATE_FULL; } self.think = building_bbox_settle; diff --git a/common/data/buildings/data_building_guard_tower.qc b/common/data/buildings/data_building_guard_tower.qc index 3c0c54a07..36d86ccfe 100644 --- a/common/data/buildings/data_building_guard_tower.qc +++ b/common/data/buildings/data_building_guard_tower.qc @@ -149,7 +149,7 @@ void() building_guard_tower={ } if( self.canTarget || (self.spawnflags & IS_MAPKEY) ){ self.SendEntity = ctrl_send_building; - self.SendFlags = self.SendFlags | SENDFLAG_NEWENT; + self.SendFlags = self.SendFlags | SENDFLAG_UPDATE_FULL; } self.think = building_bbox_settle; self.nextthink = time + 0.01; diff --git a/common/data/buildings/data_building_hangar_large.qc b/common/data/buildings/data_building_hangar_large.qc index ae3d8ee72..9728063ec 100644 --- a/common/data/buildings/data_building_hangar_large.qc +++ b/common/data/buildings/data_building_hangar_large.qc @@ -231,7 +231,7 @@ void() building_hangar_mech={ } if( self.canTarget || (self.spawnflags & IS_MAPKEY) ){ self.SendEntity = ctrl_send_building; - self.SendFlags = self.SendFlags | SENDFLAG_NEWENT; + self.SendFlags = self.SendFlags | SENDFLAG_UPDATE_FULL; } self.think = building_bbox_settle; diff --git a/common/data/buildings/data_building_hangar_med.qc b/common/data/buildings/data_building_hangar_med.qc index bb445ab80..123287155 100644 --- a/common/data/buildings/data_building_hangar_med.qc +++ b/common/data/buildings/data_building_hangar_med.qc @@ -264,7 +264,7 @@ void() building_hangar_vehicle={ } if( self.canTarget || (self.spawnflags & IS_MAPKEY) ){ self.SendEntity = ctrl_send_building; - self.SendFlags = self.SendFlags | SENDFLAG_NEWENT; + self.SendFlags = self.SendFlags | SENDFLAG_UPDATE_FULL; } self.think = building_bbox_settle; self.nextthink = time + 0.01; diff --git a/common/data/buildings/data_building_power_plant.qc b/common/data/buildings/data_building_power_plant.qc index 2140ae262..b85af3134 100644 --- a/common/data/buildings/data_building_power_plant.qc +++ b/common/data/buildings/data_building_power_plant.qc @@ -317,7 +317,7 @@ void() building_power={ } if( self.canTarget || (self.spawnflags & IS_MAPKEY) ){ self.SendEntity = ctrl_send_building; - self.SendFlags = self.SendFlags | SENDFLAG_NEWENT; + self.SendFlags = self.SendFlags | SENDFLAG_UPDATE_FULL; } self.building_delay_think = hpower_th; diff --git a/common/data/buildings/data_building_radar.qc b/common/data/buildings/data_building_radar.qc index 78b682983..3efadc588 100644 --- a/common/data/buildings/data_building_radar.qc +++ b/common/data/buildings/data_building_radar.qc @@ -455,7 +455,7 @@ void() building_radar={ } if( self.canTarget || (self.spawnflags & IS_MAPKEY) ){ self.SendEntity = ctrl_send_building; - self.SendFlags = self.SendFlags | SENDFLAG_NEWENT; + self.SendFlags = self.SendFlags | SENDFLAG_UPDATE_FULL; } self.building_delay_think = building_radar_patrol1; self.think = building_bbox_settle; diff --git a/common/data/buildings/data_building_repair_bay.qc b/common/data/buildings/data_building_repair_bay.qc index 552287d4e..e2c69cc9e 100644 --- a/common/data/buildings/data_building_repair_bay.qc +++ b/common/data/buildings/data_building_repair_bay.qc @@ -748,7 +748,7 @@ void() building_repair_bay={ if( self.canTarget || (self.spawnflags & IS_MAPKEY) ){ self.SendEntity = ctrl_send_building; - self.SendFlags = self.SendFlags | SENDFLAG_NEWENT; + self.SendFlags = self.SendFlags | SENDFLAG_UPDATE_FULL; } self.ai_state_next = REPAIR_STATE_IDLE; diff --git a/common/data/buildings/data_building_shield_generator.qc b/common/data/buildings/data_building_shield_generator.qc index 7b3f899e4..c9ad84d21 100644 --- a/common/data/buildings/data_building_shield_generator.qc +++ b/common/data/buildings/data_building_shield_generator.qc @@ -415,7 +415,7 @@ void() building_shield={ } if( self.canTarget || (self.spawnflags & IS_MAPKEY) ){ self.SendEntity = ctrl_send_building; - self.SendFlags = self.SendFlags | SENDFLAG_NEWENT; + self.SendFlags = self.SendFlags | SENDFLAG_UPDATE_FULL; } self.building_delay_think = hshield_th; self.think = building_bbox_settle; diff --git a/common/data/buildings/data_building_supply_depot.qc b/common/data/buildings/data_building_supply_depot.qc index 5a694027e..dbffdc7fa 100644 --- a/common/data/buildings/data_building_supply_depot.qc +++ b/common/data/buildings/data_building_supply_depot.qc @@ -239,7 +239,7 @@ void() building_supply_depot={ if( self.canTarget || (self.spawnflags & IS_MAPKEY) ){ self.SendEntity = ctrl_send_building; - self.SendFlags = self.SendFlags | SENDFLAG_NEWENT; + self.SendFlags = self.SendFlags | SENDFLAG_UPDATE_FULL; } self.think = building_bbox_settle; diff --git a/common/data/data_values_game.qc b/common/data/data_values_game.qc index ce5a213a3..f2262606a 100644 --- a/common/data/data_values_game.qc +++ b/common/data/data_values_game.qc @@ -323,7 +323,7 @@ float AS_INT = 8; #define SENDFLAG_CRIT 16 //what component(s) blew off. #define SENDFLAG_BURN 32 //what is starting to burn. #define SENDFLAG_IMPACT 64 //specifically missile strike on something. -#define SENDFLAG_NEWENT 128 //engine-set value, do not modify +#define SENDFLAG_UPDATE_FULL 128 //engine-set value, do not modify //128 is hardcoded as isNew, dont change //.modelindex //.faction diff --git a/common/data/defs/defs_world.qc b/common/data/defs/defs_world.qc index c524993f9..3fe5f9453 100644 --- a/common/data/defs/defs_world.qc +++ b/common/data/defs/defs_world.qc @@ -26,7 +26,7 @@ entity() world_ini_serverInfo_ent={ eServerInfo.serverFlags = serverflags; eServerInfo.SendEntity = world_rules_sendEntity; - eServerInfo.SendFlags = eServerInfo.SendFlags | SENDFLAG_NEWENT; + eServerInfo.SendFlags = eServerInfo.SendFlags | SENDFLAG_UPDATE_FULL; eServerInfo.sounds = world.sounds; @@ -61,7 +61,7 @@ void() world_server_rules_frame={ self.nextthink = time + 0.1; }; -float( float isNew, float changedFlags ) world_rules_sendEntity={ +float( entity to, float changedFlags ) world_rules_sendEntity={ //SendEnt header WriteByte( MSG_ENTITY, SENDTYPE_MAP ); @@ -69,7 +69,7 @@ float( float isNew, float changedFlags ) world_rules_sendEntity={ WriteByte( MSG_ENTITY, DATA_MAP_RULES ); //================================================== - if( (changedFlags & SENDFLAG_NEWENT) ){ + if( (changedFlags & SENDFLAG_UPDATE_FULL) ){ WriteString( MSG_ENTITY, cvar_string("hostname") ); WriteString( MSG_ENTITY, cvar_string("sv_about")); WriteLong( MSG_ENTITY, self.serverFlags ); @@ -172,7 +172,7 @@ void( float isNew, float changeFlags) world_rules_readEntity={ local float nextRuleTime;*/ prevGameMode = self.gameType; - if( (changeFlags & SENDFLAG_NEWENT) ){ + if( (changeFlags & SENDFLAG_UPDATE_FULL) ){ tempHostName = ReadString(); tempAbout = ReadString(); cacheGlobalString(self.netname, tempHostName) diff --git a/common/data/defs/defs_world.qh b/common/data/defs/defs_world.qh index 59a59f110..e0aab575f 100644 --- a/common/data/defs/defs_world.qh +++ b/common/data/defs/defs_world.qh @@ -39,7 +39,7 @@ entity ENT_SERVER_INFO; #define SENDFLAG_MISSION_STATUS 16 #define SENDFLAG_MISSION_RESULT 32 #define SENDFLAG_RULE_LIMIT_FRAG 64 -//float SENDFLAG_NEWENT = 128 <- IMPORT +//float SENDFLAG_UPDATE_FULL = 128 <- IMPORT #define SENDFLAG_RULE_LIMIT_TIME 256 #define SENDFLAG_MAP_NEXT 512 #define SENDFLAG_SAVESLOT 1024 @@ -48,7 +48,7 @@ entity ENT_SERVER_INFO; #ifdef SSQC entity() world_ini_serverInfo_ent; -float( float isNew, float changedFlags ) world_rules_sendEntity; +float( entity to, float changedFlags ) world_rules_sendEntity; void() world_server_setRules; void() world_server_rules_frame; #endif diff --git a/dp/dpextensions.qc b/dp/dpextensions.qc index 10cdaf0e8..a92b7e7e0 100644 --- a/dp/dpextensions.qc +++ b/dp/dpextensions.qc @@ -2675,7 +2675,7 @@ float(string url, float id, string content_type, string delim, float buf, float //-Roohr (I dont take credit, just adding here) #define MSG_ENTITY 5 -.float( float isNew, float changedflags) SendEntity; +.float( entity to, float changedflags) SendEntity; .float SendFlags; void(float buf, float fl) WriteFloat = #280; diff --git a/main/ai/ai_ctrl.qc b/main/ai/ai_ctrl.qc index f83bec4ab..3e13aab59 100644 --- a/main/ai/ai_ctrl.qc +++ b/main/ai/ai_ctrl.qc @@ -440,7 +440,7 @@ void() ai_setup_patrol={ self.ai_timer_tracepath = time + 0.1; self.nextthink = self.nextthink + time; - self.SendFlags = self.SendFlags | SENDFLAG_NEWENT; + self.SendFlags = self.SendFlags | SENDFLAG_UPDATE_FULL; }; diff --git a/main/ai/behaviors/turret/ai_turret.qc b/main/ai/behaviors/turret/ai_turret.qc index 56f3011ee..c25d7e4b0 100644 --- a/main/ai/behaviors/turret/ai_turret.qc +++ b/main/ai/behaviors/turret/ai_turret.qc @@ -23,7 +23,7 @@ void() ai_turret={ self.touch = ai_turret_touch; self.SendEntity = ctrl_send_turret; - self.SendFlags = self.SendFlags | (SENDFLAG_MOVE | SENDFLAG_NEWENT); + self.SendFlags = self.SendFlags | (SENDFLAG_MOVE | SENDFLAG_UPDATE_FULL); self.ai_movewait = 0; diff --git a/main/client_utils.qc b/main/client_utils.qc index 0f5a82c6e..8ac7d18d9 100644 --- a/main/client_utils.qc +++ b/main/client_utils.qc @@ -114,13 +114,13 @@ void() client_push_mapobjects={ for(obj = findchainflags( flags, FL_NODE ); obj != world; obj = obj.chain){ switch( obj.data_type ){ case DATA_DEPL: - obj.SendFlags = obj.SendFlags | (SENDFLAG_NEWENT | SENDFLAG_MOVE | SENDFLAG_CRIT | SENDFLAG_TURRET); + obj.SendFlags = obj.SendFlags | (SENDFLAG_UPDATE_FULL | SENDFLAG_MOVE | SENDFLAG_CRIT | SENDFLAG_TURRET); break; case DATA_NAVP: - obj.SendFlags = obj.SendFlags | (SENDFLAG_NEWENT | SENDFLAG_MOVE | SENDFLAG_CRIT | SENDFLAG_TURRET); + obj.SendFlags = obj.SendFlags | (SENDFLAG_UPDATE_FULL | SENDFLAG_MOVE | SENDFLAG_CRIT | SENDFLAG_TURRET); break; case DATA_OBJT: - obj.SendFlags = obj.SendFlags | (SENDFLAG_NEWENT | SENDFLAG_MOVE | SENDFLAG_CRIT | SENDFLAG_TURRET); + obj.SendFlags = obj.SendFlags | (SENDFLAG_UPDATE_FULL | SENDFLAG_MOVE | SENDFLAG_CRIT | SENDFLAG_TURRET); break; } } diff --git a/main/controllers/ctrl_building.qc b/main/controllers/ctrl_building.qc index 95e04b55e..7bd0f4f2c 100644 --- a/main/controllers/ctrl_building.qc +++ b/main/controllers/ctrl_building.qc @@ -160,7 +160,7 @@ void() building_burn={ } }; -float( float isNew, float changedflags ) ctrl_send_turret={ +float( entity to, float changedflags ) ctrl_send_turret={ //HEADER WriteByte( MSG_ENTITY, SENDTYPE_TURRET ); @@ -168,7 +168,7 @@ float( float isNew, float changedflags ) ctrl_send_turret={ //================= - if( (changedflags & SENDFLAG_NEWENT) ){ + if( (changedflags & SENDFLAG_UPDATE_FULL) ){ WriteCoord( MSG_ENTITY, self.origin_x ); WriteCoord( MSG_ENTITY, self.origin_y ); WriteCoord( MSG_ENTITY, self.origin_z ); @@ -246,21 +246,21 @@ float( float isNew, float changedflags ) ctrl_send_turret={ WriteAngle( MSG_ENTITY, self.torC_angl_y ); } if( (changedflags & SENDFLAG_VOICE) ){ - if( !(changedflags & SENDFLAG_NEWENT) ){ + if( !(changedflags & SENDFLAG_UPDATE_FULL) ){ WriteByte( MSG_ENTITY, self.ai_voice_id ); } } return TRUE; }; -float( float isNew, float changedflags ) ctrl_send_building={ +float( entity to, float changedflags ) ctrl_send_building={ local float mapKey; //HEADER WriteByte( MSG_ENTITY, SENDTYPE_BUILD ); WriteLong( MSG_ENTITY, changedflags ); //================= - if( (changedflags & SENDFLAG_NEWENT) ){ + if( (changedflags & SENDFLAG_UPDATE_FULL) ){ WriteCoord( MSG_ENTITY, self.origin_x ); WriteCoord( MSG_ENTITY, self.origin_y ); WriteCoord( MSG_ENTITY, self.origin_z ); @@ -374,7 +374,7 @@ float( float isNew, float changedflags ) ctrl_send_building={ } if( (changedflags & SENDFLAG_VOICE) ){ - if( !(changedflags & SENDFLAG_NEWENT) ){ + if( !(changedflags & SENDFLAG_UPDATE_FULL) ){ WriteByte( MSG_ENTITY, self.ai_voice_id ); } } diff --git a/main/controllers/ctrl_mech.qc b/main/controllers/ctrl_mech.qc index 897b5a61e..688614139 100644 --- a/main/controllers/ctrl_mech.qc +++ b/main/controllers/ctrl_mech.qc @@ -527,7 +527,7 @@ void() touch_mechPiece={ } }; -float( float isNew, float changedflags ) ctrl_send_mech_ai={ +float( entity to, float changedflags ) ctrl_send_mech_ai={ WriteByte( MSG_ENTITY, SENDTYPE_MECH_AI ); WriteLong( MSG_ENTITY, changedflags ); @@ -555,7 +555,7 @@ float( float isNew, float changedflags ) ctrl_send_mech_ai={ self.critBits = 0; } - if( (changedflags & SENDFLAG_NEWENT) ){ + if( (changedflags & SENDFLAG_UPDATE_FULL) ){ WriteByte( MSG_ENTITY, self.data_idx ); WriteLong( MSG_ENTITY, self.flags ); WriteByte( MSG_ENTITY, self.faction ); @@ -614,7 +614,7 @@ float( float isNew, float changedflags ) ctrl_send_mech_ai={ } if( (changedflags & SENDFLAG_VOICE) ){ - if( !(changedflags & SENDFLAG_NEWENT) ){ + if( !(changedflags & SENDFLAG_UPDATE_FULL) ){ WriteByte( MSG_ENTITY, self.ai_voice_id ); } } diff --git a/main/controllers/ctrl_tank.qc b/main/controllers/ctrl_tank.qc index cd4943c35..b7a5f4b1d 100644 --- a/main/controllers/ctrl_tank.qc +++ b/main/controllers/ctrl_tank.qc @@ -114,7 +114,7 @@ void() ctrl_updateTank={ } }; -float( float isNew, float changedflags ) ctrl_send_tank={ +float( entity to, float changedflags ) ctrl_send_tank={ WriteByte( MSG_ENTITY, SENDTYPE_TANK ); WriteLong( MSG_ENTITY, changedflags ); @@ -133,7 +133,7 @@ float( float isNew, float changedflags ) ctrl_send_tank={ WriteByte( MSG_ENTITY, self.deadflag ); } - if( (changedflags & SENDFLAG_NEWENT) ){ + if( (changedflags & SENDFLAG_UPDATE_FULL) ){ WriteByte( MSG_ENTITY, self.data_idx ); WriteLong( MSG_ENTITY, self.flags ); WriteByte( MSG_ENTITY, self.faction ); @@ -172,7 +172,7 @@ float( float isNew, float changedflags ) ctrl_send_tank={ WriteLong( MSG_ENTITY, self.attackFlag ); } if( (changedflags & SENDFLAG_VOICE) ){ - if( !(changedflags & SENDFLAG_NEWENT) ){ + if( !(changedflags & SENDFLAG_UPDATE_FULL) ){ WriteByte( MSG_ENTITY, self.ai_voice_id ); } } @@ -185,7 +185,7 @@ float( float isNew, float changedflags ) ctrl_send_tank={ return TRUE; }; -float( float isNew, float changedflags ) ctrl_send_spg={ +float( entity to, float changedflags ) ctrl_send_spg={ WriteByte( MSG_ENTITY, SENDTYPE_SPG ); WriteLong( MSG_ENTITY, changedflags ); @@ -204,7 +204,7 @@ float( float isNew, float changedflags ) ctrl_send_spg={ WriteByte( MSG_ENTITY, self.deadflag ); } - if( (changedflags & SENDFLAG_NEWENT) ){ + if( (changedflags & SENDFLAG_UPDATE_FULL) ){ WriteByte( MSG_ENTITY, self.data_idx ); WriteLong( MSG_ENTITY, self.flags ); WriteByte( MSG_ENTITY, self.faction ); @@ -238,7 +238,7 @@ float( float isNew, float changedflags ) ctrl_send_spg={ WriteLong( MSG_ENTITY, self.attackFlag ); } if( (changedflags & SENDFLAG_VOICE) ){ - if( !(changedflags & SENDFLAG_NEWENT) ){ + if( !(changedflags & SENDFLAG_UPDATE_FULL) ){ WriteByte( MSG_ENTITY, self.ai_voice_id ); } } @@ -249,7 +249,7 @@ float( float isNew, float changedflags ) ctrl_send_spg={ return TRUE; }; -float( float isNew, float changedflags ) ctrl_send_gev={ +float( entity to, float changedflags ) ctrl_send_gev={ WriteByte( MSG_ENTITY, SENDTYPE_GEV ); WriteLong( MSG_ENTITY, changedflags ); @@ -268,7 +268,7 @@ float( float isNew, float changedflags ) ctrl_send_gev={ WriteByte( MSG_ENTITY, self.deadflag ); } - if( (changedflags & SENDFLAG_NEWENT) ){ + if( (changedflags & SENDFLAG_UPDATE_FULL) ){ WriteByte( MSG_ENTITY, self.data_idx ); WriteLong( MSG_ENTITY, self.flags ); WriteByte( MSG_ENTITY, self.faction ); @@ -307,7 +307,7 @@ float( float isNew, float changedflags ) ctrl_send_gev={ } if( (changedflags & SENDFLAG_VOICE) ){ - if( !(changedflags & SENDFLAG_NEWENT) ){ + if( !(changedflags & SENDFLAG_UPDATE_FULL) ){ WriteByte( MSG_ENTITY, self.ai_voice_id ); } } diff --git a/main/controllers/ctrl_units.qc b/main/controllers/ctrl_units.qc index 11fd5f8d8..424f9eebf 100644 --- a/main/controllers/ctrl_units.qc +++ b/main/controllers/ctrl_units.qc @@ -52,7 +52,7 @@ void(entity unitPiece) ctrl_unit_remove_piece={ /* OBJECT - Nav Point */ -float( float isNew, float changedFlags ) send_nav_point={ +float( entity to, float changedFlags ) send_nav_point={ //HEADER WriteByte( MSG_ENTITY, SENDTYPE_MAP ); WriteLong( MSG_ENTITY, changedFlags ); @@ -84,7 +84,7 @@ float( float isNew, float changedFlags ) send_nav_point={ } //EVENT - new to player - if( (changedFlags & SENDFLAG_NEWENT) ){ + if( (changedFlags & SENDFLAG_UPDATE_FULL) ){ WriteByte( MSG_ENTITY, self.data_idx ); } return TRUE; @@ -94,7 +94,7 @@ float( float isNew, float changedFlags ) send_nav_point={ /* OBJECT - Mission Objective */ -float( float isNew, float changedFlags ) send_objective={ +float( entity to, float changedFlags ) send_objective={ //HEADER WriteByte( MSG_ENTITY, SENDTYPE_MAP ); WriteLong( MSG_ENTITY, changedFlags ); @@ -120,7 +120,7 @@ float( float isNew, float changedFlags ) send_objective={ } //EVENT - New Ent - if( (changedFlags & SENDFLAG_NEWENT) ){ + if( (changedFlags & SENDFLAG_UPDATE_FULL) ){ WriteByte( MSG_ENTITY, self.data_idx ); } @@ -130,7 +130,7 @@ float( float isNew, float changedFlags ) send_objective={ /* OBJECT - Player Deploy point */ -float( float isNew, float changedFlags ) send_deploy_point={ +float( entity to, float changedFlags ) send_deploy_point={ //HEADER WriteByte( MSG_ENTITY, SENDTYPE_MAP ); WriteLong( MSG_ENTITY, changedFlags ); @@ -162,7 +162,7 @@ float( float isNew, float changedFlags ) send_deploy_point={ } //EVENT - New Ent - if( (changedFlags & SENDFLAG_NEWENT) ){ + if( (changedFlags & SENDFLAG_UPDATE_FULL) ){ WriteByte( MSG_ENTITY, self.data_idx ); WriteCoord( MSG_ENTITY, self.origin_x ); WriteCoord( MSG_ENTITY, self.origin_y ); @@ -175,44 +175,39 @@ float( float isNew, float changedFlags ) send_deploy_point={ }; -float( float isNew, float changedFlags ) send_damage_zone={ +float( entity to, float changedFlags ) send_damage_zone={ local float newFlags; - - newFlags = changedFlags; - if( isNew ){ - newFlags = newFlags | (SENDFLAG_MOVE | SENDFLAG_ANGLE); - } - + //HEADER WriteByte( MSG_ENTITY, SENDTYPE_MAP ); - WriteLong( MSG_ENTITY, newFlags ); + WriteLong( MSG_ENTITY, changedFlags ); WriteByte( MSG_ENTITY, DATA_MAP_DMG ); //============ - if( (newFlags & SENDFLAG_BURN) ){ + if( (changedFlags & SENDFLAG_BURN) ){ //use to adjust isActive, toggling the field } - if( (newFlags & SENDFLAG_DEAD) ){ + if( (changedFlags & SENDFLAG_DEAD) ){ WriteByte( MSG_ENTITY, self.isActive ); } - if( (newFlags & SENDFLAG_CRIT) ){ + if( (changedFlags & SENDFLAG_CRIT) ){ WriteByte( MSG_ENTITY, 1 ); } - if( (newFlags & SENDFLAG_MOVE) ){ + if( (changedFlags & SENDFLAG_MOVE) ){ WriteCoord( MSG_ENTITY, self.origin_x ); WriteCoord( MSG_ENTITY, self.origin_y ); WriteCoord( MSG_ENTITY, self.origin_z ); } - if( (newFlags & SENDFLAG_ANGLE) ){ + if( (changedFlags & SENDFLAG_ANGLE) ){ WriteAngle( MSG_ENTITY, self.angles_x ); WriteAngle( MSG_ENTITY, self.angles_y ); WriteAngle( MSG_ENTITY, self.angles_z ); } - if( (changedFlags & SENDFLAG_NEWENT) ){ + if( (changedFlags & SENDFLAG_UPDATE_FULL) ){ WriteByte( MSG_ENTITY, self.data_idx ); WriteLong( MSG_ENTITY, self.spawnflags ); WriteByte( MSG_ENTITY, self.damageType ); diff --git a/main/controllers/ctrl_weapon.qc b/main/controllers/ctrl_weapon.qc index d6d316df5..fd657b1f9 100644 --- a/main/controllers/ctrl_weapon.qc +++ b/main/controllers/ctrl_weapon.qc @@ -383,14 +383,14 @@ void() ctrl_weapon_update={ */ -float( float isNew, float changedflags ) ctrl_send_weapon={ +float( entity to, float changedflags ) ctrl_send_weapon={ WriteByte( MSG_ENTITY, SENDTYPE_ITEM ); WriteLong( MSG_ENTITY, changedflags ); if( (changedflags & SENDFLAG_MOVE) ){} - if( (changedflags & SENDFLAG_NEWENT) ){ + if( (changedflags & SENDFLAG_UPDATE_FULL) ){ WriteLong( MSG_ENTITY, num_for_edict(self.owner)); WriteByte( MSG_ENTITY, self.data_idx); diff --git a/main/controllers/headers/controllers.qh b/main/controllers/headers/controllers.qh index 917d9f22e..6993d9cc6 100644 --- a/main/controllers/headers/controllers.qh +++ b/main/controllers/headers/controllers.qh @@ -32,11 +32,11 @@ void() ctrl_player_mech_touch; void() touch_mechPiece; -float( float isNew, float changeFlags ) ctrl_send_mech_ai; +float( entity to, float changeFlags ) ctrl_send_mech_ai; //Building entity controllers -float( float isNew, float changedflags ) ctrl_send_turret; -float( float isNew, float changedflags ) ctrl_send_building; +float( entity to, float changedflags ) ctrl_send_turret; +float( entity to, float changedflags ) ctrl_send_building; void() building_burn_th; //generic check-for-burning think void() building_burn; void() building_die; @@ -44,17 +44,17 @@ void() building_bbox_settle; //Vehicle entity controllers void() ctrl_updateTank; -float( float isNew, float changedflags ) ctrl_send_tank; -float( float isNew, float changedflags ) ctrl_send_spg; -float( float isNew, float changedflags ) ctrl_send_gev; +float( entity to, float changedflags ) ctrl_send_tank; +float( entity to, float changedflags ) ctrl_send_spg; +float( entity to, float changedflags ) ctrl_send_gev; //Generic entity controllers void() ctrl_die_weapon; -float( float isNew, float changedFlags ) send_deploy_point; -float( float isNew, float changedFlags ) send_nav_point; -float( float isNew, float changedFlags ) send_objective; -float( float isNew, float changedFlags ) send_damage_zone; +float( entity to, float changedFlags ) send_deploy_point; +float( entity to, float changedFlags ) send_nav_point; +float( entity to, float changedFlags ) send_objective; +float( entity to, float changedFlags ) send_damage_zone; //Weapon/equip controllers void(entity wep) ctrl_weapon_think; @@ -68,4 +68,4 @@ void() ctrl_missile_dud; void() ctrl_missile_dud_touch; void(entity wep) ctrl_weapon_update_player; void() ctrl_missile_lastframe; -float( float isNew, float changedflags ) ctrl_send_weapon; \ No newline at end of file +float( entity to, float changedflags ) ctrl_send_weapon; \ No newline at end of file diff --git a/main/effectinfo_api.qc b/main/effectinfo_api.qc index 67e205663..723eee61c 100644 --- a/main/effectinfo_api.qc +++ b/main/effectinfo_api.qc @@ -16,11 +16,11 @@ vector( vector startOrg ) te_apply_wind={ return windVel; }; -float( float isNew, float changedFlags ) te_send_missile={ +float( entity to, float changedFlags ) te_send_missile={ WriteByte( MSG_ENTITY, SENDTYPE_PROJ ); WriteLong( MSG_ENTITY, changedFlags ); - if( (changedFlags & SENDFLAG_NEWENT) ){ + if( (changedFlags & SENDFLAG_UPDATE_FULL) ){ WriteByte( MSG_ENTITY, self.data_idx ); WriteByte( MSG_ENTITY, self.damageValue ); WriteShort( MSG_ENTITY, num_for_edict(self.owner)); diff --git a/main/entityFactory_player.qc b/main/entityFactory_player.qc index 5dac638af..c50a4432d 100644 --- a/main/entityFactory_player.qc +++ b/main/entityFactory_player.qc @@ -31,7 +31,13 @@ void() player_makeObserver={ self.data_speed_accel = 2; self.canTarget = FALSE; self.deadflag = DEAD_NO; - self.SendFlags = self.SendFlags | SENDFLAG_NEWUNIT | SENDFLAG_EFLAGS | SENDFLAG_DEAD; + + self.critBits = -1; + self.criticalHits = -1; + self.criticalHits = 0; + self.health = 1; + self.max_health = 1; + self.SendFlags = self.SendFlags | SENDFLAG_NEWUNIT | SENDFLAG_EFLAGS | SENDFLAG_DEAD | SENDFLAG_TARGET; }; void() player_unmakeObserver={ @@ -67,7 +73,7 @@ void() player_makeMech={ //self.power_timer_segment = time + (self.startupDelay / 100 ); not sure why this was needed self.playerState = PLAYER_POWERUP_BEGIN; self.last_color = FALSE; - self.new_color = FALSE; + self.new_color = TRUE; self.enemy = world; client_push_player_info(); @@ -108,7 +114,7 @@ void() player_makeMech={ self.targetEntId = 0; self.new_color = TRUE; self.effects = self.effects | EF_NODEPTHTEST; - self.SendFlags = self.SendFlags | (SENDFLAG_VELOCITY | SENDFLAG_MOVE | SENDFLAG_TURRET | SENDFLAG_NEWUNIT | SENDFLAG_EFLAGS | SENDFLAG_COLORS | SENDFLAG_CAMERA | SENDFLAG_FACTION | SENDFLAG_RADAR | SENDFLAG_TARGET); + self.SendFlags = self.SendFlags | (SENDFLAG_UPDATE_FULL | SENDFLAG_MOVE | SENDFLAG_TURRET | SENDFLAG_NEWUNIT | SENDFLAG_EFLAGS | SENDFLAG_COLORS | SENDFLAG_CAMERA | SENDFLAG_FACTION | SENDFLAG_RADAR); }; void() player_unmakeMech={ diff --git a/main/extensions/ext_world.qc b/main/extensions/ext_world.qc index 6ee4a7959..2a9ed515d 100644 --- a/main/extensions/ext_world.qc +++ b/main/extensions/ext_world.qc @@ -79,8 +79,6 @@ void() world_metal_ini={ world_ini_serverinfo(); //kept in numerical order for easy reference. - addstat(32, AS_FLOAT, deadflag); - addstat(STAT_ENV_WARN, AS_FLOAT, stat_env_warn); addstat(STAT_RAM, AS_INT, ramUp); diff --git a/main/headers/effectinfo_api.qh b/main/headers/effectinfo_api.qh index e90f0ee09..312b16f30 100644 --- a/main/headers/effectinfo_api.qh +++ b/main/headers/effectinfo_api.qh @@ -18,7 +18,7 @@ float DEBRIS_COUNT; .float pcl_effectnum; -float( float isNew, float changedFlags ) te_send_missile; +float( entity to, float changedFlags ) te_send_missile; void(string gibname, float dm) ThrowGib ; vector(float dm) VelocityForDamage; diff --git a/main/map/map_damage_zone.qc b/main/map/map_damage_zone.qc index c82cf8d71..8a55ca591 100644 --- a/main/map/map_damage_zone.qc +++ b/main/map/map_damage_zone.qc @@ -21,7 +21,7 @@ Overview: */ void() map_hazard_ping={ self.SendEntity = send_damage_zone; - self.SendFlags = self.SendFlags | SENDFLAG_NEWENT; + self.SendFlags = self.SendFlags | SENDFLAG_UPDATE_FULL; self.think = self.th_walk; if( self.isActive ){ diff --git a/main/map/map_deploy_point.qc b/main/map/map_deploy_point.qc index e37694976..5415e1fb6 100644 --- a/main/map/map_deploy_point.qc +++ b/main/map/map_deploy_point.qc @@ -92,7 +92,7 @@ void() map_deploy_point={ } self.SendEntity = send_deploy_point; - self.SendFlags = self.SendFlags | (SENDFLAG_NEWENT | SENDFLAG_MOVE | SENDFLAG_CRIT | SENDFLAG_TURRET); + self.SendFlags = self.SendFlags | (SENDFLAG_UPDATE_FULL | SENDFLAG_MOVE | SENDFLAG_CRIT | SENDFLAG_TURRET); self.think = deploy_point_ini; self.nextthink = time + 0.1; } @@ -122,7 +122,7 @@ void() deploy_point_remote_use={ }; void() deploy_point_remote_send={ - self.SendFlags = self.SendFlags | SENDFLAG_NEWENT; + self.SendFlags = self.SendFlags | SENDFLAG_UPDATE_FULL; }; void() deploy_point_remote_query={ @@ -170,7 +170,7 @@ void() map_deploy_point_remote={ setorigin( self, self.origin ); self.SendEntity = send_deploy_point; - self.SendFlags = self.SendFlags | SENDFLAG_NEWENT; + self.SendFlags = self.SendFlags | SENDFLAG_UPDATE_FULL; self.use = deploy_point_remote_use; self.think = deploy_point_remote_query; diff --git a/main/map/map_misc_buildings.qc b/main/map/map_misc_buildings.qc index 3eeed7a6d..e9f957f72 100644 --- a/main/map/map_misc_buildings.qc +++ b/main/map/map_misc_buildings.qc @@ -6,13 +6,13 @@ Overview: misc buildings that really serve no direct purpose */ -float( float isNew, float changeFlags ) sendent_misc_building={ +float( entity to, float changeFlags ) sendent_misc_building={ WriteByte( MSG_ENTITY, SENDTYPE_MISC_BLD ); WriteLong( MSG_ENTITY, changeFlags ); //====================== - if( (changeFlags & SENDFLAG_NEWENT) ){ + if( (changeFlags & SENDFLAG_UPDATE_FULL) ){ WriteLong( MSG_ENTITY, num_for_edict(self)); WriteCoord( MSG_ENTITY, self.origin_x ); WriteCoord( MSG_ENTITY, self.origin_y ); diff --git a/main/map/map_misc_model.qc b/main/map/map_misc_model.qc index 42dda658f..7412921f5 100644 --- a/main/map/map_misc_model.qc +++ b/main/map/map_misc_model.qc @@ -15,7 +15,7 @@ float( float isNew, float changeFlags) terrain_model_send={ WriteByte( MSG_ENTITY, SENDTYPE_TERRAIN ); WriteLong( MSG_ENTITY, changeFlags ); - if( (changeFlags & SENDFLAG_NEWENT) ){ + if( (changeFlags & SENDFLAG_UPDATE_FULL) ){ WriteShort( MSG_ENTITY, self.modelindex ); WriteCoord( MSG_ENTITY, self.origin_x ); WriteCoord( MSG_ENTITY, self.origin_y ); @@ -66,7 +66,7 @@ void() map_terrain_model={ self.effects = EF_NOSHADOW; } //self.SendEntity = terrain_model_send; - //self.SendFlags = self.SendFlags | SENDFLAG_NEWENT; + //self.SendFlags = self.SendFlags | SENDFLAG_UPDATE_FULL; }; diff --git a/main/map/map_nav_point.qc b/main/map/map_nav_point.qc index 04272f59d..f0ff1060a 100644 --- a/main/map/map_nav_point.qc +++ b/main/map/map_nav_point.qc @@ -73,7 +73,7 @@ void() map_nav_point_th={ }; void() map_nav_point_ini={ - self.SendFlags = self.SendFlags | (SENDFLAG_NEWENT | SENDFLAG_MOVE | SENDFLAG_CRIT | SENDFLAG_TURRET); + self.SendFlags = self.SendFlags | (SENDFLAG_UPDATE_FULL | SENDFLAG_MOVE | SENDFLAG_CRIT | SENDFLAG_TURRET); self.think = map_nav_point_th; self.nextthink = time + 1; }; @@ -221,7 +221,7 @@ void() nav_omega{ void() map_nav_point_remote_send={ - self.SendFlags = self.SendFlags | (SENDFLAG_NEWENT | SENDFLAG_MOVE | SENDFLAG_CRIT | SENDFLAG_TURRET); + self.SendFlags = self.SendFlags | (SENDFLAG_UPDATE_FULL | SENDFLAG_MOVE | SENDFLAG_CRIT | SENDFLAG_TURRET); }; void() map_nav_point_remote_query={ @@ -262,7 +262,7 @@ void() map_nav_point_remote={ setorigin( self, self.origin ); self.SendEntity = send_nav_point; - self.SendFlags = self.SendFlags | (SENDFLAG_NEWENT | SENDFLAG_MOVE | SENDFLAG_CRIT | SENDFLAG_TURRET); + self.SendFlags = self.SendFlags | (SENDFLAG_UPDATE_FULL | SENDFLAG_MOVE | SENDFLAG_CRIT | SENDFLAG_TURRET); self.think = map_nav_point_remote_query; self.nextthink = time + 0.1; }; \ No newline at end of file diff --git a/main/map/map_objective.qc b/main/map/map_objective.qc index 76fb19134..68a66512d 100644 --- a/main/map/map_objective.qc +++ b/main/map/map_objective.qc @@ -87,7 +87,7 @@ void() map_objective_th={ }; void() map_objective_ini={ - self.SendFlags = self.SendFlags | (SENDFLAG_NEWENT | SENDFLAG_MOVE | SENDFLAG_CRIT | SENDFLAG_TURRET); + self.SendFlags = self.SendFlags | (SENDFLAG_UPDATE_FULL | SENDFLAG_MOVE | SENDFLAG_CRIT | SENDFLAG_TURRET); self.think = map_objective_th; self.nextthink = time + 0.1; }; diff --git a/main/map/map_particlecube_effect.qc b/main/map/map_particlecube_effect.qc index 9287a10ef..a3ebca47c 100644 --- a/main/map/map_particlecube_effect.qc +++ b/main/map/map_particlecube_effect.qc @@ -100,17 +100,17 @@ void() map_particlecube_effect={ void() func_meta_particlecube_th={ - self.SendFlags = self.SendFlags | SENDFLAG_NEWENT; + self.SendFlags = self.SendFlags | SENDFLAG_UPDATE_FULL; }; -float( float isNew, float changedFlags ) send_pcl_cube_meta={ +float( entity to, float changedFlags ) send_pcl_cube_meta={ //HEADER WriteByte( MSG_ENTITY, SENDTYPE_MAP ); WriteLong( MSG_ENTITY, changedFlags ); WriteByte( MSG_ENTITY, DATA_PCL_CUBE ); //-------- - if( (changedFlags & SENDFLAG_NEWENT) ){ + if( (changedFlags & SENDFLAG_UPDATE_FULL) ){ WriteCoord(MSG_ENTITY, self.absmin_x); WriteCoord(MSG_ENTITY, self.absmin_y); WriteCoord(MSG_ENTITY, self.absmin_z); diff --git a/main/map/map_scenery.qc b/main/map/map_scenery.qc index e203dd440..1d0964407 100644 --- a/main/map/map_scenery.qc +++ b/main/map/map_scenery.qc @@ -42,7 +42,7 @@ float( float isNew, float changeFlags ) send_scenery={ //dead event. } - if( (newFlags & SENDFLAG_NEWENT) ){ + if( (newFlags & SENDFLAG_UPDATE_FULL) ){ WriteByte( MSG_ENTITY, self.skin ); WriteShort( MSG_ENTITY, rint(self.modelindex) ); } @@ -98,7 +98,7 @@ void() doodad_rocks_1={ } scenery_obj(); //self.SendEntity = send_scenery; - //self.SendFlags = self.SendFlags | SENDFLAG_NEWENT; + //self.SendFlags = self.SendFlags | SENDFLAG_UPDATE_FULL; self.takedamage = DAMAGE_AIM; if(!self.health){ self.health = self.max_health = 250; @@ -115,7 +115,7 @@ void() doodad_rocks_2={ } scenery_obj(); //self.SendEntity = send_scenery; - //self.SendFlags = self.SendFlags | SENDFLAG_NEWENT; + //self.SendFlags = self.SendFlags | SENDFLAG_UPDATE_FULL; self.takedamage = DAMAGE_AIM; if(!self.health){ self.health = self.max_health = 250; @@ -132,7 +132,7 @@ void() doodad_rocks_3={ } scenery_obj(); //self.SendEntity = send_scenery; - //self.SendFlags = self.SendFlags | SENDFLAG_NEWENT; + //self.SendFlags = self.SendFlags | SENDFLAG_UPDATE_FULL; self.takedamage = DAMAGE_AIM; if(!self.health){ self.health = self.max_health = 250; @@ -167,7 +167,7 @@ void() doodad_rocks_column_1={ makevectors(self.angles); setorigin( self, self.origin); //self.SendEntity = send_scenery; - //self.SendFlags = self.SendFlags | SENDFLAG_NEWENT; + //self.SendFlags = self.SendFlags | SENDFLAG_UPDATE_FULL; }; void() doodad_rocks_column_2={ self.model = "models/map/rocks/rockcol2.md3"; @@ -180,7 +180,7 @@ void() doodad_rocks_column_2={ makevectors(self.angles); setorigin( self, self.origin); //self.SendEntity = send_scenery; - //self.SendFlags = self.SendFlags | SENDFLAG_NEWENT; + //self.SendFlags = self.SendFlags | SENDFLAG_UPDATE_FULL; }; void() doodad_rocks_column_3={ self.model = "models/map/rocks/rockcol3.md3"; @@ -193,7 +193,7 @@ void() doodad_rocks_column_3={ makevectors(self.angles); setorigin( self, self.origin ); //self.SendEntity = send_scenery; - //self.SendFlags = self.SendFlags | SENDFLAG_NEWENT; + //self.SendFlags = self.SendFlags | SENDFLAG_UPDATE_FULL; }; void() doodad_rocks_col_random={ diff --git a/main/sv/headers/sv_player_api.qh b/main/sv/headers/sv_player_api.qh index 472e952fe..993a32771 100644 --- a/main/sv/headers/sv_player_api.qh +++ b/main/sv/headers/sv_player_api.qh @@ -21,5 +21,5 @@ void() PlayerPostThink; void() PlayerPreThink_powerup; //used when player is powering up for the first time. void() PlayerPostThink_powerup; void() PlayerDieEnd; //replaces think functions originally set by player animations. -void() PlayerDieNetwork; -void() PlayerDieNetworkEnd; \ No newline at end of file +//void() PlayerDieNetwork; +//void() PlayerDieNetworkEnd; \ No newline at end of file diff --git a/main/sv/sv_client_api.qc b/main/sv/sv_client_api.qc index 1b0d2a58c..b101724a1 100644 --- a/main/sv/sv_client_api.qc +++ b/main/sv/sv_client_api.qc @@ -18,7 +18,7 @@ void() player_think_normal; SendEntity - Client */ -float( float isNew, float changeFlags ) send_client={ +float( entity to, float changeFlags ) send_client={ local entity player; local float prevType; @@ -29,20 +29,31 @@ float( float isNew, float changeFlags ) send_client={ //Always send, cost saving just send this here. WriteByte( MSG_ENTITY, self.data_type ); //always send type, always. - + /*EVENT - Client is new to receiver */ - if( (changeFlags & SENDFLAG_NEWENT) ){ - WriteByte( MSG_ENTITY, self.data_type ); - //WriteLong( MSG_ENTITY, self.criticalHits); //sync clients-copies to server-state. + if( (changeFlags & SENDFLAG_UPDATE_FULL) ){ + WriteByte( MSG_ENTITY, self.data_idx ); WriteByte( MSG_ENTITY, self.deadflag); - if( self.data_type == DATA_MECH && self.deadflag != DEAD_NO ){ - WriteLong( MSG_ENTITY, self.criticalHits ); - WriteByte( MSG_ENTITY, (self.health / self.max_health) * 100 ); - WriteByte( MSG_ENTITY, (self.torL_hp / self.torL_hpMax) * 100 ); - WriteByte( MSG_ENTITY, (self.torR_hp / self.torR_hpMax) * 100 ); - WriteByte( MSG_ENTITY, (self.armL_hp / self.armL_hpMax) * 100 ); - WriteByte( MSG_ENTITY, (self.armR_hp / self.armR_hpMax) * 100 ); - WriteByte( MSG_ENTITY, (self.legs_hp / self.legs_hpMax) * 100 ); + if( self.deadflag == DEAD_NO){ + if( self.data_type != DATA_POBS ){ + WriteByte( MSG_ENTITY, self.next_wepn1); + WriteByte( MSG_ENTITY, self.next_wepn2); + WriteByte( MSG_ENTITY, self.next_wepn3); + WriteByte( MSG_ENTITY, self.next_wepn4); + WriteByte( MSG_ENTITY, self.next_wepn5); + WriteByte( MSG_ENTITY, self.next_wepn6); + WriteByte( MSG_ENTITY, self.next_wepn7); + WriteByte( MSG_ENTITY, self.next_wepn8); + WriteByte( MSG_ENTITY, self.next_wepn9); + + WriteLong( MSG_ENTITY, self.criticalHits ); + WriteByte( MSG_ENTITY, (self.health / self.max_health) * 100 ); + WriteByte( MSG_ENTITY, (self.torL_hp / self.torL_hpMax) * 100 ); + WriteByte( MSG_ENTITY, (self.torR_hp / self.torR_hpMax) * 100 ); + WriteByte( MSG_ENTITY, (self.armL_hp / self.armL_hpMax) * 100 ); + WriteByte( MSG_ENTITY, (self.armR_hp / self.armR_hpMax) * 100 ); + WriteByte( MSG_ENTITY, (self.legs_hp / self.legs_hpMax) * 100 ); + } } } @@ -100,27 +111,6 @@ float( float isNew, float changeFlags ) send_client={ WriteFloat( MSG_ENTITY, self.data_speed_strafe); WriteFloat( MSG_ENTITY, self.data_speed_backward); WriteFloat( MSG_ENTITY, self.data_speed_accel); - - if( self.data_type != DATA_POBS ){ - WriteByte( MSG_ENTITY, self.data_idx ); - WriteByte( MSG_ENTITY, self.next_wepn1); - WriteByte( MSG_ENTITY, self.next_wepn2); - WriteByte( MSG_ENTITY, self.next_wepn3); - WriteByte( MSG_ENTITY, self.next_wepn4); - WriteByte( MSG_ENTITY, self.next_wepn5); - WriteByte( MSG_ENTITY, self.next_wepn6); - WriteByte( MSG_ENTITY, self.next_wepn7); - WriteByte( MSG_ENTITY, self.next_wepn8); - WriteByte( MSG_ENTITY, self.next_wepn9); - - - WriteByte( MSG_ENTITY, (self.health / self.max_health) * 100 ); - WriteByte( MSG_ENTITY, (self.torL_hp / self.torL_hpMax) * 100 ); - WriteByte( MSG_ENTITY, (self.torR_hp / self.torR_hpMax) * 100 ); - WriteByte( MSG_ENTITY, (self.armL_hp / self.armL_hpMax) * 100 ); - WriteByte( MSG_ENTITY, (self.armR_hp / self.armR_hpMax) * 100 ); - WriteByte( MSG_ENTITY, (self.legs_hp / self.legs_hpMax) * 100 ); - } } /* EVENT - Client has changed their unit color settings.*/ @@ -177,7 +167,6 @@ float( float isNew, float changeFlags ) send_client={ //placed here for just-in-time calculation // because not all SendFlags might be sent exactly when called, and the code originally was clearing out critBits WriteLong( MSG_ENTITY, self.critBits ); - self.critBits = 0; } /* EVENT - Client has acquired a new target. */ @@ -185,8 +174,6 @@ float( float isNew, float changeFlags ) send_client={ WriteLong( MSG_ENTITY, self.targetEntId ); } } - - self.shieldHitFlag = 0; return TRUE; }; @@ -462,7 +449,7 @@ note: This is also called after a player respawns too... */ void() PutClientInServer = { - self.SendFlags = self.SendFlags | SENDFLAG_NEWENT; + self.SendFlags = self.SendFlags | SENDFLAG_UPDATE_FULL; self.nextthink = time + 0.01; self.flags = FL_CLIENT; @@ -785,7 +772,6 @@ void() PutClientInServer_TeamDeathmatch={ }; void() sv_client_respawn={ - if( ENT_SERVER_INFO.gameType == GAMEMODE_COOP ){ // get the spawn parms as they were at level start //setspawnparms (self); diff --git a/main/sv/sv_player_api.qc b/main/sv/sv_player_api.qc index 2a422716d..8dcbe1d2f 100644 --- a/main/sv/sv_player_api.qc +++ b/main/sv/sv_player_api.qc @@ -576,6 +576,7 @@ void() PlayerDead={ } self.health = 1; + self.max_health = 1; }; //called in PlayerPreThink() when self.deadflag == DEAD_DEAD diff --git a/main/t_damage.qc b/main/t_damage.qc index 53ff65c86..24243ca8d 100644 --- a/main/t_damage.qc +++ b/main/t_damage.qc @@ -45,12 +45,8 @@ float(entity trg, entity inflictor, entity attacker, float dmg_amt, vector dmg_p } } - //------------> Damage Buffer system - if( trg.data_type != DATA_BLD ){ - dmgTrg.SendFlags = dmgTrg.SendFlags | SENDFLAG_IMPACT; - } - //----------------------- - + dmgTrg.SendFlags = dmgTrg.SendFlags | SENDFLAG_IMPACT; + trg.dmg_inflictor = inflictor; if(trg.was_hit < time){ trg.was_hit = time + 1;