diff --git a/src/playsim/d_player.h b/src/playsim/d_player.h index 3dc3acc16..97460b427 100644 --- a/src/playsim/d_player.h +++ b/src/playsim/d_player.h @@ -391,7 +391,7 @@ public: float BlendB = 0; float BlendA = 0; - FString SoundClass; + FString SoundClass = "Player"; FString LogText; // [RH] Log for Strife FString SubtitleText; int SubtitleCounter; diff --git a/src/sound/s_advsound.cpp b/src/sound/s_advsound.cpp index 49660e9c2..80a3973da 100644 --- a/src/sound/s_advsound.cpp +++ b/src/sound/s_advsound.cpp @@ -1620,7 +1620,11 @@ static const char *GetSoundClass(AActor *pp) } auto sclass = player? pp->NameVar(NAME_SoundClass) : NAME_None; - sclass != NAME_None ? pp->player->SoundClass = sclass.GetChars() : (FString)"player"; + if (sclass != NAME_None) + pp->player->SoundClass = sclass.GetChars(); + else + pp->player->SoundClass = "Player"; + return sclass != NAME_None ? sclass.GetChars() : "player"; } @@ -1638,7 +1642,7 @@ int S_FindSkinnedSound (AActor *actor, FSoundID refid) if (actor != nullptr) { - pclass = actor->player->SoundClass; + if (actor->player != nullptr) pclass = actor->player->SoundClass; if (actor->player != nullptr) gender = actor->player->userinfo.GetGender(); } else