Renders all the messages we have in the message list. If HUD_MESSAGE_TIME has elapsed, then punt the oldest message and move the others up one
| 1197 | // Renders all the messages we have in the message list. If HUD_MESSAGE_TIME has |
| 1198 | // elapsed, then punt the oldest message and move the others up one |
| 1199 | void RenderHUDMessages() { |
| 1200 | if (Hud_messages_paused) |
| 1201 | return; |
| 1202 | |
| 1203 | // Render & update the scrolling message list |
| 1204 | RenderScrollingHUDMessages(); |
| 1205 | |
| 1206 | // do persistent hud message system |
| 1207 | if (Hud_persistent_msg_id != HUD_INVALID_ID) { |
| 1208 | if (Hud_persistent_msg_timer != HUD_MSG_PERSISTENT_INFINITE) { |
| 1209 | tHUDItem *item = GetHUDItem(Hud_persistent_msg_id); |
| 1210 | |
| 1211 | // Update time |
| 1212 | Hud_persistent_msg_timer -= Frametime; |
| 1213 | |
| 1214 | // Do fadeout |
| 1215 | if (Hud_persistent_msg_flags & HPF_FADEOUT) { |
| 1216 | if (Hud_persistent_msg_timer < FADEOUT_TIME) { |
| 1217 | item->alpha = HUD_ALPHA * Hud_persistent_msg_timer / FADEOUT_TIME; |
| 1218 | } |
| 1219 | } |
| 1220 | |
| 1221 | if (item && Small_hud_flag) { |
| 1222 | grtext_SetFont(HUD_FONT); |
| 1223 | int16_t l = item->x * Max_window_w / DEFAULT_HUD_WIDTH; |
| 1224 | int16_t t = item->y * Max_window_h / DEFAULT_HUD_HEIGHT; |
| 1225 | int16_t r = l + grtext_GetTextLineWidth(item->data.text) + 10; |
| 1226 | int16_t b = t + grtext_GetTextHeight(item->data.text); |
| 1227 | item->dirty_rect.set(l, t, r, b); |
| 1228 | } |
| 1229 | |
| 1230 | // Do FreeSpace printing effect |
| 1231 | if (Hud_persistent_msg_id2 != HUD_INVALID_ID) { |
| 1232 | Hud_persistent_msg_char_timer -= Frametime; |
| 1233 | while (Hud_persistent_msg_char_timer < 0) { |
| 1234 | tHUDItem *item = GetHUDItem(Hud_persistent_msg_id); |
| 1235 | tHUDItem *item2 = GetHUDItem(Hud_persistent_msg_id2); |
| 1236 | |
| 1237 | item->data.text[Hud_persistent_msg_current_len] = item2->data.text[0]; |
| 1238 | Hud_persistent_msg_current_len++; |
| 1239 | |
| 1240 | // Check for more chars |
| 1241 | if (!item->data.text[Hud_persistent_msg_current_len]) { |
| 1242 | FreeHUDItem(Hud_persistent_msg_id2); |
| 1243 | Hud_persistent_msg_id2 = HUD_INVALID_ID; |
| 1244 | Sound_system.StopSoundLooping(Hud_persistent_msg_sound_handle); |
| 1245 | Hud_persistent_msg_sound_handle = SOUND_NONE_INDEX; |
| 1246 | break; // stop printing chars |
| 1247 | } else { // dp next char |
| 1248 | item2->data.text[0] = item->data.text[Hud_persistent_msg_current_len]; |
| 1249 | item->data.text[Hud_persistent_msg_current_len] = 0; |
| 1250 | item2->x = item->x + RenderHUDGetTextLineWidth(item->data.text); |
| 1251 | Hud_persistent_msg_char_timer += CHAR_DELAY; |
| 1252 | } |
| 1253 | } |
| 1254 | } |
| 1255 | |
| 1256 | // If time out, clear message |
no test coverage detected