MCPcopy Create free account
hub / github.com/DescentDevelopers/Descent3 / RenderHUDScore

Function RenderHUDScore

Descent3/huddisplay.cpp:955–981  ·  view source on GitHub ↗

Show the score

Source from the content-addressed store, hash-verified

953
954// Show the score
955void RenderHUDScore(tHUDItem *item) {
956 char buf[100];
957 int win_w;
958
959 if (Game_mode & GM_MULTI) {
960 if (!(Netgame.flags & NF_USE_ROBOTS)) {
961 return;
962 }
963 }
964
965 snprintf(buf, sizeof(buf), "%s: %d ", TXT_SCORE, Players[Player_num].score);
966
967 win_w = (Max_window_w - Game_window_w) * (Hud_aspect_x);
968 // if (Game_video_resolution==RES_512X384) { win_w = win_w + 10; }
969
970 int w = RenderHUDGetTextLineWidth(buf); // * win_w)/(Game_window_w);
971 RenderHUDText(item->color, HUD_ALPHA, 0, item->x - w - win_w, item->y, buf);
972
973 if (Score_added_timer > 0.0) {
974 int text_height = grfont_GetHeight(HUD_FONT);
975 snprintf(buf, sizeof(buf), "%d ", Score_added);
976 w = RenderHUDGetTextLineWidth(buf); // * win_w/Game_window_w;
977 uint8_t alpha = std::min<float>(HUD_ALPHA, HUD_ALPHA * 4 * Score_added_timer / SCORE_ADDED_TIME);
978 RenderHUDText(item->color, alpha, 0, item->x - w - win_w, item->y + text_height, buf);
979 Score_added_timer -= Frametime;
980 }
981}
982
983extern float Osiris_TimerTimeRemaining(int handle);
984

Callers

nothing calls this directly

Calls 3

RenderHUDTextFunction · 0.85
grfont_GetHeightFunction · 0.85

Tested by

no test coverage detected