Skip to content

Commit

Permalink
Tweaks to setting health cvar
Browse files Browse the repository at this point in the history
If giving player health, flash screen, play power-up sound and close
console.
  • Loading branch information
bradharding committed Mar 25, 2017
1 parent e828598 commit b7f4dc0
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 12 deletions.
13 changes: 3 additions & 10 deletions src/c_cmds.c
Original file line number Diff line number Diff line change
Expand Up @@ -4389,9 +4389,6 @@ static void player_cvars_func2(char *cmd, char *parms)
if (!player->mo)
return;

if (value > player->health)
P_AddBonus(player, BONUSADD);

value = BETWEEN(health_min, value, maxhealth);

if (player->health <= 0)
Expand All @@ -4402,24 +4399,20 @@ static void player_cvars_func2(char *cmd, char *parms)
player->mo->health = value;
}
else
{
P_ResurrectPlayer(player, value);
C_HideConsole();
}
}
else if (!(player->cheats & CF_BUDDHA))
{
if (value < player->health)
{
P_DamageMobj(player->mo, NULL, NULL, player->health - value, false);
C_HideConsole();
}
else
{
player->health = value;
player->mo->health = value;
P_AddBonus(player, BONUSADD);
S_StartSound(NULL, sfx_getpow);
}

C_HideConsole();
}
}
}
Expand Down
3 changes: 1 addition & 2 deletions src/p_inter.c
Original file line number Diff line number Diff line change
Expand Up @@ -299,8 +299,7 @@ dboolean P_GiveFullAmmo(player_t *player)
//
void P_AddBonus(player_t *player, int amount)
{
if (!consoleactive)
player->bonuscount = MIN(player->bonuscount + amount, 3 * TICRATE);
player->bonuscount = MIN(player->bonuscount + amount, 3 * TICRATE);
}

//
Expand Down

0 comments on commit b7f4dc0

Please sign in to comment.