Xonotic
timer.qh File Reference
#include "../panel.qh"
+ Include dependency graph for timer.qh:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

vector HUD_Timer_Color (float timeleft)
 
float HUD_Timer_TimeElapsed (float curtime, float starttime)
 
float HUD_Timer_TimeLeft (float curtime, float starttime, float timelimit)
 

Variables

bool autocvar_hud_panel_timer
 
bool autocvar_hud_panel_timer_dynamichud = true
 
bool autocvar_hud_panel_timer_increment
 
int autocvar_hud_panel_timer_secondary = 1
 
bool autocvar_hud_panel_timer_unbound
 

Function Documentation

◆ HUD_Timer_Color()

vector HUD_Timer_Color ( float  timeleft)

Definition at line 13 of file timer.qc.

Referenced by HUD_Timer().

14 {
15  if(timeleft <= 60)
16  return '1 0 0'; // red
17  else if(timeleft <= 300)
18  return '1 1 0'; // yellow
19  else
20  return '1 1 1'; // white
21 }
+ Here is the caller graph for this function:

◆ HUD_Timer_TimeElapsed()

float HUD_Timer_TimeElapsed ( float  curtime,
float  starttime 
)

Definition at line 23 of file timer.qc.

References autocvar_hud_panel_timer_unbound, floor(), max(), and starttime.

Referenced by HUD_Timer().

24 {
25  float time_elapsed = curtime - starttime;
27  time_elapsed = max(0, time_elapsed);
28  return floor(time_elapsed);
29 }
float starttime
Definition: strafehud.qc:38
bool autocvar_hud_panel_timer_unbound
Definition: timer.qh:8
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ HUD_Timer_TimeLeft()

float HUD_Timer_TimeLeft ( float  curtime,
float  starttime,
float  timelimit 
)

Definition at line 31 of file timer.qc.

References autocvar_hud_panel_timer_unbound, bound(), and ceil().

Referenced by HUD_Timer().

32 {
33  float timeleft = timelimit + starttime - curtime;
35  timeleft = bound(0, timeleft, timelimit);
36  return ceil(timeleft);
37 }
float starttime
Definition: strafehud.qc:38
bool autocvar_hud_panel_timer_unbound
Definition: timer.qh:8
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Variable Documentation

◆ autocvar_hud_panel_timer

bool autocvar_hud_panel_timer

Definition at line 4 of file timer.qh.

Referenced by HUD_Timer().

◆ autocvar_hud_panel_timer_dynamichud

bool autocvar_hud_panel_timer_dynamichud = true

Definition at line 5 of file timer.qh.

Referenced by HUD_Timer().

◆ autocvar_hud_panel_timer_increment

bool autocvar_hud_panel_timer_increment

Definition at line 6 of file timer.qh.

Referenced by HUD_Timer().

◆ autocvar_hud_panel_timer_secondary

int autocvar_hud_panel_timer_secondary = 1

Definition at line 7 of file timer.qh.

Referenced by HUD_Timer().

◆ autocvar_hud_panel_timer_unbound

bool autocvar_hud_panel_timer_unbound

Definition at line 8 of file timer.qh.

Referenced by HUD_Timer_TimeElapsed(), and HUD_Timer_TimeLeft().