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
|
||||
|
||||
#define ATTRUNUSED __attribute__((unused))
|
||||
#define ATTRUNOPTIMIZE __attribute__((optimize("O0")))
|
||||
#elif defined (_MSC_VER)
|
||||
#define ATTRNORETURN __declspec(noreturn)
|
||||
#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);
|
||||
|
||||
// Check if we should flip tripwire texture vertically for unpegged tripwires
|
||||
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[2].s = wallVerts[1].s = cliphigh * grTex->scaleX;
|
||||
}
|
||||
|
|
@ -1433,9 +1443,20 @@ static void HWR_ProcessSeg(void) // Sort of like GLWall::Process in GZDoom
|
|||
texturevpeg = textureheight[gl_sidedef->midtexture]*repeats - h + polybottom;
|
||||
else
|
||||
texturevpeg = polytop - h;
|
||||
|
||||
// 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[1].y = FIXED_TO_FLOAT(l);
|
||||
|
|
@ -1531,8 +1552,18 @@ static void HWR_ProcessSeg(void) // Sort of like GLWall::Process in GZDoom
|
|||
|
||||
grTex = HWR_GetTexture(gl_midtexture, gl_sidedef->midtexture);
|
||||
|
||||
// Check if we should flip tripwire texture vertically for single-sided lines too
|
||||
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[2].s = wallVerts[1].s = cliphigh * grTex->scaleX;
|
||||
|
||||
|
|
|
|||
|
|
@ -1857,6 +1857,7 @@ boolean P_IsLineTripWire(const line_t *ld)
|
|||
return ld->tripwire;
|
||||
}
|
||||
|
||||
|
||||
static boolean P_UsingStepUp(mobj_t *thing)
|
||||
{
|
||||
if (thing->flags & MF_NOCLIP)
|
||||
|
|
|
|||
|
|
@ -3375,6 +3375,19 @@ static boolean P_CheckLineSideTripWire(line_t *ld, int p)
|
|||
terrain = K_GetTerrainForTextureNum(sda->midtexture);
|
||||
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)
|
||||
{
|
||||
// copy midtexture to other side
|
||||
|
|
|
|||
|
|
@ -429,6 +429,13 @@ boolean R_IsDebugLine(seg_t *line)
|
|||
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
|
||||
// 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);
|
||||
boolean R_IsEmptyLine(seg_t *line, sector_t *front, sector_t *back);
|
||||
boolean R_IsDebugLine(seg_t *line);
|
||||
boolean R_ShouldFlipTripWire(const line_t *ld);
|
||||
|
||||
INT32 R_GetPlaneLight(sector_t *sector, fixed_t planeheight, boolean underside);
|
||||
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
|
||||
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;
|
||||
lengthcol = textures[texnum]->height;
|
||||
|
|
@ -705,10 +705,18 @@ void R_RenderMaskedSegRange(drawseg_t *drawseg, INT32 x1, INT32 x2)
|
|||
colfunc_2s = R_DrawMaskedColumn; // render the usual 2sided single-patch packed texture
|
||||
}
|
||||
else
|
||||
{
|
||||
if (R_ShouldFlipTripWire(ldef)) // Check for tripwire flip even for non-holey textures
|
||||
{
|
||||
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;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue