////////////////////////////////////// API Implementation //////////////////////////////////////
| 189 | // API Implementation |
| 190 | /////////////////////////////////////////// |
| 191 | void hud_sendTextMessage(s32 msgId) |
| 192 | { |
| 193 | GameMessage* msg = getGameMessage(&s_hudMessages, msgId); |
| 194 | // Only display the message if it is the same or lower priority than the current message. |
| 195 | if (!msg || msg->priority > s_hudMsgPriority) |
| 196 | { |
| 197 | // Always write the message to the console |
| 198 | if (msg && msg->text) { TFE_Console::addToHistory(msg->text); } |
| 199 | return; |
| 200 | } |
| 201 | |
| 202 | const char* msgText = msg->text; |
| 203 | if (!msgText[0]) { return; } |
| 204 | strCopyAndZero((char*)s_hudMessage, msgText, 80); |
| 205 | |
| 206 | s_hudMsgExpireTick = s_curTick + ((msg->priority <= HUD_HIGH_PRIORITY) ? HUD_MSG_LONG_DUR : HUD_MSG_SHORT_DUR); |
| 207 | s_hudCurrentMsgId = msgId; |
| 208 | s_hudMsgPriority = msg->priority; |
| 209 | |
| 210 | // TFE specific |
| 211 | TFE_Console::addToHistory(msgText); |
| 212 | } |
| 213 | |
| 214 | // Add Skip Priority option so the message shows up immediately and is overwritten by the next. Used by replay updates. |
| 215 | void hud_sendTextMessage(const char* msg, s32 priority, bool skipPriority) |
no test coverage detected