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 ce70058..bd9aa1a 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 cd45517..592618a 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 eb3e3b8..3f67787 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 ecfb0b2..a504bac 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 3685e9a..8b21fe0 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 4f57a2f..1140b05 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 994ec72..ff28ead 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 583e626..a5db952 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 0c430e2..8eb959f 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 c3ef2db..72a4d23 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 73bb3cf..95ab0ec 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 09a4631..84fcadd 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 50e16d5..e8c75d6 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 0fae48b..fd38377 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 dc8c8b2..4e57a5e 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 65c5bcd..3cb0173 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 2ae142f..72a13db 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 ef2b10d..5d29435 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 5deef7e..794c9e6 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 a00af18..9c0f5b7 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 a33a430..929963b 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 dc591d7..b74e51e 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 d3f1573..0b14e7a 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 2889f92..399dc05 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 a7dd3c3..3944a84 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 f33e62c..93f285f 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 b3a93d9..fbcff11 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 4dc55fc..41c2ea1 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 3aaf047..3360fc9 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 a36bc3e..b844ab4 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 7751092..8236fcb 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 cc909e5..511cf13 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 6482a3d..40fe366 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 3f3e6c5..c47a584 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 181cde6..5ae77e4 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 2266133..605ce66 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 8e3fd73..0045749 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 8e39ff3..bd2c7c9 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 21ec72a..0e91599 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 1b454fe..7f3bd1e 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 b1da1c2..f2e835d 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 a219338..d8fcd11 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 4018729..6980491 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 99093d1..eafc5cb 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 73c2457..152f93d 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 8fbfa53..70339c9 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 d899d1c..bdcd97a 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 3cda448..d518665 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 fa04e2a..74d16f3 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 43de3b8..13e7138 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 6c48a8e..acf2493 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 586deda..b50a273 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 b3c2664..68ddc9d 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 32176da..321d92e 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 ec8ceeb..d03f40f 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 b5237b3..05c9f14 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 4f9bfe7..7d95296 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 1124baa..a830e6a 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 fdcc4be..6442060 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 5619818..b4181d1 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 5e090d3..83db6e3 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 3596aef..8f21651 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 56442d8..da8c5ba 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 c382549..acef8c9 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 8e33c64..81f4eb5 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 9675816..7c8365c 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 4d3f453..0cd0d58 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 51d3bc7..194cd31 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 bcf2528..d853564 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 c0a0b17..288ba29 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 b68bfb7..aef5225 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 cdabf33..f0da6cf 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 d5bdb5c..f4c749d 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 d0bbded..55574eb 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 1cd4421..7428e07 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 8ec9e47..ad8440a 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 8266a9a..ee4ea01 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 4c085f1..4277b3f 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 f118a04..f2fdf44 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 cdf5748..0d65bbe 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 8aea033..dd01444 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 187e584..1332103 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 7efbdf7..c9825ad 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 77e0b73..5843c94 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 b280665..292f2d5 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 e858d54..33814a5 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 b44731e..1340024 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 4018e59..7dbed18 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 f4936cd..94fa451 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 4302c9e..ba391f6 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 417a425..d342a5c 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 924326f..0d0f11e 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 d2bd427..7692092 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 d7c0821..25c6f60 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.damageforces