- Added MF6_FORCEPAIN flag that forces the target to go into the pain state

regardless of pain chance.
- Changed screenblocks CVAR to be settable per game.
- Added SpawnSpotForced and SpawnSpotFacingForced ACS functions.
- Added pushfactor actor property.


SVN r1638 (trunk)
This commit is contained in:
Christoph Oelckers 2009-06-05 21:44:34 +00:00
parent 8c3a816428
commit d30e304a7f
10 changed files with 48 additions and 18 deletions

View file

@ -1,4 +1,9 @@
June 5, 2009 (Changes by Graf Zahl)
- Added MF6_FORCEPAIN flag that forces the target to go into the pain state
regardless of pain chance.
- Changed screenblocks CVAR to be settable per game.
- Added SpawnSpotForced and SpawnSpotFacingForced ACS functions.
- Added pushfactor actor property.
- Added Gez's GetArmorType submission
June 2, 2009

View file

@ -307,6 +307,7 @@ enum
MF6_NOBOSSRIP = 0x00000001, // For rippermissiles: Don't rip through bosses.
MF6_THRUSPECIES = 0x00000002, // Actors passes through other of the same species.
MF6_MTHRUSPECIES = 0x00000004, // Missile passes through actors of its shooter's species.
MF6_FORCEPAIN = 0x00000008, // forces target into painstate (unless it has the NOPAIN flag)
// --- mobj.renderflags ---
@ -736,6 +737,7 @@ public:
int bouncecount; // Strife's grenades only bounce twice before exploding
fixed_t gravity; // [GRB] Gravity factor
int FastChaseStrafeCount;
fixed_t pushfactor;
AActor *BlockingMobj; // Actor that blocked the last move
line_t *BlockingLine; // Line that blocked the last move

View file

@ -2230,7 +2230,7 @@ void DLevelScript::ReplaceTextures (int fromnamei, int tonamei, int flags)
}
}
int DLevelScript::DoSpawn (int type, fixed_t x, fixed_t y, fixed_t z, int tid, int angle)
int DLevelScript::DoSpawn (int type, fixed_t x, fixed_t y, fixed_t z, int tid, int angle, bool force)
{
const PClass *info = PClass::FindClass (FBehavior::StaticLookupString (type));
AActor *actor = NULL;
@ -2243,7 +2243,7 @@ int DLevelScript::DoSpawn (int type, fixed_t x, fixed_t y, fixed_t z, int tid, i
{
DWORD oldFlags2 = actor->flags2;
actor->flags2 |= MF2_PASSMOBJ;
if (P_TestMobjLocation (actor))
if (force || P_TestMobjLocation (actor))
{
actor->angle = angle << 24;
actor->tid = tid;
@ -2274,7 +2274,7 @@ int DLevelScript::DoSpawn (int type, fixed_t x, fixed_t y, fixed_t z, int tid, i
return spawncount;
}
int DLevelScript::DoSpawnSpot (int type, int spot, int tid, int angle)
int DLevelScript::DoSpawnSpot (int type, int spot, int tid, int angle, bool force)
{
FActorIterator iterator (spot);
AActor *aspot;
@ -2282,12 +2282,12 @@ int DLevelScript::DoSpawnSpot (int type, int spot, int tid, int angle)
while ( (aspot = iterator.Next ()) )
{
spawned += DoSpawn (type, aspot->x, aspot->y, aspot->z, tid, angle);
spawned += DoSpawn (type, aspot->x, aspot->y, aspot->z, tid, angle, force);
}
return spawned;
}
int DLevelScript::DoSpawnSpotFacing (int type, int spot, int tid)
int DLevelScript::DoSpawnSpotFacing (int type, int spot, int tid, bool force)
{
FActorIterator iterator (spot);
AActor *aspot;
@ -2295,7 +2295,7 @@ int DLevelScript::DoSpawnSpotFacing (int type, int spot, int tid)
while ( (aspot = iterator.Next ()) )
{
spawned += DoSpawn (type, aspot->x, aspot->y, aspot->z, tid, aspot->angle >> 24);
spawned += DoSpawn (type, aspot->x, aspot->y, aspot->z, tid, aspot->angle >> 24, force);
}
return spawned;
}
@ -2802,6 +2802,8 @@ enum EACSFunctions
ACSF_SetAirSupply,
ACSF_SetSkyScrollSpeed,
ACSF_GetArmorType,
ACSF_SpawnSpotForced,
ACSF_SpawnSpotFacingForced,
};
int DLevelScript::SideFromID(int id, int side)
@ -2960,6 +2962,12 @@ int DLevelScript::CallFunction(int argCount, int funcIndex, SDWORD *args)
return 0;
}
case ACSF_SpawnSpotForced:
return DoSpawnSpot(args[0], args[1], args[2], args[3], true);
case ACSF_SpawnSpotFacingForced:
return DoSpawnSpotFacing(args[0], args[1], args[2], true);
default:
break;
}
@ -4952,27 +4960,27 @@ int DLevelScript::RunScript ()
break;
case PCD_SPAWN:
STACK(6) = DoSpawn (STACK(6), STACK(5), STACK(4), STACK(3), STACK(2), STACK(1));
STACK(6) = DoSpawn (STACK(6), STACK(5), STACK(4), STACK(3), STACK(2), STACK(1), false);
sp -= 5;
break;
case PCD_SPAWNDIRECT:
PushToStack (DoSpawn (pc[0], pc[1], pc[2], pc[3], pc[4], pc[5]));
PushToStack (DoSpawn (pc[0], pc[1], pc[2], pc[3], pc[4], pc[5], false));
pc += 6;
break;
case PCD_SPAWNSPOT:
STACK(4) = DoSpawnSpot (STACK(4), STACK(3), STACK(2), STACK(1));
STACK(4) = DoSpawnSpot (STACK(4), STACK(3), STACK(2), STACK(1), false);
sp -= 3;
break;
case PCD_SPAWNSPOTDIRECT:
PushToStack (DoSpawnSpot (pc[0], pc[1], pc[2], pc[3]));
PushToStack (DoSpawnSpot (pc[0], pc[1], pc[2], pc[3], false));
pc += 4;
break;
case PCD_SPAWNSPOTFACING:
STACK(3) = DoSpawnSpotFacing (STACK(3), STACK(2), STACK(1));
STACK(3) = DoSpawnSpotFacing (STACK(3), STACK(2), STACK(1), false);
sp -= 2;
break;

View file

@ -712,9 +712,9 @@ protected:
static int CountPlayers ();
static void SetLineTexture (int lineid, int side, int position, int name);
static void ReplaceTextures (int fromname, int toname, int flags);
static int DoSpawn (int type, fixed_t x, fixed_t y, fixed_t z, int tid, int angle);
static int DoSpawnSpot (int type, int spot, int tid, int angle);
static int DoSpawnSpotFacing (int type, int spot, int tid);
static int DoSpawn (int type, fixed_t x, fixed_t y, fixed_t z, int tid, int angle, bool force);
static int DoSpawnSpot (int type, int spot, int tid, int angle, bool forced);
static int DoSpawnSpotFacing (int type, int spot, int tid, bool forced);
int DoClassifyActor (int tid);
int CallFunction(int argCount, int funcIndex, SDWORD *args);

View file

@ -1123,6 +1123,8 @@ void P_DamageMobj (AActor *target, AActor *inflictor, AActor *source, int damage
damage = newdam;
if (damage <= 0)
{
// If MF&_FORCEPAIN is set make the player enter the pain state.
if (inflictor != NULL && (inflictor->flags6 & MF6_FORCEPAIN)) goto dopain;
return;
}
}
@ -1254,8 +1256,10 @@ void P_DamageMobj (AActor *target, AActor *inflictor, AActor *source, int damage
}
}
dopain:
if (!(target->flags5 & MF5_NOPAIN) && (inflictor == NULL || !(inflictor->flags5 & MF5_PAINLESS)) &&
(pr_damagemobj() < painchance) && !(target->flags & MF_SKULLFLY))
(pr_damagemobj() < painchance || (inflictor != NULL && (inflictor->flags6 & MF6_FORCEPAIN))) &&
!(target->flags & MF_SKULLFLY))
{
if (mod == NAME_Electric)
{

View file

@ -1037,8 +1037,8 @@ bool PIT_CheckThing (AActor *thing, FCheckPosition &tm)
if (thing->flags2 & MF2_PUSHABLE && !(tm.thing->flags2 & MF2_CANNOTPUSH) &&
(tm.thing->player == NULL || !(tm.thing->player->cheats & CF_PREDICTING)))
{ // Push thing
thing->momx += tm.thing->momx >> 2;
thing->momy += tm.thing->momy >> 2;
thing->momx += FixedMul(tm.thing->momx, thing->pushfactor);
thing->momy += FixedMul(tm.thing->momy, thing->pushfactor);
}
solid = (thing->flags & MF_SOLID) &&
!(thing->flags & MF_NOCLIP) &&

View file

@ -686,7 +686,7 @@ void R_ExecuteSetViewSize ()
//
//==========================================================================
CUSTOM_CVAR (Int, screenblocks, 10, CVAR_ARCHIVE|CVAR_GLOBALCONFIG)
CUSTOM_CVAR (Int, screenblocks, 10, CVAR_ARCHIVE)
{
if (self > 12)
self = 12;

View file

@ -212,6 +212,7 @@ static FFlagDef ActorFlags[]=
DEFINE_FLAG(MF6, NOBOSSRIP, AActor, flags6),
DEFINE_FLAG(MF6, THRUSPECIES, AActor, flags6),
DEFINE_FLAG(MF6, MTHRUSPECIES, AActor, flags6),
DEFINE_FLAG(MF6, FORCEPAIN, AActor, flags6),
// Effect flags
DEFINE_FLAG(FX, VISIBILITYPULSE, AActor, effects),

View file

@ -741,6 +741,15 @@ DEFINE_PROPERTY(missileheight, F, Actor)
info->Class->Meta.SetMetaFixed (ACMETA_MissileHeight, id);
}
//==========================================================================
//
//==========================================================================
DEFINE_PROPERTY(pushfactor, F, Actor)
{
PROP_FIXED_PARM(id, 0);
defaults->pushfactor = id;
}
//==========================================================================
//
//==========================================================================

View file

@ -17,6 +17,7 @@ ACTOR Actor native //: Thinker
BounceCount -1
FloatSpeed 4
Gravity 1
PushFactor 0.25
// Variables for the expression evaluator
// NOTE: fixed_t and angle_t are only used here to ensure proper conversion