mirror of
https://github.com/ZDoom/raze-gles.git
synced 2024-11-10 23:02:03 +00:00
- PlayerColorChanged, hits, hitasprite.
This commit is contained in:
parent
1fcd5eef47
commit
79f850d126
8 changed files with 27 additions and 35 deletions
|
@ -274,18 +274,4 @@ inline int callsound(int sect, int a)
|
|||
return callsound(sect, a == -1? nullptr : &hittype[a]);
|
||||
}
|
||||
|
||||
inline int hits(DDukeActor* snum)
|
||||
{
|
||||
return hits(snum->GetIndex());
|
||||
}
|
||||
|
||||
inline int hitasprite(DDukeActor* actor, DDukeActor** hit)
|
||||
{
|
||||
short m;
|
||||
int dist = hitasprite(actor->GetIndex(), &m);
|
||||
if (hit) *hit = m >= 0? &hittype[m] : nullptr;
|
||||
else *hit = nullptr;
|
||||
return dist;
|
||||
}
|
||||
|
||||
END_DUKE_NS
|
||||
|
|
|
@ -128,8 +128,6 @@ void playerAimUp(int snum, ESyncBits actions);
|
|||
void playerAimDown(int snum, ESyncBits actions);
|
||||
bool view(struct player_struct* pp, int* vx, int* vy, int* vz, short* vsectnum, int ang, fixed_t q16horiz, double smoothratio);
|
||||
void tracers(int x1, int y1, int z1, int x2, int y2, int z2, int n);
|
||||
int hits(int i);
|
||||
int hitasprite(int i, short* hitsp);
|
||||
int aim(spritetype* s, int aang);
|
||||
void checkweapons(struct player_struct* const p);
|
||||
int findotherplayer(int p, int* d);
|
||||
|
@ -141,7 +139,7 @@ void shootbloodsplat(int i, int p, int sx, int sy, int sz, int sa, int atwith, i
|
|||
|
||||
void breakwall(short newpn, short spr, short dawallnum);
|
||||
int callsound(int sectnum,DDukeActor* snum);
|
||||
int hitasprite(int snum,short *hitSprite);
|
||||
int hitasprite(DDukeActor* snum,DDukeActor **hitSprite);
|
||||
int findplayer(const DDukeActor* s, int* dist);
|
||||
void operatejaildoors(int hitag);
|
||||
void allignwarpelevators(void);
|
||||
|
@ -160,7 +158,7 @@ int setanimation(short animsect, int animtype, int animindex, int thegoal, int t
|
|||
void dofurniture(int wallNum, int sectnum, int playerNum);
|
||||
void dotorch();
|
||||
int hitawall(struct player_struct* pl, int* hitWall);
|
||||
int hits(int snum);
|
||||
int hits(DDukeActor* snum);
|
||||
|
||||
void clearsectinterpolate(int sprnum);
|
||||
void setsectinterpolate(int sprnum);
|
||||
|
|
|
@ -58,16 +58,17 @@ void PlayerColorChanged(void)
|
|||
if (ud.recstat != 0)
|
||||
return;
|
||||
|
||||
auto& pp = ps[myconnectindex];
|
||||
if (ud.multimode > 1)
|
||||
{
|
||||
//Net_SendClientInfo();
|
||||
}
|
||||
else
|
||||
{
|
||||
ps[myconnectindex].palookup = ud.user_pals[myconnectindex] = playercolor2lookup(playercolor);
|
||||
pp.palookup = ud.user_pals[myconnectindex] = playercolor2lookup(playercolor);
|
||||
}
|
||||
if (sprite[ps[myconnectindex].i].picnum == TILE_APLAYER && sprite[ps[myconnectindex].i].pal != 1)
|
||||
sprite[ps[myconnectindex].i].pal = ud.user_pals[myconnectindex];
|
||||
if (pp.GetActor()->s.picnum == TILE_APLAYER && pp.GetActor()->s.pal != 1)
|
||||
pp.GetActor()->s.pal = ud.user_pals[myconnectindex];
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
|
@ -211,9 +212,9 @@ void tracers(int x1, int y1, int z1, int x2, int y2, int z2, int n)
|
|||
//
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
int hits(int i)
|
||||
int hits(DDukeActor* actor)
|
||||
{
|
||||
auto sp = &sprite[i];
|
||||
auto sp = &actor->s;
|
||||
int sx, sy, sz;
|
||||
short sect;
|
||||
short hw, hs;
|
||||
|
@ -233,20 +234,22 @@ int hits(int i)
|
|||
//
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
int hitasprite(int i, short* hitsp)
|
||||
int hitasprite(DDukeActor* actor, DDukeActor** hitsp)
|
||||
{
|
||||
auto sp = &sprite[i];
|
||||
auto sp = &actor->s;
|
||||
int sx, sy, sz, zoff;
|
||||
short sect, hw;
|
||||
|
||||
if (badguy(&sprite[i]))
|
||||
if (badguy(actor))
|
||||
zoff = (42 << 8);
|
||||
else if (sp->picnum == TILE_APLAYER) zoff = (39 << 8);
|
||||
else zoff = 0;
|
||||
|
||||
hitscan(sp->x, sp->y, sp->z - zoff, sp->sectnum, sintable[(sp->ang + 512) & 2047], sintable[sp->ang & 2047], 0, §, &hw, hitsp, &sx, &sy, &sz, CLIPMASK1);
|
||||
short hitthis = -1;
|
||||
hitscan(sp->x, sp->y, sp->z - zoff, sp->sectnum, sintable[(sp->ang + 512) & 2047], sintable[sp->ang & 2047], 0, §, &hw, &hitthis, &sx, &sy, &sz, CLIPMASK1);
|
||||
if (hitsp) *hitsp = (hitthis == -1 ? nullptr : &hittype[hitthis]);
|
||||
|
||||
if (hw >= 0 && (wall[hw].cstat & 16) && badguy(&sprite[i]))
|
||||
if (hw >= 0 && (wall[hw].cstat & 16) && badguy(actor))
|
||||
return((1 << 30));
|
||||
|
||||
return (FindDistance2D(sx - sp->x, sy - sp->y));
|
||||
|
|
|
@ -2204,7 +2204,7 @@ static void operateweapon(int snum, ESyncBits actions, int psect)
|
|||
sprite[j].z += (8 << 8);
|
||||
}
|
||||
|
||||
k = hits(pi);
|
||||
k = hits(p->GetActor());
|
||||
if (k < 512)
|
||||
{
|
||||
sprite[j].ang += 1024;
|
||||
|
|
|
@ -2890,7 +2890,7 @@ static void operateweapon(int snum, ESyncBits actions, int psect)
|
|||
sprite[j].z += (8 << 8);
|
||||
}
|
||||
|
||||
k = hits(pi);
|
||||
k = hits(p->GetActor());
|
||||
if (k < 512)
|
||||
{
|
||||
sprite[j].ang += 1024;
|
||||
|
|
|
@ -363,7 +363,7 @@ void operateweapon_ww(int snum, ESyncBits actions, int psect)
|
|||
sprite[j].z += (8 << 8);
|
||||
}
|
||||
|
||||
k = hits(pi);
|
||||
k = hits(p->GetActor());
|
||||
if (k < 512)
|
||||
{
|
||||
sprite[j].ang += 1024;
|
||||
|
|
|
@ -1620,8 +1620,11 @@ void checksectors_d(int snum)
|
|||
if (neartagsprite == -1 && neartagwall == -1)
|
||||
if (sector[p->cursectnum].lotag == 2)
|
||||
{
|
||||
oldz = hitasprite(p->i, &neartagsprite);
|
||||
DDukeActor* hit;
|
||||
oldz = hitasprite(p->GetActor(), &hit);
|
||||
if (hit) neartagsprite = hit->GetIndex();
|
||||
if (oldz > 1280) neartagsprite = -1;
|
||||
|
||||
}
|
||||
|
||||
if (neartagsprite >= 0)
|
||||
|
@ -1744,7 +1747,7 @@ void checksectors_d(int snum)
|
|||
else if (p->newowner >= 0) { i = -1; goto CLEARCAMERAS; }
|
||||
|
||||
if (neartagwall == -1 && neartagsector == -1 && neartagsprite == -1)
|
||||
if (abs(hits(p->i)) < 512)
|
||||
if (abs(hits(p->GetActor())) < 512)
|
||||
{
|
||||
if ((krand() & 255) < 16)
|
||||
S_PlayActorSound(DUKE_SEARCH2, p->i);
|
||||
|
|
|
@ -2585,7 +2585,9 @@ void checksectors_r(int snum)
|
|||
if (neartagsprite == -1 && neartagwall == -1)
|
||||
if (sector[p->cursectnum].lotag == 2)
|
||||
{
|
||||
oldz = hitasprite(p->i, &neartagsprite);
|
||||
DDukeActor* hit;
|
||||
oldz = hitasprite(p->GetActor(), &hit);
|
||||
if (hit) neartagsprite = hit->GetIndex();
|
||||
if (oldz > 1280) neartagsprite = -1;
|
||||
}
|
||||
|
||||
|
@ -2695,7 +2697,7 @@ void checksectors_r(int snum)
|
|||
if (!PlayerInput(snum, SB_OPEN)) return;
|
||||
|
||||
if (neartagwall == -1 && neartagsector == -1 && neartagsprite == -1)
|
||||
if (abs(hits(p->i)) < 512)
|
||||
if (abs(hits(p->GetActor())) < 512)
|
||||
{
|
||||
if ((krand() & 255) < 16)
|
||||
S_PlayActorSound(DUKE_SEARCH2, p->i);
|
||||
|
|
Loading…
Reference in a new issue