ui_node_base.c File Reference

#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"
Include dependency graph for ui_node_base.c:

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 []

Detailed Description

Definition in file ui_node_base.c.


Define Documentation

#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.


Function Documentation

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]
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.

Parameters:
[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().

static qboolean UI_BaseMapIsCellFree ( const base_t base,
int  col,
int  row 
) [inline, static]

Check a base cell.

Returns:
True if the cell is free to build

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.

See also:
UI_BaseMapRightClick
Parameters:
[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]
static void UI_BaseMapNodeDrawTooltip ( uiNode_t node,
int  x,
int  y 
) [static]

Custom tooltip.

Parameters:
[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.

See also:
UI_BaseMapNodeClick
Parameters:
[in] node Node definition for the base map
[in] x The x screen coordinate
[in] y The y screen coordinate
Note:
relies on 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.

See also:
UI_BaseMapNodeClick
Parameters:
[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  ) 
void UI_RegisterBaseLayoutNode ( uiBehaviour_t behaviour  ) 
void UI_RegisterBaseMapNode ( uiBehaviour_t behaviour  ) 

Variable Documentation

const value_t properties[] [static]
Initial value:
 {
    
    {"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.


Generated by  doxygen 1.6.2