Merge branch 'Saturn-Next' of ssh://github.com/Indev450/SRB2Kart-Saturn into Saturn-Next
This commit is contained in:
commit
d15f69dfcd
8 files changed
+134
-52
No files matched your search
+1
-1
@@ -1458,7 +1458,7 @@ void Command_Ping_f(void)
|
||||
|
||||
if (!server && playeringame[consoleplayer])
|
||||
{
|
||||
CONS_Printf("\nYour ping is %d frames (%d ms)\n", playerpingtable[consoleplayer], (INT32)(playerpingtable[i] * (1000.00f / TICRATE)));
|
||||
CONS_Printf("\nYour ping is %d frames (%d ms)\n", playerpingtable[consoleplayer], (INT32)(playerpingtable[consoleplayer] * (1000.00f / TICRATE)));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -150,6 +150,7 @@ consvar_t cv_grfallbackplayermodel = {"gr_fallbackplayermodel", "Off", CV_SAVE,
|
||||
consvar_t cv_grshearing = {"gr_shearing", "Off", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
consvar_t cv_grspritebillboarding = {"gr_spritebillboarding", "On", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
consvar_t cv_grfakecontrast = {"gr_fakecontrast", "Standard", CV_SAVE, grfakecontrast_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
consvar_t cv_grslopecontrast = {"gr_slopecontrast", "Off", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
|
||||
static void CV_filtermode_ONChange(void)
|
||||
{
|
||||
@@ -615,6 +616,50 @@ static FUINT HWR_CalcWallLight(FUINT lightnum, fixed_t v1x, fixed_t v1y, fixed_t
|
||||
return (FUINT)finallight;
|
||||
}
|
||||
|
||||
static FUINT HWR_CalcSlopeLight(FUINT lightnum, angle_t dir, fixed_t delta)
|
||||
{
|
||||
INT16 finallight = lightnum;
|
||||
|
||||
if (cv_grfakecontrast.value != 0 && cv_grslopecontrast.value != 0)
|
||||
{
|
||||
const UINT8 contrast = 8;
|
||||
fixed_t extralight = 0;
|
||||
|
||||
if (cv_grfakecontrast.value == 2) // Smooth setting
|
||||
{
|
||||
fixed_t dirmul = abs(FixedDiv(AngleFixed(dir) - (180<<FRACBITS), 180<<FRACBITS));
|
||||
|
||||
extralight = -(contrast<<FRACBITS) + (dirmul * (contrast * 2));
|
||||
|
||||
extralight = FixedMul(extralight, delta*4) >> FRACBITS;
|
||||
}
|
||||
else
|
||||
{
|
||||
dir = ((dir + ANGLE_45) / ANGLE_90) * ANGLE_90;
|
||||
|
||||
if (dir == ANGLE_180)
|
||||
extralight = -contrast;
|
||||
else if (dir == 0)
|
||||
extralight = contrast;
|
||||
|
||||
if (delta >= FRACUNIT/2)
|
||||
extralight *= 2;
|
||||
}
|
||||
|
||||
if (extralight != 0)
|
||||
{
|
||||
finallight += extralight;
|
||||
|
||||
if (finallight < 0)
|
||||
finallight = 0;
|
||||
if (finallight > 255)
|
||||
finallight = 255;
|
||||
}
|
||||
}
|
||||
|
||||
return (FUINT)finallight;
|
||||
}
|
||||
|
||||
// ==========================================================================
|
||||
// Floor and ceiling generation from subsectors
|
||||
// ==========================================================================
|
||||
@@ -801,6 +846,11 @@ void HWR_RenderPlane(extrasubsector_t *xsub, boolean isceiling, fixed_t fixedhei
|
||||
for (i = 0, v3d = planeVerts; i < nrPlaneVerts; i++,v3d++,pv++)
|
||||
SETUP3DVERT(v3d, pv->x, pv->y);
|
||||
|
||||
#ifdef ESLOPE
|
||||
if (slope)
|
||||
lightlevel = HWR_CalcSlopeLight(lightlevel, R_PointToAngle2(0, 0, slope->normal.x, slope->normal.y), abs(slope->zdelta));
|
||||
#endif
|
||||
|
||||
HWR_Lighting(&Surf, lightlevel, planecolormap);
|
||||
|
||||
if (PolyFlags & (PF_Translucent|PF_Fog))
|
||||
@@ -6217,6 +6267,7 @@ void HWR_AddCommands(void)
|
||||
CV_RegisterVar(&cv_grgammagreen);
|
||||
CV_RegisterVar(&cv_grgammared);
|
||||
CV_RegisterVar(&cv_grfakecontrast);
|
||||
CV_RegisterVar(&cv_grslopecontrast);
|
||||
|
||||
CV_RegisterVar(&cv_grfovchange);
|
||||
|
||||
|
||||
@@ -177,6 +177,7 @@ extern consvar_t cv_grfovchange;
|
||||
extern consvar_t cv_grsolvetjoin;
|
||||
extern consvar_t cv_grspritebillboarding;
|
||||
extern consvar_t cv_grfakecontrast;
|
||||
extern consvar_t cv_grslopecontrast;
|
||||
extern consvar_t cv_grfallbackplayermodel;
|
||||
extern consvar_t cv_grbatching;
|
||||
extern consvar_t cv_grrenderdistance;
|
||||
|
||||
@@ -1340,6 +1340,20 @@ void InitPalette(int flashnum, boolean skiplut)
|
||||
|
||||
if (!skiplut)
|
||||
{
|
||||
GLenum internalFormat;
|
||||
if (gl_version[0] == '1' || gl_version[0] == '2')
|
||||
{
|
||||
// if the OpenGL version is below 3.0, then the GL_R8 format may not be available.
|
||||
// so use GL_LUMINANCE8 instead to get a single component 8-bit format
|
||||
// (it is possible to have access to shaders even in some OpenGL 1.x systems,
|
||||
// so palette rendering can still possibly be achieved there)
|
||||
internalFormat = GL_LUMINANCE8;
|
||||
}
|
||||
else
|
||||
{
|
||||
internalFormat = GL_R8;
|
||||
}
|
||||
|
||||
// init the palette conversion lookup texture
|
||||
GLubyte *pal_lookup_tex = malloc(LUT_SIZE*LUT_SIZE*LUT_SIZE*sizeof(GLubyte));
|
||||
|
||||
@@ -1363,7 +1377,7 @@ void InitPalette(int flashnum, boolean skiplut)
|
||||
pglTexParameteri(GL_TEXTURE_3D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
|
||||
if (!pglTexImage3D)
|
||||
I_Error("pglTexImage3D is NULL!");
|
||||
pglTexImage3D(GL_TEXTURE_3D, 0, GL_R8, LUT_SIZE, LUT_SIZE, LUT_SIZE, 0, GL_RED, GL_UNSIGNED_BYTE, pal_lookup_tex);
|
||||
pglTexImage3D(GL_TEXTURE_3D, 0, internalFormat, LUT_SIZE, LUT_SIZE, LUT_SIZE, 0, GL_RED, GL_UNSIGNED_BYTE, pal_lookup_tex);
|
||||
free(pal_lookup_tex);
|
||||
}
|
||||
#undef STEP_SIZE
|
||||
|
||||
@@ -30,12 +30,6 @@ static precise_t enterprecise, oldenterprecise;
|
||||
static fixed_t entertic, oldentertics;
|
||||
static double tictimer;
|
||||
|
||||
// A little more than the minimum sleep duration on Windows.
|
||||
// May be incorrect for other platforms, but we don't currently have a way to
|
||||
// query the scheduler granularity. SDL will do what's needed to make this as
|
||||
// low as possible though.
|
||||
#define MIN_SLEEP_DURATION_MS 2.1
|
||||
|
||||
tic_t I_GetTime(void)
|
||||
{
|
||||
return g_time.time;
|
||||
@@ -86,38 +80,3 @@ void I_UpdateTime(fixed_t timescale)
|
||||
g_time.timefrac = FLOAT_TO_FIXED(fractional);
|
||||
}
|
||||
}
|
||||
|
||||
void I_SleepDuration(precise_t duration)
|
||||
{
|
||||
UINT64 precision = I_GetPrecisePrecision();
|
||||
INT32 sleepvalue = cv_sleep.value;
|
||||
UINT64 delaygranularity;
|
||||
precise_t cur;
|
||||
precise_t dest;
|
||||
|
||||
{
|
||||
double gran = round(((double)(precision / 1000) * sleepvalue * MIN_SLEEP_DURATION_MS));
|
||||
delaygranularity = (UINT64)gran;
|
||||
}
|
||||
|
||||
cur = I_GetPreciseTime();
|
||||
dest = cur + duration;
|
||||
|
||||
// the reason this is not dest > cur is because the precise counter may wrap
|
||||
// two's complement arithmetic is our friend here, though!
|
||||
// e.g. cur 0xFFFFFFFFFFFFFFFE = -2, dest 0x0000000000000001 = 1
|
||||
// 0x0000000000000001 - 0xFFFFFFFFFFFFFFFE = 3
|
||||
while ((INT64)(dest - cur) > 0)
|
||||
{
|
||||
// If our cv_sleep value exceeds the remaining sleep duration, use the
|
||||
// hard sleep function.
|
||||
if (sleepvalue > 0 && (dest - cur) > delaygranularity)
|
||||
{
|
||||
I_Sleep(sleepvalue);
|
||||
}
|
||||
|
||||
// Otherwise, this is a spinloop.
|
||||
|
||||
cur = I_GetPreciseTime();
|
||||
}
|
||||
}
|
||||
+3
-1
@@ -43,6 +43,8 @@
|
||||
|
||||
typedef INT32 fixed_t;
|
||||
|
||||
typedef UINT32 ufixed_t;
|
||||
|
||||
/*!
|
||||
\brief convert fixed_t into floating number
|
||||
*/
|
||||
@@ -115,7 +117,7 @@ FUNCMATH FUNCINLINE static ATTRINLINE fixed_t FixedInt(fixed_t a)
|
||||
*/
|
||||
FUNCMATH FUNCINLINE static ATTRINLINE fixed_t FixedDiv(fixed_t a, fixed_t b)
|
||||
{
|
||||
if ((abs(a) >> (FRACBITS-2)) >= abs(b))
|
||||
if (((ufixed_t)abs(a) >> (FRACBITS-2)) >= (ufixed_t)abs(b))
|
||||
return (a^b) < 0 ? INT32_MIN : INT32_MAX;
|
||||
|
||||
return FixedDiv2(a, b);
|
||||
|
||||
+9
-8
@@ -1367,16 +1367,17 @@ static menuitem_t OP_OpenGLOptionsMenu[] =
|
||||
{IT_STRING | IT_CVAR, NULL, "Flashpals in Palette Renderer", &cv_grflashpal, 45},
|
||||
{IT_STRING | IT_CVAR, NULL, "Min Shader Brightness", &cv_secbright, 55},
|
||||
|
||||
{IT_STRING|IT_CVAR, NULL, "Texture Quality", &cv_scr_depth, 75},
|
||||
{IT_STRING|IT_CVAR, NULL, "Texture Filter", &cv_grfiltermode, 85},
|
||||
{IT_STRING|IT_CVAR, NULL, "Anisotropic", &cv_granisotropicmode, 95},
|
||||
{IT_STRING|IT_CVAR, NULL, "Texture Quality", &cv_scr_depth, 70},
|
||||
{IT_STRING|IT_CVAR, NULL, "Texture Filter", &cv_grfiltermode, 80},
|
||||
{IT_STRING|IT_CVAR, NULL, "Anisotropic", &cv_granisotropicmode, 90},
|
||||
|
||||
{IT_STRING|IT_CVAR, NULL, "Visual Portals", &cv_grportals, 105},
|
||||
{IT_STRING|IT_CVAR, NULL, "Visual Portals", &cv_grportals, 100},
|
||||
|
||||
{IT_STRING|IT_CVAR, NULL, "Wall Contrast Style", &cv_grfakecontrast, 125},
|
||||
{IT_STRING|IT_CVAR, NULL, "Sprite Billboarding", &cv_grspritebillboarding, 135},
|
||||
{IT_STRING|IT_CVAR, NULL, "Software Perspective", &cv_grshearing, 145},
|
||||
{IT_STRING|IT_CVAR, NULL, "Rendering Distance", &cv_grrenderdistance, 155},
|
||||
{IT_STRING|IT_CVAR, NULL, "Wall Contrast Style", &cv_grfakecontrast, 120},
|
||||
{IT_STRING|IT_CVAR, NULL, "Slope Contrast", &cv_grslopecontrast, 130},
|
||||
{IT_STRING|IT_CVAR, NULL, "Sprite Billboarding", &cv_grspritebillboarding, 140},
|
||||
{IT_STRING|IT_CVAR, NULL, "Software Perspective", &cv_grshearing, 150},
|
||||
{IT_STRING|IT_CVAR, NULL, "Rendering Distance", &cv_grrenderdistance, 160},
|
||||
|
||||
{IT_SUBMENU|IT_STRING, NULL, "Gamma...", &OP_OpenGLColorDef, 170},
|
||||
};
|
||||
|
||||
@@ -42,6 +42,14 @@ typedef UINT (WINAPI *p_timeEndPeriod) (UINT);
|
||||
typedef HANDLE (WINAPI *p_OpenFileMappingA) (DWORD, BOOL, LPCSTR);
|
||||
typedef LPVOID (WINAPI *p_MapViewOfFile) (HANDLE, DWORD, DWORD, DWORD, SIZE_T);
|
||||
#endif
|
||||
|
||||
|
||||
// A little more than the minimum sleep duration on Windows.
|
||||
// May be incorrect for other platforms, but we don't currently have a way to
|
||||
// query the scheduler granularity. SDL will do what's needed to make this as
|
||||
// low as possible though.
|
||||
#define MIN_SLEEP_DURATION_MS 2.1
|
||||
|
||||
#include <stdio.h>
|
||||
#include <time.h>
|
||||
#include <stdlib.h>
|
||||
@@ -3220,6 +3228,52 @@ void I_Sleep(UINT32 ms)
|
||||
SDL_Delay(ms);
|
||||
}
|
||||
|
||||
void I_SleepDuration(precise_t duration)
|
||||
{
|
||||
#if defined(__linux__) || defined(__FreeBSD__)
|
||||
UINT64 precision = I_GetPrecisePrecision();
|
||||
struct timespec ts = {
|
||||
.tv_sec = duration / precision,
|
||||
.tv_nsec = duration * 1000000000 / precision % 1000000000,
|
||||
};
|
||||
int status;
|
||||
do status = clock_nanosleep(CLOCK_MONOTONIC, 0, &ts, &ts);
|
||||
while (status == EINTR);
|
||||
#else
|
||||
UINT64 precision = I_GetPrecisePrecision();
|
||||
INT32 sleepvalue = cv_sleep.value;
|
||||
UINT64 delaygranularity;
|
||||
precise_t cur;
|
||||
precise_t dest;
|
||||
|
||||
{
|
||||
double gran = round(((double)(precision / 1000) * sleepvalue * MIN_SLEEP_DURATION_MS));
|
||||
delaygranularity = (UINT64)gran;
|
||||
}
|
||||
|
||||
cur = I_GetPreciseTime();
|
||||
dest = cur + duration;
|
||||
|
||||
// the reason this is not dest > cur is because the precise counter may wrap
|
||||
// two's complement arithmetic is our friend here, though!
|
||||
// e.g. cur 0xFFFFFFFFFFFFFFFE = -2, dest 0x0000000000000001 = 1
|
||||
// 0x0000000000000001 - 0xFFFFFFFFFFFFFFFE = 3
|
||||
while ((INT64)(dest - cur) > 0)
|
||||
{
|
||||
// If our cv_sleep value exceeds the remaining sleep duration, use the
|
||||
// hard sleep function.
|
||||
if (sleepvalue > 0 && (dest - cur) > delaygranularity)
|
||||
{
|
||||
I_Sleep(sleepvalue);
|
||||
}
|
||||
|
||||
// Otherwise, this is a spinloop.
|
||||
|
||||
cur = I_GetPreciseTime();
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
#ifdef NEWSIGNALHANDLER
|
||||
FUNCNORETURN static ATTRNORETURN void newsignalhandler_Warn(const char *pr)
|
||||
{
|
||||
|
||||
Reference in new issue
Block a user