Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Blood: Add multiplayer support for hand enemies #864

Merged
merged 1 commit into from
Nov 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion source/blood/src/aihand.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ static void thinkChase(spritetype *pSprite, XSPRITE *pXSprite)
if (nDist < pDudeInfo->seeDist && klabs(nDeltaAngle) <= pDudeInfo->periphery)
{
aiSetTarget(pXSprite, pXSprite->target);
if (nDist < 0x233 && klabs(nDeltaAngle) < 85 && gGameOptions.nGameType == kGameTypeSinglePlayer)
if (nDist < 0x233 && klabs(nDeltaAngle) < 85 && (!VanillaMode() || gGameOptions.nGameType == kGameTypeSinglePlayer))
aiNewState(pSprite, pXSprite, &handJump);
return;
}
Expand Down
26 changes: 13 additions & 13 deletions source/blood/src/blood.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -114,8 +114,6 @@ char *pUserTiles = NULL;
char *pUserSoundRFF = NULL;
char *pUserRFF = NULL;

int gChokeCounter = 0;

double g_gameUpdateTime, g_gameUpdateAndDrawTime;
double g_gameUpdateAvgTime = 0.001;

Expand Down Expand Up @@ -582,6 +580,7 @@ void G_Polymer_UnInit(void)

PLAYER gPlayerTemp[kMaxPlayers];
int gHealthTemp[kMaxPlayers];
int gChokeCounter[kMaxPlayers];

vec3_t startpos;
int16_t startang, startsectnum;
Expand Down Expand Up @@ -739,6 +738,7 @@ void StartLevel(GAMEOPTIONS *gameOptions)
}
else if ((gGameOptions.nGameType == kGameTypeTeams) && !VanillaMode()) // if ctf mode and went to next level, reset scores
playerResetScores(i);
gChokeCounter[i] = 0;
playerStart(i, 1);
}
if (gameOptions->uGameFlags&kGameFlagContinuing) // if episode is in progress, restore player stats
Expand Down Expand Up @@ -777,7 +777,6 @@ void StartLevel(GAMEOPTIONS *gameOptions)
netResetState();
gCacheMiss = 0;
gFrame = 0;
gChokeCounter = 0;
if (!gDemo.at1)
gGameMenuMgr.Deactivate();
levelTryPlayMusicOrNothing(gGameOptions.nEpisode, gGameOptions.nLevel);
Expand Down Expand Up @@ -1114,8 +1113,18 @@ void ProcessFrame(void)
}
for (int i = connecthead; i >= 0; i = connectpoint2[i])
{
PLAYER *pPlayer = &gPlayer[i];
viewBackupView(i);
playerProcess(&gPlayer[i]);
playerProcess(pPlayer);
if (pPlayer->hand == 1)
{
gChokeCounter[i] += (kTicsPerFrame<<1);
while (gChokeCounter[i] >= kTicsPerSec)
{
gChoke.Process(pPlayer);
gChokeCounter[i] -= kTicsPerSec;
}
}
}
trProcessBusy();
evProcess((int)gFrameClock);
Expand All @@ -1132,15 +1141,6 @@ void ProcessFrame(void)
viewUpdateDelirium();
viewUpdateShake();
sfxUpdate3DSounds();
if (gMe->hand == 1)
{
gChokeCounter += (kTicsPerFrame<<1);
while (gChokeCounter >= kTicsPerSec)
{
gChoke.Process(gMe);
gChokeCounter -= kTicsPerSec;
}
}
gLevelTime++;
gFrame++;
gFrameClock += kTicsPerFrame;
Expand Down
6 changes: 4 additions & 2 deletions source/blood/src/player.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2009,10 +2009,12 @@ void playerProcess(PLAYER *pPlayer)
pPlayer->painEffect = ClipLow(pPlayer->painEffect-kTicsPerFrame, 0);
pPlayer->blindEffect = ClipLow(pPlayer->blindEffect-kTicsPerFrame, 0);
pPlayer->pickupEffect = ClipLow(pPlayer->pickupEffect-kTicsPerFrame, 0);
if (pPlayer == gMe && gMe->pXSprite->health == 0)
pPlayer->hand = 0;
if (!pXSprite->health)
{
if (!VanillaMode() || pPlayer == gMe)
pPlayer->hand = 0;
return;
}
pPlayer->isUnderwater = 0;
if (pPlayer->posture == kPostureSwim)
{
Expand Down
5 changes: 2 additions & 3 deletions source/blood/src/view.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4033,10 +4033,9 @@ void viewDrawScreen(void)
gViewMap.Process(cX, cY, nAng);
}
viewDrawInterface(delta);
int zn = ((gView->zWeapon-gView->zView-(12<<8))>>7)+220;
PLAYER *pPSprite = &gPlayer[gMe->pSprite->type-kDudePlayer1];
if (IsPlayerSprite(gMe->pSprite) && pPSprite->hand == 1)
if (IsPlayerSprite(gView->pSprite) && (gView->hand == 1))
{
int zn = ((gView->zWeapon-gView->zView-(12<<8))>>7)+220;
gChoke.Draw(160, zn);
}
if (byte_1A76C6)
Expand Down