- getglobalz

This commit is contained in:
Christoph Oelckers 2020-10-22 01:10:56 +02:00
parent 8f75a58343
commit 291edcdab8
3 changed files with 31 additions and 25 deletions

View file

@ -4977,11 +4977,11 @@ void handle_se31(DDukeActor* actor, bool choosedir)
// //
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
void getglobalz(int i) void getglobalz(DDukeActor* actor)
{ {
int hz,lz,zr; auto s = &actor->s;
int zr;
spritetype *s = &sprite[i]; Collision hz, lz;
if( s->statnum == STAT_PLAYER || s->statnum == STAT_STANDABLE || s->statnum == STAT_ZOMBIEACTOR || s->statnum == STAT_ACTOR || s->statnum == STAT_PROJECTILE) if( s->statnum == STAT_PLAYER || s->statnum == STAT_STANDABLE || s->statnum == STAT_ZOMBIEACTOR || s->statnum == STAT_ACTOR || s->statnum == STAT_PROJECTILE)
{ {
@ -4989,40 +4989,38 @@ void getglobalz(int i)
zr = 4; zr = 4;
else zr = 127; else zr = 127;
getzrange(s->x,s->y,s->z-(FOURSLEIGHT),s->sectnum,&hittype[i].ceilingz,&hz,&hittype[i].floorz,&lz,zr,CLIPMASK0); getzrange_ex(s->x, s->y, s->z - (FOURSLEIGHT), s->sectnum, &actor->ceilingz, hz, &actor->floorz, lz, zr, CLIPMASK0);
if( (lz&49152) == 49152 && (sprite[lz&(MAXSPRITES-1)].cstat&48) == 0 ) if( lz.type == kHitSprite && (lz.actor->s.cstat&48) == 0 )
{ {
lz &= (MAXSPRITES-1); if( badguy(lz.actor) && lz.actor->s.pal != 1)
if( badguy(&sprite[lz]) && sprite[lz].pal != 1)
{ {
if( s->statnum != 4 ) if( s->statnum != STAT_PROJECTILE)
{ {
hittype[i].aflags |= SFLAG_NOFLOORSHADOW; actor->aflags |= SFLAG_NOFLOORSHADOW;
//hittype[i].dispicnum = -4; // No shadows on actors //actor->dispicnum = -4; // No shadows on actors
s->xvel = -256; s->xvel = -256;
ssp(i,CLIPMASK0); ssp(actor, CLIPMASK0);
} }
} }
else if(sprite[lz].picnum == TILE_APLAYER && badguy(s) ) else if(lz.actor->s.picnum == TILE_APLAYER && badguy(actor) )
{ {
hittype[i].aflags |= SFLAG_NOFLOORSHADOW; actor->aflags |= SFLAG_NOFLOORSHADOW;
//hittype[i].dispicnum = -4; // No shadows on actors //actor->dispicnum = -4; // No shadows on actors
s->xvel = -256; s->xvel = -256;
ssp(i,CLIPMASK0); ssp(actor, CLIPMASK0);
} }
else if(s->statnum == 4 && sprite[lz].picnum == TILE_APLAYER) else if(s->statnum == STAT_PROJECTILE && lz.actor->s.picnum == TILE_APLAYER && actor->GetOwner() == actor)
if(s->owner == lz)
{ {
hittype[i].ceilingz = sector[s->sectnum].ceilingz; actor->ceilingz = sector[s->sectnum].ceilingz;
hittype[i].floorz = sector[s->sectnum].floorz; actor->floorz = sector[s->sectnum].floorz;
} }
} }
} }
else else
{ {
hittype[i].ceilingz = sector[s->sectnum].ceilingz; actor->ceilingz = sector[s->sectnum].ceilingz;
hittype[i].floorz = sector[s->sectnum].floorz; actor->floorz = sector[s->sectnum].floorz;
} }
} }

View file

@ -241,6 +241,14 @@ inline int clipmove_ex(int* x, int* y, int* z, short* sect, int xv, int yv, int
return result.setFromEngine(res); return result.setFromEngine(res);
} }
inline void getzrange_ex(int x, int y, int z, int16_t sectnum, int32_t* ceilz, Collision& ceilhit, int32_t* florz, Collision& florhit, int32_t walldist, uint32_t cliptype)
{
int ch, fh;
getzrange(x, y, z, sectnum, ceilz, &ch, florz, &fh, walldist, cliptype);
ceilhit.setFromEngine(ch);
florhit.setFromEngine(fh);
}
inline void ms(short i) inline void ms(short i)
{ {
ms(&hittype[i]); ms(&hittype[i]);
@ -256,9 +264,9 @@ inline void makeitfall(DDukeActor* act)
makeitfall(act->GetIndex()); makeitfall(act->GetIndex());
} }
inline void getglobalz(DDukeActor* act) inline void getglobalz(int act)
{ {
getglobalz(act->GetIndex()); getglobalz(&hittype[act]);
} }
inline int findplayer(DDukeActor* act, int* x) inline int findplayer(DDukeActor* act, int* x)

View file

@ -172,7 +172,7 @@ void LoadActor(int i, int p, int x);
void execute(int s, int p, int d); void execute(int s, int p, int d);
void makeitfall(int s); void makeitfall(int s);
int furthestangle(int snum, int angDiv); int furthestangle(int snum, int angDiv);
void getglobalz(int s); void getglobalz(DDukeActor* s);
void OnEvent(int id, int pnum = -1, int snum = -1, int dist = -1); void OnEvent(int id, int pnum = -1, int snum = -1, int dist = -1);
short EGS(short whatsect, int s_x, int s_y, int s_z, short s_pn, signed char s_s, signed char s_xr, signed char s_yr, short s_a, short s_ve, int s_zv, short s_ow, signed char s_ss); short EGS(short whatsect, int s_x, int s_y, int s_z, short s_pn, signed char s_s, signed char s_xr, signed char s_yr, short s_a, short s_ve, int s_zv, short s_ow, signed char s_ss);