shithub: qk1

Download patch

ref: d62733faff1367e247d387ca41ae27f3b6674c49
parent: 5d11846259f00c662e468585b66e62741c7998b8
author: Sigrid Solveig Haflínudóttir <sigrid@ftrv.se>
date: Fri Oct 11 23:04:19 EDT 2024

draw status bar on every frame and disable the seizure inducing flashing

--- a/cl_parse.c
+++ b/cl_parse.c
@@ -463,7 +463,6 @@
 
 	i = (bits & SU_ITEMS) ? MSG_ReadLong() : cl.items;
 	if(cl.items != i){ // set flash times
-		Sbar_Changed ();
 		for (j=0 ; j<32 ; j++)
 			if ( (i & (1<<j)) && !(cl.items & (1<<j)))
 				cl.item_gettime[j] = cl.time;
@@ -473,52 +472,20 @@
 	cl.onground = (bits & SU_ONGROUND) != 0;
 	cl.inwater = (bits & SU_INWATER) != 0;
 	cl.stats[STAT_WEAPONFRAME] = (bits & SU_WEAPONFRAME) ? MSG_ReadByte() : 0;
-
-	i = (bits & SU_ARMOR) ? MSG_ReadByte() : 0;
-	if(cl.stats[STAT_ARMOR] != i){
-		cl.stats[STAT_ARMOR] = i;
-		Sbar_Changed ();
-	}
-
+	cl.stats[STAT_ARMOR] = (bits & SU_ARMOR) ? MSG_ReadByte() : 0;
 	weaponmodel = (bits & SU_WEAPON) ? MSG_ReadByte() : 0;
+	cl.stats[STAT_HEALTH] = MSG_ReadShort();
+	cl.stats[STAT_AMMO] = MSG_ReadByte();
 
-	i = MSG_ReadShort();
-	if (cl.stats[STAT_HEALTH] != i){
-		cl.stats[STAT_HEALTH] = i;
-		Sbar_Changed();
-	}
+	for (i=0 ; i<4 ; i++)
+		cl.stats[STAT_SHELLS+i] = MSG_ReadByte();
 
 	i = MSG_ReadByte();
-	if(cl.stats[STAT_AMMO] != i){
-		cl.stats[STAT_AMMO] = i;
-		Sbar_Changed();
-	}
+	cl.stats[STAT_ACTIVEWEAPON] = standard_quake ? i : (1<<i);
 
-	for (i=0 ; i<4 ; i++){
-		j = MSG_ReadByte();
-		if(cl.stats[STAT_SHELLS+i] != j){
-			cl.stats[STAT_SHELLS+i] = j;
-			Sbar_Changed();
-		}
-	}
-
-	i = MSG_ReadByte();
-	if(standard_quake){
-		if(cl.stats[STAT_ACTIVEWEAPON] != i){
-			cl.stats[STAT_ACTIVEWEAPON] = i;
-			Sbar_Changed();
-		}
-	}else if(cl.stats[STAT_ACTIVEWEAPON] != (1<<i)){
-		cl.stats[STAT_ACTIVEWEAPON] = (1<<i);
-		Sbar_Changed();
-	}
-
 	if(bits & cl.protocol.fl_large_weaponmodel)
 		weaponmodel |= MSG_ReadByte() << 8;
-	if(cl.stats[STAT_WEAPON] != weaponmodel){
-		cl.stats[STAT_WEAPON] = weaponmodel;
-		Sbar_Changed();
-	}
+	cl.stats[STAT_WEAPON] = weaponmodel;
 
 	if(bits & cl.protocol.fl_large_weaponframe)
 		cl.stats[STAT_WEAPONFRAME] |= MSG_ReadByte() << 8;
@@ -744,7 +711,6 @@
 			break;
 
 		case svc_updatename:
-			Sbar_Changed ();
 			i = MSG_ReadByte ();
 			if (i >= cl.maxclients)
 				Host_Error ("CL_ParseServerMessage: svc_updatename > MAX_SCOREBOARD");
@@ -752,7 +718,6 @@
 			break;
 
 		case svc_updatefrags:
-			Sbar_Changed ();
 			i = MSG_ReadByte ();
 			if (i >= cl.maxclients)
 				Host_Error ("CL_ParseServerMessage: svc_updatefrags > MAX_SCOREBOARD");
@@ -760,7 +725,6 @@
 			break;
 
 		case svc_updatecolors:
-			Sbar_Changed ();
 			i = MSG_ReadByte ();
 			if (i >= cl.maxclients)
 				Host_Error ("CL_ParseServerMessage: svc_updatecolors > MAX_SCOREBOARD");
--- a/sbar.c
+++ b/sbar.c
@@ -1,8 +1,5 @@
 #include "quakedef.h"
 
-
-static int sb_updates;		// if >= vid.numpages, no update needed
-
 #define STAT_MINUS		10	// num frame for '-' stats digit
 static qpic_t *sb_nums[2][11];
 static qpic_t *sb_colon, *sb_slash;
@@ -56,7 +53,6 @@
 	if (sb_showscores)
 		return;
 	sb_showscores = true;
-	sb_updates = 0;
 }
 
 /*
@@ -70,21 +66,10 @@
 Sbar_DontShowScores(void)
 {
 	sb_showscores = false;
-	sb_updates = 0;
 }
 
 /*
 ===============
-Sbar_Changed
-===============
-*/
-void Sbar_Changed (void)
-{
-	sb_updates = 0;	// update next frame
-}
-
-/*
-===============
 Sbar_Init
 ===============
 */
@@ -490,9 +475,6 @@
 				flashon = (flashon%5) + 2;
 
          Sbar_DrawPic (i*24, -16, sb_weapons[flashon][i]);
-
-			if (flashon > 1)
-				sb_updates = 0;		// force update to remove flash
 		}
 	}
 
@@ -547,8 +529,6 @@
             }
             else
                Sbar_DrawPic (176 + (i*24), -16, hsb_weapons[flashon][i]);
-            if (flashon > 1)
-               sb_updates = 0;      // force update to remove flash
          }
       }
     }
@@ -587,7 +567,6 @@
 			time = cl.item_gettime[17+i];
 			if (time && time > cl.time - 2 && flashon )
 			{  // flash frame
-				sb_updates = 0;
 			}
 			else
 			{
@@ -597,8 +576,6 @@
 					Sbar_DrawPic (192 + i*16, -16, sb_items[i]);
 				}
 			}
-			if (time && time > cl.time - 2)
-			sb_updates = 0;
 		}
 	}
 	//MED 01/04/97 added hipnotic items
@@ -611,14 +588,11 @@
 				time = cl.item_gettime[24+i];
 				if (time && time > cl.time - 2 && flashon )
 				{  // flash frame
-					sb_updates = 0;
 				}
 				else
 				{
 					Sbar_DrawPic (288 + i*16, -16, hsb_items[i]);
 				}
-				if (time && time > cl.time - 2)
-					sb_updates = 0;
 			}
 	}
 
@@ -633,7 +607,6 @@
 
 				if (time &&	time > cl.time - 2 && flashon )
 				{	// flash frame
-					sb_updates = 0;
 				}
 				else
 				{
@@ -640,8 +613,6 @@
 					Sbar_DrawPic (288 + i*16, -16, rsb_items[i]);
 				}
 
-				if (time &&	time > cl.time - 2)
-					sb_updates = 0;
 			}
 		}
 	}
@@ -655,12 +626,9 @@
 				time = cl.item_gettime[28+i];
 				if (time &&	time > cl.time - 2 && flashon )
 				{	// flash frame
-					sb_updates = 0;
 				}
 				else
 					Sbar_DrawPic (320-32 + i*8, -16, sb_sigil[i]);
-				if (time &&	time > cl.time - 2)
-					sb_updates = 0;
 			}
 		}
 	}
@@ -823,7 +791,6 @@
 	if (cl.time <= cl.faceanimtime)
 	{
 		anim = 1;
-		sb_updates = 0;		// make sure the anim gets drawn over
 	}
 	else
 		anim = 0;
@@ -841,11 +808,6 @@
 	if (scr_con_current == vid.height)
 		return;		// console is full screen
 
-	if (sb_updates >= vid.numpages)
-		return;
-
-	sb_updates++;
-
 	if (sb_lines && vid.width > 320)
 		Draw_TileClear (0, vid.height - sb_lines, vid.width, sb_lines);
 
@@ -860,7 +822,6 @@
 	{
 		Sbar_DrawPic (0, 0, sb_scorebar);
 		Sbar_DrawScoreboard ();
-		sb_updates = 0;
 	}
 	else if (sb_lines)
 	{
--- a/sbar.h
+++ b/sbar.h
@@ -7,9 +7,6 @@
 
 void Sbar_Init (void);
 
-void Sbar_Changed (void);
-// call whenever any of the client stats represented on the sbar changes
-
 void Sbar_Draw (void);
 // called every frame by screen
 
--- a/screen.c
+++ b/screen.c
@@ -180,9 +180,6 @@
 	scr_fullupdate = 0;		// force a background redraw
 	vid.recalc_refdef = false;
 
-	// force the status bar to redraw
-	Sbar_Changed ();
-
 //========================================
 
 	// bound viewsize
@@ -427,7 +424,6 @@
 	if (clearconsole++ < vid.numpages)
 	{
 		Draw_TileClear (0,(int)scr_con_current,vid.width, vid.height - (int)scr_con_current);
-		Sbar_Changed ();
 	}
 	else if (clearnotify++ < vid.numpages)
 	{
@@ -478,7 +474,6 @@
 
 	scr_drawloading = true;
 	scr_fullupdate = 0;
-	Sbar_Changed ();
 	SCR_UpdateScreen(false);
 	scr_drawloading = false;
 
@@ -651,7 +646,6 @@
 	if (scr_fullupdate++ < vid.numpages)
 	{	// clear the entire screen
 		Draw_TileClear (0,0,vid.width,vid.height);
-		Sbar_Changed ();
 	}
 	SCR_SetUpToDrawConsole ();
 	SCR_EraseCenterString ();