OpenArena Message Boards

OpenArena Contributions => Development => Topic started by: Astro on April 04, 2008, 06:56:28 am



Title: [PATCH] cg_persistentWeaponSelect
Post by: Astro on April 04, 2008, 06:56:28 am
Hi

I really enjoy playing OA FFA. But one major disturbance in gameplay is that I have to keep my current weapons in mind. To avoid this, the following patch introduces a new cvar "cg_persistentWeaponSelect" to inhibit fading out the weapon selection bar. It is against ioquake3 trunk r1288:

Code:
Index: code/cgame/cg_local.h
===================================================================
--- code/cgame/cg_local.h (revision 1288)
+++ code/cgame/cg_local.h (working copy)
@@ -1170,6 +1170,7 @@
 extern vmCvar_t cg_oldRocket;
 extern vmCvar_t cg_oldPlasma;
 extern vmCvar_t cg_trueLightning;
+extern  vmCvar_t                cg_persistentWeaponSelect;
 #ifdef MISSIONPACK
 extern vmCvar_t cg_redTeamName;
 extern vmCvar_t cg_blueTeamName;
Index: code/cgame/cg_weapons.c
===================================================================
--- code/cgame/cg_weapons.c (revision 1288)
+++ code/cgame/cg_weapons.c (working copy)
@@ -1477,11 +1477,19 @@
  return;
  }
 
- color = CG_FadeColor( cg.weaponSelectTime, WEAPON_SELECT_TIME );
- if ( !color ) {
- return;
- }
- trap_R_SetColor( color );
+        if (cg_persistentWeaponSelect.value)
+        {
+                static float white[] = { 1.0f, 1.0f, 1.0f };
+                color = white;
+        }
+        else
+        {
+                color = CG_FadeColor( cg.weaponSelectTime, WEAPON_SELECT_TIME );
+                if ( !color ) {
+                        return;
+                }
+                trap_R_SetColor( color );
+        }
 
  // showing weapon select clears pickup item display, but not the blend blob
  cg.itemPickupTime = 0;
Index: code/cgame/cg_main.c
===================================================================
--- code/cgame/cg_main.c (revision 1288)
+++ code/cgame/cg_main.c (working copy)
@@ -182,6 +182,7 @@
 vmCvar_t cg_oldRocket;
 vmCvar_t cg_oldPlasma;
 vmCvar_t cg_trueLightning;
+vmCvar_t        cg_persistentWeaponSelect;
 
 #ifdef MISSIONPACK
 vmCvar_t cg_redTeamName;
@@ -314,8 +315,9 @@
  { &cg_oldRail, "cg_oldRail", "1", CVAR_ARCHIVE},
  { &cg_oldRocket, "cg_oldRocket", "1", CVAR_ARCHIVE},
  { &cg_oldPlasma, "cg_oldPlasma", "1", CVAR_ARCHIVE},
- { &cg_trueLightning, "cg_trueLightning", "0.0", CVAR_ARCHIVE}
+ { &cg_trueLightning, "cg_trueLightning", "0.0", CVAR_ARCHIVE},
 // { &cg_pmove_fixed, "cg_pmove_fixed", "0", CVAR_USERINFO | CVAR_ARCHIVE }
+        { &cg_persistentWeaponSelect, "cg_persistentWeaponSelect", "0", CVAR_ARCHIVE}
 };
 
 static int  cvarTableSize = sizeof( cvarTable ) / sizeof( cvarTable[0] );

Do you want me to do a 2nd patch for the UI options?


Title: Re: [PATCH] cg_persistentWeaponSelect
Post by: sago007 on April 04, 2008, 07:40:46 am
I have the same in the Elimination mod. Except I call it cg_alwaysWeaponBar.

And it has UI