mirror of
https://github.com/ZDoom/qzdoom.git
synced 2024-12-12 13:42:53 +00:00
APROP_Soundclass update again
- Just set init for SoundClass to empty. - Removed code block from SetActorProperty for APROP_Soundclass that does nothing - Lower-cased soundclass in FSerializer - Created a new const char to read the player's soundclass. If the playerpawn returns NAME_None for it's default, then it will set defaultsoundclass to "player". After running the skin code, the function now returns defaultsoundclass or soundclass, depending if soundclass is empty or not. - Renamed GetSoundClass to S_GetSoundClass
This commit is contained in:
parent
a5cf0c6605
commit
acb4d89f52
5 changed files with 13 additions and 19 deletions
|
@ -391,7 +391,7 @@ public:
|
||||||
float BlendB = 0;
|
float BlendB = 0;
|
||||||
float BlendA = 0;
|
float BlendA = 0;
|
||||||
|
|
||||||
FString SoundClass = "";
|
FString SoundClass;
|
||||||
FString LogText; // [RH] Log for Strife
|
FString LogText; // [RH] Log for Strife
|
||||||
FString SubtitleText;
|
FString SubtitleText;
|
||||||
int SubtitleCounter;
|
int SubtitleCounter;
|
||||||
|
|
|
@ -4311,16 +4311,11 @@ void DLevelScript::DoSetActorProperty (AActor *actor, int property, int value)
|
||||||
case APROP_SoundClass:
|
case APROP_SoundClass:
|
||||||
if (actor->IsKindOf(NAME_PlayerPawn))
|
if (actor->IsKindOf(NAME_PlayerPawn))
|
||||||
{
|
{
|
||||||
if (actor->player != NULL)
|
if (actor->player != nullptr)
|
||||||
{
|
{
|
||||||
if(!strcmp(Level->Behaviors.LookupString(value), ""))
|
|
||||||
{
|
|
||||||
actor->player->SoundClass = "";
|
|
||||||
}
|
|
||||||
actor->player->SoundClass = Level->Behaviors.LookupString(value);
|
actor->player->SoundClass = Level->Behaviors.LookupString(value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
@ -4420,7 +4415,7 @@ int DLevelScript::GetActorProperty (int tid, int property)
|
||||||
case APROP_MaxStepHeight: return DoubleToACS(actor->MaxStepHeight);
|
case APROP_MaxStepHeight: return DoubleToACS(actor->MaxStepHeight);
|
||||||
case APROP_MaxDropOffHeight: return DoubleToACS(actor->MaxDropOffHeight);
|
case APROP_MaxDropOffHeight: return DoubleToACS(actor->MaxDropOffHeight);
|
||||||
case APROP_DamageType: return GlobalACSStrings.AddString(actor->DamageType.GetChars());
|
case APROP_DamageType: return GlobalACSStrings.AddString(actor->DamageType.GetChars());
|
||||||
case APROP_SoundClass: return GlobalACSStrings.AddString(GetSoundClass(actor));
|
case APROP_SoundClass: return GlobalACSStrings.AddString(S_GetSoundClass(actor));
|
||||||
|
|
||||||
default: return 0;
|
default: return 0;
|
||||||
}
|
}
|
||||||
|
@ -4494,7 +4489,7 @@ int DLevelScript::CheckActorProperty (int tid, int property, int value)
|
||||||
case APROP_Species: string = actor->GetSpecies().GetChars(); break;
|
case APROP_Species: string = actor->GetSpecies().GetChars(); break;
|
||||||
case APROP_NameTag: string = actor->GetTag(); break;
|
case APROP_NameTag: string = actor->GetTag(); break;
|
||||||
case APROP_DamageType: string = actor->DamageType.GetChars(); break;
|
case APROP_DamageType: string = actor->DamageType.GetChars(); break;
|
||||||
case APROP_SoundClass: string = GetSoundClass(actor); break;
|
case APROP_SoundClass: string = S_GetSoundClass(actor); break;
|
||||||
}
|
}
|
||||||
if (string == NULL) string = "";
|
if (string == NULL) string = "";
|
||||||
return (!stricmp(string, Level->Behaviors.LookupString(value)));
|
return (!stricmp(string, Level->Behaviors.LookupString(value)));
|
||||||
|
|
|
@ -1698,7 +1698,7 @@ void player_t::Serialize(FSerializer &arc)
|
||||||
("onground", onground)
|
("onground", onground)
|
||||||
("musinfoactor", MUSINFOactor)
|
("musinfoactor", MUSINFOactor)
|
||||||
("musinfotics", MUSINFOtics)
|
("musinfotics", MUSINFOtics)
|
||||||
("SoundClass", SoundClass);
|
("soundclass", SoundClass);
|
||||||
|
|
||||||
if (arc.isWriting ())
|
if (arc.isWriting ())
|
||||||
{
|
{
|
||||||
|
|
|
@ -1608,10 +1608,10 @@ bool S_AreSoundsEquivalent (AActor *actor, int id1, int id2)
|
||||||
//
|
//
|
||||||
//===========================================================================
|
//===========================================================================
|
||||||
|
|
||||||
const char *GetSoundClass(AActor *pp)
|
const char *S_GetSoundClass(AActor *pp)
|
||||||
{
|
{
|
||||||
auto player = pp->player;
|
auto player = pp->player;
|
||||||
|
const char *defaultsoundclass = pp->NameVar(NAME_SoundClass) == NAME_None ? "player" : pp->NameVar(NAME_SoundClass).GetChars();
|
||||||
if (player != nullptr &&
|
if (player != nullptr &&
|
||||||
(player->mo == nullptr || !(player->mo->flags4 &MF4_NOSKIN)) &&
|
(player->mo == nullptr || !(player->mo->flags4 &MF4_NOSKIN)) &&
|
||||||
(unsigned int)player->userinfo.GetSkin() >= PlayerClasses.Size() &&
|
(unsigned int)player->userinfo.GetSkin() >= PlayerClasses.Size() &&
|
||||||
|
@ -1620,9 +1620,8 @@ const char *GetSoundClass(AActor *pp)
|
||||||
{
|
{
|
||||||
return Skins[player->userinfo.GetSkin()].Name.GetChars();
|
return Skins[player->userinfo.GetSkin()].Name.GetChars();
|
||||||
}
|
}
|
||||||
auto sclass = player->SoundClass.IsEmpty() ? pp->NameVar(NAME_SoundClass).GetChars() : player->SoundClass.GetChars();
|
|
||||||
|
|
||||||
return sclass ? sclass : "player";
|
return player->SoundClass.IsEmpty() ? defaultsoundclass : player->SoundClass.GetChars();
|
||||||
}
|
}
|
||||||
|
|
||||||
//==========================================================================
|
//==========================================================================
|
||||||
|
@ -1639,7 +1638,7 @@ int S_FindSkinnedSound (AActor *actor, FSoundID refid)
|
||||||
|
|
||||||
if (actor != nullptr)
|
if (actor != nullptr)
|
||||||
{
|
{
|
||||||
if (actor->player != nullptr) pclass = GetSoundClass(actor);
|
if (actor->player != nullptr) pclass = S_GetSoundClass(actor);
|
||||||
if (actor->player != nullptr) gender = actor->player->userinfo.GetGender();
|
if (actor->player != nullptr) gender = actor->player->userinfo.GetGender();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -1684,7 +1683,7 @@ int S_FindSkinnedSoundEx (AActor *actor, const char *name, const char *extendedn
|
||||||
|
|
||||||
void S_MarkPlayerSounds (AActor *player)
|
void S_MarkPlayerSounds (AActor *player)
|
||||||
{
|
{
|
||||||
const char *playerclass = GetSoundClass(player);
|
const char *playerclass = S_GetSoundClass(player);
|
||||||
int classidx = S_FindPlayerClass(playerclass);
|
int classidx = S_FindPlayerClass(playerclass);
|
||||||
if (classidx < 0)
|
if (classidx < 0)
|
||||||
{
|
{
|
||||||
|
|
|
@ -70,7 +70,7 @@ bool S_AreSoundsEquivalent (AActor *actor, int id1, int id2);
|
||||||
bool S_AreSoundsEquivalent (AActor *actor, const char *name1, const char *name2);
|
bool S_AreSoundsEquivalent (AActor *actor, const char *name1, const char *name2);
|
||||||
int S_LookupPlayerSound (const char *playerclass, int gender, const char *logicalname);
|
int S_LookupPlayerSound (const char *playerclass, int gender, const char *logicalname);
|
||||||
int S_LookupPlayerSound (const char *playerclass, int gender, FSoundID refid);
|
int S_LookupPlayerSound (const char *playerclass, int gender, FSoundID refid);
|
||||||
const char *GetSoundClass(AActor *pp);
|
const char *S_GetSoundClass(AActor *pp);
|
||||||
int S_FindSkinnedSound (AActor *actor, FSoundID refid);
|
int S_FindSkinnedSound (AActor *actor, FSoundID refid);
|
||||||
int S_FindSkinnedSoundEx (AActor *actor, const char *logicalname, const char *extendedname);
|
int S_FindSkinnedSoundEx (AActor *actor, const char *logicalname, const char *extendedname);
|
||||||
int S_AddSound (const char *logicalname, const char *lumpname, FScanner *sc=NULL); // Add sound by lumpname
|
int S_AddSound (const char *logicalname, const char *lumpname, FScanner *sc=NULL); // Add sound by lumpname
|
||||||
|
|
Loading…
Reference in a new issue