mirror of
https://github.com/ZDoom/raze-gles.git
synced 2024-11-10 23:02:03 +00:00
Clean up A_FindPlayer(), constify some function args, some 0x7fffffff->INT32_MAX
git-svn-id: https://svn.eduke32.com/eduke32@2984 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
parent
59151dd045
commit
6fe5eb2863
5 changed files with 23 additions and 16 deletions
|
@ -6310,7 +6310,7 @@ ACTOR_STATIC void G_MoveEffectors(void) //STATNUM 3
|
|||
if (s->owner==-1) //Start search
|
||||
{
|
||||
t[4]=0;
|
||||
l = 0x7fffffff;
|
||||
l = INT32_MAX;
|
||||
while (1) //Find the shortest dist
|
||||
{
|
||||
s->owner = A_FindLocator((int16_t)t[4],-1); //t[0] hold sectnum
|
||||
|
|
|
@ -3387,7 +3387,7 @@ void G_HandleMirror(int32_t x, int32_t y, int32_t z, int32_t a, int32_t horiz, i
|
|||
#endif
|
||||
)
|
||||
{
|
||||
int32_t j, i = 0, k, dst = 0x7fffffff;
|
||||
int32_t j, i = 0, k, dst = INT32_MAX;
|
||||
|
||||
if (g_mirrorCount==0)
|
||||
{
|
||||
|
@ -5579,7 +5579,7 @@ int32_t A_Spawn(int32_t j, int32_t pn)
|
|||
endwall = startwall+sector[sect].wallnum;
|
||||
|
||||
//find the two most clostest wall x's and y's
|
||||
q = 0x7fffffff;
|
||||
q = INT32_MAX;
|
||||
|
||||
for (s=startwall; s<endwall; s++)
|
||||
{
|
||||
|
@ -5596,7 +5596,7 @@ int32_t A_Spawn(int32_t j, int32_t pn)
|
|||
|
||||
T2 = clostest;
|
||||
|
||||
q = 0x7fffffff;
|
||||
q = INT32_MAX;
|
||||
|
||||
for (s=startwall; s<endwall; s++)
|
||||
{
|
||||
|
|
|
@ -243,7 +243,7 @@ static int32_t A_FindTargetSprite(spritetype *s,int32_t aang,int32_t atwith)
|
|||
gotshrinker = (s->picnum == APLAYER && *aplWeaponWorksLike[g_player[s->yvel].ps->curr_weapon] == SHRINKER_WEAPON);
|
||||
gotfreezer = (s->picnum == APLAYER && *aplWeaponWorksLike[g_player[s->yvel].ps->curr_weapon] == FREEZE_WEAPON);
|
||||
|
||||
smax = 0x7fffffff;
|
||||
smax = INT32_MAX;
|
||||
|
||||
dx1 = sintable[(a+512-aang)&2047];
|
||||
dy1 = sintable[(a-aang)&2047];
|
||||
|
@ -3630,7 +3630,7 @@ int32_t P_CheckFloorDamage(DukePlayer_t *p, int32_t tex)
|
|||
int32_t P_FindOtherPlayer(int32_t p,int32_t *d)
|
||||
{
|
||||
int32_t j, closest_player = p;
|
||||
int32_t x, closest = 0x7fffffff;
|
||||
int32_t x, closest = INT32_MAX;
|
||||
|
||||
for (TRAVERSE_CONNECT(j))
|
||||
if (p != j && sprite[g_player[j].ps->i].extra > 0)
|
||||
|
|
|
@ -201,7 +201,7 @@ inline int32_t G_CheckPlayerInSector(int32_t sect)
|
|||
return -1;
|
||||
}
|
||||
|
||||
int32_t ldist(spritetype *s1,spritetype *s2)
|
||||
int32_t ldist(const spritetype *s1, const spritetype *s2)
|
||||
{
|
||||
int32_t x= klabs(s1->x-s2->x);
|
||||
int32_t y= klabs(s1->y-s2->y);
|
||||
|
@ -214,7 +214,7 @@ int32_t ldist(spritetype *s1,spritetype *s2)
|
|||
}
|
||||
}
|
||||
|
||||
int32_t dist(spritetype *s1,spritetype *s2)
|
||||
int32_t dist(const spritetype *s1, const spritetype *s2)
|
||||
{
|
||||
int32_t x= klabs(s1->x-s2->x);
|
||||
int32_t y= klabs(s1->y-s2->y);
|
||||
|
@ -229,24 +229,31 @@ int32_t dist(spritetype *s1,spritetype *s2)
|
|||
}
|
||||
}
|
||||
|
||||
int32_t __fastcall A_FindPlayer(spritetype *s, int32_t *d)
|
||||
static inline int32_t A_FP_ManhattanDist(const DukePlayer_t *ps, const spritetype *s)
|
||||
{
|
||||
return klabs(ps->opos.x-s->x)
|
||||
+ klabs(ps->opos.y-s->y)
|
||||
+ ((klabs(ps->opos.z-s->z+(28<<8)))>>4);
|
||||
}
|
||||
|
||||
int32_t __fastcall A_FindPlayer(const spritetype *s, int32_t *d)
|
||||
{
|
||||
if ((!g_netServer && ud.multimode < 2))
|
||||
{
|
||||
DukePlayer_t *const myps = g_player[myconnectindex].ps;
|
||||
*d = klabs(myps->opos.x-s->x) + klabs(myps->opos.y-s->y) + ((klabs(myps->opos.z-s->z+(28<<8)))>>4);
|
||||
*d = A_FP_ManhattanDist(myps, s);
|
||||
return myconnectindex;
|
||||
}
|
||||
|
||||
{
|
||||
int32_t j, closest_player = 0;
|
||||
int32_t x, closest = 0x7fffffff;
|
||||
int32_t j;
|
||||
int32_t closest_player=0, closest=INT32_MAX;
|
||||
|
||||
for (TRAVERSE_CONNECT(j))
|
||||
{
|
||||
DukePlayer_t *const ps = g_player[j].ps;
|
||||
int32_t x = A_FP_ManhattanDist(ps, s);
|
||||
|
||||
x = klabs(ps->opos.x-s->x) + klabs(ps->opos.y-s->y) + ((klabs(ps->opos.z-s->z+(28<<8)))>>4);
|
||||
if (x < closest && sprite[ps->i].extra > 0)
|
||||
{
|
||||
closest_player = j;
|
||||
|
|
|
@ -102,10 +102,9 @@ int32_t A_CallSound(int32_t sn,int32_t whatsprite);
|
|||
int32_t A_CheckHitSprite(int32_t i,int16_t *hitsp);
|
||||
void A_DamageObject(int32_t i,int32_t sn);
|
||||
void A_DamageWall(int32_t spr,int32_t dawallnum,const vec3_t *pos,int32_t atwith);
|
||||
int32_t __fastcall A_FindPlayer(spritetype *s,int32_t *d);
|
||||
int32_t __fastcall A_FindPlayer(const spritetype *s,int32_t *d);
|
||||
void allignwarpelevators(void);
|
||||
int32_t CheckDoorTile(int32_t dapic);
|
||||
int32_t dist(spritetype *s1,spritetype *s2);
|
||||
void G_AnimateCamSprite(void);
|
||||
void G_AnimateWalls(void);
|
||||
int32_t G_ActivateWarpElevators(int32_t s,int32_t d);
|
||||
|
@ -121,7 +120,8 @@ 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(spritetype *s1,spritetype *s2);
|
||||
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_DamageCeiling(int32_t sn);
|
||||
|
|
Loading…
Reference in a new issue