MCPcopy Create free account
hub / github.com/TheForceEngine/TheForceEngine / hud_sendTextMessage

Function hud_sendTextMessage

TheForceEngine/TFE_DarkForces/hud.cpp:191–212  ·  view source on GitHub ↗

////////////////////////////////////// API Implementation //////////////////////////////////////

Source from the content-addressed store, hash-verified

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)

Callers 15

sendHudStartMessageFunction · 0.85
sendHudPauseMessageFunction · 0.85
increaseReplayFrameRateFunction · 0.85
decreaseReplayFrameRateFunction · 0.85
endRecordingFunction · 0.85
sendEndPlaybackMsgFunction · 0.85
sendEndRecordingMsgFunction · 0.85
inf_handleTriggerMsgFunction · 0.85
automap_updateMapDataFunction · 0.85
disableHeadlampFunction · 0.85

Calls 3

getGameMessageFunction · 0.85
addToHistoryFunction · 0.85
strCopyAndZeroFunction · 0.85

Tested by

no test coverage detected