MCPcopy Create free account
hub / github.com/diasurgical/DevilutionX / DrawItem

Function DrawItem

Source/engine/render/scrollrt.cpp:683–703  ·  view source on GitHub ↗

* @brief Draw item for a given tile * @param out Output buffer * @param tilePosition dPiece coordinates * @param targetBufferPosition Output buffer coordinates * @param pre Is the sprite in the background */

Source from the content-addressed store, hash-verified

681 * @param pre Is the sprite in the background
682 */
683void DrawItem(const Surface &out, Point tilePosition, Point targetBufferPosition, bool pre)
684{
685 int8_t bItem = dItem[tilePosition.x][tilePosition.y];
686
687 if (bItem <= 0)
688 return;
689
690 auto &item = Items[bItem - 1];
691 if (item._iPostDraw == pre)
692 return;
693
694 const ClxSprite sprite = item.AnimInfo.currentSprite();
695 int px = targetBufferPosition.x - CalculateWidth2(sprite.width());
696 const Point position { px, targetBufferPosition.y };
697 if (stextflag == TalkID::None && (bItem - 1 == pcursitem || AutoMapShowItems)) {
698 ClxDrawOutlineSkipColorZero(out, GetOutlineColor(item, false), position, sprite);
699 }
700 ClxDrawLight(out, position, sprite, LightTableIndex);
701 if (item.AnimInfo.isLastFrame() || item._iCurs == ICURS_MAGIC_ROCK)
702 AddItemToLabelQueue(bItem - 1, position);
703}
704
705/**
706 * @brief Check if and how a monster should be rendered

Callers 2

DrawDungeonFunction · 0.70
DrawStashFunction · 0.50

Calls 8

CalculateWidth2Function · 0.85
GetOutlineColorFunction · 0.85
ClxDrawLightFunction · 0.85
AddItemToLabelQueueFunction · 0.85
widthMethod · 0.80
isLastFrameMethod · 0.80
currentSpriteMethod · 0.45

Tested by

no test coverage detected