#include "../ui_main.h"
#include "../ui_parse.h"
#include "../ui_tooltip.h"
#include "../ui_nodes.h"
#include "../ui_render.h"
#include "ui_node_base.h"
#include "ui_node_abstractnode.h"
#include "../../client.h"
#include "../../campaign/cp_campaign.h"
Go to the source code of this file.
Defines | |
#define | EXTRADATA_TYPE baseExtraData_t |
#define | EXTRADATA(node) UI_EXTRADATA(node, baseExtraData_t) |
#define | BASE_IMAGE_OVERLAY 20 |
Functions | |
static void | UI_AbstractBaseNodeLoaded (uiNode_t *node) |
Called after the end of the node load from script (all data and/or child are set). | |
static void | UI_BaseLayoutNodeDraw (uiNode_t *node) |
Draw a small square with the layout of the given base. | |
static void | UI_BaseMapGetCellAtPos (const uiNode_t *node, int x, int y, int *col, int *row) |
Return col and row of a cell, at an absolute position. | |
static qboolean | UI_BaseMapIsCellFree (const base_t *base, int col, int row) |
Check a base cell. | |
static void | UI_BaseMapNodeDraw (uiNode_t *node) |
Draws a base. | |
static void | UI_BaseMapNodeDrawTooltip (uiNode_t *node, int x, int y) |
Custom tooltip. | |
static void | UI_BaseMapNodeClick (uiNode_t *node, int x, int y) |
Left click on the basemap. | |
static void | UI_BaseMapNodeRightClick (uiNode_t *node, int x, int y) |
Right click on the basemap. | |
static void | UI_BaseMapNodeMiddleClick (uiNode_t *node, int x, int y) |
Middle click on the basemap. | |
static void | UI_BaseLayoutNodeLoading (uiNode_t *node) |
Called before loading. Used to set default attribute values. | |
void | UI_RegisterAbstractBaseNode (uiBehaviour_t *behaviour) |
void | UI_RegisterBaseMapNode (uiBehaviour_t *behaviour) |
void | UI_RegisterBaseLayoutNode (uiBehaviour_t *behaviour) |
Variables | |
static const value_t | properties [] |
Definition in file ui_node_base.c.
#define BASE_IMAGE_OVERLAY 20 |
20 is the height of the part where the images overlap
Definition at line 91 of file ui_node_base.c.
Referenced by UI_BaseMapNodeDraw().
#define EXTRADATA | ( | node | ) | UI_EXTRADATA(node, baseExtraData_t) |
Definition at line 37 of file ui_node_base.c.
#define EXTRADATA_TYPE baseExtraData_t |
Definition at line 36 of file ui_node_base.c.
static void UI_AbstractBaseNodeLoaded | ( | uiNode_t * | node | ) | [static] |
Called after the end of the node load from script (all data and/or child are set).
Definition at line 42 of file ui_node_base.c.
References Com_Printf(), EXTRADATA, and MAX_BASES.
Referenced by UI_RegisterAbstractBaseNode().
static void UI_BaseLayoutNodeDraw | ( | uiNode_t * | node | ) | [static] |
Draw a small square with the layout of the given base.
Definition at line 53 of file ui_node_base.c.
References B_GetBaseByIDX(), BASE_SIZE, baseBuildingTile_s::blocked, baseBuildingTile_s::building, uiNode_s::color, EXTRADATA, base_s::founded, base_s::map, MAX_BASES, uiNode_s::padding, uiNode_s::size, UI_DrawFill(), and UI_GetNodeAbsPos().
Referenced by UI_RegisterBaseLayoutNode().
static void UI_BaseLayoutNodeLoading | ( | uiNode_t * | node | ) | [static] |
Called before loading. Used to set default attribute values.
Definition at line 389 of file ui_node_base.c.
References uiNode_s::color, uiNode_s::padding, and Vector4Set.
Referenced by UI_RegisterBaseLayoutNode().
static void UI_BaseMapGetCellAtPos | ( | const uiNode_t * | node, | |
int | x, | |||
int | y, | |||
int * | col, | |||
int * | row | |||
) | [static] |
Return col and row of a cell, at an absolute position.
[in] | node | Node definition for the base map |
[in] | x | Absolute x-position requested |
[in] | y | Absolute y-position requested |
[out] | col | Col of the cell at the position (-1 if no cell) |
[out] | row | Row of the cell at the position (-1 if no cell) |
Definition at line 101 of file ui_node_base.c.
References BASE_SIZE, uiNode_s::size, and UI_NodeAbsoluteToRelativePos().
Referenced by UI_BaseMapNodeClick(), UI_BaseMapNodeDraw(), UI_BaseMapNodeDrawTooltip(), UI_BaseMapNodeMiddleClick(), and UI_BaseMapNodeRightClick().
Check a base cell.
Definition at line 121 of file ui_node_base.c.
References BASE_SIZE, baseBuildingTile_s::blocked, baseBuildingTile_s::building, and base_s::map.
Referenced by UI_BaseMapNodeDraw().
static void UI_BaseMapNodeClick | ( | uiNode_t * | node, | |
int | x, | |||
int | y | |||
) | [static] |
Left click on the basemap.
[in] | node | Node definition for the base map |
[in] | x | Absolute X mouse position into the screen |
[in] | y | Absolute Y mouse position into the screen |
Definition at line 285 of file ui_node_base.c.
References B_BuildingOpenAfterClick(), B_GetCurrentSelectedBase(), B_SetBuildingByClick(), BA_NEWBUILDING, BA_NONE, ccs_s::baseAction, baseBuildingTile_s::blocked, baseBuildingTile_s::building, base_s::buildingCurrent, ccs, Com_Error(), ERR_DROP, map, base_s::map, building_s::needs, uiNode_s::root, and UI_BaseMapGetCellAtPos().
Referenced by UI_RegisterBaseMapNode().
static void UI_BaseMapNodeDraw | ( | uiNode_t * | node | ) | [static] |
Draws a base.
< this buffer should not be need
Definition at line 132 of file ui_node_base.c.
References ALIGN_UL, B_BuildingGetUsed, B_BuildingSetUsed, B_GetBuildingTemplate(), B_GetCurrentSelectedBase(), B_STATUS_CONSTRUCTION_FINISHED, B_STATUS_DOWN, B_STATUS_UNDER_CONSTRUCTION, BA_NEWBUILDING, BASE_IMAGE_OVERLAY, BASE_SIZE, ccs_s::baseAction, baseBuildingTile_s::blocked, baseBuildingTile_s::building, base_s::buildingCurrent, building_s::buildingStatus, building_s::buildTime, ccs, Com_Error(), ccs_s::date, date_s::day, ERR_DROP, building_s::idx, building_s::image, base_s::map, MAX_BUILDINGS, MAX_QPATH, mousePosX, mousePosY, building_s::needs, ngettext, pos, Q_strncpyz(), qfalse, uiNode_s::size, uiNode_s::state, building_s::timeStart, UI_BaseMapGetCellAtPos(), UI_BaseMapIsCellFree(), UI_DrawNormImageByName(), UI_DrawString(), UI_GetNodeAbsPos(), UI_PopWindow(), and va().
Referenced by UI_RegisterBaseMapNode().
static void UI_BaseMapNodeDrawTooltip | ( | uiNode_t * | node, | |
int | x, | |||
int | y | |||
) | [static] |
Custom tooltip.
[in] | node | Node we request to draw tooltip |
[in] | x | Position x of the mouse |
[in] | y | Position y of the mouse |
Definition at line 256 of file ui_node_base.c.
References _, B_CheckBuildingDependencesStatus(), B_GetCurrentSelectedBase(), baseBuildingTile_s::building, building_s::dependsBuilding, base_s::map, building_s::name, UI_BaseMapGetCellAtPos(), UI_DrawTooltip(), and va().
Referenced by UI_RegisterBaseMapNode().
static void UI_BaseMapNodeMiddleClick | ( | uiNode_t * | node, | |
int | x, | |||
int | y | |||
) | [static] |
Middle click on the basemap.
[in] | node | Node definition for the base map |
[in] | x | The x screen coordinate |
[in] | y | The y screen coordinate |
baseCurrent
Definition at line 362 of file ui_node_base.c.
References B_DrawBuilding(), B_GetCurrentSelectedBase(), baseBuildingTile_s::blocked, baseBuildingTile_s::building, Com_Error(), ERR_DROP, base_s::map, uiNode_s::root, and UI_BaseMapGetCellAtPos().
Referenced by UI_RegisterBaseMapNode().
static void UI_BaseMapNodeRightClick | ( | uiNode_t * | node, | |
int | x, | |||
int | y | |||
) | [static] |
Right click on the basemap.
[in] | node | Context node |
[in] | x | Absolute x mouse coordinate (screen coordinates) |
[in] | y | Absolute y mouse coordinate (screen coordinates) |
Definition at line 330 of file ui_node_base.c.
References B_GetCurrentSelectedBase(), B_MarkBuildingDestroy(), baseBuildingTile_s::blocked, baseBuildingTile_s::building, base_s::map, uiNode_s::root, Sys_Error(), and UI_BaseMapGetCellAtPos().
Referenced by UI_RegisterBaseMapNode().
void UI_RegisterAbstractBaseNode | ( | uiBehaviour_t * | behaviour | ) |
Definition at line 401 of file ui_node_base.c.
References EXTRADATA_TYPE, uiBehaviour_s::extraDataSize, uiBehaviour_s::isAbstract, uiBehaviour_s::loaded, uiBehaviour_s::name, uiBehaviour_s::properties, qtrue, and UI_AbstractBaseNodeLoaded().
void UI_RegisterBaseLayoutNode | ( | uiBehaviour_t * | behaviour | ) |
Definition at line 421 of file ui_node_base.c.
References uiBehaviour_s::draw, uiBehaviour_s::extends, uiBehaviour_s::loading, uiBehaviour_s::name, UI_BaseLayoutNodeDraw(), and UI_BaseLayoutNodeLoading().
void UI_RegisterBaseMapNode | ( | uiBehaviour_t * | behaviour | ) |
Definition at line 410 of file ui_node_base.c.
References uiBehaviour_s::draw, uiBehaviour_s::drawTooltip, uiBehaviour_s::extends, uiBehaviour_s::leftClick, uiBehaviour_s::middleClick, uiBehaviour_s::name, uiBehaviour_s::rightClick, UI_BaseMapNodeClick(), UI_BaseMapNodeDraw(), UI_BaseMapNodeDrawTooltip(), UI_BaseMapNodeMiddleClick(), and UI_BaseMapNodeRightClick().
const value_t properties[] [static] |
{ {"baseid", V_INT, UI_EXTRADATA_OFFSETOF(baseExtraData_t, baseid), MEMBER_SIZEOF(baseExtraData_t, baseid)}, {NULL, V_NULL, 0, 0} }
Definition at line 395 of file ui_node_base.c.