shithub: qk1

Download patch

ref: 5e9c01fa0f471e4449d7bf96b1903f89b761e0fc
parent: efe2b69f5701aa2b742247e444ca13052d71049c
author: Sigrid Solveig Haflínudóttir <sigrid@ftrv.se>
date: Fri Dec 15 11:37:14 EST 2023

baseline effects

This breaks the protocol. For whatever reason effects are NOT considered
for eg makestatic() which is kinda sad. For now (until some other fancy
protocol version is picked or invented) use another bit and send effects
over.

--- a/cl_parse.c
+++ b/cl_parse.c
@@ -425,6 +425,7 @@
 		ent->baseline.angles[i] = cl.protocol.MSG_ReadAngle ();
 	}
 	ent->baseline.alpha = (bits & cl.protocol.fl_baseline_alpha) ? MSG_ReadByte() : DEFAULT_ALPHA;
+	ent->baseline.effects = (bits & cl.protocol.fl_baseline_effects) ? MSG_ReadByte() : 0;
 }
 
 
--- a/pr_cmds.c
+++ b/pr_cmds.c
@@ -1552,6 +1552,8 @@
 	}
 	if(!defalpha(ent->alpha))
 		bits |= sv.protocol->fl_baseline_alpha;
+	if(((int)ent->v.effects & 0xff) != 0)
+		bits |= sv.protocol->fl_baseline_effects;
 
 	SV_SignonFrame();
 
@@ -1572,6 +1574,8 @@
 	}
 	if(bits & sv.protocol->fl_baseline_alpha)
 		MSG_WriteByte(sv.signon, ent->alpha);
+	if(bits & sv.protocol->fl_baseline_effects)
+		MSG_WriteByte(sv.signon, ent->v.effects);
 
 	// throw the entity away now
 	ED_Free(ent);
--- a/protocol.c
+++ b/protocol.c
@@ -58,6 +58,7 @@
 		.fl_large_baseline_frame = 1<<1,
 		.fl_alpha = 1<<16,
 		.fl_baseline_alpha = 1<<2,
+		.fl_baseline_effects = 1<<3,
 		.fl_weapon_alpha = 1<<25,
 		.MSG_WriteCoord = MSG_WriteCoordInt32,
 		.MSG_WriteAngle = MSG_WriteAngleInt16,
--- a/protocol.h
+++ b/protocol.h
@@ -49,6 +49,8 @@
 	u32int fl_baseline_alpha;
 	u32int fl_weapon_alpha;
 
+	u32int fl_baseline_effects; /* FIXME(sigrid): this is absolutely made up and NOT a standard anywhere */
+
 	// absolute limits for the protocol
 	int limit_entity;
 	int limit_channel;
--- a/sv_main.c
+++ b/sv_main.c
@@ -494,7 +494,7 @@
 		v = GetEdictFieldValue(sv.pr, ent, "alpha");
 		alpha = v ? f2alpha(v->_float) : DEFAULT_ALPHA;
 
-		if (ent != clent)	// clent is ALLWAYS sent
+		if (ent != clent)	// clent is ALWAYS sent
 		{
 			if((int)ent->v.effects == EF_NODRAW)
 				continue;
@@ -1068,6 +1068,8 @@
 			bits |= sv.protocol->fl_large_baseline_frame;
 		if(!defalpha(svent->baseline.alpha))
 			bits |= sv.protocol->fl_baseline_alpha;
+		if(((int)svent->baseline.effects & 0xff) != 0)
+			bits |= sv.protocol->fl_baseline_effects;
 
 		// add to the message
 		SV_SignonFrame();
@@ -1088,6 +1090,8 @@
 		}
 		if(bits & sv.protocol->fl_baseline_alpha)
 			MSG_WriteByte(sv.signon, svent->baseline.alpha);
+		if(bits & sv.protocol->fl_baseline_effects)
+			MSG_WriteByte(sv.signon, svent->baseline.effects);
 	}
 }