Merge branch 'master' of https://github.com/rheit/zdoom into z_osx_clean

This commit is contained in:
alexey.lysiuk 2014-11-08 10:42:44 +02:00
commit f0f0f2a24d
5 changed files with 46 additions and 20 deletions

View file

@ -609,9 +609,12 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_BFGSpray)
damage = defdamage; 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; thingToHit = linetarget;
int newdam = P_DamageMobj (thingToHit, self->target, self->target, damage, spray != NULL? FName(spray->DamageType) : FName(NAME_BFGSplash), 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); P_TraceBleed (newdam > 0 ? newdam : damage, thingToHit, self->target);
} }
} }

View file

@ -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, // telefrag him right? ;) (Unfortunately the damage is "absorbed" by armor,
// but telefragging should still do enough damage to kill the player) // but telefragging should still do enough damage to kill the player)
// Ignore players that are already dead. // 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. // If this is a voodoo doll we need to handle the real player as well.
player->mo->health = target->health = player->health = 1; 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; target->health -= damage;
if (target->health <= 0) if (target->health <= 0)
{ // Death { // 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... { // [SP] Save the player...
player->health = target->health = 1; player->health = target->health = 1;
} }

View file

@ -4111,7 +4111,7 @@ void P_RailAttack(AActor *source, int damage, int offset_xy, fixed_t offset_z, i
z = shootz + FixedMul(hitdist, vz); z = shootz + FixedMul(hitdist, vz);
if ((hitactor->flags & MF_NOBLOOD) || 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); 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); 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) if (bleed)
{ {
P_SpawnBlood(x, y, z, (source->angle + angleoffset) - ANG180, newdam > 0 ? newdam : damage, hitactor); P_SpawnBlood(x, y, z, (source->angle + angleoffset) - ANG180, newdam > 0 ? newdam : damage, hitactor);

View file

@ -78,7 +78,9 @@ CUSTOM_CVAR(Float, cl_predict_lerpthreshold, 2.00f, CVAR_ARCHIVE | CVAR_GLOBALCO
struct PredictPos struct PredictPos
{ {
int gametic; int gametic;
FVector3 point; fixed_t x;
fixed_t y;
fixed_t z;
fixed_t pitch; fixed_t pitch;
fixed_t yaw; fixed_t yaw;
} static PredictionLerpFrom, PredictionLerpResult, PredictionLast; } static PredictionLerpFrom, PredictionLerpResult, PredictionLast;
@ -2606,12 +2608,19 @@ void P_PredictionLerpReset()
PredictionLerptics = PredictionLast.gametic = PredictionLerpFrom.gametic = PredictionLerpResult.gametic = 0; 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; FVector3 vecFrom(FIXED2DBL(from.x), FIXED2DBL(from.y), FIXED2DBL(from.z));
result *= scale; FVector3 vecTo(FIXED2DBL(to.x), FIXED2DBL(to.y), FIXED2DBL(to.z));
result = result + from; FVector3 vecResult;
FVector3 delta = result - to; 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. // As a fail safe, assume extrapolation is the threshold.
return (delta.LengthSquared() > cl_predict_lerpthreshold && scale <= 1.00f); return (delta.LengthSquared() > cl_predict_lerpthreshold && scale <= 1.00f);
@ -2716,8 +2725,18 @@ void P_PredictPlayer (player_t *player)
if (CanLerp && PredictionLast.gametic > 0 && i == PredictionLast.gametic && !NoInterpolateOld) if (CanLerp && PredictionLast.gametic > 0 && i == PredictionLast.gametic && !NoInterpolateOld)
{ {
// Z is not compared as lifts will alter this with no apparent change // Z is not compared as lifts will alter this with no apparent change
DoLerp = (PredictionLast.point.X != FIXED2FLOAT(player->mo->x) || // Make lerping less picky by only testing whole units
PredictionLast.point.Y != FIXED2FLOAT(player->mo->y)); 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));
}
} }
} }
@ -2734,19 +2753,19 @@ void P_PredictPlayer (player_t *player)
} }
PredictionLast.gametic = maxtic - 1; PredictionLast.gametic = maxtic - 1;
PredictionLast.point.X = FIXED2FLOAT(player->mo->x); PredictionLast.x = player->mo->x;
PredictionLast.point.Y = FIXED2FLOAT(player->mo->y); PredictionLast.y = player->mo->y;
PredictionLast.point.Z = FIXED2FLOAT(player->mo->z); PredictionLast.z = player->mo->z;
if (PredictionLerptics > 0) if (PredictionLerptics > 0)
{ {
if (PredictionLerpFrom.gametic > 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++; PredictionLerptics++;
player->mo->x = FLOAT2FIXED(PredictionLerpResult.point.X); player->mo->x = PredictionLerpResult.x;
player->mo->y = FLOAT2FIXED(PredictionLerpResult.point.Y); player->mo->y = PredictionLerpResult.y;
player->mo->z = FLOAT2FIXED(PredictionLerpResult.point.Z); player->mo->z = PredictionLerpResult.z;
} }
else else
{ {

View file

@ -328,6 +328,7 @@ Const Int WARPF_STOP = 0x80;
Const Int WARPF_TOFLOOR = 0x100; Const Int WARPF_TOFLOOR = 0x100;
Const Int WARPF_TESTONLY = 0x200; Const Int WARPF_TESTONLY = 0x200;
Const Int WAPRF_ABSOLUTEPOSITION = 0x400; Const Int WAPRF_ABSOLUTEPOSITION = 0x400;
Const Int WARPF_ABSOLUTEPOSITION = 0x400;
// flags for A_SetPitch/SetAngle // flags for A_SetPitch/SetAngle
const int SPF_FORCECLAMP = 1; const int SPF_FORCECLAMP = 1;