diff --git a/docs/rh-log.txt b/docs/rh-log.txt index 21ddc8fe1..4e0901290 100644 --- a/docs/rh-log.txt +++ b/docs/rh-log.txt @@ -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) diff --git a/src/actor.h b/src/actor.h index 0b9605def..2c3b80108 100644 --- a/src/actor.h +++ b/src/actor.h @@ -850,6 +850,7 @@ public: SWORD PainChance; int PainThreshold; FNameNoInit DamageType; + fixed_t DamageFactor; FState *SpawnState; FState *SeeState; diff --git a/src/p_acs.cpp b/src/p_acs.cpp index 2e8f0050d..f7a5ef070 100644 --- a/src/p_acs.cpp +++ b/src/p_acs.cpp @@ -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; } diff --git a/src/p_interaction.cpp b/src/p_interaction.cpp index 0602226f8..22d8cdc81 100644 --- a/src/p_interaction.cpp +++ b/src/p_interaction.cpp @@ -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); } diff --git a/src/p_map.cpp b/src/p_map.cpp index 65ff3be78..644f599c6 100644 --- a/src/p_map.cpp +++ b/src/p_map.cpp @@ -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) diff --git a/src/p_mobj.cpp b/src/p_mobj.cpp index e898fd687..2285b9f9a 100644 --- a/src/p_mobj.cpp +++ b/src/p_mobj.cpp @@ -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]; diff --git a/src/thingdef/thingdef_properties.cpp b/src/thingdef/thingdef_properties.cpp index faa9fba46..2908eab65 100644 --- a/src/thingdef/thingdef_properties.cpp +++ b/src/thingdef/thingdef_properties.cpp @@ -924,18 +924,25 @@ 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 (info->DamageFactors == NULL) info->DamageFactors=new DmgFactors; + if (str == NULL) + { + defaults->DamageFactor = id; + } + else + { + if (info->DamageFactors == NULL) info->DamageFactors=new DmgFactors; - FName dmgType; - if (!stricmp(str, "Normal")) dmgType = NAME_None; - else dmgType=str; + FName dmgType; + if (!stricmp(str, "Normal")) dmgType = NAME_None; + else dmgType=str; - (*info->DamageFactors)[dmgType]=id; + (*info->DamageFactors)[dmgType]=id; + } } //==========================================================================