UFO: Alien Invasion
|
#include "g_local.h"
Go to the source code of this file.
Functions | |
const equipDef_t * | G_GetEquipDefByID (const char *equipID) |
Edict * | G_GetFloorItemFromPos (const pos3_t pos) |
Callback to G_GetEdictFromPos() for given position, used to get items from position. More... | |
Edict * | G_GetFloorItems (Edict *ent) __attribute__((nonnull)) |
Prepares a list of items on the floor at given entity position. More... | |
bool | G_InventoryRemoveItemByID (const char *itemID, Edict *ent, containerIndex_t index) |
Removes one particular item from a given container. More... | |
bool | G_AddItemToFloor (const pos3_t pos, const char *itemID) |
Adds a new item to an existing or new floor container edict at the given grid location. More... | |
void | G_InventoryToFloor (Edict *ent) |
Move items to adjacent locations if the containers on the current floor edict are full. More... | |
void | G_ReadItem (Item *item, const invDef_t **container, int *x, int *y) |
Read item from the network buffer. More... | |
void | G_WriteItem (const Item &item, const containerIndex_t contId, int x, int y) |
Write an item to the network buffer. More... | |
void | G_SendInventory (playermask_t player_mask, const Edict &ent) |
Sends whole inventory through the network buffer. More... | |
bool G_AddItemToFloor | ( | const pos3_t | pos, |
const char * | itemID | ||
) |
Adds a new item to an existing or new floor container edict at the given grid location.
pos | The grid location to spawn the item on the floor |
itemID | The item to spawn |
Definition at line 140 of file g_inventory.cpp.
References Edict::chr, CID_FLOOR, G_GetFloorItemFromPos(), G_SpawnFloor(), game, gi, character_s::inv, INVDEF, game_locals_s::invi, INVSH_GetItemByIDSilent(), and InventoryInterface::tryAddToInventory().
Referenced by SP_misc_item().
const equipDef_t* G_GetEquipDefByID | ( | const char * | equipID | ) |
Definition at line 31 of file g_inventory.cpp.
References game_import_s::csi, csi_s::eds, gi, i, equipDef_s::id, csi_s::numEDs, and Q_streq.
Referenced by G_GetEquipmentForAISpawn().
Callback to G_GetEdictFromPos() for given position, used to get items from position.
[in] | pos | A position for which items are wanted. |
Definition at line 48 of file g_inventory.cpp.
References ET_ITEM, and G_GetEdictFromPos().
Referenced by G_AddItemToFloor(), G_GetFloorItems(), G_SpawnItemOnFloor(), and TEST_F().
Prepares a list of items on the floor at given entity position.
[in] | ent | Pointer to an entity being an actor. |
nullptr
in case no items were found on the edict grid position. Definition at line 59 of file g_inventory.cpp.
References G_GetFloorItemFromPos(), Edict::pos, Edict::resetFloor(), and Edict::setFloor().
Referenced by G_ActorInvMove(), G_ActorRevitalise(), G_ClientMove(), G_InventoryToFloor(), G_MissionThink(), G_SpawnItemOnFloor(), and TEST_F().
bool G_InventoryRemoveItemByID | ( | const char * | itemID, |
Edict * | ent, | ||
containerIndex_t | container | ||
) |
Removes one particular item from a given container.
itemID | The id of the item to remove |
ent | The edict that holds the inventory to remove the item from |
container | The container in the inventory of the edict to remove the searched item from. |
true
if the removal was successful, false
otherwise. Definition at line 80 of file g_inventory.cpp.
References Edict::chr, Item::def(), G_EventInventoryDelete(), G_VisToPM(), game, Edict::getContainer(), Item::getNext(), Item::getX(), Item::getY(), gi, objDef_s::id, character_s::inv, INVDEF, game_locals_s::invi, Q_streq, InventoryInterface::removeFromInventory(), and Edict::visflags.
Referenced by G_MissionThink().
Move items to adjacent locations if the containers on the current floor edict are full.
Move the whole given inventory to the floor and destroy the items that do not fit there.
[in] | ent | Pointer to an Edict being an actor. |
Definition at line 221 of file g_inventory.cpp.
References InventoryInterface::addToInventory(), Edict::chr, CID_ARMOUR, CID_FLOOR, CID_IMPLANT, CID_MAX, Item::def(), G_CheckVis(), G_EventInventoryDelete(), G_EventPerish(), G_GetFloorItems(), G_InventoryDropToFloorCheck(), G_SpawnFloor(), G_VisFlagsReset(), G_VisToPM(), game, Item::getAmount(), Edict::getContainer(), Edict::getIdNum(), Item::getNext(), Inventory::getNextCont(), Item::getX(), Item::getY(), gi, objDef_s::id, Container::id, character_s::inv, INVDEF, game_locals_s::invi, NONE, Edict::pos, InventoryInterface::removeFromInventory(), Edict::resetContainer(), Edict::setFloor(), and Edict::visflags.
Referenced by G_ActorDieOrStun(), and TEST_F().
Read item from the network buffer.
[in,out] | item | The Item being send through net. |
[in,out] | container | Container which is being updated with item sent. |
[in] | x,y | Position of item in given container. |
Definition at line 297 of file g_inventory.cpp.
References game_import_s::csi, gi, INVDEF, isValidContId(), m, NONE, csi_s::numODs, csi_s::ods, Item::rotated, Item::setAmmoDef(), Item::setAmmoLeft(), Item::setAmount(), and Item::setDef().
Referenced by G_ClientReadInventory(), and G_ClientSkipActorInfo().
void G_SendInventory | ( | playermask_t | playerMask, |
const Edict & | ent | ||
) |
Sends whole inventory through the network buffer.
[in] | playerMask | The player mask to determine which clients should receive the event (G_VisToPM (ent->visflags)). |
[in] | ent | Pointer to an actor or floor container with inventory to send. |
Definition at line 347 of file g_inventory.cpp.
References Edict::chr, Container::countItems(), Item::def(), G_EventEnd(), G_EventInventoryAdd(), G_IsItem, G_WriteItem(), Inventory::getNextCont(), Container::getNextItem(), Item::getX(), Item::getY(), Container::id, character_s::inv, and INVDEF.
Referenced by G_AppearPerishEvent(), G_EventActorAppear(), and G_VisMakeEverythingVisible().
void G_WriteItem | ( | const Item & | item, |
const containerIndex_t | contId, | ||
int | x, | ||
int | y | ||
) |
Write an item to the network buffer.
[in,out] | item | The Item being send through net. |
[in,out] | contId | Container which is being updated with item sent. |
[in] | x,y | Position of item in given container. |
Definition at line 334 of file g_inventory.cpp.
References Item::ammoDef(), Item::def(), Item::getAmmoLeft(), Item::getAmount(), gi, objDef_s::idx, NONE, and Item::rotated.
Referenced by G_ActorInvMove(), and G_SendInventory().