From a9e1cb1fbe613042834b9a61460d1fcae4d9226f Mon Sep 17 00:00:00 2001 From: MirceaKitsune Date: Sun, 29 Jan 2012 22:00:50 +0200 Subject: [PATCH] Implement an entity which can send a portrait over to the client. Currently just prints text --- data/qcsrc/client/Main.qc | 1 + data/qcsrc/client/hud.qc | 8 ++++++++ data/qcsrc/common/constants.qh | 1 + data/qcsrc/server/cl_client.qc | 2 ++ data/qcsrc/server/miscfunctions.qc | 24 ++++++++++++++++++++++++ 5 files changed, 36 insertions(+) diff --git a/data/qcsrc/client/Main.qc b/data/qcsrc/client/Main.qc index d84f6ce5..4a106a31 100644 --- a/data/qcsrc/client/Main.qc +++ b/data/qcsrc/client/Main.qc @@ -948,6 +948,7 @@ void(float bIsNewEntity) CSQC_Ent_Update = case ENT_CLIENT_WARPZONE: WarpZone_Read(bIsNewEntity); break; case ENT_CLIENT_WARPZONE_CAMERA: WarpZone_Camera_Read(bIsNewEntity); break; case ENT_CLIENT_TRIGGER_MUSIC: Ent_ReadTriggerMusic(); break; + case ENT_CLIENT_PORTRAIT: Ent_ReadPortrait(); break; default: error(strcat("unknown entity type in CSQC_Ent_Update: ", ftos(self.enttype), "\n")); break; diff --git a/data/qcsrc/client/hud.qc b/data/qcsrc/client/hud.qc index e0723db1..93680460 100644 --- a/data/qcsrc/client/hud.qc +++ b/data/qcsrc/client/hud.qc @@ -3550,3 +3550,11 @@ void CSQC_race_hud(void) } drawfont = sbar_font; } + +void Ent_ReadPortrait() +{ + string s; + s = ReadString(); + + dprint(strcat(s, " --------\n")); +} diff --git a/data/qcsrc/common/constants.qh b/data/qcsrc/common/constants.qh index 2825c5ea..28e85846 100644 --- a/data/qcsrc/common/constants.qh +++ b/data/qcsrc/common/constants.qh @@ -98,6 +98,7 @@ const float ENT_CLIENT_MODELEFFECT = 22; const float ENT_CLIENT_WARPZONE = 23; const float ENT_CLIENT_WARPZONE_CAMERA = 24; const float ENT_CLIENT_TRIGGER_MUSIC = 25; +const float ENT_CLIENT_PORTRAIT = 26; const float ENT_CLIENT_TURRET = 40; diff --git a/data/qcsrc/server/cl_client.qc b/data/qcsrc/server/cl_client.qc index 33406554..09172abe 100644 --- a/data/qcsrc/server/cl_client.qc +++ b/data/qcsrc/server/cl_client.qc @@ -2478,6 +2478,8 @@ void() ctf_setstatus; .float power_sounded; void PlayerPreThink (void) { + portrait(self); // TEMPORARY TEST + self.stat_game_starttime = game_starttime; self.stat_allow_oldnexbeam = cvar("g_allow_oldnexbeam"); self.stat_leadlimit = cvar("leadlimit"); diff --git a/data/qcsrc/server/miscfunctions.qc b/data/qcsrc/server/miscfunctions.qc index caf444e8..84f68f71 100644 --- a/data/qcsrc/server/miscfunctions.qc +++ b/data/qcsrc/server/miscfunctions.qc @@ -2461,6 +2461,30 @@ void modeleffect_spawn(string m, float s, float f, vector o, vector v, vector an Net_LinkEntity(e, FALSE, 0.1, modeleffect_SendEntity); } +float portrait_SendEntity(entity to, float sf) +{ + WriteByte(MSG_ENTITY, ENT_CLIENT_PORTRAIT); + + string s; + s = substring(self.model, 0, strlen(self.model) - 4); // remove extension + s = strcat(s, "-", ftos(self.skin)); + + WriteString(MSG_ENTITY, s); + + return TRUE; +} + +void portrait(entity pl) +{ + entity e; + e = spawn(); + e.classname = "portrait"; + setmodel(e, pl.model); + e.skin = pl.skin; + + Net_LinkEntity(e, FALSE, 0.1, portrait_SendEntity); +} + void shockwave_spawn(string m, vector org, float sz, float t1, float t2) { return modeleffect_spawn(m, 0, 0, org, '0 0 0', '0 0 0', '0 0 0', 0, sz, 1, t1, t2); -- 2.39.2