diff --git a/source/games/sw/src/game.h b/source/games/sw/src/game.h index 105879f2b..8349f8bff 100644 --- a/source/games/sw/src/game.h +++ b/source/games/sw/src/game.h @@ -722,7 +722,8 @@ typedef void (*PLAYER_ACTION_FUNCp)(PLAYERp); typedef struct { - int cursectnum,lastcursectnum,pang; + sectortype* cursectp, * lastcursectp; + int pang; int xvect,yvect,oxvect,oyvect,slide_xvect,slide_yvect; int posx,posy,posz; SECTOR_OBJECTp sop_control; diff --git a/source/games/sw/src/mclip.cpp b/source/games/sw/src/mclip.cpp index ebefb9f00..192475b8f 100644 --- a/source/games/sw/src/mclip.cpp +++ b/source/games/sw/src/mclip.cpp @@ -159,7 +159,7 @@ short MultiClipTurn(PLAYERp pp, short new_ang, int z, int floor_dist) return true; } -int testquadinsect(int *point_num, vec2_t const * q, short sectnum) +int testquadinsect(int *point_num, vec2_t const * q, sectortype* sect) { int i,next_i; @@ -167,7 +167,7 @@ int testquadinsect(int *point_num, vec2_t const * q, short sectnum) for (i=0; i < 4; i++) { - if (!inside(q[i].x, q[i].y, sectnum)) + if (!inside(q[i].x, q[i].y, sect)) { *point_num = i; @@ -178,8 +178,8 @@ int testquadinsect(int *point_num, vec2_t const * q, short sectnum) for (i=0; i<4; i++) { next_i = (i+1) & 3; - if (!cansee(q[i].x, q[i].y,0x3fffffff, sectnum, - q[next_i].x, q[next_i].y,0x3fffffff, sectnum)) + if (!cansee(q[i].x, q[i].y,0x3fffffff, sect, + q[next_i].x, q[next_i].y,0x3fffffff, sect)) { return false; } @@ -203,7 +203,7 @@ int RectClipMove(PLAYERp pp, int *qx, int *qy) } //Given the 4 points: x[4], y[4] - if (testquadinsect(&point_num, xy, pp->cursectnum)) + if (testquadinsect(&point_num, xy, pp->cursector())) { pp->posx += (pp->xvect>>14); pp->posy += (pp->yvect>>14); @@ -220,7 +220,7 @@ int RectClipMove(PLAYERp pp, int *qx, int *qy) xy[i].x = qx[i] - (pp->yvect>>15); xy[i].y = qy[i] + (pp->xvect>>15); } - if (testquadinsect(&point_num, xy, pp->cursectnum)) + if (testquadinsect(&point_num, xy, pp->cursector())) { pp->posx -= (pp->yvect>>15); pp->posy += (pp->xvect>>15); @@ -236,7 +236,7 @@ int RectClipMove(PLAYERp pp, int *qx, int *qy) xy[i].x = qx[i] + (pp->yvect>>15); xy[i].y = qy[i] - (pp->xvect>>15); } - if (testquadinsect(&point_num, xy, pp->cursectnum)) + if (testquadinsect(&point_num, xy, pp->cursector())) { pp->posx += (pp->yvect>>15); pp->posy -= (pp->xvect>>15); @@ -287,7 +287,7 @@ short RectClipTurn(PLAYERp pp, short new_ang, int *qx, int *qy, int *ox, int *oy } //Given the 4 points: x[4], y[4] - if (testquadinsect(&point_num, xy, pp->cursectnum)) + if (testquadinsect(&point_num, xy, pp->cursector())) { // move to new pos for (i = 0; i < 4; i++) diff --git a/source/games/sw/src/mclip.h b/source/games/sw/src/mclip.h index ca47b7c87..5124f74a8 100644 --- a/source/games/sw/src/mclip.h +++ b/source/games/sw/src/mclip.h @@ -29,7 +29,6 @@ BEGIN_SW_NS int MultiClipMove(PLAYERp pp, int z, int floor_dist); short MultiClipTurn(PLAYERp pp, short new_ang, int z, int floor_dist); -int testquadinsect(int *point_num, vec2_t const * q, short sectnum); int RectClipMove(PLAYERp pp, int *qx, int *qy); int testpointinquad(int x, int y, int *qx, int *qy); //short RectClipTurn(PLAYERp pp, short new_ang, int z, int floor_dist, int *qx, int *qy); diff --git a/source/games/sw/src/player.cpp b/source/games/sw/src/player.cpp index 60d752a46..6c91e6e6f 100644 --- a/source/games/sw/src/player.cpp +++ b/source/games/sw/src/player.cpp @@ -5137,8 +5137,8 @@ void DoPlayerBeginRemoteOperate(PLAYERp pp, SECTOR_OBJECTp sop) void PlayerToRemote(PLAYERp pp) { - pp->remote.cursectnum = pp->cursectnum; - pp->remote.lastcursectnum = pp->lastcursectnum; + pp->remote.cursectp = pp->cursector(); + pp->remote.lastcursectp = pp->lastcursector(); pp->remote.posx = pp->posx; pp->remote.posy = pp->posy; @@ -5154,8 +5154,8 @@ void PlayerToRemote(PLAYERp pp) void RemoteToPlayer(PLAYERp pp) { - pp->cursectnum = pp->remote.cursectnum; - pp->lastcursectnum = pp->remote.lastcursectnum; + pp->setcursector(pp->remote.cursectp); + pp->lastcursectnum = sectnum(pp->remote.lastcursectp); pp->posx = pp->remote.posx; pp->posy = pp->remote.posy; diff --git a/source/games/sw/src/save.cpp b/source/games/sw/src/save.cpp index b5eb55262..3d62b8cbd 100644 --- a/source/games/sw/src/save.cpp +++ b/source/games/sw/src/save.cpp @@ -389,8 +389,8 @@ FSerializer& Serialize(FSerializer& arc, const char* keyname, REMOTE_CONTROL& w, if (arc.BeginObject(keyname)) { - arc("cursectnum", w.cursectnum) - ("lastcursectnum", w.lastcursectnum) + arc("cursectnum", w.cursectp) + ("lastcursectnum", w.lastcursectp) ("pang", w.pang) ("xvect", w.xvect) ("yvect", w.yvect) diff --git a/source/games/sw/src/sector.h b/source/games/sw/src/sector.h index a1cb3f585..339432527 100644 --- a/source/games/sw/src/sector.h +++ b/source/games/sw/src/sector.h @@ -42,7 +42,6 @@ void PlayerOperateEnv(PLAYERp pp); int TeleportToSector(PLAYERp pp, int newsector); int OperateSector(sectortype* sect,short player_is_operating); int OperateSprite(DSWActor*, short player_is_operating); -int OperateWall(short wallnum, short player_is_operating); void OperateTripTrigger(PLAYERp pp); enum SO_SCALE_TYPE