Skip to content

Commit

Permalink
- do the remaining clipmove calls.
Browse files Browse the repository at this point in the history
  • Loading branch information
coelckers committed Dec 4, 2021
1 parent dae8cf8 commit 4e41737
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 10 deletions.
9 changes: 5 additions & 4 deletions source/games/sw/src/mclip.cpp
Expand Up @@ -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++)
{
Expand All @@ -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);
Expand Down
29 changes: 23 additions & 6 deletions source/games/sw/src/player.cpp
Expand Up @@ -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)
Expand Down Expand Up @@ -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);

Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit 4e41737

Please sign in to comment.