sync monster mWhoHit and hitpoints

This commit is contained in:
qndel 2021-10-13 09:34:53 +02:00 committed by Anders Jenbo
commit b00feb4c3d
3 changed files with 13 additions and 1 deletions

View file

@ -408,6 +408,7 @@ void DeltaLeaveSync(BYTE bLevel)
delta._menemy = encode_enemy(monster);
delta._mhitpoints = monster._mhitpoints;
delta._mactive = monster._msquelch;
delta.mWhoHit = monster.mWhoHit;
}
memcpy(&sgLocals[bLevel].automapsv, AutomapView, sizeof(AutomapView));
}
@ -2062,6 +2063,8 @@ void delta_sync_monster(const TSyncMonster &monsterSync, uint8_t level)
monster._my = monsterSync._my;
monster._mactive = UINT8_MAX;
monster._menemy = monsterSync._menemy;
monster._mhitpoints = monsterSync._mhitpoints;
monster.mWhoHit = monsterSync.mWhoHit;
}
bool delta_portal_inited(int i)
@ -2171,8 +2174,10 @@ void DeltaLoadLevel()
monster.position.tile = { x, y };
monster.position.old = { x, y };
monster.position.future = { x, y };
if (sgLevels[currlevel].monster[i]._mhitpoints != -1)
if (sgLevels[currlevel].monster[i]._mhitpoints != -1) {
monster._mhitpoints = sgLevels[currlevel].monster[i]._mhitpoints;
monster.mWhoHit = sgLevels[currlevel].monster[i].mWhoHit;
}
if (sgLevels[currlevel].monster[i]._mhitpoints == 0) {
M_ClearSquares(i);
if (monster._mAi != AI_DIABLO) {