mirror of
https://github.com/ZDoom/qzdoom.git
synced 2024-12-11 21:21:47 +00:00
Made S_FindSkinnedSound to use GetSoundClass again
- I couldn't simply init SoundClass to NAME_SoundClass, even after converting it to the appropriate type. Probably because NAME_SoundClass hasn't been parsed from decorate yet. Instead, I change it to NAME_SoundClass through GetSoundClass if it's valid and currently "player". - The skin checker code in GetSoundClass now checks if the SoundClass is equal to NAME_SoundClass. This mechanism exists so that way reverting the SoundClass to NAME_SoundClass processes the skin soundclass code. If it's different, the code is not processed. - Just returns sclass. This is never null, so there's no need to check if so. - S_FindSkinnedSound just uses GetSoundClass. This makes sure skins are checked.
This commit is contained in:
parent
f6bdbfe535
commit
c7cd25cbcc
2 changed files with 16 additions and 10 deletions
|
@ -391,11 +391,14 @@ public:
|
|||
float BlendB = 0;
|
||||
float BlendA = 0;
|
||||
|
||||
FString SoundClass = "Player";
|
||||
//FString SoundClass = "player";
|
||||
FString SoundClass = "player";
|
||||
FString LogText; // [RH] Log for Strife
|
||||
FString SubtitleText;
|
||||
int SubtitleCounter;
|
||||
|
||||
//SoundClass != nullptr ? mo->StringVar(NAME_SoundClass) : "player";
|
||||
|
||||
DAngle MinPitch = 0.; // Viewpitch limits (negative is up, positive is down)
|
||||
DAngle MaxPitch = 0.;
|
||||
|
||||
|
|
|
@ -1611,21 +1611,24 @@ bool S_AreSoundsEquivalent (AActor *actor, int id1, int id2)
|
|||
static const char *GetSoundClass(AActor *pp)
|
||||
{
|
||||
auto player = pp->player;
|
||||
|
||||
/*I couldn't just init SoundClass to NAME_SoundClass, GZDoom won't launch at all. Probably because that info is not parsed by the time the variable is initialized.
|
||||
So I just SoundClass to NAME_SoundClass here if NAME_SoundClass is not null and the current SoundClass is player*/
|
||||
if (strcmp(pp->player->SoundClass.GetChars(), "player") == 0 && pp->NameVar(NAME_SoundClass) != NAME_None)
|
||||
pp->player->SoundClass = pp->NameVar(NAME_SoundClass).GetChars();
|
||||
|
||||
FString sclass = player ? pp->player->SoundClass.GetChars() : "player";
|
||||
|
||||
if (player != nullptr &&
|
||||
(player->mo == nullptr || !(player->mo->flags4 &MF4_NOSKIN)) &&
|
||||
(unsigned int)player->userinfo.GetSkin() >= PlayerClasses.Size() &&
|
||||
(unsigned)player->userinfo.GetSkin() < Skins.Size())
|
||||
(unsigned)player->userinfo.GetSkin() < Skins.Size() &&
|
||||
strcmp(pp->player->SoundClass.GetChars(),sclass) == 0)
|
||||
{
|
||||
return Skins[player->userinfo.GetSkin()].Name.GetChars();
|
||||
}
|
||||
auto sclass = player? pp->NameVar(NAME_SoundClass) : NAME_None;
|
||||
|
||||
if (sclass != NAME_None)
|
||||
pp->player->SoundClass = sclass.GetChars();
|
||||
else
|
||||
pp->player->SoundClass = "Player";
|
||||
|
||||
return sclass != NAME_None ? sclass.GetChars() : "player";
|
||||
return sclass;
|
||||
}
|
||||
|
||||
//==========================================================================
|
||||
|
@ -1642,7 +1645,7 @@ int S_FindSkinnedSound (AActor *actor, FSoundID refid)
|
|||
|
||||
if (actor != nullptr)
|
||||
{
|
||||
if (actor->player != nullptr) pclass = actor->player->SoundClass;
|
||||
if (actor->player != nullptr) pclass = GetSoundClass(actor);
|
||||
if (actor->player != nullptr) gender = actor->player->userinfo.GetGender();
|
||||
}
|
||||
else
|
||||
|
|
Loading…
Reference in a new issue