UFO: Alien Invasion
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
objDef_s Struct Reference

Defines all attributes of objects used in the inventory. More...

#include <inv_shared.h>

Public Member Functions

uint32_t getShapeRotated () const
 Rotates a shape definition 90 degree to the left (CCW) More...
 
bool isCraftItem () const
 Checks whether a given item is an aircraftitem item. More...
 
bool isBaseDefenceItem () const
 Checks whether the item is a basedefence item. More...
 
bool isLoadableInWeapon (const objDef_s *weapon) const
 Checks if an item can be used to reload a weapon. More...
 
bool isAmmo () const
 
bool isArmour () const
 
int getReloadTime () const
 
bool isReloadable () const
 

Data Fields

int idx
 
const char * name
 
const char * id
 
const char * model
 
const char * image
 
const char * type
 
const char * armourPath
 
uint32_t shape
 
float scale
 
vec3_t center
 
bool weapon
 
bool holdTwoHanded
 
bool fireTwoHanded
 
bool headgear
 
bool thrown
 
bool implant
 
itemEffect_tstrengthenEffect
 
bool isVirtual
 
bool isPrimary
 
bool isSecondary
 
bool isHeavy
 
bool isMisc
 
bool isUGVitem
 
bool isDummy
 
int ammo
 
int _reload
 
const char * reloadSound
 
float reloadAttenuation
 
bool oneshot
 
bool deplete
 
int useable
 
const struct objDef_sammos [MAX_AMMOS_PER_OBJDEF]
 
int numAmmos
 
const struct objDef_sweapons [MAX_WEAPONS_PER_OBJDEF]
 
fireDef_t fd [MAX_WEAPONS_PER_OBJDEF][MAX_FIREDEFS_PER_WEAPON]
 
fireDefIndex_t numFiredefs [MAX_WEAPONS_PER_OBJDEF]
 
int numWeapons
 
short protection [MAX_DAMAGETYPES]
 
short ratings [MAX_DAMAGETYPES]
 
byte dmgtype
 
byte sx
 
byte sy
 
char animationIndex
 
craftItem craftitem
 
int price
 
int productionCost
 
int size
 
int weight
 
bool notOnMarket
 

Detailed Description

Defines all attributes of objects used in the inventory.

Note
See also http://ufoai.org/wiki/index.php/UFO-Scripts/weapon_%2A.ufo

Definition at line 264 of file inv_shared.h.

Member Function Documentation

int objDef_s::getReloadTime ( ) const
inline
uint32_t objDef_t::getShapeRotated ( ) const

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

Note
Only works for V_SHAPE_SMALL!
Returns
The new shape.

Definition at line 472 of file inv_shared.cpp.

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

Referenced by Inventory::canHoldItem(), INVSH_CheckToInventory_shape(), INVSH_ShapeCheckPosition(), and UI_ContainerNodeDrawFreeSpace().

bool objDef_t::isBaseDefenceItem ( ) const

Checks whether the 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.
Returns
true if the given item is a basedefence item
See also
isCraftItem

Definition at line 239 of file inv_shared.cpp.

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

bool objDef_t::isCraftItem ( ) const

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.
Returns
true if the given item is an aircraftitem item
See also
isBaseDefenceItem

Definition at line 226 of file inv_shared.cpp.

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

Referenced by INV_ItemMatchesFilter().

bool objDef_t::isLoadableInWeapon ( const objDef_s weapon) const

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

Parameters
[in]weaponThe weapon (in the inventory) to check the item with. Might not be nullptr.
Returns
true if the item can be used in the given weapon, otherwise false.

Definition at line 356 of file inv_shared.cpp.

References i, numWeapons, and weapons.

Referenced by CL_ActorGetContainerForReload(), CP_AddWeaponAmmo(), G_ActorReload(), G_ClientCanReload(), InventoryInterface::moveInInventory(), uiContainerNode::onDndMove(), InventoryInterface::PackAmmoAndWeapon(), UI_BaseInventoryNodeDrawItems(), UI_ContainerNodeDrawGrid(), and UI_ContainerNodeDrawSingle().

Field Documentation

int objDef_s::_reload

Time units (TUs) for reloading the weapon.

Definition at line 296 of file inv_shared.h.

Referenced by getReloadTime().

int objDef_s::ammo

This value is set for weapon and it says how many bullets currently loaded clip would have, if that clip would be full. In other words, max bullets for this type of weapon with currently loaded type of ammo.

Definition at line 293 of file inv_shared.h.

Referenced by ItemCargo::add(), equipDef_s::addClip(), AII_ReloadWeapon(), AII_RemoveItemFromSlot(), AIL_roundsleft(), CL_InvReload(), Com_ParseItem(), CP_AddWeaponAmmo(), InventoryInterface::EquipActorNormal(), InventoryInterface::EquipActorRobot(), G_EventInventoryReload(), HUD_WeaponCanBeReloaded(), INV_ItemDescription(), INV_LoadWeapon(), InventoryInterface::moveInInventory(), InventoryInterface::PackAmmoAndWeapon(), and UP_AircraftItemDescription().

char objDef_s::animationIndex

The animation index for the character with the weapon.

Definition at line 327 of file inv_shared.h.

Referenced by LE_GetAnim().

const char* objDef_s::armourPath

Definition at line 272 of file inv_shared.h.

Referenced by CHRSH_CharGetBody(), CHRSH_CharGetHead(), Com_ParseItem(), and TEST_F().

vec3_t objDef_s::center

origin for models

Definition at line 276 of file inv_shared.h.

Referenced by LE_PlaceItem(), and UI_DrawItem().

bool objDef_s::deplete

This weapon is useless after all ("oneshot") ammo is used up. If true this item will not be collected on mission-end. (see INV_CollectinItems).

Definition at line 301 of file inv_shared.h.

Referenced by Com_ParseItem(), InventoryInterface::EquipActorNormal(), G_ClientShoot(), G_ShootSingle(), and INV_EquipmentDefSanityCheck().

bool objDef_s::headgear

This is a headgear.

Definition at line 280 of file inv_shared.h.

Referenced by Inventory::canHoldItem(), InventoryInterface::moveInInventory(), and UI_ContainerNodeAutoPlaceItem().

bool objDef_s::holdTwoHanded

The soldier needs both hands to hold this object.

Definition at line 278 of file inv_shared.h.

Referenced by Inventory::canHoldItem(), and Item::isHeldTwoHanded().

const char* objDef_s::image

Object image file - relative to game dir.

Definition at line 270 of file inv_shared.h.

Referenced by Com_ParseItem(), RS_InitTree(), TEST_F(), and UI_DrawItem().

bool objDef_s::isDummy
bool objDef_s::isHeavy

Definition at line 287 of file inv_shared.h.

Referenced by INV_GetFilterFromItem(), and INV_ItemMatchesFilter().

bool objDef_s::isPrimary
bool objDef_s::isSecondary
bool objDef_s::isUGVitem

Definition at line 289 of file inv_shared.h.

Referenced by INV_ItemMatchesFilter().

const char* objDef_s::model

Model name - relative to game dir.

Definition at line 269 of file inv_shared.h.

Referenced by CL_ActorCvars(), CL_ViewPrecacheModels(), Com_ParseItem(), GAME_GetModelForItem(), GEO_DrawMarkers(), HUD_UpdateActorCvar(), RS_InitTree(), and TEST_F().

bool objDef_s::notOnMarket

True if this item should not be available on market.

Definition at line 336 of file inv_shared.h.

Referenced by BS_IsOnMarket(), and BS_SetAutosell_f().

bool objDef_s::oneshot

This weapon contains its own ammo (it is loaded in the base). "int ammo" of objDef_s defines the amount of ammo used in oneshoot weapons.

Definition at line 299 of file inv_shared.h.

Referenced by Com_ParseItem(), InventoryInterface::EquipActorNormal(), G_ClientShoot(), and InventoryInterface::PackAmmoAndWeapon().

int objDef_s::price
int objDef_s::productionCost

Production costs for this item.

Definition at line 333 of file inv_shared.h.

Referenced by Com_ParseItem(), PR_CheckFrame(), PR_FinishProduction(), and PR_ItemProductionInfo().

short objDef_s::protection[MAX_DAMAGETYPES]

Protection values for each armour and every damage type.

Definition at line 322 of file inv_shared.h.

Referenced by Com_ParseItem(), and G_ApplyProtection().

short objDef_s::ratings[MAX_DAMAGETYPES]

Rating values for each armour and every damage type to display in the menus.

Definition at line 323 of file inv_shared.h.

Referenced by Com_ParseItem(), and INV_ItemDescription().

float objDef_s::reloadAttenuation

Attenuation of reload sound - less louder over distance -

Definition at line 298 of file inv_shared.h.

Referenced by CL_InvReload(), and Com_ParseItem().

const char* objDef_s::reloadSound

Sound played when weapon is reloaded

Definition at line 297 of file inv_shared.h.

Referenced by CL_InvReload(), Com_ParseItem(), and TEST_F().

float objDef_s::scale

scale value for images? and models

Definition at line 275 of file inv_shared.h.

Referenced by UI_DrawItem().

itemEffect_t* objDef_s::strengthenEffect
bool objDef_s::thrown

This item can be thrown.

Definition at line 281 of file inv_shared.h.

Referenced by Com_ParseItem(), G_ClientShoot(), G_ShootGrenade(), and G_ShootSingle().

const char* objDef_s::type

melee, rifle, ammo, armour. e.g. used in the ufopedia

Definition at line 271 of file inv_shared.h.

Referenced by AIL_weapontype(), CL_ViewPrecacheModels(), Com_ParseItem(), Inventory::findSpace(), INV_ItemMatchesFilter(), and LE_GetAnim().

int objDef_s::useable

Defines which team can use this item: TEAM_*. Used in checking the right team when filling the containers with available armour.

Definition at line 304 of file inv_shared.h.

Referenced by CHRSH_IsArmourUseableForTeam().

int objDef_s::weight

The weight of the item

Definition at line 335 of file inv_shared.h.

Referenced by Item::getWeight(), and INV_ItemDescription().


The documentation for this struct was generated from the following files: