- changed setsectinterpolate to receive a sector number, not a sprite number.

This commit is contained in:
Christoph Oelckers 2020-10-28 06:12:16 +01:00
parent 32fc9329de
commit 2b0f56a94c
6 changed files with 21 additions and 22 deletions

View file

@ -161,7 +161,7 @@ int hitawall(struct player_struct* pl, int* hitWall);
int hits(DDukeActor* snum);
void clearsectinterpolate(int sprnum);
void setsectinterpolate(int sprnum);
void setsectinterpolate(int sectnum);
DDukeActor* LocateTheLocator(int n, int sectnum);
void clearcamera(player_struct* ps);

View file

@ -77,7 +77,7 @@ inline int checkcursectnums(int se)
{
int i;
for(i=connecthead;i>=0;i=connectpoint2[i])
if((unsigned)ps[i].i < MAXSPRITES && sprite[ps[i].i].sectnum == se ) return i;
if((unsigned)ps[i].i < MAXSPRITES && ps[i].GetActor()->s.sectnum == se ) return i;
return -1;
}

View file

@ -100,10 +100,10 @@ void restoreinterpolations() //Stick at end of drawscreen
}
void setsectinterpolate(int i)
void setsectinterpolate(int sectnum)
{
int j, k, startwall,endwall;
auto sect = &sector[sprite[i].sectnum];
auto sect = &sector[sectnum];
startwall = sect->wallptr;
endwall = startwall+sect->wallnum;
@ -124,10 +124,10 @@ void setsectinterpolate(int i)
}
}
void clearsectinterpolate(short i)
void clearsectinterpolate(int sectnum)
{
short j,startwall,endwall;
auto sect = &sector[sprite[i].sectnum];
auto sect = &sector[sectnum];
startwall = sect->wallptr;
endwall = startwall + sect->wallnum;

View file

@ -102,7 +102,8 @@ void fakedomovethings(void)
{
input *syn;
struct player_struct *p;
int i, j, k, doubvel, fz, cz, hz, lz, x, y;
int i, j, k, doubvel, fz, cz, x, y;
Collision clz, chz;
short psect, psectlotag, tempsect, backcstat;
uint8_t shrunk, spritebridge;
ESyncBits actions;
@ -138,11 +139,11 @@ void fakedomovethings(void)
omyz = myz;
omyang = myang;
getzrange(myx,myy,myz,psect,&cz,&hz,&fz,&lz,163L,CLIPMASK0);
getzrange(myx,myy,myz,psect,&cz,chz,&fz,clz,163L,CLIPMASK0);
j = getflorzofslope(psect,myx,myy);
if( (lz&49152) == 16384 && psectlotag == 1 && klabs(myz-j) > PHEIGHT+(16<<8) )
if(clz.type == kHitSector && psectlotag == 1 && klabs(myz-j) > PHEIGHT+(16<<8) )
psectlotag = 0;
if( p->aim_mode == 0 && myonground && psectlotag != 2 && (sector[psect].floorstat&2) )
@ -163,27 +164,25 @@ void fakedomovethings(void)
if (myhorizoff > 0) myhorizoff -= ((myhorizoff>>3)+1);
else if (myhorizoff < 0) myhorizoff += (((-myhorizoff)>>3)+1);
if(hz >= 0 && (hz&49152) == 49152)
if(chz.type == kHitSprite)
{
hz &= (MAXSPRITES-1);
if (sprite[hz].statnum == 1 && sprite[hz].extra >= 0)
if (chz.actor->s.statnum == 1 && chz.actor->s.extra >= 0)
{
hz = 0;
chz.type = kHitNone;
cz = getceilzofslope(psect,myx,myy);
}
}
if(lz >= 0 && (lz&49152) == 49152)
if (clz.type == kHitSprite)
{
j = lz&(MAXSPRITES-1);
if ((sprite[j].cstat&33) == 33)
if ((clz.actor->s.cstat&33) == 33)
{
psectlotag = 0;
spritebridge = 1;
}
if(badguy(&sprite[j]) && sprite[j].xrepeat > 24 && klabs(p->GetActor()->s.z-sprite[j].z) < (84<<8) )
if(badguy(chz.actor) && sprite[j].xrepeat > 24 && klabs(p->GetActor()->s.z- chz.actor->s.z) < (84<<8) )
{
j = getangle( sprite[j].x-myx,sprite[j].y-myy);
j = getangle(chz.actor->s.x-myx, chz.actor->s.y-myy);
myxvel -= sintable[(j+512)&2047]<<4;
myyvel -= sintable[j&2047]<<4;
}

View file

@ -86,7 +86,7 @@ static void recreateinterpolations()
case SE_16_REACTOR:
case SE_26:
case SE_30_TWO_WAY_TRAIN:
setsectinterpolate(k);
setsectinterpolate(sprite[k].sectnum);
break;
}
}

View file

@ -956,7 +956,7 @@ void spawneffector(int i)
if (sp->pal) sprite[i].clipdist = 1;
else sprite[i].clipdist = 0;
t[3] = sector[sect].floorz;
sector[sect].hitag = i;
sector[sect].hitag = i; // hijack
}
for (j = 0; j < MAXSPRITES; j++)
@ -1005,7 +1005,7 @@ void spawneffector(int i)
sp->extra = 0;
else sp->extra = 1;
sector[sect].hitag = i;
sector[sect].hitag = i; // hijack
j = 0;
@ -1075,7 +1075,7 @@ void spawneffector(int i)
case SE_15_SLIDING_DOOR:
case SE_16_REACTOR:
case SE_26:
setsectinterpolate(i);
setsectinterpolate(sprite[i].sectnum);
break;
}