33#define INTERCEPTOR_MAX 12
34#define AIRCRAFTTYPE_MAX (DROPSHIP_MAX + INTERCEPTOR_MAX)
37#define MAX_OBJDEFS 144
38#define MAX_IMPLANTS 16
39#define MAX_MAPDEFS 256
40#define MAX_WEAPONS_PER_OBJDEF 4
41#define MAX_AMMOS_PER_OBJDEF 4
42#define MAX_FIREDEFS_PER_WEAPON 8
43#define WEAPON_BALANCE 0.5f
44#define SKILL_BALANCE 1.0f
61 return (
id >= 0 &&
id <
CID_MAX);
88typedef struct itemEffect_s {
101typedef struct implantDef_s {
110typedef struct fireDef_s {
125 const struct objDef_s*
obj;
176#define SHAPE_SMALL_MAX_WIDTH 8
177#define SHAPE_SMALL_MAX_HEIGHT 4
188#define SHAPE_BIG_MAX_HEIGHT 16
190#define SHAPE_BIG_MAX_WIDTH 32
246typedef struct craftitem_s {
258#define MAX_DAMAGETYPES 64
264typedef struct objDef_s {
344 return Q_streq(this->type,
"ammo");
347 return Q_streq(this->type,
"armour");
368#define MAX_INVDEFS 16
371typedef struct invDef_s {
394#define MAX_CONTAINERS MAX_INVDEFS
429 inline void setX (
const int val) {
432 inline void setY (
const int val) {
480 return _itemDef->getReloadTime() > 0;
591 void findSpace (
const invDef_t* container,
const Item* item,
int*
const px,
int*
const py,
const Item* ignoredItem)
const;
603#define MAX_EQUIPDEFS 64
605typedef struct equipDef_s {
618#define MAX_TEAMS_PER_MISSION MAX_TEAMDEFS
620typedef struct damageType_s {
634#define foreachhand(hand) for (int hand##__loop = 0; hand##__loop < 2; ++hand##__loop) \
635 if (hand = (hand##__loop == 0 ? ACTOR_HAND_RIGHT : ACTOR_HAND_LEFT), false) {} else
654#define THIS_FIREMODE(fm, HAND, fdIdx) ((fm)->getHand() == (HAND) && (fm)->getFmIdx() == (fdIdx))
661#define FIRESH_IsMedikit(firedef) ((firedef)->damage[0] < 0)
662void INVSH_MergeShapes(uint32_t* shape,
const uint32_t itemShape,
const int x,
const int y);
int countItems() const
Count the number of items in the Container.
Item * getNextItem(const Item *prev) const
const invDef_t * def() const
Item * getLeftHandContainer() const
int countItems() const
Count the number of items in the inventory (without temp containers).
const Container * _getNextCont(const Container *prev) const
int canHoldItem(const invDef_t *container, const objDef_t *od, const int x, const int y, const Item *ignoredItem) const
bool canHoldItemWeight(containerIndex_t from, containerIndex_t to, const Item &item, int maxWeight) const
Check that adding an item to the inventory won't exceed the max permitted weight.
Item * getFloorContainer() const
bool holdsReactionFireWeapon() const
Checks if there is a weapon in the hands that can be used for reaction fire.
void resetTempContainers()
void findSpace(const invDef_t *container, const Item *item, int *const px, int *const py, const Item *ignoredItem) const
Finds space for item in inv at container.
Item * getRightHandContainer() const
bool containsItem(const containerIndex_t contId, const Item *const item) const
Searches if there is a specific item already in the inventory&container.
Container _containers[MAX_CONTAINERS]
Item * getEquipContainer() const
int getWeight() const
Get the weight of the items in the given inventory (excluding those in temp containers).
void setContainer(const containerIndex_t idx, Item *cont)
Item * getHolsterContainer() const
Item * getImplantContainer() const
void resetContainer(const containerIndex_t idx)
Item * getHeadgear() const
void setFloorContainer(Item *cont)
Item * getItemAtPos(const invDef_t *container, const int x, const int y) const
Searches if there is an item at location (x,y) in a container.
const Container & getContainer(const containerIndex_t idx) const
Item * getContainer2(const containerIndex_t idx) const
const Container * getNextCont(const Container *prev, bool inclTemp=false) const
Item * findInContainer(const containerIndex_t contId, const Item *const item) const
Searches a specific item in the inventory&container.
item instance data, with linked list capability
const objDef_t * ammoDef(void) const
Item()
Item constructor with all default values.
void setAmount(int value)
void setAmmoDef(const objDef_t *od)
void addAmount(int value)
const objDef_t * _itemDef
void setDef(const objDef_t *objDef)
const fireDef_t * getFastestFireDef() const
const objDef_t * def(void) const
const fireDef_t * getSlowestFireDef() const
Get the firedef that uses the most TU for this item.
const objDef_t * _ammoDef
int getWeight() const
Return the weight of an item.
const fireDef_t * getFiredefs() const
Returns the firedefinitions for a given weapon/ammo.
bool isSameAs(const Item *const other) const
Check if the (physical) information of 2 items is exactly the same.
void getFirstShapePosition(int *const x, int *const y) const
Calculates the first "true" bit in the shape and returns its position in the item.
const objDef_t * getReactionFireWeaponType() const
Checks whether this item is a reaction fire enabled weapon.
bool isReloadable() const
int getNumFiredefs() const
void setAmmoLeft(int value)
bool isHeldTwoHanded() const
const objDef_t * INVSH_GetItemByIDX(int index)
Returns the item that belongs to the given index or nullptr if the index is invalid.
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/...
aircraftParams_t
Aircraft parameters.
const implantDef_t * INVSH_GetImplantByID(const char *id)
Returns the implant that belongs to the given id or nullptr if it wasn't found.
int32_t weaponFireDefIndex_t
#define MAX_AMMOS_PER_OBJDEF
bool 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.
aircraftItemType_t
All different types of craft items.
const implantDef_t * INVSH_GetImplantForObjDef(const objDef_t *od)
#define MAX_FIREDEFS_PER_WEAPON
short humanAircraftType_t
#define SHAPE_BIG_MAX_HEIGHT
defines the max height of an inventory container
const implantDef_t * INVSH_GetImplantByIDSilent(const char *id)
Returns the implant that belongs to the given id or nullptr if it wasn't found.
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.
int INVSH_ShapeSize(const uint32_t shape)
Counts the used bits in a shape (item shape).
bool isValidContId(const containerIndex_t id)
void INVSH_InitCSI(const struct csi_s *import) __attribute__((nonnull))
#define MAX_WEAPONS_PER_OBJDEF
const objDef_t * INVSH_GetItemByID(const char *id)
Returns the item that belongs to the given id or nullptr if it wasn't found.
inventory_action_t
Possible inventory actions for moving items between containers.
const invDef_t * INVSH_GetInventoryDefinitionByID(const char *id)
@ ACTOR_HAND_ENSURE_32BIT
const objDef_t * INVSH_GetItemByIDSilent(const char *id)
Returns the item that belongs to the given id or nullptr if it wasn't found.
float stats[AIR_STATS_MAX]
int numItems[MAX_OBJDEFS]
byte numItemsLoose[MAX_OBJDEFS]
int numAircraft[AIRCRAFTTYPE_MAX]
void addClip(const Item *item)
Combine the rounds of partially used clips.
this is a fire definition for our weapons/ammo
itemEffect_t * activeEffect
itemEffect_t * deactiveEffect
const struct objDef_s * obj
itemEffect_t * overdoseEffect
const char * hitBodySound
weaponFireDefIndex_t weapFdsIdx
void getShotOrigin(const vec3_t from, const vec3_t dir, bool crouching, vec3_t shotOrigin) const
const struct objDef_s * item
inventory definition for our menus
bool isFloorDef() const
Checks whether the inventory definition is the floor.
uint32_t shape[SHAPE_BIG_MAX_HEIGHT]
bool isArmourDef() const
Checks whether a given inventory definition is of special type.
bool isLeftDef() const
Checks whether a given inventory definition is of special type.
bool isEquipDef() const
Checks whether a given inventory definition is of special type.
bool isRightDef() const
Checks whether the inventory definition is the right Hand.
Defines all attributes of objects used in the inventory.
const struct objDef_s * ammos[MAX_AMMOS_PER_OBJDEF]
int getReloadTime() const
uint32_t getShapeRotated() const
Rotates a shape definition 90 degree to the left (CCW).
bool isBaseDefenceItem() const
Checks whether the item is a basedefence item.
fireDef_t fd[MAX_WEAPONS_PER_OBJDEF][MAX_FIREDEFS_PER_WEAPON]
fireDefIndex_t numFiredefs[MAX_WEAPONS_PER_OBJDEF]
itemEffect_t * strengthenEffect
short protection[MAX_DAMAGETYPES]
bool isLoadableInWeapon(const objDef_s *weapon) const
Checks if an item can be used to reload a weapon.
short ratings[MAX_DAMAGETYPES]
bool isReloadable() const
const struct objDef_s * weapons[MAX_WEAPONS_PER_OBJDEF]
bool isCraftItem() const
Checks whether a given item is an aircraftitem item.