mirror of
https://git.do.srb2.org/STJr/SRB2.git
synced 2024-11-24 05:11:08 +00:00
Implement per-texture offsets in UDMF
This commit is contained in:
parent
e88b3542c7
commit
8c31d279cf
7 changed files with 132 additions and 47 deletions
|
@ -100,7 +100,7 @@ mapformat_udmf
|
||||||
|
|
||||||
// When this is set to true, sectors with the same tag will light up when a line is highlighted
|
// When this is set to true, sectors with the same tag will light up when a line is highlighted
|
||||||
linetagindicatesectors = false;
|
linetagindicatesectors = false;
|
||||||
localsidedeftextureoffsets = false;
|
localsidedeftextureoffsets = true;
|
||||||
distinctfloorandceilingbrightness = true;
|
distinctfloorandceilingbrightness = true;
|
||||||
|
|
||||||
planeequationsupport = true;
|
planeequationsupport = true;
|
||||||
|
|
|
@ -1153,7 +1153,7 @@ static void HWR_ProcessSeg(void) // Sort of like GLWall::Process in GZDoom
|
||||||
else
|
else
|
||||||
texturevpeg = gl_backsector->ceilingheight + textureheight[gl_toptexture] - gl_frontsector->ceilingheight;
|
texturevpeg = gl_backsector->ceilingheight + textureheight[gl_toptexture] - gl_frontsector->ceilingheight;
|
||||||
|
|
||||||
texturevpeg += gl_sidedef->rowoffset;
|
texturevpeg += gl_sidedef->rowoffset + gl_sidedef->offsety_top;
|
||||||
|
|
||||||
// This is so that it doesn't overflow and screw up the wall, it doesn't need to go higher than the texture's height anyway
|
// This is so that it doesn't overflow and screw up the wall, it doesn't need to go higher than the texture's height anyway
|
||||||
texturevpeg %= textureheight[gl_toptexture];
|
texturevpeg %= textureheight[gl_toptexture];
|
||||||
|
@ -1162,8 +1162,8 @@ static void HWR_ProcessSeg(void) // Sort of like GLWall::Process in GZDoom
|
||||||
|
|
||||||
wallVerts[3].t = wallVerts[2].t = texturevpeg * grTex->scaleY;
|
wallVerts[3].t = wallVerts[2].t = texturevpeg * grTex->scaleY;
|
||||||
wallVerts[0].t = wallVerts[1].t = (texturevpeg + gl_frontsector->ceilingheight - gl_backsector->ceilingheight) * grTex->scaleY;
|
wallVerts[0].t = wallVerts[1].t = (texturevpeg + gl_frontsector->ceilingheight - gl_backsector->ceilingheight) * grTex->scaleY;
|
||||||
wallVerts[0].s = wallVerts[3].s = cliplow * grTex->scaleX;
|
wallVerts[0].s = wallVerts[3].s = (cliplow + gl_sidedef->offsetx_top) * grTex->scaleX;
|
||||||
wallVerts[2].s = wallVerts[1].s = cliphigh * grTex->scaleX;
|
wallVerts[2].s = wallVerts[1].s = (cliphigh + gl_sidedef->offsetx_top) * grTex->scaleX;
|
||||||
|
|
||||||
// Adjust t value for sloped walls
|
// Adjust t value for sloped walls
|
||||||
if (!(gl_linedef->flags & ML_SKEWTD))
|
if (!(gl_linedef->flags & ML_SKEWTD))
|
||||||
|
@ -1213,7 +1213,7 @@ static void HWR_ProcessSeg(void) // Sort of like GLWall::Process in GZDoom
|
||||||
else
|
else
|
||||||
texturevpeg = gl_frontsector->floorheight - gl_backsector->floorheight;
|
texturevpeg = gl_frontsector->floorheight - gl_backsector->floorheight;
|
||||||
|
|
||||||
texturevpeg += gl_sidedef->rowoffset;
|
texturevpeg += gl_sidedef->rowoffset + gl_sidedef->offsety_bot;
|
||||||
|
|
||||||
// This is so that it doesn't overflow and screw up the wall, it doesn't need to go higher than the texture's height anyway
|
// This is so that it doesn't overflow and screw up the wall, it doesn't need to go higher than the texture's height anyway
|
||||||
texturevpeg %= textureheight[gl_bottomtexture];
|
texturevpeg %= textureheight[gl_bottomtexture];
|
||||||
|
@ -1222,8 +1222,8 @@ static void HWR_ProcessSeg(void) // Sort of like GLWall::Process in GZDoom
|
||||||
|
|
||||||
wallVerts[3].t = wallVerts[2].t = texturevpeg * grTex->scaleY;
|
wallVerts[3].t = wallVerts[2].t = texturevpeg * grTex->scaleY;
|
||||||
wallVerts[0].t = wallVerts[1].t = (texturevpeg + gl_backsector->floorheight - gl_frontsector->floorheight) * grTex->scaleY;
|
wallVerts[0].t = wallVerts[1].t = (texturevpeg + gl_backsector->floorheight - gl_frontsector->floorheight) * grTex->scaleY;
|
||||||
wallVerts[0].s = wallVerts[3].s = cliplow * grTex->scaleX;
|
wallVerts[0].s = wallVerts[3].s = (cliplow + gl_sidedef->offsetx_bot) * grTex->scaleX;
|
||||||
wallVerts[2].s = wallVerts[1].s = cliphigh * grTex->scaleX;
|
wallVerts[2].s = wallVerts[1].s = (cliphigh + gl_sidedef->offsetx_bot) * grTex->scaleX;
|
||||||
|
|
||||||
// Adjust t value for sloped walls
|
// Adjust t value for sloped walls
|
||||||
if (!(gl_linedef->flags & ML_SKEWTD))
|
if (!(gl_linedef->flags & ML_SKEWTD))
|
||||||
|
@ -1333,13 +1333,13 @@ static void HWR_ProcessSeg(void) // Sort of like GLWall::Process in GZDoom
|
||||||
// Peg it to the floor
|
// Peg it to the floor
|
||||||
if (gl_linedef->flags & ML_MIDPEG)
|
if (gl_linedef->flags & ML_MIDPEG)
|
||||||
{
|
{
|
||||||
polybottom = max(front->floorheight, back->floorheight) + gl_sidedef->rowoffset;
|
polybottom = max(front->floorheight, back->floorheight) + gl_sidedef->rowoffset + gl_sidedef->offsety_mid;
|
||||||
polytop = polybottom + midtexheight;
|
polytop = polybottom + midtexheight;
|
||||||
}
|
}
|
||||||
// Peg it to the ceiling
|
// Peg it to the ceiling
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
polytop = min(front->ceilingheight, back->ceilingheight) + gl_sidedef->rowoffset;
|
polytop = min(front->ceilingheight, back->ceilingheight) + gl_sidedef->rowoffset + gl_sidedef->offsety_mid;
|
||||||
polybottom = polytop - midtexheight;
|
polybottom = polytop - midtexheight;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1350,9 +1350,9 @@ static void HWR_ProcessSeg(void) // Sort of like GLWall::Process in GZDoom
|
||||||
// Skew the texture, but peg it to the floor
|
// Skew the texture, but peg it to the floor
|
||||||
else if (gl_linedef->flags & ML_MIDPEG)
|
else if (gl_linedef->flags & ML_MIDPEG)
|
||||||
{
|
{
|
||||||
polybottom = popenbottom + gl_sidedef->rowoffset;
|
polybottom = popenbottom + gl_sidedef->rowoffset + gl_sidedef->offsety_mid;
|
||||||
polytop = polybottom + midtexheight;
|
polytop = polybottom + midtexheight;
|
||||||
polybottomslope = popenbottomslope + gl_sidedef->rowoffset;
|
polybottomslope = popenbottomslope + gl_sidedef->rowoffset + gl_sidedef->offsety_mid;
|
||||||
polytopslope = polybottomslope + midtexheight;
|
polytopslope = polybottomslope + midtexheight;
|
||||||
}
|
}
|
||||||
// Skew it according to the ceiling's slope
|
// Skew it according to the ceiling's slope
|
||||||
|
@ -1407,12 +1407,12 @@ static void HWR_ProcessSeg(void) // Sort of like GLWall::Process in GZDoom
|
||||||
// Left side
|
// Left side
|
||||||
wallVerts[3].t = texturevpeg * grTex->scaleY;
|
wallVerts[3].t = texturevpeg * grTex->scaleY;
|
||||||
wallVerts[0].t = (h - l + texturevpeg) * grTex->scaleY;
|
wallVerts[0].t = (h - l + texturevpeg) * grTex->scaleY;
|
||||||
wallVerts[0].s = wallVerts[3].s = cliplow * grTex->scaleX;
|
wallVerts[0].s = wallVerts[3].s = (cliplow + gl_sidedef->offsetx_mid) * grTex->scaleX;
|
||||||
|
|
||||||
// Right side
|
// Right side
|
||||||
wallVerts[2].t = texturevpegslope * grTex->scaleY;
|
wallVerts[2].t = texturevpegslope * grTex->scaleY;
|
||||||
wallVerts[1].t = (hS - lS + texturevpegslope) * grTex->scaleY;
|
wallVerts[1].t = (hS - lS + texturevpegslope) * grTex->scaleY;
|
||||||
wallVerts[2].s = wallVerts[1].s = cliphigh * grTex->scaleX;
|
wallVerts[2].s = wallVerts[1].s = (cliphigh + gl_sidedef->offsetx_mid) * grTex->scaleX;
|
||||||
|
|
||||||
// set top/bottom coords
|
// set top/bottom coords
|
||||||
// Take the texture peg into account, rather than changing the offsets past
|
// Take the texture peg into account, rather than changing the offsets past
|
||||||
|
@ -1474,19 +1474,19 @@ static void HWR_ProcessSeg(void) // Sort of like GLWall::Process in GZDoom
|
||||||
|
|
||||||
// PEGGING
|
// PEGGING
|
||||||
if ((gl_linedef->flags & (ML_DONTPEGBOTTOM|ML_NOSKEW)) == (ML_DONTPEGBOTTOM|ML_NOSKEW))
|
if ((gl_linedef->flags & (ML_DONTPEGBOTTOM|ML_NOSKEW)) == (ML_DONTPEGBOTTOM|ML_NOSKEW))
|
||||||
texturevpeg = gl_frontsector->floorheight + textureheight[gl_sidedef->midtexture] - gl_frontsector->ceilingheight + gl_sidedef->rowoffset;
|
texturevpeg = gl_frontsector->floorheight + textureheight[gl_sidedef->midtexture] - gl_frontsector->ceilingheight + gl_sidedef->rowoffset + gl_sidedef->offsety_mid;
|
||||||
else if (gl_linedef->flags & ML_DONTPEGBOTTOM)
|
else if (gl_linedef->flags & ML_DONTPEGBOTTOM)
|
||||||
texturevpeg = worldbottom + textureheight[gl_sidedef->midtexture] - worldtop + gl_sidedef->rowoffset;
|
texturevpeg = worldbottom + textureheight[gl_sidedef->midtexture] - worldtop + gl_sidedef->rowoffset + gl_sidedef->offsety_mid;
|
||||||
else
|
else
|
||||||
// top of texture at top
|
// top of texture at top
|
||||||
texturevpeg = gl_sidedef->rowoffset;
|
texturevpeg = gl_sidedef->rowoffset + gl_sidedef->offsety_mid;
|
||||||
|
|
||||||
grTex = HWR_GetTexture(gl_midtexture);
|
grTex = HWR_GetTexture(gl_midtexture);
|
||||||
|
|
||||||
wallVerts[3].t = wallVerts[2].t = texturevpeg * grTex->scaleY;
|
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].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 + gl_sidedef->offsetx_mid) * grTex->scaleX;
|
||||||
wallVerts[2].s = wallVerts[1].s = cliphigh * grTex->scaleX;
|
wallVerts[2].s = wallVerts[1].s = (cliphigh + gl_sidedef->offsetx_mid) * grTex->scaleX;
|
||||||
|
|
||||||
// Texture correction for slopes
|
// Texture correction for slopes
|
||||||
if (gl_linedef->flags & ML_NOSKEW) {
|
if (gl_linedef->flags & ML_NOSKEW) {
|
||||||
|
@ -1634,13 +1634,13 @@ static void HWR_ProcessSeg(void) // Sort of like GLWall::Process in GZDoom
|
||||||
// -- Monster Iestyn 26/06/18
|
// -- Monster Iestyn 26/06/18
|
||||||
if (newline)
|
if (newline)
|
||||||
{
|
{
|
||||||
texturevpeg = sides[newline->sidenum[0]].rowoffset;
|
texturevpeg = sides[newline->sidenum[0]].rowoffset + sides[newline->sidenum[0]].offsety_mid;
|
||||||
attachtobottom = !!(newline->flags & ML_DONTPEGBOTTOM);
|
attachtobottom = !!(newline->flags & ML_DONTPEGBOTTOM);
|
||||||
slopeskew = !!(newline->flags & ML_SKEWTD);
|
slopeskew = !!(newline->flags & ML_SKEWTD);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
texturevpeg = sides[rover->master->sidenum[0]].rowoffset;
|
texturevpeg = sides[rover->master->sidenum[0]].rowoffset + sides[rover->master->sidenum[0]].offsety_mid;
|
||||||
attachtobottom = !!(gl_linedef->flags & ML_DONTPEGBOTTOM);
|
attachtobottom = !!(gl_linedef->flags & ML_DONTPEGBOTTOM);
|
||||||
slopeskew = !!(rover->master->flags & ML_SKEWTD);
|
slopeskew = !!(rover->master->flags & ML_SKEWTD);
|
||||||
}
|
}
|
||||||
|
@ -1672,8 +1672,8 @@ static void HWR_ProcessSeg(void) // Sort of like GLWall::Process in GZDoom
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
wallVerts[0].s = wallVerts[3].s = cliplow * grTex->scaleX;
|
wallVerts[0].s = wallVerts[3].s = (cliplow + gl_sidedef->offsetx_mid) * grTex->scaleX;
|
||||||
wallVerts[2].s = wallVerts[1].s = cliphigh * grTex->scaleX;
|
wallVerts[2].s = wallVerts[1].s = (cliphigh + gl_sidedef->offsetx_mid) * grTex->scaleX;
|
||||||
}
|
}
|
||||||
if (rover->fofflags & FOF_FOG)
|
if (rover->fofflags & FOF_FOG)
|
||||||
{
|
{
|
||||||
|
@ -1785,17 +1785,17 @@ static void HWR_ProcessSeg(void) // Sort of like GLWall::Process in GZDoom
|
||||||
|
|
||||||
if (newline)
|
if (newline)
|
||||||
{
|
{
|
||||||
wallVerts[3].t = wallVerts[2].t = (*rover->topheight - h + sides[newline->sidenum[0]].rowoffset) * grTex->scaleY;
|
wallVerts[3].t = wallVerts[2].t = (*rover->topheight - h + sides[newline->sidenum[0]].rowoffset + sides[newline->sidenum[0]].offsety_mid) * grTex->scaleY;
|
||||||
wallVerts[0].t = wallVerts[1].t = (h - l + (*rover->topheight - h + sides[newline->sidenum[0]].rowoffset)) * grTex->scaleY;
|
wallVerts[0].t = wallVerts[1].t = (h - l + (*rover->topheight - h + sides[newline->sidenum[0]].rowoffset) + sides[newline->sidenum[0]].offsety_mid) * grTex->scaleY;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
wallVerts[3].t = wallVerts[2].t = (*rover->topheight - h + sides[rover->master->sidenum[0]].rowoffset) * grTex->scaleY;
|
wallVerts[3].t = wallVerts[2].t = (*rover->topheight - h + sides[rover->master->sidenum[0]].rowoffset + sides[rover->master->sidenum[0]].offsety_mid) * grTex->scaleY;
|
||||||
wallVerts[0].t = wallVerts[1].t = (h - l + (*rover->topheight - h + sides[rover->master->sidenum[0]].rowoffset)) * grTex->scaleY;
|
wallVerts[0].t = wallVerts[1].t = (h - l + (*rover->topheight - h + sides[rover->master->sidenum[0]].rowoffset + sides[rover->master->sidenum[0]].offsety_mid)) * grTex->scaleY;
|
||||||
}
|
}
|
||||||
|
|
||||||
wallVerts[0].s = wallVerts[3].s = cliplow * grTex->scaleX;
|
wallVerts[0].s = wallVerts[3].s = (cliplow + gl_sidedef->offsetx_mid) * grTex->scaleX;
|
||||||
wallVerts[2].s = wallVerts[1].s = cliphigh * grTex->scaleX;
|
wallVerts[2].s = wallVerts[1].s = (cliphigh + gl_sidedef->offsetx_mid) * grTex->scaleX;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (rover->fofflags & FOF_FOG)
|
if (rover->fofflags & FOF_FOG)
|
||||||
|
|
|
@ -166,6 +166,12 @@ enum side_e {
|
||||||
side_valid = 0,
|
side_valid = 0,
|
||||||
side_textureoffset,
|
side_textureoffset,
|
||||||
side_rowoffset,
|
side_rowoffset,
|
||||||
|
side_offsetx_top,
|
||||||
|
side_offsety_top,
|
||||||
|
side_offsetx_mid,
|
||||||
|
side_offsety_mid,
|
||||||
|
side_offsetx_bot,
|
||||||
|
side_offsety_bot,
|
||||||
side_toptexture,
|
side_toptexture,
|
||||||
side_bottomtexture,
|
side_bottomtexture,
|
||||||
side_midtexture,
|
side_midtexture,
|
||||||
|
@ -180,6 +186,12 @@ static const char *const side_opt[] = {
|
||||||
"valid",
|
"valid",
|
||||||
"textureoffset",
|
"textureoffset",
|
||||||
"rowoffset",
|
"rowoffset",
|
||||||
|
"offsetx_top",
|
||||||
|
"offsety_top",
|
||||||
|
"offsetx_mid",
|
||||||
|
"offsety_mid",
|
||||||
|
"offsetx_bot",
|
||||||
|
"offsety_bot",
|
||||||
"toptexture",
|
"toptexture",
|
||||||
"bottomtexture",
|
"bottomtexture",
|
||||||
"midtexture",
|
"midtexture",
|
||||||
|
@ -1097,6 +1109,24 @@ static int side_get(lua_State *L)
|
||||||
case side_rowoffset:
|
case side_rowoffset:
|
||||||
lua_pushfixed(L, side->rowoffset);
|
lua_pushfixed(L, side->rowoffset);
|
||||||
return 1;
|
return 1;
|
||||||
|
case side_offsetx_top:
|
||||||
|
lua_pushfixed(L, side->offsetx_top);
|
||||||
|
return 1;
|
||||||
|
case side_offsety_top:
|
||||||
|
lua_pushfixed(L, side->offsety_top);
|
||||||
|
return 1;
|
||||||
|
case side_offsetx_mid:
|
||||||
|
lua_pushfixed(L, side->offsetx_mid);
|
||||||
|
return 1;
|
||||||
|
case side_offsety_mid:
|
||||||
|
lua_pushfixed(L, side->offsety_mid);
|
||||||
|
return 1;
|
||||||
|
case side_offsetx_bot:
|
||||||
|
lua_pushfixed(L, side->offsetx_bot);
|
||||||
|
return 1;
|
||||||
|
case side_offsety_bot:
|
||||||
|
lua_pushfixed(L, side->offsety_bot);
|
||||||
|
return 1;
|
||||||
case side_toptexture:
|
case side_toptexture:
|
||||||
lua_pushinteger(L, side->toptexture);
|
lua_pushinteger(L, side->toptexture);
|
||||||
return 1;
|
return 1;
|
||||||
|
@ -1154,6 +1184,24 @@ static int side_set(lua_State *L)
|
||||||
case side_rowoffset:
|
case side_rowoffset:
|
||||||
side->rowoffset = luaL_checkfixed(L, 3);
|
side->rowoffset = luaL_checkfixed(L, 3);
|
||||||
break;
|
break;
|
||||||
|
case side_offsetx_top:
|
||||||
|
side->offsetx_top = luaL_checkfixed(L, 3);
|
||||||
|
break;
|
||||||
|
case side_offsety_top:
|
||||||
|
side->offsety_top = luaL_checkfixed(L, 3);
|
||||||
|
break;
|
||||||
|
case side_offsetx_mid:
|
||||||
|
side->offsetx_mid = luaL_checkfixed(L, 3);
|
||||||
|
break;
|
||||||
|
case side_offsety_mid:
|
||||||
|
side->offsety_mid = luaL_checkfixed(L, 3);
|
||||||
|
break;
|
||||||
|
case side_offsetx_bot:
|
||||||
|
side->offsetx_bot = luaL_checkfixed(L, 3);
|
||||||
|
break;
|
||||||
|
case side_offsety_bot:
|
||||||
|
side->offsety_bot = luaL_checkfixed(L, 3);
|
||||||
|
break;
|
||||||
case side_toptexture:
|
case side_toptexture:
|
||||||
side->toptexture = luaL_checkinteger(L, 3);
|
side->toptexture = luaL_checkinteger(L, 3);
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -509,26 +509,26 @@ void P_LineOpening(line_t *linedef, mobj_t *mobj)
|
||||||
// on non-solid polyobjects should NEVER happen in the future
|
// on non-solid polyobjects should NEVER happen in the future
|
||||||
if (linedef->polyobj && (linedef->polyobj->flags & POF_TESTHEIGHT)) {
|
if (linedef->polyobj && (linedef->polyobj->flags & POF_TESTHEIGHT)) {
|
||||||
if (linedef->flags & ML_WRAPMIDTEX && !side->repeatcnt) { // "infinite" repeat
|
if (linedef->flags & ML_WRAPMIDTEX && !side->repeatcnt) { // "infinite" repeat
|
||||||
texbottom = back->floorheight + side->rowoffset;
|
texbottom = back->floorheight + side->rowoffset + side->offsety_mid;
|
||||||
textop = back->ceilingheight + side->rowoffset;
|
textop = back->ceilingheight + side->rowoffset + side->offsety_mid;
|
||||||
} else if (linedef->flags & ML_MIDTEX) {
|
} else if (linedef->flags & ML_MIDTEX) {
|
||||||
texbottom = back->floorheight + side->rowoffset;
|
texbottom = back->floorheight + side->rowoffset + side->offsety_mid;
|
||||||
textop = texbottom + texheight*(side->repeatcnt+1);
|
textop = texbottom + texheight*(side->repeatcnt+1);
|
||||||
} else {
|
} else {
|
||||||
textop = back->ceilingheight + side->rowoffset;
|
textop = back->ceilingheight + side->rowoffset + side->offsety_mid;
|
||||||
texbottom = textop - texheight*(side->repeatcnt+1);
|
texbottom = textop - texheight*(side->repeatcnt+1);
|
||||||
}
|
}
|
||||||
} else
|
} else
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
if (linedef->flags & ML_WRAPMIDTEX && !side->repeatcnt) { // "infinite" repeat
|
if (linedef->flags & ML_WRAPMIDTEX && !side->repeatcnt) { // "infinite" repeat
|
||||||
texbottom = openbottom + side->rowoffset;
|
texbottom = openbottom + side->rowoffset + side->offsety_mid;
|
||||||
textop = opentop + side->rowoffset;
|
textop = opentop + side->rowoffset + side->offsety_mid;
|
||||||
} else if (linedef->flags & ML_MIDPEG) {
|
} else if (linedef->flags & ML_MIDPEG) {
|
||||||
texbottom = openbottom + side->rowoffset;
|
texbottom = openbottom + side->rowoffset + side->offsety_mid;
|
||||||
textop = texbottom + texheight*(side->repeatcnt+1);
|
textop = texbottom + texheight*(side->repeatcnt+1);
|
||||||
} else {
|
} else {
|
||||||
textop = opentop + side->rowoffset;
|
textop = opentop + side->rowoffset + side->offsety_mid;
|
||||||
texbottom = textop - texheight*(side->repeatcnt+1);
|
texbottom = textop - texheight*(side->repeatcnt+1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1240,6 +1240,9 @@ static void P_LoadSidedefs(UINT8 *data)
|
||||||
}
|
}
|
||||||
sd->rowoffset = SHORT(msd->rowoffset)<<FRACBITS;
|
sd->rowoffset = SHORT(msd->rowoffset)<<FRACBITS;
|
||||||
|
|
||||||
|
sd->offsetx_top = sd->offsetx_mid = sd->offsetx_bot = 0;
|
||||||
|
sd->offsety_top = sd->offsety_mid = sd->offsety_bot = 0;
|
||||||
|
|
||||||
P_SetSidedefSector(i, SHORT(msd->sector));
|
P_SetSidedefSector(i, SHORT(msd->sector));
|
||||||
|
|
||||||
// Special info stored in texture fields!
|
// Special info stored in texture fields!
|
||||||
|
@ -1777,6 +1780,18 @@ static void ParseTextmapSidedefParameter(UINT32 i, const char *param, const char
|
||||||
sides[i].textureoffset = atol(val)<<FRACBITS;
|
sides[i].textureoffset = atol(val)<<FRACBITS;
|
||||||
else if (fastcmp(param, "offsety"))
|
else if (fastcmp(param, "offsety"))
|
||||||
sides[i].rowoffset = atol(val)<<FRACBITS;
|
sides[i].rowoffset = atol(val)<<FRACBITS;
|
||||||
|
else if (fastcmp(param, "offsetx_top"))
|
||||||
|
sides[i].offsetx_top = atol(val) << FRACBITS;
|
||||||
|
else if (fastcmp(param, "offsetx_mid"))
|
||||||
|
sides[i].offsetx_mid = atol(val) << FRACBITS;
|
||||||
|
else if (fastcmp(param, "offsetx_bottom"))
|
||||||
|
sides[i].offsetx_bot = atol(val) << FRACBITS;
|
||||||
|
else if (fastcmp(param, "offsety_top"))
|
||||||
|
sides[i].offsety_top = atol(val) << FRACBITS;
|
||||||
|
else if (fastcmp(param, "offsety_mid"))
|
||||||
|
sides[i].offsety_mid = atol(val) << FRACBITS;
|
||||||
|
else if (fastcmp(param, "offsety_bottom"))
|
||||||
|
sides[i].offsety_bot = atol(val) << FRACBITS;
|
||||||
else if (fastcmp(param, "texturetop"))
|
else if (fastcmp(param, "texturetop"))
|
||||||
sides[i].toptexture = R_TextureNumForName(val);
|
sides[i].toptexture = R_TextureNumForName(val);
|
||||||
else if (fastcmp(param, "texturebottom"))
|
else if (fastcmp(param, "texturebottom"))
|
||||||
|
@ -2461,6 +2476,18 @@ static void P_WriteTextmap(void)
|
||||||
fprintf(f, "offsetx = %d;\n", wsides[i].textureoffset >> FRACBITS);
|
fprintf(f, "offsetx = %d;\n", wsides[i].textureoffset >> FRACBITS);
|
||||||
if (wsides[i].rowoffset != 0)
|
if (wsides[i].rowoffset != 0)
|
||||||
fprintf(f, "offsety = %d;\n", wsides[i].rowoffset >> FRACBITS);
|
fprintf(f, "offsety = %d;\n", wsides[i].rowoffset >> FRACBITS);
|
||||||
|
if (wsides[i].offsetx_top != 0)
|
||||||
|
fprintf(f, "offsetx_top = %d;\n", wsides[i].offsetx_top >> FRACBITS);
|
||||||
|
if (wsides[i].offsety_top != 0)
|
||||||
|
fprintf(f, "offsety_top = %d;\n", wsides[i].offsety_top >> FRACBITS);
|
||||||
|
if (wsides[i].offsetx_mid != 0)
|
||||||
|
fprintf(f, "offsetx_mid = %d;\n", wsides[i].offsetx_mid >> FRACBITS);
|
||||||
|
if (wsides[i].offsety_mid != 0)
|
||||||
|
fprintf(f, "offsety_mid = %d;\n", wsides[i].offsety_mid >> FRACBITS);
|
||||||
|
if (wsides[i].offsetx_bot != 0)
|
||||||
|
fprintf(f, "offsetx_bottom = %d;\n", wsides[i].offsetx_bot >> FRACBITS);
|
||||||
|
if (wsides[i].offsety_bot != 0)
|
||||||
|
fprintf(f, "offsety_bottom = %d;\n", wsides[i].offsety_bot >> FRACBITS);
|
||||||
if (wsides[i].toptexture > 0 && wsides[i].toptexture < numtextures)
|
if (wsides[i].toptexture > 0 && wsides[i].toptexture < numtextures)
|
||||||
fprintf(f, "texturetop = \"%.*s\";\n", 8, textures[wsides[i].toptexture]->name);
|
fprintf(f, "texturetop = \"%.*s\";\n", 8, textures[wsides[i].toptexture]->name);
|
||||||
if (wsides[i].bottomtexture > 0 && wsides[i].bottomtexture < numtextures)
|
if (wsides[i].bottomtexture > 0 && wsides[i].bottomtexture < numtextures)
|
||||||
|
@ -2828,6 +2855,8 @@ static void P_LoadTextmap(void)
|
||||||
// Defaults.
|
// Defaults.
|
||||||
sd->textureoffset = 0;
|
sd->textureoffset = 0;
|
||||||
sd->rowoffset = 0;
|
sd->rowoffset = 0;
|
||||||
|
sd->offsetx_top = sd->offsetx_mid = sd->offsetx_bot = 0;
|
||||||
|
sd->offsety_top = sd->offsety_mid = sd->offsety_bot = 0;
|
||||||
sd->toptexture = R_TextureNumForName("-");
|
sd->toptexture = R_TextureNumForName("-");
|
||||||
sd->midtexture = R_TextureNumForName("-");
|
sd->midtexture = R_TextureNumForName("-");
|
||||||
sd->bottomtexture = R_TextureNumForName("-");
|
sd->bottomtexture = R_TextureNumForName("-");
|
||||||
|
|
|
@ -559,6 +559,10 @@ typedef struct
|
||||||
// add this to the calculated texture top
|
// add this to the calculated texture top
|
||||||
fixed_t rowoffset;
|
fixed_t rowoffset;
|
||||||
|
|
||||||
|
// per-texture offsets for UDMF
|
||||||
|
fixed_t offsetx_top, offsetx_mid, offsetx_bot;
|
||||||
|
fixed_t offsety_top, offsety_mid, offsety_bot;
|
||||||
|
|
||||||
// Texture indices.
|
// Texture indices.
|
||||||
// We do not maintain names here.
|
// We do not maintain names here.
|
||||||
INT32 toptexture, bottomtexture, midtexture;
|
INT32 toptexture, bottomtexture, midtexture;
|
||||||
|
|
26
src/r_segs.c
26
src/r_segs.c
|
@ -49,6 +49,7 @@ fixed_t rw_distance;
|
||||||
static INT32 rw_x, rw_stopx;
|
static INT32 rw_x, rw_stopx;
|
||||||
static angle_t rw_centerangle;
|
static angle_t rw_centerangle;
|
||||||
static fixed_t rw_offset;
|
static fixed_t rw_offset;
|
||||||
|
static fixed_t rw_offset_top, rw_offset_mid, rw_offset_bot;
|
||||||
static fixed_t rw_offset2; // for splats
|
static fixed_t rw_offset2; // for splats
|
||||||
static fixed_t rw_scale, rw_scalestep;
|
static fixed_t rw_scale, rw_scalestep;
|
||||||
static fixed_t rw_midtexturemid, rw_toptexturemid, rw_bottomtexturemid;
|
static fixed_t rw_midtexturemid, rw_toptexturemid, rw_bottomtexturemid;
|
||||||
|
@ -778,7 +779,7 @@ void R_RenderThickSideRange(drawseg_t *ds, INT32 x1, INT32 x2, ffloor_t *pfloor)
|
||||||
|
|
||||||
if (newline)
|
if (newline)
|
||||||
{
|
{
|
||||||
offsetvalue = sides[newline->sidenum[0]].rowoffset;
|
offsetvalue = sides[newline->sidenum[0]].rowoffset + sides[newline->sidenum[0]].offsety_mid;
|
||||||
if (newline->flags & ML_DONTPEGBOTTOM)
|
if (newline->flags & ML_DONTPEGBOTTOM)
|
||||||
{
|
{
|
||||||
skewslope = *pfloor->b_slope; // skew using bottom slope
|
skewslope = *pfloor->b_slope; // skew using bottom slope
|
||||||
|
@ -790,7 +791,7 @@ void R_RenderThickSideRange(drawseg_t *ds, INT32 x1, INT32 x2, ffloor_t *pfloor)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
offsetvalue = sides[pfloor->master->sidenum[0]].rowoffset;
|
offsetvalue = sides[pfloor->master->sidenum[0]].rowoffset + sides[pfloor->master->sidenum[0]].offsety_mid;
|
||||||
if (curline->linedef->flags & ML_DONTPEGBOTTOM)
|
if (curline->linedef->flags & ML_DONTPEGBOTTOM)
|
||||||
{
|
{
|
||||||
skewslope = *pfloor->b_slope; // skew using bottom slope
|
skewslope = *pfloor->b_slope; // skew using bottom slope
|
||||||
|
@ -1335,7 +1336,7 @@ static void R_RenderSegLoop (void)
|
||||||
dc_yl = yl;
|
dc_yl = yl;
|
||||||
dc_yh = yh;
|
dc_yh = yh;
|
||||||
dc_texturemid = rw_midtexturemid;
|
dc_texturemid = rw_midtexturemid;
|
||||||
dc_source = R_GetColumn(midtexture,texturecolumn);
|
dc_source = R_GetColumn(midtexture,texturecolumn + (rw_offset_mid>>FRACBITS));
|
||||||
dc_texheight = textureheight[midtexture]>>FRACBITS;
|
dc_texheight = textureheight[midtexture]>>FRACBITS;
|
||||||
|
|
||||||
//profile stuff ---------------------------------------------------------
|
//profile stuff ---------------------------------------------------------
|
||||||
|
@ -1396,7 +1397,7 @@ static void R_RenderSegLoop (void)
|
||||||
dc_yl = yl;
|
dc_yl = yl;
|
||||||
dc_yh = mid;
|
dc_yh = mid;
|
||||||
dc_texturemid = rw_toptexturemid;
|
dc_texturemid = rw_toptexturemid;
|
||||||
dc_source = R_GetColumn(toptexture,texturecolumn);
|
dc_source = R_GetColumn(toptexture,texturecolumn + (rw_offset_top>>FRACBITS));
|
||||||
dc_texheight = textureheight[toptexture]>>FRACBITS;
|
dc_texheight = textureheight[toptexture]>>FRACBITS;
|
||||||
colfunc();
|
colfunc();
|
||||||
ceilingclip[rw_x] = (INT16)mid;
|
ceilingclip[rw_x] = (INT16)mid;
|
||||||
|
@ -1433,7 +1434,7 @@ static void R_RenderSegLoop (void)
|
||||||
dc_yh = yh;
|
dc_yh = yh;
|
||||||
dc_texturemid = rw_bottomtexturemid;
|
dc_texturemid = rw_bottomtexturemid;
|
||||||
dc_source = R_GetColumn(bottomtexture,
|
dc_source = R_GetColumn(bottomtexture,
|
||||||
texturecolumn);
|
texturecolumn + (rw_offset_bot>>FRACBITS));
|
||||||
dc_texheight = textureheight[bottomtexture]>>FRACBITS;
|
dc_texheight = textureheight[bottomtexture]>>FRACBITS;
|
||||||
colfunc();
|
colfunc();
|
||||||
floorclip[rw_x] = (INT16)mid;
|
floorclip[rw_x] = (INT16)mid;
|
||||||
|
@ -1452,7 +1453,7 @@ static void R_RenderSegLoop (void)
|
||||||
{
|
{
|
||||||
// save texturecol
|
// save texturecol
|
||||||
// for backdrawing of masked mid texture
|
// for backdrawing of masked mid texture
|
||||||
maskedtexturecol[rw_x] = (INT16)texturecolumn;
|
maskedtexturecol[rw_x] = (INT16)(texturecolumn + (rw_offset_mid>>FRACBITS));
|
||||||
|
|
||||||
if (maskedtextureheight != NULL) {
|
if (maskedtextureheight != NULL) {
|
||||||
maskedtextureheight[rw_x] = (curline->linedef->flags & ML_MIDPEG) ?
|
maskedtextureheight[rw_x] = (curline->linedef->flags & ML_MIDPEG) ?
|
||||||
|
@ -1783,7 +1784,7 @@ void R_StoreWallRange(INT32 start, INT32 stop)
|
||||||
rw_midtexturemid = worldtop;
|
rw_midtexturemid = worldtop;
|
||||||
rw_midtextureslide = ceilingfrontslide;
|
rw_midtextureslide = ceilingfrontslide;
|
||||||
}
|
}
|
||||||
rw_midtexturemid += sidedef->rowoffset;
|
rw_midtexturemid += sidedef->rowoffset + sidedef->offsety_mid;
|
||||||
|
|
||||||
ds_p->silhouette = SIL_BOTH;
|
ds_p->silhouette = SIL_BOTH;
|
||||||
ds_p->sprtopclip = screenheightarray;
|
ds_p->sprtopclip = screenheightarray;
|
||||||
|
@ -2022,8 +2023,8 @@ void R_StoreWallRange(INT32 start, INT32 stop)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
rw_toptexturemid += sidedef->rowoffset;
|
rw_toptexturemid += sidedef->rowoffset + sidedef->offsety_top;
|
||||||
rw_bottomtexturemid += sidedef->rowoffset;
|
rw_bottomtexturemid += sidedef->rowoffset + sidedef->offsety_bot;
|
||||||
|
|
||||||
// allocate space for masked texture tables
|
// allocate space for masked texture tables
|
||||||
if (frontsector && backsector && !Tag_Compare(&frontsector->tags, &backsector->tags) && (backsector->ffloors || frontsector->ffloors))
|
if (frontsector && backsector && !Tag_Compare(&frontsector->tags, &backsector->tags) && (backsector->ffloors || frontsector->ffloors))
|
||||||
|
@ -2266,8 +2267,8 @@ void R_StoreWallRange(INT32 start, INT32 stop)
|
||||||
rw_midtexturebackslide = ceilingbackslide;
|
rw_midtexturebackslide = ceilingbackslide;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
rw_midtexturemid += sidedef->rowoffset;
|
rw_midtexturemid += sidedef->rowoffset + sidedef->offsety_mid;
|
||||||
rw_midtextureback += sidedef->rowoffset;
|
rw_midtextureback += sidedef->rowoffset + sidedef->offsety_mid;
|
||||||
|
|
||||||
maskedtexture = true;
|
maskedtexture = true;
|
||||||
}
|
}
|
||||||
|
@ -2305,6 +2306,9 @@ void R_StoreWallRange(INT32 start, INT32 stop)
|
||||||
/// don't use texture offset for splats
|
/// don't use texture offset for splats
|
||||||
rw_offset2 = rw_offset + curline->offset;
|
rw_offset2 = rw_offset + curline->offset;
|
||||||
rw_offset += sidedef->textureoffset + curline->offset;
|
rw_offset += sidedef->textureoffset + curline->offset;
|
||||||
|
rw_offset_top = sidedef->offsetx_top;
|
||||||
|
rw_offset_mid = sidedef->offsetx_mid;
|
||||||
|
rw_offset_bot = sidedef->offsetx_bot;
|
||||||
rw_centerangle = ANGLE_90 + viewangle - rw_normalangle;
|
rw_centerangle = ANGLE_90 + viewangle - rw_normalangle;
|
||||||
|
|
||||||
// calculate light table
|
// calculate light table
|
||||||
|
|
Loading…
Reference in a new issue