From 2b0f56a94ccfee32505c6e1be0dd163db6d327bf Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Wed, 28 Oct 2020 06:12:16 +0100 Subject: [PATCH] - changed setsectinterpolate to receive a sector number, not a sprite number. --- source/games/duke/src/funct.h | 2 +- source/games/duke/src/inlines.h | 2 +- source/games/duke/src/interpolate.cpp | 8 ++++---- source/games/duke/src/prediction.cpp | 23 +++++++++++------------ source/games/duke/src/savegame.cpp | 2 +- source/games/duke/src/spawn.cpp | 6 +++--- 6 files changed, 21 insertions(+), 22 deletions(-) diff --git a/source/games/duke/src/funct.h b/source/games/duke/src/funct.h index 8bb6b91ce..c70e6bbab 100644 --- a/source/games/duke/src/funct.h +++ b/source/games/duke/src/funct.h @@ -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); diff --git a/source/games/duke/src/inlines.h b/source/games/duke/src/inlines.h index 698c87ff9..13a387349 100644 --- a/source/games/duke/src/inlines.h +++ b/source/games/duke/src/inlines.h @@ -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; } diff --git a/source/games/duke/src/interpolate.cpp b/source/games/duke/src/interpolate.cpp index c5368bb2f..ecd8aa254 100644 --- a/source/games/duke/src/interpolate.cpp +++ b/source/games/duke/src/interpolate.cpp @@ -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 = §or[sprite[i].sectnum]; + auto sect = §or[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 = §or[sprite[i].sectnum]; + auto sect = §or[sectnum]; startwall = sect->wallptr; endwall = startwall + sect->wallnum; diff --git a/source/games/duke/src/prediction.cpp b/source/games/duke/src/prediction.cpp index 3bcd3db14..5f0631022 100644 --- a/source/games/duke/src/prediction.cpp +++ b/source/games/duke/src/prediction.cpp @@ -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; } diff --git a/source/games/duke/src/savegame.cpp b/source/games/duke/src/savegame.cpp index d8df11256..080d17693 100644 --- a/source/games/duke/src/savegame.cpp +++ b/source/games/duke/src/savegame.cpp @@ -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; } } diff --git a/source/games/duke/src/spawn.cpp b/source/games/duke/src/spawn.cpp index 2ff8849e3..bd4a8213d 100644 --- a/source/games/duke/src/spawn.cpp +++ b/source/games/duke/src/spawn.cpp @@ -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; }