Compare commits
10
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
f332e21fa7 | ||
|
|
bc4c1637ad | ||
|
|
d9e3dd979e | ||
|
|
df8f167549 | ||
|
|
d60d9d5611 | ||
|
|
b5f4db5131 | ||
|
|
f74a7e3f07 | ||
|
|
8e1212d9d5 | ||
|
|
59a4627911 | ||
|
|
ecab383078 |
No files matched your search
@@ -61,6 +61,7 @@
|
|||||||
# NOPOSTPROCESSING=1 - ?
|
# NOPOSTPROCESSING=1 - ?
|
||||||
# MOBJCONSISTANCY=1 - ??
|
# MOBJCONSISTANCY=1 - ??
|
||||||
# PACKETDROP=1 - ??
|
# PACKETDROP=1 - ??
|
||||||
|
# NOEXECINFO=1 - Disable stack trace dump support
|
||||||
# DEBUGMODE=1 - Enable various debugging capabilities.
|
# DEBUGMODE=1 - Enable various debugging capabilities.
|
||||||
# Also disables optimizations.
|
# Also disables optimizations.
|
||||||
#
|
#
|
||||||
|
|||||||
@@ -11,6 +11,8 @@ DEDICATED?=0
|
|||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
NOEXECINFO=1
|
||||||
|
|
||||||
ifeq (${SDL},1)
|
ifeq (${SDL},1)
|
||||||
EXENAME?=srb2haiku
|
EXENAME?=srb2haiku
|
||||||
else ifeq (${DEDICATED},1)
|
else ifeq (${DEDICATED},1)
|
||||||
|
|||||||
+20
-96
@@ -350,8 +350,6 @@ static void D_Renderview(void)
|
|||||||
// added comment : there is a wipe eatch change of the gamestate
|
// added comment : there is a wipe eatch change of the gamestate
|
||||||
gamestate_t wipegamestate = GS_LEVEL;
|
gamestate_t wipegamestate = GS_LEVEL;
|
||||||
|
|
||||||
static void D_LimitFps(void);
|
|
||||||
|
|
||||||
static void D_MakeIntermissionBG(void)
|
static void D_MakeIntermissionBG(void)
|
||||||
{
|
{
|
||||||
if (!lastdraw)
|
if (!lastdraw)
|
||||||
@@ -647,10 +645,6 @@ static boolean D_Display(void)
|
|||||||
|
|
||||||
CON_Drawer(); // Ha, i LIED!
|
CON_Drawer(); // Ha, i LIED!
|
||||||
|
|
||||||
// be sure to limit our fps *before* drawing
|
|
||||||
// so we can properly "pace" our frames
|
|
||||||
D_LimitFps();
|
|
||||||
|
|
||||||
if (cv_lua_profile.value > 0)
|
if (cv_lua_profile.value > 0)
|
||||||
{
|
{
|
||||||
LUA_RenderTimers();
|
LUA_RenderTimers();
|
||||||
@@ -664,78 +658,6 @@ static boolean D_Display(void)
|
|||||||
return ranwipe;
|
return ranwipe;
|
||||||
}
|
}
|
||||||
|
|
||||||
static precise_t sleeptime = 0;
|
|
||||||
|
|
||||||
static boolean D_UseNewFramelimiter(void)
|
|
||||||
{
|
|
||||||
//if (!cv_newframelimiter.value) return false;
|
|
||||||
return (rendermode != render_none && !dedicated && (R_GetFramerateCap() >= 45) && R_UsingFrameInterpolation());
|
|
||||||
}
|
|
||||||
|
|
||||||
static void D_LimitFps(void)
|
|
||||||
{
|
|
||||||
precise_t curtime, start;
|
|
||||||
static precise_t lasttime = 0;
|
|
||||||
|
|
||||||
// timedemo runs uncapped!
|
|
||||||
if (singletics)
|
|
||||||
return;
|
|
||||||
|
|
||||||
if (!D_UseNewFramelimiter())
|
|
||||||
return;
|
|
||||||
|
|
||||||
const UINT32 framecap = R_GetFramerateCap();
|
|
||||||
|
|
||||||
// uncapped obviously does not need to be... capped...
|
|
||||||
if (framecap == 0)
|
|
||||||
return;
|
|
||||||
|
|
||||||
// dont need to sleep if we vsync and our framecap is set to refresh rate or higher
|
|
||||||
if (cv_vidwait.value && (cv_fpscap.value == 0 || framecap > I_GetRefreshRate()))
|
|
||||||
return;
|
|
||||||
|
|
||||||
start = I_GetPreciseTime();
|
|
||||||
|
|
||||||
const UINT64 precision = I_GetPrecisePrecision();
|
|
||||||
|
|
||||||
// frametarget in precise_t ticks (ex. 60fps = ~16,666,666)
|
|
||||||
const precise_t frametarget = precision / framecap;
|
|
||||||
|
|
||||||
lasttime += frametarget;
|
|
||||||
|
|
||||||
// just sync this up if we missed the target
|
|
||||||
if ((INT64)(start - lasttime) >= 0)
|
|
||||||
lasttime = start;
|
|
||||||
|
|
||||||
while (1)
|
|
||||||
{
|
|
||||||
// check the current time against the "time of the old frame"
|
|
||||||
curtime = I_GetPreciseTime();
|
|
||||||
|
|
||||||
// done waiting!
|
|
||||||
// continue as normal
|
|
||||||
if ((INT64)(curtime - lasttime) >= 0)
|
|
||||||
{
|
|
||||||
// time we spent :chaosleep:ing or doing absolutely nothing
|
|
||||||
// for frameskip calculations
|
|
||||||
sleeptime = curtime - start;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// if we have more than 1ms to wait
|
|
||||||
// sleep for a bit to not trash the cpu lul
|
|
||||||
precise_t remaining = lasttime - curtime;
|
|
||||||
|
|
||||||
if (remaining > (precise_t)(precision / 1000))
|
|
||||||
{
|
|
||||||
// sleep for 90% of the time we gotta wait for the next frame
|
|
||||||
// since we dont wanna oversleep :chaosleep:
|
|
||||||
I_SleepDuration(9 * remaining / 10);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// the rest we just be waitin until we meet our frametime target
|
|
||||||
}
|
|
||||||
|
|
||||||
// =========================================================================
|
// =========================================================================
|
||||||
// D_SRB2Loop
|
// D_SRB2Loop
|
||||||
// =========================================================================
|
// =========================================================================
|
||||||
@@ -787,13 +709,13 @@ void D_SRB2Loop(void)
|
|||||||
|
|
||||||
for (;;)
|
for (;;)
|
||||||
{
|
{
|
||||||
|
// capbudget is the minimum precise_t duration of a single loop iteration
|
||||||
|
precise_t capbudget;
|
||||||
precise_t elapsed;
|
precise_t elapsed;
|
||||||
precise_t enterprecise, finishprecise;
|
precise_t enterprecise, finishprecise;
|
||||||
|
|
||||||
boolean ranwipe = false;
|
boolean ranwipe = false;
|
||||||
|
|
||||||
sleeptime = 0;
|
|
||||||
|
|
||||||
enterprecise = I_GetPreciseTime();
|
enterprecise = I_GetPreciseTime();
|
||||||
|
|
||||||
I_HandleInterrupt();
|
I_HandleInterrupt();
|
||||||
@@ -801,6 +723,10 @@ void D_SRB2Loop(void)
|
|||||||
memset(&g_dc, 0, sizeof(g_dc));
|
memset(&g_dc, 0, sizeof(g_dc));
|
||||||
Z_Frame_Reset();
|
Z_Frame_Reset();
|
||||||
|
|
||||||
|
// Casting the return value of a function is bad practice (apparently)
|
||||||
|
const UINT32 framecap = R_GetFramerateCap();
|
||||||
|
capbudget = (framecap == 0) ? 0 : (precise_t)((double)precision / (double)framecap + 0.5); // + 0.5 instead of round
|
||||||
|
|
||||||
I_UpdateTime(cv_timescale.value);
|
I_UpdateTime(cv_timescale.value);
|
||||||
|
|
||||||
if (lastwipetic)
|
if (lastwipetic)
|
||||||
@@ -821,9 +747,11 @@ void D_SRB2Loop(void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
#ifdef DEBUGFILE
|
#ifdef DEBUGFILE
|
||||||
if (!realtics && debugload)
|
if (!realtics)
|
||||||
debugload--;
|
if (debugload)
|
||||||
|
debugload--;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
interp = !dedicated && R_UsingFrameInterpolation();
|
interp = !dedicated && R_UsingFrameInterpolation();
|
||||||
doDisplay = false;
|
doDisplay = false;
|
||||||
|
|
||||||
@@ -857,7 +785,6 @@ void D_SRB2Loop(void)
|
|||||||
{
|
{
|
||||||
P_RunChaseCameras();
|
P_RunChaseCameras();
|
||||||
}
|
}
|
||||||
|
|
||||||
R_UpdateViewInterpolation();
|
R_UpdateViewInterpolation();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -903,6 +830,7 @@ void D_SRB2Loop(void)
|
|||||||
M_SaveFrame();
|
M_SaveFrame();
|
||||||
if (takescreenshot)
|
if (takescreenshot)
|
||||||
M_DoScreenShot();
|
M_DoScreenShot();
|
||||||
|
|
||||||
#ifndef DEDICATED
|
#ifndef DEDICATED
|
||||||
if (!dedicated && renderisnewtic)
|
if (!dedicated && renderisnewtic)
|
||||||
{
|
{
|
||||||
@@ -924,9 +852,9 @@ void D_SRB2Loop(void)
|
|||||||
// Fully completed frame made.
|
// Fully completed frame made.
|
||||||
finishprecise = I_GetPreciseTime();
|
finishprecise = I_GetPreciseTime();
|
||||||
|
|
||||||
// Use the time without sleep for frameskip calculations:
|
// Use the time before sleep for frameskip calculations:
|
||||||
// post-sleep time is literally being intentionally wasted
|
// post-sleep time is literally being intentionally wasted
|
||||||
elapsed = (finishprecise - enterprecise) - sleeptime;
|
elapsed = finishprecise - enterprecise;
|
||||||
deltasecs = (double)elapsed / (double)precision;
|
deltasecs = (double)elapsed / (double)precision;
|
||||||
deltatics = deltasecs * (double)NEWTICRATE;
|
deltatics = deltasecs * (double)NEWTICRATE;
|
||||||
|
|
||||||
@@ -954,12 +882,8 @@ void D_SRB2Loop(void)
|
|||||||
frameskip = 0;
|
frameskip = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
// old fps limiter
|
if (!singletics)
|
||||||
if (!singletics && !D_UseNewFramelimiter())
|
|
||||||
{
|
{
|
||||||
const UINT32 framecap = R_GetFramerateCap();
|
|
||||||
const precise_t capbudget = (framecap == 0) ? 0 : (precise_t)((double)precision / (double)framecap + 0.5); // + 0.5 instead of round
|
|
||||||
|
|
||||||
// in the case of "match refresh rate" + vsync, don't sleep at all
|
// in the case of "match refresh rate" + vsync, don't sleep at all
|
||||||
const boolean vsync_with_match_refresh = cv_vidwait.value && cv_fpscap.value == 0;
|
const boolean vsync_with_match_refresh = cv_vidwait.value && cv_fpscap.value == 0;
|
||||||
|
|
||||||
@@ -967,13 +891,13 @@ void D_SRB2Loop(void)
|
|||||||
{
|
{
|
||||||
I_SleepDuration(capbudget - elapsed);
|
I_SleepDuration(capbudget - elapsed);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Capture the time once more to get the real delta time.
|
|
||||||
finishprecise = I_GetPreciseTime();
|
|
||||||
elapsed = finishprecise - enterprecise;
|
|
||||||
deltasecs = (double)elapsed / (double)precision;
|
|
||||||
deltatics = deltasecs * (double)NEWTICRATE;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Capture the time once more to get the real delta time.
|
||||||
|
finishprecise = I_GetPreciseTime();
|
||||||
|
elapsed = finishprecise - enterprecise;
|
||||||
|
deltasecs = (double)elapsed / (double)precision;
|
||||||
|
deltatics = deltasecs * (double)NEWTICRATE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+12
-13
@@ -64,9 +64,10 @@ typedef LPVOID (WINAPI *p_MapViewOfFile) (HANDLE, DWORD, DWORD, DWORD, SIZE_T);
|
|||||||
#include <conio.h>
|
#include <conio.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined (__unix__) || defined(__APPLE__) || defined (UNIXCOMMON)
|
#if defined (__unix__) || defined(__APPLE__) || (defined (UNIXCOMMON) && !defined (__HAIKU__))
|
||||||
#if defined (__linux__) || defined (__HAIKU__)
|
#include <time.h>
|
||||||
#include <sys/statvfs.h>
|
#if defined (__linux__)
|
||||||
|
#include <sys/vfs.h>
|
||||||
#elif defined(__APPLE__)
|
#elif defined(__APPLE__)
|
||||||
#include <sys/param.h>
|
#include <sys/param.h>
|
||||||
#include <sys/mount.h>
|
#include <sys/mount.h>
|
||||||
@@ -74,7 +75,6 @@ typedef LPVOID (WINAPI *p_MapViewOfFile) (HANDLE, DWORD, DWORD, DWORD, SIZE_T);
|
|||||||
#include <sys/sysctl.h>
|
#include <sys/sysctl.h>
|
||||||
#include <mach/mach.h>
|
#include <mach/mach.h>
|
||||||
#else
|
#else
|
||||||
#include <sys/statvfs.h>
|
|
||||||
#include <sys/param.h>
|
#include <sys/param.h>
|
||||||
#include <sys/mount.h>
|
#include <sys/mount.h>
|
||||||
/*For meminfo*/
|
/*For meminfo*/
|
||||||
@@ -87,7 +87,7 @@ typedef LPVOID (WINAPI *p_MapViewOfFile) (HANDLE, DWORD, DWORD, DWORD, SIZE_T);
|
|||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined (__linux__) || defined (UNIXCOMMON)
|
#if defined (__linux__) || (defined (UNIXCOMMON) && !defined (__HAIKU__))
|
||||||
#ifndef NOTERMIOS
|
#ifndef NOTERMIOS
|
||||||
#include <termios.h>
|
#include <termios.h>
|
||||||
#include <sys/ioctl.h> // ioctl
|
#include <sys/ioctl.h> // ioctl
|
||||||
@@ -99,10 +99,8 @@ typedef LPVOID (WINAPI *p_MapViewOfFile) (HANDLE, DWORD, DWORD, DWORD, SIZE_T);
|
|||||||
#include <poll.h>
|
#include <poll.h>
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include <sys/wait.h>
|
#include <sys/wait.h>
|
||||||
#ifndef __HAIKU__ // haiku's crash dialog is just objectively better
|
|
||||||
#define NEWSIGNALHANDLER
|
#define NEWSIGNALHANDLER
|
||||||
#endif
|
#endif
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef NOMUMBLE
|
#ifndef NOMUMBLE
|
||||||
#ifdef __linux__ // need -lrt
|
#ifdef __linux__ // need -lrt
|
||||||
@@ -133,9 +131,7 @@ typedef LPVOID (WINAPI *p_MapViewOfFile) (HANDLE, DWORD, DWORD, DWORD, SIZE_T);
|
|||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined (__unix__) || defined(__APPLE__) || defined (UNIXCOMMON)
|
|
||||||
#include <time.h>
|
#include <time.h>
|
||||||
#endif
|
|
||||||
|
|
||||||
/// Locations to directly check for srb2.srb in
|
/// Locations to directly check for srb2.srb in
|
||||||
const char *wadDefaultPaths[] = {
|
const char *wadDefaultPaths[] = {
|
||||||
@@ -1692,7 +1688,6 @@ void I_ShutdownSystem(void)
|
|||||||
for (c = MAX_QUIT_FUNCS-1; c >= 0; c--)
|
for (c = MAX_QUIT_FUNCS-1; c >= 0; c--)
|
||||||
if (quit_funcs[c])
|
if (quit_funcs[c])
|
||||||
(*quit_funcs[c])();
|
(*quit_funcs[c])();
|
||||||
|
|
||||||
#ifdef LOGMESSAGES
|
#ifdef LOGMESSAGES
|
||||||
if (logstream)
|
if (logstream)
|
||||||
{
|
{
|
||||||
@@ -1709,13 +1704,18 @@ void I_ShutdownSystem(void)
|
|||||||
void I_GetDiskFreeSpace(INT64 *freespace)
|
void I_GetDiskFreeSpace(INT64 *freespace)
|
||||||
{
|
{
|
||||||
#if defined (__unix__) || defined(__APPLE__) || defined (UNIXCOMMON)
|
#if defined (__unix__) || defined(__APPLE__) || defined (UNIXCOMMON)
|
||||||
struct statvfs stfs;
|
#if defined (SOLARIS) || defined (__HAIKU__)
|
||||||
if (statvfs(srb2home, &stfs) == -1)
|
*freespace = INT32_MAX;
|
||||||
|
return;
|
||||||
|
#else // Both Linux and BSD have this, apparently.
|
||||||
|
struct statfs stfs;
|
||||||
|
if (statfs(".", &stfs) == -1)
|
||||||
{
|
{
|
||||||
*freespace = INT32_MAX;
|
*freespace = INT32_MAX;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
*freespace = stfs.f_bavail * stfs.f_bsize;
|
*freespace = stfs.f_bavail * stfs.f_bsize;
|
||||||
|
#endif
|
||||||
#elif defined (_WIN32)
|
#elif defined (_WIN32)
|
||||||
static p_GetDiskFreeSpaceExA pfnGetDiskFreeSpaceEx = NULL;
|
static p_GetDiskFreeSpaceExA pfnGetDiskFreeSpaceEx = NULL;
|
||||||
static boolean testwin95 = false;
|
static boolean testwin95 = false;
|
||||||
@@ -1726,7 +1726,6 @@ void I_GetDiskFreeSpace(INT64 *freespace)
|
|||||||
pfnGetDiskFreeSpaceEx = (p_GetDiskFreeSpaceExA)(LPVOID)GetProcAddress(GetModuleHandleA("kernel32.dll"), "GetDiskFreeSpaceExA");
|
pfnGetDiskFreeSpaceEx = (p_GetDiskFreeSpaceExA)(LPVOID)GetProcAddress(GetModuleHandleA("kernel32.dll"), "GetDiskFreeSpaceExA");
|
||||||
testwin95 = true;
|
testwin95 = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (pfnGetDiskFreeSpaceEx)
|
if (pfnGetDiskFreeSpaceEx)
|
||||||
{
|
{
|
||||||
if (pfnGetDiskFreeSpaceEx(NULL, &lfreespace, &usedbytes, NULL))
|
if (pfnGetDiskFreeSpaceEx(NULL, &lfreespace, &usedbytes, NULL))
|
||||||
|
|||||||
+10
-27
@@ -1027,22 +1027,20 @@ void G_ResetAllDeviceRumbles(void)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void G_PlayerDeviceRumble(INT32 playernum, UINT32 low_strength, UINT32 high_strength, UINT32 duration)
|
void G_PlayerDeviceRumble(INT32 playernum, UINT16 low_strength, UINT16 high_strength, UINT32 duration)
|
||||||
{
|
{
|
||||||
I_Assert(playernum >= 0 && playernum < MAXSPLITSCREENPLAYERS);
|
I_Assert(playernum >= 0 && playernum < MAXSPLITSCREENPLAYERS);
|
||||||
|
|
||||||
if (cv_rumble[playernum].value == 0 || (window_notinfocus && cv_rumbleifunfocused.value == 0))
|
if (cv_rumble[playernum].value == 0 || (window_notinfocus && cv_rumbleifunfocused.value == 0))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
UINT16 lo, hi;
|
|
||||||
|
|
||||||
// doesent need to be super precise
|
// doesent need to be super precise
|
||||||
// but ensure this is within range (0-65535)
|
// but ensure this is within range (0-65535)
|
||||||
// placed here so it applies to lua aswell
|
// placed here so it applies to lua aswell
|
||||||
lo = (UINT16)min(FixedMul(low_strength, cv_rumble_strength[playernum].value), UINT16_MAX);
|
low_strength = (UINT16)min(FixedMul(low_strength, cv_rumble_strength[playernum].value), UINT16_MAX);
|
||||||
hi = (UINT16)min(FixedMul(high_strength, cv_rumble_strength[playernum].value), UINT16_MAX);
|
high_strength = (UINT16)min(FixedMul(high_strength, cv_rumble_strength[playernum].value), UINT16_MAX);
|
||||||
|
|
||||||
I_GamepadRumble(playernum, lo, hi, duration);
|
I_GamepadRumble(playernum, low_strength, high_strength, duration);
|
||||||
}
|
}
|
||||||
|
|
||||||
// rumble strengths
|
// rumble strengths
|
||||||
@@ -1079,9 +1077,9 @@ void G_DeviceRumbleTick(void)
|
|||||||
|
|
||||||
// SDL rumble strength goes from a range or 0-65535 respectively
|
// SDL rumble strength goes from a range or 0-65535 respectively
|
||||||
// the higher, the stronger it is
|
// the higher, the stronger it is
|
||||||
UINT32 low = 0, high = 0;
|
UINT16 low = 0, high = 0;
|
||||||
// for how long the action should rumble, in ms
|
// for how long the action should rumble, in ms
|
||||||
UINT32 length = 57; // 57ms is a short pulse, matches super well with this updating once per tic
|
UINT16 length = 57; // 57ms is a short pulse, matches super well with this updating once per tic
|
||||||
|
|
||||||
const player_t *player = P_GetLocalPlayerForNum(i);
|
const player_t *player = P_GetLocalPlayerForNum(i);
|
||||||
|
|
||||||
@@ -1097,7 +1095,7 @@ void G_DeviceRumbleTick(void)
|
|||||||
player->playerstate == PST_DEAD ||
|
player->playerstate == PST_DEAD ||
|
||||||
player->kartstuff[k_respawn] > 1)
|
player->kartstuff[k_respawn] > 1)
|
||||||
{
|
{
|
||||||
G_PlayerDeviceRumble(i, 0, 0, 0);
|
G_PlayerDeviceRumble(i, low, high, 0);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1152,42 +1150,27 @@ void G_DeviceRumbleTick(void)
|
|||||||
P_IsObjectOnGround(player->mo))
|
P_IsObjectOnGround(player->mo))
|
||||||
{
|
{
|
||||||
low = high = RUMBLE_VERYWEAK;
|
low = high = RUMBLE_VERYWEAK;
|
||||||
length = 43;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (cv_rumble_brakedrift[i].value &&
|
if (cv_rumble_brakedrift[i].value &&
|
||||||
player->kartstuff[k_brakedrift])
|
player->kartstuff[k_brakedrift])
|
||||||
{
|
{
|
||||||
high += RUMBLE_VERYWEAK;
|
high = CLAMP((high + RUMBLE_VERYWEAK), 0, UINT16_MAX);
|
||||||
}
|
}
|
||||||
|
|
||||||
// pulse when gettin new driftlevel
|
// pulse when gettin new driftlevel
|
||||||
|
// let this come last
|
||||||
if (cv_rumble_driftcharge[i].value &&
|
if (cv_rumble_driftcharge[i].value &&
|
||||||
player->kartstuff[k_driftcharge] &&
|
player->kartstuff[k_driftcharge] &&
|
||||||
player->driftlevel)
|
player->driftlevel)
|
||||||
{
|
{
|
||||||
high += RUMBLE_VERYWEAK;
|
high = CLAMP((high + RUMBLE_VERYWEAK), 0, UINT16_MAX);
|
||||||
|
|
||||||
// make it rumble slightly longer the higher your driftlevel!
|
// make it rumble slightly longer the higher your driftlevel!
|
||||||
if (player->driftlevel == 2)
|
if (player->driftlevel == 2)
|
||||||
length = 114;
|
length = 114;
|
||||||
else if (player->driftlevel == 3)
|
else if (player->driftlevel == 3)
|
||||||
length = 174;
|
length = 174;
|
||||||
else
|
|
||||||
length = 71;
|
|
||||||
}
|
|
||||||
|
|
||||||
// grow makes rumble more intense >:3
|
|
||||||
if (player->kartstuff[k_growshrinktimer] > 0)
|
|
||||||
{
|
|
||||||
high *= 2;
|
|
||||||
low *= 2;
|
|
||||||
}
|
|
||||||
// shrink does the opposite uwu
|
|
||||||
else if (player->kartstuff[k_growshrinktimer] < 0)
|
|
||||||
{
|
|
||||||
high /= 2;
|
|
||||||
low /= 2;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// hack alert! i just dont want this thing constantly resetting the rumble lol
|
// hack alert! i just dont want this thing constantly resetting the rumble lol
|
||||||
|
|||||||
+1
-1
@@ -153,7 +153,7 @@ void G_DeviceLEDTick(void);
|
|||||||
void G_ResetDeviceLED(void);
|
void G_ResetDeviceLED(void);
|
||||||
|
|
||||||
void G_ResetAllDeviceRumbles(void);
|
void G_ResetAllDeviceRumbles(void);
|
||||||
void G_PlayerDeviceRumble(INT32 playernum, UINT32 low_strength, UINT32 high_strength, UINT32 duration);
|
void G_PlayerDeviceRumble(INT32 playernum, UINT16 low_strength, UINT16 high_strength, UINT32 duration);
|
||||||
void G_DeviceRumbleTick(void);
|
void G_DeviceRumbleTick(void);
|
||||||
|
|
||||||
// peace to my little coder fingers!
|
// peace to my little coder fingers!
|
||||||
|
|||||||
@@ -196,6 +196,11 @@ enum
|
|||||||
SHADER_PALETTE_POSTPROCESS,
|
SHADER_PALETTE_POSTPROCESS,
|
||||||
SHADER_UI_COLORMAP_FADE,
|
SHADER_UI_COLORMAP_FADE,
|
||||||
|
|
||||||
|
SHADER_POSTPROCESS_WATER,
|
||||||
|
SHADER_POSTPROCESS_HEAT,
|
||||||
|
|
||||||
|
SHADER_VHS,
|
||||||
|
|
||||||
NUMSHADERTARGETS
|
NUMSHADERTARGETS
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -66,10 +66,11 @@ void GL_FlushScreenTextures(void);
|
|||||||
|
|
||||||
void GL_DrawScreenTexture(int tex, FSurfaceInfo *surf, FBITFIELD polyflags);
|
void GL_DrawScreenTexture(int tex, FSurfaceInfo *surf, FBITFIELD polyflags);
|
||||||
void GL_DoScreenWipe(int wipeStart, int wipeEnd);
|
void GL_DoScreenWipe(int wipeStart, int wipeEnd);
|
||||||
void GL_RenderVhsEffect(fixed_t upbary, fixed_t downbary, UINT8 updistort, UINT8 downdistort, UINT8 barsize);
|
void GL_RenderVhsEffect(fixed_t upbary, fixed_t downbary, UINT8 updistort, UINT8 downdistort, UINT8 barsize, boolean rewind);
|
||||||
void GL_DrawScreenFinalTexture(int tex, INT32 width, INT32 height);
|
void GL_DrawScreenFinalTexture(int tex, INT32 width, INT32 height);
|
||||||
|
|
||||||
void GL_PostImgRedraw(float points[SCREENVERTS][SCREENVERTS][2]);
|
void GL_PostImgRedraw(float points[SCREENVERTS][SCREENVERTS][2]);
|
||||||
|
void GL_DoPostProcessor(INT32 type);
|
||||||
|
|
||||||
boolean GL_InitShaders(void);
|
boolean GL_InitShaders(void);
|
||||||
void GL_LoadShader(int slot, char *code, hwdshaderstage_t stage);
|
void GL_LoadShader(int slot, char *code, hwdshaderstage_t stage);
|
||||||
|
|||||||
+51
-50
@@ -529,7 +529,7 @@ static FUINT HWR_CalcWallLight(FUINT lightnum, seg_t *seg, extracolormap_t *colo
|
|||||||
return (FUINT)finallight;
|
return (FUINT)finallight;
|
||||||
}
|
}
|
||||||
|
|
||||||
static FUINT HWR_CalcSlopeLight(FUINT lightnum, pslope_t *slope, const sector_t *sector, const boolean reverseLight)
|
static FUINT HWR_CalcSlopeLight(FUINT lightnum, pslope_t *slope, const sector_t *sector, const boolean fof)
|
||||||
{
|
{
|
||||||
INT16 finallight = lightnum;
|
INT16 finallight = lightnum;
|
||||||
|
|
||||||
@@ -539,7 +539,7 @@ static FUINT HWR_CalcSlopeLight(FUINT lightnum, pslope_t *slope, const sector_t
|
|||||||
if (slope != NULL && sector != NULL && HWR_ApplyLightOffset(lightnum, sector))
|
if (slope != NULL && sector != NULL && HWR_ApplyLightOffset(lightnum, sector))
|
||||||
{
|
{
|
||||||
const INT16 offset = (cv_glfakecontrast.value == 2) ? slope->hwLightOffset : ((INT16)slope->lightOffset * 8);
|
const INT16 offset = (cv_glfakecontrast.value == 2) ? slope->hwLightOffset : ((INT16)slope->lightOffset * 8);
|
||||||
finallight += ((reverseLight && maplighting.directional) ? -offset : offset);
|
finallight += (fof ? -offset : offset);
|
||||||
finallight = CLAMP(finallight, 0, 255);
|
finallight = CLAMP(finallight, 0, 255);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -703,7 +703,7 @@ static void HWR_RenderPlane(subsector_t *subsector, extrasubsector_t *xsub, bool
|
|||||||
SETUP3DVERT(v3d, pv->x, pv->y);
|
SETUP3DVERT(v3d, pv->x, pv->y);
|
||||||
|
|
||||||
if (slope)
|
if (slope)
|
||||||
lightlevel = HWR_CalcSlopeLight(lightlevel, slope, gl_frontsector, (FOFsector && !isceiling) || (!FOFsector && isceiling));
|
lightlevel = HWR_CalcSlopeLight(lightlevel, slope, gl_frontsector, (FOFsector != NULL));
|
||||||
|
|
||||||
HWR_Lighting(&Surf, lightlevel, planecolormap, P_SectorUsesDirectionalLighting(gl_frontsector));
|
HWR_Lighting(&Surf, lightlevel, planecolormap, P_SectorUsesDirectionalLighting(gl_frontsector));
|
||||||
|
|
||||||
@@ -1280,7 +1280,7 @@ static void HWR_SplitWall(sector_t *sector, FOutVector *wallVerts, INT32 texnum,
|
|||||||
// To avoid division by zero, which would result in a NaN, we check if the vertical difference
|
// To avoid division by zero, which would result in a NaN, we check if the vertical difference
|
||||||
// between the two vertices is not zero.
|
// between the two vertices is not zero.
|
||||||
if (std::fpclassify(diff) == FP_ZERO)
|
if (std::fpclassify(diff) == FP_ZERO)
|
||||||
pegmul = 0.0f;
|
pegmul = 0.0;
|
||||||
else
|
else
|
||||||
pegmul = (pegb - pegt) / diff;
|
pegmul = (pegb - pegt) / diff;
|
||||||
|
|
||||||
@@ -1292,7 +1292,7 @@ static void HWR_SplitWall(sector_t *sector, FOutVector *wallVerts, INT32 texnum,
|
|||||||
endpegb = wallVerts[1].t;
|
endpegb = wallVerts[1].t;
|
||||||
|
|
||||||
if (std::fpclassify(diff) == FP_ZERO)
|
if (std::fpclassify(diff) == FP_ZERO)
|
||||||
endpegmul = 0.0f;
|
endpegmul = 0.0;
|
||||||
else
|
else
|
||||||
endpegmul = (endpegb - endpegt) / diff;
|
endpegmul = (endpegb - endpegt) / diff;
|
||||||
|
|
||||||
@@ -3856,16 +3856,7 @@ static void HWR_SplitSprite(gl_vissprite_t *spr, const boolean papersprite)
|
|||||||
realbot = bot = baseWallVerts[0].y;
|
realbot = bot = baseWallVerts[0].y;
|
||||||
towtop = baseWallVerts[3].t;
|
towtop = baseWallVerts[3].t;
|
||||||
towbot = baseWallVerts[0].t;
|
towbot = baseWallVerts[0].t;
|
||||||
|
towmult = (towbot - towtop) / (top - bot);
|
||||||
float diff = (top - bot);
|
|
||||||
|
|
||||||
// If both heights of a side lay on the same position, then this sprite is a triangle.
|
|
||||||
// To avoid division by zero, which would result in a NaN, we check if the vertical difference
|
|
||||||
// between the two vertices is not zero.
|
|
||||||
if (std::fpclassify(diff) == FP_ZERO)
|
|
||||||
towmult = 0.0f;
|
|
||||||
else
|
|
||||||
towmult = (towbot - towtop) / diff;
|
|
||||||
|
|
||||||
endrealtop = endtop = baseWallVerts[2].y;
|
endrealtop = endtop = baseWallVerts[2].y;
|
||||||
endrealbot = baseWallVerts[1].y;
|
endrealbot = baseWallVerts[1].y;
|
||||||
@@ -4036,7 +4027,7 @@ static void HWR_SplitSprite(gl_vissprite_t *spr, const boolean papersprite)
|
|||||||
if ((endtop <= endrealbot) && (top <= realbot))
|
if ((endtop <= endrealbot) && (top <= realbot))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
// If we're ever down here, somehow the above loop hasn't drawn all the light levels of sprite
|
// If we're ever down here, somehow the above loop hasn't draw all the light levels of sprite
|
||||||
wallVerts[3].t = towtop + ((realtop - top) * towmult);
|
wallVerts[3].t = towtop + ((realtop - top) * towmult);
|
||||||
wallVerts[2].t = towtop + ((endrealtop - endtop) * towmult);
|
wallVerts[2].t = towtop + ((endrealtop - endtop) * towmult);
|
||||||
wallVerts[0].t = towtop + ((realtop - bot) * towmult);
|
wallVerts[0].t = towtop + ((realtop - bot) * towmult);
|
||||||
@@ -5392,11 +5383,6 @@ static void HWR_SkyDomeVertex(gl_sky_t *sky, gl_skyvertex_t *vbo, int r, int c,
|
|||||||
else
|
else
|
||||||
vbo->v = 1.0f + ((float)(sky->rows - r) / (float)sky->rows) + 0.5f;
|
vbo->v = 1.0f + ((float)(sky->rows - r) / (float)sky->rows) + 0.5f;
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
vbo->u = 0.5f / sky->width;
|
|
||||||
vbo->v = 0.5f / sky->height;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (r != 4)
|
if (r != 4)
|
||||||
{
|
{
|
||||||
@@ -6012,8 +5998,7 @@ void HWR_RenderPlayerView(void)
|
|||||||
|
|
||||||
if (HWR_UseShader())
|
if (HWR_UseShader())
|
||||||
{
|
{
|
||||||
if (cv_ripplewater.value)
|
GL_SetShaderInfo(HWD_SHADERINFO_LEVELTIME, (INT32)leveltime); // The water surface shader needs the leveltime.
|
||||||
GL_SetShaderInfo(HWD_SHADERINFO_LEVELTIME, (INT32)leveltime); // The water surface shader needs the leveltime.
|
|
||||||
|
|
||||||
if (cv_glmdls.value)
|
if (cv_glmdls.value)
|
||||||
{
|
{
|
||||||
@@ -6022,7 +6007,7 @@ void HWR_RenderPlayerView(void)
|
|||||||
const angle_t light_angle = maplighting.angle - viewangle + ANGLE_90; // I fucking hate OGL's coordinate system
|
const angle_t light_angle = maplighting.angle - viewangle + ANGLE_90; // I fucking hate OGL's coordinate system
|
||||||
GL_SetShaderInfo(HWD_SHADERINFO_LIGHT_X, FINECOSINE(light_angle >> ANGLETOFINESHIFT));
|
GL_SetShaderInfo(HWD_SHADERINFO_LIGHT_X, FINECOSINE(light_angle >> ANGLETOFINESHIFT));
|
||||||
GL_SetShaderInfo(HWD_SHADERINFO_LIGHT_Y, 0);
|
GL_SetShaderInfo(HWD_SHADERINFO_LIGHT_Y, 0);
|
||||||
GL_SetShaderInfo(HWD_SHADERINFO_LIGHT_Z, -FINESINE(light_angle >> ANGLETOFINESHIFT));
|
GL_SetShaderInfo(HWD_SHADERINFO_LIGHT_Z, -FINESINE(light_angle >> ANGLETOFINESHIFT));
|
||||||
}
|
}
|
||||||
|
|
||||||
GL_SetShaderInfo(HWD_SHADERINFO_LIGHT_CONTRAST, maplighting.contrast);
|
GL_SetShaderInfo(HWD_SHADERINFO_LIGHT_CONTRAST, maplighting.contrast);
|
||||||
@@ -6372,42 +6357,58 @@ static void HWR_DoPostProcessor(void)
|
|||||||
GL_MakeScreenTexture(HWD_SCREENTEXTURE_GENERIC1);
|
GL_MakeScreenTexture(HWD_SCREENTEXTURE_GENERIC1);
|
||||||
|
|
||||||
// Drunken vision! WooOOooo~
|
// Drunken vision! WooOOooo~
|
||||||
// 10 by 10 grid. 2 coordinates (xy)
|
|
||||||
float v[SCREENVERTS][SCREENVERTS][2];
|
|
||||||
float disStart = (leveltime-1) + FixedToFloat(R_GetTimeFrac(RTF_LEVEL));
|
|
||||||
|
|
||||||
UINT8 x, y;
|
// shader based, should be a bit faster!
|
||||||
float WAVELENGTH;
|
if (HWR_UseShader())
|
||||||
float AMPLITUDE;
|
|
||||||
float FREQUENCY;
|
|
||||||
|
|
||||||
// Modifies the wave.
|
|
||||||
if (thiscam->postimg & POSTIMG_WATER)
|
|
||||||
{
|
{
|
||||||
WAVELENGTH = 5.0f;
|
if (thiscam->postimg & POSTIMG_WATER)
|
||||||
AMPLITUDE = 40.0f;
|
{
|
||||||
FREQUENCY = 8.0f;
|
GL_DoPostProcessor(POSTIMG_WATER);
|
||||||
|
}
|
||||||
|
else if (thiscam->postimg & POSTIMG_HEAT)
|
||||||
|
{
|
||||||
|
GL_DoPostProcessor(POSTIMG_HEAT);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
WAVELENGTH = 10.0f;
|
// 10 by 10 grid. 2 coordinates (xy)
|
||||||
AMPLITUDE = 60.0f;
|
float v[SCREENVERTS][SCREENVERTS][2];
|
||||||
FREQUENCY = 4.0f;
|
float disStart = (leveltime-1) + FixedToFloat(R_GetTimeFrac(RTF_LEVEL));
|
||||||
}
|
|
||||||
|
|
||||||
//static constexpr float scale = ((float)SCREENVERTS - 1.0f) / 9.0f; // well this evals to just 1.0f and what is x / 1? kek
|
UINT8 x, y;
|
||||||
|
float WAVELENGTH;
|
||||||
|
float AMPLITUDE;
|
||||||
|
float FREQUENCY;
|
||||||
|
|
||||||
for (x = 0; x < SCREENVERTS; x++)
|
// Modifies the wave.
|
||||||
{
|
if (thiscam->postimg & POSTIMG_WATER)
|
||||||
for (y = 0; y < SCREENVERTS; y++)
|
|
||||||
{
|
{
|
||||||
// Change X position based on its Y position.
|
WAVELENGTH = 5.0f;
|
||||||
v[x][y][0] = x-4.5f + sinf(((disStart+(static_cast<float>(y) * WAVELENGTH)) / FREQUENCY)) / AMPLITUDE; // (x / scale)
|
AMPLITUDE = 40.0f;
|
||||||
v[x][y][1] = y-4.5f; // (y / scale)
|
FREQUENCY = 8.0f;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
WAVELENGTH = 10.0f;
|
||||||
|
AMPLITUDE = 60.0f;
|
||||||
|
FREQUENCY = 4.0f;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
GL_PostImgRedraw(v);
|
//static constexpr float scale = ((float)SCREENVERTS - 1.0f) / 9.0f; // well this evals to just 1.0f and what is x / 1? kek
|
||||||
|
|
||||||
|
for (x = 0; x < SCREENVERTS; x++)
|
||||||
|
{
|
||||||
|
for (y = 0; y < SCREENVERTS; y++)
|
||||||
|
{
|
||||||
|
// Change X position based on its Y position.
|
||||||
|
v[x][y][0] = x-4.5f + sinf(((disStart+(static_cast<float>(y) * WAVELENGTH)) / FREQUENCY)) / AMPLITUDE; // (x / scale)
|
||||||
|
v[x][y][1] = y-4.5f; // (y / scale)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
GL_PostImgRedraw(v);
|
||||||
|
}
|
||||||
|
|
||||||
// Capture the screen again for screen waving on the intermission
|
// Capture the screen again for screen waving on the intermission
|
||||||
if (gamestate != GS_INTERMISSION)
|
if (gamestate != GS_INTERMISSION)
|
||||||
|
|||||||
@@ -145,9 +145,9 @@ FUNCINLINE static ATTRINLINE void HWR_DrawIntermissionBG(void)
|
|||||||
GL_DrawScreenTexture(HWD_SCREENTEXTURE_GENERIC1, NULL, 0);
|
GL_DrawScreenTexture(HWD_SCREENTEXTURE_GENERIC1, NULL, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
FUNCINLINE static ATTRINLINE void HWR_RenderVhsEffect(fixed_t upbary, fixed_t downbary, UINT8 updistort, UINT8 downdistort, UINT8 barsize)
|
FUNCINLINE static ATTRINLINE void HWR_RenderVhsEffect(fixed_t upbary, fixed_t downbary, UINT8 updistort, UINT8 downdistort, UINT8 barsize, boolean rewind)
|
||||||
{
|
{
|
||||||
GL_RenderVhsEffect(upbary, downbary, updistort, downdistort, barsize);
|
GL_RenderVhsEffect(upbary, downbary, updistort, downdistort, barsize, rewind);
|
||||||
}
|
}
|
||||||
|
|
||||||
FUNCINLINE static ATTRINLINE void HWR_MakeScreenTexture(void)
|
FUNCINLINE static ATTRINLINE void HWR_MakeScreenTexture(void)
|
||||||
|
|||||||
@@ -53,6 +53,15 @@ static struct {
|
|||||||
// UI colormap fade shader
|
// UI colormap fade shader
|
||||||
{GLSL_DEFAULT_VERTEX_SHADER, GLSL_UI_COLORMAP_FADE_FRAGMENT_SHADER},
|
{GLSL_DEFAULT_VERTEX_SHADER, GLSL_UI_COLORMAP_FADE_FRAGMENT_SHADER},
|
||||||
|
|
||||||
|
// water postprocess shader
|
||||||
|
{GLSL_DEFAULT_VERTEX_SHADER, GLSL_POSTPROCESS_FRAGMENT_WATER},
|
||||||
|
|
||||||
|
// heat postprocess shader
|
||||||
|
{GLSL_DEFAULT_VERTEX_SHADER, GLSL_POSTPROCESS_FRAGMENT_HEAT},
|
||||||
|
|
||||||
|
// VHS effect
|
||||||
|
{GLSL_DEFAULT_VERTEX_SHADER, GLSL_VHS_SHADER},
|
||||||
|
|
||||||
{NULL, NULL},
|
{NULL, NULL},
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -444,6 +453,9 @@ customshaderxlat_t shaderxlat[] =
|
|||||||
{"Sky", SHADER_SKY},
|
{"Sky", SHADER_SKY},
|
||||||
{"PalettePostprocess", SHADER_PALETTE_POSTPROCESS},
|
{"PalettePostprocess", SHADER_PALETTE_POSTPROCESS},
|
||||||
{"UIColormapFade", SHADER_UI_COLORMAP_FADE},
|
{"UIColormapFade", SHADER_UI_COLORMAP_FADE},
|
||||||
|
{"PostProcessWater", SHADER_POSTPROCESS_WATER},
|
||||||
|
{"PostProcessHeat", SHADER_POSTPROCESS_HEAT},
|
||||||
|
{"VHS", SHADER_VHS},
|
||||||
{NULL, 0},
|
{NULL, 0},
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -341,6 +341,119 @@
|
|||||||
"gl_FragColor = texture2D(lighttable_tex, lighttable_coord);\n" \
|
"gl_FragColor = texture2D(lighttable_tex, lighttable_coord);\n" \
|
||||||
"}\0" \
|
"}\0" \
|
||||||
|
|
||||||
|
// these are RRs postprocess shaders
|
||||||
|
// for water and heat
|
||||||
|
/*
|
||||||
|
#define GLSL_POSTPROCESS_FRAGMENT_WATER \
|
||||||
|
"uniform sampler2D tex;\n" \
|
||||||
|
"uniform vec2 scr_resolution;\n" \
|
||||||
|
"uniform vec2 scr_tex_size;\n" \
|
||||||
|
"uniform float leveltime;\n" \
|
||||||
|
"void main(void) {\n" \
|
||||||
|
"vec2 uv = gl_TexCoord[0].st;\n" \
|
||||||
|
"vec2 maxuv = scr_resolution / scr_tex_size;\n" \
|
||||||
|
"float y = 1.0 - uv.y;\n" \
|
||||||
|
"uv.x += sin(leveltime * 2.0 + y * 20.0) * 0.01;\n" \
|
||||||
|
"uv = clamp(uv, vec2(0.0), maxuv - vec2(0.0001));\n" \
|
||||||
|
"gl_FragColor = texture2D(tex, uv);\n" \
|
||||||
|
"}\0"
|
||||||
|
|
||||||
|
#define GLSL_POSTPROCESS_FRAGMENT_HEAT \
|
||||||
|
"uniform sampler2D tex;\n" \
|
||||||
|
"uniform vec2 scr_resolution;\n" \
|
||||||
|
"uniform vec2 scr_tex_size;\n" \
|
||||||
|
"uniform float leveltime;\n" \
|
||||||
|
"void main(void) {\n" \
|
||||||
|
"vec2 uv = gl_TexCoord[0].st;\n" \
|
||||||
|
"vec2 maxuv = scr_resolution / scr_tex_size;\n" \
|
||||||
|
"float y = 1.0 - uv.y;\n" \
|
||||||
|
"float time = leveltime * 35.0;\n" \
|
||||||
|
"uv.x += max(sin((time / 35.0) * 1.2 - y * 5.0) - 0.995, 0.0);\n" \
|
||||||
|
"uv.x -= max(sin(((time + 24.0) / 35.0) * 0.2 - y * 1.5) - 0.990, 0.0);\n" \
|
||||||
|
"uv = clamp(uv, vec2(0.0), maxuv - vec2(0.0001));\n" \
|
||||||
|
"gl_FragColor = texture2D(tex, uv);\n" \
|
||||||
|
"}\0"
|
||||||
|
*/
|
||||||
|
|
||||||
|
// for reference
|
||||||
|
// sin(leveltime * X + (y) + Y) * Z
|
||||||
|
// X = Speed, Y = Vertical phase, Z = Amplitude
|
||||||
|
|
||||||
|
// this matches software at 720p wonderfully
|
||||||
|
#define GLSL_POSTPROCESS_FRAGMENT_WATER \
|
||||||
|
"#version 120\n" \
|
||||||
|
"uniform sampler2D tex;\n" \
|
||||||
|
"uniform vec2 scr_resolution;\n" \
|
||||||
|
"uniform vec2 scr_tex_size;\n" \
|
||||||
|
"uniform float leveltime;\n" \
|
||||||
|
"void main(void) {\n" \
|
||||||
|
"vec2 uv = gl_TexCoord[0].st;\n" \
|
||||||
|
"vec2 maxuv = scr_resolution / scr_tex_size;\n" \
|
||||||
|
"float y = 1.0 - uv.y;\n" \
|
||||||
|
"uv.x += sin(leveltime * 3.0 + y * 15.0) * 0.0025;\n" \
|
||||||
|
"uv = clamp(uv, vec2(0.0), maxuv - vec2(0.0001));\n" \
|
||||||
|
"gl_FragColor = texture2D(tex, uv);\n" \
|
||||||
|
"}\0"
|
||||||
|
|
||||||
|
// like the fixed function version, this is just the water wave again
|
||||||
|
// a bit readjusted since the shader wave is more lean
|
||||||
|
// makes it less neausiating anyways :p
|
||||||
|
#define GLSL_POSTPROCESS_FRAGMENT_HEAT \
|
||||||
|
"#version 120\n" \
|
||||||
|
"uniform sampler2D tex;\n" \
|
||||||
|
"uniform vec2 scr_resolution;\n" \
|
||||||
|
"uniform vec2 scr_tex_size;\n" \
|
||||||
|
"uniform float leveltime;\n" \
|
||||||
|
"void main(void) {\n" \
|
||||||
|
"vec2 uv = gl_TexCoord[0].st;\n" \
|
||||||
|
"vec2 maxuv = scr_resolution / scr_tex_size;\n" \
|
||||||
|
"float y = 1.0 - uv.y;\n" \
|
||||||
|
"uv.x += sin(leveltime * 6.0 + y * 22.5) * 0.00125;\n" \
|
||||||
|
"uv = clamp(uv, vec2(0.0), maxuv - vec2(0.0001));\n" \
|
||||||
|
"gl_FragColor = texture2D(tex, uv);\n" \
|
||||||
|
"}\0"
|
||||||
|
|
||||||
|
// VHS effect as a shader
|
||||||
|
// basically just what we did before as a shader lul
|
||||||
|
// the bars are just the RR heat shader repurposed
|
||||||
|
// thanks "stackoverflow.com/a/4275343" for the pseudo random stuff for glsl
|
||||||
|
// and thanks "thndl.com/triangle-waves" and "gamedev.stackexchange.com/q/191829"
|
||||||
|
// for the maths since im super bad at stuff
|
||||||
|
// 0.159155 = 1/pi*2
|
||||||
|
#define GLSL_VHS_SHADER \
|
||||||
|
"#version 120\n" \
|
||||||
|
"uniform sampler2D tex;\n" \
|
||||||
|
"uniform vec2 scr_resolution;\n" \
|
||||||
|
"uniform vec2 scr_tex_size;\n" \
|
||||||
|
"uniform float vhs_time;\n" \
|
||||||
|
"uniform float vhs_rewind;\n" \
|
||||||
|
"void main(void) {\n" \
|
||||||
|
"vec2 uv = gl_TexCoord[0].st;\n" \
|
||||||
|
"vec2 maxuv = scr_resolution / scr_tex_size;\n" \
|
||||||
|
"float y = (1.0 - uv.y);\n" \
|
||||||
|
"float ystep = floor(y * (800 / 2.0));\n" \
|
||||||
|
"float rand = fract(sin((ystep + vhs_time) * 12.9898 + 78.233) * 43758.5453);\n" \
|
||||||
|
"uv.x -= floor(rand * 128.0) / -22000.0;\n" \
|
||||||
|
"float updistort = (vhs_rewind > 0.5) ? 0.266667 : 0.16;\n" \
|
||||||
|
"float downdistort = updistort / 2.0;\n" \
|
||||||
|
"float downspd = (vhs_rewind > 0.5) ? 2.0 : 1.0;\n" \
|
||||||
|
"float upspd = (vhs_rewind > 0.5) ? 3.0 : 1.8;\n" \
|
||||||
|
"float downbar = max((1.0 - abs(2.0 * fract((vhs_time * downspd - y * 5.0) * 0.159155) - 1.0)) - 0.87, 0.0);\n" \
|
||||||
|
"float upbar = max((1.0 - abs(2.0 * fract(((vhs_time * -1.0) * upspd - y * 5.0) * 0.159155) - 1.0)) - 0.87, 0.0);\n" \
|
||||||
|
"uv.x -= downbar * downdistort;\n" \
|
||||||
|
"uv.x += upbar * updistort;\n" \
|
||||||
|
"uv.y = clamp(uv.y, 0.0, maxuv.y - 0.0001);\n" \
|
||||||
|
"uv.x = mod(uv.x, maxuv.x - 0.0001);\n" \
|
||||||
|
"vec4 color = texture2D(tex, uv);\n" \
|
||||||
|
"float downcol = step(0.00001, downbar);\n" \
|
||||||
|
"float upcol = step(0.00001, upbar);\n" \
|
||||||
|
"color.rgb = mix(color.rgb, color.rgb * (210.0 / 255.0), downcol);\n" \
|
||||||
|
"color.rgb = mix(color.rgb, color.rgb * (210.0 / 255.0), upcol);\n" \
|
||||||
|
"color.a = mix(color.a, color.a * (250.0 / 255.0), downcol);\n" \
|
||||||
|
"color.a = mix(color.a, color.a * (250.0 / 255.0), upcol);\n" \
|
||||||
|
"gl_FragColor = color;\n" \
|
||||||
|
"}\0"
|
||||||
|
|
||||||
// ================
|
// ================
|
||||||
// Fallback shaders
|
// Fallback shaders
|
||||||
// ================
|
// ================
|
||||||
|
|||||||
@@ -761,6 +761,13 @@ typedef enum
|
|||||||
|
|
||||||
gluniform_scr_resolution,
|
gluniform_scr_resolution,
|
||||||
|
|
||||||
|
// postprocess stuff
|
||||||
|
gluniform_scr_tex_size,
|
||||||
|
|
||||||
|
// vhs
|
||||||
|
gluniform_vhs_rewind,
|
||||||
|
gluniform_vhs_time,
|
||||||
|
|
||||||
gluniform_max,
|
gluniform_max,
|
||||||
} gluniform_t;
|
} gluniform_t;
|
||||||
|
|
||||||
@@ -793,6 +800,9 @@ static float shader_light_z = 0.0f;
|
|||||||
static INT32 shader_light_contrast = 0;
|
static INT32 shader_light_contrast = 0;
|
||||||
static INT32 shader_light_backlight = 0;
|
static INT32 shader_light_backlight = 0;
|
||||||
|
|
||||||
|
static float shader_vhs_rewind = 1.0f;
|
||||||
|
static float shader_vhs_time = 0.0f;
|
||||||
|
|
||||||
// Lactozilla: Shader functions
|
// Lactozilla: Shader functions
|
||||||
static boolean GL_Shader_CompileProgram(gl_shader_t *shader, GLint i);
|
static boolean GL_Shader_CompileProgram(gl_shader_t *shader, GLint i);
|
||||||
static void GL_Shader_SetUniforms(FSurfaceInfo *Surface, GLRGBAFloat *poly, GLRGBAFloat *tint, GLRGBAFloat *fade);
|
static void GL_Shader_SetUniforms(FSurfaceInfo *Surface, GLRGBAFloat *poly, GLRGBAFloat *tint, GLRGBAFloat *fade);
|
||||||
@@ -2330,6 +2340,12 @@ static void GL_Shader_SetUniforms(FSurfaceInfo *Surface, GLRGBAFloat *poly, GLRG
|
|||||||
|
|
||||||
UNIFORM_2(shader->uniforms[gluniform_scr_resolution], (GLfloat)screen_width, (GLfloat)screen_height, pglUniform2f);
|
UNIFORM_2(shader->uniforms[gluniform_scr_resolution], (GLfloat)screen_width, (GLfloat)screen_height, pglUniform2f);
|
||||||
|
|
||||||
|
// grrrrr stupid 2.0 support.. used similar to yfix, xfix
|
||||||
|
UNIFORM_2(shader->uniforms[gluniform_scr_tex_size], (GLfloat)screen_texsizew, (GLfloat)screen_texsizeh, pglUniform2f);
|
||||||
|
|
||||||
|
UNIFORM_1(shader->uniforms[gluniform_vhs_rewind], shader_vhs_rewind, pglUniform1f);
|
||||||
|
UNIFORM_1(shader->uniforms[gluniform_vhs_time], shader_vhs_time, pglUniform1f);
|
||||||
|
|
||||||
#undef UNIFORM_1
|
#undef UNIFORM_1
|
||||||
#undef UNIFORM_2
|
#undef UNIFORM_2
|
||||||
#undef UNIFORM_3
|
#undef UNIFORM_3
|
||||||
@@ -2461,6 +2477,14 @@ static boolean GL_Shader_CompileProgram(gl_shader_t *shader, GLint i)
|
|||||||
|
|
||||||
// misc.
|
// misc.
|
||||||
shader->uniforms[gluniform_leveltime] = GETUNI("leveltime");
|
shader->uniforms[gluniform_leveltime] = GETUNI("leveltime");
|
||||||
|
|
||||||
|
// postprocessor stuff (water/heat effect)
|
||||||
|
shader->uniforms[gluniform_scr_tex_size] = GETUNI("scr_tex_size");
|
||||||
|
|
||||||
|
// vhs stuff
|
||||||
|
shader->uniforms[gluniform_vhs_rewind] = GETUNI("vhs_rewind");
|
||||||
|
shader->uniforms[gluniform_vhs_time] = GETUNI("vhs_time");
|
||||||
|
|
||||||
#undef GETUNI
|
#undef GETUNI
|
||||||
|
|
||||||
// set permanent uniform values
|
// set permanent uniform values
|
||||||
@@ -3597,6 +3621,55 @@ INT32 GL_GetTextureUsed(void)
|
|||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void GL_DoPostProcessor(INT32 type)
|
||||||
|
{
|
||||||
|
float fix[8];
|
||||||
|
float xfix, yfix;
|
||||||
|
|
||||||
|
if (gl_enable_screen_textures != 2)
|
||||||
|
return;
|
||||||
|
|
||||||
|
xfix = 1/((float)screen_texsizew/(float)screen_width);
|
||||||
|
yfix = 1/((float)screen_texsizeh/(float)screen_height);
|
||||||
|
|
||||||
|
fix[0] = fix[1] =
|
||||||
|
fix[2] = fix[7] = 0.0f;
|
||||||
|
|
||||||
|
fix[3] = fix[5] = yfix;
|
||||||
|
fix[4] = fix[6] = xfix;
|
||||||
|
|
||||||
|
// this shouldnt be necessary, since this comes after level draw
|
||||||
|
// but somehow it breaks without this??
|
||||||
|
pglMatrixMode(GL_PROJECTION);
|
||||||
|
pglPushMatrix();
|
||||||
|
pglLoadIdentity();
|
||||||
|
pglMatrixMode(GL_MODELVIEW);
|
||||||
|
pglPushMatrix();
|
||||||
|
pglLoadIdentity();
|
||||||
|
|
||||||
|
GL_SetBlend(PF_NoDepthTest);
|
||||||
|
|
||||||
|
pglActiveTexture(GL_TEXTURE0);
|
||||||
|
pglBindTexture(GL_TEXTURE_2D, screenTextures[HWD_SCREENTEXTURE_GENERIC1]);
|
||||||
|
tex_downloaded = screenTextures[HWD_SCREENTEXTURE_GENERIC1];
|
||||||
|
|
||||||
|
int shader = (type == POSTIMG_WATER) ? SHADER_POSTPROCESS_WATER : SHADER_POSTPROCESS_HEAT;
|
||||||
|
GL_SetShader(HWR_GetShaderFromTarget(shader));
|
||||||
|
GL_Shader_SetUniforms(NULL, NULL, NULL, NULL);
|
||||||
|
pglColor4ubv(white);
|
||||||
|
|
||||||
|
pglTexCoordPointer(2, GL_FLOAT, 0, fix);
|
||||||
|
pglVertexPointer(3, GL_FLOAT, 0, defaultscreenVerts);
|
||||||
|
pglDrawArrays(GL_TRIANGLE_FAN, 0, 4);
|
||||||
|
|
||||||
|
GL_UnSetShader();
|
||||||
|
|
||||||
|
pglMatrixMode(GL_PROJECTION);
|
||||||
|
pglPopMatrix();
|
||||||
|
pglMatrixMode(GL_MODELVIEW);
|
||||||
|
pglPopMatrix();
|
||||||
|
}
|
||||||
|
|
||||||
void GL_PostImgRedraw(float points[SCREENVERTS][SCREENVERTS][2])
|
void GL_PostImgRedraw(float points[SCREENVERTS][SCREENVERTS][2])
|
||||||
{
|
{
|
||||||
INT32 x, y;
|
INT32 x, y;
|
||||||
@@ -3716,7 +3789,6 @@ void GL_DrawScreenTexture(int tex, FSurfaceInfo *surf, FBITFIELD polyflags)
|
|||||||
tex_downloaded = screenTextures[tex];
|
tex_downloaded = screenTextures[tex];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// Do screen fades!
|
// Do screen fades!
|
||||||
void GL_DoScreenWipe(int wipeStart, int wipeEnd)
|
void GL_DoScreenWipe(int wipeStart, int wipeEnd)
|
||||||
{
|
{
|
||||||
@@ -3791,120 +3863,164 @@ void GL_DoScreenWipe(int wipeStart, int wipeEnd)
|
|||||||
tex_downloaded = screenTextures[wipeEnd];
|
tex_downloaded = screenTextures[wipeEnd];
|
||||||
}
|
}
|
||||||
|
|
||||||
void GL_RenderVhsEffect(fixed_t upbary, fixed_t downbary, UINT8 updistort, UINT8 downdistort, UINT8 barsize)
|
void GL_RenderVhsEffect(fixed_t upbary, fixed_t downbary, UINT8 updistort, UINT8 downdistort, UINT8 barsize, boolean rewind)
|
||||||
{
|
{
|
||||||
float xfix, yfix;
|
float xfix, yfix;
|
||||||
float fix[8];
|
float fix[8];
|
||||||
float i;
|
|
||||||
|
|
||||||
if (gl_enable_screen_textures != 2)
|
if (gl_enable_screen_textures != 2)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
GLubyte color[4] = {255, 255, 255, 255};
|
|
||||||
|
|
||||||
float screenVerts[12] =
|
|
||||||
{
|
|
||||||
-1.0f, -1.0f, 1.0f,
|
|
||||||
-1.0f, 1.0f, 1.0f,
|
|
||||||
1.0f, 1.0f, 1.0f,
|
|
||||||
1.0f, -1.0f, 1.0f
|
|
||||||
};
|
|
||||||
|
|
||||||
const GLfloat scrwf = (float)screen_width;
|
const GLfloat scrwf = (float)screen_width;
|
||||||
const GLfloat scrwh = (float)screen_height;
|
const GLfloat scrhf = (float)screen_height;
|
||||||
|
|
||||||
xfix = 1/((float)screen_texsizew/scrwf);
|
xfix = 1/((float)screen_texsizew/scrwf);
|
||||||
yfix = 1/((float)screen_texsizeh/scrwh);
|
yfix = 1/((float)screen_texsizeh/scrhf);
|
||||||
|
|
||||||
GL_SetBlend(PF_Modulated|PF_Translucent|PF_NoDepthTest);
|
// uses shaders to replicate the effect
|
||||||
|
// thanks RR for their heat effect being basically the vhs bars, made this lots easier lul
|
||||||
// Slight fuzziness
|
if (HWR_UseShader())
|
||||||
GL_MakeScreenTexture(HWD_SCREENTEXTURE_VHS);
|
|
||||||
pglBindTexture(GL_TEXTURE_2D, screenTextures[HWD_SCREENTEXTURE_VHS]);
|
|
||||||
|
|
||||||
uint32_t r = rand();
|
|
||||||
|
|
||||||
const float ystep = 2.f/scrwh * (float)vid.udup/4.f;
|
|
||||||
|
|
||||||
for (i = 0; i < 1; i += ystep)
|
|
||||||
{
|
{
|
||||||
// avoid calling rand thousands of times
|
// leveltime pauses with the game so we need to keep our own counter here
|
||||||
r ^= r >> 13;
|
static tic_t lleveltime = 0;
|
||||||
r ^= r >> 11;
|
if (renderisnewtic) lleveltime++;
|
||||||
r ^= r << 21;
|
shader_vhs_time = (((float)(lleveltime-1)) + FIXED_TO_FLOAT(R_GetTimeFrac(RTF_MENU))) / TICRATE;
|
||||||
|
|
||||||
fix[2] = (float)(r & 127) / -22000.f * xfix;
|
// easier to account for within the shader
|
||||||
fix[0] = fix[2];
|
shader_vhs_rewind = rewind ? 1.0f : 0.0f;
|
||||||
fix[6] = fix[0] + xfix;
|
|
||||||
fix[4] = fix[2] + xfix;
|
|
||||||
fix[1] = fix[7] = i*yfix;
|
|
||||||
fix[3] = fix[5] = (i+0.015f)*yfix;
|
|
||||||
|
|
||||||
screenVerts[1] = screenVerts[10] = 2*i - 1.0f;
|
fix[0] = fix[1] =
|
||||||
screenVerts[4] = screenVerts[7] = screenVerts[1] + 0.03f;
|
fix[2] = fix[7] = 0.0f;
|
||||||
|
|
||||||
|
fix[3] = fix[5] = yfix;
|
||||||
|
fix[4] = fix[6] = xfix;
|
||||||
|
|
||||||
|
GL_SetBlend(PF_NoDepthTest);
|
||||||
|
|
||||||
|
// Slight fuzziness
|
||||||
|
GL_MakeScreenTexture(HWD_SCREENTEXTURE_VHS);
|
||||||
|
pglActiveTexture(GL_TEXTURE0);
|
||||||
|
pglBindTexture(GL_TEXTURE_2D, screenTextures[HWD_SCREENTEXTURE_VHS]);
|
||||||
|
tex_downloaded = screenTextures[HWD_SCREENTEXTURE_VHS];
|
||||||
|
|
||||||
|
GL_SetShader(HWR_GetShaderFromTarget(SHADER_VHS));
|
||||||
|
GL_Shader_SetUniforms(NULL, NULL, NULL, NULL);
|
||||||
|
pglColor4ubv(white);
|
||||||
|
|
||||||
|
pglEnableClientState(GL_TEXTURE_COORD_ARRAY);
|
||||||
|
pglTexCoordPointer(2, GL_FLOAT, 0, fix);
|
||||||
|
pglVertexPointer(3, GL_FLOAT, 0, defaultscreenVerts);
|
||||||
|
pglDrawArrays(GL_TRIANGLE_FAN, 0, 4);
|
||||||
|
|
||||||
|
GL_UnSetShader();
|
||||||
|
}
|
||||||
|
else // fallback fixed function version, this is quite slow
|
||||||
|
{
|
||||||
|
float i;
|
||||||
|
|
||||||
|
GLubyte color[4] = {255, 255, 255, 255};
|
||||||
|
|
||||||
|
float screenVerts[12] =
|
||||||
|
{
|
||||||
|
-1.0f, -1.0f, 1.0f,
|
||||||
|
-1.0f, 1.0f, 1.0f,
|
||||||
|
1.0f, 1.0f, 1.0f,
|
||||||
|
1.0f, -1.0f, 1.0f
|
||||||
|
};
|
||||||
|
|
||||||
|
xfix = 1/((float)screen_texsizew/scrwf);
|
||||||
|
yfix = 1/((float)screen_texsizeh/scrhf);
|
||||||
|
|
||||||
|
GL_SetBlend(PF_Modulated|PF_Translucent|PF_NoDepthTest);
|
||||||
|
|
||||||
|
// Slight fuzziness
|
||||||
|
GL_MakeScreenTexture(HWD_SCREENTEXTURE_VHS);
|
||||||
|
pglBindTexture(GL_TEXTURE_2D, screenTextures[HWD_SCREENTEXTURE_VHS]);
|
||||||
|
|
||||||
|
uint32_t r = rand();
|
||||||
|
|
||||||
|
const float ystep = 2.f/scrhf * (float)vid.udup/4.f;
|
||||||
|
|
||||||
|
for (i = 0.0; i < 1.0; i += ystep)
|
||||||
|
{
|
||||||
|
// avoid calling rand thousands of times
|
||||||
|
r ^= r >> 13;
|
||||||
|
r ^= r >> 11;
|
||||||
|
r ^= r << 21;
|
||||||
|
|
||||||
|
fix[2] = (float)(r & 127) / -22000.f * xfix;
|
||||||
|
fix[0] = fix[2];
|
||||||
|
fix[6] = fix[0] + xfix;
|
||||||
|
fix[4] = fix[2] + xfix;
|
||||||
|
fix[1] = fix[7] = i*yfix;
|
||||||
|
fix[3] = fix[5] = (i+0.015f)*yfix;
|
||||||
|
|
||||||
|
screenVerts[1] = screenVerts[10] = 2*i - 1.0f;
|
||||||
|
screenVerts[4] = screenVerts[7] = screenVerts[1] + 0.03f;
|
||||||
|
|
||||||
|
pglColor4ubv(color);
|
||||||
|
|
||||||
|
pglTexCoordPointer(2, GL_FLOAT, 0, fix);
|
||||||
|
pglVertexPointer(3, GL_FLOAT, 0, screenVerts);
|
||||||
|
pglDrawArrays(GL_TRIANGLE_FAN, 0, 4);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Upward bar
|
||||||
|
GL_MakeScreenTexture(HWD_SCREENTEXTURE_VHS);
|
||||||
|
pglBindTexture(GL_TEXTURE_2D, screenTextures[HWD_SCREENTEXTURE_VHS]);
|
||||||
|
|
||||||
|
color[0] = color[1] = color[2] = 190;
|
||||||
|
color[3] = 250;
|
||||||
pglColor4ubv(color);
|
pglColor4ubv(color);
|
||||||
|
|
||||||
|
fix[0] = 0.0f;
|
||||||
|
fix[6] = xfix;
|
||||||
|
fix[2] = (float)updistort / scrwf * xfix;
|
||||||
|
fix[4] = fix[2] + fix[6];
|
||||||
|
|
||||||
|
screenVerts[1] = screenVerts[10] = 2.0f*upbary/scrhf - 1.0f;
|
||||||
|
screenVerts[4] = screenVerts[7] = screenVerts[1] + (float)barsize/scrhf;
|
||||||
|
|
||||||
|
fix[1] = fix[7] = (float)upbary/scrhf * yfix;
|
||||||
|
fix[3] = fix[5] = fix[1] + (float)barsize/2/scrhf * yfix;
|
||||||
|
|
||||||
|
pglTexCoordPointer(2, GL_FLOAT, 0, fix);
|
||||||
|
pglVertexPointer(3, GL_FLOAT, 0, screenVerts);
|
||||||
|
pglDrawArrays(GL_TRIANGLE_FAN, 0, 4);
|
||||||
|
|
||||||
|
fix[1] = fix[7] += (fix[3] - fix[7])*2;
|
||||||
|
screenVerts[1] = screenVerts[10] += (screenVerts[4] - screenVerts[1])*2;
|
||||||
|
|
||||||
|
pglTexCoordPointer(2, GL_FLOAT, 0, fix);
|
||||||
|
pglVertexPointer(3, GL_FLOAT, 0, screenVerts);
|
||||||
|
pglDrawArrays(GL_TRIANGLE_FAN, 0, 4);
|
||||||
|
|
||||||
|
// Downward bar
|
||||||
|
GL_MakeScreenTexture(HWD_SCREENTEXTURE_VHS);
|
||||||
|
pglBindTexture(GL_TEXTURE_2D, screenTextures[HWD_SCREENTEXTURE_VHS]);
|
||||||
|
|
||||||
|
fix[0] = 0.0f;
|
||||||
|
fix[6] = xfix;
|
||||||
|
fix[2] = (float)downdistort / scrwf * -xfix;
|
||||||
|
fix[4] = fix[2] + fix[6];
|
||||||
|
|
||||||
|
screenVerts[1] = screenVerts[10] = 2.0f*downbary/scrhf - 1.0f;
|
||||||
|
screenVerts[4] = screenVerts[7] = screenVerts[1] + (float)barsize/scrhf;
|
||||||
|
|
||||||
|
fix[1] = fix[7] = (float)downbary/scrhf * yfix;
|
||||||
|
fix[3] = fix[5] = fix[1] + (float)barsize/2/scrhf * yfix;
|
||||||
|
|
||||||
|
pglTexCoordPointer(2, GL_FLOAT, 0, fix);
|
||||||
|
pglVertexPointer(3, GL_FLOAT, 0, screenVerts);
|
||||||
|
pglDrawArrays(GL_TRIANGLE_FAN, 0, 4);
|
||||||
|
|
||||||
|
fix[1] = fix[7] += (fix[3] - fix[7])*2;
|
||||||
|
screenVerts[1] = screenVerts[10] += (screenVerts[4] - screenVerts[1])*2;
|
||||||
|
|
||||||
pglTexCoordPointer(2, GL_FLOAT, 0, fix);
|
pglTexCoordPointer(2, GL_FLOAT, 0, fix);
|
||||||
pglVertexPointer(3, GL_FLOAT, 0, screenVerts);
|
pglVertexPointer(3, GL_FLOAT, 0, screenVerts);
|
||||||
pglDrawArrays(GL_TRIANGLE_FAN, 0, 4);
|
pglDrawArrays(GL_TRIANGLE_FAN, 0, 4);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Upward bar
|
|
||||||
GL_MakeScreenTexture(HWD_SCREENTEXTURE_VHS);
|
|
||||||
pglBindTexture(GL_TEXTURE_2D, screenTextures[HWD_SCREENTEXTURE_VHS]);
|
|
||||||
|
|
||||||
color[0] = color[1] = color[2] = 190;
|
|
||||||
color[3] = 250;
|
|
||||||
pglColor4ubv(color);
|
|
||||||
|
|
||||||
fix[0] = 0.0f;
|
|
||||||
fix[6] = xfix;
|
|
||||||
fix[2] = (float)updistort / scrwf * xfix;
|
|
||||||
fix[4] = fix[2] + fix[6];
|
|
||||||
|
|
||||||
screenVerts[1] = screenVerts[10] = 2.0f*upbary/scrwh - 1.0f;
|
|
||||||
screenVerts[4] = screenVerts[7] = screenVerts[1] + (float)barsize/scrwh;
|
|
||||||
|
|
||||||
fix[1] = fix[7] = (float)upbary/scrwh * yfix;
|
|
||||||
fix[3] = fix[5] = fix[1] + (float)barsize/2/scrwh * yfix;
|
|
||||||
|
|
||||||
pglTexCoordPointer(2, GL_FLOAT, 0, fix);
|
|
||||||
pglVertexPointer(3, GL_FLOAT, 0, screenVerts);
|
|
||||||
pglDrawArrays(GL_TRIANGLE_FAN, 0, 4);
|
|
||||||
|
|
||||||
fix[1] = fix[7] += (fix[3] - fix[7])*2;
|
|
||||||
screenVerts[1] = screenVerts[10] += (screenVerts[4] - screenVerts[1])*2;
|
|
||||||
|
|
||||||
pglTexCoordPointer(2, GL_FLOAT, 0, fix);
|
|
||||||
pglVertexPointer(3, GL_FLOAT, 0, screenVerts);
|
|
||||||
pglDrawArrays(GL_TRIANGLE_FAN, 0, 4);
|
|
||||||
|
|
||||||
// Downward bar
|
|
||||||
GL_MakeScreenTexture(HWD_SCREENTEXTURE_VHS);
|
|
||||||
pglBindTexture(GL_TEXTURE_2D, screenTextures[HWD_SCREENTEXTURE_VHS]);
|
|
||||||
|
|
||||||
fix[0] = 0.0f;
|
|
||||||
fix[6] = xfix;
|
|
||||||
fix[2] = (float)downdistort / scrwf * -xfix;
|
|
||||||
fix[4] = fix[2] + fix[6];
|
|
||||||
|
|
||||||
screenVerts[1] = screenVerts[10] = 2.0f*downbary/scrwh - 1.0f;
|
|
||||||
screenVerts[4] = screenVerts[7] = screenVerts[1] + (float)barsize/scrwh;
|
|
||||||
|
|
||||||
fix[1] = fix[7] = (float)downbary/scrwh * yfix;
|
|
||||||
fix[3] = fix[5] = fix[1] + (float)barsize/2/scrwh * yfix;
|
|
||||||
|
|
||||||
pglTexCoordPointer(2, GL_FLOAT, 0, fix);
|
|
||||||
pglVertexPointer(3, GL_FLOAT, 0, screenVerts);
|
|
||||||
pglDrawArrays(GL_TRIANGLE_FAN, 0, 4);
|
|
||||||
|
|
||||||
fix[1] = fix[7] += (fix[3] - fix[7])*2;
|
|
||||||
screenVerts[1] = screenVerts[10] += (screenVerts[4] - screenVerts[1])*2;
|
|
||||||
|
|
||||||
pglTexCoordPointer(2, GL_FLOAT, 0, fix);
|
|
||||||
pglVertexPointer(3, GL_FLOAT, 0, screenVerts);
|
|
||||||
pglDrawArrays(GL_TRIANGLE_FAN, 0, 4);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Create a texture from the screen.
|
// Create a texture from the screen.
|
||||||
|
|||||||
+2
-2
@@ -3080,8 +3080,8 @@ static int lib_gPlayerDeviceRumble(lua_State *L)
|
|||||||
{
|
{
|
||||||
INT32 pnum = -1;
|
INT32 pnum = -1;
|
||||||
player_t *player = *((player_t **)luaL_checkudata(L, 1, META_PLAYER)); // retrieve player
|
player_t *player = *((player_t **)luaL_checkudata(L, 1, META_PLAYER)); // retrieve player
|
||||||
UINT32 low_strength = (UINT32)luaL_checkinteger(L, 2); // low frequency rumble motor strength
|
UINT16 low_strength = (UINT16)luaL_checkinteger(L, 2); // low frequency rumble motor strenght
|
||||||
UINT32 high_strength = (UINT32)luaL_checkinteger(L, 3); // high frequency rumble motor strength
|
UINT16 high_strength = (UINT16)luaL_checkinteger(L, 3); // high frequency rumble motor strenght
|
||||||
UINT32 duration = (UINT32)luaL_optinteger(L, 4, 84); // duration of rumble in ms
|
UINT32 duration = (UINT32)luaL_optinteger(L, 4, 84); // duration of rumble in ms
|
||||||
|
|
||||||
if (!player)
|
if (!player)
|
||||||
|
|||||||
+1
-5
@@ -217,11 +217,7 @@ static int mobj_get(lua_State *L)
|
|||||||
case mobj_skin: // skin name or nil, not struct
|
case mobj_skin: // skin name or nil, not struct
|
||||||
if (!mo->skin)
|
if (!mo->skin)
|
||||||
return 0;
|
return 0;
|
||||||
// HUD ONLY!!!!!!!!!!
|
lua_pushstring(L, ((skin_t *)mo->skin)->name);
|
||||||
if (hud_running && cv_luaimmersion.value)
|
|
||||||
lua_pushstring(L, K_GetMobjSkin(mo)->name);
|
|
||||||
else
|
|
||||||
lua_pushstring(L, ((skin_t *)mo->skin)->name);
|
|
||||||
break;
|
break;
|
||||||
case mobj_color:
|
case mobj_color:
|
||||||
lua_pushinteger(L, mo->color);
|
lua_pushinteger(L, mo->color);
|
||||||
|
|||||||
+19
-11
@@ -80,9 +80,12 @@ typedef LPVOID (WINAPI *p_MapViewOfFile) (HANDLE, DWORD, DWORD, DWORD, SIZE_T);
|
|||||||
#include "i_ttf.h"
|
#include "i_ttf.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined (__unix__) || defined(__APPLE__) || defined (UNIXCOMMON)
|
#include "SDL_cpuinfo.h"
|
||||||
#if defined (__linux__) || defined (__HAIKU__)
|
#define HAVE_SDLCPUINFO
|
||||||
#include <sys/statvfs.h>
|
|
||||||
|
#if defined (__unix__) || defined(__APPLE__) || (defined (UNIXCOMMON) && !defined (__HAIKU__))
|
||||||
|
#if defined (__linux__)
|
||||||
|
#include <sys/vfs.h>
|
||||||
#elif defined(__APPLE__)
|
#elif defined(__APPLE__)
|
||||||
#include <sys/param.h>
|
#include <sys/param.h>
|
||||||
#include <sys/mount.h>
|
#include <sys/mount.h>
|
||||||
@@ -90,7 +93,6 @@ typedef LPVOID (WINAPI *p_MapViewOfFile) (HANDLE, DWORD, DWORD, DWORD, SIZE_T);
|
|||||||
#include <sys/sysctl.h>
|
#include <sys/sysctl.h>
|
||||||
#include <mach/mach.h>
|
#include <mach/mach.h>
|
||||||
#else
|
#else
|
||||||
#include <sys/statvfs.h>
|
|
||||||
#include <sys/param.h>
|
#include <sys/param.h>
|
||||||
#include <sys/mount.h>
|
#include <sys/mount.h>
|
||||||
/*For meminfo*/
|
/*For meminfo*/
|
||||||
@@ -103,7 +105,7 @@ typedef LPVOID (WINAPI *p_MapViewOfFile) (HANDLE, DWORD, DWORD, DWORD, SIZE_T);
|
|||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined (__linux__) || defined (UNIXCOMMON)
|
#if defined (__linux__) || (defined (UNIXCOMMON) && !defined (__HAIKU__))
|
||||||
#ifndef NOTERMIOS
|
#ifndef NOTERMIOS
|
||||||
#include <termios.h>
|
#include <termios.h>
|
||||||
#include <sys/ioctl.h> // ioctl
|
#include <sys/ioctl.h> // ioctl
|
||||||
@@ -118,10 +120,8 @@ typedef LPVOID (WINAPI *p_MapViewOfFile) (HANDLE, DWORD, DWORD, DWORD, SIZE_T);
|
|||||||
#if defined (__unix__) || (defined (UNIXCOMMON) && !defined (__APPLE__))
|
#if defined (__unix__) || (defined (UNIXCOMMON) && !defined (__APPLE__))
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include <sys/wait.h>
|
#include <sys/wait.h>
|
||||||
#ifndef __HAIKU__ // haiku's crash dialog is just objectively better
|
|
||||||
#define NEWSIGNALHANDLER
|
#define NEWSIGNALHANDLER
|
||||||
#endif
|
#endif
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef NOMUMBLE
|
#ifndef NOMUMBLE
|
||||||
#ifdef __linux__ // need -lrt
|
#ifdef __linux__ // need -lrt
|
||||||
@@ -195,6 +195,7 @@ static char returnWadPath[256];
|
|||||||
#include "../i_sound.h"
|
#include "../i_sound.h"
|
||||||
#include "../i_system.h"
|
#include "../i_system.h"
|
||||||
#include "../i_threads.h"
|
#include "../i_threads.h"
|
||||||
|
#include "../screen.h" //vid.WndParent
|
||||||
#include "../d_net.h"
|
#include "../d_net.h"
|
||||||
#include "../g_game.h"
|
#include "../g_game.h"
|
||||||
#include "../g_demo.h"
|
#include "../g_demo.h"
|
||||||
@@ -207,6 +208,9 @@ static char returnWadPath[256];
|
|||||||
|
|
||||||
#include "../m_argv.h"
|
#include "../m_argv.h"
|
||||||
|
|
||||||
|
#include "../r_main.h" // Frame interpolation/uncapped
|
||||||
|
#include "../r_fps.h"
|
||||||
|
|
||||||
#include "../s_sound.h"
|
#include "../s_sound.h"
|
||||||
|
|
||||||
#include "../d_main.h"
|
#include "../d_main.h"
|
||||||
@@ -270,7 +274,7 @@ static void tty_Clear(void)
|
|||||||
write(STDOUT_FILENO, "\r", 1);
|
write(STDOUT_FILENO, "\r", 1);
|
||||||
if (tty_con.cursor>0)
|
if (tty_con.cursor>0)
|
||||||
{
|
{
|
||||||
for (i = 0; i < tty_con.cursor; i++)
|
for (i=0; i<tty_con.cursor; i++)
|
||||||
{
|
{
|
||||||
write(STDOUT_FILENO, " ", 1);
|
write(STDOUT_FILENO, " ", 1);
|
||||||
}
|
}
|
||||||
@@ -2287,13 +2291,18 @@ void I_ShutdownSystem(void)
|
|||||||
void I_GetDiskFreeSpace(INT64 *freespace)
|
void I_GetDiskFreeSpace(INT64 *freespace)
|
||||||
{
|
{
|
||||||
#if defined (__unix__) || defined(__APPLE__) || defined (UNIXCOMMON)
|
#if defined (__unix__) || defined(__APPLE__) || defined (UNIXCOMMON)
|
||||||
struct statvfs stfs;
|
#if defined (SOLARIS) || defined (__HAIKU__)
|
||||||
if (statvfs(srb2home, &stfs) == -1)
|
*freespace = INT32_MAX;
|
||||||
|
return;
|
||||||
|
#else // Both Linux and BSD have this, apparently.
|
||||||
|
struct statfs stfs;
|
||||||
|
if (statfs(".", &stfs) == -1)
|
||||||
{
|
{
|
||||||
*freespace = INT32_MAX;
|
*freespace = INT32_MAX;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
*freespace = stfs.f_bavail * stfs.f_bsize;
|
*freespace = stfs.f_bavail * stfs.f_bsize;
|
||||||
|
#endif
|
||||||
#elif defined (_WIN32)
|
#elif defined (_WIN32)
|
||||||
static p_GetDiskFreeSpaceExA pfnGetDiskFreeSpaceEx = NULL;
|
static p_GetDiskFreeSpaceExA pfnGetDiskFreeSpaceEx = NULL;
|
||||||
static boolean testwin95 = false;
|
static boolean testwin95 = false;
|
||||||
@@ -2304,7 +2313,6 @@ void I_GetDiskFreeSpace(INT64 *freespace)
|
|||||||
pfnGetDiskFreeSpaceEx = (p_GetDiskFreeSpaceExA)(LPVOID)GetProcAddress(GetModuleHandleA("kernel32.dll"), "GetDiskFreeSpaceExA");
|
pfnGetDiskFreeSpaceEx = (p_GetDiskFreeSpaceExA)(LPVOID)GetProcAddress(GetModuleHandleA("kernel32.dll"), "GetDiskFreeSpaceExA");
|
||||||
testwin95 = true;
|
testwin95 = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (pfnGetDiskFreeSpaceEx)
|
if (pfnGetDiskFreeSpaceEx)
|
||||||
{
|
{
|
||||||
if (pfnGetDiskFreeSpaceEx(NULL, &lfreespace, &usedbytes, NULL))
|
if (pfnGetDiskFreeSpaceEx(NULL, &lfreespace, &usedbytes, NULL))
|
||||||
|
|||||||
+2
-2
@@ -262,9 +262,9 @@ void OglSdlFinishUpdate(SDL_Window *window)
|
|||||||
// Sryder: We need to draw the final screen texture again into the other buffer in the original position so that
|
// Sryder: We need to draw the final screen texture again into the other buffer in the original position so that
|
||||||
// effects that want to take the old screen can do so after this
|
// effects that want to take the old screen can do so after this
|
||||||
#ifdef USE_FBO_OGL
|
#ifdef USE_FBO_OGL
|
||||||
if (!usefbo && (realwidth != sdlw || realheight != sdlh || WipeInAction)) // not needed if fbo is in use
|
if (!usefbo && (realwidth != sdlw || realheight != sdlh)) // not needed if fbo is in use
|
||||||
#else
|
#else
|
||||||
if (realwidth != sdlw || realheight != sdlh || WipeInAction) // this is not needed if the render size matches window size
|
if (realwidth != sdlw || realheight != sdlh) // this is not needed if the render size matches window size
|
||||||
#endif
|
#endif
|
||||||
HWR_DrawScreenFinalTexture(realwidth, realheight);
|
HWR_DrawScreenFinalTexture(realwidth, realheight);
|
||||||
}
|
}
|
||||||
|
|||||||
+6
-6
@@ -1885,7 +1885,7 @@ void V_DrawVhsEffect(boolean rewind)
|
|||||||
#ifdef HWRENDER
|
#ifdef HWRENDER
|
||||||
if (rendermode == render_opengl)
|
if (rendermode == render_opengl)
|
||||||
{
|
{
|
||||||
HWR_RenderVhsEffect(uby, dby, updistort, downdistort, barsize);
|
HWR_RenderVhsEffect(uby, dby, updistort, downdistort, barsize, rewind);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
@@ -1900,7 +1900,7 @@ void V_DrawVhsEffect(boolean rewind)
|
|||||||
|
|
||||||
pos = 0;
|
pos = 0;
|
||||||
|
|
||||||
for (y = 0; y < vid.height; y += 2)
|
for (y = 0; y < vid.height; y+=2)
|
||||||
{
|
{
|
||||||
thismapstart = normalmapstart;
|
thismapstart = normalmapstart;
|
||||||
offs = 0;
|
offs = 0;
|
||||||
@@ -1917,7 +1917,7 @@ void V_DrawVhsEffect(boolean rewind)
|
|||||||
offs -= downdistort * 2.0f * min(y-dby, dby+barsize-y) / barsize;
|
offs -= downdistort * 2.0f * min(y-dby, dby+barsize-y) / barsize;
|
||||||
}
|
}
|
||||||
|
|
||||||
offs += M_RandomKey(vid.udup<<1);
|
offs += M_RandomKey(vid.dup<<1);
|
||||||
|
|
||||||
// lazy way to avoid crashes
|
// lazy way to avoid crashes
|
||||||
if ((y == 0 && offs < 0) || (y >= vid.height-2 && offs > 0))
|
if ((y == 0 && offs < 0) || (y >= vid.height-2 && offs > 0))
|
||||||
@@ -3622,7 +3622,7 @@ void V_DoPostProcessor(INT32 view, INT32 param)
|
|||||||
|
|
||||||
for (y = yoffset; y < yoffset+viewheight; y++)
|
for (y = yoffset; y < yoffset+viewheight; y++)
|
||||||
{
|
{
|
||||||
sine = (FINESINE(disStart)*5)>>FRACBITS;
|
sine = (FINESINE(disStart) * 5) >> FRACBITS;
|
||||||
newpix = abs(sine);
|
newpix = abs(sine);
|
||||||
|
|
||||||
if (sine < 0)
|
if (sine < 0)
|
||||||
@@ -3662,8 +3662,8 @@ void V_DoPostProcessor(INT32 view, INT32 param)
|
|||||||
tmpscr[y*vid.width + x] = srcscr[y*vid.width+newpix]; // *(transme + (srcscr[y*vid.width+x]<<8) + srcscr[y*vid.width+newpix]);
|
tmpscr[y*vid.width + x] = srcscr[y*vid.width+newpix]; // *(transme + (srcscr[y*vid.width+x]<<8) + srcscr[y*vid.width+newpix]);
|
||||||
}*/
|
}*/
|
||||||
|
|
||||||
disStart += 22;//the offset into the displacement map, increment each game loop
|
disStart += 22; // the offset into the displacement map, increment each game loop
|
||||||
disStart &= FINEMASK; //clip it to FINEMASK
|
disStart &= FINEMASK; // clip it to FINEMASK
|
||||||
}
|
}
|
||||||
|
|
||||||
UINT8 *tmp = tmpscr;
|
UINT8 *tmp = tmpscr;
|
||||||
|
|||||||
Reference in new issue
Block a user