The reason this article is obsolete, in techno-Quake-geek terms, is that idsoftware introduced a meansOfDeath variable which makes it easy to know how somebody died. Thus the check for weapons is no longer necessary.
But, if you want to see what the fuss was about, read on...
Some Death Message mods used "the other way" to determine the weapon being used, and as such are not prone to the bug.
For details on how a proposed fix to the BFB, see the Technical Details below.
The flaw occurs in ClientObituary (of course) if you try to determine the weapon by looking at the weapon that the attacker is holding. Sometimes, attacker->client->pers.weapon->pickup_name appears to be "undefined" and the server has a page access violation and crashes when it tries to access it. It appears that attacker->client->pers.weapon is NULL. Here's the debugger output from Visual C++ 4.0:
// - attacker->client->pers.weapon->pickup_name 0x0466003a ""
// CXX0030: Error: expression cannot be evaluated
I've seen about 5 or 6 other Death Message mods and most of them rely on checking the pickup_name of the attacker's weapon without testing if pers.weapon is NULL. Thus, servers that are running your mods may crash because of this bug.
I don't know much about most of the Quake code, but perhaps the pers.weapon is reset when a player dies; perhaps in the same frame, later on, the other player's death is recorded and the code looks at the original player's weapon, and it crashes. Evidence that supports this is that one player's Obituary is printed but not the other's.
Other evidence for this is in the function ChangeWeapon in p_weapon.c:
if (!ent->client->pers.weapon) {
// dead
ent->client->ps.gunindex = 0;
return;
}
A conditional of this sort also appears in Cmd_WeapNext_f of g_cmds.c
and several other places. So this looks like the conditional to use
for testing if you can look at the attacker's weapon.
The only places I see pers.weapon assigned to are in ChangeWeapon (p_weapon.c) and InitClientPersistant (p_client.c), but in the latter case it appears that the item assigned is the standard-issue blaster ;-)
You can't rely on the classnames of the inflictors, because, for example, a blast has the same classname whether it comes from a HyperBlaster or a regular blaster, and rockets don't have any classnames at all. I really don't want to rely on things like radius damage and inflictor damage because these are likely to be changed by people who modify weapons and therefore could affect selection of the proper obituary, but that's what I've decided to do for ServObit 1.1 - at least partially.
If the inflictor can't identify the proper weapon, then it goes to look at the attacker's weapon, if it exists. Hopefully this will cover all the bases; but in an extremely rare situation, it might not be known which weapon was fired. In this case I can rely on ServObit's wildcard capabilities to catch such a situation.
A more concrete solution is to add a new field to the player type that records the "lastweapon" that hit them or somesuch; but, this would require changing code in other source files, possibly increasing the complexity of the mod and making it a little more difficult for other modifiers who include a death message package that takes this approach.
If you have other feedback, please email me. Thanks.
Email SteQve about the BFB.
Back to SteQve's No Frills Quake Mods Page
This page has been accessed times. It was last updated 12/20/97.