From 0d5e3cf97e93f476c278f35b2df5424e05b6c6d6 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Sun, 22 Oct 2006 10:32:41 +0000 Subject: [PATCH] - Added MF5_PIERCEARMOR flag that allows damaging objects that aren't affected by armor. - Added an unfreeze CCMD so that frozen players can be unfrozen for testing. - Added special death states for projectiles hitting actors. - Added ACS SetActorPitch/GetActorPitch functions. - Added cameraheight property for actors. SVN r359 (trunk) --- docs/rh-log.txt | 8 ++++++++ src/actor.h | 2 ++ src/c_cmds.cpp | 10 ++++++++++ src/g_heretic/a_hereticweaps.cpp | 6 +++--- src/g_hexen/a_clericflame.cpp | 6 +++--- src/g_hexen/a_magelightning.cpp | 6 +++--- src/g_hexen/a_magewand.cpp | 6 +++--- src/g_strife/a_strifestuff.cpp | 2 +- src/p_acs.cpp | 28 ++++++++++++++++++++++++++++ src/p_acs.h | 2 ++ src/p_interaction.cpp | 7 ++++++- src/p_local.h | 2 +- src/p_map.cpp | 13 ++++++++++++- src/p_mobj.cpp | 28 +++++++++++++++++++--------- src/r_main.cpp | 2 +- src/thingdef.cpp | 15 ++++++++++++++- src/thingdef_codeptr.cpp | 13 ++++++++++++- 17 files changed, 128 insertions(+), 28 deletions(-) diff --git a/docs/rh-log.txt b/docs/rh-log.txt index d42efd28b..0d1a29a60 100644 --- a/docs/rh-log.txt +++ b/docs/rh-log.txt @@ -1,3 +1,11 @@ +October 22, 2006 (Changes by Graf Zahl) +- Added MF5_PIERCEARMOR flag that allows damaging objects that aren't + affected by armor. +- Added an unfreeze CCMD so that frozen players can be unfrozen for testing. +- Added special death states for projectiles hitting actors. +- Added ACS SetActorPitch/GetActorPitch functions. +- Added cameraheight property for actors. + October 21, 2006 (Changes by Graf Zahl) - Fixed: The yellow color range contained gaps in its definition which resulted in incorrect colors. diff --git a/src/actor.h b/src/actor.h index 02188d7d3..5daa657e9 100644 --- a/src/actor.h +++ b/src/actor.h @@ -284,6 +284,7 @@ enum MF5_BLOODSPLATTER = 0x00000100, // Blood splatter like in Raven's games. MF5_OLDRADIUSDMG = 0x00000200, // Use old radius damage code (for barrels and boss brain) MF5_DEHEXPLOSION = 0x00000400, // Use the DEHACKED explosion options when this projectile explodes + MF5_PIERCEARMOR = 0x00000800, // Armor doesn't protect against damage from this actor // --- mobj.renderflags --- @@ -415,6 +416,7 @@ enum AMETA_PoisonDamage, // Amount of poison damage AMETA_FastSpeed, // Speed in fast mode AMETA_RDFactor, // Radius damage factor + AMETA_CameraHeight, // Height of camera when used as such }; // Map Object definition. diff --git a/src/c_cmds.cpp b/src/c_cmds.cpp index e9a252a64..607c1705c 100644 --- a/src/c_cmds.cpp +++ b/src/c_cmds.cpp @@ -811,3 +811,13 @@ CCMD(changesky) } R_InitSkyMap (); } + +//----------------------------------------------------------------------------- +// +// +// +//----------------------------------------------------------------------------- +CCMD(unfreeze) +{ + if (who != NULL) who->player->cheats &= ~(CF_FROZEN|CF_TOTALLYFROZEN); +} diff --git a/src/g_heretic/a_hereticweaps.cpp b/src/g_heretic/a_hereticweaps.cpp index c97d1b43d..d96ab60ad 100644 --- a/src/g_heretic/a_hereticweaps.cpp +++ b/src/g_heretic/a_hereticweaps.cpp @@ -2064,7 +2064,7 @@ void ABlasterFX1::Tick () { if (!P_TryMove (this, x + xfrac, y + yfrac, true)) { // Blocked move - P_ExplodeMissile (this, BlockingLine); + P_ExplodeMissile (this, BlockingLine, BlockingMobj); return; } } @@ -2073,13 +2073,13 @@ void ABlasterFX1::Tick () { // Hit the floor z = floorz; P_HitFloor (this); - P_ExplodeMissile (this, NULL); + P_ExplodeMissile (this, NULL, NULL); return; } if (z + height > ceilingz) { // Hit the ceiling z = ceilingz - height; - P_ExplodeMissile (this, NULL); + P_ExplodeMissile (this, NULL, NULL); return; } if (changexy && (pr_bfx1t() < 64)) diff --git a/src/g_hexen/a_clericflame.cpp b/src/g_hexen/a_clericflame.cpp index 3b6df39a6..73a7f8725 100644 --- a/src/g_hexen/a_clericflame.cpp +++ b/src/g_hexen/a_clericflame.cpp @@ -320,7 +320,7 @@ void ACFlameMissile::Tick () { if (!P_TryMove (this, x+xfrac, y+yfrac, true)) { // Blocked move - P_ExplodeMissile (this, BlockingLine); + P_ExplodeMissile (this, BlockingLine, BlockingMobj); return; } } @@ -329,13 +329,13 @@ void ACFlameMissile::Tick () { // Hit the floor z = floorz; P_HitFloor (this); - P_ExplodeMissile (this, NULL); + P_ExplodeMissile (this, NULL, NULL); return; } if (z+height > ceilingz) { // Hit the ceiling z = ceilingz-height; - P_ExplodeMissile (this, NULL); + P_ExplodeMissile (this, NULL, NULL); return; } if (changexy) diff --git a/src/g_hexen/a_magelightning.cpp b/src/g_hexen/a_magelightning.cpp index 354879886..9e6132894 100644 --- a/src/g_hexen/a_magelightning.cpp +++ b/src/g_hexen/a_magelightning.cpp @@ -409,7 +409,7 @@ void A_LightningClip (AActor *actor) { if(target->health <= 0) { - P_ExplodeMissile(actor, NULL); + P_ExplodeMissile(actor, NULL, NULL); } else { @@ -534,7 +534,7 @@ void A_ZapMimic (AActor *actor) { if (mo->state >= mo->DeathState) { - P_ExplodeMissile (actor, NULL); + P_ExplodeMissile (actor, NULL, NULL); } else { @@ -577,6 +577,6 @@ void A_LightningRemove (AActor *actor) if (mo) { mo->lastenemy = NULL; - P_ExplodeMissile (mo, NULL); + P_ExplodeMissile (mo, NULL, NULL); } } diff --git a/src/g_hexen/a_magewand.cpp b/src/g_hexen/a_magewand.cpp index 2933caa2a..77bc44f09 100644 --- a/src/g_hexen/a_magewand.cpp +++ b/src/g_hexen/a_magewand.cpp @@ -141,7 +141,7 @@ void AMageWandMissile::Tick () LastRipped = NULL; // [RH] Do rip damage each step, like Hexen if (!P_TryMove (this, x+xfrac,y+yfrac, true)) { // Blocked move - P_ExplodeMissile (this, BlockingLine); + P_ExplodeMissile (this, BlockingLine, BlockingMobj); DoRipping = false; return; } @@ -151,14 +151,14 @@ void AMageWandMissile::Tick () { // Hit the floor z = floorz; P_HitFloor (this); - P_ExplodeMissile (this, NULL); + P_ExplodeMissile (this, NULL, NULL); DoRipping = false; return; } if (z+height > ceilingz) { // Hit the ceiling z = ceilingz-height; - P_ExplodeMissile (this, NULL); + P_ExplodeMissile (this, NULL, NULL); DoRipping = false; return; } diff --git a/src/g_strife/a_strifestuff.cpp b/src/g_strife/a_strifestuff.cpp index cb148c8ae..316c0a0ea 100644 --- a/src/g_strife/a_strifestuff.cpp +++ b/src/g_strife/a_strifestuff.cpp @@ -799,7 +799,7 @@ void A_Countdown (AActor *self) { if (--self->reactiontime <= 0) { - P_ExplodeMissile (self, NULL); + P_ExplodeMissile (self, NULL, NULL); self->flags &= ~MF_SKULLFLY; } } diff --git a/src/p_acs.cpp b/src/p_acs.cpp index ac7532fba..92a7dacb0 100644 --- a/src/p_acs.cpp +++ b/src/p_acs.cpp @@ -4420,6 +4420,21 @@ int DLevelScript::RunScript () } break; + case PCD_GETACTORPITCH: + { + AActor *actor = SingleActorFromTID (STACK(1), activator); + + if (actor == NULL) + { + STACK(1) = 0; + } + else + { + STACK(1) = actor->pitch >> 16; + } + } + break; + case PCD_GETLINEROWOFFSET: if (activationline) { @@ -4900,6 +4915,19 @@ int DLevelScript::RunScript () sp -= 2; break; + case PCD_SETACTORPITCH: + { + FActorIterator iterator (STACK(2)); + AActor *actor; + + while ( (actor = iterator.Next ()) ) + { + actor->pitch = STACK(1) << 16; + } + } + sp -= 2; + break; + case PCD_PLAYERCLASS: // [GRB] if (STACK(1) < 0 || STACK(1) >= MAXPLAYERS || !playeringame[STACK(1)]) { diff --git a/src/p_acs.h b/src/p_acs.h index 0a99d6142..83e17ae6a 100644 --- a/src/p_acs.h +++ b/src/p_acs.h @@ -536,6 +536,8 @@ public: PCD_SECTORDAMAGE, PCD_REPLACETEXTURES, /*330*/ PCD_NEGATEBINARY, + PCD_GETACTORPITCH, + PCD_SETACTORPITCH, PCODE_COMMAND_COUNT }; diff --git a/src/p_interaction.cpp b/src/p_interaction.cpp index 4dc71376a..25093f109 100644 --- a/src/p_interaction.cpp +++ b/src/p_interaction.cpp @@ -348,7 +348,7 @@ void AActor::Die (AActor *source, AActor *inflictor) if (flags & MF_MISSILE) { // [RH] When missiles die, they just explode - P_ExplodeMissile (this, NULL); + P_ExplodeMissile (this, NULL, NULL); return; } // [RH] Set the target to the thing that killed it. Strife apparently does this. @@ -852,6 +852,11 @@ void P_DamageMobj (AActor *target, AActor *inflictor, AActor *source, int damage } } + if (inflictor != NULL) + { + if (inflictor->flags5 & MF5_PIERCEARMOR) flags |= DMG_NO_ARMOR; + } + MeansOfDeath = mod; // [RH] Andy Baker's Stealth monsters if (target->flags & MF_STEALTH) diff --git a/src/p_local.h b/src/p_local.h index f134a1447..a4ad893b4 100644 --- a/src/p_local.h +++ b/src/p_local.h @@ -102,7 +102,7 @@ void P_BloodSplatter (fixed_t x, fixed_t y, fixed_t z, AActor *originator); void P_BloodSplatter2 (fixed_t x, fixed_t y, fixed_t z, AActor *originator); void P_RipperBlood (AActor *mo, AActor *bleeder); int P_GetThingFloorType (AActor *thing); -void P_ExplodeMissile (AActor *missile, line_t *explodeline); +void P_ExplodeMissile (AActor *missile, line_t *explodeline, AActor *target); AActor *P_SpawnMissile (AActor* source, AActor* dest, const PClass *type); AActor *P_SpawnMissileZ (AActor* source, fixed_t z, AActor* dest, const PClass *type); diff --git a/src/p_map.cpp b/src/p_map.cpp index bed94d82e..45d3091c2 100644 --- a/src/p_map.cpp +++ b/src/p_map.cpp @@ -2807,7 +2807,18 @@ void P_LineAttack (AActor *t1, angle_t angle, fixed_t distance, trace.Actor, srcangle, srcpitch); } } - if (damage) P_DamageMobj (trace.Actor, puff ? puff : t1, t1, damage, damageType); + if (damage) + { + int flags = 0; + // Allow MF5_PIERCEARMOR on a weapon as well. + if (t1->player != NULL && t1->player->ReadyWeapon != NULL && + t1->player->ReadyWeapon->flags5 & MF5_PIERCEARMOR) + { + flags |= DMG_NO_ARMOR; + } + + P_DamageMobj (trace.Actor, puff ? puff : t1, t1, damage, damageType, flags); + } } if (trace.CrossedWater) { diff --git a/src/p_mobj.cpp b/src/p_mobj.cpp index 203b6737c..aaeefccdd 100644 --- a/src/p_mobj.cpp +++ b/src/p_mobj.cpp @@ -1007,7 +1007,7 @@ bool AActor::Massacre () // //---------------------------------------------------------------------------- -void P_ExplodeMissile (AActor *mo, line_t *line) +void P_ExplodeMissile (AActor *mo, line_t *line, AActor *target) { if (mo->flags3 & MF3_EXPLOCOUNT) { @@ -1018,7 +1018,17 @@ void P_ExplodeMissile (AActor *mo, line_t *line) } mo->momx = mo->momy = mo->momz = 0; mo->effects = 0; // [RH] - mo->SetState (mo->DeathState); + + FState *nextstate=NULL; + + if (target != NULL && target->flags & MF_SHOOTABLE) + { + if (target->flags & MF_NOBLOOD) nextstate = mo->CrashState; + if (nextstate == NULL) nextstate = mo->XDeathState; + } + if (nextstate == NULL) nextstate = mo->DeathState; + mo->SetState (nextstate); + if (mo->ObjectFlags & OF_MassDestruction) { return; @@ -1131,7 +1141,7 @@ bool AActor::FloorBounceMissile (secplane_t &plane) // Landed in some sort of liquid if (flags5 & MF5_EXPLODEONWATER) { - P_ExplodeMissile(this, NULL); + P_ExplodeMissile(this, NULL, NULL); return true; } if (!(flags3 & MF3_CANBOUNCEWATER)) @@ -1144,7 +1154,7 @@ bool AActor::FloorBounceMissile (secplane_t &plane) // The amount of bounces is limited if (bouncecount>0 && --bouncecount==0) { - P_ExplodeMissile(this, NULL); + P_ExplodeMissile(this, NULL, NULL); return true; } @@ -1589,7 +1599,7 @@ void P_XYMovement (AActor *mo, fixed_t scrollx, fixed_t scrolly) } else { // Struck a player/creature - P_ExplodeMissile (mo, NULL); + P_ExplodeMissile (mo, NULL, BlockingMobj); DoRipping = false; return; } @@ -1656,7 +1666,7 @@ explode: DoRipping = false; return; } - P_ExplodeMissile (mo, BlockingLine); + P_ExplodeMissile (mo, BlockingLine, BlockingMobj); DoRipping = false; return; } @@ -1926,7 +1936,7 @@ void P_ZMovement (AActor *mo) return; } P_HitFloor (mo); - P_ExplodeMissile (mo, NULL); + P_ExplodeMissile (mo, NULL, NULL); return; } } @@ -2026,7 +2036,7 @@ void P_ZMovement (AActor *mo) mo->Destroy (); return; } - P_ExplodeMissile (mo, NULL); + P_ExplodeMissile (mo, NULL, NULL); return; } } @@ -4230,7 +4240,7 @@ bool P_CheckMissileSpawn (AActor* th) } else { - P_ExplodeMissile (th, NULL); + P_ExplodeMissile (th, NULL, NULL); } return false; } diff --git a/src/r_main.cpp b/src/r_main.cpp index 8d97308bf..3e05f17e6 100644 --- a/src/r_main.cpp +++ b/src/r_main.cpp @@ -1032,7 +1032,7 @@ void R_SetupFrame (AActor *actor) { iview->nviewx = camera->x; iview->nviewy = camera->y; - iview->nviewz = camera->player ? camera->player->viewz : camera->z; + iview->nviewz = camera->player ? camera->player->viewz : camera->z + camera->GetClass()->Meta.GetMetaFixed(AMETA_CameraHeight); viewsector = camera->Sector; r_showviewer = false; } diff --git a/src/thingdef.cpp b/src/thingdef.cpp index d848aed4d..32f3b87dd 100644 --- a/src/thingdef.cpp +++ b/src/thingdef.cpp @@ -220,6 +220,7 @@ static flagdef ActorFlags[]= DEFINE_FLAG(MF5, BLOODSPLATTER, AActor, flags5), DEFINE_FLAG(MF5, OLDRADIUSDMG, AActor, flags5), DEFINE_FLAG(MF5, DEHEXPLOSION, AActor, flags5), + DEFINE_FLAG(MF5, PIERCEARMOR, AActor, flags5), // Effect flags DEFINE_FLAG(FX, VISIBILITYPULSE, AActor, effects), @@ -508,6 +509,7 @@ ACTOR(SkullPop) ACTOR(CheckFloor) ACTOR(CheckSkullDone) ACTOR(RadiusThrust) +ACTOR(Stop) #include "d_dehackedactions.h" @@ -717,6 +719,7 @@ AFuncDesc AFTable[]= FUNC(A_Burst, "M") FUNC(A_RadiusThrust, "xxy") {"A_Explode", A_ExplodeParms, "xxy" }, + FUNC(A_Stop, NULL) }; //========================================================================== @@ -3016,12 +3019,21 @@ static void ActorRadiusDamageFactor (AActor *defaults, Baggage &bag) bag.Info->Class->Meta.SetMetaFixed (AMETA_RDFactor, fixed_t(sc_Float*FRACUNIT)); } +//========================================================================== +// +//========================================================================== +static void ActorCameraheight (AActor *defaults, Baggage &bag) +{ + SC_MustGetFloat(); + bag.Info->Class->Meta.SetMetaFixed (AMETA_CameraHeight, fixed_t(sc_Float*FRACUNIT)); +} + //========================================================================== // //========================================================================== static void ActorClearFlags (AActor *defaults, Baggage &bag) { - defaults->flags=defaults->flags2=defaults->flags3=defaults->flags4=0; + defaults->flags=defaults->flags2=defaults->flags3=defaults->flags4=defaults->flags5=0; } //========================================================================== @@ -3781,6 +3793,7 @@ static const ActorProps props[] = { "bouncefactor", ActorBounceFactor, RUNTIME_CLASS(AActor) }, { "burn", ActorBurnState, RUNTIME_CLASS(AActor) }, { "burnheight", ActorBurnHeight, RUNTIME_CLASS(AActor) }, + { "cameraheight", ActorCameraheight, RUNTIME_CLASS(AActor) }, { "clearflags", ActorClearFlags, RUNTIME_CLASS(AActor) }, { "conversationid", ActorConversationID, RUNTIME_CLASS(AActor) }, { "crash", ActorCrashState, RUNTIME_CLASS(AActor) }, diff --git a/src/thingdef_codeptr.cpp b/src/thingdef_codeptr.cpp index f527b3a82..db7af7214 100644 --- a/src/thingdef_codeptr.cpp +++ b/src/thingdef_codeptr.cpp @@ -1677,7 +1677,7 @@ void A_CountdownArg(AActor * self) { if (self->flags&MF_MISSILE) { - P_ExplodeMissile(self, NULL); + P_ExplodeMissile(self, NULL, NULL); } else if (self->flags&MF_SHOOTABLE) { @@ -1761,3 +1761,14 @@ void A_CheckFloor (AActor *self) if (pStateCall != NULL) pStateCall->Result=false; // Jumps should never set the result for inventory state chains! } + +//=========================================================================== +// +// A_Stop +// resets all momentum of the actor to 0 +// +//=========================================================================== +void A_Stop (AActor *self) +{ + self->momx = self->momy = self->momz = 0; +}