X-Git-Url: http://de.git.xonotic.org/?p=xonotic%2Fxonotic-data.pk3dir.git;a=blobdiff_plain;f=qcsrc%2Fcommon%2Ft_items.qh;h=455952dd63801dccc17d5548c4282b2398629254;hp=1cf55b13dd405ebca472fde9ac57af73beced6c7;hb=b5d301c452099f6c56f0def86444f593fea9d7b3;hpb=91cfda1dfc3e04eaa7df65875f0cdf874736dab6 diff --git a/qcsrc/common/t_items.qh b/qcsrc/common/t_items.qh index 1cf55b13dd..455952dd63 100644 --- a/qcsrc/common/t_items.qh +++ b/qcsrc/common/t_items.qh @@ -1,25 +1,5 @@ #pragma once -#ifdef SVQC -#include -#endif - -/// \brief Unconditional maximum amount of resources the player can have. -const int RESOURCE_AMOUNT_HARD_LIMIT = 999; - -/// \brief Describes the available resource types. -enum -{ - RESOURCE_HEALTH, ///< Health. - RESOURCE_ARMOR, ///< Armor. - RESOURCE_SHELLS, ///< Shells (used by shotgun). - RESOURCE_BULLETS, ///< Bullets (used by machinegun and rifle) - RESOURCE_ROCKETS, ///< Rockets (used by mortar, hagar, devastator, etc). - RESOURCE_CELLS, ///< Cells (used by electro, crylink, vortex, etc) - RESOURCE_PLASMA, ///< Plasma (unused). - RESOURCE_FUEL ///< Fuel (used by jetpack). -}; - const int AMMO_COUNT = 4; // amount of ammo types to show in the inventory panel // item networking @@ -64,21 +44,13 @@ string autocvar_cl_simpleitems_postfix = "_simple"; .vector colormod; void ItemDraw(entity this); -void ItemDrawSimple(entity this); #endif #ifdef SVQC -spawnfunc(item_strength); -spawnfunc(item_invincible); -spawnfunc(item_armor_small); -spawnfunc(item_shells); -spawnfunc(item_bullets); -spawnfunc(item_rockets); float autocvar_sv_simple_items; bool ItemSend(entity this, entity to, int sf); - bool have_pickup_item(entity this); const float ITEM_RESPAWN_TICKS = 10; @@ -89,6 +61,8 @@ const float ITEM_RESPAWN_TICKS = 10; .float max_armorvalue; .float pickup_anyway; +.float item_respawncounter; + void Item_Show (entity e, float mode); void Item_Respawn (entity this); @@ -100,69 +74,16 @@ void Item_ScheduleRespawn(entity e); void Item_ScheduleInitialRespawn(entity e); -/// \brief Converts resource entity property to resource type. -/// \param[in] resource_property Resource entity property to convert. -/// \return Resource type (a RESOURCE_* constant). -int GetResourceType(.float resource_property); - -/// \brief Converts resource type (a RESOURCE_* constant) to entity property. -/// \param[in] resource_type Type of the resource. -/// \return Entity proprty for that resource. -.float GetResourceProperty(int resource_type); - -/// \brief Returns the maximum amount of the given resource. -/// \param[in] resource_type Type of the resource (a RESOURCE_* constant). -/// \return Maximum amount of the given resource. -float GetResourceLimit(int resource_type); - -/// \brief Gives player a resource such as health, armor or ammo. -/// \param[in,out] player Player to give resource to. -/// \param[in] resource_type Type of the resource (a RESOURCE_* constant). -/// \param[in] amount Amount of resource to give. -/// \return No return. -void GivePlayerResource(entity player, int resource_type, float amount); - -/// \brief Gives player a resource such as health, armor or ammo. -/// \param[in,out] player Player to give resource to. -/// \param[in] resource_property Entity property of the resource. -/// \param[in] amount Amount of resource to give. -/// \return No return. -void GivePlayerResourceViaProperty(entity player, .float resource_property, - float amount); - -/// \brief Gives health to the player. -/// \param[in,out] player Player to give health to. -/// \param[in] amount Amount of health to give. -/// \return No return. -void GivePlayerHealth(entity player, float amount); - -/// \brief Gives armor to the player. -/// \param[in,out] player Player to give armor to. -/// \param[in] amount Amount of armor to give. -/// \return No return. -void GivePlayerArmor(entity player, float amount); - -/// \brief Gives fuel to the player. -/// \param[in,out] player Player to give fuel to. -/// \param[in] amount Amount of fuel to give. -/// \return No return. -void GivePlayerFuel(entity player, float amount); - -/// \brief Give several random weapons and ammo to the player. -/// \param[in,out] player Player to give weapons to. +/// \brief Give several random weapons and ammo to the entity. +/// \param[in,out] receiver Entity to give weapons to. /// \param[in] num_weapons Number of weapons to give. /// \param[in] weapon_names Names of weapons to give separated by spaces. -/// \param[in] shells Amount of shells to give with shell-based weapon. -/// \param[in] bullets Amount of bullets to give with bullet-based weapon. -/// \param[in] rockets Amount of rockets to give with rocket-based weapon. -/// \param[in] cells Amount of cells to give with cell-based weapon. -/// \param[in] cells Amount of plasma to give with plasma-based weapon. +/// \param[in] ammo Entity containing the ammo amount for each possible weapon. /// \return No return. -void GivePlayerRandomWeapons(entity player, int num_weapons, - string weapon_names, float shells, float bullets, float rockets, - float cells, float plasma); +void GiveRandomWeapons(entity receiver, int num_weapons, string weapon_names, + entity ammo_entity); -float Item_GiveAmmoTo(entity item, entity player, .float ammotype, float ammomax); +float Item_GiveAmmoTo(entity item, entity player, int resource_type, float ammomax); float Item_GiveTo(entity item, entity player);