Skip to content

Commit

Permalink
- Blood: Restore originally intended isRunning code that never work…
Browse files Browse the repository at this point in the history
…ed behind two CVARs to offer an alternative playing experience.

* `cl_bloodvanillarun` enables/disables the `isRunning` code that affects AI, bobbing and swaying.
* `cl_bloodvanillabobbing` enables/disables the `isRunning` code that affects bobbing and swaying, allowing only the `isRunning` AI changes.
  • Loading branch information
mjr4077au committed Jul 31, 2021
1 parent 9884d5f commit f6c7ed3
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 21 deletions.
2 changes: 2 additions & 0 deletions source/core/gamecvars.cpp
Expand Up @@ -82,6 +82,8 @@ CVARD(Bool, cl_showmagamt, false, CVAR_ARCHIVE, "show the amount of rounds left
CVARD(Bool, cl_nomeleeblur, false, CVAR_ARCHIVE, "enable/disable blur effect with melee weapons in SW")
CVARD(Bool, cl_exhumedoldturn, false, CVAR_ARCHIVE, "enable/disable legacy turning speed for Powerslave/Exhumed")
CVARD(Bool, cl_hudinterpolation, true, CVAR_ARCHIVE, "enable/disable HUD (weapon drawer) interpolation")
CVARD(Bool, cl_bloodvanillarun, true, CVAR_ARCHIVE, "enable/disable Blood's vanilla run mode")
CVARD(Bool, cl_bloodvanillabobbing, true, CVAR_ARCHIVE, "enable/disable Blood's vanilla bobbing while not using vanilla run mode")


CUSTOM_CVARD(Int, cl_autoaim, 1, CVAR_ARCHIVE|CVAR_USERINFO, "enable/disable weapon autoaim")
Expand Down
2 changes: 2 additions & 0 deletions source/core/gamecvars.h
Expand Up @@ -27,6 +27,8 @@ EXTERN_CVAR(Bool, cl_showmagamt)
EXTERN_CVAR(Bool, cl_nomeleeblur)
EXTERN_CVAR(Bool, cl_exhumedoldturn)
EXTERN_CVAR(Bool, cl_hudinterpolation)
EXTERN_CVAR(Bool, cl_bloodvanillarun)
EXTERN_CVAR(Bool, cl_bloodvanillabobbing)

EXTERN_CVAR(Bool, demorec_seeds_cvar)
EXTERN_CVAR(Bool, demoplay_diffs)
Expand Down
17 changes: 4 additions & 13 deletions source/games/blood/src/aicult.cpp
Expand Up @@ -303,7 +303,6 @@ static void cultThinkChase(DBloodActor* actor)
actor->dudeSlope = DivScale(pTarget->z-pSprite->z, nDist, 10);
switch (pSprite->type) {
case kDudeCultistTommy:
#if 0 // apparently this can never be entered.
if (nDist < 0x1e00 && nDist > 0xe00 && abs(nDeltaAngle) < 85 && !TargetNearExplosion(pTarget)
&& (pTarget->flags&2) && gGameOptions.nDifficulty > 2 && IsPlayerSprite(pTarget) && gPlayer[pTarget->type-kDudePlayer1].isRunning
&& Chance(0x8000))
Expand All @@ -327,9 +326,7 @@ static void cultThinkChase(DBloodActor* actor)
break;
}
}
else
#endif
if (nDist < 0x4600 && abs(nDeltaAngle) < 28)
else if (nDist < 0x4600 && abs(nDeltaAngle) < 28)
{
int hit = HitScan(pSprite, pSprite->z, dx, dy, 0, CLIPMASK1, 0);
switch (hit)
Expand Down Expand Up @@ -375,7 +372,7 @@ static void cultThinkChase(DBloodActor* actor)
break;
case kDudeCultistShotgun:
if (nDist < 0x2c00 && nDist > 0x1400 && !TargetNearExplosion(pTarget)
&& (pTarget->flags&2) && gGameOptions.nDifficulty >= 2 && IsPlayerSprite(pTarget) /*&& !gPlayer[pTarget->type-kDudePlayer1].isRunning*/
&& (pTarget->flags&2) && gGameOptions.nDifficulty >= 2 && IsPlayerSprite(pTarget) && !gPlayer[pTarget->type-kDudePlayer1].isRunning
&& Chance(0x8000))
{
int hit = HitScan(pSprite, pSprite->z, dx, dy, 0, CLIPMASK1, 0);
Expand Down Expand Up @@ -442,7 +439,6 @@ static void cultThinkChase(DBloodActor* actor)
}
break;
case kDudeCultistTesla:
#if 0
if (nDist < 0x1e00 && nDist > 0xe00 && !TargetNearExplosion(pTarget)
&& (pTarget->flags&2) && gGameOptions.nDifficulty > 2 && IsPlayerSprite(pTarget) && gPlayer[pTarget->type-kDudePlayer1].isRunning
&& Chance(0x8000))
Expand All @@ -466,9 +462,7 @@ static void cultThinkChase(DBloodActor* actor)
break;
}
}
else
#endif
if (nDist < 0x3200 && abs(nDeltaAngle) < 28)
else if (nDist < 0x3200 && abs(nDeltaAngle) < 28)
{
int hit = HitScan(pSprite, pSprite->z, dx, dy, 0, CLIPMASK1, 0);
switch (hit)
Expand Down Expand Up @@ -557,7 +551,6 @@ static void cultThinkChase(DBloodActor* actor)
}
break;
case kDudeCultistBeast:
#if 0
if (nDist < 0x1e00 && nDist > 0xe00 && !TargetNearExplosion(pTarget)
&& (pTarget->flags&2) && gGameOptions.nDifficulty > 2 && IsPlayerSprite(pTarget) && gPlayer[pTarget->type-kDudePlayer1].isRunning
&& Chance(0x8000))
Expand All @@ -581,9 +574,7 @@ static void cultThinkChase(DBloodActor* actor)
break;
}
}
else
#endif
if (nDist < 0x3200 && abs(nDeltaAngle) < 28)
else if (nDist < 0x3200 && abs(nDeltaAngle) < 28)
{
int hit = HitScan(pSprite, pSprite->z, dx, dy, 0, CLIPMASK1, 0);
switch (hit)
Expand Down
11 changes: 5 additions & 6 deletions source/games/blood/src/player.cpp
Expand Up @@ -1317,14 +1317,14 @@ void ProcessInput(PLAYER *pPlayer)
POSTURE *pPosture = &pPlayer->pPosture[pPlayer->lifeMode][pPlayer->posture];
InputPacket *pInput = &pPlayer->input;

// Originally, this was never able to be true due to sloppy input code in the original game.
// Allow it to become true behind a CVAR to offer an alternate playing experience if desired.
pPlayer->isRunning = !!(pInput->actions & SB_RUN) && !cl_bloodvanillarun;

if ((pInput->actions & SB_BUTTON_MASK) || pInput->fvel || pInput->svel || pInput->avel)
pPlayer->restTime = 0;
else if (pPlayer->restTime >= 0)
pPlayer->restTime += 4;

// This was just too broken. Every single place in the game depending on 'isRunning' will misbehave if this is set because originally it never worked as intended.
pPlayer->isRunning = false;// !!(pInput->actions& SB_RUN) && pPlayer->restTime <= 10;

WeaponProcess(pPlayer);
if (pXSprite->health == 0)
{
Expand Down Expand Up @@ -1666,8 +1666,7 @@ void playerProcess(PLAYER *pPlayer)
{
if (pXSprite->height < 256)
{
// taking a cue from BloodGDX here. Apparently due to poor coding in the original game this could never be true.
bool running = false;// pPlayer->isRunning;
bool running = pPlayer->isRunning && !cl_bloodvanillabobbing;
pPlayer->bobAmp = (pPlayer->bobAmp+pPosture->pace[running]*4) & 2047;
pPlayer->swayAmp = (pPlayer->swayAmp+(pPosture->pace[running]*4)/2) & 2047;
if (running)
Expand Down
4 changes: 2 additions & 2 deletions wadsrc/static/zscript/games/blood/ui/sbar.zs
Expand Up @@ -547,8 +547,8 @@ class BloodStatusBar : RazeStatusBar
else
DrawImage(nTile, (x, y), DI_ITEM_RELCENTER, style:STYLE_Normal, col: 0xff606060, translation:Translation.MakeID(Translation_Remap, 5));
}
DrawImage("BlinkIcon", (118.5, 185.5), DI_ITEM_RELCENTER, col:0xff606060);
DrawImage("BlinkIcon", (201.5, 185.5), DI_ITEM_RELCENTER, col:0xff606060);
DrawImage("BlinkIcon", (118.5, 185.5), DI_ITEM_RELCENTER, col:Raze.shadeToLight(pPlayer.isRunning || cl_bloodvanillarun ? 16 : 40));
DrawImage("BlinkIcon", (201.5, 185.5), DI_ITEM_RELCENTER, col:Raze.shadeToLight(pPlayer.isRunning || cl_bloodvanillarun ? 16 : 40));
if (pPlayer.throwPower)
{
TileHGauge("ThrowGauge", 124, 175.5, pPlayer.throwPower, 65536);
Expand Down

6 comments on commit f6c7ed3

@Tiddalick
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure what the intended behaviour is here, but turning off the vanillarun causes the fanatics to throw dynamite on skills of well done and above. The cultists just seem to sit there and spam the shotgun.
Maybe this is exactly what is supposed to happen?

@coelckers
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, it is. 'Originally intended' in this case means to assume that all code as written was supposed to get executed. But somewhere Blood screwed up and caused the 'isrunning' flag to never be set and several behavioral effects of having a running player never to be entered.

@Tiddalick
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fair enough,
I do recall that the fanatics throwing dynamite was a 'beta' thing, so perhaps this part of the code broke and was never fixed during development or the eventual vanilla behaviour was ultimately favoured.
Still, a good option to include here.
I wonder if other options in this style will be included, such as the leech life restoring health. Removing this function rather destroyed its variable use in single player.

@sinisterseed
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fair enough,
I do recall that the fanatics throwing dynamite was a 'beta' thing, so perhaps this part of the code broke and was never fixed during development or the eventual vanilla behaviour was ultimately favoured.
Still, a good option to include here.
I wonder if other options in this style will be included, such as the leech life restoring health. Removing this function rather destroyed its variable use in single player.

It wasn't a beta thing to my knowledge. It was like that in the original release, then some future patch broke it and never got fixed.

But what's different about the life leech?

@Tiddalick
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well, as far as I know in the original 1.00 release the lifeleech did what the name suggested. It damaged enemies and gave you life. If you ran out of souls then it damaged you to fire, like it does now.
This was patched/broken in future versions. Personally I liked this funtionality as it gave the weapon more of a purpose. While it does great fire damage (and is OK in bloodbath) it is rather pointless in single player I find.
Apparently it was changed in 1.1:
"In version 1.0 of Blood, the Life Leech was able to do a Vampiric attack which would heal Caleb up to 100 health points. This mechanic was changed in version 1.1 onwards."
NBlood allows (or used to) you to select the version 1.00 weapon properties. This changed the voodo doll to use the original logic, the lifeleech to steal life and the akimbo napalm to dual fire, rather than the bomblets it does from the Plasma pak.

As for the fanatics, you are right. Apparently:
1.00 Everyone throws dynamite
1.02 Noone throws dynamite
1.10 Cultists throw dynamite
https://twitter.com/SlappyCromwell/status/1071572374460473344

@sinisterseed
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Provided the necessary work wouldn't be too much for the task, I would like to have these properties supported myself.

More variety is always nice. This may necessitate menu entries as well, seeing how there'd be quite a few more toggles.

Please sign in to comment.