inv_shared.c File Reference

Common object-, inventory-, container- and firemode-related functions. More...

#include "q_shared.h"
Include dependency graph for inv_shared.c:

Go to the source code of this file.

Functions

void INVSH_InitCSI (csi_t *import)
 Initializes client server shared data pointer. This works because the client and the server are both using exactly the same pointer.
qboolean INV_IsFloorDef (const invDef_t *invDef)
 Checks whether a given inventory definition is of special type.
qboolean INV_IsRightDef (const invDef_t *invDef)
 Checks whether a given inventory definition is of special type.
qboolean INV_IsLeftDef (const invDef_t *invDef)
 Checks whether a given inventory definition is of special type.
qboolean INV_IsEquipDef (const invDef_t *invDef)
 Checks whether a given inventory definition is of special type.
qboolean INV_IsArmourDef (const invDef_t *invDef)
 Checks whether a given inventory definition is of special type.
invList_tINVSH_HasArmour (const inventory_t *inv)
static qboolean INVSH_CheckShapeCollision (const uint32_t *shape, const uint32_t itemShape, const int x, const int y)
 Will check if the item-shape is colliding with something else in the container-shape at position x/y.
static qboolean INVSH_CheckToInventory_shape (const inventory_t *const i, const invDef_t *container, const uint32_t itemShape, const int x, const int y, const invList_t *ignoredItem)
 Checks if an item-shape can be put into a container at a certain position... ignores any 'special' types of containers.
int INVSH_CheckToInventory (const inventory_t *const i, const objDef_t *od, const invDef_t *container, const int x, const int y, const invList_t *ignoredItem)
qboolean INVSH_CompareItem (item_t *item1, item_t *item2)
 Check if the (physical) information of 2 items is exactly the same.
static qboolean INVSH_ShapeCheckPosition (const invList_t *ic, const int x, const int y)
 Check if a position in a container is used by an item (i.e. collides with the shape).
void INVSH_GetFirstShapePosition (const invList_t *ic, int *const x, int *const y)
 Calculates the first "true" bit in the shape and returns its position in the container.
qboolean INVSH_ExistsInInventory (const inventory_t *const inv, const invDef_t *container, item_t item)
 Searches if there is a specific item already in the inventory&container.
qboolean INV_IsCraftItem (const objDef_t *obj)
 Checks whether a given item is an aircraftitem item.
qboolean INV_IsBaseDefenceItem (const objDef_t *obj)
 Checks whether a given item is a basedefence item.
invList_tINVSH_SearchInInventory (const inventory_t *const i, const invDef_t *container, const int x, const int y)
 Searches if there is an item at location (x,y) in a container.
void INVSH_FindSpace (const inventory_t *const inv, const item_t *item, const invDef_t *container, int *const px, int *const py, const invList_t *ignoredItem)
 Finds space for item in inv at container.
objDef_tINVSH_GetItemByIDSilent (const char *id)
 Returns the index of this item in the inventory.
objDef_tINVSH_GetItemByIDX (int index)
 Returns the index of this item in the inventory.
objDef_tINVSH_GetItemByID (const char *id)
 Returns the item that belongs to the given id or NULL if it wasn't found.
invDef_tINVSH_GetInventoryDefinitionByID (const char *id)
qboolean INVSH_LoadableInWeapon (const objDef_t *od, const objDef_t *weapon)
 Checks if an item can be used to reload a weapon.
const fireDef_tFIRESH_GetFiredef (const objDef_t *obj, const weaponFireDefIndex_t weapFdsIdx, const fireDefIndex_t fdIdx)
 Get the fire definitions for a given object.
const fireDef_tFIRESH_FiredefForWeapon (const item_t *item)
 Returns the firedefinitions for a given weapon/ammo.
const objDef_tINVSH_HasReactionFireEnabledWeapon (const invList_t *invList)
 Checks whether the given list contains a reaction fire enabled weapon.
void INVSH_MergeShapes (uint32_t *shape, const uint32_t itemShape, const int x, const int y)
 Will merge the second shape (=itemShape) into the first one (=big container shape) on the position x/y.
qboolean INVSH_CheckShape (const uint32_t *shape, const int x, const int y)
 Checks the shape if there is a 1-bit on the position x/y.
static qboolean INVSH_CheckShapeSmall (const uint32_t shape, const int x, const int y)
 Checks the shape if there is a 1-bit on the position x/y.
int INVSH_ShapeSize (const uint32_t shape)
 Counts the used bits in a shape (item shape).
static uint32_t INVSH_ShapeSetBit (uint32_t shape, const int x, const int y)
 Sets one bit in a shape to true/1.
uint32_t INVSH_ShapeRotate (const uint32_t shape)
 Rotates a shape definition 90 degree to the left (CCW).

Variables

static csi_tCSI
static int cacheCheckToInventory = INV_DOES_NOT_FIT

Detailed Description

Common object-, inventory-, container- and firemode-related functions.

Note:
Shared inventory management functions prefix: INVSH_
Shared firemode management functions prefix: FIRESH_

Definition in file inv_shared.c.


Function Documentation

const fireDef_t* FIRESH_FiredefForWeapon ( const item_t item  ) 

Returns the firedefinitions for a given weapon/ammo.

Returns:
The array (one-dimensional) of the firedefs of the ammo for a given weapon, or NULL if the ammo doesn't support the given weapon
See also:
FIRESH_GetFiredef

Definition at line 607 of file inv_shared.c.

References objDef_s::fd, i, item_s::m, objDef_s::numWeapons, item_s::t, and objDef_s::weapons.

Referenced by actorL_shoot(), AI_FighterCalcBestAction(), AI_HideNeeded(), CL_SwapSkills(), G_ActorGetTUForReactionFire(), G_ActorHasWorkingFireModeSet(), G_PrepareShot(), G_ReactionFireGetTUsForItem(), HUD_GetFireDefinitionForHand(), HUD_GetMinimumTUsForUsage(), HUD_UpdateActorFireMode(), and INVSH_HasReactionFireEnabledWeapon().

const fireDef_t* FIRESH_GetFiredef ( const objDef_t obj,
const weaponFireDefIndex_t  weapFdsIdx,
const fireDefIndex_t  fdIdx 
)

Get the fire definitions for a given object.

Parameters:
[in] obj The object to get the firedef for
[in] weapFdsIdx the weapon index in the fire definition array
[in] fdIdx the fire definition index for the weapon (given by weapFdsIdx)
Returns:
Will never return NULL
See also:
FIRESH_FiredefForWeapon

Definition at line 592 of file inv_shared.c.

References objDef_s::fd, objDef_s::id, MAX_FIREDEFS_PER_WEAPON, MAX_WEAPONS_PER_OBJDEF, and Sys_Error().

Referenced by CL_ActorDoShoot(), CL_ActorDoShootTime(), CL_ActorDoThrow(), CL_ActorShootHidden(), CL_ActorShootHiddenTime(), CL_GetEventTime(), and HUD_UpdateActorFireMode().

qboolean INV_IsArmourDef ( const invDef_t invDef  ) 

Checks whether a given inventory definition is of special type.

Parameters:
invDef The inventory definition to check
Returns:
true if the given inventory definition is of type armour

Definition at line 89 of file inv_shared.c.

References invDef_s::id, and csi_s::idArmour.

Referenced by I_MoveInInventory().

qboolean INV_IsBaseDefenceItem ( const objDef_t obj  ) 

Checks whether a given item is a basedefence item.

Note:
This is done by checking whether it's a craftitem and whether it's marked as a dummy item - the combination of both means, that it's a basedefence item.
Parameters:
[in] obj pointer to item definition to check whether it's a basedefence item
Returns:
true if the given item is a basedefence item
See also:
INV_IsCraftItem

Definition at line 383 of file inv_shared.c.

References objDef_s::craftitem, objDef_s::isDummy, MAX_ACITEMS, and craftitem_s::type.

qboolean INV_IsCraftItem ( const objDef_t obj  ) 

Checks whether a given item is an aircraftitem item.

Note:
This is done by checking whether it's a craftitem and not marked as a dummy item - the combination of both means, that it's a basedefence item.
Parameters:
[in] obj pointer to item definition to check whether it's an aircraftiem item
Returns:
true if the given item is an aircraftitem item
See also:
INV_IsBaseDefenceItem

Definition at line 369 of file inv_shared.c.

References objDef_s::craftitem, objDef_s::isDummy, MAX_ACITEMS, and craftitem_s::type.

Referenced by INV_ItemMatchesFilter().

qboolean INV_IsEquipDef ( const invDef_t invDef  ) 

Checks whether a given inventory definition is of special type.

Parameters:
invDef The inventory definition to check
Returns:
true if the given inventory definition is of type equip

Definition at line 79 of file inv_shared.c.

References invDef_s::id, and csi_s::idEquip.

Referenced by I_MoveInInventory(), INVSH_CheckToInventory(), and UI_ContainerNodeDNDMove().

qboolean INV_IsFloorDef ( const invDef_t invDef  ) 

Checks whether a given inventory definition is of special type.

Parameters:
invDef The inventory definition to check
Returns:
true if the given inventory definition is of type floor

Definition at line 49 of file inv_shared.c.

References invDef_s::id, and csi_s::idFloor.

Referenced by G_ActorInvMove(), I_MoveInInventory(), INVSH_CheckToInventory(), and UI_ContainerNodeDNDMove().

qboolean INV_IsLeftDef ( const invDef_t invDef  ) 

Checks whether a given inventory definition is of special type.

Parameters:
invDef The inventory definition to check
Returns:
true if the given inventory definition is of type left

Definition at line 69 of file inv_shared.c.

References invDef_s::id, and csi_s::idLeft.

Referenced by G_ActorInvMove(), G_ActorReload(), I_MoveInInventory(), INVSH_CheckToInventory(), and UI_ContainerNodeDrawSingle().

qboolean INV_IsRightDef ( const invDef_t invDef  ) 

Checks whether a given inventory definition is of special type.

Parameters:
invDef The inventory definition to check
Returns:
true if the given inventory definition is of type right

Definition at line 59 of file inv_shared.c.

References invDef_s::id, and csi_s::idRight.

Referenced by G_ActorInvMove(), I_MoveInInventory(), INVSH_CheckToInventory(), and UI_ContainerNodeDrawSingle().

qboolean INVSH_CheckShape ( const uint32_t shape,
const int  x,
const int  y 
)

Checks the shape if there is a 1-bit on the position x/y.

Parameters:
[in] shape Pointer to 'uint32_t shape[SHAPE_BIG_MAX_HEIGHT]'
[in] x 
[in] y 

Definition at line 673 of file inv_shared.c.

References Com_Printf(), qfalse, qtrue, SHAPE_BIG_MAX_HEIGHT, and SHAPE_BIG_MAX_WIDTH.

Referenced by UI_ContainerNodeDrawFreeSpace().

static qboolean INVSH_CheckShapeCollision ( const uint32_t shape,
const uint32_t  itemShape,
const int  x,
const int  y 
) [static]

Will check if the item-shape is colliding with something else in the container-shape at position x/y.

Note:
The function expects an already rotated shape for itemShape. Use INVSH_ShapeRotate if needed.
Parameters:
[in] shape Pointer to 'uint32_t shape[SHAPE_BIG_MAX_HEIGHT]'
[in] itemShape 
[in] x 
[in] y 

Definition at line 109 of file inv_shared.c.

References Com_DPrintf(), DEBUG_SHARED, i, qfalse, qtrue, SHAPE_BIG_MAX_HEIGHT, SHAPE_SMALL_MAX_HEIGHT, and SHAPE_SMALL_MAX_WIDTH.

Referenced by INVSH_CheckToInventory_shape().

static qboolean INVSH_CheckShapeSmall ( const uint32_t  shape,
const int  x,
const int  y 
) [static]

Checks the shape if there is a 1-bit on the position x/y.

Parameters:
[in] shape The shape to check in. (8x4)
[in] x 
[in] y 

Definition at line 695 of file inv_shared.c.

References Com_Printf(), qfalse, SHAPE_BIG_MAX_HEIGHT, SHAPE_BIG_MAX_WIDTH, and SHAPE_SMALL_MAX_WIDTH.

Referenced by INVSH_ShapeRotate().

int INVSH_CheckToInventory ( const inventory_t *const   i,
const objDef_t od,
const invDef_t container,
const int  x,
const int  y,
const invList_t ignoredItem 
)
Parameters:
[in] i The inventory to check the item in.
[in] od The item to check in the inventory.
[in] container The index of the container in the inventory to check the item in.
[in] x The x value in the container (1 << x in the shape bitmask)
[in] y The y value in the container (SHAPE_BIG_MAX_HEIGHT is the max)
[in] ignoredItem You can ignore one item in the container (most often the currently dragged one). Use NULL if you want to check against all items in the container.
Returns:
INV_DOES_NOT_FIT if the item does not fit
INV_FITS if it fits and
INV_FITS_ONLY_ROTATED if it fits only when rotated 90 degree (to the left).
INV_FITS_BOTH if it fits either normally or when rotated 90 degree (to the left).

< Return INV_FITS_BOTH if both if statements where true above.

< We are returning with status qtrue (1) if the item does not fit at all - unlikely but not impossible.

Todo:
aren't both (equip and floor) temp container?

< Return INV_FITS_BOTH if both if statements where true above.

Definition at line 206 of file inv_shared.c.

References invDef_s::all, invDef_s::armour, inventory_s::c, Com_DPrintf(), DEBUG_SHARED, invDef_s::extension, objDef_s::extension, objDef_s::fireTwoHanded, invDef_s::headgear, objDef_s::headgear, objDef_s::holdTwoHanded, invDef_s::id, csi_s::idLeft, csi_s::idRight, INV_DOES_NOT_FIT, INV_FITS, INV_FITS_ONLY_ROTATED, INV_IsArmour, INV_IsEquipDef(), INV_IsFloorDef(), INV_IsLeftDef(), INV_IsRightDef(), INVSH_CheckToInventory_shape(), INVSH_ShapeRotate(), invList_s::item, invDef_s::scroll, objDef_s::shape, invDef_s::single, and item_s::t.

Referenced by I_MoveInInventory(), I_TryAddToInventory(), INVSH_FindSpace(), UI_ContainerNodeDNDMove(), UI_ContainerNodeDrawDropPreview(), and UI_ContainerNodeDrawFreeSpace().

static qboolean INVSH_CheckToInventory_shape ( const inventory_t *const   i,
const invDef_t container,
const uint32_t  itemShape,
const int  x,
const int  y,
const invList_t ignoredItem 
) [static]

Checks if an item-shape can be put into a container at a certain position... ignores any 'special' types of containers.

Parameters:
[in] i 
[in] container The container (index) to look into.
[in] itemShape The shape info of an item to fit into the container.
[in] x The x value in the container (1 << x in the shape bitmask)
[in] y The x value in the container (SHAPE_BIG_MAX_HEIGHT is the max)
[in] ignoredItem You can ignore one item in the container (most often the currently dragged one). Use NULL if you want to check against all items in the container.
See also:
INVSH_CheckToInventory
Returns:
qfalse if the item does not fit, qtrue if it fits.

Definition at line 154 of file inv_shared.c.

References inventory_s::c, cacheCheckToInventory, invDef_s::id, INVSH_CheckShapeCollision(), INVSH_MergeShapes(), INVSH_ShapeRotate(), invList_s::item, invList_s::next, qfalse, qtrue, item_s::rotated, invDef_s::scroll, objDef_s::shape, invDef_s::shape, SHAPE_BIG_MAX_HEIGHT, SHAPE_BIG_MAX_WIDTH, Sys_Error(), item_s::t, invList_s::x, and invList_s::y.

Referenced by INVSH_CheckToInventory().

qboolean INVSH_CompareItem ( item_t item1,
item_t item2 
)

Check if the (physical) information of 2 items is exactly the same.

Parameters:
[in] item1 First item to compare.
[in] item2 Second item to compare.
Returns:
qtrue if they are identical or qfalse otherwise.

Definition at line 285 of file inv_shared.c.

References item_s::a, item_s::m, qfalse, qtrue, and item_s::t.

Referenced by I_AddToInventory(), and INVSH_ExistsInInventory().

qboolean INVSH_ExistsInInventory ( const inventory_t *const   inv,
const invDef_t container,
item_t  item 
)

Searches if there is a specific item already in the inventory&container.

Parameters:
[in] inv Pointer to the inventory where we will search.
[in] container Container in the inventory.
[in] item The item to search for.
Returns:
qtrue if there already is at least one item of this type, otherwise qfalse.

Definition at line 348 of file inv_shared.c.

References inventory_s::c, invDef_s::id, INVSH_CompareItem(), invList_s::item, invList_s::next, qfalse, and qtrue.

Referenced by testItemAdd(), testItemDel(), testItemMove(), and UI_ContainerNodeDNDMove().

void INVSH_FindSpace ( const inventory_t *const   inv,
const item_t item,
const invDef_t container,
int *const   px,
int *const   py,
const invList_t ignoredItem 
)

Finds space for item in inv at container.

Parameters:
[in] inv The inventory to search space in
[in] item The item to check the space for
[in] container The container to search in
[out] px The x position in the container
[out] py The y position in the container
[in] ignoredItem You can ignore one item in the container (most often the currently dragged one). Use NULL if you want to check against all items in the container.
See also:
INVSH_CheckToInventory
Note:
x and y are NONE if no free space is available

Todo:
optimize for single containers

Definition at line 430 of file inv_shared.c.

References cacheCheckToInventory, Com_DPrintf(), DEBUG_SHARED, objDef_s::id, INV_DOES_NOT_FIT, INV_FITS, INVSH_CheckToInventory(), invDef_s::name, NONE, invDef_s::scroll, SHAPE_BIG_MAX_HEIGHT, SHAPE_BIG_MAX_WIDTH, item_s::t, and objDef_s::type.

Referenced by G_ActorInvMove(), I_AddToInventory(), I_MoveInInventory(), I_TryAddToInventory(), UI_ContainerNodeAutoPlace(), and UI_ContainerNodeDNDMove().

void INVSH_GetFirstShapePosition ( const invList_t ic,
int *const   x,
int *const   y 
)

Calculates the first "true" bit in the shape and returns its position in the container.

Note:
Use this to get the first "grab-able" grid-location (in the container) of an item.
Parameters:
[in] ic A pointer to an invList_t struct.
[out] x The x location inside the item.
[out] y The x location inside the item.
See also:
INVSH_CheckToInventory

Definition at line 324 of file inv_shared.c.

References INVSH_ShapeCheckPosition(), NONE, SHAPE_SMALL_MAX_HEIGHT, invList_s::x, and invList_s::y.

Referenced by CL_ActorReload(), and G_ActorInvMove().

invDef_t* INVSH_GetInventoryDefinitionByID ( const char *  id  ) 

Searched an inventory container by a given container id

Parameters:
[in] id ID or name of the inventory container to search for
Returns:
NULL if not found

Definition at line 523 of file inv_shared.c.

References i, csi_s::ids, and invDef_s::name.

Referenced by testItemAdd(), testItemDel(), testItemMassActions(), testItemMove(), UI_BaseInventoryNodeLoaded(), and UI_ContainerNodeLoaded().

objDef_t* INVSH_GetItemByID ( const char *  id  ) 
objDef_t* INVSH_GetItemByIDSilent ( const char *  id  ) 

Returns the index of this item in the inventory.

Note:
check that id is a none empty string
previously known as RS_GetItem
Parameters:
[in] id the item id in our object definition array (csi.ods)
See also:
INVSH_GetItemByID

Definition at line 475 of file inv_shared.c.

References i, objDef_s::id, csi_s::numODs, and csi_s::ods.

Referenced by AIM_UpdateItemDescription(), B_ManageAntimatter(), BDEF_SelectItem_f(), CL_ParseComponents(), Com_ParseItem(), G_AddItemToFloor(), INVSH_GetItemByID(), testItemAdd(), testItemDel(), testItemMassActions(), testItemMove(), UI_ItemNodeDraw(), and UP_TechGetsDisplayed().

objDef_t* INVSH_GetItemByIDX ( int  index  ) 
invList_t* INVSH_HasArmour ( const inventory_t inv  ) 

Definition at line 94 of file inv_shared.c.

References inventory_s::c, and csi_s::idArmour.

Referenced by CHRSH_CharGetBody(), and CHRSH_CharGetHead().

const objDef_t* INVSH_HasReactionFireEnabledWeapon ( const invList_t invList  ) 

Checks whether the given list contains a reaction fire enabled weapon.

Returns:
NULL if no reaction fire enabled weapon was found in the given list, the reaction fire enabled object otherwise.

Definition at line 634 of file inv_shared.c.

References FIRESH_FiredefForWeapon(), invList_s::item, invList_s::next, fireDef_s::reaction, and item_s::t.

Referenced by G_ActorHasReactionFireEnabledWeapon(), G_ReactionFireSetDefault(), and HUD_WeaponWithReaction().

void INVSH_InitCSI ( csi_t import  ) 

Initializes client server shared data pointer. This works because the client and the server are both using exactly the same pointer.

Parameters:
[in] import The client server interface pointer
See also:
G_Init
Com_ParseScripts

Definition at line 39 of file inv_shared.c.

Referenced by Com_ParseScripts(), and G_Init().

qboolean INVSH_LoadableInWeapon ( const objDef_t od,
const objDef_t weapon 
)

Checks if an item can be used to reload a weapon.

Parameters:
[in] od The object definition of the ammo.
[in] weapon The weapon (in the inventory) to check the item with.
Returns:
qboolean Returns qtrue if the item can be used in the given weapon, otherwise qfalse.

Definition at line 541 of file inv_shared.c.

References Com_DPrintf(), DEBUG_SHARED, i, objDef_s::id, objDef_s::numWeapons, qfalse, qtrue, and objDef_s::weapons.

Referenced by CL_ActorGetContainerForReload(), CP_AddWeaponAmmo(), G_ActorReload(), G_ClientCanReload(), I_EquipActor(), I_MoveInInventory(), I_PackAmmoAndWeapon(), UI_BaseInventoryNodeDrawItems(), UI_ContainerNodeDNDMove(), UI_ContainerNodeDrawGrid(), and UI_ContainerNodeDrawSingle().

void INVSH_MergeShapes ( uint32_t shape,
const uint32_t  itemShape,
const int  x,
const int  y 
)

Will merge the second shape (=itemShape) into the first one (=big container shape) on the position x/y.

Note:
The function expects an already rotated shape for itemShape. Use INVSH_ShapeRotate if needed.
Parameters:
[in] shape Pointer to 'uint32_t shape[SHAPE_BIG_MAX_HEIGHT]'
[in] itemShape 
[in] x 
[in] y 

Definition at line 659 of file inv_shared.c.

References i, SHAPE_BIG_MAX_HEIGHT, SHAPE_SMALL_MAX_HEIGHT, and SHAPE_SMALL_MAX_WIDTH.

Referenced by INVSH_CheckToInventory_shape(), and UI_ContainerNodeDrawFreeSpace().

invList_t* INVSH_SearchInInventory ( const inventory_t *const   i,
const invDef_t container,
const int  x,
const int  y 
)

Searches if there is an item at location (x,y) in a container.

Parameters:
[in] i Pointer to the inventory where we will search.
[in] container Container in the inventory.
[in] x/y Position in the container that you want to check.
Returns:
invList_t Pointer to the invList_t/item that is located at x/y.
See also:
INV_SearchInScrollableContainer

Definition at line 396 of file inv_shared.c.

References inventory_s::c, invDef_s::id, INVSH_ShapeCheckPosition(), invDef_s::name, invList_s::next, invDef_s::scroll, invDef_s::single, and Sys_Error().

Referenced by CL_InvAmmo(), CL_InvDel(), CL_InvReload(), G_ActorInvMove(), G_ClientAction(), I_MoveInInventory(), UI_ContainerNodeAutoPlace(), UI_ContainerNodeDNDFinished(), UI_ContainerNodeDNDMove(), and UI_ContainerNodeGetItemAtPosition().

static qboolean INVSH_ShapeCheckPosition ( const invList_t ic,
const int  x,
const int  y 
) [static]

Check if a position in a container is used by an item (i.e. collides with the shape).

Parameters:
[in] ic A pointer to an invList_t struct. The position is checked against its contained item.
[in] x The x location in the container.
[in] y The y location in the container.

Definition at line 299 of file inv_shared.c.

References INVSH_ShapeRotate(), invList_s::item, qfalse, qtrue, item_s::rotated, objDef_s::shape, SHAPE_SMALL_MAX_WIDTH, item_s::t, invList_s::x, and invList_s::y.

Referenced by INVSH_GetFirstShapePosition(), and INVSH_SearchInInventory().

uint32_t INVSH_ShapeRotate ( const uint32_t  shape  ) 

Rotates a shape definition 90 degree to the left (CCW).

Note:
Only works for V_SHAPE_SMALL!
Parameters:
[in] shape The shape to rotate.
Returns:
The new shape.

Definition at line 750 of file inv_shared.c.

References INVSH_CheckShapeSmall(), INVSH_ShapeSetBit(), SHAPE_SMALL_MAX_HEIGHT, and SHAPE_SMALL_MAX_WIDTH.

Referenced by INVSH_CheckToInventory(), INVSH_CheckToInventory_shape(), INVSH_ShapeCheckPosition(), and UI_ContainerNodeDrawFreeSpace().

static uint32_t INVSH_ShapeSetBit ( uint32_t  shape,
const int  x,
const int  y 
) [static]

Sets one bit in a shape to true/1.

Note:
Only works for V_SHAPE_SMALL! If the bit is already set the shape is not changed.
Parameters:
[in] shape The shape to modify. (8x4)
[in] x The x (width) position of the bit to set.
[in] y The y (height) position of the bit to set.
Returns:
The new shape.

Definition at line 732 of file inv_shared.c.

References Com_Printf(), SHAPE_SMALL_MAX_HEIGHT, and SHAPE_SMALL_MAX_WIDTH.

Referenced by INVSH_ShapeRotate().

int INVSH_ShapeSize ( const uint32_t  shape  ) 

Counts the used bits in a shape (item shape).

Parameters:
[in] shape The shape to count the bits in.
Returns:
Number of bits.
Note:
Used to calculate the real field usage in the inventory

Definition at line 711 of file inv_shared.c.

References i, SHAPE_SMALL_MAX_HEIGHT, and SHAPE_SMALL_MAX_WIDTH.

Referenced by LE_BiggestItem().


Variable Documentation

int cacheCheckToInventory = INV_DOES_NOT_FIT [static]

Definition at line 99 of file inv_shared.c.

Referenced by INVSH_CheckToInventory_shape(), and INVSH_FindSpace().

csi_t* CSI [static]

Definition at line 30 of file inv_shared.c.


Generated by  doxygen 1.6.2