Xonotic QuakeC
The free, fast arena FPS with crisp movement and a wide array of weapons
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 timelimit)
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
float autocvar_hud_panel_timer_warning_red = 60
int autocvar_hud_panel_timer_warning_relative = 0
float autocvar_hud_panel_timer_warning_relative_red = 1.2
float autocvar_hud_panel_timer_warning_relative_yellow = 3
float autocvar_hud_panel_timer_warning_yellow = 300

Function Documentation

◆ HUD_Timer_Color()

vector HUD_Timer_Color ( float timeleft,
float timelimit )

Definition at line 16 of file timer.qc.

17{
18 float limitred, limityellow;
20 {
22 {
25 }
27 {
30 }
31 else
32 {
35 }
36 }
37 else // relative 0, means fixed values in seconds
38 {
41 }
42
43 if (timeleft <= limitred)
44 return '1 0 0'; // red
45 else if (timeleft <= limityellow)
46 return '1 1 0'; // yellow
47 else
48 return '1 1 1'; // white
49}
#define ISGAMETYPE(NAME)
Definition main.qh:46
#define TIME_DECODE(n)
Definition util.qh:101
float race_server_record
Definition racetimer.qh:29
float autocvar_hud_panel_timer_warning_red
Definition timer.qh:12
float autocvar_hud_panel_timer_warning_relative_red
Definition timer.qh:10
float autocvar_hud_panel_timer_warning_relative_yellow
Definition timer.qh:11
int autocvar_hud_panel_timer_warning_relative
Definition timer.qh:9
float autocvar_hud_panel_timer_warning_yellow
Definition timer.qh:13

References autocvar_hud_panel_timer_warning_red, autocvar_hud_panel_timer_warning_relative, autocvar_hud_panel_timer_warning_relative_red, autocvar_hud_panel_timer_warning_relative_yellow, autocvar_hud_panel_timer_warning_yellow, ISGAMETYPE, race_server_record, TIME_DECODE, and vector.

Referenced by HUD_Timer().

◆ HUD_Timer_TimeElapsed()

float HUD_Timer_TimeElapsed ( float curtime,
float starttime )

Definition at line 51 of file timer.qc.

52{
53 float time_elapsed = curtime - starttime;
55 time_elapsed = max(0, time_elapsed);
56 return floor(time_elapsed);
57}
float floor(float f)
float max(float f,...)
bool autocvar_hud_panel_timer_unbound
Definition timer.qh:8

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

Referenced by HUD_Timer().

◆ HUD_Timer_TimeLeft()

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

Definition at line 59 of file timer.qc.

60{
61 float timeleft = timelimit + starttime - curtime;
63 timeleft = bound(0, timeleft, timelimit);
64 return ceil(timeleft);
65}
float ceil(float f)
float bound(float min, float value, float max)

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

Referenced by HUD_Timer().

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_Pickup_Time(), and 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().

◆ autocvar_hud_panel_timer_warning_red

float autocvar_hud_panel_timer_warning_red = 60

Definition at line 12 of file timer.qh.

Referenced by HUD_Timer_Color().

◆ autocvar_hud_panel_timer_warning_relative

int autocvar_hud_panel_timer_warning_relative = 0

Definition at line 9 of file timer.qh.

Referenced by HUD_Timer_Color().

◆ autocvar_hud_panel_timer_warning_relative_red

float autocvar_hud_panel_timer_warning_relative_red = 1.2

Definition at line 10 of file timer.qh.

Referenced by HUD_Timer_Color().

◆ autocvar_hud_panel_timer_warning_relative_yellow

float autocvar_hud_panel_timer_warning_relative_yellow = 3

Definition at line 11 of file timer.qh.

Referenced by HUD_Timer_Color().

◆ autocvar_hud_panel_timer_warning_yellow

float autocvar_hud_panel_timer_warning_yellow = 300

Definition at line 13 of file timer.qh.

Referenced by HUD_Timer_Color().