MCPcopy Create free account
hub / github.com/crossuo/crossuo / WorldDraw

Method WorldDraw

src/TextEngine/TextRenderer.cpp:337–435  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

335}
336
337void CTextRenderer::WorldDraw()
338{
339 CalculateWorldPositions(true);
340
341 int renderIndex = g_GameScreen.RenderIndex - 1;
342
343 if (renderIndex < 1)
344 {
345 renderIndex = 99;
346 }
347
348 for (CRenderTextObject *item = m_DrawPointer; item != nullptr; item = item->m_PrevDraw)
349 {
350 if (!item->IsText())
351 {
352 continue;
353 }
354
355 CTextData &text = *(CTextData *)item;
356
357 if (text.Type != TT_SYSTEM && text.Timer >= g_Ticks)
358 {
359 CRenderWorldObject *rwo = text.Owner;
360
361 if (rwo == nullptr || rwo->UseInRender != renderIndex)
362 {
363 continue;
364 }
365
366 uint16_t textColor = text.Color;
367
368 if (text.Type == TT_OBJECT && g_SelectedObject.Object == item &&
369 (((CGameObject *)rwo)->NPC || ((CGameObject *)rwo)->IsCorpse()))
370 {
371 textColor = 0x0035;
372 }
373
374 auto uniformValue = SDM_NO_COLOR;
375 if (textColor != 0u)
376 {
377 g_ColorManager.SendColorsToShader(textColor);
378
379 uniformValue = SDM_COLORED;
380 if (text.Unicode)
381 {
382 uniformValue = SDM_TEXT_COLORED_NO_BLACK;
383 }
384 else if (text.Font != 5 && text.Font != 8)
385 {
386 uniformValue = SDM_PARTIAL_HUE;
387 }
388 }
389#ifndef NEW_RENDERER_ENABLED
390 glUniform1iARB(g_ShaderDrawMode, uniformValue);
391#else
392 ShaderUniformCmd cmd{ g_ShaderDrawMode, ShaderUniformType::ShaderUniformType_Int1 };
393 cmd.value.asInt1 = uniformValue;
394 RenderAdd_SetShaderUniform(g_renderCmdList, cmd);

Callers

nothing calls this directly

Calls 8

RenderAdd_SetBlendFunction · 0.85
RenderAdd_SetColorFunction · 0.85
RenderAdd_DisableBlendFunction · 0.85
IsCorpseMethod · 0.80
SendColorsToShaderMethod · 0.80
IsTextMethod · 0.45
DrawMethod · 0.45

Tested by

no test coverage detected