fix evil grin getting triggered at level start (and by ID(K)FA) (#2162)

* fix evil grin getting triggered at level start (and by ID(K)FA)

* ad one extra ST_Start() call to prevent triggering from savegames
This commit is contained in:
Fabian Greffrath 2025-01-28 13:18:00 +01:00 committed by GitHub
parent 793d5fc4a1
commit 12bd1fed68
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 26 additions and 9 deletions

View File

@ -2715,6 +2715,8 @@ static boolean DoLoadGame(boolean do_load_autosave)
if (demorecording) // So this can only possibly be a -recordfrom command.
G_BeginRecording();// Start the -recordfrom, since the game was loaded.
ST_Start();
return true;
}

View File

@ -421,6 +421,7 @@ static void cheat_choppers(void)
{
plyr->weaponowned[wp_chainsaw] = true;
plyr->powers[pw_invulnerability] = true;
plyr->bonuscount += 2; // trigger evil grin now
displaymsg("%s", s_STSTR_CHOPPERS); // Ty 03/27/98 - externalized
}
@ -550,6 +551,7 @@ static void cheat_fa(void)
if (i!=am_cell || gamemode!=shareware)
plyr->ammo[i] = plyr->maxammo[i];
plyr->bonuscount += 2; // trigger evil grin now
displaymsg("%s", s_STSTR_FAADDED);
}
@ -1126,7 +1128,10 @@ static void cheat_weapx(char *buf)
if (w >= 0 && w < NUMWEAPONS)
{
if ((plyr->weaponowned[w] = !plyr->weaponowned[w]))
{
plyr->bonuscount += 2; // trigger evil grin now
displaymsg("Weapon Added"); // Ty 03/27/98 - *not* externalized
}
else
{
displaymsg("Weapon Removed"); // Ty 03/27/98 - *not* externalized

View File

@ -14,6 +14,7 @@
#ifndef ST_SBARDEF_H
#define ST_SBARDEF_H
#include "doomdef.h"
#include "doomtype.h"
#include "r_defs.h"
#include "v_video.h"
@ -180,6 +181,9 @@ typedef struct
int faceindex;
int facecount;
int oldhealth;
// used for evil grin
boolean oldweaponsowned[NUMWEAPONS];
} sbe_face_t;
typedef struct

View File

@ -126,9 +126,6 @@ static boolean hud_armor_type; // color of armor depends on type
static boolean weapon_carousel;
// used for evil grin
static boolean oldweaponsowned[NUMWEAPONS];
// [crispy] blinking key or skull in the status bar
int st_keyorskull[3];
@ -590,10 +587,13 @@ static void UpdateFace(sbe_face_t *face, player_t *player)
for (int i = 0; i < NUMWEAPONS; ++i)
{
if (oldweaponsowned[i] != player->weaponowned[i])
if (face->oldweaponsowned[i] != player->weaponowned[i])
{
doevilgrin = true;
oldweaponsowned[i] = player->weaponowned[i];
if (face->oldweaponsowned[i] < player->weaponowned[i])
{
doevilgrin = true;
}
face->oldweaponsowned[i] = player->weaponowned[i];
}
}
@ -1047,7 +1047,7 @@ static void UpdateStatusBar(player_t *player)
}
}
static void ResetElem(sbarelem_t *elem)
static void ResetElem(sbarelem_t *elem, player_t *player)
{
switch (elem->type)
{
@ -1064,6 +1064,10 @@ static void ResetElem(sbarelem_t *elem)
face->faceindex = 0;
face->facecount = 0;
face->oldhealth = -1;
for (int i = 0; i < NUMWEAPONS; i++)
{
face->oldweaponsowned[i] = player->weaponowned[i];
}
}
break;
@ -1096,19 +1100,21 @@ static void ResetElem(sbarelem_t *elem)
sbarelem_t *child;
array_foreach(child, elem->children)
{
ResetElem(child);
ResetElem(child, player);
}
}
static void ResetStatusBar(void)
{
player_t *player = &players[displayplayer];
statusbar_t *local_statusbar;
array_foreach(local_statusbar, sbardef->statusbars)
{
sbarelem_t *child;
array_foreach(child, local_statusbar->children)
{
ResetElem(child);
ResetElem(child, player);
}
}