From 4acc8a69540595afad9a56762f7a9f2ce3f7ca24 Mon Sep 17 00:00:00 2001 From: Randy Heit Date: Sun, 12 Mar 2006 22:04:49 +0000 Subject: [PATCH] - Fixed: A_SpawnItem() should use CopyFriendliness(). - Fixed: AExplosiveBarrel should have MF2_MCROSS set. - Fixed: Passing 0 numrays to A_BFGSpray should default to 40. - Fixed: New A_JumpIfCloser() function. - Future-proofing: thingdef.cpp/FindState() allows the 2.1 names for SwitchingDecorations. - Fixed: ASwitchingDecoration declared itself as deriving from AActor instead of ASwitchableDecoration. - Fixed: AWeaponHolder::Serialize() did not call its supermethod. SVN r19 (trunk) --- docs/rh-log.txt | 13 +++++++++++++ src/g_doom/a_doommisc.cpp | 1 + src/g_doom/a_doomweaps.cpp | 5 +++-- src/g_hexen/a_hexenglobal.h | 8 ++++++++ src/g_hexen/a_hexenspecialdecs.cpp | 10 +--------- src/g_shared/a_weaponpiece.cpp | 1 + src/thingdef.cpp | 13 ++++++++++--- src/thingdef_codeptr.cpp | 21 +++++++-------------- 8 files changed, 44 insertions(+), 28 deletions(-) diff --git a/docs/rh-log.txt b/docs/rh-log.txt index cfcc4f782..769f4620f 100644 --- a/docs/rh-log.txt +++ b/docs/rh-log.txt @@ -1,3 +1,16 @@ +March 12, 2006 +- Fixed: A_SpawnItem() should use CopyFriendliness(). +- Fixed: AExplosiveBarrel should have MF2_MCROSS set. +- Fixed: Passing 0 numrays to A_BFGSpray should default to 40. +- Fixed: New A_JumpIfCloser() function. +- Future-proofing: thingdef.cpp/FindState() allows the 2.1 names for + SwitchingDecorations. +- Fixed: ASwitchingDecoration declared itself as deriving from AActor instead of + ASwitchableDecoration. + +March 9, 2006 +- Fixed: AWeaponHolder::Serialize() did not call its supermethod. + March 1, 2006 - Rewrote MusicVolumes handling so it's a list and not an array. - Removed I_SetMusicVolume(). It isn't used. diff --git a/src/g_doom/a_doommisc.cpp b/src/g_doom/a_doommisc.cpp index 7b9072631..75bc7cbb7 100644 --- a/src/g_doom/a_doommisc.cpp +++ b/src/g_doom/a_doommisc.cpp @@ -37,6 +37,7 @@ IMPLEMENT_ACTOR (AExplosiveBarrel, Doom, 2035, 125) PROP_RadiusFixed (10) PROP_HeightFixed (34) PROP_Flags (MF_SOLID|MF_SHOOTABLE|MF_NOBLOOD) + PROP_Flags2 (MF2_MCROSS) PROP_Flags3 (MF3_DONTGIB) PROP_Flags4 (MF4_NOICEDEATH) diff --git a/src/g_doom/a_doomweaps.cpp b/src/g_doom/a_doomweaps.cpp index f288c1bcf..4058159c6 100644 --- a/src/g_doom/a_doomweaps.cpp +++ b/src/g_doom/a_doomweaps.cpp @@ -1338,6 +1338,7 @@ void A_FireBFG (AActor *actor) } bool thebfugu; +int EvalExpressionI (int id, AActor *self); // // A_BFGSpray // Spawn a BFG explosion on every monster in view @@ -1356,8 +1357,8 @@ void A_BFGSpray (AActor *mo) if (index >= 0) { spraytype = TypeInfo::FindType ((const char *)StateParameters[index]); - numrays = (int)StateParameters[index+1]; - if (numrays < 0) + numrays = EvalExpressionI (StateParameters[index+1], mo); + if (numrays <= 0) numrays = 40; } if (spraytype == NULL) diff --git a/src/g_hexen/a_hexenglobal.h b/src/g_hexen/a_hexenglobal.h index 36c3cd393..1890e50dc 100644 --- a/src/g_hexen/a_hexenglobal.h +++ b/src/g_hexen/a_hexenglobal.h @@ -149,4 +149,12 @@ public: const char *PickupMessage (); }; +class ASwitchableDecoration : public AActor +{ + DECLARE_STATELESS_ACTOR (ASwitchableDecoration, AActor) +public: + void Activate (AActor *activator); + void Deactivate (AActor *activator); +}; + #endif //__A_HEXENGLOBAL_H__ diff --git a/src/g_hexen/a_hexenspecialdecs.cpp b/src/g_hexen/a_hexenspecialdecs.cpp index a76788fec..a8b908469 100644 --- a/src/g_hexen/a_hexenspecialdecs.cpp +++ b/src/g_hexen/a_hexenspecialdecs.cpp @@ -23,14 +23,6 @@ static FRandom pr_soaexplode ("SoAExplode"); // SwitchableDecoration: Activate and Deactivate change state --------------- -class ASwitchableDecoration : public AActor -{ - DECLARE_STATELESS_ACTOR (ASwitchableDecoration, AActor) -public: - void Activate (AActor *activator); - void Deactivate (AActor *activator); -}; - IMPLEMENT_ABSTRACT_ACTOR (ASwitchableDecoration) void ASwitchableDecoration::Activate (AActor *activator) @@ -47,7 +39,7 @@ void ASwitchableDecoration::Deactivate (AActor *activator) class ASwitchingDecoration : public ASwitchableDecoration { - DECLARE_STATELESS_ACTOR (ASwitchingDecoration, AActor) + DECLARE_STATELESS_ACTOR (ASwitchingDecoration, ASwitchableDecoration) public: void Deactivate (AActor *activator) {} }; diff --git a/src/g_shared/a_weaponpiece.cpp b/src/g_shared/a_weaponpiece.cpp index d6e959ffb..6ff9bac1b 100644 --- a/src/g_shared/a_weaponpiece.cpp +++ b/src/g_shared/a_weaponpiece.cpp @@ -15,6 +15,7 @@ public: void Serialize (FArchive &arc) { + Super::Serialize(arc); arc << PieceMask ; if (arc.IsStoring()) arc.UserWriteClass(PieceWeapon); else arc.UserWriteClass(PieceWeapon); diff --git a/src/thingdef.cpp b/src/thingdef.cpp index b4425b78b..0080c1a71 100644 --- a/src/thingdef.cpp +++ b/src/thingdef.cpp @@ -62,6 +62,7 @@ #include "v_palette.h" #include "doomerrors.h" #include "a_doomglobal.h" +#include "a_hexenglobal.h" #include "a_weaponpiece.h" #include "p_conversation.h" @@ -625,7 +626,7 @@ AFuncDesc AFTable[]= FUNC(A_StopSound, NULL ) FUNC(A_SeekerMissile, "XX" ) FUNC(A_Jump, "XL" ) - FUNC(A_CustomMissile, "MXXxxx" ) + FUNC(A_CustomMissile, "MXXxxxx" ) FUNC(A_CustomBulletAttack, "XXXXmx" ) FUNC(A_CustomRailgun, "Xxccxxx" ) FUNC(A_JumpIfHealthLower, "XL" ) @@ -1128,7 +1129,7 @@ FState ** FindState(AActor * actor, const TypeInfo * type, const char * name) return (&static_cast(actor)->UpState)+i; } } - if (type->IsDescendantOf (RUNTIME_CLASS(ACustomInventory))) + else if (type->IsDescendantOf (RUNTIME_CLASS(ACustomInventory))) { for(i=0;inventory_statenames[i];i++) { @@ -1136,7 +1137,13 @@ FState ** FindState(AActor * actor, const TypeInfo * type, const char * name) return (&static_cast(actor)->UseState)+i; } } - return NULL; + else if (type->IsDescendantOf (RUNTIME_CLASS(ASwitchableDecoration))) + { + // These are the names that 2.1.0 will use + if (!stricmp(name, "ACTIVE")) return &actor->SeeState; + if (!stricmp(name, "INACTIVE")) return &actor->MeleeState; + } + return NULL; } diff --git a/src/thingdef_codeptr.cpp b/src/thingdef_codeptr.cpp index a702fb0ac..181fe5bdc 100644 --- a/src/thingdef_codeptr.cpp +++ b/src/thingdef_codeptr.cpp @@ -382,7 +382,7 @@ void A_JumpIfHealthLower(AActor * self) void A_JumpIfCloser(AActor * self) { FState * CallingState; - int index=CheckIndex(2, &CallingState); + int index = CheckIndex(2, &CallingState); AActor * target; if (!self->player) @@ -390,7 +390,7 @@ void A_JumpIfCloser(AActor * self) target=self->target; } else - { + { // Does the player aim at something that can be shot? P_BulletSlope(self); target = linetarget; @@ -400,7 +400,7 @@ void A_JumpIfCloser(AActor * self) if (target==NULL) return; fixed_t dist = EvalExpressionF (StateParameters[index], self) * FRACUNIT; - if (index>0 && P_AproxDistance(self->x-self->target->x, self->y-self->target->y) < dist) + if (index > 0 && P_AproxDistance(self->x-target->x, self->y-target->y) < dist) DoJump(self, CallingState, StateParameters[index+1]); } @@ -491,7 +491,7 @@ void A_CallSpecial(AActor * self) //========================================================================== void A_CustomMissile(AActor * self) { - int index=CheckIndex(6); + int index=CheckIndex(7); if (index<0) return; const char * MissileName=(const char*)StateParameters[index]; @@ -500,6 +500,7 @@ void A_CustomMissile(AActor * self) angle_t Angle=EvalExpressionF (StateParameters[index+3], self) * ANGLE_1; int aimmode=EvalExpressionI (StateParameters[index+4], self); angle_t pitch=EvalExpressionF (StateParameters[index+5], self) * ANGLE_1; + BOOL realtarget = EvalExpressionI (StateParameters[index+6], self); AActor * targ; AActor * missile; @@ -1064,16 +1065,8 @@ void A_SpawnItem(AActor * self) { if (originator->flags3&MF3_ISMONSTER) { - // If this is a monster transfer all friendliness information - mo->target = originator->target; - mo->TIDtoHate = originator->TIDtoHate; - mo->LastLook = originator->LastLook; - mo->flags3 |= originator->flags3 & (MF3_NOSIGHTCHECK | MF3_HUNTPLAYERS); - mo->flags4 |= originator->flags4 & MF4_NOHATEPLAYERS; - mo->flags = (mo->flags & ~MF_FRIENDLY) | (originator->flags & MF_FRIENDLY); - // Note to Randy: This line is missing from all other friendliness transfers! - mo->FriendPlayer=originator->FriendPlayer; - + // If this is a monster, transfer all friendliness information + mo->CopyFriendliness (originator, true); if (useammo) mo->master = originator; // don't let it attack you (optional)! } else if (originator->player)