polywaypointdata_t: Turn reverse and continuous into flags

This commit is contained in:
MascaraSnake 2020-05-16 09:49:30 +02:00
parent 06dda9c69d
commit 536e355cdf
3 changed files with 17 additions and 10 deletions

View File

@ -2154,11 +2154,12 @@ boolean EV_DoPolyObjWaypoint(polywaypointdata_t *pwdata)
// set fields
th->polyObjNum = pwdata->polyObjNum;
th->speed = pwdata->speed;
th->sequence = pwdata->sequence; // Used to specify sequence #
th->direction = pwdata->reverse ? -1 : 1;
th->sequence = pwdata->sequence;
th->direction = (pwdata->flags & PWF_REVERSE) ? -1 : 1;
th->returnbehavior = pwdata->returnbehavior;
th->continuous = pwdata->continuous;
if (pwdata->flags & PWF_LOOP)
th->continuous = true;
th->stophere = false;
// Find the first waypoint we need to use
@ -2172,11 +2173,8 @@ boolean EV_DoPolyObjWaypoint(polywaypointdata_t *pwdata)
return false;
}
// Set pointnum
th->pointnum = first->health;
// We don't deal with the mirror crap here, we'll
// handle that in the T_Thinker function.
return true;
}

View File

@ -254,14 +254,19 @@ typedef struct polymovedata_s
UINT8 overRide; // if true, will override any action on the object
} polymovedata_t;
typedef enum
{
PWF_REVERSE = 1, // Move through waypoints in reverse order
PWF_LOOP = 1<<1, // Loop movement (used with PWR_WRAP or PWR_COMEBACK)
} polywaypointflags_e;
typedef struct polywaypointdata_s
{
INT32 polyObjNum; // numeric id of polyobject to affect
INT32 sequence; // waypoint sequence #
fixed_t speed; // linear speed
UINT8 reverse; // if true, will go in reverse waypoint order
UINT8 returnbehavior; // behavior after reaching the last waypoint
UINT8 continuous; // continuously move - used with PWR_WRAP or PWR_COMEBACK
UINT8 flags; // PWF_ flags
} polywaypointdata_t;
// polyobject door types

View File

@ -1276,7 +1276,6 @@ static boolean PolyWaypoint(line_t *line)
pwd.polyObjNum = line->tag;
pwd.speed = sides[line->sidenum[0]].textureoffset / 8;
pwd.sequence = sides[line->sidenum[0]].rowoffset >> FRACBITS; // Sequence #
pwd.reverse = (line->flags & ML_EFFECT1) == ML_EFFECT1; // Reverse?
// Behavior after reaching the last waypoint?
if (line->flags & ML_EFFECT3)
@ -1286,7 +1285,12 @@ static boolean PolyWaypoint(line_t *line)
else
pwd.returnbehavior = PWR_STOP; // Stop
pwd.continuous = (line->flags & ML_EFFECT4) == ML_EFFECT4; // Continuously move - used with PWR_WRAP or PWR_COMEBACK
// Flags
pwd.flags = 0;
if (line->flags & ML_EFFECT1)
pwd.flags |= PWF_REVERSE;
if (line->flags & ML_EFFECT4)
pwd.flags |= PWF_LOOP;
return EV_DoPolyObjWaypoint(&pwd);
}