From fb40427c3c647a358319896217c079e017e9e594 Mon Sep 17 00:00:00 2001 From: cypress Date: Sun, 12 Nov 2023 10:46:49 -0500 Subject: [PATCH] CLIENT: Network more important client fields --- source/client/hud.qc | 3 ++- source/client/main.qc | 4 ++++ source/server/clientfuncs.qc | 3 +++ source/server/defs/custom.qc | 1 - source/shared/defs/custom.qc | 2 ++ 5 files changed, 11 insertions(+), 2 deletions(-) diff --git a/source/client/hud.qc b/source/client/hud.qc index f796e16..f90f7bd 100644 --- a/source/client/hud.qc +++ b/source/client/hud.qc @@ -1551,7 +1551,8 @@ void(float width, float height) HUD_PlayerNames = float player_number = getplayerkeyfloat(i, "viewentity"); string text = getplayerkeyvalue(i, "name"); - vector player_origin = getentity(player_number, GE_ORIGIN) + '0 0 48'; + entity plr = findfloat(world, playernum, player_number); + vector player_origin = plr.origin + '0 0 48'; vector screen_position = project(player_origin); vector text_color = '1 1 1'; diff --git a/source/client/main.qc b/source/client/main.qc index a0e613f..d19ac31 100644 --- a/source/client/main.qc +++ b/source/client/main.qc @@ -591,8 +591,12 @@ noref void(float isnew) CSQC_Ent_Update = self.velocity_x = readshort(); self.velocity_y = readshort(); self.velocity_z = readshort(); + self.playernum = readfloat(); + self.model = readstring(); + self.movetype = readshort(); self.flags = readfloat(); + setmodel(self, self.model); setsize(self, [-16, -16, -32], [16, 16, 40]); setorigin(self, self.origin); } else { diff --git a/source/server/clientfuncs.qc b/source/server/clientfuncs.qc index 32bfb96..82c91c0 100644 --- a/source/server/clientfuncs.qc +++ b/source/server/clientfuncs.qc @@ -554,6 +554,9 @@ float Player_SendEntity( entity ePVEnt, float flChanged ) { WriteShort( MSG_ENTITY, self.velocity_x ); // Velocity X WriteShort( MSG_ENTITY, self.velocity_y ); // Velocity X WriteShort( MSG_ENTITY, self.velocity_z ); // Velocity X + WriteFloat( MSG_ENTITY, self.playernum ); // Player ID + WriteString( MSG_ENTITY, self.model ); // Player Model + WriteShort( MSG_ENTITY, self.movetype ); // Player Movetype WriteFloat( MSG_ENTITY, self.flags ); // Flags, important for physics return TRUE; } diff --git a/source/server/defs/custom.qc b/source/server/defs/custom.qc index 3e55d29..5a9ad9a 100644 --- a/source/server/defs/custom.qc +++ b/source/server/defs/custom.qc @@ -78,7 +78,6 @@ float global_trace_damage_multiplier; .float lastsound_time; .float isspec; string mappath; -.float playernum; .float ads_toggle; float player_count; entity pl1; diff --git a/source/shared/defs/custom.qc b/source/shared/defs/custom.qc index 96c91a8..89fbc1b 100644 --- a/source/shared/defs/custom.qc +++ b/source/shared/defs/custom.qc @@ -227,6 +227,8 @@ const float EVENT_LIMBGIB = 44; #define STAT_FACINGENEMY 66 #define STAT_MAXHEALTH 67 +.float playernum; + // // invert float takes in float value between 0 and 1, inverts position // eg: 0.1 returns 0.9, 0.34 returns 0.66