Skip to content

Commit

Permalink
large refactor: Thanks to Spoike for clearing up some SendEntity info…
Browse files Browse the repository at this point in the history
…rmation; 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.
  • Loading branch information
Subject9x committed Sep 29, 2023
1 parent f88af90 commit 08aeb81
Show file tree
Hide file tree
Showing 53 changed files with 403 additions and 406 deletions.
2 changes: 1 addition & 1 deletion client/data/data_buildings.qc
Original file line number Diff line number Diff line change
Expand Up @@ -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
*/
Expand Down
10 changes: 5 additions & 5 deletions client/data/data_mapobjs.qc
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}

Expand Down Expand Up @@ -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;
}
Expand Down Expand Up @@ -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();
Expand Down Expand Up @@ -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();
Expand Down Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion client/data/data_turrets.qc
Original file line number Diff line number Diff line change
Expand Up @@ -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
*/
Expand Down
2 changes: 1 addition & 1 deletion client/data/headers/data_buildings.qh
Original file line number Diff line number Diff line change
Expand Up @@ -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
*/
Expand Down
2 changes: 1 addition & 1 deletion client/data/headers/data_turrets.qh
Original file line number Diff line number Diff line change
Expand Up @@ -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
*/
Expand Down
4 changes: 2 additions & 2 deletions client/network/net_building.qc
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down Expand Up @@ -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);
}
Expand Down
Loading

0 comments on commit 08aeb81

Please sign in to comment.