From 2f11a59be0d743b04d7a7885624ad7925a8f545c Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Fri, 31 Oct 2014 08:57:43 +0100 Subject: [PATCH 01/15] - fixed: UDMF ceiling plane properties set the map's floor plane values. --- src/p_udmf.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/p_udmf.cpp b/src/p_udmf.cpp index b4700e8568..541d7d3960 100644 --- a/src/p_udmf.cpp +++ b/src/p_udmf.cpp @@ -1541,11 +1541,11 @@ public: double ulen = TVector3(cp[0], cp[1], cp[2]).Length(); // normalize the vector, it must have a length of 1 - sec->floorplane.a = FLOAT2FIXED(cp[0] / ulen); - sec->floorplane.b = FLOAT2FIXED(cp[1] / ulen); - sec->floorplane.c = FLOAT2FIXED(cp[2] / ulen); - sec->floorplane.d = FLOAT2FIXED(cp[3] / ulen); - sec->floorplane.ic = FLOAT2FIXED(ulen / cp[2]); + sec->ceilingplane.a = FLOAT2FIXED(cp[0] / ulen); + sec->ceilingplane.b = FLOAT2FIXED(cp[1] / ulen); + sec->ceilingplane.c = FLOAT2FIXED(cp[2] / ulen); + sec->ceilingplane.d = FLOAT2FIXED(cp[3] / ulen); + sec->ceilingplane.ic = FLOAT2FIXED(ulen / cp[2]); } if (lightcolor == -1 && fadecolor == -1 && desaturation == -1) From c85105f5520f873f8c32bfddbf612260025b2ae4 Mon Sep 17 00:00:00 2001 From: Edward Richardson Date: Fri, 31 Oct 2014 22:50:23 +1300 Subject: [PATCH 02/15] Added cl_showsecretmessage Controls if secret notifications are displayed (def. true) --- src/p_spec.cpp | 3 ++- wadsrc/static/menudef.txt | 1 + 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/src/p_spec.cpp b/src/p_spec.cpp index d58062a7e8..6761915557 100644 --- a/src/p_spec.cpp +++ b/src/p_spec.cpp @@ -714,6 +714,7 @@ void P_SectorDamage(int tag, int amount, FName type, const PClass *protectClass, //============================================================================ CVAR(Bool, showsecretsector, false, 0) +CVAR(Bool, cl_showsecretmessage, true, CVAR_ARCHIVE) void P_GiveSecret(AActor *actor, bool printmessage, bool playsound, int sectornum) { @@ -723,7 +724,7 @@ void P_GiveSecret(AActor *actor, bool printmessage, bool playsound, int sectornu { actor->player->secretcount++; } - if (actor->CheckLocalView (consoleplayer)) + if (cl_showsecretmessage && actor->CheckLocalView(consoleplayer)) { if (printmessage) { diff --git a/wadsrc/static/menudef.txt b/wadsrc/static/menudef.txt index 3d5a3ea3cf..408e534a8c 100644 --- a/wadsrc/static/menudef.txt +++ b/wadsrc/static/menudef.txt @@ -1098,6 +1098,7 @@ OptionMenu MessageOptions Title "MESSAGES" Option "Show messages", "show_messages", "OnOff" Option "Show obituaries", "show_obituaries", "OnOff" + Option "Show secret notifications", "cl_showsecretmessage", "OnOff" Option "Scale text in high res", "con_scaletext", "ScaleValues" Option "Minimum message level", "msg", "MessageLevels" Option "Center messages", "con_centernotify", "OnOff" From 0ff65bb43089fcae61c272b65a43987a82e11820 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Fri, 31 Oct 2014 21:08:13 +0100 Subject: [PATCH 03/15] - fixed: AActor::Massacre must return true only when it actually kills a monster. --- src/p_mobj.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/p_mobj.cpp b/src/p_mobj.cpp index 465a4d7456..a92eed8f81 100644 --- a/src/p_mobj.cpp +++ b/src/p_mobj.cpp @@ -1167,7 +1167,7 @@ bool AActor::Massacre () P_DamageMobj (this, NULL, NULL, TELEFRAG_DAMAGE, NAME_Massacre); } while (health != prevhealth && health > 0); //abort if the actor wasn't hurt. - return true; + return health <= 0; } return false; } From 938b54ccb5f62f864edcc1edf26fcd42304ddb84 Mon Sep 17 00:00:00 2001 From: MajorCooke Date: Fri, 31 Oct 2014 15:41:23 -0500 Subject: [PATCH 04/15] - Added TF_FORCED for A_Teleport. Forces the actor to move to the spot. --- src/thingdef/thingdef_codeptr.cpp | 18 ++++++++++++++++-- wadsrc/static/actors/constants.txt | 4 +++- 2 files changed, 19 insertions(+), 3 deletions(-) diff --git a/src/thingdef/thingdef_codeptr.cpp b/src/thingdef/thingdef_codeptr.cpp index 80583b5870..2732337c72 100644 --- a/src/thingdef/thingdef_codeptr.cpp +++ b/src/thingdef/thingdef_codeptr.cpp @@ -4054,6 +4054,7 @@ enum T_Flags { TF_TELEFRAG = 1, // Allow telefrag in order to teleport. TF_RANDOMDECIDE = 2, // Randomly fail based on health. (A_Srcr2Decide) + TF_FORCED = 4, // Forget what's in the way. TF_Telefrag takes precedence though. }; DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_Teleport) @@ -4103,7 +4104,20 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_Teleport) fixed_t prevX = self->x; fixed_t prevY = self->y; fixed_t prevZ = self->z; - if (P_TeleportMove (self, spot->x, spot->y, spot->z, Flags & TF_TELEFRAG)) + bool teleResult = false; + + //Take precedence and cooperate with telefragging first. + if (P_TeleportMove(self, spot->x, spot->y, spot->z, Flags & TF_TELEFRAG)) + teleResult = true; + + if ((!(teleResult)) && (Flags & TF_FORCED)) + { + //If for some reason the original move didn't work, regardless of telefrag, force it to move. + self->SetOrigin(spot->x, spot->y, spot->z); + teleResult = true; + } + + if (teleResult) { ACTION_SET_RESULT(false); // Jumps should never set the result for inventory state chains! @@ -4509,7 +4523,7 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_Warp) self->PrevY = self->y + reference->PrevY - reference->y; self->PrevZ = self->z + reference->PrevZ - reference->z; } - else if (! (flags & WARPF_INTERPOLATE)) + else if (!(flags & WARPF_INTERPOLATE)) { self->PrevX = self->x; self->PrevY = self->y; diff --git a/wadsrc/static/actors/constants.txt b/wadsrc/static/actors/constants.txt index a43d90f96f..78741e059f 100644 --- a/wadsrc/static/actors/constants.txt +++ b/wadsrc/static/actors/constants.txt @@ -181,7 +181,9 @@ const int FPF_AIMATANGLE = 1; const int FPF_TRANSFERTRANSLATION = 2; // Flags for A_Teleport -const int TF_TELEFRAG = 1;const int TF_RANDOMDECIDE = 2; +const int TF_TELEFRAG = 1; +const int TF_RANDOMDECIDE = 2; +const int TF_FORCED = 4; // Flags for A_WolfAttack const int WAF_NORANDOM = 1; From eceb37aa64d2286ab181768aefbab470de17f257 Mon Sep 17 00:00:00 2001 From: Edward Richardson Date: Sat, 1 Nov 2014 17:47:29 +1300 Subject: [PATCH 05/15] Added recordmap for recording demos from console recordmap Starts a new game from the specified map recording to the specified filename --- src/d_event.h | 1 + src/d_main.cpp | 1 + src/doomstat.h | 2 ++ src/g_game.cpp | 16 ++++++++++++++++ src/g_level.cpp | 40 ++++++++++++++++++++++++++++++++++++++++ 5 files changed, 60 insertions(+) diff --git a/src/d_event.h b/src/d_event.h index 5bd4b02e05..7a9b48eb88 100644 --- a/src/d_event.h +++ b/src/d_event.h @@ -61,6 +61,7 @@ typedef enum ga_loadlevel, ga_newgame, ga_newgame2, + ga_recordgame, ga_loadgame, ga_loadgamehidecon, ga_loadgameplaydemo, diff --git a/src/d_main.cpp b/src/d_main.cpp index 79c8990855..e08b1539e3 100644 --- a/src/d_main.cpp +++ b/src/d_main.cpp @@ -1338,6 +1338,7 @@ CCMD (endgame) { gameaction = ga_fullconsole; demosequence = -1; + G_CheckDemoStatus(); } } diff --git a/src/doomstat.h b/src/doomstat.h index 92ab5b8f82..1559609f11 100644 --- a/src/doomstat.h +++ b/src/doomstat.h @@ -136,6 +136,8 @@ extern int consoleplayer; // Disable save/end game? extern bool usergame; +extern FString newdemoname; +extern FString newdemomap; extern bool demoplayback; extern bool demorecording; extern int demover; diff --git a/src/g_game.cpp b/src/g_game.cpp index 8419fc017c..1ea1c6b68d 100644 --- a/src/g_game.cpp +++ b/src/g_game.cpp @@ -162,6 +162,8 @@ int consoleplayer; // player taking events int gametic; CVAR(Bool, demo_compress, true, CVAR_ARCHIVE|CVAR_GLOBALCONFIG); +FString newdemoname; +FString newdemomap; FString demoname; bool demorecording; bool demoplayback; @@ -1048,6 +1050,10 @@ void G_Ticker () case ga_loadlevel: G_DoLoadLevel (-1, false); break; + case ga_recordgame: + G_CheckDemoStatus(); + G_RecordDemo(newdemoname); + G_BeginRecording(newdemomap); case ga_newgame2: // Silence GCC (see above) case ga_newgame: G_DoNewGame (); @@ -2434,6 +2440,16 @@ void G_DeferedPlayDemo (const char *name) CCMD (playdemo) { + if (netgame) + { + Printf("End your current netgame first!"); + return; + } + if (demorecording) + { + Printf("End your current demo first!"); + return; + } if (argv.argc() > 1) { G_DeferedPlayDemo (argv[1]); diff --git a/src/g_level.cpp b/src/g_level.cpp index f21a1dfe5f..2a2d6471a9 100644 --- a/src/g_level.cpp +++ b/src/g_level.cpp @@ -199,6 +199,46 @@ CCMD (map) // //========================================================================== +CCMD(recordmap) +{ + if (netgame) + { + Printf("You cannot record a new game while in a netgame."); + return; + } + if (argv.argc() > 2) + { + try + { + if (!P_CheckMapData(argv[2])) + { + Printf("No map %s\n", argv[2]); + } + else + { + G_DeferedInitNew(argv[2]); + gameaction = ga_recordgame; + newdemoname = argv[1]; + newdemomap = argv[2]; + } + } + catch (CRecoverableError &error) + { + if (error.GetMessage()) + Printf("%s", error.GetMessage()); + } + } + else + { + Printf("Usage: recordmap \n"); + } +} + +//========================================================================== +// +// +//========================================================================== + CCMD (open) { if (netgame) From 2e085b23188b3472f1595340fe04eb85bf19f459 Mon Sep 17 00:00:00 2001 From: MajorCooke Date: Sat, 1 Nov 2014 00:00:29 -0500 Subject: [PATCH 06/15] - Added ALLOWPAIN flag. Monsters with this flag can enter pain states, regardless of invulnerability or damage absorption. - Fixed: god2 cheat wasn't being considered for drowning and thrusting. --- src/actor.h | 1 + src/p_interaction.cpp | 88 +++++++++++++++++++++++++++------- src/p_mobj.cpp | 2 +- src/p_user.cpp | 3 +- src/thingdef/thingdef_data.cpp | 1 + 5 files changed, 77 insertions(+), 18 deletions(-) diff --git a/src/actor.h b/src/actor.h index 6c9d53a4f2..22f4cb7767 100644 --- a/src/actor.h +++ b/src/actor.h @@ -345,6 +345,7 @@ enum MF7_BUDDHA = 0x00000040, // Behaves just like the buddha cheat. MF7_FOILBUDDHA = 0x00000080, // Similar to FOILINVUL, foils buddha mode. MF7_DONTTHRUST = 0x00000100, // Thrusting functions do not take, and do not give thrust (damage) to actors with this flag. + MF7_ALLOWPAIN = 0x00000200, // Invulnerable or immune (via damagefactors) actors can still react to taking damage even if they don't. // --- mobj.renderflags --- diff --git a/src/p_interaction.cpp b/src/p_interaction.cpp index 860e30d0fe..f318ed3b37 100644 --- a/src/p_interaction.cpp +++ b/src/p_interaction.cpp @@ -938,6 +938,10 @@ int P_DamageMobj (AActor *target, AActor *inflictor, AActor *source, int damage, FState * woundstate = NULL; PainChanceList * pc = NULL; bool justhit = false; + bool plrDontThrust = false; + bool invulpain = false; + int fakeDamage = 0; + int holdDamage = 0; if (target == NULL || !((target->flags & MF_SHOOTABLE) || (target->flags6 & MF6_VULNERABLE))) { // Shouldn't happen @@ -972,7 +976,14 @@ int P_DamageMobj (AActor *target, AActor *inflictor, AActor *source, int damage, { if (inflictor == NULL || (!(inflictor->flags3 & MF3_FOILINVUL) && !(flags & DMG_FOILINVUL))) { - return -1; + if (target->flags7 & MF7_ALLOWPAIN) + { + invulpain = true; //This returns -1 later. + fakeDamage = damage; + goto fakepain; //The label is above the massive pile of checks. + } + else + return -1; } } else @@ -980,11 +991,21 @@ int P_DamageMobj (AActor *target, AActor *inflictor, AActor *source, int damage, // Players are optionally excluded from getting thrust by damage. if (static_cast(target)->PlayerFlags & PPF_NOTHRUSTWHENINVUL) { - return -1; + if (target->flags7 & MF7_ALLOWPAIN) + plrDontThrust = 1; + else + return -1; } } } + if ((target->flags7 & MF7_ALLOWPAIN) && (damage < TELEFRAG_DAMAGE)) + { + //Intentionally do not jump to fakepain because the damage hasn't been dished out yet. + //Once it's dished out, THEN we can disregard damage factors affecting pain chances. + fakeDamage = damage; + } + if (inflictor != NULL) { if (inflictor->flags5 & MF5_PIERCEARMOR) @@ -1010,6 +1031,7 @@ int P_DamageMobj (AActor *target, AActor *inflictor, AActor *source, int damage, // Invulnerable, and won't wake up return -1; } + player = target->player; if (player && damage > 1 && damage < TELEFRAG_DAMAGE) { @@ -1032,10 +1054,13 @@ int P_DamageMobj (AActor *target, AActor *inflictor, AActor *source, int damage, return -1; } } + if (damage > 0) + damage = inflictor->DoSpecialDamage (target, damage, mod); - damage = inflictor->DoSpecialDamage (target, damage, mod); if (damage == -1) { + if (target->flags7 & MF7_ALLOWPAIN) //Hold off ending the function before we can deal the pain chances. + goto fakepain; return -1; } } @@ -1058,12 +1083,15 @@ int P_DamageMobj (AActor *target, AActor *inflictor, AActor *source, int damage, { int olddam = damage; target->Inventory->ModifyDamage(olddam, mod, damage, true); - if (olddam != damage && damage <= 0) - { // Still allow FORCEPAIN + if (((target->flags7 & MF7_ALLOWPAIN) && (fakeDamage <= 0)) || (olddam != damage && damage <= 0)) + { // Still allow FORCEPAIN and make sure we're still passing along fake damage to hit enemies for their pain states. if (MustForcePain(target, inflictor)) { goto dopain; } + else if (target->flags7 & MF7_ALLOWPAIN) + goto fakepain; + return -1; } } @@ -1081,19 +1109,25 @@ int P_DamageMobj (AActor *target, AActor *inflictor, AActor *source, int damage, { goto dopain; } + else if (target->flags7 & MF7_ALLOWPAIN) + goto fakepain; + return -1; } } - - damage = target->TakeSpecialDamage (inflictor, source, damage, mod); + if (damage > 0) + damage = target->TakeSpecialDamage (inflictor, source, damage, mod); } if (damage == -1) { + if (target->flags7 & MF7_ALLOWPAIN) + goto fakepain; + return -1; } // Push the target unless the source's weapon's kickback is 0. // (i.e. Gauntlets/Chainsaw) - if (inflictor && inflictor != target // [RH] Not if hurting own self + if (!(plrDontThrust) && inflictor && inflictor != target // [RH] Not if hurting own self && !(target->flags & MF_NOCLIP) && !(inflictor->flags2 & MF2_NODMGTHRUST) && !(flags & DMG_THRUSTLESS) @@ -1134,11 +1168,10 @@ int P_DamageMobj (AActor *target, AActor *inflictor, AActor *source, int damage, { fltthrust = clamp((damage * 0.125 * kickback) / target->Mass, 0., fltthrust); } - thrust = FLOAT2FIXED(fltthrust); - - // Don't apply ultra-small damage thrust - if (thrust < FRACUNIT/100) thrust = 0; + // Don't apply ultra-small damage thrust. + if (thrust < FRACUNIT / 100) + thrust = 0; // make fall forwards sometimes if ((damage < 40) && (damage > target->health) @@ -1147,8 +1180,7 @@ int P_DamageMobj (AActor *target, AActor *inflictor, AActor *source, int damage, // [RH] But only if not too fast and not flying && thrust < 10*FRACUNIT && !(target->flags & MF_NOGRAVITY) - && (inflictor == NULL || !(inflictor->flags5 & MF5_NOFORWARDFALL)) - ) + && (inflictor == NULL || !(inflictor->flags5 & MF5_NOFORWARDFALL))) { ang += ANG180; thrust *= 4; @@ -1215,6 +1247,12 @@ int P_DamageMobj (AActor *target, AActor *inflictor, AActor *source, int damage, (player->cheats & CF_GODMODE2) || (player->mo->flags5 & MF5_NODAMAGE)) //Absolutely no hurting if NODAMAGE is involved. Same for GODMODE2. { // player is invulnerable, so don't hurt him + if (player->mo->flags7 & MF7_ALLOWPAIN) + { + invulpain = true; + fakeDamage = damage; + goto fakepain; + } return -1; } @@ -1232,7 +1270,8 @@ int P_DamageMobj (AActor *target, AActor *inflictor, AActor *source, int damage, { // If MF6_FORCEPAIN is set, make the player enter the pain state. if (!(target->flags5 & MF5_NOPAIN) && inflictor != NULL && - (inflictor->flags6 & MF6_FORCEPAIN) && !(inflictor->flags5 & MF5_PAINLESS)) + (inflictor->flags6 & MF6_FORCEPAIN) && !(inflictor->flags5 & MF5_PAINLESS) && + (!(player->mo->flags2 & MF2_INVULNERABLE))) { goto dopain; } @@ -1296,7 +1335,10 @@ int P_DamageMobj (AActor *target, AActor *inflictor, AActor *source, int damage, damage = newdam; if (damage <= 0) { - return damage; + if (target->flags7 & MF7_ALLOWPAIN) + goto fakepain; + else + return damage; } } @@ -1383,6 +1425,12 @@ int P_DamageMobj (AActor *target, AActor *inflictor, AActor *source, int damage, } } +fakepain: //Needed so we can skip the rest of the above, but still obey the original rules. + if (target->flags7 & MF7_ALLOWPAIN && (fakeDamage != damage)) + { + holdDamage = damage; + damage = fakeDamage; + } if (!(target->flags5 & MF5_NOPAIN) && (inflictor == NULL || !(inflictor->flags5 & MF5_PAINLESS)) && (target->player != NULL || !G_SkillProperty(SKILLP_NoPain)) && !(target->flags & MF_SKULLFLY)) @@ -1474,6 +1522,14 @@ dopain: if (justhit && (target->target == source || !target->target || !target->IsFriend(target->target))) target->flags |= MF_JUSTHIT; // fight back! + if (invulpain) //Note that this takes into account all the cheats a player has, in terms of invulnerability. + { + return -1; //NOW we return -1! + } + else if (target->flags7 & MF7_ALLOWPAIN) + { + return holdDamage; + } return damage; } diff --git a/src/p_mobj.cpp b/src/p_mobj.cpp index a92eed8f81..bae4563b39 100644 --- a/src/p_mobj.cpp +++ b/src/p_mobj.cpp @@ -5986,7 +5986,7 @@ bool AActor::IsHostile (AActor *other) int AActor::DoSpecialDamage (AActor *target, int damage, FName damagetype) { if (target->player && target->player->mo == target && damage < 1000 && - (target->player->cheats & CF_GODMODE)) + (target->player->cheats & CF_GODMODE || target->player->cheats & CF_GODMODE2)) { return -1; } diff --git a/src/p_user.cpp b/src/p_user.cpp index 045e619694..8eddf31354 100644 --- a/src/p_user.cpp +++ b/src/p_user.cpp @@ -2588,7 +2588,8 @@ void P_PlayerThink (player_t *player) { if (player->mo->waterlevel < 3 || (player->mo->flags2 & MF2_INVULNERABLE) || - (player->cheats & (CF_GODMODE | CF_NOCLIP2))) + (player->cheats & (CF_GODMODE | CF_NOCLIP2)) || + (player->cheats & CF_GODMODE2)) { player->mo->ResetAirSupply (); } diff --git a/src/thingdef/thingdef_data.cpp b/src/thingdef/thingdef_data.cpp index dbd1f10318..347b2e01a3 100644 --- a/src/thingdef/thingdef_data.cpp +++ b/src/thingdef/thingdef_data.cpp @@ -245,6 +245,7 @@ static FFlagDef ActorFlags[]= DEFINE_FLAG(MF7, BUDDHA, AActor, flags7), DEFINE_FLAG(MF7, FOILBUDDHA, AActor, flags7), DEFINE_FLAG(MF7, DONTTHRUST, AActor, flags7), + DEFINE_FLAG(MF7, ALLOWPAIN, AActor, flags7), // Effect flags DEFINE_FLAG(FX, VISIBILITYPULSE, AActor, effects), From 043b28f4ba69f681a279ae02f752f33e10e6b54d Mon Sep 17 00:00:00 2001 From: Edward Richardson Date: Sun, 2 Nov 2014 17:58:59 +1300 Subject: [PATCH 07/15] Make Prediction lerping less pick + debug - Lerping uses int rather than fixed/float comparisons - Added debug information --- src/p_user.cpp | 49 ++++++++++++++++++++++++++++++++++--------------- 1 file changed, 34 insertions(+), 15 deletions(-) diff --git a/src/p_user.cpp b/src/p_user.cpp index 045e619694..c59e35122a 100644 --- a/src/p_user.cpp +++ b/src/p_user.cpp @@ -78,7 +78,9 @@ CUSTOM_CVAR(Float, cl_predict_lerpthreshold, 2.00f, CVAR_ARCHIVE | CVAR_GLOBALCO struct PredictPos { int gametic; - FVector3 point; + fixed_t x; + fixed_t y; + fixed_t z; fixed_t pitch; fixed_t yaw; } static PredictionLerpFrom, PredictionLerpResult, PredictionLast; @@ -2605,12 +2607,19 @@ void P_PredictionLerpReset() PredictionLerptics = PredictionLast.gametic = PredictionLerpFrom.gametic = PredictionLerpResult.gametic = 0; } -bool P_LerpCalculate(FVector3 from, FVector3 to, FVector3 &result, float scale) +bool P_LerpCalculate(PredictPos from, PredictPos to, PredictPos &result, float scale) { - result = to - from; - result *= scale; - result = result + from; - FVector3 delta = result - to; + FVector3 vecFrom(FIXED2DBL(from.x), FIXED2DBL(from.y), FIXED2DBL(from.z)); + FVector3 vecTo(FIXED2DBL(to.x), FIXED2DBL(to.y), FIXED2DBL(to.z)); + FVector3 vecResult; + vecResult = vecTo - vecFrom; + vecResult *= scale; + vecResult = vecResult + vecFrom; + FVector3 delta = vecResult - vecTo; + + result.x = FLOAT2FIXED(vecResult.X); + result.y = FLOAT2FIXED(vecResult.Y); + result.z = FLOAT2FIXED(vecResult.Z); // As a fail safe, assume extrapolation is the threshold. return (delta.LengthSquared() > cl_predict_lerpthreshold && scale <= 1.00f); @@ -2715,8 +2724,18 @@ void P_PredictPlayer (player_t *player) if (CanLerp && PredictionLast.gametic > 0 && i == PredictionLast.gametic && !NoInterpolateOld) { // Z is not compared as lifts will alter this with no apparent change - DoLerp = (PredictionLast.point.X != FIXED2FLOAT(player->mo->x) || - PredictionLast.point.Y != FIXED2FLOAT(player->mo->y)); + // Make lerping less picky by only testing whole units + DoLerp = ((PredictionLast.x >> 16) != (player->mo->x >> 16) || + (PredictionLast.y >> 16) != (player->mo->y >> 16)); + + // Aditional Debug information + if (developer && DoLerp) + { + DPrintf("Lerp! Ltic (%d) && Ptic (%d) | Lx (%d) && Px (%d) | Ly (%d) && Py (%d)\n", + PredictionLast.gametic, i, + (PredictionLast.x >> 16), (player->mo->x >> 16), + (PredictionLast.y >> 16), (player->mo->y >> 16)); + } } } @@ -2733,19 +2752,19 @@ void P_PredictPlayer (player_t *player) } PredictionLast.gametic = maxtic - 1; - PredictionLast.point.X = FIXED2FLOAT(player->mo->x); - PredictionLast.point.Y = FIXED2FLOAT(player->mo->y); - PredictionLast.point.Z = FIXED2FLOAT(player->mo->z); + PredictionLast.x = player->mo->x; + PredictionLast.y = player->mo->y; + PredictionLast.z = player->mo->z; if (PredictionLerptics > 0) { if (PredictionLerpFrom.gametic > 0 && - P_LerpCalculate(PredictionLerpFrom.point, PredictionLast.point, PredictionLerpResult.point, (float)PredictionLerptics * cl_predict_lerpscale)) + P_LerpCalculate(PredictionLerpFrom, PredictionLast, PredictionLerpResult, (float)PredictionLerptics * cl_predict_lerpscale)) { PredictionLerptics++; - player->mo->x = FLOAT2FIXED(PredictionLerpResult.point.X); - player->mo->y = FLOAT2FIXED(PredictionLerpResult.point.Y); - player->mo->z = FLOAT2FIXED(PredictionLerpResult.point.Z); + player->mo->x = PredictionLerpResult.x; + player->mo->y = PredictionLerpResult.y; + player->mo->z = PredictionLerpResult.z; } else { From 8f915c9dcc0f1874a4bbdb92418e29f67933e534 Mon Sep 17 00:00:00 2001 From: "alexey.lysiuk" Date: Sun, 2 Nov 2014 15:58:47 +0200 Subject: [PATCH 08/15] Fixed broken ACS on Big Endian platforms This fixes maps transition in Strife http://forum.zdoom.org/viewtopic.php?f=2&t=36754 --- src/p_acs.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/p_acs.cpp b/src/p_acs.cpp index e48e97e86c..4150ee231e 100644 --- a/src/p_acs.cpp +++ b/src/p_acs.cpp @@ -7296,7 +7296,7 @@ scriptwait: while (min <= max) { int mid = (min + max) / 2; - SDWORD caseval = pc[mid*2]; + SDWORD caseval = LittleLong(pc[mid*2]); if (caseval == STACK(1)) { pc = activeBehavior->Ofs2PC (LittleLong(pc[mid*2+1])); From c63adf920a5ed52c4380c8cc32449a1b06686863 Mon Sep 17 00:00:00 2001 From: MajorCooke Date: Wed, 5 Nov 2014 22:05:21 -0600 Subject: [PATCH 09/15] - Fixed: BUDDHA flag on a player wasn't considered. --- src/p_interaction.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/p_interaction.cpp b/src/p_interaction.cpp index f318ed3b37..d0d1152179 100644 --- a/src/p_interaction.cpp +++ b/src/p_interaction.cpp @@ -1302,7 +1302,7 @@ int P_DamageMobj (AActor *target, AActor *inflictor, AActor *source, int damage, // telefrag him right? ;) (Unfortunately the damage is "absorbed" by armor, // but telefragging should still do enough damage to kill the player) // Ignore players that are already dead. - if (((player->cheats & CF_BUDDHA2) || ((player->cheats & CF_BUDDHA) && damage < TELEFRAG_DAMAGE)) && player->playerstate != PST_DEAD) + if (((player->cheats & CF_BUDDHA2) || ((player->cheats & CF_BUDDHA) || (player->mo->flags7 & MF7_BUDDHA) && damage < TELEFRAG_DAMAGE)) && player->playerstate != PST_DEAD) { // If this is a voodoo doll we need to handle the real player as well. player->mo->health = target->health = player->health = 1; @@ -1744,7 +1744,7 @@ void P_PoisonDamage (player_t *player, AActor *source, int damage, target->health -= damage; if (target->health <= 0) { // Death - if ((player->cheats & CF_BUDDHA && damage < TELEFRAG_DAMAGE) || (player->cheats & CF_BUDDHA2)) + if ((((player->cheats & CF_BUDDHA) || (player->mo->flags7 & MF7_BUDDHA)) && damage < TELEFRAG_DAMAGE) || (player->cheats & CF_BUDDHA2)) { // [SP] Save the player... player->health = target->health = 1; } From 95bd6bde9a754a8f696ba470e28c33d2edb14bc2 Mon Sep 17 00:00:00 2001 From: MajorCooke Date: Wed, 5 Nov 2014 23:06:28 -0600 Subject: [PATCH 10/15] - Added FOILBUDDHA check for A_BFGSpray. --- src/g_doom/a_doomweaps.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/g_doom/a_doomweaps.cpp b/src/g_doom/a_doomweaps.cpp index 38c823e181..976ffbfc4d 100644 --- a/src/g_doom/a_doomweaps.cpp +++ b/src/g_doom/a_doomweaps.cpp @@ -609,9 +609,12 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_BFGSpray) damage = defdamage; } + int dmgFlagPass = 0; + dmgFlagPass += (spray != NULL && (spray->flags3 & MF3_FOILINVUL)) ? DMG_FOILINVUL : 0; //[MC]Because the original foilinvul wasn't working. + dmgFlagPass += (spray != NULL && (spray->flags7 & MF7_FOILBUDDHA)) ? DMG_FOILBUDDHA : 0; thingToHit = linetarget; int newdam = P_DamageMobj (thingToHit, self->target, self->target, damage, spray != NULL? FName(spray->DamageType) : FName(NAME_BFGSplash), - spray != NULL && (spray->flags3 & MF3_FOILINVUL)? DMG_FOILINVUL : 0); + dmgFlagPass); P_TraceBleed (newdam > 0 ? newdam : damage, thingToHit, self->target); } } From 71ce4bcf06a09ad2bc7b903ee8082946b3de96d6 Mon Sep 17 00:00:00 2001 From: MajorCooke Date: Wed, 5 Nov 2014 23:16:01 -0600 Subject: [PATCH 11/15] - Fixed: Rail attacks didn't properly respect FOILINVUL. - Added: FOILBUDDHA support for rail attacks. --- src/p_map.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/p_map.cpp b/src/p_map.cpp index b688ef43d9..44db5f4d88 100644 --- a/src/p_map.cpp +++ b/src/p_map.cpp @@ -4111,7 +4111,7 @@ void P_RailAttack(AActor *source, int damage, int offset_xy, fixed_t offset_z, i z = shootz + FixedMul(hitdist, vz); if ((hitactor->flags & MF_NOBLOOD) || - (hitactor->flags2 & (MF2_DORMANT | MF2_INVULNERABLE))) + (hitactor->flags2 & MF2_DORMANT || ((hitactor->flags2 & MF2_INVULNERABLE) && !(puffDefaults->flags3 & MF3_FOILINVUL)))) { spawnpuff = (puffclass != NULL); } @@ -4132,7 +4132,10 @@ void P_RailAttack(AActor *source, int damage, int offset_xy, fixed_t offset_z, i { P_PoisonMobj(hitactor, thepuff ? thepuff : source, source, puffDefaults->PoisonDamage, puffDefaults->PoisonDuration, puffDefaults->PoisonPeriod, puffDefaults->PoisonDamageType); } - int newdam = P_DamageMobj(hitactor, thepuff ? thepuff : source, source, damage, damagetype, DMG_INFLICTOR_IS_PUFF); + int dmgFlagPass = DMG_INFLICTOR_IS_PUFF; + dmgFlagPass += (puffDefaults->flags3 & MF3_FOILINVUL) ? DMG_FOILINVUL : 0; //[MC]Because the original foilinvul check wasn't working. + dmgFlagPass += (puffDefaults->flags7 & MF7_FOILBUDDHA) ? DMG_FOILBUDDHA : 0; + int newdam = P_DamageMobj(hitactor, thepuff ? thepuff : source, source, damage, damagetype, dmgFlagPass); if (bleed) { P_SpawnBlood(x, y, z, (source->angle + angleoffset) - ANG180, newdam > 0 ? newdam : damage, hitactor); From 848225e9ee01621357dc7ecee9e6c27f990d079d Mon Sep 17 00:00:00 2001 From: MajorCooke Date: Fri, 7 Nov 2014 17:12:03 -0600 Subject: [PATCH 12/15] - Fixed typo on WARPF_ABSOLUTEPOSITION --- wadsrc/static/actors/constants.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/wadsrc/static/actors/constants.txt b/wadsrc/static/actors/constants.txt index 78741e059f..dec1493996 100644 --- a/wadsrc/static/actors/constants.txt +++ b/wadsrc/static/actors/constants.txt @@ -327,7 +327,7 @@ Const Int WARPF_COPYINTERPOLATION = 0x40; Const Int WARPF_STOP = 0x80; Const Int WARPF_TOFLOOR = 0x100; Const Int WARPF_TESTONLY = 0x200; -Const Int WAPRF_ABSOLUTEPOSITION = 0x400; +Const Int WARPF_ABSOLUTEPOSITION = 0x400; // flags for A_SetPitch/SetAngle const int SPF_FORCECLAMP = 1; From 364d9069bd9a68b8f08d8714df4e92f2bffb018a Mon Sep 17 00:00:00 2001 From: MajorCooke Date: Fri, 7 Nov 2014 17:20:12 -0600 Subject: [PATCH 13/15] In fact, let's go ahead and ensure compatibility doesn't break since it's already in there. --- wadsrc/static/actors/constants.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/wadsrc/static/actors/constants.txt b/wadsrc/static/actors/constants.txt index dec1493996..8baf2e65c7 100644 --- a/wadsrc/static/actors/constants.txt +++ b/wadsrc/static/actors/constants.txt @@ -327,6 +327,7 @@ Const Int WARPF_COPYINTERPOLATION = 0x40; Const Int WARPF_STOP = 0x80; Const Int WARPF_TOFLOOR = 0x100; Const Int WARPF_TESTONLY = 0x200; +Const Int WAPRF_ABSOLUTEPOSITION = 0x400; Const Int WARPF_ABSOLUTEPOSITION = 0x400; // flags for A_SetPitch/SetAngle From eab971500b43b6bac77af29aec1c299d68f2710e Mon Sep 17 00:00:00 2001 From: Edoardo Prezioso Date: Sat, 8 Nov 2014 00:31:16 +0100 Subject: [PATCH 14/15] Backport 'A_FaceConsolePlayer' from zandronum. By Dusk, who authorized me to do this. --- src/thingdef/thingdef_codeptr.cpp | 30 ++++++++++++++++++++++++++++++ wadsrc/static/actors/actor.txt | 1 + 2 files changed, 31 insertions(+) diff --git a/src/thingdef/thingdef_codeptr.cpp b/src/thingdef/thingdef_codeptr.cpp index 2732337c72..28affbb0f9 100644 --- a/src/thingdef/thingdef_codeptr.cpp +++ b/src/thingdef/thingdef_codeptr.cpp @@ -3781,6 +3781,36 @@ DEFINE_ACTION_FUNCTION(AActor, A_RaiseSiblings) } } +//=========================================================================== +// +// [TP] A_FaceConsolePlayer +// +//=========================================================================== +DEFINE_ACTION_FUNCTION_PARAMS (AActor, A_FaceConsolePlayer) { + ACTION_PARAM_START (1); + ACTION_PARAM_ANGLE (MaxTurnAngle, 0); + + angle_t Angle; + angle_t DeltaAngle; + AActor *pConsolePlayer; + + // Always watch the consoleplayer. + pConsolePlayer = players[consoleplayer].mo; + if (( playeringame[consoleplayer] == false ) || ( pConsolePlayer == NULL )) + return; + + // Find the angle between the actor and the console player. + Angle = R_PointToAngle2( self->x, self->y, pConsolePlayer->x, pConsolePlayer->y ); + DeltaAngle = Angle - self->angle; + + if (( MaxTurnAngle == 0 ) || ( DeltaAngle < MaxTurnAngle ) || ( DeltaAngle > (unsigned)-MaxTurnAngle )) + self->angle = Angle; + else if ( DeltaAngle < ANG180 ) + self->angle += MaxTurnAngle; + else + self->angle -= MaxTurnAngle; +} + //=========================================================================== // // A_MonsterRefire diff --git a/wadsrc/static/actors/actor.txt b/wadsrc/static/actors/actor.txt index e253f53ac9..468b0f7b5c 100644 --- a/wadsrc/static/actors/actor.txt +++ b/wadsrc/static/actors/actor.txt @@ -186,6 +186,7 @@ ACTOR Actor native //: Thinker action native A_ClearSoundTarget(); action native A_FireAssaultGun(); action native A_CheckTerrain(); + action native A_FaceConsolePlayer(float MaxTurnAngle = 0); // [TP] action native A_MissileAttack(); action native A_MeleeAttack(); From c28c0b8f0b54c05dff75abe440f94a4ee0be4657 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Sat, 8 Nov 2014 08:53:32 +0100 Subject: [PATCH 15/15] Revert "Backport 'A_FaceConsolePlayer' from zandronum." This reverts commit eab971500b43b6bac77af29aec1c299d68f2710e. As Edward850 pointed out, this feature is broken by design and therefore completely useless. --- src/thingdef/thingdef_codeptr.cpp | 30 ------------------------------ wadsrc/static/actors/actor.txt | 1 - 2 files changed, 31 deletions(-) diff --git a/src/thingdef/thingdef_codeptr.cpp b/src/thingdef/thingdef_codeptr.cpp index 28affbb0f9..2732337c72 100644 --- a/src/thingdef/thingdef_codeptr.cpp +++ b/src/thingdef/thingdef_codeptr.cpp @@ -3781,36 +3781,6 @@ DEFINE_ACTION_FUNCTION(AActor, A_RaiseSiblings) } } -//=========================================================================== -// -// [TP] A_FaceConsolePlayer -// -//=========================================================================== -DEFINE_ACTION_FUNCTION_PARAMS (AActor, A_FaceConsolePlayer) { - ACTION_PARAM_START (1); - ACTION_PARAM_ANGLE (MaxTurnAngle, 0); - - angle_t Angle; - angle_t DeltaAngle; - AActor *pConsolePlayer; - - // Always watch the consoleplayer. - pConsolePlayer = players[consoleplayer].mo; - if (( playeringame[consoleplayer] == false ) || ( pConsolePlayer == NULL )) - return; - - // Find the angle between the actor and the console player. - Angle = R_PointToAngle2( self->x, self->y, pConsolePlayer->x, pConsolePlayer->y ); - DeltaAngle = Angle - self->angle; - - if (( MaxTurnAngle == 0 ) || ( DeltaAngle < MaxTurnAngle ) || ( DeltaAngle > (unsigned)-MaxTurnAngle )) - self->angle = Angle; - else if ( DeltaAngle < ANG180 ) - self->angle += MaxTurnAngle; - else - self->angle -= MaxTurnAngle; -} - //=========================================================================== // // A_MonsterRefire diff --git a/wadsrc/static/actors/actor.txt b/wadsrc/static/actors/actor.txt index 468b0f7b5c..e253f53ac9 100644 --- a/wadsrc/static/actors/actor.txt +++ b/wadsrc/static/actors/actor.txt @@ -186,7 +186,6 @@ ACTOR Actor native //: Thinker action native A_ClearSoundTarget(); action native A_FireAssaultGun(); action native A_CheckTerrain(); - action native A_FaceConsolePlayer(float MaxTurnAngle = 0); // [TP] action native A_MissileAttack(); action native A_MeleeAttack();