[fix] cg_drawupperright() bug


(bacon) #1

There’s a small bug in CG_DrawUpperRight() in cg_draw.c. When you set cg_drawFireteamOverlay to 0 the round timer, fps, and snapshot info will not be drawn.

To fix it just change the code in CG_DrawUpperRight() to this:

static void CG_DrawUpperRight( void ) {
	float	y;

	y = 20 + 100 + 32;

	if( !cg_drawFireteamOverlay.integer ) {
		// bacon - don't return
		//return;
		goto baconfix;
	}

	if(CG_IsOnFireteam( cg.clientNum )) {
		rectDef_t rect = { 10, 10, 100, 100 };
		CG_DrawFireTeamOverlay( &rect );
	} else {
//		CG_DrawTeamOverlay( 0 );
	}

baconfix:
	if( !( cg.snap->ps.pm_flags & PMF_LIMBO ) && ( cg.snap->ps.persistant[PERS_TEAM] != TEAM_SPECTATOR ) &&
		( cgs.autoMapExpanded || ( !cgs.autoMapExpanded && ( cg.time - cgs.autoMapExpandTime < 250.f ) ) ) )
		return;

	if ( cg_drawRoundTimer.integer ) {
		y = CG_DrawTimer( y );
	}

	if ( cg_drawFPS.integer ) {
		y = CG_DrawFPS( y );
	}

	if ( cg_drawSnapshot.integer ) {
		y = CG_DrawSnapshot( y );
	}
}

(Demolama) #2

//   if( !cg_drawFireteamOverlay.integer ) {
//      return;
//   }

   
   y = 20 + 100 + 32;
   
   
 
   if( cg_drawFireteamOverlay.integer ) {

      if(CG_IsOnFireteam( cg.clientNum )) {
      rectDef_t rect = { 10, 10, 100, 100 };
      CG_DrawFireTeamOverlay( &rect );
      }
   
   }

or you can move the if statement to below the y = 20+100+32 and not negate it… then have it include the if statement checking if you on a fireteam

bacon your fix seems to do more than you really need to do to correct this bug


(Domipheus) #3

evil gotos :bored:


(bacon) #4

I did it that way because I was tired and lazy. It still works and that’s all that counts :stuck_out_tongue: