From ef6bc9db563da3c481c126eff531c73b57aa1d0a Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Fri, 26 Nov 2021 16:41:49 +0100 Subject: [PATCH] - do the remaining clipmove calls. --- source/games/sw/src/mclip.cpp | 9 +++++---- source/games/sw/src/player.cpp | 29 +++++++++++++++++++++++------ 2 files changed, 28 insertions(+), 10 deletions(-) diff --git a/source/games/sw/src/mclip.cpp b/source/games/sw/src/mclip.cpp index ac12a6d16..5198294b6 100644 --- a/source/games/sw/src/mclip.cpp +++ b/source/games/sw/src/mclip.cpp @@ -132,7 +132,7 @@ short MultiClipTurn(PLAYERp pp, short new_ang, int z, int floor_dist) int x,y; short ang; int xvect, yvect; - int cursectnum = pp->cursectnum; + auto cursect = pp->cursector(); for (i = 0; i < sop->clipbox_num; i++) { @@ -144,11 +144,12 @@ short MultiClipTurn(PLAYERp pp, short new_ang, int z, int floor_dist) yvect = sop->clipbox_vdist[i] * bsin(ang); // move the box - ret = clipmove(&pos, &cursectnum, xvect, yvect, (int)sop->clipbox_dist[i], Z(4), floor_dist, CLIPMASK_PLAYER); + Collision coll; + clipmove(pos, &cursect, xvect, yvect, (int)sop->clipbox_dist[i], Z(4), floor_dist, CLIPMASK_PLAYER, coll); - ASSERT(cursectnum >= 0); + ASSERT(cursect); - if (ret) + if (coll.type != kHitNone) { // attempt to move a bit when turning against a wall //ang = NORM_ANGLE(ang + 1024); diff --git a/source/games/sw/src/player.cpp b/source/games/sw/src/player.cpp index afa1c8f02..8fbfd2a05 100644 --- a/source/games/sw/src/player.cpp +++ b/source/games/sw/src/player.cpp @@ -1943,7 +1943,12 @@ void DoPlayerSlide(PLAYERp pp) } return; } - clipmove(&pp->pos, &pp->cursectnum, pp->slide_xvect, pp->slide_yvect, ((int)sp->clipdist<<2), pp->ceiling_dist, pp->floor_dist, CLIPMASK_PLAYER); + Collision coll; +#pragma message(__FILE__ "remove workaround"); + sectortype* cursect = pp->cursector(); + clipmove(pp->pos, &cursect, pp->slide_xvect, pp->slide_yvect, ((int)sp->clipdist<<2), pp->ceiling_dist, pp->floor_dist, CLIPMASK_PLAYER, coll); + pp->setcursector(cursect); + PlayerCheckValidMove(pp); push_ret = pushmove(&pp->pos, &pp->cursectnum, ((int)sp->clipdist<<2), pp->ceiling_dist, pp->floor_dist, CLIPMASK_PLAYER); if (push_ret < 0) @@ -2115,8 +2120,13 @@ void DoPlayerMove(PLAYERp pp) save_cstat = sp->cstat; RESET(sp->cstat, CSTAT_SPRITE_BLOCK); - updatesector(pp->posx, pp->posy, &pp->cursectnum); - clipmove(&pp->pos, &pp->cursectnum, pp->xvect, pp->yvect, ((int)sp->clipdist<<2), pp->ceiling_dist, pp->floor_dist, CLIPMASK_PLAYER); + Collision coll; +#pragma message(__FILE__ "remove workaround"); + sectortype* cursect = pp->cursector(); + updatesector(pp->posx, pp->posy, &cursect); + clipmove(pp->pos, &cursect, pp->xvect, pp->yvect, ((int)sp->clipdist<<2), pp->ceiling_dist, pp->floor_dist, CLIPMASK_PLAYER, coll); + pp->setcursector(cursect); + sp->cstat = save_cstat; PlayerCheckValidMove(pp); @@ -2715,8 +2725,10 @@ void DoPlayerMoveVehicle(PLAYERp pp) if (pp->sop->clipdist) { vec3_t clippos = { pp->posx, pp->posy, z }; - int cm= clipmove(&clippos, &pp->cursectnum, pp->xvect, pp->yvect, (int)pp->sop->clipdist, Z(4), floor_dist, CLIPMASK_PLAYER); - u->coll.setFromEngine(cm); + Collision coll; +#pragma message(__FILE__ "remove workaround"); + sectortype* cursect = pp->cursector(); + clipmove(clippos, &cursect, pp->xvect, pp->yvect, (int)pp->sop->clipdist, Z(4), floor_dist, CLIPMASK_PLAYER, u->coll); pp->pos.vec2 = clippos.vec2; } else @@ -4651,7 +4663,12 @@ void DoPlayerCurrent(PLAYERp pp) } return; } - clipmove(&pp->pos, &pp->cursectnum, xvect, yvect, ((int)pp->Actor()->s().clipdist<<2), pp->ceiling_dist, pp->floor_dist, CLIPMASK_PLAYER); + Collision coll; +#pragma message(__FILE__ "remove workaround"); + sectortype* cursect = pp->cursector(); + clipmove(pp->pos, &cursect, xvect, yvect, ((int)pp->Actor()->s().clipdist<<2), pp->ceiling_dist, pp->floor_dist, CLIPMASK_PLAYER, coll); + pp->setcursector(cursect); + PlayerCheckValidMove(pp); pushmove(&pp->pos, &pp->cursectnum, ((int)pp->Actor()->s().clipdist<<2), pp->ceiling_dist, pp->floor_dist, CLIPMASK_PLAYER); if (push_ret < 0)