mirror of
https://git.do.srb2.org/STJr/SRB2.git
synced 2024-11-25 13:51:43 +00:00
Add repeatcnt field to edge textures
This commit is contained in:
parent
c810e662e4
commit
4ea0eebb1e
6 changed files with 88 additions and 63 deletions
|
@ -1,5 +1,5 @@
|
|||
===============================================================================
|
||||
Universal Doom Map Format Sonic Robo Blast 2 extensions v1.1 02.05.2024
|
||||
Universal Doom Map Format Sonic Robo Blast 2 extensions v1.1 23.05.2024
|
||||
|
||||
Copyright (c) 2024 Sonic Team Junior
|
||||
uses Universal Doom Map Format Specification v1.1 as a template,
|
||||
|
@ -127,7 +127,7 @@ Sonic Robo Blast 2 defines the following standardized fields:
|
|||
texturebottom = <string>; // Lower texture. Default = "-".
|
||||
texturemiddle = <string>; // Middle texture. Default = "-".
|
||||
|
||||
repeatcnt = <string>; // Number of middle texture repetitions. Default = 0
|
||||
repeatcnt = <integer>; // Number of middle texture repetitions. Default = 0.
|
||||
|
||||
sector = <integer>; // Sector index. No valid default.
|
||||
|
||||
|
@ -152,8 +152,9 @@ Sonic Robo Blast 2 defines the following standardized fields:
|
|||
edge_top_upper_offsety = <float>; // Y offset for the top edge of the upper wall. Default = 0.0.
|
||||
edge_top_upper_scalex = <float>; // X scale for the top edge of the upper wall. Default = 1.0.
|
||||
edge_top_upper_scaley = <float>; // Y scale for the top edge of the upper wall. Default = 1.0.
|
||||
edge_top_upper_repeatcnt = <integer>; // Number of texture repetitions. Default = 0.
|
||||
edge_top_upper_noskew = <bool>; // Disables skewing of the top edge of the upper wall.
|
||||
edge_top_upper_noclip = <bool>; // Top edge texture extends outside the upper wall (displays like a mid texture.)
|
||||
edge_top_upper_noclip = <bool>; // Top edge texture extends outside the 3D floor wall (displays like a mid texture.)
|
||||
edge_top_upper_wrap = <bool>; // Top edge texture of the upper wall wraps.
|
||||
edge_top_upper_alpha = <float>; // Translucency of this edge. Default is 1.0
|
||||
edge_top_upper_renderstyle = <string>; // Render style of this edge. Can be "translucent", "add", "subtract",
|
||||
|
@ -164,8 +165,9 @@ Sonic Robo Blast 2 defines the following standardized fields:
|
|||
edge_top_lower_offsety = <float>; // Y offset for the bottom edge of the upper wall. Default = 0.0.
|
||||
edge_top_lower_scalex = <float>; // X scale for the bottom edge of the upper wall. Default = 1.0.
|
||||
edge_top_lower_scaley = <float>; // Y scale for the bottom edge of the upper wall. Default = 1.0.
|
||||
edge_top_lower_repeatcnt = <integer>; // Number of texture repetitions. Default = 0.
|
||||
edge_top_lower_noskew = <bool>; // Disables skewing of the bottom edge of the upper wall.
|
||||
edge_top_lower_noclip = <bool>; // Bottom edge texture extends outside the upper wall (displays like a mid texture.)
|
||||
edge_top_lower_noclip = <bool>; // Bottom edge texture extends outside the 3D floor wall (displays like a mid texture.)
|
||||
edge_top_lower_wrap = <bool>; // Bottom edge texture of the upper wall wraps.
|
||||
edge_top_lower_alpha = <float>; // Translucency of this edge. Default is 1.0
|
||||
edge_top_lower_renderstyle = <string>; // Render style of this edge. Can be "translucent", "add", "subtract",
|
||||
|
@ -176,8 +178,9 @@ Sonic Robo Blast 2 defines the following standardized fields:
|
|||
edge_bottom_upper_offsety = <float>; // Y offset for the top edge of the lower wall. Default = 0.0.
|
||||
edge_bottom_upper_scalex = <float>; // X scale for the top edge of the lower wall. Default = 1.0.
|
||||
edge_bottom_upper_scaley = <float>; // Y scale for the top edge of the lower wall. Default = 1.0.
|
||||
edge_bottom_upper_repeatcnt = <integer>; // Number of texture repetitions. Default = 0.
|
||||
edge_bottom_upper_noskew = <bool>; // Disables skewing of the top edge of the lower wall.
|
||||
edge_bottom_upper_noclip = <bool>; // Top edge texture extends outside the lower wall (displays like a mid texture.)
|
||||
edge_bottom_upper_noclip = <bool>; // Top edge texture extends outside the 3D floor wall (displays like a mid texture.)
|
||||
edge_bottom_upper_wrap = <bool>; // Top edge texture of the lower wall wraps.
|
||||
edge_bottom_upper_alpha = <float>; // Translucency of this edge. Default is 1.0
|
||||
edge_bottom_upper_renderstyle = <string>; // Render style of this edge. Can be "translucent", "add", "subtract",
|
||||
|
@ -188,8 +191,9 @@ Sonic Robo Blast 2 defines the following standardized fields:
|
|||
edge_bottom_lower_offsety = <float>; // Y offset for the bottom edge of the lower wall. Default = 0.0.
|
||||
edge_bottom_lower_scalex = <float>; // X scale for the bottom edge of the lower wall. Default = 1.0.
|
||||
edge_bottom_lower_scaley = <float>; // Y scale for the bottom edge of the lower wall. Default = 1.0.
|
||||
edge_bottom_lower_repeatcnt = <integer>; // Number of texture repetitions. Default = 0.
|
||||
edge_bottom_lower_noskew = <bool>; // Disables skewing of the bottom edge of the lower wall.
|
||||
edge_bottom_lower_noclip = <bool>; // Bottom edge texture extends outside the lower wall (displays like a mid texture.)
|
||||
edge_bottom_lower_noclip = <bool>; // Bottom edge texture extends outside the 3D floor wall (displays like a mid texture.)
|
||||
edge_bottom_lower_wrap = <bool>; // Bottom edge texture of the lower wall wraps.
|
||||
edge_bottom_lower_alpha = <float>; // Translucency of this edge. Default is 1.0
|
||||
edge_bottom_lower_renderstyle = <string>; // Render style of this edge. Can be "translucent", "add", "subtract",
|
||||
|
@ -357,7 +361,7 @@ Sonic Robo Blast 2 defines the following standardized fields:
|
|||
Changelog
|
||||
=======================================
|
||||
|
||||
1.1: 02.05.2024
|
||||
1.1: 23.05.2024
|
||||
Added edge texture properties.
|
||||
Added clipmidtex property to lines and sides.
|
||||
Added wrapmidtex property to sides.
|
||||
|
|
|
@ -1485,6 +1485,7 @@ enum sideoverlay_e {
|
|||
sideoverlay_offsety,
|
||||
sideoverlay_scalex,
|
||||
sideoverlay_scaley,
|
||||
sideoverlay_repeatcnt,
|
||||
sideoverlay_alpha,
|
||||
sideoverlay_blendmode,
|
||||
sideoverlay_noskew,
|
||||
|
@ -1499,6 +1500,7 @@ static const char *const sideoverlay_opt[] = {
|
|||
"offsety",
|
||||
"scalex",
|
||||
"scaley",
|
||||
"repeatcnt",
|
||||
"alpha",
|
||||
"blendmode",
|
||||
"noskew",
|
||||
|
@ -1542,6 +1544,9 @@ static int sideoverlay_get(lua_State *L)
|
|||
case sideoverlay_scaley:
|
||||
lua_pushfixed(L, overlay->scaley);
|
||||
return 1;
|
||||
case sideoverlay_repeatcnt:
|
||||
lua_pushinteger(L, overlay->repeatcnt);
|
||||
return 1;
|
||||
case sideoverlay_alpha:
|
||||
lua_pushfixed(L, overlay->alpha);
|
||||
return 1;
|
||||
|
@ -1598,6 +1603,9 @@ static int sideoverlay_set(lua_State *L)
|
|||
case sideoverlay_scaley:
|
||||
overlay->scaley = luaL_checkfixed(L, 3);
|
||||
break;
|
||||
case sideoverlay_repeatcnt:
|
||||
overlay->repeatcnt = luaL_checkinteger(L, 3);
|
||||
break;
|
||||
case sideoverlay_alpha:
|
||||
overlay->alpha = min(max(0, luaL_checkfixed(L, 3)), FRACUNIT);
|
||||
break;
|
||||
|
|
|
@ -934,9 +934,10 @@ enum
|
|||
LD_EDGEOFFY = 1<<2,
|
||||
LD_EDGESCALEX = 1<<3,
|
||||
LD_EDGESCALEY = 1<<4,
|
||||
LD_EDGEALPHA = 1<<5,
|
||||
LD_EDGEBLEND = 1<<6,
|
||||
LD_EDGEFLAGS = 1<<7
|
||||
LD_EDGEREPEAT = 1<<5,
|
||||
LD_EDGEALPHA = 1<<6,
|
||||
LD_EDGEBLEND = 1<<7,
|
||||
LD_EDGEFLAGS = 1<<8
|
||||
};
|
||||
|
||||
static boolean P_AreArgsEqual(const line_t *li, const line_t *spawnli)
|
||||
|
@ -1370,9 +1371,9 @@ static void UnArchiveSectors(void)
|
|||
}
|
||||
}
|
||||
|
||||
static UINT8 GetSideEdgeDiff(const side_overlay_t *edge, const side_overlay_t *spawnedge)
|
||||
static UINT16 GetSideEdgeDiff(const side_overlay_t *edge, const side_overlay_t *spawnedge)
|
||||
{
|
||||
UINT8 diff = 0;
|
||||
UINT16 diff = 0;
|
||||
if (edge->texture != spawnedge->texture)
|
||||
diff |= LD_EDGETEX;
|
||||
if (edge->offsetx != spawnedge->offsetx)
|
||||
|
@ -1383,6 +1384,8 @@ static UINT8 GetSideEdgeDiff(const side_overlay_t *edge, const side_overlay_t *s
|
|||
diff |= LD_EDGESCALEX;
|
||||
if (edge->scaley != spawnedge->scaley)
|
||||
diff |= LD_EDGESCALEY;
|
||||
if (edge->repeatcnt != spawnedge->repeatcnt)
|
||||
diff |= LD_EDGEREPEAT;
|
||||
if (edge->alpha != spawnedge->alpha)
|
||||
diff |= LD_EDGEALPHA;
|
||||
if (edge->blendmode != spawnedge->blendmode)
|
||||
|
@ -1392,13 +1395,13 @@ static UINT8 GetSideEdgeDiff(const side_overlay_t *edge, const side_overlay_t *s
|
|||
return diff;
|
||||
}
|
||||
|
||||
static void GetAllSideEdgeDiff(const side_t *si, const side_t *spawnsi, UINT8 edgediff[4])
|
||||
static void GetAllSideEdgeDiff(const side_t *si, const side_t *spawnsi, UINT16 edgediff[4])
|
||||
{
|
||||
for (unsigned i = 0; i < NUM_WALL_OVERLAYS; i++)
|
||||
edgediff[i] = GetSideEdgeDiff(&si->overlays[i], &spawnsi->overlays[i]);
|
||||
}
|
||||
|
||||
static UINT32 GetSideDiff(const side_t *si, const side_t *spawnsi, UINT8 edgediff[4])
|
||||
static UINT32 GetSideDiff(const side_t *si, const side_t *spawnsi, UINT16 edgediff[4])
|
||||
{
|
||||
UINT32 diff = 0;
|
||||
if (si->textureoffset != spawnsi->textureoffset)
|
||||
|
@ -1451,9 +1454,9 @@ static UINT32 GetSideDiff(const side_t *si, const side_t *spawnsi, UINT8 edgedif
|
|||
return diff;
|
||||
}
|
||||
|
||||
static void ArchiveSideEdge(const side_overlay_t *edge, UINT8 diff)
|
||||
static void ArchiveSideEdge(const side_overlay_t *edge, UINT16 diff)
|
||||
{
|
||||
WRITEUINT8(save_p, diff);
|
||||
WRITEUINT16(save_p, diff);
|
||||
|
||||
if (diff & LD_EDGETEX)
|
||||
WRITEINT32(save_p, edge->texture);
|
||||
|
@ -1465,6 +1468,8 @@ static void ArchiveSideEdge(const side_overlay_t *edge, UINT8 diff)
|
|||
WRITEFIXED(save_p, edge->scalex);
|
||||
if (diff & LD_EDGESCALEY)
|
||||
WRITEFIXED(save_p, edge->scaley);
|
||||
if (diff & LD_EDGEREPEAT)
|
||||
WRITEINT16(save_p, edge->repeatcnt);
|
||||
if (diff & LD_EDGEALPHA)
|
||||
WRITEFIXED(save_p, edge->alpha);
|
||||
if (diff & LD_EDGEBLEND)
|
||||
|
@ -1473,7 +1478,7 @@ static void ArchiveSideEdge(const side_overlay_t *edge, UINT8 diff)
|
|||
WRITEUINT8(save_p, edge->flags);
|
||||
}
|
||||
|
||||
static void ArchiveSide(const side_t *si, UINT32 diff, UINT8 edgediff[4])
|
||||
static void ArchiveSide(const side_t *si, UINT32 diff, UINT16 edgediff[4])
|
||||
{
|
||||
WRITEUINT32(save_p, diff);
|
||||
|
||||
|
@ -1536,8 +1541,8 @@ static void ArchiveLines(void)
|
|||
|
||||
for (i = 0; i < numlines; i++, spawnli++, li++)
|
||||
{
|
||||
UINT8 edgediff1[4] = { 0, 0, 0, 0 };
|
||||
UINT8 edgediff2[4] = { 0, 0, 0, 0 };
|
||||
UINT16 edgediff1[4] = { 0, 0, 0, 0 };
|
||||
UINT16 edgediff2[4] = { 0, 0, 0, 0 };
|
||||
|
||||
diff = diff2 = 0;
|
||||
side1diff = side2diff = 0;
|
||||
|
@ -1634,7 +1639,7 @@ static void ArchiveLines(void)
|
|||
|
||||
static void UnArchiveSideEdge(side_overlay_t *edge)
|
||||
{
|
||||
UINT8 diff = READUINT8(save_p);
|
||||
UINT16 diff = READUINT16(save_p);
|
||||
|
||||
if (diff & LD_EDGETEX)
|
||||
edge->texture = READINT32(save_p);
|
||||
|
@ -1646,6 +1651,8 @@ static void UnArchiveSideEdge(side_overlay_t *edge)
|
|||
edge->scalex = READFIXED(save_p);
|
||||
if (diff & LD_EDGESCALEY)
|
||||
edge->scaley = READFIXED(save_p);
|
||||
if (diff & LD_EDGEREPEAT)
|
||||
edge->repeatcnt = READINT16(save_p);
|
||||
if (diff & LD_EDGEALPHA)
|
||||
edge->alpha = READFIXED(save_p);
|
||||
if (diff & LD_EDGEBLEND)
|
||||
|
|
|
@ -1335,6 +1335,7 @@ static void P_InitSideEdges(side_t *sd)
|
|||
sd->overlays[j].texture = R_TextureNumForName("-");
|
||||
sd->overlays[j].offsetx = sd->overlays[j].offsety = 0;
|
||||
sd->overlays[j].scalex = sd->overlays[j].scaley = FRACUNIT;
|
||||
sd->overlays[j].repeatcnt = 0;
|
||||
sd->overlays[j].alpha = FRACUNIT;
|
||||
sd->overlays[j].blendmode = AST_COPY;
|
||||
sd->overlays[j].flags = 0;
|
||||
|
@ -1938,6 +1939,8 @@ static void ParseTextmapSidedefOverlay(unsigned which, UINT32 i, const char *par
|
|||
overlay->scalex = FLOAT_TO_FIXED(atof(val));
|
||||
else if (fastcmp(param, "scaley"))
|
||||
overlay->scaley = FLOAT_TO_FIXED(atof(val));
|
||||
else if (fastcmp(param, "repeatcnt"))
|
||||
overlay->repeatcnt = atol(val);
|
||||
else if (fastcmp(param, "alpha"))
|
||||
overlay->alpha = FLOAT_TO_FIXED(atof(val));
|
||||
else if (fastcmp(param, "renderstyle"))
|
||||
|
@ -2285,6 +2288,8 @@ static void WriteTextmapEdgeTexture(const char *prefix, unsigned i, side_t *side
|
|||
fprintf(f, "%s""scalex = %f;\n", prefix, FIXED_TO_FLOAT(side->overlays[i].scalex));
|
||||
if (side->overlays[i].scaley != FRACUNIT)
|
||||
fprintf(f, "%s""scaley = %f;\n", prefix, FIXED_TO_FLOAT(side->overlays[i].scaley));
|
||||
if (side->overlays[i].repeatcnt != 0)
|
||||
fprintf(f, "%s""repeatcnt = %d;\n", prefix, side->overlays[i].repeatcnt);
|
||||
if (side->overlays[i].alpha != FRACUNIT)
|
||||
fprintf(f, "%s""alpha = %f;\n", prefix, FIXED_TO_FLOAT(side->overlays[i].alpha));
|
||||
if (side->overlays[i].blendmode != AST_COPY)
|
||||
|
|
|
@ -649,6 +649,7 @@ typedef struct
|
|||
INT32 texture;
|
||||
fixed_t offsetx, offsety;
|
||||
fixed_t scalex, scaley;
|
||||
INT16 repeatcnt;
|
||||
UINT8 blendmode;
|
||||
fixed_t alpha;
|
||||
UINT8 flags;
|
||||
|
|
|
@ -123,10 +123,10 @@ transnum_t R_GetLinedefTransTable(fixed_t alpha)
|
|||
|
||||
INT32 R_GetOverlayTextureRepeats(unsigned which, side_t *side, INT32 texnum, sector_t *sec_front, sector_t *sec_back, fixed_t v1x, fixed_t v1y, fixed_t v2x, fixed_t v2y)
|
||||
{
|
||||
INT32 repeats = 1;
|
||||
INT32 repeats = side->overlays[which].repeatcnt;
|
||||
|
||||
if (!(side->overlays[which].flags & SIDEOVERLAYFLAG_WRAP))
|
||||
return repeats;
|
||||
if (repeats > 0 || (side->overlays[which].flags & SIDEOVERLAYFLAG_WRAP) == 0)
|
||||
return max(repeats, 1);
|
||||
|
||||
fixed_t high, low;
|
||||
fixed_t texheight = FixedDiv(textureheight[texnum], abs(side->overlays[which].scaley));
|
||||
|
|
Loading…
Reference in a new issue