]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Reduce name space of resource constants and variables (RESOURCE_* --> RES_*, resour...
authorterencehill <piuntn@gmail.com>
Sun, 3 Feb 2019 18:09:37 +0000 (19:09 +0100)
committerterencehill <piuntn@gmail.com>
Sun, 3 Feb 2019 22:12:47 +0000 (23:12 +0100)
133 files changed:
qcsrc/client/hud/panel/ammo.qc
qcsrc/client/hud/panel/radar.qc
qcsrc/client/hud/panel/weapons.qc
qcsrc/client/miscfunctions.qh
qcsrc/client/resources.qc
qcsrc/client/resources.qh
qcsrc/client/shownames.qc
qcsrc/common/debug.qh
qcsrc/common/ent_cs.qc
qcsrc/common/gamemodes/gamemode/assault/sv_assault.qc
qcsrc/common/gamemodes/gamemode/clanarena/sv_clanarena.qc
qcsrc/common/gamemodes/gamemode/ctf/sv_ctf.qc
qcsrc/common/gamemodes/gamemode/domination/sv_domination.qc
qcsrc/common/gamemodes/gamemode/freezetag/sv_freezetag.qc
qcsrc/common/gamemodes/gamemode/invasion/sv_invasion.qc
qcsrc/common/gamemodes/gamemode/nexball/nexball.qc
qcsrc/common/gamemodes/gamemode/onslaught/cl_controlpoint.qc
qcsrc/common/gamemodes/gamemode/onslaught/cl_generator.qc
qcsrc/common/gamemodes/gamemode/onslaught/onslaught.qc
qcsrc/common/gamemodes/gamemode/onslaught/sv_controlpoint.qc
qcsrc/common/gamemodes/gamemode/onslaught/sv_generator.qc
qcsrc/common/gamemodes/gamemode/onslaught/sv_onslaught.qc
qcsrc/common/items/item/ammo.qh
qcsrc/common/items/item/armor.qh
qcsrc/common/items/item/health.qh
qcsrc/common/items/item/jetpack.qh
qcsrc/common/mapobjects/func/breakable.qc
qcsrc/common/mapobjects/func/button.qc
qcsrc/common/mapobjects/func/door.qc
qcsrc/common/mapobjects/func/door_rotating.qc
qcsrc/common/mapobjects/func/door_secret.qc
qcsrc/common/mapobjects/platforms.qc
qcsrc/common/mapobjects/teleporters.qc
qcsrc/common/mapobjects/trigger/heal.qc
qcsrc/common/mapobjects/trigger/multi.qc
qcsrc/common/mapobjects/trigger/secret.qc
qcsrc/common/mapobjects/trigger/swamp.qc
qcsrc/common/monsters/monster/mage.qc
qcsrc/common/monsters/monster/shambler.qc
qcsrc/common/monsters/monster/spider.qc
qcsrc/common/monsters/monster/wyvern.qc
qcsrc/common/monsters/monster/zombie.qc
qcsrc/common/monsters/sv_monsters.qc
qcsrc/common/mutators/mutator/bloodloss/sv_bloodloss.qc
qcsrc/common/mutators/mutator/buffs/sv_buffs.qc
qcsrc/common/mutators/mutator/campcheck/sv_campcheck.qc
qcsrc/common/mutators/mutator/instagib/items.qh
qcsrc/common/mutators/mutator/instagib/sv_instagib.qc
qcsrc/common/mutators/mutator/invincibleproj/sv_invincibleproj.qc
qcsrc/common/mutators/mutator/nades/nades.qc
qcsrc/common/mutators/mutator/nades/net.qc
qcsrc/common/mutators/mutator/nix/sv_nix.qc
qcsrc/common/mutators/mutator/overkill/okhmg.qh
qcsrc/common/mutators/mutator/overkill/okmachinegun.qh
qcsrc/common/mutators/mutator/overkill/oknex.qh
qcsrc/common/mutators/mutator/overkill/okrpc.qc
qcsrc/common/mutators/mutator/overkill/okrpc.qh
qcsrc/common/mutators/mutator/overkill/okshotgun.qh
qcsrc/common/mutators/mutator/spawn_near_teammate/sv_spawn_near_teammate.qc
qcsrc/common/mutators/mutator/vampire/sv_vampire.qc
qcsrc/common/mutators/mutator/vampirehook/sv_vampirehook.qc
qcsrc/common/mutators/mutator/waypoints/waypointsprites.qc
qcsrc/common/notifications/all.qh
qcsrc/common/physics/player.qc
qcsrc/common/resources.qh
qcsrc/common/t_items.qc
qcsrc/common/t_items.qh
qcsrc/common/turrets/cl_turrets.qc
qcsrc/common/turrets/sv_turrets.qc
qcsrc/common/turrets/turret/ewheel.qc
qcsrc/common/turrets/turret/hk_weapon.qc
qcsrc/common/turrets/turret/walker.qc
qcsrc/common/vehicles/sv_vehicles.qc
qcsrc/common/vehicles/vehicle/bumblebee.qc
qcsrc/common/vehicles/vehicle/racer.qc
qcsrc/common/vehicles/vehicle/raptor.qc
qcsrc/common/vehicles/vehicle/raptor_weapons.qc
qcsrc/common/vehicles/vehicle/spiderbot.qc
qcsrc/common/weapons/all.qc
qcsrc/common/weapons/weapon.qh
qcsrc/common/weapons/weapon/arc.qc
qcsrc/common/weapons/weapon/arc.qh
qcsrc/common/weapons/weapon/blaster.qh
qcsrc/common/weapons/weapon/crylink.qh
qcsrc/common/weapons/weapon/devastator.qc
qcsrc/common/weapons/weapon/devastator.qh
qcsrc/common/weapons/weapon/electro.qc
qcsrc/common/weapons/weapon/electro.qh
qcsrc/common/weapons/weapon/fireball.qc
qcsrc/common/weapons/weapon/fireball.qh
qcsrc/common/weapons/weapon/hagar.qc
qcsrc/common/weapons/weapon/hagar.qh
qcsrc/common/weapons/weapon/hlac.qh
qcsrc/common/weapons/weapon/hook.qc
qcsrc/common/weapons/weapon/hook.qh
qcsrc/common/weapons/weapon/machinegun.qh
qcsrc/common/weapons/weapon/minelayer.qc
qcsrc/common/weapons/weapon/minelayer.qh
qcsrc/common/weapons/weapon/mortar.qc
qcsrc/common/weapons/weapon/mortar.qh
qcsrc/common/weapons/weapon/porto.qh
qcsrc/common/weapons/weapon/rifle.qh
qcsrc/common/weapons/weapon/seeker.qc
qcsrc/common/weapons/weapon/seeker.qh
qcsrc/common/weapons/weapon/shockwave.qh
qcsrc/common/weapons/weapon/shotgun.qh
qcsrc/common/weapons/weapon/vaporizer.qc
qcsrc/common/weapons/weapon/vaporizer.qh
qcsrc/common/weapons/weapon/vortex.qh
qcsrc/server/bot/default/havocbot/havocbot.qc
qcsrc/server/bot/default/havocbot/roles.qc
qcsrc/server/bot/default/navigation.qc
qcsrc/server/bot/default/scripting.qc
qcsrc/server/cheats.qc
qcsrc/server/client.qc
qcsrc/server/command/cmd.qc
qcsrc/server/command/common.qc
qcsrc/server/compat/quake3.qc
qcsrc/server/g_damage.qc
qcsrc/server/g_damage.qh
qcsrc/server/g_hook.qc
qcsrc/server/g_world.qc
qcsrc/server/mapvoting.qc
qcsrc/server/miscfunctions.qc
qcsrc/server/mutators/events.qh
qcsrc/server/player.qc
qcsrc/server/portals.qc
qcsrc/server/resources.qc
qcsrc/server/resources.qh
qcsrc/server/tests.qc
qcsrc/server/weapons/spawning.qc
qcsrc/server/weapons/throwing.qc
qcsrc/server/weapons/weaponsystem.qc

index ce700586caad1efe174acea70a0a85f06b2a0ced..bd9aa1a21ca53afe3837d12bdf1fef3771ac4940 100644 (file)
@@ -23,7 +23,7 @@ void DrawNadeProgressBar(vector myPos, vector mySize, float progress, vector col
 void DrawAmmoItem(vector myPos, vector mySize, int ammoType, bool isCurrent, bool isInfinite)
 {
        TC(bool, isCurrent); TC(bool, isInfinite);
-       if(ammoType == RESOURCE_NONE)
+       if(ammoType == RES_NONE)
                return;
 
        // Initialize variables
@@ -31,7 +31,7 @@ void DrawAmmoItem(vector myPos, vector mySize, int ammoType, bool isCurrent, boo
        int ammo;
        if(autocvar__hud_configure)
        {
-               isCurrent = (ammoType == RESOURCE_ROCKETS); // Rockets always current
+               isCurrent = (ammoType == RES_ROCKETS); // Rockets always current
                ammo = 60;
        }
        else
@@ -183,7 +183,7 @@ void HUD_Ammo()
        {
                if(autocvar__hud_configure)
                {
-                       DrawAmmoItem(pos, ammo_size, RESOURCE_ROCKETS, true, false);
+                       DrawAmmoItem(pos, ammo_size, RES_ROCKETS, true, false);
                }
                else
                {
index cd4551725b3f90ba23440ef1db843a2fadd05f34..592618a027814203e95ede4186e8de110b665286 100644 (file)
@@ -342,7 +342,7 @@ void HUD_Radar()
 
        IL_EACH(g_radaricons, it.teamradar_icon, {
                if ( hud_panel_radar_mouse )
-               if ( GetResourceAmount(it, RESOURCE_HEALTH) >= 0 )
+               if ( GetResourceAmount(it, RES_HEALTH) >= 0 )
                if ( it.team == myteam + 1 || ISGAMETYPE(RACE) || !teamplay )
                {
                        vector coord = teamradar_texcoord_to_2dcoord(teamradar_3dcoord_to_texcoord(it.origin));
index eb3e3b87a35c725adabd748bc4b30a109220733e..3f67787020693ad72e46cde40f0d824dbbdb6b2d 100644 (file)
@@ -490,7 +490,7 @@ void HUD_Weapons()
                        }
 
                        // draw ammo status bar
-                       if(!infinite_ammo && autocvar_hud_panel_weapons_ammo && (it.ammo_type != RESOURCE_NONE))
+                       if(!infinite_ammo && autocvar_hud_panel_weapons_ammo && (it.ammo_type != RES_NONE))
                        {
                                float ammo_full;
                                a = getstati(GetAmmoStat(it.ammo_type)); // how much ammo do we have?
@@ -499,12 +499,12 @@ void HUD_Weapons()
                                {
                                        switch (it.ammo_type)
                                        {
-                                               case RESOURCE_SHELLS:  ammo_full = autocvar_hud_panel_weapons_ammo_full_shells;  break;
-                                               case RESOURCE_BULLETS: ammo_full = autocvar_hud_panel_weapons_ammo_full_nails;   break;
-                                               case RESOURCE_ROCKETS: ammo_full = autocvar_hud_panel_weapons_ammo_full_rockets; break;
-                                               case RESOURCE_CELLS:   ammo_full = autocvar_hud_panel_weapons_ammo_full_cells;   break;
-                                               case RESOURCE_PLASMA:  ammo_full = autocvar_hud_panel_weapons_ammo_full_plasma;  break;
-                                               case RESOURCE_FUEL:    ammo_full = autocvar_hud_panel_weapons_ammo_full_fuel;    break;
+                                               case RES_SHELLS:  ammo_full = autocvar_hud_panel_weapons_ammo_full_shells;  break;
+                                               case RES_BULLETS: ammo_full = autocvar_hud_panel_weapons_ammo_full_nails;   break;
+                                               case RES_ROCKETS: ammo_full = autocvar_hud_panel_weapons_ammo_full_rockets; break;
+                                               case RES_CELLS:   ammo_full = autocvar_hud_panel_weapons_ammo_full_cells;   break;
+                                               case RES_PLASMA:  ammo_full = autocvar_hud_panel_weapons_ammo_full_plasma;  break;
+                                               case RES_FUEL:    ammo_full = autocvar_hud_panel_weapons_ammo_full_fuel;    break;
                                                default: ammo_full = 60;
                                        }
 
index ecfb0b295a8f0544e3f5f3aa7e0239bbc79efd23..a504baca8b606ffbd9c3f132a16d3fd6d72dd01f 100644 (file)
@@ -34,7 +34,7 @@ float PreviewExists(string name);
 vector Rotate(vector v, float a);
 
 
-#define IS_DEAD(s) (((s).classname == "csqcmodel") ? (s).csqcmodel_isdead : (GetResourceAmount((s), RESOURCE_HEALTH) <= 0))
+#define IS_DEAD(s) (((s).classname == "csqcmodel") ? (s).csqcmodel_isdead : (GetResourceAmount((s), RES_HEALTH) <= 0))
 
 
 // decolorizes and team colors the player name when needed
index 3685e9ac81ae984ebd94035577161427dfe1449c..8b21fe0cb31724169d8695f50a5672466b46a029 100644 (file)
@@ -5,72 +5,68 @@
 /// \brief Source file that contains implementation of the resource system.
 /// \copyright GNU GPLv2 or any later version.
 
-float GetResourceAmount(entity e, int resource_type)
+float GetResourceAmount(entity e, int res_type)
 {
-       .float resource_field = GetResourceField(resource_type);
-       return e.(resource_field);
+       return e.(GetResourceField(res_type));
 }
 
-void SetResourceAmount(entity e, int resource_type, float amount)
+void SetResourceAmount(entity e, int res_type, float amount)
 {
-       .float resource_field = GetResourceField(resource_type);
-       e.(resource_field) = amount;
+       e.(GetResourceField(res_type)) = amount;
 }
 
-void TakeResource(entity receiver, int resource_type, float amount)
+void TakeResource(entity receiver, int res_type, float amount)
 {
        if (amount == 0)
        {
                return;
        }
-       SetResourceAmount(receiver, resource_type,
-               GetResourceAmount(receiver, resource_type) - amount);
+       SetResourceAmount(receiver, res_type, GetResourceAmount(receiver, res_type) - amount);
 }
 
-void TakeResourceWithLimit(entity receiver, int resource_type, float amount,
-       float limit)
+void TakeResourceWithLimit(entity receiver, int res_type, float amount, float limit)
 {
        if (amount == 0)
        {
                return;
        }
-       float current_amount = GetResourceAmount(receiver, resource_type);
+       float current_amount = GetResourceAmount(receiver, res_type);
        if (current_amount - amount < limit)
        {
                amount = limit + current_amount;
        }
-       TakeResource(receiver, resource_type, amount);
+       TakeResource(receiver, res_type, amount);
 }
 
-int GetResourceType(.float resource_field)
+int GetResourceType(.float res_field)
 {
-       switch (resource_field)
+       switch (res_field)
        {
-               case health: { return RESOURCE_HEALTH; }
-               case armorvalue: { return RESOURCE_ARMOR; }
-               case ammo_shells: { return RESOURCE_SHELLS; }
-               case ammo_nails: { return RESOURCE_BULLETS; }
-               case ammo_rockets: { return RESOURCE_ROCKETS; }
-               case ammo_cells: { return RESOURCE_CELLS; }
-               case ammo_plasma: { return RESOURCE_PLASMA; }
-               case ammo_fuel: { return RESOURCE_FUEL; }
+               case health: { return RES_HEALTH; }
+               case armorvalue: { return RES_ARMOR; }
+               case ammo_shells: { return RES_SHELLS; }
+               case ammo_nails: { return RES_BULLETS; }
+               case ammo_rockets: { return RES_ROCKETS; }
+               case ammo_cells: { return RES_CELLS; }
+               case ammo_plasma: { return RES_PLASMA; }
+               case ammo_fuel: { return RES_FUEL; }
        }
        error("GetResourceType: Invalid field.");
        return 0;
 }
 
-.float GetResourceField(int resource_type)
+.float GetResourceField(int res_type)
 {
-       switch (resource_type)
+       switch (res_type)
        {
-               case RESOURCE_HEALTH: { return health; }
-               case RESOURCE_ARMOR: { return armorvalue; }
-               case RESOURCE_SHELLS: { return ammo_shells; }
-               case RESOURCE_BULLETS: { return ammo_nails; }
-               case RESOURCE_ROCKETS: { return ammo_rockets; }
-               case RESOURCE_CELLS: { return ammo_cells; }
-               case RESOURCE_PLASMA: { return ammo_plasma; }
-               case RESOURCE_FUEL: { return ammo_fuel; }
+               case RES_HEALTH: { return health; }
+               case RES_ARMOR: { return armorvalue; }
+               case RES_SHELLS: { return ammo_shells; }
+               case RES_BULLETS: { return ammo_nails; }
+               case RES_ROCKETS: { return ammo_rockets; }
+               case RES_CELLS: { return ammo_cells; }
+               case RES_PLASMA: { return ammo_plasma; }
+               case RES_FUEL: { return ammo_fuel; }
        }
        error("GetResourceField: Invalid resource type.");
        return health;
index 4f57a2f3c01524fb13595f9a0818720bc17877d1..1140b0576eca9f05d43faad42f6cfc85f46aca63 100644 (file)
 
 /// \brief Returns the current amount of resource the given entity has.
 /// \param[in] e Entity to check.
-/// \param[in] resource_type Type of the resource (a RESOURCE_* constant).
+/// \param[in] res_type Type of the resource (a RES_* constant).
 /// \return Current amount of resource the given entity has.
-float GetResourceAmount(entity e, int resource_type);
+float GetResourceAmount(entity e, int res_type);
 
 /// \brief Sets the current amount of resource the given entity will have.
 /// \param[in,out] e Entity to adjust.
-/// \param[in] resource_type Type of the resource (a RESOURCE_* constant).
+/// \param[in] res_type Type of the resource (a RES_* constant).
 /// \param[in] amount Amount of resource to set.
 /// \return No return.
-void SetResourceAmount(entity e, int resource_type, float amount);
+void SetResourceAmount(entity e, int res_type, float amount);
 
 /// \brief Takes an entity some resource.
 /// \param[in,out] receiver Entity to take resource from.
-/// \param[in] resource_type Type of the resource (a RESOURCE_* constant).
+/// \param[in] res_type Type of the resource (a RES_* constant).
 /// \param[in] amount Amount of resource to take.
 /// \return No return.
-void TakeResource(entity receiver, int resource_type, float amount);
+void TakeResource(entity receiver, int res_type, float amount);
 
 /// \brief Takes an entity some resource but not less than a limit.
 /// \param[in,out] receiver Entity to take resource from.
-/// \param[in] resource_type Type of the resource (a RESOURCE_* constant).
+/// \param[in] res_type Type of the resource (a RES_* constant).
 /// \param[in] amount Amount of resource to take.
 /// \param[in] limit Limit of resources to take.
 /// \return No return.
-void TakeResourceWithLimit(entity receiver, int resource_type, float amount,
-       float limit);
+void TakeResourceWithLimit(entity receiver, int res_type, float amount, float limit);
 
 // ===================== Legacy and/or internal API ===========================
 
 /// \brief Converts an entity field to resource type.
-/// \param[in] resource_field Entity field to convert.
-/// \return Resource type (a RESOURCE_* constant).
-int GetResourceType(.float resource_field);
+/// \param[in] res_field Entity field to convert.
+/// \return Resource type (a RES_* constant).
+int GetResourceType(.float res_field);
 
-/// \brief Converts resource type (a RESOURCE_* constant) to entity field.
-/// \param[in] resource_type Type of the resource.
+/// \brief Converts resource type (a RES_* constant) to entity field.
+/// \param[in] res_type Type of the resource.
 /// \return Entity field for that resource.
-.float GetResourceField(int resource_type);
+.float GetResourceField(int res_type);
 
 /// \brief Legacy fields for the resources. To be removed.
 .float health;
index 994ec72e48deb44d48528c0d9d9db41628b6eb9b..ff28ead405c9507a10f6981107e1a30b8e019765 100644 (file)
@@ -170,10 +170,10 @@ void Draw_ShowNames(entity this)
                                        this.healthvalue / autocvar_hud_panel_healtharmor_maxhealth, false, 1, '1 0 0', a,
                                        DRAWFLAG_NORMAL);
                        }
-                       if (GetResourceAmount(this, RESOURCE_ARMOR) > 0)
+                       if (GetResourceAmount(this, RES_ARMOR) > 0)
                        {
                                HUD_Panel_DrawProgressBar(pos + eX * 0.5 * mySize.x, sz, "nametag_statusbar",
-                                       GetResourceAmount(this, RESOURCE_ARMOR) / autocvar_hud_panel_healtharmor_maxarmor, false, 0, '0 1 0', a,
+                                       GetResourceAmount(this, RES_ARMOR) / autocvar_hud_panel_healtharmor_maxarmor, false, 0, '0 1 0', a,
                                        DRAWFLAG_NORMAL);
                        }
                }
@@ -206,13 +206,13 @@ void Draw_ShowNames_All()
                if (entcs.m_entcs_private)
                {
                        it.healthvalue = entcs.healthvalue;
-                       SetResourceAmount(it, RESOURCE_ARMOR, GetResourceAmount(entcs, RESOURCE_ARMOR));
+                       SetResourceAmount(it, RES_ARMOR, GetResourceAmount(entcs, RES_ARMOR));
                        it.sameteam = true;
                }
                else
                {
                        it.healthvalue = 0;
-                       SetResourceAmount(it, RESOURCE_ARMOR, 0);
+                       SetResourceAmount(it, RES_ARMOR, 0);
                        it.sameteam = false;
                }
                bool dead = entcs_IsDead(i) || entcs_IsSpectating(i);
index 583e626af72fa73e90993f78208964090a47b65e..a5db952468eb8ef93816f5b78c87859f7b374caa 100644 (file)
@@ -407,7 +407,7 @@ CLASS(DebugText3d, Object)
                CONSTRUCT(DebugText3d);
                this.origin = pos;
                this.message = strzone(msg);
-               SetResourceAmount(this, RESOURCE_HEALTH, align);
+               SetResourceAmount(this, RES_HEALTH, align);
                this.hit_time = time;
                this.fade_rate = fade_rate_;
                this.velocity = vel;
@@ -432,7 +432,7 @@ CLASS(DebugText3d, Object)
                if (screen_pos.z < 0) return; // behind camera
 
                screen_pos.z = 0;
-               float align = GetResourceAmount(this, RESOURCE_HEALTH);
+               float align = GetResourceAmount(this, RES_HEALTH);
                string msg;
                vector msg_pos;
 
index 0c430e26cdb4eb677486070f70dee195af5ab6f3..8eb959f4adf6498bf6d325ae967ff84b0eb6749b 100644 (file)
@@ -117,13 +117,13 @@ ENTCS_PROP_CODED(ANGLES, false, angles_y, ENTCS_SET_NORMAL, DEC_FACTOR,
 
 // FIXME: use a better scale?
 #define DEC_FACTOR 10
-ENTCS_PROP_RESOURCE(HEALTH, false, RESOURCE_HEALTH, ENTCS_SET_NORMAL, DEC_FACTOR,
-       { WriteByte(chan, bound(0, GetResourceAmount(ent, RESOURCE_HEALTH) / DEC_FACTOR, 255)); },
+ENTCS_PROP_RESOURCE(HEALTH, false, RES_HEALTH, ENTCS_SET_NORMAL, DEC_FACTOR,
+       { WriteByte(chan, bound(0, GetResourceAmount(ent, RES_HEALTH) / DEC_FACTOR, 255)); },
        { ent.healthvalue = ReadByte() * DEC_FACTOR; })
 
-ENTCS_PROP_RESOURCE(ARMOR, false, RESOURCE_ARMOR, ENTCS_SET_NORMAL, DEC_FACTOR,
-       { WriteByte(chan, bound(0, GetResourceAmount(ent, RESOURCE_ARMOR) / DEC_FACTOR, 255)); },
-       { SetResourceAmount(ent, RESOURCE_ARMOR, ReadByte() * DEC_FACTOR); })
+ENTCS_PROP_RESOURCE(ARMOR, false, RES_ARMOR, ENTCS_SET_NORMAL, DEC_FACTOR,
+       { WriteByte(chan, bound(0, GetResourceAmount(ent, RES_ARMOR) / DEC_FACTOR, 255)); },
+       { SetResourceAmount(ent, RES_ARMOR, ReadByte() * DEC_FACTOR); })
 #undef DEC_FACTOR
 
 ENTCS_PROP(NAME, true, netname, ENTCS_SET_MUTABLE_STRING,
index c3ef2db96f1fb551c87f3f0659cf3d821a37f2fe..72a4d23a8c602deecf8591c97ff6abbd1a4b62e7 100644 (file)
@@ -17,7 +17,7 @@ STATIC_INIT(g_assault)
 void assault_objective_use(entity this, entity actor, entity trigger)
 {
        // activate objective
-       SetResourceAmount(this, RESOURCE_HEALTH, 100);
+       SetResourceAmount(this, RES_HEALTH, 100);
        //print("^2Activated objective ", this.targetname, "=", etos(this), "\n");
        //print("Activator is ", actor.classname, "\n");
 
@@ -29,7 +29,7 @@ void assault_objective_use(entity this, entity actor, entity trigger)
 
 vector target_objective_spawn_evalfunc(entity this, entity player, entity spot, vector current)
 {
-       float hlth = GetResourceAmount(this, RESOURCE_HEALTH);
+       float hlth = GetResourceAmount(this, RES_HEALTH);
        if (hlth < 0 || hlth >= ASSAULT_VALUE_INACTIVE)
                return '-1 0 0';
        return current;
@@ -39,7 +39,7 @@ vector target_objective_spawn_evalfunc(entity this, entity player, entity spot,
 // and when a new round starts
 void assault_objective_reset(entity this)
 {
-       SetResourceAmount(this, RESOURCE_HEALTH, ASSAULT_VALUE_INACTIVE);
+       SetResourceAmount(this, RES_HEALTH, ASSAULT_VALUE_INACTIVE);
 }
 
 // decrease the health of targeted objectives
@@ -60,19 +60,19 @@ void assault_objective_decrease_use(entity this, entity actor, entity trigger)
        else
                return; // already activated! cannot activate again!
 
-       float hlth = GetResourceAmount(this.enemy, RESOURCE_HEALTH);
+       float hlth = GetResourceAmount(this.enemy, RES_HEALTH);
        if (hlth < ASSAULT_VALUE_INACTIVE)
        {
                if (hlth - this.dmg > 0.5)
                {
                        GameRules_scoring_add_team(actor, SCORE, this.dmg);
-                       TakeResource(this.enemy, RESOURCE_HEALTH, this.dmg);
+                       TakeResource(this.enemy, RES_HEALTH, this.dmg);
                }
                else
                {
                        GameRules_scoring_add_team(actor, SCORE, hlth);
                        GameRules_scoring_add_team(actor, ASSAULT_OBJECTIVES, 1);
-                       SetResourceAmount(this.enemy, RESOURCE_HEALTH, -1);
+                       SetResourceAmount(this.enemy, RES_HEALTH, -1);
 
                        if(this.enemy.message)
                                FOREACH_CLIENT(IS_PLAYER(it), { centerprint(it, this.enemy.message); });
@@ -99,7 +99,7 @@ void assault_setenemytoobjective(entity this)
 
 bool assault_decreaser_sprite_visible(entity this, entity player, entity view)
 {
-       if(GetResourceAmount(this.assault_decreaser.enemy, RESOURCE_HEALTH) >= ASSAULT_VALUE_INACTIVE)
+       if(GetResourceAmount(this.assault_decreaser.enemy, RES_HEALTH) >= ASSAULT_VALUE_INACTIVE)
                return false;
 
        return true;
@@ -127,7 +127,7 @@ void target_objective_decrease_activate(entity this)
                {
                        WaypointSprite_UpdateSprites(spr, WP_AssaultDefend, WP_AssaultDestroy, WP_AssaultDestroy);
                        WaypointSprite_UpdateMaxHealth(spr, it.max_health);
-                       WaypointSprite_UpdateHealth(spr, GetResourceAmount(it, RESOURCE_HEALTH));
+                       WaypointSprite_UpdateHealth(spr, GetResourceAmount(it, RES_HEALTH));
                        it.sprite = spr;
                }
                else
@@ -176,7 +176,7 @@ void assault_roundstart_use_this(entity this)
 
 void assault_wall_think(entity this)
 {
-       if(GetResourceAmount(this.enemy, RESOURCE_HEALTH) < 0)
+       if(GetResourceAmount(this.enemy, RES_HEALTH) < 0)
        {
                this.model = "";
                this.solid = SOLID_NOT;
@@ -323,7 +323,7 @@ spawnfunc(target_objective_decrease)
                this.dmg = 101;
 
        this.use = assault_objective_decrease_use;
-       SetResourceAmount(this, RESOURCE_HEALTH, ASSAULT_VALUE_INACTIVE);
+       SetResourceAmount(this, RES_HEALTH, ASSAULT_VALUE_INACTIVE);
        this.max_health = ASSAULT_VALUE_INACTIVE;
        this.enemy = NULL;
 
@@ -333,15 +333,15 @@ spawnfunc(target_objective_decrease)
 // destructible walls that can be used to trigger target_objective_decrease
 bool destructible_heal(entity targ, entity inflictor, float amount, float limit)
 {
-       float true_limit = ((limit != RESOURCE_LIMIT_NONE) ? limit : targ.max_health);
-       float hlth = GetResourceAmount(targ, RESOURCE_HEALTH);
+       float true_limit = ((limit != RES_LIMIT_NONE) ? limit : targ.max_health);
+       float hlth = GetResourceAmount(targ, RES_HEALTH);
        if (hlth <= 0 || hlth >= true_limit)
                return false;
 
-       GiveResourceWithLimit(targ, RESOURCE_HEALTH, amount, true_limit);
+       GiveResourceWithLimit(targ, RES_HEALTH, amount, true_limit);
        if(targ.sprite)
        {
-               WaypointSprite_UpdateHealth(targ.sprite, GetResourceAmount(targ, RESOURCE_HEALTH));
+               WaypointSprite_UpdateHealth(targ.sprite, GetResourceAmount(targ, RES_HEALTH));
        }
        func_breakable_colormod(targ);
        return true;
@@ -412,7 +412,7 @@ void havocbot_goalrating_ast_targets(entity this, float ratingscale)
                entity destr = it;
                IL_EACH(g_assault_objectivedecreasers, it.targetname == destr.target,
                {
-                       float hlth = GetResourceAmount(it.enemy, RESOURCE_HEALTH);
+                       float hlth = GetResourceAmount(it.enemy, RES_HEALTH);
                        if (hlth > 0 && hlth < ASSAULT_VALUE_INACTIVE)
                        {
                                found = true;
index 73bb3cfe4cccc14def3246101a0149be66fe23e7..95ab0ec50c2c16d73eae09585337e4c2e913e313 100644 (file)
@@ -380,8 +380,8 @@ MUTATOR_HOOKFUNCTION(ca, PlayerDamage_SplitHealthArmor)
        entity frag_attacker = M_ARGV(1, entity);
        entity frag_target = M_ARGV(2, entity);
        float frag_damage = M_ARGV(7, float);
-       float damage_take = bound(0, M_ARGV(4, float), GetResourceAmount(frag_target, RESOURCE_HEALTH));
-       float damage_save = bound(0, M_ARGV(5, float), GetResourceAmount(frag_target, RESOURCE_ARMOR));
+       float damage_take = bound(0, M_ARGV(4, float), GetResourceAmount(frag_target, RES_HEALTH));
+       float damage_save = bound(0, M_ARGV(5, float), GetResourceAmount(frag_target, RES_ARMOR));
 
        float excess = max(0, frag_damage - damage_take - damage_save);
 
index 09a46312305e5c8563b5eeb1c9315d1c458ade4a..84fcadda3a929e07e271f5426f9c6341343e6da1 100644 (file)
@@ -145,7 +145,7 @@ void ctf_FlagcarrierWaypoints(entity player)
 {
        WaypointSprite_Spawn(WP_FlagCarrier, 0, 0, player, FLAG_WAYPOINT_OFFSET, NULL, player.team, player, wps_flagcarrier, true, RADARICON_FLAG);
        WaypointSprite_UpdateMaxHealth(player.wps_flagcarrier, 2 * healtharmor_maxdamage(start_health, start_armorvalue, autocvar_g_balance_armor_blockpercent, DEATH_WEAPON.m_id).x);
-       WaypointSprite_UpdateHealth(player.wps_flagcarrier, healtharmor_maxdamage(GetResourceAmount(player, RESOURCE_HEALTH), GetResourceAmount(player, RESOURCE_ARMOR), autocvar_g_balance_armor_blockpercent, DEATH_WEAPON.m_id).x);
+       WaypointSprite_UpdateHealth(player.wps_flagcarrier, healtharmor_maxdamage(GetResourceAmount(player, RES_HEALTH), GetResourceAmount(player, RES_ARMOR), autocvar_g_balance_armor_blockpercent, DEATH_WEAPON.m_id).x);
        WaypointSprite_UpdateTeamRadar(player.wps_flagcarrier, RADARICON_FLAGCARRIER, WPCOLOR_FLAGCARRIER(player.team));
 
        if(player.flagcarried && CTF_SAMETEAM(player, player.flagcarried))
@@ -341,7 +341,7 @@ void ctf_Handle_Drop(entity flag, entity player, int droptype)
        set_movetype(flag, MOVETYPE_TOSS);
        flag.takedamage = DAMAGE_YES;
        flag.angles = '0 0 0';
-       SetResourceAmount(flag, RESOURCE_HEALTH, flag.max_flag_health);
+       SetResourceAmount(flag, RES_HEALTH, flag.max_flag_health);
        flag.ctf_droptime = time;
        flag.ctf_dropper = player;
        flag.ctf_status = FLAG_DROPPED;
@@ -364,7 +364,7 @@ void ctf_Handle_Drop(entity flag, entity player, int droptype)
        if(autocvar_g_ctf_flag_return_time || (autocvar_g_ctf_flag_return_damage && autocvar_g_ctf_flag_health))
        {
                WaypointSprite_UpdateMaxHealth(flag.wps_flagdropped, flag.max_flag_health);
-               WaypointSprite_UpdateHealth(flag.wps_flagdropped, GetResourceAmount(flag, RESOURCE_HEALTH));
+               WaypointSprite_UpdateHealth(flag.wps_flagdropped, GetResourceAmount(flag, RES_HEALTH));
        }
 
        player.throw_antispam = time + autocvar_g_ctf_pass_wait;
@@ -679,7 +679,7 @@ void ctf_Handle_Pickup(entity flag, entity player, int pickuptype)
        switch(pickuptype)
        {
                case PICKUP_BASE: flag.ctf_pickuptime = time; break; // used for timing runs
-               case PICKUP_DROPPED: SetResourceAmount(flag, RESOURCE_HEALTH, flag.max_flag_health); break; // reset health/return timelimit
+               case PICKUP_DROPPED: SetResourceAmount(flag, RES_HEALTH, flag.max_flag_health); break; // reset health/return timelimit
                default: break;
        }
 
@@ -763,9 +763,9 @@ void ctf_CheckFlagReturn(entity flag, int returntype)
 {
        if((flag.ctf_status == FLAG_DROPPED) || (flag.ctf_status == FLAG_PASSING))
        {
-               if(flag.wps_flagdropped) { WaypointSprite_UpdateHealth(flag.wps_flagdropped, GetResourceAmount(flag, RESOURCE_HEALTH)); }
+               if(flag.wps_flagdropped) { WaypointSprite_UpdateHealth(flag.wps_flagdropped, GetResourceAmount(flag, RES_HEALTH)); }
 
-               if((GetResourceAmount(flag, RESOURCE_HEALTH) <= 0) || (time >= flag.ctf_droptime + autocvar_g_ctf_flag_return_time))
+               if((GetResourceAmount(flag, RES_HEALTH) <= 0) || (time >= flag.ctf_droptime + autocvar_g_ctf_flag_return_time))
                {
                        switch(returntype)
                        {
@@ -876,7 +876,7 @@ void ctf_FlagDamage(entity this, entity inflictor, entity attacker, float damage
                        this.ctf_flagdamaged_byworld = true;
                else
                {
-                       SetResourceAmount(this, RESOURCE_HEALTH, 0);
+                       SetResourceAmount(this, RES_HEALTH, 0);
                        ctf_CheckFlagReturn(this, RETURN_NEEDKILL);
                }
                return;
@@ -884,7 +884,7 @@ void ctf_FlagDamage(entity this, entity inflictor, entity attacker, float damage
        if(autocvar_g_ctf_flag_return_damage)
        {
                // reduce health and check if it should be returned
-               TakeResource(this, RESOURCE_HEALTH, damage);
+               TakeResource(this, RES_HEALTH, damage);
                ctf_CheckFlagReturn(this, RETURN_DAMAGE);
                return;
        }
@@ -947,20 +947,20 @@ void ctf_FlagThink(entity this)
                        {
                                if((vdist(this.origin - this.ctf_spawnorigin, <=, autocvar_g_ctf_flag_return_dropped)) || (autocvar_g_ctf_flag_return_dropped == -1))
                                {
-                                       SetResourceAmount(this, RESOURCE_HEALTH, 0);
+                                       SetResourceAmount(this, RES_HEALTH, 0);
                                        ctf_CheckFlagReturn(this, RETURN_DROPPED);
                                        return;
                                }
                        }
                        if(this.ctf_flagdamaged_byworld)
                        {
-                               TakeResource(this, RESOURCE_HEALTH, ((this.max_flag_health / autocvar_g_ctf_flag_return_damage_delay) * FLAG_THINKRATE));
+                               TakeResource(this, RES_HEALTH, ((this.max_flag_health / autocvar_g_ctf_flag_return_damage_delay) * FLAG_THINKRATE));
                                ctf_CheckFlagReturn(this, RETURN_NEEDKILL);
                                return;
                        }
                        else if(autocvar_g_ctf_flag_return_time)
                        {
-                               TakeResource(this, RESOURCE_HEALTH, ((this.max_flag_health / autocvar_g_ctf_flag_return_time) * FLAG_THINKRATE));
+                               TakeResource(this, RES_HEALTH, ((this.max_flag_health / autocvar_g_ctf_flag_return_time) * FLAG_THINKRATE));
                                ctf_CheckFlagReturn(this, RETURN_TIMEOUT);
                                return;
                        }
@@ -971,7 +971,7 @@ void ctf_FlagThink(entity this)
                {
                        if(this.speedrunning && ctf_captimerecord && (time >= this.ctf_pickuptime + ctf_captimerecord))
                        {
-                               SetResourceAmount(this, RESOURCE_HEALTH, 0);
+                               SetResourceAmount(this, RES_HEALTH, 0);
                                ctf_CheckFlagReturn(this, RETURN_SPEEDRUN);
 
                                CS(this.owner).impulse = CHIMPULSE_SPEEDRUN.impulse; // move the player back to the waypoint they set
@@ -1040,7 +1040,7 @@ METHOD(Flag, giveTo, bool(Flag this, entity flag, entity toucher))
        {
                if(!autocvar_g_ctf_flag_return_damage_delay)
                {
-                       SetResourceAmount(flag, RESOURCE_HEALTH, 0);
+                       SetResourceAmount(flag, RES_HEALTH, 0);
                        ctf_CheckFlagReturn(flag, RETURN_NEEDKILL);
                }
                if(!flag.ctf_flagdamaged_byworld) { return; }
@@ -1164,7 +1164,7 @@ void ctf_RespawnFlag(entity flag)
 
        set_movetype(flag, ((flag.noalign) ? MOVETYPE_NONE : MOVETYPE_TOSS));
        flag.takedamage = DAMAGE_NO;
-       SetResourceAmount(flag, RESOURCE_HEALTH, flag.max_flag_health);
+       SetResourceAmount(flag, RES_HEALTH, flag.max_flag_health);
        flag.solid = SOLID_TRIGGER;
        flag.velocity = '0 0 0';
        flag.angles = flag.mangle;
@@ -1251,7 +1251,7 @@ void ctf_FlagSetup(int teamnumber, entity flag) // called when spawning a flag e
        flag.takedamage = DAMAGE_NO;
        flag.damageforcescale = autocvar_g_ctf_flag_damageforcescale;
        flag.max_flag_health = ((autocvar_g_ctf_flag_return_damage && autocvar_g_ctf_flag_health) ? autocvar_g_ctf_flag_health : 100);
-       SetResourceAmount(flag, RESOURCE_HEALTH, flag.max_flag_health);
+       SetResourceAmount(flag, RES_HEALTH, flag.max_flag_health);
        flag.event_damage = ctf_FlagDamage;
        flag.pushable = true;
        flag.teleportable = TELEPORT_NORMAL;
@@ -1521,7 +1521,7 @@ void havocbot_goalrating_ctf_enemyflag(entity this, float ratingscale)
                {
                        // adjust rating of our flag carrier depending on his health
                        head = head.tag_entity;
-                       float f = bound(0, (GetResourceAmount(head, RESOURCE_HEALTH) + GetResourceAmount(head, RESOURCE_ARMOR)) / 100, 2) - 1;
+                       float f = bound(0, (GetResourceAmount(head, RES_HEALTH) + GetResourceAmount(head, RES_ARMOR)) / 100, 2) - 1;
                        ratingscale += ratingscale * f * 0.1;
                }
                navigation_routerating(this, head, ratingscale, 10000);
@@ -2168,7 +2168,7 @@ MUTATOR_HOOKFUNCTION(ctf, PlayerPreThink)
 
        // update the health of the flag carrier waypointsprite
        if(player.wps_flagcarrier)
-               WaypointSprite_UpdateHealth(player.wps_flagcarrier, healtharmor_maxdamage(GetResourceAmount(player, RESOURCE_HEALTH), GetResourceAmount(player, RESOURCE_ARMOR), autocvar_g_balance_armor_blockpercent, DEATH_WEAPON.m_id).x);
+               WaypointSprite_UpdateHealth(player.wps_flagcarrier, healtharmor_maxdamage(GetResourceAmount(player, RES_HEALTH), GetResourceAmount(player, RES_ARMOR), autocvar_g_balance_armor_blockpercent, DEATH_WEAPON.m_id).x);
 }
 
 MUTATOR_HOOKFUNCTION(ctf, Damage_Calculate) // for changing damage and force values that are applied to players in g_damage.qc
@@ -2196,7 +2196,7 @@ MUTATOR_HOOKFUNCTION(ctf, Damage_Calculate) // for changing damage and force val
        }
        else if(frag_target.flagcarried && !IS_DEAD(frag_target) && CTF_DIFFTEAM(frag_target, frag_attacker)) // if the target is a flagcarrier
        {
-               if(autocvar_g_ctf_flagcarrier_auto_helpme_damage > healtharmor_maxdamage(GetResourceAmount(frag_target, RESOURCE_HEALTH), GetResourceAmount(frag_target, RESOURCE_ARMOR), autocvar_g_balance_armor_blockpercent, DEATH_WEAPON.m_id).x
+               if(autocvar_g_ctf_flagcarrier_auto_helpme_damage > healtharmor_maxdamage(GetResourceAmount(frag_target, RES_HEALTH), GetResourceAmount(frag_target, RES_ARMOR), autocvar_g_balance_armor_blockpercent, DEATH_WEAPON.m_id).x
                        && time > frag_target.wps_helpme_time + autocvar_g_ctf_flagcarrier_auto_helpme_time)
                {
                        frag_target.wps_helpme_time = time;
index 50e16d53e076edb0a740aa7b1af934a0266501f3..e8c75d6d0f1cac24a0ce0aa0a0f65f381ccf5198 100644 (file)
@@ -190,7 +190,7 @@ void dompointtouch(entity this, entity toucher)
 {
        if(!IS_PLAYER(toucher))
                return;
-       if(GetResourceAmount(toucher, RESOURCE_HEALTH) < 1)
+       if(GetResourceAmount(toucher, RES_HEALTH) < 1)
                return;
 
        if(round_handler_IsActive() && !round_handler_IsRoundStarted())
index 0fae48b72b3ff2e7c7d031cba08fea1a4bc3ddb9..fd38377db63cf875558ee7af5ff0d7bc751c5ee1 100644 (file)
@@ -19,7 +19,7 @@ void freezetag_count_alive_players()
        FOREACH_CLIENT(IS_PLAYER(it) && Entity_HasValidTeam(it),
        {
                ++total_players;
-               if (GetResourceAmount(it, RESOURCE_HEALTH) < 1 || STAT(FROZEN, it) == FROZEN_NORMAL)
+               if (GetResourceAmount(it, RES_HEALTH) < 1 || STAT(FROZEN, it) == FROZEN_NORMAL)
                {
                        continue;
                }
@@ -152,7 +152,7 @@ entity freezetag_LastPlayerForTeam(entity this)
 {
        entity last_pl = NULL;
        FOREACH_CLIENT(IS_PLAYER(it) && it != this && SAME_TEAM(it, this), {
-               if (STAT(FROZEN, it) != FROZEN_NORMAL && GetResourceAmount(it, RESOURCE_HEALTH) >= 1)
+               if (STAT(FROZEN, it) != FROZEN_NORMAL && GetResourceAmount(it, RES_HEALTH) >= 1)
                {
                        if (!last_pl)
                                last_pl = it;
@@ -235,7 +235,7 @@ void havocbot_goalrating_ft_freeplayers(entity this, float ratingscale, vector o
                        navigation_routerating(this, it, ratingscale, 2000);
                }
                else if (best_dist2
-                       && GetResourceAmount(it, RESOURCE_HEALTH) < GetResourceAmount(this, RESOURCE_HEALTH) + 30
+                       && GetResourceAmount(it, RES_HEALTH) < GetResourceAmount(this, RES_HEALTH) + 30
                        && vlen2(it.origin - org) < best_dist2)
                {
                        // If teamate is not frozen still seek them out as fight better
@@ -330,7 +330,7 @@ void ft_RemovePlayer(entity this)
                freezetag_LastPlayerForTeam_Notify(this);
        Unfreeze(this, false);
 
-       SetResourceAmount(this, RESOURCE_HEALTH, 0); // neccessary to correctly count alive players
+       SetResourceAmount(this, RES_HEALTH, 0); // neccessary to correctly count alive players
        freezetag_count_alive_players();
 }
 
@@ -502,7 +502,7 @@ MUTATOR_HOOKFUNCTION(ft, PlayerPreThink, CBC_ORDER_FIRST)
                if (STAT(FROZEN, player) == FROZEN_NORMAL)
                {
                        STAT(REVIVE_PROGRESS, player) = bound(0, STAT(REVIVE_PROGRESS, player) - frametime * autocvar_g_freezetag_revive_clearspeed, 1);
-                       SetResourceAmount(player, RESOURCE_HEALTH, max(1, STAT(REVIVE_PROGRESS, player) * ((warmup_stage) ? warmup_start_health : start_health)));
+                       SetResourceAmount(player, RES_HEALTH, max(1, STAT(REVIVE_PROGRESS, player) * ((warmup_stage) ? warmup_start_health : start_health)));
                }
                else if (!STAT(FROZEN, player))
                        STAT(REVIVE_PROGRESS, player) = 0; // thawing nobody
@@ -510,7 +510,7 @@ MUTATOR_HOOKFUNCTION(ft, PlayerPreThink, CBC_ORDER_FIRST)
        else if (STAT(FROZEN, player) == FROZEN_NORMAL) // OK, there is at least one teammate reviving us
        {
                STAT(REVIVE_PROGRESS, player) = bound(0, STAT(REVIVE_PROGRESS, player) + frametime * max(1/60, autocvar_g_freezetag_revive_speed), 1);
-               SetResourceAmount(player, RESOURCE_HEALTH, max(1, STAT(REVIVE_PROGRESS, player) * ((warmup_stage) ? warmup_start_health : start_health)));
+               SetResourceAmount(player, RES_HEALTH, max(1, STAT(REVIVE_PROGRESS, player) * ((warmup_stage) ? warmup_start_health : start_health)));
 
                if(STAT(REVIVE_PROGRESS, player) >= 1)
                {
@@ -603,7 +603,7 @@ MUTATOR_HOOKFUNCTION(ft, FragCenterMessage)
 
        Send_Notification(NOTIF_ONE, frag_attacker, MSG_CHOICE, CHOICE_FRAG_FREEZE, frag_target.netname, kill_count_to_attacker, (IS_BOT_CLIENT(frag_target) ? -1 : CS(frag_target).ping));
        Send_Notification(NOTIF_ONE, frag_target, MSG_CHOICE, CHOICE_FRAGGED_FREEZE, frag_attacker.netname, kill_count_to_target,
-               GetResourceAmount(frag_attacker, RESOURCE_HEALTH), GetResourceAmount(frag_attacker, RESOURCE_ARMOR), (IS_BOT_CLIENT(frag_attacker) ? -1 : CS(frag_attacker).ping));
+               GetResourceAmount(frag_attacker, RES_HEALTH), GetResourceAmount(frag_attacker, RES_ARMOR), (IS_BOT_CLIENT(frag_attacker) ? -1 : CS(frag_attacker).ping));
 
        return true;
 }
index dc8c8b282af22a8f258dee665b49eb490e873b0a..4e57a5ef2c5b1c9a378865b40bb344606d3000ce 100644 (file)
@@ -288,7 +288,7 @@ bool Invasion_CheckWinner()
 
        float total_alive_monsters = 0, supermonster_count = 0, red_alive = 0, blue_alive = 0, yellow_alive = 0, pink_alive = 0;
 
-       IL_EACH(g_monsters, GetResourceAmount(it, RESOURCE_HEALTH) > 0,
+       IL_EACH(g_monsters, GetResourceAmount(it, RES_HEALTH) > 0,
        {
                if((get_monsterinfo(it.monsterid)).spawnflags & MON_FLAG_SUPERMONSTER)
                        ++supermonster_count;
index 65c5bcd8a0189530b2baf7eeba38a2ebcacdc272..3cb01730d0964c89a74462ecfc5f9316b175d50b 100644 (file)
@@ -308,7 +308,7 @@ void football_touch(entity this, entity toucher)
        }
        if (!IS_PLAYER(toucher))
                return;
-       if(GetResourceAmount(toucher, RESOURCE_HEALTH) < 1)
+       if(GetResourceAmount(toucher, RES_HEALTH) < 1)
                return;
        if(!this.cnt)
                this.nextthink = time + autocvar_g_nexball_delay_idle;
@@ -348,7 +348,7 @@ void basketball_touch(entity this, entity toucher)
        }
        if(!this.cnt && IS_PLAYER(toucher) && !STAT(FROZEN, toucher) && !IS_DEAD(toucher) && (toucher != this.nb_dropper || time > this.nb_droptime + autocvar_g_nexball_delay_collect))
        {
-               if(GetResourceAmount(toucher, RESOURCE_HEALTH) < 1)
+               if(GetResourceAmount(toucher, RES_HEALTH) < 1)
                        return;
                LogNB("caught", toucher);
                GiveBall(toucher, this);
index 2ae142fe14c23702bf4c1646d2184a39a1168ca6..72a13dbe4fe0bc2d63b44bc885701af402893d1c 100644 (file)
@@ -30,7 +30,7 @@ void cpicon_draw(entity this)
        this.cp_bob_spd = this.cp_bob_spd + 1.875 * frametime;
        this.colormod = '1 1 1' * (2 - bound(0, (this.pain_finished - time) / 10, 1));
 
-       if(!this.iscaptured) this.alpha = GetResourceAmount(this, RESOURCE_HEALTH) / this.max_health;
+       if(!this.iscaptured) this.alpha = GetResourceAmount(this, RES_HEALTH) / this.max_health;
 
        if(this.iscaptured)
        {
@@ -165,14 +165,14 @@ NET_HANDLE(ENT_CLIENT_CONTROLPOINT_ICON, bool isnew)
                this.origin = ReadVector();
                setorigin(this, this.origin);
 
-               SetResourceAmount(this, RESOURCE_HEALTH, ReadByte());
+               SetResourceAmount(this, RES_HEALTH, ReadByte());
                this.max_health = ReadByte();
                this.count = ReadByte();
                this.team = ReadByte();
                this.iscaptured = ReadByte();
 
                if(!this.count)
-                       this.count = (GetResourceAmount(this, RESOURCE_HEALTH) - this.max_health) * frametime;
+                       this.count = (GetResourceAmount(this, RES_HEALTH) - this.max_health) * frametime;
 
                cpicon_changeteam(this);
                cpicon_construct(this, isnew);
@@ -189,9 +189,9 @@ NET_HANDLE(ENT_CLIENT_CONTROLPOINT_ICON, bool isnew)
 
                _tmp = ReadByte();
 
-               if(_tmp != GetResourceAmount(this, RESOURCE_HEALTH))
+               if(_tmp != GetResourceAmount(this, RES_HEALTH))
                        cpicon_damage(this, _tmp);
 
-               SetResourceAmount(this, RESOURCE_HEALTH, _tmp);
+               SetResourceAmount(this, RES_HEALTH, _tmp);
        }
 }
index ef2b10d0502462c29d4ca9bbfa2c6c028f894f83..5d29435b45eb2386491d1c07c21c1245f68917bf 100644 (file)
@@ -48,10 +48,10 @@ void generator_draw(entity this)
        if(time < this.move_time)
                return;
 
-       if(GetResourceAmount(this, RESOURCE_HEALTH) > 0)
+       if(GetResourceAmount(this, RES_HEALTH) > 0)
        {
                // damaged fx (less probable the more damaged is the generator)
-               if(random() < 0.9 - GetResourceAmount(this, RESOURCE_HEALTH) / this.max_health)
+               if(random() < 0.9 - GetResourceAmount(this, RES_HEALTH) / this.max_health)
                if(random() < 0.01)
                {
                        pointparticles(EFFECT_ELECTRO_BALLEXPLODE, this.origin + randompos('-50 -50 -20', '50 50 50'), '0 0 0', 1);
@@ -195,7 +195,7 @@ NET_HANDLE(ENT_CLIENT_GENERATOR, bool isnew)
                this.origin = ReadVector();
                setorigin(this, this.origin);
 
-               SetResourceAmount(this, RESOURCE_HEALTH, ReadByte());
+               SetResourceAmount(this, RES_HEALTH, ReadByte());
                this.max_health = ReadByte();
                this.count = ReadByte();
                this.team = ReadByte();
@@ -219,9 +219,9 @@ NET_HANDLE(ENT_CLIENT_GENERATOR, bool isnew)
 
                _tmp = ReadByte();
 
-               if(_tmp != GetResourceAmount(this, RESOURCE_HEALTH))
+               if(_tmp != GetResourceAmount(this, RES_HEALTH))
                        generator_damage(this, _tmp);
 
-               SetResourceAmount(this, RESOURCE_HEALTH, _tmp);
+               SetResourceAmount(this, RES_HEALTH, _tmp);
        }
 }
index 5deef7ec22e01351ebf2f8b3796cd4c47b39f3d6..794c9e6f3550fd4a29c54e4a95b4cf98a452d38e 100644 (file)
@@ -36,7 +36,7 @@ MUTATOR_HOOKFUNCTION(cl_ons, WantEventchase)
        entity gen = NULL;
        if(ons_roundlost)
        {
-               IL_EACH(g_onsgenerators, GetResourceAmount(it, RESOURCE_HEALTH) <= 0,
+               IL_EACH(g_onsgenerators, GetResourceAmount(it, RES_HEALTH) <= 0,
                {
                        gen = it;
                        break;
index a00af18ff83119b0c991312fefdf3c8f981f0ec2..9c0f5b73126cd94c0da532d59e821e420359a0ad 100644 (file)
@@ -12,7 +12,7 @@ bool cpicon_send(entity this, entity to, int sf)
        {
                WriteVector(MSG_ENTITY, this.origin);
 
-               WriteByte(MSG_ENTITY, GetResourceAmount(this, RESOURCE_HEALTH));
+               WriteByte(MSG_ENTITY, GetResourceAmount(this, RES_HEALTH));
                WriteByte(MSG_ENTITY, this.max_health);
                WriteByte(MSG_ENTITY, this.count);
                WriteByte(MSG_ENTITY, this.team);
@@ -23,10 +23,10 @@ bool cpicon_send(entity this, entity to, int sf)
        {
                WriteByte(MSG_ENTITY, this.team);
 
-               if(GetResourceAmount(this, RESOURCE_HEALTH) <= 0)
+               if(GetResourceAmount(this, RES_HEALTH) <= 0)
                        WriteByte(MSG_ENTITY, 0);
                else
-                       WriteByte(MSG_ENTITY, ceil((GetResourceAmount(this, RESOURCE_HEALTH) / this.max_health) * 255));
+                       WriteByte(MSG_ENTITY, ceil((GetResourceAmount(this, RES_HEALTH) / this.max_health) * 255));
        }
 
        return true;
index a33a4301249c1dd67ef06ddf6b0dd445570d893e..929963bddbed2708f4adead91c99fab973c029b5 100644 (file)
@@ -8,7 +8,7 @@ bool generator_send(entity this, entity to, int sf)
        {
                WriteVector(MSG_ENTITY, this.origin);
 
-               WriteByte(MSG_ENTITY, GetResourceAmount(this, RESOURCE_HEALTH));
+               WriteByte(MSG_ENTITY, GetResourceAmount(this, RES_HEALTH));
                WriteByte(MSG_ENTITY, this.max_health);
                WriteByte(MSG_ENTITY, this.count);
                WriteByte(MSG_ENTITY, this.team);
@@ -18,10 +18,10 @@ bool generator_send(entity this, entity to, int sf)
        {
                WriteByte(MSG_ENTITY, this.team);
 
-               if(GetResourceAmount(this, RESOURCE_HEALTH) <= 0)
+               if(GetResourceAmount(this, RES_HEALTH) <= 0)
                        WriteByte(MSG_ENTITY, 0);
                else
-                       WriteByte(MSG_ENTITY, ceil((GetResourceAmount(this, RESOURCE_HEALTH) / this.max_health) * 255));
+                       WriteByte(MSG_ENTITY, ceil((GetResourceAmount(this, RES_HEALTH) / this.max_health) * 255));
        }
 
        return true;
index dc591d7398d20085fe7c34e3f35ee37f690a4dca..b74e51e44b4a19d3919e01910664d8e5f5cf6cec 100644 (file)
@@ -393,11 +393,11 @@ void ons_ControlPoint_Icon_Damage(entity this, entity inflictor, entity attacker
                ons_notification_time[this.team] = time;
        }
 
-       TakeResource(this, RESOURCE_HEALTH, damage);
+       TakeResource(this, RES_HEALTH, damage);
        if(this.owner.iscaptured)
-               WaypointSprite_UpdateHealth(this.owner.sprite, GetResourceAmount(this, RESOURCE_HEALTH));
+               WaypointSprite_UpdateHealth(this.owner.sprite, GetResourceAmount(this, RES_HEALTH));
        else
-               WaypointSprite_UpdateBuildFinished(this.owner.sprite, time + (this.max_health - GetResourceAmount(this, RESOURCE_HEALTH)) / (this.count / ONS_CP_THINKRATE));
+               WaypointSprite_UpdateBuildFinished(this.owner.sprite, time + (this.max_health - GetResourceAmount(this, RES_HEALTH)) / (this.count / ONS_CP_THINKRATE));
        this.pain_finished = time + 1;
        // particles on every hit
        pointparticles(EFFECT_SPARKS, hitloc, force*-1, 1);
@@ -407,7 +407,7 @@ void ons_ControlPoint_Icon_Damage(entity this, entity inflictor, entity attacker
        else
                sound(this, CH_TRIGGER, SND_ONS_HIT2, VOL_BASE+0.3, ATTEN_NORM);
 
-       if (GetResourceAmount(this, RESOURCE_HEALTH) < 0)
+       if (GetResourceAmount(this, RES_HEALTH) < 0)
        {
                sound(this, CH_TRIGGER, SND_GRENADE_IMPACT, VOL_BASE, ATTEN_NORM);
                pointparticles(EFFECT_ROCKET_EXPLODE, this.origin, '0 0 0', 1);
@@ -442,13 +442,13 @@ void ons_ControlPoint_Icon_Damage(entity this, entity inflictor, entity attacker
 
 bool ons_ControlPoint_Icon_Heal(entity targ, entity inflictor, float amount, float limit)
 {
-       float hlth = GetResourceAmount(targ, RESOURCE_HEALTH);
-       float true_limit = ((limit != RESOURCE_LIMIT_NONE) ? limit : targ.max_health);
+       float hlth = GetResourceAmount(targ, RES_HEALTH);
+       float true_limit = ((limit != RES_LIMIT_NONE) ? limit : targ.max_health);
        if (hlth <= 0 || hlth >= true_limit)
                return false;
 
-       GiveResourceWithLimit(targ, RESOURCE_HEALTH, amount, true_limit);
-       hlth = GetResourceAmount(targ, RESOURCE_HEALTH);
+       GiveResourceWithLimit(targ, RES_HEALTH, amount, true_limit);
+       hlth = GetResourceAmount(targ, RES_HEALTH);
        if(targ.owner.iscaptured)
                WaypointSprite_UpdateHealth(targ.owner.sprite, hlth);
        else
@@ -479,9 +479,9 @@ void ons_ControlPoint_Icon_Think(entity this)
                _friendly_count = _friendly_count * (autocvar_g_onslaught_cp_proxydecap_dps * ONS_CP_THINKRATE);
                _enemy_count = _enemy_count * (autocvar_g_onslaught_cp_proxydecap_dps * ONS_CP_THINKRATE);
 
-               GiveResourceWithLimit(this, RESOURCE_HEALTH, (_friendly_count - _enemy_count), this.max_health);
+               GiveResourceWithLimit(this, RES_HEALTH, (_friendly_count - _enemy_count), this.max_health);
                this.SendFlags |= CPSF_STATUS;
-               if(GetResourceAmount(this, RESOURCE_HEALTH) <= 0)
+               if(GetResourceAmount(this, RES_HEALTH) <= 0)
                {
                        ons_ControlPoint_Icon_Damage(this, this, this, 1, 0, DMG_NOWEP, this.origin, '0 0 0');
                        return;
@@ -490,10 +490,10 @@ void ons_ControlPoint_Icon_Think(entity this)
 
        if (time > this.pain_finished + 5)
        {
-               if(GetResourceAmount(this, RESOURCE_HEALTH) < this.max_health)
+               if(GetResourceAmount(this, RES_HEALTH) < this.max_health)
                {
-                       GiveResourceWithLimit(this, RESOURCE_HEALTH, this.count, this.max_health);
-                       WaypointSprite_UpdateHealth(this.owner.sprite, GetResourceAmount(this, RESOURCE_HEALTH));
+                       GiveResourceWithLimit(this, RES_HEALTH, this.count, this.max_health);
+                       WaypointSprite_UpdateHealth(this.owner.sprite, GetResourceAmount(this, RES_HEALTH));
                }
        }
 
@@ -512,7 +512,7 @@ void ons_ControlPoint_Icon_Think(entity this)
        }
 
        // damaged fx
-       if(random() < 0.6 - GetResourceAmount(this, RESOURCE_HEALTH) / this.max_health)
+       if(random() < 0.6 - GetResourceAmount(this, RES_HEALTH) / this.max_health)
        {
                Send_Effect(EFFECT_ELECTRIC_SPARKS, this.origin + randompos('-10 -10 -20', '10 10 20'), '0 0 0', 1);
 
@@ -534,13 +534,13 @@ void ons_ControlPoint_Icon_BuildThink(entity this)
        if(!a)
                return;
 
-       GiveResource(this, RESOURCE_HEALTH, this.count);
+       GiveResource(this, RES_HEALTH, this.count);
 
        this.SendFlags |= CPSF_STATUS;
 
-       if (GetResourceAmount(this, RESOURCE_HEALTH) >= this.max_health)
+       if (GetResourceAmount(this, RES_HEALTH) >= this.max_health)
        {
-               SetResourceAmount(this, RESOURCE_HEALTH, this.max_health);
+               SetResourceAmount(this, RES_HEALTH, this.max_health);
                this.count = autocvar_g_onslaught_cp_regen * ONS_CP_THINKRATE; // slow repair rate from now on
                setthink(this, ons_ControlPoint_Icon_Think);
                sound(this, CH_TRIGGER, SND_ONS_CONTROLPOINT_BUILT, VOL_BASE, ATTEN_NORM);
@@ -550,7 +550,7 @@ void ons_ControlPoint_Icon_BuildThink(entity this)
                Send_Effect(EFFECT_CAP(this.owner.team), this.owner.origin, '0 0 0', 1);
 
                WaypointSprite_UpdateMaxHealth(this.owner.sprite, this.max_health);
-               WaypointSprite_UpdateHealth(this.owner.sprite, GetResourceAmount(this, RESOURCE_HEALTH));
+               WaypointSprite_UpdateHealth(this.owner.sprite, GetResourceAmount(this, RES_HEALTH));
 
                if(IS_PLAYER(this.owner.ons_toucher))
                {
@@ -573,7 +573,7 @@ void ons_ControlPoint_Icon_BuildThink(entity this)
        if(this.owner.model != MDL_ONS_CP_PAD2.model_str())
                setmodel(this.owner, MDL_ONS_CP_PAD2);
 
-       if(random() < 0.9 - GetResourceAmount(this, RESOURCE_HEALTH) / this.max_health)
+       if(random() < 0.9 - GetResourceAmount(this, RES_HEALTH) / this.max_health)
                Send_Effect(EFFECT_RAGE, this.origin + 10 * randomvec(), '0 0 -1', 1);
 }
 
@@ -588,7 +588,7 @@ void ons_ControlPoint_Icon_Spawn(entity cp, entity player)
 
        e.owner = cp;
        e.max_health = autocvar_g_onslaught_cp_health;
-       SetResourceAmount(e, RESOURCE_HEALTH, autocvar_g_onslaught_cp_buildhealth);
+       SetResourceAmount(e, RES_HEALTH, autocvar_g_onslaught_cp_buildhealth);
        e.solid = SOLID_NOT;
        e.takedamage = DAMAGE_AIM;
        e.bot_attack = true;
@@ -597,7 +597,7 @@ void ons_ControlPoint_Icon_Spawn(entity cp, entity player)
        e.event_heal = ons_ControlPoint_Icon_Heal;
        e.team = player.team;
        e.colormap = 1024 + (e.team - 1) * 17;
-       e.count = (e.max_health - GetResourceAmount(e, RESOURCE_HEALTH)) * ONS_CP_THINKRATE / autocvar_g_onslaught_cp_buildtime; // how long it takes to build
+       e.count = (e.max_health - GetResourceAmount(e, RES_HEALTH)) * ONS_CP_THINKRATE / autocvar_g_onslaught_cp_buildtime; // how long it takes to build
 
        sound(e, CH_TRIGGER, SND_ONS_CONTROLPOINT_BUILD, VOL_BASE, ATTEN_NORM);
 
@@ -607,7 +607,7 @@ void ons_ControlPoint_Icon_Spawn(entity cp, entity player)
 
        Send_Effect(EFFECT_FLAG_TOUCH(player.team), e.origin, '0 0 0', 1);
 
-       WaypointSprite_UpdateBuildFinished(cp.sprite, time + (e.max_health - GetResourceAmount(e, RESOURCE_HEALTH)) / (e.count / ONS_CP_THINKRATE));
+       WaypointSprite_UpdateBuildFinished(cp.sprite, time + (e.max_health - GetResourceAmount(e, RES_HEALTH)) / (e.count / ONS_CP_THINKRATE));
        WaypointSprite_UpdateRule(cp.sprite,cp.team,SPRITERULE_TEAMPLAY);
        cp.sprite.SendFlags |= 16;
 
@@ -649,7 +649,7 @@ void ons_ControlPoint_UpdateSprite(entity e)
                        else
                        {
                                WaypointSprite_UpdateMaxHealth(e.sprite, e.goalentity.max_health);
-                               WaypointSprite_UpdateHealth(e.sprite, GetResourceAmount(e.goalentity, RESOURCE_HEALTH));
+                               WaypointSprite_UpdateHealth(e.sprite, GetResourceAmount(e.goalentity, RES_HEALTH));
                        }
                }
                if(e.lastshielded)
@@ -899,8 +899,8 @@ void ons_GeneratorDamage(entity this, entity inflictor, entity attacker, float d
                        play2team(this.team, SND(ONS_GENERATOR_UNDERATTACK));
                }
        }
-       TakeResource(this, RESOURCE_HEALTH, damage);
-       float hlth = GetResourceAmount(this, RESOURCE_HEALTH);
+       TakeResource(this, RES_HEALTH, damage);
+       float hlth = GetResourceAmount(this, RES_HEALTH);
        WaypointSprite_UpdateHealth(this.sprite, hlth);
        // choose an animation frame based on health
        this.frame = 10 * bound(0, (1 - hlth / this.max_health), 1);
@@ -960,13 +960,13 @@ void ons_GeneratorDamage(entity this, entity inflictor, entity attacker, float d
 
 bool ons_GeneratorHeal(entity targ, entity inflictor, float amount, float limit)
 {
-       float true_limit = ((limit != RESOURCE_LIMIT_NONE) ? limit : targ.max_health);
-       float hlth = GetResourceAmount(targ, RESOURCE_HEALTH);
+       float true_limit = ((limit != RES_LIMIT_NONE) ? limit : targ.max_health);
+       float hlth = GetResourceAmount(targ, RES_HEALTH);
        if (hlth <= 0 || hlth >= true_limit)
                return false;
 
-       GiveResourceWithLimit(targ, RESOURCE_HEALTH, amount, true_limit);
-       hlth = GetResourceAmount(targ, RESOURCE_HEALTH);
+       GiveResourceWithLimit(targ, RES_HEALTH, amount, true_limit);
+       hlth = GetResourceAmount(targ, RES_HEALTH);
        WaypointSprite_UpdateHealth(targ.sprite, hlth);
        targ.frame = 10 * bound(0, (1 - hlth / targ.max_health), 1);
        targ.lasthealth = hlth;
@@ -998,7 +998,7 @@ void ons_GeneratorThink(entity this)
 void ons_GeneratorReset(entity this)
 {
        this.team = this.team_saved;
-       SetResourceAmount(this, RESOURCE_HEALTH, autocvar_g_onslaught_gen_health);
+       SetResourceAmount(this, RES_HEALTH, autocvar_g_onslaught_gen_health);
        this.lasthealth = this.max_health = autocvar_g_onslaught_gen_health;
        this.takedamage = DAMAGE_AIM;
        this.bot_attack = true;
@@ -1018,7 +1018,7 @@ void ons_GeneratorReset(entity this)
        this.SendFlags |= GSF_STATUS;
 
        WaypointSprite_UpdateMaxHealth(this.sprite, this.max_health);
-       WaypointSprite_UpdateHealth(this.sprite, GetResourceAmount(this, RESOURCE_HEALTH));
+       WaypointSprite_UpdateHealth(this.sprite, GetResourceAmount(this, RES_HEALTH));
        WaypointSprite_UpdateRule(this.sprite,this.team,SPRITERULE_TEAMPLAY);
 
        onslaught_updatelinks();
@@ -1066,7 +1066,7 @@ void ons_GeneratorSetup(entity gen) // called when spawning a generator entity o
        IL_PUSH(g_saved_team, gen);
        set_movetype(gen, MOVETYPE_NONE);
        gen.lasthealth = gen.max_health = autocvar_g_onslaught_gen_health;
-       SetResourceAmount(gen, RESOURCE_HEALTH, autocvar_g_onslaught_gen_health);
+       SetResourceAmount(gen, RES_HEALTH, autocvar_g_onslaught_gen_health);
        gen.takedamage = DAMAGE_AIM;
        gen.bot_attack = true;
        IL_PUSH(g_bot_targets, gen);
@@ -1093,7 +1093,7 @@ void ons_GeneratorSetup(entity gen) // called when spawning a generator entity o
        WaypointSprite_SpawnFixed(WP_Null, gen.origin + CPGEN_WAYPOINT_OFFSET, gen, sprite, RADARICON_NONE);
        WaypointSprite_UpdateRule(gen.sprite, gen.team, SPRITERULE_TEAMPLAY);
        WaypointSprite_UpdateMaxHealth(gen.sprite, gen.max_health);
-       WaypointSprite_UpdateHealth(gen.sprite, GetResourceAmount(gen, RESOURCE_HEALTH));
+       WaypointSprite_UpdateHealth(gen.sprite, GetResourceAmount(gen, RES_HEALTH));
 
        InitializeEntity(gen, ons_DelayedGeneratorSetup, INITPRIO_SETLOCATION);
 }
@@ -1115,7 +1115,7 @@ void Onslaught_count_generators()
        for(e = ons_worldgeneratorlist; e; e = e.ons_worldgeneratornext)
        {
                ++total_generators;
-               if (GetResourceAmount(e, RESOURCE_HEALTH) < 1)
+               if (GetResourceAmount(e, RES_HEALTH) < 1)
                {
                        continue;
                }
@@ -1953,7 +1953,7 @@ MUTATOR_HOOKFUNCTION(ons, SV_ParseClientCommand)
                        {
                                entity source_point = ons_Nearest_ControlPoint(player, player.origin, autocvar_g_onslaught_teleport_radius);
 
-                               if ( !source_point && GetResourceAmount(player, RESOURCE_HEALTH) > 0 )
+                               if ( !source_point && GetResourceAmount(player, RES_HEALTH) > 0 )
                                {
                                        sprint(player, "\nYou need to be next to a control point\n");
                                        return true;
@@ -1968,7 +1968,7 @@ MUTATOR_HOOKFUNCTION(ons, SV_ParseClientCommand)
                                        return true;
                                }
 
-                               if ( GetResourceAmount(player, RESOURCE_HEALTH) <= 0 )
+                               if ( GetResourceAmount(player, RES_HEALTH) <= 0 )
                                {
                                        player.ons_spawn_by = closest_target;
                                        player.respawn_flags = player.respawn_flags | RESPAWN_FORCE;
@@ -2034,14 +2034,14 @@ MUTATOR_HOOKFUNCTION(ons, SendWaypoint)
                {
                        entity wp_owner = wp.owner;
                        entity e = WaypointSprite_getviewentity(to);
-                       if(SAME_TEAM(e, wp_owner) && GetResourceAmount(wp_owner.goalentity, RESOURCE_HEALTH) >= wp_owner.goalentity.max_health) { wp_flag |= 2; }
+                       if(SAME_TEAM(e, wp_owner) && GetResourceAmount(wp_owner.goalentity, RES_HEALTH) >= wp_owner.goalentity.max_health) { wp_flag |= 2; }
                        if(!ons_ControlPoint_Attackable(wp_owner, e.team)) { wp_flag |= 2; }
                }
                if(wp.owner.classname == "onslaught_generator")
                {
                        entity wp_owner = wp.owner;
-                       if(wp_owner.isshielded && GetResourceAmount(wp_owner, RESOURCE_HEALTH) >= wp_owner.max_health) { wp_flag |= 2; }
-                       if(GetResourceAmount(wp_owner, RESOURCE_HEALTH) <= 0) { wp_flag |= 2; }
+                       if(wp_owner.isshielded && GetResourceAmount(wp_owner, RES_HEALTH) >= wp_owner.max_health) { wp_flag |= 2; }
+                       if(GetResourceAmount(wp_owner, RES_HEALTH) <= 0) { wp_flag |= 2; }
                }
        }
 
index d3f1573b2145d770e594530eb375fedba0f944df..0b14e7a49b762c2aad8428b1b9b98a595fd517e8 100644 (file)
@@ -48,8 +48,8 @@ MODEL(Bullets_ITEM, Item_Model("a_bullets.mdl"));
 PROPERTY(int, g_pickup_nails);
 void ammo_bullets_init(Pickup this, entity item)
 {
-    if(!GetResourceAmount(item, RESOURCE_BULLETS))
-        SetResourceAmount(item, RESOURCE_BULLETS, g_pickup_nails);
+    if(!GetResourceAmount(item, RES_BULLETS))
+        SetResourceAmount(item, RES_BULLETS, g_pickup_nails);
 }
 #endif
 
@@ -82,8 +82,8 @@ MODEL(Cells_ITEM, Item_Model("a_cells.md3"));
 PROPERTY(int, g_pickup_cells);
 void ammo_cells_init(Pickup this, entity item)
 {
-    if(!GetResourceAmount(item, RESOURCE_CELLS))
-        SetResourceAmount(item, RESOURCE_CELLS, g_pickup_cells);
+    if(!GetResourceAmount(item, RES_CELLS))
+        SetResourceAmount(item, RES_CELLS, g_pickup_cells);
 }
 #endif
 REGISTER_ITEM(Cells, Ammo) {
@@ -112,8 +112,8 @@ MODEL(Plasma_ITEM, Item_Model("a_cells.md3"));
 PROPERTY(int, g_pickup_plasma);
 void ammo_plasma_init(Pickup this, entity item)
 {
-    if(!GetResourceAmount(item, RESOURCE_PLASMA))
-        SetResourceAmount(item, RESOURCE_PLASMA, g_pickup_plasma);
+    if(!GetResourceAmount(item, RES_PLASMA))
+        SetResourceAmount(item, RES_PLASMA, g_pickup_plasma);
 }
 #endif
 REGISTER_ITEM(Plasma, Ammo) {
@@ -142,8 +142,8 @@ MODEL(Rockets_ITEM, Item_Model("a_rockets.md3"));
 PROPERTY(int, g_pickup_rockets);
 void ammo_rockets_init(Pickup this, entity item)
 {
-    if(!GetResourceAmount(item, RESOURCE_ROCKETS))
-        SetResourceAmount(item, RESOURCE_ROCKETS, g_pickup_rockets);
+    if(!GetResourceAmount(item, RES_ROCKETS))
+        SetResourceAmount(item, RES_ROCKETS, g_pickup_rockets);
 }
 #endif
 REGISTER_ITEM(Rockets, Ammo) {
@@ -172,8 +172,8 @@ MODEL(Shells_ITEM, Item_Model("a_shells.md3"));
 PROPERTY(int, g_pickup_shells);
 void ammo_shells_init(Pickup this, entity item)
 {
-    if(!GetResourceAmount(item, RESOURCE_SHELLS))
-        SetResourceAmount(item, RESOURCE_SHELLS, g_pickup_shells);
+    if(!GetResourceAmount(item, RES_SHELLS))
+        SetResourceAmount(item, RES_SHELLS, g_pickup_shells);
 }
 #endif
 
index 2889f9224880b18243f142d69aaf8c1b770c3d54..399dc05b0b4acfc939b52817d8d9a50ab49bad23 100644 (file)
@@ -26,8 +26,8 @@ void item_armorsmall_init(Pickup this, entity item)
 {
     if(!item.max_armorvalue)
         item.max_armorvalue = g_pickup_armorsmall_max;
-    if(!GetResourceAmount(item, RESOURCE_ARMOR))
-        SetResourceAmount(item, RESOURCE_ARMOR, g_pickup_armorsmall);
+    if(!GetResourceAmount(item, RES_ARMOR))
+        SetResourceAmount(item, RES_ARMOR, g_pickup_armorsmall);
 }
 #endif
 
@@ -64,8 +64,8 @@ void item_armormedium_init(Pickup this, entity item)
 {
     if(!item.max_armorvalue)
         item.max_armorvalue = g_pickup_armormedium_max;
-    if(!GetResourceAmount(item, RESOURCE_ARMOR))
-        SetResourceAmount(item, RESOURCE_ARMOR, g_pickup_armormedium);
+    if(!GetResourceAmount(item, RES_ARMOR))
+        SetResourceAmount(item, RES_ARMOR, g_pickup_armormedium);
 }
 #endif
 
@@ -102,8 +102,8 @@ void item_armorbig_init(Pickup this, entity item)
 {
     if(!item.max_armorvalue)
         item.max_armorvalue = g_pickup_armorbig_max;
-    if(!GetResourceAmount(item, RESOURCE_ARMOR))
-        SetResourceAmount(item, RESOURCE_ARMOR, g_pickup_armorbig);
+    if(!GetResourceAmount(item, RES_ARMOR))
+        SetResourceAmount(item, RES_ARMOR, g_pickup_armorbig);
 }
 #endif
 
@@ -142,8 +142,8 @@ void item_armormega_init(Pickup this, entity item)
 {
     if(!item.max_armorvalue)
         item.max_armorvalue = g_pickup_armormega_max;
-    if(!GetResourceAmount(item, RESOURCE_ARMOR))
-        SetResourceAmount(item, RESOURCE_ARMOR, g_pickup_armormega);
+    if(!GetResourceAmount(item, RES_ARMOR))
+        SetResourceAmount(item, RES_ARMOR, g_pickup_armormega);
 }
 #endif
 
index a7dd3c370fd513a76a4432304808144730ee07fa..3944a84cd28d236ea40ce9b5c58f8f75cdedcb0b 100644 (file)
@@ -26,8 +26,8 @@ void item_healthsmall_init(Pickup this, entity item)
 {
     if(!item.max_health)
         item.max_health = g_pickup_healthsmall_max;
-    if(!GetResourceAmount(item, RESOURCE_HEALTH))
-        SetResourceAmount(item, RESOURCE_HEALTH, g_pickup_healthsmall);
+    if(!GetResourceAmount(item, RES_HEALTH))
+        SetResourceAmount(item, RES_HEALTH, g_pickup_healthsmall);
 }
 #endif
 
@@ -64,8 +64,8 @@ void item_healthmedium_init(Pickup this, entity item)
 {
     if(!item.max_health)
         item.max_health = g_pickup_healthmedium_max;
-    if(!GetResourceAmount(item, RESOURCE_HEALTH))
-        SetResourceAmount(item, RESOURCE_HEALTH, g_pickup_healthmedium);
+    if(!GetResourceAmount(item, RES_HEALTH))
+        SetResourceAmount(item, RES_HEALTH, g_pickup_healthmedium);
 }
 #endif
 
@@ -102,8 +102,8 @@ void item_healthbig_init(Pickup this, entity item)
 {
     if(!item.max_health)
         item.max_health = g_pickup_healthbig_max;
-    if(!GetResourceAmount(item, RESOURCE_HEALTH))
-        SetResourceAmount(item, RESOURCE_HEALTH, g_pickup_healthbig);
+    if(!GetResourceAmount(item, RES_HEALTH))
+        SetResourceAmount(item, RES_HEALTH, g_pickup_healthbig);
 }
 #endif
 
@@ -142,8 +142,8 @@ void item_healthmega_init(Pickup this, entity item)
 {
     if(!item.max_health)
         item.max_health = g_pickup_healthmega_max;
-    if(!GetResourceAmount(item, RESOURCE_HEALTH))
-        SetResourceAmount(item, RESOURCE_HEALTH, g_pickup_healthmega);
+    if(!GetResourceAmount(item, RES_HEALTH))
+        SetResourceAmount(item, RES_HEALTH, g_pickup_healthmega);
 }
 #endif
 
index f33e62cb3474bfb5c26f7467ffc0304169d4a245..93f285ffca197e1e57ac96821d75ef7d5a6e8de5 100644 (file)
@@ -19,8 +19,8 @@ MODEL(Jetpack_ITEM, Item_Model("g_jetpack.md3"));
 PROPERTY(int, g_pickup_fuel_jetpack);
 void powerup_jetpack_init(Pickup this, entity item)
 {
-    if(!GetResourceAmount(item, RESOURCE_FUEL))
-        SetResourceAmount(item, RESOURCE_FUEL, g_pickup_fuel_jetpack);
+    if(!GetResourceAmount(item, RES_FUEL))
+        SetResourceAmount(item, RES_FUEL, g_pickup_fuel_jetpack);
 }
 #endif
 
@@ -57,8 +57,8 @@ MODEL(JetpackFuel_ITEM, Item_Model("g_fuel.md3"));
 PROPERTY(int, g_pickup_fuel);
 void ammo_fuel_init(Pickup this, entity item)
 {
-    if(!GetResourceAmount(item, RESOURCE_FUEL))
-        SetResourceAmount(item, RESOURCE_FUEL, g_pickup_fuel);
+    if(!GetResourceAmount(item, RES_FUEL))
+        SetResourceAmount(item, RES_FUEL, g_pickup_fuel);
 }
 #endif
 REGISTER_ITEM(JetpackFuel, Ammo) {
index b3a93d9c90ea3045a34ed6150548100252cec492..fbcff114142a04835d6d37835ffd6991b7d08a0c 100644 (file)
@@ -83,7 +83,7 @@ void func_breakable_colormod(entity this)
        float h;
        if (!(this.spawnflags & BREAKABLE_INDICATE_DAMAGE))
                return;
-       h = GetResourceAmount(this, RESOURCE_HEALTH) / this.max_health;
+       h = GetResourceAmount(this, RES_HEALTH) / this.max_health;
        if(h < 0.25)
                this.colormod = '1 0 0';
        else if(h <= 0.75)
@@ -129,7 +129,7 @@ void func_breakable_look_restore(entity this)
 
 void func_breakable_behave_destroyed(entity this)
 {
-       SetResourceAmount(this, RESOURCE_HEALTH, this.max_health);
+       SetResourceAmount(this, RES_HEALTH, this.max_health);
        this.takedamage = DAMAGE_NO;
        if(this.bot_attack)
                IL_REMOVE(g_bot_targets, this);
@@ -157,11 +157,11 @@ void func_breakable_think(entity this)
 void func_breakable_destroy(entity this, entity actor, entity trigger);
 void func_breakable_behave_restore(entity this)
 {
-       SetResourceAmount(this, RESOURCE_HEALTH, this.max_health);
+       SetResourceAmount(this, RES_HEALTH, this.max_health);
        if(this.sprite)
        {
                WaypointSprite_UpdateMaxHealth(this.sprite, this.max_health);
-               WaypointSprite_UpdateHealth(this.sprite, GetResourceAmount(this, RESOURCE_HEALTH));
+               WaypointSprite_UpdateHealth(this.sprite, GetResourceAmount(this, RES_HEALTH));
        }
        if(!(this.spawnflags & BREAKABLE_NODAMAGE))
        {
@@ -272,15 +272,15 @@ void func_breakable_damage(entity this, entity inflictor, entity attacker, float
                if(attacker.team == this.team)
                        return;
        this.pain_finished = time;
-       TakeResource(this, RESOURCE_HEALTH, damage);
+       TakeResource(this, RES_HEALTH, damage);
        if(this.sprite)
        {
                WaypointSprite_Ping(this.sprite);
-               WaypointSprite_UpdateHealth(this.sprite, GetResourceAmount(this, RESOURCE_HEALTH));
+               WaypointSprite_UpdateHealth(this.sprite, GetResourceAmount(this, RES_HEALTH));
        }
        func_breakable_colormod(this);
 
-       if(GetResourceAmount(this, RESOURCE_HEALTH) <= 0)
+       if(GetResourceAmount(this, RES_HEALTH) <= 0)
        {
                debrisforce = force;
 
@@ -315,9 +315,9 @@ void func_breakable_reset(entity this)
 spawnfunc(func_breakable)
 {
        float n, i;
-       if(!GetResourceAmount(this, RESOURCE_HEALTH))
-               SetResourceAmount(this, RESOURCE_HEALTH, 100);
-       this.max_health = GetResourceAmount(this, RESOURCE_HEALTH);
+       if(!GetResourceAmount(this, RES_HEALTH))
+               SetResourceAmount(this, RES_HEALTH, 100);
+       this.max_health = GetResourceAmount(this, RES_HEALTH);
 
        // yes, I know, MOVETYPE_NONE is not available here, not that one would want it here anyway
        if(!this.debrismovetype) this.debrismovetype = MOVETYPE_BOUNCE;
index 4dc55fccf49b3f484c0980dd10e7f20ee64630dc..41c2ea1ba0df251a8b8c4fec7cfffc3b7b2a1bf0 100644 (file)
@@ -68,7 +68,7 @@ void button_return(entity this)
        this.state = STATE_DOWN;
        SUB_CalcMove (this, this.pos1, TSPEED_LINEAR, this.speed, button_done);
        this.frame = 0;                 // use normal textures
-       if (GetResourceAmount(this, RESOURCE_HEALTH))
+       if (GetResourceAmount(this, RES_HEALTH))
                this.takedamage = DAMAGE_YES;   // can be shot again
        this.wait_remaining = -1;
        this.activation_time = -1;
@@ -83,7 +83,7 @@ void button_blocked(entity this, entity blocker)
 
 void button_fire(entity this)
 {
-       SetResourceAmount(this, RESOURCE_HEALTH, this.max_health);
+       SetResourceAmount(this, RES_HEALTH, this.max_health);
        this.takedamage = DAMAGE_NO;    // will be reset upon return
 
        if (this.state == STATE_UP || this.state == STATE_TOP)
@@ -100,7 +100,7 @@ void button_fire(entity this)
 
 void button_reset(entity this)
 {
-       SetResourceAmount(this, RESOURCE_HEALTH, this.max_health);
+       SetResourceAmount(this, RES_HEALTH, this.max_health);
        setorigin(this, this.pos1);
        this.frame = 0;                 // use normal textures
        this.state = STATE_BOTTOM;
@@ -110,7 +110,7 @@ void button_reset(entity this)
        this.active = ACTIVE_ACTIVE;
        setthink(this, func_null);
        this.nextthink = 0;
-       if (GetResourceAmount(this, RESOURCE_HEALTH))
+       if (GetResourceAmount(this, RES_HEALTH))
                this.takedamage = DAMAGE_YES;   // can be shot again
 }
 
@@ -148,7 +148,7 @@ void button_damage(entity this, entity inflictor, entity attacker, float damage,
                        return;
        if (this.spawnflags & BUTTON_DONTACCUMULATEDMG)
        {
-               if (GetResourceAmount(this, RESOURCE_HEALTH) <= damage)
+               if (GetResourceAmount(this, RES_HEALTH) <= damage)
                {
                        this.enemy = attacker;
                        button_fire(this);
@@ -156,8 +156,8 @@ void button_damage(entity this, entity inflictor, entity attacker, float damage,
        }
        else
        {
-               TakeResource(this, RESOURCE_HEALTH, damage);
-               if (GetResourceAmount(this, RESOURCE_HEALTH) <= 0)
+               TakeResource(this, RES_HEALTH, damage);
+               if (GetResourceAmount(this, RES_HEALTH) <= 0)
                {
                        this.enemy = attacker;
                        button_fire(this);
@@ -190,9 +190,9 @@ spawnfunc(func_button)
 
 //     if (this.health == 0) // all buttons are now shootable
 //             this.health = 10;
-       if (GetResourceAmount(this, RESOURCE_HEALTH))
+       if (GetResourceAmount(this, RES_HEALTH))
        {
-               this.max_health = GetResourceAmount(this, RESOURCE_HEALTH);
+               this.max_health = GetResourceAmount(this, RES_HEALTH);
                this.event_damage = button_damage;
                this.takedamage = DAMAGE_YES;
        }
index 3aaf047a31a9b59e38c5aaeedc583c6a7097f7c8..3360fc961504b299b6d1f1c136c19439704f317a 100644 (file)
@@ -113,7 +113,7 @@ void door_go_down(entity this)
        if (this.max_health)
        {
                this.takedamage = DAMAGE_YES;
-               SetResourceAmount(this, RESOURCE_HEALTH, this.max_health);
+               SetResourceAmount(this, RES_HEALTH, this.max_health);
        }
 
        this.state = STATE_DOWN;
@@ -265,7 +265,7 @@ void door_damage(entity this, entity inflictor, entity attacker, float damage, i
        if(this.spawnflags & NOSPLASH)
                if(!(DEATH_ISSPECIAL(deathtype)) && (deathtype & HITTYPE_SPLASH))
                        return;
-       TakeResource(this, RESOURCE_HEALTH, damage);
+       TakeResource(this, RES_HEALTH, damage);
 
        if (this.itemkeys)
        {
@@ -273,9 +273,9 @@ void door_damage(entity this, entity inflictor, entity attacker, float damage, i
                return;
        }
 
-       if (GetResourceAmount(this, RESOURCE_HEALTH) <= 0)
+       if (GetResourceAmount(this, RES_HEALTH) <= 0)
        {
-               SetResourceAmount(this.owner, RESOURCE_HEALTH, this.owner.max_health);
+               SetResourceAmount(this.owner, RES_HEALTH, this.owner.max_health);
                this.owner.takedamage = DAMAGE_NO;      // will be reset upon return
                door_use(this.owner, attacker, NULL);
        }
@@ -357,7 +357,7 @@ Spawned if a door lacks a real activator
 
 void door_trigger_touch(entity this, entity toucher)
 {
-       if (GetResourceAmount(toucher, RESOURCE_HEALTH) < 1)
+       if (GetResourceAmount(toucher, RES_HEALTH) < 1)
 #ifdef SVQC
                if (!((toucher.iscreature || (toucher.flags & FL_PROJECTILE)) && !IS_DEAD(toucher)))
 #elif defined(CSQC)
@@ -441,7 +441,7 @@ void LinkDoors(entity this)
        {
                this.owner = this.enemy = this;
 
-               if (GetResourceAmount(this, RESOURCE_HEALTH))
+               if (GetResourceAmount(this, RES_HEALTH))
                        return;
                IFTARGETED
                        return;
@@ -474,8 +474,8 @@ void LinkDoors(entity this)
        cmaxs = this.absmax;
        for(t = this; ; t = t.enemy)
        {
-               if(GetResourceAmount(t, RESOURCE_HEALTH) && !GetResourceAmount(this, RESOURCE_HEALTH))
-                       SetResourceAmount(this, RESOURCE_HEALTH, GetResourceAmount(t, RESOURCE_HEALTH));
+               if(GetResourceAmount(t, RES_HEALTH) && !GetResourceAmount(this, RES_HEALTH))
+                       SetResourceAmount(this, RES_HEALTH, GetResourceAmount(t, RES_HEALTH));
                if((t.targetname != "") && (this.targetname == ""))
                        this.targetname = t.targetname;
                if((t.message != "") && (this.message == ""))
@@ -499,7 +499,7 @@ void LinkDoors(entity this)
        // distribute health, targetname, message
        for(t = this; t; t = t.enemy)
        {
-               SetResourceAmount(t, RESOURCE_HEALTH, GetResourceAmount(this, RESOURCE_HEALTH));
+               SetResourceAmount(t, RES_HEALTH, GetResourceAmount(this, RES_HEALTH));
                t.targetname = this.targetname;
                t.message = this.message;
                if(t.enemy == this)
@@ -509,7 +509,7 @@ void LinkDoors(entity this)
        // shootable, or triggered doors just needed the owner/enemy links,
        // they don't spawn a field
 
-       if (GetResourceAmount(this, RESOURCE_HEALTH))
+       if (GetResourceAmount(this, RES_HEALTH))
                return;
        IFTARGETED
                return;
@@ -628,7 +628,7 @@ void door_reset(entity this)
 // common code for func_door and func_door_rotating spawnfuncs
 void door_init_shared(entity this)
 {
-       this.max_health = GetResourceAmount(this, RESOURCE_HEALTH);
+       this.max_health = GetResourceAmount(this, RES_HEALTH);
 
        // unlock sound
        if(this.noise == "")
@@ -681,7 +681,7 @@ void door_init_shared(entity this)
 
        this.state = STATE_BOTTOM;
 
-       if (GetResourceAmount(this, RESOURCE_HEALTH))
+       if (GetResourceAmount(this, RES_HEALTH))
        {
                //this.canteamdamage = true; // TODO
                this.takedamage = DAMAGE_YES;
index a36bc3e4da3915a159bb8d4191a0e6abb0e67df7..b844ab47fd4d2ecf79534d6d059bee30679ade1f 100644 (file)
@@ -58,7 +58,7 @@ void door_rotating_go_down(entity this)
        if (this.max_health)
        {
                this.takedamage = DAMAGE_YES;
-               SetResourceAmount(this, RESOURCE_HEALTH, this.max_health);
+               SetResourceAmount(this, RES_HEALTH, this.max_health);
        }
 
        this.state = STATE_DOWN;
index 7751092b58cc114bec56c58f59d5d2ec280b4234..8236fcb13b41740fae487a58b72c68a631668e1b 100644 (file)
@@ -13,7 +13,7 @@ void fd_secret_use(entity this, entity actor, entity trigger)
        float temp;
        string message_save;
 
-       SetResourceAmount(this, RESOURCE_HEALTH, 10000);
+       SetResourceAmount(this, RES_HEALTH, 10000);
        if(!this.bot_attack)
                IL_PUSH(g_bot_targets, this);
        this.bot_attack = true;
@@ -122,7 +122,7 @@ void fd_secret_done(entity this)
 {
        if (this.spawnflags&DOOR_SECRET_YES_SHOOT)
        {
-               SetResourceAmount(this, RESOURCE_HEALTH, 10000);
+               SetResourceAmount(this, RES_HEALTH, 10000);
                this.takedamage = DAMAGE_YES;
                //this.th_pain = fd_secret_use;
        }
@@ -168,7 +168,7 @@ void secret_reset(entity this)
 {
        if (this.spawnflags & DOOR_SECRET_YES_SHOOT)
        {
-               SetResourceAmount(this, RESOURCE_HEALTH, 10000);
+               SetResourceAmount(this, RES_HEALTH, 10000);
                this.takedamage = DAMAGE_YES;
        }
        setorigin(this, this.oldorigin);
@@ -253,7 +253,7 @@ spawnfunc(func_door_secret)
        if (this.spawnflags & DOOR_SECRET_YES_SHOOT)
        {
                //this.canteamdamage = true; // TODO
-               SetResourceAmount(this, RESOURCE_HEALTH, 10000);
+               SetResourceAmount(this, RES_HEALTH, 10000);
                this.takedamage = DAMAGE_YES;
                this.event_damage = fd_secret_damage;
        }
index cc909e5c5600fa0def2e10ab424282b6b0cb64f9..511cf13a6558000f8fb3f66a2a04f7449d36d20e 100644 (file)
@@ -93,7 +93,7 @@ void plat_center_touch(entity this, entity toucher)
        if (!toucher.iscreature)
                return;
 
-       if (GetResourceAmount(toucher, RESOURCE_HEALTH) <= 0)
+       if (GetResourceAmount(toucher, RES_HEALTH) <= 0)
                return;
 #elif defined(CSQC)
        if (!IS_PLAYER(toucher))
@@ -114,7 +114,7 @@ void plat_outside_touch(entity this, entity toucher)
        if (!toucher.iscreature)
                return;
 
-       if (GetResourceAmount(toucher, RESOURCE_HEALTH) <= 0)
+       if (GetResourceAmount(toucher, RES_HEALTH) <= 0)
                return;
 #elif defined(CSQC)
        if (!IS_PLAYER(toucher))
index 6482a3d787b09e4e9b134dd1ce9d8c51c3091095..40fe366716cfec58a334696489f834c5af7aaed6 100644 (file)
@@ -44,12 +44,12 @@ void tdeath(entity player, entity teleporter, entity telefragger, vector telefra
 {
        TDEATHLOOP(player.origin)
        {
-               if (IS_PLAYER(player) && GetResourceAmount(player, RESOURCE_HEALTH) >= 1)
+               if (IS_PLAYER(player) && GetResourceAmount(player, RES_HEALTH) >= 1)
                {
                        if (!(teamplay && autocvar_g_telefrags_teamplay && head.team == player.team))
                        {
                                if(IS_PLAYER(head))
-                                       if(GetResourceAmount(head, RESOURCE_HEALTH) >= 1)
+                                       if(GetResourceAmount(head, RES_HEALTH) >= 1)
                                                ++tdeath_hit;
                                Damage (head, teleporter, telefragger, 10000, DEATH_TELEFRAG.m_id, DMG_NOWEP, head.origin, '0 0 0');
                        }
index 3f3e6c579bccbe612b48d4289f6c059b006a88f4..c47a584d1b576a26afae590838e505733d9e7249 100644 (file)
@@ -18,7 +18,7 @@ void trigger_heal_touch(entity this, entity toucher)
                                toucher.triggerhealtime = time + this.delay;
 
                        bool playthesound = (this.spawnflags & HEAL_SOUND_ALWAYS);
-                       bool healed = Heal(toucher, this, GetResourceAmount(this, RESOURCE_HEALTH), this.max_health);
+                       bool healed = Heal(toucher, this, GetResourceAmount(this, RES_HEALTH), this.max_health);
 
                        if(playthesound || healed)
                                _sound (toucher, CH_TRIGGER, this.noise, VOL_BASE, ATTEN_NORM);
@@ -36,8 +36,8 @@ void trigger_heal_init(entity this)
        this.active = ACTIVE_ACTIVE;
        if(!this.delay)
                this.delay = 1;
-       if(!GetResourceAmount(this, RESOURCE_HEALTH))
-               SetResourceAmount(this, RESOURCE_HEALTH, 10); // TODO: use a special field for this, it doesn't have actual health!
+       if(!GetResourceAmount(this, RES_HEALTH))
+               SetResourceAmount(this, RES_HEALTH, 10); // TODO: use a special field for this, it doesn't have actual health!
        if(!this.max_health)
                this.max_health = 200; // max health topoff for field
        if(this.noise == "")
index 181cde6fdcb579e1aeefbaa9c66d83016f7e806c..5ae77e4821c30b25ce05f61cdc12b13daf4b8960 100644 (file)
@@ -7,7 +7,7 @@ void multi_wait(entity this)
 {
        if (this.max_health)
        {
-               SetResourceAmount(this, RESOURCE_HEALTH, this.max_health);
+               SetResourceAmount(this, RES_HEALTH, this.max_health);
                this.takedamage = DAMAGE_YES;
                this.solid = SOLID_BBOX;
        }
@@ -120,8 +120,8 @@ void multi_eventdamage(entity this, entity inflictor, entity attacker, float dam
        if(this.team)
                if(((this.spawnflags & INVERT_TEAMS) == 0) == (this.team != attacker.team))
                        return;
-       TakeResource(this, RESOURCE_HEALTH, damage);
-       if (GetResourceAmount(this, RESOURCE_HEALTH) <= 0)
+       TakeResource(this, RES_HEALTH, damage);
+       if (GetResourceAmount(this, RES_HEALTH) <= 0)
        {
                this.enemy = attacker;
                this.goalentity = inflictor;
@@ -135,7 +135,7 @@ void multi_reset(entity this)
                settouch(this, multi_touch);
        if (this.max_health)
        {
-               SetResourceAmount(this, RESOURCE_HEALTH, this.max_health);
+               SetResourceAmount(this, RES_HEALTH, this.max_health);
                this.takedamage = DAMAGE_YES;
                this.solid = SOLID_BBOX;
        }
@@ -181,12 +181,12 @@ spawnfunc(trigger_multiple)
        this.team_saved = this.team;
        IL_PUSH(g_saved_team, this);
 
-       if (GetResourceAmount(this, RESOURCE_HEALTH))
+       if (GetResourceAmount(this, RES_HEALTH))
        {
                if (this.spawnflags & SPAWNFLAG_NOTOUCH)
                        objerror (this, "health and notouch don't make sense\n");
                this.canteamdamage = true;
-               this.max_health = GetResourceAmount(this, RESOURCE_HEALTH);
+               this.max_health = GetResourceAmount(this, RES_HEALTH);
                this.event_damage = multi_eventdamage;
                this.takedamage = DAMAGE_YES;
                this.solid = SOLID_BBOX;
index 22661333b4252b2f7cfe91dd0ae66ea1bd18f1d9..605ce668ae6417cfc1da820398b9271f983b17ec 100644 (file)
@@ -73,7 +73,7 @@ spawnfunc(trigger_secret)
        this.targetname = "";
 
        // you can't just shoot a room to find it, can you?
-       SetResourceAmount(this, RESOURCE_HEALTH, 0);
+       SetResourceAmount(this, RES_HEALTH, 0);
 
        // a secret can not be delayed
        this.delay = 0;
index 8e3fd739de5694b34dd563a999707de4544fc45f..0045749d17b2009390f06b626390ed4bcb8ae306 100644 (file)
@@ -44,7 +44,7 @@ void swampslug_think(entity this)
        this.swamp_lifetime -= 1;
 
        //Slug dead? then remove curses.
-       if(GetResourceAmount(this, RESOURCE_HEALTH) <= 0)
+       if(GetResourceAmount(this, RES_HEALTH) <= 0)
        {
                this.owner.in_swamp = 0;
                delete(this);
index 8e39ff3f927a89fe1242d7b335549b5261285813..bd2c7c940680e4d2e70e57e22fba7beb25a3f4ff 100644 (file)
@@ -87,31 +87,31 @@ bool M_Mage_Defend_Heal_Check(entity this, entity targ)
 {
        if(targ == NULL)
                return false;
-       if(GetResourceAmount(targ, RESOURCE_HEALTH) <= 0)
+       if(GetResourceAmount(targ, RES_HEALTH) <= 0)
                return false;
        if(DIFF_TEAM(targ, this) && targ != this.monster_follow)
                return false;
        if(STAT(FROZEN, targ))
                return false;
        if(!IS_PLAYER(targ))
-               return (IS_MONSTER(targ) && GetResourceAmount(targ, RESOURCE_HEALTH) < targ.max_health);
+               return (IS_MONSTER(targ) && GetResourceAmount(targ, RES_HEALTH) < targ.max_health);
        if(targ.items & ITEM_Shield.m_itemid)
                return false;
 
        switch(this.skin)
        {
-               case 0: return (GetResourceAmount(targ, RESOURCE_HEALTH) < autocvar_g_balance_health_regenstable);
+               case 0: return (GetResourceAmount(targ, RES_HEALTH) < autocvar_g_balance_health_regenstable);
                case 1:
                {
-                       return ((GetResourceAmount(targ, RESOURCE_CELLS) && GetResourceAmount(targ, RESOURCE_CELLS) < g_pickup_cells_max)
-                               ||  (GetResourceAmount(targ, RESOURCE_PLASMA) && GetResourceAmount(targ, RESOURCE_PLASMA) < g_pickup_plasma_max)
-                               ||  (GetResourceAmount(targ, RESOURCE_ROCKETS) && GetResourceAmount(targ, RESOURCE_ROCKETS) < g_pickup_rockets_max)
-                               ||  (GetResourceAmount(targ, RESOURCE_BULLETS) && GetResourceAmount(targ, RESOURCE_BULLETS) < g_pickup_nails_max)
-                               ||  (GetResourceAmount(targ, RESOURCE_SHELLS) && GetResourceAmount(targ, RESOURCE_SHELLS) < g_pickup_shells_max)
+                       return ((GetResourceAmount(targ, RES_CELLS) && GetResourceAmount(targ, RES_CELLS) < g_pickup_cells_max)
+                               ||  (GetResourceAmount(targ, RES_PLASMA) && GetResourceAmount(targ, RES_PLASMA) < g_pickup_plasma_max)
+                               ||  (GetResourceAmount(targ, RES_ROCKETS) && GetResourceAmount(targ, RES_ROCKETS) < g_pickup_rockets_max)
+                               ||  (GetResourceAmount(targ, RES_BULLETS) && GetResourceAmount(targ, RES_BULLETS) < g_pickup_nails_max)
+                               ||  (GetResourceAmount(targ, RES_SHELLS) && GetResourceAmount(targ, RES_SHELLS) < g_pickup_shells_max)
                                        );
                }
-               case 2: return (GetResourceAmount(targ, RESOURCE_ARMOR) < autocvar_g_balance_armor_regenstable);
-               case 3: return (GetResourceAmount(targ, RESOURCE_HEALTH) > 0);
+               case 2: return (GetResourceAmount(targ, RES_ARMOR) < autocvar_g_balance_armor_regenstable);
+               case 3: return (GetResourceAmount(targ, RES_HEALTH) > 0);
        }
 
        return false;
@@ -144,7 +144,7 @@ void M_Mage_Attack_Spike_Touch(entity this, entity toucher)
 // copied from W_Seeker_Think
 void M_Mage_Attack_Spike_Think(entity this)
 {
-       if (time > this.ltime || (this.enemy && GetResourceAmount(this.enemy, RESOURCE_HEALTH) <= 0) || GetResourceAmount(this.owner, RESOURCE_HEALTH) <= 0) {
+       if (time > this.ltime || (this.enemy && GetResourceAmount(this.enemy, RES_HEALTH) <= 0) || GetResourceAmount(this.owner, RES_HEALTH) <= 0) {
                this.projectiledeathtype |= HITTYPE_SPLASH;
                M_Mage_Attack_Spike_Explode(this, NULL);
        }
@@ -241,25 +241,25 @@ void M_Mage_Defend_Heal(entity this)
                                }
                                case 1:
                                {
-                                       if(GetResourceAmount(this, RESOURCE_CELLS)) GiveResourceWithLimit(it, RESOURCE_CELLS, 1, g_pickup_cells_max);
-                                       if(GetResourceAmount(this, RESOURCE_PLASMA)) GiveResourceWithLimit(it, RESOURCE_PLASMA, 1, g_pickup_plasma_max);
-                                       if(GetResourceAmount(this, RESOURCE_ROCKETS)) GiveResourceWithLimit(it, RESOURCE_ROCKETS, 1, g_pickup_rockets_max);
-                                       if(GetResourceAmount(this, RESOURCE_SHELLS)) GiveResourceWithLimit(it, RESOURCE_SHELLS, 2, g_pickup_shells_max);
-                                       if(GetResourceAmount(this, RESOURCE_BULLETS)) GiveResourceWithLimit(it, RESOURCE_BULLETS, 5, g_pickup_nails_max);
+                                       if(GetResourceAmount(this, RES_CELLS)) GiveResourceWithLimit(it, RES_CELLS, 1, g_pickup_cells_max);
+                                       if(GetResourceAmount(this, RES_PLASMA)) GiveResourceWithLimit(it, RES_PLASMA, 1, g_pickup_plasma_max);
+                                       if(GetResourceAmount(this, RES_ROCKETS)) GiveResourceWithLimit(it, RES_ROCKETS, 1, g_pickup_rockets_max);
+                                       if(GetResourceAmount(this, RES_SHELLS)) GiveResourceWithLimit(it, RES_SHELLS, 2, g_pickup_shells_max);
+                                       if(GetResourceAmount(this, RES_BULLETS)) GiveResourceWithLimit(it, RES_BULLETS, 5, g_pickup_nails_max);
                                        // TODO: fuel?
                                        fx = EFFECT_AMMO_REGEN;
                                        break;
                                }
                                case 2:
-                                       if(GetResourceAmount(it, RESOURCE_ARMOR) < autocvar_g_balance_armor_regenstable)
+                                       if(GetResourceAmount(it, RES_ARMOR) < autocvar_g_balance_armor_regenstable)
                                        {
-                                               GiveResourceWithLimit(it, RESOURCE_ARMOR, autocvar_g_monster_mage_heal_allies, autocvar_g_balance_armor_regenstable);
+                                               GiveResourceWithLimit(it, RES_ARMOR, autocvar_g_monster_mage_heal_allies, autocvar_g_balance_armor_regenstable);
                                                fx = EFFECT_ARMOR_REPAIR;
                                        }
                                        break;
                                case 3:
                                        float hp = ((it == this) ? autocvar_g_monster_mage_heal_self : autocvar_g_monster_mage_heal_allies);
-                                       TakeResource(it, RESOURCE_HEALTH, hp); // TODO: use regular damage functions? needs a way to bypass friendly fire checks
+                                       TakeResource(it, RES_HEALTH, hp); // TODO: use regular damage functions? needs a way to bypass friendly fire checks
                                        fx = EFFECT_RAGE;
                                        break;
                        }
@@ -269,9 +269,9 @@ void M_Mage_Defend_Heal(entity this)
                else
                {
                        Send_Effect(EFFECT_HEALING, it.origin, '0 0 0', 1);
-                       Heal(it, this, autocvar_g_monster_mage_heal_allies, RESOURCE_LIMIT_NONE);
+                       Heal(it, this, autocvar_g_monster_mage_heal_allies, RES_LIMIT_NONE);
                        if(!(it.spawnflags & MONSTERFLAG_INVINCIBLE) && it.sprite)
-                               WaypointSprite_UpdateHealth(it.sprite, GetResourceAmount(it, RESOURCE_HEALTH));
+                               WaypointSprite_UpdateHealth(it.sprite, GetResourceAmount(it, RES_HEALTH));
                }
        });
 
@@ -325,14 +325,14 @@ void M_Mage_Attack_Teleport(entity this, entity targ)
 void M_Mage_Defend_Shield_Remove(entity this)
 {
        this.effects &= ~(EF_ADDITIVE | EF_BLUE);
-       SetResourceAmount(this, RESOURCE_ARMOR, autocvar_g_monsters_armor_blockpercent);
+       SetResourceAmount(this, RES_ARMOR, autocvar_g_monsters_armor_blockpercent);
 }
 
 void M_Mage_Defend_Shield(entity this)
 {
        this.effects |= (EF_ADDITIVE | EF_BLUE);
        this.mage_shield_delay = time + (autocvar_g_monster_mage_shield_delay);
-       SetResourceAmount(this, RESOURCE_ARMOR, autocvar_g_monster_mage_shield_blockpercent);
+       SetResourceAmount(this, RES_ARMOR, autocvar_g_monster_mage_shield_blockpercent);
        this.mage_shield_time = time + (autocvar_g_monster_mage_shield_time);
        setanim(this, this.anim_shoot, true, true, true);
        this.attack_finished_single[0] = time + 1;
@@ -419,16 +419,16 @@ METHOD(Mage, mr_think, bool(Mage thismon, entity actor))
        });
     }
 
-    if(GetResourceAmount(actor, RESOURCE_HEALTH) < (autocvar_g_monster_mage_heal_minhealth) || need_help)
+    if(GetResourceAmount(actor, RES_HEALTH) < (autocvar_g_monster_mage_heal_minhealth) || need_help)
     if(time >= actor.attack_finished_single[0])
     if(random() < 0.5)
         M_Mage_Defend_Heal(actor);
 
-    if(time >= actor.mage_shield_time && GetResourceAmount(actor, RESOURCE_ARMOR))
+    if(time >= actor.mage_shield_time && GetResourceAmount(actor, RES_ARMOR))
         M_Mage_Defend_Shield_Remove(actor);
 
     if(actor.enemy)
-    if(GetResourceAmount(actor, RESOURCE_HEALTH) < actor.max_health)
+    if(GetResourceAmount(actor, RES_HEALTH) < actor.max_health)
     if(time >= actor.mage_shield_delay)
     if(random() < 0.5)
         M_Mage_Defend_Shield(actor);
@@ -469,7 +469,7 @@ METHOD(Mage, mr_anim, bool(Mage this, entity actor))
 METHOD(Mage, mr_setup, bool(Mage this, entity actor))
 {
     TC(Mage, this);
-    if(!GetResourceAmount(this, RESOURCE_HEALTH)) SetResourceAmount(actor, RESOURCE_HEALTH, autocvar_g_monster_mage_health);
+    if(!GetResourceAmount(this, RES_HEALTH)) SetResourceAmount(actor, RES_HEALTH, autocvar_g_monster_mage_health);
     if(!actor.speed) { actor.speed = (autocvar_g_monster_mage_speed_walk); }
     if(!actor.speed2) { actor.speed2 = (autocvar_g_monster_mage_speed_run); }
     if(!actor.stopspeed) { actor.stopspeed = (autocvar_g_monster_mage_speed_stop); }
index 21ec72aaa8076c4a4a43b865aaaec1a4f5bbef99..0e91599a8113c90fd4447d463953ea73653c90a0 100644 (file)
@@ -85,15 +85,15 @@ void M_Shambler_Attack_Lightning_Explode_use(entity this, entity actor, entity t
 
 void M_Shambler_Attack_Lightning_Damage(entity this, entity inflictor, entity attacker, float damage, int deathtype, .entity weaponentity, vector hitloc, vector force)
 {
-       if (GetResourceAmount(this, RESOURCE_HEALTH) <= 0)
+       if (GetResourceAmount(this, RES_HEALTH) <= 0)
                return;
 
        if (!W_CheckProjectileDamage(inflictor.realowner, this.realowner, deathtype, -1)) // no exceptions
                return; // g_projectiles_damage says to halt
 
-       TakeResource(this, RESOURCE_HEALTH, damage);
+       TakeResource(this, RES_HEALTH, damage);
 
-       if (GetResourceAmount(this, RESOURCE_HEALTH) <= 0)
+       if (GetResourceAmount(this, RES_HEALTH) <= 0)
                W_PrepareExplosionByDamage(this, attacker, adaptor_think2use);
 }
 
@@ -136,7 +136,7 @@ void M_Shambler_Attack_Lightning(entity this)
        settouch(gren, M_Shambler_Attack_Lightning_Touch);
 
        gren.takedamage = DAMAGE_YES;
-       SetResourceAmount(gren, RESOURCE_HEALTH, 50);
+       SetResourceAmount(gren, RES_HEALTH, 50);
        gren.damageforcescale = 0;
        gren.event_damage = M_Shambler_Attack_Lightning_Damage;
        gren.damagedbycontents = true;
@@ -246,7 +246,7 @@ METHOD(Shambler, mr_anim, bool(Shambler this, entity actor))
 METHOD(Shambler, mr_setup, bool(Shambler this, entity actor))
 {
     TC(Shambler, this);
-    if(!GetResourceAmount(this, RESOURCE_HEALTH)) SetResourceAmount(actor, RESOURCE_HEALTH, autocvar_g_monster_shambler_health);
+    if(!GetResourceAmount(this, RES_HEALTH)) SetResourceAmount(actor, RES_HEALTH, autocvar_g_monster_shambler_health);
     if(!actor.attack_range) actor.attack_range = 150;
     if(!actor.speed) { actor.speed = (autocvar_g_monster_shambler_speed_walk); }
     if(!actor.speed2) { actor.speed2 = (autocvar_g_monster_shambler_speed_run); }
index 1b454fe7c4cede2977f6d2f4b92918f1167a2cc1..7f3bd1e282710810a592f2ce59699643bdc84975 100644 (file)
@@ -103,7 +103,7 @@ void M_Spider_Attack_Web_Explode(entity this)
                Send_Effect(EFFECT_ELECTRO_IMPACT, this.origin, '0 0 0', 1);
                RadiusDamage(this, this.realowner, 0, 0, 25, NULL, NULL, 25, this.projectiledeathtype, DMG_NOWEP, NULL);
 
-               FOREACH_ENTITY_RADIUS(this.origin, 25, it != this && it.takedamage && !IS_DEAD(it) && GetResourceAmount(it, RESOURCE_HEALTH) > 0 && it.monsterid != MON_SPIDER.monsterid,
+               FOREACH_ENTITY_RADIUS(this.origin, 25, it != this && it.takedamage && !IS_DEAD(it) && GetResourceAmount(it, RES_HEALTH) > 0 && it.monsterid != MON_SPIDER.monsterid,
                {
                        it.spider_slowness = time + (autocvar_g_monster_spider_attack_web_damagetime);
                });
@@ -151,7 +151,7 @@ void M_Spider_Attack_Web(entity this)
        setsize(proj, '-4 -4 -4', '4 4 4');
        proj.takedamage = DAMAGE_NO;
        proj.damageforcescale = 0;
-       SetResourceAmount(proj, RESOURCE_HEALTH, 500);
+       SetResourceAmount(proj, RES_HEALTH, 500);
        proj.event_damage = func_null;
        proj.flags = FL_PROJECTILE;
        IL_PUSH(g_projectiles, proj);
@@ -227,7 +227,7 @@ METHOD(Spider, mr_anim, bool(Spider this, entity actor))
 METHOD(Spider, mr_setup, bool(Spider this, entity actor))
 {
     TC(Spider, this);
-    if(!GetResourceAmount(this, RESOURCE_HEALTH)) SetResourceAmount(actor, RESOURCE_HEALTH, autocvar_g_monster_spider_health);
+    if(!GetResourceAmount(this, RES_HEALTH)) SetResourceAmount(actor, RES_HEALTH, autocvar_g_monster_spider_health);
     if(!actor.speed) { actor.speed = (autocvar_g_monster_spider_speed_walk); }
     if(!actor.speed2) { actor.speed2 = (autocvar_g_monster_spider_speed_run); }
     if(!actor.stopspeed) { actor.stopspeed = (autocvar_g_monster_spider_speed_stop); }
index b1da1c2adcfc6d0a6ac6f4fdebdced5598e8a1ec..f2e835d67549e8e686516f6c1de260ea966dfd03 100644 (file)
@@ -152,7 +152,7 @@ METHOD(Wyvern, mr_anim, bool(Wyvern this, entity actor))
 METHOD(Wyvern, mr_setup, bool(Wyvern this, entity actor))
 {
     TC(Wyvern, this);
-    if(!GetResourceAmount(this, RESOURCE_HEALTH)) SetResourceAmount(actor, RESOURCE_HEALTH, autocvar_g_monster_wyvern_health);
+    if(!GetResourceAmount(this, RES_HEALTH)) SetResourceAmount(actor, RES_HEALTH, autocvar_g_monster_wyvern_health);
     if(!actor.speed) { actor.speed = (autocvar_g_monster_wyvern_speed_walk); }
     if(!actor.speed2) { actor.speed2 = (autocvar_g_monster_wyvern_speed_run); }
     if(!actor.stopspeed) { actor.stopspeed = (autocvar_g_monster_wyvern_speed_stop); }
index a219338343276fef8e08894e707987a5b93b9c2e..d8fcd11af79753156526470c8a03f3b703ba6102 100644 (file)
@@ -51,7 +51,7 @@ const float zombie_anim_spawn                         = 30;
 
 void M_Zombie_Attack_Leap_Touch(entity this, entity toucher)
 {
-       if (GetResourceAmount(this, RESOURCE_HEALTH) <= 0)
+       if (GetResourceAmount(this, RES_HEALTH) <= 0)
                return;
 
        vector angles_face;
@@ -74,16 +74,16 @@ void M_Zombie_Attack_Leap_Touch(entity this, entity toucher)
 
 void M_Zombie_Defend_Block_End(entity this)
 {
-       if(GetResourceAmount(this, RESOURCE_HEALTH) <= 0)
+       if(GetResourceAmount(this, RES_HEALTH) <= 0)
                return;
 
        setanim(this, this.anim_blockend, false, true, true);
-       SetResourceAmount(this, RESOURCE_ARMOR, autocvar_g_monsters_armor_blockpercent);
+       SetResourceAmount(this, RES_ARMOR, autocvar_g_monsters_armor_blockpercent);
 }
 
 bool M_Zombie_Defend_Block(entity this)
 {
-       SetResourceAmount(this, RESOURCE_ARMOR, 0.9);
+       SetResourceAmount(this, RES_ARMOR, 0.9);
        this.state = MONSTER_ATTACK_MELEE; // freeze monster
        this.attack_finished_single[0] = time + 2.1;
        this.anim_finished = this.attack_finished_single[0];
@@ -100,7 +100,7 @@ bool M_Zombie_Attack(int attack_type, entity actor, entity targ, .entity weapone
        {
                case MONSTER_ATTACK_MELEE:
                {
-                       if(random() < 0.3 && GetResourceAmount(actor, RESOURCE_HEALTH) < 75 && GetResourceAmount(actor.enemy, RESOURCE_HEALTH) > 10)
+                       if(random() < 0.3 && GetResourceAmount(actor, RES_HEALTH) < 75 && GetResourceAmount(actor.enemy, RES_HEALTH) > 10)
                                return M_Zombie_Defend_Block(actor);
 
                        float anim_chance = random();
@@ -148,7 +148,7 @@ METHOD(Zombie, mr_pain, float(Zombie this, entity actor, float damage_take, enti
 METHOD(Zombie, mr_death, bool(Zombie this, entity actor))
 {
     TC(Zombie, this);
-    SetResourceAmount(actor, RESOURCE_ARMOR, autocvar_g_monsters_armor_blockpercent);
+    SetResourceAmount(actor, RES_ARMOR, autocvar_g_monsters_armor_blockpercent);
 
     setanim(actor, ((random() > 0.5) ? actor.anim_die1 : actor.anim_die2), false, true, true);
     return true;
@@ -180,7 +180,7 @@ METHOD(Zombie, mr_anim, bool(Zombie this, entity actor))
 METHOD(Zombie, mr_setup, bool(Zombie this, entity actor))
 {
     TC(Zombie, this);
-    if(!GetResourceAmount(actor, RESOURCE_HEALTH)) SetResourceAmount(actor, RESOURCE_HEALTH, autocvar_g_monster_zombie_health);
+    if(!GetResourceAmount(actor, RES_HEALTH)) SetResourceAmount(actor, RES_HEALTH, autocvar_g_monster_zombie_health);
     if(!actor.speed) { actor.speed = (autocvar_g_monster_zombie_speed_walk); }
     if(!actor.speed2) { actor.speed2 = (autocvar_g_monster_zombie_speed_run); }
     if(!actor.stopspeed) { actor.stopspeed = (autocvar_g_monster_zombie_speed_stop); }
index 4018729bc1a1d033fea2bbc1e0dca5e2016caf70..698049187c0b701b0ac5711af303eba2f5709c7b 100644 (file)
@@ -84,7 +84,7 @@ bool Monster_ValidTarget(entity this, entity targ)
        || (game_stopped)
        || (targ.items & IT_INVISIBILITY)
        || (IS_SPEC(targ) || IS_OBSERVER(targ)) // don't attack spectators
-       || (!IS_VEHICLE(targ) && (IS_DEAD(targ) || IS_DEAD(this) || GetResourceAmount(targ, RESOURCE_HEALTH) <= 0 || GetResourceAmount(this, RESOURCE_HEALTH) <= 0))
+       || (!IS_VEHICLE(targ) && (IS_DEAD(targ) || IS_DEAD(this) || GetResourceAmount(targ, RES_HEALTH) <= 0 || GetResourceAmount(this, RES_HEALTH) <= 0))
        || (this.monster_follow == targ || targ.monster_follow == this)
        || (!IS_VEHICLE(targ) && (targ.flags & FL_NOTARGET))
        || (!autocvar_g_monsters_typefrag && PHYS_INPUT_BUTTON_CHAT(targ))
@@ -375,7 +375,7 @@ bool Monster_Attack_Leap_Check(entity this, vector vel)
                return false; // already attacking
        if(!IS_ONGROUND(this))
                return false; // not on the ground
-       if(GetResourceAmount(this, RESOURCE_HEALTH) <= 0 || IS_DEAD(this))
+       if(GetResourceAmount(this, RES_HEALTH) <= 0 || IS_DEAD(this))
                return false; // called when dead?
        if(time < this.attack_finished_single[0])
                return false; // still attacking
@@ -486,7 +486,7 @@ void Monster_Miniboss_Check(entity this)
        // g_monsters_miniboss_chance cvar or spawnflags 64 causes a monster to be a miniboss
        if ((this.spawnflags & MONSTERFLAG_MINIBOSS) || (chance < autocvar_g_monsters_miniboss_chance))
        {
-               GiveResource(this, RESOURCE_HEALTH, autocvar_g_monsters_miniboss_healthboost);
+               GiveResource(this, RES_HEALTH, autocvar_g_monsters_miniboss_healthboost);
                this.effects |= EF_RED;
                if(!this.weapon)
                        this.weapon = WEP_VORTEX.m_id;
@@ -531,7 +531,7 @@ void Monster_Dead_Fade(entity this)
                this.takedamage = DAMAGE_NO;
                setorigin(this, this.pos1);
                this.angles = this.pos2;
-               SetResourceAmount(this, RESOURCE_HEALTH, this.max_health);
+               SetResourceAmount(this, RES_HEALTH, this.max_health);
                setmodel(this, MDL_Null);
        }
        else
@@ -560,7 +560,7 @@ vector Monster_Move_Target(entity this, entity targ)
 
                // cases where the enemy may have changed their state (don't need to check everything here)
                if((!this.enemy)
-                       || (IS_DEAD(this.enemy) || GetResourceAmount(this.enemy, RESOURCE_HEALTH) < 1)
+                       || (IS_DEAD(this.enemy) || GetResourceAmount(this.enemy, RES_HEALTH) < 1)
                        || (STAT(FROZEN, this.enemy))
                        || (this.enemy.flags & FL_NOTARGET)
                        || (this.enemy.alpha < 0.5 && this.enemy.alpha != 0)
@@ -898,7 +898,7 @@ void Monster_Reset(entity this)
 
        Unfreeze(this, false); // remove any icy remains
 
-       SetResourceAmount(this, RESOURCE_HEALTH, this.max_health);
+       SetResourceAmount(this, RES_HEALTH, this.max_health);
        this.velocity = '0 0 0';
        this.enemy = NULL;
        this.goalentity = NULL;
@@ -908,11 +908,11 @@ void Monster_Reset(entity this)
 
 void Monster_Dead_Damage(entity this, entity inflictor, entity attacker, float damage, int deathtype, .entity weaponentity, vector hitloc, vector force)
 {
-       TakeResource(this, RESOURCE_HEALTH, damage);
+       TakeResource(this, RES_HEALTH, damage);
 
        Violence_GibSplash_At(hitloc, force, 2, bound(0, damage, 200) / 16, this, attacker);
 
-       if(GetResourceAmount(this, RESOURCE_HEALTH) <= -50) // 100 health until gone?
+       if(GetResourceAmount(this, RES_HEALTH) <= -50) // 100 health until gone?
        {
                Violence_GibSplash_At(hitloc, force, 2, bound(0, damage, 200) / 16, this, attacker);
 
@@ -1000,7 +1000,7 @@ void Monster_Damage(entity this, entity inflictor, entity attacker, float damage
        if(deathtype == DEATH_FALL.m_id && this.draggedby != NULL)
                return;
 
-       vector v = healtharmor_applydamage(100, GetResourceAmount(this, RESOURCE_ARMOR) / 100, deathtype, damage);
+       vector v = healtharmor_applydamage(100, GetResourceAmount(this, RES_ARMOR) / 100, deathtype, damage);
        float take = v.x;
        //float save = v.y;
 
@@ -1009,12 +1009,12 @@ void Monster_Damage(entity this, entity inflictor, entity attacker, float damage
 
        if(take)
        {
-               TakeResource(this, RESOURCE_HEALTH, take);
+               TakeResource(this, RES_HEALTH, take);
                Monster_Sound(this, monstersound_pain, 1.2, true, CH_PAIN);
        }
 
        if(this.sprite)
-               WaypointSprite_UpdateHealth(this.sprite, GetResourceAmount(this, RESOURCE_HEALTH));
+               WaypointSprite_UpdateHealth(this.sprite, GetResourceAmount(this, RES_HEALTH));
 
        this.dmg_time = time;
 
@@ -1032,7 +1032,7 @@ void Monster_Damage(entity this, entity inflictor, entity attacker, float damage
                        Violence_GibSplash_At(hitloc, force * -0.2, 3, 1, this, attacker);
        }
 
-       if(GetResourceAmount(this, RESOURCE_HEALTH) <= 0)
+       if(GetResourceAmount(this, RES_HEALTH) <= 0)
        {
                if(deathtype == DEATH_KILL.m_id)
                        this.candrop = false; // killed by mobkill command
@@ -1041,13 +1041,13 @@ void Monster_Damage(entity this, entity inflictor, entity attacker, float damage
                SUB_UseTargets(this, attacker, this.enemy);
                this.target2 = this.oldtarget2; // reset to original target on death, incase we respawn
 
-               Monster_Dead(this, attacker, (GetResourceAmount(this, RESOURCE_HEALTH) <= -100 || deathtype == DEATH_KILL.m_id));
+               Monster_Dead(this, attacker, (GetResourceAmount(this, RES_HEALTH) <= -100 || deathtype == DEATH_KILL.m_id));
 
                WaypointSprite_Kill(this.sprite);
 
                MUTATOR_CALLHOOK(MonsterDies, this, attacker, deathtype);
 
-               if(GetResourceAmount(this, RESOURCE_HEALTH) <= -100 || deathtype == DEATH_KILL.m_id) // check if we're already gibbed
+               if(GetResourceAmount(this, RES_HEALTH) <= -100 || deathtype == DEATH_KILL.m_id) // check if we're already gibbed
                {
                        Violence_GibSplash(this, 1, 0.5, attacker);
 
@@ -1059,13 +1059,13 @@ void Monster_Damage(entity this, entity inflictor, entity attacker, float damage
 
 bool Monster_Heal(entity targ, entity inflictor, float amount, float limit)
 {
-       float true_limit = ((limit != RESOURCE_LIMIT_NONE) ? limit : targ.max_health);
-       if(GetResourceAmount(targ, RESOURCE_HEALTH) <= 0 || GetResourceAmount(targ, RESOURCE_HEALTH) >= true_limit)
+       float true_limit = ((limit != RES_LIMIT_NONE) ? limit : targ.max_health);
+       if(GetResourceAmount(targ, RES_HEALTH) <= 0 || GetResourceAmount(targ, RES_HEALTH) >= true_limit)
                return false;
 
-       GiveResourceWithLimit(targ, RESOURCE_HEALTH, amount, true_limit);
+       GiveResourceWithLimit(targ, RES_HEALTH, amount, true_limit);
        if(targ.sprite)
-               WaypointSprite_UpdateHealth(targ.sprite, GetResourceAmount(targ, RESOURCE_HEALTH));
+               WaypointSprite_UpdateHealth(targ.sprite, GetResourceAmount(targ, RES_HEALTH));
        return true;
 }
 
@@ -1164,11 +1164,11 @@ void Monster_Frozen_Think(entity this)
        if (STAT(FROZEN, this) == FROZEN_TEMP_REVIVING)
        {
                STAT(REVIVE_PROGRESS, this) = bound(0, STAT(REVIVE_PROGRESS, this) + this.ticrate * this.revive_speed, 1);
-               SetResourceAmount(this, RESOURCE_HEALTH, max(1, STAT(REVIVE_PROGRESS, this) * this.max_health));
+               SetResourceAmount(this, RES_HEALTH, max(1, STAT(REVIVE_PROGRESS, this) * this.max_health));
                this.iceblock.alpha = bound(0.2, 1 - STAT(REVIVE_PROGRESS, this), 1);
 
                if(!(this.spawnflags & MONSTERFLAG_INVINCIBLE) && this.sprite)
-                       WaypointSprite_UpdateHealth(this.sprite, GetResourceAmount(this, RESOURCE_HEALTH));
+                       WaypointSprite_UpdateHealth(this.sprite, GetResourceAmount(this, RES_HEALTH));
 
                if(STAT(REVIVE_PROGRESS, this) >= 1)
                        Unfreeze(this, false);
@@ -1176,12 +1176,12 @@ void Monster_Frozen_Think(entity this)
        else if (STAT(FROZEN, this) == FROZEN_TEMP_DYING)
        {
                STAT(REVIVE_PROGRESS, this) = bound(0, STAT(REVIVE_PROGRESS, this) - this.ticrate * this.revive_speed, 1);
-               SetResourceAmount(this, RESOURCE_HEALTH, max(0, autocvar_g_nades_ice_health + (this.max_health-autocvar_g_nades_ice_health) * STAT(REVIVE_PROGRESS, this)));
+               SetResourceAmount(this, RES_HEALTH, max(0, autocvar_g_nades_ice_health + (this.max_health-autocvar_g_nades_ice_health) * STAT(REVIVE_PROGRESS, this)));
 
                if(!(this.spawnflags & MONSTERFLAG_INVINCIBLE) && this.sprite)
-                       WaypointSprite_UpdateHealth(this.sprite, GetResourceAmount(this, RESOURCE_HEALTH));
+                       WaypointSprite_UpdateHealth(this.sprite, GetResourceAmount(this, RES_HEALTH));
 
-               if(GetResourceAmount(this, RESOURCE_HEALTH) < 1)
+               if(GetResourceAmount(this, RES_HEALTH) < 1)
                {
                        Unfreeze(this, false);
                        if(this.event_damage)
@@ -1222,7 +1222,7 @@ void Monster_Think(entity this)
 
        if(this.monster_lifetime && time >= this.monster_lifetime)
        {
-               Damage(this, this, this, GetResourceAmount(this, RESOURCE_HEALTH) + this.max_health, DEATH_KILL.m_id, DMG_NOWEP, this.origin, this.origin);
+               Damage(this, this, this, GetResourceAmount(this, RES_HEALTH) + this.max_health, DEATH_KILL.m_id, DMG_NOWEP, this.origin, this.origin);
                return;
        }
 
@@ -1254,8 +1254,8 @@ bool Monster_Spawn_Setup(entity this)
        mon.mr_setup(mon, this);
 
        // ensure some basic needs are met
-       if(!GetResourceAmount(this, RESOURCE_HEALTH)) { SetResourceAmount(this, RESOURCE_HEALTH, 100); }
-       if(!GetResourceAmount(this, RESOURCE_ARMOR)) { SetResourceAmount(this, RESOURCE_ARMOR, bound(0.2, 0.5 * MONSTER_SKILLMOD(this), 0.9)); }
+       if(!GetResourceAmount(this, RES_HEALTH)) { SetResourceAmount(this, RES_HEALTH, 100); }
+       if(!GetResourceAmount(this, RES_ARMOR)) { SetResourceAmount(this, RES_ARMOR, bound(0.2, 0.5 * MONSTER_SKILLMOD(this), 0.9)); }
        if(!this.target_range) { this.target_range = autocvar_g_monsters_target_range; }
        if(!this.respawntime) { this.respawntime = autocvar_g_monsters_respawn_delay; }
        if(!this.monster_moveflags) { this.monster_moveflags = MONSTER_MOVE_WANDER; }
@@ -1265,13 +1265,13 @@ bool Monster_Spawn_Setup(entity this)
        if(!(this.spawnflags & MONSTERFLAG_RESPAWNED))
        {
                Monster_Miniboss_Check(this);
-               SetResourceAmount(this, RESOURCE_HEALTH, GetResourceAmount(this, RESOURCE_HEALTH) * MONSTER_SKILLMOD(this));
+               SetResourceAmount(this, RES_HEALTH, GetResourceAmount(this, RES_HEALTH) * MONSTER_SKILLMOD(this));
 
                if(!this.skin)
                        this.skin = rint(random() * 4);
        }
 
-       this.max_health = GetResourceAmount(this, RESOURCE_HEALTH);
+       this.max_health = GetResourceAmount(this, RES_HEALTH);
        this.pain_finished = this.nextthink;
 
        if(IS_PLAYER(this.monster_follow))
@@ -1300,7 +1300,7 @@ bool Monster_Spawn_Setup(entity this)
                if(!(this.spawnflags & MONSTERFLAG_INVINCIBLE))
                {
                        WaypointSprite_UpdateMaxHealth(this.sprite, this.max_health);
-                       WaypointSprite_UpdateHealth(this.sprite, GetResourceAmount(this, RESOURCE_HEALTH));
+                       WaypointSprite_UpdateHealth(this.sprite, GetResourceAmount(this, RES_HEALTH));
                }
        }
 
index 99093d16b1cb351347e4ca38b09476ee07790882..eafc5cb5b5837867fdcd4f9c661ecadd9a9f35b8 100644 (file)
@@ -10,7 +10,7 @@ MUTATOR_HOOKFUNCTION(bloodloss, PlayerPreThink)
        entity player = M_ARGV(0, entity);
 
        if(IS_PLAYER(player))
-       if(GetResourceAmount(player, RESOURCE_HEALTH) <= autocvar_g_bloodloss && !IS_DEAD(player))
+       if(GetResourceAmount(player, RES_HEALTH) <= autocvar_g_bloodloss && !IS_DEAD(player))
        {
                PHYS_INPUT_BUTTON_CROUCH(player) = true;
 
@@ -29,7 +29,7 @@ MUTATOR_HOOKFUNCTION(bloodloss, PlayerJump)
 {
        entity player = M_ARGV(0, entity);
 
-       if(GetResourceAmount(player, RESOURCE_HEALTH) <= autocvar_g_bloodloss)
+       if(GetResourceAmount(player, RES_HEALTH) <= autocvar_g_bloodloss)
                return true;
 }
 
index 73c24576ce0f53aa23865cefabd940d449366184..152f93d518772c2a530fa46b7c9ee099ea8ee491 100644 (file)
@@ -427,13 +427,13 @@ void buff_Medic_Heal(entity this)
                {
                        continue;
                }
-               float hp = GetResourceAmount(it, RESOURCE_HEALTH);
+               float hp = GetResourceAmount(it, RES_HEALTH);
                if(hp >= autocvar_g_balance_health_regenstable)
                {
                        continue;
                }
                Send_Effect(EFFECT_HEALING, it.origin, '0 0 0', 1);
-               SetResourceAmount(it, RESOURCE_HEALTH, bound(0, hp + autocvar_g_buffs_medic_heal_amount, autocvar_g_balance_health_regenstable));
+               SetResourceAmount(it, RES_HEALTH, bound(0, hp + autocvar_g_buffs_medic_heal_amount, autocvar_g_balance_health_regenstable));
        });
 }
 
@@ -464,11 +464,11 @@ MUTATOR_HOOKFUNCTION(buffs, Damage_Calculate)
                frag_damage *= autocvar_g_buffs_speed_damage_take;
 
        if(STAT(BUFFS, frag_target) & BUFF_MEDIC.m_itemid)
-       if((GetResourceAmount(frag_target, RESOURCE_HEALTH) - frag_damage) <= 0)
+       if((GetResourceAmount(frag_target, RES_HEALTH) - frag_damage) <= 0)
        if(!ITEM_DAMAGE_NEEDKILL(frag_deathtype))
        if(frag_attacker)
        if(random() <= autocvar_g_buffs_medic_survive_chance)
-               frag_damage = max(5, GetResourceAmount(frag_target, RESOURCE_HEALTH) - autocvar_g_buffs_medic_survive_health);
+               frag_damage = max(5, GetResourceAmount(frag_target, RES_HEALTH) - autocvar_g_buffs_medic_survive_health);
 
        if(STAT(BUFFS, frag_target) & BUFF_JUMP.m_itemid)
        if(frag_deathtype == DEATH_FALL.m_id)
@@ -544,13 +544,13 @@ MUTATOR_HOOKFUNCTION(buffs, Damage_Calculate)
        if(DIFF_TEAM(frag_attacker, frag_target))
        {
                float amount = bound(0, frag_damage * autocvar_g_buffs_vampire_damage_steal,
-                       GetResourceAmount(frag_target, RESOURCE_HEALTH));
-               GiveResourceWithLimit(frag_attacker, RESOURCE_HEALTH, amount, g_pickup_healthsmall_max);
-               if (GetResourceAmount(frag_target, RESOURCE_ARMOR))
+                       GetResourceAmount(frag_target, RES_HEALTH));
+               GiveResourceWithLimit(frag_attacker, RES_HEALTH, amount, g_pickup_healthsmall_max);
+               if (GetResourceAmount(frag_target, RES_ARMOR))
                {
                        amount = bound(0, frag_damage * autocvar_g_buffs_vampire_damage_steal,
-                               GetResourceAmount(frag_target, RESOURCE_ARMOR));
-                       GiveResourceWithLimit(frag_attacker, RESOURCE_ARMOR, amount, g_pickup_armorsmall_max);
+                               GetResourceAmount(frag_target, RES_ARMOR));
+                       GiveResourceWithLimit(frag_attacker, RES_ARMOR, amount, g_pickup_armorsmall_max);
                }
        }
 
index 8fbfa533dd1fd230058a52045159f46bd6e1ccbf..70339c9a3b2f238115a00fd07fb0c02476e424fe 100644 (file)
@@ -65,7 +65,7 @@ MUTATOR_HOOKFUNCTION(campcheck, PlayerPreThink)
                                if(player.vehicle)
                                        Damage(player.vehicle, NULL, NULL, autocvar_g_campcheck_damage * 2, DEATH_CAMP.m_id, DMG_NOWEP, player.vehicle.origin, '0 0 0');
                                else
-                                       Damage(player, NULL, NULL, bound(0, autocvar_g_campcheck_damage, GetResourceAmount(player, RESOURCE_HEALTH) + GetResourceAmount(player, RESOURCE_ARMOR) * autocvar_g_balance_armor_blockpercent + 5), DEATH_CAMP.m_id, DMG_NOWEP, player.origin, '0 0 0');
+                                       Damage(player, NULL, NULL, bound(0, autocvar_g_campcheck_damage, GetResourceAmount(player, RES_HEALTH) + GetResourceAmount(player, RES_ARMOR) * autocvar_g_balance_armor_blockpercent + 5), DEATH_CAMP.m_id, DMG_NOWEP, player.origin, '0 0 0');
                        }
                        player.campcheck_nextcheck = time + autocvar_g_campcheck_interval;
                        player.campcheck_traveled_distance = 0;
index d899d1ce4458ceb2872960f600b9c2d0201c52eb..bdcd97aae66c202032580dc4cdea1735c3908663 100644 (file)
@@ -18,8 +18,8 @@ SOUND(VaporizerCells, Item_Sound("itempickup"));
 int autocvar_g_instagib_ammo_drop;
 void ammo_vaporizercells_init(Pickup this, entity item)
 {
-    if(!GetResourceAmount(item, RESOURCE_CELLS))
-        SetResourceAmount(item, RESOURCE_CELLS, autocvar_g_instagib_ammo_drop);
+    if(!GetResourceAmount(item, RES_CELLS))
+        SetResourceAmount(item, RES_CELLS, autocvar_g_instagib_ammo_drop);
 }
 #endif
 REGISTER_ITEM(VaporizerCells, Ammo) {
index 3cda4485f1a3efde2bcb324335fbc2da635ea11b..d518665d2d3a1e72079c42e0458ec09a6a24f06c 100644 (file)
@@ -82,7 +82,7 @@ void instagib_ammocheck(entity this)
 
        if(IS_DEAD(this) || game_stopped)
                instagib_stop_countdown(this);
-       else if (GetResourceAmount(this, RESOURCE_CELLS) > 0 || (this.items & IT_UNLIMITED_WEAPON_AMMO) || (this.flags & FL_GODMODE))
+       else if (GetResourceAmount(this, RES_CELLS) > 0 || (this.items & IT_UNLIMITED_WEAPON_AMMO) || (this.flags & FL_GODMODE))
                instagib_stop_countdown(this);
        else if(autocvar_g_rm && autocvar_g_rm_laser)
        {
@@ -94,7 +94,7 @@ void instagib_ammocheck(entity this)
        }
        else
        {
-               float hp = GetResourceAmount(this, RESOURCE_HEALTH);
+               float hp = GetResourceAmount(this, RES_HEALTH);
                this.instagib_needammo = true;
                if (hp <= 5)
                {
@@ -328,11 +328,11 @@ MUTATOR_HOOKFUNCTION(mutator_instagib, Damage_Calculate)
                        if(!autocvar_g_instagib_friendlypush && SAME_TEAM(frag_target, frag_attacker))
                                frag_force = '0 0 0';
 
-                       float armor = GetResourceAmount(frag_target, RESOURCE_ARMOR);
+                       float armor = GetResourceAmount(frag_target, RES_ARMOR);
                        if(armor)
                        {
                                armor -= 1;
-                               SetResourceAmount(frag_target, RESOURCE_ARMOR, armor);
+                               SetResourceAmount(frag_target, RES_ARMOR, armor);
                                frag_damage = 0;
                                frag_target.damage_dealt += 1;
                                frag_attacker.damage_dealt += 1;
@@ -353,7 +353,7 @@ MUTATOR_HOOKFUNCTION(mutator_instagib, Damage_Calculate)
 
                                if(frag_target != frag_attacker)
                                {
-                                       if(frag_damage <= 0 && GetResourceAmount(frag_target, RESOURCE_HEALTH) > 0) { Send_Notification(NOTIF_ONE, frag_attacker, MSG_CENTER, CENTER_SECONDARY_NODAMAGE); }
+                                       if(frag_damage <= 0 && GetResourceAmount(frag_target, RES_HEALTH) > 0) { Send_Notification(NOTIF_ONE, frag_attacker, MSG_CENTER, CENTER_SECONDARY_NODAMAGE); }
                                        if(!autocvar_g_instagib_blaster_keepforce)
                                                frag_force = '0 0 0';
                                }
@@ -366,11 +366,11 @@ MUTATOR_HOOKFUNCTION(mutator_instagib, Damage_Calculate)
        if(frag_mirrordamage > 0)
        {
                // just lose extra LIVES, don't kill the player for mirror damage
-               float armor = GetResourceAmount(frag_attacker, RESOURCE_ARMOR);
+               float armor = GetResourceAmount(frag_attacker, RES_ARMOR);
                if(armor > 0)
                {
                        armor -= 1;
-                       SetResourceAmount(frag_attacker, RESOURCE_ARMOR, armor);
+                       SetResourceAmount(frag_attacker, RES_ARMOR, armor);
                        Send_Notification(NOTIF_ONE, frag_attacker, MSG_CENTER, CENTER_INSTAGIB_LIVES_REMAINING, armor);
                        frag_attacker.damage_dealt += frag_mirrordamage;
                }
@@ -458,7 +458,7 @@ MUTATOR_HOOKFUNCTION(mutator_instagib, FilterItem)
 
        if(item.weapon == WEP_VAPORIZER.m_id && Item_IsLoot(item))
        {
-               SetResourceAmount(item, RESOURCE_CELLS, autocvar_g_instagib_ammo_drop);
+               SetResourceAmount(item, RES_CELLS, autocvar_g_instagib_ammo_drop);
                return false;
        }
 
@@ -471,9 +471,9 @@ MUTATOR_HOOKFUNCTION(mutator_instagib, FilterItem)
        if(item.flags & FL_POWERUP)
                return false;
 
-       float cells = GetResourceAmount(item, RESOURCE_CELLS);
+       float cells = GetResourceAmount(item, RES_CELLS);
        if(cells > autocvar_g_instagib_ammo_drop && item.classname != "item_vaporizer_cells")
-               SetResourceAmount(item, RESOURCE_CELLS, autocvar_g_instagib_ammo_drop);
+               SetResourceAmount(item, RES_CELLS, autocvar_g_instagib_ammo_drop);
 
        if(cells && !item.weapon)
                return false;
@@ -508,10 +508,10 @@ MUTATOR_HOOKFUNCTION(mutator_instagib, ItemTouch)
        entity item = M_ARGV(0, entity);
        entity toucher = M_ARGV(1, entity);
 
-       if(GetResourceAmount(item, RESOURCE_CELLS))
+       if(GetResourceAmount(item, RES_CELLS))
        {
                // play some cool sounds ;)
-               float hp = GetResourceAmount(toucher, RESOURCE_HEALTH);
+               float hp = GetResourceAmount(toucher, RES_HEALTH);
                if (IS_CLIENT(toucher))
                {
                        if(hp <= 5)
@@ -521,14 +521,14 @@ MUTATOR_HOOKFUNCTION(mutator_instagib, ItemTouch)
                }
 
                if(hp < 100)
-                       SetResourceAmount(toucher, RESOURCE_HEALTH, 100);
+                       SetResourceAmount(toucher, RES_HEALTH, 100);
 
                return MUT_ITEMTOUCH_CONTINUE;
        }
 
        if(item.itemdef == ITEM_ExtraLife)
        {
-               GiveResource(toucher, RESOURCE_ARMOR, autocvar_g_instagib_extralives);
+               GiveResource(toucher, RES_ARMOR, autocvar_g_instagib_extralives);
                Send_Notification(NOTIF_ONE, toucher, MSG_CENTER, CENTER_EXTRALIVES);
                return MUT_ITEMTOUCH_PICKUP;
        }
index fa04e2a00dd32b08fa36eafebca1ac19512ab83b..74d16f3eae609b04a17ff411f326487abe8db6d9 100644 (file)
@@ -7,10 +7,10 @@ MUTATOR_HOOKFUNCTION(invincibleprojectiles, EditProjectile)
 {
        entity proj = M_ARGV(1, entity);
 
-       if(GetResourceAmount(proj, RESOURCE_HEALTH))
+       if(GetResourceAmount(proj, RES_HEALTH))
        {
                // disable health which in effect disables damage calculations
-               SetResourceAmount(proj, RESOURCE_HEALTH, 0);
+               SetResourceAmount(proj, RES_HEALTH, 0);
        }
 }
 
index 43de3b8cdc6482a91d8f561aec1a9b52f0c81bae..13e7138fa43c11b0b25307049a66b81f5d79b7a1 100644 (file)
@@ -440,7 +440,7 @@ void nade_ice_think(entity this)
 
        float current_freeze_time = this.ltime - time - 0.1;
 
-       FOREACH_ENTITY_RADIUS(this.origin, autocvar_g_nades_nade_radius, it != this && it.takedamage && !IS_DEAD(it) && GetResourceAmount(it, RESOURCE_HEALTH) > 0 && current_freeze_time > 0,
+       FOREACH_ENTITY_RADIUS(this.origin, autocvar_g_nades_nade_radius, it != this && it.takedamage && !IS_DEAD(it) && GetResourceAmount(it, RES_HEALTH) > 0 && current_freeze_time > 0,
        {
                if(!autocvar_g_nades_ice_teamcheck || (DIFF_TEAM(it, this.realowner) || it == this.realowner))
                if(!it.revival_time || ((time - it.revival_time) >= 1.5))
@@ -632,14 +632,14 @@ void nade_heal_touch(entity this, entity toucher)
                if ( health_factor > 0 )
                {
                        maxhealth = (IS_MONSTER(toucher)) ? toucher.max_health : g_pickup_healthmega_max;
-                       float hp = GetResourceAmount(toucher, RESOURCE_HEALTH);
+                       float hp = GetResourceAmount(toucher, RES_HEALTH);
                        if (hp < maxhealth)
                        {
                                if (this.nade_show_particles)
                                {
                                        Send_Effect(EFFECT_HEALING, toucher.origin, '0 0 0', 1);
                                }
-                               GiveResourceWithLimit(toucher, RESOURCE_HEALTH, health_factor, maxhealth);
+                               GiveResourceWithLimit(toucher, RES_HEALTH, health_factor, maxhealth);
                        }
                }
                else if ( health_factor < 0 )
@@ -814,7 +814,7 @@ void nade_touch(entity this, entity toucher)
 
        if(autocvar_g_nades_pickup)
        if(time >= this.spawnshieldtime)
-       if(!toucher.nade && GetResourceAmount(this, RESOURCE_HEALTH) == this.max_health) // no boosted shot pickups, thank you very much
+       if(!toucher.nade && GetResourceAmount(this, RES_HEALTH) == this.max_health) // no boosted shot pickups, thank you very much
        if(CanThrowNade(toucher)) // prevent some obvious things, like dead players
        if(IS_REAL_CLIENT(toucher)) // above checks for IS_PLAYER, don't need to do it here
        {
@@ -842,7 +842,7 @@ void nade_touch(entity this, entity toucher)
 
        //setsize(this, '-2 -2 -2', '2 2 2');
        //UpdateCSQCProjectile(this);
-       if(GetResourceAmount(this, RESOURCE_HEALTH) == this.max_health)
+       if(GetResourceAmount(this, RES_HEALTH) == this.max_health)
        {
                spamsound(this, CH_SHOTS, SND_GRENADE_BOUNCE_RANDOM(), VOL_BASE, ATTEN_NORM);
                return;
@@ -906,7 +906,7 @@ void nade_damage(entity this, entity inflictor, entity attacker, float damage, i
        if(damage <= 0 || ((IS_ONGROUND(this)) && IS_PLAYER(attacker)))
                return;
 
-       float hp = GetResourceAmount(this, RESOURCE_HEALTH);
+       float hp = GetResourceAmount(this, RES_HEALTH);
        if(hp == this.max_health)
        {
                sound(this, CH_SHOTS_SINGLE, SND_Null, VOL_BASE, 0.5 *(ATTEN_LARGE + ATTEN_MAX));
@@ -915,7 +915,7 @@ void nade_damage(entity this, entity inflictor, entity attacker, float damage, i
        }
 
        hp -= damage;
-       SetResourceAmount(this, RESOURCE_HEALTH, hp);
+       SetResourceAmount(this, RES_HEALTH, hp);
 
 
        if ( STAT(NADE_BONUS_TYPE, this) != NADE_TYPE_HEAL.m_id || IS_PLAYER(attacker) )
@@ -977,8 +977,8 @@ void toss_nade(entity e, bool set_owner, vector _velocity, float _time)
 
        settouch(_nade, nade_touch);
        _nade.spawnshieldtime = time + 0.1; // prevent instantly picking up again
-       SetResourceAmount(_nade, RESOURCE_HEALTH, autocvar_g_nades_nade_health);
-       _nade.max_health = GetResourceAmount(_nade, RESOURCE_HEALTH);
+       SetResourceAmount(_nade, RES_HEALTH, autocvar_g_nades_nade_health);
+       _nade.max_health = GetResourceAmount(_nade, RES_HEALTH);
        _nade.takedamage = DAMAGE_AIM;
        _nade.event_damage = nade_damage;
        setcefc(_nade, func_null);
@@ -1359,7 +1359,7 @@ MUTATOR_HOOKFUNCTION(nades, PlayerPreThink)
        if (n > 0 && STAT(FROZEN, player) == FROZEN_TEMP_DYING) // OK, there is at least one teammate reviving us
        {
                STAT(REVIVE_PROGRESS, player) = bound(0, STAT(REVIVE_PROGRESS, player) + frametime * max(1/60, autocvar_g_freezetag_revive_speed), 1);
-               SetResourceAmount(player, RESOURCE_HEALTH, max(1, STAT(REVIVE_PROGRESS, player) * start_health));
+               SetResourceAmount(player, RES_HEALTH, max(1, STAT(REVIVE_PROGRESS, player) * start_health));
 
                if(STAT(REVIVE_PROGRESS, player) >= 1)
                {
@@ -1479,7 +1479,7 @@ MUTATOR_HOOKFUNCTION(nades, Damage_Calculate)
        if(time - frag_inflictor.toss_time <= 0.1)
        {
                Unfreeze(frag_target, false);
-               SetResourceAmount(frag_target, RESOURCE_HEALTH, autocvar_g_freezetag_revive_nade_health);
+               SetResourceAmount(frag_target, RES_HEALTH, autocvar_g_freezetag_revive_nade_health);
                Send_Effect(EFFECT_ICEORGLASS, frag_target.origin, '0 0 0', 3);
                M_ARGV(4, float) = 0;
                M_ARGV(6, vector) = '0 0 0';
index 6c48a8ec6e5ee6a6f3bbba1dc8d5b72a3c22ab9a..acf24936bf5c55f6be5e48dc35092c4a21d6e0ed 100644 (file)
@@ -32,7 +32,7 @@ void orb_setup(entity e)
 
        e.draw = orb_draw;
        IL_PUSH(g_drawables, e);
-       SetResourceAmount(e, RESOURCE_HEALTH, 255);
+       SetResourceAmount(e, RES_HEALTH, 255);
        set_movetype(e, MOVETYPE_NONE);
        e.solid = SOLID_NOT;
        e.drawmask = MASK_NORMAL;
index 586deda3efbb4aa6fcc5dc6d00de5bad6d5184c5..b50a273ad3e117c4c8098fede8a616430f001ce1 100644 (file)
@@ -57,12 +57,12 @@ REGISTER_MUTATOR(nix, expr_evaluate(cvar_string("g_nix")) && !MUTATOR_IS_ENABLED
        {
                // as the PlayerSpawn hook will no longer run, NIX is turned off by this!
                FOREACH_CLIENT(IS_PLAYER(it) && !IS_DEAD(it), {
-                       SetResourceAmount(it, RESOURCE_SHELLS, start_ammo_shells);
-                       SetResourceAmount(it, RESOURCE_BULLETS, start_ammo_nails);
-                       SetResourceAmount(it, RESOURCE_ROCKETS, start_ammo_rockets);
-                       SetResourceAmount(it, RESOURCE_CELLS, start_ammo_cells);
-                       SetResourceAmount(it, RESOURCE_PLASMA, start_ammo_plasma);
-                       SetResourceAmount(it, RESOURCE_FUEL, start_ammo_fuel);
+                       SetResourceAmount(it, RES_SHELLS, start_ammo_shells);
+                       SetResourceAmount(it, RES_BULLETS, start_ammo_nails);
+                       SetResourceAmount(it, RES_ROCKETS, start_ammo_rockets);
+                       SetResourceAmount(it, RES_CELLS, start_ammo_cells);
+                       SetResourceAmount(it, RES_PLASMA, start_ammo_plasma);
+                       SetResourceAmount(it, RES_FUEL, start_ammo_fuel);
                        STAT(WEAPONS, it) = start_weapons;
                        for(int slot = 0; slot < MAX_WEAPONSLOTS; ++slot)
                        {
@@ -134,34 +134,34 @@ void NIX_GiveCurrentWeapon(entity this)
 
        if(nix_nextchange != this.nix_lastchange_id) // this shall only be called once per round!
        {
-               SetResourceAmount(this, RESOURCE_SHELLS, 0);
-               SetResourceAmount(this, RESOURCE_BULLETS, 0);
-               SetResourceAmount(this, RESOURCE_ROCKETS, 0);
-               SetResourceAmount(this, RESOURCE_CELLS, 0);
-               SetResourceAmount(this, RESOURCE_PLASMA, 0);
-               SetResourceAmount(this, RESOURCE_FUEL, 0);
+               SetResourceAmount(this, RES_SHELLS, 0);
+               SetResourceAmount(this, RES_BULLETS, 0);
+               SetResourceAmount(this, RES_ROCKETS, 0);
+               SetResourceAmount(this, RES_CELLS, 0);
+               SetResourceAmount(this, RES_PLASMA, 0);
+               SetResourceAmount(this, RES_FUEL, 0);
                if(this.items & IT_UNLIMITED_WEAPON_AMMO)
                {
                        switch (wpn.ammo_type)
                        {
-                               case RESOURCE_SHELLS:  SetResourceAmount(this, RESOURCE_SHELLS, autocvar_g_pickup_shells_max);  break;
-                               case RESOURCE_BULLETS: SetResourceAmount(this, RESOURCE_BULLETS, autocvar_g_pickup_nails_max);   break;
-                               case RESOURCE_ROCKETS: SetResourceAmount(this, RESOURCE_ROCKETS, autocvar_g_pickup_rockets_max); break;
-                               case RESOURCE_CELLS:   SetResourceAmount(this, RESOURCE_CELLS, autocvar_g_pickup_cells_max);   break;
-                               case RESOURCE_PLASMA:  SetResourceAmount(this, RESOURCE_PLASMA, autocvar_g_pickup_plasma_max);   break;
-                               case RESOURCE_FUEL:    SetResourceAmount(this, RESOURCE_FUEL, autocvar_g_pickup_fuel_max);    break;
+                               case RES_SHELLS:  SetResourceAmount(this, RES_SHELLS, autocvar_g_pickup_shells_max);  break;
+                               case RES_BULLETS: SetResourceAmount(this, RES_BULLETS, autocvar_g_pickup_nails_max);   break;
+                               case RES_ROCKETS: SetResourceAmount(this, RES_ROCKETS, autocvar_g_pickup_rockets_max); break;
+                               case RES_CELLS:   SetResourceAmount(this, RES_CELLS, autocvar_g_pickup_cells_max);   break;
+                               case RES_PLASMA:  SetResourceAmount(this, RES_PLASMA, autocvar_g_pickup_plasma_max);   break;
+                               case RES_FUEL:    SetResourceAmount(this, RES_FUEL, autocvar_g_pickup_fuel_max);    break;
                        }
                }
                else
                {
                        switch (wpn.ammo_type)
                        {
-                               case RESOURCE_SHELLS:  SetResourceAmount(this, RESOURCE_SHELLS, autocvar_g_balance_nix_ammo_shells);  break;
-                               case RESOURCE_BULLETS: SetResourceAmount(this, RESOURCE_BULLETS, autocvar_g_balance_nix_ammo_nails);   break;
-                               case RESOURCE_ROCKETS: SetResourceAmount(this, RESOURCE_ROCKETS, autocvar_g_balance_nix_ammo_rockets); break;
-                               case RESOURCE_CELLS:   SetResourceAmount(this, RESOURCE_CELLS, autocvar_g_balance_nix_ammo_cells);   break;
-                               case RESOURCE_PLASMA:  SetResourceAmount(this, RESOURCE_PLASMA, autocvar_g_balance_nix_ammo_plasma);   break;
-                               case RESOURCE_FUEL:    SetResourceAmount(this, RESOURCE_FUEL, autocvar_g_balance_nix_ammo_fuel);    break;
+                               case RES_SHELLS:  SetResourceAmount(this, RES_SHELLS, autocvar_g_balance_nix_ammo_shells);  break;
+                               case RES_BULLETS: SetResourceAmount(this, RES_BULLETS, autocvar_g_balance_nix_ammo_nails);   break;
+                               case RES_ROCKETS: SetResourceAmount(this, RES_ROCKETS, autocvar_g_balance_nix_ammo_rockets); break;
+                               case RES_CELLS:   SetResourceAmount(this, RES_CELLS, autocvar_g_balance_nix_ammo_cells);   break;
+                               case RES_PLASMA:  SetResourceAmount(this, RES_PLASMA, autocvar_g_balance_nix_ammo_plasma);   break;
+                               case RES_FUEL:    SetResourceAmount(this, RES_FUEL, autocvar_g_balance_nix_ammo_fuel);    break;
                        }
                }
 
@@ -197,12 +197,12 @@ void NIX_GiveCurrentWeapon(entity this)
        {
                switch (wpn.ammo_type)
                {
-                       case RESOURCE_SHELLS:  GiveResource(this, RESOURCE_SHELLS, autocvar_g_balance_nix_ammoincr_shells);  break;
-                       case RESOURCE_BULLETS: GiveResource(this, RESOURCE_BULLETS, autocvar_g_balance_nix_ammoincr_nails);   break;
-                       case RESOURCE_ROCKETS: GiveResource(this, RESOURCE_ROCKETS, autocvar_g_balance_nix_ammoincr_rockets); break;
-                       case RESOURCE_CELLS:   GiveResource(this, RESOURCE_CELLS, autocvar_g_balance_nix_ammoincr_cells);   break;
-                       case RESOURCE_PLASMA:  GiveResource(this, RESOURCE_PLASMA, autocvar_g_balance_nix_ammoincr_plasma);   break;
-                       case RESOURCE_FUEL:    GiveResource(this, RESOURCE_FUEL, autocvar_g_balance_nix_ammoincr_fuel);    break;
+                       case RES_SHELLS:  GiveResource(this, RES_SHELLS, autocvar_g_balance_nix_ammoincr_shells);  break;
+                       case RES_BULLETS: GiveResource(this, RES_BULLETS, autocvar_g_balance_nix_ammoincr_nails);   break;
+                       case RES_ROCKETS: GiveResource(this, RES_ROCKETS, autocvar_g_balance_nix_ammoincr_rockets); break;
+                       case RES_CELLS:   GiveResource(this, RES_CELLS, autocvar_g_balance_nix_ammoincr_cells);   break;
+                       case RES_PLASMA:  GiveResource(this, RES_PLASMA, autocvar_g_balance_nix_ammoincr_plasma);   break;
+                       case RES_FUEL:    GiveResource(this, RES_FUEL, autocvar_g_balance_nix_ammoincr_fuel);    break;
                }
 
                this.nix_nextincr = time + autocvar_g_balance_nix_incrtime;
index b3c26644029699dc23bf4b02a8ba928463bc2ca5..68ddc9d9233bef0fcf6e6666015225965df70f1d 100644 (file)
@@ -4,7 +4,7 @@
 
 CLASS(OverkillHeavyMachineGun, Weapon)
 /* spawnfunc */ ATTRIB(OverkillHeavyMachineGun, m_canonical_spawnfunc, string, "weapon_okhmg");
-/* ammotype  */ ATTRIB(OverkillHeavyMachineGun, ammo_type, int, RESOURCE_BULLETS);
+/* ammotype  */ ATTRIB(OverkillHeavyMachineGun, ammo_type, int, RES_BULLETS);
 /* impulse   */ ATTRIB(OverkillHeavyMachineGun, impulse, int, 3);
 /* flags     */ ATTRIB(OverkillHeavyMachineGun, spawnflags, int, WEP_FLAG_MUTATORBLOCKED | WEP_FLAG_HIDDEN | WEP_FLAG_NORMAL | WEP_FLAG_RELOADABLE | WEP_TYPE_HITSCAN | WEP_FLAG_SUPERWEAPON);
 /* rating    */ ATTRIB(OverkillHeavyMachineGun, bot_pickupbasevalue, float, 10000);
index 32176da90a3b1713080854ec37508d1700a75b7f..321d92e2268a51cc352bd188aa2d1cadbe6a4848 100644 (file)
@@ -2,7 +2,7 @@
 
 CLASS(OverkillMachineGun, Weapon)
 /* spawnfunc */ ATTRIB(OverkillMachineGun, m_canonical_spawnfunc, string, "weapon_okmachinegun");
-/* ammotype  */ ATTRIB(OverkillMachineGun, ammo_type, int, RESOURCE_BULLETS);
+/* ammotype  */ ATTRIB(OverkillMachineGun, ammo_type, int, RES_BULLETS);
 /* impulse   */ ATTRIB(OverkillMachineGun, impulse, int, 3);
 /* flags        */ ATTRIB(OverkillMachineGun, spawnflags, int, WEP_FLAG_HIDDEN | WEP_FLAG_RELOADABLE | WEP_TYPE_HITSCAN | WEP_FLAG_PENETRATEWALLS | WEP_FLAG_MUTATORBLOCKED);
 /* rating      */ ATTRIB(OverkillMachineGun, bot_pickupbasevalue, float, 7000);
index ec8ceeb3902df4ed2cbdc7affa69d654cc9448c8..d03f40ff2e0049b05820d9a9c1078b694c798fb7 100644 (file)
@@ -2,7 +2,7 @@
 
 CLASS(OverkillNex, Weapon)
 /* spawnfunc */ ATTRIB(OverkillNex, m_canonical_spawnfunc, string, "weapon_oknex");
-/* ammotype  */ ATTRIB(OverkillNex, ammo_type, int, RESOURCE_CELLS);
+/* ammotype  */ ATTRIB(OverkillNex, ammo_type, int, RES_CELLS);
 /* impulse   */ ATTRIB(OverkillNex, impulse, int, 7);
 /* flags     */ ATTRIB(OverkillNex, spawnflags, int, WEP_FLAG_HIDDEN | WEP_FLAG_RELOADABLE | WEP_TYPE_HITSCAN | WEP_FLAG_MUTATORBLOCKED);
 /* rating    */ ATTRIB(OverkillNex, bot_pickupbasevalue, float, 8000);
index b5237b35df4f78c3dcdf27191dc2c49406de3e22..05c9f14cd9d532ab65b50d1ddc200c20e231af7c 100644 (file)
@@ -36,15 +36,15 @@ void W_OverkillRocketPropelledChainsaw_Touch (entity this, entity toucher)
 
 void W_OverkillRocketPropelledChainsaw_Damage(entity this, entity inflictor, entity attacker, float damage, int deathtype, .entity weaponentity, vector hitloc, vector force)
 {
-       if (GetResourceAmount(this, RESOURCE_HEALTH) <= 0)
+       if (GetResourceAmount(this, RES_HEALTH) <= 0)
                return;
 
        if (!W_CheckProjectileDamage(inflictor.realowner, this.realowner, deathtype, -1)) // no exceptions
                return; // g_projectiles_damage says to halt
 
-       TakeResource(this, RESOURCE_HEALTH, damage);
+       TakeResource(this, RES_HEALTH, damage);
 
-       if (GetResourceAmount(this, RESOURCE_HEALTH) <= 0)
+       if (GetResourceAmount(this, RES_HEALTH) <= 0)
                W_PrepareExplosionByDamage(this, attacker, W_OverkillRocketPropelledChainsaw_Explode_think);
 }
 
@@ -100,7 +100,7 @@ void W_OverkillRocketPropelledChainsaw_Attack(Weapon thiswep, entity actor, .ent
 
        missile.takedamage = DAMAGE_YES;
        missile.damageforcescale = WEP_CVAR_PRI(okrpc, damageforcescale);
-       SetResourceAmount(missile, RESOURCE_HEALTH, WEP_CVAR_PRI(okrpc, health));
+       SetResourceAmount(missile, RES_HEALTH, WEP_CVAR_PRI(okrpc, health));
        missile.event_damage = W_OverkillRocketPropelledChainsaw_Damage;
        missile.damagedbycontents = true;
        IL_PUSH(g_damagedbycontents, missile);
index 4f9bfe7b997e90becac4af7f943353bc6bcc0c14..7d95296f96a37d85b8416be36880a7e534db7115 100644 (file)
@@ -4,7 +4,7 @@
 
 CLASS(OverkillRocketPropelledChainsaw, Weapon)
 /* spawnfunc */ ATTRIB(OverkillRocketPropelledChainsaw, m_canonical_spawnfunc, string, "weapon_okrpc");
-/* ammotype  */ ATTRIB(OverkillRocketPropelledChainsaw, ammo_type, int, RESOURCE_ROCKETS);
+/* ammotype  */ ATTRIB(OverkillRocketPropelledChainsaw, ammo_type, int, RES_ROCKETS);
 /* impulse   */ ATTRIB(OverkillRocketPropelledChainsaw, impulse, int, 9);
 /* flags     */ ATTRIB(OverkillRocketPropelledChainsaw, spawnflags, int, WEP_FLAG_MUTATORBLOCKED | WEP_FLAG_HIDDEN | WEP_FLAG_NORMAL | WEP_FLAG_CANCLIMB | WEP_FLAG_RELOADABLE | WEP_TYPE_SPLASH | WEP_FLAG_SUPERWEAPON);
 /* rating    */ ATTRIB(OverkillRocketPropelledChainsaw, bot_pickupbasevalue, float, 10000);
index 1124baa68bff28fc72e75c9c4d4d2529384d3e7a..a830e6ac46f9035d46c14ea8d75d89579534b669 100644 (file)
@@ -2,7 +2,7 @@
 
 CLASS(OverkillShotgun, Weapon)
 /* spawnfunc */ ATTRIB(OverkillShotgun, m_canonical_spawnfunc, string, "weapon_okshotgun");
-/* ammotype  */ ATTRIB(OverkillShotgun, ammo_type, int, RESOURCE_SHELLS);
+/* ammotype  */ ATTRIB(OverkillShotgun, ammo_type, int, RES_SHELLS);
 /* impulse   */ ATTRIB(OverkillShotgun, impulse, int, 2);
 /* flags     */ ATTRIB(OverkillShotgun, spawnflags, int, WEP_FLAG_HIDDEN | WEP_FLAG_RELOADABLE | WEP_TYPE_HITSCAN | WEP_FLAG_MUTATORBLOCKED);
 /* rating    */ ATTRIB(OverkillShotgun, bot_pickupbasevalue, float, 6000);
index fdcc4beee5fb51ab89c4ca8774638aa435241d14..644206049a3bdcf4b31d4ceee1906b3eb72e2e11 100644 (file)
@@ -91,7 +91,7 @@ MUTATOR_HOOKFUNCTION(spawn_near_teammate, PlayerSpawn)
 
                        if (PHYS_INPUT_BUTTON_CHAT(it)) continue;
                        if (DIFF_TEAM(player, it)) continue;
-                       if (autocvar_g_spawn_near_teammate_ignore_spawnpoint_check_health && GetResourceAmount(it, RESOURCE_HEALTH) < autocvar_g_balance_health_regenstable) continue;
+                       if (autocvar_g_spawn_near_teammate_ignore_spawnpoint_check_health && GetResourceAmount(it, RES_HEALTH) < autocvar_g_balance_health_regenstable) continue;
                        if (IS_DEAD(it)) continue;
                        if (time < it.msnt_timer) continue;
                        if (time < it.spawnshieldtime) continue;
index 56198186f1492b1e27648ca7abe6491b6c0f4ce8..b4181d10e29528ca806592421642afbaeb1fa072 100644 (file)
@@ -13,8 +13,8 @@ MUTATOR_HOOKFUNCTION(vampire, PlayerDamage_SplitHealthArmor)
        if(frag_target != frag_attacker)
        if(!IS_DEAD(frag_target))
        {
-               GiveResource(frag_attacker, RESOURCE_HEALTH,
-                       bound(0, damage_take, GetResourceAmount(frag_target, RESOURCE_HEALTH)));
+               GiveResource(frag_attacker, RES_HEALTH,
+                       bound(0, damage_take, GetResourceAmount(frag_target, RES_HEALTH)));
        }
 }
 
index 5e090d394802fb3a37e401a7822ad889d594c249..83db6e3c0af7c5d5540407eae0f5881e8da214d0 100644 (file)
@@ -21,7 +21,7 @@ MUTATOR_HOOKFUNCTION(vh, GrappleHookThink)
        if(!STAT(FROZEN, thehook.aiment))
        if(time >= game_starttime)
        if(DIFF_TEAM(thehook.owner, thehook.aiment) || autocvar_g_vampirehook_teamheal)
-       if(GetResourceAmount(thehook.aiment, RESOURCE_HEALTH) > 0)
+       if(GetResourceAmount(thehook.aiment, RES_HEALTH) > 0)
        if(autocvar_g_vampirehook_damage)
        {
                thehook.last_dmg = time + autocvar_g_vampirehook_damagerate;
@@ -30,9 +30,9 @@ MUTATOR_HOOKFUNCTION(vh, GrappleHookThink)
                entity targ = ((SAME_TEAM(thehook.owner, thehook.aiment)) ? thehook.aiment : thehook.owner);
                // TODO: we can't do this due to an issue with globals and the mutator arguments
                //Heal(targ, thehook.owner, autocvar_g_vampirehook_health_steal, g_pickup_healthsmall_max);
-               SetResourceAmount(targ, RESOURCE_HEALTH, min(GetResourceAmount(targ, RESOURCE_HEALTH) + autocvar_g_vampirehook_health_steal, g_pickup_healthsmall_max));
+               SetResourceAmount(targ, RES_HEALTH, min(GetResourceAmount(targ, RES_HEALTH) + autocvar_g_vampirehook_health_steal, g_pickup_healthsmall_max));
 
                if(dmgent == thehook.owner)
-                       TakeResource(dmgent, RESOURCE_HEALTH, autocvar_g_vampirehook_damage); // FIXME: friendly fire?!
+                       TakeResource(dmgent, RES_HEALTH, autocvar_g_vampirehook_damage); // FIXME: friendly fire?!
        }
 }
index 3596aef750604b27ae84134de15e18aaf3c68a52..8f21651f3919f26f1599311f931f97fc5c0555c9 100644 (file)
@@ -34,7 +34,7 @@ bool WaypointSprite_SendEntity(entity this, entity to, float sendflags)
     {
         if (this.max_health)
         {
-            WriteByte(MSG_ENTITY, (GetResourceAmount(this, RESOURCE_HEALTH) / this.max_health) * 191.0);
+            WriteByte(MSG_ENTITY, (GetResourceAmount(this, RES_HEALTH) / this.max_health) * 191.0);
         }
         else
         {
@@ -130,7 +130,7 @@ void Ent_WaypointSprite(entity this, bool isnew)
         int t = ReadByte();
         if (t < 192)
         {
-            SetResourceAmount(this, RESOURCE_HEALTH, t / 191.0);
+            SetResourceAmount(this, RES_HEALTH, t / 191.0);
             this.build_finished = 0;
         }
         else
@@ -138,7 +138,7 @@ void Ent_WaypointSprite(entity this, bool isnew)
             t = (t - 192) * 256 + ReadByte();
             this.build_started = servertime;
             if (this.build_finished)
-                this.build_starthealth = bound(0, GetResourceAmount(this, RESOURCE_HEALTH), 1);
+                this.build_starthealth = bound(0, GetResourceAmount(this, RES_HEALTH), 1);
             else
                 this.build_starthealth = 0;
             this.build_finished = servertime + t / 32;
@@ -146,7 +146,7 @@ void Ent_WaypointSprite(entity this, bool isnew)
     }
     else
     {
-        SetResourceAmount(this, RESOURCE_HEALTH, -1);
+        SetResourceAmount(this, RES_HEALTH, -1);
         this.build_finished = 0;
     }
 
@@ -548,7 +548,7 @@ void Draw_WaypointSprite(entity this)
         LOG_INFOF("WARNING: sprite of name %s has no color, using pink so you notice it", spriteimage);
     }
 
-    float health_val = GetResourceAmount(this, RESOURCE_HEALTH);
+    float health_val = GetResourceAmount(this, RES_HEALTH);
     float blink_time = (health_val >= 0) ? (health_val * 10) : time;
     if (blink_time - floor(blink_time) > 0.5)
     {
@@ -652,14 +652,14 @@ void Draw_WaypointSprite(entity this)
         if (time < this.build_finished + 0.25)
         {
             if (time < this.build_started)
-                SetResourceAmount(this, RESOURCE_HEALTH, this.build_starthealth);
+                SetResourceAmount(this, RES_HEALTH, this.build_starthealth);
             else if (time < this.build_finished)
-                SetResourceAmount(this, RESOURCE_HEALTH, (time - this.build_started) / (this.build_finished - this.build_started) * (1 - this.build_starthealth) + this.build_starthealth);
+                SetResourceAmount(this, RES_HEALTH, (time - this.build_started) / (this.build_finished - this.build_started) * (1 - this.build_starthealth) + this.build_starthealth);
             else
-                SetResourceAmount(this, RESOURCE_HEALTH, 1);
+                SetResourceAmount(this, RES_HEALTH, 1);
         }
         else
-            SetResourceAmount(this, RESOURCE_HEALTH, -1);
+            SetResourceAmount(this, RES_HEALTH, -1);
     }
 
     o = drawspritearrow(o, ang, rgb, a, SPRITE_ARROW_SCALE * t);
@@ -707,7 +707,7 @@ void Draw_WaypointSprite(entity this)
     }
 
     draw_beginBoldFont();
-    if (GetResourceAmount(this, RESOURCE_HEALTH) >= 0)
+    if (GetResourceAmount(this, RES_HEALTH) >= 0)
     {
         float align = 0, marg;
         if (this.build_finished)
@@ -724,7 +724,7 @@ void Draw_WaypointSprite(entity this)
         drawhealthbar(
                 o,
                 0,
-                GetResourceAmount(this, RESOURCE_HEALTH),
+                GetResourceAmount(this, RES_HEALTH),
                 '0 0 0',
                 '0 0 0',
                 SPRITE_HEALTHBAR_WIDTH * t,
@@ -830,9 +830,9 @@ void WaypointSprite_UpdateHealth(entity e, float f)
 {
     f = bound(0, f, e.max_health);
     float step = e.max_health / 40;
-    if ((floor(f / step) != floor(GetResourceAmount(e, RESOURCE_HEALTH) / step)) || e.pain_finished)
+    if ((floor(f / step) != floor(GetResourceAmount(e, RES_HEALTH) / step)) || e.pain_finished)
     {
-        SetResourceAmount(e, RESOURCE_HEALTH, f);
+        SetResourceAmount(e, RES_HEALTH, f);
         e.pain_finished = 0;
         e.SendFlags |= 0x80;
     }
@@ -1159,10 +1159,10 @@ entity WaypointSprite_AttachCarrier(
 {
     WaypointSprite_Kill(carrier.waypointsprite_attached); // FC overrides attached
     entity e = WaypointSprite_Spawn(spr, 0, 0, carrier, '0 0 64', NULL, carrier.team, carrier, waypointsprite_attachedforcarrier, false, icon);
-    if (GetResourceAmount(carrier, RESOURCE_HEALTH))
+    if (GetResourceAmount(carrier, RES_HEALTH))
     {
         WaypointSprite_UpdateMaxHealth(e, 2 * healtharmor_maxdamage(start_health, start_armorvalue, autocvar_g_balance_armor_blockpercent, DEATH_WEAPON.m_id).x);
-        WaypointSprite_UpdateHealth(e, healtharmor_maxdamage(GetResourceAmount(carrier, RESOURCE_HEALTH), GetResourceAmount(carrier, RESOURCE_ARMOR), autocvar_g_balance_armor_blockpercent, DEATH_WEAPON.m_id).x);
+        WaypointSprite_UpdateHealth(e, healtharmor_maxdamage(GetResourceAmount(carrier, RES_HEALTH), GetResourceAmount(carrier, RES_ARMOR), autocvar_g_balance_armor_blockpercent, DEATH_WEAPON.m_id).x);
     }
     return e;
 }
index 56442d8be70c73accef5439bb91faa56dacfa5f9..da8c5ba6e1880050ca7d3e5e534e0affedf49b53 100644 (file)
@@ -632,12 +632,12 @@ string notif_arg_item_wepammo(float f1, float f2)
        Weapon wep = Weapons_from(f1);
        switch (wep.ammo_type)
        {
-               case RESOURCE_SHELLS:  ammoitems = ITEM_Shells.m_name;      break;
-               case RESOURCE_BULLETS: ammoitems = ITEM_Bullets.m_name;     break;
-               case RESOURCE_ROCKETS: ammoitems = ITEM_Rockets.m_name;     break;
-               case RESOURCE_CELLS:   ammoitems = ITEM_Cells.m_name;       break;
-               case RESOURCE_PLASMA:  ammoitems = ITEM_Plasma.m_name;      break;
-               case RESOURCE_FUEL:    ammoitems = ITEM_JetpackFuel.m_name; break;
+               case RES_SHELLS:  ammoitems = ITEM_Shells.m_name;      break;
+               case RES_BULLETS: ammoitems = ITEM_Bullets.m_name;     break;
+               case RES_ROCKETS: ammoitems = ITEM_Rockets.m_name;     break;
+               case RES_CELLS:   ammoitems = ITEM_Cells.m_name;       break;
+               case RES_PLASMA:  ammoitems = ITEM_Plasma.m_name;      break;
+               case RES_FUEL:    ammoitems = ITEM_JetpackFuel.m_name; break;
                default: return ""; // doesn't use ammo
        }
        return sprintf(_(" with %d %s"), f2, ammoitems);
index c38254982b13287d8d64c9a0ed4c8de451fbcf96..acef8c97ad183273d5e944e5c119838bc4d6eb54 100644 (file)
@@ -799,7 +799,7 @@ void PM_jetpack(entity this, float maxspd_mod, float dt)
 
 #ifdef SVQC
                if (!(ITEMS_STAT(this) & IT_UNLIMITED_WEAPON_AMMO))
-                       TakeResource(this, RESOURCE_FUEL, PHYS_JETPACK_FUEL(this) * dt * fvel * f);
+                       TakeResource(this, RES_FUEL, PHYS_JETPACK_FUEL(this) * dt * fvel * f);
 
                ITEMS_STAT(this) |= IT_USING_JETPACK;
 
index 8e33c649b3bf5e68e09b5050252f53f48002e8b7..81f4eb54a4a02979f071bbe5e3170f7f3c375f0c 100644 (file)
@@ -6,19 +6,19 @@
 /// \copyright GNU GPLv2 or any later version.
 
 /// \brief Unconditional maximum amount of resources the entity can have.
-const int RESOURCE_AMOUNT_HARD_LIMIT = 999;
-const int RESOURCE_LIMIT_NONE = -1;
+const int RES_AMOUNT_HARD_LIMIT = 999;
+const int RES_LIMIT_NONE = -1;
 
 /// \brief Describes the available resource types.
 enum
 {
-       RESOURCE_NONE, ///< Indicates the lack of resource. Use with caution.
-       RESOURCE_HEALTH, ///< Health.
-       RESOURCE_ARMOR, ///< Armor.
-       RESOURCE_SHELLS, ///< Shells (used by shotgun).
-       RESOURCE_BULLETS, ///< Bullets (used by machinegun, rifle, HMG)
-       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).
+       RES_NONE, ///< Indicates the lack of resource. Use with caution.
+       RES_HEALTH, ///< Health.
+       RES_ARMOR, ///< Armor.
+       RES_SHELLS, ///< Shells (used by shotgun).
+       RES_BULLETS, ///< Bullets (used by machinegun, rifle, HMG)
+       RES_ROCKETS, ///< Rockets (used by mortar, hagar, devastator, etc).
+       RES_CELLS, ///< Cells (used by electro, crylink, vortex, etc)
+       RES_PLASMA, ///< Plasma (unused).
+       RES_FUEL ///< Fuel (used by jetpack).
 };
index 9675816cc5701d5ae103765e36c5823fffe3dbe9..7c8365cebc82b64060b89a795cc6141fdd19c3ce 100644 (file)
@@ -717,7 +717,7 @@ void GiveRandomWeapons(entity receiver, int num_weapons, string weapon_names,
                        return;
                }
                STAT(WEAPONS, receiver) |= RandomSelection_chosen_ent.m_wepset;
-               if (RandomSelection_chosen_ent.ammo_type == RESOURCE_NONE)
+               if (RandomSelection_chosen_ent.ammo_type == RES_NONE)
                {
                        continue;
                }
@@ -732,28 +732,28 @@ void GiveRandomWeapons(entity receiver, int num_weapons, string weapon_names,
        }
 }
 
-float Item_GiveAmmoTo(entity item, entity player, int resource_type, float ammomax)
+float Item_GiveAmmoTo(entity item, entity player, int res_type, float ammomax)
 {
-       float amount = GetResourceAmount(item, resource_type);
+       float amount = GetResourceAmount(item, res_type);
        if (amount == 0)
        {
                return false;
        }
-       float player_amount = GetResourceAmount(player, resource_type);
+       float player_amount = GetResourceAmount(player, res_type);
        if (item.spawnshieldtime)
        {
                if ((player_amount >= ammomax) && (item.pickup_anyway <= 0))
                {
                        return false;
                }
-               GiveOrTakeResourceWithLimit(player, resource_type, amount, ammomax);
+               GiveOrTakeResourceWithLimit(player, res_type, amount, ammomax);
                return true;
        }
        if (g_weapon_stay != 2)
        {
                return false;
        }
-       GiveOrTakeResourceWithLimit(player, resource_type, amount, min(amount, ammomax));
+       GiveOrTakeResourceWithLimit(player, res_type, amount, min(amount, ammomax));
        return true;
 }
 
@@ -783,14 +783,14 @@ float Item_GiveTo(entity item, entity player)
                        }
                }
        }
-       pickedup |= Item_GiveAmmoTo(item, player, RESOURCE_HEALTH, item.max_health);
-       pickedup |= Item_GiveAmmoTo(item, player, RESOURCE_ARMOR, item.max_armorvalue);
-       pickedup |= Item_GiveAmmoTo(item, player, RESOURCE_SHELLS, g_pickup_shells_max);
-       pickedup |= Item_GiveAmmoTo(item, player, RESOURCE_BULLETS, g_pickup_nails_max);
-       pickedup |= Item_GiveAmmoTo(item, player, RESOURCE_ROCKETS, g_pickup_rockets_max);
-       pickedup |= Item_GiveAmmoTo(item, player, RESOURCE_CELLS, g_pickup_cells_max);
-       pickedup |= Item_GiveAmmoTo(item, player, RESOURCE_PLASMA, g_pickup_plasma_max);
-       pickedup |= Item_GiveAmmoTo(item, player, RESOURCE_FUEL, g_pickup_fuel_max);
+       pickedup |= Item_GiveAmmoTo(item, player, RES_HEALTH, item.max_health);
+       pickedup |= Item_GiveAmmoTo(item, player, RES_ARMOR, item.max_armorvalue);
+       pickedup |= Item_GiveAmmoTo(item, player, RES_SHELLS, g_pickup_shells_max);
+       pickedup |= Item_GiveAmmoTo(item, player, RES_BULLETS, g_pickup_nails_max);
+       pickedup |= Item_GiveAmmoTo(item, player, RES_ROCKETS, g_pickup_rockets_max);
+       pickedup |= Item_GiveAmmoTo(item, player, RES_CELLS, g_pickup_cells_max);
+       pickedup |= Item_GiveAmmoTo(item, player, RES_PLASMA, g_pickup_plasma_max);
+       pickedup |= Item_GiveAmmoTo(item, player, RES_FUEL, g_pickup_fuel_max);
        if (item.itemdef.instanceOfWeaponPickup)
        {
                WepSet w;
@@ -1075,12 +1075,12 @@ float ammo_pickupevalfunc(entity player, entity item)
        if(item.itemdef.instanceOfWeaponPickup)
        {
                entity ammo = NULL;
-               if(GetResourceAmount(item, RESOURCE_SHELLS))       { need_shells  = true; ammo = ITEM_Shells;      }
-               else if(GetResourceAmount(item, RESOURCE_BULLETS))   { need_nails   = true; ammo = ITEM_Bullets;     }
-               else if(GetResourceAmount(item, RESOURCE_ROCKETS)) { need_rockets = true; ammo = ITEM_Rockets;     }
-               else if(GetResourceAmount(item, RESOURCE_CELLS))   { need_cells   = true; ammo = ITEM_Cells;       }
-               else if(GetResourceAmount(item, RESOURCE_PLASMA))  { need_plasma  = true; ammo = ITEM_Plasma;      }
-               else if(GetResourceAmount(item, RESOURCE_FUEL))    { need_fuel    = true; ammo = ITEM_JetpackFuel; }
+               if(GetResourceAmount(item, RES_SHELLS))       { need_shells  = true; ammo = ITEM_Shells;      }
+               else if(GetResourceAmount(item, RES_BULLETS))   { need_nails   = true; ammo = ITEM_Bullets;     }
+               else if(GetResourceAmount(item, RES_ROCKETS)) { need_rockets = true; ammo = ITEM_Rockets;     }
+               else if(GetResourceAmount(item, RES_CELLS))   { need_cells   = true; ammo = ITEM_Cells;       }
+               else if(GetResourceAmount(item, RES_PLASMA))  { need_plasma  = true; ammo = ITEM_Plasma;      }
+               else if(GetResourceAmount(item, RES_FUEL))    { need_fuel    = true; ammo = ITEM_JetpackFuel; }
 
                if(!ammo)
                        return 0;
@@ -1095,12 +1095,12 @@ float ammo_pickupevalfunc(entity player, entity item)
 
                        switch(it.ammo_type)
                        {
-                               case RESOURCE_SHELLS:  need_shells  = true; break;
-                               case RESOURCE_BULLETS: need_nails   = true; break;
-                               case RESOURCE_ROCKETS: need_rockets = true; break;
-                               case RESOURCE_CELLS:   need_cells   = true; break;
-                               case RESOURCE_PLASMA:  need_plasma  = true; break;
-                               case RESOURCE_FUEL:    need_fuel    = true; break;
+                               case RES_SHELLS:  need_shells  = true; break;
+                               case RES_BULLETS: need_nails   = true; break;
+                               case RES_ROCKETS: need_rockets = true; break;
+                               case RES_CELLS:   need_cells   = true; break;
+                               case RES_PLASMA:  need_plasma  = true; break;
+                               case RES_FUEL:    need_fuel    = true; break;
                        }
                });
                rating = item.bot_pickupbasevalue;
@@ -1108,23 +1108,23 @@ float ammo_pickupevalfunc(entity player, entity item)
 
        float noammorating = 0.5;
 
-       if ((need_shells) && GetResourceAmount(item, RESOURCE_SHELLS) && (GetResourceAmount(player, RESOURCE_SHELLS) < g_pickup_shells_max))
-               c = GetResourceAmount(item, RESOURCE_SHELLS) / max(noammorating, GetResourceAmount(player, RESOURCE_SHELLS));
+       if ((need_shells) && GetResourceAmount(item, RES_SHELLS) && (GetResourceAmount(player, RES_SHELLS) < g_pickup_shells_max))
+               c = GetResourceAmount(item, RES_SHELLS) / max(noammorating, GetResourceAmount(player, RES_SHELLS));
 
-       if ((need_nails) && GetResourceAmount(item, RESOURCE_BULLETS) && (GetResourceAmount(player, RESOURCE_BULLETS) < g_pickup_nails_max))
-               c = GetResourceAmount(item, RESOURCE_BULLETS) / max(noammorating, GetResourceAmount(player, RESOURCE_BULLETS));
+       if ((need_nails) && GetResourceAmount(item, RES_BULLETS) && (GetResourceAmount(player, RES_BULLETS) < g_pickup_nails_max))
+               c = GetResourceAmount(item, RES_BULLETS) / max(noammorating, GetResourceAmount(player, RES_BULLETS));
 
-       if ((need_rockets) && GetResourceAmount(item, RESOURCE_ROCKETS) && (GetResourceAmount(player, RESOURCE_ROCKETS) < g_pickup_rockets_max))
-               c = GetResourceAmount(item, RESOURCE_ROCKETS) / max(noammorating, GetResourceAmount(player, RESOURCE_ROCKETS));
+       if ((need_rockets) && GetResourceAmount(item, RES_ROCKETS) && (GetResourceAmount(player, RES_ROCKETS) < g_pickup_rockets_max))
+               c = GetResourceAmount(item, RES_ROCKETS) / max(noammorating, GetResourceAmount(player, RES_ROCKETS));
 
-       if ((need_cells) && GetResourceAmount(item, RESOURCE_CELLS) && (GetResourceAmount(player, RESOURCE_CELLS) < g_pickup_cells_max))
-               c = GetResourceAmount(item, RESOURCE_CELLS) / max(noammorating, GetResourceAmount(player, RESOURCE_CELLS));
+       if ((need_cells) && GetResourceAmount(item, RES_CELLS) && (GetResourceAmount(player, RES_CELLS) < g_pickup_cells_max))
+               c = GetResourceAmount(item, RES_CELLS) / max(noammorating, GetResourceAmount(player, RES_CELLS));
 
-       if ((need_plasma) && GetResourceAmount(item, RESOURCE_PLASMA) && (GetResourceAmount(player, RESOURCE_PLASMA) < g_pickup_plasma_max))
-               c = GetResourceAmount(item, RESOURCE_PLASMA) / max(noammorating, GetResourceAmount(player, RESOURCE_PLASMA));
+       if ((need_plasma) && GetResourceAmount(item, RES_PLASMA) && (GetResourceAmount(player, RES_PLASMA) < g_pickup_plasma_max))
+               c = GetResourceAmount(item, RES_PLASMA) / max(noammorating, GetResourceAmount(player, RES_PLASMA));
 
-       if ((need_fuel) && GetResourceAmount(item, RESOURCE_FUEL) && (GetResourceAmount(player, RESOURCE_FUEL) < g_pickup_fuel_max))
-               c = GetResourceAmount(item, RESOURCE_FUEL) / max(noammorating, GetResourceAmount(player, RESOURCE_FUEL));
+       if ((need_fuel) && GetResourceAmount(item, RES_FUEL) && (GetResourceAmount(player, RES_FUEL) < g_pickup_fuel_max))
+               c = GetResourceAmount(item, RES_FUEL) / max(noammorating, GetResourceAmount(player, RES_FUEL));
 
        rating *= min(c, 2);
        if(wpn)
@@ -1137,8 +1137,8 @@ float healtharmor_pickupevalfunc(entity player, entity item)
        float c = 0;
        float rating = item.bot_pickupbasevalue;
 
-       float itemarmor = GetResourceAmount(item, RESOURCE_ARMOR);
-       float itemhealth = GetResourceAmount(item, RESOURCE_HEALTH);
+       float itemarmor = GetResourceAmount(item, RES_ARMOR);
+       float itemhealth = GetResourceAmount(item, RES_HEALTH);
 
        if(item.item_group)
        {
@@ -1146,11 +1146,11 @@ float healtharmor_pickupevalfunc(entity player, entity item)
                itemhealth *= min(4, item.item_group_count);
        }
 
-       if (itemarmor && (GetResourceAmount(player, RESOURCE_ARMOR) < item.max_armorvalue))
-               c = itemarmor / max(1, GetResourceAmount(player, RESOURCE_ARMOR) * 2/3 + GetResourceAmount(player, RESOURCE_HEALTH) * 1/3);
+       if (itemarmor && (GetResourceAmount(player, RES_ARMOR) < item.max_armorvalue))
+               c = itemarmor / max(1, GetResourceAmount(player, RES_ARMOR) * 2/3 + GetResourceAmount(player, RES_HEALTH) * 1/3);
 
-       if (itemhealth && (GetResourceAmount(player, RESOURCE_HEALTH) < item.max_health))
-               c = itemhealth / max(1, GetResourceAmount(player, RESOURCE_HEALTH));
+       if (itemhealth && (GetResourceAmount(player, RES_HEALTH) < item.max_health))
+               c = itemhealth / max(1, GetResourceAmount(player, RES_HEALTH));
 
        rating *= min(2, c);
        return rating;
@@ -1339,7 +1339,7 @@ void _StartItem(entity this, entity def, float defaultrespawntime, float default
                if(def.instanceOfPowerup)
                        this.ItemStatus |= ITS_ANIMATE1;
 
-               if(GetResourceAmount(this, RESOURCE_ARMOR) || GetResourceAmount(this, RESOURCE_HEALTH))
+               if(GetResourceAmount(this, RES_ARMOR) || GetResourceAmount(this, RES_HEALTH))
                        this.ItemStatus |= ITS_ANIMATE2;
        }
 
@@ -1559,14 +1559,14 @@ spawnfunc(target_items)
                this.netname = sprintf("%s %s%d %s", this.netname, valueprefix, this.superweapons_finished * boolean(this.items & IT_SUPERWEAPON), "superweapons");
                this.netname = sprintf("%s %s%d %s", this.netname, itemprefix, boolean(this.items & ITEM_Jetpack.m_itemid), "jetpack");
                this.netname = sprintf("%s %s%d %s", this.netname, itemprefix, boolean(this.items & ITEM_JetpackRegen.m_itemid), "fuel_regen");
-               if(GetResourceAmount(this, RESOURCE_SHELLS) != 0) this.netname = sprintf("%s %s%d %s", this.netname, valueprefix, max(0, GetResourceAmount(this, RESOURCE_SHELLS)), "shells");
-               if(GetResourceAmount(this, RESOURCE_BULLETS) != 0) this.netname = sprintf("%s %s%d %s", this.netname, valueprefix, max(0, GetResourceAmount(this, RESOURCE_BULLETS)), "nails");
-               if(GetResourceAmount(this, RESOURCE_ROCKETS) != 0) this.netname = sprintf("%s %s%d %s", this.netname, valueprefix, max(0, GetResourceAmount(this, RESOURCE_ROCKETS)), "rockets");
-               if(GetResourceAmount(this, RESOURCE_CELLS) != 0) this.netname = sprintf("%s %s%d %s", this.netname, valueprefix, max(0, GetResourceAmount(this, RESOURCE_CELLS)), "cells");
-               if(GetResourceAmount(this, RESOURCE_PLASMA) != 0) this.netname = sprintf("%s %s%d %s", this.netname, valueprefix, max(0, GetResourceAmount(this, RESOURCE_PLASMA)), "plasma");
-               if(GetResourceAmount(this, RESOURCE_FUEL) != 0) this.netname = sprintf("%s %s%d %s", this.netname, valueprefix, max(0, GetResourceAmount(this, RESOURCE_FUEL)), "fuel");
-               if(GetResourceAmount(this, RESOURCE_HEALTH) != 0) this.netname = sprintf("%s %s%d %s", this.netname, valueprefix, max(0, GetResourceAmount(this, RESOURCE_HEALTH)), "health");
-               if(GetResourceAmount(this, RESOURCE_ARMOR) != 0) this.netname = sprintf("%s %s%d %s", this.netname, valueprefix, max(0, GetResourceAmount(this, RESOURCE_ARMOR)), "armor");
+               if(GetResourceAmount(this, RES_SHELLS) != 0) this.netname = sprintf("%s %s%d %s", this.netname, valueprefix, max(0, GetResourceAmount(this, RES_SHELLS)), "shells");
+               if(GetResourceAmount(this, RES_BULLETS) != 0) this.netname = sprintf("%s %s%d %s", this.netname, valueprefix, max(0, GetResourceAmount(this, RES_BULLETS)), "nails");
+               if(GetResourceAmount(this, RES_ROCKETS) != 0) this.netname = sprintf("%s %s%d %s", this.netname, valueprefix, max(0, GetResourceAmount(this, RES_ROCKETS)), "rockets");
+               if(GetResourceAmount(this, RES_CELLS) != 0) this.netname = sprintf("%s %s%d %s", this.netname, valueprefix, max(0, GetResourceAmount(this, RES_CELLS)), "cells");
+               if(GetResourceAmount(this, RES_PLASMA) != 0) this.netname = sprintf("%s %s%d %s", this.netname, valueprefix, max(0, GetResourceAmount(this, RES_PLASMA)), "plasma");
+               if(GetResourceAmount(this, RES_FUEL) != 0) this.netname = sprintf("%s %s%d %s", this.netname, valueprefix, max(0, GetResourceAmount(this, RES_FUEL)), "fuel");
+               if(GetResourceAmount(this, RES_HEALTH) != 0) this.netname = sprintf("%s %s%d %s", this.netname, valueprefix, max(0, GetResourceAmount(this, RES_HEALTH)), "health");
+               if(GetResourceAmount(this, RES_ARMOR) != 0) this.netname = sprintf("%s %s%d %s", this.netname, valueprefix, max(0, GetResourceAmount(this, RES_ARMOR)), "armor");
                FOREACH(Buffs, it != BUFF_Null, this.netname = sprintf("%s %s%d %s", this.netname, itemprefix, !!(STAT(BUFFS, this) & (it.m_itemid)), it.m_name));
                FOREACH(Weapons, it != WEP_Null, this.netname = sprintf("%s %s%d %s", this.netname, itemprefix, !!(STAT(WEAPONS, this) & (it.m_wepset)), it.netname));
        }
@@ -1666,28 +1666,19 @@ void GiveRot(entity e, float v0, float v1, .float rotfield, float rottime, .floa
        else if(v0 > v1)
                e.(regenfield) = max(e.(regenfield), time + regentime);
 }
-bool GiveResourceValue(entity e, int resource_type, int op, int val)
+bool GiveResourceValue(entity e, int res_type, int op, int val)
 {
-       int v0 = GetResourceAmount(e, resource_type);
+       int v0 = GetResourceAmount(e, res_type);
        switch (op)
        {
-               case OP_SET:
-                       SetResourceAmount(e, resource_type, val);
-                       break;
-               case OP_MIN:
-                       SetResourceAmount(e, resource_type, max(v0, val)); // min 100 cells = at least 100 cells
-                       break;
-               case OP_MAX:
-                       SetResourceAmount(e, resource_type, min(v0, val));
-                       break;
-               case OP_PLUS:
-                       SetResourceAmount(e, resource_type, v0 + val);
-                       break;
-               case OP_MINUS:
-                       SetResourceAmount(e, resource_type, v0 - val);
-                       break;
+               // min 100 cells = at least 100 cells
+               case OP_SET: SetResourceAmount(e, res_type, val); break;
+               case OP_MIN: SetResourceAmount(e, res_type, max(v0, val)); break;
+               case OP_MAX: SetResourceAmount(e, res_type, min(v0, val)); break;
+               case OP_PLUS: SetResourceAmount(e, res_type, v0 + val); break;
+               case OP_MINUS: SetResourceAmount(e, res_type, v0 - val); break;
        }
-       int v1 = GetResourceAmount(e, resource_type);
+       int v1 = GetResourceAmount(e, res_type);
        return v0 != v1;
 }
 
@@ -1723,14 +1714,14 @@ float GiveItems(entity e, float beginarg, float endarg)
        PREGIVE(e, strength_finished);
        PREGIVE(e, invincible_finished);
        PREGIVE(e, superweapons_finished);
-       PREGIVE_RESOURCE(e, RESOURCE_BULLETS);
-       PREGIVE_RESOURCE(e, RESOURCE_CELLS);
-       PREGIVE_RESOURCE(e, RESOURCE_PLASMA);
-       PREGIVE_RESOURCE(e, RESOURCE_SHELLS);
-       PREGIVE_RESOURCE(e, RESOURCE_ROCKETS);
-       PREGIVE_RESOURCE(e, RESOURCE_FUEL);
-       PREGIVE_RESOURCE(e, RESOURCE_ARMOR);
-       PREGIVE_RESOURCE(e, RESOURCE_HEALTH);
+       PREGIVE_RESOURCE(e, RES_BULLETS);
+       PREGIVE_RESOURCE(e, RES_CELLS);
+       PREGIVE_RESOURCE(e, RES_PLASMA);
+       PREGIVE_RESOURCE(e, RES_SHELLS);
+       PREGIVE_RESOURCE(e, RES_ROCKETS);
+       PREGIVE_RESOURCE(e, RES_FUEL);
+       PREGIVE_RESOURCE(e, RES_ARMOR);
+       PREGIVE_RESOURCE(e, RES_HEALTH);
 
        for(i = beginarg; i < endarg; ++i)
        {
@@ -1767,19 +1758,19 @@ float GiveItems(entity e, float beginarg, float endarg)
                                got += GiveBit(e, items, IT_UNLIMITED_AMMO, op, val);
                        case "all":
                                got += GiveBit(e, items, ITEM_Jetpack.m_itemid, op, val);
-                               got += GiveResourceValue(e, RESOURCE_HEALTH, op, val);
-                               got += GiveResourceValue(e, RESOURCE_ARMOR, op, val);
+                               got += GiveResourceValue(e, RES_HEALTH, op, val);
+                               got += GiveResourceValue(e, RES_ARMOR, op, val);
                        case "allweapons":
                                FOREACH(Weapons, it != WEP_Null && !(it.spawnflags & WEP_FLAG_MUTATORBLOCKED), got += GiveWeapon(e, it.m_id, op, val));
                        //case "allbuffs": // all buffs makes a player god, do not want!
                                //FOREACH(Buffs, it != BUFF_Null, got += GiveBuff(e, it.m_itemid, op, val));
                        case "allammo":
-                               got += GiveResourceValue(e, RESOURCE_CELLS, op, val);
-                               got += GiveResourceValue(e, RESOURCE_PLASMA, op, val);
-                               got += GiveResourceValue(e, RESOURCE_SHELLS, op, val);
-                               got += GiveResourceValue(e, RESOURCE_BULLETS, op, val);
-                               got += GiveResourceValue(e, RESOURCE_ROCKETS, op, val);
-                               got += GiveResourceValue(e, RESOURCE_FUEL, op, val);
+                               got += GiveResourceValue(e, RES_CELLS, op, val);
+                               got += GiveResourceValue(e, RES_PLASMA, op, val);
+                               got += GiveResourceValue(e, RES_SHELLS, op, val);
+                               got += GiveResourceValue(e, RES_BULLETS, op, val);
+                               got += GiveResourceValue(e, RES_ROCKETS, op, val);
+                               got += GiveResourceValue(e, RES_FUEL, op, val);
                                break;
                        case "unlimited_ammo":
                                got += GiveBit(e, items, IT_UNLIMITED_AMMO, op, val);
@@ -1806,29 +1797,29 @@ float GiveItems(entity e, float beginarg, float endarg)
                                got += GiveValue(e, superweapons_finished, op, val);
                                break;
                        case "cells":
-                               got += GiveResourceValue(e, RESOURCE_CELLS, op, val);
+                               got += GiveResourceValue(e, RES_CELLS, op, val);
                                break;
                        case "plasma":
-                               got += GiveResourceValue(e, RESOURCE_PLASMA, op, val);
+                               got += GiveResourceValue(e, RES_PLASMA, op, val);
                                break;
                        case "shells":
-                               got += GiveResourceValue(e, RESOURCE_SHELLS, op, val);
+                               got += GiveResourceValue(e, RES_SHELLS, op, val);
                                break;
                        case "nails":
                        case "bullets":
-                               got += GiveResourceValue(e, RESOURCE_BULLETS, op, val);
+                               got += GiveResourceValue(e, RES_BULLETS, op, val);
                                break;
                        case "rockets":
-                               got += GiveResourceValue(e, RESOURCE_ROCKETS, op, val);
+                               got += GiveResourceValue(e, RES_ROCKETS, op, val);
                                break;
                        case "health":
-                               got += GiveResourceValue(e, RESOURCE_HEALTH, op, val);
+                               got += GiveResourceValue(e, RES_HEALTH, op, val);
                                break;
                        case "armor":
-                               got += GiveResourceValue(e, RESOURCE_ARMOR, op, val);
+                               got += GiveResourceValue(e, RES_ARMOR, op, val);
                                break;
                        case "fuel":
-                               got += GiveResourceValue(e, RESOURCE_FUEL, op, val);
+                               got += GiveResourceValue(e, RES_FUEL, op, val);
                                break;
                        default:
                                FOREACH(Buffs, it != BUFF_Null && Buff_UndeprecateName(cmd) == it.m_name,
@@ -1859,14 +1850,14 @@ float GiveItems(entity e, float beginarg, float endarg)
        POSTGIVE_VALUE(e, strength_finished, 1, SND_POWERUP, SND_POWEROFF);
        POSTGIVE_VALUE(e, invincible_finished, 1, SND_Shield, SND_POWEROFF);
        //POSTGIVE_VALUE(e, superweapons_finished, 1, SND_Null, SND_Null);
-       POSTGIVE_RESOURCE(e, RESOURCE_BULLETS, 0, SND_ITEMPICKUP, SND_Null);
-       POSTGIVE_RESOURCE(e, RESOURCE_CELLS, 0, SND_ITEMPICKUP, SND_Null);
-       POSTGIVE_RESOURCE(e, RESOURCE_PLASMA, 0, SND_ITEMPICKUP, SND_Null);
-       POSTGIVE_RESOURCE(e, RESOURCE_SHELLS, 0, SND_ITEMPICKUP, SND_Null);
-       POSTGIVE_RESOURCE(e, RESOURCE_ROCKETS, 0, SND_ITEMPICKUP, SND_Null);
-       POSTGIVE_RESOURCE_ROT(e, RESOURCE_FUEL, 1, pauserotfuel_finished, autocvar_g_balance_pause_fuel_rot, pauseregen_finished, autocvar_g_balance_pause_fuel_regen, SND_ITEMPICKUP, SND_Null);
-       POSTGIVE_RESOURCE_ROT(e, RESOURCE_ARMOR, 1, pauserotarmor_finished, autocvar_g_balance_pause_armor_rot, pauseregen_finished, autocvar_g_balance_pause_health_regen, SND_ARMOR25, SND_Null);
-       POSTGIVE_RESOURCE_ROT(e, RESOURCE_HEALTH, 1, pauserothealth_finished, autocvar_g_balance_pause_health_rot, pauseregen_finished, autocvar_g_balance_pause_health_regen, SND_MEGAHEALTH, SND_Null);
+       POSTGIVE_RESOURCE(e, RES_BULLETS, 0, SND_ITEMPICKUP, SND_Null);
+       POSTGIVE_RESOURCE(e, RES_CELLS, 0, SND_ITEMPICKUP, SND_Null);
+       POSTGIVE_RESOURCE(e, RES_PLASMA, 0, SND_ITEMPICKUP, SND_Null);
+       POSTGIVE_RESOURCE(e, RES_SHELLS, 0, SND_ITEMPICKUP, SND_Null);
+       POSTGIVE_RESOURCE(e, RES_ROCKETS, 0, SND_ITEMPICKUP, SND_Null);
+       POSTGIVE_RES_ROT(e, RES_FUEL, 1, pauserotfuel_finished, autocvar_g_balance_pause_fuel_rot, pauseregen_finished, autocvar_g_balance_pause_fuel_regen, SND_ITEMPICKUP, SND_Null);
+       POSTGIVE_RES_ROT(e, RES_ARMOR, 1, pauserotarmor_finished, autocvar_g_balance_pause_armor_rot, pauseregen_finished, autocvar_g_balance_pause_health_regen, SND_ARMOR25, SND_Null);
+       POSTGIVE_RES_ROT(e, RES_HEALTH, 1, pauserothealth_finished, autocvar_g_balance_pause_health_rot, pauseregen_finished, autocvar_g_balance_pause_health_regen, SND_MEGAHEALTH, SND_Null);
 
        if(e.superweapons_finished <= 0)
                if(STAT(WEAPONS, e) & WEPSET_SUPERWEAPONS)
index 4d3f45380069e9cd6fe397265e2c98291d2132ad..0cd0d58ca2c3f473b0eeb9495e838ce4ca3aad01 100644 (file)
@@ -82,7 +82,7 @@ void Item_ScheduleInitialRespawn(entity e);
 void GiveRandomWeapons(entity receiver, int num_weapons, string weapon_names,
        entity ammo_entity);
 
-float Item_GiveAmmoTo(entity item, entity player, int resource_type, float ammomax);
+float Item_GiveAmmoTo(entity item, entity player, int res_type, float ammomax);
 
 float Item_GiveTo(entity item, entity player);
 
@@ -132,7 +132,7 @@ spawnfunc(target_items);
 #define POSTGIVE_WEAPON(e,b,snd_incr,snd_decr) GiveSound((e), !!(save_weapons & WepSet_FromWeapon(b)), !!(STAT(WEAPONS, e) & WepSet_FromWeapon(b)), 0, snd_incr, snd_decr)
 #define POSTGIVE_BIT(e,f,b,snd_incr,snd_decr) GiveSound((e), save_##f & (b), (e).f & (b), 0, snd_incr, snd_decr)
 #define POSTGIVE_RESOURCE(e,f,t,snd_incr,snd_decr) GiveSound((e), save_##f, GetResourceAmount((e), (f)), t, snd_incr, snd_decr)
-#define POSTGIVE_RESOURCE_ROT(e,f,t,rotfield,rottime,regenfield,regentime,snd_incr,snd_decr) GiveRot((e),save_##f,GetResourceAmount((e),(f)),rotfield,rottime,regenfield,regentime);GiveSound((e),save_##f,GetResourceAmount((e),(f)),t,snd_incr,snd_decr)
+#define POSTGIVE_RES_ROT(e,f,t,rotfield,rottime,regenfield,regentime,snd_incr,snd_decr) GiveRot((e),save_##f,GetResourceAmount((e),(f)),rotfield,rottime,regenfield,regentime);GiveSound((e),save_##f,GetResourceAmount((e),(f)),t,snd_incr,snd_decr)
 #define POSTGIVE_VALUE(e,f,t,snd_incr,snd_decr) GiveSound((e), save_##f, (e).f, t, snd_incr, snd_decr)
 #define POSTGIVE_VALUE_ROT(e,f,t,rotfield,rottime,regenfield,regentime,snd_incr,snd_decr) GiveRot((e), save_##f, (e).f, rotfield, rottime, regenfield, regentime); GiveSound((e), save_##f, (e).f, t, snd_incr, snd_decr)
 
index 51d3bc7fcee9958d5169e823299e4790966e421a..194cd31d939493492f9e713881ccdf222dcc475f 100644 (file)
@@ -37,7 +37,7 @@ void turret_draw(entity this)
 
        this.tur_head.angles += dt * this.tur_head.avelocity;
 
-       if (GetResourceAmount(this, RESOURCE_HEALTH) < 127)
+       if (GetResourceAmount(this, RES_HEALTH) < 127)
        {
                dt = random();
 
@@ -45,11 +45,11 @@ void turret_draw(entity this)
                        te_spark(this.origin + '0 0 40', randomvec() * 256 + '0 0 256', 16);
        }
 
-       if(GetResourceAmount(this, RESOURCE_HEALTH) < 85)
+       if(GetResourceAmount(this, RES_HEALTH) < 85)
        if(dt < 0.01)
                pointparticles(EFFECT_SMOKE_LARGE, (this.origin + (randomvec() * 80)), '0 0 0', 1);
 
-       if(GetResourceAmount(this, RESOURCE_HEALTH) < 32)
+       if(GetResourceAmount(this, RES_HEALTH) < 32)
        if(dt < 0.015)
                pointparticles(EFFECT_SMOKE_SMALL, (this.origin + (randomvec() * 80)), '0 0 0', 1);
 
@@ -183,7 +183,7 @@ void turret_draw2d(entity this)
        drawhealthbar(
                        o,
                        0,
-                       GetResourceAmount(this, RESOURCE_HEALTH) / 255,
+                       GetResourceAmount(this, RES_HEALTH) / 255,
                        '0 0 0',
                        '0 0 0',
                        0.5 * SPRITE_HEALTHBAR_WIDTH * t,
@@ -224,7 +224,7 @@ void turret_construct(entity this, bool isnew)
        set_movetype(this.tur_head, MOVETYPE_NOCLIP);
        set_movetype(this, MOVETYPE_NOCLIP);
        this.tur_head.angles                    = this.angles;
-       SetResourceAmount(this, RESOURCE_HEALTH, 255);
+       SetResourceAmount(this, RES_HEALTH, 255);
        this.solid                                              = SOLID_BBOX;
        this.tur_head.solid                             = SOLID_NOT;
        set_movetype(this, MOVETYPE_NOCLIP);
@@ -425,7 +425,7 @@ NET_HANDLE(ENT_CLIENT_TURRET, bool isnew)
                }
 
                _tmp = ReadByte();
-               float myhp = GetResourceAmount(this, RESOURCE_HEALTH);
+               float myhp = GetResourceAmount(this, RES_HEALTH);
                if(_tmp == 0 && myhp != 0)
                        turret_die(this);
                else if(myhp && myhp > _tmp)
@@ -433,7 +433,7 @@ NET_HANDLE(ENT_CLIENT_TURRET, bool isnew)
                else if(myhp && myhp < _tmp)
                        this.helpme = 0; // we're being healed, don't spam help me waypoints
 
-               SetResourceAmount(this, RESOURCE_HEALTH, _tmp);
+               SetResourceAmount(this, RES_HEALTH, _tmp);
        }
        return true;
 }
index bcf25284a141ca176f2cf69ada88e4251f68d132..d853564b65d70dde4d19ddf10a0fc68e67fd2629 100644 (file)
@@ -185,7 +185,7 @@ void turret_die(entity this)
        this.event_heal = func_null;
        this.takedamage                  = DAMAGE_NO;
 
-       SetResourceAmount(this, RESOURCE_HEALTH, 0);
+       SetResourceAmount(this, RES_HEALTH, 0);
 
 // Go boom
        //RadiusDamage (this,this, min(this.ammo,50),min(this.ammo,50) * 0.25,250,NULL,min(this.ammo,50)*5,DEATH_TURRET,NULL);
@@ -231,7 +231,7 @@ void turret_damage(entity this, entity inflictor, entity attacker, float damage,
                        return;
        }
 
-       TakeResource(this, RESOURCE_HEALTH, damage);
+       TakeResource(this, RES_HEALTH, damage);
 
        // thorw head slightly off aim when hit?
        if (this.damage_flags & TFL_DMG_HEADSHAKE)
@@ -245,7 +245,7 @@ void turret_damage(entity this, entity inflictor, entity attacker, float damage,
        if (this.turret_flags & TUR_FLAG_MOVE)
                this.velocity = this.velocity + vforce;
 
-       if (GetResourceAmount(this, RESOURCE_HEALTH) <= 0)
+       if (GetResourceAmount(this, RES_HEALTH) <= 0)
        {
                this.event_damage                 = func_null;
                this.tur_head.event_damage = func_null;
@@ -261,11 +261,11 @@ void turret_damage(entity this, entity inflictor, entity attacker, float damage,
 
 bool turret_heal(entity targ, entity inflictor, float amount, float limit)
 {
-       float true_limit = ((limit != RESOURCE_LIMIT_NONE) ? limit : targ.max_health);
-       if(GetResourceAmount(targ, RESOURCE_HEALTH) <= 0 || GetResourceAmount(targ, RESOURCE_HEALTH) >= true_limit)
+       float true_limit = ((limit != RES_LIMIT_NONE) ? limit : targ.max_health);
+       if(GetResourceAmount(targ, RES_HEALTH) <= 0 || GetResourceAmount(targ, RES_HEALTH) >= true_limit)
                return false;
 
-       GiveResourceWithLimit(targ, RESOURCE_HEALTH, amount, true_limit);
+       GiveResourceWithLimit(targ, RES_HEALTH, amount, true_limit);
        targ.SendFlags |= TNSF_STATUS;
        return true;
 }
@@ -286,7 +286,7 @@ void turret_respawn(entity this)
        this.avelocity                          = '0 0 0';
        this.tur_head.avelocity         = this.avelocity;
        this.tur_head.angles            = this.idle_aim;
-       SetResourceAmount(this, RESOURCE_HEALTH, this.max_health);
+       SetResourceAmount(this, RES_HEALTH, this.max_health);
        this.enemy                                      = NULL;
        this.volly_counter                      = this.shot_volly;
        this.ammo                                       = this.ammo_max;
@@ -365,10 +365,10 @@ bool turret_send(entity this, entity to, float sf)
        {
                WriteByte(MSG_ENTITY, this.team);
 
-               if(GetResourceAmount(this, RESOURCE_HEALTH) <= 0)
+               if(GetResourceAmount(this, RES_HEALTH) <= 0)
                        WriteByte(MSG_ENTITY, 0);
                else
-                       WriteByte(MSG_ENTITY, ceil((GetResourceAmount(this, RESOURCE_HEALTH) / this.max_health) * 255));
+                       WriteByte(MSG_ENTITY, ceil((GetResourceAmount(this, RES_HEALTH) / this.max_health) * 255));
        }
 
        return true;
@@ -399,7 +399,7 @@ void load_unit_settings(entity ent, bool is_reload)
                ent.tur_head.angles = '0 0 0';
        }
 
-       SetResourceAmount(ent, RESOURCE_HEALTH, cvar(strcat(sbase,"_health")) * ent.turret_scale_health);
+       SetResourceAmount(ent, RES_HEALTH, cvar(strcat(sbase,"_health")) * ent.turret_scale_health);
        ent.respawntime = cvar(strcat(sbase,"_respawntime")) * ent.turret_scale_respawn;
 
        ent.shot_dmg             = cvar(strcat(sbase,"_shot_dmg")) * ent.turret_scale_damage;
@@ -466,9 +466,9 @@ void turret_projectile_touch(entity this, entity toucher)
 void turret_projectile_damage(entity this, entity inflictor, entity attacker, float damage, int deathtype, .entity weaponentity, vector hitloc, vector vforce)
 {
        this.velocity  += vforce;
-       TakeResource(this, RESOURCE_HEALTH, damage);
+       TakeResource(this, RES_HEALTH, damage);
        //this.realowner = attacker; // Dont change realowner, it does not make much sense for turrets
-       if(GetResourceAmount(this, RESOURCE_HEALTH) <= 0)
+       if(GetResourceAmount(this, RES_HEALTH) <= 0)
                W_PrepareExplosionByDamage(this, this.owner, turret_projectile_explode);
 }
 
@@ -498,7 +498,7 @@ entity turret_projectile(entity actor, Sound _snd, float _size, float _health, f
        PROJECTILE_MAKETRIGGER(proj);
        if(_health)
        {
-               SetResourceAmount(proj, RESOURCE_HEALTH, _health);
+               SetResourceAmount(proj, RES_HEALTH, _health);
                proj.takedamage  = DAMAGE_YES;
                proj.event_damage  = turret_projectile_damage;
        }
@@ -731,7 +731,7 @@ float turret_validate_target(entity e_turret, entity e_target, float validate_fl
                return -5;
 
        // Cant touch this
-       if (GetResourceAmount(e_target, RESOURCE_HEALTH) <= 0)
+       if (GetResourceAmount(e_target, RES_HEALTH) <= 0)
                return -6;
        else if (STAT(FROZEN, e_target))
                return -6;
@@ -1311,7 +1311,7 @@ bool turret_initialize(entity this, Turret tur)
 
        if(!this.team || !teamplay)             { this.team = FLOAT_MAX; }
        if(!this.ticrate)                               { this.ticrate = ((this.turret_flags & TUR_FLAG_SUPPORT) ? 0.2 : 0.1); }
-       if(!GetResourceAmount(this, RESOURCE_HEALTH)) { SetResourceAmount(this, RESOURCE_HEALTH, 1000); }
+       if(!GetResourceAmount(this, RES_HEALTH)) { SetResourceAmount(this, RES_HEALTH, 1000); }
        if(!this.shot_refire)                   { this.shot_refire = 1; }
        if(!this.tur_shotorg)                   { this.tur_shotorg = '50 0 50'; }
        if(!this.turret_flags)                  { this.turret_flags = TUR_FLAG_SPLASH | TUR_FLAG_MEDPROJ | TUR_FLAG_PLAYER; }
@@ -1368,7 +1368,7 @@ bool turret_initialize(entity this, Turret tur)
        this.effects                            = EF_NODRAW;
        this.netname                            = tur.turret_name;
        this.ticrate                            = bound(sys_frametime, this.ticrate, 60);
-       this.max_health                         = GetResourceAmount(this, RESOURCE_HEALTH);
+       this.max_health                         = GetResourceAmount(this, RES_HEALTH);
        this.target_validate_flags      = this.target_select_flags;
        this.ammo                                       = this.ammo_max;
        this.ammo_recharge                 *= this.ticrate;
index c0a0b177ee2d179afb99aeb774203521daf5eeeb..288ba29366c841186402828cf81de56c7f09d531 100644 (file)
@@ -228,7 +228,7 @@ void ewheel_draw(entity this)
     setorigin(this, this.origin + this.velocity * dt);
     this.tur_head.angles += dt * this.tur_head.avelocity;
 
-    if(GetResourceAmount(this, RESOURCE_HEALTH) < 127)
+    if(GetResourceAmount(this, RES_HEALTH) < 127)
     if(random() < 0.05)
         te_spark(this.origin + '0 0 40', randomvec() * 256 + '0 0 256', 16);
 }
index b68bfb77307a5f3ed243779deb9b3b717eacfad9..aef5225f1e053ac4e1df8a634c862175947cf41f 100644 (file)
@@ -251,7 +251,7 @@ bool hk_is_valid_target(entity this, entity proj, entity targ)
         return false;
 
     // Cant touch this
-    if ((targ.takedamage == DAMAGE_NO) || (GetResourceAmount(targ, RESOURCE_HEALTH) < 0))
+    if ((targ.takedamage == DAMAGE_NO) || (GetResourceAmount(targ, RES_HEALTH) < 0))
         return false;
 
     // player
index cdabf3391bab6167e572bd7e8050a251117da7a1..f0da6cf136905645f4609addef67f76370a23fe3 100644 (file)
@@ -86,10 +86,10 @@ void walker_rocket_touch(entity this, entity toucher)
 
 void walker_rocket_damage(entity this, entity inflictor, entity attacker, float damage, float deathtype, .entity weaponentity, vector hitloc, vector vforce)
 {
-    TakeResource(this, RESOURCE_HEALTH, damage);
+    TakeResource(this, RES_HEALTH, damage);
     this.velocity = this.velocity + vforce;
 
-    if (GetResourceAmount(this, RESOURCE_HEALTH) <= 0)
+    if (GetResourceAmount(this, RES_HEALTH) <= 0)
         W_PrepareExplosionByDamage(this, this.owner, walker_rocket_explode);
 }
 
@@ -218,7 +218,7 @@ void walker_fire_rocket(entity this, vector org)
     rocket.bot_dodgerating     = 50;
     rocket.takedamage           = DAMAGE_YES;
     rocket.damageforcescale   = 2;
-    SetResourceAmount(rocket, RESOURCE_HEALTH, 25);
+    SetResourceAmount(rocket, RES_HEALTH, 25);
     rocket.tur_shotorg         = randomvec() * 512;
     rocket.cnt                         = time + 1;
     rocket.enemy                         = this.enemy;
@@ -629,7 +629,7 @@ void walker_draw(entity this)
     setorigin(this, this.origin + this.velocity * dt);
     this.tur_head.angles += dt * this.tur_head.avelocity;
 
-    if(GetResourceAmount(this, RESOURCE_HEALTH) < 127)
+    if(GetResourceAmount(this, RES_HEALTH) < 127)
     if(random() < 0.15)
         te_spark(this.origin + '0 0 40', randomvec() * 256 + '0 0 256', 16);
 }
index d5bdb5c4fe6d710d13cc1efdb1d44c8f4da413b8..f4c749d70892363a85f8fd28ad3ca387220dea92 100644 (file)
@@ -205,9 +205,9 @@ void vehicles_projectile_damage(entity this, entity inflictor, entity attacker,
        if(inflictor.owner == this.owner)
                return;
 
-       TakeResource(this, RESOURCE_HEALTH, damage);
+       TakeResource(this, RES_HEALTH, damage);
        this.velocity += force;
-       if(GetResourceAmount(this, RESOURCE_HEALTH) < 1)
+       if(GetResourceAmount(this, RES_HEALTH) < 1)
        {
                this.takedamage = DAMAGE_NO;
                this.event_damage = func_null;
@@ -282,7 +282,7 @@ entity vehicles_projectile(entity this, string _mzlfx, Sound _mzlsound,
        {
                proj.takedamage    = DAMAGE_AIM;
                proj.event_damage        = vehicles_projectile_damage;
-               SetResourceAmount(proj, RESOURCE_HEALTH, _health);
+               SetResourceAmount(proj, RES_HEALTH, _health);
        }
        else
                proj.flags |= FL_NOTARGET;
@@ -587,7 +587,7 @@ void vehicles_regen(entity this, float timer, .float regen_field, float field_ma
        if(timer + rpause < time)
        {
                if(_healthscale)
-                       regen = regen * (GetResourceAmount(this, RESOURCE_HEALTH) / this.max_health);
+                       regen = regen * (GetResourceAmount(this, RES_HEALTH) / this.max_health);
 
                this.(regen_field) = min(this.(regen_field) + regen * delta_time, field_max);
 
@@ -630,7 +630,7 @@ void shieldhit_think(entity this)
 
 void vehicles_painframe(entity this)
 {
-       int myhealth = ((this.owner) ? this.owner.vehicle_health : ((GetResourceAmount(this, RESOURCE_HEALTH) / this.max_health) * 100));
+       int myhealth = ((this.owner) ? this.owner.vehicle_health : ((GetResourceAmount(this, RES_HEALTH) / this.max_health) * 100));
 
        if(myhealth <= 50)
        if(this.pain_frame < time)
@@ -703,7 +703,7 @@ void vehicles_damage(entity this, entity inflictor, entity attacker, float damag
 
                if(this.vehicle_shield < 0)
                {
-                       TakeResource(this, RESOURCE_HEALTH, fabs(this.vehicle_shield));
+                       TakeResource(this, RES_HEALTH, fabs(this.vehicle_shield));
                        this.vehicle_shieldent.colormod = '2 0 0';
                        this.vehicle_shield = 0;
                        this.vehicle_shieldent.alpha = 0.75;
@@ -718,7 +718,7 @@ void vehicles_damage(entity this, entity inflictor, entity attacker, float damag
        }
        else
        {
-               TakeResource(this, RESOURCE_HEALTH, damage);
+               TakeResource(this, RES_HEALTH, damage);
 
                if(sound_allowed(MSG_BROADCAST, attacker))
                        spamsound (this, CH_PAIN, SND_ONS_HIT2, VOL_BASE, ATTEN_NORM);  // FIXME: PLACEHOLDER
@@ -729,7 +729,7 @@ void vehicles_damage(entity this, entity inflictor, entity attacker, float damag
        else
                this.velocity += force;
 
-       if(GetResourceAmount(this, RESOURCE_HEALTH) <= 0)
+       if(GetResourceAmount(this, RES_HEALTH) <= 0)
        {
                if(this.owner)
                {
@@ -749,13 +749,13 @@ void vehicles_damage(entity this, entity inflictor, entity attacker, float damag
 
 bool vehicles_heal(entity targ, entity inflictor, float amount, float limit)
 {
-       float true_limit = ((limit != RESOURCE_LIMIT_NONE) ? limit : targ.max_health);
-       if(GetResourceAmount(targ, RESOURCE_HEALTH) <= 0 || GetResourceAmount(targ, RESOURCE_HEALTH) >= true_limit)
+       float true_limit = ((limit != RES_LIMIT_NONE) ? limit : targ.max_health);
+       if(GetResourceAmount(targ, RES_HEALTH) <= 0 || GetResourceAmount(targ, RES_HEALTH) >= true_limit)
                return false;
 
-       GiveResourceWithLimit(targ, RESOURCE_HEALTH, amount, true_limit);
+       GiveResourceWithLimit(targ, RES_HEALTH, amount, true_limit);
        if(targ.owner)
-               targ.owner.vehicle_health = (GetResourceAmount(targ, RESOURCE_HEALTH) / targ.max_health) * 100;
+               targ.owner.vehicle_health = (GetResourceAmount(targ, RES_HEALTH) / targ.max_health) * 100;
        return true;
 }
 
index d0bbdeddf95666c0bbd7fcc785bc64a190f367f3..55574eb8299a80d0167c69ce07052f89e933f0d0 100644 (file)
@@ -168,7 +168,7 @@ bool bumblebee_gunner_frame(entity this, float dt)
                                gun.attack_finished_single[0] = time + autocvar_g_vehicle_bumblebee_cannon_refire;
                        }
 
-       VEHICLE_UPDATE_PLAYER_RESOURCE(this, vehic, health, bumblebee, RESOURCE_HEALTH);
+       VEHICLE_UPDATE_PLAYER_RESOURCE(this, vehic, health, bumblebee, RES_HEALTH);
 
        if(vehic.vehicle_flags & VHF_HASSHIELD)
                VEHICLE_UPDATE_PLAYER(this, vehic, shield, bumblebee);
@@ -397,7 +397,7 @@ void bumblebee_regen(entity this, float dt)
                vehicles_regen(this, this.dmg_time, vehicle_shield, autocvar_g_vehicle_bumblebee_shield, autocvar_g_vehicle_bumblebee_shield_regen_pause, autocvar_g_vehicle_bumblebee_shield_regen, dt, true);
 
        if(this.vehicle_flags  & VHF_HEALTHREGEN)
-               vehicles_regen_resource(this, this.dmg_time, vehicle_health, autocvar_g_vehicle_bumblebee_health, autocvar_g_vehicle_bumblebee_health_regen_pause, autocvar_g_vehicle_bumblebee_health_regen, dt, false, RESOURCE_HEALTH);
+               vehicles_regen_resource(this, this.dmg_time, vehicle_health, autocvar_g_vehicle_bumblebee_health, autocvar_g_vehicle_bumblebee_health_regen_pause, autocvar_g_vehicle_bumblebee_health_regen, dt, false, RES_HEALTH);
 
        if(this.vehicle_flags  & VHF_ENERGYREGEN)
                vehicles_regen(this, this.wait, vehicle_energy, autocvar_g_vehicle_bumblebee_energy, autocvar_g_vehicle_bumblebee_energy_regen_pause, autocvar_g_vehicle_bumblebee_energy_regen, dt, false);
@@ -557,19 +557,19 @@ bool bumblebee_pilot_frame(entity this, float dt)
                                        {
                                                if(autocvar_g_vehicle_bumblebee_healgun_hps)
                                                {
-                                                       float hplimit = ((IS_PLAYER(trace_ent)) ? autocvar_g_vehicle_bumblebee_healgun_hmax : RESOURCE_LIMIT_NONE);
+                                                       float hplimit = ((IS_PLAYER(trace_ent)) ? autocvar_g_vehicle_bumblebee_healgun_hmax : RES_LIMIT_NONE);
                                                        Heal(trace_ent, this, autocvar_g_vehicle_bumblebee_healgun_hps * dt, hplimit);
                                                }
 
                                                if(IS_VEHICLE(trace_ent))
                                                {
-                                                       if(autocvar_g_vehicle_bumblebee_healgun_sps && GetResourceAmount(trace_ent, RESOURCE_HEALTH) <= trace_ent.max_health)
+                                                       if(autocvar_g_vehicle_bumblebee_healgun_sps && GetResourceAmount(trace_ent, RES_HEALTH) <= trace_ent.max_health)
                                                                trace_ent.vehicle_shield = min(trace_ent.vehicle_shield + autocvar_g_vehicle_bumblebee_healgun_sps * dt, trace_ent.tur_head.max_health);
                                                }
                                                else if(IS_CLIENT(trace_ent))
                                                {
-                                                       if(GetResourceAmount(trace_ent, RESOURCE_ARMOR) <= autocvar_g_vehicle_bumblebee_healgun_amax && autocvar_g_vehicle_bumblebee_healgun_aps)
-                                                               GiveResourceWithLimit(trace_ent, RESOURCE_ARMOR, autocvar_g_vehicle_bumblebee_healgun_aps * dt, autocvar_g_vehicle_bumblebee_healgun_amax);
+                                                       if(GetResourceAmount(trace_ent, RES_ARMOR) <= autocvar_g_vehicle_bumblebee_healgun_amax && autocvar_g_vehicle_bumblebee_healgun_aps)
+                                                               GiveResourceWithLimit(trace_ent, RES_ARMOR, autocvar_g_vehicle_bumblebee_healgun_aps * dt, autocvar_g_vehicle_bumblebee_healgun_amax);
                                                }
                                        }
                                }
@@ -592,7 +592,7 @@ bool bumblebee_pilot_frame(entity this, float dt)
        }
        */
 
-       VEHICLE_UPDATE_PLAYER_RESOURCE(this, vehic, health, bumblebee, RESOURCE_HEALTH);
+       VEHICLE_UPDATE_PLAYER_RESOURCE(this, vehic, health, bumblebee, RES_HEALTH);
        VEHICLE_UPDATE_PLAYER(this, vehic, energy, bumblebee);
 
        this.vehicle_ammo1 = (vehic.gun1.vehicle_energy / autocvar_g_vehicle_bumblebee_cannon_ammo) * 100;
@@ -802,7 +802,7 @@ METHOD(Bumblebee, vr_death, void(Bumblebee thisveh, entity instance))
 
     Send_Effect(EFFECT_EXPLOSION_MEDIUM, findbetterlocation(instance.origin, 16), '0 0 0', 1);
 
-    SetResourceAmount(instance, RESOURCE_HEALTH, 0);
+    SetResourceAmount(instance, RES_HEALTH, 0);
     instance.event_damage      = func_null;
     instance.solid                     = SOLID_NOT;
     instance.takedamage                = DAMAGE_NO;
@@ -887,7 +887,7 @@ METHOD(Bumblebee, vr_spawn, void(Bumblebee thisveh, entity instance))
     if(!autocvar_g_vehicle_bumblebee_swim)
        instance.dphitcontentsmask |= DPCONTENTS_LIQUIDSMASK;
 
-    SetResourceAmount(instance, RESOURCE_HEALTH, autocvar_g_vehicle_bumblebee_health);
+    SetResourceAmount(instance, RES_HEALTH, autocvar_g_vehicle_bumblebee_health);
     instance.vehicle_shield = autocvar_g_vehicle_bumblebee_shield;
     instance.solid = SOLID_BBOX;
     set_movetype(instance, MOVETYPE_TOSS);
@@ -914,8 +914,8 @@ METHOD(Bumblebee, vr_setup, void(Bumblebee thisveh, entity instance))
 
     instance.vehicle_exit = bumblebee_exit;
     instance.respawntime = autocvar_g_vehicle_bumblebee_respawntime;
-    SetResourceAmount(instance, RESOURCE_HEALTH, autocvar_g_vehicle_bumblebee_health);
-    instance.max_health = GetResourceAmount(instance, RESOURCE_HEALTH);
+    SetResourceAmount(instance, RES_HEALTH, autocvar_g_vehicle_bumblebee_health);
+    instance.max_health = GetResourceAmount(instance, RES_HEALTH);
     instance.vehicle_shield = autocvar_g_vehicle_bumblebee_shield;
 }
 
index 1cd442117ebb79b134d6ff3d93548b5c50ee957a..7428e07a13be680a2f92fdfef613b5414119ce0a 100644 (file)
@@ -359,12 +359,12 @@ bool racer_frame(entity this, float dt)
                vehicles_regen(vehic, vehic.dmg_time, vehicle_shield, autocvar_g_vehicle_racer_shield, autocvar_g_vehicle_racer_shield_regen_pause, autocvar_g_vehicle_racer_shield_regen, dt, true);
 
        if(vehic.vehicle_flags & VHF_HEALTHREGEN)
-               vehicles_regen_resource(vehic, vehic.dmg_time, vehicle_health, autocvar_g_vehicle_racer_health, autocvar_g_vehicle_racer_health_regen_pause, autocvar_g_vehicle_racer_health_regen, dt, false, RESOURCE_HEALTH);
+               vehicles_regen_resource(vehic, vehic.dmg_time, vehicle_health, autocvar_g_vehicle_racer_health, autocvar_g_vehicle_racer_health_regen_pause, autocvar_g_vehicle_racer_health_regen, dt, false, RES_HEALTH);
 
        if(vehic.vehicle_flags & VHF_ENERGYREGEN)
                vehicles_regen(vehic, vehic.wait, vehicle_energy, autocvar_g_vehicle_racer_energy, autocvar_g_vehicle_racer_energy_regen_pause, autocvar_g_vehicle_racer_energy_regen, dt, false);
 
-       VEHICLE_UPDATE_PLAYER_RESOURCE(player, vehic, health, racer, RESOURCE_HEALTH);
+       VEHICLE_UPDATE_PLAYER_RESOURCE(player, vehic, health, racer, RES_HEALTH);
        VEHICLE_UPDATE_PLAYER(player, vehic, energy, racer);
 
        if(vehic.vehicle_flags & VHF_HASSHIELD)
@@ -514,7 +514,7 @@ METHOD(Racer, vr_enter, void(Racer thisveh, entity instance))
 {
 #ifdef SVQC
     set_movetype(instance, MOVETYPE_BOUNCE);
-    instance.owner.vehicle_health = (GetResourceAmount(instance, RESOURCE_HEALTH) / autocvar_g_vehicle_racer_health)  * 100;
+    instance.owner.vehicle_health = (GetResourceAmount(instance, RES_HEALTH) / autocvar_g_vehicle_racer_health)  * 100;
     instance.owner.vehicle_shield = (instance.vehicle_shield / autocvar_g_vehicle_racer_shield)  * 100;
 
     if(instance.owner.flagcarried)
@@ -544,7 +544,7 @@ METHOD(Racer, vr_spawn, void(Racer thisveh, entity instance))
 
     setthink(instance, racer_think);
     instance.nextthink   = time;
-    SetResourceAmount(instance, RESOURCE_HEALTH, autocvar_g_vehicle_racer_health);
+    SetResourceAmount(instance, RES_HEALTH, autocvar_g_vehicle_racer_health);
     instance.vehicle_shield = autocvar_g_vehicle_racer_shield;
 
     set_movetype(instance, MOVETYPE_TOSS);
@@ -557,7 +557,7 @@ METHOD(Racer, vr_spawn, void(Racer thisveh, entity instance))
     instance.bouncefactor = autocvar_g_vehicle_racer_bouncefactor;
     instance.bouncestop = autocvar_g_vehicle_racer_bouncestop;
     instance.damageforcescale = 0.5;
-    SetResourceAmount(instance, RESOURCE_HEALTH, autocvar_g_vehicle_racer_health);
+    SetResourceAmount(instance, RES_HEALTH, autocvar_g_vehicle_racer_health);
     instance.vehicle_shield = autocvar_g_vehicle_racer_shield;
 #endif
 }
@@ -566,7 +566,7 @@ METHOD(Racer, vr_death, void(Racer thisveh, entity instance))
 {
 #ifdef SVQC
     setSendEntity(instance, func_null); // stop networking this racer (for now)
-    SetResourceAmount(instance, RESOURCE_HEALTH, 0);
+    SetResourceAmount(instance, RES_HEALTH, 0);
     instance.event_damage      = func_null;
     instance.solid                     = SOLID_CORPSE;
     instance.takedamage                = DAMAGE_NO;
@@ -625,9 +625,9 @@ METHOD(Racer, vr_setup, void(Racer thisveh, entity instance))
         instance.vehicle_flags |= VHF_HEALTHREGEN;
 
     instance.respawntime = autocvar_g_vehicle_racer_respawntime;
-    SetResourceAmount(instance, RESOURCE_HEALTH, autocvar_g_vehicle_racer_health);
+    SetResourceAmount(instance, RES_HEALTH, autocvar_g_vehicle_racer_health);
     instance.vehicle_shield = autocvar_g_vehicle_racer_shield;
-    instance.max_health = GetResourceAmount(instance, RESOURCE_HEALTH);
+    instance.max_health = GetResourceAmount(instance, RES_HEALTH);
 #endif
 
 #ifdef CSQC
index 8ec9e47d21e8a6e9a6f218ba3c09898aa112e0a7..ad8440a5eb74f7ea3fd3aa42a044a224c7a29dfe 100644 (file)
@@ -369,7 +369,7 @@ bool raptor_frame(entity this, float dt)
                vehicles_regen(vehic, vehic.dmg_time, vehicle_shield, autocvar_g_vehicle_raptor_shield, autocvar_g_vehicle_raptor_shield_regen_pause, autocvar_g_vehicle_raptor_shield_regen, dt, true);
 
        if(vehic.vehicle_flags  & VHF_HEALTHREGEN)
-               vehicles_regen_resource(vehic, vehic.dmg_time, vehicle_health, autocvar_g_vehicle_raptor_health, autocvar_g_vehicle_raptor_health_regen_pause, autocvar_g_vehicle_raptor_health_regen, dt, false, RESOURCE_HEALTH);
+               vehicles_regen_resource(vehic, vehic.dmg_time, vehicle_health, autocvar_g_vehicle_raptor_health, autocvar_g_vehicle_raptor_health_regen_pause, autocvar_g_vehicle_raptor_health_regen, dt, false, RES_HEALTH);
 
        if(vehic.vehicle_flags  & VHF_ENERGYREGEN)
                vehicles_regen(vehic, vehic.cnt, vehicle_energy, autocvar_g_vehicle_raptor_energy, autocvar_g_vehicle_raptor_energy_regen_pause, autocvar_g_vehicle_raptor_energy_regen, dt, false);
@@ -427,7 +427,7 @@ bool raptor_frame(entity this, float dt)
        }
 
 
-       VEHICLE_UPDATE_PLAYER_RESOURCE(this, vehic, health, raptor, RESOURCE_HEALTH);
+       VEHICLE_UPDATE_PLAYER_RESOURCE(this, vehic, health, raptor, RES_HEALTH);
        VEHICLE_UPDATE_PLAYER(this, vehic, energy, raptor);
        if(vehic.vehicle_flags & VHF_HASSHIELD)
                VEHICLE_UPDATE_PLAYER(this, vehic, shield, raptor);
@@ -471,7 +471,7 @@ bool raptor_takeoff(entity this, float dt)
                vehicles_regen(vehic, vehic.dmg_time, vehicle_shield, autocvar_g_vehicle_raptor_shield, autocvar_g_vehicle_raptor_shield_regen_pause, autocvar_g_vehicle_raptor_shield_regen, dt, true);
 
        if(vehic.vehicle_flags  & VHF_HEALTHREGEN)
-               vehicles_regen_resource(vehic, vehic.dmg_time, vehicle_health, autocvar_g_vehicle_raptor_health, autocvar_g_vehicle_raptor_health_regen_pause, autocvar_g_vehicle_raptor_health_regen, dt, false, RESOURCE_HEALTH);
+               vehicles_regen_resource(vehic, vehic.dmg_time, vehicle_health, autocvar_g_vehicle_raptor_health, autocvar_g_vehicle_raptor_health_regen_pause, autocvar_g_vehicle_raptor_health_regen, dt, false, RES_HEALTH);
 
        if(vehic.vehicle_flags  & VHF_ENERGYREGEN)
                vehicles_regen(vehic, vehic.cnt, vehicle_energy, autocvar_g_vehicle_raptor_energy, autocvar_g_vehicle_raptor_energy_regen_pause, autocvar_g_vehicle_raptor_energy_regen, dt, false);
@@ -481,7 +481,7 @@ bool raptor_takeoff(entity this, float dt)
        this.vehicle_reload2 = bound(0, vehic.bomb1.alpha * 100, 100);
        this.vehicle_ammo2 = (this.vehicle_reload2 == 100) ? 100 : 0;
 
-       VEHICLE_UPDATE_PLAYER_RESOURCE(this, vehic, health, raptor, RESOURCE_HEALTH);
+       VEHICLE_UPDATE_PLAYER_RESOURCE(this, vehic, health, raptor, RES_HEALTH);
        VEHICLE_UPDATE_PLAYER(this, vehic, energy, raptor);
        if(vehic.vehicle_flags & VHF_HASSHIELD)
                VEHICLE_UPDATE_PLAYER(this, vehic, shield, raptor);
@@ -594,7 +594,7 @@ METHOD(Raptor, vr_enter, void(Raptor thisveh, entity instance))
     instance.owner.PlayerPhysplug = raptor_takeoff;
     set_movetype(instance, MOVETYPE_BOUNCEMISSILE);
     instance.solid               = SOLID_SLIDEBOX;
-    instance.owner.vehicle_health = (GetResourceAmount(instance, RESOURCE_HEALTH) / autocvar_g_vehicle_raptor_health) * 100;
+    instance.owner.vehicle_health = (GetResourceAmount(instance, RES_HEALTH) / autocvar_g_vehicle_raptor_health) * 100;
     instance.owner.vehicle_shield = (instance.vehicle_shield / autocvar_g_vehicle_raptor_shield) * 100;
     instance.velocity = '0 0 1'; // nudge upwards so takeoff sequence can work
     instance.tur_head.exteriormodeltoclient = instance.owner;
@@ -609,7 +609,7 @@ METHOD(Raptor, vr_enter, void(Raptor thisveh, entity instance))
 }
 METHOD(Raptor, vr_death, void(Raptor thisveh, entity instance))
 {
-       SetResourceAmount(instance, RESOURCE_HEALTH, 0);
+       SetResourceAmount(instance, RES_HEALTH, 0);
     instance.event_damage              = func_null;
     instance.solid                             = SOLID_CORPSE;
     instance.takedamage                        = DAMAGE_NO;
@@ -701,7 +701,7 @@ METHOD(Raptor, vr_spawn, void(Raptor thisveh, entity instance))
     }
 
     instance.frame               = 0;
-    SetResourceAmount(instance, RESOURCE_HEALTH, autocvar_g_vehicle_raptor_health);
+    SetResourceAmount(instance, RES_HEALTH, autocvar_g_vehicle_raptor_health);
     instance.vehicle_shield = autocvar_g_vehicle_raptor_shield;
     set_movetype(instance, MOVETYPE_TOSS);
     instance.solid               = SOLID_SLIDEBOX;
@@ -720,7 +720,7 @@ METHOD(Raptor, vr_spawn, void(Raptor thisveh, entity instance))
     instance.bouncefactor = autocvar_g_vehicle_raptor_bouncefactor;
     instance.bouncestop = autocvar_g_vehicle_raptor_bouncestop;
     instance.damageforcescale = 0.25;
-    SetResourceAmount(instance, RESOURCE_HEALTH, autocvar_g_vehicle_raptor_health);
+    SetResourceAmount(instance, RES_HEALTH, autocvar_g_vehicle_raptor_health);
     instance.vehicle_shield = autocvar_g_vehicle_raptor_shield;
 }
 METHOD(Raptor, vr_setup, void(Raptor thisveh, entity instance))
@@ -739,9 +739,9 @@ METHOD(Raptor, vr_setup, void(Raptor thisveh, entity instance))
 
     instance.vehicle_exit = raptor_exit;
     instance.respawntime = autocvar_g_vehicle_raptor_respawntime;
-    SetResourceAmount(instance, RESOURCE_HEALTH, autocvar_g_vehicle_raptor_health);
+    SetResourceAmount(instance, RES_HEALTH, autocvar_g_vehicle_raptor_health);
     instance.vehicle_shield = autocvar_g_vehicle_raptor_shield;
-    instance.max_health = GetResourceAmount(instance, RESOURCE_HEALTH);
+    instance.max_health = GetResourceAmount(instance, RES_HEALTH);
 
     if(!autocvar_g_vehicle_raptor_swim)
        instance.dphitcontentsmask |= DPCONTENTS_LIQUIDSMASK;
index 8266a9a2058f3f5130a4b43dc9baa5bfe77c274a..ee4ea01030b968f3a0fcac61dfc8a1be423ec025 100644 (file)
@@ -74,7 +74,7 @@ METHOD(RaptorFlare, wr_think, void(entity thiswep, entity actor, .entity weapone
             _flare.solid = SOLID_CORPSE;
             _flare.takedamage = DAMAGE_YES;
             _flare.event_damage = raptor_flare_damage;
-            SetResourceAmount(_flare, RESOURCE_HEALTH, 20);
+            SetResourceAmount(_flare, RES_HEALTH, 20);
             _flare.tur_impacttime = time + autocvar_g_vehicle_raptor_flare_lifetime;
             settouch(_flare, raptor_flare_touch);
         }
@@ -191,8 +191,8 @@ void raptor_flare_touch(entity this, entity toucher)
 
 void raptor_flare_damage(entity this, entity inflictor, entity attacker, float damage, int deathtype, .entity weaponentity, vector hitloc, vector force)
 {
-    TakeResource(this, RESOURCE_HEALTH, damage);
-    if(GetResourceAmount(this, RESOURCE_HEALTH) <= 0)
+    TakeResource(this, RES_HEALTH, damage);
+    if(GetResourceAmount(this, RES_HEALTH) <= 0)
         delete(this);
 }
 
index 4c085f138e38fcbe3528afafb1a7cfc79fb5ec38..4277b3f786faff016d46923bb31f51b44d321919 100644 (file)
@@ -294,7 +294,7 @@ bool spiderbot_frame(entity this, float dt)
                vehicles_regen(vehic, vehic.dmg_time, vehicle_shield, autocvar_g_vehicle_spiderbot_shield, autocvar_g_vehicle_spiderbot_shield_regen_pause, autocvar_g_vehicle_spiderbot_shield_regen, dt, true);
 
        if(vehic.vehicle_flags  & VHF_HEALTHREGEN)
-               vehicles_regen_resource(vehic, vehic.dmg_time, vehicle_health, autocvar_g_vehicle_spiderbot_health, autocvar_g_vehicle_spiderbot_health_regen_pause, autocvar_g_vehicle_spiderbot_health_regen, dt, false, RESOURCE_HEALTH);
+               vehicles_regen_resource(vehic, vehic.dmg_time, vehicle_health, autocvar_g_vehicle_spiderbot_health, autocvar_g_vehicle_spiderbot_health_regen_pause, autocvar_g_vehicle_spiderbot_health_regen, dt, false, RES_HEALTH);
 
        PHYS_INPUT_BUTTON_ATCK(this) = PHYS_INPUT_BUTTON_ATCK2(this) = false;
        //this.vehicle_ammo2 = vehic.tur_head.frame;
@@ -309,7 +309,7 @@ bool spiderbot_frame(entity this, float dt)
        this.oldorigin = this.origin; // negate fall damage
        this.velocity = vehic.velocity;
 
-       VEHICLE_UPDATE_PLAYER_RESOURCE(this, vehic, health, spiderbot, RESOURCE_HEALTH);
+       VEHICLE_UPDATE_PLAYER_RESOURCE(this, vehic, health, spiderbot, RES_HEALTH);
 
        if(vehic.vehicle_flags & VHF_HASSHIELD)
                VEHICLE_UPDATE_PLAYER(this, vehic, shield, spiderbot);
@@ -524,7 +524,7 @@ METHOD(Spiderbot, vr_enter, void(Spiderbot thisveh, entity instance))
     STAT(VEHICLESTAT_W2MODE, instance) = SBRM_GUIDE;
     set_movetype(instance, MOVETYPE_WALK);
     CSQCVehicleSetup(instance.owner, 0);
-    instance.owner.vehicle_health = (GetResourceAmount(instance, RESOURCE_HEALTH) / autocvar_g_vehicle_spiderbot_health) * 100;
+    instance.owner.vehicle_health = (GetResourceAmount(instance, RES_HEALTH) / autocvar_g_vehicle_spiderbot_health) * 100;
     instance.owner.vehicle_shield = (instance.vehicle_shield / autocvar_g_vehicle_spiderbot_shield) * 100;
 
     if(instance.owner.flagcarried)
@@ -540,7 +540,7 @@ METHOD(Spiderbot, vr_think, void(Spiderbot thisveh, entity instance))
 }
 METHOD(Spiderbot, vr_death, void(Spiderbot thisveh, entity instance))
 {
-       SetResourceAmount(instance, RESOURCE_HEALTH, 0);
+       SetResourceAmount(instance, RES_HEALTH, 0);
     instance.event_damage              = func_null;
     instance.takedamage                        = DAMAGE_NO;
     settouch(instance, func_null);
@@ -582,7 +582,7 @@ METHOD(Spiderbot, vr_spawn, void(Spiderbot thisveh, entity instance))
     setorigin(instance, instance.pos1 + '0 0 128');
     instance.angles = instance.pos2;
     instance.damageforcescale = 0.03;
-    SetResourceAmount(instance, RESOURCE_HEALTH, autocvar_g_vehicle_spiderbot_health);
+    SetResourceAmount(instance, RES_HEALTH, autocvar_g_vehicle_spiderbot_health);
     instance.vehicle_shield = autocvar_g_vehicle_spiderbot_shield;
 
     instance.PlayerPhysplug = spiderbot_frame;
@@ -599,9 +599,9 @@ METHOD(Spiderbot, vr_setup, void(Spiderbot thisveh, entity instance))
         instance.vehicle_flags |= VHF_HEALTHREGEN;
 
     instance.respawntime = autocvar_g_vehicle_spiderbot_respawntime;
-    SetResourceAmount(instance, RESOURCE_HEALTH, autocvar_g_vehicle_spiderbot_health);
+    SetResourceAmount(instance, RES_HEALTH, autocvar_g_vehicle_spiderbot_health);
     instance.vehicle_shield = autocvar_g_vehicle_spiderbot_shield;
-    instance.max_health = GetResourceAmount(instance, RESOURCE_HEALTH);
+    instance.max_health = GetResourceAmount(instance, RES_HEALTH);
     instance.pushable = true; // spiderbot can use jumppads
 }
 
index f118a04667f39c181eb0dee13eede8cc59d42973..f2fdf4407fb6307494ba7201e009c3c21f36091c 100644 (file)
@@ -215,12 +215,12 @@ string GetAmmoPicture(int ammotype)
 {
        switch (ammotype)
        {
-               case RESOURCE_SHELLS:  return ITEM_Shells.m_icon;
-               case RESOURCE_BULLETS: return ITEM_Bullets.m_icon;
-               case RESOURCE_ROCKETS: return ITEM_Rockets.m_icon;
-               case RESOURCE_CELLS:   return ITEM_Cells.m_icon;
-               case RESOURCE_PLASMA:  return ITEM_Plasma.m_icon;
-               case RESOURCE_FUEL:    return ITEM_JetpackFuel.m_icon;
+               case RES_SHELLS:  return ITEM_Shells.m_icon;
+               case RES_BULLETS: return ITEM_Bullets.m_icon;
+               case RES_ROCKETS: return ITEM_Rockets.m_icon;
+               case RES_CELLS:   return ITEM_Cells.m_icon;
+               case RES_PLASMA:  return ITEM_Plasma.m_icon;
+               case RES_FUEL:    return ITEM_JetpackFuel.m_icon;
                default: return "";  // wtf, no ammo type?
        }
 }
@@ -230,13 +230,13 @@ int GetAmmoTypeFromNum(int i)
 {
        switch (i)
        {
-               case 0: return RESOURCE_SHELLS;
-               case 1: return RESOURCE_BULLETS;
-               case 2: return RESOURCE_ROCKETS;
-               case 3: return RESOURCE_CELLS;
-               case 4: return RESOURCE_PLASMA;
-               case 5: return RESOURCE_FUEL;
-               default: return RESOURCE_NONE;
+               case 0: return RES_SHELLS;
+               case 1: return RES_BULLETS;
+               case 2: return RES_ROCKETS;
+               case 3: return RES_CELLS;
+               case 4: return RES_PLASMA;
+               case 5: return RES_FUEL;
+               default: return RES_NONE;
        }
 }
 
@@ -244,12 +244,12 @@ int GetAmmoStat(int ammotype)
 {
        switch (ammotype)
        {
-               case RESOURCE_SHELLS: return STAT_SHELLS;
-               case RESOURCE_BULLETS: return STAT_NAILS;
-               case RESOURCE_ROCKETS: return STAT_ROCKETS;
-               case RESOURCE_CELLS: return STAT_CELLS;
-               case RESOURCE_PLASMA: return STAT_PLASMA.m_id;
-               case RESOURCE_FUEL: return STAT_FUEL.m_id;
+               case RES_SHELLS: return STAT_SHELLS;
+               case RES_BULLETS: return STAT_NAILS;
+               case RES_ROCKETS: return STAT_ROCKETS;
+               case RES_CELLS: return STAT_CELLS;
+               case RES_PLASMA: return STAT_PLASMA.m_id;
+               case RES_FUEL: return STAT_FUEL.m_id;
                default: return -1;
        }
 }
index cdf5748e678bf62388ffd85c793cd9194f8656d1..0d65bbef9d51f3e410981232ca62a0d31e035cad 100644 (file)
@@ -45,7 +45,7 @@ CLASS(Weapon, Object)
     /** control what happens when this weapon is spawned */
     METHOD(Weapon, m_spawnfunc_hookreplace, Weapon(Weapon this, entity e)) { return this; }
     /** M: ammotype  : main ammo type */
-    ATTRIB(Weapon, ammo_type, int, RESOURCE_NONE);
+    ATTRIB(Weapon, ammo_type, int, RES_NONE);
     /** M: impulse   : weapon impulse */
     ATTRIB(Weapon, impulse, int, -1);
     /** M: flags     : WEPSPAWNFLAG_... combined */
index 8aea03312a5ab86137d8be4d18275559fef52b44..dd01444ef9efb67a80964a67dbb386c00f497082 100644 (file)
@@ -104,16 +104,16 @@ void W_Arc_Bolt_Explode_use(entity this, entity actor, entity trigger)
 
 void W_Arc_Bolt_Damage(entity this, entity inflictor, entity attacker, float damage, int deathtype, .entity weaponentity, vector hitloc, vector force)
 {
-       if(GetResourceAmount(this, RESOURCE_HEALTH) <= 0)
+       if(GetResourceAmount(this, RES_HEALTH) <= 0)
                return;
 
        if(!W_CheckProjectileDamage(inflictor.realowner, this.realowner, deathtype, -1))
                return; // g_projectiles_damage says to halt
 
-       TakeResource(this, RESOURCE_HEALTH, damage);
+       TakeResource(this, RES_HEALTH, damage);
        this.angles = vectoangles(this.velocity);
 
-       if(GetResourceAmount(this, RESOURCE_HEALTH) <= 0)
+       if(GetResourceAmount(this, RES_HEALTH) <= 0)
                W_PrepareExplosionByDamage(this, attacker, getthink(this));
 }
 
@@ -140,7 +140,7 @@ void W_Arc_Attack_Bolt(Weapon thiswep, entity actor, .entity weaponentity)
        missile.bot_dodgerating = WEP_CVAR(arc, bolt_damage);
 
        missile.takedamage = DAMAGE_YES;
-       SetResourceAmount(missile, RESOURCE_HEALTH, WEP_CVAR(arc, bolt_health));
+       SetResourceAmount(missile, RES_HEALTH, WEP_CVAR(arc, bolt_health));
        missile.damageforcescale = WEP_CVAR(arc, bolt_damageforcescale);
        missile.event_damage = W_Arc_Bolt_Damage;
        missile.damagedbycontents = true;
@@ -428,13 +428,13 @@ void W_Arc_Beam_Think(entity this)
                        {
                                float roothealth = ((burst) ? WEP_CVAR(arc, burst_healing_hps) : WEP_CVAR(arc, beam_healing_hps));
                                float rootarmor = ((burst) ? WEP_CVAR(arc, burst_healing_aps) : WEP_CVAR(arc, beam_healing_aps));
-                               float hplimit = ((IS_PLAYER(trace_ent)) ? WEP_CVAR(arc, beam_healing_hmax) : RESOURCE_LIMIT_NONE);
+                               float hplimit = ((IS_PLAYER(trace_ent)) ? WEP_CVAR(arc, beam_healing_hmax) : RES_LIMIT_NONE);
                                Heal(trace_ent, own, (roothealth * coefficient), hplimit);
                                if(IS_PLAYER(trace_ent) && rootarmor)
                                {
-                                       if(GetResourceAmount(trace_ent, RESOURCE_ARMOR) <= WEP_CVAR(arc, beam_healing_amax))
+                                       if(GetResourceAmount(trace_ent, RES_ARMOR) <= WEP_CVAR(arc, beam_healing_amax))
                                        {
-                                               GiveResourceWithLimit(trace_ent, RESOURCE_ARMOR, (rootarmor * coefficient), WEP_CVAR(arc, beam_healing_amax));
+                                               GiveResourceWithLimit(trace_ent, RES_ARMOR, (rootarmor * coefficient), WEP_CVAR(arc, beam_healing_amax));
                                                trace_ent.pauserotarmor_finished = max(
                                                        trace_ent.pauserotarmor_finished,
                                                        time + autocvar_g_balance_pause_armor_rot
index 187e5840257149e270f929961f13a7ed2412a7ea..13321039c9d215cc17211eadc3c7dd2b9c09da2d 100644 (file)
@@ -2,7 +2,7 @@
 
 CLASS(Arc, Weapon)
 /* spawnfunc */ ATTRIB(Arc, m_canonical_spawnfunc, string, "weapon_arc");
-/* ammotype  */ ATTRIB(Arc, ammo_type, int, RESOURCE_CELLS);
+/* ammotype  */ ATTRIB(Arc, ammo_type, int, RES_CELLS);
 /* impulse   */ ATTRIB(Arc, impulse, int, 3);
 /* flags     */ ATTRIB(Arc, spawnflags, int, WEP_TYPE_HITSCAN);
 /* rating    */ ATTRIB(Arc, bot_pickupbasevalue, float, 8000);
index 7efbdf7a52cc661899ce42c973c72c11df5959df..c9825adf0b06d5f3ed4d936d1216680318f278a9 100644 (file)
@@ -2,7 +2,7 @@
 
 CLASS(Blaster, Weapon)
 /* spawnfunc */ ATTRIB(Blaster, m_canonical_spawnfunc, string, "weapon_blaster");
-/* ammotype  */ //ATTRIB(Blaster, ammo_type, int, RESOURCE_NONE);
+/* ammotype  */ //ATTRIB(Blaster, ammo_type, int, RES_NONE);
 /* impulse   */ ATTRIB(Blaster, impulse, int, 1);
 /* flags     */ ATTRIB(Blaster, spawnflags, int, WEP_FLAG_NORMAL | WEP_FLAG_CANCLIMB | WEP_TYPE_SPLASH);
 /* rating    */ ATTRIB(Blaster, bot_pickupbasevalue, float, 0);
index 77e0b734e2e7e2c1009ee42fb400691a9bca8ed1..5843c94bbe2df1188b10cb092c8e7eb94e4d7f6e 100644 (file)
@@ -2,7 +2,7 @@
 
 CLASS(Crylink, Weapon)
 /* spawnfunc */ ATTRIB(Crylink, m_canonical_spawnfunc, string, "weapon_crylink");
-/* ammotype  */ ATTRIB(Crylink, ammo_type, int, RESOURCE_CELLS);
+/* ammotype  */ ATTRIB(Crylink, ammo_type, int, RES_CELLS);
 /* impulse   */ ATTRIB(Crylink, impulse, int, 6);
 /* flags     */ ATTRIB(Crylink, spawnflags, int, WEP_FLAG_NORMAL | WEP_FLAG_RELOADABLE | WEP_TYPE_SPLASH | WEP_FLAG_CANCLIMB);
 /* rating    */ ATTRIB(Crylink, bot_pickupbasevalue, float, 6000);
index b280665c881979f6f68eb2f8ff69686fa4d60aef..292f2d5d8852a58866c0170a3da473e080f465e7 100644 (file)
@@ -287,16 +287,16 @@ void W_Devastator_Touch(entity this, entity toucher)
 
 void W_Devastator_Damage(entity this, entity inflictor, entity attacker, float damage, int deathtype, .entity weaponentity, vector hitloc, vector force)
 {
-       if(GetResourceAmount(this, RESOURCE_HEALTH) <= 0)
+       if(GetResourceAmount(this, RES_HEALTH) <= 0)
                return;
 
        if(!W_CheckProjectileDamage(inflictor.realowner, this.realowner, deathtype, -1)) // no exceptions
                return; // g_projectiles_damage says to halt
 
-       TakeResource(this, RESOURCE_HEALTH, damage);
+       TakeResource(this, RES_HEALTH, damage);
        this.angles = vectoangles(this.velocity);
 
-       if(GetResourceAmount(this, RESOURCE_HEALTH) <= 0)
+       if(GetResourceAmount(this, RES_HEALTH) <= 0)
                W_PrepareExplosionByDamage(this, attacker, W_Devastator_Explode_think);
 }
 
@@ -322,7 +322,7 @@ void W_Devastator_Attack(Weapon thiswep, entity actor, .entity weaponentity, int
 
        missile.takedamage = DAMAGE_YES;
        missile.damageforcescale = WEP_CVAR(devastator, damageforcescale);
-       SetResourceAmount(missile, RESOURCE_HEALTH, WEP_CVAR(devastator, health));
+       SetResourceAmount(missile, RES_HEALTH, WEP_CVAR(devastator, health));
        missile.event_damage = W_Devastator_Damage;
        missile.damagedbycontents = true;
        IL_PUSH(g_damagedbycontents, missile);
@@ -435,7 +435,7 @@ METHOD(Devastator, wr_aim, void(entity thiswep, entity actor, .entity weaponenti
         // but don't fire a new shot at the same time!
         if(desirabledamage >= 0.75 * coredamage) //this should do group damage in rare fortunate events
             PHYS_INPUT_BUTTON_ATCK2(actor) = true;
-        if((skill > 6.5) && (selfdamage > GetResourceAmount(actor, RESOURCE_HEALTH)))
+        if((skill > 6.5) && (selfdamage > GetResourceAmount(actor, RES_HEALTH)))
             PHYS_INPUT_BUTTON_ATCK2(actor) = false;
         //if(PHYS_INPUT_BUTTON_ATCK2(actor) == true)
         //     dprint(ftos(desirabledamage),"\n");
index e858d54e42d155f87653fb38c1bb85c304d8e152..33814a5e1e0c3c3cda5b384e3fb272e08ee4d3e7 100644 (file)
@@ -2,7 +2,7 @@
 
 CLASS(Devastator, Weapon)
 /* spawnfunc */ ATTRIB(Devastator, m_canonical_spawnfunc, string, "weapon_devastator");
-/* ammotype  */ ATTRIB(Devastator, ammo_type, int, RESOURCE_ROCKETS);
+/* ammotype  */ ATTRIB(Devastator, ammo_type, int, RES_ROCKETS);
 /* impulse   */ ATTRIB(Devastator, impulse, int, 9);
 /* flags     */ ATTRIB(Devastator, spawnflags, int, WEP_FLAG_NORMAL | WEP_FLAG_RELOADABLE | WEP_FLAG_CANCLIMB | WEP_TYPE_SPLASH);
 /* rating    */ ATTRIB(Devastator, bot_pickupbasevalue, float, 8000);
index b44731eab872e667711724ee74e5b75b57f6704c..134002426ce22e97f03e3e0d6215ae80f854b2f7 100644 (file)
@@ -258,7 +258,7 @@ void W_Electro_Orb_Stick(entity this, entity to)
 
        newproj.takedamage = this.takedamage;
        newproj.damageforcescale = this.damageforcescale;
-       SetResourceAmount(newproj, RESOURCE_HEALTH, GetResourceAmount(this, RESOURCE_HEALTH));
+       SetResourceAmount(newproj, RES_HEALTH, GetResourceAmount(this, RES_HEALTH));
        newproj.event_damage = this.event_damage;
        newproj.spawnshieldtime = this.spawnshieldtime;
        newproj.damagedbycontents = true;
@@ -300,7 +300,7 @@ void W_Electro_Orb_Touch(entity this, entity toucher)
 
 void W_Electro_Orb_Damage(entity this, entity inflictor, entity attacker, float damage, int deathtype, .entity weaponentity, vector hitloc, vector force)
 {
-       if(GetResourceAmount(this, RESOURCE_HEALTH) <= 0)
+       if(GetResourceAmount(this, RES_HEALTH) <= 0)
                return;
 
        // note: combos are usually triggered by W_Electro_TriggerCombo, not damage
@@ -309,8 +309,8 @@ void W_Electro_Orb_Damage(entity this, entity inflictor, entity attacker, float
        if(!W_CheckProjectileDamage(inflictor.realowner, this.realowner, deathtype, (is_combo ? 1 : -1)))
                return; // g_projectiles_damage says to halt
 
-       TakeResource(this, RESOURCE_HEALTH, damage);
-       if(GetResourceAmount(this, RESOURCE_HEALTH) <= 0)
+       TakeResource(this, RES_HEALTH, damage);
+       if(GetResourceAmount(this, RES_HEALTH) <= 0)
        {
                this.takedamage = DAMAGE_NO;
                this.nextthink = time;
@@ -381,7 +381,7 @@ void W_Electro_Attack_Orb(Weapon thiswep, entity actor, .entity weaponentity)
        setsize(proj, '-4 -4 -4', '4 4 4');
        proj.takedamage = DAMAGE_YES;
        proj.damageforcescale = WEP_CVAR_SEC(electro, damageforcescale);
-       SetResourceAmount(proj, RESOURCE_HEALTH, WEP_CVAR_SEC(electro, health));
+       SetResourceAmount(proj, RES_HEALTH, WEP_CVAR_SEC(electro, health));
        proj.event_damage = W_Electro_Orb_Damage;
        proj.flags = FL_PROJECTILE;
        IL_PUSH(g_projectiles, proj);
index 4018e5926c78ac03364173ce19883119b59d1503..7dbed189b095e297a6a2805f1df2dda980c36045 100644 (file)
@@ -2,7 +2,7 @@
 
 CLASS(Electro, Weapon)
 /* spawnfunc */ ATTRIB(Electro, m_canonical_spawnfunc, string, "weapon_electro");
-/* ammotype  */ ATTRIB(Electro, ammo_type, int, RESOURCE_CELLS);
+/* ammotype  */ ATTRIB(Electro, ammo_type, int, RES_CELLS);
 /* impulse   */ ATTRIB(Electro, impulse, int, 5);
 /* flags     */ ATTRIB(Electro, spawnflags, int, WEP_FLAG_NORMAL | WEP_FLAG_RELOADABLE | WEP_FLAG_CANCLIMB | WEP_TYPE_SPLASH);
 /* rating    */ ATTRIB(Electro, bot_pickupbasevalue, float, 5000);
index f4936cdf474944cf84a1ef2fec3e0389921109f9..94fa451eec42367479adb881544ca22cccfadaa0 100644 (file)
@@ -14,9 +14,9 @@ void W_Fireball_Explode(entity this, entity directhitentity)
        this.takedamage = DAMAGE_NO;
 
        // 1. dist damage
-       d = (GetResourceAmount(this.realowner, RESOURCE_HEALTH) + GetResourceAmount(this.realowner, RESOURCE_ARMOR));
+       d = (GetResourceAmount(this.realowner, RES_HEALTH) + GetResourceAmount(this.realowner, RES_ARMOR));
        RadiusDamage(this, this.realowner, WEP_CVAR_PRI(fireball, damage), WEP_CVAR_PRI(fireball, edgedamage), WEP_CVAR_PRI(fireball, radius), NULL, NULL, WEP_CVAR_PRI(fireball, force), this.projectiledeathtype, this.weaponentity_fld, directhitentity);
-       if(GetResourceAmount(this.realowner, RESOURCE_HEALTH) + GetResourceAmount(this.realowner, RESOURCE_ARMOR) >= d)
+       if(GetResourceAmount(this.realowner, RES_HEALTH) + GetResourceAmount(this.realowner, RES_ARMOR) >= d)
        if(!this.cnt)
        {
                modeleffect_spawn("models/sphere/sphere.md3", 0, 0, this.origin, '0 0 0', '0 0 0', '0 0 0', 0, WEP_CVAR_PRI(fireball, bfgradius), 0.2, 0.05, 0.25);
@@ -119,14 +119,14 @@ void W_Fireball_Think(entity this)
 
 void W_Fireball_Damage(entity this, entity inflictor, entity attacker, float damage, int deathtype, .entity weaponentity, vector hitloc, vector force)
 {
-       if(GetResourceAmount(this, RESOURCE_HEALTH) <= 0)
+       if(GetResourceAmount(this, RES_HEALTH) <= 0)
                return;
 
        if(!W_CheckProjectileDamage(inflictor.realowner, this.realowner, deathtype, -1)) // no exceptions
                return; // g_projectiles_damage says to halt
 
-       TakeResource(this, RESOURCE_HEALTH, damage);
-       if(GetResourceAmount(this, RESOURCE_HEALTH) <= 0)
+       TakeResource(this, RES_HEALTH, damage);
+       if(GetResourceAmount(this, RES_HEALTH) <= 0)
        {
                this.cnt = 1;
                W_PrepareExplosionByDamage(this, attacker, W_Fireball_Explode_think);
@@ -147,7 +147,7 @@ void W_Fireball_Attack1(entity actor, .entity weaponentity)
        proj.use = W_Fireball_Explode_use;
        setthink(proj, W_Fireball_Think);
        proj.nextthink = time;
-       SetResourceAmount(proj, RESOURCE_HEALTH, WEP_CVAR_PRI(fireball, health));
+       SetResourceAmount(proj, RES_HEALTH, WEP_CVAR_PRI(fireball, health));
        proj.team = actor.team;
        proj.event_damage = W_Fireball_Damage;
        proj.takedamage = DAMAGE_YES;
index 4302c9e7973467d5843917f708cc805260db2cce..ba391f6a2d13b42dc33ae6dd08654345921c379f 100644 (file)
@@ -2,7 +2,7 @@
 
 CLASS(Fireball, Weapon)
 /* spawnfunc */ ATTRIB(Fireball, m_canonical_spawnfunc, string, "weapon_fireball");
-/* ammotype  */ //ATTRIB(Fireball, ammo_type, int, RESOURCE_NONE);
+/* ammotype  */ //ATTRIB(Fireball, ammo_type, int, RES_NONE);
 /* impulse   */ ATTRIB(Fireball, impulse, int, 9);
 /* flags     */ ATTRIB(Fireball, spawnflags, int, WEP_FLAG_SUPERWEAPON | WEP_TYPE_SPLASH | WEP_FLAG_NODUAL);
 /* rating    */ ATTRIB(Fireball, bot_pickupbasevalue, float, 5000);
index 417a425685fbb7dc4eb234173c64d2fda4acfa3b..d342a5cf5fe0bb5e0f0b3ae8468d3dee63a70381 100644 (file)
@@ -32,7 +32,7 @@ void W_Hagar_Explode2_use(entity this, entity actor, entity trigger)
 
 void W_Hagar_Damage(entity this, entity inflictor, entity attacker, float damage, int deathtype, .entity weaponentity, vector hitloc, vector force)
 {
-       if(GetResourceAmount(this, RESOURCE_HEALTH) <= 0)
+       if(GetResourceAmount(this, RES_HEALTH) <= 0)
                return;
 
        float is_linkexplode = ( ((inflictor.owner != NULL) ? (inflictor.owner == this.owner) : true)
@@ -47,10 +47,10 @@ void W_Hagar_Damage(entity this, entity inflictor, entity attacker, float damage
        if(!W_CheckProjectileDamage(inflictor.realowner, this.realowner, deathtype, is_linkexplode))
                return; // g_projectiles_damage says to halt
 
-       TakeResource(this, RESOURCE_HEALTH, damage);
+       TakeResource(this, RES_HEALTH, damage);
        this.angles = vectoangles(this.velocity);
 
-       if(GetResourceAmount(this, RESOURCE_HEALTH) <= 0)
+       if(GetResourceAmount(this, RES_HEALTH) <= 0)
                W_PrepareExplosionByDamage(this, attacker, getthink(this));
 }
 
@@ -91,7 +91,7 @@ void W_Hagar_Attack(Weapon thiswep, entity actor, .entity weaponentity)
        missile.bot_dodgerating = WEP_CVAR_PRI(hagar, damage);
 
        missile.takedamage = DAMAGE_YES;
-       SetResourceAmount(missile, RESOURCE_HEALTH, WEP_CVAR_PRI(hagar, health));
+       SetResourceAmount(missile, RES_HEALTH, WEP_CVAR_PRI(hagar, health));
        missile.damageforcescale = WEP_CVAR_PRI(hagar, damageforcescale);
        missile.event_damage = W_Hagar_Damage;
        missile.damagedbycontents = true;
@@ -137,7 +137,7 @@ void W_Hagar_Attack2(Weapon thiswep, entity actor, .entity weaponentity)
        missile.bot_dodgerating = WEP_CVAR_SEC(hagar, damage);
 
        missile.takedamage = DAMAGE_YES;
-       SetResourceAmount(missile, RESOURCE_HEALTH, WEP_CVAR_SEC(hagar, health));
+       SetResourceAmount(missile, RES_HEALTH, WEP_CVAR_SEC(hagar, health));
        missile.damageforcescale = WEP_CVAR_SEC(hagar, damageforcescale);
        missile.event_damage = W_Hagar_Damage;
        missile.damagedbycontents = true;
@@ -200,7 +200,7 @@ void W_Hagar_Attack2_Load_Release(Weapon thiswep, entity actor, .entity weaponen
                missile.bot_dodgerating = WEP_CVAR_SEC(hagar, damage);
 
                missile.takedamage = DAMAGE_YES;
-               SetResourceAmount(missile, RESOURCE_HEALTH, WEP_CVAR_SEC(hagar, health));
+               SetResourceAmount(missile, RES_HEALTH, WEP_CVAR_SEC(hagar, health));
                missile.damageforcescale = WEP_CVAR_SEC(hagar, damageforcescale);
                missile.event_damage = W_Hagar_Damage;
                missile.damagedbycontents = true;
index 924326fb3a0a65e211ef2a0eba363444e5f1b771..0d0f11e8575774e8d2f939e2f9f394f1c8d49920 100644 (file)
@@ -2,7 +2,7 @@
 
 CLASS(Hagar, Weapon)
 /* spawnfunc */ ATTRIB(Hagar, m_canonical_spawnfunc, string, "weapon_hagar");
-/* ammotype  */ ATTRIB(Hagar, ammo_type, int, RESOURCE_ROCKETS);
+/* ammotype  */ ATTRIB(Hagar, ammo_type, int, RES_ROCKETS);
 /* impulse   */ ATTRIB(Hagar, impulse, int, 8);
 /* flags     */ ATTRIB(Hagar, spawnflags, int, WEP_FLAG_NORMAL | WEP_FLAG_RELOADABLE | WEP_FLAG_CANCLIMB | WEP_TYPE_SPLASH);
 /* rating    */ ATTRIB(Hagar, bot_pickupbasevalue, float, 6000);
index d2bd427c2397bb90a1a69acb5c8be17382e39da0..769209259bda3efb8f92291ab52937a541b9df78 100644 (file)
@@ -2,7 +2,7 @@
 
 CLASS(HLAC, Weapon)
 /* spawnfunc */ ATTRIB(HLAC, m_canonical_spawnfunc, string, "weapon_hlac");
-/* ammotype  */ ATTRIB(HLAC, ammo_type, int, RESOURCE_CELLS);
+/* ammotype  */ ATTRIB(HLAC, ammo_type, int, RES_CELLS);
 /* impulse   */ ATTRIB(HLAC, impulse, int, 6);
 /* flags     */ ATTRIB(HLAC, spawnflags, int, WEP_FLAG_MUTATORBLOCKED | WEP_FLAG_RELOADABLE | WEP_TYPE_SPLASH);
 /* rating    */ ATTRIB(HLAC, bot_pickupbasevalue, float, 4000);
index d7c08219d7ae2159a6cbd51a897839784b4bf3fc..25c6f609fe7d61c8c799755989232f6bda58fcd1 100644 (file)
@@ -48,15 +48,15 @@ void W_Hook_Explode2_use(entity this, entity actor, entity trigger)
 
 void W_Hook_Damage(entity this, entity inflictor, entity attacker, float damage, int deathtype, .entity weaponentity, vector hitloc, vector force)
 {
-       if(GetResourceAmount(this, RESOURCE_HEALTH) <= 0)
+       if(GetResourceAmount(this, RES_HEALTH) <= 0)
                return;
 
        if(!W_CheckProjectileDamage(inflictor.realowner, this.realowner, deathtype, -1)) // no exceptions
                return; // g_projectiles_damage says to halt
 
-       SetResourceAmount(this, RESOURCE_HEALTH, GetResourceAmount(this, RESOURCE_HEALTH));
+       SetResourceAmount(this, RES_HEALTH, GetResourceAmount(this, RES_HEALTH));
 
-       if(GetResourceAmount(this, RESOURCE_HEALTH) <= 0)
+       if(GetResourceAmount(this, RES_HEALTH) <= 0)
                W_PrepareExplosionByDamage(this, this.realowner, W_Hook_Explode2);
 }
 
@@ -88,7 +88,7 @@ void W_Hook_Attack2(Weapon thiswep, entity actor, .entity weaponentity)
        settouch(gren, W_Hook_Touch2);
 
        gren.takedamage = DAMAGE_YES;
-       SetResourceAmount(gren, RESOURCE_HEALTH, WEP_CVAR_SEC(hook, health));
+       SetResourceAmount(gren, RES_HEALTH, WEP_CVAR_SEC(hook, health));
        gren.damageforcescale = WEP_CVAR_SEC(hook, damageforcescale);
        gren.event_damage = W_Hook_Damage;
        gren.damagedbycontents = true;
@@ -165,7 +165,7 @@ METHOD(Hook, wr_think, void(entity thiswep, entity actor, .entity weaponentity,
             {
                 if(!(actor.items & IT_UNLIMITED_WEAPON_AMMO))
                 {
-                    if( GetResourceAmount(actor, RESOURCE_FUEL) >= (time - actor.(weaponentity).hook_time_fueldecrease) * hooked_fuel )
+                    if( GetResourceAmount(actor, RES_FUEL) >= (time - actor.(weaponentity).hook_time_fueldecrease) * hooked_fuel )
                     {
                         W_DecreaseAmmo(thiswep, actor, (time - actor.(weaponentity).hook_time_fueldecrease) * hooked_fuel, weaponentity);
                         actor.(weaponentity).hook_time_fueldecrease = time;
@@ -173,7 +173,7 @@ METHOD(Hook, wr_think, void(entity thiswep, entity actor, .entity weaponentity,
                     }
                     else
                     {
-                        SetResourceAmount(actor, RESOURCE_FUEL, 0);
+                        SetResourceAmount(actor, RES_FUEL, 0);
                         actor.(weaponentity).hook_state |= HOOK_REMOVING;
                         if(actor.(weaponentity).m_weapon != WEP_Null) // offhand
                                W_SwitchWeapon_Force(actor, w_getbestweapon(actor, weaponentity), weaponentity);
@@ -214,9 +214,9 @@ METHOD(Hook, wr_checkammo1, bool(Hook thiswep, entity actor, .entity weaponentit
     if (!thiswep.ammo_factor) return true;
 
     if(actor.(weaponentity).hook)
-       return GetResourceAmount(actor, RESOURCE_FUEL) > 0;
+       return GetResourceAmount(actor, RES_FUEL) > 0;
 
-    return GetResourceAmount(actor, RESOURCE_FUEL) >= WEP_CVAR_PRI(hook, ammo);
+    return GetResourceAmount(actor, RES_FUEL) >= WEP_CVAR_PRI(hook, ammo);
 }
 METHOD(Hook, wr_checkammo2, bool(Hook thiswep, entity actor, .entity weaponentity))
 {
index 31424d421b14d68009a52e061c9e6dbf252d40e7..1d15d448ec5b7442e6a6a30ead436665fad4af9e 100644 (file)
@@ -2,7 +2,7 @@
 
 CLASS(Hook, Weapon)
 /* spawnfunc */ ATTRIB(Hook, m_canonical_spawnfunc, string, "weapon_hook");
-/* ammotype  */ ATTRIB(Hook, ammo_type, int, RESOURCE_FUEL);
+/* ammotype  */ ATTRIB(Hook, ammo_type, int, RES_FUEL);
 /* impulse   */ ATTRIB(Hook, impulse, int, 0);
 /* flags     */ ATTRIB(Hook, spawnflags, int, WEP_FLAG_CANCLIMB | WEP_TYPE_SPLASH);
 /* rating    */ ATTRIB(Hook, bot_pickupbasevalue, float, 0);
index a7ede47a2105125d60a9a07778130c633720ce8e..2ecd8082fbdff7707fbef7610a0e0154711f15f4 100644 (file)
@@ -2,7 +2,7 @@
 
 CLASS(MachineGun, Weapon)
 /* spawnfunc */ ATTRIB(MachineGun, m_canonical_spawnfunc, string, "weapon_machinegun");
-/* ammotype  */ ATTRIB(MachineGun, ammo_type, int, RESOURCE_BULLETS);
+/* ammotype  */ ATTRIB(MachineGun, ammo_type, int, RES_BULLETS);
 /* impulse   */ ATTRIB(MachineGun, impulse, int, 3);
 /* flags     */ ATTRIB(MachineGun, spawnflags, int, WEP_FLAG_NORMAL | WEP_FLAG_RELOADABLE | WEP_TYPE_HITSCAN | WEP_FLAG_PENETRATEWALLS);
 /* rating    */ ATTRIB(MachineGun, bot_pickupbasevalue, float, 7000);
index df4e7b002eebe6cd5cced4fa346467ab09663d3b..23b60733a495d11c1cafdda8a87541fc892f31e9 100644 (file)
@@ -27,7 +27,7 @@ void W_MineLayer_Stick(entity this, entity to)
 
        newmine.takedamage = this.takedamage;
        newmine.damageforcescale = this.damageforcescale;
-       SetResourceAmount(newmine, RESOURCE_HEALTH, GetResourceAmount(this, RESOURCE_HEALTH));
+       SetResourceAmount(newmine, RES_HEALTH, GetResourceAmount(this, RES_HEALTH));
        newmine.event_damage = this.event_damage;
        newmine.spawnshieldtime = this.spawnshieldtime;
        newmine.damagedbycontents = true;
@@ -237,7 +237,7 @@ void W_MineLayer_Touch(entity this, entity toucher)
 
 void W_MineLayer_Damage(entity this, entity inflictor, entity attacker, float damage, int deathtype, .entity weaponentity, vector hitloc, vector force)
 {
-       if(GetResourceAmount(this, RESOURCE_HEALTH) <= 0)
+       if(GetResourceAmount(this, RES_HEALTH) <= 0)
                return;
 
        float is_from_enemy = (inflictor.realowner != this.realowner);
@@ -245,10 +245,10 @@ void W_MineLayer_Damage(entity this, entity inflictor, entity attacker, float da
        if(!W_CheckProjectileDamage(inflictor.realowner, this.realowner, deathtype, (is_from_enemy ? 1 : -1)))
                return; // g_projectiles_damage says to halt
 
-       TakeResource(this, RESOURCE_HEALTH, damage);
+       TakeResource(this, RES_HEALTH, damage);
        this.angles = vectoangles(this.velocity);
 
-       if(GetResourceAmount(this, RESOURCE_HEALTH) <= 0)
+       if(GetResourceAmount(this, RES_HEALTH) <= 0)
                W_PrepareExplosionByDamage(this, attacker, W_MineLayer_Explode_think);
 }
 
@@ -289,7 +289,7 @@ void W_MineLayer_Attack(Weapon thiswep, entity actor, .entity weaponentity)
 
        mine.takedamage = DAMAGE_YES;
        mine.damageforcescale = WEP_CVAR(minelayer, damageforcescale);
-       SetResourceAmount(mine, RESOURCE_HEALTH, WEP_CVAR(minelayer, health));
+       SetResourceAmount(mine, RES_HEALTH, WEP_CVAR(minelayer, health));
        mine.event_damage = W_MineLayer_Damage;
        mine.damagedbycontents = true;
        IL_PUSH(g_damagedbycontents, mine);
@@ -427,7 +427,7 @@ METHOD(MineLayer, wr_aim, void(entity thiswep, entity actor, .entity weaponentit
         // but don't fire a new shot at the same time!
         if(desirabledamage >= 0.75 * coredamage) //this should do group damage in rare fortunate events
             PHYS_INPUT_BUTTON_ATCK2(actor) = true;
-        if((skill > 6.5) && (selfdamage > GetResourceAmount(actor, RESOURCE_HEALTH)))
+        if((skill > 6.5) && (selfdamage > GetResourceAmount(actor, RES_HEALTH)))
             PHYS_INPUT_BUTTON_ATCK2(actor) = false;
         //if(PHYS_INPUT_BUTTON_ATCK2(actor) == true)
         //     dprint(ftos(desirabledamage),"\n");
index f804aaf44e9c637520a33a2673b47bed06aba853..6d63e539b49099a558de124334f28fca34826281 100644 (file)
@@ -2,7 +2,7 @@
 
 CLASS(MineLayer, Weapon)
 /* spawnfunc */ ATTRIB(MineLayer, m_canonical_spawnfunc, string, "weapon_minelayer");
-/* ammotype  */ ATTRIB(MineLayer, ammo_type, int, RESOURCE_ROCKETS);
+/* ammotype  */ ATTRIB(MineLayer, ammo_type, int, RES_ROCKETS);
 /* impulse   */ ATTRIB(MineLayer, impulse, int, 4);
 /* flags     */ ATTRIB(MineLayer, spawnflags, int, WEP_FLAG_MUTATORBLOCKED | WEP_FLAG_RELOADABLE | WEP_TYPE_SPLASH);
 /* rating    */ ATTRIB(MineLayer, bot_pickupbasevalue, float, 7000);
index 23c7a5e47db922c09fb4f86610836757ac0e8657..f95f6bd0051aff6af2fc108209b8666dd7a5f9ba 100644 (file)
@@ -54,15 +54,15 @@ void W_Mortar_Grenade_Explode2_use(entity this, entity actor, entity trigger)
 
 void W_Mortar_Grenade_Damage(entity this, entity inflictor, entity attacker, float damage, int deathtype, .entity weaponentity, vector hitloc, vector force)
 {
-       if(GetResourceAmount(this, RESOURCE_HEALTH) <= 0)
+       if(GetResourceAmount(this, RES_HEALTH) <= 0)
                return;
 
        if(!W_CheckProjectileDamage(inflictor.realowner, this.realowner, deathtype, -1)) // no exceptions
                return; // g_projectiles_damage says to halt
 
-       TakeResource(this, RESOURCE_HEALTH, damage);
+       TakeResource(this, RES_HEALTH, damage);
 
-       if(GetResourceAmount(this, RESOURCE_HEALTH) <= 0)
+       if(GetResourceAmount(this, RES_HEALTH) <= 0)
                W_PrepareExplosionByDamage(this, attacker, adaptor_think2use);
 }
 
@@ -176,7 +176,7 @@ void W_Mortar_Attack(Weapon thiswep, entity actor, .entity weaponentity)
        settouch(gren, W_Mortar_Grenade_Touch1);
 
        gren.takedamage = DAMAGE_YES;
-       SetResourceAmount(gren, RESOURCE_HEALTH, WEP_CVAR_PRI(mortar, health));
+       SetResourceAmount(gren, RES_HEALTH, WEP_CVAR_PRI(mortar, health));
        gren.damageforcescale = WEP_CVAR_PRI(mortar, damageforcescale);
        gren.event_damage = W_Mortar_Grenade_Damage;
        gren.damagedbycontents = true;
@@ -227,7 +227,7 @@ void W_Mortar_Attack2(Weapon thiswep, entity actor, .entity weaponentity)
        settouch(gren, W_Mortar_Grenade_Touch2);
 
        gren.takedamage = DAMAGE_YES;
-       SetResourceAmount(gren, RESOURCE_HEALTH, WEP_CVAR_SEC(mortar, health));
+       SetResourceAmount(gren, RES_HEALTH, WEP_CVAR_SEC(mortar, health));
        gren.damageforcescale = WEP_CVAR_SEC(mortar, damageforcescale);
        gren.event_damage = W_Mortar_Grenade_Damage;
        gren.damagedbycontents = true;
index affec0dbcae952696866a9c6e08c84d15b7ba454..d83fe59dc6fd5ad6df18357689b051c617da4622 100644 (file)
@@ -2,7 +2,7 @@
 
 CLASS(Mortar, Weapon)
 /* spawnfunc */ ATTRIB(Mortar, m_canonical_spawnfunc, string, "weapon_mortar");
-/* ammotype  */ ATTRIB(Mortar, ammo_type, int, RESOURCE_ROCKETS);
+/* ammotype  */ ATTRIB(Mortar, ammo_type, int, RES_ROCKETS);
 /* impulse   */ ATTRIB(Mortar, impulse, int, 4);
 /* flags     */ ATTRIB(Mortar, spawnflags, int, WEP_FLAG_NORMAL | WEP_FLAG_RELOADABLE | WEP_FLAG_CANCLIMB | WEP_TYPE_SPLASH);
 /* rating    */ ATTRIB(Mortar, bot_pickupbasevalue, float, 7000);
index a77093944b6e0fbab37bb5ca42aafc5eacc39174..735426feb698366006f2dad88c9a330b724e146a 100644 (file)
@@ -2,7 +2,7 @@
 
 CLASS(PortoLaunch, Weapon)
 /* spawnfunc */ ATTRIB(PortoLaunch, m_canonical_spawnfunc, string, "weapon_porto");
-/* ammotype  */ ATTRIB(PortoLaunch, ammo_type, int, RESOURCE_NONE);
+/* ammotype  */ ATTRIB(PortoLaunch, ammo_type, int, RES_NONE);
 /* impulse   */ ATTRIB(PortoLaunch, impulse, int, 0);
 /* flags     */ ATTRIB(PortoLaunch, spawnflags, int, WEP_TYPE_OTHER | WEP_FLAG_SUPERWEAPON | WEP_FLAG_NODUAL);
 /* rating    */ ATTRIB(PortoLaunch, bot_pickupbasevalue, float, 0);
index 560354c0529b40b5e19e9a4ff389a01946dae6c6..ae9a3b9aa5fa2b846800d280793f515b36e06baf 100644 (file)
@@ -2,7 +2,7 @@
 
 CLASS(Rifle, Weapon)
 /* spawnfunc */ ATTRIB(Rifle, m_canonical_spawnfunc, string, "weapon_rifle");
-/* ammotype  */ ATTRIB(Rifle, ammo_type, int, RESOURCE_BULLETS);
+/* ammotype  */ ATTRIB(Rifle, ammo_type, int, RES_BULLETS);
 /* impulse   */ ATTRIB(Rifle, impulse, int, 7);
 /* flags     */ ATTRIB(Rifle, spawnflags, int, WEP_FLAG_MUTATORBLOCKED | WEP_FLAG_RELOADABLE | WEP_TYPE_HITSCAN | WEP_FLAG_PENETRATEWALLS);
 /* rating    */ ATTRIB(Rifle, bot_pickupbasevalue, float, 7000);
index 2b69ed0c813bdeb8bebaf0bc3b92a9edabb87ad4..9e2a059be9025adba70b8a81c3e30bdc57d0e30c 100644 (file)
@@ -124,18 +124,18 @@ void W_Seeker_Missile_Think(entity this)
 
 void W_Seeker_Missile_Damage(entity this, entity inflictor, entity attacker, float damage, int deathtype, .entity weaponentity, vector hitloc, vector force)
 {
-       if(GetResourceAmount(this, RESOURCE_HEALTH) <= 0)
+       if(GetResourceAmount(this, RES_HEALTH) <= 0)
                return;
 
        if(!W_CheckProjectileDamage(inflictor.realowner, this.realowner, deathtype, -1)) // no exceptions
                return; // g_projectiles_damage says to halt
 
        if(this.realowner == attacker)
-               TakeResource(this, RESOURCE_HEALTH, (damage * 0.25));
+               TakeResource(this, RES_HEALTH, (damage * 0.25));
        else
-               TakeResource(this, RESOURCE_HEALTH, damage);
+               TakeResource(this, RES_HEALTH, damage);
 
-       if(GetResourceAmount(this, RESOURCE_HEALTH) <= 0)
+       if(GetResourceAmount(this, RES_HEALTH) <= 0)
                W_PrepareExplosionByDamage(this, attacker, W_Seeker_Missile_Explode_think);
 }
 
@@ -190,7 +190,7 @@ void W_Seeker_Fire_Missile(Weapon thiswep, entity actor, .entity weaponentity, v
        missile.scale           = 2;
        missile.takedamage      = DAMAGE_YES;
        missile.weaponentity_fld = weaponentity;
-       SetResourceAmount(missile, RESOURCE_HEALTH, WEP_CVAR(seeker, missile_health));
+       SetResourceAmount(missile, RES_HEALTH, WEP_CVAR(seeker, missile_health));
        missile.damageforcescale = WEP_CVAR(seeker, missile_damageforcescale);
        missile.damagedbycontents = true;
        IL_PUSH(g_damagedbycontents, missile);
@@ -415,10 +415,10 @@ void W_Seeker_Tag_Explode(entity this)
 
 void W_Seeker_Tag_Damage(entity this, entity inflictor, entity attacker, float damage, int deathtype, .entity weaponentity, vector hitloc, vector force)
 {
-       if(GetResourceAmount(this, RESOURCE_HEALTH) <= 0)
+       if(GetResourceAmount(this, RES_HEALTH) <= 0)
                return;
-       TakeResource(this, RESOURCE_HEALTH, damage);
-       if(GetResourceAmount(this, RESOURCE_HEALTH) <= 0)
+       TakeResource(this, RES_HEALTH, damage);
+       if(GetResourceAmount(this, RES_HEALTH) <= 0)
                W_Seeker_Tag_Explode(this);
 }
 
@@ -506,7 +506,7 @@ void W_Seeker_Fire_Tag(Weapon thiswep, entity actor, .entity weaponentity)
 
        missile.takedamage       = DAMAGE_YES;
        missile.event_damage     = W_Seeker_Tag_Damage;
-       SetResourceAmount(missile, RESOURCE_HEALTH, WEP_CVAR(seeker, tag_health));
+       SetResourceAmount(missile, RES_HEALTH, WEP_CVAR(seeker, tag_health));
        missile.damageforcescale = WEP_CVAR(seeker, tag_damageforcescale);
 
        setorigin(missile, w_shotorg);
index e4e9fd535248f4b1f58bfe71e96866d9ac2f9306..5690938137f19955987acc2b084fb4b92ebe2251 100644 (file)
@@ -2,7 +2,7 @@
 
 CLASS(Seeker, Weapon)
 /* spawnfunc */ ATTRIB(Seeker, m_canonical_spawnfunc, string, "weapon_seeker");
-/* ammotype  */ ATTRIB(Seeker, ammo_type, int, RESOURCE_ROCKETS);
+/* ammotype  */ ATTRIB(Seeker, ammo_type, int, RES_ROCKETS);
 /* impulse   */ ATTRIB(Seeker, impulse, int, 8);
 /* flags     */ ATTRIB(Seeker, spawnflags, int, WEP_FLAG_MUTATORBLOCKED | WEP_FLAG_RELOADABLE | WEP_TYPE_SPLASH);
 /* rating    */ ATTRIB(Seeker, bot_pickupbasevalue, float, 5000);
index ade2e9a85c46a08984c3adb698f80254323021a2..f42eea7d49c250a13f2270d226c3eb485f2a8b83 100644 (file)
@@ -2,7 +2,7 @@
 
 CLASS(Shockwave, Weapon)
 /* spawnfunc */ ATTRIB(Shockwave, m_canonical_spawnfunc, string, "weapon_shockwave");
-/* ammotype  */ //ATTRIB(Shockwave, ammo_type, int, RESOURCE_NONE);
+/* ammotype  */ //ATTRIB(Shockwave, ammo_type, int, RES_NONE);
 /* impulse   */ ATTRIB(Shockwave, impulse, int, 2);
 /* flags     */ ATTRIB(Shockwave, spawnflags, int, WEP_TYPE_HITSCAN | WEP_FLAG_CANCLIMB | WEP_TYPE_MELEE_SEC);
 /* rating    */ ATTRIB(Shockwave, bot_pickupbasevalue, float, 3000);
index e40b1d8a1f7f8aa07914fd2a4afabc325cff901d..5a47a18890cda1246024982d4f9a1ec90bce7dc0 100644 (file)
@@ -2,7 +2,7 @@
 
 CLASS(Shotgun, Weapon)
 /* spawnfunc */ ATTRIB(Shotgun, m_canonical_spawnfunc, string, "weapon_shotgun");
-/* ammotype  */ ATTRIB(Shotgun, ammo_type, int, RESOURCE_SHELLS);
+/* ammotype  */ ATTRIB(Shotgun, ammo_type, int, RES_SHELLS);
 /* impulse   */ ATTRIB(Shotgun, impulse, int, 2);
 /* flags     */ ATTRIB(Shotgun, spawnflags, int, WEP_FLAG_NORMAL | WEP_FLAG_RELOADABLE | WEP_TYPE_HITSCAN | WEP_TYPE_MELEE_SEC);
 /* rating    */ ATTRIB(Shotgun, bot_pickupbasevalue, float, 6000);
index cefa4558f2fd9b43f7aa2fa1a9fe94f8cd63582b..1629aa90324ed23135f797321cfb4c41e85be514 100644 (file)
@@ -295,7 +295,7 @@ METHOD(Vaporizer, wr_think, void(entity thiswep, entity actor, .entity weaponent
     } else if(WEP_CVAR(vaporizer, reload_ammo) && actor.(weaponentity).clip_load < vaporizer_ammo) { // forced reload
         thiswep.wr_reload(thiswep, actor, weaponentity);
     }
-    if((fire & 1) && (GetResourceAmount(actor, RESOURCE_CELLS) || !autocvar_g_rm) && !forbidWeaponUse(actor))
+    if((fire & 1) && (GetResourceAmount(actor, RES_CELLS) || !autocvar_g_rm) && !forbidWeaponUse(actor))
     {
         if(weapon_prepareattack(thiswep, actor, weaponentity, false, WEP_CVAR_PRI(vaporizer, refire)))
         {
@@ -303,7 +303,7 @@ METHOD(Vaporizer, wr_think, void(entity thiswep, entity actor, .entity weaponent
             weapon_thinkf(actor, weaponentity, WFRAME_FIRE1, WEP_CVAR_PRI(vaporizer, animtime), w_ready);
         }
     }
-    if((fire & 2) || ((fire & 1) && !GetResourceAmount(actor, RESOURCE_CELLS) && autocvar_g_rm))
+    if((fire & 2) || ((fire & 1) && !GetResourceAmount(actor, RES_CELLS) && autocvar_g_rm))
     {
         if((autocvar_g_rm && autocvar_g_rm_laser) || autocvar_g_rm_laser == 2)
         {
index 9bbc5e9bdded6c4098a31020e9da6139b1795b07..207ae8e630dd4a2a36905f8808739ad929cd6907 100644 (file)
@@ -2,7 +2,7 @@
 
 CLASS(Vaporizer, Weapon)
 /* spawnfunc */ ATTRIB(Vaporizer, m_canonical_spawnfunc, string, "weapon_vaporizer");
-/* ammotype  */ ATTRIB(Vaporizer, ammo_type, int, RESOURCE_CELLS);
+/* ammotype  */ ATTRIB(Vaporizer, ammo_type, int, RES_CELLS);
 /* impulse   */ ATTRIB(Vaporizer, impulse, int, 7);
 /* flags     */ ATTRIB(Vaporizer, spawnflags, int, WEP_FLAG_RELOADABLE | WEP_FLAG_CANCLIMB | WEP_FLAG_SUPERWEAPON | WEP_TYPE_HITSCAN | WEP_FLAG_NODUAL);
 /* rating    */ ATTRIB(Vaporizer, bot_pickupbasevalue, float, 10000);
index 8a11b2e13e4c3a00a751400047f4ded606a94789..570464cb913e7ddbc758509323b61fb0dc97baec 100644 (file)
@@ -2,7 +2,7 @@
 
 CLASS(Vortex, Weapon)
 /* spawnfunc */ ATTRIB(Vortex, m_canonical_spawnfunc, string, "weapon_vortex");
-/* ammotype  */ ATTRIB(Vortex, ammo_type, int, RESOURCE_CELLS);
+/* ammotype  */ ATTRIB(Vortex, ammo_type, int, RES_CELLS);
 /* impulse   */ ATTRIB(Vortex, impulse, int, 7);
 /* flags     */ ATTRIB(Vortex, spawnflags, int, WEP_FLAG_NORMAL | WEP_FLAG_RELOADABLE | WEP_TYPE_HITSCAN);
 /* rating    */ ATTRIB(Vortex, bot_pickupbasevalue, float, 8000);
index b82398675c175290a77594bba4b420fc11362647..6551771681a8e31f6a54966b28d33093a87de8c9 100644 (file)
@@ -477,7 +477,7 @@ void havocbot_movetogoal(entity this)
        // Jetpack navigation
        if(this.navigation_jetpack_goal)
        if(this.goalcurrent==this.navigation_jetpack_goal)
-       if(GetResourceAmount(this, RESOURCE_FUEL))
+       if(GetResourceAmount(this, RES_FUEL))
        {
                if(autocvar_bot_debug_goalstack)
                {
@@ -673,7 +673,7 @@ void havocbot_movetogoal(entity this)
                        return;
                }
                else if(!this.jumppadcount && !this.goalcurrent.wphardwired
-                       && GetResourceAmount(this, RESOURCE_HEALTH) + GetResourceAmount(this, RESOURCE_ARMOR) > ROCKETJUMP_DAMAGE())
+                       && GetResourceAmount(this, RES_HEALTH) + GetResourceAmount(this, RES_ARMOR) > ROCKETJUMP_DAMAGE())
                {
                        if(this.velocity.z < 0)
                        {
@@ -1303,7 +1303,7 @@ void havocbot_chooseenemy(entity this)
                        traceline(this.origin+this.view_ofs, ( this.enemy.absmin + this.enemy.absmax ) * 0.5,false,NULL);
                        if (trace_ent == this.enemy || trace_fraction == 1)
                        if (vdist(((this.enemy.absmin + this.enemy.absmax) * 0.5) - this.origin, <, 1000))
-                       if (GetResourceAmount(this, RESOURCE_HEALTH) > 30)
+                       if (GetResourceAmount(this, RES_HEALTH) > 30)
                        {
                                // remain tracking him for a shot while (case he went after a small corner or pilar
                                this.havocbot_chooseenemy_finished = time + 0.5;
index 1d66df09668a783b4b763a72174e944d2e8e4dcc..64a8f97ea7a45b6e9f10364caca08dd6db633a0a 100644 (file)
@@ -50,14 +50,14 @@ void havocbot_goalrating_waypoints(entity this, float ratingscale, vector org, f
 
 bool havocbot_goalrating_item_can_be_left_to_teammate(entity this, entity player, entity item)
 {
-       if (GetResourceAmount(item, RESOURCE_HEALTH) && GetResourceAmount(player, RESOURCE_HEALTH) <= GetResourceAmount(this, RESOURCE_HEALTH)) {return true;}
-       if (GetResourceAmount(item, RESOURCE_ARMOR) && GetResourceAmount(player, RESOURCE_ARMOR) <= GetResourceAmount(this, RESOURCE_ARMOR)) {return true;}
+       if (GetResourceAmount(item, RES_HEALTH) && GetResourceAmount(player, RES_HEALTH) <= GetResourceAmount(this, RES_HEALTH)) {return true;}
+       if (GetResourceAmount(item, RES_ARMOR) && GetResourceAmount(player, RES_ARMOR) <= GetResourceAmount(this, RES_ARMOR)) {return true;}
        if (STAT(WEAPONS, item) && !(STAT(WEAPONS, player) & STAT(WEAPONS, item))) {return true;}
-       if (GetResourceAmount(item, RESOURCE_SHELLS) && GetResourceAmount(player, RESOURCE_SHELLS) <= GetResourceAmount(this, RESOURCE_SHELLS)) {return true;}
-       if (GetResourceAmount(item, RESOURCE_BULLETS) && GetResourceAmount(player, RESOURCE_BULLETS) <= GetResourceAmount(this, RESOURCE_BULLETS)) {return true;}
-       if (GetResourceAmount(item, RESOURCE_ROCKETS) && GetResourceAmount(player, RESOURCE_ROCKETS) <= GetResourceAmount(this, RESOURCE_ROCKETS)) {return true;}
-       if (GetResourceAmount(item, RESOURCE_CELLS) && GetResourceAmount(player, RESOURCE_CELLS) <= GetResourceAmount(this, RESOURCE_CELLS)) {return true;}
-       if (GetResourceAmount(item, RESOURCE_PLASMA) && GetResourceAmount(player, RESOURCE_PLASMA) <= GetResourceAmount(this, RESOURCE_PLASMA)) {return true;}
+       if (GetResourceAmount(item, RES_SHELLS) && GetResourceAmount(player, RES_SHELLS) <= GetResourceAmount(this, RES_SHELLS)) {return true;}
+       if (GetResourceAmount(item, RES_BULLETS) && GetResourceAmount(player, RES_BULLETS) <= GetResourceAmount(this, RES_BULLETS)) {return true;}
+       if (GetResourceAmount(item, RES_ROCKETS) && GetResourceAmount(player, RES_ROCKETS) <= GetResourceAmount(this, RES_ROCKETS)) {return true;}
+       if (GetResourceAmount(item, RES_CELLS) && GetResourceAmount(player, RES_CELLS) <= GetResourceAmount(this, RES_CELLS)) {return true;}
+       if (GetResourceAmount(item, RES_PLASMA) && GetResourceAmount(player, RES_PLASMA) <= GetResourceAmount(this, RES_PLASMA)) {return true;}
        if (item.itemdef.instanceOfPowerup) {return true;}
 
        return false;
@@ -208,7 +208,7 @@ void havocbot_goalrating_enemyplayers(entity this, float ratingscale, vector org
                        continue;
                */
 
-               t = ((GetResourceAmount(this, RESOURCE_HEALTH) + GetResourceAmount(this, RESOURCE_ARMOR)) - (GetResourceAmount(it, RESOURCE_HEALTH) + GetResourceAmount(it, RESOURCE_ARMOR))) / 150;
+               t = ((GetResourceAmount(this, RES_HEALTH) + GetResourceAmount(this, RES_ARMOR)) - (GetResourceAmount(it, RES_HEALTH) + GetResourceAmount(it, RES_ARMOR))) / 150;
                t = bound(0, 1 + t, 3);
                if (skill > 3)
                {
index 7c7f7e1e1264a8e7b9eaeb98be8f7780efd1cd85..a27b4ca3543e24c8019f28b95772516f470d13be 100644 (file)
@@ -1332,10 +1332,10 @@ void navigation_routerating(entity this, entity e, float f, float rangebias)
                        t += xydistance / autocvar_g_jetpack_maxspeed_side;
                        fuel = t * autocvar_g_jetpack_fuel * 0.8;
 
-                       LOG_DEBUG("jetpack ai: required fuel ", ftos(fuel), ", have ", ftos(GetResourceAmount(this, RESOURCE_FUEL)));
+                       LOG_DEBUG("jetpack ai: required fuel ", ftos(fuel), ", have ", ftos(GetResourceAmount(this, RES_FUEL)));
 
                        // enough fuel ?
-                       if(GetResourceAmount(this, RESOURCE_FUEL) > fuel || (this.items & IT_UNLIMITED_WEAPON_AMMO))
+                       if(GetResourceAmount(this, RES_FUEL) > fuel || (this.items & IT_UNLIMITED_WEAPON_AMMO))
                        {
                                // Estimate cost
                                // (as onground costs calculation is mostly based on distances, here we do the same establishing some relationship
index 555f6fc58a54c8e898f4472e7ee81577ea99b579..e72b17805c2d2e5ab01027f0eca714bb4f04c078 100644 (file)
@@ -624,7 +624,7 @@ float bot_cmd_eval(entity this, string expr)
        switch(expr)
        {
                case "health":
-                       return GetResourceAmount(this, RESOURCE_HEALTH);
+                       return GetResourceAmount(this, RES_HEALTH);
                case "speed":
                        return vlen(this.velocity);
                case "flagcarrier":
index 277db38fef521c485f3627e88450a08cfcb481cc..be481617ca3fac15de8c88640095cf5510c44176 100644 (file)
@@ -152,14 +152,14 @@ float CheatImpulse(entity this, int imp)
                        this.personal.origin = this.origin;
                        this.personal.v_angle = this.v_angle;
                        this.personal.velocity = this.velocity;
-                       SetResourceAmount(this.personal, RESOURCE_ROCKETS, GetResourceAmount(this, RESOURCE_ROCKETS));
-                       SetResourceAmount(this.personal, RESOURCE_BULLETS, GetResourceAmount(this, RESOURCE_BULLETS));
-                       SetResourceAmount(this.personal, RESOURCE_CELLS, GetResourceAmount(this, RESOURCE_CELLS));
-                       SetResourceAmount(this.personal, RESOURCE_PLASMA, GetResourceAmount(this, RESOURCE_PLASMA));
-                       SetResourceAmount(this.personal, RESOURCE_SHELLS, GetResourceAmount(this, RESOURCE_SHELLS));
-                       SetResourceAmount(this.personal, RESOURCE_FUEL, GetResourceAmount(this, RESOURCE_FUEL));
-                       SetResourceAmount(this.personal, RESOURCE_HEALTH, max(1, GetResourceAmount(this, RESOURCE_HEALTH)));
-                       SetResourceAmount(this.personal, RESOURCE_ARMOR, GetResourceAmount(this, RESOURCE_ARMOR));
+                       SetResourceAmount(this.personal, RES_ROCKETS, GetResourceAmount(this, RES_ROCKETS));
+                       SetResourceAmount(this.personal, RES_BULLETS, GetResourceAmount(this, RES_BULLETS));
+                       SetResourceAmount(this.personal, RES_CELLS, GetResourceAmount(this, RES_CELLS));
+                       SetResourceAmount(this.personal, RES_PLASMA, GetResourceAmount(this, RES_PLASMA));
+                       SetResourceAmount(this.personal, RES_SHELLS, GetResourceAmount(this, RES_SHELLS));
+                       SetResourceAmount(this.personal, RES_FUEL, GetResourceAmount(this, RES_FUEL));
+                       SetResourceAmount(this.personal, RES_HEALTH, max(1, GetResourceAmount(this, RES_HEALTH)));
+                       SetResourceAmount(this.personal, RES_ARMOR, GetResourceAmount(this, RES_ARMOR));
                        STAT(WEAPONS, this.personal) = STAT(WEAPONS, this);
                        this.personal.items = this.items;
                        this.personal.pauserotarmor_finished = this.pauserotarmor_finished;
@@ -211,14 +211,14 @@ float CheatImpulse(entity this, int imp)
                                        MUTATOR_CALLHOOK(AbortSpeedrun, this);
                                }
 
-                               SetResourceAmount(this, RESOURCE_ROCKETS, GetResourceAmount(this.personal, RESOURCE_ROCKETS));
-                               SetResourceAmount(this, RESOURCE_BULLETS, GetResourceAmount(this.personal, RESOURCE_BULLETS));
-                               SetResourceAmount(this, RESOURCE_CELLS, GetResourceAmount(this.personal, RESOURCE_CELLS));
-                               SetResourceAmount(this, RESOURCE_PLASMA, GetResourceAmount(this.personal, RESOURCE_PLASMA));
-                               SetResourceAmount(this, RESOURCE_SHELLS, GetResourceAmount(this.personal, RESOURCE_SHELLS));
-                               SetResourceAmount(this, RESOURCE_FUEL, GetResourceAmount(this.personal, RESOURCE_FUEL));
-                               SetResourceAmount(this, RESOURCE_HEALTH, GetResourceAmount(this.personal, RESOURCE_HEALTH));
-                               SetResourceAmount(this, RESOURCE_ARMOR, GetResourceAmount(this.personal, RESOURCE_ARMOR));
+                               SetResourceAmount(this, RES_ROCKETS, GetResourceAmount(this.personal, RES_ROCKETS));
+                               SetResourceAmount(this, RES_BULLETS, GetResourceAmount(this.personal, RES_BULLETS));
+                               SetResourceAmount(this, RES_CELLS, GetResourceAmount(this.personal, RES_CELLS));
+                               SetResourceAmount(this, RES_PLASMA, GetResourceAmount(this.personal, RES_PLASMA));
+                               SetResourceAmount(this, RES_SHELLS, GetResourceAmount(this.personal, RES_SHELLS));
+                               SetResourceAmount(this, RES_FUEL, GetResourceAmount(this.personal, RES_FUEL));
+                               SetResourceAmount(this, RES_HEALTH, GetResourceAmount(this.personal, RES_HEALTH));
+                               SetResourceAmount(this, RES_ARMOR, GetResourceAmount(this.personal, RES_ARMOR));
                                STAT(WEAPONS, this) = STAT(WEAPONS, this.personal);
                                this.items = this.personal.items;
                                this.pauserotarmor_finished = time + this.personal.pauserotarmor_finished - this.personal.teleport_time;
@@ -355,7 +355,7 @@ float CheatCommand(entity this, int argc)
                                        entity e = spawn();
                                        e.model = strzone(argv(1));
                                        e.mdl = "rocket_explode";
-                                       SetResourceAmount(e, RESOURCE_HEALTH, 1000);
+                                       SetResourceAmount(e, RES_HEALTH, 1000);
                                        setorigin(e, trace_endpos);
                                        e.effects = EF_NOMODELFLAGS;
                                        if(f == 1)
index 265d2111da9a2f41f7ab60262fe79eed3fc45ea9..8f64de4b10e661ef6e57c7e6ceb7e71e31daba92 100644 (file)
@@ -232,7 +232,7 @@ void PutObserverInServer(entity this)
 
        if (IS_PLAYER(this))
        {
-               if(GetResourceAmount(this, RESOURCE_HEALTH) >= 1)
+               if(GetResourceAmount(this, RES_HEALTH) >= 1)
                {
                        // despawn effect
                        Send_Effect(EFFECT_SPAWN_NEUTRAL, this.origin, '0 0 0', 1);
@@ -311,14 +311,14 @@ void PutObserverInServer(entity this)
        if(this.damagedbycontents)
                IL_REMOVE(g_damagedbycontents, this);
        this.damagedbycontents = false;
-       SetResourceAmount(this, RESOURCE_HEALTH, FRAGS_SPECTATOR);
+       SetResourceAmount(this, RES_HEALTH, FRAGS_SPECTATOR);
        SetSpectatee_status(this, etof(this));
        this.takedamage = DAMAGE_NO;
        this.solid = SOLID_NOT;
        set_movetype(this, MOVETYPE_FLY_WORLDONLY); // user preference is controlled by playerprethink
        this.flags = FL_CLIENT | FL_NOTARGET;
        this.effects = 0;
-       SetResourceAmount(this, RESOURCE_ARMOR, autocvar_g_balance_armor_start); // was 666?!
+       SetResourceAmount(this, RES_ARMOR, autocvar_g_balance_armor_start); // was 666?!
        this.pauserotarmor_finished = 0;
        this.pauserothealth_finished = 0;
        this.pauseregen_finished = 0;
@@ -557,24 +557,24 @@ void PutPlayerInServer(entity this)
        this.effects = EF_TELEPORT_BIT | EF_RESTARTANIM_BIT;
 
        if (warmup_stage) {
-               SetResourceAmount(this, RESOURCE_SHELLS, warmup_start_ammo_shells);
-               SetResourceAmount(this, RESOURCE_BULLETS, warmup_start_ammo_nails);
-               SetResourceAmount(this, RESOURCE_ROCKETS, warmup_start_ammo_rockets);
-               SetResourceAmount(this, RESOURCE_CELLS, warmup_start_ammo_cells);
-               SetResourceAmount(this, RESOURCE_PLASMA, warmup_start_ammo_plasma);
-               SetResourceAmount(this, RESOURCE_FUEL, warmup_start_ammo_fuel);
-               SetResourceAmount(this, RESOURCE_HEALTH, warmup_start_health);
-               SetResourceAmount(this, RESOURCE_ARMOR, warmup_start_armorvalue);
+               SetResourceAmount(this, RES_SHELLS, warmup_start_ammo_shells);
+               SetResourceAmount(this, RES_BULLETS, warmup_start_ammo_nails);
+               SetResourceAmount(this, RES_ROCKETS, warmup_start_ammo_rockets);
+               SetResourceAmount(this, RES_CELLS, warmup_start_ammo_cells);
+               SetResourceAmount(this, RES_PLASMA, warmup_start_ammo_plasma);
+               SetResourceAmount(this, RES_FUEL, warmup_start_ammo_fuel);
+               SetResourceAmount(this, RES_HEALTH, warmup_start_health);
+               SetResourceAmount(this, RES_ARMOR, warmup_start_armorvalue);
                STAT(WEAPONS, this) = WARMUP_START_WEAPONS;
        } else {
-               SetResourceAmount(this, RESOURCE_SHELLS, start_ammo_shells);
-               SetResourceAmount(this, RESOURCE_BULLETS, start_ammo_nails);
-               SetResourceAmount(this, RESOURCE_ROCKETS, start_ammo_rockets);
-               SetResourceAmount(this, RESOURCE_CELLS, start_ammo_cells);
-               SetResourceAmount(this, RESOURCE_PLASMA, start_ammo_plasma);
-               SetResourceAmount(this, RESOURCE_FUEL, start_ammo_fuel);
-               SetResourceAmount(this, RESOURCE_HEALTH, start_health);
-               SetResourceAmount(this, RESOURCE_ARMOR, start_armorvalue);
+               SetResourceAmount(this, RES_SHELLS, start_ammo_shells);
+               SetResourceAmount(this, RES_BULLETS, start_ammo_nails);
+               SetResourceAmount(this, RES_ROCKETS, start_ammo_rockets);
+               SetResourceAmount(this, RES_CELLS, start_ammo_cells);
+               SetResourceAmount(this, RES_PLASMA, start_ammo_plasma);
+               SetResourceAmount(this, RES_FUEL, start_ammo_fuel);
+               SetResourceAmount(this, RES_HEALTH, start_health);
+               SetResourceAmount(this, RES_ARMOR, start_armorvalue);
                STAT(WEAPONS, this) = start_weapons;
                if (MUTATOR_CALLHOOK(ForbidRandomStartWeapons, this) == false)
                {
@@ -1575,25 +1575,25 @@ void player_regen(entity this)
                float mina, maxa, limith, limita;
                maxa = autocvar_g_balance_armor_rotstable;
                mina = autocvar_g_balance_armor_regenstable;
-               limith = GetResourceLimit(this, RESOURCE_HEALTH);
-               limita = GetResourceLimit(this, RESOURCE_ARMOR);
+               limith = GetResourceLimit(this, RES_HEALTH);
+               limita = GetResourceLimit(this, RES_ARMOR);
 
                regen_health_rotstable = regen_health_rotstable * max_mod;
                regen_health_stable = regen_health_stable * max_mod;
                limith = limith * limit_mod;
                limita = limita * limit_mod;
 
-               SetResourceAmount(this, RESOURCE_ARMOR, CalcRotRegen(GetResourceAmount(this, RESOURCE_ARMOR), mina, autocvar_g_balance_armor_regen, autocvar_g_balance_armor_regenlinear, 
+               SetResourceAmount(this, RES_ARMOR, CalcRotRegen(GetResourceAmount(this, RES_ARMOR), mina, autocvar_g_balance_armor_regen, autocvar_g_balance_armor_regenlinear, 
                                                                        regen_mod * frametime * (time > this.pauseregen_finished), maxa, autocvar_g_balance_armor_rot, autocvar_g_balance_armor_rotlinear,
                                                                        rot_mod * frametime * (time > this.pauserotarmor_finished), limita));
-               SetResourceAmount(this, RESOURCE_HEALTH, CalcRotRegen(GetResourceAmount(this, RESOURCE_HEALTH), regen_health_stable, regen_health, regen_health_linear,
+               SetResourceAmount(this, RES_HEALTH, CalcRotRegen(GetResourceAmount(this, RES_HEALTH), regen_health_stable, regen_health, regen_health_linear,
                                                                        regen_mod * frametime * (time > this.pauseregen_finished), regen_health_rotstable, regen_health_rot, regen_health_rotlinear,
                                                                        rot_mod * frametime * (time > this.pauserothealth_finished), limith));
        }
 
        // if player rotted to death...  die!
        // check this outside above checks, as player may still be able to rot to death
-       if(GetResourceAmount(this, RESOURCE_HEALTH) < 1)
+       if(GetResourceAmount(this, RES_HEALTH) < 1)
        {
                if(this.vehicle)
                        vehicles_exit(this.vehicle, VHEF_RELEASE);
@@ -1607,9 +1607,9 @@ void player_regen(entity this)
 
                maxf = autocvar_g_balance_fuel_rotstable;
                minf = autocvar_g_balance_fuel_regenstable;
-               limitf = GetResourceLimit(this, RESOURCE_FUEL);
+               limitf = GetResourceLimit(this, RES_FUEL);
 
-               SetResourceAmount(this, RESOURCE_FUEL, CalcRotRegen(GetResourceAmount(this, RESOURCE_FUEL), minf, autocvar_g_balance_fuel_regen, autocvar_g_balance_fuel_regenlinear, 
+               SetResourceAmount(this, RES_FUEL, CalcRotRegen(GetResourceAmount(this, RES_FUEL), minf, autocvar_g_balance_fuel_regen, autocvar_g_balance_fuel_regenlinear, 
                                                                                frametime * (time > this.pauseregen_finished) * ((this.items & ITEM_JetpackRegen.m_itemid) != 0),
                                                                                maxf, autocvar_g_balance_fuel_rot, autocvar_g_balance_fuel_rotlinear, frametime * (time > this.pauserotfuel_finished), limitf));
        }
@@ -1657,15 +1657,15 @@ void SpectateCopy(entity this, entity spectatee)
        MUTATOR_CALLHOOK(SpectateCopy, spectatee, this);
        PS(this) = PS(spectatee);
        this.armortype = spectatee.armortype;
-       SetResourceAmount(this, RESOURCE_ARMOR, GetResourceAmount(spectatee, RESOURCE_ARMOR));
-       SetResourceAmount(this, RESOURCE_CELLS, GetResourceAmount(spectatee, RESOURCE_CELLS));
-       SetResourceAmount(this, RESOURCE_PLASMA, GetResourceAmount(spectatee, RESOURCE_PLASMA));
-       SetResourceAmount(this, RESOURCE_SHELLS, GetResourceAmount(spectatee, RESOURCE_SHELLS));
-       SetResourceAmount(this, RESOURCE_BULLETS, GetResourceAmount(spectatee, RESOURCE_BULLETS));
-       SetResourceAmount(this, RESOURCE_ROCKETS, GetResourceAmount(spectatee, RESOURCE_ROCKETS));
-       SetResourceAmount(this, RESOURCE_FUEL, GetResourceAmount(spectatee, RESOURCE_FUEL));
+       SetResourceAmount(this, RES_ARMOR, GetResourceAmount(spectatee, RES_ARMOR));
+       SetResourceAmount(this, RES_CELLS, GetResourceAmount(spectatee, RES_CELLS));
+       SetResourceAmount(this, RES_PLASMA, GetResourceAmount(spectatee, RES_PLASMA));
+       SetResourceAmount(this, RES_SHELLS, GetResourceAmount(spectatee, RES_SHELLS));
+       SetResourceAmount(this, RES_BULLETS, GetResourceAmount(spectatee, RES_BULLETS));
+       SetResourceAmount(this, RES_ROCKETS, GetResourceAmount(spectatee, RES_ROCKETS));
+       SetResourceAmount(this, RES_FUEL, GetResourceAmount(spectatee, RES_FUEL));
        this.effects = spectatee.effects & EFMASK_CHEAP; // eat performance
-       SetResourceAmount(this, RESOURCE_HEALTH, GetResourceAmount(spectatee, RESOURCE_HEALTH));
+       SetResourceAmount(this, RES_HEALTH, GetResourceAmount(spectatee, RES_HEALTH));
        CS(this).impulse = 0;
        this.items = spectatee.items;
        STAT(LAST_PICKUP, this) = STAT(LAST_PICKUP, spectatee);
@@ -2173,7 +2173,7 @@ bool PlayerThink(entity this)
                }
 
                this.items_added = 0;
-               if ((this.items & ITEM_Jetpack.m_itemid) && ((this.items & ITEM_JetpackRegen.m_itemid) || GetResourceAmount(this, RESOURCE_FUEL) >= 0.01))
+               if ((this.items & ITEM_Jetpack.m_itemid) && ((this.items & ITEM_JetpackRegen.m_itemid) || GetResourceAmount(this, RES_FUEL) >= 0.01))
             this.items_added |= IT_FUEL;
 
                this.items |= this.items_added;
@@ -2429,7 +2429,7 @@ void PlayerPreThink (entity this)
                if (STAT(FROZEN, this) == FROZEN_TEMP_REVIVING)
                {
                        STAT(REVIVE_PROGRESS, this) = bound(0, STAT(REVIVE_PROGRESS, this) + frametime * this.revive_speed, 1);
-                       SetResourceAmount(this, RESOURCE_HEALTH, max(1, STAT(REVIVE_PROGRESS, this) * start_health));
+                       SetResourceAmount(this, RES_HEALTH, max(1, STAT(REVIVE_PROGRESS, this) * start_health));
                        this.iceblock.alpha = bound(0.2, 1 - STAT(REVIVE_PROGRESS, this), 1);
 
                        if (STAT(REVIVE_PROGRESS, this) >= 1)
@@ -2438,9 +2438,9 @@ void PlayerPreThink (entity this)
                else if (STAT(FROZEN, this) == FROZEN_TEMP_DYING)
                {
                        STAT(REVIVE_PROGRESS, this) = bound(0, STAT(REVIVE_PROGRESS, this) - frametime * this.revive_speed, 1);
-                       SetResourceAmount(this, RESOURCE_HEALTH, max(0, autocvar_g_nades_ice_health + (start_health-autocvar_g_nades_ice_health) * STAT(REVIVE_PROGRESS, this)));
+                       SetResourceAmount(this, RES_HEALTH, max(0, autocvar_g_nades_ice_health + (start_health-autocvar_g_nades_ice_health) * STAT(REVIVE_PROGRESS, this)));
 
-                       if (GetResourceAmount(this, RESOURCE_HEALTH) < 1)
+                       if (GetResourceAmount(this, RES_HEALTH) < 1)
                        {
                                if (this.vehicle)
                                        vehicles_exit(this.vehicle, VHEF_RELEASE);
@@ -2682,7 +2682,7 @@ void PlayerPostThink (entity this)
        }
 
        if (this.waypointsprite_attachedforcarrier) {
-               float hp = healtharmor_maxdamage(GetResourceAmount(this, RESOURCE_HEALTH), GetResourceAmount(this, RESOURCE_ARMOR), autocvar_g_balance_armor_blockpercent, DEATH_WEAPON.m_id).x;
+               float hp = healtharmor_maxdamage(GetResourceAmount(this, RES_HEALTH), GetResourceAmount(this, RES_ARMOR), autocvar_g_balance_armor_blockpercent, DEATH_WEAPON.m_id).x;
                WaypointSprite_UpdateHealth(this.waypointsprite_attachedforcarrier, hp);
        }
 
index e39d5039dd8f4debe754d6487671416e401f5853..aec9957c7b16d11cfd02010ee0b074e7697941ae 100644 (file)
@@ -285,7 +285,7 @@ void ClientCommand_kill(entity caller, int request)
                        if(IS_SPEC(caller) || IS_OBSERVER(caller))
                                return; // no point warning about this, command does nothing
 
-                       if(GetResourceAmount(caller, RESOURCE_HEALTH) <= 0)
+                       if(GetResourceAmount(caller, RES_HEALTH) <= 0)
                        {
                                sprint(caller, "Can't die - you are already dead!\n");
                                return;
index 643afa3f177887ff8ab2754a30c882eb90263231..207a9c44a1a6724465730c85fce8c48df32de964 100644 (file)
@@ -405,7 +405,7 @@ void CommonCommand_editmob(int request, entity caller, int argc)
                                        if (mon.realowner != caller && autocvar_g_monsters_edit < 2) { print_to(caller, "This monster does not belong to you"); return; }
                                        if (!is_visible) { print_to(caller, "You must look at your monster to edit it"); return; }
 
-                                       Damage(mon, NULL, NULL, GetResourceAmount(mon, RESOURCE_HEALTH) + mon.max_health + 200, DEATH_KILL.m_id, DMG_NOWEP, mon.origin, '0 0 0');
+                                       Damage(mon, NULL, NULL, GetResourceAmount(mon, RES_HEALTH) + mon.max_health + 200, DEATH_KILL.m_id, DMG_NOWEP, mon.origin, '0 0 0');
                                        print_to(caller, strcat("Your pet '", mon.monster_name, "' has been brutally mutilated"));
                                        return;
                                }
index ff74d2ddb4ce1591c164ed81f99d07ea3d802564..e13fffa01dee1ca64b29ca1b6f123800c197f123 100644 (file)
@@ -88,25 +88,25 @@ void target_init_use(entity this, entity actor, entity trigger)
 {
        if (!(this.spawnflags & 1))
        {
-               SetResourceAmount(actor, RESOURCE_ARMOR, start_armorvalue);
+               SetResourceAmount(actor, RES_ARMOR, start_armorvalue);
                actor.pauserotarmor_finished = time + autocvar_g_balance_pause_armor_rot;
        }
 
        if (!(this.spawnflags & 2))
        {
-               SetResourceAmount(actor, RESOURCE_HEALTH, start_health);
+               SetResourceAmount(actor, RES_HEALTH, start_health);
                actor.pauserothealth_finished = time + autocvar_g_balance_pause_health_rot;
                actor.pauseregen_finished = time + autocvar_g_balance_pause_health_regen;
        }
 
        if (!(this.spawnflags & 4))
        {
-               SetResourceAmount(actor, RESOURCE_SHELLS, start_ammo_shells);
-               SetResourceAmount(actor, RESOURCE_BULLETS, start_ammo_nails);
-               SetResourceAmount(actor, RESOURCE_ROCKETS, start_ammo_rockets);
-               SetResourceAmount(actor, RESOURCE_CELLS, start_ammo_cells);
-               SetResourceAmount(actor, RESOURCE_PLASMA, start_ammo_plasma);
-               SetResourceAmount(actor, RESOURCE_FUEL, start_ammo_fuel);
+               SetResourceAmount(actor, RES_SHELLS, start_ammo_shells);
+               SetResourceAmount(actor, RES_BULLETS, start_ammo_nails);
+               SetResourceAmount(actor, RES_ROCKETS, start_ammo_rockets);
+               SetResourceAmount(actor, RES_CELLS, start_ammo_cells);
+               SetResourceAmount(actor, RES_PLASMA, start_ammo_plasma);
+               SetResourceAmount(actor, RES_FUEL, start_ammo_fuel);
 
                STAT(WEAPONS, actor) = start_weapons;
                if (this.spawnflags & 32)
@@ -142,33 +142,33 @@ void target_give_init(entity this)
        IL_EACH(g_items, it.targetname == this.target,
        {
                if (it.classname == "weapon_devastator") {
-                       SetResourceAmount(this, RESOURCE_ROCKETS, GetResourceAmount(this, RESOURCE_ROCKETS) + it.count * WEP_CVAR_PRI(devastator, ammo)); // WEAPONTODO
+                       SetResourceAmount(this, RES_ROCKETS, GetResourceAmount(this, RES_ROCKETS) + it.count * WEP_CVAR_PRI(devastator, ammo)); // WEAPONTODO
                        this.netname = cons(this.netname, "devastator");
                }
                else if (it.classname == "weapon_vortex") {
-                       SetResourceAmount(this, RESOURCE_CELLS, GetResourceAmount(this, RESOURCE_CELLS) + it.count * WEP_CVAR_PRI(vortex, ammo)); // WEAPONTODO
+                       SetResourceAmount(this, RES_CELLS, GetResourceAmount(this, RES_CELLS) + it.count * WEP_CVAR_PRI(vortex, ammo)); // WEAPONTODO
                        this.netname = cons(this.netname, "vortex");
                }
                else if (it.classname == "weapon_electro") {
-                       SetResourceAmount(this, RESOURCE_CELLS, GetResourceAmount(this, RESOURCE_CELLS) + it.count * WEP_CVAR_PRI(electro, ammo)); // WEAPONTODO
+                       SetResourceAmount(this, RES_CELLS, GetResourceAmount(this, RES_CELLS) + it.count * WEP_CVAR_PRI(electro, ammo)); // WEAPONTODO
                        this.netname = cons(this.netname, "electro");
                }
                else if (it.classname == "weapon_hagar") {
-                       SetResourceAmount(this, RESOURCE_ROCKETS, GetResourceAmount(this, RESOURCE_ROCKETS) + it.count * WEP_CVAR_PRI(hagar, ammo)); // WEAPONTODO
+                       SetResourceAmount(this, RES_ROCKETS, GetResourceAmount(this, RES_ROCKETS) + it.count * WEP_CVAR_PRI(hagar, ammo)); // WEAPONTODO
                        this.netname = cons(this.netname, "hagar");
                }
                else if (it.classname == "weapon_crylink") {
-                       SetResourceAmount(this, RESOURCE_CELLS, GetResourceAmount(this, RESOURCE_CELLS) + it.count * WEP_CVAR_PRI(crylink, ammo)); // WEAPONTODO
+                       SetResourceAmount(this, RES_CELLS, GetResourceAmount(this, RES_CELLS) + it.count * WEP_CVAR_PRI(crylink, ammo)); // WEAPONTODO
                        this.netname = cons(this.netname, "crylink");
                }
                else if (it.classname == "weapon_mortar") {
-                       SetResourceAmount(this, RESOURCE_ROCKETS, GetResourceAmount(this, RESOURCE_ROCKETS) + it.count * WEP_CVAR_PRI(mortar, ammo)); // WEAPONTODO
+                       SetResourceAmount(this, RES_ROCKETS, GetResourceAmount(this, RES_ROCKETS) + it.count * WEP_CVAR_PRI(mortar, ammo)); // WEAPONTODO
                        this.netname = cons(this.netname, "mortar");
                }
                else if (it.classname == "item_armor_mega")
-                       SetResourceAmount(this, RESOURCE_ARMOR, 100);
+                       SetResourceAmount(this, RES_ARMOR, 100);
                else if (it.classname == "item_health_mega")
-                       SetResourceAmount(this, RESOURCE_HEALTH, 200);
+                       SetResourceAmount(this, RES_HEALTH, 200);
                //remove(it); // removing ents in init functions causes havoc, workaround:
         setthink(it, SUB_Remove);
         it.nextthink = time;
index cfdc00c57740fe411ae1e78c18d71657065bc125..fb755b705bcf4fabb7cacecdd52be329a9f3b89f 100644 (file)
@@ -216,7 +216,7 @@ bool frag_centermessage_override(entity attacker, entity targ, int deathtype, in
        if(deathtype == DEATH_FIRE.m_id)
        {
                Send_Notification(NOTIF_ONE, attacker, MSG_CHOICE, CHOICE_FRAG_FIRE, targ.netname, kill_count_to_attacker, (IS_BOT_CLIENT(targ) ? -1 : CS(targ).ping));
-               Send_Notification(NOTIF_ONE, targ, MSG_CHOICE, CHOICE_FRAGGED_FIRE, attacker.netname, kill_count_to_target, GetResourceAmount(attacker, RESOURCE_HEALTH), GetResourceAmount(attacker, RESOURCE_ARMOR), (IS_BOT_CLIENT(attacker) ? -1 : CS(attacker).ping));
+               Send_Notification(NOTIF_ONE, targ, MSG_CHOICE, CHOICE_FRAGGED_FIRE, attacker.netname, kill_count_to_target, GetResourceAmount(attacker, RES_HEALTH), GetResourceAmount(attacker, RES_ARMOR), (IS_BOT_CLIENT(attacker) ? -1 : CS(attacker).ping));
                return true;
        }
 
@@ -371,8 +371,8 @@ void Obituary(entity attacker, entity inflictor, entity targ, int deathtype, .en
                                        CHOICE_TYPEFRAGGED,
                                        attacker.netname,
                                        kill_count_to_target,
-                                       GetResourceAmount(attacker, RESOURCE_HEALTH),
-                                       GetResourceAmount(attacker, RESOURCE_ARMOR),
+                                       GetResourceAmount(attacker, RES_HEALTH),
+                                       GetResourceAmount(attacker, RES_ARMOR),
                                        (IS_BOT_CLIENT(attacker) ? -1 : CS(attacker).ping)
                                );
                        }
@@ -394,8 +394,8 @@ void Obituary(entity attacker, entity inflictor, entity targ, int deathtype, .en
                                        CHOICE_FRAGGED,
                                        attacker.netname,
                                        kill_count_to_target,
-                                       GetResourceAmount(attacker, RESOURCE_HEALTH),
-                                       GetResourceAmount(attacker, RESOURCE_ARMOR),
+                                       GetResourceAmount(attacker, RES_HEALTH),
+                                       GetResourceAmount(attacker, RES_ARMOR),
                                        (IS_BOT_CLIENT(attacker) ? -1 : CS(attacker).ping)
                                );
                        }
@@ -490,7 +490,7 @@ void Freeze(entity targ, float revivespeed, int frozen_type, bool show_waypoint)
 
        STAT(FROZEN, targ) = frozen_type;
        STAT(REVIVE_PROGRESS, targ) = ((frozen_type == FROZEN_TEMP_DYING) ? 1 : 0);
-       SetResourceAmount(targ, RESOURCE_HEALTH, ((frozen_type == FROZEN_TEMP_DYING) ? targ_maxhealth : 1));
+       SetResourceAmount(targ, RES_HEALTH, ((frozen_type == FROZEN_TEMP_DYING) ? targ_maxhealth : 1));
        targ.revive_speed = revivespeed;
        if(targ.bot_attack)
                IL_REMOVE(g_bot_targets, targ);
@@ -535,7 +535,7 @@ void Unfreeze(entity targ, bool reset_health)
                return;
 
        if (reset_health && STAT(FROZEN, targ) != FROZEN_TEMP_DYING)
-               SetResourceAmount(targ, RESOURCE_HEALTH, ((IS_PLAYER(targ)) ? start_health : targ.max_health));
+               SetResourceAmount(targ, RES_HEALTH, ((IS_PLAYER(targ)) ? start_health : targ.max_health));
 
        targ.pauseregen_finished = time + autocvar_g_balance_pause_health_regen;
 
@@ -595,9 +595,9 @@ void Damage(entity targ, entity inflictor, entity attacker, float damage, int de
                // These are ALWAYS lethal
                // No damage modification here
                // Instead, prepare the victim for his death...
-               SetResourceAmount(targ, RESOURCE_ARMOR, 0);
+               SetResourceAmount(targ, RES_ARMOR, 0);
                targ.spawnshieldtime = 0;
-               SetResourceAmount(targ, RESOURCE_HEALTH, 0.9); // this is < 1
+               SetResourceAmount(targ, RES_HEALTH, 0.9); // this is < 1
                targ.flags -= targ.flags & FL_GODMODE;
                damage = 100000;
        }
@@ -638,7 +638,7 @@ void Damage(entity targ, entity inflictor, entity attacker, float damage, int de
 
                                                        if(autocvar_g_mirrordamage_virtual)
                                                        {
-                                                               vector v  = healtharmor_applydamage(GetResourceAmount(attacker, RESOURCE_ARMOR), autocvar_g_balance_armor_blockpercent, deathtype, mirrordamage);
+                                                               vector v  = healtharmor_applydamage(GetResourceAmount(attacker, RES_ARMOR), autocvar_g_balance_armor_blockpercent, deathtype, mirrordamage);
                                                                attacker.dmg_take += v.x;
                                                                attacker.dmg_save += v.y;
                                                                attacker.dmg_inflictor = inflictor;
@@ -648,7 +648,7 @@ void Damage(entity targ, entity inflictor, entity attacker, float damage, int de
 
                                                        if(autocvar_g_friendlyfire_virtual)
                                                        {
-                                                               vector v = healtharmor_applydamage(GetResourceAmount(targ, RESOURCE_ARMOR), autocvar_g_balance_armor_blockpercent, deathtype, damage);
+                                                               vector v = healtharmor_applydamage(GetResourceAmount(targ, RES_ARMOR), autocvar_g_balance_armor_blockpercent, deathtype, damage);
                                                                targ.dmg_take += v.x;
                                                                targ.dmg_save += v.y;
                                                                targ.dmg_inflictor = inflictor;
@@ -694,7 +694,7 @@ void Damage(entity targ, entity inflictor, entity attacker, float damage, int de
                        if(autocvar_g_frozen_revive_falldamage > 0 && deathtype == DEATH_FALL.m_id && damage >= autocvar_g_frozen_revive_falldamage)
                        {
                                Unfreeze(targ, false);
-                               SetResourceAmount(targ, RESOURCE_HEALTH, autocvar_g_frozen_revive_falldamage_health);
+                               SetResourceAmount(targ, RES_HEALTH, autocvar_g_frozen_revive_falldamage_health);
                                Send_Effect(EFFECT_ICEORGLASS, targ.origin, '0 0 0', 3);
                                Send_Notification(NOTIF_ALL, NULL, MSG_INFO, INFO_FREEZETAG_REVIVED_FALL, targ.netname);
                                Send_Notification(NOTIF_ONE, targ, MSG_CENTER, CENTER_FREEZETAG_REVIVE_SELF);
index 1d100e7a5a86874b2be4ed55771584f708581fd0..efe6b2e1b306af9a6903638f8681579f411532fa 100644 (file)
@@ -97,7 +97,7 @@ float RadiusDamageForSource (entity inflictor, vector inflictororigin, vector in
 float RadiusDamage (entity inflictor, entity attacker, float coredamage, float edgedamage, float rad, entity cantbe, entity mustbe, float forceintensity, int deathtype, .entity weaponentity, entity directhitentity);
 
 // Calls .event_heal on the target so that they can handle healing themselves
-// a limit of RESOURCE_LIMIT_NONE should be handled by the entity as its max health (if applicable)
+// a limit of RES_LIMIT_NONE should be handled by the entity as its max health (if applicable)
 bool Heal(entity targ, entity inflictor, float amount, float limit);
 
 .float fire_damagepersec;
index 226ab2f1a2c4beb30c0e1f3707ae77466ab4dca1..ad45fa1fb99c283473bebc95495a39b47949f1e0 100644 (file)
@@ -338,15 +338,15 @@ void GrapplingHookTouch(entity this, entity toucher)
 
 void GrapplingHook_Damage(entity this, entity inflictor, entity attacker, float damage, int deathtype, .entity weaponentity, vector hitloc, vector force)
 {
-       if(GetResourceAmount(this, RESOURCE_HEALTH) <= 0)
+       if(GetResourceAmount(this, RES_HEALTH) <= 0)
                return;
 
        if (!W_CheckProjectileDamage(inflictor.realowner, this.realowner, deathtype, -1)) // no exceptions
                return; // g_balance_projectiledamage says to halt
 
-       TakeResource(this, RESOURCE_HEALTH, damage);
+       TakeResource(this, RES_HEALTH, damage);
 
-       if (GetResourceAmount(this, RESOURCE_HEALTH) <= 0)
+       if (GetResourceAmount(this, RES_HEALTH) <= 0)
        {
                if(attacker != this.realowner)
                {
@@ -397,7 +397,7 @@ void FireGrapplingHook(entity actor, .entity weaponentity)
 
        missile.effects = /*EF_FULLBRIGHT | EF_ADDITIVE |*/ EF_LOWPRECISION;
 
-       SetResourceAmount(missile, RESOURCE_HEALTH, autocvar_g_balance_grapplehook_health);
+       SetResourceAmount(missile, RES_HEALTH, autocvar_g_balance_grapplehook_health);
        missile.event_damage = GrapplingHook_Damage;
        missile.takedamage = DAMAGE_AIM;
        missile.damageforcescale = 0;
index eb09f188d25abcf5c240b52f17a112d67df36c61..9c4b6f0ae0b99bf6c39066f29d677c3918f86705 100644 (file)
@@ -1523,7 +1523,7 @@ void FixIntermissionClient(entity e)
        if(!e.autoscreenshot) // initial call
        {
                e.autoscreenshot = time + 0.8;  // used for autoscreenshot
-               SetResourceAmount(e, RESOURCE_HEALTH, -2342);
+               SetResourceAmount(e, RES_HEALTH, -2342);
                // first intermission phase; voting phase has positive health (used to decide whether to send SVC_FINALE or not)
                for (int slot = 0; slot < MAX_WEAPONSLOTS; ++slot)
                {
index 3ba64a3b167c30e2421c92882f2a83d9dfedabb8..7b33b89d8a66493d6bf24f58ec9e90a05232d631 100644 (file)
@@ -591,9 +591,9 @@ void MapVote_Tick()
        int totalvotes = 0;
        FOREACH_CLIENT(IS_REAL_CLIENT(it), {
                // hide scoreboard again
-               if(GetResourceAmount(it, RESOURCE_HEALTH) != 2342)
+               if(GetResourceAmount(it, RES_HEALTH) != 2342)
                {
-                       SetResourceAmount(it, RESOURCE_HEALTH, 2342);
+                       SetResourceAmount(it, RES_HEALTH, 2342);
                        CS(it).impulse = 0;
 
                        msg_entity = it;
index 035891e5b19c0205bac6ef228d91ecbb3f974c5d..ca867d374d0a09b1cd85a6e630adaa2bc2ee9f04 100644 (file)
@@ -218,12 +218,12 @@ string AmmoNameFromWeaponentity(Weapon wep)
        string ammoitems = "batteries";
        switch (wep.ammo_type)
        {
-               case RESOURCE_SHELLS:  ammoitems = ITEM_Shells.m_name;      break;
-               case RESOURCE_BULLETS: ammoitems = ITEM_Bullets.m_name;     break;
-               case RESOURCE_ROCKETS: ammoitems = ITEM_Rockets.m_name;     break;
-               case RESOURCE_CELLS:   ammoitems = ITEM_Cells.m_name;       break;
-               case RESOURCE_PLASMA:  ammoitems = ITEM_Plasma.m_name;      break;
-               case RESOURCE_FUEL:    ammoitems = ITEM_JetpackFuel.m_name; break;
+               case RES_SHELLS:  ammoitems = ITEM_Shells.m_name;      break;
+               case RES_BULLETS: ammoitems = ITEM_Bullets.m_name;     break;
+               case RES_ROCKETS: ammoitems = ITEM_Rockets.m_name;     break;
+               case RES_CELLS:   ammoitems = ITEM_Cells.m_name;       break;
+               case RES_PLASMA:  ammoitems = ITEM_Plasma.m_name;      break;
+               case RES_FUEL:    ammoitems = ITEM_JetpackFuel.m_name; break;
        }
        return ammoitems;
 }
@@ -280,8 +280,8 @@ string formatmessage(entity this, string msg)
                        case "%": replacement = "%"; break;
                        case "\\":replacement = "\\"; break;
                        case "n": replacement = "\n"; break;
-                       case "a": replacement = ftos(floor(GetResourceAmount(this, RESOURCE_ARMOR))); break;
-                       case "h": replacement = ftos(floor(GetResourceAmount(this, RESOURCE_HEALTH))); break;
+                       case "a": replacement = ftos(floor(GetResourceAmount(this, RES_ARMOR))); break;
+                       case "h": replacement = ftos(floor(GetResourceAmount(this, RES_HEALTH))); break;
                        case "l": replacement = NearestLocation(this.origin); break;
                        case "y": replacement = NearestLocation(cursor); break;
                        case "d": replacement = NearestLocation(this.death_origin); break;
@@ -660,15 +660,15 @@ void readplayerstartcvars()
                start_ammo_plasma = cvar("g_start_ammo_plasma");
                start_ammo_fuel = cvar("g_start_ammo_fuel");
                random_start_weapons_count = cvar("g_random_start_weapons_count");
-               SetResourceAmount(random_start_ammo, RESOURCE_SHELLS, cvar(
+               SetResourceAmount(random_start_ammo, RES_SHELLS, cvar(
                        "g_random_start_shells"));
-               SetResourceAmount(random_start_ammo, RESOURCE_BULLETS, cvar(
+               SetResourceAmount(random_start_ammo, RES_BULLETS, cvar(
                        "g_random_start_bullets"));
-               SetResourceAmount(random_start_ammo, RESOURCE_ROCKETS,
+               SetResourceAmount(random_start_ammo, RES_ROCKETS,
                        cvar("g_random_start_rockets"));
-               SetResourceAmount(random_start_ammo, RESOURCE_CELLS, cvar(
+               SetResourceAmount(random_start_ammo, RES_CELLS, cvar(
                        "g_random_start_cells"));
-               SetResourceAmount(random_start_ammo, RESOURCE_PLASMA, cvar(
+               SetResourceAmount(random_start_ammo, RES_PLASMA, cvar(
                        "g_random_start_plasma"));
        }
 
@@ -738,16 +738,16 @@ void readplayerstartcvars()
        start_ammo_cells = max(0, start_ammo_cells);
        start_ammo_plasma = max(0, start_ammo_plasma);
        start_ammo_fuel = max(0, start_ammo_fuel);
-       SetResourceAmount(random_start_ammo, RESOURCE_SHELLS, max(0,
-               GetResourceAmount(random_start_ammo, RESOURCE_SHELLS)));
-       SetResourceAmount(random_start_ammo, RESOURCE_BULLETS, max(0,
-               GetResourceAmount(random_start_ammo, RESOURCE_BULLETS)));
-       SetResourceAmount(random_start_ammo, RESOURCE_ROCKETS, max(0,
-               GetResourceAmount(random_start_ammo, RESOURCE_ROCKETS)));
-       SetResourceAmount(random_start_ammo, RESOURCE_CELLS, max(0,
-               GetResourceAmount(random_start_ammo, RESOURCE_CELLS)));
-       SetResourceAmount(random_start_ammo, RESOURCE_PLASMA, max(0,
-               GetResourceAmount(random_start_ammo, RESOURCE_PLASMA)));
+       SetResourceAmount(random_start_ammo, RES_SHELLS, max(0,
+               GetResourceAmount(random_start_ammo, RES_SHELLS)));
+       SetResourceAmount(random_start_ammo, RES_BULLETS, max(0,
+               GetResourceAmount(random_start_ammo, RES_BULLETS)));
+       SetResourceAmount(random_start_ammo, RES_ROCKETS, max(0,
+               GetResourceAmount(random_start_ammo, RES_ROCKETS)));
+       SetResourceAmount(random_start_ammo, RES_CELLS, max(0,
+               GetResourceAmount(random_start_ammo, RES_CELLS)));
+       SetResourceAmount(random_start_ammo, RES_PLASMA, max(0,
+               GetResourceAmount(random_start_ammo, RES_PLASMA)));
 
        warmup_start_ammo_shells = max(0, warmup_start_ammo_shells);
        warmup_start_ammo_nails = max(0, warmup_start_ammo_nails);
index 864623bbae4b888f5c3ca4e56e40d70b0d513246..bdcd9012192eff0db0777aae70d7bf21f0853b1c 100644 (file)
@@ -701,7 +701,7 @@ resource limit. */
        /**/
 MUTATOR_HOOKABLE(GetResourceLimit, EV_GetResourceLimit);
 
-/** Called when the amount of resource of an entity changes. See RESOURCE_*
+/** Called when the amount of resource of an entity changes. See RES_*
 constants for resource types. Return true to forbid the change. */
 #define EV_SetResourceAmount(i, o) \
        /** checked entity */ i(entity, MUTATOR_ARGV_0_entity) \
@@ -712,7 +712,7 @@ constants for resource types. Return true to forbid the change. */
        /**/
 MUTATOR_HOOKABLE(SetResourceAmount, EV_SetResourceAmount);
 
-/** Called after the amount of resource of an entity has changed. See RESOURCE_*
+/** Called after the amount of resource of an entity has changed. See RES_*
 constants for resource types. Amount wasted is the amount of resource that is
 above resource limit so it was not given. */
 #define EV_ResourceAmountChanged(i, o) \
@@ -723,7 +723,7 @@ above resource limit so it was not given. */
 MUTATOR_HOOKABLE(ResourceAmountChanged, EV_ResourceAmountChanged);
 
 /** Called when there was an attempt to set entity resources higher than their
-limit. See RESOURCE_* constants for resource types. Amount wasted is the amount
+limit. See RES_* constants for resource types. Amount wasted is the amount
 of resource that is above resource limit so it was not given. */
 #define EV_ResourceWasted(i, o) \
        /** checked entity */ i(entity, MUTATOR_ARGV_0_entity) \
@@ -732,7 +732,7 @@ of resource that is above resource limit so it was not given. */
        /**/
 MUTATOR_HOOKABLE(ResourceWasted, EV_ResourceWasted);
 
-/** Called when entity is being given some resource. See RESOURCE_* constants
+/** Called when entity is being given some resource. See RES_* constants
 for resource types. Return true to forbid giving. */
 #define EV_GiveResource(i, o) \
        /** receiver */      i(entity, MUTATOR_ARGV_0_entity) \
@@ -744,7 +744,7 @@ for resource types. Return true to forbid giving. */
 MUTATOR_HOOKABLE(GiveResource, EV_GiveResource);
 
 /** Called when entity is being given some resource with specified limit. See
-RESOURCE_* constants for resource types. Return true to forbid giving. */
+RES_* constants for resource types. Return true to forbid giving. */
 #define EV_GiveResourceWithLimit(i, o) \
        /** receiver */      i(entity, MUTATOR_ARGV_0_entity) \
        /** resource type */ i(int, MUTATOR_ARGV_1_int) \
@@ -756,7 +756,7 @@ RESOURCE_* constants for resource types. Return true to forbid giving. */
        /**/
 MUTATOR_HOOKABLE(GiveResourceWithLimit, EV_GiveResourceWithLimit);
 
-/** Called when some resource is being taken from an entity. See RESOURCE_* constants
+/** Called when some resource is being taken from an entity. See RES_* constants
 for resource types. Return true to forbid giving. */
 #define EV_TakeResource(i, o) \
     /** receiver */      i(entity, MUTATOR_ARGV_0_entity) \
@@ -768,7 +768,7 @@ for resource types. Return true to forbid giving. */
 MUTATOR_HOOKABLE(TakeResource, EV_TakeResource);
 
 /** Called when some resource is being taken from an entity, with a limit. See
-RESOURCE_* constants for resource types. Return true to forbid giving. */
+RES_* constants for resource types. Return true to forbid giving. */
 #define EV_TakeResourceWithLimit(i, o) \
     /** receiver */      i(entity, MUTATOR_ARGV_0_entity) \
     /** resource type */ i(int, MUTATOR_ARGV_1_int) \
index b28aae40ddda82712c946547d7a91173ea67b3cf..90736401d4af4fcc32c7509309536dcf099c1040 100644 (file)
@@ -93,8 +93,8 @@ void CopyBody(entity this, float keepvelocity)
        clone.dphitcontentsmask = this.dphitcontentsmask;
        clone.death_time = this.death_time;
        clone.pain_finished = this.pain_finished;
-       SetResourceAmount(clone, RESOURCE_HEALTH, GetResourceAmount(this, RESOURCE_HEALTH));
-       SetResourceAmount(clone, RESOURCE_ARMOR, GetResourceAmount(this, RESOURCE_ARMOR));
+       SetResourceAmount(clone, RES_HEALTH, GetResourceAmount(this, RES_HEALTH));
+       SetResourceAmount(clone, RES_ARMOR, GetResourceAmount(this, RES_ARMOR));
        clone.armortype = this.armortype;
        clone.model = this.model;
        clone.modelindex = this.modelindex;
@@ -177,7 +177,7 @@ void PlayerCorpseDamage(entity this, entity inflictor, entity attacker, float da
        vector v;
        Violence_GibSplash_At(hitloc, force, 2, bound(0, damage, 200) / 16, this, attacker);
 
-       v = healtharmor_applydamage(GetResourceAmount(this, RESOURCE_ARMOR), autocvar_g_balance_armor_blockpercent, deathtype, damage);
+       v = healtharmor_applydamage(GetResourceAmount(this, RES_ARMOR), autocvar_g_balance_armor_blockpercent, deathtype, damage);
        take = v.x;
        save = v.y;
 
@@ -196,8 +196,8 @@ void PlayerCorpseDamage(entity this, entity inflictor, entity attacker, float da
        if (take > 100)
                Violence_GibSplash_At(hitloc, force * -0.2, 3, 1, this, attacker);
 
-       TakeResource(this, RESOURCE_ARMOR, save);
-       TakeResource(this, RESOURCE_HEALTH, take);
+       TakeResource(this, RES_ARMOR, save);
+       TakeResource(this, RES_HEALTH, take);
        // pause regeneration for 5 seconds
        this.pauseregen_finished = max(this.pauseregen_finished, time + autocvar_g_balance_pause_health_regen);
 
@@ -205,7 +205,7 @@ void PlayerCorpseDamage(entity this, entity inflictor, entity attacker, float da
        this.dmg_take = this.dmg_take + take;//max(take - 10, 0);
        this.dmg_inflictor = inflictor;
 
-       if (GetResourceAmount(this, RESOURCE_HEALTH) <= -autocvar_sv_gibhealth && this.alpha >= 0)
+       if (GetResourceAmount(this, RES_HEALTH) <= -autocvar_sv_gibhealth && this.alpha >= 0)
        {
                // don't use any animations as a gib
                this.frame = 0;
@@ -314,8 +314,8 @@ void PlayerDamage(entity this, entity inflictor, entity attacker, float damage,
        vector v;
        float excess;
 
-       dh = max(GetResourceAmount(this, RESOURCE_HEALTH), 0);
-       da = max(GetResourceAmount(this, RESOURCE_ARMOR), 0);
+       dh = max(GetResourceAmount(this, RES_HEALTH), 0);
+       da = max(GetResourceAmount(this, RES_ARMOR), 0);
 
        if(!DEATH_ISSPECIAL(deathtype))
        {
@@ -363,7 +363,7 @@ void PlayerDamage(entity this, entity inflictor, entity attacker, float damage,
        else
                Violence_GibSplash_At(hitloc, force, 2, bound(0, damage, 200) / 16, this, attacker);
 
-       v = healtharmor_applydamage(GetResourceAmount(this, RESOURCE_ARMOR), autocvar_g_balance_armor_blockpercent, deathtype, damage);
+       v = healtharmor_applydamage(GetResourceAmount(this, RES_ARMOR), autocvar_g_balance_armor_blockpercent, deathtype, damage);
        take = v.x;
        save = v.y;
 
@@ -392,8 +392,8 @@ void PlayerDamage(entity this, entity inflictor, entity attacker, float damage,
        }
 
        MUTATOR_CALLHOOK(PlayerDamage_SplitHealthArmor, inflictor, attacker, this, force, take, save, deathtype, damage);
-       take = bound(0, M_ARGV(4, float), GetResourceAmount(this, RESOURCE_HEALTH));
-       save = bound(0, M_ARGV(5, float), GetResourceAmount(this, RESOURCE_ARMOR));
+       take = bound(0, M_ARGV(4, float), GetResourceAmount(this, RES_HEALTH));
+       save = bound(0, M_ARGV(5, float), GetResourceAmount(this, RES_ARMOR));
        excess = max(0, damage - take - save);
 
        if(sound_allowed(MSG_BROADCAST, attacker))
@@ -415,8 +415,8 @@ void PlayerDamage(entity this, entity inflictor, entity attacker, float damage,
        {
                if (!(this.flags & FL_GODMODE))
                {
-                       TakeResource(this, RESOURCE_ARMOR, save);
-                       TakeResource(this, RESOURCE_HEALTH, take);
+                       TakeResource(this, RES_ARMOR, save);
+                       TakeResource(this, RES_HEALTH, take);
                        // pause regeneration for 5 seconds
                        if(take)
                                this.pauseregen_finished = max(this.pauseregen_finished, time + autocvar_g_balance_pause_health_regen);
@@ -436,7 +436,7 @@ void PlayerDamage(entity this, entity inflictor, entity attacker, float damage,
                                                                animdecide_setaction(this, ANIMACTION_PAIN2, true);
                                                }
                                        }
-                                       float myhp = GetResourceAmount(this, RESOURCE_HEALTH);
+                                       float myhp = GetResourceAmount(this, RES_HEALTH);
                                        if(myhp > 1)
                                        if(myhp < 25 || !(DEATH_WEAPONOF(deathtype).spawnflags & WEP_FLAG_CANCLIMB) || take > 20 || attacker != this)
                                        if(sound_allowed(MSG_BROADCAST, attacker))
@@ -458,7 +458,7 @@ void PlayerDamage(entity this, entity inflictor, entity attacker, float damage,
 
                        // throw off bot aim temporarily
                        float shake;
-                       if(IS_BOT_CLIENT(this) && GetResourceAmount(this, RESOURCE_HEALTH) >= 1)
+                       if(IS_BOT_CLIENT(this) && GetResourceAmount(this, RES_HEALTH) >= 1)
                        {
                                shake = damage * 5 / (bound(0,skill,100) + 1);
                                this.v_angle_x = this.v_angle.x + (random() * 2 - 1) * shake;
@@ -501,8 +501,8 @@ void PlayerDamage(entity this, entity inflictor, entity attacker, float damage,
                valid_damage_for_weaponstats = true;
        }
 
-       dh = dh - max(GetResourceAmount(this, RESOURCE_HEALTH), 0);
-       da = da - max(GetResourceAmount(this, RESOURCE_ARMOR), 0);
+       dh = dh - max(GetResourceAmount(this, RES_HEALTH), 0);
+       da = da - max(GetResourceAmount(this, RES_ARMOR), 0);
        if(valid_damage_for_weaponstats)
        {
                WeaponStats_LogDamage(awep.m_id, abot, this.(weaponentity).m_weapon.m_id, vbot, dh + da);
@@ -510,7 +510,7 @@ void PlayerDamage(entity this, entity inflictor, entity attacker, float damage,
 
        MUTATOR_CALLHOOK(PlayerDamaged, attacker, this, dh, da, hitloc, deathtype, damage);
 
-       if (GetResourceAmount(this, RESOURCE_HEALTH) < 1)
+       if (GetResourceAmount(this, RES_HEALTH) < 1)
        {
                float defer_ClientKill_Now_TeamChange;
                defer_ClientKill_Now_TeamChange = false;
@@ -584,7 +584,7 @@ void PlayerDamage(entity this, entity inflictor, entity attacker, float damage,
 
                // player could have been miraculously resuscitated ;)
                // e.g. players in freezetag get frozen, they don't really die
-               if(GetResourceAmount(this, RESOURCE_HEALTH) >= 1 || !(IS_PLAYER(this) || this.classname == "body"))
+               if(GetResourceAmount(this, RES_HEALTH) >= 1 || !(IS_PLAYER(this) || this.classname == "body"))
                        return;
 
                if (!this.respawn_time) // can be set in the mutator hook PlayerDies
@@ -670,9 +670,9 @@ void PlayerDamage(entity this, entity inflictor, entity attacker, float damage,
 
 bool PlayerHeal(entity targ, entity inflictor, float amount, float limit)
 {
-       if(GetResourceAmount(targ, RESOURCE_HEALTH) <= 0 || GetResourceAmount(targ, RESOURCE_HEALTH) >= limit)
+       if(GetResourceAmount(targ, RES_HEALTH) <= 0 || GetResourceAmount(targ, RES_HEALTH) >= limit)
                return false;
 
-       GiveResourceWithLimit(targ, RESOURCE_HEALTH, amount, limit);
+       GiveResourceWithLimit(targ, RES_HEALTH, amount, limit);
        return true;
 }
index 623e43c06873750722595f63959460ab6c7ea030..58c42110fd08f141b40752cc3fa21bc507e32017 100644 (file)
@@ -199,8 +199,8 @@ float Portal_TeleportPlayer(entity teleporter, entity player)
        // reset fade counter
        teleporter.portal_wants_to_vanish = 0;
        teleporter.fade_time = ((autocvar_g_balance_portal_lifetime >= 0) ? time + autocvar_g_balance_portal_lifetime : 0);
-       SetResourceAmount(teleporter, RESOURCE_HEALTH, autocvar_g_balance_portal_health);
-       SetResourceAmount(teleporter.enemy, RESOURCE_HEALTH, autocvar_g_balance_portal_health);
+       SetResourceAmount(teleporter, RES_HEALTH, autocvar_g_balance_portal_health);
+       SetResourceAmount(teleporter.enemy, RES_HEALTH, autocvar_g_balance_portal_health);
 
        return 1;
 }
@@ -435,8 +435,8 @@ void Portal_Damage(entity this, entity inflictor, entity attacker, float damage,
        if(attacker != this.aiment)
                if(IS_INDEPENDENT_PLAYER(attacker) || IS_INDEPENDENT_PLAYER(this.aiment))
                        return;
-       TakeResource(this, RESOURCE_HEALTH, damage);
-       if(GetResourceAmount(this, RESOURCE_HEALTH) < 0)
+       TakeResource(this, RES_HEALTH, damage);
+       if(GetResourceAmount(this, RES_HEALTH) < 0)
                Portal_Remove(this, 1);
 }
 
@@ -639,7 +639,7 @@ entity Portal_Spawn(entity own, vector org, vector ang)
        portal.takedamage = DAMAGE_AIM;
        portal.event_damage = Portal_Damage;
        portal.fade_time = ((autocvar_g_balance_portal_lifetime >= 0) ? time + autocvar_g_balance_portal_lifetime : 0);
-       SetResourceAmount(portal, RESOURCE_HEALTH, autocvar_g_balance_portal_health);
+       SetResourceAmount(portal, RES_HEALTH, autocvar_g_balance_portal_health);
        setmodel(portal, MDL_PORTAL);
        portal.savemodelindex = portal.modelindex;
        setcefc(portal, Portal_Customize);
index 2356d8eaf443eb625c5bd1687d18720844a541ad..b894d6d1f74fab6af9726230d62154e57c7b9e5c 100644 (file)
@@ -8,50 +8,50 @@
 #include "autocvars.qh"
 #include "miscfunctions.qh"
 
-float GetResourceLimit(entity e, int resource_type)
+float GetResourceLimit(entity e, int res_type)
 {
        if(!IS_PLAYER(e))
-               return RESOURCE_LIMIT_NONE; // no limits on non-players
+               return RES_LIMIT_NONE; // no limits on non-players
 
        float limit;
-       switch (resource_type)
+       switch (res_type)
        {
-               case RESOURCE_HEALTH:
+               case RES_HEALTH:
                {
                        limit = autocvar_g_balance_health_limit;
                        break;
                }
-               case RESOURCE_ARMOR:
+               case RES_ARMOR:
                {
                        limit = autocvar_g_balance_armor_limit;
                        break;
                }
-               case RESOURCE_SHELLS:
+               case RES_SHELLS:
                {
                        limit = g_pickup_shells_max;
                        break;
                }
-               case RESOURCE_BULLETS:
+               case RES_BULLETS:
                {
                        limit = g_pickup_nails_max;
                        break;
                }
-               case RESOURCE_ROCKETS:
+               case RES_ROCKETS:
                {
                        limit = g_pickup_rockets_max;
                        break;
                }
-               case RESOURCE_CELLS:
+               case RES_CELLS:
                {
                        limit = g_pickup_cells_max;
                        break;
                }
-               case RESOURCE_PLASMA:
+               case RES_PLASMA:
                {
                        limit = g_pickup_plasma_max;
                        break;
                }
-               case RESOURCE_FUEL:
+               case RES_FUEL:
                {
                        limit = autocvar_g_balance_fuel_limit;
                        break;
@@ -62,87 +62,84 @@ float GetResourceLimit(entity e, int resource_type)
                        return 0;
                }
        }
-       MUTATOR_CALLHOOK(GetResourceLimit, e, resource_type, limit);
+       MUTATOR_CALLHOOK(GetResourceLimit, e, res_type, limit);
        limit = M_ARGV(2, float);
-       if (limit > RESOURCE_AMOUNT_HARD_LIMIT)
+       if (limit > RES_AMOUNT_HARD_LIMIT)
        {
-               limit = RESOURCE_AMOUNT_HARD_LIMIT;
+               limit = RES_AMOUNT_HARD_LIMIT;
        }
        return limit;
 }
 
-float GetResourceAmount(entity e, int resource_type)
+float GetResourceAmount(entity e, int res_type)
 {
-       .float resource_field = GetResourceField(resource_type);
-       return e.(resource_field);
+       return e.(GetResourceField(res_type));
 }
 
-void SetResourceAmount(entity e, int resource_type, float amount)
+void SetResourceAmount(entity e, int res_type, float amount)
 {
-       bool forbid = MUTATOR_CALLHOOK(SetResourceAmount, e, resource_type, amount);
+       bool forbid = MUTATOR_CALLHOOK(SetResourceAmount, e, res_type, amount);
        if (forbid)
        {
                return;
        }
-       resource_type = M_ARGV(1, int);
+       res_type = M_ARGV(1, int);
        amount = M_ARGV(2, float);
-       float max_amount = GetResourceLimit(e, resource_type); // TODO: should allow overriding these limits if cheats are enabled!
+       float max_amount = GetResourceLimit(e, res_type); // TODO: should allow overriding these limits if cheats are enabled!
        float amount_wasted = 0;
-       if (amount > max_amount && max_amount != RESOURCE_LIMIT_NONE)
+       if (amount > max_amount && max_amount != RES_LIMIT_NONE)
        {
                amount_wasted = amount - max_amount;
                amount = max_amount;
        }
-       .float resource_field = GetResourceField(resource_type);
-       if (e.(resource_field) != amount)
+       .float res_field = GetResourceField(res_type);
+       if (e.(res_field) != amount)
        {
-               e.(resource_field) = amount;
-               MUTATOR_CALLHOOK(ResourceAmountChanged, e, resource_type, amount);
+               e.(res_field) = amount;
+               MUTATOR_CALLHOOK(ResourceAmountChanged, e, res_type, amount);
        }
        if (amount_wasted == 0)
        {
                return;
        }
-       MUTATOR_CALLHOOK(ResourceWasted, e, resource_type, amount_wasted);
+       MUTATOR_CALLHOOK(ResourceWasted, e, res_type, amount_wasted);
 }
 
-void GiveResource(entity receiver, int resource_type, float amount)
+void GiveResource(entity receiver, int res_type, float amount)
 {
        if (amount <= 0)
        {
                return;
        }
-       bool forbid = MUTATOR_CALLHOOK(GiveResource, receiver, resource_type,
-               amount);
+       bool forbid = MUTATOR_CALLHOOK(GiveResource, receiver, res_type, amount);
        if (forbid)
        {
                return;
        }
-       resource_type = M_ARGV(1, int);
+       res_type = M_ARGV(1, int);
        amount = M_ARGV(2, float);
        if (amount <= 0)
        {
                return;
        }
-       SetResourceAmount(receiver, resource_type,
-               GetResourceAmount(receiver, resource_type) + amount);
-       switch (resource_type)
+       SetResourceAmount(receiver, res_type, GetResourceAmount(receiver, res_type) + amount);
+       switch (res_type)
        {
-               case RESOURCE_HEALTH:
+               case RES_HEALTH:
                {
                        receiver.pauserothealth_finished =
                                max(receiver.pauserothealth_finished, time +
                                autocvar_g_balance_pause_health_rot);
                        return;
                }
-               case RESOURCE_ARMOR:
+               case RES_ARMOR:
                {
                        receiver.pauserotarmor_finished =
                                max(receiver.pauserotarmor_finished, time +
                                autocvar_g_balance_pause_armor_rot);
                        return;
                }
-               case RESOURCE_FUEL:
+               case RES_FUEL:
                {
                        receiver.pauserotfuel_finished = max(receiver.pauserotfuel_finished,
                                time + autocvar_g_balance_pause_fuel_rot);
@@ -151,138 +148,131 @@ void GiveResource(entity receiver, int resource_type, float amount)
        }
 }
 
-void GiveResourceWithLimit(entity receiver, int resource_type, float amount,
-       float limit)
+void GiveResourceWithLimit(entity receiver, int res_type, float amount, float limit)
 {
        if (amount <= 0)
        {
                return;
        }
-       bool forbid = MUTATOR_CALLHOOK(GiveResourceWithLimit, receiver,
-               resource_type, amount, limit);
+       bool forbid = MUTATOR_CALLHOOK(GiveResourceWithLimit, receiver, res_type, amount, limit);
        if (forbid)
        {
                return;
        }
-       resource_type = M_ARGV(1, int);
+       res_type = M_ARGV(1, int);
        amount = M_ARGV(2, float);
        limit = M_ARGV(3, float);
        if (amount <= 0)
        {
                return;
        }
-       float current_amount = GetResourceAmount(receiver, resource_type);
-       if (current_amount + amount > limit && limit != RESOURCE_LIMIT_NONE)
+       float current_amount = GetResourceAmount(receiver, res_type);
+       if (current_amount + amount > limit && limit != RES_LIMIT_NONE)
        {
                amount = limit - current_amount;
        }
-       GiveResource(receiver, resource_type, amount);
+       GiveResource(receiver, res_type, amount);
 }
 
-void TakeResource(entity receiver, int resource_type, float amount)
+void TakeResource(entity receiver, int res_type, float amount)
 {
        if (amount <= 0)
        {
                return;
        }
-       bool forbid = MUTATOR_CALLHOOK(TakeResource, receiver, resource_type,
-               amount);
+       bool forbid = MUTATOR_CALLHOOK(TakeResource, receiver, res_type, amount);
        if (forbid)
        {
                return;
        }
-       resource_type = M_ARGV(1, int);
+       res_type = M_ARGV(1, int);
        amount = M_ARGV(2, float);
        if (amount <= 0)
        {
                return;
        }
-       SetResourceAmount(receiver, resource_type,
-               GetResourceAmount(receiver, resource_type) - amount);
+       SetResourceAmount(receiver, res_type, GetResourceAmount(receiver, res_type) - amount);
 }
 
-void TakeResourceWithLimit(entity receiver, int resource_type, float amount,
-       float limit)
+void TakeResourceWithLimit(entity receiver, int res_type, float amount, float limit)
 {
        if (amount <= 0)
        {
                return;
        }
-       bool forbid = MUTATOR_CALLHOOK(TakeResourceWithLimit, receiver,
-               resource_type, amount, limit);
+       bool forbid = MUTATOR_CALLHOOK(TakeResourceWithLimit, receiver, res_type, amount, limit);
        if (forbid)
        {
                return;
        }
-       resource_type = M_ARGV(1, int);
+       res_type = M_ARGV(1, int);
        amount = M_ARGV(2, float);
        limit = M_ARGV(3, float);
        if (amount <= 0)
        {
                return;
        }
-       float current_amount = GetResourceAmount(receiver, resource_type);
+       float current_amount = GetResourceAmount(receiver, res_type);
        if (current_amount - amount < -limit)
        {
                amount = -limit + current_amount;
        }
-       TakeResource(receiver, resource_type, amount);
+       TakeResource(receiver, res_type, amount);
 }
 
-void GiveOrTakeResource(entity receiver, int resource_type, float amount)
+void GiveOrTakeResource(entity receiver, int res_type, float amount)
 {
        if(amount < 0)
        {
-               TakeResource(receiver, resource_type, amount * -1);
+               TakeResource(receiver, res_type, amount * -1);
        }
        else
        {
-               GiveResource(receiver, resource_type, amount);
+               GiveResource(receiver, res_type, amount);
        }
 }
 
-void GiveOrTakeResourceWithLimit(entity receiver, int resource_type, float amount,
-       float limit)
+void GiveOrTakeResourceWithLimit(entity receiver, int res_type, float amount, float limit)
 {
        if(amount < 0)
        {
-               TakeResourceWithLimit(receiver, resource_type, amount * -1, limit);
+               TakeResourceWithLimit(receiver, res_type, amount * -1, limit);
        }
        else
        {
-               GiveResourceWithLimit(receiver, resource_type, amount, limit);
+               GiveResourceWithLimit(receiver, res_type, amount, limit);
        }
 }
 
-int GetResourceType(.float resource_field)
+int GetResourceType(.float res_field)
 {
-       switch (resource_field)
+       switch (res_field)
        {
-               case health: { return RESOURCE_HEALTH; }
-               case armorvalue: { return RESOURCE_ARMOR; }
-               case ammo_shells: { return RESOURCE_SHELLS; }
-               case ammo_nails: { return RESOURCE_BULLETS; }
-               case ammo_rockets: { return RESOURCE_ROCKETS; }
-               case ammo_cells: { return RESOURCE_CELLS; }
-               case ammo_plasma: { return RESOURCE_PLASMA; }
-               case ammo_fuel: { return RESOURCE_FUEL; }
+               case health: { return RES_HEALTH; }
+               case armorvalue: { return RES_ARMOR; }
+               case ammo_shells: { return RES_SHELLS; }
+               case ammo_nails: { return RES_BULLETS; }
+               case ammo_rockets: { return RES_ROCKETS; }
+               case ammo_cells: { return RES_CELLS; }
+               case ammo_plasma: { return RES_PLASMA; }
+               case ammo_fuel: { return RES_FUEL; }
        }
        error("GetResourceType: Invalid field.");
        return 0;
 }
 
-.float GetResourceField(int resource_type)
+.float GetResourceField(int res_type)
 {
-       switch (resource_type)
+       switch (res_type)
        {
-               case RESOURCE_HEALTH: { return health; }
-               case RESOURCE_ARMOR: { return armorvalue; }
-               case RESOURCE_SHELLS: { return ammo_shells; }
-               case RESOURCE_BULLETS: { return ammo_nails; }
-               case RESOURCE_ROCKETS: { return ammo_rockets; }
-               case RESOURCE_CELLS: { return ammo_cells; }
-               case RESOURCE_PLASMA: { return ammo_plasma; }
-               case RESOURCE_FUEL: { return ammo_fuel; }
+               case RES_HEALTH: { return health; }
+               case RES_ARMOR: { return armorvalue; }
+               case RES_SHELLS: { return ammo_shells; }
+               case RES_BULLETS: { return ammo_nails; }
+               case RES_ROCKETS: { return ammo_rockets; }
+               case RES_CELLS: { return ammo_cells; }
+               case RES_PLASMA: { return ammo_plasma; }
+               case RES_FUEL: { return ammo_fuel; }
        }
        error("GetResourceField: Invalid resource type.");
        return health;
index a13d4f35ec139eef53a17f8bffc7290ba5ff8c7a..6a54bf2e86aa60287bdcf2cc5932fe41ae549f6b 100644 (file)
 
 /// \brief Returns the maximum amount of the given resource.
 /// \param[in] e Entity to check.
-/// \param[in] resource_type Type of the resource (a RESOURCE_* constant).
+/// \param[in] res_type Type of the resource (a RES_* constant).
 /// \return Maximum amount of the given resource.
-float GetResourceLimit(entity e, int resource_type);
+float GetResourceLimit(entity e, int res_type);
 
 /// \brief Returns the current amount of resource the given entity has.
 /// \param[in] e Entity to check.
-/// \param[in] resource_type Type of the resource (a RESOURCE_* constant).
+/// \param[in] res_type Type of the resource (a RES_* constant).
 /// \return Current amount of resource the given entity has.
-float GetResourceAmount(entity e, int resource_type);
+float GetResourceAmount(entity e, int res_type);
 
 /// \brief Sets the current amount of resource the given entity will have.
 /// \param[in,out] e Entity to adjust.
-/// \param[in] resource_type Type of the resource (a RESOURCE_* constant).
+/// \param[in] res_type Type of the resource (a RES_* constant).
 /// \param[in] amount Amount of resource to set.
 /// \return No return.
-void SetResourceAmount(entity e, int resource_type, float amount);
+void SetResourceAmount(entity e, int res_type, float amount);
 
 /// \brief Gives an entity some resource.
 /// \param[in,out] receiver Entity to give resource to.
-/// \param[in] resource_type Type of the resource (a RESOURCE_* constant).
+/// \param[in] res_type Type of the resource (a RES_* constant).
 /// \param[in] amount Amount of resource to give.
 /// \return No return.
-void GiveResource(entity receiver, int resource_type, float amount);
+void GiveResource(entity receiver, int res_type, float amount);
 
 /// \brief Gives an entity some resource but not more than a limit.
 /// \param[in,out] receiver Entity to give resource to.
-/// \param[in] resource_type Type of the resource (a RESOURCE_* constant).
+/// \param[in] res_type Type of the resource (a RES_* constant).
 /// \param[in] amount Amount of resource to give.
 /// \param[in] limit Limit of resources to give.
 /// \return No return.
-void GiveResourceWithLimit(entity receiver, int resource_type, float amount,
-       float limit);
+void GiveResourceWithLimit(entity receiver, int res_type, float amount, float limit);
 
 /// \brief Takes an entity some resource.
 /// \param[in,out] receiver Entity to take resource from.
-/// \param[in] resource_type Type of the resource (a RESOURCE_* constant).
+/// \param[in] res_type Type of the resource (a RES_* constant).
 /// \param[in] amount Amount of resource to take.
 /// \return No return.
-void TakeResource(entity receiver, int resource_type, float amount);
+void TakeResource(entity receiver, int res_type, float amount);
 
 /// \brief Takes an entity some resource but not less than a limit.
 /// \param[in,out] receiver Entity to take resource from.
-/// \param[in] resource_type Type of the resource (a RESOURCE_* constant).
+/// \param[in] res_type Type of the resource (a RES_* constant).
 /// \param[in] amount Amount of resource to take.
 /// \param[in] limit Limit of resources to take.
 /// \return No return.
-void TakeResourceWithLimit(entity receiver, int resource_type, float amount,
-       float limit);
+void TakeResourceWithLimit(entity receiver, int res_type, float amount, float limit);
 
 /// \brief Gives to or takes from an entity resource.
 /// \param[in,out] receiver Entity to give or take resource.
-/// \param[in] resource_type Type of the resource (a RESOURCE_* constant).
+/// \param[in] res_type Type of the resource (a RES_* constant).
 /// \param[in] amount Amount of resource to give or take.
 /// \return No return.
-void GiveOrTakeResource(entity receiver, int resource_type, float amount);
+void GiveOrTakeResource(entity receiver, int res_type, float amount);
 
 /// \brief Gives to or takes from an entity resource but not more/less than a limit.
 /// \param[in,out] receiver Entity to give or take resource.
-/// \param[in] resource_type Type of the resource (a RESOURCE_* constant).
+/// \param[in] res_type Type of the resource (a RES_* constant).
 /// \param[in] amount Amount of resource to give or take.
 /// \param[in] limit Limit of resources to give or take.
 /// \return No return.
-void GiveOrTakeResourceWithLimit(entity receiver, int resource_type, float amount,
-       float limit);
+void GiveOrTakeResourceWithLimit(entity receiver, int res_type, float amount, float limit);
 
 // ===================== Legacy and/or internal API ===========================
 
 /// \brief Converts an entity field to resource type.
-/// \param[in] resource_field Entity field to convert.
-/// \return Resource type (a RESOURCE_* constant).
-int GetResourceType(.float resource_field);
+/// \param[in] res_field Entity field to convert.
+/// \return Resource type (a RES_* constant).
+int GetResourceType(.float res_field);
 
-/// \brief Converts resource type (a RESOURCE_* constant) to entity field.
-/// \param[in] resource_type Type of the resource.
+/// \brief Converts resource type (a RES_* constant) to entity field.
+/// \param[in] res_type Type of the resource.
 /// \return Entity field for that resource.
-.float GetResourceField(int resource_type);
+.float GetResourceField(int res_type);
index e52d4fcf1111c67ddd6c17f53b95feed83d605b7..0eb3ec661c5ea3822a9dc210dba2dd25ff998389 100644 (file)
@@ -2,7 +2,7 @@
 
 void test_weapons_hurt(entity this)
 {
-    EXPECT_NE(100, GetResourceAmount(this, RESOURCE_HEALTH));
+    EXPECT_NE(100, GetResourceAmount(this, RES_HEALTH));
     delete(this.enemy);
     delete(this);
 }
index 4ab5a43717c14e472bc30f0e5cdf6ab98d6bbbb7..b61cb303552241815daf1fbd61c2fedd1548b7db 100644 (file)
@@ -105,16 +105,16 @@ void weapon_defaultspawnfunc(entity this, Weapon e)
                        this.superweapons_finished = autocvar_g_balance_superweapons_time;
 
        // if we don't already have ammo, give us some ammo
-       if ((wpn.ammo_type != RESOURCE_NONE) && !GetResourceAmount(this, wpn.ammo_type))
+       if ((wpn.ammo_type != RES_NONE) && !GetResourceAmount(this, wpn.ammo_type))
        {
                switch (wpn.ammo_type)
                {
-                       case RESOURCE_SHELLS:  SetResourceAmount(this, wpn.ammo_type, cvar("g_pickup_shells_weapon"));  break;
-                       case RESOURCE_BULLETS: SetResourceAmount(this, wpn.ammo_type, cvar("g_pickup_nails_weapon"));   break;
-                       case RESOURCE_ROCKETS: SetResourceAmount(this, wpn.ammo_type, cvar("g_pickup_rockets_weapon")); break;
-                       case RESOURCE_CELLS:   SetResourceAmount(this, wpn.ammo_type, cvar("g_pickup_cells_weapon"));   break;
-                       case RESOURCE_PLASMA:  SetResourceAmount(this, wpn.ammo_type, cvar("g_pickup_plasma_weapon"));  break;
-                       case RESOURCE_FUEL:    SetResourceAmount(this, wpn.ammo_type, cvar("g_pickup_fuel_weapon"));    break;
+                       case RES_SHELLS:  SetResourceAmount(this, wpn.ammo_type, cvar("g_pickup_shells_weapon"));  break;
+                       case RES_BULLETS: SetResourceAmount(this, wpn.ammo_type, cvar("g_pickup_nails_weapon"));   break;
+                       case RES_ROCKETS: SetResourceAmount(this, wpn.ammo_type, cvar("g_pickup_rockets_weapon")); break;
+                       case RES_CELLS:   SetResourceAmount(this, wpn.ammo_type, cvar("g_pickup_cells_weapon"));   break;
+                       case RES_PLASMA:  SetResourceAmount(this, wpn.ammo_type, cvar("g_pickup_plasma_weapon"));  break;
+                       case RES_FUEL:    SetResourceAmount(this, wpn.ammo_type, cvar("g_pickup_fuel_weapon"));    break;
                }
        }
 
index 9aaabb05bfafa8075ea63466e89ab0996ffe53b5..4c140a711dc992d0856435bf21011fbadfdb217f 100644 (file)
@@ -89,7 +89,7 @@ float W_ThrowNewWeapon(entity own, float wpn, float doreduce, vector org, vector
        wep.pickup_anyway = true; // these are ALWAYS pickable
 
        //wa = W_AmmoItemCode(wpn);
-       if(ammotype == RESOURCE_NONE)
+       if(ammotype == RES_NONE)
        {
                return 0;
        }
index d791fc798e3056c1eb8dd6c5931561f4b282871e..9c0c402e34722b1a03064d694a77cbf454c677b6 100644 (file)
@@ -454,7 +454,7 @@ void W_WeaponFrame(Player actor, .entity weaponentity)
        entity this = actor.(weaponentity);
        if (frametime) this.weapon_frametime = frametime;
 
-       if (!this || GetResourceAmount(actor, RESOURCE_HEALTH) < 1) return;  // Dead player can't use weapons and injure impulse commands
+       if (!this || GetResourceAmount(actor, RES_HEALTH) < 1) return;  // Dead player can't use weapons and injure impulse commands
 
        int button_atck = PHYS_INPUT_BUTTON_ATCK(actor);
        int button_atck2 = PHYS_INPUT_BUTTON_ATCK2(actor);
@@ -692,7 +692,7 @@ void W_DecreaseAmmo(Weapon wep, entity actor, float ammo_use, .entity weaponenti
                w_ent.clip_load -= ammo_use;
                w_ent.(weapon_load[w_ent.m_weapon.m_id]) = w_ent.clip_load;
        }
-       else if (wep.ammo_type != RESOURCE_NONE)
+       else if (wep.ammo_type != RES_NONE)
        {
                float ammo = GetResourceAmount(actor, wep.ammo_type);
                if (ammo < ammo_use)
@@ -727,7 +727,7 @@ void W_ReloadedAndReady(Weapon thiswep, entity actor, .entity weaponentity, int
        w_ent.clip_load = w_ent.old_clip_load;  // restore the ammo counter, in case we still had ammo in the weapon before reloading
 
        // if the gun uses no ammo, max out weapon load, else decrease ammo as we increase weapon load
-       if (!w_ent.reload_ammo_min || (actor.items & IT_UNLIMITED_WEAPON_AMMO) || wpn.ammo_type == RESOURCE_NONE)
+       if (!w_ent.reload_ammo_min || (actor.items & IT_UNLIMITED_WEAPON_AMMO) || wpn.ammo_type == RES_NONE)
        {
                w_ent.clip_load = w_ent.reload_ammo_amount;
        }
@@ -779,7 +779,7 @@ void W_Reload(entity actor, .entity weaponentity, float sent_ammo_min, Sound sen
        if (this.clip_load >= this.reload_ammo_amount) return;
 
        // no ammo, so nothing to load
-       if (e.ammo_type != RESOURCE_NONE)
+       if (e.ammo_type != RES_NONE)
        {
                if (!GetResourceAmount(actor, e.ammo_type) && this.reload_ammo_min)
                {