Skip to content

Commit 15f2ac4

Browse files
authored
Fix statting on death crash (diasurgical#8308)
1 parent 7217493 commit 15f2ac4

3 files changed

Lines changed: 15 additions & 3 deletions

File tree

Source/control/control_panel.cpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -680,6 +680,9 @@ void CheckChrBtns()
680680
{
681681
const Player &myPlayer = *MyPlayer;
682682

683+
if (myPlayer._pmode == PM_DEATH)
684+
return;
685+
683686
if (CharPanelButtonActive || myPlayer._pStatPts == 0)
684687
return;
685688

@@ -698,6 +701,11 @@ void CheckChrBtns()
698701

699702
void ReleaseChrBtns(bool addAllStatPoints)
700703
{
704+
const Player &myPlayer = *MyPlayer;
705+
706+
if (myPlayer._pmode == PM_DEATH)
707+
return;
708+
701709
CharPanelButtonActive = false;
702710
for (auto attribute : enum_values<CharacterAttribute>()) {
703711
auto buttonId = static_cast<size_t>(attribute);

Source/player.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2108,7 +2108,7 @@ void LoadPlrGFX(Player &player, player_graphic graphic)
21082108
return;
21092109

21102110
const HeroClass cls = GetPlayerSpriteClass(player._pClass);
2111-
const PlayerWeaponGraphic animWeaponId = GetPlayerWeaponGraphic(graphic, static_cast<PlayerWeaponGraphic>(player._pgfxnum & 0xF));
2111+
PlayerWeaponGraphic animWeaponId = GetPlayerWeaponGraphic(graphic, static_cast<PlayerWeaponGraphic>(player._pgfxnum & 0xF));
21122112

21132113
const PlayerSpriteData &spriteData = GetPlayerSpriteDataForClass(cls);
21142114
const char *path = spriteData.classPath.c_str();
@@ -2145,8 +2145,8 @@ void LoadPlrGFX(Player &player, player_graphic graphic)
21452145
szCel = "qm";
21462146
break;
21472147
case player_graphic::Death:
2148-
if (animWeaponId != PlayerWeaponGraphic::Unarmed)
2149-
return;
2148+
// Only one Death animation exists, for unarmed characters
2149+
animWeaponId = PlayerWeaponGraphic::Unarmed;
21502150
szCel = "dt";
21512151
break;
21522152
case player_graphic::Block:

docs/CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1414
- Music doesn't unmute when focus is lost on level transition with Auto Pause On Focus Lost disabled
1515
- Image ghosting visible on border of map in higher resolutions
1616

17+
#### Stability / Performance / System
18+
19+
- Crashes related to player graphics rendering in death state
20+
1721
## DevilutionX 1.5.2
1822

1923
### Bug Fixes

0 commit comments

Comments
 (0)