From fcbf861ad4a6673234795b871769e5b8c515102d Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Sun, 21 Nov 2021 08:50:04 +0100 Subject: [PATCH] - final preparations for changing type of cursectnum --- source/core/secrets.h | 1 + source/games/duke/src/actors.cpp | 4 ++-- source/games/duke/src/animatesprites_d.cpp | 2 ++ source/games/duke/src/animatesprites_r.cpp | 2 ++ source/games/duke/src/player_d.cpp | 6 ++--- source/games/duke/src/player_r.cpp | 28 ++++++++++------------ source/games/duke/src/prediction.cpp | 2 +- source/games/duke/src/premap.cpp | 4 ++-- source/games/duke/src/types.h | 2 +- 9 files changed, 27 insertions(+), 24 deletions(-) diff --git a/source/core/secrets.h b/source/core/secrets.h index 2cf29ec9c..21a6eefa9 100644 --- a/source/core/secrets.h +++ b/source/core/secrets.h @@ -5,4 +5,5 @@ class FSerializer; void SECRET_Serialize(FSerializer &arc); void SECRET_SetMapName(const char *filename, const char *maptitle); bool SECRET_Trigger(int num); + diff --git a/source/games/duke/src/actors.cpp b/source/games/duke/src/actors.cpp index 7ad3462bf..ab9e81c57 100644 --- a/source/games/duke/src/actors.cpp +++ b/source/games/duke/src/actors.cpp @@ -2928,7 +2928,7 @@ void handle_se14(DDukeActor* actor, bool checkstat, int RPG, int JIBS6) auto psp = ps[p].GetActor(); if (ps[p].insector() && ps[p].cursector()->lotag != 2) { - if (po[p].os == s->sectnum) + if (po[p].os == s->sector()) { po[p].ox += m; po[p].oy += x; @@ -3123,7 +3123,7 @@ void handle_se30(DDukeActor *actor, int JIBS6) ps[p].bobposy += x; } - if (po[p].os == s->sectnum) + if (po[p].os == s->sector()) { po[p].ox += l; po[p].oy += x; diff --git a/source/games/duke/src/animatesprites_d.cpp b/source/games/duke/src/animatesprites_d.cpp index 4033bc1cb..b2da159b9 100644 --- a/source/games/duke/src/animatesprites_d.cpp +++ b/source/games/duke/src/animatesprites_d.cpp @@ -320,6 +320,7 @@ void animatesprites_d(spritetype* tsprite, int& spritesortcnt, int x, int y, int if (ps[p].over_shoulder_on > 0 && ps[p].newOwner == nullptr) { t->cstat |= 2; +#if 0 // multiplayer only if (screenpeek == myconnectindex && numplayers >= 2) { t->x = interpolatedvalue(omyx, myx, smoothratio); @@ -328,6 +329,7 @@ void animatesprites_d(spritetype* tsprite, int& spritesortcnt, int x, int y, int t->ang = interpolatedangle(omyang, myang, smoothratio).asbuild(); t->sectnum = mycursectnum; } +#endif } if ((display_mirror == 1 || screenpeek != p || !h->GetOwner()) && ud.multimode > 1 && cl_showweapon && ps[p].GetActor()->s->extra > 0 && ps[p].curr_weapon > 0) diff --git a/source/games/duke/src/animatesprites_r.cpp b/source/games/duke/src/animatesprites_r.cpp index 12c8fe49d..c7db8956b 100644 --- a/source/games/duke/src/animatesprites_r.cpp +++ b/source/games/duke/src/animatesprites_r.cpp @@ -361,6 +361,7 @@ void animatesprites_r(spritetype* tsprite, int& spritesortcnt, int x, int y, int if (ps[p].over_shoulder_on > 0 && ps[p].newOwner == nullptr) { t->cstat |= 2; +#if 0 // multiplayer only if (screenpeek == myconnectindex && numplayers >= 2) { t->x = interpolatedvalue(omyx, myx, smoothratio); @@ -369,6 +370,7 @@ void animatesprites_r(spritetype* tsprite, int& spritesortcnt, int x, int y, int t->ang = interpolatedangle(omyang, myang, smoothratio).asbuild(); t->sectnum = mycursectnum; } +#endif } if ((display_mirror == 1 || screenpeek != p || !h->GetOwner()) && ud.multimode > 1 && cl_showweapon && ps[p].GetActor()->s->extra > 0 && ps[p].curr_weapon > 0) diff --git a/source/games/duke/src/player_d.cpp b/source/games/duke/src/player_d.cpp index ec2b12441..06c5f0449 100644 --- a/source/games/duke/src/player_d.cpp +++ b/source/games/duke/src/player_d.cpp @@ -3070,7 +3070,7 @@ HORIZONLY: p->pos.x += p->posxv >> 14; p->pos.y += p->posyv >> 14; updatesector(p->pos.x, p->pos.y, &p->cursectnum); - changeactorsect(pact, p->cursectnum); + changeactorsect(pact, p->cursector()); } else clipmove_ex(&p->pos, &p->cursectnum, p->posxv, p->posyv, 164, (4 << 8), ii, CLIPMASK0, clip); @@ -3117,8 +3117,8 @@ HORIZONLY: if (!S_CheckActorSoundPlaying(pact, DUKE_ONWATER)) S_PlayActorSound(DUKE_ONWATER, pact); - if (p->cursectnum != s->sectnum) - changeactorsect(pact, p->cursectnum); + if (p->cursector() != s->sector()) + changeactorsect(pact, p->cursector()); if (ud.clipping == 0) j = (pushmove(&p->pos, &p->cursectnum, 164L, (4L << 8), (4L << 8), CLIPMASK0) < 0 && furthestangle(p->GetActor(), 8) < 512); diff --git a/source/games/duke/src/player_r.cpp b/source/games/duke/src/player_r.cpp index f5ce3ac40..2750ddf2c 100644 --- a/source/games/duke/src/player_r.cpp +++ b/source/games/duke/src/player_r.cpp @@ -3364,7 +3364,7 @@ void processinput_r(int snum) int i, k, doubvel, fz, cz, truefdist; Collision chz, clz; bool shrunk; - int psect, psectlotag; + int psectlotag; auto p = &ps[snum]; auto pact = p->GetActor(); @@ -3379,7 +3379,7 @@ void processinput_r(int snum) auto sb_svel = PlayerInputSideVel(snum); auto sb_avel = PlayerInputAngVel(snum); - psect = p->cursectnum; + auto psectp = p->cursector(); if (p->OnMotorcycle && s->extra > 0) { onMotorcycle(snum, actions); @@ -3388,21 +3388,20 @@ void processinput_r(int snum) { onBoat(snum, actions); } - if (psect == -1) + if (psectp == nullptr) { if (s->extra > 0 && ud.clipping == 0) { quickkill(p); S_PlayActorSound(SQUISHED, pact); } - psect = 0; + psectp = §or[0]; } - auto psectp = §or[psect]; psectlotag = psectp->lotag; if (psectlotag == 867) { - DukeSectIterator it(psect); + DukeSectIterator it(psectp); while (auto act2 = it.Next()) { if (act2->s->picnum == RRTILE380) @@ -3427,17 +3426,17 @@ void processinput_r(int snum) int tempfz; if (s->clipdist == 64) { - getzrange_ex(p->pos.x, p->pos.y, p->pos.z, psect, &cz, chz, &fz, clz, 163L, CLIPMASK0); - tempfz = getflorzofslope(psect, p->pos.x, p->pos.y); + getzrange_ex(p->pos.x, p->pos.y, p->pos.z, psectp, &cz, chz, &fz, clz, 163L, CLIPMASK0); + tempfz = getflorzofslopeptr(psectp, p->pos.x, p->pos.y); } else { - getzrange_ex(p->pos.x, p->pos.y, p->pos.z, psect, &cz, chz, &fz, clz, 4L, CLIPMASK0); - tempfz = getflorzofslope(psect, p->pos.x, p->pos.y); + getzrange_ex(p->pos.x, p->pos.y, p->pos.z, psectp, &cz, chz, &fz, clz, 4L, CLIPMASK0); + tempfz = getflorzofslopeptr(psectp, p->pos.x, p->pos.y); } p->truefz = tempfz; - p->truecz = getceilzofslope(psect, p->pos.x, p->pos.y); + p->truecz = getceilzofslopeptr(psectp, p->pos.x, p->pos.y); truefdist = abs(p->pos.z - tempfz); if (clz.type == kHitSector && psectlotag == 1 && truefdist > gs.playerheight + (16 << 8)) @@ -3812,7 +3811,7 @@ HORIZONLY: p->pos.x += p->posxv >> 14; p->pos.y += p->posyv >> 14; updatesector(p->pos.x, p->pos.y, &p->cursectnum); - changeactorsect(pact, p->cursectnum); + changeactorsect(pact, p->cursector()); } else clipmove_ex(&p->pos, &p->cursectnum, p->posxv, p->posyv, 164, (4 << 8), i, CLIPMASK0, clip); @@ -3923,7 +3922,6 @@ HORIZONLY: if (psectlotag < 3) { - psect = s->sectnum; psectp = s->sector(); if (ud.clipping == 0 && psectp->lotag == ST_31_TWO_WAY_TRAIN) { @@ -3941,8 +3939,8 @@ HORIZONLY: if (!isRRRA() || (!p->OnBoat && !p->OnMotorcycle && p->cursector()->hitag != 321)) S_PlayActorSound(DUKE_ONWATER, pact); - if (p->cursectnum != s->sectnum) - changeactorsect(pact, p->cursectnum); + if (p->cursector() != s->sector()) + changeactorsect(pact, p->cursector()); int j; if (ud.clipping == 0) diff --git a/source/games/duke/src/prediction.cpp b/source/games/duke/src/prediction.cpp index 485c3a0c8..52f3e3170 100644 --- a/source/games/duke/src/prediction.cpp +++ b/source/games/duke/src/prediction.cpp @@ -82,7 +82,7 @@ void fakedomovethingscorrect(void) myy = p->pos.y; omyy = p->oposy; myyvel = p->posyv; myz = p->pos.z; omyz = p->oposz; myzvel = p->poszv; myang = p->ang; omyang = p->oang; - mycursectnum = p->cursectnum; + mycursectnum = p->cursector; myhoriz = p->horiz; omyhoriz = p->ohoriz; myhorizoff = p->horizoff; omyhorizoff = p->ohorizoff; myjumpingcounter = p->jumping_counter; diff --git a/source/games/duke/src/premap.cpp b/source/games/duke/src/premap.cpp index 64a687206..1cb857a45 100644 --- a/source/games/duke/src/premap.cpp +++ b/source/games/duke/src/premap.cpp @@ -64,7 +64,7 @@ void pickrandomspot(int snum) p->bobposy = p->oposy = p->pos.y = po[i].oy; p->oposz = p->pos.z = po[i].oz; p->angle.oang = p->angle.ang = buildang(po[i].oa); - p->cursectnum = po[i].os; + p->setCursector(po[i].os); } @@ -588,7 +588,7 @@ void resetpspritevars(int g) po[numplayersprites].oy = s->y; po[numplayersprites].oz = s->z; po[numplayersprites].oa = s->ang; - po[numplayersprites].os = s->sectnum; + po[numplayersprites].os = s->sector(); numplayersprites++; if (j >= 0) diff --git a/source/games/duke/src/types.h b/source/games/duke/src/types.h index 1e9873386..39f0d68c5 100644 --- a/source/games/duke/src/types.h +++ b/source/games/duke/src/types.h @@ -165,7 +165,7 @@ struct player_orig { int ox, oy, oz; short oa; - int os; + sectortype* os; }; struct CraneDef