Fix incorrect obituary hit location

This commit is contained in:
smallmodel 2024-10-02 16:42:10 +02:00
parent 15e8a71249
commit 388ab210a7
No known key found for this signature in database
GPG key ID: 9F2D623CEDF08512
2 changed files with 14 additions and 10 deletions

View file

@ -2116,7 +2116,11 @@ G_PrintDeathMessageEmulated(const char *s1, const char *s2, char *attackerName,
return va("%c%s %s\n", hudColor, victimName, result1); return va("%c%s %s\n", hudColor, victimName, result1);
} else if (tolower(type) == 'p') { } else if (tolower(type) == 'p') {
if (*s2 == 'x') { if (*s2 == 'x') {
return va("%c%s %s %s\n", hudColor, victimName, result1, attackerName); if (s2[1] && s2[2]) {
return va("%c%s %s %s %s\n", hudColor, victimName, result1, attackerName, s2 + 2);
} else {
return va("%c%s %s %s\n", hudColor, victimName, result1, attackerName);
}
} else { } else {
return va("%c%s %s %s%s\n", hudColor, victimName, result1, attackerName, result2); return va("%c%s %s %s%s\n", hudColor, victimName, result1, attackerName, result2);
} }

View file

@ -2783,13 +2783,13 @@ void Player::Obituary(Entity *attacker, Entity *inflictor, int meansofdeath, int
} }
if (bDispLocation && g_obituarylocation->integer) { if (bDispLocation && g_obituarylocation->integer) {
str szConv1 = s1 + str(" ") + G_LocationNumToDispString(iLocation); str szConv2 = s2 + " in the " + G_LocationNumToDispString(iLocation);
if (dedicated->integer) { if (dedicated->integer) {
gi.Printf("%s %s\n", client->pers.netname, gi.LV_ConvertString(szConv1.c_str())); gi.Printf("%s %s\n", client->pers.netname, gi.LV_ConvertString(szConv2.c_str()));
} }
G_PrintDeathMessage(szConv1, s2.c_str(), "x", client->pers.netname, this, "s"); G_PrintDeathMessage(s1, szConv2.c_str(), "x", client->pers.netname, this, "s");
} else { } else {
if (dedicated->integer) { if (dedicated->integer) {
gi.Printf("%s %s\n", client->pers.netname, gi.LV_ConvertString(s1.c_str())); gi.Printf("%s %s\n", client->pers.netname, gi.LV_ConvertString(s1.c_str()));
@ -2904,20 +2904,20 @@ void Player::Obituary(Entity *attacker, Entity *inflictor, int meansofdeath, int
} }
if (bDispLocation && g_obituarylocation->integer) { if (bDispLocation && g_obituarylocation->integer) {
str szConv1 = s1 + str(" ") + G_LocationNumToDispString(iLocation); str szConv2 = s2 + " in the " + G_LocationNumToDispString(iLocation);
G_PrintDeathMessage( G_PrintDeathMessage(
szConv1.c_str(), s2.c_str(), attacker->client->pers.netname, client->pers.netname, this, "p" s1.c_str(), szConv2.c_str(), attacker->client->pers.netname, client->pers.netname, this, "p"
); );
if (dedicated->integer) { if (dedicated->integer) {
str szLoc1, szLoc2; str szLoc1, szLoc2;
szLoc1 = gi.LV_ConvertString(szConv1.c_str()); szLoc1 = gi.LV_ConvertString(s1.c_str());
if (s2 == 'x') { if (s2 == 'x') {
gi.Printf("%s %s %s\n", client->pers.netname, szLoc1.c_str(), attacker->client->pers.netname); gi.Printf("%s %s %s\n", client->pers.netname, szLoc1.c_str(), attacker->client->pers.netname);
} else { } else {
szLoc2 = gi.LV_ConvertString(s2.c_str()); szLoc2 = gi.LV_ConvertString(szConv2.c_str());
gi.Printf( gi.Printf(
"%s %s %s%s\n", "%s %s %s%s\n",
client->pers.netname, client->pers.netname,
@ -2991,9 +2991,9 @@ void Player::Obituary(Entity *attacker, Entity *inflictor, int meansofdeath, int
} }
if (bDispLocation && g_obituarylocation->integer) { if (bDispLocation && g_obituarylocation->integer) {
str szConv1 = s1 + str(" ") + G_LocationNumToDispString(iLocation); str szConv2 = s2 + " in the " + G_LocationNumToDispString(iLocation);
G_PrintDeathMessage(szConv1.c_str(), s2.c_str(), "x", client->pers.netname, this, "w"); G_PrintDeathMessage(s1.c_str(), szConv2.c_str(), "x", client->pers.netname, this, "w");
if (dedicated->integer) { if (dedicated->integer) {
gi.Printf("%s %s\n", client->pers.netname, gi.LV_ConvertString(s1.c_str())); gi.Printf("%s %s\n", client->pers.netname, gi.LV_ConvertString(s1.c_str()));