mirror of
https://git.do.srb2.org/KartKrew/Kart-Public.git
synced 2024-12-27 21:01:04 +00:00
Merge branch 'next' of git@git.magicalgirl.moe:STJr/SRB2.git into nextmerge
# Conflicts: # src/d_main.c # src/d_main.h # src/d_netcmd.c # src/doomtype.h # src/hardware/hw_md2.h # src/p_user.c # src/r_splats.h # src/s_sound.c # src/s_sound.h # src/screen.c # src/sdl/i_system.c
This commit is contained in:
commit
6af56273bf
38 changed files with 1282 additions and 574 deletions
|
@ -13,8 +13,6 @@
|
||||||
- libupnp (Linux/OS X only)
|
- libupnp (Linux/OS X only)
|
||||||
- libgme (Linux/OS X only)
|
- libgme (Linux/OS X only)
|
||||||
|
|
||||||
Warning: 64-bit builds are not netgame compatible with 32-bit builds. Use at your own risk.
|
|
||||||
|
|
||||||
## Compiling
|
## Compiling
|
||||||
|
|
||||||
See [SRB2 Wiki/Source code compiling](http://wiki.srb2.org/wiki/Source_code_compiling)
|
See [SRB2 Wiki/Source code compiling](http://wiki.srb2.org/wiki/Source_code_compiling)
|
||||||
|
|
33
SRB2.cbp
33
SRB2.cbp
|
@ -1174,6 +1174,39 @@ HW3SOUND for 3D hardware sound support
|
||||||
<Option target="Debug Mingw64/DirectX" />
|
<Option target="Debug Mingw64/DirectX" />
|
||||||
<Option target="Release Mingw64/DirectX" />
|
<Option target="Release Mingw64/DirectX" />
|
||||||
</Unit>
|
</Unit>
|
||||||
|
<Unit filename="src/hardware/hw_clip.c">
|
||||||
|
<Option compilerVar="CC" />
|
||||||
|
<Option target="Debug Native/SDL" />
|
||||||
|
<Option target="Release Native/SDL" />
|
||||||
|
<Option target="Debug Mingw/SDL" />
|
||||||
|
<Option target="Release Mingw/SDL" />
|
||||||
|
<Option target="Debug Mingw/DirectX" />
|
||||||
|
<Option target="Release Mingw/DirectX" />
|
||||||
|
<Option target="Debug Any/Dummy" />
|
||||||
|
<Option target="Release Any/Dummy" />
|
||||||
|
<Option target="Debug Linux/SDL" />
|
||||||
|
<Option target="Release Linux/SDL" />
|
||||||
|
<Option target="Debug Mingw64/SDL" />
|
||||||
|
<Option target="Release Mingw64/SDL" />
|
||||||
|
<Option target="Debug Mingw64/DirectX" />
|
||||||
|
<Option target="Release Mingw64/DirectX" />
|
||||||
|
</Unit>
|
||||||
|
<Unit filename="src/hardware/hw_clip.h">
|
||||||
|
<Option target="Debug Native/SDL" />
|
||||||
|
<Option target="Release Native/SDL" />
|
||||||
|
<Option target="Debug Mingw/SDL" />
|
||||||
|
<Option target="Release Mingw/SDL" />
|
||||||
|
<Option target="Debug Mingw/DirectX" />
|
||||||
|
<Option target="Release Mingw/DirectX" />
|
||||||
|
<Option target="Debug Any/Dummy" />
|
||||||
|
<Option target="Release Any/Dummy" />
|
||||||
|
<Option target="Debug Linux/SDL" />
|
||||||
|
<Option target="Release Linux/SDL" />
|
||||||
|
<Option target="Debug Mingw64/SDL" />
|
||||||
|
<Option target="Release Mingw64/SDL" />
|
||||||
|
<Option target="Debug Mingw64/DirectX" />
|
||||||
|
<Option target="Release Mingw64/DirectX" />
|
||||||
|
</Unit>
|
||||||
<Unit filename="src/hardware/hw_data.h">
|
<Unit filename="src/hardware/hw_data.h">
|
||||||
<Option target="Debug Native/SDL" />
|
<Option target="Debug Native/SDL" />
|
||||||
<Option target="Release Native/SDL" />
|
<Option target="Release Native/SDL" />
|
||||||
|
|
|
@ -352,6 +352,7 @@ if(${SRB2_CONFIG_HWRENDER})
|
||||||
set(SRB2_HWRENDER_SOURCES
|
set(SRB2_HWRENDER_SOURCES
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/hardware/hw_bsp.c
|
${CMAKE_CURRENT_SOURCE_DIR}/hardware/hw_bsp.c
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/hardware/hw_cache.c
|
${CMAKE_CURRENT_SOURCE_DIR}/hardware/hw_cache.c
|
||||||
|
${CMAKE_CURRENT_SOURCE_DIR}/hardware/hw_clip.c
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/hardware/hw_draw.c
|
${CMAKE_CURRENT_SOURCE_DIR}/hardware/hw_draw.c
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/hardware/hw_light.c
|
${CMAKE_CURRENT_SOURCE_DIR}/hardware/hw_light.c
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/hardware/hw_main.c
|
${CMAKE_CURRENT_SOURCE_DIR}/hardware/hw_main.c
|
||||||
|
@ -360,6 +361,7 @@ if(${SRB2_CONFIG_HWRENDER})
|
||||||
)
|
)
|
||||||
|
|
||||||
set (SRB2_HWRENDER_HEADERS
|
set (SRB2_HWRENDER_HEADERS
|
||||||
|
${CMAKE_CURRENT_SOURCE_DIR}/hardware/hw_clip.h
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/hardware/hw_data.h
|
${CMAKE_CURRENT_SOURCE_DIR}/hardware/hw_data.h
|
||||||
${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
|
||||||
|
|
12
src/Makefile
12
src/Makefile
|
@ -269,7 +269,7 @@ ifndef DC
|
||||||
endif
|
endif
|
||||||
OPTS+=-DHWRENDER
|
OPTS+=-DHWRENDER
|
||||||
OBJS+=$(OBJDIR)/hw_bsp.o $(OBJDIR)/hw_draw.o $(OBJDIR)/hw_light.o \
|
OBJS+=$(OBJDIR)/hw_bsp.o $(OBJDIR)/hw_draw.o $(OBJDIR)/hw_light.o \
|
||||||
$(OBJDIR)/hw_main.o $(OBJDIR)/hw_md2.o $(OBJDIR)/hw_cache.o $(OBJDIR)/hw_trick.o
|
$(OBJDIR)/hw_main.o $(OBJDIR)/hw_clip.o $(OBJDIR)/hw_md2.o $(OBJDIR)/hw_cache.o $(OBJDIR)/hw_trick.o
|
||||||
endif
|
endif
|
||||||
|
|
||||||
ifdef NOHS
|
ifdef NOHS
|
||||||
|
@ -721,7 +721,7 @@ 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_glide.h hardware/hw_defs.h \
|
||||||
hardware/hw_md2.h hardware/hw_glob.h hardware/hw_main.h am_map.h \
|
hardware/hw_md2.h hardware/hw_glob.h hardware/hw_main.h hardware/hw_clip.h am_map.h \
|
||||||
d_event.h d_player.h p_pspr.h m_fixed.h tables.h info.h d_think.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
|
||||||
$(CC) $(CFLAGS) $(WFLAGS) -c $< -o $@
|
$(CC) $(CFLAGS) $(WFLAGS) -c $< -o $@
|
||||||
|
@ -729,7 +729,7 @@ 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_glide.h hardware/hw_defs.h \
|
||||||
hardware/hw_md2.h hardware/hw_glob.h hardware/hw_main.h am_map.h \
|
hardware/hw_md2.h hardware/hw_glob.h hardware/hw_main.h hardware/hw_clip.h am_map.h \
|
||||||
d_event.h d_player.h p_pspr.h m_fixed.h tables.h info.h d_think.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
|
||||||
$(CC) $(CFLAGS) $(WFLAGS) -I/usr/X11R6/include -c $< -o $@
|
$(CC) $(CFLAGS) $(WFLAGS) -I/usr/X11R6/include -c $< -o $@
|
||||||
|
@ -882,7 +882,7 @@ 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_glide.h hardware/hw_defs.h \
|
||||||
hardware/hw_md2.h hardware/hw_glob.h hardware/hw_main.h am_map.h \
|
hardware/hw_md2.h hardware/hw_glob.h hardware/hw_main.h hardware/hw_clip.h am_map.h \
|
||||||
d_event.h d_player.h p_pspr.h m_fixed.h tables.h info.h d_think.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
|
||||||
$(CC) $(CFLAGS) $(WFLAGS) -D_WINDOWS -mwindows -c $< -o $@
|
$(CC) $(CFLAGS) $(WFLAGS) -D_WINDOWS -mwindows -c $< -o $@
|
||||||
|
@ -890,7 +890,7 @@ $(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_glide.h hardware/hw_defs.h \
|
||||||
hardware/hw_md2.h hardware/hw_glob.h hardware/hw_main.h am_map.h \
|
hardware/hw_md2.h hardware/hw_glob.h hardware/hw_main.h hardware/hw_clip.h am_map.h \
|
||||||
d_event.h d_player.h p_pspr.h m_fixed.h tables.h info.h d_think.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
|
||||||
$(CC) $(CFLAGS) $(WFLAGS) -D_WINDOWS -mwindows -c $< -o $@
|
$(CC) $(CFLAGS) $(WFLAGS) -D_WINDOWS -mwindows -c $< -o $@
|
||||||
|
@ -898,7 +898,7 @@ $(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_glide.h hardware/hw_defs.h \
|
||||||
hardware/hw_md2.h hardware/hw_glob.h hardware/hw_main.h am_map.h \
|
hardware/hw_md2.h hardware/hw_glob.h hardware/hw_main.h hardware/hw_clip.h am_map.h \
|
||||||
d_event.h d_player.h p_pspr.h m_fixed.h tables.h info.h d_think.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
|
||||||
$(CC) $(CFLAGS) $(WFLAGS) -D_WINDOWS -mwindows -c $< -o $@
|
$(CC) $(CFLAGS) $(WFLAGS) -D_WINDOWS -mwindows -c $< -o $@
|
||||||
|
|
|
@ -15,7 +15,9 @@
|
||||||
#define DEALIGNED
|
#define DEALIGNED
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef _BIG_ENDIAN
|
#include "endian.h"
|
||||||
|
|
||||||
|
#ifndef SRB2_BIG_ENDIAN
|
||||||
//
|
//
|
||||||
// Little-endian machines
|
// Little-endian machines
|
||||||
//
|
//
|
||||||
|
@ -75,7 +77,7 @@
|
||||||
#define READANGLE(p) *((angle_t *)p)++
|
#define READANGLE(p) *((angle_t *)p)++
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#else //_BIG_ENDIAN
|
#else //SRB2_BIG_ENDIAN
|
||||||
//
|
//
|
||||||
// definitions for big-endian machines with alignment constraints.
|
// definitions for big-endian machines with alignment constraints.
|
||||||
//
|
//
|
||||||
|
@ -144,7 +146,7 @@ FUNCINLINE static ATTRINLINE UINT32 readulong(void *ptr)
|
||||||
#define READCHAR(p) ({ char *p_tmp = ( char *)p; char b = *p_tmp; p_tmp++; p = (void *)p_tmp; b; })
|
#define READCHAR(p) ({ char *p_tmp = ( char *)p; char b = *p_tmp; p_tmp++; p = (void *)p_tmp; b; })
|
||||||
#define READFIXED(p) ({ fixed_t *p_tmp = (fixed_t *)p; fixed_t b = readlong(p); p_tmp++; p = (void *)p_tmp; b; })
|
#define READFIXED(p) ({ fixed_t *p_tmp = (fixed_t *)p; fixed_t b = readlong(p); p_tmp++; p = (void *)p_tmp; b; })
|
||||||
#define READANGLE(p) ({ angle_t *p_tmp = (angle_t *)p; angle_t b = readulong(p); p_tmp++; p = (void *)p_tmp; b; })
|
#define READANGLE(p) ({ angle_t *p_tmp = (angle_t *)p; angle_t b = readulong(p); p_tmp++; p = (void *)p_tmp; b; })
|
||||||
#endif //_BIG_ENDIAN
|
#endif //SRB2_BIG_ENDIAN
|
||||||
|
|
||||||
#undef DEALIGNED
|
#undef DEALIGNED
|
||||||
|
|
||||||
|
|
|
@ -69,6 +69,7 @@ CV_PossibleValue_t kartspeed_cons_t[] = {
|
||||||
{0, NULL}};
|
{0, NULL}};
|
||||||
|
|
||||||
#define COM_BUF_SIZE 8192 // command buffer size
|
#define COM_BUF_SIZE 8192 // command buffer size
|
||||||
|
#define MAX_ALIAS_RECURSION 100 // max recursion allowed for aliases
|
||||||
|
|
||||||
static INT32 com_wait; // one command per frame (for cmd sequences)
|
static INT32 com_wait; // one command per frame (for cmd sequences)
|
||||||
|
|
||||||
|
@ -491,6 +492,7 @@ static void COM_ExecuteString(char *ptext)
|
||||||
{
|
{
|
||||||
xcommand_t *cmd;
|
xcommand_t *cmd;
|
||||||
cmdalias_t *a;
|
cmdalias_t *a;
|
||||||
|
static INT32 recursion = 0; // detects recursion and stops it if it goes too far
|
||||||
|
|
||||||
COM_TokenizeString(ptext);
|
COM_TokenizeString(ptext);
|
||||||
|
|
||||||
|
@ -503,6 +505,7 @@ 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;
|
||||||
}
|
}
|
||||||
|
@ -513,11 +516,20 @@ static void COM_ExecuteString(char *ptext)
|
||||||
{
|
{
|
||||||
if (!stricmp(com_argv[0], a->name))
|
if (!stricmp(com_argv[0], a->name))
|
||||||
{
|
{
|
||||||
|
if (recursion > MAX_ALIAS_RECURSION)
|
||||||
|
{
|
||||||
|
CONS_Alert(CONS_WARNING, M_GetText("Alias recursion cycle detected!\n"));
|
||||||
|
recursion = 0;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
recursion++;
|
||||||
COM_BufInsertText(a->value);
|
COM_BufInsertText(a->value);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
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)
|
||||||
|
|
10
src/d_main.c
10
src/d_main.c
|
@ -180,7 +180,7 @@ void D_PostEvent(const event_t *ev)
|
||||||
eventhead = (eventhead+1) & (MAXEVENTS-1);
|
eventhead = (eventhead+1) & (MAXEVENTS-1);
|
||||||
}
|
}
|
||||||
// just for lock this function
|
// just for lock this function
|
||||||
#ifndef DOXYGEN
|
#if defined (PC_DOS) && !defined (DOXYGEN)
|
||||||
void D_PostEvent_end(void) {};
|
void D_PostEvent_end(void) {};
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -512,7 +512,8 @@ static void D_Display(void)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Image postprocessing effect
|
if (rendermode == render_soft)
|
||||||
|
{
|
||||||
if (postimgtype)
|
if (postimgtype)
|
||||||
V_DoPostProcessor(0, postimgtype, postimgparam);
|
V_DoPostProcessor(0, postimgtype, postimgparam);
|
||||||
if (postimgtype2)
|
if (postimgtype2)
|
||||||
|
@ -522,6 +523,7 @@ static void D_Display(void)
|
||||||
if (postimgtype4)
|
if (postimgtype4)
|
||||||
V_DoPostProcessor(3, postimgtype4, postimgparam4);
|
V_DoPostProcessor(3, postimgtype4, postimgparam4);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (lastdraw)
|
if (lastdraw)
|
||||||
{
|
{
|
||||||
|
@ -855,10 +857,6 @@ static inline void D_CleanFile(void)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifndef _MAX_PATH
|
|
||||||
#define _MAX_PATH MAX_WADPATH
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// ==========================================================================
|
// ==========================================================================
|
||||||
// Identify the SRB2 version, and IWAD file to use.
|
// Identify the SRB2 version, and IWAD file to use.
|
||||||
// ==========================================================================
|
// ==========================================================================
|
||||||
|
|
|
@ -40,7 +40,7 @@ void D_SRB2Main(void);
|
||||||
|
|
||||||
// Called by IO functions when input is detected.
|
// Called by IO functions when input is detected.
|
||||||
void D_PostEvent(const event_t *ev);
|
void D_PostEvent(const event_t *ev);
|
||||||
#ifndef DOXYGEN
|
#if defined (PC_DOS) && !defined (DOXYGEN)
|
||||||
void D_PostEvent_end(void); // delimiter for locking memory
|
void D_PostEvent_end(void); // delimiter for locking memory
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
103
src/d_netcmd.c
103
src/d_netcmd.c
|
@ -147,8 +147,6 @@ FUNCNORETURN static ATTRNORETURN void Command_Quit_f(void);
|
||||||
static void Command_Playintro_f(void);
|
static void Command_Playintro_f(void);
|
||||||
|
|
||||||
static void Command_Displayplayer_f(void);
|
static void Command_Displayplayer_f(void);
|
||||||
static void Command_Tunes_f(void);
|
|
||||||
static void Command_RestartAudio_f(void);
|
|
||||||
|
|
||||||
static void Command_ExitLevel_f(void);
|
static void Command_ExitLevel_f(void);
|
||||||
static void Command_Showmap_f(void);
|
static void Command_Showmap_f(void);
|
||||||
|
@ -405,7 +403,6 @@ consvar_t cv_overtime = {"overtime", "Yes", CV_NETVAR, CV_YesNo, NULL, 0, NULL,
|
||||||
consvar_t cv_rollingdemos = {"rollingdemos", "On", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL};
|
consvar_t cv_rollingdemos = {"rollingdemos", "On", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||||
|
|
||||||
consvar_t cv_timetic = {"timerres", "Normal", CV_SAVE|CV_NOSHOWHELP, timetic_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL}; // use tics in display
|
consvar_t cv_timetic = {"timerres", "Normal", CV_SAVE|CV_NOSHOWHELP, timetic_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL}; // use tics in display
|
||||||
consvar_t cv_resetmusic = {"resetmusic", "No", CV_SAVE|CV_NOSHOWHELP, CV_YesNo, NULL, 0, NULL, NULL, 0, 0, NULL};
|
|
||||||
|
|
||||||
static CV_PossibleValue_t pointlimit_cons_t[] = {{0, "MIN"}, {999999990, "MAX"}, {0, NULL}};
|
static CV_PossibleValue_t pointlimit_cons_t[] = {{0, "MIN"}, {999999990, "MAX"}, {0, NULL}};
|
||||||
consvar_t cv_pointlimit = {"pointlimit", "0", CV_NETVAR|CV_CALL|CV_NOINIT, pointlimit_cons_t,
|
consvar_t cv_pointlimit = {"pointlimit", "0", CV_NETVAR|CV_CALL|CV_NOINIT, pointlimit_cons_t,
|
||||||
|
@ -778,9 +775,6 @@ void D_RegisterClientCommands(void)
|
||||||
CV_RegisterVar(&cv_ghost_staff);
|
CV_RegisterVar(&cv_ghost_staff);
|
||||||
|
|
||||||
COM_AddCommand("displayplayer", Command_Displayplayer_f);
|
COM_AddCommand("displayplayer", Command_Displayplayer_f);
|
||||||
COM_AddCommand("tunes", Command_Tunes_f);
|
|
||||||
COM_AddCommand("restartaudio", Command_RestartAudio_f);
|
|
||||||
CV_RegisterVar(&cv_resetmusic);
|
|
||||||
|
|
||||||
// FIXME: not to be here.. but needs be done for config loading
|
// FIXME: not to be here.. but needs be done for config loading
|
||||||
CV_RegisterVar(&cv_usegamma);
|
CV_RegisterVar(&cv_usegamma);
|
||||||
|
@ -4770,103 +4764,6 @@ static void Command_Displayplayer_f(void)
|
||||||
CONS_Printf(M_GetText("Displayplayer is %d\n"), displayplayer);
|
CONS_Printf(M_GetText("Displayplayer is %d\n"), displayplayer);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void Command_Tunes_f(void)
|
|
||||||
{
|
|
||||||
const char *tunearg;
|
|
||||||
UINT16 tunenum, track = 0;
|
|
||||||
const size_t argc = COM_Argc();
|
|
||||||
|
|
||||||
if (argc < 2) //tunes slot ...
|
|
||||||
{
|
|
||||||
CONS_Printf("tunes <name/num> [track] [speed] / <-show> / <-default> / <-none>:\n");
|
|
||||||
CONS_Printf(M_GetText("Play an arbitrary music lump. If a map number is used, 'MAP##M' is played.\n"));
|
|
||||||
CONS_Printf(M_GetText("If the format supports multiple songs, you can specify which one to play.\n\n"));
|
|
||||||
CONS_Printf(M_GetText("* With \"-show\", shows the currently playing tune and track.\n"));
|
|
||||||
CONS_Printf(M_GetText("* With \"-default\", returns to the default music for the map.\n"));
|
|
||||||
CONS_Printf(M_GetText("* With \"-none\", any music playing will be stopped.\n"));
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
tunearg = COM_Argv(1);
|
|
||||||
tunenum = (UINT16)atoi(tunearg);
|
|
||||||
track = 0;
|
|
||||||
|
|
||||||
if (!strcasecmp(tunearg, "-show"))
|
|
||||||
{
|
|
||||||
CONS_Printf(M_GetText("The current tune is: %s [track %d]\n"),
|
|
||||||
mapmusname, (mapmusflags & MUSIC_TRACKMASK));
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (!strcasecmp(tunearg, "-none"))
|
|
||||||
{
|
|
||||||
S_StopMusic();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
else if (!strcasecmp(tunearg, "-default"))
|
|
||||||
{
|
|
||||||
tunearg = mapheaderinfo[gamemap-1]->musname;
|
|
||||||
track = mapheaderinfo[gamemap-1]->mustrack;
|
|
||||||
}
|
|
||||||
else if (!tunearg[2] && toupper(tunearg[0]) >= 'A' && toupper(tunearg[0]) <= 'Z')
|
|
||||||
tunenum = (UINT16)M_MapNumber(tunearg[0], tunearg[1]);
|
|
||||||
|
|
||||||
if (tunenum && tunenum >= 1036)
|
|
||||||
{
|
|
||||||
CONS_Alert(CONS_NOTICE, M_GetText("Valid music slots are 1 to 1035.\n"));
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (!tunenum && strlen(tunearg) > 6) // This is automatic -- just show the error just in case
|
|
||||||
CONS_Alert(CONS_NOTICE, M_GetText("Music name too long - truncated to six characters.\n"));
|
|
||||||
|
|
||||||
if (argc > 2)
|
|
||||||
track = (UINT16)atoi(COM_Argv(2))-1;
|
|
||||||
|
|
||||||
if (tunenum)
|
|
||||||
snprintf(mapmusname, 7, "%sM", G_BuildMapName(tunenum));
|
|
||||||
else
|
|
||||||
strncpy(mapmusname, tunearg, 7);
|
|
||||||
mapmusname[6] = 0;
|
|
||||||
mapmusflags = (track & MUSIC_TRACKMASK);
|
|
||||||
|
|
||||||
S_ChangeMusic(mapmusname, mapmusflags, true);
|
|
||||||
|
|
||||||
if (argc > 3)
|
|
||||||
{
|
|
||||||
float speed = (float)atof(COM_Argv(3));
|
|
||||||
if (speed > 0.0f)
|
|
||||||
S_SpeedMusic(speed);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
static void Command_RestartAudio_f(void)
|
|
||||||
{
|
|
||||||
if (dedicated) // No point in doing anything if game is a dedicated server.
|
|
||||||
return;
|
|
||||||
|
|
||||||
S_StopMusic();
|
|
||||||
S_StopSounds();
|
|
||||||
I_ShutdownMusic();
|
|
||||||
I_ShutdownSound();
|
|
||||||
I_StartupSound();
|
|
||||||
I_InitMusic();
|
|
||||||
|
|
||||||
// These must be called or no sound and music until manually set.
|
|
||||||
|
|
||||||
I_SetSfxVolume(cv_soundvolume.value);
|
|
||||||
#ifdef NO_MIDI
|
|
||||||
S_SetMusicVolume(cv_digmusicvolume.value, -1);
|
|
||||||
#else
|
|
||||||
S_SetMusicVolume(cv_digmusicvolume.value, cv_midimusicvolume.value);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
S_StartSound(NULL, sfx_strpst);
|
|
||||||
|
|
||||||
if (Playing()) // Gotta make sure the player is in a level
|
|
||||||
P_RestoreMusic(&players[consoleplayer]);
|
|
||||||
else
|
|
||||||
S_ChangeMusicInternal("titles", looptitle);
|
|
||||||
}
|
|
||||||
|
|
||||||
/** Quits a game and returns to the title screen.
|
/** Quits a game and returns to the title screen.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -137,8 +137,6 @@ extern consvar_t cv_startinglives;
|
||||||
// for F_finale.c
|
// for F_finale.c
|
||||||
extern consvar_t cv_rollingdemos;
|
extern consvar_t cv_rollingdemos;
|
||||||
|
|
||||||
extern consvar_t cv_resetmusic;
|
|
||||||
|
|
||||||
extern consvar_t cv_ringslinger, cv_soundtest;
|
extern consvar_t cv_ringslinger, cv_soundtest;
|
||||||
|
|
||||||
extern consvar_t cv_specialrings, cv_powerstones, cv_matchboxes, cv_competitionboxes;
|
extern consvar_t cv_specialrings, cv_powerstones, cv_matchboxes, cv_competitionboxes;
|
||||||
|
@ -250,5 +248,3 @@ void D_SetPassword(const char *pw);
|
||||||
UINT8 CanChangeSkin(INT32 playernum);
|
UINT8 CanChangeSkin(INT32 playernum);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -551,4 +551,11 @@ extern const char *compdate, *comptime, *comprevision, *compbranch;
|
||||||
/// SRB2Kart: MIDI support is shitty and busted and we don't want it, lets throw it behind a define
|
/// SRB2Kart: MIDI support is shitty and busted and we don't want it, lets throw it behind a define
|
||||||
#define NO_MIDI
|
#define NO_MIDI
|
||||||
|
|
||||||
|
/// FINALLY some real clipping that doesn't make walls dissappear AND speeds the game up
|
||||||
|
/// (that was the original comment from SRB2CB, sadly it is a lie and actually slows game down)
|
||||||
|
/// on the bright side it fixes some weird issues with translucent walls
|
||||||
|
/// \note SRB2CB port.
|
||||||
|
/// SRB2CB itself ported this from PrBoom+
|
||||||
|
#define NEWCLIP
|
||||||
|
|
||||||
#endif // __DOOMDEF__
|
#endif // __DOOMDEF__
|
||||||
|
|
110
src/doomtype.h
110
src/doomtype.h
|
@ -44,13 +44,14 @@
|
||||||
typedef long ssize_t;
|
typedef long ssize_t;
|
||||||
|
|
||||||
/* Older Visual C++ headers don't have the Win64-compatible typedefs... */
|
/* Older Visual C++ headers don't have the Win64-compatible typedefs... */
|
||||||
#if ((_MSC_VER <= 1200) && (!defined(DWORD_PTR)))
|
#if (_MSC_VER <= 1200)
|
||||||
|
#ifndef DWORD_PTR
|
||||||
#define DWORD_PTR DWORD
|
#define DWORD_PTR DWORD
|
||||||
#endif
|
#endif
|
||||||
|
#ifndef PDWORD_PTR
|
||||||
#if ((_MSC_VER <= 1200) && (!defined(PDWORD_PTR)))
|
|
||||||
#define PDWORD_PTR PDWORD
|
#define PDWORD_PTR PDWORD
|
||||||
#endif
|
#endif
|
||||||
|
#endif
|
||||||
#elif defined (_arch_dreamcast) // KOS Dreamcast
|
#elif defined (_arch_dreamcast) // KOS Dreamcast
|
||||||
#include <arch/types.h>
|
#include <arch/types.h>
|
||||||
|
|
||||||
|
@ -97,12 +98,14 @@ typedef long ssize_t;
|
||||||
#define NOIPX
|
#define NOIPX
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
/* Strings and some misc platform specific stuff */
|
||||||
|
|
||||||
#if defined (_MSC_VER) || defined (__OS2__)
|
#if defined (_MSC_VER) || defined (__OS2__)
|
||||||
// Microsoft VisualC++
|
// Microsoft VisualC++
|
||||||
#ifdef _MSC_VER
|
#ifdef _MSC_VER
|
||||||
#if (_MSC_VER <= 1800) // MSVC 2013 and back
|
#if (_MSC_VER <= 1800) // MSVC 2013 and back
|
||||||
#define snprintf _snprintf
|
#define snprintf _snprintf
|
||||||
#if (_MSC_VER <= 1200) // MSVC 2012 and back
|
#if (_MSC_VER <= 1200) // MSVC 6.0 and back
|
||||||
#define vsnprintf _vsnprintf
|
#define vsnprintf _vsnprintf
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
@ -178,6 +181,8 @@ size_t strlcpy(char *dst, const char *src, size_t siz);
|
||||||
// not the number of bytes in the buffer.
|
// not the number of bytes in the buffer.
|
||||||
#define STRBUFCPY(dst,src) strlcpy(dst, src, sizeof dst)
|
#define STRBUFCPY(dst,src) strlcpy(dst, src, sizeof dst)
|
||||||
|
|
||||||
|
/* Boolean type definition */
|
||||||
|
|
||||||
// \note __BYTEBOOL__ used to be set above if "macintosh" was defined,
|
// \note __BYTEBOOL__ used to be set above if "macintosh" was defined,
|
||||||
// if macintosh's version of boolean type isn't needed anymore, then isn't this macro pointless now?
|
// if macintosh's version of boolean type isn't needed anymore, then isn't this macro pointless now?
|
||||||
#ifndef __BYTEBOOL__
|
#ifndef __BYTEBOOL__
|
||||||
|
@ -240,50 +245,18 @@ size_t strlcpy(char *dst, const char *src, size_t siz);
|
||||||
#define UINT64_MAX 0xffffffffffffffffULL /* 18446744073709551615ULL */
|
#define UINT64_MAX 0xffffffffffffffffULL /* 18446744073709551615ULL */
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
union FColorRGBA
|
/* Compiler-specific attributes and other macros */
|
||||||
{
|
|
||||||
UINT32 rgba;
|
|
||||||
struct
|
|
||||||
{
|
|
||||||
UINT8 red;
|
|
||||||
UINT8 green;
|
|
||||||
UINT8 blue;
|
|
||||||
UINT8 alpha;
|
|
||||||
} s;
|
|
||||||
} ATTRPACK;
|
|
||||||
typedef union FColorRGBA RGBA_t;
|
|
||||||
|
|
||||||
typedef enum
|
|
||||||
{
|
|
||||||
postimg_none,
|
|
||||||
postimg_water,
|
|
||||||
postimg_motion,
|
|
||||||
postimg_flip,
|
|
||||||
postimg_heat,
|
|
||||||
postimg_mirror
|
|
||||||
} postimg_t;
|
|
||||||
|
|
||||||
typedef UINT32 lumpnum_t; // 16 : 16 unsigned long (wad num: lump num)
|
|
||||||
#define LUMPERROR UINT32_MAX
|
|
||||||
|
|
||||||
typedef UINT32 tic_t;
|
|
||||||
#define INFTICS UINT32_MAX
|
|
||||||
|
|
||||||
#ifdef _BIG_ENDIAN
|
|
||||||
#define UINT2RGBA(a) a
|
|
||||||
#else
|
|
||||||
#define UINT2RGBA(a) (UINT32)((a&0xff)<<24)|((a&0xff00)<<8)|((a&0xff0000)>>8)|(((UINT32)a&0xff000000)>>24)
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef __GNUC__ // __attribute__ ((X))
|
#ifdef __GNUC__ // __attribute__ ((X))
|
||||||
#define FUNCNORETURN __attribute__ ((noreturn))
|
#define FUNCNORETURN __attribute__ ((noreturn))
|
||||||
#if ((__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 1)) && defined (__MINGW32__)
|
|
||||||
|
#if ((__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 1)) && defined (__MINGW32__) // MinGW, >= GCC 4.1
|
||||||
#include "inttypes.h"
|
#include "inttypes.h"
|
||||||
#if 0 //defined (__USE_MINGW_ANSI_STDIO) && __USE_MINGW_ANSI_STDIO > 0
|
#if 0 //defined (__USE_MINGW_ANSI_STDIO) && __USE_MINGW_ANSI_STDIO > 0
|
||||||
#define FUNCPRINTF __attribute__ ((format(gnu_printf, 1, 2)))
|
#define FUNCPRINTF __attribute__ ((format(gnu_printf, 1, 2)))
|
||||||
#define FUNCDEBUG __attribute__ ((format(gnu_printf, 2, 3)))
|
#define FUNCDEBUG __attribute__ ((format(gnu_printf, 2, 3)))
|
||||||
#define FUNCIERROR __attribute__ ((format(gnu_printf, 1, 2),noreturn))
|
#define FUNCIERROR __attribute__ ((format(gnu_printf, 1, 2),noreturn))
|
||||||
#elif (__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4)
|
#elif (__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4) // >= GCC 4.4
|
||||||
#define FUNCPRINTF __attribute__ ((format(ms_printf, 1, 2)))
|
#define FUNCPRINTF __attribute__ ((format(ms_printf, 1, 2)))
|
||||||
#define FUNCDEBUG __attribute__ ((format(ms_printf, 2, 3)))
|
#define FUNCDEBUG __attribute__ ((format(ms_printf, 2, 3)))
|
||||||
#define FUNCIERROR __attribute__ ((format(ms_printf, 1, 2),noreturn))
|
#define FUNCIERROR __attribute__ ((format(ms_printf, 1, 2),noreturn))
|
||||||
|
@ -297,27 +270,36 @@ typedef UINT32 tic_t;
|
||||||
#define FUNCDEBUG __attribute__ ((format(printf, 2, 3)))
|
#define FUNCDEBUG __attribute__ ((format(printf, 2, 3)))
|
||||||
#define FUNCIERROR __attribute__ ((format(printf, 1, 2),noreturn))
|
#define FUNCIERROR __attribute__ ((format(printf, 1, 2),noreturn))
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef FUNCIERROR
|
#ifndef FUNCIERROR
|
||||||
#define FUNCIERROR __attribute__ ((noreturn))
|
#define FUNCIERROR __attribute__ ((noreturn))
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define FUNCMATH __attribute__((const))
|
#define FUNCMATH __attribute__((const))
|
||||||
#if (__GNUC__ > 3) || (__GNUC__ == 3 && __GNUC_MINOR__ >= 1)
|
|
||||||
|
#if (__GNUC__ > 3) || (__GNUC__ == 3 && __GNUC_MINOR__ >= 1) // >= GCC 3.1
|
||||||
#define FUNCDEAD __attribute__ ((deprecated))
|
#define FUNCDEAD __attribute__ ((deprecated))
|
||||||
#define FUNCINLINE __attribute__((always_inline))
|
#define FUNCINLINE __attribute__((always_inline))
|
||||||
#define FUNCNONNULL __attribute__((nonnull))
|
#define FUNCNONNULL __attribute__((nonnull))
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define FUNCNOINLINE __attribute__((noinline))
|
#define FUNCNOINLINE __attribute__((noinline))
|
||||||
#if (__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4)
|
|
||||||
|
#if (__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4) // >= GCC 4.4
|
||||||
#ifdef __i386__ // i386 only
|
#ifdef __i386__ // i386 only
|
||||||
#define FUNCTARGET(X) __attribute__ ((__target__ (X)))
|
#define FUNCTARGET(X) __attribute__ ((__target__ (X)))
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
#if defined (__MINGW32__) && ((__GNUC__ > 3) || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4))
|
|
||||||
|
#if defined (__MINGW32__) && ((__GNUC__ > 3) || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4)) // MinGW, >= GCC 3.4
|
||||||
#define ATTRPACK __attribute__((packed, gcc_struct))
|
#define ATTRPACK __attribute__((packed, gcc_struct))
|
||||||
#else
|
#else
|
||||||
#define ATTRPACK __attribute__((packed))
|
#define ATTRPACK __attribute__((packed))
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define ATTRUNUSED __attribute__((unused))
|
#define ATTRUNUSED __attribute__((unused))
|
||||||
|
|
||||||
|
// Xbox-only macros
|
||||||
#ifdef _XBOX
|
#ifdef _XBOX
|
||||||
#define FILESTAMP I_OutputMsg("%s:%d\n",__FILE__,__LINE__);
|
#define FILESTAMP I_OutputMsg("%s:%d\n",__FILE__,__LINE__);
|
||||||
#define XBOXSTATIC static
|
#define XBOXSTATIC static
|
||||||
|
@ -325,7 +307,7 @@ typedef UINT32 tic_t;
|
||||||
#elif defined (_MSC_VER)
|
#elif defined (_MSC_VER)
|
||||||
#define ATTRNORETURN __declspec(noreturn)
|
#define ATTRNORETURN __declspec(noreturn)
|
||||||
#define ATTRINLINE __forceinline
|
#define ATTRINLINE __forceinline
|
||||||
#if _MSC_VER > 1200
|
#if _MSC_VER > 1200 // >= MSVC 6.0
|
||||||
#define ATTRNOINLINE __declspec(noinline)
|
#define ATTRNOINLINE __declspec(noinline)
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
@ -381,4 +363,44 @@ typedef UINT32 tic_t;
|
||||||
#ifndef FILESTAMP
|
#ifndef FILESTAMP
|
||||||
#define FILESTAMP
|
#define FILESTAMP
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
/* Miscellaneous types that don't fit anywhere else (Can this be changed?) */
|
||||||
|
|
||||||
|
union FColorRGBA
|
||||||
|
{
|
||||||
|
UINT32 rgba;
|
||||||
|
struct
|
||||||
|
{
|
||||||
|
UINT8 red;
|
||||||
|
UINT8 green;
|
||||||
|
UINT8 blue;
|
||||||
|
UINT8 alpha;
|
||||||
|
} s;
|
||||||
|
} ATTRPACK;
|
||||||
|
typedef union FColorRGBA RGBA_t;
|
||||||
|
|
||||||
|
typedef enum
|
||||||
|
{
|
||||||
|
postimg_none,
|
||||||
|
postimg_water,
|
||||||
|
postimg_motion,
|
||||||
|
postimg_flip,
|
||||||
|
postimg_heat,
|
||||||
|
postimg_mirror
|
||||||
|
} postimg_t;
|
||||||
|
|
||||||
|
typedef UINT32 lumpnum_t; // 16 : 16 unsigned long (wad num: lump num)
|
||||||
|
#define LUMPERROR UINT32_MAX
|
||||||
|
|
||||||
|
typedef UINT32 tic_t;
|
||||||
|
#define INFTICS UINT32_MAX
|
||||||
|
|
||||||
|
#include "endian.h" // This is needed to make sure the below macro acts correctly in big endian builds
|
||||||
|
|
||||||
|
#ifdef SRB2_BIG_ENDIAN
|
||||||
|
#define UINT2RGBA(a) a
|
||||||
|
#else
|
||||||
|
#define UINT2RGBA(a) (UINT32)((a&0xff)<<24)|((a&0xff00)<<8)|((a&0xff0000)>>8)|(((UINT32)a&0xff000000)>>24)
|
||||||
|
#endif
|
||||||
|
|
||||||
#endif //__DOOMTYPE__
|
#endif //__DOOMTYPE__
|
||||||
|
|
|
@ -867,6 +867,7 @@ void F_StartGameEnd(void)
|
||||||
//
|
//
|
||||||
void F_GameEndDrawer(void)
|
void F_GameEndDrawer(void)
|
||||||
{
|
{
|
||||||
|
// this function does nothing
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
|
|
|
@ -879,8 +879,8 @@ static void AdjustSegs(void)
|
||||||
count = subsectors[i].numlines;
|
count = subsectors[i].numlines;
|
||||||
lseg = &segs[subsectors[i].firstline];
|
lseg = &segs[subsectors[i].firstline];
|
||||||
p = extrasubsectors[i].planepoly;
|
p = extrasubsectors[i].planepoly;
|
||||||
if (!p)
|
//if (!p)
|
||||||
continue;
|
//continue;
|
||||||
for (; count--; lseg++)
|
for (; count--; lseg++)
|
||||||
{
|
{
|
||||||
float distv1,distv2,tmp;
|
float distv1,distv2,tmp;
|
||||||
|
@ -893,6 +893,7 @@ static void AdjustSegs(void)
|
||||||
continue;
|
continue;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
if (p) {
|
||||||
for (j = 0; j < p->numpts; j++)
|
for (j = 0; j < p->numpts; j++)
|
||||||
{
|
{
|
||||||
distv1 = p->pts[j].x - FIXED_TO_FLOAT(lseg->v1->x);
|
distv1 = p->pts[j].x - FIXED_TO_FLOAT(lseg->v1->x);
|
||||||
|
@ -913,9 +914,10 @@ static void AdjustSegs(void)
|
||||||
nearv2 = distv2;
|
nearv2 = distv2;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (nearv1 <= NEARDIST*NEARDIST)
|
}
|
||||||
|
if (p && nearv1 <= NEARDIST*NEARDIST)
|
||||||
// share vertice with segs
|
// share vertice with segs
|
||||||
lseg->v1 = (vertex_t *)&(p->pts[v1found]);
|
lseg->pv1 = &(p->pts[v1found]);
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// BP: here we can do better, using PointInSeg and compute
|
// BP: here we can do better, using PointInSeg and compute
|
||||||
|
@ -926,24 +928,24 @@ static void AdjustSegs(void)
|
||||||
polyvertex_t *pv = HWR_AllocVertex();
|
polyvertex_t *pv = HWR_AllocVertex();
|
||||||
pv->x = FIXED_TO_FLOAT(lseg->v1->x);
|
pv->x = FIXED_TO_FLOAT(lseg->v1->x);
|
||||||
pv->y = FIXED_TO_FLOAT(lseg->v1->y);
|
pv->y = FIXED_TO_FLOAT(lseg->v1->y);
|
||||||
lseg->v1 = (vertex_t *)pv;
|
lseg->pv1 = pv;
|
||||||
}
|
}
|
||||||
if (nearv2 <= NEARDIST*NEARDIST)
|
if (p && nearv2 <= NEARDIST*NEARDIST)
|
||||||
lseg->v2 = (vertex_t *)&(p->pts[v2found]);
|
lseg->pv2 = &(p->pts[v2found]);
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
polyvertex_t *pv = HWR_AllocVertex();
|
polyvertex_t *pv = HWR_AllocVertex();
|
||||||
pv->x = FIXED_TO_FLOAT(lseg->v2->x);
|
pv->x = FIXED_TO_FLOAT(lseg->v2->x);
|
||||||
pv->y = FIXED_TO_FLOAT(lseg->v2->y);
|
pv->y = FIXED_TO_FLOAT(lseg->v2->y);
|
||||||
lseg->v2 = (vertex_t *)pv;
|
lseg->pv2 = pv;
|
||||||
}
|
}
|
||||||
|
|
||||||
// recompute length
|
// recompute length
|
||||||
{
|
{
|
||||||
float x,y;
|
float x,y;
|
||||||
x = ((polyvertex_t *)lseg->v2)->x - ((polyvertex_t *)lseg->v1)->x
|
x = ((polyvertex_t *)lseg->pv2)->x - ((polyvertex_t *)lseg->pv1)->x
|
||||||
+ FIXED_TO_FLOAT(FRACUNIT/2);
|
+ FIXED_TO_FLOAT(FRACUNIT/2);
|
||||||
y = ((polyvertex_t *)lseg->v2)->y - ((polyvertex_t *)lseg->v1)->y
|
y = ((polyvertex_t *)lseg->pv2)->y - ((polyvertex_t *)lseg->pv1)->y
|
||||||
+ FIXED_TO_FLOAT(FRACUNIT/2);
|
+ FIXED_TO_FLOAT(FRACUNIT/2);
|
||||||
lseg->flength = (float)hypot(x, y);
|
lseg->flength = (float)hypot(x, y);
|
||||||
// BP: debug see this kind of segs
|
// BP: debug see this kind of segs
|
||||||
|
|
465
src/hardware/hw_clip.c
Normal file
465
src/hardware/hw_clip.c
Normal file
|
@ -0,0 +1,465 @@
|
||||||
|
/* Emacs style mode select -*- C++ -*-
|
||||||
|
*-----------------------------------------------------------------------------
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* PrBoom: a Doom port merged with LxDoom and LSDLDoom
|
||||||
|
* based on BOOM, a modified and improved DOOM engine
|
||||||
|
* Copyright (C) 1999 by
|
||||||
|
* id Software, Chi Hoang, Lee Killough, Jim Flynn, Rand Phares, Ty Halderman
|
||||||
|
* Copyright (C) 1999-2000 by
|
||||||
|
* Jess Haas, Nicolas Kalkhof, Colin Phipps, Florian Schulze
|
||||||
|
* Copyright 2005, 2006 by
|
||||||
|
* Florian Schulze, Colin Phipps, Neil Stevens, Andrey Budko
|
||||||
|
*
|
||||||
|
* 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.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
|
||||||
|
* 02111-1307, USA.
|
||||||
|
*
|
||||||
|
* DESCRIPTION:
|
||||||
|
*
|
||||||
|
*---------------------------------------------------------------------
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
*
|
||||||
|
** gl_clipper.cpp
|
||||||
|
**
|
||||||
|
** Handles visibility checks.
|
||||||
|
** Loosely based on the JDoom clipper.
|
||||||
|
**
|
||||||
|
**---------------------------------------------------------------------------
|
||||||
|
** Copyright 2003 Tim Stump
|
||||||
|
** All rights reserved.
|
||||||
|
**
|
||||||
|
** Redistribution and use in source and binary forms, with or without
|
||||||
|
** modification, are permitted provided that the following conditions
|
||||||
|
** are met:
|
||||||
|
**
|
||||||
|
** 1. Redistributions of source code must retain the above copyright
|
||||||
|
** notice, this list of conditions and the following disclaimer.
|
||||||
|
** 2. Redistributions in binary form must reproduce the above copyright
|
||||||
|
** notice, this list of conditions and the following disclaimer in the
|
||||||
|
** documentation and/or other materials provided with the distribution.
|
||||||
|
** 3. The name of the author may not be used to endorse or promote products
|
||||||
|
** derived from this software without specific prior written permission.
|
||||||
|
**
|
||||||
|
** THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
|
||||||
|
** IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
||||||
|
** OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
||||||
|
** IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||||
|
** INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
||||||
|
** NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||||
|
** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||||
|
** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||||
|
** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
||||||
|
** THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
**---------------------------------------------------------------------------
|
||||||
|
**
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <math.h>
|
||||||
|
#include "../v_video.h"
|
||||||
|
#include "hw_clip.h"
|
||||||
|
#include "hw_glob.h"
|
||||||
|
#include "../r_state.h"
|
||||||
|
#include "../tables.h"
|
||||||
|
#include "r_opengl/r_opengl.h"
|
||||||
|
|
||||||
|
#ifdef HAVE_SPHEREFRUSTRUM
|
||||||
|
static GLdouble viewMatrix[16];
|
||||||
|
static GLdouble projMatrix[16];
|
||||||
|
float frustum[6][4];
|
||||||
|
#endif
|
||||||
|
|
||||||
|
typedef struct clipnode_s
|
||||||
|
{
|
||||||
|
struct clipnode_s *prev, *next;
|
||||||
|
angle_t start, end;
|
||||||
|
} clipnode_t;
|
||||||
|
|
||||||
|
clipnode_t *freelist;
|
||||||
|
clipnode_t *clipnodes;
|
||||||
|
clipnode_t *cliphead;
|
||||||
|
|
||||||
|
static clipnode_t * gld_clipnode_GetNew(void);
|
||||||
|
static clipnode_t * gld_clipnode_NewRange(angle_t start, angle_t end);
|
||||||
|
static boolean gld_clipper_IsRangeVisible(angle_t startAngle, angle_t endAngle);
|
||||||
|
static void gld_clipper_AddClipRange(angle_t start, angle_t end);
|
||||||
|
static void gld_clipper_RemoveRange(clipnode_t * range);
|
||||||
|
static void gld_clipnode_Free(clipnode_t *node);
|
||||||
|
|
||||||
|
static clipnode_t * gld_clipnode_GetNew(void)
|
||||||
|
{
|
||||||
|
if (freelist)
|
||||||
|
{
|
||||||
|
clipnode_t * p = freelist;
|
||||||
|
freelist = p->next;
|
||||||
|
return p;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return (clipnode_t*)malloc(sizeof(clipnode_t));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static clipnode_t * gld_clipnode_NewRange(angle_t start, angle_t end)
|
||||||
|
{
|
||||||
|
clipnode_t * c = gld_clipnode_GetNew();
|
||||||
|
c->start = start;
|
||||||
|
c->end = end;
|
||||||
|
c->next = c->prev=NULL;
|
||||||
|
return c;
|
||||||
|
}
|
||||||
|
|
||||||
|
boolean gld_clipper_SafeCheckRange(angle_t startAngle, angle_t endAngle)
|
||||||
|
{
|
||||||
|
if(startAngle > endAngle)
|
||||||
|
{
|
||||||
|
return (gld_clipper_IsRangeVisible(startAngle, ANGLE_MAX) || gld_clipper_IsRangeVisible(0, endAngle));
|
||||||
|
}
|
||||||
|
|
||||||
|
return gld_clipper_IsRangeVisible(startAngle, endAngle);
|
||||||
|
}
|
||||||
|
|
||||||
|
static boolean gld_clipper_IsRangeVisible(angle_t startAngle, angle_t endAngle)
|
||||||
|
{
|
||||||
|
clipnode_t *ci;
|
||||||
|
ci = cliphead;
|
||||||
|
|
||||||
|
if (endAngle == 0 && ci && ci->start == 0)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
while (ci != NULL && ci->start < endAngle)
|
||||||
|
{
|
||||||
|
if (startAngle >= ci->start && endAngle <= ci->end)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
ci = ci->next;
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void gld_clipnode_Free(clipnode_t *node)
|
||||||
|
{
|
||||||
|
node->next = freelist;
|
||||||
|
freelist = node;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void gld_clipper_RemoveRange(clipnode_t *range)
|
||||||
|
{
|
||||||
|
if (range == cliphead)
|
||||||
|
{
|
||||||
|
cliphead = cliphead->next;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (range->prev)
|
||||||
|
{
|
||||||
|
range->prev->next = range->next;
|
||||||
|
}
|
||||||
|
if (range->next)
|
||||||
|
{
|
||||||
|
range->next->prev = range->prev;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
gld_clipnode_Free(range);
|
||||||
|
}
|
||||||
|
|
||||||
|
void gld_clipper_SafeAddClipRange(angle_t startangle, angle_t endangle)
|
||||||
|
{
|
||||||
|
if(startangle > endangle)
|
||||||
|
{
|
||||||
|
// The range has to added in two parts.
|
||||||
|
gld_clipper_AddClipRange(startangle, ANGLE_MAX);
|
||||||
|
gld_clipper_AddClipRange(0, endangle);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// Add the range as usual.
|
||||||
|
gld_clipper_AddClipRange(startangle, endangle);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static void gld_clipper_AddClipRange(angle_t start, angle_t end)
|
||||||
|
{
|
||||||
|
clipnode_t *node, *temp, *prevNode, *node2, *delnode;
|
||||||
|
|
||||||
|
if (cliphead)
|
||||||
|
{
|
||||||
|
//check to see if range contains any old ranges
|
||||||
|
node = cliphead;
|
||||||
|
while (node != NULL && node->start < end)
|
||||||
|
{
|
||||||
|
if (node->start >= start && node->end <= end)
|
||||||
|
{
|
||||||
|
temp = node;
|
||||||
|
node = node->next;
|
||||||
|
gld_clipper_RemoveRange(temp);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (node->start <= start && node->end >= end)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
node = node->next;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//check to see if range overlaps a range (or possibly 2)
|
||||||
|
node = cliphead;
|
||||||
|
while (node != NULL && node->start <= end)
|
||||||
|
{
|
||||||
|
if (node->end >= start)
|
||||||
|
{
|
||||||
|
// we found the first overlapping node
|
||||||
|
if (node->start > start)
|
||||||
|
{
|
||||||
|
// the new range overlaps with this node's start point
|
||||||
|
node->start = start;
|
||||||
|
}
|
||||||
|
if (node->end < end)
|
||||||
|
{
|
||||||
|
node->end = end;
|
||||||
|
}
|
||||||
|
|
||||||
|
node2 = node->next;
|
||||||
|
while (node2 && node2->start <= node->end)
|
||||||
|
{
|
||||||
|
if (node2->end > node->end)
|
||||||
|
{
|
||||||
|
node->end = node2->end;
|
||||||
|
}
|
||||||
|
|
||||||
|
delnode = node2;
|
||||||
|
node2 = node2->next;
|
||||||
|
gld_clipper_RemoveRange(delnode);
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
node = node->next;
|
||||||
|
}
|
||||||
|
|
||||||
|
//just add range
|
||||||
|
node = cliphead;
|
||||||
|
prevNode = NULL;
|
||||||
|
temp = gld_clipnode_NewRange(start, end);
|
||||||
|
while (node != NULL && node->start < end)
|
||||||
|
{
|
||||||
|
prevNode = node;
|
||||||
|
node = node->next;
|
||||||
|
}
|
||||||
|
temp->next = node;
|
||||||
|
if (node == NULL)
|
||||||
|
{
|
||||||
|
temp->prev = prevNode;
|
||||||
|
if (prevNode)
|
||||||
|
{
|
||||||
|
prevNode->next = temp;
|
||||||
|
}
|
||||||
|
if (!cliphead)
|
||||||
|
{
|
||||||
|
cliphead = temp;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (node == cliphead)
|
||||||
|
{
|
||||||
|
cliphead->prev = temp;
|
||||||
|
cliphead = temp;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
temp->prev = prevNode;
|
||||||
|
prevNode->next = temp;
|
||||||
|
node->prev = temp;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
temp = gld_clipnode_NewRange(start, end);
|
||||||
|
cliphead = temp;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void gld_clipper_Clear(void)
|
||||||
|
{
|
||||||
|
clipnode_t *node = cliphead;
|
||||||
|
clipnode_t *temp;
|
||||||
|
|
||||||
|
while (node != NULL)
|
||||||
|
{
|
||||||
|
temp = node;
|
||||||
|
node = node->next;
|
||||||
|
gld_clipnode_Free(temp);
|
||||||
|
}
|
||||||
|
|
||||||
|
cliphead = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
#define RMUL (1.6f/1.333333f)
|
||||||
|
|
||||||
|
angle_t gld_FrustumAngle(void)
|
||||||
|
{
|
||||||
|
double floatangle;
|
||||||
|
angle_t a1;
|
||||||
|
|
||||||
|
float tilt = (float)fabs(((double)(int)aimingangle) / ANG1);
|
||||||
|
|
||||||
|
// NEWCLIP TODO: SRB2CBTODO: make a global render_fov for this function
|
||||||
|
|
||||||
|
float render_fov = FIXED_TO_FLOAT(cv_grfov.value);
|
||||||
|
float render_fovratio = (float)BASEVIDWIDTH / (float)BASEVIDHEIGHT; // SRB2CBTODO: NEWCLIPTODO: Is this right?
|
||||||
|
float render_multiplier = 64.0f / render_fovratio / RMUL;
|
||||||
|
|
||||||
|
if (tilt > 90.0f)
|
||||||
|
{
|
||||||
|
tilt = 90.0f;
|
||||||
|
}
|
||||||
|
|
||||||
|
// If the pitch is larger than this you can look all around at a FOV of 90
|
||||||
|
if (abs((signed)aimingangle) > 46 * ANG1)
|
||||||
|
return 0xffffffff;
|
||||||
|
|
||||||
|
// ok, this is a gross hack that barely works...
|
||||||
|
// but at least it doesn't overestimate too much...
|
||||||
|
floatangle = 2.0f + (45.0f + (tilt / 1.9f)) * (float)render_fov * 48.0f / render_multiplier / 90.0f;
|
||||||
|
a1 = ANG1 * (int)floatangle;
|
||||||
|
if (a1 >= ANGLE_180)
|
||||||
|
return 0xffffffff;
|
||||||
|
return a1;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 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
|
||||||
|
// 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
|
||||||
|
#ifdef HAVE_SPHEREFRUSTRUM
|
||||||
|
//
|
||||||
|
// gld_FrustrumSetup
|
||||||
|
//
|
||||||
|
|
||||||
|
#define CALCMATRIX(a, b, c, d, e, f, g, h)\
|
||||||
|
(float)(viewMatrix[a] * projMatrix[b] + \
|
||||||
|
viewMatrix[c] * projMatrix[d] + \
|
||||||
|
viewMatrix[e] * projMatrix[f] + \
|
||||||
|
viewMatrix[g] * projMatrix[h])
|
||||||
|
|
||||||
|
#define NORMALIZE_PLANE(i)\
|
||||||
|
t = (float)sqrt(\
|
||||||
|
frustum[i][0] * frustum[i][0] + \
|
||||||
|
frustum[i][1] * frustum[i][1] + \
|
||||||
|
frustum[i][2] * frustum[i][2]); \
|
||||||
|
frustum[i][0] /= t; \
|
||||||
|
frustum[i][1] /= t; \
|
||||||
|
frustum[i][2] /= t; \
|
||||||
|
frustum[i][3] /= t
|
||||||
|
|
||||||
|
void gld_FrustrumSetup(void)
|
||||||
|
{
|
||||||
|
float t;
|
||||||
|
float clip[16];
|
||||||
|
|
||||||
|
pglGetDoublev(GL_PROJECTION_MATRIX, projMatrix);
|
||||||
|
pglGetDoublev(GL_MODELVIEW_MATRIX, viewMatrix);
|
||||||
|
|
||||||
|
clip[0] = CALCMATRIX(0, 0, 1, 4, 2, 8, 3, 12);
|
||||||
|
clip[1] = CALCMATRIX(0, 1, 1, 5, 2, 9, 3, 13);
|
||||||
|
clip[2] = CALCMATRIX(0, 2, 1, 6, 2, 10, 3, 14);
|
||||||
|
clip[3] = CALCMATRIX(0, 3, 1, 7, 2, 11, 3, 15);
|
||||||
|
|
||||||
|
clip[4] = CALCMATRIX(4, 0, 5, 4, 6, 8, 7, 12);
|
||||||
|
clip[5] = CALCMATRIX(4, 1, 5, 5, 6, 9, 7, 13);
|
||||||
|
clip[6] = CALCMATRIX(4, 2, 5, 6, 6, 10, 7, 14);
|
||||||
|
clip[7] = CALCMATRIX(4, 3, 5, 7, 6, 11, 7, 15);
|
||||||
|
|
||||||
|
clip[8] = CALCMATRIX(8, 0, 9, 4, 10, 8, 11, 12);
|
||||||
|
clip[9] = CALCMATRIX(8, 1, 9, 5, 10, 9, 11, 13);
|
||||||
|
clip[10] = CALCMATRIX(8, 2, 9, 6, 10, 10, 11, 14);
|
||||||
|
clip[11] = CALCMATRIX(8, 3, 9, 7, 10, 11, 11, 15);
|
||||||
|
|
||||||
|
clip[12] = CALCMATRIX(12, 0, 13, 4, 14, 8, 15, 12);
|
||||||
|
clip[13] = CALCMATRIX(12, 1, 13, 5, 14, 9, 15, 13);
|
||||||
|
clip[14] = CALCMATRIX(12, 2, 13, 6, 14, 10, 15, 14);
|
||||||
|
clip[15] = CALCMATRIX(12, 3, 13, 7, 14, 11, 15, 15);
|
||||||
|
|
||||||
|
// Right plane
|
||||||
|
frustum[0][0] = clip[ 3] - clip[ 0];
|
||||||
|
frustum[0][1] = clip[ 7] - clip[ 4];
|
||||||
|
frustum[0][2] = clip[11] - clip[ 8];
|
||||||
|
frustum[0][3] = clip[15] - clip[12];
|
||||||
|
NORMALIZE_PLANE(0);
|
||||||
|
|
||||||
|
// Left plane
|
||||||
|
frustum[1][0] = clip[ 3] + clip[ 0];
|
||||||
|
frustum[1][1] = clip[ 7] + clip[ 4];
|
||||||
|
frustum[1][2] = clip[11] + clip[ 8];
|
||||||
|
frustum[1][3] = clip[15] + clip[12];
|
||||||
|
NORMALIZE_PLANE(1);
|
||||||
|
|
||||||
|
// Bottom plane
|
||||||
|
frustum[2][0] = clip[ 3] + clip[ 1];
|
||||||
|
frustum[2][1] = clip[ 7] + clip[ 5];
|
||||||
|
frustum[2][2] = clip[11] + clip[ 9];
|
||||||
|
frustum[2][3] = clip[15] + clip[13];
|
||||||
|
NORMALIZE_PLANE(2);
|
||||||
|
|
||||||
|
// Top plane
|
||||||
|
frustum[3][0] = clip[ 3] - clip[ 1];
|
||||||
|
frustum[3][1] = clip[ 7] - clip[ 5];
|
||||||
|
frustum[3][2] = clip[11] - clip[ 9];
|
||||||
|
frustum[3][3] = clip[15] - clip[13];
|
||||||
|
NORMALIZE_PLANE(3);
|
||||||
|
|
||||||
|
// Far plane
|
||||||
|
frustum[4][0] = clip[ 3] - clip[ 2];
|
||||||
|
frustum[4][1] = clip[ 7] - clip[ 6];
|
||||||
|
frustum[4][2] = clip[11] - clip[10];
|
||||||
|
frustum[4][3] = clip[15] - clip[14];
|
||||||
|
NORMALIZE_PLANE(4);
|
||||||
|
|
||||||
|
// Near plane
|
||||||
|
frustum[5][0] = clip[ 3] + clip[ 2];
|
||||||
|
frustum[5][1] = clip[ 7] + clip[ 6];
|
||||||
|
frustum[5][2] = clip[11] + clip[10];
|
||||||
|
frustum[5][3] = clip[15] + clip[14];
|
||||||
|
NORMALIZE_PLANE(5);
|
||||||
|
}
|
||||||
|
|
||||||
|
boolean gld_SphereInFrustum(float x, float y, float z, float radius)
|
||||||
|
{
|
||||||
|
int p;
|
||||||
|
|
||||||
|
for (p = 0; p < 4; p++)
|
||||||
|
{
|
||||||
|
if (frustum[p][0] * x +
|
||||||
|
frustum[p][1] * y +
|
||||||
|
frustum[p][2] * z +
|
||||||
|
frustum[p][3] <= -radius)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
#endif
|
24
src/hardware/hw_clip.h
Normal file
24
src/hardware/hw_clip.h
Normal file
|
@ -0,0 +1,24 @@
|
||||||
|
/*
|
||||||
|
* hw_clip.h
|
||||||
|
* SRB2CB
|
||||||
|
*
|
||||||
|
* PrBoom's OpenGL clipping
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
// OpenGL BSP clipping
|
||||||
|
#include "../doomdef.h"
|
||||||
|
#include "../tables.h"
|
||||||
|
#include "../doomtype.h"
|
||||||
|
|
||||||
|
//#define HAVE_SPHEREFRUSTRUM // enable if you want gld_SphereInFrustum and related code
|
||||||
|
|
||||||
|
boolean gld_clipper_SafeCheckRange(angle_t startAngle, angle_t endAngle);
|
||||||
|
void gld_clipper_SafeAddClipRange(angle_t startangle, angle_t endangle);
|
||||||
|
void gld_clipper_Clear(void);
|
||||||
|
angle_t gld_FrustumAngle(void);
|
||||||
|
#ifdef HAVE_SPHEREFRUSTRUM
|
||||||
|
void gld_FrustrumSetup(void);
|
||||||
|
boolean gld_SphereInFrustum(float x, float y, float z, float radius);
|
||||||
|
#endif
|
|
@ -26,10 +26,6 @@
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined (VID_X11) && !defined (HAVE_SDL)
|
|
||||||
#include <GL/glx.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include "../doomdef.h"
|
#include "../doomdef.h"
|
||||||
//THIS MUST DISAPPEAR!!!
|
//THIS MUST DISAPPEAR!!!
|
||||||
#include "hw_glide.h"
|
#include "hw_glide.h"
|
||||||
|
|
|
@ -32,10 +32,6 @@
|
||||||
// STANDARD DLL EXPORTS
|
// STANDARD DLL EXPORTS
|
||||||
// ==========================================================================
|
// ==========================================================================
|
||||||
|
|
||||||
#ifdef HAVE_SDL
|
|
||||||
#undef VID_X11
|
|
||||||
#endif
|
|
||||||
|
|
||||||
EXPORT boolean HWRAPI(Init) (I_Error_t ErrorFunction);
|
EXPORT boolean HWRAPI(Init) (I_Error_t ErrorFunction);
|
||||||
#ifndef HAVE_SDL
|
#ifndef HAVE_SDL
|
||||||
EXPORT void HWRAPI(Shutdown) (void);
|
EXPORT void HWRAPI(Shutdown) (void);
|
||||||
|
@ -43,9 +39,6 @@ EXPORT void HWRAPI(Shutdown) (void);
|
||||||
#ifdef _WINDOWS
|
#ifdef _WINDOWS
|
||||||
EXPORT void HWRAPI(GetModeList) (vmode_t **pvidmodes, INT32 *numvidmodes);
|
EXPORT void HWRAPI(GetModeList) (vmode_t **pvidmodes, INT32 *numvidmodes);
|
||||||
#endif
|
#endif
|
||||||
#ifdef VID_X11
|
|
||||||
EXPORT Window HWRAPI(HookXwin) (Display *, INT32, INT32, boolean);
|
|
||||||
#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
|
||||||
|
@ -71,10 +64,6 @@ EXPORT void HWRAPI(SetTransform) (FTransform *ptransform);
|
||||||
EXPORT INT32 HWRAPI(GetTextureUsed) (void);
|
EXPORT INT32 HWRAPI(GetTextureUsed) (void);
|
||||||
EXPORT INT32 HWRAPI(GetRenderVersion) (void);
|
EXPORT INT32 HWRAPI(GetRenderVersion) (void);
|
||||||
|
|
||||||
#ifdef VID_X11 // ifdef to be removed as soon as windoze supports that as well
|
|
||||||
// metzgermeister: added for Voodoo detection
|
|
||||||
EXPORT char *HWRAPI(GetRenderer) (void);
|
|
||||||
#endif
|
|
||||||
#ifdef SHUFFLE
|
#ifdef SHUFFLE
|
||||||
#define SCREENVERTS 10
|
#define SCREENVERTS 10
|
||||||
EXPORT void HWRAPI(PostImgRedraw) (float points[SCREENVERTS][SCREENVERTS][2]);
|
EXPORT void HWRAPI(PostImgRedraw) (float points[SCREENVERTS][SCREENVERTS][2]);
|
||||||
|
@ -115,10 +104,6 @@ struct hwdriver_s
|
||||||
#ifdef _WINDOWS
|
#ifdef _WINDOWS
|
||||||
GetModeList pfnGetModeList;
|
GetModeList pfnGetModeList;
|
||||||
#endif
|
#endif
|
||||||
#ifdef VID_X11
|
|
||||||
HookXwin pfnHookXwin;
|
|
||||||
GetRenderer pfnGetRenderer;
|
|
||||||
#endif
|
|
||||||
#ifndef HAVE_SDL
|
#ifndef HAVE_SDL
|
||||||
Shutdown pfnShutdown;
|
Shutdown pfnShutdown;
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -44,6 +44,10 @@
|
||||||
#endif
|
#endif
|
||||||
#include "hw_md2.h"
|
#include "hw_md2.h"
|
||||||
|
|
||||||
|
#ifdef NEWCLIP
|
||||||
|
#include "hw_clip.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
#define R_FAKEFLOORS
|
#define R_FAKEFLOORS
|
||||||
#define HWPRECIP
|
#define HWPRECIP
|
||||||
#define SORTING
|
#define SORTING
|
||||||
|
@ -99,8 +103,9 @@ CV_PossibleValue_t granisotropicmode_cons_t[] = {{1, "MIN"}, {16, "MAX"}, {0, NU
|
||||||
boolean drawsky = true;
|
boolean drawsky = true;
|
||||||
|
|
||||||
// needs fix: walls are incorrectly clipped one column less
|
// needs fix: walls are incorrectly clipped one column less
|
||||||
|
#ifndef NEWCLIP
|
||||||
static consvar_t cv_grclipwalls = {"gr_clipwalls", "Off", 0, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL};
|
static consvar_t cv_grclipwalls = {"gr_clipwalls", "Off", 0, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||||
|
#endif
|
||||||
//development variables for diverse uses
|
//development variables for diverse uses
|
||||||
static consvar_t cv_gralpha = {"gr_alpha", "160", 0, CV_Unsigned, NULL, 0, NULL, NULL, 0, 0, NULL};
|
static consvar_t cv_gralpha = {"gr_alpha", "160", 0, CV_Unsigned, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||||
static consvar_t cv_grbeta = {"gr_beta", "0", 0, CV_Unsigned, NULL, 0, NULL, NULL, 0, 0, NULL};
|
static consvar_t cv_grbeta = {"gr_beta", "0", 0, CV_Unsigned, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||||
|
@ -323,9 +328,6 @@ static angle_t gr_xtoviewangle[MAXVIDWIDTH+1];
|
||||||
// test change fov when looking up/down but bsp projection messup :(
|
// test change fov when looking up/down but bsp projection messup :(
|
||||||
//#define NOCRAPPYMLOOK
|
//#define NOCRAPPYMLOOK
|
||||||
|
|
||||||
/// \note crappy
|
|
||||||
#define drawtextured true
|
|
||||||
|
|
||||||
// base values set at SetViewSize
|
// base values set at SetViewSize
|
||||||
static float gr_basecentery;
|
static float gr_basecentery;
|
||||||
static float gr_basecenterx;
|
static float gr_basecenterx;
|
||||||
|
@ -862,11 +864,11 @@ static void HWR_DrawSegsSplats(FSurfaceInfo * pSurf)
|
||||||
|
|
||||||
M_ClearBox(segbbox);
|
M_ClearBox(segbbox);
|
||||||
M_AddToBox(segbbox,
|
M_AddToBox(segbbox,
|
||||||
FLOAT_TO_FIXED(((polyvertex_t *)gr_curline->v1)->x),
|
FLOAT_TO_FIXED(((polyvertex_t *)gr_curline->pv1)->x),
|
||||||
FLOAT_TO_FIXED(((polyvertex_t *)gr_curline->v1)->y));
|
FLOAT_TO_FIXED(((polyvertex_t *)gr_curline->pv1)->y));
|
||||||
M_AddToBox(segbbox,
|
M_AddToBox(segbbox,
|
||||||
FLOAT_TO_FIXED(((polyvertex_t *)gr_curline->v2)->x),
|
FLOAT_TO_FIXED(((polyvertex_t *)gr_curline->pv2)->x),
|
||||||
FLOAT_TO_FIXED(((polyvertex_t *)gr_curline->v2)->y));
|
FLOAT_TO_FIXED(((polyvertex_t *)gr_curline->pv2)->y));
|
||||||
|
|
||||||
splat = (wallsplat_t *)gr_curline->linedef->splats;
|
splat = (wallsplat_t *)gr_curline->linedef->splats;
|
||||||
for (; splat; splat = splat->next)
|
for (; splat; splat = splat->next)
|
||||||
|
@ -1039,6 +1041,7 @@ static void HWR_ProjectWall(wallVert3D * wallVerts,
|
||||||
// (in fact a clipping plane that has a constant, so can clip with simple 2d)
|
// (in fact a clipping plane that has a constant, so can clip with simple 2d)
|
||||||
// with the wall segment
|
// with the wall segment
|
||||||
//
|
//
|
||||||
|
#ifndef NEWCLIP
|
||||||
static float HWR_ClipViewSegment(INT32 x, polyvertex_t *v1, polyvertex_t *v2)
|
static float HWR_ClipViewSegment(INT32 x, polyvertex_t *v1, polyvertex_t *v2)
|
||||||
{
|
{
|
||||||
float num, den;
|
float num, den;
|
||||||
|
@ -1067,6 +1070,7 @@ static float HWR_ClipViewSegment(INT32 x, polyvertex_t *v1, polyvertex_t *v2)
|
||||||
|
|
||||||
return num / den;
|
return num / den;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
//
|
//
|
||||||
// HWR_SplitWall
|
// HWR_SplitWall
|
||||||
|
@ -1342,7 +1346,11 @@ static void HWR_DrawSkyWall(wallVert3D *wallVerts, FSurfaceInfo *Surf, fixed_t b
|
||||||
// Anything between means the wall segment has been clipped with solidsegs,
|
// Anything between means the wall segment has been clipped with solidsegs,
|
||||||
// reducing wall overdraw to a minimum
|
// reducing wall overdraw to a minimum
|
||||||
//
|
//
|
||||||
|
#ifdef NEWCLIP
|
||||||
|
static void HWR_ProcessSeg(void) // Sort of like GLWall::Process in GZDoom
|
||||||
|
#else
|
||||||
static void HWR_StoreWallRange(double startfrac, double endfrac)
|
static void HWR_StoreWallRange(double startfrac, double endfrac)
|
||||||
|
#endif
|
||||||
{
|
{
|
||||||
wallVert3D wallVerts[4];
|
wallVert3D wallVerts[4];
|
||||||
v2d_t vs, ve; // start, end vertices of 2d line (view from above)
|
v2d_t vs, ve; // start, end vertices of 2d line (view from above)
|
||||||
|
@ -1367,16 +1375,18 @@ static void HWR_StoreWallRange(double startfrac, double endfrac)
|
||||||
extracolormap_t *colormap;
|
extracolormap_t *colormap;
|
||||||
FSurfaceInfo Surf;
|
FSurfaceInfo Surf;
|
||||||
|
|
||||||
|
#ifndef NEWCLIP
|
||||||
if (startfrac > endfrac)
|
if (startfrac > endfrac)
|
||||||
return;
|
return;
|
||||||
|
#endif
|
||||||
|
|
||||||
gr_sidedef = gr_curline->sidedef;
|
gr_sidedef = gr_curline->sidedef;
|
||||||
gr_linedef = gr_curline->linedef;
|
gr_linedef = gr_curline->linedef;
|
||||||
|
|
||||||
vs.x = ((polyvertex_t *)gr_curline->v1)->x;
|
vs.x = ((polyvertex_t *)gr_curline->pv1)->x;
|
||||||
vs.y = ((polyvertex_t *)gr_curline->v1)->y;
|
vs.y = ((polyvertex_t *)gr_curline->pv1)->y;
|
||||||
ve.x = ((polyvertex_t *)gr_curline->v2)->x;
|
ve.x = ((polyvertex_t *)gr_curline->pv2)->x;
|
||||||
ve.y = ((polyvertex_t *)gr_curline->v2)->y;
|
ve.y = ((polyvertex_t *)gr_curline->pv2)->y;
|
||||||
|
|
||||||
#ifdef ESLOPE
|
#ifdef ESLOPE
|
||||||
v1x = FLOAT_TO_FIXED(vs.x);
|
v1x = FLOAT_TO_FIXED(vs.x);
|
||||||
|
@ -1384,44 +1394,21 @@ static void HWR_StoreWallRange(double startfrac, double endfrac)
|
||||||
v2x = FLOAT_TO_FIXED(ve.x);
|
v2x = FLOAT_TO_FIXED(ve.x);
|
||||||
v2y = FLOAT_TO_FIXED(ve.y);
|
v2y = FLOAT_TO_FIXED(ve.y);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (gr_frontsector->heightsec != -1)
|
|
||||||
{
|
|
||||||
#ifdef ESLOPE
|
#ifdef ESLOPE
|
||||||
worldtop = worldtopslope = sectors[gr_frontsector->heightsec].ceilingheight;
|
|
||||||
worldbottom = worldbottomslope = sectors[gr_frontsector->heightsec].floorheight;
|
|
||||||
#else
|
|
||||||
worldtop = sectors[gr_frontsector->heightsec].ceilingheight;
|
|
||||||
worldbottom = sectors[gr_frontsector->heightsec].floorheight;
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
#ifdef ESLOPE
|
|
||||||
if (gr_frontsector->c_slope)
|
|
||||||
{
|
|
||||||
worldtop = P_GetZAt(gr_frontsector->c_slope, v1x, v1y);
|
|
||||||
worldtopslope = P_GetZAt(gr_frontsector->c_slope, v2x, v2y);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
worldtop = worldtopslope = gr_frontsector->ceilingheight;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (gr_frontsector->f_slope)
|
#define SLOPEPARAMS(slope, end1, end2, normalheight) \
|
||||||
{
|
if (slope) { \
|
||||||
worldbottom = P_GetZAt(gr_frontsector->f_slope, v1x, v1y);
|
end1 = P_GetZAt(slope, v1x, v1y); \
|
||||||
worldbottomslope = P_GetZAt(gr_frontsector->f_slope, v2x, v2y);
|
end2 = P_GetZAt(slope, v2x, v2y); \
|
||||||
}
|
} else \
|
||||||
else
|
end1 = end2 = normalheight;
|
||||||
{
|
|
||||||
worldbottom = worldbottomslope = gr_frontsector->floorheight;
|
SLOPEPARAMS(gr_frontsector->c_slope, worldtop, worldtopslope, gr_frontsector->ceilingheight)
|
||||||
}
|
SLOPEPARAMS(gr_frontsector->f_slope, worldbottom, worldbottomslope, gr_frontsector->floorheight)
|
||||||
#else
|
#else
|
||||||
worldtop = gr_frontsector->ceilingheight;
|
worldtop = gr_frontsector->ceilingheight;
|
||||||
worldbottom = gr_frontsector->floorheight;
|
worldbottom = gr_frontsector->floorheight;
|
||||||
#endif
|
#endif
|
||||||
}
|
|
||||||
|
|
||||||
// remember vertices ordering
|
// remember vertices ordering
|
||||||
// 3--2
|
// 3--2
|
||||||
|
@ -1436,20 +1423,23 @@ static void HWR_StoreWallRange(double startfrac, double endfrac)
|
||||||
wallVerts[2].z = wallVerts[1].z = ve.y;
|
wallVerts[2].z = wallVerts[1].z = ve.y;
|
||||||
wallVerts[0].w = wallVerts[1].w = wallVerts[2].w = wallVerts[3].w = 1.0f;
|
wallVerts[0].w = wallVerts[1].w = wallVerts[2].w = wallVerts[3].w = 1.0f;
|
||||||
|
|
||||||
if (drawtextured)
|
|
||||||
{
|
{
|
||||||
// x offset the texture
|
// x offset the texture
|
||||||
fixed_t texturehpeg = gr_sidedef->textureoffset + gr_curline->offset;
|
fixed_t texturehpeg = gr_sidedef->textureoffset + gr_curline->offset;
|
||||||
|
|
||||||
|
#ifndef NEWCLIP
|
||||||
// clip texture s start/end coords with solidsegs
|
// clip texture s start/end coords with solidsegs
|
||||||
if (startfrac > 0.0f && startfrac < 1.0f)
|
if (startfrac > 0.0f && startfrac < 1.0f)
|
||||||
cliplow = (float)(texturehpeg + (gr_curline->flength*FRACUNIT) * startfrac);
|
cliplow = (float)(texturehpeg + (gr_curline->flength*FRACUNIT) * startfrac);
|
||||||
else
|
else
|
||||||
|
#endif
|
||||||
cliplow = (float)texturehpeg;
|
cliplow = (float)texturehpeg;
|
||||||
|
|
||||||
|
#ifndef NEWCLIP
|
||||||
if (endfrac > 0.0f && endfrac < 1.0f)
|
if (endfrac > 0.0f && endfrac < 1.0f)
|
||||||
cliphigh = (float)(texturehpeg + (gr_curline->flength*FRACUNIT) * endfrac);
|
cliphigh = (float)(texturehpeg + (gr_curline->flength*FRACUNIT) * endfrac);
|
||||||
else
|
else
|
||||||
|
#endif
|
||||||
cliphigh = (float)(texturehpeg + (gr_curline->flength*FRACUNIT));
|
cliphigh = (float)(texturehpeg + (gr_curline->flength*FRACUNIT));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1465,43 +1455,15 @@ static void HWR_StoreWallRange(double startfrac, double endfrac)
|
||||||
{
|
{
|
||||||
INT32 gr_toptexture, gr_bottomtexture;
|
INT32 gr_toptexture, gr_bottomtexture;
|
||||||
// two sided line
|
// two sided line
|
||||||
if (gr_backsector->heightsec != -1)
|
|
||||||
{
|
|
||||||
#ifdef ESLOPE
|
|
||||||
worldhigh = worldhighslope = sectors[gr_backsector->heightsec].ceilingheight;
|
|
||||||
worldlow = worldlowslope = sectors[gr_backsector->heightsec].floorheight;
|
|
||||||
#else
|
|
||||||
worldhigh = sectors[gr_backsector->heightsec].ceilingheight;
|
|
||||||
worldlow = sectors[gr_backsector->heightsec].floorheight;
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
#ifdef ESLOPE
|
|
||||||
if (gr_backsector->c_slope)
|
|
||||||
{
|
|
||||||
worldhigh = P_GetZAt(gr_backsector->c_slope, v1x, v1y);
|
|
||||||
worldhighslope = P_GetZAt(gr_backsector->c_slope, v2x, v2y);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
worldhigh = worldhighslope = gr_backsector->ceilingheight;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (gr_backsector->f_slope)
|
#ifdef ESLOPE
|
||||||
{
|
SLOPEPARAMS(gr_backsector->c_slope, worldhigh, worldhighslope, gr_backsector->ceilingheight)
|
||||||
worldlow = P_GetZAt(gr_backsector->f_slope, v1x, v1y);
|
SLOPEPARAMS(gr_backsector->f_slope, worldlow, worldlowslope, gr_backsector->floorheight)
|
||||||
worldlowslope = P_GetZAt(gr_backsector->f_slope, v2x, v2y);
|
#undef SLOPEPARAMS
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
worldlow = worldlowslope = gr_backsector->floorheight;
|
|
||||||
}
|
|
||||||
#else
|
#else
|
||||||
worldhigh = gr_backsector->ceilingheight;
|
worldhigh = gr_backsector->ceilingheight;
|
||||||
worldlow = gr_backsector->floorheight;
|
worldlow = gr_backsector->floorheight;
|
||||||
#endif
|
#endif
|
||||||
}
|
|
||||||
|
|
||||||
// hack to allow height changes in outdoor areas
|
// hack to allow height changes in outdoor areas
|
||||||
// This is what gets rid of the upper textures if there should be sky
|
// This is what gets rid of the upper textures if there should be sky
|
||||||
|
@ -1525,7 +1487,6 @@ static void HWR_StoreWallRange(double startfrac, double endfrac)
|
||||||
worldhigh < worldtop
|
worldhigh < worldtop
|
||||||
) && gr_toptexture)
|
) && gr_toptexture)
|
||||||
{
|
{
|
||||||
if (drawtextured)
|
|
||||||
{
|
{
|
||||||
fixed_t texturevpegtop; // top
|
fixed_t texturevpegtop; // top
|
||||||
|
|
||||||
|
@ -1606,7 +1567,6 @@ static void HWR_StoreWallRange(double startfrac, double endfrac)
|
||||||
#endif
|
#endif
|
||||||
worldlow > worldbottom) && gr_bottomtexture) //only if VISIBLE!!!
|
worldlow > worldbottom) && gr_bottomtexture) //only if VISIBLE!!!
|
||||||
{
|
{
|
||||||
if (drawtextured)
|
|
||||||
{
|
{
|
||||||
fixed_t texturevpegbottom = 0; // bottom
|
fixed_t texturevpegbottom = 0; // bottom
|
||||||
|
|
||||||
|
@ -1798,7 +1758,6 @@ static void HWR_StoreWallRange(double startfrac, double endfrac)
|
||||||
h = min(highcut, polytop);
|
h = min(highcut, polytop);
|
||||||
l = max(polybottom, lowcut);
|
l = max(polybottom, lowcut);
|
||||||
|
|
||||||
if (drawtextured)
|
|
||||||
{
|
{
|
||||||
// PEGGING
|
// PEGGING
|
||||||
#ifdef ESLOPE
|
#ifdef ESLOPE
|
||||||
|
@ -1854,7 +1813,6 @@ static void HWR_StoreWallRange(double startfrac, double endfrac)
|
||||||
h = min(highcut, polytop);
|
h = min(highcut, polytop);
|
||||||
l = max(polybottom, lowcut);
|
l = max(polybottom, lowcut);
|
||||||
|
|
||||||
if (drawtextured)
|
|
||||||
{
|
{
|
||||||
// PEGGING
|
// PEGGING
|
||||||
if (!!(gr_linedef->flags & ML_DONTPEGBOTTOM) ^ !!(gr_linedef->flags & ML_EFFECT3))
|
if (!!(gr_linedef->flags & ML_DONTPEGBOTTOM) ^ !!(gr_linedef->flags & ML_EFFECT3))
|
||||||
|
@ -2046,7 +2004,6 @@ static void HWR_StoreWallRange(double startfrac, double endfrac)
|
||||||
if (gr_midtexture
|
if (gr_midtexture
|
||||||
&& gr_linedef->special != 41) // Ignore horizon line for OGL
|
&& gr_linedef->special != 41) // Ignore horizon line for OGL
|
||||||
{
|
{
|
||||||
if (drawtextured)
|
|
||||||
{
|
{
|
||||||
fixed_t texturevpeg;
|
fixed_t texturevpeg;
|
||||||
// PEGGING
|
// PEGGING
|
||||||
|
@ -2187,7 +2144,7 @@ static void HWR_StoreWallRange(double startfrac, double endfrac)
|
||||||
wallVerts[0].s = wallVerts[3].s = 0;
|
wallVerts[0].s = wallVerts[3].s = 0;
|
||||||
wallVerts[2].s = wallVerts[1].s = 0;
|
wallVerts[2].s = wallVerts[1].s = 0;
|
||||||
}
|
}
|
||||||
else if (drawtextured)
|
else
|
||||||
{
|
{
|
||||||
fixed_t texturevpeg;
|
fixed_t texturevpeg;
|
||||||
boolean attachtobottom = false;
|
boolean attachtobottom = false;
|
||||||
|
@ -2353,7 +2310,7 @@ static void HWR_StoreWallRange(double startfrac, double endfrac)
|
||||||
wallVerts[0].s = wallVerts[3].s = 0;
|
wallVerts[0].s = wallVerts[3].s = 0;
|
||||||
wallVerts[2].s = wallVerts[1].s = 0;
|
wallVerts[2].s = wallVerts[1].s = 0;
|
||||||
}
|
}
|
||||||
else if (drawtextured)
|
else
|
||||||
{
|
{
|
||||||
grTex = HWR_GetTexture(texnum);
|
grTex = HWR_GetTexture(texnum);
|
||||||
|
|
||||||
|
@ -2422,6 +2379,110 @@ static void HWR_StoreWallRange(double startfrac, double endfrac)
|
||||||
//Hurdler: end of 3d-floors test
|
//Hurdler: end of 3d-floors test
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// From PrBoom:
|
||||||
|
//
|
||||||
|
// e6y: Check whether the player can look beyond this line
|
||||||
|
//
|
||||||
|
#ifdef NEWCLIP
|
||||||
|
boolean checkforemptylines = true;
|
||||||
|
// Don't modify anything here, just check
|
||||||
|
// Kalaron: Modified for sloped linedefs
|
||||||
|
static boolean CheckClip(seg_t * seg, sector_t * afrontsector, sector_t * abacksector)
|
||||||
|
{
|
||||||
|
fixed_t frontf1,frontf2, frontc1, frontc2; // front floor/ceiling ends
|
||||||
|
fixed_t backf1, backf2, backc1, backc2; // back floor ceiling ends
|
||||||
|
|
||||||
|
// GZDoom method of sloped line clipping
|
||||||
|
|
||||||
|
#ifdef ESLOPE
|
||||||
|
if (afrontsector->f_slope || afrontsector->c_slope || abacksector->f_slope || abacksector->c_slope)
|
||||||
|
{
|
||||||
|
fixed_t v1x, v1y, v2x, v2y; // the seg's vertexes as fixed_t
|
||||||
|
v1x = FLOAT_TO_FIXED(((polyvertex_t *)gr_curline->pv1)->x);
|
||||||
|
v1y = FLOAT_TO_FIXED(((polyvertex_t *)gr_curline->pv1)->y);
|
||||||
|
v2x = FLOAT_TO_FIXED(((polyvertex_t *)gr_curline->pv2)->x);
|
||||||
|
v2y = FLOAT_TO_FIXED(((polyvertex_t *)gr_curline->pv2)->y);
|
||||||
|
#define SLOPEPARAMS(slope, end1, end2, normalheight) \
|
||||||
|
if (slope) { \
|
||||||
|
end1 = P_GetZAt(slope, v1x, v1y); \
|
||||||
|
end2 = P_GetZAt(slope, v2x, v2y); \
|
||||||
|
} else \
|
||||||
|
end1 = end2 = normalheight;
|
||||||
|
|
||||||
|
SLOPEPARAMS(afrontsector->f_slope, frontf1, frontf2, afrontsector->floorheight)
|
||||||
|
SLOPEPARAMS(afrontsector->c_slope, frontc1, frontc2, afrontsector->ceilingheight)
|
||||||
|
SLOPEPARAMS( abacksector->f_slope, backf1, backf2, abacksector->floorheight)
|
||||||
|
SLOPEPARAMS( abacksector->c_slope, backc1, backc2, abacksector->ceilingheight)
|
||||||
|
#undef SLOPEPARAMS
|
||||||
|
}
|
||||||
|
else
|
||||||
|
#endif
|
||||||
|
{
|
||||||
|
frontf1 = frontf2 = afrontsector->floorheight;
|
||||||
|
frontc1 = frontc2 = afrontsector->ceilingheight;
|
||||||
|
backf1 = backf2 = abacksector->floorheight;
|
||||||
|
backc1 = backc2 = abacksector->ceilingheight;
|
||||||
|
}
|
||||||
|
|
||||||
|
// now check for closed sectors!
|
||||||
|
if (backc1 <= frontf1 && backc2 <= frontf2)
|
||||||
|
{
|
||||||
|
checkforemptylines = false;
|
||||||
|
if (!seg->sidedef->toptexture)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
if (abacksector->ceilingpic == skyflatnum && afrontsector->ceilingpic == skyflatnum)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (backf1 >= frontc1 && backf2 >= frontc2)
|
||||||
|
{
|
||||||
|
checkforemptylines = false;
|
||||||
|
if (!seg->sidedef->bottomtexture)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
// properly render skies (consider door "open" if both floors are sky):
|
||||||
|
if (abacksector->ceilingpic == skyflatnum && afrontsector->ceilingpic == skyflatnum)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (backc1 <= backf1 && backc2 <= backf2)
|
||||||
|
{
|
||||||
|
checkforemptylines = false;
|
||||||
|
// preserve a kind of transparent door/lift special effect:
|
||||||
|
if (backc1 < frontc1 || backc2 < frontc2)
|
||||||
|
{
|
||||||
|
if (!seg->sidedef->toptexture)
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if (backf1 > frontf1 || backf2 > frontf2)
|
||||||
|
{
|
||||||
|
if (!seg->sidedef->bottomtexture)
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if (abacksector->ceilingpic == skyflatnum && afrontsector->ceilingpic == skyflatnum)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
if (abacksector->floorpic == skyflatnum && afrontsector->floorpic == skyflatnum)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (backc1 != frontc1 || backc2 != frontc2
|
||||||
|
|| backf1 != frontf1 || backf2 != frontf2)
|
||||||
|
{
|
||||||
|
checkforemptylines = false;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
#else
|
||||||
//Hurdler: just like in r_bsp.c
|
//Hurdler: just like in r_bsp.c
|
||||||
#if 1
|
#if 1
|
||||||
#define MAXSEGS MAXVIDWIDTH/2+1
|
#define MAXSEGS MAXVIDWIDTH/2+1
|
||||||
|
@ -2493,7 +2554,7 @@ static void HWR_ClipSolidWallSegment(INT32 first, INT32 last)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
highfrac = HWR_ClipViewSegment(start->first+1, (polyvertex_t *)gr_curline->v1, (polyvertex_t *)gr_curline->v2);
|
highfrac = HWR_ClipViewSegment(start->first+1, (polyvertex_t *)gr_curline->pv1, (polyvertex_t *)gr_curline->pv2);
|
||||||
HWR_StoreWallRange(0, highfrac);
|
HWR_StoreWallRange(0, highfrac);
|
||||||
}
|
}
|
||||||
// Now adjust the clip size.
|
// Now adjust the clip size.
|
||||||
|
@ -2517,8 +2578,8 @@ static void HWR_ClipSolidWallSegment(INT32 first, INT32 last)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
lowfrac = HWR_ClipViewSegment(next->last-1, (polyvertex_t *)gr_curline->v1, (polyvertex_t *)gr_curline->v2);
|
lowfrac = HWR_ClipViewSegment(next->last-1, (polyvertex_t *)gr_curline->pv1, (polyvertex_t *)gr_curline->pv2);
|
||||||
highfrac = HWR_ClipViewSegment((next+1)->first+1, (polyvertex_t *)gr_curline->v1, (polyvertex_t *)gr_curline->v2);
|
highfrac = HWR_ClipViewSegment((next+1)->first+1, (polyvertex_t *)gr_curline->pv1, (polyvertex_t *)gr_curline->pv2);
|
||||||
HWR_StoreWallRange(lowfrac, highfrac);
|
HWR_StoreWallRange(lowfrac, highfrac);
|
||||||
}
|
}
|
||||||
next++;
|
next++;
|
||||||
|
@ -2552,7 +2613,7 @@ static void HWR_ClipSolidWallSegment(INT32 first, INT32 last)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
lowfrac = HWR_ClipViewSegment(next->last-1, (polyvertex_t *)gr_curline->v1, (polyvertex_t *)gr_curline->v2);
|
lowfrac = HWR_ClipViewSegment(next->last-1, (polyvertex_t *)gr_curline->pv1, (polyvertex_t *)gr_curline->pv2);
|
||||||
HWR_StoreWallRange(lowfrac, 1);
|
HWR_StoreWallRange(lowfrac, 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2615,8 +2676,8 @@ static void HWR_ClipPassWallSegment(INT32 first, INT32 last)
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
highfrac = HWR_ClipViewSegment(min(start->first + 1,
|
highfrac = HWR_ClipViewSegment(min(start->first + 1,
|
||||||
start->last), (polyvertex_t *)gr_curline->v1,
|
start->last), (polyvertex_t *)gr_curline->pv1,
|
||||||
(polyvertex_t *)gr_curline->v2);
|
(polyvertex_t *)gr_curline->pv2);
|
||||||
HWR_StoreWallRange(0, highfrac);
|
HWR_StoreWallRange(0, highfrac);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2635,8 +2696,8 @@ static void HWR_ClipPassWallSegment(INT32 first, INT32 last)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
lowfrac = HWR_ClipViewSegment(max(start->last-1,start->first), (polyvertex_t *)gr_curline->v1, (polyvertex_t *)gr_curline->v2);
|
lowfrac = HWR_ClipViewSegment(max(start->last-1,start->first), (polyvertex_t *)gr_curline->pv1, (polyvertex_t *)gr_curline->pv2);
|
||||||
highfrac = HWR_ClipViewSegment(min((start+1)->first+1,(start+1)->last), (polyvertex_t *)gr_curline->v1, (polyvertex_t *)gr_curline->v2);
|
highfrac = HWR_ClipViewSegment(min((start+1)->first+1,(start+1)->last), (polyvertex_t *)gr_curline->pv1, (polyvertex_t *)gr_curline->pv2);
|
||||||
HWR_StoreWallRange(lowfrac, highfrac);
|
HWR_StoreWallRange(lowfrac, highfrac);
|
||||||
}
|
}
|
||||||
start++;
|
start++;
|
||||||
|
@ -2666,8 +2727,8 @@ static void HWR_ClipPassWallSegment(INT32 first, INT32 last)
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
lowfrac = HWR_ClipViewSegment(max(start->last - 1,
|
lowfrac = HWR_ClipViewSegment(max(start->last - 1,
|
||||||
start->first), (polyvertex_t *)gr_curline->v1,
|
start->first), (polyvertex_t *)gr_curline->pv1,
|
||||||
(polyvertex_t *)gr_curline->v2);
|
(polyvertex_t *)gr_curline->pv2);
|
||||||
HWR_StoreWallRange(lowfrac, 1);
|
HWR_StoreWallRange(lowfrac, 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2707,6 +2768,7 @@ static void HWR_ClearClipSegs(void)
|
||||||
gr_solidsegs[1].last = 0x7fffffff;
|
gr_solidsegs[1].last = 0x7fffffff;
|
||||||
hw_newend = gr_solidsegs+2;
|
hw_newend = gr_solidsegs+2;
|
||||||
}
|
}
|
||||||
|
#endif // NEWCLIP
|
||||||
|
|
||||||
// -----------------+
|
// -----------------+
|
||||||
// HWR_AddLine : Clips the given segment and adds any visible pieces to the line list.
|
// HWR_AddLine : Clips the given segment and adds any visible pieces to the line list.
|
||||||
|
@ -2715,24 +2777,46 @@ static void HWR_ClearClipSegs(void)
|
||||||
// -----------------+
|
// -----------------+
|
||||||
static void HWR_AddLine(seg_t * line)
|
static void HWR_AddLine(seg_t * line)
|
||||||
{
|
{
|
||||||
INT32 x1, x2;
|
|
||||||
angle_t angle1, angle2;
|
angle_t angle1, angle2;
|
||||||
|
#ifndef NEWCLIP
|
||||||
|
INT32 x1, x2;
|
||||||
angle_t span, tspan;
|
angle_t span, tspan;
|
||||||
|
#endif
|
||||||
|
|
||||||
// SoM: Backsector needs to be run through R_FakeFlat
|
// SoM: Backsector needs to be run through R_FakeFlat
|
||||||
static sector_t tempsec;
|
static sector_t tempsec;
|
||||||
|
|
||||||
|
fixed_t v1x, v1y, v2x, v2y; // the seg's vertexes as fixed_t
|
||||||
|
#ifdef POLYOBJECTS
|
||||||
if (line->polyseg && !(line->polyseg->flags & POF_RENDERSIDES))
|
if (line->polyseg && !(line->polyseg->flags & POF_RENDERSIDES))
|
||||||
return;
|
return;
|
||||||
|
#endif
|
||||||
|
|
||||||
gr_curline = line;
|
gr_curline = line;
|
||||||
|
|
||||||
// OPTIMIZE: quickly reject orthogonal back sides.
|
v1x = FLOAT_TO_FIXED(((polyvertex_t *)gr_curline->pv1)->x);
|
||||||
angle1 = R_PointToAngle(FLOAT_TO_FIXED(((polyvertex_t *)gr_curline->v1)->x),
|
v1y = FLOAT_TO_FIXED(((polyvertex_t *)gr_curline->pv1)->y);
|
||||||
FLOAT_TO_FIXED(((polyvertex_t *)gr_curline->v1)->y));
|
v2x = FLOAT_TO_FIXED(((polyvertex_t *)gr_curline->pv2)->x);
|
||||||
angle2 = R_PointToAngle(FLOAT_TO_FIXED(((polyvertex_t *)gr_curline->v2)->x),
|
v2y = FLOAT_TO_FIXED(((polyvertex_t *)gr_curline->pv2)->y);
|
||||||
FLOAT_TO_FIXED(((polyvertex_t *)gr_curline->v2)->y));
|
|
||||||
|
|
||||||
|
// OPTIMIZE: quickly reject orthogonal back sides.
|
||||||
|
angle1 = R_PointToAngle(v1x, v1y);
|
||||||
|
angle2 = R_PointToAngle(v2x, v2y);
|
||||||
|
|
||||||
|
#ifdef NEWCLIP
|
||||||
|
// PrBoom: Back side, i.e. backface culling - read: endAngle >= startAngle!
|
||||||
|
if (angle2 - angle1 < ANGLE_180)
|
||||||
|
return;
|
||||||
|
|
||||||
|
// PrBoom: use REAL clipping math YAYYYYYYY!!!
|
||||||
|
|
||||||
|
if (!gld_clipper_SafeCheckRange(angle2, angle1))
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
checkforemptylines = true;
|
||||||
|
#else
|
||||||
// Clip to view edges.
|
// Clip to view edges.
|
||||||
span = angle1 - angle2;
|
span = angle1 - angle2;
|
||||||
|
|
||||||
|
@ -2773,8 +2857,8 @@ static void HWR_AddLine(seg_t * line)
|
||||||
float fx1,fx2,fy1,fy2;
|
float fx1,fx2,fy1,fy2;
|
||||||
//BP: test with a better projection than viewangletox[R_PointToAngle(angle)]
|
//BP: test with a better projection than viewangletox[R_PointToAngle(angle)]
|
||||||
// do not enable this at release 4 mul and 2 div
|
// do not enable this at release 4 mul and 2 div
|
||||||
fx1 = ((polyvertex_t *)(line->v1))->x-gr_viewx;
|
fx1 = ((polyvertex_t *)(line->pv1))->x-gr_viewx;
|
||||||
fy1 = ((polyvertex_t *)(line->v1))->y-gr_viewy;
|
fy1 = ((polyvertex_t *)(line->pv1))->y-gr_viewy;
|
||||||
fy2 = (fx1 * gr_viewcos + fy1 * gr_viewsin);
|
fy2 = (fx1 * gr_viewcos + fy1 * gr_viewsin);
|
||||||
if (fy2 < 0)
|
if (fy2 < 0)
|
||||||
// the point is back
|
// the point is back
|
||||||
|
@ -2782,8 +2866,8 @@ static void HWR_AddLine(seg_t * line)
|
||||||
else
|
else
|
||||||
fx1 = gr_windowcenterx + (fx1 * gr_viewsin - fy1 * gr_viewcos) * gr_centerx / fy2;
|
fx1 = gr_windowcenterx + (fx1 * gr_viewsin - fy1 * gr_viewcos) * gr_centerx / fy2;
|
||||||
|
|
||||||
fx2 = ((polyvertex_t *)(line->v2))->x-gr_viewx;
|
fx2 = ((polyvertex_t *)(line->pv2))->x-gr_viewx;
|
||||||
fy2 = ((polyvertex_t *)(line->v2))->y-gr_viewy;
|
fy2 = ((polyvertex_t *)(line->pv2))->y-gr_viewy;
|
||||||
fy1 = (fx2 * gr_viewcos + fy2 * gr_viewsin);
|
fy1 = (fx2 * gr_viewcos + fy2 * gr_viewsin);
|
||||||
if (fy1 < 0)
|
if (fy1 < 0)
|
||||||
// the point is back
|
// the point is back
|
||||||
|
@ -2811,8 +2895,34 @@ static void HWR_AddLine(seg_t * line)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
|
#endif
|
||||||
|
|
||||||
gr_backsector = line->backsector;
|
gr_backsector = line->backsector;
|
||||||
|
|
||||||
|
#ifdef NEWCLIP
|
||||||
|
if (!line->backsector)
|
||||||
|
{
|
||||||
|
gld_clipper_SafeAddClipRange(angle2, angle1);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
gr_backsector = R_FakeFlat(gr_backsector, &tempsec, NULL, NULL, true);
|
||||||
|
if (CheckClip(line, gr_frontsector, gr_backsector))
|
||||||
|
{
|
||||||
|
gld_clipper_SafeAddClipRange(angle2, angle1);
|
||||||
|
checkforemptylines = false;
|
||||||
|
}
|
||||||
|
// Reject empty lines used for triggers and special events.
|
||||||
|
// Identical floor and ceiling on both sides,
|
||||||
|
// identical light levels on both sides,
|
||||||
|
// and no middle texture.
|
||||||
|
if (checkforemptylines && R_IsEmptyLine(line, gr_frontsector, gr_backsector))
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
HWR_ProcessSeg(); // Doesn't need arguments because they're defined globally :D
|
||||||
|
return;
|
||||||
|
#else
|
||||||
// Single sided line?
|
// Single sided line?
|
||||||
if (!gr_backsector)
|
if (!gr_backsector)
|
||||||
goto clipsolid;
|
goto clipsolid;
|
||||||
|
@ -2822,14 +2932,9 @@ static void HWR_AddLine(seg_t * line)
|
||||||
#ifdef ESLOPE
|
#ifdef ESLOPE
|
||||||
if (gr_frontsector->f_slope || gr_frontsector->c_slope || gr_backsector->f_slope || gr_backsector->c_slope)
|
if (gr_frontsector->f_slope || gr_frontsector->c_slope || gr_backsector->f_slope || gr_backsector->c_slope)
|
||||||
{
|
{
|
||||||
fixed_t v1x, v1y, v2x, v2y; // the seg's vertexes as fixed_t
|
|
||||||
fixed_t frontf1,frontf2, frontc1, frontc2; // front floor/ceiling ends
|
fixed_t frontf1,frontf2, frontc1, frontc2; // front floor/ceiling ends
|
||||||
fixed_t backf1, backf2, backc1, backc2; // back floor ceiling ends
|
fixed_t backf1, backf2, backc1, backc2; // back floor ceiling ends
|
||||||
|
|
||||||
v1x = FLOAT_TO_FIXED(((polyvertex_t *)gr_curline->v1)->x);
|
|
||||||
v1y = FLOAT_TO_FIXED(((polyvertex_t *)gr_curline->v1)->y);
|
|
||||||
v2x = FLOAT_TO_FIXED(((polyvertex_t *)gr_curline->v2)->x);
|
|
||||||
v2y = FLOAT_TO_FIXED(((polyvertex_t *)gr_curline->v2)->y);
|
|
||||||
#define SLOPEPARAMS(slope, end1, end2, normalheight) \
|
#define SLOPEPARAMS(slope, end1, end2, normalheight) \
|
||||||
if (slope) { \
|
if (slope) { \
|
||||||
end1 = P_GetZAt(slope, v1x, v1y); \
|
end1 = P_GetZAt(slope, v1x, v1y); \
|
||||||
|
@ -2853,6 +2958,13 @@ static void HWR_AddLine(seg_t * line)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Check for automap fix.
|
||||||
|
if (backc1 <= backf1 && backc2 <= backf2
|
||||||
|
&& ((backc1 >= frontc1 && backc2 >= frontc2) || gr_curline->sidedef->toptexture)
|
||||||
|
&& ((backf1 <= frontf1 && backf2 >= frontf2) || gr_curline->sidedef->bottomtexture)
|
||||||
|
&& (gr_backsector->ceilingpic != skyflatnum || gr_frontsector->ceilingpic != skyflatnum))
|
||||||
|
goto clipsolid;
|
||||||
|
|
||||||
// Window.
|
// Window.
|
||||||
if (backc1 != frontc1 || backc2 != frontc2
|
if (backc1 != frontc1 || backc2 != frontc2
|
||||||
|| backf1 != frontf1 || backf2 != frontf2)
|
|| backf1 != frontf1 || backf2 != frontf2)
|
||||||
|
@ -2871,6 +2983,13 @@ static void HWR_AddLine(seg_t * line)
|
||||||
goto clipsolid;
|
goto clipsolid;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Check for automap fix.
|
||||||
|
if (gr_backsector->ceilingheight <= gr_backsector->floorheight
|
||||||
|
&& ((gr_backsector->ceilingheight >= gr_frontsector->ceilingheight) || gr_curline->sidedef->toptexture)
|
||||||
|
&& ((gr_backsector->floorheight <= gr_backsector->floorheight) || gr_curline->sidedef->bottomtexture)
|
||||||
|
&& (gr_backsector->ceilingpic != skyflatnum || gr_frontsector->ceilingpic != skyflatnum))
|
||||||
|
goto clipsolid;
|
||||||
|
|
||||||
// Window.
|
// Window.
|
||||||
if (gr_backsector->ceilingheight != gr_frontsector->ceilingheight ||
|
if (gr_backsector->ceilingheight != gr_frontsector->ceilingheight ||
|
||||||
gr_backsector->floorheight != gr_frontsector->floorheight)
|
gr_backsector->floorheight != gr_frontsector->floorheight)
|
||||||
|
@ -2881,25 +3000,8 @@ static void HWR_AddLine(seg_t * line)
|
||||||
// Identical floor and ceiling on both sides,
|
// Identical floor and ceiling on both sides,
|
||||||
// identical light levels on both sides,
|
// identical light levels on both sides,
|
||||||
// and no middle texture.
|
// and no middle texture.
|
||||||
if (
|
if (R_IsEmptyLine(gr_curline, gr_frontsector, gr_backsector))
|
||||||
#ifdef POLYOBJECTS
|
|
||||||
!line->polyseg &&
|
|
||||||
#endif
|
|
||||||
gr_backsector->ceilingpic == gr_frontsector->ceilingpic
|
|
||||||
&& gr_backsector->floorpic == gr_frontsector->floorpic
|
|
||||||
#ifdef ESLOPE
|
|
||||||
&& gr_backsector->f_slope == gr_frontsector->f_slope
|
|
||||||
&& gr_backsector->c_slope == gr_frontsector->c_slope
|
|
||||||
#endif
|
|
||||||
&& gr_backsector->lightlevel == gr_frontsector->lightlevel
|
|
||||||
&& gr_curline->sidedef->midtexture == 0
|
|
||||||
&& !gr_backsector->ffloors && !gr_frontsector->ffloors)
|
|
||||||
// SoM: For 3D sides... Boris, would you like to take a
|
|
||||||
// crack at rendering 3D sides? You would need to add the
|
|
||||||
// above check and add code to HWR_StoreWallRange...
|
|
||||||
{
|
|
||||||
return;
|
return;
|
||||||
}
|
|
||||||
|
|
||||||
clippass:
|
clippass:
|
||||||
if (x1 == x2)
|
if (x1 == x2)
|
||||||
|
@ -2911,6 +3013,7 @@ clipsolid:
|
||||||
if (x1 == x2)
|
if (x1 == x2)
|
||||||
goto clippass;
|
goto clippass;
|
||||||
HWR_ClipSolidWallSegment(x1, x2-1);
|
HWR_ClipSolidWallSegment(x1, x2-1);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
// HWR_CheckBBox
|
// HWR_CheckBBox
|
||||||
|
@ -2922,9 +3025,13 @@ clipsolid:
|
||||||
|
|
||||||
static boolean HWR_CheckBBox(fixed_t *bspcoord)
|
static boolean HWR_CheckBBox(fixed_t *bspcoord)
|
||||||
{
|
{
|
||||||
INT32 boxpos, sx1, sx2;
|
INT32 boxpos;
|
||||||
fixed_t px1, py1, px2, py2;
|
fixed_t px1, py1, px2, py2;
|
||||||
angle_t angle1, angle2, span, tspan;
|
angle_t angle1, angle2;
|
||||||
|
#ifndef NEWCLIP
|
||||||
|
INT32 sx1, sx2;
|
||||||
|
angle_t span, tspan;
|
||||||
|
#endif
|
||||||
|
|
||||||
// Find the corners of the box
|
// Find the corners of the box
|
||||||
// that define the edges from current viewpoint.
|
// that define the edges from current viewpoint.
|
||||||
|
@ -2950,6 +3057,11 @@ static boolean HWR_CheckBBox(fixed_t *bspcoord)
|
||||||
px2 = bspcoord[checkcoord[boxpos][2]];
|
px2 = bspcoord[checkcoord[boxpos][2]];
|
||||||
py2 = bspcoord[checkcoord[boxpos][3]];
|
py2 = bspcoord[checkcoord[boxpos][3]];
|
||||||
|
|
||||||
|
#ifdef NEWCLIP
|
||||||
|
angle1 = R_PointToAngle(px1, py1);
|
||||||
|
angle2 = R_PointToAngle(px2, py2);
|
||||||
|
return gld_clipper_SafeCheckRange(angle2, angle1);
|
||||||
|
#else
|
||||||
// check clip list for an open space
|
// check clip list for an open space
|
||||||
angle1 = R_PointToAngle2(dup_viewx>>1, dup_viewy>>1, px1>>1, py1>>1) - dup_viewangle;
|
angle1 = R_PointToAngle2(dup_viewx>>1, dup_viewy>>1, px1>>1, py1>>1) - dup_viewangle;
|
||||||
angle2 = R_PointToAngle2(dup_viewx>>1, dup_viewy>>1, px2>>1, py2>>1) - dup_viewangle;
|
angle2 = R_PointToAngle2(dup_viewx>>1, dup_viewy>>1, px2>>1, py2>>1) - dup_viewangle;
|
||||||
|
@ -2997,6 +3109,7 @@ static boolean HWR_CheckBBox(fixed_t *bspcoord)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
return HWR_ClipToSolidSegs(sx1, sx2 - 1);
|
return HWR_ClipToSolidSegs(sx1, sx2 - 1);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef POLYOBJECTS
|
#ifdef POLYOBJECTS
|
||||||
|
@ -3030,8 +3143,8 @@ static inline void HWR_AddPolyObjectSegs(void)
|
||||||
pv2->x = FIXED_TO_FLOAT(gr_fakeline->v2->x);
|
pv2->x = FIXED_TO_FLOAT(gr_fakeline->v2->x);
|
||||||
pv2->y = FIXED_TO_FLOAT(gr_fakeline->v2->y);
|
pv2->y = FIXED_TO_FLOAT(gr_fakeline->v2->y);
|
||||||
|
|
||||||
gr_fakeline->v1 = (vertex_t *)pv1;
|
gr_fakeline->pv1 = pv1;
|
||||||
gr_fakeline->v2 = (vertex_t *)pv2;
|
gr_fakeline->pv2 = pv2;
|
||||||
|
|
||||||
HWR_AddLine(gr_fakeline);
|
HWR_AddLine(gr_fakeline);
|
||||||
}
|
}
|
||||||
|
@ -5904,7 +6017,19 @@ if (0)
|
||||||
#ifdef SORTING
|
#ifdef SORTING
|
||||||
drawcount = 0;
|
drawcount = 0;
|
||||||
#endif
|
#endif
|
||||||
|
#ifdef NEWCLIP
|
||||||
|
if (rendermode == render_opengl)
|
||||||
|
{
|
||||||
|
angle_t a1 = gld_FrustumAngle();
|
||||||
|
gld_clipper_Clear();
|
||||||
|
gld_clipper_SafeAddClipRange(viewangle + a1, viewangle - a1);
|
||||||
|
#ifdef HAVE_SPHEREFRUSTRUM
|
||||||
|
gld_FrustrumSetup();
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
#else
|
||||||
HWR_ClearClipSegs();
|
HWR_ClearClipSegs();
|
||||||
|
#endif
|
||||||
|
|
||||||
//04/01/2000: Hurdler: added for T&L
|
//04/01/2000: Hurdler: added for T&L
|
||||||
// Actually it only works on Walls and Planes
|
// Actually it only works on Walls and Planes
|
||||||
|
@ -5914,6 +6039,7 @@ if (0)
|
||||||
|
|
||||||
HWR_RenderBSPNode((INT32)numnodes-1, ssplayer);
|
HWR_RenderBSPNode((INT32)numnodes-1, ssplayer);
|
||||||
|
|
||||||
|
#ifndef NEWCLIP
|
||||||
// Make a viewangle int so we can render things based on mouselook
|
// Make a viewangle int so we can render things based on mouselook
|
||||||
if (player == &players[consoleplayer])
|
if (player == &players[consoleplayer])
|
||||||
viewangle = localaiming;
|
viewangle = localaiming;
|
||||||
|
@ -5944,6 +6070,7 @@ if (0)
|
||||||
|
|
||||||
dup_viewangle += ANGLE_90;
|
dup_viewangle += ANGLE_90;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
// Check for new console commands.
|
// Check for new console commands.
|
||||||
NetUpdate();
|
NetUpdate();
|
||||||
|
@ -6152,7 +6279,19 @@ if (0)
|
||||||
#ifdef SORTING
|
#ifdef SORTING
|
||||||
drawcount = 0;
|
drawcount = 0;
|
||||||
#endif
|
#endif
|
||||||
|
#ifdef NEWCLIP
|
||||||
|
if (rendermode == render_opengl)
|
||||||
|
{
|
||||||
|
angle_t a1 = gld_FrustumAngle();
|
||||||
|
gld_clipper_Clear();
|
||||||
|
gld_clipper_SafeAddClipRange(viewangle + a1, viewangle - a1);
|
||||||
|
#ifdef HAVE_SPHEREFRUSTRUM
|
||||||
|
gld_FrustrumSetup();
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
#else
|
||||||
HWR_ClearClipSegs();
|
HWR_ClearClipSegs();
|
||||||
|
#endif
|
||||||
|
|
||||||
//04/01/2000: Hurdler: added for T&L
|
//04/01/2000: Hurdler: added for T&L
|
||||||
// Actually it only works on Walls and Planes
|
// Actually it only works on Walls and Planes
|
||||||
|
@ -6162,6 +6301,7 @@ if (0)
|
||||||
|
|
||||||
HWR_RenderBSPNode((INT32)numnodes-1, ssplayer);
|
HWR_RenderBSPNode((INT32)numnodes-1, ssplayer);
|
||||||
|
|
||||||
|
#ifndef NEWCLIP
|
||||||
// Make a viewangle int so we can render things based on mouselook
|
// Make a viewangle int so we can render things based on mouselook
|
||||||
if (player == &players[consoleplayer])
|
if (player == &players[consoleplayer])
|
||||||
viewangle = localaiming;
|
viewangle = localaiming;
|
||||||
|
@ -6192,6 +6332,7 @@ if (0)
|
||||||
|
|
||||||
dup_viewangle += ANGLE_90;
|
dup_viewangle += ANGLE_90;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
// Check for new console commands.
|
// Check for new console commands.
|
||||||
NetUpdate();
|
NetUpdate();
|
||||||
|
@ -6334,7 +6475,9 @@ static inline void HWR_AddEngineCommands(void)
|
||||||
{
|
{
|
||||||
// engine state variables
|
// engine state variables
|
||||||
//CV_RegisterVar(&cv_grzbuffer);
|
//CV_RegisterVar(&cv_grzbuffer);
|
||||||
|
#ifndef NEWCLIP
|
||||||
CV_RegisterVar(&cv_grclipwalls);
|
CV_RegisterVar(&cv_grclipwalls);
|
||||||
|
#endif
|
||||||
|
|
||||||
// engine development mode variables
|
// engine development mode variables
|
||||||
// - usage may vary from version to version..
|
// - usage may vary from version to version..
|
||||||
|
|
|
@ -307,8 +307,8 @@ static md2_model_t *md2_readModel(const char *filename)
|
||||||
// initialize model and read header
|
// initialize model and read header
|
||||||
|
|
||||||
if (fread(&model->header, sizeof (model->header), 1, file) != 1
|
if (fread(&model->header, sizeof (model->header), 1, file) != 1
|
||||||
|| model->header.magic !=
|
|| model->header.magic != MD2_IDENT
|
||||||
(INT32)(('2' << 24) + ('P' << 16) + ('D' << 8) + 'I'))
|
|| model->header.version != MD2_VERSION)
|
||||||
{
|
{
|
||||||
fclose(file);
|
fclose(file);
|
||||||
free(model);
|
free(model);
|
||||||
|
@ -322,6 +322,7 @@ static md2_model_t *md2_readModel(const char *filename)
|
||||||
{ \
|
{ \
|
||||||
CONS_Alert(CONS_ERROR, "md2_readModel: %s has too many " msgname " (# found: %d, maximum: %d)\n", filename, field, max); \
|
CONS_Alert(CONS_ERROR, "md2_readModel: %s has too many " msgname " (# found: %d, maximum: %d)\n", filename, field, max); \
|
||||||
md2_freeModel (model); \
|
md2_freeModel (model); \
|
||||||
|
fclose(file); \
|
||||||
return 0; \
|
return 0; \
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -343,6 +344,7 @@ static md2_model_t *md2_readModel(const char *filename)
|
||||||
fread(model->skins, sizeof (md2_skin_t), model->header.numSkins, file))
|
fread(model->skins, sizeof (md2_skin_t), model->header.numSkins, file))
|
||||||
{
|
{
|
||||||
md2_freeModel (model);
|
md2_freeModel (model);
|
||||||
|
fclose(file);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -356,6 +358,7 @@ static md2_model_t *md2_readModel(const char *filename)
|
||||||
fread(model->texCoords, sizeof (md2_textureCoordinate_t), model->header.numTexCoords, file))
|
fread(model->texCoords, sizeof (md2_textureCoordinate_t), model->header.numTexCoords, file))
|
||||||
{
|
{
|
||||||
md2_freeModel (model);
|
md2_freeModel (model);
|
||||||
|
fclose(file);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -369,6 +372,7 @@ static md2_model_t *md2_readModel(const char *filename)
|
||||||
fread(model->triangles, sizeof (md2_triangle_t), model->header.numTriangles, file))
|
fread(model->triangles, sizeof (md2_triangle_t), model->header.numTriangles, file))
|
||||||
{
|
{
|
||||||
md2_freeModel (model);
|
md2_freeModel (model);
|
||||||
|
fclose(file);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -381,6 +385,7 @@ static md2_model_t *md2_readModel(const char *filename)
|
||||||
if (!model->frames)
|
if (!model->frames)
|
||||||
{
|
{
|
||||||
md2_freeModel (model);
|
md2_freeModel (model);
|
||||||
|
fclose(file);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -394,6 +399,7 @@ static md2_model_t *md2_readModel(const char *filename)
|
||||||
fread(frame, 1, model->header.frameSize, file))
|
fread(frame, 1, model->header.frameSize, file))
|
||||||
{
|
{
|
||||||
md2_freeModel (model);
|
md2_freeModel (model);
|
||||||
|
fclose(file);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -419,6 +425,7 @@ static md2_model_t *md2_readModel(const char *filename)
|
||||||
fread(model->glCommandBuffer, sizeof (INT32), model->header.numGlCommands, file))
|
fread(model->glCommandBuffer, sizeof (INT32), model->header.numGlCommands, file))
|
||||||
{
|
{
|
||||||
md2_freeModel (model);
|
md2_freeModel (model);
|
||||||
|
fclose(file);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -23,6 +23,11 @@
|
||||||
|
|
||||||
#include "hw_glob.h"
|
#include "hw_glob.h"
|
||||||
|
|
||||||
|
// magic number "IDP2" or 844121161
|
||||||
|
#define MD2_IDENT (INT32)(('2' << 24) + ('P' << 16) + ('D' << 8) + 'I')
|
||||||
|
// model version
|
||||||
|
#define MD2_VERSION 8
|
||||||
|
|
||||||
#define MD2_MAX_TRIANGLES 16384
|
#define MD2_MAX_TRIANGLES 16384
|
||||||
#define MD2_MAX_VERTICES 4096
|
#define MD2_MAX_VERTICES 4096
|
||||||
#define MD2_MAX_TEXCOORDS 4096
|
#define MD2_MAX_TEXCOORDS 4096
|
||||||
|
|
|
@ -397,7 +397,7 @@ static void sortStacklist(sector_t *sector)
|
||||||
i = 0;
|
i = 0;
|
||||||
finished = true;
|
finished = true;
|
||||||
|
|
||||||
while (NULL != *(list+i+1))
|
while (*(list+i+1))
|
||||||
{
|
{
|
||||||
sec1 = *(list+i);
|
sec1 = *(list+i);
|
||||||
sec2 = *(list+i+1);
|
sec2 = *(list+i+1);
|
||||||
|
@ -438,7 +438,7 @@ static double calcLineoutLength(sector_t *sector)
|
||||||
double length = 0.0L;
|
double length = 0.0L;
|
||||||
chain = sector->sectorLines;
|
chain = sector->sectorLines;
|
||||||
|
|
||||||
while (NULL != chain) // sum up lengths of all lines
|
while (chain) // sum up lengths of all lines
|
||||||
{
|
{
|
||||||
length += lineLength(chain->line);
|
length += lineLength(chain->line);
|
||||||
chain = chain->next;
|
chain = chain->next;
|
||||||
|
@ -454,7 +454,7 @@ static void calcLineouts(sector_t *sector)
|
||||||
size_t secCount = 0;
|
size_t secCount = 0;
|
||||||
sector_t *encSector = *(sector->stackList);
|
sector_t *encSector = *(sector->stackList);
|
||||||
|
|
||||||
while (NULL != encSector)
|
while (encSector)
|
||||||
{
|
{
|
||||||
if (encSector->lineoutLength < 0.0L) // if length has not yet been calculated
|
if (encSector->lineoutLength < 0.0L) // if length has not yet been calculated
|
||||||
{
|
{
|
||||||
|
@ -552,7 +552,7 @@ static boolean areBottomtexturesMissing(sector_t *thisSector)
|
||||||
if (frontSector == backSector) // skip damn renderer tricks here
|
if (frontSector == backSector) // skip damn renderer tricks here
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (frontSector == NULL || backSector == NULL)
|
if (!frontSector || !backSector)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
sider = &sides[thisElem->line->sidenum[0]];
|
sider = &sides[thisElem->line->sidenum[0]];
|
||||||
|
@ -587,67 +587,6 @@ static boolean areBottomtexturesMissing(sector_t *thisSector)
|
||||||
static boolean isCeilingFloating(sector_t *thisSector)
|
static boolean isCeilingFloating(sector_t *thisSector)
|
||||||
{
|
{
|
||||||
sector_t *adjSector, *refSector = NULL, *frontSector, *backSector;
|
sector_t *adjSector, *refSector = NULL, *frontSector, *backSector;
|
||||||
boolean floating = true;
|
|
||||||
linechain_t *thisElem, *nextElem;
|
|
||||||
|
|
||||||
if (!thisSector)
|
|
||||||
return false;
|
|
||||||
|
|
||||||
nextElem = thisSector->sectorLines;
|
|
||||||
|
|
||||||
while (NULL != nextElem) // walk through chain
|
|
||||||
{
|
|
||||||
thisElem = nextElem;
|
|
||||||
nextElem = thisElem->next;
|
|
||||||
|
|
||||||
frontSector = thisElem->line->frontsector;
|
|
||||||
backSector = thisElem->line->backsector;
|
|
||||||
|
|
||||||
if (frontSector == thisSector)
|
|
||||||
adjSector = backSector;
|
|
||||||
else
|
|
||||||
adjSector = frontSector;
|
|
||||||
|
|
||||||
if (!adjSector) // assume floating sectors have surrounding sectors
|
|
||||||
{
|
|
||||||
floating = false;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!refSector)
|
|
||||||
{
|
|
||||||
refSector = adjSector;
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
// if adjacent sector has same height or more than one adjacent sector exists -> stop
|
|
||||||
if (thisSector->ceilingheight == adjSector->ceilingheight ||
|
|
||||||
refSector != adjSector)
|
|
||||||
{
|
|
||||||
floating = false;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// now check for walltextures
|
|
||||||
if (floating)
|
|
||||||
{
|
|
||||||
if (!areToptexturesMissing(thisSector))
|
|
||||||
{
|
|
||||||
floating = false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return floating;
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
// check if no adjacent sector has same ceiling height
|
|
||||||
// FIXME: throw that together with isCeilingFloating??
|
|
||||||
//
|
|
||||||
static boolean isFloorFloating(sector_t *thisSector)
|
|
||||||
{
|
|
||||||
sector_t *adjSector, *refSector = NULL, *frontSector, *backSector;
|
|
||||||
boolean floating = true;
|
|
||||||
linechain_t *thisElem, *nextElem;
|
linechain_t *thisElem, *nextElem;
|
||||||
|
|
||||||
if (!thisSector)
|
if (!thisSector)
|
||||||
|
@ -668,36 +607,83 @@ static boolean isFloorFloating(sector_t *thisSector)
|
||||||
else
|
else
|
||||||
adjSector = frontSector;
|
adjSector = frontSector;
|
||||||
|
|
||||||
if (NULL == adjSector) // assume floating sectors have surrounding sectors
|
if (!adjSector) // assume floating sectors have surrounding sectors
|
||||||
{
|
return false;
|
||||||
floating = false;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (NULL == refSector)
|
#ifdef ESLOPE
|
||||||
|
if (adjSector->c_slope) // Don't bother with slopes
|
||||||
|
return false;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
if (!refSector)
|
||||||
{
|
{
|
||||||
refSector = adjSector;
|
refSector = adjSector;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
// if adjacent sector has same height or more than one adjacent sector exists -> stop
|
// if adjacent sector has same height or more than one adjacent sector exists -> stop
|
||||||
if (thisSector->floorheight == adjSector->floorheight ||
|
if (thisSector->ceilingheight == adjSector->ceilingheight || refSector != adjSector)
|
||||||
refSector != adjSector)
|
return false;
|
||||||
{
|
|
||||||
floating = false;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// now check for walltextures
|
// now check for walltextures
|
||||||
if (floating)
|
if (!areToptexturesMissing(thisSector))
|
||||||
|
return false;
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// check if no adjacent sector has same ceiling height
|
||||||
|
// FIXME: throw that together with isCeilingFloating??
|
||||||
|
//
|
||||||
|
static boolean isFloorFloating(sector_t *thisSector)
|
||||||
{
|
{
|
||||||
|
sector_t *adjSector, *refSector = NULL, *frontSector, *backSector;
|
||||||
|
linechain_t *thisElem, *nextElem;
|
||||||
|
|
||||||
|
if (!thisSector)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
nextElem = thisSector->sectorLines;
|
||||||
|
|
||||||
|
while (nextElem) // walk through chain
|
||||||
|
{
|
||||||
|
thisElem = nextElem;
|
||||||
|
nextElem = thisElem->next;
|
||||||
|
|
||||||
|
frontSector = thisElem->line->frontsector;
|
||||||
|
backSector = thisElem->line->backsector;
|
||||||
|
|
||||||
|
if (frontSector == thisSector)
|
||||||
|
adjSector = backSector;
|
||||||
|
else
|
||||||
|
adjSector = frontSector;
|
||||||
|
|
||||||
|
if (!adjSector) // assume floating sectors have surrounding sectors
|
||||||
|
return false;
|
||||||
|
|
||||||
|
#ifdef ESLOPE
|
||||||
|
if (adjSector->f_slope) // Don't bother with slopes
|
||||||
|
return false;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
if (!refSector)
|
||||||
|
{
|
||||||
|
refSector = adjSector;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
// if adjacent sector has same height or more than one adjacent sector exists -> stop
|
||||||
|
if (thisSector->floorheight == adjSector->floorheight || refSector != adjSector)
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// now check for walltextures
|
||||||
if (!areBottomtexturesMissing(thisSector))
|
if (!areBottomtexturesMissing(thisSector))
|
||||||
{
|
return false;
|
||||||
floating = false;
|
|
||||||
}
|
return true;
|
||||||
}
|
|
||||||
return floating;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
|
@ -707,9 +693,7 @@ static fixed_t estimateCeilHeight(sector_t *thisSector)
|
||||||
{
|
{
|
||||||
sector_t *adjSector;
|
sector_t *adjSector;
|
||||||
|
|
||||||
if (!thisSector ||
|
if (!thisSector || !thisSector->sectorLines || !thisSector->sectorLines->line)
|
||||||
!thisSector->sectorLines ||
|
|
||||||
!thisSector->sectorLines->line)
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
adjSector = thisSector->sectorLines->line->frontsector;
|
adjSector = thisSector->sectorLines->line->frontsector;
|
||||||
|
@ -729,16 +713,14 @@ static fixed_t estimateFloorHeight(sector_t *thisSector)
|
||||||
{
|
{
|
||||||
sector_t *adjSector;
|
sector_t *adjSector;
|
||||||
|
|
||||||
if (!thisSector ||
|
if (!thisSector || !thisSector->sectorLines || !thisSector->sectorLines->line)
|
||||||
!thisSector->sectorLines ||
|
|
||||||
!thisSector->sectorLines->line)
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
adjSector = thisSector->sectorLines->line->frontsector;
|
adjSector = thisSector->sectorLines->line->frontsector;
|
||||||
if (adjSector == thisSector)
|
if (adjSector == thisSector)
|
||||||
adjSector = thisSector->sectorLines->line->backsector;
|
adjSector = thisSector->sectorLines->line->backsector;
|
||||||
|
|
||||||
if (NULL == adjSector)
|
if (!adjSector)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
return adjSector->floorheight;
|
return adjSector->floorheight;
|
||||||
|
@ -845,18 +827,12 @@ void HWR_CorrectSWTricks(void)
|
||||||
// correct height of floating sectors
|
// correct height of floating sectors
|
||||||
if (isCeilingFloating(floatSector))
|
if (isCeilingFloating(floatSector))
|
||||||
{
|
{
|
||||||
fixed_t corrheight;
|
floatSector->virtualCeilingheight = estimateCeilHeight(floatSector);
|
||||||
|
|
||||||
corrheight = estimateCeilHeight(floatSector);
|
|
||||||
floatSector->virtualCeilingheight = corrheight;
|
|
||||||
floatSector->virtualCeiling = true;
|
floatSector->virtualCeiling = true;
|
||||||
}
|
}
|
||||||
if (isFloorFloating(floatSector))
|
if (isFloorFloating(floatSector))
|
||||||
{
|
{
|
||||||
fixed_t corrheight;
|
floatSector->virtualFloorheight = estimateFloorHeight(floatSector);
|
||||||
|
|
||||||
corrheight = estimateFloorHeight(floatSector);
|
|
||||||
floatSector->virtualFloorheight = corrheight;
|
|
||||||
floatSector->virtualFloor = true;
|
floatSector->virtualFloor = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
16
src/p_mobj.c
16
src/p_mobj.c
|
@ -3670,14 +3670,15 @@ boolean P_CameraThinker(player_t *player, camera_t *thiscam, boolean resetcalled
|
||||||
postimg = postimg_mirror;
|
postimg = postimg_mirror;
|
||||||
else if (player->pflags & PF_FLIPCAM && !(player->pflags & PF_NIGHTSMODE) && player->mo->eflags & MFE_VERTICALFLIP)
|
else if (player->pflags & PF_FLIPCAM && !(player->pflags & PF_NIGHTSMODE) && player->mo->eflags & MFE_VERTICALFLIP)
|
||||||
postimg = postimg_flip;
|
postimg = postimg_flip;
|
||||||
else if (player->awayviewtics)
|
else if (player->awayviewtics && player->awayviewmobj != NULL) // Camera must obviously exist
|
||||||
{
|
{
|
||||||
camera_t dummycam;
|
camera_t dummycam;
|
||||||
dummycam.subsector = player->awayviewmobj->subsector;
|
dummycam.subsector = player->awayviewmobj->subsector;
|
||||||
dummycam.x = player->awayviewmobj->x;
|
dummycam.x = player->awayviewmobj->x;
|
||||||
dummycam.y = player->awayviewmobj->y;
|
dummycam.y = player->awayviewmobj->y;
|
||||||
dummycam.z = player->awayviewmobj->z;
|
dummycam.z = player->awayviewmobj->z;
|
||||||
dummycam.height = 40*FRACUNIT; // alt view height is 20*FRACUNIT
|
//dummycam.height = 40*FRACUNIT; // alt view height is 20*FRACUNIT
|
||||||
|
dummycam.height = 0; // Why? Remote viewpoint cameras have no height.
|
||||||
// Are we in water?
|
// Are we in water?
|
||||||
if (P_CameraCheckWater(&dummycam))
|
if (P_CameraCheckWater(&dummycam))
|
||||||
postimg = postimg_water;
|
postimg = postimg_water;
|
||||||
|
@ -11712,9 +11713,6 @@ ML_NOCLIMB : Direction not controllable
|
||||||
// the bumper in 30 degree increments.
|
// the bumper in 30 degree increments.
|
||||||
mobj->threshold = (mthing->options & 15) % 12; // It loops over, etc
|
mobj->threshold = (mthing->options & 15) % 12; // It loops over, etc
|
||||||
P_SetMobjState(mobj, mobj->info->spawnstate+mobj->threshold);
|
P_SetMobjState(mobj, mobj->info->spawnstate+mobj->threshold);
|
||||||
|
|
||||||
// you can shut up now, OBJECTFLIP. And all of the other options, for that matter.
|
|
||||||
mthing->options &= ~0xF;
|
|
||||||
break;
|
break;
|
||||||
case MT_EGGCAPSULE:
|
case MT_EGGCAPSULE:
|
||||||
if (mthing->angle <= 0)
|
if (mthing->angle <= 0)
|
||||||
|
@ -11952,6 +11950,14 @@ ML_NOCLIMB : Direction not controllable
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ignore MTF_ flags and return early
|
||||||
|
if (i == MT_NIGHTSBUMPER)
|
||||||
|
{
|
||||||
|
mobj->angle = FixedAngle(mthing->angle*FRACUNIT);
|
||||||
|
mthing->mobj = mobj;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
mobj->angle = FixedAngle(mthing->angle*FRACUNIT);
|
mobj->angle = FixedAngle(mthing->angle*FRACUNIT);
|
||||||
|
|
||||||
if ((mthing->options & MTF_AMBUSH)
|
if ((mthing->options & MTF_AMBUSH)
|
||||||
|
|
|
@ -466,6 +466,7 @@ static void P_LoadSegs(lumpnum_t lumpnum)
|
||||||
//Hurdler: 04/12/2000: for now, only used in hardware mode
|
//Hurdler: 04/12/2000: for now, only used in hardware mode
|
||||||
li->lightmaps = NULL; // list of static lightmap for this seg
|
li->lightmaps = NULL; // list of static lightmap for this seg
|
||||||
}
|
}
|
||||||
|
li->pv1 = li->pv2 = NULL;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
li->angle = (SHORT(ml->angle))<<FRACBITS;
|
li->angle = (SHORT(ml->angle))<<FRACBITS;
|
||||||
|
|
|
@ -8986,8 +8986,9 @@ void P_PlayerThink(player_t *player)
|
||||||
if (player->flashcount)
|
if (player->flashcount)
|
||||||
player->flashcount--;
|
player->flashcount--;
|
||||||
|
|
||||||
if (player->awayviewtics)
|
// By the time P_MoveChaseCamera is called, this might be zero. Do not do it here.
|
||||||
player->awayviewtics--;
|
//if (player->awayviewtics)
|
||||||
|
// player->awayviewtics--;
|
||||||
|
|
||||||
/// \note do this in the cheat code
|
/// \note do this in the cheat code
|
||||||
if (player->pflags & PF_NOCLIP)
|
if (player->pflags & PF_NOCLIP)
|
||||||
|
@ -9799,6 +9800,9 @@ void P_PlayerAfterThink(player_t *player)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (player->awayviewtics)
|
||||||
|
player->awayviewtics--;
|
||||||
|
|
||||||
// spectator invisibility and nogravity.
|
// spectator invisibility and nogravity.
|
||||||
if ((netgame || multiplayer) && player->spectator)
|
if ((netgame || multiplayer) && player->spectator)
|
||||||
{
|
{
|
||||||
|
|
60
src/r_bsp.c
60
src/r_bsp.c
|
@ -365,6 +365,36 @@ sector_t *R_FakeFlat(sector_t *sec, sector_t *tempsec, INT32 *floorlightlevel,
|
||||||
return sec;
|
return sec;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
boolean R_IsEmptyLine(seg_t *line, sector_t *front, sector_t *back)
|
||||||
|
{
|
||||||
|
return (
|
||||||
|
#ifdef POLYOBJECTS
|
||||||
|
!line->polyseg &&
|
||||||
|
#endif
|
||||||
|
back->ceilingpic == front->ceilingpic
|
||||||
|
&& back->floorpic == front->floorpic
|
||||||
|
#ifdef ESLOPE
|
||||||
|
&& back->f_slope == front->f_slope
|
||||||
|
&& back->c_slope == front->c_slope
|
||||||
|
#endif
|
||||||
|
&& back->lightlevel == front->lightlevel
|
||||||
|
&& !line->sidedef->midtexture
|
||||||
|
// Check offsets too!
|
||||||
|
&& back->floor_xoffs == front->floor_xoffs
|
||||||
|
&& back->floor_yoffs == front->floor_yoffs
|
||||||
|
&& back->floorpic_angle == front->floorpic_angle
|
||||||
|
&& back->ceiling_xoffs == front->ceiling_xoffs
|
||||||
|
&& back->ceiling_yoffs == front->ceiling_yoffs
|
||||||
|
&& back->ceilingpic_angle == front->ceilingpic_angle
|
||||||
|
// Consider altered lighting.
|
||||||
|
&& back->floorlightsec == front->floorlightsec
|
||||||
|
&& back->ceilinglightsec == front->ceilinglightsec
|
||||||
|
// Consider colormaps
|
||||||
|
&& back->extra_colormap == front->extra_colormap
|
||||||
|
&& ((!front->ffloors && !back->ffloors)
|
||||||
|
|| front->tag == back->tag));
|
||||||
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// R_AddLine
|
// R_AddLine
|
||||||
// Clips the given segment and adds any visible pieces to the line list.
|
// Clips the given segment and adds any visible pieces to the line list.
|
||||||
|
@ -536,36 +566,8 @@ static void R_AddLine(seg_t *line)
|
||||||
// Identical floor and ceiling on both sides, identical light levels on both sides,
|
// Identical floor and ceiling on both sides, identical light levels on both sides,
|
||||||
// and no middle texture.
|
// and no middle texture.
|
||||||
|
|
||||||
if (
|
if (R_IsEmptyLine(line, frontsector, backsector))
|
||||||
#ifdef POLYOBJECTS
|
|
||||||
!line->polyseg &&
|
|
||||||
#endif
|
|
||||||
backsector->ceilingpic == frontsector->ceilingpic
|
|
||||||
&& backsector->floorpic == frontsector->floorpic
|
|
||||||
#ifdef ESLOPE
|
|
||||||
&& backsector->f_slope == frontsector->f_slope
|
|
||||||
&& backsector->c_slope == frontsector->c_slope
|
|
||||||
#endif
|
|
||||||
&& backsector->lightlevel == frontsector->lightlevel
|
|
||||||
&& !curline->sidedef->midtexture
|
|
||||||
// Check offsets too!
|
|
||||||
&& backsector->floor_xoffs == frontsector->floor_xoffs
|
|
||||||
&& backsector->floor_yoffs == frontsector->floor_yoffs
|
|
||||||
&& backsector->floorpic_angle == frontsector->floorpic_angle
|
|
||||||
&& backsector->ceiling_xoffs == frontsector->ceiling_xoffs
|
|
||||||
&& backsector->ceiling_yoffs == frontsector->ceiling_yoffs
|
|
||||||
&& backsector->ceilingpic_angle == frontsector->ceilingpic_angle
|
|
||||||
// Consider altered lighting.
|
|
||||||
&& backsector->floorlightsec == frontsector->floorlightsec
|
|
||||||
&& backsector->ceilinglightsec == frontsector->ceilinglightsec
|
|
||||||
// Consider colormaps
|
|
||||||
&& backsector->extra_colormap == frontsector->extra_colormap
|
|
||||||
&& ((!frontsector->ffloors && !backsector->ffloors)
|
|
||||||
|| frontsector->tag == backsector->tag))
|
|
||||||
{
|
|
||||||
return;
|
return;
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
clippass:
|
clippass:
|
||||||
R_ClipPassWallSegment(x1, x2 - 1);
|
R_ClipPassWallSegment(x1, x2 - 1);
|
||||||
|
|
|
@ -50,6 +50,7 @@ extern polyobj_t **po_ptrs; // temp ptr array to sort polyobject pointers
|
||||||
|
|
||||||
sector_t *R_FakeFlat(sector_t *sec, sector_t *tempsec, INT32 *floorlightlevel,
|
sector_t *R_FakeFlat(sector_t *sec, sector_t *tempsec, INT32 *floorlightlevel,
|
||||||
INT32 *ceilinglightlevel, boolean back);
|
INT32 *ceilinglightlevel, boolean back);
|
||||||
|
boolean R_IsEmptyLine(seg_t *line, sector_t *front, sector_t *back);
|
||||||
|
|
||||||
INT32 R_GetPlaneLight(sector_t *sector, fixed_t planeheight, boolean underside);
|
INT32 R_GetPlaneLight(sector_t *sector, fixed_t planeheight, boolean underside);
|
||||||
void R_Prep3DFloors(sector_t *sector);
|
void R_Prep3DFloors(sector_t *sector);
|
||||||
|
|
|
@ -574,6 +574,9 @@ typedef struct seg_s
|
||||||
sector_t *backsector;
|
sector_t *backsector;
|
||||||
|
|
||||||
#ifdef HWRENDER
|
#ifdef HWRENDER
|
||||||
|
// new pointers so that AdjustSegs doesn't mess with v1/v2
|
||||||
|
void *pv1; // 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
|
lightmap_t *lightmaps; // for static lightmap
|
||||||
|
|
|
@ -63,11 +63,7 @@ typedef struct floorsplat_s
|
||||||
fixed_t P_SegLength(seg_t *seg);
|
fixed_t P_SegLength(seg_t *seg);
|
||||||
|
|
||||||
// call at P_SetupLevel()
|
// call at P_SetupLevel()
|
||||||
#if !(defined (WALLSPLATS) || defined (FLOORSPLATS))
|
|
||||||
void R_ClearLevelSplats(void);
|
void R_ClearLevelSplats(void);
|
||||||
#else
|
|
||||||
void R_ClearLevelSplats(void);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef WALLSPLATS
|
#ifdef WALLSPLATS
|
||||||
void R_AddWallSplat(line_t *wallline, INT16 sectorside, const char *patchname, fixed_t top,
|
void R_AddWallSplat(line_t *wallline, INT16 sectorside, const char *patchname, fixed_t top,
|
||||||
|
|
106
src/s_sound.c
106
src/s_sound.c
|
@ -36,6 +36,7 @@ extern INT32 msg_id;
|
||||||
#include "d_main.h"
|
#include "d_main.h"
|
||||||
#include "r_sky.h" // skyflatnum
|
#include "r_sky.h" // skyflatnum
|
||||||
#include "p_local.h" // camera info
|
#include "p_local.h" // camera info
|
||||||
|
#include "m_misc.h" // for tunes command
|
||||||
|
|
||||||
#ifdef HW3SOUND
|
#ifdef HW3SOUND
|
||||||
// 3D Sound Interface
|
// 3D Sound Interface
|
||||||
|
@ -46,6 +47,8 @@ static INT32 S_AdjustSoundParams(const mobj_t *listener, const mobj_t *source, I
|
||||||
|
|
||||||
CV_PossibleValue_t soundvolume_cons_t[] = {{0, "MIN"}, {31, "MAX"}, {0, NULL}};
|
CV_PossibleValue_t soundvolume_cons_t[] = {{0, "MIN"}, {31, "MAX"}, {0, NULL}};
|
||||||
static void SetChannelsNum(void);
|
static void SetChannelsNum(void);
|
||||||
|
static void Command_Tunes_f(void);
|
||||||
|
static void Command_RestartAudio_f(void);
|
||||||
|
|
||||||
// commands for music and sound servers
|
// commands for music and sound servers
|
||||||
#ifdef MUSSERV
|
#ifdef MUSSERV
|
||||||
|
@ -91,6 +94,7 @@ consvar_t cv_numChannels = {"snd_channels", "64", CV_SAVE|CV_CALL, CV_Unsigned,
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
consvar_t surround = {"surround", "Off", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL};
|
consvar_t surround = {"surround", "Off", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||||
|
consvar_t cv_resetmusic = {"resetmusic", "No", CV_SAVE|CV_NOSHOWHELP, CV_YesNo, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||||
|
|
||||||
#define S_MAX_VOLUME 127
|
#define S_MAX_VOLUME 127
|
||||||
|
|
||||||
|
@ -245,6 +249,11 @@ void S_RegisterSoundStuff(void)
|
||||||
#endif
|
#endif
|
||||||
CV_RegisterVar(&surround);
|
CV_RegisterVar(&surround);
|
||||||
CV_RegisterVar(&cv_samplerate);
|
CV_RegisterVar(&cv_samplerate);
|
||||||
|
CV_RegisterVar(&cv_resetmusic);
|
||||||
|
|
||||||
|
COM_AddCommand("tunes", Command_Tunes_f);
|
||||||
|
COM_AddCommand("restartaudio", Command_RestartAudio_f);
|
||||||
|
|
||||||
|
|
||||||
#if defined (macintosh) && !defined (HAVE_SDL) // mp3 playlist stuff
|
#if defined (macintosh) && !defined (HAVE_SDL) // mp3 playlist stuff
|
||||||
{
|
{
|
||||||
|
@ -1816,3 +1825,100 @@ void S_Start(void)
|
||||||
S_StopMusic();
|
S_StopMusic();
|
||||||
S_ChangeMusic(mapmusname, mapmusflags, true);
|
S_ChangeMusic(mapmusname, mapmusflags, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void Command_Tunes_f(void)
|
||||||
|
{
|
||||||
|
const char *tunearg;
|
||||||
|
UINT16 tunenum, track = 0;
|
||||||
|
const size_t argc = COM_Argc();
|
||||||
|
|
||||||
|
if (argc < 2) //tunes slot ...
|
||||||
|
{
|
||||||
|
CONS_Printf("tunes <name/num> [track] [speed] / <-show> / <-default> / <-none>:\n");
|
||||||
|
CONS_Printf(M_GetText("Play an arbitrary music lump. If a map number is used, 'MAP##M' is played.\n"));
|
||||||
|
CONS_Printf(M_GetText("If the format supports multiple songs, you can specify which one to play.\n\n"));
|
||||||
|
CONS_Printf(M_GetText("* With \"-show\", shows the currently playing tune and track.\n"));
|
||||||
|
CONS_Printf(M_GetText("* With \"-default\", returns to the default music for the map.\n"));
|
||||||
|
CONS_Printf(M_GetText("* With \"-none\", any music playing will be stopped.\n"));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
tunearg = COM_Argv(1);
|
||||||
|
tunenum = (UINT16)atoi(tunearg);
|
||||||
|
track = 0;
|
||||||
|
|
||||||
|
if (!strcasecmp(tunearg, "-show"))
|
||||||
|
{
|
||||||
|
CONS_Printf(M_GetText("The current tune is: %s [track %d]\n"),
|
||||||
|
mapmusname, (mapmusflags & MUSIC_TRACKMASK));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (!strcasecmp(tunearg, "-none"))
|
||||||
|
{
|
||||||
|
S_StopMusic();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
else if (!strcasecmp(tunearg, "-default"))
|
||||||
|
{
|
||||||
|
tunearg = mapheaderinfo[gamemap-1]->musname;
|
||||||
|
track = mapheaderinfo[gamemap-1]->mustrack;
|
||||||
|
}
|
||||||
|
else if (!tunearg[2] && toupper(tunearg[0]) >= 'A' && toupper(tunearg[0]) <= 'Z')
|
||||||
|
tunenum = (UINT16)M_MapNumber(tunearg[0], tunearg[1]);
|
||||||
|
|
||||||
|
if (tunenum && tunenum >= 1036)
|
||||||
|
{
|
||||||
|
CONS_Alert(CONS_NOTICE, M_GetText("Valid music slots are 1 to 1035.\n"));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (!tunenum && strlen(tunearg) > 6) // This is automatic -- just show the error just in case
|
||||||
|
CONS_Alert(CONS_NOTICE, M_GetText("Music name too long - truncated to six characters.\n"));
|
||||||
|
|
||||||
|
if (argc > 2)
|
||||||
|
track = (UINT16)atoi(COM_Argv(2))-1;
|
||||||
|
|
||||||
|
if (tunenum)
|
||||||
|
snprintf(mapmusname, 7, "%sM", G_BuildMapName(tunenum));
|
||||||
|
else
|
||||||
|
strncpy(mapmusname, tunearg, 7);
|
||||||
|
mapmusname[6] = 0;
|
||||||
|
mapmusflags = (track & MUSIC_TRACKMASK);
|
||||||
|
|
||||||
|
S_ChangeMusic(mapmusname, mapmusflags, true);
|
||||||
|
|
||||||
|
if (argc > 3)
|
||||||
|
{
|
||||||
|
float speed = (float)atof(COM_Argv(3));
|
||||||
|
if (speed > 0.0f)
|
||||||
|
S_SpeedMusic(speed);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static void Command_RestartAudio_f(void)
|
||||||
|
{
|
||||||
|
if (dedicated) // No point in doing anything if game is a dedicated server.
|
||||||
|
return;
|
||||||
|
|
||||||
|
S_StopMusic();
|
||||||
|
S_StopSounds();
|
||||||
|
I_ShutdownMusic();
|
||||||
|
I_ShutdownSound();
|
||||||
|
I_StartupSound();
|
||||||
|
I_InitMusic();
|
||||||
|
|
||||||
|
// These must be called or no sound and music until manually set.
|
||||||
|
|
||||||
|
I_SetSfxVolume(cv_soundvolume.value);
|
||||||
|
#ifdef NO_MIDI
|
||||||
|
S_SetMusicVolume(cv_digmusicvolume.value, -1);
|
||||||
|
#else
|
||||||
|
S_SetMusicVolume(cv_digmusicvolume.value, cv_midimusicvolume.value);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
S_StartSound(NULL, sfx_strpst);
|
||||||
|
|
||||||
|
if (Playing()) // Gotta make sure the player is in a level
|
||||||
|
P_RestoreMusic(&players[consoleplayer]);
|
||||||
|
else
|
||||||
|
S_ChangeMusicInternal("titles", looptitle);
|
||||||
|
}
|
||||||
|
|
|
@ -27,6 +27,7 @@ extern consvar_t stereoreverse;
|
||||||
extern consvar_t cv_soundvolume, cv_digmusicvolume;//, cv_midimusicvolume;
|
extern consvar_t cv_soundvolume, cv_digmusicvolume;//, cv_midimusicvolume;
|
||||||
extern consvar_t cv_numChannels;
|
extern consvar_t cv_numChannels;
|
||||||
extern consvar_t surround;
|
extern consvar_t surround;
|
||||||
|
extern consvar_t cv_resetmusic;
|
||||||
|
|
||||||
#ifdef SNDSERV
|
#ifdef SNDSERV
|
||||||
extern consvar_t sndserver_cmd, sndserver_arg;
|
extern consvar_t sndserver_cmd, sndserver_arg;
|
||||||
|
|
|
@ -71,11 +71,7 @@ consvar_t cv_scr_depth = {"scr_depth", "16 bits", CV_SAVE, scr_depth_cons_t, NUL
|
||||||
#endif
|
#endif
|
||||||
consvar_t cv_renderview = {"renderview", "On", 0, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL};
|
consvar_t cv_renderview = {"renderview", "On", 0, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||||
|
|
||||||
#ifdef DIRECTFULLSCREEN
|
|
||||||
static void SCR_ChangeFullscreen (void);
|
static void SCR_ChangeFullscreen (void);
|
||||||
#else
|
|
||||||
static void SCR_ChangeFullscreen (void);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
consvar_t cv_fullscreen = {"fullscreen", "Yes", CV_SAVE|CV_CALL, CV_YesNo, SCR_ChangeFullscreen, 0, NULL, NULL, 0, 0, NULL};
|
consvar_t cv_fullscreen = {"fullscreen", "Yes", CV_SAVE|CV_CALL, CV_YesNo, SCR_ChangeFullscreen, 0, NULL, NULL, 0, 0, NULL};
|
||||||
|
|
||||||
|
|
|
@ -1,8 +1,11 @@
|
||||||
// Emacs style mode select -*- C++ -*-
|
// Emacs style mode select -*- C++ -*-
|
||||||
|
//
|
||||||
|
// SONIC ROBO BLAST 2
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
//
|
//
|
||||||
// Copyright (C) 1993-1996 by id Software, Inc.
|
// Copyright (C) 1993-1996 by id Software, Inc.
|
||||||
// Portions Copyright (C) 1998-2000 by DooM Legacy Team.
|
// Portions Copyright (C) 1998-2000 by DooM Legacy Team.
|
||||||
|
// Copyright (C) 2014-2018 by Sonic Team Junior.
|
||||||
//
|
//
|
||||||
// This program is free software; you can redistribute it and/or
|
// This program is free software; you can redistribute it and/or
|
||||||
// modify it under the terms of the GNU General Public License
|
// modify it under the terms of the GNU General Public License
|
||||||
|
@ -2589,7 +2592,7 @@ void I_Tactile4(FFType pFFType, const JoyFF_t *FFEffect)
|
||||||
*/
|
*/
|
||||||
static ticcmd_t emptycmd;
|
static ticcmd_t emptycmd;
|
||||||
|
|
||||||
FUNCMATH ticcmd_t *I_BaseTiccmd(void)
|
ticcmd_t *I_BaseTiccmd(void)
|
||||||
{
|
{
|
||||||
return &emptycmd;
|
return &emptycmd;
|
||||||
}
|
}
|
||||||
|
@ -2598,7 +2601,7 @@ FUNCMATH ticcmd_t *I_BaseTiccmd(void)
|
||||||
*/
|
*/
|
||||||
static ticcmd_t emptycmd2;
|
static ticcmd_t emptycmd2;
|
||||||
|
|
||||||
FUNCMATH ticcmd_t *I_BaseTiccmd2(void)
|
ticcmd_t *I_BaseTiccmd2(void)
|
||||||
{
|
{
|
||||||
return &emptycmd2;
|
return &emptycmd2;
|
||||||
}
|
}
|
||||||
|
@ -2607,7 +2610,7 @@ FUNCMATH ticcmd_t *I_BaseTiccmd2(void)
|
||||||
*/
|
*/
|
||||||
static ticcmd_t emptycmd3;
|
static ticcmd_t emptycmd3;
|
||||||
|
|
||||||
FUNCMATH ticcmd_t *I_BaseTiccmd3(void)
|
ticcmd_t *I_BaseTiccmd3(void)
|
||||||
{
|
{
|
||||||
return &emptycmd3;
|
return &emptycmd3;
|
||||||
}
|
}
|
||||||
|
@ -2616,7 +2619,7 @@ FUNCMATH ticcmd_t *I_BaseTiccmd3(void)
|
||||||
*/
|
*/
|
||||||
static ticcmd_t emptycmd4;
|
static ticcmd_t emptycmd4;
|
||||||
|
|
||||||
FUNCMATH ticcmd_t *I_BaseTiccmd4(void)
|
ticcmd_t *I_BaseTiccmd4(void)
|
||||||
{
|
{
|
||||||
return &emptycmd4;
|
return &emptycmd4;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,8 +1,10 @@
|
||||||
// Emacs style mode select -*- C++ -*-
|
// Emacs style mode select -*- C++ -*-
|
||||||
|
// SONIC ROBO BLAST 2
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
//
|
//
|
||||||
// Copyright (C) 1993-1996 by id Software, Inc.
|
// Copyright (C) 1993-1996 by id Software, Inc.
|
||||||
// Portions Copyright (C) 1998-2000 by DooM Legacy Team.
|
// Portions Copyright (C) 1998-2000 by DooM Legacy Team.
|
||||||
|
// Copyright (C) 2014-2018 by Sonic Team Junior.
|
||||||
//
|
//
|
||||||
// This program is free software; you can redistribute it and/or
|
// This program is free software; you can redistribute it and/or
|
||||||
// modify it under the terms of the GNU General Public License
|
// modify it under the terms of the GNU General Public License
|
||||||
|
@ -1116,7 +1118,7 @@ void I_SetPalette(RGBA_t *palette)
|
||||||
}
|
}
|
||||||
|
|
||||||
// return number of fullscreen + X11 modes
|
// return number of fullscreen + X11 modes
|
||||||
FUNCMATH INT32 VID_NumModes(void)
|
INT32 VID_NumModes(void)
|
||||||
{
|
{
|
||||||
if (USE_FULLSCREEN && numVidModes != -1)
|
if (USE_FULLSCREEN && numVidModes != -1)
|
||||||
return numVidModes - firstEntry;
|
return numVidModes - firstEntry;
|
||||||
|
@ -1124,7 +1126,7 @@ FUNCMATH INT32 VID_NumModes(void)
|
||||||
return MAXWINMODES;
|
return MAXWINMODES;
|
||||||
}
|
}
|
||||||
|
|
||||||
FUNCMATH const char *VID_GetModeName(INT32 modeNum)
|
const char *VID_GetModeName(INT32 modeNum)
|
||||||
{
|
{
|
||||||
#if 0
|
#if 0
|
||||||
if (USE_FULLSCREEN && numVidModes != -1) // fullscreen modes
|
if (USE_FULLSCREEN && numVidModes != -1) // fullscreen modes
|
||||||
|
@ -1154,7 +1156,7 @@ FUNCMATH const char *VID_GetModeName(INT32 modeNum)
|
||||||
return &vidModeName[modeNum][0];
|
return &vidModeName[modeNum][0];
|
||||||
}
|
}
|
||||||
|
|
||||||
FUNCMATH INT32 VID_GetModeForSize(INT32 w, INT32 h)
|
INT32 VID_GetModeForSize(INT32 w, INT32 h)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
for (i = 0; i < MAXWINMODES; i++)
|
for (i = 0; i < MAXWINMODES; i++)
|
||||||
|
|
|
@ -1,3 +1,11 @@
|
||||||
|
// SONIC ROBO BLAST 2
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
// Copyright (C) 2014-2018 by Sonic Team Junior.
|
||||||
|
//
|
||||||
|
// This program is free software distributed under the
|
||||||
|
// terms of the GNU General Public License, version 2.
|
||||||
|
// See the 'LICENSE' file for more details.
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
/// \file
|
/// \file
|
||||||
/// \brief SDL Mixer interface for sound
|
/// \brief SDL Mixer interface for sound
|
||||||
|
|
||||||
|
@ -503,7 +511,7 @@ static void mix_gme(void *udata, Uint8 *stream, int len)
|
||||||
/// Music System
|
/// Music System
|
||||||
/// ------------------------
|
/// ------------------------
|
||||||
|
|
||||||
FUNCMATH void I_InitMusic(void)
|
void I_InitMusic(void)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -219,7 +219,7 @@ static void Snd_UnlockAudio(void) //Alam: Unlock audio data and reinstall audio
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
FUNCMATH static inline Uint16 Snd_LowerRate(Uint16 sr)
|
static inline Uint16 Snd_LowerRate(Uint16 sr)
|
||||||
{
|
{
|
||||||
if (sr <= audio.freq) // already lowered rate?
|
if (sr <= audio.freq) // already lowered rate?
|
||||||
return sr; // good then
|
return sr; // good then
|
||||||
|
|
|
@ -1,3 +1,11 @@
|
||||||
|
// SONIC ROBO BLAST 2
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
// Copyright (C) 2008-2018 by Sonic Team Junior.
|
||||||
|
//
|
||||||
|
// This program is free software distributed under the
|
||||||
|
// terms of the GNU General Public License, version 2.
|
||||||
|
// See the 'LICENSE' file for more details.
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
/// \file
|
/// \file
|
||||||
/// \brief SDL Mixer interface for sound
|
/// \brief SDL Mixer interface for sound
|
||||||
|
|
||||||
|
|
|
@ -236,7 +236,7 @@ static void Snd_UnlockAudio(void) //Alam: Unlock audio data and reinstall audio
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
FUNCMATH static inline Uint16 Snd_LowerRate(Uint16 sr)
|
static inline Uint16 Snd_LowerRate(Uint16 sr)
|
||||||
{
|
{
|
||||||
if (sr <= audio.freq) // already lowered rate?
|
if (sr <= audio.freq) // already lowered rate?
|
||||||
return sr; // good then
|
return sr; // good then
|
||||||
|
|
Loading…
Reference in a new issue