diff --git a/src/filesrch.c b/src/filesrch.c index 55d40d811..3a3a576ce 100644 --- a/src/filesrch.c +++ b/src/filesrch.c @@ -37,7 +37,6 @@ #include #define SUFFIX "*" -#define SLASH "\\" #define S_ISDIR(m) (((m) & S_IFMT) == S_IFDIR) #ifndef INVALID_FILE_ATTRIBUTES @@ -135,7 +134,7 @@ opendir (const CHAR *szPath) /* Allocate enough space to store DIR structure and the complete * directory path given. */ nd = (DIR *) malloc (sizeof (DIR) + (strlen(szFullPath) + strlen (SLASH) + - strlen(SUFFIX) + 1) * sizeof (CHAR)); + strlen(PATHSEP) + 1) * sizeof (CHAR)); if (!nd) { @@ -149,10 +148,9 @@ opendir (const CHAR *szPath) /* Add on a slash if the path does not end with one. */ if (nd->dd_name[0] != '\0' && - nd->dd_name[strlen (nd->dd_name) - 1] != '/' && - nd->dd_name[strlen (nd->dd_name) - 1] != '\\') + nd->dd_name[strlen (nd->dd_name) - 1] != PATHSEP[0]) { - strcat (nd->dd_name, SLASH); + strcat (nd->dd_name, PATHSEP); } /* Add on the search pattern */ @@ -382,9 +380,9 @@ filestatus_t filesearch(char *filename, const char *startpath, const UINT8 *want return FS_NOTFOUND; } - if (searchpath[searchpathindex[depthleft]-2] != '/') + if (searchpath[searchpathindex[depthleft]-2] != PATHSEP[0]) { - searchpath[searchpathindex[depthleft]-1] = '/'; + searchpath[searchpathindex[depthleft]-1] = PATHSEP[0]; searchpath[searchpathindex[depthleft]] = 0; } else @@ -392,7 +390,7 @@ filestatus_t filesearch(char *filename, const char *startpath, const UINT8 *want while ((!found) && (depthleft < maxsearchdepth)) { - searchpath[searchpathindex[depthleft]]=0; + searchpath[searchpathindex[depthleft]] = 0; dent = readdir(dirhandle[depthleft]); if (!dent) @@ -419,7 +417,7 @@ filestatus_t filesearch(char *filename, const char *startpath, const UINT8 *want if (S_ISDIR(fsstat.st_mode)) dent->d_type = DT_DIR; else if (S_ISLNK(fsstat.st_mode)) - dent->d_type = DT_LNK; + dent->d_type = DT_LNK; } // Symlinks aren't always directory symlinks. Dunno if this would resolve recursive @@ -447,8 +445,8 @@ filestatus_t filesearch(char *filename, const char *startpath, const UINT8 *want depthleft++; } - searchpath[searchpathindex[depthleft]-1]='/'; - searchpath[searchpathindex[depthleft]]=0; + searchpath[searchpathindex[depthleft]-1] = PATHSEP[0]; + searchpath[searchpathindex[depthleft]] = 0; } else if (!strcasecmp(searchname, dent->d_name)) { diff --git a/src/hardware/hw_main.c b/src/hardware/hw_main.c index d5c789368..b50e05e61 100644 --- a/src/hardware/hw_main.c +++ b/src/hardware/hw_main.c @@ -533,10 +533,8 @@ void HWR_Lighting(FSurfaceInfo *Surface, INT32 light_level, extracolormap_t *col poly_color.s.blue = (UINT8)blue; } - light_level = SOFTLIGHT(light_level); - // Clamp the light level, since it can sometimes go out of the 0-255 range from animations - light_level = min(max(light_level, cv_secbright.value), 255); + light_level = CLAMP(SOFTLIGHT(light_level), cv_secbright.value, 255); // in palette rendering mode, this is not needed since it properly takes the changes to the palette itself if (!HWR_ShouldUsePaletteRendering()) diff --git a/src/hardware/hw_shaders.h b/src/hardware/hw_shaders.h index 7b188f64b..714b004b1 100644 --- a/src/hardware/hw_shaders.h +++ b/src/hardware/hw_shaders.h @@ -53,15 +53,19 @@ // Include GLSL_FLOOR_FUDGES or GLSL_WALL_FUDGES or define the fudges in shaders that use this macro. #define GLSL_DOOM_COLORMAP_DITHER \ "float baseValue = max(startmap * STARTMAP_FUDGE - scale * 0.5 * SCALE_FUDGE, cap);\n" \ - "float halfResolutionx = scr_resolution.x;\n" \ - "float halfResolutiony = scr_resolution.y;\n" \ + "float endResolutionx = scr_resolution.x;\n" \ + "float endResolutiony = scr_resolution.y;\n" \ "if (scr_resolution.x > 1280.0) {\n" \ - "halfResolutionx = scr_resolution.x * 0.5;\n" \ + "endResolutionx = scr_resolution.x * 0.5;\n" \ "}\n" \ "if (scr_resolution.y > 720.0) {\n" \ - "halfResolutiony = scr_resolution.y * 0.5;\n" \ + "endResolutiony = scr_resolution.y * 0.5;\n" \ "}\n" \ - "vec2 normalizedPosition = position * vec2(halfResolutionx / scr_resolution.x, halfResolutiony / scr_resolution.y);\n" \ + "float zFactor = clamp((z - 192.0) / (6144.0 - 192.0), 0.0, 1.0);\n" \ + "int scaleFactor = int(mix(1.0, 8.0, zFactor));\n" \ + "endResolutionx = endResolutionx * scaleFactor;\n" \ + "endResolutiony = endResolutiony * scaleFactor;\n" \ + "vec2 normalizedPosition = position * vec2(endResolutionx / scr_resolution.x, endResolutiony / scr_resolution.y);\n" \ "int x = int(mod(normalizedPosition.x, 4.0));\n" \ "int y = int(mod(normalizedPosition.y, 4.0));\n" \ "float bayerMatrix[4*4] = float[4*4](\n" \ @@ -71,11 +75,11 @@ "15.0, 7.0, 13.0, 5.0\n" \ ");\n" \ "#ifdef SRB2_PALETTE_RENDERING\n" \ - "float threshold = bayerMatrix[y*4 + x] / 12.0;\n" \ + "float threshold = (1.0 - pow(zFactor, 2.0)) * (bayerMatrix[y*4 + x] / 11.0);\n" \ "#else\n" \ - "float threshold = bayerMatrix[y*4 + x] / 16.0;\n" \ + "float threshold = (1.0 - pow(zFactor, 2.0)) * (bayerMatrix[y*4 + x] / 16.0);\n" \ "#endif\n" \ - "return baseValue + threshold - 0.5 / 16.0;\n" \ + "return mix(baseValue + threshold - 0.5 / 16.0, baseValue, zFactor);\n" #define GLSL_DOOM_COLORMAP_NODITHER \ "return max(startmap * STARTMAP_FUDGE - scale * 0.5 * SCALE_FUDGE, cap);\n" \ diff --git a/src/k_kart.c b/src/k_kart.c index 93ddadd40..52e2ceb95 100644 --- a/src/k_kart.c +++ b/src/k_kart.c @@ -9350,10 +9350,9 @@ static void K_drawDriftGauge(void) if (driftcharge >= driftval*4) // rainbow sparks { - int index = max((leveltime % 18) + 1, 18 - 1); cmap = R_GetTranslationColormap(TC_RAINBOW, 1 + leveltime % (MAXSKINCOLORS-1),GTC_CACHE); for (i = 0; i < 4; i++) - V_DrawFill(barx, bary+dup*1+dup*i, BAR_WIDTH, dup, (driftrainbow[index] + i*2) | V_NOSCALESTART|drifttrans); + V_DrawFill(barx, bary+dup*1+dup*i, BAR_WIDTH, dup, (driftrainbow[min((leveltime % 18) + 1, 18 - 1)] + i*2) | V_NOSCALESTART|drifttrans); } else // none/blue/red { diff --git a/src/r_main.c b/src/r_main.c index f1ffeebce..fc753941c 100644 --- a/src/r_main.c +++ b/src/r_main.c @@ -1119,8 +1119,8 @@ subsector_t *R_IsPointInSubsector(fixed_t x, fixed_t y) subsector_t *ret; // single subsector is a special case - if (numnodes == 0) - return subsectors; + //if (numnodes == 0) + //return subsectors; nodenum = numnodes - 1;