- removed some redundant initializations from PClassActor constructor.

- Removed GibHealth function and integrated it into AActor::GetGibHealth.


SVN r2245 (scripting)
This commit is contained in:
Christoph Oelckers 2010-03-26 08:53:16 +00:00
parent 61d75b7cae
commit e553f9a34f
3 changed files with 4 additions and 11 deletions

View File

@ -176,8 +176,6 @@ PClassActor::PClassActor()
DamageFactors = NULL; DamageFactors = NULL;
PainChances = NULL; PainChances = NULL;
Obituary = Obituary;
HitObituary = HitObituary;
DeathHeight = -1; DeathHeight = -1;
BurnHeight = -1; BurnHeight = -1;
GibHealth = INT_MIN; GibHealth = INT_MIN;

View File

@ -314,15 +314,10 @@ void ClientObituary (AActor *self, AActor *inflictor, AActor *attacker)
// //
EXTERN_CVAR (Int, fraglimit) EXTERN_CVAR (Int, fraglimit)
static int GibHealth(AActor *actor)
{
return -abs(actor->GetGibHealth());
}
void AActor::Die (AActor *source, AActor *inflictor) void AActor::Die (AActor *source, AActor *inflictor)
{ {
// Handle possible unmorph on death // Handle possible unmorph on death
bool wasgibbed = (health < GibHealth(this)); bool wasgibbed = (health < GetGibHealth());
AActor *realthis = NULL; AActor *realthis = NULL;
int realstyle = 0; int realstyle = 0;
@ -333,7 +328,7 @@ void AActor::Die (AActor *source, AActor *inflictor)
{ {
if (wasgibbed) if (wasgibbed)
{ {
int realgibhealth = GibHealth(realthis); int realgibhealth = realthis->GetGibHealth();
if (realthis->health >= realgibhealth) if (realthis->health >= realgibhealth)
{ {
realthis->health = realgibhealth -1; // if morphed was gibbed, so must original be (where allowed) realthis->health = realgibhealth -1; // if morphed was gibbed, so must original be (where allowed)
@ -661,7 +656,7 @@ void AActor::Die (AActor *source, AActor *inflictor)
{ {
int flags4 = inflictor == NULL ? 0 : inflictor->flags4; int flags4 = inflictor == NULL ? 0 : inflictor->flags4;
int gibhealth = GibHealth(this); int gibhealth = GetGibHealth();
// Don't pass on a damage type this actor cannot handle. // Don't pass on a damage type this actor cannot handle.
// (most importantly, prevent barrels from passing on ice damage.) // (most importantly, prevent barrels from passing on ice damage.)

View File

@ -5561,7 +5561,7 @@ int AActor::GetGibHealth() const
if (gibhealth != INT_MIN) if (gibhealth != INT_MIN)
{ {
return gibhealth; return -abs(gibhealth);
} }
else if (gameinfo.gametype & GAME_DoomChex) else if (gameinfo.gametype & GAME_DoomChex)
{ {