const int IT_PICKUPMASK = IT_UNLIMITED_AMMO | IT_UNLIMITED_SUPERWEAPONS | IT_JETPACK | IT_FUEL_REGEN; // strength and invincible are handled separately
#ifdef SVQC
-const .float strength_finished = _STAT(STRENGTH_FINISHED);
+.float strength_finished; // NOTE: this field is used only by map entities, it does not directly apply the strength stat
const .float invincible_finished = _STAT(INVINCIBLE_FINISHED);
#define spawnfunc_body(item) \
BUFF_ONADD(BUFF_INVISIBLE)
{
- if(time < player.strength_finished && MUTATOR_IS_ENABLED(mutator_instagib))
+ if(time < STAT(STRENGTH_FINISHED, player) && MUTATOR_IS_ENABLED(mutator_instagib))
player.buff_invisible_prev_alpha = default_player_alpha; // we don't want to save the powerup's alpha, as player may lose the powerup while holding the buff
else
player.buff_invisible_prev_alpha = player.alpha;
BUFF_ONREM(BUFF_INVISIBLE)
{
- if(time < player.strength_finished && MUTATOR_IS_ENABLED(mutator_instagib))
+ if(time < STAT(STRENGTH_FINISHED, player) && MUTATOR_IS_ENABLED(mutator_instagib))
player.alpha = autocvar_g_instagib_invis_alpha;
else
player.alpha = player.buff_invisible_prev_alpha;
if (player.items & ITEM_Invisibility.m_itemid)
{
- play_countdown(player, player.strength_finished, SND_POWEROFF);
- if (time > player.strength_finished)
+ play_countdown(player, STAT(STRENGTH_FINISHED, player), SND_POWEROFF);
+ if (time > STAT(STRENGTH_FINISHED, player))
{
player.alpha = default_player_alpha;
player.exteriorweaponentity.alpha = default_weapon_alpha;
}
else
{
- if (time < player.strength_finished)
+ if (time < STAT(STRENGTH_FINISHED, player))
{
player.alpha = autocvar_g_instagib_invis_alpha;
player.exteriorweaponentity.alpha = autocvar_g_instagib_invis_alpha;
if (item.strength_finished)
{
pickedup = true;
- player.strength_finished = max(player.strength_finished, time) + item.strength_finished;
+ STAT(STRENGTH_FINISHED, player) = max(STAT(STRENGTH_FINISHED, player), time) + item.strength_finished;
}
if (item.invincible_finished)
{
}
}
- e.strength_finished = max(0, e.strength_finished - time);
+ STAT(STRENGTH_FINISHED, e) = max(0, STAT(STRENGTH_FINISHED, e) - time);
e.invincible_finished = max(0, e.invincible_finished - time);
e.superweapons_finished = max(0, e.superweapons_finished - time);
STAT(BUFF_TIME, e) = max(0, STAT(BUFF_TIME, e) - time);
PREGIVE(e, items);
PREGIVE_WEAPONS(e);
- PREGIVE(e, strength_finished);
+ PREGIVE(e, stat_STRENGTH_FINISHED);
PREGIVE(e, invincible_finished);
PREGIVE(e, superweapons_finished);
PREGIVE_RESOURCE(e, RES_BULLETS);
continue;
case "ALL":
got += GiveBit(e, items, ITEM_JetpackRegen.m_itemid, op, val);
- got += GiveValue(e, strength_finished, op, val);
+ got += GiveValue(e, stat_STRENGTH_FINISHED, op, val);
got += GiveValue(e, invincible_finished, op, val);
got += GiveValue(e, superweapons_finished, op, val);
got += GiveBit(e, items, IT_UNLIMITED_AMMO | IT_UNLIMITED_SUPERWEAPONS, op, val);
got += GiveBit(e, items, ITEM_JetpackRegen.m_itemid, op, val);
break;
case "strength":
- got += GiveValue(e, strength_finished, op, val);
+ got += GiveValue(e, stat_STRENGTH_FINISHED, op, val);
break;
case "invincible":
got += GiveValue(e, invincible_finished, op, val);
if(STAT(WEAPONS, e) & (it.m_wepset))
it.wr_init(it);
});
- POSTGIVE_VALUE(e, strength_finished, 1, SND_POWERUP, SND_POWEROFF);
+ POSTGIVE_VALUE(e, stat_STRENGTH_FINISHED, 1, SND_POWERUP, SND_POWEROFF);
POSTGIVE_VALUE(e, invincible_finished, 1, SND_Shield, SND_POWEROFF);
//POSTGIVE_VALUE(e, superweapons_finished, 1, SND_Null, SND_Null);
POSTGIVE_RESOURCE(e, RES_BULLETS, 0, SND_ITEMPICKUP, SND_Null);
if(!g_weaponarena && (STAT(WEAPONS, e) & WEPSET_SUPERWEAPONS))
e.superweapons_finished = autocvar_g_balance_superweapons_time;
- if(e.strength_finished <= 0)
- e.strength_finished = 0;
+ if(STAT(STRENGTH_FINISHED, e) <= 0)
+ STAT(STRENGTH_FINISHED, e) = 0;
else
- e.strength_finished += time;
+ STAT(STRENGTH_FINISHED, e) += time;
if(e.invincible_finished <= 0)
e.invincible_finished = 0;
else
vehic.invincible_finished = time + 0.1 + (random() * 0.1);
}
+ // NOTE: reusing .strength_finished here as a sound delay counter
if(vehic.strength_finished < time)
{
vehic.strength_finished = time + 10.922667; //soundlength("vehicles/racer_boost.wav");
if (skill > 6 && !(IS_ONGROUND(this)))
{
#define ROCKETJUMP_DAMAGE() WEP_CVAR(devastator, damage) * 0.8 \
- * ((this.strength_finished > time) ? autocvar_g_balance_powerup_strength_selfdamage : 1) \
+ * ((STAT(STRENGTH_FINISHED, this) > time) ? autocvar_g_balance_powerup_strength_selfdamage : 1) \
* ((this.invincible_finished > time) ? autocvar_g_balance_powerup_invincible_takedamage : 1)
// save some CPU cycles by checking trigger_hurt after checking
t = bound(0, 1 + t, 3);
if (skill > 3)
{
- if (time < this.strength_finished - 1) t += 0.5;
- if (time < it.strength_finished - 1) t -= 0.5;
+ if (time < STAT(STRENGTH_FINISHED, this) - 1) t += 0.5;
+ if (time < STAT(STRENGTH_FINISHED, it) - 1) t -= 0.5;
if (time < this.invincible_finished - 1) t += 0.2;
if (time < it.invincible_finished - 1) t -= 0.4;
}
this.personal.pauserothealth_finished = this.pauserothealth_finished;
this.personal.pauserotfuel_finished = this.pauserotfuel_finished;
this.personal.pauseregen_finished = this.pauseregen_finished;
- this.personal.strength_finished = this.strength_finished;
+ STAT(STRENGTH_FINISHED, this.personal) = STAT(STRENGTH_FINISHED, this);
this.personal.invincible_finished = this.invincible_finished;
this.personal.teleport_time = time;
break; // this part itself doesn't cheat, so let's not count this
this.pauserothealth_finished = time + this.personal.pauserothealth_finished - this.personal.teleport_time;
this.pauserotfuel_finished = time + this.personal.pauserotfuel_finished - this.personal.teleport_time;
this.pauseregen_finished = time + this.personal.pauseregen_finished - this.personal.teleport_time;
- this.strength_finished = time + this.personal.strength_finished - this.personal.teleport_time;
+ STAT(STRENGTH_FINISHED, this) = time + STAT(STRENGTH_FINISHED, this.personal) - this.personal.teleport_time;
this.invincible_finished = time + this.personal.invincible_finished - this.personal.teleport_time;
if(!autocvar_g_allow_checkpoints)
this.fade_time = 0;
this.pain_frame = 0;
this.pain_finished = 0;
- this.strength_finished = 0;
+ STAT(STRENGTH_FINISHED, this) = 0;
this.invincible_finished = 0;
this.superweapons_finished = 0;
this.air_finished = 0;
this.punchangle = '0 0 0';
this.punchvector = '0 0 0';
- this.strength_finished = 0;
+ STAT(STRENGTH_FINISHED, this) = 0;
this.invincible_finished = 0;
this.fire_endtime = -1;
STAT(REVIVE_PROGRESS, this) = 0;
{
if (this.items & ITEM_Strength.m_itemid)
{
- play_countdown(this, this.strength_finished, SND_POWEROFF);
+ play_countdown(this, STAT(STRENGTH_FINISHED, this), SND_POWEROFF);
this.effects = this.effects | (EF_BLUE | EF_ADDITIVE | EF_FULLBRIGHT);
- if (time > this.strength_finished)
+ if (time > STAT(STRENGTH_FINISHED, this))
{
this.items = this.items - (this.items & ITEM_Strength.m_itemid);
//Send_Notification(NOTIF_ALL, NULL, MSG_INFO, INFO_POWERDOWN_STRENGTH, this.netname);
}
else
{
- if (time < this.strength_finished)
+ if (time < STAT(STRENGTH_FINISHED, this))
{
this.items = this.items | ITEM_Strength.m_itemid;
if(!g_cts)
this.items = spectatee.items;
STAT(LAST_PICKUP, this) = STAT(LAST_PICKUP, spectatee);
STAT(HIT_TIME, this) = STAT(HIT_TIME, spectatee);
- this.strength_finished = spectatee.strength_finished;
+ STAT(STRENGTH_FINISHED, this) = STAT(STRENGTH_FINISHED, spectatee);
this.invincible_finished = spectatee.invincible_finished;
this.superweapons_finished = spectatee.superweapons_finished;
this.air_finished = spectatee.air_finished;
if (!(this.spawnflags & 8))
{
- actor.strength_finished = 0;
+ STAT(STRENGTH_FINISHED, actor) = 0;
actor.invincible_finished = 0;
if(STAT(BUFFS, actor)) // TODO: make a dropbuffs function to handle this
{
if(w != 0 || slot == 0)
s = strcat(s, ftos(w));
}
- if(time < player.strength_finished)
+ if(time < STAT(STRENGTH_FINISHED, player))
s = strcat(s, "S");
if(time < player.invincible_finished)
s = strcat(s, "I");