From 270a443c88f5ad8e9a40686d0fcd83ece2b9675d Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Wed, 24 Nov 2021 23:54:37 +0100 Subject: [PATCH] - hitinfo.hitsect is gone. --- source/games/sw/src/draw.cpp | 20 ++++++++++---------- source/games/sw/src/swactor.h | 5 +---- 2 files changed, 11 insertions(+), 14 deletions(-) diff --git a/source/games/sw/src/draw.cpp b/source/games/sw/src/draw.cpp index 600bbf190..3db7bbcfc 100644 --- a/source/games/sw/src/draw.cpp +++ b/source/games/sw/src/draw.cpp @@ -904,7 +904,7 @@ post_analyzesprites(spritetype* tsprite, int& spritesortcnt) #endif void -CircleCamera(int *nx, int *ny, int *nz, int *vsect, binangle *nang, fixed_t q16horiz) +CircleCamera(int *nx, int *ny, int *nz, sectortype** vsect, binangle *nang, fixed_t q16horiz) { vec3_t n = { *nx, *ny, *nz }; SPRITEp sp; @@ -935,7 +935,7 @@ CircleCamera(int *nx, int *ny, int *nz, int *vsect, binangle *nang, fixed_t q16h // Make sure sector passed to hitscan is correct //updatesector(*nx, *ny, vsect); - hitscan(&n, *vsect, vx, vy, vz, &hit_info, CLIPMASK_MISSILE); + hitscan(&n, sectnum(*vsect), vx, vy, vz, &hit_info, CLIPMASK_MISSILE); HITINFO hitinfo; hitinfo.set(&hit_info); sp->cstat = bakcstat; // Restore cstat @@ -949,7 +949,7 @@ CircleCamera(int *nx, int *ny, int *nz, int *vsect, binangle *nang, fixed_t q16h { if (hitinfo.wall()) // Push you a little bit off the wall { - *vsect = hitinfo.hitsect; + *vsect = hitinfo.sector(); daang = getangle(hitinfo.wall()->delta()); @@ -961,7 +961,7 @@ CircleCamera(int *nx, int *ny, int *nz, int *vsect, binangle *nang, fixed_t q16h } else if (hitinfo.hitactor == nullptr) // Push you off the ceiling/floor { - *vsect = hitinfo.hitsect; + *vsect = hitinfo.sector(); if (abs(vx) > abs(vy)) hx -= (vx >> 5); @@ -1077,7 +1077,7 @@ void DrawCrosshair(PLAYERp pp) } } -void CameraView(PLAYERp pp, int *tx, int *ty, int *tz, int *tsectnum, binangle *tang, fixedhoriz *thoriz) +void CameraView(PLAYERp pp, int *tx, int *ty, int *tz, sectortype** tsect, binangle *tang, fixedhoriz *thoriz) { binangle ang; SPRITEp sp; @@ -1118,7 +1118,7 @@ void CameraView(PLAYERp pp, int *tx, int *ty, int *tz, int *tsectnum, binangle * { case 1: pp->last_camera_sp = sp; - CircleCamera(tx, ty, tz, tsectnum, tang, 0); + CircleCamera(tx, ty, tz, tsect, tang, 0); found_camera = true; break; @@ -1153,7 +1153,7 @@ void CameraView(PLAYERp pp, int *tx, int *ty, int *tz, int *tsectnum, binangle * *tx = sp->x; *ty = sp->y; *tz = sp->z; - *tsectnum = sp->sectnum; + *tsect = sp->sector(); found_camera = true; break; @@ -1537,17 +1537,16 @@ drawscreen(PLAYERp pp, double smoothratio) tang = bvectangbam(pp->sop_remote->xmid - tx, pp->sop_remote->ymid - ty); } + auto pSect = §or[tsectnum]; if (TEST(pp->Flags, PF_VIEW_FROM_OUTSIDE)) { tz -= 8448; - auto pSect = §or[tsectnum]; if (!calcChaseCamPos(&tx, &ty, &tz, &pp->Actor()->s(), &pSect, tang, thoriz, smoothratio)) { tz += 8448; calcChaseCamPos(&tx, &ty, &tz, &pp->Actor()->s(), &pSect, tang, thoriz, smoothratio); } - tsectnum = sectnum(pSect); } else { @@ -1555,9 +1554,10 @@ drawscreen(PLAYERp pp, double smoothratio) if (CameraTestMode) { - CameraView(camerapp, &tx, &ty, &tz, &tsectnum, &tang, &thoriz); + CameraView(camerapp, &tx, &ty, &tz, &pSect, &tang, &thoriz); } } + tsectnum = sectnum(pSect); if (!TEST(pp->Flags, PF_VIEW_FROM_CAMERA|PF_VIEW_FROM_OUTSIDE)) { diff --git a/source/games/sw/src/swactor.h b/source/games/sw/src/swactor.h index 682c76774..028d16b8d 100644 --- a/source/games/sw/src/swactor.h +++ b/source/games/sw/src/swactor.h @@ -201,7 +201,6 @@ inline int Collision::setFromEngine(int value) struct HITINFO { DSWActor* hitactor; sectortype* hitSector; - int hitsect; int hitwall; short hitsprite; vec3_t pos; @@ -209,14 +208,13 @@ struct HITINFO { void clearObj() { pos = {}; - hitsect = hitwall = -1; + hitwall = -1; hitsprite = -1; hitactor = nullptr; hitSector = nullptr; } void set(hitdata_t* hit) { - hitsect = hit->sect; hitSector = &::sector[hit->sect]; hitwall = hit->wall; hitsprite = hit->sprite; @@ -227,7 +225,6 @@ struct HITINFO { void setSector(sectortype* sect) { hitSector = sect; - hitsect = sectnum(sect); } walltype* wall() const { return hitwall == -1? nullptr : &::wall[hitwall]; }