mirror of
https://github.com/ZDoom/gzdoom.git
synced 2024-11-29 15:22:08 +00:00
APROP_SoundClass inits a default value and checks for null pointers
- Gave default init value to SoundClass as "Player" - Changed SoundClass detection to use the if/else structure - Checked for null pointer in S_FindSkinnedSound when reading the player's sound class
This commit is contained in:
parent
852a96497d
commit
f6bdbfe535
2 changed files with 7 additions and 3 deletions
|
@ -391,7 +391,7 @@ public:
|
||||||
float BlendB = 0;
|
float BlendB = 0;
|
||||||
float BlendA = 0;
|
float BlendA = 0;
|
||||||
|
|
||||||
FString SoundClass;
|
FString SoundClass = "Player";
|
||||||
FString LogText; // [RH] Log for Strife
|
FString LogText; // [RH] Log for Strife
|
||||||
FString SubtitleText;
|
FString SubtitleText;
|
||||||
int SubtitleCounter;
|
int SubtitleCounter;
|
||||||
|
|
|
@ -1620,7 +1620,11 @@ static const char *GetSoundClass(AActor *pp)
|
||||||
}
|
}
|
||||||
auto sclass = player? pp->NameVar(NAME_SoundClass) : NAME_None;
|
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";
|
return sclass != NAME_None ? sclass.GetChars() : "player";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1638,7 +1642,7 @@ int S_FindSkinnedSound (AActor *actor, FSoundID refid)
|
||||||
|
|
||||||
if (actor != nullptr)
|
if (actor != nullptr)
|
||||||
{
|
{
|
||||||
pclass = actor->player->SoundClass;
|
if (actor->player != nullptr) pclass = actor->player->SoundClass;
|
||||||
if (actor->player != nullptr) gender = actor->player->userinfo.GetGender();
|
if (actor->player != nullptr) gender = actor->player->userinfo.GetGender();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
Loading…
Reference in a new issue