mirror of
https://github.com/ZDoom/gzdoom.git
synced 2024-11-22 20:21:26 +00:00
- Changed gravity doubling so that it only happens when you run off a ledge.
SVN r1543 (trunk)
This commit is contained in:
parent
6a9acc2cf8
commit
81c4773b46
2 changed files with 44 additions and 23 deletions
|
@ -1,4 +1,7 @@
|
||||||
April 10, 2009
|
April 13, 2009
|
||||||
|
- Changed gravity doubling so that it only happens when you run off a ledge.
|
||||||
|
|
||||||
|
April 10, 2009
|
||||||
- Fixed: World panning was ignored for the X offset of masked midtextures.
|
- Fixed: World panning was ignored for the X offset of masked midtextures.
|
||||||
|
|
||||||
April 10, 2009 (Changes by Graf Zahl)
|
April 10, 2009 (Changes by Graf Zahl)
|
||||||
|
|
|
@ -1330,11 +1330,13 @@ bool P_SeekerMissile (AActor *actor, angle_t thresh, angle_t turnMax)
|
||||||
//
|
//
|
||||||
// P_XYMovement
|
// P_XYMovement
|
||||||
//
|
//
|
||||||
|
// Returns the actor's old floorz.
|
||||||
|
//
|
||||||
#define STOPSPEED 0x1000
|
#define STOPSPEED 0x1000
|
||||||
#define FRICTION 0xe800
|
#define FRICTION 0xe800
|
||||||
#define CARRYSTOPSPEED (STOPSPEED*32/3)
|
#define CARRYSTOPSPEED (STOPSPEED*32/3)
|
||||||
|
|
||||||
void P_XYMovement (AActor *mo, fixed_t scrollx, fixed_t scrolly)
|
fixed_t P_XYMovement (AActor *mo, fixed_t scrollx, fixed_t scrolly)
|
||||||
{
|
{
|
||||||
bool bForceSlide = scrollx || scrolly;
|
bool bForceSlide = scrollx || scrolly;
|
||||||
angle_t angle;
|
angle_t angle;
|
||||||
|
@ -1345,6 +1347,7 @@ void P_XYMovement (AActor *mo, fixed_t scrollx, fixed_t scrolly)
|
||||||
static const int windTab[3] = {2048*5, 2048*10, 2048*25};
|
static const int windTab[3] = {2048*5, 2048*10, 2048*25};
|
||||||
int steps, step, totalsteps;
|
int steps, step, totalsteps;
|
||||||
fixed_t startx, starty;
|
fixed_t startx, starty;
|
||||||
|
fixed_t oldfloorz = mo->floorz;
|
||||||
|
|
||||||
fixed_t maxmove = (mo->waterlevel < 1) || (mo->flags & MF_MISSILE) ||
|
fixed_t maxmove = (mo->waterlevel < 1) || (mo->flags & MF_MISSILE) ||
|
||||||
(mo->player && mo->player->crouchoffset<-10*FRACUNIT) ? MAXMOVE : MAXMOVE/4;
|
(mo->player && mo->player->crouchoffset<-10*FRACUNIT) ? MAXMOVE : MAXMOVE/4;
|
||||||
|
@ -1430,7 +1433,7 @@ void P_XYMovement (AActor *mo, fixed_t scrollx, fixed_t scrolly)
|
||||||
mo->tics = -1;
|
mo->tics = -1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return;
|
return oldfloorz;
|
||||||
}
|
}
|
||||||
|
|
||||||
player = mo->player;
|
player = mo->player;
|
||||||
|
@ -1613,12 +1616,12 @@ void P_XYMovement (AActor *mo, fixed_t scrollx, fixed_t scrolly)
|
||||||
{
|
{
|
||||||
S_Sound (mo, CHAN_VOICE, mo->SeeSound, 1, ATTN_IDLE);
|
S_Sound (mo, CHAN_VOICE, mo->SeeSound, 1, ATTN_IDLE);
|
||||||
}
|
}
|
||||||
return;
|
return oldfloorz;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{ // Struck a player/creature
|
{ // Struck a player/creature
|
||||||
P_ExplodeMissile (mo, NULL, BlockingMobj);
|
P_ExplodeMissile (mo, NULL, BlockingMobj);
|
||||||
return;
|
return oldfloorz;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1631,7 +1634,7 @@ void P_XYMovement (AActor *mo, fixed_t scrollx, fixed_t scrolly)
|
||||||
{
|
{
|
||||||
S_Sound (mo, CHAN_VOICE, mo->SeeSound, 1, ATTN_IDLE);
|
S_Sound (mo, CHAN_VOICE, mo->SeeSound, 1, ATTN_IDLE);
|
||||||
}
|
}
|
||||||
return;
|
return oldfloorz;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (BlockingMobj &&
|
if (BlockingMobj &&
|
||||||
|
@ -1658,7 +1661,7 @@ void P_XYMovement (AActor *mo, fixed_t scrollx, fixed_t scrolly)
|
||||||
mo->tracer = mo->target;
|
mo->tracer = mo->target;
|
||||||
}
|
}
|
||||||
mo->target = BlockingMobj;
|
mo->target = BlockingMobj;
|
||||||
return;
|
return oldfloorz;
|
||||||
}
|
}
|
||||||
explode:
|
explode:
|
||||||
// explode a missile
|
// explode a missile
|
||||||
|
@ -1671,16 +1674,16 @@ explode:
|
||||||
// Hack to prevent missiles exploding against the sky.
|
// Hack to prevent missiles exploding against the sky.
|
||||||
// Does not handle sky floors.
|
// Does not handle sky floors.
|
||||||
mo->Destroy ();
|
mo->Destroy ();
|
||||||
return;
|
return oldfloorz;
|
||||||
}
|
}
|
||||||
// [RH] Don't explode on horizon lines.
|
// [RH] Don't explode on horizon lines.
|
||||||
if (mo->BlockingLine != NULL && mo->BlockingLine->special == Line_Horizon)
|
if (mo->BlockingLine != NULL && mo->BlockingLine->special == Line_Horizon)
|
||||||
{
|
{
|
||||||
mo->Destroy ();
|
mo->Destroy ();
|
||||||
return;
|
return oldfloorz;
|
||||||
}
|
}
|
||||||
P_ExplodeMissile (mo, mo->BlockingLine, BlockingMobj);
|
P_ExplodeMissile (mo, mo->BlockingLine, BlockingMobj);
|
||||||
return;
|
return oldfloorz;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -1715,12 +1718,12 @@ explode:
|
||||||
{ // debug option for no sliding at all
|
{ // debug option for no sliding at all
|
||||||
mo->momx = mo->momy = 0;
|
mo->momx = mo->momy = 0;
|
||||||
player->momx = player->momy = 0;
|
player->momx = player->momy = 0;
|
||||||
return;
|
return oldfloorz;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mo->flags & (MF_MISSILE | MF_SKULLFLY))
|
if (mo->flags & (MF_MISSILE | MF_SKULLFLY))
|
||||||
{ // no friction for missiles
|
{ // no friction for missiles
|
||||||
return;
|
return oldfloorz;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mo->z > mo->floorz && !(mo->flags2 & MF2_ONMOBJ) &&
|
if (mo->z > mo->floorz && !(mo->flags2 & MF2_ONMOBJ) &&
|
||||||
|
@ -1737,7 +1740,7 @@ explode:
|
||||||
player->momy = FixedMul (player->momy, level.airfriction);
|
player->momy = FixedMul (player->momy, level.airfriction);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return;
|
return oldfloorz;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mo->flags & MF_CORPSE)
|
if (mo->flags & MF_CORPSE)
|
||||||
|
@ -1761,7 +1764,7 @@ explode:
|
||||||
}
|
}
|
||||||
if (i==mo->Sector->e->XFloor.ffloors.Size())
|
if (i==mo->Sector->e->XFloor.ffloors.Size())
|
||||||
#endif
|
#endif
|
||||||
return;
|
return oldfloorz;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1820,6 +1823,7 @@ explode:
|
||||||
player->momy = FixedMul (player->momy, ORIG_FRICTION);
|
player->momy = FixedMul (player->momy, ORIG_FRICTION);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
return oldfloorz;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Move this to p_inter ***
|
// Move this to p_inter ***
|
||||||
|
@ -1849,7 +1853,7 @@ void P_MonsterFallingDamage (AActor *mo)
|
||||||
//
|
//
|
||||||
// P_ZMovement
|
// P_ZMovement
|
||||||
//
|
//
|
||||||
void P_ZMovement (AActor *mo)
|
void P_ZMovement (AActor *mo, fixed_t oldfloorz)
|
||||||
{
|
{
|
||||||
fixed_t dist;
|
fixed_t dist;
|
||||||
fixed_t delta;
|
fixed_t delta;
|
||||||
|
@ -1864,7 +1868,10 @@ void P_ZMovement (AActor *mo)
|
||||||
mo->player->deltaviewheight = mo->player->GetDeltaViewHeight();
|
mo->player->deltaviewheight = mo->player->GetDeltaViewHeight();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!(mo->flags2&MF2_FLOATBOB)) mo->z += mo->momz;
|
if (!(mo->flags2 & MF2_FLOATBOB))
|
||||||
|
{
|
||||||
|
mo->z += mo->momz;
|
||||||
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// apply gravity
|
// apply gravity
|
||||||
|
@ -1879,8 +1886,16 @@ void P_ZMovement (AActor *mo)
|
||||||
fixed_t grav = (fixed_t)(level.gravity * mo->Sector->gravity *
|
fixed_t grav = (fixed_t)(level.gravity * mo->Sector->gravity *
|
||||||
FIXED2FLOAT(mo->gravity) * 81.92);
|
FIXED2FLOAT(mo->gravity) * 81.92);
|
||||||
|
|
||||||
if (mo->momz == 0) mo->momz -= grav + grav;
|
// [RH] Double gravity only if running off a ledge. Coming down from
|
||||||
else mo->momz -= grav;
|
// an upward thrust (e.g. a jump) should not double it.
|
||||||
|
if (mo->momz == 0 && oldfloorz > mo->floorz && mo->z == oldfloorz)
|
||||||
|
{
|
||||||
|
mo->momz -= grav + grav;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
mo->momz -= grav;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (mo->waterlevel > 1)
|
if (mo->waterlevel > 1)
|
||||||
{
|
{
|
||||||
|
@ -1898,7 +1913,10 @@ void P_ZMovement (AActor *mo)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mo->flags2&MF2_FLOATBOB) mo->z += mo->momz;
|
if (mo->flags2 & MF2_FLOATBOB)
|
||||||
|
{
|
||||||
|
mo->z += mo->momz;
|
||||||
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// adjust height
|
// adjust height
|
||||||
|
@ -2930,7 +2948,7 @@ void AActor::Tick ()
|
||||||
|
|
||||||
// Handle X and Y momemtums
|
// Handle X and Y momemtums
|
||||||
BlockingMobj = NULL;
|
BlockingMobj = NULL;
|
||||||
P_XYMovement (this, cummx, cummy);
|
fixed_t oldfloorz = P_XYMovement (this, cummx, cummy);
|
||||||
if (ObjectFlags & OF_EuthanizeMe)
|
if (ObjectFlags & OF_EuthanizeMe)
|
||||||
{ // actor was destroyed
|
{ // actor was destroyed
|
||||||
return;
|
return;
|
||||||
|
@ -2953,7 +2971,7 @@ void AActor::Tick ()
|
||||||
{
|
{
|
||||||
if (!(onmo = P_CheckOnmobj (this)))
|
if (!(onmo = P_CheckOnmobj (this)))
|
||||||
{
|
{
|
||||||
P_ZMovement (this);
|
P_ZMovement (this, oldfloorz);
|
||||||
flags2 &= ~MF2_ONMOBJ;
|
flags2 &= ~MF2_ONMOBJ;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -2986,7 +3004,7 @@ void AActor::Tick ()
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
P_ZMovement (this);
|
P_ZMovement (this, oldfloorz);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ObjectFlags & OF_EuthanizeMe)
|
if (ObjectFlags & OF_EuthanizeMe)
|
||||||
|
|
Loading…
Reference in a new issue