Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found
Select Git revision

Target

Select target project
  • STJr/SRB2
  • Sryder/SRB2
  • wolfy852/SRB2
  • Alpha2244/SRB2
  • Inuyasha/SRB2
  • yoshibot/SRB2
  • TehRealSalt/SRB2
  • PrisimaTF/SRB2
  • Hatninja/SRB2
  • SteelT/SRB2
  • james/SRB2
  • ShaderWraith/SRB2
  • SinnamonLat/SRB2
  • mazmazz_/SRB2
  • filpAM/SRB2
  • chaoloveicemdboy/SRB2
  • Whooa21/SRB2
  • Machturne/SRB2
  • Golden/SRB2
  • Tatsuru/SRB2
  • Snu/SRB2
  • Zwip-Zwap_Zapony/SRB2
  • fickleheart/SRB2
  • alphaRexJames/SRB2
  • JJK/SRB2
  • diskpoppy/SRB2
  • Hannu_Hanhi/SRB2
  • ZipperQR/SRB2
  • kays/SRB2
  • spherallic/SRB2
  • Zippy_Zolton/SRB2
  • namiishere/SRB2
  • Ors/SRB2
  • SMS_Alfredo/SRB2
  • sonic_edge/SRB2
  • lavla/SRB2
  • ashi/SRB2
  • X.organic/SRB2
  • Fafabis/SRB2
  • Meziu/SRB2
  • v-rob/SRB2
  • tertu/SRB2
  • bitten2up/SRB2
  • flarn2006/SRB2
  • Krabs/SRB2
  • clairebun/SRB2
  • Lactozilla/SRB2
  • thehackstack/SRB2
  • Spice/SRB2
  • win8linux/SRB2
  • JohnFrostFox/SRB2
  • talktoneon726/SRB2
  • Wane/SRB2
  • Lamibe/SRB2
  • spectrumuk2/srb-2
  • nerdyminer18/srb-2
  • 256nil/SRB2
  • ARJr/SRB2
  • Alam/SRB2
  • Zenya/srb-2-marathon-demos
  • Acelite/srb-2-archivedmodifications
  • MIDIMan/SRB2
  • Lach/SRB2
  • Frostiikin/bounce-tweaks
  • Jaden/SRB2
  • Tyron/SRB2
  • Astronight/SRB2
  • Mari0shi06/SRB2
  • aiire/SRB2
  • Galactice/SRB2
  • srb2-ports/srb2-dreamcast
  • sdasdas/SRB2
  • chreas/srb-2-vr
  • StarManiaKG/the-story-of-sinically-rocketing-and-botching-the-2nd
  • LoganAir/SRB2
  • NepDisk/srb-2
  • alufolie91/SRB2
  • Felicia.iso/SRB2
  • twi/SRB2
  • BarrelsOFun/SRB2
  • Speed2411/SRB2
  • Leather_Realms/SRB2
  • Ayemar/SRB2
  • Acelite/SRB2
  • VladDoc/SRB2
  • kaldrum/model-features
  • strawberryfox417/SRB2
  • Lugent/SRB2
  • Jisk/SRB2
  • Rem/SRB2
  • Refrag/SRB2
  • Henry_3230/srb-3230
  • TehPuertoRicanSpartan2/tprs-srb2
  • Leminn/srb-2-marathon-stuff
  • chromaticpipe2/SRB2
  • MiguelGustavo15/SRB2
  • Maru/srb-2-tests
  • SilicDev/SRB2
  • UnmatchedBracket/SRB2
  • HybridDog/SRB2
  • xordspar0/SRB2
  • jsjhbewfhh/SRB2
  • Fancy2209/SRB2
  • Lorsoen/SRB2
  • shindoukin/SRB2
  • GamerOfDays/SRB2
  • Craftyawesome/SRB2
  • tenshi-tensai-tennoji/SRB2
  • Scarfdudebalder/SRB2
  • luigi-budd/srb-2-fix-interplag-lockon
  • mskluesner/SRB2
  • johnpetersa19/SRB2
  • Pheazant/SRB2
  • chromaticpipe2/srb2classic
  • romoney5/SRB2
  • PAS/SRB2Classic
  • BlueStaggo/SRB2
117 results
Select Git revision
Show changes
Commits on Source (1)
=============================================================================== ===============================================================================
Universal Doom Map Format Sonic Robo Blast 2 extensions v1.0 19.02.2024 Universal Doom Map Format Sonic Robo Blast 2 extensions v1.1 03.05.2024
Copyright (c) 2024 Sonic Team Junior Copyright (c) 2024 Sonic Team Junior
uses Universal Doom Map Format Specification v1.1 as a template, uses Universal Doom Map Format Specification v1.1 as a template,
...@@ -80,6 +80,7 @@ Sonic Robo Blast 2 defines the following standardized fields: ...@@ -80,6 +80,7 @@ Sonic Robo Blast 2 defines the following standardized fields:
noskew = <bool>; // Middle texture is not skewed. noskew = <bool>; // Middle texture is not skewed.
midpeg = <bool>; // Middle texture is pegged. midpeg = <bool>; // Middle texture is pegged.
midsolid = <bool>; // Middle texture is solid. midsolid = <bool>; // Middle texture is solid.
clipmidtex = <bool>; // Line's mid textures are clipped to floor and ceiling.
wrapmidtex = <bool>; // Line's mid textures are wrapped. wrapmidtex = <bool>; // Line's mid textures are wrapped.
nonet = <bool>; // Special only takes effect in singleplayer games. nonet = <bool>; // Special only takes effect in singleplayer games.
netonly = <bool>; // Special only takes effect in multiplayer games. netonly = <bool>; // Special only takes effect in multiplayer games.
...@@ -143,6 +144,8 @@ Sonic Robo Blast 2 defines the following standardized fields: ...@@ -143,6 +144,8 @@ Sonic Robo Blast 2 defines the following standardized fields:
offsetx_bottom = <float>; // X offset for lower texture. Default = 0.0. offsetx_bottom = <float>; // X offset for lower texture. Default = 0.0.
offsety_bottom = <float>; // Y offset for lower texture. Default = 0.0. offsety_bottom = <float>; // Y offset for lower texture. Default = 0.0.
clipmidtex = <bool>; // Side's mid textures are clipped to floor and ceiling.
comment = <string>; // A comment. Implementors should attach no special comment = <string>; // A comment. Implementors should attach no special
// semantic meaning to this field. // semantic meaning to this field.
} }
...@@ -305,6 +308,9 @@ Sonic Robo Blast 2 defines the following standardized fields: ...@@ -305,6 +308,9 @@ Sonic Robo Blast 2 defines the following standardized fields:
Changelog Changelog
======================================= =======================================
1.1: 03.05.2024
Added clipmidtex property to lines and sides.
1.0: 19.02.2024 1.0: 19.02.2024
Initial version. Initial version.
......
...@@ -4540,6 +4540,7 @@ const char *const ML_LIST[] = { ...@@ -4540,6 +4540,7 @@ const char *const ML_LIST[] = {
"EFFECT6", "EFFECT6",
"BOUNCY", "BOUNCY",
"TFERLINE", "TFERLINE",
"CLIPMIDTEX",
NULL NULL
}; };
......
...@@ -103,48 +103,53 @@ typedef struct ...@@ -103,48 +103,53 @@ typedef struct
// LineDef attributes. // LineDef attributes.
// //
// Solid, is an obstacle. enum
#define ML_IMPASSIBLE 1 {
// Solid, is an obstacle.
ML_IMPASSIBLE = 1<<0,
// Blocks monsters only. // Blocks monsters only.
#define ML_BLOCKMONSTERS 2 ML_BLOCKMONSTERS = 1<<1,
// Backside will not be present at all if not two sided. // Backside will not be present at all if not two sided.
#define ML_TWOSIDED 4 ML_TWOSIDED = 1<<2,
// If a texture is pegged, the texture will have // If a texture is pegged, the texture will have
// the end exposed to air held constant at the // the end exposed to air held constant at the
// top or bottom of the texture (stairs or pulled // top or bottom of the texture (stairs or pulled
// down things) and will move with a height change // down things) and will move with a height change
// of one of the neighbor sectors. // of one of the neighbor sectors.
// Unpegged textures allways have the first row of // Unpegged textures allways have the first row of
// the texture at the top pixel of the line for both // the texture at the top pixel of the line for both
// top and bottom textures (use next to windows). // top and bottom textures (use next to windows).
// upper texture unpegged // upper texture unpegged
#define ML_DONTPEGTOP 8 ML_DONTPEGTOP = 1<<3,
// lower texture unpegged // lower texture unpegged
#define ML_DONTPEGBOTTOM 16 ML_DONTPEGBOTTOM = 1<<4,
#define ML_SKEWTD 32 ML_SKEWTD = 1<<5,
// Don't let Knuckles climb on this line // Don't let Knuckles climb on this line
#define ML_NOCLIMB 64 ML_NOCLIMB = 1<<6,
#define ML_NOSKEW 128 ML_NOSKEW = 1<<7,
#define ML_MIDPEG 256 ML_MIDPEG = 1<<8,
#define ML_MIDSOLID 512 ML_MIDSOLID = 1<<9,
#define ML_WRAPMIDTEX 1024 ML_WRAPMIDTEX = 1<<10,
#define ML_NETONLY 2048 // Apply effect only in netgames ML_NETONLY = 1<<11, // Apply effect only in netgames
#define ML_NONET 4096 // Apply effect only in single player games ML_NONET = 1<<12, // Apply effect only in single player games
#define ML_EFFECT6 8192 ML_EFFECT6 = 1<<13,
// Bounce off walls! // Bounce off walls!
#define ML_BOUNCY 16384 ML_BOUNCY = 1<<14,
#define ML_TFERLINE 32768 ML_TFERLINE = 1<<15,
ML_CLIPMIDTEX = 1<<16
};
// Sector definition, from editing. // Sector definition, from editing.
typedef struct typedef struct
......
...@@ -1023,7 +1023,7 @@ static void HWR_RenderMidtexture(INT32 gl_midtexture, float cliplow, float cliph ...@@ -1023,7 +1023,7 @@ static void HWR_RenderMidtexture(INT32 gl_midtexture, float cliplow, float cliph
} }
// The cut-off values of a linedef can always be constant, since every line has an absoulute front and or back sector // The cut-off values of a linedef can always be constant, since every line has an absoulute front and or back sector
if (gl_curline->polyseg) if (gl_curline->polyseg && ((gl_linedef->flags & ML_CLIPMIDTEX) || (gl_sidedef->flags & SIDEFLAG_CLIP_MIDTEX)) == 0)
{ {
lowcut = polybottom; lowcut = polybottom;
highcut = polytop; highcut = polytop;
......
...@@ -213,6 +213,7 @@ enum side_e { ...@@ -213,6 +213,7 @@ enum side_e {
side_sector, side_sector,
side_special, side_special,
side_repeatcnt, side_repeatcnt,
side_clipmidtex,
side_text side_text
}; };
...@@ -241,6 +242,7 @@ static const char *const side_opt[] = { ...@@ -241,6 +242,7 @@ static const char *const side_opt[] = {
"sector", "sector",
"special", "special",
"repeatcnt", "repeatcnt",
"clipmidtex",
"text", "text",
NULL}; NULL};
...@@ -1311,6 +1313,9 @@ static int side_get(lua_State *L) ...@@ -1311,6 +1313,9 @@ static int side_get(lua_State *L)
case side_repeatcnt: case side_repeatcnt:
lua_pushinteger(L, side->repeatcnt); lua_pushinteger(L, side->repeatcnt);
return 1; return 1;
case side_clipmidtex:
lua_pushinteger(L, side->flags & SIDEFLAG_CLIP_MIDTEX);
return 1;
// TODO: 2.3: Delete // TODO: 2.3: Delete
case side_text: case side_text:
{ {
...@@ -1413,6 +1418,12 @@ static int side_set(lua_State *L) ...@@ -1413,6 +1418,12 @@ static int side_set(lua_State *L)
case side_repeatcnt: case side_repeatcnt:
side->repeatcnt = luaL_checkinteger(L, 3); side->repeatcnt = luaL_checkinteger(L, 3);
break; break;
case side_clipmidtex:
if (luaL_checkboolean(L, 3))
side->flags |= SIDEFLAG_CLIP_MIDTEX;
else
side->flags &= ~SIDEFLAG_CLIP_MIDTEX;
break;
} }
return 0; return 0;
} }
......
...@@ -1393,6 +1393,8 @@ static UINT32 GetSideDiff(const side_t *si, const side_t *spawnsi) ...@@ -1393,6 +1393,8 @@ static UINT32 GetSideDiff(const side_t *si, const side_t *spawnsi)
diff |= LD_SDBOTSCALEY; diff |= LD_SDBOTSCALEY;
if (si->repeatcnt != spawnsi->repeatcnt) if (si->repeatcnt != spawnsi->repeatcnt)
diff |= LD_SDREPEATCNT; diff |= LD_SDREPEATCNT;
if (si->flags != spawnsi->flags)
diff |= LD_SDFLAGS;
return diff; return diff;
} }
...@@ -1436,6 +1438,8 @@ static void ArchiveSide(const side_t *si, UINT32 diff) ...@@ -1436,6 +1438,8 @@ static void ArchiveSide(const side_t *si, UINT32 diff)
WRITEFIXED(save_p, si->scaley_bottom); WRITEFIXED(save_p, si->scaley_bottom);
if (diff & LD_SDREPEATCNT) if (diff & LD_SDREPEATCNT)
WRITEINT16(save_p, si->repeatcnt); WRITEINT16(save_p, si->repeatcnt);
if (diff & LD_SDFLAGS)
WRITEUINT16(save_p, si->flags);
} }
static void ArchiveLines(void) static void ArchiveLines(void)
...@@ -1493,7 +1497,7 @@ static void ArchiveLines(void) ...@@ -1493,7 +1497,7 @@ static void ArchiveLines(void)
if (diff & LD_DIFF2) if (diff & LD_DIFF2)
WRITEUINT8(save_p, diff2); WRITEUINT8(save_p, diff2);
if (diff & LD_FLAG) if (diff & LD_FLAG)
WRITEINT16(save_p, li->flags); WRITEUINT32(save_p, li->flags);
if (diff & LD_SPECIAL) if (diff & LD_SPECIAL)
WRITEINT16(save_p, li->special); WRITEINT16(save_p, li->special);
if (diff & LD_CLLCOUNT) if (diff & LD_CLLCOUNT)
...@@ -1576,6 +1580,8 @@ static void UnArchiveSide(side_t *si) ...@@ -1576,6 +1580,8 @@ static void UnArchiveSide(side_t *si)
si->scaley_bottom = READFIXED(save_p); si->scaley_bottom = READFIXED(save_p);
if (diff & LD_SDREPEATCNT) if (diff & LD_SDREPEATCNT)
si->repeatcnt = READINT16(save_p); si->repeatcnt = READINT16(save_p);
if (diff & LD_SDFLAGS)
si->flags = READUINT16(save_p);
} }
static void UnArchiveLines(void) static void UnArchiveLines(void)
...@@ -1601,7 +1607,7 @@ static void UnArchiveLines(void) ...@@ -1601,7 +1607,7 @@ static void UnArchiveLines(void)
li = &lines[i]; li = &lines[i];
if (diff & LD_FLAG) if (diff & LD_FLAG)
li->flags = READINT16(save_p); li->flags = READUINT32(save_p);
if (diff & LD_SPECIAL) if (diff & LD_SPECIAL)
li->special = READINT16(save_p); li->special = READINT16(save_p);
if (diff & LD_CLLCOUNT) if (diff & LD_CLLCOUNT)
......
...@@ -1363,6 +1363,8 @@ static void P_LoadSidedefs(UINT8 *data) ...@@ -1363,6 +1363,8 @@ static void P_LoadSidedefs(UINT8 *data)
sd->scalex_top = sd->scalex_mid = sd->scalex_bottom = FRACUNIT; sd->scalex_top = sd->scalex_mid = sd->scalex_bottom = FRACUNIT;
sd->scaley_top = sd->scaley_mid = sd->scaley_bottom = FRACUNIT; sd->scaley_top = sd->scaley_mid = sd->scaley_bottom = FRACUNIT;
sd->flags = 0;
P_SetSidedefSector(i, (UINT16)SHORT(msd->sector)); P_SetSidedefSector(i, (UINT16)SHORT(msd->sector));
// Special info stored in texture fields! // Special info stored in texture fields!
...@@ -1943,6 +1945,8 @@ static void ParseTextmapSidedefParameter(UINT32 i, const char *param, const char ...@@ -1943,6 +1945,8 @@ static void ParseTextmapSidedefParameter(UINT32 i, const char *param, const char
P_SetSidedefSector(i, atol(val)); P_SetSidedefSector(i, atol(val));
else if (fastcmp(param, "repeatcnt")) else if (fastcmp(param, "repeatcnt"))
sides[i].repeatcnt = atol(val); sides[i].repeatcnt = atol(val);
else if (fastcmp(param, "clipmidtex") && fastcmp("true", val))
sides[i].flags |= SIDEFLAG_CLIP_MIDTEX;
} }
static void ParseTextmapLinedefParameter(UINT32 i, const char *param, const char *val) static void ParseTextmapLinedefParameter(UINT32 i, const char *param, const char *val)
...@@ -2025,10 +2029,10 @@ static void ParseTextmapLinedefParameter(UINT32 i, const char *param, const char ...@@ -2025,10 +2029,10 @@ static void ParseTextmapLinedefParameter(UINT32 i, const char *param, const char
lines[i].flags |= ML_MIDPEG; lines[i].flags |= ML_MIDPEG;
else if (fastcmp(param, "midsolid") && fastcmp("true", val)) else if (fastcmp(param, "midsolid") && fastcmp("true", val))
lines[i].flags |= ML_MIDSOLID; lines[i].flags |= ML_MIDSOLID;
else if (fastcmp(param, "clipmidtex") && fastcmp("true", val))
lines[i].flags |= ML_CLIPMIDTEX;
else if (fastcmp(param, "wrapmidtex") && fastcmp("true", val)) else if (fastcmp(param, "wrapmidtex") && fastcmp("true", val))
lines[i].flags |= ML_WRAPMIDTEX; lines[i].flags |= ML_WRAPMIDTEX;
/*else if (fastcmp(param, "effect6") && fastcmp("true", val))
lines[i].flags |= ML_EFFECT6;*/
else if (fastcmp(param, "nonet") && fastcmp("true", val)) else if (fastcmp(param, "nonet") && fastcmp("true", val))
lines[i].flags |= ML_NONET; lines[i].flags |= ML_NONET;
else if (fastcmp(param, "netonly") && fastcmp("true", val)) else if (fastcmp(param, "netonly") && fastcmp("true", val))
...@@ -2615,6 +2619,8 @@ static void P_WriteTextmap(void) ...@@ -2615,6 +2619,8 @@ static void P_WriteTextmap(void)
fprintf(f, "midpeg = true;\n"); fprintf(f, "midpeg = true;\n");
if (wlines[i].flags & ML_MIDSOLID) if (wlines[i].flags & ML_MIDSOLID)
fprintf(f, "midsolid = true;\n"); fprintf(f, "midsolid = true;\n");
if (wlines[i].flags & ML_CLIPMIDTEX)
fprintf(f, "clipmidtex = true;\n");
if (wlines[i].flags & ML_WRAPMIDTEX) if (wlines[i].flags & ML_WRAPMIDTEX)
fprintf(f, "wrapmidtex = true;\n"); fprintf(f, "wrapmidtex = true;\n");
if (wlines[i].flags & ML_NONET) if (wlines[i].flags & ML_NONET)
...@@ -2670,6 +2676,8 @@ static void P_WriteTextmap(void) ...@@ -2670,6 +2676,8 @@ static void P_WriteTextmap(void)
fprintf(f, "texturemiddle = \"%.*s\";\n", 8, textures[wsides[i].midtexture]->name); fprintf(f, "texturemiddle = \"%.*s\";\n", 8, textures[wsides[i].midtexture]->name);
if (wsides[i].repeatcnt != 0) if (wsides[i].repeatcnt != 0)
fprintf(f, "repeatcnt = %d;\n", wsides[i].repeatcnt); fprintf(f, "repeatcnt = %d;\n", wsides[i].repeatcnt);
if (wsides[i].flags & SIDEFLAG_CLIP_MIDTEX)
fprintf(f, "clipmidtex = true;\n");
fprintf(f, "}\n"); fprintf(f, "}\n");
fprintf(f, "\n"); fprintf(f, "\n");
} }
...@@ -3072,6 +3080,7 @@ static void P_LoadTextmap(void) ...@@ -3072,6 +3080,7 @@ static void P_LoadTextmap(void)
sd->bottomtexture = R_TextureNumForName("-"); sd->bottomtexture = R_TextureNumForName("-");
sd->sector = NULL; sd->sector = NULL;
sd->repeatcnt = 0; sd->repeatcnt = 0;
sd->flags = 0;
TextmapParse(sidesPos[i], i, ParseTextmapSidedefParameter); TextmapParse(sidesPos[i], i, ParseTextmapSidedefParameter);
......
...@@ -584,7 +584,7 @@ typedef struct line_s ...@@ -584,7 +584,7 @@ typedef struct line_s
angle_t angle; // Precalculated angle between dx and dy angle_t angle; // Precalculated angle between dx and dy
// Animation related. // Animation related.
INT16 flags; UINT32 flags;
INT16 special; INT16 special;
taglist_t tags; taglist_t tags;
INT32 args[NUMLINEARGS]; INT32 args[NUMLINEARGS];
...@@ -614,6 +614,12 @@ typedef struct line_s ...@@ -614,6 +614,12 @@ typedef struct line_s
UINT32 secportal; // transferred sector portal UINT32 secportal; // transferred sector portal
} line_t; } line_t;
// Don't make available to Lua or I will find where you live
typedef enum
{
SIDEFLAG_CLIP_MIDTEX = 1 << 0, // Like the line counterpart, but only for this side.
} sideflags_t;
typedef struct typedef struct
{ {
// add this to the calculated texture column // add this to the calculated texture column
...@@ -622,13 +628,16 @@ typedef struct ...@@ -622,13 +628,16 @@ 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 // per-texture offsets
fixed_t offsetx_top, offsetx_mid, offsetx_bottom; fixed_t offsetx_top, offsetx_mid, offsetx_bottom;
fixed_t offsety_top, offsety_mid, offsety_bottom; fixed_t offsety_top, offsety_mid, offsety_bottom;
fixed_t scalex_top, scalex_mid, scalex_bottom; fixed_t scalex_top, scalex_mid, scalex_bottom;
fixed_t scaley_top, scaley_mid, scaley_bottom; fixed_t scaley_top, scaley_mid, scaley_bottom;
// Rendering-related flags
UINT16 flags;
// Texture indices. // Texture indices.
// We do not maintain names here. // We do not maintain names here.
INT32 toptexture, bottomtexture, midtexture; INT32 toptexture, bottomtexture, midtexture;
......
...@@ -114,6 +114,8 @@ void R_RenderMaskedSegRange(drawseg_t *ds, INT32 x1, INT32 x2) ...@@ -114,6 +114,8 @@ void R_RenderMaskedSegRange(drawseg_t *ds, INT32 x1, INT32 x2)
fixed_t wall_scaley; fixed_t wall_scaley;
fixed_t scalestep; fixed_t scalestep;
fixed_t scale1; fixed_t scale1;
fixed_t texture_top, texture_bottom, texture_height;
boolean clipmidtex;
// Calculate light table. // Calculate light table.
// Use different light tables // Use different light tables
...@@ -276,6 +278,9 @@ void R_RenderMaskedSegRange(drawseg_t *ds, INT32 x1, INT32 x2) ...@@ -276,6 +278,9 @@ void R_RenderMaskedSegRange(drawseg_t *ds, INT32 x1, INT32 x2)
else else
back = backsector; back = backsector;
clipmidtex = (ldef->flags & ML_CLIPMIDTEX) || (sidedef->flags & SIDEFLAG_CLIP_MIDTEX);
texture_height = FixedDiv(textureheight[texnum], wall_scaley);
if (sidedef->repeatcnt) if (sidedef->repeatcnt)
repeats = 1 + sidedef->repeatcnt; repeats = 1 + sidedef->repeatcnt;
else if (ldef->flags & ML_WRAPMIDTEX) else if (ldef->flags & ML_WRAPMIDTEX)
...@@ -292,8 +297,8 @@ void R_RenderMaskedSegRange(drawseg_t *ds, INT32 x1, INT32 x2) ...@@ -292,8 +297,8 @@ void R_RenderMaskedSegRange(drawseg_t *ds, INT32 x1, INT32 x2)
else else
low = back->floorheight; low = back->floorheight;
repeats = (high - low)/textureheight[texnum]; repeats = (high - low)/texture_height;
if ((high-low)%textureheight[texnum]) if ((high-low)%texture_height)
repeats++; // tile an extra time to fill the gap -- Monster Iestyn repeats++; // tile an extra time to fill the gap -- Monster Iestyn
} }
else else
...@@ -301,6 +306,33 @@ void R_RenderMaskedSegRange(drawseg_t *ds, INT32 x1, INT32 x2) ...@@ -301,6 +306,33 @@ void R_RenderMaskedSegRange(drawseg_t *ds, INT32 x1, INT32 x2)
for (times = 0; times < repeats; times++) for (times = 0; times < repeats; times++)
{ {
fixed_t left_top = 0, left_bottom = 0;
fixed_t right_top = 0, right_bottom = 0;
fixed_t top_step = 0, bottom_step = 0;
// Get left and right ends of wall for clipping it
if (clipmidtex)
{
// For this to work correctly with polyobjects, it needs to use its own back sector, rather than the seg's front sector
sector_t *sec_front = curline->polyseg ?
curline->polyseg->lines[0]->backsector :
frontsector;
// calculate both left ends
left_top = P_GetSectorCeilingZAt(sec_front, ds->leftpos.x, ds->leftpos.y) - viewz;
left_bottom = P_GetSectorFloorZAt(sec_front, ds->leftpos.x, ds->leftpos.y) - viewz;
// calculate right ends now
right_top = P_GetSectorCeilingZAt(sec_front, ds->rightpos.x, ds->rightpos.y) - viewz;
right_bottom = P_GetSectorFloorZAt(sec_front, ds->rightpos.x, ds->rightpos.y) - viewz;
top_step = (right_top - left_top) / range;
bottom_step = (right_bottom - left_bottom) / range;
left_top += top_step * (x1 - ds->x1);
left_bottom += bottom_step * (x1 - ds->x1);
}
if (times > 0) if (times > 0)
{ {
rw_scalestep = scalestep; rw_scalestep = scalestep;
...@@ -321,7 +353,7 @@ void R_RenderMaskedSegRange(drawseg_t *ds, INT32 x1, INT32 x2) ...@@ -321,7 +353,7 @@ void R_RenderMaskedSegRange(drawseg_t *ds, INT32 x1, INT32 x2)
{ {
dc_texturemid = ds->maskedtextureheight[dc_x]; dc_texturemid = ds->maskedtextureheight[dc_x];
if (curline->linedef->flags & ML_MIDPEG) if (ldef->flags & ML_MIDPEG)
dc_texturemid += (textureheight[texnum])*times + textureheight[texnum]; dc_texturemid += (textureheight[texnum])*times + textureheight[texnum];
else else
dc_texturemid -= (textureheight[texnum])*times; dc_texturemid -= (textureheight[texnum])*times;
...@@ -341,29 +373,53 @@ void R_RenderMaskedSegRange(drawseg_t *ds, INT32 x1, INT32 x2) ...@@ -341,29 +373,53 @@ void R_RenderMaskedSegRange(drawseg_t *ds, INT32 x1, INT32 x2)
} }
} }
spryscale += rw_scalestep; spryscale += rw_scalestep;
if (clipmidtex)
{
left_top += top_step;
left_bottom += bottom_step;
}
continue; continue;
} }
// calculate lighting texture_top = dc_texturemid;
if (dc_numlights) texture_bottom = texture_top - texture_height;
// If the texture is meant to be clipped
if (clipmidtex)
{ {
lighttable_t **xwalllights; texture_top = min(FixedMul(left_top, wall_scaley), texture_top);
texture_bottom = max(FixedMul(left_bottom, wall_scaley), texture_bottom);
sprtopscreen = windowtop = (centeryfrac - FixedMul(dc_texturemid, spryscale)); left_top += top_step;
left_bottom += bottom_step;
}
realbot = FixedMul(textureheight[texnum], spryscale) + sprtopscreen; // NB: sprtopscreen needs to start where dc_texturemid does, so that R_DrawMaskedColumn works correctly.
dc_iscale = FixedMul(ds->invscale[dc_x], wall_scaley); // windowtop however is set so that the column gets clipped properly.
sprtopscreen = centeryfrac - FixedMul(dc_texturemid, spryscale);
realbot = centeryfrac - FixedMul(texture_bottom, spryscale);
// set wall bounds if necessary
if (dc_numlights || clipmidtex)
{
windowtop = centeryfrac - FixedMul(texture_top, spryscale);
windowbottom = realbot; windowbottom = realbot;
}
// draw the texture dc_iscale = FixedMul(ds->invscale[dc_x], wall_scaley);
col = R_GetColumn(texnum, maskedtexturecol[dc_x] >> FRACBITS);
col = R_GetColumn(texnum, maskedtexturecol[dc_x] >> FRACBITS);
// draw light list if there is one
if (dc_numlights)
{
for (i = 0; i < dc_numlights; i++) for (i = 0; i < dc_numlights; i++)
{ {
lighttable_t **xwalllights;
rlight = &dc_lightlist[i]; rlight = &dc_lightlist[i];
if ((rlight->flags & FOF_NOSHADE)) if (rlight->flags & FOF_NOSHADE)
continue; continue;
if (rlight->lightnum < 0) if (rlight->lightnum < 0)
...@@ -373,7 +429,7 @@ void R_RenderMaskedSegRange(drawseg_t *ds, INT32 x1, INT32 x2) ...@@ -373,7 +429,7 @@ void R_RenderMaskedSegRange(drawseg_t *ds, INT32 x1, INT32 x2)
else else
xwalllights = scalelight[rlight->lightnum]; xwalllights = scalelight[rlight->lightnum];
pindex = FixedMul(spryscale, LIGHTRESOLUTIONFIX)>>LIGHTSCALESHIFT; pindex = FixedMul(FixedMul(spryscale, wall_scaley), LIGHTRESOLUTIONFIX)>>LIGHTSCALESHIFT;
if (pindex >= MAXLIGHTSCALE) if (pindex >= MAXLIGHTSCALE)
pindex = MAXLIGHTSCALE - 1; pindex = MAXLIGHTSCALE - 1;
...@@ -418,7 +474,7 @@ void R_RenderMaskedSegRange(drawseg_t *ds, INT32 x1, INT32 x2) ...@@ -418,7 +474,7 @@ void R_RenderMaskedSegRange(drawseg_t *ds, INT32 x1, INT32 x2)
} }
// calculate lighting // calculate lighting
pindex = FixedMul(spryscale, LIGHTRESOLUTIONFIX)>>LIGHTSCALESHIFT; pindex = FixedMul(FixedMul(spryscale, wall_scaley), LIGHTRESOLUTIONFIX)>>LIGHTSCALESHIFT;
if (pindex >= MAXLIGHTSCALE) if (pindex >= MAXLIGHTSCALE)
pindex = MAXLIGHTSCALE - 1; pindex = MAXLIGHTSCALE - 1;
...@@ -428,11 +484,7 @@ void R_RenderMaskedSegRange(drawseg_t *ds, INT32 x1, INT32 x2) ...@@ -428,11 +484,7 @@ void R_RenderMaskedSegRange(drawseg_t *ds, INT32 x1, INT32 x2)
if (frontsector->extra_colormap) if (frontsector->extra_colormap)
dc_colormap = frontsector->extra_colormap->colormap + (dc_colormap - colormaps); dc_colormap = frontsector->extra_colormap->colormap + (dc_colormap - colormaps);
sprtopscreen = centeryfrac - FixedMul(dc_texturemid, spryscale);
dc_iscale = FixedMul(ds->invscale[dc_x], wall_scaley);
// draw the texture // draw the texture
col = R_GetColumn(texnum, maskedtexturecol[dc_x] >> FRACBITS);
colfunc_2s(col, lengthcol); colfunc_2s(col, lengthcol);
spryscale += rw_scalestep; spryscale += rw_scalestep;
......