Compare commits

...
69 Commits
Author SHA1 Message Date
Alug 54cbfbe699 forgor ifdef here 2024-11-03 15:33:26 +01:00
Alug 05f454157f Merge pull request #138 from Indev450/Saturn-Next
Saturn v7.2
2024-11-03 16:24:00 +01:00
Alug c451f0f1a6 windoze 2024-11-03 14:23:26 +01:00
Alug 35b85bec36 bleh pls 2024-11-03 14:18:59 +01:00
Alug b0c64be31d try to simplify this alteast a little
shit is awful
2024-11-03 03:40:55 +01:00
Alug d09a28e3da missed this 2024-11-03 03:13:15 +01:00
Alug 550c66b25b add some more checks for this 2024-11-03 02:59:23 +01:00
Alug dfec9e24f3 add just a little more extra safety for fbo 2024-11-03 02:44:42 +01:00
indev 2350889445 Fix normal skin being unable to load if localskins limit is reached (thx Alug for pointing out <3) 2024-11-03 00:26:18 +03:00
indev 990854e176 Fix localskins being unable to load if normal skin limit is reached 2024-11-03 00:16:15 +03:00
Alug 8c727b979c initialise this to null aswell
just in case
2024-11-02 14:19:53 +01:00
Alug 60de48ad65 add accurate fps counter crap to menu + rename it to force it back on
since shit more or less was broken in saturn before and always showed the more accurate one, force it again since stuff caused confusion
2024-11-02 12:57:17 +01:00
Alug 2fd1abce5c v7.2 2024-11-02 01:20:02 +01:00
Alug 691a61de72 oops 2024-11-02 01:12:56 +01:00
Alug 3a153c3abe Merge pull request #137 from Indev450/refactorogl
Cleanup and slightly refactor ogl files
2024-11-02 00:57:49 +01:00
Alug d22645e56a use a "-" here for consistancy 2024-11-02 00:50:28 +01:00
Alug 08fe3beef1 respect cv_showdirectorhud 2024-11-02 00:49:35 +01:00
Alug 2c54c92e14 spec cam disables director, but you can toggle it from speccam
uhhhhhhh
2024-11-02 00:49:32 +01:00
Alug c127cd9016 fix wanted reticle offsets
Zzz...
2024-11-01 20:29:33 +01:00
Alug 9cb790ac23 oops broke encore 2024-11-01 20:01:50 +01:00
Alug c2c7381bc1 use precalced minimap stuff for v.drawOnMinimap 2024-11-01 19:55:23 +01:00
Alug 1e4eeb2bcf fix some issues with cv_minihead and minimap icon drawing 2024-11-01 19:55:20 +01:00
Alug b1f99f8d2f fix minimap not being initialised
causes issues when you switch to maps that dont have a minimap
2024-11-01 18:39:36 +01:00
Alug f752da7d03 formatting stuff lul 2024-10-31 12:02:48 +01:00
Alug 7ddcf6d0d4 Merge branch 'Saturn-Next' into refactorogl 2024-10-31 11:59:33 +01:00
indev b21776183e Add shift+insert shortcut for pasting text 2024-10-30 22:14:17 +03:00
indev 9c0dcac5c6 Fix mapmusname global in lua being renamed to (*mapmusname) 2024-10-30 19:21:07 +01:00
indev 1b75d8b8e2 Fix mapmusname global in lua being renamed to (*mapmusname) 2024-10-30 20:35:17 +03:00
Alug 145e305494 Merge branch 'Saturn-Next' into refactorogl 2024-10-30 16:04:06 +01:00
Alug 8f4d185ea6 Revert "use highly optmized (but slightly inaccurate) version of R_PointOnSide for rendering"
This reverts commit 9314a24cb2.
2024-10-30 16:03:35 +01:00
Alug 4b5ff6be5d Merge branch 'Saturn-Next' into refactorogl 2024-10-30 15:34:43 +01:00
Alug d27ef85b9e remove some unused stuff in portal struct 2024-10-30 13:52:06 +01:00
Alug 1ac210c2fc improve ogl portal clipping 2024-10-30 13:05:30 +01:00
Alug 878b7f4b43 fix portal culling 2024-10-28 20:25:03 +01:00
Alug 7cbac66935 throw this into an inline func 2024-10-28 20:25:01 +01:00
Alug 7e09223e6e gu 2024-10-28 16:36:04 +01:00
Alug b4e1be5bee dont always call HWR_Startup again 2024-10-28 16:35:44 +01:00
Alug d3e5e236ac those do nothing 2024-10-28 16:34:40 +01:00
Alug 238ce98c44 dont always call HWR_Startup again 2024-10-28 07:21:13 +01:00
Alug 2824e5d850 no need to update this witouth water ripples 2024-10-28 06:49:09 +01:00
Alug cd154d5748 grey out some stuffs in the ogl and advanced video menus 2024-10-28 06:40:23 +01:00
Alug c0a8153a10 sort those a bit 2024-10-28 06:40:19 +01:00
Alug 3433fc7651 those should be disabled 2024-10-28 06:40:17 +01:00
Alug 22d1ee8f60 move CV_PossibleValue_t to their own section like other files 2024-10-28 06:40:14 +01:00
Alug 5155958ade add "gl" to secbright and lightdither cvars
theyre only used in ogl so follow the naming convention
2024-10-28 05:40:59 +01:00
Alug 5fdd486bab reorder all of this to be in same order lol 2024-10-28 05:40:56 +01:00
Alug 4672037bcd check if those are already off before trying to turn them off lol 2024-10-28 05:40:54 +01:00
Alug 2281b82b5a replace last remaining "gr" 2024-10-28 04:28:25 +01:00
Alug 3fe096c7d4 gr -> gl
this has been annoying me since ages lol
2024-10-28 04:23:15 +01:00
Alug dd3ca0e161 change cvar register order for ogl stuff 2024-10-28 03:39:05 +01:00
Alug d8da78f900 more cleanup 2024-10-28 03:38:52 +01:00
Alug 9325e7be8f make a bunch of hwr stuff static and cleanup 2024-10-28 03:38:48 +01:00
Alug f3f94bf80e fr*nch 2024-10-28 03:38:36 +01:00
Alug 506dc2455a fr*nch 2024-10-26 23:24:01 +02:00
Alug 94d6ee15b5 this should be portalcullsector lol 2024-10-26 19:44:32 +02:00
Alug 2d918d32a1 reduce the scope of this since not needed 2024-10-26 19:44:28 +02:00
Alug dd516b573b rename this to avoid confusion 2024-10-26 19:31:14 +02:00
Alug de9698efc8 just use the same as software lol
i never saw any differernce except in performance for this
also viewsin and viewcos get calced in r_fps so no need to do here again
2024-10-26 19:29:53 +02:00
Alug 14b026f04b slight cleanup ogl portals again 2024-10-26 19:29:51 +02:00
Alug 9dd45440c0 rename and slight cleanup 2024-10-26 19:29:46 +02:00
Alug c59e8387ca smth smth shadows a global declaration 2024-10-26 19:29:35 +02:00
Alug 772ad9f04f throw ogl portals into their own files 2024-10-26 19:29:32 +02:00
Alug 6053c2c619 readd mobj null check here 2024-10-26 16:40:08 +02:00
Alug a515b133c5 inline this since its super smol 2024-10-26 16:40:04 +02:00
Alug 240dae9a1a move chasecam postimg stuff into own function + add comments for what stuff does lol
shit got me really confused
2024-10-26 16:12:43 +02:00
Alug b8a703233a forgor to remove this 2024-10-26 00:51:58 +02:00
Alug bf44c95d00 clean up portals 2024-10-26 00:51:55 +02:00
Alug c3dd1755dc port srb2 software portal refactor 2024-10-26 00:51:44 +02:00
Alug 0be25bd362 Merge branch 'Saturn-Next' into Saturn 2024-10-20 14:56:56 +02:00
53 changed files with 2263 additions and 2116 deletions

No files matched your search

+2
View File
@@ -470,6 +470,7 @@ if(${SRB2_CONFIG_HWRENDER})
${CMAKE_CURRENT_SOURCE_DIR}/hardware/hw_clip.c
${CMAKE_CURRENT_SOURCE_DIR}/hardware/hw_draw.c
${CMAKE_CURRENT_SOURCE_DIR}/hardware/hw_main.c
${CMAKE_CURRENT_SOURCE_DIR}/hardware/hw_portal.c
${CMAKE_CURRENT_SOURCE_DIR}/hardware/hw_md2.c
${CMAKE_CURRENT_SOURCE_DIR}/hardware/hw_md2load.c
${CMAKE_CURRENT_SOURCE_DIR}/hardware/hw_md3load.c
@@ -487,6 +488,7 @@ if(${SRB2_CONFIG_HWRENDER})
${CMAKE_CURRENT_SOURCE_DIR}/hardware/hw_drv.h
${CMAKE_CURRENT_SOURCE_DIR}/hardware/hw_glob.h
${CMAKE_CURRENT_SOURCE_DIR}/hardware/hw_main.h
${CMAKE_CURRENT_SOURCE_DIR}/hardware/hw_portal.c
${CMAKE_CURRENT_SOURCE_DIR}/hardware/hw_md2.h
${CMAKE_CURRENT_SOURCE_DIR}/hardware/hw_md2load.h
${CMAKE_CURRENT_SOURCE_DIR}/hardware/hw_md3load.h
+4 -3
View File
@@ -293,7 +293,7 @@ ifdef NOHW
else
OPTS+=-DHWRENDER
OBJS+=$(OBJDIR)/hw_bsp.o $(OBJDIR)/hw_draw.o \
$(OBJDIR)/hw_main.o $(OBJDIR)/hw_clip.o $(OBJDIR)/hw_md2.o $(OBJDIR)/hw_cache.o \
$(OBJDIR)/hw_main.o $(OBJDIR)/hw_clip.o $(OBJDIR)/hw_md2.o $(OBJDIR)/hw_cache.o $(OBJDIR)/hw_portal.o\
$(OBJDIR)/hw_md2load.o $(OBJDIR)/hw_md3load.o $(OBJDIR)/hw_model.o $(OBJDIR)/u_list.o $(OBJDIR)/hw_batching.o $(OBJDIR)/hw_shaders.o
endif
@@ -563,6 +563,7 @@ OBJS:=$(i_main_o) \
$(OBJDIR)/r_splats.o \
$(OBJDIR)/r_patch.o \
$(OBJDIR)/r_things.o \
$(OBJDIR)/r_portal.o \
$(OBJDIR)/screen.o \
$(OBJDIR)/v_video.o \
$(OBJDIR)/s_sound.o \
@@ -738,7 +739,7 @@ ifdef MINGW
$(OBJDIR)/r_opengl.o: hardware/r_opengl/r_opengl.c hardware/r_opengl/r_opengl.h \
doomdef.h doomtype.h g_state.h m_swap.h hardware/hw_drv.h screen.h \
command.h hardware/hw_data.h hardware/hw_defs.h hardware/hw_md2.h \
hardware/hw_glob.h hardware/hw_main.h hardware/hw_clip.h \
hardware/hw_glob.h hardware/hw_main.h hardware/hw_clip.h hardware/hw_portal.h\
hardware/hw_md2load.h hardware/hw_md3load.h hardware/hw_model.h hardware/u_list.h \
am_map.h d_event.h d_player.h p_pspr.h m_fixed.h tables.h info.h d_think.h \
p_mobj.h doomdata.h d_ticcmd.h r_defs.h hardware/hw_dll.h
@@ -747,7 +748,7 @@ else
$(OBJDIR)/r_opengl.o: hardware/r_opengl/r_opengl.c hardware/r_opengl/r_opengl.h \
doomdef.h doomtype.h g_state.h m_swap.h hardware/hw_drv.h screen.h \
command.h hardware/hw_data.h hardware/hw_defs.h hardware/hw_md2.h \
hardware/hw_glob.h hardware/hw_main.h hardware/hw_clip.h \
hardware/hw_glob.h hardware/hw_main.h hardware/hw_clip.h hardware/hw_portal.h \
hardware/hw_md2load.h hardware/hw_md3load.h hardware/hw_model.h hardware/u_list.h \
am_map.h d_event.h d_player.h p_pspr.h m_fixed.h tables.h info.h d_think.h \
p_mobj.h doomdata.h d_ticcmd.h r_defs.h hardware/hw_dll.h
+1 -1
View File
@@ -628,7 +628,7 @@ static void COM_ExecuteString(char *ptext)
// check cvars
// Hurdler: added at Ebola's request ;)
// (don't flood the console in software mode with bad gr_xxx command)
// (don't flood the console in software mode with bad gl_xxx command)
if (!CV_Command() && con_destlines)
CONS_Printf(M_GetText("Unknown command '%s'\n"), COM_Argv(0));
}
+5 -1
View File
@@ -9149,7 +9149,6 @@ int LUA_EnumLib(lua_State *L)
PUSHGETTER(globalweather, u8);
PUSHGETTER(levelskynum, i32);
PUSHGETTER(globallevelskynum, i32);
PUSHGETTER((*mapmusname), str);
PUSHGETTER(mapmusflags, u16);
PUSHGETTER(mapmusposition, u32);
PUSHGETTER(gravity, fxp);
@@ -9166,6 +9165,11 @@ int LUA_EnumLib(lua_State *L)
PUSHGETTER(racecountdown, u32);
PUSHGETTER(exitcountdown, u32);
lua_pushcfunction(L, lua_glib_new_getter);
lua_pushliteral(L, "mapmusname");
lua_glib_push_str_getter(L, mapmusname);
lua_call(L, 2, 0);
lua_pushcfunction(L, lua_glib_new_getter);
lua_pushliteral(L, "mariomode");
lua_pushcfunction(L, lua_enumlib_mariomode_get);
+2 -2
View File
@@ -127,8 +127,8 @@ extern char logfilename[1024];
#else
#define VERSION 1 // Game version
#define SUBVERSION 6 // more precise version number
#define VERSIONSTRING "Saturn v7.1"
#define VERSIONSTRINGW L"Saturn v7.1"
#define VERSIONSTRING "Saturn v7.2"
#define VERSIONSTRINGW L"Saturn v7.2"
// Hey! If you change this, add 1 to the MODVERSION below! Otherwise we can't force updates!
// And change CMakeLists.txt (not src/, but in root), for CMake users!
// AND appveyor.yml, for the build bots!
+5
View File
@@ -1492,7 +1492,12 @@ void G_BuildTiccmd(ticcmd_t *cmd, INT32 realtics, UINT8 ssplayer)
//Reset away view if a command is given.
if ((cmd->forwardmove || cmd->sidemove || cmd->buttons)
&& displayplayers[0] != consoleplayer && ssplayer == 1)
{
displayplayers[0] = consoleplayer;
// i dont like this lmao
if (cv_director.value)
CV_SetValue(&cv_director, 0);
}
}
+23 -21
View File
@@ -46,12 +46,12 @@ int unsortedVertexArrayAllocSize = 65536;
// Call HWR_RenderBatches to render all the collected geometry.
void HWR_StartBatching(void)
{
if (currently_batching)
if (currently_batching)
{
I_Error("Repeat call to HWR_StartBatching without HWR_RenderBatches");
I_Error("Repeat call to HWR_StartBatching without HWR_RenderBatches");
}
// init arrays if that has not been done yet
// init arrays if that has not been done yet
if (!finalVertexArray)
{
finalVertexArray = malloc(finalVertexArrayAllocSize * sizeof(FOutVector));
@@ -61,7 +61,7 @@ void HWR_StartBatching(void)
unsortedVertexArray = malloc(unsortedVertexArrayAllocSize * sizeof(FOutVector));
}
currently_batching = true;
currently_batching = true;
}
// This replaces the direct calls to pfnSetTexture in cases where batching is available.
@@ -69,14 +69,14 @@ void HWR_StartBatching(void)
// Doing this was easier than getting a texture pointer to HWR_ProcessPolygon.
void HWR_SetCurrentTexture(GLMipmap_t *texture)
{
if (currently_batching)
{
current_texture = texture;
}
else
{
HWD.pfnSetTexture(texture);
}
if (currently_batching)
{
current_texture = texture;
}
else
{
HWD.pfnSetTexture(texture);
}
}
// If batching is enabled, this function collects the polygon data and the chosen texture
@@ -84,7 +84,7 @@ void HWR_SetCurrentTexture(GLMipmap_t *texture)
// render the polygon immediately.
void HWR_ProcessPolygon(FSurfaceInfo *pSurf, FOutVector *pOutVerts, FUINT iNumPts, FBITFIELD PolyFlags, int shader_target, boolean horizonSpecial)
{
if (currently_batching)
if (currently_batching)
{
if (!pSurf)
I_Error("Got a null FSurfaceInfo in batching");// nulls should not come in the stuff that batching currently applies to
@@ -220,7 +220,7 @@ static int comparePolygonsNoShaders(const void *p1, const void *p2)
// the rendering backend to draw them.
void HWR_RenderBatches(void)
{
int finalVertexWritePos = 0;// position in finalVertexArray
int finalVertexWritePos = 0;// position in finalVertexArray
int finalIndexWritePos = 0;// position in finalVertexIndexArray
int polygonReadPos = 0;// position in polygonArraySorted
@@ -236,7 +236,7 @@ void HWR_RenderBatches(void)
int i;
if (!currently_batching)
if (!currently_batching)
I_Error("HWR_RenderBatches called without starting batching");
nextSurfaceInfo.LightInfo.fade_end = 0;
@@ -256,6 +256,7 @@ void HWR_RenderBatches(void)
ps_hw_numcalls.value.i = ps_hw_numverts.value.i = 0;
ps_hw_numshaders.value.i = ps_hw_numtextures.value.i
= ps_hw_numpolyflags.value.i = ps_hw_numcolors.value.i = 1;
// init polygonArraySorted
for (i = 0; i < polygonArraySize; i++)
{
@@ -264,11 +265,12 @@ void HWR_RenderBatches(void)
// sort polygons
PS_START_TIMING(ps_hw_batchsorttime);
if (cv_grshaders.value && gr_shadersavailable)
if (cv_glshaders.value && gl_shadersavailable)
qs22j(polygonArraySorted, polygonArraySize, sizeof(PolygonArrayEntry *), comparePolygons);
else
qs22j(polygonArraySorted, polygonArraySize, sizeof(PolygonArrayEntry *), comparePolygonsNoShaders);
PS_STOP_TIMING(ps_hw_batchsorttime);
// sort order
// 1. shader
// 2. texture
@@ -287,14 +289,14 @@ void HWR_RenderBatches(void)
// set state for first batch
if (cv_grshaders.value && gr_shadersavailable)
if (cv_glshaders.value && gl_shadersavailable)
{
HWD.pfnSetShader(currentShader);
}
if (currentPolyFlags & PF_NoTexture)
currentTexture = NULL;
else
else
HWD.pfnSetTexture(currentTexture);
while (1)// note: remember handling notexture polyflag as having texture number 0 (also in comparePolygons)
@@ -369,7 +371,7 @@ void HWR_RenderBatches(void)
nextSurfaceInfo = nextEntry->surf;
if (nextPolyFlags & PF_NoTexture)
nextTexture = 0;
if (currentShader != nextShader && cv_grshaders.value && gr_shadersavailable)
if (currentShader != nextShader && cv_glshaders.value && gl_shadersavailable)
{
changeState = true;
changeShader = true;
@@ -384,7 +386,7 @@ void HWR_RenderBatches(void)
changeState = true;
changePolyFlags = true;
}
if (cv_grshaders.value && gr_shadersavailable)
if (cv_glshaders.value && gl_shadersavailable)
{
if (currentSurfaceInfo.PolyColor.rgba != nextSurfaceInfo.PolyColor.rgba ||
currentSurfaceInfo.TintColor.rgba != nextSurfaceInfo.TintColor.rgba ||
@@ -457,6 +459,7 @@ void HWR_RenderBatches(void)
ps_hw_numcolors.value.i++;
}
// and that should be it?
}
}
// reset the arrays (set sizes to 0)
@@ -466,5 +469,4 @@ void HWR_RenderBatches(void)
PS_STOP_TIMING(ps_hw_batchdrawtime);
}
#endif // HWRENDER
+8 -8
View File
@@ -46,7 +46,7 @@ typedef struct
// when loading the map, this is set to true if portals are found.
// if no portals are found, the portal scanning phase can be skipped while rendering, saving a bit of time.
boolean gr_maphasportals = false;
boolean gl_maphasportals = false;
// ==========================================================================
// FLOOR & CEILING CONVEX POLYS GENERATION
@@ -371,14 +371,14 @@ static poly_t *CutOutSubsecPoly(seg_t *lseg, INT32 count, poly_t *poly)
line_t *line = lseg->linedef;
// portal check
if (!gr_maphasportals && line->special == 40 && lseg->side == 0)
if (!gl_maphasportals && line->special == 40 && lseg->side == 0)
{
// Find the other side!
INT32 line2 = P_FindSpecialLineFromTag(40, line->tag, -1);
if (line == &lines[line2])
line2 = P_FindSpecialLineFromTag(40, line->tag, line2);
if (line2 >= 0) // found it!
gr_maphasportals = 1;
gl_maphasportals = 1;
}
p1.x = FIXED_TO_FLOAT(lseg->side ? line->v2->x : line->v1->x);
@@ -768,7 +768,7 @@ static INT32 SolveTProblem(void)
INT32 i;
size_t l;
if (cv_grsolvetjoin.value == 0)
if (cv_glsolvetjoin.value == 0)
return 0;
CONS_Debug(DBG_RENDER, "Solving T-joins. This may take a while. Please wait...\n");
@@ -905,7 +905,7 @@ void HWR_CreatePlanePolygons(INT32 bspnum)
#endif
// reset the portal flag
gr_maphasportals = 0;
gl_maphasportals = 0;
// find min/max boundaries of map
//CONS_Debug(DBG_RENDER, "Looking for boundaries of map...\n");
@@ -923,9 +923,9 @@ void HWR_CreatePlanePolygons(INT32 bspnum)
I_Error("couldn't malloc extrasubsectors totsubsectors %s\n", sizeu1(totsubsectors));
// allocate table for back to front drawing of subsectors
/*gr_drawsubsectors = (INT16 *)malloc(sizeof (*gr_drawsubsectors) * totsubsectors);
if (!gr_drawsubsectors)
I_Error("couldn't malloc gr_drawsubsectors\n");*/
/*gl_drawsubsectors = (INT16 *)malloc(sizeof (*gl_drawsubsectors) * totsubsectors);
if (!gl_drawsubsectors)
I_Error("couldn't malloc gl_drawsubsectors\n");*/
// number of the first new subsector that might be added
addsubsector = numsubsectors;
+132 -133
View File
@@ -166,7 +166,7 @@ static void HWR_DrawPatchInCache(GLMipmap_t *mipmap,
if (pwidth <= 0 || pheight <= 0)
return;
palette = HWR_GetTexturePalette();
ncols = pwidth;
@@ -216,7 +216,7 @@ static void HWR_DrawTexturePatchInCache(GLMipmap_t *mipmap,
if (texture->width <= 0 || texture->height <= 0)
return;
palette = HWR_GetTexturePalette();
x1 = patch->originx;
@@ -275,15 +275,15 @@ static void HWR_DrawTexturePatchInCache(GLMipmap_t *mipmap,
}
}
static UINT8 *MakeBlock(GLMipmap_t *grMipmap)
static UINT8 *MakeBlock(GLMipmap_t *glMipmap)
{
UINT8 *block;
INT32 bpp, i;
UINT16 bu16 = ((0x00 <<8) | HWR_PATCHES_CHROMAKEY_COLORINDEX);
INT32 blocksize = (grMipmap->width * grMipmap->height);
INT32 blocksize = (glMipmap->width * glMipmap->height);
bpp = format2bpp(grMipmap->format);
block = Z_Malloc(blocksize*bpp, PU_HWRCACHE, &(grMipmap->data));
bpp = format2bpp(glMipmap->format);
block = Z_Malloc(blocksize*bpp, PU_HWRCACHE, &(glMipmap->data));
switch (bpp)
{
@@ -303,7 +303,7 @@ static UINT8 *MakeBlock(GLMipmap_t *grMipmap)
// Create a composite texture from patches, adapt the texture size to a power of 2
// height and width for the hardware texture cache.
//
static void HWR_GenerateTexture(INT32 texnum, GLMapTexture_t *grtex, boolean noencore)
static void HWR_GenerateTexture(INT32 texnum, GLMapTexture_t *gltex, boolean noencore)
{
UINT8 *block;
texture_t *texture;
@@ -313,7 +313,7 @@ static void HWR_GenerateTexture(INT32 texnum, GLMapTexture_t *grtex, boolean noe
INT32 i;
boolean skyspecial = false; //poor hack for Legacy large skies..
RGBA_t *palette;
palette = HWR_GetTexturePalette();
@@ -328,30 +328,30 @@ static void HWR_GenerateTexture(INT32 texnum, GLMapTexture_t *grtex, boolean noe
)
{
skyspecial = true;
grtex->mipmap.flags = TF_WRAPXY; // don't use the chromakey for sky
gltex->mipmap.flags = TF_WRAPXY; // don't use the chromakey for sky
}
else
grtex->mipmap.flags = TF_CHROMAKEYED | TF_WRAPXY;
gltex->mipmap.flags = TF_CHROMAKEYED | TF_WRAPXY;
grtex->mipmap.width = (UINT16)texture->width;
grtex->mipmap.height = (UINT16)texture->height;
gltex->mipmap.width = (UINT16)texture->width;
gltex->mipmap.height = (UINT16)texture->height;
if (skyspecial)
grtex->mipmap.format = GL_TEXFMT_RGBA; // that skyspecial code below assumes this format ...
gltex->mipmap.format = GL_TEXFMT_RGBA; // that skyspecial code below assumes this format ...
else
grtex->mipmap.format = textureformat;
gltex->mipmap.format = textureformat;
grtex->mipmap.colormap = colormaps;
gltex->mipmap.colormap = colormaps;
#ifdef GLENCORE
if (encoremap && !noencore)
grtex->mipmap.colormap += COLORMAP_REMAPOFFSET;
gltex->mipmap.colormap += COLORMAP_REMAPOFFSET;
#endif
blockwidth = texture->width;
blockheight = texture->height;
blocksize = (blockwidth * blockheight);
block = MakeBlock(&grtex->mipmap);
block = MakeBlock(&gltex->mipmap);
if (skyspecial) //Hurdler: not efficient, but better than holes in the sky (and it's done only at level loading)
{
@@ -375,7 +375,7 @@ static void HWR_GenerateTexture(INT32 texnum, GLMapTexture_t *grtex, boolean noe
for (i = 0, patch = texture->patches; i < texture->patchcount; i++, patch++)
{
realpatch = W_CacheLumpNumPwad(patch->wad, patch->lump, PU_CACHE);
HWR_DrawTexturePatchInCache(&grtex->mipmap,
HWR_DrawTexturePatchInCache(&gltex->mipmap,
blockwidth, blockheight,
texture, patch,
realpatch);
@@ -383,78 +383,78 @@ static void HWR_GenerateTexture(INT32 texnum, GLMapTexture_t *grtex, boolean noe
}
//Hurdler: not efficient at all but I don't remember exactly how HWR_DrawPatchInCache works :(
if (format2bpp(grtex->mipmap.format)==4)
if (format2bpp(gltex->mipmap.format)==4)
{
for (i = 3; i < blocksize*4; i += 4) // blocksize*4 because blocksize doesn't include the bpp
{
if (block[i] != 0)
continue;
grtex->mipmap.flags |= TF_TRANSPARENT;
gltex->mipmap.flags |= TF_TRANSPARENT;
break;
}
}
grtex->scaleX = 1.0f/(texture->width*FRACUNIT);
grtex->scaleY = 1.0f/(texture->height*FRACUNIT);
gltex->scaleX = 1.0f/(texture->width*FRACUNIT);
gltex->scaleY = 1.0f/(texture->height*FRACUNIT);
}
// patch may be NULL if grMipmap has been initialised already and makebitmap is false
void HWR_MakePatch (patch_t *patch, GLPatch_t *grPatch, GLMipmap_t *grMipmap, boolean makebitmap)
// patch may be NULL if glMipmap has been initialised already and makebitmap is false
void HWR_MakePatch (patch_t *patch, GLPatch_t *glPatch, GLMipmap_t *glMipmap, boolean makebitmap)
{
// don't do it twice (like a cache)
if (grMipmap->width == 0)
if (glMipmap->width == 0)
{
// save the original patch header so that the GLPatch can be casted
// into a standard patch_t struct and the existing code can get the
// orginal patch dimensions and offsets.
grPatch->width = SHORT(patch->width);
grPatch->height = SHORT(patch->height);
grPatch->leftoffset = SHORT(patch->leftoffset);
grPatch->topoffset = SHORT(patch->topoffset);
glPatch->width = SHORT(patch->width);
glPatch->height = SHORT(patch->height);
glPatch->leftoffset = SHORT(patch->leftoffset);
glPatch->topoffset = SHORT(patch->topoffset);
//grMipmap->width = (UINT16)SHORT(patch->width);
//grMipmap->height = (UINT16)SHORT(patch->height);
grMipmap->width = grMipmap->height = 1;
while (grMipmap->width < grPatch->width) grMipmap->width <<= 1;
while (grMipmap->height < grPatch->height) grMipmap->height <<= 1;
//glMipmap->width = (UINT16)SHORT(patch->width);
//glMipmap->height = (UINT16)SHORT(patch->height);
glMipmap->width = glMipmap->height = 1;
while (glMipmap->width < glPatch->width) glMipmap->width <<= 1;
while (glMipmap->height < glPatch->height) glMipmap->height <<= 1;
// no wrap around, no chroma key
grMipmap->flags = 0;
glMipmap->flags = 0;
// setup the texture info
grMipmap->format = patchformat;
//grPatch->max_s = grPatch->max_t = 1.0f;
grPatch->max_s = (float)grPatch->width / (float)grMipmap->width;
grPatch->max_t = (float)grPatch->height / (float)grMipmap->height;
glMipmap->format = patchformat;
//glPatch->max_s = glPatch->max_t = 1.0f;
glPatch->max_s = (float)glPatch->width / (float)glMipmap->width;
glPatch->max_t = (float)glPatch->height / (float)glMipmap->height;
}
Z_Free(grMipmap->data);
grMipmap->data = NULL;
Z_Free(glMipmap->data);
glMipmap->data = NULL;
if (makebitmap)
{
MakeBlock(grMipmap);
HWR_DrawPatchInCache(grMipmap,
grMipmap->width, grMipmap->height,
grPatch->width, grPatch->height,
MakeBlock(glMipmap);
HWR_DrawPatchInCache(glMipmap,
glMipmap->width, glMipmap->height,
glPatch->width, glPatch->height,
patch);
}
//grPatch->max_s = grPatch->max_t = 1.0f;
//glPatch->max_s = glPatch->max_t = 1.0f;
}
// =================================================
// CACHING HANDLING
// =================================================
static size_t gr_numtextures;
static GLMapTexture_t *gr_textures; // For all textures
static size_t gl_numtextures;
static GLMapTexture_t *gl_textures; // For all textures
void HWR_InitTextureCache(void)
{
gr_numtextures = 0;
gr_textures = NULL;
gl_numtextures = 0;
gl_textures = NULL;
}
// Callback function for HWR_FreeTextureCache.
@@ -526,10 +526,10 @@ void HWR_FreeTextureCache(void)
// now the heap don't have any 'user' pointing to our
// texturecache info, we can free it
if (gr_textures)
free(gr_textures);
gr_textures = NULL;
gr_numtextures = 0;
if (gl_textures)
free(gl_textures);
gl_textures = NULL;
gl_numtextures = 0;
}
void HWR_LoadTextures(size_t pnumtextures)
@@ -537,13 +537,13 @@ void HWR_LoadTextures(size_t pnumtextures)
// we must free it since numtextures changed
HWR_FreeTextureCache();
gr_numtextures = pnumtextures;
gl_numtextures = pnumtextures;
#ifdef GLENCORE
gr_textures = calloc(pnumtextures, sizeof (*gr_textures)*2); // *2 - 1 for encore-remapped texture and another for noencore texture (unused when not in encore)
gl_textures = calloc(pnumtextures, sizeof (*gl_textures)*2); // *2 - 1 for encore-remapped texture and another for noencore texture (unused when not in encore)
#else
gr_textures = calloc(pnumtextures, sizeof (*gr_textures));
gl_textures = calloc(pnumtextures, sizeof (*gl_textures));
#endif
if (gr_textures == NULL)
if (gl_textures == NULL)
I_Error("HWR_LoadTextures: ran out of memory for OpenGL textures. Sad!");
}
@@ -552,9 +552,9 @@ void HWR_LoadTextures(size_t pnumtextures)
// --------------------------------------------------------------------------
GLMapTexture_t *HWR_GetTexture(INT32 tex, boolean noencore)
{
GLMapTexture_t *grtex;
GLMapTexture_t *gltex;
if (tex < 0 || tex >= (signed)gr_numtextures)
if (tex < 0 || tex >= (signed)gl_numtextures)
{
#ifdef PARANOIA
I_Error("HWR_GetTexture: Invalid texture ID %d", tex);
@@ -563,25 +563,25 @@ GLMapTexture_t *HWR_GetTexture(INT32 tex, boolean noencore)
#endif
}
#ifdef GLENCORE
grtex = &gr_textures[tex*2 + (encoremap && !noencore ? 0 : 1)];
gltex = &gl_textures[tex*2 + (encoremap && !noencore ? 0 : 1)];
#else
grtex = &gr_textures[tex];
gltex = &gl_textures[tex];
#endif
if (!grtex->mipmap.data && !grtex->mipmap.downloaded)
HWR_GenerateTexture(tex, grtex, noencore);
if (!gltex->mipmap.data && !gltex->mipmap.downloaded)
HWR_GenerateTexture(tex, gltex, noencore);
// If hardware does not have the texture, then call pfnSetTexture to upload it
if (!grtex->mipmap.downloaded)
HWD.pfnSetTexture(&grtex->mipmap);
HWR_SetCurrentTexture(&grtex->mipmap);
if (!gltex->mipmap.downloaded)
HWD.pfnSetTexture(&gltex->mipmap);
HWR_SetCurrentTexture(&gltex->mipmap);
// The system-memory data can be purged now.
Z_ChangeTag(grtex->mipmap.data, PU_HWRCACHE_UNLOCKED);
Z_ChangeTag(gltex->mipmap.data, PU_HWRCACHE_UNLOCKED);
return grtex;
return gltex;
}
static void HWR_CacheFlat(GLMipmap_t *grMipmap, lumpnum_t flatlumpnum)
static void HWR_CacheFlat(GLMipmap_t *glMipmap, lumpnum_t flatlumpnum)
{
#ifdef GLENCORE
UINT8 *flat;
@@ -590,8 +590,8 @@ static void HWR_CacheFlat(GLMipmap_t *grMipmap, lumpnum_t flatlumpnum)
size_t size, pflatsize;
// setup the texture info
grMipmap->format = GL_TEXFMT_P_8;
grMipmap->flags = TF_WRAPXY|TF_CHROMAKEYED;
glMipmap->format = GL_TEXFMT_P_8;
glMipmap->flags = TF_WRAPXY|TF_CHROMAKEYED;
size = W_LumpLength(flatlumpnum);
@@ -619,21 +619,21 @@ static void HWR_CacheFlat(GLMipmap_t *grMipmap, lumpnum_t flatlumpnum)
pflatsize = 64;
break;
}
grMipmap->width = (UINT16)pflatsize;
grMipmap->height = (UINT16)pflatsize;
glMipmap->width = (UINT16)pflatsize;
glMipmap->height = (UINT16)pflatsize;
// the flat raw data needn't be converted with palettized textures
W_ReadLump(flatlumpnum, Z_Malloc(W_LumpLength(flatlumpnum),
PU_HWRCACHE, &grMipmap->data));
PU_HWRCACHE, &glMipmap->data));
#ifdef GLENCORE
flat = grMipmap->data;
flat = glMipmap->data;
for (steppy = 0; steppy < size; steppy++)
{
if (flat[steppy] == HWR_PATCHES_CHROMAKEY_COLORINDEX)
continue;
flat[steppy] = grMipmap->colormap[flat[steppy]];
flat[steppy] = glMipmap->colormap[flat[steppy]];
}
#endif
}
@@ -641,44 +641,44 @@ static void HWR_CacheFlat(GLMipmap_t *grMipmap, lumpnum_t flatlumpnum)
// Download a Doom 'flat' to the hardware cache and make it ready for use
void HWR_GetFlat(lumpnum_t flatlumpnum, boolean noencoremap)
{
GLMipmap_t *grmip;
GLMipmap_t *glmip;
if (flatlumpnum == LUMPERROR)
return;
grmip = HWR_GetCachedGLPatch(flatlumpnum)->mipmap;
glmip = HWR_GetCachedGLPatch(flatlumpnum)->mipmap;
grmip->colormap = colormaps;
glmip->colormap = colormaps;
#ifdef GLENCORE
if (!noencoremap && encoremap)
grmip->colormap += COLORMAP_REMAPOFFSET;
glmip->colormap += COLORMAP_REMAPOFFSET;
#endif
if (!grmip->downloaded && !grmip->data)
HWR_CacheFlat(grmip, flatlumpnum);
if (!glmip->downloaded && !glmip->data)
HWR_CacheFlat(glmip, flatlumpnum);
// If hardware does not have the texture, then call pfnSetTexture to upload it
if (!grmip->downloaded)
HWD.pfnSetTexture(grmip);
HWR_SetCurrentTexture(grmip);
if (!glmip->downloaded)
HWD.pfnSetTexture(glmip);
HWR_SetCurrentTexture(glmip);
// The system-memory data can be purged now.
Z_ChangeTag(grmip->data, PU_HWRCACHE_UNLOCKED);
Z_ChangeTag(glmip->data, PU_HWRCACHE_UNLOCKED);
}
//
// HWR_LoadMappedPatch(): replace the skin color of the sprite in cache
// : load it first in doom cache if not already
//
static void HWR_LoadMappedPatch(GLMipmap_t *grmip, GLPatch_t *gpatch)
static void HWR_LoadMappedPatch(GLMipmap_t *glmip, GLPatch_t *gpatch)
{
if (!grmip->downloaded && !grmip->data)
if (!glmip->downloaded && !glmip->data)
{
patch_t *patch = gpatch->rawpatch;
if (!patch)
patch = W_CacheLumpNumPwad(gpatch->wadnum, gpatch->lumpnum, PU_STATIC);
HWR_MakePatch(patch, gpatch, grmip, true);
HWR_MakePatch(patch, gpatch, glmip, true);
// You can't free rawpatch for some reason?
// (Obviously I can't, sprite rotation needs that...)
@@ -688,12 +688,12 @@ static void HWR_LoadMappedPatch(GLMipmap_t *grmip, GLPatch_t *gpatch)
}
// If hardware does not have the texture, then call pfnSetTexture to upload it
if (!grmip->downloaded)
HWD.pfnSetTexture(grmip);
HWR_SetCurrentTexture(grmip);
if (!glmip->downloaded)
HWD.pfnSetTexture(glmip);
HWR_SetCurrentTexture(glmip);
// The system-memory data can be purged now.
Z_ChangeTag(grmip->data, PU_HWRCACHE_UNLOCKED);
Z_ChangeTag(glmip->data, PU_HWRCACHE_UNLOCKED);
}
// -----------------+
@@ -732,7 +732,7 @@ void HWR_GetPatch(GLPatch_t *gpatch)
// -------------------+
void HWR_GetMappedPatch(GLPatch_t *gpatch, const UINT8 *colormap)
{
GLMipmap_t *grmip, *newmip;
GLMipmap_t *glmip, *newmip;
// Blatant hack for encore colormapping aside...
if (colormap == colormaps || colormap == NULL || colormap == (const UINT8*)(COLORMAP_REMAPOFFSET))
@@ -744,14 +744,14 @@ void HWR_GetMappedPatch(GLPatch_t *gpatch, const UINT8 *colormap)
// search for the mimmap
// skip the first (no colormap translated)
for (grmip = gpatch->mipmap; grmip->nextcolormap; )
for (glmip = gpatch->mipmap; glmip->nextcolormap; )
{
grmip = grmip->nextcolormap;
glmip = glmip->nextcolormap;
if (grmip->colormap != colormap)
if (glmip->colormap != colormap)
continue;
HWR_LoadMappedPatch(grmip, gpatch);
HWR_LoadMappedPatch(glmip, gpatch);
return;
}
// not found, create it!
@@ -764,7 +764,7 @@ void HWR_GetMappedPatch(GLPatch_t *gpatch, const UINT8 *colormap)
newmip = calloc(1, sizeof (*newmip));
if (newmip == NULL)
I_Error("%s: Out of memory", "HWR_GetMappedPatch");
grmip->nextcolormap = newmip;
glmip->nextcolormap = newmip;
newmip->colormap = colormap;
HWR_LoadMappedPatch(newmip, gpatch);
@@ -781,18 +781,18 @@ void HWR_UnlockCachedPatch(GLPatch_t *gpatch)
GLPatch_t *HWR_GetCachedGLPatchPwad(UINT16 wadnum, UINT16 lumpnum)
{
aatree_t *hwrcache = wadfiles[wadnum]->hwrcache;
GLPatch_t *grpatch;
GLPatch_t *glpatch;
if (!(grpatch = M_AATreeGet(hwrcache, lumpnum)))
if (!(glpatch = M_AATreeGet(hwrcache, lumpnum)))
{
grpatch = Z_Calloc(sizeof(GLPatch_t), PU_HWRPATCHINFO, NULL);
grpatch->wadnum = wadnum;
grpatch->lumpnum = lumpnum;
grpatch->mipmap = Z_Calloc(sizeof(GLMipmap_t), PU_HWRPATCHINFO, NULL);
M_AATreeSet(hwrcache, lumpnum, grpatch);
glpatch = Z_Calloc(sizeof(GLPatch_t), PU_HWRPATCHINFO, NULL);
glpatch->wadnum = wadnum;
glpatch->lumpnum = lumpnum;
glpatch->mipmap = Z_Calloc(sizeof(GLMipmap_t), PU_HWRPATCHINFO, NULL);
M_AATreeSet(hwrcache, lumpnum, glpatch);
}
return grpatch;
return glpatch;
}
GLPatch_t *HWR_GetCachedGLPatch(lumpnum_t lumpnum)
@@ -840,14 +840,14 @@ static void HWR_DrawFadeMaskInCache(GLMipmap_t *mipmap, INT32 pblockwidth, INT32
Z_Free(flat);
}
static void HWR_CacheFadeMask(GLMipmap_t *grMipmap, lumpnum_t fademasklumpnum)
static void HWR_CacheFadeMask(GLMipmap_t *glMipmap, lumpnum_t fademasklumpnum)
{
size_t size;
UINT16 fmheight = 0, fmwidth = 0;
// setup the texture info
grMipmap->format = GL_TEXFMT_ALPHA_8; // put the correct alpha levels straight in so I don't need to convert it later
grMipmap->flags = 0;
glMipmap->format = GL_TEXFMT_ALPHA_8; // put the correct alpha levels straight in so I don't need to convert it later
glMipmap->flags = 0;
size = W_LumpLength(fademasklumpnum);
@@ -876,28 +876,28 @@ static void HWR_CacheFadeMask(GLMipmap_t *grMipmap, lumpnum_t fademasklumpnum)
}
// Thankfully, this will still work for this scenario
grMipmap->width = fmwidth;
grMipmap->height = fmheight;
glMipmap->width = fmwidth;
glMipmap->height = fmheight;
MakeBlock(grMipmap);
MakeBlock(glMipmap);
HWR_DrawFadeMaskInCache(grMipmap, fmwidth, fmheight, fademasklumpnum, fmwidth, fmheight);
HWR_DrawFadeMaskInCache(glMipmap, fmwidth, fmheight, fademasklumpnum, fmwidth, fmheight);
// I DO need to convert this because it isn't power of 2 and we need the alpha
}
void HWR_GetFadeMask(lumpnum_t fademasklumpnum)
{
GLMipmap_t *grmip;
GLMipmap_t *glmip;
grmip = HWR_GetCachedGLPatch(fademasklumpnum)->mipmap;
glmip = HWR_GetCachedGLPatch(fademasklumpnum)->mipmap;
if (!grmip->downloaded && !grmip->data)
HWR_CacheFadeMask(grmip, fademasklumpnum);
if (!glmip->downloaded && !glmip->data)
HWR_CacheFadeMask(glmip, fademasklumpnum);
HWD.pfnSetTexture(grmip);
HWD.pfnSetTexture(glmip);
// The system-memory data can be purged now.
Z_ChangeTag(grmip->data, PU_HWRCACHE_UNLOCKED);
Z_ChangeTag(glmip->data, PU_HWRCACHE_UNLOCKED);
}
// =================================================
@@ -909,15 +909,15 @@ void HWR_SetPalette(RGBA_t *palette)
if (HWR_ShouldUsePaletteRendering())
{
// set the palette for palette postprocessing
if (cv_grpalettedepth.value == 16)
if (cv_glpalettedepth.value == 16)
{
// crush to 16-bit rgb565, like software currently does in the standard configuration
// Note: Software's screenshots have the 24-bit palette, but the screen gets
// the 16-bit version! For making comparison screenshots either use an external screenshot
// tool or set the palette depth to 24 bits.
RGBA_t crushed_palette[256];
int i;
for (i = 0; i < 256; i++)
for (int i = 0; i < 256; i++)
{
float fred = (float)(palette[i].s.red >> 3);
float fgreen = (float)(palette[i].s.green >> 2);
@@ -935,7 +935,7 @@ void HWR_SetPalette(RGBA_t *palette)
}
// this part is responsible for keeping track of the palette OUTSIDE of a level.
if ((!(gamestate == GS_LEVEL)) || (gamestate == GS_TITLESCREEN))
if (gamestate != GS_LEVEL || gamestate == GS_TITLESCREEN)
HWR_SetMapPalette();
}
else
@@ -987,11 +987,9 @@ void HWR_SetMapPalette(void)
RGBA_t *palette;
int i;
if ((!(gamestate == GS_LEVEL)) || (gamestate == GS_TITLESCREEN))
if (gamestate != GS_LEVEL || gamestate == GS_TITLESCREEN)
{
// outside of a level, pMasterPalette should have PLAYPAL ready for us
//palette = pMasterPalette; // we dont have this in kart so just use pLocalPalette as before
// outside of a level, pLocalPalette should have PLAYPAL ready for us
palette = pLocalPalette;
}
else
@@ -1001,8 +999,10 @@ void HWR_SetMapPalette(void)
lumpnum_t lumpnum = W_GetNumForName(GetPalette());
size_t palsize = W_LumpLength(lumpnum);
UINT8 *RGB_data;
if (palsize < 768) // 256 * 3
I_Error("HWR_SetMapPalette: A programmer assumed palette lumps are at least 768 bytes long, but apparently this was a wrong assumption!\n");
RGB_data = W_CacheLumpNum(lumpnum, PU_CACHE);
// we got the RGB palette now, but we need it in RGBA format.
for (i = 0; i < 256; i++)
@@ -1050,7 +1050,6 @@ UINT32 HWR_CreateLightTable(UINT8 *lighttable)
return id;
}
// get hwr lighttable id for colormap, create it if it doesn't already exist
UINT32 HWR_GetLightTableID(extracolormap_t *colormap)
{
-5
View File
@@ -121,8 +121,6 @@ typedef struct
poly_t *planepoly; // the generated convex polygon
} extrasubsector_t;
//here lies gr_vissprite
// Kart features
#define USE_FTRANSFORM_ANGLEZ
#define USE_FTRANSFORM_MIRROR
@@ -289,9 +287,6 @@ typedef struct FSurfaceInfo FSurfaceInfo;
enum hwdsetspecialstate
{
#ifdef USE_FBO_OGL
HWD_SET_FRAMEBUFFER,
#endif
HWD_SET_SHADERS,
HWD_SET_TEXTUREFILTERMODE,
+10 -10
View File
@@ -569,7 +569,7 @@ void HWR_FadeScreenMenuBack(UINT16 color, UINT8 strength)
if (color & 0xFF00) // Do COLORMAP fade.
{
if (HWR_ShouldUsePaletteRendering() && cv_grscreentextures.value)
if (HWR_ShouldUsePaletteRendering() && cv_glscreentextures.value)
{
const hwdscreentexture_t scr_tex = HWD_SCREENTEXTURE_GENERIC2;
@@ -593,12 +593,12 @@ void HWR_FadeScreenMenuBack(UINT16 color, UINT8 strength)
{
RGBA_t *palette = HWR_GetTexturePalette();
Surf.PolyColor.rgba = palette[color&0xFF].rgba;
if (HWR_ShouldUsePaletteRendering())
Surf.PolyColor.s.alpha = softwaretranstogl[strength];
else
Surf.PolyColor.s.alpha = (UINT8)(strength*25.5f);
poly_flags |= PF_Translucent;
}
@@ -652,17 +652,17 @@ void HWR_DrawViewBorder(INT32 clearlines)
INT32 basewindowx, basewindowy;
GLPatch_t *patch;
// if (gr_viewwidth == vid.width)
// if (gl_viewwidth == vid.width)
// return;
if (!clearlines)
clearlines = BASEVIDHEIGHT; // refresh all
// calc view size based on original game resolution
baseviewwidth = FixedInt(FixedDiv(FLOAT_TO_FIXED(gr_viewwidth), vid.fdupx)); //(cv_viewsize.value * BASEVIDWIDTH/10)&~7;
baseviewheight = FixedInt(FixedDiv(FLOAT_TO_FIXED(gr_viewheight), vid.fdupy));
top = FixedInt(FixedDiv(FLOAT_TO_FIXED(gr_baseviewwindowy), vid.fdupy));
side = FixedInt(FixedDiv(FLOAT_TO_FIXED(gr_baseviewwindowx), vid.fdupx));
baseviewwidth = FixedInt(FixedDiv(FLOAT_TO_FIXED(gl_viewwidth), vid.fdupx)); //(cv_viewsize.value * BASEVIDWIDTH/10)&~7;
baseviewheight = FixedInt(FixedDiv(FLOAT_TO_FIXED(gl_viewheight), vid.fdupy));
top = FixedInt(FixedDiv(FLOAT_TO_FIXED(gl_baseviewwindowy), vid.fdupy));
side = FixedInt(FixedDiv(FLOAT_TO_FIXED(gl_baseviewwindowx), vid.fdupx));
// top
HWR_DrawFlatFill(0, 0,
@@ -776,9 +776,9 @@ void HWR_drawAMline(const fline_t *fl, INT32 color)
F2DCoord v1, v2;
RGBA_t color_rgba;
RGBA_t *palette = HWR_GetTexturePalette();
color_rgba = palette[color&0xFF];
v1.x = ((float)fl->a.x-(vid.width/2.0f))*(2.0f/vid.width);
v1.y = ((float)fl->a.y-(vid.height/2.0f))*(2.0f/vid.height);
+3 -11
View File
@@ -23,7 +23,7 @@
// needed for sprite rendering
// equivalent of the software renderer's vissprites
typedef struct gr_vissprite_s
typedef struct gl_vissprite_s
{
float x1, x2;
float z1, z2;
@@ -41,7 +41,7 @@ typedef struct gr_vissprite_s
//Hurdler: 25/04/2000: now support colormap in hardware mode
UINT8 *colormap;
INT32 dispoffset; // copy of info->dispoffset, affects ordering but not drawing
} gr_vissprite_t;
} gl_vissprite_t;
// --------
// hw_bsp.c
@@ -63,7 +63,7 @@ void HWR_GetFlat(lumpnum_t flatlumpnum, boolean noencoremap);
GLMapTexture_t *HWR_GetTexture(INT32 tex, boolean noencore);
void HWR_GetPatch(GLPatch_t *gpatch);
void HWR_GetMappedPatch(GLPatch_t *gpatch, const UINT8 *colormap);
void HWR_MakePatch(patch_t *patch, GLPatch_t *grPatch, GLMipmap_t *grMipmap, boolean makebitmap);
void HWR_MakePatch(patch_t *patch, GLPatch_t *glPatch, GLMipmap_t *glMipmap, boolean makebitmap);
void HWR_UnlockCachedPatch(GLPatch_t *gpatch);
void HWR_SetPalette(RGBA_t *palette);
@@ -81,14 +81,6 @@ void HWR_GetFadeMask(lumpnum_t fademasklumpnum);
extern INT32 patchformat;
extern INT32 textureformat;
// --------
// hw_main.c // originally hw_drawnodes.c from HWPortal branch
// --------
void HWR_AddTransparentWall(FOutVector *wallVerts, FSurfaceInfo *pSurf, INT32 texnum, boolean noencore, FBITFIELD blend, boolean fogwall, INT32 lightlevel, extracolormap_t *wallcolormap);
void HWR_AddTransparentFloor(lumpnum_t lumpnum, extrasubsector_t *xsub, boolean isceiling, fixed_t fixedheight, INT32 lightlevel, INT32 alpha, sector_t *FOFSector, FBITFIELD blend, boolean fogplane, extracolormap_t *planecolormap);
void HWR_AddTransparentPolyobjectFloor(lumpnum_t lumpnum, polyobj_t *polysector, boolean isceiling, fixed_t fixedheight,
INT32 lightlevel, INT32 alpha, sector_t *FOFSector, FBITFIELD blend, extracolormap_t *planecolormap);
// --------
// hw_shaders.c
// --------
+824 -1141
View File
File diff suppressed because it is too large. Load diff
+63 -53
View File
@@ -23,6 +23,7 @@
#include "hw_glob.h"
#include "hw_data.h"
#include "hw_defs.h"
#include "hw_portal.h"
#include "../am_map.h"
#include "../d_player.h"
@@ -35,15 +36,32 @@
void HWR_Startup(void);
void HWR_Shutdown(void);
extern float gr_viewwidth, gr_viewheight, gr_baseviewwindowx, gr_baseviewwindowy;
extern float gl_viewwidth, gl_viewheight, gl_baseviewwindowx, gl_baseviewwindowy;
extern float gr_basewindowcenterx, gr_basewindowcentery;
extern float gl_basewindowcenterx, gl_basewindowcentery;
extern unsigned msaa;
extern boolean a2c;
extern FTransform atransform;
extern float gr_viewsin, gr_viewcos;
extern float gl_viewsin, gl_viewcos;
extern boolean gl_drawing_stencil;
extern seg_t *gl_curline;
extern side_t *gl_sidedef;
extern line_t *gl_linedef;
extern sector_t *gl_frontsector;
extern sector_t *gl_backsector;
enum
{
HWR_STENCIL_NORMAL,
HWR_STENCIL_BEGIN,
HWR_STENCIL_REVERSE,
HWR_STENCIL_DEPTH,
HWR_STENCIL_SKY
};
// Performance stats
extern ps_metric_t ps_hw_nodesorttime;
@@ -62,7 +80,7 @@ extern ps_metric_t ps_hw_numcolors;
extern ps_metric_t ps_hw_batchsorttime;
extern ps_metric_t ps_hw_batchdrawtime;
extern boolean gr_shadersavailable;
extern boolean gl_shadersavailable;
// hw_draw.c
void HWR_DrawPatch(GLPatch_t *gpatch, INT32 x, INT32 y, INT32 option);
@@ -81,24 +99,25 @@ UINT8 *HWR_GetScreenshot(void);
boolean HWR_Screenshot(const char *lbmname);
// hw_main.c
void HWR_RenderFrame(INT32 viewnumber, player_t *player, boolean skybox);
void HWR_RenderPlayerView(INT32 viewnumber, player_t *player);
void HWR_SetViewSize(void);
void HWR_AddCommands(void);
void HWR_RenderPlayerView(INT32 viewnumber, player_t *player);
void HWR_RenderViewpoint(gl_portal_t *rootportal, const float fpov, player_t *player, int stencil_level, boolean allow_portals);
void HWR_SetTransform(float fpov, player_t *player);
void HWR_ClearClipper(void);
void HWR_SetStencilState(int state, int level);
boolean HWR_UseShader(void);
boolean HWR_ShouldUsePaletteRendering(void);
boolean HWR_PalRenderFlashpal(void);
void HWR_TogglePaletteRendering(void);
// My original intention was to split hw_main.c
// into files like hw_bsp.c, hw_sprites.c...
// hw_main.c: Lighting and fog
void HWR_Lighting(FSurfaceInfo *Surface, INT32 light_level, extracolormap_t *colormap);
UINT8 HWR_FogBlockAlpha(INT32 light, extracolormap_t *colormap); // Let's see if this can work
FBITFIELD HWR_TranstableToAlpha(INT32 transtablenum, FSurfaceInfo *pSurf);
@@ -106,7 +125,6 @@ FBITFIELD HWR_TranstableToAlpha(INT32 transtablenum, FSurfaceInfo *pSurf);
INT32 HWR_GetTextureUsed(void);
// hw_main.c: Post-rendering
void HWR_DoPostProcessor(player_t *player);
void HWR_StartScreenWipe(void);
void HWR_EndScreenWipe(void);
void HWR_DrawIntermissionBG(void);
@@ -115,63 +133,55 @@ void HWR_RenderVhsEffect(fixed_t upbary, fixed_t downbary, UINT8 updistort, UINT
void HWR_MakeScreenFinalTexture(void);
void HWR_DrawScreenFinalTexture(INT32 width, INT32 height);
// hw_main.c: Planes
//void HWR_RenderPlane(subsector_t *subsector, extrasubsector_t *xsub, boolean isceiling, fixed_t fixedheight, FBITFIELD PolyFlags, INT32 lightlevel, lumpnum_t lumpnum, sector_t *FOFsector, UINT8 alpha, extracolormap_t *planecolormap);
void HWR_AddTransparentFloor(lumpnum_t lumpnum, extrasubsector_t *xsub, boolean isceiling, fixed_t fixedheight, INT32 lightlevel, INT32 alpha, sector_t *FOFSector, FBITFIELD blend, boolean fogplane, extracolormap_t *planecolormap);
void HWR_RenderPolyObjectPlane(polyobj_t *polysector, boolean isceiling, fixed_t fixedheight, FBITFIELD blendmode, UINT8 lightlevel, lumpnum_t lumpnum, sector_t *FOFsector, UINT8 alpha, extracolormap_t *planecolormap);
void HWR_AddTransparentPolyobjectFloor(lumpnum_t lumpnum, polyobj_t *polysector, boolean isceiling, fixed_t fixedheight, INT32 lightlevel, INT32 alpha, sector_t *FOFSector, FBITFIELD blend, extracolormap_t *planecolormap);
// hw_main.c: Segs
void HWR_ProcessSeg(void); // Sort of like GLWall::Process in GZDoom
void HWR_RenderWall(FOutVector *wallVerts, FSurfaceInfo *pSurf, FBITFIELD blend, boolean fogwall, INT32 lightlevel, extracolormap_t *wallcolormap);
void HWR_ProjectWall(FOutVector *wallVerts, FSurfaceInfo *pSurf, FBITFIELD blendmode, INT32 lightlevel, extracolormap_t *wallcolormap);
void HWR_AddTransparentWall(FOutVector *wallVerts, FSurfaceInfo * pSurf, INT32 texnum, boolean noencore, FBITFIELD blend, boolean fogwall, INT32 lightlevel, extracolormap_t *wallcolormap);
// moved HWR_SplitWall to hw_main.c
void HWR_DrawSkyWall(FOutVector *wallVerts, FSurfaceInfo *Surf);
void HWR_DrawSkyBackground(float fpov);
// hw_bsp.c
void HWR_CreatePlanePolygons(INT32 bspnum);
extern boolean gr_maphasportals;
extern boolean gl_maphasportals;
// hw_cache.c
void HWR_LoadTextures(size_t pnumtextures);
RGBA_t *HWR_GetTexturePalette(void);
void HWR_SetShaderState(void);
// Console variables
extern consvar_t cv_grshaders;
extern CV_PossibleValue_t glanisotropicmode_cons_t[];
extern consvar_t cv_glscreentextures;
#ifdef USE_FBO_OGL
extern consvar_t cv_grframebuffer;
extern consvar_t cv_glframebuffer;
#endif
extern consvar_t cv_grshearing;
extern consvar_t cv_grfov;
extern consvar_t cv_grmdls;
extern consvar_t cv_grfog;
extern consvar_t cv_grfogdensity;
extern consvar_t cv_grfiltermode;
extern consvar_t cv_granisotropicmode;
extern consvar_t cv_grcorrecttricks;
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_grhorizonlines;
extern consvar_t cv_grfallbackplayermodel;
extern consvar_t cv_grbatching;
extern consvar_t cv_grrenderdistance;
extern consvar_t cv_grpaletterendering;
extern consvar_t cv_grpalettedepth;
extern consvar_t cv_grflashpal;
extern consvar_t cv_lightdither;
extern consvar_t cv_grscreentextures;
extern consvar_t cv_grportals;
extern consvar_t cv_nostencil;
extern consvar_t cv_secbright;
extern CV_PossibleValue_t granisotropicmode_cons_t[];
extern consvar_t cv_glmdls;
extern consvar_t cv_glfallbackplayermodel;
extern consvar_t cv_glspritebillboarding;
extern consvar_t cv_glshearing;
extern consvar_t cv_glfakecontrast;
extern consvar_t cv_glslopecontrast;
extern consvar_t cv_glshaders;
extern consvar_t cv_gllightdither;
extern consvar_t cv_glsecbright;
extern consvar_t cv_glfiltermode;
extern consvar_t cv_glanisotropicmode;
extern consvar_t cv_glsolvetjoin;
extern consvar_t cv_glbatching;
extern consvar_t cv_glrenderdistance;
extern consvar_t cv_glhorizonlines;
extern consvar_t cv_glportals;
extern consvar_t cv_glfovchange;
extern consvar_t cv_glpaletterendering;
extern consvar_t cv_glpalettedepth;
extern consvar_t cv_glflashpal;
#endif
+83 -83
View File
@@ -147,7 +147,7 @@ static void PNG_warn(png_structp PNG, png_const_charp pngtext)
CONS_Debug(DBG_RENDER, "libpng warning at %p: %s", PNG, pngtext);
}
static GLTextureFormat_t PNG_Load(const char *filename, int *w, int *h, GLPatch_t *grpatch)
static GLTextureFormat_t PNG_Load(const char *filename, int *w, int *h, GLPatch_t *glpatch)
{
png_structp png_ptr;
png_infop png_info_ptr;
@@ -201,7 +201,7 @@ static GLTextureFormat_t PNG_Load(const char *filename, int *w, int *h, GLPatch_
//CONS_Debug(DBG_RENDER, "libpng load error on %s\n", filename);
png_destroy_read_struct(&png_ptr, &png_info_ptr, NULL);
fclose(png_FILE);
Z_Free(grpatch->mipmap->data);
Z_Free(glpatch->mipmap->data);
return 0;
}
#ifdef USE_FAR_KEYWORD
@@ -242,7 +242,7 @@ static GLTextureFormat_t PNG_Load(const char *filename, int *w, int *h, GLPatch_
{
png_uint_32 i, pitch = png_get_rowbytes(png_ptr, png_info_ptr);
png_bytep PNG_image = Z_Malloc(pitch*height, PU_HWRCACHE, &grpatch->mipmap->data);
png_bytep PNG_image = Z_Malloc(pitch*height, PU_HWRCACHE, &glpatch->mipmap->data);
png_bytepp row_pointers = png_malloc(png_ptr, height * sizeof (png_bytep));
for (i = 0; i < height; i++)
row_pointers[i] = PNG_image + i*pitch;
@@ -282,7 +282,7 @@ typedef struct
} PcxHeader;
static GLTextureFormat_t PCX_Load(const char *filename, int *w, int *h,
GLPatch_t *grpatch)
GLPatch_t *glpatch)
{
PcxHeader header;
#define PALSIZE 768
@@ -322,7 +322,7 @@ static GLTextureFormat_t PCX_Load(const char *filename, int *w, int *h,
pw = *w = header.xmax - header.xmin + 1;
ph = *h = header.ymax - header.ymin + 1;
image = Z_Malloc(pw*ph*4, PU_HWRCACHE, &grpatch->mipmap->data);
image = Z_Malloc(pw*ph*4, PU_HWRCACHE, &glpatch->mipmap->data);
if (fread(palette, sizeof (UINT8), PALSIZE, file) != PALSIZE)
{
@@ -364,43 +364,43 @@ static GLTextureFormat_t PCX_Load(const char *filename, int *w, int *h,
// -----------------+
static void md2_loadTexture(md2_t *model)
{
GLPatch_t *grpatch;
GLPatch_t *glpatch;
const char *filename = model->filename;
if (model->grpatch)
if (model->glpatch)
{
grpatch = model->grpatch;
Z_Free(grpatch->mipmap->data);
glpatch = model->glpatch;
Z_Free(glpatch->mipmap->data);
}
else
{
grpatch = Z_Calloc(sizeof *grpatch, PU_HWRPATCHINFO,
&(model->grpatch));
grpatch->mipmap = Z_Calloc(sizeof (GLMipmap_t), PU_HWRPATCHINFO, NULL);
glpatch = Z_Calloc(sizeof *glpatch, PU_HWRPATCHINFO,
&(model->glpatch));
glpatch->mipmap = Z_Calloc(sizeof (GLMipmap_t), PU_HWRPATCHINFO, NULL);
}
if (!grpatch->mipmap->downloaded && !grpatch->mipmap->data)
if (!glpatch->mipmap->downloaded && !glpatch->mipmap->data)
{
int w = 0, h = 0;
#ifdef HAVE_PNG
grpatch->mipmap->format = PNG_Load(filename, &w, &h, grpatch);
if (grpatch->mipmap->format == 0)
glpatch->mipmap->format = PNG_Load(filename, &w, &h, glpatch);
if (glpatch->mipmap->format == 0)
#endif
grpatch->mipmap->format = PCX_Load(filename, &w, &h, grpatch);
if (grpatch->mipmap->format == 0)
glpatch->mipmap->format = PCX_Load(filename, &w, &h, glpatch);
if (glpatch->mipmap->format == 0)
{
grpatch->notfound = true;// mark it so its not searched for again repeatedly
glpatch->notfound = true;// mark it so its not searched for again repeatedly
return;
}
grpatch->mipmap->downloaded = 0;
grpatch->mipmap->flags = 0;
glpatch->mipmap->downloaded = 0;
glpatch->mipmap->flags = 0;
grpatch->width = (INT16)w;
grpatch->height = (INT16)h;
grpatch->mipmap->width = (UINT16)w;
grpatch->mipmap->height = (UINT16)h;
glpatch->width = (INT16)w;
glpatch->height = (INT16)h;
glpatch->mipmap->width = (UINT16)w;
glpatch->mipmap->height = (UINT16)h;
// for palette rendering, color cube is applied in post-processing instead of here
if (!HWR_ShouldUsePaletteRendering())
@@ -408,7 +408,7 @@ static void md2_loadTexture(md2_t *model)
UINT32 size;
RGBA_t *image;
// Lactozilla: Apply colour cube
image = grpatch->mipmap->data;
image = glpatch->mipmap->data;
size = w*h;
while (size--)
{
@@ -417,8 +417,8 @@ static void md2_loadTexture(md2_t *model)
}
}
}
HWD.pfnSetTexture(grpatch->mipmap);
HWR_UnlockCachedPatch(grpatch);
HWD.pfnSetTexture(glpatch->mipmap);
HWR_UnlockCachedPatch(glpatch);
}
// -----------------+
@@ -426,49 +426,49 @@ static void md2_loadTexture(md2_t *model)
// -----------------+
static void md2_loadBlendTexture(md2_t *model)
{
GLPatch_t *grpatch;
GLPatch_t *glpatch;
char *filename = Z_Malloc(strlen(model->filename)+7, PU_STATIC, NULL);
strcpy(filename, model->filename);
FIL_ForceExtension(filename, "_blend.png");
if (model->blendgrpatch)
if (model->blendglpatch)
{
grpatch = model->blendgrpatch;
Z_Free(grpatch->mipmap->data);
glpatch = model->blendglpatch;
Z_Free(glpatch->mipmap->data);
}
else
{
grpatch = Z_Calloc(sizeof *grpatch, PU_HWRPATCHINFO,
&(model->blendgrpatch));
grpatch->mipmap = Z_Calloc(sizeof (GLMipmap_t), PU_HWRPATCHINFO, NULL);
glpatch = Z_Calloc(sizeof *glpatch, PU_HWRPATCHINFO,
&(model->blendglpatch));
glpatch->mipmap = Z_Calloc(sizeof (GLMipmap_t), PU_HWRPATCHINFO, NULL);
}
if (!grpatch->mipmap->downloaded && !grpatch->mipmap->data)
if (!glpatch->mipmap->downloaded && !glpatch->mipmap->data)
{
int w = 0, h = 0;
#ifdef HAVE_PNG
grpatch->mipmap->format = PNG_Load(filename, &w, &h, grpatch);
if (grpatch->mipmap->format == 0)
glpatch->mipmap->format = PNG_Load(filename, &w, &h, glpatch);
if (glpatch->mipmap->format == 0)
#endif
grpatch->mipmap->format = PCX_Load(filename, &w, &h, grpatch);
if (grpatch->mipmap->format == 0)
glpatch->mipmap->format = PCX_Load(filename, &w, &h, glpatch);
if (glpatch->mipmap->format == 0)
{
grpatch->notfound = true;// mark it so its not searched for again repeatedly
glpatch->notfound = true;// mark it so its not searched for again repeatedly
Z_Free(filename);
return;
}
grpatch->mipmap->downloaded = 0;
grpatch->mipmap->flags = 0;
glpatch->mipmap->downloaded = 0;
glpatch->mipmap->flags = 0;
grpatch->width = (INT16)w;
grpatch->height = (INT16)h;
grpatch->mipmap->width = (UINT16)w;
grpatch->mipmap->height = (UINT16)h;
glpatch->width = (INT16)w;
glpatch->height = (INT16)h;
glpatch->mipmap->width = (UINT16)w;
glpatch->mipmap->height = (UINT16)h;
}
HWD.pfnSetTexture(grpatch->mipmap); // We do need to do this so that it can be cleared and knows to recreate it when necessary
HWR_UnlockCachedPatch(grpatch);
HWD.pfnSetTexture(glpatch->mipmap); // We do need to do this so that it can be cleared and knows to recreate it when necessary
HWR_UnlockCachedPatch(glpatch);
Z_Free(filename);
}
@@ -489,7 +489,7 @@ void HWR_InitMD2(void)
{
md2_playermodels[s].scale = -1.0f;
md2_playermodels[s].model = NULL;
md2_playermodels[s].grpatch = NULL;
md2_playermodels[s].glpatch = NULL;
md2_playermodels[s].skin = -1;
md2_playermodels[s].notfound = true;
md2_playermodels[s].error = false;
@@ -498,7 +498,7 @@ void HWR_InitMD2(void)
{
md2_localplayermodels[s].scale = -1.0f;
md2_localplayermodels[s].model = NULL;
md2_localplayermodels[s].grpatch = NULL;
md2_localplayermodels[s].glpatch = NULL;
md2_localplayermodels[s].skin = -1;
md2_localplayermodels[s].notfound = true;
md2_localplayermodels[s].error = false;
@@ -507,7 +507,7 @@ void HWR_InitMD2(void)
{
md2_models[i].scale = -1.0f;
md2_models[i].model = NULL;
md2_models[i].grpatch = NULL;
md2_models[i].glpatch = NULL;
md2_models[i].skin = -1;
md2_models[i].notfound = true;
md2_models[i].error = false;
@@ -680,7 +680,7 @@ spritemd2found:
#define SETBRIGHTNESS(brightness,r,g,b) \
brightness = (UINT8)(((1063*(UINT32)(r))/5000) + ((3576*(UINT32)(g))/5000) + ((361*(UINT32)(b))/5000))
static void HWR_CreateBlendedTexture(GLPatch_t *gpatch, GLPatch_t *blendgpatch, GLMipmap_t *grmip, INT32 skinnum, skincolors_t color)
static void HWR_CreateBlendedTexture(GLPatch_t *gpatch, GLPatch_t *blendgpatch, GLMipmap_t *glmip, INT32 skinnum, skincolors_t color)
{
UINT16 w = gpatch->width, h = gpatch->height;
UINT32 size = w*h;
@@ -696,24 +696,24 @@ static void HWR_CreateBlendedTexture(GLPatch_t *gpatch, GLPatch_t *blendgpatch,
memset(translation, 0, sizeof(translation));
memset(cutoff, 0, sizeof(cutoff));
if (grmip->width == 0)
if (glmip->width == 0)
{
grmip->width = gpatch->width;
grmip->height = gpatch->height;
glmip->width = gpatch->width;
glmip->height = gpatch->height;
// no wrap around, no chroma key
grmip->flags = 0;
glmip->flags = 0;
// setup the texture info
grmip->format = GL_TEXFMT_RGBA;
glmip->format = GL_TEXFMT_RGBA;
}
if (grmip->data)
if (glmip->data)
{
Z_Free(grmip->data);
grmip->data = NULL;
Z_Free(glmip->data);
glmip->data = NULL;
}
cur = Z_Malloc(size*4, PU_HWRCACHE, &grmip->data);
cur = Z_Malloc(size*4, PU_HWRCACHE, &glmip->data);
memset(cur, 0x00, size*4);
image = gpatch->mipmap->data;
@@ -1044,7 +1044,7 @@ skippixel:
static void HWR_GetBlendedTexture(GLPatch_t *gpatch, GLPatch_t *blendgpatch, INT32 skinnum, const UINT8 *colormap, skincolors_t color)
{
// mostly copied from HWR_GetMappedPatch, hence the similarities and comment
GLMipmap_t *grmip, *newmip;
GLMipmap_t *glmip, *newmip;
if (colormap == colormaps || colormap == NULL)
{
@@ -1055,15 +1055,15 @@ static void HWR_GetBlendedTexture(GLPatch_t *gpatch, GLPatch_t *blendgpatch, INT
// search for the mimmap
// skip the first (no colormap translated)
for (grmip = gpatch->mipmap; grmip->nextcolormap; )
for (glmip = gpatch->mipmap; glmip->nextcolormap; )
{
grmip = grmip->nextcolormap;
if (grmip->colormap == colormap)
glmip = glmip->nextcolormap;
if (glmip->colormap == colormap)
{
if (grmip->downloaded && grmip->data)
if (glmip->downloaded && glmip->data)
{
HWD.pfnSetTexture(grmip); // found the colormap, set it to the correct texture
Z_ChangeTag(grmip->data, PU_HWRCACHE_UNLOCKED);
HWD.pfnSetTexture(glmip); // found the colormap, set it to the correct texture
Z_ChangeTag(glmip->data, PU_HWRCACHE_UNLOCKED);
return;
}
}
@@ -1079,7 +1079,7 @@ static void HWR_GetBlendedTexture(GLPatch_t *gpatch, GLPatch_t *blendgpatch, INT
newmip = calloc(1, sizeof (*newmip));
if (newmip == NULL)
I_Error("%s: Out of memory", "HWR_GetMappedPatch");
grmip->nextcolormap = newmip;
glmip->nextcolormap = newmip;
newmip->colormap = colormap;
HWR_CreateBlendedTexture(gpatch, blendgpatch, newmip, skinnum, color);
@@ -1095,7 +1095,7 @@ static void HWR_GetBlendedTexture(GLPatch_t *gpatch, GLPatch_t *blendgpatch, INT
// Returns :
// -----------------+
void HWR_DrawMD2(gr_vissprite_t *spr)
void HWR_DrawMD2(gl_vissprite_t *spr)
{
md2_t *md2;
@@ -1105,7 +1105,7 @@ void HWR_DrawMD2(gr_vissprite_t *spr)
FTransform p;
FSurfaceInfo Surf;
if (!cv_grmdls.value)
if (!cv_glmdls.value)
return;
if (spr->precip)
@@ -1164,7 +1164,7 @@ void HWR_DrawMD2(gr_vissprite_t *spr)
angle_t ang;
interpmobjstate_t interp;
if (R_UsingFrameInterpolation() && !paused && (!cv_grmaxinterpdist.value || R_QuickCamDist(spr->mobj->x, spr->mobj->y) < cv_grmaxinterpdist.value))
if (R_UsingFrameInterpolation() && !paused && (!cv_maxinterpdist.value || R_QuickCamDist(spr->mobj->x, spr->mobj->y) < cv_maxinterpdist.value))
{
R_InterpolateMobjState(spr->mobj, rendertimefrac, &interp);
}
@@ -1244,22 +1244,22 @@ void HWR_DrawMD2(gr_vissprite_t *spr)
}
}
//Hurdler: arf, I don't like that implementation at all... too much crappy
gpatch = md2->grpatch;
gpatch = md2->glpatch;
if (!gpatch || ((!gpatch->mipmap->format || !gpatch->mipmap->downloaded) && !gpatch->notfound))
md2_loadTexture(md2);
gpatch = md2->grpatch; // Load it again, because it isn't being loaded into gpatch after md2_loadtexture...
gpatch = md2->glpatch; // Load it again, because it isn't being loaded into gpatch after md2_loadtexture...
if ((gpatch && gpatch->mipmap->format) // don't load the blend texture if the base texture isn't available
&& (!md2->blendgrpatch
|| ((!((GLPatch_t *)md2->blendgrpatch)->mipmap->format || !((GLPatch_t *)md2->blendgrpatch)->mipmap->downloaded)
&& !((GLPatch_t *)md2->blendgrpatch)->notfound)))
&& (!md2->blendglpatch
|| ((!((GLPatch_t *)md2->blendglpatch)->mipmap->format || !((GLPatch_t *)md2->blendglpatch)->mipmap->downloaded)
&& !((GLPatch_t *)md2->blendglpatch)->notfound)))
md2_loadBlendTexture(md2);
if (gpatch && gpatch->mipmap->format) // else if meant that if a texture couldn't be loaded, it would just end up using something else's texture
{
if ((skincolors_t)spr->mobj->color != SKINCOLOR_NONE &&
md2->blendgrpatch && ((GLPatch_t *)md2->blendgrpatch)->mipmap->format
&& gpatch->width == ((GLPatch_t *)md2->blendgrpatch)->width && gpatch->height == ((GLPatch_t *)md2->blendgrpatch)->height)
md2->blendglpatch && ((GLPatch_t *)md2->blendglpatch)->mipmap->format
&& gpatch->width == ((GLPatch_t *)md2->blendglpatch)->width && gpatch->height == ((GLPatch_t *)md2->blendglpatch)->height)
{
INT32 tcskinnum = TC_DEFAULT;
if ((spr->mobj->flags & MF_BOSS) && (spr->mobj->flags2 & MF2_FRET) && (leveltime & 1)) // Bosses "flash"
@@ -1284,7 +1284,7 @@ void HWR_DrawMD2(gr_vissprite_t *spr)
}
else tcskinnum = TC_DEFAULT;
}
HWR_GetBlendedTexture(gpatch, (GLPatch_t *)md2->blendgrpatch, tcskinnum, spr->colormap, (skincolors_t)spr->mobj->color);
HWR_GetBlendedTexture(gpatch, (GLPatch_t *)md2->blendglpatch, tcskinnum, spr->colormap, (skincolors_t)spr->mobj->color);
}
else
{
@@ -1313,7 +1313,7 @@ void HWR_DrawMD2(gr_vissprite_t *spr)
// Interpolate the model interpolation. (lol)
tics -= FixedToFloat(rendertimefrac);
if (cv_grmdls.value == 1 && tics <= durs)
if (cv_glmdls.value == 1 && tics <= durs)
{
// frames are handled differently for states with FF_ANIMATE, so get the next frame differently for the interpolation
if (spr->mobj->frame & FF_ANIMATE)
@@ -1478,8 +1478,8 @@ void HWR_DrawMD2(gr_vissprite_t *spr)
float oy = ys * flipfactor*FIXED_TO_FLOAT(interp.spriteyoffset);
// offset perpendicular to the camera angle
p.x -= ox * gr_viewsin;
p.y += ox * gr_viewcos;
p.x -= ox * gl_viewsin;
p.y += ox * gl_viewcos;
p.z += oy;
HWD.pfnDrawModel(md2->model, frame, durs, tics, nextFrame, &p, md2->scale * xs, md2->scale * ys, flip, hflip, &Surf);
+3 -3
View File
@@ -28,8 +28,8 @@ typedef struct
float scale;
float offset;
model_t *model;
void *grpatch;
void *blendgrpatch;
void *glpatch;
void *blendglpatch;
boolean notfound;
INT32 skin;
boolean error;
@@ -40,7 +40,7 @@ extern md2_t md2_playermodels[MAXSKINS];
extern md2_t md2_localplayermodels[MAXLOCALSKINS];
void HWR_InitMD2(void);
void HWR_DrawMD2(gr_vissprite_t *spr);
void HWR_DrawMD2(gl_vissprite_t *spr);
void HWR_AddPlayerMD2(INT32 skin, boolean local);
void HWR_AddSpriteMD2(size_t spritenum);
+227
View File
@@ -0,0 +1,227 @@
// SONIC ROBO BLAST 2 KART
//-----------------------------------------------------------------------------
// Copyright (C) 2024 by Kart Krew.
// Copyright (C) 2020 by Sonic Team Junior.
// Copyright (C) 2000 by DooM Legacy Team.
// Copyright (C) 1996 by id Software, Inc.
//
// This program is free software distributed under the
// terms of the GNU General Public License, version 2.
// See the 'LICENSE' file for more details.
//-----------------------------------------------------------------------------
/// \file hw_portal.c
/// \brief OpenGL renderer portals.
// ==========================================================================
// Visual portals (attr. Hannu Hanhi)
// ==========================================================================
#ifdef HWRENDER
#include "../r_portal.h"
#include "../z_zone.h"
#include "hw_clip.h"
#include "hw_drv.h"
#include "hw_defs.h"
#include "hw_main.h"
#include "hw_portal.h"
SINT8 gl_portal_state = GLPORTAL_OFF;
gl_portallist_t *currentportallist;
// clip the area outside the portal destination window
void HWR_PortalClipping(gl_portal_t *portal)
{
gld_clipper_SafeAddClipRange(portal->angle1, portal->angle2);
}
static gl_portal_t* HWR_Portal_Add (seg_t *seg)
{
gl_portal_t *portal = Z_Malloc(sizeof(gl_portal_t), PU_STATIC, NULL);
// Linked list.
if (!currentportallist->base)
{
currentportallist->base = portal;
currentportallist->cap = portal;
}
else
{
currentportallist->cap->next = portal;
currentportallist->cap = portal;
}
portal->next = NULL;
portal->seg = seg;
return portal;
}
void HWR_FreePortalList(gl_portallist_t freelist)
{
portalcullsector = NULL;
// free memory from portal list allocated by calls to Add2Lines
gl_portal_t *gl_portal_temp = freelist.base;
while (gl_portal_temp)
{
gl_portal_t *nextportal = gl_portal_temp->next;
Z_Free(gl_portal_temp);
gl_portal_temp = nextportal;
}
}
void HWR_Portal_Add2Lines(const INT32 line1, const INT32 line2, seg_t *seg)
{
gl_portal_t *portal = HWR_Portal_Add(seg);
// Offset the portal view by the linedef centers
line_t* start = &lines[line1];
line_t* dest = &lines[line2];
angle_t dangle = R_PointToAngle2(0, 0, dest->dx, dest->dy) - R_PointToAngle2(start->dx, start->dy, 0, 0);
fixed_t disttopoint;
angle_t angtopoint;
vertex_t dest_c, start_c;
// looking glass center
start_c.x = start->v1->x/2 + start->v2->x/2;
start_c.y = start->v1->y/2 + start->v2->y/2;
// other side center
dest_c.x = dest->v1->x/2 + dest->v2->x/2;
dest_c.y = dest->v1->y/2 + dest->v2->y/2;
disttopoint = R_PointToDist2(start_c.x, start_c.y, viewx, viewy);
angtopoint = R_PointToAngle2(start_c.x, start_c.y, viewx, viewy);
angtopoint += dangle;
portal->viewx = dest_c.x + FixedMul(FINECOSINE(angtopoint>>ANGLETOFINESHIFT), disttopoint);
portal->viewy = dest_c.y + FixedMul(FINESINE(angtopoint>>ANGLETOFINESHIFT), disttopoint);
portal->viewz = viewz + dest->frontsector->floorheight - start->frontsector->floorheight;
portal->viewangle = viewangle + dangle;
portal->angle1 = R_PointToAngle64(seg->v1->x, seg->v1->y) + dangle;
portal->angle2 = R_PointToAngle64(seg->v2->x, seg->v2->y) + dangle;
portal->clipline = line2;
}
void HWR_PortalFrame(gl_portal_t* portal)
{
viewx = portal->viewx;
viewy = portal->viewy;
viewz = portal->viewz;
viewangle = portal->viewangle;
//viewsin = FINESINE(viewangle>>ANGLETOFINESHIFT);
//viewcos = FINECOSINE(viewangle>>ANGLETOFINESHIFT);
if (portal->clipline != -1)
{
portalclipline = &lines[portal->clipline];
portalcullsector = portalclipline->frontsector;
viewsector = portalclipline->frontsector;
}
else
{
portalclipline = NULL;
portalcullsector = NULL;
viewsector = R_PointInSubsector(viewx, viewy)->sector;
}
}
// Renders a portal segment.
static void HWR_RenderPortalSeg(gl_portal_t* portal, SINT8 state)
{
gl_drawing_stencil = true; // do not draw outside of the stencil buffer, idiot.
// set our portal state and prepare to render the seg
HWR_SetPortalState(state);
gl_curline = portal->seg;
gl_frontsector = portal->seg->frontsector;
gl_backsector = portal->seg->backsector;
HWR_ProcessSeg();
gl_drawing_stencil = false;
// need to work around the r_opengl PF_Invisible bug with this call
// similarly as in the linkdraw hack in HWR_DrawSprites
HWD.pfnSetBlend(PF_Translucent|PF_Occlude|PF_Masked);
}
// Renders a single portal from the current viewpoint.
void HWR_RenderPortal(gl_portal_t* portal, gl_portal_t* rootportal, const float fpov, player_t *player, int stencil_level)
{
// draw portal seg to stencil buffer with increment
HWR_SetTransform(fpov, player);
HWR_ClearClipper();
HWR_SetStencilState(HWR_STENCIL_BEGIN, stencil_level);
HWR_RenderPortalSeg(portal, GLPORTAL_STENCIL);
// go to portal frame lmao
HWR_PortalFrame(portal);
// call HWR_RenderViewpoint
HWR_RenderViewpoint(portal, fpov, player, stencil_level + 1, true);
// return to current frame
if (rootportal)
HWR_PortalFrame(rootportal);
else // current frame is not a portal frame but the main view!
{
R_SetupFrame(player, false);
portalclipline = NULL;
}
// remove portal seg from stencil buffer
HWR_SetTransform(fpov, player);
HWR_ClearClipper();
HWR_SetStencilState(HWR_STENCIL_REVERSE, stencil_level);
HWR_RenderPortalSeg(portal, GLPORTAL_STENCIL);
// draw portal seg to depth buffer
HWR_ClearClipper();
HWR_SetStencilState(HWR_STENCIL_DEPTH, stencil_level);
HWR_RenderPortalSeg(portal, GLPORTAL_DEPTH);
}
// returns true if the point is on the correct (viewable) side of the
// portal destination line
boolean HWR_PortalCheckPointSide(fixed_t x, fixed_t y)
{
// we are checking if the point is on the viewable side of the portal exit.
// being exactly on the portal exit line is not enough to pass the test.
// P_PointOnLineSide could behave differently from this expectation on this case,
// so first check if the point is precisely on the line, and then if not, check the side.
vertex_t closest_point;
P_ClosestPointOnLine(x, y, portalclipline, &closest_point);
if (closest_point.x != x || closest_point.y != y)
{
if (P_PointOnLineSide(x, y, portalclipline) != 1)
return true;
}
return false;
}
boolean HWR_PortalCheckBBox(const fixed_t *bspcoord)
{
if (!portalclipline)
return true;
if (HWR_PortalCheckPointSide(bspcoord[BOXLEFT], bspcoord[BOXTOP]) ||
HWR_PortalCheckPointSide(bspcoord[BOXLEFT], bspcoord[BOXBOTTOM]) ||
HWR_PortalCheckPointSide(bspcoord[BOXRIGHT], bspcoord[BOXTOP]) ||
HWR_PortalCheckPointSide(bspcoord[BOXRIGHT], bspcoord[BOXBOTTOM]))
{
return true;
}
// we did not find any reason to pass the check, so return failure
return false;
}
#endif
+81
View File
@@ -0,0 +1,81 @@
// SONIC ROBO BLAST 2
//-----------------------------------------------------------------------------
// Copyright (C) 1993-1996 by id Software, Inc.
// Copyright (C) 1998-2000 by DooM Legacy Team.
// Copyright (C) 1999-2018 by Sonic Team Junior.
//
// This program is free software distributed under the
// terms of the GNU General Public License, version 2.
// See the 'LICENSE' file for more details.
//-----------------------------------------------------------------------------
/// \file hw_portal.h
/// \brief OpenGL renderer portal struct, functions, linked list extern.
#ifndef __HW_PORTAL__
#define __HW_PORTAL__
#ifdef HWRENDER
#include "../doomstat.h"
#include "../r_data.h"
#include "../r_bsp.h"
/** Portal structure.
*/
enum
{
GLPORTAL_OFF,
GLPORTAL_SEARCH,
GLPORTAL_STENCIL,
GLPORTAL_DEPTH,
GLPORTAL_INSIDE,
};
typedef struct gl_portal_s
{
struct gl_portal_s *next;
// Viewport.
fixed_t viewx;
fixed_t viewy;
fixed_t viewz;
angle_t viewangle;
seg_t *seg; // seg that is used for drawing to the stencil buffer
INT32 clipline; // Optional clipline for line-based portals
// angles for the left and right edges of the portal
// relative to the viewpoint
angle_t angle1;
angle_t angle2;
} gl_portal_t;
typedef struct gl_portallist_s
{
gl_portal_t *base;
gl_portal_t *cap;
} gl_portallist_t;
extern SINT8 gl_portal_state;
// new thing
extern gl_portallist_t *currentportallist;
static inline void HWR_SetPortalState (SINT8 state)
{
gl_portal_state = state;
}
// Adds an entry to the clipper for portal rendering
void HWR_PortalClipping(gl_portal_t *portal);
void HWR_Portal_Add2Lines(const INT32 line1, const INT32 line2, seg_t *seg);
void HWR_PortalFrame(gl_portal_t* portal);
void HWR_RenderPortal(gl_portal_t* portal, gl_portal_t* rootportal, const float fpov, player_t *player, int stencil_level);
void HWR_FreePortalList(gl_portallist_t portallist);
boolean HWR_PortalCheckPointSide(fixed_t x, fixed_t y);
boolean HWR_PortalCheckBBox(const fixed_t *bspcoord);
#endif
#endif
+9 -9
View File
@@ -25,7 +25,7 @@ static struct {
const char *vertex;
const char *fragment;
} const gl_shadersources[] = {
// Floor shader
{GLSL_DEFAULT_VERTEX_SHADER, GLSL_FLOOR_FRAGMENT_SHADER},
@@ -52,7 +52,7 @@ static struct {
// Palette postprocess shader
{GLSL_DEFAULT_VERTEX_SHADER, GLSL_PALETTE_POSTPROCESS_FRAGMENT_SHADER},
// UI colormap fade shader
{GLSL_DEFAULT_VERTEX_SHADER, GLSL_UI_COLORMAP_FADE_FRAGMENT_SHADER},
@@ -279,11 +279,11 @@ static char *HWR_PreprocessShader(char *original)
// Calculate length of modified shader.
new_len = original_len;
if (cv_grpaletterendering.value)
if (cv_glpaletterendering.value)
ADD_TO_LEN(PALETTE_RENDERING_DEFINE)
if (cv_lightdither.value)
if (cv_gllightdither.value)
ADD_TO_LEN(LIGHT_DITHERING_DEFINE)
#undef ADD_TO_LEN
@@ -324,10 +324,10 @@ static char *HWR_PreprocessShader(char *original)
}
// Write the defines.
if (cv_grpaletterendering.value)
if (cv_glpaletterendering.value)
WRITE_DEFINE(PALETTE_RENDERING_DEFINE)
if (cv_lightdither.value)
if (cv_gllightdither.value)
WRITE_DEFINE(LIGHT_DITHERING_DEFINE)
#undef WRITE_DEFINE
@@ -410,7 +410,7 @@ int HWR_GetShaderFromTarget(int shader_target)
// - custom shaders are enabled
// - custom shaders are allowed by the server
if (custom_shader != -1 && gl_shaders[custom_shader].compiled &&
cv_grshaders.value == 1)
cv_glshaders.value == 1)
return custom_shader;
else
return gl_shadertargets[shader_target].base_shader;
@@ -565,7 +565,7 @@ void HWR_LoadCustomShadersFromFile(UINT16 wadnum, boolean PK3)
int i;
boolean modified_shaders[NUMSHADERTARGETS] = {0};
if (!gr_shadersavailable)
if (!gl_shadersavailable)
return;
lump = HWR_FindShaderDefs(wadnum);
+2 -2
View File
@@ -171,7 +171,7 @@
"gl_FragColor = final_color;\n" \
"}\n" \
"#endif\0"
#define GLSL_SOFTWARE_FRAGMENT_SHADER_NOPAL \
"uniform sampler2D tex;\n" \
"uniform vec4 poly_color;\n" \
@@ -210,7 +210,7 @@
#define GLSL_WALL_FRAGMENT_SHADER \
GLSL_WALL_FUDGES \
GLSL_SOFTWARE_FRAGMENT_SHADER
#define GLSL_SHADOW_FRAGMENT_SHADER \
GLSL_FLOOR_FUDGES \
GLSL_SOFTWARE_FRAGMENT_SHADER_NOPAL
+37 -47
View File
@@ -24,6 +24,7 @@
#include <stdarg.h>
#include <math.h>
#include "../../r_local.h" // For rendertimefrac, used for the leveltime shader uniform
#include "../../i_video.h" // for UseScreenFBO
#include "r_opengl.h"
#include "r_vbo.h"
#include "../hw_shaders.h"
@@ -121,9 +122,9 @@ static GLint viewport[4];
#ifdef USE_FBO_OGL
GLuint FramebufferObject, FramebufferTexture, RenderbufferObject;
GLboolean FrameBufferEnabled = GL_FALSE, RenderToFramebuffer = GL_FALSE;
boolean supportFBO = false;
static boolean fboinit = false;
#endif
// Sryder: NextTexAvail is broken for these because palette changes or changes to the texture filter or antialiasing
@@ -706,7 +707,15 @@ static void Shader_SetUniforms(FSurfaceInfo *Surface, GLRGBAFloat *poly, GLRGBAF
static GLRGBAFloat shader_defaultcolor = {1.0f, 1.0f, 1.0f, 1.0f};
#ifdef USE_FBO_OGL
static boolean GLFramebuffer_IsFuncAvailible(void);
static boolean GLFramebuffer_CheckExt(void)
{
//this stuff needs atleast OGL 3.0
if (majorGL < 3)
return false;
// check if all needed gl extensions are available
return (isExtAvailable("GL_ARB_framebuffer_no_attachments", gl_extensions) && isExtAvailable("GL_ARB_framebuffer_object", gl_extensions) && isExtAvailable("GL_ARB_framebuffer_sRGB", gl_extensions));
}
#endif
void SetupGLFunc4(void)
@@ -753,7 +762,7 @@ void SetupGLFunc4(void)
pglGetUniformLocation = GetGLFunc("glGetUniformLocation");
#ifdef USE_FBO_OGL
if (GLFramebuffer_IsFuncAvailible())
if (GLFramebuffer_CheckExt())
{
pglGenFramebuffers = GetGLFunc("glGenFramebuffers");
pglBindFramebuffer = GetGLFunc("glBindFramebuffer");
@@ -766,24 +775,17 @@ void SetupGLFunc4(void)
pglRenderbufferStorage = GetGLFunc("glRenderbufferStorage");
pglFramebufferRenderbuffer = GetGLFunc("glFramebufferRenderbuffer");
// check if ALL functions are availible
if (pglGenFramebuffers && pglBindFramebuffer &&
pglDeleteFramebuffers && pglFramebufferTexture2D &&
pglCheckFramebufferStatus && pglGenRenderbuffers &&
pglBindRenderbuffer && pglDeleteRenderbuffers &&
pglRenderbufferStorage && pglFramebufferRenderbuffer)
supportFBO = true;
}
#endif
}
#ifdef USE_FBO_OGL
static boolean GLFramebuffer_IsFuncAvailible(void)
{
//this stuff needs atleast OGL 3.0
if (majorGL < 3)
return false;
return (isExtAvailable("GL_ARB_framebuffer_no_attachments",gl_extensions) && isExtAvailable("GL_ARB_framebuffer_object",gl_extensions) && isExtAvailable("GL_ARB_framebuffer_sRGB",gl_extensions));
return false;
}
#endif
EXPORT boolean HWRAPI(InitShaders) (void)
{
if (!pglUseProgram)
@@ -951,7 +953,6 @@ static void GLPerspective(GLfloat fovy, GLfloat aspect)
pglMultMatrixf(&m[0][0]);
}
// -----------------+
// SetModelView :
// -----------------+
@@ -1046,7 +1047,7 @@ EXPORT void HWRAPI(DeleteTexture) (GLMipmap_t *pTexInfo)
#ifdef USE_FBO_OGL
static void GLFramebuffer_GenerateAttachments(void)
{
if (!supportFBO)
if (!supportFBO || !UseScreenFBO())
return;
// Bind the framebuffer
@@ -1083,11 +1084,16 @@ static void GLFramebuffer_GenerateAttachments(void)
// Unbind the framebuffer
pglBindFramebuffer(GL_FRAMEBUFFER, 0);
fboinit = true;
}
void GLFramebuffer_DeleteAttachments(void)
{
if (!supportFBO)
if (!supportFBO || fboinit == false)
return;
if (FramebufferObject == 0 && RenderbufferObject == 0 && FramebufferTexture == 0)
return;
// Unbind the framebuffer
@@ -1102,11 +1108,12 @@ void GLFramebuffer_DeleteAttachments(void)
FramebufferTexture = 0;
RenderbufferObject = 0;
fboinit = false;
}
static void GLFramebuffer_Generate(void)
{
if (!supportFBO)
if (!supportFBO || !UseScreenFBO())
return;
// Generate the framebuffer
@@ -1119,7 +1126,7 @@ static void GLFramebuffer_Generate(void)
static void GLFramebuffer_Delete(void)
{
if (!supportFBO)
if (!supportFBO || fboinit == false)
return;
if (FramebufferObject)
@@ -1131,7 +1138,10 @@ static void GLFramebuffer_Delete(void)
inline void GLFramebuffer_Unbind(void)
{
if (!supportFBO)
if (!supportFBO || fboinit == false)
return;
if (FramebufferObject == 0 && RenderbufferObject == 0)
return;
pglBindFramebuffer(GL_FRAMEBUFFER, 0);
@@ -1140,7 +1150,7 @@ inline void GLFramebuffer_Unbind(void)
inline void GLFramebuffer_Enable(void)
{
if (!supportFBO)
if (!supportFBO || !UseScreenFBO())
return;
if (FramebufferObject == 0)
@@ -1154,7 +1164,10 @@ inline void GLFramebuffer_Enable(void)
void GLFramebuffer_Disable(void)
{
if (!supportFBO)
if (!supportFBO || fboinit == false)
return;
if (FramebufferObject == 0 && RenderbufferObject == 0)
return;
pglBindFramebuffer(GL_FRAMEBUFFER, 0);
@@ -1170,8 +1183,6 @@ void GLFramebuffer_Disable(void)
// -----------------+
void Flush(void)
{
//GL_DBG_Printf ("HWR_Flush()\n");
while (TexCacheHead)
{
FTextureInfo *pTexInfo = TexCacheHead;
@@ -1198,7 +1209,6 @@ void Flush(void)
textureBufferSize = 0;
}
// -----------------+
// isExtAvailable : Look if an OpenGL extension is available
// Returns : true if extension available
@@ -1226,7 +1236,6 @@ INT32 isExtAvailable(const char *extension, const GLubyte *start)
return 0;
}
// -----------------+
// Init : Initialise the OpenGL interface API
// Returns :
@@ -1236,7 +1245,6 @@ EXPORT boolean HWRAPI(Init) (void)
return LoadGL();
}
// -----------------+
// SetupGLInfo : Retreive and store currently loaded OpenGL version
// -----------------+
@@ -1398,7 +1406,6 @@ static void Clamp2D(GLenum pname)
#endif
}
// -----------------+
// SetBlend : Set render mode
// -----------------+
@@ -2247,12 +2254,6 @@ static void gld_BuildSky(int row_count, int col_count)
}
}
//-----------------------------------------------------------------------------
//
//
//
//-----------------------------------------------------------------------------
static void RenderDome(INT32 skytexnum)
{
int i, j;
@@ -2350,17 +2351,6 @@ EXPORT void HWRAPI(SetSpecialState) (hwdspecialstate_t IdState, INT32 Value)
case HWD_SET_SHADERS:
gl_allowshaders = Value;
break;
#ifdef USE_FBO_OGL
case HWD_SET_FRAMEBUFFER:
FrameBufferEnabled = Value ? GL_TRUE : GL_FALSE;
if (!supportFBO)
{
FrameBufferEnabled = GL_FALSE;
CV_Set(&cv_grframebuffer, "Off");
}
break;
#endif
case HWD_SET_TEXTUREFILTERMODE:
switch (Value)
{
-4
View File
@@ -98,10 +98,6 @@ typedef void (APIENTRY * PFNglGetIntegerv) (GLenum pname, GLint *params);
extern PFNglGetIntegerv pglGetIntegerv;
typedef const GLubyte* (APIENTRY * PFNglGetString) (GLenum name);
extern PFNglGetString pglGetString;
#if 0
typedef void (APIENTRY * PFNglEnableClientState) (GLenum cap); // redefined in r_opengl.c
static PFNglEnableClientState pglEnableClientState;
#endif
#endif
#ifdef USE_FBO_OGL
+1
View File
@@ -146,6 +146,7 @@ extern boolean xwaylandcrap;
void RefreshOGLSDLSurface(void);
void I_DownSample(void);
boolean UseScreenFBO(void);
extern boolean downsample;
#endif
+1 -1
View File
@@ -69,7 +69,7 @@ static fixed_t ScaleFromMap(fixed_t n, fixed_t scale)
static boolean K_DirectorIsEnabled(void)
{
return cv_director.value && !splitscreen && (gamestate == GS_LEVEL && (((stplyr && !stplyr->spectator) && (!playeringame[consoleplayer] || players[consoleplayer].spectator)) || (demo.playback && !demo.freecam && (!demo.title || !modeattacking))) && !K_DirectorIsPlayerAlone());
return cv_director.value && !splitscreen && (gamestate == GS_LEVEL && (((!playeringame[consoleplayer] || players[consoleplayer].spectator)) || (demo.playback && !demo.freecam && (!demo.title || !modeattacking))) && !K_DirectorIsPlayerAlone());
}
void K_InitDirector(void)
+62 -64
View File
@@ -2779,16 +2779,9 @@ void K_SpawnKartExplosion(fixed_t x, fixed_t y, fixed_t z, fixed_t radius, INT32
TVector v;
TVector *res;
fixed_t finalx, finaly, finalz, dist;
//mobj_t hoopcenter;
angle_t degrees, fa, closestangle;
fixed_t mobjx, mobjy, mobjz;
//hoopcenter.x = x;
//hoopcenter.y = y;
//hoopcenter.z = z;
//hoopcenter.z = z - mobjinfo[type].height/2;
degrees = FINEANGLES/number;
closestangle = 0;
@@ -3174,17 +3167,19 @@ static void K_SpawnAIZDust(player_t *player)
static void K_StretchPlayerGravity(player_t *p)
{
fixed_t mos = FRACUNIT;
fixed_t rzs = abs(p->mo->momz);
fixed_t zspd = abs(rzs/mos);
I_Assert(p != NULL);
I_Assert(p->mo != NULL);
I_Assert(!P_MobjWasRemoved(p->mo));
fixed_t mos = FRACUNIT;
fixed_t rzs = abs(p->mo->momz);
fixed_t zspd = abs(rzs/mos);
fixed_t stretchScaleFactor = 0;
fixed_t rzsDiv = 1;
fixed_t slamDiv = 1;
fixed_t dxs = p->mo->realxscale;
fixed_t dys = p->mo->realyscale;
//boolean gravSlamming = false;
//fixed_t impactFactor = 0;
fixed_t dxs = p->mo->realxscale;
fixed_t dys = p->mo->realyscale;
stretchScaleFactor = FixedDiv(FRACUNIT*60, cv_gravstretch.value);
if (stretchScaleFactor > 17476977)
@@ -3194,10 +3189,6 @@ static void K_StretchPlayerGravity(player_t *p)
//CONS_Printf(M_GetText("div: %d, scale factor: %d, stretch value: %d\n"), rzsDiv, stretchScaleFactor, cv_gravstretch.value);
I_Assert(p != NULL);
I_Assert(p->mo != NULL);
I_Assert(!P_MobjWasRemoved(p->mo));
if (p->mo->slamsoundtimer)
p->mo->slamsoundtimer--;
@@ -3207,40 +3198,40 @@ static void K_StretchPlayerGravity(player_t *p)
p->mo->slamsoundtimer = TICRATE;
}
if (!P_IsObjectOnGround(p->mo))
{
if (zspd != 0)
{
if (((dxs-(rzsDiv))) > (dxs/5))
{
p->mo->spritexscale = ((dxs-(rzsDiv)));
p->mo->stretchslam = rzs;
}
else
p->mo->spritexscale = (dxs/5);
if (!P_IsObjectOnGround(p->mo))
{
if (zspd != 0)
{
if (((dxs-(rzsDiv))) > (dxs/5))
{
p->mo->spritexscale = ((dxs-(rzsDiv)));
p->mo->stretchslam = rzs;
}
else
p->mo->spritexscale = (dxs/5);
p->mo->spriteyscale = (dys+((rzsDiv*2)/3));
}
else
{
p->mo->spritexscale = (dxs);
p->mo->spriteyscale = (dys);
}
}
else
{
p->mo->spriteyscale = (dys+((rzsDiv*2)/3));
}
else
{
p->mo->spritexscale = (dxs);
p->mo->spriteyscale = (dys);
}
}
else
{
if (stretchScaleFactor > 17476977)
slamDiv = 0;
else
slamDiv = FixedDiv(p->mo->stretchslam, stretchScaleFactor);
p->mo->spritexscale = (dxs+(((slamDiv*2)/3)*2));
p->mo->spriteyscale = (dys-(slamDiv));
if (p->mo->stretchslam > 0)
p->mo->stretchslam -= (4*mos);
else
p->mo->stretchslam = 0;
}
p->mo->spritexscale = (dxs+(((slamDiv*2)/3)*2));
p->mo->spriteyscale = (dys-(slamDiv));
if (p->mo->stretchslam > 0)
p->mo->stretchslam -= (4*mos);
else
p->mo->stretchslam = 0;
}
}
static void K_QuiteSaltyHop(player_t *p)
@@ -9024,7 +9015,7 @@ static boolean K_GetScreenCoords(vector2_t *vec, player_t *player, mobj_t *targe
#ifdef HWRENDER
// NOW we can get the angle differnce
if (rendermode == render_opengl && cv_grshearing.value == 0)
if (rendermode == render_opengl && cv_glshearing.value == 0)
{
angle_t yang = R_PointToAngle2(0, 0, dist, y); // not perspective
x = FixedMul(x, FINECOSINE((yang>>ANGLETOFINESHIFT) & FINEMASK)); // perspective
@@ -9625,7 +9616,8 @@ static void K_drawKartMinimapHead(mobj_t *mo, INT32 x, INT32 y, INT32 flags)
boolean skinlocal = mo->skinlocal;
fixed_t amnumxpos, amnumypos;
INT32 amxpos, amypos;
INT32 amxpos, amypos, wntdamxpos, wntdamypos;
fixed_t scale = FRACUNIT;
if (mo->skin)
skin = ((skin_t*)(mo->localskin ? mo->localskin : mo->skin))-(skinlocal ? localskins : skins);
@@ -9636,11 +9628,28 @@ static void K_drawKartMinimapHead(mobj_t *mo, INT32 x, INT32 y, INT32 flags)
if (encoremode)
amnumxpos = -amnumxpos;
amxpos = amnumxpos + ((x + (SHORT(minimapinfo.minimap_pic->width)-SHORT((skinlocal ? localfacemmapprefix : facemmapprefix)[skin]->width))/2)<<FRACBITS);
amypos = amnumypos + ((y + (SHORT(minimapinfo.minimap_pic->height)-SHORT((skinlocal ? localfacemmapprefix : facemmapprefix)[skin]->height))/2)<<FRACBITS);
amxpos = amnumxpos + ((x + (SHORT(minimapinfo.minimap_pic->width)-SHORT((skinlocal ? localfacemmapprefix : facemmapprefix)[skin]->width)) / 2)<<FRACBITS);
amypos = amnumypos + ((y + (SHORT(minimapinfo.minimap_pic->height)-SHORT((skinlocal ? localfacemmapprefix : facemmapprefix)[skin]->height)) / 2)<<FRACBITS);
if (cv_showminimapnames.value && mo->player && !(modeattacking || gamestate == GS_TIMEATTACK))
{
const char *player_name = va("%c%s", (mo->color) ? V_GetSkincolorChar(mo->color) : 0, player_names[mo->player - players]);
V_DrawCenteredSmallStringAtFixed(amxpos + (4*FRACUNIT), amypos - (3*FRACUNIT), V_ALLOWLOWERCASE|flags, player_name);
}
// thx wanted reticle for having weird offsets very cool
wntdamxpos = cv_minihead.value ? amxpos + (1<<FRACBITS) : amxpos - (4<<FRACBITS);
wntdamypos = cv_minihead.value ? amypos + (1<<FRACBITS) : amypos - (4<<FRACBITS);
if (cv_minihead.value)
{
amxpos += (SHORT((skinlocal ? localfacemmapprefix : facemmapprefix)[skin]->width) / 4)<<FRACBITS;
amypos += (SHORT((skinlocal ? localfacemmapprefix : facemmapprefix)[skin]->height) / 4)<<FRACBITS;
scale /= 2;
}
if (!mo->color) // 'default' color
V_DrawSciencePatch(amxpos, amypos, flags, ( (skinlocal) ? localfacemmapprefix : facemmapprefix )[skin], FRACUNIT);
V_DrawSciencePatch(amxpos, amypos, flags, ((skinlocal) ? localfacemmapprefix : facemmapprefix)[skin], scale);
else
{
UINT8 *colormap;
@@ -9649,24 +9658,13 @@ static void K_drawKartMinimapHead(mobj_t *mo, INT32 x, INT32 y, INT32 flags)
else
colormap = R_GetLocalTranslationColormap(mo->skin, mo->localskin, mo->color, GTC_CACHE, skinlocal);
if (cv_minihead.value)
V_DrawFixedPatch(amxpos + (2*FRACUNIT), amypos + (2*FRACUNIT), FRACUNIT/2, flags, ((skinlocal) ? localfacemmapprefix : facemmapprefix)[skin], colormap);
else
V_DrawFixedPatch(amxpos, amypos, FRACUNIT, flags, ((skinlocal) ? localfacemmapprefix : facemmapprefix)[skin], colormap);
V_DrawFixedPatch(amxpos, amypos, scale, flags, ((skinlocal) ? localfacemmapprefix : facemmapprefix)[skin], colormap);
if (cv_showminimapnames.value && !(modeattacking || gamestate == GS_TIMEATTACK))
{
const char *player_name = va("%c%s", V_GetSkincolorChar(mo->color), player_names[mo->player - players]);
V_DrawCenteredSmallStringAtFixed(amxpos + (4*FRACUNIT), amypos - (3*FRACUNIT), V_ALLOWLOWERCASE|flags, player_name);
}
if (mo->player
&& ((G_RaceGametype() && mo->player->kartstuff[k_position] == spbplace)
|| (G_BattleGametype() && K_IsPlayerWanted(mo->player))))
{
if (cv_minihead.value)
V_DrawFixedPatch(amxpos, amypos, FRACUNIT/2, flags, kp_wantedreticle, NULL);
else
V_DrawFixedPatch(amxpos - (4<<FRACBITS), amypos - (4<<FRACBITS), FRACUNIT, flags, kp_wantedreticle, NULL);
V_DrawFixedPatch(wntdamxpos, wntdamypos, scale, flags, kp_wantedreticle, NULL);
}
}
}
+47 -87
View File
@@ -591,26 +591,16 @@ static int libd_drawOnMinimap(lua_State *L)
UINT8 *colormap = NULL; // do we want to colormap this patch?
boolean centered; // the patch is centered and doesn't need readjusting on x/y coordinates.
huddrawlist_h list;
// variables used to replicate k_kart's mmap drawer:
INT32 lumpnum;
patch_t *AutomapPic;
INT32 mx, my;
INT32 splitflags, minimaptrans;
patch_t *AutomapPic = NULL;
// base position of the minimap which also takes splits into account:
INT32 MM_X, MM_Y;
// variables used for actually drawing the icon:
INT32 splitflags, minimaptrans;
fixed_t amnumxpos, amnumypos;
INT32 amxpos, amypos;
node_t *bsp = &nodes[numnodes-1];
fixed_t maxx, minx, maxy, miny;
fixed_t mapwidth, mapheight;
fixed_t xoffset, yoffset;
fixed_t xscale, yscale, zoom;
fixed_t amxpos, amypos;
INT32 mm_x, mm_y;
fixed_t patchw, patchh;
HUDONLY // only run this function in hud hooks
@@ -622,8 +612,6 @@ static int libd_drawOnMinimap(lua_State *L)
colormap = *((UINT8 **)luaL_checkudata(L, 5, META_COLORMAP));
centered = lua_optboolean(L, 6);
// replicate exactly what source does for its minimap drawer; AKA hardcoded garbo.
// first, check what position the mmap is supposed to be in (pasted from k_kart.c):
MM_X = BASEVIDWIDTH - 50 + cv_mini_xoffset.value; // 270
MM_Y = (BASEVIDHEIGHT/2)-16 + cv_mini_yoffset.value; // 84
@@ -658,7 +646,6 @@ static int libd_drawOnMinimap(lua_State *L)
else
return 0;
minimaptrans = ((10-minimaptrans)<<FF_TRANSSHIFT);
splitflags |= minimaptrans;
@@ -679,97 +666,70 @@ static int libd_drawOnMinimap(lua_State *L)
if (stplyr != &players[displayplayers[0]])
return 0;
lumpnum = W_CheckNumForName(va("%sR", G_BuildMapName(gamemap)));
AutomapPic = minimapinfo.minimap_pic;
if (lumpnum != -1)
AutomapPic = W_CachePatchName(va("%sR", G_BuildMapName(gamemap)), PU_HUDGFX);
else
if (!AutomapPic)
{
return 0; // no pic, just get outta here
}
mx = MM_X - (AutomapPic->width/2);
my = MM_Y - (AutomapPic->height/2);
// Handle offsets and stuff.
mm_x = MM_X - (SHORT(AutomapPic->width)/2);
mm_y = MM_Y - (SHORT(AutomapPic->height)/2);
// let offsets transfer to the heads, too!
if (encoremode)
mx += SHORT(AutomapPic->leftoffset);
{
mm_x += SHORT(AutomapPic->leftoffset);
}
else
mx -= SHORT(AutomapPic->leftoffset);
my -= SHORT(AutomapPic->topoffset);
{
mm_x -= SHORT(AutomapPic->leftoffset);
}
// now that we have replicated this behavior, we can draw an icon from our supplied x, y coordinates by replicating k_kart.c's totally understandable uncommented code!!!
// get map boundaries using nodes
maxx = maxy = INT32_MAX;
minx = miny = INT32_MIN;
minx = bsp->bbox[0][BOXLEFT];
maxx = bsp->bbox[0][BOXRIGHT];
miny = bsp->bbox[0][BOXBOTTOM];
maxy = bsp->bbox[0][BOXTOP];
if (bsp->bbox[1][BOXLEFT] < minx)
minx = bsp->bbox[1][BOXLEFT];
if (bsp->bbox[1][BOXRIGHT] > maxx)
maxx = bsp->bbox[1][BOXRIGHT];
if (bsp->bbox[1][BOXBOTTOM] < miny)
miny = bsp->bbox[1][BOXBOTTOM];
if (bsp->bbox[1][BOXTOP] > maxy)
maxy = bsp->bbox[1][BOXTOP];
// You might be wondering why these are being bitshift here
// it's because mapwidth and height would otherwise overflow for maps larger than half the size possible...
// map boundaries and sizes will ALWAYS be whole numbers thankfully
// later calculations take into consideration that these are actually not in terms of FRACUNIT though
minx >>= FRACBITS;
maxx >>= FRACBITS;
miny >>= FRACBITS;
maxy >>= FRACBITS;
// these are our final map boundaries:
mapwidth = maxx - minx;
mapheight = maxy - miny;
// These should always be small enough to be bitshift back right now
xoffset = (minx + mapwidth/2)<<FRACBITS;
yoffset = (miny + mapheight/2)<<FRACBITS;
xscale = FixedDiv(AutomapPic->width, mapwidth);
yscale = FixedDiv(AutomapPic->height, mapheight);
zoom = FixedMul(min(xscale, yscale), FRACUNIT-FRACUNIT/20);
amnumxpos = (FixedMul(x, zoom) - FixedMul(xoffset, zoom));
amnumypos = -(FixedMul(y, zoom) - FixedMul(yoffset, zoom));
if (encoremode)
amnumxpos = -amnumxpos;
mm_y -= SHORT(AutomapPic->topoffset);
// scale patch coords
patchw = patch->width*scale /2;
patchh = patch->height*scale /2;
patchw = (SHORT(patch->width) * scale / 2);
patchh = (SHORT(patch->height) * scale / 2);
if (centered)
{
patchw = patchh = 0; // patch is supposedly already centered, don't butt in.
}
amxpos = amnumxpos + ((mx + AutomapPic->width/2)<<FRACBITS) - patchw;
amypos = amnumypos + ((my + AutomapPic->height/2)<<FRACBITS) - patchh;
amnumxpos = (FixedMul(x, minimapinfo.zoom) - minimapinfo.offs_x);
amnumypos = -(FixedMul(y, minimapinfo.zoom) - minimapinfo.offs_y);
if (encoremode)
{
amnumxpos = -amnumxpos;
}
amxpos = amnumxpos + ((mm_x + SHORT(AutomapPic->width) / 2)<<FRACBITS) - patchw;
amypos = amnumypos + ((mm_y + SHORT(AutomapPic->height) / 2)<<FRACBITS) - patchh;
// and NOW we can FINALLY DRAW OUR GOD DAMN PATCH :V
lua_getfield(L, LUA_REGISTRYINDEX, "HUD_DRAW_LIST");
list = (huddrawlist_h) lua_touserdata(L, -1);
lua_pop(L, 1);
if (LUA_HUD_IsDrawListValid(list)){
if (cv_minihead.value)
LUA_HUD_AddDrawScaled(list, amxpos, amypos, scale/2, patch, splitflags, colormap);
else
LUA_HUD_AddDrawScaled(list, amxpos, amypos, scale, patch, splitflags, colormap);
}else{
if (cv_minihead.value)
V_DrawFixedPatch(amxpos, amypos, scale/2, splitflags, patch, colormap);
else
V_DrawFixedPatch(amxpos, amypos, scale, splitflags, patch, colormap);
if (cv_minihead.value)
{
amxpos += patchw / 2;
amypos += patchh / 2;
scale /= 2;
}
if (LUA_HUD_IsDrawListValid(list))
{
LUA_HUD_AddDrawScaled(list, amxpos, amypos, scale, patch, splitflags, colormap);
}
else
{
V_DrawFixedPatch(amxpos, amypos, scale, splitflags, patch, colormap);
}
return 0;
}
@@ -1612,4 +1572,4 @@ void LUAh_VoteHUD(huddrawlist_h list)
lua_pushlightuserdata(gL, NULL);
lua_setfield(gL, LUA_REGISTRYINDEX, "HUD_DRAW_LIST");
}
}
+146 -91
View File
@@ -1160,7 +1160,7 @@ static menuitem_t OP_ControlsMenu[] =
{IT_CALL | IT_STRING, NULL, "Player 3 Controls...", &M_Setup3PControlsMenu, 30},
{IT_CALL | IT_STRING, NULL, "Player 4 Controls...", &M_Setup4PControlsMenu, 40},
{IT_SUBMENU | IT_STRING, NULL, "Mouse Options...", &OP_MouseOptionsDef, 60},
{IT_STRING | IT_CVAR, NULL, "Controls per key", &cv_controlperkey, 80},
@@ -1372,7 +1372,7 @@ static menuitem_t OP_VideoOptionsMenu[] =
{IT_STRING | IT_CVAR | IT_CV_SLIDER,
NULL, "Saturation", &cv_globalsaturation , 40},
{IT_SUBMENU|IT_STRING, NULL, "Advanced Color Settings...", &OP_ColorOptionsDef, 50},
{IT_STRING | IT_CVAR, NULL, "Draw Distance", &cv_drawdist, 65},
@@ -1484,7 +1484,7 @@ static menuitem_t OP_ColorOptionsMenu[] =
static menuitem_t OP_ExpOptionsMenu[] =
{
{IT_HEADER, NULL, "Advanced Video Options", NULL, 10},
{IT_STRING|IT_CVAR, NULL, "Interpolation Distance", &cv_grmaxinterpdist, 30},
{IT_STRING|IT_CVAR, NULL, "Interpolation Distance", &cv_maxinterpdist, 30},
{IT_STRING | IT_CVAR, NULL, "Weather Interpolation", &cv_precipinterp, 40},
{IT_STRING | IT_CVAR, NULL, "Scale Weather with Mobjscale", &cv_mobjscaleprecip, 60},
@@ -1492,13 +1492,15 @@ static menuitem_t OP_ExpOptionsMenu[] =
{IT_STRING | IT_CVAR, NULL, "Skyboxes", &cv_skybox, 80},
#ifdef HWRENDER
{IT_STRING | IT_CVAR, NULL, "Screen Textures", &cv_grscreentextures, 100},
{IT_STRING | IT_CVAR, NULL, "FPS counter sampling", &cv_accuratefps, 90},
#ifdef HWRENDER
{IT_STRING | IT_CVAR, NULL, "Screen Textures", &cv_glscreentextures, 110},
#ifdef USE_FBO_OGL
{IT_STRING | IT_CVAR, NULL, "FBO Downsampling support", &cv_grframebuffer, 110},
{IT_STRING | IT_CVAR, NULL, "FBO Downsampling support", &cv_glframebuffer, 120},
#endif
{IT_STRING | IT_CVAR, NULL, "Palette Depth", &cv_glpalettedepth, 140},
#endif
{IT_STRING | IT_CVAR, NULL, "Palette Depth", &cv_grpalettedepth, 130},
#endif
};
static const char* OP_ExpTooltips[] =
@@ -1509,6 +1511,7 @@ static const char* OP_ExpTooltips[] =
"Should weather be scaled with Mapobjectscale?.",
"When weather is on this will cut the object amount used in half.",
"Toggle being able to see the sky.",
"Change the FPS counter sampling method\nInaccurate updates slower and might miss frame drops and such\nAccurate updates faster and is more accurate, but might be less readable", // how to ingles??
#ifdef HWRENDER
"Should the game do Screen Textures? Provides a good boost to frames\nat the cost of some visual effects not working when disabled.",
#ifdef USE_FBO_OGL
@@ -1526,8 +1529,9 @@ enum
op_exp_precipmoscale,
op_exp_lessprecip,
op_exp_skybox,
op_exp_accuratefps,
#ifdef HWRENDER
op_exp_grscrtx,
op_exp_glscrtx,
#ifdef USE_FBO_OGL
op_exp_fbo,
#endif
@@ -1539,24 +1543,24 @@ enum
#ifdef HWRENDER
static menuitem_t OP_OpenGLOptionsMenu[] =
{
{IT_STRING | IT_CVAR, NULL, "3D Models", &cv_grmdls, 15},
{IT_STRING | IT_CVAR, NULL, "Fallback Player 3D Model", &cv_grfallbackplayermodel, 20},
{IT_STRING | IT_CVAR, NULL, "Shaders", &cv_grshaders, 25},
{IT_STRING | IT_CVAR, NULL, "Palette Rendering", &cv_grpaletterendering, 30},
{IT_STRING | IT_CVAR, NULL, "Flashpals in Palette Renderer", &cv_grflashpal, 35},
{IT_STRING | IT_CVAR, NULL, "Min Shader Brightness", &cv_secbright, 40},
{IT_STRING | IT_CVAR, NULL, "3D Models", &cv_glmdls, 15},
{IT_STRING | IT_CVAR, NULL, "Fallback Player 3D Model", &cv_glfallbackplayermodel, 20},
{IT_STRING | IT_CVAR, NULL, "Shaders", &cv_glshaders, 25},
{IT_STRING | IT_CVAR, NULL, "Palette Rendering", &cv_glpaletterendering, 30},
{IT_STRING | IT_CVAR, NULL, "Palette Rendering Flashpals",&cv_glflashpal, 35},
{IT_STRING | IT_CVAR, NULL, "Min Shader Brightness", &cv_glsecbright, 40},
{IT_STRING|IT_CVAR, NULL, "Texture Quality", &cv_scr_depth, 50},
{IT_STRING|IT_CVAR, NULL, "Texture Filter", &cv_grfiltermode, 55},
{IT_STRING|IT_CVAR, NULL, "Anisotropic", &cv_granisotropicmode, 60},
{IT_STRING|IT_CVAR, NULL, "Visual Portals", &cv_grportals, 65},
{IT_STRING | IT_CVAR, NULL, "Texture Quality", &cv_scr_depth, 50},
{IT_STRING | IT_CVAR, NULL, "Texture Filter", &cv_glfiltermode, 55},
{IT_STRING | IT_CVAR, NULL, "Anisotropic", &cv_glanisotropicmode, 60},
{IT_STRING | IT_CVAR, NULL, "Visual Portals", &cv_glportals, 65},
{IT_STRING|IT_CVAR, NULL, "Wall Contrast Style", &cv_grfakecontrast, 75},
{IT_STRING|IT_CVAR, NULL, "Slope Contrast", &cv_grslopecontrast, 80},
{IT_STRING | IT_CVAR, NULL, "Dithered Lightning", &cv_lightdither, 85},
{IT_STRING|IT_CVAR, NULL, "Sprite Billboarding", &cv_grspritebillboarding, 90},
{IT_STRING|IT_CVAR, NULL, "Software Perspective", &cv_grshearing, 95},
{IT_STRING|IT_CVAR, NULL, "Rendering Distance", &cv_grrenderdistance, 100},
{IT_STRING | IT_CVAR, NULL, "Wall Contrast Style", &cv_glfakecontrast, 75},
{IT_STRING | IT_CVAR, NULL, "Slope Contrast", &cv_glslopecontrast, 80},
{IT_STRING | IT_CVAR, NULL, "Dithered Lightning", &cv_gllightdither, 85},
{IT_STRING | IT_CVAR, NULL, "Sprite Billboarding", &cv_glspritebillboarding, 90},
{IT_STRING | IT_CVAR, NULL, "Software Perspective", &cv_glshearing, 95},
{IT_STRING | IT_CVAR, NULL, "Rendering Distance", &cv_glrenderdistance, 100},
};
static const char* OP_OpenGLTooltips[] =
@@ -1573,11 +1577,32 @@ static const char* OP_OpenGLTooltips[] =
"Recreates an effect from software mode that is used on some maps.",
"The look of the wall contrast effect.",
"Wall contrast but for slopes.",
"Should OpenGL lightning be dithered?",
"Should shader lightning be dithered?",
"Should sprites always face the camera?",
"Recreates the look of software mode camera perspective.",
"How far the game world should be drawn.",
};
enum
{
op_gl_mdls,
op_gl_falbckmdls,
op_gl_shader,
op_gl_palrender,
op_gl_flashpal,
op_gl_secbright,
op_gl_scrdepth,
op_gl_filter,
op_gl_anis,
op_gl_portal,
op_gl_wallcont,
op_gl_slopecont,
op_gl_lightdither,
op_gl_bill,
op_gl_shearing,
op_gl_renderdist,
};
#endif
static menuitem_t OP_SoundOptionsMenu[] =
@@ -1604,7 +1629,7 @@ static menuitem_t OP_SoundOptionsMenu[] =
{IT_STRING|IT_CVAR, NULL, "Character voices", &cv_kartvoices, 75},
{IT_STRING|IT_CVAR, NULL, "Hit Em Delay", &cv_karthitemdialog, 85},
{IT_STRING|IT_CVAR, NULL, "Powerup Warning", &cv_kartinvinsfx, 95},
{IT_KEYHANDLER|IT_STRING, NULL, "Sound Test", M_HandleSoundTest, 105},
{IT_STRING|IT_CALL, NULL, "Music Test", M_MusicTest, 115},
@@ -1618,7 +1643,7 @@ static menuitem_t OP_SoundOptionsMenu[] =
{IT_STRING|IT_CVAR, NULL, "Character voices", &cv_kartvoices, 85},
{IT_STRING|IT_CVAR, NULL, "Hit Em Delay", &cv_karthitemdialog, 95},
{IT_STRING|IT_CVAR, NULL, "Powerup Warning", &cv_kartinvinsfx, 105},
{IT_KEYHANDLER|IT_STRING, NULL, "Sound Test", M_HandleSoundTest, 115},
{IT_STRING|IT_CALL, NULL, "Music Test", M_MusicTest, 125},
@@ -1679,7 +1704,7 @@ static const char* OP_SoundAdvancedTooltips[] =
{
#ifdef HAVE_OPENMPT
NULL,
"Filter used to resample tracker instruments.",
"Resample tracker modules to sound similar to Paula hardware.",
#if OPENMPT_API_VERSION_MAJOR < 1 && OPENMPT_API_VERSION_MINOR > 4
@@ -1792,7 +1817,7 @@ static menuitem_t OP_HUDOptionsMenu[] =
{
{IT_STRING | IT_CVAR, NULL, "Show HUD (F3)", &cv_showhud, 10},
{IT_STRING | IT_CVAR | IT_CV_SLIDER,
NULL, "HUD Visibility", &cv_translucenthud, 20},
NULL, "HUD Visibility", &cv_translucenthud, 20},
{IT_STRING | IT_SUBMENU, NULL, "Online HUD options...", &OP_ChatOptionsDef, 35},
{IT_STRING | IT_CVAR, NULL, "Background Glass", &cons_backcolor, 45},
@@ -1808,9 +1833,9 @@ static menuitem_t OP_HUDOptionsMenu[] =
{IT_STRING | IT_CVAR, NULL, "Console Text Size", &cv_constextsize, 120},
{IT_STRING | IT_CVAR, NULL, "Show Track Addon Name", &cv_showtrackaddon, 135},
{IT_STRING | IT_CVAR, NULL, "Show All Maps", &cv_showallmaps, 145},
{IT_STRING | IT_CVAR, NULL, "Show \"FOCUS LOST\"", &cv_showfocuslost, 155},
{IT_STRING | IT_CVAR, NULL, "2D character select", &cv_skinselectmenu, 165},
@@ -2062,7 +2087,7 @@ static menuitem_t OP_AdvServerOptionsMenu[] =
};
static const char* OP_AdvServerOptionsTooltips[] =
{
{
"Server used for master server.",
"Attempts to resynchronise player to server.",
#ifdef SATURNSYNCH
@@ -2326,7 +2351,6 @@ enum
sh_hudoffsets,
};
static menuitem_t OP_HudOffsetMenu[] =
{
{IT_HEADER, NULL, "Kart Hud Offsets", NULL, 0},
@@ -2380,7 +2404,7 @@ static menuitem_t OP_SaturnCreditsMenu[] =
{IT_STRING2+IT_SPACE, NULL, "xyzzy", NULL, 70},
{IT_STRING2+IT_SPACE, NULL, "Chearii", NULL, 80},
{IT_STRING+IT_SPACE, NULL, "", NULL, 83}, // dummy text
{IT_STRING+IT_SPACE, NULL, "", NULL, 83}, // dummy text
{IT_STRING2+IT_SPACE, NULL, "Sunflower aka AnimeSonic", NULL, 90},
{IT_STRING2+IT_SPACE, NULL, "Yuz aka Yuzler", NULL, 100},
@@ -3388,7 +3412,7 @@ void PDistort_menu_Onchange(void)
OP_PlayerDistortMenu[slrotatedist].status = IT_STRING | IT_CVAR;
else
OP_PlayerDistortMenu[slrotatedist].status = IT_GRAYEDOUT;
if ((cv_sloperoll.value == 2) && (cv_spriteroll.value)) //enable/disable sparkroll depending on which setting
OP_PlayerDistortMenu[sparkrotate].status = IT_STRING | IT_CVAR;
else
@@ -3417,7 +3441,7 @@ void Bird_menu_Onchange(void)
OP_AdvancedBirdMenu[fadegrow].status = status;
OP_AdvancedBirdMenu[respawnfadeout].status = status;
OP_AdvancedBirdMenu[respawnfadein].status = status;
if (cv_birdmusic.value)
{
OP_BirdMenu[lvlresum].status = IT_STRING | IT_CVAR;
@@ -3429,7 +3453,7 @@ void Bird_menu_Onchange(void)
OP_BirdMenu[lvlresum].status = IT_GRAYEDOUT;
OP_BirdMenu[spclresum].status = IT_GRAYEDOUT;
OP_BirdMenu[advmusic].status = IT_GRAYEDOUT;
}
}
}
//menu code is nice
@@ -3441,11 +3465,30 @@ void SaturnHud_menu_Onchange(void)
status = IT_STRING | IT_CVAR;
else
status = IT_GRAYEDOUT;
OP_SaturnHudMenu[sh_coloritem].status = status;
OP_SaturnHudMenu[sh_colorhud_customcolor].status = status;
}
#ifdef HWRENDER
void M_UpdateOGLMenu(void)
{
#ifdef USE_FBO_OGL
OP_ExpOptionsMenu[op_exp_fbo].status = (!supportFBO || cv_glscreentextures.value != 2) ? IT_GRAYEDOUT : IT_STRING | IT_CVAR;
#endif
OP_ExpOptionsMenu[op_exp_paldepth].status = (!HWR_ShouldUsePaletteRendering()) ? IT_GRAYEDOUT : IT_STRING | IT_CVAR;
OP_OpenGLOptionsMenu[op_gl_falbckmdls].status = (!cv_glmdls.value) ? IT_GRAYEDOUT : IT_STRING | IT_CVAR;
OP_OpenGLOptionsMenu[op_gl_lightdither].status = (!HWR_UseShader()) ? IT_GRAYEDOUT : IT_STRING | IT_CVAR;
OP_OpenGLOptionsMenu[op_gl_secbright].status = (!HWR_UseShader()) ? IT_GRAYEDOUT : IT_STRING | IT_CVAR;
OP_OpenGLOptionsMenu[op_gl_palrender].status = (cv_glscreentextures.value != 2 || !HWR_UseShader()) ? IT_GRAYEDOUT : IT_STRING | IT_CVAR;
OP_OpenGLOptionsMenu[op_gl_flashpal].status = (!HWR_ShouldUsePaletteRendering()) ? IT_GRAYEDOUT : IT_STRING | IT_CVAR;
}
#endif
// ==========================================================================
// END ORGANIZATION STUFF.
// ==========================================================================
@@ -4316,9 +4359,9 @@ void M_Drawer(void)
#ifdef HWRENDER
if (rendermode == render_opengl)
V_DrawThinString(0, 0, V_GREENMAP|V_SNAPTOTOP|V_SNAPTOLEFT|V_TRANSLUCENT|V_ALLOWLOWERCASE, ("Opengl"));
#endif
#endif
if (rendermode == render_soft)
V_DrawThinString(0, 0, V_REDMAP|V_SNAPTOTOP|V_SNAPTOLEFT|V_TRANSLUCENT|V_ALLOWLOWERCASE, ("Software"));
V_DrawThinString(0, 0, V_REDMAP|V_SNAPTOTOP|V_SNAPTOLEFT|V_TRANSLUCENT|V_ALLOWLOWERCASE, ("Software"));
}
}
}
@@ -4409,18 +4452,18 @@ void M_StartControlPanel(void)
MPauseMenu[mpause_psetup].status = IT_DISABLED;
MISC_ChangeTeamMenu[0].status = IT_DISABLED;
MISC_ChangeSpectateMenu[0].status = IT_DISABLED;
MPauseMenu[mpause_addlocalskins].status = IT_STRING | IT_CALL;
MPauseMenu[mpause_localskin].status = IT_STRING | IT_CALL;
// Reset these in case splitscreen messes things up
MPauseMenu[mpause_addons].alphaKey = 8;
if (IsPlayerAdmin(consoleplayer))
MPauseMenu[mpause_addlocalskins].alphaKey = 16;
else
MPauseMenu[mpause_addlocalskins].alphaKey = 24;
MPauseMenu[mpause_scramble].alphaKey = 8;
MPauseMenu[mpause_switchmap].alphaKey = 24;
@@ -4441,17 +4484,17 @@ void M_StartControlPanel(void)
if (G_GametypeHasTeams())
MPauseMenu[mpause_scramble].status = IT_STRING | IT_SUBMENU;
}
if (server || (!cv_showlocalskinmenus.value))
{
MPauseMenu[mpause_addlocalskins].status = IT_DISABLED;
MPauseMenu[mpause_localskin].status = IT_DISABLED;
MPauseMenu[mpause_options].alphaKey = 64;
MPauseMenu[mpause_title].alphaKey = 80;
MPauseMenu[mpause_quit].alphaKey = 88;
}
if (splitscreen)
{
@@ -4716,10 +4759,12 @@ void M_Init(void)
if (rendermode == render_soft)
{
OP_VideoOptionsMenu[op_video_ogl].status = IT_DISABLED;
OP_ExpOptionsMenu[op_exp_grscrtx].status = IT_DISABLED;
OP_ExpOptionsMenu[op_exp_glscrtx].status = IT_DISABLED;
#ifdef USE_FBO_OGL
OP_ExpOptionsMenu[op_exp_fbo].status = IT_DISABLED;
#endif
OP_ExpOptionsMenu[op_exp_paldepth].status = IT_DISABLED;
}
if (rendermode == render_opengl)
@@ -4728,15 +4773,25 @@ void M_Init(void)
if (!supportFBO)
OP_ExpOptionsMenu[op_exp_fbo].status = IT_GRAYEDOUT;
#endif
if (!gl_shadersavailable)
{
OP_OpenGLOptionsMenu[op_gl_shader].status = IT_GRAYEDOUT;
OP_OpenGLOptionsMenu[op_gl_lightdither].status = IT_GRAYEDOUT;
OP_OpenGLOptionsMenu[op_gl_secbright].status = IT_GRAYEDOUT;
OP_OpenGLOptionsMenu[op_gl_palrender].status = IT_GRAYEDOUT;
OP_OpenGLOptionsMenu[op_gl_flashpal].status = IT_GRAYEDOUT;
OP_ExpOptionsMenu[op_exp_paldepth].status = IT_GRAYEDOUT;
}
}
#endif
if (!xtra_speedo && !kartzspeedo && !achi_speedo) // why bother?
OP_SaturnHudMenu[sh_speedometer].status = IT_GRAYEDOUT;
//if (!xtra_speedo && kartzspeedo)
//OP_SaturnMenu[sm_speedometer].text = "Speedometer (No Small)";
//if (xtra_speedo && !kartzspeedo)
//OP_SaturnMenu[sm_speedometer].text = "Speedometer (No PMeter)";
// idk i dont wanna bother with this tbh lmao
@@ -5072,7 +5127,7 @@ static void M_DrawSplitText(INT32 x, INT32 y, INT32 option, const char* str, INT
yoffset = (((5*10 - num_lines*10)));
// Draw BG first,,,
for (int i = 0; i < num_lines; i++)
for (int i = 0; i < num_lines; i++)
{
V_DrawFill(0, (y + yoffset - 6)+5, vid.width, 11, 239|V_SNAPTOBOTTOM|V_SNAPTOLEFT);
yoffset += 11;
@@ -5081,7 +5136,7 @@ static void M_DrawSplitText(INT32 x, INT32 y, INT32 option, const char* str, INT
yoffset = (((5*10 - num_lines*10)));
// THEN the text
for (int i = 0; i < num_lines; i++)
for (int i = 0; i < num_lines; i++)
{
V_DrawCenteredThinString(x, y + yoffset, option, clines[i]);
V_DrawCenteredThinString(x, y + yoffset, option|V_YELLOWMAP|((9 - alpha) << V_ALPHASHIFT), clines[i]);
@@ -5097,7 +5152,7 @@ static void M_DrawSplitText(INT32 x, INT32 y, INT32 option, const char* str, INT
static void M_DrawGenericMenu(void)
{
INT32 x, y, w, i, cursory = 0;
INT32 lowercase = !cv_menucaps.value ? V_ALLOWLOWERCASE : 0;
// DRAW MENU
@@ -5313,7 +5368,7 @@ static void M_DrawGenericScrollMenu(void)
// draw title (or big pic)
M_DrawMenuTitle();
INT32 lowercase = !cv_menucaps.value ? V_ALLOWLOWERCASE : 0;
for (; i < max; i++)
@@ -5435,7 +5490,7 @@ static void M_DrawCenteredMenu(void)
// draw title (or big pic)
M_DrawMenuTitle();
INT32 lowercase = !cv_menucaps.value ? V_ALLOWLOWERCASE : 0;
for (i = 0; i < currentMenu->numitems; i++)
@@ -6364,7 +6419,7 @@ static void M_AddonAutoLoad(INT32 ch)
S_StartSound(NULL, sfx_s26d);
return;
}
// first, find the file //
path = va("%s"PATHSEP"%s", srb2home, AUTOLOADCONFIGFILENAME);
autoloadconfigfile = fopen(path, "a");
@@ -6379,7 +6434,7 @@ static void M_AddonAutoLoad(INT32 ch)
case EXT_CFG:
CONS_Printf("Added the \x82%s\x80 console script to the autoload configuration list.\n", dirmenu[dir_on[menudepthleft]]+DIR_STRING);
fprintf(autoloadconfigfile, "%s\n", dirmenu[dir_on[menudepthleft]]+DIR_STRING);
S_StartSound(NULL, sfx_s221);
break;
case EXT_LUA:
@@ -6392,7 +6447,7 @@ static void M_AddonAutoLoad(INT32 ch)
{
CONS_Printf("Added \x82%s\x80 to the autoload configuration list.\n", dirmenu[dir_on[menudepthleft]]+DIR_STRING);
fprintf(autoloadconfigfile, "%s\n", dirmenu[dir_on[menudepthleft]]+DIR_STRING);
S_StartSound(NULL, sfx_s221);
}
else
@@ -6402,7 +6457,7 @@ static void M_AddonAutoLoad(INT32 ch)
}
break;
}
// lastly, do some last things and close the autoload config file //
fclose(autoloadconfigfile);
}
@@ -6606,7 +6661,7 @@ static void M_HandleAddons(INT32 choice)
|| (strcmp(dirmenu[dir_on[menudepthleft]]+DIR_STRING, AUTOLOADCONFIGFILENAME) == 0)
|| (strcmp(dirmenu[dir_on[menudepthleft]]+DIR_STRING, "kartserv.cfg") == 0)
|| (strcmp(dirmenu[dir_on[menudepthleft]]+DIR_STRING, "kartexec.cfg") == 0))
{
{
M_StartMessage(va("%c%s\x80\nYou can't autoload this builds' base console scripts, silly!\n They're already autoloaded on startup! \n\n(Press a key)\n", ('\x80' + (highlightflags>>V_CHARCOLORSHIFT)), dirmenu[dir_on[menudepthleft]]+DIR_STRING),NULL,MM_NOTHING);
S_StartSound(NULL, sfx_s26d);
}
@@ -7877,7 +7932,7 @@ static void M_Options(INT32 choice)
OP_MainMenu[5].status = OP_MainMenu[6].status = (Playing() && !(server || IsPlayerAdmin(consoleplayer))) ? (IT_GRAYEDOUT) : (IT_STRING|IT_SUBMENU);
OP_MainMenu[10].status = (Playing()) ? (IT_GRAYEDOUT) : (IT_STRING|IT_CALL); // Play credits
OP_MainMenu[13].status = (!cv_showlocalskinmenus.value) ? (IT_DISABLED) : (IT_CALL|IT_STRING);
#ifdef HAVE_DISCORDRPC
@@ -8451,14 +8506,14 @@ static void M_DrawMusicTest(void)
if (curplaying && curplaying->authors[0])
V_DrawRightAlignedThinString(BASEVIDWIDTH-16, 46, V_ALLOWLOWERCASE, curplaying->authors);
if (curplaying)
{
if (!curplaying->usage[0])
V_DrawString(vid.dupx, vid.height - 10*vid.dupy, V_NOSCALESTART|V_ALLOWLOWERCASE, va("%.6s", curplaying->name));
else
V_DrawSmallString(vid.dupx, vid.height - 5*vid.dupy, V_NOSCALESTART|V_ALLOWLOWERCASE, va("%.6s - %.255s\n", curplaying->name, curplaying->usage));
if (cv_showmusicfilename.value)
V_DrawSmallString(0, 0, V_SNAPTOTOP|V_SNAPTOLEFT|V_ALLOWLOWERCASE, curplaying->filename);
}
@@ -8604,7 +8659,7 @@ static void M_HandleMusicTest(INT32 choice)
case KEY_ENTER:
S_StopSounds();
S_StopMusic();
curplaying = soundtestdefs[st_sel];
curplaying = soundtestdefs[st_sel];
S_ChangeMusicInternal(curplaying->name, true);
break;
@@ -9469,10 +9524,10 @@ static void M_Connect(INT32 choice)
{
// do not call menuexitfunc
M_ClearMenus(false);
CV_Set(&cv_lastserver, I_GetNodeAddress(serverlist[choice-FIRSTSERVERLINE + serverlistpage * SERVERS_PER_PAGE].node));
COM_BufAddText(va("connect node %d\n", serverlist[choice-FIRSTSERVERLINE + serverlistpage * SERVERS_PER_PAGE].node));
COM_BufAddText(va("connect node %d\n", serverlist[choice-FIRSTSERVERLINE + serverlistpage * SERVERS_PER_PAGE].node));
}
static void M_Refresh(INT32 choice)
@@ -9718,7 +9773,7 @@ void M_SortServerList(void)
#ifndef NONET
#ifdef UPDATE_ALERT
#ifdef MASTERSERVER
#ifdef MASTERSERVER
static void M_CheckMODVersion(int id)
{
char updatestring[500];
@@ -9993,9 +10048,9 @@ static void M_DrawLevelSelectOnly(boolean leftfade, boolean rightfade)
const char *item2 = gamecontrol[gc_fire][1] != 0 ? G_KeynumToString(gamecontrol[gc_fire][1]) : NULL;
if (item1 != NULL && item2 != NULL)
snprintf(encoretoggle, 32, "%s/%s: Toggle Encore", item1, item2);
snprintf(encoretoggle, 32, "%s/%s - Toggle Encore", item1, item2);
else
snprintf(encoretoggle, 32, "%s: Toggle Encore", item1 != NULL ? item1 : item2 != NULL ? item2 : "Item");
snprintf(encoretoggle, 32, "%s - Toggle Encore", item1 != NULL ? item1 : item2 != NULL ? item2 : "Item");
V_DrawThinString(1, BASEVIDHEIGHT-8-1, V_SNAPTOLEFT|V_SNAPTOBOTTOM|V_TRANSLUCENT|V_ALLOWLOWERCASE, encoretoggle);
}
@@ -10218,7 +10273,7 @@ static void M_DrawMPMainMenu(void)
// use generic drawer for cursor, items and title
M_DrawGenericMenu();
INT32 lowercase = !cv_menucaps.value ? V_ALLOWLOWERCASE : 0;
#ifndef NONET
@@ -10425,7 +10480,7 @@ static void M_ConnectLastServer(INT32 choice)
}
M_ClearMenus(true);
COM_BufAddText(va("connect \"%s\"\n", cv_lastserver.string));
COM_BufAddText(va("connect \"%s\"\n", cv_lastserver.string));
}
// Tails 11-19-2002
@@ -10596,11 +10651,11 @@ static void M_DrawSetupMultiPlayerMenu(void)
statoffset = 0;
tw = V_StringWidth("Character", 0);//V_StringWidth(GETSELECTEDSKINNAME, 0);
st = V_StringWidth(GETSELECTEDSKINNAME, 0);
INT32 selectedskin = (itemOn == 1 && setupm_skinselect < numskins ? skinsorted[setupm_skinselect] : setupm_fakeskin);
speed = skins[selectedskin].kartspeed;
weight = skins[selectedskin].kartweight;
weight = skins[selectedskin].kartweight;
V_DrawString((mx+(tw/2)) - (st/2), my + 37,
((MP_PlayerSetupMenu[2].status & IT_TYPE) == IT_SPACE ? V_TRANSLUCENT : 0) | highlightflags | V_ALLOWLOWERCASE,
GETSELECTEDSKINNAME);
@@ -10608,7 +10663,7 @@ static void M_DrawSetupMultiPlayerMenu(void)
statoffset = 50;
else
statoffset = 113;
V_DrawString(statx - statoffset, staty - 10, V_6WIDTHSPACE, va("\x84%dS \x87%dW", GETSELECTEDSPEED, GETSELECTEDWEIGHT));
#undef GETSELECTEDSKINNAME
#undef GETSELECTEDSPEED
@@ -10673,7 +10728,7 @@ static void M_DrawSetupMultiPlayerMenu(void)
V_DrawCharacter(mx + 2 + st + (skullAnimCounter/5), my + 164,
'\x1D' | highlightflags, false); // right arrow
}
break;
break;
case SKINMENUTYPE_GRID:
case SKINMENUTYPE_2D:
V_DrawString(mx, my + 152, highlightflags | V_ALLOWLOWERCASE, KartColor_Names[setupm_fakecolor]); // SRB2kart
@@ -10717,8 +10772,8 @@ static void M_DrawSetupMultiPlayerMenu(void)
{
//Background
V_DrawScaledPatch(statx - 50, staty + 4, 0, W_CachePatchName("K_STATNB", PU_CACHE));
//Speed
//Speed
for (i = 0; i < GETSELECTEDSPEED; i++) // draw the stat bars
{
if (i == 0)
@@ -10728,11 +10783,11 @@ static void M_DrawSetupMultiPlayerMenu(void)
else
V_DrawScaledPatch(statx - 45, staty + 63 -(5 *i), 0, W_CachePatchName("K_STATN2", PU_CACHE));
}
//Weight
for (i = 0; i < GETSELECTEDWEIGHT; i++) // draw the stat bars
{
if (i == 0)
V_DrawScaledPatch(statx - 30, staty + 63, 0, W_CachePatchName("K_STATN4", PU_CACHE));
else if (i == GETSELECTEDWEIGHT -1)
@@ -11008,10 +11063,10 @@ static void M_DrawSetupMultiPlayerMenu(void)
#define indexwidth 8
{
INT32 colwidth = ((BASEVIDWIDTH-(2*mx))-charw)/(2*indexwidth);
if (cv_skinselectmenu.value == SKINMENUTYPE_EXTENDED)
colwidth = colwidth - 10;
INT32 j = -colwidth;
INT16 col = setupm_fakecolor - colwidth;
INT32 x = mx;
@@ -11145,7 +11200,7 @@ static void M_DrawSetupMultiPlayerMenu(void)
frame = 0; // Try to use standing frame
sprframe = &sprdef->spriteframes[frame];
//minenice's speen css, it's a piece of shit but hey
//patch = W_CachePatchNum(sprframe->lumppat[1], PU_CACHE);
speenframe = (I_GetTime()*cv_skinselectspin.value/TICRATE + 1)%8;
@@ -11215,7 +11270,7 @@ static void M_HandleSetupMultiPlayer(INT32 choice)
if (setupm_skinselect < ROUNDSKINSUPTO8 - SKINGRIDWIDTH) //if we arent at the bottom of the menu
{
setupm_skinselect += SKINGRIDWIDTH;
if (cv_skinselectmenu.value == SKINMENUTYPE_GRID){
if (setupm_skinselect >= ((setupm_skinypos-1)+SKINGRIDHEIGHT)*8 && setupm_skinypos < (ROUNDSKINSUPTO8/8)-SKINGRIDHEIGHT)
setupm_skinypos++;
@@ -11288,9 +11343,9 @@ static void M_HandleSetupMultiPlayer(INT32 choice)
else if (cv_skinselectmenu.value == SKINMENUTYPE_EXTENDED){
setupm_skinypos = (((numskins / SKINGRIDWIDTH) - (SKINGRIDHEIGHT-1)-2) > 0 ? ((numskins / SKINGRIDWIDTH) - (SKINGRIDHEIGHT-1)-2) : 0);
M_PrevOpt();
}
}
else
M_PrevOpt();
@@ -11751,7 +11806,7 @@ static boolean M_QuitMultiPlayerMenu(void)
}
// you know what? always putting these in the buffer won't hurt anything.
COM_BufAddText (va("%s \"%s\"\n",setupm_cvskin->name,skins[setupm_fakeskin].name));
COM_BufAddText (va("%s %d\n",setupm_cvcolor->name,setupm_fakecolor));
COM_BufAddText (va("%s %d\n",setupm_cvcolor->name,setupm_fakecolor));
return true;
}
@@ -12576,7 +12631,7 @@ static void M_VideoModeMenu(INT32 choice)
static void M_DrawVideoMenu(void)
{
M_DrawGenericMenu();
INT32 lowercase = !cv_menucaps.value ? V_ALLOWLOWERCASE : 0;
V_DrawRightAlignedString(BASEVIDWIDTH - currentMenu->x, currentMenu->y + OP_VideoOptionsMenu[0].alphaKey,
@@ -12669,7 +12724,7 @@ static void M_DrawLocalSkinMenu(void)
else
multi_tics += multi_state->tics * FRACUNIT;
}
// skin 0 is default player sprite
if (R_AnySkinAvailable(cv_fakelocalskin.string) != -1)
{
@@ -12678,7 +12733,7 @@ static void M_DrawLocalSkinMenu(void)
}
else
{
// ATTEMPT TO FIND REAL SKIN
// ATTEMPT TO FIND REAL SKIN
if (R_AnySkinAvailable(cv_skin.string) != -1)
{
sprdef = &allskins[R_AnySkinAvailable(cv_skin.string)].spritedef;
+4
View File
@@ -299,6 +299,10 @@ void Bird_menu_Onchange(void);
// Saturn Hud menu updating
void SaturnHud_menu_Onchange(void);
#ifdef HWRENDER
void M_UpdateOGLMenu(void);
#endif
void M_ReplayHut(INT32 choice);
void M_SetPlaybackMenuPointer(void);
+4 -4
View File
@@ -301,7 +301,7 @@ static boolean PS_IsRowValid(perfstatrow_t *row)
|| (row->flags & PS_SW && rendermode != render_soft)
|| (row->flags & PS_HW && rendermode != render_opengl)
#ifdef HWRENDER
|| (row->flags & PS_BATCHING && !cv_grbatching.value)
|| (row->flags & PS_BATCHING && !cv_glbatching.value)
#endif
);
}
@@ -518,7 +518,7 @@ static void PS_UpdateFrameStats(void)
ps_hw_spritesorttime.value.p +
ps_hw_spritedrawtime.value.p;
if (cv_grbatching.value)
if (cv_glbatching.value)
{
ps_otherrendertime.value.p -=
ps_hw_batchsorttime.value.p +
@@ -547,7 +547,7 @@ static void PS_UpdateFrameStats(void)
PS_UpdateRowHistories(interpolation_rows, true);*/
#ifdef HWRENDER
if (rendermode == render_opengl && cv_grbatching.value)
if (rendermode == render_opengl && cv_glbatching.value)
{
PS_UpdateRowHistories(batchcount_rows, true);
PS_UpdateRowHistories(batchcalls_rows, true);
@@ -760,7 +760,7 @@ static void PS_DrawRenderStats(void)
/*cy = */PS_DrawPerfRows(x, 10, V_BLUEMAP, commoncounter_rows);// + half_row;
#ifdef HWRENDER
if (rendermode == render_opengl && cv_grbatching.value)
if (rendermode == render_opengl && cv_glbatching.value)
{
x = hires ? 200 : 155;
y = PS_DrawPerfRows(x, 10, V_PURPLEMAP, batchcount_rows);
+16 -5
View File
@@ -118,6 +118,15 @@ static void M_TextInputToWordBegin(textinput_t *input, boolean move_sel)
if (move_sel) input->select = input->cursor;
}
static void M_TextInputPaste(textinput_t *input)
{
const char *paste = I_ClipboardPaste();
if (input->select != input->cursor)
M_TextInputDelSelection(input);
if (paste != NULL)
M_TextInputAddString(input, paste);
}
void M_TextInputInit(textinput_t *input, char *buffer, size_t buffer_size)
{
input->buffer = buffer;
@@ -147,6 +156,12 @@ boolean M_TextInputHandle(textinput_t *input, INT32 key)
|| key == KEY_LALT || key == KEY_RALT)
return false;
if (shiftdown && key == KEY_INS)
{
M_TextInputPaste(input);
return true;
}
if ((cv_keyboardlayout.value != 3 && ctrldown) || (cv_keyboardlayout.value == 3 && ctrldown && !altdown))
{
if (key == 'x' || key == 'X')
@@ -168,11 +183,7 @@ boolean M_TextInputHandle(textinput_t *input, INT32 key)
}
else if (key == 'v' || key == 'V')
{
const char *paste = I_ClipboardPaste();
if (input->select != input->cursor)
M_TextInputDelSelection(input);
if (paste != NULL)
M_TextInputAddString(input, paste);
M_TextInputPaste(input);
return true;
}
else if (key == 'w' || key == 'W')
+8 -1
View File
@@ -298,7 +298,14 @@ mobj_t *P_SPMAngle(mobj_t *source, mobjtype_t type, angle_t angle, UINT8 aimtype
#define P_SpawnNameFinder(s,t) P_SPMAngle(s,t,s->angle,true,0)
#endif
void P_ColorTeamMissile(mobj_t *missile, player_t *source);
SINT8 P_MobjFlip(const mobj_t *mobj);
// P_MobjFlip
// Special utility to return +1 or -1 depending on mobj's gravity
FUNCINLINE static ATTRINLINE SINT8 P_MobjFlip(const mobj_t *mobj)
{
return (mobj && mobj->eflags & MFE_VERTICALFLIP) ? -1 : 1;
}
fixed_t P_GetMobjGravity(mobj_t *mo);
FUNCMATH boolean P_WeaponOrPanel(mobjtype_t type);
+24 -43
View File
@@ -91,6 +91,7 @@ FUNCINLINE static ATTRINLINE void P_CycleStateAnimation(mobj_t *mobj)
// var2 determines delay between animation frames
if (!(mobj->frame & FF_ANIMATE) || --mobj->anim_duration != 0)
return;
mobj->anim_duration = (UINT16)mobj->state->var2;
// compare the current sprite frame to the one we started from
@@ -351,18 +352,6 @@ static boolean P_SetPrecipMobjState(precipmobj_t *mobj, statenum_t state)
return true;
}
//
// P_MobjFlip
//
// Special utility to return +1 or -1 depending on mobj's gravity
//
SINT8 P_MobjFlip(const mobj_t *mobj)
{
if (mobj && mobj->eflags & MFE_VERTICALFLIP)
return -1;
return 1;
}
//
// P_WeaponOrPanel
//
@@ -3242,35 +3231,13 @@ void P_DestroyRobots(void)
}
}
// P_CameraThinker
//
// Process the mobj-ish required functions of the camera
boolean P_CameraThinker(player_t *player, camera_t *thiscam, boolean resetcalled)
// the below is chasecam only, if you're curious. check out P_CalcPostImg in p_user.c for first person
static void P_CalcChasePostImg(player_t *player, camera_t *thiscam)
{
boolean itsatwodlevel = false;
boolean flipcam = (player->pflags & PF_FLIPCAM && !(player->pflags & PF_NIGHTSMODE) && player->mo->eflags & MFE_VERTICALFLIP);
const boolean flipcam = (player->pflags & PF_FLIPCAM && !(player->pflags & PF_NIGHTSMODE) && player->mo->eflags & MFE_VERTICALFLIP);
UINT16 postimgflags = 0;
UINT8 i;
// This can happen when joining
if (thiscam->subsector == NULL || thiscam->subsector->sector == NULL)
return true;
if (twodlevel)
itsatwodlevel = true;
else
{
for (i = 0; i <= splitscreen; i++)
{
if (thiscam == &camera[i] && players[displayplayers[i]].mo
&& (players[displayplayers[i]].mo->flags2 & MF2_TWOD))
{
itsatwodlevel = true;
break;
}
}
}
if (encoremode)
postimgflags |= POSTIMG_MIRROR;
if (flipcam)
@@ -3310,6 +3277,18 @@ boolean P_CameraThinker(player_t *player, camera_t *thiscam, boolean resetcalled
players[displayplayers[i]].postimgflags = postimgflags;
break;
}
}
// P_CameraThinker
//
// Process the mobj-ish required functions of the camera
boolean P_CameraThinker(player_t *player, camera_t *thiscam, boolean resetcalled)
{
// This can happen when joining
if (thiscam->subsector == NULL || thiscam->subsector->sector == NULL)
return true;
P_CalcChasePostImg(player, thiscam);
if (thiscam->momx || thiscam->momy)
{
@@ -3337,8 +3316,7 @@ boolean P_CameraThinker(player_t *player, camera_t *thiscam, boolean resetcalled
}
}
if (!itsatwodlevel)
P_CheckCameraPosition(thiscam->x, thiscam->y, thiscam);
P_CheckCameraPosition(thiscam->x, thiscam->y, thiscam);
thiscam->subsector = R_PointInSubsector(thiscam->x, thiscam->y);
thiscam->floorz = tmfloorz;
@@ -3350,7 +3328,7 @@ boolean P_CameraThinker(player_t *player, camera_t *thiscam, boolean resetcalled
thiscam->z += thiscam->momz + player->mo->pmomz;
#ifndef NOCLIPCAM
if (!itsatwodlevel && !(player->pflags & PF_NOCLIP || leveltime < introtime))
if (!(player->pflags & PF_NOCLIP || leveltime < introtime))
{
// clip movement
if (thiscam->z <= thiscam->floorz) // hit the floor
@@ -3393,13 +3371,13 @@ boolean P_CameraThinker(player_t *player, camera_t *thiscam, boolean resetcalled
#endif
}
if (itsatwodlevel
|| (thiscam->ceilingz - thiscam->z < thiscam->height
&& thiscam->ceilingz >= thiscam->z))
if (thiscam->ceilingz - thiscam->z < thiscam->height
&& thiscam->ceilingz >= thiscam->z)
{
thiscam->ceilingz = thiscam->z + thiscam->height;
thiscam->floorz = thiscam->z;
}
return false;
}
@@ -6915,6 +6893,9 @@ void P_MobjThinker(mobj_t *mobj)
// separate thinker
if (mobj->flags & MF_PUSHABLE || (mobj->info->flags & MF_PUSHABLE && mobj->fuse))
{
if (!mobj)
return;
P_MobjCheckWater(mobj);
P_PushableThinker(mobj);
+17 -7
View File
@@ -510,7 +510,7 @@ void P_UpdateSegLightOffset(seg_t *li)
// Loads the SEGS resource from a level.
static void P_LoadRawSegs(UINT8 *data)
{
INT32 linedef, side;
INT32 rawlinedef, rawside;
mapseg_t *ml = (mapseg_t*)data;
seg_t *li = segs;
line_t *ldef;
@@ -530,14 +530,14 @@ static void P_LoadRawSegs(UINT8 *data)
li->angle = (SHORT(ml->angle))<<FRACBITS;
li->offset = (SHORT(ml->offset))<<FRACBITS;
linedef = SHORT(ml->linedef);
ldef = &lines[linedef];
rawlinedef = SHORT(ml->linedef);
ldef = &lines[rawlinedef];
li->linedef = ldef;
li->side = side = SHORT(ml->side);
li->sidedef = &sides[ldef->sidenum[side]];
li->frontsector = sides[ldef->sidenum[side]].sector;
li->side = rawside = SHORT(ml->side);
li->sidedef = &sides[ldef->sidenum[rawside]];
li->frontsector = sides[ldef->sidenum[rawside]].sector;
if (ldef->flags & ML_TWOSIDED)
li->backsector = sides[ldef->sidenum[side^1]].sector;
li->backsector = sides[ldef->sidenum[rawside^1]].sector;
else
li->backsector = 0;
@@ -2494,6 +2494,9 @@ static void P_InitMinimapInfo(void)
fixed_t a;
fixed_t b;
node_t *bsp = &nodes[numnodes-1];
minimapinfo.minimap_pic = NULL;
lumpnum = W_CheckNumForName(va("%sR", G_BuildMapName(gamemap)));
if (lumpnum != -1)
@@ -2505,6 +2508,7 @@ static void P_InitMinimapInfo(void)
minimapinfo.max_x = bsp->bbox[0][BOXRIGHT];
minimapinfo.min_y = bsp->bbox[0][BOXBOTTOM];
minimapinfo.max_y = bsp->bbox[0][BOXTOP];
if (bsp->bbox[1][BOXLEFT] < minimapinfo.min_x)
minimapinfo.min_x = bsp->bbox[1][BOXLEFT];
if (bsp->bbox[1][BOXRIGHT] > minimapinfo.max_x)
@@ -2513,15 +2517,19 @@ static void P_InitMinimapInfo(void)
minimapinfo.min_y = bsp->bbox[1][BOXBOTTOM];
if (bsp->bbox[1][BOXTOP] > minimapinfo.max_y)
minimapinfo.max_y = bsp->bbox[1][BOXTOP];
// You might be wondering why these are being bitshift here
// it's because mapwidth and height would otherwise overflow for maps larger than half the size possible...
// map boundaries and sizes will ALWAYS be whole numbers thankfully
// later calculations take into consideration that these are actually not in terms of FRACUNIT though
minimapinfo.map_w = (minimapinfo.max_x >>= FRACBITS) - (minimapinfo.min_x >>= FRACBITS);
minimapinfo.map_h = (minimapinfo.max_y >>= FRACBITS) - (minimapinfo.min_y >>= FRACBITS);
minimapinfo.minimap_w = minimapinfo.minimap_h = 100;
a = FixedDiv(minimapinfo.minimap_w<<FRACBITS, minimapinfo.map_w<<4);
b = FixedDiv(minimapinfo.minimap_h<<FRACBITS, minimapinfo.map_h<<4);
if (a < b)
{
minimapinfo.minimap_h = FixedMul(a, minimapinfo.map_h)>>(FRACBITS-4);
@@ -2535,8 +2543,10 @@ static void P_InitMinimapInfo(void)
}
minimapinfo.zoom = b;
}
minimapinfo.zoom >>= (FRACBITS-4);
minimapinfo.zoom -= (minimapinfo.zoom/20);
// These should always be small enough to be bitshift back right now
minimapinfo.offs_x = FixedMul((minimapinfo.min_x + minimapinfo.map_w/2) << FRACBITS, minimapinfo.zoom);
minimapinfo.offs_y = FixedMul((minimapinfo.min_y + minimapinfo.map_h/2) << FRACBITS, minimapinfo.zoom);
+2 -1
View File
@@ -2498,7 +2498,7 @@ static void P_MovePlayer(player_t *player)
}
#ifdef HWRENDER
if (rendermode != render_soft && rendermode != render_none && cv_grfovchange.value)
if (rendermode == render_opengl && cv_glfovchange.value)
{
fixed_t speed;
const fixed_t runnyspeed = 20*FRACUNIT;
@@ -4103,6 +4103,7 @@ boolean P_SpectatorJoinGame(player_t *player)
return false;
}
// the below is first person only, if you're curious. check out P_CalcChasePostImg in p_mobj.c for chasecam
static void P_CalcPostImg(player_t *player)
{
sector_t *sector = player->mo->subsector->sector;
+4 -4
View File
@@ -15,6 +15,8 @@
#include "g_game.h"
#include "r_local.h"
#include "r_state.h"
#include "r_portal.h" // Add seg portals
#include "r_splats.h"
#include "p_local.h" // camera
@@ -28,7 +30,6 @@ side_t *sidedef;
line_t *linedef;
sector_t *frontsector;
sector_t *backsector;
portal_pair *g_portal; // is curline a portal seg?
// very ugly realloc() of drawsegs at run-time, I upped it to 512
// instead of 256.. and someone managed to send me a level with
@@ -486,7 +487,7 @@ static void R_AddLine(seg_t *line)
line2 = P_FindSpecialLineFromTag(40, line->linedef->tag, line2);
if (line2 >= 0) // found it!
{
R_AddPortal(line->linedef-lines, line2, x1, x2); // Remember the lines for later rendering
Portal_Add2Lines(line->linedef-lines, line2, x1, x2); // Remember the lines for later rendering
//return; // Don't fill in that space now!
goto clipsolid;
}
@@ -1319,8 +1320,7 @@ void R_RenderBSPNode(INT32 bspnum)
bsp = &nodes[bspnum];
// Decide which side the view point is on.
side = R_PointOnSideRender(viewx, viewy, bsp);
side = R_PointOnSide(viewx, viewy, bsp);
// Recursively divide front space.
R_RenderBSPNode(bsp->children[side]);
+2 -2
View File
@@ -25,7 +25,8 @@ extern side_t *sidedef;
extern line_t *linedef;
extern sector_t *frontsector;
extern sector_t *backsector;
extern portal_pair *g_portal; // is curline a portal seg?
typedef struct portal_s portal_t;
extern portal_t *g_portal; // is curline a portal seg?
// drawsegs are allocated on the fly... see r_segs.c
@@ -41,7 +42,6 @@ void R_ClearClipSegs(void);
void R_PortalClearClipSegs(INT32 start, INT32 end);
void R_ClearDrawSegs(void);
void R_RenderBSPNode(INT32 bspnum);
void R_AddPortal(INT32 line1, INT32 line2, INT32 x1, INT32 x2);
// determines when a given sector shouldn't abide by the encoremap's palette.
// no longer a static since this is used for encore in hw_main.c as well now:
+2 -2
View File
@@ -129,7 +129,7 @@ static void R_SetupFreelook(void)
// (lmps, network and use F12...)
if (rendermode == render_soft
#ifdef HWRENDER
|| cv_grshearing.value
|| cv_glshearing.value
#endif
)
{
@@ -323,7 +323,7 @@ void R_InterpolateMobjState(mobj_t *mobj, fixed_t frac, interpmobjstate_t *out)
out->angle = mobj->resetinterp ? mobj->angle : R_LerpAngle(mobj->old_angle, mobj->angle, frac);
#ifdef HWRENDER
if (cv_grmdls.value)
if (cv_glmdls.value)
{
// pitch roll stuff
out->pitch = mobj->resetinterp ? mobj->pitch : R_LerpAngle(mobj->old_pitch, mobj->pitch, frac);
+39 -126
View File
@@ -31,6 +31,7 @@
#include "p_spec.h" // skyboxmo
#include "z_zone.h"
#include "m_random.h" // quake camera shake
#include "r_portal.h"
#include "doomstat.h" // MAXSPLITSCREENPLAYERS
#include "r_fps.h" // Frame interpolation/uncapped
#include "tables.h"
@@ -66,14 +67,6 @@ boolean skyVisiblePerPlayer[MAXSPLITSCREENPLAYERS]; // saved values of skyVisibl
sector_t *viewsector;
player_t *viewplayer;
// PORTALS!
// You can thank and/or curse JTE for these.
UINT8 portalrender;
sector_t *portalcullsector;
portal_pair *portal_base, *portal_cap;
line_t *portalclipline;
INT32 portalclipstart, portalclipend;
fixed_t rendertimefrac;
fixed_t rendertimefrac_unpaused;
fixed_t renderdeltatics;
@@ -194,7 +187,7 @@ consvar_t cv_drawdist_precip = {"drawdist_precip", "1024", CV_SAVE|CV_CALL|CV_NO
consvar_t cv_lessprecip = {"lessweathereffects", "Off", CV_SAVE|CV_CALL|CV_NOINIT, CV_OnOff, Precipstuff_OnChange, 0, NULL, NULL, 0, 0, NULL};
consvar_t cv_mobjscaleprecip = {"scaleprecipmobjscale", "Off", CV_SAVE|CV_CALL|CV_NOINIT, CV_OnOff, Precipstuff_OnChange, 0, NULL, NULL, 0, 0, NULL};
consvar_t cv_grmaxinterpdist = {"gr_maxinterpdist", "Infinite", CV_SAVE, maxinterpdist_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
consvar_t cv_maxinterpdist = {"maxinterpdist", "Infinite", CV_SAVE, maxinterpdist_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
consvar_t cv_ripplewater = {"waterripples", "On", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL};
@@ -1481,112 +1474,30 @@ void R_SetupFrame(player_t *player, boolean skybox)
R_InterpolateView(R_UsingFrameInterpolation() ? (demo.playback && demo.freecam) ? rendertimefrac_unpaused : rendertimefrac : FRACUNIT, false);
}
#define ANGLED_PORTALS
static void R_PortalFrame(line_t *start, line_t *dest, portal_pair *portal)
static void R_PortalFrame(portal_t *portal)
{
vertex_t dest_c, start_c;
#ifdef ANGLED_PORTALS
// delta angle
angle_t dangle = R_PointToAngle2(0,0,dest->dx,dest->dy) - R_PointToAngle2(start->dx,start->dy,0,0);
#endif
//R_SetupFrame(player, false);
viewx = portal->viewx;
viewy = portal->viewy;
viewz = portal->viewz;
viewangle = portal->viewangle;
// newview->sin = FINESINE(newview->angle>>ANGLETOFINESHIFT);
// newview->cos = FINECOSINE(newview->angle>>ANGLETOFINESHIFT);
// viewsin = FINESINE(viewangle>>ANGLETOFINESHIFT);
// viewcos = FINECOSINE(viewangle>>ANGLETOFINESHIFT);
portalcullsector = dest->frontsector;
viewsector = dest->frontsector;
portalclipline = dest;
portalclipstart = portal->start;
portalclipend = portal->end;
// Offset the portal view by the linedef centers
// looking glass center
start_c.x = (start->v1->x + start->v2->x) / 2;
start_c.y = (start->v1->y + start->v2->y) / 2;
// other side center
dest_c.x = (dest->v1->x + dest->v2->x) / 2;
dest_c.y = (dest->v1->y + dest->v2->y) / 2;
// Heights!
viewz += dest->frontsector->floorheight - start->frontsector->floorheight;
// calculate the difference in position and rotation!
#ifdef ANGLED_PORTALS
if (dangle == 0)
#endif
{ // the entrance goes straight opposite the exit, so we just need to mess with the offset.
viewx += dest_c.x - start_c.x;
viewy += dest_c.y - start_c.y;
return;
}
#ifdef ANGLED_PORTALS
viewangle += dangle;
// newview->sin = FINESINE(newview->angle>>ANGLETOFINESHIFT);
// newview->cos = FINECOSINE(newview->angle>>ANGLETOFINESHIFT);
//CONS_Printf("dangle == %u\n", AngleFixed(dangle)>>FRACBITS);
// ????
if (portal->clipline != -1)
{
fixed_t disttopoint;
angle_t angtopoint;
disttopoint = R_PointToDist2(start_c.x, start_c.y, newview->x, newview->y);
angtopoint = R_PointToAngle2(start_c.x, start_c.y, newview->x, newview->y);
angtopoint += dangle;
viewx = dest_c.x+FixedMul(FINECOSINE(angtopoint>>ANGLETOFINESHIFT), disttopoint);
viewy = dest_c.y+FixedMul(FINESINE(angtopoint>>ANGLETOFINESHIFT), disttopoint);
}
#endif
}
void R_AddPortal(INT32 line1, INT32 line2, INT32 x1, INT32 x2)
{
portal_pair *portal = Z_Malloc(sizeof(portal_pair), PU_LEVEL, NULL);
INT16 *ceilingclipsave = Z_Malloc(sizeof(INT16)*(x2-x1), PU_LEVEL, NULL);
INT16 *floorclipsave = Z_Malloc(sizeof(INT16)*(x2-x1), PU_LEVEL, NULL);
fixed_t *frontscalesave = Z_Malloc(sizeof(fixed_t)*(x2-x1), PU_LEVEL, NULL);
portal->line1 = line1;
portal->line2 = line2;
portal->pass = portalrender+1;
portal->next = NULL;
R_PortalStoreClipValues(x1, x2, ceilingclipsave, floorclipsave, frontscalesave);
portal->ceilingclip = ceilingclipsave;
portal->floorclip = floorclipsave;
portal->frontscale = frontscalesave;
portal->start = x1;
portal->end = x2;
g_portal = portal; // this tells R_StoreWallRange that curline is a portal seg
portal->viewx = viewx;
portal->viewy = viewy;
portal->viewz = viewz;
portal->viewangle = viewangle;
if (!portal_base)
{
portal_base = portal;
portal_cap = portal;
portalclipline = &lines[portal->clipline];
portalcullsector = portalclipline->frontsector;
viewsector = portalclipline->frontsector;
}
else
{
portal_cap->next = portal;
portal_cap = portal;
portalclipline = NULL;
portalcullsector = NULL;
viewsector = R_PointInSubsector(viewx, viewy)->sector;
}
}
@@ -1602,7 +1513,6 @@ void R_AddPortal(INT32 line1, INT32 line2, INT32 x1, INT32 x2)
void R_RenderPlayerView(player_t *player)
{
portal_pair *portal;
const boolean skybox = (skyboxmo[0] && cv_skybox.value);
UINT8 i;
@@ -1639,8 +1549,7 @@ void R_RenderPlayerView(player_t *player)
break;
}
portalrender = 0;
portal_base = portal_cap = NULL;
Portal_InitList();
PS_START_TIMING(ps_skyboxtime);
if (skybox && skyVisible)
@@ -1705,37 +1614,41 @@ void R_RenderPlayerView(player_t *player)
ps_numsprites.value.i = numvisiblesprites;
// PORTAL RENDERING
PS_START_TIMING(ps_sw_portaltime);
for(portal = portal_base; portal; portal = portal_base)
// Portal rendering. Hijacks the BSP traversal.
if (portal_base)
{
// render the portal
CONS_Debug(DBG_RENDER, "Rendering portal from line %d to %d\n", portal->line1, portal->line2);
portalrender = portal->pass;
portal_t *portal;
R_PortalFrame(&lines[portal->line1], &lines[portal->line2], portal);
for (portal = portal_base; portal; portal = portal_base)
{
portalrender = portal->pass; // Recursiveness depth.
R_PortalClearClipSegs(portal->start, portal->end);
R_ClearFFloorClips();
R_PortalRestoreClipValues(portal->start, portal->end, portal->ceilingclip, portal->floorclip, portal->frontscale);
// Apply the viewpoint stored for the portal.
R_PortalFrame(portal);
validcount++;
// Hack in the clipsegs to delimit the starting
// clipping for sprites and possibly other similar
// future items.
R_PortalClearClipSegs(portal->start, portal->end);
R_RenderBSPNode((INT32)numnodes - 1);
R_ClipSprites();
//R_DrawPlanes();
//R_DrawMasked();
// Hack in the top/bottom clip values for the window
// that were previously stored.
Portal_ClipApply(portal);
// okay done. free it.
portalcullsector = NULL; // Just in case...
portal_base = portal->next;
Z_Free(portal->ceilingclip);
Z_Free(portal->floorclip);
Z_Free(portal->frontscale);
Z_Free(portal);
// Render the BSP from the new viewpoint, and clip
// any sprites with the new clipsegs and window.
R_RenderBSPNode((INT32)numnodes - 1);
R_ClipSprites();
Portal_Remove(portal);
validcount++;
}
}
PS_STOP_TIMING(ps_sw_portaltime);
// END PORTAL RENDERING
PS_START_TIMING(ps_sw_planetime);
R_DrawPlanes();
@@ -1847,7 +1760,7 @@ void R_RegisterEngineStuff(void)
CV_RegisterVar(&cv_maxportals);
CV_RegisterVar(&cv_grmaxinterpdist);
CV_RegisterVar(&cv_maxinterpdist);
CV_RegisterVar(&cv_ripplewater);
+1 -28
View File
@@ -74,12 +74,6 @@ extern lighttable_t *zlight[LIGHTLEVELS][MAXLIGHTZ];
// Utility functions.
INT32 R_PointOnSide(fixed_t x, fixed_t y, const node_t *node);
FUNCINLINE static ATTRINLINE PUREFUNC INT32 R_PointOnSideRender(fixed_t x, fixed_t y, const node_t *node)
{
// use cross product to determine side quickly
return (INT64)(y - node->y) * node->dx - (INT64)(x - node->x) * node->dy > 0;
}
FUNCINLINE static ATTRINLINE PUREFUNC INT32 R_PointOnSegSide(fixed_t x, fixed_t y, const seg_t *line)
{
fixed_t lx = line->v1->x;
@@ -107,27 +101,6 @@ subsector_t *R_IsPointInSubsector(fixed_t x, fixed_t y);
boolean R_DoCulling(line_t *cullheight, line_t *viewcullheight, fixed_t vz, fixed_t bottomh, fixed_t toph);
void R_GetRenderBlockMapDimensions(fixed_t drawdist, INT32 *xl, INT32 *xh, INT32 *yl, INT32 *yh);
typedef struct portal_pair
{
INT32 line1;
INT32 line2;
UINT8 pass;
struct portal_pair *next;
fixed_t viewx;
fixed_t viewy;
fixed_t viewz;
angle_t viewangle;
INT32 start;
INT32 end;
INT16 *ceilingclip;
INT16 *floorclip;
fixed_t *frontscale;
} portal_pair;
// Performance stats
extern precise_t ps_prevframetime;// time when previous frame was rendered
extern ps_metric_t ps_rendercalltime;
@@ -163,7 +136,7 @@ extern consvar_t cv_drawdist, cv_drawdist_precip, cv_lessprecip, cv_mobjscalepre
extern consvar_t cv_fov;
extern consvar_t cv_skybox;
extern consvar_t cv_tailspickup;
extern consvar_t cv_grmaxinterpdist;
extern consvar_t cv_maxinterpdist;
extern consvar_t cv_ripplewater;
// Called by startup code.
+5 -5
View File
@@ -775,11 +775,11 @@ static UINT16 GetPatchPixel(patch_t *patch, INT32 x, INT32 y, boolean flip)
#ifdef HWRENDER
static patch_t *R_CreateHardwarePatch(patch_t *patch)
{
GLPatch_t *grPatch = Z_Calloc(sizeof(GLPatch_t), PU_HWRPATCHINFO, NULL);
grPatch->mipmap = Z_Calloc(sizeof(GLMipmap_t), PU_HWRPATCHINFO, NULL);
grPatch->rawpatch = patch;
HWR_MakePatch(patch, grPatch, grPatch->mipmap, false);
return (patch_t *)grPatch;
GLPatch_t *glPatch = Z_Calloc(sizeof(GLPatch_t), PU_HWRPATCHINFO, NULL);
glPatch->mipmap = Z_Calloc(sizeof(GLMipmap_t), PU_HWRPATCHINFO, NULL);
glPatch->rawpatch = patch;
HWR_MakePatch(patch, glPatch, glPatch->mipmap, false);
return (patch_t *)glPatch;
}
#endif
+18 -50
View File
@@ -28,6 +28,7 @@
#include "z_zone.h"
#include "p_tick.h"
#include "r_fps.h"
#include "r_portal.h"
//
// opening
@@ -39,12 +40,6 @@
// good night sweet prince
//#define SHITPLANESPARENCY
//SoM: 3/23/2000: Use Boom visplane hashing.
#define VISPLANEHASHBITS 9
#define VISPLANEHASHMASK ((1<<VISPLANEHASHBITS)-1)
// the last visplane list is outside of the hash table and is used for fof planes
#define MAXVISPLANES ((1<<VISPLANEHASHBITS)+1)
static visplane_t *visplanes[MAXVISPLANES];
static visplane_t *freetail;
static visplane_t **freehead = &freetail;
@@ -112,50 +107,6 @@ void R_InitPlanes(void)
// FIXME: unused
}
// R_PortalStoreClipValues
// Saves clipping values for later. -Red
void R_PortalStoreClipValues(INT32 start, INT32 end, INT16 *ceil, INT16 *floor, fixed_t *scale)
{
INT32 i;
for (i = 0; i < end-start; i++)
{
*ceil = ceilingclip[start+i];
ceil++;
*floor = floorclip[start+i];
floor++;
*scale = frontscale[start+i];
scale++;
}
}
// R_PortalRestoreClipValues
// Inverse of the above. Restores the old value!
void R_PortalRestoreClipValues(INT32 start, INT32 end, INT16 *ceil, INT16 *floor, fixed_t *scale)
{
INT32 i;
for (i = 0; i < end-start; i++)
{
ceilingclip[start+i] = *ceil;
ceil++;
floorclip[start+i] = *floor;
floor++;
frontscale[start+i] = *scale;
scale++;
}
// HACKS FOLLOW
for (i = 0; i < start; i++)
{
floorclip[i] = -1;
ceilingclip[i] = (INT16)viewheight;
}
for (i = end; i < vid.width; i++)
{
floorclip[i] = -1;
ceilingclip[i] = (INT16)viewheight;
}
}
//
// Water ripple effect!!
// Needs the height of the plane, and the vertical position of the span.
@@ -307,6 +258,23 @@ void R_MapPlane(INT32 y, INT32 x1, INT32 x2)
spanfunc();
}
void R_ClearFFloorClips (void)
{
INT32 i, p;
// opening / clipping determination
for (i = 0; i < viewwidth; i++)
{
for (p = 0; p < MAXFFLOORS; p++)
{
ffloor[p].f_clip[i] = (INT16)viewheight;
ffloor[p].c_clip[i] = -1;
}
}
numffloors = 0;
}
//
// R_ClearPlanes
// At begining of frame.
+2 -2
View File
@@ -18,6 +18,7 @@
#include "r_data.h"
#include "p_polyobj.h"
//SoM: 3/23/2000: Use Boom visplane hashing.
#define VISPLANEHASHBITS 9
#define VISPLANEHASHMASK ((1<<VISPLANEHASHBITS)-1)
// the last visplane list is outside of the hash table and is used for fof planes
@@ -75,9 +76,8 @@ extern fixed_t *yslope;
extern lighttable_t **planezlight;
void R_InitPlanes(void);
void R_PortalStoreClipValues(INT32 start, INT32 end, INT16 *ceil, INT16 *floor, fixed_t *scale);
void R_PortalRestoreClipValues(INT32 start, INT32 end, INT16 *ceil, INT16 *floor, fixed_t *scale);
void R_ClearPlanes(void);
void R_ClearFFloorClips (void);
void R_MapPlane(INT32 y, INT32 x1, INT32 x2);
void R_MakeSpans(INT32 x, INT32 t1, INT32 b1, INT32 t2, INT32 b2);
+193
View File
@@ -0,0 +1,193 @@
// SONIC ROBO BLAST 2 KART
//-----------------------------------------------------------------------------
// Copyright (C) 2024 by Kart Krew.
// Copyright (C) 2020 by Sonic Team Junior.
// Copyright (C) 2000 by DooM Legacy Team.
// Copyright (C) 1996 by id Software, Inc.
//
// This program is free software distributed under the
// terms of the GNU General Public License, version 2.
// See the 'LICENSE' file for more details.
//-----------------------------------------------------------------------------
/// \file r_portal.c
/// \brief Software renderer portals.
#include "r_portal.h"
#include "r_plane.h"
#include "r_main.h" // viewheight, viewwidth
#include "z_zone.h"
#include "r_things.h"
#include "r_sky.h"
UINT8 portalrender; /**< When rendering a portal, it establishes the depth of the current BSP traversal. */
// Linked list for portals.
portal_t *portal_base, *portal_cap;
line_t *portalclipline;
sector_t *portalcullsector;
INT32 portalclipstart, portalclipend;
portal_t *g_portal; // is curline a portal seg?
void Portal_InitList (void)
{
portalrender = 0;
portal_base = portal_cap = NULL;
}
/** Store the clipping window for a portal in its given range.
*
* The window is copied from the current window at the time
* the function is called, so it is useful for converting one-sided
* lines into portals.
*/
static void Portal_ClipRange (portal_t* portal)
{
INT32 start = portal->start;
INT32 end = portal->end;
INT16 *ceil = portal->ceilingclip;
INT16 *floor = portal->floorclip;
fixed_t *scale = portal->frontscale;
INT32 i;
for (i = 0; i < end-start; i++)
{
*ceil = ceilingclip[start+i];
ceil++;
*floor = floorclip[start+i];
floor++;
*scale = frontscale[start+i];
scale++;
}
}
/** Apply the clipping window from a portal.
*/
void Portal_ClipApply (const portal_t* portal)
{
INT32 i;
INT32 start = portal->start;
INT32 end = portal->end;
INT16 *ceil = portal->ceilingclip;
INT16 *floor = portal->floorclip;
fixed_t *scale = portal->frontscale;
for (i = 0; i < end-start; i++)
{
ceilingclip[start+i] = *ceil;
ceil++;
floorclip[start+i] = *floor;
floor++;
frontscale[start+i] = *scale;
scale++;
}
// HACKS FOLLOW
for (i = 0; i < start; i++)
{
floorclip[i] = -1;
ceilingclip[i] = (INT16)viewheight;
}
for (i = end; i < vid.width; i++)
{
floorclip[i] = -1;
ceilingclip[i] = (INT16)viewheight;
}
}
static portal_t* Portal_Add (const INT16 x1, const INT16 x2)
{
portal_t *portal = Z_Malloc(sizeof(portal_t), PU_LEVEL, NULL);
INT16 *ceilingclipsave = Z_Malloc(sizeof(INT16)*(x2-x1 + 1), PU_LEVEL, NULL);
INT16 *floorclipsave = Z_Malloc(sizeof(INT16)*(x2-x1 + 1), PU_LEVEL, NULL);
fixed_t *frontscalesave = Z_Malloc(sizeof(fixed_t)*(x2-x1 + 1), PU_LEVEL, NULL);
// Linked list.
if (!portal_base)
{
portal_base = portal;
portal_cap = portal;
}
else
{
portal_cap->next = portal;
portal_cap = portal;
}
portal->next = NULL;
// Store clipping values so they can be restored once the portal is rendered.
portal->ceilingclip = ceilingclipsave;
portal->floorclip = floorclipsave;
portal->frontscale = frontscalesave;
portal->start = x1;
portal->end = x2;
// Increase recursion level.
portal->pass = portalrender+1;
return portal;
}
void Portal_Remove (portal_t* portal)
{
portalcullsector = NULL;
portal_base = portal->next;
Z_Free(portal->ceilingclip);
Z_Free(portal->floorclip);
Z_Free(portal->frontscale);
Z_Free(portal);
}
/** Creates a portal out of two lines and a determined screen range.
*
* line1 determines the entrance, and line2 the exit.
* x1 and x2 determine the screen's column bounds.
* The view's offset from the entry line center is obtained,
* and then rotated&translated to the exit line's center.
* When the portal renders, it will create the illusion of
* the two lines being seamed together.
*/
void Portal_Add2Lines (const INT32 line1, const INT32 line2, const INT32 x1, const INT32 x2)
{
portal_t* portal = Portal_Add(x1, x2);
// Offset the portal view by the linedef centers
line_t* start = &lines[line1];
line_t* dest = &lines[line2];
angle_t dangle = R_PointToAngle2(0,0,dest->dx,dest->dy) - R_PointToAngle2(start->dx,start->dy,0,0);
fixed_t disttopoint;
angle_t angtopoint;
vertex_t dest_c, start_c;
// looking glass center
start_c.x = (start->v1->x + start->v2->x) / 2;
start_c.y = (start->v1->y + start->v2->y) / 2;
// other side center
dest_c.x = (dest->v1->x + dest->v2->x) / 2;
dest_c.y = (dest->v1->y + dest->v2->y) / 2;
disttopoint = R_PointToDist2(start_c.x, start_c.y, viewx, viewy);
angtopoint = R_PointToAngle2(start_c.x, start_c.y, viewx, viewy);
angtopoint += dangle;
portal->viewx = dest_c.x + FixedMul(FINECOSINE(angtopoint>>ANGLETOFINESHIFT), disttopoint);
portal->viewy = dest_c.y + FixedMul(FINESINE(angtopoint>>ANGLETOFINESHIFT), disttopoint);
portal->viewz = viewz + dest->frontsector->floorheight - start->frontsector->floorheight;
portal->viewangle = viewangle + dangle;
portal->clipline = line2;
Portal_ClipRange(portal);
g_portal = portal; // this tells R_StoreWallRange that curline is a portal seg
}
+57
View File
@@ -0,0 +1,57 @@
// SONIC ROBO BLAST 2
//-----------------------------------------------------------------------------
// Copyright (C) 1993-1996 by id Software, Inc.
// Copyright (C) 1998-2000 by DooM Legacy Team.
// Copyright (C) 1999-2018 by Sonic Team Junior.
//
// This program is free software distributed under the
// terms of the GNU General Public License, version 2.
// See the 'LICENSE' file for more details.
//-----------------------------------------------------------------------------
/// \file r_portal.h
/// \brief Software renderer portal struct, functions, linked list extern.
#ifndef __R_PORTAL__
#define __R_PORTAL__
#include "r_data.h"
/** Portal structure.
*/
typedef struct portal_s
{
struct portal_s *next;
// Viewport.
fixed_t viewx;
fixed_t viewy;
fixed_t viewz;
angle_t viewangle;
UINT8 pass; /**< Keeps track of the portal's recursion depth. */
INT32 clipline; /**< Optional clipline for line-based portals. */
// Clipping information.
INT32 start; /**< First horizontal pixel coordinate to draw at. */
INT32 end; /**< Last horizontal pixel coordinate to draw at. */
INT16 *ceilingclip; /**< Temporary screen top clipping array. */
INT16 *floorclip; /**< Temporary screen bottom clipping array. */
fixed_t *frontscale;/**< Temporary screen bottom clipping array. */
} portal_t;
extern portal_t* portal_base;
extern portal_t* portal_cap;
extern UINT8 portalrender;
extern line_t *portalclipline;
extern sector_t *portalcullsector;
extern INT32 portalclipstart, portalclipend;
void Portal_InitList (void);
void Portal_Remove (portal_t* portal);
void Portal_Add2Lines (const INT32 line1, const INT32 line2, const INT32 x1, const INT32 x2);
void Portal_ClipApply (const portal_t* portal);
#endif
+1
View File
@@ -15,6 +15,7 @@
#include "r_local.h"
#include "r_sky.h"
#include "r_portal.h"
#include "r_splats.h"
#include "w_wad.h"
-4
View File
@@ -94,10 +94,6 @@ extern boolean viewsky, skyVisible;
extern boolean skyVisiblePerPlayer[MAXSPLITSCREENPLAYERS]; // saved values of skyVisible of each splitscreen player
extern sector_t *viewsector;
extern player_t *viewplayer;
extern UINT8 portalrender;
extern sector_t *portalcullsector;
extern line_t *portalclipline;
extern INT32 portalclipstart, portalclipend;
extern consvar_t cv_allowmlook;
extern consvar_t cv_maxportals;
+7 -6
View File
@@ -31,6 +31,7 @@
#include "dehacked.h" // get_number (for thok)
#include "d_netfil.h" // blargh. for nameonly().
#include "m_cheat.h" // objectplace
#include "r_portal.h"
#include "k_kart.h" // SRB2kart
#include "p_local.h" // stplyr
#ifdef HWRENDER
@@ -1169,14 +1170,14 @@ static void R_ProjectSprite(mobj_t *thing)
INT32 dist = -1;
if (cv_grmaxinterpdist.value)
if (cv_maxinterpdist.value)
dist = R_QuickCamDist(thing->x, thing->y);
// uncapped/interpolation
interpmobjstate_t interp = {0};
// do interpolation
if (R_UsingFrameInterpolation() && !paused && (!cv_grmaxinterpdist.value || dist < cv_grmaxinterpdist.value))
if (R_UsingFrameInterpolation() && !paused && (!cv_maxinterpdist.value || dist < cv_maxinterpdist.value))
{
R_InterpolateMobjState(oldthing, rendertimefrac, &interp);
}
@@ -1738,7 +1739,7 @@ static void R_ProjectPrecipitationSprite(precipmobj_t *thing)
INT32 dist = 1;
if (cv_grmaxinterpdist.value)
if (cv_maxinterpdist.value)
dist = R_QuickCamDist(thing->x, thing->y);
// uncapped/interpolation
@@ -1751,7 +1752,7 @@ static void R_ProjectPrecipitationSprite(precipmobj_t *thing)
}
// do interpolation
if (R_UsingFrameInterpolation() && !paused && (!cv_grmaxinterpdist.value || dist < cv_grmaxinterpdist.value))
if (R_UsingFrameInterpolation() && !paused && (!cv_maxinterpdist.value || dist < cv_maxinterpdist.value))
{
R_InterpolatePrecipMobjState(thing, rendertimefrac, &interp);
}
@@ -3299,12 +3300,12 @@ void R_AddSkins(UINT16 wadnum, boolean local)
// advance by default
lastlump = lump + 1;
if (numskins >= MAXSKINS)
if (!local && numskins >= MAXSKINS)
{
CONS_Alert(CONS_WARNING, M_GetText("Unable to add skin, too many characters are loaded (%d maximum)\n"), MAXSKINS);
continue; // so we know how many skins couldn't be added
}
if (numlocalskins >= MAXLOCALSKINS)
if (local && numlocalskins >= MAXLOCALSKINS)
{
CONS_Alert(CONS_WARNING, M_GetText("Unable to add localskin, too many localskins are loaded (%d maximum)\n"), MAXLOCALSKINS);
continue; // so we know how many skins couldn't be added
+6 -10
View File
@@ -82,7 +82,8 @@ static void SCR_ChangeFullscreen (void);
consvar_t cv_fullscreen = {"fullscreen", "Yes", CV_SAVE|CV_CALL, CV_YesNo, SCR_ChangeFullscreen, 0, NULL, NULL, 0, 0, NULL};
consvar_t cv_accuratefps = {"accuratefpscounter", "Off", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL};
static CV_PossibleValue_t accuratefps_cons_t[] = {{0, "Inaccurate"}, {1, "Accurate"}, {0, NULL}};
consvar_t cv_accuratefps = {"fpssampling", "1", CV_SAVE, accuratefps_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
// =========================================================================
// SCREEN VARIABLES
@@ -354,11 +355,7 @@ void SCR_ChangeFullscreen(void)
boolean SCR_IsAspectCorrect(INT32 width, INT32 height)
{
return
( width % BASEVIDWIDTH == 0
&& height % BASEVIDHEIGHT == 0
&& width / BASEVIDWIDTH == height / BASEVIDHEIGHT
);
return (width % BASEVIDWIDTH == 0 && height % BASEVIDHEIGHT == 0 && width / BASEVIDWIDTH == height / BASEVIDHEIGHT);
}
double averageFPS = 0.0f;
@@ -411,7 +408,6 @@ void SCR_CalculateFPS(void)
if (total_frame_time >= MAX_FRAME_TIME)
{
static int sampleIndex = 0;
int i;
fps_samples[sampleIndex] = frameElapsed;
@@ -420,7 +416,7 @@ void SCR_CalculateFPS(void)
sampleIndex = 0;
averageFPS = 0.0;
for (i = 0; i < NUM_FPS_SAMPLES; i++)
for (int i = 0; i < NUM_FPS_SAMPLES; i++)
{
averageFPS += fps_samples[i];
}
@@ -458,7 +454,7 @@ void SCR_DisplayTicRate(void)
return;
// new kart counter
if ((cv_ticrate.value == 1) || (cv_ticrate.value == 2))
if (cv_ticrate.value == 1 || cv_ticrate.value == 2)
{
// draw "FPS"
if (cv_ticrate.value == 1)
@@ -492,7 +488,7 @@ void SCR_DisplayTicRate(void)
// draw our actual framerate
V_DrawPingNum(x, 190, fpsflags, fps, ticcntcolor);
}
else if ((cv_ticrate.value == 3)||(cv_ticrate.value == 4)) // kart v1.0/srb2 counter
else if (cv_ticrate.value == 3 || cv_ticrate.value == 4) // kart v1.0/srb2 counter
{
if (fps > (benchmark - 5))
ticcntcolor2 = V_GREENMAP;
+6 -3
View File
@@ -758,7 +758,7 @@ static INT32 SDLJoyAxis(const Sint16 axis, evtype_t which)
#ifdef USE_FBO_OGL
void I_DownSample(void)
{
if (!cv_grframebuffer.value || !supportFBO) //no sense to do this crap if we cant benefit from it
if (!cv_glframebuffer.value || !supportFBO) //no sense to do this crap if we cant benefit from it
{
downsample = false;
return;
@@ -781,8 +781,11 @@ void I_DownSample(void)
}
else
{
downsample = false; // its not so no need to do crap
RefreshOGLSDLSurface();
if (downsample == true)
{
downsample = false; // its not so no need to do crap
RefreshOGLSDLSurface();
}
}
}
+26 -19
View File
@@ -68,10 +68,19 @@ PFNglGetIntegerv pglGetIntegerv;
PFNglGetString pglGetString;
#endif
#if defined (__unix__)
#ifdef USE_FBO_OGL
#if defined (__unix__)
static boolean isnvidiagpu = false;
#endif
boolean UseScreenFBO(void)
{
return ((supportFBO && cv_glframebuffer.value && downsample)
#if defined (__unix__)
|| (supportFBO && isnvidiagpu && xwaylandcrap)
#endif
);
}
#endif
/** \brief SDL video display surface
@@ -112,10 +121,11 @@ boolean LoadGL(void)
\return if true, changed video mode
*/
static boolean first_init = false;
boolean OglSdlSurface(INT32 w, INT32 h)
{
INT32 cbpp = cv_scr_depth.value < 16 ? 16 : cv_scr_depth.value;
static boolean first_init = false;
const char *gllogdir = NULL;
oglflags = 0;
@@ -171,7 +181,7 @@ boolean OglSdlSurface(INT32 w, INT32 h)
else
maximumAnisotropy = 1;
granisotropicmode_cons_t[1].value = maximumAnisotropy;
glanisotropicmode_cons_t[1].value = maximumAnisotropy;
#if defined (__unix__)
#ifdef USE_FBO_OGL
@@ -180,7 +190,6 @@ boolean OglSdlSurface(INT32 w, INT32 h)
#endif
#endif
}
first_init = true;
SDL_GL_SetSwapInterval(cv_vidwait.value ? 1 : 0);
@@ -202,21 +211,25 @@ boolean OglSdlSurface(INT32 w, INT32 h)
pglClear(GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT|GL_STENCIL_BUFFER_BIT);
#ifdef USE_FBO_OGL
RenderToFramebuffer = ((FrameBufferEnabled && supportFBO && downsample)
#if defined (__unix__)
|| (isnvidiagpu && xwaylandcrap)
#endif
);
if (RenderToFramebuffer)
if (!supportFBO)
{
if (cv_glframebuffer.value)
CV_SetValue(&cv_glframebuffer, 0);
}
if (UseScreenFBO())
GLFramebuffer_Enable();
else
GLFramebuffer_Disable();
#endif
HWR_Startup();
if (!first_init)
HWR_Startup();
textureformatGL = cbpp > 16 ? GL_RGBA : GL_RGB5_A1;
first_init = true;
return true;
}
@@ -241,20 +254,14 @@ void OglSdlFinishUpdate(boolean waitvbl)
HWR_MakeScreenFinalTexture();
#ifdef USE_FBO_OGL
RenderToFramebuffer = ((FrameBufferEnabled && supportFBO && downsample)
#if defined (__unix__)
|| (isnvidiagpu && xwaylandcrap)
#endif
);
if (RenderToFramebuffer)
if (UseScreenFBO())
GLFramebuffer_Unbind();
#endif
HWR_DrawScreenFinalTexture(sdlw, sdlh);
#ifdef USE_FBO_OGL
if (RenderToFramebuffer)
if (UseScreenFBO())
GLFramebuffer_Enable();
#endif
+28 -4
View File
@@ -15,6 +15,7 @@
#include "doomdef.h"
#include "g_game.h"
#include "g_input.h"
#include "r_local.h"
#include "p_local.h"
#include "f_finale.h"
@@ -773,10 +774,33 @@ static void ST_overlayDrawer(void)
}
else
{
V_DrawString(2, BASEVIDHEIGHT-40, V_SNAPTOBOTTOM|V_SNAPTOLEFT|V_HUDTRANSHALF|V_YELLOWMAP, M_GetText("- SPECTATING -"));
V_DrawString(2, BASEVIDHEIGHT-30, V_SNAPTOBOTTOM|V_SNAPTOLEFT|V_HUDTRANSHALF, itemtxt);
V_DrawString(2, BASEVIDHEIGHT-20, V_SNAPTOBOTTOM|V_SNAPTOLEFT|V_HUDTRANSHALF, M_GetText("Accelerate - Float"));
V_DrawString(2, BASEVIDHEIGHT-10, V_SNAPTOBOTTOM|V_SNAPTOLEFT|V_HUDTRANSHALF, M_GetText("Brake - Sink"));
if (cv_showdirectorhud.value)
{
V_DrawString(2, BASEVIDHEIGHT-50, V_SNAPTOBOTTOM|V_SNAPTOLEFT|V_HUDTRANSHALF|V_YELLOWMAP, M_GetText("- SPECTATING -"));
V_DrawString(2, BASEVIDHEIGHT-40, V_SNAPTOBOTTOM|V_SNAPTOLEFT|V_HUDTRANSHALF, itemtxt);
V_DrawString(2, BASEVIDHEIGHT-30, V_SNAPTOBOTTOM|V_SNAPTOLEFT|V_HUDTRANSHALF, M_GetText("Accelerate - Float"));
V_DrawString(2, BASEVIDHEIGHT-20, V_SNAPTOBOTTOM|V_SNAPTOLEFT|V_HUDTRANSHALF, M_GetText("Brake - Sink"));
char directortoggle[32] = {0};
const char *item1 = gamecontrol[gc_director][0] != 0 ? G_KeynumToString(gamecontrol[gc_director][0]) : NULL;
const char *item2 = gamecontrol[gc_director][1] != 0 ? G_KeynumToString(gamecontrol[gc_director][1]) : NULL;
if (item1 != NULL && item2 != NULL)
snprintf(directortoggle, 32, "%s/%s - Toggle Director", item1, item2);
else
snprintf(directortoggle, 32, "%s - Toggle Director", item1 != NULL ? item1 : item2 != NULL ? item2 : "Not Bound");
V_DrawString(2, BASEVIDHEIGHT-10, V_SNAPTOBOTTOM|V_SNAPTOLEFT|V_HUDTRANSHALF, directortoggle);
directortextactive = true;
}
else
{
V_DrawString(2, BASEVIDHEIGHT-40, V_SNAPTOBOTTOM|V_SNAPTOLEFT|V_HUDTRANSHALF|V_YELLOWMAP, M_GetText("- SPECTATING -"));
V_DrawString(2, BASEVIDHEIGHT-30, V_SNAPTOBOTTOM|V_SNAPTOLEFT|V_HUDTRANSHALF, itemtxt);
V_DrawString(2, BASEVIDHEIGHT-20, V_SNAPTOBOTTOM|V_SNAPTOLEFT|V_HUDTRANSHALF, M_GetText("Accelerate - Float"));
V_DrawString(2, BASEVIDHEIGHT-10, V_SNAPTOBOTTOM|V_SNAPTOLEFT|V_HUDTRANSHALF, M_GetText("Brake - Sink"));
}
}
}
}
+9 -9
View File
@@ -1699,7 +1699,7 @@ void *W_CacheLumpName(const char *name, INT32 tag)
#ifdef HWRENDER
FUNCINLINE static ATTRINLINE void *W_CachePatchNumPwad(UINT16 wad, UINT16 lump, INT32 tag)
{
GLPatch_t *grPatch;
GLPatch_t *glPatch;
if (rendermode == render_soft || rendermode == render_none)
return W_CacheLumpNumPwad(wad, lump, tag);
@@ -1707,29 +1707,29 @@ FUNCINLINE static ATTRINLINE void *W_CachePatchNumPwad(UINT16 wad, UINT16 lump,
if (!TestValidLump(wad, lump))
return NULL;
grPatch = HWR_GetCachedGLPatchPwad(wad, lump);
glPatch = HWR_GetCachedGLPatchPwad(wad, lump);
if (grPatch->mipmap->data)
if (glPatch->mipmap->data)
{
if (tag == PU_CACHE)
tag = PU_HWRCACHE;
Z_ChangeTag(grPatch->mipmap->data, tag);
Z_ChangeTag(glPatch->mipmap->data, tag);
}
else
{
patch_t *ptr = NULL;
// Only load the patch if we haven't initialised the grPatch yet
if (grPatch->mipmap->width == 0)
ptr = W_CacheLumpNumPwad(grPatch->wadnum, grPatch->lumpnum, PU_STATIC);
// Only load the patch if we haven't initialised the glPatch yet
if (glPatch->mipmap->width == 0)
ptr = W_CacheLumpNumPwad(glPatch->wadnum, glPatch->lumpnum, PU_STATIC);
// Run HWR_MakePatch in all cases, to recalculate some things
HWR_MakePatch(ptr, grPatch, grPatch->mipmap, false);
HWR_MakePatch(ptr, glPatch, glPatch->mipmap, false);
Z_Free(ptr);
}
// return GLPatch_t, which can be casted to (patch_t) with valid patch header info
return (void *)grPatch;
return (void *)glPatch;
}
void *W_CachePatchNum(lumpnum_t lumpnum, INT32 tag)
+1 -1
View File
@@ -388,7 +388,7 @@ void Y_IntermissionDrawer(void)
if (cv_betainterscreen.value == 1
#ifdef HWRENDER
|| (rendermode == render_opengl && cv_grscreentextures.value != 2) // use the neato kart bg for intermission on disabled screen textures
|| (rendermode == render_opengl && cv_glscreentextures.value != 2) // use the neato kart bg for intermission on disabled screen textures
#endif
)
V_DrawPatchFill(bgtile); // use the neato kart bg for intermission on disabled screen textures