MCPcopy Create free account
hub / github.com/BohemiaInteractive/CWR / OnDraw

Method OnDraw

engine/Poseidon/Game/Chat.cpp:262–388  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

260 {
261 snprintf(from, sizeof(from), "%s", (const char*)LocalizeString(IDS_DRIVER));
262 }
263 }
264 else if (person == veh->Gunner())
265 {
266 snprintf(from, sizeof(from), "%s", (const char*)LocalizeString(IDS_GUNNER));
267 }
268 else if (sender == veh->CommanderUnit())
269 {
270 snprintf(from, sizeof(from), "%s", (const char*)LocalizeString(IDS_COMMANDER));
271 }
272 else
273 {
274 LOG_DEBUG(Script, "Warning: unknown position");
275 }
276 }
277 break;
278 case CCDirect:
279 GWorld->SetTitleEffect(CreateTitleEffect(TitPlainDown, text));
280 return;
281 }
282
283 if (person && person->IsNetworkPlayer())
284 {
285 if (from[0])
286 {
287 strncat(from, " (", sizeof(from) - strlen(from) - 1);
288 strncat(from, GetFullPlayerName(person), sizeof(from) - strlen(from) - 1);
289 strncat(from, ")", sizeof(from) - strlen(from) - 1);
290 }
291 else
292 {
293 snprintf(from, sizeof(from), "%s", (const char*)GetFullPlayerName(person));
294 }
295 }
296 }
297 Add(channel, from, text, playerMsg, forceDisplay);
298}
299
300void ChatList::OnDraw()
301{
302 if (_rows <= 0)
303 {
304 return;
305 }
306
307 const float startDim = 25, endDim = 30;
308 int w = GEngine->Width2D();
309 int h = GEngine->Height2D();
310
311 if (!_font)
312 {
313 _font = GEngine->LoadFont(GetFontID("tahomaB24"));
314 PoseidonAssert(_font);
315 _size = 0.02;
316 }
317
318 float top = _y + (_rows - 1) * _h;
319 int row = _rows - 1;

Callers 1

SimulateMethod · 0.45

Calls 15

GetFontIDFunction · 0.85
saturateFunction · 0.85
ColorClass · 0.85
MutableDataMethod · 0.80
GetFunction · 0.50
RStringClass · 0.50
PackedColorRGBFunction · 0.50
PackedColorClass · 0.50
Rect2DPixelClass · 0.50
Point2DFloatClass · 0.50
Rect2DFloatClass · 0.50
Width2DMethod · 0.45

Tested by

no test coverage detected