Skip to content

Commit

Permalink
Blood: Drop hand enemy after killing player for multiplayer
Browse files Browse the repository at this point in the history
  • Loading branch information
tmyqlfpir authored and Hendricks266 committed Dec 21, 2024
1 parent 70978b1 commit 159e638
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 14 deletions.
2 changes: 1 addition & 1 deletion source/blood/src/blood.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -750,8 +750,8 @@ 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);
gChokeCounter[i] = 0;
}
if (gameOptions->uGameFlags&kGameFlagContinuing) // if episode is in progress, restore player stats
{
Expand Down
31 changes: 18 additions & 13 deletions source/blood/src/player.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1525,6 +1525,19 @@ int ActionScan(PLAYER *pPlayer, int *a2, int *a3)
return -1;
}

inline void playerDropHand(PLAYER *pPlayer)
{
spritetype *pSprite2 = actSpawnDude(pPlayer->pSprite, kDudeHand, pPlayer->pSprite->clipdist<<1, 0);
pSprite2->ang = (pPlayer->pSprite->ang+1024)&2047;
int nSprite = pPlayer->pSprite->index;
int x = Cos(pPlayer->pSprite->ang)>>16;
int y = Sin(pPlayer->pSprite->ang)>>16;
xvel[pSprite2->index] = xvel[nSprite] + mulscale14(0x155555, x);
yvel[pSprite2->index] = yvel[nSprite] + mulscale14(0x155555, y);
zvel[pSprite2->index] = zvel[nSprite];
pPlayer->hand = 0;
}

void ProcessInput(PLAYER *pPlayer)
{
spritetype *pSprite = pPlayer->pSprite;
Expand Down Expand Up @@ -1768,18 +1781,8 @@ void ProcessInput(PLAYER *pPlayer)
}
if (pPlayer->handTime > 0)
pPlayer->handTime = ClipLow(pPlayer->handTime-kTicsPerFrame*(6-gGameOptions.nDifficulty), 0);
if (pPlayer->handTime <= 0 && pPlayer->hand)
{
spritetype *pSprite2 = actSpawnDude(pPlayer->pSprite, kDudeHand, pPlayer->pSprite->clipdist<<1, 0);
pSprite2->ang = (pPlayer->pSprite->ang+1024)&2047;
int nSprite = pPlayer->pSprite->index;
int x = Cos(pPlayer->pSprite->ang)>>16;
int y = Sin(pPlayer->pSprite->ang)>>16;
xvel[pSprite2->index] = xvel[nSprite] + mulscale14(0x155555, x);
yvel[pSprite2->index] = yvel[nSprite] + mulscale14(0x155555, y);
zvel[pSprite2->index] = zvel[nSprite];
pPlayer->hand = 0;
}
if (pPlayer->handTime <= 0 && pPlayer->hand) // if hand enemy successfully thrown off
playerDropHand(pPlayer);
pInput->keyFlags.action = 0;
}
if (gDemo.VanillaDemo())
Expand Down Expand Up @@ -2013,7 +2016,9 @@ void playerProcess(PLAYER *pPlayer)
pPlayer->pickupEffect = ClipLow(pPlayer->pickupEffect-kTicsPerFrame, 0);
if (!pXSprite->health)
{
if (!VanillaMode() || pPlayer == gMe)
if (pPlayer->hand && gGameOptions.nGameType != kGameTypeSinglePlayer && !VanillaMode())
playerDropHand(pPlayer);
else if (!VanillaMode() || pPlayer == gMe)
pPlayer->hand = 0;
return;
}
Expand Down

0 comments on commit 159e638

Please sign in to comment.