mirror of
https://github.com/ZDoom/gzdoom.git
synced 2025-01-31 13:50:48 +00:00
- new method to define obituaries without modifying actors.
Adding strings to the language file named OBITUARY_{classname}_{damagetype} or OBITUARY_{classname} will now be detected automatically and override all other definitions. This not only allows damage type aware obituaries but also makes it easier to retroactively add them to mods that have none defined.
This commit is contained in:
parent
c89ae6358e
commit
1b43575580
1 changed files with 18 additions and 8 deletions
|
@ -188,7 +188,7 @@ void PronounMessage (const char *from, char *to, int pronoun, const char *victim
|
|||
//
|
||||
void ClientObituary (AActor *self, AActor *inflictor, AActor *attacker, int dmgflags, FName MeansOfDeath)
|
||||
{
|
||||
FString ret;
|
||||
FString ret, lookup;
|
||||
char gendermessage[1024];
|
||||
|
||||
// No obituaries for non-players, voodoo dolls or when not wanted
|
||||
|
@ -239,20 +239,30 @@ void ClientObituary (AActor *self, AActor *inflictor, AActor *attacker, int dmgf
|
|||
messagename = "$OB_VOODOO";
|
||||
}
|
||||
|
||||
if (attacker != NULL && message == NULL)
|
||||
if (attacker != nullptr && message == nullptr)
|
||||
{
|
||||
if (attacker == self)
|
||||
{
|
||||
message = "$OB_KILLEDSELF";
|
||||
}
|
||||
else
|
||||
else
|
||||
{
|
||||
IFVIRTUALPTR(attacker, AActor, GetObituary)
|
||||
lookup.Format("$Obituary_%s_%s", attacker->GetClass()->TypeName, mod.GetChars());
|
||||
if (GStrings[lookup]) message = lookup;
|
||||
else
|
||||
{
|
||||
VMValue params[] = { attacker, self, inflictor, mod.GetIndex(), !!(dmgflags & DMG_PLAYERATTACK) };
|
||||
VMReturn rett(&ret);
|
||||
VMCall(func, params, countof(params), &rett, 1);
|
||||
if (ret.IsNotEmpty()) message = ret;
|
||||
lookup.Format("$Obituary_%s", attacker->GetClass()->TypeName, mod.GetChars());
|
||||
if (GStrings[lookup]) message = lookup;
|
||||
else
|
||||
{
|
||||
IFVIRTUALPTR(attacker, AActor, GetObituary)
|
||||
{
|
||||
VMValue params[] = { attacker, self, inflictor, mod.GetIndex(), !!(dmgflags & DMG_PLAYERATTACK) };
|
||||
VMReturn rett(&ret);
|
||||
VMCall(func, params, countof(params), &rett, 1);
|
||||
if (ret.IsNotEmpty()) message = ret;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue