mirror of
https://git.do.srb2.org/KartKrew/Kart-Public.git
synced 2024-12-28 05:11:34 +00:00
Merge remote-tracking branch '[remote name redacted]/jimita-shaders'
# Conflicts: # src/hardware/hw_main.c
This commit is contained in:
commit
9ecc48d0e4
80 changed files with 2649 additions and 7029 deletions
|
@ -2,7 +2,10 @@ tar-ignore = "assets/*.srb"
|
||||||
tar-ignore = "assets/*.pk3"
|
tar-ignore = "assets/*.pk3"
|
||||||
tar-ignore = "assets/*.dta"
|
tar-ignore = "assets/*.dta"
|
||||||
tar-ignore = "assets/*.wad"
|
tar-ignore = "assets/*.wad"
|
||||||
|
<<<<<<< HEAD:debian-template/source/options
|
||||||
tar-ignore = "assets/*.kart"
|
tar-ignore = "assets/*.kart"
|
||||||
|
=======
|
||||||
|
>>>>>>> e251f9c230beda984cdcdea7e903d765f1c68f6f:debian-template/source/options
|
||||||
tar-ignore = "assets/debian/${PACKAGE_NAME}-data/*"
|
tar-ignore = "assets/debian/${PACKAGE_NAME}-data/*"
|
||||||
tar-ignore = "assets/debian/tmp/*"
|
tar-ignore = "assets/debian/tmp/*"
|
||||||
tar-ignore = "*.obj"
|
tar-ignore = "*.obj"
|
||||||
|
|
16
libs/libgme.props
Normal file
16
libs/libgme.props
Normal file
|
@ -0,0 +1,16 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||||
|
<ImportGroup Label="PropertySheets" />
|
||||||
|
<PropertyGroup Label="UserMacros" />
|
||||||
|
<PropertyGroup Condition="'$(Platform)' == 'Win32' OR '$(Platform)' == 'x64'">
|
||||||
|
<IncludePath>$(SolutionDir)libs\gme\include;$(IncludePath)</IncludePath>
|
||||||
|
<LibraryPath Condition="'$(Platform)' == 'Win32'">$(SolutionDir)libs\gme\win32;$(LibraryPath)</LibraryPath>
|
||||||
|
<LibraryPath Condition="'$(Platform)' == 'x64'">$(SolutionDir)libs\gme\win64;$(LibraryPath)</LibraryPath>
|
||||||
|
</PropertyGroup>
|
||||||
|
<ItemDefinitionGroup Condition="'$(Platform)' == 'Win32' OR '$(Platform)' == 'x64'">
|
||||||
|
<Link>
|
||||||
|
<AdditionalDependencies>libgme.dll.a;%(AdditionalDependencies)</AdditionalDependencies>
|
||||||
|
</Link>
|
||||||
|
</ItemDefinitionGroup>
|
||||||
|
<ItemGroup />
|
||||||
|
</Project>
|
|
@ -414,7 +414,6 @@ if(${SRB2_CONFIG_HWRENDER})
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/hardware/hw_defs.h
|
${CMAKE_CURRENT_SOURCE_DIR}/hardware/hw_defs.h
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/hardware/hw_dll.h
|
${CMAKE_CURRENT_SOURCE_DIR}/hardware/hw_dll.h
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/hardware/hw_drv.h
|
${CMAKE_CURRENT_SOURCE_DIR}/hardware/hw_drv.h
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/hardware/hw_glide.h
|
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/hardware/hw_glob.h
|
${CMAKE_CURRENT_SOURCE_DIR}/hardware/hw_glob.h
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/hardware/hw_light.h
|
${CMAKE_CURRENT_SOURCE_DIR}/hardware/hw_light.h
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/hardware/hw_main.h
|
${CMAKE_CURRENT_SOURCE_DIR}/hardware/hw_main.h
|
||||||
|
|
20
src/Makefile
20
src/Makefile
|
@ -741,8 +741,8 @@ ifdef SDL
|
||||||
ifdef MINGW
|
ifdef MINGW
|
||||||
$(OBJDIR)/r_opengl.o: hardware/r_opengl/r_opengl.c hardware/r_opengl/r_opengl.h \
|
$(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 \
|
doomdef.h doomtype.h g_state.h m_swap.h hardware/hw_drv.h screen.h \
|
||||||
command.h hardware/hw_data.h hardware/hw_glide.h hardware/hw_defs.h \
|
command.h hardware/hw_data.h hardware/hw_defs.h hardware/hw_md2.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_md2load.h hardware/hw_md3load.h hardware/hw_model.h hardware/u_list.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 \
|
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
|
p_mobj.h doomdata.h d_ticcmd.h r_defs.h hardware/hw_dll.h
|
||||||
|
@ -750,8 +750,8 @@ $(OBJDIR)/r_opengl.o: hardware/r_opengl/r_opengl.c hardware/r_opengl/r_opengl.h
|
||||||
else
|
else
|
||||||
$(OBJDIR)/r_opengl.o: hardware/r_opengl/r_opengl.c hardware/r_opengl/r_opengl.h \
|
$(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 \
|
doomdef.h doomtype.h g_state.h m_swap.h hardware/hw_drv.h screen.h \
|
||||||
command.h hardware/hw_data.h hardware/hw_glide.h hardware/hw_defs.h \
|
command.h hardware/hw_data.h hardware/hw_defs.h hardware/hw_md2.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_md2load.h hardware/hw_md3load.h hardware/hw_model.h hardware/u_list.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 \
|
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
|
p_mobj.h doomdata.h d_ticcmd.h r_defs.h hardware/hw_dll.h
|
||||||
|
@ -904,8 +904,8 @@ ifndef SDL
|
||||||
ifndef NOHW
|
ifndef NOHW
|
||||||
$(OBJDIR)/r_opengl.o: hardware/r_opengl/r_opengl.c hardware/r_opengl/r_opengl.h \
|
$(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 \
|
doomdef.h doomtype.h g_state.h m_swap.h hardware/hw_drv.h screen.h \
|
||||||
command.h hardware/hw_data.h hardware/hw_glide.h hardware/hw_defs.h \
|
command.h hardware/hw_data.h hardware/hw_defs.h hardware/hw_md2.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_md2load.h hardware/hw_md3load.h hardware/hw_model.h hardware/u_list.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 \
|
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
|
p_mobj.h doomdata.h d_ticcmd.h r_defs.h hardware/hw_dll.h
|
||||||
|
@ -913,8 +913,8 @@ $(OBJDIR)/r_opengl.o: hardware/r_opengl/r_opengl.c hardware/r_opengl/r_opengl.h
|
||||||
|
|
||||||
$(OBJDIR)/ogl_win.o: hardware/r_opengl/ogl_win.c hardware/r_opengl/r_opengl.h \
|
$(OBJDIR)/ogl_win.o: hardware/r_opengl/ogl_win.c hardware/r_opengl/r_opengl.h \
|
||||||
doomdef.h doomtype.h g_state.h m_swap.h hardware/hw_drv.h screen.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_glide.h hardware/hw_defs.h \
|
command.h hardware/hw_data.h hardware/hw_defs.h hardware/hw_md2.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_md2load.h hardware/hw_md3load.h hardware/hw_model.h hardware/u_list.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 \
|
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
|
p_mobj.h doomdata.h d_ticcmd.h r_defs.h hardware/hw_dll.h
|
||||||
|
@ -922,8 +922,8 @@ $(OBJDIR)/ogl_win.o: hardware/r_opengl/ogl_win.c hardware/r_opengl/r_opengl.h \
|
||||||
|
|
||||||
$(OBJDIR)/r_minigl.o: hardware/r_minigl/r_minigl.c hardware/r_opengl/r_opengl.h \
|
$(OBJDIR)/r_minigl.o: hardware/r_minigl/r_minigl.c hardware/r_opengl/r_opengl.h \
|
||||||
doomdef.h doomtype.h g_state.h m_swap.h hardware/hw_drv.h screen.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_glide.h hardware/hw_defs.h \
|
command.h hardware/hw_data.h hardware/hw_defs.h hardware/hw_md2.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_md2load.h hardware/hw_md3load.h hardware/hw_model.h hardware/u_list.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 \
|
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
|
p_mobj.h doomdata.h d_ticcmd.h r_defs.h hardware/hw_dll.h
|
||||||
|
|
|
@ -532,7 +532,6 @@ static void COM_ExecuteString(char *ptext)
|
||||||
{
|
{
|
||||||
if (!stricmp(com_argv[0], cmd->name)) //case insensitive now that we have lower and uppercase!
|
if (!stricmp(com_argv[0], cmd->name)) //case insensitive now that we have lower and uppercase!
|
||||||
{
|
{
|
||||||
recursion = 0;
|
|
||||||
cmd->function();
|
cmd->function();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -586,8 +585,6 @@ static void COM_ExecuteString(char *ptext)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
recursion = 0;
|
|
||||||
|
|
||||||
// check cvars
|
// check cvars
|
||||||
// Hurdler: added at Ebola's request ;)
|
// 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 gr_xxx command)
|
||||||
|
|
13
src/d_main.c
13
src/d_main.c
|
@ -180,6 +180,7 @@ void D_PostEvent_end(void) {};
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// modifier keys
|
// modifier keys
|
||||||
|
// Now handled in I_OsPolling
|
||||||
UINT8 shiftdown = 0; // 0x1 left, 0x2 right
|
UINT8 shiftdown = 0; // 0x1 left, 0x2 right
|
||||||
UINT8 ctrldown = 0; // 0x1 left, 0x2 right
|
UINT8 ctrldown = 0; // 0x1 left, 0x2 right
|
||||||
UINT8 altdown = 0; // 0x1 left, 0x2 right
|
UINT8 altdown = 0; // 0x1 left, 0x2 right
|
||||||
|
@ -226,9 +227,6 @@ void D_ProcessEvents(void)
|
||||||
{
|
{
|
||||||
ev = &events[eventtail];
|
ev = &events[eventtail];
|
||||||
|
|
||||||
// Set global shift/ctrl/alt down variables
|
|
||||||
D_ModifierKeyResponder(ev); // never eats events
|
|
||||||
|
|
||||||
// Screenshots over everything so that they can be taken anywhere.
|
// Screenshots over everything so that they can be taken anywhere.
|
||||||
if (M_ScreenshotResponder(ev))
|
if (M_ScreenshotResponder(ev))
|
||||||
continue; // ate the event
|
continue; // ate the event
|
||||||
|
@ -1301,6 +1299,15 @@ void D_SRB2Main(void)
|
||||||
CONS_Printf("I_StartupGraphics()...\n");
|
CONS_Printf("I_StartupGraphics()...\n");
|
||||||
I_StartupGraphics();
|
I_StartupGraphics();
|
||||||
|
|
||||||
|
#ifdef HWRENDER
|
||||||
|
if (rendermode == render_opengl)
|
||||||
|
{
|
||||||
|
INT32 i;
|
||||||
|
for (i = 0; i < numwadfiles; i++)
|
||||||
|
HWR_LoadShaders(i, (wadfiles[i]->type == RET_PK3));
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
//--------------------------------------------------------- CONSOLE
|
//--------------------------------------------------------- CONSOLE
|
||||||
// setup loading screen
|
// setup loading screen
|
||||||
SCR_Startup();
|
SCR_Startup();
|
||||||
|
|
174
src/dehacked.c
174
src/dehacked.c
|
@ -42,10 +42,6 @@
|
||||||
#include "r_draw.h" // translation colormap consts (for lua)
|
#include "r_draw.h" // translation colormap consts (for lua)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef HWRENDER
|
|
||||||
#include "hardware/hw_light.h"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef PC_DOS
|
#ifdef PC_DOS
|
||||||
#include <stdio.h> // for snprintf
|
#include <stdio.h> // for snprintf
|
||||||
//int snprintf(char *str, size_t n, const char *fmt, ...);
|
//int snprintf(char *str, size_t n, const char *fmt, ...);
|
||||||
|
@ -335,21 +331,6 @@ static INT32 searchvalue(const char *s)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef HWRENDER
|
|
||||||
static float searchfvalue(const char *s)
|
|
||||||
{
|
|
||||||
while (s[0] != '=' && s[0])
|
|
||||||
s++;
|
|
||||||
if (s[0] == '=')
|
|
||||||
return (float)atof(&s[1]);
|
|
||||||
else
|
|
||||||
{
|
|
||||||
deh_warning("No value found");
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// These are for clearing all of various things
|
// These are for clearing all of various things
|
||||||
static void clear_conditionsets(void)
|
static void clear_conditionsets(void)
|
||||||
{
|
{
|
||||||
|
@ -854,128 +835,6 @@ static void readthing(MYFILE *f, INT32 num)
|
||||||
Z_Free(s);
|
Z_Free(s);
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef HWRENDER
|
|
||||||
static void readlight(MYFILE *f, INT32 num)
|
|
||||||
{
|
|
||||||
char *s = Z_Malloc(MAXLINELEN, PU_STATIC, NULL);
|
|
||||||
char *word;
|
|
||||||
char *tmp;
|
|
||||||
INT32 value;
|
|
||||||
float fvalue;
|
|
||||||
|
|
||||||
do
|
|
||||||
{
|
|
||||||
if (myfgets(s, MAXLINELEN, f))
|
|
||||||
{
|
|
||||||
if (s[0] == '\n')
|
|
||||||
break;
|
|
||||||
|
|
||||||
tmp = strchr(s, '#');
|
|
||||||
if (tmp)
|
|
||||||
*tmp = '\0';
|
|
||||||
if (s == tmp)
|
|
||||||
continue; // Skip comment lines, but don't break.
|
|
||||||
|
|
||||||
fvalue = searchfvalue(s);
|
|
||||||
value = searchvalue(s);
|
|
||||||
|
|
||||||
word = strtok(s, " ");
|
|
||||||
if (word)
|
|
||||||
strupr(word);
|
|
||||||
else
|
|
||||||
break;
|
|
||||||
|
|
||||||
if (fastcmp(word, "TYPE"))
|
|
||||||
{
|
|
||||||
DEH_WriteUndoline(word, va("%d", lspr[num].type), UNDO_NONE);
|
|
||||||
lspr[num].type = (UINT16)value;
|
|
||||||
}
|
|
||||||
else if (fastcmp(word, "OFFSETX"))
|
|
||||||
{
|
|
||||||
DEH_WriteUndoline(word, va("%f", lspr[num].light_xoffset), UNDO_NONE);
|
|
||||||
lspr[num].light_xoffset = fvalue;
|
|
||||||
}
|
|
||||||
else if (fastcmp(word, "OFFSETY"))
|
|
||||||
{
|
|
||||||
DEH_WriteUndoline(word, va("%f", lspr[num].light_yoffset), UNDO_NONE);
|
|
||||||
lspr[num].light_yoffset = fvalue;
|
|
||||||
}
|
|
||||||
else if (fastcmp(word, "CORONACOLOR"))
|
|
||||||
{
|
|
||||||
DEH_WriteUndoline(word, va("%u", lspr[num].corona_color), UNDO_NONE);
|
|
||||||
lspr[num].corona_color = value;
|
|
||||||
}
|
|
||||||
else if (fastcmp(word, "CORONARADIUS"))
|
|
||||||
{
|
|
||||||
DEH_WriteUndoline(word, va("%f", lspr[num].corona_radius), UNDO_NONE);
|
|
||||||
lspr[num].corona_radius = fvalue;
|
|
||||||
}
|
|
||||||
else if (fastcmp(word, "DYNAMICCOLOR"))
|
|
||||||
{
|
|
||||||
DEH_WriteUndoline(word, va("%u", lspr[num].dynamic_color), UNDO_NONE);
|
|
||||||
lspr[num].dynamic_color = value;
|
|
||||||
}
|
|
||||||
else if (fastcmp(word, "DYNAMICRADIUS"))
|
|
||||||
{
|
|
||||||
DEH_WriteUndoline(word, va("%f", lspr[num].dynamic_radius), UNDO_NONE);
|
|
||||||
lspr[num].dynamic_radius = fvalue;
|
|
||||||
|
|
||||||
/// \note Update the sqrradius! unnecessary?
|
|
||||||
lspr[num].dynamic_sqrradius = fvalue * fvalue;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
deh_warning("Light %d: unknown word '%s'", num, word);
|
|
||||||
}
|
|
||||||
} while (!myfeof(f)); // finish when the line is empty
|
|
||||||
|
|
||||||
Z_Free(s);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void readspritelight(MYFILE *f, INT32 num)
|
|
||||||
{
|
|
||||||
char *s = Z_Malloc(MAXLINELEN, PU_STATIC, NULL);
|
|
||||||
char *word;
|
|
||||||
char *tmp;
|
|
||||||
INT32 value;
|
|
||||||
|
|
||||||
do
|
|
||||||
{
|
|
||||||
if (myfgets(s, MAXLINELEN, f))
|
|
||||||
{
|
|
||||||
if (s[0] == '\n')
|
|
||||||
break;
|
|
||||||
|
|
||||||
tmp = strchr(s, '#');
|
|
||||||
if (tmp)
|
|
||||||
*tmp = '\0';
|
|
||||||
if (s == tmp)
|
|
||||||
continue; // Skip comment lines, but don't break.
|
|
||||||
|
|
||||||
value = searchvalue(s);
|
|
||||||
|
|
||||||
word = strtok(s, " ");
|
|
||||||
if (word)
|
|
||||||
strupr(word);
|
|
||||||
else
|
|
||||||
break;
|
|
||||||
|
|
||||||
if (fastcmp(word, "LIGHTTYPE"))
|
|
||||||
{
|
|
||||||
INT32 oldvar;
|
|
||||||
for (oldvar = 0; t_lspr[num] != &lspr[oldvar]; oldvar++)
|
|
||||||
;
|
|
||||||
DEH_WriteUndoline(word, va("%d", oldvar), UNDO_NONE);
|
|
||||||
t_lspr[num] = &lspr[value];
|
|
||||||
}
|
|
||||||
else
|
|
||||||
deh_warning("Sprite %d: unknown word '%s'", num, word);
|
|
||||||
}
|
|
||||||
} while (!myfeof(f)); // finish when the line is empty
|
|
||||||
|
|
||||||
Z_Free(s);
|
|
||||||
}
|
|
||||||
#endif // HWRENDER
|
|
||||||
|
|
||||||
static const struct {
|
static const struct {
|
||||||
const char *name;
|
const char *name;
|
||||||
const UINT16 flag;
|
const UINT16 flag;
|
||||||
|
@ -3513,37 +3372,6 @@ static void DEH_LoadDehackedFile(MYFILE *f, UINT16 wad)
|
||||||
readAnimTex(f, i);
|
readAnimTex(f, i);
|
||||||
// This is not a major mod.
|
// This is not a major mod.
|
||||||
}*/
|
}*/
|
||||||
else if (fastcmp(word, "LIGHT"))
|
|
||||||
{
|
|
||||||
#ifdef HWRENDER
|
|
||||||
// TODO: Read lights by name
|
|
||||||
if (i > 0 && i < NUMLIGHTS)
|
|
||||||
readlight(f, i);
|
|
||||||
else
|
|
||||||
{
|
|
||||||
deh_warning("Light number %d out of range (1 - %d)", i, NUMLIGHTS-1);
|
|
||||||
ignorelines(f);
|
|
||||||
}
|
|
||||||
DEH_WriteUndoline(word, word2, UNDO_HEADER);
|
|
||||||
// This is not a major mod.
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
else if (fastcmp(word, "SPRITE"))
|
|
||||||
{
|
|
||||||
#ifdef HWRENDER
|
|
||||||
if (i == 0 && word2[0] != '0') // If word2 isn't a number
|
|
||||||
i = get_sprite(word2); // find a sprite by name
|
|
||||||
if (i < NUMSPRITES && i >= 0)
|
|
||||||
readspritelight(f, i);
|
|
||||||
else
|
|
||||||
{
|
|
||||||
deh_warning("Sprite number %d out of range (0 - %d)", i, NUMSPRITES-1);
|
|
||||||
ignorelines(f);
|
|
||||||
}
|
|
||||||
DEH_WriteUndoline(word, word2, UNDO_HEADER);
|
|
||||||
// This is not a major mod.
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
else if (fastcmp(word, "LEVEL"))
|
else if (fastcmp(word, "LEVEL"))
|
||||||
{
|
{
|
||||||
// Support using the actual map name,
|
// Support using the actual map name,
|
||||||
|
@ -7391,7 +7219,7 @@ static const char *const MOBJTYPE_LIST[] = { // array length left dynamic for s
|
||||||
|
|
||||||
// Castle Eggman Scenery
|
// Castle Eggman Scenery
|
||||||
"MT_CHAIN", // CEZ Chain
|
"MT_CHAIN", // CEZ Chain
|
||||||
"MT_FLAME", // Flame (has corona)
|
"MT_FLAME", // Flame
|
||||||
"MT_EGGSTATUE", // Eggman Statue
|
"MT_EGGSTATUE", // Eggman Statue
|
||||||
"MT_MACEPOINT", // Mace rotation point
|
"MT_MACEPOINT", // Mace rotation point
|
||||||
"MT_SWINGMACEPOINT", // Mace swinging point
|
"MT_SWINGMACEPOINT", // Mace swinging point
|
||||||
|
|
|
@ -548,6 +548,9 @@ extern INT32 cv_debug;
|
||||||
extern UINT8 shiftdown, ctrldown, altdown;
|
extern UINT8 shiftdown, ctrldown, altdown;
|
||||||
extern boolean capslock;
|
extern boolean capslock;
|
||||||
|
|
||||||
|
// WARNING: a should be unsigned but to add with 2048, it isn't!
|
||||||
|
#define AIMINGTODY(a) (FINETANGENT((2048+(((INT32)a)>>ANGLETOFINESHIFT)) & FINEMASK)*160)
|
||||||
|
|
||||||
// if we ever make our alloc stuff...
|
// if we ever make our alloc stuff...
|
||||||
#define ZZ_Alloc(x) Z_Malloc(x, PU_STATIC, NULL)
|
#define ZZ_Alloc(x) Z_Malloc(x, PU_STATIC, NULL)
|
||||||
|
|
||||||
|
@ -633,11 +636,6 @@ extern const char *compdate, *comptime, *comprevision, *compbranch;
|
||||||
/// Most modifications should probably enable this.
|
/// Most modifications should probably enable this.
|
||||||
//#define SAVEGAME_OTHERVERSIONS
|
//#define SAVEGAME_OTHERVERSIONS
|
||||||
|
|
||||||
#if !defined (_NDS) && !defined (_PSP)
|
|
||||||
/// Shuffle's incomplete OpenGL sorting code.
|
|
||||||
#define SHUFFLE // This has nothing to do with sorting, why was it disabled?
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if !defined (_NDS) && !defined (_PSP)
|
#if !defined (_NDS) && !defined (_PSP)
|
||||||
/// Allow the use of the SOC RESETINFO command.
|
/// Allow the use of the SOC RESETINFO command.
|
||||||
/// \note Builds that are tight on memory should disable this.
|
/// \note Builds that are tight on memory should disable this.
|
||||||
|
@ -674,6 +672,9 @@ extern const char *compdate, *comptime, *comprevision, *compbranch;
|
||||||
/// on the bright side it fixes some weird issues with translucent walls
|
/// on the bright side it fixes some weird issues with translucent walls
|
||||||
/// \note SRB2CB port.
|
/// \note SRB2CB port.
|
||||||
/// SRB2CB itself ported this from PrBoom+
|
/// SRB2CB itself ported this from PrBoom+
|
||||||
#define NEWCLIP
|
//#define NEWCLIP
|
||||||
|
|
||||||
|
/// Hardware renderer: OpenGL
|
||||||
|
#define GL_SHADERS
|
||||||
|
|
||||||
#endif // __DOOMDEF__
|
#endif // __DOOMDEF__
|
||||||
|
|
|
@ -1,17 +1,12 @@
|
||||||
// Emacs style mode select -*- C++ -*-
|
// SONIC ROBO BLAST 2
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
//
|
// Copyright (C) 1993-1996 by id Software, Inc.
|
||||||
// Copyright (C) 1998-2000 by DooM Legacy Team.
|
// Copyright (C) 1998-2000 by DooM Legacy Team.
|
||||||
|
// Copyright (C) 1999-2019 by Sonic Team Junior.
|
||||||
//
|
//
|
||||||
// This program is free software; you can redistribute it and/or
|
// This program is free software distributed under the
|
||||||
// modify it under the terms of the GNU General Public License
|
// terms of the GNU General Public License, version 2.
|
||||||
// as published by the Free Software Foundation; either version 2
|
// See the 'LICENSE' file for more details.
|
||||||
// of the License, or (at your option) any later version.
|
|
||||||
//
|
|
||||||
// This program is distributed in the hope that it will be useful,
|
|
||||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
// GNU General Public License for more details.
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
/// \file
|
/// \file
|
||||||
/// \brief convert SRB2 map
|
/// \brief convert SRB2 map
|
||||||
|
@ -19,6 +14,7 @@
|
||||||
#include "../doomdef.h"
|
#include "../doomdef.h"
|
||||||
#include "../doomstat.h"
|
#include "../doomstat.h"
|
||||||
#ifdef HWRENDER
|
#ifdef HWRENDER
|
||||||
|
#include "hw_main.h"
|
||||||
#include "hw_glob.h"
|
#include "hw_glob.h"
|
||||||
#include "../r_local.h"
|
#include "../r_local.h"
|
||||||
#include "../z_zone.h"
|
#include "../z_zone.h"
|
||||||
|
@ -60,77 +56,12 @@ static INT32 totalsubsecpolys = 0;
|
||||||
// --------------------------------------------------------------------------
|
// --------------------------------------------------------------------------
|
||||||
// Polygon fast alloc / free
|
// Polygon fast alloc / free
|
||||||
// --------------------------------------------------------------------------
|
// --------------------------------------------------------------------------
|
||||||
//hurdler: quick fix for those who wants to play with larger wad
|
|
||||||
|
|
||||||
#define ZPLANALLOC
|
|
||||||
#ifndef ZPLANALLOC
|
|
||||||
//#define POLYPOOLSIZE 1024000 // may be much over what is needed
|
|
||||||
/// \todo check out how much is used
|
|
||||||
static size_t POLYPOOLSIZE = 1024000;
|
|
||||||
|
|
||||||
static UINT8 *gr_polypool = NULL;
|
|
||||||
static UINT8 *gr_ppcurrent;
|
|
||||||
static size_t gr_ppfree;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// only between levels, clear poly pool
|
|
||||||
static void HWR_ClearPolys(void)
|
|
||||||
{
|
|
||||||
#ifndef ZPLANALLOC
|
|
||||||
gr_ppcurrent = gr_polypool;
|
|
||||||
gr_ppfree = POLYPOOLSIZE;
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
// allocate pool for fast alloc of polys
|
|
||||||
void HWR_InitPolyPool(void)
|
|
||||||
{
|
|
||||||
#ifndef ZPLANALLOC
|
|
||||||
INT32 pnum;
|
|
||||||
|
|
||||||
//hurdler: quick fix for those who wants to play with larger wad
|
|
||||||
if ((pnum = M_CheckParm("-polypoolsize")))
|
|
||||||
POLYPOOLSIZE = atoi(myargv[pnum+1])*1024; // (in kb)
|
|
||||||
|
|
||||||
CONS_Debug(DBG_RENDER, "HWR_InitPolyPool(): allocating %d bytes\n", POLYPOOLSIZE);
|
|
||||||
gr_polypool = malloc(POLYPOOLSIZE);
|
|
||||||
if (!gr_polypool)
|
|
||||||
I_Error("HWR_InitPolyPool(): couldn't malloc polypool\n");
|
|
||||||
HWR_ClearPolys();
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
void HWR_FreePolyPool(void)
|
|
||||||
{
|
|
||||||
#ifndef ZPLANALLOC
|
|
||||||
if (gr_polypool)
|
|
||||||
free(gr_polypool);
|
|
||||||
gr_polypool = NULL;
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
static poly_t *HWR_AllocPoly(INT32 numpts)
|
static poly_t *HWR_AllocPoly(INT32 numpts)
|
||||||
{
|
{
|
||||||
poly_t *p;
|
poly_t *p;
|
||||||
size_t size = sizeof (poly_t) + sizeof (polyvertex_t) * numpts;
|
size_t size = sizeof (poly_t) + sizeof (polyvertex_t) * numpts;
|
||||||
#ifdef ZPLANALLOC
|
|
||||||
p = Z_Malloc(size, PU_HWRPLANE, NULL);
|
p = Z_Malloc(size, PU_HWRPLANE, NULL);
|
||||||
#else
|
|
||||||
#ifdef PARANOIA
|
|
||||||
if (!gr_polypool)
|
|
||||||
I_Error("Used gr_polypool without init!\n");
|
|
||||||
if (!gr_ppcurrent)
|
|
||||||
I_Error("gr_ppcurrent == NULL!\n");
|
|
||||||
#endif
|
|
||||||
|
|
||||||
if (gr_ppfree < size)
|
|
||||||
I_Error("HWR_AllocPoly(): no more memory %u bytes left, %u bytes needed\n\n%s\n",
|
|
||||||
gr_ppfree, size, "You can try the param -polypoolsize 2048 (or higher if needed)");
|
|
||||||
|
|
||||||
p = (poly_t *)gr_ppcurrent;
|
|
||||||
gr_ppcurrent += size;
|
|
||||||
gr_ppfree -= size;
|
|
||||||
#endif
|
|
||||||
p->numpts = numpts;
|
p->numpts = numpts;
|
||||||
return p;
|
return p;
|
||||||
}
|
}
|
||||||
|
@ -139,17 +70,7 @@ static polyvertex_t *HWR_AllocVertex(void)
|
||||||
{
|
{
|
||||||
polyvertex_t *p;
|
polyvertex_t *p;
|
||||||
size_t size = sizeof (polyvertex_t);
|
size_t size = sizeof (polyvertex_t);
|
||||||
#ifdef ZPLANALLOC
|
|
||||||
p = Z_Malloc(size, PU_HWRPLANE, NULL);
|
p = Z_Malloc(size, PU_HWRPLANE, NULL);
|
||||||
#else
|
|
||||||
if (gr_ppfree < size)
|
|
||||||
I_Error("HWR_AllocVertex(): no more memory %u bytes left, %u bytes needed\n\n%s\n",
|
|
||||||
gr_ppfree, size, "You can try the param -polypoolsize 2048 (or higher if needed)");
|
|
||||||
|
|
||||||
p = (polyvertex_t *)gr_ppcurrent;
|
|
||||||
gr_ppcurrent += size;
|
|
||||||
gr_ppfree -= size;
|
|
||||||
#endif
|
|
||||||
return p;
|
return p;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -157,16 +78,9 @@ static polyvertex_t *HWR_AllocVertex(void)
|
||||||
/// for now don't free because it doesn't free in reverse order
|
/// for now don't free because it doesn't free in reverse order
|
||||||
static void HWR_FreePoly(poly_t *poly)
|
static void HWR_FreePoly(poly_t *poly)
|
||||||
{
|
{
|
||||||
#ifdef ZPLANALLOC
|
|
||||||
Z_Free(poly);
|
Z_Free(poly);
|
||||||
#else
|
|
||||||
const size_t size = sizeof (poly_t) + sizeof (polyvertex_t) * poly->numpts;
|
|
||||||
memset(poly, 0x00, size);
|
|
||||||
//mempoly -= polysize;
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// Return interception along bsp line,
|
// Return interception along bsp line,
|
||||||
// with the polygon segment
|
// with the polygon segment
|
||||||
//
|
//
|
||||||
|
@ -577,8 +491,8 @@ static inline void SearchDivline(node_t *bsp, fdivline_t *divline)
|
||||||
divline->dy = FIXED_TO_FLOAT(bsp->dy);
|
divline->dy = FIXED_TO_FLOAT(bsp->dy);
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef HWR_LOADING_SCREEN
|
|
||||||
//Hurdler: implement a loading status
|
//Hurdler: implement a loading status
|
||||||
|
#ifdef HWR_LOADING_SCREEN
|
||||||
static size_t ls_count = 0;
|
static size_t ls_count = 0;
|
||||||
static UINT8 ls_percent = 0;
|
static UINT8 ls_percent = 0;
|
||||||
|
|
||||||
|
@ -836,8 +750,6 @@ static INT32 SolveTProblem(void)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
CONS_Debug(DBG_RENDER, "Solving T-joins. This may take a while. Please wait...\n");
|
CONS_Debug(DBG_RENDER, "Solving T-joins. This may take a while. Please wait...\n");
|
||||||
CON_Drawer(); //let the user know what we are doing
|
|
||||||
I_FinishUpdate(); // page flip or blit buffer
|
|
||||||
|
|
||||||
numsplitpoly = 0;
|
numsplitpoly = 0;
|
||||||
|
|
||||||
|
@ -964,11 +876,9 @@ void HWR_CreatePlanePolygons(INT32 bspnum)
|
||||||
CONS_Debug(DBG_RENDER, "Creating polygons, please wait...\n");
|
CONS_Debug(DBG_RENDER, "Creating polygons, please wait...\n");
|
||||||
#ifdef HWR_LOADING_SCREEN
|
#ifdef HWR_LOADING_SCREEN
|
||||||
ls_count = ls_percent = 0; // reset the loading status
|
ls_count = ls_percent = 0; // reset the loading status
|
||||||
#endif
|
|
||||||
CON_Drawer(); //let the user know what we are doing
|
CON_Drawer(); //let the user know what we are doing
|
||||||
I_FinishUpdate(); // page flip or blit buffer
|
I_FinishUpdate(); // page flip or blit buffer
|
||||||
|
#endif
|
||||||
HWR_ClearPolys();
|
|
||||||
|
|
||||||
// find min/max boundaries of map
|
// find min/max boundaries of map
|
||||||
//CONS_Debug(DBG_RENDER, "Looking for boundaries of map...\n");
|
//CONS_Debug(DBG_RENDER, "Looking for boundaries of map...\n");
|
||||||
|
|
|
@ -1,18 +1,12 @@
|
||||||
// Emacs style mode select -*- C++ -*-
|
// SONIC ROBO BLAST 2
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
//
|
// Copyright (C) 1993-1996 by id Software, Inc.
|
||||||
// Copyright (C) 1998-2000 by DooM Legacy Team.
|
// Copyright (C) 1998-2000 by DooM Legacy Team.
|
||||||
|
// Copyright (C) 1999-2019 by Sonic Team Junior.
|
||||||
//
|
//
|
||||||
// This program is free software; you can redistribute it and/or
|
// This program is free software distributed under the
|
||||||
// modify it under the terms of the GNU General Public License
|
// terms of the GNU General Public License, version 2.
|
||||||
// as published by the Free Software Foundation; either version 2
|
// See the 'LICENSE' file for more details.
|
||||||
// of the License, or (at your option) any later version.
|
|
||||||
//
|
|
||||||
// This program is distributed in the hope that it will be useful,
|
|
||||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
// GNU General Public License for more details.
|
|
||||||
//
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
/// \file
|
/// \file
|
||||||
/// \brief load and convert graphics to the hardware format
|
/// \brief load and convert graphics to the hardware format
|
||||||
|
@ -20,6 +14,7 @@
|
||||||
#include "../doomdef.h"
|
#include "../doomdef.h"
|
||||||
|
|
||||||
#ifdef HWRENDER
|
#ifdef HWRENDER
|
||||||
|
#include "hw_main.h"
|
||||||
#include "hw_glob.h"
|
#include "hw_glob.h"
|
||||||
#include "hw_drv.h"
|
#include "hw_drv.h"
|
||||||
|
|
||||||
|
@ -31,10 +26,6 @@
|
||||||
#include "../v_video.h"
|
#include "../v_video.h"
|
||||||
#include "../r_draw.h"
|
#include "../r_draw.h"
|
||||||
|
|
||||||
//Hurdler: 25/04/2000: used for new colormap code in hardware mode
|
|
||||||
//static UINT8 *gr_colormap = NULL; // by default it must be NULL ! (because colormap tables are not initialized)
|
|
||||||
boolean firetranslucent = false;
|
|
||||||
|
|
||||||
// Values set after a call to HWR_ResizeBlock()
|
// Values set after a call to HWR_ResizeBlock()
|
||||||
static INT32 blocksize, blockwidth, blockheight;
|
static INT32 blocksize, blockwidth, blockheight;
|
||||||
|
|
||||||
|
@ -139,17 +130,17 @@ static void HWR_DrawPatchInCache(GLMipmap_t *mipmap,
|
||||||
count--;
|
count--;
|
||||||
|
|
||||||
texel = source[yfrac>>FRACBITS];
|
texel = source[yfrac>>FRACBITS];
|
||||||
|
|
||||||
if (firetranslucent && (transtables[(texel<<8)+0x40000]!=texel))
|
|
||||||
alpha = 0x80;
|
|
||||||
else
|
|
||||||
alpha = 0xff;
|
alpha = 0xff;
|
||||||
|
|
||||||
//Hurdler: not perfect, but better than holes
|
//Hurdler: not perfect, but better than holes
|
||||||
if (texel == HWR_PATCHES_CHROMAKEY_COLORINDEX && (mipmap->flags & TF_CHROMAKEYED))
|
if (texel == HWR_PATCHES_CHROMAKEY_COLORINDEX && (mipmap->flags & TF_CHROMAKEYED))
|
||||||
texel = HWR_CHROMAKEY_EQUIVALENTCOLORINDEX;
|
alpha = 0x00;
|
||||||
|
|
||||||
|
//texel = HWR_CHROMAKEY_EQUIVALENTCOLORINDEX;
|
||||||
|
// Lat: Don't do that, some weirdos still use CYAN on their WALLTEXTURES for translucency :V
|
||||||
|
|
||||||
//Hurdler: 25/04/2000: now support colormap in hardware mode
|
//Hurdler: 25/04/2000: now support colormap in hardware mode
|
||||||
else if (mipmap->colormap)
|
if (mipmap->colormap)
|
||||||
texel = mipmap->colormap[texel];
|
texel = mipmap->colormap[texel];
|
||||||
|
|
||||||
// hope compiler will get this switch out of the loops (dreams...)
|
// hope compiler will get this switch out of the loops (dreams...)
|
||||||
|
@ -181,16 +172,16 @@ static void HWR_DrawPatchInCache(GLMipmap_t *mipmap,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// resize the patch to be 3dfx compliant
|
// resize the patch
|
||||||
// set : blocksize = blockwidth * blockheight (no bpp used)
|
// set : blocksize = blockwidth * blockheight (no bpp used)
|
||||||
// blockwidth
|
// blockwidth
|
||||||
// blockheight
|
// blockheight
|
||||||
//note : 8bit (1 byte per pixel) palettized format
|
//note : 8bit (1 byte per pixel) palettized format
|
||||||
static void HWR_ResizeBlock(INT32 originalwidth, INT32 originalheight,
|
static void HWR_ResizeBlock(INT32 originalwidth, INT32 originalheight,
|
||||||
GrTexInfo *grInfo)
|
GLTexInfo *grInfo)
|
||||||
{
|
{
|
||||||
// Build the full textures from patches.
|
// Build the full textures from patches.
|
||||||
static const GrLOD_t gr_lods[9] =
|
static const GLlod_t gr_lods[9] =
|
||||||
{
|
{
|
||||||
GR_LOD_LOG2_256,
|
GR_LOD_LOG2_256,
|
||||||
GR_LOD_LOG2_128,
|
GR_LOD_LOG2_128,
|
||||||
|
@ -205,7 +196,7 @@ static void HWR_ResizeBlock(INT32 originalwidth, INT32 originalheight,
|
||||||
|
|
||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
GrAspectRatio_t aspect;
|
GLAspectRatio_t aspect;
|
||||||
float max_s;
|
float max_s;
|
||||||
float max_t;
|
float max_t;
|
||||||
} booring_aspect_t;
|
} booring_aspect_t;
|
||||||
|
@ -226,41 +217,21 @@ static void HWR_ResizeBlock(INT32 originalwidth, INT32 originalheight,
|
||||||
INT32 j,k;
|
INT32 j,k;
|
||||||
INT32 max,min;
|
INT32 max,min;
|
||||||
|
|
||||||
// find a power of 2 width/height
|
// size up to nearest power of 2
|
||||||
if (cv_grrounddown.value)
|
|
||||||
{
|
|
||||||
blockwidth = 256;
|
|
||||||
while (originalwidth < blockwidth)
|
|
||||||
blockwidth >>= 1;
|
|
||||||
if (blockwidth < 1)
|
|
||||||
I_Error("3D GenerateTexture : too small");
|
|
||||||
|
|
||||||
blockheight = 256;
|
|
||||||
while (originalheight < blockheight)
|
|
||||||
blockheight >>= 1;
|
|
||||||
if (blockheight < 1)
|
|
||||||
I_Error("3D GenerateTexture : too small");
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
//size up to nearest power of 2
|
|
||||||
blockwidth = 1;
|
blockwidth = 1;
|
||||||
while (blockwidth < originalwidth)
|
while (blockwidth < originalwidth)
|
||||||
blockwidth <<= 1;
|
blockwidth <<= 1;
|
||||||
// scale down the original graphics to fit in 256
|
// scale down the original graphics to fit in 2048
|
||||||
if (blockwidth > 2048)
|
if (blockwidth > 2048)
|
||||||
blockwidth = 2048;
|
blockwidth = 2048;
|
||||||
//I_Error("3D GenerateTexture : too big");
|
|
||||||
|
|
||||||
//size up to nearest power of 2
|
// size up to nearest power of 2
|
||||||
blockheight = 1;
|
blockheight = 1;
|
||||||
while (blockheight < originalheight)
|
while (blockheight < originalheight)
|
||||||
blockheight <<= 1;
|
blockheight <<= 1;
|
||||||
// scale down the original graphics to fit in 256
|
// scale down the original graphics to fit in 2048
|
||||||
if (blockheight > 2048)
|
if (blockheight > 2048)
|
||||||
blockheight = 2048;
|
blockheight = 2048;
|
||||||
//I_Error("3D GenerateTexture : too big");
|
|
||||||
}
|
|
||||||
|
|
||||||
// do the boring LOD stuff.. blech!
|
// do the boring LOD stuff.. blech!
|
||||||
if (blockwidth >= blockheight)
|
if (blockwidth >= blockheight)
|
||||||
|
@ -324,7 +295,7 @@ static UINT8 *MakeBlock(GLMipmap_t *grMipmap)
|
||||||
{
|
{
|
||||||
UINT8 *block;
|
UINT8 *block;
|
||||||
INT32 bpp, i;
|
INT32 bpp, i;
|
||||||
UINT16 bu16 = ((0x00 <<8) | HWR_CHROMAKEY_EQUIVALENTCOLORINDEX);
|
UINT16 bu16 = ((0x00 <<8) | HWR_PATCHES_CHROMAKEY_COLORINDEX);
|
||||||
|
|
||||||
bpp = format2bpp[grMipmap->grInfo.format];
|
bpp = format2bpp[grMipmap->grInfo.format];
|
||||||
block = Z_Malloc(blocksize*bpp, PU_HWRCACHE, &(grMipmap->grInfo.data));
|
block = Z_Malloc(blocksize*bpp, PU_HWRCACHE, &(grMipmap->grInfo.data));
|
||||||
|
@ -335,8 +306,8 @@ static UINT8 *MakeBlock(GLMipmap_t *grMipmap)
|
||||||
case 2:
|
case 2:
|
||||||
// fill background with chromakey, alpha = 0
|
// fill background with chromakey, alpha = 0
|
||||||
for (i = 0; i < blocksize; i++)
|
for (i = 0; i < blocksize; i++)
|
||||||
//[segabor]
|
|
||||||
memcpy(block+i*sizeof(UINT16), &bu16, sizeof(UINT16));
|
memcpy(block+i*sizeof(UINT16), &bu16, sizeof(UINT16));
|
||||||
|
|
||||||
break;
|
break;
|
||||||
case 4: memset(block, 0x00, blocksize*sizeof(UINT32)); break;
|
case 4: memset(block, 0x00, blocksize*sizeof(UINT32)); break;
|
||||||
}
|
}
|
||||||
|
@ -379,6 +350,13 @@ static void HWR_GenerateTexture(INT32 texnum, GLTexture_t *grtex)
|
||||||
grtex->mipmap.height = (UINT16)blockheight;
|
grtex->mipmap.height = (UINT16)blockheight;
|
||||||
grtex->mipmap.grInfo.format = textureformat;
|
grtex->mipmap.grInfo.format = textureformat;
|
||||||
|
|
||||||
|
grtex->mipmap.colormap = colormaps;
|
||||||
|
|
||||||
|
#ifdef GLENCORE
|
||||||
|
if (encoremap)
|
||||||
|
grtex->mipmap.colormap += (256*32);
|
||||||
|
#endif
|
||||||
|
|
||||||
block = MakeBlock(&grtex->mipmap);
|
block = MakeBlock(&grtex->mipmap);
|
||||||
|
|
||||||
if (skyspecial) //Hurdler: not efficient, but better than holes in the sky (and it's done only at level loading)
|
if (skyspecial) //Hurdler: not efficient, but better than holes in the sky (and it's done only at level loading)
|
||||||
|
@ -430,7 +408,7 @@ static void HWR_GenerateTexture(INT32 texnum, GLTexture_t *grtex)
|
||||||
}
|
}
|
||||||
|
|
||||||
// patch may be NULL if grMipmap has been initialised already and makebitmap is false
|
// patch may be NULL if grMipmap has been initialised already and makebitmap is false
|
||||||
void HWR_MakePatch (const patch_t *patch, GLPatch_t *grPatch, GLMipmap_t *grMipmap, boolean makebitmap)
|
void HWR_MakePatch (patch_t *patch, GLPatch_t *grPatch, GLMipmap_t *grMipmap, boolean makebitmap)
|
||||||
{
|
{
|
||||||
INT32 newwidth, newheight;
|
INT32 newwidth, newheight;
|
||||||
|
|
||||||
|
@ -445,8 +423,8 @@ void HWR_MakePatch (const patch_t *patch, GLPatch_t *grPatch, GLMipmap_t *grMipm
|
||||||
grPatch->leftoffset = SHORT(patch->leftoffset);
|
grPatch->leftoffset = SHORT(patch->leftoffset);
|
||||||
grPatch->topoffset = SHORT(patch->topoffset);
|
grPatch->topoffset = SHORT(patch->topoffset);
|
||||||
|
|
||||||
// find the good 3dfx size (boring spec)
|
// resize patch
|
||||||
HWR_ResizeBlock (SHORT(patch->width), SHORT(patch->height), &grMipmap->grInfo);
|
HWR_ResizeBlock(SHORT(patch->width), SHORT(patch->height), &grMipmap->grInfo);
|
||||||
grMipmap->width = (UINT16)blockwidth;
|
grMipmap->width = (UINT16)blockwidth;
|
||||||
grMipmap->height = (UINT16)blockheight;
|
grMipmap->height = (UINT16)blockheight;
|
||||||
|
|
||||||
|
@ -465,23 +443,12 @@ void HWR_MakePatch (const patch_t *patch, GLPatch_t *grPatch, GLMipmap_t *grMipm
|
||||||
Z_Free(grMipmap->grInfo.data);
|
Z_Free(grMipmap->grInfo.data);
|
||||||
grMipmap->grInfo.data = NULL;
|
grMipmap->grInfo.data = NULL;
|
||||||
|
|
||||||
// if rounddown, rounddown patches as well as textures
|
|
||||||
if (cv_grrounddown.value)
|
|
||||||
{
|
|
||||||
newwidth = blockwidth;
|
|
||||||
newheight = blockheight;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
// no rounddown, do not size up patches, so they don't look 'scaled'
|
|
||||||
newwidth = min(grPatch->width, blockwidth);
|
newwidth = min(grPatch->width, blockwidth);
|
||||||
newheight = min(grPatch->height, blockheight);
|
newheight = min(grPatch->height, blockheight);
|
||||||
}
|
|
||||||
|
|
||||||
if (makebitmap)
|
if (makebitmap)
|
||||||
{
|
{
|
||||||
MakeBlock(grMipmap);
|
MakeBlock(grMipmap);
|
||||||
|
|
||||||
HWR_DrawPatchInCache(grMipmap,
|
HWR_DrawPatchInCache(grMipmap,
|
||||||
newwidth, newheight,
|
newwidth, newheight,
|
||||||
blockwidth*format2bpp[grMipmap->grInfo.format],
|
blockwidth*format2bpp[grMipmap->grInfo.format],
|
||||||
|
@ -495,7 +462,6 @@ void HWR_MakePatch (const patch_t *patch, GLPatch_t *grPatch, GLMipmap_t *grMipm
|
||||||
grPatch->max_t = (float)newheight / (float)blockheight;
|
grPatch->max_t = (float)newheight / (float)blockheight;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// =================================================
|
// =================================================
|
||||||
// CACHING HANDLING
|
// CACHING HANDLING
|
||||||
// =================================================
|
// =================================================
|
||||||
|
@ -562,7 +528,7 @@ void HWR_PrepLevelCache(size_t pnumtextures)
|
||||||
gr_numtextures = pnumtextures;
|
gr_numtextures = pnumtextures;
|
||||||
gr_textures = calloc(pnumtextures, sizeof (*gr_textures));
|
gr_textures = calloc(pnumtextures, sizeof (*gr_textures));
|
||||||
if (gr_textures == NULL)
|
if (gr_textures == NULL)
|
||||||
I_Error("3D can't alloc gr_textures");
|
I_Error("HWR_PrepLevelCache: can't alloc gr_textures");
|
||||||
}
|
}
|
||||||
|
|
||||||
void HWR_SetPalette(RGBA_t *palette)
|
void HWR_SetPalette(RGBA_t *palette)
|
||||||
|
@ -593,7 +559,7 @@ GLTexture_t *HWR_GetTexture(INT32 tex)
|
||||||
GLTexture_t *grtex;
|
GLTexture_t *grtex;
|
||||||
#ifdef PARANOIA
|
#ifdef PARANOIA
|
||||||
if ((unsigned)tex >= gr_numtextures)
|
if ((unsigned)tex >= gr_numtextures)
|
||||||
I_Error(" HWR_GetTexture: tex >= numtextures\n");
|
I_Error("HWR_GetTexture: tex >= numtextures\n");
|
||||||
#endif
|
#endif
|
||||||
grtex = &gr_textures[tex];
|
grtex = &gr_textures[tex];
|
||||||
|
|
||||||
|
@ -611,6 +577,10 @@ GLTexture_t *HWR_GetTexture(INT32 tex)
|
||||||
|
|
||||||
static void HWR_CacheFlat(GLMipmap_t *grMipmap, lumpnum_t flatlumpnum)
|
static void HWR_CacheFlat(GLMipmap_t *grMipmap, lumpnum_t flatlumpnum)
|
||||||
{
|
{
|
||||||
|
#ifdef GLENCORE
|
||||||
|
UINT8 *flat;
|
||||||
|
INT32 steppy;
|
||||||
|
#endif
|
||||||
size_t size, pflatsize;
|
size_t size, pflatsize;
|
||||||
|
|
||||||
// setup the texture info
|
// setup the texture info
|
||||||
|
@ -652,16 +622,30 @@ static void HWR_CacheFlat(GLMipmap_t *grMipmap, lumpnum_t flatlumpnum)
|
||||||
// the flat raw data needn't be converted with palettized textures
|
// the flat raw data needn't be converted with palettized textures
|
||||||
W_ReadLump(flatlumpnum, Z_Malloc(W_LumpLength(flatlumpnum),
|
W_ReadLump(flatlumpnum, Z_Malloc(W_LumpLength(flatlumpnum),
|
||||||
PU_HWRCACHE, &grMipmap->grInfo.data));
|
PU_HWRCACHE, &grMipmap->grInfo.data));
|
||||||
|
|
||||||
|
#ifdef GLENCORE
|
||||||
|
flat = grMipmap->grInfo.data;
|
||||||
|
for (steppy = 0; steppy < size; steppy++)
|
||||||
|
if (flat[steppy] != HWR_PATCHES_CHROMAKEY_COLORINDEX)
|
||||||
|
flat[steppy] = grMipmap->colormap[flat[steppy]];
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// Download a Doom 'flat' to the hardware cache and make it ready for use
|
// Download a Doom 'flat' to the hardware cache and make it ready for use
|
||||||
void HWR_GetFlat(lumpnum_t flatlumpnum)
|
void HWR_GetFlat(lumpnum_t flatlumpnum, boolean noencoremap)
|
||||||
{
|
{
|
||||||
GLMipmap_t *grmip;
|
GLMipmap_t *grmip;
|
||||||
|
|
||||||
grmip = &HWR_GetCachedGLPatch(flatlumpnum)->mipmap;
|
grmip = &HWR_GetCachedGLPatch(flatlumpnum)->mipmap;
|
||||||
|
|
||||||
|
grmip->colormap = colormaps;
|
||||||
|
|
||||||
|
#ifdef GLENCORE
|
||||||
|
if (!noencoremap && encoremap)
|
||||||
|
grmip->colormap += (256*32);
|
||||||
|
#endif
|
||||||
|
|
||||||
if (!grmip->downloaded && !grmip->grInfo.data)
|
if (!grmip->downloaded && !grmip->grInfo.data)
|
||||||
HWR_CacheFlat(grmip, flatlumpnum);
|
HWR_CacheFlat(grmip, flatlumpnum);
|
||||||
|
|
||||||
|
@ -701,12 +685,12 @@ void HWR_GetPatch(GLPatch_t *gpatch)
|
||||||
{
|
{
|
||||||
// load the software patch, PU_STATIC or the Z_Malloc for hardware patch will
|
// load the software patch, PU_STATIC or the Z_Malloc for hardware patch will
|
||||||
// flush the software patch before the conversion! oh yeah I suffered
|
// flush the software patch before the conversion! oh yeah I suffered
|
||||||
patch_t *ptr = W_CacheLumpNumPwad(gpatch->wadnum, gpatch->lumpnum, PU_STATIC);
|
patch_t *patch = W_CacheLumpNumPwad(gpatch->wadnum, gpatch->lumpnum, PU_STATIC);
|
||||||
HWR_MakePatch(ptr, gpatch, &gpatch->mipmap, true);
|
HWR_MakePatch(patch, gpatch, &gpatch->mipmap, true);
|
||||||
|
|
||||||
// this is inefficient.. but the hardware patch in heap is purgeable so it should
|
// this is inefficient.. but the hardware patch in heap is purgeable so it should
|
||||||
// not fragment memory, and besides the REAL cache here is the hardware memory
|
// not fragment memory, and besides the REAL cache here is the hardware memory
|
||||||
Z_Free(ptr);
|
Z_Free(patch);
|
||||||
}
|
}
|
||||||
|
|
||||||
HWD.pfnSetTexture(&gpatch->mipmap);
|
HWD.pfnSetTexture(&gpatch->mipmap);
|
||||||
|
@ -766,160 +750,6 @@ void HWR_UnlockCachedPatch(GLPatch_t *gpatch)
|
||||||
Z_ChangeTag(gpatch, PU_HWRPATCHINFO_UNLOCKED);
|
Z_ChangeTag(gpatch, PU_HWRPATCHINFO_UNLOCKED);
|
||||||
}
|
}
|
||||||
|
|
||||||
static const INT32 picmode2GR[] =
|
|
||||||
{
|
|
||||||
GR_TEXFMT_P_8, // PALETTE
|
|
||||||
0, // INTENSITY (unsupported yet)
|
|
||||||
GR_TEXFMT_ALPHA_INTENSITY_88, // INTENSITY_ALPHA (corona use this)
|
|
||||||
0, // RGB24 (unsupported yet)
|
|
||||||
GR_RGBA, // RGBA32 (opengl only)
|
|
||||||
};
|
|
||||||
|
|
||||||
static void HWR_DrawPicInCache(UINT8 *block, INT32 pblockwidth, INT32 pblockheight,
|
|
||||||
INT32 blockmodulo, pic_t *pic, INT32 bpp)
|
|
||||||
{
|
|
||||||
INT32 i,j;
|
|
||||||
fixed_t posx, posy, stepx, stepy;
|
|
||||||
UINT8 *dest, *src, texel;
|
|
||||||
UINT16 texelu16;
|
|
||||||
INT32 picbpp;
|
|
||||||
RGBA_t col;
|
|
||||||
|
|
||||||
stepy = ((INT32)SHORT(pic->height)<<FRACBITS)/pblockheight;
|
|
||||||
stepx = ((INT32)SHORT(pic->width)<<FRACBITS)/pblockwidth;
|
|
||||||
picbpp = format2bpp[picmode2GR[pic->mode]];
|
|
||||||
posy = 0;
|
|
||||||
for (j = 0; j < pblockheight; j++)
|
|
||||||
{
|
|
||||||
posx = 0;
|
|
||||||
dest = &block[j*blockmodulo];
|
|
||||||
src = &pic->data[(posy>>FRACBITS)*SHORT(pic->width)*picbpp];
|
|
||||||
for (i = 0; i < pblockwidth;i++)
|
|
||||||
{
|
|
||||||
switch (pic->mode)
|
|
||||||
{ // source bpp
|
|
||||||
case PALETTE :
|
|
||||||
texel = src[(posx+FRACUNIT/2)>>FRACBITS];
|
|
||||||
switch (bpp)
|
|
||||||
{ // destination bpp
|
|
||||||
case 1 :
|
|
||||||
*dest++ = texel; break;
|
|
||||||
case 2 :
|
|
||||||
texelu16 = (UINT16)(texel | 0xff00);
|
|
||||||
memcpy(dest, &texelu16, sizeof(UINT16));
|
|
||||||
dest += sizeof(UINT16);
|
|
||||||
break;
|
|
||||||
case 3 :
|
|
||||||
col = V_GetColor(texel);
|
|
||||||
memcpy(dest, &col, sizeof(RGBA_t)-sizeof(UINT8));
|
|
||||||
dest += sizeof(RGBA_t)-sizeof(UINT8);
|
|
||||||
break;
|
|
||||||
case 4 :
|
|
||||||
memcpy(dest, &V_GetColor(texel), sizeof(RGBA_t));
|
|
||||||
dest += sizeof(RGBA_t);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case INTENSITY :
|
|
||||||
*dest++ = src[(posx+FRACUNIT/2)>>FRACBITS];
|
|
||||||
break;
|
|
||||||
case INTENSITY_ALPHA : // assume dest bpp = 2
|
|
||||||
memcpy(dest, src + ((posx+FRACUNIT/2)>>FRACBITS)*sizeof(UINT16), sizeof(UINT16));
|
|
||||||
dest += sizeof(UINT16);
|
|
||||||
break;
|
|
||||||
case RGB24 :
|
|
||||||
break; // not supported yet
|
|
||||||
case RGBA32 : // assume dest bpp = 4
|
|
||||||
dest += sizeof(UINT32);
|
|
||||||
memcpy(dest, src + ((posx+FRACUNIT/2)>>FRACBITS)*sizeof(UINT32), sizeof(UINT32));
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
posx += stepx;
|
|
||||||
}
|
|
||||||
posy += stepy;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// -----------------+
|
|
||||||
// HWR_GetPic : Download a Doom pic (raw row encoded with no 'holes')
|
|
||||||
// Returns :
|
|
||||||
// -----------------+
|
|
||||||
GLPatch_t *HWR_GetPic(lumpnum_t lumpnum)
|
|
||||||
{
|
|
||||||
GLPatch_t *grpatch;
|
|
||||||
|
|
||||||
grpatch = HWR_GetCachedGLPatch(lumpnum);
|
|
||||||
|
|
||||||
if (!grpatch->mipmap.downloaded && !grpatch->mipmap.grInfo.data)
|
|
||||||
{
|
|
||||||
pic_t *pic;
|
|
||||||
UINT8 *block;
|
|
||||||
size_t len;
|
|
||||||
INT32 newwidth, newheight;
|
|
||||||
|
|
||||||
pic = W_CacheLumpNum(lumpnum, PU_CACHE);
|
|
||||||
grpatch->width = SHORT(pic->width);
|
|
||||||
grpatch->height = SHORT(pic->height);
|
|
||||||
len = W_LumpLength(lumpnum) - sizeof (pic_t);
|
|
||||||
|
|
||||||
grpatch->leftoffset = 0;
|
|
||||||
grpatch->topoffset = 0;
|
|
||||||
|
|
||||||
// find the good 3dfx size (boring spec)
|
|
||||||
HWR_ResizeBlock (grpatch->width, grpatch->height, &grpatch->mipmap.grInfo);
|
|
||||||
grpatch->mipmap.width = (UINT16)blockwidth;
|
|
||||||
grpatch->mipmap.height = (UINT16)blockheight;
|
|
||||||
|
|
||||||
if (pic->mode == PALETTE)
|
|
||||||
grpatch->mipmap.grInfo.format = textureformat; // can be set by driver
|
|
||||||
else
|
|
||||||
grpatch->mipmap.grInfo.format = picmode2GR[pic->mode];
|
|
||||||
|
|
||||||
Z_Free(grpatch->mipmap.grInfo.data);
|
|
||||||
|
|
||||||
// allocate block
|
|
||||||
block = MakeBlock(&grpatch->mipmap);
|
|
||||||
|
|
||||||
// if rounddown, rounddown patches as well as textures
|
|
||||||
if (cv_grrounddown.value)
|
|
||||||
{
|
|
||||||
newwidth = blockwidth;
|
|
||||||
newheight = blockheight;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
// no rounddown, do not size up patches, so they don't look 'scaled'
|
|
||||||
newwidth = min(SHORT(pic->width),blockwidth);
|
|
||||||
newheight = min(SHORT(pic->height),blockheight);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
if (grpatch->width == blockwidth &&
|
|
||||||
grpatch->height == blockheight &&
|
|
||||||
format2bpp[grpatch->mipmap.grInfo.format] == format2bpp[picmode2GR[pic->mode]])
|
|
||||||
{
|
|
||||||
// no conversion needed
|
|
||||||
M_Memcpy(grpatch->mipmap.grInfo.data, pic->data,len);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
HWR_DrawPicInCache(block, newwidth, newheight,
|
|
||||||
blockwidth*format2bpp[grpatch->mipmap.grInfo.format],
|
|
||||||
pic,
|
|
||||||
format2bpp[grpatch->mipmap.grInfo.format]);
|
|
||||||
|
|
||||||
Z_Unlock(pic);
|
|
||||||
Z_ChangeTag(block, PU_HWRCACHE_UNLOCKED);
|
|
||||||
|
|
||||||
grpatch->mipmap.flags = 0;
|
|
||||||
grpatch->max_s = (float)newwidth / (float)blockwidth;
|
|
||||||
grpatch->max_t = (float)newheight / (float)blockheight;
|
|
||||||
}
|
|
||||||
HWD.pfnSetTexture(&grpatch->mipmap);
|
|
||||||
//CONS_Debug(DBG_RENDER, "picloaded at %x as texture %d\n",grpatch->mipmap.grInfo.data, grpatch->mipmap.downloaded);
|
|
||||||
|
|
||||||
return grpatch;
|
|
||||||
}
|
|
||||||
|
|
||||||
GLPatch_t *HWR_GetCachedGLPatchPwad(UINT16 wadnum, UINT16 lumpnum)
|
GLPatch_t *HWR_GetCachedGLPatchPwad(UINT16 wadnum, UINT16 lumpnum)
|
||||||
{
|
{
|
||||||
aatree_t *hwrcache = wadfiles[wadnum]->hwrcache;
|
aatree_t *hwrcache = wadfiles[wadnum]->hwrcache;
|
||||||
|
|
|
@ -70,16 +70,17 @@
|
||||||
|
|
||||||
#include <math.h>
|
#include <math.h>
|
||||||
#include "../v_video.h"
|
#include "../v_video.h"
|
||||||
|
#include "hw_main.h"
|
||||||
#include "hw_clip.h"
|
#include "hw_clip.h"
|
||||||
#include "hw_glob.h"
|
#include "hw_glob.h"
|
||||||
#include "../r_main.h"
|
|
||||||
#include "../r_state.h"
|
#include "../r_state.h"
|
||||||
#include "../tables.h"
|
#include "../tables.h"
|
||||||
#include "r_opengl/r_opengl.h"
|
#include "r_opengl/r_opengl.h"
|
||||||
|
#include "../r_main.h" // for cv_fov
|
||||||
|
|
||||||
#ifdef HAVE_SPHEREFRUSTRUM
|
#ifdef HAVE_SPHEREFRUSTRUM
|
||||||
static GLfloat viewMatrix[16];
|
static GLdouble viewMatrix[16];
|
||||||
static GLfloat projMatrix[16];
|
static GLdouble projMatrix[16];
|
||||||
float frustum[6][4];
|
float frustum[6][4];
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -320,12 +321,12 @@ void gld_clipper_Clear(void)
|
||||||
|
|
||||||
#define RMUL (1.6f/1.333333f)
|
#define RMUL (1.6f/1.333333f)
|
||||||
|
|
||||||
angle_t gld_FrustumAngle(void)
|
angle_t gld_FrustumAngle(angle_t tiltangle)
|
||||||
{
|
{
|
||||||
double floatangle;
|
double floatangle;
|
||||||
angle_t a1;
|
angle_t a1;
|
||||||
|
|
||||||
float tilt = (float)fabs(((double)(int)aimingangle) / ANG1);
|
float tilt = (float)fabs(((double)(int)tiltangle) / ANG1);
|
||||||
|
|
||||||
// NEWCLIP TODO: SRB2CBTODO: make a global render_fov for this function
|
// NEWCLIP TODO: SRB2CBTODO: make a global render_fov for this function
|
||||||
|
|
||||||
|
@ -334,12 +335,10 @@ angle_t gld_FrustumAngle(void)
|
||||||
float render_multiplier = 64.0f / render_fovratio / RMUL;
|
float render_multiplier = 64.0f / render_fovratio / RMUL;
|
||||||
|
|
||||||
if (tilt > 90.0f)
|
if (tilt > 90.0f)
|
||||||
{
|
|
||||||
tilt = 90.0f;
|
tilt = 90.0f;
|
||||||
}
|
|
||||||
|
|
||||||
// If the pitch is larger than this you can look all around at a FOV of 90
|
// If the pitch is larger than this you can look all around at a FOV of 90
|
||||||
if (abs((signed)aimingangle) > 46 * ANG1)
|
if (abs((signed)tiltangle) > 46 * ANG1)
|
||||||
return 0xffffffff;
|
return 0xffffffff;
|
||||||
|
|
||||||
// ok, this is a gross hack that barely works...
|
// ok, this is a gross hack that barely works...
|
||||||
|
@ -352,7 +351,7 @@ angle_t gld_FrustumAngle(void)
|
||||||
}
|
}
|
||||||
|
|
||||||
// SRB2CB I don't think used any of this stuff, let's disable for now since SRB2 probably doesn't want it either
|
// SRB2CB I don't think used any of this stuff, let's disable for now since SRB2 probably doesn't want it either
|
||||||
// compiler complains about (p)glGetDoublev anyway, in case anyone wants this
|
// compiler complains about (p)glGetFloatv anyway, in case anyone wants this
|
||||||
// only r_opengl.c can use the base gl funcs as it turns out, that's a problem for whoever wants sphere frustum checks
|
// only r_opengl.c can use the base gl funcs as it turns out, that's a problem for whoever wants sphere frustum checks
|
||||||
// btw to renable define HAVE_SPHEREFRUSTRUM in hw_clip.h
|
// btw to renable define HAVE_SPHEREFRUSTRUM in hw_clip.h
|
||||||
#ifdef HAVE_SPHEREFRUSTRUM
|
#ifdef HAVE_SPHEREFRUSTRUM
|
||||||
|
@ -381,7 +380,7 @@ void gld_FrustrumSetup(void)
|
||||||
float t;
|
float t;
|
||||||
float clip[16];
|
float clip[16];
|
||||||
|
|
||||||
pglGeFloatv(GL_PROJECTION_MATRIX, projMatrix);
|
pglGetFloatv(GL_PROJECTION_MATRIX, projMatrix);
|
||||||
pglGetFloatv(GL_MODELVIEW_MATRIX, viewMatrix);
|
pglGetFloatv(GL_MODELVIEW_MATRIX, viewMatrix);
|
||||||
|
|
||||||
clip[0] = CALCMATRIX(0, 0, 1, 4, 2, 8, 3, 12);
|
clip[0] = CALCMATRIX(0, 0, 1, 4, 2, 8, 3, 12);
|
||||||
|
|
|
@ -17,7 +17,7 @@
|
||||||
boolean gld_clipper_SafeCheckRange(angle_t startAngle, angle_t endAngle);
|
boolean gld_clipper_SafeCheckRange(angle_t startAngle, angle_t endAngle);
|
||||||
void gld_clipper_SafeAddClipRange(angle_t startangle, angle_t endangle);
|
void gld_clipper_SafeAddClipRange(angle_t startangle, angle_t endangle);
|
||||||
void gld_clipper_Clear(void);
|
void gld_clipper_Clear(void);
|
||||||
angle_t gld_FrustumAngle(void);
|
angle_t gld_FrustumAngle(angle_t tiltangle);
|
||||||
#ifdef HAVE_SPHEREFRUSTRUM
|
#ifdef HAVE_SPHEREFRUSTRUM
|
||||||
void gld_FrustrumSetup(void);
|
void gld_FrustrumSetup(void);
|
||||||
boolean gld_SphereInFrustum(float x, float y, float z, float radius);
|
boolean gld_SphereInFrustum(float x, float y, float z, float radius);
|
||||||
|
|
|
@ -1,60 +1,86 @@
|
||||||
// Emacs style mode select -*- C++ -*-
|
// SONIC ROBO BLAST 2
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
//
|
// Copyright (C) 1993-1996 by id Software, Inc.
|
||||||
// Copyright (C) 1998-2000 by DooM Legacy Team.
|
// Copyright (C) 1998-2000 by DooM Legacy Team.
|
||||||
|
// Copyright (C) 1999-2019 by Sonic Team Junior.
|
||||||
//
|
//
|
||||||
// This program is free software; you can redistribute it and/or
|
// This program is free software distributed under the
|
||||||
// modify it under the terms of the GNU General Public License
|
// terms of the GNU General Public License, version 2.
|
||||||
// as published by the Free Software Foundation; either version 2
|
// See the 'LICENSE' file for more details.
|
||||||
// of the License, or (at your option) any later version.
|
|
||||||
//
|
|
||||||
// This program is distributed in the hope that it will be useful,
|
|
||||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
// GNU General Public License for more details.
|
|
||||||
//
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
/// \file
|
/// \file
|
||||||
/// \brief defines structures and exports for the standard 3D driver DLL used by Doom Legacy
|
/// \brief defines structures and exports for the standard GPU driver
|
||||||
|
|
||||||
#ifndef _HWR_DATA_
|
#ifndef _HWR_DATA_
|
||||||
#define _HWR_DATA_
|
#define _HWR_DATA_
|
||||||
|
|
||||||
#if defined (_WIN32) && !defined (__CYGWIN__) && !defined (_XBOX)
|
|
||||||
//#define WIN32_LEAN_AND_MEAN
|
|
||||||
#define RPC_NO_WINDOWS_H
|
|
||||||
#include <windows.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include "../doomdef.h"
|
#include "../doomdef.h"
|
||||||
//THIS MUST DISAPPEAR!!!
|
|
||||||
#include "hw_glide.h"
|
|
||||||
#include "../screen.h"
|
#include "../screen.h"
|
||||||
|
|
||||||
|
|
||||||
// ==========================================================================
|
// ==========================================================================
|
||||||
// TEXTURE INFO
|
// TEXTURE INFO
|
||||||
// ==========================================================================
|
// ==========================================================================
|
||||||
|
|
||||||
|
//
|
||||||
|
// hw_glide.h
|
||||||
|
//
|
||||||
|
|
||||||
|
typedef long GLAspectRatio_t;
|
||||||
|
#define GR_ASPECT_LOG2_8x1 3 /* 8W x 1H */
|
||||||
|
#define GR_ASPECT_LOG2_4x1 2 /* 4W x 1H */
|
||||||
|
#define GR_ASPECT_LOG2_2x1 1 /* 2W x 1H */
|
||||||
|
#define GR_ASPECT_LOG2_1x1 0 /* 1W x 1H */
|
||||||
|
#define GR_ASPECT_LOG2_1x2 -1 /* 1W x 2H */
|
||||||
|
#define GR_ASPECT_LOG2_1x4 -2 /* 1W x 4H */
|
||||||
|
#define GR_ASPECT_LOG2_1x8 -3 /* 1W x 8H */
|
||||||
|
|
||||||
|
typedef long GLlod_t;
|
||||||
|
#define GR_LOD_LOG2_256 0x8
|
||||||
|
#define GR_LOD_LOG2_128 0x7
|
||||||
|
#define GR_LOD_LOG2_64 0x6
|
||||||
|
#define GR_LOD_LOG2_32 0x5
|
||||||
|
#define GR_LOD_LOG2_16 0x4
|
||||||
|
#define GR_LOD_LOG2_8 0x3
|
||||||
|
#define GR_LOD_LOG2_4 0x2
|
||||||
|
#define GR_LOD_LOG2_2 0x1
|
||||||
|
#define GR_LOD_LOG2_1 0x0
|
||||||
|
|
||||||
|
typedef long GLTextureFormat_t;
|
||||||
|
#define GR_TEXFMT_ALPHA_8 0x2 /* (0..0xFF) alpha */
|
||||||
|
#define GR_TEXFMT_INTENSITY_8 0x3 /* (0..0xFF) intensity */
|
||||||
|
#define GR_TEXFMT_ALPHA_INTENSITY_44 0x4
|
||||||
|
#define GR_TEXFMT_P_8 0x5 /* 8-bit palette */
|
||||||
|
#define GR_TEXFMT_RGB_565 0xa
|
||||||
|
#define GR_TEXFMT_ARGB_1555 0xb
|
||||||
|
#define GR_TEXFMT_ARGB_4444 0xc
|
||||||
|
#define GR_TEXFMT_ALPHA_INTENSITY_88 0xd
|
||||||
|
#define GR_TEXFMT_AP_88 0xe /* 8-bit alpha 8-bit palette */
|
||||||
|
#define GR_RGBA 0x6 // 32 bit RGBA !
|
||||||
|
|
||||||
|
typedef struct
|
||||||
|
{
|
||||||
|
GLlod_t smallLodLog2;
|
||||||
|
GLlod_t largeLodLog2;
|
||||||
|
GLAspectRatio_t aspectRatioLog2;
|
||||||
|
GLTextureFormat_t format;
|
||||||
|
void *data;
|
||||||
|
} GLTexInfo;
|
||||||
|
|
||||||
// grInfo.data holds the address of the graphics data cached in heap memory
|
// grInfo.data holds the address of the graphics data cached in heap memory
|
||||||
// NULL if the texture is not in Doom heap cache.
|
// NULL if the texture is not in Doom heap cache.
|
||||||
struct GLMipmap_s
|
struct GLMipmap_s
|
||||||
{
|
{
|
||||||
GrTexInfo grInfo; //for TexDownloadMipMap
|
GLTexInfo grInfo;
|
||||||
FxU32 flags;
|
unsigned long flags;
|
||||||
UINT16 height;
|
UINT16 width, height;
|
||||||
UINT16 width;
|
UINT32 downloaded; // tex_downloaded
|
||||||
UINT32 downloaded; // the dll driver have it in there cache ?
|
|
||||||
|
|
||||||
|
struct GLMipmap_s *nextmipmap;
|
||||||
struct GLMipmap_s *nextcolormap;
|
struct GLMipmap_s *nextcolormap;
|
||||||
const UINT8 *colormap;
|
const UINT8 *colormap;
|
||||||
|
|
||||||
// opengl
|
|
||||||
struct GLMipmap_s *nextmipmap; // opengl : liste of all texture in opengl driver
|
|
||||||
};
|
};
|
||||||
typedef struct GLMipmap_s GLMipmap_t;
|
typedef struct GLMipmap_s GLMipmap_t;
|
||||||
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// Doom texture info, as cached for hardware rendering
|
// Doom texture info, as cached for hardware rendering
|
||||||
//
|
//
|
||||||
|
@ -66,12 +92,10 @@ struct GLTexture_s
|
||||||
};
|
};
|
||||||
typedef struct GLTexture_s GLTexture_t;
|
typedef struct GLTexture_s GLTexture_t;
|
||||||
|
|
||||||
|
|
||||||
// a cached patch as converted to hardware format, holding the original patch_t
|
// a cached patch as converted to hardware format, holding the original patch_t
|
||||||
// header so that the existing code can retrieve ->width, ->height as usual
|
// header so that the existing code can retrieve ->width, ->height as usual
|
||||||
// This is returned by W_CachePatchNum()/W_CachePatchName(), when rendermode
|
// This is returned by W_CachePatchNum()/W_CachePatchName(), when rendermode
|
||||||
// is 'render_opengl'. Else it returns the normal patch_t data.
|
// is 'render_opengl'. Else it returns the normal patch_t data.
|
||||||
|
|
||||||
struct GLPatch_s
|
struct GLPatch_s
|
||||||
{
|
{
|
||||||
// the 4 first fields come right away from the original patch_t
|
// the 4 first fields come right away from the original patch_t
|
||||||
|
|
|
@ -19,6 +19,7 @@
|
||||||
#ifndef _HWR_DEFS_
|
#ifndef _HWR_DEFS_
|
||||||
#define _HWR_DEFS_
|
#define _HWR_DEFS_
|
||||||
#include "../doomtype.h"
|
#include "../doomtype.h"
|
||||||
|
#include "../r_defs.h"
|
||||||
|
|
||||||
#define ZCLIP_PLANE 4.0f // Used for the actual game drawing
|
#define ZCLIP_PLANE 4.0f // Used for the actual game drawing
|
||||||
#define NZCLIP_PLANE 0.9f // Seems to be only used for the HUD and screen textures
|
#define NZCLIP_PLANE 0.9f // Seems to be only used for the HUD and screen textures
|
||||||
|
@ -41,17 +42,8 @@ typedef unsigned char FBOOLEAN;
|
||||||
// ==========================================================================
|
// ==========================================================================
|
||||||
|
|
||||||
// byte value for paletted graphics, which represent the transparent color
|
// byte value for paletted graphics, which represent the transparent color
|
||||||
#ifdef _NDS
|
|
||||||
// NDS is hardwired to use zero as transparent color
|
|
||||||
#define HWR_PATCHES_CHROMAKEY_COLORINDEX 0
|
|
||||||
#define HWR_CHROMAKEY_EQUIVALENTCOLORINDEX 1
|
|
||||||
#else
|
|
||||||
#define HWR_PATCHES_CHROMAKEY_COLORINDEX 247
|
#define HWR_PATCHES_CHROMAKEY_COLORINDEX 247
|
||||||
#define HWR_CHROMAKEY_EQUIVALENTCOLORINDEX 220
|
#define HWR_CHROMAKEY_EQUIVALENTCOLORINDEX 220
|
||||||
#endif
|
|
||||||
|
|
||||||
// the chroma key color shows on border sprites, set it to black
|
|
||||||
#define HWR_PATCHES_CHROMAKEY_COLORVALUE (0x00000000) //RGBA format as in grSstWinOpen()
|
|
||||||
|
|
||||||
// RGBA Color components with float type ranging [ 0 ... 1 ]
|
// RGBA Color components with float type ranging [ 0 ... 1 ]
|
||||||
struct FRGBAFloat
|
struct FRGBAFloat
|
||||||
|
@ -73,8 +65,6 @@ struct FColorARGB
|
||||||
typedef struct FColorARGB ARGB_t;
|
typedef struct FColorARGB ARGB_t;
|
||||||
typedef struct FColorARGB FColorARGB;
|
typedef struct FColorARGB FColorARGB;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// ==========================================================================
|
// ==========================================================================
|
||||||
// VECTORS
|
// VECTORS
|
||||||
// ==========================================================================
|
// ==========================================================================
|
||||||
|
@ -85,22 +75,65 @@ typedef struct
|
||||||
FLOAT x,y;
|
FLOAT x,y;
|
||||||
} F2DCoord, v2d_t;
|
} F2DCoord, v2d_t;
|
||||||
|
|
||||||
// Simple 3D vector
|
// ======================
|
||||||
typedef struct FVector
|
// wallVert3D
|
||||||
{
|
// ----------------------
|
||||||
FLOAT x,y,z;
|
// :crab: IS GONE! :crab:
|
||||||
} FVector;
|
// ======================
|
||||||
|
|
||||||
// 3D model vector (coords + texture coords)
|
// -----------
|
||||||
|
// structures
|
||||||
|
// -----------
|
||||||
|
|
||||||
|
// a vertex of a Doom 'plane' polygon
|
||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
//FVector Point;
|
float x;
|
||||||
FLOAT x,y,z;
|
float y;
|
||||||
FLOAT s,t,w; // texture coordinates
|
float z;
|
||||||
} v3d_t, wallVert3D;
|
} polyvertex_t;
|
||||||
|
|
||||||
//Hurdler: Transform (coords + angles)
|
#ifdef _MSC_VER
|
||||||
//BP: transform order : scale(rotation_x(rotation_y(translation(v))))
|
#pragma warning(disable : 4200)
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// a convex 'plane' polygon, clockwise order
|
||||||
|
typedef struct
|
||||||
|
{
|
||||||
|
INT32 numpts;
|
||||||
|
polyvertex_t pts[0];
|
||||||
|
} poly_t;
|
||||||
|
|
||||||
|
#ifdef _MSC_VER
|
||||||
|
#pragma warning(default : 4200)
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// holds extra info for 3D render, for each subsector in subsectors[]
|
||||||
|
typedef struct
|
||||||
|
{
|
||||||
|
poly_t *planepoly; // the generated convex polygon
|
||||||
|
} extrasubsector_t;
|
||||||
|
|
||||||
|
// needed for sprite rendering
|
||||||
|
// equivalent of the software renderer's vissprites
|
||||||
|
typedef struct gr_vissprite_s
|
||||||
|
{
|
||||||
|
// Doubly linked list
|
||||||
|
struct gr_vissprite_s *prev;
|
||||||
|
struct gr_vissprite_s *next;
|
||||||
|
float x1, x2;
|
||||||
|
float z1, z2;
|
||||||
|
float tz, ty;
|
||||||
|
lumpnum_t patchlumpnum;
|
||||||
|
boolean flip;
|
||||||
|
UINT8 translucency; //alpha level 0-255
|
||||||
|
mobj_t *mobj;
|
||||||
|
boolean precip; // Tails 08-25-2002
|
||||||
|
boolean vflip;
|
||||||
|
//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;
|
||||||
|
|
||||||
// Kart features
|
// Kart features
|
||||||
#define USE_FTRANSFORM_ANGLEZ
|
#define USE_FTRANSFORM_ANGLEZ
|
||||||
|
@ -124,18 +157,17 @@ typedef struct
|
||||||
#ifdef USE_FTRANSFORM_MIRROR
|
#ifdef USE_FTRANSFORM_MIRROR
|
||||||
boolean mirror; // SRB2Kart: Encore Mode
|
boolean mirror; // SRB2Kart: Encore Mode
|
||||||
#endif
|
#endif
|
||||||
|
boolean shearing; // 14042019
|
||||||
|
angle_t viewaiming; // 17052019
|
||||||
} FTransform;
|
} FTransform;
|
||||||
|
|
||||||
// Transformed vector, as passed to HWR API
|
// Transformed vector, as passed to HWR API
|
||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
FLOAT x,y,z;
|
FLOAT x,y,z;
|
||||||
FUINT argb; // flat-shaded color
|
FLOAT s,t;
|
||||||
FLOAT sow; // s texture ordinate (s over w)
|
|
||||||
FLOAT tow; // t texture ordinate (t over w)
|
|
||||||
} FOutVector;
|
} FOutVector;
|
||||||
|
|
||||||
|
|
||||||
// ==========================================================================
|
// ==========================================================================
|
||||||
// RENDER MODES
|
// RENDER MODES
|
||||||
// ==========================================================================
|
// ==========================================================================
|
||||||
|
@ -164,21 +196,15 @@ enum EPolyFlags
|
||||||
PF_Decal = 0x00000800, // Enable polygon offset
|
PF_Decal = 0x00000800, // Enable polygon offset
|
||||||
PF_Modulated = 0x00001000, // Modulation (multiply output with constant ARGB)
|
PF_Modulated = 0x00001000, // Modulation (multiply output with constant ARGB)
|
||||||
// When set, pass the color constant into the FSurfaceInfo -> FlatColor
|
// When set, pass the color constant into the FSurfaceInfo -> FlatColor
|
||||||
PF_NoTexture = 0x00002000, // Use the small white texture
|
PF_NoTexture = 0x00002000, // Disable texture
|
||||||
PF_Corona = 0x00004000, // Tell the rendrer we are drawing a corona
|
PF_Ripple = 0x00004000, // Water shader effect
|
||||||
PF_Unused = 0x00008000, // Unused
|
// 0x00008000
|
||||||
PF_RemoveYWrap = 0x00010000, // Force clamp texture on Y
|
PF_RemoveYWrap = 0x00010000, // Force clamp texture on Y
|
||||||
PF_ForceWrapX = 0x00020000, // Force repeat texture on X
|
PF_ForceWrapX = 0x00020000, // Force repeat texture on X
|
||||||
PF_ForceWrapY = 0x00040000, // Force repeat texture on Y
|
PF_ForceWrapY = 0x00040000, // Force repeat texture on Y
|
||||||
PF_Clip = 0x40000000, // clip to frustum and nearz plane (glide only, automatic in opengl)
|
// 0x20000000
|
||||||
PF_NoZClip = 0x20000000, // in conjonction with PF_Clip
|
// 0x40000000
|
||||||
PF_Debug = 0x80000000 // print debug message in driver :)
|
// 0x80000000
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
enum ESurfFlags
|
|
||||||
{
|
|
||||||
SF_DYNLIGHT = 0x00000001,
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -191,46 +217,42 @@ enum ETextureFlags
|
||||||
TF_TRANSPARENT = 0x00000040, // texture with some alpha == 0
|
TF_TRANSPARENT = 0x00000040, // texture with some alpha == 0
|
||||||
};
|
};
|
||||||
|
|
||||||
#ifdef TODO
|
|
||||||
struct FTextureInfo
|
|
||||||
{
|
|
||||||
FUINT Width; // Pixels
|
|
||||||
FUINT Height; // Pixels
|
|
||||||
FUBYTE *TextureData; // Image data
|
|
||||||
FUINT Format; // FORMAT_RGB, ALPHA ...
|
|
||||||
FBITFIELD Flags; // Flags to tell driver about texture (see ETextureFlags)
|
|
||||||
void DriverExtra; // (OpenGL texture object nr, ...)
|
|
||||||
// chromakey enabled,...
|
|
||||||
|
|
||||||
struct FTextureInfo *Next; // Manage list of downloaded textures.
|
|
||||||
};
|
|
||||||
#else
|
|
||||||
typedef struct GLMipmap_s FTextureInfo;
|
typedef struct GLMipmap_s FTextureInfo;
|
||||||
#endif
|
|
||||||
|
// jimita 14032019
|
||||||
|
struct FLightInfo
|
||||||
|
{
|
||||||
|
FUINT light_level;
|
||||||
|
};
|
||||||
|
typedef struct FLightInfo FLightInfo;
|
||||||
|
|
||||||
// Description of a renderable surface
|
// Description of a renderable surface
|
||||||
struct FSurfaceInfo
|
struct FSurfaceInfo
|
||||||
{
|
{
|
||||||
FUINT PolyFlags; // Surface flags -- UNUSED YET --
|
FUINT PolyFlags;
|
||||||
RGBA_t FlatColor; // Flat-shaded color used with PF_Modulated mode
|
RGBA_t PolyColor;
|
||||||
|
RGBA_t FadeColor;
|
||||||
|
FLightInfo LightInfo; // jimita 14032019
|
||||||
};
|
};
|
||||||
typedef struct FSurfaceInfo FSurfaceInfo;
|
typedef struct FSurfaceInfo FSurfaceInfo;
|
||||||
|
|
||||||
//Hurdler: added for backward compatibility
|
|
||||||
enum hwdsetspecialstate
|
enum hwdsetspecialstate
|
||||||
{
|
{
|
||||||
HWD_SET_FOG_TABLE = 1,
|
HWD_SET_SHADERS,
|
||||||
|
|
||||||
HWD_SET_FOG_MODE,
|
HWD_SET_FOG_MODE,
|
||||||
HWD_SET_FOG_COLOR,
|
|
||||||
HWD_SET_FOG_DENSITY,
|
HWD_SET_FOG_DENSITY,
|
||||||
HWD_SET_FOV,
|
|
||||||
HWD_SET_TEXTUREFILTERMODE,
|
HWD_SET_TEXTUREFILTERMODE,
|
||||||
HWD_SET_TEXTUREANISOTROPICMODE,
|
HWD_SET_TEXTUREANISOTROPICMODE,
|
||||||
|
|
||||||
HWD_NUMSTATE
|
HWD_NUMSTATE
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef enum hwdsetspecialstate hwdspecialstate_t;
|
typedef enum hwdsetspecialstate hwdspecialstate_t;
|
||||||
|
|
||||||
|
#define GL_NORMALFOG 0x00000000
|
||||||
|
#define GL_FADEFOG 0x19000000
|
||||||
|
|
||||||
enum hwdfiltermode
|
enum hwdfiltermode
|
||||||
{
|
{
|
||||||
HWD_SET_TEXTUREFILTER_POINTSAMPLED,
|
HWD_SET_TEXTUREFILTER_POINTSAMPLED,
|
||||||
|
@ -241,5 +263,4 @@ enum hwdfiltermode
|
||||||
HWD_SET_TEXTUREFILTER_MIXED3,
|
HWD_SET_TEXTUREFILTER_MIXED3,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
#endif //_HWR_DEFS_
|
#endif //_HWR_DEFS_
|
||||||
|
|
|
@ -54,8 +54,6 @@
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
typedef void (*I_Error_t) (const char *error, ...) FUNCIERROR;
|
|
||||||
|
|
||||||
// ==========================================================================
|
// ==========================================================================
|
||||||
// MATHS
|
// MATHS
|
||||||
// ==========================================================================
|
// ==========================================================================
|
||||||
|
@ -63,7 +61,8 @@ typedef void (*I_Error_t) (const char *error, ...) FUNCIERROR;
|
||||||
// Constants
|
// Constants
|
||||||
#define DEGREE (0.017453292519943295769236907684883l) // 2*PI/360
|
#define DEGREE (0.017453292519943295769236907684883l) // 2*PI/360
|
||||||
|
|
||||||
void DBG_Printf(const char *lpFmt, ...) /*FUNCPRINTF*/;
|
void GL_DBG_Printf(const char *format, ...) /*FUNCPRINTF*/;
|
||||||
|
#define DBG_Printf GL_DBG_Printf
|
||||||
|
|
||||||
#ifdef _WINDOWS
|
#ifdef _WINDOWS
|
||||||
BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved);
|
BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved);
|
||||||
|
|
|
@ -1,17 +1,12 @@
|
||||||
// Emacs style mode select -*- C++ -*-
|
// SONIC ROBO BLAST 2
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
//
|
// Copyright (C) 1993-1996 by id Software, Inc.
|
||||||
// Copyright (C) 1998-2000 by DooM Legacy Team.
|
// Copyright (C) 1998-2000 by DooM Legacy Team.
|
||||||
|
// Copyright (C) 1999-2019 by Sonic Team Junior.
|
||||||
//
|
//
|
||||||
// This program is free software; you can redistribute it and/or
|
// This program is free software distributed under the
|
||||||
// modify it under the terms of the GNU General Public License
|
// terms of the GNU General Public License, version 2.
|
||||||
// as published by the Free Software Foundation; either version 2
|
// See the 'LICENSE' file for more details.
|
||||||
// of the License, or (at your option) any later version.
|
|
||||||
//
|
|
||||||
// This program is distributed in the hope that it will be useful,
|
|
||||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
// GNU General Public License for more details.
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
/// \file
|
/// \file
|
||||||
/// \brief miscellaneous drawing (mainly 2d)
|
/// \brief miscellaneous drawing (mainly 2d)
|
||||||
|
@ -23,6 +18,7 @@
|
||||||
#include "../doomdef.h"
|
#include "../doomdef.h"
|
||||||
|
|
||||||
#ifdef HWRENDER
|
#ifdef HWRENDER
|
||||||
|
#include "hw_main.h"
|
||||||
#include "hw_glob.h"
|
#include "hw_glob.h"
|
||||||
#include "hw_drv.h"
|
#include "hw_drv.h"
|
||||||
|
|
||||||
|
@ -41,9 +37,6 @@
|
||||||
#define O_BINARY 0
|
#define O_BINARY 0
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
float gr_patch_scalex;
|
|
||||||
float gr_patch_scaley;
|
|
||||||
|
|
||||||
#if defined(_MSC_VER)
|
#if defined(_MSC_VER)
|
||||||
#pragma pack(1)
|
#pragma pack(1)
|
||||||
#endif
|
#endif
|
||||||
|
@ -63,9 +56,6 @@ typedef struct
|
||||||
#if defined(_MSC_VER)
|
#if defined(_MSC_VER)
|
||||||
#pragma pack()
|
#pragma pack()
|
||||||
#endif
|
#endif
|
||||||
typedef UINT8 GLRGB[3];
|
|
||||||
|
|
||||||
#define BLENDMODE PF_Translucent
|
|
||||||
|
|
||||||
static UINT8 softwaretranstogl[11] = { 0, 25, 51, 76,102,127,153,178,204,229,255};
|
static UINT8 softwaretranstogl[11] = { 0, 25, 51, 76,102,127,153,178,204,229,255};
|
||||||
static UINT8 softwaretranstogl_hi[11] = { 0, 51,102,153,204,255,255,255,255,255,255};
|
static UINT8 softwaretranstogl_hi[11] = { 0, 51,102,153,204,255,255,255,255,255,255};
|
||||||
|
@ -119,12 +109,12 @@ void HWR_DrawPatch(GLPatch_t *gpatch, INT32 x, INT32 y, INT32 option)
|
||||||
|
|
||||||
v[0].z = v[1].z = v[2].z = v[3].z = 1.0f;
|
v[0].z = v[1].z = v[2].z = v[3].z = 1.0f;
|
||||||
|
|
||||||
v[0].sow = v[3].sow = 0.0f;
|
v[0].s = v[3].s = 0.0f;
|
||||||
v[2].sow = v[1].sow = gpatch->max_s;
|
v[2].s = v[1].s = gpatch->max_s;
|
||||||
v[0].tow = v[1].tow = 0.0f;
|
v[0].t = v[1].t = 0.0f;
|
||||||
v[2].tow = v[3].tow = gpatch->max_t;
|
v[2].t = v[3].t = gpatch->max_t;
|
||||||
|
|
||||||
flags = BLENDMODE|PF_Clip|PF_NoZClip|PF_NoDepthTest;
|
flags = PF_Translucent|PF_NoDepthTest;
|
||||||
|
|
||||||
if (option & V_WRAPX)
|
if (option & V_WRAPX)
|
||||||
flags |= PF_ForceWrapX;
|
flags |= PF_ForceWrapX;
|
||||||
|
@ -220,7 +210,7 @@ void HWR_DrawFixedPatch(GLPatch_t *gpatch, fixed_t x, fixed_t y, fixed_t pscale,
|
||||||
// if it's meant to cover the whole screen, black out the rest
|
// if it's meant to cover the whole screen, black out the rest
|
||||||
// cx and cy are possibly *slightly* off from float maths
|
// cx and cy are possibly *slightly* off from float maths
|
||||||
// This is done before here compared to software because we directly alter cx and cy to centre
|
// This is done before here compared to software because we directly alter cx and cy to centre
|
||||||
/*if (cx >= -0.1f && cx <= 0.1f && SHORT(gpatch->width) == BASEVIDWIDTH && cy >= -0.1f && cy <= 0.1f && SHORT(gpatch->height) == BASEVIDHEIGHT)
|
if (cx >= -0.1f && cx <= 0.1f && SHORT(gpatch->width) == BASEVIDWIDTH && cy >= -0.1f && cy <= 0.1f && SHORT(gpatch->height) == BASEVIDHEIGHT)
|
||||||
{
|
{
|
||||||
// Need to temporarily cache the real patch to get the colour of the top left pixel
|
// Need to temporarily cache the real patch to get the colour of the top left pixel
|
||||||
patch_t *realpatch = W_CacheLumpNumPwad(gpatch->wadnum, gpatch->lumpnum, PU_STATIC);
|
patch_t *realpatch = W_CacheLumpNumPwad(gpatch->wadnum, gpatch->lumpnum, PU_STATIC);
|
||||||
|
@ -228,7 +218,7 @@ void HWR_DrawFixedPatch(GLPatch_t *gpatch, fixed_t x, fixed_t y, fixed_t pscale,
|
||||||
const UINT8 *source = (const UINT8 *)(column) + 3;
|
const UINT8 *source = (const UINT8 *)(column) + 3;
|
||||||
HWR_DrawFill(0, 0, BASEVIDWIDTH, BASEVIDHEIGHT, (column->topdelta == 0xff ? 31 : source[0]));
|
HWR_DrawFill(0, 0, BASEVIDWIDTH, BASEVIDHEIGHT, (column->topdelta == 0xff ? 31 : source[0]));
|
||||||
Z_Free(realpatch);
|
Z_Free(realpatch);
|
||||||
}*/
|
}
|
||||||
// centre screen
|
// centre screen
|
||||||
if (fabsf((float)vid.width - (float)BASEVIDWIDTH * dupx) > 1.0E-36f)
|
if (fabsf((float)vid.width - (float)BASEVIDWIDTH * dupx) > 1.0E-36f)
|
||||||
{
|
{
|
||||||
|
@ -279,19 +269,19 @@ void HWR_DrawFixedPatch(GLPatch_t *gpatch, fixed_t x, fixed_t y, fixed_t pscale,
|
||||||
|
|
||||||
if (option & V_FLIP)
|
if (option & V_FLIP)
|
||||||
{
|
{
|
||||||
v[0].sow = v[3].sow = gpatch->max_s;
|
v[0].s = v[3].s = gpatch->max_s;
|
||||||
v[2].sow = v[1].sow = 0.0f;
|
v[2].s = v[1].s = 0.0f;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
v[0].sow = v[3].sow = 0.0f;
|
v[0].s = v[3].s = 0.0f;
|
||||||
v[2].sow = v[1].sow = gpatch->max_s;
|
v[2].s = v[1].s = gpatch->max_s;
|
||||||
}
|
}
|
||||||
|
|
||||||
v[0].tow = v[1].tow = 0.0f;
|
v[0].t = v[1].t = 0.0f;
|
||||||
v[2].tow = v[3].tow = gpatch->max_t;
|
v[2].t = v[3].t = gpatch->max_t;
|
||||||
|
|
||||||
flags = BLENDMODE|PF_Clip|PF_NoZClip|PF_NoDepthTest;
|
flags = PF_Translucent|PF_NoDepthTest;
|
||||||
|
|
||||||
if (option & V_WRAPX)
|
if (option & V_WRAPX)
|
||||||
flags |= PF_ForceWrapX;
|
flags |= PF_ForceWrapX;
|
||||||
|
@ -302,11 +292,11 @@ void HWR_DrawFixedPatch(GLPatch_t *gpatch, fixed_t x, fixed_t y, fixed_t pscale,
|
||||||
if (alphalevel)
|
if (alphalevel)
|
||||||
{
|
{
|
||||||
FSurfaceInfo Surf;
|
FSurfaceInfo Surf;
|
||||||
Surf.FlatColor.s.red = Surf.FlatColor.s.green = Surf.FlatColor.s.blue = 0xff;
|
Surf.PolyColor.s.red = Surf.PolyColor.s.green = Surf.PolyColor.s.blue = 0xff;
|
||||||
if (alphalevel == 13) Surf.FlatColor.s.alpha = softwaretranstogl_lo[hudtrans];
|
if (alphalevel == 13) Surf.PolyColor.s.alpha = softwaretranstogl_lo[cv_translucenthud.value];
|
||||||
else if (alphalevel == 14) Surf.FlatColor.s.alpha = softwaretranstogl[hudtrans];
|
else if (alphalevel == 14) Surf.PolyColor.s.alpha = softwaretranstogl[cv_translucenthud.value];
|
||||||
else if (alphalevel == 15) Surf.FlatColor.s.alpha = softwaretranstogl_hi[hudtrans];
|
else if (alphalevel == 15) Surf.PolyColor.s.alpha = softwaretranstogl_hi[cv_translucenthud.value];
|
||||||
else Surf.FlatColor.s.alpha = softwaretranstogl[10-alphalevel];
|
else Surf.PolyColor.s.alpha = softwaretranstogl[10-alphalevel];
|
||||||
flags |= PF_Modulated;
|
flags |= PF_Modulated;
|
||||||
HWD.pfnDrawPolygon(&Surf, v, 4, flags);
|
HWD.pfnDrawPolygon(&Surf, v, 4, flags);
|
||||||
}
|
}
|
||||||
|
@ -368,7 +358,7 @@ void HWR_DrawCroppedPatch(GLPatch_t *gpatch, fixed_t x, fixed_t y, fixed_t pscal
|
||||||
// if it's meant to cover the whole screen, black out the rest
|
// if it's meant to cover the whole screen, black out the rest
|
||||||
// cx and cy are possibly *slightly* off from float maths
|
// cx and cy are possibly *slightly* off from float maths
|
||||||
// This is done before here compared to software because we directly alter cx and cy to centre
|
// This is done before here compared to software because we directly alter cx and cy to centre
|
||||||
/*if (cx >= -0.1f && cx <= 0.1f && SHORT(gpatch->width) == BASEVIDWIDTH && cy >= -0.1f && cy <= 0.1f && SHORT(gpatch->height) == BASEVIDHEIGHT)
|
if (cx >= -0.1f && cx <= 0.1f && SHORT(gpatch->width) == BASEVIDWIDTH && cy >= -0.1f && cy <= 0.1f && SHORT(gpatch->height) == BASEVIDHEIGHT)
|
||||||
{
|
{
|
||||||
// Need to temporarily cache the real patch to get the colour of the top left pixel
|
// Need to temporarily cache the real patch to get the colour of the top left pixel
|
||||||
patch_t *realpatch = W_CacheLumpNumPwad(gpatch->wadnum, gpatch->lumpnum, PU_STATIC);
|
patch_t *realpatch = W_CacheLumpNumPwad(gpatch->wadnum, gpatch->lumpnum, PU_STATIC);
|
||||||
|
@ -376,7 +366,7 @@ void HWR_DrawCroppedPatch(GLPatch_t *gpatch, fixed_t x, fixed_t y, fixed_t pscal
|
||||||
const UINT8 *source = (const UINT8 *)(column) + 3;
|
const UINT8 *source = (const UINT8 *)(column) + 3;
|
||||||
HWR_DrawFill(0, 0, BASEVIDWIDTH, BASEVIDHEIGHT, (column->topdelta == 0xff ? 31 : source[0]));
|
HWR_DrawFill(0, 0, BASEVIDWIDTH, BASEVIDHEIGHT, (column->topdelta == 0xff ? 31 : source[0]));
|
||||||
Z_Free(realpatch);
|
Z_Free(realpatch);
|
||||||
}*/
|
}
|
||||||
// centre screen
|
// centre screen
|
||||||
if (fabsf((float)vid.width - (float)BASEVIDWIDTH * dupx) > 1.0E-36f)
|
if (fabsf((float)vid.width - (float)BASEVIDWIDTH * dupx) > 1.0E-36f)
|
||||||
{
|
{
|
||||||
|
@ -440,12 +430,12 @@ void HWR_DrawCroppedPatch(GLPatch_t *gpatch, fixed_t x, fixed_t y, fixed_t pscal
|
||||||
|
|
||||||
v[0].z = v[1].z = v[2].z = v[3].z = 1.0f;
|
v[0].z = v[1].z = v[2].z = v[3].z = 1.0f;
|
||||||
|
|
||||||
v[0].sow = v[3].sow = ((sx)/(float)SHORT(gpatch->width) )*gpatch->max_s;
|
v[0].s = v[3].s = ((sx)/(float)SHORT(gpatch->width) )*gpatch->max_s;
|
||||||
v[2].sow = v[1].sow = ((w )/(float)SHORT(gpatch->width) )*gpatch->max_s;
|
v[2].s = v[1].s = ((w )/(float)SHORT(gpatch->width) )*gpatch->max_s;
|
||||||
v[0].tow = v[1].tow = ((sy)/(float)SHORT(gpatch->height))*gpatch->max_t;
|
v[0].t = v[1].t = ((sy)/(float)SHORT(gpatch->height))*gpatch->max_t;
|
||||||
v[2].tow = v[3].tow = ((h )/(float)SHORT(gpatch->height))*gpatch->max_t;
|
v[2].t = v[3].t = ((h )/(float)SHORT(gpatch->height))*gpatch->max_t;
|
||||||
|
|
||||||
flags = BLENDMODE|PF_Clip|PF_NoZClip|PF_NoDepthTest;
|
flags = PF_Translucent|PF_NoDepthTest;
|
||||||
|
|
||||||
if (option & V_WRAPX)
|
if (option & V_WRAPX)
|
||||||
flags |= PF_ForceWrapX;
|
flags |= PF_ForceWrapX;
|
||||||
|
@ -456,11 +446,11 @@ void HWR_DrawCroppedPatch(GLPatch_t *gpatch, fixed_t x, fixed_t y, fixed_t pscal
|
||||||
if (alphalevel)
|
if (alphalevel)
|
||||||
{
|
{
|
||||||
FSurfaceInfo Surf;
|
FSurfaceInfo Surf;
|
||||||
Surf.FlatColor.s.red = Surf.FlatColor.s.green = Surf.FlatColor.s.blue = 0xff;
|
Surf.PolyColor.s.red = Surf.PolyColor.s.green = Surf.PolyColor.s.blue = 0xff;
|
||||||
if (alphalevel == 13) Surf.FlatColor.s.alpha = softwaretranstogl_lo[hudtrans];
|
if (alphalevel == 13) Surf.PolyColor.s.alpha = softwaretranstogl_lo[cv_translucenthud.value];
|
||||||
else if (alphalevel == 14) Surf.FlatColor.s.alpha = softwaretranstogl[hudtrans];
|
else if (alphalevel == 14) Surf.PolyColor.s.alpha = softwaretranstogl[cv_translucenthud.value];
|
||||||
else if (alphalevel == 15) Surf.FlatColor.s.alpha = softwaretranstogl_hi[hudtrans];
|
else if (alphalevel == 15) Surf.PolyColor.s.alpha = softwaretranstogl_hi[cv_translucenthud.value];
|
||||||
else Surf.FlatColor.s.alpha = softwaretranstogl[10-alphalevel];
|
else Surf.PolyColor.s.alpha = softwaretranstogl[10-alphalevel];
|
||||||
flags |= PF_Modulated;
|
flags |= PF_Modulated;
|
||||||
HWD.pfnDrawPolygon(&Surf, v, 4, flags);
|
HWD.pfnDrawPolygon(&Surf, v, 4, flags);
|
||||||
}
|
}
|
||||||
|
@ -468,41 +458,6 @@ void HWR_DrawCroppedPatch(GLPatch_t *gpatch, fixed_t x, fixed_t y, fixed_t pscal
|
||||||
HWD.pfnDrawPolygon(NULL, v, 4, flags);
|
HWD.pfnDrawPolygon(NULL, v, 4, flags);
|
||||||
}
|
}
|
||||||
|
|
||||||
void HWR_DrawPic(INT32 x, INT32 y, lumpnum_t lumpnum)
|
|
||||||
{
|
|
||||||
FOutVector v[4];
|
|
||||||
const GLPatch_t *patch;
|
|
||||||
|
|
||||||
// make pic ready in hardware cache
|
|
||||||
patch = HWR_GetPic(lumpnum);
|
|
||||||
|
|
||||||
// 3--2
|
|
||||||
// | /|
|
|
||||||
// |/ |
|
|
||||||
// 0--1
|
|
||||||
|
|
||||||
v[0].x = v[3].x = 2.0f * (float)x/vid.width - 1;
|
|
||||||
v[2].x = v[1].x = 2.0f * (float)(x + patch->width*FIXED_TO_FLOAT(vid.fdupx))/vid.width - 1;
|
|
||||||
v[0].y = v[1].y = 1.0f - 2.0f * (float)y/vid.height;
|
|
||||||
v[2].y = v[3].y = 1.0f - 2.0f * (float)(y + patch->height*FIXED_TO_FLOAT(vid.fdupy))/vid.height;
|
|
||||||
|
|
||||||
v[0].z = v[1].z = v[2].z = v[3].z = 1.0f;
|
|
||||||
|
|
||||||
v[0].sow = v[3].sow = 0;
|
|
||||||
v[2].sow = v[1].sow = patch->max_s;
|
|
||||||
v[0].tow = v[1].tow = 0;
|
|
||||||
v[2].tow = v[3].tow = patch->max_t;
|
|
||||||
|
|
||||||
|
|
||||||
//Hurdler: Boris, the same comment as above... but maybe for pics
|
|
||||||
// it not a problem since they don't have any transparent pixel
|
|
||||||
// if I'm right !?
|
|
||||||
// But then, the question is: why not 0 instead of PF_Masked ?
|
|
||||||
// or maybe PF_Environment ??? (like what I said above)
|
|
||||||
// BP: PF_Environment don't change anything ! and 0 is undifined
|
|
||||||
HWD.pfnDrawPolygon(NULL, v, 4, BLENDMODE | PF_NoDepthTest | PF_Clip | PF_NoZClip);
|
|
||||||
}
|
|
||||||
|
|
||||||
// ==========================================================================
|
// ==========================================================================
|
||||||
// V_VIDEO.C STUFF
|
// V_VIDEO.C STUFF
|
||||||
// ==========================================================================
|
// ==========================================================================
|
||||||
|
@ -563,12 +518,12 @@ void HWR_DrawFlatFill (INT32 x, INT32 y, INT32 w, INT32 h, lumpnum_t flatlumpnum
|
||||||
v[0].z = v[1].z = v[2].z = v[3].z = 1.0f;
|
v[0].z = v[1].z = v[2].z = v[3].z = 1.0f;
|
||||||
|
|
||||||
// flat is 64x64 lod and texture offsets are [0.0, 1.0]
|
// flat is 64x64 lod and texture offsets are [0.0, 1.0]
|
||||||
v[0].sow = v[3].sow = (float)((x & flatflag)/dflatsize);
|
v[0].s = v[3].s = (float)((x & flatflag)/dflatsize);
|
||||||
v[2].sow = v[1].sow = (float)(v[0].sow + w/dflatsize);
|
v[2].s = v[1].s = (float)(v[0].s + w/dflatsize);
|
||||||
v[0].tow = v[1].tow = (float)((y & flatflag)/dflatsize);
|
v[0].t = v[1].t = (float)((y & flatflag)/dflatsize);
|
||||||
v[2].tow = v[3].tow = (float)(v[0].tow + h/dflatsize);
|
v[2].t = v[3].t = (float)(v[0].t + h/dflatsize);
|
||||||
|
|
||||||
HWR_GetFlat(flatlumpnum);
|
HWR_GetFlat(flatlumpnum, false); // Never Encore map drawflatfill, duh.
|
||||||
|
|
||||||
//Hurdler: Boris, the same comment as above... but maybe for pics
|
//Hurdler: Boris, the same comment as above... but maybe for pics
|
||||||
// it not a problem since they don't have any transparent pixel
|
// it not a problem since they don't have any transparent pixel
|
||||||
|
@ -598,20 +553,20 @@ void HWR_FadeScreenMenuBack(UINT16 color, UINT8 strength)
|
||||||
v[2].y = v[3].y = 1.0f;
|
v[2].y = v[3].y = 1.0f;
|
||||||
v[0].z = v[1].z = v[2].z = v[3].z = 1.0f;
|
v[0].z = v[1].z = v[2].z = v[3].z = 1.0f;
|
||||||
|
|
||||||
v[0].sow = v[3].sow = 0.0f;
|
v[0].s = v[3].s = 0.0f;
|
||||||
v[2].sow = v[1].sow = 1.0f;
|
v[2].s = v[1].s = 1.0f;
|
||||||
v[0].tow = v[1].tow = 1.0f;
|
v[0].t = v[1].t = 1.0f;
|
||||||
v[2].tow = v[3].tow = 0.0f;
|
v[2].t = v[3].t = 0.0f;
|
||||||
|
|
||||||
if (color & 0xFF00) // Do COLORMAP fade.
|
if (color & 0xFF00) // Do COLORMAP fade.
|
||||||
{
|
{
|
||||||
Surf.FlatColor.rgba = UINT2RGBA(0x01010160);
|
Surf.PolyColor.rgba = UINT2RGBA(0x01010160);
|
||||||
Surf.FlatColor.s.alpha = (strength*8);
|
Surf.PolyColor.s.alpha = (strength*8);
|
||||||
}
|
}
|
||||||
else // Do TRANSMAP** fade.
|
else // Do TRANSMAP** fade.
|
||||||
{
|
{
|
||||||
Surf.FlatColor.rgba = pLocalPalette[color].rgba;
|
Surf.PolyColor.rgba = pLocalPalette[color].rgba;
|
||||||
Surf.FlatColor.s.alpha = (UINT8)(strength*25.5f);
|
Surf.PolyColor.s.alpha = (UINT8)(strength*25.5f);
|
||||||
}
|
}
|
||||||
HWD.pfnDrawPolygon(&Surf, v, 4, PF_NoTexture|PF_Modulated|PF_Translucent|PF_NoDepthTest);
|
HWD.pfnDrawPolygon(&Surf, v, 4, PF_NoTexture|PF_Modulated|PF_Translucent|PF_NoDepthTest);
|
||||||
}
|
}
|
||||||
|
@ -632,13 +587,13 @@ void HWR_DrawConsoleBack(UINT32 color, INT32 height)
|
||||||
v[2].y = v[3].y = 1.0f;
|
v[2].y = v[3].y = 1.0f;
|
||||||
v[0].z = v[1].z = v[2].z = v[3].z = 1.0f;
|
v[0].z = v[1].z = v[2].z = v[3].z = 1.0f;
|
||||||
|
|
||||||
v[0].sow = v[3].sow = 0.0f;
|
v[0].s = v[3].s = 0.0f;
|
||||||
v[2].sow = v[1].sow = 1.0f;
|
v[2].s = v[1].s = 1.0f;
|
||||||
v[0].tow = v[1].tow = 1.0f;
|
v[0].t = v[1].t = 1.0f;
|
||||||
v[2].tow = v[3].tow = 0.0f;
|
v[2].t = v[3].t = 0.0f;
|
||||||
|
|
||||||
Surf.FlatColor.rgba = UINT2RGBA(color);
|
Surf.PolyColor.rgba = UINT2RGBA(color);
|
||||||
Surf.FlatColor.s.alpha = 0x80;
|
Surf.PolyColor.s.alpha = 0x80;
|
||||||
|
|
||||||
HWD.pfnDrawPolygon(&Surf, v, 4, PF_NoTexture|PF_Modulated|PF_Translucent|PF_NoDepthTest);
|
HWD.pfnDrawPolygon(&Surf, v, 4, PF_NoTexture|PF_Modulated|PF_Translucent|PF_NoDepthTest);
|
||||||
}
|
}
|
||||||
|
@ -773,6 +728,7 @@ void HWR_DrawViewBorder(INT32 clearlines)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// ==========================================================================
|
// ==========================================================================
|
||||||
// AM_MAP.C DRAWING STUFF
|
// AM_MAP.C DRAWING STUFF
|
||||||
// ==========================================================================
|
// ==========================================================================
|
||||||
|
@ -797,225 +753,6 @@ void HWR_drawAMline(const fline_t *fl, INT32 color)
|
||||||
HWD.pfnDraw2DLine(&v1, &v2, color_rgba);
|
HWD.pfnDraw2DLine(&v1, &v2, color_rgba);
|
||||||
}
|
}
|
||||||
|
|
||||||
// -----------------+
|
|
||||||
// HWR_DrawFill : draw flat coloured rectangle, with no texture
|
|
||||||
// -----------------+
|
|
||||||
void HWR_DrawFill(INT32 x, INT32 y, INT32 w, INT32 h, INT32 color)
|
|
||||||
{
|
|
||||||
FOutVector v[4];
|
|
||||||
FSurfaceInfo Surf;
|
|
||||||
float fx, fy, fw, fh;
|
|
||||||
|
|
||||||
if (w < 0 || h < 0)
|
|
||||||
return; // consistency w/ software
|
|
||||||
|
|
||||||
// 3--2
|
|
||||||
// | /|
|
|
||||||
// |/ |
|
|
||||||
// 0--1
|
|
||||||
|
|
||||||
fx = (float)x;
|
|
||||||
fy = (float)y;
|
|
||||||
fw = (float)w;
|
|
||||||
fh = (float)h;
|
|
||||||
|
|
||||||
if (!(color & V_NOSCALESTART))
|
|
||||||
{
|
|
||||||
float dupx = (float)vid.dupx, dupy = (float)vid.dupy;
|
|
||||||
|
|
||||||
if (x == 0 && y == 0 && w == BASEVIDWIDTH && h == BASEVIDHEIGHT)
|
|
||||||
{
|
|
||||||
RGBA_t rgbaColour = V_GetColor(color);
|
|
||||||
FRGBAFloat clearColour;
|
|
||||||
clearColour.red = (float)rgbaColour.s.red / 255;
|
|
||||||
clearColour.green = (float)rgbaColour.s.green / 255;
|
|
||||||
clearColour.blue = (float)rgbaColour.s.blue / 255;
|
|
||||||
clearColour.alpha = 1;
|
|
||||||
HWD.pfnClearBuffer(true, false, &clearColour);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
fx *= dupx;
|
|
||||||
fy *= dupy;
|
|
||||||
fw *= dupx;
|
|
||||||
fh *= dupy;
|
|
||||||
|
|
||||||
if (fabsf((float)vid.width - (float)BASEVIDWIDTH * dupx) > 1.0E-36f)
|
|
||||||
{
|
|
||||||
if (color & V_SNAPTORIGHT)
|
|
||||||
fx += ((float)vid.width - ((float)BASEVIDWIDTH * dupx));
|
|
||||||
else if (!(color & V_SNAPTOLEFT))
|
|
||||||
fx += ((float)vid.width - ((float)BASEVIDWIDTH * dupx)) / 2;
|
|
||||||
}
|
|
||||||
if (fabsf((float)vid.height - (float)BASEVIDHEIGHT * dupy) > 1.0E-36f)
|
|
||||||
{
|
|
||||||
// same thing here
|
|
||||||
if (color & V_SNAPTOBOTTOM)
|
|
||||||
fy += ((float)vid.height - ((float)BASEVIDHEIGHT * dupy));
|
|
||||||
else if (!(color & V_SNAPTOTOP))
|
|
||||||
fy += ((float)vid.height - ((float)BASEVIDHEIGHT * dupy)) / 2;
|
|
||||||
}
|
|
||||||
if (color & V_SPLITSCREEN)
|
|
||||||
fy += ((float)BASEVIDHEIGHT * dupy)/2;
|
|
||||||
if (color & V_HORZSCREEN)
|
|
||||||
fx += ((float)BASEVIDWIDTH * dupx)/2;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (fx >= vid.width || fy >= vid.height)
|
|
||||||
return;
|
|
||||||
if (fx < 0)
|
|
||||||
{
|
|
||||||
fw += fx;
|
|
||||||
fx = 0;
|
|
||||||
}
|
|
||||||
if (fy < 0)
|
|
||||||
{
|
|
||||||
fh += fy;
|
|
||||||
fy = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (fw <= 0 || fh <= 0)
|
|
||||||
return;
|
|
||||||
if (fx + fw > vid.width)
|
|
||||||
fw = (float)vid.width - fx;
|
|
||||||
if (fy + fh > vid.height)
|
|
||||||
fh = (float)vid.height - fy;
|
|
||||||
|
|
||||||
fx = -1 + fx / (vid.width / 2);
|
|
||||||
fy = 1 - fy / (vid.height / 2);
|
|
||||||
fw = fw / (vid.width / 2);
|
|
||||||
fh = fh / (vid.height / 2);
|
|
||||||
|
|
||||||
v[0].x = v[3].x = fx;
|
|
||||||
v[2].x = v[1].x = fx + fw;
|
|
||||||
v[0].y = v[1].y = fy;
|
|
||||||
v[2].y = v[3].y = fy - fh;
|
|
||||||
|
|
||||||
//Hurdler: do we still use this argb color? if not, we should remove it
|
|
||||||
v[0].argb = v[1].argb = v[2].argb = v[3].argb = 0xff00ff00; //;
|
|
||||||
v[0].z = v[1].z = v[2].z = v[3].z = 1.0f;
|
|
||||||
|
|
||||||
v[0].sow = v[3].sow = 0.0f;
|
|
||||||
v[2].sow = v[1].sow = 1.0f;
|
|
||||||
v[0].tow = v[1].tow = 0.0f;
|
|
||||||
v[2].tow = v[3].tow = 1.0f;
|
|
||||||
|
|
||||||
Surf.FlatColor = V_GetColor(color);
|
|
||||||
|
|
||||||
HWD.pfnDrawPolygon(&Surf, v, 4,
|
|
||||||
PF_Modulated|PF_NoTexture|PF_NoDepthTest);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// -------------------+
|
|
||||||
// HWR_DrawConsoleFill : draw flat coloured transparent rectangle because that's cool, and hw sucks less than sw for that.
|
|
||||||
// -------------------+
|
|
||||||
void HWR_DrawConsoleFill(INT32 x, INT32 y, INT32 w, INT32 h, UINT32 color, INT32 options)
|
|
||||||
{
|
|
||||||
FOutVector v[4];
|
|
||||||
FSurfaceInfo Surf;
|
|
||||||
float fx, fy, fw, fh;
|
|
||||||
|
|
||||||
if (w < 0 || h < 0)
|
|
||||||
return; // consistency w/ software
|
|
||||||
|
|
||||||
// 3--2
|
|
||||||
// | /|
|
|
||||||
// |/ |
|
|
||||||
// 0--1
|
|
||||||
|
|
||||||
fx = (float)x;
|
|
||||||
fy = (float)y;
|
|
||||||
fw = (float)w;
|
|
||||||
fh = (float)h;
|
|
||||||
|
|
||||||
if (!(options & V_NOSCALESTART))
|
|
||||||
{
|
|
||||||
float dupx = (float)vid.dupx, dupy = (float)vid.dupy;
|
|
||||||
|
|
||||||
if (x == 0 && y == 0 && w == BASEVIDWIDTH && h == BASEVIDHEIGHT)
|
|
||||||
{
|
|
||||||
RGBA_t rgbaColour = V_GetColor(color);
|
|
||||||
FRGBAFloat clearColour;
|
|
||||||
clearColour.red = (float)rgbaColour.s.red / 255;
|
|
||||||
clearColour.green = (float)rgbaColour.s.green / 255;
|
|
||||||
clearColour.blue = (float)rgbaColour.s.blue / 255;
|
|
||||||
clearColour.alpha = 1;
|
|
||||||
HWD.pfnClearBuffer(true, false, &clearColour);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
fx *= dupx;
|
|
||||||
fy *= dupy;
|
|
||||||
fw *= dupx;
|
|
||||||
fh *= dupy;
|
|
||||||
|
|
||||||
if (fabsf((float)vid.width - ((float)BASEVIDWIDTH * dupx)) > 1.0E-36f)
|
|
||||||
{
|
|
||||||
if (options & V_SNAPTORIGHT)
|
|
||||||
fx += ((float)vid.width - ((float)BASEVIDWIDTH * dupx));
|
|
||||||
else if (!(options & V_SNAPTOLEFT))
|
|
||||||
fx += ((float)vid.width - ((float)BASEVIDWIDTH * dupx)) / 2;
|
|
||||||
}
|
|
||||||
if (fabsf((float)vid.height - ((float)BASEVIDHEIGHT * dupy)) > 1.0E-36f)
|
|
||||||
{
|
|
||||||
// same thing here
|
|
||||||
if (options & V_SNAPTOBOTTOM)
|
|
||||||
fy += ((float)vid.height - ((float)BASEVIDHEIGHT * dupy));
|
|
||||||
else if (!(options & V_SNAPTOTOP))
|
|
||||||
fy += ((float)vid.height - ((float)BASEVIDHEIGHT * dupy)) / 2;
|
|
||||||
}
|
|
||||||
if (options & V_SPLITSCREEN)
|
|
||||||
fy += ((float)BASEVIDHEIGHT * dupy)/2;
|
|
||||||
if (options & V_HORZSCREEN)
|
|
||||||
fx += ((float)BASEVIDWIDTH * dupx)/2;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (fx >= vid.width || fy >= vid.height)
|
|
||||||
return;
|
|
||||||
if (fx < 0)
|
|
||||||
{
|
|
||||||
fw += fx;
|
|
||||||
fx = 0;
|
|
||||||
}
|
|
||||||
if (fy < 0)
|
|
||||||
{
|
|
||||||
fh += fy;
|
|
||||||
fy = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (fw <= 0 || fh <= 0)
|
|
||||||
return;
|
|
||||||
if (fx + fw > vid.width)
|
|
||||||
fw = (float)vid.width - fx;
|
|
||||||
if (fy + fh > vid.height)
|
|
||||||
fh = (float)vid.height - fy;
|
|
||||||
|
|
||||||
fx = -1 + fx / (vid.width / 2);
|
|
||||||
fy = 1 - fy / (vid.height / 2);
|
|
||||||
fw = fw / (vid.width / 2);
|
|
||||||
fh = fh / (vid.height / 2);
|
|
||||||
|
|
||||||
v[0].x = v[3].x = fx;
|
|
||||||
v[2].x = v[1].x = fx + fw;
|
|
||||||
v[0].y = v[1].y = fy;
|
|
||||||
v[2].y = v[3].y = fy - fh;
|
|
||||||
|
|
||||||
//Hurdler: do we still use this argb color? if not, we should remove it
|
|
||||||
v[0].argb = v[1].argb = v[2].argb = v[3].argb = 0xff00ff00; //;
|
|
||||||
v[0].z = v[1].z = v[2].z = v[3].z = 1.0f;
|
|
||||||
|
|
||||||
v[0].sow = v[3].sow = 0.0f;
|
|
||||||
v[2].sow = v[1].sow = 1.0f;
|
|
||||||
v[0].tow = v[1].tow = 0.0f;
|
|
||||||
v[2].tow = v[3].tow = 1.0f;
|
|
||||||
|
|
||||||
Surf.FlatColor.rgba = UINT2RGBA(color);
|
|
||||||
Surf.FlatColor.s.alpha = 0x80;
|
|
||||||
|
|
||||||
HWD.pfnDrawPolygon(&Surf, v, 4, PF_NoTexture|PF_Modulated|PF_Translucent|PF_NoDepthTest);
|
|
||||||
}
|
|
||||||
|
|
||||||
// -----------------+
|
// -----------------+
|
||||||
// HWR_DrawDiag : draw flat coloured rectangle, with no texture
|
// HWR_DrawDiag : draw flat coloured rectangle, with no texture
|
||||||
// -----------------+
|
// -----------------+
|
||||||
|
@ -1097,22 +834,234 @@ void HWR_DrawDiag(INT32 x, INT32 y, INT32 wh, INT32 color)
|
||||||
v[3].y = fy - fh;
|
v[3].y = fy - fh;
|
||||||
v[2].y = fy - fwait;
|
v[2].y = fy - fwait;
|
||||||
|
|
||||||
//Hurdler: do we still use this argb color? if not, we should remove it
|
|
||||||
v[0].argb = v[1].argb = v[2].argb = v[3].argb = 0xff00ff00; //;
|
|
||||||
v[0].z = v[1].z = v[2].z = v[3].z = 1.0f;
|
v[0].z = v[1].z = v[2].z = v[3].z = 1.0f;
|
||||||
|
|
||||||
v[0].sow = v[3].sow = 0.0f;
|
v[0].s = v[3].s = 0.0f;
|
||||||
v[2].sow = v[1].sow = 1.0f;
|
v[2].s = v[1].s = 1.0f;
|
||||||
v[0].tow = v[1].tow = 0.0f;
|
v[0].t = v[1].t = 0.0f;
|
||||||
v[2].tow = v[3].tow = 1.0f;
|
v[2].t = v[3].t = 1.0f;
|
||||||
|
|
||||||
Surf.FlatColor = V_GetColor(color);
|
Surf.PolyColor = V_GetColor(color);
|
||||||
|
|
||||||
HWD.pfnDrawPolygon(&Surf, v, 4,
|
HWD.pfnDrawPolygon(&Surf, v, 4,
|
||||||
PF_Modulated|PF_NoTexture|PF_NoDepthTest);
|
PF_Modulated|PF_NoTexture|PF_NoDepthTest);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// -------------------+
|
||||||
|
// HWR_DrawConsoleFill : draw flat coloured transparent rectangle because that's cool, and hw sucks less than sw for that.
|
||||||
|
// -------------------+
|
||||||
|
void HWR_DrawConsoleFill(INT32 x, INT32 y, INT32 w, INT32 h, UINT32 color, INT32 options)
|
||||||
|
{
|
||||||
|
FOutVector v[4];
|
||||||
|
FSurfaceInfo Surf;
|
||||||
|
float fx, fy, fw, fh;
|
||||||
|
|
||||||
|
if (w < 0 || h < 0)
|
||||||
|
return; // consistency w/ software
|
||||||
|
|
||||||
|
// 3--2
|
||||||
|
// | /|
|
||||||
|
// |/ |
|
||||||
|
// 0--1
|
||||||
|
|
||||||
|
fx = (float)x;
|
||||||
|
fy = (float)y;
|
||||||
|
fw = (float)w;
|
||||||
|
fh = (float)h;
|
||||||
|
|
||||||
|
if (!(options & V_NOSCALESTART))
|
||||||
|
{
|
||||||
|
float dupx = (float)vid.dupx, dupy = (float)vid.dupy;
|
||||||
|
|
||||||
|
if (x == 0 && y == 0 && w == BASEVIDWIDTH && h == BASEVIDHEIGHT)
|
||||||
|
{
|
||||||
|
RGBA_t rgbaColour = V_GetColor(color);
|
||||||
|
FRGBAFloat clearColour;
|
||||||
|
clearColour.red = (float)rgbaColour.s.red / 255;
|
||||||
|
clearColour.green = (float)rgbaColour.s.green / 255;
|
||||||
|
clearColour.blue = (float)rgbaColour.s.blue / 255;
|
||||||
|
clearColour.alpha = 1;
|
||||||
|
HWD.pfnClearBuffer(true, false, &clearColour);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
fx *= dupx;
|
||||||
|
fy *= dupy;
|
||||||
|
fw *= dupx;
|
||||||
|
fh *= dupy;
|
||||||
|
|
||||||
|
if (fabsf((float)vid.width - ((float)BASEVIDWIDTH * dupx)) > 1.0E-36f)
|
||||||
|
{
|
||||||
|
if (options & V_SNAPTORIGHT)
|
||||||
|
fx += ((float)vid.width - ((float)BASEVIDWIDTH * dupx));
|
||||||
|
else if (!(options & V_SNAPTOLEFT))
|
||||||
|
fx += ((float)vid.width - ((float)BASEVIDWIDTH * dupx)) / 2;
|
||||||
|
}
|
||||||
|
if (fabsf((float)vid.height - ((float)BASEVIDHEIGHT * dupy)) > 1.0E-36f)
|
||||||
|
{
|
||||||
|
// same thing here
|
||||||
|
if (options & V_SNAPTOBOTTOM)
|
||||||
|
fy += ((float)vid.height - ((float)BASEVIDHEIGHT * dupy));
|
||||||
|
else if (!(options & V_SNAPTOTOP))
|
||||||
|
fy += ((float)vid.height - ((float)BASEVIDHEIGHT * dupy)) / 2;
|
||||||
|
}
|
||||||
|
if (options & V_SPLITSCREEN)
|
||||||
|
fy += ((float)BASEVIDHEIGHT * dupy)/2;
|
||||||
|
if (options & V_HORZSCREEN)
|
||||||
|
fx += ((float)BASEVIDWIDTH * dupx)/2;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
if (fx >= vid.width || fy >= vid.height)
|
||||||
|
return;
|
||||||
|
if (fx < 0)
|
||||||
|
{
|
||||||
|
fw += fx;
|
||||||
|
fx = 0;
|
||||||
|
}
|
||||||
|
if (fy < 0)
|
||||||
|
{
|
||||||
|
fh += fy;
|
||||||
|
fy = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (fw <= 0 || fh <= 0)
|
||||||
|
return;
|
||||||
|
if (fx + fw > vid.width)
|
||||||
|
fw = (float)vid.width - fx;
|
||||||
|
if (fy + fh > vid.height)
|
||||||
|
fh = (float)vid.height - fy;
|
||||||
|
|
||||||
|
fx = -1 + fx / (vid.width / 2);
|
||||||
|
fy = 1 - fy / (vid.height / 2);
|
||||||
|
fw = fw / (vid.width / 2);
|
||||||
|
fh = fh / (vid.height / 2);
|
||||||
|
|
||||||
|
v[0].x = v[3].x = fx;
|
||||||
|
v[2].x = v[1].x = fx + fw;
|
||||||
|
v[0].y = v[1].y = fy;
|
||||||
|
v[2].y = v[3].y = fy - fh;
|
||||||
|
|
||||||
|
v[0].z = v[1].z = v[2].z = v[3].z = 1.0f;
|
||||||
|
|
||||||
|
v[0].s = v[3].s = 0.0f;
|
||||||
|
v[2].s = v[1].s = 1.0f;
|
||||||
|
v[0].t = v[1].t = 0.0f;
|
||||||
|
v[2].t = v[3].t = 1.0f;
|
||||||
|
|
||||||
|
Surf.PolyColor.rgba = UINT2RGBA(color);
|
||||||
|
Surf.PolyColor.s.alpha = 0x80;
|
||||||
|
|
||||||
|
HWD.pfnDrawPolygon(&Surf, v, 4, PF_NoTexture|PF_Modulated|PF_Translucent|PF_NoDepthTest);
|
||||||
|
}
|
||||||
|
|
||||||
|
// -----------------+
|
||||||
|
// HWR_DrawFill : draw flat coloured rectangle, with no texture
|
||||||
|
// -----------------+
|
||||||
|
void HWR_DrawFill(INT32 x, INT32 y, INT32 w, INT32 h, INT32 color)
|
||||||
|
{
|
||||||
|
FOutVector v[4];
|
||||||
|
FSurfaceInfo Surf;
|
||||||
|
float fx, fy, fw, fh;
|
||||||
|
|
||||||
|
if (w < 0 || h < 0)
|
||||||
|
return; // consistency w/ software
|
||||||
|
|
||||||
|
// 3--2
|
||||||
|
// | /|
|
||||||
|
// |/ |
|
||||||
|
// 0--1
|
||||||
|
|
||||||
|
fx = (float)x;
|
||||||
|
fy = (float)y;
|
||||||
|
fw = (float)w;
|
||||||
|
fh = (float)h;
|
||||||
|
|
||||||
|
if (!(color & V_NOSCALESTART))
|
||||||
|
{
|
||||||
|
float dupx = (float)vid.dupx, dupy = (float)vid.dupy;
|
||||||
|
|
||||||
|
if (x == 0 && y == 0 && w == BASEVIDWIDTH && h == BASEVIDHEIGHT)
|
||||||
|
{
|
||||||
|
RGBA_t rgbaColour = V_GetColor(color);
|
||||||
|
FRGBAFloat clearColour;
|
||||||
|
clearColour.red = (float)rgbaColour.s.red / 255;
|
||||||
|
clearColour.green = (float)rgbaColour.s.green / 255;
|
||||||
|
clearColour.blue = (float)rgbaColour.s.blue / 255;
|
||||||
|
clearColour.alpha = 1;
|
||||||
|
HWD.pfnClearBuffer(true, false, &clearColour);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
fx *= dupx;
|
||||||
|
fy *= dupy;
|
||||||
|
fw *= dupx;
|
||||||
|
fh *= dupy;
|
||||||
|
|
||||||
|
if (fabsf((float)vid.width - (float)BASEVIDWIDTH * dupx) > 1.0E-36f)
|
||||||
|
{
|
||||||
|
if (color & V_SNAPTORIGHT)
|
||||||
|
fx += ((float)vid.width - ((float)BASEVIDWIDTH * dupx));
|
||||||
|
else if (!(color & V_SNAPTOLEFT))
|
||||||
|
fx += ((float)vid.width - ((float)BASEVIDWIDTH * dupx)) / 2;
|
||||||
|
}
|
||||||
|
if (fabsf((float)vid.height - (float)BASEVIDHEIGHT * dupy) > 1.0E-36f)
|
||||||
|
{
|
||||||
|
// same thing here
|
||||||
|
if (color & V_SNAPTOBOTTOM)
|
||||||
|
fy += ((float)vid.height - ((float)BASEVIDHEIGHT * dupy));
|
||||||
|
else if (!(color & V_SNAPTOTOP))
|
||||||
|
fy += ((float)vid.height - ((float)BASEVIDHEIGHT * dupy)) / 2;
|
||||||
|
}
|
||||||
|
if (color & V_SPLITSCREEN)
|
||||||
|
fy += ((float)BASEVIDHEIGHT * dupy)/2;
|
||||||
|
if (color & V_HORZSCREEN)
|
||||||
|
fx += ((float)BASEVIDWIDTH * dupx)/2;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
if (fx >= vid.width || fy >= vid.height)
|
||||||
|
return;
|
||||||
|
if (fx < 0)
|
||||||
|
{
|
||||||
|
fw += fx;
|
||||||
|
fx = 0;
|
||||||
|
}
|
||||||
|
if (fy < 0)
|
||||||
|
{
|
||||||
|
fh += fy;
|
||||||
|
fy = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (fw <= 0 || fh <= 0)
|
||||||
|
return;
|
||||||
|
if (fx + fw > vid.width)
|
||||||
|
fw = (float)vid.width - fx;
|
||||||
|
if (fy + fh > vid.height)
|
||||||
|
fh = (float)vid.height - fy;
|
||||||
|
|
||||||
|
fx = -1 + fx / (vid.width / 2);
|
||||||
|
fy = 1 - fy / (vid.height / 2);
|
||||||
|
fw = fw / (vid.width / 2);
|
||||||
|
fh = fh / (vid.height / 2);
|
||||||
|
|
||||||
|
v[0].x = v[3].x = fx;
|
||||||
|
v[2].x = v[1].x = fx + fw;
|
||||||
|
v[0].y = v[1].y = fy;
|
||||||
|
v[2].y = v[3].y = fy - fh;
|
||||||
|
|
||||||
|
v[0].z = v[1].z = v[2].z = v[3].z = 1.0f;
|
||||||
|
|
||||||
|
v[0].s = v[3].s = 0.0f;
|
||||||
|
v[2].s = v[1].s = 1.0f;
|
||||||
|
v[0].t = v[1].t = 0.0f;
|
||||||
|
v[2].t = v[3].t = 1.0f;
|
||||||
|
|
||||||
|
Surf.PolyColor = V_GetColor(color);
|
||||||
|
|
||||||
|
HWD.pfnDrawPolygon(&Surf, v, 4,
|
||||||
|
PF_Modulated|PF_NoTexture|PF_NoDepthTest);
|
||||||
|
}
|
||||||
|
|
||||||
#ifdef HAVE_PNG
|
#ifdef HAVE_PNG
|
||||||
|
|
||||||
|
@ -1196,21 +1145,24 @@ UINT8 *HWR_GetScreenshot(void)
|
||||||
return buf;
|
return buf;
|
||||||
}
|
}
|
||||||
|
|
||||||
boolean HWR_Screenshot(const char *lbmname)
|
boolean HWR_Screenshot(const char *pathname)
|
||||||
{
|
{
|
||||||
boolean ret;
|
boolean ret;
|
||||||
UINT8 *buf = malloc(vid.width * vid.height * 3 * sizeof (*buf));
|
UINT8 *buf = malloc(vid.width * vid.height * 3 * sizeof (*buf));
|
||||||
|
|
||||||
if (!buf)
|
if (!buf)
|
||||||
|
{
|
||||||
|
CONS_Debug(DBG_RENDER, "HWR_Screenshot: Failed to allocate memory\n");
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
// returns 24bit 888 RGB
|
// returns 24bit 888 RGB
|
||||||
HWD.pfnReadRect(0, 0, vid.width, vid.height, vid.width * 3, (void *)buf);
|
HWD.pfnReadRect(0, 0, vid.width, vid.height, vid.width * 3, (void *)buf);
|
||||||
|
|
||||||
#ifdef USE_PNG
|
#ifdef USE_PNG
|
||||||
ret = M_SavePNG(lbmname, buf, vid.width, vid.height, NULL);
|
ret = M_SavePNG(pathname, buf, vid.width, vid.height, NULL);
|
||||||
#else
|
#else
|
||||||
ret = saveTGA(lbmname, buf, vid.width, vid.height);
|
ret = saveTGA(pathname, buf, vid.width, vid.height);
|
||||||
#endif
|
#endif
|
||||||
free(buf);
|
free(buf);
|
||||||
return ret;
|
return ret;
|
||||||
|
|
|
@ -1,21 +1,15 @@
|
||||||
// Emacs style mode select -*- C++ -*-
|
// SONIC ROBO BLAST 2
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
//
|
// Copyright (C) 1993-1996 by id Software, Inc.
|
||||||
// Copyright (C) 1998-2000 by DooM Legacy Team.
|
// Copyright (C) 1998-2000 by DooM Legacy Team.
|
||||||
|
// Copyright (C) 1999-2019 by Sonic Team Junior.
|
||||||
//
|
//
|
||||||
// This program is free software; you can redistribute it and/or
|
// This program is free software distributed under the
|
||||||
// modify it under the terms of the GNU General Public License
|
// terms of the GNU General Public License, version 2.
|
||||||
// as published by the Free Software Foundation; either version 2
|
// See the 'LICENSE' file for more details.
|
||||||
// of the License, or (at your option) any later version.
|
|
||||||
//
|
|
||||||
// This program is distributed in the hope that it will be useful,
|
|
||||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
// GNU General Public License for more details.
|
|
||||||
//
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
/// \file
|
/// \file
|
||||||
/// \brief imports/exports for the 3D hardware low-level interface API
|
/// \brief imports/exports for the GPU hardware low-level interface API
|
||||||
|
|
||||||
#ifndef __HWR_DRV_H__
|
#ifndef __HWR_DRV_H__
|
||||||
#define __HWR_DRV_H__
|
#define __HWR_DRV_H__
|
||||||
|
@ -32,13 +26,7 @@
|
||||||
// STANDARD DLL EXPORTS
|
// STANDARD DLL EXPORTS
|
||||||
// ==========================================================================
|
// ==========================================================================
|
||||||
|
|
||||||
EXPORT boolean HWRAPI(Init) (I_Error_t ErrorFunction);
|
EXPORT boolean HWRAPI(Init) (void);
|
||||||
#ifndef HAVE_SDL
|
|
||||||
EXPORT void HWRAPI(Shutdown) (void);
|
|
||||||
#endif
|
|
||||||
#ifdef _WINDOWS
|
|
||||||
EXPORT void HWRAPI(GetModeList) (vmode_t **pvidmodes, INT32 *numvidmodes);
|
|
||||||
#endif
|
|
||||||
#if defined (PURESDL) || defined (macintosh)
|
#if defined (PURESDL) || defined (macintosh)
|
||||||
EXPORT void HWRAPI(SetPalette) (INT32 *, RGBA_t *gamma);
|
EXPORT void HWRAPI(SetPalette) (INT32 *, RGBA_t *gamma);
|
||||||
#else
|
#else
|
||||||
|
@ -58,14 +46,11 @@ EXPORT void HWRAPI(ClearMipMapCache) (void);
|
||||||
EXPORT void HWRAPI(SetSpecialState) (hwdspecialstate_t IdState, INT32 Value);
|
EXPORT void HWRAPI(SetSpecialState) (hwdspecialstate_t IdState, INT32 Value);
|
||||||
|
|
||||||
//Hurdler: added for new development
|
//Hurdler: added for new development
|
||||||
EXPORT void HWRAPI(DrawModel) (model_t *model, INT32 frameIndex, INT32 duration, INT32 tics, INT32 nextFrameIndex, FTransform *pos, float scale, UINT8 flipped, UINT8 *color);
|
EXPORT void HWRAPI(DrawModel) (model_t *model, INT32 frameIndex, INT32 duration, INT32 tics, INT32 nextFrameIndex, FTransform *pos, float scale, UINT8 flipped, FSurfaceInfo *Surface);
|
||||||
EXPORT void HWRAPI(CreateModelVBOs) (model_t *model);
|
EXPORT void HWRAPI(CreateModelVBOs) (model_t *model);
|
||||||
EXPORT void HWRAPI(SetTransform) (FTransform *ptransform);
|
EXPORT void HWRAPI(SetTransform) (FTransform *stransform);
|
||||||
EXPORT INT32 HWRAPI(GetTextureUsed) (void);
|
EXPORT INT32 HWRAPI(GetTextureUsed) (void);
|
||||||
EXPORT INT32 HWRAPI(GetRenderVersion) (void);
|
|
||||||
|
|
||||||
#define SCREENVERTS 10
|
|
||||||
EXPORT void HWRAPI(PostImgRedraw) (float points[SCREENVERTS][SCREENVERTS][2]);
|
|
||||||
EXPORT void HWRAPI(FlushScreenTextures) (void);
|
EXPORT void HWRAPI(FlushScreenTextures) (void);
|
||||||
EXPORT void HWRAPI(StartScreenWipe) (void);
|
EXPORT void HWRAPI(StartScreenWipe) (void);
|
||||||
EXPORT void HWRAPI(EndScreenWipe) (void);
|
EXPORT void HWRAPI(EndScreenWipe) (void);
|
||||||
|
@ -74,6 +59,19 @@ EXPORT void HWRAPI(DrawIntermissionBG) (void);
|
||||||
EXPORT void HWRAPI(MakeScreenTexture) (void);
|
EXPORT void HWRAPI(MakeScreenTexture) (void);
|
||||||
EXPORT void HWRAPI(MakeScreenFinalTexture) (void);
|
EXPORT void HWRAPI(MakeScreenFinalTexture) (void);
|
||||||
EXPORT void HWRAPI(DrawScreenFinalTexture) (int width, int height);
|
EXPORT void HWRAPI(DrawScreenFinalTexture) (int width, int height);
|
||||||
|
|
||||||
|
#define SCREENVERTS 10
|
||||||
|
EXPORT void HWRAPI(PostImgRedraw) (float points[SCREENVERTS][SCREENVERTS][2]);
|
||||||
|
|
||||||
|
// jimita
|
||||||
|
EXPORT void HWRAPI(LoadShaders) (void);
|
||||||
|
EXPORT void HWRAPI(KillShaders) (void);
|
||||||
|
EXPORT void HWRAPI(SetShader) (int shader);
|
||||||
|
EXPORT void HWRAPI(UnSetShader) (void);
|
||||||
|
|
||||||
|
EXPORT void HWRAPI(LoadCustomShader) (int number, char *shader, size_t size, boolean fragment);
|
||||||
|
EXPORT void HWRAPI(InitCustomShaders) (void);
|
||||||
|
|
||||||
// ==========================================================================
|
// ==========================================================================
|
||||||
// HWR DRIVER OBJECT, FOR CLIENT PROGRAM
|
// HWR DRIVER OBJECT, FOR CLIENT PROGRAM
|
||||||
// ==========================================================================
|
// ==========================================================================
|
||||||
|
@ -93,18 +91,11 @@ struct hwdriver_s
|
||||||
ReadRect pfnReadRect;
|
ReadRect pfnReadRect;
|
||||||
GClipRect pfnGClipRect;
|
GClipRect pfnGClipRect;
|
||||||
ClearMipMapCache pfnClearMipMapCache;
|
ClearMipMapCache pfnClearMipMapCache;
|
||||||
SetSpecialState pfnSetSpecialState;//Hurdler: added for backward compatibility
|
SetSpecialState pfnSetSpecialState;
|
||||||
DrawModel pfnDrawModel;
|
DrawModel pfnDrawModel;
|
||||||
CreateModelVBOs pfnCreateModelVBOs;
|
CreateModelVBOs pfnCreateModelVBOs;
|
||||||
SetTransform pfnSetTransform;
|
SetTransform pfnSetTransform;
|
||||||
GetTextureUsed pfnGetTextureUsed;
|
GetTextureUsed pfnGetTextureUsed;
|
||||||
GetRenderVersion pfnGetRenderVersion;
|
|
||||||
#ifdef _WINDOWS
|
|
||||||
GetModeList pfnGetModeList;
|
|
||||||
#endif
|
|
||||||
#ifndef HAVE_SDL
|
|
||||||
Shutdown pfnShutdown;
|
|
||||||
#endif
|
|
||||||
PostImgRedraw pfnPostImgRedraw;
|
PostImgRedraw pfnPostImgRedraw;
|
||||||
FlushScreenTextures pfnFlushScreenTextures;
|
FlushScreenTextures pfnFlushScreenTextures;
|
||||||
StartScreenWipe pfnStartScreenWipe;
|
StartScreenWipe pfnStartScreenWipe;
|
||||||
|
@ -114,16 +105,20 @@ struct hwdriver_s
|
||||||
MakeScreenTexture pfnMakeScreenTexture;
|
MakeScreenTexture pfnMakeScreenTexture;
|
||||||
MakeScreenFinalTexture pfnMakeScreenFinalTexture;
|
MakeScreenFinalTexture pfnMakeScreenFinalTexture;
|
||||||
DrawScreenFinalTexture pfnDrawScreenFinalTexture;
|
DrawScreenFinalTexture pfnDrawScreenFinalTexture;
|
||||||
|
|
||||||
|
LoadShaders pfnLoadShaders;
|
||||||
|
KillShaders pfnKillShaders;
|
||||||
|
SetShader pfnSetShader;
|
||||||
|
UnSetShader pfnUnSetShader;
|
||||||
|
|
||||||
|
LoadCustomShader pfnLoadCustomShader;
|
||||||
|
InitCustomShaders pfnInitCustomShaders;
|
||||||
};
|
};
|
||||||
|
|
||||||
extern struct hwdriver_s hwdriver;
|
extern struct hwdriver_s hwdriver;
|
||||||
|
|
||||||
//Hurdler: 16/10/99: added for OpenGL gamma correction
|
|
||||||
//extern RGBA_t gamma_correction;
|
|
||||||
|
|
||||||
#define HWD hwdriver
|
#define HWD hwdriver
|
||||||
|
|
||||||
#endif //not defined _CREATE_DLL_
|
#endif //not defined _CREATE_DLL_
|
||||||
|
|
||||||
#endif //__HWR_DRV_H__
|
#endif //__HWR_DRV_H__
|
||||||
|
|
||||||
|
|
|
@ -1,71 +0,0 @@
|
||||||
// Emacs style mode select -*- C++ -*-
|
|
||||||
//-----------------------------------------------------------------------------
|
|
||||||
//
|
|
||||||
// Copyright (C) 1998-2000 by DooM Legacy Team.
|
|
||||||
//
|
|
||||||
// This program is free software; you can redistribute it and/or
|
|
||||||
// modify it under the terms of the GNU General Public License
|
|
||||||
// as published by the Free Software Foundation; either version 2
|
|
||||||
// of the License, or (at your option) any later version.
|
|
||||||
//
|
|
||||||
// This program is distributed in the hope that it will be useful,
|
|
||||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
// GNU General Public License for more details.
|
|
||||||
//-----------------------------------------------------------------------------
|
|
||||||
/// \file
|
|
||||||
/// \brief Declaration needed by Glide renderer
|
|
||||||
/// !!! To be replaced by our own def in the future !!!
|
|
||||||
|
|
||||||
#ifndef _GLIDE_H_
|
|
||||||
#define _GLIDE_H_
|
|
||||||
|
|
||||||
#ifndef __GLIDE_H__
|
|
||||||
|
|
||||||
typedef unsigned long FxU32;
|
|
||||||
typedef long FxI32;
|
|
||||||
|
|
||||||
typedef FxI32 GrAspectRatio_t;
|
|
||||||
#define GR_ASPECT_LOG2_8x1 3 /* 8W x 1H */
|
|
||||||
#define GR_ASPECT_LOG2_4x1 2 /* 4W x 1H */
|
|
||||||
#define GR_ASPECT_LOG2_2x1 1 /* 2W x 1H */
|
|
||||||
#define GR_ASPECT_LOG2_1x1 0 /* 1W x 1H */
|
|
||||||
#define GR_ASPECT_LOG2_1x2 -1 /* 1W x 2H */
|
|
||||||
#define GR_ASPECT_LOG2_1x4 -2 /* 1W x 4H */
|
|
||||||
#define GR_ASPECT_LOG2_1x8 -3 /* 1W x 8H */
|
|
||||||
|
|
||||||
typedef FxI32 GrLOD_t;
|
|
||||||
#define GR_LOD_LOG2_256 0x8
|
|
||||||
#define GR_LOD_LOG2_128 0x7
|
|
||||||
#define GR_LOD_LOG2_64 0x6
|
|
||||||
#define GR_LOD_LOG2_32 0x5
|
|
||||||
#define GR_LOD_LOG2_16 0x4
|
|
||||||
#define GR_LOD_LOG2_8 0x3
|
|
||||||
#define GR_LOD_LOG2_4 0x2
|
|
||||||
#define GR_LOD_LOG2_2 0x1
|
|
||||||
#define GR_LOD_LOG2_1 0x0
|
|
||||||
|
|
||||||
typedef FxI32 GrTextureFormat_t;
|
|
||||||
#define GR_TEXFMT_ALPHA_8 0x2 /* (0..0xFF) alpha */
|
|
||||||
#define GR_TEXFMT_INTENSITY_8 0x3 /* (0..0xFF) intensity */
|
|
||||||
#define GR_TEXFMT_ALPHA_INTENSITY_44 0x4
|
|
||||||
#define GR_TEXFMT_P_8 0x5 /* 8-bit palette */
|
|
||||||
#define GR_TEXFMT_RGB_565 0xa
|
|
||||||
#define GR_TEXFMT_ARGB_1555 0xb
|
|
||||||
#define GR_TEXFMT_ARGB_4444 0xc
|
|
||||||
#define GR_TEXFMT_ALPHA_INTENSITY_88 0xd
|
|
||||||
#define GR_TEXFMT_AP_88 0xe /* 8-bit alpha 8-bit palette */
|
|
||||||
#define GR_RGBA 0x6 // 32 bit RGBA !
|
|
||||||
|
|
||||||
typedef struct
|
|
||||||
{
|
|
||||||
GrLOD_t smallLodLog2;
|
|
||||||
GrLOD_t largeLodLog2;
|
|
||||||
GrAspectRatio_t aspectRatioLog2;
|
|
||||||
GrTextureFormat_t format;
|
|
||||||
void *data;
|
|
||||||
} GrTexInfo;
|
|
||||||
|
|
||||||
#endif // __GLIDE_H__ (defined in <glide.h>)
|
|
||||||
|
|
||||||
#endif // _GLIDE_H_
|
|
|
@ -1,18 +1,12 @@
|
||||||
// Emacs style mode select -*- C++ -*-
|
// SONIC ROBO BLAST 2
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
//
|
// Copyright (C) 1993-1996 by id Software, Inc.
|
||||||
// Copyright (C) 1998-2000 by DooM Legacy Team.
|
// Copyright (C) 1998-2000 by DooM Legacy Team.
|
||||||
|
// Copyright (C) 1999-2019 by Sonic Team Junior.
|
||||||
//
|
//
|
||||||
// This program is free software; you can redistribute it and/or
|
// This program is free software distributed under the
|
||||||
// modify it under the terms of the GNU General Public License
|
// terms of the GNU General Public License, version 2.
|
||||||
// as published by the Free Software Foundation; either version 2
|
// See the 'LICENSE' file for more details.
|
||||||
// of the License, or (at your option) any later version.
|
|
||||||
//
|
|
||||||
// This program is distributed in the hope that it will be useful,
|
|
||||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
// GNU General Public License for more details.
|
|
||||||
//
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
/// \file
|
/// \file
|
||||||
/// \brief globals (shared data & code) for hw_ modules
|
/// \brief globals (shared data & code) for hw_ modules
|
||||||
|
@ -21,78 +15,18 @@
|
||||||
#define _HWR_GLOB_H_
|
#define _HWR_GLOB_H_
|
||||||
|
|
||||||
#include "hw_defs.h"
|
#include "hw_defs.h"
|
||||||
#include "hw_main.h"
|
|
||||||
#include "../m_misc.h"
|
#include "../m_misc.h"
|
||||||
|
#include "../r_defs.h"
|
||||||
// the original aspect ratio of Doom graphics isn't square
|
|
||||||
#define ORIGINAL_ASPECT (320.0f/200.0f)
|
|
||||||
|
|
||||||
// Uncomment this to enable the OpenGL loading screen
|
// Uncomment this to enable the OpenGL loading screen
|
||||||
//#define HWR_LOADING_SCREEN
|
//#define HWR_LOADING_SCREEN
|
||||||
|
|
||||||
// -----------
|
|
||||||
// structures
|
|
||||||
// -----------
|
|
||||||
|
|
||||||
// a vertex of a Doom 'plane' polygon
|
|
||||||
typedef struct
|
|
||||||
{
|
|
||||||
float x;
|
|
||||||
float y;
|
|
||||||
float z;
|
|
||||||
} polyvertex_t;
|
|
||||||
|
|
||||||
#ifdef _MSC_VER
|
|
||||||
#pragma warning(disable : 4200)
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// a convex 'plane' polygon, clockwise order
|
|
||||||
typedef struct
|
|
||||||
{
|
|
||||||
INT32 numpts;
|
|
||||||
polyvertex_t pts[0];
|
|
||||||
} poly_t;
|
|
||||||
|
|
||||||
#ifdef _MSC_VER
|
|
||||||
#pragma warning(default : 4200)
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// holds extra info for 3D render, for each subsector in subsectors[]
|
|
||||||
typedef struct
|
|
||||||
{
|
|
||||||
poly_t *planepoly; // the generated convex polygon
|
|
||||||
} extrasubsector_t;
|
|
||||||
|
|
||||||
// needed for sprite rendering
|
|
||||||
// equivalent of the software renderer's vissprites
|
|
||||||
typedef struct gr_vissprite_s
|
|
||||||
{
|
|
||||||
// Doubly linked list
|
|
||||||
struct gr_vissprite_s *prev;
|
|
||||||
struct gr_vissprite_s *next;
|
|
||||||
float x1, x2;
|
|
||||||
float tz, ty;
|
|
||||||
lumpnum_t patchlumpnum;
|
|
||||||
boolean flip;
|
|
||||||
UINT8 translucency; //alpha level 0-255
|
|
||||||
mobj_t *mobj;
|
|
||||||
boolean precip; // Tails 08-25-2002
|
|
||||||
boolean vflip;
|
|
||||||
//Hurdler: 25/04/2000: now support colormap in hardware mode
|
|
||||||
UINT8 *colormap;
|
|
||||||
INT32 dispoffset; // copy of info->dispoffset, affects ordering but not drawing
|
|
||||||
float z1, z2;
|
|
||||||
} gr_vissprite_t;
|
|
||||||
|
|
||||||
// --------
|
// --------
|
||||||
// hw_bsp.c
|
// hw_bsp.c
|
||||||
// --------
|
// --------
|
||||||
extern extrasubsector_t *extrasubsectors;
|
extern extrasubsector_t *extrasubsectors;
|
||||||
extern size_t addsubsector;
|
extern size_t addsubsector;
|
||||||
|
|
||||||
void HWR_InitPolyPool(void);
|
|
||||||
void HWR_FreePolyPool(void);
|
|
||||||
|
|
||||||
// --------
|
// --------
|
||||||
// hw_cache.c
|
// hw_cache.c
|
||||||
// --------
|
// --------
|
||||||
|
@ -100,27 +34,28 @@ void HWR_InitTextureCache(void);
|
||||||
void HWR_FreeTextureCache(void);
|
void HWR_FreeTextureCache(void);
|
||||||
void HWR_FreeExtraSubsectors(void);
|
void HWR_FreeExtraSubsectors(void);
|
||||||
|
|
||||||
void HWR_GetFlat(lumpnum_t flatlumpnum);
|
void HWR_GetFlat(lumpnum_t flatlumpnum, boolean noencoremap);
|
||||||
|
// ^ some flats must NOT be remapped to encore, since we remap them as we cache them for ease, adding a toggle here seems wise.
|
||||||
|
|
||||||
GLTexture_t *HWR_GetTexture(INT32 tex);
|
GLTexture_t *HWR_GetTexture(INT32 tex);
|
||||||
void HWR_GetPatch(GLPatch_t *gpatch);
|
void HWR_GetPatch(GLPatch_t *gpatch);
|
||||||
void HWR_GetMappedPatch(GLPatch_t *gpatch, const UINT8 *colormap);
|
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_UnlockCachedPatch(GLPatch_t *gpatch);
|
void HWR_UnlockCachedPatch(GLPatch_t *gpatch);
|
||||||
GLPatch_t *HWR_GetPic(lumpnum_t lumpnum);
|
|
||||||
void HWR_SetPalette(RGBA_t *palette);
|
void HWR_SetPalette(RGBA_t *palette);
|
||||||
GLPatch_t *HWR_GetCachedGLPatchPwad(UINT16 wad, UINT16 lump);
|
GLPatch_t *HWR_GetCachedGLPatchPwad(UINT16 wad, UINT16 lump);
|
||||||
GLPatch_t *HWR_GetCachedGLPatch(lumpnum_t lumpnum);
|
GLPatch_t *HWR_GetCachedGLPatch(lumpnum_t lumpnum);
|
||||||
void HWR_GetFadeMask(lumpnum_t fademasklumpnum);
|
void HWR_GetFadeMask(lumpnum_t fademasklumpnum);
|
||||||
|
|
||||||
|
// hardware driver
|
||||||
|
extern INT32 gl_leveltime;
|
||||||
|
|
||||||
// --------
|
// --------
|
||||||
// hw_draw.c
|
// hw_draw.c
|
||||||
// --------
|
// --------
|
||||||
extern float gr_patch_scalex;
|
|
||||||
extern float gr_patch_scaley;
|
|
||||||
|
|
||||||
extern consvar_t cv_grrounddown; // on/off
|
extern consvar_t cv_grrounddown; // on/off
|
||||||
|
|
||||||
extern INT32 patchformat;
|
extern INT32 patchformat;
|
||||||
extern INT32 textureformat;
|
extern INT32 textureformat;
|
||||||
extern boolean firetranslucent;
|
|
||||||
|
|
||||||
#endif //_HW_GLOB_
|
#endif //_HW_GLOB_
|
File diff suppressed because it is too large
Load diff
|
@ -1,17 +1,12 @@
|
||||||
// Emacs style mode select -*- C++ -*-
|
// SONIC ROBO BLAST 2
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
//
|
// Copyright (C) 1993-1996 by id Software, Inc.
|
||||||
// Copyright (C) 1998-2000 by DooM Legacy Team.
|
// Copyright (C) 1998-2000 by DooM Legacy Team.
|
||||||
|
// Copyright (C) 1999-2019 by Sonic Team Junior.
|
||||||
//
|
//
|
||||||
// This program is free software; you can redistribute it and/or
|
// This program is free software distributed under the
|
||||||
// modify it under the terms of the GNU General Public License
|
// terms of the GNU General Public License, version 2.
|
||||||
// as published by the Free Software Foundation; either version 2
|
// See the 'LICENSE' file for more details.
|
||||||
// of the License, or (at your option) any later version.
|
|
||||||
//
|
|
||||||
// This program is distributed in the hope that it will be useful,
|
|
||||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
// GNU General Public License for more details.
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
/// \file
|
/// \file
|
||||||
/// \brief Dynamic lighting & coronas add on by Hurdler
|
/// \brief Dynamic lighting & coronas add on by Hurdler
|
||||||
|
@ -22,79 +17,4 @@
|
||||||
#include "hw_glob.h"
|
#include "hw_glob.h"
|
||||||
#include "hw_defs.h"
|
#include "hw_defs.h"
|
||||||
|
|
||||||
#define NUMLIGHTFREESLOTS 32 // Free light slots (for SOCs)
|
|
||||||
|
|
||||||
#ifdef ALAM_LIGHTING
|
|
||||||
#define NEWCORONAS
|
|
||||||
|
|
||||||
#define DL_MAX_LIGHT 256 // maximum number of lights (extra lights are ignored)
|
|
||||||
|
|
||||||
void HWR_InitLight(void);
|
|
||||||
void HWR_DL_AddLight(gr_vissprite_t *spr, GLPatch_t *patch);
|
|
||||||
void HWR_PlaneLighting(FOutVector *clVerts, int nrClipVerts);
|
|
||||||
void HWR_WallLighting(FOutVector *wlVerts);
|
|
||||||
void HWR_ResetLights(void);
|
|
||||||
void HWR_SetLights(int viewnumber);
|
|
||||||
|
|
||||||
#ifdef NEWCORONAS
|
|
||||||
void HWR_DrawCoronas(void);
|
|
||||||
#else
|
|
||||||
void HWR_DoCoronasLighting(FOutVector *outVerts, gr_vissprite_t *spr);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
typedef struct
|
|
||||||
{
|
|
||||||
int nb;
|
|
||||||
light_t *p_lspr[DL_MAX_LIGHT];
|
|
||||||
FVector position[DL_MAX_LIGHT]; // actually maximum DL_MAX_LIGHT lights
|
|
||||||
mobj_t *mo[DL_MAX_LIGHT];
|
|
||||||
} dynlights_t;
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
typedef enum
|
|
||||||
{
|
|
||||||
NOLIGHT = 0,
|
|
||||||
RINGSPARK_L,
|
|
||||||
SUPERSONIC_L, // Cool. =)
|
|
||||||
SUPERSPARK_L,
|
|
||||||
INVINCIBLE_L,
|
|
||||||
GREENSHIELD_L,
|
|
||||||
BLUESHIELD_L,
|
|
||||||
YELLOWSHIELD_L,
|
|
||||||
REDSHIELD_L,
|
|
||||||
BLACKSHIELD_L,
|
|
||||||
WHITESHIELD_L,
|
|
||||||
SMALLREDBALL_L,
|
|
||||||
RINGLIGHT_L,
|
|
||||||
GREENSMALL_L,
|
|
||||||
REDSMALL_L,
|
|
||||||
GREENSHINE_L,
|
|
||||||
ORANGESHINE_L,
|
|
||||||
PINKSHINE_L,
|
|
||||||
BLUESHINE_L,
|
|
||||||
REDSHINE_L,
|
|
||||||
LBLUESHINE_L,
|
|
||||||
GREYSHINE_L,
|
|
||||||
REDBALL_L,
|
|
||||||
GREENBALL_L,
|
|
||||||
BLUEBALL_L,
|
|
||||||
NIGHTSLIGHT_L,
|
|
||||||
JETLIGHT_L,
|
|
||||||
GOOPLIGHT_L,
|
|
||||||
STREETLIGHT_L,
|
|
||||||
|
|
||||||
// free slots for SOCs at run-time --------------------
|
|
||||||
FREESLOT0_L,
|
|
||||||
//
|
|
||||||
// ... 32 free lights here ...
|
|
||||||
//
|
|
||||||
LASTFREESLOT_L = (FREESLOT0_L+NUMLIGHTFREESLOTS-1),
|
|
||||||
// end of freeslots ---------------------------------------------
|
|
||||||
|
|
||||||
NUMLIGHTS
|
|
||||||
} lightspritenum_t;
|
|
||||||
|
|
||||||
extern light_t lspr[NUMLIGHTS];
|
|
||||||
extern light_t *t_lspr[NUMSPRITES];
|
|
||||||
#endif
|
#endif
|
||||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -20,6 +20,7 @@
|
||||||
#ifndef __HWR_MAIN_H__
|
#ifndef __HWR_MAIN_H__
|
||||||
#define __HWR_MAIN_H__
|
#define __HWR_MAIN_H__
|
||||||
|
|
||||||
|
#include "hw_glob.h"
|
||||||
#include "hw_data.h"
|
#include "hw_data.h"
|
||||||
#include "hw_defs.h"
|
#include "hw_defs.h"
|
||||||
|
|
||||||
|
@ -27,38 +28,54 @@
|
||||||
#include "../d_player.h"
|
#include "../d_player.h"
|
||||||
#include "../r_defs.h"
|
#include "../r_defs.h"
|
||||||
|
|
||||||
|
#define GLENCORE
|
||||||
|
|
||||||
// Startup & Shutdown the hardware mode renderer
|
// Startup & Shutdown the hardware mode renderer
|
||||||
void HWR_Startup(void);
|
void HWR_Startup(void);
|
||||||
void HWR_Shutdown(void);
|
void HWR_Shutdown(void);
|
||||||
|
|
||||||
void HWR_drawAMline(const fline_t *fl, INT32 color);
|
extern float gr_viewwidth, gr_viewheight, gr_baseviewwindowx, gr_baseviewwindowy;
|
||||||
void HWR_FadeScreenMenuBack(UINT16 color, UINT8 strength);
|
|
||||||
void HWR_DrawConsoleBack(UINT32 color, INT32 height);
|
extern float gr_basewindowcenterx, gr_basewindowcentery;
|
||||||
void HWR_RenderSkyboxView(INT32 viewnumber, player_t *player);
|
|
||||||
void HWR_RenderPlayerView(INT32 viewnumber, player_t *player);
|
extern FTransform atransform;
|
||||||
void HWR_DrawViewBorder(INT32 clearlines);
|
|
||||||
void HWR_DrawFlatFill(INT32 x, INT32 y, INT32 w, INT32 h, lumpnum_t flatlumpnum);
|
// hw_draw.c
|
||||||
UINT8 *HWR_GetScreenshot(void);
|
|
||||||
boolean HWR_Screenshot(const char *lbmname);
|
|
||||||
void HWR_InitTextureMapping(void);
|
|
||||||
void HWR_SetViewSize(void);
|
|
||||||
void HWR_DrawPatch(GLPatch_t *gpatch, INT32 x, INT32 y, INT32 option);
|
void HWR_DrawPatch(GLPatch_t *gpatch, INT32 x, INT32 y, INT32 option);
|
||||||
void HWR_DrawFixedPatch(GLPatch_t *gpatch, fixed_t x, fixed_t y, fixed_t scale, INT32 option, const UINT8 *colormap);
|
void HWR_DrawFixedPatch(GLPatch_t *gpatch, fixed_t x, fixed_t y, fixed_t scale, INT32 option, const UINT8 *colormap);
|
||||||
void HWR_DrawCroppedPatch(GLPatch_t *gpatch, fixed_t x, fixed_t y, fixed_t scale, INT32 option, fixed_t sx, fixed_t sy, fixed_t w, fixed_t h);
|
void HWR_DrawCroppedPatch(GLPatch_t *gpatch, fixed_t x, fixed_t y, fixed_t pscale, INT32 option, fixed_t sx, fixed_t sy, fixed_t w, fixed_t h);
|
||||||
void HWR_MakePatch (const patch_t *patch, GLPatch_t *grPatch, GLMipmap_t *grMipmap, boolean makebitmap);
|
|
||||||
void HWR_CreatePlanePolygons(INT32 bspnum);
|
|
||||||
void HWR_CreateStaticLightmaps(INT32 bspnum);
|
|
||||||
void HWR_PrepLevelCache(size_t pnumtextures);
|
|
||||||
void HWR_DrawFill(INT32 x, INT32 y, INT32 w, INT32 h, INT32 color);
|
void HWR_DrawFill(INT32 x, INT32 y, INT32 w, INT32 h, INT32 color);
|
||||||
void HWR_DrawConsoleFill(INT32 x, INT32 y, INT32 w, INT32 h, UINT32 color, INT32 options); // Lat: separate flags from color since color needs to be an uint to work right.
|
void HWR_DrawConsoleFill(INT32 x, INT32 y, INT32 w, INT32 h, UINT32 color, INT32 options); // Lat: separate flags from color since color needs to be an uint to work right.
|
||||||
void HWR_DrawDiag(INT32 x, INT32 y, INT32 wh, INT32 color);
|
void HWR_DrawDiag(INT32 x, INT32 y, INT32 wh, INT32 color);
|
||||||
void HWR_DrawPic(INT32 x,INT32 y,lumpnum_t lumpnum);
|
void HWR_drawAMline(const fline_t *fl, INT32 color);
|
||||||
|
void HWR_FadeScreenMenuBack(UINT16 color, UINT8 strength);
|
||||||
|
void HWR_DrawConsoleBack(UINT32 color, INT32 height);
|
||||||
|
void HWR_DrawViewBorder(INT32 clearlines);
|
||||||
|
void HWR_DrawFlatFill(INT32 x, INT32 y, INT32 w, INT32 h, lumpnum_t flatlumpnum);
|
||||||
|
|
||||||
|
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_LoadShaders(UINT16 wadnum, boolean PK3);
|
||||||
|
void HWR_SetViewSize(void);
|
||||||
void HWR_AddCommands(void);
|
void HWR_AddCommands(void);
|
||||||
void HWR_CorrectSWTricks(void);
|
|
||||||
void transform(float *cx, float *cy, float *cz);
|
// 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, UINT32 mixcolor, UINT32 fadecolor);
|
||||||
|
void HWR_NoColormapLighting(FSurfaceInfo *Surface, INT32 light_level, UINT32 mixcolor, UINT32 fadecolor);
|
||||||
|
UINT8 HWR_FogBlockAlpha(INT32 light, UINT32 color); // Let's see if this can work
|
||||||
|
|
||||||
|
void HWR_FoggingOn(void);
|
||||||
|
|
||||||
FBITFIELD HWR_TranstableToAlpha(INT32 transtablenum, FSurfaceInfo *pSurf);
|
FBITFIELD HWR_TranstableToAlpha(INT32 transtablenum, FSurfaceInfo *pSurf);
|
||||||
INT32 HWR_GetTextureUsed(void);
|
|
||||||
|
// hw_main.c: Post-rendering
|
||||||
void HWR_DoPostProcessor(player_t *player);
|
void HWR_DoPostProcessor(player_t *player);
|
||||||
void HWR_StartScreenWipe(void);
|
void HWR_StartScreenWipe(void);
|
||||||
void HWR_EndScreenWipe(void);
|
void HWR_EndScreenWipe(void);
|
||||||
|
@ -67,24 +84,60 @@ void HWR_DoWipe(UINT8 wipenum, UINT8 scrnnum);
|
||||||
void HWR_MakeScreenFinalTexture(void);
|
void HWR_MakeScreenFinalTexture(void);
|
||||||
void HWR_DrawScreenFinalTexture(int width, int height);
|
void HWR_DrawScreenFinalTexture(int width, int height);
|
||||||
|
|
||||||
// This stuff is put here so MD2's can use them
|
// hw_main.c: Planes
|
||||||
UINT32 HWR_Lighting(INT32 light, UINT32 color, UINT32 fadecolor, boolean fogblockpoly, boolean plane);
|
void HWR_RenderPlane(extrasubsector_t *xsub, boolean isceiling, fixed_t fixedheight, FBITFIELD PolyFlags, INT32 lightlevel, lumpnum_t lumpnum, sector_t *FOFsector, UINT8 alpha, extracolormap_t *planecolormap);
|
||||||
FUNCMATH UINT8 LightLevelToLum(INT32 l);
|
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);
|
||||||
|
|
||||||
extern CV_PossibleValue_t granisotropicmode_cons_t[];
|
#ifdef POLYOBJECTS
|
||||||
|
#ifdef POLYOBJECTS_PLANES
|
||||||
#ifdef ALAM_LIGHTING
|
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);
|
||||||
extern consvar_t cv_grdynamiclighting;
|
void HWR_AddPolyObjectPlanes(void);
|
||||||
extern consvar_t cv_grstaticlighting;
|
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);
|
||||||
extern consvar_t cv_grcoronas;
|
|
||||||
extern consvar_t cv_grcoronasize;
|
|
||||||
#endif
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// 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, FBITFIELD blend, boolean fogwall, INT32 lightlevel, extracolormap_t *wallcolormap);
|
||||||
|
void HWR_SplitWall(sector_t *sector, FOutVector *wallVerts, INT32 texnum, FSurfaceInfo* Surf, INT32 cutflag, ffloor_t *pfloor);
|
||||||
|
void HWR_DrawSkyWall(FOutVector *wallVerts, FSurfaceInfo *Surf, fixed_t bottom, fixed_t top);
|
||||||
|
void HWR_DrawSkyBackground(void);
|
||||||
|
|
||||||
|
#ifdef POLYOBJECTS
|
||||||
|
void HWR_AddPolyObjectSegs(void);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// hw_main.c: BSP
|
||||||
|
void HWR_RenderBSPNode(INT32 bspnum);
|
||||||
|
void HWR_Subsector(size_t num);
|
||||||
|
void HWR_AddLine(seg_t *line);
|
||||||
|
boolean HWR_CheckBBox(fixed_t *bspcoord);
|
||||||
|
void HWR_RenderDrawNodes(void);
|
||||||
|
|
||||||
|
// hw_main.c: Sprites
|
||||||
|
void HWR_AddSprites(sector_t *sec);
|
||||||
|
void HWR_ProjectSprite(mobj_t *thing);
|
||||||
|
void HWR_ProjectPrecipitationSprite(precipmobj_t *thing);
|
||||||
|
void HWR_DrawSprites(void);
|
||||||
|
|
||||||
|
// hw_bsp.c
|
||||||
|
void HWR_CreatePlanePolygons(INT32 bspnum);
|
||||||
|
|
||||||
|
// hw_cache.c
|
||||||
|
void HWR_PrepLevelCache(size_t pnumtextures);
|
||||||
|
|
||||||
|
// hw_trick.c
|
||||||
|
void HWR_CorrectSWTricks(void);
|
||||||
|
|
||||||
|
// Console variables
|
||||||
|
extern consvar_t cv_grshaders;
|
||||||
|
extern consvar_t cv_grshearing;
|
||||||
|
extern consvar_t cv_grfov;
|
||||||
extern consvar_t cv_grmdls;
|
extern consvar_t cv_grmdls;
|
||||||
extern consvar_t cv_grfallbackplayermodel;
|
|
||||||
extern consvar_t cv_grfog;
|
extern consvar_t cv_grfog;
|
||||||
extern consvar_t cv_grfogcolor;
|
|
||||||
extern consvar_t cv_grfogdensity;
|
extern consvar_t cv_grfogdensity;
|
||||||
extern consvar_t cv_grsoftwarefog;
|
|
||||||
extern consvar_t cv_grgammared;
|
extern consvar_t cv_grgammared;
|
||||||
extern consvar_t cv_grgammagreen;
|
extern consvar_t cv_grgammagreen;
|
||||||
extern consvar_t cv_grgammablue;
|
extern consvar_t cv_grgammablue;
|
||||||
|
@ -94,22 +147,8 @@ extern consvar_t cv_grcorrecttricks;
|
||||||
extern consvar_t cv_grfovchange;
|
extern consvar_t cv_grfovchange;
|
||||||
extern consvar_t cv_grsolvetjoin;
|
extern consvar_t cv_grsolvetjoin;
|
||||||
extern consvar_t cv_grspritebillboarding;
|
extern consvar_t cv_grspritebillboarding;
|
||||||
|
extern consvar_t cv_grfallbackplayermodel;
|
||||||
|
|
||||||
extern float gr_viewwidth, gr_viewheight, gr_baseviewwindowx, gr_baseviewwindowy;
|
extern CV_PossibleValue_t granisotropicmode_cons_t[];
|
||||||
|
|
||||||
extern float gr_basewindowcenterx, gr_basewindowcentery;
|
|
||||||
|
|
||||||
// BP: big hack for a test in lighting ref : 1249753487AB
|
|
||||||
extern fixed_t *hwbbox;
|
|
||||||
extern FTransform atransform;
|
|
||||||
|
|
||||||
typedef struct
|
|
||||||
{
|
|
||||||
wallVert3D floorVerts[4];
|
|
||||||
FSurfaceInfo Surf;
|
|
||||||
INT32 texnum;
|
|
||||||
INT32 blend;
|
|
||||||
INT32 drawcount;
|
|
||||||
} floorinfo_t;
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -1,17 +1,12 @@
|
||||||
// Emacs style mode select -*- C++ -*-
|
// SONIC ROBO BLAST 2
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
//
|
// Copyright (C) 1993-1996 by id Software, Inc.
|
||||||
// Copyright (C) 1998-2000 by DooM Legacy Team.
|
// Copyright (C) 1998-2000 by DooM Legacy Team.
|
||||||
|
// Copyright (C) 1999-2019 by Sonic Team Junior.
|
||||||
//
|
//
|
||||||
// This program is free software; you can redistribute it and/or
|
// This program is free software distributed under the
|
||||||
// modify it under the terms of the GNU General Public License
|
// terms of the GNU General Public License, version 2.
|
||||||
// as published by the Free Software Foundation; either version 2
|
// See the 'LICENSE' file for more details.
|
||||||
// of the License, or (at your option) any later version.
|
|
||||||
//
|
|
||||||
// This program is distributed in the hope that it will be useful,
|
|
||||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
// GNU General Public License for more details.
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
/// \file
|
/// \file
|
||||||
/// \brief MD2 Handling
|
/// \brief MD2 Handling
|
||||||
|
@ -90,7 +85,6 @@ static void md2_freeModel (model_t *model)
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// load model
|
// load model
|
||||||
//
|
//
|
||||||
|
@ -151,7 +145,7 @@ static void PNG_warn(png_structp PNG, png_const_charp pngtext)
|
||||||
CONS_Debug(DBG_RENDER, "libpng warning at %p: %s", PNG, pngtext);
|
CONS_Debug(DBG_RENDER, "libpng warning at %p: %s", PNG, pngtext);
|
||||||
}
|
}
|
||||||
|
|
||||||
static GrTextureFormat_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 *grpatch)
|
||||||
{
|
{
|
||||||
png_structp png_ptr;
|
png_structp png_ptr;
|
||||||
png_infop png_info_ptr;
|
png_infop png_info_ptr;
|
||||||
|
@ -285,7 +279,7 @@ typedef struct
|
||||||
UINT8 filler[54];
|
UINT8 filler[54];
|
||||||
} PcxHeader;
|
} PcxHeader;
|
||||||
|
|
||||||
static GrTextureFormat_t PCX_Load(const char *filename, int *w, int *h,
|
static GLTextureFormat_t PCX_Load(const char *filename, int *w, int *h,
|
||||||
GLPatch_t *grpatch)
|
GLPatch_t *grpatch)
|
||||||
{
|
{
|
||||||
PcxHeader header;
|
PcxHeader header;
|
||||||
|
@ -544,7 +538,7 @@ void HWR_InitMD2(void)
|
||||||
goto md2found;
|
goto md2found;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// no sprite/player skin name found?!?
|
// no sprite/player skin name found?!?D
|
||||||
CONS_Printf("Unknown sprite/player skin %s detected in mdls.dat\n", name);
|
CONS_Printf("Unknown sprite/player skin %s detected in mdls.dat\n", name);
|
||||||
md2found:
|
md2found:
|
||||||
// move on to next line...
|
// move on to next line...
|
||||||
|
@ -579,7 +573,7 @@ void HWR_AddPlayerMD2(int skin) // For MD2's that were added after startup
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check for any MD2s that match the names of player skins!
|
// Check for any MD2s that match the names of sprite names!
|
||||||
while (fscanf(f, "%19s %31s %f %f", name, filename, &scale, &offset) == 4)
|
while (fscanf(f, "%19s %31s %f %f", name, filename, &scale, &offset) == 4)
|
||||||
{
|
{
|
||||||
if (stricmp(name, skins[skin].name) == 0)
|
if (stricmp(name, skins[skin].name) == 0)
|
||||||
|
@ -837,35 +831,19 @@ static void HWR_GetBlendedTexture(GLPatch_t *gpatch, GLPatch_t *blendgpatch, INT
|
||||||
|
|
||||||
// -----------------+
|
// -----------------+
|
||||||
// HWR_DrawMD2 : Draw MD2
|
// HWR_DrawMD2 : Draw MD2
|
||||||
// : (monsters, bonuses, weapons, lights, ...)
|
// :
|
||||||
// Returns :
|
// Returns :
|
||||||
// -----------------+
|
// -----------------+
|
||||||
/*
|
|
||||||
wait/stand
|
|
||||||
death
|
|
||||||
pain
|
|
||||||
walk
|
|
||||||
shoot/fire
|
|
||||||
|
|
||||||
die?
|
|
||||||
atka?
|
|
||||||
atkb?
|
|
||||||
attacka/b/c/d?
|
|
||||||
res?
|
|
||||||
run?
|
|
||||||
*/
|
|
||||||
#define NORMALFOG 0x00000000
|
|
||||||
#define FADEFOG 0x19000000
|
|
||||||
void HWR_DrawMD2(gr_vissprite_t *spr)
|
void HWR_DrawMD2(gr_vissprite_t *spr)
|
||||||
{
|
{
|
||||||
FSurfaceInfo Surf;
|
md2_t *md2;
|
||||||
|
|
||||||
char filename[64];
|
char filename[64];
|
||||||
INT32 frame = 0;
|
INT32 frame = 0;
|
||||||
INT32 nextFrame = -1;
|
INT32 nextFrame = -1;
|
||||||
FTransform p;
|
FTransform p;
|
||||||
md2_t *md2;
|
FSurfaceInfo Surf;
|
||||||
UINT8 color[4];
|
|
||||||
|
|
||||||
if (!cv_grmdls.value)
|
if (!cv_grmdls.value)
|
||||||
return;
|
return;
|
||||||
|
@ -878,8 +856,8 @@ void HWR_DrawMD2(gr_vissprite_t *spr)
|
||||||
if (spr->mobj->subsector)
|
if (spr->mobj->subsector)
|
||||||
{
|
{
|
||||||
sector_t *sector = spr->mobj->subsector->sector;
|
sector_t *sector = spr->mobj->subsector->sector;
|
||||||
UINT8 lightlevel = 255;
|
|
||||||
extracolormap_t *colormap = sector->extra_colormap;
|
extracolormap_t *colormap = sector->extra_colormap;
|
||||||
|
UINT8 lightlevel = 255;
|
||||||
|
|
||||||
if (sector->numlights)
|
if (sector->numlights)
|
||||||
{
|
{
|
||||||
|
@ -903,13 +881,13 @@ void HWR_DrawMD2(gr_vissprite_t *spr)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (colormap)
|
if (colormap)
|
||||||
Surf.FlatColor.rgba = HWR_Lighting(lightlevel, colormap->rgba, colormap->fadergba, false, false);
|
HWR_Lighting(&Surf, lightlevel, colormap->rgba, colormap->fadergba);
|
||||||
else
|
else
|
||||||
Surf.FlatColor.rgba = HWR_Lighting(lightlevel, NORMALFOG, FADEFOG, false, false);
|
HWR_NoColormapLighting(&Surf, lightlevel, GL_NORMALFOG, GL_FADEFOG);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Surf.FlatColor.rgba = 0xFFFFFFFF;
|
Surf.PolyColor.rgba = 0xFFFFFFFF;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Look at HWR_ProjectSprite for more
|
// Look at HWR_ProjectSprite for more
|
||||||
|
@ -928,11 +906,11 @@ void HWR_DrawMD2(gr_vissprite_t *spr)
|
||||||
//durs = tics;
|
//durs = tics;
|
||||||
|
|
||||||
if (spr->mobj->flags2 & MF2_SHADOW)
|
if (spr->mobj->flags2 & MF2_SHADOW)
|
||||||
Surf.FlatColor.s.alpha = 0x40;
|
Surf.PolyColor.s.alpha = 0x40;
|
||||||
else if (spr->mobj->frame & FF_TRANSMASK)
|
else if (spr->mobj->frame & FF_TRANSMASK)
|
||||||
HWR_TranstableToAlpha((spr->mobj->frame & FF_TRANSMASK)>>FF_TRANSSHIFT, &Surf);
|
HWR_TranstableToAlpha((spr->mobj->frame & FF_TRANSMASK)>>FF_TRANSSHIFT, &Surf);
|
||||||
else
|
else
|
||||||
Surf.FlatColor.s.alpha = 0xFF;
|
Surf.PolyColor.s.alpha = 0xFF;
|
||||||
|
|
||||||
// dont forget to enabled the depth test because we can't do this like
|
// dont forget to enabled the depth test because we can't do this like
|
||||||
// before: polygons models are not sorted
|
// before: polygons models are not sorted
|
||||||
|
@ -967,7 +945,6 @@ void HWR_DrawMD2(gr_vissprite_t *spr)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//HWD.pfnSetBlend(blend); // This seems to actually break translucency?
|
|
||||||
finalscale = md2->scale;
|
finalscale = md2->scale;
|
||||||
//Hurdler: arf, I don't like that implementation at all... too much crappy
|
//Hurdler: arf, I don't like that implementation at all... too much crappy
|
||||||
gpatch = md2->grpatch;
|
gpatch = md2->grpatch;
|
||||||
|
@ -1103,11 +1080,6 @@ void HWR_DrawMD2(gr_vissprite_t *spr)
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
color[0] = Surf.FlatColor.s.red;
|
|
||||||
color[1] = Surf.FlatColor.s.green;
|
|
||||||
color[2] = Surf.FlatColor.s.blue;
|
|
||||||
color[3] = Surf.FlatColor.s.alpha;
|
|
||||||
|
|
||||||
// SRB2CBTODO: MD2 scaling support
|
// SRB2CBTODO: MD2 scaling support
|
||||||
finalscale *= FIXED_TO_FLOAT(spr->mobj->scale);
|
finalscale *= FIXED_TO_FLOAT(spr->mobj->scale);
|
||||||
|
|
||||||
|
@ -1116,7 +1088,8 @@ void HWR_DrawMD2(gr_vissprite_t *spr)
|
||||||
p.mirror = atransform.mirror; // from Kart
|
p.mirror = atransform.mirror; // from Kart
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
HWD.pfnDrawModel(md2->model, frame, durs, tics, nextFrame, &p, finalscale, flip, color);
|
HWD.pfnSetShader(4); // model shader
|
||||||
|
HWD.pfnDrawModel(md2->model, frame, durs, tics, nextFrame, &p, finalscale, flip, &Surf);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,18 +1,12 @@
|
||||||
// Emacs style mode select -*- C++ -*-
|
// SONIC ROBO BLAST 2
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
//
|
// Copyright (C) 1993-1996 by id Software, Inc.
|
||||||
// Copyright (C) 1998-2000 by DooM Legacy Team.
|
// Copyright (C) 1998-2000 by DooM Legacy Team.
|
||||||
|
// Copyright (C) 1999-2019 by Sonic Team Junior.
|
||||||
//
|
//
|
||||||
// This program is free software; you can redistribute it and/or
|
// This program is free software distributed under the
|
||||||
// modify it under the terms of the GNU General Public License
|
// terms of the GNU General Public License, version 2.
|
||||||
// as published by the Free Software Foundation; either version 2
|
// See the 'LICENSE' file for more details.
|
||||||
// of the License, or (at your option) any later version.
|
|
||||||
//
|
|
||||||
// This program is distributed in the hope that it will be useful,
|
|
||||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
// GNU General Public License for more details.
|
|
||||||
//
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
/// \file
|
/// \file
|
||||||
/// \brief MD2 Handling
|
/// \brief MD2 Handling
|
||||||
|
|
|
@ -44,6 +44,7 @@
|
||||||
#include "../doomstat.h"
|
#include "../doomstat.h"
|
||||||
|
|
||||||
#ifdef HWRENDER
|
#ifdef HWRENDER
|
||||||
|
#include "hw_main.h"
|
||||||
#include "hw_glob.h"
|
#include "hw_glob.h"
|
||||||
#include "hw_dll.h"
|
#include "hw_dll.h"
|
||||||
#include "../r_local.h"
|
#include "../r_local.h"
|
||||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -57,23 +57,10 @@
|
||||||
#undef DEBUG_TO_FILE // maybe defined in previous *.h
|
#undef DEBUG_TO_FILE // maybe defined in previous *.h
|
||||||
#define DEBUG_TO_FILE // output debugging msgs to ogllog.txt
|
#define DEBUG_TO_FILE // output debugging msgs to ogllog.txt
|
||||||
|
|
||||||
// todo: find some way of getting SDL to log to ogllog.txt, without
|
|
||||||
// interfering with r_opengl.dll
|
|
||||||
#ifdef HAVE_SDL
|
|
||||||
#undef DEBUG_TO_FILE
|
|
||||||
#endif
|
|
||||||
//#if defined(HAVE_SDL) && !defined(_DEBUG)
|
|
||||||
//#undef DEBUG_TO_FILE
|
|
||||||
//#endif
|
|
||||||
|
|
||||||
#ifdef DEBUG_TO_FILE
|
#ifdef DEBUG_TO_FILE
|
||||||
extern FILE *gllogstream;
|
extern FILE *gllogstream;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef DRIVER_STRING
|
|
||||||
#define DRIVER_STRING "HWRAPI Init(): SRB2Kart OpenGL renderer" // Tails
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// ==========================================================================
|
// ==========================================================================
|
||||||
// PROTOS
|
// PROTOS
|
||||||
// ==========================================================================
|
// ==========================================================================
|
||||||
|
@ -81,13 +68,15 @@ extern FILE *gllogstream;
|
||||||
boolean LoadGL(void);
|
boolean LoadGL(void);
|
||||||
void *GetGLFunc(const char *proc);
|
void *GetGLFunc(const char *proc);
|
||||||
boolean SetupGLfunc(void);
|
boolean SetupGLfunc(void);
|
||||||
boolean SetupGLFunc13(void);
|
void SetupGLFunc4(void);
|
||||||
void Flush(void);
|
void Flush(void);
|
||||||
INT32 isExtAvailable(const char *extension, const GLubyte *start);
|
INT32 isExtAvailable(const char *extension, const GLubyte *start);
|
||||||
int SetupPixelFormat(INT32 WantColorBits, INT32 WantStencilBits, INT32 WantDepthBits);
|
|
||||||
void SetModelView(GLint w, GLint h);
|
void SetModelView(GLint w, GLint h);
|
||||||
void SetStates(void);
|
void SetStates(void);
|
||||||
FUNCMATH float byteasfloat(UINT8 fbyte);
|
#ifdef USE_PALETTED_TEXTURE
|
||||||
|
extern PFNGLCOLORTABLEEXTPROC glColorTableEXT;
|
||||||
|
extern GLubyte palette_tex[256*3];
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifndef GL_EXT_texture_filter_anisotropic
|
#ifndef GL_EXT_texture_filter_anisotropic
|
||||||
#define GL_TEXTURE_MAX_ANISOTROPY_EXT 0x84FE
|
#define GL_TEXTURE_MAX_ANISOTROPY_EXT 0x84FE
|
||||||
|
@ -123,7 +112,10 @@ static PFNglEnableClientState pglEnableClientState;
|
||||||
// GLOBAL
|
// GLOBAL
|
||||||
// ==========================================================================
|
// ==========================================================================
|
||||||
|
|
||||||
|
extern const GLubyte *gl_version;
|
||||||
|
extern const GLubyte *gl_renderer;
|
||||||
extern const GLubyte *gl_extensions;
|
extern const GLubyte *gl_extensions;
|
||||||
|
|
||||||
extern RGBA_t myPaletteData[];
|
extern RGBA_t myPaletteData[];
|
||||||
extern GLint screen_width;
|
extern GLint screen_width;
|
||||||
extern GLint screen_height;
|
extern GLint screen_height;
|
||||||
|
|
|
@ -20,9 +20,6 @@
|
||||||
#include "z_zone.h"
|
#include "z_zone.h"
|
||||||
#include "d_player.h"
|
#include "d_player.h"
|
||||||
#include "lzf.h"
|
#include "lzf.h"
|
||||||
#ifdef HWRENDER
|
|
||||||
#include "hardware/hw_light.h"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// Hey, moron! If you change this table, don't forget about the sprite enum in info.h and the sprite lights in hw_light.c!
|
// Hey, moron! If you change this table, don't forget about the sprite enum in info.h and the sprite lights in hw_light.c!
|
||||||
char sprnames[NUMSPRITES + 1][5] =
|
char sprnames[NUMSPRITES + 1][5] =
|
||||||
|
@ -20101,7 +20098,7 @@ void P_PatchInfoTables(void)
|
||||||
char *tempname;
|
char *tempname;
|
||||||
|
|
||||||
#if NUMSPRITEFREESLOTS > 1000
|
#if NUMSPRITEFREESLOTS > 1000
|
||||||
"Update P_PatchInfoTables, you big dumb head"
|
#error "Update P_PatchInfoTables, you big dumb head"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// empty out free slots
|
// empty out free slots
|
||||||
|
@ -20113,9 +20110,6 @@ void P_PatchInfoTables(void)
|
||||||
tempname[2] = (char)('0' + (char)(((i-SPR_FIRSTFREESLOT+1)/10)%10));
|
tempname[2] = (char)('0' + (char)(((i-SPR_FIRSTFREESLOT+1)/10)%10));
|
||||||
tempname[3] = (char)('0' + (char)((i-SPR_FIRSTFREESLOT+1)%10));
|
tempname[3] = (char)('0' + (char)((i-SPR_FIRSTFREESLOT+1)%10));
|
||||||
tempname[4] = '\0';
|
tempname[4] = '\0';
|
||||||
#ifdef HWRENDER
|
|
||||||
t_lspr[i] = &lspr[NOLIGHT];
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
sprnames[i][0] = '\0'; // i == NUMSPRITES
|
sprnames[i][0] = '\0'; // i == NUMSPRITES
|
||||||
memset(&states[S_FIRSTFREESLOT], 0, sizeof (state_t) * NUMSTATEFREESLOTS);
|
memset(&states[S_FIRSTFREESLOT], 0, sizeof (state_t) * NUMSTATEFREESLOTS);
|
||||||
|
|
|
@ -226,7 +226,7 @@ void A_NapalmScatter();
|
||||||
void A_SpawnFreshCopy();
|
void A_SpawnFreshCopy();
|
||||||
|
|
||||||
// ratio of states to sprites to mobj types is roughly 6 : 1 : 1
|
// ratio of states to sprites to mobj types is roughly 6 : 1 : 1
|
||||||
#define NUMMOBJFREESLOTS 256
|
#define NUMMOBJFREESLOTS 512
|
||||||
#define NUMSPRITEFREESLOTS NUMMOBJFREESLOTS
|
#define NUMSPRITEFREESLOTS NUMMOBJFREESLOTS
|
||||||
#define NUMSTATEFREESLOTS (NUMMOBJFREESLOTS*8)
|
#define NUMSTATEFREESLOTS (NUMMOBJFREESLOTS*8)
|
||||||
|
|
||||||
|
@ -4301,7 +4301,7 @@ typedef enum mobj_type
|
||||||
|
|
||||||
// Castle Eggman Scenery
|
// Castle Eggman Scenery
|
||||||
MT_CHAIN, // CEZ Chain
|
MT_CHAIN, // CEZ Chain
|
||||||
MT_FLAME, // Flame (has corona)
|
MT_FLAME, // Flame
|
||||||
MT_EGGSTATUE, // Eggman Statue
|
MT_EGGSTATUE, // Eggman Statue
|
||||||
MT_MACEPOINT, // Mace rotation point
|
MT_MACEPOINT, // Mace rotation point
|
||||||
MT_SWINGMACEPOINT, // Mace swinging point
|
MT_SWINGMACEPOINT, // Mace swinging point
|
||||||
|
|
|
@ -411,6 +411,19 @@ boolean FV3_Equal(const vector3_t *a_1, const vector3_t *a_2)
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ClosestPointOnVector
|
||||||
|
//
|
||||||
|
// Similar to ClosestPointOnLine, but uses a vector instead of two points.
|
||||||
|
//
|
||||||
|
void FV3_ClosestPointOnVector(const vector3_t *dir, const vector3_t *p, vector3_t *out)
|
||||||
|
{
|
||||||
|
fixed_t t = FV3_Dot(dir, p);
|
||||||
|
|
||||||
|
// Return the point on the line closest
|
||||||
|
FV3_MulEx(dir, t, out);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
fixed_t FV3_Dot(const vector3_t *a_1, const vector3_t *a_2)
|
fixed_t FV3_Dot(const vector3_t *a_1, const vector3_t *a_2)
|
||||||
{
|
{
|
||||||
return (FixedMul(a_1->x, a_2->x) + FixedMul(a_1->y, a_2->y) + FixedMul(a_1->z, a_2->z));
|
return (FixedMul(a_1->x, a_2->x) + FixedMul(a_1->y, a_2->y) + FixedMul(a_1->z, a_2->z));
|
||||||
|
@ -458,19 +471,6 @@ vector3_t *FV3_ClosestPointOnLine(const vector3_t *Line, const vector3_t *p, vec
|
||||||
return FV3_AddEx(&Line[0], &V, out);
|
return FV3_AddEx(&Line[0], &V, out);
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
|
||||||
// ClosestPointOnVector
|
|
||||||
//
|
|
||||||
// Similar to ClosestPointOnLine, but uses a vector instead of two points.
|
|
||||||
//
|
|
||||||
void FV3_ClosestPointOnVector(const vector3_t *dir, const vector3_t *p, vector3_t *out)
|
|
||||||
{
|
|
||||||
fixed_t t = FV3_Dot(dir, p);
|
|
||||||
|
|
||||||
// Return the point on the line closest
|
|
||||||
FV3_MulEx(dir, t, out);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// ClosestPointOnTriangle
|
// ClosestPointOnTriangle
|
||||||
|
|
119
src/m_menu.c
119
src/m_menu.c
|
@ -372,9 +372,6 @@ static void M_HandleLevelStats(INT32 choice);
|
||||||
static void M_HandleConnectIP(INT32 choice);
|
static void M_HandleConnectIP(INT32 choice);
|
||||||
#endif
|
#endif
|
||||||
static void M_HandleSetupMultiPlayer(INT32 choice);
|
static void M_HandleSetupMultiPlayer(INT32 choice);
|
||||||
#ifdef HWRENDER
|
|
||||||
static void M_HandleFogColor(INT32 choice);
|
|
||||||
#endif
|
|
||||||
static void M_HandleVideoMode(INT32 choice);
|
static void M_HandleVideoMode(INT32 choice);
|
||||||
static void M_HandleMonitorToggles(INT32 choice);
|
static void M_HandleMonitorToggles(INT32 choice);
|
||||||
|
|
||||||
|
@ -1285,36 +1282,24 @@ static menuitem_t OP_VideoModeMenu[] =
|
||||||
#ifdef HWRENDER
|
#ifdef HWRENDER
|
||||||
static menuitem_t OP_OpenGLOptionsMenu[] =
|
static menuitem_t OP_OpenGLOptionsMenu[] =
|
||||||
{
|
{
|
||||||
{IT_SUBMENU|IT_STRING, NULL, "Fog...", &OP_OpenGLFogDef, 10},
|
{IT_STRING|IT_CVAR, NULL, "Shaders", &cv_grshaders, 10},
|
||||||
{IT_SUBMENU|IT_STRING, NULL, "Gamma...", &OP_OpenGLColorDef, 20},
|
{IT_STRING|IT_CVAR, NULL, "Software Perspective", &cv_grshearing, 20},
|
||||||
|
{IT_STRING|IT_CVAR, NULL, "Sprite Billboarding", &cv_grspritebillboarding,30},
|
||||||
|
|
||||||
{IT_STRING|IT_CVAR, NULL, "Quality", &cv_scr_depth, 35},
|
{IT_STRING|IT_CVAR, NULL, "Quality", &cv_scr_depth, 50},
|
||||||
{IT_STRING|IT_CVAR, NULL, "Texture Filter", &cv_grfiltermode, 45},
|
{IT_STRING|IT_CVAR, NULL, "Texture Filter", &cv_grfiltermode, 60},
|
||||||
{IT_STRING|IT_CVAR, NULL, "Anisotropic", &cv_granisotropicmode, 55},
|
{IT_STRING|IT_CVAR, NULL, "Anisotropic", &cv_granisotropicmode, 70},
|
||||||
/*#ifdef _WINDOWS
|
#ifdef _WINDOWS
|
||||||
{IT_STRING|IT_CVAR, NULL, "Fullscreen", &cv_fullscreen, 50},
|
{IT_STRING|IT_CVAR, NULL, "Fullscreen", &cv_fullscreen, 80},
|
||||||
#endif
|
#endif
|
||||||
#ifdef ALAM_LIGHTING
|
{IT_SUBMENU|IT_STRING, NULL, "Fog...", &OP_OpenGLFogDef, 100},
|
||||||
{IT_SUBMENU|IT_STRING, NULL, "Lighting...", &OP_OpenGLLightingDef, 70},
|
{IT_SUBMENU|IT_STRING, NULL, "Gamma...", &OP_OpenGLColorDef, 110},
|
||||||
#endif*/
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#ifdef ALAM_LIGHTING
|
|
||||||
static menuitem_t OP_OpenGLLightingMenu[] =
|
|
||||||
{
|
|
||||||
{IT_STRING|IT_CVAR, NULL, "Coronas", &cv_grcoronas, 0},
|
|
||||||
{IT_STRING|IT_CVAR, NULL, "Coronas size", &cv_grcoronasize, 10},
|
|
||||||
{IT_STRING|IT_CVAR, NULL, "Dynamic lighting", &cv_grdynamiclighting, 20},
|
|
||||||
{IT_STRING|IT_CVAR, NULL, "Static lighting", &cv_grstaticlighting, 30},
|
|
||||||
};
|
|
||||||
#endif
|
|
||||||
|
|
||||||
static menuitem_t OP_OpenGLFogMenu[] =
|
static menuitem_t OP_OpenGLFogMenu[] =
|
||||||
{
|
{
|
||||||
{IT_STRING|IT_CVAR, NULL, "Fog", &cv_grfog, 10},
|
{IT_STRING|IT_CVAR, NULL, "Fog", &cv_grfog, 10},
|
||||||
{IT_STRING|IT_KEYHANDLER, NULL, "Fog Color", M_HandleFogColor, 20},
|
{IT_STRING|IT_CVAR, NULL, "Fog density", &cv_grfogdensity, 20},
|
||||||
{IT_STRING|IT_CVAR, NULL, "Fog Density", &cv_grfogdensity, 30},
|
|
||||||
{IT_STRING|IT_CVAR, NULL, "Software Fog",&cv_grsoftwarefog,40},
|
|
||||||
};
|
};
|
||||||
|
|
||||||
static menuitem_t OP_OpenGLColorMenu[] =
|
static menuitem_t OP_OpenGLColorMenu[] =
|
||||||
|
@ -2078,9 +2063,6 @@ menu_t OP_MonitorToggleDef =
|
||||||
|
|
||||||
#ifdef HWRENDER
|
#ifdef HWRENDER
|
||||||
menu_t OP_OpenGLOptionsDef = DEFAULTMENUSTYLE("M_VIDEO", OP_OpenGLOptionsMenu, &OP_VideoOptionsDef, 30, 30);
|
menu_t OP_OpenGLOptionsDef = DEFAULTMENUSTYLE("M_VIDEO", OP_OpenGLOptionsMenu, &OP_VideoOptionsDef, 30, 30);
|
||||||
#ifdef ALAM_LIGHTING
|
|
||||||
menu_t OP_OpenGLLightingDef = DEFAULTMENUSTYLE("M_VIDEO", OP_OpenGLLightingMenu, &OP_OpenGLOptionsDef, 60, 40);
|
|
||||||
#endif
|
|
||||||
menu_t OP_OpenGLFogDef =
|
menu_t OP_OpenGLFogDef =
|
||||||
{
|
{
|
||||||
"M_VIDEO",
|
"M_VIDEO",
|
||||||
|
@ -4503,21 +4485,11 @@ static void M_StopMessage(INT32 choice)
|
||||||
// You can even put multiple images in one menu!
|
// You can even put multiple images in one menu!
|
||||||
static void M_DrawImageDef(void)
|
static void M_DrawImageDef(void)
|
||||||
{
|
{
|
||||||
// this is probably what the V_DrawFixedPatch screen-fill bullshit was for, right
|
|
||||||
//V_DrawFill(0, 0, BASEVIDWIDTH, BASEVIDHEIGHT, 31); -- never mind, screen fade
|
|
||||||
|
|
||||||
// Grr. Need to autodetect for pic_ts.
|
|
||||||
pic_t *pictest = (pic_t *)W_CachePatchName(currentMenu->menuitems[itemOn].text,PU_CACHE);
|
|
||||||
if (!pictest->zero)
|
|
||||||
V_DrawScaledPic(0,0,0,W_GetNumForName(currentMenu->menuitems[itemOn].text));
|
|
||||||
else
|
|
||||||
{
|
|
||||||
patch_t *patch = W_CachePatchName(currentMenu->menuitems[itemOn].text,PU_CACHE);
|
patch_t *patch = W_CachePatchName(currentMenu->menuitems[itemOn].text,PU_CACHE);
|
||||||
if (patch->height <= BASEVIDHEIGHT)
|
if (patch->width <= BASEVIDWIDTH)
|
||||||
V_DrawScaledPatch(0,0,0,patch);
|
V_DrawScaledPatch(0,0,0,patch);
|
||||||
else
|
else
|
||||||
V_DrawSmallScaledPatch(0,0,0,patch);
|
V_DrawSmallScaledPatch(0,0,0,patch);
|
||||||
}
|
|
||||||
|
|
||||||
if (currentMenu->menuitems[itemOn].alphaKey)
|
if (currentMenu->menuitems[itemOn].alphaKey)
|
||||||
{
|
{
|
||||||
|
@ -10992,7 +10964,7 @@ static void M_QuitSRB2(INT32 choice)
|
||||||
// OpenGL specific options
|
// OpenGL specific options
|
||||||
// =====================================================================
|
// =====================================================================
|
||||||
|
|
||||||
#define FOG_COLOR_ITEM 1
|
#define FOG_DENSITY_ITEM 1
|
||||||
// ===================
|
// ===================
|
||||||
// M_OGL_DrawFogMenu()
|
// M_OGL_DrawFogMenu()
|
||||||
// ===================
|
// ===================
|
||||||
|
@ -11003,12 +10975,8 @@ static void M_OGL_DrawFogMenu(void)
|
||||||
mx = currentMenu->x;
|
mx = currentMenu->x;
|
||||||
my = currentMenu->y;
|
my = currentMenu->y;
|
||||||
M_DrawGenericMenu(); // use generic drawer for cursor, items and title
|
M_DrawGenericMenu(); // use generic drawer for cursor, items and title
|
||||||
V_DrawString(BASEVIDWIDTH - mx - V_StringWidth(cv_grfogcolor.string, 0),
|
V_DrawString(BASEVIDWIDTH - mx - V_StringWidth(cv_grfogdensity.string, 0),
|
||||||
my + currentMenu->menuitems[FOG_COLOR_ITEM].alphaKey, highlightflags, cv_grfogcolor.string);
|
my + currentMenu->menuitems[FOG_DENSITY_ITEM].alphaKey, V_YELLOWMAP, cv_grfogdensity.string);
|
||||||
// blink cursor on FOG_COLOR_ITEM if selected
|
|
||||||
if (itemOn == FOG_COLOR_ITEM && skullAnimCounter < 4)
|
|
||||||
V_DrawCharacter(BASEVIDWIDTH - mx,
|
|
||||||
my + currentMenu->menuitems[FOG_COLOR_ITEM].alphaKey, '_' | 0x80,false);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// =====================
|
// =====================
|
||||||
|
@ -11024,61 +10992,4 @@ static void M_OGL_DrawColorMenu(void)
|
||||||
V_DrawString(mx, my + currentMenu->menuitems[0].alphaKey - 10,
|
V_DrawString(mx, my + currentMenu->menuitems[0].alphaKey - 10,
|
||||||
highlightflags, "Gamma correction");
|
highlightflags, "Gamma correction");
|
||||||
}
|
}
|
||||||
|
|
||||||
//===================
|
|
||||||
// M_HandleFogColor()
|
|
||||||
//===================
|
|
||||||
static void M_HandleFogColor(INT32 choice)
|
|
||||||
{
|
|
||||||
size_t i, l;
|
|
||||||
char temp[8];
|
|
||||||
boolean exitmenu = false; // exit to previous menu and send name change
|
|
||||||
|
|
||||||
switch (choice)
|
|
||||||
{
|
|
||||||
case KEY_DOWNARROW:
|
|
||||||
S_StartSound(NULL, sfx_menu1);
|
|
||||||
itemOn++;
|
|
||||||
break;
|
|
||||||
|
|
||||||
case KEY_UPARROW:
|
|
||||||
S_StartSound(NULL, sfx_menu1);
|
|
||||||
itemOn--;
|
|
||||||
break;
|
|
||||||
|
|
||||||
case KEY_ESCAPE:
|
|
||||||
exitmenu = true;
|
|
||||||
break;
|
|
||||||
|
|
||||||
case KEY_BACKSPACE:
|
|
||||||
S_StartSound(NULL, sfx_menu1);
|
|
||||||
strcpy(temp, cv_grfogcolor.string);
|
|
||||||
strcpy(cv_grfogcolor.zstring, "000000");
|
|
||||||
l = strlen(temp)-1;
|
|
||||||
for (i = 0; i < l; i++)
|
|
||||||
cv_grfogcolor.zstring[i + 6 - l] = temp[i];
|
|
||||||
break;
|
|
||||||
|
|
||||||
default:
|
|
||||||
if ((choice >= '0' && choice <= '9') || (choice >= 'a' && choice <= 'f')
|
|
||||||
|| (choice >= 'A' && choice <= 'F'))
|
|
||||||
{
|
|
||||||
S_StartSound(NULL, sfx_menu1);
|
|
||||||
strcpy(temp, cv_grfogcolor.string);
|
|
||||||
strcpy(cv_grfogcolor.zstring, "000000");
|
|
||||||
l = strlen(temp);
|
|
||||||
for (i = 0; i < l; i++)
|
|
||||||
cv_grfogcolor.zstring[5 - i] = temp[l - i];
|
|
||||||
cv_grfogcolor.zstring[5] = (char)choice;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
if (exitmenu)
|
|
||||||
{
|
|
||||||
if (currentMenu->prevMenu)
|
|
||||||
M_SetupNextMenu(currentMenu->prevMenu);
|
|
||||||
else
|
|
||||||
M_ClearMenus(true);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#endif
|
#endif
|
||||||
|
|
58
src/m_misc.c
58
src/m_misc.c
|
@ -30,6 +30,7 @@
|
||||||
#include "g_game.h"
|
#include "g_game.h"
|
||||||
#include "m_misc.h"
|
#include "m_misc.h"
|
||||||
#include "hu_stuff.h"
|
#include "hu_stuff.h"
|
||||||
|
#include "st_stuff.h"
|
||||||
#include "v_video.h"
|
#include "v_video.h"
|
||||||
#include "z_zone.h"
|
#include "z_zone.h"
|
||||||
#include "g_input.h"
|
#include "g_input.h"
|
||||||
|
@ -586,6 +587,21 @@ void M_SaveConfig(const char *filename)
|
||||||
fclose(f);
|
fclose(f);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ==========================================================================
|
||||||
|
// SCREENSHOTS
|
||||||
|
// ==========================================================================
|
||||||
|
static UINT8 screenshot_palette[768];
|
||||||
|
static void M_CreateScreenShotPalette(void)
|
||||||
|
{
|
||||||
|
size_t i, j;
|
||||||
|
for (i = 0, j = 0; i < 768; i += 3, j++)
|
||||||
|
{
|
||||||
|
RGBA_t locpal = pLocalPalette[(max(st_palette,0)*256)+j];
|
||||||
|
screenshot_palette[i] = locpal.s.red;
|
||||||
|
screenshot_palette[i+1] = locpal.s.green;
|
||||||
|
screenshot_palette[i+2] = locpal.s.blue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#if NUMSCREENS > 2
|
#if NUMSCREENS > 2
|
||||||
static const char *Newsnapshotfile(const char *pathname, const char *ext)
|
static const char *Newsnapshotfile(const char *pathname, const char *ext)
|
||||||
|
@ -1017,6 +1033,7 @@ static boolean M_SetupaPNG(png_const_charp filename, png_bytep pal)
|
||||||
static inline moviemode_t M_StartMovieAPNG(const char *pathname)
|
static inline moviemode_t M_StartMovieAPNG(const char *pathname)
|
||||||
{
|
{
|
||||||
#ifdef USE_APNG
|
#ifdef USE_APNG
|
||||||
|
UINT8 *palette;
|
||||||
const char *freename = NULL;
|
const char *freename = NULL;
|
||||||
boolean ret = false;
|
boolean ret = false;
|
||||||
|
|
||||||
|
@ -1032,10 +1049,8 @@ static inline moviemode_t M_StartMovieAPNG(const char *pathname)
|
||||||
return MM_OFF;
|
return MM_OFF;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (rendermode == render_soft)
|
if (rendermode == render_soft) M_CreateScreenShotPalette();
|
||||||
ret = M_SetupaPNG(va(pandf,pathname,freename), W_CacheLumpName(GetPalette(), PU_CACHE));
|
ret = M_SetupaPNG(va(pandf,pathname,freename), (palette = screenshot_palette));
|
||||||
else
|
|
||||||
ret = M_SetupaPNG(va(pandf,pathname,freename), NULL);
|
|
||||||
|
|
||||||
if (!ret)
|
if (!ret)
|
||||||
{
|
{
|
||||||
|
@ -1238,7 +1253,7 @@ void M_StopMovie(void)
|
||||||
* \param data The image data.
|
* \param data The image data.
|
||||||
* \param width Width of the picture.
|
* \param width Width of the picture.
|
||||||
* \param height Height of the picture.
|
* \param height Height of the picture.
|
||||||
* \param palette Palette of image data
|
* \param palette Palette of image data.
|
||||||
* \note if palette is NULL, BGR888 format
|
* \note if palette is NULL, BGR888 format
|
||||||
*/
|
*/
|
||||||
boolean M_SavePNG(const char *filename, void *data, int width, int height, const UINT8 *palette)
|
boolean M_SavePNG(const char *filename, void *data, int width, int height, const UINT8 *palette)
|
||||||
|
@ -1260,8 +1275,7 @@ boolean M_SavePNG(const char *filename, void *data, int width, int height, const
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
png_ptr = png_create_write_struct(PNG_LIBPNG_VER_STRING, NULL,
|
png_ptr = png_create_write_struct(PNG_LIBPNG_VER_STRING, NULL, PNG_error, PNG_warn);
|
||||||
PNG_error, PNG_warn);
|
|
||||||
if (!png_ptr)
|
if (!png_ptr)
|
||||||
{
|
{
|
||||||
CONS_Debug(DBG_RENDER, "M_SavePNG: Error on initialize libpng\n");
|
CONS_Debug(DBG_RENDER, "M_SavePNG: Error on initialize libpng\n");
|
||||||
|
@ -1415,9 +1429,8 @@ void M_ScreenShot(void)
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Takes a screenshot.
|
/** Takes a screenshot.
|
||||||
* The screenshot is saved as "kartxxxx.pcx" (or "kartxxxx.tga" in hardware
|
* The screenshot is saved as "srb2xxxx.png" where xxxx is the lowest
|
||||||
* rendermode) where xxxx is the lowest four-digit number for which a file
|
* four-digit number for which a file does not already exist.
|
||||||
* does not already exist.
|
|
||||||
*
|
*
|
||||||
* \sa HWR_ScreenShot
|
* \sa HWR_ScreenShot
|
||||||
*/
|
*/
|
||||||
|
@ -1431,6 +1444,10 @@ void M_DoScreenShot(void)
|
||||||
// Don't take multiple screenshots, obviously
|
// Don't take multiple screenshots, obviously
|
||||||
takescreenshot = false;
|
takescreenshot = false;
|
||||||
|
|
||||||
|
// how does one take a screenshot without a render system?
|
||||||
|
if (rendermode == render_none)
|
||||||
|
return;
|
||||||
|
|
||||||
if (cv_screenshot_option.value == 0)
|
if (cv_screenshot_option.value == 0)
|
||||||
pathname = usehome ? srb2home : srb2path;
|
pathname = usehome ? srb2home : srb2path;
|
||||||
else if (cv_screenshot_option.value == 1)
|
else if (cv_screenshot_option.value == 1)
|
||||||
|
@ -1441,16 +1458,13 @@ void M_DoScreenShot(void)
|
||||||
pathname = cv_screenshot_folder.string;
|
pathname = cv_screenshot_folder.string;
|
||||||
|
|
||||||
#ifdef USE_PNG
|
#ifdef USE_PNG
|
||||||
if (rendermode != render_none)
|
|
||||||
freename = Newsnapshotfile(pathname,"png");
|
freename = Newsnapshotfile(pathname,"png");
|
||||||
#else
|
#else
|
||||||
if (rendermode == render_soft)
|
if (rendermode == render_soft)
|
||||||
freename = Newsnapshotfile(pathname,"pcx");
|
freename = Newsnapshotfile(pathname,"pcx");
|
||||||
else if (rendermode != render_none)
|
else if (rendermode == render_opengl)
|
||||||
freename = Newsnapshotfile(pathname,"tga");
|
freename = Newsnapshotfile(pathname,"tga");
|
||||||
#endif
|
#endif
|
||||||
else
|
|
||||||
I_Error("Can't take a screenshot without a render system");
|
|
||||||
|
|
||||||
if (rendermode == render_soft)
|
if (rendermode == render_soft)
|
||||||
{
|
{
|
||||||
|
@ -1464,18 +1478,16 @@ void M_DoScreenShot(void)
|
||||||
|
|
||||||
// save the pcx file
|
// save the pcx file
|
||||||
#ifdef HWRENDER
|
#ifdef HWRENDER
|
||||||
if (rendermode != render_soft)
|
if (rendermode == render_opengl)
|
||||||
ret = HWR_Screenshot(va(pandf,pathname,freename));
|
ret = HWR_Screenshot(va(pandf,pathname,freename));
|
||||||
else
|
else
|
||||||
#endif
|
#endif
|
||||||
if (rendermode != render_none)
|
|
||||||
{
|
{
|
||||||
|
M_CreateScreenShotPalette();
|
||||||
#ifdef USE_PNG
|
#ifdef USE_PNG
|
||||||
ret = M_SavePNG(va(pandf,pathname,freename), linear, vid.width, vid.height,
|
ret = M_SavePNG(va(pandf,pathname,freename), linear, vid.width, vid.height, screenshot_palette);
|
||||||
W_CacheLumpName(GetPalette(), PU_CACHE));
|
|
||||||
#else
|
#else
|
||||||
ret = WritePCXfile(va(pandf,pathname,freename), linear, vid.width, vid.height,
|
ret = WritePCXfile(va(pandf,pathname,freename), linear, vid.width, vid.height, screenshot_palette);
|
||||||
W_CacheLumpName(GetPalette(), PU_CACHE));
|
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1483,14 +1495,14 @@ failure:
|
||||||
if (ret)
|
if (ret)
|
||||||
{
|
{
|
||||||
if (moviemode != MM_SCREENSHOT)
|
if (moviemode != MM_SCREENSHOT)
|
||||||
CONS_Printf(M_GetText("screen shot %s saved in %s\n"), freename, pathname);
|
CONS_Printf(M_GetText("Screen shot %s saved in %s\n"), freename, pathname);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (freename)
|
if (freename)
|
||||||
CONS_Printf(M_GetText("Couldn't create screen shot %s in %s\n"), freename, pathname);
|
CONS_Alert(CONS_ERROR, M_GetText("Couldn't create screen shot %s in %s\n"), freename, pathname);
|
||||||
else
|
else
|
||||||
CONS_Printf(M_GetText("Couldn't create screen shot (all 10000 slots used!) in %s\n"), pathname);
|
CONS_Alert(CONS_ERROR, M_GetText("Couldn't create screen shot in %s (all 10000 slots used!)\n"), pathname);
|
||||||
|
|
||||||
if (moviemode == MM_SCREENSHOT)
|
if (moviemode == MM_SCREENSHOT)
|
||||||
M_StopMovie();
|
M_StopMovie();
|
||||||
|
|
|
@ -160,7 +160,7 @@ void NDS3D_DrawPolygon(FSurfaceInfo *pSurf, FOutVector *pOutVerts, FUINT iNumPts
|
||||||
z = pOutVerts[index].z;
|
z = pOutVerts[index].z;
|
||||||
}
|
}
|
||||||
|
|
||||||
glTexCoord2f(pOutVerts[index].sow, pOutVerts[index].tow);
|
glTexCoord2f(pOutVerts[index].s, pOutVerts[index].tow);
|
||||||
glVertex3f(x,y,z);
|
glVertex3f(x,y,z);
|
||||||
}
|
}
|
||||||
glEnd();
|
glEnd();
|
||||||
|
|
|
@ -465,11 +465,7 @@ static void P_LoadRawSegs(UINT8 *data, size_t i)
|
||||||
li->length = P_SegLength(li);
|
li->length = P_SegLength(li);
|
||||||
#ifdef HWRENDER
|
#ifdef HWRENDER
|
||||||
if (rendermode == render_opengl)
|
if (rendermode == render_opengl)
|
||||||
{
|
|
||||||
li->flength = P_SegLengthFloat(li);
|
li->flength = P_SegLengthFloat(li);
|
||||||
//Hurdler: 04/12/2000: for now, only used in hardware mode
|
|
||||||
li->lightmaps = NULL; // list of static lightmap for this seg
|
|
||||||
}
|
|
||||||
li->pv1 = li->pv2 = NULL;
|
li->pv1 = li->pv2 = NULL;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -1412,6 +1408,8 @@ static void P_LoadRawSideDefs2(void *data)
|
||||||
{
|
{
|
||||||
UINT16 i;
|
UINT16 i;
|
||||||
INT32 num;
|
INT32 num;
|
||||||
|
size_t j;
|
||||||
|
UINT32 cr, cg, cb;
|
||||||
|
|
||||||
for (i = 0; i < numsides; i++)
|
for (i = 0; i < numsides; i++)
|
||||||
{
|
{
|
||||||
|
@ -1490,16 +1488,43 @@ static void P_LoadRawSideDefs2(void *data)
|
||||||
{
|
{
|
||||||
col = msd->toptexture;
|
col = msd->toptexture;
|
||||||
|
|
||||||
sec->extra_colormap->rgba =
|
// encore mode colormaps!
|
||||||
(HEX2INT(col[1]) << 4) + (HEX2INT(col[2]) << 0) +
|
// do it like software by aproximating a color to a palette index, and then convert it to its encore variant and then back to a color code.
|
||||||
(HEX2INT(col[3]) << 12) + (HEX2INT(col[4]) << 8) +
|
// do this for both the start and fade colormaps.
|
||||||
(HEX2INT(col[5]) << 20) + (HEX2INT(col[6]) << 16);
|
|
||||||
|
cr = (HEX2INT(col[1]) << 4) + (HEX2INT(col[2]) << 0);
|
||||||
|
cg = (HEX2INT(col[3]) << 12) + (HEX2INT(col[4]) << 8);
|
||||||
|
cb = (HEX2INT(col[5]) << 20) + (HEX2INT(col[6]) << 16);
|
||||||
|
|
||||||
|
#ifdef GLENCORE
|
||||||
|
if (encoremap)
|
||||||
|
{
|
||||||
|
j = encoremap[NearestColor((UINT8)cr, (UINT8)cg, (UINT8)cb)];
|
||||||
|
//CONS_Printf("R_CreateColormap: encoremap[%d] = %d\n", j, encoremap[j]); -- moved encoremap upwards for optimisation
|
||||||
|
cr = pLocalPalette[j].s.red;
|
||||||
|
cg = pLocalPalette[j].s.green;
|
||||||
|
cb = pLocalPalette[j].s.blue;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
sec->extra_colormap->rgba = cr + cg + cb;
|
||||||
|
|
||||||
// alpha
|
// alpha
|
||||||
if (msd->toptexture[7])
|
if (msd->toptexture[7])
|
||||||
sec->extra_colormap->rgba += (ALPHA2INT(col[7]) << 24);
|
sec->extra_colormap->rgba += (ALPHA2INT(col[7]) << 24);
|
||||||
else
|
else
|
||||||
sec->extra_colormap->rgba += (25 << 24);
|
sec->extra_colormap->rgba += (25 << 24);
|
||||||
|
|
||||||
|
/*nearest = NearestColor(
|
||||||
|
(HEX2INT(col[1]) << 4) + (HEX2INT(col[2]) << 0),
|
||||||
|
(HEX2INT(col[3]) << 4) + (HEX2INT(col[4]) << 0),
|
||||||
|
(HEX2INT(col[5]) << 4) + (HEX2INT(col[6]) << 0)
|
||||||
|
);
|
||||||
|
|
||||||
|
sec->extra_colormap->rgba =
|
||||||
|
pLocalPalette[nearest].s.red +
|
||||||
|
(pLocalPalette[nearest].s.green << 8) +
|
||||||
|
(pLocalPalette[nearest].s.blue << 16);*/
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
sec->extra_colormap->rgba = 0;
|
sec->extra_colormap->rgba = 0;
|
||||||
|
@ -1508,10 +1533,24 @@ static void P_LoadRawSideDefs2(void *data)
|
||||||
{
|
{
|
||||||
col = msd->bottomtexture;
|
col = msd->bottomtexture;
|
||||||
|
|
||||||
sec->extra_colormap->fadergba =
|
// do the exact same thing as above here.
|
||||||
(HEX2INT(col[1]) << 4) + (HEX2INT(col[2]) << 0) +
|
|
||||||
(HEX2INT(col[3]) << 12) + (HEX2INT(col[4]) << 8) +
|
cr = (HEX2INT(col[1]) << 4) + (HEX2INT(col[2]) << 0);
|
||||||
(HEX2INT(col[5]) << 20) + (HEX2INT(col[6]) << 16);
|
cg = (HEX2INT(col[3]) << 12) + (HEX2INT(col[4]) << 8);
|
||||||
|
cb = (HEX2INT(col[5]) << 20) + (HEX2INT(col[6]) << 16);
|
||||||
|
|
||||||
|
#ifdef GLENCORE
|
||||||
|
if (encoremap)
|
||||||
|
{
|
||||||
|
j = encoremap[NearestColor((UINT8)cr, (UINT8)cg, (UINT8)cb)];
|
||||||
|
//CONS_Printf("R_CreateColormap: encoremap[%d] = %d\n", j, encoremap[j]); -- moved encoremap upwards for optimisation
|
||||||
|
cr = pLocalPalette[j].s.red;
|
||||||
|
cg = pLocalPalette[j].s.green;
|
||||||
|
cb = pLocalPalette[j].s.blue;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
sec->extra_colormap->fadergba = cr + cg + cb;
|
||||||
|
|
||||||
// alpha
|
// alpha
|
||||||
if (msd->bottomtexture[7])
|
if (msd->bottomtexture[7])
|
||||||
|
@ -3089,10 +3128,6 @@ boolean P_SetupLevel(boolean skipprecip)
|
||||||
#ifdef HWRENDER // not win32 only 19990829 by Kin
|
#ifdef HWRENDER // not win32 only 19990829 by Kin
|
||||||
if (rendermode != render_soft && rendermode != render_none)
|
if (rendermode != render_soft && rendermode != render_none)
|
||||||
{
|
{
|
||||||
#ifdef ALAM_LIGHTING
|
|
||||||
// BP: reset light between levels (we draw preview frame lights on current frame)
|
|
||||||
HWR_ResetLights();
|
|
||||||
#endif
|
|
||||||
// Correct missing sidedefs & deep water trick
|
// Correct missing sidedefs & deep water trick
|
||||||
HWR_CorrectSWTricks();
|
HWR_CorrectSWTricks();
|
||||||
HWR_CreatePlanePolygons((INT32)numnodes - 1);
|
HWR_CreatePlanePolygons((INT32)numnodes - 1);
|
||||||
|
|
|
@ -37,7 +37,7 @@ drawseg_t *ds_p = NULL;
|
||||||
// indicates doors closed wrt automap bugfix:
|
// indicates doors closed wrt automap bugfix:
|
||||||
INT32 doorclosed;
|
INT32 doorclosed;
|
||||||
|
|
||||||
static boolean R_NoEncore(sector_t *sector, boolean ceiling)
|
boolean R_NoEncore(sector_t *sector, boolean ceiling)
|
||||||
{
|
{
|
||||||
boolean invertencore = (GETSECSPECIAL(sector->special, 2) == 15);
|
boolean invertencore = (GETSECSPECIAL(sector->special, 2) == 15);
|
||||||
#if 0 // perfect implementation
|
#if 0 // perfect implementation
|
||||||
|
|
|
@ -40,6 +40,10 @@ void R_ClearDrawSegs(void);
|
||||||
void R_RenderBSPNode(INT32 bspnum);
|
void R_RenderBSPNode(INT32 bspnum);
|
||||||
void R_AddPortal(INT32 line1, INT32 line2, INT32 x1, INT32 x2);
|
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:
|
||||||
|
boolean R_NoEncore(sector_t *sector, boolean ceiling);
|
||||||
|
|
||||||
#ifdef POLYOBJECTS
|
#ifdef POLYOBJECTS
|
||||||
void R_SortPolyObjects(subsector_t *sub);
|
void R_SortPolyObjects(subsector_t *sub);
|
||||||
|
|
||||||
|
|
|
@ -1177,7 +1177,6 @@ void R_ClearColormaps(void)
|
||||||
//
|
//
|
||||||
static double deltas[256][3], map[256][3];
|
static double deltas[256][3], map[256][3];
|
||||||
|
|
||||||
static UINT8 NearestColor(UINT8 r, UINT8 g, UINT8 b);
|
|
||||||
static int RoundUp(double number);
|
static int RoundUp(double number);
|
||||||
|
|
||||||
#ifdef HASINVERT
|
#ifdef HASINVERT
|
||||||
|
@ -1403,7 +1402,7 @@ INT32 R_CreateColormap(char *p1, char *p2, char *p3)
|
||||||
|
|
||||||
// Thanks to quake2 source!
|
// Thanks to quake2 source!
|
||||||
// utils3/qdata/images.c
|
// utils3/qdata/images.c
|
||||||
static UINT8 NearestColor(UINT8 r, UINT8 g, UINT8 b)
|
UINT8 NearestColor(UINT8 r, UINT8 g, UINT8 b)
|
||||||
{
|
{
|
||||||
int dr, dg, db;
|
int dr, dg, db;
|
||||||
int distortion, bestdistortion = 256 * 256 * 4, bestcolor = 0, i;
|
int distortion, bestdistortion = 256 * 256 * 4, bestcolor = 0, i;
|
||||||
|
|
|
@ -100,4 +100,6 @@ const char *R_ColormapNameForNum(INT32 num);
|
||||||
|
|
||||||
extern INT32 numtextures;
|
extern INT32 numtextures;
|
||||||
|
|
||||||
|
UINT8 NearestColor(UINT8 r, UINT8 g, UINT8 b);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
27
src/r_defs.h
27
src/r_defs.h
|
@ -526,31 +526,6 @@ typedef struct mprecipsecnode_s
|
||||||
boolean visited; // used in search algorithms
|
boolean visited; // used in search algorithms
|
||||||
} mprecipsecnode_t;
|
} mprecipsecnode_t;
|
||||||
|
|
||||||
// for now, only used in hardware mode
|
|
||||||
// maybe later for software as well?
|
|
||||||
// that's why it's moved here
|
|
||||||
typedef struct light_s
|
|
||||||
{
|
|
||||||
UINT16 type; // light,... (cfr #define in hwr_light.c)
|
|
||||||
|
|
||||||
float light_xoffset;
|
|
||||||
float light_yoffset; // y offset to adjust corona's height
|
|
||||||
|
|
||||||
UINT32 corona_color; // color of the light for static lighting
|
|
||||||
float corona_radius; // radius of the coronas
|
|
||||||
|
|
||||||
UINT32 dynamic_color; // color of the light for dynamic lighting
|
|
||||||
float dynamic_radius; // radius of the light ball
|
|
||||||
float dynamic_sqrradius; // radius^2 of the light ball
|
|
||||||
} light_t;
|
|
||||||
|
|
||||||
typedef struct lightmap_s
|
|
||||||
{
|
|
||||||
float s[2], t[2];
|
|
||||||
light_t *light;
|
|
||||||
struct lightmap_s *next;
|
|
||||||
} lightmap_t;
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// The lineseg.
|
// The lineseg.
|
||||||
//
|
//
|
||||||
|
@ -579,8 +554,6 @@ typedef struct seg_s
|
||||||
void *pv1; // polyvertex_t
|
void *pv1; // polyvertex_t
|
||||||
void *pv2; // polyvertex_t
|
void *pv2; // polyvertex_t
|
||||||
float flength; // length of the seg, used by hardware renderer
|
float flength; // length of the seg, used by hardware renderer
|
||||||
|
|
||||||
lightmap_t *lightmaps; // for static lightmap
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Why slow things down by calculating lightlists for every thick side?
|
// Why slow things down by calculating lightlists for every thick side?
|
||||||
|
|
35
src/r_main.c
35
src/r_main.c
|
@ -137,7 +137,7 @@ static CV_PossibleValue_t drawdist_precip_cons_t[] = {
|
||||||
{1024, "1024"}, {1536, "1536"}, {2048, "2048"},
|
{1024, "1024"}, {1536, "1536"}, {2048, "2048"},
|
||||||
{0, "None"}, {0, NULL}};
|
{0, "None"}, {0, NULL}};
|
||||||
|
|
||||||
static CV_PossibleValue_t fov_cons_t[] = {{0, "MIN"}, {179*FRACUNIT, "MAX"}, {0, NULL}};
|
static CV_PossibleValue_t fov_cons_t[] = {{45*FRACUNIT, "MIN"}, {120*FRACUNIT, "MAX"}, {0, NULL}};
|
||||||
|
|
||||||
//static CV_PossibleValue_t precipdensity_cons_t[] = {{0, "None"}, {1, "Light"}, {2, "Moderate"}, {4, "Heavy"}, {6, "Thick"}, {8, "V.Thick"}, {0, NULL}};
|
//static CV_PossibleValue_t precipdensity_cons_t[] = {{0, "None"}, {1, "Light"}, {2, "Moderate"}, {4, "Heavy"}, {6, "Thick"}, {8, "V.Thick"}, {0, NULL}};
|
||||||
static CV_PossibleValue_t translucenthud_cons_t[] = {{0, "MIN"}, {10, "MAX"}, {0, NULL}};
|
static CV_PossibleValue_t translucenthud_cons_t[] = {{0, "MIN"}, {10, "MAX"}, {0, NULL}};
|
||||||
|
@ -181,7 +181,9 @@ consvar_t cv_drawdist = {"drawdist", "Infinite", CV_SAVE, drawdist_cons_t, NULL,
|
||||||
//consvar_t cv_drawdist_nights = {"drawdist_nights", "2048", CV_SAVE, drawdist_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
|
//consvar_t cv_drawdist_nights = {"drawdist_nights", "2048", CV_SAVE, drawdist_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||||
consvar_t cv_drawdist_precip = {"drawdist_precip", "1024", CV_SAVE, drawdist_precip_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
|
consvar_t cv_drawdist_precip = {"drawdist_precip", "1024", CV_SAVE, drawdist_precip_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||||
//consvar_t cv_precipdensity = {"precipdensity", "Moderate", CV_SAVE, precipdensity_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
|
//consvar_t cv_precipdensity = {"precipdensity", "Moderate", CV_SAVE, precipdensity_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||||
consvar_t cv_fov = {"fov", "90", CV_FLOAT|CV_CALL, fov_cons_t, Fov_OnChange, 0, NULL, NULL, 0, 0, NULL};
|
|
||||||
|
// cap fov, fov too high tears software apart.
|
||||||
|
consvar_t cv_fov = {"fov", "90", CV_FLOAT|CV_CALL|CV_SAVE, fov_cons_t, Fov_OnChange, 0, NULL, NULL, 0, 0, NULL};
|
||||||
|
|
||||||
// Okay, whoever said homremoval causes a performance hit should be shot.
|
// Okay, whoever said homremoval causes a performance hit should be shot.
|
||||||
consvar_t cv_homremoval = {"homremoval", "Yes", CV_SAVE, homremoval_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
|
consvar_t cv_homremoval = {"homremoval", "Yes", CV_SAVE, homremoval_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||||
|
@ -686,11 +688,6 @@ void R_ExecuteSetViewSize(void)
|
||||||
|
|
||||||
R_InitTextureMapping();
|
R_InitTextureMapping();
|
||||||
|
|
||||||
#ifdef HWRENDER
|
|
||||||
if (rendermode != render_soft)
|
|
||||||
HWR_InitTextureMapping();
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// thing clipping
|
// thing clipping
|
||||||
for (i = 0; i < viewwidth; i++)
|
for (i = 0; i < viewwidth; i++)
|
||||||
screenheightarray[i] = (INT16)viewheight;
|
screenheightarray[i] = (INT16)viewheight;
|
||||||
|
@ -820,29 +817,31 @@ subsector_t *R_IsPointInSubsector(fixed_t x, fixed_t y)
|
||||||
|
|
||||||
static mobj_t *viewmobj;
|
static mobj_t *viewmobj;
|
||||||
|
|
||||||
// WARNING: a should be unsigned but to add with 2048, it isn't!
|
|
||||||
#define AIMINGTODY(a) FixedDiv((FINETANGENT((2048+(((INT32)a)>>ANGLETOFINESHIFT)) & FINEMASK)*160)>>FRACBITS, fovtan)
|
|
||||||
|
|
||||||
// recalc necessary stuff for mouseaiming
|
// recalc necessary stuff for mouseaiming
|
||||||
// slopes are already calculated for the full possible view (which is 4*viewheight).
|
// slopes are already calculated for the full possible view (which is 4*viewheight).
|
||||||
// 18/08/18: (No it's actually 16*viewheight, thanks Jimita for finding this out)
|
// 18/08/18: (No it's actually 16*viewheight, thanks Jimita for finding this out)
|
||||||
static void R_SetupFreelook(void)
|
static void R_SetupFreelook(void)
|
||||||
{
|
{
|
||||||
INT32 dy = 0;
|
INT32 dy = 0;
|
||||||
if (rendermode == render_soft)
|
|
||||||
{
|
|
||||||
// clip it in the case we are looking a hardware 90 degrees full aiming
|
// clip it in the case we are looking a hardware 90 degrees full aiming
|
||||||
// (lmps, network and use F12...)
|
// (lmps, network and use F12...)
|
||||||
|
if (rendermode == render_soft
|
||||||
|
#ifdef HWRENDER
|
||||||
|
|| cv_grshearing.value
|
||||||
|
#endif
|
||||||
|
)
|
||||||
G_SoftwareClipAimingPitch((INT32 *)&aimingangle);
|
G_SoftwareClipAimingPitch((INT32 *)&aimingangle);
|
||||||
dy = AIMINGTODY(aimingangle) * viewwidth/BASEVIDWIDTH;
|
|
||||||
|
if (rendermode == render_soft)
|
||||||
|
{
|
||||||
|
dy = (AIMINGTODY(aimingangle)>>FRACBITS) * viewwidth/BASEVIDWIDTH;
|
||||||
yslope = &yslopetab[viewheight*8 - (viewheight/2 + dy)];
|
yslope = &yslopetab[viewheight*8 - (viewheight/2 + dy)];
|
||||||
}
|
}
|
||||||
centery = (viewheight/2) + dy;
|
centery = (viewheight/2) + dy;
|
||||||
centeryfrac = centery<<FRACBITS;
|
centeryfrac = centery<<FRACBITS;
|
||||||
}
|
}
|
||||||
|
|
||||||
#undef AIMINGTODY
|
|
||||||
|
|
||||||
void R_SkyboxFrame(player_t *player)
|
void R_SkyboxFrame(player_t *player)
|
||||||
{
|
{
|
||||||
camera_t *thiscam = &camera[0];
|
camera_t *thiscam = &camera[0];
|
||||||
|
@ -1552,8 +1551,7 @@ void R_RegisterEngineStuff(void)
|
||||||
CV_RegisterVar(&cv_grgammared);
|
CV_RegisterVar(&cv_grgammared);
|
||||||
CV_RegisterVar(&cv_grfovchange);
|
CV_RegisterVar(&cv_grfovchange);
|
||||||
CV_RegisterVar(&cv_grfog);
|
CV_RegisterVar(&cv_grfog);
|
||||||
CV_RegisterVar(&cv_grfogcolor);
|
//CV_RegisterVar(&cv_grfogcolor);
|
||||||
CV_RegisterVar(&cv_grsoftwarefog);
|
|
||||||
#ifdef ALAM_LIGHTING
|
#ifdef ALAM_LIGHTING
|
||||||
CV_RegisterVar(&cv_grstaticlighting);
|
CV_RegisterVar(&cv_grstaticlighting);
|
||||||
CV_RegisterVar(&cv_grdynamiclighting);
|
CV_RegisterVar(&cv_grdynamiclighting);
|
||||||
|
@ -1562,7 +1560,10 @@ void R_RegisterEngineStuff(void)
|
||||||
#endif
|
#endif
|
||||||
CV_RegisterVar(&cv_grmdls);
|
CV_RegisterVar(&cv_grmdls);
|
||||||
CV_RegisterVar(&cv_grfallbackplayermodel);
|
CV_RegisterVar(&cv_grfallbackplayermodel);
|
||||||
|
CV_RegisterVar(&cv_grfogdensity);
|
||||||
CV_RegisterVar(&cv_grspritebillboarding);
|
CV_RegisterVar(&cv_grspritebillboarding);
|
||||||
|
CV_RegisterVar(&cv_grshearing);
|
||||||
|
CV_RegisterVar(&cv_grshaders);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef HWRENDER
|
#ifdef HWRENDER
|
||||||
|
|
|
@ -259,6 +259,11 @@ static boolean R_AddSingleSpriteDef(const char *sprname, spritedef_t *spritedef,
|
||||||
//BP: we cannot use special tric in hardware mode because feet in ground caused by z-buffer
|
//BP: we cannot use special tric in hardware mode because feet in ground caused by z-buffer
|
||||||
if (rendermode != render_none) // not for psprite
|
if (rendermode != render_none) // not for psprite
|
||||||
spritecachedinfo[numspritelumps].topoffset += 4<<FRACBITS;
|
spritecachedinfo[numspritelumps].topoffset += 4<<FRACBITS;
|
||||||
|
|
||||||
|
// Idea, how about we do it like literally every hardware renderer ever?
|
||||||
|
if (rendermode == render_opengl)
|
||||||
|
spritecachedinfo[numspritelumps].topoffset += 5<<FRACBITS;
|
||||||
|
|
||||||
// Being selective with this causes bad things. :( Like the special stage tokens breaking apart.
|
// Being selective with this causes bad things. :( Like the special stage tokens breaking apart.
|
||||||
/*if (rendermode != render_none // not for psprite
|
/*if (rendermode != render_none // not for psprite
|
||||||
&& SHORT(patch.topoffset)>0 && SHORT(patch.topoffset)<SHORT(patch.height))
|
&& SHORT(patch.topoffset)>0 && SHORT(patch.topoffset)<SHORT(patch.height))
|
||||||
|
|
|
@ -93,6 +93,7 @@
|
||||||
<Import Project="..\..\libs\libpng.props" />
|
<Import Project="..\..\libs\libpng.props" />
|
||||||
<Import Project="..\..\libs\SDL2.props" />
|
<Import Project="..\..\libs\SDL2.props" />
|
||||||
<Import Project="..\..\libs\SDL_mixer.props" />
|
<Import Project="..\..\libs\SDL_mixer.props" />
|
||||||
|
<Import Project="..\..\libs\libgme.props" />
|
||||||
<Import Project="Srb2SDL.props" />
|
<Import Project="Srb2SDL.props" />
|
||||||
</ImportGroup>
|
</ImportGroup>
|
||||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||||
|
@ -222,7 +223,6 @@
|
||||||
<ClInclude Include="..\hardware\hw_defs.h" />
|
<ClInclude Include="..\hardware\hw_defs.h" />
|
||||||
<ClInclude Include="..\hardware\hw_dll.h" />
|
<ClInclude Include="..\hardware\hw_dll.h" />
|
||||||
<ClInclude Include="..\hardware\hw_drv.h" />
|
<ClInclude Include="..\hardware\hw_drv.h" />
|
||||||
<ClInclude Include="..\hardware\hw_glide.h" />
|
|
||||||
<ClInclude Include="..\hardware\hw_glob.h" />
|
<ClInclude Include="..\hardware\hw_glob.h" />
|
||||||
<ClInclude Include="..\hardware\hw_light.h" />
|
<ClInclude Include="..\hardware\hw_light.h" />
|
||||||
<ClInclude Include="..\hardware\hw_main.h" />
|
<ClInclude Include="..\hardware\hw_main.h" />
|
||||||
|
|
|
@ -231,9 +231,6 @@
|
||||||
<ClInclude Include="..\hardware\hw_drv.h">
|
<ClInclude Include="..\hardware\hw_drv.h">
|
||||||
<Filter>Hw_Hardware</Filter>
|
<Filter>Hw_Hardware</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
<ClInclude Include="..\hardware\hw_glide.h">
|
|
||||||
<Filter>Hw_Hardware</Filter>
|
|
||||||
</ClInclude>
|
|
||||||
<ClInclude Include="..\hardware\hw_glob.h">
|
<ClInclude Include="..\hardware\hw_glob.h">
|
||||||
<Filter>Hw_Hardware</Filter>
|
<Filter>Hw_Hardware</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
|
|
|
@ -2410,10 +2410,6 @@
|
||||||
RelativePath="..\hardware\hw_drv.h"
|
RelativePath="..\hardware\hw_drv.h"
|
||||||
>
|
>
|
||||||
</File>
|
</File>
|
||||||
<File
|
|
||||||
RelativePath="..\hardware\hw_glide.h"
|
|
||||||
>
|
|
||||||
</File>
|
|
||||||
<File
|
<File
|
||||||
RelativePath="..\hardware\hw_glob.h"
|
RelativePath="..\hardware\hw_glob.h"
|
||||||
>
|
>
|
||||||
|
|
|
@ -576,10 +576,6 @@ SOURCE=..\hardware\hw_drv.h
|
||||||
# End Source File
|
# End Source File
|
||||||
# Begin Source File
|
# Begin Source File
|
||||||
|
|
||||||
SOURCE=..\hardware\hw_glide.h
|
|
||||||
# End Source File
|
|
||||||
# Begin Source File
|
|
||||||
|
|
||||||
SOURCE=..\hardware\hw_glob.h
|
SOURCE=..\hardware\hw_glob.h
|
||||||
# End Source File
|
# End Source File
|
||||||
# Begin Source File
|
# Begin Source File
|
||||||
|
|
|
@ -5,7 +5,10 @@
|
||||||
<PropertyGroup />
|
<PropertyGroup />
|
||||||
<ItemDefinitionGroup>
|
<ItemDefinitionGroup>
|
||||||
<ClCompile>
|
<ClCompile>
|
||||||
<PreprocessorDefinitions>USE_WGL_SWAP;DIRECTFULLSCREEN;HAVE_SDL;HWRENDER;HW3SOUND;HAVE_FILTER;HAVE_MIXER;SDLMAIN;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
<!-- x86/x64 defines: has specific libraries that ARM does not -->
|
||||||
|
<PreprocessorDefinitions Condition="'$(Platform)' == 'Win32' OR '$(Platform)' == 'x64'">HAVE_ZLIB;HAVE_LIBGME;USE_WGL_SWAP;DIRECTFULLSCREEN;HAVE_SDL;HWRENDER;HW3SOUND;HAVE_FILTER;HAVE_MIXER;SDLMAIN;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||||
|
<!-- ARM defines -->
|
||||||
|
<PreprocessorDefinitions Condition="'$(Platform)' != 'Win32' AND '$(Platform)' != 'x64'">USE_WGL_SWAP;DIRECTFULLSCREEN;HAVE_SDL;HWRENDER;HW3SOUND;HAVE_FILTER;HAVE_MIXER;SDLMAIN;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
</ItemDefinitionGroup>
|
</ItemDefinitionGroup>
|
||||||
<ItemGroup />
|
<ItemGroup />
|
||||||
|
|
|
@ -76,6 +76,7 @@ void *hwSym(const char *funcName,void *handle)
|
||||||
#ifdef HWRENDER
|
#ifdef HWRENDER
|
||||||
if (0 == strcmp("SetPalette", funcName))
|
if (0 == strcmp("SetPalette", funcName))
|
||||||
funcPointer = &OglSdlSetPalette;
|
funcPointer = &OglSdlSetPalette;
|
||||||
|
|
||||||
GETFUNC(Init);
|
GETFUNC(Init);
|
||||||
GETFUNC(Draw2DLine);
|
GETFUNC(Draw2DLine);
|
||||||
GETFUNC(DrawPolygon);
|
GETFUNC(DrawPolygon);
|
||||||
|
@ -90,7 +91,6 @@ void *hwSym(const char *funcName,void *handle)
|
||||||
GETFUNC(DrawModel);
|
GETFUNC(DrawModel);
|
||||||
GETFUNC(CreateModelVBOs);
|
GETFUNC(CreateModelVBOs);
|
||||||
GETFUNC(SetTransform);
|
GETFUNC(SetTransform);
|
||||||
GETFUNC(GetRenderVersion);
|
|
||||||
GETFUNC(PostImgRedraw);
|
GETFUNC(PostImgRedraw);
|
||||||
GETFUNC(FlushScreenTextures);
|
GETFUNC(FlushScreenTextures);
|
||||||
GETFUNC(StartScreenWipe);
|
GETFUNC(StartScreenWipe);
|
||||||
|
@ -100,6 +100,15 @@ void *hwSym(const char *funcName,void *handle)
|
||||||
GETFUNC(MakeScreenTexture);
|
GETFUNC(MakeScreenTexture);
|
||||||
GETFUNC(MakeScreenFinalTexture);
|
GETFUNC(MakeScreenFinalTexture);
|
||||||
GETFUNC(DrawScreenFinalTexture);
|
GETFUNC(DrawScreenFinalTexture);
|
||||||
|
|
||||||
|
GETFUNC(LoadShaders);
|
||||||
|
GETFUNC(KillShaders);
|
||||||
|
GETFUNC(SetShader);
|
||||||
|
GETFUNC(UnSetShader);
|
||||||
|
|
||||||
|
GETFUNC(LoadCustomShader);
|
||||||
|
GETFUNC(InitCustomShaders);
|
||||||
|
|
||||||
#else //HWRENDER
|
#else //HWRENDER
|
||||||
if (0 == strcmp("FinishUpdate", funcName))
|
if (0 == strcmp("FinishUpdate", funcName))
|
||||||
return funcPointer; //&FinishUpdate;
|
return funcPointer; //&FinishUpdate;
|
||||||
|
|
|
@ -351,11 +351,6 @@ static INT32 Impl_SDL_Scancode_To_Keycode(SDL_Scancode code)
|
||||||
case SDL_SCANCODE_RGUI: return KEY_RIGHTWIN;
|
case SDL_SCANCODE_RGUI: return KEY_RIGHTWIN;
|
||||||
default: break;
|
default: break;
|
||||||
}
|
}
|
||||||
#ifdef HWRENDER
|
|
||||||
DBG_Printf("Unknown incoming scancode: %d, represented %c\n",
|
|
||||||
code,
|
|
||||||
SDL_GetKeyName(SDL_GetKeyFromScancode(code)));
|
|
||||||
#endif
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -635,11 +630,6 @@ static void Impl_HandleWindowEvent(SDL_WindowEvent evt)
|
||||||
if (cv_usemouse.value) I_StartupMouse();
|
if (cv_usemouse.value) I_StartupMouse();
|
||||||
}
|
}
|
||||||
//else firsttimeonmouse = SDL_FALSE;
|
//else firsttimeonmouse = SDL_FALSE;
|
||||||
|
|
||||||
capslock = !!( SDL_GetModState() & KMOD_CAPS );// in case CL changes
|
|
||||||
|
|
||||||
if (USE_MOUSEINPUT)
|
|
||||||
SDLdoGrabMouse();
|
|
||||||
}
|
}
|
||||||
else if (!mousefocus && !kbfocus)
|
else if (!mousefocus && !kbfocus)
|
||||||
{
|
{
|
||||||
|
@ -1296,6 +1286,8 @@ void I_StartupMouse(void)
|
||||||
//
|
//
|
||||||
void I_OsPolling(void)
|
void I_OsPolling(void)
|
||||||
{
|
{
|
||||||
|
SDL_Keymod mod;
|
||||||
|
|
||||||
if (consolevent)
|
if (consolevent)
|
||||||
I_GetConsoleEvents();
|
I_GetConsoleEvents();
|
||||||
if (SDL_WasInit(SDL_INIT_JOYSTICK) == SDL_INIT_JOYSTICK)
|
if (SDL_WasInit(SDL_INIT_JOYSTICK) == SDL_INIT_JOYSTICK)
|
||||||
|
@ -1310,6 +1302,18 @@ void I_OsPolling(void)
|
||||||
I_GetMouseEvents();
|
I_GetMouseEvents();
|
||||||
|
|
||||||
I_GetEvent();
|
I_GetEvent();
|
||||||
|
|
||||||
|
mod = SDL_GetModState();
|
||||||
|
/* Handle here so that our state is always synched with the system. */
|
||||||
|
shiftdown = ctrldown = altdown = 0;
|
||||||
|
capslock = false;
|
||||||
|
if (mod & KMOD_LSHIFT) shiftdown |= 1;
|
||||||
|
if (mod & KMOD_RSHIFT) shiftdown |= 2;
|
||||||
|
if (mod & KMOD_LCTRL) ctrldown |= 1;
|
||||||
|
if (mod & KMOD_RCTRL) ctrldown |= 2;
|
||||||
|
if (mod & KMOD_LALT) altdown |= 1;
|
||||||
|
if (mod & KMOD_RALT) altdown |= 2;
|
||||||
|
if (mod & KMOD_CAPS) capslock = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
|
@ -1828,9 +1832,11 @@ void I_StartupGraphics(void)
|
||||||
framebuffer = SDL_TRUE;
|
framebuffer = SDL_TRUE;
|
||||||
}
|
}
|
||||||
if (M_CheckParm("-software"))
|
if (M_CheckParm("-software"))
|
||||||
{
|
|
||||||
rendermode = render_soft;
|
rendermode = render_soft;
|
||||||
}
|
#ifdef HWRENDER
|
||||||
|
else if (M_CheckParm("-opengl"))
|
||||||
|
rendermode = render_opengl;
|
||||||
|
#endif
|
||||||
|
|
||||||
usesdl2soft = M_CheckParm("-softblit");
|
usesdl2soft = M_CheckParm("-softblit");
|
||||||
borderlesswindow = M_CheckParm("-borderless");
|
borderlesswindow = M_CheckParm("-borderless");
|
||||||
|
@ -1838,9 +1844,8 @@ void I_StartupGraphics(void)
|
||||||
//SDL_EnableKeyRepeat(SDL_DEFAULT_REPEAT_DELAY>>1,SDL_DEFAULT_REPEAT_INTERVAL<<2);
|
//SDL_EnableKeyRepeat(SDL_DEFAULT_REPEAT_DELAY>>1,SDL_DEFAULT_REPEAT_INTERVAL<<2);
|
||||||
VID_Command_ModeList_f();
|
VID_Command_ModeList_f();
|
||||||
#ifdef HWRENDER
|
#ifdef HWRENDER
|
||||||
if (M_CheckParm("-opengl") || rendermode == render_opengl)
|
if (rendermode == render_opengl)
|
||||||
{
|
{
|
||||||
rendermode = render_opengl;
|
|
||||||
HWD.pfnInit = hwSym("Init",NULL);
|
HWD.pfnInit = hwSym("Init",NULL);
|
||||||
HWD.pfnFinishUpdate = NULL;
|
HWD.pfnFinishUpdate = NULL;
|
||||||
HWD.pfnDraw2DLine = hwSym("Draw2DLine",NULL);
|
HWD.pfnDraw2DLine = hwSym("Draw2DLine",NULL);
|
||||||
|
@ -1857,7 +1862,6 @@ void I_StartupGraphics(void)
|
||||||
HWD.pfnDrawModel = hwSym("DrawModel",NULL);
|
HWD.pfnDrawModel = hwSym("DrawModel",NULL);
|
||||||
HWD.pfnCreateModelVBOs = hwSym("CreateModelVBOs",NULL);
|
HWD.pfnCreateModelVBOs = hwSym("CreateModelVBOs",NULL);
|
||||||
HWD.pfnSetTransform = hwSym("SetTransform",NULL);
|
HWD.pfnSetTransform = hwSym("SetTransform",NULL);
|
||||||
HWD.pfnGetRenderVersion = hwSym("GetRenderVersion",NULL);
|
|
||||||
HWD.pfnPostImgRedraw = hwSym("PostImgRedraw",NULL);
|
HWD.pfnPostImgRedraw = hwSym("PostImgRedraw",NULL);
|
||||||
HWD.pfnFlushScreenTextures=hwSym("FlushScreenTextures",NULL);
|
HWD.pfnFlushScreenTextures=hwSym("FlushScreenTextures",NULL);
|
||||||
HWD.pfnStartScreenWipe = hwSym("StartScreenWipe",NULL);
|
HWD.pfnStartScreenWipe = hwSym("StartScreenWipe",NULL);
|
||||||
|
@ -1867,14 +1871,18 @@ void I_StartupGraphics(void)
|
||||||
HWD.pfnMakeScreenTexture= hwSym("MakeScreenTexture",NULL);
|
HWD.pfnMakeScreenTexture= hwSym("MakeScreenTexture",NULL);
|
||||||
HWD.pfnMakeScreenFinalTexture=hwSym("MakeScreenFinalTexture",NULL);
|
HWD.pfnMakeScreenFinalTexture=hwSym("MakeScreenFinalTexture",NULL);
|
||||||
HWD.pfnDrawScreenFinalTexture=hwSym("DrawScreenFinalTexture",NULL);
|
HWD.pfnDrawScreenFinalTexture=hwSym("DrawScreenFinalTexture",NULL);
|
||||||
// check gl renderer lib
|
|
||||||
if (HWD.pfnGetRenderVersion() != VERSION)
|
HWD.pfnLoadShaders = hwSym("LoadShaders",NULL);
|
||||||
I_Error("%s", M_GetText("The version of the renderer doesn't match the version of the executable\nBe sure you have installed SRB2Kart properly.\n"));
|
HWD.pfnKillShaders = hwSym("KillShaders",NULL);
|
||||||
if (!HWD.pfnInit(I_Error)) // let load the OpenGL library
|
HWD.pfnSetShader = hwSym("SetShader",NULL);
|
||||||
{
|
HWD.pfnUnSetShader = hwSym("UnSetShader",NULL);
|
||||||
|
|
||||||
|
HWD.pfnLoadCustomShader = hwSym("LoadCustomShader",NULL);
|
||||||
|
HWD.pfnInitCustomShaders = hwSym("InitCustomShaders",NULL);
|
||||||
|
|
||||||
|
if (!HWD.pfnInit()) // load the OpenGL library
|
||||||
rendermode = render_soft;
|
rendermode = render_soft;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Fury: we do window initialization after GL setup to allow
|
// Fury: we do window initialization after GL setup to allow
|
||||||
|
|
|
@ -1064,13 +1064,6 @@
|
||||||
path = ../../hardware/hw_drv.h;
|
path = ../../hardware/hw_drv.h;
|
||||||
refType = 2;
|
refType = 2;
|
||||||
};
|
};
|
||||||
8417773B085A106C000C01D8 = {
|
|
||||||
fileEncoding = 30;
|
|
||||||
isa = PBXFileReference;
|
|
||||||
name = hw_glide.h;
|
|
||||||
path = ../../hardware/hw_glide.h;
|
|
||||||
refType = 2;
|
|
||||||
};
|
|
||||||
8417773C085A106C000C01D8 = {
|
8417773C085A106C000C01D8 = {
|
||||||
fileEncoding = 30;
|
fileEncoding = 30;
|
||||||
isa = PBXFileReference;
|
isa = PBXFileReference;
|
||||||
|
|
|
@ -181,7 +181,6 @@
|
||||||
1E44AE640B67CC2B00BAD059 /* hw_cache.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = hw_cache.c; path = ../../hardware/hw_cache.c; sourceTree = SOURCE_ROOT; };
|
1E44AE640B67CC2B00BAD059 /* hw_cache.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = hw_cache.c; path = ../../hardware/hw_cache.c; sourceTree = SOURCE_ROOT; };
|
||||||
1E44AE650B67CC2B00BAD059 /* hw_dll.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = hw_dll.h; path = ../../hardware/hw_dll.h; sourceTree = SOURCE_ROOT; };
|
1E44AE650B67CC2B00BAD059 /* hw_dll.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = hw_dll.h; path = ../../hardware/hw_dll.h; sourceTree = SOURCE_ROOT; };
|
||||||
1E44AE660B67CC2B00BAD059 /* hw_drv.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = hw_drv.h; path = ../../hardware/hw_drv.h; sourceTree = SOURCE_ROOT; };
|
1E44AE660B67CC2B00BAD059 /* hw_drv.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = hw_drv.h; path = ../../hardware/hw_drv.h; sourceTree = SOURCE_ROOT; };
|
||||||
1E44AE670B67CC2B00BAD059 /* hw_glide.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = hw_glide.h; path = ../../hardware/hw_glide.h; sourceTree = SOURCE_ROOT; };
|
|
||||||
1E44AE680B67CC2B00BAD059 /* hw_light.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = hw_light.c; path = ../../hardware/hw_light.c; sourceTree = SOURCE_ROOT; };
|
1E44AE680B67CC2B00BAD059 /* hw_light.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = hw_light.c; path = ../../hardware/hw_light.c; sourceTree = SOURCE_ROOT; };
|
||||||
1E44AE690B67CC2B00BAD059 /* hw_light.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = hw_light.h; path = ../../hardware/hw_light.h; sourceTree = SOURCE_ROOT; };
|
1E44AE690B67CC2B00BAD059 /* hw_light.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = hw_light.h; path = ../../hardware/hw_light.h; sourceTree = SOURCE_ROOT; };
|
||||||
1E44AE6A0B67CC2B00BAD059 /* hw3sound.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = hw3sound.h; path = ../../hardware/hw3sound.h; sourceTree = SOURCE_ROOT; };
|
1E44AE6A0B67CC2B00BAD059 /* hw3sound.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = hw3sound.h; path = ../../hardware/hw3sound.h; sourceTree = SOURCE_ROOT; };
|
||||||
|
@ -535,7 +534,6 @@
|
||||||
1E44AE640B67CC2B00BAD059 /* hw_cache.c */,
|
1E44AE640B67CC2B00BAD059 /* hw_cache.c */,
|
||||||
1E44AE650B67CC2B00BAD059 /* hw_dll.h */,
|
1E44AE650B67CC2B00BAD059 /* hw_dll.h */,
|
||||||
1E44AE660B67CC2B00BAD059 /* hw_drv.h */,
|
1E44AE660B67CC2B00BAD059 /* hw_drv.h */,
|
||||||
1E44AE670B67CC2B00BAD059 /* hw_glide.h */,
|
|
||||||
1E44AE680B67CC2B00BAD059 /* hw_light.c */,
|
1E44AE680B67CC2B00BAD059 /* hw_light.c */,
|
||||||
1E44AE690B67CC2B00BAD059 /* hw_light.h */,
|
1E44AE690B67CC2B00BAD059 /* hw_light.h */,
|
||||||
1E44AE6A0B67CC2B00BAD059 /* hw3sound.h */,
|
1E44AE6A0B67CC2B00BAD059 /* hw3sound.h */,
|
||||||
|
@ -1219,7 +1217,7 @@
|
||||||
C01FCF4B08A954540054247B /* Debug */ = {
|
C01FCF4B08A954540054247B /* Debug */ = {
|
||||||
isa = XCBuildConfiguration;
|
isa = XCBuildConfiguration;
|
||||||
buildSettings = {
|
buildSettings = {
|
||||||
CURRENT_PROJECT_VERSION = 2.1.23;
|
CURRENT_PROJECT_VERSION = 2.1.24;
|
||||||
GCC_PREPROCESSOR_DEFINITIONS = (
|
GCC_PREPROCESSOR_DEFINITIONS = (
|
||||||
"$(inherited)",
|
"$(inherited)",
|
||||||
NORMALSRB2,
|
NORMALSRB2,
|
||||||
|
@ -1231,7 +1229,7 @@
|
||||||
C01FCF4C08A954540054247B /* Release */ = {
|
C01FCF4C08A954540054247B /* Release */ = {
|
||||||
isa = XCBuildConfiguration;
|
isa = XCBuildConfiguration;
|
||||||
buildSettings = {
|
buildSettings = {
|
||||||
CURRENT_PROJECT_VERSION = 2.1.23;
|
CURRENT_PROJECT_VERSION = 2.1.24;
|
||||||
GCC_ENABLE_FIX_AND_CONTINUE = NO;
|
GCC_ENABLE_FIX_AND_CONTINUE = NO;
|
||||||
GCC_GENERATE_DEBUGGING_SYMBOLS = NO;
|
GCC_GENERATE_DEBUGGING_SYMBOLS = NO;
|
||||||
GCC_PREPROCESSOR_DEFINITIONS = (
|
GCC_PREPROCESSOR_DEFINITIONS = (
|
||||||
|
|
|
@ -36,6 +36,7 @@
|
||||||
|
|
||||||
#ifdef HWRENDER
|
#ifdef HWRENDER
|
||||||
#include "../hardware/r_opengl/r_opengl.h"
|
#include "../hardware/r_opengl/r_opengl.h"
|
||||||
|
#include "../hardware/hw_main.h"
|
||||||
#include "ogl_sdl.h"
|
#include "ogl_sdl.h"
|
||||||
#include "../i_system.h"
|
#include "../i_system.h"
|
||||||
#include "hwsym_sdl.h"
|
#include "hwsym_sdl.h"
|
||||||
|
@ -89,15 +90,15 @@ boolean LoadGL(void)
|
||||||
const char *OGLLibname = NULL;
|
const char *OGLLibname = NULL;
|
||||||
const char *GLULibname = NULL;
|
const char *GLULibname = NULL;
|
||||||
|
|
||||||
if (M_CheckParm ("-OGLlib") && M_IsNextParm())
|
if (M_CheckParm("-OGLlib") && M_IsNextParm())
|
||||||
OGLLibname = M_GetNextParm();
|
OGLLibname = M_GetNextParm();
|
||||||
|
|
||||||
if (SDL_GL_LoadLibrary(OGLLibname) != 0)
|
if (SDL_GL_LoadLibrary(OGLLibname) != 0)
|
||||||
{
|
{
|
||||||
I_OutputMsg("Could not load OpenGL Library: %s\n"
|
CONS_Alert(CONS_ERROR, "Could not load OpenGL Library: %s\n"
|
||||||
"Falling back to Software mode.\n", SDL_GetError());
|
"Falling back to Software mode.\n", SDL_GetError());
|
||||||
if (!M_CheckParm ("-OGLlib"))
|
if (!M_CheckParm("-OGLlib"))
|
||||||
I_OutputMsg("If you know what is the OpenGL library's name, use -OGLlib\n");
|
CONS_Printf("If you know what is the OpenGL library's name, use -OGLlib\n");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -117,7 +118,7 @@ boolean LoadGL(void)
|
||||||
GLULibname = NULL;
|
GLULibname = NULL;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (M_CheckParm ("-GLUlib") && M_IsNextParm())
|
if (M_CheckParm("-GLUlib") && M_IsNextParm())
|
||||||
GLULibname = M_GetNextParm();
|
GLULibname = M_GetNextParm();
|
||||||
|
|
||||||
if (GLULibname)
|
if (GLULibname)
|
||||||
|
@ -127,15 +128,15 @@ boolean LoadGL(void)
|
||||||
return SetupGLfunc();
|
return SetupGLfunc();
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
I_OutputMsg("Could not load GLU Library: %s\n", GLULibname);
|
CONS_Alert(CONS_ERROR, "Could not load GLU Library: %s\n", GLULibname);
|
||||||
if (!M_CheckParm ("-GLUlib"))
|
if (!M_CheckParm("-GLUlib"))
|
||||||
I_OutputMsg("If you know what is the GLU library's name, use -GLUlib\n");
|
CONS_Printf("If you know what is the GLU library's name, use -GLUlib\n");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
I_OutputMsg("Could not load GLU Library\n");
|
CONS_Alert(CONS_ERROR, "Could not load GLU Library\n");
|
||||||
I_OutputMsg("If you know what is the GLU library's name, use -GLUlib\n");
|
CONS_Printf("If you know what is the GLU library's name, use -GLUlib\n");
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
return SetupGLfunc();
|
return SetupGLfunc();
|
||||||
|
@ -151,31 +152,29 @@ boolean LoadGL(void)
|
||||||
*/
|
*/
|
||||||
boolean OglSdlSurface(INT32 w, INT32 h)
|
boolean OglSdlSurface(INT32 w, INT32 h)
|
||||||
{
|
{
|
||||||
INT32 cbpp;
|
INT32 cbpp = cv_scr_depth.value < 16 ? 16 : cv_scr_depth.value;
|
||||||
const GLvoid *glvendor = NULL, *glrenderer = NULL, *glversion = NULL;
|
static boolean first_init = false;
|
||||||
|
|
||||||
cbpp = cv_scr_depth.value < 16 ? 16 : cv_scr_depth.value;
|
oglflags = 0;
|
||||||
|
|
||||||
glvendor = pglGetString(GL_VENDOR);
|
if (!first_init)
|
||||||
// Get info and extensions.
|
{
|
||||||
//BP: why don't we make it earlier ?
|
gl_version = pglGetString(GL_VERSION);
|
||||||
//Hurdler: we cannot do that before intialising gl context
|
gl_renderer = pglGetString(GL_RENDERER);
|
||||||
glrenderer = pglGetString(GL_RENDERER);
|
|
||||||
glversion = pglGetString(GL_VERSION);
|
|
||||||
gl_extensions = pglGetString(GL_EXTENSIONS);
|
gl_extensions = pglGetString(GL_EXTENSIONS);
|
||||||
|
|
||||||
DBG_Printf("Vendor : %s\n", glvendor);
|
GL_DBG_Printf("OpenGL %s\n", gl_version);
|
||||||
DBG_Printf("Renderer : %s\n", glrenderer);
|
GL_DBG_Printf("GPU: %s\n", gl_renderer);
|
||||||
DBG_Printf("Version : %s\n", glversion);
|
GL_DBG_Printf("Extensions: %s\n", gl_extensions);
|
||||||
DBG_Printf("Extensions : %s\n", gl_extensions);
|
}
|
||||||
oglflags = 0;
|
first_init = true;
|
||||||
|
|
||||||
if (isExtAvailable("GL_EXT_texture_filter_anisotropic", gl_extensions))
|
if (isExtAvailable("GL_EXT_texture_filter_anisotropic", gl_extensions))
|
||||||
pglGetIntegerv(GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT, &maximumAnisotropy);
|
pglGetIntegerv(GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT, &maximumAnisotropy);
|
||||||
else
|
else
|
||||||
maximumAnisotropy = 1;
|
maximumAnisotropy = 1;
|
||||||
|
|
||||||
SetupGLFunc13();
|
SetupGLFunc4();
|
||||||
|
|
||||||
granisotropicmode_cons_t[1].value = maximumAnisotropy;
|
granisotropicmode_cons_t[1].value = maximumAnisotropy;
|
||||||
|
|
||||||
|
@ -221,7 +220,7 @@ void OglSdlFinishUpdate(boolean waitvbl)
|
||||||
HWR_DrawScreenFinalTexture(realwidth, realheight);
|
HWR_DrawScreenFinalTexture(realwidth, realheight);
|
||||||
}
|
}
|
||||||
|
|
||||||
EXPORT void HWRAPI( OglSdlSetPalette) (RGBA_t *palette, RGBA_t *pgamma)
|
EXPORT void HWRAPI(OglSdlSetPalette) (RGBA_t *palette, RGBA_t *pgamma)
|
||||||
{
|
{
|
||||||
INT32 i = -1;
|
INT32 i = -1;
|
||||||
UINT32 redgamma = pgamma->s.red, greengamma = pgamma->s.green,
|
UINT32 redgamma = pgamma->s.red, greengamma = pgamma->s.green,
|
||||||
|
|
|
@ -1375,7 +1375,6 @@
|
||||||
<ClInclude Include="..\hardware\hw_defs.h" />
|
<ClInclude Include="..\hardware\hw_defs.h" />
|
||||||
<ClInclude Include="..\hardware\hw_dll.h" />
|
<ClInclude Include="..\hardware\hw_dll.h" />
|
||||||
<ClInclude Include="..\hardware\hw_drv.h" />
|
<ClInclude Include="..\hardware\hw_drv.h" />
|
||||||
<ClInclude Include="..\hardware\hw_glide.h" />
|
|
||||||
<ClInclude Include="..\hardware\hw_glob.h" />
|
<ClInclude Include="..\hardware\hw_glob.h" />
|
||||||
<ClInclude Include="..\hardware\hw_light.h" />
|
<ClInclude Include="..\hardware\hw_light.h" />
|
||||||
<ClInclude Include="..\hardware\hw_main.h" />
|
<ClInclude Include="..\hardware\hw_main.h" />
|
||||||
|
|
|
@ -2410,10 +2410,6 @@
|
||||||
RelativePath="..\hardware\hw_drv.h"
|
RelativePath="..\hardware\hw_drv.h"
|
||||||
>
|
>
|
||||||
</File>
|
</File>
|
||||||
<File
|
|
||||||
RelativePath="..\hardware\hw_glide.h"
|
|
||||||
>
|
|
||||||
</File>
|
|
||||||
<File
|
<File
|
||||||
RelativePath="..\hardware\hw_glob.h"
|
RelativePath="..\hardware\hw_glob.h"
|
||||||
>
|
>
|
||||||
|
|
|
@ -576,10 +576,6 @@ SOURCE=..\hardware\hw_drv.h
|
||||||
# End Source File
|
# End Source File
|
||||||
# Begin Source File
|
# Begin Source File
|
||||||
|
|
||||||
SOURCE=..\hardware\hw_glide.h
|
|
||||||
# End Source File
|
|
||||||
# Begin Source File
|
|
||||||
|
|
||||||
SOURCE=..\hardware\hw_glob.h
|
SOURCE=..\hardware\hw_glob.h
|
||||||
# End Source File
|
# End Source File
|
||||||
# Begin Source File
|
# Begin Source File
|
||||||
|
|
|
@ -49,14 +49,6 @@
|
||||||
|
|
||||||
#define _CREATE_DLL_ // necessary for Unix AND Windows
|
#define _CREATE_DLL_ // necessary for Unix AND Windows
|
||||||
|
|
||||||
#ifdef HWRENDER
|
|
||||||
#include "../hardware/hw_drv.h"
|
|
||||||
#include "ogl_sdl.h"
|
|
||||||
#ifdef STATIC_OPENGL
|
|
||||||
#include "../hardware/r_opengl/r_opengl.h"
|
|
||||||
#endif
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef HW3SOUND
|
#ifdef HW3SOUND
|
||||||
#include "../hardware/hw3dsdrv.h"
|
#include "../hardware/hw3dsdrv.h"
|
||||||
#endif
|
#endif
|
||||||
|
@ -79,39 +71,8 @@
|
||||||
void *hwSym(const char *funcName,void *handle)
|
void *hwSym(const char *funcName,void *handle)
|
||||||
{
|
{
|
||||||
void *funcPointer = NULL;
|
void *funcPointer = NULL;
|
||||||
#ifdef HWRENDER
|
|
||||||
if (0 == strcmp("SetPalette", funcName))
|
|
||||||
funcPointer = &OglSdlSetPalette;
|
|
||||||
GETFUNC(Init);
|
|
||||||
GETFUNC(Draw2DLine);
|
|
||||||
GETFUNC(DrawPolygon);
|
|
||||||
GETFUNC(SetBlend);
|
|
||||||
GETFUNC(ClearBuffer);
|
|
||||||
GETFUNC(SetTexture);
|
|
||||||
GETFUNC(ReadRect);
|
|
||||||
GETFUNC(GClipRect);
|
|
||||||
GETFUNC(ClearMipMapCache);
|
|
||||||
GETFUNC(SetSpecialState);
|
|
||||||
GETFUNC(GetTextureUsed);
|
|
||||||
GETFUNC(DrawMD2);
|
|
||||||
GETFUNC(DrawMD2i);
|
|
||||||
GETFUNC(SetTransform);
|
|
||||||
GETFUNC(GetRenderVersion);
|
|
||||||
#ifdef SHUFFLE
|
|
||||||
GETFUNC(PostImgRedraw);
|
|
||||||
#endif //SHUFFLE
|
|
||||||
GETFUNC(FlushScreenTextures);
|
|
||||||
GETFUNC(StartScreenWipe);
|
|
||||||
GETFUNC(EndScreenWipe);
|
|
||||||
GETFUNC(DoScreenWipe);
|
|
||||||
GETFUNC(DrawIntermissionBG);
|
|
||||||
GETFUNC(MakeScreenTexture);
|
|
||||||
GETFUNC(MakeScreenFinalTexture);
|
|
||||||
GETFUNC(DrawScreenFinalTexture);
|
|
||||||
#else //HWRENDER
|
|
||||||
if (0 == strcmp("FinishUpdate", funcName))
|
if (0 == strcmp("FinishUpdate", funcName))
|
||||||
return funcPointer; //&FinishUpdate;
|
return funcPointer; //&FinishUpdate;
|
||||||
#endif //!HWRENDER
|
|
||||||
#ifdef STATIC3DS
|
#ifdef STATIC3DS
|
||||||
GETFUNC(Startup);
|
GETFUNC(Startup);
|
||||||
GETFUNC(AddSfx);
|
GETFUNC(AddSfx);
|
||||||
|
|
|
@ -104,13 +104,6 @@
|
||||||
#include "../console.h"
|
#include "../console.h"
|
||||||
#include "../command.h"
|
#include "../command.h"
|
||||||
#include "sdlmain.h"
|
#include "sdlmain.h"
|
||||||
#ifdef HWRENDER
|
|
||||||
#include "../hardware/hw_main.h"
|
|
||||||
#include "../hardware/hw_drv.h"
|
|
||||||
// For dynamic referencing of HW rendering functions
|
|
||||||
#include "hwsym_sdl.h"
|
|
||||||
#include "ogl_sdl.h"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef REMOTE_DEBUGGING
|
#ifdef REMOTE_DEBUGGING
|
||||||
#ifdef _WII
|
#ifdef _WII
|
||||||
|
@ -169,9 +162,7 @@ static SDL_bool disable_mouse = SDL_FALSE;
|
||||||
static INT32 firstEntry = 0;
|
static INT32 firstEntry = 0;
|
||||||
|
|
||||||
// SDL vars
|
// SDL vars
|
||||||
#ifndef HWRENDER //[segabor] !!! I had problem compiling this source with gcc 3.3
|
|
||||||
static SDL_Surface *vidSurface = NULL;
|
static SDL_Surface *vidSurface = NULL;
|
||||||
#endif
|
|
||||||
static SDL_Surface *bufSurface = NULL;
|
static SDL_Surface *bufSurface = NULL;
|
||||||
static SDL_Surface *icoSurface = NULL;
|
static SDL_Surface *icoSurface = NULL;
|
||||||
static SDL_Color localPalette[256];
|
static SDL_Color localPalette[256];
|
||||||
|
@ -664,11 +655,7 @@ static void VID_Command_ModeList_f(void)
|
||||||
{
|
{
|
||||||
#if !defined (DC) && !defined (_WIN32_WCE) && !defined (_PSP) && !defined(GP2X)
|
#if !defined (DC) && !defined (_WIN32_WCE) && !defined (_PSP) && !defined(GP2X)
|
||||||
INT32 i;
|
INT32 i;
|
||||||
#ifdef HWRENDER
|
|
||||||
if (rendermode == render_opengl)
|
|
||||||
modeList = SDL_ListModes(NULL, SDL_OPENGL|SDL_FULLSCREEN);
|
|
||||||
else
|
|
||||||
#endif
|
|
||||||
modeList = SDL_ListModes(NULL, surfaceFlagsF|SDL_HWSURFACE); //Alam: At least hardware surface
|
modeList = SDL_ListModes(NULL, surfaceFlagsF|SDL_HWSURFACE); //Alam: At least hardware surface
|
||||||
|
|
||||||
if (modeList == (SDL_Rect **)0 && cv_fullscreen.value)
|
if (modeList == (SDL_Rect **)0 && cv_fullscreen.value)
|
||||||
|
@ -1277,11 +1264,7 @@ void I_UpdateNoBlit(void)
|
||||||
{
|
{
|
||||||
if (!vidSurface)
|
if (!vidSurface)
|
||||||
return;
|
return;
|
||||||
#ifdef HWRENDER
|
|
||||||
if (rendermode != render_soft)
|
|
||||||
OglSdlFinishUpdate(cv_vidwait.value);
|
|
||||||
else
|
|
||||||
#endif
|
|
||||||
if (vidSurface->flags&SDL_DOUBLEBUF)
|
if (vidSurface->flags&SDL_DOUBLEBUF)
|
||||||
SDL_Flip(vidSurface);
|
SDL_Flip(vidSurface);
|
||||||
else if (exposevideo)
|
else if (exposevideo)
|
||||||
|
@ -1494,12 +1477,6 @@ void I_FinishUpdate(void)
|
||||||
else
|
else
|
||||||
I_OutputMsg("%s\n",SDL_GetError());
|
I_OutputMsg("%s\n",SDL_GetError());
|
||||||
}
|
}
|
||||||
#ifdef HWRENDER
|
|
||||||
else
|
|
||||||
{
|
|
||||||
OglSdlFinishUpdate(cv_vidwait.value);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
exposevideo = SDL_FALSE;
|
exposevideo = SDL_FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1646,11 +1623,6 @@ void VID_PrepareModeList(void)
|
||||||
|
|
||||||
firstEntry = 0;
|
firstEntry = 0;
|
||||||
|
|
||||||
#ifdef HWRENDER
|
|
||||||
if (rendermode == render_opengl)
|
|
||||||
modeList = SDL_ListModes(NULL, SDL_OPENGL|SDL_FULLSCREEN);
|
|
||||||
else
|
|
||||||
#endif
|
|
||||||
modeList = SDL_ListModes(NULL, surfaceFlagsF|SDL_HWSURFACE); //Alam: At least hardware surface
|
modeList = SDL_ListModes(NULL, surfaceFlagsF|SDL_HWSURFACE); //Alam: At least hardware surface
|
||||||
|
|
||||||
if (disable_fullscreen?0:cv_fullscreen.value) // only fullscreen needs preparation
|
if (disable_fullscreen?0:cv_fullscreen.value) // only fullscreen needs preparation
|
||||||
|
@ -1786,23 +1758,6 @@ INT32 VID_SetMode(INT32 modeNum)
|
||||||
I_Error("Could not set vidmode: %s\n",SDL_GetError());
|
I_Error("Could not set vidmode: %s\n",SDL_GetError());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#ifdef HWRENDER
|
|
||||||
else // (render_soft != rendermode)
|
|
||||||
{
|
|
||||||
if (!OglSdlSurface(vid.width, vid.height, true))
|
|
||||||
{
|
|
||||||
cv_fullscreen.value = 0;
|
|
||||||
modeNum = VID_GetModeForSize(vid.width,vid.height);
|
|
||||||
vid.width = windowedModes[modeNum][0];
|
|
||||||
vid.height = windowedModes[modeNum][1];
|
|
||||||
if (!OglSdlSurface(vid.width, vid.height,false))
|
|
||||||
I_Error("Could not set vidmode: %s\n",SDL_GetError());
|
|
||||||
}
|
|
||||||
|
|
||||||
realwidth = (Uint16)vid.width;
|
|
||||||
realheight = (Uint16)vid.height;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
else //(cv_fullscreen.value)
|
else //(cv_fullscreen.value)
|
||||||
{
|
{
|
||||||
|
@ -1815,15 +1770,6 @@ INT32 VID_SetMode(INT32 modeNum)
|
||||||
if (!vidSurface)
|
if (!vidSurface)
|
||||||
I_Error("Could not set vidmode: %s\n",SDL_GetError());
|
I_Error("Could not set vidmode: %s\n",SDL_GetError());
|
||||||
}
|
}
|
||||||
#ifdef HWRENDER
|
|
||||||
else //(render_soft != rendermode)
|
|
||||||
{
|
|
||||||
if (!OglSdlSurface(vid.width, vid.height, false))
|
|
||||||
I_Error("Could not set vidmode: %s\n",SDL_GetError());
|
|
||||||
realwidth = (Uint16)vid.width;
|
|
||||||
realheight = (Uint16)vid.height;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
vid.modenum = VID_GetModeForSize(vidSurface->w,vidSurface->h);
|
vid.modenum = VID_GetModeForSize(vidSurface->w,vidSurface->h);
|
||||||
|
@ -1950,68 +1896,7 @@ void I_StartupGraphics(void)
|
||||||
//DisableAero(); //also disable Aero on Vista
|
//DisableAero(); //also disable Aero on Vista
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef HWRENDER
|
|
||||||
if (M_CheckParm("-opengl") || rendermode == render_opengl)
|
|
||||||
{
|
|
||||||
rendermode = render_opengl;
|
|
||||||
HWD.pfnInit = hwSym("Init",NULL);
|
|
||||||
HWD.pfnFinishUpdate = NULL;
|
|
||||||
HWD.pfnDraw2DLine = hwSym("Draw2DLine",NULL);
|
|
||||||
HWD.pfnDrawPolygon = hwSym("DrawPolygon",NULL);
|
|
||||||
HWD.pfnSetBlend = hwSym("SetBlend",NULL);
|
|
||||||
HWD.pfnClearBuffer = hwSym("ClearBuffer",NULL);
|
|
||||||
HWD.pfnSetTexture = hwSym("SetTexture",NULL);
|
|
||||||
HWD.pfnReadRect = hwSym("ReadRect",NULL);
|
|
||||||
HWD.pfnGClipRect = hwSym("GClipRect",NULL);
|
|
||||||
HWD.pfnClearMipMapCache = hwSym("ClearMipMapCache",NULL);
|
|
||||||
HWD.pfnSetSpecialState = hwSym("SetSpecialState",NULL);
|
|
||||||
HWD.pfnSetPalette = hwSym("SetPalette",NULL);
|
|
||||||
HWD.pfnGetTextureUsed = hwSym("GetTextureUsed",NULL);
|
|
||||||
HWD.pfnDrawMD2 = hwSym("DrawMD2",NULL);
|
|
||||||
HWD.pfnDrawMD2i = hwSym("DrawMD2i",NULL);
|
|
||||||
HWD.pfnSetTransform = hwSym("SetTransform",NULL);
|
|
||||||
HWD.pfnGetRenderVersion = hwSym("GetRenderVersion",NULL);
|
|
||||||
#ifdef SHUFFLE
|
|
||||||
HWD.pfnPostImgRedraw = hwSym("PostImgRedraw",NULL);
|
|
||||||
#endif
|
|
||||||
HWD.pfnFlushScreenTextures=hwSym("FlushScreenTextures",NULL);
|
|
||||||
HWD.pfnStartScreenWipe = hwSym("StartScreenWipe",NULL);
|
|
||||||
HWD.pfnEndScreenWipe = hwSym("EndScreenWipe",NULL);
|
|
||||||
HWD.pfnDoScreenWipe = hwSym("DoScreenWipe",NULL);
|
|
||||||
HWD.pfnDrawIntermissionBG=hwSym("DrawIntermissionBG",NULL);
|
|
||||||
HWD.pfnMakeScreenTexture= hwSym("MakeScreenTexture",NULL);
|
|
||||||
// check gl renderer lib
|
|
||||||
if (HWD.pfnGetRenderVersion() != VERSION)
|
|
||||||
I_Error("%s", M_GetText("The version of the renderer doesn't match the version of the executable\nBe sure you have installed SRB2 properly.\n"));
|
|
||||||
#if 1 //#ifdef _WIN32_WCE
|
|
||||||
vid.width = BASEVIDWIDTH;
|
|
||||||
vid.height = BASEVIDHEIGHT;
|
|
||||||
#else
|
|
||||||
vid.width = 640; // hack to make voodoo cards work in 640x480
|
|
||||||
vid.height = 480;
|
|
||||||
#endif
|
|
||||||
if (HWD.pfnInit(I_Error)) // let load the OpenGL library
|
|
||||||
{
|
|
||||||
/*
|
|
||||||
* We want at least 1 bit R, G, and B,
|
|
||||||
* and at least 16 bpp. Why 1 bit? May be more?
|
|
||||||
*/
|
|
||||||
SDL_GL_SetAttribute(SDL_GL_RED_SIZE, 1);
|
|
||||||
SDL_GL_SetAttribute(SDL_GL_GREEN_SIZE, 1);
|
|
||||||
SDL_GL_SetAttribute(SDL_GL_BLUE_SIZE, 1);
|
|
||||||
SDL_GL_SetAttribute(SDL_GL_DOUBLEBUFFER, 1);
|
|
||||||
if (!OglSdlSurface(vid.width, vid.height, (USE_FULLSCREEN)))
|
|
||||||
if (!OglSdlSurface(vid.width, vid.height, !(USE_FULLSCREEN)))
|
|
||||||
rendermode = render_soft;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
rendermode = render_soft;
|
|
||||||
}
|
|
||||||
#else
|
|
||||||
rendermode = render_soft; //force software mode when there no HWRENDER code
|
rendermode = render_soft; //force software mode when there no HWRENDER code
|
||||||
#endif
|
|
||||||
if (render_soft == rendermode)
|
|
||||||
{
|
|
||||||
#if defined(_WII)
|
#if defined(_WII)
|
||||||
vid.width = 640;
|
vid.width = 640;
|
||||||
vid.height = 480;
|
vid.height = 480;
|
||||||
|
@ -2035,7 +1920,7 @@ void I_StartupGraphics(void)
|
||||||
vid.buffer = malloc(vid.rowbytes*vid.height*NUMSCREENS);
|
vid.buffer = malloc(vid.rowbytes*vid.height*NUMSCREENS);
|
||||||
if (vid.buffer) memset(vid.buffer,0x00,vid.rowbytes*vid.height*NUMSCREENS);
|
if (vid.buffer) memset(vid.buffer,0x00,vid.rowbytes*vid.height*NUMSCREENS);
|
||||||
else CONS_Printf("%s", M_GetText("Not enough memory for video buffer\n"));
|
else CONS_Printf("%s", M_GetText("Not enough memory for video buffer\n"));
|
||||||
}
|
|
||||||
if (M_CheckParm("-nomousegrab"))
|
if (M_CheckParm("-nomousegrab"))
|
||||||
mousegrabok = SDL_FALSE;
|
mousegrabok = SDL_FALSE;
|
||||||
#ifdef _DEBUG
|
#ifdef _DEBUG
|
||||||
|
@ -2091,10 +1976,6 @@ void I_ShutdownGraphics(void)
|
||||||
#endif
|
#endif
|
||||||
graphics_started = false;
|
graphics_started = false;
|
||||||
CONS_Printf("%s", M_GetText("shut down\n"));
|
CONS_Printf("%s", M_GetText("shut down\n"));
|
||||||
#ifdef HWRENDER
|
|
||||||
if (GLUhandle)
|
|
||||||
hwClose(GLUhandle);
|
|
||||||
#endif
|
|
||||||
#ifndef _arch_dreamcast
|
#ifndef _arch_dreamcast
|
||||||
SDL_QuitSubSystem(SDL_INIT_VIDEO);
|
SDL_QuitSubSystem(SDL_INIT_VIDEO);
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -1064,13 +1064,6 @@
|
||||||
path = ../../hardware/hw_drv.h;
|
path = ../../hardware/hw_drv.h;
|
||||||
refType = 2;
|
refType = 2;
|
||||||
};
|
};
|
||||||
8417773B085A106C000C01D8 = {
|
|
||||||
fileEncoding = 30;
|
|
||||||
isa = PBXFileReference;
|
|
||||||
name = hw_glide.h;
|
|
||||||
path = ../../hardware/hw_glide.h;
|
|
||||||
refType = 2;
|
|
||||||
};
|
|
||||||
8417773C085A106C000C01D8 = {
|
8417773C085A106C000C01D8 = {
|
||||||
fileEncoding = 30;
|
fileEncoding = 30;
|
||||||
isa = PBXFileReference;
|
isa = PBXFileReference;
|
||||||
|
|
|
@ -181,7 +181,6 @@
|
||||||
1E44AE640B67CC2B00BAD059 /* hw_cache.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = hw_cache.c; path = ../../hardware/hw_cache.c; sourceTree = SOURCE_ROOT; };
|
1E44AE640B67CC2B00BAD059 /* hw_cache.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = hw_cache.c; path = ../../hardware/hw_cache.c; sourceTree = SOURCE_ROOT; };
|
||||||
1E44AE650B67CC2B00BAD059 /* hw_dll.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = hw_dll.h; path = ../../hardware/hw_dll.h; sourceTree = SOURCE_ROOT; };
|
1E44AE650B67CC2B00BAD059 /* hw_dll.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = hw_dll.h; path = ../../hardware/hw_dll.h; sourceTree = SOURCE_ROOT; };
|
||||||
1E44AE660B67CC2B00BAD059 /* hw_drv.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = hw_drv.h; path = ../../hardware/hw_drv.h; sourceTree = SOURCE_ROOT; };
|
1E44AE660B67CC2B00BAD059 /* hw_drv.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = hw_drv.h; path = ../../hardware/hw_drv.h; sourceTree = SOURCE_ROOT; };
|
||||||
1E44AE670B67CC2B00BAD059 /* hw_glide.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = hw_glide.h; path = ../../hardware/hw_glide.h; sourceTree = SOURCE_ROOT; };
|
|
||||||
1E44AE680B67CC2B00BAD059 /* hw_light.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = hw_light.c; path = ../../hardware/hw_light.c; sourceTree = SOURCE_ROOT; };
|
1E44AE680B67CC2B00BAD059 /* hw_light.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = hw_light.c; path = ../../hardware/hw_light.c; sourceTree = SOURCE_ROOT; };
|
||||||
1E44AE690B67CC2B00BAD059 /* hw_light.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = hw_light.h; path = ../../hardware/hw_light.h; sourceTree = SOURCE_ROOT; };
|
1E44AE690B67CC2B00BAD059 /* hw_light.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = hw_light.h; path = ../../hardware/hw_light.h; sourceTree = SOURCE_ROOT; };
|
||||||
1E44AE6A0B67CC2B00BAD059 /* hw3sound.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = hw3sound.h; path = ../../hardware/hw3sound.h; sourceTree = SOURCE_ROOT; };
|
1E44AE6A0B67CC2B00BAD059 /* hw3sound.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = hw3sound.h; path = ../../hardware/hw3sound.h; sourceTree = SOURCE_ROOT; };
|
||||||
|
@ -535,7 +534,6 @@
|
||||||
1E44AE640B67CC2B00BAD059 /* hw_cache.c */,
|
1E44AE640B67CC2B00BAD059 /* hw_cache.c */,
|
||||||
1E44AE650B67CC2B00BAD059 /* hw_dll.h */,
|
1E44AE650B67CC2B00BAD059 /* hw_dll.h */,
|
||||||
1E44AE660B67CC2B00BAD059 /* hw_drv.h */,
|
1E44AE660B67CC2B00BAD059 /* hw_drv.h */,
|
||||||
1E44AE670B67CC2B00BAD059 /* hw_glide.h */,
|
|
||||||
1E44AE680B67CC2B00BAD059 /* hw_light.c */,
|
1E44AE680B67CC2B00BAD059 /* hw_light.c */,
|
||||||
1E44AE690B67CC2B00BAD059 /* hw_light.h */,
|
1E44AE690B67CC2B00BAD059 /* hw_light.h */,
|
||||||
1E44AE6A0B67CC2B00BAD059 /* hw3sound.h */,
|
1E44AE6A0B67CC2B00BAD059 /* hw3sound.h */,
|
||||||
|
@ -1219,7 +1217,7 @@
|
||||||
C01FCF4B08A954540054247B /* Debug */ = {
|
C01FCF4B08A954540054247B /* Debug */ = {
|
||||||
isa = XCBuildConfiguration;
|
isa = XCBuildConfiguration;
|
||||||
buildSettings = {
|
buildSettings = {
|
||||||
CURRENT_PROJECT_VERSION = 2.1.23;
|
CURRENT_PROJECT_VERSION = 2.1.24;
|
||||||
GCC_PREPROCESSOR_DEFINITIONS = (
|
GCC_PREPROCESSOR_DEFINITIONS = (
|
||||||
"$(inherited)",
|
"$(inherited)",
|
||||||
NORMALSRB2,
|
NORMALSRB2,
|
||||||
|
@ -1231,7 +1229,7 @@
|
||||||
C01FCF4C08A954540054247B /* Release */ = {
|
C01FCF4C08A954540054247B /* Release */ = {
|
||||||
isa = XCBuildConfiguration;
|
isa = XCBuildConfiguration;
|
||||||
buildSettings = {
|
buildSettings = {
|
||||||
CURRENT_PROJECT_VERSION = 2.1.23;
|
CURRENT_PROJECT_VERSION = 2.1.24;
|
||||||
GCC_ENABLE_FIX_AND_CONTINUE = NO;
|
GCC_ENABLE_FIX_AND_CONTINUE = NO;
|
||||||
GCC_GENERATE_DEBUGGING_SYMBOLS = NO;
|
GCC_GENERATE_DEBUGGING_SYMBOLS = NO;
|
||||||
GCC_PREPROCESSOR_DEFINITIONS = (
|
GCC_PREPROCESSOR_DEFINITIONS = (
|
||||||
|
|
|
@ -1,317 +0,0 @@
|
||||||
// Emacs style mode select -*- C++ -*-
|
|
||||||
//-----------------------------------------------------------------------------
|
|
||||||
//
|
|
||||||
// Copyright (C) 1998-2000 by DooM Legacy Team.
|
|
||||||
//
|
|
||||||
// This program is free software; you can redistribute it and/or
|
|
||||||
// modify it under the terms of the GNU General Public License
|
|
||||||
// as published by the Free Software Foundation; either version 2
|
|
||||||
// of the License, or (at your option) any later version.
|
|
||||||
//
|
|
||||||
// This program is distributed in the hope that it will be useful,
|
|
||||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
// GNU General Public License for more details.
|
|
||||||
//
|
|
||||||
//-----------------------------------------------------------------------------
|
|
||||||
/// \file
|
|
||||||
/// \brief SDL specific part of the OpenGL API for SRB2
|
|
||||||
|
|
||||||
#ifdef _MSC_VER
|
|
||||||
#pragma warning(disable : 4214 4244)
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef HAVE_SDL
|
|
||||||
|
|
||||||
#include "SDL.h"
|
|
||||||
|
|
||||||
#ifdef _MSC_VER
|
|
||||||
#pragma warning(default : 4214 4244)
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include "../doomdef.h"
|
|
||||||
|
|
||||||
#ifdef HWRENDER
|
|
||||||
#include "../hardware/r_opengl/r_opengl.h"
|
|
||||||
#include "ogl_sdl.h"
|
|
||||||
#include "../i_system.h"
|
|
||||||
#include "hwsym_sdl.h"
|
|
||||||
#include "../m_argv.h"
|
|
||||||
|
|
||||||
#ifdef DEBUG_TO_FILE
|
|
||||||
#include <stdarg.h>
|
|
||||||
#if defined (_WIN32) && !defined (__CYGWIN__)
|
|
||||||
#include <direct.h>
|
|
||||||
#else
|
|
||||||
#include <unistd.h>
|
|
||||||
#endif
|
|
||||||
#include <sys/types.h>
|
|
||||||
#include <sys/stat.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef USE_WGL_SWAP
|
|
||||||
PFNWGLEXTSWAPCONTROLPROC wglSwapIntervalEXT = NULL;
|
|
||||||
#else
|
|
||||||
typedef int (*PFNGLXSWAPINTERVALPROC) (int);
|
|
||||||
PFNGLXSWAPINTERVALPROC glXSwapIntervalSGIEXT = NULL;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef STATIC_OPENGL
|
|
||||||
PFNglClear pglClear;
|
|
||||||
PFNglGetIntegerv pglGetIntegerv;
|
|
||||||
PFNglGetString pglGetString;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef _PSP
|
|
||||||
static const Uint32 WOGLFlags = SDL_HWSURFACE|SDL_OPENGL/*|SDL_RESIZABLE*/;
|
|
||||||
static const Uint32 FOGLFlags = SDL_HWSURFACE|SDL_OPENGL|SDL_FULLSCREEN;
|
|
||||||
#else
|
|
||||||
static const Uint32 WOGLFlags = SDL_OPENGL/*|SDL_RESIZABLE*/;
|
|
||||||
static const Uint32 FOGLFlags = SDL_OPENGL|SDL_FULLSCREEN;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/** \brief SDL video display surface
|
|
||||||
*/
|
|
||||||
SDL_Surface *vidSurface = NULL;
|
|
||||||
INT32 oglflags = 0;
|
|
||||||
void *GLUhandle = NULL;
|
|
||||||
|
|
||||||
#ifndef STATIC_OPENGL
|
|
||||||
void *GetGLFunc(const char *proc)
|
|
||||||
{
|
|
||||||
if (strncmp(proc, "glu", 3) == 0)
|
|
||||||
{
|
|
||||||
if (GLUhandle)
|
|
||||||
return hwSym(proc, GLUhandle);
|
|
||||||
else
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
return SDL_GL_GetProcAddress(proc);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
boolean LoadGL(void)
|
|
||||||
{
|
|
||||||
#ifndef STATIC_OPENGL
|
|
||||||
const char *OGLLibname = NULL;
|
|
||||||
const char *GLULibname = NULL;
|
|
||||||
|
|
||||||
if (M_CheckParm ("-OGLlib") && M_IsNextParm())
|
|
||||||
OGLLibname = M_GetNextParm();
|
|
||||||
|
|
||||||
if (SDL_GL_LoadLibrary(OGLLibname) != 0)
|
|
||||||
{
|
|
||||||
I_OutputMsg("Could not load OpenGL Library: %s\n"
|
|
||||||
"Falling back to Software mode.\n", SDL_GetError());
|
|
||||||
if (!M_CheckParm ("-OGLlib"))
|
|
||||||
I_OutputMsg("If you know what is the OpenGL library's name, use -OGLlib\n");
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
#if 0
|
|
||||||
GLULibname = "/proc/self/exe";
|
|
||||||
#elif defined (_WIN32)
|
|
||||||
GLULibname = "GLU32.DLL";
|
|
||||||
#elif defined (__MACH__)
|
|
||||||
GLULibname = "/System/Library/Frameworks/OpenGL.framework/Libraries/libGLU.dylib";
|
|
||||||
#elif defined (macintos)
|
|
||||||
GLULibname = "OpenGLLibrary";
|
|
||||||
#elif defined (__unix__)
|
|
||||||
GLULibname = "libGLU.so.1";
|
|
||||||
#elif defined (__HAIKU__)
|
|
||||||
GLULibname = "libGLU.so";
|
|
||||||
#else
|
|
||||||
GLULibname = NULL;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
if (M_CheckParm ("-GLUlib") && M_IsNextParm())
|
|
||||||
GLULibname = M_GetNextParm();
|
|
||||||
|
|
||||||
if (GLULibname)
|
|
||||||
{
|
|
||||||
GLUhandle = hwOpen(GLULibname);
|
|
||||||
if (GLUhandle)
|
|
||||||
return SetupGLfunc();
|
|
||||||
else
|
|
||||||
{
|
|
||||||
I_OutputMsg("Could not load GLU Library: %s\n", GLULibname);
|
|
||||||
if (!M_CheckParm ("-GLUlib"))
|
|
||||||
I_OutputMsg("If you know what is the GLU library's name, use -GLUlib\n");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
I_OutputMsg("Could not load GLU Library\n");
|
|
||||||
I_OutputMsg("If you know what is the GLU library's name, use -GLUlib\n");
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
return SetupGLfunc();
|
|
||||||
}
|
|
||||||
|
|
||||||
/** \brief The OglSdlSurface function
|
|
||||||
|
|
||||||
\param w width
|
|
||||||
\param h height
|
|
||||||
\param isFullscreen if true, go fullscreen
|
|
||||||
|
|
||||||
\return if true, changed video mode
|
|
||||||
*/
|
|
||||||
boolean OglSdlSurface(INT32 w, INT32 h, boolean isFullscreen)
|
|
||||||
{
|
|
||||||
INT32 cbpp;
|
|
||||||
Uint32 OGLFlags;
|
|
||||||
const GLvoid *glvendor = NULL, *glrenderer = NULL, *glversion = NULL;
|
|
||||||
|
|
||||||
cbpp = cv_scr_depth.value < 16 ? 16 : cv_scr_depth.value;
|
|
||||||
|
|
||||||
if (vidSurface)
|
|
||||||
{
|
|
||||||
//Alam: SDL_Video system free vidSurface for me
|
|
||||||
#ifdef VOODOOSAFESWITCHING
|
|
||||||
SDL_QuitSubSystem(SDL_INIT_VIDEO);
|
|
||||||
SDL_InitSubSystem(SDL_INIT_VIDEO);
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
if (isFullscreen)
|
|
||||||
OGLFlags = FOGLFlags;
|
|
||||||
else
|
|
||||||
OGLFlags = WOGLFlags;
|
|
||||||
|
|
||||||
cbpp = SDL_VideoModeOK(w, h, cbpp, OGLFlags);
|
|
||||||
if (cbpp < 16)
|
|
||||||
return true; //Alam: Let just say we did, ok?
|
|
||||||
|
|
||||||
vidSurface = SDL_SetVideoMode(w, h, cbpp, OGLFlags);
|
|
||||||
if (!vidSurface)
|
|
||||||
return false;
|
|
||||||
|
|
||||||
glvendor = pglGetString(GL_VENDOR);
|
|
||||||
// Get info and extensions.
|
|
||||||
//BP: why don't we make it earlier ?
|
|
||||||
//Hurdler: we cannot do that before intialising gl context
|
|
||||||
glrenderer = pglGetString(GL_RENDERER);
|
|
||||||
glversion = pglGetString(GL_VERSION);
|
|
||||||
gl_extensions = pglGetString(GL_EXTENSIONS);
|
|
||||||
|
|
||||||
DBG_Printf("Vendor : %s\n", glvendor);
|
|
||||||
DBG_Printf("Renderer : %s\n", glrenderer);
|
|
||||||
DBG_Printf("Version : %s\n", glversion);
|
|
||||||
DBG_Printf("Extensions : %s\n", gl_extensions);
|
|
||||||
oglflags = 0;
|
|
||||||
|
|
||||||
#ifdef _WIN32
|
|
||||||
// BP: disable advenced feature that don't work on somes hardware
|
|
||||||
// Hurdler: Now works on G400 with bios 1.6 and certified drivers 6.04
|
|
||||||
if (strstr(glrenderer, "810")) oglflags |= GLF_NOZBUFREAD;
|
|
||||||
#elif defined (unix) || defined (UNIXCOMMON)
|
|
||||||
// disable advanced features not working on somes hardware
|
|
||||||
if (strstr(glrenderer, "G200")) oglflags |= GLF_NOTEXENV;
|
|
||||||
if (strstr(glrenderer, "G400")) oglflags |= GLF_NOTEXENV;
|
|
||||||
#endif
|
|
||||||
DBG_Printf("oglflags : 0x%X\n", oglflags );
|
|
||||||
|
|
||||||
#ifdef USE_PALETTED_TEXTURE
|
|
||||||
if (isExtAvailable("GL_EXT_paletted_texture", gl_extensions))
|
|
||||||
glColorTableEXT = SDL_GL_GetProcAddress("glColorTableEXT");
|
|
||||||
else
|
|
||||||
glColorTableEXT = NULL;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef USE_WGL_SWAP
|
|
||||||
if (isExtAvailable("WGL_EXT_swap_control", gl_extensions))
|
|
||||||
wglSwapIntervalEXT = SDL_GL_GetProcAddress("wglSwapIntervalEXT");
|
|
||||||
else
|
|
||||||
wglSwapIntervalEXT = NULL;
|
|
||||||
#else
|
|
||||||
if (isExtAvailable("GLX_SGI_swap_control", gl_extensions))
|
|
||||||
glXSwapIntervalSGIEXT = SDL_GL_GetProcAddress("glXSwapIntervalSGI");
|
|
||||||
else
|
|
||||||
glXSwapIntervalSGIEXT = NULL;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef KOS_GL_COMPATIBILITY
|
|
||||||
if (isExtAvailable("GL_EXT_texture_filter_anisotropic", gl_extensions))
|
|
||||||
pglGetIntegerv(GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT, &maximumAnisotropy);
|
|
||||||
else
|
|
||||||
#endif
|
|
||||||
maximumAnisotropy = 0;
|
|
||||||
|
|
||||||
SetupGLFunc13();
|
|
||||||
|
|
||||||
granisotropicmode_cons_t[1].value = maximumAnisotropy;
|
|
||||||
|
|
||||||
SetModelView(w, h);
|
|
||||||
SetStates();
|
|
||||||
pglClear(GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT);
|
|
||||||
|
|
||||||
HWR_Startup();
|
|
||||||
#ifdef KOS_GL_COMPATIBILITY
|
|
||||||
textureformatGL = GL_ARGB4444;
|
|
||||||
#else
|
|
||||||
textureformatGL = cbpp > 16 ? GL_RGBA : GL_RGB5_A1;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
/** \brief The OglSdlFinishUpdate function
|
|
||||||
|
|
||||||
\param vidwait wait for video sync
|
|
||||||
|
|
||||||
\return void
|
|
||||||
*/
|
|
||||||
void OglSdlFinishUpdate(boolean waitvbl)
|
|
||||||
{
|
|
||||||
static boolean oldwaitvbl = false;
|
|
||||||
if (oldwaitvbl != waitvbl)
|
|
||||||
{
|
|
||||||
#ifdef USE_WGL_SWAP
|
|
||||||
if (wglSwapIntervalEXT)
|
|
||||||
wglSwapIntervalEXT(waitvbl);
|
|
||||||
#else
|
|
||||||
if (glXSwapIntervalSGIEXT)
|
|
||||||
glXSwapIntervalSGIEXT(waitvbl);
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
oldwaitvbl = waitvbl;
|
|
||||||
|
|
||||||
SDL_GL_SwapBuffers();
|
|
||||||
}
|
|
||||||
|
|
||||||
EXPORT void HWRAPI( OglSdlSetPalette) (RGBA_t *palette, RGBA_t *pgamma)
|
|
||||||
{
|
|
||||||
INT32 i = -1;
|
|
||||||
UINT32 redgamma = pgamma->s.red, greengamma = pgamma->s.green,
|
|
||||||
bluegamma = pgamma->s.blue;
|
|
||||||
|
|
||||||
#if 0 // changing the gamma to 127 is a bad idea
|
|
||||||
i = SDL_SetGamma(byteasfloat(redgamma), byteasfloat(greengamma), byteasfloat(bluegamma));
|
|
||||||
#endif
|
|
||||||
if (i == 0) redgamma = greengamma = bluegamma = 0x7F; //Alam: cool
|
|
||||||
for (i = 0; i < 256; i++)
|
|
||||||
{
|
|
||||||
myPaletteData[i].s.red = (UINT8)MIN((palette[i].s.red * redgamma) /127, 255);
|
|
||||||
myPaletteData[i].s.green = (UINT8)MIN((palette[i].s.green * greengamma)/127, 255);
|
|
||||||
myPaletteData[i].s.blue = (UINT8)MIN((palette[i].s.blue * bluegamma) /127, 255);
|
|
||||||
myPaletteData[i].s.alpha = palette[i].s.alpha;
|
|
||||||
}
|
|
||||||
#ifdef USE_PALETTED_TEXTURE
|
|
||||||
if (glColorTableEXT)
|
|
||||||
{
|
|
||||||
for (i = 0; i < 256; i++)
|
|
||||||
{
|
|
||||||
palette_tex[(3*i)+0] = palette[i].s.red;
|
|
||||||
palette_tex[(3*i)+1] = palette[i].s.green;
|
|
||||||
palette_tex[(3*i)+2] = palette[i].s.blue;
|
|
||||||
}
|
|
||||||
glColorTableEXT(GL_TEXTURE_2D, GL_RGB8, 256, GL_RGB, GL_UNSIGNED_BYTE, palette_tex);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
// on a chang<6E>de palette, il faut recharger toutes les textures
|
|
||||||
// jaja, und noch viel mehr ;-)
|
|
||||||
Flush();
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif //HWRENDER
|
|
||||||
#endif //SDL
|
|
|
@ -1,30 +0,0 @@
|
||||||
// Emacs style mode select -*- C++ -*-
|
|
||||||
//-----------------------------------------------------------------------------
|
|
||||||
//
|
|
||||||
// Copyright (C) 1998-2000 by DooM Legacy Team.
|
|
||||||
//
|
|
||||||
// This program is free software; you can redistribute it and/or
|
|
||||||
// modify it under the terms of the GNU General Public License
|
|
||||||
// as published by the Free Software Foundation; either version 2
|
|
||||||
// of the License, or (at your option) any later version.
|
|
||||||
//
|
|
||||||
// This program is distributed in the hope that it will be useful,
|
|
||||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
// GNU General Public License for more details.
|
|
||||||
//-----------------------------------------------------------------------------
|
|
||||||
/// \file
|
|
||||||
/// \brief SDL specific part of the OpenGL API for SRB2
|
|
||||||
|
|
||||||
#include "../v_video.h"
|
|
||||||
|
|
||||||
extern SDL_Surface *vidSurface;
|
|
||||||
extern void *GLUhandle;
|
|
||||||
|
|
||||||
boolean OglSdlSurface(INT32 w, INT32 h, boolean isFullscreen);
|
|
||||||
|
|
||||||
void OglSdlFinishUpdate(boolean vidwait);
|
|
||||||
|
|
||||||
#ifdef _CREATE_DLL_
|
|
||||||
EXPORT void HWRAPI( OglSdlSetPalette ) (RGBA_t *palette, RGBA_t *pgamma);
|
|
||||||
#endif
|
|
|
@ -54,7 +54,7 @@ typedef enum
|
||||||
} skinsound_t;
|
} skinsound_t;
|
||||||
|
|
||||||
// free sfx for S_AddSoundFx()
|
// free sfx for S_AddSoundFx()
|
||||||
#define NUMSFXFREESLOTS 800 // Matches SOC Editor.
|
#define NUMSFXFREESLOTS 1600 // Matches SOC Editor.
|
||||||
#define NUMSKINSFXSLOTS (MAXSKINS*NUMSKINSOUNDS)
|
#define NUMSKINSFXSLOTS (MAXSKINS*NUMSKINSOUNDS)
|
||||||
|
|
||||||
//
|
//
|
||||||
|
|
|
@ -203,7 +203,7 @@ void ST_Ticker(void)
|
||||||
}
|
}
|
||||||
|
|
||||||
// 0 is default, any others are special palettes.
|
// 0 is default, any others are special palettes.
|
||||||
static INT32 st_palette = 0;
|
INT32 st_palette = 0;
|
||||||
|
|
||||||
void ST_doPaletteStuff(void)
|
void ST_doPaletteStuff(void)
|
||||||
{
|
{
|
||||||
|
@ -614,9 +614,7 @@ static void ST_drawDebugInfo(void)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (cv_debug & DBG_MEMORY)
|
if (cv_debug & DBG_MEMORY)
|
||||||
{
|
|
||||||
V_DrawRightAlignedString(320, height, V_MONOSPACE, va("Heap used: %7sKB", sizeu1(Z_TagsUsage(0, INT32_MAX)>>10)));
|
V_DrawRightAlignedString(320, height, V_MONOSPACE, va("Heap used: %7sKB", sizeu1(Z_TagsUsage(0, INT32_MAX)>>10)));
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -2039,8 +2037,6 @@ static void ST_overlayDrawer(void)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ST_drawDebugInfo();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void ST_DrawDemoTitleEntry(void)
|
void ST_DrawDemoTitleEntry(void)
|
||||||
|
@ -2142,4 +2138,5 @@ void ST_Drawer(void)
|
||||||
else
|
else
|
||||||
V_DrawFadeScreen(120, 15-timeinmap); // Then gradually fade out from there
|
V_DrawFadeScreen(120, 15-timeinmap); // Then gradually fade out from there
|
||||||
}
|
}
|
||||||
|
ST_drawDebugInfo();
|
||||||
}
|
}
|
||||||
|
|
|
@ -61,6 +61,7 @@ boolean ST_SameTeam(player_t *a, player_t *b);
|
||||||
//--------------------
|
//--------------------
|
||||||
|
|
||||||
extern boolean st_overlay; // sb overlay on or off when fullscreen
|
extern boolean st_overlay; // sb overlay on or off when fullscreen
|
||||||
|
extern INT32 st_palette; // 0 is default, any others are special palettes.
|
||||||
|
|
||||||
extern lumpnum_t st_borderpatchnum;
|
extern lumpnum_t st_borderpatchnum;
|
||||||
// patches, also used in intermission
|
// patches, also used in intermission
|
||||||
|
|
|
@ -27,7 +27,7 @@
|
||||||
#include "doomstat.h"
|
#include "doomstat.h"
|
||||||
|
|
||||||
#ifdef HWRENDER
|
#ifdef HWRENDER
|
||||||
#include "hardware/hw_glob.h"
|
#include "hardware/hw_main.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Each screen is [vid.width*vid.height];
|
// Each screen is [vid.width*vid.height];
|
||||||
|
@ -58,29 +58,25 @@ static void CV_Gammaxxx_ONChange(void);
|
||||||
// - You can change them in software,
|
// - You can change them in software,
|
||||||
// but they won't do anything.
|
// but they won't do anything.
|
||||||
static CV_PossibleValue_t grgamma_cons_t[] = {{1, "MIN"}, {255, "MAX"}, {0, NULL}};
|
static CV_PossibleValue_t grgamma_cons_t[] = {{1, "MIN"}, {255, "MAX"}, {0, NULL}};
|
||||||
static CV_PossibleValue_t grsoftwarefog_cons_t[] = {{0, "Off"}, {1, "On"}, {2, "LightPlanes"}, {0, NULL}};
|
static CV_PossibleValue_t grfogdensity_cons_t[] = {{FRACUNIT/8, "MIN"}, {FRACUNIT*2, "MAX"}, {0, NULL}};
|
||||||
|
|
||||||
consvar_t cv_grfovchange = {"gr_fovchange", "Off", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL};
|
consvar_t cv_grshaders = {"gr_shaders", "On", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||||
consvar_t cv_grfog = {"gr_fog", "On", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL};
|
consvar_t cv_grfog = {"gr_fog", "On", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||||
consvar_t cv_grfogcolor = {"gr_fogcolor", "AAAAAA", CV_SAVE, NULL, NULL, 0, NULL, NULL, 0, 0, NULL};
|
consvar_t cv_grfogdensity = {"gr_fogdensity", "0.30", CV_SAVE|CV_FLOAT, grfogdensity_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||||
consvar_t cv_grsoftwarefog = {"gr_softwarefog", "Off", CV_SAVE, grsoftwarefog_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
|
consvar_t cv_grfovchange = {"gr_fovchange", "Off", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||||
consvar_t cv_grgammared = {"gr_gammared", "127", CV_SAVE|CV_CALL, grgamma_cons_t,
|
consvar_t cv_grgammared = {"gr_gammared", "127", CV_SAVE|CV_CALL, grgamma_cons_t,
|
||||||
CV_Gammaxxx_ONChange, 0, NULL, NULL, 0, 0, NULL};
|
CV_Gammaxxx_ONChange, 0, NULL, NULL, 0, 0, NULL};
|
||||||
consvar_t cv_grgammagreen = {"gr_gammagreen", "127", CV_SAVE|CV_CALL, grgamma_cons_t,
|
consvar_t cv_grgammagreen = {"gr_gammagreen", "127", CV_SAVE|CV_CALL, grgamma_cons_t,
|
||||||
CV_Gammaxxx_ONChange, 0, NULL, NULL, 0, 0, NULL};
|
CV_Gammaxxx_ONChange, 0, NULL, NULL, 0, 0, NULL};
|
||||||
consvar_t cv_grgammablue = {"gr_gammablue", "127", CV_SAVE|CV_CALL, grgamma_cons_t,
|
consvar_t cv_grgammablue = {"gr_gammablue", "127", CV_SAVE|CV_CALL, grgamma_cons_t,
|
||||||
CV_Gammaxxx_ONChange, 0, NULL, NULL, 0, 0, NULL};
|
CV_Gammaxxx_ONChange, 0, NULL, NULL, 0, 0, NULL};
|
||||||
#ifdef ALAM_LIGHTING
|
|
||||||
consvar_t cv_grdynamiclighting = {"gr_dynamiclighting", "On", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL};
|
|
||||||
consvar_t cv_grstaticlighting = {"gr_staticlighting", "On", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL};
|
|
||||||
consvar_t cv_grcoronas = {"gr_coronas", "On", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL};
|
|
||||||
consvar_t cv_grcoronasize = {"gr_coronasize", "1", CV_SAVE| CV_FLOAT, 0, NULL, 0, NULL, NULL, 0, 0, NULL};
|
|
||||||
#endif
|
|
||||||
|
|
||||||
//static CV_PossibleValue_t CV_MD2[] = {{0, "Off"}, {1, "On"}, {2, "Old"}, {0, NULL}};
|
//static CV_PossibleValue_t CV_MD2[] = {{0, "Off"}, {1, "On"}, {2, "Old"}, {0, NULL}};
|
||||||
// console variables in development
|
// console variables in development
|
||||||
consvar_t cv_grmdls = {"gr_mdls", "On", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL};
|
consvar_t cv_grmdls = {"gr_mdls", "On", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||||
consvar_t cv_grfallbackplayermodel = {"gr_fallbackplayermodel", "Off", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL};
|
consvar_t cv_grfallbackplayermodel = {"gr_fallbackplayermodel", "Off", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||||
|
|
||||||
|
consvar_t cv_grshearing = {"gr_shearing", "Off", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||||
consvar_t cv_grspritebillboarding = {"gr_spritebillboarding", "On", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL};
|
consvar_t cv_grspritebillboarding = {"gr_spritebillboarding", "On", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -350,7 +346,7 @@ void V_DrawFixedPatch(fixed_t x, fixed_t y, fixed_t pscale, INT32 scrn, patch_t
|
||||||
|
|
||||||
#ifdef HWRENDER
|
#ifdef HWRENDER
|
||||||
//if (rendermode != render_soft && !con_startup) // Why?
|
//if (rendermode != render_soft && !con_startup) // Why?
|
||||||
if (rendermode != render_soft)
|
if (rendermode == render_opengl)
|
||||||
{
|
{
|
||||||
HWR_DrawFixedPatch((GLPatch_t *)patch, x, y, pscale, scrn, colormap);
|
HWR_DrawFixedPatch((GLPatch_t *)patch, x, y, pscale, scrn, colormap);
|
||||||
return;
|
return;
|
||||||
|
@ -572,8 +568,7 @@ void V_DrawCroppedPatch(fixed_t x, fixed_t y, fixed_t pscale, INT32 scrn, patch_
|
||||||
return;
|
return;
|
||||||
|
|
||||||
#ifdef HWRENDER
|
#ifdef HWRENDER
|
||||||
// Done
|
if (rendermode == render_opengl)
|
||||||
if (rendermode != render_soft && !con_startup)
|
|
||||||
{
|
{
|
||||||
HWR_DrawCroppedPatch((GLPatch_t*)patch,x,y,pscale,scrn,sx,sy,w,h);
|
HWR_DrawCroppedPatch((GLPatch_t*)patch,x,y,pscale,scrn,sx,sy,w,h);
|
||||||
return;
|
return;
|
||||||
|
@ -719,61 +714,6 @@ void V_DrawBlock(INT32 x, INT32 y, INT32 scrn, INT32 width, INT32 height, const
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void V_BlitScaledPic(INT32 px1, INT32 py1, INT32 scrn, pic_t *pic);
|
|
||||||
// Draw a linear pic, scaled, TOTALLY CRAP CODE!!! OPTIMISE AND ASM!!
|
|
||||||
//
|
|
||||||
void V_DrawScaledPic(INT32 rx1, INT32 ry1, INT32 scrn, INT32 lumpnum)
|
|
||||||
{
|
|
||||||
#ifdef HWRENDER
|
|
||||||
if (rendermode != render_soft)
|
|
||||||
{
|
|
||||||
HWR_DrawPic(rx1, ry1, lumpnum);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
V_BlitScaledPic(rx1, ry1, scrn, W_CacheLumpNum(lumpnum, PU_CACHE));
|
|
||||||
}
|
|
||||||
|
|
||||||
static void V_BlitScaledPic(INT32 rx1, INT32 ry1, INT32 scrn, pic_t * pic)
|
|
||||||
{
|
|
||||||
INT32 dupx, dupy;
|
|
||||||
INT32 x, y;
|
|
||||||
UINT8 *src, *dest;
|
|
||||||
INT32 width, height;
|
|
||||||
|
|
||||||
width = SHORT(pic->width);
|
|
||||||
height = SHORT(pic->height);
|
|
||||||
scrn &= V_PARAMMASK;
|
|
||||||
|
|
||||||
if (pic->mode != 0)
|
|
||||||
{
|
|
||||||
CONS_Debug(DBG_RENDER, "pic mode %d not supported in Software\n", pic->mode);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
dest = screens[scrn] + max(0, ry1 * vid.width) + max(0, rx1);
|
|
||||||
// y cliping to the screen
|
|
||||||
if (ry1 + height * vid.dupy >= vid.width)
|
|
||||||
height = (vid.width - ry1) / vid.dupy - 1;
|
|
||||||
// WARNING no x clipping (not needed for the moment)
|
|
||||||
|
|
||||||
for (y = max(0, -ry1 / vid.dupy); y < height; y++)
|
|
||||||
{
|
|
||||||
for (dupy = vid.dupy; dupy; dupy--)
|
|
||||||
{
|
|
||||||
src = pic->data + y * width;
|
|
||||||
for (x = 0; x < width; x++)
|
|
||||||
{
|
|
||||||
for (dupx = vid.dupx; dupx; dupx--)
|
|
||||||
*dest++ = *src;
|
|
||||||
src++;
|
|
||||||
}
|
|
||||||
dest += vid.width - vid.dupx * width;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// Fills a box of pixels with a single color, NOTE: scaled to screen size
|
// Fills a box of pixels with a single color, NOTE: scaled to screen size
|
||||||
//
|
//
|
||||||
|
@ -786,7 +726,7 @@ void V_DrawFill(INT32 x, INT32 y, INT32 w, INT32 h, INT32 c)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
#ifdef HWRENDER
|
#ifdef HWRENDER
|
||||||
if (rendermode != render_soft && !con_startup)
|
if (rendermode == render_opengl)
|
||||||
{
|
{
|
||||||
HWR_DrawFill(x, y, w, h, c);
|
HWR_DrawFill(x, y, w, h, c);
|
||||||
return;
|
return;
|
||||||
|
@ -906,7 +846,7 @@ void V_DrawFillConsoleMap(INT32 x, INT32 y, INT32 w, INT32 h, INT32 c)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
#ifdef HWRENDER
|
#ifdef HWRENDER
|
||||||
if (rendermode != render_soft && rendermode != render_none)
|
if (rendermode == render_opengl)
|
||||||
{
|
{
|
||||||
UINT32 hwcolor = V_GetHWConsBackColor();
|
UINT32 hwcolor = V_GetHWConsBackColor();
|
||||||
HWR_DrawConsoleFill(x, y, w, h, hwcolor, c); // we still use the regular color stuff but only for flags. actual draw color is "hwcolor" for this.
|
HWR_DrawConsoleFill(x, y, w, h, hwcolor, c); // we still use the regular color stuff but only for flags. actual draw color is "hwcolor" for this.
|
||||||
|
@ -1117,7 +1057,7 @@ void V_DrawFlatFill(INT32 x, INT32 y, INT32 w, INT32 h, lumpnum_t flatnum)
|
||||||
size_t size, lflatsize, flatshift;
|
size_t size, lflatsize, flatshift;
|
||||||
|
|
||||||
#ifdef HWRENDER
|
#ifdef HWRENDER
|
||||||
if (rendermode != render_soft && rendermode != render_none)
|
if (rendermode == render_opengl)
|
||||||
{
|
{
|
||||||
HWR_DrawFlatFill(x, y, w, h, flatnum);
|
HWR_DrawFlatFill(x, y, w, h, flatnum);
|
||||||
return;
|
return;
|
||||||
|
@ -1317,7 +1257,7 @@ void V_DrawFadeConsBack(INT32 plines)
|
||||||
UINT8 *deststop, *buf;
|
UINT8 *deststop, *buf;
|
||||||
|
|
||||||
#ifdef HWRENDER // not win32 only 19990829 by Kin
|
#ifdef HWRENDER // not win32 only 19990829 by Kin
|
||||||
if (rendermode != render_soft && rendermode != render_none)
|
if (rendermode == render_opengl)
|
||||||
{
|
{
|
||||||
UINT32 hwcolor = V_GetHWConsBackColor();
|
UINT32 hwcolor = V_GetHWConsBackColor();
|
||||||
HWR_DrawConsoleBack(hwcolor, plines);
|
HWR_DrawConsoleBack(hwcolor, plines);
|
||||||
|
@ -2423,8 +2363,7 @@ void V_DoPostProcessor(INT32 view, postimg_t type, INT32 param)
|
||||||
INT32 yoffset, xoffset;
|
INT32 yoffset, xoffset;
|
||||||
|
|
||||||
#ifdef HWRENDER
|
#ifdef HWRENDER
|
||||||
// draw a hardware converted patch
|
if (rendermode != render_soft)
|
||||||
if (rendermode != render_soft && rendermode != render_none)
|
|
||||||
return;
|
return;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
@ -142,9 +142,6 @@ void V_DrawContinueIcon(INT32 x, INT32 y, INT32 flags, INT32 skinnum, UINT8 skin
|
||||||
// Draw a linear block of pixels into the view buffer.
|
// Draw a linear block of pixels into the view buffer.
|
||||||
void V_DrawBlock(INT32 x, INT32 y, INT32 scrn, INT32 width, INT32 height, const UINT8 *src);
|
void V_DrawBlock(INT32 x, INT32 y, INT32 scrn, INT32 width, INT32 height, const UINT8 *src);
|
||||||
|
|
||||||
// draw a pic_t, SCALED
|
|
||||||
void V_DrawScaledPic (INT32 px1, INT32 py1, INT32 scrn, INT32 lumpnum);
|
|
||||||
|
|
||||||
// fill a box with a single color
|
// fill a box with a single color
|
||||||
void V_DrawFill(INT32 x, INT32 y, INT32 w, INT32 h, INT32 c);
|
void V_DrawFill(INT32 x, INT32 y, INT32 w, INT32 h, INT32 c);
|
||||||
void V_DrawFillConsoleMap(INT32 x, INT32 y, INT32 w, INT32 h, INT32 c);
|
void V_DrawFillConsoleMap(INT32 x, INT32 y, INT32 w, INT32 h, INT32 c);
|
||||||
|
|
13
src/w_wad.c
13
src/w_wad.c
|
@ -196,6 +196,7 @@ static inline void W_LoadDehackedLumpsPK3(UINT16 wadnum)
|
||||||
LUA_LoadLump(wadnum, posStart);
|
LUA_LoadLump(wadnum, posStart);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
posStart = W_CheckNumForFolderStartPK3("SOC/", wadnum, 0);
|
posStart = W_CheckNumForFolderStartPK3("SOC/", wadnum, 0);
|
||||||
if (posStart != INT16_MAX)
|
if (posStart != INT16_MAX)
|
||||||
{
|
{
|
||||||
|
@ -212,7 +213,6 @@ static inline void W_LoadDehackedLumpsPK3(UINT16 wadnum)
|
||||||
DEH_LoadDehackedLumpPwad(wadnum, posStart);
|
DEH_LoadDehackedLumpPwad(wadnum, posStart);
|
||||||
free(name);
|
free(name);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -764,6 +764,11 @@ UINT16 W_InitFile(const char *filename)
|
||||||
wadfiles[numwadfiles] = wadfile;
|
wadfiles[numwadfiles] = wadfile;
|
||||||
numwadfiles++; // must come BEFORE W_LoadDehackedLumps, so any addfile called by COM_BufInsertText called by Lua doesn't overwrite what we just loaded
|
numwadfiles++; // must come BEFORE W_LoadDehackedLumps, so any addfile called by COM_BufInsertText called by Lua doesn't overwrite what we just loaded
|
||||||
|
|
||||||
|
#ifdef HWRENDER
|
||||||
|
if (rendermode == render_opengl)
|
||||||
|
HWR_LoadShaders(numwadfiles - 1, (wadfile->type == RET_PK3));
|
||||||
|
#endif
|
||||||
|
|
||||||
// TODO: HACK ALERT - Load Lua & SOC stuff right here. I feel like this should be out of this place, but... Let's stick with this for now.
|
// TODO: HACK ALERT - Load Lua & SOC stuff right here. I feel like this should be out of this place, but... Let's stick with this for now.
|
||||||
switch (wadfile->type)
|
switch (wadfile->type)
|
||||||
{
|
{
|
||||||
|
@ -1532,6 +1537,7 @@ void *W_CachePatchName(const char *name, INT32 tag)
|
||||||
return W_CachePatchNum(W_GetNumForName("MISSING"), tag);
|
return W_CachePatchNum(W_GetNumForName("MISSING"), tag);
|
||||||
return W_CachePatchNum(num, tag);
|
return W_CachePatchNum(num, tag);
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifndef NOMD5
|
#ifndef NOMD5
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -1720,11 +1726,14 @@ int W_VerifyNMUSlumps(const char *filename)
|
||||||
{"RRINGS", 6}, // Rings HUD (not named as SBO)
|
{"RRINGS", 6}, // Rings HUD (not named as SBO)
|
||||||
{"YB_", 3}, // Intermission graphics, goes with the above
|
{"YB_", 3}, // Intermission graphics, goes with the above
|
||||||
{"M_", 2}, // As does menu stuff
|
{"M_", 2}, // As does menu stuff
|
||||||
|
|
||||||
{"MKFNT", 5}, // Kart font changes
|
{"MKFNT", 5}, // Kart font changes
|
||||||
{"K_", 2}, // Kart graphic changes
|
{"K_", 2}, // Kart graphic changes
|
||||||
{"MUSICDEF", 8}, // Kart song definitions
|
{"MUSICDEF", 8}, // Kart song definitions
|
||||||
|
|
||||||
|
#ifdef HWRENDER
|
||||||
|
{"SHADERS", 7},
|
||||||
|
{"SH_", 3},
|
||||||
|
#endif
|
||||||
{NULL, 0},
|
{NULL, 0},
|
||||||
};
|
};
|
||||||
return W_VerifyFile(filename, NMUSlist, false);
|
return W_VerifyFile(filename, NMUSlist, false);
|
||||||
|
|
|
@ -1,10 +1,5 @@
|
||||||
file(GLOB SRB2_WIN_SOURCES *.c *.h *.rc)
|
file(GLOB SRB2_WIN_SOURCES *.c *.h *.rc)
|
||||||
|
|
||||||
if(${SRB2_CONFIG_HWRENDER})
|
|
||||||
set(SRB2_WIN_SOURCES ${SRB2_WIN_SOURCES} ${SRB2_HWRENDER_SOURCES} ${SRB2_HWRENDER_HEADERS})
|
|
||||||
set(SRB2_WIN_SOURCES ${SRB2_WIN_SOURCES} ${SRB2_R_OPENGL_SOURCES} ${SRB2_R_OPENGL_HEADERS})
|
|
||||||
endif()
|
|
||||||
|
|
||||||
add_executable(SRB2DD EXCLUDE_FROM_ALL WIN32
|
add_executable(SRB2DD EXCLUDE_FROM_ALL WIN32
|
||||||
${SRB2_WIN_SOURCES}
|
${SRB2_WIN_SOURCES}
|
||||||
)
|
)
|
||||||
|
|
|
@ -91,6 +91,7 @@
|
||||||
<Import Project="..\..\libs\FMOD.props" />
|
<Import Project="..\..\libs\FMOD.props" />
|
||||||
<Import Project="..\..\libs\zlib.props" />
|
<Import Project="..\..\libs\zlib.props" />
|
||||||
<Import Project="..\..\libs\libpng.props" />
|
<Import Project="..\..\libs\libpng.props" />
|
||||||
|
<Import Project="..\..\libs\libgme.props" />
|
||||||
<Import Project="SRB2Win.props" />
|
<Import Project="SRB2Win.props" />
|
||||||
</ImportGroup>
|
</ImportGroup>
|
||||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||||
|
@ -222,19 +223,6 @@
|
||||||
<ClCompile Include="..\f_wipe.c" />
|
<ClCompile Include="..\f_wipe.c" />
|
||||||
<ClCompile Include="..\g_game.c" />
|
<ClCompile Include="..\g_game.c" />
|
||||||
<ClCompile Include="..\g_input.c" />
|
<ClCompile Include="..\g_input.c" />
|
||||||
<ClCompile Include="..\hardware\hw3sound.c" />
|
|
||||||
<ClCompile Include="..\hardware\hw_bsp.c" />
|
|
||||||
<ClCompile Include="..\hardware\hw_cache.c" />
|
|
||||||
<ClCompile Include="..\hardware\hw_clip.c" />
|
|
||||||
<ClCompile Include="..\hardware\hw_draw.c" />
|
|
||||||
<ClCompile Include="..\hardware\hw_light.c" />
|
|
||||||
<ClCompile Include="..\hardware\hw_main.c" />
|
|
||||||
<ClCompile Include="..\hardware\hw_md2.c" />
|
|
||||||
<ClCompile Include="..\hardware\hw_md2load.c" />
|
|
||||||
<ClCompile Include="..\hardware\hw_md3load.c" />
|
|
||||||
<ClCompile Include="..\hardware\hw_model.c" />
|
|
||||||
<ClCompile Include="..\hardware\hw_trick.c" />
|
|
||||||
<ClCompile Include="..\hardware\u_list.c" />
|
|
||||||
<ClCompile Include="..\hu_stuff.c" />
|
<ClCompile Include="..\hu_stuff.c" />
|
||||||
<ClCompile Include="..\info.c" />
|
<ClCompile Include="..\info.c" />
|
||||||
<ClCompile Include="..\i_addrinfo.c">
|
<ClCompile Include="..\i_addrinfo.c">
|
||||||
|
@ -388,20 +376,6 @@
|
||||||
<ClInclude Include="..\hardware\hw3dsdrv.h" />
|
<ClInclude Include="..\hardware\hw3dsdrv.h" />
|
||||||
<ClInclude Include="..\hardware\hw3sound.h" />
|
<ClInclude Include="..\hardware\hw3sound.h" />
|
||||||
<ClInclude Include="..\hardware\hws_data.h" />
|
<ClInclude Include="..\hardware\hws_data.h" />
|
||||||
<ClInclude Include="..\hardware\hw_clip.h" />
|
|
||||||
<ClInclude Include="..\hardware\hw_data.h" />
|
|
||||||
<ClInclude Include="..\hardware\hw_defs.h" />
|
|
||||||
<ClInclude Include="..\hardware\hw_dll.h" />
|
|
||||||
<ClInclude Include="..\hardware\hw_drv.h" />
|
|
||||||
<ClInclude Include="..\hardware\hw_glide.h" />
|
|
||||||
<ClInclude Include="..\hardware\hw_glob.h" />
|
|
||||||
<ClInclude Include="..\hardware\hw_light.h" />
|
|
||||||
<ClInclude Include="..\hardware\hw_main.h" />
|
|
||||||
<ClInclude Include="..\hardware\hw_md2.h" />
|
|
||||||
<ClInclude Include="..\hardware\hw_md2load.h" />
|
|
||||||
<ClInclude Include="..\hardware\hw_md3load.h" />
|
|
||||||
<ClInclude Include="..\hardware\hw_model.h" />
|
|
||||||
<ClInclude Include="..\hardware\u_list.h" />
|
|
||||||
<ClInclude Include="..\hu_stuff.h" />
|
<ClInclude Include="..\hu_stuff.h" />
|
||||||
<ClInclude Include="..\info.h" />
|
<ClInclude Include="..\info.h" />
|
||||||
<ClInclude Include="..\i_addrinfo.h" />
|
<ClInclude Include="..\i_addrinfo.h" />
|
||||||
|
|
|
@ -87,30 +87,6 @@
|
||||||
<ClCompile Include="win_vid.c">
|
<ClCompile Include="win_vid.c">
|
||||||
<Filter>Win32app</Filter>
|
<Filter>Win32app</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<ClCompile Include="..\hardware\hw_bsp.c">
|
|
||||||
<Filter>Hw_Hardware</Filter>
|
|
||||||
</ClCompile>
|
|
||||||
<ClCompile Include="..\hardware\hw_cache.c">
|
|
||||||
<Filter>Hw_Hardware</Filter>
|
|
||||||
</ClCompile>
|
|
||||||
<ClCompile Include="..\hardware\hw_clip.c">
|
|
||||||
<Filter>Hw_Hardware</Filter>
|
|
||||||
</ClCompile>
|
|
||||||
<ClCompile Include="..\hardware\hw_draw.c">
|
|
||||||
<Filter>Hw_Hardware</Filter>
|
|
||||||
</ClCompile>
|
|
||||||
<ClCompile Include="..\hardware\hw_light.c">
|
|
||||||
<Filter>Hw_Hardware</Filter>
|
|
||||||
</ClCompile>
|
|
||||||
<ClCompile Include="..\hardware\hw_main.c">
|
|
||||||
<Filter>Hw_Hardware</Filter>
|
|
||||||
</ClCompile>
|
|
||||||
<ClCompile Include="..\hardware\hw_md2.c">
|
|
||||||
<Filter>Hw_Hardware</Filter>
|
|
||||||
</ClCompile>
|
|
||||||
<ClCompile Include="..\hardware\hw_trick.c">
|
|
||||||
<Filter>Hw_Hardware</Filter>
|
|
||||||
</ClCompile>
|
|
||||||
<ClCompile Include="..\hardware\hw3sound.c">
|
<ClCompile Include="..\hardware\hw3sound.c">
|
||||||
<Filter>Hw_Hardware</Filter>
|
<Filter>Hw_Hardware</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
|
@ -480,45 +456,6 @@
|
||||||
<ClInclude Include="win_main.h">
|
<ClInclude Include="win_main.h">
|
||||||
<Filter>Win32app</Filter>
|
<Filter>Win32app</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
<ClInclude Include="..\hardware\hw_clip.h">
|
|
||||||
<Filter>Hw_Hardware</Filter>
|
|
||||||
</ClInclude>
|
|
||||||
<ClInclude Include="..\hardware\hw_data.h">
|
|
||||||
<Filter>Hw_Hardware</Filter>
|
|
||||||
</ClInclude>
|
|
||||||
<ClInclude Include="..\hardware\hw_defs.h">
|
|
||||||
<Filter>Hw_Hardware</Filter>
|
|
||||||
</ClInclude>
|
|
||||||
<ClInclude Include="..\hardware\hw_dll.h">
|
|
||||||
<Filter>Hw_Hardware</Filter>
|
|
||||||
</ClInclude>
|
|
||||||
<ClInclude Include="..\hardware\hw_drv.h">
|
|
||||||
<Filter>Hw_Hardware</Filter>
|
|
||||||
</ClInclude>
|
|
||||||
<ClInclude Include="..\hardware\hw_glide.h">
|
|
||||||
<Filter>Hw_Hardware</Filter>
|
|
||||||
</ClInclude>
|
|
||||||
<ClInclude Include="..\hardware\hw_glob.h">
|
|
||||||
<Filter>Hw_Hardware</Filter>
|
|
||||||
</ClInclude>
|
|
||||||
<ClInclude Include="..\hardware\hw_light.h">
|
|
||||||
<Filter>Hw_Hardware</Filter>
|
|
||||||
</ClInclude>
|
|
||||||
<ClInclude Include="..\hardware\hw_main.h">
|
|
||||||
<Filter>Hw_Hardware</Filter>
|
|
||||||
</ClInclude>
|
|
||||||
<ClInclude Include="..\hardware\hw_md2.h">
|
|
||||||
<Filter>Hw_Hardware</Filter>
|
|
||||||
</ClInclude>
|
|
||||||
<ClInclude Include="..\hardware\hw_md2load.h">
|
|
||||||
<Filter>Hw_Hardware</Filter>
|
|
||||||
</ClInclude>
|
|
||||||
<ClInclude Include="..\hardware\hw_md3load.h">
|
|
||||||
<Filter>Hw_Hardware</Filter>
|
|
||||||
</ClInclude>
|
|
||||||
<ClInclude Include="..\hardware\hw_model.h">
|
|
||||||
<Filter>Hw_Hardware</Filter>
|
|
||||||
</ClInclude>
|
|
||||||
<ClInclude Include="..\hardware\hw3dsdrv.h">
|
<ClInclude Include="..\hardware\hw3dsdrv.h">
|
||||||
<Filter>Hw_Hardware</Filter>
|
<Filter>Hw_Hardware</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
|
|
|
@ -2151,10 +2151,6 @@
|
||||||
RelativePath="..\hardware\hw_drv.h"
|
RelativePath="..\hardware\hw_drv.h"
|
||||||
>
|
>
|
||||||
</File>
|
</File>
|
||||||
<File
|
|
||||||
RelativePath="..\hardware\hw_glide.h"
|
|
||||||
>
|
|
||||||
</File>
|
|
||||||
<File
|
<File
|
||||||
RelativePath="..\hardware\hw_glob.h"
|
RelativePath="..\hardware\hw_glob.h"
|
||||||
>
|
>
|
||||||
|
|
|
@ -535,10 +535,6 @@ SOURCE=..\hardware\hw_drv.h
|
||||||
# End Source File
|
# End Source File
|
||||||
# Begin Source File
|
# Begin Source File
|
||||||
|
|
||||||
SOURCE=..\hardware\hw_glide.h
|
|
||||||
# End Source File
|
|
||||||
# Begin Source File
|
|
||||||
|
|
||||||
SOURCE=..\hardware\hw_glob.h
|
SOURCE=..\hardware\hw_glob.h
|
||||||
# End Source File
|
# End Source File
|
||||||
# Begin Source File
|
# Begin Source File
|
||||||
|
|
|
@ -5,7 +5,10 @@
|
||||||
<PropertyGroup />
|
<PropertyGroup />
|
||||||
<ItemDefinitionGroup>
|
<ItemDefinitionGroup>
|
||||||
<ClCompile>
|
<ClCompile>
|
||||||
<PreprocessorDefinitions>_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
<!-- x86/x64 defines: has specific libraries that ARM does not -->
|
||||||
|
<PreprocessorDefinitions Condition="'$(Platform)' == 'Win32' OR '$(Platform)' == 'x64'">HAVE_ZLIB;HAVE_LIBGME;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||||
|
<!-- ARM defines -->
|
||||||
|
<PreprocessorDefinitions Condition="'$(Platform)' != 'Win32' AND '$(Platform)' != 'x64'">_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<Link />
|
<Link />
|
||||||
<Link>
|
<Link>
|
||||||
|
|
|
@ -17,9 +17,6 @@
|
||||||
/// \brief load and initialise the 3D driver DLL
|
/// \brief load and initialise the 3D driver DLL
|
||||||
|
|
||||||
#include "../doomdef.h"
|
#include "../doomdef.h"
|
||||||
#ifdef HWRENDER
|
|
||||||
#include "../hardware/hw_drv.h" // get the standard 3D Driver DLL exports prototypes
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef HW3SOUND
|
#ifdef HW3SOUND
|
||||||
#include "../hardware/hw3dsdrv.h" // get the 3D sound driver DLL export prototypes
|
#include "../hardware/hw3dsdrv.h" // get the 3D sound driver DLL export prototypes
|
||||||
|
@ -30,7 +27,7 @@
|
||||||
#include "win_dll.h"
|
#include "win_dll.h"
|
||||||
#include "win_main.h" // I_ShowLastError()
|
#include "win_main.h" // I_ShowLastError()
|
||||||
|
|
||||||
#if defined(HWRENDER) || defined(HW3SOUND)
|
#if defined(HW3SOUND)
|
||||||
typedef struct loadfunc_s {
|
typedef struct loadfunc_s {
|
||||||
LPCSTR fnName;
|
LPCSTR fnName;
|
||||||
LPVOID fnPointer;
|
LPVOID fnPointer;
|
||||||
|
@ -84,92 +81,6 @@ static VOID UnloadDLL (HMODULE* pModule)
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// ==========================================================================
|
|
||||||
// STANDARD 3D DRIVER DLL FOR DOOM LEGACY
|
|
||||||
// ==========================================================================
|
|
||||||
|
|
||||||
// note : the 3D driver loading should be put somewhere else..
|
|
||||||
|
|
||||||
#ifdef HWRENDER
|
|
||||||
static HMODULE hwdModule = NULL;
|
|
||||||
|
|
||||||
static loadfunc_t hwdFuncTable[] = {
|
|
||||||
#ifdef _X86_
|
|
||||||
{"Init@4", &hwdriver.pfnInit},
|
|
||||||
{"Shutdown@0", &hwdriver.pfnShutdown},
|
|
||||||
{"GetModeList@8", &hwdriver.pfnGetModeList},
|
|
||||||
{"SetPalette@8", &hwdriver.pfnSetPalette},
|
|
||||||
{"FinishUpdate@4", &hwdriver.pfnFinishUpdate},
|
|
||||||
{"Draw2DLine@12", &hwdriver.pfnDraw2DLine},
|
|
||||||
{"DrawPolygon@16", &hwdriver.pfnDrawPolygon},
|
|
||||||
{"SetBlend@4", &hwdriver.pfnSetBlend},
|
|
||||||
{"ClearBuffer@12", &hwdriver.pfnClearBuffer},
|
|
||||||
{"SetTexture@4", &hwdriver.pfnSetTexture},
|
|
||||||
{"ReadRect@24", &hwdriver.pfnReadRect},
|
|
||||||
{"GClipRect@20", &hwdriver.pfnGClipRect},
|
|
||||||
{"ClearMipMapCache@0", &hwdriver.pfnClearMipMapCache},
|
|
||||||
{"SetSpecialState@8", &hwdriver.pfnSetSpecialState},
|
|
||||||
{"DrawModel@16", &hwdriver.pfnDrawModel},
|
|
||||||
{"SetTransform@4", &hwdriver.pfnSetTransform},
|
|
||||||
{"GetTextureUsed@0", &hwdriver.pfnGetTextureUsed},
|
|
||||||
{"GetRenderVersion@0", &hwdriver.pfnGetRenderVersion},
|
|
||||||
#ifdef SHUFFLE
|
|
||||||
{"PostImgRedraw@4", &hwdriver.pfnPostImgRedraw},
|
|
||||||
#endif
|
|
||||||
{"FlushScreenTextures@0",&hwdriver.pfnFlushScreenTextures},
|
|
||||||
{"StartScreenWipe@0", &hwdriver.pfnStartScreenWipe},
|
|
||||||
{"EndScreenWipe@0", &hwdriver.pfnEndScreenWipe},
|
|
||||||
{"DoScreenWipe@4", &hwdriver.pfnDoScreenWipe},
|
|
||||||
{"DrawIntermissionBG@0",&hwdriver.pfnDrawIntermissionBG},
|
|
||||||
{"MakeScreenTexture@0", &hwdriver.pfnMakeScreenTexture},
|
|
||||||
{"MakeScreenFinalTexture@0", &hwdriver.pfnMakeScreenFinalTexture},
|
|
||||||
{"DrawScreenFinalTexture@8", &hwdriver.pfnDrawScreenFinalTexture},
|
|
||||||
#else
|
|
||||||
{"Init", &hwdriver.pfnInit},
|
|
||||||
{"Shutdown", &hwdriver.pfnShutdown},
|
|
||||||
{"GetModeList", &hwdriver.pfnGetModeList},
|
|
||||||
{"SetPalette", &hwdriver.pfnSetPalette},
|
|
||||||
{"FinishUpdate", &hwdriver.pfnFinishUpdate},
|
|
||||||
{"Draw2DLine", &hwdriver.pfnDraw2DLine},
|
|
||||||
{"DrawPolygon", &hwdriver.pfnDrawPolygon},
|
|
||||||
{"SetBlend", &hwdriver.pfnSetBlend},
|
|
||||||
{"ClearBuffer", &hwdriver.pfnClearBuffer},
|
|
||||||
{"SetTexture", &hwdriver.pfnSetTexture},
|
|
||||||
{"ReadRect", &hwdriver.pfnReadRect},
|
|
||||||
{"GClipRect", &hwdriver.pfnGClipRect},
|
|
||||||
{"ClearMipMapCache", &hwdriver.pfnClearMipMapCache},
|
|
||||||
{"SetSpecialState", &hwdriver.pfnSetSpecialState},
|
|
||||||
{"DrawModel", &hwdriver.pfnDrawModel},
|
|
||||||
{"SetTransform", &hwdriver.pfnSetTransform},
|
|
||||||
{"GetTextureUsed", &hwdriver.pfnGetTextureUsed},
|
|
||||||
{"GetRenderVersion", &hwdriver.pfnGetRenderVersion},
|
|
||||||
#ifdef SHUFFLE
|
|
||||||
{"PostImgRedraw", &hwdriver.pfnPostImgRedraw},
|
|
||||||
#endif
|
|
||||||
{"FlushScreenTextures", &hwdriver.pfnFlushScreenTextures},
|
|
||||||
{"StartScreenWipe", &hwdriver.pfnStartScreenWipe},
|
|
||||||
{"EndScreenWipe", &hwdriver.pfnEndScreenWipe},
|
|
||||||
{"DoScreenWipe", &hwdriver.pfnDoScreenWipe},
|
|
||||||
{"DrawIntermissionBG", &hwdriver.pfnDrawIntermissionBG},
|
|
||||||
{"MakeScreenTexture", &hwdriver.pfnMakeScreenTexture},
|
|
||||||
{"MakeScreenFinalTexture", &hwdriver.pfnMakeScreenFinalTexture},
|
|
||||||
{"DrawScreenFinalTexture", &hwdriver.pfnDrawScreenFinalTexture},
|
|
||||||
#endif
|
|
||||||
{NULL,NULL}
|
|
||||||
};
|
|
||||||
|
|
||||||
BOOL Init3DDriver (LPCSTR dllName)
|
|
||||||
{
|
|
||||||
hwdModule = LoadDLL(dllName, hwdFuncTable);
|
|
||||||
return (hwdModule != NULL);
|
|
||||||
}
|
|
||||||
|
|
||||||
VOID Shutdown3DDriver (VOID)
|
|
||||||
{
|
|
||||||
UnloadDLL(&hwdModule);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef HW3SOUND
|
#ifdef HW3SOUND
|
||||||
static HMODULE hwsModule = NULL;
|
static HMODULE hwsModule = NULL;
|
||||||
|
|
||||||
|
|
|
@ -20,11 +20,6 @@
|
||||||
#define RPC_NO_WINDOWS_H
|
#define RPC_NO_WINDOWS_H
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
|
|
||||||
#ifdef HWRENDER
|
|
||||||
BOOL Init3DDriver (LPCSTR dllName);
|
|
||||||
VOID Shutdown3DDriver (VOID);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef HW3SOUND
|
#ifdef HW3SOUND
|
||||||
BOOL Init3DSDriver(LPCSTR dllName);
|
BOOL Init3DSDriver(LPCSTR dllName);
|
||||||
VOID Shutdown3DSDriver(VOID);
|
VOID Shutdown3DSDriver(VOID);
|
||||||
|
|
|
@ -36,12 +36,6 @@
|
||||||
#include "../command.h"
|
#include "../command.h"
|
||||||
#include "../screen.h"
|
#include "../screen.h"
|
||||||
|
|
||||||
#ifdef HWRENDER
|
|
||||||
#include "win_dll.h" // loading the render DLL
|
|
||||||
#include "../hardware/hw_drv.h" // calling driver init & shutdown
|
|
||||||
#include "../hardware/hw_main.h" // calling HWR module init & shutdown
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// -------
|
// -------
|
||||||
// Globals
|
// Globals
|
||||||
// -------
|
// -------
|
||||||
|
@ -222,11 +216,6 @@ void I_StartupGraphics(void)
|
||||||
if (graphics_started)
|
if (graphics_started)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
#ifdef HWRENDER
|
|
||||||
else if (M_CheckParm("-opengl"))
|
|
||||||
rendermode = render_opengl;
|
|
||||||
else
|
|
||||||
#endif
|
|
||||||
rendermode = render_soft;
|
rendermode = render_soft;
|
||||||
|
|
||||||
if (dedicated)
|
if (dedicated)
|
||||||
|
@ -245,10 +234,6 @@ void I_StartupGraphics(void)
|
||||||
// ------------------
|
// ------------------
|
||||||
void I_ShutdownGraphics(void)
|
void I_ShutdownGraphics(void)
|
||||||
{
|
{
|
||||||
#ifdef HWRENDER
|
|
||||||
const rendermode_t oldrendermode = rendermode;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// This is BAD because it makes the I_Error box screw up!
|
// This is BAD because it makes the I_Error box screw up!
|
||||||
// rendermode = render_none;
|
// rendermode = render_none;
|
||||||
|
|
||||||
|
@ -273,15 +258,6 @@ void I_ShutdownGraphics(void)
|
||||||
bmiMain = NULL;
|
bmiMain = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef HWRENDER
|
|
||||||
if (oldrendermode != render_soft)
|
|
||||||
{
|
|
||||||
HWR_Shutdown(); // free stuff from the hardware renderer
|
|
||||||
HWD.pfnShutdown(); // close 3d card display
|
|
||||||
Shutdown3DDriver(); // free the driver DLL
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// free the last video mode screen buffers
|
// free the last video mode screen buffers
|
||||||
if (vid.buffer)
|
if (vid.buffer)
|
||||||
{
|
{
|
||||||
|
@ -289,9 +265,6 @@ void I_ShutdownGraphics(void)
|
||||||
vid.buffer = NULL;
|
vid.buffer = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef HWRENDER
|
|
||||||
if (rendermode == render_soft)
|
|
||||||
#endif
|
|
||||||
CloseDirectDraw();
|
CloseDirectDraw();
|
||||||
|
|
||||||
graphics_started = false;
|
graphics_started = false;
|
||||||
|
@ -380,11 +353,6 @@ void I_FinishUpdate(void)
|
||||||
DIB_RGB_COLORS);
|
DIB_RGB_COLORS);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
#ifdef HWRENDER
|
|
||||||
if (rendermode != render_soft)
|
|
||||||
HWD.pfnFinishUpdate(cv_vidwait.value);
|
|
||||||
else
|
|
||||||
#endif
|
|
||||||
{
|
{
|
||||||
// DIRECT DRAW
|
// DIRECT DRAW
|
||||||
// copy virtual screen to real screen
|
// copy virtual screen to real screen
|
||||||
|
@ -486,9 +454,6 @@ void I_SetPalette(RGBA_t *palette)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
#ifdef HWRENDER
|
|
||||||
if (rendermode == render_soft)
|
|
||||||
#endif
|
|
||||||
{
|
{
|
||||||
PALETTEENTRY mainpal[256];
|
PALETTEENTRY mainpal[256];
|
||||||
|
|
||||||
|
@ -680,48 +645,6 @@ static VOID VID_Init(VOID)
|
||||||
bDIBMode = TRUE;
|
bDIBMode = TRUE;
|
||||||
bAppFullScreen = FALSE;
|
bAppFullScreen = FALSE;
|
||||||
|
|
||||||
#ifdef HWRENDER
|
|
||||||
// initialize the appropriate display device
|
|
||||||
if (rendermode != render_soft)
|
|
||||||
{
|
|
||||||
const char *drvname = NULL;
|
|
||||||
|
|
||||||
switch (rendermode)
|
|
||||||
{
|
|
||||||
case render_opengl:
|
|
||||||
drvname = "r_opengl.dll";
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
I_Error("Unknown hardware render mode");
|
|
||||||
}
|
|
||||||
|
|
||||||
// load the DLL
|
|
||||||
if (drvname && Init3DDriver(drvname))
|
|
||||||
{
|
|
||||||
int hwdversion = HWD.pfnGetRenderVersion();
|
|
||||||
if (hwdversion != VERSION)
|
|
||||||
CONS_Alert(CONS_WARNING, M_GetText("This r_opengl version is not supported, use it at your own risk!\n"));
|
|
||||||
|
|
||||||
// perform initialisations
|
|
||||||
HWD.pfnInit(I_Error);
|
|
||||||
// get available display modes for the device
|
|
||||||
HWD.pfnGetModeList(&pvidmodes, &numvidmodes);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
switch (rendermode)
|
|
||||||
{
|
|
||||||
case render_opengl:
|
|
||||||
I_Error("Error initializing OpenGL");
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
rendermode = render_soft;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (rendermode == render_soft)
|
|
||||||
#endif
|
|
||||||
if (!bWinParm)
|
if (!bWinParm)
|
||||||
{
|
{
|
||||||
if (!CreateDirectDrawInstance())
|
if (!CreateDirectDrawInstance())
|
||||||
|
@ -927,14 +850,6 @@ INT32 VID_SetMode(INT32 modenum)
|
||||||
// we switch to fullscreen
|
// we switch to fullscreen
|
||||||
bAppFullScreen = TRUE;
|
bAppFullScreen = TRUE;
|
||||||
bDIBMode = FALSE;
|
bDIBMode = FALSE;
|
||||||
#ifdef HWRENDER
|
|
||||||
if (rendermode != render_soft)
|
|
||||||
{
|
|
||||||
// purge all patch graphics stored in software format
|
|
||||||
//Z_FreeTags (PU_PURGELEVEL, PU_PURGELEVEL+100);
|
|
||||||
HWR_Startup();
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
I_RestartSysMouse();
|
I_RestartSysMouse();
|
||||||
|
|
|
@ -17,9 +17,6 @@
|
||||||
/// \brief load and initialise the 3D driver DLL
|
/// \brief load and initialise the 3D driver DLL
|
||||||
|
|
||||||
#include "../doomdef.h"
|
#include "../doomdef.h"
|
||||||
#ifdef HWRENDER
|
|
||||||
#include "../hardware/hw_drv.h" // get the standard 3D Driver DLL exports prototypes
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef HW3SOUND
|
#ifdef HW3SOUND
|
||||||
#include "../hardware/hw3dsdrv.h" // get the 3D sound driver DLL export prototypes
|
#include "../hardware/hw3dsdrv.h" // get the 3D sound driver DLL export prototypes
|
||||||
|
@ -28,7 +25,7 @@
|
||||||
#include "win_dll.h"
|
#include "win_dll.h"
|
||||||
#include "win_main.h" // I_GetLastErrorMsgBox()
|
#include "win_main.h" // I_GetLastErrorMsgBox()
|
||||||
|
|
||||||
#if defined(HWRENDER) || defined(HW3SOUND)
|
#if defined(HW3SOUND)
|
||||||
typedef struct loadfunc_s {
|
typedef struct loadfunc_s {
|
||||||
LPCSTR fnName;
|
LPCSTR fnName;
|
||||||
LPVOID fnPointer;
|
LPVOID fnPointer;
|
||||||
|
@ -82,49 +79,6 @@ static inline VOID UnloadDLL (HMODULE* pModule)
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// ==========================================================================
|
|
||||||
// STANDARD 3D DRIVER DLL FOR DOOM LEGACY
|
|
||||||
// ==========================================================================
|
|
||||||
|
|
||||||
// note : the 3D driver loading should be put somewhere else..
|
|
||||||
|
|
||||||
#ifdef HWRENDER
|
|
||||||
static HMODULE hwdModule = NULL;
|
|
||||||
|
|
||||||
static loadfunc_t hwdFuncTable[] = {
|
|
||||||
{"_Init@4", &hwdriver.pfnInit},
|
|
||||||
{"_Shutdown@0", &hwdriver.pfnShutdown},
|
|
||||||
{"_GetModeList@8", &hwdriver.pfnGetModeList},
|
|
||||||
{"_SetPalette@8", &hwdriver.pfnSetPalette},
|
|
||||||
{"_FinishUpdate@4", &hwdriver.pfnFinishUpdate},
|
|
||||||
{"_Draw2DLine@12", &hwdriver.pfnDraw2DLine},
|
|
||||||
{"_DrawPolygon@16", &hwdriver.pfnDrawPolygon},
|
|
||||||
{"_SetBlend@4", &hwdriver.pfnSetBlend},
|
|
||||||
{"_ClearBuffer@12", &hwdriver.pfnClearBuffer},
|
|
||||||
{"_SetTexture@4", &hwdriver.pfnSetTexture},
|
|
||||||
{"_ReadRect@24", &hwdriver.pfnReadRect},
|
|
||||||
{"_GClipRect@20", &hwdriver.pfnGClipRect},
|
|
||||||
{"_ClearMipMapCache@0",&hwdriver.pfnClearMipMapCache},
|
|
||||||
{"_SetSpecialState@8", &hwdriver.pfnSetSpecialState},
|
|
||||||
{"_DrawMD2@16", &hwdriver.pfnDrawMD2},
|
|
||||||
{"_SetTransform@4", &hwdriver.pfnSetTransform},
|
|
||||||
{"_GetTextureUsed@0", &hwdriver.pfnGetTextureUsed},
|
|
||||||
{"_GetRenderVersion@0",&hwdriver.pfnGetRenderVersion},
|
|
||||||
{NULL,NULL}
|
|
||||||
};
|
|
||||||
|
|
||||||
BOOL Init3DDriver (LPCSTR dllName)
|
|
||||||
{
|
|
||||||
hwdModule = LoadDLL(dllName, hwdFuncTable);
|
|
||||||
return (hwdModule != NULL);
|
|
||||||
}
|
|
||||||
|
|
||||||
VOID Shutdown3DDriver (VOID)
|
|
||||||
{
|
|
||||||
UnloadDLL(&hwdModule);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef HW3SOUND
|
#ifdef HW3SOUND
|
||||||
static HMODULE hwsModule = NULL;
|
static HMODULE hwsModule = NULL;
|
||||||
|
|
||||||
|
|
|
@ -20,11 +20,6 @@
|
||||||
#define RPC_NO_WINDOWS_H
|
#define RPC_NO_WINDOWS_H
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
|
|
||||||
#ifdef HWRENDER
|
|
||||||
BOOL Init3DDriver (LPCSTR dllName);
|
|
||||||
VOID Shutdown3DDriver (VOID);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef HW3SOUND
|
#ifdef HW3SOUND
|
||||||
BOOL Init3DSDriver(LPCSTR dllName);
|
BOOL Init3DSDriver(LPCSTR dllName);
|
||||||
VOID Shutdown3DSDriver(VOID);
|
VOID Shutdown3DSDriver(VOID);
|
||||||
|
|
|
@ -34,12 +34,6 @@
|
||||||
#include "../command.h"
|
#include "../command.h"
|
||||||
#include "../screen.h"
|
#include "../screen.h"
|
||||||
|
|
||||||
#ifdef HWRENDER
|
|
||||||
#include "win_dll.h" // loading the render DLL
|
|
||||||
#include "../hardware/hw_drv.h" // calling driver init & shutdown
|
|
||||||
#include "../hardware/hw_main.h" // calling HWR module init & shutdown
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// -------
|
// -------
|
||||||
// Globals
|
// Globals
|
||||||
// -------
|
// -------
|
||||||
|
@ -110,13 +104,6 @@ void I_StartupGraphics(void)
|
||||||
if (graphics_started)
|
if (graphics_started)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
#ifdef HWRENDER
|
|
||||||
if (M_CheckParm("-opengl"))
|
|
||||||
rendermode = render_opengl;
|
|
||||||
else
|
|
||||||
rendermode = render_soft;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
if (dedicated)
|
if (dedicated)
|
||||||
rendermode = render_none;
|
rendermode = render_none;
|
||||||
else
|
else
|
||||||
|
@ -152,15 +139,6 @@ void I_ShutdownGraphics(void)
|
||||||
bmiMain = NULL;
|
bmiMain = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef HWRENDER
|
|
||||||
if (rendermode != render_soft)
|
|
||||||
{
|
|
||||||
HWR_Shutdown(); // free stuff from the hardware renderer
|
|
||||||
HWD.pfnShutdown(); // close 3d card display
|
|
||||||
Shutdown3DDriver(); // free the driver DLL
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// free the last video mode screen buffers
|
// free the last video mode screen buffers
|
||||||
if (vid.buffer)
|
if (vid.buffer)
|
||||||
{
|
{
|
||||||
|
@ -168,9 +146,6 @@ void I_ShutdownGraphics(void)
|
||||||
vid.buffer = NULL;
|
vid.buffer = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef HWRENDER
|
|
||||||
if (rendermode == render_soft)
|
|
||||||
#endif
|
|
||||||
CloseDirectDraw();
|
CloseDirectDraw();
|
||||||
|
|
||||||
graphics_started = false;
|
graphics_started = false;
|
||||||
|
@ -212,11 +187,6 @@ void I_FinishUpdate(void)
|
||||||
DIB_RGB_COLORS);
|
DIB_RGB_COLORS);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
#ifdef HWRENDER
|
|
||||||
if (rendermode != render_soft)
|
|
||||||
HWD.pfnFinishUpdate(cv_vidwait.value);
|
|
||||||
else
|
|
||||||
#endif
|
|
||||||
{
|
{
|
||||||
// DIRECT DRAW
|
// DIRECT DRAW
|
||||||
// copy virtual screen to real screen
|
// copy virtual screen to real screen
|
||||||
|
@ -295,9 +265,6 @@ void I_SetPalette(RGBA_t *palette)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
#ifdef HWRENDER
|
|
||||||
if (rendermode == render_soft)
|
|
||||||
#endif
|
|
||||||
{
|
{
|
||||||
PALETTEENTRY mainpal[256];
|
PALETTEENTRY mainpal[256];
|
||||||
|
|
||||||
|
@ -458,48 +425,6 @@ static void VID_Init(void)
|
||||||
bDIBMode = TRUE;
|
bDIBMode = TRUE;
|
||||||
bAppFullScreen = FALSE;
|
bAppFullScreen = FALSE;
|
||||||
|
|
||||||
#ifdef HWRENDER
|
|
||||||
// initialize the appropriate display device
|
|
||||||
if (rendermode != render_soft)
|
|
||||||
{
|
|
||||||
const char *drvname = NULL;
|
|
||||||
|
|
||||||
switch (rendermode)
|
|
||||||
{
|
|
||||||
case render_opengl:
|
|
||||||
drvname = "r_opengl.dll";
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
I_Error("Unknown hardware render mode");
|
|
||||||
}
|
|
||||||
|
|
||||||
// load the DLL
|
|
||||||
if (drvname && Init3DDriver(drvname))
|
|
||||||
{
|
|
||||||
int hwdversion = HWD.pfnGetRenderVersion();
|
|
||||||
if (hwdversion != VERSION)
|
|
||||||
CONS_Printf("WARNING: This r_opengl version is not supported, use it at your own risk.\n");
|
|
||||||
|
|
||||||
// perform initialisations
|
|
||||||
HWD.pfnInit(I_Error);
|
|
||||||
// get available display modes for the device
|
|
||||||
HWD.pfnGetModeList(&pvidmodes, &numvidmodes);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
switch (rendermode)
|
|
||||||
{
|
|
||||||
case render_opengl:
|
|
||||||
I_Error("Error initializing OpenGL");
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
rendermode = render_soft;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (rendermode == render_soft)
|
|
||||||
#endif
|
|
||||||
if (!bWinParm)
|
if (!bWinParm)
|
||||||
{
|
{
|
||||||
if (!CreateDirectDrawInstance())
|
if (!CreateDirectDrawInstance())
|
||||||
|
@ -705,14 +630,6 @@ INT32 VID_SetMode(INT32 modenum)
|
||||||
// we switch to fullscreen
|
// we switch to fullscreen
|
||||||
bAppFullScreen = TRUE;
|
bAppFullScreen = TRUE;
|
||||||
bDIBMode = FALSE;
|
bDIBMode = FALSE;
|
||||||
#ifdef HWRENDER
|
|
||||||
if (rendermode != render_soft)
|
|
||||||
{
|
|
||||||
// purge all patch graphics stored in software format
|
|
||||||
//Z_FreeTags (PU_PURGELEVEL, PU_PURGELEVEL+100);
|
|
||||||
HWR_Startup();
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
I_RestartSysMouse();
|
I_RestartSysMouse();
|
||||||
|
|
|
@ -637,7 +637,6 @@ void Command_Memfree_f(void)
|
||||||
CONS_Printf(M_GetText("Mipmap patches : %7s KB\n"), sizeu1(Z_TagUsage(PU_HWRPATCHCOLMIPMAP)>>10));
|
CONS_Printf(M_GetText("Mipmap patches : %7s KB\n"), sizeu1(Z_TagUsage(PU_HWRPATCHCOLMIPMAP)>>10));
|
||||||
CONS_Printf(M_GetText("HW Texture cache : %7s KB\n"), sizeu1(Z_TagUsage(PU_HWRCACHE)>>10));
|
CONS_Printf(M_GetText("HW Texture cache : %7s KB\n"), sizeu1(Z_TagUsage(PU_HWRCACHE)>>10));
|
||||||
CONS_Printf(M_GetText("Plane polygons : %7s KB\n"), sizeu1(Z_TagUsage(PU_HWRPLANE)>>10));
|
CONS_Printf(M_GetText("Plane polygons : %7s KB\n"), sizeu1(Z_TagUsage(PU_HWRPLANE)>>10));
|
||||||
CONS_Printf(M_GetText("HW Texture used : %7d KB\n"), HWR_GetTextureUsed()>>10);
|
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue