- fixed broken jumping.

This was a nasty, but typical case for Duke where a variable did not contain what the name said and was carried along way too much code.

Fixes #112
This commit is contained in:
Christoph Oelckers 2020-08-07 21:59:11 +02:00
parent 4b69a181c3
commit f8c65839f0
2 changed files with 13 additions and 16 deletions

View file

@ -1617,12 +1617,11 @@ static void operateJetpack(int snum, ESyncBits sb_snum, int psectlotag, int fz,
// //
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
static void movement(int snum, ESyncBits sb_snum, int psect, int fz, int cz, int shrunk, int truefdist) static void movement(int snum, ESyncBits sb_snum, int psect, int fz, int cz, int shrunk, int truefdist, int psectlotag)
{ {
int j; int j;
auto p = &ps[snum]; auto p = &ps[snum];
int pi = p->i; int pi = p->i;
int psectlotag = sector[psect].lotag;
if (p->airleft != 15 * 26) if (p->airleft != 15 * 26)
p->airleft = 15 * 26; //Aprox twenty seconds. p->airleft = 15 * 26; //Aprox twenty seconds.
@ -1631,7 +1630,7 @@ static void movement(int snum, ESyncBits sb_snum, int psect, int fz, int cz, int
p->scuba_on = 0; p->scuba_on = 0;
int i = 40; int i = 40;
if (psectlotag == 1 && p->spritebridge == 0) if (psectlotag == ST_1_ABOVE_WATER && p->spritebridge == 0)
{ {
if (shrunk == 0) if (shrunk == 0)
{ {
@ -1713,7 +1712,7 @@ static void movement(int snum, ESyncBits sb_snum, int psect, int fz, int cz, int
p->falling_counter = 0; p->falling_counter = 0;
S_StopSound(-1, pi, CHAN_VOICE); S_StopSound(-1, pi, CHAN_VOICE);
if (psectlotag != 1 && psectlotag != 2 && p->on_ground == 0 && p->poszv > (6144 >> 1)) if (psectlotag != ST_1_ABOVE_WATER && psectlotag != ST_2_UNDERWATER && p->on_ground == 0 && p->poszv > (6144 >> 1))
p->hard_landing = p->poszv >> 10; p->hard_landing = p->poszv >> 10;
p->on_ground = 1; p->on_ground = 1;
@ -2761,7 +2760,7 @@ void processinput_d(int snum)
} }
else if (psectlotag != ST_2_UNDERWATER) else if (psectlotag != ST_2_UNDERWATER)
{ {
movement(snum, sb_snum, psect, fz, cz, shrunk, truefdist); movement(snum, sb_snum, psect, fz, cz, shrunk, truefdist, psectlotag);
} }
p->psectlotag = psectlotag; p->psectlotag = psectlotag;
@ -3079,7 +3078,7 @@ void processmove_d(int snum, ESyncBits sb_snum, int psect, int fz, int cz, int s
} }
else if (psectlotag != 2) else if (psectlotag != 2)
{ {
movement(snum, sb_snum, psect, fz, cz, shrunk, truefdist); movement(snum, sb_snum, psect, fz, cz, shrunk, truefdist, psectlotag);
} }
} }
END_DUKE_NS END_DUKE_NS

View file

@ -2086,12 +2086,11 @@ static void onBoat(int snum, ESyncBits& sb_snum)
// //
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
static void movement(int snum, ESyncBits sb_snum, int psect, int fz, int cz, int shrunk, int truefdist) static void movement(int snum, ESyncBits sb_snum, int psect, int fz, int cz, int shrunk, int truefdist, int psectlotag)
{ {
auto p = &ps[snum]; auto p = &ps[snum];
auto pi = p->i; auto pi = p->i;
auto s = &sprite[pi]; auto s = &sprite[pi];
int psectlotag = sector[psect].lotag;
if (p->airleft != 15 * 26) if (p->airleft != 15 * 26)
p->airleft = 15 * 26; //Aprox twenty seconds. p->airleft = 15 * 26; //Aprox twenty seconds.
@ -2100,7 +2099,7 @@ static void movement(int snum, ESyncBits sb_snum, int psect, int fz, int cz, int
p->scuba_on = 0; p->scuba_on = 0;
int i = 40; int i = 40;
if (psectlotag == 1 && p->spritebridge == 0) if (psectlotag == ST_1_ABOVE_WATER && p->spritebridge == 0)
{ {
if (shrunk == 0) if (shrunk == 0)
{ {
@ -2277,7 +2276,7 @@ static void movement(int snum, ESyncBits sb_snum, int psect, int fz, int cz, int
if (p->jumping_counter < 768) if (p->jumping_counter < 768)
{ {
if (psectlotag == 1 && p->jumping_counter > 768) if (psectlotag == ST_1_ABOVE_WATER && p->jumping_counter > 768)
{ {
p->jumping_counter = 0; p->jumping_counter = 0;
p->poszv = -512; p->poszv = -512;
@ -3675,9 +3674,9 @@ void processinput_r(int snum)
{ {
underwater(snum, sb_snum, psect, fz, cz); underwater(snum, sb_snum, psect, fz, cz);
} }
else if (psectlotag != ST_2_UNDERWATER) else
{ {
movement(snum, sb_snum, psect, fz, cz, shrunk, truefdist); movement(snum, sb_snum, psect, fz, cz, shrunk, truefdist, psectlotag);
} }
p->psectlotag = psectlotag; p->psectlotag = psectlotag;
@ -4107,14 +4106,13 @@ void processmove_r(int snum, ESyncBits sb_snum, int psect, int fz, int cz, int s
{ {
int psectlotag = sector[psect].lotag; int psectlotag = sector[psect].lotag;
auto p = &ps[snum]; auto p = &ps[snum];
if (psectlotag == 2) if (psectlotag == ST_2_UNDERWATER)
{ {
underwater(snum, sb_snum, psect, fz, cz); underwater(snum, sb_snum, psect, fz, cz);
} }
else
else if (psectlotag != 2)
{ {
movement(snum, sb_snum, psect, fz, cz, shrunk, truefdist); movement(snum, sb_snum, psect, fz, cz, shrunk, truefdist, psectlotag);
} }
} }