- added ACS CheckActprClass function

- fixed: When a blasted actor collided with another one this other actor's
  DONTBLAST flag was not checked.
- added a global DamageFactor actor property. All damage this actor takes is multiplied
  by this factor in addition to damage type specific damage factors.


SVN r1915 (trunk)
This commit is contained in:
Christoph Oelckers 2009-10-15 20:09:22 +00:00
parent efd3e7f94e
commit ce2e85c7b2
7 changed files with 42 additions and 7 deletions

View File

@ -1,4 +1,9 @@
October 15, 2009 (Changes by Graf Zahl)
- added ACS CheckActprClass function
- fixed: When a blasted actor collided with another one this other actor's
DONTBLAST flag was not checked.
- added a global DamageFactor actor property. All damage this actor takes is multiplied
by this factor in addition to damage type specific damage factors.
- added better earthquake functions for ACS and DECORATE.
October 10, 2009 (Changes by Graf Zahl)

View File

@ -850,6 +850,7 @@ public:
SWORD PainChance;
int PainThreshold;
FNameNoInit DamageType;
fixed_t DamageFactor;
FState *SpawnState;
FState *SeeState;

View File

@ -2429,6 +2429,7 @@ enum
APROP_NameTag = 21,
APROP_Score = 22,
APROP_Notrigger = 23,
APROP_DamageFactor = 24,
};
// These are needed for ACS's APROP_RenderStyle
@ -2593,6 +2594,10 @@ void DLevelScript::DoSetActorProperty (AActor *actor, int property, int value)
actor->Tag = FBehavior::StaticLookupString(value);
break;
case APROP_DamageFactor:
actor->DamageFactor = value;
break;
default:
// do nothing.
break;
@ -2625,6 +2630,7 @@ int DLevelScript::GetActorProperty (int tid, int property)
case APROP_Health: return actor->health;
case APROP_Speed: return actor->Speed;
case APROP_Damage: return actor->Damage; // Should this call GetMissileDamage() instead?
case APROP_DamageFactor:return actor->DamageFactor;
case APROP_Alpha: return actor->alpha;
case APROP_RenderStyle: for (int style = STYLE_None; style < STYLE_Count; ++style)
{ // Check for a legacy render style that matches.
@ -2685,6 +2691,7 @@ int DLevelScript::CheckActorProperty (int tid, int property, int value)
case APROP_Health:
case APROP_Speed:
case APROP_Damage:
case APROP_DamageFactor:
case APROP_Alpha:
case APROP_RenderStyle:
case APROP_Gravity:
@ -2900,6 +2907,7 @@ enum EACSFunctions
ACSF_SetUserVariable,
ACSF_GetUserVariable,
ACSF_Radius_Quake2,
ACSF_CheckActorClass,
};
int DLevelScript::SideFromID(int id, int side)
@ -3139,6 +3147,13 @@ int DLevelScript::CallFunction(int argCount, int funcIndex, SDWORD *args)
P_StartQuake(activator, args[0], args[1], args[2], args[3], args[4], FBehavior::StaticLookupString(args[5]));
break;
case ACSF_CheckActorClass:
{
AActor *a = args[0] == 0 ? (AActor *)activator : SingleActorFromTID(args[0], NULL);
return a->GetClass()->TypeName == FName(FBehavior::StaticLookupString(args[1]));
}
default:
break;
}

View File

@ -1009,6 +1009,8 @@ void P_DamageMobj (AActor *target, AActor *inflictor, AActor *source, int damage
if (damage <= 0) return;
}
}
damage = FixedMul(damage, target->DamageFactor);
if (damage <= 0) return;
damage = target->TakeSpecialDamage (inflictor, source, damage, mod);
}

View File

@ -886,8 +886,9 @@ bool PIT_CheckThing (AActor *thing, FCheckPosition &tm)
// Check for blasted thing running into another
if ((tm.thing->flags2 & MF2_BLASTED) && (thing->flags & MF_SHOOTABLE))
{
if (!(thing->flags2 & MF2_BOSS) && (thing->flags3 & MF3_ISMONSTER))
if (!(thing->flags2 & MF2_BOSS) && (thing->flags3 & MF3_ISMONSTER) && !(thing->flags3 & MF3_DONTBLAST))
{
// ideally this should take the mass factor into account
thing->velx += tm.thing->velx;
thing->vely += tm.thing->vely;
if ((thing->velx + thing->vely) > 3*FRACUNIT)

View File

@ -309,6 +309,10 @@ void AActor::Serialize (FArchive &arc)
{
arc << PainThreshold;
}
if (SaveVersion >= 1914)
{
arc << DamageFactor;
}
for(int i=0; i<10; i++) arc << uservar[i];

View File

@ -924,11 +924,17 @@ DEFINE_PROPERTY(damagetype, S, Actor)
//==========================================================================
//
//==========================================================================
DEFINE_PROPERTY(damagefactor, SF, Actor)
DEFINE_PROPERTY(damagefactor, ZF, Actor)
{
PROP_STRING_PARM(str, 0);
PROP_FIXED_PARM(id, 1);
if (str == NULL)
{
defaults->DamageFactor = id;
}
else
{
if (info->DamageFactors == NULL) info->DamageFactors=new DmgFactors;
FName dmgType;
@ -937,6 +943,7 @@ DEFINE_PROPERTY(damagefactor, SF, Actor)
(*info->DamageFactors)[dmgType]=id;
}
}
//==========================================================================
//