Make dist() and ldist() take void pointers so we can compare spritetype with tspritetype without inserting casts everywhere.

git-svn-id: https://svn.eduke32.com/eduke32@4910 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
terminx 2015-01-12 09:28:41 +00:00
parent 19729fc766
commit d70ac064b7
3 changed files with 10 additions and 8 deletions

View file

@ -125,8 +125,8 @@ static inline int32_t sepdist(const int32_t dx, const int32_t dy, const int32_t
return d.x - (d.x>>4) + (d.y>>2) + (d.y>>3);
}
int32_t ldist(const spritetype *s1, const spritetype *s2);
int32_t dist(const spritetype *s1, const spritetype *s2);
int32_t ldist(const void *s1, const void *s2);
int32_t dist(const void *s1, const void *s2);
void COMMON_clearbackground(int32_t numcols, int32_t numrows);

View file

@ -188,14 +188,18 @@ int32_t maybe_append_ext(char *wbuf, int32_t wbufsiz, const char *fn, const char
}
int32_t ldist(const spritetype *s1, const spritetype *s2)
int32_t ldist(const void *s1, const void *s2)
{
return sepldist(s1->x-s2->x, s1->y-s2->y);
tspritetype const *const sp1 = (tspritetype *)s1;
tspritetype const *const sp2 = (tspritetype *)s2;
return sepldist(sp1->x - sp2->x, sp1->y - sp2->y);
}
int32_t dist(const spritetype *s1, const spritetype *s2)
int32_t dist(const void *s1, const void *s2)
{
return sepdist(s1->x-s2->x, s1->y-s2->y, s1->z-s2->z);
tspritetype const *const sp1 = (tspritetype *)s1;
tspritetype const *const sp2 = (tspritetype *)s2;
return sepdist(sp1->x - sp2->x, sp1->y - sp2->y, sp1->z - sp2->z);
}

View file

@ -131,8 +131,6 @@ void P_HandleSharedKeys(int32_t snum);
int32_t GetAnimationGoal(const int32_t *animptr);
int32_t isanearoperator(int32_t lotag);
int32_t isanunderoperator(int32_t lotag);
int32_t ldist(const spritetype *s1, const spritetype *s2);
int32_t dist(const spritetype *s1, const spritetype *s2);
int32_t P_ActivateSwitch(int32_t snum,int32_t w,int32_t switchissprite);
void P_CheckSectors(int32_t snum);
int32_t Sect_DamageCeilingOrFloor(int32_t floorp, int32_t sn);