dukeplayer stuff

This commit is contained in:
Christoph Oelckers 2021-11-21 08:48:36 +01:00
parent 312b1fd39f
commit 22b2f64016
5 changed files with 44 additions and 21 deletions

View file

@ -336,6 +336,16 @@ inline void dragpoint(walltype* pointhighlight, int32_t dax, int32_t day)
dragpoint(wallnum(pointhighlight), dax, day);
}
inline int pushmove(vec3_t *const vect, sectortype**const sect, int32_t const walldist, int32_t const ceildist, int32_t const flordist,
uint32_t const cliptype, bool clear = true)
{
int sectno = *sect? sector.IndexOf(*sect) : -1;
int res = pushmove(vect, &sectno, walldist, ceildist, flordist, cliptype, clear);
*sect = sectno == -1? nullptr : &sector[sectno];
return res;
}
inline int findwallbetweensectors(sectortype* sect1, sectortype* sect2)
{
return findwallbetweensectors(sectnum(sect1), sectnum(sect2));

View file

@ -187,6 +187,14 @@ inline int clipmove_ex(vec3_t* pos, int* sect, int xv, int yv, int wal, int ceil
return result.setFromEngine(res);
}
inline int clipmove_ex(vec3_t* pos, sectortype** sect, int xv, int yv, int wal, int ceil, int flor, int ct, Collision& result)
{
int sectno = *sect? sectnum(*sect) : -1;
int res = clipmove(pos, &sectno, xv, yv, wal, ceil, flor, ct);
*sect = sectno == -1? nullptr : &sector[sectno];
return result.setFromEngine(res);
}
inline void getzrange_ex(int x, int y, int z, int sectnum, int32_t* ceilz, Collision& ceilhit, int32_t* florz, Collision& florhit, int32_t walldist, uint32_t cliptype)
{
int ch, fh;
@ -195,6 +203,14 @@ inline void getzrange_ex(int x, int y, int z, int sectnum, int32_t* ceilz, Colli
florhit.setFromEngine(fh);
}
inline void getzrange_ex(int x, int y, int z, sectortype* sect, int32_t* ceilz, Collision& ceilhit, int32_t* florz, Collision& florhit, int32_t walldist, uint32_t cliptype)
{
int ch, fh;
getzrange(x, y, z, sectnum(sect), ceilz, &ch, florz, &fh, walldist, cliptype);
ceilhit.setFromEngine(ch);
florhit.setFromEngine(fh);
}
inline int hitscan(int x, int y, int z, int sectnum, int32_t vx, int32_t vy, int32_t vz,
sectortype** hitsect, walltype** hitwall, DDukeActor** hitspr, int* hitx, int* hity, int* hitz, uint32_t cliptype)
{

View file

@ -42,7 +42,7 @@ source as it is released.
BEGIN_DUKE_NS
void fireweapon_ww(int snum);
void operateweapon_ww(int snum, ESyncBits actions, int psect);
void operateweapon_ww(int snum, ESyncBits actions);
//---------------------------------------------------------------------------
//
@ -2055,7 +2055,7 @@ int operateTripbomb(int snum)
walltype* wal;
hitscan(p->pos.x, p->pos.y, p->pos.z,
p->cursectnum, p->angle.ang.bcos(),
p->cursector(), p->angle.ang.bcos(),
p->angle.ang.bsin(), -p->horizon.sum().asq16() >> 11,
&hitsectp, &wal, &hitsprt, &sx, &sy, &sz, CLIPMASK1);
@ -2215,7 +2215,7 @@ static void fireweapon(int snum)
//
//---------------------------------------------------------------------------
static void operateweapon(int snum, ESyncBits actions, int psect)
static void operateweapon(int snum, ESyncBits actions)
{
auto p = &ps[snum];
auto pact = p->GetActor();
@ -2673,7 +2673,7 @@ static void operateweapon(int snum, ESyncBits actions, int psect)
//
//---------------------------------------------------------------------------
static void processweapon(int snum, ESyncBits actions, int psect)
static void processweapon(int snum, ESyncBits actions)
{
auto p = &ps[snum];
auto pact = p->GetActor();
@ -2743,8 +2743,8 @@ static void processweapon(int snum, ESyncBits actions, int psect)
}
else if (p->kickback_pic)
{
if (!isWW2GI()) operateweapon(snum, actions, psect);
else operateweapon_ww(snum, actions, psect);
if (!isWW2GI()) operateweapon(snum, actions);
else operateweapon_ww(snum, actions);
}
}
//---------------------------------------------------------------------------
@ -2758,7 +2758,7 @@ void processinput_d(int snum)
int j, k, doubvel, fz, cz, truefdist;
Collision chz, clz;
bool shrunk;
int psect, psectlotag;
int psectlotag;
struct player_struct* p;
spritetype* s;
@ -2775,28 +2775,27 @@ void processinput_d(int snum)
auto sb_svel = PlayerInputSideVel(snum);
auto sb_avel = PlayerInputAngVel(snum);
psect = p->cursectnum;
if (psect == -1)
auto psectp = p->cursector();
if (psectp == nullptr)
{
if (s->extra > 0 && ud.clipping == 0)
{
quickkill(p);
S_PlayActorSound(SQUISHED, pact);
}
psect = 0;
psectp = &sector[0];
}
auto psectp = &sector[psect];
psectlotag = psectp->lotag;
p->spritebridge = 0;
shrunk = (s->yrepeat < 32);
getzrange_ex(p->pos.x, p->pos.y, p->pos.z, psect, &cz, chz, &fz, clz, 163L, CLIPMASK0);
getzrange_ex(p->pos.x, p->pos.y, p->pos.z, psectp, &cz, chz, &fz, clz, 163, CLIPMASK0);
j = getflorzofslope(psect, p->pos.x, p->pos.y);
j = getflorzofslopeptr(psectp, p->pos.x, p->pos.y);
p->truefz = j;
p->truecz = getceilzofslope(psect, p->pos.x, p->pos.y);
p->truecz = getceilzofslopeptr(psectp, p->pos.x, p->pos.y);
truefdist = abs(p->pos.z - j);
if (clz.type == kHitSector && psectlotag == 1 && truefdist > gs.playerheight + (16 << 8))
@ -2882,8 +2881,8 @@ void processinput_d(int snum)
fi.doincrements(p);
if (isWW2GI() && aplWeaponWorksLike[p->curr_weapon][snum] == HANDREMOTE_WEAPON) processweapon(snum, actions, psect);
if (!isWW2GI() && p->curr_weapon == HANDREMOTE_WEAPON) processweapon(snum, actions, psect);
if (isWW2GI() && aplWeaponWorksLike[p->curr_weapon][snum] == HANDREMOTE_WEAPON) processweapon(snum, actions);
if (!isWW2GI() && p->curr_weapon == HANDREMOTE_WEAPON) processweapon(snum, actions);
return;
}
@ -3102,8 +3101,7 @@ HORIZONLY:
if (psectlotag < 3)
{
psect = s->sectnum;
psectp = s->sector(); //
psectp = s->sector();
if (ud.clipping == 0 && psectp->lotag == 31)
{
auto secact = ScriptIndexToActor(psectp->hitag);
@ -3209,7 +3207,7 @@ HORIZONLY:
}
// HACKS
processweapon(snum, actions, psect);
processweapon(snum, actions);
}
END_DUKE_NS

View file

@ -307,7 +307,7 @@ void fireweapon_ww(int snum)
//
//---------------------------------------------------------------------------
void operateweapon_ww(int snum, ESyncBits actions, int psect)
void operateweapon_ww(int snum, ESyncBits actions)
{
auto p = &ps[snum];
auto pact = p->GetActor();

View file

@ -1533,7 +1533,6 @@ void checksectors_d(int snum)
{
int i = -1, oldz;
struct player_struct* p;
int j;
walltype* hitscanwall;
sectortype* ntsector = nullptr;
walltype* ntwall = nullptr;