Skip to content

Commit

Permalink
- inside, haskey and removed unused processmove functions.
Browse files Browse the repository at this point in the history
  • Loading branch information
coelckers committed Nov 21, 2021
1 parent a0cf6c8 commit 6a1bc31
Show file tree
Hide file tree
Showing 8 changed files with 25 additions and 52 deletions.
5 changes: 1 addition & 4 deletions source/build/include/build.h
Expand Up @@ -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 inside(int32_t x, int32_t y, int sectnum);
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 vx, int32_t vy, int32_t vz,
vec3_t * const intp, int32_t strictly_smaller_than_p);
Expand All @@ -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)));

int findwallbetweensectors(int sect1, int sect2);

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);
extern const int16_t *chsecptr_onextwall;
Expand Down
14 changes: 14 additions & 0 deletions source/core/gamefuncs.h
Expand Up @@ -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));
}

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));
}
2 changes: 1 addition & 1 deletion source/games/duke/src/funct.h
Expand Up @@ -133,7 +133,7 @@ int findotherplayer(int p, int* d);
void quickkill(struct player_struct* p);
int setpal(struct player_struct* p);
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 breakwall(int newpn, DDukeActor* spr, walltype* dawallnum);
Expand Down
3 changes: 2 additions & 1 deletion source/games/duke/src/player.cpp
Expand Up @@ -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];
if (!sectorextra[sect])
return 1;
Expand Down
19 changes: 0 additions & 19 deletions source/games/duke/src/player_d.cpp
Expand Up @@ -3172,23 +3172,4 @@ void processinput_d(int snum)
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
20 changes: 0 additions & 20 deletions source/games/duke/src/player_r.cpp
Expand Up @@ -4016,26 +4016,6 @@ void processinput_r(int snum)
//
//---------------------------------------------------------------------------

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)
{
if (!p->OnMotorcycle && !(p->cursector()->lotag == 2))
Expand Down
2 changes: 1 addition & 1 deletion source/games/duke/src/premap.cpp
Expand Up @@ -1025,7 +1025,7 @@ void enterlevel(MapRecord *mi, int gamemode)
for (int i = connecthead; i >= 0; i = connectpoint2[i])
{
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)
{
resetinventory(i);
Expand Down
12 changes: 6 additions & 6 deletions source/games/duke/src/sectors_r.cpp
Expand Up @@ -2749,7 +2749,7 @@ void checksectors_r(int snum)
if (act->s->picnum == ACTIVATOR || act->s->picnum == MASTERSWITCH)
return;
}
if (haskey(sectnum(ntsector), snum))
if (haskey(ntsector, snum))
operatesectors(ntsector, p->GetActor());
else
{
Expand All @@ -2770,7 +2770,7 @@ void checksectors_r(int snum)
if (act->s->picnum == ACTIVATOR || act->s->picnum == MASTERSWITCH)
return;
}
if (haskey(sectnum(ntsector), snum))
if (haskey(ntsector, snum))
operatesectors(p->GetActor()->s->sector(), p->GetActor());
else
{
Expand Down Expand Up @@ -2830,16 +2830,16 @@ void dofurniture(walltype* wlwal, sectortype* sectp, int snum)
max_y += var_cx + 1;
min_x -= 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)
var_C = 0;
ins = inside(max_x, min_y, sectnum(sectp));
ins = inside(max_x, min_y, sectp);
if (!ins)
var_C = 0;
ins = inside(min_x, min_y, sectnum(sectp));
ins = inside(min_x, min_y, sectp);
if (!ins)
var_C = 0;
ins = inside(min_x, max_y, sectnum(sectp));
ins = inside(min_x, max_y, sectp);
if (!ins)
var_C = 0;
if (var_C)
Expand Down

0 comments on commit 6a1bc31

Please sign in to comment.