diff --git a/docs/rh-log.txt b/docs/rh-log.txt index aac863aa2d..bd69cdcc5c 100644 --- a/docs/rh-log.txt +++ b/docs/rh-log.txt @@ -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 diff --git a/src/actor.h b/src/actor.h index 1b144a56ca..61c45c6fd0 100644 --- a/src/actor.h +++ b/src/actor.h @@ -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 diff --git a/src/p_acs.cpp b/src/p_acs.cpp index 93aa5bb073..5f8d42a9c8 100644 --- a/src/p_acs.cpp +++ b/src/p_acs.cpp @@ -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; diff --git a/src/p_acs.h b/src/p_acs.h index 365277b294..824777972a 100644 --- a/src/p_acs.h +++ b/src/p_acs.h @@ -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); diff --git a/src/p_interaction.cpp b/src/p_interaction.cpp index 539f055388..9bcadd15bc 100644 --- a/src/p_interaction.cpp +++ b/src/p_interaction.cpp @@ -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) { diff --git a/src/p_map.cpp b/src/p_map.cpp index 703e8ab4a4..af1a60f7c1 100644 --- a/src/p_map.cpp +++ b/src/p_map.cpp @@ -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) && diff --git a/src/r_main.cpp b/src/r_main.cpp index 0a3b57e990..3ab29028ff 100644 --- a/src/r_main.cpp +++ b/src/r_main.cpp @@ -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; diff --git a/src/thingdef/thingdef_data.cpp b/src/thingdef/thingdef_data.cpp index 0a199aeb3d..e65d0ea01f 100644 --- a/src/thingdef/thingdef_data.cpp +++ b/src/thingdef/thingdef_data.cpp @@ -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), diff --git a/src/thingdef/thingdef_properties.cpp b/src/thingdef/thingdef_properties.cpp index e2af1f05ff..fc2765a49e 100644 --- a/src/thingdef/thingdef_properties.cpp +++ b/src/thingdef/thingdef_properties.cpp @@ -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; +} + //========================================================================== // //========================================================================== diff --git a/wadsrc/static/actors/actor.txt b/wadsrc/static/actors/actor.txt index 42aea63f68..c0f7b27408 100644 --- a/wadsrc/static/actors/actor.txt +++ b/wadsrc/static/actors/actor.txt @@ -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