MCPcopy Create free account
hub / github.com/diasurgical/devilution / StartPlrHit

Function StartPlrHit

Source/player.cpp:1624–1663  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1622}
1623
1624void StartPlrHit(int pnum, int dam, BOOL forcehit)
1625{
1626 int pd;
1627
1628 if ((DWORD)pnum >= MAX_PLRS) {
1629 app_fatal("StartPlrHit: illegal player %d", pnum);
1630 }
1631
1632 if (plr[pnum]._pInvincible && !plr[pnum]._pHitPoints && pnum == myplr) {
1633 SyncPlrKill(pnum, -1);
1634 return;
1635 }
1636
1637 if (plr[pnum]._pClass == PC_WARRIOR) {
1638 PlaySfxLoc(PS_WARR69, plr[pnum].WorldX, plr[pnum].WorldY);
1639#ifndef SPAWN
1640 } else if (plr[pnum]._pClass == PC_ROGUE) {
1641 PlaySfxLoc(PS_ROGUE69, plr[pnum].WorldX, plr[pnum].WorldY);
1642 } else if (plr[pnum]._pClass == PC_SORCERER) {
1643 PlaySfxLoc(PS_MAGE69, plr[pnum].WorldX, plr[pnum].WorldY);
1644#endif
1645 }
1646
1647 drawhpflag = TRUE;
1648 if (dam >> 6 >= plr[pnum]._pLevel || forcehit) {
1649 pd = plr[pnum]._pdir;
1650
1651 if (!(plr[pnum]._pGFXLoad & PFILE_HIT)) {
1652 LoadPlrGFX(pnum, PFILE_HIT);
1653 }
1654 NewPlrAnim(pnum, plr[pnum]._pHAnim[pd], plr[pnum]._pHFrames, 0, plr[pnum]._pHWidth);
1655
1656 plr[pnum]._pmode = PM_GOTHIT;
1657 FixPlayerLocation(pnum, pd);
1658 plr[pnum]._pVar8 = 1;
1659 FixPlrWalkTags(pnum);
1660 dPlayer[plr[pnum].WorldX][plr[pnum].WorldY] = pnum + 1;
1661 SetPlayerOld(pnum);
1662 }
1663}
1664
1665void RespawnDeadItem(ItemStruct *itm, int x, int y)
1666{

Callers 5

M_TryH2HHitFunction · 0.85
MissToMonstFunction · 0.85
PlayerMHitFunction · 0.85
Plr2PlrMHitFunction · 0.85
PlrHitPlrFunction · 0.85

Calls 8

app_fatalFunction · 0.85
SyncPlrKillFunction · 0.85
PlaySfxLocFunction · 0.85
LoadPlrGFXFunction · 0.85
NewPlrAnimFunction · 0.85
FixPlayerLocationFunction · 0.85
FixPlrWalkTagsFunction · 0.85
SetPlayerOldFunction · 0.85

Tested by

no test coverage detected