mirror of
https://github.com/KartKrewDev/RingRacers.git
synced 2025-10-30 08:01:28 +00:00
Merge branch 'tripwire-texture-swap' into 'master'
Tripwire texture swap See merge request kart-krew-dev/ring-racers-internal!2950
This commit is contained in:
commit
c73c02aac9
7 changed files with 71 additions and 9 deletions
|
|
@ -239,6 +239,7 @@ enum {false = 0, true = 1};
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define ATTRUNUSED __attribute__((unused))
|
#define ATTRUNUSED __attribute__((unused))
|
||||||
|
#define ATTRUNOPTIMIZE __attribute__((optimize("O0")))
|
||||||
#elif defined (_MSC_VER)
|
#elif defined (_MSC_VER)
|
||||||
#define ATTRNORETURN __declspec(noreturn)
|
#define ATTRNORETURN __declspec(noreturn)
|
||||||
#define ATTRINLINE __forceinline
|
#define ATTRINLINE __forceinline
|
||||||
|
|
|
||||||
|
|
@ -1386,8 +1386,18 @@ static void HWR_ProcessSeg(void) // Sort of like GLWall::Process in GZDoom
|
||||||
|
|
||||||
grTex = HWR_GetTexture(gl_midtexture, gl_sidedef->midtexture);
|
grTex = HWR_GetTexture(gl_midtexture, gl_sidedef->midtexture);
|
||||||
|
|
||||||
wallVerts[3].t = wallVerts[2].t = texturevpeg * grTex->scaleY;
|
// Check if we should flip tripwire texture vertically for unpegged tripwires
|
||||||
wallVerts[0].t = wallVerts[1].t = (h - l + texturevpeg) * grTex->scaleY;
|
if (R_ShouldFlipTripWire(gl_linedef))
|
||||||
|
{
|
||||||
|
// Flip texture coordinates vertically
|
||||||
|
wallVerts[0].t = wallVerts[1].t = texturevpeg * grTex->scaleY;
|
||||||
|
wallVerts[3].t = wallVerts[2].t = (h - l + texturevpeg) * grTex->scaleY;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
wallVerts[3].t = wallVerts[2].t = texturevpeg * grTex->scaleY;
|
||||||
|
wallVerts[0].t = wallVerts[1].t = (h - l + texturevpeg) * grTex->scaleY;
|
||||||
|
}
|
||||||
wallVerts[0].s = wallVerts[3].s = cliplow * grTex->scaleX;
|
wallVerts[0].s = wallVerts[3].s = cliplow * grTex->scaleX;
|
||||||
wallVerts[2].s = wallVerts[1].s = cliphigh * grTex->scaleX;
|
wallVerts[2].s = wallVerts[1].s = cliphigh * grTex->scaleX;
|
||||||
}
|
}
|
||||||
|
|
@ -1433,8 +1443,19 @@ static void HWR_ProcessSeg(void) // Sort of like GLWall::Process in GZDoom
|
||||||
texturevpeg = textureheight[gl_sidedef->midtexture]*repeats - h + polybottom;
|
texturevpeg = textureheight[gl_sidedef->midtexture]*repeats - h + polybottom;
|
||||||
else
|
else
|
||||||
texturevpeg = polytop - h;
|
texturevpeg = polytop - h;
|
||||||
wallVerts[2].t = texturevpeg * grTex->scaleY;
|
|
||||||
wallVerts[1].t = (h - l + texturevpeg) * grTex->scaleY;
|
// Apply tripwire flipping for slope correction as well
|
||||||
|
if (R_ShouldFlipTripWire(gl_linedef))
|
||||||
|
{
|
||||||
|
// Flip texture coordinates vertically
|
||||||
|
wallVerts[1].t = texturevpeg * grTex->scaleY;
|
||||||
|
wallVerts[2].t = (h - l + texturevpeg) * grTex->scaleY;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
wallVerts[2].t = texturevpeg * grTex->scaleY;
|
||||||
|
wallVerts[1].t = (h - l + texturevpeg) * grTex->scaleY;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
wallVerts[2].y = FIXED_TO_FLOAT(h);
|
wallVerts[2].y = FIXED_TO_FLOAT(h);
|
||||||
|
|
@ -1531,8 +1552,18 @@ static void HWR_ProcessSeg(void) // Sort of like GLWall::Process in GZDoom
|
||||||
|
|
||||||
grTex = HWR_GetTexture(gl_midtexture, gl_sidedef->midtexture);
|
grTex = HWR_GetTexture(gl_midtexture, gl_sidedef->midtexture);
|
||||||
|
|
||||||
wallVerts[3].t = wallVerts[2].t = texturevpeg * grTex->scaleY;
|
// Check if we should flip tripwire texture vertically for single-sided lines too
|
||||||
wallVerts[0].t = wallVerts[1].t = (texturevpeg + gl_frontsector->ceilingheight - gl_frontsector->floorheight) * grTex->scaleY;
|
if (R_ShouldFlipTripWire(gl_linedef))
|
||||||
|
{
|
||||||
|
// Flip texture coordinates vertically
|
||||||
|
wallVerts[0].t = wallVerts[1].t = texturevpeg * grTex->scaleY;
|
||||||
|
wallVerts[3].t = wallVerts[2].t = (texturevpeg + gl_frontsector->ceilingheight - gl_frontsector->floorheight) * grTex->scaleY;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
wallVerts[3].t = wallVerts[2].t = texturevpeg * grTex->scaleY;
|
||||||
|
wallVerts[0].t = wallVerts[1].t = (texturevpeg + gl_frontsector->ceilingheight - gl_frontsector->floorheight) * grTex->scaleY;
|
||||||
|
}
|
||||||
wallVerts[0].s = wallVerts[3].s = cliplow * grTex->scaleX;
|
wallVerts[0].s = wallVerts[3].s = cliplow * grTex->scaleX;
|
||||||
wallVerts[2].s = wallVerts[1].s = cliphigh * grTex->scaleX;
|
wallVerts[2].s = wallVerts[1].s = cliphigh * grTex->scaleX;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1857,6 +1857,7 @@ boolean P_IsLineTripWire(const line_t *ld)
|
||||||
return ld->tripwire;
|
return ld->tripwire;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static boolean P_UsingStepUp(mobj_t *thing)
|
static boolean P_UsingStepUp(mobj_t *thing)
|
||||||
{
|
{
|
||||||
if (thing->flags & MF_NOCLIP)
|
if (thing->flags & MF_NOCLIP)
|
||||||
|
|
|
||||||
|
|
@ -3375,6 +3375,19 @@ static boolean P_CheckLineSideTripWire(line_t *ld, int p)
|
||||||
terrain = K_GetTerrainForTextureNum(sda->midtexture);
|
terrain = K_GetTerrainForTextureNum(sda->midtexture);
|
||||||
tripwire = terrain && (terrain->flags & TRF_TRIPWIRE);
|
tripwire = terrain && (terrain->flags & TRF_TRIPWIRE);
|
||||||
|
|
||||||
|
// If we are texture TRIPWIRE and have the ML_MIDTEXINVISWALL, the replace texture with TRIPWLOW
|
||||||
|
if (tripwire && (ld->flags & ML_MIDTEXINVISWALL)) // if we do backwards compat, update this to also swap for older custom maps without the flag
|
||||||
|
{
|
||||||
|
if (sda->midtexture == R_TextureNumForName("TRIPWIRE"))
|
||||||
|
{
|
||||||
|
sda->midtexture = R_TextureNumForName("TRIPWLOW");
|
||||||
|
}
|
||||||
|
else if (sda->midtexture == R_TextureNumForName("4RIPWIRE"))
|
||||||
|
{
|
||||||
|
sda->midtexture = R_TextureNumForName("4RIPWLOW");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (tripwire)
|
if (tripwire)
|
||||||
{
|
{
|
||||||
// copy midtexture to other side
|
// copy midtexture to other side
|
||||||
|
|
|
||||||
|
|
@ -429,6 +429,13 @@ boolean R_IsDebugLine(seg_t *line)
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
boolean R_ShouldFlipTripWire(const line_t *ld)
|
||||||
|
{
|
||||||
|
// Flip tripwire textures when they are unpegged
|
||||||
|
// so the energy flows downward instead of upward, matching collision behavior
|
||||||
|
return (ld->tripwire && !(ld->flags & ML_MIDPEG));
|
||||||
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// R_AddLine
|
// R_AddLine
|
||||||
// Clips the given segment and adds any visible pieces to the line list.
|
// Clips the given segment and adds any visible pieces to the line list.
|
||||||
|
|
|
||||||
|
|
@ -61,6 +61,7 @@ sector_t *R_FakeFlat(sector_t *sec, sector_t *tempsec, INT32 *floorlightlevel,
|
||||||
INT32 *ceilinglightlevel, boolean back);
|
INT32 *ceilinglightlevel, boolean back);
|
||||||
boolean R_IsEmptyLine(seg_t *line, sector_t *front, sector_t *back);
|
boolean R_IsEmptyLine(seg_t *line, sector_t *front, sector_t *back);
|
||||||
boolean R_IsDebugLine(seg_t *line);
|
boolean R_IsDebugLine(seg_t *line);
|
||||||
|
boolean R_ShouldFlipTripWire(const line_t *ld);
|
||||||
|
|
||||||
INT32 R_GetPlaneLight(sector_t *sector, fixed_t planeheight, boolean underside);
|
INT32 R_GetPlaneLight(sector_t *sector, fixed_t planeheight, boolean underside);
|
||||||
void R_Prep3DFloors(sector_t *sector);
|
void R_Prep3DFloors(sector_t *sector);
|
||||||
|
|
|
||||||
|
|
@ -696,7 +696,7 @@ void R_RenderMaskedSegRange(drawseg_t *drawseg, INT32 x1, INT32 x2)
|
||||||
// are not stored per-column with post info in SRB2
|
// are not stored per-column with post info in SRB2
|
||||||
if (textures[texnum]->holes)
|
if (textures[texnum]->holes)
|
||||||
{
|
{
|
||||||
if (textures[texnum]->flip & 2) // vertically flipped?
|
if ((textures[texnum]->flip & 2) || R_ShouldFlipTripWire(ldef)) // vertically flipped?
|
||||||
{
|
{
|
||||||
colfunc_2s = R_DrawFlippedMaskedColumn;
|
colfunc_2s = R_DrawFlippedMaskedColumn;
|
||||||
lengthcol = textures[texnum]->height;
|
lengthcol = textures[texnum]->height;
|
||||||
|
|
@ -706,8 +706,16 @@ void R_RenderMaskedSegRange(drawseg_t *drawseg, INT32 x1, INT32 x2)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
colfunc_2s = R_Render2sidedMultiPatchColumn; // render multipatch with no holes (no post_t info)
|
if (R_ShouldFlipTripWire(ldef)) // Check for tripwire flip even for non-holey textures
|
||||||
lengthcol = textures[texnum]->height;
|
{
|
||||||
|
colfunc_2s = R_DrawFlippedMaskedColumn;
|
||||||
|
lengthcol = textures[texnum]->height;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
colfunc_2s = R_Render2sidedMultiPatchColumn; // render multipatch with no holes (no post_t info)
|
||||||
|
lengthcol = textures[texnum]->height;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
maskedtexturecol = drawseg->maskedtexturecol;
|
maskedtexturecol = drawseg->maskedtexturecol;
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue