Fandom

Doom Wiki

Player face grins after restoring savefile

3,484pages on
this wiki
Add New Page
Talk0 Share

Ad blocker interference detected!


Wikia is a free-to-use site that makes money from advertising. We have a modified experience for viewers using ad blockers

Wikia is not accessible if you’ve made further modifications. Remove the custom ad blocker rule(s) and the page will load as expected.

The status bar face momentarily displays a malicious grin whenever the player obtains a new weapon. After a saved game is loaded, however, the grin also appears the first time any item is picked up, weapon or otherwise.

Technical

The malicious grin is triggered during the function ST_updateFaceWidget in st_stuff.c:

   if (plyr->bonuscount)
   {
       // picking up bonus
       doevilgrin = false;
   
       for (i=0;i<NUMWEAPONS;i++)
       {
           if (oldweaponsowned[i] != plyr->weaponowned[i])
           {
               doevilgrin = true;
               oldweaponsowned[i] = plyr->weaponowned[i];
           }
       }
       if (doevilgrin) 
       {
           // evil grin if just picked up weapon
           priority = 8;
           st_facecount = ST_EVILGRINCOUNT;
           st_faceindex = ST_calcPainOffset() + ST_EVILGRINOFFSET;
       }
   }

The bonuscount field is initially set to zero upon creation of the player thing (P_SpawnPlayer in p_mobj.c), but can be assigned a nonzero value by picking up almost any beneficial object (see the function P_TouchSpecialThing in p_inter.c). Because the variable oldweaponsowned is local to st_stuff.c, its value cannot be recorded in the savefile, so it contains uninitialized "junk" values the first time the above conditional statement is executed. Therefore, the bolded test is virtually guaranteed to return TRUE and produce a grinning face in that instance.

This bug can also manifest itself when the IDKFA or IDFA cheat code is invoked, because the cheats give weapons to the player by directly updating plyr->weaponowned, bypassing the status bar face completely (see the function ST_Responder in st_stuff.c). The next time the player collects any item, the status bar will then "notice" the change in weapons owned and the grinning face will be displayed at that time, even if the new item being collected is a weapon already possessed or an unrelated thing like a health bonus.

Also on Fandom

Random Wiki