2006-04-23 06:44:19 +00:00
|
|
|
#include "compat.h"
|
|
|
|
#include "osd.h"
|
|
|
|
#include "build.h"
|
|
|
|
#include "baselayer.h"
|
|
|
|
|
2012-11-25 04:26:37 +00:00
|
|
|
#include "renderlayer.h"
|
2006-04-23 06:44:19 +00:00
|
|
|
|
2012-12-14 19:28:17 +00:00
|
|
|
#include "a.h"
|
2009-08-09 05:32:17 +00:00
|
|
|
#include "polymost.h"
|
2018-04-05 04:39:30 +00:00
|
|
|
#include "cache1d.h"
|
2019-10-04 19:13:04 +00:00
|
|
|
#include "../../glbackend/glbackend.h"
|
2009-08-09 05:32:17 +00:00
|
|
|
|
2018-04-12 21:02:31 +00:00
|
|
|
// video
|
2018-04-12 21:02:18 +00:00
|
|
|
#ifdef _WIN32
|
|
|
|
extern "C"
|
|
|
|
{
|
|
|
|
__declspec(dllexport) int AmdPowerXpressRequestHighPerformance = 0x00000001;
|
|
|
|
__declspec(dllexport) DWORD NvOptimusEnablement = 0x00000001;
|
|
|
|
}
|
|
|
|
#endif // _WIN32
|
|
|
|
|
2019-08-29 19:00:52 +00:00
|
|
|
int32_t g_borderless=2;
|
2014-12-27 18:36:43 +00:00
|
|
|
|
2018-04-12 21:02:31 +00:00
|
|
|
// input
|
|
|
|
char inputdevices = 0;
|
2010-05-25 10:56:00 +00:00
|
|
|
|
2018-04-12 21:02:31 +00:00
|
|
|
char keystatus[NUMKEYS];
|
|
|
|
char g_keyFIFO[KEYFIFOSIZ];
|
|
|
|
char g_keyAsciiFIFO[KEYFIFOSIZ];
|
2019-09-19 20:02:45 +00:00
|
|
|
uint8_t g_keyFIFOpos;
|
2018-04-12 21:02:31 +00:00
|
|
|
uint8_t g_keyFIFOend;
|
|
|
|
uint8_t g_keyAsciiPos;
|
|
|
|
uint8_t g_keyAsciiEnd;
|
|
|
|
char g_keyRemapTable[NUMKEYS];
|
|
|
|
char g_keyNameTable[NUMKEYS][24];
|
2010-05-25 10:56:00 +00:00
|
|
|
|
2018-04-12 21:02:31 +00:00
|
|
|
void (*keypresscallback)(int32_t, int32_t);
|
2010-07-03 08:53:57 +00:00
|
|
|
|
2018-04-12 21:02:31 +00:00
|
|
|
void keySetCallback(void (*callback)(int32_t, int32_t)) { keypresscallback = callback; }
|
2010-05-25 10:56:00 +00:00
|
|
|
|
2018-04-12 21:02:31 +00:00
|
|
|
int32_t keyGetState(int32_t key) { return keystatus[g_keyRemapTable[key]]; }
|
2011-03-04 07:04:42 +00:00
|
|
|
|
2018-04-12 21:02:31 +00:00
|
|
|
void keySetState(int32_t key, int32_t state)
|
2010-05-25 10:56:00 +00:00
|
|
|
{
|
2018-04-12 21:02:31 +00:00
|
|
|
keystatus[g_keyRemapTable[key]] = state;
|
2010-05-25 10:56:00 +00:00
|
|
|
|
2011-01-16 02:50:27 +00:00
|
|
|
if (state)
|
2010-05-25 10:56:00 +00:00
|
|
|
{
|
2018-04-12 21:02:31 +00:00
|
|
|
g_keyFIFO[g_keyFIFOend] = g_keyRemapTable[key];
|
|
|
|
g_keyFIFO[(g_keyFIFOend+1)&(KEYFIFOSIZ-1)] = state;
|
|
|
|
g_keyFIFOend = ((g_keyFIFOend+2)&(KEYFIFOSIZ-1));
|
2010-05-25 10:56:00 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-09-19 20:02:45 +00:00
|
|
|
char keyGetScan(void)
|
|
|
|
{
|
|
|
|
if (g_keyFIFOpos == g_keyFIFOend)
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
char const c = g_keyFIFO[g_keyFIFOpos];
|
|
|
|
g_keyFIFOpos = ((g_keyFIFOpos + 2) & (KEYFIFOSIZ - 1));
|
|
|
|
|
|
|
|
return c;
|
|
|
|
}
|
|
|
|
|
|
|
|
void keyFlushScans(void)
|
|
|
|
{
|
|
|
|
Bmemset(&g_keyFIFO,0,sizeof(g_keyFIFO));
|
|
|
|
g_keyFIFOpos = g_keyFIFOend = 0;
|
|
|
|
}
|
|
|
|
|
2010-05-25 10:56:00 +00:00
|
|
|
//
|
2018-04-12 21:02:31 +00:00
|
|
|
// character-based input functions
|
2010-05-25 10:56:00 +00:00
|
|
|
//
|
2018-04-12 21:02:31 +00:00
|
|
|
char keyGetChar(void)
|
2010-05-25 10:56:00 +00:00
|
|
|
{
|
2018-04-12 21:02:31 +00:00
|
|
|
if (g_keyAsciiPos == g_keyAsciiEnd)
|
2010-05-25 10:56:00 +00:00
|
|
|
return 0;
|
|
|
|
|
2018-04-12 21:02:31 +00:00
|
|
|
char const c = g_keyAsciiFIFO[g_keyAsciiPos];
|
|
|
|
g_keyAsciiPos = ((g_keyAsciiPos + 1) & (KEYFIFOSIZ - 1));
|
|
|
|
|
|
|
|
return c;
|
2010-05-25 10:56:00 +00:00
|
|
|
}
|
|
|
|
|
2018-04-12 21:02:31 +00:00
|
|
|
void keyFlushChars(void)
|
2010-05-25 10:56:00 +00:00
|
|
|
{
|
2018-04-12 21:02:31 +00:00
|
|
|
Bmemset(&g_keyAsciiFIFO,0,sizeof(g_keyAsciiFIFO));
|
|
|
|
g_keyAsciiPos = g_keyAsciiEnd = 0;
|
2010-05-25 10:56:00 +00:00
|
|
|
}
|
|
|
|
|
2018-04-12 21:02:31 +00:00
|
|
|
const char *keyGetName(int32_t num) { return ((unsigned)num >= NUMKEYS) ? NULL : g_keyNameTable[num]; }
|
|
|
|
|
|
|
|
vec2_t g_mousePos;
|
|
|
|
vec2_t g_mouseAbs;
|
|
|
|
int32_t g_mouseBits;
|
|
|
|
uint8_t g_mouseClickState;
|
|
|
|
|
|
|
|
bool g_mouseEnabled;
|
|
|
|
bool g_mouseGrabbed;
|
|
|
|
bool g_mouseInsideWindow = 1;
|
|
|
|
bool g_mouseLockedToWindow = 1;
|
|
|
|
|
|
|
|
void (*g_mouseCallback)(int32_t, int32_t);
|
|
|
|
void mouseSetCallback(void(*callback)(int32_t, int32_t)) { g_mouseCallback = callback; }
|
|
|
|
|
|
|
|
int32_t mouseAdvanceClickState(void)
|
2010-05-25 10:56:00 +00:00
|
|
|
{
|
2018-04-12 21:02:31 +00:00
|
|
|
switch (g_mouseClickState)
|
|
|
|
{
|
|
|
|
case MOUSE_PRESSED: g_mouseClickState = MOUSE_HELD; return 1;
|
|
|
|
case MOUSE_RELEASED: g_mouseClickState = MOUSE_IDLE; return 1;
|
|
|
|
case MOUSE_HELD: return 1;
|
|
|
|
}
|
|
|
|
return 0;
|
2010-05-25 10:56:00 +00:00
|
|
|
}
|
|
|
|
|
2018-04-12 21:02:31 +00:00
|
|
|
void mouseReadPos(int32_t *x, int32_t *y)
|
2011-04-07 01:16:29 +00:00
|
|
|
{
|
2018-04-12 21:02:31 +00:00
|
|
|
if (!g_mouseEnabled || !g_mouseGrabbed || !appactive)
|
|
|
|
{
|
|
|
|
*x = *y = 0;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
*x = g_mousePos.x;
|
|
|
|
*y = g_mousePos.y;
|
|
|
|
g_mousePos.x = g_mousePos.y = 0;
|
2011-04-07 01:16:29 +00:00
|
|
|
}
|
|
|
|
|
2018-04-12 21:02:31 +00:00
|
|
|
int32_t mouseReadAbs(vec2_t * const pResult, vec2_t const * const pInput)
|
2012-05-01 12:38:14 +00:00
|
|
|
{
|
2018-04-12 21:02:31 +00:00
|
|
|
if (!g_mouseEnabled || !appactive || !g_mouseInsideWindow || (osd && osd->flags & OSD_CAPTURE))
|
2014-11-17 07:39:12 +00:00
|
|
|
return 0;
|
|
|
|
|
2018-04-12 21:02:31 +00:00
|
|
|
int32_t const xwidth = max(scale(240<<16, xdim, ydim), 320<<16);
|
2014-11-17 07:39:12 +00:00
|
|
|
|
2018-07-14 21:36:44 +00:00
|
|
|
pResult->x = scale(pInput->x, xwidth, xres) - ((xwidth>>1) - (320<<15));
|
|
|
|
pResult->y = scale(pInput->y, 200<<16, yres);
|
2014-11-17 07:39:12 +00:00
|
|
|
|
2019-01-30 00:19:56 +00:00
|
|
|
pResult->y = divscale16(pResult->y - (200<<15), rotatesprite_yxaspect) + (200<<15) - rotatesprite_y_offset;
|
|
|
|
|
2014-11-17 07:39:12 +00:00
|
|
|
return 1;
|
2012-05-01 12:38:14 +00:00
|
|
|
}
|
|
|
|
|
2018-11-18 18:08:53 +00:00
|
|
|
int32_t mouseReadButtons(void)
|
2011-04-07 01:16:29 +00:00
|
|
|
{
|
2018-11-18 18:08:53 +00:00
|
|
|
return (!g_mouseEnabled || !appactive || !g_mouseInsideWindow || (osd && osd->flags & OSD_CAPTURE)) ? 0 : g_mouseBits;
|
2011-04-07 01:16:29 +00:00
|
|
|
}
|
|
|
|
|
2018-04-12 21:02:31 +00:00
|
|
|
controllerinput_t joystick;
|
|
|
|
|
|
|
|
void joySetCallback(void (*callback)(int32_t, int32_t)) { joystick.pCallback = callback; }
|
|
|
|
void joyReadButtons(int32_t *pResult) { *pResult = appactive ? joystick.bits : 0; }
|
2012-06-03 16:11:22 +00:00
|
|
|
|
2017-02-19 22:15:44 +00:00
|
|
|
#if defined __linux || defined EDUKE32_BSD || defined __APPLE__
|
2014-11-02 05:36:28 +00:00
|
|
|
# include <sys/mman.h>
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2012-12-14 19:28:17 +00:00
|
|
|
// Calculate ylookup[] and call setvlinebpl()
|
|
|
|
void calc_ylookup(int32_t bpl, int32_t lastyidx)
|
|
|
|
{
|
|
|
|
int32_t i, j=0;
|
2014-11-06 23:43:47 +00:00
|
|
|
static int32_t ylookupsiz;
|
2014-11-02 05:36:28 +00:00
|
|
|
|
2012-12-14 19:28:17 +00:00
|
|
|
Bassert(lastyidx <= MAXYDIM);
|
|
|
|
|
2014-11-06 23:43:47 +00:00
|
|
|
lastyidx++;
|
|
|
|
|
2014-10-29 17:04:28 +00:00
|
|
|
if (lastyidx > ylookupsiz)
|
|
|
|
{
|
2019-06-25 11:29:08 +00:00
|
|
|
Xaligned_free(ylookup);
|
2014-10-29 17:04:28 +00:00
|
|
|
|
|
|
|
ylookup = (intptr_t *)Xaligned_alloc(16, lastyidx * sizeof(intptr_t));
|
|
|
|
ylookupsiz = lastyidx;
|
|
|
|
}
|
|
|
|
|
|
|
|
for (i=0; i<=lastyidx-4; i+=4)
|
|
|
|
{
|
|
|
|
ylookup[i] = j;
|
|
|
|
ylookup[i + 1] = j + bpl;
|
|
|
|
ylookup[i + 2] = j + (bpl << 1);
|
|
|
|
ylookup[i + 3] = j + (bpl * 3);
|
|
|
|
j += (bpl << 2);
|
|
|
|
}
|
|
|
|
|
2014-11-06 23:43:47 +00:00
|
|
|
for (; i<lastyidx; i++)
|
2012-12-14 19:28:17 +00:00
|
|
|
{
|
|
|
|
ylookup[i] = j;
|
|
|
|
j += bpl;
|
|
|
|
}
|
|
|
|
|
|
|
|
setvlinebpl(bpl);
|
|
|
|
}
|
|
|
|
|
2014-11-02 05:36:28 +00:00
|
|
|
|
|
|
|
void makeasmwriteable(void)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2016-11-15 21:55:30 +00:00
|
|
|
int32_t vsync=0;
|
2018-04-12 21:02:31 +00:00
|
|
|
int32_t g_logFlushWindow = 1;
|
2016-11-15 21:55:30 +00:00
|
|
|
|
2006-04-23 06:44:19 +00:00
|
|
|
#ifdef USE_OPENGL
|
2010-05-02 23:27:30 +00:00
|
|
|
struct glinfo_t glinfo =
|
2007-12-12 17:42:14 +00:00
|
|
|
{
|
2009-09-30 01:26:13 +00:00
|
|
|
"Unknown", // vendor
|
|
|
|
"Unknown", // renderer
|
|
|
|
"0.0.0", // version
|
|
|
|
"", // extensions
|
|
|
|
|
|
|
|
1.0, // max anisotropy
|
2007-12-12 17:42:14 +00:00
|
|
|
};
|
2009-01-06 06:59:18 +00:00
|
|
|
|
2013-08-12 15:18:19 +00:00
|
|
|
// Used to register the game's / editor's osdcmd_vidmode() functions here.
|
2018-11-18 18:06:15 +00:00
|
|
|
int32_t (*baselayer_osdcmd_vidmode_func)(osdcmdptr_t parm);
|
2013-08-12 15:18:19 +00:00
|
|
|
|
2018-11-18 18:06:15 +00:00
|
|
|
static int osdfunc_setrendermode(osdcmdptr_t parm)
|
2006-04-23 06:44:19 +00:00
|
|
|
{
|
2013-08-12 15:18:19 +00:00
|
|
|
if (parm->numparms != 1)
|
|
|
|
return OSDCMD_SHOWHELP;
|
|
|
|
|
2016-01-11 05:06:10 +00:00
|
|
|
char *p;
|
|
|
|
int32_t m = Bstrtol(parm->parms[0], &p, 10);
|
2006-04-23 06:44:19 +00:00
|
|
|
|
2013-08-12 15:18:19 +00:00
|
|
|
if (m != REND_CLASSIC && m != REND_POLYMOST && m != REND_POLYMER)
|
|
|
|
return OSDCMD_SHOWHELP;
|
|
|
|
|
|
|
|
if ((m==REND_CLASSIC) != (bpp==8) && baselayer_osdcmd_vidmode_func)
|
|
|
|
{
|
|
|
|
// Mismatch between video mode and requested renderer, do auto switch.
|
|
|
|
osdfuncparm_t parm;
|
|
|
|
char arg[4];
|
|
|
|
|
|
|
|
const char *ptrptr[1];
|
|
|
|
ptrptr[0] = arg;
|
|
|
|
|
|
|
|
Bmemset(&parm, 0, sizeof(parm));
|
|
|
|
|
|
|
|
if (m==REND_CLASSIC)
|
|
|
|
Bmemcpy(&arg, "8", 2);
|
|
|
|
else
|
|
|
|
Bmemcpy(&arg, "32", 3);
|
|
|
|
|
|
|
|
// CAUTION: we assume that the osdcmd_vidmode function doesn't use any
|
|
|
|
// other member!
|
|
|
|
parm.numparms = 1;
|
|
|
|
parm.parms = ptrptr;
|
|
|
|
|
|
|
|
baselayer_osdcmd_vidmode_func(&parm);
|
|
|
|
}
|
2006-04-23 06:44:19 +00:00
|
|
|
|
2018-04-12 21:03:47 +00:00
|
|
|
videoSetRenderMode(m);
|
2012-12-30 20:34:55 +00:00
|
|
|
|
2018-10-07 05:21:43 +00:00
|
|
|
char const *renderer = "other";
|
2016-01-11 05:06:10 +00:00
|
|
|
|
2018-04-12 21:03:12 +00:00
|
|
|
switch (videoGetRenderMode())
|
2012-12-30 20:34:55 +00:00
|
|
|
{
|
|
|
|
case REND_CLASSIC:
|
2018-10-07 05:21:43 +00:00
|
|
|
#ifdef NOASM
|
|
|
|
renderer = "classic software (C)";
|
|
|
|
#else
|
|
|
|
renderer = "classic software (ASM)";
|
|
|
|
#endif
|
2012-12-30 20:34:55 +00:00
|
|
|
break;
|
|
|
|
case REND_POLYMOST:
|
2016-01-11 05:06:10 +00:00
|
|
|
renderer = "polygonal OpenGL";
|
2012-12-30 20:34:55 +00:00
|
|
|
break;
|
2016-03-14 00:07:40 +00:00
|
|
|
#ifdef POLYMER
|
2012-12-30 20:34:55 +00:00
|
|
|
case REND_POLYMER:
|
2016-01-11 05:06:10 +00:00
|
|
|
renderer = "great justice (Polymer)";
|
2012-12-30 20:34:55 +00:00
|
|
|
break;
|
2016-03-14 00:07:40 +00:00
|
|
|
#endif
|
2012-12-30 20:34:55 +00:00
|
|
|
}
|
|
|
|
|
2016-01-11 05:06:10 +00:00
|
|
|
OSD_Printf("Rendering method changed to %s\n", renderer);
|
2006-04-23 06:44:19 +00:00
|
|
|
|
2006-04-24 19:04:22 +00:00
|
|
|
return OSDCMD_OK;
|
2006-04-23 06:44:19 +00:00
|
|
|
}
|
2018-04-12 21:02:31 +00:00
|
|
|
|
2006-04-23 06:44:19 +00:00
|
|
|
#ifdef DEBUGGINGAIDS
|
2018-11-18 18:06:15 +00:00
|
|
|
static int osdcmd_hicsetpalettetint(osdcmdptr_t parm)
|
2006-04-23 06:44:19 +00:00
|
|
|
{
|
2017-12-12 05:13:58 +00:00
|
|
|
int32_t parms[8];
|
2006-04-24 19:04:22 +00:00
|
|
|
|
2017-12-12 05:13:58 +00:00
|
|
|
if (parm->numparms < 1 || (int32_t)ARRAY_SIZE(parms) < parm->numparms) return OSDCMD_SHOWHELP;
|
2006-04-24 19:04:22 +00:00
|
|
|
|
2017-12-12 05:13:58 +00:00
|
|
|
size_t i;
|
|
|
|
for (i = 0; (int32_t)i < parm->numparms; ++i)
|
|
|
|
parms[i] = Batol(parm->parms[i]);
|
|
|
|
for (; i < ARRAY_SIZE(parms); ++i)
|
|
|
|
parms[i] = 0;
|
2006-04-24 19:04:22 +00:00
|
|
|
|
2017-12-12 05:13:58 +00:00
|
|
|
// order is intentional
|
|
|
|
hicsetpalettetint(parms[0],parms[1],parms[2],parms[3],parms[5],parms[6],parms[7],parms[4]);
|
2006-04-24 19:04:22 +00:00
|
|
|
|
|
|
|
return OSDCMD_OK;
|
2006-04-23 06:44:19 +00:00
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2018-11-18 18:06:15 +00:00
|
|
|
int osdcmd_glinfo(osdcmdptr_t UNUSED(parm))
|
2006-04-23 06:44:19 +00:00
|
|
|
{
|
2017-06-27 02:24:14 +00:00
|
|
|
UNREFERENCED_CONST_PARAMETER(parm);
|
2008-03-22 10:23:57 +00:00
|
|
|
|
2015-02-11 05:23:04 +00:00
|
|
|
initprintf("OpenGL information\n %s %s %s\n",
|
2019-10-04 19:13:04 +00:00
|
|
|
GLInterface.glinfo.vendor, GLInterface.glinfo.renderer, GLInterface.glinfo.version);
|
2006-04-24 19:04:22 +00:00
|
|
|
|
|
|
|
return OSDCMD_OK;
|
2006-04-23 06:44:19 +00:00
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2018-11-18 18:06:15 +00:00
|
|
|
static int osdcmd_cvar_set_baselayer(osdcmdptr_t parm)
|
2006-04-23 06:44:19 +00:00
|
|
|
{
|
2010-07-03 08:53:57 +00:00
|
|
|
int32_t r = osdcmd_cvar_set(parm);
|
2006-04-24 19:04:22 +00:00
|
|
|
|
2010-07-03 08:53:57 +00:00
|
|
|
if (r != OSDCMD_OK) return r;
|
|
|
|
|
|
|
|
if (!Bstrcasecmp(parm->name, "vid_gamma") || !Bstrcasecmp(parm->name, "vid_brightness") || !Bstrcasecmp(parm->name, "vid_contrast"))
|
|
|
|
{
|
2018-04-12 21:03:12 +00:00
|
|
|
videoSetPalette(GAMMA_CALC,0,0);
|
2010-07-03 08:53:57 +00:00
|
|
|
|
|
|
|
return r;
|
2006-04-24 19:04:22 +00:00
|
|
|
}
|
2010-07-03 08:53:57 +00:00
|
|
|
|
|
|
|
return r;
|
2006-04-23 06:44:19 +00:00
|
|
|
}
|
|
|
|
|
2009-01-09 09:29:17 +00:00
|
|
|
int32_t baselayer_init(void)
|
2006-04-23 06:44:19 +00:00
|
|
|
{
|
2012-04-09 19:22:00 +00:00
|
|
|
#ifdef _WIN32
|
|
|
|
// on Windows, don't save the "r_screenaspect" cvar because the physical screen size is
|
|
|
|
// determined at startup
|
|
|
|
# define SCREENASPECT_CVAR_TYPE (CVAR_UINT|CVAR_NOSAVE)
|
|
|
|
#else
|
|
|
|
# define SCREENASPECT_CVAR_TYPE (CVAR_UINT)
|
|
|
|
#endif
|
2017-06-27 02:24:14 +00:00
|
|
|
static osdcvardata_t cvars_engine[] =
|
2009-04-29 06:20:07 +00:00
|
|
|
{
|
2018-04-05 04:39:30 +00:00
|
|
|
{ "lz4compressionlevel","adjust LZ4 compression level used for savegames",(void *) &lz4CompressionLevel, CVAR_INT, 1, 32 },
|
2019-09-02 05:55:04 +00:00
|
|
|
{ "r_borderless", "borderless windowed mode: 0: never 1: always 2: if resolution matches desktop", (void *) &r_borderless, CVAR_INT|CVAR_RESTARTVID, 0, 2 },
|
|
|
|
{ "r_displayindex","index of output display",(void *)&r_displayindex, CVAR_INT|CVAR_RESTARTVID, 0, 10 },
|
2013-05-17 03:43:20 +00:00
|
|
|
{ "r_usenewaspect","enable/disable new screen aspect ratio determination code",(void *) &r_usenewaspect, CVAR_BOOL, 0, 1 },
|
|
|
|
{ "r_screenaspect","if using r_usenewaspect and in fullscreen, screen aspect ratio in the form XXYY, e.g. 1609 for 16:9",
|
2012-08-24 18:51:49 +00:00
|
|
|
(void *) &r_screenxy, SCREENASPECT_CVAR_TYPE, 0, 9999 },
|
2019-07-06 16:30:18 +00:00
|
|
|
{ "r_fpgrouscan","use floating-point numbers for slope rendering",(void *) &r_fpgrouscan, CVAR_BOOL, 0, 1 },
|
2013-05-17 03:43:20 +00:00
|
|
|
{ "r_novoxmips","turn off/on the use of mipmaps when rendering 8-bit voxels",(void *) &novoxmips, CVAR_BOOL, 0, 1 },
|
|
|
|
{ "r_voxels","enable/disable automatic sprite->voxel rendering",(void *) &usevoxels, CVAR_BOOL, 0, 1 },
|
Support for drawing 'island sectors' for TROR/classic (and with limited
functionality, Polymost).
The new feature can be enabled/disabled with the 'r_tror_nomaskpass' cvar.
The basic idea is that when drawing lower or upper levels, a first pass
is performed that ignores all red walls for which the TROR nextwall link
'towards' the viewer arrives at a red wall. Thus, in the worst case, there
can be up to twice as many rendering passes now (when it is discovered that
the no-mask-pass isn't different that what would be drawn with the ordinary
one, the latter is skipped, since we've already drawn all needed geometry).
Hovever, this kind of multi-pass splitting is only suitable for simple scenes,
like the upper subway in the TROR test map. In particular, multiple islands
shouldn't 'see' each other.
Two issues are worth mentioning: first, care needs to be taken for translucent
ceilings or floors, since drawing them twice isn't the same as drawing them
once. This is done for classic, but not for Polymost. Second, sprites (which
are always drawn _after_ the geometry for a given pass) are still clipped to
the geometry of the ordinary pass, resulting in their disappearance from
certain angles.
--
Additionaly, a change made it into this commit that fixes redundant collection
of sprites in TROR:classic/Polymost.
git-svn-id: https://svn.eduke32.com/eduke32@2024 1a8010ca-5511-0410-912e-c29ae57300e0
2011-09-15 17:04:14 +00:00
|
|
|
#ifdef YAX_ENABLE
|
2013-05-17 03:43:20 +00:00
|
|
|
{ "r_tror_nomaskpass", "enable/disable additional pass in TROR software rendering", (void *)&r_tror_nomaskpass, CVAR_BOOL, 0, 1 },
|
Support for drawing 'island sectors' for TROR/classic (and with limited
functionality, Polymost).
The new feature can be enabled/disabled with the 'r_tror_nomaskpass' cvar.
The basic idea is that when drawing lower or upper levels, a first pass
is performed that ignores all red walls for which the TROR nextwall link
'towards' the viewer arrives at a red wall. Thus, in the worst case, there
can be up to twice as many rendering passes now (when it is discovered that
the no-mask-pass isn't different that what would be drawn with the ordinary
one, the latter is skipped, since we've already drawn all needed geometry).
Hovever, this kind of multi-pass splitting is only suitable for simple scenes,
like the upper subway in the TROR test map. In particular, multiple islands
shouldn't 'see' each other.
Two issues are worth mentioning: first, care needs to be taken for translucent
ceilings or floors, since drawing them twice isn't the same as drawing them
once. This is done for classic, but not for Polymost. Second, sprites (which
are always drawn _after_ the geometry for a given pass) are still clipped to
the geometry of the ordinary pass, resulting in their disappearance from
certain angles.
--
Additionaly, a change made it into this commit that fixes redundant collection
of sprites in TROR:classic/Polymost.
git-svn-id: https://svn.eduke32.com/eduke32@2024 1a8010ca-5511-0410-912e-c29ae57300e0
2011-09-15 17:04:14 +00:00
|
|
|
#endif
|
2014-02-11 17:55:45 +00:00
|
|
|
{ "r_windowpositioning", "enable/disable window position memory", (void *) &windowpos, CVAR_BOOL, 0, 1 },
|
2018-04-12 21:02:51 +00:00
|
|
|
{ "vid_gamma","adjusts gamma component of gamma ramp",(void *) &g_videoGamma, CVAR_FLOAT|CVAR_FUNCPTR, 0, 10 },
|
|
|
|
{ "vid_contrast","adjusts contrast component of gamma ramp",(void *) &g_videoContrast, CVAR_FLOAT|CVAR_FUNCPTR, 0, 10 },
|
|
|
|
{ "vid_brightness","adjusts brightness component of gamma ramp",(void *) &g_videoBrightness, CVAR_FLOAT|CVAR_FUNCPTR, 0, 10 },
|
2012-12-31 01:50:45 +00:00
|
|
|
#ifdef DEBUGGINGAIDS
|
2011-01-16 02:50:27 +00:00
|
|
|
{ "debug1","debug counter",(void *) &debug1, CVAR_FLOAT, -100000, 100000 },
|
|
|
|
{ "debug2","debug counter",(void *) &debug2, CVAR_FLOAT, -100000, 100000 },
|
2014-01-19 20:17:14 +00:00
|
|
|
#endif
|
|
|
|
#ifdef DEBUG_MASK_DRAWING
|
2014-01-24 21:39:02 +00:00
|
|
|
{ "debug_maskdrawmode", "Show mask draw orders", (void *)&g_maskDrawMode, CVAR_BOOL, 0, 1 },
|
2012-12-31 01:50:45 +00:00
|
|
|
#endif
|
2009-04-29 06:20:07 +00:00
|
|
|
};
|
|
|
|
|
2018-10-25 23:33:40 +00:00
|
|
|
for (auto & i : cvars_engine)
|
|
|
|
OSD_RegisterCvar(&i, (i.flags & CVAR_FUNCPTR) ? osdcmd_cvar_set_baselayer : osdcmd_cvar_set);
|
2009-04-29 06:20:07 +00:00
|
|
|
|
2011-03-04 08:50:58 +00:00
|
|
|
#ifdef USE_OPENGL
|
2006-04-24 19:04:22 +00:00
|
|
|
OSD_RegisterFunction("setrendermode","setrendermode <number>: sets the engine's rendering mode.\n"
|
|
|
|
"Mode numbers are:\n"
|
|
|
|
" 0 - Classic Build software\n"
|
|
|
|
" 3 - Polygonal OpenGL\n"
|
2016-03-14 00:07:40 +00:00
|
|
|
#ifdef POLYMER
|
2010-05-25 10:56:00 +00:00
|
|
|
" 4 - Great justice renderer (Polymer)\n"
|
2016-03-14 00:07:40 +00:00
|
|
|
#endif
|
2006-04-24 19:04:22 +00:00
|
|
|
,
|
|
|
|
osdfunc_setrendermode);
|
2015-11-02 17:07:54 +00:00
|
|
|
|
2009-12-13 01:23:44 +00:00
|
|
|
# ifdef DEBUGGINGAIDS
|
|
|
|
OSD_RegisterFunction("hicsetpalettetint","hicsetpalettetint: sets palette tinting values",osdcmd_hicsetpalettetint);
|
|
|
|
# endif
|
2015-11-02 17:07:54 +00:00
|
|
|
|
2006-04-24 19:04:22 +00:00
|
|
|
OSD_RegisterFunction("glinfo","glinfo: shows OpenGL information about the current OpenGL mode",osdcmd_glinfo);
|
2015-11-02 17:07:54 +00:00
|
|
|
|
2009-04-29 06:20:07 +00:00
|
|
|
polymost_initosdfuncs();
|
2006-04-23 06:44:19 +00:00
|
|
|
#endif
|
2009-04-29 06:20:07 +00:00
|
|
|
|
2018-04-12 21:02:31 +00:00
|
|
|
for (native_t i = 0; i < NUMKEYS; i++) g_keyRemapTable[i] = i;
|
|
|
|
|
2006-04-24 19:04:22 +00:00
|
|
|
return 0;
|
2006-04-23 06:44:19 +00:00
|
|
|
}
|
|
|
|
|