mirror of
https://git.do.srb2.org/STJr/SRB2.git
synced 2025-01-30 21:20:54 +00:00
Added new functionality, reorganised functionality from last commit, cursed a lot. Again, more info in merge request.
This commit is contained in:
parent
7a1b309653
commit
a8248fb6c9
1 changed files with 44 additions and 36 deletions
58
src/p_spec.c
58
src/p_spec.c
|
@ -51,6 +51,9 @@ mobj_t *skyboxmo[2];
|
||||||
// Amount (dx, dy) vector linedef is shifted right to get scroll amount
|
// Amount (dx, dy) vector linedef is shifted right to get scroll amount
|
||||||
#define SCROLL_SHIFT 5
|
#define SCROLL_SHIFT 5
|
||||||
|
|
||||||
|
// This must be updated whenever we up the max flat size - quicker to assume rather than figuring out the sqrt of the specific flat's filesize.
|
||||||
|
#define MAXFLATSIZE (2048<<FRACBITS)
|
||||||
|
|
||||||
/** Animated texture descriptor
|
/** Animated texture descriptor
|
||||||
* This keeps track of an animated texture or an animated flat.
|
* This keeps track of an animated texture or an animated flat.
|
||||||
* \sa P_UpdateSpecials, P_InitPicAnims, animdef_t
|
* \sa P_UpdateSpecials, P_InitPicAnims, animdef_t
|
||||||
|
@ -5488,6 +5491,8 @@ void P_SpawnSpecials(INT32 fromnetsave)
|
||||||
|
|
||||||
// Init line EFFECTs
|
// Init line EFFECTs
|
||||||
for (i = 0; i < numlines; i++)
|
for (i = 0; i < numlines; i++)
|
||||||
|
{
|
||||||
|
if (lines[i].special != 7) // This is a hack. I can at least hope nobody wants to prevent flat alignment with arbitrary skin setups...
|
||||||
{
|
{
|
||||||
// set line specials to 0 here too, same reason as above
|
// set line specials to 0 here too, same reason as above
|
||||||
if (netgame || multiplayer)
|
if (netgame || multiplayer)
|
||||||
|
@ -5501,20 +5506,13 @@ void P_SpawnSpecials(INT32 fromnetsave)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (players[consoleplayer].charability == CA_THOK && (lines[i].flags & ML_NOSONIC))
|
if ((players[consoleplayer].charability == CA_THOK && (lines[i].flags & ML_NOSONIC))
|
||||||
|
|| (players[consoleplayer].charability == CA_FLY && (lines[i].flags & ML_NOTAILS))
|
||||||
|
|| (players[consoleplayer].charability == CA_GLIDEANDCLIMB && (lines[i].flags & ML_NOKNUX)))
|
||||||
{
|
{
|
||||||
lines[i].special = 0;
|
lines[i].special = 0;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (players[consoleplayer].charability == CA_FLY && (lines[i].flags & ML_NOTAILS))
|
|
||||||
{
|
|
||||||
lines[i].special = 0;
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
if (players[consoleplayer].charability == CA_GLIDEANDCLIMB && (lines[i].flags & ML_NOKNUX))
|
|
||||||
{
|
|
||||||
lines[i].special = 0;
|
|
||||||
continue;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -5560,31 +5558,43 @@ void P_SpawnSpecials(INT32 fromnetsave)
|
||||||
break;
|
break;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
case 7: // Flat alignment
|
case 7: // Flat alignment - redone by toast
|
||||||
if ((lines[i].flags & (ML_EFFECT1|ML_NOCLIMB)) != (ML_EFFECT1|ML_NOCLIMB)) // If you can do something...
|
if ((lines[i].flags & (ML_NOSONIC|ML_NOTAILS)) != (ML_NOSONIC|ML_NOTAILS)) // If you can do something...
|
||||||
{
|
{
|
||||||
line_t line = lines[i];
|
angle_t flatangle = InvAngle(R_PointToAngle2(lines[i].v1->x, lines[i].v1->y, lines[i].v2->x, lines[i].v2->y));
|
||||||
angle_t flatangle = 0;
|
fixed_t xoffs;
|
||||||
if (!(line.flags & ML_EFFECT2)) // Change flat angles unless EFFECT2 flag is set
|
fixed_t yoffs;
|
||||||
flatangle = R_PointToAngle2(line.v1->x, line.v1->y, line.v2->x, line.v2->y);
|
|
||||||
|
if (lines[i].flags & ML_NOKNUX) // Set offset through x and y texture offsets if NOKNUX flag is set
|
||||||
|
{
|
||||||
|
xoffs = sides[lines[i].sidenum[0]].textureoffset;
|
||||||
|
yoffs = sides[lines[i].sidenum[0]].rowoffset;
|
||||||
|
}
|
||||||
|
else // Otherwise, set calculated offsets such that line's v1 is the apparent origin
|
||||||
|
{
|
||||||
|
fixed_t cosinecomponent = FINECOSINE(flatangle>>ANGLETOFINESHIFT);
|
||||||
|
fixed_t sinecomponent = FINESINE(flatangle>>ANGLETOFINESHIFT);
|
||||||
|
xoffs = (-FixedMul(lines[i].v1->x, cosinecomponent) % MAXFLATSIZE) + (FixedMul(lines[i].v1->y, sinecomponent) % MAXFLATSIZE); // No danger of overflow thanks to the strategically placed modulo operations.
|
||||||
|
yoffs = (FixedMul(lines[i].v1->x, sinecomponent) % MAXFLATSIZE) + (FixedMul(lines[i].v1->y, cosinecomponent) % MAXFLATSIZE); // Ditto.
|
||||||
|
}
|
||||||
|
|
||||||
for (s = -1; (s = P_FindSectorFromLineTag(lines + i, s)) >= 0 ;)
|
for (s = -1; (s = P_FindSectorFromLineTag(lines + i, s)) >= 0 ;)
|
||||||
{
|
{
|
||||||
if (!(line.flags & ML_EFFECT1)) // Change floor flat unless EFFECT1 flag is set
|
if (!(lines[i].flags & ML_NOSONIC)) // Modify floor flat alignment unless NOSONIC flag is set
|
||||||
{
|
{
|
||||||
sectors[s].spawn_flrpic_angle = sectors[s].floorpic_angle = flatangle;
|
sectors[s].spawn_flrpic_angle = sectors[s].floorpic_angle = flatangle;
|
||||||
sectors[s].floor_xoffs += sides[line.sidenum[0]].textureoffset;
|
sectors[s].floor_xoffs += xoffs;
|
||||||
sectors[s].floor_yoffs += sides[line.sidenum[0]].rowoffset;
|
sectors[s].floor_yoffs += yoffs;
|
||||||
// saved for netgames
|
// saved for netgames
|
||||||
sectors[s].spawn_flr_xoffs = sectors[s].floor_xoffs;
|
sectors[s].spawn_flr_xoffs = sectors[s].floor_xoffs;
|
||||||
sectors[s].spawn_flr_yoffs = sectors[s].floor_yoffs;
|
sectors[s].spawn_flr_yoffs = sectors[s].floor_yoffs;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!(line.flags & ML_NOCLIMB)) // Change ceiling flat unless NOCLIMB flag is set
|
if (!(lines[i].flags & ML_NOTAILS)) // Modify ceiling flat alignment unless NOTAILS flag is set
|
||||||
{
|
{
|
||||||
sectors[s].spawn_ceilpic_angle = sectors[s].ceilingpic_angle = flatangle;
|
sectors[s].spawn_ceilpic_angle = sectors[s].ceilingpic_angle = flatangle;
|
||||||
sectors[s].ceiling_xoffs += sides[line.sidenum[0]].textureoffset;
|
sectors[s].ceiling_xoffs += xoffs;
|
||||||
sectors[s].ceiling_yoffs += sides[line.sidenum[0]].rowoffset;
|
sectors[s].ceiling_yoffs += yoffs;
|
||||||
// saved for netgames
|
// saved for netgames
|
||||||
sectors[s].spawn_ceil_xoffs = sectors[s].ceiling_xoffs;
|
sectors[s].spawn_ceil_xoffs = sectors[s].ceiling_xoffs;
|
||||||
sectors[s].spawn_ceil_yoffs = sectors[s].ceiling_yoffs;
|
sectors[s].spawn_ceil_yoffs = sectors[s].ceiling_yoffs;
|
||||||
|
@ -5592,11 +5602,9 @@ void P_SpawnSpecials(INT32 fromnetsave)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else // Otherwise, print a helpful warning. Can I do no less?
|
else // Otherwise, print a helpful warning. Can I do no less?
|
||||||
{
|
|
||||||
CONS_Alert(CONS_WARNING,
|
CONS_Alert(CONS_WARNING,
|
||||||
M_GetText("Flat alignment linedef with tag %d doesn't have anything to do.\nConsider changing the linedef's flag configuration or removing it entirely.\n"),
|
M_GetText("Flat alignment linedef (tag %d) doesn't have anything to do.\nConsider changing the linedef's flag configuration or removing it entirely.\n"),
|
||||||
lines[i].tag);
|
lines[i].tag);
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 8: // Sector Parameters
|
case 8: // Sector Parameters
|
||||||
|
|
Loading…
Reference in a new issue