MCPcopy Create free account
hub / github.com/assaultcube/AC / timeupdate

Function timeupdate

source/src/clientgame.cpp:1005–1040  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1003}
1004
1005void timeupdate(int milliscur, int millismax)
1006{
1007 if (ispaused) return;
1008 static int lastgametimedisplay = 0;
1009
1010 silenttimeupdate(milliscur, millismax);
1011 int lastdisplay = lastmillis - lastgametimedisplay;
1012 if(lastdisplay >= 0 && lastdisplay <= 1000) return; // avoid double-output
1013 lastgametimedisplay = lastmillis;
1014
1015 if(!minutesremaining)
1016 {
1017 intermission = true;
1018 extern bool needsautoscreenshot;
1019 if(autoscreenshot) needsautoscreenshot = true;
1020 player1->attacking = false;
1021 conoutf("intermission:");
1022 conoutf("game has ended!");
1023 consolescores();
1024 showscores(true);
1025 exechook(HOOK_SP_MP, "start_intermission", "");
1026 }
1027 else
1028 {
1029 extern int gametimedisplay; // only output to console if no hud-clock with game time is being shown
1030 int sec = 60 - ( (gametimecurrent + ( lastmillis - lastgametimeupdate ) ) / 1000) % 60;
1031 if(minutesremaining==1)
1032 {
1033 audiomgr.musicsuggest(M_LASTMINUTE1 + rnd(2), 70*1000, true);
1034 hudoutf("%s1 minute left!", sec==60 ? "" : "less than ");
1035 exechook(HOOK_SP_MP, "onLastMin", "");
1036 }
1037 else if(!gametimedisplay) conoutf("time remaining: %d minutes", minutesremaining);
1038 else clientlogf("time remaining: %d minutes", minutesremaining);
1039 }
1040}
1041
1042playerent *newclient(int cn) // ensure valid entity
1043{

Callers 1

parsemessagesFunction · 0.85

Calls 8

silenttimeupdateFunction · 0.85
consolescoresFunction · 0.85
showscoresFunction · 0.85
exechookFunction · 0.85
hudoutfFunction · 0.85
clientlogfFunction · 0.85
musicsuggestMethod · 0.80
conoutfFunction · 0.70

Tested by

no test coverage detected