mirror of
https://git.do.srb2.org/STJr/SRB2.git
synced 2024-11-22 04:21:23 +00:00
Merge branch 'polyobject-cleanup' into 'next'
PolyObject cleanup See merge request STJr/SRB2!919
This commit is contained in:
commit
023c095d55
4 changed files with 200 additions and 463 deletions
|
@ -760,6 +760,7 @@ linedeftypes
|
|||
{
|
||||
title = "Parameters";
|
||||
prefix = "(22)";
|
||||
flags8text = "[3] Set translucency by X offset";
|
||||
flags32text = "[5] Render outer sides only";
|
||||
flags64text = "[6] Trigger linedef executor";
|
||||
flags128text = "[7] Intangible";
|
||||
|
|
519
src/p_polyobj.c
519
src/p_polyobj.c
File diff suppressed because it is too large
Load diff
|
@ -29,7 +29,6 @@
|
|||
#define POLYOBJ_SPAWNCRUSH_DOOMEDNUM 762 // todo: REMOVE
|
||||
|
||||
#define POLYOBJ_START_LINE 20
|
||||
#define POLYOBJ_EXPLICIT_LINE 21
|
||||
#define POLYINFO_SPECIALNUM 22
|
||||
|
||||
typedef enum
|
||||
|
@ -299,6 +298,14 @@ typedef struct polyrotdisplacedata_s
|
|||
UINT8 turnobjs;
|
||||
} polyrotdisplacedata_t;
|
||||
|
||||
typedef struct polyflagdata_s
|
||||
{
|
||||
INT32 polyObjNum;
|
||||
INT32 speed;
|
||||
UINT32 angle;
|
||||
fixed_t momx;
|
||||
} polyflagdata_t;
|
||||
|
||||
typedef struct polyfadedata_s
|
||||
{
|
||||
INT32 polyObjNum;
|
||||
|
@ -320,7 +327,6 @@ boolean P_PointInsidePolyobj(polyobj_t *po, fixed_t x, fixed_t y);
|
|||
boolean P_MobjTouchingPolyobj(polyobj_t *po, mobj_t *mo);
|
||||
boolean P_MobjInsidePolyobj(polyobj_t *po, mobj_t *mo);
|
||||
boolean P_BBoxInsidePolyobj(polyobj_t *po, fixed_t *bbox);
|
||||
void Polyobj_GetInfo(INT16 poid, INT32 *poflags, INT32 *parentID, INT32 *potrans);
|
||||
|
||||
// thinkers (needed in p_saveg.c)
|
||||
void T_PolyObjRotate(polyrotate_t *);
|
||||
|
@ -333,14 +339,14 @@ void T_PolyObjRotDisplace (polyrotdisplace_t *);
|
|||
void T_PolyObjFlag (polymove_t *);
|
||||
void T_PolyObjFade (polyfade_t *);
|
||||
|
||||
INT32 EV_DoPolyDoor(polydoordata_t *);
|
||||
INT32 EV_DoPolyObjMove(polymovedata_t *);
|
||||
INT32 EV_DoPolyObjWaypoint(polywaypointdata_t *);
|
||||
INT32 EV_DoPolyObjRotate(polyrotdata_t *);
|
||||
INT32 EV_DoPolyObjDisplace(polydisplacedata_t *);
|
||||
INT32 EV_DoPolyObjRotDisplace(polyrotdisplacedata_t *);
|
||||
INT32 EV_DoPolyObjFlag(struct line_s *);
|
||||
INT32 EV_DoPolyObjFade(polyfadedata_t *);
|
||||
boolean EV_DoPolyDoor(polydoordata_t *);
|
||||
boolean EV_DoPolyObjMove(polymovedata_t *);
|
||||
boolean EV_DoPolyObjWaypoint(polywaypointdata_t *);
|
||||
boolean EV_DoPolyObjRotate(polyrotdata_t *);
|
||||
boolean EV_DoPolyObjDisplace(polydisplacedata_t *);
|
||||
boolean EV_DoPolyObjRotDisplace(polyrotdisplacedata_t *);
|
||||
boolean EV_DoPolyObjFlag(polyflagdata_t *);
|
||||
boolean EV_DoPolyObjFade(polyfadedata_t *);
|
||||
|
||||
|
||||
//
|
||||
|
|
117
src/p_spec.c
117
src/p_spec.c
|
@ -1044,9 +1044,6 @@ static INT32 P_FindLineFromTag(INT32 tag, INT32 start)
|
|||
}
|
||||
}
|
||||
|
||||
//
|
||||
// P_FindSpecialLineFromTag
|
||||
//
|
||||
INT32 P_FindSpecialLineFromTag(INT16 special, INT16 tag, INT32 start)
|
||||
{
|
||||
if (tag == -1)
|
||||
|
@ -1076,11 +1073,8 @@ INT32 P_FindSpecialLineFromTag(INT16 special, INT16 tag, INT32 start)
|
|||
}
|
||||
}
|
||||
|
||||
//
|
||||
// PolyDoor
|
||||
//
|
||||
|
||||
// Parses arguments for parameterized polyobject door types
|
||||
//
|
||||
static boolean PolyDoor(line_t *line)
|
||||
{
|
||||
polydoordata_t pdd;
|
||||
|
@ -1117,11 +1111,7 @@ static boolean PolyDoor(line_t *line)
|
|||
return EV_DoPolyDoor(&pdd);
|
||||
}
|
||||
|
||||
//
|
||||
// PolyMove
|
||||
//
|
||||
// Parses arguments for parameterized polyobject move specials
|
||||
//
|
||||
static boolean PolyMove(line_t *line)
|
||||
{
|
||||
polymovedata_t pmd;
|
||||
|
@ -1136,12 +1126,8 @@ static boolean PolyMove(line_t *line)
|
|||
return EV_DoPolyObjMove(&pmd);
|
||||
}
|
||||
|
||||
//
|
||||
// PolyInvisible
|
||||
//
|
||||
// Makes a polyobject invisible and intangible
|
||||
// If NOCLIMB is ticked, the polyobject will still be tangible, just not visible.
|
||||
//
|
||||
static void PolyInvisible(line_t *line)
|
||||
{
|
||||
INT32 polyObjNum = line->tag;
|
||||
|
@ -1164,12 +1150,8 @@ static void PolyInvisible(line_t *line)
|
|||
po->flags &= ~POF_RENDERALL;
|
||||
}
|
||||
|
||||
//
|
||||
// PolyVisible
|
||||
//
|
||||
// Makes a polyobject visible and tangible
|
||||
// If NOCLIMB is ticked, the polyobject will not be tangible, just visible.
|
||||
//
|
||||
static void PolyVisible(line_t *line)
|
||||
{
|
||||
INT32 polyObjNum = line->tag;
|
||||
|
@ -1192,16 +1174,14 @@ static void PolyVisible(line_t *line)
|
|||
po->flags |= (po->spawnflags & POF_RENDERALL);
|
||||
}
|
||||
|
||||
//
|
||||
// PolyTranslucency
|
||||
//
|
||||
|
||||
// Sets the translucency of a polyobject
|
||||
// Frontsector floor / 100 = translevel
|
||||
//
|
||||
static void PolyTranslucency(line_t *line)
|
||||
{
|
||||
INT32 polyObjNum = line->tag;
|
||||
polyobj_t *po;
|
||||
INT32 value;
|
||||
|
||||
if (!(po = Polyobj_GetForNum(polyObjNum)))
|
||||
{
|
||||
|
@ -1213,37 +1193,28 @@ static void PolyTranslucency(line_t *line)
|
|||
if (po->isBad)
|
||||
return;
|
||||
|
||||
// if DONTPEGBOTTOM, specify raw translucency value in Front X Offset
|
||||
// else, take it out of 1000. If Front X Offset is specified, use that. Else, use floorheight.
|
||||
// If Front X Offset is specified, use that. Else, use floorheight.
|
||||
value = (sides[line->sidenum[0]].textureoffset ? sides[line->sidenum[0]].textureoffset : line->frontsector->floorheight) >> FRACBITS;
|
||||
|
||||
// If DONTPEGBOTTOM, specify raw translucency value. Else, take it out of 1000.
|
||||
if (!(line->flags & ML_DONTPEGBOTTOM))
|
||||
value /= 100;
|
||||
|
||||
if (line->flags & ML_EFFECT3) // relative calc
|
||||
po->translucency = max(min(po->translucency + ((line->flags & ML_DONTPEGBOTTOM) ?
|
||||
(sides[line->sidenum[0]].textureoffset ?
|
||||
max(min(sides[line->sidenum[0]].textureoffset>>FRACBITS, NUMTRANSMAPS), -NUMTRANSMAPS)
|
||||
: max(min(line->frontsector->floorheight>>FRACBITS, NUMTRANSMAPS), -NUMTRANSMAPS))
|
||||
: (sides[line->sidenum[0]].textureoffset ?
|
||||
max(min(sides[line->sidenum[0]].textureoffset>>FRACBITS, 1000), -1000) / 100
|
||||
: max(min(line->frontsector->floorheight>>FRACBITS, 1000), -1000) / 100)),
|
||||
NUMTRANSMAPS), 0);
|
||||
po->translucency += value;
|
||||
else
|
||||
po->translucency = (line->flags & ML_DONTPEGBOTTOM) ?
|
||||
(sides[line->sidenum[0]].textureoffset ?
|
||||
max(min(sides[line->sidenum[0]].textureoffset>>FRACBITS, NUMTRANSMAPS), 0)
|
||||
: max(min(line->frontsector->floorheight>>FRACBITS, NUMTRANSMAPS), 0))
|
||||
: (sides[line->sidenum[0]].textureoffset ?
|
||||
max(min(sides[line->sidenum[0]].textureoffset>>FRACBITS, 1000), 0) / 100
|
||||
: max(min(line->frontsector->floorheight>>FRACBITS, 1000), 0) / 100);
|
||||
po->translucency = value;
|
||||
|
||||
po->translucency = max(min(po->translucency, NUMTRANSMAPS), 0);
|
||||
}
|
||||
|
||||
//
|
||||
// PolyFade
|
||||
//
|
||||
// Makes a polyobject translucency fade and applies tangibility
|
||||
//
|
||||
static boolean PolyFade(line_t *line)
|
||||
{
|
||||
INT32 polyObjNum = line->tag;
|
||||
polyobj_t *po;
|
||||
polyfadedata_t pfd;
|
||||
INT32 value;
|
||||
|
||||
if (!(po = Polyobj_GetForNum(polyObjNum)))
|
||||
{
|
||||
|
@ -1266,25 +1237,19 @@ static boolean PolyFade(line_t *line)
|
|||
|
||||
pfd.polyObjNum = polyObjNum;
|
||||
|
||||
// if DONTPEGBOTTOM, specify raw translucency value in Front X Offset
|
||||
// else, take it out of 1000. If Front X Offset is specified, use that. Else, use floorheight.
|
||||
// If Front X Offset is specified, use that. Else, use floorheight.
|
||||
value = (sides[line->sidenum[0]].textureoffset ? sides[line->sidenum[0]].textureoffset : line->frontsector->floorheight) >> FRACBITS;
|
||||
|
||||
// If DONTPEGBOTTOM, specify raw translucency value. Else, take it out of 1000.
|
||||
if (!(line->flags & ML_DONTPEGBOTTOM))
|
||||
value /= 100;
|
||||
|
||||
if (line->flags & ML_EFFECT3) // relative calc
|
||||
pfd.destvalue = max(min(po->translucency + ((line->flags & ML_DONTPEGBOTTOM) ?
|
||||
(sides[line->sidenum[0]].textureoffset ?
|
||||
max(min(sides[line->sidenum[0]].textureoffset>>FRACBITS, NUMTRANSMAPS), -NUMTRANSMAPS)
|
||||
: max(min(line->frontsector->floorheight>>FRACBITS, NUMTRANSMAPS), -NUMTRANSMAPS))
|
||||
: (sides[line->sidenum[0]].textureoffset ?
|
||||
max(min(sides[line->sidenum[0]].textureoffset>>FRACBITS, 1000), -1000) / 100
|
||||
: max(min(line->frontsector->floorheight>>FRACBITS, 1000), -1000) / 100)),
|
||||
NUMTRANSMAPS), 0);
|
||||
pfd.destvalue = po->translucency + value;
|
||||
else
|
||||
pfd.destvalue = (line->flags & ML_DONTPEGBOTTOM) ?
|
||||
(sides[line->sidenum[0]].textureoffset ?
|
||||
max(min(sides[line->sidenum[0]].textureoffset>>FRACBITS, NUMTRANSMAPS), 0)
|
||||
: max(min(line->frontsector->floorheight>>FRACBITS, NUMTRANSMAPS), 0))
|
||||
: (sides[line->sidenum[0]].textureoffset ?
|
||||
max(min(sides[line->sidenum[0]].textureoffset>>FRACBITS, 1000), 0) / 100
|
||||
: max(min(line->frontsector->floorheight>>FRACBITS, 1000), 0) / 100);
|
||||
pfd.destvalue = value;
|
||||
|
||||
pfd.destvalue = max(min(pfd.destvalue, NUMTRANSMAPS), 0);
|
||||
|
||||
// already equal, nothing to do
|
||||
if (po->translucency == pfd.destvalue)
|
||||
|
@ -1303,11 +1268,7 @@ static boolean PolyFade(line_t *line)
|
|||
return EV_DoPolyObjFade(&pfd);
|
||||
}
|
||||
|
||||
//
|
||||
// PolyWaypoint
|
||||
//
|
||||
// Parses arguments for parameterized polyobject waypoint movement
|
||||
//
|
||||
static boolean PolyWaypoint(line_t *line)
|
||||
{
|
||||
polywaypointdata_t pwd;
|
||||
|
@ -1323,11 +1284,7 @@ static boolean PolyWaypoint(line_t *line)
|
|||
return EV_DoPolyObjWaypoint(&pwd);
|
||||
}
|
||||
|
||||
//
|
||||
// PolyRotate
|
||||
//
|
||||
// Parses arguments for parameterized polyobject rotate specials
|
||||
//
|
||||
static boolean PolyRotate(line_t *line)
|
||||
{
|
||||
polyrotdata_t prd;
|
||||
|
@ -1352,11 +1309,20 @@ static boolean PolyRotate(line_t *line)
|
|||
return EV_DoPolyObjRotate(&prd);
|
||||
}
|
||||
|
||||
//
|
||||
// PolyDisplace
|
||||
//
|
||||
// Parses arguments for polyobject flag waving special
|
||||
static boolean PolyFlag(line_t *line)
|
||||
{
|
||||
polyflagdata_t pfd;
|
||||
|
||||
pfd.polyObjNum = line->tag;
|
||||
pfd.speed = P_AproxDistance(line->dx, line->dy) >> FRACBITS;
|
||||
pfd.angle = R_PointToAngle2(line->v1->x, line->v1->y, line->v2->x, line->v2->y) >> ANGLETOFINESHIFT;
|
||||
pfd.momx = sides[line->sidenum[0]].textureoffset >> FRACBITS;
|
||||
|
||||
return EV_DoPolyObjFlag(&pfd);
|
||||
}
|
||||
|
||||
// Parses arguments for parameterized polyobject move-by-sector-heights specials
|
||||
//
|
||||
static boolean PolyDisplace(line_t *line)
|
||||
{
|
||||
polydisplacedata_t pdd;
|
||||
|
@ -1371,8 +1337,7 @@ static boolean PolyDisplace(line_t *line)
|
|||
}
|
||||
|
||||
|
||||
/** Similar to PolyDisplace().
|
||||
*/
|
||||
// Parses arguments for parameterized polyobject rotate-by-sector-heights specials
|
||||
static boolean PolyRotDisplace(line_t *line)
|
||||
{
|
||||
polyrotdisplacedata_t pdd;
|
||||
|
@ -7323,7 +7288,7 @@ void P_SpawnSpecials(boolean fromnetsave)
|
|||
switch (lines[i].special)
|
||||
{
|
||||
case 30: // Polyobj_Flag
|
||||
EV_DoPolyObjFlag(&lines[i]);
|
||||
PolyFlag(&lines[i]);
|
||||
break;
|
||||
|
||||
case 31: // Polyobj_Displace
|
||||
|
|
Loading…
Reference in a new issue