- sector references in remote, some cursectnum replacements.

This commit is contained in:
Christoph Oelckers 2021-11-25 19:29:59 +01:00
parent 104e80e34a
commit 33d2d80c42
6 changed files with 16 additions and 17 deletions

View file

@ -722,7 +722,8 @@ typedef void (*PLAYER_ACTION_FUNCp)(PLAYERp);
typedef struct typedef struct
{ {
int cursectnum,lastcursectnum,pang; sectortype* cursectp, * lastcursectp;
int pang;
int xvect,yvect,oxvect,oyvect,slide_xvect,slide_yvect; int xvect,yvect,oxvect,oyvect,slide_xvect,slide_yvect;
int posx,posy,posz; int posx,posy,posz;
SECTOR_OBJECTp sop_control; SECTOR_OBJECTp sop_control;

View file

@ -159,7 +159,7 @@ short MultiClipTurn(PLAYERp pp, short new_ang, int z, int floor_dist)
return true; 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; 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++) 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; *point_num = i;
@ -178,8 +178,8 @@ int testquadinsect(int *point_num, vec2_t const * q, short sectnum)
for (i=0; i<4; i++) for (i=0; i<4; i++)
{ {
next_i = (i+1) & 3; next_i = (i+1) & 3;
if (!cansee(q[i].x, q[i].y,0x3fffffff, sectnum, if (!cansee(q[i].x, q[i].y,0x3fffffff, sect,
q[next_i].x, q[next_i].y,0x3fffffff, sectnum)) q[next_i].x, q[next_i].y,0x3fffffff, sect))
{ {
return false; return false;
} }
@ -203,7 +203,7 @@ int RectClipMove(PLAYERp pp, int *qx, int *qy)
} }
//Given the 4 points: x[4], y[4] //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->posx += (pp->xvect>>14);
pp->posy += (pp->yvect>>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].x = qx[i] - (pp->yvect>>15);
xy[i].y = qy[i] + (pp->xvect>>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->posx -= (pp->yvect>>15);
pp->posy += (pp->xvect>>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].x = qx[i] + (pp->yvect>>15);
xy[i].y = qy[i] - (pp->xvect>>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->posx += (pp->yvect>>15);
pp->posy -= (pp->xvect>>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] //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 // move to new pos
for (i = 0; i < 4; i++) for (i = 0; i < 4; i++)

View file

@ -29,7 +29,6 @@ BEGIN_SW_NS
int MultiClipMove(PLAYERp pp, int z, int floor_dist); int MultiClipMove(PLAYERp pp, int z, int floor_dist);
short MultiClipTurn(PLAYERp pp, short new_ang, 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 RectClipMove(PLAYERp pp, int *qx, int *qy);
int testpointinquad(int x, int y, 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); //short RectClipTurn(PLAYERp pp, short new_ang, int z, int floor_dist, int *qx, int *qy);

View file

@ -5137,8 +5137,8 @@ void DoPlayerBeginRemoteOperate(PLAYERp pp, SECTOR_OBJECTp sop)
void PlayerToRemote(PLAYERp pp) void PlayerToRemote(PLAYERp pp)
{ {
pp->remote.cursectnum = pp->cursectnum; pp->remote.cursectp = pp->cursector();
pp->remote.lastcursectnum = pp->lastcursectnum; pp->remote.lastcursectp = pp->lastcursector();
pp->remote.posx = pp->posx; pp->remote.posx = pp->posx;
pp->remote.posy = pp->posy; pp->remote.posy = pp->posy;
@ -5154,8 +5154,8 @@ void PlayerToRemote(PLAYERp pp)
void RemoteToPlayer(PLAYERp pp) void RemoteToPlayer(PLAYERp pp)
{ {
pp->cursectnum = pp->remote.cursectnum; pp->setcursector(pp->remote.cursectp);
pp->lastcursectnum = pp->remote.lastcursectnum; pp->lastcursectnum = sectnum(pp->remote.lastcursectp);
pp->posx = pp->remote.posx; pp->posx = pp->remote.posx;
pp->posy = pp->remote.posy; pp->posy = pp->remote.posy;

View file

@ -389,8 +389,8 @@ FSerializer& Serialize(FSerializer& arc, const char* keyname, REMOTE_CONTROL& w,
if (arc.BeginObject(keyname)) if (arc.BeginObject(keyname))
{ {
arc("cursectnum", w.cursectnum) arc("cursectnum", w.cursectp)
("lastcursectnum", w.lastcursectnum) ("lastcursectnum", w.lastcursectp)
("pang", w.pang) ("pang", w.pang)
("xvect", w.xvect) ("xvect", w.xvect)
("yvect", w.yvect) ("yvect", w.yvect)

View file

@ -42,7 +42,6 @@ void PlayerOperateEnv(PLAYERp pp);
int TeleportToSector(PLAYERp pp, int newsector); int TeleportToSector(PLAYERp pp, int newsector);
int OperateSector(sectortype* sect,short player_is_operating); int OperateSector(sectortype* sect,short player_is_operating);
int OperateSprite(DSWActor*, short player_is_operating); int OperateSprite(DSWActor*, short player_is_operating);
int OperateWall(short wallnum, short player_is_operating);
void OperateTripTrigger(PLAYERp pp); void OperateTripTrigger(PLAYERp pp);
enum SO_SCALE_TYPE enum SO_SCALE_TYPE