- inside, haskey and removed unused processmove functions.

This commit is contained in:
Christoph Oelckers 2021-11-18 19:57:14 +01:00
parent 3970c9a757
commit baf36a321b
8 changed files with 25 additions and 52 deletions

View file

@ -429,10 +429,6 @@ int32_t cansee(int32_t x1, int32_t y1, int32_t z1, int16_t sect1,
int32_t x2, int32_t y2, int32_t z2, int16_t sect2); int32_t x2, int32_t y2, int32_t z2, int16_t sect2);
int32_t inside(int32_t x, int32_t y, int sectnum); int32_t inside(int32_t x, int32_t y, int sectnum);
void dragpoint(int pointhighlight, int32_t dax, int32_t day); void dragpoint(int pointhighlight, int32_t dax, int32_t day);
inline void dragpoint(walltype* pointhighlight, int32_t dax, int32_t day)
{
dragpoint(int(pointhighlight - wall), dax, day);
}
int32_t try_facespr_intersect(uspriteptr_t const spr, vec3_t const in, int32_t try_facespr_intersect(uspriteptr_t const spr, vec3_t const in,
int32_t vx, int32_t vy, int32_t vz, int32_t vx, int32_t vy, int32_t vz,
vec3_t * const intp, int32_t strictly_smaller_than_p); vec3_t * const intp, int32_t strictly_smaller_than_p);
@ -452,6 +448,7 @@ void updatesectorneighbor(int32_t const x, int32_t const y, int * const sectnum,
void updatesectorneighborz(int32_t const x, int32_t const y, int32_t const z, int * const sectnum, int32_t initialMaxDistance = INITIALUPDATESECTORDIST, int32_t maxDistance = MAXUPDATESECTORDIST) ATTRIBUTE((nonnull(4))); void updatesectorneighborz(int32_t const x, int32_t const y, int32_t const z, int * const sectnum, int32_t initialMaxDistance = INITIALUPDATESECTORDIST, int32_t maxDistance = MAXUPDATESECTORDIST) ATTRIBUTE((nonnull(4)));
int findwallbetweensectors(int sect1, int sect2); int findwallbetweensectors(int sect1, int sect2);
inline int sectoradjacent(int sect1, int sect2) { return findwallbetweensectors(sect1, sect2) != -1; } inline int sectoradjacent(int sect1, int sect2) { return findwallbetweensectors(sect1, sect2) != -1; }
int32_t getsectordist(vec2_t const in, int const sectnum, vec2_t * const out = nullptr); int32_t getsectordist(vec2_t const in, int const sectnum, vec2_t * const out = nullptr);
extern const int16_t *chsecptr_onextwall; extern const int16_t *chsecptr_onextwall;

View file

@ -296,3 +296,17 @@ inline double SquareDistToWall(double px, double py, const walltype* wal)
return SquareDist(px, py, lx1 + t * (lx2 - lx1), ly1 + t * (ly2 - ly1)); return SquareDist(px, py, lx1 + t * (lx2 - lx1), ly1 + t * (ly2 - ly1));
} }
inline int inside(int x, int y, sectortype* sect)
{
return inside(x, y, sectnum(sect));
}
inline void dragpoint(walltype* pointhighlight, int32_t dax, int32_t day)
{
dragpoint(wallnum(pointhighlight), dax, day);
}
inline int findwallbetweensectors(sectortype* sect1, sectortype* sect2)
{
return findwallbetweensectors(sectnum(sect1), sectnum(sect2));
}

View file

@ -133,7 +133,7 @@ int findotherplayer(int p, int* d);
void quickkill(struct player_struct* p); void quickkill(struct player_struct* p);
int setpal(struct player_struct* p); int setpal(struct player_struct* p);
int madenoise(int playerNum); int madenoise(int playerNum);
int haskey(int sect, int snum); int haskey(sectortype* sect, int snum);
void shootbloodsplat(DDukeActor* i, int p, int sx, int sy, int sz, int sa, int atwith, int BIGFORCE, int OOZFILTER, int NEWBEAST); void shootbloodsplat(DDukeActor* i, int p, int sx, int sy, int sz, int sa, int atwith, int BIGFORCE, int OOZFILTER, int NEWBEAST);
void breakwall(int newpn, DDukeActor* spr, walltype* dawallnum); void breakwall(int newpn, DDukeActor* spr, walltype* dawallnum);

View file

@ -960,8 +960,9 @@ bool movementBlocked(player_struct *p)
// //
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
int haskey(int sect, int snum) int haskey(sectortype* sectp, int snum)
{ {
int sect = sectnum(sectp);
auto p = &ps[snum]; auto p = &ps[snum];
if (!sectorextra[sect]) if (!sectorextra[sect])
return 1; return 1;

View file

@ -3172,23 +3172,4 @@ HORIZONLY:
processweapon(snum, actions, psect); processweapon(snum, actions, psect);
} }
void processmove_d(int snum, ESyncBits actions, int psect, int fz, int cz, int shrunk, int truefdist)
{
auto psectp = &sector[psect];
int psectlotag = psectp->lotag;
auto p = &ps[snum];
if (psectlotag == 2)
{
underwater(snum, actions, fz, cz);
}
else if (p->jetpack_on)
{
operateJetpack(snum, actions, psectlotag, fz, cz, shrunk);
}
else if (psectlotag != 2)
{
movement(snum, actions, psectp, fz, cz, shrunk, truefdist, psectlotag);
}
}
END_DUKE_NS END_DUKE_NS

View file

@ -4016,26 +4016,6 @@ HORIZONLY:
// //
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
void processmove_r(int snum, ESyncBits actions, int psect, int fz, int cz, int shrunk, int truefdist)
{
auto psectp = &sector[psect];
int psectlotag = psectp->lotag;
if (psectlotag == ST_2_UNDERWATER)
{
underwater(snum, actions, fz, cz);
}
else
{
movement(snum, actions, psectp, fz, cz, shrunk, truefdist, psectlotag);
}
}
//---------------------------------------------------------------------------
//
//
//
//---------------------------------------------------------------------------
void OnMotorcycle(struct player_struct *p, DDukeActor* motosprite) void OnMotorcycle(struct player_struct *p, DDukeActor* motosprite)
{ {
if (!p->OnMotorcycle && !(p->cursector()->lotag == 2)) if (!p->OnMotorcycle && !(p->cursector()->lotag == 2))

View file

@ -1025,7 +1025,7 @@ void enterlevel(MapRecord *mi, int gamemode)
for (int i = connecthead; i >= 0; i = connectpoint2[i]) for (int i = connecthead; i >= 0; i = connectpoint2[i])
{ {
bool clearweapon = !!(currentLevel->flags & LEVEL_CLEARWEAPONS); bool clearweapon = !!(currentLevel->flags & LEVEL_CLEARWEAPONS);
int pn = sector[ps[i].GetActor()->s->sectnum].floorpicnum; int pn = ps[i].GetActor()->getSector()->floorpicnum;
if (pn == TILE_HURTRAIL || pn == TILE_FLOORSLIME || pn == TILE_FLOORPLASMA) if (pn == TILE_HURTRAIL || pn == TILE_FLOORSLIME || pn == TILE_FLOORPLASMA)
{ {
resetinventory(i); resetinventory(i);

View file

@ -2749,7 +2749,7 @@ void checksectors_r(int snum)
if (act->s->picnum == ACTIVATOR || act->s->picnum == MASTERSWITCH) if (act->s->picnum == ACTIVATOR || act->s->picnum == MASTERSWITCH)
return; return;
} }
if (haskey(sectnum(ntsector), snum)) if (haskey(ntsector, snum))
operatesectors(ntsector, p->GetActor()); operatesectors(ntsector, p->GetActor());
else else
{ {
@ -2770,7 +2770,7 @@ void checksectors_r(int snum)
if (act->s->picnum == ACTIVATOR || act->s->picnum == MASTERSWITCH) if (act->s->picnum == ACTIVATOR || act->s->picnum == MASTERSWITCH)
return; return;
} }
if (haskey(sectnum(ntsector), snum)) if (haskey(ntsector, snum))
operatesectors(p->GetActor()->s->sector(), p->GetActor()); operatesectors(p->GetActor()->s->sector(), p->GetActor());
else else
{ {
@ -2830,16 +2830,16 @@ void dofurniture(walltype* wlwal, sectortype* sectp, int snum)
max_y += var_cx + 1; max_y += var_cx + 1;
min_x -= var_cx + 1; min_x -= var_cx + 1;
min_y -= var_cx + 1; min_y -= var_cx + 1;
ins = inside(max_x, max_y, sectnum(sectp)); ins = inside(max_x, max_y, sectp);
if (!ins) if (!ins)
var_C = 0; var_C = 0;
ins = inside(max_x, min_y, sectnum(sectp)); ins = inside(max_x, min_y, sectp);
if (!ins) if (!ins)
var_C = 0; var_C = 0;
ins = inside(min_x, min_y, sectnum(sectp)); ins = inside(min_x, min_y, sectp);
if (!ins) if (!ins)
var_C = 0; var_C = 0;
ins = inside(min_x, max_y, sectnum(sectp)); ins = inside(min_x, max_y, sectp);
if (!ins) if (!ins)
var_C = 0; var_C = 0;
if (var_C) if (var_C)