Skip to content

Commit

Permalink
Fix monster light on knockback (diasurgical#7122)
Browse files Browse the repository at this point in the history
  • Loading branch information
kphoenix137 authored Aug 8, 2024
1 parent 112e113 commit 75f42cc
Showing 1 changed file with 4 additions and 8 deletions.
12 changes: 4 additions & 8 deletions Source/monster.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -911,10 +911,7 @@ void Teleport(Monster &monster)
monster.occupyTile(*position, false);
monster.position.old = *position;
monster.direction = GetMonsterDirection(monster);

if (monster.lightId != NO_LIGHT) {
ChangeLightXY(monster.lightId, *position);
}
ChangeLightXY(monster.lightId, *position);
}

bool IsHardHit(Monster &target, unsigned dam)
Expand Down Expand Up @@ -1027,8 +1024,7 @@ bool MonsterWalk(Monster &monster)
monster.position.tile.y += monster.var2;
// dMonster is set here for backwards compatibility; without it, the monster would be invisible if loaded from a vanilla save.
monster.occupyTile(monster.position.tile, false);
if (monster.lightId != NO_LIGHT)
ChangeLightXY(monster.lightId, monster.position.tile);
ChangeLightXY(monster.lightId, monster.position.tile);
M_StartStand(monster, monster.direction);
} else { // We didn't reach new tile so update monster's "sub-tile" position
if (monster.animInfo.tickCounterOfCurrentFrame == 0) {
Expand All @@ -1037,8 +1033,7 @@ bool MonsterWalk(Monster &monster)
}
}

if (monster.lightId != NO_LIGHT)
SyncLightPosition(monster);
SyncLightPosition(monster);

return isAnimationEnd;
}
Expand Down Expand Up @@ -3748,6 +3743,7 @@ void M_GetKnockback(Monster &monster)
M_ClearSquares(monster);
monster.position.old += dir;
StartMonsterGotHit(monster);
ChangeLightXY(monster.lightId, monster.position.tile);
}

void M_StartHit(Monster &monster, int dam)
Expand Down

0 comments on commit 75f42cc

Please sign in to comment.