]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
GetResourceAmount --> GetResource, SetResourceAmount --> SetResource
authorterencehill <piuntn@gmail.com>
Sun, 3 Feb 2019 22:20:10 +0000 (23:20 +0100)
committerterencehill <piuntn@gmail.com>
Sun, 3 Feb 2019 22:20:10 +0000 (23:20 +0100)
112 files changed:
qcsrc/client/hud/panel/radar.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.qc
qcsrc/common/mutators/mutator/overkill/okmachinegun.qc
qcsrc/common/mutators/mutator/overkill/oknex.qc
qcsrc/common/mutators/mutator/overkill/okrpc.qc
qcsrc/common/mutators/mutator/overkill/okshotgun.qc
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/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/sv_vehicles.qh
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/weapon/arc.qc
qcsrc/common/weapons/weapon/crylink.qc
qcsrc/common/weapons/weapon/devastator.qc
qcsrc/common/weapons/weapon/electro.qc
qcsrc/common/weapons/weapon/fireball.qc
qcsrc/common/weapons/weapon/hagar.qc
qcsrc/common/weapons/weapon/hlac.qc
qcsrc/common/weapons/weapon/hook.qc
qcsrc/common/weapons/weapon/machinegun.qc
qcsrc/common/weapons/weapon/minelayer.qc
qcsrc/common/weapons/weapon/mortar.qc
qcsrc/common/weapons/weapon/rifle.qc
qcsrc/common/weapons/weapon/seeker.qc
qcsrc/common/weapons/weapon/shotgun.qc
qcsrc/common/weapons/weapon/vaporizer.qc
qcsrc/common/weapons/weapon/vortex.qc
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_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 592618a027814203e95ede4186e8de110b665286..ca1cb2a0655097c04d6b378445e66fd529d791a5 100644 (file)
@@ -342,7 +342,7 @@ void HUD_Radar()
 
        IL_EACH(g_radaricons, it.teamradar_icon, {
                if ( hud_panel_radar_mouse )
-               if ( GetResourceAmount(it, RES_HEALTH) >= 0 )
+               if ( GetResource(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 a504baca8b606ffbd9c3f132a16d3fd6d72dd01f..d259efe66036ed21404fac890ca60b32b9d28787 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), RES_HEALTH) <= 0))
+#define IS_DEAD(s) (((s).classname == "csqcmodel") ? (s).csqcmodel_isdead : (GetResource((s), RES_HEALTH) <= 0))
 
 
 // decolorizes and team colors the player name when needed
index 8b21fe0cb31724169d8695f50a5672466b46a029..7d498c3f6d093baadc410bdac9b790e5c73b6aff 100644 (file)
@@ -5,12 +5,12 @@
 /// \brief Source file that contains implementation of the resource system.
 /// \copyright GNU GPLv2 or any later version.
 
-float GetResourceAmount(entity e, int res_type)
+float GetResource(entity e, int res_type)
 {
        return e.(GetResourceField(res_type));
 }
 
-void SetResourceAmount(entity e, int res_type, float amount)
+void SetResource(entity e, int res_type, float amount)
 {
        e.(GetResourceField(res_type)) = amount;
 }
@@ -21,7 +21,7 @@ void TakeResource(entity receiver, int res_type, float amount)
        {
                return;
        }
-       SetResourceAmount(receiver, res_type, GetResourceAmount(receiver, res_type) - amount);
+       SetResource(receiver, res_type, GetResource(receiver, res_type) - amount);
 }
 
 void TakeResourceWithLimit(entity receiver, int res_type, float amount, float limit)
@@ -30,7 +30,7 @@ void TakeResourceWithLimit(entity receiver, int res_type, float amount, float li
        {
                return;
        }
-       float current_amount = GetResourceAmount(receiver, res_type);
+       float current_amount = GetResource(receiver, res_type);
        if (current_amount - amount < limit)
        {
                amount = limit + current_amount;
index 1140b0576eca9f05d43faad42f6cfc85f46aca63..939d12c172f267f94bd2c027ead67f74776d959e 100644 (file)
 /// \param[in] e Entity to check.
 /// \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 res_type);
+float GetResource(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] 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 res_type, float amount);
+void SetResource(entity e, int res_type, float amount);
 
 /// \brief Takes an entity some resource.
 /// \param[in,out] receiver Entity to take resource from.
index ff28ead405c9507a10f6981107e1a30b8e019765..8d15fbc57b725313869a54a0c8c11cf0dbb651a2 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, RES_ARMOR) > 0)
+                       if (GetResource(this, RES_ARMOR) > 0)
                        {
                                HUD_Panel_DrawProgressBar(pos + eX * 0.5 * mySize.x, sz, "nametag_statusbar",
-                                       GetResourceAmount(this, RES_ARMOR) / autocvar_hud_panel_healtharmor_maxarmor, false, 0, '0 1 0', a,
+                                       GetResource(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, RES_ARMOR, GetResourceAmount(entcs, RES_ARMOR));
+                       SetResource(it, RES_ARMOR, GetResource(entcs, RES_ARMOR));
                        it.sameteam = true;
                }
                else
                {
                        it.healthvalue = 0;
-                       SetResourceAmount(it, RES_ARMOR, 0);
+                       SetResource(it, RES_ARMOR, 0);
                        it.sameteam = false;
                }
                bool dead = entcs_IsDead(i) || entcs_IsSpectating(i);
index a5db952468eb8ef93816f5b78c87859f7b374caa..a8a76e47182f9fa67f757ce8428cb9bed355e3d0 100644 (file)
@@ -407,7 +407,7 @@ CLASS(DebugText3d, Object)
                CONSTRUCT(DebugText3d);
                this.origin = pos;
                this.message = strzone(msg);
-               SetResourceAmount(this, RES_HEALTH, align);
+               SetResource(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, RES_HEALTH);
+               float align = GetResource(this, RES_HEALTH);
                string msg;
                vector msg_pos;
 
index 8eb959f4adf6498bf6d325ae967ff84b0eb6749b..0a972277e6957672e3ba28d9fec875a2a6ebe700 100644 (file)
@@ -75,9 +75,9 @@ void entcs_force_origin(entity player)
 #ifdef SVQC
 #define ENTCS_PROP_RESOURCE(id, ispublic, checkprop, setprop, decfactor, svsend, clreceive) \
        bool id##_check(entity ent, entity player) { \
-               return (floor(GetResourceAmount(ent, checkprop) / decfactor) != floor(GetResourceAmount(player, checkprop) / decfactor)); \
+               return (floor(GetResource(ent, checkprop) / decfactor) != floor(GetResource(player, checkprop) / decfactor)); \
        } \
-       void id##_set(entity ent, entity player) { SetResourceAmount(ent, checkprop, GetResourceAmount(player, checkprop)); } \
+       void id##_set(entity ent, entity player) { SetResource(ent, checkprop, GetResource(player, checkprop)); } \
        void id##_send(int chan, entity ent) { LAMBDA(svsend); } \
        REGISTER(EntCSProps, ENTCS_PROP, id, m_id, new_pure(entcs_prop)) { \
                this.m_public = ispublic; \
@@ -118,12 +118,12 @@ 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, RES_HEALTH, ENTCS_SET_NORMAL, DEC_FACTOR,
-       { WriteByte(chan, bound(0, GetResourceAmount(ent, RES_HEALTH) / DEC_FACTOR, 255)); },
+       { WriteByte(chan, bound(0, GetResource(ent, RES_HEALTH) / DEC_FACTOR, 255)); },
        { ent.healthvalue = 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); })
+       { WriteByte(chan, bound(0, GetResource(ent, RES_ARMOR) / DEC_FACTOR, 255)); },
+       { SetResource(ent, RES_ARMOR, ReadByte() * DEC_FACTOR); })
 #undef DEC_FACTOR
 
 ENTCS_PROP(NAME, true, netname, ENTCS_SET_MUTABLE_STRING,
index 72a4d23a8c602deecf8591c97ff6abbd1a4b62e7..211bfb5bfa017371782ef3a159cbe081ad379714 100644 (file)
@@ -17,7 +17,7 @@ STATIC_INIT(g_assault)
 void assault_objective_use(entity this, entity actor, entity trigger)
 {
        // activate objective
-       SetResourceAmount(this, RES_HEALTH, 100);
+       SetResource(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, RES_HEALTH);
+       float hlth = GetResource(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, RES_HEALTH, ASSAULT_VALUE_INACTIVE);
+       SetResource(this, RES_HEALTH, ASSAULT_VALUE_INACTIVE);
 }
 
 // decrease the health of targeted objectives
@@ -60,7 +60,7 @@ void assault_objective_decrease_use(entity this, entity actor, entity trigger)
        else
                return; // already activated! cannot activate again!
 
-       float hlth = GetResourceAmount(this.enemy, RES_HEALTH);
+       float hlth = GetResource(this.enemy, RES_HEALTH);
        if (hlth < ASSAULT_VALUE_INACTIVE)
        {
                if (hlth - this.dmg > 0.5)
@@ -72,7 +72,7 @@ void assault_objective_decrease_use(entity this, entity actor, entity trigger)
                {
                        GameRules_scoring_add_team(actor, SCORE, hlth);
                        GameRules_scoring_add_team(actor, ASSAULT_OBJECTIVES, 1);
-                       SetResourceAmount(this.enemy, RES_HEALTH, -1);
+                       SetResource(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, RES_HEALTH) >= ASSAULT_VALUE_INACTIVE)
+       if(GetResource(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, RES_HEALTH));
+                       WaypointSprite_UpdateHealth(spr, GetResource(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, RES_HEALTH) < 0)
+       if(GetResource(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, RES_HEALTH, ASSAULT_VALUE_INACTIVE);
+       SetResource(this, RES_HEALTH, ASSAULT_VALUE_INACTIVE);
        this.max_health = ASSAULT_VALUE_INACTIVE;
        this.enemy = NULL;
 
@@ -334,14 +334,14 @@ spawnfunc(target_objective_decrease)
 bool destructible_heal(entity targ, entity inflictor, float amount, float limit)
 {
        float true_limit = ((limit != RES_LIMIT_NONE) ? limit : targ.max_health);
-       float hlth = GetResourceAmount(targ, RES_HEALTH);
+       float hlth = GetResource(targ, RES_HEALTH);
        if (hlth <= 0 || hlth >= true_limit)
                return false;
 
        GiveResourceWithLimit(targ, RES_HEALTH, amount, true_limit);
        if(targ.sprite)
        {
-               WaypointSprite_UpdateHealth(targ.sprite, GetResourceAmount(targ, RES_HEALTH));
+               WaypointSprite_UpdateHealth(targ.sprite, GetResource(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, RES_HEALTH);
+                       float hlth = GetResource(it.enemy, RES_HEALTH);
                        if (hlth > 0 && hlth < ASSAULT_VALUE_INACTIVE)
                        {
                                found = true;
index 95ab0ec50c2c16d73eae09585337e4c2e913e313..88540baf60091b5c496e93b3e67e2c1a251351d4 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, RES_HEALTH));
-       float damage_save = bound(0, M_ARGV(5, float), GetResourceAmount(frag_target, RES_ARMOR));
+       float damage_take = bound(0, M_ARGV(4, float), GetResource(frag_target, RES_HEALTH));
+       float damage_save = bound(0, M_ARGV(5, float), GetResource(frag_target, RES_ARMOR));
 
        float excess = max(0, frag_damage - damage_take - damage_save);
 
index 84fcadda3a929e07e271f5426f9c6341343e6da1..79ecf5fe07c2764f6720c53016298f3358430efc 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, RES_HEALTH), GetResourceAmount(player, RES_ARMOR), autocvar_g_balance_armor_blockpercent, DEATH_WEAPON.m_id).x);
+       WaypointSprite_UpdateHealth(player.wps_flagcarrier, healtharmor_maxdamage(GetResource(player, RES_HEALTH), GetResource(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, RES_HEALTH, flag.max_flag_health);
+       SetResource(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, RES_HEALTH));
+               WaypointSprite_UpdateHealth(flag.wps_flagdropped, GetResource(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, RES_HEALTH, flag.max_flag_health); break; // reset health/return timelimit
+               case PICKUP_DROPPED: SetResource(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, RES_HEALTH)); }
+               if(flag.wps_flagdropped) { WaypointSprite_UpdateHealth(flag.wps_flagdropped, GetResource(flag, RES_HEALTH)); }
 
-               if((GetResourceAmount(flag, RES_HEALTH) <= 0) || (time >= flag.ctf_droptime + autocvar_g_ctf_flag_return_time))
+               if((GetResource(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, RES_HEALTH, 0);
+                       SetResource(this, RES_HEALTH, 0);
                        ctf_CheckFlagReturn(this, RETURN_NEEDKILL);
                }
                return;
@@ -947,7 +947,7 @@ 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, RES_HEALTH, 0);
+                                       SetResource(this, RES_HEALTH, 0);
                                        ctf_CheckFlagReturn(this, RETURN_DROPPED);
                                        return;
                                }
@@ -971,7 +971,7 @@ void ctf_FlagThink(entity this)
                {
                        if(this.speedrunning && ctf_captimerecord && (time >= this.ctf_pickuptime + ctf_captimerecord))
                        {
-                               SetResourceAmount(this, RES_HEALTH, 0);
+                               SetResource(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, RES_HEALTH, 0);
+                       SetResource(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, RES_HEALTH, flag.max_flag_health);
+       SetResource(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, RES_HEALTH, flag.max_flag_health);
+       SetResource(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, RES_HEALTH) + GetResourceAmount(head, RES_ARMOR)) / 100, 2) - 1;
+                       float f = bound(0, (GetResource(head, RES_HEALTH) + GetResource(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, RES_HEALTH), GetResourceAmount(player, RES_ARMOR), autocvar_g_balance_armor_blockpercent, DEATH_WEAPON.m_id).x);
+               WaypointSprite_UpdateHealth(player.wps_flagcarrier, healtharmor_maxdamage(GetResource(player, RES_HEALTH), GetResource(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, RES_HEALTH), GetResourceAmount(frag_target, RES_ARMOR), autocvar_g_balance_armor_blockpercent, DEATH_WEAPON.m_id).x
+               if(autocvar_g_ctf_flagcarrier_auto_helpme_damage > healtharmor_maxdamage(GetResource(frag_target, RES_HEALTH), GetResource(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 e8c75d6d0f1cac24a0ce0aa0a0f65f381ccf5198..32e39e204de21bad8250b8c6eeff9bba2e9b025e 100644 (file)
@@ -190,7 +190,7 @@ void dompointtouch(entity this, entity toucher)
 {
        if(!IS_PLAYER(toucher))
                return;
-       if(GetResourceAmount(toucher, RES_HEALTH) < 1)
+       if(GetResource(toucher, RES_HEALTH) < 1)
                return;
 
        if(round_handler_IsActive() && !round_handler_IsRoundStarted())
index fd38377db63cf875558ee7af5ff0d7bc751c5ee1..ad0d8878c7aa7ee178f5b03657b34c20bf1e9e96 100644 (file)
@@ -19,7 +19,7 @@ void freezetag_count_alive_players()
        FOREACH_CLIENT(IS_PLAYER(it) && Entity_HasValidTeam(it),
        {
                ++total_players;
-               if (GetResourceAmount(it, RES_HEALTH) < 1 || STAT(FROZEN, it) == FROZEN_NORMAL)
+               if (GetResource(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, RES_HEALTH) >= 1)
+               if (STAT(FROZEN, it) != FROZEN_NORMAL && GetResource(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, RES_HEALTH) < GetResourceAmount(this, RES_HEALTH) + 30
+                       && GetResource(it, RES_HEALTH) < GetResource(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, RES_HEALTH, 0); // neccessary to correctly count alive players
+       SetResource(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, RES_HEALTH, max(1, STAT(REVIVE_PROGRESS, player) * ((warmup_stage) ? warmup_start_health : start_health)));
+                       SetResource(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, RES_HEALTH, max(1, STAT(REVIVE_PROGRESS, player) * ((warmup_stage) ? warmup_start_health : start_health)));
+               SetResource(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, RES_HEALTH), GetResourceAmount(frag_attacker, RES_ARMOR), (IS_BOT_CLIENT(frag_attacker) ? -1 : CS(frag_attacker).ping));
+               GetResource(frag_attacker, RES_HEALTH), GetResource(frag_attacker, RES_ARMOR), (IS_BOT_CLIENT(frag_attacker) ? -1 : CS(frag_attacker).ping));
 
        return true;
 }
index 4e57a5ef2c5b1c9a378865b40bb344606d3000ce..31c5711424834925e91cb53e21d64da6ea2e9e39 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, RES_HEALTH) > 0,
+       IL_EACH(g_monsters, GetResource(it, RES_HEALTH) > 0,
        {
                if((get_monsterinfo(it.monsterid)).spawnflags & MON_FLAG_SUPERMONSTER)
                        ++supermonster_count;
index 3cb01730d0964c89a74462ecfc5f9316b175d50b..f9885fefd45321c42987a5ff192fa7c9faf539df 100644 (file)
@@ -308,7 +308,7 @@ void football_touch(entity this, entity toucher)
        }
        if (!IS_PLAYER(toucher))
                return;
-       if(GetResourceAmount(toucher, RES_HEALTH) < 1)
+       if(GetResource(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, RES_HEALTH) < 1)
+               if(GetResource(toucher, RES_HEALTH) < 1)
                        return;
                LogNB("caught", toucher);
                GiveBall(toucher, this);
index 72a13dbe4fe0bc2d63b44bc885701af402893d1c..ef217242b1f6d78189b9ab242f7b1fc278d244f3 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, RES_HEALTH) / this.max_health;
+       if(!this.iscaptured) this.alpha = GetResource(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, RES_HEALTH, ReadByte());
+               SetResource(this, RES_HEALTH, ReadByte());
                this.max_health = ReadByte();
                this.count = ReadByte();
                this.team = ReadByte();
                this.iscaptured = ReadByte();
 
                if(!this.count)
-                       this.count = (GetResourceAmount(this, RES_HEALTH) - this.max_health) * frametime;
+                       this.count = (GetResource(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, RES_HEALTH))
+               if(_tmp != GetResource(this, RES_HEALTH))
                        cpicon_damage(this, _tmp);
 
-               SetResourceAmount(this, RES_HEALTH, _tmp);
+               SetResource(this, RES_HEALTH, _tmp);
        }
 }
index 5d29435b45eb2386491d1c07c21c1245f68917bf..db861a355774d9212806556c8f2d96a884163258 100644 (file)
@@ -48,10 +48,10 @@ void generator_draw(entity this)
        if(time < this.move_time)
                return;
 
-       if(GetResourceAmount(this, RES_HEALTH) > 0)
+       if(GetResource(this, RES_HEALTH) > 0)
        {
                // damaged fx (less probable the more damaged is the generator)
-               if(random() < 0.9 - GetResourceAmount(this, RES_HEALTH) / this.max_health)
+               if(random() < 0.9 - GetResource(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, RES_HEALTH, ReadByte());
+               SetResource(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, RES_HEALTH))
+               if(_tmp != GetResource(this, RES_HEALTH))
                        generator_damage(this, _tmp);
 
-               SetResourceAmount(this, RES_HEALTH, _tmp);
+               SetResource(this, RES_HEALTH, _tmp);
        }
 }
index 794c9e6f3550fd4a29c54e4a95b4cf98a452d38e..66ae14db424dfb64a0f36124c3ca7ba1e686c72f 100644 (file)
@@ -36,7 +36,7 @@ MUTATOR_HOOKFUNCTION(cl_ons, WantEventchase)
        entity gen = NULL;
        if(ons_roundlost)
        {
-               IL_EACH(g_onsgenerators, GetResourceAmount(it, RES_HEALTH) <= 0,
+               IL_EACH(g_onsgenerators, GetResource(it, RES_HEALTH) <= 0,
                {
                        gen = it;
                        break;
index 9c0f5b73126cd94c0da532d59e821e420359a0ad..4617d6a3ca1e711b5371c0cc0e960343311fca0f 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, RES_HEALTH));
+               WriteByte(MSG_ENTITY, GetResource(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, RES_HEALTH) <= 0)
+               if(GetResource(this, RES_HEALTH) <= 0)
                        WriteByte(MSG_ENTITY, 0);
                else
-                       WriteByte(MSG_ENTITY, ceil((GetResourceAmount(this, RES_HEALTH) / this.max_health) * 255));
+                       WriteByte(MSG_ENTITY, ceil((GetResource(this, RES_HEALTH) / this.max_health) * 255));
        }
 
        return true;
index 929963bddbed2708f4adead91c99fab973c029b5..eb8c13c39cde27fae9779aa8c4e7a8f5e0137427 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, RES_HEALTH));
+               WriteByte(MSG_ENTITY, GetResource(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, RES_HEALTH) <= 0)
+               if(GetResource(this, RES_HEALTH) <= 0)
                        WriteByte(MSG_ENTITY, 0);
                else
-                       WriteByte(MSG_ENTITY, ceil((GetResourceAmount(this, RES_HEALTH) / this.max_health) * 255));
+                       WriteByte(MSG_ENTITY, ceil((GetResource(this, RES_HEALTH) / this.max_health) * 255));
        }
 
        return true;
index b74e51e44b4a19d3919e01910664d8e5f5cf6cec..23ca66de3f762c00e514694aa75b424966a5d85a 100644 (file)
@@ -395,9 +395,9 @@ void ons_ControlPoint_Icon_Damage(entity this, entity inflictor, entity attacker
 
        TakeResource(this, RES_HEALTH, damage);
        if(this.owner.iscaptured)
-               WaypointSprite_UpdateHealth(this.owner.sprite, GetResourceAmount(this, RES_HEALTH));
+               WaypointSprite_UpdateHealth(this.owner.sprite, GetResource(this, RES_HEALTH));
        else
-               WaypointSprite_UpdateBuildFinished(this.owner.sprite, time + (this.max_health - GetResourceAmount(this, RES_HEALTH)) / (this.count / ONS_CP_THINKRATE));
+               WaypointSprite_UpdateBuildFinished(this.owner.sprite, time + (this.max_health - GetResource(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, RES_HEALTH) < 0)
+       if (GetResource(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, RES_HEALTH);
+       float hlth = GetResource(targ, RES_HEALTH);
        float true_limit = ((limit != RES_LIMIT_NONE) ? limit : targ.max_health);
        if (hlth <= 0 || hlth >= true_limit)
                return false;
 
        GiveResourceWithLimit(targ, RES_HEALTH, amount, true_limit);
-       hlth = GetResourceAmount(targ, RES_HEALTH);
+       hlth = GetResource(targ, RES_HEALTH);
        if(targ.owner.iscaptured)
                WaypointSprite_UpdateHealth(targ.owner.sprite, hlth);
        else
@@ -481,7 +481,7 @@ void ons_ControlPoint_Icon_Think(entity this)
 
                GiveResourceWithLimit(this, RES_HEALTH, (_friendly_count - _enemy_count), this.max_health);
                this.SendFlags |= CPSF_STATUS;
-               if(GetResourceAmount(this, RES_HEALTH) <= 0)
+               if(GetResource(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, RES_HEALTH) < this.max_health)
+               if(GetResource(this, RES_HEALTH) < this.max_health)
                {
                        GiveResourceWithLimit(this, RES_HEALTH, this.count, this.max_health);
-                       WaypointSprite_UpdateHealth(this.owner.sprite, GetResourceAmount(this, RES_HEALTH));
+                       WaypointSprite_UpdateHealth(this.owner.sprite, GetResource(this, RES_HEALTH));
                }
        }
 
@@ -512,7 +512,7 @@ void ons_ControlPoint_Icon_Think(entity this)
        }
 
        // damaged fx
-       if(random() < 0.6 - GetResourceAmount(this, RES_HEALTH) / this.max_health)
+       if(random() < 0.6 - GetResource(this, RES_HEALTH) / this.max_health)
        {
                Send_Effect(EFFECT_ELECTRIC_SPARKS, this.origin + randompos('-10 -10 -20', '10 10 20'), '0 0 0', 1);
 
@@ -538,9 +538,9 @@ void ons_ControlPoint_Icon_BuildThink(entity this)
 
        this.SendFlags |= CPSF_STATUS;
 
-       if (GetResourceAmount(this, RES_HEALTH) >= this.max_health)
+       if (GetResource(this, RES_HEALTH) >= this.max_health)
        {
-               SetResourceAmount(this, RES_HEALTH, this.max_health);
+               SetResource(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, RES_HEALTH));
+               WaypointSprite_UpdateHealth(this.owner.sprite, GetResource(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, RES_HEALTH) / this.max_health)
+       if(random() < 0.9 - GetResource(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, RES_HEALTH, autocvar_g_onslaught_cp_buildhealth);
+       SetResource(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, RES_HEALTH)) * ONS_CP_THINKRATE / autocvar_g_onslaught_cp_buildtime; // how long it takes to build
+       e.count = (e.max_health - GetResource(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, RES_HEALTH)) / (e.count / ONS_CP_THINKRATE));
+       WaypointSprite_UpdateBuildFinished(cp.sprite, time + (e.max_health - GetResource(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, RES_HEALTH));
+                               WaypointSprite_UpdateHealth(e.sprite, GetResource(e.goalentity, RES_HEALTH));
                        }
                }
                if(e.lastshielded)
@@ -900,7 +900,7 @@ void ons_GeneratorDamage(entity this, entity inflictor, entity attacker, float d
                }
        }
        TakeResource(this, RES_HEALTH, damage);
-       float hlth = GetResourceAmount(this, RES_HEALTH);
+       float hlth = GetResource(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);
@@ -961,12 +961,12 @@ 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 != RES_LIMIT_NONE) ? limit : targ.max_health);
-       float hlth = GetResourceAmount(targ, RES_HEALTH);
+       float hlth = GetResource(targ, RES_HEALTH);
        if (hlth <= 0 || hlth >= true_limit)
                return false;
 
        GiveResourceWithLimit(targ, RES_HEALTH, amount, true_limit);
-       hlth = GetResourceAmount(targ, RES_HEALTH);
+       hlth = GetResource(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, RES_HEALTH, autocvar_g_onslaught_gen_health);
+       SetResource(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, RES_HEALTH));
+       WaypointSprite_UpdateHealth(this.sprite, GetResource(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, RES_HEALTH, autocvar_g_onslaught_gen_health);
+       SetResource(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, RES_HEALTH));
+       WaypointSprite_UpdateHealth(gen.sprite, GetResource(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, RES_HEALTH) < 1)
+               if (GetResource(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, RES_HEALTH) > 0 )
+                               if ( !source_point && GetResource(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, RES_HEALTH) <= 0 )
+                               if ( GetResource(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, RES_HEALTH) >= wp_owner.goalentity.max_health) { wp_flag |= 2; }
+                       if(SAME_TEAM(e, wp_owner) && GetResource(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, RES_HEALTH) >= wp_owner.max_health) { wp_flag |= 2; }
-                       if(GetResourceAmount(wp_owner, RES_HEALTH) <= 0) { wp_flag |= 2; }
+                       if(wp_owner.isshielded && GetResource(wp_owner, RES_HEALTH) >= wp_owner.max_health) { wp_flag |= 2; }
+                       if(GetResource(wp_owner, RES_HEALTH) <= 0) { wp_flag |= 2; }
                }
        }
 
index 0b14e7a49b762c2aad8428b1b9b98a595fd517e8..c38c5d9823b389ef3bc509adee9aaaba117f6559 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, RES_BULLETS))
-        SetResourceAmount(item, RES_BULLETS, g_pickup_nails);
+    if(!GetResource(item, RES_BULLETS))
+        SetResource(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, RES_CELLS))
-        SetResourceAmount(item, RES_CELLS, g_pickup_cells);
+    if(!GetResource(item, RES_CELLS))
+        SetResource(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, RES_PLASMA))
-        SetResourceAmount(item, RES_PLASMA, g_pickup_plasma);
+    if(!GetResource(item, RES_PLASMA))
+        SetResource(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, RES_ROCKETS))
-        SetResourceAmount(item, RES_ROCKETS, g_pickup_rockets);
+    if(!GetResource(item, RES_ROCKETS))
+        SetResource(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, RES_SHELLS))
-        SetResourceAmount(item, RES_SHELLS, g_pickup_shells);
+    if(!GetResource(item, RES_SHELLS))
+        SetResource(item, RES_SHELLS, g_pickup_shells);
 }
 #endif
 
index 399dc05b0b4acfc939b52817d8d9a50ab49bad23..4b206d1b377dd8a97f348d4bb194805e4f4fb88e 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, RES_ARMOR))
-        SetResourceAmount(item, RES_ARMOR, g_pickup_armorsmall);
+    if(!GetResource(item, RES_ARMOR))
+        SetResource(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, RES_ARMOR))
-        SetResourceAmount(item, RES_ARMOR, g_pickup_armormedium);
+    if(!GetResource(item, RES_ARMOR))
+        SetResource(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, RES_ARMOR))
-        SetResourceAmount(item, RES_ARMOR, g_pickup_armorbig);
+    if(!GetResource(item, RES_ARMOR))
+        SetResource(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, RES_ARMOR))
-        SetResourceAmount(item, RES_ARMOR, g_pickup_armormega);
+    if(!GetResource(item, RES_ARMOR))
+        SetResource(item, RES_ARMOR, g_pickup_armormega);
 }
 #endif
 
index 3944a84cd28d236ea40ce9b5c58f8f75cdedcb0b..a2f33fb46078be748bdb312c4f591bb37bf2c185 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, RES_HEALTH))
-        SetResourceAmount(item, RES_HEALTH, g_pickup_healthsmall);
+    if(!GetResource(item, RES_HEALTH))
+        SetResource(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, RES_HEALTH))
-        SetResourceAmount(item, RES_HEALTH, g_pickup_healthmedium);
+    if(!GetResource(item, RES_HEALTH))
+        SetResource(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, RES_HEALTH))
-        SetResourceAmount(item, RES_HEALTH, g_pickup_healthbig);
+    if(!GetResource(item, RES_HEALTH))
+        SetResource(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, RES_HEALTH))
-        SetResourceAmount(item, RES_HEALTH, g_pickup_healthmega);
+    if(!GetResource(item, RES_HEALTH))
+        SetResource(item, RES_HEALTH, g_pickup_healthmega);
 }
 #endif
 
index 93f285ffca197e1e57ac96821d75ef7d5a6e8de5..33680e832c75a26df3bc86473224fa5bc0aac876 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, RES_FUEL))
-        SetResourceAmount(item, RES_FUEL, g_pickup_fuel_jetpack);
+    if(!GetResource(item, RES_FUEL))
+        SetResource(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, RES_FUEL))
-        SetResourceAmount(item, RES_FUEL, g_pickup_fuel);
+    if(!GetResource(item, RES_FUEL))
+        SetResource(item, RES_FUEL, g_pickup_fuel);
 }
 #endif
 REGISTER_ITEM(JetpackFuel, Ammo) {
index fbcff114142a04835d6d37835ffd6991b7d08a0c..a1b8c76ba42c49e736f5e742cdb1a787c4fbc3ab 100644 (file)
@@ -83,7 +83,7 @@ void func_breakable_colormod(entity this)
        float h;
        if (!(this.spawnflags & BREAKABLE_INDICATE_DAMAGE))
                return;
-       h = GetResourceAmount(this, RES_HEALTH) / this.max_health;
+       h = GetResource(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, RES_HEALTH, this.max_health);
+       SetResource(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, RES_HEALTH, this.max_health);
+       SetResource(this, RES_HEALTH, this.max_health);
        if(this.sprite)
        {
                WaypointSprite_UpdateMaxHealth(this.sprite, this.max_health);
-               WaypointSprite_UpdateHealth(this.sprite, GetResourceAmount(this, RES_HEALTH));
+               WaypointSprite_UpdateHealth(this.sprite, GetResource(this, RES_HEALTH));
        }
        if(!(this.spawnflags & BREAKABLE_NODAMAGE))
        {
@@ -276,11 +276,11 @@ void func_breakable_damage(entity this, entity inflictor, entity attacker, float
        if(this.sprite)
        {
                WaypointSprite_Ping(this.sprite);
-               WaypointSprite_UpdateHealth(this.sprite, GetResourceAmount(this, RES_HEALTH));
+               WaypointSprite_UpdateHealth(this.sprite, GetResource(this, RES_HEALTH));
        }
        func_breakable_colormod(this);
 
-       if(GetResourceAmount(this, RES_HEALTH) <= 0)
+       if(GetResource(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, RES_HEALTH))
-               SetResourceAmount(this, RES_HEALTH, 100);
-       this.max_health = GetResourceAmount(this, RES_HEALTH);
+       if(!GetResource(this, RES_HEALTH))
+               SetResource(this, RES_HEALTH, 100);
+       this.max_health = GetResource(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 41c2ea1ba0df251a8b8c4fec7cfffc3b7b2a1bf0..f21d37fd29fce615a6f4a68300452278b49d1f4d 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, RES_HEALTH))
+       if (GetResource(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, RES_HEALTH, this.max_health);
+       SetResource(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, RES_HEALTH, this.max_health);
+       SetResource(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, RES_HEALTH))
+       if (GetResource(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, RES_HEALTH) <= damage)
+               if (GetResource(this, RES_HEALTH) <= damage)
                {
                        this.enemy = attacker;
                        button_fire(this);
@@ -157,7 +157,7 @@ void button_damage(entity this, entity inflictor, entity attacker, float damage,
        else
        {
                TakeResource(this, RES_HEALTH, damage);
-               if (GetResourceAmount(this, RES_HEALTH) <= 0)
+               if (GetResource(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, RES_HEALTH))
+       if (GetResource(this, RES_HEALTH))
        {
-               this.max_health = GetResourceAmount(this, RES_HEALTH);
+               this.max_health = GetResource(this, RES_HEALTH);
                this.event_damage = button_damage;
                this.takedamage = DAMAGE_YES;
        }
index 3360fc961504b299b6d1f1c136c19439704f317a..47fda80f55f1b2591b407c032a203d392bfb6979 100644 (file)
@@ -113,7 +113,7 @@ void door_go_down(entity this)
        if (this.max_health)
        {
                this.takedamage = DAMAGE_YES;
-               SetResourceAmount(this, RES_HEALTH, this.max_health);
+               SetResource(this, RES_HEALTH, this.max_health);
        }
 
        this.state = STATE_DOWN;
@@ -273,9 +273,9 @@ void door_damage(entity this, entity inflictor, entity attacker, float damage, i
                return;
        }
 
-       if (GetResourceAmount(this, RES_HEALTH) <= 0)
+       if (GetResource(this, RES_HEALTH) <= 0)
        {
-               SetResourceAmount(this.owner, RES_HEALTH, this.owner.max_health);
+               SetResource(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, RES_HEALTH) < 1)
+       if (GetResource(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, RES_HEALTH))
+               if (GetResource(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, RES_HEALTH) && !GetResourceAmount(this, RES_HEALTH))
-                       SetResourceAmount(this, RES_HEALTH, GetResourceAmount(t, RES_HEALTH));
+               if(GetResource(t, RES_HEALTH) && !GetResource(this, RES_HEALTH))
+                       SetResource(this, RES_HEALTH, GetResource(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, RES_HEALTH, GetResourceAmount(this, RES_HEALTH));
+               SetResource(t, RES_HEALTH, GetResource(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, RES_HEALTH))
+       if (GetResource(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, RES_HEALTH);
+       this.max_health = GetResource(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, RES_HEALTH))
+       if (GetResource(this, RES_HEALTH))
        {
                //this.canteamdamage = true; // TODO
                this.takedamage = DAMAGE_YES;
index b844ab47fd4d2ecf79534d6d059bee30679ade1f..9b355707b49010dea1f83257d53487da1a8d66a3 100644 (file)
@@ -58,7 +58,7 @@ void door_rotating_go_down(entity this)
        if (this.max_health)
        {
                this.takedamage = DAMAGE_YES;
-               SetResourceAmount(this, RES_HEALTH, this.max_health);
+               SetResource(this, RES_HEALTH, this.max_health);
        }
 
        this.state = STATE_DOWN;
index 8236fcb13b41740fae487a58b72c68a631668e1b..4697cc46cac4f1f9f8de4d2494084ec98ee3696e 100644 (file)
@@ -13,7 +13,7 @@ void fd_secret_use(entity this, entity actor, entity trigger)
        float temp;
        string message_save;
 
-       SetResourceAmount(this, RES_HEALTH, 10000);
+       SetResource(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, RES_HEALTH, 10000);
+               SetResource(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, RES_HEALTH, 10000);
+               SetResource(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, RES_HEALTH, 10000);
+               SetResource(this, RES_HEALTH, 10000);
                this.takedamage = DAMAGE_YES;
                this.event_damage = fd_secret_damage;
        }
index 511cf13a6558000f8fb3f66a2a04f7449d36d20e..832b25b6b4e8f6513bd30655347ef0472f8c3468 100644 (file)
@@ -93,7 +93,7 @@ void plat_center_touch(entity this, entity toucher)
        if (!toucher.iscreature)
                return;
 
-       if (GetResourceAmount(toucher, RES_HEALTH) <= 0)
+       if (GetResource(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, RES_HEALTH) <= 0)
+       if (GetResource(toucher, RES_HEALTH) <= 0)
                return;
 #elif defined(CSQC)
        if (!IS_PLAYER(toucher))
index 40fe366716cfec58a334696489f834c5af7aaed6..339ade52a775cc86462c7f991b82a8d5ba8ac366 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, RES_HEALTH) >= 1)
+               if (IS_PLAYER(player) && GetResource(player, RES_HEALTH) >= 1)
                {
                        if (!(teamplay && autocvar_g_telefrags_teamplay && head.team == player.team))
                        {
                                if(IS_PLAYER(head))
-                                       if(GetResourceAmount(head, RES_HEALTH) >= 1)
+                                       if(GetResource(head, RES_HEALTH) >= 1)
                                                ++tdeath_hit;
                                Damage (head, teleporter, telefragger, 10000, DEATH_TELEFRAG.m_id, DMG_NOWEP, head.origin, '0 0 0');
                        }
index c47a584d1b576a26afae590838e505733d9e7249..dd1cf4015b290548d25ec64d1c5b6360964ee5b6 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, RES_HEALTH), this.max_health);
+                       bool healed = Heal(toucher, this, GetResource(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, RES_HEALTH))
-               SetResourceAmount(this, RES_HEALTH, 10); // TODO: use a special field for this, it doesn't have actual health!
+       if(!GetResource(this, RES_HEALTH))
+               SetResource(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 5ae77e4821c30b25ce05f61cdc12b13daf4b8960..f999083aafca87eda2c25f02d5081e58e5ef4144 100644 (file)
@@ -7,7 +7,7 @@ void multi_wait(entity this)
 {
        if (this.max_health)
        {
-               SetResourceAmount(this, RES_HEALTH, this.max_health);
+               SetResource(this, RES_HEALTH, this.max_health);
                this.takedamage = DAMAGE_YES;
                this.solid = SOLID_BBOX;
        }
@@ -121,7 +121,7 @@ void multi_eventdamage(entity this, entity inflictor, entity attacker, float dam
                if(((this.spawnflags & INVERT_TEAMS) == 0) == (this.team != attacker.team))
                        return;
        TakeResource(this, RES_HEALTH, damage);
-       if (GetResourceAmount(this, RES_HEALTH) <= 0)
+       if (GetResource(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, RES_HEALTH, this.max_health);
+               SetResource(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, RES_HEALTH))
+       if (GetResource(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, RES_HEALTH);
+               this.max_health = GetResource(this, RES_HEALTH);
                this.event_damage = multi_eventdamage;
                this.takedamage = DAMAGE_YES;
                this.solid = SOLID_BBOX;
index 605ce668ae6417cfc1da820398b9271f983b17ec..8422a01b1a77cf3234191b60fe44278fc5e5b9a9 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, RES_HEALTH, 0);
+       SetResource(this, RES_HEALTH, 0);
 
        // a secret can not be delayed
        this.delay = 0;
index 0045749d17b2009390f06b626390ed4bcb8ae306..0717f4beadd4eeb4aa0ae1c2a7cfcc94af38a0f9 100644 (file)
@@ -44,7 +44,7 @@ void swampslug_think(entity this)
        this.swamp_lifetime -= 1;
 
        //Slug dead? then remove curses.
-       if(GetResourceAmount(this, RES_HEALTH) <= 0)
+       if(GetResource(this, RES_HEALTH) <= 0)
        {
                this.owner.in_swamp = 0;
                delete(this);
index bd2c7c940680e4d2e70e57e22fba7beb25a3f4ff..bdbae245f5c2c205a27f9615fc6c094a86810d55 100644 (file)
@@ -87,31 +87,31 @@ bool M_Mage_Defend_Heal_Check(entity this, entity targ)
 {
        if(targ == NULL)
                return false;
-       if(GetResourceAmount(targ, RES_HEALTH) <= 0)
+       if(GetResource(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, RES_HEALTH) < targ.max_health);
+               return (IS_MONSTER(targ) && GetResource(targ, RES_HEALTH) < targ.max_health);
        if(targ.items & ITEM_Shield.m_itemid)
                return false;
 
        switch(this.skin)
        {
-               case 0: return (GetResourceAmount(targ, RES_HEALTH) < autocvar_g_balance_health_regenstable);
+               case 0: return (GetResource(targ, RES_HEALTH) < autocvar_g_balance_health_regenstable);
                case 1:
                {
-                       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)
+                       return ((GetResource(targ, RES_CELLS) && GetResource(targ, RES_CELLS) < g_pickup_cells_max)
+                               ||  (GetResource(targ, RES_PLASMA) && GetResource(targ, RES_PLASMA) < g_pickup_plasma_max)
+                               ||  (GetResource(targ, RES_ROCKETS) && GetResource(targ, RES_ROCKETS) < g_pickup_rockets_max)
+                               ||  (GetResource(targ, RES_BULLETS) && GetResource(targ, RES_BULLETS) < g_pickup_nails_max)
+                               ||  (GetResource(targ, RES_SHELLS) && GetResource(targ, RES_SHELLS) < g_pickup_shells_max)
                                        );
                }
-               case 2: return (GetResourceAmount(targ, RES_ARMOR) < autocvar_g_balance_armor_regenstable);
-               case 3: return (GetResourceAmount(targ, RES_HEALTH) > 0);
+               case 2: return (GetResource(targ, RES_ARMOR) < autocvar_g_balance_armor_regenstable);
+               case 3: return (GetResource(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, RES_HEALTH) <= 0) || GetResourceAmount(this.owner, RES_HEALTH) <= 0) {
+       if (time > this.ltime || (this.enemy && GetResource(this.enemy, RES_HEALTH) <= 0) || GetResource(this.owner, RES_HEALTH) <= 0) {
                this.projectiledeathtype |= HITTYPE_SPLASH;
                M_Mage_Attack_Spike_Explode(this, NULL);
        }
@@ -241,17 +241,17 @@ void M_Mage_Defend_Heal(entity this)
                                }
                                case 1:
                                {
-                                       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);
+                                       if(GetResource(this, RES_CELLS)) GiveResourceWithLimit(it, RES_CELLS, 1, g_pickup_cells_max);
+                                       if(GetResource(this, RES_PLASMA)) GiveResourceWithLimit(it, RES_PLASMA, 1, g_pickup_plasma_max);
+                                       if(GetResource(this, RES_ROCKETS)) GiveResourceWithLimit(it, RES_ROCKETS, 1, g_pickup_rockets_max);
+                                       if(GetResource(this, RES_SHELLS)) GiveResourceWithLimit(it, RES_SHELLS, 2, g_pickup_shells_max);
+                                       if(GetResource(this, RES_BULLETS)) GiveResourceWithLimit(it, RES_BULLETS, 5, g_pickup_nails_max);
                                        // TODO: fuel?
                                        fx = EFFECT_AMMO_REGEN;
                                        break;
                                }
                                case 2:
-                                       if(GetResourceAmount(it, RES_ARMOR) < autocvar_g_balance_armor_regenstable)
+                                       if(GetResource(it, RES_ARMOR) < autocvar_g_balance_armor_regenstable)
                                        {
                                                GiveResourceWithLimit(it, RES_ARMOR, autocvar_g_monster_mage_heal_allies, autocvar_g_balance_armor_regenstable);
                                                fx = EFFECT_ARMOR_REPAIR;
@@ -271,7 +271,7 @@ void M_Mage_Defend_Heal(entity this)
                        Send_Effect(EFFECT_HEALING, it.origin, '0 0 0', 1);
                        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, RES_HEALTH));
+                               WaypointSprite_UpdateHealth(it.sprite, GetResource(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, RES_ARMOR, autocvar_g_monsters_armor_blockpercent);
+       SetResource(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, RES_ARMOR, autocvar_g_monster_mage_shield_blockpercent);
+       SetResource(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, RES_HEALTH) < (autocvar_g_monster_mage_heal_minhealth) || need_help)
+    if(GetResource(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, RES_ARMOR))
+    if(time >= actor.mage_shield_time && GetResource(actor, RES_ARMOR))
         M_Mage_Defend_Shield_Remove(actor);
 
     if(actor.enemy)
-    if(GetResourceAmount(actor, RES_HEALTH) < actor.max_health)
+    if(GetResource(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, RES_HEALTH)) SetResourceAmount(actor, RES_HEALTH, autocvar_g_monster_mage_health);
+    if(!GetResource(this, RES_HEALTH)) SetResource(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 0e91599a8113c90fd4447d463953ea73653c90a0..043a8649857518376c51656014d2840c2c213b03 100644 (file)
@@ -85,7 +85,7 @@ 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, RES_HEALTH) <= 0)
+       if (GetResource(this, RES_HEALTH) <= 0)
                return;
 
        if (!W_CheckProjectileDamage(inflictor.realowner, this.realowner, deathtype, -1)) // no exceptions
@@ -93,7 +93,7 @@ void M_Shambler_Attack_Lightning_Damage(entity this, entity inflictor, entity at
 
        TakeResource(this, RES_HEALTH, damage);
 
-       if (GetResourceAmount(this, RES_HEALTH) <= 0)
+       if (GetResource(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, RES_HEALTH, 50);
+       SetResource(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, RES_HEALTH)) SetResourceAmount(actor, RES_HEALTH, autocvar_g_monster_shambler_health);
+    if(!GetResource(this, RES_HEALTH)) SetResource(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 7f3bd1e282710810a592f2ce59699643bdc84975..7cff3d447483e4cd49fd7e17c4e52513b2a48d0d 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, RES_HEALTH) > 0 && it.monsterid != MON_SPIDER.monsterid,
+               FOREACH_ENTITY_RADIUS(this.origin, 25, it != this && it.takedamage && !IS_DEAD(it) && GetResource(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, RES_HEALTH, 500);
+       SetResource(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, RES_HEALTH)) SetResourceAmount(actor, RES_HEALTH, autocvar_g_monster_spider_health);
+    if(!GetResource(this, RES_HEALTH)) SetResource(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 f2e835d67549e8e686516f6c1de260ea966dfd03..5f471bc9ee2aec69a132c1ad17a8f00ecb5a76d0 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, RES_HEALTH)) SetResourceAmount(actor, RES_HEALTH, autocvar_g_monster_wyvern_health);
+    if(!GetResource(this, RES_HEALTH)) SetResource(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 d8fcd11af79753156526470c8a03f3b703ba6102..4f0d9802815b6ad6d952e007bc67f6b59af2b0e9 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, RES_HEALTH) <= 0)
+       if (GetResource(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, RES_HEALTH) <= 0)
+       if(GetResource(this, RES_HEALTH) <= 0)
                return;
 
        setanim(this, this.anim_blockend, false, true, true);
-       SetResourceAmount(this, RES_ARMOR, autocvar_g_monsters_armor_blockpercent);
+       SetResource(this, RES_ARMOR, autocvar_g_monsters_armor_blockpercent);
 }
 
 bool M_Zombie_Defend_Block(entity this)
 {
-       SetResourceAmount(this, RES_ARMOR, 0.9);
+       SetResource(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, RES_HEALTH) < 75 && GetResourceAmount(actor.enemy, RES_HEALTH) > 10)
+                       if(random() < 0.3 && GetResource(actor, RES_HEALTH) < 75 && GetResource(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, RES_ARMOR, autocvar_g_monsters_armor_blockpercent);
+    SetResource(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, RES_HEALTH)) SetResourceAmount(actor, RES_HEALTH, autocvar_g_monster_zombie_health);
+    if(!GetResource(actor, RES_HEALTH)) SetResource(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 698049187c0b701b0ac5711af303eba2f5709c7b..fa1ecb07b0105cff66c2a0871b352e2b3cf9a6e4 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, RES_HEALTH) <= 0 || GetResourceAmount(this, RES_HEALTH) <= 0))
+       || (!IS_VEHICLE(targ) && (IS_DEAD(targ) || IS_DEAD(this) || GetResource(targ, RES_HEALTH) <= 0 || GetResource(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, RES_HEALTH) <= 0 || IS_DEAD(this))
+       if(GetResource(this, RES_HEALTH) <= 0 || IS_DEAD(this))
                return false; // called when dead?
        if(time < this.attack_finished_single[0])
                return false; // still attacking
@@ -531,7 +531,7 @@ void Monster_Dead_Fade(entity this)
                this.takedamage = DAMAGE_NO;
                setorigin(this, this.pos1);
                this.angles = this.pos2;
-               SetResourceAmount(this, RES_HEALTH, this.max_health);
+               SetResource(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, RES_HEALTH) < 1)
+                       || (IS_DEAD(this.enemy) || GetResource(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, RES_HEALTH, this.max_health);
+       SetResource(this, RES_HEALTH, this.max_health);
        this.velocity = '0 0 0';
        this.enemy = NULL;
        this.goalentity = NULL;
@@ -912,7 +912,7 @@ void Monster_Dead_Damage(entity this, entity inflictor, entity attacker, float d
 
        Violence_GibSplash_At(hitloc, force, 2, bound(0, damage, 200) / 16, this, attacker);
 
-       if(GetResourceAmount(this, RES_HEALTH) <= -50) // 100 health until gone?
+       if(GetResource(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, RES_ARMOR) / 100, deathtype, damage);
+       vector v = healtharmor_applydamage(100, GetResource(this, RES_ARMOR) / 100, deathtype, damage);
        float take = v.x;
        //float save = v.y;
 
@@ -1014,7 +1014,7 @@ void Monster_Damage(entity this, entity inflictor, entity attacker, float damage
        }
 
        if(this.sprite)
-               WaypointSprite_UpdateHealth(this.sprite, GetResourceAmount(this, RES_HEALTH));
+               WaypointSprite_UpdateHealth(this.sprite, GetResource(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, RES_HEALTH) <= 0)
+       if(GetResource(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, RES_HEALTH) <= -100 || deathtype == DEATH_KILL.m_id));
+               Monster_Dead(this, attacker, (GetResource(this, RES_HEALTH) <= -100 || deathtype == DEATH_KILL.m_id));
 
                WaypointSprite_Kill(this.sprite);
 
                MUTATOR_CALLHOOK(MonsterDies, this, attacker, deathtype);
 
-               if(GetResourceAmount(this, RES_HEALTH) <= -100 || deathtype == DEATH_KILL.m_id) // check if we're already gibbed
+               if(GetResource(this, RES_HEALTH) <= -100 || deathtype == DEATH_KILL.m_id) // check if we're already gibbed
                {
                        Violence_GibSplash(this, 1, 0.5, attacker);
 
@@ -1060,12 +1060,12 @@ 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 != RES_LIMIT_NONE) ? limit : targ.max_health);
-       if(GetResourceAmount(targ, RES_HEALTH) <= 0 || GetResourceAmount(targ, RES_HEALTH) >= true_limit)
+       if(GetResource(targ, RES_HEALTH) <= 0 || GetResource(targ, RES_HEALTH) >= true_limit)
                return false;
 
        GiveResourceWithLimit(targ, RES_HEALTH, amount, true_limit);
        if(targ.sprite)
-               WaypointSprite_UpdateHealth(targ.sprite, GetResourceAmount(targ, RES_HEALTH));
+               WaypointSprite_UpdateHealth(targ.sprite, GetResource(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, RES_HEALTH, max(1, STAT(REVIVE_PROGRESS, this) * this.max_health));
+               SetResource(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, RES_HEALTH));
+                       WaypointSprite_UpdateHealth(this.sprite, GetResource(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, RES_HEALTH, max(0, autocvar_g_nades_ice_health + (this.max_health-autocvar_g_nades_ice_health) * STAT(REVIVE_PROGRESS, this)));
+               SetResource(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, RES_HEALTH));
+                       WaypointSprite_UpdateHealth(this.sprite, GetResource(this, RES_HEALTH));
 
-               if(GetResourceAmount(this, RES_HEALTH) < 1)
+               if(GetResource(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, RES_HEALTH) + this.max_health, DEATH_KILL.m_id, DMG_NOWEP, this.origin, this.origin);
+               Damage(this, this, this, GetResource(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, 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(!GetResource(this, RES_HEALTH)) { SetResource(this, RES_HEALTH, 100); }
+       if(!GetResource(this, RES_ARMOR)) { SetResource(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, RES_HEALTH, GetResourceAmount(this, RES_HEALTH) * MONSTER_SKILLMOD(this));
+               SetResource(this, RES_HEALTH, GetResource(this, RES_HEALTH) * MONSTER_SKILLMOD(this));
 
                if(!this.skin)
                        this.skin = rint(random() * 4);
        }
 
-       this.max_health = GetResourceAmount(this, RES_HEALTH);
+       this.max_health = GetResource(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, RES_HEALTH));
+                       WaypointSprite_UpdateHealth(this.sprite, GetResource(this, RES_HEALTH));
                }
        }
 
index eafc5cb5b5837867fdcd4f9c661ecadd9a9f35b8..a89691d2016a3591c572df9c93a7956a39cf8af3 100644 (file)
@@ -10,7 +10,7 @@ MUTATOR_HOOKFUNCTION(bloodloss, PlayerPreThink)
        entity player = M_ARGV(0, entity);
 
        if(IS_PLAYER(player))
-       if(GetResourceAmount(player, RES_HEALTH) <= autocvar_g_bloodloss && !IS_DEAD(player))
+       if(GetResource(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, RES_HEALTH) <= autocvar_g_bloodloss)
+       if(GetResource(player, RES_HEALTH) <= autocvar_g_bloodloss)
                return true;
 }
 
index 152f93d518772c2a530fa46b7c9ee099ea8ee491..58663be1ac72aafd49268046138727770b250871 100644 (file)
@@ -427,13 +427,13 @@ void buff_Medic_Heal(entity this)
                {
                        continue;
                }
-               float hp = GetResourceAmount(it, RES_HEALTH);
+               float hp = GetResource(it, RES_HEALTH);
                if(hp >= autocvar_g_balance_health_regenstable)
                {
                        continue;
                }
                Send_Effect(EFFECT_HEALING, it.origin, '0 0 0', 1);
-               SetResourceAmount(it, RES_HEALTH, bound(0, hp + autocvar_g_buffs_medic_heal_amount, autocvar_g_balance_health_regenstable));
+               SetResource(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, RES_HEALTH) - frag_damage) <= 0)
+       if((GetResource(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, RES_HEALTH) - autocvar_g_buffs_medic_survive_health);
+               frag_damage = max(5, GetResource(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,12 +544,12 @@ 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, RES_HEALTH));
+                       GetResource(frag_target, RES_HEALTH));
                GiveResourceWithLimit(frag_attacker, RES_HEALTH, amount, g_pickup_healthsmall_max);
-               if (GetResourceAmount(frag_target, RES_ARMOR))
+               if (GetResource(frag_target, RES_ARMOR))
                {
                        amount = bound(0, frag_damage * autocvar_g_buffs_vampire_damage_steal,
-                               GetResourceAmount(frag_target, RES_ARMOR));
+                               GetResource(frag_target, RES_ARMOR));
                        GiveResourceWithLimit(frag_attacker, RES_ARMOR, amount, g_pickup_armorsmall_max);
                }
        }
index 70339c9a3b2f238115a00fd07fb0c02476e424fe..e56d044669b353aa346bde74cb4c829565c40e1d 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, RES_HEALTH) + GetResourceAmount(player, RES_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, GetResource(player, RES_HEALTH) + GetResource(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 bdcd97aae66c202032580dc4cdea1735c3908663..cd0d81918004363ddf0a77b1db58c3eefb7d2483 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, RES_CELLS))
-        SetResourceAmount(item, RES_CELLS, autocvar_g_instagib_ammo_drop);
+    if(!GetResource(item, RES_CELLS))
+        SetResource(item, RES_CELLS, autocvar_g_instagib_ammo_drop);
 }
 #endif
 REGISTER_ITEM(VaporizerCells, Ammo) {
index d518665d2d3a1e72079c42e0458ec09a6a24f06c..fc571678b2c7f22ea1032f2f4a3d6e580cc83a02 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, RES_CELLS) > 0 || (this.items & IT_UNLIMITED_WEAPON_AMMO) || (this.flags & FL_GODMODE))
+       else if (GetResource(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, RES_HEALTH);
+               float hp = GetResource(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, RES_ARMOR);
+                       float armor = GetResource(frag_target, RES_ARMOR);
                        if(armor)
                        {
                                armor -= 1;
-                               SetResourceAmount(frag_target, RES_ARMOR, armor);
+                               SetResource(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, RES_HEALTH) > 0) { Send_Notification(NOTIF_ONE, frag_attacker, MSG_CENTER, CENTER_SECONDARY_NODAMAGE); }
+                                       if(frag_damage <= 0 && GetResource(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, RES_ARMOR);
+               float armor = GetResource(frag_attacker, RES_ARMOR);
                if(armor > 0)
                {
                        armor -= 1;
-                       SetResourceAmount(frag_attacker, RES_ARMOR, armor);
+                       SetResource(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, RES_CELLS, autocvar_g_instagib_ammo_drop);
+               SetResource(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, RES_CELLS);
+       float cells = GetResource(item, RES_CELLS);
        if(cells > autocvar_g_instagib_ammo_drop && item.classname != "item_vaporizer_cells")
-               SetResourceAmount(item, RES_CELLS, autocvar_g_instagib_ammo_drop);
+               SetResource(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, RES_CELLS))
+       if(GetResource(item, RES_CELLS))
        {
                // play some cool sounds ;)
-               float hp = GetResourceAmount(toucher, RES_HEALTH);
+               float hp = GetResource(toucher, RES_HEALTH);
                if (IS_CLIENT(toucher))
                {
                        if(hp <= 5)
@@ -521,7 +521,7 @@ MUTATOR_HOOKFUNCTION(mutator_instagib, ItemTouch)
                }
 
                if(hp < 100)
-                       SetResourceAmount(toucher, RES_HEALTH, 100);
+                       SetResource(toucher, RES_HEALTH, 100);
 
                return MUT_ITEMTOUCH_CONTINUE;
        }
index 74d16f3eae609b04a17ff411f326487abe8db6d9..dd088d78f25c401f1565ec416b17d3b28837bdb0 100644 (file)
@@ -7,10 +7,10 @@ MUTATOR_HOOKFUNCTION(invincibleprojectiles, EditProjectile)
 {
        entity proj = M_ARGV(1, entity);
 
-       if(GetResourceAmount(proj, RES_HEALTH))
+       if(GetResource(proj, RES_HEALTH))
        {
                // disable health which in effect disables damage calculations
-               SetResourceAmount(proj, RES_HEALTH, 0);
+               SetResource(proj, RES_HEALTH, 0);
        }
 }
 
index 13e7138fa43c11b0b25307049a66b81f5d79b7a1..6924947f05c0c821b5558648ef471c42fda5be4b 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, RES_HEALTH) > 0 && current_freeze_time > 0,
+       FOREACH_ENTITY_RADIUS(this.origin, autocvar_g_nades_nade_radius, it != this && it.takedamage && !IS_DEAD(it) && GetResource(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,7 +632,7 @@ 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, RES_HEALTH);
+                       float hp = GetResource(toucher, RES_HEALTH);
                        if (hp < maxhealth)
                        {
                                if (this.nade_show_particles)
@@ -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, RES_HEALTH) == this.max_health) // no boosted shot pickups, thank you very much
+       if(!toucher.nade && GetResource(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, RES_HEALTH) == this.max_health)
+       if(GetResource(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, RES_HEALTH);
+       float hp = GetResource(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, RES_HEALTH, hp);
+       SetResource(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, RES_HEALTH, autocvar_g_nades_nade_health);
-       _nade.max_health = GetResourceAmount(_nade, RES_HEALTH);
+       SetResource(_nade, RES_HEALTH, autocvar_g_nades_nade_health);
+       _nade.max_health = GetResource(_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, RES_HEALTH, max(1, STAT(REVIVE_PROGRESS, player) * start_health));
+               SetResource(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, RES_HEALTH, autocvar_g_freezetag_revive_nade_health);
+               SetResource(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 acf24936bf5c55f6be5e48dc35092c4a21d6e0ed..bc96ec8ecdd6a11918598650ef9f28474f63f5fd 100644 (file)
@@ -32,7 +32,7 @@ void orb_setup(entity e)
 
        e.draw = orb_draw;
        IL_PUSH(g_drawables, e);
-       SetResourceAmount(e, RES_HEALTH, 255);
+       SetResource(e, RES_HEALTH, 255);
        set_movetype(e, MOVETYPE_NONE);
        e.solid = SOLID_NOT;
        e.drawmask = MASK_NORMAL;
index b50a273ad3e117c4c8098fede8a616430f001ce1..efe8ee3aedf2449988527ca916cc77bc2055044e 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, 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);
+                       SetResource(it, RES_SHELLS, start_ammo_shells);
+                       SetResource(it, RES_BULLETS, start_ammo_nails);
+                       SetResource(it, RES_ROCKETS, start_ammo_rockets);
+                       SetResource(it, RES_CELLS, start_ammo_cells);
+                       SetResource(it, RES_PLASMA, start_ammo_plasma);
+                       SetResource(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, 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);
+               SetResource(this, RES_SHELLS, 0);
+               SetResource(this, RES_BULLETS, 0);
+               SetResource(this, RES_ROCKETS, 0);
+               SetResource(this, RES_CELLS, 0);
+               SetResource(this, RES_PLASMA, 0);
+               SetResource(this, RES_FUEL, 0);
                if(this.items & IT_UNLIMITED_WEAPON_AMMO)
                {
                        switch (wpn.ammo_type)
                        {
-                               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;
+                               case RES_SHELLS:  SetResource(this, RES_SHELLS, autocvar_g_pickup_shells_max);  break;
+                               case RES_BULLETS: SetResource(this, RES_BULLETS, autocvar_g_pickup_nails_max);   break;
+                               case RES_ROCKETS: SetResource(this, RES_ROCKETS, autocvar_g_pickup_rockets_max); break;
+                               case RES_CELLS:   SetResource(this, RES_CELLS, autocvar_g_pickup_cells_max);   break;
+                               case RES_PLASMA:  SetResource(this, RES_PLASMA, autocvar_g_pickup_plasma_max);   break;
+                               case RES_FUEL:    SetResource(this, RES_FUEL, autocvar_g_pickup_fuel_max);    break;
                        }
                }
                else
                {
                        switch (wpn.ammo_type)
                        {
-                               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;
+                               case RES_SHELLS:  SetResource(this, RES_SHELLS, autocvar_g_balance_nix_ammo_shells);  break;
+                               case RES_BULLETS: SetResource(this, RES_BULLETS, autocvar_g_balance_nix_ammo_nails);   break;
+                               case RES_ROCKETS: SetResource(this, RES_ROCKETS, autocvar_g_balance_nix_ammo_rockets); break;
+                               case RES_CELLS:   SetResource(this, RES_CELLS, autocvar_g_balance_nix_ammo_cells);   break;
+                               case RES_PLASMA:  SetResource(this, RES_PLASMA, autocvar_g_balance_nix_ammo_plasma);   break;
+                               case RES_FUEL:    SetResource(this, RES_FUEL, autocvar_g_balance_nix_ammo_fuel);    break;
                        }
                }
 
index 688928ce1425b23a4a1294de87788d66b1406b07..bee61f2fea54516c00e7be4088be64b09a8fdab4 100644 (file)
@@ -116,7 +116,7 @@ METHOD(OverkillHeavyMachineGun, wr_think, void(entity thiswep, entity actor, .en
 
 METHOD(OverkillHeavyMachineGun, wr_checkammo1, bool(entity thiswep, entity actor, .entity weaponentity))
 {
-       float ammo_amount = GetResourceAmount(actor, thiswep.ammo_type) >= WEP_CVAR_PRI(okhmg, ammo);
+       float ammo_amount = GetResource(actor, thiswep.ammo_type) >= WEP_CVAR_PRI(okhmg, ammo);
        if (autocvar_g_balance_okhmg_reload_ammo)
        {
                ammo_amount += actor.(weaponentity).(weapon_load[WEP_OVERKILL_HMG.m_id]) >= WEP_CVAR_PRI(okhmg, ammo);
@@ -126,7 +126,7 @@ METHOD(OverkillHeavyMachineGun, wr_checkammo1, bool(entity thiswep, entity actor
 
 METHOD(OverkillHeavyMachineGun, wr_checkammo2, bool(entity thiswep, entity actor, .entity weaponentity))
 {
-       float ammo_amount = GetResourceAmount(actor, thiswep.ammo_type) >= WEP_CVAR_SEC(okhmg, ammo);
+       float ammo_amount = GetResource(actor, thiswep.ammo_type) >= WEP_CVAR_SEC(okhmg, ammo);
        if (autocvar_g_balance_okhmg_reload_ammo)
        {
                ammo_amount += actor.(weaponentity).(weapon_load[WEP_OVERKILL_HMG.m_id]) >= WEP_CVAR_SEC(okhmg, ammo);
index aa872f1541a64f052d79d7c73751a6c7e46a984c..f8dfa89fe5b5748e72bea985b7349315f1c56780 100644 (file)
@@ -111,7 +111,7 @@ METHOD(OverkillMachineGun, wr_think, void(entity thiswep, entity actor, .entity
 METHOD(OverkillMachineGun, wr_checkammo1, bool(entity thiswep, entity actor, .entity weaponentity))
 {
        float ammo_amount;
-       ammo_amount = GetResourceAmount(actor, thiswep.ammo_type) >= WEP_CVAR_PRI(okmachinegun, ammo);
+       ammo_amount = GetResource(actor, thiswep.ammo_type) >= WEP_CVAR_PRI(okmachinegun, ammo);
        if (WEP_CVAR(okmachinegun, reload_ammo))
        {
                ammo_amount += actor.(weaponentity).(weapon_load[WEP_OVERKILL_MACHINEGUN.m_id]) >= WEP_CVAR_PRI(okmachinegun, ammo);
index 4fbd200b699321160defd98d9259311ec8de60a2..e1b26c36d17c790ab334067c0dcd198c5ef13028 100644 (file)
@@ -268,7 +268,7 @@ METHOD(OverkillNex, wr_setup, void(entity thiswep, entity actor, .entity weapone
 
 METHOD(OverkillNex, wr_checkammo1, bool(entity thiswep, entity actor, .entity weaponentity))
 {
-       float ammo_amount = GetResourceAmount(actor, thiswep.ammo_type) >= WEP_CVAR_PRI(oknex, ammo);
+       float ammo_amount = GetResource(actor, thiswep.ammo_type) >= WEP_CVAR_PRI(oknex, ammo);
        ammo_amount += (autocvar_g_balance_oknex_reload_ammo && actor.(weaponentity).(weapon_load[thiswep.m_id]) >= WEP_CVAR_PRI(oknex, ammo));
        return ammo_amount;
 }
@@ -278,7 +278,7 @@ METHOD(OverkillNex, wr_checkammo2, bool(entity thiswep, entity actor, .entity we
        if (WEP_CVAR(oknex, secondary))
        {
                // don't allow charging if we don't have enough ammo
-               float ammo_amount = GetResourceAmount(actor, thiswep.ammo_type) >= WEP_CVAR_SEC(oknex, ammo);
+               float ammo_amount = GetResource(actor, thiswep.ammo_type) >= WEP_CVAR_SEC(oknex, ammo);
                ammo_amount += actor.(weaponentity).(weapon_load[thiswep.m_id]) >= WEP_CVAR_SEC(oknex, ammo);
                return ammo_amount;
        }
index 05c9f14cd9d532ab65b50d1ddc200c20e231af7c..d599cf799de7564bd8b4cc1242eb68391cb61a17 100644 (file)
@@ -36,7 +36,7 @@ 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, RES_HEALTH) <= 0)
+       if (GetResource(this, RES_HEALTH) <= 0)
                return;
 
        if (!W_CheckProjectileDamage(inflictor.realowner, this.realowner, deathtype, -1)) // no exceptions
@@ -44,7 +44,7 @@ void W_OverkillRocketPropelledChainsaw_Damage(entity this, entity inflictor, ent
 
        TakeResource(this, RES_HEALTH, damage);
 
-       if (GetResourceAmount(this, RES_HEALTH) <= 0)
+       if (GetResource(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, RES_HEALTH, WEP_CVAR_PRI(okrpc, health));
+       SetResource(missile, RES_HEALTH, WEP_CVAR_PRI(okrpc, health));
        missile.event_damage = W_OverkillRocketPropelledChainsaw_Damage;
        missile.damagedbycontents = true;
        IL_PUSH(g_damagedbycontents, missile);
@@ -191,14 +191,14 @@ METHOD(OverkillRocketPropelledChainsaw, wr_think, void(entity thiswep, entity ac
 
 METHOD(OverkillRocketPropelledChainsaw, wr_checkammo1, bool(entity thiswep, entity actor, .entity weaponentity))
 {
-       float ammo_amount = GetResourceAmount(actor, thiswep.ammo_type) >= WEP_CVAR_PRI(okrpc, ammo);
+       float ammo_amount = GetResource(actor, thiswep.ammo_type) >= WEP_CVAR_PRI(okrpc, ammo);
        ammo_amount += actor.(weaponentity).(weapon_load[thiswep.m_id]) >= WEP_CVAR_PRI(okrpc, ammo);
        return ammo_amount;
 }
 
 METHOD(OverkillRocketPropelledChainsaw, wr_checkammo2, bool(entity thiswep, entity actor, .entity weaponentity))
 {
-       float ammo_amount = GetResourceAmount(actor, thiswep.ammo_type) >= WEP_CVAR_SEC(okrpc, ammo);
+       float ammo_amount = GetResource(actor, thiswep.ammo_type) >= WEP_CVAR_SEC(okrpc, ammo);
        ammo_amount += actor.(weaponentity).(weapon_load[thiswep.m_id]) >= WEP_CVAR_SEC(okrpc, ammo);
        return ammo_amount;
 }
index 2461ba0cb09dd1098019bd1929a08fccbf6accbb..784d1c37b770f47a4110b76cc03e990dacee4063 100644 (file)
@@ -73,7 +73,7 @@ METHOD(OverkillShotgun, wr_think, void(entity thiswep, entity actor, .entity wea
 
 METHOD(OverkillShotgun, wr_checkammo1, bool(entity thiswep, entity actor, .entity weaponentity))
 {
-       float ammo_amount = GetResourceAmount(actor, thiswep.ammo_type) >= WEP_CVAR_PRI(okshotgun, ammo);
+       float ammo_amount = GetResource(actor, thiswep.ammo_type) >= WEP_CVAR_PRI(okshotgun, ammo);
        ammo_amount += actor.(weaponentity).(weapon_load[WEP_OVERKILL_SHOTGUN.m_id]) >= WEP_CVAR_PRI(okshotgun, ammo);
        return ammo_amount;
 }
index 644206049a3bdcf4b31d4ceee1906b3eb72e2e11..b747ce74922b7c19de988bf88b07492532b31665 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, RES_HEALTH) < autocvar_g_balance_health_regenstable) continue;
+                       if (autocvar_g_spawn_near_teammate_ignore_spawnpoint_check_health && GetResource(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 b4181d10e29528ca806592421642afbaeb1fa072..57df1b02bf205ab9e8160c20c90998a77c393cc2 100644 (file)
@@ -14,7 +14,7 @@ MUTATOR_HOOKFUNCTION(vampire, PlayerDamage_SplitHealthArmor)
        if(!IS_DEAD(frag_target))
        {
                GiveResource(frag_attacker, RES_HEALTH,
-                       bound(0, damage_take, GetResourceAmount(frag_target, RES_HEALTH)));
+                       bound(0, damage_take, GetResource(frag_target, RES_HEALTH)));
        }
 }
 
index 83db6e3c0af7c5d5540407eae0f5881e8da214d0..76ae0caa88f478dac90ed2d8f60ea0f624870414 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, RES_HEALTH) > 0)
+       if(GetResource(thehook.aiment, RES_HEALTH) > 0)
        if(autocvar_g_vampirehook_damage)
        {
                thehook.last_dmg = time + autocvar_g_vampirehook_damagerate;
@@ -30,7 +30,7 @@ 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, RES_HEALTH, min(GetResourceAmount(targ, RES_HEALTH) + autocvar_g_vampirehook_health_steal, g_pickup_healthsmall_max));
+               SetResource(targ, RES_HEALTH, min(GetResource(targ, RES_HEALTH) + autocvar_g_vampirehook_health_steal, g_pickup_healthsmall_max));
 
                if(dmgent == thehook.owner)
                        TakeResource(dmgent, RES_HEALTH, autocvar_g_vampirehook_damage); // FIXME: friendly fire?!
index 8f21651f3919f26f1599311f931f97fc5c0555c9..cc8b61abed976d9c19e42b02a9cb44b9357199a1 100644 (file)
@@ -34,7 +34,7 @@ bool WaypointSprite_SendEntity(entity this, entity to, float sendflags)
     {
         if (this.max_health)
         {
-            WriteByte(MSG_ENTITY, (GetResourceAmount(this, RES_HEALTH) / this.max_health) * 191.0);
+            WriteByte(MSG_ENTITY, (GetResource(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, RES_HEALTH, t / 191.0);
+            SetResource(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, RES_HEALTH), 1);
+                this.build_starthealth = bound(0, GetResource(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, RES_HEALTH, -1);
+        SetResource(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, RES_HEALTH);
+    float health_val = GetResource(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, RES_HEALTH, this.build_starthealth);
+                SetResource(this, RES_HEALTH, this.build_starthealth);
             else if (time < this.build_finished)
-                SetResourceAmount(this, RES_HEALTH, (time - this.build_started) / (this.build_finished - this.build_started) * (1 - this.build_starthealth) + this.build_starthealth);
+                SetResource(this, RES_HEALTH, (time - this.build_started) / (this.build_finished - this.build_started) * (1 - this.build_starthealth) + this.build_starthealth);
             else
-                SetResourceAmount(this, RES_HEALTH, 1);
+                SetResource(this, RES_HEALTH, 1);
         }
         else
-            SetResourceAmount(this, RES_HEALTH, -1);
+            SetResource(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, RES_HEALTH) >= 0)
+    if (GetResource(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, RES_HEALTH),
+                GetResource(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, RES_HEALTH) / step)) || e.pain_finished)
+    if ((floor(f / step) != floor(GetResource(e, RES_HEALTH) / step)) || e.pain_finished)
     {
-        SetResourceAmount(e, RES_HEALTH, f);
+        SetResource(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, RES_HEALTH))
+    if (GetResource(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, RES_HEALTH), GetResourceAmount(carrier, RES_ARMOR), autocvar_g_balance_armor_blockpercent, DEATH_WEAPON.m_id).x);
+        WaypointSprite_UpdateHealth(e, healtharmor_maxdamage(GetResource(carrier, RES_HEALTH), GetResource(carrier, RES_ARMOR), autocvar_g_balance_armor_blockpercent, DEATH_WEAPON.m_id).x);
     }
     return e;
 }
index 7c8365cebc82b64060b89a795cc6141fdd19c3ce..2bea084b20ef5f2e07a6b55e13e3975d1ac04a01 100644 (file)
@@ -721,25 +721,25 @@ void GiveRandomWeapons(entity receiver, int num_weapons, string weapon_names,
                {
                        continue;
                }
-               if (GetResourceAmount(receiver,
+               if (GetResource(receiver,
                        RandomSelection_chosen_ent.ammo_type) != 0)
                {
                        continue;
                }
                GiveResource(receiver, RandomSelection_chosen_ent.ammo_type,
-                       GetResourceAmount(ammo_entity,
+                       GetResource(ammo_entity,
                        RandomSelection_chosen_ent.ammo_type));
        }
 }
 
 float Item_GiveAmmoTo(entity item, entity player, int res_type, float ammomax)
 {
-       float amount = GetResourceAmount(item, res_type);
+       float amount = GetResource(item, res_type);
        if (amount == 0)
        {
                return false;
        }
-       float player_amount = GetResourceAmount(player, res_type);
+       float player_amount = GetResource(player, res_type);
        if (item.spawnshieldtime)
        {
                if ((player_amount >= ammomax) && (item.pickup_anyway <= 0))
@@ -1075,12 +1075,12 @@ float ammo_pickupevalfunc(entity player, entity item)
        if(item.itemdef.instanceOfWeaponPickup)
        {
                entity ammo = NULL;
-               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(GetResource(item, RES_SHELLS))       { need_shells  = true; ammo = ITEM_Shells;      }
+               else if(GetResource(item, RES_BULLETS))   { need_nails   = true; ammo = ITEM_Bullets;     }
+               else if(GetResource(item, RES_ROCKETS)) { need_rockets = true; ammo = ITEM_Rockets;     }
+               else if(GetResource(item, RES_CELLS))   { need_cells   = true; ammo = ITEM_Cells;       }
+               else if(GetResource(item, RES_PLASMA))  { need_plasma  = true; ammo = ITEM_Plasma;      }
+               else if(GetResource(item, RES_FUEL))    { need_fuel    = true; ammo = ITEM_JetpackFuel; }
 
                if(!ammo)
                        return 0;
@@ -1108,23 +1108,23 @@ float ammo_pickupevalfunc(entity player, entity item)
 
        float noammorating = 0.5;
 
-       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_shells) && GetResource(item, RES_SHELLS) && (GetResource(player, RES_SHELLS) < g_pickup_shells_max))
+               c = GetResource(item, RES_SHELLS) / max(noammorating, GetResource(player, RES_SHELLS));
 
-       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_nails) && GetResource(item, RES_BULLETS) && (GetResource(player, RES_BULLETS) < g_pickup_nails_max))
+               c = GetResource(item, RES_BULLETS) / max(noammorating, GetResource(player, RES_BULLETS));
 
-       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_rockets) && GetResource(item, RES_ROCKETS) && (GetResource(player, RES_ROCKETS) < g_pickup_rockets_max))
+               c = GetResource(item, RES_ROCKETS) / max(noammorating, GetResource(player, RES_ROCKETS));
 
-       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_cells) && GetResource(item, RES_CELLS) && (GetResource(player, RES_CELLS) < g_pickup_cells_max))
+               c = GetResource(item, RES_CELLS) / max(noammorating, GetResource(player, RES_CELLS));
 
-       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_plasma) && GetResource(item, RES_PLASMA) && (GetResource(player, RES_PLASMA) < g_pickup_plasma_max))
+               c = GetResource(item, RES_PLASMA) / max(noammorating, GetResource(player, RES_PLASMA));
 
-       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));
+       if ((need_fuel) && GetResource(item, RES_FUEL) && (GetResource(player, RES_FUEL) < g_pickup_fuel_max))
+               c = GetResource(item, RES_FUEL) / max(noammorating, GetResource(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, RES_ARMOR);
-       float itemhealth = GetResourceAmount(item, RES_HEALTH);
+       float itemarmor = GetResource(item, RES_ARMOR);
+       float itemhealth = GetResource(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, RES_ARMOR) < item.max_armorvalue))
-               c = itemarmor / max(1, GetResourceAmount(player, RES_ARMOR) * 2/3 + GetResourceAmount(player, RES_HEALTH) * 1/3);
+       if (itemarmor && (GetResource(player, RES_ARMOR) < item.max_armorvalue))
+               c = itemarmor / max(1, GetResource(player, RES_ARMOR) * 2/3 + GetResource(player, RES_HEALTH) * 1/3);
 
-       if (itemhealth && (GetResourceAmount(player, RES_HEALTH) < item.max_health))
-               c = itemhealth / max(1, GetResourceAmount(player, RES_HEALTH));
+       if (itemhealth && (GetResource(player, RES_HEALTH) < item.max_health))
+               c = itemhealth / max(1, GetResource(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, RES_ARMOR) || GetResourceAmount(this, RES_HEALTH))
+               if(GetResource(this, RES_ARMOR) || GetResource(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, 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");
+               if(GetResource(this, RES_SHELLS) != 0) this.netname = sprintf("%s %s%d %s", this.netname, valueprefix, max(0, GetResource(this, RES_SHELLS)), "shells");
+               if(GetResource(this, RES_BULLETS) != 0) this.netname = sprintf("%s %s%d %s", this.netname, valueprefix, max(0, GetResource(this, RES_BULLETS)), "nails");
+               if(GetResource(this, RES_ROCKETS) != 0) this.netname = sprintf("%s %s%d %s", this.netname, valueprefix, max(0, GetResource(this, RES_ROCKETS)), "rockets");
+               if(GetResource(this, RES_CELLS) != 0) this.netname = sprintf("%s %s%d %s", this.netname, valueprefix, max(0, GetResource(this, RES_CELLS)), "cells");
+               if(GetResource(this, RES_PLASMA) != 0) this.netname = sprintf("%s %s%d %s", this.netname, valueprefix, max(0, GetResource(this, RES_PLASMA)), "plasma");
+               if(GetResource(this, RES_FUEL) != 0) this.netname = sprintf("%s %s%d %s", this.netname, valueprefix, max(0, GetResource(this, RES_FUEL)), "fuel");
+               if(GetResource(this, RES_HEALTH) != 0) this.netname = sprintf("%s %s%d %s", this.netname, valueprefix, max(0, GetResource(this, RES_HEALTH)), "health");
+               if(GetResource(this, RES_ARMOR) != 0) this.netname = sprintf("%s %s%d %s", this.netname, valueprefix, max(0, GetResource(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));
        }
@@ -1668,17 +1668,17 @@ void GiveRot(entity e, float v0, float v1, .float rotfield, float rottime, .floa
 }
 bool GiveResourceValue(entity e, int res_type, int op, int val)
 {
-       int v0 = GetResourceAmount(e, res_type);
+       int v0 = GetResource(e, res_type);
        switch (op)
        {
                // 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;
+               case OP_SET: SetResource(e, res_type, val); break;
+               case OP_MIN: SetResource(e, res_type, max(v0, val)); break;
+               case OP_MAX: SetResource(e, res_type, min(v0, val)); break;
+               case OP_PLUS: SetResource(e, res_type, v0 + val); break;
+               case OP_MINUS: SetResource(e, res_type, v0 - val); break;
        }
-       int v1 = GetResourceAmount(e, res_type);
+       int v1 = GetResource(e, res_type);
        return v0 != v1;
 }
 
index 0cd0d58ca2c3f473b0eeb9495e838ce4ca3aad01..f03d3d48702ca166a2eb25377cf0252b48eb3ee4 100644 (file)
@@ -128,11 +128,11 @@ spawnfunc(target_items);
 
 #define PREGIVE_WEAPONS(e) WepSet save_weapons; save_weapons = STAT(WEAPONS, e)
 #define PREGIVE(e,f) float save_##f; save_##f = (e).f
-#define PREGIVE_RESOURCE(e,f) float save_##f = GetResourceAmount((e), (f))
+#define PREGIVE_RESOURCE(e,f) float save_##f = GetResource((e), (f))
 #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_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_RESOURCE(e,f,t,snd_incr,snd_decr) GiveSound((e), save_##f, GetResource((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,GetResource((e),(f)),rotfield,rottime,regenfield,regentime);GiveSound((e),save_##f,GetResource((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 194cd31d939493492f9e713881ccdf222dcc475f..fd37564a881eead341452a6d2c8646afc15a160a 100644 (file)
@@ -37,7 +37,7 @@ void turret_draw(entity this)
 
        this.tur_head.angles += dt * this.tur_head.avelocity;
 
-       if (GetResourceAmount(this, RES_HEALTH) < 127)
+       if (GetResource(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, RES_HEALTH) < 85)
+       if(GetResource(this, RES_HEALTH) < 85)
        if(dt < 0.01)
                pointparticles(EFFECT_SMOKE_LARGE, (this.origin + (randomvec() * 80)), '0 0 0', 1);
 
-       if(GetResourceAmount(this, RES_HEALTH) < 32)
+       if(GetResource(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, RES_HEALTH) / 255,
+                       GetResource(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, RES_HEALTH, 255);
+       SetResource(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, RES_HEALTH);
+               float myhp = GetResource(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, RES_HEALTH, _tmp);
+               SetResource(this, RES_HEALTH, _tmp);
        }
        return true;
 }
index d853564b65d70dde4d19ddf10a0fc68e67fd2629..26918c9aad169be9c455fd84506c12baf160167a 100644 (file)
@@ -185,7 +185,7 @@ void turret_die(entity this)
        this.event_heal = func_null;
        this.takedamage                  = DAMAGE_NO;
 
-       SetResourceAmount(this, RES_HEALTH, 0);
+       SetResource(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);
@@ -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, RES_HEALTH) <= 0)
+       if (GetResource(this, RES_HEALTH) <= 0)
        {
                this.event_damage                 = func_null;
                this.tur_head.event_damage = func_null;
@@ -262,7 +262,7 @@ 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 != RES_LIMIT_NONE) ? limit : targ.max_health);
-       if(GetResourceAmount(targ, RES_HEALTH) <= 0 || GetResourceAmount(targ, RES_HEALTH) >= true_limit)
+       if(GetResource(targ, RES_HEALTH) <= 0 || GetResource(targ, RES_HEALTH) >= true_limit)
                return false;
 
        GiveResourceWithLimit(targ, RES_HEALTH, amount, true_limit);
@@ -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, RES_HEALTH, this.max_health);
+       SetResource(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, RES_HEALTH) <= 0)
+               if(GetResource(this, RES_HEALTH) <= 0)
                        WriteByte(MSG_ENTITY, 0);
                else
-                       WriteByte(MSG_ENTITY, ceil((GetResourceAmount(this, RES_HEALTH) / this.max_health) * 255));
+                       WriteByte(MSG_ENTITY, ceil((GetResource(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, RES_HEALTH, cvar(strcat(sbase,"_health")) * ent.turret_scale_health);
+       SetResource(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;
@@ -468,7 +468,7 @@ void turret_projectile_damage(entity this, entity inflictor, entity attacker, fl
        this.velocity  += vforce;
        TakeResource(this, RES_HEALTH, damage);
        //this.realowner = attacker; // Dont change realowner, it does not make much sense for turrets
-       if(GetResourceAmount(this, RES_HEALTH) <= 0)
+       if(GetResource(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, RES_HEALTH, _health);
+               SetResource(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, RES_HEALTH) <= 0)
+       if (GetResource(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, RES_HEALTH)) { SetResourceAmount(this, RES_HEALTH, 1000); }
+       if(!GetResource(this, RES_HEALTH)) { SetResource(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, RES_HEALTH);
+       this.max_health                         = GetResource(this, RES_HEALTH);
        this.target_validate_flags      = this.target_select_flags;
        this.ammo                                       = this.ammo_max;
        this.ammo_recharge                 *= this.ticrate;
index 288ba29366c841186402828cf81de56c7f09d531..90463697dbf9835e394f36ff343694216f8a852f 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, RES_HEALTH) < 127)
+    if(GetResource(this, RES_HEALTH) < 127)
     if(random() < 0.05)
         te_spark(this.origin + '0 0 40', randomvec() * 256 + '0 0 256', 16);
 }
index aef5225f1e053ac4e1df8a634c862175947cf41f..deb508bca297868af8455112045ee3fb9fd47aa3 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, RES_HEALTH) < 0))
+    if ((targ.takedamage == DAMAGE_NO) || (GetResource(targ, RES_HEALTH) < 0))
         return false;
 
     // player
index f0da6cf136905645f4609addef67f76370a23fe3..89eaa994b51319afbc878540ae68fa78b7898a83 100644 (file)
@@ -89,7 +89,7 @@ void walker_rocket_damage(entity this, entity inflictor, entity attacker, float
     TakeResource(this, RES_HEALTH, damage);
     this.velocity = this.velocity + vforce;
 
-    if (GetResourceAmount(this, RES_HEALTH) <= 0)
+    if (GetResource(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, RES_HEALTH, 25);
+    SetResource(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, RES_HEALTH) < 127)
+    if(GetResource(this, RES_HEALTH) < 127)
     if(random() < 0.15)
         te_spark(this.origin + '0 0 40', randomvec() * 256 + '0 0 256', 16);
 }
index f4c749d70892363a85f8fd28ad3ca387220dea92..52b70a43055ac40941ae73424fd6be3c2b79a2b8 100644 (file)
@@ -207,7 +207,7 @@ void vehicles_projectile_damage(entity this, entity inflictor, entity attacker,
 
        TakeResource(this, RES_HEALTH, damage);
        this.velocity += force;
-       if(GetResourceAmount(this, RES_HEALTH) < 1)
+       if(GetResource(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, RES_HEALTH, _health);
+               SetResource(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, RES_HEALTH) / this.max_health);
+                       regen = regen * (GetResource(this, RES_HEALTH) / this.max_health);
 
                this.(regen_field) = min(this.(regen_field) + regen * delta_time, field_max);
 
@@ -598,7 +598,7 @@ void vehicles_regen(entity this, float timer, .float regen_field, float field_ma
 
 void vehicles_regen_resource(entity this, float timer, .float regen_field, float field_max, float rpause, float regen, float delta_time, float _healthscale, int resource)
 {
-       float resource_amount = GetResourceAmount(this, resource);
+       float resource_amount = GetResource(this, resource);
 
        if(resource_amount < field_max)
        if(timer + rpause < time)
@@ -606,10 +606,10 @@ void vehicles_regen_resource(entity this, float timer, .float regen_field, float
                if(_healthscale)
                        regen = regen * (resource_amount / this.max_health);
 
-               SetResourceAmount(this, resource, min(resource_amount + regen * delta_time, field_max));
+               SetResource(this, resource, min(resource_amount + regen * delta_time, field_max));
 
                if(this.owner)
-                       this.owner.(regen_field) = (GetResourceAmount(this, resource) / field_max) * 100;
+                       this.owner.(regen_field) = (GetResource(this, resource) / field_max) * 100;
        }
 }
 
@@ -630,7 +630,7 @@ void shieldhit_think(entity this)
 
 void vehicles_painframe(entity this)
 {
-       int myhealth = ((this.owner) ? this.owner.vehicle_health : ((GetResourceAmount(this, RES_HEALTH) / this.max_health) * 100));
+       int myhealth = ((this.owner) ? this.owner.vehicle_health : ((GetResource(this, RES_HEALTH) / this.max_health) * 100));
 
        if(myhealth <= 50)
        if(this.pain_frame < time)
@@ -729,7 +729,7 @@ void vehicles_damage(entity this, entity inflictor, entity attacker, float damag
        else
                this.velocity += force;
 
-       if(GetResourceAmount(this, RES_HEALTH) <= 0)
+       if(GetResource(this, RES_HEALTH) <= 0)
        {
                if(this.owner)
                {
@@ -750,12 +750,12 @@ 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 != RES_LIMIT_NONE) ? limit : targ.max_health);
-       if(GetResourceAmount(targ, RES_HEALTH) <= 0 || GetResourceAmount(targ, RES_HEALTH) >= true_limit)
+       if(GetResource(targ, RES_HEALTH) <= 0 || GetResource(targ, RES_HEALTH) >= true_limit)
                return false;
 
        GiveResourceWithLimit(targ, RES_HEALTH, amount, true_limit);
        if(targ.owner)
-               targ.owner.vehicle_health = (GetResourceAmount(targ, RES_HEALTH) / targ.max_health) * 100;
+               targ.owner.vehicle_health = (GetResource(targ, RES_HEALTH) / targ.max_health) * 100;
        return true;
 }
 
index 6c2074f4a7d901aaa97a16513d38916a385e623a..9870814d30e4e3287c39adf4f8fd3938b9b2bd6f 100644 (file)
@@ -100,7 +100,7 @@ float vehicles_exit_running;
        ply.vehicle_##fld = (vehi.vehicle_##fld / autocvar_g_vehicle_##vhname##_##fld) * 100
 
 #define VEHICLE_UPDATE_PLAYER_RESOURCE(ply,vehi,fld,vhname,res) \
-       ply.vehicle_##fld = (GetResourceAmount(vehi, res) / autocvar_g_vehicle_##vhname##_##fld) * 100
+       ply.vehicle_##fld = (GetResource(vehi, res) / autocvar_g_vehicle_##vhname##_##fld) * 100
 
 .float vehicle_enter_delay; // prevent players jumping to and from vehicles instantly
 
index 55574eb8299a80d0167c69ce07052f89e933f0d0..1dadc70a6e50b1f42b80de58fa10f0b9b828e462 100644 (file)
@@ -563,12 +563,12 @@ bool bumblebee_pilot_frame(entity this, float dt)
 
                                                if(IS_VEHICLE(trace_ent))
                                                {
-                                                       if(autocvar_g_vehicle_bumblebee_healgun_sps && GetResourceAmount(trace_ent, RES_HEALTH) <= trace_ent.max_health)
+                                                       if(autocvar_g_vehicle_bumblebee_healgun_sps && GetResource(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, RES_ARMOR) <= autocvar_g_vehicle_bumblebee_healgun_amax && autocvar_g_vehicle_bumblebee_healgun_aps)
+                                                       if(GetResource(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);
                                                }
                                        }
@@ -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, RES_HEALTH, 0);
+    SetResource(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, RES_HEALTH, autocvar_g_vehicle_bumblebee_health);
+    SetResource(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, RES_HEALTH, autocvar_g_vehicle_bumblebee_health);
-    instance.max_health = GetResourceAmount(instance, RES_HEALTH);
+    SetResource(instance, RES_HEALTH, autocvar_g_vehicle_bumblebee_health);
+    instance.max_health = GetResource(instance, RES_HEALTH);
     instance.vehicle_shield = autocvar_g_vehicle_bumblebee_shield;
 }
 
index 7428e07a13be680a2f92fdfef613b5414119ce0a..9b8c34bb58a549252f0be998ca7c8c96f3e85be2 100644 (file)
@@ -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, RES_HEALTH) / autocvar_g_vehicle_racer_health)  * 100;
+    instance.owner.vehicle_health = (GetResource(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, RES_HEALTH, autocvar_g_vehicle_racer_health);
+    SetResource(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, RES_HEALTH, autocvar_g_vehicle_racer_health);
+    SetResource(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, RES_HEALTH, 0);
+    SetResource(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, RES_HEALTH, autocvar_g_vehicle_racer_health);
+    SetResource(instance, RES_HEALTH, autocvar_g_vehicle_racer_health);
     instance.vehicle_shield = autocvar_g_vehicle_racer_shield;
-    instance.max_health = GetResourceAmount(instance, RES_HEALTH);
+    instance.max_health = GetResource(instance, RES_HEALTH);
 #endif
 
 #ifdef CSQC
index ad8440a5eb74f7ea3fd3aa42a044a224c7a29dfe..3fdd86f25e4c3578c280007d4bf5d536399baae0 100644 (file)
@@ -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, RES_HEALTH) / autocvar_g_vehicle_raptor_health) * 100;
+    instance.owner.vehicle_health = (GetResource(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, RES_HEALTH, 0);
+       SetResource(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, RES_HEALTH, autocvar_g_vehicle_raptor_health);
+    SetResource(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, RES_HEALTH, autocvar_g_vehicle_raptor_health);
+    SetResource(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, RES_HEALTH, autocvar_g_vehicle_raptor_health);
+    SetResource(instance, RES_HEALTH, autocvar_g_vehicle_raptor_health);
     instance.vehicle_shield = autocvar_g_vehicle_raptor_shield;
-    instance.max_health = GetResourceAmount(instance, RES_HEALTH);
+    instance.max_health = GetResource(instance, RES_HEALTH);
 
     if(!autocvar_g_vehicle_raptor_swim)
        instance.dphitcontentsmask |= DPCONTENTS_LIQUIDSMASK;
index ee4ea01030b968f3a0fcac61dfc8a1be423ec025..9d716aae2a4c12f7510fcb6dcc763802e98bf295 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, RES_HEALTH, 20);
+            SetResource(_flare, RES_HEALTH, 20);
             _flare.tur_impacttime = time + autocvar_g_vehicle_raptor_flare_lifetime;
             settouch(_flare, raptor_flare_touch);
         }
@@ -192,7 +192,7 @@ 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, RES_HEALTH, damage);
-    if(GetResourceAmount(this, RES_HEALTH) <= 0)
+    if(GetResource(this, RES_HEALTH) <= 0)
         delete(this);
 }
 
index 4277b3f786faff016d46923bb31f51b44d321919..c65c057e8a82c6709e10f6d21eb632de0d570285 100644 (file)
@@ -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, RES_HEALTH) / autocvar_g_vehicle_spiderbot_health) * 100;
+    instance.owner.vehicle_health = (GetResource(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, RES_HEALTH, 0);
+       SetResource(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, RES_HEALTH, autocvar_g_vehicle_spiderbot_health);
+    SetResource(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, RES_HEALTH, autocvar_g_vehicle_spiderbot_health);
+    SetResource(instance, RES_HEALTH, autocvar_g_vehicle_spiderbot_health);
     instance.vehicle_shield = autocvar_g_vehicle_spiderbot_shield;
-    instance.max_health = GetResourceAmount(instance, RES_HEALTH);
+    instance.max_health = GetResource(instance, RES_HEALTH);
     instance.pushable = true; // spiderbot can use jumppads
 }
 
index dd01444ef9efb67a80964a67dbb386c00f497082..0c31aefb9a0d5a49749e71b1e21142da88f18266 100644 (file)
@@ -104,7 +104,7 @@ 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, RES_HEALTH) <= 0)
+       if(GetResource(this, RES_HEALTH) <= 0)
                return;
 
        if(!W_CheckProjectileDamage(inflictor.realowner, this.realowner, deathtype, -1))
@@ -113,7 +113,7 @@ void W_Arc_Bolt_Damage(entity this, entity inflictor, entity attacker, float dam
        TakeResource(this, RES_HEALTH, damage);
        this.angles = vectoangles(this.velocity);
 
-       if(GetResourceAmount(this, RES_HEALTH) <= 0)
+       if(GetResource(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, RES_HEALTH, WEP_CVAR(arc, bolt_health));
+       SetResource(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;
@@ -254,8 +254,8 @@ void W_Arc_Beam_Think(entity this)
 
                if(rootammo)
                {
-                       coefficient = min(coefficient, GetResourceAmount(own, thiswep.ammo_type) / rootammo);
-                       SetResourceAmount(own, thiswep.ammo_type, max(0, GetResourceAmount(own, thiswep.ammo_type) - (rootammo * frametime)));
+                       coefficient = min(coefficient, GetResource(own, thiswep.ammo_type) / rootammo);
+                       SetResource(own, thiswep.ammo_type, max(0, GetResource(own, thiswep.ammo_type) - (rootammo * frametime)));
                }
        }
        float heat_speed = burst ? WEP_CVAR(arc, burst_heat) : WEP_CVAR(arc, beam_heat);
@@ -432,7 +432,7 @@ void W_Arc_Beam_Think(entity this)
                                Heal(trace_ent, own, (roothealth * coefficient), hplimit);
                                if(IS_PLAYER(trace_ent) && rootarmor)
                                {
-                                       if(GetResourceAmount(trace_ent, RES_ARMOR) <= WEP_CVAR(arc, beam_healing_amax))
+                                       if(GetResource(trace_ent, RES_ARMOR) <= WEP_CVAR(arc, beam_healing_amax))
                                        {
                                                GiveResourceWithLimit(trace_ent, RES_ARMOR, (rootarmor * coefficient), WEP_CVAR(arc, beam_healing_amax));
                                                trace_ent.pauserotarmor_finished = max(
@@ -695,19 +695,19 @@ METHOD(Arc, wr_init, void(entity thiswep))
 }
 METHOD(Arc, wr_checkammo1, bool(entity thiswep, entity actor, .entity weaponentity))
 {
-    return ((!WEP_CVAR(arc, beam_ammo)) || (GetResourceAmount(actor, thiswep.ammo_type) > 0));
+    return ((!WEP_CVAR(arc, beam_ammo)) || (GetResource(actor, thiswep.ammo_type) > 0));
 }
 METHOD(Arc, wr_checkammo2, bool(entity thiswep, entity actor, .entity weaponentity))
 {
     if(WEP_CVAR(arc, bolt))
     {
-        float ammo_amount = GetResourceAmount(actor, thiswep.ammo_type) >= WEP_CVAR(arc, bolt_ammo);
+        float ammo_amount = GetResource(actor, thiswep.ammo_type) >= WEP_CVAR(arc, bolt_ammo);
         ammo_amount += actor.(weaponentity).(weapon_load[WEP_ARC.m_id]) >= WEP_CVAR(arc, bolt_ammo);
         return ammo_amount;
     }
     else
         return WEP_CVAR(arc, overheat_max) > 0 &&
-            ((!WEP_CVAR(arc, burst_ammo)) || (GetResourceAmount(actor, thiswep.ammo_type) > 0));
+            ((!WEP_CVAR(arc, burst_ammo)) || (GetResource(actor, thiswep.ammo_type) > 0));
 }
 METHOD(Arc, wr_killmessage, Notification(entity thiswep))
 {
index 064668ca6cafa443c2260cf00c11d8e9ce51c643..3589146352e18d6fe74b3616147cc6233b3d7958 100644 (file)
@@ -583,7 +583,7 @@ METHOD(Crylink, wr_checkammo1, bool(entity thiswep, entity actor, .entity weapon
     if(actor.(weaponentity).crylink_lastgroup && actor.(weaponentity).crylink_waitrelease)
         return true;
 
-    float ammo_amount = GetResourceAmount(actor, thiswep.ammo_type) >= WEP_CVAR_PRI(crylink, ammo);
+    float ammo_amount = GetResource(actor, thiswep.ammo_type) >= WEP_CVAR_PRI(crylink, ammo);
     ammo_amount += actor.(weaponentity).(weapon_load[thiswep.m_id]) >= WEP_CVAR_PRI(crylink, ammo);
     return ammo_amount;
 }
@@ -593,7 +593,7 @@ METHOD(Crylink, wr_checkammo2, bool(entity thiswep, entity actor, .entity weapon
     if(actor.(weaponentity).crylink_lastgroup && actor.(weaponentity).crylink_waitrelease)
         return true;
 
-    float ammo_amount = GetResourceAmount(actor, thiswep.ammo_type) >= WEP_CVAR_SEC(crylink, ammo);
+    float ammo_amount = GetResource(actor, thiswep.ammo_type) >= WEP_CVAR_SEC(crylink, ammo);
     ammo_amount += actor.(weaponentity).(weapon_load[thiswep.m_id]) >= WEP_CVAR_SEC(crylink, ammo);
     return ammo_amount;
 }
index 292f2d5d8852a58866c0170a3da473e080f465e7..1569ba59cefea82d3ecb51aee9997ced564822ed 100644 (file)
@@ -46,7 +46,7 @@ void W_Devastator_Explode(entity this, entity directhitentity)
        .entity weaponentity = this.weaponentity_fld;
        if(this.realowner.(weaponentity).m_weapon == thiswep)
        {
-               if(GetResourceAmount(this.realowner, thiswep.ammo_type) < WEP_CVAR(devastator, ammo))
+               if(GetResource(this.realowner, thiswep.ammo_type) < WEP_CVAR(devastator, ammo))
                if(!(this.realowner.items & IT_UNLIMITED_WEAPON_AMMO))
                {
                        this.realowner.cnt = thiswep.m_id;
@@ -139,7 +139,7 @@ void W_Devastator_DoRemoteExplode(entity this, .entity weaponentity)
        Weapon thiswep = WEP_DEVASTATOR;
        if(this.realowner.(weaponentity).m_weapon == thiswep)
        {
-               if(GetResourceAmount(this.realowner, thiswep.ammo_type) < WEP_CVAR(devastator, ammo))
+               if(GetResource(this.realowner, thiswep.ammo_type) < WEP_CVAR(devastator, ammo))
                if(!(this.realowner.items & IT_UNLIMITED_WEAPON_AMMO))
                {
                        this.realowner.cnt = thiswep.m_id;
@@ -287,7 +287,7 @@ 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, RES_HEALTH) <= 0)
+       if(GetResource(this, RES_HEALTH) <= 0)
                return;
 
        if(!W_CheckProjectileDamage(inflictor.realowner, this.realowner, deathtype, -1)) // no exceptions
@@ -296,7 +296,7 @@ void W_Devastator_Damage(entity this, entity inflictor, entity attacker, float d
        TakeResource(this, RES_HEALTH, damage);
        this.angles = vectoangles(this.velocity);
 
-       if(GetResourceAmount(this, RES_HEALTH) <= 0)
+       if(GetResource(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, RES_HEALTH, WEP_CVAR(devastator, health));
+       SetResource(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, RES_HEALTH)))
+        if((skill > 6.5) && (selfdamage > GetResource(actor, RES_HEALTH)))
             PHYS_INPUT_BUTTON_ATCK2(actor) = false;
         //if(PHYS_INPUT_BUTTON_ATCK2(actor) == true)
         //     dprint(ftos(desirabledamage),"\n");
@@ -491,10 +491,10 @@ METHOD(Devastator, wr_checkammo1, bool(entity thiswep, entity actor, .entity wea
         ammo_amount = false;
         if(WEP_CVAR(devastator, reload_ammo))
         {
-            if(GetResourceAmount(actor, thiswep.ammo_type) < WEP_CVAR(devastator, ammo) && actor.(weaponentity).(weapon_load[WEP_DEVASTATOR.m_id]) < WEP_CVAR(devastator, ammo))
+            if(GetResource(actor, thiswep.ammo_type) < WEP_CVAR(devastator, ammo) && actor.(weaponentity).(weapon_load[WEP_DEVASTATOR.m_id]) < WEP_CVAR(devastator, ammo))
                 ammo_amount = true;
         }
-        else if(GetResourceAmount(actor, thiswep.ammo_type) < WEP_CVAR(devastator, ammo))
+        else if(GetResource(actor, thiswep.ammo_type) < WEP_CVAR(devastator, ammo))
             ammo_amount = true;
         return !ammo_amount;
     }
@@ -502,18 +502,18 @@ METHOD(Devastator, wr_checkammo1, bool(entity thiswep, entity actor, .entity wea
     #if 0
     if(actor.rl_release == 0)
     {
-        LOG_INFOF("W_Devastator(WR_CHECKAMMO1): %d, %.2f, %d: TRUE", actor.rl_release, GetResourceAmount(actor, thiswep.ammo_type), WEP_CVAR(devastator, ammo));
+        LOG_INFOF("W_Devastator(WR_CHECKAMMO1): %d, %.2f, %d: TRUE", actor.rl_release, GetResource(actor, thiswep.ammo_type), WEP_CVAR(devastator, ammo));
         return true;
     }
     else
     {
-        ammo_amount = GetResourceAmount(actor, thiswep.ammo_type) >= WEP_CVAR(devastator, ammo);
+        ammo_amount = GetResource(actor, thiswep.ammo_type) >= WEP_CVAR(devastator, ammo);
         ammo_amount += actor.(weaponentity).(weapon_load[WEP_DEVASTATOR.m_id]) >= WEP_CVAR(devastator, ammo);
-        LOG_INFOF("W_Devastator(WR_CHECKAMMO1): %d, %.2f, %d: %s", actor.rl_release, GetResourceAmount(actor, thiswep.ammo_type), WEP_CVAR(devastator, ammo), (ammo_amount ? "TRUE" : "FALSE"));
+        LOG_INFOF("W_Devastator(WR_CHECKAMMO1): %d, %.2f, %d: %s", actor.rl_release, GetResource(actor, thiswep.ammo_type), WEP_CVAR(devastator, ammo), (ammo_amount ? "TRUE" : "FALSE"));
         return ammo_amount;
     }
     #else
-    float ammo_amount = GetResourceAmount(actor, thiswep.ammo_type) >= WEP_CVAR(devastator, ammo);
+    float ammo_amount = GetResource(actor, thiswep.ammo_type) >= WEP_CVAR(devastator, ammo);
     ammo_amount += actor.(weaponentity).(weapon_load[thiswep.m_id]) >= WEP_CVAR(devastator, ammo);
     return ammo_amount;
     #endif
index 134002426ce22e97f03e3e0d6215ae80f854b2f7..3d9b9fa6e2668ecc9c25ae4ee97359c14266ccb9 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, RES_HEALTH, GetResourceAmount(this, RES_HEALTH));
+       SetResource(newproj, RES_HEALTH, GetResource(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, RES_HEALTH) <= 0)
+       if(GetResource(this, RES_HEALTH) <= 0)
                return;
 
        // note: combos are usually triggered by W_Electro_TriggerCombo, not damage
@@ -310,7 +310,7 @@ void W_Electro_Orb_Damage(entity this, entity inflictor, entity attacker, float
                return; // g_projectiles_damage says to halt
 
        TakeResource(this, RES_HEALTH, damage);
-       if(GetResourceAmount(this, RES_HEALTH) <= 0)
+       if(GetResource(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, RES_HEALTH, WEP_CVAR_SEC(electro, health));
+       SetResource(proj, RES_HEALTH, WEP_CVAR_SEC(electro, health));
        proj.event_damage = W_Electro_Orb_Damage;
        proj.flags = FL_PROJECTILE;
        IL_PUSH(g_projectiles, proj);
@@ -483,7 +483,7 @@ METHOD(Electro, wr_think, void(entity thiswep, entity actor, .entity weaponentit
 }
 METHOD(Electro, wr_checkammo1, bool(entity thiswep, entity actor, .entity weaponentity))
 {
-    float ammo_amount = GetResourceAmount(actor, thiswep.ammo_type) >= WEP_CVAR_PRI(electro, ammo);
+    float ammo_amount = GetResource(actor, thiswep.ammo_type) >= WEP_CVAR_PRI(electro, ammo);
     ammo_amount += actor.(weaponentity).(weapon_load[thiswep.m_id]) >= WEP_CVAR_PRI(electro, ammo);
     return ammo_amount;
 }
@@ -492,12 +492,12 @@ METHOD(Electro, wr_checkammo2, bool(entity thiswep, entity actor, .entity weapon
     float ammo_amount;
     if(WEP_CVAR(electro, combo_safeammocheck)) // true if you can fire at least one secondary blob AND one primary shot after it, otherwise false.
     {
-        ammo_amount = GetResourceAmount(actor, thiswep.ammo_type) >= WEP_CVAR_SEC(electro, ammo) + WEP_CVAR_PRI(electro, ammo);
+        ammo_amount = GetResource(actor, thiswep.ammo_type) >= WEP_CVAR_SEC(electro, ammo) + WEP_CVAR_PRI(electro, ammo);
         ammo_amount += actor.(weaponentity).(weapon_load[thiswep.m_id]) >= WEP_CVAR_SEC(electro, ammo) + WEP_CVAR_PRI(electro, ammo);
     }
     else
     {
-        ammo_amount = GetResourceAmount(actor, thiswep.ammo_type) >= WEP_CVAR_SEC(electro, ammo);
+        ammo_amount = GetResource(actor, thiswep.ammo_type) >= WEP_CVAR_SEC(electro, ammo);
         ammo_amount += actor.(weaponentity).(weapon_load[thiswep.m_id]) >= WEP_CVAR_SEC(electro, ammo);
     }
     return ammo_amount;
index 94fa451eec42367479adb881544ca22cccfadaa0..05d8b1ee394f831f68f1754bdcf2a0e38ec06676 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, RES_HEALTH) + GetResourceAmount(this.realowner, RES_ARMOR));
+       d = (GetResource(this.realowner, RES_HEALTH) + GetResource(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, RES_HEALTH) + GetResourceAmount(this.realowner, RES_ARMOR) >= d)
+       if(GetResource(this.realowner, RES_HEALTH) + GetResource(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, RES_HEALTH) <= 0)
+       if(GetResource(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, RES_HEALTH, damage);
-       if(GetResourceAmount(this, RES_HEALTH) <= 0)
+       if(GetResource(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, RES_HEALTH, WEP_CVAR_PRI(fireball, health));
+       SetResource(proj, RES_HEALTH, WEP_CVAR_PRI(fireball, health));
        proj.team = actor.team;
        proj.event_damage = W_Fireball_Damage;
        proj.takedamage = DAMAGE_YES;
index d342a5cf5fe0bb5e0f0b3ae8468d3dee63a70381..dc9f7f0f9689f0052d022bf3c3de75bfeee21300 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, RES_HEALTH) <= 0)
+       if(GetResource(this, RES_HEALTH) <= 0)
                return;
 
        float is_linkexplode = ( ((inflictor.owner != NULL) ? (inflictor.owner == this.owner) : true)
@@ -50,7 +50,7 @@ void W_Hagar_Damage(entity this, entity inflictor, entity attacker, float damage
        TakeResource(this, RES_HEALTH, damage);
        this.angles = vectoangles(this.velocity);
 
-       if(GetResourceAmount(this, RES_HEALTH) <= 0)
+       if(GetResource(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, RES_HEALTH, WEP_CVAR_PRI(hagar, health));
+       SetResource(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, RES_HEALTH, WEP_CVAR_SEC(hagar, health));
+       SetResource(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, RES_HEALTH, WEP_CVAR_SEC(hagar, health));
+               SetResource(missile, RES_HEALTH, WEP_CVAR_SEC(hagar, health));
                missile.damageforcescale = WEP_CVAR_SEC(hagar, damageforcescale);
                missile.event_damage = W_Hagar_Damage;
                missile.damagedbycontents = true;
@@ -269,7 +269,7 @@ void W_Hagar_Attack2_Load(Weapon thiswep, entity actor, .entity weaponentity)
        else if(autocvar_g_balance_hagar_reload_ammo)
                enough_ammo = actor.(weaponentity).(weapon_load[thiswep.m_id]) >= WEP_CVAR_SEC(hagar, ammo);
        else
-               enough_ammo = GetResourceAmount(actor, thiswep.ammo_type) >= WEP_CVAR_SEC(hagar, ammo);
+               enough_ammo = GetResource(actor, thiswep.ammo_type) >= WEP_CVAR_SEC(hagar, ammo);
 
        bool stopped = loaded || !enough_ammo;
 
@@ -435,13 +435,13 @@ METHOD(Hagar, wr_setup, void(entity thiswep, entity actor, .entity weaponentity)
 }
 METHOD(Hagar, wr_checkammo1, bool(entity thiswep, entity actor, .entity weaponentity))
 {
-    float ammo_amount = GetResourceAmount(actor, thiswep.ammo_type) >= WEP_CVAR_PRI(hagar, ammo);
+    float ammo_amount = GetResource(actor, thiswep.ammo_type) >= WEP_CVAR_PRI(hagar, ammo);
     ammo_amount += actor.(weaponentity).(weapon_load[thiswep.m_id]) >= WEP_CVAR_PRI(hagar, ammo);
     return ammo_amount;
 }
 METHOD(Hagar, wr_checkammo2, bool(entity thiswep, entity actor, .entity weaponentity))
 {
-    float ammo_amount = GetResourceAmount(actor, thiswep.ammo_type) >= WEP_CVAR_SEC(hagar, ammo);
+    float ammo_amount = GetResource(actor, thiswep.ammo_type) >= WEP_CVAR_SEC(hagar, ammo);
     ammo_amount += actor.(weaponentity).(weapon_load[thiswep.m_id]) >= WEP_CVAR_SEC(hagar, ammo);
     return ammo_amount;
 }
index 816ddae3655d523387571a2e9e23b850881be710..8498597634bbcf7c689e1b5adcf2d480b75c0ff1 100644 (file)
@@ -190,13 +190,13 @@ METHOD(HLAC, wr_think, void(entity thiswep, entity actor, .entity weaponentity,
 }
 METHOD(HLAC, wr_checkammo1, bool(entity thiswep, entity actor, .entity weaponentity))
 {
-    float ammo_amount = GetResourceAmount(actor, thiswep.ammo_type) >= WEP_CVAR_PRI(hlac, ammo);
+    float ammo_amount = GetResource(actor, thiswep.ammo_type) >= WEP_CVAR_PRI(hlac, ammo);
     ammo_amount += actor.(weaponentity).(weapon_load[thiswep.m_id]) >= WEP_CVAR_PRI(hlac, ammo);
     return ammo_amount;
 }
 METHOD(HLAC, wr_checkammo2, bool(entity thiswep, entity actor, .entity weaponentity))
 {
-    float ammo_amount = GetResourceAmount(actor, thiswep.ammo_type) >= WEP_CVAR_SEC(hlac, ammo);
+    float ammo_amount = GetResource(actor, thiswep.ammo_type) >= WEP_CVAR_SEC(hlac, ammo);
     ammo_amount += actor.(weaponentity).(weapon_load[thiswep.m_id]) >= WEP_CVAR_SEC(hlac, ammo);
     return ammo_amount;
 }
index 25c6f609fe7d61c8c799755989232f6bda58fcd1..da0daac945732ed3407c988ca49e2f9757768dcc 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, RES_HEALTH) <= 0)
+       if(GetResource(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, RES_HEALTH, GetResourceAmount(this, RES_HEALTH));
+       SetResource(this, RES_HEALTH, GetResource(this, RES_HEALTH));
 
-       if(GetResourceAmount(this, RES_HEALTH) <= 0)
+       if(GetResource(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, RES_HEALTH, WEP_CVAR_SEC(hook, health));
+       SetResource(gren, RES_HEALTH, WEP_CVAR_SEC(hook, health));
        gren.damageforcescale = WEP_CVAR_SEC(hook, damageforcescale);
        gren.event_damage = W_Hook_Damage;
        gren.damagedbycontents = true;
@@ -165,7 +165,7 @@ METHOD(Hook, wr_think, void(entity thiswep, entity actor, .entity weaponentity,
             {
                 if(!(actor.items & IT_UNLIMITED_WEAPON_AMMO))
                 {
-                    if( GetResourceAmount(actor, RES_FUEL) >= (time - actor.(weaponentity).hook_time_fueldecrease) * hooked_fuel )
+                    if( GetResource(actor, RES_FUEL) >= (time - actor.(weaponentity).hook_time_fueldecrease) * hooked_fuel )
                     {
                         W_DecreaseAmmo(thiswep, actor, (time - actor.(weaponentity).hook_time_fueldecrease) * hooked_fuel, weaponentity);
                         actor.(weaponentity).hook_time_fueldecrease = time;
@@ -173,7 +173,7 @@ METHOD(Hook, wr_think, void(entity thiswep, entity actor, .entity weaponentity,
                     }
                     else
                     {
-                        SetResourceAmount(actor, RES_FUEL, 0);
+                        SetResource(actor, RES_FUEL, 0);
                         actor.(weaponentity).hook_state |= HOOK_REMOVING;
                         if(actor.(weaponentity).m_weapon != WEP_Null) // offhand
                                W_SwitchWeapon_Force(actor, w_getbestweapon(actor, weaponentity), weaponentity);
@@ -214,9 +214,9 @@ METHOD(Hook, wr_checkammo1, bool(Hook thiswep, entity actor, .entity weaponentit
     if (!thiswep.ammo_factor) return true;
 
     if(actor.(weaponentity).hook)
-       return GetResourceAmount(actor, RES_FUEL) > 0;
+       return GetResource(actor, RES_FUEL) > 0;
 
-    return GetResourceAmount(actor, RES_FUEL) >= WEP_CVAR_PRI(hook, ammo);
+    return GetResource(actor, RES_FUEL) >= WEP_CVAR_PRI(hook, ammo);
 }
 METHOD(Hook, wr_checkammo2, bool(Hook thiswep, entity actor, .entity weaponentity))
 {
index 607f1fcddfedfda1e80b7048aa0729fd7b22569d..6679f2135fe2079904ec6f920a911eb2758556b1 100644 (file)
@@ -252,9 +252,9 @@ METHOD(MachineGun, wr_checkammo1, bool(entity thiswep, entity actor, .entity wea
 {
     float ammo_amount;
     if(WEP_CVAR(machinegun, mode) == 1)
-        ammo_amount = GetResourceAmount(actor, thiswep.ammo_type) >= WEP_CVAR(machinegun, sustained_ammo);
+        ammo_amount = GetResource(actor, thiswep.ammo_type) >= WEP_CVAR(machinegun, sustained_ammo);
     else
-        ammo_amount = GetResourceAmount(actor, thiswep.ammo_type) >= WEP_CVAR(machinegun, first_ammo);
+        ammo_amount = GetResource(actor, thiswep.ammo_type) >= WEP_CVAR(machinegun, first_ammo);
 
     if(WEP_CVAR(machinegun, reload_ammo))
     {
@@ -269,9 +269,9 @@ METHOD(MachineGun, wr_checkammo2, bool(entity thiswep, entity actor, .entity wea
 {
     float ammo_amount;
     if(WEP_CVAR(machinegun, mode) == 1)
-        ammo_amount = GetResourceAmount(actor, thiswep.ammo_type) >= WEP_CVAR(machinegun, burst_ammo);
+        ammo_amount = GetResource(actor, thiswep.ammo_type) >= WEP_CVAR(machinegun, burst_ammo);
     else
-        ammo_amount = GetResourceAmount(actor, thiswep.ammo_type) >= WEP_CVAR(machinegun, first_ammo);
+        ammo_amount = GetResource(actor, thiswep.ammo_type) >= WEP_CVAR(machinegun, first_ammo);
 
     if(WEP_CVAR(machinegun, reload_ammo))
     {
index 23b60733a495d11c1cafdda8a87541fc892f31e9..7e54c3c4301578db20b0eb4923413f3f63e34f96 100644 (file)
@@ -27,7 +27,7 @@ void W_MineLayer_Stick(entity this, entity to)
 
        newmine.takedamage = this.takedamage;
        newmine.damageforcescale = this.damageforcescale;
-       SetResourceAmount(newmine, RES_HEALTH, GetResourceAmount(this, RES_HEALTH));
+       SetResource(newmine, RES_HEALTH, GetResource(this, RES_HEALTH));
        newmine.event_damage = this.event_damage;
        newmine.spawnshieldtime = this.spawnshieldtime;
        newmine.damagedbycontents = true;
@@ -237,7 +237,7 @@ void W_MineLayer_Touch(entity this, entity toucher)
 
 void W_MineLayer_Damage(entity this, entity inflictor, entity attacker, float damage, int deathtype, .entity weaponentity, vector hitloc, vector force)
 {
-       if(GetResourceAmount(this, RES_HEALTH) <= 0)
+       if(GetResource(this, RES_HEALTH) <= 0)
                return;
 
        float is_from_enemy = (inflictor.realowner != this.realowner);
@@ -248,7 +248,7 @@ void W_MineLayer_Damage(entity this, entity inflictor, entity attacker, float da
        TakeResource(this, RES_HEALTH, damage);
        this.angles = vectoangles(this.velocity);
 
-       if(GetResourceAmount(this, RES_HEALTH) <= 0)
+       if(GetResource(this, RES_HEALTH) <= 0)
                W_PrepareExplosionByDamage(this, attacker, W_MineLayer_Explode_think);
 }
 
@@ -289,7 +289,7 @@ void W_MineLayer_Attack(Weapon thiswep, entity actor, .entity weaponentity)
 
        mine.takedamage = DAMAGE_YES;
        mine.damageforcescale = WEP_CVAR(minelayer, damageforcescale);
-       SetResourceAmount(mine, RES_HEALTH, WEP_CVAR(minelayer, health));
+       SetResource(mine, RES_HEALTH, WEP_CVAR(minelayer, health));
        mine.event_damage = W_MineLayer_Damage;
        mine.damagedbycontents = true;
        IL_PUSH(g_damagedbycontents, mine);
@@ -427,7 +427,7 @@ METHOD(MineLayer, wr_aim, void(entity thiswep, entity actor, .entity weaponentit
         // but don't fire a new shot at the same time!
         if(desirabledamage >= 0.75 * coredamage) //this should do group damage in rare fortunate events
             PHYS_INPUT_BUTTON_ATCK2(actor) = true;
-        if((skill > 6.5) && (selfdamage > GetResourceAmount(actor, RES_HEALTH)))
+        if((skill > 6.5) && (selfdamage > GetResource(actor, RES_HEALTH)))
             PHYS_INPUT_BUTTON_ATCK2(actor) = false;
         //if(PHYS_INPUT_BUTTON_ATCK2(actor) == true)
         //     dprint(ftos(desirabledamage),"\n");
@@ -441,7 +441,7 @@ METHOD(MineLayer, wr_think, void(entity thiswep, entity actor, .entity weaponent
     if(autocvar_g_balance_minelayer_reload_ammo && actor.(weaponentity).clip_load < WEP_CVAR(minelayer, ammo)) // forced reload
     {
         // not if we're holding the minelayer without enough ammo, but can detonate existing mines
-        if(!(W_MineLayer_PlacedMines(actor, weaponentity, false) && GetResourceAmount(actor, thiswep.ammo_type) < WEP_CVAR(minelayer, ammo))) {
+        if(!(W_MineLayer_PlacedMines(actor, weaponentity, false) && GetResource(actor, thiswep.ammo_type) < WEP_CVAR(minelayer, ammo))) {
             thiswep.wr_reload(thiswep, actor, weaponentity);
         }
     }
@@ -465,7 +465,7 @@ METHOD(MineLayer, wr_checkammo1, bool(entity thiswep, entity actor, .entity weap
     // actually do // don't switch while placing a mine
     //if(ATTACK_FINISHED(actor, weaponentity) <= time || PS(actor).m_weapon != WEP_MINE_LAYER)
     //{
-        float ammo_amount = GetResourceAmount(actor, thiswep.ammo_type) >= WEP_CVAR(minelayer, ammo);
+        float ammo_amount = GetResource(actor, thiswep.ammo_type) >= WEP_CVAR(minelayer, ammo);
         ammo_amount += actor.(weaponentity).(weapon_load[thiswep.m_id]) >= WEP_CVAR(minelayer, ammo);
         return ammo_amount;
     //}
index f95f6bd0051aff6af2fc108209b8666dd7a5f9ba..7d92f290851443aac33da3447fab8155e973573f 100644 (file)
@@ -54,7 +54,7 @@ void W_Mortar_Grenade_Explode2_use(entity this, entity actor, entity trigger)
 
 void W_Mortar_Grenade_Damage(entity this, entity inflictor, entity attacker, float damage, int deathtype, .entity weaponentity, vector hitloc, vector force)
 {
-       if(GetResourceAmount(this, RES_HEALTH) <= 0)
+       if(GetResource(this, RES_HEALTH) <= 0)
                return;
 
        if(!W_CheckProjectileDamage(inflictor.realowner, this.realowner, deathtype, -1)) // no exceptions
@@ -62,7 +62,7 @@ void W_Mortar_Grenade_Damage(entity this, entity inflictor, entity attacker, flo
 
        TakeResource(this, RES_HEALTH, damage);
 
-       if(GetResourceAmount(this, RES_HEALTH) <= 0)
+       if(GetResource(this, RES_HEALTH) <= 0)
                W_PrepareExplosionByDamage(this, attacker, adaptor_think2use);
 }
 
@@ -176,7 +176,7 @@ void W_Mortar_Attack(Weapon thiswep, entity actor, .entity weaponentity)
        settouch(gren, W_Mortar_Grenade_Touch1);
 
        gren.takedamage = DAMAGE_YES;
-       SetResourceAmount(gren, RES_HEALTH, WEP_CVAR_PRI(mortar, health));
+       SetResource(gren, RES_HEALTH, WEP_CVAR_PRI(mortar, health));
        gren.damageforcescale = WEP_CVAR_PRI(mortar, damageforcescale);
        gren.event_damage = W_Mortar_Grenade_Damage;
        gren.damagedbycontents = true;
@@ -227,7 +227,7 @@ void W_Mortar_Attack2(Weapon thiswep, entity actor, .entity weaponentity)
        settouch(gren, W_Mortar_Grenade_Touch2);
 
        gren.takedamage = DAMAGE_YES;
-       SetResourceAmount(gren, RES_HEALTH, WEP_CVAR_SEC(mortar, health));
+       SetResource(gren, RES_HEALTH, WEP_CVAR_SEC(mortar, health));
        gren.damageforcescale = WEP_CVAR_SEC(mortar, damageforcescale);
        gren.event_damage = W_Mortar_Grenade_Damage;
        gren.damagedbycontents = true;
@@ -324,13 +324,13 @@ METHOD(Mortar, wr_think, void(entity thiswep, entity actor, .entity weaponentity
 }
 METHOD(Mortar, wr_checkammo1, bool(entity thiswep, entity actor, .entity weaponentity))
 {
-    float ammo_amount = GetResourceAmount(actor, thiswep.ammo_type) >= WEP_CVAR_PRI(mortar, ammo);
+    float ammo_amount = GetResource(actor, thiswep.ammo_type) >= WEP_CVAR_PRI(mortar, ammo);
     ammo_amount += actor.(weaponentity).(weapon_load[thiswep.m_id]) >= WEP_CVAR_PRI(mortar, ammo);
     return ammo_amount;
 }
 METHOD(Mortar, wr_checkammo2, bool(entity thiswep, entity actor, .entity weaponentity))
 {
-    float ammo_amount = GetResourceAmount(actor, thiswep.ammo_type) >= WEP_CVAR_SEC(mortar, ammo);
+    float ammo_amount = GetResource(actor, thiswep.ammo_type) >= WEP_CVAR_SEC(mortar, ammo);
     ammo_amount += actor.(weaponentity).(weapon_load[thiswep.m_id]) >= WEP_CVAR_SEC(mortar, ammo);
     return ammo_amount;
 }
index d4d692ec70f0adeab3f7118961bd904dbb66d533..7daf4ec40803c445f109569a9a8e73e532beb4e6 100644 (file)
@@ -146,13 +146,13 @@ METHOD(Rifle, wr_think, void(entity thiswep, entity actor, .entity weaponentity,
 }
 METHOD(Rifle, wr_checkammo1, bool(entity thiswep, entity actor, .entity weaponentity))
 {
-    float ammo_amount = GetResourceAmount(actor, thiswep.ammo_type) >= WEP_CVAR_PRI(rifle, ammo);
+    float ammo_amount = GetResource(actor, thiswep.ammo_type) >= WEP_CVAR_PRI(rifle, ammo);
     ammo_amount += actor.(weaponentity).(weapon_load[thiswep.m_id]) >= WEP_CVAR_PRI(rifle, ammo);
     return ammo_amount;
 }
 METHOD(Rifle, wr_checkammo2, bool(entity thiswep, entity actor, .entity weaponentity))
 {
-    float ammo_amount = GetResourceAmount(actor, thiswep.ammo_type) >= WEP_CVAR_SEC(rifle, ammo);
+    float ammo_amount = GetResource(actor, thiswep.ammo_type) >= WEP_CVAR_SEC(rifle, ammo);
     ammo_amount += actor.(weaponentity).(weapon_load[thiswep.m_id]) >= WEP_CVAR_SEC(rifle, ammo);
     return ammo_amount;
 }
index 9e2a059be9025adba70b8a81c3e30bdc57d0e30c..54cbdc293b6d77a040602847b06fe6ab54cf8d1c 100644 (file)
@@ -124,7 +124,7 @@ void W_Seeker_Missile_Think(entity this)
 
 void W_Seeker_Missile_Damage(entity this, entity inflictor, entity attacker, float damage, int deathtype, .entity weaponentity, vector hitloc, vector force)
 {
-       if(GetResourceAmount(this, RES_HEALTH) <= 0)
+       if(GetResource(this, RES_HEALTH) <= 0)
                return;
 
        if(!W_CheckProjectileDamage(inflictor.realowner, this.realowner, deathtype, -1)) // no exceptions
@@ -135,7 +135,7 @@ void W_Seeker_Missile_Damage(entity this, entity inflictor, entity attacker, flo
        else
                TakeResource(this, RES_HEALTH, damage);
 
-       if(GetResourceAmount(this, RES_HEALTH) <= 0)
+       if(GetResource(this, RES_HEALTH) <= 0)
                W_PrepareExplosionByDamage(this, attacker, W_Seeker_Missile_Explode_think);
 }
 
@@ -190,7 +190,7 @@ void W_Seeker_Fire_Missile(Weapon thiswep, entity actor, .entity weaponentity, v
        missile.scale           = 2;
        missile.takedamage      = DAMAGE_YES;
        missile.weaponentity_fld = weaponentity;
-       SetResourceAmount(missile, RES_HEALTH, WEP_CVAR(seeker, missile_health));
+       SetResource(missile, RES_HEALTH, WEP_CVAR(seeker, missile_health));
        missile.damageforcescale = WEP_CVAR(seeker, missile_damageforcescale);
        missile.damagedbycontents = true;
        IL_PUSH(g_damagedbycontents, missile);
@@ -348,7 +348,7 @@ void W_Seeker_Vollycontroller_Think(entity this) // TODO: Merge this with W_Seek
 
        Weapon thiswep = WEP_SEEKER;
        .entity weaponentity = this.weaponentity_fld;
-       if((!(this.realowner.items & IT_UNLIMITED_AMMO) && GetResourceAmount(this.realowner, thiswep.ammo_type) < WEP_CVAR(seeker, missile_ammo)) || (this.cnt <= -1) || (IS_DEAD(this.realowner)) || (this.realowner.(weaponentity).m_switchweapon != thiswep))
+       if((!(this.realowner.items & IT_UNLIMITED_AMMO) && GetResource(this.realowner, thiswep.ammo_type) < WEP_CVAR(seeker, missile_ammo)) || (this.cnt <= -1) || (IS_DEAD(this.realowner)) || (this.realowner.(weaponentity).m_switchweapon != thiswep))
        {
                delete(this);
                return;
@@ -415,10 +415,10 @@ void W_Seeker_Tag_Explode(entity this)
 
 void W_Seeker_Tag_Damage(entity this, entity inflictor, entity attacker, float damage, int deathtype, .entity weaponentity, vector hitloc, vector force)
 {
-       if(GetResourceAmount(this, RES_HEALTH) <= 0)
+       if(GetResource(this, RES_HEALTH) <= 0)
                return;
        TakeResource(this, RES_HEALTH, damage);
-       if(GetResourceAmount(this, RES_HEALTH) <= 0)
+       if(GetResource(this, RES_HEALTH) <= 0)
                W_Seeker_Tag_Explode(this);
 }
 
@@ -506,7 +506,7 @@ void W_Seeker_Fire_Tag(Weapon thiswep, entity actor, .entity weaponentity)
 
        missile.takedamage       = DAMAGE_YES;
        missile.event_damage     = W_Seeker_Tag_Damage;
-       SetResourceAmount(missile, RES_HEALTH, WEP_CVAR(seeker, tag_health));
+       SetResource(missile, RES_HEALTH, WEP_CVAR(seeker, tag_health));
        missile.damageforcescale = WEP_CVAR(seeker, tag_damageforcescale);
 
        setorigin(missile, w_shotorg);
@@ -591,12 +591,12 @@ METHOD(Seeker, wr_checkammo1, bool(entity thiswep, entity actor, .entity weapone
     float ammo_amount;
     if(WEP_CVAR(seeker, type) == 1)
     {
-        ammo_amount = GetResourceAmount(actor, thiswep.ammo_type) >= WEP_CVAR(seeker, missile_ammo);
+        ammo_amount = GetResource(actor, thiswep.ammo_type) >= WEP_CVAR(seeker, missile_ammo);
         ammo_amount += actor.(weaponentity).(weapon_load[thiswep.m_id]) >= WEP_CVAR(seeker, missile_ammo);
     }
     else
     {
-        ammo_amount = GetResourceAmount(actor, thiswep.ammo_type) >= WEP_CVAR(seeker, tag_ammo);
+        ammo_amount = GetResource(actor, thiswep.ammo_type) >= WEP_CVAR(seeker, tag_ammo);
         ammo_amount += actor.(weaponentity).(weapon_load[thiswep.m_id]) >= WEP_CVAR(seeker, tag_ammo);
     }
     return ammo_amount;
@@ -606,12 +606,12 @@ METHOD(Seeker, wr_checkammo2, bool(entity thiswep, entity actor, .entity weapone
     float ammo_amount;
     if(WEP_CVAR(seeker, type) == 1)
     {
-        ammo_amount = GetResourceAmount(actor, thiswep.ammo_type) >= WEP_CVAR(seeker, tag_ammo);
+        ammo_amount = GetResource(actor, thiswep.ammo_type) >= WEP_CVAR(seeker, tag_ammo);
         ammo_amount += actor.(weaponentity).(weapon_load[thiswep.m_id]) >= WEP_CVAR(seeker, tag_ammo);
     }
     else
     {
-        ammo_amount = GetResourceAmount(actor, thiswep.ammo_type) >= WEP_CVAR(seeker, flac_ammo);
+        ammo_amount = GetResource(actor, thiswep.ammo_type) >= WEP_CVAR(seeker, flac_ammo);
         ammo_amount += actor.(weaponentity).(weapon_load[thiswep.m_id]) >= WEP_CVAR(seeker, flac_ammo);
     }
     return ammo_amount;
index 8faac3d5d03d7e2a4f2dd8f98e9303a572a36ea5..a3bf16145ac438c8e5cc9d9150e0a9646f86379b 100644 (file)
@@ -245,7 +245,7 @@ METHOD(Shotgun, wr_think, void(entity thiswep, entity actor, .entity weaponentit
     }
     if(actor.(weaponentity).clip_load >= 0) // we are not currently reloading
     if(WEP_CVAR(shotgun, secondary) == 1)
-    if(((fire & 1) && GetResourceAmount(actor, thiswep.ammo_type) <= 0 && !(actor.items & IT_UNLIMITED_WEAPON_AMMO)) || (fire & 2))
+    if(((fire & 1) && GetResource(actor, thiswep.ammo_type) <= 0 && !(actor.items & IT_UNLIMITED_WEAPON_AMMO)) || (fire & 2))
     if(weapon_prepareattack(thiswep, actor, weaponentity, true, WEP_CVAR_SEC(shotgun, refire)))
     {
         // attempt forcing playback of the anim by switching to another anim (that we never play) here...
@@ -254,7 +254,7 @@ METHOD(Shotgun, wr_think, void(entity thiswep, entity actor, .entity weaponentit
 }
 METHOD(Shotgun, wr_checkammo1, bool(entity thiswep, entity actor, .entity weaponentity))
 {
-    float ammo_amount = GetResourceAmount(actor, thiswep.ammo_type) >= WEP_CVAR_PRI(shotgun, ammo);
+    float ammo_amount = GetResource(actor, thiswep.ammo_type) >= WEP_CVAR_PRI(shotgun, ammo);
     ammo_amount += actor.(weaponentity).(weapon_load[thiswep.m_id]) >= WEP_CVAR_PRI(shotgun, ammo);
     return ammo_amount;
 }
@@ -268,7 +268,7 @@ METHOD(Shotgun, wr_checkammo2, bool(entity thiswep, entity actor, .entity weapon
         case 1: return true; // melee does not use ammo
         case 2: // secondary triple shot
         {
-            float ammo_amount = GetResourceAmount(actor, thiswep.ammo_type) >= WEP_CVAR_PRI(shotgun, ammo);
+            float ammo_amount = GetResource(actor, thiswep.ammo_type) >= WEP_CVAR_PRI(shotgun, ammo);
             ammo_amount += actor.(weaponentity).(weapon_load[thiswep.m_id]) >= WEP_CVAR_PRI(shotgun, ammo);
             return ammo_amount;
         }
index 1629aa90324ed23135f797321cfb4c41e85be514..2e76827d799380035b7c4a959f545f6e7e5b8d82 100644 (file)
@@ -281,7 +281,7 @@ void W_RocketMinsta_Attack3 (entity actor, .entity weaponentity)
 
 METHOD(Vaporizer, wr_aim, void(entity thiswep, entity actor, .entity weaponentity))
 {
-    if(GetResourceAmount(actor, thiswep.ammo_type) > 0)
+    if(GetResource(actor, thiswep.ammo_type) > 0)
         PHYS_INPUT_BUTTON_ATCK(actor) = bot_aim(actor, weaponentity, 1000000, 0, 1, false);
     else
         PHYS_INPUT_BUTTON_ATCK2(actor) = bot_aim(actor, weaponentity, WEP_CVAR_SEC(vaporizer, speed), 0, WEP_CVAR_SEC(vaporizer, lifetime), false); // WEAPONTODO: replace with proper vaporizer cvars
@@ -295,7 +295,7 @@ METHOD(Vaporizer, wr_think, void(entity thiswep, entity actor, .entity weaponent
     } else if(WEP_CVAR(vaporizer, reload_ammo) && actor.(weaponentity).clip_load < vaporizer_ammo) { // forced reload
         thiswep.wr_reload(thiswep, actor, weaponentity);
     }
-    if((fire & 1) && (GetResourceAmount(actor, RES_CELLS) || !autocvar_g_rm) && !forbidWeaponUse(actor))
+    if((fire & 1) && (GetResource(actor, RES_CELLS) || !autocvar_g_rm) && !forbidWeaponUse(actor))
     {
         if(weapon_prepareattack(thiswep, actor, weaponentity, false, WEP_CVAR_PRI(vaporizer, refire)))
         {
@@ -303,7 +303,7 @@ METHOD(Vaporizer, wr_think, void(entity thiswep, entity actor, .entity weaponent
             weapon_thinkf(actor, weaponentity, WFRAME_FIRE1, WEP_CVAR_PRI(vaporizer, animtime), w_ready);
         }
     }
-    if((fire & 2) || ((fire & 1) && !GetResourceAmount(actor, RES_CELLS) && autocvar_g_rm))
+    if((fire & 2) || ((fire & 1) && !GetResource(actor, RES_CELLS) && autocvar_g_rm))
     {
         if((autocvar_g_rm && autocvar_g_rm_laser) || autocvar_g_rm_laser == 2)
         {
@@ -350,7 +350,7 @@ METHOD(Vaporizer, wr_setup, void(entity thiswep, entity actor, .entity weaponent
 METHOD(Vaporizer, wr_checkammo1, bool(entity thiswep, entity actor, .entity weaponentity))
 {
     float vaporizer_ammo = ((autocvar_g_instagib) ? 1 : WEP_CVAR_PRI(vaporizer, ammo));
-    float ammo_amount = GetResourceAmount(actor, thiswep.ammo_type) >= vaporizer_ammo;
+    float ammo_amount = GetResource(actor, thiswep.ammo_type) >= vaporizer_ammo;
     ammo_amount += actor.(weaponentity).(weapon_load[thiswep.m_id]) >= vaporizer_ammo;
     return ammo_amount;
 }
@@ -358,7 +358,7 @@ METHOD(Vaporizer, wr_checkammo2, bool(entity thiswep, entity actor, .entity weap
 {
     if(!WEP_CVAR_SEC(vaporizer, ammo))
         return true;
-    float ammo_amount = GetResourceAmount(actor, thiswep.ammo_type) >= WEP_CVAR_SEC(vaporizer, ammo);
+    float ammo_amount = GetResource(actor, thiswep.ammo_type) >= WEP_CVAR_SEC(vaporizer, ammo);
     ammo_amount += actor.(weaponentity).(weapon_load[thiswep.m_id]) >= WEP_CVAR_SEC(vaporizer, ammo);
     return ammo_amount;
 }
index 81b34e45d8d2e39f08aae4947363c632b454d203..edd9d47613e979f2cd2b8c643b0e87bc5d65acbe 100644 (file)
@@ -234,11 +234,11 @@ METHOD(Vortex, wr_think, void(entity thiswep, entity actor, .entity weaponentity
                                 }
                                 else
                                 {
-                                    dt = min(dt, (GetResourceAmount(actor, thiswep.ammo_type) - WEP_CVAR_PRI(vortex, ammo)) / WEP_CVAR_SEC(vortex, ammo));
+                                    dt = min(dt, (GetResource(actor, thiswep.ammo_type) - WEP_CVAR_PRI(vortex, ammo)) / WEP_CVAR_SEC(vortex, ammo));
                                     dt = max(0, dt);
                                     if(dt > 0)
                                     {
-                                        SetResourceAmount(actor, thiswep.ammo_type, max(WEP_CVAR_SEC(vortex, ammo), GetResourceAmount(actor, thiswep.ammo_type) - WEP_CVAR_SEC(vortex, ammo) * dt));
+                                        SetResource(actor, thiswep.ammo_type, max(WEP_CVAR_SEC(vortex, ammo), GetResource(actor, thiswep.ammo_type) - WEP_CVAR_SEC(vortex, ammo) * dt));
                                     }
                                 }
                             }
@@ -270,7 +270,7 @@ METHOD(Vortex, wr_setup, void(entity thiswep, entity actor, .entity weaponentity
 }
 METHOD(Vortex, wr_checkammo1, bool(entity thiswep, entity actor, .entity weaponentity))
 {
-    float ammo_amount = GetResourceAmount(actor, thiswep.ammo_type) >= WEP_CVAR_PRI(vortex, ammo);
+    float ammo_amount = GetResource(actor, thiswep.ammo_type) >= WEP_CVAR_PRI(vortex, ammo);
     ammo_amount += (autocvar_g_balance_vortex_reload_ammo && actor.(weaponentity).(weapon_load[thiswep.m_id]) >= WEP_CVAR_PRI(vortex, ammo));
     return ammo_amount;
 }
@@ -279,7 +279,7 @@ METHOD(Vortex, wr_checkammo2, bool(entity thiswep, entity actor, .entity weapone
     if(WEP_CVAR(vortex, secondary))
     {
         // don't allow charging if we don't have enough ammo
-        float ammo_amount = GetResourceAmount(actor, thiswep.ammo_type) >= WEP_CVAR_SEC(vortex, ammo);
+        float ammo_amount = GetResource(actor, thiswep.ammo_type) >= WEP_CVAR_SEC(vortex, ammo);
         ammo_amount += actor.(weaponentity).(weapon_load[thiswep.m_id]) >= WEP_CVAR_SEC(vortex, ammo);
         return ammo_amount;
     }
index 6551771681a8e31f6a54966b28d33093a87de8c9..502d3bcfc5147167d160068264706cd1dbf089f3 100644 (file)
@@ -477,7 +477,7 @@ void havocbot_movetogoal(entity this)
        // Jetpack navigation
        if(this.navigation_jetpack_goal)
        if(this.goalcurrent==this.navigation_jetpack_goal)
-       if(GetResourceAmount(this, RES_FUEL))
+       if(GetResource(this, RES_FUEL))
        {
                if(autocvar_bot_debug_goalstack)
                {
@@ -673,7 +673,7 @@ void havocbot_movetogoal(entity this)
                        return;
                }
                else if(!this.jumppadcount && !this.goalcurrent.wphardwired
-                       && GetResourceAmount(this, RES_HEALTH) + GetResourceAmount(this, RES_ARMOR) > ROCKETJUMP_DAMAGE())
+                       && GetResource(this, RES_HEALTH) + GetResource(this, RES_ARMOR) > ROCKETJUMP_DAMAGE())
                {
                        if(this.velocity.z < 0)
                        {
@@ -1303,7 +1303,7 @@ void havocbot_chooseenemy(entity this)
                        traceline(this.origin+this.view_ofs, ( this.enemy.absmin + this.enemy.absmax ) * 0.5,false,NULL);
                        if (trace_ent == this.enemy || trace_fraction == 1)
                        if (vdist(((this.enemy.absmin + this.enemy.absmax) * 0.5) - this.origin, <, 1000))
-                       if (GetResourceAmount(this, RES_HEALTH) > 30)
+                       if (GetResource(this, RES_HEALTH) > 30)
                        {
                                // remain tracking him for a shot while (case he went after a small corner or pilar
                                this.havocbot_chooseenemy_finished = time + 0.5;
index 64a8f97ea7a45b6e9f10364caca08dd6db633a0a..b72153c95cb0bc371c5e9808b544b785861be7de 100644 (file)
@@ -50,14 +50,14 @@ void havocbot_goalrating_waypoints(entity this, float ratingscale, vector org, f
 
 bool havocbot_goalrating_item_can_be_left_to_teammate(entity this, entity player, entity item)
 {
-       if (GetResourceAmount(item, RES_HEALTH) && GetResourceAmount(player, RES_HEALTH) <= GetResourceAmount(this, RES_HEALTH)) {return true;}
-       if (GetResourceAmount(item, RES_ARMOR) && GetResourceAmount(player, RES_ARMOR) <= GetResourceAmount(this, RES_ARMOR)) {return true;}
+       if (GetResource(item, RES_HEALTH) && GetResource(player, RES_HEALTH) <= GetResource(this, RES_HEALTH)) {return true;}
+       if (GetResource(item, RES_ARMOR) && GetResource(player, RES_ARMOR) <= GetResource(this, RES_ARMOR)) {return true;}
        if (STAT(WEAPONS, item) && !(STAT(WEAPONS, player) & STAT(WEAPONS, item))) {return true;}
-       if (GetResourceAmount(item, RES_SHELLS) && GetResourceAmount(player, RES_SHELLS) <= GetResourceAmount(this, RES_SHELLS)) {return true;}
-       if (GetResourceAmount(item, RES_BULLETS) && GetResourceAmount(player, RES_BULLETS) <= GetResourceAmount(this, RES_BULLETS)) {return true;}
-       if (GetResourceAmount(item, RES_ROCKETS) && GetResourceAmount(player, RES_ROCKETS) <= GetResourceAmount(this, RES_ROCKETS)) {return true;}
-       if (GetResourceAmount(item, RES_CELLS) && GetResourceAmount(player, RES_CELLS) <= GetResourceAmount(this, RES_CELLS)) {return true;}
-       if (GetResourceAmount(item, RES_PLASMA) && GetResourceAmount(player, RES_PLASMA) <= GetResourceAmount(this, RES_PLASMA)) {return true;}
+       if (GetResource(item, RES_SHELLS) && GetResource(player, RES_SHELLS) <= GetResource(this, RES_SHELLS)) {return true;}
+       if (GetResource(item, RES_BULLETS) && GetResource(player, RES_BULLETS) <= GetResource(this, RES_BULLETS)) {return true;}
+       if (GetResource(item, RES_ROCKETS) && GetResource(player, RES_ROCKETS) <= GetResource(this, RES_ROCKETS)) {return true;}
+       if (GetResource(item, RES_CELLS) && GetResource(player, RES_CELLS) <= GetResource(this, RES_CELLS)) {return true;}
+       if (GetResource(item, RES_PLASMA) && GetResource(player, RES_PLASMA) <= GetResource(this, RES_PLASMA)) {return true;}
        if (item.itemdef.instanceOfPowerup) {return true;}
 
        return false;
@@ -208,7 +208,7 @@ void havocbot_goalrating_enemyplayers(entity this, float ratingscale, vector org
                        continue;
                */
 
-               t = ((GetResourceAmount(this, RES_HEALTH) + GetResourceAmount(this, RES_ARMOR)) - (GetResourceAmount(it, RES_HEALTH) + GetResourceAmount(it, RES_ARMOR))) / 150;
+               t = ((GetResource(this, RES_HEALTH) + GetResource(this, RES_ARMOR)) - (GetResource(it, RES_HEALTH) + GetResource(it, RES_ARMOR))) / 150;
                t = bound(0, 1 + t, 3);
                if (skill > 3)
                {
index a27b4ca3543e24c8019f28b95772516f470d13be..9dc1e47aa37e326a626501b9e90d24fb51c63e49 100644 (file)
@@ -1332,10 +1332,10 @@ void navigation_routerating(entity this, entity e, float f, float rangebias)
                        t += xydistance / autocvar_g_jetpack_maxspeed_side;
                        fuel = t * autocvar_g_jetpack_fuel * 0.8;
 
-                       LOG_DEBUG("jetpack ai: required fuel ", ftos(fuel), ", have ", ftos(GetResourceAmount(this, RES_FUEL)));
+                       LOG_DEBUG("jetpack ai: required fuel ", ftos(fuel), ", have ", ftos(GetResource(this, RES_FUEL)));
 
                        // enough fuel ?
-                       if(GetResourceAmount(this, RES_FUEL) > fuel || (this.items & IT_UNLIMITED_WEAPON_AMMO))
+                       if(GetResource(this, RES_FUEL) > fuel || (this.items & IT_UNLIMITED_WEAPON_AMMO))
                        {
                                // Estimate cost
                                // (as onground costs calculation is mostly based on distances, here we do the same establishing some relationship
index e72b17805c2d2e5ab01027f0eca714bb4f04c078..176b6361de30bb83ca0870475a3b49b00bfab804 100644 (file)
@@ -624,7 +624,7 @@ float bot_cmd_eval(entity this, string expr)
        switch(expr)
        {
                case "health":
-                       return GetResourceAmount(this, RES_HEALTH);
+                       return GetResource(this, RES_HEALTH);
                case "speed":
                        return vlen(this.velocity);
                case "flagcarrier":
index be481617ca3fac15de8c88640095cf5510c44176..18d12815a0ec2ddf57150985aadc8c26d6d9459d 100644 (file)
@@ -152,14 +152,14 @@ float CheatImpulse(entity this, int imp)
                        this.personal.origin = this.origin;
                        this.personal.v_angle = this.v_angle;
                        this.personal.velocity = this.velocity;
-                       SetResourceAmount(this.personal, RES_ROCKETS, GetResourceAmount(this, RES_ROCKETS));
-                       SetResourceAmount(this.personal, RES_BULLETS, GetResourceAmount(this, RES_BULLETS));
-                       SetResourceAmount(this.personal, RES_CELLS, GetResourceAmount(this, RES_CELLS));
-                       SetResourceAmount(this.personal, RES_PLASMA, GetResourceAmount(this, RES_PLASMA));
-                       SetResourceAmount(this.personal, RES_SHELLS, GetResourceAmount(this, RES_SHELLS));
-                       SetResourceAmount(this.personal, RES_FUEL, GetResourceAmount(this, RES_FUEL));
-                       SetResourceAmount(this.personal, RES_HEALTH, max(1, GetResourceAmount(this, RES_HEALTH)));
-                       SetResourceAmount(this.personal, RES_ARMOR, GetResourceAmount(this, RES_ARMOR));
+                       SetResource(this.personal, RES_ROCKETS, GetResource(this, RES_ROCKETS));
+                       SetResource(this.personal, RES_BULLETS, GetResource(this, RES_BULLETS));
+                       SetResource(this.personal, RES_CELLS, GetResource(this, RES_CELLS));
+                       SetResource(this.personal, RES_PLASMA, GetResource(this, RES_PLASMA));
+                       SetResource(this.personal, RES_SHELLS, GetResource(this, RES_SHELLS));
+                       SetResource(this.personal, RES_FUEL, GetResource(this, RES_FUEL));
+                       SetResource(this.personal, RES_HEALTH, max(1, GetResource(this, RES_HEALTH)));
+                       SetResource(this.personal, RES_ARMOR, GetResource(this, RES_ARMOR));
                        STAT(WEAPONS, this.personal) = STAT(WEAPONS, this);
                        this.personal.items = this.items;
                        this.personal.pauserotarmor_finished = this.pauserotarmor_finished;
@@ -211,14 +211,14 @@ float CheatImpulse(entity this, int imp)
                                        MUTATOR_CALLHOOK(AbortSpeedrun, this);
                                }
 
-                               SetResourceAmount(this, RES_ROCKETS, GetResourceAmount(this.personal, RES_ROCKETS));
-                               SetResourceAmount(this, RES_BULLETS, GetResourceAmount(this.personal, RES_BULLETS));
-                               SetResourceAmount(this, RES_CELLS, GetResourceAmount(this.personal, RES_CELLS));
-                               SetResourceAmount(this, RES_PLASMA, GetResourceAmount(this.personal, RES_PLASMA));
-                               SetResourceAmount(this, RES_SHELLS, GetResourceAmount(this.personal, RES_SHELLS));
-                               SetResourceAmount(this, RES_FUEL, GetResourceAmount(this.personal, RES_FUEL));
-                               SetResourceAmount(this, RES_HEALTH, GetResourceAmount(this.personal, RES_HEALTH));
-                               SetResourceAmount(this, RES_ARMOR, GetResourceAmount(this.personal, RES_ARMOR));
+                               SetResource(this, RES_ROCKETS, GetResource(this.personal, RES_ROCKETS));
+                               SetResource(this, RES_BULLETS, GetResource(this.personal, RES_BULLETS));
+                               SetResource(this, RES_CELLS, GetResource(this.personal, RES_CELLS));
+                               SetResource(this, RES_PLASMA, GetResource(this.personal, RES_PLASMA));
+                               SetResource(this, RES_SHELLS, GetResource(this.personal, RES_SHELLS));
+                               SetResource(this, RES_FUEL, GetResource(this.personal, RES_FUEL));
+                               SetResource(this, RES_HEALTH, GetResource(this.personal, RES_HEALTH));
+                               SetResource(this, RES_ARMOR, GetResource(this.personal, RES_ARMOR));
                                STAT(WEAPONS, this) = STAT(WEAPONS, this.personal);
                                this.items = this.personal.items;
                                this.pauserotarmor_finished = time + this.personal.pauserotarmor_finished - this.personal.teleport_time;
@@ -355,7 +355,7 @@ float CheatCommand(entity this, int argc)
                                        entity e = spawn();
                                        e.model = strzone(argv(1));
                                        e.mdl = "rocket_explode";
-                                       SetResourceAmount(e, RES_HEALTH, 1000);
+                                       SetResource(e, RES_HEALTH, 1000);
                                        setorigin(e, trace_endpos);
                                        e.effects = EF_NOMODELFLAGS;
                                        if(f == 1)
index 8f64de4b10e661ef6e57c7e6ceb7e71e31daba92..4a03c3cb4370666758778414f9e19f8839a4e562 100644 (file)
@@ -232,7 +232,7 @@ void PutObserverInServer(entity this)
 
        if (IS_PLAYER(this))
        {
-               if(GetResourceAmount(this, RES_HEALTH) >= 1)
+               if(GetResource(this, RES_HEALTH) >= 1)
                {
                        // despawn effect
                        Send_Effect(EFFECT_SPAWN_NEUTRAL, this.origin, '0 0 0', 1);
@@ -311,14 +311,14 @@ void PutObserverInServer(entity this)
        if(this.damagedbycontents)
                IL_REMOVE(g_damagedbycontents, this);
        this.damagedbycontents = false;
-       SetResourceAmount(this, RES_HEALTH, FRAGS_SPECTATOR);
+       SetResource(this, RES_HEALTH, FRAGS_SPECTATOR);
        SetSpectatee_status(this, etof(this));
        this.takedamage = DAMAGE_NO;
        this.solid = SOLID_NOT;
        set_movetype(this, MOVETYPE_FLY_WORLDONLY); // user preference is controlled by playerprethink
        this.flags = FL_CLIENT | FL_NOTARGET;
        this.effects = 0;
-       SetResourceAmount(this, RES_ARMOR, autocvar_g_balance_armor_start); // was 666?!
+       SetResource(this, RES_ARMOR, autocvar_g_balance_armor_start); // was 666?!
        this.pauserotarmor_finished = 0;
        this.pauserothealth_finished = 0;
        this.pauseregen_finished = 0;
@@ -557,24 +557,24 @@ void PutPlayerInServer(entity this)
        this.effects = EF_TELEPORT_BIT | EF_RESTARTANIM_BIT;
 
        if (warmup_stage) {
-               SetResourceAmount(this, RES_SHELLS, warmup_start_ammo_shells);
-               SetResourceAmount(this, RES_BULLETS, warmup_start_ammo_nails);
-               SetResourceAmount(this, RES_ROCKETS, warmup_start_ammo_rockets);
-               SetResourceAmount(this, RES_CELLS, warmup_start_ammo_cells);
-               SetResourceAmount(this, RES_PLASMA, warmup_start_ammo_plasma);
-               SetResourceAmount(this, RES_FUEL, warmup_start_ammo_fuel);
-               SetResourceAmount(this, RES_HEALTH, warmup_start_health);
-               SetResourceAmount(this, RES_ARMOR, warmup_start_armorvalue);
+               SetResource(this, RES_SHELLS, warmup_start_ammo_shells);
+               SetResource(this, RES_BULLETS, warmup_start_ammo_nails);
+               SetResource(this, RES_ROCKETS, warmup_start_ammo_rockets);
+               SetResource(this, RES_CELLS, warmup_start_ammo_cells);
+               SetResource(this, RES_PLASMA, warmup_start_ammo_plasma);
+               SetResource(this, RES_FUEL, warmup_start_ammo_fuel);
+               SetResource(this, RES_HEALTH, warmup_start_health);
+               SetResource(this, RES_ARMOR, warmup_start_armorvalue);
                STAT(WEAPONS, this) = WARMUP_START_WEAPONS;
        } else {
-               SetResourceAmount(this, RES_SHELLS, start_ammo_shells);
-               SetResourceAmount(this, RES_BULLETS, start_ammo_nails);
-               SetResourceAmount(this, RES_ROCKETS, start_ammo_rockets);
-               SetResourceAmount(this, RES_CELLS, start_ammo_cells);
-               SetResourceAmount(this, RES_PLASMA, start_ammo_plasma);
-               SetResourceAmount(this, RES_FUEL, start_ammo_fuel);
-               SetResourceAmount(this, RES_HEALTH, start_health);
-               SetResourceAmount(this, RES_ARMOR, start_armorvalue);
+               SetResource(this, RES_SHELLS, start_ammo_shells);
+               SetResource(this, RES_BULLETS, start_ammo_nails);
+               SetResource(this, RES_ROCKETS, start_ammo_rockets);
+               SetResource(this, RES_CELLS, start_ammo_cells);
+               SetResource(this, RES_PLASMA, start_ammo_plasma);
+               SetResource(this, RES_FUEL, start_ammo_fuel);
+               SetResource(this, RES_HEALTH, start_health);
+               SetResource(this, RES_ARMOR, start_armorvalue);
                STAT(WEAPONS, this) = start_weapons;
                if (MUTATOR_CALLHOOK(ForbidRandomStartWeapons, this) == false)
                {
@@ -1583,17 +1583,17 @@ void player_regen(entity this)
                limith = limith * limit_mod;
                limita = limita * limit_mod;
 
-               SetResourceAmount(this, RES_ARMOR, CalcRotRegen(GetResourceAmount(this, RES_ARMOR), mina, autocvar_g_balance_armor_regen, autocvar_g_balance_armor_regenlinear, 
+               SetResource(this, RES_ARMOR, CalcRotRegen(GetResource(this, RES_ARMOR), mina, autocvar_g_balance_armor_regen, autocvar_g_balance_armor_regenlinear, 
                                                                        regen_mod * frametime * (time > this.pauseregen_finished), maxa, autocvar_g_balance_armor_rot, autocvar_g_balance_armor_rotlinear,
                                                                        rot_mod * frametime * (time > this.pauserotarmor_finished), limita));
-               SetResourceAmount(this, RES_HEALTH, CalcRotRegen(GetResourceAmount(this, RES_HEALTH), regen_health_stable, regen_health, regen_health_linear,
+               SetResource(this, RES_HEALTH, CalcRotRegen(GetResource(this, RES_HEALTH), regen_health_stable, regen_health, regen_health_linear,
                                                                        regen_mod * frametime * (time > this.pauseregen_finished), regen_health_rotstable, regen_health_rot, regen_health_rotlinear,
                                                                        rot_mod * frametime * (time > this.pauserothealth_finished), limith));
        }
 
        // if player rotted to death...  die!
        // check this outside above checks, as player may still be able to rot to death
-       if(GetResourceAmount(this, RES_HEALTH) < 1)
+       if(GetResource(this, RES_HEALTH) < 1)
        {
                if(this.vehicle)
                        vehicles_exit(this.vehicle, VHEF_RELEASE);
@@ -1609,7 +1609,7 @@ void player_regen(entity this)
                minf = autocvar_g_balance_fuel_regenstable;
                limitf = GetResourceLimit(this, RES_FUEL);
 
-               SetResourceAmount(this, RES_FUEL, CalcRotRegen(GetResourceAmount(this, RES_FUEL), minf, autocvar_g_balance_fuel_regen, autocvar_g_balance_fuel_regenlinear, 
+               SetResource(this, RES_FUEL, CalcRotRegen(GetResource(this, RES_FUEL), minf, autocvar_g_balance_fuel_regen, autocvar_g_balance_fuel_regenlinear, 
                                                                                frametime * (time > this.pauseregen_finished) * ((this.items & ITEM_JetpackRegen.m_itemid) != 0),
                                                                                maxf, autocvar_g_balance_fuel_rot, autocvar_g_balance_fuel_rotlinear, frametime * (time > this.pauserotfuel_finished), limitf));
        }
@@ -1657,15 +1657,15 @@ void SpectateCopy(entity this, entity spectatee)
        MUTATOR_CALLHOOK(SpectateCopy, spectatee, this);
        PS(this) = PS(spectatee);
        this.armortype = spectatee.armortype;
-       SetResourceAmount(this, RES_ARMOR, GetResourceAmount(spectatee, RES_ARMOR));
-       SetResourceAmount(this, RES_CELLS, GetResourceAmount(spectatee, RES_CELLS));
-       SetResourceAmount(this, RES_PLASMA, GetResourceAmount(spectatee, RES_PLASMA));
-       SetResourceAmount(this, RES_SHELLS, GetResourceAmount(spectatee, RES_SHELLS));
-       SetResourceAmount(this, RES_BULLETS, GetResourceAmount(spectatee, RES_BULLETS));
-       SetResourceAmount(this, RES_ROCKETS, GetResourceAmount(spectatee, RES_ROCKETS));
-       SetResourceAmount(this, RES_FUEL, GetResourceAmount(spectatee, RES_FUEL));
+       SetResource(this, RES_ARMOR, GetResource(spectatee, RES_ARMOR));
+       SetResource(this, RES_CELLS, GetResource(spectatee, RES_CELLS));
+       SetResource(this, RES_PLASMA, GetResource(spectatee, RES_PLASMA));
+       SetResource(this, RES_SHELLS, GetResource(spectatee, RES_SHELLS));
+       SetResource(this, RES_BULLETS, GetResource(spectatee, RES_BULLETS));
+       SetResource(this, RES_ROCKETS, GetResource(spectatee, RES_ROCKETS));
+       SetResource(this, RES_FUEL, GetResource(spectatee, RES_FUEL));
        this.effects = spectatee.effects & EFMASK_CHEAP; // eat performance
-       SetResourceAmount(this, RES_HEALTH, GetResourceAmount(spectatee, RES_HEALTH));
+       SetResource(this, RES_HEALTH, GetResource(spectatee, RES_HEALTH));
        CS(this).impulse = 0;
        this.items = spectatee.items;
        STAT(LAST_PICKUP, this) = STAT(LAST_PICKUP, spectatee);
@@ -2173,7 +2173,7 @@ bool PlayerThink(entity this)
                }
 
                this.items_added = 0;
-               if ((this.items & ITEM_Jetpack.m_itemid) && ((this.items & ITEM_JetpackRegen.m_itemid) || GetResourceAmount(this, RES_FUEL) >= 0.01))
+               if ((this.items & ITEM_Jetpack.m_itemid) && ((this.items & ITEM_JetpackRegen.m_itemid) || GetResource(this, RES_FUEL) >= 0.01))
             this.items_added |= IT_FUEL;
 
                this.items |= this.items_added;
@@ -2429,7 +2429,7 @@ void PlayerPreThink (entity this)
                if (STAT(FROZEN, this) == FROZEN_TEMP_REVIVING)
                {
                        STAT(REVIVE_PROGRESS, this) = bound(0, STAT(REVIVE_PROGRESS, this) + frametime * this.revive_speed, 1);
-                       SetResourceAmount(this, RES_HEALTH, max(1, STAT(REVIVE_PROGRESS, this) * start_health));
+                       SetResource(this, RES_HEALTH, max(1, STAT(REVIVE_PROGRESS, this) * start_health));
                        this.iceblock.alpha = bound(0.2, 1 - STAT(REVIVE_PROGRESS, this), 1);
 
                        if (STAT(REVIVE_PROGRESS, this) >= 1)
@@ -2438,9 +2438,9 @@ void PlayerPreThink (entity this)
                else if (STAT(FROZEN, this) == FROZEN_TEMP_DYING)
                {
                        STAT(REVIVE_PROGRESS, this) = bound(0, STAT(REVIVE_PROGRESS, this) - frametime * this.revive_speed, 1);
-                       SetResourceAmount(this, RES_HEALTH, max(0, autocvar_g_nades_ice_health + (start_health-autocvar_g_nades_ice_health) * STAT(REVIVE_PROGRESS, this)));
+                       SetResource(this, RES_HEALTH, max(0, autocvar_g_nades_ice_health + (start_health-autocvar_g_nades_ice_health) * STAT(REVIVE_PROGRESS, this)));
 
-                       if (GetResourceAmount(this, RES_HEALTH) < 1)
+                       if (GetResource(this, RES_HEALTH) < 1)
                        {
                                if (this.vehicle)
                                        vehicles_exit(this.vehicle, VHEF_RELEASE);
@@ -2682,7 +2682,7 @@ void PlayerPostThink (entity this)
        }
 
        if (this.waypointsprite_attachedforcarrier) {
-               float hp = healtharmor_maxdamage(GetResourceAmount(this, RES_HEALTH), GetResourceAmount(this, RES_ARMOR), autocvar_g_balance_armor_blockpercent, DEATH_WEAPON.m_id).x;
+               float hp = healtharmor_maxdamage(GetResource(this, RES_HEALTH), GetResource(this, RES_ARMOR), autocvar_g_balance_armor_blockpercent, DEATH_WEAPON.m_id).x;
                WaypointSprite_UpdateHealth(this.waypointsprite_attachedforcarrier, hp);
        }
 
index aec9957c7b16d11cfd02010ee0b074e7697941ae..1395986b97bd3a463ab33c16e8508da381f992ca 100644 (file)
@@ -285,7 +285,7 @@ void ClientCommand_kill(entity caller, int request)
                        if(IS_SPEC(caller) || IS_OBSERVER(caller))
                                return; // no point warning about this, command does nothing
 
-                       if(GetResourceAmount(caller, RES_HEALTH) <= 0)
+                       if(GetResource(caller, RES_HEALTH) <= 0)
                        {
                                sprint(caller, "Can't die - you are already dead!\n");
                                return;
index 207a9c44a1a6724465730c85fce8c48df32de964..fd0375cb35fb02363cbb0698825a494c31aaed36 100644 (file)
@@ -405,7 +405,7 @@ void CommonCommand_editmob(int request, entity caller, int argc)
                                        if (mon.realowner != caller && autocvar_g_monsters_edit < 2) { print_to(caller, "This monster does not belong to you"); return; }
                                        if (!is_visible) { print_to(caller, "You must look at your monster to edit it"); return; }
 
-                                       Damage(mon, NULL, NULL, GetResourceAmount(mon, RES_HEALTH) + mon.max_health + 200, DEATH_KILL.m_id, DMG_NOWEP, mon.origin, '0 0 0');
+                                       Damage(mon, NULL, NULL, GetResource(mon, RES_HEALTH) + mon.max_health + 200, DEATH_KILL.m_id, DMG_NOWEP, mon.origin, '0 0 0');
                                        print_to(caller, strcat("Your pet '", mon.monster_name, "' has been brutally mutilated"));
                                        return;
                                }
index e13fffa01dee1ca64b29ca1b6f123800c197f123..5fdd924891316d3a51363250d241a423e770a824 100644 (file)
@@ -88,25 +88,25 @@ void target_init_use(entity this, entity actor, entity trigger)
 {
        if (!(this.spawnflags & 1))
        {
-               SetResourceAmount(actor, RES_ARMOR, start_armorvalue);
+               SetResource(actor, RES_ARMOR, start_armorvalue);
                actor.pauserotarmor_finished = time + autocvar_g_balance_pause_armor_rot;
        }
 
        if (!(this.spawnflags & 2))
        {
-               SetResourceAmount(actor, RES_HEALTH, start_health);
+               SetResource(actor, RES_HEALTH, start_health);
                actor.pauserothealth_finished = time + autocvar_g_balance_pause_health_rot;
                actor.pauseregen_finished = time + autocvar_g_balance_pause_health_regen;
        }
 
        if (!(this.spawnflags & 4))
        {
-               SetResourceAmount(actor, RES_SHELLS, start_ammo_shells);
-               SetResourceAmount(actor, RES_BULLETS, start_ammo_nails);
-               SetResourceAmount(actor, RES_ROCKETS, start_ammo_rockets);
-               SetResourceAmount(actor, RES_CELLS, start_ammo_cells);
-               SetResourceAmount(actor, RES_PLASMA, start_ammo_plasma);
-               SetResourceAmount(actor, RES_FUEL, start_ammo_fuel);
+               SetResource(actor, RES_SHELLS, start_ammo_shells);
+               SetResource(actor, RES_BULLETS, start_ammo_nails);
+               SetResource(actor, RES_ROCKETS, start_ammo_rockets);
+               SetResource(actor, RES_CELLS, start_ammo_cells);
+               SetResource(actor, RES_PLASMA, start_ammo_plasma);
+               SetResource(actor, RES_FUEL, start_ammo_fuel);
 
                STAT(WEAPONS, actor) = start_weapons;
                if (this.spawnflags & 32)
@@ -142,33 +142,33 @@ void target_give_init(entity this)
        IL_EACH(g_items, it.targetname == this.target,
        {
                if (it.classname == "weapon_devastator") {
-                       SetResourceAmount(this, RES_ROCKETS, GetResourceAmount(this, RES_ROCKETS) + it.count * WEP_CVAR_PRI(devastator, ammo)); // WEAPONTODO
+                       SetResource(this, RES_ROCKETS, GetResource(this, RES_ROCKETS) + it.count * WEP_CVAR_PRI(devastator, ammo)); // WEAPONTODO
                        this.netname = cons(this.netname, "devastator");
                }
                else if (it.classname == "weapon_vortex") {
-                       SetResourceAmount(this, RES_CELLS, GetResourceAmount(this, RES_CELLS) + it.count * WEP_CVAR_PRI(vortex, ammo)); // WEAPONTODO
+                       SetResource(this, RES_CELLS, GetResource(this, RES_CELLS) + it.count * WEP_CVAR_PRI(vortex, ammo)); // WEAPONTODO
                        this.netname = cons(this.netname, "vortex");
                }
                else if (it.classname == "weapon_electro") {
-                       SetResourceAmount(this, RES_CELLS, GetResourceAmount(this, RES_CELLS) + it.count * WEP_CVAR_PRI(electro, ammo)); // WEAPONTODO
+                       SetResource(this, RES_CELLS, GetResource(this, RES_CELLS) + it.count * WEP_CVAR_PRI(electro, ammo)); // WEAPONTODO
                        this.netname = cons(this.netname, "electro");
                }
                else if (it.classname == "weapon_hagar") {
-                       SetResourceAmount(this, RES_ROCKETS, GetResourceAmount(this, RES_ROCKETS) + it.count * WEP_CVAR_PRI(hagar, ammo)); // WEAPONTODO
+                       SetResource(this, RES_ROCKETS, GetResource(this, RES_ROCKETS) + it.count * WEP_CVAR_PRI(hagar, ammo)); // WEAPONTODO
                        this.netname = cons(this.netname, "hagar");
                }
                else if (it.classname == "weapon_crylink") {
-                       SetResourceAmount(this, RES_CELLS, GetResourceAmount(this, RES_CELLS) + it.count * WEP_CVAR_PRI(crylink, ammo)); // WEAPONTODO
+                       SetResource(this, RES_CELLS, GetResource(this, RES_CELLS) + it.count * WEP_CVAR_PRI(crylink, ammo)); // WEAPONTODO
                        this.netname = cons(this.netname, "crylink");
                }
                else if (it.classname == "weapon_mortar") {
-                       SetResourceAmount(this, RES_ROCKETS, GetResourceAmount(this, RES_ROCKETS) + it.count * WEP_CVAR_PRI(mortar, ammo)); // WEAPONTODO
+                       SetResource(this, RES_ROCKETS, GetResource(this, RES_ROCKETS) + it.count * WEP_CVAR_PRI(mortar, ammo)); // WEAPONTODO
                        this.netname = cons(this.netname, "mortar");
                }
                else if (it.classname == "item_armor_mega")
-                       SetResourceAmount(this, RES_ARMOR, 100);
+                       SetResource(this, RES_ARMOR, 100);
                else if (it.classname == "item_health_mega")
-                       SetResourceAmount(this, RES_HEALTH, 200);
+                       SetResource(this, RES_HEALTH, 200);
                //remove(it); // removing ents in init functions causes havoc, workaround:
         setthink(it, SUB_Remove);
         it.nextthink = time;
index fb755b705bcf4fabb7cacecdd52be329a9f3b89f..01b4926ecd743c04c21c54a2b02fba7c853c64e6 100644 (file)
@@ -216,7 +216,7 @@ bool frag_centermessage_override(entity attacker, entity targ, int deathtype, in
        if(deathtype == DEATH_FIRE.m_id)
        {
                Send_Notification(NOTIF_ONE, attacker, MSG_CHOICE, CHOICE_FRAG_FIRE, targ.netname, kill_count_to_attacker, (IS_BOT_CLIENT(targ) ? -1 : CS(targ).ping));
-               Send_Notification(NOTIF_ONE, targ, MSG_CHOICE, CHOICE_FRAGGED_FIRE, attacker.netname, kill_count_to_target, GetResourceAmount(attacker, RES_HEALTH), GetResourceAmount(attacker, RES_ARMOR), (IS_BOT_CLIENT(attacker) ? -1 : CS(attacker).ping));
+               Send_Notification(NOTIF_ONE, targ, MSG_CHOICE, CHOICE_FRAGGED_FIRE, attacker.netname, kill_count_to_target, GetResource(attacker, RES_HEALTH), GetResource(attacker, RES_ARMOR), (IS_BOT_CLIENT(attacker) ? -1 : CS(attacker).ping));
                return true;
        }
 
@@ -371,8 +371,8 @@ void Obituary(entity attacker, entity inflictor, entity targ, int deathtype, .en
                                        CHOICE_TYPEFRAGGED,
                                        attacker.netname,
                                        kill_count_to_target,
-                                       GetResourceAmount(attacker, RES_HEALTH),
-                                       GetResourceAmount(attacker, RES_ARMOR),
+                                       GetResource(attacker, RES_HEALTH),
+                                       GetResource(attacker, RES_ARMOR),
                                        (IS_BOT_CLIENT(attacker) ? -1 : CS(attacker).ping)
                                );
                        }
@@ -394,8 +394,8 @@ void Obituary(entity attacker, entity inflictor, entity targ, int deathtype, .en
                                        CHOICE_FRAGGED,
                                        attacker.netname,
                                        kill_count_to_target,
-                                       GetResourceAmount(attacker, RES_HEALTH),
-                                       GetResourceAmount(attacker, RES_ARMOR),
+                                       GetResource(attacker, RES_HEALTH),
+                                       GetResource(attacker, RES_ARMOR),
                                        (IS_BOT_CLIENT(attacker) ? -1 : CS(attacker).ping)
                                );
                        }
@@ -490,7 +490,7 @@ void Freeze(entity targ, float revivespeed, int frozen_type, bool show_waypoint)
 
        STAT(FROZEN, targ) = frozen_type;
        STAT(REVIVE_PROGRESS, targ) = ((frozen_type == FROZEN_TEMP_DYING) ? 1 : 0);
-       SetResourceAmount(targ, RES_HEALTH, ((frozen_type == FROZEN_TEMP_DYING) ? targ_maxhealth : 1));
+       SetResource(targ, RES_HEALTH, ((frozen_type == FROZEN_TEMP_DYING) ? targ_maxhealth : 1));
        targ.revive_speed = revivespeed;
        if(targ.bot_attack)
                IL_REMOVE(g_bot_targets, targ);
@@ -535,7 +535,7 @@ void Unfreeze(entity targ, bool reset_health)
                return;
 
        if (reset_health && STAT(FROZEN, targ) != FROZEN_TEMP_DYING)
-               SetResourceAmount(targ, RES_HEALTH, ((IS_PLAYER(targ)) ? start_health : targ.max_health));
+               SetResource(targ, RES_HEALTH, ((IS_PLAYER(targ)) ? start_health : targ.max_health));
 
        targ.pauseregen_finished = time + autocvar_g_balance_pause_health_regen;
 
@@ -595,9 +595,9 @@ void Damage(entity targ, entity inflictor, entity attacker, float damage, int de
                // These are ALWAYS lethal
                // No damage modification here
                // Instead, prepare the victim for his death...
-               SetResourceAmount(targ, RES_ARMOR, 0);
+               SetResource(targ, RES_ARMOR, 0);
                targ.spawnshieldtime = 0;
-               SetResourceAmount(targ, RES_HEALTH, 0.9); // this is < 1
+               SetResource(targ, RES_HEALTH, 0.9); // this is < 1
                targ.flags -= targ.flags & FL_GODMODE;
                damage = 100000;
        }
@@ -638,7 +638,7 @@ void Damage(entity targ, entity inflictor, entity attacker, float damage, int de
 
                                                        if(autocvar_g_mirrordamage_virtual)
                                                        {
-                                                               vector v  = healtharmor_applydamage(GetResourceAmount(attacker, RES_ARMOR), autocvar_g_balance_armor_blockpercent, deathtype, mirrordamage);
+                                                               vector v  = healtharmor_applydamage(GetResource(attacker, RES_ARMOR), autocvar_g_balance_armor_blockpercent, deathtype, mirrordamage);
                                                                attacker.dmg_take += v.x;
                                                                attacker.dmg_save += v.y;
                                                                attacker.dmg_inflictor = inflictor;
@@ -648,7 +648,7 @@ void Damage(entity targ, entity inflictor, entity attacker, float damage, int de
 
                                                        if(autocvar_g_friendlyfire_virtual)
                                                        {
-                                                               vector v = healtharmor_applydamage(GetResourceAmount(targ, RES_ARMOR), autocvar_g_balance_armor_blockpercent, deathtype, damage);
+                                                               vector v = healtharmor_applydamage(GetResource(targ, RES_ARMOR), autocvar_g_balance_armor_blockpercent, deathtype, damage);
                                                                targ.dmg_take += v.x;
                                                                targ.dmg_save += v.y;
                                                                targ.dmg_inflictor = inflictor;
@@ -694,7 +694,7 @@ void Damage(entity targ, entity inflictor, entity attacker, float damage, int de
                        if(autocvar_g_frozen_revive_falldamage > 0 && deathtype == DEATH_FALL.m_id && damage >= autocvar_g_frozen_revive_falldamage)
                        {
                                Unfreeze(targ, false);
-                               SetResourceAmount(targ, RES_HEALTH, autocvar_g_frozen_revive_falldamage_health);
+                               SetResource(targ, RES_HEALTH, autocvar_g_frozen_revive_falldamage_health);
                                Send_Effect(EFFECT_ICEORGLASS, targ.origin, '0 0 0', 3);
                                Send_Notification(NOTIF_ALL, NULL, MSG_INFO, INFO_FREEZETAG_REVIVED_FALL, targ.netname);
                                Send_Notification(NOTIF_ONE, targ, MSG_CENTER, CENTER_FREEZETAG_REVIVE_SELF);
index ad45fa1fb99c283473bebc95495a39b47949f1e0..e00096344df75f1b4c8bf39354c4721f2ca1f1eb 100644 (file)
@@ -338,7 +338,7 @@ void GrapplingHookTouch(entity this, entity toucher)
 
 void GrapplingHook_Damage(entity this, entity inflictor, entity attacker, float damage, int deathtype, .entity weaponentity, vector hitloc, vector force)
 {
-       if(GetResourceAmount(this, RES_HEALTH) <= 0)
+       if(GetResource(this, RES_HEALTH) <= 0)
                return;
 
        if (!W_CheckProjectileDamage(inflictor.realowner, this.realowner, deathtype, -1)) // no exceptions
@@ -346,7 +346,7 @@ void GrapplingHook_Damage(entity this, entity inflictor, entity attacker, float
 
        TakeResource(this, RES_HEALTH, damage);
 
-       if (GetResourceAmount(this, RES_HEALTH) <= 0)
+       if (GetResource(this, RES_HEALTH) <= 0)
        {
                if(attacker != this.realowner)
                {
@@ -397,7 +397,7 @@ void FireGrapplingHook(entity actor, .entity weaponentity)
 
        missile.effects = /*EF_FULLBRIGHT | EF_ADDITIVE |*/ EF_LOWPRECISION;
 
-       SetResourceAmount(missile, RES_HEALTH, autocvar_g_balance_grapplehook_health);
+       SetResource(missile, RES_HEALTH, autocvar_g_balance_grapplehook_health);
        missile.event_damage = GrapplingHook_Damage;
        missile.takedamage = DAMAGE_AIM;
        missile.damageforcescale = 0;
index 9c4b6f0ae0b99bf6c39066f29d677c3918f86705..c9560d8e7ee5960c036790b2a0f088eb0ac5fd50 100644 (file)
@@ -1523,7 +1523,7 @@ void FixIntermissionClient(entity e)
        if(!e.autoscreenshot) // initial call
        {
                e.autoscreenshot = time + 0.8;  // used for autoscreenshot
-               SetResourceAmount(e, RES_HEALTH, -2342);
+               SetResource(e, RES_HEALTH, -2342);
                // first intermission phase; voting phase has positive health (used to decide whether to send SVC_FINALE or not)
                for (int slot = 0; slot < MAX_WEAPONSLOTS; ++slot)
                {
index 7b33b89d8a66493d6bf24f58ec9e90a05232d631..eec081075d867e4242ed3fb9cb0330df6dcdb470 100644 (file)
@@ -591,9 +591,9 @@ void MapVote_Tick()
        int totalvotes = 0;
        FOREACH_CLIENT(IS_REAL_CLIENT(it), {
                // hide scoreboard again
-               if(GetResourceAmount(it, RES_HEALTH) != 2342)
+               if(GetResource(it, RES_HEALTH) != 2342)
                {
-                       SetResourceAmount(it, RES_HEALTH, 2342);
+                       SetResource(it, RES_HEALTH, 2342);
                        CS(it).impulse = 0;
 
                        msg_entity = it;
index ca867d374d0a09b1cd85a6e630adaa2bc2ee9f04..6e722797b5d6f71db0d631b47d7130726b07cb38 100644 (file)
@@ -280,8 +280,8 @@ string formatmessage(entity this, string msg)
                        case "%": replacement = "%"; break;
                        case "\\":replacement = "\\"; break;
                        case "n": replacement = "\n"; break;
-                       case "a": replacement = ftos(floor(GetResourceAmount(this, RES_ARMOR))); break;
-                       case "h": replacement = ftos(floor(GetResourceAmount(this, RES_HEALTH))); break;
+                       case "a": replacement = ftos(floor(GetResource(this, RES_ARMOR))); break;
+                       case "h": replacement = ftos(floor(GetResource(this, RES_HEALTH))); break;
                        case "l": replacement = NearestLocation(this.origin); break;
                        case "y": replacement = NearestLocation(cursor); break;
                        case "d": replacement = NearestLocation(this.death_origin); break;
@@ -660,15 +660,15 @@ void readplayerstartcvars()
                start_ammo_plasma = cvar("g_start_ammo_plasma");
                start_ammo_fuel = cvar("g_start_ammo_fuel");
                random_start_weapons_count = cvar("g_random_start_weapons_count");
-               SetResourceAmount(random_start_ammo, RES_SHELLS, cvar(
+               SetResource(random_start_ammo, RES_SHELLS, cvar(
                        "g_random_start_shells"));
-               SetResourceAmount(random_start_ammo, RES_BULLETS, cvar(
+               SetResource(random_start_ammo, RES_BULLETS, cvar(
                        "g_random_start_bullets"));
-               SetResourceAmount(random_start_ammo, RES_ROCKETS,
+               SetResource(random_start_ammo, RES_ROCKETS,
                        cvar("g_random_start_rockets"));
-               SetResourceAmount(random_start_ammo, RES_CELLS, cvar(
+               SetResource(random_start_ammo, RES_CELLS, cvar(
                        "g_random_start_cells"));
-               SetResourceAmount(random_start_ammo, RES_PLASMA, cvar(
+               SetResource(random_start_ammo, RES_PLASMA, cvar(
                        "g_random_start_plasma"));
        }
 
@@ -738,16 +738,16 @@ void readplayerstartcvars()
        start_ammo_cells = max(0, start_ammo_cells);
        start_ammo_plasma = max(0, start_ammo_plasma);
        start_ammo_fuel = max(0, start_ammo_fuel);
-       SetResourceAmount(random_start_ammo, RES_SHELLS, max(0,
-               GetResourceAmount(random_start_ammo, RES_SHELLS)));
-       SetResourceAmount(random_start_ammo, RES_BULLETS, max(0,
-               GetResourceAmount(random_start_ammo, RES_BULLETS)));
-       SetResourceAmount(random_start_ammo, RES_ROCKETS, max(0,
-               GetResourceAmount(random_start_ammo, RES_ROCKETS)));
-       SetResourceAmount(random_start_ammo, RES_CELLS, max(0,
-               GetResourceAmount(random_start_ammo, RES_CELLS)));
-       SetResourceAmount(random_start_ammo, RES_PLASMA, max(0,
-               GetResourceAmount(random_start_ammo, RES_PLASMA)));
+       SetResource(random_start_ammo, RES_SHELLS, max(0,
+               GetResource(random_start_ammo, RES_SHELLS)));
+       SetResource(random_start_ammo, RES_BULLETS, max(0,
+               GetResource(random_start_ammo, RES_BULLETS)));
+       SetResource(random_start_ammo, RES_ROCKETS, max(0,
+               GetResource(random_start_ammo, RES_ROCKETS)));
+       SetResource(random_start_ammo, RES_CELLS, max(0,
+               GetResource(random_start_ammo, RES_CELLS)));
+       SetResource(random_start_ammo, RES_PLASMA, max(0,
+               GetResource(random_start_ammo, RES_PLASMA)));
 
        warmup_start_ammo_shells = max(0, warmup_start_ammo_shells);
        warmup_start_ammo_nails = max(0, warmup_start_ammo_nails);
index bdcd9012192eff0db0777aae70d7bf21f0853b1c..eec3317c02cdefaca99abebd02e078f22279742c 100644 (file)
@@ -703,14 +703,14 @@ MUTATOR_HOOKABLE(GetResourceLimit, EV_GetResourceLimit);
 
 /** Called when the amount of resource of an entity changes. See RES_*
 constants for resource types. Return true to forbid the change. */
-#define EV_SetResourceAmount(i, o) \
+#define EV_SetResource(i, o) \
        /** checked entity */ i(entity, MUTATOR_ARGV_0_entity) \
        /** resource type */  i(int, MUTATOR_ARGV_1_int) \
        /**/                  o(int, MUTATOR_ARGV_1_int) \
        /** amount */         i(float, MUTATOR_ARGV_2_float) \
        /**/                  o(float, MUTATOR_ARGV_2_float) \
        /**/
-MUTATOR_HOOKABLE(SetResourceAmount, EV_SetResourceAmount);
+MUTATOR_HOOKABLE(SetResource, EV_SetResource);
 
 /** Called after the amount of resource of an entity has changed. See RES_*
 constants for resource types. Amount wasted is the amount of resource that is
index 90736401d4af4fcc32c7509309536dcf099c1040..ce36cdfae2317edf032293c71e2f33e0c6e03dc6 100644 (file)
@@ -93,8 +93,8 @@ void CopyBody(entity this, float keepvelocity)
        clone.dphitcontentsmask = this.dphitcontentsmask;
        clone.death_time = this.death_time;
        clone.pain_finished = this.pain_finished;
-       SetResourceAmount(clone, RES_HEALTH, GetResourceAmount(this, RES_HEALTH));
-       SetResourceAmount(clone, RES_ARMOR, GetResourceAmount(this, RES_ARMOR));
+       SetResource(clone, RES_HEALTH, GetResource(this, RES_HEALTH));
+       SetResource(clone, RES_ARMOR, GetResource(this, RES_ARMOR));
        clone.armortype = this.armortype;
        clone.model = this.model;
        clone.modelindex = this.modelindex;
@@ -177,7 +177,7 @@ void PlayerCorpseDamage(entity this, entity inflictor, entity attacker, float da
        vector v;
        Violence_GibSplash_At(hitloc, force, 2, bound(0, damage, 200) / 16, this, attacker);
 
-       v = healtharmor_applydamage(GetResourceAmount(this, RES_ARMOR), autocvar_g_balance_armor_blockpercent, deathtype, damage);
+       v = healtharmor_applydamage(GetResource(this, RES_ARMOR), autocvar_g_balance_armor_blockpercent, deathtype, damage);
        take = v.x;
        save = v.y;
 
@@ -205,7 +205,7 @@ void PlayerCorpseDamage(entity this, entity inflictor, entity attacker, float da
        this.dmg_take = this.dmg_take + take;//max(take - 10, 0);
        this.dmg_inflictor = inflictor;
 
-       if (GetResourceAmount(this, RES_HEALTH) <= -autocvar_sv_gibhealth && this.alpha >= 0)
+       if (GetResource(this, RES_HEALTH) <= -autocvar_sv_gibhealth && this.alpha >= 0)
        {
                // don't use any animations as a gib
                this.frame = 0;
@@ -314,8 +314,8 @@ void PlayerDamage(entity this, entity inflictor, entity attacker, float damage,
        vector v;
        float excess;
 
-       dh = max(GetResourceAmount(this, RES_HEALTH), 0);
-       da = max(GetResourceAmount(this, RES_ARMOR), 0);
+       dh = max(GetResource(this, RES_HEALTH), 0);
+       da = max(GetResource(this, RES_ARMOR), 0);
 
        if(!DEATH_ISSPECIAL(deathtype))
        {
@@ -363,7 +363,7 @@ void PlayerDamage(entity this, entity inflictor, entity attacker, float damage,
        else
                Violence_GibSplash_At(hitloc, force, 2, bound(0, damage, 200) / 16, this, attacker);
 
-       v = healtharmor_applydamage(GetResourceAmount(this, RES_ARMOR), autocvar_g_balance_armor_blockpercent, deathtype, damage);
+       v = healtharmor_applydamage(GetResource(this, RES_ARMOR), autocvar_g_balance_armor_blockpercent, deathtype, damage);
        take = v.x;
        save = v.y;
 
@@ -392,8 +392,8 @@ void PlayerDamage(entity this, entity inflictor, entity attacker, float damage,
        }
 
        MUTATOR_CALLHOOK(PlayerDamage_SplitHealthArmor, inflictor, attacker, this, force, take, save, deathtype, damage);
-       take = bound(0, M_ARGV(4, float), GetResourceAmount(this, RES_HEALTH));
-       save = bound(0, M_ARGV(5, float), GetResourceAmount(this, RES_ARMOR));
+       take = bound(0, M_ARGV(4, float), GetResource(this, RES_HEALTH));
+       save = bound(0, M_ARGV(5, float), GetResource(this, RES_ARMOR));
        excess = max(0, damage - take - save);
 
        if(sound_allowed(MSG_BROADCAST, attacker))
@@ -436,7 +436,7 @@ void PlayerDamage(entity this, entity inflictor, entity attacker, float damage,
                                                                animdecide_setaction(this, ANIMACTION_PAIN2, true);
                                                }
                                        }
-                                       float myhp = GetResourceAmount(this, RES_HEALTH);
+                                       float myhp = GetResource(this, RES_HEALTH);
                                        if(myhp > 1)
                                        if(myhp < 25 || !(DEATH_WEAPONOF(deathtype).spawnflags & WEP_FLAG_CANCLIMB) || take > 20 || attacker != this)
                                        if(sound_allowed(MSG_BROADCAST, attacker))
@@ -458,7 +458,7 @@ void PlayerDamage(entity this, entity inflictor, entity attacker, float damage,
 
                        // throw off bot aim temporarily
                        float shake;
-                       if(IS_BOT_CLIENT(this) && GetResourceAmount(this, RES_HEALTH) >= 1)
+                       if(IS_BOT_CLIENT(this) && GetResource(this, RES_HEALTH) >= 1)
                        {
                                shake = damage * 5 / (bound(0,skill,100) + 1);
                                this.v_angle_x = this.v_angle.x + (random() * 2 - 1) * shake;
@@ -501,8 +501,8 @@ void PlayerDamage(entity this, entity inflictor, entity attacker, float damage,
                valid_damage_for_weaponstats = true;
        }
 
-       dh = dh - max(GetResourceAmount(this, RES_HEALTH), 0);
-       da = da - max(GetResourceAmount(this, RES_ARMOR), 0);
+       dh = dh - max(GetResource(this, RES_HEALTH), 0);
+       da = da - max(GetResource(this, RES_ARMOR), 0);
        if(valid_damage_for_weaponstats)
        {
                WeaponStats_LogDamage(awep.m_id, abot, this.(weaponentity).m_weapon.m_id, vbot, dh + da);
@@ -510,7 +510,7 @@ void PlayerDamage(entity this, entity inflictor, entity attacker, float damage,
 
        MUTATOR_CALLHOOK(PlayerDamaged, attacker, this, dh, da, hitloc, deathtype, damage);
 
-       if (GetResourceAmount(this, RES_HEALTH) < 1)
+       if (GetResource(this, RES_HEALTH) < 1)
        {
                float defer_ClientKill_Now_TeamChange;
                defer_ClientKill_Now_TeamChange = false;
@@ -584,7 +584,7 @@ void PlayerDamage(entity this, entity inflictor, entity attacker, float damage,
 
                // player could have been miraculously resuscitated ;)
                // e.g. players in freezetag get frozen, they don't really die
-               if(GetResourceAmount(this, RES_HEALTH) >= 1 || !(IS_PLAYER(this) || this.classname == "body"))
+               if(GetResource(this, RES_HEALTH) >= 1 || !(IS_PLAYER(this) || this.classname == "body"))
                        return;
 
                if (!this.respawn_time) // can be set in the mutator hook PlayerDies
@@ -670,7 +670,7 @@ void PlayerDamage(entity this, entity inflictor, entity attacker, float damage,
 
 bool PlayerHeal(entity targ, entity inflictor, float amount, float limit)
 {
-       if(GetResourceAmount(targ, RES_HEALTH) <= 0 || GetResourceAmount(targ, RES_HEALTH) >= limit)
+       if(GetResource(targ, RES_HEALTH) <= 0 || GetResource(targ, RES_HEALTH) >= limit)
                return false;
 
        GiveResourceWithLimit(targ, RES_HEALTH, amount, limit);
index 58c42110fd08f141b40752cc3fa21bc507e32017..fb09d352b2ec365e2a450b14d51a56d34d93c410 100644 (file)
@@ -199,8 +199,8 @@ float Portal_TeleportPlayer(entity teleporter, entity player)
        // reset fade counter
        teleporter.portal_wants_to_vanish = 0;
        teleporter.fade_time = ((autocvar_g_balance_portal_lifetime >= 0) ? time + autocvar_g_balance_portal_lifetime : 0);
-       SetResourceAmount(teleporter, RES_HEALTH, autocvar_g_balance_portal_health);
-       SetResourceAmount(teleporter.enemy, RES_HEALTH, autocvar_g_balance_portal_health);
+       SetResource(teleporter, RES_HEALTH, autocvar_g_balance_portal_health);
+       SetResource(teleporter.enemy, RES_HEALTH, autocvar_g_balance_portal_health);
 
        return 1;
 }
@@ -436,7 +436,7 @@ void Portal_Damage(entity this, entity inflictor, entity attacker, float damage,
                if(IS_INDEPENDENT_PLAYER(attacker) || IS_INDEPENDENT_PLAYER(this.aiment))
                        return;
        TakeResource(this, RES_HEALTH, damage);
-       if(GetResourceAmount(this, RES_HEALTH) < 0)
+       if(GetResource(this, RES_HEALTH) < 0)
                Portal_Remove(this, 1);
 }
 
@@ -639,7 +639,7 @@ entity Portal_Spawn(entity own, vector org, vector ang)
        portal.takedamage = DAMAGE_AIM;
        portal.event_damage = Portal_Damage;
        portal.fade_time = ((autocvar_g_balance_portal_lifetime >= 0) ? time + autocvar_g_balance_portal_lifetime : 0);
-       SetResourceAmount(portal, RES_HEALTH, autocvar_g_balance_portal_health);
+       SetResource(portal, RES_HEALTH, autocvar_g_balance_portal_health);
        setmodel(portal, MDL_PORTAL);
        portal.savemodelindex = portal.modelindex;
        setcefc(portal, Portal_Customize);
index b894d6d1f74fab6af9726230d62154e57c7b9e5c..4ff31c3c066e191341a231836075eebc683c84a9 100644 (file)
@@ -71,14 +71,14 @@ float GetResourceLimit(entity e, int res_type)
        return limit;
 }
 
-float GetResourceAmount(entity e, int res_type)
+float GetResource(entity e, int res_type)
 {
        return e.(GetResourceField(res_type));
 }
 
-void SetResourceAmount(entity e, int res_type, float amount)
+void SetResource(entity e, int res_type, float amount)
 {
-       bool forbid = MUTATOR_CALLHOOK(SetResourceAmount, e, res_type, amount);
+       bool forbid = MUTATOR_CALLHOOK(SetResource, e, res_type, amount);
        if (forbid)
        {
                return;
@@ -122,7 +122,7 @@ void GiveResource(entity receiver, int res_type, float amount)
        {
                return;
        }
-       SetResourceAmount(receiver, res_type, GetResourceAmount(receiver, res_type) + amount);
+       SetResource(receiver, res_type, GetResource(receiver, res_type) + amount);
        switch (res_type)
        {
                case RES_HEALTH:
@@ -166,7 +166,7 @@ void GiveResourceWithLimit(entity receiver, int res_type, float amount, float li
        {
                return;
        }
-       float current_amount = GetResourceAmount(receiver, res_type);
+       float current_amount = GetResource(receiver, res_type);
        if (current_amount + amount > limit && limit != RES_LIMIT_NONE)
        {
                amount = limit - current_amount;
@@ -191,7 +191,7 @@ void TakeResource(entity receiver, int res_type, float amount)
        {
                return;
        }
-       SetResourceAmount(receiver, res_type, GetResourceAmount(receiver, res_type) - amount);
+       SetResource(receiver, res_type, GetResource(receiver, res_type) - amount);
 }
 
 void TakeResourceWithLimit(entity receiver, int res_type, float amount, float limit)
@@ -212,7 +212,7 @@ void TakeResourceWithLimit(entity receiver, int res_type, float amount, float li
        {
                return;
        }
-       float current_amount = GetResourceAmount(receiver, res_type);
+       float current_amount = GetResource(receiver, res_type);
        if (current_amount - amount < -limit)
        {
                amount = -limit + current_amount;
index 6a54bf2e86aa60287bdcf2cc5932fe41ae549f6b..b5e188b62062b8bba29cd4049f818485a346a766 100644 (file)
@@ -19,14 +19,14 @@ float GetResourceLimit(entity e, int res_type);
 /// \param[in] e Entity to check.
 /// \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 res_type);
+float GetResource(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] 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 res_type, float amount);
+void SetResource(entity e, int res_type, float amount);
 
 /// \brief Gives an entity some resource.
 /// \param[in,out] receiver Entity to give resource to.
index 0eb3ec661c5ea3822a9dc210dba2dd25ff998389..2f7dc88ba1436fffc693778aba98ddcdfad4100e 100644 (file)
@@ -2,7 +2,7 @@
 
 void test_weapons_hurt(entity this)
 {
-    EXPECT_NE(100, GetResourceAmount(this, RES_HEALTH));
+    EXPECT_NE(100, GetResource(this, RES_HEALTH));
     delete(this.enemy);
     delete(this);
 }
index b61cb303552241815daf1fbd61c2fedd1548b7db..ba17d3f1f893bdb2c42a7aa89fa4e674867ba548 100644 (file)
@@ -105,16 +105,16 @@ void weapon_defaultspawnfunc(entity this, Weapon e)
                        this.superweapons_finished = autocvar_g_balance_superweapons_time;
 
        // if we don't already have ammo, give us some ammo
-       if ((wpn.ammo_type != RES_NONE) && !GetResourceAmount(this, wpn.ammo_type))
+       if ((wpn.ammo_type != RES_NONE) && !GetResource(this, wpn.ammo_type))
        {
                switch (wpn.ammo_type)
                {
-                       case RES_SHELLS:  SetResourceAmount(this, wpn.ammo_type, cvar("g_pickup_shells_weapon"));  break;
-                       case RES_BULLETS: SetResourceAmount(this, wpn.ammo_type, cvar("g_pickup_nails_weapon"));   break;
-                       case RES_ROCKETS: SetResourceAmount(this, wpn.ammo_type, cvar("g_pickup_rockets_weapon")); break;
-                       case RES_CELLS:   SetResourceAmount(this, wpn.ammo_type, cvar("g_pickup_cells_weapon"));   break;
-                       case RES_PLASMA:  SetResourceAmount(this, wpn.ammo_type, cvar("g_pickup_plasma_weapon"));  break;
-                       case RES_FUEL:    SetResourceAmount(this, wpn.ammo_type, cvar("g_pickup_fuel_weapon"));    break;
+                       case RES_SHELLS:  SetResource(this, wpn.ammo_type, cvar("g_pickup_shells_weapon"));  break;
+                       case RES_BULLETS: SetResource(this, wpn.ammo_type, cvar("g_pickup_nails_weapon"));   break;
+                       case RES_ROCKETS: SetResource(this, wpn.ammo_type, cvar("g_pickup_rockets_weapon")); break;
+                       case RES_CELLS:   SetResource(this, wpn.ammo_type, cvar("g_pickup_cells_weapon"));   break;
+                       case RES_PLASMA:  SetResource(this, wpn.ammo_type, cvar("g_pickup_plasma_weapon"));  break;
+                       case RES_FUEL:    SetResource(this, wpn.ammo_type, cvar("g_pickup_fuel_weapon"));    break;
                }
        }
 
index 4c140a711dc992d0856435bf21011fbadfdb217f..af148393255aea59b5ab3902b165ed98b3d4f3a3 100644 (file)
@@ -104,7 +104,7 @@ float W_ThrowNewWeapon(entity own, float wpn, float doreduce, vector org, vector
                                GiveResource(own, ammotype, own.(weaponentity).(weapon_load[i]));
                                own.(weaponentity).(weapon_load[i]) = -1; // schedule the weapon for reloading
                        }
-                       SetResourceAmount(wep, ammotype, 0);
+                       SetResource(wep, ammotype, 0);
                }
                else if(doreduce)
                {
@@ -116,10 +116,10 @@ float W_ThrowNewWeapon(entity own, float wpn, float doreduce, vector org, vector
                                own.(weaponentity).(weapon_load[i]) = -1; // schedule the weapon for reloading
                        }
 
-                       float ownderammo = GetResourceAmount(own, ammotype);
-                       float thisammo = min(ownderammo, GetResourceAmount(wep, ammotype));
-                       SetResourceAmount(wep, ammotype, thisammo);
-                       SetResourceAmount(own, ammotype, ownderammo - thisammo);
+                       float ownderammo = GetResource(own, ammotype);
+                       float thisammo = min(ownderammo, GetResource(wep, ammotype));
+                       SetResource(wep, ammotype, thisammo);
+                       SetResource(own, ammotype, ownderammo - thisammo);
 
                        return thisammo;
                }
index 9c0c402e34722b1a03064d694a77cbf454c677b6..e7ab90c39eb2441408dcb86027b8de34e7c377d1 100644 (file)
@@ -454,7 +454,7 @@ void W_WeaponFrame(Player actor, .entity weaponentity)
        entity this = actor.(weaponentity);
        if (frametime) this.weapon_frametime = frametime;
 
-       if (!this || GetResourceAmount(actor, RES_HEALTH) < 1) return;  // Dead player can't use weapons and injure impulse commands
+       if (!this || GetResource(actor, RES_HEALTH) < 1) return;  // Dead player can't use weapons and injure impulse commands
 
        int button_atck = PHYS_INPUT_BUTTON_ATCK(actor);
        int button_atck2 = PHYS_INPUT_BUTTON_ATCK2(actor);
@@ -694,7 +694,7 @@ void W_DecreaseAmmo(Weapon wep, entity actor, float ammo_use, .entity weaponenti
        }
        else if (wep.ammo_type != RES_NONE)
        {
-               float ammo = GetResourceAmount(actor, wep.ammo_type);
+               float ammo = GetResource(actor, wep.ammo_type);
                if (ammo < ammo_use)
                {
                        backtrace(sprintf(
@@ -707,7 +707,7 @@ void W_DecreaseAmmo(Weapon wep, entity actor, float ammo_use, .entity weaponenti
                                ammo
                                             ));
                }
-               SetResourceAmount(actor, wep.ammo_type, ammo - ammo_use);
+               SetResource(actor, wep.ammo_type, ammo - ammo_use);
        }
 }
 
@@ -734,10 +734,10 @@ void W_ReloadedAndReady(Weapon thiswep, entity actor, .entity weaponentity, int
        else
        {
                // make sure we don't add more ammo than we have
-               float ammo = GetResourceAmount(actor, wpn.ammo_type);
+               float ammo = GetResource(actor, wpn.ammo_type);
                float load = min(w_ent.reload_ammo_amount - w_ent.clip_load, ammo);
                w_ent.clip_load += load;
-               SetResourceAmount(actor, wpn.ammo_type, ammo - load);
+               SetResource(actor, wpn.ammo_type, ammo - load);
        }
        w_ent.(weapon_load[w_ent.m_weapon.m_id]) = w_ent.clip_load;
 
@@ -781,7 +781,7 @@ void W_Reload(entity actor, .entity weaponentity, float sent_ammo_min, Sound sen
        // no ammo, so nothing to load
        if (e.ammo_type != RES_NONE)
        {
-               if (!GetResourceAmount(actor, e.ammo_type) && this.reload_ammo_min)
+               if (!GetResource(actor, e.ammo_type) && this.reload_ammo_min)
                {
                        if (!(actor.items & IT_UNLIMITED_WEAPON_AMMO))
                        {