UFO: Alien Invasion
Loading...
Searching...
No Matches
ui_node_container.h File Reference
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

class  uiContainerNode
struct  containerExtraData_t
 extradata for container widget More...

Macros

#define C_UNIT   25
 One unit in the containers is 25x25.

Functions

void UI_RegisterContainerNode (uiBehaviour_t *behaviour)
void UI_DrawItem (uiNode_t *node, const vec3_t org, const Item *item, int x, int y, const vec3_t scale, const vec4_t color)
 Draws an item to the screen.
void UI_ContainerNodeUpdateEquipment (Inventory *inv, const equipDef_t *ed)
 Fills the ground container of the ui_inventory with unused items from a given equipment definition.
uiNode_tUI_GetContainerNodeByContainerIDX (const uiNode_t *const parent, const int index)
 Search a child container node by the given container id.
void UI_ContainerNodeAutoPlaceItem (uiNode_t *node, Item *ic)
 Try to autoplace an item from a container.
void UI_GetItemTooltip (const Item &item, char *tooltipText, size_t stringMaxLength)
 Generate tooltip text for an item.

Variables

Inventoryui_inventory

Macro Definition Documentation

◆ C_UNIT

Function Documentation

◆ UI_ContainerNodeAutoPlaceItem()

void UI_ContainerNodeAutoPlaceItem ( uiNode_t * node,
Item * ic )

◆ UI_ContainerNodeUpdateEquipment()

void UI_ContainerNodeUpdateEquipment ( Inventory * inv,
const equipDef_t * ed )

Fills the ground container of the ui_inventory with unused items from a given equipment definition.

Todo
it's not obvious for the caller that ui_inventory pointer must be set
Parameters
[in,out]invThe inventory to add the unused items from ed to
[in]edThe equipment definition to get the used items from that should be added to the ground container of inv
Todo
not used nor called by the container node; should be move somewhere else

Definition at line 102 of file ui_node_container.cpp.

References CID_EQUIP, cls, csi, Item::def(), FILTER_AIRCRAFT, GAME_ItemIsUseable(), Inventory::getEquipContainer(), i, objDef_t::idx, INVDEF, INVSH_GetItemByIDX(), lengthof, MAX_CONTAINERS, Mem_Dup, Mem_Free, NONE, equipDef_t::numItems, and ui_inventory.

Referenced by GAME_GetImportData(), and GAME_UpdateInventory().

◆ UI_DrawItem()

void UI_DrawItem ( uiNode_t * node,
const vec3_t org,
const Item * item,
int x,
int y,
const vec3_t scale,
const vec4_t color )

Draws an item to the screen.

Parameters
[in]nodeContext node
[in]orgNode position on the screen (pixel). Single nodes: Use the center of the node.
[in]itemThe item to draw.
[in]x,yPosition in container. Set both to -1 if it's drawn in a single container.
[in]scale
[in]color
See also
SCR_DrawCursor Used to draw an item to the equipment containers. First look whether the objDef_t includes an image - if there is none then draw the model
Todo
Change the rotation of the image as well, right now only the location is changed. How is image-rotation handled right now?
Todo
Image size calculation depends on handling of image-rotation. imgWidth = od->sy * C_UNIT; imgHeight = od->sx * C_UNIT;

Definition at line 149 of file ui_node_container.cpp.

References modelInfo_t::angles, C_UNIT, modelInfo_t::center, objDef_t::center, modelInfo_t::color, Com_Printf(), Item::def(), GAME_GetModelForItem(), objDef_t::id, objDef_t::image, Item::mustReload(), modelInfo_t::name, OBJZERO, modelInfo_t::origin, Q_strnull(), R_Color(), R_DrawModelDirect(), Item::rotated, modelInfo_t::scale, objDef_t::scale, scale, objDef_t::sx, objDef_t::sy, UI_DrawModelNode(), UI_DrawNormImageByName(), Vector4Copy, VectorCopy, VectorNegate, VectorScale, and objDef_t::weapon.

Referenced by uiItemNode::draw(), UI_BaseInventoryNodeDrawItems(), UI_ContainerNodeDrawDropPreview(), UI_ContainerNodeDrawGrid(), UI_ContainerNodeDrawSingle(), and UI_DrawDragAndDrop().

◆ UI_GetContainerNodeByContainerIDX()

uiNode_t * UI_GetContainerNodeByContainerIDX ( const uiNode_t *const parent,
const int index )

Search a child container node by the given container id.

Note
Only search with one depth

Definition at line 290 of file ui_node_container.cpp.

References index, INVDEF, invDef_t::name, and UI_GetNode().

Referenced by UI_ContainerNodeAutoPlaceItem().

◆ UI_GetItemTooltip()

void UI_GetItemTooltip ( const Item & item,
char * tooltipText,
size_t stringMaxLength )

Generate tooltip text for an item.

Parameters
[in]itemThe item we want to generate the tooltip text for.
[in,out]tooltipTextPointer to a string the information should be written into.
[in]stringMaxLengthMax. string size of tooltipText.
Returns
Number of lines

Definition at line 247 of file ui_node_container.cpp.

References _, Item::ammoDef(), Com_sprintf(), Item::def(), GAME_ItemIsUseable(), Item::getAmmoLeft(), Item::getAmount(), i, Item::isWeapon(), objDef_t::name, objDef_t::numWeapons, Q_strcat(), and objDef_t::weapons.

Referenced by uiBaseInventoryNode::drawTooltip(), and uiContainerNode::drawTooltip().

◆ UI_RegisterContainerNode()

Variable Documentation

◆ ui_inventory