From ad14caa80026a1713377c050d77b1e7ef08dd2d7 Mon Sep 17 00:00:00 2001 From: MajorCooke Date: Mon, 10 Aug 2015 11:19:54 -0500 Subject: [PATCH 01/22] - Added A_Warp heightoffset property. Only has an effect by two flags. - WARPF_ADDHEIGHT adds the pointed actor's height to heightoffset, and adds to the pointed actor's z position. - WARPF_MULHEIGHT multiplies the pointed actor's height by heightoffset, and adds to the pointed actor's z position. Overridden by ADDHEIGHT. --- src/p_acs.cpp | 3 ++- src/p_local.h | 4 +++- src/p_things.cpp | 18 ++++++++++++------ src/thingdef/thingdef_codeptr.cpp | 5 +++-- wadsrc/static/actors/actor.txt | 2 +- wadsrc/static/actors/constants.txt | 2 ++ 6 files changed, 23 insertions(+), 11 deletions(-) diff --git a/src/p_acs.cpp b/src/p_acs.cpp index 83a087d8f..b703b87dd 100644 --- a/src/p_acs.cpp +++ b/src/p_acs.cpp @@ -5862,6 +5862,7 @@ doplaysound: if (funcIndex == ACSF_PlayActorSound) int flags = args[5]; const char *statename = argCount > 6 ? FBehavior::StaticLookupString(args[6]) : ""; bool exact = argCount > 7 ? !!args[7] : false; + fixed_t heightoffset = argCount > 8 ? args[8] : 0; FState *state = argCount > 6 ? activator->GetClass()->ActorInfo->FindStateByString(statename, exact) : 0; @@ -5879,7 +5880,7 @@ doplaysound: if (funcIndex == ACSF_PlayActorSound) if (!reference) return false; - if (P_Thing_Warp(activator, reference, xofs, yofs, zofs, angle, flags)) + if (P_Thing_Warp(activator, reference, xofs, yofs, zofs, angle, flags, heightoffset)) { if (state && argCount > 6) { diff --git a/src/p_local.h b/src/p_local.h index 0b1c9c7a8..6022d8e8e 100644 --- a/src/p_local.h +++ b/src/p_local.h @@ -176,7 +176,7 @@ bool P_Thing_Raise(AActor *thing, AActor *raiser); bool P_Thing_CanRaise(AActor *thing); const PClass *P_GetSpawnableType(int spawnnum); void InitSpawnablesFromMapinfo(); -int P_Thing_Warp(AActor *caller, AActor *reference, fixed_t xofs, fixed_t yofs, fixed_t zofs, angle_t angle, int flags); +int P_Thing_Warp(AActor *caller, AActor *reference, fixed_t xofs, fixed_t yofs, fixed_t zofs, angle_t angle, int flags, fixed_t heightoffset); enum WARPF { @@ -198,6 +198,8 @@ enum WARPF WARPF_MOVEPTR = 0x1000, WARPF_USEPTR = 0x2000, WARPF_USETID = 0x2000, + WARPF_ADDHEIGHT = 0x4000, + WARPF_MULHEIGHT = 0x8000, }; diff --git a/src/p_things.cpp b/src/p_things.cpp index 799e72893..db80e35ca 100644 --- a/src/p_things.cpp +++ b/src/p_things.cpp @@ -680,7 +680,7 @@ void InitSpawnablesFromMapinfo() } -int P_Thing_Warp(AActor *caller, AActor *reference, fixed_t xofs, fixed_t yofs, fixed_t zofs, angle_t angle, int flags) +int P_Thing_Warp(AActor *caller, AActor *reference, fixed_t xofs, fixed_t yofs, fixed_t zofs, angle_t angle, int flags, fixed_t heightoffset) { if (flags & WARPF_MOVEPTR) { @@ -692,6 +692,12 @@ int P_Thing_Warp(AActor *caller, AActor *reference, fixed_t xofs, fixed_t yofs, fixed_t oldx = caller->x; fixed_t oldy = caller->y; fixed_t oldz = caller->z; + fixed_t height = 0; + + if (flags & WARPF_ADDHEIGHT) + height = reference->height + heightoffset; + else if (flags & WARPF_MULHEIGHT) + height = FixedMul(reference->height, heightoffset); if (!(flags & WARPF_ABSOLUTEANGLE)) { @@ -719,7 +725,7 @@ int P_Thing_Warp(AActor *caller, AActor *reference, fixed_t xofs, fixed_t yofs, caller->SetOrigin( reference->x + xofs, reference->y + yofs, - reference->z); + reference->z + height); // now the caller's floorz should be appropriate for the assigned xy-position // assigning position again with @@ -730,7 +736,7 @@ int P_Thing_Warp(AActor *caller, AActor *reference, fixed_t xofs, fixed_t yofs, caller->SetOrigin( caller->x, caller->y, - caller->floorz + zofs); + caller->floorz + zofs + height); } else { @@ -745,18 +751,18 @@ int P_Thing_Warp(AActor *caller, AActor *reference, fixed_t xofs, fixed_t yofs, caller->SetOrigin( reference->x + xofs, reference->y + yofs, - reference->z + zofs); + reference->z + zofs + height); } } else // [MC] The idea behind "absolute" is meant to be "absolute". Override everything, just like A_SpawnItemEx's. { if (flags & WARPF_TOFLOOR) { - caller->SetOrigin(xofs, yofs, caller->floorz + zofs); + caller->SetOrigin(xofs, yofs, caller->floorz + zofs + height); } else { - caller->SetOrigin(xofs, yofs, zofs); + caller->SetOrigin(xofs, yofs, zofs + height); } } diff --git a/src/thingdef/thingdef_codeptr.cpp b/src/thingdef/thingdef_codeptr.cpp index 69dd89cd0..5f863e746 100644 --- a/src/thingdef/thingdef_codeptr.cpp +++ b/src/thingdef/thingdef_codeptr.cpp @@ -4671,7 +4671,7 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_WolfAttack) DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_Warp) { - ACTION_PARAM_START(7); + ACTION_PARAM_START(8); ACTION_PARAM_INT(destination_selector, 0); ACTION_PARAM_FIXED(xofs, 1); @@ -4680,6 +4680,7 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_Warp) ACTION_PARAM_ANGLE(angle, 4); ACTION_PARAM_INT(flags, 5); ACTION_PARAM_STATE(success_state, 6); + ACTION_PARAM_FIXED(heightoffset,7) AActor *reference; @@ -4699,7 +4700,7 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_Warp) return; } - if (P_Thing_Warp(self, reference, xofs, yofs, zofs, angle, flags)) + if (P_Thing_Warp(self, reference, xofs, yofs, zofs, angle, flags, heightoffset)) { if (success_state) { diff --git a/wadsrc/static/actors/actor.txt b/wadsrc/static/actors/actor.txt index 6885ad2d6..00476b502 100644 --- a/wadsrc/static/actors/actor.txt +++ b/wadsrc/static/actors/actor.txt @@ -249,7 +249,7 @@ ACTOR Actor native //: Thinker action native A_PlayerSkinCheck(state label); action native A_BasicAttack(int meleedamage, sound meleesound, class missiletype, float missileheight); action native A_Teleport(state teleportstate = "", class targettype = "BossSpot", class fogtype = "TeleportFog", int flags = 0, float mindist = 0, float maxdist = 0, int ptr = AAPTR_DEFAULT); - action native A_Warp(int ptr_destination, float xofs = 0, float yofs = 0, float zofs = 0, float angle = 0, int flags = 0, state success_state = ""); + action native A_Warp(int ptr_destination, float xofs = 0, float yofs = 0, float zofs = 0, float angle = 0, int flags = 0, state success_state = "", float heightoffset = 0); action native A_ThrowGrenade(class itemtype, float zheight = 0, float xyvel = 0, float zvel = 0, bool useammo = true); action native A_Weave(int xspeed, int yspeed, float xdist, float ydist); diff --git a/wadsrc/static/actors/constants.txt b/wadsrc/static/actors/constants.txt index 04ed6f1fc..a0c6f1f98 100644 --- a/wadsrc/static/actors/constants.txt +++ b/wadsrc/static/actors/constants.txt @@ -361,6 +361,8 @@ Const Int WARPF_ABSOLUTEPOSITION = 0x400; Const Int WARPF_BOB = 0x800; Const Int WARPF_MOVEPTR = 0x1000; Const Int WARPF_USETID = 0x2000; +Const Int WARPF_ADDHEIGHT = 0x4000; +Const Int WARPF_MULHEIGHT = 0x8000; // flags for A_SetPitch/SetAngle/SetRoll const int SPF_FORCECLAMP = 1; From 9cf8a2a26ca137196874763965dedb9a19584ea4 Mon Sep 17 00:00:00 2001 From: MajorCooke Date: Mon, 10 Aug 2015 12:20:42 -0500 Subject: [PATCH 02/22] - Missed a spot. --- src/p_things.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/p_things.cpp b/src/p_things.cpp index db80e35ca..6c8349a72 100644 --- a/src/p_things.cpp +++ b/src/p_things.cpp @@ -743,7 +743,7 @@ int P_Thing_Warp(AActor *caller, AActor *reference, fixed_t xofs, fixed_t yofs, // if there is no offset, there should be no ill effect from moving down to the already defined floor // A_Teleport does the same thing anyway - caller->z = caller->floorz; + caller->z = caller->floorz + height; } } else From 7e661dfe573c6101f7b0d215f12f5cd6d64f5c43 Mon Sep 17 00:00:00 2001 From: MajorCooke Date: Mon, 10 Aug 2015 12:41:40 -0500 Subject: [PATCH 03/22] - Clean up. --- src/p_things.cpp | 41 +++++++++++++++++------------------------ 1 file changed, 17 insertions(+), 24 deletions(-) diff --git a/src/p_things.cpp b/src/p_things.cpp index 6c8349a72..1467935d7 100644 --- a/src/p_things.cpp +++ b/src/p_things.cpp @@ -692,12 +692,16 @@ int P_Thing_Warp(AActor *caller, AActor *reference, fixed_t xofs, fixed_t yofs, fixed_t oldx = caller->x; fixed_t oldy = caller->y; fixed_t oldz = caller->z; - fixed_t height = 0; + if (flags & WARPF_ADDHEIGHT) - height = reference->height + heightoffset; + { + zofs += reference->height + heightoffset; + } else if (flags & WARPF_MULHEIGHT) - height = FixedMul(reference->height, heightoffset); + { + zofs += FixedMul(reference->height, heightoffset); + } if (!(flags & WARPF_ABSOLUTEANGLE)) { @@ -725,44 +729,33 @@ int P_Thing_Warp(AActor *caller, AActor *reference, fixed_t xofs, fixed_t yofs, caller->SetOrigin( reference->x + xofs, reference->y + yofs, - reference->z + height); + reference->z); // now the caller's floorz should be appropriate for the assigned xy-position - // assigning position again with - - if (zofs) - { - // extra unlink, link and environment calculation - caller->SetOrigin( - caller->x, - caller->y, - caller->floorz + zofs + height); - } - else - { - // if there is no offset, there should be no ill effect from moving down to the already defined floor - - // A_Teleport does the same thing anyway - caller->z = caller->floorz + height; - } + // assigning position again with. + // extra unlink, link and environment calculation + caller->SetOrigin( + caller->x, + caller->y, + caller->floorz + zofs); } else { caller->SetOrigin( reference->x + xofs, reference->y + yofs, - reference->z + zofs + height); + reference->z + zofs); } } else // [MC] The idea behind "absolute" is meant to be "absolute". Override everything, just like A_SpawnItemEx's. { if (flags & WARPF_TOFLOOR) { - caller->SetOrigin(xofs, yofs, caller->floorz + zofs + height); + caller->SetOrigin(xofs, yofs, caller->floorz + zofs); } else { - caller->SetOrigin(xofs, yofs, zofs + height); + caller->SetOrigin(xofs, yofs, zofs); } } From 54af1e379edcc6a2f58034c06d0e406710adb570 Mon Sep 17 00:00:00 2001 From: MajorCooke Date: Mon, 10 Aug 2015 15:03:29 -0500 Subject: [PATCH 04/22] - Removed WARPF_MULHEIGHT. Enable its ability by default. - WARPF_ADDHEIGHT will simply change HeightOffset from multiplying to adding by default. --- src/p_local.h | 1 - src/p_things.cpp | 2 +- wadsrc/static/actors/constants.txt | 1 - 3 files changed, 1 insertion(+), 3 deletions(-) diff --git a/src/p_local.h b/src/p_local.h index 6022d8e8e..a457cd877 100644 --- a/src/p_local.h +++ b/src/p_local.h @@ -199,7 +199,6 @@ enum WARPF WARPF_USEPTR = 0x2000, WARPF_USETID = 0x2000, WARPF_ADDHEIGHT = 0x4000, - WARPF_MULHEIGHT = 0x8000, }; diff --git a/src/p_things.cpp b/src/p_things.cpp index 1467935d7..678608dc6 100644 --- a/src/p_things.cpp +++ b/src/p_things.cpp @@ -698,7 +698,7 @@ int P_Thing_Warp(AActor *caller, AActor *reference, fixed_t xofs, fixed_t yofs, { zofs += reference->height + heightoffset; } - else if (flags & WARPF_MULHEIGHT) + else { zofs += FixedMul(reference->height, heightoffset); } diff --git a/wadsrc/static/actors/constants.txt b/wadsrc/static/actors/constants.txt index a0c6f1f98..b7baca73a 100644 --- a/wadsrc/static/actors/constants.txt +++ b/wadsrc/static/actors/constants.txt @@ -362,7 +362,6 @@ Const Int WARPF_BOB = 0x800; Const Int WARPF_MOVEPTR = 0x1000; Const Int WARPF_USETID = 0x2000; Const Int WARPF_ADDHEIGHT = 0x4000; -Const Int WARPF_MULHEIGHT = 0x8000; // flags for A_SetPitch/SetAngle/SetRoll const int SPF_FORCECLAMP = 1; From 87cc3f77f9c7eccd247448c131b57ad9871bab4f Mon Sep 17 00:00:00 2001 From: MajorCooke Date: Mon, 10 Aug 2015 16:05:44 -0500 Subject: [PATCH 05/22] - Removed WARPF_ADDHEIGHT. --- src/p_local.h | 1 - src/p_things.cpp | 9 +-------- wadsrc/static/actors/constants.txt | 1 - 3 files changed, 1 insertion(+), 10 deletions(-) diff --git a/src/p_local.h b/src/p_local.h index a457cd877..a2fa00c71 100644 --- a/src/p_local.h +++ b/src/p_local.h @@ -198,7 +198,6 @@ enum WARPF WARPF_MOVEPTR = 0x1000, WARPF_USEPTR = 0x2000, WARPF_USETID = 0x2000, - WARPF_ADDHEIGHT = 0x4000, }; diff --git a/src/p_things.cpp b/src/p_things.cpp index 678608dc6..f9d85c43f 100644 --- a/src/p_things.cpp +++ b/src/p_things.cpp @@ -693,15 +693,8 @@ int P_Thing_Warp(AActor *caller, AActor *reference, fixed_t xofs, fixed_t yofs, fixed_t oldy = caller->y; fixed_t oldz = caller->z; + zofs += FixedMul(reference->height, heightoffset); - if (flags & WARPF_ADDHEIGHT) - { - zofs += reference->height + heightoffset; - } - else - { - zofs += FixedMul(reference->height, heightoffset); - } if (!(flags & WARPF_ABSOLUTEANGLE)) { diff --git a/wadsrc/static/actors/constants.txt b/wadsrc/static/actors/constants.txt index b7baca73a..04ed6f1fc 100644 --- a/wadsrc/static/actors/constants.txt +++ b/wadsrc/static/actors/constants.txt @@ -361,7 +361,6 @@ Const Int WARPF_ABSOLUTEPOSITION = 0x400; Const Int WARPF_BOB = 0x800; Const Int WARPF_MOVEPTR = 0x1000; Const Int WARPF_USETID = 0x2000; -Const Int WARPF_ADDHEIGHT = 0x4000; // flags for A_SetPitch/SetAngle/SetRoll const int SPF_FORCECLAMP = 1; From 2d58a28cc3feb559b7989698d88144309da7bc6a Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Sun, 16 Aug 2015 08:50:22 +0200 Subject: [PATCH 06/22] - fixed: In Heretic an active Tome of Power should not freeze a teleporting player. This was implemented by adding a new inventory flag INVENTORY.NOTELEPORTFREEZE so that the effect can both be activated for other items and deactivated for the two that currently have it. --- src/g_shared/a_artifacts.cpp | 14 +++++++++++++- src/g_shared/a_artifacts.h | 1 + src/g_shared/a_pickups.cpp | 19 +++++++++++++++++++ src/g_shared/a_pickups.h | 2 ++ src/p_teleport.cpp | 2 +- src/thingdef/thingdef_data.cpp | 4 +++- wadsrc/static/actors/shared/inventory.txt | 2 ++ 7 files changed, 41 insertions(+), 3 deletions(-) diff --git a/src/g_shared/a_artifacts.cpp b/src/g_shared/a_artifacts.cpp index bc33eb19c..2be2e179d 100644 --- a/src/g_shared/a_artifacts.cpp +++ b/src/g_shared/a_artifacts.cpp @@ -72,7 +72,7 @@ bool APowerupGiver::Use (bool pickup) power->Strength = Strength; } - power->ItemFlags |= ItemFlags & (IF_ALWAYSPICKUP|IF_ADDITIVETIME); + power->ItemFlags |= ItemFlags & (IF_ALWAYSPICKUP|IF_ADDITIVETIME|IF_NOTELEPORTFREEZE); if (power->CallTryPickup (Owner)) { return true; @@ -342,6 +342,18 @@ void APowerup::OwnerDied () Destroy (); } +//=========================================================================== +// +// AInventory :: GetNoTeleportFreeze +// +//=========================================================================== + +bool APowerup::GetNoTeleportFreeze () +{ + if (ItemFlags & IF_NOTELEPORTFREEZE) return true; + return Super::GetNoTeleportFreeze(); +} + // Invulnerability Powerup --------------------------------------------------- IMPLEMENT_CLASS (APowerInvulnerable) diff --git a/src/g_shared/a_artifacts.h b/src/g_shared/a_artifacts.h index 4e1823f5a..c16a7a0c1 100644 --- a/src/g_shared/a_artifacts.h +++ b/src/g_shared/a_artifacts.h @@ -18,6 +18,7 @@ public: virtual AInventory *CreateTossable (); virtual void Serialize (FArchive &arc); virtual void OwnerDied (); + virtual bool GetNoTeleportFreeze(); virtual PalEntry GetBlend (); virtual bool DrawPowerup (int x, int y); diff --git a/src/g_shared/a_pickups.cpp b/src/g_shared/a_pickups.cpp index 038b63029..5d494c935 100644 --- a/src/g_shared/a_pickups.cpp +++ b/src/g_shared/a_pickups.cpp @@ -850,6 +850,25 @@ fixed_t AInventory::GetSpeedFactor () } } +//=========================================================================== +// +// AInventory :: GetNoTeleportFreeze +// +//=========================================================================== + +bool AInventory::GetNoTeleportFreeze () +{ + // do not check the flag here because it's only active when used on PowerUps, not on PowerupGivers. + if (Inventory != NULL) + { + return Inventory->GetNoTeleportFreeze(); + } + else + { + return false; + } +} + //=========================================================================== // // AInventory :: AlterWeaponSprite diff --git a/src/g_shared/a_pickups.h b/src/g_shared/a_pickups.h index 504a26c73..74b10206b 100644 --- a/src/g_shared/a_pickups.h +++ b/src/g_shared/a_pickups.h @@ -137,6 +137,7 @@ enum IF_TOSSED = 1<<22, // Was spawned by P_DropItem (i.e. as a monster drop) IF_ALWAYSRESPAWN = 1<<23, // Always respawn, regardless of dmflag IF_TRANSFER = 1<<24, // All inventory items that the inventory item contains is also transfered to the pickuper + IF_NOTELEPORTFREEZE = 1<<25, // does not 'freeze' the player right after teleporting. }; @@ -201,6 +202,7 @@ public: virtual void AbsorbDamage (int damage, FName damageType, int &newdamage); virtual void ModifyDamage (int damage, FName damageType, int &newdamage, bool passive); virtual fixed_t GetSpeedFactor(); + virtual bool GetNoTeleportFreeze(); virtual int AlterWeaponSprite (visstyle_t *vis); virtual PalEntry GetBlend (); diff --git a/src/p_teleport.cpp b/src/p_teleport.cpp index 82359f4e0..040aca9f4 100644 --- a/src/p_teleport.cpp +++ b/src/p_teleport.cpp @@ -211,7 +211,7 @@ bool P_Teleport (AActor *thing, fixed_t x, fixed_t y, fixed_t z, angle_t angle, if (thing->player && (useFog || !keepOrientation) && bHaltVelocity) { // Freeze player for about .5 sec - if (thing->Inventory == NULL || thing->Inventory->GetSpeedFactor() <= FRACUNIT) + if (thing->Inventory == NULL || !thing->Inventory->GetNoTeleportFreeze()) thing->reactiontime = 18; } if (thing->flags & MF_MISSILE) diff --git a/src/thingdef/thingdef_data.cpp b/src/thingdef/thingdef_data.cpp index b1387ba52..817afd0fa 100644 --- a/src/thingdef/thingdef_data.cpp +++ b/src/thingdef/thingdef_data.cpp @@ -331,9 +331,11 @@ static FFlagDef InventoryFlagDefs[] = DEFINE_FLAG(IF, TOSSED, AInventory, ItemFlags), DEFINE_FLAG(IF, ALWAYSRESPAWN, AInventory, ItemFlags), DEFINE_FLAG(IF, TRANSFER, AInventory, ItemFlags), + DEFINE_FLAG(IF, NOTELEPORTFREEZE, AInventory, ItemFlags), DEFINE_DEPRECATED_FLAG(PICKUPFLASH), - DEFINE_DEPRECATED_FLAG(INTERHUBSTRIP),}; + DEFINE_DEPRECATED_FLAG(INTERHUBSTRIP), +}; static FFlagDef WeaponFlagDefs[] = { diff --git a/wadsrc/static/actors/shared/inventory.txt b/wadsrc/static/actors/shared/inventory.txt index 0c106417b..541dd37ac 100644 --- a/wadsrc/static/actors/shared/inventory.txt +++ b/wadsrc/static/actors/shared/inventory.txt @@ -225,6 +225,7 @@ ACTOR PowerWeaponLevel2 : Powerup native { Powerup.Duration -40 Inventory.Icon "SPINBK0" + +INVENTORY.NOTELEPORTFREEZE } ACTOR PowerSpeed : Powerup native @@ -232,6 +233,7 @@ ACTOR PowerSpeed : Powerup native Powerup.Duration -45 Speed 1.5 Inventory.Icon "SPBOOT0" + +INVENTORY.NOTELEPORTFREEZE } // Player Speed Trail (used by the Speed Powerup) ---------------------------- From d786148ccfa7befdccc212fb03665d7fa56b2000 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Sun, 16 Aug 2015 20:33:34 +0200 Subject: [PATCH 07/22] - fixed: the 'gameversion' console output was missing a trailing linefeed. --- src/c_cmds.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/c_cmds.cpp b/src/c_cmds.cpp index a40f1f1a2..0a9e4f0e3 100644 --- a/src/c_cmds.cpp +++ b/src/c_cmds.cpp @@ -422,7 +422,7 @@ CCMD (take) CCMD (gameversion) { - Printf ("%s @ %s\nCommit %s", GetVersionString(), GetGitTime(), GetGitHash()); + Printf ("%s @ %s\nCommit %s\n", GetVersionString(), GetGitTime(), GetGitHash()); } CCMD (print) From f9e70a82c6216c19075adcd9f3d9826ba52ef5db Mon Sep 17 00:00:00 2001 From: MajorCooke Date: Mon, 24 Aug 2015 12:45:10 -0500 Subject: [PATCH 08/22] - Added A_SetSpecies(,). --- src/thingdef/thingdef_codeptr.cpp | 22 ++++++++++++++++++++++ wadsrc/static/actors/actor.txt | 1 + 2 files changed, 23 insertions(+) diff --git a/src/thingdef/thingdef_codeptr.cpp b/src/thingdef/thingdef_codeptr.cpp index d09ad6d6e..f6b724747 100644 --- a/src/thingdef/thingdef_codeptr.cpp +++ b/src/thingdef/thingdef_codeptr.cpp @@ -5764,6 +5764,28 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_JumpIfHigherOrLower) ACTION_JUMP(low); } +//=========================================================================== +// A_SetSpecies(str species, ptr) +// +// Sets the species of the calling actor('s pointer). +//=========================================================================== +DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_SetSpecies) +{ + ACTION_PARAM_START(2); + ACTION_PARAM_NAME(species, 0); + ACTION_PARAM_INT(ptr, 1); + AActor *mobj = COPY_AAPTR(self, ptr); + if (!mobj) + { + ACTION_SET_RESULT(false); + return; + } + + if (!stricmp(species, "None") || !stricmp(species, "")) + mobj->Species = NAME_None; + else + mobj->Species = species; +} //=========================================================================== // diff --git a/wadsrc/static/actors/actor.txt b/wadsrc/static/actors/actor.txt index 6885ad2d6..5e79d6b82 100644 --- a/wadsrc/static/actors/actor.txt +++ b/wadsrc/static/actors/actor.txt @@ -331,6 +331,7 @@ ACTOR Actor native //: Thinker action native A_SetHealth(int health, int ptr = AAPTR_DEFAULT); action native A_ResetHealth(int ptr = AAPTR_DEFAULT); action native A_JumpIfHigherOrLower(state high, state low, float offsethigh = 0, float offsetlow = 0, bool includeHeight = true, int ptr = AAPTR_TARGET); + action native A_SetSpecies(name species, int ptr = AAPTR_DEFAULT); action native A_SetRipperLevel(int level); action native A_SetRipMin(int min); action native A_SetRipMax(int max); From 27316432009ab2a09c494fd4d72287b215caf241 Mon Sep 17 00:00:00 2001 From: MajorCooke Date: Tue, 25 Aug 2015 08:15:23 -0500 Subject: [PATCH 09/22] Removed stricmp checks, as they're not needed. --- src/thingdef/thingdef_codeptr.cpp | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/src/thingdef/thingdef_codeptr.cpp b/src/thingdef/thingdef_codeptr.cpp index f6b724747..377c4915b 100644 --- a/src/thingdef/thingdef_codeptr.cpp +++ b/src/thingdef/thingdef_codeptr.cpp @@ -5781,10 +5781,7 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_SetSpecies) return; } - if (!stricmp(species, "None") || !stricmp(species, "")) - mobj->Species = NAME_None; - else - mobj->Species = species; + mobj->Species = species; } //=========================================================================== From ebf515f8c76ca32d2fd5fe9b70783987af5c12ca Mon Sep 17 00:00:00 2001 From: MajorCooke Date: Tue, 25 Aug 2015 20:18:06 -0500 Subject: [PATCH 10/22] - Fixed unneeded dual call to SetOrigin. --- src/p_things.cpp | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/src/p_things.cpp b/src/p_things.cpp index f9d85c43f..b7e3f058b 100644 --- a/src/p_things.cpp +++ b/src/p_things.cpp @@ -718,19 +718,13 @@ int P_Thing_Warp(AActor *caller, AActor *reference, fixed_t xofs, fixed_t yofs, if (flags & WARPF_TOFLOOR) { // set correct xy - - caller->SetOrigin( - reference->x + xofs, - reference->y + yofs, - reference->z); - // now the caller's floorz should be appropriate for the assigned xy-position // assigning position again with. // extra unlink, link and environment calculation caller->SetOrigin( - caller->x, - caller->y, - caller->floorz + zofs); + reference->x + xofs, + reference->y + yofs, + reference->floorz + zofs); } else { From 696c6af588a4b1f326a7257ca0cdc1073eaedbb2 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Thu, 27 Aug 2015 12:48:43 +0200 Subject: [PATCH 11/22] - fixed: FString's 'Strip...' functions could crash on empty strings. --- src/zstring.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/zstring.cpp b/src/zstring.cpp index 510ff19d7..1aa388da9 100644 --- a/src/zstring.cpp +++ b/src/zstring.cpp @@ -583,6 +583,7 @@ void FString::SwapCase () void FString::StripLeft () { size_t max = Len(), i, j; + if (max == 0) return; for (i = 0; i < max; ++i) { if (!isspace(Chars[i])) @@ -613,6 +614,7 @@ void FString::StripLeft (const FString &charset) void FString::StripLeft (const char *charset) { size_t max = Len(), i, j; + if (max == 0) return; for (i = 0; i < max; ++i) { if (!strchr (charset, Chars[i])) @@ -665,6 +667,7 @@ void FString::StripRight (const FString &charset) void FString::StripRight (const char *charset) { size_t max = Len(), i; + if (max == 0) return; for (i = max; i-- > 0; ) { if (!strchr (charset, Chars[i])) @@ -687,6 +690,7 @@ void FString::StripRight (const char *charset) void FString::StripLeftRight () { size_t max = Len(), i, j, k; + if (max == 0) return; for (i = 0; i < max; ++i) { if (!isspace(Chars[i])) @@ -723,6 +727,7 @@ void FString::StripLeftRight (const FString &charset) void FString::StripLeftRight (const char *charset) { size_t max = Len(), i, j, k; + if (max == 0) return; for (i = 0; i < max; ++i) { if (!strchr (charset, Chars[i])) From 98f214ee66fd5223c2d277fb982848e03e0200d2 Mon Sep 17 00:00:00 2001 From: Gaerzi Date: Fri, 28 Aug 2015 19:14:25 +0200 Subject: [PATCH 12/22] Added support for GOG paths This works a bit differently from the Steam version, because each game has its own registry keys and its own independent path. --- src/d_iwad.cpp | 5 ++++ src/win32/i_system.cpp | 63 ++++++++++++++++++++++++++++++++++++++---- src/win32/i_system.h | 3 ++ 3 files changed, 66 insertions(+), 5 deletions(-) diff --git a/src/d_iwad.cpp b/src/d_iwad.cpp index 3fc365e8c..a8d60e1ce 100644 --- a/src/d_iwad.cpp +++ b/src/d_iwad.cpp @@ -435,6 +435,11 @@ int FIWadManager::IdentifyVersion (TArray &wadfiles, const char *iwad, } } } + TArray gog_paths = I_GetGogPaths(); + for (i = 0; i < gog_paths.Size(); ++i) + { + CheckIWAD (gog_paths[i], &wads[0]); + } TArray steam_path = I_GetSteamPath(); for (i = 0; i < steam_path.Size(); ++i) { diff --git a/src/win32/i_system.cpp b/src/win32/i_system.cpp index 6d8fb8595..372da8685 100644 --- a/src/win32/i_system.cpp +++ b/src/win32/i_system.cpp @@ -1504,30 +1504,83 @@ int I_FindClose(void *handle) static bool QueryPathKey(HKEY key, const char *keypath, const char *valname, FString &value) { - HKEY steamkey; + HKEY pathkey; DWORD pathtype; DWORD pathlen; LONG res; - if(ERROR_SUCCESS == RegOpenKeyEx(key, keypath, 0, KEY_QUERY_VALUE, &steamkey)) + if(ERROR_SUCCESS == RegOpenKeyEx(key, keypath, 0, KEY_QUERY_VALUE, &pathkey)) { - if (ERROR_SUCCESS == RegQueryValueEx(steamkey, valname, 0, &pathtype, NULL, &pathlen) && + if (ERROR_SUCCESS == RegQueryValueEx(pathkey, valname, 0, &pathtype, NULL, &pathlen) && pathtype == REG_SZ && pathlen != 0) { // Don't include terminating null in count char *chars = value.LockNewBuffer(pathlen - 1); - res = RegQueryValueEx(steamkey, valname, 0, NULL, (LPBYTE)chars, &pathlen); + res = RegQueryValueEx(pathkey, valname, 0, NULL, (LPBYTE)chars, &pathlen); value.UnlockBuffer(); if (res != ERROR_SUCCESS) { value = ""; } } - RegCloseKey(steamkey); + RegCloseKey(pathkey); } return value.IsNotEmpty(); } +//========================================================================== +// +// I_GetGogPaths +// +// Check the registry for GOG installation paths, so we can search for IWADs +// that were bought from GOG.com. This is a bit different from the Steam +// version because each game has its own independent installation path, no +// such thing as /SteamApps/common/. +// +//========================================================================== + +TArray I_GetGogPaths() +{ + TArray result; + FString path; + FString gamepath; + +#ifdef _WIN64 + FString gogregistrypath = "Software\\Wow6432Node\\GOG.com\\Games"; +#else + // If a 32-bit ZDoom runs on a 64-bit Windows, this will be transparently and + // automatically redirected to the Wow6432Node address instead, so this address + // should be safe to use in all cases. + FString gogregistrypath = "Software\\GOG.com\\Games"; +#endif + + // Look for Ultimate Doom + gamepath = gogregistrypath + "\\1435827232"; + if (QueryPathKey(HKEY_LOCAL_MACHINE, gamepath.GetChars(), "Path", path)) + { + result.Push(path); // directly in install folder + } + + // Look for Doom II + gamepath = gogregistrypath + "\\1435848814"; + if (QueryPathKey(HKEY_LOCAL_MACHINE, gamepath.GetChars(), "Path", path)) + { + result.Push(path + "/doom2"); // in a subdirectory + // If direct support for the Master Levels is ever added, they are in path + /master/wads + } + + // Look for Final Doom + gamepath = gogregistrypath + "\\1435848742"; + if (QueryPathKey(HKEY_LOCAL_MACHINE, gamepath.GetChars(), "Path", path)) + { + // in subdirectories + result.Push(path + "/TNT"); + result.Push(path + "/Plutonia"); + } + + return result; +} + //========================================================================== // // I_GetSteamPath diff --git a/src/win32/i_system.h b/src/win32/i_system.h index 566ca1977..03f4f3c0f 100644 --- a/src/win32/i_system.h +++ b/src/win32/i_system.h @@ -168,6 +168,9 @@ void I_SetWndProc(); // directories for IWADs if the user purchased any through Steam. TArray I_GetSteamPath(); +// [GZ] Same deal for GOG paths +TArray I_GetGogPaths(); + // Damn Microsoft for doing Get/SetWindowLongPtr half-assed. Instead of // giving them proper prototypes under Win32, they are just macros for // Get/SetWindowLong, meaning they take LONGs and not LONG_PTRs. From 677dc8893ee53d36361dc40adc5347790b647a2f Mon Sep 17 00:00:00 2001 From: "alexey.lysiuk" Date: Sat, 29 Aug 2015 14:55:10 +0300 Subject: [PATCH 13/22] Fixed compilation on non-Windows OSes --- src/posix/i_system.cpp | 6 ++++++ src/posix/i_system.h | 2 ++ 2 files changed, 8 insertions(+) diff --git a/src/posix/i_system.cpp b/src/posix/i_system.cpp index fd6bb4c0c..84b953717 100644 --- a/src/posix/i_system.cpp +++ b/src/posix/i_system.cpp @@ -758,3 +758,9 @@ unsigned int I_MakeRNGSeed() } return seed; } + +TArray I_GetGogPaths() +{ + // GOG's Doom games are Windows only at the moment + return TArray(); +} diff --git a/src/posix/i_system.h b/src/posix/i_system.h index abda490c4..391503602 100644 --- a/src/posix/i_system.h +++ b/src/posix/i_system.h @@ -124,6 +124,8 @@ int I_PickIWad (WadStuff *wads, int numwads, bool queryiwad, int defaultiwad); // directories for IWADs if the user purchased any through Steam. TArray I_GetSteamPath(); +TArray I_GetGogPaths(); + // The ini could not be saved at exit bool I_WriteIniFailed (); From 0ed4549683e608422aa1952b01225289e41b2c0b Mon Sep 17 00:00:00 2001 From: Edward Richardson Date: Sun, 30 Aug 2015 02:47:45 +1200 Subject: [PATCH 14/22] Correct the mastermind's radius --- wadsrc/static/actors/doom/spidermaster.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/wadsrc/static/actors/doom/spidermaster.txt b/wadsrc/static/actors/doom/spidermaster.txt index 97ebbf143..c2a742f1e 100644 --- a/wadsrc/static/actors/doom/spidermaster.txt +++ b/wadsrc/static/actors/doom/spidermaster.txt @@ -6,7 +6,7 @@ ACTOR SpiderMastermind { Health 3000 - Radius 100 + Radius 128 Height 100 Mass 1000 Speed 12 From 389ff4fc98b6ad354418d9370a97b52dc9f49e0b Mon Sep 17 00:00:00 2001 From: Edward Richardson Date: Sun, 30 Aug 2015 22:02:36 +1200 Subject: [PATCH 15/22] Shift self-clip to first check for performance --- src/p_map.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/p_map.cpp b/src/p_map.cpp index fca43c120..c9b2f14cf 100644 --- a/src/p_map.cpp +++ b/src/p_map.cpp @@ -1013,6 +1013,10 @@ bool PIT_CheckThing(AActor *thing, FCheckPosition &tm) bool solid; int damage; + // don't clip against self + if (thing == tm.thing) + return true; + if (!((thing->flags & (MF_SOLID | MF_SPECIAL | MF_SHOOTABLE)) || thing->flags6 & MF6_TOUCHY)) return true; // can't hit thing @@ -1020,10 +1024,6 @@ bool PIT_CheckThing(AActor *thing, FCheckPosition &tm) if (abs(thing->x - tm.x) >= blockdist || abs(thing->y - tm.y) >= blockdist) return true; - // don't clip against self - if (thing == tm.thing) - return true; - if ((thing->flags2 | tm.thing->flags2) & MF2_THRUACTORS) return true; From b87435ac9d931d3bd053fd9084cb23d7d5457426 Mon Sep 17 00:00:00 2001 From: Edward Richardson Date: Sun, 30 Aug 2015 22:56:34 +1200 Subject: [PATCH 16/22] Remove unnecessary FriendlyFire global --- src/p_interaction.cpp | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/src/p_interaction.cpp b/src/p_interaction.cpp index 276a88c75..2947bf9c0 100644 --- a/src/p_interaction.cpp +++ b/src/p_interaction.cpp @@ -74,7 +74,6 @@ EXTERN_CVAR (Bool, show_obituaries) FName MeansOfDeath; -bool FriendlyFire; // // GET STUFF @@ -198,10 +197,8 @@ void ClientObituary (AActor *self, AActor *inflictor, AActor *attacker, int dmgf if (inflictor && inflictor->player && inflictor->player->mo != inflictor) MeansOfDeath = NAME_None; - if (multiplayer && !deathmatch) - FriendlyFire = true; + friendly = (self->player != attacker->player && self->IsTeammate(attacker)); - friendly = FriendlyFire; mod = MeansOfDeath; message = NULL; messagename = NULL; @@ -1024,7 +1021,6 @@ int P_DamageMobj (AActor *target, AActor *inflictor, AActor *source, int damage, } MeansOfDeath = mod; - FriendlyFire = false; // [RH] Andy Baker's Stealth monsters if (target->flags & MF_STEALTH) { @@ -1221,8 +1217,6 @@ int P_DamageMobj (AActor *target, AActor *inflictor, AActor *source, int damage, ((player && player != source->player) || (!player && target != source)) && target->IsTeammate (source)) { - if (player) - FriendlyFire = true; if (rawdamage < TELEFRAG_DAMAGE) //Use the original damage to check for telefrag amount. Don't let the now-amplified damagetypes do it. { // Still allow telefragging :-( damage = (int)((float)damage * level.teamdamage); From 02c562518ddf9657c0a353bd03a4caab424a214e Mon Sep 17 00:00:00 2001 From: Edward Richardson Date: Sun, 30 Aug 2015 23:36:00 +1200 Subject: [PATCH 17/22] Fixed possible sync issue with frag counts --- src/p_interaction.cpp | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/src/p_interaction.cpp b/src/p_interaction.cpp index 2947bf9c0..a0b1ddbc1 100644 --- a/src/p_interaction.cpp +++ b/src/p_interaction.cpp @@ -268,8 +268,6 @@ void ClientObituary (AActor *self, AActor *inflictor, AActor *attacker, int dmgf { if (friendly) { - attacker->player->fragcount -= 2; - attacker->player->frags[attacker->player - players]++; self = attacker; gender = self->player->userinfo.GetGender(); mysnprintf (gendermessage, countof(gendermessage), "OB_FRIENDLY%c", '1' + (pr_obituary() & 3)); @@ -467,12 +465,21 @@ void AActor::Die (AActor *source, AActor *inflictor, int dmgflags) if ((dmflags2 & DF2_YES_LOSEFRAG) && deathmatch) player->fragcount--; - ++source->player->fragcount; - ++source->player->spreecount; + if (this->IsTeammate(source)) + { + source->player->fragcount--; + } + else + { + ++source->player->fragcount; + ++source->player->spreecount; + } + if (source->player->morphTics) { // Make a super chicken source->GiveInventoryType (RUNTIME_CLASS(APowerWeaponLevel2)); } + if (deathmatch && cl_showsprees) { const char *spreemsg; From 1a275a7e8eb91dfefa341b1745235759fd465cb2 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Wed, 2 Sep 2015 23:15:41 +0200 Subject: [PATCH 18/22] - removed the initial extra state of Heretic's Mummy's projectile to restore the original sound behavior. --- wadsrc/static/actors/heretic/mummy.txt | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/wadsrc/static/actors/heretic/mummy.txt b/wadsrc/static/actors/heretic/mummy.txt index 46e9deaba..c06f519f6 100644 --- a/wadsrc/static/actors/heretic/mummy.txt +++ b/wadsrc/static/actors/heretic/mummy.txt @@ -121,12 +121,11 @@ ACTOR MummyFX1 States { Spawn: - FX15 A 1 Bright FX15 A 5 Bright A_PlaySound("mummy/head") FX15 B 5 Bright A_SeekerMissile(10,20) FX15 C 5 Bright FX15 B 5 Bright A_SeekerMissile(10,20) - Goto Spawn+1 + Loop Death: FX15 DEFG 5 Bright Stop From 8ec4d431cfcba1479d5631613a6c8b4ea20bf2a7 Mon Sep 17 00:00:00 2001 From: Edward Richardson Date: Sat, 5 Sep 2015 14:12:52 +1200 Subject: [PATCH 19/22] Fixed memory leak in joystick menu --- src/menu/joystickmenu.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/menu/joystickmenu.cpp b/src/menu/joystickmenu.cpp index a7d950ed5..676bc1767 100644 --- a/src/menu/joystickmenu.cpp +++ b/src/menu/joystickmenu.cpp @@ -345,8 +345,8 @@ void UpdateJoystickMenu(IJoystickConfig *selected) for(unsigned i=0;imItems.Size();i++) { delete opt->mItems[i]; - opt->mItems.Clear(); } + opt->mItems.Clear(); int i; int itemnum = -1; From abb033d400eed5a5d3c2577b86764695c6d80cf6 Mon Sep 17 00:00:00 2001 From: Edward Richardson Date: Sat, 5 Sep 2015 14:18:48 +1200 Subject: [PATCH 20/22] Fix deallocation of controllers with no axes --- src/win32/i_dijoy.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/win32/i_dijoy.cpp b/src/win32/i_dijoy.cpp index ccbc7ecdc..439e0fda7 100644 --- a/src/win32/i_dijoy.cpp +++ b/src/win32/i_dijoy.cpp @@ -309,7 +309,7 @@ FDInputJoystick::~FDInputJoystick() { Joy_GenerateButtonEvents(Axes[0].ButtonValue, 0, 2, KEY_JOYAXIS1PLUS); } - else + else if (Axes.Size() > 1) { Joy_GenerateButtonEvents(Axes[1].ButtonValue, 0, 4, KEY_JOYAXIS1PLUS); for (i = 2; i < Axes.Size(); ++i) From 9aabc852816921ed1c95e6bba094961fc8dbcaab Mon Sep 17 00:00:00 2001 From: Edward Richardson Date: Sat, 5 Sep 2015 17:13:54 +1200 Subject: [PATCH 21/22] Fixed loading default map saves - Just like normal maps, default map stores an FString as a map name. --- src/g_level.cpp | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/g_level.cpp b/src/g_level.cpp index 899f96d4f..15d88ccaf 100644 --- a/src/g_level.cpp +++ b/src/g_level.cpp @@ -1791,8 +1791,14 @@ void G_ReadSnapshots (PNGHandle *png) DWORD snapver; arc << snapver; - arc << namelen; - arc.Read (mapname, namelen); + if (SaveVersion < 4508) + { + arc << namelen; + arc.Read(mapname, namelen); + mapname[namelen] = 0; + MapName = mapname; + } + else arc << MapName; TheDefaultLevelInfo.snapshotVer = snapver; TheDefaultLevelInfo.snapshot = new FCompressedMemFile; TheDefaultLevelInfo.snapshot->Serialize (arc); From e939d6885d293020469840eef43a0ad42f902a8e Mon Sep 17 00:00:00 2001 From: Edoardo Prezioso Date: Sat, 5 Sep 2015 23:58:02 +0200 Subject: [PATCH 22/22] - Fixed a crash in ACS strlen parsing with invalid argument. --- src/p_acs.cpp | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/src/p_acs.cpp b/src/p_acs.cpp index b703b87dd..54f9fa658 100644 --- a/src/p_acs.cpp +++ b/src/p_acs.cpp @@ -8880,7 +8880,22 @@ scriptwait: break; case PCD_STRLEN: - STACK(1) = SDWORD(strlen(FBehavior::StaticLookupString (STACK(1)))); + { + const char *str = FBehavior::StaticLookupString(STACK(1)); + if (str != NULL) + { + STACK(1) = SDWORD(strlen(str)); + break; + } + + static bool StrlenInvalidPrintedAlready = false; + if (!StrlenInvalidPrintedAlready) + { + Printf(PRINT_BOLD, "Warning: ACS function strlen called with invalid string argument.\n"); + StrlenInvalidPrintedAlready = true; + } + STACK(1) = 0; + } break; case PCD_GETCVAR: