Fix tedious mistakes, comment out unused functions

This commit is contained in:
spherallic 2024-06-12 15:38:52 +02:00
parent 5302f0ce59
commit e7dc0506d5
5 changed files with 68 additions and 9 deletions

View file

@ -315,6 +315,7 @@ static FUINT HWR_SideLightLevel(side_t *side, UINT8 base_lightlevel)
((side->lightabsolute) ? 0 : base_lightlevel); ((side->lightabsolute) ? 0 : base_lightlevel);
} }
/* TODO: implement per-texture lighting
static FUINT HWR_TopLightLevel(side_t *side, UINT8 base_lightlevel) static FUINT HWR_TopLightLevel(side_t *side, UINT8 base_lightlevel)
{ {
return side->light_top + return side->light_top +
@ -332,6 +333,7 @@ static FUINT HWR_BottomLightLevel(side_t *side, UINT8 base_lightlevel)
return side->light_bottom + return side->light_bottom +
((side->lightabsolute_bottom) ? 0 : HWR_SideLightLevel(side, base_lightlevel)); ((side->lightabsolute_bottom) ? 0 : HWR_SideLightLevel(side, base_lightlevel));
} }
*/
// ========================================================================== // ==========================================================================
// FLOOR/CEILING GENERATION FROM SUBSECTORS // FLOOR/CEILING GENERATION FROM SUBSECTORS

View file

@ -1454,16 +1454,16 @@ static int side_set(lua_State *L)
side->repeatcnt = luaL_checkinteger(L, 3); side->repeatcnt = luaL_checkinteger(L, 3);
break; break;
case side_light: case side_light:
side->repeatcnt = luaL_checkinteger(L, 3); side->light = luaL_checkinteger(L, 3);
break; break;
case side_light_top: case side_light_top:
side->repeatcnt = luaL_checkinteger(L, 3); side->light_top = luaL_checkinteger(L, 3);
break; break;
case side_light_mid: case side_light_mid:
side->repeatcnt = luaL_checkinteger(L, 3); side->light_mid = luaL_checkinteger(L, 3);
break; break;
case side_light_bottom: case side_light_bottom:
side->repeatcnt = luaL_checkinteger(L, 3); side->light_bottom = luaL_checkinteger(L, 3);
break; break;
case side_lightabsolute: case side_lightabsolute:
side->lightabsolute = luaL_checkboolean(L, 3); side->lightabsolute = luaL_checkboolean(L, 3);

View file

@ -1407,6 +1407,12 @@ static UINT32 GetSideDiff(const side_t *si, const side_t *spawnsi)
diff |= LD_SDBOTLIGHT; diff |= LD_SDBOTLIGHT;
if (si->lightabsolute != spawnsi->lightabsolute) if (si->lightabsolute != spawnsi->lightabsolute)
diff |= LD_SDLIGHTABS; diff |= LD_SDLIGHTABS;
if (si->lightabsolute_top != spawnsi->lightabsolute_top)
diff |= LD_SDTOPLIGHTABS;
if (si->lightabsolute_mid != spawnsi->lightabsolute_mid)
diff |= LD_SDMIDLIGHTABS;
if (si->lightabsolute_bottom != spawnsi->lightabsolute_bottom)
diff |= LD_SDBOTLIGHTABS;
return diff; return diff;
} }
@ -1452,8 +1458,20 @@ static void ArchiveSide(const side_t *si, UINT32 diff)
WRITEINT16(save_p, si->repeatcnt); WRITEINT16(save_p, si->repeatcnt);
if (diff & LD_SDLIGHT) if (diff & LD_SDLIGHT)
WRITEINT16(save_p, si->light); WRITEINT16(save_p, si->light);
if (diff & LD_SDTOPLIGHT)
WRITEINT16(save_p, si->light_top);
if (diff & LD_SDMIDLIGHT)
WRITEINT16(save_p, si->light_mid);
if (diff & LD_SDBOTLIGHT)
WRITEINT16(save_p, si->light_bottom);
if (diff & LD_SDLIGHTABS) if (diff & LD_SDLIGHTABS)
WRITEINT16(save_p, si->lightabsolute); WRITEUINT8(save_p, si->lightabsolute);
if (diff & LD_SDTOPLIGHTABS)
WRITEUINT8(save_p, si->lightabsolute_top);
if (diff & LD_SDMIDLIGHTABS)
WRITEUINT8(save_p, si->lightabsolute_mid);
if (diff & LD_SDBOTLIGHTABS)
WRITEUINT8(save_p, si->lightabsolute_bottom);
} }
static void ArchiveLines(void) static void ArchiveLines(void)
@ -1596,8 +1614,20 @@ static void UnArchiveSide(side_t *si)
si->repeatcnt = READINT16(save_p); si->repeatcnt = READINT16(save_p);
if (diff & LD_SDLIGHT) if (diff & LD_SDLIGHT)
si->light = READINT16(save_p); si->light = READINT16(save_p);
if (diff & LD_SDTOPLIGHT)
si->light_top = READINT16(save_p);
if (diff & LD_SDMIDLIGHT)
si->light_mid = READINT16(save_p);
if (diff & LD_SDBOTLIGHT)
si->light_bottom = READINT16(save_p);
if (diff & LD_SDLIGHTABS) if (diff & LD_SDLIGHTABS)
si->lightabsolute = READINT16(save_p); si->lightabsolute = READUINT8(save_p);
if (diff & LD_SDTOPLIGHTABS)
si->lightabsolute_top = READUINT8(save_p);
if (diff & LD_SDMIDLIGHTABS)
si->lightabsolute_mid = READUINT8(save_p);
if (diff & LD_SDBOTLIGHTABS)
si->lightabsolute_bottom = READUINT8(save_p);
} }
static void UnArchiveLines(void) static void UnArchiveLines(void)

View file

@ -1982,8 +1982,20 @@ static void ParseTextmapSidedefParameter(UINT32 i, const char *param, const char
sides[i].repeatcnt = atol(val); sides[i].repeatcnt = atol(val);
else if (fastcmp(param, "light")) else if (fastcmp(param, "light"))
sides[i].light = atol(val); sides[i].light = atol(val);
else if (fastcmp(param, "light_top"))
sides[i].light_top = atol(val);
else if (fastcmp(param, "light_mid"))
sides[i].light_mid = atol(val);
else if (fastcmp(param, "light_bottom"))
sides[i].light_bottom = atol(val);
else if (fastcmp(param, "lightabsolute") && fastcmp("true", val)) else if (fastcmp(param, "lightabsolute") && fastcmp("true", val))
sides[i].lightabsolute = true; sides[i].lightabsolute = true;
else if (fastcmp(param, "lightabsolute_top") && fastcmp("true", val))
sides[i].lightabsolute_top = true;
else if (fastcmp(param, "lightabsolute_mid") && fastcmp("true", val))
sides[i].lightabsolute_mid = true;
else if (fastcmp(param, "lightabsolute_bottom") && fastcmp("true", val))
sides[i].lightabsolute_bottom = true;
} }
static void ParseTextmapLinedefParameter(UINT32 i, const char *param, const char *val) static void ParseTextmapLinedefParameter(UINT32 i, const char *param, const char *val)
@ -2713,8 +2725,20 @@ static void P_WriteTextmap(void)
fprintf(f, "repeatcnt = %d;\n", wsides[i].repeatcnt); fprintf(f, "repeatcnt = %d;\n", wsides[i].repeatcnt);
if (wsides[i].light != 0) if (wsides[i].light != 0)
fprintf(f, "light = %d;\n", wsides[i].light); fprintf(f, "light = %d;\n", wsides[i].light);
if (wsides[i].lightabsolute != 0) if (wsides[i].light_top != 0)
fprintf(f, "lightabsolute = %d;\n", wsides[i].lightabsolute); fprintf(f, "light_top = %d;\n", wsides[i].light_top);
if (wsides[i].light_mid != 0)
fprintf(f, "light_mid = %d;\n", wsides[i].light_mid);
if (wsides[i].light_bottom != 0)
fprintf(f, "light_bottom = %d;\n", wsides[i].light_bottom);
if (wsides[i].lightabsolute)
fprintf(f, "lightabsolute = true;\n");
if (wsides[i].lightabsolute_top)
fprintf(f, "lightabsolute_top = true;\n");
if (wsides[i].lightabsolute_mid)
fprintf(f, "lightabsolute_mid = true;\n");
if (wsides[i].lightabsolute_bottom)
fprintf(f, "lightabsolute_bottom = true;\n");
fprintf(f, "}\n"); fprintf(f, "}\n");
fprintf(f, "\n"); fprintf(f, "\n");
} }
@ -3117,7 +3141,8 @@ 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->light = sd->lightabsolute = 0; sd->light = sd->light_top = sd->light_mid = sd->light_bottom = 0;
sd->lightabsolute = sd->lightabsolute_top = sd->lightabsolute_mid = sd->lightabsolute_bottom = false;
TextmapParse(sidedefBlocks.pos[i], i, ParseTextmapSidedefParameter); TextmapParse(sidedefBlocks.pos[i], i, ParseTextmapSidedefParameter);

View file

@ -100,6 +100,7 @@ static INT16 R_SideLightLevel(side_t *side, UINT8 base_lightlevel)
((side->lightabsolute) ? 0 : base_lightlevel); ((side->lightabsolute) ? 0 : base_lightlevel);
} }
/* TODO: implement per-texture lighting
static INT16 R_TopLightLevel(side_t *side, UINT8 base_lightlevel) static INT16 R_TopLightLevel(side_t *side, UINT8 base_lightlevel)
{ {
return side->light_top + return side->light_top +
@ -117,6 +118,7 @@ static INT16 R_BottomLightLevel(side_t *side, UINT8 base_lightlevel)
return side->light_bottom + return side->light_bottom +
((side->lightabsolute_bottom) ? 0 : R_SideLightLevel(side, base_lightlevel)); ((side->lightabsolute_bottom) ? 0 : R_SideLightLevel(side, base_lightlevel));
} }
*/
void R_RenderMaskedSegRange(drawseg_t *ds, INT32 x1, INT32 x2) void R_RenderMaskedSegRange(drawseg_t *ds, INT32 x1, INT32 x2)
{ {