Skip to content

Commit

Permalink
Added compatibility option for the HUD OUCH face fix, both in the men…
Browse files Browse the repository at this point in the history
…u and via the cvar "hud-face-ouchfix".
  • Loading branch information
danij committed Jun 29, 2007
1 parent b63a9c4 commit 6548a34
Show file tree
Hide file tree
Showing 6 changed files with 54 additions and 46 deletions.
2 changes: 2 additions & 0 deletions doomsday/plugins/common/src/mn_menu.c
Expand Up @@ -1083,6 +1083,7 @@ static menuitem_t GameplayItems[] = {
# if __JDOOM__
{ITT_EFUNC, 0, "ZOMBIE PLAYERS CAN EXIT LEVELS :", M_ToggleVar, 0, NULL,
"game-zombiescanexit"},
{ITT_EFUNC, 0, "FIX OUCH FACE :", M_ToggleVar, 0, NULL, "hud-face-ouchfix"},
# endif
#endif
};
Expand Down Expand Up @@ -2941,6 +2942,7 @@ void M_DrawGameplay(void)
# endif
# if __JDOOM__
M_WriteMenuText(menu, idx++, yesno[cfg.zombiesCanExit != 0]);
M_WriteMenuText(menu, idx++, yesno[cfg.fixOuchFace != 0]);
# endif
#endif
}
Expand Down
3 changes: 3 additions & 0 deletions doomsday/plugins/jdoom/data/conhelp.txt
Expand Up @@ -868,6 +868,9 @@ desc = 1=Use EXACTLY DOOM's clipping code (disables DOOM bug fix).
[game-zombiescanexit]
desc = 1=Zombie players can exit levels (disables DOOM bug fix).

[hud-face-ouchfix]
desc = 1=Fix HUD OUCH face (enables DOOM bug fix).

[game-player-wallrun-northonly]
desc = 1=Players can only wallrun North (disables DOOM bug fix).

Expand Down
1 change: 1 addition & 0 deletions doomsday/plugins/jdoom/include/d_config.h
Expand Up @@ -140,6 +140,7 @@ typedef struct jdoom_config_s {
byte wallRunNorthOnly; // If handle large make exception for wallrunning
byte zombiesCanExit; // Zombie players can exit levels.
byte fallOff; // Objects fall under their own weight.
byte fixOuchFace;

// Automap stuff.
byte counterCheat;
Expand Down
1 change: 1 addition & 0 deletions doomsday/plugins/jdoom/src/d_console.c
Expand Up @@ -184,6 +184,7 @@ cvar_t gameCVars[] = {
{"game-objects-falloff", 0, CVT_BYTE, &cfg.fallOff, 0, 1},
{"game-zclip", 0, CVT_BYTE, &cfg.moveCheckZ, 0, 1},
{"game-corpse-sliding", 0, CVT_BYTE, &cfg.slidingCorpses, 0, 1},
{"hud-face-ouchfix", 0, CVT_BYTE, &cfg.fixOuchFace, 0, 1},

// Game state
{"game-fastmonsters", 0, CVT_BYTE, &fastparm, 0, 1},
Expand Down
1 change: 1 addition & 0 deletions doomsday/plugins/jdoom/src/d_main.c
Expand Up @@ -439,6 +439,7 @@ void D_PreInit(void)
cfg.avoidDropoffs = true;
cfg.moveBlock = false;
cfg.fallOff = true;
cfg.fixOuchFace = true;

cfg.statusbarAlpha = 1;
cfg.statusbarCounterAlpha = 1;
Expand Down
92 changes: 46 additions & 46 deletions doomsday/plugins/jdoom/src/st_stuff.c
Expand Up @@ -577,17 +577,16 @@ int ST_calcPainOffset(void)
*/
void ST_updateFaceWidget(void)
{
int i;
angle_t badguyangle;
angle_t diffang;
static int lastattackdown = -1;
static int priority = 0;
boolean doevilgrin;
player_t *plyr = &players[consoleplayer];
int i;
angle_t badguyangle;
angle_t diffang;
static int lastattackdown = -1;
static int priority = 0;
boolean doevilgrin;
player_t *plyr = &players[consoleplayer];

if(priority < 10)
{
// dead
{ // Player is dead.
if(!plyr->health)
{
priority = 9;
Expand All @@ -599,48 +598,50 @@ void ST_updateFaceWidget(void)
if(priority < 9)
{
if(plyr->bonuscount)
{
// picking up bonus
{ // Picking up a bonus.
doevilgrin = false;

for(i = 0; i < NUM_WEAPON_TYPES; i++)
for(i = 0; i < NUM_WEAPON_TYPES; ++i)
{
if(oldweaponsowned[i] != plyr->weaponowned[i])
{
doevilgrin = true;
oldweaponsowned[i] = plyr->weaponowned[i];
}
}

if(doevilgrin)
{
// evil grin if just picked up weapon
{ // Evil grin if just picked up weapon.
priority = 8;
st_facecount = ST_EVILGRINCOUNT;
st_faceindex = ST_calcPainOffset() + ST_EVILGRINOFFSET;
}
}

}

if(priority < 8)
{
if(plyr->damagecount && plyr->attacker &&
plyr->attacker != plyr->plr->mo)
{
// being attacked
{ // Being attacked.
priority = 7;

// DOOM BUG
// This test was inversed, thereby the OUCH face was NEVER used
// in normal gameplay as it requires the player recieving damage
// to end up with MORE health than he started with.

// Also, priority was not changed which would have resulted in a
// frame duration of only 1 tic.
// if(plyr->health - st_oldhealth > ST_MUCHPAIN)
if(st_oldhealth - plyr->health > ST_MUCHPAIN)

if((cfg.fixOuchFace?
(st_oldhealth - plyr->health) :
(plyr->health - st_oldhealth)) > ST_MUCHPAIN)
{
st_facecount = ST_TURNCOUNT;
st_faceindex = ST_calcPainOffset() + ST_OUCHOFFSET;
priority = 8;
if(cfg.fixOuchFace)
priority = 8; // Added to fix 1 tic issue.
}
else
{
Expand All @@ -649,46 +650,48 @@ void ST_updateFaceWidget(void)
plyr->attacker->pos[VX], plyr->attacker->pos[VY]);

if(badguyangle > plyr->plr->mo->angle)
{
// whether right or left
{ // Whether right or left.
diffang = badguyangle - plyr->plr->mo->angle;
i = diffang > ANG180;
}
else
{
// whether left or right
{ // Whether left or right.
diffang = plyr->plr->mo->angle - badguyangle;
i = diffang <= ANG180;
} // confusing, aint it?
}

st_facecount = ST_TURNCOUNT;
st_faceindex = ST_calcPainOffset();

if(diffang < ANG45)
{
// head-on
{ // Head-on.
st_faceindex += ST_RAMPAGEOFFSET;
}
else if(i)
{
// turn face right
{ // Turn face right.
st_faceindex += ST_TURNOFFSET;
}
else
{
// turn face left
{ // Turn face left.
st_faceindex += ST_TURNOFFSET + 1;
}
}
}
}

if(priority < 7)
{
// getting hurt because of your own damn stupidity
{ // Getting hurt because of your own damn stupidity.
if(plyr->damagecount)
{
if(plyr->health - st_oldhealth > ST_MUCHPAIN)
// DOOM BUG
// This test was inversed, thereby the OUCH face was NEVER used
// in normal gameplay as it requires the player recieving damage
// to end up with MORE health than he started with.
// if(plyr->health - st_oldhealth > ST_MUCHPAIN)

if((cfg.fixOuchFace?
(st_oldhealth - plyr->health) :
(plyr->health - st_oldhealth)) > ST_MUCHPAIN)
{
priority = 7;
st_facecount = ST_TURNCOUNT;
Expand All @@ -700,18 +703,17 @@ void ST_updateFaceWidget(void)
st_facecount = ST_TURNCOUNT;
st_faceindex = ST_calcPainOffset() + ST_RAMPAGEOFFSET;
}

}

}

if(priority < 6)
{
// rapid firing
{ // Rapid firing.
if(plyr->attackdown)
{
if(lastattackdown == -1)
{
lastattackdown = ST_RAMPAGEDELAY;
}
else if(!--lastattackdown)
{
priority = 5;
Expand All @@ -721,25 +723,24 @@ void ST_updateFaceWidget(void)
}
}
else
{
lastattackdown = -1;

}
}

if(priority < 5)
{
// invulnerability
if((P_GetPlayerCheats(plyr) & CF_GODMODE) || plyr->powers[PT_INVULNERABILITY])
{ // Invulnerability.
if((P_GetPlayerCheats(plyr) & CF_GODMODE) ||
plyr->powers[PT_INVULNERABILITY])
{
priority = 4;

st_faceindex = ST_GODFACE;
st_facecount = 1;

}

}

// look left or look right if the facecount has timed out
// Look left or look right if the facecount has timed out.
if(!st_facecount)
{
st_faceindex = ST_calcPainOffset() + (st_randomnumber % 3);
Expand All @@ -748,7 +749,6 @@ void ST_updateFaceWidget(void)
}

st_facecount--;

}

void ST_updateWidgets(void)
Expand Down

0 comments on commit 6548a34

Please sign in to comment.