From e97b64485a434330d40ccb3adcbc3e4de9f9608a Mon Sep 17 00:00:00 2001 From: terencehill Date: Sat, 20 Aug 2011 17:53:12 +0200 Subject: [PATCH] Send one byte less in Send_KillNotification, Send_CSQC_KillCenterprint and Send_CSQC_Centerprint_Generic by networking directly TE_CSQC_* constants rather than TE_CSQC_NOTIFY + CSQC_* constants --- qcsrc/client/Main.qc | 44 ++++++++++++++--------------------- qcsrc/common/constants.qh | 10 ++++---- qcsrc/server/g_damage.qc | 6 ++--- qcsrc/server/miscfunctions.qc | 3 +-- 4 files changed, 24 insertions(+), 39 deletions(-) diff --git a/qcsrc/client/Main.qc b/qcsrc/client/Main.qc index 0ec9ccd96..606123ad1 100644 --- a/qcsrc/client/Main.qc +++ b/qcsrc/client/Main.qc @@ -1313,31 +1313,6 @@ void Net_ReadPingPLReport() playerslots[e].ping_movementloss = ml / 255.0; } -void Net_Notify() { - float type; - type = ReadByte(); - - if(type == CSQC_KILLNOTIFY) - { - HUD_KillNotify(ReadString(), ReadString(), ReadString(), ReadShort(), ReadByte()); - } - else if(type == CSQC_KILLCENTERPRINT) - { - HUD_KillCenterprint(ReadString(), ReadString(), ReadShort(), ReadByte()); - } - else if(type == CSQC_CENTERPRINT_GENERIC) - { - float id; - string s; - id = ReadByte(); - s = ReadString(); - if (id != 0 && s != "") - centerprint_generic(id, s, ReadByte(), ReadByte()); - else - centerprint_generic(id, s, 0, 0); - } -} - void Net_WeaponComplain() { complain_weapon = ReadByte(); @@ -1405,8 +1380,23 @@ float CSQC_Parse_TempEntity() announce_snd = strzone(ReadString()); bHandled = true; break; - case TE_CSQC_NOTIFY: - Net_Notify(); + case TE_CSQC_KILLNOTIFY: + HUD_KillNotify(ReadString(), ReadString(), ReadString(), ReadShort(), ReadByte()); + bHandled = true; + break; + case TE_CSQC_KILLCENTERPRINT: + HUD_KillCenterprint(ReadString(), ReadString(), ReadShort(), ReadByte()); + bHandled = true; + break; + case TE_CSQC_CENTERPRINT_GENERIC: + float id; + string s; + id = ReadByte(); + s = ReadString(); + if (id != 0 && s != "") + centerprint_generic(id, s, ReadByte(), ReadByte()); + else + centerprint_generic(id, s, 0, 0); bHandled = true; break; case TE_CSQC_WEAPONCOMPLAIN: diff --git a/qcsrc/common/constants.qh b/qcsrc/common/constants.qh index be7e7cd0a..3fb1b5b47 100644 --- a/qcsrc/common/constants.qh +++ b/qcsrc/common/constants.qh @@ -57,8 +57,10 @@ const float TE_CSQC_TEAMNAGGER = 106; const float TE_CSQC_PINGPLREPORT = 107; const float TE_CSQC_ANNOUNCE = 110; const float TE_CSQC_TARGET_MUSIC = 111; -const float TE_CSQC_NOTIFY = 112; -const float TE_CSQC_WEAPONCOMPLAIN = 113; +const float TE_CSQC_KILLNOTIFY = 112; +const float TE_CSQC_KILLCENTERPRINT = 113; +const float TE_CSQC_CENTERPRINT_GENERIC = 114; +const float TE_CSQC_WEAPONCOMPLAIN = 115; const float TE_CSQC_NEX_SCOPE = 116; const float TE_CSQC_MINELAYER_MAXMINES = 117; const float TE_CSQC_HAGAR_MAXROCKETS = 118; @@ -79,10 +81,6 @@ const float RACE_NET_SERVER_RANKINGS = 11; const float RACE_NET_SERVER_STATUS = 12; const float RANKINGS_CNT = 15; -const float CSQC_KILLNOTIFY = 0; -const float CSQC_KILLCENTERPRINT = 1; -const float CSQC_CENTERPRINT_GENERIC = 2; - const float ENT_CLIENT = 0; const float ENT_CLIENT_DEAD = 1; const float ENT_CLIENT_ENTCS = 2; diff --git a/qcsrc/server/g_damage.qc b/qcsrc/server/g_damage.qc index 06e52238a..40887ad93 100644 --- a/qcsrc/server/g_damage.qc +++ b/qcsrc/server/g_damage.qc @@ -267,8 +267,7 @@ void LogDeath(string mode, float deathtype, entity killer, entity killed) void Send_KillNotification (string s1, string s2, string s3, float msg, float type) { WriteByte(MSG_ALL, SVC_TEMPENTITY); - WriteByte(MSG_ALL, TE_CSQC_NOTIFY); - WriteByte(MSG_ALL, CSQC_KILLNOTIFY); + WriteByte(MSG_ALL, TE_CSQC_KILLNOTIFY); WriteString(MSG_ALL, s1); WriteString(MSG_ALL, s2); WriteString(MSG_ALL, s3); @@ -284,8 +283,7 @@ void Send_CSQC_KillCenterprint(entity e, string s1, string s2, float msg, float msg_entity = e; WRITESPECTATABLE_MSG_ONE({ WriteByte(MSG_ONE, SVC_TEMPENTITY); - WriteByte(MSG_ONE, TE_CSQC_NOTIFY); - WriteByte(MSG_ONE, CSQC_KILLCENTERPRINT); + WriteByte(MSG_ONE, TE_CSQC_KILLCENTERPRINT); WriteString(MSG_ONE, s1); WriteString(MSG_ONE, s2); WriteShort(MSG_ONE, msg); diff --git a/qcsrc/server/miscfunctions.qc b/qcsrc/server/miscfunctions.qc index 09e2dfb05..a32a8baf2 100644 --- a/qcsrc/server/miscfunctions.qc +++ b/qcsrc/server/miscfunctions.qc @@ -1672,8 +1672,7 @@ void Send_CSQC_Centerprint_Generic(entity e, float id, string s, float duration, msg_entity = e; WRITESPECTATABLE_MSG_ONE({ WriteByte(MSG_ONE, SVC_TEMPENTITY); - WriteByte(MSG_ONE, TE_CSQC_NOTIFY); - WriteByte(MSG_ONE, CSQC_CENTERPRINT_GENERIC); + WriteByte(MSG_ONE, TE_CSQC_CENTERPRINT_GENERIC); WriteByte(MSG_ONE, id); WriteString(MSG_ONE, s); if (id != 0 && s != "") -- 2.39.2