2020-07-06 09:39:39 +00:00
|
|
|
//-------------------------------------------------------------------------
|
|
|
|
/*
|
|
|
|
Copyright (C) 1996, 2003 - 3D Realms Entertainment
|
|
|
|
Copyright (C) 2020 - Christoph Oelckers
|
|
|
|
|
|
|
|
This file is part of Duke Nukem 3D version 1.5 - Atomic Edition
|
|
|
|
|
|
|
|
Duke Nukem 3D is free software; you can redistribute it and/or
|
|
|
|
modify it under the terms of the GNU General Public License
|
|
|
|
as published by the Free Software Foundation; either version 2
|
|
|
|
of the License, or (at your option) any later version.
|
|
|
|
|
|
|
|
This program is distributed in the hope that it will be useful,
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
|
|
|
|
|
|
|
See the GNU General Public License for more details.
|
|
|
|
|
|
|
|
You should have received a copy of the GNU General Public License
|
|
|
|
aint with this program; if not, write to the Free Software
|
|
|
|
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|
|
|
|
|
|
|
Original Source: 1996 - Todd Replogle
|
|
|
|
Prepared for public release: 03/21/2003 - Charlie Wiederhold, 3D Realms
|
|
|
|
Modifications for JonoF's port by Jonathon Fowler (jf@jonof.id.au)
|
|
|
|
*/
|
|
|
|
//-------------------------------------------------------------------------
|
|
|
|
|
|
|
|
#include "ns.h" // Must come before everything else!
|
|
|
|
|
|
|
|
#include "duke3d.h"
|
|
|
|
#include "m_argv.h"
|
|
|
|
#include "mapinfo.h"
|
|
|
|
#include "texturemanager.h"
|
|
|
|
|
|
|
|
BEGIN_DUKE_NS
|
|
|
|
|
|
|
|
|
2022-09-08 10:47:21 +00:00
|
|
|
DVector3 omypos, mypos;
|
|
|
|
int myxvel, myyvel, myzvel;
|
2021-11-07 13:55:28 +00:00
|
|
|
int globalskillsound;
|
2022-08-27 08:24:16 +00:00
|
|
|
DAngle myang, omyang;
|
2022-09-28 03:39:01 +00:00
|
|
|
DAngle myhoriz, omyhoriz, myhorizoff, omyhorizoff;
|
2021-11-07 13:55:28 +00:00
|
|
|
int mycursectnum, myjumpingcounter;
|
2021-11-07 11:53:48 +00:00
|
|
|
uint8_t myjumpingtoggle, myonground, myhardlanding,myreturntocenter;
|
2020-07-06 09:39:39 +00:00
|
|
|
int fakemovefifoplc;
|
|
|
|
int myxbak[MOVEFIFOSIZ], myybak[MOVEFIFOSIZ], myzbak[MOVEFIFOSIZ];
|
|
|
|
int myhorizbak[MOVEFIFOSIZ];
|
|
|
|
short myangbak[MOVEFIFOSIZ];
|
|
|
|
|
|
|
|
|
|
|
|
void resetmys()
|
|
|
|
{
|
2022-09-08 10:47:21 +00:00
|
|
|
mypos = omypos = ps[myconnectindex].pos;
|
2020-07-23 15:01:37 +00:00
|
|
|
myxvel = myyvel = myzvel = 0;
|
2022-08-27 13:09:22 +00:00
|
|
|
myang = ps[myconnectindex].angle.ang;
|
2022-10-11 02:37:20 +00:00
|
|
|
myhoriz = omyhoriz = ps[myconnectindex].horizon.horiz;
|
2020-10-07 07:34:52 +00:00
|
|
|
myhorizoff = omyhorizoff = ps[myconnectindex].horizon.horizoff;
|
2021-11-21 07:56:39 +00:00
|
|
|
mycursectnum = sectnum(ps[myconnectindex].cursector);
|
2020-07-23 15:01:37 +00:00
|
|
|
myjumpingcounter = ps[myconnectindex].jumping_counter;
|
|
|
|
myjumpingtoggle = ps[myconnectindex].jumping_toggle;
|
|
|
|
myonground = ps[myconnectindex].on_ground;
|
|
|
|
myhardlanding = ps[myconnectindex].hard_landing;
|
|
|
|
}
|
2020-07-06 09:39:39 +00:00
|
|
|
|
|
|
|
#if 0 // todo: fix this when networking works again
|
|
|
|
void fakedomovethingscorrect(void)
|
|
|
|
{
|
2022-09-08 10:47:21 +00:00
|
|
|
int i;
|
|
|
|
player_struct* p;
|
|
|
|
|
|
|
|
if (numplayers < 2) return;
|
|
|
|
|
|
|
|
i = ((movefifoplc-1)&(MOVEFIFOSIZ-1));
|
|
|
|
p = &ps[myconnectindex];
|
|
|
|
|
|
|
|
if (p->pos.x == myxbak[i] && p->pos.y == myybak[i] && p->pos.z == myzbak[i]
|
|
|
|
&& p->horiz == myhorizbak[i] && p->ang == myangbak[i]) return;
|
|
|
|
|
|
|
|
omypos = p->opos;
|
|
|
|
mypos = p->pos;
|
|
|
|
myxvel = p->vel.X;
|
|
|
|
myyvel = p->vel.Y;
|
|
|
|
myzvel = p->vel.Z;
|
|
|
|
myang = p->ang; omyang = p->oang;
|
|
|
|
mycursectnum = p->cursector;
|
|
|
|
myhoriz = p->horiz; omyhoriz = p->ohoriz;
|
|
|
|
myhorizoff = p->horizoff; omyhorizoff = p->ohorizoff;
|
|
|
|
myjumpingcounter = p->jumping_counter;
|
|
|
|
myjumpingtoggle = p->jumping_toggle;
|
|
|
|
myonground = p->on_ground;
|
|
|
|
myhardlanding = p->hard_landing;
|
|
|
|
|
|
|
|
fakemovefifoplc = movefifoplc;
|
|
|
|
while (fakemovefifoplc < movefifoend[myconnectindex])
|
|
|
|
fakedomovethings();
|
2020-07-06 09:39:39 +00:00
|
|
|
|
|
|
|
}
|
|
|
|
|
2020-08-29 11:32:14 +00:00
|
|
|
// This still needs fixing for the magic numbers in the input bits
|
2020-07-06 09:39:39 +00:00
|
|
|
void fakedomovethings(void)
|
|
|
|
{
|
2020-07-20 21:21:27 +00:00
|
|
|
input *syn;
|
2022-02-07 10:04:19 +00:00
|
|
|
player_struct* p;
|
2020-10-28 05:12:16 +00:00
|
|
|
int i, j, k, doubvel, fz, cz, x, y;
|
|
|
|
Collision clz, chz;
|
2021-11-07 13:55:28 +00:00
|
|
|
int psect, psectlotag, tempsect, backcstat;
|
2020-07-20 21:21:27 +00:00
|
|
|
uint8_t shrunk, spritebridge;
|
2020-08-29 11:32:14 +00:00
|
|
|
ESyncBits actions;
|
2020-07-20 21:21:27 +00:00
|
|
|
|
|
|
|
syn = (input *)&inputfifo[fakemovefifoplc&(MOVEFIFOSIZ-1)][myconnectindex];
|
|
|
|
|
|
|
|
p = &ps[myconnectindex];
|
|
|
|
|
2020-10-23 19:40:49 +00:00
|
|
|
backcstat = p->GetActor()->s.cstat;
|
2021-12-18 15:09:58 +00:00
|
|
|
p->GetActor()->s.cstat &= ~CSTAT_SPRITE_BLOCK_ALL;
|
2020-07-20 21:21:27 +00:00
|
|
|
|
2020-08-29 11:32:14 +00:00
|
|
|
actions = syn->actions;
|
2020-07-20 21:21:27 +00:00
|
|
|
|
|
|
|
psect = mycursectnum;
|
2021-11-18 18:33:32 +00:00
|
|
|
psectlotag = psect->lotag;
|
2020-07-20 21:21:27 +00:00
|
|
|
spritebridge = 0;
|
|
|
|
|
2022-10-06 15:30:01 +00:00
|
|
|
shrunk = (p->GetActor()->s.y_repeat < (isRR()? 8 : 32));
|
2020-07-20 21:21:27 +00:00
|
|
|
|
2021-11-18 18:33:32 +00:00
|
|
|
if( ud.clipping == 0 && ( psect->floorpicnum == MIRROR || psect == nullptr) )
|
2020-07-20 21:21:27 +00:00
|
|
|
{
|
2022-09-08 10:47:21 +00:00
|
|
|
mypos.XY() = omypos.XY();
|
2020-07-20 21:21:27 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2022-09-08 10:47:21 +00:00
|
|
|
omypos.XY() = mypos.XY();
|
2020-07-20 21:21:27 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
omyhoriz = myhoriz;
|
|
|
|
omyhorizoff = myhorizoff;
|
|
|
|
omyz = myz;
|
|
|
|
omyang = myang;
|
|
|
|
|
2020-10-28 05:12:16 +00:00
|
|
|
getzrange(myx,myy,myz,psect,&cz,chz,&fz,clz,163L,CLIPMASK0);
|
2020-07-20 21:21:27 +00:00
|
|
|
|
|
|
|
j = getflorzofslope(psect,myx,myy);
|
|
|
|
|
2021-01-04 12:02:00 +00:00
|
|
|
if(clz.type == kHitSector && psectlotag == 1 && abs(myz-j) > gs.playerheight+(16<<8) )
|
2020-07-20 21:21:27 +00:00
|
|
|
psectlotag = 0;
|
|
|
|
|
2021-11-18 18:33:32 +00:00
|
|
|
if( p->aim_mode == 0 && myonground && psectlotag != 2 && (psect->floorstat&2) )
|
2020-07-20 21:21:27 +00:00
|
|
|
{
|
2022-09-15 17:23:47 +00:00
|
|
|
x = myx + b cos(myang, -5);
|
|
|
|
y = myy + b sin(myang, -5);
|
2020-07-20 21:21:27 +00:00
|
|
|
tempsect = psect;
|
|
|
|
updatesector(x,y,&tempsect);
|
|
|
|
if (tempsect >= 0)
|
|
|
|
{
|
|
|
|
k = getflorzofslope(psect,x,y);
|
|
|
|
if (psect == tempsect)
|
2021-01-04 11:36:54 +00:00
|
|
|
myhorizoff += MulScale(j-k,160, 16);
|
2021-01-04 12:02:00 +00:00
|
|
|
else if (abs(getflorzofslope(tempsect,x,y)-k) <= (4<<8))
|
2021-01-04 11:36:54 +00:00
|
|
|
myhorizoff += MulScale(j-k,160, 16);
|
2020-07-20 21:21:27 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
if (myhorizoff > 0) myhorizoff -= ((myhorizoff>>3)+1);
|
|
|
|
else if (myhorizoff < 0) myhorizoff += (((-myhorizoff)>>3)+1);
|
|
|
|
|
2020-10-28 05:12:16 +00:00
|
|
|
if(chz.type == kHitSprite)
|
2020-07-20 21:21:27 +00:00
|
|
|
{
|
2021-11-26 12:41:15 +00:00
|
|
|
if (chz.actor()->s.statnum == 1 && chz.actor()->s.extra >= 0)
|
2020-07-20 21:21:27 +00:00
|
|
|
{
|
2020-10-28 05:12:16 +00:00
|
|
|
chz.type = kHitNone;
|
2020-07-20 21:21:27 +00:00
|
|
|
cz = getceilzofslope(psect,myx,myy);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-10-28 05:12:16 +00:00
|
|
|
if (clz.type == kHitSprite)
|
2020-07-20 21:21:27 +00:00
|
|
|
{
|
2021-11-26 12:41:15 +00:00
|
|
|
if ((clz.actor()->s.cstat&33) == 33)
|
2020-07-20 21:21:27 +00:00
|
|
|
{
|
|
|
|
psectlotag = 0;
|
|
|
|
spritebridge = 1;
|
|
|
|
}
|
2022-10-06 15:30:01 +00:00
|
|
|
if(badguy(chz.actor) && chz.actor()->s.ScaleX() > 0.375 && abs(p->GetActor()->s.z- chz.actor()->s.z) < (84<<8) )
|
2020-07-20 21:21:27 +00:00
|
|
|
{
|
2022-09-15 16:52:39 +00:00
|
|
|
j = g etangle(chz.actor()->s.x-myx, chz.actor()->s.y-myy);
|
2022-09-15 17:23:47 +00:00
|
|
|
myxvel -= b cos(j, 4);
|
|
|
|
myyvel -= b sin(j, 4);
|
2020-07-20 21:21:27 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-10-23 19:40:49 +00:00
|
|
|
if( p->GetActor()->s.extra <= 0 )
|
2020-07-20 21:21:27 +00:00
|
|
|
{
|
|
|
|
if( psectlotag == 2 )
|
|
|
|
{
|
|
|
|
if(p->on_warping_sector == 0)
|
|
|
|
{
|
2021-01-04 12:02:00 +00:00
|
|
|
if( abs(myz-fz) > (gs.playerheight>>1))
|
2020-07-20 21:21:27 +00:00
|
|
|
myz += 348;
|
|
|
|
}
|
|
|
|
clipmove(&myx,&myy,&myz,&mycursectnum,0,0,164L,(4L<<8),(4L<<8),CLIPMASK0);
|
|
|
|
}
|
|
|
|
|
|
|
|
updatesector(myx,myy,&mycursectnum);
|
|
|
|
pushmove(&myx,&myy,&myz,&mycursectnum,128L,(4L<<8),(20L<<8),CLIPMASK0);
|
|
|
|
|
|
|
|
myhoriz = 100;
|
|
|
|
myhorizoff = 0;
|
|
|
|
|
|
|
|
goto ENDFAKEPROCESSINPUT;
|
|
|
|
}
|
|
|
|
|
|
|
|
doubvel = TICSPERFRAME;
|
|
|
|
|
2020-10-17 08:44:00 +00:00
|
|
|
if(p->on_crane != nullptr) goto FAKEHORIZONLY;
|
2020-07-20 21:21:27 +00:00
|
|
|
|
2020-10-07 12:13:21 +00:00
|
|
|
if(p->angle.spin.asbam() < 0) myang += 128;
|
2020-07-20 21:21:27 +00:00
|
|
|
|
|
|
|
i = 40;
|
|
|
|
|
|
|
|
if( psectlotag == 2)
|
|
|
|
{
|
|
|
|
myjumpingcounter = 0;
|
|
|
|
|
|
|
|
if ( (sb_snum&1) && !(p->OnMotorcycle || p->OnBoat) )
|
|
|
|
{
|
|
|
|
if(myzvel > 0) myzvel = 0;
|
|
|
|
myzvel -= 348;
|
|
|
|
if(myzvel < -(256*6)) myzvel = -(256*6);
|
|
|
|
}
|
|
|
|
else if ( (sb_snum&(1<<1)) && !(p->OnMotorcycle || p->OnBoat) )
|
|
|
|
{
|
|
|
|
if(myzvel < 0) myzvel = 0;
|
|
|
|
myzvel += 348;
|
|
|
|
if(myzvel > (256*6)) myzvel = (256*6);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if(myzvel < 0)
|
|
|
|
{
|
|
|
|
myzvel += 256;
|
|
|
|
if(myzvel > 0)
|
|
|
|
myzvel = 0;
|
|
|
|
}
|
|
|
|
if(myzvel > 0)
|
|
|
|
{
|
|
|
|
myzvel -= 256;
|
|
|
|
if(myzvel < 0)
|
|
|
|
myzvel = 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if(myzvel > 2048) myzvel >>= 1;
|
|
|
|
|
|
|
|
myz += myzvel;
|
|
|
|
|
|
|
|
if(myz > (fz-(15<<8)) )
|
|
|
|
myz += ((fz-(15<<8))-myz)>>1;
|
|
|
|
|
|
|
|
if(myz < (cz+(4<<8)) )
|
|
|
|
{
|
|
|
|
myz = cz+(4<<8);
|
|
|
|
myzvel = 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
else if(p->jetpack_on)
|
|
|
|
{
|
|
|
|
myonground = 0;
|
|
|
|
myjumpingcounter = 0;
|
|
|
|
myhardlanding = 0;
|
|
|
|
|
|
|
|
if(p->jetpack_on < 11)
|
|
|
|
myz -= (p->jetpack_on<<7); //Goin up
|
|
|
|
|
|
|
|
if(shrunk) j = 512;
|
|
|
|
else j = 2048;
|
2021-12-30 09:30:21 +00:00
|
|
|
|
2020-07-20 21:21:27 +00:00
|
|
|
if ((sb_snum&1) && !(p->OnMotorcycle || p->OnBoat))
|
|
|
|
myz -= j;
|
|
|
|
if ((sb_snum&(1<<1)) && !(p->OnMotorcycle || p->OnBoat))
|
|
|
|
myz += j;
|
|
|
|
|
|
|
|
if(shrunk == 0 && ( psectlotag == 0 || psectlotag == 2 ) ) k = 32;
|
|
|
|
else k = 16;
|
|
|
|
|
|
|
|
if(myz > (fz-(k<<8)) )
|
|
|
|
myz += ((fz-(k<<8))-myz)>>1;
|
|
|
|
if(myz < (cz+(18<<8)) )
|
|
|
|
myz = cz+(18<<8);
|
|
|
|
}
|
|
|
|
else if( psectlotag != 2 )
|
|
|
|
{
|
|
|
|
if (psectlotag == 1 && p->spritebridge == 0)
|
|
|
|
{
|
|
|
|
if(shrunk == 0) i = 34;
|
|
|
|
else i = 12;
|
|
|
|
}
|
|
|
|
if(myz < (fz-(i<<8)) && (floorspace(psect)|ceilingspace(psect)) == 0 ) //falling
|
|
|
|
{
|
2021-11-18 18:33:32 +00:00
|
|
|
if( (sb_snum&3) == 0 && !(p->OnMotorcycle || p->OnBoat) && myonground && (psect->floorstat&2) && myz >= (fz-(i<<8)-(16<<8) ) )
|
2020-07-20 21:21:27 +00:00
|
|
|
myz = fz-(i<<8);
|
|
|
|
else
|
|
|
|
{
|
|
|
|
myonground = 0;
|
|
|
|
|
2020-11-29 12:54:58 +00:00
|
|
|
myzvel += (gs.gravity+80);
|
2020-07-20 21:21:27 +00:00
|
|
|
|
|
|
|
if(myzvel >= (4096+2048)) myzvel = (4096+2048);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if(psectlotag != 1 && psectlotag != 2 && myonground == 0 && myzvel > (6144>>1))
|
|
|
|
myhardlanding = myzvel>>10;
|
|
|
|
myonground = 1;
|
|
|
|
|
|
|
|
if(i==40)
|
|
|
|
{
|
|
|
|
//Smooth on the ground
|
|
|
|
|
|
|
|
k = ((fz-(i<<8))-myz)>>1;
|
2021-01-04 12:02:00 +00:00
|
|
|
if( abs(k) < 256 ) k = 0;
|
2020-07-20 21:21:27 +00:00
|
|
|
myz += k; // ((fz-(i<<8))-myz)>>1;
|
|
|
|
myzvel -= 768; // 412;
|
|
|
|
if(myzvel < 0) myzvel = 0;
|
|
|
|
}
|
|
|
|
else if(myjumpingcounter == 0)
|
|
|
|
{
|
|
|
|
myz += ((fz-(i<<7))-myz)>>1; //Smooth on the water
|
|
|
|
if(p->on_warping_sector == 0 && myz > fz-(16<<8))
|
|
|
|
{
|
|
|
|
myz = fz-(16<<8);
|
|
|
|
myzvel >>= 1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if( (sb_snum&2) && !(p->OnMotorcycle || p->OnBoat) )
|
|
|
|
myz += (2048+768);
|
|
|
|
|
|
|
|
if( (sb_snum&1) == 0 && !(p->OnMotorcycle || p->OnBoat) && myjumpingtoggle == 1)
|
|
|
|
myjumpingtoggle = 0;
|
|
|
|
|
|
|
|
else if( (sb_snum&1) && !(p->OnMotorcycle || p->OnBoat) && myjumpingtoggle == 0 )
|
|
|
|
{
|
|
|
|
if( myjumpingcounter == 0 )
|
|
|
|
if( (fz-cz) > (56<<8) )
|
|
|
|
{
|
|
|
|
myjumpingcounter = 1;
|
|
|
|
myjumpingtoggle = 1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if(!isRR() && myjumpingcounter && (sb_snum&1) == 0 )
|
|
|
|
myjumpingcounter = 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
if(myjumpingcounter)
|
|
|
|
{
|
|
|
|
if( (sb_snum&1) == 0 && !(p->OnMotorcycle || p->OnBoat) && myjumpingtoggle == 1)
|
|
|
|
myjumpingtoggle = 0;
|
|
|
|
|
|
|
|
if( myjumpingcounter < (1024+256) )
|
|
|
|
{
|
|
|
|
if(psectlotag == 1 && myjumpingcounter > 768)
|
|
|
|
{
|
|
|
|
myjumpingcounter = 0;
|
|
|
|
myzvel = -512;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2022-09-15 17:23:47 +00:00
|
|
|
myzvel -= b sin(128 + myjumpingcounter) / 12;
|
2020-07-20 21:21:27 +00:00
|
|
|
myjumpingcounter += 180;
|
|
|
|
|
|
|
|
myonground = 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
myjumpingcounter = 0;
|
|
|
|
myzvel = 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
myz += myzvel;
|
|
|
|
|
|
|
|
if(myz < (cz+(4<<8)) )
|
|
|
|
{
|
|
|
|
myjumpingcounter = 0;
|
|
|
|
if(myzvel < 0) myxvel = myyvel = 0;
|
|
|
|
myzvel = 128;
|
|
|
|
myz = cz+(4<<8);
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if (movementBlocked(snum) || myhardlanding)
|
|
|
|
{
|
|
|
|
doubvel = 0;
|
|
|
|
myxvel = 0;
|
|
|
|
myyvel = 0;
|
|
|
|
}
|
2021-11-09 23:05:42 +00:00
|
|
|
else if ( syn->avel )//p->ang += syncangvel * constant
|
|
|
|
{ //ENGINE calculates angvel for you
|
2020-07-20 21:21:27 +00:00
|
|
|
int tempang;
|
|
|
|
|
|
|
|
tempang = syn->avel<<1;
|
|
|
|
|
|
|
|
if(psectlotag == 2)
|
2021-01-04 12:35:33 +00:00
|
|
|
myang += (tempang-(tempang>>3))*Sgn(doubvel);
|
|
|
|
else myang += (tempang)*Sgn(doubvel);
|
2020-07-20 21:21:27 +00:00
|
|
|
myang &= 2047;
|
|
|
|
}
|
|
|
|
|
|
|
|
if ( myxvel || myyvel || syn->fvel || syn->svel )
|
|
|
|
{
|
|
|
|
if(p->steroids_amount > 0 && p->steroids_amount < 400)
|
|
|
|
doubvel <<= 1;
|
|
|
|
|
|
|
|
myxvel += ((syn->fvel*doubvel)<<6);
|
|
|
|
myyvel += ((syn->svel*doubvel)<<6);
|
|
|
|
|
|
|
|
if( ( p->curr_weapon == KNEE_WEAPON && p->kickback_pic > 10 && myonground ) || ( myonground && (sb_snum&2) && !(p->OnMotorcycle || p->OnBoat)) )
|
|
|
|
{
|
2021-01-04 11:36:54 +00:00
|
|
|
myxvel = MulScale(myxvel,gs.playerfriction-0x2000, 16);
|
|
|
|
myyvel = MulScale(myyvel,gs.playerfriction-0x2000, 16);
|
2020-07-20 21:21:27 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if(psectlotag == 2)
|
|
|
|
{
|
2021-01-04 11:36:54 +00:00
|
|
|
myxvel = MulScale(myxvel,gs.playerfriction-0x1400, 16);
|
|
|
|
myyvel = MulScale(myyvel,gs.playerfriction-0x1400, 16);
|
2020-07-20 21:21:27 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2021-01-04 11:36:54 +00:00
|
|
|
myxvel = MulScale(myxvel,gs.playerfriction, 16);
|
|
|
|
myyvel = MulScale(myyvel,gs.playerfriction, 16);
|
2020-07-20 21:21:27 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if( abs(myxvel) < 2048 && abs(myyvel) < 2048 )
|
|
|
|
myxvel = myyvel = 0;
|
|
|
|
|
|
|
|
if( shrunk )
|
|
|
|
{
|
|
|
|
myxvel =
|
2021-01-04 11:36:54 +00:00
|
|
|
MulScale(myxvel,(gs.playerfriction)-(gs.playerfriction>>1)+(gs.playerfriction>>2), 16);
|
2020-07-20 21:21:27 +00:00
|
|
|
myyvel =
|
2021-01-04 11:36:54 +00:00
|
|
|
MulScale(myyvel,(gs.playerfriction)-(gs.playerfriction>>1)+(gs.playerfriction>>2), 16);
|
2020-07-20 21:21:27 +00:00
|
|
|
}
|
|
|
|
}
|
2020-07-06 09:39:39 +00:00
|
|
|
|
|
|
|
FAKEHORIZONLY:
|
2020-07-20 21:21:27 +00:00
|
|
|
if(psectlotag == 1 || spritebridge == 1) i = (4L<<8); else i = (20L<<8);
|
|
|
|
|
|
|
|
clipmove(&myx,&myy,&myz,&mycursectnum,myxvel,myyvel,164L,4L<<8,i,CLIPMASK0);
|
|
|
|
pushmove(&myx,&myy,&myz,&mycursectnum,164L,4L<<8,4L<<8,CLIPMASK0);
|
|
|
|
|
|
|
|
if( p->jetpack_on == 0 && psectlotag != 1 && psectlotag != 2 && shrunk)
|
|
|
|
myz += 30<<8;
|
|
|
|
|
|
|
|
if ((sb_snum&(1<<18)) || myhardlanding)
|
|
|
|
myreturntocenter = 9;
|
|
|
|
|
|
|
|
if (sb_snum&(1<<13))
|
|
|
|
{
|
|
|
|
myreturntocenter = 9;
|
|
|
|
if (sb_snum&(1<<5)) myhoriz += 6;
|
|
|
|
myhoriz += 6;
|
|
|
|
}
|
|
|
|
else if (sb_snum&(1<<14))
|
|
|
|
{
|
|
|
|
myreturntocenter = 9;
|
|
|
|
if (sb_snum&(1<<5)) myhoriz -= 6;
|
|
|
|
myhoriz -= 6;
|
|
|
|
}
|
|
|
|
else if ((sb_snum&(1<<3)) && !(p->OnMotorcycle || p->OnBoat))
|
|
|
|
{
|
|
|
|
if (sb_snum&(1<<5)) myhoriz += 6;
|
|
|
|
myhoriz += 6;
|
|
|
|
}
|
|
|
|
else if ((sb_snum&(1<<4)) && !(p->OnMotorcycle || p->OnBoat))
|
|
|
|
{
|
|
|
|
if (sb_snum&(1<<5)) myhoriz -= 6;
|
|
|
|
myhoriz -= 6;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (myreturntocenter > 0)
|
|
|
|
if ((sb_snum&(1<<13)) == 0 && (sb_snum&(1<<14)) == 0)
|
|
|
|
{
|
|
|
|
myreturntocenter--;
|
|
|
|
myhoriz += 33-(myhoriz/3);
|
|
|
|
}
|
|
|
|
|
|
|
|
if(p->aim_mode)
|
|
|
|
myhoriz += syn->horz>>1;
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if( myhoriz > 95 && myhoriz < 105) myhoriz = 100;
|
|
|
|
if( myhorizoff > -5 && myhorizoff < 5) myhorizoff = 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (myhardlanding > 0)
|
|
|
|
{
|
|
|
|
myhardlanding--;
|
|
|
|
myhoriz -= (myhardlanding<<4);
|
|
|
|
}
|
|
|
|
|
|
|
|
myhoriz = clamp(myhoriz, HORIZ_MIN, HORIZ_MAX);
|
|
|
|
|
|
|
|
if(p->knee_incs > 0)
|
|
|
|
{
|
|
|
|
myhoriz -= 48;
|
|
|
|
myreturntocenter = 9;
|
|
|
|
}
|
2020-07-06 09:39:39 +00:00
|
|
|
|
|
|
|
|
|
|
|
ENDFAKEPROCESSINPUT:
|
|
|
|
|
2020-07-20 21:21:27 +00:00
|
|
|
myxbak[fakemovefifoplc&(MOVEFIFOSIZ-1)] = myx;
|
|
|
|
myybak[fakemovefifoplc&(MOVEFIFOSIZ-1)] = myy;
|
|
|
|
myzbak[fakemovefifoplc&(MOVEFIFOSIZ-1)] = myz;
|
|
|
|
myangbak[fakemovefifoplc&(MOVEFIFOSIZ-1)] = myang;
|
|
|
|
myhorizbak[fakemovefifoplc&(MOVEFIFOSIZ-1)] = myhoriz;
|
|
|
|
fakemovefifoplc++;
|
2020-07-06 09:39:39 +00:00
|
|
|
|
2020-10-23 19:40:49 +00:00
|
|
|
p->GetActor()->s.cstat = backcstat;
|
2020-07-06 09:39:39 +00:00
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
|
|
|
END_DUKE_NS
|